@jam-overture/loom 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/application/application.d.ts +109 -0
- package/dist/application/application.js +97 -0
- package/dist/application/memory.d.ts +20 -0
- package/dist/application/memory.js +79 -0
- package/dist/application/store.d.ts +101 -0
- package/dist/application/store.js +25 -0
- package/dist/audience/audience.d.ts +36 -0
- package/dist/audience/audience.js +41 -0
- package/dist/cli/templates.js +19 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +23 -1
- package/dist/data/resolve.d.ts +30 -3
- package/dist/data/resolve.js +11 -3
- package/dist/ids.d.ts +10 -0
- package/dist/ids.js +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/patch.d.ts +54 -0
- package/dist/patch.js +44 -0
- package/dist/project/closing.d.ts +51 -0
- package/dist/project/closing.js +53 -0
- package/dist/project/memory.d.ts +20 -0
- package/dist/project/memory.js +97 -0
- package/dist/project/project.d.ts +90 -0
- package/dist/project/project.js +91 -0
- package/dist/project/store.d.ts +135 -0
- package/dist/project/store.js +41 -0
- package/dist/registered.d.ts +64 -0
- package/dist/registered.js +118 -0
- package/dist/render/behaviour-adjust.d.ts +11 -19
- package/dist/render/behaviour-adjust.js +75 -21
- package/dist/render/behaviour-present.d.ts +8 -0
- package/dist/render/behaviour-present.js +57 -6
- package/dist/render/behaviour.d.ts +98 -17
- package/dist/render/behaviour.js +91 -26
- package/dist/render/control-name.d.ts +68 -0
- package/dist/render/control-name.js +37 -0
- package/dist/render/diagnostics.d.ts +72 -0
- package/dist/render/diagnostics.js +7 -0
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.js +2 -0
- package/dist/render/reads.d.ts +11 -0
- package/dist/render/reads.js +12 -1
- package/dist/render/render.js +102 -7
- package/dist/render/slots.d.ts +52 -0
- package/dist/render/slots.js +24 -0
- package/dist/render/theme.d.ts +54 -1
- package/dist/render/theme.js +23 -1
- package/dist/render/unshown.d.ts +152 -0
- package/dist/render/unshown.js +80 -0
- package/dist/runtime/analysis.d.ts +94 -9
- package/dist/runtime/analysis.js +54 -9
- package/dist/runtime/assessment.d.ts +36 -2
- package/dist/runtime/assessment.js +27 -2
- package/dist/runtime/checks.d.ts +148 -0
- package/dist/runtime/checks.js +112 -0
- package/dist/runtime/disposition.d.ts +96 -0
- package/dist/runtime/disposition.js +46 -0
- package/dist/runtime/gate.js +22 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/irreversibility.d.ts +64 -0
- package/dist/runtime/irreversibility.js +45 -0
- package/dist/runtime/pipeline.d.ts +43 -0
- package/dist/runtime/pipeline.js +10 -2
- package/dist/runtime/policy-change.d.ts +93 -0
- package/dist/runtime/policy-change.js +299 -0
- package/dist/runtime/policy-log.d.ts +406 -0
- package/dist/runtime/policy-log.js +285 -0
- package/dist/runtime/reversibility.d.ts +11 -9
- package/dist/runtime/stakes.d.ts +129 -1
- package/dist/runtime/stakes.js +240 -26
- package/dist/runtime/vocabulary.d.ts +164 -7
- package/dist/runtime/vocabulary.js +181 -8
- package/dist/sdk/audit.d.ts +174 -3
- package/dist/sdk/audit.js +176 -17
- package/dist/sdk/catalogue.d.ts +9 -1
- package/dist/sdk/conformance.d.ts +37 -3
- package/dist/sdk/conformance.js +25 -4
- package/dist/sdk/definition.d.ts +65 -0
- package/dist/sdk/definition.js +22 -0
- package/dist/sdk/registry.d.ts +29 -2
- package/dist/sdk/registry.js +63 -1
- package/dist/signals/action-change.d.ts +507 -0
- package/dist/signals/action-change.js +265 -0
- package/dist/signals/action.d.ts +331 -0
- package/dist/signals/action.js +182 -0
- package/dist/signals/applied-window.contract.d.ts +23 -0
- package/dist/signals/applied-window.contract.js +160 -0
- package/dist/signals/arriving.d.ts +210 -0
- package/dist/signals/arriving.js +133 -0
- package/dist/signals/audiences.d.ts +528 -0
- package/dist/signals/audiences.js +255 -0
- package/dist/signals/broadcast.d.ts +8 -2
- package/dist/signals/broadcast.js +58 -8
- package/dist/signals/change.d.ts +378 -0
- package/dist/signals/change.js +327 -0
- package/dist/signals/collect.d.ts +41 -0
- package/dist/signals/collect.js +88 -7
- package/dist/signals/copy-change.d.ts +553 -0
- package/dist/signals/copy-change.js +377 -0
- package/dist/signals/copy.d.ts +337 -0
- package/dist/signals/copy.js +211 -0
- package/dist/signals/counters.d.ts +46 -0
- package/dist/signals/counters.js +102 -0
- package/dist/signals/deliver.d.ts +23 -4
- package/dist/signals/deliver.js +34 -6
- package/dist/signals/deployment-change.d.ts +371 -0
- package/dist/signals/deployment-change.js +268 -0
- package/dist/signals/deployment.d.ts +265 -0
- package/dist/signals/deployment.js +152 -0
- package/dist/signals/door.d.ts +92 -0
- package/dist/signals/door.js +53 -0
- package/dist/signals/fold.d.ts +10 -0
- package/dist/signals/fold.js +5 -1
- package/dist/signals/form-action.d.ts +302 -0
- package/dist/signals/form-action.js +169 -0
- package/dist/signals/form-copy.d.ts +523 -0
- package/dist/signals/form-copy.js +346 -0
- package/dist/signals/forms.d.ts +247 -0
- package/dist/signals/forms.js +147 -0
- package/dist/signals/funnel-change.d.ts +548 -0
- package/dist/signals/funnel-change.js +361 -0
- package/dist/signals/funnel.d.ts +532 -0
- package/dist/signals/funnel.js +216 -0
- package/dist/signals/health.d.ts +497 -0
- package/dist/signals/health.js +361 -0
- package/dist/signals/index.d.ts +41 -0
- package/dist/signals/index.js +41 -0
- package/dist/signals/ingest.d.ts +56 -1
- package/dist/signals/ingest.js +91 -1
- package/dist/signals/journal.d.ts +11 -0
- package/dist/signals/kinds.d.ts +8 -6
- package/dist/signals/kinds.js +14 -6
- package/dist/signals/library-action.d.ts +430 -0
- package/dist/signals/library-action.js +336 -0
- package/dist/signals/library-change.d.ts +477 -0
- package/dist/signals/library-change.js +335 -0
- package/dist/signals/library-copy-change.d.ts +498 -0
- package/dist/signals/library-copy-change.js +476 -0
- package/dist/signals/library-pace.d.ts +319 -0
- package/dist/signals/library-pace.js +305 -0
- package/dist/signals/library-reach-change.d.ts +636 -0
- package/dist/signals/library-reach-change.js +534 -0
- package/dist/signals/library-reach.d.ts +377 -0
- package/dist/signals/library-reach.js +227 -0
- package/dist/signals/library-word-reach-change.d.ts +567 -0
- package/dist/signals/library-word-reach-change.js +568 -0
- package/dist/signals/library.d.ts +306 -0
- package/dist/signals/library.js +178 -0
- package/dist/signals/memory.d.ts +9 -0
- package/dist/signals/memory.js +105 -14
- package/dist/signals/migrate.d.ts +17 -2
- package/dist/signals/migrate.js +122 -5
- package/dist/signals/notice.d.ts +334 -0
- package/dist/signals/notice.js +228 -0
- package/dist/signals/pace-change.d.ts +501 -0
- package/dist/signals/pace-change.js +310 -0
- package/dist/signals/pace.d.ts +296 -0
- package/dist/signals/pace.js +291 -0
- package/dist/signals/page-views.d.ts +365 -0
- package/dist/signals/page-views.js +218 -0
- package/dist/signals/parts.d.ts +344 -0
- package/dist/signals/parts.js +273 -0
- package/dist/signals/postgres.d.ts +16 -2
- package/dist/signals/postgres.js +390 -87
- package/dist/signals/progress.d.ts +212 -0
- package/dist/signals/progress.js +150 -0
- package/dist/signals/ratios.d.ts +108 -0
- package/dist/signals/ratios.js +40 -0
- package/dist/signals/reach.d.ts +309 -0
- package/dist/signals/reach.js +93 -0
- package/dist/signals/readable.d.ts +34 -0
- package/dist/signals/readable.js +34 -0
- package/dist/signals/readership.d.ts +381 -0
- package/dist/signals/readership.js +308 -0
- package/dist/signals/region-pages.d.ts +173 -0
- package/dist/signals/region-pages.js +62 -0
- package/dist/signals/region.d.ts +287 -0
- package/dist/signals/region.js +198 -0
- package/dist/signals/retention.d.ts +141 -0
- package/dist/signals/retention.js +58 -0
- package/dist/signals/rollup.d.ts +67 -3
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +432 -1
- package/dist/signals/schema.js +157 -3
- package/dist/signals/signal.d.ts +237 -11
- package/dist/signals/signal.js +70 -10
- package/dist/signals/silence-census.d.ts +205 -0
- package/dist/signals/silence-census.js +87 -0
- package/dist/signals/silences.d.ts +848 -0
- package/dist/signals/silences.js +753 -0
- package/dist/signals/tally.d.ts +140 -11
- package/dist/signals/window-figures.d.ts +148 -0
- package/dist/signals/window-figures.js +42 -0
- package/dist/signals/window.d.ts +866 -0
- package/dist/signals/window.js +693 -0
- package/dist/signals/words.d.ts +24 -0
- package/dist/signals/words.js +24 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.js +19 -0
- package/dist/store/memory.d.ts +2 -1
- package/dist/store/memory.js +48 -12
- package/dist/store/migrate.d.ts +80 -0
- package/dist/store/migrate.js +259 -7
- package/dist/store/postgres-applications.d.ts +4 -0
- package/dist/store/postgres-applications.js +197 -0
- package/dist/store/postgres-holds.d.ts +10 -1
- package/dist/store/postgres-holds.js +116 -101
- package/dist/store/postgres-policy-log.d.ts +14 -0
- package/dist/store/postgres-policy-log.js +240 -0
- package/dist/store/postgres-projects.d.ts +4 -0
- package/dist/store/postgres-projects.js +217 -0
- package/dist/store/postgres.d.ts +16 -1
- package/dist/store/postgres.js +59 -9
- package/dist/store/replay.d.ts +102 -1
- package/dist/store/replay.js +190 -19
- package/dist/store/reseed.d.ts +238 -0
- package/dist/store/reseed.js +308 -0
- package/dist/store/schema.d.ts +450 -2
- package/dist/store/schema.js +141 -5
- package/dist/store/store.d.ts +29 -6
- package/dist/submit/resolve.js +2 -1
- package/dist/telemetry/calibration.d.ts +25 -0
- package/dist/telemetry/calibration.js +27 -1
- package/dist/telemetry/event.d.ts +391 -33
- package/dist/telemetry/event.js +84 -20
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/journal.d.ts +72 -3
- package/dist/telemetry/journal.js +9 -0
- package/dist/telemetry/lookup.d.ts +27 -0
- package/dist/telemetry/lookup.js +18 -0
- package/dist/telemetry/memory.js +23 -0
- package/dist/telemetry/migrate.js +22 -1
- package/dist/telemetry/postgres.d.ts +10 -1
- package/dist/telemetry/postgres.js +172 -90
- package/dist/telemetry/remeasure.d.ts +78 -0
- package/dist/telemetry/remeasure.js +83 -0
- package/dist/telemetry/retention.d.ts +2 -2
- package/dist/telemetry/schema.d.ts +17 -0
- package/dist/telemetry/schema.js +27 -1
- package/dist/telemetry/sink.d.ts +2 -2
- package/dist/testing/application-contract.d.ts +14 -0
- package/dist/testing/application-contract.js +270 -0
- package/dist/testing/contracts.d.ts +12 -7
- package/dist/testing/contracts.js +12 -7
- package/dist/testing/definitions.d.ts +78 -0
- package/dist/testing/definitions.js +134 -9
- package/dist/testing/doubles.d.ts +103 -0
- package/dist/testing/doubles.js +143 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/journal-contract.js +140 -2
- package/dist/testing/model-contract.d.ts +110 -0
- package/dist/testing/model-contract.js +150 -0
- package/dist/testing/policy-log-contract.d.ts +26 -0
- package/dist/testing/policy-log-contract.js +344 -0
- package/dist/testing/project-contract.d.ts +14 -0
- package/dist/testing/project-contract.js +266 -0
- package/dist/testing/reader-signal-contract.d.ts +27 -2
- package/dist/testing/reader-signal-contract.js +475 -5
- package/dist/testing/store-contract.d.ts +7 -1
- package/dist/testing/store-contract.js +84 -3
- package/dist/theme/apply.d.ts +20 -1
- package/dist/theme/apply.js +5 -3
- package/dist/theme/derive.d.ts +22 -0
- package/dist/theme/derive.js +54 -1
- package/dist/theme/library.js +1 -1
- package/dist/theme/measure.d.ts +34 -0
- package/dist/theme/measure.js +30 -1
- package/dist/theme/palettes.js +7 -7
- package/dist/theme/ramp.d.ts +64 -0
- package/dist/theme/ramp.js +114 -0
- package/dist/theme/registry.d.ts +9 -0
- package/dist/theme/registry.js +11 -1
- package/dist/theme/separation.d.ts +97 -3
- package/dist/theme/separation.js +75 -0
- package/dist/tree/compare.d.ts +9 -0
- package/dist/tree/compare.js +18 -0
- package/dist/write/computed.d.ts +60 -0
- package/dist/write/computed.js +61 -0
- package/dist/write/held.d.ts +59 -0
- package/dist/write/index.d.ts +5 -2
- package/dist/write/index.js +5 -2
- package/dist/write/reseed.d.ts +151 -0
- package/dist/write/reseed.js +184 -0
- package/dist/write/revert.js +2 -16
- package/package.json +98 -19
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { PrimitiveType } from "../primitive-type.js";
|
|
3
|
+
import { type ControlNameProps, type ControlNames } from "./control-name.js";
|
|
3
4
|
import type { PrimitiveText } from "./text.js";
|
|
4
5
|
export { DISCLOSED_ATTRIBUTE } from "./disclosed.js";
|
|
5
6
|
export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
|
|
7
|
+
export { NO_CONTROL_NAME_PROPS, NO_CONTROL_NAMES, resolveControlNames, type ControlNameProps, type ControlNames, } from "./control-name.js";
|
|
6
8
|
/**
|
|
7
9
|
* The behaviour seam: the things a primitive *does* that its props cannot carry.
|
|
8
10
|
*
|
|
@@ -79,6 +81,19 @@ export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
|
|
|
79
81
|
* carries why, and [0176](../../decisions/0176-a-control-may-be-answerable-to-another-control-and-they-agree-through-the-dom.md)
|
|
80
82
|
* records what was rejected.
|
|
81
83
|
*
|
|
84
|
+
* A fifth axis arrived with the first control whose word is not the framework's:
|
|
85
|
+
* **where a control's name comes from.** Every member's name is a string its
|
|
86
|
+
* primitive declared, per type, so every code panel's button reads *Copy* and a
|
|
87
|
+
* dictionary can translate all of them at once. That is right for an affordance
|
|
88
|
+
* and wrong for a trigger whose words are the page's own — *Watch the demo* is
|
|
89
|
+
* content, and a dialog opened by a chip reading *Open* is a worse page than no
|
|
90
|
+
* dialog. So a primitive may name one of its own props as where a control takes
|
|
91
|
+
* its name from, the runtime reads it off the node, and the declared string stays
|
|
92
|
+
* underneath as the floor; `control-name.ts` carries why that is narrower than a
|
|
93
|
+
* reserved prop, and
|
|
94
|
+
* [0234](../../decisions/0234-a-primitive-may-name-a-control-from-the-tree-and-its-declared-string-is-the-floor.md)
|
|
95
|
+
* records what was rejected.
|
|
96
|
+
*
|
|
82
97
|
* What a control hands back is not the same question as what a primitive may say
|
|
83
98
|
* about it, and the second one lives in `control.ts`: the class every control
|
|
84
99
|
* carries, and the custom property that decides whether it is displayed. Both
|
|
@@ -114,14 +129,26 @@ export type BehaviourName = (typeof BEHAVIOUR_NAMES)[number];
|
|
|
114
129
|
* .after { clip-path: inset(0 calc(100% - var(--loom-adjust, 50) * 1%) 0 0) }
|
|
115
130
|
* ```
|
|
116
131
|
*
|
|
117
|
-
* **The fallback is not optional and not decoration
|
|
118
|
-
*
|
|
119
|
-
* moment it unmounts — so the second
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
132
|
+
* **The fallback is not optional and not decoration**, and it holds for longer
|
|
133
|
+
* than it first appeared to. The property is absent until **the reader has
|
|
134
|
+
* moved the control**, and absent again the moment it unmounts — so the second
|
|
135
|
+
* argument to `var()` is what a page renders both with scripting off and with
|
|
136
|
+
* scripting on and nobody having touched it yet. It should be the position the
|
|
137
|
+
* primitive's own props declared.
|
|
138
|
+
*
|
|
139
|
+
* It was written as absent until the control *mounted*, which made a declared
|
|
140
|
+
* position visible only on an unscripted page: the control published the
|
|
141
|
+
* runtime's midpoint in its mount effect, so a band authored at 35 rendered at
|
|
142
|
+
* 35 and jumped to 50 as hydration landed. A control now publishes nothing it
|
|
143
|
+
* was not asked for, and says where it starts through
|
|
144
|
+
* {@link ADJUST_RESTING_PROPERTY} instead. Every taker was already required to
|
|
145
|
+
* write a fallback, so the narrower contract takes nothing away from one that
|
|
146
|
+
* followed it.
|
|
123
147
|
*
|
|
124
|
-
* See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
|
|
148
|
+
* See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
|
|
149
|
+
* for where the property goes and
|
|
150
|
+
* [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md)
|
|
151
|
+
* for when it is written.
|
|
125
152
|
*/
|
|
126
153
|
export declare const ADJUST_PROPERTY = "--loom-adjust";
|
|
127
154
|
/** The bottom of an adjust control's range. */
|
|
@@ -136,14 +163,45 @@ export declare const ADJUST_MINIMUM = 0;
|
|
|
136
163
|
*/
|
|
137
164
|
export declare const ADJUST_MAXIMUM = 100;
|
|
138
165
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
166
|
+
* The property a primitive declares to say **where its control should start**,
|
|
167
|
+
* on the element it places the control in. Read once, at mount, and never
|
|
168
|
+
* again — where the slider goes after that is the reader's.
|
|
169
|
+
*
|
|
170
|
+
* It exists because the obvious route to the same number is closed. `build`
|
|
171
|
+
* receives a node's text and its content, not its props, and that is 0086's
|
|
172
|
+
* shape rather than an omission: props are AI-authored, and a control a model
|
|
173
|
+
* configures is the thing the behaviour seam exists to prevent. So the number
|
|
174
|
+
* does not come through the seam. It comes the way `present` and `dismiss`
|
|
175
|
+
* agree (0176) — **through the DOM**, off the one element the primitive already
|
|
176
|
+
* chose by deciding where the control goes.
|
|
177
|
+
*
|
|
178
|
+
* Nothing new is exposed by that. A primitive taking `adjust` already renders
|
|
179
|
+
* its declared position into the page, as the `var()` fallback the still
|
|
180
|
+
* version is built on; this is the same number written where the control can
|
|
181
|
+
* read it, so the control starts where the page already is:
|
|
182
|
+
*
|
|
183
|
+
* ```ts
|
|
184
|
+
* const wipe = `var(${ADJUST_PROPERTY}, ${position})`
|
|
185
|
+
* // on the element the control is placed in:
|
|
186
|
+
* style: { [ADJUST_RESTING_PROPERTY]: position, ... }
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* Declaring it is optional and a primitive that leaves it out gets
|
|
190
|
+
* {@link ADJUST_RESTING}. What it may not do is declare one number here and a
|
|
191
|
+
* different one as the `var()` fallback — the first is where the control
|
|
192
|
+
* starts, the second is what a page with no scripting shows, and a page where
|
|
193
|
+
* those disagree is a page that moves on hydration. See
|
|
194
|
+
* [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md).
|
|
195
|
+
*/
|
|
196
|
+
export declare const ADJUST_RESTING_PROPERTY = "--loom-adjust-resting";
|
|
197
|
+
/**
|
|
198
|
+
* Where the control sits when nothing declared otherwise.
|
|
199
|
+
*
|
|
200
|
+
* The midpoint, and it is the runtime's floor rather than the answer: a
|
|
201
|
+
* primitive that has a position of its own says so with
|
|
202
|
+
* {@link ADJUST_RESTING_PROPERTY}, and this is what a primitive with no opinion
|
|
203
|
+
* gets. Fixed rather than declarable per node, for the reason the range is
|
|
204
|
+
* fixed — what a control rests at is not a model's to write.
|
|
147
205
|
*/
|
|
148
206
|
export declare const ADJUST_RESTING = 50;
|
|
149
207
|
type Behaviour = {
|
|
@@ -174,7 +232,19 @@ type Behaviour = {
|
|
|
174
232
|
* judgement the seam already makes about a control with no accessible name.
|
|
175
233
|
*/
|
|
176
234
|
readonly requires?: BehaviourName;
|
|
177
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Builds the control.
|
|
237
|
+
*
|
|
238
|
+
* Three arguments, and each is a different answer to *where does a control's
|
|
239
|
+
* word come from*. `content` is the node's own text, which is what a copy
|
|
240
|
+
* button acts on. `text` is the primitive's declared strings, laid over by
|
|
241
|
+
* whatever dictionary the deployment supplied. `name` is the word this node
|
|
242
|
+
* named its control with, or `undefined` where its primitive named no prop or
|
|
243
|
+
* the node filled none in — so every member decides for itself which of its
|
|
244
|
+
* strings a tree is allowed to replace, and `copy` lets a tree rename the
|
|
245
|
+
* button without touching what it says once it has copied.
|
|
246
|
+
*/
|
|
247
|
+
readonly build: (content: string, text: PrimitiveText<string>, name: string | undefined) => ReactNode;
|
|
178
248
|
};
|
|
179
249
|
export declare const BEHAVIOURS: Readonly<Record<BehaviourName, Behaviour>>;
|
|
180
250
|
export declare const isBehaviourName: (value: string) => value is BehaviourName;
|
|
@@ -210,6 +280,17 @@ export declare const NO_BEHAVIOURS: PrimitiveBehaviours<BehaviourName>;
|
|
|
210
280
|
*/
|
|
211
281
|
export interface BehaviourResolver {
|
|
212
282
|
readonly behavioursFor: (type: PrimitiveType) => readonly BehaviourName[];
|
|
283
|
+
/**
|
|
284
|
+
* The prop each of this type's controls takes its name from, where its author
|
|
285
|
+
* said so.
|
|
286
|
+
*
|
|
287
|
+
* Optional on the interface, and that is the only concession this seam makes
|
|
288
|
+
* to compatibility: a resolver written before a control could be named from a
|
|
289
|
+
* tree answers nothing here and is read as a library whose primitives all name
|
|
290
|
+
* their controls themselves, which is what it is. A registry built by the SDK
|
|
291
|
+
* always answers.
|
|
292
|
+
*/
|
|
293
|
+
readonly controlNamePropsFor?: (type: PrimitiveType) => ControlNameProps;
|
|
213
294
|
}
|
|
214
295
|
export declare const isBehaviourResolver: (value: object) => value is BehaviourResolver;
|
|
215
296
|
/** A declared behaviour whose control could not be given a name. */
|
|
@@ -239,5 +320,5 @@ export declare const NO_RESOLVED_BEHAVIOURS: ResolvedBehaviours;
|
|
|
239
320
|
* button, in exactly the way the finding that asked for this said a fake one
|
|
240
321
|
* would be.
|
|
241
322
|
*/
|
|
242
|
-
export declare const resolveBehaviours: (names: readonly BehaviourName[], content: string, text: PrimitiveText<string
|
|
323
|
+
export declare const resolveBehaviours: (names: readonly BehaviourName[], content: string, text: PrimitiveText<string>, named?: ControlNames) => ResolvedBehaviours;
|
|
243
324
|
//# sourceMappingURL=behaviour.d.ts.map
|
package/dist/render/behaviour.js
CHANGED
|
@@ -3,8 +3,10 @@ import { AdjustControl } from "./behaviour-adjust.js";
|
|
|
3
3
|
import { CopyControl } from "./behaviour-copy.js";
|
|
4
4
|
import { DiscloseControl } from "./behaviour-disclose.js";
|
|
5
5
|
import { DismissControl, PresentControl } from "./behaviour-present.js";
|
|
6
|
+
import { NO_CONTROL_NAMES } from "./control-name.js";
|
|
6
7
|
export { DISCLOSED_ATTRIBUTE } from "./disclosed.js";
|
|
7
8
|
export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
|
|
9
|
+
export { NO_CONTROL_NAME_PROPS, NO_CONTROL_NAMES, resolveControlNames, } from "./control-name.js";
|
|
8
10
|
/**
|
|
9
11
|
* The behaviour seam: the things a primitive *does* that its props cannot carry.
|
|
10
12
|
*
|
|
@@ -81,6 +83,19 @@ export { DISMISS_EVENT, PRESENTED_ATTRIBUTE } from "./presented.js";
|
|
|
81
83
|
* carries why, and [0176](../../decisions/0176-a-control-may-be-answerable-to-another-control-and-they-agree-through-the-dom.md)
|
|
82
84
|
* records what was rejected.
|
|
83
85
|
*
|
|
86
|
+
* A fifth axis arrived with the first control whose word is not the framework's:
|
|
87
|
+
* **where a control's name comes from.** Every member's name is a string its
|
|
88
|
+
* primitive declared, per type, so every code panel's button reads *Copy* and a
|
|
89
|
+
* dictionary can translate all of them at once. That is right for an affordance
|
|
90
|
+
* and wrong for a trigger whose words are the page's own — *Watch the demo* is
|
|
91
|
+
* content, and a dialog opened by a chip reading *Open* is a worse page than no
|
|
92
|
+
* dialog. So a primitive may name one of its own props as where a control takes
|
|
93
|
+
* its name from, the runtime reads it off the node, and the declared string stays
|
|
94
|
+
* underneath as the floor; `control-name.ts` carries why that is narrower than a
|
|
95
|
+
* reserved prop, and
|
|
96
|
+
* [0234](../../decisions/0234-a-primitive-may-name-a-control-from-the-tree-and-its-declared-string-is-the-floor.md)
|
|
97
|
+
* records what was rejected.
|
|
98
|
+
*
|
|
84
99
|
* What a control hands back is not the same question as what a primitive may say
|
|
85
100
|
* about it, and the second one lives in `control.ts`: the class every control
|
|
86
101
|
* carries, and the custom property that decides whether it is displayed. Both
|
|
@@ -115,14 +130,26 @@ export const BEHAVIOUR_NAMES = ["copy", "disclose", "adjust", "present", "dismis
|
|
|
115
130
|
* .after { clip-path: inset(0 calc(100% - var(--loom-adjust, 50) * 1%) 0 0) }
|
|
116
131
|
* ```
|
|
117
132
|
*
|
|
118
|
-
* **The fallback is not optional and not decoration
|
|
119
|
-
*
|
|
120
|
-
* moment it unmounts — so the second
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
133
|
+
* **The fallback is not optional and not decoration**, and it holds for longer
|
|
134
|
+
* than it first appeared to. The property is absent until **the reader has
|
|
135
|
+
* moved the control**, and absent again the moment it unmounts — so the second
|
|
136
|
+
* argument to `var()` is what a page renders both with scripting off and with
|
|
137
|
+
* scripting on and nobody having touched it yet. It should be the position the
|
|
138
|
+
* primitive's own props declared.
|
|
139
|
+
*
|
|
140
|
+
* It was written as absent until the control *mounted*, which made a declared
|
|
141
|
+
* position visible only on an unscripted page: the control published the
|
|
142
|
+
* runtime's midpoint in its mount effect, so a band authored at 35 rendered at
|
|
143
|
+
* 35 and jumped to 50 as hydration landed. A control now publishes nothing it
|
|
144
|
+
* was not asked for, and says where it starts through
|
|
145
|
+
* {@link ADJUST_RESTING_PROPERTY} instead. Every taker was already required to
|
|
146
|
+
* write a fallback, so the narrower contract takes nothing away from one that
|
|
147
|
+
* followed it.
|
|
124
148
|
*
|
|
125
|
-
* See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
|
|
149
|
+
* See [0096](../../decisions/0096-a-behaviour-publishes-a-value-on-the-element-the-primitive-placed-it-in.md)
|
|
150
|
+
* for where the property goes and
|
|
151
|
+
* [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md)
|
|
152
|
+
* for when it is written.
|
|
126
153
|
*/
|
|
127
154
|
export const ADJUST_PROPERTY = "--loom-adjust";
|
|
128
155
|
/** The bottom of an adjust control's range. */
|
|
@@ -137,14 +164,45 @@ export const ADJUST_MINIMUM = 0;
|
|
|
137
164
|
*/
|
|
138
165
|
export const ADJUST_MAXIMUM = 100;
|
|
139
166
|
/**
|
|
140
|
-
*
|
|
167
|
+
* The property a primitive declares to say **where its control should start**,
|
|
168
|
+
* on the element it places the control in. Read once, at mount, and never
|
|
169
|
+
* again — where the slider goes after that is the reader's.
|
|
170
|
+
*
|
|
171
|
+
* It exists because the obvious route to the same number is closed. `build`
|
|
172
|
+
* receives a node's text and its content, not its props, and that is 0086's
|
|
173
|
+
* shape rather than an omission: props are AI-authored, and a control a model
|
|
174
|
+
* configures is the thing the behaviour seam exists to prevent. So the number
|
|
175
|
+
* does not come through the seam. It comes the way `present` and `dismiss`
|
|
176
|
+
* agree (0176) — **through the DOM**, off the one element the primitive already
|
|
177
|
+
* chose by deciding where the control goes.
|
|
178
|
+
*
|
|
179
|
+
* Nothing new is exposed by that. A primitive taking `adjust` already renders
|
|
180
|
+
* its declared position into the page, as the `var()` fallback the still
|
|
181
|
+
* version is built on; this is the same number written where the control can
|
|
182
|
+
* read it, so the control starts where the page already is:
|
|
183
|
+
*
|
|
184
|
+
* ```ts
|
|
185
|
+
* const wipe = `var(${ADJUST_PROPERTY}, ${position})`
|
|
186
|
+
* // on the element the control is placed in:
|
|
187
|
+
* style: { [ADJUST_RESTING_PROPERTY]: position, ... }
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* Declaring it is optional and a primitive that leaves it out gets
|
|
191
|
+
* {@link ADJUST_RESTING}. What it may not do is declare one number here and a
|
|
192
|
+
* different one as the `var()` fallback — the first is where the control
|
|
193
|
+
* starts, the second is what a page with no scripting shows, and a page where
|
|
194
|
+
* those disagree is a page that moves on hydration. See
|
|
195
|
+
* [0226](../../decisions/0226-a-primitive-declares-where-its-control-rests-and-the-control-publishes-nothing-until-the-reader-moves-it.md).
|
|
196
|
+
*/
|
|
197
|
+
export const ADJUST_RESTING_PROPERTY = "--loom-adjust-resting";
|
|
198
|
+
/**
|
|
199
|
+
* Where the control sits when nothing declared otherwise.
|
|
141
200
|
*
|
|
142
|
-
* The midpoint, and it is the
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* a reader has a slider in front of them, where it started is theirs to change.
|
|
201
|
+
* The midpoint, and it is the runtime's floor rather than the answer: a
|
|
202
|
+
* primitive that has a position of its own says so with
|
|
203
|
+
* {@link ADJUST_RESTING_PROPERTY}, and this is what a primitive with no opinion
|
|
204
|
+
* gets. Fixed rather than declarable per node, for the reason the range is
|
|
205
|
+
* fixed — what a control rests at is not a model's to write.
|
|
148
206
|
*/
|
|
149
207
|
export const ADJUST_RESTING = 50;
|
|
150
208
|
export const BEHAVIOURS = {
|
|
@@ -152,9 +210,9 @@ export const BEHAVIOURS = {
|
|
|
152
210
|
description: "A control that puts the node's own text on the clipboard, and shows itself only where the clipboard is actually available.",
|
|
153
211
|
text: ["copy", "copied"],
|
|
154
212
|
rendersControl: true,
|
|
155
|
-
build: (content, text) => createElement(CopyControl, {
|
|
213
|
+
build: (content, text, name) => createElement(CopyControl, {
|
|
156
214
|
value: content,
|
|
157
|
-
label: text.copy ?? "",
|
|
215
|
+
label: name ?? text.copy ?? "",
|
|
158
216
|
copiedLabel: text.copied ?? "",
|
|
159
217
|
}),
|
|
160
218
|
},
|
|
@@ -173,8 +231,8 @@ export const BEHAVIOURS = {
|
|
|
173
231
|
description: "A control that opens and closes a region the primitive lays out beside it, and shows itself only where scripting actually runs.",
|
|
174
232
|
text: ["disclose"],
|
|
175
233
|
rendersControl: true,
|
|
176
|
-
build: (_content, text) => createElement(DiscloseControl, {
|
|
177
|
-
label: text.disclose ?? "",
|
|
234
|
+
build: (_content, text, name) => createElement(DiscloseControl, {
|
|
235
|
+
label: name ?? text.disclose ?? "",
|
|
178
236
|
}),
|
|
179
237
|
},
|
|
180
238
|
/**
|
|
@@ -195,8 +253,8 @@ export const BEHAVIOURS = {
|
|
|
195
253
|
description: "A control the reader drags to choose a number, published to the primitive as a CSS custom property so a stylesheet can compute a length from it.",
|
|
196
254
|
text: ["adjust"],
|
|
197
255
|
rendersControl: true,
|
|
198
|
-
build: (_content, text) => createElement(AdjustControl, {
|
|
199
|
-
label: text.adjust ?? "",
|
|
256
|
+
build: (_content, text, name) => createElement(AdjustControl, {
|
|
257
|
+
label: name ?? text.adjust ?? "",
|
|
200
258
|
}),
|
|
201
259
|
},
|
|
202
260
|
/**
|
|
@@ -214,8 +272,8 @@ export const BEHAVIOURS = {
|
|
|
214
272
|
description: "A control that opens a region the primitive lays out inside it and closes again on Escape, on a press outside, or on a dismiss control within it.",
|
|
215
273
|
text: ["present"],
|
|
216
274
|
rendersControl: true,
|
|
217
|
-
build: (_content, text) => createElement(PresentControl, {
|
|
218
|
-
label: text.present ?? "",
|
|
275
|
+
build: (_content, text, name) => createElement(PresentControl, {
|
|
276
|
+
label: name ?? text.present ?? "",
|
|
219
277
|
}),
|
|
220
278
|
},
|
|
221
279
|
/**
|
|
@@ -232,8 +290,8 @@ export const BEHAVIOURS = {
|
|
|
232
290
|
text: ["dismiss"],
|
|
233
291
|
rendersControl: true,
|
|
234
292
|
requires: "present",
|
|
235
|
-
build: (_content, text) => createElement(DismissControl, {
|
|
236
|
-
label: text.dismiss ?? "",
|
|
293
|
+
build: (_content, text, name) => createElement(DismissControl, {
|
|
294
|
+
label: name ?? text.dismiss ?? "",
|
|
237
295
|
}),
|
|
238
296
|
},
|
|
239
297
|
};
|
|
@@ -262,7 +320,7 @@ export const NO_RESOLVED_BEHAVIOURS = Object.freeze({
|
|
|
262
320
|
* button, in exactly the way the finding that asked for this said a fake one
|
|
263
321
|
* would be.
|
|
264
322
|
*/
|
|
265
|
-
export const resolveBehaviours = (names, content, text) => {
|
|
323
|
+
export const resolveBehaviours = (names, content, text, named = NO_CONTROL_NAMES) => {
|
|
266
324
|
if (names.length === 0)
|
|
267
325
|
return NO_RESOLVED_BEHAVIOURS;
|
|
268
326
|
const behaviours = Object.create(null);
|
|
@@ -270,11 +328,18 @@ export const resolveBehaviours = (names, content, text) => {
|
|
|
270
328
|
for (const name of names) {
|
|
271
329
|
const behaviour = BEHAVIOURS[name];
|
|
272
330
|
const missing = behaviour.text.find((key) => (text[key] ?? "").trim() === "");
|
|
331
|
+
/**
|
|
332
|
+
* Checked before the node's own word is considered, and that order is the
|
|
333
|
+
* decision rather than a detail. A primitive declaring no strings is a
|
|
334
|
+
* primitive whose control has no name in a deployment that translates, and
|
|
335
|
+
* one node happening to carry a usable word does not make it translatable —
|
|
336
|
+
* so a tree cannot talk a nameless control onto the page.
|
|
337
|
+
*/
|
|
273
338
|
if (missing !== undefined) {
|
|
274
339
|
unnamed.push({ behaviour: name, key: missing });
|
|
275
340
|
continue;
|
|
276
341
|
}
|
|
277
|
-
behaviours[name] = behaviour.build(content, text);
|
|
342
|
+
behaviours[name] = behaviour.build(content, text, named[name]);
|
|
278
343
|
}
|
|
279
344
|
return {
|
|
280
345
|
behaviours: Object.freeze(behaviours),
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { JsonObject } from "../json.js";
|
|
2
|
+
import type { BehaviourName } from "./behaviour.js";
|
|
3
|
+
/**
|
|
4
|
+
* Where a control's name comes from when the primitive's own vocabulary is the
|
|
5
|
+
* wrong place to keep it.
|
|
6
|
+
*
|
|
7
|
+
* Every string a control is announced by arrives through the text seam, per
|
|
8
|
+
* type: one `Copy` for every code panel in a deployment, translatable by a
|
|
9
|
+
* dictionary a host already has. That is right for an affordance — a word that
|
|
10
|
+
* names the *mechanism*, which a reader wants to be the same word everywhere —
|
|
11
|
+
* and it is wrong for the one control whose words are the page's own. A trigger
|
|
12
|
+
* that opens a dialog says *Watch the demo*; the next one on the same page says
|
|
13
|
+
* *Book a call*; neither is a thing a dictionary should hold and neither is a
|
|
14
|
+
* fact about the primitive.
|
|
15
|
+
*
|
|
16
|
+
* So a primitive may name **one of its own props** as where a control takes its
|
|
17
|
+
* name from, and the runtime reads it off the node. Three things make that
|
|
18
|
+
* narrower than it sounds, and they are why this is not a reserved prop:
|
|
19
|
+
*
|
|
20
|
+
* - **The primitive opts in, per control.** Nothing a tree writes turns this on.
|
|
21
|
+
* The declaration lives beside `frames` and `interactive`, in the component a
|
|
22
|
+
* human approved once, and the registry checks it names a prop the schema
|
|
23
|
+
* really declares.
|
|
24
|
+
* - **The declared string is still the floor.** A primitive taking a behaviour
|
|
25
|
+
* must declare its text whether or not it names a prop, so the control has a
|
|
26
|
+
* name in every language before any node is written — and a node that says
|
|
27
|
+
* nothing gets it.
|
|
28
|
+
* - **A string is what crosses the seam**, not the props. What a behaviour's
|
|
29
|
+
* `build` receives is still the node's text, the primitive's strings and now
|
|
30
|
+
* one resolved word; a control that could read props is a control a model
|
|
31
|
+
* configures, which is the thing the seam exists to prevent.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* What a primitive declared: the prop each of its controls is named by.
|
|
35
|
+
*
|
|
36
|
+
* Partial on purpose. A primitive naming one control and leaving the others to
|
|
37
|
+
* their declared strings is the ordinary case — a dialog's trigger carries the
|
|
38
|
+
* page's words and its cross is still *Close*.
|
|
39
|
+
*/
|
|
40
|
+
export type ControlNameProps = Readonly<Partial<Record<BehaviourName, string>>>;
|
|
41
|
+
/** The answer for a primitive that named none, which is almost all of them. */
|
|
42
|
+
export declare const NO_CONTROL_NAME_PROPS: ControlNameProps;
|
|
43
|
+
/**
|
|
44
|
+
* What one node resolved to: the words each control is announced by here.
|
|
45
|
+
*
|
|
46
|
+
* Partial again, and for a second reason: a prop the primitive named may be
|
|
47
|
+
* absent from this node, or hold something that is not a usable name, and both
|
|
48
|
+
* mean *this node said nothing* rather than *this control has no name*.
|
|
49
|
+
*/
|
|
50
|
+
export type ControlNames = Readonly<Partial<Record<BehaviourName, string>>>;
|
|
51
|
+
/** The answer for a node whose primitive named none, or that filled none in. */
|
|
52
|
+
export declare const NO_CONTROL_NAMES: ControlNames;
|
|
53
|
+
/**
|
|
54
|
+
* Reads the named props off one node.
|
|
55
|
+
*
|
|
56
|
+
* A value survives only if it is a string with something in it. Everything else
|
|
57
|
+
* — absent, `null`, a number, an object, whitespace — is dropped, and dropping
|
|
58
|
+
* it is the whole of the error handling here: what it falls back to is the
|
|
59
|
+
* string the primitive declared, which is a real name in the deployment's
|
|
60
|
+
* language rather than a hole.
|
|
61
|
+
*
|
|
62
|
+
* That is deliberately quieter than the frame seam, which reports a URL it
|
|
63
|
+
* refused. A frame that will not render is a thing the tree asked for and did
|
|
64
|
+
* not get; a name that was not written is a tree declining an option, and the
|
|
65
|
+
* page is correct either way. Nothing here is a diagnostic.
|
|
66
|
+
*/
|
|
67
|
+
export declare const resolveControlNames: (props: JsonObject, declared: ControlNameProps) => ControlNames;
|
|
68
|
+
//# sourceMappingURL=control-name.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The answer for a primitive that named none, which is almost all of them. */
|
|
2
|
+
export const NO_CONTROL_NAME_PROPS = Object.freeze(Object.create(null));
|
|
3
|
+
/** The answer for a node whose primitive named none, or that filled none in. */
|
|
4
|
+
export const NO_CONTROL_NAMES = Object.freeze(Object.create(null));
|
|
5
|
+
/**
|
|
6
|
+
* Reads the named props off one node.
|
|
7
|
+
*
|
|
8
|
+
* A value survives only if it is a string with something in it. Everything else
|
|
9
|
+
* — absent, `null`, a number, an object, whitespace — is dropped, and dropping
|
|
10
|
+
* it is the whole of the error handling here: what it falls back to is the
|
|
11
|
+
* string the primitive declared, which is a real name in the deployment's
|
|
12
|
+
* language rather than a hole.
|
|
13
|
+
*
|
|
14
|
+
* That is deliberately quieter than the frame seam, which reports a URL it
|
|
15
|
+
* refused. A frame that will not render is a thing the tree asked for and did
|
|
16
|
+
* not get; a name that was not written is a tree declining an option, and the
|
|
17
|
+
* page is correct either way. Nothing here is a diagnostic.
|
|
18
|
+
*/
|
|
19
|
+
export const resolveControlNames = (props, declared) => {
|
|
20
|
+
const names = Object.create(null);
|
|
21
|
+
let found = false;
|
|
22
|
+
for (const [behaviour, prop] of Object.entries(declared)) {
|
|
23
|
+
if (prop === undefined)
|
|
24
|
+
continue;
|
|
25
|
+
/** Own-property only: a prop called `constructor` must read as absent. */
|
|
26
|
+
const value = Object.hasOwn(props, prop) ? props[prop] : undefined;
|
|
27
|
+
if (typeof value !== "string")
|
|
28
|
+
continue;
|
|
29
|
+
const name = value.trim();
|
|
30
|
+
if (name === "")
|
|
31
|
+
continue;
|
|
32
|
+
names[behaviour] = name;
|
|
33
|
+
found = true;
|
|
34
|
+
}
|
|
35
|
+
return found ? Object.freeze(names) : NO_CONTROL_NAMES;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=control-name.js.map
|
|
@@ -9,6 +9,7 @@ import { type SubmissionError } from "../submit/declaration.js";
|
|
|
9
9
|
import { type EndpointId, type SubmissionUnavailable } from "../submit/endpoint.js";
|
|
10
10
|
import { type ThemeError } from "../theme/registry.js";
|
|
11
11
|
import type { PropsIssue } from "./props.js";
|
|
12
|
+
import { type UnshownFault } from "./unshown.js";
|
|
12
13
|
/**
|
|
13
14
|
* Rendering is total: it always returns an element. Anything it could not
|
|
14
15
|
* honour comes back beside the element as a diagnostic rather than as a thrown
|
|
@@ -76,6 +77,35 @@ export type RenderDiagnostic = {
|
|
|
76
77
|
readonly code: "reserved-prop-unrecognised";
|
|
77
78
|
readonly nodeId: NodeId;
|
|
78
79
|
readonly key: string;
|
|
80
|
+
} | {
|
|
81
|
+
/**
|
|
82
|
+
* A region the node filled under a name this primitive says it places
|
|
83
|
+
* nowhere. The content was rendered and then mounted by nothing, and it
|
|
84
|
+
* took its whole subtree with it.
|
|
85
|
+
*
|
|
86
|
+
* The sibling of `data-unread`, one node over: there a resolved answer is
|
|
87
|
+
* dropped, and here it is authored content. It is the quieter of the two
|
|
88
|
+
* and the more expensive — a binding nobody reads costs a round trip and
|
|
89
|
+
* draws an empty state, and a region nobody places removes words somebody
|
|
90
|
+
* wrote from a page that still looks finished. The loss is stated where a
|
|
91
|
+
* slot was given its meaning (0051), and until now nothing reported it.
|
|
92
|
+
*
|
|
93
|
+
* Reported per name rather than per slot child: two children sharing a
|
|
94
|
+
* name are both placed, so they are dropped by one mistake.
|
|
95
|
+
*
|
|
96
|
+
* Only ever reported when the resolver can say what a primitive places,
|
|
97
|
+
* which a registry can and a plain map cannot. Not reported for an
|
|
98
|
+
* unknown primitive, whose whole subtree is already omitted and said so.
|
|
99
|
+
*
|
|
100
|
+
* **Not** the conformance probe's *unplaced* (`sdk/conformance.ts`),
|
|
101
|
+
* which is the opposite fault: a region the primitive *declared* and no
|
|
102
|
+
* probed configuration drew. That one is addressed to whoever wrote the
|
|
103
|
+
* component; this one is addressed to whoever wrote the tree.
|
|
104
|
+
*/
|
|
105
|
+
readonly code: "slot-unplaced";
|
|
106
|
+
readonly nodeId: NodeId;
|
|
107
|
+
readonly type: PrimitiveType;
|
|
108
|
+
readonly name: string;
|
|
79
109
|
} | {
|
|
80
110
|
/**
|
|
81
111
|
* `loom:data` that is not a map of binding names to registered sources.
|
|
@@ -135,6 +165,48 @@ export type RenderDiagnostic = {
|
|
|
135
165
|
readonly nodeId: NodeId;
|
|
136
166
|
readonly type: PrimitiveType;
|
|
137
167
|
readonly name: string;
|
|
168
|
+
} | {
|
|
169
|
+
/**
|
|
170
|
+
* An answer arrived, under a name the primitive reads, and the primitive
|
|
171
|
+
* placed some of its rows and not the rest.
|
|
172
|
+
*
|
|
173
|
+
* The one way a binding can be wrong that is invisible from outside the
|
|
174
|
+
* component: each row has a shape only the primitive knows, so only the
|
|
175
|
+
* primitive can say that eleven of twelve stopped reading. A listing skips
|
|
176
|
+
* the row it cannot read and names it to the reader without a count
|
|
177
|
+
* (0175). There was nowhere else for it to say the count (0206).
|
|
178
|
+
*
|
|
179
|
+
* Both counts rather than the difference, because the sentence the author
|
|
180
|
+
* needs is *eleven of twelve*. Never the rows: a diagnostic is logged and
|
|
181
|
+
* a row is the host's data, the same line `data-unavailable` holds.
|
|
182
|
+
*
|
|
183
|
+
* Reported only when `shown < given`. An answer read whole is the ordinary
|
|
184
|
+
* case and would be one line per bound region in every log.
|
|
185
|
+
*/
|
|
186
|
+
readonly code: "data-unshown";
|
|
187
|
+
readonly nodeId: NodeId;
|
|
188
|
+
readonly type: PrimitiveType;
|
|
189
|
+
readonly name: string;
|
|
190
|
+
readonly given: number;
|
|
191
|
+
readonly shown: number;
|
|
192
|
+
} | {
|
|
193
|
+
/**
|
|
194
|
+
* A primitive declares what it could not show and its declaration could
|
|
195
|
+
* not be believed: it threw, or it returned a reading that cannot describe
|
|
196
|
+
* an answer.
|
|
197
|
+
*
|
|
198
|
+
* The node renders exactly as it would have. A declaration is bookkeeping
|
|
199
|
+
* about an answer, not part of drawing it, and a page lost to bookkeeping
|
|
200
|
+
* is the worst trade available here — so the fault becomes the thing it
|
|
201
|
+
* was trying to report.
|
|
202
|
+
*
|
|
203
|
+
* It is the one diagnostic in this union a tree cannot cause and a
|
|
204
|
+
* deployment cannot cause. It is addressed to whoever wrote the component.
|
|
205
|
+
*/
|
|
206
|
+
readonly code: "unshown-unreadable";
|
|
207
|
+
readonly nodeId: NodeId;
|
|
208
|
+
readonly type: PrimitiveType;
|
|
209
|
+
readonly fault: UnshownFault;
|
|
138
210
|
} | {
|
|
139
211
|
/**
|
|
140
212
|
* `loom:submit` that is not an endpoint id under `to`. The node renders —
|
|
@@ -5,6 +5,7 @@ import { assertNever } from "../result.js";
|
|
|
5
5
|
import { describeSubmissionError } from "../submit/declaration.js";
|
|
6
6
|
import { describeSubmissionUnavailable, } from "../submit/endpoint.js";
|
|
7
7
|
import { describeThemeError } from "../theme/registry.js";
|
|
8
|
+
import { describeUnshownFault } from "./unshown.js";
|
|
8
9
|
const describeIssues = (issues) => issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ");
|
|
9
10
|
export const describeRenderDiagnostic = (diagnostic) => {
|
|
10
11
|
switch (diagnostic.code) {
|
|
@@ -22,12 +23,18 @@ export const describeRenderDiagnostic = (diagnostic) => {
|
|
|
22
23
|
return `node ${diagnostic.nodeId} names a theme and is not the root, so it was ignored — a theme is mounted once, at the render root`;
|
|
23
24
|
case "reserved-prop-unrecognised":
|
|
24
25
|
return `node ${diagnostic.nodeId} carries "${diagnostic.key}", which is in the runtime's reserved namespace and is read by nothing, so it was dropped`;
|
|
26
|
+
case "slot-unplaced":
|
|
27
|
+
return `node ${diagnostic.nodeId} fills the region "${diagnostic.name}" and "${diagnostic.type}" places no region of that name, so the content and everything under it was dropped`;
|
|
25
28
|
case "data-misdeclared":
|
|
26
29
|
return `node ${diagnostic.nodeId} declares data that is not a map of binding names to sources, so it rendered with none — ${describeBindingError(diagnostic.error)}`;
|
|
27
30
|
case "data-unavailable":
|
|
28
31
|
return `node ${diagnostic.nodeId} binds "${diagnostic.name}" to "${diagnostic.source}" and it could not be answered — ${describeDataUnavailable(diagnostic.unavailable)}`;
|
|
29
32
|
case "data-unread":
|
|
30
33
|
return `node ${diagnostic.nodeId} binds "${diagnostic.name}" and "${diagnostic.type}" does not read a binding of that name, so the answer was resolved and then read by nobody`;
|
|
34
|
+
case "data-unshown":
|
|
35
|
+
return `node ${diagnostic.nodeId} was answered ${diagnostic.given} row${diagnostic.given === 1 ? "" : "s"} under "${diagnostic.name}" and "${diagnostic.type}" showed ${diagnostic.shown} of them, so the rest arrived and were not drawn`;
|
|
36
|
+
case "unshown-unreadable":
|
|
37
|
+
return `node ${diagnostic.nodeId} is drawn by "${diagnostic.type}", which says what it could not show and could not be believed, so nothing was reported of what it dropped — ${describeUnshownFault(diagnostic.fault)}`;
|
|
31
38
|
case "data-unresolved":
|
|
32
39
|
return diagnostic.resolution === "absent"
|
|
33
40
|
? `node ${diagnostic.nodeId} asks for data and this render was given no resolution, so it rendered with none`
|
package/dist/render/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export * from "./props.js";
|
|
|
30
30
|
export * from "./reads.js";
|
|
31
31
|
export * from "./render.js";
|
|
32
32
|
export * from "./request.js";
|
|
33
|
+
export * from "./slots.js";
|
|
33
34
|
export * from "./text.js";
|
|
34
35
|
export * from "./theme.js";
|
|
36
|
+
export * from "./unshown.js";
|
|
35
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/render/index.js
CHANGED
|
@@ -30,6 +30,8 @@ export * from "./props.js";
|
|
|
30
30
|
export * from "./reads.js";
|
|
31
31
|
export * from "./render.js";
|
|
32
32
|
export * from "./request.js";
|
|
33
|
+
export * from "./slots.js";
|
|
33
34
|
export * from "./text.js";
|
|
34
35
|
export * from "./theme.js";
|
|
36
|
+
export * from "./unshown.js";
|
|
35
37
|
//# sourceMappingURL=index.js.map
|
package/dist/render/reads.d.ts
CHANGED
|
@@ -52,6 +52,17 @@ export interface BindingReader {
|
|
|
52
52
|
readonly bindingsReadBy: (type: PrimitiveType) => readonly BindingDeclaration[] | undefined;
|
|
53
53
|
}
|
|
54
54
|
export declare const isBindingReader: (value: object) => value is BindingReader;
|
|
55
|
+
/**
|
|
56
|
+
* Every name a node carrying these props reads, one per declaration.
|
|
57
|
+
*
|
|
58
|
+
* Exported because a second instrument asks the same question of a state it is
|
|
59
|
+
* about to probe in rather than of a node — whether an answer it was handed is
|
|
60
|
+
* keyed under a name this primitive will look for — and the resolution has to be
|
|
61
|
+
* the walk's own or the two disagree about one declaration. Unsorted and not
|
|
62
|
+
* deduplicated: it answers *per declaration*, and `unreadBindings` wants a set
|
|
63
|
+
* while a caller reporting what a primitive asked for wants the list as declared.
|
|
64
|
+
*/
|
|
65
|
+
export declare const namesRead: (declared: readonly BindingDeclaration[], props: JsonObject) => readonly string[];
|
|
55
66
|
/**
|
|
56
67
|
* The names this node asked under that its primitive says it does not read.
|
|
57
68
|
*
|