@arkitektio/bsx 6.8.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.
@@ -2,7 +2,7 @@ export default {
2
2
  "id": "https://arkitekt.live/catalogs/base/v4",
3
3
  "name": "base",
4
4
  "version": 4,
5
- "minor": 3,
5
+ "minor": 4,
6
6
  "extends": null,
7
7
  "description": "The base catalog: everything every renderer draws. The language's own elements (control flow, async boundaries, the Blok element, the declarations, text), the html components, the structure and run parts a host supplies, the scene and the logo shapes. A renderer speaks it whole, in the contexts it draws; functions and effects are in vocabulary.json.",
8
8
  "components": [
@@ -291,6 +291,33 @@ export default {
291
291
  ],
292
292
  "since": 3
293
293
  },
294
+ {
295
+ "name": "logo",
296
+ "group": "language",
297
+ "description": "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.",
298
+ "context": "PANEL",
299
+ "children_context": "LOGO",
300
+ "inherits_context": false,
301
+ "accepts_children": true,
302
+ "downstream_of": [],
303
+ "not_downstream_of": [],
304
+ "text_prop": null,
305
+ "props": [
306
+ {
307
+ "key": "title",
308
+ "kind": "STRING",
309
+ "required": false,
310
+ "description": "What the logo is called: read out in place of the drawing."
311
+ },
312
+ {
313
+ "key": "viewBox",
314
+ "kind": "STRING",
315
+ "required": false,
316
+ "description": "The drawing's grid; 0 0 24 24 when left out."
317
+ }
318
+ ],
319
+ "since": 4
320
+ },
294
321
  {
295
322
  "name": "#text",
296
323
  "group": "language",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "vocab": 2,
3
- "minor": 7,
3
+ "minor": 8,
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": {
@@ -99,6 +99,7 @@
99
99
  "query": "<query name=\"x\" service=\"mikro\" document=\"query (...) {...}\" poll={5} more=\"items\"><var key=\"k\" value={...} /></query>: a declared read, queries.<name>. A child of <Blok>, before its content.",
100
100
  "subscription": "<subscription name=\"x\" service=\"mikro\" document=\"subscription (...) {...}\" keep={10} history=\"q\"><var key=\"k\" value={...} /></subscription>: a declared stream, subscriptions.<name>. A child of <Blok>, before its content.",
101
101
  "dependencies": "<dependencies key=\"cells\" like=\"self.<action>\" />: the dependencies of one of the app's own actions, for an agent blok to read, call and hand to a run of it. A custom blok declares those of an action of an agent it is bound to: like=\"agents.<name>.<action>\" (stored deps.<name>.<action>). Each is read through the key, bare: cells.<dependency>.<state>.<field>, cells.<dependency>.<action>(...), cells.<dependency>.connected (stored as the blok's dependency deps.cells__<dependency>). cells.options.<dependency> lists the agents that fit one ({id, name, connected, picked}) and cells.pick(<dependency>: <agent id>) binds it; <deppicker key=\"cells.<dependency>\" /> is the ready-made picker. Which agent each is bound to is the viewer's own choice, kept on their device and never on a server; until they choose it is seeded once, with the agent the latest run of the action had, else the only one that fits. A child of <Blok>, after its locals and before what reads through it; an agent blok only. An action whose dependency is called options or pick cannot be read through one.",
102
+ "logo": "<logo title=\"Microscope\"><Circle cx=\"12\" cy=\"12\" r=\"7\" /></logo>: the blok's own logo, standing for it in lists, pins and tabs. A child of <Blok>, one, in a blok that is no logo. It holds a drawing of the logo catalog on a 24-unit grid (viewBox=\"0 0 24 24\" unless it says otherwise), painted with the logo pens and drawn with the action logos' pen (fill none, stroke ink, round) unless a shape says otherwise. title and viewBox are literals, and so is everything it draws: a fixed drawing that reads nothing. It is checked and drawn as a logo blok of its own.",
102
103
  "var": "<var key=\"k\" value={expression or literal} />: one variable of a query or subscription; an expression over args, blok-level locals and agents."
103
104
  }
104
105
  },
@@ -544,6 +545,10 @@
544
545
  "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."},
545
546
  "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=[...]."},
546
547
  "logo.complexity": {"level": "error", "message": "{detail}"},
548
+ "logo.misplaced": {"level": "error", "message": "A <logo> is a child of the <Blok> it stands for, not inside another element.", "hint": "Move it to the top of the blok, beside its queries."},
549
+ "logo.twice": {"level": "error", "message": "A blok has one <logo>; this is a second one."},
550
+ "logo.in_logo": {"level": "error", "message": "A logo blok is a logo already: it declares no <logo> of its own.", "hint": "Draw it in the blok's <Logo> instead."},
551
+ "logo.dynamic": {"level": "warning", "message": "<{component}> sets {prop} with an expression; a <logo> is a fixed drawing that reads nothing, so it is drawn without it.", "hint": "Write the value as a literal."},
547
552
  "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."},
548
553
  "catalog.children": {"level": "warning", "message": "<{component}> takes no children.", "hint": "Close <{component}> without children (<{component} ... />), or put them beside it."},
549
554
  "catalog.text": {"level": "warning", "message": "<{component}> {detail}", "hint": "Put the text in a component that draws it (<Text>, <p>, <span>), or set it once."},
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "vocab": 2,
3
- "minor": 7,
3
+ "minor": 8,
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": {
@@ -99,6 +99,7 @@ export default {
99
99
  "query": "<query name=\"x\" service=\"mikro\" document=\"query (...) {...}\" poll={5} more=\"items\"><var key=\"k\" value={...} /></query>: a declared read, queries.<name>. A child of <Blok>, before its content.",
100
100
  "subscription": "<subscription name=\"x\" service=\"mikro\" document=\"subscription (...) {...}\" keep={10} history=\"q\"><var key=\"k\" value={...} /></subscription>: a declared stream, subscriptions.<name>. A child of <Blok>, before its content.",
101
101
  "dependencies": "<dependencies key=\"cells\" like=\"self.<action>\" />: the dependencies of one of the app's own actions, for an agent blok to read, call and hand to a run of it. A custom blok declares those of an action of an agent it is bound to: like=\"agents.<name>.<action>\" (stored deps.<name>.<action>). Each is read through the key, bare: cells.<dependency>.<state>.<field>, cells.<dependency>.<action>(...), cells.<dependency>.connected (stored as the blok's dependency deps.cells__<dependency>). cells.options.<dependency> lists the agents that fit one ({id, name, connected, picked}) and cells.pick(<dependency>: <agent id>) binds it; <deppicker key=\"cells.<dependency>\" /> is the ready-made picker. Which agent each is bound to is the viewer's own choice, kept on their device and never on a server; until they choose it is seeded once, with the agent the latest run of the action had, else the only one that fits. A child of <Blok>, after its locals and before what reads through it; an agent blok only. An action whose dependency is called options or pick cannot be read through one.",
102
+ "logo": "<logo title=\"Microscope\"><Circle cx=\"12\" cy=\"12\" r=\"7\" /></logo>: the blok's own logo, standing for it in lists, pins and tabs. A child of <Blok>, one, in a blok that is no logo. It holds a drawing of the logo catalog on a 24-unit grid (viewBox=\"0 0 24 24\" unless it says otherwise), painted with the logo pens and drawn with the action logos' pen (fill none, stroke ink, round) unless a shape says otherwise. title and viewBox are literals, and so is everything it draws: a fixed drawing that reads nothing. It is checked and drawn as a logo blok of its own.",
102
103
  "var": "<var key=\"k\" value={expression or literal} />: one variable of a query or subscription; an expression over args, blok-level locals and agents."
103
104
  }
104
105
  },
@@ -544,6 +545,10 @@ export default {
544
545
  "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."},
545
546
  "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=[...]."},
546
547
  "logo.complexity": {"level": "error", "message": "{detail}"},
548
+ "logo.misplaced": {"level": "error", "message": "A <logo> is a child of the <Blok> it stands for, not inside another element.", "hint": "Move it to the top of the blok, beside its queries."},
549
+ "logo.twice": {"level": "error", "message": "A blok has one <logo>; this is a second one."},
550
+ "logo.in_logo": {"level": "error", "message": "A logo blok is a logo already: it declares no <logo> of its own.", "hint": "Draw it in the blok's <Logo> instead."},
551
+ "logo.dynamic": {"level": "warning", "message": "<{component}> sets {prop} with an expression; a <logo> is a fixed drawing that reads nothing, so it is drawn without it.", "hint": "Write the value as a literal."},
547
552
  "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."},
548
553
  "catalog.children": {"level": "warning", "message": "<{component}> takes no children.", "hint": "Close <{component}> without children (<{component} ... />), or put them beside it."},
549
554
  "catalog.text": {"level": "warning", "message": "<{component}> {detail}", "hint": "Put the text in a component that draws it (<Text>, <p>, <span>), or set it once."},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkitektio/bsx",
3
- "version": "6.8.0",
3
+ "version": "6.9.0",
4
4
  "description": "The BSX language, the blok spec, runtime and React renderer: one copy for every Arkitekt frontend.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -26,6 +26,8 @@ export const QUERY_COMPONENT = 'query';
26
26
  export const SUBSCRIPTION_COMPONENT = 'subscription';
27
27
  export const VAR_COMPONENT = 'var';
28
28
  export const DEPENDENCIES_COMPONENT = 'dependencies';
29
+ /** A blok's own logo: a child of its `<Blok>` holding a drawing of the logo catalog. */
30
+ export const LOGO_COMPONENT = 'logo';
29
31
  /** The components that declare what a blok owns and draw nothing. */
30
32
  export const DECLARATION_COMPONENTS: ReadonlySet<string> = new Set([
31
33
  LOCAL_COMPONENT,
@@ -33,7 +35,22 @@ export const DECLARATION_COMPONENTS: ReadonlySet<string> = new Set([
33
35
  SUBSCRIPTION_COMPONENT,
34
36
  VAR_COMPONENT,
35
37
  DEPENDENCIES_COMPONENT,
38
+ LOGO_COMPONENT,
36
39
  ]);
40
+ const LOGO_TITLE_PROP = 'title';
41
+ const LOGO_VIEW_BOX_PROP = 'viewBox';
42
+ /** A logo's grid when its `<logo>` names none: 24 units, the grid of the action logos. */
43
+ export const LOGO_VIEW_BOX = '0 0 24 24';
44
+ /** The pen a `<logo>` draws with unless a shape says otherwise: the action logos' pen. */
45
+ export const LOGO_PEN: ReadonlyArray<readonly [string, string]> = [
46
+ ['fill', 'none'],
47
+ ['stroke', 'ink'],
48
+ ['strokeWidth', '1.8'],
49
+ ['strokeLinecap', 'round'],
50
+ ['strokeLinejoin', 'round'],
51
+ ];
52
+ /** The kind a `<logo>` is drawn as (`blokLogoTree`): one drawn in the logo context. */
53
+ export const LOGO_KIND = 'agent';
37
54
  /** The name a local, a query or a subscription is read by. */
38
55
  export const NAME_PROP = 'name';
39
56
  /** A local's borrowed port: `self.<action>.<arg>` or `deps.<key>.<action>.<arg>`. */
@@ -224,6 +241,49 @@ export const declaredLocal = (node: BlokComponentNode): DeclaredLocal | null =>
224
241
  };
225
242
 
226
243
  /** Every node of `tree` with its ancestors, depth first. */
244
+ /**
245
+ * The blok's own `<logo>`: the first among the children of its `<Blok>`, or
246
+ * null. A `<logo>` anywhere else, or a second one, stands for nothing (the
247
+ * checker says so: `logo.misplaced`, `logo.twice`). The port of the spec's
248
+ * `declared_logo`.
249
+ */
250
+ export const declaredLogo = (tree: BlokComponentNode | null | undefined): BlokComponentNode | null =>
251
+ (tree?.children ?? []).find(child => child.component === LOGO_COMPONENT) ?? null;
252
+
253
+ /**
254
+ * The blok's `<logo>` as a logo blok of its own, or null when it declares
255
+ * none: `<Blok kind="agent" context="logo"><Logo viewBox title><G pen>...`.
256
+ * What is checked (pens, the logo catalog, the logo limits) and drawn for it,
257
+ * in lists, pins and tabs. Its kind is `agent` whatever the blok's: a `<logo>`
258
+ * is literals only and reads nothing. The drawing's nodes are the `<logo>`'s
259
+ * own; the frame takes its id (and two made from it). The port of the spec's
260
+ * `blok_logo_tree`.
261
+ */
262
+ export const blokLogoTree = (tree: BlokComponentNode | null | undefined): BlokComponentNode | null => {
263
+ const logo = declaredLogo(tree);
264
+ if (logo === null) return null;
265
+ const props = new Map((logo.props ?? []).map(prop => [prop.key, prop]));
266
+ const title = props.get(LOGO_TITLE_PROP);
267
+ const drawingProps = [props.get(LOGO_VIEW_BOX_PROP) ?? {key: LOGO_VIEW_BOX_PROP, static_value: LOGO_VIEW_BOX}];
268
+ if (title) drawingProps.push(title);
269
+ const pen: BlokComponentNode = {
270
+ id: `${logo.id}.pen`,
271
+ component: 'G',
272
+ props: LOGO_PEN.map(([key, value]) => ({key, static_value: value})),
273
+ children: logo.children ?? [],
274
+ };
275
+ const drawing: BlokComponentNode = {id: `${logo.id}.drawing`, component: 'Logo', props: drawingProps, children: [pen]};
276
+ return {
277
+ id: logo.id,
278
+ component: BLOK_COMPONENT,
279
+ props: [
280
+ {key: KIND_ATTRIBUTE, static_value: LOGO_KIND},
281
+ {key: CONTEXT_ATTRIBUTE, static_value: 'logo'},
282
+ ],
283
+ children: [drawing],
284
+ };
285
+ };
286
+
227
287
  export const iterWithParents = (tree: BlokComponentNode): Array<[BlokComponentNode, readonly BlokComponentNode[]]> => {
228
288
  const found: Array<[BlokComponentNode, readonly BlokComponentNode[]]> = [];
229
289
  const visit = (node: BlokComponentNode, ancestors: readonly BlokComponentNode[]) => {
@@ -1,6 +1,6 @@
1
1
  import {defaultBlokView, innerContext, type BlokView, type SpecComponent, type SpecProp} from '../spec/catalogs';
2
2
  import {BLOK_KINDS, kindIn, loadVocabulary, type BlokContextName, type BlokKind, type VocabFunction, type VocabRecordField} from '../spec/vocabulary';
3
- import {BLOK_COMPONENT, declaredQueries, declaredSubscriptions, QUERY_COMPONENT, SUBSCRIPTION_COMPONENT} from './declared';
3
+ import {BLOK_COMPONENT, declaredQueries, declaredSubscriptions, LOGO_COMPONENT, QUERY_COMPONENT, SUBSCRIPTION_COMPONENT} from './declared';
4
4
  import {resolveLocals} from './infer';
5
5
  import {FOREACH_COMPONENT, FOREACH_INDEX_PROP, FOREACH_LET_PROP, INTO_KEYWORD} from './parse';
6
6
  import {parseBsxPartial} from './partial';
@@ -333,7 +333,8 @@ const completeTag = (env: BsxEnvironment, cursor: Extract<BsxCursor, {kind: 'tag
333
333
  if (stack.length === 0) return [blokCompletion(from)];
334
334
  const parent = view.components.get(stack[stack.length - 1].tag);
335
335
  if (parent && !parent.acceptsChildren) return [];
336
- const ancestors = stack.map(element => element.tag);
336
+ // A blok's own <logo> is drawn inside a <Logo> (`blokLogoTree`): what may sit in one may sit in it.
337
+ const ancestors = stack.flatMap(element => (element.tag === LOGO_COMPONENT ? [element.tag, 'Logo'] : [element.tag]));
337
338
  const header = headerAt(stack);
338
339
  const atRoot = stack.length === 1 && stack[0].tag === BLOK_COMPONENT;
339
340
  const declarations = new Set(Object.keys(loadVocabulary().blok.declarations));
@@ -0,0 +1,47 @@
1
+ import {describe, expect, it} from 'vitest';
2
+ import {drawnChildren} from '../renderer/bloks/control';
3
+ import {blokLogoTree, content, declaredLogo, LOGO_VIEW_BOX} from './declared';
4
+ import {completeBsx} from './language';
5
+ import {parseBsx} from './parse';
6
+
7
+ const PANEL =
8
+ '<Blok kind="agent" context="panel"><logo title="Scope"><Circle cx="12" cy="12" r="7" /><Path d="M12 5v14" /></logo><Card><Text text="hi" /></Card></Blok>';
9
+
10
+ const props = (node: {props?: Array<{key: string; static_value?: unknown}> | null}) =>
11
+ Object.fromEntries((node.props ?? []).map(prop => [prop.key, prop.static_value]));
12
+
13
+ describe("a blok's own logo", () => {
14
+ it('draws nothing in the blok', () => {
15
+ const {tree} = parseBsx(PANEL);
16
+ expect(content(tree).map(node => node.component)).toEqual(['Card']);
17
+ expect(drawnChildren(tree).map(node => node.component)).toEqual(['Card']);
18
+ expect(declaredLogo(tree)?.component).toBe('logo');
19
+ });
20
+
21
+ it('is drawn as a logo blok of its own, with the action logos pen', () => {
22
+ const logo = blokLogoTree(parseBsx(PANEL).tree);
23
+ expect(logo).not.toBeNull();
24
+ expect(props(logo!)).toEqual({kind: 'agent', context: 'logo'});
25
+ const [drawing] = logo!.children ?? [];
26
+ expect(drawing.component).toBe('Logo');
27
+ expect(props(drawing)).toEqual({viewBox: LOGO_VIEW_BOX, title: 'Scope'});
28
+ const [pen] = drawing.children ?? [];
29
+ expect(pen.component).toBe('G');
30
+ expect(props(pen)).toMatchObject({fill: 'none', stroke: 'ink'});
31
+ expect((pen.children ?? []).map(node => node.component)).toEqual(['Circle', 'Path']);
32
+ });
33
+
34
+ it('is none when the blok declares none', () => {
35
+ expect(blokLogoTree(parseBsx('<Blok kind="agent" context="panel"><Card /></Blok>').tree)).toBeNull();
36
+ });
37
+
38
+ it('is offered at the top of a blok, and the logo shapes inside it', () => {
39
+ const atRoot = '<Blok kind="agent" context="panel"><|';
40
+ const top = completeBsx(atRoot.replace('|', ''), atRoot.indexOf('|'), {}).map(item => item.label);
41
+ expect(top).toContain('logo');
42
+ const inside = '<Blok kind="agent" context="panel"><logo><|';
43
+ const shapes = completeBsx(inside.replace('|', ''), inside.indexOf('|'), {}).map(item => item.label);
44
+ expect(shapes).toEqual(expect.arrayContaining(['Circle', 'Path']));
45
+ expect(shapes).not.toContain('Card');
46
+ });
47
+ });
@@ -27,6 +27,8 @@ import {
27
27
  iterWithParents,
28
28
  LIKE_PROP,
29
29
  LOCAL_COMPONENT,
30
+ LOGO_COMPONENT,
31
+ blokLogoTree,
30
32
  localName,
31
33
  localProblem,
32
34
  QUERY_COMPONENT,
@@ -616,6 +618,32 @@ class Checker {
616
618
 
617
619
  /* -- declarations -- */
618
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
+
619
647
  checkDeclarations(tree: BlokComponentNode): void {
620
648
  const {vocabulary, header} = this;
621
649
  const kind = this.kindName;
@@ -640,6 +668,7 @@ class Checker {
640
668
  this.checkDependencies(tree);
641
669
  this.checkLocalPositions(tree);
642
670
  this.checkQueries(tree);
671
+ this.checkLogoDeclaration(tree);
643
672
  for (const [name, sites] of intoSites(tree)) {
644
673
  this.into.add(name);
645
674
  if (vocabulary.reserved.has(name)) this.add('roots.reserved', sites[0].site, {name});
@@ -944,7 +973,12 @@ class Checker {
944
973
  const name = localDeclared(child);
945
974
  if (name !== null) inner.set(name, this.bindLocal(name, child, new Map(inner)));
946
975
  }
947
- for (const child of children) this.walkNode(child, inner, [...ancestors, node], inSlot);
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
+ }
948
982
  }
949
983
 
950
984
  private walkProp(node: BlokComponentNode, prop: BlokComponentProp, scope: Scope, inError: boolean): void {
@@ -1729,6 +1763,16 @@ export const checkBlokTree = (
1729
1763
  checker.checkDeclarations(tree);
1730
1764
  checker.walk(tree);
1731
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
+ }
1732
1772
  checker.finish();
1733
1773
  return checker.findings;
1734
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
 
@@ -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,