-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): revise environment provider
- Loading branch information
1 parent
e072245
commit d79adbc
Showing
29 changed files
with
92 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
packages/react/src/providers/environment/examples/basic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
import Frame from 'react-frame-component' | ||
import { Environment, useEnvironmentContext } from '../' | ||
import { EnvironmentProvider } from '../' | ||
import { Usage } from './usage' | ||
|
||
export const Basic = () => { | ||
return ( | ||
<Frame title="IFrame Context" width="100%" height="300px"> | ||
<Environment> | ||
<PrintEnvironment /> | ||
</Environment> | ||
<EnvironmentProvider> | ||
<Usage /> | ||
</EnvironmentProvider> | ||
</Frame> | ||
) | ||
} | ||
|
||
const PrintEnvironment = () => { | ||
const { getRootNode } = useEnvironmentContext() | ||
|
||
return <pre>{JSON.stringify(getRootNode(), null, 2)}</pre> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import Frame from 'react-frame-component' | ||
import { Environment } from '../' | ||
import { EnvironmentProvider } from '../' | ||
|
||
export const App = () => { | ||
return ( | ||
<Frame title="IFrame Context"> | ||
<Environment>{/* Your App */}</Environment> | ||
<EnvironmentProvider>{/* Your App */}</EnvironmentProvider> | ||
</Frame> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/solid/src/providers/environment/environment.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
packages/solid/src/providers/environment/examples/basic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { Environment, useEnvironmentContext } from '../..' | ||
import { EnvironmentProvider } from '../..' | ||
import { Usage } from './usage' | ||
|
||
export const Basic = () => ( | ||
<Environment> | ||
<PrintEnvironment /> | ||
</Environment> | ||
<EnvironmentProvider> | ||
<Usage /> | ||
</EnvironmentProvider> | ||
) | ||
|
||
const PrintEnvironment = () => { | ||
const environment = useEnvironmentContext() | ||
|
||
return <pre>{JSON.stringify(environment().getRootNode(), null, 2)}</pre> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { Environment } from '../..' | ||
import { EnvironmentProvider } from '../..' | ||
|
||
export const App = () => { | ||
return ( | ||
<iframe title="IFrame Context"> | ||
<Environment>{/* Your App */}</Environment> | ||
<EnvironmentProvider>{/* Your App */}</EnvironmentProvider> | ||
</iframe> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<script setup lang="ts"> | ||
import Environment from '../environment.vue' | ||
import { EnvironmentProvider } from '..' | ||
import Usage from './usage.vue' | ||
</script> | ||
|
||
<template> | ||
<Environment> | ||
<EnvironmentProvider> | ||
<Usage /> | ||
</Environment> | ||
</EnvironmentProvider> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<script setup lang="ts"> | ||
import { Environment } from '../' | ||
import { EnvironmentProvider } from '../' | ||
</script> | ||
|
||
<template> | ||
<iframe title="IFrame Context"> | ||
<Environment><!-- Your App --></Environment> | ||
<EnvironmentProvider><!-- Your App --></EnvironmentProvider> | ||
</iframe> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"Environment": { | ||
"EnvironmentProvider": { | ||
"props": { "value": { "type": "RootNode | (() => RootNode)", "isRequired": false } } | ||
} | ||
} |
Oops, something went wrong.