Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea27327
commit 0f8b811
Showing
10 changed files
with
90 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { PyScript } from "pyscript-solid"; | ||
import { PyScript, PyScriptProvider } from "pyscript-solid"; | ||
import type { Component } from "solid-js"; | ||
|
||
const App: Component = () => { | ||
return <PyScript src="hello.py" />; | ||
return ( | ||
<PyScriptProvider> | ||
<PyScript src="hello.py" /> | ||
</PyScriptProvider> | ||
); | ||
}; | ||
|
||
export default App; |
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,8 +1,12 @@ | ||
import type { Component } from "solid-js"; | ||
import { PyScript } from "pyscript-solid"; | ||
import { PyScript, PyScriptProvider } from "pyscript-solid"; | ||
|
||
const App: Component = () => { | ||
return <PyScript>print("Hello World")</PyScript>; | ||
return ( | ||
<PyScriptProvider> | ||
<PyScript>print("Hello World")</PyScript> | ||
</PyScriptProvider> | ||
); | ||
}; | ||
|
||
export default App; |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { JSX } from "solid-js"; | ||
import { Link, MetaProvider } from "solid-meta"; | ||
import { Component } from "solid-js"; | ||
import { createScriptLoader } from "@solid-primitives/script-loader"; | ||
|
||
interface PyScriptProviderProperties { | ||
children: JSX.Element; | ||
jsSource?: string; | ||
cssSource?: string; | ||
} | ||
|
||
export const PyScriptProvider: Component<PyScriptProviderProperties> = ( | ||
props, | ||
) => { | ||
createScriptLoader({ | ||
src: props.jsSource || "https://pyscript.net/alpha/pyscript.js", | ||
}); | ||
|
||
return ( | ||
<> | ||
<MetaProvider> | ||
<Link | ||
rel="stylesheet" | ||
href={props.cssSource || "https://pyscript.net/alpha/pyscript.css"} | ||
/> | ||
</MetaProvider> | ||
{props.children} | ||
</> | ||
); | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.