@arkitektio/bsx 0.0.0-stage → 1.0.1
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 +36 -2
- package/dist/bsx/analyze.d.ts +30 -0
- package/dist/bsx/analyze.d.ts.map +1 -0
- package/dist/bsx/analyze.js +47 -0
- package/dist/bsx/analyze.js.map +1 -0
- package/dist/bsx/expr.d.ts +116 -0
- package/dist/bsx/expr.d.ts.map +1 -0
- package/dist/bsx/expr.js +476 -0
- package/dist/bsx/expr.js.map +1 -0
- package/dist/bsx/index.d.ts +9 -0
- package/dist/bsx/index.d.ts.map +1 -0
- package/dist/bsx/index.js +9 -0
- package/dist/bsx/index.js.map +1 -0
- package/dist/bsx/infer.d.ts +77 -0
- package/dist/bsx/infer.d.ts.map +1 -0
- package/dist/bsx/infer.js +279 -0
- package/dist/bsx/infer.js.map +1 -0
- package/dist/bsx/language.d.ts +106 -0
- package/dist/bsx/language.d.ts.map +1 -0
- package/dist/bsx/language.js +717 -0
- package/dist/bsx/language.js.map +1 -0
- package/dist/bsx/parse.d.ts +77 -0
- package/dist/bsx/parse.d.ts.map +1 -0
- package/dist/bsx/parse.js +801 -0
- package/dist/bsx/parse.js.map +1 -0
- package/dist/bsx/partial.d.ts +37 -0
- package/dist/bsx/partial.d.ts.map +1 -0
- package/dist/bsx/partial.js +184 -0
- package/dist/bsx/partial.js.map +1 -0
- package/dist/bsx/print.d.ts +21 -0
- package/dist/bsx/print.d.ts.map +1 -0
- package/dist/bsx/print.js +407 -0
- package/dist/bsx/print.js.map +1 -0
- package/dist/bsx/references.d.ts +155 -0
- package/dist/bsx/references.d.ts.map +1 -0
- package/dist/bsx/references.js +971 -0
- package/dist/bsx/references.js.map +1 -0
- package/dist/bsx/source.d.ts +34 -0
- package/dist/bsx/source.d.ts.map +1 -0
- package/dist/bsx/source.js +53 -0
- package/dist/bsx/source.js.map +1 -0
- package/dist/cache/keyedStore.d.ts +44 -0
- package/dist/cache/keyedStore.d.ts.map +1 -0
- package/dist/cache/keyedStore.js +84 -0
- package/dist/cache/keyedStore.js.map +1 -0
- package/dist/editor/BsxEditor.d.ts +19 -0
- package/dist/editor/BsxEditor.d.ts.map +1 -0
- package/dist/editor/BsxEditor.js +214 -0
- package/dist/editor/BsxEditor.js.map +1 -0
- package/dist/editor.d.ts +2 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +3 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/logo/CachedBlokLogo.d.ts +38 -0
- package/dist/logo/CachedBlokLogo.d.ts.map +1 -0
- package/dist/logo/CachedBlokLogo.js +84 -0
- package/dist/logo/CachedBlokLogo.js.map +1 -0
- package/dist/logo/SourceLogo.d.ts +8 -0
- package/dist/logo/SourceLogo.d.ts.map +1 -0
- package/dist/logo/SourceLogo.js +40 -0
- package/dist/logo/SourceLogo.js.map +1 -0
- package/dist/logo/actionLogoSource.d.ts +18 -0
- package/dist/logo/actionLogoSource.d.ts.map +1 -0
- package/dist/logo/actionLogoSource.js +20 -0
- package/dist/logo/actionLogoSource.js.map +1 -0
- package/dist/logo/demo.d.ts +8 -0
- package/dist/logo/demo.d.ts.map +1 -0
- package/dist/logo/demo.js +20 -0
- package/dist/logo/demo.js.map +1 -0
- package/dist/logo/logoCache.d.ts +44 -0
- package/dist/logo/logoCache.d.ts.map +1 -0
- package/dist/logo/logoCache.js +121 -0
- package/dist/logo/logoCache.js.map +1 -0
- package/dist/platform.d.ts +83 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +52 -0
- package/dist/platform.js.map +1 -0
- package/dist/preview/CachedBlokPreview.d.ts +49 -0
- package/dist/preview/CachedBlokPreview.d.ts.map +1 -0
- package/dist/preview/CachedBlokPreview.js +200 -0
- package/dist/preview/CachedBlokPreview.js.map +1 -0
- package/dist/preview/previewCache.d.ts +18 -0
- package/dist/preview/previewCache.d.ts.map +1 -0
- package/dist/preview/previewCache.js +50 -0
- package/dist/preview/previewCache.js.map +1 -0
- package/dist/preview/queue.d.ts +17 -0
- package/dist/preview/queue.d.ts.map +1 -0
- package/dist/preview/queue.js +67 -0
- package/dist/preview/queue.js.map +1 -0
- package/dist/preview/snapshot.d.ts +40 -0
- package/dist/preview/snapshot.d.ts.map +1 -0
- package/dist/preview/snapshot.js +211 -0
- package/dist/preview/snapshot.js.map +1 -0
- package/dist/preview/snapshotMode.d.ts +31 -0
- package/dist/preview/snapshotMode.d.ts.map +1 -0
- package/dist/preview/snapshotMode.js +19 -0
- package/dist/preview/snapshotMode.js.map +1 -0
- package/dist/renderer/BlokComponentHost.d.ts +46 -0
- package/dist/renderer/BlokComponentHost.d.ts.map +1 -0
- package/dist/renderer/BlokComponentHost.js +83 -0
- package/dist/renderer/BlokComponentHost.js.map +1 -0
- package/dist/renderer/BlokDebugState.d.ts +7 -0
- package/dist/renderer/BlokDebugState.d.ts.map +1 -0
- package/dist/renderer/BlokDebugState.js +19 -0
- package/dist/renderer/BlokDebugState.js.map +1 -0
- package/dist/renderer/BlokRenderer.d.ts +57 -0
- package/dist/renderer/BlokRenderer.d.ts.map +1 -0
- package/dist/renderer/BlokRenderer.js +136 -0
- package/dist/renderer/BlokRenderer.js.map +1 -0
- package/dist/renderer/assets.d.ts +85 -0
- package/dist/renderer/assets.d.ts.map +1 -0
- package/dist/renderer/assets.js +99 -0
- package/dist/renderer/assets.js.map +1 -0
- package/dist/renderer/baseCatalog.d.ts +12 -0
- package/dist/renderer/baseCatalog.d.ts.map +1 -0
- package/dist/renderer/baseCatalog.js +13 -0
- package/dist/renderer/baseCatalog.js.map +1 -0
- package/dist/renderer/bloks/control.d.ts +25 -0
- package/dist/renderer/bloks/control.d.ts.map +1 -0
- package/dist/renderer/bloks/control.js +294 -0
- package/dist/renderer/bloks/control.js.map +1 -0
- package/dist/renderer/bloks/data.d.ts +28 -0
- package/dist/renderer/bloks/data.d.ts.map +1 -0
- package/dist/renderer/bloks/data.js +409 -0
- package/dist/renderer/bloks/data.js.map +1 -0
- package/dist/renderer/bloks/feedback.d.ts +9 -0
- package/dist/renderer/bloks/feedback.d.ts.map +1 -0
- package/dist/renderer/bloks/feedback.js +128 -0
- package/dist/renderer/bloks/feedback.js.map +1 -0
- package/dist/renderer/bloks/forms.d.ts +43 -0
- package/dist/renderer/bloks/forms.d.ts.map +1 -0
- package/dist/renderer/bloks/forms.js +777 -0
- package/dist/renderer/bloks/forms.js.map +1 -0
- package/dist/renderer/bloks/html.d.ts +10 -0
- package/dist/renderer/bloks/html.d.ts.map +1 -0
- package/dist/renderer/bloks/html.js +99 -0
- package/dist/renderer/bloks/html.js.map +1 -0
- package/dist/renderer/bloks/icons.d.ts +263 -0
- package/dist/renderer/bloks/icons.d.ts.map +1 -0
- package/dist/renderer/bloks/icons.js +173 -0
- package/dist/renderer/bloks/icons.js.map +1 -0
- package/dist/renderer/bloks/index.d.ts +19 -0
- package/dist/renderer/bloks/index.d.ts.map +1 -0
- package/dist/renderer/bloks/index.js +30 -0
- package/dist/renderer/bloks/index.js.map +1 -0
- package/dist/renderer/bloks/inspector/Inspector.d.ts +2 -0
- package/dist/renderer/bloks/inspector/Inspector.d.ts.map +1 -0
- package/dist/renderer/bloks/inspector/Inspector.js +14 -0
- package/dist/renderer/bloks/inspector/Inspector.js.map +1 -0
- package/dist/renderer/bloks/layout.d.ts +16 -0
- package/dist/renderer/bloks/layout.d.ts.map +1 -0
- package/dist/renderer/bloks/layout.js +345 -0
- package/dist/renderer/bloks/layout.js.map +1 -0
- package/dist/renderer/bloks/logo/index.d.ts +26 -0
- package/dist/renderer/bloks/logo/index.d.ts.map +1 -0
- package/dist/renderer/bloks/logo/index.js +361 -0
- package/dist/renderer/bloks/logo/index.js.map +1 -0
- package/dist/renderer/bloks/logo/logo.fixture.json +323 -0
- package/dist/renderer/bloks/navigation.d.ts +29 -0
- package/dist/renderer/bloks/navigation.d.ts.map +1 -0
- package/dist/renderer/bloks/navigation.js +421 -0
- package/dist/renderer/bloks/navigation.js.map +1 -0
- package/dist/renderer/bloks/overlays.d.ts +56 -0
- package/dist/renderer/bloks/overlays.d.ts.map +1 -0
- package/dist/renderer/bloks/overlays.js +391 -0
- package/dist/renderer/bloks/overlays.js.map +1 -0
- package/dist/renderer/bloks/run/components.d.ts +5 -0
- package/dist/renderer/bloks/run/components.d.ts.map +1 -0
- package/dist/renderer/bloks/run/components.js +121 -0
- package/dist/renderer/bloks/run/components.js.map +1 -0
- package/dist/renderer/bloks/run/host.d.ts +38 -0
- package/dist/renderer/bloks/run/host.d.ts.map +1 -0
- package/dist/renderer/bloks/run/host.js +21 -0
- package/dist/renderer/bloks/run/host.js.map +1 -0
- package/dist/renderer/bloks/run/index.d.ts +4 -0
- package/dist/renderer/bloks/run/index.d.ts.map +1 -0
- package/dist/renderer/bloks/run/index.js +4 -0
- package/dist/renderer/bloks/run/index.js.map +1 -0
- package/dist/renderer/bloks/run/math.d.ts +50 -0
- package/dist/renderer/bloks/run/math.d.ts.map +1 -0
- package/dist/renderer/bloks/run/math.js +79 -0
- package/dist/renderer/bloks/run/math.js.map +1 -0
- package/dist/renderer/bloks/scene/Model.d.ts +3 -0
- package/dist/renderer/bloks/scene/Model.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/Model.js +367 -0
- package/dist/renderer/bloks/scene/Model.js.map +1 -0
- package/dist/renderer/bloks/scene/Scene.d.ts +46 -0
- package/dist/renderer/bloks/scene/Scene.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/Scene.js +467 -0
- package/dist/renderer/bloks/scene/Scene.js.map +1 -0
- package/dist/renderer/bloks/scene/Transform.d.ts +2 -0
- package/dist/renderer/bloks/scene/Transform.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/Transform.js +83 -0
- package/dist/renderer/bloks/scene/Transform.js.map +1 -0
- package/dist/renderer/bloks/scene/bindings.d.ts +9 -0
- package/dist/renderer/bloks/scene/bindings.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/bindings.js +387 -0
- package/dist/renderer/bloks/scene/bindings.js.map +1 -0
- package/dist/renderer/bloks/scene/colour.d.ts +23 -0
- package/dist/renderer/bloks/scene/colour.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/colour.js +45 -0
- package/dist/renderer/bloks/scene/colour.js.map +1 -0
- package/dist/renderer/bloks/scene/context.d.ts +115 -0
- package/dist/renderer/bloks/scene/context.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/context.js +120 -0
- package/dist/renderer/bloks/scene/context.js.map +1 -0
- package/dist/renderer/bloks/scene/host.d.ts +36 -0
- package/dist/renderer/bloks/scene/host.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/host.js +41 -0
- package/dist/renderer/bloks/scene/host.js.map +1 -0
- package/dist/renderer/bloks/scene/index.d.ts +10 -0
- package/dist/renderer/bloks/scene/index.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/index.js +30 -0
- package/dist/renderer/bloks/scene/index.js.map +1 -0
- package/dist/renderer/bloks/scene/interaction.d.ts +3 -0
- package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/interaction.js +166 -0
- package/dist/renderer/bloks/scene/interaction.js.map +1 -0
- package/dist/renderer/bloks/scene/loadModel.d.ts +35 -0
- package/dist/renderer/bloks/scene/loadModel.d.ts.map +1 -0
- package/dist/renderer/bloks/scene/loadModel.js +106 -0
- package/dist/renderer/bloks/scene/loadModel.js.map +1 -0
- package/dist/renderer/bloks/scene/scene.fixture.json +203 -0
- package/dist/renderer/bloks/scene/scope.fixture.glb +0 -0
- package/dist/renderer/bloks/shared/index.d.ts +6 -0
- package/dist/renderer/bloks/shared/index.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/index.js +6 -0
- package/dist/renderer/bloks/shared/index.js.map +1 -0
- package/dist/renderer/bloks/shared/props.d.ts +72 -0
- package/dist/renderer/bloks/shared/props.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/props.js +152 -0
- package/dist/renderer/bloks/shared/props.js.map +1 -0
- package/dist/renderer/bloks/shared/render.d.ts +20 -0
- package/dist/renderer/bloks/shared/render.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/render.js +42 -0
- package/dist/renderer/bloks/shared/render.js.map +1 -0
- package/dist/renderer/bloks/shared/schemas.d.ts +226 -0
- package/dist/renderer/bloks/shared/schemas.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/schemas.js +174 -0
- package/dist/renderer/bloks/shared/schemas.js.map +1 -0
- package/dist/renderer/bloks/shared/state.d.ts +40 -0
- package/dist/renderer/bloks/shared/state.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/state.js +49 -0
- package/dist/renderer/bloks/shared/state.js.map +1 -0
- package/dist/renderer/bloks/shared/throttle.d.ts +17 -0
- package/dist/renderer/bloks/shared/throttle.d.ts.map +1 -0
- package/dist/renderer/bloks/shared/throttle.js +38 -0
- package/dist/renderer/bloks/shared/throttle.js.map +1 -0
- package/dist/renderer/bloks/testing.d.ts +29 -0
- package/dist/renderer/bloks/testing.d.ts.map +1 -0
- package/dist/renderer/bloks/testing.js +32 -0
- package/dist/renderer/bloks/testing.js.map +1 -0
- package/dist/renderer/bloks/toast.d.ts +32 -0
- package/dist/renderer/bloks/toast.d.ts.map +1 -0
- package/dist/renderer/bloks/toast.js +89 -0
- package/dist/renderer/bloks/toast.js.map +1 -0
- package/dist/renderer/bloks/typography.d.ts +25 -0
- package/dist/renderer/bloks/typography.d.ts.map +1 -0
- package/dist/renderer/bloks/typography.js +188 -0
- package/dist/renderer/bloks/typography.js.map +1 -0
- package/dist/renderer/catalog.d.ts +42 -0
- package/dist/renderer/catalog.d.ts.map +1 -0
- package/dist/renderer/catalog.js +83 -0
- package/dist/renderer/catalog.js.map +1 -0
- package/dist/renderer/declarations.d.ts +102 -0
- package/dist/renderer/declarations.d.ts.map +1 -0
- package/dist/renderer/declarations.js +159 -0
- package/dist/renderer/declarations.js.map +1 -0
- package/dist/renderer/functions/index.d.ts +3 -0
- package/dist/renderer/functions/index.d.ts.map +1 -0
- package/dist/renderer/functions/index.js +4 -0
- package/dist/renderer/functions/index.js.map +1 -0
- package/dist/renderer/functions/v2/handler.d.ts +9 -0
- package/dist/renderer/functions/v2/handler.d.ts.map +1 -0
- package/dist/renderer/functions/v2/handler.js +9 -0
- package/dist/renderer/functions/v2/handler.js.map +1 -0
- package/dist/renderer/functions/v2/index.d.ts +41 -0
- package/dist/renderer/functions/v2/index.d.ts.map +1 -0
- package/dist/renderer/functions/v2/index.js +602 -0
- package/dist/renderer/functions/v2/index.js.map +1 -0
- package/dist/renderer/modules.d.ts +21 -0
- package/dist/renderer/modules.d.ts.map +1 -0
- package/dist/renderer/modules.js +41 -0
- package/dist/renderer/modules.js.map +1 -0
- package/dist/renderer/persist.d.ts +121 -0
- package/dist/renderer/persist.d.ts.map +1 -0
- package/dist/renderer/persist.js +201 -0
- package/dist/renderer/persist.js.map +1 -0
- package/dist/renderer/runtime/checks.d.ts +13 -0
- package/dist/renderer/runtime/checks.d.ts.map +1 -0
- package/dist/renderer/runtime/checks.js +132 -0
- package/dist/renderer/runtime/checks.js.map +1 -0
- package/dist/renderer/runtime/components.d.ts +118 -0
- package/dist/renderer/runtime/components.d.ts.map +1 -0
- package/dist/renderer/runtime/components.js +158 -0
- package/dist/renderer/runtime/components.js.map +1 -0
- package/dist/renderer/runtime/context.d.ts +43 -0
- package/dist/renderer/runtime/context.d.ts.map +1 -0
- package/dist/renderer/runtime/context.js +286 -0
- package/dist/renderer/runtime/context.js.map +1 -0
- package/dist/renderer/runtime/functions.d.ts +36 -0
- package/dist/renderer/runtime/functions.d.ts.map +1 -0
- package/dist/renderer/runtime/functions.js +37 -0
- package/dist/renderer/runtime/functions.js.map +1 -0
- package/dist/renderer/runtime/hooks.d.ts +138 -0
- package/dist/renderer/runtime/hooks.d.ts.map +1 -0
- package/dist/renderer/runtime/hooks.js +535 -0
- package/dist/renderer/runtime/hooks.js.map +1 -0
- package/dist/renderer/runtime/index.d.ts +21 -0
- package/dist/renderer/runtime/index.d.ts.map +1 -0
- package/dist/renderer/runtime/index.js +26 -0
- package/dist/renderer/runtime/index.js.map +1 -0
- package/dist/renderer/runtime/nodeState.d.ts +34 -0
- package/dist/renderer/runtime/nodeState.d.ts.map +1 -0
- package/dist/renderer/runtime/nodeState.js +13 -0
- package/dist/renderer/runtime/nodeState.js.map +1 -0
- package/dist/renderer/runtime/normalize.d.ts +21 -0
- package/dist/renderer/runtime/normalize.d.ts.map +1 -0
- package/dist/renderer/runtime/normalize.js +107 -0
- package/dist/renderer/runtime/normalize.js.map +1 -0
- package/dist/renderer/runtime/port.d.ts +24 -0
- package/dist/renderer/runtime/port.d.ts.map +1 -0
- package/dist/renderer/runtime/port.js +5 -0
- package/dist/renderer/runtime/port.js.map +1 -0
- package/dist/renderer/runtime/preflight.d.ts +20 -0
- package/dist/renderer/runtime/preflight.d.ts.map +1 -0
- package/dist/renderer/runtime/preflight.js +195 -0
- package/dist/renderer/runtime/preflight.js.map +1 -0
- package/dist/renderer/runtime/reads.d.ts +101 -0
- package/dist/renderer/runtime/reads.d.ts.map +1 -0
- package/dist/renderer/runtime/reads.js +284 -0
- package/dist/renderer/runtime/reads.js.map +1 -0
- package/dist/renderer/runtime/resolution.d.ts +71 -0
- package/dist/renderer/runtime/resolution.d.ts.map +1 -0
- package/dist/renderer/runtime/resolution.js +403 -0
- package/dist/renderer/runtime/resolution.js.map +1 -0
- package/dist/renderer/runtime/resource.d.ts +71 -0
- package/dist/renderer/runtime/resource.d.ts.map +1 -0
- package/dist/renderer/runtime/resource.js +138 -0
- package/dist/renderer/runtime/resource.js.map +1 -0
- package/dist/renderer/runtime/schemas.d.ts +119 -0
- package/dist/renderer/runtime/schemas.d.ts.map +1 -0
- package/dist/renderer/runtime/schemas.js +139 -0
- package/dist/renderer/runtime/schemas.js.map +1 -0
- package/dist/renderer/runtime/scope.d.ts +41 -0
- package/dist/renderer/runtime/scope.d.ts.map +1 -0
- package/dist/renderer/runtime/scope.js +95 -0
- package/dist/renderer/runtime/scope.js.map +1 -0
- package/dist/renderer/runtime/status.d.ts +35 -0
- package/dist/renderer/runtime/status.d.ts.map +1 -0
- package/dist/renderer/runtime/status.js +23 -0
- package/dist/renderer/runtime/status.js.map +1 -0
- package/dist/renderer/runtime/task.d.ts +63 -0
- package/dist/renderer/runtime/task.d.ts.map +1 -0
- package/dist/renderer/runtime/task.js +99 -0
- package/dist/renderer/runtime/task.js.map +1 -0
- package/dist/renderer/runtime/tree.d.ts +33 -0
- package/dist/renderer/runtime/tree.d.ts.map +1 -0
- package/dist/renderer/runtime/tree.js +59 -0
- package/dist/renderer/runtime/tree.js.map +1 -0
- package/dist/renderer/runtime/types.d.ts +247 -0
- package/dist/renderer/runtime/types.d.ts.map +1 -0
- package/dist/renderer/runtime/types.js +4 -0
- package/dist/renderer/runtime/types.js.map +1 -0
- package/dist/renderer/runtime/utils.d.ts +13 -0
- package/dist/renderer/runtime/utils.d.ts.map +1 -0
- package/dist/renderer/runtime/utils.js +48 -0
- package/dist/renderer/runtime/utils.js.map +1 -0
- package/dist/renderer/runtime/viewer.d.ts +17 -0
- package/dist/renderer/runtime/viewer.d.ts.map +1 -0
- package/dist/renderer/runtime/viewer.js +15 -0
- package/dist/renderer/runtime/viewer.js.map +1 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +10 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scene.d.ts +3 -0
- package/dist/scene.d.ts.map +1 -0
- package/dist/scene.js +4 -0
- package/dist/scene.js.map +1 -0
- package/dist/spec/bsx_v2.json +11380 -0
- package/dist/spec/catalogs/base@2.json +210 -0
- package/dist/spec/catalogs/base@2.json.js +210 -0
- package/dist/spec/catalogs/html@1.json +308 -0
- package/dist/spec/catalogs/html@1.json.js +308 -0
- package/dist/spec/catalogs/logo@1.json +1673 -0
- package/dist/spec/catalogs/logo@1.json.js +1673 -0
- package/dist/spec/catalogs/scene@1.json +806 -0
- package/dist/spec/catalogs/scene@1.json.js +806 -0
- package/dist/spec/catalogs/structure@1.json +185 -0
- package/dist/spec/catalogs/structure@1.json.js +185 -0
- package/dist/spec/catalogs/ui@1.json +3696 -0
- package/dist/spec/catalogs/ui@1.json.js +3696 -0
- package/dist/spec/catalogs.d.ts +101 -0
- package/dist/spec/catalogs.d.ts.map +1 -0
- package/dist/spec/catalogs.js +131 -0
- package/dist/spec/catalogs.js.map +1 -0
- package/dist/spec/locals.d.ts +14 -0
- package/dist/spec/locals.d.ts.map +1 -0
- package/dist/spec/locals.js +29 -0
- package/dist/spec/locals.js.map +1 -0
- package/dist/spec/modules/orkestrator.json +2755 -0
- package/dist/spec/modules/orkestrator.json.js +2755 -0
- package/dist/spec/vocabulary.d.ts +209 -0
- package/dist/spec/vocabulary.d.ts.map +1 -0
- package/dist/spec/vocabulary.js +307 -0
- package/dist/spec/vocabulary.js.map +1 -0
- package/dist/spec/vocabulary.json +411 -0
- package/dist/spec/vocabulary.json.js +411 -0
- package/dist/tailwind/defaultTheme.d.ts +3 -0
- package/dist/tailwind/defaultTheme.d.ts.map +1 -0
- package/dist/tailwind/defaultTheme.js +4 -0
- package/dist/tailwind/defaultTheme.js.map +1 -0
- package/dist/tailwind/runtimeTailwind.d.ts +14 -0
- package/dist/tailwind/runtimeTailwind.d.ts.map +1 -0
- package/dist/tailwind/runtimeTailwind.js +124 -0
- package/dist/tailwind/runtimeTailwind.js.map +1 -0
- package/dist/tailwind/theme.css +137 -0
- package/dist/tailwind/useBlokTailwind.d.ts +5 -0
- package/dist/tailwind/useBlokTailwind.d.ts.map +1 -0
- package/dist/tailwind/useBlokTailwind.js +74 -0
- package/dist/tailwind/useBlokTailwind.js.map +1 -0
- package/dist/tailwind.d.ts +3 -0
- package/dist/tailwind.d.ts.map +1 -0
- package/dist/tailwind.js +4 -0
- package/dist/tailwind.js.map +1 -0
- package/dist/vendor/core/data/scene/camera/navigateButtons.d.ts +15 -0
- package/dist/vendor/core/data/scene/camera/navigateButtons.d.ts.map +1 -0
- package/dist/vendor/core/data/scene/camera/navigateButtons.js +15 -0
- package/dist/vendor/core/data/scene/camera/navigateButtons.js.map +1 -0
- package/dist/vendor/core/dialogs/PageDialogHost.d.ts +5 -0
- package/dist/vendor/core/dialogs/PageDialogHost.d.ts.map +1 -0
- package/dist/vendor/core/dialogs/PageDialogHost.js +32 -0
- package/dist/vendor/core/dialogs/PageDialogHost.js.map +1 -0
- package/dist/vendor/core/model/affine.d.ts +44 -0
- package/dist/vendor/core/model/affine.d.ts.map +1 -0
- package/dist/vendor/core/model/affine.js +94 -0
- package/dist/vendor/core/model/affine.js.map +1 -0
- package/dist/vendor/core/model/glb.d.ts +75 -0
- package/dist/vendor/core/model/glb.d.ts.map +1 -0
- package/dist/vendor/core/model/glb.js +478 -0
- package/dist/vendor/core/model/glb.js.map +1 -0
- package/dist/vendor/core/model/joints.d.ts +26 -0
- package/dist/vendor/core/model/joints.d.ts.map +1 -0
- package/dist/vendor/core/model/joints.js +44 -0
- package/dist/vendor/core/model/joints.js.map +1 -0
- package/dist/vendor/core/model/motion.d.ts +65 -0
- package/dist/vendor/core/model/motion.d.ts.map +1 -0
- package/dist/vendor/core/model/motion.js +89 -0
- package/dist/vendor/core/model/motion.js.map +1 -0
- package/dist/vendor/core/model/testing.d.ts +7 -0
- package/dist/vendor/core/model/testing.d.ts.map +1 -0
- package/dist/vendor/core/model/testing.js +54 -0
- package/dist/vendor/core/model/testing.js.map +1 -0
- package/dist/vendor/core/model/units.d.ts +21 -0
- package/dist/vendor/core/model/units.d.ts.map +1 -0
- package/dist/vendor/core/model/units.js +107 -0
- package/dist/vendor/core/model/units.js.map +1 -0
- package/dist/vendor/core/model/writers.d.ts +24 -0
- package/dist/vendor/core/model/writers.d.ts.map +1 -0
- package/dist/vendor/core/model/writers.js +45 -0
- package/dist/vendor/core/model/writers.js.map +1 -0
- package/dist/vendor/core/ui/AsyncBoundary.d.ts +14 -0
- package/dist/vendor/core/ui/AsyncBoundary.d.ts.map +1 -0
- package/dist/vendor/core/ui/AsyncBoundary.js +42 -0
- package/dist/vendor/core/ui/AsyncBoundary.js.map +1 -0
- package/dist/vendor/core/ui/ChromeSurface.d.ts +16 -0
- package/dist/vendor/core/ui/ChromeSurface.d.ts.map +1 -0
- package/dist/vendor/core/ui/ChromeSurface.js +44 -0
- package/dist/vendor/core/ui/ChromeSurface.js.map +1 -0
- package/dist/vendor/core/ui/accordion.d.ts +8 -0
- package/dist/vendor/core/ui/accordion.d.ts.map +1 -0
- package/dist/vendor/core/ui/accordion.js +19 -0
- package/dist/vendor/core/ui/accordion.js.map +1 -0
- package/dist/vendor/core/ui/actionPlan.d.ts +54 -0
- package/dist/vendor/core/ui/actionPlan.d.ts.map +1 -0
- package/dist/vendor/core/ui/actionPlan.js +101 -0
- package/dist/vendor/core/ui/actionPlan.js.map +1 -0
- package/dist/vendor/core/ui/alert-dialog.d.ts +19 -0
- package/dist/vendor/core/ui/alert-dialog.d.ts.map +1 -0
- package/dist/vendor/core/ui/alert-dialog.js +50 -0
- package/dist/vendor/core/ui/alert-dialog.js.map +1 -0
- package/dist/vendor/core/ui/alert.d.ts +11 -0
- package/dist/vendor/core/ui/alert.d.ts.map +1 -0
- package/dist/vendor/core/ui/alert.js +29 -0
- package/dist/vendor/core/ui/alert.js.map +1 -0
- package/dist/vendor/core/ui/aspect-ratio.d.ts +4 -0
- package/dist/vendor/core/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/vendor/core/ui/aspect-ratio.js +8 -0
- package/dist/vendor/core/ui/aspect-ratio.js.map +1 -0
- package/dist/vendor/core/ui/avatar.d.ts +12 -0
- package/dist/vendor/core/ui/avatar.d.ts.map +1 -0
- package/dist/vendor/core/ui/avatar.js +24 -0
- package/dist/vendor/core/ui/avatar.js.map +1 -0
- package/dist/vendor/core/ui/badge.d.ts +10 -0
- package/dist/vendor/core/ui/badge.d.ts.map +1 -0
- package/dist/vendor/core/ui/badge.js +26 -0
- package/dist/vendor/core/ui/badge.js.map +1 -0
- package/dist/vendor/core/ui/bento-grid.d.ts +107 -0
- package/dist/vendor/core/ui/bento-grid.d.ts.map +1 -0
- package/dist/vendor/core/ui/bento-grid.js +631 -0
- package/dist/vendor/core/ui/bento-grid.js.map +1 -0
- package/dist/vendor/core/ui/breadcrumb.d.ts +12 -0
- package/dist/vendor/core/ui/breadcrumb.d.ts.map +1 -0
- package/dist/vendor/core/ui/breadcrumb.js +29 -0
- package/dist/vendor/core/ui/breadcrumb.js.map +1 -0
- package/dist/vendor/core/ui/button-group.d.ts +12 -0
- package/dist/vendor/core/ui/button-group.d.ts.map +1 -0
- package/dist/vendor/core/ui/button-group.js +28 -0
- package/dist/vendor/core/ui/button-group.js.map +1 -0
- package/dist/vendor/core/ui/button.d.ts +24 -0
- package/dist/vendor/core/ui/button.d.ts.map +1 -0
- package/dist/vendor/core/ui/button.js +39 -0
- package/dist/vendor/core/ui/button.js.map +1 -0
- package/dist/vendor/core/ui/calendar.d.ts +9 -0
- package/dist/vendor/core/ui/calendar.d.ts.map +1 -0
- package/dist/vendor/core/ui/calendar.js +76 -0
- package/dist/vendor/core/ui/calendar.js.map +1 -0
- package/dist/vendor/core/ui/card.d.ts +12 -0
- package/dist/vendor/core/ui/card.d.ts.map +1 -0
- package/dist/vendor/core/ui/card.js +26 -0
- package/dist/vendor/core/ui/card.js.map +1 -0
- package/dist/vendor/core/ui/carousel.d.ts +29 -0
- package/dist/vendor/core/ui/carousel.d.ts.map +1 -0
- package/dist/vendor/core/ui/carousel.js +92 -0
- package/dist/vendor/core/ui/carousel.js.map +1 -0
- package/dist/vendor/core/ui/chart.d.ts +41 -0
- package/dist/vendor/core/ui/chart.d.ts.map +1 -0
- package/dist/vendor/core/ui/chart.js +132 -0
- package/dist/vendor/core/ui/chart.js.map +1 -0
- package/dist/vendor/core/ui/checkbox.d.ts +5 -0
- package/dist/vendor/core/ui/checkbox.d.ts.map +1 -0
- package/dist/vendor/core/ui/checkbox.js +10 -0
- package/dist/vendor/core/ui/checkbox.js.map +1 -0
- package/dist/vendor/core/ui/collapsible.d.ts +6 -0
- package/dist/vendor/core/ui/collapsible.d.ts.map +1 -0
- package/dist/vendor/core/ui/collapsible.js +15 -0
- package/dist/vendor/core/ui/collapsible.js.map +1 -0
- package/dist/vendor/core/ui/context-menu.d.ts +28 -0
- package/dist/vendor/core/ui/context-menu.d.ts.map +1 -0
- package/dist/vendor/core/ui/context-menu.js +55 -0
- package/dist/vendor/core/ui/context-menu.js.map +1 -0
- package/dist/vendor/core/ui/dialog.d.ts +20 -0
- package/dist/vendor/core/ui/dialog.d.ts.map +1 -0
- package/dist/vendor/core/ui/dialog.js +44 -0
- package/dist/vendor/core/ui/dialog.js.map +1 -0
- package/dist/vendor/core/ui/drawer.d.ts +14 -0
- package/dist/vendor/core/ui/drawer.d.ts.map +1 -0
- package/dist/vendor/core/ui/drawer.js +38 -0
- package/dist/vendor/core/ui/drawer.js.map +1 -0
- package/dist/vendor/core/ui/dropdown-menu.d.ts +26 -0
- package/dist/vendor/core/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/vendor/core/ui/dropdown-menu.js +56 -0
- package/dist/vendor/core/ui/dropdown-menu.js.map +1 -0
- package/dist/vendor/core/ui/empty.d.ts +12 -0
- package/dist/vendor/core/ui/empty.d.ts.map +1 -0
- package/dist/vendor/core/ui/empty.js +34 -0
- package/dist/vendor/core/ui/empty.js.map +1 -0
- package/dist/vendor/core/ui/field.d.ts +25 -0
- package/dist/vendor/core/ui/field.d.ts.map +1 -0
- package/dist/vendor/core/ui/field.js +68 -0
- package/dist/vendor/core/ui/field.js.map +1 -0
- package/dist/vendor/core/ui/hover-card.d.ts +7 -0
- package/dist/vendor/core/ui/hover-card.d.ts.map +1 -0
- package/dist/vendor/core/ui/hover-card.js +19 -0
- package/dist/vendor/core/ui/hover-card.js.map +1 -0
- package/dist/vendor/core/ui/image.d.ts +10 -0
- package/dist/vendor/core/ui/image.d.ts.map +1 -0
- package/dist/vendor/core/ui/image.js +49 -0
- package/dist/vendor/core/ui/image.js.map +1 -0
- package/dist/vendor/core/ui/input-group.d.ts +17 -0
- package/dist/vendor/core/ui/input-group.d.ts.map +1 -0
- package/dist/vendor/core/ui/input-group.js +59 -0
- package/dist/vendor/core/ui/input-group.js.map +1 -0
- package/dist/vendor/core/ui/input-otp.d.ts +12 -0
- package/dist/vendor/core/ui/input-otp.d.ts.map +1 -0
- package/dist/vendor/core/ui/input-otp.js +21 -0
- package/dist/vendor/core/ui/input-otp.js.map +1 -0
- package/dist/vendor/core/ui/input.d.ts +4 -0
- package/dist/vendor/core/ui/input.d.ts.map +1 -0
- package/dist/vendor/core/ui/input.js +8 -0
- package/dist/vendor/core/ui/input.js.map +1 -0
- package/dist/vendor/core/ui/item.d.ts +24 -0
- package/dist/vendor/core/ui/item.d.ts.map +1 -0
- package/dist/vendor/core/ui/item.js +69 -0
- package/dist/vendor/core/ui/item.js.map +1 -0
- package/dist/vendor/core/ui/kbd.d.ts +4 -0
- package/dist/vendor/core/ui/kbd.d.ts.map +1 -0
- package/dist/vendor/core/ui/kbd.js +10 -0
- package/dist/vendor/core/ui/kbd.js.map +1 -0
- package/dist/vendor/core/ui/label.d.ts +5 -0
- package/dist/vendor/core/ui/label.d.ts.map +1 -0
- package/dist/vendor/core/ui/label.js +10 -0
- package/dist/vendor/core/ui/label.js.map +1 -0
- package/dist/vendor/core/ui/markdown.d.ts +19 -0
- package/dist/vendor/core/ui/markdown.d.ts.map +1 -0
- package/dist/vendor/core/ui/markdown.js +236 -0
- package/dist/vendor/core/ui/markdown.js.map +1 -0
- package/dist/vendor/core/ui/menubar.d.ts +27 -0
- package/dist/vendor/core/ui/menubar.d.ts.map +1 -0
- package/dist/vendor/core/ui/menubar.js +55 -0
- package/dist/vendor/core/ui/menubar.js.map +1 -0
- package/dist/vendor/core/ui/pagination.d.ts +14 -0
- package/dist/vendor/core/ui/pagination.d.ts.map +1 -0
- package/dist/vendor/core/ui/pagination.js +28 -0
- package/dist/vendor/core/ui/pagination.js.map +1 -0
- package/dist/vendor/core/ui/popover.d.ts +11 -0
- package/dist/vendor/core/ui/popover.d.ts.map +1 -0
- package/dist/vendor/core/ui/popover.js +31 -0
- package/dist/vendor/core/ui/popover.js.map +1 -0
- package/dist/vendor/core/ui/progress.d.ts +5 -0
- package/dist/vendor/core/ui/progress.d.ts.map +1 -0
- package/dist/vendor/core/ui/progress.js +9 -0
- package/dist/vendor/core/ui/progress.js.map +1 -0
- package/dist/vendor/core/ui/radio-group.d.ts +6 -0
- package/dist/vendor/core/ui/radio-group.d.ts.map +1 -0
- package/dist/vendor/core/ui/radio-group.js +14 -0
- package/dist/vendor/core/ui/radio-group.js.map +1 -0
- package/dist/vendor/core/ui/resizable.d.ts +9 -0
- package/dist/vendor/core/ui/resizable.d.ts.map +1 -0
- package/dist/vendor/core/ui/resizable.js +15 -0
- package/dist/vendor/core/ui/resizable.js.map +1 -0
- package/dist/vendor/core/ui/scroll-area.d.ts +6 -0
- package/dist/vendor/core/ui/scroll-area.d.ts.map +1 -0
- package/dist/vendor/core/ui/scroll-area.js +13 -0
- package/dist/vendor/core/ui/scroll-area.js.map +1 -0
- package/dist/vendor/core/ui/select.d.ts +16 -0
- package/dist/vendor/core/ui/select.d.ts.map +1 -0
- package/dist/vendor/core/ui/select.js +39 -0
- package/dist/vendor/core/ui/select.js.map +1 -0
- package/dist/vendor/core/ui/separator.d.ts +5 -0
- package/dist/vendor/core/ui/separator.d.ts.map +1 -0
- package/dist/vendor/core/ui/separator.js +10 -0
- package/dist/vendor/core/ui/separator.js.map +1 -0
- package/dist/vendor/core/ui/sheet.d.ts +17 -0
- package/dist/vendor/core/ui/sheet.d.ts.map +1 -0
- package/dist/vendor/core/ui/sheet.js +45 -0
- package/dist/vendor/core/ui/sheet.js.map +1 -0
- package/dist/vendor/core/ui/skeleton.d.ts +3 -0
- package/dist/vendor/core/ui/skeleton.d.ts.map +1 -0
- package/dist/vendor/core/ui/skeleton.js +7 -0
- package/dist/vendor/core/ui/skeleton.js.map +1 -0
- package/dist/vendor/core/ui/slider.d.ts +5 -0
- package/dist/vendor/core/ui/slider.d.ts.map +1 -0
- package/dist/vendor/core/ui/slider.js +14 -0
- package/dist/vendor/core/ui/slider.js.map +1 -0
- package/dist/vendor/core/ui/spinner.d.ts +3 -0
- package/dist/vendor/core/ui/spinner.d.ts.map +1 -0
- package/dist/vendor/core/ui/spinner.js +8 -0
- package/dist/vendor/core/ui/spinner.js.map +1 -0
- package/dist/vendor/core/ui/switch.d.ts +7 -0
- package/dist/vendor/core/ui/switch.d.ts.map +1 -0
- package/dist/vendor/core/ui/switch.js +9 -0
- package/dist/vendor/core/ui/switch.js.map +1 -0
- package/dist/vendor/core/ui/table.d.ts +11 -0
- package/dist/vendor/core/ui/table.d.ts.map +1 -0
- package/dist/vendor/core/ui/table.js +30 -0
- package/dist/vendor/core/ui/table.js.map +1 -0
- package/dist/vendor/core/ui/tabs.d.ts +12 -0
- package/dist/vendor/core/ui/tabs.d.ts.map +1 -0
- package/dist/vendor/core/ui/tabs.js +30 -0
- package/dist/vendor/core/ui/tabs.js.map +1 -0
- package/dist/vendor/core/ui/textarea.d.ts +4 -0
- package/dist/vendor/core/ui/textarea.d.ts.map +1 -0
- package/dist/vendor/core/ui/textarea.js +8 -0
- package/dist/vendor/core/ui/textarea.js.map +1 -0
- package/dist/vendor/core/ui/toggle-group.d.ts +11 -0
- package/dist/vendor/core/ui/toggle-group.d.ts.map +1 -0
- package/dist/vendor/core/ui/toggle-group.js +24 -0
- package/dist/vendor/core/ui/toggle-group.js.map +1 -0
- package/dist/vendor/core/ui/toggle.d.ts +12 -0
- package/dist/vendor/core/ui/toggle.d.ts.map +1 -0
- package/dist/vendor/core/ui/toggle.js +28 -0
- package/dist/vendor/core/ui/toggle.js.map +1 -0
- package/dist/vendor/core/ui/tooltip.d.ts +8 -0
- package/dist/vendor/core/ui/tooltip.d.ts.map +1 -0
- package/dist/vendor/core/ui/tooltip.js +21 -0
- package/dist/vendor/core/ui/tooltip.js.map +1 -0
- package/dist/vendor/core/ui/trigger-child.d.ts +17 -0
- package/dist/vendor/core/ui/trigger-child.d.ts.map +1 -0
- package/dist/vendor/core/ui/trigger-child.js +31 -0
- package/dist/vendor/core/ui/trigger-child.js.map +1 -0
- package/dist/vendor/core/util/hooks/useLatestRef.d.ts +10 -0
- package/dist/vendor/core/util/hooks/useLatestRef.d.ts.map +1 -0
- package/dist/vendor/core/util/hooks/useLatestRef.js +17 -0
- package/dist/vendor/core/util/hooks/useLatestRef.js.map +1 -0
- package/dist/vendor/core/util/utils.d.ts +8 -0
- package/dist/vendor/core/util/utils.d.ts.map +1 -0
- package/dist/vendor/core/util/utils.js +17 -0
- package/dist/vendor/core/util/utils.js.map +1 -0
- package/dist/web.d.ts +13 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/web.js +14 -0
- package/dist/web.js.map +1 -0
- package/package.json +188 -4
- package/src/bsx/analyze.ts +65 -0
- package/src/bsx/bsx.test.ts +111 -0
- package/src/bsx/expr.ts +541 -0
- package/src/bsx/index.ts +8 -0
- package/src/bsx/infer.test.ts +149 -0
- package/src/bsx/infer.ts +308 -0
- package/src/bsx/language.test.ts +204 -0
- package/src/bsx/language.ts +750 -0
- package/src/bsx/parse.ts +848 -0
- package/src/bsx/partial.test.ts +88 -0
- package/src/bsx/partial.ts +193 -0
- package/src/bsx/print.ts +412 -0
- package/src/bsx/references.test.ts +161 -0
- package/src/bsx/references.ts +1155 -0
- package/src/bsx/source.ts +70 -0
- package/src/cache/keyedStore.ts +122 -0
- package/src/editor/BsxEditor.tsx +252 -0
- package/src/editor.ts +2 -0
- package/src/env.d.ts +5 -0
- package/src/index.ts +6 -0
- package/src/logo/CachedBlokLogo.tsx +179 -0
- package/src/logo/SourceLogo.tsx +52 -0
- package/src/logo/actionLogoSource.ts +24 -0
- package/src/logo/demo.ts +21 -0
- package/src/logo/logoCache.test.ts +75 -0
- package/src/logo/logoCache.ts +130 -0
- package/src/platform.ts +121 -0
- package/src/preview/CachedBlokPreview.test.tsx +63 -0
- package/src/preview/CachedBlokPreview.tsx +336 -0
- package/src/preview/previewCache.test.ts +28 -0
- package/src/preview/previewCache.ts +64 -0
- package/src/preview/queue.test.ts +40 -0
- package/src/preview/queue.ts +75 -0
- package/src/preview/snapshot.test.ts +86 -0
- package/src/preview/snapshot.ts +226 -0
- package/src/preview/snapshotMode.test.tsx +45 -0
- package/src/preview/snapshotMode.tsx +45 -0
- package/src/renderer/BlokComponentHost.tsx +151 -0
- package/src/renderer/BlokDebugState.tsx +50 -0
- package/src/renderer/BlokRenderer.test.tsx +124 -0
- package/src/renderer/BlokRenderer.tsx +370 -0
- package/src/renderer/addBlokComponents.test.tsx +62 -0
- package/src/renderer/assets.test.tsx +123 -0
- package/src/renderer/assets.tsx +174 -0
- package/src/renderer/baseCatalog.ts +14 -0
- package/src/renderer/bloks/components.test.tsx +415 -0
- package/src/renderer/bloks/control.tsx +412 -0
- package/src/renderer/bloks/data.tsx +766 -0
- package/src/renderer/bloks/events.test.tsx +139 -0
- package/src/renderer/bloks/feedback.tsx +205 -0
- package/src/renderer/bloks/flow.test.tsx +201 -0
- package/src/renderer/bloks/forms.tsx +1195 -0
- package/src/renderer/bloks/html.tsx +171 -0
- package/src/renderer/bloks/icons.tsx +308 -0
- package/src/renderer/bloks/index.ts +42 -0
- package/src/renderer/bloks/inspector/Inspector.tsx +19 -0
- package/src/renderer/bloks/layout.tsx +538 -0
- package/src/renderer/bloks/logo/index.tsx +529 -0
- package/src/renderer/bloks/logo/logo.fixture.json +323 -0
- package/src/renderer/bloks/logo/logo.test.tsx +192 -0
- package/src/renderer/bloks/navigation.tsx +699 -0
- package/src/renderer/bloks/overlays.tsx +869 -0
- package/src/renderer/bloks/primitives.test.tsx +307 -0
- package/src/renderer/bloks/run/components.tsx +212 -0
- package/src/renderer/bloks/run/host.tsx +63 -0
- package/src/renderer/bloks/run/index.ts +3 -0
- package/src/renderer/bloks/run/math.test.ts +81 -0
- package/src/renderer/bloks/run/math.ts +112 -0
- package/src/renderer/bloks/run/run.test.tsx +164 -0
- package/src/renderer/bloks/scene/Model.tsx +571 -0
- package/src/renderer/bloks/scene/Scene.tsx +882 -0
- package/src/renderer/bloks/scene/Transform.tsx +116 -0
- package/src/renderer/bloks/scene/animate.test.tsx +81 -0
- package/src/renderer/bloks/scene/bindings.tsx +432 -0
- package/src/renderer/bloks/scene/colour.test.ts +47 -0
- package/src/renderer/bloks/scene/colour.ts +56 -0
- package/src/renderer/bloks/scene/context.tsx +228 -0
- package/src/renderer/bloks/scene/embedded.test.tsx +68 -0
- package/src/renderer/bloks/scene/host.tsx +84 -0
- package/src/renderer/bloks/scene/index.ts +32 -0
- package/src/renderer/bloks/scene/interaction.tsx +212 -0
- package/src/renderer/bloks/scene/loadModel.test.ts +69 -0
- package/src/renderer/bloks/scene/loadModel.ts +135 -0
- package/src/renderer/bloks/scene/scene.fixture.json +203 -0
- package/src/renderer/bloks/scene/scene.test.ts +35 -0
- package/src/renderer/bloks/scene/scope.fixture.glb +0 -0
- package/src/renderer/bloks/scene/transform.test.ts +26 -0
- package/src/renderer/bloks/shared/index.ts +5 -0
- package/src/renderer/bloks/shared/props.ts +224 -0
- package/src/renderer/bloks/shared/render.tsx +62 -0
- package/src/renderer/bloks/shared/schemas.ts +215 -0
- package/src/renderer/bloks/shared/state.ts +96 -0
- package/src/renderer/bloks/shared/throttle.test.ts +50 -0
- package/src/renderer/bloks/shared/throttle.ts +53 -0
- package/src/renderer/bloks/testing.tsx +73 -0
- package/src/renderer/bloks/time.test.tsx +78 -0
- package/src/renderer/bloks/toast.test.tsx +82 -0
- package/src/renderer/bloks/toast.tsx +132 -0
- package/src/renderer/bloks/typography.tsx +265 -0
- package/src/renderer/bloks/unavailable.test.tsx +52 -0
- package/src/renderer/catalog.tsx +97 -0
- package/src/renderer/declarations.test.ts +72 -0
- package/src/renderer/declarations.ts +285 -0
- package/src/renderer/functions/index.ts +3 -0
- package/src/renderer/functions/v2/functions.test.ts +256 -0
- package/src/renderer/functions/v2/handler.ts +11 -0
- package/src/renderer/functions/v2/index.ts +638 -0
- package/src/renderer/modules.ts +54 -0
- package/src/renderer/persist.test.ts +182 -0
- package/src/renderer/persist.ts +320 -0
- package/src/renderer/persistComponent.test.tsx +68 -0
- package/src/renderer/runtime/checks.ts +177 -0
- package/src/renderer/runtime/components.tsx +311 -0
- package/src/renderer/runtime/context.test.ts +137 -0
- package/src/renderer/runtime/context.tsx +369 -0
- package/src/renderer/runtime/functions.ts +69 -0
- package/src/renderer/runtime/hooks.ts +764 -0
- package/src/renderer/runtime/index.ts +31 -0
- package/src/renderer/runtime/nodeState.ts +43 -0
- package/src/renderer/runtime/normalize.test.ts +154 -0
- package/src/renderer/runtime/normalize.ts +121 -0
- package/src/renderer/runtime/port.tsx +24 -0
- package/src/renderer/runtime/preflight.test.ts +127 -0
- package/src/renderer/runtime/preflight.ts +264 -0
- package/src/renderer/runtime/reads.test.tsx +278 -0
- package/src/renderer/runtime/reads.tsx +448 -0
- package/src/renderer/runtime/resolution.test.ts +467 -0
- package/src/renderer/runtime/resolution.ts +531 -0
- package/src/renderer/runtime/resource.ts +196 -0
- package/src/renderer/runtime/schemas.ts +181 -0
- package/src/renderer/runtime/scope.tsx +123 -0
- package/src/renderer/runtime/status.ts +54 -0
- package/src/renderer/runtime/task.test.ts +131 -0
- package/src/renderer/runtime/task.ts +149 -0
- package/src/renderer/runtime/tree.tsx +138 -0
- package/src/renderer/runtime/types.ts +285 -0
- package/src/renderer/runtime/utils.test.ts +68 -0
- package/src/renderer/runtime/utils.ts +67 -0
- package/src/renderer/runtime/viewer.tsx +21 -0
- package/src/renderer/unbound.test.tsx +75 -0
- package/src/runtime.ts +9 -0
- package/src/scene.ts +3 -0
- package/src/spec/bsx_v2.json +11380 -0
- package/src/spec/catalogs/base@2.json +210 -0
- package/src/spec/catalogs/html@1.json +308 -0
- package/src/spec/catalogs/logo@1.json +1673 -0
- package/src/spec/catalogs/scene@1.json +806 -0
- package/src/spec/catalogs/structure@1.json +185 -0
- package/src/spec/catalogs/ui@1.json +3696 -0
- package/src/spec/catalogs.ts +210 -0
- package/src/spec/locals.ts +35 -0
- package/src/spec/modules/orkestrator.json +2755 -0
- package/src/spec/spec.test.ts +87 -0
- package/src/spec/vocabulary.json +411 -0
- package/src/spec/vocabulary.ts +514 -0
- package/src/tailwind/defaultTheme.ts +3 -0
- package/src/tailwind/runtimeTailwind.test.ts +86 -0
- package/src/tailwind/runtimeTailwind.ts +137 -0
- package/src/tailwind/theme.css +137 -0
- package/src/tailwind/useBlokTailwind.test.tsx +52 -0
- package/src/tailwind/useBlokTailwind.ts +84 -0
- package/src/tailwind.ts +3 -0
- package/src/vendor/core/data/scene/camera/navigateButtons.ts +15 -0
- package/src/vendor/core/dialogs/PageDialogHost.tsx +42 -0
- package/src/vendor/core/model/affine.ts +117 -0
- package/src/vendor/core/model/glb.ts +580 -0
- package/src/vendor/core/model/joints.ts +65 -0
- package/src/vendor/core/model/model.test.ts +241 -0
- package/src/vendor/core/model/motion.ts +134 -0
- package/src/vendor/core/model/testing.ts +57 -0
- package/src/vendor/core/model/units.ts +112 -0
- package/src/vendor/core/model/writers.ts +62 -0
- package/src/vendor/core/ui/AsyncBoundary.tsx +96 -0
- package/src/vendor/core/ui/ChromeSurface.tsx +51 -0
- package/src/vendor/core/ui/accordion.tsx +79 -0
- package/src/vendor/core/ui/actionPlan.ts +150 -0
- package/src/vendor/core/ui/alert-dialog.tsx +201 -0
- package/src/vendor/core/ui/alert.tsx +72 -0
- package/src/vendor/core/ui/aspect-ratio.tsx +11 -0
- package/src/vendor/core/ui/avatar.tsx +104 -0
- package/src/vendor/core/ui/badge.tsx +45 -0
- package/src/vendor/core/ui/bento-grid.tsx +818 -0
- package/src/vendor/core/ui/breadcrumb.tsx +119 -0
- package/src/vendor/core/ui/button-group.tsx +83 -0
- package/src/vendor/core/ui/button.tsx +82 -0
- package/src/vendor/core/ui/calendar.tsx +214 -0
- package/src/vendor/core/ui/card.tsx +94 -0
- package/src/vendor/core/ui/carousel.tsx +240 -0
- package/src/vendor/core/ui/chart.tsx +354 -0
- package/src/vendor/core/ui/checkbox.tsx +31 -0
- package/src/vendor/core/ui/collapsible.tsx +36 -0
- package/src/vendor/core/ui/context-menu.tsx +239 -0
- package/src/vendor/core/ui/dialog.tsx +165 -0
- package/src/vendor/core/ui/drawer.tsx +119 -0
- package/src/vendor/core/ui/dropdown-menu.tsx +250 -0
- package/src/vendor/core/ui/empty.tsx +99 -0
- package/src/vendor/core/ui/field.tsx +220 -0
- package/src/vendor/core/ui/hover-card.tsx +53 -0
- package/src/vendor/core/ui/image.tsx +70 -0
- package/src/vendor/core/ui/input-group.tsx +144 -0
- package/src/vendor/core/ui/input-otp.tsx +85 -0
- package/src/vendor/core/ui/input.tsx +19 -0
- package/src/vendor/core/ui/item.tsx +187 -0
- package/src/vendor/core/ui/kbd.tsx +26 -0
- package/src/vendor/core/ui/label.tsx +24 -0
- package/src/vendor/core/ui/markdown.tsx +398 -0
- package/src/vendor/core/ui/menubar.tsx +248 -0
- package/src/vendor/core/ui/pagination.tsx +132 -0
- package/src/vendor/core/ui/popover.tsx +96 -0
- package/src/vendor/core/ui/progress.tsx +29 -0
- package/src/vendor/core/ui/radio-group.tsx +45 -0
- package/src/vendor/core/ui/resizable.tsx +51 -0
- package/src/vendor/core/ui/scroll-area.tsx +55 -0
- package/src/vendor/core/ui/select.tsx +185 -0
- package/src/vendor/core/ui/separator.tsx +28 -0
- package/src/vendor/core/ui/sheet.tsx +139 -0
- package/src/vendor/core/ui/skeleton.tsx +13 -0
- package/src/vendor/core/ui/slider.tsx +57 -0
- package/src/vendor/core/ui/spinner.tsx +10 -0
- package/src/vendor/core/ui/switch.tsx +31 -0
- package/src/vendor/core/ui/table.tsx +95 -0
- package/src/vendor/core/ui/tabs.tsx +88 -0
- package/src/vendor/core/ui/textarea.tsx +18 -0
- package/src/vendor/core/ui/toggle-group.tsx +87 -0
- package/src/vendor/core/ui/toggle.tsx +46 -0
- package/src/vendor/core/ui/tooltip.tsx +64 -0
- package/src/vendor/core/ui/trigger-child.ts +35 -0
- package/src/vendor/core/util/hooks/useLatestRef.ts +17 -0
- package/src/vendor/core/util/utils.ts +18 -0
- package/src/web.ts +13 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button as ShadButton } from '../../vendor/core/ui/button.js';
|
|
4
|
+
import { ButtonGroup as ShadButtonGroup } from '../../vendor/core/ui/button-group.js';
|
|
5
|
+
import { Calendar as ShadCalendar } from '../../vendor/core/ui/calendar.js';
|
|
6
|
+
import { Checkbox as ShadCheckbox } from '../../vendor/core/ui/checkbox.js';
|
|
7
|
+
import { Field as ShadField, FieldDescription as ShadFieldDescription, FieldError as ShadFieldError, FieldGroup as ShadFieldGroup, FieldLabel as ShadFieldLabel, FieldSet as ShadFieldSet, } from '../../vendor/core/ui/field.js';
|
|
8
|
+
import { Input as ShadInput } from '../../vendor/core/ui/input.js';
|
|
9
|
+
import { InputGroup as ShadInputGroup, InputGroupAddon as ShadInputGroupAddon, InputGroupText as ShadInputGroupText, } from '../../vendor/core/ui/input-group.js';
|
|
10
|
+
import { InputOTP as ShadInputOTP, InputOTPGroup as ShadInputOTPGroup, InputOTPSlot as ShadInputOTPSlot, } from '../../vendor/core/ui/input-otp.js';
|
|
11
|
+
import { Label as ShadLabel } from '../../vendor/core/ui/label.js';
|
|
12
|
+
import { RadioGroup as ShadRadioGroup, RadioGroupItem as ShadRadioGroupItem } from '../../vendor/core/ui/radio-group.js';
|
|
13
|
+
import { Select as ShadSelect, SelectContent as ShadSelectContent, SelectGroup as ShadSelectGroup, SelectItem as ShadSelectItem, SelectLabel as ShadSelectLabel, SelectTrigger as ShadSelectTrigger, SelectValue as ShadSelectValue, } from '../../vendor/core/ui/select.js';
|
|
14
|
+
import { Slider as ShadSlider } from '../../vendor/core/ui/slider.js';
|
|
15
|
+
import { Switch as ShadSwitch } from '../../vendor/core/ui/switch.js';
|
|
16
|
+
import { Textarea as ShadTextarea } from '../../vendor/core/ui/textarea.js';
|
|
17
|
+
import { Toggle as ShadToggle } from '../../vendor/core/ui/toggle.js';
|
|
18
|
+
import { ToggleGroup as ShadToggleGroup, ToggleGroupItem as ShadToggleGroupItem } from '../../vendor/core/ui/toggle-group.js';
|
|
19
|
+
import { cn } from '../../vendor/core/util/utils.js';
|
|
20
|
+
import * as z from 'zod';
|
|
21
|
+
import { BlokPropSchemas, createBlokComponent, useBlok, useChecks, useEventAction, usePendingAction, useValidation, useValue, markBindSchema, useBlokDataAttributes, } from '../runtime/index.js';
|
|
22
|
+
import { renderIcon, iconNameSchema } from './icons.js';
|
|
23
|
+
import { actionProp, asBoolean, asNumber, asString, asStringList, bindSchema, boolSchema, buttonSizeSchema, buttonVariantSchema, checksSchema, childListSchema, classNameSchema, contentSchema, disabledSchema, numberSchema, orientationSchema, renderChildList, renderContent, throttle, useControlledValue, } from './shared/index.js';
|
|
24
|
+
/**
|
|
25
|
+
* Buttons and form controls.
|
|
26
|
+
*
|
|
27
|
+
* Every value-carrying control shares one contract:
|
|
28
|
+
*
|
|
29
|
+
* - `bind` is a data-model path the control reads from and writes back to;
|
|
30
|
+
* `value`/`defaultValue` are the controlled/uncontrolled alternatives.
|
|
31
|
+
* `useControlledValue` resolves the three into one value plus a setter.
|
|
32
|
+
* - the change action fires *after* the write, so its arguments can read the
|
|
33
|
+
* bound path — or `event.value`, which carries the new value directly.
|
|
34
|
+
*
|
|
35
|
+
* Multi-part controls (`Select`, `RadioGroup`, `ToggleGroup`) are composed
|
|
36
|
+
* from subcomponents exactly as in shadcn. That works because a child blok is
|
|
37
|
+
* rendered as a real React child, so Radix context reaches it; what it rules
|
|
38
|
+
* out is wrapping a child in `asChild`, since `BlokNode` does not forward refs.
|
|
39
|
+
*/
|
|
40
|
+
export const Button = createBlokComponent({
|
|
41
|
+
name: 'Button',
|
|
42
|
+
schema: z
|
|
43
|
+
.object({
|
|
44
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Button text.'),
|
|
45
|
+
children: contentSchema,
|
|
46
|
+
icon: iconNameSchema.describe('Icon rendered before the label.'),
|
|
47
|
+
onClick: actionProp('Runs when the button is clicked.'),
|
|
48
|
+
className: classNameSchema,
|
|
49
|
+
variant: buttonVariantSchema,
|
|
50
|
+
size: buttonSizeSchema,
|
|
51
|
+
fullWidth: boolSchema.describe('Stretch to the full width of the parent.'),
|
|
52
|
+
disabled: disabledSchema,
|
|
53
|
+
checks: checksSchema,
|
|
54
|
+
})
|
|
55
|
+
.describe('A clickable button.'),
|
|
56
|
+
}, ({ buildChild, component, schema }) => {
|
|
57
|
+
const blok = useBlok(component, schema);
|
|
58
|
+
const validation = useValidation(component, schema);
|
|
59
|
+
const label = useValue(blok.label);
|
|
60
|
+
const children = useValue(blok.children);
|
|
61
|
+
const icon = useValue(blok.icon);
|
|
62
|
+
const { run: onClick, pending, unavailable } = usePendingAction(blok.onClick);
|
|
63
|
+
const className = useValue(blok.className);
|
|
64
|
+
const rawVariant = useValue(blok.variant);
|
|
65
|
+
const size = useValue(blok.size);
|
|
66
|
+
const fullWidth = useValue(blok.fullWidth);
|
|
67
|
+
const disabled = useValue(blok.disabled);
|
|
68
|
+
const checks = useChecks(useValue(blok.checks));
|
|
69
|
+
const resolvedVariant = rawVariant === 'primary'
|
|
70
|
+
? 'default'
|
|
71
|
+
: rawVariant === 'borderless'
|
|
72
|
+
? 'ghost'
|
|
73
|
+
: rawVariant;
|
|
74
|
+
// `checks` are the author-facing guard; validation failures are a payload
|
|
75
|
+
// bug, and an agent its action needs being offline or unbound is the
|
|
76
|
+
// host's: each disables the button, with the reason in the tooltip.
|
|
77
|
+
const blockingReason = checks.failures[0] ?? validation.validationErrors[0] ?? unavailable;
|
|
78
|
+
const isDisabled = disabled === true || Boolean(blockingReason);
|
|
79
|
+
const attributes = useBlokDataAttributes({ busy: pending });
|
|
80
|
+
return (_jsxs(ShadButton, { ...attributes, variant: resolvedVariant ?? 'default', size: size ?? 'default',
|
|
81
|
+
// `ShadButton` already applies `buttonVariants({variant, size,
|
|
82
|
+
// className})` internally, so only the extras belong here.
|
|
83
|
+
className: cn(fullWidth && 'w-full', pending && 'animate-pulse', className), onClick: onClick, disabled: isDisabled, title: blockingReason, "aria-busy": pending || undefined, children: [renderIcon(icon), renderContent(children ?? label, buildChild)] }));
|
|
84
|
+
});
|
|
85
|
+
export const ButtonGroup = createBlokComponent({
|
|
86
|
+
name: 'ButtonGroup',
|
|
87
|
+
schema: z
|
|
88
|
+
.object({
|
|
89
|
+
children: childListSchema,
|
|
90
|
+
orientation: orientationSchema,
|
|
91
|
+
className: classNameSchema,
|
|
92
|
+
})
|
|
93
|
+
.describe('Groups related buttons into one connected control.'),
|
|
94
|
+
}, ({ buildChild, component, schema }) => {
|
|
95
|
+
const blok = useBlok(component, schema);
|
|
96
|
+
const children = useValue(blok.children);
|
|
97
|
+
const orientation = useValue(blok.orientation);
|
|
98
|
+
const className = useValue(blok.className);
|
|
99
|
+
return (_jsx(ShadButtonGroup, { orientation: orientation ?? 'horizontal', className: className, children: renderChildList(children, buildChild) }));
|
|
100
|
+
});
|
|
101
|
+
export const Input = createBlokComponent({
|
|
102
|
+
name: 'Input',
|
|
103
|
+
schema: z
|
|
104
|
+
.object({
|
|
105
|
+
bind: bindSchema,
|
|
106
|
+
value: BlokPropSchemas.DynamicString.optional().describe('Controlled value.'),
|
|
107
|
+
defaultValue: BlokPropSchemas.DynamicString.optional().describe('Initial value when uncontrolled.'),
|
|
108
|
+
placeholder: BlokPropSchemas.DynamicString.nullish().describe('Placeholder text.'),
|
|
109
|
+
type: z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe('HTML input type, e.g. "text", "number", "email", "password".'),
|
|
113
|
+
className: classNameSchema,
|
|
114
|
+
disabled: disabledSchema,
|
|
115
|
+
readOnly: boolSchema.describe('Show the value but refuse edits.'),
|
|
116
|
+
fullWidth: boolSchema.describe('Stretch to the full width of the parent.'),
|
|
117
|
+
action: actionProp('Runs after each edit. Arguments may read event.value.'),
|
|
118
|
+
})
|
|
119
|
+
.describe('A single-line text input.'),
|
|
120
|
+
}, ({ component, schema }) => {
|
|
121
|
+
const blok = useBlok(component, schema);
|
|
122
|
+
const bind = useValue(blok.bind);
|
|
123
|
+
const value = useValue(blok.value);
|
|
124
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
125
|
+
const placeholder = useValue(blok.placeholder);
|
|
126
|
+
const type = useValue(blok.type);
|
|
127
|
+
const className = useValue(blok.className);
|
|
128
|
+
const disabled = useValue(blok.disabled);
|
|
129
|
+
const readOnly = useValue(blok.readOnly);
|
|
130
|
+
const fullWidth = useValue(blok.fullWidth);
|
|
131
|
+
const action = useEventAction(blok.action);
|
|
132
|
+
const controlled = useControlledValue({
|
|
133
|
+
bind,
|
|
134
|
+
value,
|
|
135
|
+
defaultValue,
|
|
136
|
+
fallback: '',
|
|
137
|
+
parse: asString,
|
|
138
|
+
});
|
|
139
|
+
return (_jsx(ShadInput, { type: type ?? 'text', value: controlled.value, placeholder: typeof placeholder === 'string' ? placeholder : undefined, className: cn(fullWidth && 'w-full', className), disabled: disabled === true, readOnly: readOnly, onChange: event => {
|
|
140
|
+
const nextValue = event.target.value;
|
|
141
|
+
controlled.setValue(nextValue);
|
|
142
|
+
action?.(nextValue);
|
|
143
|
+
} }));
|
|
144
|
+
});
|
|
145
|
+
export const Textarea = createBlokComponent({
|
|
146
|
+
name: 'Textarea',
|
|
147
|
+
schema: z
|
|
148
|
+
.object({
|
|
149
|
+
bind: bindSchema,
|
|
150
|
+
value: BlokPropSchemas.DynamicString.optional().describe('Controlled value.'),
|
|
151
|
+
defaultValue: BlokPropSchemas.DynamicString.optional().describe('Initial value when uncontrolled.'),
|
|
152
|
+
placeholder: BlokPropSchemas.DynamicString.nullish().describe('Placeholder text.'),
|
|
153
|
+
rows: numberSchema.describe('Visible rows.'),
|
|
154
|
+
className: classNameSchema,
|
|
155
|
+
disabled: disabledSchema,
|
|
156
|
+
readOnly: boolSchema.describe('Show the value but refuse edits.'),
|
|
157
|
+
onChange: actionProp('Runs after each edit. Arguments may read event.value.'),
|
|
158
|
+
})
|
|
159
|
+
.describe('A multi-line text input.'),
|
|
160
|
+
}, ({ component, schema }) => {
|
|
161
|
+
const blok = useBlok(component, schema);
|
|
162
|
+
const bind = useValue(blok.bind);
|
|
163
|
+
const value = useValue(blok.value);
|
|
164
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
165
|
+
const placeholder = useValue(blok.placeholder);
|
|
166
|
+
const rows = useValue(blok.rows);
|
|
167
|
+
const className = useValue(blok.className);
|
|
168
|
+
const disabled = useValue(blok.disabled);
|
|
169
|
+
const readOnly = useValue(blok.readOnly);
|
|
170
|
+
const onChange = useEventAction(blok.onChange);
|
|
171
|
+
const controlled = useControlledValue({
|
|
172
|
+
bind,
|
|
173
|
+
value,
|
|
174
|
+
defaultValue,
|
|
175
|
+
fallback: '',
|
|
176
|
+
parse: asString,
|
|
177
|
+
});
|
|
178
|
+
return (_jsx(ShadTextarea, { value: controlled.value, rows: rows, placeholder: typeof placeholder === 'string' ? placeholder : undefined, className: className, disabled: disabled === true, readOnly: readOnly, onChange: event => {
|
|
179
|
+
const nextValue = event.target.value;
|
|
180
|
+
controlled.setValue(nextValue);
|
|
181
|
+
onChange?.(nextValue);
|
|
182
|
+
} }));
|
|
183
|
+
});
|
|
184
|
+
export const Label = createBlokComponent({
|
|
185
|
+
name: 'Label',
|
|
186
|
+
schema: z
|
|
187
|
+
.object({
|
|
188
|
+
text: BlokPropSchemas.DynamicString.optional().describe('Label text.'),
|
|
189
|
+
children: contentSchema,
|
|
190
|
+
htmlFor: z.string().optional().describe('Id of the control this labels.'),
|
|
191
|
+
className: classNameSchema,
|
|
192
|
+
})
|
|
193
|
+
.describe('A label for a form control.'),
|
|
194
|
+
}, ({ buildChild, component, schema }) => {
|
|
195
|
+
const blok = useBlok(component, schema);
|
|
196
|
+
const text = useValue(blok.text);
|
|
197
|
+
const children = useValue(blok.children);
|
|
198
|
+
const htmlFor = useValue(blok.htmlFor);
|
|
199
|
+
const className = useValue(blok.className);
|
|
200
|
+
return (_jsx(ShadLabel, { htmlFor: htmlFor, className: className, children: renderContent(children ?? text, buildChild) }));
|
|
201
|
+
});
|
|
202
|
+
/** `Checkbox` and `Switch` are the same contract over two presentations. */
|
|
203
|
+
const createBooleanControl = (name, description, Control) => createBlokComponent({
|
|
204
|
+
name,
|
|
205
|
+
schema: z
|
|
206
|
+
.object({
|
|
207
|
+
bind: bindSchema,
|
|
208
|
+
checked: BlokPropSchemas.DynamicBoolean.optional().describe('Controlled checked state.'),
|
|
209
|
+
defaultChecked: boolSchema.describe('Initial state when uncontrolled.'),
|
|
210
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Text shown beside the control.'),
|
|
211
|
+
disabled: disabledSchema,
|
|
212
|
+
className: classNameSchema,
|
|
213
|
+
onChange: actionProp('Runs on toggle. Arguments may read event.value.'),
|
|
214
|
+
checks: checksSchema,
|
|
215
|
+
})
|
|
216
|
+
.describe(description),
|
|
217
|
+
}, ({ component, schema }) => {
|
|
218
|
+
const blok = useBlok(component, schema);
|
|
219
|
+
const bind = useValue(blok.bind);
|
|
220
|
+
const checked = useValue(blok.checked);
|
|
221
|
+
const defaultChecked = useValue(blok.defaultChecked);
|
|
222
|
+
const label = useValue(blok.label);
|
|
223
|
+
const disabled = useValue(blok.disabled);
|
|
224
|
+
const className = useValue(blok.className);
|
|
225
|
+
const onChange = useEventAction(blok.onChange);
|
|
226
|
+
const checks = useChecks(useValue(blok.checks));
|
|
227
|
+
const controlled = useControlledValue({
|
|
228
|
+
bind,
|
|
229
|
+
value: checked,
|
|
230
|
+
defaultValue: defaultChecked,
|
|
231
|
+
fallback: false,
|
|
232
|
+
parse: asBoolean,
|
|
233
|
+
});
|
|
234
|
+
const blockingReason = checks.failures[0];
|
|
235
|
+
const control = (_jsx(Control, { checked: controlled.value, disabled: disabled === true || Boolean(blockingReason), className: className, title: blockingReason, onCheckedChange: next => {
|
|
236
|
+
const nextValue = next === true;
|
|
237
|
+
controlled.setValue(nextValue);
|
|
238
|
+
onChange?.(nextValue);
|
|
239
|
+
} }));
|
|
240
|
+
if (!label) {
|
|
241
|
+
return control;
|
|
242
|
+
}
|
|
243
|
+
return (_jsxs(ShadLabel, { className: "flex items-center gap-2 font-normal", children: [control, label] }));
|
|
244
|
+
});
|
|
245
|
+
export const Checkbox = createBooleanControl('Checkbox', 'A checkbox bound to a boolean value.', ShadCheckbox);
|
|
246
|
+
export const Switch = createBooleanControl('Switch', 'A switch bound to a boolean value.', ShadSwitch);
|
|
247
|
+
/** How often a slider's `onChange` runs while it is dragged. */
|
|
248
|
+
const SLIDER_CHANGE_INTERVAL_MS = 150;
|
|
249
|
+
export const Slider = createBlokComponent({
|
|
250
|
+
name: 'Slider',
|
|
251
|
+
schema: z
|
|
252
|
+
.object({
|
|
253
|
+
bind: bindSchema,
|
|
254
|
+
value: numberSchema.describe('Controlled value.'),
|
|
255
|
+
defaultValue: numberSchema.describe('Initial value when uncontrolled.'),
|
|
256
|
+
min: numberSchema.describe('Minimum. Defaults to 0.'),
|
|
257
|
+
max: numberSchema.describe('Maximum. Defaults to 100.'),
|
|
258
|
+
step: numberSchema.describe('Step size.'),
|
|
259
|
+
disabled: disabledSchema,
|
|
260
|
+
className: classNameSchema,
|
|
261
|
+
onChange: actionProp('Runs while dragging, at most every 150 ms and always with the final value. Arguments may read event.value.'),
|
|
262
|
+
onCommit: actionProp('Runs when the drag ends. Arguments may read event.value.'),
|
|
263
|
+
})
|
|
264
|
+
.describe('A slider bound to a numeric value.'),
|
|
265
|
+
}, ({ component, schema }) => {
|
|
266
|
+
const blok = useBlok(component, schema);
|
|
267
|
+
const bind = useValue(blok.bind);
|
|
268
|
+
const value = useValue(blok.value);
|
|
269
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
270
|
+
const min = useValue(blok.min);
|
|
271
|
+
const max = useValue(blok.max);
|
|
272
|
+
const step = useValue(blok.step);
|
|
273
|
+
const disabled = useValue(blok.disabled);
|
|
274
|
+
const className = useValue(blok.className);
|
|
275
|
+
const onChange = useEventAction(blok.onChange);
|
|
276
|
+
const onCommit = useEventAction(blok.onCommit);
|
|
277
|
+
// A drag yields a value per pointer move, and an action is a request to an
|
|
278
|
+
// agent: the thumb follows the pointer, the action follows at a measured pace.
|
|
279
|
+
const onChangeRef = React.useRef(onChange);
|
|
280
|
+
onChangeRef.current = onChange;
|
|
281
|
+
const sendChange = React.useMemo(() => throttle((next) => onChangeRef.current?.(next), SLIDER_CHANGE_INTERVAL_MS), []);
|
|
282
|
+
React.useEffect(() => () => sendChange.cancel(), [sendChange]);
|
|
283
|
+
const controlled = useControlledValue({
|
|
284
|
+
bind,
|
|
285
|
+
value,
|
|
286
|
+
defaultValue,
|
|
287
|
+
fallback: min ?? 0,
|
|
288
|
+
parse: asNumber,
|
|
289
|
+
});
|
|
290
|
+
// While dragged, the thumb follows the pointer: a `value` read from the app's state
|
|
291
|
+
// only changes once the action ran, and would hold the thumb where it was. After
|
|
292
|
+
// the commit it stays there until the value arrives (or, should the action not
|
|
293
|
+
// change it, for a moment).
|
|
294
|
+
const [dragged, setDragged] = React.useState(null);
|
|
295
|
+
React.useEffect(() => setDragged(null), [controlled.value]);
|
|
296
|
+
const release = React.useRef(undefined);
|
|
297
|
+
React.useEffect(() => () => clearTimeout(release.current), []);
|
|
298
|
+
return (_jsx(ShadSlider, { value: [dragged ?? controlled.value], min: min ?? 0, max: max ?? 100, step: step, disabled: disabled === true,
|
|
299
|
+
// A slider has no width of its own: in a Column, whose children sit at
|
|
300
|
+
// their content width, it would collapse. It takes the width on offer.
|
|
301
|
+
className: cn('min-w-40 self-stretch', className), onValueChange: next => {
|
|
302
|
+
const nextValue = next[0] ?? 0;
|
|
303
|
+
clearTimeout(release.current);
|
|
304
|
+
setDragged(nextValue);
|
|
305
|
+
controlled.setValue(nextValue);
|
|
306
|
+
sendChange(nextValue);
|
|
307
|
+
}, onValueCommit: next => {
|
|
308
|
+
// Where the drag stopped is sent before the commit, never after it.
|
|
309
|
+
sendChange.flush();
|
|
310
|
+
clearTimeout(release.current);
|
|
311
|
+
release.current = setTimeout(() => setDragged(null), 2000);
|
|
312
|
+
onCommit?.(next[0] ?? 0);
|
|
313
|
+
} }));
|
|
314
|
+
});
|
|
315
|
+
export const RadioGroup = createBlokComponent({
|
|
316
|
+
name: 'RadioGroup',
|
|
317
|
+
schema: z
|
|
318
|
+
.object({
|
|
319
|
+
bind: bindSchema,
|
|
320
|
+
value: BlokPropSchemas.DynamicString.optional().describe('Controlled selected value.'),
|
|
321
|
+
defaultValue: BlokPropSchemas.DynamicString.optional().describe('Initially selected value.'),
|
|
322
|
+
children: childListSchema.describe('RadioGroupItem children.'),
|
|
323
|
+
orientation: orientationSchema,
|
|
324
|
+
disabled: disabledSchema,
|
|
325
|
+
className: classNameSchema,
|
|
326
|
+
onChange: actionProp('Runs on selection. Arguments may read event.value.'),
|
|
327
|
+
})
|
|
328
|
+
.describe('A group of mutually exclusive options.'),
|
|
329
|
+
}, ({ buildChild, component, schema }) => {
|
|
330
|
+
const blok = useBlok(component, schema);
|
|
331
|
+
const bind = useValue(blok.bind);
|
|
332
|
+
const value = useValue(blok.value);
|
|
333
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
334
|
+
const children = useValue(blok.children);
|
|
335
|
+
const orientation = useValue(blok.orientation);
|
|
336
|
+
const disabled = useValue(blok.disabled);
|
|
337
|
+
const className = useValue(blok.className);
|
|
338
|
+
const onChange = useEventAction(blok.onChange);
|
|
339
|
+
const controlled = useControlledValue({
|
|
340
|
+
bind,
|
|
341
|
+
value,
|
|
342
|
+
defaultValue,
|
|
343
|
+
fallback: '',
|
|
344
|
+
parse: asString,
|
|
345
|
+
});
|
|
346
|
+
return (_jsx(ShadRadioGroup, { value: controlled.value, disabled: disabled === true, className: cn(orientation === 'horizontal' && 'flex-row', className), onValueChange: next => {
|
|
347
|
+
controlled.setValue(next);
|
|
348
|
+
onChange?.(next);
|
|
349
|
+
}, children: renderChildList(children, buildChild) }));
|
|
350
|
+
});
|
|
351
|
+
export const RadioGroupItem = createBlokComponent({
|
|
352
|
+
name: 'RadioGroupItem',
|
|
353
|
+
schema: z
|
|
354
|
+
.object({
|
|
355
|
+
value: z.string().describe('The value this option selects.'),
|
|
356
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Text shown beside the radio.'),
|
|
357
|
+
disabled: disabledSchema,
|
|
358
|
+
className: classNameSchema,
|
|
359
|
+
})
|
|
360
|
+
.describe('One option inside a RadioGroup.'),
|
|
361
|
+
}, ({ component, schema }) => {
|
|
362
|
+
const blok = useBlok(component, schema);
|
|
363
|
+
const value = useValue(blok.value);
|
|
364
|
+
const label = useValue(blok.label);
|
|
365
|
+
const disabled = useValue(blok.disabled);
|
|
366
|
+
const className = useValue(blok.className);
|
|
367
|
+
const item = (_jsx(ShadRadioGroupItem, { value: value ?? '', disabled: disabled === true, className: className }));
|
|
368
|
+
if (!label) {
|
|
369
|
+
return item;
|
|
370
|
+
}
|
|
371
|
+
return (_jsxs(ShadLabel, { className: "flex items-center gap-2 font-normal", children: [item, label] }));
|
|
372
|
+
});
|
|
373
|
+
export const Select = createBlokComponent({
|
|
374
|
+
name: 'Select',
|
|
375
|
+
schema: z
|
|
376
|
+
.object({
|
|
377
|
+
bind: bindSchema,
|
|
378
|
+
value: BlokPropSchemas.DynamicString.optional().describe('Controlled selected value.'),
|
|
379
|
+
defaultValue: BlokPropSchemas.DynamicString.optional().describe('Initially selected value.'),
|
|
380
|
+
children: childListSchema.describe('SelectTrigger and SelectContent children.'),
|
|
381
|
+
disabled: disabledSchema,
|
|
382
|
+
onChange: actionProp('Runs on selection. Arguments may read event.value.'),
|
|
383
|
+
})
|
|
384
|
+
.describe('A dropdown select. Compose SelectTrigger and SelectContent inside it.'),
|
|
385
|
+
}, ({ buildChild, component, schema }) => {
|
|
386
|
+
const blok = useBlok(component, schema);
|
|
387
|
+
const bind = useValue(blok.bind);
|
|
388
|
+
const value = useValue(blok.value);
|
|
389
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
390
|
+
const children = useValue(blok.children);
|
|
391
|
+
const disabled = useValue(blok.disabled);
|
|
392
|
+
const onChange = useEventAction(blok.onChange);
|
|
393
|
+
const controlled = useControlledValue({
|
|
394
|
+
bind,
|
|
395
|
+
value,
|
|
396
|
+
defaultValue,
|
|
397
|
+
fallback: '',
|
|
398
|
+
parse: asString,
|
|
399
|
+
});
|
|
400
|
+
return (_jsx(ShadSelect
|
|
401
|
+
// Radix treats "" as "nothing selected", which is exactly the empty
|
|
402
|
+
// state here, but it refuses it as an item value — so an unset select
|
|
403
|
+
// passes `undefined` rather than the empty string.
|
|
404
|
+
, {
|
|
405
|
+
// Radix treats "" as "nothing selected", which is exactly the empty
|
|
406
|
+
// state here, but it refuses it as an item value — so an unset select
|
|
407
|
+
// passes `undefined` rather than the empty string.
|
|
408
|
+
value: controlled.value === '' ? undefined : controlled.value, disabled: disabled === true, onValueChange: next => {
|
|
409
|
+
controlled.setValue(next);
|
|
410
|
+
onChange?.(next);
|
|
411
|
+
}, children: renderChildList(children, buildChild) }));
|
|
412
|
+
});
|
|
413
|
+
export const SelectTrigger = createBlokComponent({
|
|
414
|
+
name: 'SelectTrigger',
|
|
415
|
+
schema: z
|
|
416
|
+
.object({
|
|
417
|
+
placeholder: BlokPropSchemas.DynamicString.optional().describe('Shown while nothing is selected.'),
|
|
418
|
+
size: z.enum(['default', 'sm']).optional().describe('Trigger size.'),
|
|
419
|
+
className: classNameSchema,
|
|
420
|
+
})
|
|
421
|
+
.describe('The button that opens a Select.'),
|
|
422
|
+
}, ({ component, schema }) => {
|
|
423
|
+
const blok = useBlok(component, schema);
|
|
424
|
+
const placeholder = useValue(blok.placeholder);
|
|
425
|
+
const size = useValue(blok.size);
|
|
426
|
+
const className = useValue(blok.className);
|
|
427
|
+
return (_jsx(ShadSelectTrigger, { size: size ?? 'default', className: className, children: _jsx(ShadSelectValue, { placeholder: placeholder }) }));
|
|
428
|
+
});
|
|
429
|
+
export const SelectContent = createBlokComponent({
|
|
430
|
+
name: 'SelectContent',
|
|
431
|
+
schema: z
|
|
432
|
+
.object({
|
|
433
|
+
children: childListSchema.describe('SelectItem and SelectGroup children.'),
|
|
434
|
+
className: classNameSchema,
|
|
435
|
+
})
|
|
436
|
+
.describe('The popup list of a Select.'),
|
|
437
|
+
}, ({ buildChild, component, schema }) => {
|
|
438
|
+
const blok = useBlok(component, schema);
|
|
439
|
+
const children = useValue(blok.children);
|
|
440
|
+
const className = useValue(blok.className);
|
|
441
|
+
return (_jsx(ShadSelectContent, { className: className, children: renderChildList(children, buildChild) }));
|
|
442
|
+
});
|
|
443
|
+
export const SelectGroup = createBlokComponent({
|
|
444
|
+
name: 'SelectGroup',
|
|
445
|
+
schema: z
|
|
446
|
+
.object({
|
|
447
|
+
children: childListSchema,
|
|
448
|
+
className: classNameSchema,
|
|
449
|
+
})
|
|
450
|
+
.describe('Groups related SelectItems.'),
|
|
451
|
+
}, ({ buildChild, component, schema }) => {
|
|
452
|
+
const blok = useBlok(component, schema);
|
|
453
|
+
const children = useValue(blok.children);
|
|
454
|
+
const className = useValue(blok.className);
|
|
455
|
+
return (_jsx(ShadSelectGroup, { className: className, children: renderChildList(children, buildChild) }));
|
|
456
|
+
});
|
|
457
|
+
export const SelectLabel = createBlokComponent({
|
|
458
|
+
name: 'SelectLabel',
|
|
459
|
+
schema: z
|
|
460
|
+
.object({
|
|
461
|
+
text: BlokPropSchemas.DynamicString.optional().describe('Group heading.'),
|
|
462
|
+
className: classNameSchema,
|
|
463
|
+
})
|
|
464
|
+
.describe('A heading inside a SelectGroup.'),
|
|
465
|
+
}, ({ component, schema }) => {
|
|
466
|
+
const blok = useBlok(component, schema);
|
|
467
|
+
const text = useValue(blok.text);
|
|
468
|
+
const className = useValue(blok.className);
|
|
469
|
+
return _jsx(ShadSelectLabel, { className: className, children: text });
|
|
470
|
+
});
|
|
471
|
+
export const SelectItem = createBlokComponent({
|
|
472
|
+
name: 'SelectItem',
|
|
473
|
+
schema: z
|
|
474
|
+
.object({
|
|
475
|
+
value: z.string().describe('The value this option selects.'),
|
|
476
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Option text. Defaults to the value.'),
|
|
477
|
+
disabled: disabledSchema,
|
|
478
|
+
className: classNameSchema,
|
|
479
|
+
})
|
|
480
|
+
.describe('One option inside a SelectContent.'),
|
|
481
|
+
}, ({ component, schema }) => {
|
|
482
|
+
const blok = useBlok(component, schema);
|
|
483
|
+
const value = useValue(blok.value);
|
|
484
|
+
const label = useValue(blok.label);
|
|
485
|
+
const disabled = useValue(blok.disabled);
|
|
486
|
+
const className = useValue(blok.className);
|
|
487
|
+
return (_jsx(ShadSelectItem, { value: value ?? '', disabled: disabled === true, className: className, children: label ?? value }));
|
|
488
|
+
});
|
|
489
|
+
export const Toggle = createBlokComponent({
|
|
490
|
+
name: 'Toggle',
|
|
491
|
+
schema: z
|
|
492
|
+
.object({
|
|
493
|
+
bind: bindSchema,
|
|
494
|
+
pressed: BlokPropSchemas.DynamicBoolean.optional().describe('Controlled pressed state.'),
|
|
495
|
+
defaultPressed: boolSchema.describe('Initial state when uncontrolled.'),
|
|
496
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Button text.'),
|
|
497
|
+
icon: iconNameSchema.describe('Icon rendered before the label.'),
|
|
498
|
+
variant: z.enum(['default', 'outline']).optional().describe('Toggle appearance.'),
|
|
499
|
+
size: z.enum(['default', 'sm', 'lg']).optional().describe('Toggle size.'),
|
|
500
|
+
disabled: disabledSchema,
|
|
501
|
+
className: classNameSchema,
|
|
502
|
+
onChange: actionProp('Runs on toggle. Arguments may read event.value.'),
|
|
503
|
+
})
|
|
504
|
+
.describe('A two-state toggle button.'),
|
|
505
|
+
}, ({ component, schema }) => {
|
|
506
|
+
const blok = useBlok(component, schema);
|
|
507
|
+
const bind = useValue(blok.bind);
|
|
508
|
+
const pressed = useValue(blok.pressed);
|
|
509
|
+
const defaultPressed = useValue(blok.defaultPressed);
|
|
510
|
+
const label = useValue(blok.label);
|
|
511
|
+
const icon = useValue(blok.icon);
|
|
512
|
+
const variant = useValue(blok.variant);
|
|
513
|
+
const size = useValue(blok.size);
|
|
514
|
+
const disabled = useValue(blok.disabled);
|
|
515
|
+
const className = useValue(blok.className);
|
|
516
|
+
const onChange = useEventAction(blok.onChange);
|
|
517
|
+
const controlled = useControlledValue({
|
|
518
|
+
bind,
|
|
519
|
+
value: pressed,
|
|
520
|
+
defaultValue: defaultPressed,
|
|
521
|
+
fallback: false,
|
|
522
|
+
parse: asBoolean,
|
|
523
|
+
});
|
|
524
|
+
return (_jsxs(ShadToggle, { pressed: controlled.value, variant: variant ?? 'default', size: size ?? 'default', disabled: disabled === true, className: className, onPressedChange: next => {
|
|
525
|
+
controlled.setValue(next);
|
|
526
|
+
onChange?.(next);
|
|
527
|
+
}, children: [renderIcon(icon), label] }));
|
|
528
|
+
});
|
|
529
|
+
export const ToggleGroup = createBlokComponent({
|
|
530
|
+
name: 'ToggleGroup',
|
|
531
|
+
schema: z
|
|
532
|
+
.object({
|
|
533
|
+
bind: bindSchema,
|
|
534
|
+
multiple: boolSchema.describe('Allow more than one item to be pressed.'),
|
|
535
|
+
children: childListSchema.describe('ToggleGroupItem children.'),
|
|
536
|
+
variant: z.enum(['default', 'outline']).optional().describe('Item appearance.'),
|
|
537
|
+
size: z.enum(['default', 'sm', 'lg']).optional().describe('Item size.'),
|
|
538
|
+
disabled: disabledSchema,
|
|
539
|
+
className: classNameSchema,
|
|
540
|
+
onChange: actionProp('Runs on change. Arguments may read event.value.'),
|
|
541
|
+
})
|
|
542
|
+
.describe('A set of toggle buttons. Binds to a string, or to a list when multiple.'),
|
|
543
|
+
}, ({ buildChild, component, schema }) => {
|
|
544
|
+
const blok = useBlok(component, schema);
|
|
545
|
+
const bind = useValue(blok.bind);
|
|
546
|
+
const multiple = useValue(blok.multiple);
|
|
547
|
+
const children = useValue(blok.children);
|
|
548
|
+
const variant = useValue(blok.variant);
|
|
549
|
+
const size = useValue(blok.size);
|
|
550
|
+
const disabled = useValue(blok.disabled);
|
|
551
|
+
const className = useValue(blok.className);
|
|
552
|
+
const onChange = useEventAction(blok.onChange);
|
|
553
|
+
const single = useControlledValue({
|
|
554
|
+
bind: multiple ? undefined : bind,
|
|
555
|
+
value: undefined,
|
|
556
|
+
defaultValue: undefined,
|
|
557
|
+
fallback: '',
|
|
558
|
+
parse: asString,
|
|
559
|
+
});
|
|
560
|
+
const many = useControlledValue({
|
|
561
|
+
bind: multiple ? bind : undefined,
|
|
562
|
+
value: undefined,
|
|
563
|
+
defaultValue: undefined,
|
|
564
|
+
fallback: [],
|
|
565
|
+
parse: asStringList,
|
|
566
|
+
});
|
|
567
|
+
const shared = {
|
|
568
|
+
variant: variant ?? 'default',
|
|
569
|
+
size: size ?? 'default',
|
|
570
|
+
disabled: disabled === true,
|
|
571
|
+
className,
|
|
572
|
+
};
|
|
573
|
+
if (multiple) {
|
|
574
|
+
return (_jsx(ShadToggleGroup, { type: "multiple", value: many.value, onValueChange: next => {
|
|
575
|
+
many.setValue(next);
|
|
576
|
+
onChange?.(next);
|
|
577
|
+
}, ...shared, children: renderChildList(children, buildChild) }));
|
|
578
|
+
}
|
|
579
|
+
return (_jsx(ShadToggleGroup, { type: "single", value: single.value, onValueChange: next => {
|
|
580
|
+
single.setValue(next);
|
|
581
|
+
onChange?.(next);
|
|
582
|
+
}, ...shared, children: renderChildList(children, buildChild) }));
|
|
583
|
+
});
|
|
584
|
+
export const ToggleGroupItem = createBlokComponent({
|
|
585
|
+
name: 'ToggleGroupItem',
|
|
586
|
+
schema: z
|
|
587
|
+
.object({
|
|
588
|
+
value: z.string().describe('The value this item contributes.'),
|
|
589
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Item text.'),
|
|
590
|
+
icon: iconNameSchema.describe('Icon rendered before the label.'),
|
|
591
|
+
disabled: disabledSchema,
|
|
592
|
+
className: classNameSchema,
|
|
593
|
+
})
|
|
594
|
+
.describe('One item inside a ToggleGroup.'),
|
|
595
|
+
}, ({ component, schema }) => {
|
|
596
|
+
const blok = useBlok(component, schema);
|
|
597
|
+
const value = useValue(blok.value);
|
|
598
|
+
const label = useValue(blok.label);
|
|
599
|
+
const icon = useValue(blok.icon);
|
|
600
|
+
const disabled = useValue(blok.disabled);
|
|
601
|
+
const className = useValue(blok.className);
|
|
602
|
+
return (_jsxs(ShadToggleGroupItem, { value: value ?? '', disabled: disabled === true, className: className, children: [renderIcon(icon), label] }));
|
|
603
|
+
});
|
|
604
|
+
export const InputOTP = createBlokComponent({
|
|
605
|
+
name: 'InputOTP',
|
|
606
|
+
schema: z
|
|
607
|
+
.object({
|
|
608
|
+
bind: bindSchema,
|
|
609
|
+
length: numberSchema.describe('Number of slots. Defaults to 6.'),
|
|
610
|
+
disabled: disabledSchema,
|
|
611
|
+
className: classNameSchema,
|
|
612
|
+
onComplete: actionProp('Runs once every slot is filled. Arguments may read event.value.'),
|
|
613
|
+
})
|
|
614
|
+
.describe('A one-time-code input.'),
|
|
615
|
+
}, ({ component, schema }) => {
|
|
616
|
+
const blok = useBlok(component, schema);
|
|
617
|
+
const bind = useValue(blok.bind);
|
|
618
|
+
const length = useValue(blok.length);
|
|
619
|
+
const disabled = useValue(blok.disabled);
|
|
620
|
+
const className = useValue(blok.className);
|
|
621
|
+
const onComplete = useEventAction(blok.onComplete);
|
|
622
|
+
const slots = Math.max(1, Math.trunc(length ?? 6));
|
|
623
|
+
const controlled = useControlledValue({
|
|
624
|
+
bind,
|
|
625
|
+
value: undefined,
|
|
626
|
+
defaultValue: undefined,
|
|
627
|
+
fallback: '',
|
|
628
|
+
parse: asString,
|
|
629
|
+
});
|
|
630
|
+
return (_jsx(ShadInputOTP, { maxLength: slots, value: controlled.value, disabled: disabled === true, className: className, onChange: next => controlled.setValue(next), onComplete: next => onComplete?.(next), children: _jsx(ShadInputOTPGroup, { children: Array.from({ length: slots }, (_unused, index) => (_jsx(ShadInputOTPSlot, { index: index }, index))) }) }));
|
|
631
|
+
});
|
|
632
|
+
export const InputGroup = createBlokComponent({
|
|
633
|
+
name: 'InputGroup',
|
|
634
|
+
schema: z
|
|
635
|
+
.object({
|
|
636
|
+
children: childListSchema.describe('An Input plus InputGroupAddon children.'),
|
|
637
|
+
className: classNameSchema,
|
|
638
|
+
})
|
|
639
|
+
.describe('Wraps an input with leading or trailing addons.'),
|
|
640
|
+
}, ({ buildChild, component, schema }) => {
|
|
641
|
+
const blok = useBlok(component, schema);
|
|
642
|
+
const children = useValue(blok.children);
|
|
643
|
+
const className = useValue(blok.className);
|
|
644
|
+
return (_jsx(ShadInputGroup, { className: className, children: renderChildList(children, buildChild) }));
|
|
645
|
+
});
|
|
646
|
+
export const InputGroupAddon = createBlokComponent({
|
|
647
|
+
name: 'InputGroupAddon',
|
|
648
|
+
schema: z
|
|
649
|
+
.object({
|
|
650
|
+
text: BlokPropSchemas.DynamicString.optional().describe('Addon text.'),
|
|
651
|
+
icon: iconNameSchema.describe('Addon icon.'),
|
|
652
|
+
children: childListSchema,
|
|
653
|
+
align: z
|
|
654
|
+
.enum(['inline-start', 'inline-end', 'block-start', 'block-end'])
|
|
655
|
+
.optional()
|
|
656
|
+
.describe('Where the addon sits relative to the input.'),
|
|
657
|
+
className: classNameSchema,
|
|
658
|
+
})
|
|
659
|
+
.describe('A label, icon or button attached to an InputGroup.'),
|
|
660
|
+
}, ({ buildChild, component, schema }) => {
|
|
661
|
+
const blok = useBlok(component, schema);
|
|
662
|
+
const text = useValue(blok.text);
|
|
663
|
+
const icon = useValue(blok.icon);
|
|
664
|
+
const children = useValue(blok.children);
|
|
665
|
+
const align = useValue(blok.align);
|
|
666
|
+
const className = useValue(blok.className);
|
|
667
|
+
return (_jsxs(ShadInputGroupAddon, { align: align ?? 'inline-start', className: className, children: [renderIcon(icon), text ? _jsx(ShadInputGroupText, { children: text }) : null, renderChildList(children, buildChild)] }));
|
|
668
|
+
});
|
|
669
|
+
export const FieldSet = createBlokComponent({
|
|
670
|
+
name: 'FieldSet',
|
|
671
|
+
schema: z
|
|
672
|
+
.object({
|
|
673
|
+
children: childListSchema.describe('Field children.'),
|
|
674
|
+
className: classNameSchema,
|
|
675
|
+
})
|
|
676
|
+
.describe('Groups related fields into one form section.'),
|
|
677
|
+
}, ({ buildChild, component, schema }) => {
|
|
678
|
+
const blok = useBlok(component, schema);
|
|
679
|
+
const children = useValue(blok.children);
|
|
680
|
+
const className = useValue(blok.className);
|
|
681
|
+
return (_jsx(ShadFieldSet, { className: className, children: _jsx(ShadFieldGroup, { children: renderChildList(children, buildChild) }) }));
|
|
682
|
+
});
|
|
683
|
+
export const Field = createBlokComponent({
|
|
684
|
+
name: 'Field',
|
|
685
|
+
schema: z
|
|
686
|
+
.object({
|
|
687
|
+
label: BlokPropSchemas.DynamicString.optional().describe('Field label.'),
|
|
688
|
+
description: BlokPropSchemas.DynamicString.optional().describe('Helper text.'),
|
|
689
|
+
error: BlokPropSchemas.DynamicString.optional().describe('Error message; shown instead of the description when set.'),
|
|
690
|
+
children: childListSchema.describe('The control this field wraps.'),
|
|
691
|
+
orientation: z
|
|
692
|
+
.enum(['vertical', 'horizontal', 'responsive'])
|
|
693
|
+
.optional()
|
|
694
|
+
.describe('Label placement.'),
|
|
695
|
+
className: classNameSchema,
|
|
696
|
+
})
|
|
697
|
+
.describe('A labelled form field with description and error slots.'),
|
|
698
|
+
}, ({ buildChild, component, schema }) => {
|
|
699
|
+
const blok = useBlok(component, schema);
|
|
700
|
+
const label = useValue(blok.label);
|
|
701
|
+
const description = useValue(blok.description);
|
|
702
|
+
const error = useValue(blok.error);
|
|
703
|
+
const children = useValue(blok.children);
|
|
704
|
+
const orientation = useValue(blok.orientation);
|
|
705
|
+
const className = useValue(blok.className);
|
|
706
|
+
return (_jsxs(ShadField, { orientation: orientation ?? 'vertical', className: className, children: [label ? _jsx(ShadFieldLabel, { children: label }) : null, renderChildList(children, buildChild), error ? (_jsx(ShadFieldError, { children: error })) : description ? (_jsx(ShadFieldDescription, { children: description })) : null] }));
|
|
707
|
+
});
|
|
708
|
+
/** ISO `YYYY-MM-DD`, which is what a bound date path carries. */
|
|
709
|
+
const toIsoDate = (date) => date.toISOString().slice(0, 10);
|
|
710
|
+
const parseIsoDate = (raw) => {
|
|
711
|
+
if (!raw) {
|
|
712
|
+
return undefined;
|
|
713
|
+
}
|
|
714
|
+
const parsed = new Date(raw);
|
|
715
|
+
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
716
|
+
};
|
|
717
|
+
export const Calendar = createBlokComponent({
|
|
718
|
+
name: 'Calendar',
|
|
719
|
+
schema: z
|
|
720
|
+
.object({
|
|
721
|
+
bind: markBindSchema(bindSchema.describe('Data-model path holding an ISO date string (YYYY-MM-DD).')),
|
|
722
|
+
value: BlokPropSchemas.DynamicString.optional().describe('Controlled ISO date.'),
|
|
723
|
+
defaultValue: BlokPropSchemas.DynamicString.optional().describe('Initial ISO date.'),
|
|
724
|
+
disabled: disabledSchema,
|
|
725
|
+
className: classNameSchema,
|
|
726
|
+
onChange: actionProp('Runs on selection. Arguments may read event.value.'),
|
|
727
|
+
})
|
|
728
|
+
.describe('An inline date picker.'),
|
|
729
|
+
}, ({ component, schema }) => {
|
|
730
|
+
const blok = useBlok(component, schema);
|
|
731
|
+
const bind = useValue(blok.bind);
|
|
732
|
+
const value = useValue(blok.value);
|
|
733
|
+
const defaultValue = useValue(blok.defaultValue);
|
|
734
|
+
const disabled = useValue(blok.disabled);
|
|
735
|
+
const className = useValue(blok.className);
|
|
736
|
+
const onChange = useEventAction(blok.onChange);
|
|
737
|
+
const controlled = useControlledValue({
|
|
738
|
+
bind,
|
|
739
|
+
value,
|
|
740
|
+
defaultValue,
|
|
741
|
+
fallback: '',
|
|
742
|
+
parse: asString,
|
|
743
|
+
});
|
|
744
|
+
return (_jsx(ShadCalendar, { mode: "single", selected: parseIsoDate(controlled.value), disabled: disabled === true, className: className, onSelect: next => {
|
|
745
|
+
const nextValue = next ? toIsoDate(next) : '';
|
|
746
|
+
controlled.setValue(nextValue);
|
|
747
|
+
onChange?.(nextValue);
|
|
748
|
+
} }));
|
|
749
|
+
});
|
|
750
|
+
export const formBlokComponents = [
|
|
751
|
+
Button,
|
|
752
|
+
ButtonGroup,
|
|
753
|
+
Input,
|
|
754
|
+
Textarea,
|
|
755
|
+
Label,
|
|
756
|
+
Checkbox,
|
|
757
|
+
Switch,
|
|
758
|
+
Slider,
|
|
759
|
+
RadioGroup,
|
|
760
|
+
RadioGroupItem,
|
|
761
|
+
Select,
|
|
762
|
+
SelectTrigger,
|
|
763
|
+
SelectContent,
|
|
764
|
+
SelectGroup,
|
|
765
|
+
SelectLabel,
|
|
766
|
+
SelectItem,
|
|
767
|
+
Toggle,
|
|
768
|
+
ToggleGroup,
|
|
769
|
+
ToggleGroupItem,
|
|
770
|
+
InputOTP,
|
|
771
|
+
InputGroup,
|
|
772
|
+
InputGroupAddon,
|
|
773
|
+
FieldSet,
|
|
774
|
+
Field,
|
|
775
|
+
Calendar,
|
|
776
|
+
];
|
|
777
|
+
//# sourceMappingURL=forms.js.map
|