Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 43
docs: v3 docs structure#479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
29771e64a3bc18ae008282815551f215f86a43c1d8f6494675cfdf6d2c526ffa9d76ec09208d3b61a2e080a80267531a18c608cf4710b83cf0014f0016fc3d963d91fdda23fcd7b5e4ee087eb8617275e6ff351022de9b963d5c612fd667eb9e61931a2a102847a11eec146453ebe44ff84787007209d716d96b125822c8192910fdb39b213dc70c72a1cbbb2fe949a7d880b08c059c5790de90014cbbe135684299c6b5a0fdcf9c2e229b36b9d4534bd1637277f9660111abbFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [submodule "code-repos/zenstackhq/v3-doc-orm"] | ||
| path = code-repos/zenstackhq/v3-doc-orm | ||
| url = https://github.com/zenstackhq/v3-doc-orm.git | ||
| [submodule "code-repos/zenstackhq/v3-doc-orm-computed-fields"] | ||
| path = code-repos/zenstackhq/v3-doc-orm-computed-fields | ||
| url = https://github.com/zenstackhq/v3-doc-orm-computed-fields.git | ||
| [submodule "code-repos/zenstackhq/v3-doc-orm-computed-polymorphism"] | ||
| path = code-repos/zenstackhq/v3-doc-orm-computed-polymorphism | ||
| url = https://github.com/zenstackhq/v3-doc-orm-polymorphism.git | ||
| [submodule "code-repos/zenstackhq/v3-doc-orm-typed-json"] | ||
| path = code-repos/zenstackhq/v3-doc-orm-typed-json | ||
| url = https://github.com/zenstackhq/v3-doc-orm-typed-json.git | ||
| [submodule "code-repos/zenstackhq/v3-doc-quick-start"] | ||
| path = code-repos/zenstackhq/v3-doc-quick-start | ||
| url = https://github.com/zenstackhq/v3-doc-quick-start.git | ||
| [submodule "code-repos/zenstackhq/v3-doc-orm-polymorphism"] | ||
| path = code-repos/zenstackhq/v3-doc-orm-polymorphism | ||
| url = https://github.com/zenstackhq/v3-doc-orm-polymorphism.git |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import CodeBlock from '@theme/CodeBlock'; | ||
| interface GithubCodeBlockProps { | ||
| repoPath: string; | ||
| file: string; | ||
| } | ||
| const GithubCodeBlock: React.FC<GithubCodeBlockProps> = ({ repoPath, file }) => { | ||
| const code = require(`!!raw-loader!@site/code-repos/${repoPath}/${file}`).default; | ||
| const getLanguage = (file: string): string => { | ||
| if (file.endsWith('.ts')) { | ||
| return 'typescript'; | ||
| } else if (file.endsWith('.zmodel')) { | ||
| return 'zmodel'; | ||
| } else { | ||
| return 'plaintext'; | ||
| } | ||
| }; | ||
| return ( | ||
| <CodeBlock language={getLanguage(file)} title={file}> | ||
| {code} | ||
| </CodeBlock> | ||
| ); | ||
| }; | ||
| export default GithubCodeBlock; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import React, { useEffect, useRef } from 'react'; | ||
| import sdk from '@stackblitz/sdk'; | ||
| interface StackBlitzEmbedProps { | ||
| projectId: string; | ||
| height?: string; | ||
| } | ||
| const StackBlitzEmbed: React.FC<StackBlitzEmbedProps> = ({ projectId, height = '600px' }) => { | ||
| const containerRef = useRef<HTMLDivElement>(null); | ||
| useEffect(() => { | ||
| if (containerRef.current) { | ||
| sdk.embedProjectId(containerRef.current, projectId, { | ||
| openFile: 'main.ts', | ||
| height, | ||
| view: 'editor', | ||
| forceEmbedLayout: true, | ||
| }); | ||
| } | ||
| }, [projectId, height]); | ||
| return <div ref={containerRef} style={{ width: '100%', height }} />; | ||
| }; | ||
| export default StackBlitzEmbed; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import sdk from '@stackblitz/sdk'; | ||
| import React from 'react'; | ||
| import GithubCodeBlock from './GithubCodeBlock'; | ||
| interface StackBlitzGithubProps { | ||
| repoPath: string; | ||
| openFile?: string; | ||
| codeFiles?: string[]; | ||
| startScript?: string; | ||
| } | ||
| const StackBlitzGithub: React.FC<StackBlitzGithubProps> = ({ | ||
| repoPath, | ||
| openFile = 'main.ts', | ||
| codeFiles: plainCodeFiles = undefined, | ||
| startScript, | ||
| }) => { | ||
| const options = { | ||
| openFile, | ||
| view: 'editor', | ||
| startScript, | ||
| } as const; | ||
| if (!plainCodeFiles) { | ||
| plainCodeFiles = [openFile]; | ||
| } | ||
| return ( | ||
| <> | ||
| <div className="mb-1 italic text-sm"> | ||
| Click{' '} | ||
| <a href="#" onClick={() => sdk.openGithubProject(repoPath, options)}> | ||
| here | ||
| </a>{' '} | ||
| to open an interactive playground. | ||
| </div> | ||
ymc9 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| {plainCodeFiles.map((file) => ( | ||
| <GithubCodeBlock key={file} repoPath={repoPath} file={file} /> | ||
| ))} | ||
| </> | ||
| ); | ||
| }; | ||
| export default StackBlitzGithub; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,10 @@ | ||
| Prism.languages.zmodel = Prism.languages.extend('clike', { | ||
| keyword: /\b(?:datasource|enum|generator|model|type|abstract|import|extends|attribute|view|plugin|proc)\b/, | ||
| function: /@@?[A-Za-z_]\w*/, | ||
| keyword: /\b(?:datasource|enum|generator|model|type|abstract|import|extends|attribute|view|plugin|proc|with)\b/, | ||
| entity: /\b(?:Int|String|Boolean|DateTime|Float|Decimal|BigInt|Bytes|Json|Unsupported)\b/, | ||
| 'type-class-name': /(\b()\s+)[\w.\\]+/, | ||
| }); | ||
ymc9 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Prism.languages.javascript['class-name'][0].pattern = | ||
| /(\b(?:model|datasource|enum|generator|type|plugin|abstract)\s+)[\w.\\]+/; | ||
| Prism.languages.insertBefore('zmodel', 'function', { | ||
| annotation: { | ||
| pattern: /(^|[^.])@+\w+/, | ||
| lookbehind: true, | ||
| alias: 'punctuation', | ||
| }, | ||
| }); | ||
| Prism.languages.insertBefore('zmodel', 'punctuation', { | ||
| 'type-args': /\b(?:references|fields|onDelete|onUpdate):/, | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.