Skip to content

Commit

Permalink
Gatsby4.17 (#211)
Browse files Browse the repository at this point in the history
* updated deps

* fix for microsoft/jacdac#1173
  • Loading branch information
pelikhan authored Jun 28, 2022
1 parent 309cc9a commit 6d9cb8f
Show file tree
Hide file tree
Showing 6 changed files with 504 additions and 474 deletions.
2 changes: 1 addition & 1 deletion jacdac-python
58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"@mdx-js/react": "^1.6.22",
"@microsoft/applicationinsights-web": "^2.8.4",
"@mui/icons-material": "^5.8.4",
"@mui/lab": "^5.0.0-alpha.86",
"@mui/material": "^5.8.4",
"@mui/lab": "^5.0.0-alpha.88",
"@mui/material": "^5.8.6",
"@octokit/core": "^3.6.0",
"@parcel/transformer-typescript-types": "^2.6.1",
"@react-three/drei": "^9.13.2",
"@parcel/transformer-typescript-types": "^2.6.2",
"@react-three/drei": "^9.14.3",
"@react-three/fiber": "^8.0.27",
"@tensorflow/tfjs": "3.8.0",
"@tidyjs/tidy": "^2.4.5",
Expand All @@ -36,8 +36,8 @@
"@types/w3c-web-usb": "^1.0.6",
"@types/web-bluetooth": "^0.0.14",
"@types/wicg-file-system-access": "^2020.9.5",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"accessible-nprogress": "^2.1.2",
"assert": "^2.0.0",
"blockly": "^6.20210701.0",
Expand All @@ -48,35 +48,35 @@
"d3-array": "^3.1.6",
"dns-packet": "^5.4.0",
"eslint": "^8.18.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.30.0",
"gatsby": "^4.16.0",
"gatsby-plugin-catch-links": "^4.16.0",
"gatsby-plugin-image": "^2.16.1",
"gatsby-plugin-manifest": "^4.16.0",
"gatsby-plugin-mdx": "^3.16.1",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-react": "^7.30.1",
"gatsby": "^4.17.1",
"gatsby-plugin-catch-links": "^4.17.0",
"gatsby-plugin-image": "^2.17.0",
"gatsby-plugin-manifest": "^4.17.0",
"gatsby-plugin-mdx": "^3.17.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^5.16.0",
"gatsby-plugin-react-helmet": "^5.16.0",
"gatsby-plugin-offline": "^5.17.0",
"gatsby-plugin-react-helmet": "^5.17.0",
"gatsby-plugin-robots-txt": "^1.7.1",
"gatsby-plugin-sharp": "^4.16.1",
"gatsby-plugin-sitemap": "^5.16.0",
"gatsby-plugin-sharp": "^4.17.0",
"gatsby-plugin-sitemap": "^5.17.0",
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.27",
"gatsby-prismjs-dracula": "^0.1.15",
"gatsby-remark-autolink-headers": "^5.16.0",
"gatsby-remark-embed-snippet": "^7.16.0",
"gatsby-remark-autolink-headers": "^5.17.0",
"gatsby-remark-embed-snippet": "^7.17.0",
"gatsby-remark-external-links": "0.0.4",
"gatsby-remark-images": "^6.16.0",
"gatsby-remark-images": "^6.17.0",
"gatsby-remark-makecode": "^1.0.24",
"gatsby-remark-static-images": "^1.2.1",
"gatsby-source-filesystem": "^4.16.0",
"gatsby-source-filesystem": "^4.17.0",
"gatsby-theme-material-ui": "^5.2.0",
"gatsby-transformer-csv": "^4.16.0",
"gatsby-transformer-javascript-frontmatter": "^4.16.0",
"gatsby-transformer-json": "^4.16.0",
"gatsby-transformer-csv": "^4.17.0",
"gatsby-transformer-javascript-frontmatter": "^4.17.0",
"gatsby-transformer-json": "^4.17.0",
"gatsby-transformer-plaintext": "^2.0.0",
"gatsby-transformer-remark": "^5.16.0",
"gatsby-transformer-sharp": "^4.16.0",
"gatsby-transformer-remark": "^5.17.0",
"gatsby-transformer-sharp": "^4.17.0",
"gltfjsx": "^4.6.4",
"howler": "^2.2.3",
"is-svg": "^4.3.2",
Expand All @@ -94,20 +94,20 @@
"prism-react-renderer": "^1.3.3",
"prismjs": "^1.28.0",
"prop-types": "^15.8.1",
"puppeteer": "^14.4.1",
"puppeteer": "^15.1.1",
"qrcode": "^1.5.0",
"react": "^18.2.0",
"react-blockly": "^7.0.1",
"react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-draggable": "^4.4.5",
"react-helmet": "^6.1.0",
"react-intersection-observer": "^9.3.3",
"react-intersection-observer": "^9.3.4",
"react-markdown": "^8.0.3",
"react-minisearch": "^5.0.0",
"react-piano": "^3.1.3",
"react-player": "^2.10.1",
"react-simple-keyboard": "^3.4.157",
"react-simple-keyboard": "^3.4.163",
"react-vega": "^7.5.1",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.7",
Expand Down
31 changes: 6 additions & 25 deletions src/components/specification/ServiceSpecificationSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import TabPanel from "../ui/TabPanel"
import Snippet from "../ui/Snippet"
import { converters } from "../../../jacdac-ts/jacdac-spec/spectool/jdspec"
import ServiceSpecification from "./ServiceSpecification"
import { serviceSpecificationToServiceTwinSpecification } from "../../../jacdac-ts/src/azure-iot/devicetwin"
import { withPrefix } from "gatsby"

export default function ServiceSpecificationSource(props: {
classIdentifier?: number
Expand All @@ -20,7 +18,6 @@ export default function ServiceSpecificationSource(props: {
serviceSpecification ||
serviceSpecificationFromClassIdentifier(classIdentifier)
const convs = converters()
const showDeviceTwin = spec && spec?.camelName !== "sytem"

const handleTabChange = (
event: React.ChangeEvent<unknown>,
Expand All @@ -39,11 +36,9 @@ export default function ServiceSpecificationSource(props: {
>
{[
showSpecification && "Specification",
"MakeCode",
"TypeScript",
"C",
"JSON",
showDeviceTwin && "Twin",
]
.filter(n => !!n)
.map(n => (
Expand All @@ -55,30 +50,16 @@ export default function ServiceSpecificationSource(props: {
<ServiceSpecification service={spec} />
</TabPanel>
)}
{["sts", "ts", "c", "json"].map(lang => (
{["ts", "c", "json"].map(lang => (
<TabPanel key={`conv${lang}`} value={tab} index={index++}>
<Snippet value={() => convs[lang](spec)} mode={lang} />
</TabPanel>
))}
{showDeviceTwin && (
<TabPanel key="devicetwin" value={tab} index={index++}>
<Snippet
mode="json"
url={withPrefix(
`/services/twin/x${spec.classIdentifier.toString(
16
)}.json`
)}
value={JSON.stringify(
serviceSpecificationToServiceTwinSpecification(
spec
),
null,
2
)}
copy={true}
value={() => convs[lang](spec)}
mode={lang}
download={`service.${lang}`}
/>
</TabPanel>
)}
))}
</Paper>
)
}
14 changes: 11 additions & 3 deletions src/components/tools/ServiceSpecificationEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import RandomGenerator from "../RandomGenerator"
import useLocalStorage from "../hooks/useLocalStorage"
import HighlightTextField from "../ui/HighlightTextField"
import ServiceSpecification from "../specification/ServiceSpecification"
import ServiceSpecificationSource from "../specification/ServiceSpecificationSource"

const SERVICE_SPECIFICATION_STORAGE_KEY =
"jacdac:servicespecificationeditorsource"
Expand All @@ -27,7 +28,7 @@ export default function ServiceSpecificationEditor() {
`0x${json.classIdentifier.toString(16)}`
).toLowerCase()}`
return (
<Grid spacing={1} container>
<Grid spacing={2} container>
<Grid item xs={12}>
<HighlightTextField
code={source}
Expand All @@ -39,10 +40,17 @@ export default function ServiceSpecificationEditor() {
pullRequestDescription={`This pull request defines a new service.`}
/>
</Grid>
<Grid item>
<Grid item xs={12}>
<RandomGenerator device={false} />
{json && <ServiceSpecification service={json} />}
</Grid>
{json && (
<Grid item xs={12}>
<ServiceSpecificationSource
serviceSpecification={json}
showSpecification={true}
/>
</Grid>
)}
</Grid>
)
}
4 changes: 3 additions & 1 deletion src/components/ui/Snippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export default function Snippet(props: {
actions?: ReactNode
url?: string
caption?: string | JSX.Element | JSX.Element[]
copy?: boolean
}) {
const { value, mode, download, url, caption, actions } = props
const { value, mode, download, url, caption, actions, copy } = props
const v: string = typeof value === "function" ? value() : value
const className = mode && `language-${mode === "sts" ? "ts" : mode}`
return (
Expand All @@ -21,6 +22,7 @@ export default function Snippet(props: {
downloadText={download && v}
actions={actions}
url={url}
copy={copy}
>
{v}
</CodeBlock>
Expand Down
Loading

0 comments on commit 6d9cb8f

Please sign in to comment.