@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,7 +1,10 @@
|
|
|
1
|
+
import type { BindingName } from "../data/source.js";
|
|
1
2
|
import type { NodeId } from "../ids.js";
|
|
2
3
|
import type { JsonObject } from "../json.js";
|
|
3
4
|
import type { PrimitiveType } from "../primitive-type.js";
|
|
4
5
|
import type { PropsIssue, PropsVerdict } from "../render/props.js";
|
|
6
|
+
import { type BindingReader } from "../render/reads.js";
|
|
7
|
+
import { type SlotPlacer } from "../render/slots.js";
|
|
5
8
|
import type { LoomNode } from "../tree/node.js";
|
|
6
9
|
/**
|
|
7
10
|
* What a deployment's primitives are, as far as the write path is concerned.
|
|
@@ -74,6 +77,12 @@ export declare const describeUnknownPrimitive: (unknown: UnknownPrimitive) => st
|
|
|
74
77
|
* Reusing the type also means the two seams cannot drift: what the renderer
|
|
75
78
|
* would decline to draw is, by construction, what the write path declines to
|
|
76
79
|
* write.
|
|
80
|
+
*
|
|
81
|
+
* **A vocabulary is handed a node's own props, with the runtime's reserved keys
|
|
82
|
+
* already removed** — the same bag `renderElement` hands the validator, and the
|
|
83
|
+
* same bag the primitive itself is handed. That is the whole of the contract
|
|
84
|
+
* and it is stated here rather than left to each implementation, because the
|
|
85
|
+
* one thing this type exists to guarantee is that the two seams agree.
|
|
77
86
|
*/
|
|
78
87
|
export type PropsVocabulary = (type: PrimitiveType, props: JsonObject) => PropsVerdict;
|
|
79
88
|
/**
|
|
@@ -100,13 +109,24 @@ export type InvalidProps = {
|
|
|
100
109
|
* gives: an inserted band carries its own children, and a node three levels
|
|
101
110
|
* down that will not draw is the same hole.
|
|
102
111
|
*
|
|
103
|
-
* Reserved props are
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
112
|
+
* Reserved props are split off first, exactly as `renderElement` does, and the
|
|
113
|
+
* split is the same function rather than a second one that agrees. A `loom:`
|
|
114
|
+
* key is the runtime's own — it never reaches a primitive, so no primitive's
|
|
115
|
+
* schema has any business being asked about it, and every schema in the starter
|
|
116
|
+
* library is `.strict()` on the strength of that. A walk that handed the raw
|
|
117
|
+
* props over refused, at the write path's highest stakes, the very JSON
|
|
118
|
+
* `interpretation/prompt.ts` teaches a model to write.
|
|
119
|
+
*
|
|
120
|
+
* `partitionReservedProps` is not behind the render boundary: it lives in
|
|
121
|
+
* `reserved-props.ts` beside `json.ts`, for the reason that module gives — a
|
|
122
|
+
* reserved key is a property of a node's props rather than of rendering. Both
|
|
123
|
+
* seams reading the one copy is what makes their agreement a fact instead of a
|
|
124
|
+
* coincidence when a fifth key lands.
|
|
125
|
+
*
|
|
126
|
+
* What this does **not** do is judge the reserved keys themselves. A key the
|
|
127
|
+
* runtime does not recognise, or `loom:theme` somewhere other than the root,
|
|
128
|
+
* are real faults that the render seam reports and this seam stays silent
|
|
129
|
+
* about; 0203 records why, and what catching them here would cost.
|
|
110
130
|
*/
|
|
111
131
|
export declare const invalidPropsIn: (node: LoomNode, checkProps: PropsVocabulary) => readonly InvalidProps[];
|
|
112
132
|
/**
|
|
@@ -119,4 +139,141 @@ export declare const invalidPropsIn: (node: LoomNode, checkProps: PropsVocabular
|
|
|
119
139
|
* the refusal a repairer cannot act on.
|
|
120
140
|
*/
|
|
121
141
|
export declare const describeInvalidProps: (invalid: InvalidProps) => string;
|
|
142
|
+
/**
|
|
143
|
+
* What a deployment's primitives *read*, as far as the write path is concerned.
|
|
144
|
+
*
|
|
145
|
+
* The third question in this module, under the two above it. `PrimitiveVocabulary`
|
|
146
|
+
* answers *can this be drawn at all*; `PropsVocabulary` answers *will its own
|
|
147
|
+
* primitive accept what it carries*; this one answers the question a bound node
|
|
148
|
+
* raises and neither of those can see — the type is registered, the props are
|
|
149
|
+
* fine, and **is anything going to look at the answer this node is asking for?**
|
|
150
|
+
*
|
|
151
|
+
* A binding is a question the tree asks under a name, and the name is how the
|
|
152
|
+
* primitive reading it finds the answer (0058). Three of the four ways that
|
|
153
|
+
* declaration can be wrong are already refused before a delta lands: an
|
|
154
|
+
* unregistered source and an undeclared param are refused at the data seam, and
|
|
155
|
+
* a malformed `loom:data` never parses. The fourth resolves perfectly — a name
|
|
156
|
+
* nothing reads costs the host a round trip to its own source, hands the answer
|
|
157
|
+
* to a primitive that looks under a different name, and draws the empty state.
|
|
158
|
+
*
|
|
159
|
+
* `BindingReader`, the renderer's own seam, rather than a fourth vocabulary
|
|
160
|
+
* shaped for this side. It is the same move `PropsVocabulary` makes with
|
|
161
|
+
* `PropsVerdict` and for the identical reason: what the renderer reports as
|
|
162
|
+
* `data-unread` is then, by construction, what the write path declines to write,
|
|
163
|
+
* and an SDK registry already satisfies it structurally — so a host hands the
|
|
164
|
+
* same object to both seams and there is nothing here that can drift or go
|
|
165
|
+
* missing.
|
|
166
|
+
*
|
|
167
|
+
* Handed to the write path rather than declared on the policy, which is 0179's
|
|
168
|
+
* rule and this is the second thing it covers: a reader is behaviour, a policy
|
|
169
|
+
* is data with a fingerprint, and a policy carrying a function is a policy that
|
|
170
|
+
* cannot be compared with the one that decided yesterday.
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* What a host that has handed no reader gets, which is today's behaviour.
|
|
174
|
+
*
|
|
175
|
+
* `undefined` for every type rather than an empty list, and the asymmetry with
|
|
176
|
+
* `EVERY_TYPE_REGISTERED` is `unreadBindings`' own bargain rather than a second
|
|
177
|
+
* judgement: absence and emptiness are different answers (0181), `undefined`
|
|
178
|
+
* means *nobody has said*, and nothing is reported for it. A reader that
|
|
179
|
+
* answered `[]` would claim every primitive reads no binding and refuse every
|
|
180
|
+
* bound node on every deployment that has not opted in.
|
|
181
|
+
*/
|
|
182
|
+
export declare const NOTHING_DECLARED: BindingReader;
|
|
183
|
+
/** A question a change would leave on the page that no primitive will look at. */
|
|
184
|
+
export type UnreadBinding = {
|
|
185
|
+
readonly nodeId: NodeId;
|
|
186
|
+
readonly type: PrimitiveType;
|
|
187
|
+
/** The name the node asked under, which is the half the primitive does not hold. */
|
|
188
|
+
readonly name: BindingName;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Every binding in a subtree whose name its own primitive says it does not read,
|
|
192
|
+
* in document order and name-sorted within a node.
|
|
193
|
+
*
|
|
194
|
+
* Measured on the **declaration** rather than on the answers, which is the one
|
|
195
|
+
* place this walk differs from `reportUnreadBindings` in the renderer, and the
|
|
196
|
+
* difference is forced rather than chosen: there are no answers here. Nothing
|
|
197
|
+
* has been asked, no source has run, and the question of whether one *could*
|
|
198
|
+
* have answered is not this seam's. That turns out to be the stronger reading
|
|
199
|
+
* anyway — a name nothing reads is wrong whether or not the source behind it
|
|
200
|
+
* happens to be up.
|
|
201
|
+
*
|
|
202
|
+
* A node whose `loom:data` does not parse contributes nothing. `parseBindings`
|
|
203
|
+
* refuses the whole map together and the renderer reports that separately
|
|
204
|
+
* (0058); there are no names in a malformed declaration to be read, so there is
|
|
205
|
+
* nothing here to say about one that has not already been said louder.
|
|
206
|
+
*
|
|
207
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
208
|
+
* gives: an inserted band carries its own children, and a wasted round trip
|
|
209
|
+
* three levels down is the same wasted round trip.
|
|
210
|
+
*/
|
|
211
|
+
export declare const unreadBindingsIn: (node: LoomNode, reads: BindingReader) => readonly UnreadBinding[];
|
|
212
|
+
export declare const describeUnreadBinding: (unread: UnreadBinding) => string;
|
|
213
|
+
/**
|
|
214
|
+
* What a deployment's primitives *place*, as far as the write path is concerned.
|
|
215
|
+
*
|
|
216
|
+
* The fourth question in this module, and the one under the other three. The
|
|
217
|
+
* type is registered, its props are accepted, something will read the answer it
|
|
218
|
+
* asks for — and **is there anywhere for the content this node carries to go?**
|
|
219
|
+
*
|
|
220
|
+
* A `slot` child is a named region of authored content and the name is how the
|
|
221
|
+
* primitive receiving it decides where it goes (0051). A name the primitive
|
|
222
|
+
* places nowhere is the quietest way to lose authored content in a Loom page:
|
|
223
|
+
* the node draws, its own children draw, and the region's content and
|
|
224
|
+
* everything under it is dropped. 0249 made that a render diagnostic; this is
|
|
225
|
+
* the half that refuses to write one, the same pairing `BindingReader` already
|
|
226
|
+
* has on both sides of the seam.
|
|
227
|
+
*
|
|
228
|
+
* `SlotPlacer`, the renderer's own seam, rather than a vocabulary shaped for
|
|
229
|
+
* this side — the move `PropsVocabulary` and `BindingReader` both make, for
|
|
230
|
+
* their reason: what the renderer reports as `slot-unplaced` is then, by
|
|
231
|
+
* construction, what the write path declines to write, and an SDK registry
|
|
232
|
+
* satisfies it structurally, so a host hands one object to both seams and
|
|
233
|
+
* there is nothing here that can drift.
|
|
234
|
+
*/
|
|
235
|
+
/**
|
|
236
|
+
* What a host that has handed no placer gets, which is today's behaviour.
|
|
237
|
+
*
|
|
238
|
+
* `undefined` for every type, which is `unplacedSlots`' own bargain rather than
|
|
239
|
+
* a second judgement: a resolver that cannot say what a primitive places is not
|
|
240
|
+
* a resolver claiming every primitive places nothing, and a sentinel answering
|
|
241
|
+
* `[]` would refuse every slot child on every deployment that has not opted in.
|
|
242
|
+
*
|
|
243
|
+
* Note where this stops being symmetrical with `NOTHING_DECLARED`. For a *type
|
|
244
|
+
* a registry holds*, absence and emptiness are the same claim and a primitive
|
|
245
|
+
* that declared no regions places none (0249). The sentinel is the other
|
|
246
|
+
* question — whether anything has a registry at all — and the two answers are
|
|
247
|
+
* only spelled the same way.
|
|
248
|
+
*/
|
|
249
|
+
export declare const NOTHING_PLACED: SlotPlacer;
|
|
250
|
+
/** A region a change would fill on a primitive that places no region of that name. */
|
|
251
|
+
export type UnplacedSlot = {
|
|
252
|
+
readonly nodeId: NodeId;
|
|
253
|
+
readonly type: PrimitiveType;
|
|
254
|
+
/** The name the tree filled, which is the half the primitive does not hold. */
|
|
255
|
+
readonly name: string;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Every region filled in a subtree whose own primitive places it nowhere, in
|
|
259
|
+
* document order and name-sorted within a node.
|
|
260
|
+
*
|
|
261
|
+
* Read off each element's **direct** `slot` children, which is the same list
|
|
262
|
+
* `reportUnplacedSlots` reads in the renderer and for its reason: only direct
|
|
263
|
+
* slot children are routed to a primitive (0051), so a slot nested inside
|
|
264
|
+
* another slot's fallback renders where it sits and is nobody's region to
|
|
265
|
+
* place. `walkTree` reaches it anyway, and reading children rather than
|
|
266
|
+
* positions is what keeps this walk from reporting it.
|
|
267
|
+
*
|
|
268
|
+
* `unplacedSlots` is the comparison, shared with the renderer rather than
|
|
269
|
+
* repeated: it deduplicates, because two slot children sharing a name are both
|
|
270
|
+
* placed and so both lost by one mistake, and it sorts, because a list whose
|
|
271
|
+
* order depends on child order is one a test can only assert loosely.
|
|
272
|
+
*
|
|
273
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
274
|
+
* gives: an inserted band carries its own children, and a paragraph dropped
|
|
275
|
+
* three levels down is the same dropped paragraph.
|
|
276
|
+
*/
|
|
277
|
+
export declare const unplacedSlotsIn: (node: LoomNode, places: SlotPlacer) => readonly UnplacedSlot[];
|
|
278
|
+
export declare const describeUnplacedSlot: (unplaced: UnplacedSlot) => string;
|
|
122
279
|
//# sourceMappingURL=vocabulary.d.ts.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { parseBindings } from "../data/binding.js";
|
|
2
|
+
import { unreadBindings } from "../render/reads.js";
|
|
3
|
+
import { unplacedSlots } from "../render/slots.js";
|
|
4
|
+
import { partitionReservedProps } from "../reserved-props.js";
|
|
1
5
|
import { walkTree } from "../tree/navigation.js";
|
|
2
6
|
/**
|
|
3
7
|
* What a host that has declared no vocabulary gets, which is today's behaviour.
|
|
@@ -56,18 +60,30 @@ export const EVERY_TYPE_UNDECLARED = () => ({ outcome: "undeclared" });
|
|
|
56
60
|
* gives: an inserted band carries its own children, and a node three levels
|
|
57
61
|
* down that will not draw is the same hole.
|
|
58
62
|
*
|
|
59
|
-
* Reserved props are
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* Reserved props are split off first, exactly as `renderElement` does, and the
|
|
64
|
+
* split is the same function rather than a second one that agrees. A `loom:`
|
|
65
|
+
* key is the runtime's own — it never reaches a primitive, so no primitive's
|
|
66
|
+
* schema has any business being asked about it, and every schema in the starter
|
|
67
|
+
* library is `.strict()` on the strength of that. A walk that handed the raw
|
|
68
|
+
* props over refused, at the write path's highest stakes, the very JSON
|
|
69
|
+
* `interpretation/prompt.ts` teaches a model to write.
|
|
70
|
+
*
|
|
71
|
+
* `partitionReservedProps` is not behind the render boundary: it lives in
|
|
72
|
+
* `reserved-props.ts` beside `json.ts`, for the reason that module gives — a
|
|
73
|
+
* reserved key is a property of a node's props rather than of rendering. Both
|
|
74
|
+
* seams reading the one copy is what makes their agreement a fact instead of a
|
|
75
|
+
* coincidence when a fifth key lands.
|
|
76
|
+
*
|
|
77
|
+
* What this does **not** do is judge the reserved keys themselves. A key the
|
|
78
|
+
* runtime does not recognise, or `loom:theme` somewhere other than the root,
|
|
79
|
+
* are real faults that the render seam reports and this seam stays silent
|
|
80
|
+
* about; 0203 records why, and what catching them here would cost.
|
|
66
81
|
*/
|
|
67
82
|
export const invalidPropsIn = (node, checkProps) => Array.from(walkTree(node)).flatMap((current) => {
|
|
68
83
|
if (current.kind !== "element")
|
|
69
84
|
return [];
|
|
70
|
-
const
|
|
85
|
+
const { props } = partitionReservedProps(current.props);
|
|
86
|
+
const verdict = checkProps(current.type, props);
|
|
71
87
|
return verdict.outcome === "invalid"
|
|
72
88
|
? [{ nodeId: current.id, type: current.type, issues: verdict.issues }]
|
|
73
89
|
: [];
|
|
@@ -84,4 +100,161 @@ export const invalidPropsIn = (node, checkProps) => Array.from(walkTree(node)).f
|
|
|
84
100
|
export const describeInvalidProps = (invalid) => `${invalid.type} at ${invalid.nodeId} (${invalid.issues
|
|
85
101
|
.map((issue) => `${issue.path}: ${issue.message}`)
|
|
86
102
|
.join("; ")})`;
|
|
103
|
+
/**
|
|
104
|
+
* What a deployment's primitives *read*, as far as the write path is concerned.
|
|
105
|
+
*
|
|
106
|
+
* The third question in this module, under the two above it. `PrimitiveVocabulary`
|
|
107
|
+
* answers *can this be drawn at all*; `PropsVocabulary` answers *will its own
|
|
108
|
+
* primitive accept what it carries*; this one answers the question a bound node
|
|
109
|
+
* raises and neither of those can see — the type is registered, the props are
|
|
110
|
+
* fine, and **is anything going to look at the answer this node is asking for?**
|
|
111
|
+
*
|
|
112
|
+
* A binding is a question the tree asks under a name, and the name is how the
|
|
113
|
+
* primitive reading it finds the answer (0058). Three of the four ways that
|
|
114
|
+
* declaration can be wrong are already refused before a delta lands: an
|
|
115
|
+
* unregistered source and an undeclared param are refused at the data seam, and
|
|
116
|
+
* a malformed `loom:data` never parses. The fourth resolves perfectly — a name
|
|
117
|
+
* nothing reads costs the host a round trip to its own source, hands the answer
|
|
118
|
+
* to a primitive that looks under a different name, and draws the empty state.
|
|
119
|
+
*
|
|
120
|
+
* `BindingReader`, the renderer's own seam, rather than a fourth vocabulary
|
|
121
|
+
* shaped for this side. It is the same move `PropsVocabulary` makes with
|
|
122
|
+
* `PropsVerdict` and for the identical reason: what the renderer reports as
|
|
123
|
+
* `data-unread` is then, by construction, what the write path declines to write,
|
|
124
|
+
* and an SDK registry already satisfies it structurally — so a host hands the
|
|
125
|
+
* same object to both seams and there is nothing here that can drift or go
|
|
126
|
+
* missing.
|
|
127
|
+
*
|
|
128
|
+
* Handed to the write path rather than declared on the policy, which is 0179's
|
|
129
|
+
* rule and this is the second thing it covers: a reader is behaviour, a policy
|
|
130
|
+
* is data with a fingerprint, and a policy carrying a function is a policy that
|
|
131
|
+
* cannot be compared with the one that decided yesterday.
|
|
132
|
+
*/
|
|
133
|
+
/**
|
|
134
|
+
* What a host that has handed no reader gets, which is today's behaviour.
|
|
135
|
+
*
|
|
136
|
+
* `undefined` for every type rather than an empty list, and the asymmetry with
|
|
137
|
+
* `EVERY_TYPE_REGISTERED` is `unreadBindings`' own bargain rather than a second
|
|
138
|
+
* judgement: absence and emptiness are different answers (0181), `undefined`
|
|
139
|
+
* means *nobody has said*, and nothing is reported for it. A reader that
|
|
140
|
+
* answered `[]` would claim every primitive reads no binding and refuse every
|
|
141
|
+
* bound node on every deployment that has not opted in.
|
|
142
|
+
*/
|
|
143
|
+
export const NOTHING_DECLARED = { bindingsReadBy: () => undefined };
|
|
144
|
+
/**
|
|
145
|
+
* Every binding in a subtree whose name its own primitive says it does not read,
|
|
146
|
+
* in document order and name-sorted within a node.
|
|
147
|
+
*
|
|
148
|
+
* Measured on the **declaration** rather than on the answers, which is the one
|
|
149
|
+
* place this walk differs from `reportUnreadBindings` in the renderer, and the
|
|
150
|
+
* difference is forced rather than chosen: there are no answers here. Nothing
|
|
151
|
+
* has been asked, no source has run, and the question of whether one *could*
|
|
152
|
+
* have answered is not this seam's. That turns out to be the stronger reading
|
|
153
|
+
* anyway — a name nothing reads is wrong whether or not the source behind it
|
|
154
|
+
* happens to be up.
|
|
155
|
+
*
|
|
156
|
+
* A node whose `loom:data` does not parse contributes nothing. `parseBindings`
|
|
157
|
+
* refuses the whole map together and the renderer reports that separately
|
|
158
|
+
* (0058); there are no names in a malformed declaration to be read, so there is
|
|
159
|
+
* nothing here to say about one that has not already been said louder.
|
|
160
|
+
*
|
|
161
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
162
|
+
* gives: an inserted band carries its own children, and a wasted round trip
|
|
163
|
+
* three levels down is the same wasted round trip.
|
|
164
|
+
*/
|
|
165
|
+
export const unreadBindingsIn = (node, reads) => Array.from(walkTree(node)).flatMap((current) => {
|
|
166
|
+
if (current.kind !== "element")
|
|
167
|
+
return [];
|
|
168
|
+
const declared = reads.bindingsReadBy(current.type);
|
|
169
|
+
if (declared === undefined)
|
|
170
|
+
return [];
|
|
171
|
+
const bindings = parseBindings(current.props["loom:data"] ?? {});
|
|
172
|
+
if (!bindings.ok)
|
|
173
|
+
return [];
|
|
174
|
+
/**
|
|
175
|
+
* The seam decides in plain strings, so the brand is recovered by looking
|
|
176
|
+
* the answer back up among the names that were handed in rather than by
|
|
177
|
+
* asserting it — the move `parseBindings` makes one module over, for its
|
|
178
|
+
* reason: filtering keeps the one place that could be wrong honest.
|
|
179
|
+
*/
|
|
180
|
+
const asked = new Map(Array.from(bindings.value.keys()).map((name) => [name, name]));
|
|
181
|
+
return unreadBindings(asked.keys(), declared, current.props).flatMap((name) => {
|
|
182
|
+
const named = asked.get(name);
|
|
183
|
+
return named === undefined ? [] : [{ nodeId: current.id, type: current.type, name: named }];
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
export const describeUnreadBinding = (unread) => `${unread.nodeId} asks under "${unread.name}", which ${unread.type} does not read`;
|
|
187
|
+
/**
|
|
188
|
+
* What a deployment's primitives *place*, as far as the write path is concerned.
|
|
189
|
+
*
|
|
190
|
+
* The fourth question in this module, and the one under the other three. The
|
|
191
|
+
* type is registered, its props are accepted, something will read the answer it
|
|
192
|
+
* asks for — and **is there anywhere for the content this node carries to go?**
|
|
193
|
+
*
|
|
194
|
+
* A `slot` child is a named region of authored content and the name is how the
|
|
195
|
+
* primitive receiving it decides where it goes (0051). A name the primitive
|
|
196
|
+
* places nowhere is the quietest way to lose authored content in a Loom page:
|
|
197
|
+
* the node draws, its own children draw, and the region's content and
|
|
198
|
+
* everything under it is dropped. 0249 made that a render diagnostic; this is
|
|
199
|
+
* the half that refuses to write one, the same pairing `BindingReader` already
|
|
200
|
+
* has on both sides of the seam.
|
|
201
|
+
*
|
|
202
|
+
* `SlotPlacer`, the renderer's own seam, rather than a vocabulary shaped for
|
|
203
|
+
* this side — the move `PropsVocabulary` and `BindingReader` both make, for
|
|
204
|
+
* their reason: what the renderer reports as `slot-unplaced` is then, by
|
|
205
|
+
* construction, what the write path declines to write, and an SDK registry
|
|
206
|
+
* satisfies it structurally, so a host hands one object to both seams and
|
|
207
|
+
* there is nothing here that can drift.
|
|
208
|
+
*/
|
|
209
|
+
/**
|
|
210
|
+
* What a host that has handed no placer gets, which is today's behaviour.
|
|
211
|
+
*
|
|
212
|
+
* `undefined` for every type, which is `unplacedSlots`' own bargain rather than
|
|
213
|
+
* a second judgement: a resolver that cannot say what a primitive places is not
|
|
214
|
+
* a resolver claiming every primitive places nothing, and a sentinel answering
|
|
215
|
+
* `[]` would refuse every slot child on every deployment that has not opted in.
|
|
216
|
+
*
|
|
217
|
+
* Note where this stops being symmetrical with `NOTHING_DECLARED`. For a *type
|
|
218
|
+
* a registry holds*, absence and emptiness are the same claim and a primitive
|
|
219
|
+
* that declared no regions places none (0249). The sentinel is the other
|
|
220
|
+
* question — whether anything has a registry at all — and the two answers are
|
|
221
|
+
* only spelled the same way.
|
|
222
|
+
*/
|
|
223
|
+
export const NOTHING_PLACED = { slotsPlacedBy: () => undefined };
|
|
224
|
+
/**
|
|
225
|
+
* Every region filled in a subtree whose own primitive places it nowhere, in
|
|
226
|
+
* document order and name-sorted within a node.
|
|
227
|
+
*
|
|
228
|
+
* Read off each element's **direct** `slot` children, which is the same list
|
|
229
|
+
* `reportUnplacedSlots` reads in the renderer and for its reason: only direct
|
|
230
|
+
* slot children are routed to a primitive (0051), so a slot nested inside
|
|
231
|
+
* another slot's fallback renders where it sits and is nobody's region to
|
|
232
|
+
* place. `walkTree` reaches it anyway, and reading children rather than
|
|
233
|
+
* positions is what keeps this walk from reporting it.
|
|
234
|
+
*
|
|
235
|
+
* `unplacedSlots` is the comparison, shared with the renderer rather than
|
|
236
|
+
* repeated: it deduplicates, because two slot children sharing a name are both
|
|
237
|
+
* placed and so both lost by one mistake, and it sorts, because a list whose
|
|
238
|
+
* order depends on child order is one a test can only assert loosely.
|
|
239
|
+
*
|
|
240
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
241
|
+
* gives: an inserted band carries its own children, and a paragraph dropped
|
|
242
|
+
* three levels down is the same dropped paragraph.
|
|
243
|
+
*/
|
|
244
|
+
export const unplacedSlotsIn = (node, places) => Array.from(walkTree(node)).flatMap((current) => {
|
|
245
|
+
if (current.kind !== "element")
|
|
246
|
+
return [];
|
|
247
|
+
const filled = [];
|
|
248
|
+
for (const child of current.children)
|
|
249
|
+
if (child.kind === "slot")
|
|
250
|
+
filled.push(child.name);
|
|
251
|
+
if (filled.length === 0)
|
|
252
|
+
return [];
|
|
253
|
+
return unplacedSlots(filled, places.slotsPlacedBy(current.type)).map((name) => ({
|
|
254
|
+
nodeId: current.id,
|
|
255
|
+
type: current.type,
|
|
256
|
+
name,
|
|
257
|
+
}));
|
|
258
|
+
});
|
|
259
|
+
export const describeUnplacedSlot = (unplaced) => `${unplaced.nodeId} fills "${unplaced.name}", which ${unplaced.type} places nowhere`;
|
|
87
260
|
//# sourceMappingURL=vocabulary.js.map
|
package/dist/sdk/audit.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { DecorationLookup } from "../render/addressing.js";
|
|
2
|
+
import type { BindingName } from "../data/source.js";
|
|
3
|
+
import type { JsonObject } from "../json.js";
|
|
2
4
|
import type { PrimitiveType } from "../primitive-type.js";
|
|
3
5
|
import type { BehaviourName } from "../render/behaviour.js";
|
|
6
|
+
import type { PropsIssue } from "../render/props.js";
|
|
7
|
+
import { type BindingDeclaration } from "../render/reads.js";
|
|
4
8
|
import { type ConformanceVerdict, type PlacementVerdict, type ProbeAnswers, type ProbeFailure, type SubmissionVerdict } from "./conformance.js";
|
|
5
9
|
import type { PrimitiveRegistry } from "./registry.js";
|
|
6
10
|
/**
|
|
@@ -33,6 +37,18 @@ export type PrimitiveAudit = {
|
|
|
33
37
|
readonly declaresSubmits: boolean;
|
|
34
38
|
/** The props this primitive declared it frames (0095). Empty for almost all. */
|
|
35
39
|
readonly framesProps: readonly string[];
|
|
40
|
+
/**
|
|
41
|
+
* The configurations this primitive was probed under that its own schema
|
|
42
|
+
* refuses (0267).
|
|
43
|
+
*
|
|
44
|
+
* Non-empty does not mean anything is wrong: the verdicts above still hold,
|
|
45
|
+
* because what they report is *reach* — some configuration placed this
|
|
46
|
+
* region, some configuration decorated — and a bag the schema refuses that
|
|
47
|
+
* places a region is still evidence the component reads it. It is here so a
|
|
48
|
+
* reader can tell how much of a verdict rests on configurations no tree could
|
|
49
|
+
* carry, which for the starter library is thirty-two primitives' worth.
|
|
50
|
+
*/
|
|
51
|
+
readonly refusedConfigurations: readonly RefusedConfiguration[];
|
|
36
52
|
};
|
|
37
53
|
/** A primitive that declared a region and then did not render it. */
|
|
38
54
|
export type UnplacedSlots = {
|
|
@@ -44,6 +60,99 @@ export type UnplacedBehaviours = {
|
|
|
44
60
|
readonly type: PrimitiveType;
|
|
45
61
|
readonly behaviours: readonly BehaviourName[];
|
|
46
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Why a bound primitive was never probed in a state where it had an answer.
|
|
65
|
+
*
|
|
66
|
+
* Two causes, one list, because what a reader of this does about either is the
|
|
67
|
+
* same — hand `auditRegistry` an answer for that type — and because the second
|
|
68
|
+
* is reachable only by trying the first. A host that satisfies `notAnswered` by
|
|
69
|
+
* handing an answer keyed under a name the primitive does not read would, with
|
|
70
|
+
* only the first cause reported, get an empty list and the same wrong picture it
|
|
71
|
+
* started with.
|
|
72
|
+
*/
|
|
73
|
+
export type UnansweredReason =
|
|
74
|
+
/** The audit was handed no answers for this type at all. */
|
|
75
|
+
"no-answers"
|
|
76
|
+
/**
|
|
77
|
+
* It was handed some, and no state carried a name this primitive resolves to.
|
|
78
|
+
*
|
|
79
|
+
* *No* state rather than *some* state: a primitive reading two bindings and
|
|
80
|
+
* answered on one has been seen answered, and reporting it would make the list
|
|
81
|
+
* one a host cannot assert empty. This is the total miss only.
|
|
82
|
+
*/
|
|
83
|
+
| "names-not-answered";
|
|
84
|
+
/**
|
|
85
|
+
* A bound primitive the audit was not put in a position to see answered.
|
|
86
|
+
*
|
|
87
|
+
* The one entry here that is a fact about the **call** rather than about the
|
|
88
|
+
* component. Everything else this audit reports is something a probe observed;
|
|
89
|
+
* this says the probe was never told what it needed, which is why it is reported
|
|
90
|
+
* at all — a primitive that declares a region it places only for an answer reads
|
|
91
|
+
* as having dropped that region, and nothing in the output says the reader is
|
|
92
|
+
* looking at the audit's own blind spot rather than at a defect.
|
|
93
|
+
*
|
|
94
|
+
* 0185 gave the probe the seam and the permission that followed it sat for
|
|
95
|
+
* sixteen days with no caller, because a permission is the one kind of change no
|
|
96
|
+
* suite notices. This is the half that would have said so on the day.
|
|
97
|
+
*/
|
|
98
|
+
export type UnansweredReader = {
|
|
99
|
+
readonly type: PrimitiveType;
|
|
100
|
+
/**
|
|
101
|
+
* What its registrant declared it reads, unchanged — either of the two forms
|
|
102
|
+
* a declaration may take (0184).
|
|
103
|
+
*/
|
|
104
|
+
readonly reads: readonly BindingDeclaration<BindingName>[];
|
|
105
|
+
readonly reason: UnansweredReason;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* A configuration the probe built and the primitive's own schema refuses.
|
|
109
|
+
*
|
|
110
|
+
* The issues are the validator's, unchanged, because the reader of this has to
|
|
111
|
+
* know *which* prop is missing before they can hand one over — and because the
|
|
112
|
+
* same strings are what a tree carrying these props would have been refused
|
|
113
|
+
* with.
|
|
114
|
+
*/
|
|
115
|
+
export type RefusedConfiguration = {
|
|
116
|
+
readonly props: JsonObject;
|
|
117
|
+
readonly issues: readonly PropsIssue[];
|
|
118
|
+
};
|
|
119
|
+
/** Why the audit had no configuration a primitive's own schema accepts. */
|
|
120
|
+
export type UnconfiguredReason =
|
|
121
|
+
/** The audit was handed no props for this type, and `{}` is not enough. */
|
|
122
|
+
"no-props"
|
|
123
|
+
/**
|
|
124
|
+
* It was handed some, and the schema refused every configuration they built.
|
|
125
|
+
*
|
|
126
|
+
* Reachable only by trying the first, and reported for the reason
|
|
127
|
+
* `names-not-answered` is: a host told to empty this list by handing props
|
|
128
|
+
* over can hand over a bag that is refused too, and with only the first cause
|
|
129
|
+
* reported would get an empty list and the same unjudged primitive.
|
|
130
|
+
*/
|
|
131
|
+
| "props-not-accepted";
|
|
132
|
+
/**
|
|
133
|
+
* A primitive the audit could not put in a configuration its own schema accepts.
|
|
134
|
+
*
|
|
135
|
+
* The second entry here that is a fact about the **call** rather than about the
|
|
136
|
+
* component, and it is `notAnswered`'s shape for the same reason: a primitive
|
|
137
|
+
* that requires props and was handed none is probed with a bag no tree the Gate
|
|
138
|
+
* accepts can carry, so a throw under it is the probe's doing. Thirty-two of the
|
|
139
|
+
* hundred and seven starter primitives are in that position and none of them
|
|
140
|
+
* throws — every one hands its props to React, which renders a missing one as
|
|
141
|
+
* nothing — so this list is empty for the library it shipped with and becomes
|
|
142
|
+
* non-empty the first time somebody trims, uppercases or parses a required prop.
|
|
143
|
+
*
|
|
144
|
+
* What a reader does about it is hand `auditRegistry` a props bag for that type,
|
|
145
|
+
* which is the one thing that makes every other list on this audit a claim about
|
|
146
|
+
* the component again (0267).
|
|
147
|
+
*/
|
|
148
|
+
export type UnconfiguredPrimitive = {
|
|
149
|
+
readonly type: PrimitiveType;
|
|
150
|
+
/** The props its registration says it must have, name-sorted. */
|
|
151
|
+
readonly required: readonly string[];
|
|
152
|
+
readonly reason: UnconfiguredReason;
|
|
153
|
+
/** Every configuration the schema refused, with what it said about each. */
|
|
154
|
+
readonly refused: readonly RefusedConfiguration[];
|
|
155
|
+
};
|
|
47
156
|
/** A primitive that threw under some configuration its own schema accepts. */
|
|
48
157
|
export type ThrowingConfigurations = {
|
|
49
158
|
readonly type: PrimitiveType;
|
|
@@ -67,7 +176,15 @@ export type RegistryAudit = {
|
|
|
67
176
|
readonly audits: readonly PrimitiveAudit[];
|
|
68
177
|
/** Registered, renders, invisible to the portal. */
|
|
69
178
|
readonly notDecorated: readonly PrimitiveType[];
|
|
70
|
-
/**
|
|
179
|
+
/**
|
|
180
|
+
* The probe could not answer — neither a pass nor a failure.
|
|
181
|
+
*
|
|
182
|
+
* A primitive that threw under every configuration *its own schema refuses*
|
|
183
|
+
* is in `notConfigured` instead (0267). Both are "the probe got no answer",
|
|
184
|
+
* and only one of them is a fact about the component: a class or hook-using
|
|
185
|
+
* component cannot be called at all (0012), while a component nobody has
|
|
186
|
+
* handed required props to has not been asked a question it could answer.
|
|
187
|
+
*/
|
|
71
188
|
readonly notProbeable: readonly PrimitiveType[];
|
|
72
189
|
/**
|
|
73
190
|
* Declared a slot and dropped it. Unlike `notDecorated` this loses content
|
|
@@ -81,6 +198,33 @@ export type RegistryAudit = {
|
|
|
81
198
|
* the content a behaviour acts on renders perfectly without it.
|
|
82
199
|
*/
|
|
83
200
|
readonly unplacedBehaviours: readonly UnplacedBehaviours[];
|
|
201
|
+
/**
|
|
202
|
+
* Declared it reads a binding and was never probed in a state that answered
|
|
203
|
+
* one. Reported rather than failed, like `notDecorated` and for the same
|
|
204
|
+
* reason: whether it matters depends on the deployment (0012). A host
|
|
205
|
+
* auditing the library it ships asserts it empty, because an entry here means
|
|
206
|
+
* every other list on this audit is describing that primitive's unanswered
|
|
207
|
+
* branch and calling it the primitive.
|
|
208
|
+
*
|
|
209
|
+
* Unlike every other list, an entry is not a claim about the component. It is
|
|
210
|
+
* a claim about this call.
|
|
211
|
+
*/
|
|
212
|
+
readonly notAnswered: readonly UnansweredReader[];
|
|
213
|
+
/**
|
|
214
|
+
* Requires props and was probed under none its own schema accepts, so every
|
|
215
|
+
* other list on this audit is describing it under a bag no valid tree carries
|
|
216
|
+
* (0267).
|
|
217
|
+
*
|
|
218
|
+
* Reported for the same reason `notAnswered` is, and asserted empty by the
|
|
219
|
+
* same kind of host: an entry means the probe never reached this primitive,
|
|
220
|
+
* and the remedy is to hand `auditRegistry` props for that type. It is
|
|
221
|
+
* deliberately *not* every primitive whose default configuration was refused
|
|
222
|
+
* — that is thirty-two of the starter library, all of which answer anyway —
|
|
223
|
+
* only those where nothing the probe accepted came back at all.
|
|
224
|
+
*
|
|
225
|
+
* Like `notAnswered`, an entry is not a claim about the component.
|
|
226
|
+
*/
|
|
227
|
+
readonly notConfigured: readonly UnconfiguredPrimitive[];
|
|
84
228
|
/**
|
|
85
229
|
* Renders no children — a leaf. Not a fault: `loom.stat` holds its value and
|
|
86
230
|
* label as props and has nowhere to put a text node. It is here because it is
|
|
@@ -89,11 +233,18 @@ export type RegistryAudit = {
|
|
|
89
233
|
*/
|
|
90
234
|
readonly leaves: readonly PrimitiveType[];
|
|
91
235
|
/**
|
|
92
|
-
* Threw on props
|
|
236
|
+
* Threw on props its own schema **accepts**. A fault whoever registered it
|
|
93
237
|
* wants to know about — a tree the validator accepts can take the page down —
|
|
94
238
|
* and never a reason to distrust the rest of this audit, which is answered by
|
|
95
239
|
* the configurations that did render.
|
|
96
240
|
*
|
|
241
|
+
* Accepts, not merely *built from*: the probe's default configuration is the
|
|
242
|
+
* empty bag, which the schema of any primitive with a required prop refuses,
|
|
243
|
+
* and a throw under that is the probe handing a component props no tree could
|
|
244
|
+
* (0267). Those land in `notConfigured` or in the audit's
|
|
245
|
+
* `refusedConfigurations` and never here, so the sentence above is true of
|
|
246
|
+
* every row.
|
|
247
|
+
*
|
|
97
248
|
* Every primitive that threw is here, including one that threw under *all* of
|
|
98
249
|
* them. That case used to reach only `notProbeable`, beside the class and
|
|
99
250
|
* hook-using components that are legitimate primitives (0012), so the most
|
|
@@ -149,7 +300,13 @@ export type RegistryAudit = {
|
|
|
149
300
|
/**
|
|
150
301
|
* What the audit is told beyond the registry itself.
|
|
151
302
|
*
|
|
152
|
-
*
|
|
303
|
+
* Two fields, and both exist because a probe that reads a registration can only
|
|
304
|
+
* build a question out of what the registration *closes over*. A binding's
|
|
305
|
+
* answer is not in there (0185), and neither is a value for a required
|
|
306
|
+
* `z.string()` (0267) — so for both, the host who registered the primitive is
|
|
307
|
+
* asked rather than guessed at.
|
|
308
|
+
*
|
|
309
|
+
* The first exists because a probe that can only ask a primitive
|
|
153
310
|
* questions about its props cannot see a bound one at all (0185). `loom.feed`
|
|
154
311
|
* draws rows, an empty region, and a line for a source that did not answer;
|
|
155
312
|
* probed with no answers it draws the third of those under every configuration
|
|
@@ -171,6 +328,20 @@ export type RegistryAuditOptions = {
|
|
|
171
328
|
* `Object.prototype` for any name that happens to be on it.
|
|
172
329
|
*/
|
|
173
330
|
readonly answers?: ReadonlyMap<PrimitiveType, readonly ProbeAnswers[]>;
|
|
331
|
+
/**
|
|
332
|
+
* Props bags each type is probed from, beside the empty one (0267).
|
|
333
|
+
*
|
|
334
|
+
* For a primitive that requires nothing this changes nothing worth having —
|
|
335
|
+
* the empty bag is already accepted. For one that requires a prop the schema
|
|
336
|
+
* does not close over, it is the difference between an audit of the component
|
|
337
|
+
* and an audit of what it does when handed props no tree can carry.
|
|
338
|
+
*
|
|
339
|
+
* A bag per entry rather than one, because a primitive whose rendering turns
|
|
340
|
+
* on a required prop needs as many as there are branches — and each is varied
|
|
341
|
+
* by every closed choice in turn, so the cost is the sum again and not the
|
|
342
|
+
* product.
|
|
343
|
+
*/
|
|
344
|
+
readonly props?: ReadonlyMap<PrimitiveType, readonly JsonObject[]>;
|
|
174
345
|
};
|
|
175
346
|
export declare const auditRegistry: (registry: PrimitiveRegistry, options?: RegistryAuditOptions) => RegistryAudit;
|
|
176
347
|
/**
|