@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import "../../template-contracts/dist/table-members.js";
|
|
3
|
+
import "../../template-contracts/dist/row-sources.js";
|
|
4
|
+
import "./derive-source.js";
|
|
5
|
+
import "./list-grammar.js";
|
|
6
|
+
import "./bake-property-ref.js";
|
|
7
|
+
import "./linked-merge.js";
|
|
8
|
+
import "./item-merge.js";
|
|
9
|
+
import "./held-rows.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { poolingPrimitiveOf } from "../../template-contracts/dist/row-planners.js";
|
|
2
1
|
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
2
|
+
import { poolingPrimitiveOf } from "../../template-contracts/dist/row-planners.js";
|
|
3
3
|
import "./row-planners.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../internal/fill-vocabulary/dist/holder.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
1
2
|
import { isValueKind } from "../../template-contracts/dist/value-contracts.js";
|
|
2
3
|
import { plannerForField } from "../../template-contracts/dist/row-planners.js";
|
|
3
|
-
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
4
4
|
import "./row-planners.js";
|
|
5
5
|
import { bindsElement, holderLabel, holderOf, isFactBound } from "./holder.js";
|
|
6
6
|
import { pickIsUnique, readFillVerb, verbRunsOn, writesElements } from "./verbs.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
1
2
|
import { FINDABLE_KINDS, isFindableKind } from "../../template-contracts/dist/findable.js";
|
|
2
3
|
import { isValueKind } from "../../template-contracts/dist/value-contracts.js";
|
|
3
|
-
import { listItemFieldsOf } from "../../template-contracts/dist/row-sources.js";
|
|
4
4
|
import { bindsElement, holderOf, poolOfKind } from "./holder.js";
|
|
5
5
|
|
|
6
6
|
//#region ../../internal/fill-vocabulary/dist/verbs.js
|
|
@@ -18,21 +18,13 @@ function captureViewport(format) {
|
|
|
18
18
|
deviceScaleFactor: geometry.deviceScaleFactor
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function printViewport(format) {
|
|
22
|
-
const geometry = resolveFormatGeometry(format);
|
|
23
|
-
return {
|
|
24
|
-
width: Math.round(geometry.sheetWidth),
|
|
25
|
-
height: Math.round(geometry.sheetHeight),
|
|
26
|
-
deviceScaleFactor: geometry.deviceScaleFactor
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
21
|
function printPageSize(format) {
|
|
30
22
|
const geometry = resolveFormatGeometry(format);
|
|
31
23
|
return {
|
|
32
|
-
width: `${geometry.
|
|
33
|
-
height: `${geometry.
|
|
24
|
+
width: `${geometry.pointWidth / 72}in`,
|
|
25
|
+
height: `${geometry.pointHeight / 72}in`
|
|
34
26
|
};
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
//#endregion
|
|
38
|
-
export { FRAME_ROOT_CLASS, captureViewport, frameTokens, printPageSize
|
|
30
|
+
export { FRAME_ROOT_CLASS, captureViewport, frameTokens, printPageSize };
|
|
@@ -25,13 +25,8 @@ type ImageFormat = FormatIdentity & {
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* A document format is either a pixel sheet (decks) or a physical print size
|
|
28
|
-
* with a capture `dpi
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `panels` is fold geometry: `width`/`height` is then ONE panel, and a printed
|
|
32
|
-
* sheet carries that many consecutive pages side by side (a tri-fold is a 6 × 9 in
|
|
33
|
-
* panel with `panels: 3`). The sheet is derived, never declared; absent means one
|
|
34
|
-
* page per sheet, which is every unfolded document.
|
|
28
|
+
* with a capture `dpi` and optional `bleed`. The union keeps a physical width
|
|
29
|
+
* from ever pairing with a pixel height.
|
|
35
30
|
*/
|
|
36
31
|
type DocumentFormat = FormatIdentity & ({
|
|
37
32
|
readonly width: number;
|
|
@@ -41,7 +36,6 @@ type DocumentFormat = FormatIdentity & ({
|
|
|
41
36
|
readonly height: PhysicalLength;
|
|
42
37
|
readonly dpi: number;
|
|
43
38
|
readonly bleed?: PhysicalLength;
|
|
44
|
-
readonly panels?: number;
|
|
45
39
|
});
|
|
46
40
|
//#endregion
|
|
47
41
|
export { DocumentFormat, FormatIdentity, ImageFormat, PhysicalLength };
|
|
@@ -21,12 +21,7 @@ function resolveFormatGeometry(format) {
|
|
|
21
21
|
pixelHeight: format.height,
|
|
22
22
|
pointWidth: format.width / CSS_PX_PER_INCH * 72,
|
|
23
23
|
pointHeight: format.height / CSS_PX_PER_INCH * 72,
|
|
24
|
-
bleedPoints: 0
|
|
25
|
-
panels: 1,
|
|
26
|
-
sheetWidth: format.width,
|
|
27
|
-
sheetHeight: format.height,
|
|
28
|
-
sheetPointWidth: format.width / CSS_PX_PER_INCH * 72,
|
|
29
|
-
sheetPointHeight: format.height / CSS_PX_PER_INCH * 72
|
|
24
|
+
bleedPoints: 0
|
|
30
25
|
};
|
|
31
26
|
const physical = format;
|
|
32
27
|
const widthIn = toInches(physical.width);
|
|
@@ -38,7 +33,6 @@ function resolveFormatGeometry(format) {
|
|
|
38
33
|
const viewportWidth = frameWidth + 2 * bleed;
|
|
39
34
|
const viewportHeight = frameHeight + 2 * bleed;
|
|
40
35
|
const deviceScaleFactor = physical.dpi / CSS_PX_PER_INCH;
|
|
41
|
-
const panels = physical.panels ?? 1;
|
|
42
36
|
return {
|
|
43
37
|
frameWidth,
|
|
44
38
|
frameHeight,
|
|
@@ -50,12 +44,7 @@ function resolveFormatGeometry(format) {
|
|
|
50
44
|
pixelHeight: Math.round(viewportHeight * deviceScaleFactor),
|
|
51
45
|
pointWidth: (widthIn + 2 * bleedIn) * 72,
|
|
52
46
|
pointHeight: (heightIn + 2 * bleedIn) * 72,
|
|
53
|
-
bleedPoints: bleedIn * 72
|
|
54
|
-
panels,
|
|
55
|
-
sheetWidth: panels * frameWidth + 2 * bleed,
|
|
56
|
-
sheetHeight: viewportHeight,
|
|
57
|
-
sheetPointWidth: (panels * widthIn + 2 * bleedIn) * 72,
|
|
58
|
-
sheetPointHeight: (heightIn + 2 * bleedIn) * 72
|
|
47
|
+
bleedPoints: bleedIn * 72
|
|
59
48
|
};
|
|
60
49
|
}
|
|
61
50
|
|
|
@@ -118,15 +118,6 @@ async function hydrateIslands(options) {
|
|
|
118
118
|
}
|
|
119
119
|
return handles;
|
|
120
120
|
}
|
|
121
|
-
function unmountIslands(root = document) {
|
|
122
|
-
const self = root instanceof Element && root.matches(`[${"data-tr-island"}]`) ? [root] : [];
|
|
123
|
-
for (const element of [...self, ...root.querySelectorAll(`[${ATTR_ISLAND_KEY}]`)]) {
|
|
124
|
-
const reactRoot = roots.get(element);
|
|
125
|
-
if (!reactRoot) continue;
|
|
126
|
-
roots.delete(element);
|
|
127
|
-
reactRoot.unmount();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
121
|
|
|
131
122
|
//#endregion
|
|
132
|
-
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, IslandPropsError, deserializeIslandProps, hydrateIslands, islandId, islandsCaptureReady, serializeIslandProps
|
|
123
|
+
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, IslandPropsError, deserializeIslandProps, hydrateIslands, islandId, islandsCaptureReady, serializeIslandProps };
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
* that paints everything during mount needs none of this — never calling the
|
|
12
12
|
* hook is the default contract.
|
|
13
13
|
*
|
|
14
|
+
* Start the engine at the state it is captured in: a map constructed with its
|
|
15
|
+
* fitted `bounds`, never at a placeholder camera it moves away from on load.
|
|
16
|
+
* An engine keeps what it fetched for its first state, and whether that arrived
|
|
17
|
+
* before the move changes the pixels from one shot to the next.
|
|
18
|
+
*
|
|
14
19
|
* Where nothing captures (an editor canvas, a published website) the hold is
|
|
15
20
|
* never read, so the hook costs nothing there.
|
|
16
21
|
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region ../../internal/lead-fields/dist/ingest.js
|
|
2
|
+
const LEAD_INGEST_MAX_BODY = 16 * 1024;
|
|
3
|
+
const LEAD_SIGNATURE_WINDOW_SECONDS = 300;
|
|
4
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
5
|
+
function isLeadIngestRefusal(value) {
|
|
6
|
+
return "error" in value;
|
|
7
|
+
}
|
|
8
|
+
function leadIngestHeaders(header) {
|
|
9
|
+
const siteId = header("x-site-id");
|
|
10
|
+
const timestamp = header("x-timestamp");
|
|
11
|
+
const signature = header("x-signature");
|
|
12
|
+
const idempotencyKey = header("idempotency-key");
|
|
13
|
+
if (!siteId || !UUID_RE.test(siteId)) return {
|
|
14
|
+
status: 401,
|
|
15
|
+
error: "unauthorized"
|
|
16
|
+
};
|
|
17
|
+
if (!timestamp || !signature) return {
|
|
18
|
+
status: 401,
|
|
19
|
+
error: "unauthorized"
|
|
20
|
+
};
|
|
21
|
+
if (!idempotencyKey || !UUID_RE.test(idempotencyKey)) return {
|
|
22
|
+
status: 400,
|
|
23
|
+
error: "idempotency_key_required"
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
siteId,
|
|
27
|
+
timestamp,
|
|
28
|
+
signature,
|
|
29
|
+
idempotencyKey
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function leadIngestSize(rawBody) {
|
|
33
|
+
return rawBody.length > 16384 ? {
|
|
34
|
+
status: 413,
|
|
35
|
+
error: "too_large"
|
|
36
|
+
} : null;
|
|
37
|
+
}
|
|
38
|
+
function leadTimestampFresh(timestamp, nowSeconds) {
|
|
39
|
+
const ts = Number(timestamp);
|
|
40
|
+
return Number.isFinite(ts) && Math.abs(nowSeconds - ts) <= 300;
|
|
41
|
+
}
|
|
42
|
+
function leadIngestBody(rawBody) {
|
|
43
|
+
let parsed;
|
|
44
|
+
try {
|
|
45
|
+
parsed = JSON.parse(rawBody);
|
|
46
|
+
} catch {
|
|
47
|
+
return {
|
|
48
|
+
status: 400,
|
|
49
|
+
error: "invalid_body"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const payload = parsed && typeof parsed === "object" ? parsed : {};
|
|
53
|
+
const fields = payload.fields;
|
|
54
|
+
if (!fields || typeof fields !== "object" || Array.isArray(fields)) return {
|
|
55
|
+
status: 400,
|
|
56
|
+
error: "invalid_body"
|
|
57
|
+
};
|
|
58
|
+
const emailRaw = fields.email;
|
|
59
|
+
const email = typeof emailRaw === "string" ? emailRaw.trim() : "";
|
|
60
|
+
if (!email) return {
|
|
61
|
+
status: 400,
|
|
62
|
+
error: "invalid_body"
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
fields,
|
|
66
|
+
email,
|
|
67
|
+
sourceUrl: typeof payload.source_url === "string" ? payload.source_url.slice(0, 2048) : null
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { LEAD_INGEST_MAX_BODY, isLeadIngestRefusal, leadIngestBody, leadIngestHeaders, leadIngestSize, leadTimestampFresh };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { videoEmbedUrl } from "../../template-contracts/dist/slot-catalog.js";
|
|
2
|
-
import { contentMediaIdOf, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
2
|
+
import { JOB_FAILED_ERROR, contentMediaIdOf, videoSourceOf } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { readLadder } from "./store.js";
|
|
4
4
|
|
|
5
5
|
//#region ../../internal/media-resolution/dist/video.js
|
|
@@ -15,6 +15,10 @@ async function attachPosterResponsive(out, previewKey, store) {
|
|
|
15
15
|
if (responsive) out.poster_responsive = responsive;
|
|
16
16
|
return out;
|
|
17
17
|
}
|
|
18
|
+
function encodeNeverLands(record) {
|
|
19
|
+
const failure = record.failed_outputs?.transcode;
|
|
20
|
+
return failure === void 0 ? record.state === "failed" : failure !== JOB_FAILED_ERROR;
|
|
21
|
+
}
|
|
18
22
|
async function resolveVideoSlot(value, records, store) {
|
|
19
23
|
if (value === null) return null;
|
|
20
24
|
if (typeof value !== "object") return DEFAULT;
|
|
@@ -60,7 +64,7 @@ async function resolveVideoSlot(value, records, store) {
|
|
|
60
64
|
media_id: videoId,
|
|
61
65
|
state: record.state
|
|
62
66
|
}, "resolve-video-slot: no encode; poster-only");
|
|
63
|
-
if (record
|
|
67
|
+
if (!encodeNeverLands(record)) store.notePending?.({
|
|
64
68
|
kind: "video",
|
|
65
69
|
id: videoId
|
|
66
70
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { DOCUMENT_FORMATS } from "../../upload-formats/dist/index.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../internal/page-render/dist/addresses.js
|
|
4
|
+
const docExtByCt = {};
|
|
5
|
+
const docCtByExt = {};
|
|
6
|
+
for (const format of DOCUMENT_FORMATS) {
|
|
7
|
+
const ext = format.extension.slice(1);
|
|
8
|
+
docCtByExt[ext] = format.mimeTypes[0];
|
|
9
|
+
for (const mime of format.mimeTypes) docExtByCt[mime] = ext;
|
|
10
|
+
}
|
|
11
|
+
const EXT_BY_CT = {
|
|
12
|
+
"image/avif": "avif",
|
|
13
|
+
"image/webp": "webp",
|
|
14
|
+
"image/jpeg": "jpg",
|
|
15
|
+
"image/png": "png",
|
|
16
|
+
"image/svg+xml": "svg",
|
|
17
|
+
"video/mp4": "mp4",
|
|
18
|
+
...docExtByCt
|
|
19
|
+
};
|
|
20
|
+
const CT_BY_EXT = {
|
|
21
|
+
avif: "image/avif",
|
|
22
|
+
webp: "image/webp",
|
|
23
|
+
jpg: "image/jpeg",
|
|
24
|
+
jpeg: "image/jpeg",
|
|
25
|
+
png: "image/png",
|
|
26
|
+
svg: "image/svg+xml",
|
|
27
|
+
mp4: "video/mp4",
|
|
28
|
+
...docCtByExt
|
|
29
|
+
};
|
|
30
|
+
const DIR_BY_FAMILY = {
|
|
31
|
+
image: "img",
|
|
32
|
+
video: "video"
|
|
33
|
+
};
|
|
34
|
+
function familyDirFor(contentType) {
|
|
35
|
+
if (docExtByCt[contentType]) return "doc";
|
|
36
|
+
return DIR_BY_FAMILY[contentType.split("/")[0]] ?? null;
|
|
37
|
+
}
|
|
38
|
+
function extOf(key) {
|
|
39
|
+
const basename = (key.split("/").pop() ?? "").split("?")[0] ?? "";
|
|
40
|
+
const dot = basename.lastIndexOf(".");
|
|
41
|
+
if (dot <= 0) return null;
|
|
42
|
+
const ext = basename.slice(dot + 1);
|
|
43
|
+
return /^[a-zA-Z0-9]+$/.test(ext) ? ext.toLowerCase() : null;
|
|
44
|
+
}
|
|
45
|
+
function contentTypeFor(key, hint) {
|
|
46
|
+
if (hint && EXT_BY_CT[hint]) return hint;
|
|
47
|
+
const ext = extOf(key);
|
|
48
|
+
return ext ? CT_BY_EXT[ext] ?? null : null;
|
|
49
|
+
}
|
|
50
|
+
function mediaPath(key, contentType, filename, hash) {
|
|
51
|
+
const dir = familyDirFor(contentType);
|
|
52
|
+
if (!dir) return null;
|
|
53
|
+
return `assets/${dir}/${hash(filename === null ? key : `${key}\n${filename}`).slice(0, 16)}.${EXT_BY_CT[contentType]}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { contentTypeFor, mediaPath };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { contentTypeFor, mediaPath } from "./addresses.js";
|
|
2
|
+
import { keptInProcess } from "./kept.js";
|
|
3
|
+
import { bareName, pageHref, resolvePageNav } from "./nav.js";
|
|
4
|
+
import { displayCase, pagePlan, renderPage, renderPageSection, renderSection, resolveSectionInputs, sectionFingerprint, snapshotNav, snapshotNavPages } from "./render.js";
|
|
5
|
+
|
|
6
|
+
export { bareName, contentTypeFor, keptInProcess, mediaPath, pagePlan, renderPage, renderPageSection };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../internal/page-render/dist/kept.js
|
|
2
|
+
const KEPT_PER_SECTION = 64;
|
|
3
|
+
function keptInProcess(hash, perSection = 64) {
|
|
4
|
+
const bySection = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const holder = (component) => typeof component === "object" && component !== null || typeof component === "function" ? component : null;
|
|
6
|
+
return {
|
|
7
|
+
hash,
|
|
8
|
+
kept(component, fingerprint) {
|
|
9
|
+
const held = holder(component);
|
|
10
|
+
const kept = held === null ? void 0 : bySection.get(held);
|
|
11
|
+
const section = kept?.get(fingerprint);
|
|
12
|
+
if (section === void 0) return void 0;
|
|
13
|
+
kept.delete(fingerprint);
|
|
14
|
+
kept.set(fingerprint, section);
|
|
15
|
+
return section;
|
|
16
|
+
},
|
|
17
|
+
keep(component, fingerprint, section) {
|
|
18
|
+
const held = holder(component);
|
|
19
|
+
if (held === null) return;
|
|
20
|
+
let kept = bySection.get(held);
|
|
21
|
+
if (kept === void 0) bySection.set(held, kept = /* @__PURE__ */ new Map());
|
|
22
|
+
kept.delete(fingerprint);
|
|
23
|
+
kept.set(fingerprint, section);
|
|
24
|
+
if (kept.size > perSection) kept.delete(kept.keys().next().value);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { keptInProcess };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region ../../internal/page-render/dist/nav.js
|
|
2
|
+
function bareName(sectionKey) {
|
|
3
|
+
return sectionKey.split("/").pop();
|
|
4
|
+
}
|
|
5
|
+
function pageHref(contentBase, path) {
|
|
6
|
+
const base = contentBase.replace(/\/+$/, "");
|
|
7
|
+
return path === "/" ? `${base}/` : `${base}${path}/`;
|
|
8
|
+
}
|
|
9
|
+
function resolvePageNav(input) {
|
|
10
|
+
const { pages, currentPageId, contentBase } = input;
|
|
11
|
+
const current = pages.find((p) => p.id === currentPageId);
|
|
12
|
+
if (current === void 0) throw new Error(`nav: page "${currentPageId}" is not one of the declared pages (${pages.map((p) => p.id).join(", ")}).`);
|
|
13
|
+
const pageOf = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const page of pages) {
|
|
15
|
+
if (page.id !== current.id && page.enabled === false) continue;
|
|
16
|
+
for (const section of page.sections) {
|
|
17
|
+
if (section.enabled === false) continue;
|
|
18
|
+
const name = bareName(section.key);
|
|
19
|
+
if (!pageOf.has(name) || page.id === current.id) pageOf.set(name, {
|
|
20
|
+
page,
|
|
21
|
+
anchor: section.anchor
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const anchors = {};
|
|
26
|
+
for (const [name, { page, anchor }] of pageOf) {
|
|
27
|
+
if (anchor === void 0 || anchor === "") continue;
|
|
28
|
+
anchors[name] = page.id === current.id ? `#${anchor}` : `${pageHref(contentBase, page.path)}#${anchor}`;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
anchors,
|
|
32
|
+
pages: pages.filter((p) => p.enabled !== false).map((p) => ({
|
|
33
|
+
id: p.id,
|
|
34
|
+
label: p.label,
|
|
35
|
+
href: pageHref(contentBase, p.path),
|
|
36
|
+
current: p.id === current.id
|
|
37
|
+
}))
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { bareName, pageHref, resolvePageNav };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { resolvePageNav } from "./nav.js";
|
|
2
|
+
import { defaultDisplayCase } from "../../deliverable-reads/dist/display.js";
|
|
3
|
+
import { defaultForSlotType } from "../../template-contracts/dist/primitive-descriptors.js";
|
|
4
|
+
import "../../deliverable-reads/dist/index.js";
|
|
5
|
+
import { resolveSlotValue } from "../../media-resolution/dist/slot.js";
|
|
6
|
+
import "../../media-resolution/dist/index.js";
|
|
7
|
+
import { fillSectionAssetRefs } from "../../static-assets-binding/dist/section-asset-url.js";
|
|
8
|
+
|
|
9
|
+
//#region ../../internal/page-render/dist/render.js
|
|
10
|
+
function displayCase(stored, schema) {
|
|
11
|
+
return stored ?? defaultDisplayCase(schema.display);
|
|
12
|
+
}
|
|
13
|
+
function sectionFingerprint(hash, inputs, identifierPrefix, buildBase) {
|
|
14
|
+
return hash(JSON.stringify([
|
|
15
|
+
identifierPrefix,
|
|
16
|
+
buildBase ?? null,
|
|
17
|
+
inputs
|
|
18
|
+
]));
|
|
19
|
+
}
|
|
20
|
+
async function resolveSectionInputs(input) {
|
|
21
|
+
const { schema } = input;
|
|
22
|
+
const slots = {};
|
|
23
|
+
for (const [id, def] of Object.entries(schema.slots ?? {})) slots[id] = defaultForSlotType(def.type);
|
|
24
|
+
for (const [id, value] of Object.entries(input.values)) {
|
|
25
|
+
if (value === void 0) continue;
|
|
26
|
+
slots[id] = await resolveSlotValue(value, schema.slots?.[id], input.media);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
slots,
|
|
30
|
+
variant: displayCase(input.variant, schema),
|
|
31
|
+
nav: {
|
|
32
|
+
selfAnchor: input.nav.selfAnchor ?? schema.anchor,
|
|
33
|
+
anchors: input.nav.anchors,
|
|
34
|
+
pages: input.nav.pages
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function renderSection(input) {
|
|
39
|
+
const inputs = input.inputs ?? await resolveSectionInputs(input);
|
|
40
|
+
const { kept } = input;
|
|
41
|
+
const fingerprint = kept === void 0 ? null : sectionFingerprint(kept.hash, inputs, input.identifierPrefix, input.buildBase);
|
|
42
|
+
const answered = fingerprint === null ? void 0 : kept.kept(input.component, fingerprint);
|
|
43
|
+
if (answered !== void 0) return {
|
|
44
|
+
...answered,
|
|
45
|
+
inputs
|
|
46
|
+
};
|
|
47
|
+
const filled = fillSectionAssetRefs(input.react.renderToString(input.react.createElement(input.component, { ...inputs }), { identifierPrefix: input.identifierPrefix }), input.buildBase === void 0 ? { kind: "canonical" } : {
|
|
48
|
+
kind: "underBuildBase",
|
|
49
|
+
buildBase: input.buildBase
|
|
50
|
+
});
|
|
51
|
+
const made = {
|
|
52
|
+
html: filled.text,
|
|
53
|
+
buildFiles: filled.files
|
|
54
|
+
};
|
|
55
|
+
if (fingerprint !== null) kept.keep(input.component, fingerprint, made);
|
|
56
|
+
return {
|
|
57
|
+
...made,
|
|
58
|
+
inputs
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function pagePlan(snapshot, pageId) {
|
|
62
|
+
const page = pageOf(snapshot, pageId);
|
|
63
|
+
const held = new Map(snapshot.instances.map((instance) => [instance.instanceId, instance]));
|
|
64
|
+
return page.sections.flatMap((placed) => {
|
|
65
|
+
const instance = held.get(placed.instanceId);
|
|
66
|
+
return instance?.enabled === true ? [instance] : [];
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function pageOf(snapshot, pageId) {
|
|
70
|
+
const page = snapshot.pages.find((p) => p.id === pageId);
|
|
71
|
+
if (page === void 0) throw new Error(`The composition declares no page "${pageId}" (have: ${snapshot.pages.map((p) => p.id).join(", ")}).`);
|
|
72
|
+
return page;
|
|
73
|
+
}
|
|
74
|
+
async function snapshotNavPages(snapshot) {
|
|
75
|
+
const enabled = new Map(snapshot.instances.map((instance) => [instance.instanceId, instance.enabled]));
|
|
76
|
+
const pages = [];
|
|
77
|
+
for (const page of snapshot.pages) {
|
|
78
|
+
const sections = [];
|
|
79
|
+
for (const placed of page.sections) {
|
|
80
|
+
const { schema } = await snapshot.section(placed.section);
|
|
81
|
+
sections.push({
|
|
82
|
+
key: placed.section,
|
|
83
|
+
anchor: schema.anchor,
|
|
84
|
+
enabled: enabled.get(placed.instanceId) === true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
pages.push({
|
|
88
|
+
id: page.id,
|
|
89
|
+
label: page.label,
|
|
90
|
+
path: page.path ?? `/${page.id}`,
|
|
91
|
+
enabled: snapshot.pageEnabled(page.id),
|
|
92
|
+
sections
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return pages;
|
|
96
|
+
}
|
|
97
|
+
async function snapshotNav(snapshot, pageId, contentBase) {
|
|
98
|
+
if (snapshot.output !== "website") return {
|
|
99
|
+
anchors: {},
|
|
100
|
+
pages: []
|
|
101
|
+
};
|
|
102
|
+
return resolvePageNav({
|
|
103
|
+
pages: await snapshotNavPages(snapshot),
|
|
104
|
+
currentPageId: pageId,
|
|
105
|
+
contentBase
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
async function renderInstance(request, instance, sectionKey, nav) {
|
|
109
|
+
const { react, snapshot, over } = request;
|
|
110
|
+
const laid = over?.[instance.instanceId];
|
|
111
|
+
const section = await snapshot.section(sectionKey);
|
|
112
|
+
const rendered = await renderSection({
|
|
113
|
+
react,
|
|
114
|
+
component: section.component,
|
|
115
|
+
schema: section.schema,
|
|
116
|
+
values: {
|
|
117
|
+
...instance.values,
|
|
118
|
+
...laid?.values
|
|
119
|
+
},
|
|
120
|
+
variant: laid?.variant ?? instance.variant,
|
|
121
|
+
nav,
|
|
122
|
+
media: snapshot.media(),
|
|
123
|
+
identifierPrefix: instance.instanceId,
|
|
124
|
+
buildBase: request.buildBase,
|
|
125
|
+
kept: request.kept
|
|
126
|
+
});
|
|
127
|
+
return {
|
|
128
|
+
instanceId: instance.instanceId,
|
|
129
|
+
...rendered
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async function renderPage(request) {
|
|
133
|
+
const page = pageOf(request.snapshot, request.pageId);
|
|
134
|
+
const nav = await snapshotNav(request.snapshot, page.id, request.contentBase);
|
|
135
|
+
const keyOf = new Map(page.sections.map((placed) => [placed.instanceId, placed.section]));
|
|
136
|
+
const out = [];
|
|
137
|
+
for (const instance of pagePlan(request.snapshot, page.id)) out.push(await renderInstance(request, instance, keyOf.get(instance.instanceId), nav));
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
async function renderPageSection(request, instanceId) {
|
|
141
|
+
const page = pageOf(request.snapshot, request.pageId);
|
|
142
|
+
const placed = [page, ...request.snapshot.pages].flatMap((p) => p.sections).find((p) => p.instanceId === instanceId);
|
|
143
|
+
if (placed === void 0) throw new Error(`The composition places no instance "${instanceId}".`);
|
|
144
|
+
return renderInstance(request, request.snapshot.instances.find((i) => i.instanceId === instanceId) ?? {
|
|
145
|
+
instanceId,
|
|
146
|
+
values: {},
|
|
147
|
+
enabled: false
|
|
148
|
+
}, placed.section, await snapshotNav(request.snapshot, page.id, request.contentBase));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { displayCase, pagePlan, renderPage, renderPageSection, renderSection, resolveSectionInputs, sectionFingerprint, snapshotNav, snapshotNavPages };
|