@yaks/render 0.0.0-stage → 0.2.36

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.
Files changed (53) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +396 -2
  3. package/_dist/archetype.d.ts +3 -0
  4. package/_dist/archetype.d.ts.map +1 -0
  5. package/_dist/component.d.ts +15 -0
  6. package/_dist/component.d.ts.map +1 -0
  7. package/_dist/edit.d.ts +17 -0
  8. package/_dist/edit.d.ts.map +1 -0
  9. package/_dist/host.d.ts +59 -0
  10. package/_dist/host.d.ts.map +1 -0
  11. package/_dist/mod.d.ts +72 -0
  12. package/_dist/mod.d.ts.map +1 -0
  13. package/_dist/namespace.d.ts +12 -0
  14. package/_dist/namespace.d.ts.map +1 -0
  15. package/_dist/prepare.d.ts +11 -0
  16. package/_dist/prepare.d.ts.map +1 -0
  17. package/_dist/types.d.ts +66 -0
  18. package/_dist/types.d.ts.map +1 -0
  19. package/_dist/views.d.ts +88 -0
  20. package/_dist/views.d.ts.map +1 -0
  21. package/archetype.js +56 -0
  22. package/archetype.js.map +1 -0
  23. package/archetype.ts +76 -0
  24. package/component.js +39 -0
  25. package/component.js.map +1 -0
  26. package/component.ts +84 -0
  27. package/deno.json +1 -0
  28. package/edit.js +88 -0
  29. package/edit.js.map +1 -0
  30. package/edit.ts +113 -0
  31. package/host.js +191 -0
  32. package/host.js.map +1 -0
  33. package/host.ts +277 -0
  34. package/mod.js +158 -0
  35. package/mod.js.map +1 -0
  36. package/mod.ts +328 -0
  37. package/namespace.js +90 -0
  38. package/namespace.js.map +1 -0
  39. package/namespace.ts +121 -0
  40. package/package.json +31 -4
  41. package/prepare.js +32 -0
  42. package/prepare.js.map +1 -0
  43. package/prepare.ts +55 -0
  44. package/prop.js +37 -0
  45. package/prop.js.map +1 -0
  46. package/prop.ts +46 -0
  47. package/types.js +7 -0
  48. package/types.js.map +1 -0
  49. package/types.ts +116 -0
  50. package/views.js +333 -0
  51. package/views.js.map +1 -0
  52. package/views.ts +389 -0
  53. package/vocab.json +29 -0
package/namespace.ts ADDED
@@ -0,0 +1,121 @@
1
+ import { namesBetween } from '@yaks/graph'
2
+ import { reworded } from '@yaks/query'
3
+ import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
4
+ import type { Bundle } from 'jsr:@yaks/match@0.2.36'
5
+ import type { Context, Registration, Rendering } from './types.ts'
6
+
7
+ /** Attribute renderers from one package so a match reads the package's words. */
8
+ export let contributed = <R extends Registration>(
9
+ label: string,
10
+ entries: readonly R[],
11
+ ): R[] =>
12
+ entries.map((entry) => ({
13
+ ...entry,
14
+ namespace: entry.namespace ?? { label },
15
+ }))
16
+
17
+ let planned = new WeakMap<Registration, WeakMap<Vocab, Registration['match']>>()
18
+ export let matchIn = (
19
+ entry: Registration,
20
+ vocab: Vocab,
21
+ ): Registration['match'] => {
22
+ if (entry.match === true || !entry.namespace) return entry.match
23
+ let local = vocab.in(entry.namespace)
24
+ if (local === vocab) return entry.match
25
+ let plans = planned.get(entry)
26
+ if (!plans) planned.set(entry, plans = new WeakMap())
27
+ let match = plans.get(vocab)
28
+ if (!match) plans.set(vocab, match = reworded(entry.match, local, vocab))
29
+ return match
30
+ }
31
+
32
+ export let viewIn = (
33
+ entry: Registration,
34
+ vocab: Vocab,
35
+ ): {
36
+ local: Vocab
37
+ into: ReturnType<typeof namesBetween>
38
+ out: ReturnType<typeof namesBetween>
39
+ } | undefined => {
40
+ let local = entry.namespace ? vocab.in(entry.namespace) : vocab
41
+ if (local === vocab) return
42
+ return {
43
+ local,
44
+ into: namesBetween(vocab, local),
45
+ out: namesBetween(local, vocab),
46
+ }
47
+ }
48
+
49
+ export let needsIn = (
50
+ entry: Registration,
51
+ bundle: Bundle,
52
+ vocab: Vocab,
53
+ ): string[] =>
54
+ entry.needs?.(viewIn(entry, vocab)?.into.read([bundle])[0] ?? bundle) ?? []
55
+
56
+ export let renderingIn =
57
+ (entry: Registration, render: Rendering): Rendering => (bundle, h, ctx) => {
58
+ let words = ctx.vocab && viewIn(entry, ctx.vocab)
59
+ if (!words) return render(bundle, h, ctx)
60
+ let { into, out, local } = words
61
+ let keys = (context: Context, names: typeof into) => ({
62
+ ...context,
63
+ comp: context.comp && names.comp(context.comp),
64
+ prop: context.comp && context.prop
65
+ ? names.prop(context.comp, context.prop)
66
+ : context.prop,
67
+ })
68
+ let get = ctx.get as ((eid: string) => Bundle | undefined) | undefined
69
+ let query = ctx.query as ((q: string) => Bundle[] | undefined) | undefined
70
+ let related = ctx.related as
71
+ | ((eid: string, relation: string) => Bundle[])
72
+ | undefined
73
+ let node = into.read([bundle])[0]
74
+ return render(node, (tag, props, ...children) => {
75
+ let change = props?.onChange
76
+ if (
77
+ change && typeof change == 'object' && 'run' in change &&
78
+ typeof change.run == 'function'
79
+ ) {
80
+ let run = change.run as (row: Bundle, input?: unknown) => Bundle
81
+ props = {
82
+ ...props,
83
+ onChange: {
84
+ ...change,
85
+ run: (row: Bundle, input?: unknown) =>
86
+ out.write([run(into.read([row])[0], input)])[0],
87
+ },
88
+ }
89
+ }
90
+ return h(tag, props, ...children)
91
+ }, {
92
+ ...ctx,
93
+ ...keys(ctx, into),
94
+ vocab: local,
95
+ ...get
96
+ ? {
97
+ get: (eid: string) => {
98
+ let found = get(eid)
99
+ return found && into.read([found])[0]
100
+ },
101
+ }
102
+ : {},
103
+ ...query
104
+ ? {
105
+ query: (q: string) => {
106
+ let found = query(out.query(q))
107
+ return found && into.read(found)
108
+ },
109
+ }
110
+ : {},
111
+ ...related
112
+ ? {
113
+ related: (eid: string, relation: string) =>
114
+ into.read(related(eid, out.comp(relation))),
115
+ }
116
+ : {},
117
+ ...ctx.render
118
+ ? { render: (name, opts) => ctx.render!(name, opts && keys(opts, out)) }
119
+ : {},
120
+ })
121
+ }
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@yaks/render",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.36",
4
+ "homepage": "https://jsr.io/@yaks/render",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./_dist/mod.d.ts",
9
+ "default": "./mod.js"
10
+ },
11
+ "./views": {
12
+ "types": "./_dist/views.d.ts",
13
+ "default": "./views.js"
14
+ },
15
+ "./component": {
16
+ "types": "./_dist/component.d.ts",
17
+ "default": "./component.js"
18
+ },
19
+ "./host": {
20
+ "types": "./_dist/host.d.ts",
21
+ "default": "./host.js"
22
+ }
23
+ },
24
+ "license": "Apache-2.0",
25
+ "dependencies": {
26
+ "@yaks/graph": "0.2.36",
27
+ "@yaks/match": "0.2.36",
28
+ "@yaks/query": "0.2.36",
29
+ "@yaks/vocab": "0.2.36"
30
+ },
31
+ "description": "Selects views, editors, and actions for entity bundles through a query-matched registry independent of the rendering host.",
32
+ "repository": "https://github.com/yak-sh/yak.git"
33
+ }
package/prepare.js ADDED
@@ -0,0 +1,32 @@
1
+ // Preparing a renderer belongs to the host boundary. Selection keeps the
2
+ // complete registration list; preparing replaces implementations without
3
+ // changing metadata, ordering, or the caller's registry.
4
+ import { renderingIn } from "./namespace.js";
5
+ export async function prepared(registry, requested = registry.renderers) {
6
+ let wanted = new Set(requested);
7
+ let renderers = await Promise.all(registry.renderers.map(async (r)=>{
8
+ if (!wanted.has(r) || !('load' in r) || typeof r.load != 'function') {
9
+ return r;
10
+ }
11
+ let { load, ...metadata } = r;
12
+ return {
13
+ ...metadata,
14
+ render: await load()
15
+ };
16
+ }));
17
+ return {
18
+ ...registry,
19
+ renderers
20
+ };
21
+ }
22
+ /** A pure lowering reports deferred selections to its host. Without that
23
+ * boundary, an unprepared renderer is an error, not an empty drawing. */ export let rendering = (renderer, ctx)=>{
24
+ if (renderer.render) {
25
+ return renderer.namespace ? renderingIn(renderer, renderer.render) : renderer.render;
26
+ }
27
+ if (!ctx.deferred) {
28
+ throw new Error(`View ${renderer.view} requires preparation`);
29
+ }
30
+ ctx.deferred(renderer);
31
+ };
32
+ //# sourceMappingURL=prepare.js.map
package/prepare.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.js","sources":["./prepare.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,yDAAyD;AACzD,SAAS,WAAW,yBAAwB;AAqB5C,OAAO,eAAe,SACpB,QAA2B,EAC3B,YAA0B,SAAS,SAAS;EAE5C,IAAI,SAAS,IAAI,IAAI;EACrB,IAAI,YAAY,MAAM,QAAQ,GAAG,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,OAAO;IAC9D,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,OAAO,EAAE,IAAI,IAAI,YAAY;MACnE,OAAO;IACT;IACA,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,GAAG;IAC5B,OAAO;MAAE,GAAG,QAAQ;MAAE,QAAQ,MAAM;IAAO;EAC7C;EACA,OAAO;IAAE,GAAG,QAAQ;IAAE;EAAU;AAClC;AAEA;uEACuE,GACvE,OAAO,IAAI,YAAY,CACrB,UACA;EAEA,IAAI,SAAS,MAAM,EAAE;IACnB,OAAO,SAAS,SAAS,GACrB,YAAY,UAAU,SAAS,MAAM,IACrC,SAAS,MAAM;EACrB;EACA,IAAI,CAAC,IAAI,QAAQ,EAAE;IACjB,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,qBAAqB,CAAC;EAC9D;EACA,IAAI,QAAQ,CAAC;AACf,EAAC"}
package/prepare.ts ADDED
@@ -0,0 +1,55 @@
1
+ // Preparing a renderer belongs to the host boundary. Selection keeps the
2
+ // complete registration list; preparing replaces implementations without
3
+ // changing metadata, ordering, or the caller's registry.
4
+ import { renderingIn } from './namespace.js'
5
+ import type {
6
+ Registration,
7
+ Registry,
8
+ RenderContext,
9
+ Renderer,
10
+ Rendering,
11
+ } from './types.ts'
12
+
13
+ export type Prepared<R> = R extends { load: () => Promise<Rendering> }
14
+ ? Omit<R, 'load' | 'render'> & { render: Rendering }
15
+ : R
16
+
17
+ /** Prepare all renderers, or only the selected registrations a host demanded. */
18
+ export function prepared<R extends Registration, A, E>(
19
+ registry: Registry<R, A, E>,
20
+ ): Promise<Registry<Prepared<R>, A, E>>
21
+ export function prepared<R extends Registration, A, E>(
22
+ registry: Registry<R, A, E>,
23
+ requested: readonly R[],
24
+ ): Promise<Registry<R | Prepared<R>, A, E>>
25
+ export async function prepared<R extends Registration, A, E>(
26
+ registry: Registry<R, A, E>,
27
+ requested: readonly R[] = registry.renderers,
28
+ ): Promise<Registry<R | Prepared<R>, A, E>> {
29
+ let wanted = new Set(requested)
30
+ let renderers = await Promise.all(registry.renderers.map(async (r) => {
31
+ if (!wanted.has(r) || !('load' in r) || typeof r.load != 'function') {
32
+ return r
33
+ }
34
+ let { load, ...metadata } = r
35
+ return { ...metadata, render: await load() } as Prepared<R>
36
+ }))
37
+ return { ...registry, renderers }
38
+ }
39
+
40
+ /** A pure lowering reports deferred selections to its host. Without that
41
+ * boundary, an unprepared renderer is an error, not an empty drawing. */
42
+ export let rendering = <Node>(
43
+ renderer: Renderer,
44
+ ctx: RenderContext<Node>,
45
+ ): Rendering | undefined => {
46
+ if (renderer.render) {
47
+ return renderer.namespace
48
+ ? renderingIn(renderer, renderer.render)
49
+ : renderer.render
50
+ }
51
+ if (!ctx.deferred) {
52
+ throw new Error(`View ${renderer.view} requires preparation`)
53
+ }
54
+ ctx.deferred(renderer)
55
+ }
package/prop.js ADDED
@@ -0,0 +1,37 @@
1
+ import { derivedEid } from "@yaks/graph/identity";
2
+ import { loadVocab } from "@yaks/vocab/runtime";
3
+ import doc from './vocab.json' with {
4
+ type: 'json'
5
+ };
6
+ /** The schema of the property projection, used by the ordinary query matcher. */ export let propVocab = loadVocab([
7
+ doc
8
+ ]);
9
+ /** Read a declared property; an incomplete or unknown address is an error. */ export let declared = (vocab, ctx)=>{
10
+ let { comp, prop } = ctx;
11
+ if (comp == null || prop == null) {
12
+ throw new Error('property selection needs both comp and prop');
13
+ }
14
+ let schema = vocab.prop(comp, prop);
15
+ if (!schema) throw new Error(`unknown property: ${comp}.${prop}`);
16
+ return schema;
17
+ };
18
+ /** Computed and server-owned values can be shown, never patched by an editor. */ export let writable = (vocab, c)=>!!vocab.comp(c.comp)?.wire && !c.stamped && !c.computed;
19
+ /** Project the declaration, independently of the entity's current value. */ export let projection = (vocab, ctx)=>{
20
+ let schema = declared(vocab, ctx);
21
+ let { comp, prop } = schema;
22
+ let type = schema.category == 'scalar' ? schema.scalar : schema.category;
23
+ if (type == 'text') type = 'string';
24
+ if (type == 'bool') type = 'boolean';
25
+ return {
26
+ entity: {
27
+ eid: derivedEid(`prop|${comp}|${prop}`)
28
+ },
29
+ prop: {
30
+ comp,
31
+ prop,
32
+ type,
33
+ ref: schema.ref
34
+ }
35
+ };
36
+ };
37
+ //# sourceMappingURL=prop.js.map
package/prop.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop.js","sources":["./prop.ts"],"names":[],"mappings":"AAAA,SAAS,UAAU,oCAAyC;AAU5D,SAAS,SAAS,mCAA+D;AACjF,OAAO,SAAS,oBAAoB;EAAE,MAAM;AAAO,EAAC;AAGpD,+EAA+E,GAC/E,OAAO,IAAI,YAAmB,UAAU;EAAC;CAAI,EAAC;AAE9C,4EAA4E,GAC5E,OAAO,IAAI,WAAW,CAAC,OAAc;EACnC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG;EACrB,IAAI,QAAQ,QAAQ,QAAQ,MAAM;IAChC,MAAM,IAAI,MAAM;EAClB;EACA,IAAI,SAAS,MAAM,IAAI,CAAC,MAAM;EAC9B,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,KAAK,CAAC,EAAE,MAAM;EAChE,OAAO;AACT,EAAC;AAED,+EAA+E,GAC/E,OAAO,IAAI,WAAW,CAAC,OAAc,IACnC,CAAC,CAAC,MAAM,IAAI,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,QAAQ,CAAA;AAEzD,0EAA0E,GAC1E,OAAO,IAAI,aAAa,CAAC,OAAc;EACrC,IAAI,SAAS,SAAS,OAAO;EAC7B,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG;EACrB,IAAI,OAA2B,OAAO,QAAQ,IAAI,WAC9C,OAAO,MAAM,GACb,OAAO,QAAQ;EACnB,IAAI,QAAQ,QAAQ,OAAO;EAC3B,IAAI,QAAQ,QAAQ,OAAO;EAC3B,OAAO;IACL,QAAQ;MAAE,KAAK,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM;IAAE;IAClD,MAAM;MAAE;MAAM;MAAM;MAAM,KAAK,OAAO,GAAG;IAAC;EAC5C;AACF,EAAC"}
package/prop.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { derivedEid } from '@yaks/graph/identity'
2
+ /**
3
+ * A vocabulary property as a matchable bundle. This is a projection for
4
+ * selection, never a stored entity: editors receive the original bundle and
5
+ * {comp, prop}. The four queryable fields are prop.comp, prop.prop, prop.type
6
+ * and prop.ref. Type uses the vocabulary's own name for the scalar type, with
7
+ * text → string and bool → boolean; ref and enum keep their own categories.
8
+ */
9
+
10
+ import type { Bundle } from 'jsr:@yaks/match@0.2.36'
11
+ import { loadVocab, type Prop, type Vocab } from '@yaks/vocab/runtime'
12
+ import doc from './vocab.json' with { type: 'json' }
13
+ import type { Context } from './types.ts'
14
+
15
+ /** The schema of the property projection, used by the ordinary query matcher. */
16
+ export let propVocab: Vocab = loadVocab([doc])
17
+
18
+ /** Read a declared property; an incomplete or unknown address is an error. */
19
+ export let declared = (vocab: Vocab, ctx: Context): Prop => {
20
+ let { comp, prop } = ctx
21
+ if (comp == null || prop == null) {
22
+ throw new Error('property selection needs both comp and prop')
23
+ }
24
+ let schema = vocab.prop(comp, prop)
25
+ if (!schema) throw new Error(`unknown property: ${comp}.${prop}`)
26
+ return schema
27
+ }
28
+
29
+ /** Computed and server-owned values can be shown, never patched by an editor. */
30
+ export let writable = (vocab: Vocab, c: Prop): boolean =>
31
+ !!vocab.comp(c.comp)?.wire && !c.stamped && !c.computed
32
+
33
+ /** Project the declaration, independently of the entity's current value. */
34
+ export let projection = (vocab: Vocab, ctx: Context): Bundle => {
35
+ let schema = declared(vocab, ctx)
36
+ let { comp, prop } = schema
37
+ let type: string | undefined = schema.category == 'scalar'
38
+ ? schema.scalar
39
+ : schema.category
40
+ if (type == 'text') type = 'string'
41
+ if (type == 'bool') type = 'boolean'
42
+ return {
43
+ entity: { eid: derivedEid(`prop|${comp}|${prop}`) },
44
+ prop: { comp, prop, type, ref: schema.ref },
45
+ }
46
+ }
package/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The portable renderer contract: a tree belongs to the injected hyperscript,
3
+ * while selection and actions remain data. A renderer is generic over the node
4
+ * type its backend builds, so the same registration can be given to a browser
5
+ * backend or to a text one.
6
+ */
7
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["./types.ts"],"names":[],"mappings":"AAAA;;;;;CAKC,GAED"}
package/types.ts ADDED
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The portable renderer contract: a tree belongs to the injected hyperscript,
3
+ * while selection and actions remain data. A renderer is generic over the node
4
+ * type its backend builds, so the same registration can be given to a browser
5
+ * backend or to a text one.
6
+ */
7
+
8
+ import type { Bundle } from 'jsr:@yaks/match@0.2.36'
9
+ import type { Query } from 'jsr:@yaks/query@0.2.36'
10
+ import type { Namespace, Vocab } from 'jsr:@yaks/vocab@0.2.36'
11
+ import type { ArchetypeLookup } from './archetype.ts'
12
+
13
+ /** A node the backend built, literal content, an empty child, or nested
14
+ * children. */
15
+ export type Child<Node> =
16
+ | Node
17
+ | string
18
+ | number
19
+ | boolean
20
+ | null
21
+ | undefined
22
+ | readonly Child<Node>[]
23
+
24
+ /** The shared set of element names; each backend decides what a tag becomes. */
25
+ export type H<Node> = (
26
+ tag: string,
27
+ props: Record<string, unknown> | null,
28
+ ...children: Child<Node>[]
29
+ ) => Node
30
+
31
+ /** Extra values the caller supplies; comp and prop together select a property
32
+ * schema. */
33
+ export type Context = {
34
+ comp?: string
35
+ prop?: string
36
+ [key: string]: unknown
37
+ }
38
+
39
+ /** The backend supplies nested rendering through the same registry and
40
+ * bundle, and the vocabulary the renderer was chosen by, for a view that
41
+ * reads what it declares (a computed status). */
42
+ export type RenderContext<Node> = Context & {
43
+ render?: (view: string, ctx?: Context) => Node | null
44
+ vocab?: Vocab
45
+ /** A lowering reports the selected renderer's declared reference needs. */
46
+ needed?: (eids: readonly string[]) => void
47
+ /** Report a selected renderer whose implementation the host must prepare. */
48
+ deferred?: (renderer: Renderer) => void
49
+ }
50
+
51
+ /** The fields selection needs, shared by portable renderers and by ones a
52
+ * backend defines itself. */
53
+ export type Registration = {
54
+ view: string
55
+ namespace?: Namespace
56
+ match: Query | true
57
+ /** Additional entities this view reads, supplied by the host. */
58
+ needs?: (bundle: Bundle) => string[]
59
+ }
60
+
61
+ /** A pure view of a bundle, independent of any backend's node type. */
62
+ export type Rendering = <Node>(
63
+ bundle: Bundle,
64
+ h: H<Node>,
65
+ ctx: RenderContext<Node>,
66
+ ) => Node
67
+
68
+ /** Selection reads the same metadata before and after preparation. */
69
+ export type Renderer =
70
+ & Registration
71
+ & (
72
+ | { render: Rendering; load?: never }
73
+ | { load: () => Promise<Rendering>; render?: never }
74
+ )
75
+
76
+ /** Component changes for the caller to apply to the action's entity. */
77
+ export type Patch = Record<string, Record<string, unknown> | null>
78
+
79
+ /** An offered verb; listing it never invokes run or applies its patch. */
80
+ export type Action = {
81
+ name: string
82
+ when?: Query
83
+ run: (bundle: Bundle, input?: unknown) => Patch
84
+ }
85
+
86
+ /** A dynamic contribution; selection reads a bundle, while the source stays typed. */
87
+ export type Contributor<A = Action, E = Bundle> = {
88
+ match: Query | true
89
+ acts: (source: E) => readonly (A & { when?: Query })[]
90
+ }
91
+
92
+ /** Registry configuration; actions preserve component and contribution order. */
93
+ export type Options<A = Action, E = Bundle> = {
94
+ /** Immutable table sets held by the caller's descriptor subscription. */
95
+ archetypes?: ArchetypeLookup
96
+ actions?:
97
+ | Readonly<Record<string, readonly (A & { when?: Query })[]>>
98
+ | readonly Contributor<A, E>[]
99
+ /** Vocabulary for action conditions when actions() is called with two args. */
100
+ vocab?: Vocab
101
+ /** Views eligible for an unnamed request; defaults to every registered view. */
102
+ views?: readonly string[]
103
+ }
104
+
105
+ /** One curated registry, with no global registrations and no backend state. */
106
+ export type Registry<
107
+ R extends Registration = Renderer,
108
+ A = Action,
109
+ E = Bundle,
110
+ > = Options<A, E> & { renderers: readonly R[] }
111
+
112
+ /** The part of a registry selection needs, independent of its action types. */
113
+ export type Selection<R extends Registration = Renderer> = Pick<
114
+ Registry<R>,
115
+ 'renderers' | 'views' | 'archetypes'
116
+ >