@homepages/concrete 8.0.0 → 9.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 +988 -0
- package/README.md +20 -9
- package/codemods/list-grammar.mjs +923 -0
- package/codemods/manifest.json +60 -0
- package/codemods/process-builders.mjs +198 -0
- package/codemods/slot-object.mjs +1097 -0
- package/codemods/steps/content-object-fields.mjs +324 -0
- package/codemods/steps/list-object-form.mjs +6 -7
- package/codemods/table-rows.mjs +568 -0
- package/codemods/unwrap-object-fields.mjs +310 -0
- package/codemods/viewer-slot-document.mjs +131 -0
- package/codemods/write-property-as-facts-document.mjs +716 -0
- package/codemods/write-the-address-line.mjs +255 -0
- package/codemods/write-the-registry-members.mjs +653 -0
- package/codemods/write-the-select-from.mjs +141 -0
- package/codemods/write-the-sole-from.mjs +369 -0
- package/codemods/write-the-table-from.mjs +267 -0
- package/codemods/write-the-whole-item.mjs +512 -0
- package/codemods/writeback-drop.mjs +168 -0
- package/codemods/written-contact-address.mjs +162 -0
- package/codemods/written-media-category.mjs +227 -0
- package/codemods/written-ref-kinds-name-the-layer.mjs +172 -0
- package/codemods/written-uploads-replace-pool-reads.mjs +454 -0
- package/codemods/written-uploads-sort-into-lists.mjs +405 -0
- package/codemods/written-uploads-stated-in-sorted-lists.mjs +295 -0
- package/codemods/written-video-sources-drop.mjs +144 -0
- package/codemods/written-without-pick-none.mjs +146 -0
- package/codemods/written-without-retired-knowledge.mjs +223 -0
- package/codemods/written-without-the-media-key.mjs +202 -0
- package/codemods/written-without-the-property-type.mjs +249 -0
- package/dist/artifact/playground/client/assets/index-BUmdDDX5.js +1259 -0
- package/dist/artifact/playground/client/assets/index-DDOcM0zA.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 +61 -27
- package/dist/base.css +58 -1
- package/dist/cli/build/artifact.js +6 -9
- package/dist/cli/build/captures.js +2 -12
- package/dist/cli/build/esbuild.js +1 -25
- package/dist/cli/build/fixtures.js +2 -1
- package/dist/cli/build/icons.js +1 -1
- package/dist/cli/build/static.js +2 -2
- package/dist/cli/capture/capture.js +8 -9
- package/dist/cli/check/analyze.js +8 -1
- package/dist/cli/check/load-outdir.js +47 -0
- package/dist/cli/check/load-workspace.js +4 -4
- package/dist/cli/check/render/html.js +1 -2
- package/dist/cli/check/render/inputs.js +10 -3
- package/dist/cli/check/render/island-frames.js +2 -1
- package/dist/cli/check/render/marker-coverage.js +23 -15
- package/dist/cli/check/report.js +5 -0
- package/dist/cli/check/stages/bundles.js +1 -1
- package/dist/cli/check/stages/relations.js +1 -1
- package/dist/cli/check/stages/render.js +48 -33
- package/dist/cli/check/stages/sections.js +83 -31
- package/dist/cli/commands.js +1 -1
- package/dist/cli/dev/crop.js +1 -1
- package/dist/cli/dev/fixture-ladders.js +96 -0
- package/dist/cli/dev/islands.js +12 -123
- package/dist/cli/dev/listen.js +20 -1
- package/dist/cli/dev/load-template.js +1 -1
- package/dist/cli/dev/server.js +35 -10
- package/dist/cli/dev/vite.js +9 -7
- package/dist/cli/dev/workspace-reader.js +16 -16
- package/dist/cli/media/derive.js +43 -57
- package/dist/cli/media/frame-rung-floor.js +0 -1
- package/dist/cli/property/index.js +1 -6
- package/dist/css/inline.js +1 -22
- package/dist/eslint/rules/no-marker-literal.js +1 -1
- package/dist/fixtures/load.js +16 -7
- package/dist/fixtures/media-plugin.js +17 -12
- package/dist/fixtures/media-store.js +115 -0
- package/dist/fixtures/property.js +345 -126
- package/dist/fixtures/resolve.js +263 -251
- package/dist/fixtures/rows.js +4 -11
- package/dist/fixtures.d.ts +234 -109
- package/dist/index.d.ts +25 -16
- package/dist/index.js +10 -6
- package/dist/islands/marker.js +2 -1
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/canvas-core/dist/island-host.js +62 -0
- package/dist/packages/internal/canvas-core/dist/island-shields.js +30 -0
- package/dist/packages/internal/capture-settle/dist/index.js +3 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.d.ts +13 -0
- package/dist/packages/internal/capture-settle/dist/island-markers.js +6 -0
- package/dist/packages/internal/capture-settle/dist/settle.js +150 -0
- package/dist/packages/internal/{image-ladder/dist/crop.js → crop-region/dist/index.js} +21 -20
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +251 -33
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +365 -4
- package/dist/packages/internal/fill-bake/dist/derive-source.js +35 -21
- package/dist/packages/internal/fill-bake/dist/index.js +8 -3
- package/dist/packages/internal/fill-bake/dist/item-merge.js +119 -0
- package/dist/packages/internal/fill-bake/dist/item-overrides.js +28 -0
- package/dist/packages/internal/fill-bake/dist/linked-merge.js +40 -0
- package/dist/packages/internal/fill-bake/dist/list-grammar.js +175 -0
- package/dist/packages/internal/fill-vocabulary/dist/holder.js +51 -0
- package/dist/packages/internal/fill-vocabulary/dist/resolved-decision.js +390 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -23
- package/dist/packages/internal/fill-vocabulary/dist/row-reads.js +1 -1
- package/dist/packages/internal/fill-vocabulary/dist/verbs.js +75 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +11 -147
- package/dist/packages/internal/format-geometry/dist/format.d.ts +8 -2
- package/dist/packages/internal/format-geometry/dist/geometry.js +13 -2
- package/dist/packages/internal/image-ladder/dist/encode.js +27 -14
- package/dist/packages/internal/image-ladder/dist/index.js +3 -3
- package/dist/packages/internal/image-ladder/dist/policy.js +28 -53
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +1 -1
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +3 -12
- package/dist/packages/internal/island-runtime/dist/contract.js +2 -2
- package/dist/packages/internal/island-runtime/dist/index.d.ts +3 -7
- package/dist/packages/internal/island-runtime/dist/index.js +2 -1
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +1 -1
- package/dist/packages/internal/media-resolution/dist/crop-key.js +7 -0
- package/dist/packages/internal/media-resolution/dist/document.js +63 -0
- package/dist/packages/internal/media-resolution/dist/image.js +228 -0
- package/dist/packages/internal/media-resolution/dist/index.js +11 -0
- package/dist/packages/internal/media-resolution/dist/list.js +112 -0
- package/dist/packages/internal/media-resolution/dist/media.js +59 -0
- package/dist/packages/internal/media-resolution/dist/records.js +7 -0
- package/dist/packages/internal/media-resolution/dist/slot.js +34 -0
- package/dist/packages/internal/media-resolution/dist/store.js +19 -0
- package/dist/packages/internal/media-resolution/dist/tour.js +59 -0
- package/dist/packages/internal/media-resolution/dist/video.js +93 -0
- package/dist/packages/internal/property-facts/dist/registry-facts.js +244 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +8 -17
- package/dist/packages/internal/section-contracts/dist/catalog.js +34 -10
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/directly-linked-list-contract.js +27 -0
- package/dist/packages/internal/section-contracts/dist/fill-options.js +12 -0
- package/dist/packages/internal/section-contracts/dist/fill-verb-contract.js +95 -0
- package/dist/packages/internal/section-contracts/dist/grammar-scope.js +154 -0
- package/dist/packages/internal/section-contracts/dist/index.js +7 -1
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +15 -20
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +12 -7
- package/dist/packages/internal/section-contracts/dist/list-source-contract.js +46 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +11 -2
- package/dist/packages/internal/section-contracts/dist/object-contract.js +92 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +5 -5
- package/dist/packages/internal/section-contracts/dist/reads-acyclic-contract.js +63 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +7 -4
- package/dist/packages/internal/section-contracts/dist/row-rule-contract.js +83 -0
- package/dist/packages/internal/section-contracts/dist/row-source-contract.js +67 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +74 -10
- package/dist/packages/internal/section-contracts/dist/select-contract.js +0 -8
- package/dist/packages/internal/section-contracts/dist/source-contract.js +103 -46
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +47 -17
- package/dist/packages/internal/section-contracts/dist/table-member.js +16 -0
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +42 -21
- package/dist/packages/internal/source-resolution/dist/index.js +113 -72
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -0
- package/dist/packages/internal/street-address/dist/index.js +72 -0
- package/dist/packages/internal/template-artifact/dist/asset-mime.js +30 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +1 -2
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +12 -29
- package/dist/packages/internal/template-contracts/dist/address-value.d.ts +52 -0
- package/dist/packages/internal/template-contracts/dist/address-value.js +90 -0
- package/dist/packages/internal/template-contracts/dist/comparable-address.js +19 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.d.ts +29 -6
- package/dist/{schema → packages/internal/template-contracts/dist}/compute.js +11 -13
- package/dist/packages/internal/template-contracts/dist/content-pick.js +51 -0
- package/dist/packages/internal/template-contracts/dist/decision-fills.js +85 -0
- package/dist/packages/internal/template-contracts/dist/display-overrides.js +7 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +16 -5
- package/dist/packages/internal/template-contracts/dist/fact-compute.d.ts +24 -0
- package/dist/packages/internal/template-contracts/dist/fact-compute.js +30 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.d.ts +44 -0
- package/dist/packages/internal/template-contracts/dist/fact-keys.js +88 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.d.ts +290 -0
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +598 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +10 -24
- package/dist/packages/internal/template-contracts/dist/fill-builders.d.ts +157 -0
- package/dist/packages/internal/template-contracts/dist/fill-builders.js +79 -0
- package/dist/packages/internal/template-contracts/dist/fill-declaration.d.ts +14 -0
- package/dist/{schema → packages/internal/template-contracts/dist}/fill-declaration.js +6 -5
- package/dist/packages/internal/template-contracts/dist/fill-spec-schema.js +158 -0
- package/dist/packages/internal/template-contracts/dist/fill-spec.js +291 -0
- package/dist/packages/internal/template-contracts/dist/findable.js +8 -0
- package/dist/packages/internal/template-contracts/dist/floor-presets.js +13 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.d.ts +5 -0
- package/dist/packages/internal/template-contracts/dist/icon-names.js +70 -0
- package/dist/packages/internal/template-contracts/dist/legacy-facts.js +167 -0
- package/dist/packages/internal/template-contracts/dist/list-editing.js +94 -0
- package/dist/packages/internal/template-contracts/dist/list.d.ts +215 -0
- package/dist/packages/internal/template-contracts/dist/list.js +258 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +2 -2
- package/dist/packages/internal/template-contracts/dist/media-candidates.js +38 -0
- package/dist/packages/internal/template-contracts/dist/mirror-kind.js +48 -0
- package/dist/packages/internal/template-contracts/dist/number-display.js +10 -0
- package/dist/packages/internal/template-contracts/dist/object.d.ts +89 -0
- package/dist/packages/internal/template-contracts/dist/object.js +131 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.d.ts +1 -0
- package/dist/packages/internal/template-contracts/dist/primitive-descriptors.js +162 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.d.ts +77 -0
- package/dist/packages/internal/template-contracts/dist/process-builders.js +73 -0
- package/dist/packages/internal/template-contracts/dist/read-graph.js +250 -0
- package/dist/packages/internal/template-contracts/dist/ref-locate.js +192 -0
- package/dist/packages/internal/template-contracts/dist/registry-aliases.js +77 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.d.ts +268 -0
- package/dist/packages/internal/template-contracts/dist/registry-facts.js +202 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.d.ts +41 -0
- package/dist/packages/internal/template-contracts/dist/registry-shape.js +135 -0
- package/dist/packages/internal/template-contracts/dist/resolve-scope.js +103 -0
- package/dist/packages/internal/{image-descriptor/dist/index.d.ts → template-contracts/dist/responsive-image.d.ts} +1 -1
- package/dist/packages/internal/template-contracts/dist/row-planners.js +29 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.d.ts +133 -0
- package/dist/packages/internal/template-contracts/dist/row-ref.js +101 -0
- package/dist/packages/internal/template-contracts/dist/row-sources.js +49 -3
- package/dist/packages/internal/template-contracts/dist/row.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/row.js +84 -0
- package/dist/packages/internal/template-contracts/dist/runtime-values.d.ts +97 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.d.ts +782 -0
- package/dist/packages/internal/template-contracts/dist/slot-builders.js +233 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +243 -384
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +335 -227
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +21 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.d.ts +155 -0
- package/dist/packages/internal/template-contracts/dist/slot-ref.js +76 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.d.ts +163 -0
- package/dist/packages/internal/template-contracts/dist/slot-types.js +140 -0
- package/dist/packages/internal/template-contracts/dist/slot-value.d.ts +97 -0
- package/dist/packages/internal/template-contracts/dist/table-members.d.ts +25 -0
- package/dist/packages/internal/template-contracts/dist/table-members.js +90 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +5 -5
- package/dist/packages/internal/template-contracts/dist/value-contracts.js +15 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +2 -2
- package/dist/platform/fs.js +5 -2
- package/dist/playground/canvas-island-host.d.ts +11 -0
- package/dist/playground/canvas-island-host.js +29 -0
- package/dist/playground/canvas-markers.js +14 -0
- package/dist/playground-island-runtime.d.ts +3 -2
- package/dist/playground-island-runtime.js +3 -2
- package/dist/primitives/FrameShell.js +0 -1
- package/dist/primitives/Image.d.ts +5 -4
- package/dist/primitives/Tour.d.ts +1 -1
- package/dist/primitives/Video.d.ts +2 -2
- package/dist/primitives/index.d.ts +2 -3
- package/dist/primitives/picture-sources.js +2 -2
- package/dist/primitives/probe-context.js +2 -12
- package/dist/primitives/slot-address.d.ts +44 -0
- package/dist/primitives/slot-address.js +19 -0
- package/dist/primitives/slot-bindings.d.ts +65 -26
- package/dist/primitives/slot-bindings.js +104 -46
- package/dist/primitives/slot-document.d.ts +23 -18
- package/dist/primitives/slot-document.js +39 -14
- package/dist/primitives/slot-download.d.ts +39 -0
- package/dist/primitives/slot-download.js +39 -0
- package/dist/primitives/slot-list.d.ts +3 -3
- package/dist/primitives/slot-list.js +0 -2
- package/dist/primitives/slot-media.d.ts +24 -5
- package/dist/primitives/slot-media.js +6 -9
- package/dist/primitives/slot-object.d.ts +49 -0
- package/dist/primitives/slot-object.js +20 -0
- package/dist/primitives/slot-scalar.d.ts +27 -2
- package/dist/primitives/slot-scalar.js +50 -7
- package/dist/primitives/slot.d.ts +13 -6
- package/dist/primitives/slot.js +10 -3
- package/dist/rules/registry.js +19 -30
- package/dist/schema/define-schema.d.ts +4 -8
- package/dist/schema/define-schema.js +178 -79
- package/dist/schema/extract-fill-spec.js +2 -153
- package/dist/schema/fact.d.ts +57 -15
- package/dist/schema/fact.js +42 -7
- package/dist/schema/facts-view.d.ts +14 -0
- package/dist/schema/format.d.ts +1 -0
- package/dist/schema/format.js +2 -1
- package/dist/schema/manifest.js +24 -0
- package/dist/schema/property-facts.d.ts +8 -12
- package/dist/schema/section-props.d.ts +2 -66
- package/dist/schema/section-schema.d.ts +8 -11
- package/dist/schema/section-schema.js +27 -10
- package/dist/section/declare.d.ts +18 -7
- package/dist/section/declare.js +18 -5
- package/dist/section/materialize.js +3 -8
- package/dist/section/section.d.ts +12 -8
- package/dist/section/section.js +1 -1
- package/dist/template/logic-shim.d.ts +14 -7
- package/dist/template/logic-shim.js +14 -7
- package/dist/template/materialize.js +17 -18
- package/dist/template/mirror-types.js +30 -31
- package/dist/template/section-reads.js +85 -9
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +2 -2
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +28 -24
- package/package.json +9 -8
- package/dist/artifact/playground/client/assets/index-CckS2ONm.css +0 -1
- package/dist/artifact/playground/client/assets/index-Dn_xT16-.js +0 -1101
- package/dist/fixtures/canonical.d.ts +0 -166
- package/dist/fixtures/media.js +0 -163
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +0 -51
- package/dist/packages/internal/format-geometry/dist/index.js +0 -4
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +0 -10
- package/dist/packages/internal/property-facts/dist/index.js +0 -3
- package/dist/packages/internal/property-facts/dist/property-facts-Cy7-O4p0.js +0 -189
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +0 -24
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -22
- package/dist/packages/internal/template-contracts/dist/facts-view.js +0 -104
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -7
- package/dist/primitives/slot-group.d.ts +0 -40
- package/dist/primitives/slot-group.js +0 -36
- package/dist/schema/extract-used-facts.js +0 -34
- package/dist/schema/fill-builders.d.ts +0 -115
- package/dist/schema/fill-builders.js +0 -25
- package/dist/schema/fill-declaration.d.ts +0 -14
- package/dist/schema/fill-spec.js +0 -98
- package/dist/schema/layout.d.ts +0 -30
- package/dist/schema/layout.js +0 -14
- package/dist/schema/row-fields.js +0 -88
- package/dist/schema/row-ref.d.ts +0 -59
- package/dist/schema/row-ref.js +0 -28
- package/dist/schema/runtime-values.d.ts +0 -71
- package/dist/schema/section-nav.js +0 -14
- package/dist/schema/slot-builders.d.ts +0 -633
- package/dist/schema/slot-builders.js +0 -177
- package/dist/schema/slot-ref.d.ts +0 -79
- package/dist/schema/slot-ref.js +0 -41
- package/dist/schema/slot-types.d.ts +0 -111
- package/dist/schema/slot-types.js +0 -214
- package/dist/section/groups.js +0 -68
package/dist/schema/format.js
CHANGED
|
@@ -25,7 +25,8 @@ const DocumentFormatSchema = z.union([z.object({
|
|
|
25
25
|
width: physicalLength("positive"),
|
|
26
26
|
height: physicalLength("positive"),
|
|
27
27
|
dpi: z.number().min(72).max(600),
|
|
28
|
-
bleed: physicalLength("non-negative").optional()
|
|
28
|
+
bleed: physicalLength("non-negative").optional(),
|
|
29
|
+
panels: z.number().int().min(2).optional()
|
|
29
30
|
}).strict()]);
|
|
30
31
|
const WebsiteFormatSchema = z.object(identityFields).omit({ preset: true }).strict();
|
|
31
32
|
|
package/dist/schema/manifest.js
CHANGED
|
@@ -235,6 +235,30 @@ function refineRenderedRules(manifest, ctx) {
|
|
|
235
235
|
message: `Duplicate format id "${format.id}".`
|
|
236
236
|
});
|
|
237
237
|
seenFormatIds.add(format.id);
|
|
238
|
+
const panels = "panels" in format ? format.panels : void 0;
|
|
239
|
+
if (panels !== void 0) {
|
|
240
|
+
if (manifest.pages.length % panels !== 0) ctx.addIssue({
|
|
241
|
+
code: z.ZodIssueCode.custom,
|
|
242
|
+
path: [
|
|
243
|
+
"formats",
|
|
244
|
+
formatIdx,
|
|
245
|
+
"panels"
|
|
246
|
+
],
|
|
247
|
+
message: `Format "${format.id}" folds ${panels} panels to a sheet, so the template's page count must be a multiple of ${panels}; "${manifest.key}" declares ${manifest.pages.length}. Each page is one panel, listed in the order the sheets print.`
|
|
248
|
+
});
|
|
249
|
+
manifest.pages.forEach((page, pageIdx) => {
|
|
250
|
+
if (!page.optional) return;
|
|
251
|
+
ctx.addIssue({
|
|
252
|
+
code: z.ZodIssueCode.custom,
|
|
253
|
+
path: [
|
|
254
|
+
"pages",
|
|
255
|
+
pageIdx,
|
|
256
|
+
"optional"
|
|
257
|
+
],
|
|
258
|
+
message: `Page "${page.id}" is optional, but format "${format.id}" folds ${panels} panels to a sheet: every panel prints, so no page of a folded format may be optional.`
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
238
262
|
if (!presetGeometryMatches(format)) ctx.addIssue({
|
|
239
263
|
code: z.ZodIssueCode.custom,
|
|
240
264
|
path: [
|
|
@@ -14,12 +14,13 @@ type Narrative = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* One comparable property — a recently sold or currently listed home similar
|
|
17
|
-
* to the subject — as the
|
|
18
|
-
* `compute()` reading `fact.property.comparables`
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* to the subject — as the legacy `comparables` reading flattens it: its address as
|
|
18
|
+
* flat members and one display line. A `compute()` reading `fact.property.comparables`
|
|
19
|
+
* receives `FactsComparable` instead — the address one address value, the photo
|
|
20
|
+
* the comp's own media. Not a bound record list's row, which is its `id` plus the fields the
|
|
21
|
+
* list declares. `address`, `distance_m` and `price_period` are the three members the
|
|
22
|
+
* live projection derives (the display line, meters from the subject, and what the
|
|
23
|
+
* price is denominated in).
|
|
23
24
|
*/
|
|
24
25
|
type ComparableRow = {
|
|
25
26
|
id: string;
|
|
@@ -44,10 +45,7 @@ type ComparableRow = {
|
|
|
44
45
|
/**
|
|
45
46
|
* The comp's photo: the id of an upload the comparable itself owns — never one of the
|
|
46
47
|
* property's own photos, so no media pool offers it. `null` when none was uploaded. A
|
|
47
|
-
* `compute()` over `fact.property.comparables` reads it as `photo
|
|
48
|
-
* through an `image` value built from the id,
|
|
49
|
-
* `{ photo_id: comp.photo, url: "", alt: comp.address }`, and the render attaches
|
|
50
|
-
* the served URL and ladder by `photo_id`, as it does for any image.
|
|
48
|
+
* `compute()` over `fact.property.comparables` reads it as `photo`, the comp's own media.
|
|
51
49
|
*/
|
|
52
50
|
photo_upload_id: string | null;
|
|
53
51
|
/** The year the comparable was built. */
|
|
@@ -66,8 +64,6 @@ type ComparableRow = {
|
|
|
66
64
|
mls_number?: string | null;
|
|
67
65
|
/** The listing remarks, verbatim from the source. */
|
|
68
66
|
description?: string | null;
|
|
69
|
-
/** The comparable's type in the platform's vocabulary; null when the source states none. */
|
|
70
|
-
property_type?: "single_family" | "condo_townhome" | "multi_family" | "investment" | null;
|
|
71
67
|
};
|
|
72
68
|
//#endregion
|
|
73
69
|
export { ComparableRow, Coordinates, Narrative };
|
|
@@ -1,71 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
3
|
-
import { TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
|
-
import { DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
5
|
-
import { PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
6
|
-
import { ImageValue } from "./runtime-values.js";
|
|
7
|
-
import { CollectionIdKey } from "./row-ref.js";
|
|
1
|
+
import { ItemIdentity, ObjectValue, SlotValue } from "../packages/internal/template-contracts/dist/slot-value.js";
|
|
8
2
|
import { SectionNav } from "./section-nav.js";
|
|
9
3
|
import { SectionSchemaShape } from "./section-schema.js";
|
|
10
4
|
//#region src/schema/section-props.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Maps one slot definition (as authored under a section schema's `slots`) to
|
|
13
|
-
* the runtime value shape a renderer receives at `props.slots[<key>]`, as
|
|
14
|
-
* normalized by the binding layer. String-valued kinds (`text`, `select`,
|
|
15
|
-
* `url`) are plain `string` — the canonical blank is `""`, never `null`; a
|
|
16
|
-
* `number`, `image`, `poi` or `document` slot's blank is `null`. A `list` slot is always an
|
|
17
|
-
* array, never `null` — an empty list is the absent state. A record list's row
|
|
18
|
-
* is its identity plus its declared fields and nothing else: a list bound to a
|
|
19
|
-
* collection carries that collection's identity key (a unit's `unit_id`, a
|
|
20
|
-
* contact's or comparable's `id`), every other record list the stamped `id`.
|
|
21
|
-
*/
|
|
22
|
-
type SlotValue<S> = S extends {
|
|
23
|
-
type: "text";
|
|
24
|
-
} ? string : S extends {
|
|
25
|
-
type: "number";
|
|
26
|
-
} ? number | null : S extends {
|
|
27
|
-
type: "select";
|
|
28
|
-
} ? string : S extends {
|
|
29
|
-
type: "image";
|
|
30
|
-
} ? ImageValue | null : S extends {
|
|
31
|
-
type: "video";
|
|
32
|
-
} ? VideoValue | null : S extends {
|
|
33
|
-
type: "tour";
|
|
34
|
-
} ? TourValue | null : S extends {
|
|
35
|
-
type: "list";
|
|
36
|
-
readonly __row?: infer R;
|
|
37
|
-
} ? (unknown extends R ? ListValue<S> : R[]) : S extends {
|
|
38
|
-
type: "poi";
|
|
39
|
-
} ? PoiRow | null : S extends {
|
|
40
|
-
type: "url";
|
|
41
|
-
} ? string : S extends {
|
|
42
|
-
type: "document";
|
|
43
|
-
} ? DocumentValue | null : never;
|
|
44
|
-
type ListValue<S> = S extends {
|
|
45
|
-
type: "list";
|
|
46
|
-
source: {
|
|
47
|
-
kind: "direct";
|
|
48
|
-
field: infer F extends CollectionField;
|
|
49
|
-
};
|
|
50
|
-
fields: infer I;
|
|
51
|
-
} ? BoundRowValue<F, I>[] : S extends {
|
|
52
|
-
type: "list";
|
|
53
|
-
fields: infer I;
|
|
54
|
-
} ? RowValue<I>[] : S extends {
|
|
55
|
-
type: "list";
|
|
56
|
-
element: infer E;
|
|
57
|
-
} ? NonNullable<SlotValue<E>>[] : unknown[];
|
|
58
|
-
/**
|
|
59
|
-
* One row of a record `list` slot, derived from the declared `fields` record:
|
|
60
|
-
* the editor-stamped `id` — which every persisted row carries though `fields`
|
|
61
|
-
* never declares it — plus each declared field typed by its own definition.
|
|
62
|
-
* The shape is closed (no index signature), so an undeclared field is a
|
|
63
|
-
* compile error.
|
|
64
|
-
*/
|
|
65
|
-
type RowValue<I> = {
|
|
66
|
-
id: string;
|
|
67
|
-
} & { [K in keyof I]: SlotValue<I[K]>; };
|
|
68
|
-
type BoundRowValue<C extends CollectionField, I> = { [K in CollectionIdKey<C>]: string; } & { [K in keyof I]: SlotValue<I[K]>; };
|
|
69
5
|
type VariantOf<S extends SectionSchemaShape> = S["meta"] extends {
|
|
70
6
|
display: {
|
|
71
7
|
variant: {
|
|
@@ -86,4 +22,4 @@ type SectionProps<S extends SectionSchemaShape> = {
|
|
|
86
22
|
variant: VariantOf<S>;
|
|
87
23
|
};
|
|
88
24
|
//#endregion
|
|
89
|
-
export {
|
|
25
|
+
export { type ItemIdentity, type ObjectValue, SectionProps, type SlotValue };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VideoCollectionValue, VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
3
|
-
import { TourCollectionValue, TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
1
|
+
import { AddressValue } from "../packages/internal/template-contracts/dist/address-value.js";
|
|
4
2
|
import { DocumentCollectionValue, DocumentValue } from "../packages/internal/template-contracts/dist/document-value.js";
|
|
3
|
+
import { TourCollectionValue, TourValue } from "../packages/internal/template-contracts/dist/tour-value.js";
|
|
4
|
+
import { VideoCollectionValue, VideoValue } from "../packages/internal/template-contracts/dist/video-value.js";
|
|
5
5
|
import { PoiPhoto, PoiRow } from "../packages/internal/template-contracts/dist/poi-row.js";
|
|
6
|
+
import { AuthorImage, ImageCollectionValue, ImageValue, MediaValue, PlaybackConfig } from "../packages/internal/template-contracts/dist/runtime-values.js";
|
|
7
|
+
import { ItemIdentity, ObjectValue, SlotValue } from "../packages/internal/template-contracts/dist/slot-value.js";
|
|
8
|
+
import { Slot } from "../packages/internal/template-contracts/dist/slot-types.js";
|
|
6
9
|
import { ComparableRow, Coordinates, Narrative } from "./property-facts.js";
|
|
7
|
-
import {
|
|
8
|
-
import { RowValue, SectionProps, SlotValue } from "./section-props.js";
|
|
10
|
+
import { SectionProps } from "./section-props.js";
|
|
9
11
|
import { z } from "zod";
|
|
10
12
|
//#region src/schema/section-schema.d.ts
|
|
11
13
|
/** One `meta.display` entry as consumers read it: declared `cases` (first =
|
|
@@ -36,11 +38,6 @@ declare const SectionSchema: z.ZodObject<{
|
|
|
36
38
|
meta: z.ZodObject<{
|
|
37
39
|
displayName: z.ZodString;
|
|
38
40
|
anchor: z.ZodOptional<z.ZodString>;
|
|
39
|
-
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
label: z.ZodString;
|
|
42
|
-
members: z.ZodArray<z.ZodString>;
|
|
43
|
-
}, z.core.$strict>>>;
|
|
44
41
|
display: z.ZodOptional<z.ZodType<DisplayShape, DisplayShape, z.core.$ZodTypeInternals<DisplayShape, DisplayShape>>>;
|
|
45
42
|
}, z.core.$strict>;
|
|
46
43
|
slots: z.ZodRecord<z.ZodString, z.ZodType<Slot, Slot, z.core.$ZodTypeInternals<Slot, Slot>>>;
|
|
@@ -49,4 +46,4 @@ declare const SectionSchema: z.ZodObject<{
|
|
|
49
46
|
/** The authored input shape of `SectionSchema` — what `as const satisfies SectionSchemaShape` checks a section's `schema.ts` against. */
|
|
50
47
|
type SectionSchemaShape = z.input<typeof SectionSchema>;
|
|
51
48
|
//#endregion
|
|
52
|
-
export { type AuthorImage, type ComparableRow, type Coordinates, DisplayEntryShape, DisplayShape, type DocumentCollectionValue, type DocumentValue, type ImageCollectionValue, type ImageValue, type Narrative, type
|
|
49
|
+
export { type AddressValue, type AuthorImage, type ComparableRow, type Coordinates, DisplayEntryShape, DisplayShape, type DocumentCollectionValue, type DocumentValue, type ImageCollectionValue, type ImageValue, type ItemIdentity, type MediaValue, type Narrative, type ObjectValue, type PlaybackConfig, type PoiPhoto, type PoiRow, SectionSchema, SectionSchemaShape, type Slot, type SlotValue, type TourCollectionValue, type TourValue, type VideoCollectionValue, type VideoValue };
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { CONTENT_SLOT_TYPES, REFERRAL_FIELDS, REF_SLOT_TYPES, SLOT_TYPES } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
-
import { SerializedReads, SlotDef
|
|
2
|
+
import { SerializedReads, SlotDef } from "../packages/internal/template-contracts/dist/slot-types.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/schema/section-schema.ts
|
|
6
|
-
const SlotGroupDef = z.object({
|
|
7
|
-
id: z.string(),
|
|
8
|
-
label: z.string(),
|
|
9
|
-
members: z.array(z.string()).min(1)
|
|
10
|
-
}).strict();
|
|
11
6
|
const DisplayEntryDef = z.object({
|
|
12
7
|
cases: z.array(z.string().min(1)).min(1),
|
|
13
8
|
locked: z.boolean().optional(),
|
|
14
9
|
source: z.object({
|
|
15
10
|
kind: z.literal("derived"),
|
|
16
11
|
transform: z.string().min(1),
|
|
17
|
-
reads: SerializedReads
|
|
12
|
+
reads: SerializedReads,
|
|
13
|
+
requires: SerializedReads
|
|
18
14
|
}).strict().optional(),
|
|
19
15
|
fill: z.object({ pick: z.string().min(1) }).strict().optional()
|
|
20
16
|
}).strict();
|
|
@@ -25,14 +21,35 @@ const DisplayDef = z.object({
|
|
|
25
21
|
const SectionMeta = z.object({
|
|
26
22
|
displayName: z.string().min(1),
|
|
27
23
|
anchor: z.string().min(1).optional(),
|
|
28
|
-
groups: z.array(SlotGroupDef).optional(),
|
|
29
24
|
display: DisplayDef.optional()
|
|
30
25
|
}).strict();
|
|
31
26
|
const SectionSchema = z.object({
|
|
32
27
|
meta: SectionMeta,
|
|
33
28
|
slots: z.record(z.string(), SlotDef),
|
|
34
29
|
slot_order: z.array(z.string()).optional()
|
|
35
|
-
}).strict()
|
|
30
|
+
}).strict().superRefine((schema, ctx) => {
|
|
31
|
+
for (const [key, slot] of Object.entries(schema.slots)) if (slot.type === "object") {
|
|
32
|
+
for (const [field, def] of Object.entries(slot.fields)) if (field !== "label" && def.label === void 0) ctx.addIssue({
|
|
33
|
+
code: "custom",
|
|
34
|
+
path: [
|
|
35
|
+
"slots",
|
|
36
|
+
key,
|
|
37
|
+
"fields",
|
|
38
|
+
field,
|
|
39
|
+
"label"
|
|
40
|
+
],
|
|
41
|
+
message: `object field "${key}.${field}" declares no label`
|
|
42
|
+
});
|
|
43
|
+
} else if (slot.label === void 0) ctx.addIssue({
|
|
44
|
+
code: "custom",
|
|
45
|
+
path: [
|
|
46
|
+
"slots",
|
|
47
|
+
key,
|
|
48
|
+
"label"
|
|
49
|
+
],
|
|
50
|
+
message: `slot "${key}" declares no label`
|
|
51
|
+
});
|
|
52
|
+
});
|
|
36
53
|
|
|
37
54
|
//#endregion
|
|
38
|
-
export { DisplayDef, SectionMeta, SectionSchema, SlotDef
|
|
55
|
+
export { DisplayDef, SectionMeta, SectionSchema, SlotDef };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { SlotValue } from "../packages/internal/template-contracts/dist/slot-value.js";
|
|
2
|
+
import { Slot } from "../packages/internal/template-contracts/dist/slot-types.js";
|
|
3
|
+
import { DISPLAY_REF_PREFIX, DisplayEntryName, SlotRef } from "../packages/internal/template-contracts/dist/slot-ref.js";
|
|
4
|
+
import "../schema/section-props.js";
|
|
4
5
|
import { DefinedSchema, DisplayInput } from "../schema/define-schema.js";
|
|
5
6
|
//#region src/section/declare.d.ts
|
|
6
7
|
/** The first argument of `section()`: identity plus the schema declaration. */
|
|
@@ -22,9 +23,19 @@ interface SectionOptions<Key extends string, Slots extends Record<string, Slot>,
|
|
|
22
23
|
readonly slots: Slots;
|
|
23
24
|
}
|
|
24
25
|
/** The schema a section's options materialize to — `defineSchema`'s own shape. */
|
|
25
|
-
type SectionSchemaOf<Slots extends Record<string, Slot>, Display extends DisplayInput> = DefinedSchema<Slots, Display
|
|
26
|
-
/** One `SlotRef` per
|
|
27
|
-
type
|
|
26
|
+
type SectionSchemaOf<Slots extends Record<string, Slot>, Display extends DisplayInput> = DefinedSchema<Slots, Display>;
|
|
27
|
+
/** One `SlotRef` per field of the object `Object`, at the field's dotted id (`agent.contact`). */
|
|
28
|
+
type FieldRefsOf<Key extends string, Object extends string, Fields> = { readonly [F in keyof Fields & string]: SlotRef<Key, `${Object}.${F}`, SlotValue<Fields[F]>>; };
|
|
29
|
+
/**
|
|
30
|
+
* One `SlotRef` per declared slot, keyed by slot id, each at that slot's value type.
|
|
31
|
+
* An object's ref also hands out its fields' (`Hero.slots.agent.fields.contact`).
|
|
32
|
+
*/
|
|
33
|
+
type SlotRefsOf<Key extends string, Slots extends Record<string, Slot>> = { readonly [K in keyof Slots & string]: SlotRef<Key, K, SlotValue<Slots[K]>> & (Slots[K] extends {
|
|
34
|
+
type: "object";
|
|
35
|
+
fields: infer Fields;
|
|
36
|
+
} ? {
|
|
37
|
+
readonly fields: FieldRefsOf<Key, K, Fields>;
|
|
38
|
+
} : unknown); };
|
|
28
39
|
/** A display entry's declared cases — its value type — or `string` for a loose entry. */
|
|
29
40
|
type CasesOf<Entry> = Entry extends {
|
|
30
41
|
cases: readonly (infer C)[];
|
|
@@ -45,4 +56,4 @@ interface SectionDeclaration<Key extends string, Slots extends Record<string, Sl
|
|
|
45
56
|
readonly display: DisplayRefsOf<Key, Display>;
|
|
46
57
|
}
|
|
47
58
|
//#endregion
|
|
48
|
-
export { DisplayRefsOf, SectionDeclaration, SectionOptions, SectionSchemaOf, type SlotRef, SlotRefsOf };
|
|
59
|
+
export { DisplayRefsOf, FieldRefsOf, SectionDeclaration, SectionOptions, SectionSchemaOf, type SlotRef, SlotRefsOf };
|
package/dist/section/declare.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import { DISPLAY_REF_PREFIX } from "../
|
|
1
|
+
import { DISPLAY_REF_PREFIX } from "../packages/internal/template-contracts/dist/slot-ref.js";
|
|
2
2
|
import { defineSchema } from "../schema/define-schema.js";
|
|
3
3
|
|
|
4
4
|
//#region src/section/declare.ts
|
|
5
|
+
function slotRefOf(section, slot, def) {
|
|
6
|
+
if (def.type !== "object") return {
|
|
7
|
+
section,
|
|
8
|
+
slot
|
|
9
|
+
};
|
|
10
|
+
const fields = {};
|
|
11
|
+
for (const field of Object.keys(def.fields)) fields[field] = {
|
|
12
|
+
section,
|
|
13
|
+
slot: `${slot}.${field}`
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
section,
|
|
17
|
+
slot,
|
|
18
|
+
fields: Object.freeze(fields)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
5
21
|
const DISPLAY_ENTRY_NAMES = ["visibility", "variant"];
|
|
6
22
|
function declareSection(options) {
|
|
7
23
|
const { key, label, required = false } = options;
|
|
@@ -12,10 +28,7 @@ function declareSection(options) {
|
|
|
12
28
|
slots: options.slots
|
|
13
29
|
});
|
|
14
30
|
const refs = {};
|
|
15
|
-
for (const slot of Object.
|
|
16
|
-
section: key,
|
|
17
|
-
slot
|
|
18
|
-
};
|
|
31
|
+
for (const [slot, def] of Object.entries(options.slots)) refs[slot] = slotRefOf(key, slot, def);
|
|
19
32
|
const displayRefs = {};
|
|
20
33
|
for (const entry of DISPLAY_ENTRY_NAMES) {
|
|
21
34
|
if (options.display?.[entry] === void 0) continue;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { COMPUTED, getComputed } from "../
|
|
2
|
-
import { deriveGroups } from "./groups.js";
|
|
1
|
+
import { COMPUTED, getComputed } from "../packages/internal/template-contracts/dist/compute.js";
|
|
3
2
|
|
|
4
3
|
//#region src/section/materialize.ts
|
|
5
|
-
function materializeSection(section
|
|
6
|
-
const groups = deriveGroups(section, states);
|
|
4
|
+
function materializeSection(section) {
|
|
7
5
|
const result = {
|
|
8
|
-
meta:
|
|
9
|
-
...section.schema.meta,
|
|
10
|
-
...groups.length > 0 ? { groups } : {}
|
|
11
|
-
},
|
|
6
|
+
meta: section.schema.meta,
|
|
12
7
|
slots: section.schema.slots,
|
|
13
8
|
slot_order: Object.keys(section.schema.slots)
|
|
14
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Slot } from "../
|
|
2
|
-
import { SlotRef } from "../
|
|
1
|
+
import { Slot } from "../packages/internal/template-contracts/dist/slot-types.js";
|
|
2
|
+
import { SlotRef } from "../packages/internal/template-contracts/dist/slot-ref.js";
|
|
3
3
|
import { SectionNav } from "../schema/section-nav.js";
|
|
4
4
|
import "../schema/section-schema.js";
|
|
5
5
|
import { SectionProps } from "../schema/section-props.js";
|
|
@@ -20,7 +20,7 @@ interface SectionRenderBindings<Slots extends Record<string, Slot>, Display exte
|
|
|
20
20
|
/**
|
|
21
21
|
* One binding per declared slot, keyed by slot id — what `bindSlots` returned to a Renderer.
|
|
22
22
|
* There is no raw `slots` beside it. A record list's bound row is its identity plus
|
|
23
|
-
* its declared fields: a
|
|
23
|
+
* its declared fields: a table member the section reads is declared as a row
|
|
24
24
|
* field bound to that member (`source: comp.status`).
|
|
25
25
|
*/
|
|
26
26
|
readonly slot: SlotBindingMap<SectionSchemaOf<Slots, Display>>;
|
|
@@ -55,15 +55,19 @@ interface SectionValue<Key extends string, Slots extends Record<string, Slot>, D
|
|
|
55
55
|
* key: "hero",
|
|
56
56
|
* label: "Hero",
|
|
57
57
|
* slots: {
|
|
58
|
-
* headline: text.medium({ cap: 60, label: "Headline", source: fill({ brief: "A confident one-line headline." }) }),
|
|
59
|
-
*
|
|
58
|
+
* headline: text.medium({ cap: 60, label: "Headline", source: fill.write({ brief: "A confident one-line headline." }) }),
|
|
59
|
+
* address: object({ label: fact.property.address, fields: {
|
|
60
|
+
* street: text.short({ source: fact.property.address_street, label: "Street" }),
|
|
61
|
+
* city: text.short({ source: fact.property.address_city, label: "City" }),
|
|
62
|
+
* } }),
|
|
60
63
|
* },
|
|
61
64
|
* }, ({ slot, nav }) => (
|
|
62
65
|
* <Section id={nav.selfAnchor}>
|
|
63
66
|
* <Slot.Text slot={slot.headline} as="h1" />
|
|
64
|
-
* <
|
|
65
|
-
* <Slot.Text slot={slot.street} as="span" />
|
|
66
|
-
*
|
|
67
|
+
* <Slot.Object slot={slot.address} as="address">
|
|
68
|
+
* <Slot.Text slot={slot.address.street} as="span" />
|
|
69
|
+
* <Slot.Text slot={slot.address.city} as="span" />
|
|
70
|
+
* </Slot.Object>
|
|
67
71
|
* </Section>
|
|
68
72
|
* ));
|
|
69
73
|
* ```
|
package/dist/section/section.js
CHANGED
|
@@ -22,7 +22,7 @@ function section(options, render) {
|
|
|
22
22
|
const { key, label, required, schema, slots, display } = declareSection(options);
|
|
23
23
|
const component = (props) => {
|
|
24
24
|
const probe = useContext(ProbeContext);
|
|
25
|
-
if (probe
|
|
25
|
+
if (probe !== null) {
|
|
26
26
|
const instance = "instance" in props && props.instance !== void 0 ? props.instance : `${key}-1`;
|
|
27
27
|
probe.place(key, instance, value);
|
|
28
28
|
return null;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ATTR_ISLAND_KEY, ISLAND_CAPTURE_HOLDS_GLOBAL } from "../packages/internal/capture-settle/dist/island-markers.js";
|
|
2
|
+
import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_PROPS, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, ISLAND_ELEMENT, IslandComponent, IslandEditor, IslandEditorOptions, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, deserializeIslandProps, islandId, serializeIslandProps } from "../packages/internal/island-runtime/dist/contract.js";
|
|
3
|
+
import { compute, getComputed } from "../packages/internal/template-contracts/dist/compute.js";
|
|
4
|
+
import { Slot as Slot$1 } from "../packages/internal/template-contracts/dist/slot-types.js";
|
|
5
|
+
import { fill } from "../packages/internal/template-contracts/dist/fill-builders.js";
|
|
6
|
+
import { holderProcess } from "../packages/internal/template-contracts/dist/process-builders.js";
|
|
7
|
+
import { address, date, document, email, image, media, number, phone, poi, select, text, tour, url, video } from "../packages/internal/template-contracts/dist/slot-builders.js";
|
|
8
|
+
import { object } from "../packages/internal/template-contracts/dist/object.js";
|
|
9
|
+
import { row } from "../packages/internal/template-contracts/dist/row.js";
|
|
10
|
+
import { list } from "../packages/internal/template-contracts/dist/list.js";
|
|
6
11
|
import { DisplayInput } from "../schema/define-schema.js";
|
|
7
12
|
import { SectionDeclaration, SectionOptions } from "../section/declare.js";
|
|
8
13
|
import { ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE } from "../packages/internal/template-contracts/dist/markers.js";
|
|
@@ -18,7 +23,6 @@ declare function defineTemplate<T>(input: T): T;
|
|
|
18
23
|
/** The text a surviving stub throws with — what the build greps the output for. */
|
|
19
24
|
declare const LOGIC_STUB_MARKER = "@homepages/concrete logic build: a render-time primitive reached the bundle";
|
|
20
25
|
declare const Section: () => never;
|
|
21
|
-
declare const SlotGroup: () => never;
|
|
22
26
|
declare const Image: () => never;
|
|
23
27
|
declare const Video: () => never;
|
|
24
28
|
declare const Tour: () => never;
|
|
@@ -33,11 +37,14 @@ declare const Slot: {
|
|
|
33
37
|
Number: () => never;
|
|
34
38
|
Select: () => never;
|
|
35
39
|
Url: () => never;
|
|
40
|
+
Address: () => never;
|
|
36
41
|
Image: () => never;
|
|
37
42
|
Video: () => never;
|
|
38
43
|
Tour: () => never;
|
|
39
44
|
Document: () => never;
|
|
45
|
+
Download: () => never;
|
|
40
46
|
List: () => never;
|
|
47
|
+
Object: () => never;
|
|
41
48
|
};
|
|
42
49
|
//#endregion
|
|
43
|
-
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, CONCRETE_VERSION, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, IslandComponent, IslandEditor, IslandEditorOptions, IslandMarker, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, LOGIC_STUB_MARKER, Section, Slot,
|
|
50
|
+
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, CONCRETE_VERSION, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, IslandComponent, IslandEditor, IslandEditorOptions, IslandMarker, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, LOGIC_STUB_MARKER, Section, Slot, Tour, Video, a4Landscape, a4Portrait, address, bindItems, compute, date, deck16x9, defineTemplate, deserializeIslandProps, document, email, facebookPost, fact, fill, getComputed, halfLetterFlyer, image, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, media, number, object, phone, poi, postcard6x4, postcard7x5, presets, holderProcess as process, row, section, select, serializeIslandProps, text, tour, url, useCaptureReady, useEditor, useIslandId, video, website, xPost };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ATTR_ISLAND_KEY, ISLAND_CAPTURE_HOLDS_GLOBAL } from "../packages/internal/capture-settle/dist/island-markers.js";
|
|
2
|
+
import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_PROPS, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, ISLAND_ELEMENT, IslandPropsError, deserializeIslandProps, islandId, serializeIslandProps } from "../packages/internal/island-runtime/dist/contract.js";
|
|
3
|
+
import { compute, getComputed } from "../packages/internal/template-contracts/dist/compute.js";
|
|
4
|
+
import { fill } from "../packages/internal/template-contracts/dist/fill-builders.js";
|
|
5
|
+
import { address, date, document, email, image, media, number, phone, poi, select, text, tour, url, video } from "../packages/internal/template-contracts/dist/slot-builders.js";
|
|
6
|
+
import { object } from "../packages/internal/template-contracts/dist/object.js";
|
|
7
|
+
import { list } from "../packages/internal/template-contracts/dist/list.js";
|
|
8
|
+
import { holderProcess } from "../packages/internal/template-contracts/dist/process-builders.js";
|
|
9
|
+
import { row } from "../packages/internal/template-contracts/dist/row.js";
|
|
4
10
|
import { declareSection } from "../section/declare.js";
|
|
5
11
|
import { ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE } from "../packages/internal/template-contracts/dist/markers.js";
|
|
6
|
-
import { document, image, list, number, poi, select, text, tour, url, video } from "../schema/slot-builders.js";
|
|
7
12
|
import { fact } from "../schema/fact.js";
|
|
8
13
|
import { presets } from "../schema/format-presets.js";
|
|
9
14
|
import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost } from "../schema/formats.js";
|
|
@@ -23,7 +28,6 @@ const stub = (name) => {
|
|
|
23
28
|
};
|
|
24
29
|
};
|
|
25
30
|
const Section = /* @__PURE__ */ stub("Section");
|
|
26
|
-
const SlotGroup = /* @__PURE__ */ stub("SlotGroup");
|
|
27
31
|
const Image = /* @__PURE__ */ stub("Image");
|
|
28
32
|
const Video = /* @__PURE__ */ stub("Video");
|
|
29
33
|
const Tour = /* @__PURE__ */ stub("Tour");
|
|
@@ -38,12 +42,15 @@ const Slot = {
|
|
|
38
42
|
Number: /* @__PURE__ */ stub("Slot.Number"),
|
|
39
43
|
Select: /* @__PURE__ */ stub("Slot.Select"),
|
|
40
44
|
Url: /* @__PURE__ */ stub("Slot.Url"),
|
|
45
|
+
Address: /* @__PURE__ */ stub("Slot.Address"),
|
|
41
46
|
Image: /* @__PURE__ */ stub("Slot.Image"),
|
|
42
47
|
Video: /* @__PURE__ */ stub("Slot.Video"),
|
|
43
48
|
Tour: /* @__PURE__ */ stub("Slot.Tour"),
|
|
44
49
|
Document: /* @__PURE__ */ stub("Slot.Document"),
|
|
45
|
-
|
|
50
|
+
Download: /* @__PURE__ */ stub("Slot.Download"),
|
|
51
|
+
List: /* @__PURE__ */ stub("Slot.List"),
|
|
52
|
+
Object: /* @__PURE__ */ stub("Slot.Object")
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
//#endregion
|
|
49
|
-
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, CONCRETE_VERSION, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, IslandMarker, IslandPropsError, LOGIC_STUB_MARKER, Section, Slot,
|
|
56
|
+
export { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, ATTR_SECTION_INSTANCE_ID, ATTR_SLOT_FIELD, ATTR_SLOT_GROUP, ATTR_SLOT_ID, ATTR_SLOT_ITEM, ATTR_SLOT_TEXT_LEAF, ATTR_SLOT_UNSELECTABLE, ATTR_TR_ENHANCE, CONCRETE_VERSION, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, IslandMarker, IslandPropsError, LOGIC_STUB_MARKER, Section, Slot, Tour, Video, a4Landscape, a4Portrait, address, bindItems, compute, date, deck16x9, defineTemplate, deserializeIslandProps, document, email, facebookPost, fact, fill, getComputed, halfLetterFlyer, image, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, media, number, object, phone, poi, postcard6x4, postcard7x5, presets, holderProcess as process, row, section, select, serializeIslandProps, text, tour, url, useCaptureReady, useEditor, useIslandId, video, website, xPost };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { placementOf } from "../packages/internal/template-contracts/dist/ref-locate.js";
|
|
1
2
|
import { recordPlacements } from "../section/placements.js";
|
|
2
3
|
import { TemplateManifest } from "../schema/manifest.js";
|
|
3
4
|
import { buildReadGraph, isSourcedTarget } from "./section-reads.js";
|
|
@@ -9,7 +10,6 @@ function materializeTemplate(template, options = {}) {
|
|
|
9
10
|
const sectionOfInstance = /* @__PURE__ */ new Map();
|
|
10
11
|
const placements = [];
|
|
11
12
|
const instances = [];
|
|
12
|
-
const instanceBySection = {};
|
|
13
13
|
const pages = template.pages.map((page) => {
|
|
14
14
|
const recorded = recordPlacements(createElement(page.page));
|
|
15
15
|
if (recorded.markup !== "") {
|
|
@@ -27,7 +27,6 @@ function materializeTemplate(template, options = {}) {
|
|
|
27
27
|
instanceId: placement.instance
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
if (!(placement.key in instanceBySection)) instanceBySection[placement.key] = placement.instance;
|
|
31
30
|
sections.set(placement.key, placement.section);
|
|
32
31
|
}
|
|
33
32
|
return {
|
|
@@ -52,14 +51,13 @@ function materializeTemplate(template, options = {}) {
|
|
|
52
51
|
...template.preview === void 0 ? {} : { preview: template.preview }
|
|
53
52
|
});
|
|
54
53
|
const readGraph = buildReadGraph(sections);
|
|
55
|
-
const { reads, readDiagnostics } = resolveReads(readGraph, sections,
|
|
54
|
+
const { reads, readDiagnostics } = resolveReads(readGraph, sections, manifest, instances);
|
|
56
55
|
return {
|
|
57
56
|
manifest,
|
|
58
57
|
instances,
|
|
59
58
|
reads,
|
|
60
59
|
readGraph,
|
|
61
60
|
readDiagnostics,
|
|
62
|
-
instanceBySection,
|
|
63
61
|
placements,
|
|
64
62
|
sections
|
|
65
63
|
};
|
|
@@ -68,7 +66,8 @@ function excerpt(markup) {
|
|
|
68
66
|
const oneLine = markup.replace(/\s+/g, " ").trim();
|
|
69
67
|
return oneLine.length > 80 ? `${oneLine.slice(0, 77)}…` : oneLine;
|
|
70
68
|
}
|
|
71
|
-
function resolveReads(graph, sections,
|
|
69
|
+
function resolveReads(graph, sections, manifest, instances) {
|
|
70
|
+
const placement = placementOf(manifest.pages);
|
|
72
71
|
const seen = /* @__PURE__ */ new Set();
|
|
73
72
|
const reads = [];
|
|
74
73
|
const readDiagnostics = [];
|
|
@@ -83,8 +82,11 @@ function resolveReads(graph, sections, instanceBySection) {
|
|
|
83
82
|
};
|
|
84
83
|
for (const edge of graph.edges) {
|
|
85
84
|
const upstream = sections.get(edge.to.section);
|
|
86
|
-
const
|
|
87
|
-
|
|
85
|
+
const located = instances.filter((reader) => reader.key === edge.from).map((reader) => placement.locate(edge.to, {
|
|
86
|
+
instanceId: reader.instanceId,
|
|
87
|
+
section: reader.key
|
|
88
|
+
}));
|
|
89
|
+
if (upstream === void 0 || located.length === 0 || located.includes(void 0)) {
|
|
88
90
|
readDiagnostics.push({
|
|
89
91
|
kind: "unplaced",
|
|
90
92
|
from: edge.from,
|
|
@@ -94,17 +96,14 @@ function resolveReads(graph, sections, instanceBySection) {
|
|
|
94
96
|
});
|
|
95
97
|
continue;
|
|
96
98
|
}
|
|
97
|
-
if (edge.kind === "fill") {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
index(instanceId, edge.to.slot);
|
|
99
|
+
if (edge.kind === "fill" && isSourcedTarget(upstream.schema, edge.to.slot)) readDiagnostics.push({
|
|
100
|
+
kind: "fill-reads-computed",
|
|
101
|
+
from: edge.from,
|
|
102
|
+
at: edge.at,
|
|
103
|
+
section: edge.to.section,
|
|
104
|
+
slot: edge.to.slot
|
|
105
|
+
});
|
|
106
|
+
for (const address of located) if (address !== void 0) index(address.instanceId, address.slot);
|
|
108
107
|
}
|
|
109
108
|
return {
|
|
110
109
|
reads,
|