@arkitektio/bsx 6.4.0 → 6.6.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/dist/bsx/references.d.ts +2 -0
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +28 -2
- package/dist/bsx/references.js.map +1 -1
- package/dist/ports/engine/defaultRegistry.d.ts.map +1 -1
- package/dist/ports/engine/defaultRegistry.js +2 -0
- package/dist/ports/engine/defaultRegistry.js.map +1 -1
- package/dist/ports/forms/ListSearchField.d.ts.map +1 -1
- package/dist/ports/forms/ListSearchField.js +4 -2
- package/dist/ports/forms/ListSearchField.js.map +1 -1
- package/dist/ports/forms/SearchField.d.ts.map +1 -1
- package/dist/ports/forms/SearchField.js +4 -2
- package/dist/ports/forms/SearchField.js.map +1 -1
- package/dist/ports/forms/StructurePickerControl.d.ts +16 -1
- package/dist/ports/forms/StructurePickerControl.d.ts.map +1 -1
- package/dist/ports/forms/StructurePickerControl.js +26 -3
- package/dist/ports/forms/StructurePickerControl.js.map +1 -1
- package/dist/ports/host.d.ts +6 -0
- package/dist/ports/host.d.ts.map +1 -1
- package/dist/ports/host.js.map +1 -1
- package/dist/ports/rekuest.d.ts +25 -7
- package/dist/ports/rekuest.d.ts.map +1 -1
- package/dist/ports/rekuest.js +1 -0
- package/dist/ports/rekuest.js.map +1 -1
- package/dist/ports/structure/Structure.d.ts.map +1 -1
- package/dist/ports/structure/Structure.js +7 -4
- package/dist/ports/structure/Structure.js.map +1 -1
- package/dist/ports/widgets/custom/ListSearchWidget.d.ts.map +1 -1
- package/dist/ports/widgets/custom/ListSearchWidget.js +3 -2
- package/dist/ports/widgets/custom/ListSearchWidget.js.map +1 -1
- package/dist/ports/widgets/custom/PortBlokWidget.d.ts +30 -0
- package/dist/ports/widgets/custom/PortBlokWidget.d.ts.map +1 -0
- package/dist/ports/widgets/custom/PortBlokWidget.js +210 -0
- package/dist/ports/widgets/custom/PortBlokWidget.js.map +1 -0
- package/dist/ports/widgets/custom/SearchWidget.d.ts.map +1 -1
- package/dist/ports/widgets/custom/SearchWidget.js +3 -2
- package/dist/ports/widgets/custom/SearchWidget.js.map +1 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.d.ts.map +1 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.js +5 -1
- package/dist/ports/widgets/fallbacks/EnumWidget.js.map +1 -1
- package/dist/ports.d.ts +2 -0
- package/dist/ports.d.ts.map +1 -1
- package/dist/ports.js +4 -0
- 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/bloks/control.d.ts +5 -0
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +28 -1
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/renderer/bloks/port/host.d.ts +32 -0
- package/dist/renderer/bloks/port/host.d.ts.map +1 -0
- package/dist/renderer/bloks/port/host.js +14 -0
- package/dist/renderer/bloks/port/host.js.map +1 -0
- package/dist/renderer/bloks/scene/Model.d.ts.map +1 -1
- package/dist/renderer/bloks/scene/Model.js +16 -2
- package/dist/renderer/bloks/scene/Model.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/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/resolution.d.ts +3 -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/types.d.ts +6 -0
- package/dist/renderer/runtime/types.d.ts.map +1 -1
- package/dist/renderer/runtime/types.js.map +1 -1
- package/dist/spec/bsx_v2.json +1285 -181
- package/dist/spec/catalogs/base@4.json +95 -2
- package/dist/spec/catalogs/base@4.json.js +95 -2
- package/dist/spec/vocabulary.d.ts +5 -1
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +4 -1
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +44 -10
- package/dist/spec/vocabulary.json.js +44 -10
- package/dist/vendor/core/ui/name.d.ts +30 -0
- package/dist/vendor/core/ui/name.d.ts.map +1 -0
- package/dist/vendor/core/ui/name.js +40 -0
- package/dist/vendor/core/ui/name.js.map +1 -0
- package/dist/vendor/core/ui/overflow-tooltip.d.ts +20 -0
- package/dist/vendor/core/ui/overflow-tooltip.d.ts.map +1 -0
- package/dist/vendor/core/ui/overflow-tooltip.js +27 -0
- package/dist/vendor/core/ui/overflow-tooltip.js.map +1 -0
- package/dist/vendor/core/ui/select.js +3 -3
- package/dist/vendor/core/ui/select.js.map +1 -1
- package/package.json +1 -1
- package/src/bsx/references.test.ts +1 -1
- package/src/bsx/references.ts +28 -2
- package/src/ports/engine/defaultRegistry.tsx +2 -0
- package/src/ports/forms/ListSearchField.tsx +12 -9
- package/src/ports/forms/SearchField.tsx +9 -3
- package/src/ports/forms/StructurePickerControl.test.tsx +29 -1
- package/src/ports/forms/StructurePickerControl.tsx +38 -4
- package/src/ports/host.tsx +6 -0
- package/src/ports/rekuest.ts +14 -8
- package/src/ports/structure/Structure.tsx +14 -5
- package/src/ports/widgets/custom/ListSearchWidget.tsx +3 -2
- package/src/ports/widgets/custom/PortBlokWidget.test.tsx +88 -0
- package/src/ports/widgets/custom/PortBlokWidget.tsx +268 -0
- package/src/ports/widgets/custom/SearchWidget.tsx +3 -2
- package/src/ports/widgets/fallbacks/EnumWidget.test.tsx +89 -0
- package/src/ports/widgets/fallbacks/EnumWidget.tsx +38 -13
- package/src/ports.ts +4 -0
- package/src/renderer/BlokRenderer.tsx +9 -0
- package/src/renderer/bloks/control.tsx +47 -1
- package/src/renderer/bloks/port/host.tsx +46 -0
- package/src/renderer/bloks/scene/Model.tsx +15 -2
- package/src/renderer/runtime/context.tsx +6 -0
- package/src/renderer/runtime/hooks.ts +1 -0
- package/src/renderer/runtime/resolution.ts +16 -1
- package/src/renderer/runtime/types.ts +6 -0
- package/src/spec/bsx_v2.json +1285 -181
- package/src/spec/catalogs/base@4.json +95 -2
- package/src/spec/spec.test.ts +7 -3
- package/src/spec/vocabulary.json +44 -10
- package/src/spec/vocabulary.ts +9 -2
- package/src/vendor/core/ui/name.tsx +69 -0
- package/src/vendor/core/ui/overflow-tooltip.tsx +59 -0
- package/src/vendor/core/ui/select.tsx +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"vocab": 2,
|
|
3
|
-
"minor":
|
|
3
|
+
"minor": 5,
|
|
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": {
|
|
@@ -8,9 +8,10 @@ export default {
|
|
|
8
8
|
"deps": "deps.<key>: an agent bound to a dependency of the blok, a custom blok or an action.",
|
|
9
9
|
"queries": "queries.<name>: a declared query's record (status, value, error, refetching, fetching_more).",
|
|
10
10
|
"subscriptions": "subscriptions.<name>: a declared subscription's record (status, value, error); value is the latest payload, or the last `keep` payloads.",
|
|
11
|
-
"args": "args.<key>: what the blok is opened on: the item for an agent or custom blok, the task's args for a task or action blok.",
|
|
11
|
+
"args": "args.<key>: what the blok is opened on: the item for an agent or custom blok, the task's args for a task or action blok, the form's other arguments as they are filled in for a port blok (read only).",
|
|
12
12
|
"task": "The task this blok is about: the sending task, or the run. A task record.",
|
|
13
13
|
"assign": "The run an assign blok prepares: assign.given.<key> (true for an argument the caller decided, which is locked), assign.missing (the keys of required arguments still empty) and assign.ready (nothing is missing).",
|
|
14
|
+
"port": "The port a port blok is the widget of: its value (port.value, which a control writes through bind) and what the form knows of it. A port record.",
|
|
14
15
|
"event": "The payload a component hands its callback. Only inside a callback.",
|
|
15
16
|
"viewer": "{user, org, roles} of whoever is looking.",
|
|
16
17
|
"then": "The moment being viewed while time-travelling (an ISO 8601 datetime), null while live. A blok never reads the wall clock: a query passes then as an ordinary variable (variables={at: \"then\"}), <Time> measures relative time from it, and while it is set subscriptions pause (their history query, or the value at travel start, stale)."
|
|
@@ -22,7 +23,7 @@ export default {
|
|
|
22
23
|
"functions": ["cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query"],
|
|
23
24
|
"future": ["mutations"]
|
|
24
25
|
},
|
|
25
|
-
"reserved": ["self", "deps", "queries", "subscriptions", "args", "task", "assign", "event", "viewer", "then", "error", "cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query", "mutations"],
|
|
26
|
+
"reserved": ["self", "deps", "queries", "subscriptions", "args", "task", "assign", "port", "event", "viewer", "then", "error", "cmp", "logic", "math", "str", "list", "obj", "val", "fmt", "time", "ui", "query", "mutations"],
|
|
26
27
|
"agent_segments": {
|
|
27
28
|
"description": "What follows an agent (self or deps.<key>): .<state>.<field> is state, .tasks.<action> the latest task of that action, .assets.<name> one of the agent's assets; deps.<key>.<action>(...) calls it.",
|
|
28
29
|
"tasks": "tasks",
|
|
@@ -61,6 +62,13 @@ export default {
|
|
|
61
62
|
"roots": ["self", "deps", "args", "assign", "queries", "subscriptions", "viewer"],
|
|
62
63
|
"locals": true,
|
|
63
64
|
"contexts": ["PANEL", "SCENE"]
|
|
65
|
+
},
|
|
66
|
+
"port": {
|
|
67
|
+
"description": "A port's own widget, declared with the port: drawn in the action's form where the port's control would be. It is a field of that form: it reads the port, the form's other arguments as args and the state of the agents a run would get, and writes the port's value and nothing else. It calls no agent.",
|
|
68
|
+
"roots": ["self", "deps", "args", "port", "queries", "subscriptions", "viewer"],
|
|
69
|
+
"locals": true,
|
|
70
|
+
"contexts": ["PANEL"],
|
|
71
|
+
"calls": false
|
|
64
72
|
}
|
|
65
73
|
},
|
|
66
74
|
"contexts": {
|
|
@@ -72,7 +80,7 @@ export default {
|
|
|
72
80
|
"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
81
|
"component": "Blok",
|
|
74
82
|
"attributes": {
|
|
75
|
-
"kind": "Required: agent, custom, task, action or
|
|
83
|
+
"kind": "Required: agent, custom, task, action, assign or port (a row of kinds).",
|
|
76
84
|
"context": "Required: panel, scene or logo.",
|
|
77
85
|
"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
86
|
"chrome": "\"none\": the host draws none of its own interface around the blok (panel and scene only)."
|
|
@@ -152,6 +160,26 @@ export default {
|
|
|
152
160
|
{"key": "blocked", "kind": "STRING", "nullable": true, "description": "Why the run cannot start now, as a sentence (a dependency is not met, no agent fits); null when it can."}
|
|
153
161
|
]
|
|
154
162
|
},
|
|
163
|
+
"port": {
|
|
164
|
+
"description": "What a port blok knows of the port it draws: its value, what the port declares, and where it stands in the form. Everything but value is the form's to say: a port blok sets no error and no flag.",
|
|
165
|
+
"fields": [
|
|
166
|
+
{"key": "value", "kind": "ANY", "nullable": true, "description": "The port's value as the form holds it, typed as the port; null while nothing is given. The one thing a port blok writes: a control through bind={port.value}, a callback with port.set(...)."},
|
|
167
|
+
{"key": "key", "kind": "STRING", "description": "The port's key."},
|
|
168
|
+
{"key": "label", "kind": "STRING", "nullable": true, "description": "What the form calls the port."},
|
|
169
|
+
{"key": "description", "kind": "STRING", "nullable": true},
|
|
170
|
+
{"key": "kind", "kind": "STRING", "description": "The port's kind (FLOAT, STRUCTURE, ...)."},
|
|
171
|
+
{"key": "identifier", "kind": "STRING", "nullable": true, "description": "The structure's identifier, for a STRUCTURE port."},
|
|
172
|
+
{"key": "nullable", "kind": "BOOL", "description": "Whether the port may be left empty."},
|
|
173
|
+
{"key": "default", "kind": "ANY", "nullable": true, "description": "What port.reset() goes back to."},
|
|
174
|
+
{"key": "choices", "kind": "LIST", "description": "The choices the port declares, each {value, label, description}; empty when it declares none."},
|
|
175
|
+
{"key": "unit", "kind": "STRING", "nullable": true, "description": "The unit a QUANTITY port's value is in."},
|
|
176
|
+
{"key": "editable", "kind": "BOOL", "description": "False where the value is only shown: the caller decided it, the form is locked or sent. A control bound to the port is then disabled, and port.set does nothing."},
|
|
177
|
+
{"key": "error", "kind": "STRING", "nullable": true, "description": "What the form says is wrong with the value, by the port's own rules (required, its kind, its validators); null when nothing is, or nothing was checked yet."},
|
|
178
|
+
{"key": "invalid", "kind": "BOOL", "description": "True while error is set."},
|
|
179
|
+
{"key": "touched", "kind": "BOOL", "description": "True once the viewer left the field (a bound control lost focus, or port.touch())."},
|
|
180
|
+
{"key": "dirty", "kind": "BOOL", "description": "True once the value differs from what the form opened with."}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
155
183
|
"viewer": {
|
|
156
184
|
"description": "Exposes nothing beyond what the viewer's own token says.",
|
|
157
185
|
"fields": [
|
|
@@ -187,7 +215,7 @@ export default {
|
|
|
187
215
|
]
|
|
188
216
|
},
|
|
189
217
|
"functions": {
|
|
190
|
-
"description": "Pure functions by namespace, snake_case. Positional arguments map onto params in order. `lazy`: arguments are read only as needed. `effect`: allowed only as a callback's one thing (ui.*, task.*, assign.start, query.*). `command`: an effect that changes the world (it acts on a task or starts one, and is recorded with it); an effect without it only changes what the viewer sees. A blok does nothing else: every other function is pure. `sees_status`: sees pending/failed instead of suspending. No function reads the wall clock. `null` says what the function does with a null argument (known absence); a missing path reads as null.",
|
|
218
|
+
"description": "Pure functions by namespace, snake_case. Positional arguments map onto params in order. `lazy`: arguments are read only as needed. `effect`: allowed only as a callback's one thing (ui.*, task.*, assign.start, port.*, query.*). `needs`: the root a blok's kind must read to hold the effect (port.set needs port). `command`: an effect that changes the world (it acts on a task or starts one, and is recorded with it); an effect without it only changes what the viewer sees. A blok does nothing else: every other function is pure. `sees_status`: sees pending/failed instead of suspending. No function reads the wall clock. `null` says what the function does with a null argument (known absence); a missing path reads as null.",
|
|
191
219
|
"cmp.eq": {"params": [["a", "ANY"], ["b", "ANY"]], "returns": "BOOL", "description": "Deep JSON equality.", "null": "null equals only null"},
|
|
192
220
|
"cmp.ne": {"params": [["a", "ANY"], ["b", "ANY"]], "returns": "BOOL", "description": "Not deep-equal.", "null": "null equals only null"},
|
|
193
221
|
"cmp.gt": {"params": [["a", "ANY"], ["b", "ANY"]], "returns": "BOOL", "description": "a > b, numbers or strings.", "null": "false"},
|
|
@@ -313,6 +341,10 @@ export default {
|
|
|
313
341
|
"task.step": {"params": [], "returns": "ANY", "effect": true, "command": true, "task_operation": true, "description": "Resumes the run `task` is about until its next breakpoint. Refused while `task.can.step` is false, and while the blok shows the past. Counts as a task operation.", "null": "takes no arguments"},
|
|
314
342
|
"task.interrupt": {"params": [], "returns": "ANY", "effect": true, "command": true, "task_operation": true, "description": "Interrupts the run `task` is about: stopped at once, without waiting for it to wind down. Refused while `task.can.interrupt` is false, and while the blok shows the past. Counts as a task operation.", "null": "takes no arguments"},
|
|
315
343
|
"assign.start": {"params": [], "returns": "ANY", "effect": true, "command": true, "description": "Starts the run an assign blok prepares, with the arguments as they are filled in and the agents the blok was shown (deps) pinned. An assign blok only.", "null": "starts the run"},
|
|
344
|
+
"port.set": {"params": [["value", "ANY"]], "returns": "ANY", "effect": true, "needs": "port", "description": "Sets the port's value, as a control bound to it would: the form marks it dirty and checks it. A port blok only.", "null": "sets the port to empty, as port.clear() does"},
|
|
345
|
+
"port.clear": {"params": [], "returns": "ANY", "effect": true, "needs": "port", "description": "Empties the port: nothing is given for it. A port blok only.", "null": "takes no arguments"},
|
|
346
|
+
"port.reset": {"params": [], "returns": "ANY", "effect": true, "needs": "port", "description": "Puts the port back to what the form opened with (port.default when nothing was given), and clears touched and dirty. A port blok only.", "null": "takes no arguments"},
|
|
347
|
+
"port.touch": {"params": [], "returns": "ANY", "effect": true, "needs": "port", "description": "Says the viewer left the field: what a bound control says itself when it loses focus, for a control drawn by hand. A port blok only.", "null": "takes no arguments"},
|
|
316
348
|
"query.refetch": {"params": [["query", "STRING"]], "returns": "ANY", "effect": true, "description": "Re-reads the declared query named by the literal `query`; never suspends, queries.<name>.refetching is true meanwhile. BSX writes it queries.<name>.refetch().", "null": "refused: the query is named by a literal"},
|
|
317
349
|
"query.fetch_more": {"params": [["query", "STRING"], ["variables", "DICT", false]], "returns": "ANY", "effect": true, "description": "Reads the next page of the declared query named by the literal `query`, its variables overridden by `variables`, and appends the page's list at the query's `more` field to what is shown; queries.<name>.fetching_more is true meanwhile. BSX writes it queries.<name>.fetch_more(name: value, ...). Refused on a query without `more`.", "null": "refused: the query is named by a literal; null variables fetch with the query's own"}
|
|
318
350
|
},
|
|
@@ -326,8 +358,8 @@ export default {
|
|
|
326
358
|
"calls": {
|
|
327
359
|
"description": "What a prop or an argument may hold besides a literal, a path or a util call.",
|
|
328
360
|
"kinds": {
|
|
329
|
-
"agent_call": "A task call: self.<action>(...) or deps.<key>.<action>(...), only as a callback's one thing, optionally named with `into <name>` (stored as the prop's declares_value).",
|
|
330
|
-
"util_call": "A pure function, or an effect (ui.copy, task.answer, assign.start, query.refetch, query.fetch_more) as a callback's one thing."
|
|
361
|
+
"agent_call": "A task call: self.<action>(...) or deps.<key>.<action>(...), only as a callback's one thing, optionally named with `into <name>` (stored as the prop's declares_value). A kind that says calls: false (a port blok) holds none.",
|
|
362
|
+
"util_call": "A pure function, or an effect (ui.copy, task.answer, assign.start, port.set, query.refetch, query.fetch_more) as a callback's one thing."
|
|
331
363
|
},
|
|
332
364
|
"reserved_kinds": {
|
|
333
365
|
"service_call": "Reserved for mutations, should they ever exist. Renderers refuse a call kind they do not know."
|
|
@@ -401,7 +433,7 @@ export default {
|
|
|
401
433
|
"name": "^[A-Za-z_][A-Za-z0-9_.-]*$",
|
|
402
434
|
"host_parts": {
|
|
403
435
|
"description": "Parts of the host's own interface a blok may place itself: placing one anywhere in the tree claims it, and the host then draws none of its own. The claim is read off the stored tree, so a part inside an inactive <if> still claims it (part.conditional). What a blok does not place, the host still draws, unless its root says chrome=\"none\".",
|
|
404
|
-
"parts": ["args", "arg", "deps", "dep", "ask", "returns", "status", "timeline"]
|
|
436
|
+
"parts": ["args", "arg", "deps", "dep", "ask", "returns", "status", "timeline", "label", "description", "message", "control", "field"]
|
|
405
437
|
}
|
|
406
438
|
},
|
|
407
439
|
"classes": {
|
|
@@ -444,7 +476,7 @@ export default {
|
|
|
444
476
|
"callback.positional": {"level": "error", "message": "{call}: a task call names its arguments (name: value)."},
|
|
445
477
|
"callback.into": {"level": "error", "message": "into names the record of a task call: `<call> into <name>`.", "hint": "Write `deps.<key>.<action>(name: value) into run`, then read run.running, run.returns.<port>."},
|
|
446
478
|
"callback.not_callback": {"level": "error", "message": "{key} of <{component}> is not a callback prop, so it cannot hold {what}.", "hint": "Use a callback prop of <{component}> (the catalog lists them as CALLBACK), or compute {key} without a call."},
|
|
447
|
-
"callback.unbound": {"level": "error", "message": "{key} of <{component}> is a callback prop: it holds one task call or one effect (queries.<name>.refetch(), queries.<name>.fetch_more(...), ui.copy, task.answer, assign.start).", "hint": "Give {key} a task call (deps.<key>.<action>(name: value)) or one effect, not a value."},
|
|
479
|
+
"callback.unbound": {"level": "error", "message": "{key} of <{component}> is a callback prop: it holds one task call or one effect (queries.<name>.refetch(), queries.<name>.fetch_more(...), ui.copy, task.answer, assign.start, port.set).", "hint": "Give {key} a task call (deps.<key>.<action>(name: value)) or one effect, not a value."},
|
|
448
480
|
"callback.event_field": {"level": "error", "message": "event has no field {field!r} in {key} of <{component}> (its fields: {fields}).", "hint": "Read one of the fields listed for {key}: {fields}."},
|
|
449
481
|
"roots.unknown": {"level": "error", "message": "{path} reads {root!r}, which is no root, local, loop variable or record of this blok.", "hint": "Read a root this blok has (deps.<key>, args.<key>, queries.<name>, ...), a declared local, a foreach let or index, or an into record."},
|
|
450
482
|
"roots.not_in_kind": {"level": "error", "message": "{path}: a{n} {kind} blok has no {root!r} (it reads {roots}).", "hint": "Read one of {roots} instead."},
|
|
@@ -462,6 +494,7 @@ export default {
|
|
|
462
494
|
"args.unknown": {"level": "error", "message": "{path} reads args.{key}, which the blok does not declare (declared: {keys}).", "hint": "Read one of the declared args, or declare args.{key} (only when the user asks what the blok is opened for)."},
|
|
463
495
|
"into.twice": {"level": "error", "message": "{name!r} is written by two calls: {first} and {second}. Each call site needs a record of its own."},
|
|
464
496
|
"local.unknown": {"level": "error", "message": "bind={{{path}}} writes {root!r}, which is no declared local.", "hint": "Declare {root!r} in locals (its default, or null), then bind it."},
|
|
497
|
+
"port.bind": {"level": "error", "message": "bind={{{path}}}: a port blok writes port.value and nothing else of its port.", "hint": "Write bind={{port.value}}; what the form knows of the port (its label, its error) is the form's to say."},
|
|
465
498
|
"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."},
|
|
466
499
|
"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."},
|
|
467
500
|
"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)."},
|
|
@@ -494,11 +527,12 @@ export default {
|
|
|
494
527
|
"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}})."},
|
|
495
528
|
"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."},
|
|
496
529
|
"blok.root": {"level": "error", "message": "A blok is one <Blok kind=... context=...> element, not <{component}>.", "hint": "Wrap it: <Blok kind=\"agent\" context=\"panel\">...</Blok>."},
|
|
497
|
-
"blok.attribute": {"level": "error", "message": "<Blok> {problem}.", "hint": "Write kind=\"agent|custom|task|action|assign\" and context=\"panel|scene|logo\" as literals."},
|
|
530
|
+
"blok.attribute": {"level": "error", "message": "<Blok> {problem}.", "hint": "Write kind=\"agent|custom|task|action|assign|port\" and context=\"panel|scene|logo\" as literals."},
|
|
498
531
|
"blok.content": {"level": "error", "message": "A {context} blok holds {expected} beside its declarations, not {found}.", "hint": "Put everything inside one {expected}."},
|
|
499
532
|
"context.kind": {"level": "error", "message": "A{n} {kind} blok is drawn in {contexts}, not {context}."},
|
|
500
533
|
"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."},
|
|
501
534
|
"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."},
|
|
535
|
+
"calls.not_in_kind": {"level": "error", "message": "{path}: a{n} {kind} blok calls no agent.", "hint": "A port blok is a field of a form: read the agent's state and write the port (port.set(...), bind={{port.value}}). What starts a task belongs in the action's assign blok."},
|
|
502
536
|
"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=[...]."},
|
|
503
537
|
"logo.complexity": {"level": "error", "message": "{detail}"},
|
|
504
538
|
"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."},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Where a long name is cut so both ends stay readable: the tail is the last
|
|
4
|
+
* `keep` characters before the extension plus the extension, the head is the
|
|
5
|
+
* rest. A name too short to be worth cutting comes back whole, as the head.
|
|
6
|
+
*/
|
|
7
|
+
export declare const splitName: (name: string, keep?: number) => {
|
|
8
|
+
head: string;
|
|
9
|
+
tail: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A name that keeps its start AND its end when it does not fit: the head
|
|
13
|
+
* gives way with an ellipsis, the tail (the last characters and the
|
|
14
|
+
* extension) never shrinks. Plain CSS, nothing is measured. When the name
|
|
15
|
+
* fits it reads as ordinary text; copying copies it whole.
|
|
16
|
+
*
|
|
17
|
+
* The head carries `data-overflow-text`, so inside an `OverflowTooltip` the
|
|
18
|
+
* tooltip opens exactly when the name is cut; elsewhere pass `title`.
|
|
19
|
+
* Like `truncate`, it needs `min-w-0` on every flex ancestor up to the one
|
|
20
|
+
* with a real width.
|
|
21
|
+
*/
|
|
22
|
+
declare function Name({ children, keep, inline, className, ...props }: Omit<React.ComponentProps<"span">, "children"> & {
|
|
23
|
+
children: string;
|
|
24
|
+
/** Characters kept before the extension (default 8). */
|
|
25
|
+
keep?: number;
|
|
26
|
+
/** Sit in a line of text instead of filling the row. */
|
|
27
|
+
inline?: boolean;
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
export { Name };
|
|
30
|
+
//# sourceMappingURL=name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../../../src/vendor/core/ui/name.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,aAAQ,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAW9E,CAAA;AAED;;;;;;;;;;GAUG;AACH,iBAAS,IAAI,CAAC,EACZ,QAAQ,EACR,IAAI,EACJ,MAAc,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,qBAkBA;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../util/utils.js";
|
|
4
|
+
/** `.tiff`, `.ome.tiff`, `.tar.gz`: up to two short alphanumeric suffixes. */
|
|
5
|
+
const EXTENSION = /(?:\.[A-Za-z0-9]{1,5}){1,2}$/;
|
|
6
|
+
/**
|
|
7
|
+
* Where a long name is cut so both ends stay readable: the tail is the last
|
|
8
|
+
* `keep` characters before the extension plus the extension, the head is the
|
|
9
|
+
* rest. A name too short to be worth cutting comes back whole, as the head.
|
|
10
|
+
*/
|
|
11
|
+
export const splitName = (name, keep = 8) => {
|
|
12
|
+
const match = EXTENSION.exec(name);
|
|
13
|
+
// A dotfile (`.gitignore`) is all name, no extension.
|
|
14
|
+
const extension = match && match.index > 0 ? match[0] : "";
|
|
15
|
+
// By code point, so a surrogate pair is never cut in half.
|
|
16
|
+
const stem = Array.from(name.slice(0, name.length - extension.length));
|
|
17
|
+
if (keep <= 0 || stem.length <= keep * 2)
|
|
18
|
+
return { head: name, tail: "" };
|
|
19
|
+
return {
|
|
20
|
+
head: stem.slice(0, stem.length - keep).join(""),
|
|
21
|
+
tail: stem.slice(stem.length - keep).join("") + extension,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A name that keeps its start AND its end when it does not fit: the head
|
|
26
|
+
* gives way with an ellipsis, the tail (the last characters and the
|
|
27
|
+
* extension) never shrinks. Plain CSS, nothing is measured. When the name
|
|
28
|
+
* fits it reads as ordinary text; copying copies it whole.
|
|
29
|
+
*
|
|
30
|
+
* The head carries `data-overflow-text`, so inside an `OverflowTooltip` the
|
|
31
|
+
* tooltip opens exactly when the name is cut; elsewhere pass `title`.
|
|
32
|
+
* Like `truncate`, it needs `min-w-0` on every flex ancestor up to the one
|
|
33
|
+
* with a real width.
|
|
34
|
+
*/
|
|
35
|
+
function Name({ children, keep, inline = false, className, ...props }) {
|
|
36
|
+
const { head, tail } = splitName(children, keep);
|
|
37
|
+
return (_jsxs("span", { "data-slot": "name", className: cn(inline ? "inline-flex align-bottom" : "flex", "min-w-0 max-w-full overflow-hidden", className), ...props, children: [_jsx("span", { "data-overflow-text": "", className: "min-w-0 truncate whitespace-pre", children: head }), tail && _jsx("span", { className: "shrink-0 whitespace-pre", children: tail })] }));
|
|
38
|
+
}
|
|
39
|
+
export { Name };
|
|
40
|
+
//# sourceMappingURL=name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/name.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAElC,8EAA8E;AAC9E,MAAM,SAAS,GAAG,8BAA8B,CAAA;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,IAAI,GAAG,CAAC,EAAkC,EAAE;IAClF,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,sDAAsD;IACtD,MAAM,SAAS,GAAG,KAAK,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,C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"react";
|
|
2
|
+
import { TooltipContent } from "./tooltip";
|
|
3
|
+
/** Mark the text an `OverflowTooltip` watches: it opens when this is cut off. */
|
|
4
|
+
export declare const OVERFLOW_TEXT: {
|
|
5
|
+
readonly "data-overflow-text": "";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A tooltip for text that may not fit: it opens only when an element marked
|
|
9
|
+
* with `OVERFLOW_TEXT` inside the trigger is cut off, or always when `always`
|
|
10
|
+
* (say, a description the trigger has no room for). The trigger is the child.
|
|
11
|
+
*/
|
|
12
|
+
declare function OverflowTooltip({ content, always, side, className, children, }: {
|
|
13
|
+
content: React.ReactNode;
|
|
14
|
+
always?: boolean;
|
|
15
|
+
side?: React.ComponentProps<typeof TooltipContent>["side"];
|
|
16
|
+
className?: string;
|
|
17
|
+
children: React.ReactElement;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
export { OverflowTooltip };
|
|
20
|
+
//# sourceMappingURL=overflow-tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overflow-tooltip.d.ts","sourceRoot":"","sources":["../../../../src/vendor/core/ui/overflow-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAW,cAAc,EAAkB,MAAM,WAAW,CAAA;AAEnE,iFAAiF;AACjF,eAAO,MAAM,aAAa;;CAAwC,CAAA;AAWlE;;;;GAIG;AACH,iBAAS,eAAe,CAAC,EACvB,OAAO,EACP,MAAc,EACd,IAAI,EACJ,SAAS,EACT,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAA;CAC7B,qBAsBA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../util/utils.js";
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
5
|
+
/** Mark the text an `OverflowTooltip` watches: it opens when this is cut off. */
|
|
6
|
+
export const OVERFLOW_TEXT = { "data-overflow-text": "" };
|
|
7
|
+
const isCutOff = (el) => el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1;
|
|
8
|
+
const hasOverflow = (root) => {
|
|
9
|
+
if (!root)
|
|
10
|
+
return false;
|
|
11
|
+
if (root.matches("[data-overflow-text]") && isCutOff(root))
|
|
12
|
+
return true;
|
|
13
|
+
return Array.from(root.querySelectorAll("[data-overflow-text]")).some(isCutOff);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A tooltip for text that may not fit: it opens only when an element marked
|
|
17
|
+
* with `OVERFLOW_TEXT` inside the trigger is cut off, or always when `always`
|
|
18
|
+
* (say, a description the trigger has no room for). The trigger is the child.
|
|
19
|
+
*/
|
|
20
|
+
function OverflowTooltip({ content, always = false, side, className, children, }) {
|
|
21
|
+
const triggerRef = React.useRef(null);
|
|
22
|
+
const [open, setOpen] = React.useState(false);
|
|
23
|
+
const onOpenChange = React.useCallback((next) => setOpen(next && (always || hasOverflow(triggerRef.current))), [always]);
|
|
24
|
+
return (_jsxs(Tooltip, { open: open, onOpenChange: onOpenChange, children: [_jsx(TooltipTrigger, { asChild: true, ref: triggerRef, children: children }), _jsx(TooltipContent, { side: side, className: cn("whitespace-normal break-words", className), children: content })] }));
|
|
25
|
+
}
|
|
26
|
+
export { OverflowTooltip };
|
|
27
|
+
//# sourceMappingURL=overflow-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|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C,IAAI,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAC/E,CAAC,MAAM,CAAC,CACT,CAAA;IAED,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,aAC7C,KAAC,cAAc,IAAC,OAAO,QAAC,GAAG,EAAE,UAAU,YACpC,QAAQ,GACM,EACjB,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,YAExD,OAAO,GACO,IACT,CACX,CAAA;AACH,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -14,17 +14,17 @@ function SelectValue({ ...props }) {
|
|
|
14
14
|
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
15
15
|
}
|
|
16
16
|
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
17
|
-
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:
|
|
17
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:overflow-hidden *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "text-muted-foreground size-3.5 pointer-events-none" }) })] }));
|
|
18
18
|
}
|
|
19
19
|
function SelectContent({ className, children, position = "popper", align = "center", ...props }) {
|
|
20
20
|
const chromeZoom = useChromeZoomClass();
|
|
21
|
-
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn(chromeZoom, "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { "data-position": position, className: cn("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]", position === "popper" && ""), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
21
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn(chromeZoom, "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 max-w-(--radix-select-content-available-width) rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { "data-position": position, className: cn("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]", position === "popper" && ""), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
22
|
}
|
|
23
23
|
function SelectLabel({ className, ...props }) {
|
|
24
24
|
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn("text-muted-foreground px-2 py-1.5 text-xs", className), ...props }));
|
|
25
25
|
}
|
|
26
26
|
function SelectItem({ className, children, ...props }) {
|
|
27
|
-
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md
|
|
27
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1 pl-2 pr-8 break-words text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "pointer-events-none" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
28
28
|
}
|
|
29
29
|
function SelectSeparator({ className, ...props }) {
|
|
30
30
|
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn("bg-border/50 -mx-1 my-1 h-px pointer-events-none", className), ...props }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAExE,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KACvC,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,SAAS,EACT,IAAI,GAAG,SAAS,EAChB,QAAQ,EACR,GAAG,KAAK,EAGT;IACC,OAAO,CACL,MAAC,eAAe,CAAC,OAAO,iBACZ,gBAAgB,eACf,IAAI,EACf,SAAS,EAAE,EAAE,CACX,
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/vendor/core/ui/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAExE,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EAC2C;IACnD,OAAO,CACL,KAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KACvC,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,EACrB,SAAS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+10,7 @@ import type {BlokComponentNode} from '../renderer/runtime/types';
|
|
|
10
10
|
/** Where a corpus case is checked: the spec's `mount`, and whether a catalog is read at all. */
|
|
11
11
|
type CorpusMount = Omit<BlokCheckScope, 'catalog'> & {catalog: boolean};
|
|
12
12
|
|
|
13
|
-
const scopeOf = (mount: CorpusMount): BlokCheckScope => ({kinds: mount.kinds, dependencies: mount.dependencies, args: mount.args});
|
|
13
|
+
const scopeOf = (mount: CorpusMount): BlokCheckScope => ({kinds: mount.kinds, dependencies: mount.dependencies, args: mount.args, port: mount.port ?? null});
|
|
14
14
|
type CheckedCase = {
|
|
15
15
|
name: string;
|
|
16
16
|
source: string;
|
package/src/bsx/references.ts
CHANGED
|
@@ -177,6 +177,8 @@ export type BlokCheckScope = {
|
|
|
177
177
|
assets?: readonly string[] | null;
|
|
178
178
|
/** Preview data, for the logo's foreach limit. */
|
|
179
179
|
demo?: {deps?: unknown; args?: unknown; task?: unknown} | null;
|
|
180
|
+
/** The port a port blok is the widget of, as a match: what `port.value` is typed as. Null (or absent) leaves the value open. */
|
|
181
|
+
port?: BlokPortMatch | null;
|
|
180
182
|
};
|
|
181
183
|
|
|
182
184
|
/** A blok checked on its own, mounted nowhere: what an editor checks from the source alone. */
|
|
@@ -206,6 +208,10 @@ const DEPENDENCY_KEY_PROPS = new Set(['Placed.dep', 'Route.through']);
|
|
|
206
208
|
/** The kinds that have a run's dependencies: an action's own bloks, for a run and for starting one. */
|
|
207
209
|
const RUN_KINDS: readonly string[] = ['action', 'assign'];
|
|
208
210
|
const ASSIGN_KIND = 'assign';
|
|
211
|
+
/** The root of a port blok: the port it is the widget of. */
|
|
212
|
+
const PORT_ROOT = 'port';
|
|
213
|
+
/** The one field of `port` a control writes. */
|
|
214
|
+
const PORT_VALUE_FIELD = 'value';
|
|
209
215
|
const ASK_COMPONENT = 'ask';
|
|
210
216
|
const CHROME_NONE = 'none';
|
|
211
217
|
/** The language's elements whose children do not always show: a host part inside one still claims its slot. */
|
|
@@ -382,7 +388,7 @@ const DIGITS = /^[0-9]+$/;
|
|
|
382
388
|
* - an agent blok has none: ``agent bloks read only `self` ``.
|
|
383
389
|
*/
|
|
384
390
|
export const dependencyHint = (key: string, kind: BlokKind): string => {
|
|
385
|
-
if (kind === 'action' || kind === 'assign') return `add a dependency parameter \`${key}\` to the action`;
|
|
391
|
+
if (kind === 'action' || kind === 'assign' || kind === 'port') return `add a dependency parameter \`${key}\` to the action`;
|
|
386
392
|
if (kind === 'agent') return 'agent bloks read only `self`';
|
|
387
393
|
return `dependencies=[AgentDependencyInput(key="${key}")]`;
|
|
388
394
|
};
|
|
@@ -854,6 +860,11 @@ class Checker {
|
|
|
854
860
|
if (effect !== undefined && vocabulary.functions.get(effect)?.taskOperation && !this.kind.roots.includes('task')) {
|
|
855
861
|
this.notInKind(node.id, effect, 'task', prop.key);
|
|
856
862
|
}
|
|
863
|
+
// An effect that is a root's own (port.set) belongs to the kinds that read that root.
|
|
864
|
+
const needs = effect === undefined ? null : (vocabulary.functions.get(effect)?.needs ?? null);
|
|
865
|
+
if (effect !== undefined && needs !== null && !this.kind.roots.includes(needs)) {
|
|
866
|
+
this.notInKind(node.id, effect, needs, prop.key);
|
|
867
|
+
}
|
|
857
868
|
if (prop.key === BIND_PROP) {
|
|
858
869
|
const path = prop.dynamic_value?.path ?? null;
|
|
859
870
|
if (path === null) {
|
|
@@ -861,7 +872,11 @@ class Checker {
|
|
|
861
872
|
} else {
|
|
862
873
|
const root = path.split('.')[0];
|
|
863
874
|
const binding = scope.get(root);
|
|
864
|
-
if (!
|
|
875
|
+
if (root === PORT_ROOT && !scope.has(root) && this.kind.roots.includes(PORT_ROOT)) {
|
|
876
|
+
// The one thing besides a local a control writes: the value of the port a port blok
|
|
877
|
+
// stands for (and what is below it), never what the form says of it.
|
|
878
|
+
if (path.split('.')[1] !== PORT_VALUE_FIELD) this.add('port.bind', node.id, {path}, prop.key);
|
|
879
|
+
} else if (!isLocalBinding(binding)) this.add('local.unknown', node.id, {path, root}, prop.key);
|
|
865
880
|
else {
|
|
866
881
|
this.boundLocals.add(binding.node);
|
|
867
882
|
if (propSpec) this.checkBindKind(node, propSpec.kind, binding, path);
|
|
@@ -945,6 +960,11 @@ class Checker {
|
|
|
945
960
|
private visitAgentCall(call: BlokAgentCall, where: Where, scope: Scope): void {
|
|
946
961
|
const owner = whereText(where);
|
|
947
962
|
const action = actionKeyFor(call);
|
|
963
|
+
if (!this.kind.calls) {
|
|
964
|
+
const called = call.dependency === 'self' ? `self.${action}(...)` : `deps.${call.dependency}.${action}(...)`;
|
|
965
|
+
this.add('calls.not_in_kind', where.node.id, {path: called, n: article(this.kindName), kind: this.kindName}, where.key);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
948
968
|
if (call.dependency === 'self') {
|
|
949
969
|
if (!this.kind.roots.includes('self')) {
|
|
950
970
|
this.notInKind(where.node.id, `self.${action}(...)`, 'self', where.key);
|
|
@@ -1198,6 +1218,12 @@ class Checker {
|
|
|
1198
1218
|
return {key: rest[1], kind: 'BOOL'};
|
|
1199
1219
|
}
|
|
1200
1220
|
return this.descend(recordMatch('assign', vocabulary.records.assign.fields), rest, path, nodeId, propKey);
|
|
1221
|
+
case PORT_ROOT: {
|
|
1222
|
+
// `port.value` is the port's own type where the mount says it; the rest is the record.
|
|
1223
|
+
const value = this.scope.port ?? null;
|
|
1224
|
+
const overrides = value === null ? undefined : {[PORT_VALUE_FIELD]: {...value, at: null, nullable: true}};
|
|
1225
|
+
return this.descend(recordMatch(PORT_ROOT, vocabulary.records.port.fields, overrides), rest, path, nodeId, propKey);
|
|
1226
|
+
}
|
|
1201
1227
|
case 'task':
|
|
1202
1228
|
this.checkReturns(path, rest, nodeId, propKey);
|
|
1203
1229
|
return this.descend(taskRecordMatch('task'), rest, path, nodeId, propKey);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChoicesWidget } from "../widgets/custom/ChoicesWidget";
|
|
2
2
|
import { CustomWidget } from "../widgets/custom/CustomWidget";
|
|
3
|
+
import { PortBlokWidget } from "../widgets/custom/PortBlokWidget";
|
|
3
4
|
import { ProxyWidget } from "../widgets/custom/ProxyWidget";
|
|
4
5
|
import { SearchWidget } from "../widgets/custom/SearchWidget";
|
|
5
6
|
import { SliderWidget } from "../widgets/custom/SliderWidget";
|
|
@@ -90,6 +91,7 @@ export const createWidgetRegistry = (options: { canPick?: (identifier: string) =
|
|
|
90
91
|
registry.registerInputWidget("ProxyWidget", ProxyWidget);
|
|
91
92
|
registry.registerInputWidget("StringAssignWidget", StringWidget);
|
|
92
93
|
registry.registerInputWidget("CustomAssignWidget", CustomWidget);
|
|
94
|
+
registry.registerInputWidget("BlokAssignWidget", PortBlokWidget);
|
|
93
95
|
|
|
94
96
|
registry.registerReturnWidgetFallback(PortKind.Int, IntReturnWidget);
|
|
95
97
|
registry.registerReturnWidgetFallback(PortKind.Float, FloatReturnWidget);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CheckIcon } from "lucide-react";
|
|
2
|
+
import { Name } from "../../vendor/core/ui/name";
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
Command,
|
|
@@ -19,6 +20,7 @@ import { cn, notEmpty } from "../../vendor/core/util/utils";
|
|
|
19
20
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
20
21
|
import { useFormContext } from "react-hook-form";
|
|
21
22
|
import { Badge } from "../../vendor/core/ui/badge";
|
|
23
|
+
import { OverflowTooltip } from "../../vendor/core/ui/overflow-tooltip";
|
|
22
24
|
import { type FieldProps } from "./types";
|
|
23
25
|
|
|
24
26
|
export type Option = {
|
|
@@ -59,15 +61,16 @@ export const ListButtonLabel = (props: {
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
return (
|
|
62
|
-
<div className="
|
|
64
|
+
<div className="flex min-w-0 flex-row flex-wrap gap-2 p-1">
|
|
63
65
|
{options.map((l, index) => (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
<OverflowTooltip key={index} content={l.label}>
|
|
67
|
+
<Badge
|
|
68
|
+
onClick={() => remove(l.value)}
|
|
69
|
+
className="cursor-pointer px-1 py-1 bg-muted my-2 max-w-full"
|
|
70
|
+
>
|
|
71
|
+
<Name>{l.label}</Name>
|
|
72
|
+
</Badge>
|
|
73
|
+
</OverflowTooltip>
|
|
71
74
|
))}
|
|
72
75
|
{error}
|
|
73
76
|
</div>
|
|
@@ -253,7 +256,7 @@ export const ListSearchField = ({
|
|
|
253
256
|
setInputValue("");
|
|
254
257
|
}}
|
|
255
258
|
>
|
|
256
|
-
{option.label}
|
|
259
|
+
<Name title={option.label}>{option.label}</Name>
|
|
257
260
|
<CheckIcon
|
|
258
261
|
className={cn(
|
|
259
262
|
"ml-auto h-4 w-4",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CheckIcon } from "lucide-react";
|
|
2
|
+
import { Name } from "../../vendor/core/ui/name";
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
Command,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
PopoverAnchor,
|
|
21
22
|
PopoverContent,
|
|
22
23
|
} from "../../vendor/core/ui/popover";
|
|
24
|
+
import { OverflowTooltip } from "../../vendor/core/ui/overflow-tooltip";
|
|
23
25
|
import { useLatestRef } from "../../vendor/core/util/hooks/useLatestRef";
|
|
24
26
|
import { cn, notEmpty } from "../../vendor/core/util/utils";
|
|
25
27
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -64,8 +66,12 @@ export const ButtonLabel = (props: {
|
|
|
64
66
|
}, [props.value, props.searchKey]);
|
|
65
67
|
|
|
66
68
|
return (
|
|
67
|
-
<div className="flex flex-row items-center">
|
|
68
|
-
{option?.label &&
|
|
69
|
+
<div className="flex min-w-0 flex-row items-center">
|
|
70
|
+
{option?.label && (
|
|
71
|
+
<OverflowTooltip content={option.label}>
|
|
72
|
+
<Name className="text-foreground">{option.label}</Name>
|
|
73
|
+
</OverflowTooltip>
|
|
74
|
+
)}
|
|
69
75
|
{error}
|
|
70
76
|
</div>
|
|
71
77
|
);
|
|
@@ -287,7 +293,7 @@ export const SearchField = ({
|
|
|
287
293
|
setOpen(false);
|
|
288
294
|
}}
|
|
289
295
|
>
|
|
290
|
-
{option.label}
|
|
296
|
+
<Name title={option.label}>{option.label}</Name>
|
|
291
297
|
<CheckIcon
|
|
292
298
|
className={cn(
|
|
293
299
|
"ml-auto h-4 w-4",
|
|
@@ -27,7 +27,7 @@ vi.mock("../../vendor/core/ui/command", () => ({
|
|
|
27
27
|
),
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
|
-
import { PICKER_PAGE_SIZE, StructurePickerControl, type PickerRequest, type PickerScope } from "./StructurePickerControl";
|
|
30
|
+
import { PICKER_PAGE_SIZE, StructurePickerControl, groupItems, type PickerRequest, type PickerScope } from "./StructurePickerControl";
|
|
31
31
|
|
|
32
32
|
afterEach(cleanup);
|
|
33
33
|
|
|
@@ -109,3 +109,31 @@ describe("the structure picker control", () => {
|
|
|
109
109
|
expect(load).toHaveBeenCalledTimes(1);
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
describe("groupItems", () => {
|
|
114
|
+
type Lens = { id: string; group?: string };
|
|
115
|
+
const groupOf = (lens: Lens) => lens.group;
|
|
116
|
+
const ids = (buckets: { group: string | undefined; items: Lens[] }[]) =>
|
|
117
|
+
buckets.map((bucket) => [bucket.group, bucket.items.map((lens) => lens.id)]);
|
|
118
|
+
|
|
119
|
+
it("is one headless bucket when nothing is grouped", () => {
|
|
120
|
+
expect(ids(groupItems([{ id: "1" }, { id: "2" }], groupOf))).toEqual([[undefined, ["1", "2"]]]);
|
|
121
|
+
expect(ids(groupItems([{ id: "1", group: "a" }]))).toEqual([[undefined, ["1"]]]);
|
|
122
|
+
expect(groupItems([], groupOf)).toEqual([]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("opens a group where it first appears and adds a later page to it", () => {
|
|
126
|
+
const page1 = [{ id: "1", group: "Series001" }, { id: "2", group: "Series002" }];
|
|
127
|
+
const page2 = [{ id: "3", group: "Series001" }, { id: "4", group: "Series003" }];
|
|
128
|
+
expect(ids(groupItems([...page1, ...page2], groupOf))).toEqual([
|
|
129
|
+
["Series001", ["1", "3"]],
|
|
130
|
+
["Series002", ["2"]],
|
|
131
|
+
["Series003", ["4"]],
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("lists the ungrouped first, and a blank group is no group", () => {
|
|
136
|
+
const items = [{ id: "1", group: "a" }, { id: "2" }, { id: "3", group: " " }];
|
|
137
|
+
expect(ids(groupItems(items, groupOf))).toEqual([[undefined, ["2", "3"]], ["a", ["1"]]]);
|
|
138
|
+
});
|
|
139
|
+
});
|