-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hotfix: Restructure Source Examples and Tutorial
- Loading branch information
1 parent
05d2da4
commit da9127f
Showing
16 changed files
with
158 additions
and
174 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 was deleted.
Oops, something went wrong.
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
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,40 @@ | ||
import type { OptionGroup } from '../components/Select'; | ||
import v7x from './v7.3.2/index'; | ||
import v8x from './v8.0.0-rc/index'; | ||
|
||
export type ExampleDataEntry = { | ||
name: string; | ||
hide?: boolean; | ||
usesWebWorkerLibrary?: boolean; | ||
}; | ||
export type ExampleSourceEntry = { | ||
source: string; | ||
hide: boolean; | ||
usesWebWorkerLibrary: boolean; | ||
}; | ||
|
||
// json data structure | ||
export type ExamplesJsonType = Record<string, (ExampleDataEntry | string)[]>; | ||
// sourcecode dictionary structure for below | ||
export type ExamplesSourceType = Record<string, Record<string, string>>; | ||
// normalized combination of the above | ||
export type CategoryDataType = Record<string, ExampleSourceEntry>; | ||
export type ExamplesDataType = Record<string, CategoryDataType>; | ||
|
||
// TODO: Use await import to dynamically load versioned content on demand instead? | ||
const versions: Record<string, { entries: ExamplesDataType; options: OptionGroup[] }> = { | ||
'7.3.2': v7x, | ||
'8.0.0-rc': v8x, | ||
}; | ||
|
||
export function getExampleEntry(version: string, pathString: string): ExampleSourceEntry | undefined | ||
{ | ||
const [directory, example] = pathString.split('.'); | ||
|
||
return versions[version]?.entries[directory]?.[example]; | ||
} | ||
|
||
export function getExampleOptions(version: string): OptionGroup[] | ||
{ | ||
return versions[version]?.options; | ||
} |
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
Oops, something went wrong.