@homepages/concrete 11.0.0 → 13.0.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/CHANGELOG.md +203 -0
- package/README.md +8 -10
- package/codemods/fixtures-are-data.mjs +7 -0
- package/codemods/fixtures-list-properties.mjs +6 -0
- package/codemods/manifest.json +17 -0
- package/codemods/steps/fixtures-list-properties.mjs +16 -0
- package/codemods/steps/fixtures-to-data.mjs +41 -0
- package/dist/artifact/playground/client/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
- package/dist/artifact/playground/client/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
- package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +1338 -0
- package/dist/artifact/playground/client/assets/index-C01UCAWD.css +1 -0
- package/dist/artifact/playground/client/index.html +2 -2
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -1
- package/dist/artifact/playground/host.mjs +110 -60
- package/dist/base.css +19 -59
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/index.js +11 -10
- package/dist/cli/build/manifest.js +44 -0
- package/dist/cli/build/record.js +123 -0
- package/dist/cli/build/sections.js +28 -18
- package/dist/cli/build/source.js +1 -1
- package/dist/cli/build/static.js +8 -5
- package/dist/cli/build/template-build.js +614 -0
- package/dist/cli/check/analyze.js +18 -1
- package/dist/cli/check/load-workspace.js +2 -2
- package/dist/cli/check/portable-names.js +1 -1
- package/dist/cli/check/render/corpus.js +119 -0
- package/dist/cli/check/render/invariants.js +1 -0
- package/dist/cli/check/stages/bundles.js +15 -18
- package/dist/cli/check/stages/composition.js +8 -25
- package/dist/cli/check/stages/fixtures.js +14 -10
- package/dist/cli/check/stages/logic.js +7 -23
- package/dist/cli/check/stages/render.js +12 -14
- package/dist/cli/check/stages/sections.js +22 -66
- package/dist/cli/check/stages/stylesheet.js +4 -26
- package/dist/cli/check/stages/workspace.js +27 -22
- package/dist/cli/commands.js +51 -23
- package/dist/cli/currency/preamble.js +1 -1
- package/dist/cli/currency/resolve-latest.js +3 -2
- package/dist/cli/dev/capture-browser.js +26 -0
- package/dist/cli/dev/fixture-schema.js +441 -0
- package/dist/cli/dev/folder-files.js +244 -0
- package/dist/cli/dev/index.js +7 -3
- package/dist/cli/dev/playground-server.js +34 -0
- package/dist/cli/dev/section-ladders.js +76 -0
- package/dist/cli/dev/server.js +120 -304
- package/dist/cli/install/background.js +16 -0
- package/dist/cli/install/index.js +45 -0
- package/dist/cli/install/tools.js +27 -0
- package/dist/cli/media/derive.js +19 -13
- package/dist/cli/media/deriver-plugin.js +14 -3
- package/dist/cli/property/fixture-list.js +46 -0
- package/dist/cli/property/index.js +12 -9
- package/dist/cli/property/library.js +12 -10
- package/dist/cli/publish/artifact.js +90 -0
- package/dist/cli/publish/captures.js +61 -0
- package/dist/cli/publish/fixtures.js +17 -0
- package/dist/cli/publish/index.js +10 -18
- package/dist/cli/{build → publish}/playground.js +3 -3
- package/dist/cli/publish/report.js +15 -33
- package/dist/cli/upgrade/codemod.d.ts +14 -0
- package/dist/cli/upgrade/fixture-conversion.d.ts +11 -0
- package/dist/cli/upgrade/fixture-conversion.js +54 -0
- package/dist/cli/upgrade/fixture-modules.js +125 -0
- package/dist/cli/upgrade/fixtures-to-data.d.ts +40 -0
- package/dist/cli/upgrade/fixtures-to-data.js +498 -0
- package/dist/cli/upgrade/index.js +18 -2
- package/dist/cli/upgrade/legacy-fixtures.d.ts +34 -0
- package/dist/cli/upgrade/legacy-fixtures.js +22 -0
- package/dist/cli/upgrade/stage.js +1 -1
- package/dist/cli/workspace-fixtures.js +80 -0
- package/dist/cli.js +1 -0
- package/dist/css/compile.js +9 -3
- package/dist/fixtures/bundle-rule.js +16 -16
- package/dist/fixtures/media-plugin.js +12 -33
- package/dist/fixtures/synthesize-empties.js +3 -2
- package/dist/index.d.ts +7 -7
- package/dist/{playground-island-runtime.d.ts → island-runtime.d.ts} +1 -2
- package/dist/{playground-island-runtime.js → island-runtime.js} +1 -2
- package/dist/islands/client-module.js +1 -1
- package/dist/{cli/dev → islands}/tsconfig-paths.js +2 -14
- package/dist/islands/wrap.js +40 -0
- package/dist/node_modules/.pnpm/acorn@8.18.0/node_modules/acorn/dist/acorn.js +5119 -0
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/bundle-evaluation/dist/cache.js +36 -0
- package/dist/packages/internal/bundle-evaluation/dist/evaluate.js +174 -0
- package/dist/packages/internal/bundle-evaluation/dist/index.js +5 -0
- package/dist/packages/internal/bundle-evaluation/dist/section-code.js +10 -0
- package/dist/packages/internal/capture-settle/dist/index.js +2 -2
- package/dist/packages/internal/capture-settle/dist/settle.js +88 -13
- package/dist/packages/internal/code-fingerprint/dist/index.js +57 -0
- package/dist/packages/internal/content-doc-ops/dist/index.js +176 -0
- package/dist/packages/internal/content-doc-ops/dist/made-rows.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/bootstrap.js +81 -0
- package/dist/packages/internal/deliverable-reads/dist/display.js +21 -0
- package/dist/packages/internal/deliverable-reads/dist/format.js +15 -0
- package/dist/packages/internal/deliverable-reads/dist/index.js +7 -0
- package/dist/packages/internal/deliverable-reads/dist/pages.js +29 -0
- package/dist/packages/internal/deliverable-reads/dist/requirements.js +72 -0
- package/dist/{cli/capture → packages/internal/download-files/dist}/bundle.js +8 -4
- package/dist/packages/internal/download-files/dist/capture-origin.js +126 -0
- package/dist/packages/internal/download-files/dist/capture-routes.js +139 -0
- package/dist/packages/internal/download-files/dist/capture-shell.js +38 -0
- package/dist/packages/internal/download-files/dist/capture.js +74 -0
- package/dist/packages/internal/download-files/dist/egress-watch.js +38 -0
- package/dist/packages/internal/download-files/dist/files.js +7 -0
- package/dist/packages/internal/download-files/dist/finish.js +35 -0
- package/dist/packages/internal/download-files/dist/fleet.js +94 -0
- package/dist/packages/internal/download-files/dist/format.js +40 -0
- package/dist/packages/internal/download-files/dist/make.js +105 -0
- package/dist/packages/internal/download-files/dist/master-tally.js +32 -0
- package/dist/packages/internal/download-files/dist/names.js +24 -0
- package/dist/packages/internal/download-files/dist/pdf-boxes.js +33 -0
- package/dist/packages/internal/download-files/dist/pdf-image-placements.js +194 -0
- package/dist/packages/internal/download-files/dist/pdf-images.js +289 -0
- package/dist/packages/internal/file-store/dist/files.js +8 -0
- package/dist/packages/internal/file-store/dist/lru.js +40 -0
- package/dist/packages/internal/file-store/dist/refusal.js +12 -0
- package/dist/packages/internal/file-store/dist/trees.js +151 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +1 -1
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +48 -22
- package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -1
- package/dist/packages/internal/fill-bake/dist/item-merge.js +4 -3
- package/dist/packages/internal/fill-bake/dist/resolve-instance.js +9 -0
- package/dist/packages/internal/fill-bake/dist/resolve.js +3 -0
- package/dist/packages/internal/fill-bake/dist/round-trip.js +2 -0
- package/dist/packages/internal/fill-bake/dist/strip.js +6 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +1 -1
- package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
- package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
- package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
- package/dist/packages/internal/island-runtime/dist/index.js +1 -10
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +5 -0
- package/dist/packages/internal/lead-fields/dist/ingest.js +72 -0
- package/dist/packages/internal/media-resolution/dist/video.js +6 -2
- package/dist/packages/internal/page-render/dist/addresses.js +57 -0
- package/dist/packages/internal/page-render/dist/index.js +6 -0
- package/dist/packages/internal/page-render/dist/kept.js +30 -0
- package/dist/packages/internal/page-render/dist/nav.js +42 -0
- package/dist/packages/internal/page-render/dist/render.js +152 -0
- package/dist/packages/internal/page-shell/dist/assemble.js +161 -0
- package/dist/packages/internal/page-shell/dist/escape.js +10 -0
- package/dist/packages/internal/page-shell/dist/frame.js +23 -0
- package/dist/packages/internal/page-shell/dist/index.js +26 -0
- package/dist/packages/internal/playground/dist/build-fingerprint.js +18 -0
- package/dist/packages/internal/playground/dist/fixture-conversions/list-names-properties.js +76 -0
- package/dist/packages/internal/playground/dist/fixture-formats.d.ts +37 -0
- package/dist/packages/internal/playground/dist/fixture-formats.js +20 -0
- package/dist/packages/internal/playground/dist/host/bootstrap.js +108 -0
- package/dist/packages/internal/playground/dist/host/built.js +202 -0
- package/dist/packages/internal/playground/dist/host/catalog-fixture.js +53 -0
- package/dist/packages/internal/playground/dist/host/download.js +34 -0
- package/dist/packages/internal/playground/dist/host/env.js +11 -0
- package/dist/packages/internal/playground/dist/host/everywhere-saves.js +353 -0
- package/dist/packages/internal/playground/dist/host/fixture-addresses.js +52 -0
- package/dist/packages/internal/playground/dist/host/fixture-documents.js +494 -0
- package/dist/packages/internal/playground/dist/host/fixture-operations.js +364 -0
- package/dist/packages/internal/playground/dist/host/fixture-units.js +93 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/image-dimensions.js +1 -1
- package/dist/packages/internal/playground/dist/host/leads.js +41 -0
- package/dist/packages/internal/playground/dist/host/media-saves.js +309 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/media-store.js +79 -26
- package/dist/packages/internal/playground/dist/host/overridable.js +9 -0
- package/dist/packages/internal/playground/dist/host/owned-saves.js +203 -0
- package/dist/{playground → packages/internal/playground/dist}/host/page-state.js +1 -1
- package/dist/packages/internal/playground/dist/host/program.js +54 -0
- package/dist/packages/internal/playground/dist/host/property-derive.js +216 -0
- package/dist/packages/internal/playground/dist/host/property-saves.js +74 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/property.js +88 -229
- package/dist/packages/internal/playground/dist/host/provenance.js +49 -0
- package/dist/packages/internal/playground/dist/host/resolve.js +553 -0
- package/dist/packages/internal/playground/dist/host/row-images.js +41 -0
- package/dist/{fixtures → packages/internal/playground/dist/host}/rows.js +1 -1
- package/dist/packages/internal/playground/dist/host/save.js +429 -0
- package/dist/packages/internal/playground/dist/host/serve.js +952 -0
- package/dist/packages/internal/playground/dist/host/site.js +79 -0
- package/dist/packages/internal/playground/dist/host/slots.js +202 -0
- package/dist/packages/internal/playground/dist/host/stated-content.js +93 -0
- package/dist/packages/internal/playground/dist/host/stored-fixtures.js +135 -0
- package/dist/packages/internal/playground/dist/host/violations.js +7 -0
- package/dist/packages/internal/playground/dist/jobs/lanes.js +24 -0
- package/dist/packages/internal/playground/dist/jobs/memory-queue.js +112 -0
- package/dist/packages/internal/playground/dist/jobs/probe.js +37 -0
- package/dist/packages/internal/playground/dist/jobs/queue.js +28 -0
- package/dist/packages/internal/playground/dist/jobs/runner.js +207 -0
- package/dist/packages/internal/playground/dist/layout.js +14 -0
- package/dist/packages/internal/playground/dist/platform.js +33 -0
- package/dist/packages/internal/playground/dist/server/changes.js +57 -0
- package/dist/packages/internal/playground/dist/server/crop.js +47 -0
- package/dist/packages/internal/playground/dist/server/derived-files.js +88 -0
- package/dist/packages/internal/playground/dist/server/download.js +158 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/http.js +4 -12
- package/dist/packages/internal/playground/dist/server/jobs.js +29 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/listen.js +4 -11
- package/dist/packages/internal/playground/dist/server/playground-server.js +424 -0
- package/dist/{cli/dev → packages/internal/playground/dist/server}/request-error.js +1 -1
- package/dist/packages/internal/playground/dist/server/size-ladders.js +170 -0
- package/dist/packages/internal/playground/dist/server/verification.js +75 -0
- package/dist/packages/internal/playground/dist/server/verify-build.js +139 -0
- package/dist/packages/internal/playground/dist/wire.js +78 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +1 -1
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +1 -1
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +1 -1
- package/dist/packages/internal/site-files/dist/head.js +59 -0
- package/dist/packages/internal/site-files/dist/index.js +4 -0
- package/dist/packages/internal/site-files/dist/site.js +211 -0
- package/dist/packages/internal/static-assets-binding/dist/index.js +32 -0
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +38 -5
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +8 -1
- package/dist/packages/internal/template-artifact/dist/build.js +148 -0
- package/dist/packages/internal/template-artifact/dist/composition.js +62 -0
- package/dist/packages/internal/template-artifact/dist/index.js +2 -2
- package/dist/packages/internal/template-artifact/dist/layout.js +48 -12
- package/dist/packages/internal/template-artifact/dist/manifest.js +3 -10
- package/dist/packages/internal/template-artifact/dist/verify.js +51 -31
- package/dist/packages/internal/template-contracts/dist/address-value.js +6 -1
- package/dist/packages/internal/template-contracts/dist/content-categories.js +10 -1
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +59 -32
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +14 -1
- package/dist/packages/internal/template-contracts/dist/list.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +67 -2
- package/dist/packages/internal/template-contracts/dist/media-offer.js +180 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +9 -2
- package/dist/packages/internal/template-contracts/dist/read-graph.js +36 -2
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +16 -1
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +9 -10
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +12 -1
- package/dist/packages/internal/template-contracts/dist/registry-graph.js +112 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +15 -2
- package/dist/packages/internal/template-contracts/dist/require-graph.js +300 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +3 -3
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +1 -1
- package/dist/{schema → packages/internal/template-contracts/dist}/section-nav.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +4 -4
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +3 -1
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +24 -1
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +26 -1
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-types.js +1 -1
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/table-members.js +7 -2
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
- package/dist/packages/internal/upload-formats/dist/heic.js +35 -0
- package/dist/packages/internal/upload-formats/dist/index.js +80 -0
- package/dist/packages/internal/upload-formats/dist/magic-bytes.js +293 -0
- package/dist/platform/paths.js +1 -0
- package/dist/platform/process.js +49 -1
- package/dist/primitives/FrameShell.d.ts +5 -2
- package/dist/primitives/FrameShell.js +2 -1
- package/dist/rules/registry.js +28 -4
- package/dist/schema/fact.d.ts +2 -2
- package/dist/schema/facts-view.d.ts +1 -1
- package/dist/schema/format.d.ts +0 -1
- package/dist/schema/format.js +1 -2
- package/dist/schema/manifest.js +18 -24
- package/dist/schema/section-props.d.ts +1 -1
- package/dist/schema/section-schema.d.ts +1 -1
- package/dist/schema/section-schema.js +1 -0
- package/dist/section/declare.d.ts +1 -1
- package/dist/section/discovery.js +6 -2
- package/dist/section/publish-shape.js +38 -0
- package/dist/section/section.d.ts +1 -1
- package/dist/site-analytics.js +6 -1
- package/dist/site-runtime/window-height.js +19 -0
- package/dist/template/define-template.d.ts +25 -4
- package/dist/template/define-template.js +3 -0
- package/dist/template/logic-shim.d.ts +1 -1
- package/dist/template/materialize.js +3 -1
- package/dist/template/running-copy.js +0 -1
- package/dist/template/section-reads.js +1 -1
- package/guide/reference/cli/INDEX.md +6 -5
- package/guide/reference/cli/build.md +10 -8
- package/guide/reference/cli/check.md +4 -2
- package/guide/reference/cli/dev.md +6 -2
- package/guide/reference/cli/install.md +41 -0
- package/guide/reference/cli/property-add.md +5 -4
- package/guide/reference/cli/property-list.md +2 -2
- package/guide/reference/cli/publish.md +5 -5
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +9 -5
- package/package.json +14 -30
- package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
- package/dist/artifact/playground/client/assets/index-CxWPYOH2.css +0 -1
- package/dist/cli/build/artifact.js +0 -220
- package/dist/cli/build/captures.js +0 -48
- package/dist/cli/build/fixtures.js +0 -92
- package/dist/cli/capture/capture-browser.js +0 -37
- package/dist/cli/capture/capture.js +0 -113
- package/dist/cli/check/render/inputs.js +0 -60
- package/dist/cli/check/render/nav.js +0 -31
- package/dist/cli/dev/crop.js +0 -20
- package/dist/cli/dev/fixture-ladders.js +0 -96
- package/dist/cli/dev/hmr.js +0 -26
- package/dist/cli/dev/islands.js +0 -234
- package/dist/cli/dev/load-template.js +0 -52
- package/dist/cli/dev/vite.js +0 -114
- package/dist/cli/dev/workspace-reader.js +0 -248
- package/dist/cli/publish/freshness.js +0 -64
- package/dist/fixtures/brand.d.ts +0 -4
- package/dist/fixtures/brand.js +0 -8
- package/dist/fixtures/load.js +0 -159
- package/dist/fixtures/resolve.js +0 -392
- package/dist/fixtures.d.ts +0 -429
- package/dist/fixtures.js +0 -23
- package/dist/packages/internal/canvas-core/dist/island-host.js +0 -62
- package/dist/packages/internal/canvas-core/dist/island-shields.js +0 -30
- package/dist/playground/canvas-island-host.d.ts +0 -11
- package/dist/playground/canvas-island-host.js +0 -29
- package/dist/playground/canvas-markers.js +0 -14
- package/dist/playground/host/paths.js +0 -8
- package/dist/playground/layout.js +0 -17
- package/dist/playground/wire.js +0 -28
|
@@ -81,6 +81,21 @@ function holderOf(slots, reader, key) {
|
|
|
81
81
|
kind: found.def.type
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
+
function memberAddressOf(slots, reader, member) {
|
|
85
|
+
const holder = holderOf(slots, reader, member.slot);
|
|
86
|
+
if (holder === void 0) return void 0;
|
|
87
|
+
const table = holder.kind === "row" ? rowTableOf(holder.def) : null;
|
|
88
|
+
return table === null ? {
|
|
89
|
+
layer: "section",
|
|
90
|
+
slot: holder.path,
|
|
91
|
+
member: member.field
|
|
92
|
+
} : {
|
|
93
|
+
layer: "home",
|
|
94
|
+
row: holder.path,
|
|
95
|
+
table,
|
|
96
|
+
member: member.field
|
|
97
|
+
};
|
|
98
|
+
}
|
|
84
99
|
function rowTableOf(row) {
|
|
85
100
|
return tableOf(row.from);
|
|
86
101
|
}
|
|
@@ -177,4 +192,4 @@ function elementIdentityField(element) {
|
|
|
177
192
|
}
|
|
178
193
|
|
|
179
194
|
//#endregion
|
|
180
|
-
export { attributedRows, elementIdentity, elementIdentityField, heldRowTableOf, holderOf, isHolderKind, itemHolderOf, itemRowTablesOf, listTableOf, listTablesOf, mirrorRefOf, placementOf, refSectionKey, rowTableOf, rowTablesOf, sectionSlotAt, slotInScope, slotTableOf };
|
|
195
|
+
export { attributedRows, elementIdentity, elementIdentityField, heldRowTableOf, holderOf, isHolderKind, itemHolderOf, itemRowTablesOf, listTableOf, listTablesOf, memberAddressOf, mirrorRefOf, placementOf, refSectionKey, rowTableOf, rowTablesOf, sectionSlotAt, slotInScope, slotTableOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { KindProcessVerb, MediaKind } from "./slot-catalog.js";
|
|
1
2
|
import { AddressView } from "./address-value.js";
|
|
2
|
-
import { MediaKind } from "./slot-catalog.js";
|
|
3
3
|
import { FactHome, LibraryFactRegistry, PropertyFactRegistry } from "./fact-registry.js";
|
|
4
4
|
//#region ../../internal/template-contracts/dist/registry-facts.d.ts
|
|
5
5
|
/**
|
|
@@ -94,6 +94,13 @@ interface FileMembers {
|
|
|
94
94
|
renditions: FileRenditions;
|
|
95
95
|
/** Whether its gating processing has finished. */
|
|
96
96
|
state: FileState;
|
|
97
|
+
/**
|
|
98
|
+
* The outputs whose run failed at the file's current inputs, by verb, each with its
|
|
99
|
+
* memo's `error`; absent where none did. A failed output is that output's alone: `state`
|
|
100
|
+
* reads only what reads the file (`KindRowEntry.reads`), so a surface waiting on one
|
|
101
|
+
* output asks here.
|
|
102
|
+
*/
|
|
103
|
+
failed_outputs?: Readonly<Partial<Record<KindProcessVerb, string>>>;
|
|
97
104
|
}
|
|
98
105
|
/** An image file: a photo, a floor plan, a logo, a headshot. */
|
|
99
106
|
interface ImageFile extends FileMembers {
|
|
@@ -155,8 +162,6 @@ interface DocumentFile extends FileMembers {
|
|
|
155
162
|
encode: null;
|
|
156
163
|
};
|
|
157
164
|
}
|
|
158
|
-
/** One file, narrowed by its kind. Named `MediaFile`, not `File`, so it never shadows the DOM's `File` where a browser imports it. */
|
|
159
|
-
type MediaFile = ImageFile | VideoFile | TourFile | DocumentFile;
|
|
160
165
|
/** The value a home owning place holds — an `uploads` item, a contact's `headshot`. */
|
|
161
166
|
interface HomeMediaValue {
|
|
162
167
|
/** The media id, minted at birth: the owning item's identity, what a reference names. */
|
|
@@ -260,11 +265,5 @@ type FactItem<E> = E extends {
|
|
|
260
265
|
} & FactValue<E> : E extends {
|
|
261
266
|
readonly type: "row";
|
|
262
267
|
} ? FactValue<E> : NonNullable<FactValue<E>>;
|
|
263
|
-
type PropertyPages = PropertyFactRegistry["pages"];
|
|
264
|
-
/** One property's facts as `propertyFacts` declares them, and the files their media values are over. */
|
|
265
|
-
type RegistryFacts = { -readonly [K in keyof PropertyPages]: FactValue<PropertyPages[K]["declaration"]>; } & {
|
|
266
|
-
/** The file of every owning value the document holds, keyed by its id. */
|
|
267
|
-
files: Record<string, MediaFile>;
|
|
268
|
-
};
|
|
269
268
|
//#endregion
|
|
270
|
-
export { DocumentFile, DocumentMedia, DocumentMediaValue, FILE_RENDITION_NAMES, FactItem, FactValue, FileRenditionName, FileRenditions, FileState, HomeMediaValue, ImageFile, ImageMedia, Media, MediaCrop,
|
|
269
|
+
export { DocumentFile, DocumentMedia, DocumentMediaValue, FILE_RENDITION_NAMES, FactItem, FactValue, FileRenditionName, FileRenditions, FileState, HomeMediaValue, ImageFile, ImageMedia, Media, MediaCrop, MediaReference, PLACE_RENDITION_NAMES, PlaceMembers, PlaceRendition, PlaceRenditionName, PlaceRenditions, Rendition, RenditionInputs, TourFile, TourMedia, VideoFile, VideoMedia };
|
|
@@ -24,6 +24,7 @@ const RENDITION_NAMES = [
|
|
|
24
24
|
function cropsPart(crop) {
|
|
25
25
|
return crop !== null && !(crop.x <= 0 && crop.y <= 0 && crop.width >= 1 && crop.height >= 1);
|
|
26
26
|
}
|
|
27
|
+
const JOB_FAILED_ERROR = "job_failed";
|
|
27
28
|
function fileNameOf(file) {
|
|
28
29
|
if (file.url !== null) return file.url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, "");
|
|
29
30
|
return file.key?.split("/").pop() ?? file.id;
|
|
@@ -153,6 +154,16 @@ function framedAt(record, reference) {
|
|
|
153
154
|
}
|
|
154
155
|
};
|
|
155
156
|
}
|
|
157
|
+
function framedValueAt(value, reference) {
|
|
158
|
+
if (!hasOwnFraming(reference)) return value;
|
|
159
|
+
return {
|
|
160
|
+
...value,
|
|
161
|
+
...framingOver({
|
|
162
|
+
crop: value.crop,
|
|
163
|
+
renditions: value.renditions
|
|
164
|
+
}, reference)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
156
167
|
function readAsRecords(value, document) {
|
|
157
168
|
let records;
|
|
158
169
|
const resolve = (id) => {
|
|
@@ -188,4 +199,4 @@ function storedAsRefs(value) {
|
|
|
188
199
|
}
|
|
189
200
|
|
|
190
201
|
//#endregion
|
|
191
|
-
export { FILE_RENDITION_NAMES, PLACE_RENDITION_NAMES, RENDITION_NAMES, contentMediaIdOf, cropsPart, fileNameOf, framedAt, framingOver, hasOwnFraming, isContentMediaValue, isHomeMediaValue, isMediaRecord, isMediaReference, mediaIdOf, mediaRecords, mergeMedia, owningValues, readAsRecords, recordOf, splitMedia, storedAsRefs, videoSourceOf };
|
|
202
|
+
export { FILE_RENDITION_NAMES, JOB_FAILED_ERROR, PLACE_RENDITION_NAMES, RENDITION_NAMES, contentMediaIdOf, cropsPart, fileNameOf, framedAt, framedValueAt, framingOver, hasOwnFraming, isContentMediaValue, isHomeMediaValue, isMediaRecord, isMediaReference, mediaIdOf, mediaRecords, mergeMedia, owningValues, readAsRecords, recordOf, splitMedia, storedAsRefs, videoSourceOf };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ADDRESS_MEMBERS } from "./address-value.js";
|
|
2
|
+
import { isFactCompute } from "./fact-compute.js";
|
|
3
|
+
import { fromListsOf } from "./media-candidates.js";
|
|
4
|
+
import { linkedRegistry } from "./registry-shape.js";
|
|
5
|
+
import { isPaged, listKeyOf, pickedRowOf, rowFromKeys } from "./fact-registry.js";
|
|
6
|
+
import { fillSpecFromRegistry } from "./fill-spec.js";
|
|
7
|
+
|
|
8
|
+
//#region ../../internal/template-contracts/dist/registry-graph.js
|
|
9
|
+
const PLATFORM_READS = {
|
|
10
|
+
property: ["property.hero"],
|
|
11
|
+
library: []
|
|
12
|
+
};
|
|
13
|
+
function readPaths(reads, item) {
|
|
14
|
+
const paths = [];
|
|
15
|
+
for (const read of reads ?? []) if (read.kind === "home" && read.key !== void 0) paths.push(read.key);
|
|
16
|
+
else if (read.kind === "item" && read.field !== void 0 && item !== null) paths.push(`${item}[].${read.field}`);
|
|
17
|
+
return paths;
|
|
18
|
+
}
|
|
19
|
+
function computeReads(source, item) {
|
|
20
|
+
return isFactCompute(source) ? readPaths(source.reads, item) : [];
|
|
21
|
+
}
|
|
22
|
+
function fromReads(declaration) {
|
|
23
|
+
const from = declaration.from;
|
|
24
|
+
return from === void 0 || declaration.type === "row" ? [] : [...fromListsOf(from) ?? []];
|
|
25
|
+
}
|
|
26
|
+
function fillReads(decision, item) {
|
|
27
|
+
const of = decision?.of;
|
|
28
|
+
const candidates = of?.type === "media" ? [...fromListsOf(of.from) ?? []] : [];
|
|
29
|
+
return [...(decision?.fills ?? []).flatMap((fill) => readPaths(fill.reads, item)), ...candidates];
|
|
30
|
+
}
|
|
31
|
+
function unique(paths) {
|
|
32
|
+
return [...new Set(paths)];
|
|
33
|
+
}
|
|
34
|
+
function itemFields(element) {
|
|
35
|
+
if (element.type === "object") return {
|
|
36
|
+
fields: element.fields,
|
|
37
|
+
rowsOf: null
|
|
38
|
+
};
|
|
39
|
+
const row = pickedRowOf(element);
|
|
40
|
+
if (row === null) return null;
|
|
41
|
+
const from = rowFromKeys(row)[0];
|
|
42
|
+
if (from === void 0) return null;
|
|
43
|
+
const { home, key } = listKeyOf(from);
|
|
44
|
+
const table = linkedRegistry(home).pages[key]?.declaration;
|
|
45
|
+
if (table?.type !== "list" || table.element.type !== "object") return null;
|
|
46
|
+
return {
|
|
47
|
+
fields: table.element.fields,
|
|
48
|
+
rowsOf: from
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function factOf(registry, key, specById) {
|
|
52
|
+
const page = registry.pages[key];
|
|
53
|
+
const declaration = page.declaration;
|
|
54
|
+
const path = `${registry.home}.${key}`;
|
|
55
|
+
const decision = specById.get(path);
|
|
56
|
+
const head = page.head;
|
|
57
|
+
const reads = [
|
|
58
|
+
...fillReads(decision, path),
|
|
59
|
+
...computeReads(declaration.source, null),
|
|
60
|
+
...fromReads(declaration),
|
|
61
|
+
...head === null ? [] : [...computeReads(head.title, null), ...computeReads(head.description, null)],
|
|
62
|
+
...declaration.type === "list" ? [...computeReads(declaration.max, null), ...fromReads(declaration.element)] : []
|
|
63
|
+
];
|
|
64
|
+
const item = declaration.type === "list" ? itemFields(declaration.element) : null;
|
|
65
|
+
let fields;
|
|
66
|
+
if (item !== null) fields = Object.entries(item.fields).map(([member, field]) => ({
|
|
67
|
+
path: `${path}[].${member}`,
|
|
68
|
+
declaration: field,
|
|
69
|
+
reads: unique([
|
|
70
|
+
...computeReads(field.source, path),
|
|
71
|
+
...fillReads(decision?.fields?.[member], path),
|
|
72
|
+
...fromReads(field)
|
|
73
|
+
])
|
|
74
|
+
}));
|
|
75
|
+
else if (declaration.type === "address") fields = ADDRESS_MEMBERS.map((part) => ({
|
|
76
|
+
path: `${path}.${part}`,
|
|
77
|
+
declaration: null,
|
|
78
|
+
reads: []
|
|
79
|
+
}));
|
|
80
|
+
else fields = [{
|
|
81
|
+
path,
|
|
82
|
+
declaration,
|
|
83
|
+
reads: []
|
|
84
|
+
}];
|
|
85
|
+
return {
|
|
86
|
+
home: registry.home,
|
|
87
|
+
key,
|
|
88
|
+
path,
|
|
89
|
+
declaration,
|
|
90
|
+
paged: isPaged(page),
|
|
91
|
+
rowsOf: item?.rowsOf ?? null,
|
|
92
|
+
fields,
|
|
93
|
+
reads: unique(reads.filter((read) => read !== path))
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const GRAPHS = /* @__PURE__ */ new WeakMap();
|
|
97
|
+
function registryGraphOf(registry) {
|
|
98
|
+
const cached = GRAPHS.get(registry);
|
|
99
|
+
if (cached !== void 0) return cached;
|
|
100
|
+
const specById = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const raw of fillSpecFromRegistry(registry).decisions) if (raw.id !== void 0) specById.set(raw.id, raw);
|
|
102
|
+
const graph = {
|
|
103
|
+
home: registry.home,
|
|
104
|
+
facts: Object.keys(registry.pages).map((key) => factOf(registry, key, specById)),
|
|
105
|
+
platformReads: PLATFORM_READS[registry.home]
|
|
106
|
+
};
|
|
107
|
+
GRAPHS.set(registry, graph);
|
|
108
|
+
return graph;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
export { registryGraphOf };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ADDRESS_MEMBERS } from "./address-value.js";
|
|
2
2
|
import { isMediaKind } from "./slot-catalog.js";
|
|
3
3
|
import { isFactCompute } from "./fact-compute.js";
|
|
4
|
-
import "./media-candidates.js";
|
|
4
|
+
import { mediaFilterOf } from "./media-candidates.js";
|
|
5
5
|
|
|
6
6
|
//#region ../../internal/template-contracts/dist/registry-shape.js
|
|
7
7
|
const LINKED = /* @__PURE__ */ new Map();
|
|
@@ -36,6 +36,19 @@ function listValueType(element) {
|
|
|
36
36
|
if (element.type === "number") return "number_list";
|
|
37
37
|
return TEXT_TYPES.has(element.type) ? "text_list" : null;
|
|
38
38
|
}
|
|
39
|
+
function memberMediaFilter(declaration) {
|
|
40
|
+
if (declaration.type === "list") {
|
|
41
|
+
const element = declaration.element;
|
|
42
|
+
if (element.type !== "object") return memberMediaFilter(element);
|
|
43
|
+
for (const field of Object.values(element.fields)) {
|
|
44
|
+
const filter = memberMediaFilter(field);
|
|
45
|
+
if (filter !== void 0) return filter;
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const filter = declaration.from === void 0 ? null : mediaFilterOf(declaration);
|
|
50
|
+
return filter?.from === void 0 ? void 0 : filter;
|
|
51
|
+
}
|
|
39
52
|
function isMediaListDeclaration(declaration) {
|
|
40
53
|
if (declaration.type !== "list") return false;
|
|
41
54
|
const element = declaration.element.type;
|
|
@@ -190,4 +203,4 @@ function tableColumnOfKey(key) {
|
|
|
190
203
|
}
|
|
191
204
|
|
|
192
205
|
//#endregion
|
|
193
|
-
export { addressPartValueType, fieldOf, isDerived, isMediaListDeclaration, linkRegistry, linkedRegistry, linkedTableFields, mediaListKeysOf, memberListOfKey, memberValueType, registryFactsOf, stampTableBounds, tableBounds, tableColumnOfKey, tableFieldsIn, tableForSlot, tableHome, tableKey, tableMemberValueType, tableNames, tableOf, tableOfSource };
|
|
206
|
+
export { addressPartValueType, fieldOf, isDerived, isMediaListDeclaration, linkRegistry, linkedRegistry, linkedTableFields, mediaListKeysOf, memberListOfKey, memberMediaFilter, memberValueType, registryFactsOf, stampTableBounds, tableBounds, tableColumnOfKey, tableFieldsIn, tableForSlot, tableHome, tableKey, tableMemberValueType, tableNames, tableOf, tableOfSource };
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { normalizeAddressValue } from "./address-value.js";
|
|
2
|
+
import { libraryFacts, listKeyOf, propertyFacts } from "./fact-registry.js";
|
|
3
|
+
import { objectFieldSlotId } from "./slot-overrides.js";
|
|
4
|
+
import { PRIMITIVE_DESCRIPTORS } from "./primitive-descriptors.js";
|
|
5
|
+
import { registryGraphOf } from "./registry-graph.js";
|
|
6
|
+
|
|
7
|
+
//#region ../../internal/template-contracts/dist/require-graph.js
|
|
8
|
+
const PATH = /^([a-z]+\.[a-z_]+)(?:(\[\]|\[0\])\.([a-z_]+))?(?:\.([a-z_]+))?$/;
|
|
9
|
+
function catalogOf(registries) {
|
|
10
|
+
const graphs = registries.map(registryGraphOf);
|
|
11
|
+
const facts = graphs.flatMap((graph) => graph.facts);
|
|
12
|
+
return {
|
|
13
|
+
platformReads: graphs.flatMap((graph) => graph.platformReads),
|
|
14
|
+
facts,
|
|
15
|
+
byPath: new Map(facts.map((fact) => [fact.path, fact])),
|
|
16
|
+
fields: new Map(facts.flatMap((fact) => fact.fields.map((field) => [field.path, field])))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function parse(catalog, path) {
|
|
20
|
+
const match = PATH.exec(path);
|
|
21
|
+
const fact = match === null ? void 0 : catalog.byPath.get(match[1]);
|
|
22
|
+
if (match === null || fact === void 0) throw new Error(`require graph: "${path}" names no fact the registries declare.`);
|
|
23
|
+
const [, , rows, member, part] = match;
|
|
24
|
+
return {
|
|
25
|
+
fact,
|
|
26
|
+
...rows === void 0 ? {} : { rows: rows === "[0]" ? "first" : "every" },
|
|
27
|
+
...member === void 0 ? {} : { member },
|
|
28
|
+
...part === void 0 ? {} : { part }
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function fieldsOfRead(catalog, path) {
|
|
32
|
+
const parsed = parse(catalog, path);
|
|
33
|
+
if (parsed.member !== void 0) return [`${parsed.fact.path}[].${parsed.member}`];
|
|
34
|
+
if (parsed.part !== void 0) return [`${parsed.fact.path}.${parsed.part}`];
|
|
35
|
+
return parsed.fact.fields.map((field) => field.path);
|
|
36
|
+
}
|
|
37
|
+
function isRecord(value) {
|
|
38
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39
|
+
}
|
|
40
|
+
function isEmptyAs(declaration, value) {
|
|
41
|
+
if (declaration === null) return value == null;
|
|
42
|
+
switch (declaration.type) {
|
|
43
|
+
case "list": return !Array.isArray(value) || value.length === 0;
|
|
44
|
+
case "object": return !isRecord(value);
|
|
45
|
+
case "row": return value == null;
|
|
46
|
+
case "media": return PRIMITIVE_DESCRIPTORS.image.isEmpty(value);
|
|
47
|
+
default: return PRIMITIVE_DESCRIPTORS[declaration.type]?.isEmpty(value) ?? value == null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function partEmpty(value, part) {
|
|
51
|
+
const place = normalizeAddressValue(value);
|
|
52
|
+
return place === null || place[part] === null;
|
|
53
|
+
}
|
|
54
|
+
function pickedRowId(item) {
|
|
55
|
+
if (typeof item === "string") return item;
|
|
56
|
+
if (!isRecord(item)) return null;
|
|
57
|
+
const id = item["id"] ?? item["row_id"];
|
|
58
|
+
return typeof id === "string" ? id : null;
|
|
59
|
+
}
|
|
60
|
+
function memberOf(fact, facts, item, member, path) {
|
|
61
|
+
if (fact.rowsOf === null) return isRecord(item) ? item[member] : void 0;
|
|
62
|
+
const table = listKeyOf(fact.rowsOf);
|
|
63
|
+
const home = facts[table.home];
|
|
64
|
+
const id = pickedRowId(item);
|
|
65
|
+
const rows = home?.[table.key];
|
|
66
|
+
const row = Array.isArray(rows) && id !== null ? rows.find((candidate) => isRecord(candidate) && candidate["id"] === id) : void 0;
|
|
67
|
+
if (isRecord(row)) return row[member];
|
|
68
|
+
if (isRecord(item) && Object.hasOwn(item, member)) return item[member];
|
|
69
|
+
if (home == null && id !== null) throw new Error(`require graph: "${path}" reads a picked row's member, but the facts hold only the pick; pass the ${table.home} facts, where the row's members are stored.`);
|
|
70
|
+
}
|
|
71
|
+
function answered(catalog, facts, path) {
|
|
72
|
+
const { fact, rows, member, part } = parse(catalog, path);
|
|
73
|
+
const value = facts[fact.home]?.[fact.key] ?? null;
|
|
74
|
+
if (member === void 0) return part === void 0 ? !isEmptyAs(fact.declaration, value) : !partEmpty(value, part);
|
|
75
|
+
const declaration = catalog.fields.get(`${fact.path}[].${member}`)?.declaration ?? null;
|
|
76
|
+
const holds = (row) => {
|
|
77
|
+
const memberValue = memberOf(fact, facts, row, member, path);
|
|
78
|
+
return part === void 0 ? !isEmptyAs(declaration, memberValue) : !partEmpty(memberValue, part);
|
|
79
|
+
};
|
|
80
|
+
const items = Array.isArray(value) ? value : [];
|
|
81
|
+
return rows === "first" ? items.length > 0 && holds(items[0]) : items.every(holds);
|
|
82
|
+
}
|
|
83
|
+
function isEmptyContent(value) {
|
|
84
|
+
if (value == null) return true;
|
|
85
|
+
if (typeof value === "string") return value.trim() === "";
|
|
86
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
87
|
+
if (isRecord(value)) return Object.keys(value).length === 0;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
function contentEmptyAt(slots, path) {
|
|
91
|
+
const [head, ...rest] = path.split("[]");
|
|
92
|
+
const dot = head.indexOf(".");
|
|
93
|
+
return emptyThrough(dot < 0 ? slots[head] : slots[objectFieldSlotId(head.slice(0, dot), head.slice(dot + 1))] ?? at(slots[head.slice(0, dot)], head.slice(dot + 1)), rest);
|
|
94
|
+
}
|
|
95
|
+
function at(value, dotted) {
|
|
96
|
+
let current = value;
|
|
97
|
+
for (const key of dotted.split(".").filter((k) => k !== "")) current = isRecord(current) ? current[key] : void 0;
|
|
98
|
+
return current;
|
|
99
|
+
}
|
|
100
|
+
function emptyThrough(value, rest) {
|
|
101
|
+
if (rest.length === 0) return isEmptyContent(value);
|
|
102
|
+
if (!Array.isArray(value)) return false;
|
|
103
|
+
const [next, ...more] = rest;
|
|
104
|
+
return value.some((item) => emptyThrough(at(item, next), more));
|
|
105
|
+
}
|
|
106
|
+
function inCase(slot, variant) {
|
|
107
|
+
return slot.when === void 0 || variant !== void 0 && slot.when.includes(variant);
|
|
108
|
+
}
|
|
109
|
+
function ancestorsOf(path) {
|
|
110
|
+
const out = [];
|
|
111
|
+
for (let at = path.indexOf("[]"); at >= 0; at = path.indexOf("[]", at + 2)) out.push(path.slice(0, at), path.slice(0, at + 2));
|
|
112
|
+
return out.filter((ancestor) => ancestor !== path);
|
|
113
|
+
}
|
|
114
|
+
function chainsIn(instance, slot, variant) {
|
|
115
|
+
const holds = (holder) => holder.required && inCase(holder, variant);
|
|
116
|
+
if (!holds(slot)) return false;
|
|
117
|
+
return ancestorsOf(slot.path).every((path) => {
|
|
118
|
+
const holder = instance.slots.find((candidate) => candidate.path === path);
|
|
119
|
+
return holder === void 0 || holds(holder);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function casesOf(subject, instance) {
|
|
123
|
+
const cases = instance.variant === void 0 ? void 0 : subject.variantCases.get(instance.section);
|
|
124
|
+
return cases === void 0 || cases.length === 0 ? [void 0] : cases;
|
|
125
|
+
}
|
|
126
|
+
function storedGates(content, pageId, instance) {
|
|
127
|
+
const pageEnabled = content.page_state?.find((state) => state.page_id === pageId)?.enabled !== false;
|
|
128
|
+
const stored = content.instances.find((entry) => entry.instance_id === instance.instanceId);
|
|
129
|
+
const visible = stored?.enabled === void 0 ? instance.visibility?.first !== "hidden" : stored.enabled;
|
|
130
|
+
const variant = instance.variant === void 0 ? void 0 : stored?.variant ?? instance.variant.first;
|
|
131
|
+
return {
|
|
132
|
+
shown: pageEnabled && instance.required && visible,
|
|
133
|
+
variant
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const DEFAULT_REGISTRIES = [propertyFacts, libraryFacts];
|
|
137
|
+
function requireAll(into, paths) {
|
|
138
|
+
for (const path of paths) into.set(path, [path]);
|
|
139
|
+
}
|
|
140
|
+
function requireAny(into, paths) {
|
|
141
|
+
if (paths.length === 1) requireAll(into, paths);
|
|
142
|
+
else if (paths.length > 1) into.set(paths.join("|"), paths);
|
|
143
|
+
}
|
|
144
|
+
function intersect(sets) {
|
|
145
|
+
const [first, ...rest] = sets;
|
|
146
|
+
if (first === void 0) return /* @__PURE__ */ new Map();
|
|
147
|
+
return new Map([...first].filter(([key]) => rest.every((set) => set.has(key))));
|
|
148
|
+
}
|
|
149
|
+
function evaluateRequirements(input) {
|
|
150
|
+
const catalog = catalogOf(input.registries ?? DEFAULT_REGISTRIES);
|
|
151
|
+
const used = /* @__PURE__ */ new Set();
|
|
152
|
+
const touched = /* @__PURE__ */ new Set();
|
|
153
|
+
const visitRead = (path) => {
|
|
154
|
+
const { fact } = parse(catalog, path);
|
|
155
|
+
if (!touched.has(fact.path)) {
|
|
156
|
+
touched.add(fact.path);
|
|
157
|
+
fact.reads.forEach(visitRead);
|
|
158
|
+
}
|
|
159
|
+
for (const field of fieldsOfRead(catalog, path)) {
|
|
160
|
+
if (used.has(field)) continue;
|
|
161
|
+
used.add(field);
|
|
162
|
+
catalog.fields.get(field)?.reads.forEach(visitRead);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const required = /* @__PURE__ */ new Map();
|
|
166
|
+
const preconditions = [];
|
|
167
|
+
const pendingPreconditions = [];
|
|
168
|
+
const emptyContent = [];
|
|
169
|
+
catalog.platformReads.forEach(visitRead);
|
|
170
|
+
for (const subject of input.subjects) {
|
|
171
|
+
const instances = /* @__PURE__ */ new Map();
|
|
172
|
+
for (const page of subject.graph.pages) for (const instance of page.instances) instances.set(instance.instanceId, {
|
|
173
|
+
pageId: page.id,
|
|
174
|
+
instance
|
|
175
|
+
});
|
|
176
|
+
const contentEmpty = /* @__PURE__ */ new Set();
|
|
177
|
+
const sourceOf = (pageId, instance, slot, seen, visit) => {
|
|
178
|
+
if (slot.kind !== "mirror") {
|
|
179
|
+
visit(pageId, instance, slot);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const upstream = slot.mirrors === void 0 ? void 0 : instances.get(slot.mirrors.instanceId);
|
|
183
|
+
const key = `${slot.mirrors?.instanceId ?? ""}/${slot.mirrors?.slot ?? ""}`;
|
|
184
|
+
const target = upstream?.instance.slots.find((candidate) => candidate.path === slot.mirrors?.slot);
|
|
185
|
+
if (upstream !== void 0 && target !== void 0 && !seen.has(key)) sourceOf(upstream.pageId, upstream.instance, target, /* @__PURE__ */ new Set([...seen, key]), visit);
|
|
186
|
+
};
|
|
187
|
+
const requireFacts = (into) => (_pageId, _instance, slot) => {
|
|
188
|
+
switch (slot.kind) {
|
|
189
|
+
case "binding":
|
|
190
|
+
case "member":
|
|
191
|
+
requireAll(into, slot.reads);
|
|
192
|
+
return;
|
|
193
|
+
case "row":
|
|
194
|
+
requireAny(into, slot.reads);
|
|
195
|
+
return;
|
|
196
|
+
case "compute":
|
|
197
|
+
case "fill":
|
|
198
|
+
case "content":
|
|
199
|
+
requireAll(into, slot.requires);
|
|
200
|
+
return;
|
|
201
|
+
case "mirror":
|
|
202
|
+
case "element": return;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const markContent = (content) => (pageId, instance, slot) => {
|
|
206
|
+
if (slot.kind !== "fill" && slot.kind !== "content") return;
|
|
207
|
+
const stored = content.instances.find((entry) => entry.instance_id === instance.instanceId);
|
|
208
|
+
const key = `${instance.instanceId}/${slot.path}`;
|
|
209
|
+
if (contentEmpty.has(key) || !contentEmptyAt(stored?.slots ?? {}, slot.path)) return;
|
|
210
|
+
contentEmpty.add(key);
|
|
211
|
+
emptyContent.push({
|
|
212
|
+
subject: subject.id,
|
|
213
|
+
pageId,
|
|
214
|
+
instanceId: instance.instanceId,
|
|
215
|
+
slot: slot.path
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
for (const page of subject.graph.pages) for (const instance of page.instances) {
|
|
219
|
+
const fixed = instance.required && instance.visibility === void 0 && !subject.optionalPages.has(page.id);
|
|
220
|
+
const cases = casesOf(subject, instance);
|
|
221
|
+
for (const name of ["visibility", "variant"]) {
|
|
222
|
+
const entry = instance[name];
|
|
223
|
+
if (entry === void 0) continue;
|
|
224
|
+
entry.reads.forEach(visitRead);
|
|
225
|
+
if (entry.requires.length === 0) continue;
|
|
226
|
+
if (name === "variant" && fixed) requireAll(required, entry.requires);
|
|
227
|
+
else pendingPreconditions.push({
|
|
228
|
+
subject: subject.id,
|
|
229
|
+
instanceId: instance.instanceId,
|
|
230
|
+
slot: `display.${name}`,
|
|
231
|
+
requires: entry.requires
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
if (fixed) {
|
|
235
|
+
const perCase = cases.map((variant) => {
|
|
236
|
+
const groups = /* @__PURE__ */ new Map();
|
|
237
|
+
for (const slot of instance.slots) if (chainsIn(instance, slot, variant)) sourceOf(page.id, instance, slot, /* @__PURE__ */ new Set(), requireFacts(groups));
|
|
238
|
+
return groups;
|
|
239
|
+
});
|
|
240
|
+
for (const [key, group] of intersect(perCase)) required.set(key, group);
|
|
241
|
+
}
|
|
242
|
+
for (const slot of instance.slots) {
|
|
243
|
+
slot.reads.forEach(visitRead);
|
|
244
|
+
if (!(fixed && cases.every((variant) => chainsIn(instance, slot, variant))) && (slot.kind === "compute" || slot.kind === "fill") && slot.requires.length > 0) pendingPreconditions.push({
|
|
245
|
+
subject: subject.id,
|
|
246
|
+
instanceId: instance.instanceId,
|
|
247
|
+
slot: slot.path,
|
|
248
|
+
requires: slot.requires
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
if (subject.content !== void 0) {
|
|
252
|
+
const { shown, variant } = storedGates(subject.content, page.id, instance);
|
|
253
|
+
const mark = markContent(subject.content);
|
|
254
|
+
if (shown) {
|
|
255
|
+
for (const slot of instance.slots) if (chainsIn(instance, slot, variant)) sourceOf(page.id, instance, slot, /* @__PURE__ */ new Set(), mark);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const isAnswered = (path) => answered(catalog, input.facts, path);
|
|
261
|
+
for (const pending of pendingPreconditions) preconditions.push({
|
|
262
|
+
...pending,
|
|
263
|
+
unanswered: pending.requires.filter((path) => !isAnswered(path))
|
|
264
|
+
});
|
|
265
|
+
for (const group of required.values()) group.forEach(visitRead);
|
|
266
|
+
const unansweredGroups = [...required.values()].filter((group) => !group.some(isAnswered));
|
|
267
|
+
const unanswered = new Set(unansweredGroups.flat());
|
|
268
|
+
const requiredPaths = new Set([...required.values()].flat());
|
|
269
|
+
const pages = [];
|
|
270
|
+
for (const fact of catalog.facts) {
|
|
271
|
+
const mine = (path) => parse(catalog, path).fact === fact;
|
|
272
|
+
const order = (paths) => [...paths].filter(mine).sort((a, b) => rank(catalog, fact, a) - rank(catalog, fact, b));
|
|
273
|
+
const pageUsed = fact.fields.map((field) => field.path).filter((path) => used.has(path));
|
|
274
|
+
const pageRequired = order(requiredPaths);
|
|
275
|
+
if (pageUsed.length === 0 && pageRequired.length === 0) continue;
|
|
276
|
+
pages.push({
|
|
277
|
+
home: fact.home,
|
|
278
|
+
key: fact.key,
|
|
279
|
+
paged: fact.paged,
|
|
280
|
+
used: pageUsed,
|
|
281
|
+
required: pageRequired,
|
|
282
|
+
unanswered: pageRequired.filter((path) => unanswered.has(path)),
|
|
283
|
+
preconditions: preconditions.filter((precondition) => precondition.requires.some(mine))
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
pages,
|
|
288
|
+
emptyContent
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function rank(catalog, fact, path) {
|
|
292
|
+
if (path === fact.path) return -1;
|
|
293
|
+
const { member, part } = parse(catalog, path);
|
|
294
|
+
const field = member === void 0 ? `${fact.path}.${part ?? ""}` : `${fact.path}[].${member}`;
|
|
295
|
+
const index = fact.fields.findIndex((candidate) => candidate.path === field);
|
|
296
|
+
return (index < 0 ? fact.fields.length : index) * 2 + (path.includes("[0]") ? 1 : 0);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
//#endregion
|
|
300
|
+
export { contentEmptyAt, evaluateRequirements };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AddressMember, AddressValue } from "./address-value.js";
|
|
2
2
|
import { PoiRow } from "./poi-row.js";
|
|
3
3
|
import { ImageValue } from "./runtime-values.js";
|
|
4
|
+
import { ElementRef, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
5
|
+
import { ComputeBinding } from "./compute.js";
|
|
4
6
|
import { MemberValueTypeOf, RegistryTable, RegistryTableKey, TableFieldsOf } from "./registry-shape.js";
|
|
7
|
+
import { DocumentMediaValue } from "./registry-facts.js";
|
|
5
8
|
import { RegistryTableRow } from "./table-members.js";
|
|
6
|
-
import { ComputeBinding } from "./compute.js";
|
|
7
9
|
import { SlotValue } from "./slot-value.js";
|
|
8
|
-
import { ElementRef, RowRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
9
|
-
import { DocumentMediaValue } from "./registry-facts.js";
|
|
10
10
|
//#region ../../internal/template-contracts/dist/row-ref.d.ts
|
|
11
11
|
/** The table a registry table key names — `units` for `property.units`, `contacts` for `library.contacts`. */
|
|
12
12
|
type TableOfKey<K extends RegistryTableKey> = K extends `${string}.${infer T extends RegistryTable}` ? T : never;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RegistryTableKey } from "./registry-shape.js";
|
|
2
|
-
import { ComputeBinding } from "./compute.js";
|
|
3
|
-
import { MemberListItem, MemberListRow, OriginTableOf, TableRow } from "./row-ref.js";
|
|
4
1
|
import { ComputeRead, ElementRef, RowRef, SiblingSlot, SiblingSource, SlotRef } from "./slot-ref.js";
|
|
5
2
|
import { PickFill } from "./fill-builders.js";
|
|
6
3
|
import { FillMark } from "./fill-declaration.js";
|
|
4
|
+
import { ComputeBinding } from "./compute.js";
|
|
5
|
+
import { RegistryTableKey } from "./registry-shape.js";
|
|
6
|
+
import { MemberListItem, MemberListRow, OriginTableOf, TableRow } from "./row-ref.js";
|
|
7
7
|
//#region ../../internal/template-contracts/dist/row.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* A fact table, as a row's `from` — `fact.property.contacts`. It names the table by its
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MediaKind } from "./slot-catalog.js";
|
|
1
2
|
import { AddressMember, AddressSource, AddressValue } from "./address-value.js";
|
|
2
3
|
import { ResponsiveImage } from "./responsive-image.js";
|
|
3
4
|
import { DocumentValue } from "./document-value.js";
|
|
4
|
-
import { MediaKind } from "./slot-catalog.js";
|
|
5
5
|
import { TourValue } from "./tour-value.js";
|
|
6
6
|
import { VideoValue } from "./video-value.js";
|
|
7
7
|
import { PoiPhoto, PoiRow } from "./poi-row.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import { LinkKind, LinkProviderId, MediaKind } from "./slot-catalog.js";
|
|
1
2
|
import { AddressValue } from "./address-value.js";
|
|
2
3
|
import { DocumentValue } from "./document-value.js";
|
|
3
|
-
import { LinkKind, LinkProviderId, MediaKind } from "./slot-catalog.js";
|
|
4
4
|
import { TourValue } from "./tour-value.js";
|
|
5
5
|
import { VideoValue } from "./video-value.js";
|
|
6
6
|
import { ImageValue, MediaValue, PlaybackConfig } from "./runtime-values.js";
|
|
7
|
-
import { ComputeBinding, RequiringCompute } from "./compute.js";
|
|
8
|
-
import { AddressMembers } from "./row-ref.js";
|
|
9
|
-
import { SlotValue } from "./slot-value.js";
|
|
10
7
|
import { ComputeRead, ElementRef, FactRef, RefValue, RowRef, SerializedSectionRef, SiblingSlot, SlotRef } from "./slot-ref.js";
|
|
11
8
|
import { FillBinding, FindFill, PickFill, WriteFill } from "./fill-builders.js";
|
|
12
9
|
import { FillMark } from "./fill-declaration.js";
|
|
10
|
+
import { ComputeBinding, RequiringCompute } from "./compute.js";
|
|
13
11
|
import { IconName } from "./icon-names.js";
|
|
14
12
|
import { HolderProcessOf } from "./process-builders.js";
|
|
15
13
|
import { FactHome } from "./fact-registry.js";
|
|
16
14
|
import { DocumentMedia, DocumentMediaValue, ImageMedia, TourMedia, VideoMedia } from "./registry-facts.js";
|
|
15
|
+
import { AddressMembers } from "./row-ref.js";
|
|
16
|
+
import { SlotValue } from "./slot-value.js";
|
|
17
17
|
//#region ../../internal/template-contracts/dist/slot-builders.d.ts
|
|
18
18
|
/** A registry key as a ref spells it — home first (`property.address.city`). */
|
|
19
19
|
type RegistryKeySpelling = `${FactHome}.${string}`;
|
|
@@ -118,6 +118,8 @@ declare const PROCESS_CATALOG: {
|
|
|
118
118
|
type ProcessVerb = keyof typeof PROCESS_CATALOG;
|
|
119
119
|
/** A verb declared on a media holder's `process` — a holder-site entry's. */
|
|
120
120
|
type HolderProcessVerb = { [V in ProcessVerb]: (typeof PROCESS_CATALOG)[V]["site"] extends "holder" ? V : never; }[ProcessVerb];
|
|
121
|
+
/** A verb declared on a kind's row — a kind-site entry's. */
|
|
122
|
+
type KindProcessVerb = { [V in ProcessVerb]: (typeof PROCESS_CATALOG)[V]["site"] extends "kind" ? V : never; }[ProcessVerb];
|
|
121
123
|
/** The holder-site verbs that apply to EVERY kind of `Kinds` — what a declaration of those kinds may `process`. */
|
|
122
124
|
type ProcessOf<Kinds extends MediaKind> = { [V in HolderProcessVerb]: [Kinds] extends [(typeof PROCESS_CATALOG)[V]["kinds"][number]] ? V : never; }[HolderProcessVerb];
|
|
123
125
|
/**
|
|
@@ -241,4 +243,4 @@ declare const VIDEO_SOURCES: readonly ["upload", "link"];
|
|
|
241
243
|
/** A video's storage/origin kind — one of `VIDEO_SOURCES`. */
|
|
242
244
|
type VideoSource = (typeof VIDEO_SOURCES)[number];
|
|
243
245
|
//#endregion
|
|
244
|
-
export { HolderProcessVerb, LINK_KINDS, LINK_PROVIDERS, LinkKind, LinkProviderId, MEDIA_KINDS, MediaKind, OBJECT_BINDING_OWN_KEYS, ObjectBindingOwnKey, PROCESS_CATALOG, ProcessOf, ProcessVerb, VIDEO_SOURCES, VideoSource };
|
|
246
|
+
export { HolderProcessVerb, KindProcessVerb, LINK_KINDS, LINK_PROVIDERS, LinkKind, LinkProviderId, MEDIA_KINDS, MediaKind, OBJECT_BINDING_OWN_KEYS, ObjectBindingOwnKey, PROCESS_CATALOG, ProcessOf, ProcessVerb, VIDEO_SOURCES, VideoSource };
|