@arkitektio/bsx 5.0.0 → 6.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 +2 -2
- package/dist/bsx/analyze.d.ts +6 -5
- package/dist/bsx/analyze.d.ts.map +1 -1
- package/dist/bsx/analyze.js +12 -10
- package/dist/bsx/analyze.js.map +1 -1
- package/dist/bsx/declared.d.ts +111 -0
- package/dist/bsx/declared.d.ts.map +1 -0
- package/dist/bsx/declared.js +311 -0
- package/dist/bsx/declared.js.map +1 -0
- package/dist/bsx/index.d.ts +1 -0
- package/dist/bsx/index.d.ts.map +1 -1
- package/dist/bsx/index.js +1 -0
- package/dist/bsx/index.js.map +1 -1
- package/dist/bsx/infer.d.ts +40 -17
- package/dist/bsx/infer.d.ts.map +1 -1
- package/dist/bsx/infer.js +105 -49
- package/dist/bsx/infer.js.map +1 -1
- package/dist/bsx/language.d.ts +6 -2
- package/dist/bsx/language.d.ts.map +1 -1
- package/dist/bsx/language.js +65 -21
- package/dist/bsx/language.js.map +1 -1
- package/dist/bsx/parse.d.ts +6 -1
- package/dist/bsx/parse.d.ts.map +1 -1
- package/dist/bsx/parse.js +32 -3
- package/dist/bsx/parse.js.map +1 -1
- package/dist/bsx/print.d.ts.map +1 -1
- package/dist/bsx/print.js +3 -0
- package/dist/bsx/print.js.map +1 -1
- package/dist/bsx/references.d.ts +45 -51
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +265 -138
- package/dist/bsx/references.js.map +1 -1
- package/dist/catalogs/html.d.ts +2 -2
- package/dist/catalogs/index.d.ts +49 -71
- package/dist/catalogs/index.d.ts.map +1 -1
- package/dist/catalogs/index.js +1 -1
- package/dist/catalogs/logo.d.ts +14 -28
- package/dist/catalogs/logo.d.ts.map +1 -1
- package/dist/catalogs/logo.js +1 -2
- package/dist/catalogs/logo.js.map +1 -1
- package/dist/catalogs/parts/data.d.ts +1 -1
- package/dist/catalogs/parts/feedback.d.ts +3 -3
- package/dist/catalogs/parts/forms.d.ts +4 -4
- package/dist/catalogs/parts/html.d.ts +2 -2
- package/dist/catalogs/parts/icons.d.ts +2 -2
- package/dist/catalogs/parts/index.d.ts +35 -57
- package/dist/catalogs/parts/index.d.ts.map +1 -1
- package/dist/catalogs/parts/logo.d.ts +10 -25
- package/dist/catalogs/parts/logo.d.ts.map +1 -1
- package/dist/catalogs/parts/logo.js +12 -14
- package/dist/catalogs/parts/logo.js.map +1 -1
- package/dist/catalogs/parts/navigation.d.ts +4 -4
- package/dist/catalogs/parts/overlays.d.ts +11 -11
- package/dist/catalogs/parts/run.d.ts +2 -10
- package/dist/catalogs/parts/run.d.ts.map +1 -1
- package/dist/catalogs/parts/scene.d.ts +7 -15
- package/dist/catalogs/parts/scene.d.ts.map +1 -1
- package/dist/catalogs/parts/scene.js +1 -5
- package/dist/catalogs/parts/scene.js.map +1 -1
- package/dist/catalogs/parts/typography.d.ts +3 -3
- package/dist/catalogs/props.d.ts +2 -2
- package/dist/catalogs/scene.d.ts +5 -13
- package/dist/catalogs/scene.d.ts.map +1 -1
- package/dist/catalogs/shadcn.d.ts +11 -11
- package/dist/catalogs/ui.d.ts +16 -16
- package/dist/logo/actionLogoSource.d.ts +3 -3
- package/dist/logo/actionLogoSource.d.ts.map +1 -1
- package/dist/logo/actionLogoSource.js +4 -4
- package/dist/logo/actionLogoSource.js.map +1 -1
- package/dist/renderer/BlokRenderer.d.ts +10 -6
- package/dist/renderer/BlokRenderer.d.ts.map +1 -1
- package/dist/renderer/BlokRenderer.js +23 -9
- package/dist/renderer/BlokRenderer.js.map +1 -1
- package/dist/renderer/baseCatalog.d.ts +3 -3
- package/dist/renderer/baseCatalog.js +2 -2
- package/dist/renderer/bloks/control.d.ts +18 -2
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +85 -14
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/renderer/bloks/data.d.ts +1 -1
- package/dist/renderer/bloks/feedback.d.ts +3 -3
- package/dist/renderer/bloks/forms.d.ts +4 -4
- package/dist/renderer/bloks/html.d.ts +2 -2
- package/dist/renderer/bloks/icons.d.ts +1 -1
- package/dist/renderer/bloks/index.d.ts +30 -37
- package/dist/renderer/bloks/index.d.ts.map +1 -1
- package/dist/renderer/bloks/logo/index.d.ts +1 -8
- package/dist/renderer/bloks/logo/index.d.ts.map +1 -1
- package/dist/renderer/bloks/logo/index.js +1 -2
- package/dist/renderer/bloks/logo/index.js.map +1 -1
- package/dist/renderer/bloks/logo/logo.fixture.json +266 -250
- package/dist/renderer/bloks/navigation.d.ts +4 -4
- package/dist/renderer/bloks/overlays.d.ts +11 -11
- package/dist/renderer/bloks/run/components.d.ts +1 -5
- package/dist/renderer/bloks/run/components.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/index.d.ts +4 -8
- package/dist/renderer/bloks/scene/index.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/interaction.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/interaction.js +3 -2
- package/dist/renderer/bloks/scene/interaction.js.map +1 -1
- package/dist/renderer/bloks/shared/props.d.ts +2 -2
- package/dist/renderer/bloks/typography.d.ts +3 -3
- package/dist/renderer/declarations.d.ts +40 -33
- package/dist/renderer/declarations.d.ts.map +1 -1
- package/dist/renderer/declarations.js +41 -56
- package/dist/renderer/declarations.js.map +1 -1
- package/dist/renderer/declare.js +4 -4
- package/dist/renderer/declare.js.map +1 -1
- package/dist/renderer/persist.d.ts +22 -13
- package/dist/renderer/persist.d.ts.map +1 -1
- package/dist/renderer/persist.js +40 -21
- package/dist/renderer/persist.js.map +1 -1
- package/dist/renderer/runtime/catalog.d.ts +4 -4
- package/dist/renderer/runtime/catalog.js +3 -3
- package/dist/renderer/runtime/components.d.ts +4 -4
- package/dist/renderer/runtime/components.d.ts.map +1 -1
- package/dist/renderer/runtime/components.js +5 -5
- package/dist/renderer/runtime/components.js.map +1 -1
- package/dist/renderer/runtime/context.d.ts +5 -5
- package/dist/renderer/runtime/context.d.ts.map +1 -1
- package/dist/renderer/runtime/context.js +11 -5
- package/dist/renderer/runtime/context.js.map +1 -1
- package/dist/renderer/runtime/describe.d.ts +3 -3
- package/dist/renderer/runtime/describe.d.ts.map +1 -1
- package/dist/renderer/runtime/describe.js +2 -2
- 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 +8 -4
- 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/locals.d.ts +57 -0
- package/dist/renderer/runtime/locals.d.ts.map +1 -0
- package/dist/renderer/runtime/locals.js +87 -0
- package/dist/renderer/runtime/locals.js.map +1 -0
- package/dist/renderer/runtime/scope.d.ts +14 -0
- package/dist/renderer/runtime/scope.d.ts.map +1 -1
- package/dist/renderer/runtime/scope.js +25 -3
- package/dist/renderer/runtime/scope.js.map +1 -1
- package/dist/renderer/runtime/tree.d.ts.map +1 -1
- package/dist/renderer/runtime/tree.js +7 -1
- package/dist/renderer/runtime/tree.js.map +1 -1
- package/dist/renderer/runtime/types.d.ts +8 -3
- package/dist/renderer/runtime/types.d.ts.map +1 -1
- package/dist/shadcn.d.ts +36 -43
- package/dist/shadcn.d.ts.map +1 -1
- package/dist/shadcn.js +1 -2
- package/dist/shadcn.js.map +1 -1
- package/dist/spec/bsx_v2.json +11067 -6321
- package/dist/spec/catalogs/{base@3.json → base@4.json} +434 -288
- package/dist/spec/catalogs/{base@3.json.js → base@4.json.js} +434 -288
- package/dist/spec/catalogs/orkestrator@1.json +10 -10
- package/dist/spec/catalogs/orkestrator@1.json.js +10 -10
- package/dist/spec/catalogs.d.ts +4 -4
- package/dist/spec/catalogs.d.ts.map +1 -1
- package/dist/spec/catalogs.js +7 -7
- package/dist/spec/catalogs.js.map +1 -1
- package/dist/spec/vocabulary.d.ts +25 -4
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +50 -5
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +58 -32
- package/dist/spec/vocabulary.json.js +58 -32
- package/package.json +1 -1
- package/src/bsx/analyze.ts +14 -12
- package/src/bsx/bsx.test.ts +4 -4
- package/src/bsx/declared.ts +346 -0
- package/src/bsx/index.ts +1 -0
- package/src/bsx/infer.test.ts +42 -32
- package/src/bsx/infer.ts +128 -71
- package/src/bsx/language.test.ts +37 -25
- package/src/bsx/language.ts +72 -25
- package/src/bsx/parse.ts +34 -3
- package/src/bsx/print.ts +3 -0
- package/src/bsx/references.test.ts +82 -81
- package/src/bsx/references.ts +313 -178
- package/src/catalogs/catalogs.test.ts +3 -2
- package/src/catalogs/index.ts +1 -1
- package/src/catalogs/logo.ts +1 -2
- package/src/catalogs/parts/logo.ts +13 -17
- package/src/catalogs/parts/scene.ts +1 -7
- package/src/logo/actionLogoSource.ts +4 -4
- package/src/renderer/BlokComponentHost.test.tsx +5 -5
- package/src/renderer/BlokRenderer.tsx +46 -14
- package/src/renderer/addBlokComponents.test.tsx +1 -1
- package/src/renderer/baseCatalog.ts +2 -2
- package/src/renderer/bloks/control.tsx +119 -16
- package/src/renderer/bloks/logo/index.tsx +2 -3
- package/src/renderer/bloks/logo/logo.fixture.json +266 -250
- package/src/renderer/bloks/logo/logo.test.tsx +18 -7
- package/src/renderer/bloks/run/space.test.tsx +12 -4
- package/src/renderer/bloks/scene/interaction.tsx +11 -6
- package/src/renderer/bloks/scene/transform.test.ts +8 -7
- package/src/renderer/declarations.test.ts +38 -51
- package/src/renderer/declarations.ts +67 -88
- package/src/renderer/declare.test.ts +4 -4
- package/src/renderer/declare.ts +4 -4
- package/src/renderer/persist.test.ts +70 -49
- package/src/renderer/persist.ts +57 -34
- package/src/renderer/runtime/catalog.test.ts +2 -2
- package/src/renderer/runtime/catalog.ts +4 -4
- package/src/renderer/runtime/components.tsx +8 -8
- package/src/renderer/runtime/context.tsx +17 -10
- package/src/renderer/runtime/describe.ts +5 -5
- package/src/renderer/runtime/hooks.ts +6 -4
- package/src/renderer/runtime/index.ts +1 -0
- package/src/renderer/runtime/locals.tsx +105 -0
- package/src/renderer/runtime/scope.tsx +31 -3
- package/src/renderer/runtime/tree.tsx +16 -4
- package/src/renderer/runtime/types.ts +8 -3
- package/src/shadcn.ts +1 -2
- package/src/spec/bsx_v2.json +11067 -6321
- package/src/spec/catalogs/{base@3.json → base@4.json} +434 -288
- package/src/spec/catalogs/orkestrator@1.json +10 -10
- package/src/spec/catalogs.ts +8 -8
- package/src/spec/spec.test.ts +19 -16
- package/src/spec/vocabulary.json +58 -32
- package/src/spec/vocabulary.ts +69 -10
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"name": "orkestrator",
|
|
4
4
|
"version": 1,
|
|
5
5
|
"minor": 0,
|
|
6
|
-
"extends": "https://arkitekt.live/catalogs/base/
|
|
6
|
+
"extends": "https://arkitekt.live/catalogs/base/v4",
|
|
7
7
|
"description": "What the Orkestrator draws beyond the base catalog: the components of the services it has modules for (mikro's scene and tables). A blok written for it names it as its catalog.",
|
|
8
8
|
"components": [
|
|
9
9
|
{
|
|
10
10
|
"name": "ColumnHistogram",
|
|
11
11
|
"description": "Draws how the numbers of one column of a TableDataset are distributed, as bars over its range.",
|
|
12
|
-
"context": "
|
|
12
|
+
"context": "PANEL",
|
|
13
13
|
"children_context": null,
|
|
14
14
|
"inherits_context": false,
|
|
15
15
|
"accepts_children": false,
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
{
|
|
66
66
|
"name": "ColumnStat",
|
|
67
67
|
"description": "Reads how full one column of a TableDataset is and how its numbers spread, in one scan. Draws nothing.",
|
|
68
|
-
"context": "
|
|
68
|
+
"context": "PANEL",
|
|
69
69
|
"children_context": null,
|
|
70
70
|
"inherits_context": false,
|
|
71
71
|
"accepts_children": false,
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
{
|
|
110
110
|
"name": "MikroScene",
|
|
111
111
|
"description": "One mikro scene and its stores, shared by the MikroScene parts inside it. One per blok is the supported case: a second scene's viewport also hears the window's keyboard.",
|
|
112
|
-
"context": "
|
|
112
|
+
"context": "PANEL",
|
|
113
113
|
"children_context": null,
|
|
114
114
|
"inherits_context": false,
|
|
115
115
|
"accepts_children": true,
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
{
|
|
253
253
|
"name": "MikroSceneAnnotations",
|
|
254
254
|
"description": "The scene's annotation layers, each card with its shapes and the selection in it. Placed inside a MikroScene.",
|
|
255
|
-
"context": "
|
|
255
|
+
"context": "PANEL",
|
|
256
256
|
"children_context": null,
|
|
257
257
|
"inherits_context": false,
|
|
258
258
|
"accepts_children": false,
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
{
|
|
281
281
|
"name": "MikroSceneLayers",
|
|
282
282
|
"description": "The scene's layers, as the scene page's Layers tab lists them. Placed inside a MikroScene.",
|
|
283
|
-
"context": "
|
|
283
|
+
"context": "PANEL",
|
|
284
284
|
"children_context": null,
|
|
285
285
|
"inherits_context": false,
|
|
286
286
|
"accepts_children": false,
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
{
|
|
309
309
|
"name": "MikroSceneProbe",
|
|
310
310
|
"description": "What the probe reads under the cursor. Placed inside a MikroScene.",
|
|
311
|
-
"context": "
|
|
311
|
+
"context": "PANEL",
|
|
312
312
|
"children_context": null,
|
|
313
313
|
"inherits_context": false,
|
|
314
314
|
"accepts_children": false,
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
{
|
|
337
337
|
"name": "MikroSceneViewport",
|
|
338
338
|
"description": "The scene's interactive view: draw, probe, navigate. Placed inside a MikroScene.",
|
|
339
|
-
"context": "
|
|
339
|
+
"context": "PANEL",
|
|
340
340
|
"children_context": null,
|
|
341
341
|
"inherits_context": false,
|
|
342
342
|
"accepts_children": false,
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
{
|
|
383
383
|
"name": "TableColumns",
|
|
384
384
|
"description": "Reads what a TableDataset's columns are. Draws nothing: a picker or a foreach reads the record.",
|
|
385
|
-
"context": "
|
|
385
|
+
"context": "PANEL",
|
|
386
386
|
"children_context": null,
|
|
387
387
|
"inherits_context": false,
|
|
388
388
|
"accepts_children": false,
|
|
@@ -420,7 +420,7 @@
|
|
|
420
420
|
{
|
|
421
421
|
"name": "TableRows",
|
|
422
422
|
"description": "Reads one page of a TableDataset's rows, filtered and sorted. Draws nothing: a foreach or a Table reads the record.",
|
|
423
|
-
"context": "
|
|
423
|
+
"context": "PANEL",
|
|
424
424
|
"children_context": null,
|
|
425
425
|
"inherits_context": false,
|
|
426
426
|
"accepts_children": false,
|
package/src/spec/catalogs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import baseCatalogJson from './catalogs/base@
|
|
1
|
+
import baseCatalogJson from './catalogs/base@4.json';
|
|
2
2
|
import orkestratorCatalogJson from './catalogs/orkestrator@1.json';
|
|
3
3
|
import {loadVocabulary, type BlokContextName, type VocabFunction} from './vocabulary';
|
|
4
4
|
|
|
@@ -9,8 +9,8 @@ import {loadVocabulary, type BlokContextName, type VocabFunction} from './vocabu
|
|
|
9
9
|
* A *catalog* is a versioned set of components, named by the address it is
|
|
10
10
|
* published at (its `id`).
|
|
11
11
|
*
|
|
12
|
-
* - The **base catalog** (`catalogs/base@
|
|
13
|
-
* `https://arkitekt.live/catalogs/base/
|
|
12
|
+
* - The **base catalog** (`catalogs/base@4.json`,
|
|
13
|
+
* `https://arkitekt.live/catalogs/base/v4`): everything every renderer draws.
|
|
14
14
|
* The language's own elements, the html components, the structure and run
|
|
15
15
|
* parts a host supplies, the scene and the logo shapes. The spec owns it; this
|
|
16
16
|
* package's contracts (`catalogs/`) are held to it by a test.
|
|
@@ -24,7 +24,7 @@ import {loadVocabulary, type BlokContextName, type VocabFunction} from './vocabu
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
export const BASE_NAME = 'base';
|
|
27
|
-
/** The family of the language's own elements (control flow, async boundaries, the
|
|
27
|
+
/** The family of the language's own elements (control flow, async boundaries, the Blok element, the declarations, text). */
|
|
28
28
|
export const LANGUAGE_GROUP = 'language';
|
|
29
29
|
/** The Orkestrator's catalog: what it draws beyond the base. */
|
|
30
30
|
export const ORKESTRATOR_CATALOG_ID = 'https://arkitekt.live/catalogs/orkestrator/v1';
|
|
@@ -67,7 +67,7 @@ export type SpecComponent = {
|
|
|
67
67
|
group: string | null;
|
|
68
68
|
/** How it is drawn where there is no pointer, when that differs. */
|
|
69
69
|
touch: string | null;
|
|
70
|
-
/** The catalog it is from, `name@version` (`base@
|
|
70
|
+
/** The catalog it is from, `name@version` (`base@4`), or the bare name of one nothing published. */
|
|
71
71
|
catalog: string;
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -93,7 +93,7 @@ const texts = (value: unknown): string[] => rawList(value).filter((item): item i
|
|
|
93
93
|
const count = (value: unknown): number => (typeof value === 'number' && Number.isInteger(value) && value >= 0 ? value : 0);
|
|
94
94
|
|
|
95
95
|
const contextOf = (value: unknown): BlokContextName | null =>
|
|
96
|
-
value === '
|
|
96
|
+
value === 'PANEL' || value === 'SCENE' || value === 'LOGO' ? value : null;
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* A catalog file (`{id, name, version, minor, extends, components}`) as a
|
|
@@ -112,7 +112,7 @@ export const parseSpecCatalog = (raw: unknown, file: string): SpecCatalog => {
|
|
|
112
112
|
const components = rawList(raw.components).filter(isRaw).map((entry): SpecComponent => ({
|
|
113
113
|
name: String(entry.name),
|
|
114
114
|
description: text(entry.description),
|
|
115
|
-
context: contextOf(entry.context) ?? '
|
|
115
|
+
context: contextOf(entry.context) ?? 'PANEL',
|
|
116
116
|
childrenContext: contextOf(entry.children_context),
|
|
117
117
|
inheritsContext: entry.inherits_context === true,
|
|
118
118
|
acceptsChildren: entry.accepts_children === true,
|
|
@@ -151,7 +151,7 @@ export const parseSpecCatalog = (raw: unknown, file: string): SpecCatalog => {
|
|
|
151
151
|
export const catalogLabel = (catalog: SpecCatalog): string => (catalog.version === null ? catalog.name : `${catalog.name}@${catalog.version}`);
|
|
152
152
|
|
|
153
153
|
const BUNDLED: Readonly<Record<string, unknown>> = {
|
|
154
|
-
'catalogs/base@
|
|
154
|
+
'catalogs/base@4.json': baseCatalogJson,
|
|
155
155
|
'catalogs/orkestrator@1.json': orkestratorCatalogJson,
|
|
156
156
|
};
|
|
157
157
|
|
package/src/spec/spec.test.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
registerBlokCatalog,
|
|
16
16
|
setAppBlokCatalog,
|
|
17
17
|
} from './catalogs';
|
|
18
|
-
import {argFits, bindFits, bindKindsOf, diagnosticMessage, isExplicitId, loadVocabulary} from './vocabulary';
|
|
18
|
+
import {argFits, bindFits, bindKindsOf, diagnosticMessage, isExplicitId, kindIn, loadVocabulary} from './vocabulary';
|
|
19
19
|
|
|
20
20
|
describe('the synced vocabulary', () => {
|
|
21
21
|
it('is version 2, with the one reserved list', () => {
|
|
@@ -26,7 +26,10 @@ describe('the synced vocabulary', () => {
|
|
|
26
26
|
expect(vocabulary.functions.get('str.template')?.keys).toEqual(['template', 'values']);
|
|
27
27
|
expect(vocabulary.functions.get('logic.choose')?.requiredKeys).toEqual(['cond', 'then']);
|
|
28
28
|
expect(vocabulary.functions.get('ui.copy')?.effect).toBe(true);
|
|
29
|
-
|
|
29
|
+
// An action's logo reads only the task it is drawn against, and declares nothing.
|
|
30
|
+
expect(kindIn(vocabulary.kinds.action, 'LOGO')).toMatchObject({roots: ['task'], locals: false});
|
|
31
|
+
expect(kindIn(vocabulary.kinds.action, 'PANEL')).toBe(vocabulary.kinds.action);
|
|
32
|
+
expect(vocabulary.blok).toMatchObject({component: 'Blok', contexts: {panel: 'PANEL', scene: 'SCENE', logo: 'LOGO'}, content: {SCENE: ['Scene', 'Space'], LOGO: ['Logo']}});
|
|
30
33
|
});
|
|
31
34
|
|
|
32
35
|
it('has then, never now, and the query effects (revision 2)', () => {
|
|
@@ -37,7 +40,7 @@ describe('the synced vocabulary', () => {
|
|
|
37
40
|
expect(vocabulary.reserved.has('query')).toBe(true);
|
|
38
41
|
expect(vocabulary.reserved.has('now')).toBe(false);
|
|
39
42
|
expect(vocabulary.kinds.agent.roots).toContain('then');
|
|
40
|
-
expect(vocabulary.kinds.
|
|
43
|
+
expect(kindIn(vocabulary.kinds.action, 'LOGO').roots).not.toContain('then');
|
|
41
44
|
expect(vocabulary.functions.get('query.refetch')).toMatchObject({effect: true, keys: ['query']});
|
|
42
45
|
expect(vocabulary.functions.get('query.fetch_more')).toMatchObject({effect: true, keys: ['query', 'variables'], requiredKeys: ['query']});
|
|
43
46
|
expect(vocabulary.functions.get('time.diff')?.keys).toEqual(['start', 'end']);
|
|
@@ -46,9 +49,9 @@ describe('the synced vocabulary', () => {
|
|
|
46
49
|
expect(vocabulary.callKinds).not.toContain('query_refetch');
|
|
47
50
|
expect(vocabulary.records.query.fields.map(field => field.key)).toContain('fetching_more');
|
|
48
51
|
expect(Object.keys(vocabulary.theme.dataAttributes).sort()).toEqual(['busy', 'stale']);
|
|
49
|
-
expect([vocabulary.vocab, vocabulary.minor]).toEqual([2,
|
|
50
|
-
expect(vocabulary.baseCatalog).toBe('https://arkitekt.live/catalogs/base/
|
|
51
|
-
expect(Object.values(vocabulary.bundledCatalogs)).toEqual(['catalogs/base@
|
|
52
|
+
expect([vocabulary.vocab, vocabulary.minor]).toEqual([2, 2]);
|
|
53
|
+
expect(vocabulary.baseCatalog).toBe('https://arkitekt.live/catalogs/base/v4');
|
|
54
|
+
expect(Object.values(vocabulary.bundledCatalogs)).toEqual(['catalogs/base@4.json', 'catalogs/orkestrator@1.json']);
|
|
52
55
|
expect(vocabulary.hostParts).toEqual(['args', 'arg', 'deps', 'dep', 'ask', 'returns', 'status', 'timeline']);
|
|
53
56
|
expect(vocabulary.unportableVariants.has('before')).toBe(true);
|
|
54
57
|
expect(vocabulary.unportableVariants.has('hover')).toBe(false);
|
|
@@ -89,7 +92,7 @@ describe('the catalogs', () => {
|
|
|
89
92
|
|
|
90
93
|
it('ship as the vocabulary names them, the base catalog first', () => {
|
|
91
94
|
const base = baseCatalog();
|
|
92
|
-
expect([base.id, base.name, base.version, base.extends]).toEqual(['https://arkitekt.live/catalogs/base/
|
|
95
|
+
expect([base.id, base.name, base.version, base.extends]).toEqual(['https://arkitekt.live/catalogs/base/v4', 'base', 4, null]);
|
|
93
96
|
const orkestrator = orkestratorCatalog();
|
|
94
97
|
expect([orkestrator.id, orkestrator.extends]).toEqual([ORKESTRATOR_CATALOG_ID, base.id]);
|
|
95
98
|
expect(catalogChain(ORKESTRATOR_CATALOG_ID).map(catalog => catalog.name)).toEqual(['base', 'orkestrator']);
|
|
@@ -97,11 +100,11 @@ describe('the catalogs', () => {
|
|
|
97
100
|
|
|
98
101
|
it('give a view of one catalog, which knows what is another\'s', () => {
|
|
99
102
|
const base = baseBlokView();
|
|
100
|
-
expect(base.label).toBe('base@
|
|
103
|
+
expect(base.label).toBe('base@4');
|
|
101
104
|
expect(base.components.has('MikroScene')).toBe(false);
|
|
102
105
|
expect(base.foreign.get('MikroScene')).toBe(ORKESTRATOR_CATALOG_ID);
|
|
103
106
|
const orkestrator = blokView(ORKESTRATOR_CATALOG_ID);
|
|
104
|
-
expect(orkestrator.label).toBe('base@
|
|
107
|
+
expect(orkestrator.label).toBe('base@4 + orkestrator@1');
|
|
105
108
|
expect(orkestrator.components.get('MikroScene')?.service).toBe('mikro');
|
|
106
109
|
expect(orkestrator.components.has('Button')).toBe(true);
|
|
107
110
|
expect(orkestrator.components.get('args')?.kinds).toEqual(['assign']);
|
|
@@ -117,17 +120,17 @@ describe('the catalogs', () => {
|
|
|
117
120
|
const view = blokViewFor(lab.id);
|
|
118
121
|
expect(view.complete).toBe(true);
|
|
119
122
|
expect(['Spectrum', 'MikroScene', 'Button'].every(name => view.components.has(name))).toBe(true);
|
|
120
|
-
expect(minorNeeded({component: '
|
|
121
|
-
expect(minorNeeded({component: '
|
|
122
|
-
expect(blokViewFor(null).label).toBe('base@
|
|
123
|
+
expect(minorNeeded({component: 'Blok', children: [{component: 'Spectrum', props: [{key: 'bands'}]}]}, view)).toBe(2);
|
|
124
|
+
expect(minorNeeded({component: 'Blok', children: [{component: 'Spectrum'}]}, view)).toBe(0);
|
|
125
|
+
expect(blokViewFor(null).label).toBe('base@4');
|
|
123
126
|
});
|
|
124
127
|
|
|
125
128
|
it('are the app\'s own view once it says what it draws', () => {
|
|
126
|
-
expect(defaultBlokView().label).toBe('base@
|
|
129
|
+
expect(defaultBlokView().label).toBe('base@4');
|
|
127
130
|
setAppBlokCatalog(ORKESTRATOR_CATALOG_ID);
|
|
128
131
|
expect(defaultBlokView().components.has('MikroScene')).toBe(true);
|
|
129
132
|
setAppBlokCatalog(parseSpecCatalog({name: 'mine', components: [{name: 'Gauge', props: []}]}, 'mine'));
|
|
130
|
-
expect(defaultBlokView().label).toBe('base@
|
|
133
|
+
expect(defaultBlokView().label).toBe('base@4 + mine');
|
|
131
134
|
});
|
|
132
135
|
|
|
133
136
|
it('take the app\'s own catalog over the snapshot that ships under its id, and never replace the base', () => {
|
|
@@ -139,13 +142,13 @@ describe('the catalogs', () => {
|
|
|
139
142
|
expect(defaultBlokView().components.has('Fresh')).toBe(true);
|
|
140
143
|
expect(blokViewFor(ORKESTRATOR_CATALOG_ID).components.has('Fresh')).toBe(true);
|
|
141
144
|
expect(baseBlokView().foreign.get('Fresh')).toBe(ORKESTRATOR_CATALOG_ID);
|
|
142
|
-
registerBlokCatalog(parseSpecCatalog({id: baseCatalog().id, name: 'base', version:
|
|
145
|
+
registerBlokCatalog(parseSpecCatalog({id: baseCatalog().id, name: 'base', version: 4, components: []}, 'base'));
|
|
143
146
|
expect(baseBlokView().components.has('Button')).toBe(true);
|
|
144
147
|
});
|
|
145
148
|
|
|
146
149
|
it('refuse a catalog that redefines what it extends, or names no catalog address', () => {
|
|
147
150
|
const redefining = parseSpecCatalog({id: 'https://acme.example/catalogs/x/v1', name: 'x', version: 1, components: [{name: 'Button', props: []}]}, 'x');
|
|
148
|
-
expect(() => registerBlokCatalog(redefining)).toThrow(/redefines <Button> of base@
|
|
151
|
+
expect(() => registerBlokCatalog(redefining)).toThrow(/redefines <Button> of base@4/);
|
|
149
152
|
expect(() => parseSpecCatalog({id: 'http://acme.example/catalogs/x/v1', name: 'x', components: []}, 'x')).toThrow(/not the address of a catalog/);
|
|
150
153
|
expect(isCatalogTarget('ui@1')).toBe(false);
|
|
151
154
|
expect(isCatalogTarget(ORKESTRATOR_CATALOG_ID) && isCatalogTarget('mine')).toBe(true);
|
package/src/spec/vocabulary.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"vocab": 2,
|
|
3
|
-
"minor":
|
|
3
|
+
"minor": 2,
|
|
4
4
|
"description": "The blok language, version 2: what a blok may read, call and store. The spec's parser, the server (rekuest_core, takt) and the renderer (orkestrator) load this file or are generated from it. The design is the blok-vocab-v2 proposal of 2026-10-25. Three layers, each versioned on its own: this language (vocab, and minor for what it gained since); the base catalog, everything every renderer draws; and the app catalogs that extend it with what one frontend draws beyond (see catalogs). A server holds a blok to the language alone, never to a catalog: whoever draws a blok checks it against the catalog it has, and an author's tooling checks it when asked.",
|
|
5
5
|
"roots": {
|
|
6
6
|
"data": {
|
|
@@ -35,47 +35,62 @@
|
|
|
35
35
|
"description": "Declared by an app for its own agent (app.blok).",
|
|
36
36
|
"roots": ["self", "args", "queries", "subscriptions", "viewer", "then"],
|
|
37
37
|
"locals": true,
|
|
38
|
-
"contexts": ["
|
|
38
|
+
"contexts": ["PANEL", "SCENE", "LOGO"]
|
|
39
39
|
},
|
|
40
40
|
"custom": {
|
|
41
41
|
"description": "Built by a user and materialized onto agents.",
|
|
42
42
|
"roots": ["deps", "args", "queries", "subscriptions", "viewer", "then"],
|
|
43
43
|
"locals": true,
|
|
44
|
-
"contexts": ["
|
|
44
|
+
"contexts": ["PANEL", "SCENE"]
|
|
45
45
|
},
|
|
46
46
|
"task": {
|
|
47
47
|
"description": "A task's ask or inform blok; its dependencies are the sending task's, mapped.",
|
|
48
48
|
"roots": ["self", "deps", "args", "task", "queries", "subscriptions", "viewer", "then"],
|
|
49
49
|
"locals": true,
|
|
50
|
-
"contexts": ["
|
|
50
|
+
"contexts": ["PANEL"]
|
|
51
51
|
},
|
|
52
52
|
"action": {
|
|
53
|
-
"description": "An action's own blok, declared
|
|
53
|
+
"description": "An action's own blok, declared with the action (bloks=); its dependencies are the action's. In the logo context it is the action's logo, drawn against the task the viewer last ran of it (null until then): it reads only task and declares nothing.",
|
|
54
54
|
"roots": ["self", "deps", "args", "task", "queries", "subscriptions", "viewer", "then"],
|
|
55
55
|
"locals": true,
|
|
56
|
-
"contexts": ["
|
|
56
|
+
"contexts": ["PANEL", "SCENE", "LOGO"],
|
|
57
|
+
"in": {"LOGO": {"roots": ["task"], "locals": false}}
|
|
57
58
|
},
|
|
58
59
|
"assign": {
|
|
59
|
-
"description": "An action's own blok for starting a run of it (
|
|
60
|
+
"description": "An action's own blok for starting a run of it (bloks=, kind assign): shown before there is a task, with the arguments being filled in as args and the agents a run would get as deps.",
|
|
60
61
|
"roots": ["self", "deps", "args", "assign", "queries", "subscriptions", "viewer"],
|
|
61
62
|
"locals": true,
|
|
62
|
-
"contexts": ["
|
|
63
|
-
},
|
|
64
|
-
"action_logo": {
|
|
65
|
-
"description": "An action's logo, drawn against the task the viewer last ran of it (null until then).",
|
|
66
|
-
"roots": ["task"],
|
|
67
|
-
"locals": false,
|
|
68
|
-
"contexts": ["LOGO"]
|
|
63
|
+
"contexts": ["PANEL", "SCENE"]
|
|
69
64
|
}
|
|
70
65
|
},
|
|
71
66
|
"contexts": {
|
|
72
|
-
"
|
|
67
|
+
"PANEL": {"text": true, "description": "Panels, dashboards and popouts: a flat rectangle the host lays out."},
|
|
73
68
|
"SCENE": {"text": false, "description": "A 3D view: a Scene, or an action's Space, which places the run's dependencies in a room whose layout is shared."},
|
|
74
|
-
"LOGO": {"text": false, "description": "An SVG drawing in the viewer's palette: an agent's logo, or an action's (
|
|
69
|
+
"LOGO": {"text": false, "description": "An SVG drawing in the viewer's palette: an agent's logo, or an action's (kind action), which paints with the palette's pens only."}
|
|
75
70
|
},
|
|
76
|
-
"
|
|
77
|
-
"description": "
|
|
78
|
-
"
|
|
71
|
+
"blok": {
|
|
72
|
+
"description": "Every blok is one <Blok> element that says what it is: its kind (what it reads, and where it may be mounted), its context (what host draws it), the catalog it is written for and whether the host draws its own chrome around it. What the blok owns is declared inside it (<local>, <query>, <subscription>); what its mount provides (deps, args, task, self's actions) is checked only where it is mounted.",
|
|
73
|
+
"component": "Blok",
|
|
74
|
+
"attributes": {
|
|
75
|
+
"kind": "Required: agent, custom, task, action or assign (a row of kinds).",
|
|
76
|
+
"context": "Required: panel, scene or logo.",
|
|
77
|
+
"catalog": "The catalog it is written for (the address it is published at, or the name of one registered in the organization); the base catalog when left out.",
|
|
78
|
+
"chrome": "\"none\": the host draws none of its own interface around the blok (panel and scene only)."
|
|
79
|
+
},
|
|
80
|
+
"contexts": {"panel": "PANEL", "scene": "SCENE", "logo": "LOGO"},
|
|
81
|
+
"content": {
|
|
82
|
+
"description": "Per context, the one element a blok holds besides its declarations; a panel holds any elements.",
|
|
83
|
+
"SCENE": ["Scene", "Space"],
|
|
84
|
+
"LOGO": ["Logo"]
|
|
85
|
+
},
|
|
86
|
+
"chrome": ["PANEL", "SCENE"],
|
|
87
|
+
"declarations": {
|
|
88
|
+
"description": "What a blok owns, declared in its tree. Each is stored as a node of its own and draws nothing.",
|
|
89
|
+
"local": "<local name=\"x\" default={...} persist kind=... />: a local (see locals). It comes before every other child of its parent and is in scope in its parent's subtree only; inside a foreach there is one per item. Every attribute but name is a literal: a port field (kind, identifier, nullable, choices, children, label, description, default, ...), persist, or like=\"self.<action>.<arg>\" / like=\"deps.<key>.<action>.<arg>\" (the port of that argument, resolved where the blok is mounted).",
|
|
90
|
+
"query": "<query name=\"x\" service=\"mikro\" document=\"query (...) {...}\" poll={5} more=\"items\"><var key=\"k\" value={...} /></query>: a declared read, queries.<name>. A child of <Blok>, before its content.",
|
|
91
|
+
"subscription": "<subscription name=\"x\" service=\"mikro\" document=\"subscription (...) {...}\" keep={10} history=\"q\"><var key=\"k\" value={...} /></subscription>: a declared stream, subscriptions.<name>. A child of <Blok>, before its content.",
|
|
92
|
+
"var": "<var key=\"k\" value={expression or literal} />: one variable of a query or subscription; an expression over args, blok-level locals and agents."
|
|
93
|
+
}
|
|
79
94
|
},
|
|
80
95
|
"records": {
|
|
81
96
|
"task": {
|
|
@@ -324,10 +339,12 @@
|
|
|
324
339
|
"text": "Text is a child like any other: each run of text between elements is stored as a node {id: <parent>/#<n>, component: \"#text\", props: [value]}, its value a literal or an expression; several parts of one run desugar to str.template(template, values). No element can be called #text, so only text makes one. Parsing needs no catalog. What a component does with its text is its renderer's: one with a text_prop makes its text children that prop (a Button its label), any other that takes children draws them in place; a component that sets its text_prop as an attribute too, or takes neither text nor children, is a catalog finding (catalog.text). A tree stored before text was a node holds the text_prop itself, and implicit Text or span nodes under the same ids: a renderer draws both."
|
|
325
340
|
},
|
|
326
341
|
"locals": {
|
|
327
|
-
"description": "
|
|
342
|
+
"description": "Form state that feeds a call, declared in the tree as <local name=... />: a local is an arg port (key, kind, identifier, nullable, default, children, choices, validators, description, ...) plus persist, written only through `bind` on controls, read bare. persist remembers the last input on this device. Its kind is a port kind or ANY; left out it is inferred (kind_inference).",
|
|
328
343
|
"fields": ["persist"],
|
|
344
|
+
"node": {"component": "local", "name": "name", "like": "like", "persist": "persist"},
|
|
345
|
+
"scope": "A local is in scope in its parent's subtree: its siblings, their children, and nothing outside its parent. It is the first of its parent's children (only other locals before it), never a child of a component that takes no children. Inside a foreach there is one value per item (by the item's runtime id); it lives as long as the blok is open, an if's branch closing and reopening included. A kept (persist) value is kept by the local's runtime id: an explicit id keeps it across edits of the tree. A local never shadows a name in scope (another local, a let, an into name) nor a reserved root.",
|
|
329
346
|
"any": "ANY is a local's kind only (no action port is ever ANY): an untyped value. It is never an error and gets no warning; it skips the bind_kinds and arg_kinds checks and a path below it is taken as written. A renderer treats it as an untyped value.",
|
|
330
|
-
"kind_inference": ["A given kind (ANY included) is kept; only a left-out kind is inferred, by the first rule that gives one:", "1. the default: a bool BOOL, an integer INT, any other number FLOAT, a string STRING; a non-empty list of one scalar kind LIST of it, a non-empty object of one scalar kind DICT of it (the item port keyed ...); null, [], {} and mixed items tell nothing;", "2. the port of the task argument the local is passed to whole (an argument whose value is exactly the local's path), at the first such call in tree order whose arg port is known and makes a valid local: its kind, identifier, nullable, choices, reference_unit, proposed_units, dimension and children (from a demand's arg match: kind, identifier, nullable and children, every child with a kind);", "3. the bind kind of the first control bound to the local whole, when it is STRING, INT, FLOAT or BOOL (LIST, DICT and ANY controls tell too little);", "4. else ANY.", "
|
|
347
|
+
"kind_inference": ["A given kind (ANY included) is kept; only a left-out kind is inferred, by the first rule that gives one:", "1. the default: a bool BOOL, an integer INT, any other number FLOAT, a string STRING; a non-empty list of one scalar kind LIST of it, a non-empty object of one scalar kind DICT of it (the item port keyed ...); null, [], {} and mixed items tell nothing;", "2. the port of the task argument the local is passed to whole (an argument whose value is exactly the local's path), at the first such call in tree order whose arg port is known and makes a valid local: its kind, identifier, nullable, choices, reference_unit, proposed_units, dimension and children (from a demand's arg match: kind, identifier, nullable and children, every child with a kind);", "3. the bind kind of the first control bound to the local whole, when it is STRING, INT, FLOAT or BOOL (LIST, DICT and ANY controls tell too little);", "4. else ANY.", "A given kind and like= come before rule 1. Only uses inside the local's scope (its parent's subtree) count. Tree order is the walk order: nodes depth first, each node's props in order, a call's arguments in order. Every field the local sets (choices, nullable, widget, identifier, children, description, ...) wins over the inferred type, which only fills what it leaves out; a candidate whose merge is no valid port is skipped. The other call sites and binds are then checked against the kind found (local.arg_kind, local.bind_kind). A left-out kind stays distinguishable from a given ANY until inference ran (no default filled in at deserialization; null is left out)."],
|
|
331
348
|
"bind": "bind={<local>} or bind={<local>.<field>...}: the control writes the local; nothing else does. The catalog's kind of the bind prop is what the control writes: the local (or the field of it bound) must be a port kind bind_kinds lists for it.",
|
|
332
349
|
"bind_kinds": {"description": "Per catalog kind of a bind prop, the port kinds of the locals it may write. A kind not listed (ANY) writes any local.", "STRING": ["STRING", "ENUM", "DATE"], "FLOAT": ["FLOAT", "INT", "QUANTITY"], "INT": ["INT"], "BOOL": ["BOOL"], "LIST": ["LIST"], "DICT": ["DICT", "MODEL"]},
|
|
333
350
|
"arg_kinds": {"description": "Per port kind of a local passed whole as a task call's argument, the kinds of the action's arg port that take it, where the action is known (agent self.<action> demands, an action's dependencies). STRUCTURE also needs the same identifier. An ANY local is not checked.", "STRING": ["STRING"], "INT": ["INT", "FLOAT"], "FLOAT": ["FLOAT"], "BOOL": ["BOOL"], "ENUM": ["ENUM", "STRING"], "DATE": ["DATE", "STRING"], "QUANTITY": ["QUANTITY", "FLOAT"], "LIST": ["LIST"], "DICT": ["DICT"], "MODEL": ["MODEL", "DICT"], "STRUCTURE": ["STRUCTURE"]}
|
|
@@ -370,9 +387,9 @@
|
|
|
370
387
|
"logo_path_data_props": ["d", "points"]
|
|
371
388
|
},
|
|
372
389
|
"catalogs": {
|
|
373
|
-
"description": "A catalog is a versioned set of components. The base catalog is what every renderer draws, whole, in the contexts it draws (
|
|
374
|
-
"base": "https://arkitekt.live/catalogs/base/
|
|
375
|
-
"bundled": {"https://arkitekt.live/catalogs/base/
|
|
390
|
+
"description": "A catalog is a versioned set of components. The base catalog is what every renderer draws, whole, in the contexts it draws (PANEL, SCENE, LOGO): a blok written for it runs everywhere. An app catalog extends another (in the end the base) with what one frontend draws beyond it; it is that frontend's to publish. A catalog is named by the address it is published at (its id); a blok names the one catalog it is written for (catalog), the base when it names none, and may record the minor it needs (catalog_minor). A version only ever gains components and props: each says the minor that added it (since), so a blok valid at v1.2 stays valid. A renderer reports the catalogs and minors it speaks; what it lacks it draws as a placeholder, and reports. A catalog never redefines a component of the one it extends. Nobody's server fetches a catalog: it holds what a frontend registered under the id, and an author's tooling resolves an id from what ships with it, from its cache, or by fetching it.",
|
|
391
|
+
"base": "https://arkitekt.live/catalogs/base/v4",
|
|
392
|
+
"bundled": {"https://arkitekt.live/catalogs/base/v4": "catalogs/base@4.json", "https://arkitekt.live/catalogs/orkestrator/v1": "catalogs/orkestrator@1.json"},
|
|
376
393
|
"id": "^https://[^\\s/]+(/[^\\s/]+)*/v[0-9]+$",
|
|
377
394
|
"name": "^[A-Za-z_][A-Za-z0-9_.-]*$",
|
|
378
395
|
"host_parts": {
|
|
@@ -390,8 +407,8 @@
|
|
|
390
407
|
"diagnostics": {
|
|
391
408
|
"description": "One table of stable codes, the same in Python, Rust and TypeScript. level: error refuses the blok, warning is reported; runtime: true marks a code no checker raises, the renderer's error code of a record (deps.unbound). Messages are str.format templates; parity compares codes, never text.",
|
|
392
409
|
"bsx.syntax": {"level": "error", "message": "{detail}", "hint": "Fix the markup at the line and column given; every attribute is name=\"text\" or name={{expression}}."},
|
|
393
|
-
"bsx.empty": {"level": "error", "message": "A blok has one root element; this source has none.", "hint": "Write one root element
|
|
394
|
-
"bsx.multiple_roots": {"level": "error", "message": "A blok has one root element; found another after it: <{component}>.", "hint": "Wrap everything in the one root element (<
|
|
410
|
+
"bsx.empty": {"level": "error", "message": "A blok has one root element; this source has none.", "hint": "Write one root element: <Blok kind=\"...\" context=\"...\">."},
|
|
411
|
+
"bsx.multiple_roots": {"level": "error", "message": "A blok has one root element; found another after it: <{component}>.", "hint": "Wrap everything in the one root element (<Blok ...>...</Blok>); siblings go inside it."},
|
|
395
412
|
"bsx.unclosed": {"level": "error", "message": "<{component}> is never closed.", "hint": "Close it with </{component}>, or write it self-closing as <{component} ... />."},
|
|
396
413
|
"bsx.mismatched_tag": {"level": "error", "message": "</{found}> closes <{expected}>.", "hint": "Close <{expected}> before </{found}>: tags nest, the last one opened closes first."},
|
|
397
414
|
"bsx.duplicate_attribute": {"level": "error", "message": "<{component}> sets {key} twice.", "hint": "Keep one {key}; to choose between values, write one expression (c ? a : b)."},
|
|
@@ -440,7 +457,13 @@
|
|
|
440
457
|
"local.bind": {"level": "error", "message": "bind holds a local's path ({{name}} or {{name.field}}), not {what}.", "hint": "Write bind={{name}} with a declared local's name."},
|
|
441
458
|
"local.default": {"level": "error", "message": "local {name!r}: its default {default!r} is not a {kind}.", "hint": "Give a default of that kind, or leave the kind out so the default sets it."},
|
|
442
459
|
"local.kind": {"level": "error", "message": "local {name!r}: type={type!r} is a name, not an annotation; give the type itself (int, list[str], a registered structure)."},
|
|
443
|
-
"local.like": {"level": "error", "message": "local {name!r}:
|
|
460
|
+
"local.like": {"level": "error", "message": "local {name!r}: like={like!r} {problem}.", "hint": "Write like=\"self.<action>.<arg>\" or like=\"deps.<key>.<action>.<arg>\"."},
|
|
461
|
+
"local.position": {"level": "error", "message": "local {name!r} {problem}.", "hint": "Declare a local first among its parent's children, inside an element that takes children."},
|
|
462
|
+
"local.attribute": {"level": "error", "message": "local {name!r}: {key} {problem}.", "hint": "Every attribute of a local but name is a literal: default={{3}}, persist, kind=\"INT\"."},
|
|
463
|
+
"local.persist_id": {"level": "warning", "message": "local {name!r} persists inside a foreach without key: its kept value follows the item's position, not the item.", "hint": "Give the foreach a key={{...}}."},
|
|
464
|
+
"query.position": {"level": "error", "message": "<{component}> {name!r} is declared at {at}: queries and subscriptions are children of <Blok>.", "hint": "Move it to the top of the <Blok>."},
|
|
465
|
+
"query.duplicate": {"level": "error", "message": "{what} {name!r} is declared twice ({first} and {second})."},
|
|
466
|
+
"query.declaration": {"level": "error", "message": "<{component}> {problem}."},
|
|
444
467
|
"local.bind_kind": {"level": "error", "message": "{key} of <{component}> writes a {prop_kind}, but {path} is a {kind} local (a {prop_kind} control writes {kinds}).", "hint": "Bind a local of a kind the control writes, or leave the local's kind out so the control sets it."},
|
|
445
468
|
"local.arg_kind": {"level": "error", "message": "{call}: {argument} takes a {port_kind}, but {path} is a {kind} local.", "hint": "Pass a local of the argument's kind, or leave the local's kind out so the argument sets it."},
|
|
446
469
|
"local.unused_persist": {"level": "warning", "message": "local {name!r} persists, but no control binds it.", "hint": "Bind a control to it, or drop persist."},
|
|
@@ -462,10 +485,13 @@
|
|
|
462
485
|
"props.literal_type": {"level": "error", "message": "<{component}> {key}={value!r} is a string, but {key} takes a {kind}; write {hint}.", "hint": "Write the value as an expression in braces: {key}={{...}}."},
|
|
463
486
|
"foreach.position_key": {"level": "warning", "message": "<foreach let=\"{let}\"> has no key, so its items are keyed by their position; they are not scalars, so key them by a stable field (key={{{let}.id}})."},
|
|
464
487
|
"returns.unnamed": {"level": "warning", "message": "{path} reads {port}, a return the action left unnamed; name it in the action, as Annotated[T, Key(\"name\")] or as a field of a NamedTuple return, and read it by that name."},
|
|
465
|
-
"
|
|
466
|
-
"
|
|
488
|
+
"blok.root": {"level": "error", "message": "A blok is one <Blok kind=... context=...> element, not <{component}>.", "hint": "Wrap it: <Blok kind=\"agent\" context=\"panel\">...</Blok>."},
|
|
489
|
+
"blok.attribute": {"level": "error", "message": "<Blok> {problem}.", "hint": "Write kind=\"agent|custom|task|action|assign\" and context=\"panel|scene|logo\" as literals."},
|
|
490
|
+
"blok.content": {"level": "error", "message": "A {context} blok holds {expected} beside its declarations, not {found}.", "hint": "Put everything inside one {expected}."},
|
|
467
491
|
"context.kind": {"level": "error", "message": "A{n} {kind} blok is drawn in {contexts}, not {context}."},
|
|
468
|
-
"
|
|
492
|
+
"kind.placement": {"level": "error", "message": "This is a{n} {kind} blok, but it is mounted as a{m} {expected} blok ({where}).", "hint": "Write kind=\"{expected}\" on its <Blok>, or mount it where a{n} {kind} blok goes."},
|
|
493
|
+
"chrome.context": {"level": "error", "message": "chrome is the host's interface around a panel or a scene, not a {context} blok's.", "hint": "Drop chrome."},
|
|
494
|
+
"assign.kind": {"level": "error", "message": "{what} belongs to starting a run, so only an action's assign blok holds it, not a{n} {kind} blok.", "hint": "Make it <Blok kind=\"assign\"> in the action's bloks=[...]."},
|
|
469
495
|
"logo.complexity": {"level": "error", "message": "{detail}"},
|
|
470
496
|
"catalog.unknown_component": {"level": "warning", "message": "<{component}> is not in the catalog the blok is written for ({catalogs}).", "hint": "Look the component up in the catalog; names are case-sensitive."},
|
|
471
497
|
"catalog.children": {"level": "warning", "message": "<{component}> takes no children.", "hint": "Close <{component}> without children (<{component} ... />), or put them beside it."},
|
|
@@ -476,7 +502,7 @@
|
|
|
476
502
|
"catalog.asset": {"level": "warning", "message": "{key} of <{component}> names an asset as <agent>.assets.<name>.", "hint": "Write {key}={{self.assets.<name>}} with an asset the app registered."},
|
|
477
503
|
"catalog.target": {"level": "error", "message": "<{component}> is of {catalog}, and this blok is written for {target}.", "hint": "Name the catalog it is written for (catalog=\"{catalog}\"), or use what {target} draws."},
|
|
478
504
|
"catalog.unknown": {"level": "warning", "message": "The catalog {catalog!r} is not known here ({catalogs}), so what it adds to the base catalog is not checked.", "hint": "Register the catalog with the tooling, or check the address."},
|
|
479
|
-
"catalog.kind": {"level": "error", "message": "<{component}> belongs to {kinds} bloks, not to a{n} {kind} blok.", "hint": "Declare it with the action
|
|
505
|
+
"catalog.kind": {"level": "error", "message": "<{component}> belongs to {kinds} bloks, not to a{n} {kind} blok.", "hint": "Declare it with the action, in bloks=[...]: <Blok kind=\"action\"> for a run, <Blok kind=\"assign\"> for starting one."},
|
|
480
506
|
"catalog.context": {"level": "warning", "message": "<{component}> needs the {service} service where it is drawn; without it a notice shows in its place."},
|
|
481
507
|
"part.conditional": {"level": "warning", "message": "<{component}> is inside <{inside}>: placing it anywhere claims it, so the host draws none of its own even while this one does not show.", "hint": "Place <{component}> outside <{inside}>, or hide what is around it instead."},
|
|
482
508
|
"chrome.no_ask": {"level": "warning", "message": "chrome=\"none\" leaves the run's asks to the blok, and it places no <ask />: an ask can then only be answered elsewhere.", "hint": "Place <ask /> where the run's questions should show, or answer task.ask with task.answer(values: ...)."},
|
|
@@ -486,7 +512,7 @@
|
|
|
486
512
|
"manifest.catalog": {"level": "error", "message": "Catalog {catalog!r} is neither the address a catalog is published at (https://arkitekt.live/catalogs/orkestrator/v1) nor the name of one registered in the organization."},
|
|
487
513
|
"manifest.duplicate": {"level": "error", "message": "{what}: {key!r} is declared twice."},
|
|
488
514
|
"manifest.name": {"level": "error", "message": "{what}: {key!r} is not a name."},
|
|
489
|
-
"manifest.action_logo": {"level": "error", "message": "An action logo reads only the task it is drawn against: no
|
|
515
|
+
"manifest.action_logo": {"level": "error", "message": "An action logo reads only the task it is drawn against: no dependencies."},
|
|
490
516
|
"manifest.demo": {"level": "error", "message": "demo.deps names {keys}, which are not dependencies of the blok."}
|
|
491
517
|
}
|
|
492
518
|
}
|
package/src/spec/vocabulary.ts
CHANGED
|
@@ -8,10 +8,11 @@ import vocabularyJson from './vocabulary.json';
|
|
|
8
8
|
* diagnostics is read from this one file, never restated.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export type BlokKind = 'agent' | 'custom' | 'task' | 'action' | 'assign'
|
|
12
|
-
export const BLOK_KINDS: readonly BlokKind[] = ['agent', 'custom', 'task', 'action', 'assign'
|
|
11
|
+
export type BlokKind = 'agent' | 'custom' | 'task' | 'action' | 'assign';
|
|
12
|
+
export const BLOK_KINDS: readonly BlokKind[] = ['agent', 'custom', 'task', 'action', 'assign'];
|
|
13
13
|
|
|
14
|
-
export type BlokContextName = '
|
|
14
|
+
export type BlokContextName = 'PANEL' | 'SCENE' | 'LOGO';
|
|
15
|
+
export const BLOK_CONTEXTS: readonly BlokContextName[] = ['PANEL', 'SCENE', 'LOGO'];
|
|
15
16
|
|
|
16
17
|
export type VocabParam = {key: string; kind: string; required: boolean};
|
|
17
18
|
|
|
@@ -57,6 +58,27 @@ export type VocabKind = {
|
|
|
57
58
|
roots: readonly string[];
|
|
58
59
|
locals: boolean;
|
|
59
60
|
contexts: readonly BlokContextName[];
|
|
61
|
+
/** Per context, the narrower row the kind reads there (an action's logo reads only `task`, and has no locals). */
|
|
62
|
+
within: Readonly<Partial<Record<BlokContextName, VocabKind>>>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** The row of `kind` in `context`: its own, or the narrower one it has there (vocabulary `kinds.<kind>.in`). */
|
|
66
|
+
export const kindIn = (kind: VocabKind, context: string): VocabKind => kind.within[context as BlokContextName] ?? kind;
|
|
67
|
+
|
|
68
|
+
/** The one element every blok is (vocabulary `blok`): `<Blok kind context catalog chrome>`. */
|
|
69
|
+
export type VocabBlokElement = {
|
|
70
|
+
/** `Blok`. */
|
|
71
|
+
component: string;
|
|
72
|
+
/** What each attribute of the element says. */
|
|
73
|
+
attributes: Readonly<Record<string, string>>;
|
|
74
|
+
/** The `context` attribute's spelling → the context (`panel` → `PANEL`). */
|
|
75
|
+
contexts: Readonly<Record<string, BlokContextName>>;
|
|
76
|
+
/** Per context, the components its one element may be; a context not listed (PANEL) holds anything. */
|
|
77
|
+
content: Readonly<Partial<Record<BlokContextName, readonly string[]>>>;
|
|
78
|
+
/** The contexts `chrome` is said in. */
|
|
79
|
+
chrome: readonly BlokContextName[];
|
|
80
|
+
/** The components that declare what a blok owns and draw nothing (`local`, `query`, `subscription`, `var`), with what each says. */
|
|
81
|
+
declarations: Readonly<Record<string, string>>;
|
|
60
82
|
};
|
|
61
83
|
|
|
62
84
|
export type VocabContext = {text: boolean; description: string};
|
|
@@ -164,8 +186,8 @@ export type BlokVocabulary = {
|
|
|
164
186
|
};
|
|
165
187
|
kinds: Readonly<Record<BlokKind, VocabKind>>;
|
|
166
188
|
contexts: Readonly<Record<BlokContextName, VocabContext>>;
|
|
167
|
-
/**
|
|
168
|
-
|
|
189
|
+
/** The one element every blok is: `<Blok kind context catalog chrome>`. */
|
|
190
|
+
blok: VocabBlokElement;
|
|
169
191
|
records: Readonly<Record<string, VocabRecord>>;
|
|
170
192
|
statuses: Readonly<Record<string, string>>;
|
|
171
193
|
alwaysReady: readonly string[];
|
|
@@ -241,8 +263,9 @@ const stringMap = (value: unknown, where: string): Record<string, string> =>
|
|
|
241
263
|
.map(([key, item]) => [key, string(item, `${where}.${key}`)]),
|
|
242
264
|
);
|
|
243
265
|
|
|
244
|
-
const
|
|
245
|
-
value === '
|
|
266
|
+
export const isBlokContext = (value: string): value is BlokContextName =>
|
|
267
|
+
value === 'PANEL' || value === 'SCENE' || value === 'LOGO';
|
|
268
|
+
const isContext = isBlokContext;
|
|
246
269
|
|
|
247
270
|
const recordFields = (value: unknown, where: string): VocabRecordField[] =>
|
|
248
271
|
list(value, where).map((raw, index) => {
|
|
@@ -291,13 +314,31 @@ export const parseVocabulary = (raw: unknown): BlokVocabulary => {
|
|
|
291
314
|
const kinds = {} as Record<BlokKind, VocabKind>;
|
|
292
315
|
for (const kind of BLOK_KINDS) {
|
|
293
316
|
const entry = object(kindsRaw[kind], `kinds.${kind}`);
|
|
317
|
+
const roots = strings(entry.roots, `kinds.${kind}.roots`);
|
|
318
|
+
const within: Partial<Record<BlokContextName, VocabKind>> = {};
|
|
319
|
+
for (const [context, value] of Object.entries(entry.in === undefined ? {} : object(entry.in, `kinds.${kind}.in`))) {
|
|
320
|
+
if (!isContext(context)) throw new Error(`vocabulary.json: kinds.${kind}.in names an unknown context ${context}`);
|
|
321
|
+
const narrower = object(value, `kinds.${kind}.in.${context}`);
|
|
322
|
+
const narrowerRoots = strings(narrower.roots, `kinds.${kind}.in.${context}.roots`);
|
|
323
|
+
if (narrowerRoots.some(root => !roots.includes(root))) throw new Error(`vocabulary.json: kind ${kind} reads more in ${context} than it reads`);
|
|
324
|
+
within[context] = {
|
|
325
|
+
description: '',
|
|
326
|
+
roots: narrowerRoots,
|
|
327
|
+
locals: narrower.locals === true,
|
|
328
|
+
contexts: [context],
|
|
329
|
+
within: {},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
294
332
|
kinds[kind] = {
|
|
295
333
|
description: typeof entry.description === 'string' ? entry.description : '',
|
|
296
|
-
roots
|
|
334
|
+
roots,
|
|
297
335
|
locals: entry.locals === true,
|
|
298
336
|
contexts: strings(entry.contexts, `kinds.${kind}.contexts`).filter(isContext),
|
|
337
|
+
within,
|
|
299
338
|
};
|
|
300
339
|
}
|
|
340
|
+
const unknownKinds = Object.keys(kindsRaw).filter(kind => kind !== 'description' && !(BLOK_KINDS as readonly string[]).includes(kind));
|
|
341
|
+
if (unknownKinds.length) throw new Error(`vocabulary.json: kinds this package does not know: ${unknownKinds.join(', ')}`);
|
|
301
342
|
|
|
302
343
|
const contextsRaw = object(root.contexts, 'contexts');
|
|
303
344
|
const contexts = {} as Record<BlokContextName, VocabContext>;
|
|
@@ -310,7 +351,25 @@ export const parseVocabulary = (raw: unknown): BlokVocabulary => {
|
|
|
310
351
|
};
|
|
311
352
|
}
|
|
312
353
|
|
|
313
|
-
const
|
|
354
|
+
const blokRaw = object(root.blok, 'blok');
|
|
355
|
+
const blokContexts: Record<string, BlokContextName> = {};
|
|
356
|
+
for (const [spelled, context] of Object.entries(stringMap(blokRaw.contexts, 'blok.contexts'))) {
|
|
357
|
+
if (!isContext(context)) throw new Error(`vocabulary.json: blok.contexts.${spelled} is no context`);
|
|
358
|
+
blokContexts[spelled] = context;
|
|
359
|
+
}
|
|
360
|
+
const blokContent: Partial<Record<BlokContextName, readonly string[]>> = {};
|
|
361
|
+
for (const [context, components] of Object.entries(kindTable(blokRaw.content, 'blok.content'))) {
|
|
362
|
+
if (!isContext(context)) throw new Error(`vocabulary.json: blok.content names an unknown context ${context}`);
|
|
363
|
+
blokContent[context] = components;
|
|
364
|
+
}
|
|
365
|
+
const blok: VocabBlokElement = {
|
|
366
|
+
component: string(blokRaw.component, 'blok.component'),
|
|
367
|
+
attributes: stringMap(blokRaw.attributes, 'blok.attributes'),
|
|
368
|
+
contexts: blokContexts,
|
|
369
|
+
content: blokContent,
|
|
370
|
+
chrome: strings(blokRaw.chrome, 'blok.chrome').filter(isContext),
|
|
371
|
+
declarations: stringMap(blokRaw.declarations, 'blok.declarations'),
|
|
372
|
+
};
|
|
314
373
|
|
|
315
374
|
const recordsRaw = object(root.records, 'records');
|
|
316
375
|
const records: Record<string, VocabRecord> = {};
|
|
@@ -378,7 +437,7 @@ export const parseVocabulary = (raw: unknown): BlokVocabulary => {
|
|
|
378
437
|
},
|
|
379
438
|
kinds,
|
|
380
439
|
contexts,
|
|
381
|
-
|
|
440
|
+
blok,
|
|
382
441
|
records,
|
|
383
442
|
statuses: stringMap(asyncRaw.statuses, 'async.statuses'),
|
|
384
443
|
alwaysReady: strings(asyncRaw.always_ready, 'async.always_ready'),
|