@arkitektio/bsx 6.7.0 → 6.9.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/declared.d.ts +35 -3
- package/dist/bsx/declared.d.ts.map +1 -1
- package/dist/bsx/declared.js +73 -3
- package/dist/bsx/declared.js.map +1 -1
- package/dist/bsx/expr.d.ts +5 -3
- package/dist/bsx/expr.d.ts.map +1 -1
- package/dist/bsx/expr.js +18 -7
- package/dist/bsx/expr.js.map +1 -1
- package/dist/bsx/language.d.ts.map +1 -1
- package/dist/bsx/language.js +6 -4
- package/dist/bsx/language.js.map +1 -1
- package/dist/bsx/parse.d.ts.map +1 -1
- package/dist/bsx/parse.js +23 -6
- package/dist/bsx/parse.js.map +1 -1
- package/dist/bsx/print.d.ts.map +1 -1
- package/dist/bsx/print.js +10 -3
- package/dist/bsx/print.js.map +1 -1
- package/dist/bsx/references.d.ts.map +1 -1
- package/dist/bsx/references.js +103 -22
- package/dist/bsx/references.js.map +1 -1
- package/dist/renderer/bloks/control.d.ts +7 -1
- package/dist/renderer/bloks/control.d.ts.map +1 -1
- package/dist/renderer/bloks/control.js +24 -6
- package/dist/renderer/bloks/control.js.map +1 -1
- package/dist/spec/bsx_v2.json +3479 -2185
- package/dist/spec/catalogs/base@4.json +35 -6
- package/dist/spec/catalogs/base@4.json.js +35 -6
- package/dist/spec/vocabulary.d.ts +2 -0
- package/dist/spec/vocabulary.d.ts.map +1 -1
- package/dist/spec/vocabulary.js +2 -0
- package/dist/spec/vocabulary.js.map +1 -1
- package/dist/spec/vocabulary.json +19 -12
- package/dist/spec/vocabulary.json.js +19 -12
- package/package.json +1 -1
- package/src/bsx/declared.ts +76 -5
- package/src/bsx/expr.ts +17 -8
- package/src/bsx/infer.test.ts +1 -1
- package/src/bsx/language.test.ts +17 -16
- package/src/bsx/language.ts +6 -4
- package/src/bsx/logo.test.ts +47 -0
- package/src/bsx/parse.ts +23 -4
- package/src/bsx/print.ts +9 -2
- package/src/bsx/references.test.ts +6 -6
- package/src/bsx/references.ts +105 -20
- package/src/renderer/bloks/control.tsx +31 -7
- package/src/spec/bsx_v2.json +3479 -2185
- package/src/spec/catalogs/base@4.json +35 -6
- package/src/spec/spec.test.ts +1 -1
- package/src/spec/vocabulary.json +19 -12
- package/src/spec/vocabulary.ts +4 -0
package/src/bsx/references.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from '../renderer/runtime/types';
|
|
8
8
|
import {blokViewFor, defaultBlokView, type BlokView, type SpecComponent} from '../spec/catalogs';
|
|
9
9
|
import {PICK_FUNCTION, TEXT_NODE} from './parse';
|
|
10
|
-
import {PICK_VERB, REFERENCE_SEPARATOR} from './expr';
|
|
10
|
+
import {AGENTS_ROOT, PICK_VERB, REFERENCE_SEPARATOR} from './expr';
|
|
11
11
|
import {valueFitsPort} from '../spec/locals';
|
|
12
12
|
import {LOCAL_ANY, localDeclared, resolveLocals, type ResolvedLocal} from './infer';
|
|
13
13
|
import {
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
declarationProblem,
|
|
18
18
|
declaredDependencies,
|
|
19
19
|
dependenciesAction,
|
|
20
|
+
dependenciesOwner,
|
|
21
|
+
dependenciesTarget,
|
|
20
22
|
DEPENDENCIES_COMPONENT,
|
|
21
23
|
declaredQueries,
|
|
22
24
|
declaredSubscriptions,
|
|
@@ -25,6 +27,8 @@ import {
|
|
|
25
27
|
iterWithParents,
|
|
26
28
|
LIKE_PROP,
|
|
27
29
|
LOCAL_COMPONENT,
|
|
30
|
+
LOGO_COMPONENT,
|
|
31
|
+
blokLogoTree,
|
|
28
32
|
localName,
|
|
29
33
|
localProblem,
|
|
30
34
|
QUERY_COMPONENT,
|
|
@@ -39,6 +43,7 @@ import {
|
|
|
39
43
|
argFits,
|
|
40
44
|
finding,
|
|
41
45
|
kindIn,
|
|
46
|
+
kindReads,
|
|
42
47
|
loadVocabulary,
|
|
43
48
|
type BlokFinding,
|
|
44
49
|
type BlokKind,
|
|
@@ -267,6 +272,18 @@ export const boundScope = (tree: BlokComponentNode, scope: BlokCheckScope): Blok
|
|
|
267
272
|
return borrowed.length ? {...scope, dependencies: [...(scope.dependencies ?? []), ...borrowed]} : scope;
|
|
268
273
|
};
|
|
269
274
|
|
|
275
|
+
const CUSTOM_KIND: BlokKind = 'custom';
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* `text` (a path, a call) as a custom blok writes it: a bound agent stored `deps.<key>`
|
|
279
|
+
* reads `agents.<key>`; one through declared dependencies is left.
|
|
280
|
+
*/
|
|
281
|
+
const asWritten = (text: string): string => {
|
|
282
|
+
if (!text.startsWith('deps.')) return text;
|
|
283
|
+
const rest = text.slice('deps.'.length);
|
|
284
|
+
return rest.split('.')[0].split('(')[0].includes(REFERENCE_SEPARATOR) ? text : `${AGENTS_ROOT}.${rest}`;
|
|
285
|
+
};
|
|
286
|
+
|
|
270
287
|
/** A context as a `<Blok context>` spells it (`PANEL` → `panel`). */
|
|
271
288
|
export const spelledContext = (context: string): string => context.toLowerCase();
|
|
272
289
|
|
|
@@ -573,10 +590,24 @@ class Checker {
|
|
|
573
590
|
this.colour = colourPattern(this.vocabulary);
|
|
574
591
|
}
|
|
575
592
|
|
|
576
|
-
add(code: string, nodeId: string | null,
|
|
593
|
+
add(code: string, nodeId: string | null, written: DiagnosticFields = {}, propKey?: string): void {
|
|
594
|
+
const fields =
|
|
595
|
+
this.kindName === CUSTOM_KIND
|
|
596
|
+
? Object.fromEntries(Object.entries(written).map(([key, value]) => [key, typeof value === 'string' ? asWritten(value) : value]))
|
|
597
|
+
: written;
|
|
577
598
|
this.findings.push(finding(code, fields, {...(nodeId !== null ? {nodeId} : {}), ...(propKey !== undefined ? {propKey} : {})}));
|
|
578
599
|
}
|
|
579
600
|
|
|
601
|
+
/** Whether the kind reads the stored `root`: a custom blok's `agents` is stored `deps`. */
|
|
602
|
+
private reads(root: string): boolean {
|
|
603
|
+
return kindReads(this.kind, root);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/** Whether `dependency` (as stored) is declared in the blok's own tree: any of an agent blok, a `<key>__<name>` one of a custom blok. */
|
|
607
|
+
private declares(dependency: string): boolean {
|
|
608
|
+
return this.kindName === 'agent' || (this.kindName === CUSTOM_KIND && dependency.includes(REFERENCE_SEPARATOR));
|
|
609
|
+
}
|
|
610
|
+
|
|
580
611
|
private rootsText(): string {
|
|
581
612
|
return [...this.kind.roots].sort().join(', ');
|
|
582
613
|
}
|
|
@@ -587,6 +618,32 @@ class Checker {
|
|
|
587
618
|
|
|
588
619
|
/* -- declarations -- */
|
|
589
620
|
|
|
621
|
+
/**
|
|
622
|
+
* The blok's own `<logo>`: a child of its `<Blok>`, one, in a blok that is no logo, and a fixed
|
|
623
|
+
* drawing. What it draws is checked as a logo blok (`checkBlokTree`). The port of the spec's
|
|
624
|
+
* `check_logo_declaration`.
|
|
625
|
+
*/
|
|
626
|
+
checkLogoDeclaration(tree: BlokComponentNode): void {
|
|
627
|
+
let own = 0;
|
|
628
|
+
for (const [node, ancestors] of iterWithParents(tree)) {
|
|
629
|
+
if (node.component !== LOGO_COMPONENT) continue;
|
|
630
|
+
if (ancestors.length !== 1) {
|
|
631
|
+
this.add('logo.misplaced', node.id);
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
own += 1;
|
|
635
|
+
if (own > 1) this.add('logo.twice', node.id);
|
|
636
|
+
else if (this.header.context === LOGO) this.add('logo.in_logo', node.id);
|
|
637
|
+
for (const [drawn] of iterWithParents(node)) {
|
|
638
|
+
for (const prop of drawn.props ?? []) {
|
|
639
|
+
if (prop.dynamic_value || prop.agent_call || prop.util_call) {
|
|
640
|
+
this.add('logo.dynamic', drawn.id, {component: drawn.component, prop: prop.key});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
590
647
|
checkDeclarations(tree: BlokComponentNode): void {
|
|
591
648
|
const {vocabulary, header} = this;
|
|
592
649
|
const kind = this.kindName;
|
|
@@ -611,6 +668,7 @@ class Checker {
|
|
|
611
668
|
this.checkDependencies(tree);
|
|
612
669
|
this.checkLocalPositions(tree);
|
|
613
670
|
this.checkQueries(tree);
|
|
671
|
+
this.checkLogoDeclaration(tree);
|
|
614
672
|
for (const [name, sites] of intoSites(tree)) {
|
|
615
673
|
this.into.add(name);
|
|
616
674
|
if (vocabulary.reserved.has(name)) this.add('roots.reserved', sites[0].site, {name});
|
|
@@ -669,15 +727,15 @@ class Checker {
|
|
|
669
727
|
}
|
|
670
728
|
|
|
671
729
|
/**
|
|
672
|
-
* A `<dependencies>` is a child of an agent blok's `<Blok>`, keyed once, and
|
|
673
|
-
* names one of the app's own
|
|
730
|
+
* A `<dependencies>` is a child of an agent or custom blok's `<Blok>`, keyed once, and
|
|
731
|
+
* names an action that has dependencies: one of the app's own, or of a bound agent (custom).
|
|
674
732
|
*/
|
|
675
733
|
private checkDependencies(tree: BlokComponentNode): void {
|
|
676
734
|
for (const [node, ancestors] of iterWithParents(tree)) {
|
|
677
735
|
if (node.component !== DEPENDENCIES_COMPONENT) continue;
|
|
678
736
|
const literal = (name: string): unknown => node.props?.find(prop => prop.key === name)?.static_value;
|
|
679
737
|
const key = literal('key');
|
|
680
|
-
if (ancestors.length !== 1 || this.kindName !== 'agent') {
|
|
738
|
+
if (ancestors.length !== 1 || (this.kindName !== 'agent' && this.kindName !== CUSTOM_KIND)) {
|
|
681
739
|
const at = ancestors.length > 1 ? ancestors[ancestors.length - 1].id : `a${article(this.kindName)} ${this.kindName} blok`;
|
|
682
740
|
this.add('dependencies.position', node.id, {key: typeof key === 'string' ? key : '?', at});
|
|
683
741
|
continue;
|
|
@@ -695,7 +753,14 @@ class Checker {
|
|
|
695
753
|
const declared: DeclaredDependencies = {key, node: node.id, like: typeof like === 'string' ? like : null};
|
|
696
754
|
this.declared.set(key, declared);
|
|
697
755
|
const workflows = this.scope.workflows ?? null;
|
|
698
|
-
|
|
756
|
+
const owner = dependenciesOwner(declared);
|
|
757
|
+
if (this.kindName === CUSTOM_KIND) {
|
|
758
|
+
if (owner === null || owner === 'self') {
|
|
759
|
+
this.add('dependencies.like', node.id, {key, like: declared.like ?? '', problem: 'is not agents.<name>.<action>'});
|
|
760
|
+
} else if (this.mounted && !this.dependencies.has(owner)) {
|
|
761
|
+
this.add('dependencies.like', node.id, {key, like: declared.like ?? '', problem: `names the agent '${owner}', which the blok is not bound to`});
|
|
762
|
+
}
|
|
763
|
+
} else if (owner !== 'self') {
|
|
699
764
|
this.add('dependencies.like', node.id, {key, like: declared.like ?? '', problem: 'is not self.<action>'});
|
|
700
765
|
} else if (workflows !== null) {
|
|
701
766
|
const borrowed = borrowedDependencies(declared, workflows);
|
|
@@ -711,15 +776,17 @@ class Checker {
|
|
|
711
776
|
private typed(key: string): boolean {
|
|
712
777
|
const declared = this.declared.get(key);
|
|
713
778
|
const workflows = this.scope.workflows ?? null;
|
|
714
|
-
|
|
779
|
+
// A bound agent's actions are known only where the blok runs.
|
|
780
|
+
if (declared === undefined || dependenciesOwner(declared) !== 'self' || workflows === null) return false;
|
|
781
|
+
return typeof borrowedDependencies(declared, workflows) !== 'string';
|
|
715
782
|
}
|
|
716
783
|
|
|
717
784
|
/**
|
|
718
|
-
* Whether `dependency` (stored `<key>__<name>`) is none this
|
|
719
|
-
* declares:
|
|
785
|
+
* Whether `dependency` (stored `<key>__<name>`) is none this blok
|
|
786
|
+
* declares: such dependencies are the ones in its own tree, mounted or not.
|
|
720
787
|
*/
|
|
721
788
|
private undeclared(dependency: string): boolean {
|
|
722
|
-
if (this.
|
|
789
|
+
if (!this.declares(dependency) || dependency === 'self') return false;
|
|
723
790
|
const split = splitReference(dependency);
|
|
724
791
|
if (split === null || !this.declared.has(split[0])) return true;
|
|
725
792
|
return this.typed(split[0]) && split[1] !== OPTIONS_SEGMENT && !this.dependencies.has(dependency);
|
|
@@ -780,12 +847,14 @@ class Checker {
|
|
|
780
847
|
this.add('deps.unknown', where.node.id, {path: `with ${given}`, key: given, keys, hint: dependencyHint(given, this.kindName)}, where.key);
|
|
781
848
|
return;
|
|
782
849
|
}
|
|
850
|
+
const target = dependenciesTarget(declared);
|
|
783
851
|
const of = dependenciesAction(declared);
|
|
784
|
-
if (
|
|
852
|
+
if (target !== null && (target[0] !== call.dependency || target[1] !== action)) this.add('with.mismatch', where.node.id, {path: whereText(where), key: given, action, of}, where.key);
|
|
785
853
|
}
|
|
786
854
|
|
|
787
855
|
/** What `key` may read through, for a message: the dependencies declared under it, else the keys the blok declares. */
|
|
788
856
|
private dependencyKnown(key: string): string {
|
|
857
|
+
if (this.kindName !== 'agent' && !this.declared.has(key)) return [...this.dependencies.keys()].sort().join(', ') || 'none';
|
|
789
858
|
if (this.declared.has(key) && this.typed(key)) {
|
|
790
859
|
const prefix = `${key}${REFERENCE_SEPARATOR}`;
|
|
791
860
|
const names = [...this.dependencies.keys()].filter(name => name.startsWith(prefix)).map(name => `${key}.${name.slice(prefix.length)}`);
|
|
@@ -904,7 +973,12 @@ class Checker {
|
|
|
904
973
|
const name = localDeclared(child);
|
|
905
974
|
if (name !== null) inner.set(name, this.bindLocal(name, child, new Map(inner)));
|
|
906
975
|
}
|
|
907
|
-
for (const child of children)
|
|
976
|
+
for (const child of children) {
|
|
977
|
+
// A blok's own <logo> draws nothing in it and reads nothing: it is checked as a logo blok
|
|
978
|
+
// of its own (`blokLogoTree`), never as part of the blok it stands for.
|
|
979
|
+
if (child.component === LOGO_COMPONENT) continue;
|
|
980
|
+
this.walkNode(child, inner, [...ancestors, node], inSlot);
|
|
981
|
+
}
|
|
908
982
|
}
|
|
909
983
|
|
|
910
984
|
private walkProp(node: BlokComponentNode, prop: BlokComponentProp, scope: Scope, inError: boolean): void {
|
|
@@ -1064,7 +1138,7 @@ class Checker {
|
|
|
1064
1138
|
}
|
|
1065
1139
|
// An effect that is a root's own (port.set) belongs to the kinds that read that root.
|
|
1066
1140
|
const needs = effect === undefined ? null : (vocabulary.functions.get(effect)?.needs ?? null);
|
|
1067
|
-
if (effect !== undefined && needs !== null && !this.
|
|
1141
|
+
if (effect !== undefined && needs !== null && !this.reads(needs)) {
|
|
1068
1142
|
this.notInKind(node.id, effect, needs, prop.key);
|
|
1069
1143
|
}
|
|
1070
1144
|
if (prop.key === BIND_PROP) {
|
|
@@ -1172,16 +1246,16 @@ class Checker {
|
|
|
1172
1246
|
this.notInKind(where.node.id, `self.${action}(...)`, 'self', where.key);
|
|
1173
1247
|
return;
|
|
1174
1248
|
}
|
|
1175
|
-
} else if (!this.
|
|
1249
|
+
} else if (!this.reads('deps')) {
|
|
1176
1250
|
this.notInKind(where.node.id, `deps.${call.dependency}.${action}(...)`, 'deps', where.key);
|
|
1177
1251
|
return;
|
|
1178
1252
|
}
|
|
1179
1253
|
if (call.given != null) this.checkWith(call, where);
|
|
1180
1254
|
const dependency = this.undeclared(call.dependency) ? undefined : this.dependencies.get(call.dependency);
|
|
1181
1255
|
if (!dependency) {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1256
|
+
const agent = this.declares(call.dependency);
|
|
1257
|
+
if (call.dependency !== 'self' && (agent ? this.undeclared(call.dependency) : this.mounted)) {
|
|
1258
|
+
// One the blok does not declare itself is the mount's, taken as it is keyed.
|
|
1185
1259
|
const written = agent ? (splitReference(call.dependency)?.[0] ?? call.dependency) : call.dependency;
|
|
1186
1260
|
const key = agent ? call.dependency.split(REFERENCE_SEPARATOR).join('.') : call.dependency;
|
|
1187
1261
|
const keys = agent ? this.dependencyKnown(written) : [...this.dependencies.keys()].sort().join(', ') || 'none';
|
|
@@ -1384,7 +1458,8 @@ class Checker {
|
|
|
1384
1458
|
report('roots.unknown', {path, root: namespace ? `${root} (a function namespace)` : root});
|
|
1385
1459
|
return null;
|
|
1386
1460
|
}
|
|
1387
|
-
|
|
1461
|
+
// `agents` is how a custom blok writes `deps`: a stored tree never holds it.
|
|
1462
|
+
if (!this.reads(root) || root === AGENTS_ROOT) {
|
|
1388
1463
|
this.notInKind(nodeId, path, root, propKey);
|
|
1389
1464
|
return null;
|
|
1390
1465
|
}
|
|
@@ -1402,7 +1477,7 @@ class Checker {
|
|
|
1402
1477
|
// An agent blok's dependencies are in its own tree (`cells.microscope`, stored
|
|
1403
1478
|
// `deps.cells__microscope`): one it does not declare is unknown, mounted or not;
|
|
1404
1479
|
// one it declares and this side cannot type is open.
|
|
1405
|
-
if (this.
|
|
1480
|
+
if (this.declares(rest[0]) && rest[0] !== 'self') {
|
|
1406
1481
|
const split = splitReference(rest[0]);
|
|
1407
1482
|
const key = split ? split[0] : rest[0];
|
|
1408
1483
|
if (split && this.declared.has(key) && split[1] === OPTIONS_SEGMENT) return this.options(key, rest.slice(1), path, nodeId, propKey);
|
|
@@ -1415,7 +1490,7 @@ class Checker {
|
|
|
1415
1490
|
}
|
|
1416
1491
|
const dependency = this.dependencies.get(rest[0]);
|
|
1417
1492
|
if (!dependency) {
|
|
1418
|
-
if (!this.mounted || this.
|
|
1493
|
+
if (!this.mounted || this.declares(rest[0])) return openMatch(path);
|
|
1419
1494
|
report('deps.unknown', {path, key: rest[0], keys: [...this.dependencies.keys()].sort().join(', ') || 'none', hint: dependencyHint(rest[0], this.kindName)});
|
|
1420
1495
|
return null;
|
|
1421
1496
|
}
|
|
@@ -1688,6 +1763,16 @@ export const checkBlokTree = (
|
|
|
1688
1763
|
checker.checkDeclarations(tree);
|
|
1689
1764
|
checker.walk(tree);
|
|
1690
1765
|
if (header.context === LOGO) checker.findings.push(...checkLogo(tree, scope.demo));
|
|
1766
|
+
else {
|
|
1767
|
+
// The blok's own <logo>, drawn and checked as the logo blok it stands for: the pens, the
|
|
1768
|
+
// logo catalog, the logo limits.
|
|
1769
|
+
const logo = blokLogoTree(tree);
|
|
1770
|
+
if (logo !== null) checker.findings.push(...checkBlokTree(logo, unmountedBlokScope(), logoView(view)));
|
|
1771
|
+
}
|
|
1691
1772
|
checker.finish();
|
|
1692
1773
|
return checker.findings;
|
|
1693
1774
|
};
|
|
1775
|
+
|
|
1776
|
+
/** The view a `<logo>` is drawn against: the blok's when it draws logos, else the base one. */
|
|
1777
|
+
const logoView = (view: BlokView | null): BlokView | null =>
|
|
1778
|
+
view === null || view.components.has('Logo') ? view : defaultBlokView();
|
|
@@ -284,9 +284,9 @@ export const chromeSchema = z
|
|
|
284
284
|
);
|
|
285
285
|
|
|
286
286
|
const BLOK_COMPONENT = 'Blok';
|
|
287
|
-
const DECLARATIONS: ReadonlySet<string> = new Set(['local', 'query', 'subscription', 'var', 'dependencies']);
|
|
287
|
+
const DECLARATIONS: ReadonlySet<string> = new Set(['local', 'query', 'subscription', 'var', 'dependencies', 'logo']);
|
|
288
288
|
|
|
289
|
-
/** The children of a node that draw: its declarations (`local`, `query`, `subscription`, `var`, `dependencies`) left out. */
|
|
289
|
+
/** The children of a node that draw: its declarations (`local`, `query`, `subscription`, `var`, `dependencies`, `logo`) left out. */
|
|
290
290
|
export const drawnChildren = (component: BlokComponentNode): BlokComponentNode[] =>
|
|
291
291
|
(component.children ?? []).filter(child => !DECLARATIONS.has(child.component));
|
|
292
292
|
|
|
@@ -393,13 +393,13 @@ export const Dependencies = declaration(
|
|
|
393
393
|
z
|
|
394
394
|
.object({
|
|
395
395
|
key: z.string().describe('The key they are read through, bare: cells.<dependency>.'),
|
|
396
|
-
like: z.string().describe('The action whose dependencies they are: self.<action>.'),
|
|
396
|
+
like: z.string().describe('The action whose dependencies they are: self.<action>, in a custom blok agents.<name>.<action>.'),
|
|
397
397
|
})
|
|
398
398
|
.describe(
|
|
399
|
-
"Declares the dependencies of one of the app's own
|
|
399
|
+
"Declares the dependencies of one action, for an agent blok one of the app's own, for a custom blok one of an agent it is bound to: read and called through its key (cells.<dependency>), picked by the viewer, and handed to a run of that action with `with <key>`. A child of <Blok>; draws nothing.",
|
|
400
400
|
),
|
|
401
401
|
false,
|
|
402
|
-
{kinds: ['agent'], since: 3},
|
|
402
|
+
{kinds: ['agent', 'custom'], since: 3},
|
|
403
403
|
);
|
|
404
404
|
|
|
405
405
|
/* -------------------------------------------------------------------------- */
|
|
@@ -649,10 +649,10 @@ const depPickerSchema = z
|
|
|
649
649
|
.string()
|
|
650
650
|
.describe('One dependency (`cells.microscope`), or the key alone (`cells`) for every dependency declared under it that no other picker places.'),
|
|
651
651
|
})
|
|
652
|
-
.describe('The ready-made picker of the agent a declared dependency is bound to: the agents that fit, the chosen one shown, always changeable.
|
|
652
|
+
.describe('The ready-made picker of the agent a declared dependency is bound to: the agents that fit, the chosen one shown, always changeable. In an agent or a custom blok.');
|
|
653
653
|
|
|
654
654
|
/** `<deppicker key="cells.microscope" />`: the host's picker of declared dependencies; nothing without a host. */
|
|
655
|
-
export const Deppicker = createBlokComponent({name: 'deppicker', schema: depPickerSchema, kinds: ['agent'], since: 3}, ({component, schema}) => {
|
|
655
|
+
export const Deppicker = createBlokComponent({name: 'deppicker', schema: depPickerSchema, kinds: ['agent', 'custom'], since: 3}, ({component, schema}) => {
|
|
656
656
|
const key = useValue(useBlok(component, schema).key);
|
|
657
657
|
const host = useBlokRunHost();
|
|
658
658
|
return <>{typeof key === 'string' ? (host.renderDepPicker?.(key) ?? null) : null}</>;
|
|
@@ -738,6 +738,29 @@ export const PortField = createBlokComponent({name: 'field', schema: fieldSchema
|
|
|
738
738
|
return <>{typeof key === 'string' ? parts.renderField(key) : null}</>;
|
|
739
739
|
});
|
|
740
740
|
|
|
741
|
+
/**
|
|
742
|
+
* `<logo title viewBox>`: the blok's own logo, what stands for it in lists, pins and tabs. Draws
|
|
743
|
+
* nothing in the blok; its children are a drawing of the logo catalog, drawn as a logo blok of
|
|
744
|
+
* its own (`blokLogoTree`).
|
|
745
|
+
*/
|
|
746
|
+
export const LogoDeclaration = createBlokComponent(
|
|
747
|
+
{
|
|
748
|
+
name: 'logo',
|
|
749
|
+
acceptsChildren: true,
|
|
750
|
+
placement: {childrenContext: 'logo'},
|
|
751
|
+
since: 4,
|
|
752
|
+
schema: z
|
|
753
|
+
.object({
|
|
754
|
+
title: z.string().optional().describe('What the logo is called: read out in place of the drawing.'),
|
|
755
|
+
viewBox: z.string().optional().describe("The drawing's grid; 0 0 24 24 when left out."),
|
|
756
|
+
})
|
|
757
|
+
.describe(
|
|
758
|
+
"Declares the blok's own logo: what stands for it in lists, pins and tabs. A drawing of the logo catalog on a 24-unit grid, painted with the logo pens, drawn with the action logos' pen unless a shape says otherwise; literals only. A child of <Blok>, one; draws nothing in the blok.",
|
|
759
|
+
),
|
|
760
|
+
},
|
|
761
|
+
() => null,
|
|
762
|
+
);
|
|
763
|
+
|
|
741
764
|
export const controlBlokComponents = [
|
|
742
765
|
TextNode,
|
|
743
766
|
Foreach,
|
|
@@ -750,6 +773,7 @@ export const controlBlokComponents = [
|
|
|
750
773
|
Subscription,
|
|
751
774
|
Var,
|
|
752
775
|
Dependencies,
|
|
776
|
+
LogoDeclaration,
|
|
753
777
|
Match,
|
|
754
778
|
Case,
|
|
755
779
|
Default,
|