@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
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* What an action's own blok needs from the app that shows a run of it.
|
|
4
4
|
*
|
|
5
|
-
* The blok core draws `Space`, `Placed`, `Route` and `
|
|
5
|
+
* The blok core draws `Space`, `Placed`, `Route`, `ask` and `timeline`; it does not know
|
|
6
6
|
* which agents a run got, how an agent's own scene blok is found, where a room
|
|
7
7
|
* keeps its devices, or how an ask is answered. The host answers those through
|
|
8
8
|
* these contexts: the run (rekuest, from the task or a dry run) and the rooms
|
|
@@ -11,6 +11,15 @@ import * as React from 'react';
|
|
|
11
11
|
* Both are provided around the scene surface, not inside the canvas: a
|
|
12
12
|
* `Popout`'s card is rendered by the scene's HTML half, outside the blok.
|
|
13
13
|
*/
|
|
14
|
+
/** How an `<args />` narrows the form it draws. */
|
|
15
|
+
export type BlokArgsOptions = {
|
|
16
|
+
/** Only these port keys. */
|
|
17
|
+
only?: readonly string[];
|
|
18
|
+
/** Not these port keys. */
|
|
19
|
+
omit?: readonly string[];
|
|
20
|
+
/** What it does with the arguments the caller gave: leaves them out (`hide`, the default) or lists them, locked (`show`). */
|
|
21
|
+
given?: 'hide' | 'show';
|
|
22
|
+
};
|
|
14
23
|
/** An agent a run binds a dependency key to. */
|
|
15
24
|
export type BlokRunAgent = {
|
|
16
25
|
id: string;
|
|
@@ -21,8 +30,28 @@ export type BlokRunHost = {
|
|
|
21
30
|
agentsFor: (key: string) => readonly BlokRunAgent[];
|
|
22
31
|
/** The run's open ask, answered in place (answering resumes the run); nothing while none is open. */
|
|
23
32
|
renderAsk: () => React.ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The form of the arguments of the run an assign blok starts (`<args />`); absent where no run is
|
|
35
|
+
* being started. It draws the rest: every argument the caller did not give and no `<arg />` places,
|
|
36
|
+
* narrowed by `options`.
|
|
37
|
+
*/
|
|
38
|
+
renderArgs?: (options?: BlokArgsOptions) => React.ReactNode;
|
|
39
|
+
/** One argument of that run, by port key (`<arg key="image" />`); nothing for one the caller gave. */
|
|
40
|
+
renderArg?: (key: string) => React.ReactNode;
|
|
41
|
+
/** The picker of the run's dependencies (`<deps />`): every dependency no `<dep />` places. */
|
|
42
|
+
renderDeps?: () => React.ReactNode;
|
|
43
|
+
/** The picker of one dependency of that run, by key (`<dep key="microscope" />`). */
|
|
44
|
+
renderDep?: (key: string) => React.ReactNode;
|
|
45
|
+
/** What the run returned, as its return ports show it (`<returns />`); nothing before the first yield. */
|
|
46
|
+
renderReturns?: (options?: Pick<BlokArgsOptions, 'only' | 'omit'>) => React.ReactNode;
|
|
47
|
+
/** Where the run stands, as one line (`<status />`). */
|
|
48
|
+
renderStatus?: () => React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* The run's time slider (`<timeline />`): moving it moves what the host shows of the run, this
|
|
51
|
+
* blok with it. Absent where the run has no clock; a host that draws a slider of its own leaves
|
|
52
|
+
* that out for a blok that places this one.
|
|
53
|
+
*/
|
|
54
|
+
renderTimeline?: () => React.ReactNode;
|
|
26
55
|
};
|
|
27
56
|
export declare const BlokRunHostProvider: React.Provider<BlokRunHost>;
|
|
28
57
|
export declare const useBlokRunHost: () => BlokRunHost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../src/renderer/bloks/run/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;GAWG;AAEH,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,2FAA2F;IAC3F,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,YAAY,EAAE,CAAC;IACpD,qGAAqG;IACrG,SAAS,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACjC,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../src/renderer/bloks/run/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;GAWG;AAEH,mDAAmD;AACnD,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,6HAA6H;IAC7H,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,2FAA2F;IAC3F,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,YAAY,EAAE,CAAC;IACpD,qG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aAAa,GAAG;IAC1B,qEAAqE;IACrE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,CAAC;IACpC;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;CACxE,CAAC;AAWF,eAAO,MAAM,qBAAqB,+BAAgC,CAAC;AAEnE,eAAO,MAAM,gBAAgB,QAAO,aAAuD,CAAC;AAQ5F,eAAO,MAAM,gBAAgB,+BAA2B,CAAC;AAEzD,eAAO,MAAM,WAAW,QAAO,MAAM,GAAG,IAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../src/renderer/bloks/run/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../src/renderer/bloks/run/host.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyD/B,MAAM,SAAS,GAA4B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE7D,MAAM,YAAY,GAAgB;IAChC,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;IAC1B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI;CACtB,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAc,YAAY,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,QAAQ,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAgB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AA+BtF,MAAM,OAAO,GAAa,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAC,CAAC;AAE/C,MAAM,cAAc,GAAkB;IACpC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;IACtB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI;CACxB,CAAC;AAEF,MAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAgB,cAAc,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,QAAQ,CAAC;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAkB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAE5F;;;GAGG;AACH,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAgB,IAAI,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAkB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -14,11 +14,15 @@ export declare const sceneRenders: {
|
|
|
14
14
|
notDownstreamOf: string[];
|
|
15
15
|
};
|
|
16
16
|
schema: import("zod").ZodObject<{
|
|
17
|
+
chrome: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
18
|
+
none: "none";
|
|
19
|
+
auto: "auto";
|
|
20
|
+
}>>;
|
|
17
21
|
camera: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
22
|
+
top: "top";
|
|
18
23
|
iso: "iso";
|
|
19
|
-
front: "front";
|
|
20
24
|
side: "side";
|
|
21
|
-
|
|
25
|
+
front: "front";
|
|
22
26
|
}>>;
|
|
23
27
|
grid: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
24
28
|
height: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/renderer/bloks/scene/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,cAAc,QAAQ,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/renderer/bloks/scene/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,cAAc,QAAQ,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAexB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
/**
|
|
4
4
|
* `<Toast task={move}>`: a notification when a task settles, once per task
|
|
5
|
-
* (ui
|
|
5
|
+
* (the ui family). Each outcome slot (`done`, `failed`, `cancelled`) is optional and
|
|
6
6
|
* holds the text shown for it:
|
|
7
7
|
*
|
|
8
8
|
* <Toast task={move}>
|
|
@@ -78,7 +78,7 @@ const useClock = (active, target) => {
|
|
|
78
78
|
return now;
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
|
-
* `<Time value relative? format?>` (ui
|
|
81
|
+
* `<Time value relative? format?>` (the ui family): a moment, absolute or relative.
|
|
82
82
|
* Relative time is measured from the viewed moment: the wall clock live
|
|
83
83
|
* (ticking here), `then` while travelling, so the past renders as it did.
|
|
84
84
|
*/
|
|
@@ -5,7 +5,7 @@ export declare const BlokCatalogProvider: ({ catalog, children }: {
|
|
|
5
5
|
catalog: BlokCatalog;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
}) => React.JSX.Element;
|
|
8
|
-
/** The app's catalog when no provider says otherwise: the platform's, or
|
|
8
|
+
/** The app's catalog when no provider says otherwise: the platform's, or the language's own elements alone. */
|
|
9
9
|
export declare const appBlokCatalog: () => BlokCatalog;
|
|
10
10
|
/** The catalog the app provides here, or the app's. */
|
|
11
11
|
export declare const useBlokCatalog: () => BlokCatalog;
|
|
@@ -15,12 +15,9 @@ export declare const useBlokCatalog: () => BlokCatalog;
|
|
|
15
15
|
* export) offers them. Called once, by the composition root that installs the
|
|
16
16
|
* modules; core never imports a module.
|
|
17
17
|
*
|
|
18
|
-
* A
|
|
19
|
-
* the
|
|
20
|
-
*
|
|
21
|
-
* already holds (base's, the app's own, another module's) is refused, whoever
|
|
22
|
-
* brought it. Returns the undo, which puts a drawn-over component back (a dev
|
|
23
|
-
* hot reload installs the modules again).
|
|
18
|
+
* A catalog only adds: a name the catalog already holds (the language's, the
|
|
19
|
+
* base catalog's, the app's own, another module's) is refused, whoever brought
|
|
20
|
+
* it. Returns the undo (a dev hot reload installs the modules again).
|
|
24
21
|
*/
|
|
25
22
|
export declare const addBlokComponents: (components: readonly BlokComponentDefinition[], catalog: BlokCatalog) => (() => void);
|
|
26
23
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/renderer/catalog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/renderer/catalog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAC,WAAW,EAAE,uBAAuB,EAAC,MAAM,WAAW,CAAC;AAWpE,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,GAAI,uBAAqB;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAC,sBAE1G,CAAC;AAEF,+GAA+G;AAC/G,eAAO,MAAM,cAAc,QAAO,WAAwD,CAAC;AAE3F,uDAAuD;AACvD,eAAO,MAAM,cAAc,QAAO,WAAuE,CAAC;AAE1G;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,SAAS,uBAAuB,EAAE,EAC9C,SAAS,WAAW,KACnB,CAAC,MAAM,IAAI,CAWb,CAAC"}
|
package/dist/renderer/catalog.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { baseBlokCatalog } from './baseCatalog.js';
|
|
4
|
-
import { moduleShadowsOf } from './modules.js';
|
|
5
4
|
import { blokPlatform } from '../platform.js';
|
|
6
5
|
/**
|
|
7
6
|
* The catalog a blok payload is validated and rendered against: which
|
|
@@ -12,53 +11,30 @@ import { blokPlatform } from '../platform.js';
|
|
|
12
11
|
const BlokCatalogContext = React.createContext(null);
|
|
13
12
|
/** The app's catalog, for every renderer below it. */
|
|
14
13
|
export const BlokCatalogProvider = ({ catalog, children }) => (_jsx(BlokCatalogContext.Provider, { value: catalog, children: children }));
|
|
15
|
-
/** The app's catalog when no provider says otherwise: the platform's, or
|
|
14
|
+
/** The app's catalog when no provider says otherwise: the platform's, or the language's own elements alone. */
|
|
16
15
|
export const appBlokCatalog = () => blokPlatform().catalog ?? baseBlokCatalog;
|
|
17
16
|
/** The catalog the app provides here, or the app's. */
|
|
18
17
|
export const useBlokCatalog = () => React.useContext(BlokCatalogContext) ?? appBlokCatalog();
|
|
19
|
-
/** A component of a global catalog (`ui@1`, `scene@1`): what a module may draw over. */
|
|
20
|
-
const isGlobal = (component) => component?.origin?.includes('@') === true;
|
|
21
18
|
/**
|
|
22
19
|
* Adds components a module brings (`ModuleBuiltins.bloks`) to the catalog, so
|
|
23
20
|
* everything that reads the app's catalog (the renderer, the registrar, the
|
|
24
21
|
* export) offers them. Called once, by the composition root that installs the
|
|
25
22
|
* modules; core never imports a module.
|
|
26
23
|
*
|
|
27
|
-
* A
|
|
28
|
-
* the
|
|
29
|
-
*
|
|
30
|
-
* already holds (base's, the app's own, another module's) is refused, whoever
|
|
31
|
-
* brought it. Returns the undo, which puts a drawn-over component back (a dev
|
|
32
|
-
* hot reload installs the modules again).
|
|
24
|
+
* A catalog only adds: a name the catalog already holds (the language's, the
|
|
25
|
+
* base catalog's, the app's own, another module's) is refused, whoever brought
|
|
26
|
+
* it. Returns the undo (a dev hot reload installs the modules again).
|
|
33
27
|
*/
|
|
34
28
|
export const addBlokComponents = (components, catalog) => {
|
|
35
|
-
const
|
|
36
|
-
const taken = components.filter(component => {
|
|
37
|
-
const held = catalog.components.get(component.name);
|
|
38
|
-
return held !== undefined && (!isGlobal(held) || shadows.has(component.name));
|
|
39
|
-
});
|
|
29
|
+
const taken = components.filter(component => catalog.components.has(component.name));
|
|
40
30
|
if (taken.length > 0) {
|
|
41
31
|
throw new Error(`Blok components already in the catalog: ${taken.map(component => component.name).join(', ')}`);
|
|
42
32
|
}
|
|
43
|
-
const
|
|
44
|
-
for (const component of components) {
|
|
45
|
-
const drawnOver = catalog.components.get(component.name);
|
|
46
|
-
if (drawnOver) {
|
|
47
|
-
previous.set(component.name, drawnOver);
|
|
48
|
-
shadows.add(component.name);
|
|
49
|
-
}
|
|
33
|
+
for (const component of components)
|
|
50
34
|
catalog.components.set(component.name, component);
|
|
51
|
-
}
|
|
52
35
|
return () => {
|
|
53
36
|
for (const component of components) {
|
|
54
|
-
if (catalog.components.get(component.name)
|
|
55
|
-
continue;
|
|
56
|
-
const restored = previous.get(component.name);
|
|
57
|
-
if (restored) {
|
|
58
|
-
catalog.components.set(component.name, restored);
|
|
59
|
-
shadows.delete(component.name);
|
|
60
|
-
}
|
|
61
|
-
else
|
|
37
|
+
if (catalog.components.get(component.name) === component)
|
|
62
38
|
catalog.components.delete(component.name);
|
|
63
39
|
}
|
|
64
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/renderer/catalog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/renderer/catalog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzC;;;;;GAKG;AAEH,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC,CAAC;AAEzE,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAqD,EAAE,EAAE,CAAC,CAC9G,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YAAG,QAAQ,GAA+B,CACtF,CAAC;AAEF,+GAA+G;AAC/G,MAAM,CAAC,MAAM,cAAc,GAAG,GAAgB,EAAE,CAAC,YAAY,EAAE,CAAC,OAAO,IAAI,eAAe,CAAC;AAE3F,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAgB,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,cAAc,EAAE,CAAC;AAE1G;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAA8C,EAC9C,OAAoB,EACN,EAAE;IAChB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACrF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,2CAA2C,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClH,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,UAAU;QAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACtF,OAAO,GAAG,EAAE;QACV,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,SAAS;gBAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
import { type BlokCatalog, type BlokCatalogImplementation, type BlokComponentDefinition, type SpecCatalogJson } from './runtime';
|
|
2
|
+
import type { BlokContextName } from '../spec/vocabulary';
|
|
2
3
|
/**
|
|
3
|
-
* A UI's catalog, declared:
|
|
4
|
+
* A UI's catalog, declared: what it draws, and nothing inferred.
|
|
4
5
|
*
|
|
5
|
-
* - `catalog` is what its renderers draw:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* - `catalog` is what its renderers draw: the language's own elements and every
|
|
7
|
+
* implementation.
|
|
8
|
+
* - `contexts` are the contexts in which it draws the base catalog whole
|
|
9
|
+
* (`HTML`, `SCENE`, `LOGO`): a blok written for the base catalog and drawn in
|
|
10
|
+
* one of them is known to render here.
|
|
11
|
+
* - `claims` are the catalogs it speaks: the base catalog when it draws it
|
|
12
|
+
* whole in at least one context, and each published catalog of its own.
|
|
13
|
+
* - Its own catalogs are part of `catalog`; what it publishes as its app
|
|
14
|
+
* catalog is `ownComponentsOf(catalog)`, which also counts what its modules
|
|
15
|
+
* add later (`addBlokComponents`).
|
|
14
16
|
*/
|
|
15
17
|
export type BlokUi = {
|
|
16
18
|
name: string;
|
|
17
19
|
description: string | null;
|
|
18
20
|
catalog: BlokCatalog;
|
|
19
21
|
implementations: readonly BlokCatalogImplementation[];
|
|
22
|
+
contexts: readonly BlokContextName[];
|
|
20
23
|
claims: readonly string[];
|
|
21
24
|
};
|
|
25
|
+
/** The contexts in which `catalog` draws every component of the base catalog. */
|
|
26
|
+
export declare const baseContextsOf: (catalog: BlokCatalog) => BlokContextName[];
|
|
22
27
|
export declare const declareBlokUi: (declaration: {
|
|
23
28
|
name: string;
|
|
24
29
|
description?: string;
|
|
25
30
|
implements: readonly BlokCatalogImplementation[];
|
|
26
31
|
}) => BlokUi;
|
|
27
32
|
/**
|
|
28
|
-
* What a UI
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* and a global component a module drew over (it is the module's now).
|
|
33
|
+
* What a UI draws beyond the base catalog: every component of its catalog
|
|
34
|
+
* that is neither the language's own nor one of the base catalog's. Its own
|
|
35
|
+
* catalogs' components, and what its modules added since (`addBlokComponents`).
|
|
32
36
|
*/
|
|
33
|
-
export declare const
|
|
37
|
+
export declare const ownComponentsOf: (catalog: BlokCatalog) => BlokComponentDefinition[];
|
|
34
38
|
/**
|
|
35
|
-
* A UI's
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* A UI's app catalog as the spec writes one (`{id, name, version, minor,
|
|
40
|
+
* extends, components}`): what it publishes at `id`, registers with the
|
|
41
|
+
* server, and hands the language (`setAppBlokCatalog(parseSpecCatalog(...))`)
|
|
42
|
+
* so its own parser, checks and editor know the components only it draws.
|
|
38
43
|
*/
|
|
39
|
-
export declare const
|
|
44
|
+
export declare const blokCatalogSpec: (meta: {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
version: number;
|
|
48
|
+
minor?: number;
|
|
49
|
+
extends?: string;
|
|
50
|
+
description: string;
|
|
51
|
+
}, catalog: BlokCatalog) => SpecCatalogJson;
|
|
40
52
|
//# sourceMappingURL=declare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACtD,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAYF,iFAAiF;AACjF,eAAO,MAAM,cAAc,GAAI,SAAS,WAAW,KAAG,eAAe,EAMpE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,aAAa;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAC;CAClD,KAAG,MA2BH,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,uBAAuB,EAG3E,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,EACxG,SAAS,WAAW,KACnB,eAUD,CAAC"}
|
package/dist/renderer/declare.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { baseBlokCatalog } from './baseCatalog.js';
|
|
2
|
-
import { catalogRef, describeBlokComponent, extendBlokCatalog, } from './runtime/index.js';
|
|
2
|
+
import { BASE_CATALOG_ADDRESS, BASE_CATALOG_REF, catalogRef, describeBlokComponent, extendBlokCatalog, } from './runtime/index.js';
|
|
3
|
+
import { baseCatalog } from '../spec/catalogs.js';
|
|
4
|
+
const CONTEXTS = ['HTML', 'SCENE', 'LOGO'];
|
|
5
|
+
/**
|
|
6
|
+
* The context a base component counts towards: its own, and for one that
|
|
7
|
+
* bridges html and another context (`Scene` opens a scene inside html), the
|
|
8
|
+
* other one: a renderer that draws no 3D still draws html whole.
|
|
9
|
+
*/
|
|
10
|
+
const contextOf = (component) => component.context !== 'HTML' ? component.context : (component.childrenContext ?? 'HTML');
|
|
11
|
+
/** The contexts in which `catalog` draws every component of the base catalog. */
|
|
12
|
+
export const baseContextsOf = (catalog) => {
|
|
13
|
+
const components = baseCatalog().components;
|
|
14
|
+
return CONTEXTS.filter(context => {
|
|
15
|
+
const drawn = components.filter(component => !component.inheritsContext && contextOf(component) === context);
|
|
16
|
+
return drawn.length > 0 && drawn.every(component => catalog.components.has(component.name));
|
|
17
|
+
});
|
|
18
|
+
};
|
|
3
19
|
export const declareBlokUi = (declaration) => {
|
|
4
20
|
const implementations = declaration.implements;
|
|
5
21
|
const refs = implementations.map(implementation => catalogRef(implementation.contract));
|
|
@@ -7,33 +23,43 @@ export const declareBlokUi = (declaration) => {
|
|
|
7
23
|
if (twice.length > 0) {
|
|
8
24
|
throw new Error(`${declaration.name} implements ${[...new Set(twice)].join(', ')} twice`);
|
|
9
25
|
}
|
|
26
|
+
const catalog = extendBlokCatalog(baseBlokCatalog, declaration.name, implementations.flatMap(implementation => implementation.components));
|
|
27
|
+
const contexts = baseContextsOf(catalog);
|
|
10
28
|
return {
|
|
11
29
|
name: declaration.name,
|
|
12
30
|
description: declaration.description ?? null,
|
|
13
|
-
catalog
|
|
31
|
+
catalog,
|
|
14
32
|
implementations,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
33
|
+
contexts,
|
|
34
|
+
claims: [
|
|
35
|
+
...(contexts.length > 0 ? [BASE_CATALOG_REF] : []),
|
|
36
|
+
...implementations
|
|
37
|
+
.filter(implementation => implementation.contract.partOf === null && implementation.contract.version !== null && implementation.whole)
|
|
38
|
+
.map(implementation => catalogRef(implementation.contract))
|
|
39
|
+
.sort(),
|
|
40
|
+
],
|
|
19
41
|
};
|
|
20
42
|
};
|
|
21
43
|
/**
|
|
22
|
-
* What a UI
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* and a global component a module drew over (it is the module's now).
|
|
44
|
+
* What a UI draws beyond the base catalog: every component of its catalog
|
|
45
|
+
* that is neither the language's own nor one of the base catalog's. Its own
|
|
46
|
+
* catalogs' components, and what its modules added since (`addBlokComponents`).
|
|
26
47
|
*/
|
|
27
|
-
export const
|
|
48
|
+
export const ownComponentsOf = (catalog) => [...catalog.components.values()].filter(component => catalog.base?.components.get(component.name) !== component && component.origin !== BASE_CATALOG_REF);
|
|
28
49
|
/**
|
|
29
|
-
* A UI's
|
|
30
|
-
*
|
|
31
|
-
*
|
|
50
|
+
* A UI's app catalog as the spec writes one (`{id, name, version, minor,
|
|
51
|
+
* extends, components}`): what it publishes at `id`, registers with the
|
|
52
|
+
* server, and hands the language (`setAppBlokCatalog(parseSpecCatalog(...))`)
|
|
53
|
+
* so its own parser, checks and editor know the components only it draws.
|
|
32
54
|
*/
|
|
33
|
-
export const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
export const blokCatalogSpec = (meta, catalog) => ({
|
|
56
|
+
id: meta.id,
|
|
57
|
+
name: meta.name,
|
|
58
|
+
version: meta.version,
|
|
59
|
+
minor: meta.minor ?? 0,
|
|
60
|
+
extends: meta.extends ?? BASE_CATALOG_ADDRESS,
|
|
61
|
+
description: meta.description,
|
|
62
|
+
components: ownComponentsOf(catalog)
|
|
37
63
|
.map(component => describeBlokComponent(component.name, component))
|
|
38
64
|
.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),
|
|
39
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declare.js","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,iBAAiB,GAKlB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"declare.js","sourceRoot":"","sources":["../../src/renderer/declare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,qBAAqB,EACrB,iBAAiB,GAKlB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AA0B7C,MAAM,QAAQ,GAA+B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,SAAS,GAAG,CAAC,SAA8E,EAAmB,EAAE,CACpH,SAAS,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAA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AE,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC;CAC5F,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAC,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAC,GAAG;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AA8IzF,4GAA4G;AAC5G,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,GAAG,SAAS,KAAG,MAsB1E,CAAC;AAQF,oGAAoG;AACpG,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,KAAG,MAgB9C,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,EAAE,QAAQ,OAAO,EAAE,QAAQ,MAAM,GAAG,SAAS,EAAE,UAAU,OAAO,KAAG,MAazG,CAAC;AA+dF,sDAAsD;AACtD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAW,CAAC;AAExE,8FAA8F;AAC9F,eAAO,MAAM,yBAAyB,QAAO,MAAM,EACiC,CAAC;AAErF,oGAAoG;AACpG,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,qBAAqB,KAAG,kBAcxH,CAAC"}
|
|
@@ -252,6 +252,17 @@ const strTest = (key, test) => args => {
|
|
|
252
252
|
const other = str(args[key]);
|
|
253
253
|
return value !== null && other !== null && test(value, other);
|
|
254
254
|
};
|
|
255
|
+
/** What list.where keeps: the items whose `key` deep-equals `equals`, or is truthy when `equals` is left out. */
|
|
256
|
+
const matching = (args) => {
|
|
257
|
+
const key = optStr(args.key, '', 'key');
|
|
258
|
+
const any = isNull(args.equals);
|
|
259
|
+
return item => {
|
|
260
|
+
const found = readDotted(item, key).value;
|
|
261
|
+
return any ? truthy(found) : deepEqual(found, args.equals);
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
/** Key names as a list holds them. */
|
|
265
|
+
const keyNames = (value) => (list(value) ?? []).filter((key) => typeof key === 'string');
|
|
255
266
|
const listOr = (fallback, operate) => args => {
|
|
256
267
|
const value = list(args.value);
|
|
257
268
|
return value === null ? fallback() : operate(value, args);
|
|
@@ -472,6 +483,10 @@ const IMPLEMENTATIONS = {
|
|
|
472
483
|
})
|
|
473
484
|
.map(entry => entry.item);
|
|
474
485
|
}),
|
|
486
|
+
'list.where': listOr(() => [], (value, args) => value.filter(matching(args))),
|
|
487
|
+
'list.find': listOr(() => null, (value, args) => value.find(matching(args)) ?? null),
|
|
488
|
+
'list.count': listOr(() => 0, (value, args) => value.filter(matching(args)).length),
|
|
489
|
+
'list.concat': args => [...(list(args.value) ?? []), ...(list(args.other) ?? [])],
|
|
475
490
|
'list.range': args => {
|
|
476
491
|
const start = num(args.start);
|
|
477
492
|
const end = num(args.end);
|
|
@@ -503,6 +518,15 @@ const IMPLEMENTATIONS = {
|
|
|
503
518
|
const key = str(args.key);
|
|
504
519
|
return key !== null && Object.prototype.hasOwnProperty.call(value, key);
|
|
505
520
|
}),
|
|
521
|
+
'obj.merge': args => ({ ...(dict(args.value) ?? {}), ...(dict(args.other) ?? {}) }),
|
|
522
|
+
'obj.pick': dictOr(() => ({}), (value, args) => {
|
|
523
|
+
const keys = keyNames(args.keys);
|
|
524
|
+
return Object.fromEntries(Object.entries(value).filter(([key]) => keys.includes(key)));
|
|
525
|
+
}),
|
|
526
|
+
'obj.omit': dictOr(() => ({}), (value, args) => {
|
|
527
|
+
const keys = keyNames(args.keys);
|
|
528
|
+
return Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)));
|
|
529
|
+
}),
|
|
506
530
|
'obj.keys': dictOr(() => [], value => Object.keys(value)),
|
|
507
531
|
'obj.values': dictOr(() => [], value => Object.values(value)),
|
|
508
532
|
'obj.entries': dictOr(() => [], value => Object.entries(value).map(([key, item]) => ({ key, value: item }))),
|
|
@@ -613,6 +637,21 @@ const IMPLEMENTATIONS = {
|
|
|
613
637
|
const end = timeOf(args.end);
|
|
614
638
|
return start === null || end === null ? null : (end - start) / 1000;
|
|
615
639
|
},
|
|
640
|
+
'time.add': args => {
|
|
641
|
+
const start = timeOf(args.value);
|
|
642
|
+
const seconds = num(args.seconds);
|
|
643
|
+
return start === null || seconds === null ? null : new Date(start + seconds * 1000).toISOString();
|
|
644
|
+
},
|
|
645
|
+
'time.before': args => {
|
|
646
|
+
const a = timeOf(args.a);
|
|
647
|
+
const b = timeOf(args.b);
|
|
648
|
+
return a !== null && b !== null && a < b;
|
|
649
|
+
},
|
|
650
|
+
'time.after': args => {
|
|
651
|
+
const a = timeOf(args.a);
|
|
652
|
+
const b = timeOf(args.b);
|
|
653
|
+
return a !== null && b !== null && a > b;
|
|
654
|
+
},
|
|
616
655
|
};
|
|
617
656
|
const build = () => {
|
|
618
657
|
const functions = new Map();
|