@arkitektio/bsx 4.2.0 → 5.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 +39 -18
- package/dist/bsx/parse.d.ts +13 -7
- package/dist/bsx/parse.d.ts.map +1 -1
- package/dist/bsx/parse.js +18 -57
- package/dist/bsx/parse.js.map +1 -1
- package/dist/bsx/print.d.ts.map +1 -1
- package/dist/bsx/print.js +22 -35
- package/dist/bsx/print.js.map +1 -1
- package/dist/bsx/references.d.ts +5 -5
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +124 -30
- package/dist/bsx/references.js.map +1 -1
- package/dist/catalogs/html.d.ts +1 -1
- package/dist/catalogs/html.d.ts.map +1 -1
- package/dist/catalogs/html.js +3 -3
- package/dist/catalogs/html.js.map +1 -1
- package/dist/catalogs/index.d.ts +209 -139
- package/dist/catalogs/index.d.ts.map +1 -1
- package/dist/catalogs/index.js +6 -2
- package/dist/catalogs/index.js.map +1 -1
- package/dist/catalogs/logo.d.ts +5 -5
- package/dist/catalogs/logo.d.ts.map +1 -1
- package/dist/catalogs/logo.js +3 -3
- package/dist/catalogs/logo.js.map +1 -1
- package/dist/catalogs/parts/data.d.ts +6 -6
- package/dist/catalogs/parts/feedback.d.ts +15 -15
- package/dist/catalogs/parts/forms.d.ts +55 -27
- package/dist/catalogs/parts/forms.d.ts.map +1 -1
- package/dist/catalogs/parts/forms.js +32 -0
- package/dist/catalogs/parts/forms.js.map +1 -1
- package/dist/catalogs/parts/html.d.ts +1 -1
- package/dist/catalogs/parts/html.d.ts.map +1 -1
- package/dist/catalogs/parts/html.js +1 -1
- package/dist/catalogs/parts/html.js.map +1 -1
- package/dist/catalogs/parts/icons.d.ts +11 -11
- package/dist/catalogs/parts/icons.js +1 -1
- package/dist/catalogs/parts/index.d.ts +183 -137
- package/dist/catalogs/parts/index.d.ts.map +1 -1
- package/dist/catalogs/parts/layout.d.ts +11 -1
- package/dist/catalogs/parts/layout.d.ts.map +1 -1
- package/dist/catalogs/parts/layout.js +9 -0
- package/dist/catalogs/parts/layout.js.map +1 -1
- package/dist/catalogs/parts/logo.d.ts +8 -8
- package/dist/catalogs/parts/logo.d.ts.map +1 -1
- package/dist/catalogs/parts/logo.js +2 -2
- package/dist/catalogs/parts/logo.js.map +1 -1
- package/dist/catalogs/parts/navigation.d.ts +20 -20
- package/dist/catalogs/parts/overlays.d.ts +55 -55
- package/dist/catalogs/parts/run.d.ts +13 -5
- package/dist/catalogs/parts/run.d.ts.map +1 -1
- package/dist/catalogs/parts/run.js +1 -1
- package/dist/catalogs/parts/scene.d.ts +12 -4
- package/dist/catalogs/parts/scene.d.ts.map +1 -1
- package/dist/catalogs/parts/scene.js +4 -0
- package/dist/catalogs/parts/scene.js.map +1 -1
- package/dist/catalogs/parts/structure.js +2 -2
- package/dist/catalogs/parts/toast.js +1 -1
- package/dist/catalogs/parts/toast.js.map +1 -1
- package/dist/catalogs/parts/typography.js +1 -1
- package/dist/catalogs/parts/typography.js.map +1 -1
- package/dist/catalogs/props.d.ts +3 -3
- package/dist/catalogs/scene.d.ts +13 -5
- package/dist/catalogs/scene.d.ts.map +1 -1
- package/dist/catalogs/scene.js +3 -3
- package/dist/catalogs/scene.js.map +1 -1
- package/dist/catalogs/shadcn.d.ts +106 -58
- package/dist/catalogs/shadcn.d.ts.map +1 -1
- package/dist/catalogs/shadcn.js +6 -4
- package/dist/catalogs/shadcn.js.map +1 -1
- package/dist/catalogs/structure.d.ts +1 -1
- package/dist/catalogs/structure.d.ts.map +1 -1
- package/dist/catalogs/structure.js +3 -3
- package/dist/catalogs/structure.js.map +1 -1
- package/dist/catalogs/ui.d.ts +83 -73
- package/dist/catalogs/ui.d.ts.map +1 -1
- package/dist/catalogs/ui.js +4 -3
- package/dist/catalogs/ui.js.map +1 -1
- package/dist/catalogs.d.ts +1 -1
- package/dist/catalogs.d.ts.map +1 -1
- package/dist/catalogs.js +2 -2
- package/dist/catalogs.js.map +1 -1
- package/dist/ports.js +1 -1
- package/dist/ports.js.map +1 -1
- package/dist/renderer/BlokRenderer.d.ts +4 -1
- package/dist/renderer/BlokRenderer.d.ts.map +1 -1
- package/dist/renderer/BlokRenderer.js +5 -1
- package/dist/renderer/BlokRenderer.js.map +1 -1
- package/dist/renderer/baseCatalog.d.ts +8 -6
- package/dist/renderer/baseCatalog.d.ts.map +1 -1
- package/dist/renderer/baseCatalog.js +7 -5
- package/dist/renderer/baseCatalog.js.map +1 -1
- package/dist/renderer/bloks/control.d.ts +14 -0
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +105 -6
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/renderer/bloks/data.d.ts +6 -6
- package/dist/renderer/bloks/feedback.d.ts +15 -15
- package/dist/renderer/bloks/forms.d.ts +51 -27
- package/dist/renderer/bloks/forms.d.ts.map +1 -1
- package/dist/renderer/bloks/forms.js +56 -0
- package/dist/renderer/bloks/forms.js.map +1 -1
- package/dist/renderer/bloks/html.js +2 -2
- package/dist/renderer/bloks/icons.d.ts +5 -5
- package/dist/renderer/bloks/index.d.ts +166 -134
- package/dist/renderer/bloks/index.d.ts.map +1 -1
- package/dist/renderer/bloks/index.js +1 -1
- package/dist/renderer/bloks/layout.d.ts +9 -1
- package/dist/renderer/bloks/layout.d.ts.map +1 -1
- package/dist/renderer/bloks/layout.js +15 -0
- package/dist/renderer/bloks/layout.js.map +1 -1
- package/dist/renderer/bloks/logo/index.d.ts +5 -5
- package/dist/renderer/bloks/logo/index.d.ts.map +1 -1
- package/dist/renderer/bloks/logo/index.js +2 -2
- package/dist/renderer/bloks/logo/index.js.map +1 -1
- package/dist/renderer/bloks/navigation.d.ts +20 -20
- package/dist/renderer/bloks/overlays.d.ts +55 -55
- package/dist/renderer/bloks/run/components.d.ts +6 -2
- package/dist/renderer/bloks/run/components.d.ts.map +1 -1
- package/dist/renderer/bloks/run/components.js +1 -1
- package/dist/renderer/bloks/run/host.d.ts +32 -3
- package/dist/renderer/bloks/run/host.d.ts.map +1 -1
- package/dist/renderer/bloks/run/host.js.map +1 -1
- package/dist/renderer/bloks/scene/index.d.ts +6 -2
- package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
- package/dist/renderer/bloks/toast.d.ts +1 -1
- package/dist/renderer/bloks/typography.js +1 -1
- package/dist/renderer/catalog.d.ts +4 -7
- package/dist/renderer/catalog.d.ts.map +1 -1
- package/dist/renderer/catalog.js +7 -31
- package/dist/renderer/catalog.js.map +1 -1
- package/dist/renderer/declare.d.ts +31 -19
- package/dist/renderer/declare.d.ts.map +1 -1
- package/dist/renderer/declare.js +44 -18
- package/dist/renderer/declare.js.map +1 -1
- package/dist/renderer/functions/v2/index.d.ts.map +1 -1
- package/dist/renderer/functions/v2/index.js +39 -0
- package/dist/renderer/functions/v2/index.js.map +1 -1
- package/dist/renderer/runtime/catalog.d.ts +27 -7
- package/dist/renderer/runtime/catalog.d.ts.map +1 -1
- package/dist/renderer/runtime/catalog.js +30 -3
- package/dist/renderer/runtime/catalog.js.map +1 -1
- package/dist/renderer/runtime/components.d.ts +7 -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/context.d.ts +2 -0
- package/dist/renderer/runtime/context.d.ts.map +1 -1
- package/dist/renderer/runtime/context.js +4 -0
- package/dist/renderer/runtime/context.js.map +1 -1
- package/dist/renderer/runtime/describe.d.ts +14 -4
- package/dist/renderer/runtime/describe.d.ts.map +1 -1
- package/dist/renderer/runtime/describe.js +3 -0
- package/dist/renderer/runtime/describe.js.map +1 -1
- package/dist/renderer/runtime/hooks.d.ts.map +1 -1
- package/dist/renderer/runtime/hooks.js +1 -0
- package/dist/renderer/runtime/hooks.js.map +1 -1
- package/dist/renderer/runtime/index.d.ts +1 -0
- package/dist/renderer/runtime/index.d.ts.map +1 -1
- package/dist/renderer/runtime/index.js +1 -0
- package/dist/renderer/runtime/index.js.map +1 -1
- package/dist/renderer/runtime/preflight.d.ts.map +1 -1
- package/dist/renderer/runtime/preflight.js +5 -2
- package/dist/renderer/runtime/preflight.js.map +1 -1
- package/dist/renderer/runtime/resolution.d.ts +2 -0
- package/dist/renderer/runtime/resolution.d.ts.map +1 -1
- package/dist/renderer/runtime/resolution.js +17 -1
- package/dist/renderer/runtime/resolution.js.map +1 -1
- package/dist/renderer/runtime/schemas.d.ts +5 -5
- package/dist/renderer/runtime/task.d.ts +25 -2
- package/dist/renderer/runtime/task.d.ts.map +1 -1
- package/dist/renderer/runtime/task.js +11 -2
- package/dist/renderer/runtime/task.js.map +1 -1
- package/dist/renderer/runtime/text.d.ts +28 -0
- package/dist/renderer/runtime/text.d.ts.map +1 -0
- package/dist/renderer/runtime/text.js +82 -0
- package/dist/renderer/runtime/text.js.map +1 -0
- package/dist/renderer/runtime/types.d.ts +7 -2
- package/dist/renderer/runtime/types.d.ts.map +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +0 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scene.d.ts +1 -1
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +2 -2
- package/dist/scene.js.map +1 -1
- package/dist/shadcn.d.ts +169 -137
- package/dist/shadcn.d.ts.map +1 -1
- package/dist/shadcn.js +8 -5
- package/dist/shadcn.js.map +1 -1
- package/dist/spec/bsx_v2.json +3080 -2372
- package/dist/spec/catalogs/base@3.json +13029 -0
- package/dist/spec/catalogs/base@3.json.js +13029 -0
- package/dist/spec/catalogs/orkestrator@1.json +489 -0
- package/dist/spec/catalogs/orkestrator@1.json.js +489 -0
- package/dist/spec/catalogs.d.ts +109 -46
- package/dist/spec/catalogs.d.ts.map +1 -1
- package/dist/spec/catalogs.js +241 -73
- package/dist/spec/catalogs.js.map +1 -1
- package/dist/spec/vocabulary.d.ts +21 -3
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +16 -2
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +73 -27
- package/dist/spec/vocabulary.json.js +73 -27
- package/dist/vendor/core/ui/button-group.d.ts +1 -1
- package/dist/vendor/core/ui/button.d.ts +1 -1
- package/dist/vendor/core/ui/field.d.ts +1 -1
- package/package.json +1 -1
- package/src/bsx/infer.test.ts +18 -26
- package/src/bsx/language.test.ts +2 -2
- package/src/bsx/parse.ts +18 -62
- package/src/bsx/partial.test.ts +1 -1
- package/src/bsx/print.ts +24 -34
- package/src/bsx/references.test.ts +71 -10
- package/src/bsx/references.ts +114 -35
- package/src/catalogs/catalogs.test.ts +45 -14
- package/src/catalogs/html.ts +3 -3
- package/src/catalogs/index.ts +6 -2
- package/src/catalogs/logo.ts +3 -3
- package/src/catalogs/parts/forms.ts +32 -0
- package/src/catalogs/parts/html.ts +1 -1
- package/src/catalogs/parts/icons.ts +1 -1
- package/src/catalogs/parts/layout.ts +11 -0
- package/src/catalogs/parts/logo.ts +2 -2
- package/src/catalogs/parts/run.ts +1 -1
- package/src/catalogs/parts/scene.ts +6 -0
- package/src/catalogs/parts/structure.ts +2 -2
- package/src/catalogs/parts/toast.ts +1 -1
- package/src/catalogs/parts/typography.ts +1 -1
- package/src/catalogs/scene.ts +3 -3
- package/src/catalogs/shadcn.ts +6 -4
- package/src/catalogs/structure.ts +3 -3
- package/src/catalogs/ui.ts +4 -3
- package/src/catalogs.ts +9 -2
- package/src/ports.ts +1 -1
- package/src/renderer/BlokRenderer.tsx +9 -0
- package/src/renderer/addBlokComponents.test.tsx +8 -22
- package/src/renderer/baseCatalog.ts +7 -5
- package/src/renderer/bloks/components.test.tsx +2 -2
- package/src/renderer/bloks/control.tsx +133 -6
- package/src/renderer/bloks/flow.test.tsx +1 -1
- package/src/renderer/bloks/forms.tsx +126 -0
- package/src/renderer/bloks/html.tsx +2 -2
- package/src/renderer/bloks/index.ts +1 -1
- package/src/renderer/bloks/layout.tsx +28 -0
- package/src/renderer/bloks/logo/index.tsx +2 -2
- package/src/renderer/bloks/run/components.tsx +1 -1
- package/src/renderer/bloks/run/host.tsx +33 -3
- package/src/renderer/bloks/run/space.test.tsx +76 -0
- package/src/renderer/bloks/time.test.tsx +1 -1
- package/src/renderer/bloks/toast.tsx +1 -1
- package/src/renderer/bloks/typography.tsx +1 -1
- package/src/renderer/catalog.tsx +7 -31
- package/src/renderer/declare.test.ts +41 -0
- package/src/renderer/declare.ts +70 -32
- package/src/renderer/functions/v2/functions.test.ts +40 -1
- package/src/renderer/functions/v2/index.ts +47 -0
- package/src/renderer/runtime/catalog.ts +35 -10
- package/src/renderer/runtime/components.tsx +10 -1
- package/src/renderer/runtime/context.tsx +6 -0
- package/src/renderer/runtime/describe.ts +17 -4
- package/src/renderer/runtime/hooks.ts +1 -0
- package/src/renderer/runtime/index.ts +1 -0
- package/src/renderer/runtime/preflight.ts +5 -2
- package/src/renderer/runtime/resolution.test.ts +14 -0
- package/src/renderer/runtime/resolution.ts +15 -1
- package/src/renderer/runtime/task.ts +33 -4
- package/src/renderer/runtime/text.test.tsx +65 -0
- package/src/renderer/runtime/text.ts +88 -0
- package/src/renderer/runtime/types.ts +7 -2
- package/src/runtime.ts +0 -1
- package/src/scene.ts +2 -2
- package/src/shadcn.ts +8 -5
- package/src/spec/bsx_v2.json +3080 -2372
- package/src/spec/catalogs/base@3.json +13029 -0
- package/src/spec/catalogs/orkestrator@1.json +489 -0
- package/src/spec/catalogs.ts +257 -101
- package/src/spec/spec.test.ts +107 -21
- package/src/spec/vocabulary.json +73 -27
- package/src/spec/vocabulary.ts +36 -7
- package/dist/renderer/modules.d.ts +0 -4
- package/dist/renderer/modules.d.ts.map +0 -1
- package/dist/renderer/modules.js +0 -11
- package/dist/renderer/modules.js.map +0 -1
- package/dist/spec/catalogs/base@2.json +0 -222
- package/dist/spec/catalogs/base@2.json.js +0 -222
- package/dist/spec/catalogs/html@1.json +0 -308
- package/dist/spec/catalogs/html@1.json.js +0 -308
- package/dist/spec/catalogs/logo@1.json +0 -1687
- package/dist/spec/catalogs/logo@1.json.js +0 -1687
- package/dist/spec/catalogs/scene@1.json +0 -858
- package/dist/spec/catalogs/scene@1.json.js +0 -858
- package/dist/spec/catalogs/shadcn@1.json +0 -3860
- package/dist/spec/catalogs/shadcn@1.json.js +0 -3860
- package/dist/spec/catalogs/structure@1.json +0 -185
- package/dist/spec/catalogs/structure@1.json.js +0 -185
- package/dist/spec/catalogs/ui@1.json +0 -5349
- package/dist/spec/catalogs/ui@1.json.js +0 -5349
- package/src/renderer/modules.ts +0 -12
- package/src/spec/catalogs/base@2.json +0 -222
- package/src/spec/catalogs/html@1.json +0 -308
- package/src/spec/catalogs/logo@1.json +0 -1687
- package/src/spec/catalogs/scene@1.json +0 -858
- package/src/spec/catalogs/shadcn@1.json +0 -3860
- package/src/spec/catalogs/structure@1.json +0 -185
- package/src/spec/catalogs/ui@1.json +0 -5349
|
@@ -3,7 +3,7 @@ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
|
|
|
3
3
|
import {BlokPropSchemas} from '../../renderer/runtime/schemas';
|
|
4
4
|
import {actionProp, boolSchema, classNameSchema, contentSchema, layoutFields, textFields} from '../props';
|
|
5
5
|
|
|
6
|
-
/** ui
|
|
6
|
+
/** the ui family's links and media: `Link`, `Image` and `Code`. */
|
|
7
7
|
|
|
8
8
|
export const htmlContracts = {
|
|
9
9
|
Link: {
|
|
@@ -3,7 +3,7 @@ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
|
|
|
3
3
|
import {classNameSchema, numberSchema} from '../props';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The icons a blok payload may name, and `Icon` (ui
|
|
6
|
+
* The icons a blok payload may name, and `Icon` (the ui family).
|
|
7
7
|
*
|
|
8
8
|
* The names are spelled out here so the contract carries no icon set: the
|
|
9
9
|
* renderer's `BLOK_ICONS` map is typed against this tuple, so a name without a
|
|
@@ -152,6 +152,17 @@ export const layoutContracts = {
|
|
|
152
152
|
})
|
|
153
153
|
.describe('A scrollable region with styled scrollbars.'),
|
|
154
154
|
},
|
|
155
|
+
List: {
|
|
156
|
+
schema: z
|
|
157
|
+
.object({
|
|
158
|
+
children: childListSchema,
|
|
159
|
+
className: classNameSchema,
|
|
160
|
+
height: sizeSchema.describe('CSS height of the list; it scrolls inside it. Fills its parent when left out.'),
|
|
161
|
+
})
|
|
162
|
+
.describe(
|
|
163
|
+
'A long list: a `<foreach>` placed directly inside it is drawn row by row as it scrolls into view, so thousands of items cost what a screenful does. Anything else inside it is drawn as a Column would.',
|
|
164
|
+
),
|
|
165
|
+
},
|
|
155
166
|
Resizable: {
|
|
156
167
|
schema: z
|
|
157
168
|
.object({
|
|
@@ -5,7 +5,7 @@ import {loadVocabulary} from '../../spec/vocabulary';
|
|
|
5
5
|
import {actionProp, describedString} from '../props';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The `logo
|
|
8
|
+
* The `logo` family of the blok language: the `AgentLogo` and `ActionLogo`
|
|
9
9
|
* roots and the classic SVG elements as components.
|
|
10
10
|
*
|
|
11
11
|
* A logo root sits in html like `Scene` does and opens the `logo` context, so a
|
|
@@ -156,7 +156,7 @@ const gradientUnits = z
|
|
|
156
156
|
.optional()
|
|
157
157
|
.describe('Whether the coordinates are fractions of the shape (the default) or user units.');
|
|
158
158
|
|
|
159
|
-
/** The `logo
|
|
159
|
+
/** The `logo` family: the root, seven shapes, text, and what shapes reference. */
|
|
160
160
|
export const logoContracts = {
|
|
161
161
|
[AGENT_LOGO_ROOT]: logoRoot(
|
|
162
162
|
"The root of an agent's logo: a drawing in the viewer's pens. Its children are SVG shapes.",
|
|
@@ -4,7 +4,7 @@ import {describedString} from '../props';
|
|
|
4
4
|
import {sceneSchema} from './scene';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The components that place an action's dependencies in 3D (scene
|
|
7
|
+
* The components that place an action's dependencies in 3D (the scene family). `Space`
|
|
8
8
|
* is a scene whose layout is shared: a room the whole organization arranges,
|
|
9
9
|
* found again by its `room` (not `id`: that is every node's own explicit id). `Placed` draws the agent a dependency is bound to
|
|
10
10
|
* with that agent's own scene blok, where the room keeps it, and `Route` draws
|
|
@@ -19,6 +19,12 @@ import {actionProp, bindSchema, describedString} from '../props';
|
|
|
19
19
|
|
|
20
20
|
export const sceneSchema = z
|
|
21
21
|
.object({
|
|
22
|
+
chrome: z
|
|
23
|
+
.enum(['auto', 'none'])
|
|
24
|
+
.optional()
|
|
25
|
+
.describe(
|
|
26
|
+
"What the host draws around the blok of its own: `auto` (the default) adds what the blok does not place (the time slider, the open ask, the rest of the argument form, its buttons); `none` adds nothing, the blok places what it wants.",
|
|
27
|
+
),
|
|
22
28
|
camera: z
|
|
23
29
|
.enum(['iso', 'front', 'side', 'top'])
|
|
24
30
|
.optional()
|
|
@@ -4,9 +4,9 @@ import {BlokPropSchemas} from '../../renderer/runtime/schemas';
|
|
|
4
4
|
import {actionProp, bindSchema, boolSchema, classNameSchema, disabledSchema, sizeSchema, structureValueSchema} from '../props';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* structure
|
|
7
|
+
* the structure family: bloks over other modules' objects, by structure identifier. The
|
|
8
8
|
* contract only: drawing one needs the app's smart system (its option sources,
|
|
9
|
-
* displays and viewers), so every app that claims structure
|
|
9
|
+
* displays and viewers), so every app that claims the structure family draws it itself.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const emptyTextSchema = BlokPropSchemas.DynamicString.optional().describe(
|
|
@@ -2,7 +2,7 @@ import * as z from 'zod';
|
|
|
2
2
|
import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
|
|
3
3
|
import {BlokPropSchemas} from '../../renderer/runtime/schemas';
|
|
4
4
|
|
|
5
|
-
/** `<Toast task={move}>` (ui
|
|
5
|
+
/** `<Toast task={move}>` (the ui family) and its outcome slots `done`, `failed`, `cancelled`. */
|
|
6
6
|
|
|
7
7
|
const toastSchema = z
|
|
8
8
|
.object({
|
|
@@ -3,7 +3,7 @@ import type {BlokComponentContracts} from '../../renderer/runtime/catalog';
|
|
|
3
3
|
import {BlokPropSchemas} from '../../renderer/runtime/schemas';
|
|
4
4
|
import {classNameSchema, contentSchema, headingLevelSchema, textAlignSchema, textFields} from '../props';
|
|
5
5
|
|
|
6
|
-
/** Text-bearing components: `Text` (ui
|
|
6
|
+
/** Text-bearing components: `Text` (the ui family), `p` and `span` (the html family), `Heading`, `Kbd`, `Markdown`, `Time`. */
|
|
7
7
|
|
|
8
8
|
/** `Text` and `p`/`span` differ only in the element they render: one schema. */
|
|
9
9
|
const textComponentSchema = z
|
package/src/catalogs/scene.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
1
|
+
import {BASE_CATALOG_REF, defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
2
|
import {parts} from './parts';
|
|
3
3
|
|
|
4
|
-
/** `scene
|
|
4
|
+
/** The `scene` family of the base catalog. */
|
|
5
5
|
export const sceneCatalog = defineBlokCatalog({
|
|
6
6
|
name: "scene",
|
|
7
|
-
|
|
7
|
+
partOf: BASE_CATALOG_REF,
|
|
8
8
|
description: "3D components: the Scene and Space roots, models, verb modifiers on a model's nodes, the HTML bridge (Popout), and the placed dependencies of a Space.",
|
|
9
9
|
components: {
|
|
10
10
|
Animate: parts.Animate,
|
package/src/catalogs/shadcn.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
1
|
+
import {BASE_CATALOG_REF, defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
2
|
import {parts} from './parts';
|
|
3
3
|
|
|
4
|
-
/** `shadcn
|
|
4
|
+
/** The `shadcn` family of the base catalog. */
|
|
5
5
|
export const shadcnCatalog = defineBlokCatalog({
|
|
6
6
|
name: "shadcn",
|
|
7
|
-
|
|
8
|
-
description: "The shadcn families beyond ui
|
|
7
|
+
partOf: BASE_CATALOG_REF,
|
|
8
|
+
description: "The shadcn families beyond the ui family (alert dialogs, sheets, drawers, menus, calendars, carousels, resizable panels, bento grids ...), charts and the raw inspector.",
|
|
9
9
|
components: {
|
|
10
10
|
AlertDialog: {...parts.AlertDialog, events: {onOpenChange: [{key: "value", kind: "BOOL", description: "Whether it is open now."}]}},
|
|
11
11
|
AlertDialogAction: parts.AlertDialogAction,
|
|
@@ -26,6 +26,8 @@ export const shadcnCatalog = defineBlokCatalog({
|
|
|
26
26
|
ButtonGroup: parts.ButtonGroup,
|
|
27
27
|
Calendar: {...parts.Calendar, events: {onChange: [{key: "value", kind: "STRING", description: "The date picked, as an ISO date (YYYY-MM-DD)."}]}, bindKinds: {bind: "STRING"}},
|
|
28
28
|
Carousel: parts.Carousel,
|
|
29
|
+
Combobox: {...parts.Combobox, events: {onChange: [{key: "value", kind: "STRING", description: "The value picked."}]}, bindKinds: {bind: "STRING"}},
|
|
30
|
+
DatePicker: {...parts.DatePicker, events: {onChange: [{key: "value", kind: "STRING", description: "The date picked, as an ISO date (YYYY-MM-DD)."}]}, bindKinds: {bind: "STRING"}},
|
|
29
31
|
CarouselItem: parts.CarouselItem,
|
|
30
32
|
Chart: parts.Chart,
|
|
31
33
|
Collapsible: {...parts.Collapsible, events: {onChange: [{key: "value", kind: "BOOL", description: "Whether it is open now."}]}},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
1
|
+
import {BASE_CATALOG_REF, defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
2
|
import {parts} from './parts';
|
|
3
3
|
|
|
4
|
-
/** `structure
|
|
4
|
+
/** The `structure` family of the base catalog. */
|
|
5
5
|
export const structureCatalog = defineBlokCatalog({
|
|
6
6
|
name: "structure",
|
|
7
|
-
|
|
7
|
+
partOf: BASE_CATALOG_REF,
|
|
8
8
|
description: "Pick, show and view structures, typed by `\"@package/key\"`.",
|
|
9
9
|
components: {
|
|
10
10
|
StructureDisplay: parts.StructureDisplay,
|
package/src/catalogs/ui.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
1
|
+
import {BASE_CATALOG_REF, defineBlokCatalog} from '../renderer/runtime/catalog';
|
|
2
2
|
import {parts} from './parts';
|
|
3
3
|
|
|
4
|
-
/** `ui
|
|
4
|
+
/** The `ui` family of the base catalog. */
|
|
5
5
|
export const uiCatalog = defineBlokCatalog({
|
|
6
6
|
name: "ui",
|
|
7
|
-
|
|
7
|
+
partOf: BASE_CATALOG_REF,
|
|
8
8
|
description: "Standard HTML components: layout, text, feedback, forms, data and overlays (shadcn-based).",
|
|
9
9
|
components: {
|
|
10
10
|
Accordion: {...parts.Accordion, events: {onChange: [{key: "value", kind: "ANY", description: "The open/pressed value(s): a string, or a list when multiple."}]}},
|
|
@@ -50,6 +50,7 @@ export const uiCatalog = defineBlokCatalog({
|
|
|
50
50
|
RadioGroup: {...parts.RadioGroup, events: {onChange: [{key: "value", kind: "STRING", description: "The value now chosen."}]}, bindKinds: {bind: "STRING"}},
|
|
51
51
|
RadioGroupItem: {...parts.RadioGroupItem, textProp: "label"},
|
|
52
52
|
Row: parts.Row,
|
|
53
|
+
List: parts.List,
|
|
53
54
|
ScrollArea: parts.ScrollArea,
|
|
54
55
|
Select: {...parts.Select, events: {onChange: [{key: "value", kind: "STRING", description: "The value now chosen."}]}, bindKinds: {bind: "STRING"}},
|
|
55
56
|
SelectContent: parts.SelectContent,
|
package/src/catalogs.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
// @arkitektio/bsx/catalogs: the
|
|
1
|
+
// @arkitektio/bsx/catalogs: the contracts of the base catalog's families (ui, html, logo, scene, structure, shadcn)
|
|
2
2
|
// and the prop-schema vocabulary to define a UI's own. zod only: no React, no DOM.
|
|
3
3
|
export * from './catalogs/index';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
BASE_CATALOG_ADDRESS,
|
|
6
|
+
BASE_CATALOG_REF,
|
|
7
|
+
catalogRef,
|
|
8
|
+
defineBlokCatalog,
|
|
9
|
+
type BlokCatalogContract,
|
|
10
|
+
type BlokComponentContracts,
|
|
11
|
+
} from './renderer/runtime/catalog';
|
|
5
12
|
export type {BlokComponentContract} from './renderer/runtime/components';
|
|
6
13
|
export {describeBlokContract, specJsonText, type SpecCatalogJson} from './renderer/runtime/describe';
|
package/src/ports.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @arkitektio/bsx/ports: an action's form, the port engine and its widgets. What the app gives it is
|
|
2
|
-
// `configurePortHost`; `hostedStructure` draws structure
|
|
2
|
+
// `configurePortHost`; `hostedStructure` draws the structure family with the same host. A form needs the
|
|
3
3
|
// optional peers react-hook-form, @hookform/resolvers, cmdk and date-fns.
|
|
4
4
|
export * from './ports/engine/DependencyContext';
|
|
5
5
|
export * from './ports/engine/EffectWrapper';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type {BlokTaskControl} from './runtime/task';
|
|
1
2
|
import {useEffect, useId, useMemo, useRef, useState} from 'react';
|
|
2
3
|
import {cn} from '../vendor/core/util/utils';
|
|
3
4
|
import {useBlokTailwind} from '../tailwind/useBlokTailwind';
|
|
@@ -84,6 +85,8 @@ type BlokRendererProps = {
|
|
|
84
85
|
answerTask?: (values: Record<string, unknown>) => unknown;
|
|
85
86
|
/** Starts the run an assign blok prepares (`assign.start()`). */
|
|
86
87
|
startRun?: () => unknown;
|
|
88
|
+
/** Cancels, pauses, resumes, steps, interrupts or reruns `task` (`task.cancel()` and its kin). */
|
|
89
|
+
controlTask?: (operation: BlokTaskControl) => unknown;
|
|
87
90
|
/** Where `persist` components keep their state by id; none: they keep nothing. */
|
|
88
91
|
componentState?: BlokComponentStateStore | null;
|
|
89
92
|
children?: React.ReactNode;
|
|
@@ -148,6 +151,7 @@ export default function BlokRenderer({
|
|
|
148
151
|
readExecutor,
|
|
149
152
|
answerTask,
|
|
150
153
|
startRun,
|
|
154
|
+
controlTask,
|
|
151
155
|
componentState = null,
|
|
152
156
|
children,
|
|
153
157
|
}: BlokRendererProps) {
|
|
@@ -202,6 +206,7 @@ export default function BlokRenderer({
|
|
|
202
206
|
travelAt,
|
|
203
207
|
answerTask,
|
|
204
208
|
startRun,
|
|
209
|
+
controlTask,
|
|
205
210
|
});
|
|
206
211
|
return store;
|
|
207
212
|
});
|
|
@@ -229,6 +234,10 @@ export default function BlokRenderer({
|
|
|
229
234
|
runtimeStore.getState().setStartRun(startRun);
|
|
230
235
|
}, [startRun, runtimeStore]);
|
|
231
236
|
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
runtimeStore.getState().setControlTask(controlTask);
|
|
239
|
+
}, [controlTask, runtimeStore]);
|
|
240
|
+
|
|
232
241
|
useEffect(() => {
|
|
233
242
|
if (keptRoots) runtimeStore.getState().setKeptRoots(keptRoots);
|
|
234
243
|
}, [keptRoots, runtimeStore]);
|
|
@@ -5,12 +5,11 @@ import * as z from "zod";
|
|
|
5
5
|
import { cleanup, screen } from "@testing-library/react";
|
|
6
6
|
import { renderBsx, testCatalog} from "./bloks/testing";
|
|
7
7
|
import { addBlokComponents } from "./catalog";
|
|
8
|
-
import { moduleShadowsOf } from "./modules";
|
|
9
8
|
import { createBlokCatalog, createBlokComponent } from "./runtime";
|
|
10
9
|
|
|
11
10
|
const part = (name: string) => createBlokComponent({ name, schema: z.object({}) }, () => null);
|
|
12
|
-
/** A component of
|
|
13
|
-
const
|
|
11
|
+
/** A component of the base catalog, as `implementBlokCatalog` tags one of its families'. */
|
|
12
|
+
const base = (name: string) => ({ ...part(name), origin: "base@3" });
|
|
14
13
|
|
|
15
14
|
describe("addBlokComponents", () => {
|
|
16
15
|
it("adds a module's components and takes them back out", () => {
|
|
@@ -29,36 +28,23 @@ describe("addBlokComponents", () => {
|
|
|
29
28
|
expect([...catalog.components.keys()]).toEqual(["Card", "foreach", "MikroScene"]);
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
it("
|
|
33
|
-
const standard =
|
|
34
|
-
const mine = part("Slider");
|
|
31
|
+
it("never draws over a component of the base catalog: a catalog only adds", () => {
|
|
32
|
+
const standard = base("Slider");
|
|
35
33
|
const catalog = createBlokCatalog("test", [standard]);
|
|
36
|
-
const undo = addBlokComponents([mine], catalog);
|
|
37
|
-
expect(catalog.components.get("Slider")).toBe(mine);
|
|
38
|
-
// A second module cannot draw over it again.
|
|
39
34
|
expect(() => addBlokComponents([part("Slider")], catalog)).toThrow(/Slider/);
|
|
40
|
-
undo();
|
|
41
35
|
expect(catalog.components.get("Slider")).toBe(standard);
|
|
42
36
|
});
|
|
43
37
|
|
|
44
38
|
it("renders the module's component where a blok uses the name", () => {
|
|
45
|
-
const mine = createBlokComponent({ name: "
|
|
39
|
+
const mine = createBlokComponent({ name: "Gauge", schema: z.object({}) }, () => <span>my gauge</span>);
|
|
46
40
|
const undo = addBlokComponents([mine], testCatalog());
|
|
47
41
|
try {
|
|
48
|
-
renderBsx(testCatalog(), "<Card><
|
|
49
|
-
expect(screen.queryByText("my
|
|
42
|
+
renderBsx(testCatalog(), "<Card><Gauge /></Card>");
|
|
43
|
+
expect(screen.queryByText("my gauge")).not.toBeNull();
|
|
50
44
|
} finally {
|
|
51
45
|
cleanup();
|
|
52
46
|
undo();
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
it("records a drawn-over global component as the module's own until undone", () => {
|
|
57
|
-
const catalog = createBlokCatalog("test", [global("Slider")]);
|
|
58
|
-
expect(moduleShadowsOf(catalog).has("Slider")).toBe(false);
|
|
59
|
-
const undo = addBlokComponents([part("Slider")], catalog);
|
|
60
|
-
expect(moduleShadowsOf(catalog).has("Slider")).toBe(true);
|
|
61
|
-
undo();
|
|
62
|
-
expect(moduleShadowsOf(catalog).has("Slider")).toBe(false);
|
|
48
|
+
expect(testCatalog().components.has("Gauge")).toBe(false);
|
|
63
49
|
});
|
|
64
50
|
});
|
|
@@ -2,13 +2,15 @@ import {controlBlokComponents} from './bloks/control';
|
|
|
2
2
|
import {createBlokCatalog, type BlokCatalog} from './runtime';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
* `fragment`, `suspense`/`fallback`/`error`,
|
|
8
|
-
*
|
|
5
|
+
* The part of the base catalog the renderer itself draws, whatever toolkit
|
|
6
|
+
* draws the rest: the language's elements (`if`/`else`, `foreach`,
|
|
7
|
+
* `match`/`case`/`default`, `fragment`, `suspense`/`fallback`/`error`, the
|
|
8
|
+
* context root `Html`, text) and the parts of a host's interface a blok may
|
|
9
|
+
* place (`ask`, `args`, `timeline`, ...), which the host supplies. Its
|
|
10
|
+
* functions are the vocabulary's (`functions/v2`), evaluated by the renderer.
|
|
9
11
|
*/
|
|
10
12
|
export const BASE_CATALOG_NAME = 'base';
|
|
11
|
-
export const BASE_CATALOG_VERSION =
|
|
13
|
+
export const BASE_CATALOG_VERSION = 3;
|
|
12
14
|
export const BASE_CATALOG_ID = `${BASE_CATALOG_NAME}@${BASE_CATALOG_VERSION}`;
|
|
13
15
|
|
|
14
16
|
export const baseBlokCatalog: BlokCatalog = createBlokCatalog(BASE_CATALOG_ID, controlBlokComponents);
|
|
@@ -8,7 +8,7 @@ afterEach(cleanup);
|
|
|
8
8
|
const render = (roots: unknown[], initialState?: unknown) =>
|
|
9
9
|
renderBlokDocument(testCatalog(), roots, initialState);
|
|
10
10
|
|
|
11
|
-
describe('links and media (ui
|
|
11
|
+
describe('links and media (the ui family)', () => {
|
|
12
12
|
it('renders a link, inline code and a heading', () => {
|
|
13
13
|
const {errors} = render([
|
|
14
14
|
{
|
|
@@ -33,7 +33,7 @@ describe('links and media (ui@1)', () => {
|
|
|
33
33
|
expect(screen.getByRole('heading', {level: 2}).textContent).toBe('Overview');
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
it('keeps raw html to the three containers html
|
|
36
|
+
it('keeps raw html to the three containers the html family has', () => {
|
|
37
37
|
expect(testCatalog().components.has('div')).toBe(true);
|
|
38
38
|
expect(testCatalog().components.has('p')).toBe(true);
|
|
39
39
|
expect(testCatalog().components.has('span')).toBe(true);
|
|
@@ -22,7 +22,7 @@ import {useBlokRunHost} from './run/host';
|
|
|
22
22
|
import {blokPlatform} from '../../platform';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* The language of base
|
|
25
|
+
* The language of the base catalog (`core/blok/spec/base_v2.json`): components that
|
|
26
26
|
* decide *whether* and *how often* their children render, rather than drawing
|
|
27
27
|
* anything themselves. Lowercase names are reserved for language.
|
|
28
28
|
*
|
|
@@ -228,6 +228,21 @@ export const Else = createBlokComponent(
|
|
|
228
228
|
({buildChild, component}) => renderDeclaredChildren(component, buildChild),
|
|
229
229
|
);
|
|
230
230
|
|
|
231
|
+
/** A run of text, as the parser stores it: drawn as it stands where no component took it (`runtime/text`). */
|
|
232
|
+
export const TextNode = createBlokComponent(
|
|
233
|
+
{
|
|
234
|
+
name: '#text',
|
|
235
|
+
schema: z
|
|
236
|
+
.object({value: z.unknown().describe('The text: a literal, or an expression whose value is shown as text.')})
|
|
237
|
+
.describe('A run of text between elements: what the parser stores it as (no element can be called this).'),
|
|
238
|
+
},
|
|
239
|
+
({component, schema}) => {
|
|
240
|
+
const blok = useBlok(component, schema);
|
|
241
|
+
const value = useValue(blok.value);
|
|
242
|
+
return <>{value === null || value === undefined ? null : typeof value === 'string' ? value : String(value)}</>;
|
|
243
|
+
},
|
|
244
|
+
);
|
|
245
|
+
|
|
231
246
|
export const Fragment = createBlokComponent(
|
|
232
247
|
{
|
|
233
248
|
name: 'fragment',
|
|
@@ -238,12 +253,22 @@ export const Fragment = createBlokComponent(
|
|
|
238
253
|
({buildChild, component}) => renderDeclaredChildren(component, buildChild),
|
|
239
254
|
);
|
|
240
255
|
|
|
256
|
+
/** What the host adds around a blok; read by the host off the root, the blok itself draws the same either way. */
|
|
257
|
+
export const chromeSchema = z
|
|
258
|
+
.enum(['auto', 'none'])
|
|
259
|
+
.optional()
|
|
260
|
+
.describe(
|
|
261
|
+
"What the host draws around the blok of its own: `auto` (the default) adds what the blok does not place (the time slider, the open ask, the rest of the argument form, its buttons); `none` adds nothing, the blok places what it wants.",
|
|
262
|
+
);
|
|
263
|
+
|
|
241
264
|
export const Html = createBlokComponent(
|
|
242
265
|
{
|
|
243
266
|
name: 'Html',
|
|
244
267
|
acceptsChildren: true,
|
|
245
268
|
placement: {childrenContext: 'html', notDownstreamOf: ['Html']},
|
|
246
|
-
schema: z
|
|
269
|
+
schema: z
|
|
270
|
+
.object({chrome: chromeSchema})
|
|
271
|
+
.describe("The root of an html blok (a panel, a dashboard, a popout's page): lays its children out as a fragment does, and names the blok's context."),
|
|
247
272
|
},
|
|
248
273
|
({buildChild, component}) => renderDeclaredChildren(component, buildChild),
|
|
249
274
|
);
|
|
@@ -424,17 +449,113 @@ export const Ask = createBlokComponent(
|
|
|
424
449
|
/* args */
|
|
425
450
|
/* -------------------------------------------------------------------------- */
|
|
426
451
|
|
|
427
|
-
|
|
452
|
+
/** Port or dependency keys as a prop holds them: a list, or one string with spaces between. */
|
|
453
|
+
const keysOf = (value: unknown): string[] | undefined => {
|
|
454
|
+
if (Array.isArray(value)) return value.filter((key): key is string => typeof key === 'string');
|
|
455
|
+
if (typeof value === 'string') return value.split(/[\s,]+/).filter(Boolean);
|
|
456
|
+
return undefined;
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
const keyList = (what: string) => z.union([z.string(), z.array(z.string())]).optional().describe(what);
|
|
460
|
+
|
|
461
|
+
const argsSchema = z
|
|
462
|
+
.object({
|
|
463
|
+
only: keyList('Only these port keys: `only="exposure gain"` or `only={["exposure", "gain"]}`.'),
|
|
464
|
+
omit: keyList('Not these port keys.'),
|
|
465
|
+
given: z
|
|
466
|
+
.enum(['hide', 'show'])
|
|
467
|
+
.optional()
|
|
468
|
+
.describe('What to do with the arguments the caller gave (`assign.given.<key>`): `hide` leaves them out (the default), `show` lists them, locked.'),
|
|
469
|
+
})
|
|
470
|
+
.describe(
|
|
471
|
+
"The arguments of the run an assign blok starts, as a form generated from the action's ports: filled in right here, read as `args.<key>`. It draws the rest: every argument the caller did not give and no `<arg />` places.",
|
|
472
|
+
);
|
|
473
|
+
|
|
474
|
+
export const Args = createBlokComponent({name: 'args', schema: argsSchema}, ({component, schema}) => {
|
|
475
|
+
const blok = useBlok(component, schema);
|
|
476
|
+
const only = keysOf(useValue(blok.only));
|
|
477
|
+
const omit = keysOf(useValue(blok.omit));
|
|
478
|
+
const given = useValue(blok.given);
|
|
479
|
+
const host = useBlokRunHost();
|
|
480
|
+
return <>{host.renderArgs?.({only, omit, given: given === 'show' ? 'show' : 'hide'}) ?? null}</>;
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
const argSchema = z
|
|
484
|
+
.object({key: z.string().describe('The port key of the argument: `key="exposure"`.')})
|
|
485
|
+
.describe('One argument of the run an assign blok starts, as its port draws it; `<args />` then leaves it out. Nothing for an argument the caller gave: it is locked.');
|
|
486
|
+
|
|
487
|
+
export const Arg = createBlokComponent({name: 'arg', schema: argSchema}, ({component, schema}) => {
|
|
488
|
+
const key = useValue(useBlok(component, schema).key);
|
|
489
|
+
const host = useBlokRunHost();
|
|
490
|
+
return <>{typeof key === 'string' ? (host.renderArg?.(key) ?? null) : null}</>;
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
/* -------------------------------------------------------------------------- */
|
|
494
|
+
/* deps */
|
|
495
|
+
/* -------------------------------------------------------------------------- */
|
|
496
|
+
|
|
497
|
+
export const Deps = createBlokComponent(
|
|
498
|
+
{
|
|
499
|
+
name: 'deps',
|
|
500
|
+
schema: z
|
|
501
|
+
.object({})
|
|
502
|
+
.describe("The picker of the agents the run an assign blok starts would get: every dependency no `<dep />` places. Without it the host shows the picker beside the blok."),
|
|
503
|
+
},
|
|
504
|
+
() => <>{useBlokRunHost().renderDeps?.() ?? null}</>,
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
const depSchema = z
|
|
508
|
+
.object({key: z.string().describe('The dependency key: `key="microscope"`.')})
|
|
509
|
+
.describe('The picker of one dependency of the run an assign blok starts; `<deps />` then leaves it out.');
|
|
510
|
+
|
|
511
|
+
export const Dep = createBlokComponent({name: 'dep', schema: depSchema}, ({component, schema}) => {
|
|
512
|
+
const key = useValue(useBlok(component, schema).key);
|
|
513
|
+
const host = useBlokRunHost();
|
|
514
|
+
return <>{typeof key === 'string' ? (host.renderDep?.(key) ?? null) : null}</>;
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
/* -------------------------------------------------------------------------- */
|
|
518
|
+
/* returns, status */
|
|
519
|
+
/* -------------------------------------------------------------------------- */
|
|
520
|
+
|
|
521
|
+
const returnsSchema = z
|
|
522
|
+
.object({
|
|
523
|
+
only: keyList('Only these return port keys.'),
|
|
524
|
+
omit: keyList('Not these return port keys.'),
|
|
525
|
+
})
|
|
526
|
+
.describe("What `task` returned, as the action's return ports show it (an image as an image, a table as a table). Nothing before the first yield.");
|
|
527
|
+
|
|
528
|
+
export const Returns = createBlokComponent({name: 'returns', schema: returnsSchema}, ({component, schema}) => {
|
|
529
|
+
const blok = useBlok(component, schema);
|
|
530
|
+
const only = keysOf(useValue(blok.only));
|
|
531
|
+
const omit = keysOf(useValue(blok.omit));
|
|
532
|
+
return <>{useBlokRunHost().renderReturns?.({only, omit}) ?? null}</>;
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
export const Status = createBlokComponent(
|
|
536
|
+
{
|
|
537
|
+
name: 'status',
|
|
538
|
+
schema: z.object({}).describe('Where `task` stands, as one line the host draws: its state, how long it took, what it last said.'),
|
|
539
|
+
},
|
|
540
|
+
() => <>{useBlokRunHost().renderStatus?.() ?? null}</>,
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
/* -------------------------------------------------------------------------- */
|
|
544
|
+
/* timeline */
|
|
545
|
+
/* -------------------------------------------------------------------------- */
|
|
546
|
+
|
|
547
|
+
export const Timeline = createBlokComponent(
|
|
428
548
|
{
|
|
429
|
-
name: '
|
|
549
|
+
name: 'timeline',
|
|
430
550
|
schema: z
|
|
431
551
|
.object({})
|
|
432
|
-
.describe("The
|
|
552
|
+
.describe("The time slider of what the blok shows (the run of `task`, or the history of its agents): dragging it shows the whole blok as it was at that moment. Nothing where the host has no clock."),
|
|
433
553
|
},
|
|
434
|
-
() => <>{useBlokRunHost().
|
|
554
|
+
() => <>{useBlokRunHost().renderTimeline?.() ?? null}</>,
|
|
435
555
|
);
|
|
436
556
|
|
|
437
557
|
export const controlBlokComponents = [
|
|
558
|
+
TextNode,
|
|
438
559
|
Foreach,
|
|
439
560
|
If,
|
|
440
561
|
Else,
|
|
@@ -448,4 +569,10 @@ export const controlBlokComponents = [
|
|
|
448
569
|
ErrorSlot,
|
|
449
570
|
Ask,
|
|
450
571
|
Args,
|
|
572
|
+
Arg,
|
|
573
|
+
Deps,
|
|
574
|
+
Dep,
|
|
575
|
+
Returns,
|
|
576
|
+
Status,
|
|
577
|
+
Timeline,
|
|
451
578
|
];
|
|
@@ -5,7 +5,7 @@ import {foreachItemIds} from './control';
|
|
|
5
5
|
import {renderBsx, testCatalog} from './testing';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The language of base
|
|
8
|
+
* The language of the base catalog rendered end to end, from BSX: branches, loops, the
|
|
9
9
|
* `when` guard, and the async model (suspense, fallback, error, stale).
|
|
10
10
|
*/
|
|
11
11
|
|