@arkitektio/bsx 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -16
- package/dist/catalogs/html.d.ts +117 -0
- package/dist/catalogs/html.d.ts.map +1 -0
- package/dist/catalogs/html.js +14 -0
- package/dist/catalogs/html.js.map +1 -0
- package/dist/catalogs/index.d.ts +6059 -0
- package/dist/catalogs/index.d.ts.map +1 -0
- package/dist/catalogs/index.js +11 -0
- package/dist/catalogs/index.js.map +1 -0
- package/dist/catalogs/logo.d.ts +214 -0
- package/dist/catalogs/logo.d.ts.map +1 -0
- package/dist/catalogs/logo.js +27 -0
- package/dist/catalogs/logo.js.map +1 -0
- package/dist/catalogs/parts/data.d.ts +408 -0
- package/dist/catalogs/parts/data.d.ts.map +1 -0
- package/dist/catalogs/parts/data.js +206 -0
- package/dist/catalogs/parts/data.js.map +1 -0
- package/dist/catalogs/parts/feedback.d.ts +440 -0
- package/dist/catalogs/parts/feedback.d.ts.map +1 -0
- package/dist/catalogs/parts/feedback.js +70 -0
- package/dist/catalogs/parts/feedback.js.map +1 -0
- package/dist/catalogs/parts/forms.d.ts +874 -0
- package/dist/catalogs/parts/forms.d.ts.map +1 -0
- package/dist/catalogs/parts/forms.js +302 -0
- package/dist/catalogs/parts/forms.js.map +1 -0
- package/dist/catalogs/parts/html.d.ts +93 -0
- package/dist/catalogs/parts/html.d.ts.map +1 -0
- package/dist/catalogs/parts/html.js +45 -0
- package/dist/catalogs/parts/html.js.map +1 -0
- package/dist/catalogs/parts/icons.d.ts +266 -0
- package/dist/catalogs/parts/icons.d.ts.map +1 -0
- package/dist/catalogs/parts/icons.js +149 -0
- package/dist/catalogs/parts/icons.js.map +1 -0
- package/dist/catalogs/parts/index.d.ts +5765 -0
- package/dist/catalogs/parts/index.d.ts.map +1 -0
- package/dist/catalogs/parts/index.js +38 -0
- package/dist/catalogs/parts/index.js.map +1 -0
- package/dist/catalogs/parts/inspector.d.ts +10 -0
- package/dist/catalogs/parts/inspector.d.ts.map +1 -0
- package/dist/catalogs/parts/inspector.js +12 -0
- package/dist/catalogs/parts/inspector.js.map +1 -0
- package/dist/catalogs/parts/layout.d.ts +647 -0
- package/dist/catalogs/parts/layout.d.ts.map +1 -0
- package/dist/catalogs/parts/layout.js +188 -0
- package/dist/catalogs/parts/layout.js.map +1 -0
- package/dist/catalogs/parts/logo.d.ts +321 -0
- package/dist/catalogs/parts/logo.d.ts.map +1 -0
- package/dist/catalogs/parts/logo.js +227 -0
- package/dist/catalogs/parts/logo.js.map +1 -0
- package/dist/catalogs/parts/navigation.d.ts +697 -0
- package/dist/catalogs/parts/navigation.d.ts.map +1 -0
- package/dist/catalogs/parts/navigation.js +194 -0
- package/dist/catalogs/parts/navigation.js.map +1 -0
- package/dist/catalogs/parts/overlays.d.ts +2012 -0
- package/dist/catalogs/parts/overlays.d.ts.map +1 -0
- package/dist/catalogs/parts/overlays.js +191 -0
- package/dist/catalogs/parts/overlays.js.map +1 -0
- package/dist/catalogs/parts/run.d.ts +41 -0
- package/dist/catalogs/parts/run.d.ts.map +1 -0
- package/dist/catalogs/parts/run.js +46 -0
- package/dist/catalogs/parts/run.js.map +1 -0
- package/dist/catalogs/parts/scene.d.ts +326 -0
- package/dist/catalogs/parts/scene.d.ts.map +1 -0
- package/dist/catalogs/parts/scene.js +237 -0
- package/dist/catalogs/parts/scene.js.map +1 -0
- package/dist/catalogs/parts/structure.d.ts +51 -0
- package/dist/catalogs/parts/structure.d.ts.map +1 -0
- package/dist/catalogs/parts/structure.js +66 -0
- package/dist/catalogs/parts/structure.js.map +1 -0
- package/dist/catalogs/parts/toast.d.ts +37 -0
- package/dist/catalogs/parts/toast.d.ts.map +1 -0
- package/dist/catalogs/parts/toast.js +23 -0
- package/dist/catalogs/parts/toast.js.map +1 -0
- package/dist/catalogs/parts/typography.d.ts +174 -0
- package/dist/catalogs/parts/typography.d.ts.map +1 -0
- package/dist/catalogs/parts/typography.js +56 -0
- package/dist/catalogs/parts/typography.js.map +1 -0
- package/dist/{renderer/bloks/shared/schemas.d.ts → catalogs/props.d.ts} +3 -3
- package/dist/catalogs/props.d.ts.map +1 -0
- package/dist/{renderer/bloks/shared/schemas.js → catalogs/props.js} +3 -4
- package/dist/catalogs/props.js.map +1 -0
- package/dist/catalogs/scene.d.ts +250 -0
- package/dist/catalogs/scene.d.ts.map +1 -0
- package/dist/catalogs/scene.js +28 -0
- package/dist/catalogs/scene.js.map +1 -0
- package/dist/catalogs/shadcn.d.ts +2397 -0
- package/dist/catalogs/shadcn.d.ts.map +1 -0
- package/dist/catalogs/shadcn.js +82 -0
- package/dist/catalogs/shadcn.js.map +1 -0
- package/dist/catalogs/structure.d.ts +61 -0
- package/dist/catalogs/structure.d.ts.map +1 -0
- package/dist/catalogs/structure.js +14 -0
- package/dist/catalogs/structure.js.map +1 -0
- package/dist/catalogs/ui.d.ts +3027 -0
- package/dist/catalogs/ui.d.ts.map +1 -0
- package/dist/catalogs/ui.js +91 -0
- package/dist/catalogs/ui.js.map +1 -0
- package/dist/catalogs.d.ts +5 -0
- package/dist/catalogs.d.ts.map +1 -0
- package/dist/catalogs.js +6 -0
- package/dist/catalogs.js.map +1 -0
- package/dist/platform.d.ts +11 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js.map +1 -1
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +5 -1
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/renderer/bloks/data.d.ts +378 -27
- package/dist/renderer/bloks/data.d.ts.map +1 -1
- package/dist/renderer/bloks/data.js +55 -251
- package/dist/renderer/bloks/data.js.map +1 -1
- package/dist/renderer/bloks/feedback.d.ts +425 -8
- package/dist/renderer/bloks/feedback.d.ts.map +1 -1
- package/dist/renderer/bloks/feedback.js +23 -79
- package/dist/renderer/bloks/feedback.js.map +1 -1
- package/dist/renderer/bloks/forms.d.ts +828 -42
- package/dist/renderer/bloks/forms.d.ts.map +1 -1
- package/dist/renderer/bloks/forms.js +78 -368
- package/dist/renderer/bloks/forms.js.map +1 -1
- package/dist/renderer/bloks/html.d.ts +84 -9
- package/dist/renderer/bloks/html.d.ts.map +1 -1
- package/dist/renderer/bloks/html.js +13 -48
- package/dist/renderer/bloks/html.js.map +1 -1
- package/dist/renderer/bloks/icons.d.ts +133 -130
- package/dist/renderer/bloks/icons.d.ts.map +1 -1
- package/dist/renderer/bloks/icons.js +10 -23
- package/dist/renderer/bloks/icons.js.map +1 -1
- package/dist/renderer/bloks/index.d.ts +5251 -16
- package/dist/renderer/bloks/index.d.ts.map +1 -1
- package/dist/renderer/bloks/index.js +29 -27
- package/dist/renderer/bloks/index.js.map +1 -1
- package/dist/renderer/bloks/inspector/Inspector.d.ts +5 -1
- package/dist/renderer/bloks/inspector/Inspector.d.ts.map +1 -1
- package/dist/renderer/bloks/inspector/Inspector.js +5 -11
- package/dist/renderer/bloks/inspector/Inspector.js.map +1 -1
- package/dist/renderer/bloks/layout.d.ts +432 -15
- package/dist/renderer/bloks/layout.d.ts.map +1 -1
- package/dist/renderer/bloks/layout.js +43 -224
- package/dist/renderer/bloks/layout.js.map +1 -1
- package/dist/renderer/bloks/logo/index.d.ts +172 -24
- package/dist/renderer/bloks/logo/index.d.ts.map +1 -1
- package/dist/renderer/bloks/logo/index.js +42 -236
- package/dist/renderer/bloks/logo/index.js.map +1 -1
- package/dist/renderer/bloks/navigation.d.ts +651 -28
- package/dist/renderer/bloks/navigation.d.ts.map +1 -1
- package/dist/renderer/bloks/navigation.js +65 -249
- package/dist/renderer/bloks/navigation.js.map +1 -1
- package/dist/renderer/bloks/overlays.d.ts +1998 -55
- package/dist/renderer/bloks/overlays.d.ts.map +1 -1
- package/dist/renderer/bloks/overlays.js +87 -265
- package/dist/renderer/bloks/overlays.js.map +1 -1
- package/dist/renderer/bloks/run/components.d.ts +13 -4
- package/dist/renderer/bloks/run/components.d.ts.map +1 -1
- package/dist/renderer/bloks/run/components.js +12 -34
- package/dist/renderer/bloks/run/components.js.map +1 -1
- package/dist/renderer/bloks/run/index.d.ts +1 -1
- package/dist/renderer/bloks/run/index.d.ts.map +1 -1
- package/dist/renderer/bloks/run/index.js +1 -1
- package/dist/renderer/bloks/run/index.js.map +1 -1
- package/dist/renderer/bloks/scene/Model.d.ts +6 -2
- package/dist/renderer/bloks/scene/Model.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/Model.js +4 -48
- package/dist/renderer/bloks/scene/Model.js.map +1 -1
- package/dist/renderer/bloks/scene/Scene.d.ts +4 -1
- package/dist/renderer/bloks/scene/Scene.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/Scene.js +3 -24
- package/dist/renderer/bloks/scene/Scene.js.map +1 -1
- package/dist/renderer/bloks/scene/Transform.d.ts +5 -1
- package/dist/renderer/bloks/scene/Transform.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/Transform.js +3 -25
- package/dist/renderer/bloks/scene/Transform.js.map +1 -1
- package/dist/renderer/bloks/scene/bindings.d.ts +40 -8
- package/dist/renderer/bloks/scene/bindings.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/bindings.js +18 -102
- package/dist/renderer/bloks/scene/bindings.js.map +1 -1
- package/dist/renderer/bloks/scene/index.d.ts +194 -1
- package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/index.js +21 -21
- package/dist/renderer/bloks/scene/index.js.map +1 -1
- package/dist/renderer/bloks/scene/interaction.d.ts +6 -2
- package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/interaction.js +6 -42
- package/dist/renderer/bloks/scene/interaction.js.map +1 -1
- package/dist/renderer/bloks/shared/index.d.ts +0 -1
- package/dist/renderer/bloks/shared/index.d.ts.map +1 -1
- package/dist/renderer/bloks/shared/index.js +0 -1
- package/dist/renderer/bloks/shared/index.js.map +1 -1
- package/dist/renderer/bloks/shared/props.d.ts +1 -1
- package/dist/renderer/bloks/shared/props.d.ts.map +1 -1
- package/dist/renderer/bloks/shared/props.js +1 -1
- package/dist/renderer/bloks/shared/props.js.map +1 -1
- package/dist/renderer/bloks/testing.d.ts +1 -1
- package/dist/renderer/bloks/testing.d.ts.map +1 -1
- package/dist/renderer/bloks/testing.js +5 -5
- package/dist/renderer/bloks/testing.js.map +1 -1
- package/dist/renderer/bloks/toast.d.ts +15 -5
- package/dist/renderer/bloks/toast.d.ts.map +1 -1
- package/dist/renderer/bloks/toast.js +11 -19
- package/dist/renderer/bloks/toast.js.map +1 -1
- package/dist/renderer/bloks/typography.d.ts +166 -24
- package/dist/renderer/bloks/typography.d.ts.map +1 -1
- package/dist/renderer/bloks/typography.js +22 -98
- package/dist/renderer/bloks/typography.js.map +1 -1
- package/dist/renderer/catalog.d.ts +3 -19
- package/dist/renderer/catalog.d.ts.map +1 -1
- package/dist/renderer/catalog.js +12 -29
- package/dist/renderer/catalog.js.map +1 -1
- package/dist/renderer/declare.d.ts +40 -0
- package/dist/renderer/declare.d.ts.map +1 -0
- package/dist/renderer/declare.js +40 -0
- package/dist/renderer/declare.js.map +1 -0
- package/dist/renderer/modules.d.ts +1 -18
- package/dist/renderer/modules.d.ts.map +1 -1
- package/dist/renderer/modules.js +1 -31
- package/dist/renderer/modules.js.map +1 -1
- package/dist/renderer/runtime/catalog.d.ts +63 -0
- package/dist/renderer/runtime/catalog.d.ts.map +1 -0
- package/dist/renderer/runtime/catalog.js +33 -0
- package/dist/renderer/runtime/catalog.js.map +1 -0
- package/dist/renderer/runtime/components.d.ts +27 -1
- package/dist/renderer/runtime/components.d.ts.map +1 -1
- package/dist/renderer/runtime/components.js +3 -0
- package/dist/renderer/runtime/components.js.map +1 -1
- package/dist/renderer/runtime/describe.d.ts +49 -0
- package/dist/renderer/runtime/describe.d.ts.map +1 -0
- package/dist/renderer/runtime/describe.js +127 -0
- package/dist/renderer/runtime/describe.js.map +1 -0
- package/dist/renderer/runtime/functions.d.ts +0 -13
- package/dist/renderer/runtime/functions.d.ts.map +1 -1
- package/dist/renderer/runtime/functions.js +0 -14
- package/dist/renderer/runtime/functions.js.map +1 -1
- package/dist/renderer/runtime/index.d.ts +2 -0
- package/dist/renderer/runtime/index.d.ts.map +1 -1
- package/dist/renderer/runtime/index.js +2 -0
- package/dist/renderer/runtime/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -0
- package/dist/runtime.js.map +1 -1
- package/dist/scene.d.ts +2 -0
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +27 -1
- package/dist/scene.js.map +1 -1
- package/dist/shadcn.d.ts +5265 -0
- package/dist/shadcn.d.ts.map +1 -0
- package/dist/shadcn.js +194 -0
- package/dist/shadcn.js.map +1 -0
- package/dist/spec/bsx_v2.json +74 -113
- package/dist/spec/catalogs/logo@1.json +39 -25
- package/dist/spec/catalogs/logo@1.json.js +39 -25
- package/dist/spec/catalogs/scene@1.json +23 -23
- package/dist/spec/catalogs/scene@1.json.js +23 -23
- package/dist/spec/{modules/orkestrator.json → catalogs/shadcn@1.json} +1391 -286
- package/dist/spec/{modules/orkestrator.json.js → catalogs/shadcn@1.json.js} +1391 -286
- package/dist/spec/catalogs/structure@1.json +1 -1
- package/dist/spec/catalogs/structure@1.json.js +1 -1
- package/dist/spec/catalogs/ui@1.json +1690 -37
- package/dist/spec/catalogs/ui@1.json.js +1690 -37
- package/dist/spec/catalogs.d.ts +16 -12
- package/dist/spec/catalogs.d.ts.map +1 -1
- package/dist/spec/catalogs.js +23 -15
- package/dist/spec/catalogs.js.map +1 -1
- package/dist/spec/vocabulary.json +1 -1
- package/dist/spec/vocabulary.json.js +1 -1
- package/dist/vendor/core/ui/button-group.d.ts +1 -1
- package/dist/vendor/core/ui/field.d.ts +1 -1
- package/dist/web.d.ts +0 -3
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +2 -4
- package/dist/web.js.map +1 -1
- package/package.json +11 -2
- package/src/bsx/infer.test.ts +2 -2
- package/src/bsx/references.test.ts +2 -2
- package/src/catalogs/catalogs.test.ts +28 -0
- package/src/catalogs/html.ts +14 -0
- package/src/catalogs/index.ts +12 -0
- package/src/catalogs/logo.ts +27 -0
- package/src/catalogs/parts/data.ts +228 -0
- package/src/catalogs/parts/feedback.ts +79 -0
- package/src/catalogs/parts/forms.ts +335 -0
- package/src/catalogs/parts/html.ts +51 -0
- package/src/catalogs/parts/icons.ts +154 -0
- package/src/catalogs/parts/index.ts +38 -0
- package/src/catalogs/parts/inspector.ts +14 -0
- package/src/catalogs/parts/layout.ts +217 -0
- package/src/catalogs/parts/logo.ts +254 -0
- package/src/catalogs/parts/navigation.ts +198 -0
- package/src/catalogs/parts/overlays.ts +221 -0
- package/src/catalogs/parts/run.ts +57 -0
- package/src/catalogs/parts/scene.ts +292 -0
- package/src/catalogs/parts/structure.ts +83 -0
- package/src/catalogs/parts/toast.ts +27 -0
- package/src/catalogs/parts/typography.ts +63 -0
- package/src/{renderer/bloks/shared/schemas.ts → catalogs/props.ts} +2 -3
- package/src/catalogs/scene.ts +28 -0
- package/src/catalogs/shadcn.ts +82 -0
- package/src/catalogs/structure.ts +14 -0
- package/src/catalogs/ui.ts +91 -0
- package/src/catalogs.ts +6 -0
- package/src/platform.ts +8 -2
- package/src/preview/CachedBlokPreview.test.tsx +6 -1
- package/src/renderer/addBlokComponents.test.tsx +9 -7
- package/src/renderer/bloks/control.tsx +8 -1
- package/src/renderer/bloks/data.tsx +339 -621
- package/src/renderer/bloks/feedback.tsx +32 -112
- package/src/renderer/bloks/forms.tsx +103 -504
- package/src/renderer/bloks/html.tsx +16 -78
- package/src/renderer/bloks/icons.tsx +14 -31
- package/src/renderer/bloks/index.ts +28 -38
- package/src/renderer/bloks/inspector/Inspector.tsx +9 -11
- package/src/renderer/bloks/layout.tsx +216 -453
- package/src/renderer/bloks/logo/index.tsx +144 -387
- package/src/renderer/bloks/navigation.tsx +87 -343
- package/src/renderer/bloks/overlays.tsx +106 -524
- package/src/renderer/bloks/primitives.test.tsx +3 -1
- package/src/renderer/bloks/run/components.tsx +20 -58
- package/src/renderer/bloks/run/index.ts +1 -1
- package/src/renderer/bloks/scene/Model.tsx +7 -64
- package/src/renderer/bloks/scene/Scene.tsx +12 -38
- package/src/renderer/bloks/scene/Transform.tsx +6 -34
- package/src/renderer/bloks/scene/animate.test.tsx +2 -2
- package/src/renderer/bloks/scene/bindings.tsx +31 -113
- package/src/renderer/bloks/scene/index.ts +21 -21
- package/src/renderer/bloks/scene/interaction.tsx +7 -59
- package/src/renderer/bloks/shared/index.ts +0 -1
- package/src/renderer/bloks/shared/props.ts +1 -1
- package/src/renderer/bloks/testing.tsx +5 -5
- package/src/renderer/bloks/toast.tsx +16 -31
- package/src/renderer/bloks/typography.tsx +28 -141
- package/src/renderer/bloks/unavailable.test.tsx +3 -1
- package/src/renderer/catalog.tsx +13 -36
- package/src/renderer/declare.ts +82 -0
- package/src/renderer/modules.ts +1 -43
- package/src/renderer/runtime/catalog.test.ts +102 -0
- package/src/renderer/runtime/catalog.ts +108 -0
- package/src/renderer/runtime/components.tsx +27 -0
- package/src/renderer/runtime/describe.ts +180 -0
- package/src/renderer/runtime/functions.ts +0 -25
- package/src/renderer/runtime/index.ts +2 -0
- package/src/runtime.ts +1 -0
- package/src/scene.ts +30 -1
- package/src/shadcn.ts +202 -0
- package/src/spec/bsx_v2.json +74 -113
- package/src/spec/catalogs/logo@1.json +39 -25
- package/src/spec/catalogs/scene@1.json +23 -23
- package/src/spec/{modules/orkestrator.json → catalogs/shadcn@1.json} +1391 -286
- package/src/spec/catalogs/structure@1.json +1 -1
- package/src/spec/catalogs/ui@1.json +1690 -37
- package/src/spec/catalogs.ts +25 -16
- package/src/spec/spec.test.ts +1 -1
- package/src/spec/vocabulary.json +1 -1
- package/src/web.ts +2 -4
- package/dist/renderer/bloks/shared/schemas.d.ts.map +0 -1
- package/dist/renderer/bloks/shared/schemas.js.map +0 -1
package/dist/spec/catalogs.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { type BlokContextName, type VocabFunction } from './vocabulary';
|
|
2
2
|
/**
|
|
3
|
-
* What a v2 blok
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `catalogs
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `blok/catalogs` (`BlokView`, `default_view`).
|
|
3
|
+
* What a v2 blok is parsed and checked against, in the spec's terms. base@2
|
|
4
|
+
* (the language) is the spec's; the global catalogs (`ui@1`, `scene@1`,
|
|
5
|
+
* `logo@1`, `structure@1`, `html@1`, `shadcn@1`) are written from this
|
|
6
|
+
* package's contracts (`catalogs/`, `pnpm spec:export`). A *module* is a UI's
|
|
7
|
+
* own unversioned catalog, registered by that UI (the server's `Module`): an
|
|
8
|
+
* app adds its own to the default view with `registerBlokModules`. The port
|
|
9
|
+
* of arkitekt-spec's `blok/catalogs` (`BlokView`, `default_view`).
|
|
10
10
|
*/
|
|
11
11
|
export declare const BASE_NAME = "base";
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const STANDARD_CATALOGS: readonly ["ui", "scene", "logo", "structure", "html"];
|
|
12
|
+
export declare const STANDARD_CATALOGS: readonly ["ui", "scene", "logo", "structure", "html", "shadcn"];
|
|
14
13
|
export type StandardCatalog = (typeof STANDARD_CATALOGS)[number];
|
|
15
14
|
export type SpecEventField = {
|
|
16
15
|
key: string;
|
|
@@ -54,8 +53,6 @@ export declare const parseSpecCatalog: (raw: unknown, file: string) => SpecCatal
|
|
|
54
53
|
export declare const baseCatalog: () => SpecCatalog;
|
|
55
54
|
/** A standard catalog at the version the vocabulary names. */
|
|
56
55
|
export declare const standardCatalog: (name: StandardCatalog) => SpecCatalog;
|
|
57
|
-
/** What only the Orkestrator draws: the `orkestrator` module it registers. */
|
|
58
|
-
export declare const orkestratorModule: () => SpecCatalog;
|
|
59
56
|
export declare const standardCatalogs: () => SpecCatalog[];
|
|
60
57
|
/**
|
|
61
58
|
* A component name two sources define differently, and which definition is
|
|
@@ -92,7 +89,14 @@ export declare const blokView: (extra?: readonly SpecCatalog[], options?: {
|
|
|
92
89
|
standard?: boolean;
|
|
93
90
|
complete?: boolean;
|
|
94
91
|
}) => BlokView;
|
|
95
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The app's own catalogs, as its UI registers them (`describeBlokContract` of
|
|
94
|
+
* each unversioned contract it implements): part of the default view from now
|
|
95
|
+
* on, so the parser, the checks and the editor know its components. Call it
|
|
96
|
+
* once at start, beside `configureBlokPlatform`.
|
|
97
|
+
*/
|
|
98
|
+
export declare const registerBlokModules: (modules: readonly SpecCatalog[]) => void;
|
|
99
|
+
/** The app's view: base, every global catalog and its own (`registerBlokModules`). */
|
|
96
100
|
export declare const defaultBlokView: () => BlokView;
|
|
97
101
|
/** Whether a component is a language one that holds others in whatever context (`if`, `foreach`, `fragment`). */
|
|
98
102
|
export declare const isLanguageContainer: (component: SpecComponent | undefined) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogs.d.ts","sourceRoot":"","sources":["../../src/spec/catalogs.ts"],"names":[],"mappings":"AAOA,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,aAAa,EAAC,MAAM,cAAc,CAAC;AAEtF;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,SAAS,CAAC;AAChC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"catalogs.d.ts","sourceRoot":"","sources":["../../src/spec/catalogs.ts"],"names":[],"mappings":"AAOA,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,aAAa,EAAC,MAAM,cAAc,CAAC;AAEtF;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,SAAS,CAAC;AAChC,eAAO,MAAM,iBAAiB,iEAAkE,CAAC;AACjG,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,MAAM,cAAc,GAAG;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI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,GAAI,WAAW,aAAa,GAAG,SAAS,EAAE,SAAS,eAAe,KAAG,eAG7F,CAAC"}
|
package/dist/spec/catalogs.js
CHANGED
|
@@ -3,21 +3,20 @@ import htmlCatalogJson from './catalogs/html@1.json.js';
|
|
|
3
3
|
import logoCatalogJson from './catalogs/logo@1.json.js';
|
|
4
4
|
import sceneCatalogJson from './catalogs/scene@1.json.js';
|
|
5
5
|
import structureCatalogJson from './catalogs/structure@1.json.js';
|
|
6
|
+
import shadcnCatalogJson from './catalogs/shadcn@1.json.js';
|
|
6
7
|
import uiCatalogJson from './catalogs/ui@1.json.js';
|
|
7
|
-
import orkestratorModuleJson from './modules/orkestrator.json.js';
|
|
8
8
|
import { loadVocabulary } from './vocabulary.js';
|
|
9
9
|
/**
|
|
10
|
-
* What a v2 blok
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `catalogs
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `blok/catalogs` (`BlokView`, `default_view`).
|
|
10
|
+
* What a v2 blok is parsed and checked against, in the spec's terms. base@2
|
|
11
|
+
* (the language) is the spec's; the global catalogs (`ui@1`, `scene@1`,
|
|
12
|
+
* `logo@1`, `structure@1`, `html@1`, `shadcn@1`) are written from this
|
|
13
|
+
* package's contracts (`catalogs/`, `pnpm spec:export`). A *module* is a UI's
|
|
14
|
+
* own unversioned catalog, registered by that UI (the server's `Module`): an
|
|
15
|
+
* app adds its own to the default view with `registerBlokModules`. The port
|
|
16
|
+
* of arkitekt-spec's `blok/catalogs` (`BlokView`, `default_view`).
|
|
17
17
|
*/
|
|
18
18
|
export const BASE_NAME = 'base';
|
|
19
|
-
export const
|
|
20
|
-
export const STANDARD_CATALOGS = ['ui', 'scene', 'logo', 'structure', 'html'];
|
|
19
|
+
export const STANDARD_CATALOGS = ['ui', 'scene', 'logo', 'structure', 'html', 'shadcn'];
|
|
21
20
|
const isRaw = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
22
21
|
const rawList = (value) => (Array.isArray(value) ? value : []);
|
|
23
22
|
const text = (value) => (typeof value === 'string' ? value : null);
|
|
@@ -63,8 +62,8 @@ const catalogs = () => {
|
|
|
63
62
|
logo: parseSpecCatalog(logoCatalogJson, 'catalogs/logo@1.json'),
|
|
64
63
|
structure: parseSpecCatalog(structureCatalogJson, 'catalogs/structure@1.json'),
|
|
65
64
|
html: parseSpecCatalog(htmlCatalogJson, 'catalogs/html@1.json'),
|
|
65
|
+
shadcn: parseSpecCatalog(shadcnCatalogJson, 'catalogs/shadcn@1.json'),
|
|
66
66
|
},
|
|
67
|
-
orkestrator: parseSpecCatalog(orkestratorModuleJson, 'modules/orkestrator.json'),
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
69
|
return parsed;
|
|
@@ -73,8 +72,6 @@ const catalogs = () => {
|
|
|
73
72
|
export const baseCatalog = () => catalogs().base;
|
|
74
73
|
/** A standard catalog at the version the vocabulary names. */
|
|
75
74
|
export const standardCatalog = (name) => catalogs().standard[name];
|
|
76
|
-
/** What only the Orkestrator draws: the `orkestrator` module it registers. */
|
|
77
|
-
export const orkestratorModule = () => catalogs().orkestrator;
|
|
78
75
|
export const standardCatalogs = () => STANDARD_CATALOGS.map(name => standardCatalog(name));
|
|
79
76
|
const catalogLabel = (catalog) => (catalog.version === null ? catalog.name : `${catalog.name}@${catalog.version}`);
|
|
80
77
|
/** Two definitions of a component are the same when everything but the catalog they come from is. */
|
|
@@ -114,10 +111,21 @@ export const blokView = (extra = [], options = {}) => {
|
|
|
114
111
|
return { components, functions: loadVocabulary().functions, label, complete: options.complete ?? true, shadows };
|
|
115
112
|
};
|
|
116
113
|
let defaultView = null;
|
|
117
|
-
|
|
114
|
+
let defaultModules = [];
|
|
115
|
+
/**
|
|
116
|
+
* The app's own catalogs, as its UI registers them (`describeBlokContract` of
|
|
117
|
+
* each unversioned contract it implements): part of the default view from now
|
|
118
|
+
* on, so the parser, the checks and the editor know its components. Call it
|
|
119
|
+
* once at start, beside `configureBlokPlatform`.
|
|
120
|
+
*/
|
|
121
|
+
export const registerBlokModules = (modules) => {
|
|
122
|
+
defaultModules = modules;
|
|
123
|
+
defaultView = null;
|
|
124
|
+
};
|
|
125
|
+
/** The app's view: base, every global catalog and its own (`registerBlokModules`). */
|
|
118
126
|
export const defaultBlokView = () => {
|
|
119
127
|
if (!defaultView)
|
|
120
|
-
defaultView = blokView(
|
|
128
|
+
defaultView = blokView(defaultModules);
|
|
121
129
|
return defaultView;
|
|
122
130
|
};
|
|
123
131
|
/** Whether a component is a language one that holds others in whatever context (`if`, `foreach`, `fragment`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../src/spec/catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"catalogs.js","sourceRoot":"","sources":["../../src/spec/catalogs.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AACzD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAC,cAAc,EAA2C,MAAM,cAAc,CAAC;AAEtF;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE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AC,eAAe,IAAI,SAAS,CAAC,OAAO,CAAC;AAC9F,CAAC,CAAC"}
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
"catalogs": {
|
|
307
307
|
"description": "Catalogs are the spec-owned, versioned sets a blok renders with: base (every renderer) and the standard catalogs (opt-in). A blok declares the catalogs it needs (catalogs: [\"ui@1\", \"scene@1\"]); a renderer lacking one renders its children or a placeholder, and reports it. A module is an app's own unversioned extras (the server's Module, registered by an app such as the Orkestrator with the catalogs it implements in full); a blok names at most one, as its module.",
|
|
308
308
|
"base": 2,
|
|
309
|
-
"standard": {"ui": 1, "scene": 1, "logo": 1, "structure": 1, "html": 1}
|
|
309
|
+
"standard": {"ui": 1, "scene": 1, "logo": 1, "structure": 1, "html": 1, "shadcn": 1}
|
|
310
310
|
},
|
|
311
311
|
"diagnostics": {
|
|
312
312
|
"description": "One table of stable codes, the same in Python, Rust and TypeScript. level: error refuses the blok, warning is reported; runtime: true marks a code no checker raises, the renderer's error code of a record (deps.unbound). Messages are str.format templates; parity compares codes, never text.",
|
|
@@ -306,7 +306,7 @@ export default {
|
|
|
306
306
|
"catalogs": {
|
|
307
307
|
"description": "Catalogs are the spec-owned, versioned sets a blok renders with: base (every renderer) and the standard catalogs (opt-in). A blok declares the catalogs it needs (catalogs: [\"ui@1\", \"scene@1\"]); a renderer lacking one renders its children or a placeholder, and reports it. A module is an app's own unversioned extras (the server's Module, registered by an app such as the Orkestrator with the catalogs it implements in full); a blok names at most one, as its module.",
|
|
308
308
|
"base": 2,
|
|
309
|
-
"standard": {"ui": 1, "scene": 1, "logo": 1, "structure": 1, "html": 1}
|
|
309
|
+
"standard": {"ui": 1, "scene": 1, "logo": 1, "structure": 1, "html": 1, "shadcn": 1}
|
|
310
310
|
},
|
|
311
311
|
"diagnostics": {
|
|
312
312
|
"description": "One table of stable codes, the same in Python, Rust and TypeScript. level: error refuses the blok, warning is reported; runtime: true marks a code no checker raises, the renderer's error code of a record (deps.unbound). Messages are str.format templates; parity compares codes, never text.",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import { Separator } from "./separator";
|
|
3
3
|
declare const buttonGroupVariants: (props?: ({
|
|
4
|
-
orientation?: "
|
|
4
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react").JSX.Element;
|
|
7
7
|
declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<"div"> & {
|
|
@@ -6,7 +6,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
|
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
7
|
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
8
8
|
declare const fieldVariants: (props?: ({
|
|
9
|
-
orientation?: "
|
|
9
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): import("react").JSX.Element;
|
|
12
12
|
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
package/dist/web.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ export { default as BlokRenderer } from './renderer/BlokRenderer';
|
|
|
2
2
|
export * from './renderer/BlokComponentHost';
|
|
3
3
|
export * from './renderer/catalog';
|
|
4
4
|
export * from './renderer/assets';
|
|
5
|
-
export * from './renderer/bloks';
|
|
6
|
-
export { logoBlokComponents } from './renderer/bloks/logo';
|
|
7
|
-
export { RawInspector } from './renderer/bloks/inspector/Inspector';
|
|
8
5
|
export * from './logo/CachedBlokLogo';
|
|
9
6
|
export * from './logo/SourceLogo';
|
|
10
7
|
export * from './preview/CachedBlokPreview';
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAChE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/dist/web.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
// @arkitektio/bsx/web: the React DOM renderer
|
|
1
|
+
// @arkitektio/bsx/web: the React DOM renderer. What it draws is the app's (declareBlokUi); a shadcn
|
|
2
|
+
// implementation of the global catalogs is opt-in at @arkitektio/bsx/shadcn.
|
|
2
3
|
export { default as BlokRenderer } from './renderer/BlokRenderer.js';
|
|
3
4
|
export * from './renderer/BlokComponentHost.js';
|
|
4
5
|
export * from './renderer/catalog.js';
|
|
5
6
|
export * from './renderer/assets.js';
|
|
6
|
-
export * from './renderer/bloks/index.js';
|
|
7
|
-
export { logoBlokComponents } from './renderer/bloks/logo/index.js';
|
|
8
|
-
export { RawInspector } from './renderer/bloks/inspector/Inspector.js';
|
|
9
7
|
export * from './logo/CachedBlokLogo.js';
|
|
10
8
|
export * from './logo/SourceLogo.js';
|
|
11
9
|
export * from './preview/CachedBlokPreview.js';
|
package/dist/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,6EAA6E;AAC7E,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAChE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkitektio/bsx",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The BSX language, the blok spec, runtime and React renderer: one copy for every Arkitekt frontend.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"default": "./dist/index.js"
|
|
22
22
|
},
|
|
23
|
+
"./catalogs": {
|
|
24
|
+
"types": "./dist/catalogs.d.ts",
|
|
25
|
+
"default": "./dist/catalogs.js"
|
|
26
|
+
},
|
|
23
27
|
"./runtime": {
|
|
24
28
|
"types": "./dist/runtime.d.ts",
|
|
25
29
|
"default": "./dist/runtime.js"
|
|
@@ -28,6 +32,10 @@
|
|
|
28
32
|
"types": "./dist/web.d.ts",
|
|
29
33
|
"default": "./dist/web.js"
|
|
30
34
|
},
|
|
35
|
+
"./shadcn": {
|
|
36
|
+
"types": "./dist/shadcn.d.ts",
|
|
37
|
+
"default": "./dist/shadcn.js"
|
|
38
|
+
},
|
|
31
39
|
"./scene": {
|
|
32
40
|
"types": "./dist/scene.d.ts",
|
|
33
41
|
"default": "./dist/scene.js"
|
|
@@ -51,7 +59,8 @@
|
|
|
51
59
|
"theme": "node scripts/embed-theme.mjs",
|
|
52
60
|
"build": "node scripts/embed-theme.mjs && tsc -p tsconfig.build.json && node scripts/finish-build.mjs",
|
|
53
61
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
54
|
-
"test": "vitest run"
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"spec:export": "node scripts/export-spec.mjs"
|
|
55
64
|
},
|
|
56
65
|
"peerDependencies": {
|
|
57
66
|
"@monaco-editor/react": "^4.7.0",
|
package/src/bsx/infer.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {describe, expect, it} from 'vitest';
|
|
2
|
-
import {blokView, defaultBlokView,
|
|
2
|
+
import {blokView, defaultBlokView, parseSpecCatalog} from '../spec/catalogs';
|
|
3
3
|
import {defaultType, portIsValid, resolveBlokScope, resolveLocal} from './infer';
|
|
4
4
|
import {parseBsx} from './parse';
|
|
5
5
|
import {printBsx} from './print';
|
|
@@ -120,7 +120,7 @@ describe('shadowing', () => {
|
|
|
120
120
|
},
|
|
121
121
|
'mine',
|
|
122
122
|
);
|
|
123
|
-
const view = blokView([
|
|
123
|
+
const view = blokView([module]);
|
|
124
124
|
expect(view.components.get('Slider')?.catalog).toBe('mine');
|
|
125
125
|
expect(view.shadows.get('Slider')).toEqual({component: 'Slider', catalog: 'ui@1', module: 'mine', winner: 'mine'});
|
|
126
126
|
expect(view.components.get('foreach')?.catalog).toMatch(/^base@/);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {describe, expect, it} from 'vitest';
|
|
2
2
|
import corpus from '../spec/bsx_v2.json';
|
|
3
|
-
import {blokView, defaultBlokView,
|
|
3
|
+
import {blokView, defaultBlokView, parseSpecCatalog, type BlokView} from '../spec/catalogs';
|
|
4
4
|
import {resolveBlokScope} from './infer';
|
|
5
5
|
import {parseBsx} from './parse';
|
|
6
6
|
import {checkBlokTree, dependencyHint, emptyBlokScope, type BlokCheckScope} from './references';
|
|
@@ -19,7 +19,7 @@ type CheckedCase = {
|
|
|
19
19
|
const caseView = (scope: CorpusScope): BlokView | null => {
|
|
20
20
|
if (scope.catalog === false) return null;
|
|
21
21
|
if (scope.module == null) return defaultBlokView();
|
|
22
|
-
return blokView([
|
|
22
|
+
return blokView([parseSpecCatalog(scope.module, 'module')]);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const caseScope = (scope: CorpusScope): BlokCheckScope => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {readFileSync} from 'node:fs';
|
|
2
|
+
import {describe, expect, it} from 'vitest';
|
|
3
|
+
import {catalogRef, describeBlokContract, specJsonText} from '../renderer/runtime';
|
|
4
|
+
import {globalCatalogs} from './index';
|
|
5
|
+
import {parts} from './parts';
|
|
6
|
+
import baseCatalogJson from '../spec/catalogs/base@2.json';
|
|
7
|
+
|
|
8
|
+
const shipped = (ref: string): string => readFileSync(new URL(`../spec/catalogs/${ref}.json`, import.meta.url), 'utf-8');
|
|
9
|
+
|
|
10
|
+
describe('the global catalogs', () => {
|
|
11
|
+
it('are what the shipped spec JSON says, so `pnpm spec:export` has run', () => {
|
|
12
|
+
for (const contract of globalCatalogs) {
|
|
13
|
+
expect(shipped(catalogRef(contract)), catalogRef(contract)).toBe(specJsonText(describeBlokContract(contract)));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('hold each component once, and never one of base@2', () => {
|
|
18
|
+
const base = new Set(baseCatalogJson.components.map(component => component.name));
|
|
19
|
+
const names = globalCatalogs.flatMap(contract => Object.keys(contract.components));
|
|
20
|
+
expect(names.filter((name, index) => names.indexOf(name) !== index)).toEqual([]);
|
|
21
|
+
expect(names.filter(name => base.has(name))).toEqual([]);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('use every contract the package defines', () => {
|
|
25
|
+
const used = new Set(globalCatalogs.flatMap(contract => Object.keys(contract.components)));
|
|
26
|
+
expect(Object.keys(parts).filter(name => !used.has(name))).toEqual([]);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
|
+
import {parts} from './parts';
|
|
3
|
+
|
|
4
|
+
/** `html@1`. */
|
|
5
|
+
export const htmlCatalog = defineBlokCatalog({
|
|
6
|
+
name: "html",
|
|
7
|
+
version: 1,
|
|
8
|
+
description: "Plain containers that translate directly to React Native: div (View), p and span (Text).",
|
|
9
|
+
components: {
|
|
10
|
+
div: parts.div,
|
|
11
|
+
p: {...parts.p, textProp: "text"},
|
|
12
|
+
span: {...parts.span, textProp: "text"},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {htmlCatalog} from './html';
|
|
2
|
+
import {logoCatalog} from './logo';
|
|
3
|
+
import {sceneCatalog} from './scene';
|
|
4
|
+
import {shadcnCatalog} from './shadcn';
|
|
5
|
+
import {structureCatalog} from './structure';
|
|
6
|
+
import {uiCatalog} from './ui';
|
|
7
|
+
|
|
8
|
+
export {htmlCatalog, logoCatalog, sceneCatalog, shadcnCatalog, structureCatalog, uiCatalog};
|
|
9
|
+
export * from './props';
|
|
10
|
+
|
|
11
|
+
/** The global catalogs this package defines: what the spec publishes, every UI may claim. */
|
|
12
|
+
export const globalCatalogs = [uiCatalog, htmlCatalog, logoCatalog, sceneCatalog, structureCatalog, shadcnCatalog] as const;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
|
+
import {parts} from './parts';
|
|
3
|
+
|
|
4
|
+
/** `logo@1`. */
|
|
5
|
+
export const logoCatalog = defineBlokCatalog({
|
|
6
|
+
name: "logo",
|
|
7
|
+
version: 1,
|
|
8
|
+
description: "SVG drawing for logos and action logos; the palette is restricted to the logo pens.",
|
|
9
|
+
components: {
|
|
10
|
+
ActionLogo: parts.ActionLogo,
|
|
11
|
+
AgentLogo: parts.AgentLogo,
|
|
12
|
+
Circle: parts.Circle,
|
|
13
|
+
ClipPath: parts.ClipPath,
|
|
14
|
+
Defs: parts.Defs,
|
|
15
|
+
Ellipse: parts.Ellipse,
|
|
16
|
+
G: parts.G,
|
|
17
|
+
Line: parts.Line,
|
|
18
|
+
LinearGradient: parts.LinearGradient,
|
|
19
|
+
Path: parts.Path,
|
|
20
|
+
Polygon: parts.Polygon,
|
|
21
|
+
Polyline: parts.Polyline,
|
|
22
|
+
RadialGradient: parts.RadialGradient,
|
|
23
|
+
Rect: parts.Rect,
|
|
24
|
+
Stop: parts.Stop,
|
|
25
|
+
SvgText: parts.SvgText,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
|
|
3
|
+
import {BlokPropSchemas} from '../../renderer/runtime/schemas';
|
|
4
|
+
import {
|
|
5
|
+
actionProp,
|
|
6
|
+
alignSchema,
|
|
7
|
+
boolSchema,
|
|
8
|
+
childListSchema,
|
|
9
|
+
classNameSchema,
|
|
10
|
+
contentSchema,
|
|
11
|
+
justifySchema,
|
|
12
|
+
layoutFields,
|
|
13
|
+
numberSchema,
|
|
14
|
+
spacingSchema,
|
|
15
|
+
textAlignSchema,
|
|
16
|
+
} from '../props';
|
|
17
|
+
import {iconNameSchema} from './icons';
|
|
18
|
+
|
|
19
|
+
/** Content containers, tables, media and charts. */
|
|
20
|
+
|
|
21
|
+
/** `CardTitle` and `CardDescription` differ only in the element they render. */
|
|
22
|
+
const cardTextContract = (description: string) => ({
|
|
23
|
+
schema: z
|
|
24
|
+
.object({
|
|
25
|
+
text: BlokPropSchemas.DynamicString.optional().describe('The text to render.'),
|
|
26
|
+
children: contentSchema,
|
|
27
|
+
className: classNameSchema,
|
|
28
|
+
align: textAlignSchema,
|
|
29
|
+
})
|
|
30
|
+
.describe(description),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const tablePartContract = (description: string) => ({
|
|
34
|
+
schema: z
|
|
35
|
+
.object({
|
|
36
|
+
children: childListSchema,
|
|
37
|
+
className: classNameSchema,
|
|
38
|
+
})
|
|
39
|
+
.describe(description),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** `TableHead` and `TableCell` share one shape over two elements. */
|
|
43
|
+
const tableCellContract = (description: string) => ({
|
|
44
|
+
schema: z
|
|
45
|
+
.object({
|
|
46
|
+
text: BlokPropSchemas.DynamicString.optional().describe('Cell text.'),
|
|
47
|
+
children: contentSchema,
|
|
48
|
+
align: textAlignSchema,
|
|
49
|
+
className: classNameSchema,
|
|
50
|
+
})
|
|
51
|
+
.describe(description),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const chartSeriesSchema = z.object({
|
|
55
|
+
key: z.string(),
|
|
56
|
+
label: z.string().optional(),
|
|
57
|
+
color: z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const dataContracts = {
|
|
61
|
+
Card: {
|
|
62
|
+
schema: z
|
|
63
|
+
.object({
|
|
64
|
+
children: childListSchema,
|
|
65
|
+
size: z.enum(['default', 'sm']).optional().describe('Card density.'),
|
|
66
|
+
className: classNameSchema,
|
|
67
|
+
padding: spacingSchema,
|
|
68
|
+
width: layoutFields.width,
|
|
69
|
+
minHeight: layoutFields.minHeight,
|
|
70
|
+
height: layoutFields.height,
|
|
71
|
+
background: layoutFields.background,
|
|
72
|
+
borderColor: layoutFields.borderColor,
|
|
73
|
+
radius: layoutFields.radius,
|
|
74
|
+
})
|
|
75
|
+
.describe('A bordered surface grouping related content.'),
|
|
76
|
+
},
|
|
77
|
+
CardHeader: {
|
|
78
|
+
schema: z
|
|
79
|
+
.object({
|
|
80
|
+
children: childListSchema,
|
|
81
|
+
className: classNameSchema,
|
|
82
|
+
padding: spacingSchema,
|
|
83
|
+
gap: spacingSchema,
|
|
84
|
+
})
|
|
85
|
+
.describe('The header region of a Card.'),
|
|
86
|
+
},
|
|
87
|
+
CardTitle: cardTextContract('The title of a Card.'),
|
|
88
|
+
CardDescription: cardTextContract('Supporting text under a CardTitle.'),
|
|
89
|
+
CardContent: {
|
|
90
|
+
schema: z
|
|
91
|
+
.object({
|
|
92
|
+
children: childListSchema,
|
|
93
|
+
className: classNameSchema,
|
|
94
|
+
padding: spacingSchema,
|
|
95
|
+
gap: spacingSchema,
|
|
96
|
+
})
|
|
97
|
+
.describe('The body region of a Card.'),
|
|
98
|
+
},
|
|
99
|
+
CardFooter: {
|
|
100
|
+
schema: z
|
|
101
|
+
.object({
|
|
102
|
+
children: childListSchema,
|
|
103
|
+
className: classNameSchema,
|
|
104
|
+
justify: justifySchema,
|
|
105
|
+
align: alignSchema,
|
|
106
|
+
gap: spacingSchema,
|
|
107
|
+
padding: spacingSchema,
|
|
108
|
+
})
|
|
109
|
+
.describe('The footer region of a Card.'),
|
|
110
|
+
},
|
|
111
|
+
Table: {
|
|
112
|
+
schema: z
|
|
113
|
+
.object({
|
|
114
|
+
children: childListSchema.describe('TableHeader, TableBody and TableFooter children.'),
|
|
115
|
+
caption: BlokPropSchemas.DynamicString.optional().describe('Caption below the table.'),
|
|
116
|
+
className: classNameSchema,
|
|
117
|
+
})
|
|
118
|
+
.describe('A styled data table. Use the lowercase table element for a plain one.'),
|
|
119
|
+
},
|
|
120
|
+
TableHeader: tablePartContract('The header row group of a Table.'),
|
|
121
|
+
TableBody: tablePartContract('The body row group of a Table.'),
|
|
122
|
+
TableFooter: tablePartContract('The footer row group of a Table.'),
|
|
123
|
+
TableRow: {
|
|
124
|
+
schema: z
|
|
125
|
+
.object({
|
|
126
|
+
children: childListSchema.describe('TableHead or TableCell children.'),
|
|
127
|
+
onClick: actionProp('Runs when the row is clicked.'),
|
|
128
|
+
className: classNameSchema,
|
|
129
|
+
})
|
|
130
|
+
.describe('One row of a Table.'),
|
|
131
|
+
},
|
|
132
|
+
TableHead: tableCellContract('A header cell of a Table.'),
|
|
133
|
+
TableCell: tableCellContract('A cell of a Table.'),
|
|
134
|
+
Avatar: {
|
|
135
|
+
schema: z
|
|
136
|
+
.object({
|
|
137
|
+
src: BlokPropSchemas.DynamicString.optional().describe(
|
|
138
|
+
'Image URL, or an image its app registered as an asset: `{self.assets.logo}`.',
|
|
139
|
+
),
|
|
140
|
+
alt: BlokPropSchemas.DynamicString.optional().describe('Alternative text.'),
|
|
141
|
+
fallback: BlokPropSchemas.DynamicString.optional().describe(
|
|
142
|
+
'Initials shown while the image is missing.',
|
|
143
|
+
),
|
|
144
|
+
size: z.enum(['default', 'sm', 'lg']).optional().describe('Avatar size.'),
|
|
145
|
+
className: classNameSchema,
|
|
146
|
+
})
|
|
147
|
+
.describe('A user or entity avatar.'),
|
|
148
|
+
},
|
|
149
|
+
ItemGroup: {
|
|
150
|
+
schema: z
|
|
151
|
+
.object({
|
|
152
|
+
children: childListSchema.describe('Item children.'),
|
|
153
|
+
className: classNameSchema,
|
|
154
|
+
})
|
|
155
|
+
.describe('A vertical list of Items.'),
|
|
156
|
+
},
|
|
157
|
+
Item: {
|
|
158
|
+
schema: z
|
|
159
|
+
.object({
|
|
160
|
+
title: BlokPropSchemas.DynamicString.optional().describe('Item title.'),
|
|
161
|
+
description: BlokPropSchemas.DynamicString.optional().describe('Supporting text.'),
|
|
162
|
+
icon: iconNameSchema.describe('Icon shown in the media slot.'),
|
|
163
|
+
children: childListSchema.describe('Controls shown in the actions slot.'),
|
|
164
|
+
variant: z
|
|
165
|
+
.enum(['default', 'outline', 'muted'])
|
|
166
|
+
.optional()
|
|
167
|
+
.describe('Item appearance.'),
|
|
168
|
+
size: z.enum(['default', 'sm']).optional().describe('Item density.'),
|
|
169
|
+
onClick: actionProp('Runs when the item is clicked.'),
|
|
170
|
+
className: classNameSchema,
|
|
171
|
+
})
|
|
172
|
+
.describe('A list row with a title, description and actions.'),
|
|
173
|
+
},
|
|
174
|
+
Carousel: {
|
|
175
|
+
schema: z
|
|
176
|
+
.object({
|
|
177
|
+
children: childListSchema.describe('CarouselItem children.'),
|
|
178
|
+
orientation: z
|
|
179
|
+
.enum(['horizontal', 'vertical'])
|
|
180
|
+
.optional()
|
|
181
|
+
.describe('Scroll direction.'),
|
|
182
|
+
showControls: boolSchema.describe('Show previous/next buttons. Defaults to true.'),
|
|
183
|
+
className: classNameSchema,
|
|
184
|
+
})
|
|
185
|
+
.describe('A horizontally scrolling set of slides.'),
|
|
186
|
+
},
|
|
187
|
+
CarouselItem: {
|
|
188
|
+
schema: z
|
|
189
|
+
.object({
|
|
190
|
+
children: childListSchema,
|
|
191
|
+
className: classNameSchema,
|
|
192
|
+
})
|
|
193
|
+
.describe('One slide of a Carousel.'),
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* The one component in the catalog that is configured by data rather than by
|
|
197
|
+
* subcomponents: recharts series are options, not slots, and a `LineChart`
|
|
198
|
+
* built out of per-series bloks would be a worse authoring experience than the
|
|
199
|
+
* array it is really describing.
|
|
200
|
+
*/
|
|
201
|
+
Chart: {
|
|
202
|
+
schema: z
|
|
203
|
+
.object({
|
|
204
|
+
type: z
|
|
205
|
+
.enum(['line', 'bar', 'area', 'pie'])
|
|
206
|
+
.optional()
|
|
207
|
+
.describe('Chart kind. Defaults to "line".'),
|
|
208
|
+
data: z
|
|
209
|
+
.array(z.record(z.string(), z.unknown()))
|
|
210
|
+
.optional()
|
|
211
|
+
.describe('One object per point, keyed by category and series key.'),
|
|
212
|
+
categoryKey: z
|
|
213
|
+
.string()
|
|
214
|
+
.optional()
|
|
215
|
+
.describe('Key holding the x-axis (or slice) label. Defaults to "name".'),
|
|
216
|
+
series: z
|
|
217
|
+
.array(chartSeriesSchema)
|
|
218
|
+
.optional()
|
|
219
|
+
.describe('Series to plot: {key, label?, color?} per entry.'),
|
|
220
|
+
stacked: boolSchema.describe('Stack bar or area series.'),
|
|
221
|
+
showGrid: boolSchema.describe('Draw the cartesian grid. Defaults to true.'),
|
|
222
|
+
showLegend: boolSchema.describe('Show the legend.'),
|
|
223
|
+
height: numberSchema.describe('Chart height in pixels.'),
|
|
224
|
+
className: classNameSchema,
|
|
225
|
+
})
|
|
226
|
+
.describe('A line, bar, area or pie chart over tabular data.'),
|
|
227
|
+
},
|
|
228
|
+
} satisfies BlokComponentContracts;
|