@jam-overture/loom 0.1.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/LICENSE +21 -0
- package/README.md +743 -0
- package/dist/catalogue.d.ts +70 -0
- package/dist/catalogue.js +88 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +83 -0
- package/dist/cli/filesystem.d.ts +15 -0
- package/dist/cli/filesystem.js +31 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +30 -0
- package/dist/cli/namespace.d.ts +40 -0
- package/dist/cli/namespace.js +40 -0
- package/dist/cli/plan.d.ts +84 -0
- package/dist/cli/plan.js +113 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.js +75 -0
- package/dist/cli/templates.d.ts +43 -0
- package/dist/cli/templates.js +134 -0
- package/dist/closed-set.d.ts +34 -0
- package/dist/closed-set.js +34 -0
- package/dist/data/adapter.d.ts +123 -0
- package/dist/data/adapter.js +91 -0
- package/dist/data/binding.d.ts +48 -0
- package/dist/data/binding.js +39 -0
- package/dist/data/catalogue.d.ts +26 -0
- package/dist/data/catalogue.js +6 -0
- package/dist/data/index.d.ts +14 -0
- package/dist/data/index.js +14 -0
- package/dist/data/plan.d.ts +58 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +91 -0
- package/dist/data/resolution.js +96 -0
- package/dist/data/resolve.d.ts +46 -0
- package/dist/data/resolve.js +37 -0
- package/dist/data/source.d.ts +40 -0
- package/dist/data/source.js +45 -0
- package/dist/deadline.d.ts +57 -0
- package/dist/deadline.js +78 -0
- package/dist/frame/catalogue.d.ts +24 -0
- package/dist/frame/catalogue.js +5 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/frame/origin.d.ts +87 -0
- package/dist/frame/origin.js +114 -0
- package/dist/frame/resolution.d.ts +85 -0
- package/dist/frame/resolution.js +79 -0
- package/dist/grammar.d.ts +26 -0
- package/dist/grammar.js +28 -0
- package/dist/ids.d.ts +57 -0
- package/dist/ids.js +104 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/interactivity.d.ts +50 -0
- package/dist/interactivity.js +22 -0
- package/dist/interpretation/anthropic.d.ts +22 -0
- package/dist/interpretation/anthropic.js +76 -0
- package/dist/interpretation/client.d.ts +83 -0
- package/dist/interpretation/client.js +2 -0
- package/dist/interpretation/draft.d.ts +234 -0
- package/dist/interpretation/draft.js +84 -0
- package/dist/interpretation/index.d.ts +15 -0
- package/dist/interpretation/index.js +15 -0
- package/dist/interpretation/interpreter.d.ts +62 -0
- package/dist/interpretation/interpreter.js +151 -0
- package/dist/interpretation/materialize.d.ts +42 -0
- package/dist/interpretation/materialize.js +107 -0
- package/dist/interpretation/prompt.d.ts +229 -0
- package/dist/interpretation/prompt.js +285 -0
- package/dist/interpretation/render.d.ts +76 -0
- package/dist/interpretation/render.js +272 -0
- package/dist/interpretation/schema.d.ts +49 -0
- package/dist/interpretation/schema.js +131 -0
- package/dist/json.d.ts +35 -0
- package/dist/json.js +11 -0
- package/dist/paging.d.ts +60 -0
- package/dist/paging.js +49 -0
- package/dist/primitive-type.d.ts +32 -0
- package/dist/primitive-type.js +39 -0
- package/dist/render/addressing.d.ts +59 -0
- package/dist/render/addressing.js +60 -0
- package/dist/render/anchor.d.ts +105 -0
- package/dist/render/anchor.js +84 -0
- package/dist/render/behaviour-adjust.d.ts +62 -0
- package/dist/render/behaviour-adjust.js +78 -0
- package/dist/render/behaviour-copy.d.ts +53 -0
- package/dist/render/behaviour-copy.js +75 -0
- package/dist/render/behaviour-disclose.d.ts +74 -0
- package/dist/render/behaviour-disclose.js +77 -0
- package/dist/render/behaviour-present.d.ts +123 -0
- package/dist/render/behaviour-present.js +173 -0
- package/dist/render/behaviour.d.ts +243 -0
- package/dist/render/behaviour.js +284 -0
- package/dist/render/control.d.ts +81 -0
- package/dist/render/control.js +80 -0
- package/dist/render/decorative.d.ts +62 -0
- package/dist/render/decorative.js +2 -0
- package/dist/render/diagnostics.d.ts +260 -0
- package/dist/render/diagnostics.js +61 -0
- package/dist/render/disclosed.d.ts +37 -0
- package/dist/render/disclosed.js +37 -0
- package/dist/render/editable.d.ts +34 -0
- package/dist/render/editable.js +35 -0
- package/dist/render/frame.d.ts +42 -0
- package/dist/render/frame.js +31 -0
- package/dist/render/index.d.ts +35 -0
- package/dist/render/index.js +35 -0
- package/dist/render/inline-variables.d.ts +77 -0
- package/dist/render/inline-variables.js +220 -0
- package/dist/render/presented.d.ts +82 -0
- package/dist/render/presented.js +82 -0
- package/dist/render/primitive.d.ts +228 -0
- package/dist/render/primitive.js +36 -0
- package/dist/render/props.d.ts +48 -0
- package/dist/render/props.js +2 -0
- package/dist/render/reads.d.ts +73 -0
- package/dist/render/reads.js +45 -0
- package/dist/render/render.d.ts +164 -0
- package/dist/render/render.js +571 -0
- package/dist/render/request.d.ts +111 -0
- package/dist/render/request.js +60 -0
- package/dist/render/text.d.ts +91 -0
- package/dist/render/text.js +44 -0
- package/dist/render/theme.d.ts +61 -0
- package/dist/render/theme.js +52 -0
- package/dist/reserved-props.d.ts +35 -0
- package/dist/reserved-props.js +45 -0
- package/dist/result.d.ts +27 -0
- package/dist/result.js +30 -0
- package/dist/role.d.ts +71 -0
- package/dist/role.js +22 -0
- package/dist/runtime/analysis.d.ts +149 -0
- package/dist/runtime/analysis.js +187 -0
- package/dist/runtime/assessment.d.ts +35 -0
- package/dist/runtime/assessment.js +13 -0
- package/dist/runtime/disposition.d.ts +102 -0
- package/dist/runtime/disposition.js +59 -0
- package/dist/runtime/events.d.ts +187 -0
- package/dist/runtime/events.js +7 -0
- package/dist/runtime/gate.d.ts +43 -0
- package/dist/runtime/gate.js +169 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/intent.d.ts +60 -0
- package/dist/runtime/intent.js +36 -0
- package/dist/runtime/interpreter.d.ts +117 -0
- package/dist/runtime/interpreter.js +46 -0
- package/dist/runtime/inverse-interpreter.d.ts +90 -0
- package/dist/runtime/inverse-interpreter.js +56 -0
- package/dist/runtime/inverse.d.ts +87 -0
- package/dist/runtime/inverse.js +48 -0
- package/dist/runtime/narration.d.ts +24 -0
- package/dist/runtime/narration.js +36 -0
- package/dist/runtime/nesting.d.ts +31 -0
- package/dist/runtime/nesting.js +46 -0
- package/dist/runtime/pipeline.d.ts +124 -0
- package/dist/runtime/pipeline.js +178 -0
- package/dist/runtime/policy-fingerprint.d.ts +29 -0
- package/dist/runtime/policy-fingerprint.js +119 -0
- package/dist/runtime/policy-source.d.ts +42 -0
- package/dist/runtime/policy-source.js +8 -0
- package/dist/runtime/policy.d.ts +156 -0
- package/dist/runtime/policy.js +107 -0
- package/dist/runtime/proposal.d.ts +423 -0
- package/dist/runtime/proposal.js +109 -0
- package/dist/runtime/redirection.d.ts +53 -0
- package/dist/runtime/redirection.js +38 -0
- package/dist/runtime/repointing.d.ts +71 -0
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +36 -0
- package/dist/runtime/reversibility.js +39 -0
- package/dist/runtime/stake-level.d.ts +33 -0
- package/dist/runtime/stake-level.js +58 -0
- package/dist/runtime/stakes.d.ts +47 -0
- package/dist/runtime/stakes.js +305 -0
- package/dist/runtime/vocabulary.d.ts +122 -0
- package/dist/runtime/vocabulary.js +87 -0
- package/dist/sdk/audit.d.ts +195 -0
- package/dist/sdk/audit.js +128 -0
- package/dist/sdk/catalogue.d.ts +37 -0
- package/dist/sdk/catalogue.js +16 -0
- package/dist/sdk/conformance.d.ts +342 -0
- package/dist/sdk/conformance.js +494 -0
- package/dist/sdk/copy.d.ts +105 -0
- package/dist/sdk/copy.js +90 -0
- package/dist/sdk/definition.d.ts +242 -0
- package/dist/sdk/definition.js +64 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/interactivity.d.ts +29 -0
- package/dist/sdk/interactivity.js +34 -0
- package/dist/sdk/pairings.d.ts +124 -0
- package/dist/sdk/pairings.js +81 -0
- package/dist/sdk/registry.d.ts +162 -0
- package/dist/sdk/registry.js +329 -0
- package/dist/sdk/selection.d.ts +46 -0
- package/dist/sdk/selection.js +24 -0
- package/dist/sdk/text.d.ts +100 -0
- package/dist/sdk/text.js +105 -0
- package/dist/sdk/vocabulary.d.ts +39 -0
- package/dist/sdk/vocabulary.js +36 -0
- package/dist/signals/broadcast.d.ts +134 -0
- package/dist/signals/broadcast.js +451 -0
- package/dist/signals/collect.d.ts +184 -0
- package/dist/signals/collect.js +196 -0
- package/dist/signals/deliver.d.ts +64 -0
- package/dist/signals/deliver.js +85 -0
- package/dist/signals/fold.d.ts +112 -0
- package/dist/signals/fold.js +76 -0
- package/dist/signals/index.d.ts +31 -0
- package/dist/signals/index.js +31 -0
- package/dist/signals/ingest.d.ts +51 -0
- package/dist/signals/ingest.js +70 -0
- package/dist/signals/intake.d.ts +149 -0
- package/dist/signals/intake.js +154 -0
- package/dist/signals/journal.d.ts +94 -0
- package/dist/signals/journal.js +11 -0
- package/dist/signals/kinds.d.ts +22 -0
- package/dist/signals/kinds.js +22 -0
- package/dist/signals/ledger.d.ts +46 -0
- package/dist/signals/ledger.js +81 -0
- package/dist/signals/memory.d.ts +17 -0
- package/dist/signals/memory.js +99 -0
- package/dist/signals/migrate.d.ts +27 -0
- package/dist/signals/migrate.js +78 -0
- package/dist/signals/postgres.d.ts +7 -0
- package/dist/signals/postgres.js +295 -0
- package/dist/signals/rollup.d.ts +142 -0
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +534 -0
- package/dist/signals/schema.js +92 -0
- package/dist/signals/signal.d.ts +381 -0
- package/dist/signals/signal.js +150 -0
- package/dist/signals/tally.d.ts +70 -0
- package/dist/signals/tally.js +2 -0
- package/dist/signals/view.d.ts +51 -0
- package/dist/signals/view.js +54 -0
- package/dist/store/attribution.d.ts +125 -0
- package/dist/store/attribution.js +116 -0
- package/dist/store/database.d.ts +14 -0
- package/dist/store/database.js +2 -0
- package/dist/store/driver.d.ts +29 -0
- package/dist/store/driver.js +39 -0
- package/dist/store/errors.d.ts +56 -0
- package/dist/store/errors.js +37 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.js +16 -0
- package/dist/store/memory.d.ts +3 -0
- package/dist/store/memory.js +115 -0
- package/dist/store/migrate.d.ts +54 -0
- package/dist/store/migrate.js +122 -0
- package/dist/store/postgres-holds.d.ts +4 -0
- package/dist/store/postgres-holds.js +192 -0
- package/dist/store/postgres.d.ts +8 -0
- package/dist/store/postgres.js +262 -0
- package/dist/store/replay.d.ts +94 -0
- package/dist/store/replay.js +82 -0
- package/dist/store/revert.d.ts +116 -0
- package/dist/store/revert.js +243 -0
- package/dist/store/schema.d.ts +371 -0
- package/dist/store/schema.js +78 -0
- package/dist/store/source.d.ts +23 -0
- package/dist/store/source.js +37 -0
- package/dist/store/store.d.ts +231 -0
- package/dist/store/store.js +52 -0
- package/dist/store/undone.d.ts +18 -0
- package/dist/store/undone.js +89 -0
- package/dist/submit/catalogue.d.ts +20 -0
- package/dist/submit/catalogue.js +5 -0
- package/dist/submit/declaration.d.ts +39 -0
- package/dist/submit/declaration.js +30 -0
- package/dist/submit/endpoint.d.ts +131 -0
- package/dist/submit/endpoint.js +160 -0
- package/dist/submit/index.d.ts +13 -0
- package/dist/submit/index.js +13 -0
- package/dist/submit/plan.d.ts +49 -0
- package/dist/submit/plan.js +47 -0
- package/dist/submit/resolution.d.ts +61 -0
- package/dist/submit/resolution.js +64 -0
- package/dist/submit/resolve.d.ts +45 -0
- package/dist/submit/resolve.js +36 -0
- package/dist/telemetry/calibration.d.ts +132 -0
- package/dist/telemetry/calibration.js +151 -0
- package/dist/telemetry/episode.d.ts +140 -0
- package/dist/telemetry/episode.js +272 -0
- package/dist/telemetry/event.d.ts +2310 -0
- package/dist/telemetry/event.js +405 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/journal.d.ts +116 -0
- package/dist/telemetry/journal.js +11 -0
- package/dist/telemetry/memory.d.ts +24 -0
- package/dist/telemetry/memory.js +75 -0
- package/dist/telemetry/migrate.d.ts +26 -0
- package/dist/telemetry/migrate.js +40 -0
- package/dist/telemetry/postgres.d.ts +6 -0
- package/dist/telemetry/postgres.js +139 -0
- package/dist/telemetry/retention.d.ts +131 -0
- package/dist/telemetry/retention.js +217 -0
- package/dist/telemetry/schema.d.ts +113 -0
- package/dist/telemetry/schema.js +33 -0
- package/dist/telemetry/sink.d.ts +42 -0
- package/dist/telemetry/sink.js +61 -0
- package/dist/testing/contracts.d.ts +34 -0
- package/dist/testing/contracts.js +34 -0
- package/dist/testing/definitions.d.ts +15 -0
- package/dist/testing/definitions.js +48 -0
- package/dist/testing/doubles.d.ts +94 -0
- package/dist/testing/doubles.js +141 -0
- package/dist/testing/episode-harness.d.ts +49 -0
- package/dist/testing/episode-harness.js +65 -0
- package/dist/testing/filesystem.d.ts +17 -0
- package/dist/testing/filesystem.js +17 -0
- package/dist/testing/fixtures.d.ts +57 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/hold-contract.d.ts +19 -0
- package/dist/testing/hold-contract.js +374 -0
- package/dist/testing/index.d.ts +41 -0
- package/dist/testing/index.js +41 -0
- package/dist/testing/journal-contract.d.ts +17 -0
- package/dist/testing/journal-contract.js +353 -0
- package/dist/testing/model-replies.d.ts +34 -0
- package/dist/testing/model-replies.js +101 -0
- package/dist/testing/primitives.d.ts +7 -0
- package/dist/testing/primitives.js +29 -0
- package/dist/testing/reader-signal-contract.d.ts +38 -0
- package/dist/testing/reader-signal-contract.js +318 -0
- package/dist/testing/row-security.d.ts +17 -0
- package/dist/testing/row-security.js +21 -0
- package/dist/testing/store-contract.d.ts +25 -0
- package/dist/testing/store-contract.js +500 -0
- package/dist/theme/apply.d.ts +17 -0
- package/dist/theme/apply.js +60 -0
- package/dist/theme/contrast.d.ts +197 -0
- package/dist/theme/contrast.js +259 -0
- package/dist/theme/derive.d.ts +77 -0
- package/dist/theme/derive.js +167 -0
- package/dist/theme/faces.d.ts +73 -0
- package/dist/theme/faces.js +119 -0
- package/dist/theme/font-packs.d.ts +25 -0
- package/dist/theme/font-packs.js +257 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/lab.d.ts +30 -0
- package/dist/theme/lab.js +46 -0
- package/dist/theme/library.d.ts +114 -0
- package/dist/theme/library.js +300 -0
- package/dist/theme/measure.d.ts +144 -0
- package/dist/theme/measure.js +145 -0
- package/dist/theme/palettes.d.ts +64 -0
- package/dist/theme/palettes.js +497 -0
- package/dist/theme/registry.d.ts +59 -0
- package/dist/theme/registry.js +60 -0
- package/dist/theme/separation.d.ts +177 -0
- package/dist/theme/separation.js +203 -0
- package/dist/theme/style-presets.d.ts +60 -0
- package/dist/theme/style-presets.js +124 -0
- package/dist/theme/theme.d.ts +253 -0
- package/dist/theme/theme.js +171 -0
- package/dist/tree/apply.d.ts +16 -0
- package/dist/tree/apply.js +104 -0
- package/dist/tree/builders.d.ts +19 -0
- package/dist/tree/builders.js +20 -0
- package/dist/tree/compare.d.ts +68 -0
- package/dist/tree/compare.js +75 -0
- package/dist/tree/configuration.d.ts +25 -0
- package/dist/tree/configuration.js +108 -0
- package/dist/tree/delta.d.ts +288 -0
- package/dist/tree/delta.js +88 -0
- package/dist/tree/errors.d.ts +69 -0
- package/dist/tree/errors.js +34 -0
- package/dist/tree/identity.d.ts +117 -0
- package/dist/tree/identity.js +145 -0
- package/dist/tree/index.d.ts +21 -0
- package/dist/tree/index.js +21 -0
- package/dist/tree/inverse.d.ts +24 -0
- package/dist/tree/inverse.js +112 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +49 -0
- package/dist/tree/naming.d.ts +4 -0
- package/dist/tree/naming.js +35 -0
- package/dist/tree/navigation.d.ts +38 -0
- package/dist/tree/navigation.js +83 -0
- package/dist/tree/node.d.ts +103 -0
- package/dist/tree/node.js +46 -0
- package/dist/tree/outline.d.ts +28 -0
- package/dist/tree/outline.js +10 -0
- package/dist/tree/tree.d.ts +83 -0
- package/dist/tree/tree.js +62 -0
- package/dist/write/commit.d.ts +124 -0
- package/dist/write/commit.js +234 -0
- package/dist/write/held.d.ts +674 -0
- package/dist/write/held.js +185 -0
- package/dist/write/index.d.ts +11 -0
- package/dist/write/index.js +11 -0
- package/dist/write/liveness.d.ts +132 -0
- package/dist/write/liveness.js +91 -0
- package/dist/write/revert.d.ts +79 -0
- package/dist/write/revert.js +134 -0
- package/package.json +160 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { type DataUnavailable } from "../data/adapter.js";
|
|
2
|
+
import { type BindingError } from "../data/binding.js";
|
|
3
|
+
import type { BindingName, SourceId } from "../data/source.js";
|
|
4
|
+
import type { FrameOrigin } from "../frame/origin.js";
|
|
5
|
+
import { type FrameRefusal } from "../frame/resolution.js";
|
|
6
|
+
import type { NodeId } from "../ids.js";
|
|
7
|
+
import type { PrimitiveType } from "../primitive-type.js";
|
|
8
|
+
import { type SubmissionError } from "../submit/declaration.js";
|
|
9
|
+
import { type EndpointId, type SubmissionUnavailable } from "../submit/endpoint.js";
|
|
10
|
+
import { type ThemeError } from "../theme/registry.js";
|
|
11
|
+
import type { PropsIssue } from "./props.js";
|
|
12
|
+
/**
|
|
13
|
+
* Rendering is total: it always returns an element. Anything it could not
|
|
14
|
+
* honour comes back beside the element as a diagnostic rather than as a thrown
|
|
15
|
+
* error or an absent page.
|
|
16
|
+
*
|
|
17
|
+
* A tree can name a primitive the host has not registered — an AI proposed it,
|
|
18
|
+
* or a deployment rolled back the code but not the tree — and blanking the
|
|
19
|
+
* whole page over one unknown card serves nobody. The diagnostic is the record
|
|
20
|
+
* that it happened, and it is shaped for §6 to consume.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Which way a render came to have no answer for a node that asked for one.
|
|
24
|
+
*
|
|
25
|
+
* Both seams that resolve a tree's questions before the walk — data and
|
|
26
|
+
* submissions — can be handed nothing at all or handed a resolution that was
|
|
27
|
+
* built from some other tree. The distinction is worth carrying because it sends
|
|
28
|
+
* a different person to a different line: `absent` is a composition root that
|
|
29
|
+
* never resolved, and `unrelated` is one that resolved the wrong plan.
|
|
30
|
+
*/
|
|
31
|
+
export type UnresolvedResolution = "absent" | "unrelated";
|
|
32
|
+
export type RenderDiagnostic = {
|
|
33
|
+
readonly code: "unknown-primitive";
|
|
34
|
+
readonly nodeId: NodeId;
|
|
35
|
+
readonly type: PrimitiveType;
|
|
36
|
+
} | {
|
|
37
|
+
readonly code: "invalid-props";
|
|
38
|
+
readonly nodeId: NodeId;
|
|
39
|
+
readonly type: PrimitiveType;
|
|
40
|
+
readonly issues: readonly PropsIssue[];
|
|
41
|
+
} | {
|
|
42
|
+
/**
|
|
43
|
+
* The resolver knows this type and the validator does not, which is a
|
|
44
|
+
* composition-root fault rather than anything the tree did. The node
|
|
45
|
+
* still renders — one seam not recognising a type the other resolved is
|
|
46
|
+
* no reason to blank the page — but the props went unchecked, and that is
|
|
47
|
+
* worth saying out loud.
|
|
48
|
+
*/
|
|
49
|
+
readonly code: "props-undeclared";
|
|
50
|
+
readonly nodeId: NodeId;
|
|
51
|
+
readonly type: PrimitiveType;
|
|
52
|
+
} | {
|
|
53
|
+
/**
|
|
54
|
+
* The root names a theme and the registry refused it — an id nobody
|
|
55
|
+
* registered, or a selection that is not three ids. The page renders
|
|
56
|
+
* unstyled rather than not at all, which is the same bargain every other
|
|
57
|
+
* diagnostic here makes.
|
|
58
|
+
*/
|
|
59
|
+
readonly code: "theme-unresolved";
|
|
60
|
+
readonly nodeId: NodeId;
|
|
61
|
+
readonly error: ThemeError;
|
|
62
|
+
} | {
|
|
63
|
+
/** The root names a theme and this render was given no registry. */
|
|
64
|
+
readonly code: "theme-unregistered";
|
|
65
|
+
readonly nodeId: NodeId;
|
|
66
|
+
} | {
|
|
67
|
+
/**
|
|
68
|
+
* A theme below the root, which is not mounted (0049): the variables are
|
|
69
|
+
* mounted once, at the render root, so a nested selection would be read
|
|
70
|
+
* by nothing. Reported rather than dropped, because someone meant it.
|
|
71
|
+
*/
|
|
72
|
+
readonly code: "theme-misplaced";
|
|
73
|
+
readonly nodeId: NodeId;
|
|
74
|
+
} | {
|
|
75
|
+
/** A key in the runtime's reserved namespace that the runtime does not read. */
|
|
76
|
+
readonly code: "reserved-prop-unrecognised";
|
|
77
|
+
readonly nodeId: NodeId;
|
|
78
|
+
readonly key: string;
|
|
79
|
+
} | {
|
|
80
|
+
/**
|
|
81
|
+
* `loom:data` that is not a map of binding names to registered sources.
|
|
82
|
+
* The node renders — its props are its own and are still valid — with no
|
|
83
|
+
* data at all, which is what a primitive's unavailable path is for.
|
|
84
|
+
*/
|
|
85
|
+
readonly code: "data-misdeclared";
|
|
86
|
+
readonly nodeId: NodeId;
|
|
87
|
+
readonly error: BindingError;
|
|
88
|
+
} | {
|
|
89
|
+
/**
|
|
90
|
+
* A binding that could not be answered: no such source, params the source
|
|
91
|
+
* refuses, an answer that fails its own schema, or an adapter that could
|
|
92
|
+
* not reach what it wraps. One region of the page is short of data; the
|
|
93
|
+
* page still renders, because the alternative is a whole page lost to one
|
|
94
|
+
* integration being down.
|
|
95
|
+
*/
|
|
96
|
+
readonly code: "data-unavailable";
|
|
97
|
+
readonly nodeId: NodeId;
|
|
98
|
+
readonly name: BindingName;
|
|
99
|
+
readonly source: SourceId;
|
|
100
|
+
readonly unavailable: DataUnavailable;
|
|
101
|
+
} | {
|
|
102
|
+
/**
|
|
103
|
+
* A node asks for data and this render has no answers for it — neither a
|
|
104
|
+
* value nor a named reason there is none.
|
|
105
|
+
*
|
|
106
|
+
* There are two ways to arrive here and they are fixed in the same place
|
|
107
|
+
* by the same person, which is why they are one code carrying which:
|
|
108
|
+
* `absent`, a render given no resolution at all, and `unrelated`, a render
|
|
109
|
+
* given one built from a different tree's plan. The second is the one that
|
|
110
|
+
* used to say nothing: `EMPTY_DATA_RESOLUTION` answers `NO_DATA` for every
|
|
111
|
+
* node, so a composition root that reached for it as a neutral "no data"
|
|
112
|
+
* value got a page whose every binding vanished in silence.
|
|
113
|
+
*/
|
|
114
|
+
readonly code: "data-unresolved";
|
|
115
|
+
readonly nodeId: NodeId;
|
|
116
|
+
readonly resolution: UnresolvedResolution;
|
|
117
|
+
} | {
|
|
118
|
+
/**
|
|
119
|
+
* A binding the node asked under a name this primitive says it does not
|
|
120
|
+
* read. The answer arrived and nothing will ever look at it.
|
|
121
|
+
*
|
|
122
|
+
* The quietest of the three ways a binding can be wrong, and until the
|
|
123
|
+
* primitive declared its names it was the only one nothing could see: an
|
|
124
|
+
* unregistered source is refused as `no-such-source`, params the source
|
|
125
|
+
* did not declare are refused by its own schema, and a name nothing reads
|
|
126
|
+
* resolves perfectly and is then dropped on the floor. The node renders —
|
|
127
|
+
* the binding cost it nothing but a round trip — and what is reported is
|
|
128
|
+
* that somebody asked a question whose answer has no reader.
|
|
129
|
+
*
|
|
130
|
+
* Only ever reported for a primitive whose author has declared `reads`.
|
|
131
|
+
* Absence is not emptiness (0181), so a primitive that has said nothing
|
|
132
|
+
* says nothing about the names it is given.
|
|
133
|
+
*/
|
|
134
|
+
readonly code: "data-unread";
|
|
135
|
+
readonly nodeId: NodeId;
|
|
136
|
+
readonly type: PrimitiveType;
|
|
137
|
+
readonly name: string;
|
|
138
|
+
} | {
|
|
139
|
+
/**
|
|
140
|
+
* `loom:submit` that is not an endpoint id under `to`. The node renders —
|
|
141
|
+
* its props are its own and are still valid — with no target, which is
|
|
142
|
+
* what a form primitive's unavailable path is for.
|
|
143
|
+
*/
|
|
144
|
+
readonly code: "submit-misdeclared";
|
|
145
|
+
readonly nodeId: NodeId;
|
|
146
|
+
readonly error: SubmissionError;
|
|
147
|
+
} | {
|
|
148
|
+
/**
|
|
149
|
+
* A form whose endpoint could not give a target: nobody registered it,
|
|
150
|
+
* it refused this visitor, or it answered with something the seam refuses.
|
|
151
|
+
* The page still renders, because a page lost to one form is worse than a
|
|
152
|
+
* form that says it cannot be sent right now.
|
|
153
|
+
*/
|
|
154
|
+
readonly code: "submit-unavailable";
|
|
155
|
+
readonly nodeId: NodeId;
|
|
156
|
+
readonly to: EndpointId;
|
|
157
|
+
readonly unavailable: SubmissionUnavailable;
|
|
158
|
+
} | {
|
|
159
|
+
/**
|
|
160
|
+
* A node names an endpoint and this render has no target for it — neither
|
|
161
|
+
* one nor a named reason there is none. `absent` and `unrelated` are the
|
|
162
|
+
* two routes the data seam's twin describes, for the same reasons:
|
|
163
|
+
* `EMPTY_SUBMISSION_RESOLUTION` answers `undefined` for every node, and a
|
|
164
|
+
* form whose target went missing that way rendered a submit button
|
|
165
|
+
* pointing nowhere with nothing said about it.
|
|
166
|
+
*/
|
|
167
|
+
readonly code: "submit-unresolved";
|
|
168
|
+
readonly nodeId: NodeId;
|
|
169
|
+
readonly resolution: UnresolvedResolution;
|
|
170
|
+
} | {
|
|
171
|
+
/**
|
|
172
|
+
* A framable prop whose URL will not be framed: no allowlist was wired,
|
|
173
|
+
* nobody registered its origin, or it is not an absolute http(s) URL at
|
|
174
|
+
* all. The node still renders — its props are its own — and what it does
|
|
175
|
+
* with a refusal is the primitive's business, which for a frame is
|
|
176
|
+
* usually to render the refusal rather than an empty box.
|
|
177
|
+
*/
|
|
178
|
+
readonly code: "frame-refused";
|
|
179
|
+
readonly nodeId: NodeId;
|
|
180
|
+
readonly prop: string;
|
|
181
|
+
readonly refusal: FrameRefusal;
|
|
182
|
+
} | {
|
|
183
|
+
/**
|
|
184
|
+
* A permitted frame whose document comes from this deployment's own
|
|
185
|
+
* origin, so the primitive's `sandbox` is inert: `allow-scripts` beside
|
|
186
|
+
* `allow-same-origin` is only a boundary between two origins, and between
|
|
187
|
+
* one and itself it is nothing. Not a refusal — a host that registered
|
|
188
|
+
* its own origin meant to — and reported anyway, because it is the one
|
|
189
|
+
* thing about a frame that looks contained and is not.
|
|
190
|
+
*/
|
|
191
|
+
readonly code: "frame-same-origin";
|
|
192
|
+
readonly nodeId: NodeId;
|
|
193
|
+
readonly prop: string;
|
|
194
|
+
readonly origin: FrameOrigin;
|
|
195
|
+
} | {
|
|
196
|
+
/**
|
|
197
|
+
* `loom:anchor` that is not a slug a link can carry: not a string, empty,
|
|
198
|
+
* longer than an anchor may be, or spelled with something that does not
|
|
199
|
+
* survive a URL. The node renders exactly as it would have — an anchor
|
|
200
|
+
* adds an attribute and changes nothing else — and is not a fragment
|
|
201
|
+
* target.
|
|
202
|
+
*/
|
|
203
|
+
readonly code: "anchor-unusable";
|
|
204
|
+
readonly nodeId: NodeId;
|
|
205
|
+
readonly detail: string;
|
|
206
|
+
} | {
|
|
207
|
+
/**
|
|
208
|
+
* Two nodes named the same anchor, and this is the second one. The first
|
|
209
|
+
* in document order keeps it, because two elements sharing an `id` is a
|
|
210
|
+
* document a browser resolves by its own rule rather than by the tree's —
|
|
211
|
+
* and a link that lands on whichever of the two the parser preferred is
|
|
212
|
+
* worse than one node that cannot be linked to.
|
|
213
|
+
*/
|
|
214
|
+
readonly code: "anchor-claimed";
|
|
215
|
+
readonly nodeId: NodeId;
|
|
216
|
+
readonly anchor: string;
|
|
217
|
+
readonly holder: NodeId;
|
|
218
|
+
} | {
|
|
219
|
+
/**
|
|
220
|
+
* A declared behaviour's control had no name to render under, so it was
|
|
221
|
+
* left out. The registry refuses a primitive that declares a behaviour
|
|
222
|
+
* and not its strings, so the way here is a dictionary that answers a
|
|
223
|
+
* declared key with a blank — a translation fault, in the one place that
|
|
224
|
+
* can see it, rather than an unnamed button on the page.
|
|
225
|
+
*/
|
|
226
|
+
readonly code: "behaviour-unnamed";
|
|
227
|
+
readonly nodeId: NodeId;
|
|
228
|
+
readonly behaviour: string;
|
|
229
|
+
readonly key: string;
|
|
230
|
+
} | {
|
|
231
|
+
/**
|
|
232
|
+
* The render was asked for values rather than references
|
|
233
|
+
* (`themeValues: "literals"`) and no theme mounted, so there was nothing
|
|
234
|
+
* to resolve them against and the page keeps the references it was
|
|
235
|
+
* written with. Worth saying because of who asks: a caller wants values
|
|
236
|
+
* when whatever it is feeding cannot resolve a reference, and in that
|
|
237
|
+
* medium nothing downstream would notice they never arrived.
|
|
238
|
+
*
|
|
239
|
+
* On the root, because the theme is the root's (0049).
|
|
240
|
+
*/
|
|
241
|
+
readonly code: "theme-values-unmounted";
|
|
242
|
+
readonly nodeId: NodeId;
|
|
243
|
+
} | {
|
|
244
|
+
/**
|
|
245
|
+
* An excerpt was asked for by node id and this tree holds no such node.
|
|
246
|
+
* Nothing rendered, because there is nothing to render — the one case in
|
|
247
|
+
* this union where the element is null rather than a page missing a part
|
|
248
|
+
* of itself.
|
|
249
|
+
*
|
|
250
|
+
* It is a diagnostic rather than a thrown error for the reason every
|
|
251
|
+
* other one here is: the id came from somewhere — a URL, a row in a
|
|
252
|
+
* review queue, a link in a record — and the node it named can have been
|
|
253
|
+
* deleted by an ordinary change since. A preview of a part that is gone
|
|
254
|
+
* is a thing to say, not a crash.
|
|
255
|
+
*/
|
|
256
|
+
readonly code: "excerpt-absent";
|
|
257
|
+
readonly nodeId: NodeId;
|
|
258
|
+
};
|
|
259
|
+
export declare const describeRenderDiagnostic: (diagnostic: RenderDiagnostic) => string;
|
|
260
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describeDataUnavailable } from "../data/adapter.js";
|
|
2
|
+
import { describeBindingError } from "../data/binding.js";
|
|
3
|
+
import { describeFrameRefusal } from "../frame/resolution.js";
|
|
4
|
+
import { assertNever } from "../result.js";
|
|
5
|
+
import { describeSubmissionError } from "../submit/declaration.js";
|
|
6
|
+
import { describeSubmissionUnavailable, } from "../submit/endpoint.js";
|
|
7
|
+
import { describeThemeError } from "../theme/registry.js";
|
|
8
|
+
const describeIssues = (issues) => issues.map((issue) => `${issue.path}: ${issue.message}`).join("; ");
|
|
9
|
+
export const describeRenderDiagnostic = (diagnostic) => {
|
|
10
|
+
switch (diagnostic.code) {
|
|
11
|
+
case "unknown-primitive":
|
|
12
|
+
return `no primitive is registered for "${diagnostic.type}", so node ${diagnostic.nodeId} and its subtree were omitted`;
|
|
13
|
+
case "invalid-props":
|
|
14
|
+
return `node ${diagnostic.nodeId} does not satisfy the props declared by "${diagnostic.type}", so it and its subtree were omitted — ${describeIssues(diagnostic.issues)}`;
|
|
15
|
+
case "props-undeclared":
|
|
16
|
+
return `no prop schema is registered for "${diagnostic.type}", so node ${diagnostic.nodeId} rendered with unchecked props`;
|
|
17
|
+
case "theme-unresolved":
|
|
18
|
+
return `the theme named by node ${diagnostic.nodeId} could not be resolved, so the tree rendered unstyled — ${describeThemeError(diagnostic.error)}`;
|
|
19
|
+
case "theme-unregistered":
|
|
20
|
+
return `node ${diagnostic.nodeId} names a theme and no theme registry was supplied, so the tree rendered unstyled`;
|
|
21
|
+
case "theme-misplaced":
|
|
22
|
+
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
|
+
case "reserved-prop-unrecognised":
|
|
24
|
+
return `node ${diagnostic.nodeId} carries "${diagnostic.key}", which is in the runtime's reserved namespace and is read by nothing, so it was dropped`;
|
|
25
|
+
case "data-misdeclared":
|
|
26
|
+
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
|
+
case "data-unavailable":
|
|
28
|
+
return `node ${diagnostic.nodeId} binds "${diagnostic.name}" to "${diagnostic.source}" and it could not be answered — ${describeDataUnavailable(diagnostic.unavailable)}`;
|
|
29
|
+
case "data-unread":
|
|
30
|
+
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`;
|
|
31
|
+
case "data-unresolved":
|
|
32
|
+
return diagnostic.resolution === "absent"
|
|
33
|
+
? `node ${diagnostic.nodeId} asks for data and this render was given no resolution, so it rendered with none`
|
|
34
|
+
: `node ${diagnostic.nodeId} asks for data and the resolution this render was given has no answer for it, so it rendered with none — the answers came from resolving a different plan than this tree`;
|
|
35
|
+
case "submit-misdeclared":
|
|
36
|
+
return `node ${diagnostic.nodeId} declares a submission that is not an endpoint id under \`to\`, so it rendered with no target — ${describeSubmissionError(diagnostic.error)}`;
|
|
37
|
+
case "submit-unavailable":
|
|
38
|
+
return `node ${diagnostic.nodeId} posts to "${diagnostic.to}" and no target could be given for it — ${describeSubmissionUnavailable(diagnostic.unavailable)}`;
|
|
39
|
+
case "submit-unresolved":
|
|
40
|
+
return diagnostic.resolution === "absent"
|
|
41
|
+
? `node ${diagnostic.nodeId} names an endpoint and this render was given no resolution, so it rendered with no target`
|
|
42
|
+
: `node ${diagnostic.nodeId} names an endpoint and the resolution this render was given has no target for it, so it rendered with none — the targets came from resolving a different plan than this tree`;
|
|
43
|
+
case "frame-refused":
|
|
44
|
+
return `node ${diagnostic.nodeId} frames "${diagnostic.prop}" and it will not be framed — ${describeFrameRefusal(diagnostic.refusal)}`;
|
|
45
|
+
case "frame-same-origin":
|
|
46
|
+
return `node ${diagnostic.nodeId} frames "${diagnostic.prop}" from "${diagnostic.origin}", which this deployment registered as its own, so the frame's sandbox grants it nothing it did not already have`;
|
|
47
|
+
case "anchor-unusable":
|
|
48
|
+
return `node ${diagnostic.nodeId} names an anchor a link could not carry, so it is not a fragment target — ${diagnostic.detail}`;
|
|
49
|
+
case "anchor-claimed":
|
|
50
|
+
return `node ${diagnostic.nodeId} names the anchor "${diagnostic.anchor}" and node ${diagnostic.holder} already holds it, so only the first one is a fragment target`;
|
|
51
|
+
case "behaviour-unnamed":
|
|
52
|
+
return `node ${diagnostic.nodeId} takes the "${diagnostic.behaviour}" behaviour and "${diagnostic.key}" resolved to nothing, so the control was left out rather than rendered with no accessible name`;
|
|
53
|
+
case "theme-values-unmounted":
|
|
54
|
+
return `this render was asked for the theme's values and node ${diagnostic.nodeId} mounted no theme, so every reference on the page was left as written — nothing outside a browser will resolve them`;
|
|
55
|
+
case "excerpt-absent":
|
|
56
|
+
return `an excerpt was asked for node ${diagnostic.nodeId} and this tree holds no such node, so nothing was rendered — the id may name a part a later revision removed`;
|
|
57
|
+
default:
|
|
58
|
+
return assertNever(diagnostic, "describeRenderDiagnostic");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The disclose contract's one name, in a module with nothing else in it.
|
|
3
|
+
*
|
|
4
|
+
* It lives apart from `behaviour.ts` so that code which only needs to *read* a
|
|
5
|
+
* disclosure — the reader-signal broadcaster — can import the name without
|
|
6
|
+
* importing the React controls that write it (0136).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The attribute a disclosure control stamps on its own button: `"true"` when
|
|
10
|
+
* the region it names is open, `"false"` when it is closed.
|
|
11
|
+
*
|
|
12
|
+
* **This is the whole of the contract between the runtime and a primitive that
|
|
13
|
+
* takes `disclose`**, and it is an attribute rather than a callback or a
|
|
14
|
+
* wrapper because a stylesheet is what has to read it. The control owns one
|
|
15
|
+
* element; the region beside it belongs to the primitive, which alone knows
|
|
16
|
+
* whether the thing being disclosed is a column of links, at what width the
|
|
17
|
+
* collapsing should start, and what should happen to the layout around it. So
|
|
18
|
+
* the runtime says only *open* or *closed*, on the one element it owns, and the
|
|
19
|
+
* primitive writes the rule:
|
|
20
|
+
*
|
|
21
|
+
* ```css
|
|
22
|
+
* [data-loom-disclosed="false"] ~ .my-links { display: none }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* — or `:has([data-loom-disclosed="false"])` on an ancestor if the control is
|
|
26
|
+
* placed inside a wrapper of the primitive's own.
|
|
27
|
+
*
|
|
28
|
+
* Two properties of the selector are worth stating because they are what make
|
|
29
|
+
* it safe. It matches nothing when the control has not rendered, which is the
|
|
30
|
+
* no-scripting case and the reason the region must default to *visible* and be
|
|
31
|
+
* hidden by the rule rather than the other way round. And `display: none` takes
|
|
32
|
+
* the region out of the accessibility tree as well as the layout, so a closed
|
|
33
|
+
* menu is closed for a screen reader too — which `aria-expanded` on the button
|
|
34
|
+
* then describes correctly instead of contradicting.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DISCLOSED_ATTRIBUTE = "data-loom-disclosed";
|
|
37
|
+
//# sourceMappingURL=disclosed.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The disclose contract's one name, in a module with nothing else in it.
|
|
3
|
+
*
|
|
4
|
+
* It lives apart from `behaviour.ts` so that code which only needs to *read* a
|
|
5
|
+
* disclosure — the reader-signal broadcaster — can import the name without
|
|
6
|
+
* importing the React controls that write it (0136).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The attribute a disclosure control stamps on its own button: `"true"` when
|
|
10
|
+
* the region it names is open, `"false"` when it is closed.
|
|
11
|
+
*
|
|
12
|
+
* **This is the whole of the contract between the runtime and a primitive that
|
|
13
|
+
* takes `disclose`**, and it is an attribute rather than a callback or a
|
|
14
|
+
* wrapper because a stylesheet is what has to read it. The control owns one
|
|
15
|
+
* element; the region beside it belongs to the primitive, which alone knows
|
|
16
|
+
* whether the thing being disclosed is a column of links, at what width the
|
|
17
|
+
* collapsing should start, and what should happen to the layout around it. So
|
|
18
|
+
* the runtime says only *open* or *closed*, on the one element it owns, and the
|
|
19
|
+
* primitive writes the rule:
|
|
20
|
+
*
|
|
21
|
+
* ```css
|
|
22
|
+
* [data-loom-disclosed="false"] ~ .my-links { display: none }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* — or `:has([data-loom-disclosed="false"])` on an ancestor if the control is
|
|
26
|
+
* placed inside a wrapper of the primitive's own.
|
|
27
|
+
*
|
|
28
|
+
* Two properties of the selector are worth stating because they are what make
|
|
29
|
+
* it safe. It matches nothing when the control has not rendered, which is the
|
|
30
|
+
* no-scripting case and the reason the region must default to *visible* and be
|
|
31
|
+
* hidden by the rule rather than the other way round. And `display: none` takes
|
|
32
|
+
* the region out of the accessibility tree as well as the layout, so a closed
|
|
33
|
+
* menu is closed for a screen reader too — which `aria-expanded` on the button
|
|
34
|
+
* then describes correctly instead of contradicting.
|
|
35
|
+
*/
|
|
36
|
+
export const DISCLOSED_ATTRIBUTE = "data-loom-disclosed";
|
|
37
|
+
//# sourceMappingURL=disclosed.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ElementNode } from "../tree/node.js";
|
|
2
|
+
import type { LoomTree } from "../tree/tree.js";
|
|
3
|
+
/**
|
|
4
|
+
* Edit mode decorates; it never restructures.
|
|
5
|
+
*
|
|
6
|
+
* A node's identity reaches the browser as data attributes the primitive
|
|
7
|
+
* spreads onto its own root element. The renderer does not wrap anything in a
|
|
8
|
+
* wrapper element to carry them, because a wrapper changes what `>`,
|
|
9
|
+
* `:first-child`, and `:nth-child` select, and a UI that only lays out
|
|
10
|
+
* correctly when edit mode is off is not the UI anyone reviewed.
|
|
11
|
+
*
|
|
12
|
+
* When edit mode is off these are never built, so the cost of the whole
|
|
13
|
+
* decorator is one boolean test per element.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LOOM_NODE_ATTRIBUTE = "data-loom-node";
|
|
16
|
+
export declare const LOOM_TYPE_ATTRIBUTE = "data-loom-type";
|
|
17
|
+
export declare const LOOM_TREE_ATTRIBUTE = "data-loom-tree";
|
|
18
|
+
export declare const LOOM_REVISION_ATTRIBUTE = "data-loom-revision";
|
|
19
|
+
export type EditableAttributes = {
|
|
20
|
+
readonly [LOOM_NODE_ATTRIBUTE]: string;
|
|
21
|
+
readonly [LOOM_TYPE_ATTRIBUTE]: string;
|
|
22
|
+
/** Root element only — see `editableAttributes`. */
|
|
23
|
+
readonly [LOOM_TREE_ATTRIBUTE]?: string;
|
|
24
|
+
readonly [LOOM_REVISION_ATTRIBUTE]?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The root element additionally carries the tree it belongs to and the revision
|
|
28
|
+
* it was rendered from, which is exactly the pair an `EditIntent` needs as its
|
|
29
|
+
* base. A portal can author an intent from the DOM alone, and an intent
|
|
30
|
+
* authored against a stale render names the stale revision rather than
|
|
31
|
+
* silently claiming the current one.
|
|
32
|
+
*/
|
|
33
|
+
export declare const editableAttributes: (node: ElementNode, tree?: LoomTree) => EditableAttributes;
|
|
34
|
+
//# sourceMappingURL=editable.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit mode decorates; it never restructures.
|
|
3
|
+
*
|
|
4
|
+
* A node's identity reaches the browser as data attributes the primitive
|
|
5
|
+
* spreads onto its own root element. The renderer does not wrap anything in a
|
|
6
|
+
* wrapper element to carry them, because a wrapper changes what `>`,
|
|
7
|
+
* `:first-child`, and `:nth-child` select, and a UI that only lays out
|
|
8
|
+
* correctly when edit mode is off is not the UI anyone reviewed.
|
|
9
|
+
*
|
|
10
|
+
* When edit mode is off these are never built, so the cost of the whole
|
|
11
|
+
* decorator is one boolean test per element.
|
|
12
|
+
*/
|
|
13
|
+
export const LOOM_NODE_ATTRIBUTE = "data-loom-node";
|
|
14
|
+
export const LOOM_TYPE_ATTRIBUTE = "data-loom-type";
|
|
15
|
+
export const LOOM_TREE_ATTRIBUTE = "data-loom-tree";
|
|
16
|
+
export const LOOM_REVISION_ATTRIBUTE = "data-loom-revision";
|
|
17
|
+
/**
|
|
18
|
+
* The root element additionally carries the tree it belongs to and the revision
|
|
19
|
+
* it was rendered from, which is exactly the pair an `EditIntent` needs as its
|
|
20
|
+
* base. A portal can author an intent from the DOM alone, and an intent
|
|
21
|
+
* authored against a stale render names the stale revision rather than
|
|
22
|
+
* silently claiming the current one.
|
|
23
|
+
*/
|
|
24
|
+
export const editableAttributes = (node, tree) => tree
|
|
25
|
+
? {
|
|
26
|
+
[LOOM_NODE_ATTRIBUTE]: node.id,
|
|
27
|
+
[LOOM_TYPE_ATTRIBUTE]: node.type,
|
|
28
|
+
[LOOM_TREE_ATTRIBUTE]: tree.treeId,
|
|
29
|
+
[LOOM_REVISION_ATTRIBUTE]: String(tree.revision),
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
[LOOM_NODE_ATTRIBUTE]: node.id,
|
|
33
|
+
[LOOM_TYPE_ATTRIBUTE]: node.type,
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=editable.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FrameOutcome, type NodeFrames } from "../frame/resolution.js";
|
|
2
|
+
import type { FrameOriginRegistry } from "../frame/origin.js";
|
|
3
|
+
import type { JsonObject } from "../json.js";
|
|
4
|
+
import type { PrimitiveType } from "../primitive-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* Holding a node's framable props against the origins a deployment permits.
|
|
7
|
+
*
|
|
8
|
+
* The check happens here, inside the walk, rather than in a pass before it —
|
|
9
|
+
* which is the one structural difference between this seam and the two it is
|
|
10
|
+
* modelled on. A binding is answered by a host's adapter and a form's target is
|
|
11
|
+
* minted per request, so both may do IO and neither can happen inside a
|
|
12
|
+
* synchronous render. An allowlist is a static host-authored list and a URL
|
|
13
|
+
* parse; there is nothing to await, so there is no plan, no resolve, and no
|
|
14
|
+
* second walk that could disagree with the first.
|
|
15
|
+
*
|
|
16
|
+
* Which props are framable is the primitive author's declaration, because it is
|
|
17
|
+
* the one thing the runtime cannot work out for itself: a `src` reaching an
|
|
18
|
+
* `iframe` and a `src` reaching an `img` are the same JSON string and very
|
|
19
|
+
* different documents.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Which of a primitive's props reach a frame, read off whatever registered it.
|
|
23
|
+
*
|
|
24
|
+
* Structural, and detected the way `BehaviourResolver` is: a registry built by
|
|
25
|
+
* the SDK satisfies it, and a host resolving from a plain map has registered
|
|
26
|
+
* nothing that could declare a framable prop in the first place — so there is
|
|
27
|
+
* nothing here to wire and nothing that can go missing.
|
|
28
|
+
*/
|
|
29
|
+
export interface FrameResolver {
|
|
30
|
+
readonly framePropsFor: (type: PrimitiveType) => readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export declare const isFrameResolver: (value: object) => value is FrameResolver;
|
|
33
|
+
/**
|
|
34
|
+
* Every declared framable prop the node carries, checked, with each outcome
|
|
35
|
+
* reported to the caller as it is decided.
|
|
36
|
+
*
|
|
37
|
+
* Reporting through a callback rather than returning a list keeps this pure of
|
|
38
|
+
* the renderer's diagnostic vocabulary: what a refused frame is *called* is the
|
|
39
|
+
* render's business, and what it *is* is this function's.
|
|
40
|
+
*/
|
|
41
|
+
export declare const resolveNodeFrames: (props: JsonObject, declared: readonly string[], registry: FrameOriginRegistry | undefined, report: (prop: string, outcome: FrameOutcome) => void) => NodeFrames;
|
|
42
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { resolveFrame, NO_FRAMES } from "../frame/resolution.js";
|
|
2
|
+
export const isFrameResolver = (value) => typeof value.framePropsFor === "function";
|
|
3
|
+
/**
|
|
4
|
+
* Every declared framable prop the node carries, checked, with each outcome
|
|
5
|
+
* reported to the caller as it is decided.
|
|
6
|
+
*
|
|
7
|
+
* Reporting through a callback rather than returning a list keeps this pure of
|
|
8
|
+
* the renderer's diagnostic vocabulary: what a refused frame is *called* is the
|
|
9
|
+
* render's business, and what it *is* is this function's.
|
|
10
|
+
*/
|
|
11
|
+
export const resolveNodeFrames = (props, declared, registry, report) => {
|
|
12
|
+
if (declared.length === 0)
|
|
13
|
+
return NO_FRAMES;
|
|
14
|
+
let frames;
|
|
15
|
+
for (const prop of declared) {
|
|
16
|
+
/**
|
|
17
|
+
* A declared frame prop the node does not carry is not a frame. An optional
|
|
18
|
+
* `src` left out is a primitive rendering no frame at all, which is neither
|
|
19
|
+
* a refusal nor something to report — so the entry is absent rather than
|
|
20
|
+
* present and refused.
|
|
21
|
+
*/
|
|
22
|
+
if (!Object.hasOwn(props, prop))
|
|
23
|
+
continue;
|
|
24
|
+
const outcome = resolveFrame(props[prop], registry);
|
|
25
|
+
frames ??= Object.create(null);
|
|
26
|
+
frames[prop] = outcome;
|
|
27
|
+
report(prop, outcome);
|
|
28
|
+
}
|
|
29
|
+
return frames ? Object.freeze(frames) : NO_FRAMES;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a tree into React elements.
|
|
3
|
+
*
|
|
4
|
+
* A total, pure projection — every node either renders or produces a diagnostic,
|
|
5
|
+
* and a render never throws and never decides anything the tree did not say.
|
|
6
|
+
*/
|
|
7
|
+
export * from "./addressing.js";
|
|
8
|
+
export * from "./anchor.js";
|
|
9
|
+
/**
|
|
10
|
+
* The `behaviour-*.js` controls are deliberately not re-exported. A behaviour's
|
|
11
|
+
* implementation is reached by declaring it and reading `loom.behaviours`, and
|
|
12
|
+
* a host that imported a control directly would get one with no registration
|
|
13
|
+
* behind it — no declared name to translate, and nothing telling the Gate the
|
|
14
|
+
* page now holds a target.
|
|
15
|
+
*/
|
|
16
|
+
export * from "./behaviour.js";
|
|
17
|
+
export * from "./control.js";
|
|
18
|
+
export * from "./decorative.js";
|
|
19
|
+
export * from "./diagnostics.js";
|
|
20
|
+
export * from "./editable.js";
|
|
21
|
+
export * from "./frame.js";
|
|
22
|
+
/**
|
|
23
|
+
* Named one at a time rather than `export *`: `literalThemeElement` is how the
|
|
24
|
+
* seam wires the literal-theme mode into its own walk, and a host reaching for
|
|
25
|
+
* it has one node's primitive and no render around it.
|
|
26
|
+
*/
|
|
27
|
+
export { inlineThemeVariables, substituteVariables, type InlinedProjection, type VariableSubstitution, } from "./inline-variables.js";
|
|
28
|
+
export * from "./primitive.js";
|
|
29
|
+
export * from "./props.js";
|
|
30
|
+
export * from "./reads.js";
|
|
31
|
+
export * from "./render.js";
|
|
32
|
+
export * from "./request.js";
|
|
33
|
+
export * from "./text.js";
|
|
34
|
+
export * from "./theme.js";
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning a tree into React elements.
|
|
3
|
+
*
|
|
4
|
+
* A total, pure projection — every node either renders or produces a diagnostic,
|
|
5
|
+
* and a render never throws and never decides anything the tree did not say.
|
|
6
|
+
*/
|
|
7
|
+
export * from "./addressing.js";
|
|
8
|
+
export * from "./anchor.js";
|
|
9
|
+
/**
|
|
10
|
+
* The `behaviour-*.js` controls are deliberately not re-exported. A behaviour's
|
|
11
|
+
* implementation is reached by declaring it and reading `loom.behaviours`, and
|
|
12
|
+
* a host that imported a control directly would get one with no registration
|
|
13
|
+
* behind it — no declared name to translate, and nothing telling the Gate the
|
|
14
|
+
* page now holds a target.
|
|
15
|
+
*/
|
|
16
|
+
export * from "./behaviour.js";
|
|
17
|
+
export * from "./control.js";
|
|
18
|
+
export * from "./decorative.js";
|
|
19
|
+
export * from "./diagnostics.js";
|
|
20
|
+
export * from "./editable.js";
|
|
21
|
+
export * from "./frame.js";
|
|
22
|
+
/**
|
|
23
|
+
* Named one at a time rather than `export *`: `literalThemeElement` is how the
|
|
24
|
+
* seam wires the literal-theme mode into its own walk, and a host reaching for
|
|
25
|
+
* it has one node's primitive and no render around it.
|
|
26
|
+
*/
|
|
27
|
+
export { inlineThemeVariables, substituteVariables, } from "./inline-variables.js";
|
|
28
|
+
export * from "./primitive.js";
|
|
29
|
+
export * from "./props.js";
|
|
30
|
+
export * from "./reads.js";
|
|
31
|
+
export * from "./render.js";
|
|
32
|
+
export * from "./request.js";
|
|
33
|
+
export * from "./text.js";
|
|
34
|
+
export * from "./theme.js";
|
|
35
|
+
//# sourceMappingURL=index.js.map
|