@jam-overture/loom 0.1.0 → 0.3.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/audience/compose.d.ts +112 -0
- package/dist/audience/compose.js +134 -0
- package/dist/audience/memory.d.ts +14 -0
- package/dist/audience/memory.js +71 -0
- package/dist/audience/overlay-store.d.ts +343 -0
- package/dist/audience/overlay-store.js +217 -0
- package/dist/audience/rule.d.ts +121 -0
- package/dist/audience/rule.js +78 -0
- package/dist/cli/index.d.ts +3 -4
- package/dist/cli/index.js +3 -4
- package/dist/cli/templates.js +19 -0
- package/dist/data/adapter.d.ts +9 -1
- package/dist/data/adapter.js +2 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +23 -1
- package/dist/data/resolve.d.ts +31 -4
- 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/interpretation/anthropic.d.ts +1 -1
- package/dist/interpretation/anthropic.js +2 -22
- package/dist/interpretation/client.d.ts +1 -1
- package/dist/interpretation/materialize.js +67 -22
- package/dist/interpretation/openai-compatible.d.ts +36 -0
- package/dist/interpretation/openai-compatible.js +79 -0
- package/dist/interpretation/status.d.ts +19 -0
- package/dist/interpretation/status.js +26 -0
- package/dist/live/index.d.ts +73 -0
- package/dist/live/index.js +73 -0
- package/dist/live/pages.d.ts +187 -0
- package/dist/live/pages.js +161 -0
- package/dist/live/pull.d.ts +147 -0
- package/dist/live/pull.js +398 -0
- package/dist/live/pulling.d.ts +79 -0
- package/dist/live/pulling.js +117 -0
- package/dist/live/window.d.ts +129 -0
- package/dist/live/window.js +132 -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/addressed.d.ts +35 -0
- package/dist/render/addressed.js +79 -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/document-theme.d.ts +70 -0
- package/dist/render/document-theme.js +139 -0
- package/dist/render/editable.d.ts +15 -1
- package/dist/render/editable.js +13 -1
- package/dist/render/expected.d.ts +98 -0
- package/dist/render/expected.js +88 -0
- package/dist/render/index.d.ts +4 -0
- package/dist/render/index.js +4 -0
- package/dist/render/reads.d.ts +11 -0
- package/dist/render/reads.js +12 -1
- package/dist/render/render.d.ts +11 -0
- package/dist/render/render.js +294 -53
- package/dist/render/request.d.ts +8 -1
- package/dist/render/request.js +1 -0
- 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/auto-apply-ceiling.d.ts +54 -0
- package/dist/runtime/auto-apply-ceiling.js +66 -0
- 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 +91 -10
- package/dist/runtime/index.d.ts +4 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/irreversibility.d.ts +64 -0
- package/dist/runtime/irreversibility.js +45 -0
- package/dist/runtime/nesting.d.ts +13 -1
- package/dist/runtime/nesting.js +41 -24
- 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 +305 -0
- package/dist/runtime/policy-log.d.ts +406 -0
- package/dist/runtime/policy-log.js +285 -0
- package/dist/runtime/policy.d.ts +8 -6
- package/dist/runtime/policy.js +5 -2
- package/dist/runtime/repointing.js +0 -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 +129 -5
- package/dist/sdk/definition.js +66 -0
- package/dist/sdk/registry.d.ts +45 -2
- package/dist/sdk/registry.js +102 -1
- package/dist/signals/acted.contract.d.ts +21 -0
- package/dist/signals/acted.contract.js +236 -0
- package/dist/signals/acted.d.ts +359 -0
- package/dist/signals/acted.js +135 -0
- 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/agenda.d.ts +585 -0
- package/dist/signals/agenda.js +295 -0
- package/dist/signals/applied-window.contract.d.ts +23 -0
- package/dist/signals/applied-window.contract.js +160 -0
- package/dist/signals/arrivals.contract.d.ts +21 -0
- package/dist/signals/arrivals.contract.js +180 -0
- package/dist/signals/arrivals.d.ts +375 -0
- package/dist/signals/arrivals.js +254 -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 +33 -17
- package/dist/signals/broadcast.js +255 -32
- package/dist/signals/change.d.ts +378 -0
- package/dist/signals/change.js +327 -0
- package/dist/signals/collect.d.ts +169 -34
- package/dist/signals/collect.js +186 -38
- package/dist/signals/conversion.d.ts +348 -0
- package/dist/signals/conversion.js +235 -0
- 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/correlated.contract.d.ts +24 -0
- package/dist/signals/correlated.contract.js +94 -0
- package/dist/signals/counters.d.ts +97 -0
- package/dist/signals/counters.js +160 -0
- package/dist/signals/deliver.d.ts +23 -4
- package/dist/signals/deliver.js +34 -6
- package/dist/signals/deployment-change.d.ts +395 -0
- package/dist/signals/deployment-change.js +309 -0
- package/dist/signals/deployment.d.ts +278 -0
- package/dist/signals/deployment.js +178 -0
- package/dist/signals/door.d.ts +114 -0
- package/dist/signals/door.js +77 -0
- package/dist/signals/expire.d.ts +192 -0
- package/dist/signals/expire.js +213 -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/frontier.d.ts +268 -0
- package/dist/signals/frontier.js +145 -0
- package/dist/signals/funnel-change.d.ts +548 -0
- package/dist/signals/funnel-change.js +361 -0
- package/dist/signals/funnel-hours.contract.d.ts +21 -0
- package/dist/signals/funnel-hours.contract.js +221 -0
- package/dist/signals/funnel-hours.d.ts +293 -0
- package/dist/signals/funnel-hours.js +99 -0
- package/dist/signals/funnel.d.ts +592 -0
- package/dist/signals/funnel.js +231 -0
- package/dist/signals/health.d.ts +694 -0
- package/dist/signals/health.js +573 -0
- package/dist/signals/index.d.ts +60 -0
- package/dist/signals/index.js +60 -0
- package/dist/signals/ingest.d.ts +56 -1
- package/dist/signals/ingest.js +91 -1
- package/dist/signals/inside.d.ts +190 -0
- package/dist/signals/inside.js +263 -0
- package/dist/signals/join.d.ts +56 -0
- package/dist/signals/join.js +60 -0
- package/dist/signals/journal.d.ts +123 -9
- package/dist/signals/kept.contract.d.ts +22 -0
- package/dist/signals/kept.contract.js +111 -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-agenda-change.d.ts +324 -0
- package/dist/signals/library-agenda-change.js +199 -0
- package/dist/signals/library-agenda.d.ts +258 -0
- package/dist/signals/library-agenda.js +167 -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 +646 -0
- package/dist/signals/library-reach-change.js +542 -0
- package/dist/signals/library-reach.d.ts +377 -0
- package/dist/signals/library-reach.js +227 -0
- package/dist/signals/library-senders-change.d.ts +457 -0
- package/dist/signals/library-senders-change.js +367 -0
- package/dist/signals/library-senders-reach-change.d.ts +486 -0
- package/dist/signals/library-senders-reach-change.js +538 -0
- package/dist/signals/library-senders-reach.d.ts +340 -0
- package/dist/signals/library-senders-reach.js +252 -0
- package/dist/signals/library-senders.d.ts +271 -0
- package/dist/signals/library-senders.js +180 -0
- package/dist/signals/library-word-reach-change.d.ts +567 -0
- package/dist/signals/library-word-reach-change.js +564 -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 +246 -14
- package/dist/signals/migrate.d.ts +20 -4
- package/dist/signals/migrate.js +269 -8
- package/dist/signals/notice.d.ts +389 -0
- package/dist/signals/notice.js +250 -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/part-pace.d.ts +378 -0
- package/dist/signals/part-pace.js +333 -0
- package/dist/signals/parts.d.ts +354 -0
- package/dist/signals/parts.js +232 -0
- package/dist/signals/postgres.d.ts +16 -2
- package/dist/signals/postgres.js +753 -76
- 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 +163 -0
- package/dist/signals/retention.js +75 -0
- package/dist/signals/rhythm.d.ts +302 -0
- package/dist/signals/rhythm.js +262 -0
- package/dist/signals/rollup.d.ts +194 -4
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +1069 -1
- package/dist/signals/schema.js +393 -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 +1147 -0
- package/dist/signals/silences.js +996 -0
- package/dist/signals/subtrees.d.ts +123 -0
- package/dist/signals/subtrees.js +102 -0
- package/dist/signals/tally.d.ts +262 -12
- package/dist/signals/unread.d.ts +292 -0
- package/dist/signals/unread.js +137 -0
- package/dist/signals/window-agenda.d.ts +276 -0
- package/dist/signals/window-agenda.js +83 -0
- package/dist/signals/window-figures.d.ts +148 -0
- package/dist/signals/window-figures.js +42 -0
- package/dist/signals/window-funnels.d.ts +88 -0
- package/dist/signals/window-funnels.js +47 -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/cache.d.ts +101 -0
- package/dist/store/cache.js +149 -0
- package/dist/store/history.d.ts +82 -0
- package/dist/store/history.js +36 -0
- package/dist/store/index.d.ts +30 -0
- package/dist/store/index.js +30 -0
- package/dist/store/memory.d.ts +2 -1
- package/dist/store/memory.js +48 -12
- package/dist/store/migrate.d.ts +106 -0
- package/dist/store/migrate.js +323 -7
- package/dist/store/postgres-applications.d.ts +4 -0
- package/dist/store/postgres-applications.js +197 -0
- package/dist/store/postgres-audience.d.ts +14 -0
- package/dist/store/postgres-audience.js +272 -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 +17 -1
- package/dist/store/postgres.js +60 -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 +762 -2
- package/dist/store/schema.js +218 -5
- package/dist/store/source.d.ts +57 -1
- package/dist/store/source.js +65 -1
- package/dist/store/store.d.ts +29 -6
- package/dist/submit/resolve.d.ts +1 -1
- 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 +2 -0
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/journal.d.ts +104 -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 +33 -1
- package/dist/telemetry/migrate.js +22 -1
- package/dist/telemetry/postgres.d.ts +10 -1
- package/dist/telemetry/postgres.js +188 -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/telemetry/window.d.ts +135 -0
- package/dist/telemetry/window.js +101 -0
- package/dist/testing/application-contract.d.ts +14 -0
- package/dist/testing/application-contract.js +270 -0
- package/dist/testing/audience-overlay-contract.d.ts +31 -0
- package/dist/testing/audience-overlay-contract.js +354 -0
- package/dist/testing/contracts.d.ts +13 -7
- package/dist/testing/contracts.js +13 -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 +297 -6
- 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/contrast.d.ts +19 -14
- package/dist/theme/contrast.js +181 -17
- 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/apply.js +13 -0
- package/dist/tree/compare.d.ts +9 -0
- package/dist/tree/compare.js +18 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +24 -12
- package/dist/tree/navigation.d.ts +5 -0
- package/dist/tree/navigation.js +32 -10
- package/dist/tree/outline.d.ts +7 -0
- package/dist/tree/outline.js +9 -5
- 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 +25 -3
- package/dist/runtime/inverse-interpreter.d.ts +0 -90
- package/dist/runtime/inverse-interpreter.js +0 -56
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AudienceId } from "../audience/audience.js";
|
|
1
2
|
import type { ElementNode } from "../tree/node.js";
|
|
2
3
|
import type { LoomTree } from "../tree/tree.js";
|
|
3
4
|
/**
|
|
@@ -16,12 +17,15 @@ export declare const LOOM_NODE_ATTRIBUTE = "data-loom-node";
|
|
|
16
17
|
export declare const LOOM_TYPE_ATTRIBUTE = "data-loom-type";
|
|
17
18
|
export declare const LOOM_TREE_ATTRIBUTE = "data-loom-tree";
|
|
18
19
|
export declare const LOOM_REVISION_ATTRIBUTE = "data-loom-revision";
|
|
20
|
+
export declare const LOOM_AUDIENCE_ATTRIBUTE = "data-loom-audience";
|
|
19
21
|
export type EditableAttributes = {
|
|
20
22
|
readonly [LOOM_NODE_ATTRIBUTE]: string;
|
|
21
23
|
readonly [LOOM_TYPE_ATTRIBUTE]: string;
|
|
22
24
|
/** Root element only — see `editableAttributes`. */
|
|
23
25
|
readonly [LOOM_TREE_ATTRIBUTE]?: string;
|
|
24
26
|
readonly [LOOM_REVISION_ATTRIBUTE]?: string;
|
|
27
|
+
/** Root element only, and only when the page was served to a segment. */
|
|
28
|
+
readonly [LOOM_AUDIENCE_ATTRIBUTE]?: string;
|
|
25
29
|
};
|
|
26
30
|
/**
|
|
27
31
|
* The root element additionally carries the tree it belongs to and the revision
|
|
@@ -29,6 +33,16 @@ export type EditableAttributes = {
|
|
|
29
33
|
* base. A portal can author an intent from the DOM alone, and an intent
|
|
30
34
|
* authored against a stale render names the stale revision rather than
|
|
31
35
|
* silently claiming the current one.
|
|
36
|
+
*
|
|
37
|
+
* It carries the segment the page was served to as well, when it was served to
|
|
38
|
+
* one (0284, 0371), because the browser cannot work that out for itself: the
|
|
39
|
+
* site's server sorted the reader, and this is how the page's signals learn
|
|
40
|
+
* which segment to be filed under. The renderer never hands it `aud_everyone`
|
|
41
|
+
* (see `RenderOptions.audience`), because a page that names no audience already
|
|
42
|
+
* means it.
|
|
43
|
+
*
|
|
44
|
+
* Only a type is imported for it: this file is what `addressed.ts` hands a
|
|
45
|
+
* reader's browser, and the id's schema would bring the schema library with it.
|
|
32
46
|
*/
|
|
33
|
-
export declare const editableAttributes: (node: ElementNode, tree?: LoomTree) => EditableAttributes;
|
|
47
|
+
export declare const editableAttributes: (node: ElementNode, tree?: LoomTree, audience?: AudienceId) => EditableAttributes;
|
|
34
48
|
//# sourceMappingURL=editable.d.ts.map
|
package/dist/render/editable.js
CHANGED
|
@@ -14,19 +14,31 @@ export const LOOM_NODE_ATTRIBUTE = "data-loom-node";
|
|
|
14
14
|
export const LOOM_TYPE_ATTRIBUTE = "data-loom-type";
|
|
15
15
|
export const LOOM_TREE_ATTRIBUTE = "data-loom-tree";
|
|
16
16
|
export const LOOM_REVISION_ATTRIBUTE = "data-loom-revision";
|
|
17
|
+
export const LOOM_AUDIENCE_ATTRIBUTE = "data-loom-audience";
|
|
17
18
|
/**
|
|
18
19
|
* The root element additionally carries the tree it belongs to and the revision
|
|
19
20
|
* it was rendered from, which is exactly the pair an `EditIntent` needs as its
|
|
20
21
|
* base. A portal can author an intent from the DOM alone, and an intent
|
|
21
22
|
* authored against a stale render names the stale revision rather than
|
|
22
23
|
* silently claiming the current one.
|
|
24
|
+
*
|
|
25
|
+
* It carries the segment the page was served to as well, when it was served to
|
|
26
|
+
* one (0284, 0371), because the browser cannot work that out for itself: the
|
|
27
|
+
* site's server sorted the reader, and this is how the page's signals learn
|
|
28
|
+
* which segment to be filed under. The renderer never hands it `aud_everyone`
|
|
29
|
+
* (see `RenderOptions.audience`), because a page that names no audience already
|
|
30
|
+
* means it.
|
|
31
|
+
*
|
|
32
|
+
* Only a type is imported for it: this file is what `addressed.ts` hands a
|
|
33
|
+
* reader's browser, and the id's schema would bring the schema library with it.
|
|
23
34
|
*/
|
|
24
|
-
export const editableAttributes = (node, tree) => tree
|
|
35
|
+
export const editableAttributes = (node, tree, audience) => tree
|
|
25
36
|
? {
|
|
26
37
|
[LOOM_NODE_ATTRIBUTE]: node.id,
|
|
27
38
|
[LOOM_TYPE_ATTRIBUTE]: node.type,
|
|
28
39
|
[LOOM_TREE_ATTRIBUTE]: tree.treeId,
|
|
29
40
|
[LOOM_REVISION_ATTRIBUTE]: String(tree.revision),
|
|
41
|
+
...(audience === undefined ? {} : { [LOOM_AUDIENCE_ATTRIBUTE]: audience }),
|
|
30
42
|
}
|
|
31
43
|
: {
|
|
32
44
|
[LOOM_NODE_ATTRIBUTE]: node.id,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { NodeData } from "../data/resolution.js";
|
|
2
|
+
import type { JsonObject, JsonValue } from "../json.js";
|
|
3
|
+
import type { PrimitiveType } from "../primitive-type.js";
|
|
4
|
+
import { type BindingDeclaration } from "./reads.js";
|
|
5
|
+
/**
|
|
6
|
+
* What a primitive said it could read, and the answer that arrived instead.
|
|
7
|
+
*
|
|
8
|
+
* A binding has three ways of being wrong and two of them were closed when the
|
|
9
|
+
* seam was built (0058): an unregistered source is refused, and a param the
|
|
10
|
+
* source did not declare is refused. `reads` closed a third — a name nothing
|
|
11
|
+
* reads (0181). This module closes the one left: an answer that arrives under a
|
|
12
|
+
* name the primitive does read, from a source whose own schema accepted it,
|
|
13
|
+
* **in a shape the primitive cannot draw**.
|
|
14
|
+
*
|
|
15
|
+
* The source's schema is a claim about a host's database and says nothing about
|
|
16
|
+
* what can go on a page, which is 0180's reasoning for a primitive carrying its
|
|
17
|
+
* own schema for what it draws. Until now that schema was private to the
|
|
18
|
+
* component — `loom.feed` re-parses every answer by hand, `loom.tally` the same
|
|
19
|
+
* — so nothing outside the component could tell a list bound to a figure from a
|
|
20
|
+
* figure bound to a figure, and the only report of the mistake was whatever the
|
|
21
|
+
* component chose to draw.
|
|
22
|
+
*
|
|
23
|
+
* What this adds is the declaration, not the reading. **The top-level shape is
|
|
24
|
+
* the framework's question and each row stays the primitive's**, because a row's
|
|
25
|
+
* shape is the one thing only the component knows (0175, 0206) and a listing
|
|
26
|
+
* that skips one row is doing its job rather than failing. So an expectation
|
|
27
|
+
* answers *is this the kind of answer I asked for* and never *is every row in
|
|
28
|
+
* it drawable*.
|
|
29
|
+
*/
|
|
30
|
+
/** Whether an answer is the shape the primitive declared it reads. */
|
|
31
|
+
export type AnswerVerdict = {
|
|
32
|
+
readonly outcome: "readable";
|
|
33
|
+
} | {
|
|
34
|
+
readonly outcome: "unreadable";
|
|
35
|
+
readonly detail: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* One primitive's reading of one binding's answer, with its schema erased.
|
|
39
|
+
*
|
|
40
|
+
* A function rather than the Zod schema it came from, for `validate`'s reason in
|
|
41
|
+
* `sdk/definition.ts`: the erasure happens once, where the schema is still in
|
|
42
|
+
* hand, and nothing in the render path then depends on which schema library
|
|
43
|
+
* declared it. Total — it answers for every `JsonValue` and never throws, which
|
|
44
|
+
* is what lets the walk call it while rendering stays total.
|
|
45
|
+
*/
|
|
46
|
+
export type AnswerExpectation = (answer: JsonValue) => AnswerVerdict;
|
|
47
|
+
/**
|
|
48
|
+
* Which answers a primitive says it can read, asked per type.
|
|
49
|
+
*
|
|
50
|
+
* Structural, and detected the way `BindingReader` and `UnshownReader` are: a
|
|
51
|
+
* registry built by the SDK satisfies it, and a host resolving from a plain map
|
|
52
|
+
* has registered nothing that could have declared an expectation. So there is
|
|
53
|
+
* nothing here to wire and nothing that can go missing.
|
|
54
|
+
*
|
|
55
|
+
* Keyed by the **declared** name rather than the name a node asked under, which
|
|
56
|
+
* are different whenever a declaration takes its name from a prop (0184). The
|
|
57
|
+
* shape a primitive draws does not change because a node renamed the binding it
|
|
58
|
+
* draws it from, so the expectation belongs to the declaration and the walk is
|
|
59
|
+
* what resolves one to the other.
|
|
60
|
+
*/
|
|
61
|
+
export interface AnswerReader {
|
|
62
|
+
readonly answersExpectedBy: (type: PrimitiveType) => Readonly<Record<string, AnswerExpectation>> | undefined;
|
|
63
|
+
}
|
|
64
|
+
export declare const isAnswerReader: (value: object) => value is AnswerReader;
|
|
65
|
+
/** The name a declaration is keyed under: itself, or the name it falls back to. */
|
|
66
|
+
export declare const declaredName: (declaration: BindingDeclaration) => string;
|
|
67
|
+
/** One answer this node's primitive was given and said it could not read. */
|
|
68
|
+
export type RefusedAnswer = {
|
|
69
|
+
/** The name the node asked under, which is what a reader of the tree sees. */
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly detail: string;
|
|
72
|
+
};
|
|
73
|
+
export type CheckedAnswers = {
|
|
74
|
+
readonly data: NodeData;
|
|
75
|
+
readonly refused: readonly RefusedAnswer[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* This node's answers with every one its primitive cannot read turned into the
|
|
79
|
+
* named absence of an answer, and the list of the ones that moved.
|
|
80
|
+
*
|
|
81
|
+
* A refused answer becomes `unavailable` rather than being passed through with a
|
|
82
|
+
* diagnostic beside it, and that is the whole point of the declaration. 0058 is
|
|
83
|
+
* explicit that a binding either has an answer or has a **named reason** it does
|
|
84
|
+
* not, and a primitive handed rows it declared it cannot read has no answer in
|
|
85
|
+
* every sense that matters to the page. What it draws is the rendering 0180
|
|
86
|
+
* already designed for that state — a declared line, announced — rather than
|
|
87
|
+
* whatever a hand-written parse happened to fall through to.
|
|
88
|
+
*
|
|
89
|
+
* Returns the data it was given, by reference, whenever nothing was declared or
|
|
90
|
+
* nothing was refused. That is the path every render takes on every node: the
|
|
91
|
+
* check costs one map read per bound node and allocates nothing unless an answer
|
|
92
|
+
* actually moves.
|
|
93
|
+
*
|
|
94
|
+
* An `unavailable` answer is not re-checked. It has no value to be the wrong
|
|
95
|
+
* shape, and the reason it already carries is the more specific of the two.
|
|
96
|
+
*/
|
|
97
|
+
export declare const checkAnswers: (data: NodeData, declared: readonly BindingDeclaration[] | undefined, expectations: Readonly<Record<string, AnswerExpectation>> | undefined, props: JsonObject) => CheckedAnswers;
|
|
98
|
+
//# sourceMappingURL=expected.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { namesRead } from "./reads.js";
|
|
2
|
+
export const isAnswerReader = (value) => typeof value.answersExpectedBy === "function";
|
|
3
|
+
/** The name a declaration is keyed under: itself, or the name it falls back to. */
|
|
4
|
+
export const declaredName = (declaration) => typeof declaration === "string" ? declaration : declaration.default;
|
|
5
|
+
const NOTHING_REFUSED = Object.freeze([]);
|
|
6
|
+
/**
|
|
7
|
+
* This node's answers with every one its primitive cannot read turned into the
|
|
8
|
+
* named absence of an answer, and the list of the ones that moved.
|
|
9
|
+
*
|
|
10
|
+
* A refused answer becomes `unavailable` rather than being passed through with a
|
|
11
|
+
* diagnostic beside it, and that is the whole point of the declaration. 0058 is
|
|
12
|
+
* explicit that a binding either has an answer or has a **named reason** it does
|
|
13
|
+
* not, and a primitive handed rows it declared it cannot read has no answer in
|
|
14
|
+
* every sense that matters to the page. What it draws is the rendering 0180
|
|
15
|
+
* already designed for that state — a declared line, announced — rather than
|
|
16
|
+
* whatever a hand-written parse happened to fall through to.
|
|
17
|
+
*
|
|
18
|
+
* Returns the data it was given, by reference, whenever nothing was declared or
|
|
19
|
+
* nothing was refused. That is the path every render takes on every node: the
|
|
20
|
+
* check costs one map read per bound node and allocates nothing unless an answer
|
|
21
|
+
* actually moves.
|
|
22
|
+
*
|
|
23
|
+
* An `unavailable` answer is not re-checked. It has no value to be the wrong
|
|
24
|
+
* shape, and the reason it already carries is the more specific of the two.
|
|
25
|
+
*/
|
|
26
|
+
export const checkAnswers = (data, declared, expectations, props) => {
|
|
27
|
+
if (!declared || !expectations)
|
|
28
|
+
return { data, refused: NOTHING_REFUSED };
|
|
29
|
+
const asked = namesRead(declared, props);
|
|
30
|
+
const refused = [];
|
|
31
|
+
let checked;
|
|
32
|
+
for (const [index, name] of asked.entries()) {
|
|
33
|
+
if (!Object.hasOwn(data, name))
|
|
34
|
+
continue;
|
|
35
|
+
/**
|
|
36
|
+
* Two declarations can resolve to one name — a fixed `entries` beside a
|
|
37
|
+
* prop-named one that fell back to `entries`. That is a strange thing to
|
|
38
|
+
* declare and the registry does not refuse it, so the first expectation
|
|
39
|
+
* holding an opinion decides and the answer is not re-checked. Reading from
|
|
40
|
+
* `data` rather than from the copy is what makes the guard necessary: the
|
|
41
|
+
* copy has the refusal in it and the original still has the answer.
|
|
42
|
+
*/
|
|
43
|
+
if (checked && Object.hasOwn(checked, name) && data[name] !== checked[name])
|
|
44
|
+
continue;
|
|
45
|
+
const outcome = data[name];
|
|
46
|
+
if (!outcome || outcome.status !== "ready")
|
|
47
|
+
continue;
|
|
48
|
+
const declaration = declared[index];
|
|
49
|
+
if (!declaration)
|
|
50
|
+
continue;
|
|
51
|
+
/**
|
|
52
|
+
* `Object.hasOwn` before the read, and it is not belt-and-braces: a binding
|
|
53
|
+
* name is an identifier and `constructor` is a valid one, so a declaration
|
|
54
|
+
* map built as a plain object literal would answer every undeclared name
|
|
55
|
+
* with something off `Object.prototype`. `freezeExpectations` gives the
|
|
56
|
+
* registry's map no prototype, and this is the half that holds for a caller
|
|
57
|
+
* handing one over directly — a probe, a test, a host assembling its own.
|
|
58
|
+
* Without it an expectation nobody declared is *called*, and `Object` is not
|
|
59
|
+
* a verdict, so every answer under that name would be refused.
|
|
60
|
+
*/
|
|
61
|
+
const key = declaredName(declaration);
|
|
62
|
+
if (!Object.hasOwn(expectations, key))
|
|
63
|
+
continue;
|
|
64
|
+
const expectation = expectations[key];
|
|
65
|
+
if (!expectation)
|
|
66
|
+
continue;
|
|
67
|
+
const verdict = expectation(outcome.value);
|
|
68
|
+
if (verdict.outcome === "readable")
|
|
69
|
+
continue;
|
|
70
|
+
refused.push({ name, detail: verdict.detail });
|
|
71
|
+
if (!checked) {
|
|
72
|
+
checked = Object.create(null);
|
|
73
|
+
for (const held in data) {
|
|
74
|
+
const carried = data[held];
|
|
75
|
+
if (carried)
|
|
76
|
+
checked[held] = carried;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
checked[name] = {
|
|
80
|
+
status: "unavailable",
|
|
81
|
+
unavailable: { reason: "unreadable-answer", detail: verdict.detail },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (!checked)
|
|
85
|
+
return { data, refused: NOTHING_REFUSED };
|
|
86
|
+
return { data: Object.freeze(checked), refused: Object.freeze(refused) };
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=expected.js.map
|
package/dist/render/index.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ export * from "./behaviour.js";
|
|
|
17
17
|
export * from "./control.js";
|
|
18
18
|
export * from "./decorative.js";
|
|
19
19
|
export * from "./diagnostics.js";
|
|
20
|
+
export * from "./document-theme.js";
|
|
20
21
|
export * from "./editable.js";
|
|
22
|
+
export * from "./expected.js";
|
|
21
23
|
export * from "./frame.js";
|
|
22
24
|
/**
|
|
23
25
|
* Named one at a time rather than `export *`: `literalThemeElement` is how the
|
|
@@ -30,6 +32,8 @@ export * from "./props.js";
|
|
|
30
32
|
export * from "./reads.js";
|
|
31
33
|
export * from "./render.js";
|
|
32
34
|
export * from "./request.js";
|
|
35
|
+
export * from "./slots.js";
|
|
33
36
|
export * from "./text.js";
|
|
34
37
|
export * from "./theme.js";
|
|
38
|
+
export * from "./unshown.js";
|
|
35
39
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/render/index.js
CHANGED
|
@@ -17,7 +17,9 @@ export * from "./behaviour.js";
|
|
|
17
17
|
export * from "./control.js";
|
|
18
18
|
export * from "./decorative.js";
|
|
19
19
|
export * from "./diagnostics.js";
|
|
20
|
+
export * from "./document-theme.js";
|
|
20
21
|
export * from "./editable.js";
|
|
22
|
+
export * from "./expected.js";
|
|
21
23
|
export * from "./frame.js";
|
|
22
24
|
/**
|
|
23
25
|
* Named one at a time rather than `export *`: `literalThemeElement` is how the
|
|
@@ -30,6 +32,8 @@ export * from "./props.js";
|
|
|
30
32
|
export * from "./reads.js";
|
|
31
33
|
export * from "./render.js";
|
|
32
34
|
export * from "./request.js";
|
|
35
|
+
export * from "./slots.js";
|
|
33
36
|
export * from "./text.js";
|
|
34
37
|
export * from "./theme.js";
|
|
38
|
+
export * from "./unshown.js";
|
|
35
39
|
//# sourceMappingURL=index.js.map
|
package/dist/render/reads.d.ts
CHANGED
|
@@ -52,6 +52,17 @@ export interface BindingReader {
|
|
|
52
52
|
readonly bindingsReadBy: (type: PrimitiveType) => readonly BindingDeclaration[] | undefined;
|
|
53
53
|
}
|
|
54
54
|
export declare const isBindingReader: (value: object) => value is BindingReader;
|
|
55
|
+
/**
|
|
56
|
+
* Every name a node carrying these props reads, one per declaration.
|
|
57
|
+
*
|
|
58
|
+
* Exported because a second instrument asks the same question of a state it is
|
|
59
|
+
* about to probe in rather than of a node — whether an answer it was handed is
|
|
60
|
+
* keyed under a name this primitive will look for — and the resolution has to be
|
|
61
|
+
* the walk's own or the two disagree about one declaration. Unsorted and not
|
|
62
|
+
* deduplicated: it answers *per declaration*, and `unreadBindings` wants a set
|
|
63
|
+
* while a caller reporting what a primitive asked for wants the list as declared.
|
|
64
|
+
*/
|
|
65
|
+
export declare const namesRead: (declared: readonly BindingDeclaration[], props: JsonObject) => readonly string[];
|
|
55
66
|
/**
|
|
56
67
|
* The names this node asked under that its primitive says it does not read.
|
|
57
68
|
*
|
package/dist/render/reads.js
CHANGED
|
@@ -15,6 +15,17 @@ const nameRead = (declaration, props) => {
|
|
|
15
15
|
const named = props[declaration.fromProp];
|
|
16
16
|
return typeof named === "string" && named !== "" ? named : declaration.default;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Every name a node carrying these props reads, one per declaration.
|
|
20
|
+
*
|
|
21
|
+
* Exported because a second instrument asks the same question of a state it is
|
|
22
|
+
* about to probe in rather than of a node — whether an answer it was handed is
|
|
23
|
+
* keyed under a name this primitive will look for — and the resolution has to be
|
|
24
|
+
* the walk's own or the two disagree about one declaration. Unsorted and not
|
|
25
|
+
* deduplicated: it answers *per declaration*, and `unreadBindings` wants a set
|
|
26
|
+
* while a caller reporting what a primitive asked for wants the list as declared.
|
|
27
|
+
*/
|
|
28
|
+
export const namesRead = (declared, props) => declared.map((declaration) => nameRead(declaration, props));
|
|
18
29
|
/**
|
|
19
30
|
* The names this node asked under that its primitive says it does not read.
|
|
20
31
|
*
|
|
@@ -35,7 +46,7 @@ const nameRead = (declaration, props) => {
|
|
|
35
46
|
export const unreadBindings = (asked, declared, props) => {
|
|
36
47
|
if (declared === undefined)
|
|
37
48
|
return [];
|
|
38
|
-
const reads = new Set(declared
|
|
49
|
+
const reads = new Set(namesRead(declared, props));
|
|
39
50
|
const unread = [];
|
|
40
51
|
for (const name of asked)
|
|
41
52
|
if (!reads.has(name))
|
package/dist/render/render.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type AudienceId } from "../audience/audience.js";
|
|
2
3
|
import { type DataResolution } from "../data/resolution.js";
|
|
3
4
|
import type { FrameOriginRegistry } from "../frame/origin.js";
|
|
4
5
|
import type { NodeId } from "../ids.js";
|
|
@@ -97,6 +98,16 @@ export type RenderOptions = {
|
|
|
97
98
|
* the addresses an event about a reader has to carry (0136).
|
|
98
99
|
*/
|
|
99
100
|
readonly addressed?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* The segment the site's server sorted this reader into, when it sorted them
|
|
103
|
+
* into one (0371) — what `segmentOf` from `@jam-overture/loom/live` answers.
|
|
104
|
+
*
|
|
105
|
+
* Written on the root of an addressed page so its reader signals are filed
|
|
106
|
+
* under that segment (0284), and nowhere else: it changes no node and no
|
|
107
|
+
* prop. Absent, or `aud_everyone`, writes nothing, which is every page as it
|
|
108
|
+
* was before segments.
|
|
109
|
+
*/
|
|
110
|
+
readonly audience?: AudienceId | undefined;
|
|
100
111
|
readonly slots?: SlotContent;
|
|
101
112
|
/**
|
|
102
113
|
* How the mounted theme reaches the elements: as the `var()` references
|