@homepages/concrete 5.0.0 → 6.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 +336 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +12 -0
- package/codemods/reads-replace-reconcile.mjs +285 -0
- package/dist/artifact/playground/client/assets/{index-D1fwOGVK.js → index-u3T7DiSN.js} +96 -96
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +23 -23
- package/dist/base.css +3 -8
- package/dist/browser/site-config.js +1 -16
- package/dist/browser/submit-lead.js +0 -31
- package/dist/cli/build/artifact.js +16 -23
- package/dist/cli/build/captures.js +0 -6
- package/dist/cli/build/esbuild.js +0 -17
- package/dist/cli/build/fixtures.js +15 -30
- package/dist/cli/build/icons.js +0 -3
- package/dist/cli/build/index.js +1 -1
- package/dist/cli/build/playground.js +4 -8
- package/dist/cli/build/sections.js +9 -30
- package/dist/cli/build/source.js +52 -27
- package/dist/cli/build/static.js +4 -25
- package/dist/cli/capture/bundle.js +0 -9
- package/dist/cli/capture/capture-browser.js +0 -14
- package/dist/cli/capture/capture.js +1 -8
- package/dist/cli/check/analyze.js +2 -5
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/check/line-endings.js +52 -0
- package/dist/cli/check/load-workspace.js +3 -8
- package/dist/cli/check/portable-names.js +48 -0
- package/dist/cli/check/render/class-conflicts.js +0 -5
- package/dist/cli/check/render/html.js +0 -1
- package/dist/cli/check/render/invariants.js +0 -5
- package/dist/cli/check/render/island-frames.js +0 -25
- package/dist/cli/check/render/marker-coverage.js +0 -20
- package/dist/cli/check/render/nav.js +0 -33
- package/dist/cli/check/report.js +0 -3
- package/dist/cli/check/stages/bundles.js +1 -9
- package/dist/cli/check/stages/composition.js +3 -2
- package/dist/cli/check/stages/dependencies.js +7 -38
- package/dist/cli/check/stages/fixtures.js +3 -31
- package/dist/cli/check/stages/lint.js +2 -2
- package/dist/cli/check/stages/logic.js +3 -34
- package/dist/cli/check/stages/relations.js +46 -0
- package/dist/cli/check/stages/render.js +0 -1
- package/dist/cli/check/stages/sections.js +3 -3
- package/dist/cli/check/stages/stylesheet.js +1 -1
- package/dist/cli/check/stages/typecheck.js +5 -11
- package/dist/cli/check/stages/workspace.js +36 -14
- package/dist/cli/commands.js +9 -56
- package/dist/cli/currency/cache.js +4 -17
- package/dist/cli/currency/decide.js +0 -14
- package/dist/cli/currency/opt-out.js +0 -7
- package/dist/cli/currency/preamble.js +3 -24
- package/dist/cli/currency/prompt.js +0 -1
- package/dist/cli/currency/refresh.js +5 -12
- package/dist/cli/currency/resolve-latest.js +3 -64
- package/dist/cli/currency/version-order.js +0 -12
- package/dist/cli/dev/crop.js +0 -2
- package/dist/cli/dev/http.js +0 -13
- package/dist/cli/dev/index.js +3 -4
- package/dist/cli/dev/islands.js +25 -70
- package/dist/cli/dev/listen.js +26 -0
- package/dist/cli/dev/load-template.js +0 -1
- package/dist/cli/dev/request-error.js +0 -4
- package/dist/cli/dev/server.js +46 -52
- package/dist/cli/dev/tsconfig-paths.js +0 -13
- package/dist/cli/dev/vite.js +9 -38
- package/dist/cli/dev/workspace-reader.js +4 -34
- package/dist/cli/media/cache.js +4 -51
- package/dist/cli/media/derive.js +2 -94
- package/dist/cli/media/deriver-plugin.js +0 -2
- package/dist/cli/media/frame-rung-floor.js +0 -6
- package/dist/cli/property/index.js +0 -4
- package/dist/cli/property/library.js +6 -24
- package/dist/cli/publish/client.js +0 -1
- package/dist/cli/publish/freshness.js +0 -2
- package/dist/cli/publish/git.js +2 -8
- package/dist/cli/publish/index.js +8 -15
- package/dist/cli/publish/pack.js +5 -6
- package/dist/cli/publish/report.js +0 -6
- package/dist/cli/publish/target.js +16 -13
- package/dist/cli/publish/wire.js +0 -6
- package/dist/cli/tar.js +2 -9
- package/dist/cli/upgrade/codemod.js +0 -8
- package/dist/cli/upgrade/index.js +0 -24
- package/dist/cli/upgrade/manifest.js +0 -12
- package/dist/cli/upgrade/plan.js +0 -17
- package/dist/cli/upgrade/stage.js +12 -15
- package/dist/cli/version.js +0 -8
- package/dist/cli/workspace.js +2 -34
- package/dist/cli.js +4 -21
- package/dist/css/compile.js +25 -28
- package/dist/css/graph.js +3 -10
- package/dist/css/inline.js +3 -13
- package/dist/css/rules.js +6 -43
- package/dist/design-system/format-variants.js +0 -22
- package/dist/eslint/authoring.js +0 -2
- package/dist/eslint/correctness.js +0 -7
- package/dist/eslint/rules/editor-reason.js +0 -11
- package/dist/eslint/rules/island-ids.js +0 -1
- package/dist/eslint/rules/jsx-visitor.js +0 -13
- package/dist/eslint/rules/no-editor-globals.js +0 -2
- package/dist/eslint/rules/no-raw-values.js +0 -1
- package/dist/fixtures/brand.js +0 -1
- package/dist/fixtures/bundle-rule.js +4 -9
- package/dist/fixtures/canonical.d.ts +20 -0
- package/dist/fixtures/image-dimensions.js +0 -1
- package/dist/fixtures/load.js +8 -17
- package/dist/fixtures/media-plugin.js +4 -31
- package/dist/fixtures/media.js +0 -21
- package/dist/fixtures/package-stylesheets.js +0 -6
- package/dist/fixtures/property.js +16 -15
- package/dist/fixtures/resolve.js +102 -29
- package/dist/fixtures/rows.js +12 -11
- package/dist/fixtures/synthesize-empties.js +0 -4
- package/dist/fixtures.d.ts +19 -4
- package/dist/fixtures.js +0 -18
- package/dist/index.d.ts +8 -9
- package/dist/index.js +2 -11
- package/dist/islands/client-module.js +0 -11
- package/dist/islands/marker.js +0 -33
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +0 -20
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +21 -35
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +4 -0
- package/dist/packages/internal/fill-bake/dist/derive-source.js +40 -0
- package/dist/packages/internal/fill-bake/dist/display.js +0 -1
- package/dist/packages/internal/fill-bake/dist/index.js +4 -4
- package/dist/packages/internal/fill-vocabulary/dist/origination.js +106 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +1 -49
- package/dist/packages/internal/format-geometry/dist/capture.js +10 -240
- package/dist/packages/internal/format-geometry/dist/geometry.js +0 -6
- package/dist/packages/internal/image-ladder/dist/crop.js +0 -12
- package/dist/packages/internal/image-ladder/dist/policy.js +0 -14
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +0 -13
- package/dist/packages/internal/island-runtime/dist/contract.js +0 -34
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/index.js +0 -34
- package/dist/packages/internal/island-runtime/dist/island-id-context.js +0 -1
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +0 -15
- package/dist/packages/internal/island-runtime/dist/use-editor.js +0 -10
- package/dist/packages/internal/island-runtime/dist/use-island-id.js +0 -32
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +2 -17
- package/dist/packages/internal/property-facts/dist/index.js +1 -1
- package/dist/packages/internal/property-facts/dist/{property-facts-CSdkSuD7.js → property-facts-5pxZnlkh.js} +13 -2
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +1 -18
- package/dist/packages/internal/section-contracts/dist/catalog.js +16 -8
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +12 -16
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +5 -11
- package/dist/packages/internal/section-contracts/dist/display-contract.js +2 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +2 -8
- package/dist/packages/internal/section-contracts/dist/fill-spec-view.js +13 -0
- package/dist/packages/internal/section-contracts/dist/index.js +2 -1
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +16 -42
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +24 -43
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +11 -18
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +10 -12
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +3 -13
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +6 -18
- package/dist/packages/internal/section-contracts/dist/runners.js +21 -13
- package/dist/packages/internal/section-contracts/dist/source-contract.js +13 -2
- package/dist/packages/internal/section-contracts/dist/writer-reads-fact-contract.js +31 -0
- package/dist/packages/internal/source-resolution/dist/index.js +1 -9
- package/dist/packages/internal/template-artifact/dist/hash.js +0 -8
- package/dist/packages/internal/template-artifact/dist/index.js +1 -1
- package/dist/packages/internal/template-artifact/dist/layout.js +0 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -9
- package/dist/packages/internal/template-artifact/dist/sha256.js +0 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +2 -4
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +0 -16
- package/dist/packages/internal/template-contracts/dist/content-categories.js +0 -4
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +16 -10
- package/dist/packages/internal/template-contracts/dist/facts-view.js +15 -28
- package/dist/packages/internal/template-contracts/dist/layout.js +0 -7
- package/dist/packages/internal/template-contracts/dist/markers.js +0 -29
- package/dist/packages/internal/template-contracts/dist/select-key.js +0 -6
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +56 -34
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +22 -389
- package/dist/platform/file-url.js +8 -0
- package/dist/platform/fs.js +73 -0
- package/dist/platform/names.js +63 -0
- package/dist/platform/order.js +7 -0
- package/dist/platform/paths.js +62 -0
- package/dist/platform/process.js +97 -0
- package/dist/playground/host/page-state.js +0 -2
- package/dist/playground/host/paths.js +0 -1
- package/dist/playground/layout.js +0 -7
- package/dist/playground/wire.js +0 -8
- package/dist/primitives/FrameShell.js +0 -18
- package/dist/primitives/Image.d.ts +5 -1
- package/dist/primitives/Image.js +2 -68
- package/dist/primitives/Section.js +0 -13
- package/dist/primitives/Tour.js +0 -26
- package/dist/primitives/Video.js +0 -32
- package/dist/primitives/embed-playback.js +0 -1
- package/dist/primitives/marker-attrs.js +0 -17
- package/dist/primitives/picture-sources.js +6 -1
- package/dist/primitives/probe-context.js +0 -7
- package/dist/primitives/slot-bindings.js +0 -46
- package/dist/primitives/slot-document.js +0 -11
- package/dist/primitives/slot-group.js +0 -9
- package/dist/primitives/slot-media.js +0 -27
- package/dist/primitives/slot-scalar.js +0 -4
- package/dist/primitives/slot.js +0 -6
- package/dist/rules/registry.js +42 -24
- package/dist/schema/compute.d.ts +46 -8
- package/dist/schema/compute.js +21 -15
- package/dist/schema/define-schema.d.ts +1 -1
- package/dist/schema/define-schema.js +37 -17
- package/dist/schema/extract-fill-spec.js +93 -180
- package/dist/schema/extract-used-facts.js +16 -158
- package/dist/schema/fact.d.ts +25 -12
- package/dist/schema/fact.js +7 -11
- package/dist/schema/fill-builders.d.ts +91 -366
- package/dist/schema/fill-builders.js +21 -259
- package/dist/schema/fill-declaration.d.ts +7 -69
- package/dist/schema/fill-declaration.js +5 -34
- package/dist/schema/fill-spec.js +59 -148
- package/dist/schema/format-presets.js +0 -12
- package/dist/schema/format.js +0 -7
- package/dist/schema/layout.js +0 -10
- package/dist/schema/manifest.js +0 -39
- package/dist/schema/property-facts.d.ts +20 -0
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-schema.d.ts +0 -1
- package/dist/schema/section-schema.js +4 -20
- package/dist/schema/slot-builders.d.ts +128 -117
- package/dist/schema/slot-builders.js +18 -201
- package/dist/schema/slot-ref.d.ts +63 -0
- package/dist/schema/slot-ref.js +33 -0
- package/dist/schema/slot-types.d.ts +3 -2
- package/dist/schema/slot-types.js +11 -20
- package/dist/section/declare.d.ts +14 -10
- package/dist/section/declare.js +13 -2
- package/dist/section/discovery.js +6 -21
- package/dist/section/groups.js +0 -6
- package/dist/section/materialize.js +0 -5
- package/dist/section/placements.js +0 -4
- package/dist/section/section.d.ts +8 -5
- package/dist/section/section.js +7 -29
- package/dist/styles.css +5 -0
- package/dist/template/define-template.d.ts +0 -4
- package/dist/template/define-template.js +1 -15
- package/dist/template/logic-build.js +8 -35
- package/dist/template/logic-shim.d.ts +4 -5
- package/dist/template/logic-shim.js +2 -6
- package/dist/template/logic-transform.js +0 -6
- package/dist/template/materialize.js +52 -43
- package/dist/template/mirror-types.js +43 -0
- package/dist/template/running-copy.js +5 -20
- package/dist/template/section-reads.js +83 -0
- package/guide/reference/cli/INDEX.md +12 -6
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +3 -3
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +4 -2
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +26 -13
- package/package.json +4 -2
- package/dist/packages/internal/fact-interpolation/dist/index.js +0 -22
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +0 -170
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +0 -32
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +0 -131
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +0 -11
- package/dist/schema/fill-spec.d.ts +0 -18
- package/dist/template/reconcile.d.ts +0 -67
- package/dist/template/reconcile.js +0 -25
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { _ as PropertyFactsSchema } from "../packages/internal/property-facts/dist/property-facts-
|
|
1
|
+
import { _ as PropertyFactsSchema } from "../packages/internal/property-facts/dist/property-facts-5pxZnlkh.js";
|
|
2
2
|
import "../packages/internal/property-facts/dist/index.js";
|
|
3
3
|
import { basename, extname } from "node:path";
|
|
4
4
|
|
|
5
5
|
//#region src/fixtures/property.ts
|
|
6
|
-
/**
|
|
7
|
-
* The id a contact's image takes. A contact card's avatar and logos are uploads like any
|
|
8
|
-
* other, but the platform holds them on the card rather than in a pool, so a fixture's
|
|
9
|
-
* property has no entry to carry their id and this mints one. The resolver mints the
|
|
10
|
-
* same id when a content entry states the image (a `ContactImageEntry`), which is why
|
|
11
|
-
* both go through here.
|
|
12
|
-
*/
|
|
13
6
|
function contactImageId(contactId, field) {
|
|
14
7
|
return `contact:${contactId}:${field}`;
|
|
15
8
|
}
|
|
@@ -29,7 +22,6 @@ const MIME_BY_EXTENSION = {
|
|
|
29
22
|
".svg": "image/svg+xml",
|
|
30
23
|
".zip": "application/zip"
|
|
31
24
|
};
|
|
32
|
-
/** The URL a media file serves at — a derived raster's base rung, or the file itself. */
|
|
33
25
|
function mediaUrl(file) {
|
|
34
26
|
return typeof file === "string" ? file : file.url;
|
|
35
27
|
}
|
|
@@ -44,11 +36,6 @@ function isMediaFile(value) {
|
|
|
44
36
|
if (typeof value === "string") return value.length > 0;
|
|
45
37
|
return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.width === "number" && typeof value.height === "number";
|
|
46
38
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Map a property's files to ids, derive what the platform derives, and validate the
|
|
49
|
-
* result with the platform schema. `file` is the module the property was loaded from,
|
|
50
|
-
* which every violation names.
|
|
51
|
-
*/
|
|
52
39
|
function canonicalizeProperty(property, file) {
|
|
53
40
|
const violations = [];
|
|
54
41
|
const media = /* @__PURE__ */ new Map();
|
|
@@ -191,6 +178,20 @@ function canonicalizeProperty(property, file) {
|
|
|
191
178
|
media,
|
|
192
179
|
violations
|
|
193
180
|
};
|
|
181
|
+
const comparables = (property.comparables ?? []).map((comp) => ({
|
|
182
|
+
year_built: null,
|
|
183
|
+
lot_sqft: null,
|
|
184
|
+
stories: null,
|
|
185
|
+
units: null,
|
|
186
|
+
hoa_monthly: null,
|
|
187
|
+
days_on_market: null,
|
|
188
|
+
list_price: null,
|
|
189
|
+
listed_date: null,
|
|
190
|
+
mls_number: null,
|
|
191
|
+
description: null,
|
|
192
|
+
property_type: null,
|
|
193
|
+
...comp
|
|
194
|
+
}));
|
|
194
195
|
const candidate = {
|
|
195
196
|
address: property.address,
|
|
196
197
|
lat: property.lat,
|
|
@@ -200,7 +201,7 @@ function canonicalizeProperty(property, file) {
|
|
|
200
201
|
units: property.units,
|
|
201
202
|
narrative: property.narrative,
|
|
202
203
|
tours,
|
|
203
|
-
comparables
|
|
204
|
+
comparables,
|
|
204
205
|
photos,
|
|
205
206
|
floor_plans: floorPlans,
|
|
206
207
|
videos,
|
package/dist/fixtures/resolve.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getComputed } from "../schema/compute.js";
|
|
2
|
+
import { buildReadGraph } from "../template/section-reads.js";
|
|
3
|
+
import { readFact } from "../packages/internal/template-contracts/dist/facts-view.js";
|
|
2
4
|
import { rowFieldSources } from "../packages/internal/source-resolution/dist/index.js";
|
|
3
5
|
import { buildDeriveFactsView } from "../packages/internal/property-facts/dist/derive-facts-view.js";
|
|
4
6
|
import { bakeDisplayEntries, bakePropertyRefSlots } from "../packages/internal/fill-bake/dist/bake-property-ref.js";
|
|
5
|
-
import { applyReconcile } from "../packages/internal/fill-bake/dist/reconcile-cross-section.js";
|
|
6
7
|
import "../packages/internal/fill-bake/dist/index.js";
|
|
7
8
|
import { canonicalizeProperty, contactImageId } from "./property.js";
|
|
8
9
|
import { blankForField, canonicalizeRows } from "./rows.js";
|
|
@@ -14,33 +15,16 @@ const MEDIA_KINDS = /* @__PURE__ */ new Set([
|
|
|
14
15
|
"tour",
|
|
15
16
|
"document"
|
|
16
17
|
]);
|
|
17
|
-
/** The empty value an unauthored generative slot resolves to: `[]` for a list, `null` otherwise. */
|
|
18
18
|
function emptyValueFor(type) {
|
|
19
19
|
return type === "list" ? [] : null;
|
|
20
20
|
}
|
|
21
|
-
/** Is this value the empty one for its kind? */
|
|
22
21
|
function isEmptyValue(value, type) {
|
|
23
22
|
return type === "list" ? Array.isArray(value) && value.length === 0 : value === null || value === void 0;
|
|
24
23
|
}
|
|
25
|
-
/** The instances the composition has, one per instance id in first-placement order (a shared instance appears once). */
|
|
26
24
|
function uniquePlacements(placements) {
|
|
27
25
|
const seen = /* @__PURE__ */ new Set();
|
|
28
26
|
return placements.filter((p) => seen.has(p.instance) ? false : (seen.add(p.instance), true));
|
|
29
27
|
}
|
|
30
|
-
function reconcileInstances(placements) {
|
|
31
|
-
const perKey = /* @__PURE__ */ new Map();
|
|
32
|
-
for (const p of placements) perKey.set(p.key, (perKey.get(p.key) ?? 0) + 1);
|
|
33
|
-
return placements.map((p) => ({
|
|
34
|
-
key: (perKey.get(p.key) ?? 0) > 1 ? p.instance : p.key,
|
|
35
|
-
instanceId: p.instance
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Resolve one loaded fixture over the template's placements. The result carries the
|
|
40
|
-
* facts, the media catalog, the content doc and the per-slot provenance; a content
|
|
41
|
-
* entry naming an unplaced instance or a media entry the property lacks is a violation
|
|
42
|
-
* and the entry (or the slot) is dropped, so `check` reports every fault at once.
|
|
43
|
-
*/
|
|
44
28
|
function resolveFixture(loaded, options) {
|
|
45
29
|
const { fixture, module } = loaded;
|
|
46
30
|
const violations = [];
|
|
@@ -66,24 +50,29 @@ function resolveFixture(loaded, options) {
|
|
|
66
50
|
if (entriesByInstance.has(instance)) throw new Error(`Fixture "${loaded.id}" (${module}) states content twice for instance "${instance}".`);
|
|
67
51
|
entriesByInstance.set(instance, entry);
|
|
68
52
|
}
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
for (const placement of placements) {
|
|
53
|
+
const settled = /* @__PURE__ */ new Map();
|
|
54
|
+
const byInstance = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const placement of computeOrder(placements)) {
|
|
72
56
|
const resolved = resolveInstance(placement, entriesByInstance.get(placement.instance), {
|
|
73
57
|
facts,
|
|
74
58
|
media,
|
|
75
59
|
module,
|
|
76
60
|
fixtureId: loaded.id,
|
|
77
61
|
log: options.log,
|
|
78
|
-
violations
|
|
62
|
+
violations,
|
|
63
|
+
settled
|
|
79
64
|
});
|
|
65
|
+
byInstance.set(placement.instance, resolved);
|
|
66
|
+
if (!settled.has(placement.key)) settled.set(placement.key, resolved.settled);
|
|
67
|
+
}
|
|
68
|
+
const instances = [];
|
|
69
|
+
const provenance = {};
|
|
70
|
+
for (const placement of placements) {
|
|
71
|
+
const resolved = byInstance.get(placement.instance);
|
|
72
|
+
if (resolved === void 0) continue;
|
|
80
73
|
instances.push(resolved.instance);
|
|
81
74
|
provenance[placement.instance] = resolved.provenance;
|
|
82
75
|
}
|
|
83
|
-
const reconciled = applyReconcile({ instances }, buildDeriveFactsView(facts), {
|
|
84
|
-
reconcile: options.reconcile ?? [],
|
|
85
|
-
instances: reconcileInstances(placements)
|
|
86
|
-
}, options.log);
|
|
87
76
|
return {
|
|
88
77
|
resolved: {
|
|
89
78
|
id: loaded.id,
|
|
@@ -92,23 +81,90 @@ function resolveFixture(loaded, options) {
|
|
|
92
81
|
synthesized: false,
|
|
93
82
|
facts,
|
|
94
83
|
media,
|
|
95
|
-
contentDoc:
|
|
84
|
+
contentDoc: { instances },
|
|
96
85
|
provenance
|
|
97
86
|
},
|
|
98
87
|
violations
|
|
99
88
|
};
|
|
100
89
|
}
|
|
90
|
+
function computeOrder(placements) {
|
|
91
|
+
const sections = /* @__PURE__ */ new Map();
|
|
92
|
+
for (const placement of placements) if (!sections.has(placement.key)) sections.set(placement.key, placement.section);
|
|
93
|
+
const rank = new Map(buildReadGraph(sections).order.map((key, index) => [key, index]));
|
|
94
|
+
return [...placements].sort((a, b) => (rank.get(a.key) ?? 0) - (rank.get(b.key) ?? 0));
|
|
95
|
+
}
|
|
96
|
+
function valuesFor(reads, facts, settled, own) {
|
|
97
|
+
return reads.map((ref) => {
|
|
98
|
+
if (ref.kind === "fact") return readFact(facts, ref.key);
|
|
99
|
+
if (ref.section === own?.section) return own.slots[ref.slot];
|
|
100
|
+
const from = settled.get(ref.section);
|
|
101
|
+
if (from === void 0) return void 0;
|
|
102
|
+
if (ref.slot === "display.visibility") return from.visibility;
|
|
103
|
+
if (ref.slot === "display.variant") return from.variant;
|
|
104
|
+
return from.slots[ref.slot];
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function sameSectionOrder(sectionKey, declared) {
|
|
108
|
+
const ordered = [];
|
|
109
|
+
const visited = /* @__PURE__ */ new Set();
|
|
110
|
+
const visit = (id) => {
|
|
111
|
+
const slot = declared.get(id);
|
|
112
|
+
if (slot === void 0 || visited.has(id)) return;
|
|
113
|
+
visited.add(id);
|
|
114
|
+
for (const ref of slot.reads) if (ref.kind !== "fact" && ref.section === sectionKey) visit(ref.slot);
|
|
115
|
+
ordered.push([id, slot]);
|
|
116
|
+
};
|
|
117
|
+
for (const id of declared.keys()) visit(id);
|
|
118
|
+
return ordered;
|
|
119
|
+
}
|
|
120
|
+
function declaredReads(source) {
|
|
121
|
+
if (typeof source !== "object" || source === null) return [];
|
|
122
|
+
const reads = source.reads;
|
|
123
|
+
return Array.isArray(reads) ? reads : [];
|
|
124
|
+
}
|
|
125
|
+
function runDeclared(fns, transform, values) {
|
|
126
|
+
const fn = fns[transform];
|
|
127
|
+
if (fn === void 0) return null;
|
|
128
|
+
try {
|
|
129
|
+
return { value: fn(...values) };
|
|
130
|
+
} catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function constantComputed(schema) {
|
|
135
|
+
const declared = /* @__PURE__ */ new Set();
|
|
136
|
+
const record = (source) => {
|
|
137
|
+
const reads = declaredReads(source);
|
|
138
|
+
const transform = source?.transform;
|
|
139
|
+
if (reads.length > 0 && typeof transform === "string") declared.add(transform);
|
|
140
|
+
};
|
|
141
|
+
for (const slot of Object.values(schema.slots)) record(slot.source);
|
|
142
|
+
const display = schema.meta.display;
|
|
143
|
+
for (const entry of ["visibility", "variant"]) record(display?.[entry]?.source);
|
|
144
|
+
return Object.fromEntries(Object.entries(getComputed(schema)).filter(([handle]) => !declared.has(handle)));
|
|
145
|
+
}
|
|
101
146
|
function resolveInstance(placement, entry, ctx) {
|
|
102
147
|
const section = placement.section;
|
|
103
148
|
const { schema } = section;
|
|
104
149
|
const bakeCtx = {
|
|
105
|
-
computed:
|
|
150
|
+
computed: constantComputed(schema),
|
|
106
151
|
section_key: section.key,
|
|
107
152
|
log: ctx.log
|
|
108
153
|
};
|
|
109
154
|
const baked = bakePropertyRefSlots(schema, ctx.facts, bakeCtx);
|
|
110
155
|
const display = schema.meta.display ?? {};
|
|
111
156
|
const resolvedDisplay = bakeDisplayEntries({ display }, ctx.facts, bakeCtx);
|
|
157
|
+
const computeFns = getComputed(schema);
|
|
158
|
+
const factsView = buildDeriveFactsView(ctx.facts);
|
|
159
|
+
for (const [entryName, entryDef] of Object.entries(display)) {
|
|
160
|
+
const reads = declaredReads(entryDef?.source);
|
|
161
|
+
const transform = entryDef?.source?.transform;
|
|
162
|
+
if (reads.length === 0 || typeof transform !== "string") continue;
|
|
163
|
+
const answered = runDeclared(computeFns, transform, valuesFor(reads, factsView, ctx.settled));
|
|
164
|
+
const answer = typeof answered?.value === "string" ? answered.value : "";
|
|
165
|
+
if (entryDef?.cases?.includes(answer) === true) resolvedDisplay[entryName] = answer;
|
|
166
|
+
else delete resolvedDisplay[entryName];
|
|
167
|
+
}
|
|
112
168
|
const values = entry?.values ?? {};
|
|
113
169
|
const visibility = resolvedDisplay.visibility ?? display.visibility?.cases?.[0];
|
|
114
170
|
const enabled = typeof values.enabled === "boolean" ? values.enabled : visibility === void 0 ? true : visibility !== "hidden";
|
|
@@ -120,6 +176,7 @@ function resolveInstance(placement, entry, ctx) {
|
|
|
120
176
|
}
|
|
121
177
|
const slots = {};
|
|
122
178
|
const provenance = {};
|
|
179
|
+
const declared = /* @__PURE__ */ new Map();
|
|
123
180
|
for (const [id, def] of Object.entries(schema.slots)) {
|
|
124
181
|
const gate = def.variant?.cases;
|
|
125
182
|
if (gate !== void 0 && (variant === void 0 || !gate.includes(variant))) continue;
|
|
@@ -139,6 +196,12 @@ function resolveInstance(placement, entry, ctx) {
|
|
|
139
196
|
continue;
|
|
140
197
|
}
|
|
141
198
|
if (source?.kind === "derived" && typeof source.transform === "string") {
|
|
199
|
+
const reads = declaredReads(source);
|
|
200
|
+
if (reads.length > 0) declared.set(id, {
|
|
201
|
+
transform: source.transform,
|
|
202
|
+
reads,
|
|
203
|
+
type: def.type
|
|
204
|
+
});
|
|
142
205
|
slots[id] = baked[id] ?? null;
|
|
143
206
|
provenance[id] = {
|
|
144
207
|
kind: "computed",
|
|
@@ -159,6 +222,11 @@ function resolveInstance(placement, entry, ctx) {
|
|
|
159
222
|
});
|
|
160
223
|
provenance[id] = { kind: "authored" };
|
|
161
224
|
}
|
|
225
|
+
const own = {
|
|
226
|
+
section: section.key,
|
|
227
|
+
slots
|
|
228
|
+
};
|
|
229
|
+
for (const [id, slot] of sameSectionOrder(section.key, declared)) slots[id] = runDeclared(computeFns, slot.transform, valuesFor(slot.reads, factsView, ctx.settled, own))?.value ?? emptyValueFor(slot.type);
|
|
162
230
|
return {
|
|
163
231
|
instance: {
|
|
164
232
|
instance_id: placement.instance,
|
|
@@ -167,7 +235,12 @@ function resolveInstance(placement, entry, ctx) {
|
|
|
167
235
|
...variant === void 0 ? {} : { variant },
|
|
168
236
|
slots
|
|
169
237
|
},
|
|
170
|
-
provenance
|
|
238
|
+
provenance,
|
|
239
|
+
settled: {
|
|
240
|
+
slots,
|
|
241
|
+
visibility: resolvedDisplay.visibility ?? display.visibility?.cases?.[0],
|
|
242
|
+
variant
|
|
243
|
+
}
|
|
171
244
|
};
|
|
172
245
|
}
|
|
173
246
|
function enrichedRows(fields, baked, stated, ctx) {
|
package/dist/fixtures/rows.js
CHANGED
|
@@ -53,7 +53,18 @@ const EMPTY_FACT_ROW = {
|
|
|
53
53
|
sqft: null,
|
|
54
54
|
photo_url: null,
|
|
55
55
|
source_url: null,
|
|
56
|
-
source_name: null
|
|
56
|
+
source_name: null,
|
|
57
|
+
year_built: null,
|
|
58
|
+
lot_sqft: null,
|
|
59
|
+
stories: null,
|
|
60
|
+
units: null,
|
|
61
|
+
hoa_monthly: null,
|
|
62
|
+
days_on_market: null,
|
|
63
|
+
list_price: null,
|
|
64
|
+
listed_date: null,
|
|
65
|
+
mls_number: null,
|
|
66
|
+
description: null,
|
|
67
|
+
property_type: null
|
|
57
68
|
}
|
|
58
69
|
};
|
|
59
70
|
function blankCollectionRow(collection, facts, rowFields) {
|
|
@@ -63,11 +74,6 @@ function blankCollectionRow(collection, facts, rowFields) {
|
|
|
63
74
|
};
|
|
64
75
|
return COLLECTION_PROJECTIONS[collection](oneEmptyRow, rowFields)[0] ?? {};
|
|
65
76
|
}
|
|
66
|
-
/**
|
|
67
|
-
* The per-kind blank of one declared row field — the same canonical form the binding
|
|
68
|
-
* layer normalizes an unfilled value to. Kept to the kinds a row field may take (a
|
|
69
|
-
* record cannot nest inside a record).
|
|
70
|
-
*/
|
|
71
77
|
function blankForField(def) {
|
|
72
78
|
switch (def.type) {
|
|
73
79
|
case "text":
|
|
@@ -94,11 +100,6 @@ function blankDeclaredRow(slot) {
|
|
|
94
100
|
for (const [field, def] of Object.entries(slot.fields ?? {})) row[field] = blankForField(def);
|
|
95
101
|
return row;
|
|
96
102
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Fill each stated row of a record list out to a whole row, giving every key the row
|
|
99
|
-
* does not state the blank a bake would carry there. A non-array value passes through
|
|
100
|
-
* untouched.
|
|
101
|
-
*/
|
|
102
103
|
function canonicalizeRows(slot, value, facts, rowFields) {
|
|
103
104
|
if (!Array.isArray(value)) return value;
|
|
104
105
|
const collection = collectionForSlot(slot);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { emptyValueFor, isEmptyValue, uniquePlacements } from "./resolve.js";
|
|
2
2
|
|
|
3
3
|
//#region src/fixtures/synthesize-empties.ts
|
|
4
|
-
/**
|
|
5
|
-
* One derived fixture per (instance, slot) whose value is not already empty. The id
|
|
6
|
-
* is `<fixture id>/empty/<instance>/<slot>`; provenance marks the slot `empty`.
|
|
7
|
-
*/
|
|
8
4
|
function synthesizeEmptyFixtures(resolved, placements) {
|
|
9
5
|
const out = [];
|
|
10
6
|
for (const placement of uniquePlacements(placements)) {
|
package/dist/fixtures.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ type CanonicalFloorPlan = Canonical["floor_plans"][number];
|
|
|
18
18
|
type CanonicalVideo = Canonical["videos"][number];
|
|
19
19
|
type CanonicalDocument = Canonical["documents"][number];
|
|
20
20
|
type CanonicalContact = Canonical["contacts"][number];
|
|
21
|
+
type CanonicalComparable = Canonical["comparables"][number];
|
|
21
22
|
/** A photo of the property: the canonical photo row with its file imported. */
|
|
22
23
|
type PhotoEntry = CanonicalPhoto & {
|
|
23
24
|
readonly file: MediaFile;
|
|
@@ -29,6 +30,20 @@ type PhotoEntry = CanonicalPhoto & {
|
|
|
29
30
|
type FloorPlanEntry = Omit<CanonicalFloorPlan, "upload_id" | "page_index" | "processed_s3_key"> & {
|
|
30
31
|
readonly file: MediaFile;
|
|
31
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* The members of a comparable the PLATFORM collects rather than the author states —
|
|
35
|
+
* what its research reads back from the address once the row exists.
|
|
36
|
+
*/
|
|
37
|
+
type CollectedComparableMember = "year_built" | "lot_sqft" | "stories" | "units" | "hoa_monthly" | "days_on_market" | "list_price" | "listed_date" | "mls_number" | "description" | "property_type";
|
|
38
|
+
/**
|
|
39
|
+
* A comparable property: the canonical row, with the collected members optional.
|
|
40
|
+
*
|
|
41
|
+
* They are the one part of a comp nobody types — the platform looks them up — so a
|
|
42
|
+
* fixture that cares about an age or an asking price states it and a fixture that
|
|
43
|
+
* does not says nothing. An omitted member loads as `null`, which is exactly what a
|
|
44
|
+
* real bake carries for a comp whose record was never collected.
|
|
45
|
+
*/
|
|
46
|
+
type ComparableEntry = Omit<CanonicalComparable, CollectedComparableMember> & Partial<Pick<CanonicalComparable, CollectedComparableMember>>;
|
|
32
47
|
/** A hosted video: the canonical row with its file imported. */
|
|
33
48
|
type UploadVideoEntry = Omit<CanonicalVideo, "source" | "url" | "provider"> & {
|
|
34
49
|
readonly source: "upload";
|
|
@@ -80,7 +95,8 @@ type ContactEntry = Omit<CanonicalContact, "avatar_upload_id" | "logo_dark_uploa
|
|
|
80
95
|
* Facts only. Unit copy, points of interest, amenities and any other fill output are
|
|
81
96
|
* not on a property; a fixture states them in its content entries.
|
|
82
97
|
*/
|
|
83
|
-
type Property = Omit<Canonical, "photos" | "floor_plans" | "videos" | "tours" | "documents" | "contacts" | "document_notes"> & {
|
|
98
|
+
type Property = Omit<Canonical, "photos" | "floor_plans" | "videos" | "tours" | "documents" | "contacts" | "document_notes" | "comparables"> & {
|
|
99
|
+
readonly comparables: ComparableEntry[];
|
|
84
100
|
readonly photos: PhotoEntry[];
|
|
85
101
|
readonly floor_plans: FloorPlanEntry[];
|
|
86
102
|
readonly videos: VideoEntry[];
|
|
@@ -163,8 +179,7 @@ type ContactImageField = "avatar" | "logo_dark" | "logo_light";
|
|
|
163
179
|
* `{ contact: listingAgent, field: "logo_dark" }`. A contact's avatar and logos are image
|
|
164
180
|
* media like any other, but the platform holds them on the card rather than in a pool, so
|
|
165
181
|
* they have no entry of their own to state — this names the same image the resolver
|
|
166
|
-
* registers, and it resolves to the `{ asset_id }`
|
|
167
|
-
* field. A contact the property does not carry, or a field it holds `null`, is a check
|
|
182
|
+
* registers, and it resolves to the `{ asset_id }` the platform bakes for that field. A contact the property does not carry, or a field it holds `null`, is a check
|
|
168
183
|
* error like any other media the property lacks.
|
|
169
184
|
*/
|
|
170
185
|
interface ContactImageEntry {
|
|
@@ -278,4 +293,4 @@ declare function content<S extends SectionRef, M extends object>(section: S, val
|
|
|
278
293
|
readonly instance?: string;
|
|
279
294
|
}): ContentEntry<S>;
|
|
280
295
|
//#endregion
|
|
281
|
-
export { ContactEntry, ContactImageEntry, ContactImageField, ContentDisplay, ContentEntry, ContentRow, ContentSlotValue, ContentSlots, ContentValues, ContentValuesOf, DocumentEntry, ExactContent, Fixture, FixtureSpec, FloorPlanEntry, ImageEntry, LinkVideoEntry, MediaFile, PhotoEntry, Property, RowFillFields, SectionRef, TourEntry, UploadVideoEntry, VideoEntry, content, defineFixture };
|
|
296
|
+
export { ComparableEntry, ContactEntry, ContactImageEntry, ContactImageField, ContentDisplay, ContentEntry, ContentRow, ContentSlotValue, ContentSlots, ContentValues, ContentValuesOf, DocumentEntry, ExactContent, Fixture, FixtureSpec, FloorPlanEntry, ImageEntry, LinkVideoEntry, MediaFile, PhotoEntry, Property, RowFillFields, SectionRef, TourEntry, UploadVideoEntry, VideoEntry, content, defineFixture };
|
package/dist/fixtures.js
CHANGED
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
import { FIXTURE } from "./fixtures/brand.js";
|
|
2
2
|
|
|
3
3
|
//#region src/fixtures/index.ts
|
|
4
|
-
/**
|
|
5
|
-
* Declare a fixture. The export name is the fixture id; the loader collects every
|
|
6
|
-
* exported fixture value from every module under the workspace's `fixtures/`
|
|
7
|
-
* directory. Validation is the loader's: this returns the spec, branded.
|
|
8
|
-
*/
|
|
9
4
|
function defineFixture(spec) {
|
|
10
5
|
return {
|
|
11
6
|
...spec,
|
|
12
7
|
[FIXTURE]: true
|
|
13
8
|
};
|
|
14
9
|
}
|
|
15
|
-
/**
|
|
16
|
-
* State the content a fill would generate for one placed instance of a section: its
|
|
17
|
-
* generative slots and its display state, typed by the section value. A fact-bound or
|
|
18
|
-
* computed slot is never stated here — derived information is taken from the property —
|
|
19
|
-
* with one exception in the platform's own image: a record list bound to a collection
|
|
20
|
-
* takes the fields of each row a fill enriches, stated row by row in the property's own
|
|
21
|
-
* order, while the row's bound fields stay the bake's.
|
|
22
|
-
* Media is stated by value, as an entry of the fixture's property (`hero_image:
|
|
23
|
-
* deckShot`), of the slot's own kind; an entry the property does not carry is a check
|
|
24
|
-
* error. A contact's image, which has no entry, is stated as the card plus the field
|
|
25
|
-
* ({@link ContactImageEntry}). A second placed instance names itself with `instance`,
|
|
26
|
-
* the same id the placement wrote.
|
|
27
|
-
*/
|
|
28
10
|
function content(section, values, options = {}) {
|
|
29
11
|
const stated = values;
|
|
30
12
|
return options.instance === void 0 ? {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ATTR_ISLAND_FRAMELESS, ATTR_ISLAND_ID, ATTR_ISLAND_KEY, ATTR_ISLAND_PROPS, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, IslandComponent, IslandEditor, IslandEditorOptions, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, deserializeIslandProps, islandId, serializeIslandProps } from "./packages/internal/island-runtime/dist/contract.js";
|
|
2
2
|
import "./asset-modules.js";
|
|
3
|
+
import { FactsAddress, FactsContact, FactsDocument, FactsDocumentNote, FactsFloorPlan, FactsPhoto, FactsTour, FactsUnit, FactsVideo } from "./packages/internal/template-contracts/dist/facts-view.js";
|
|
3
4
|
import { ResponsiveImage, ResponsiveSource } from "./packages/internal/image-descriptor/dist/index.js";
|
|
4
5
|
import { VideoCollectionValue, VideoValue } from "./packages/internal/template-contracts/dist/video-value.js";
|
|
5
6
|
import { TourCollectionValue, TourValue } from "./packages/internal/template-contracts/dist/tour-value.js";
|
|
@@ -7,13 +8,10 @@ import { DocumentCollectionValue, DocumentValue } from "./packages/internal/temp
|
|
|
7
8
|
import { PoiPhoto, PoiRow } from "./packages/internal/template-contracts/dist/poi-row.js";
|
|
8
9
|
import { ComparableRow, Coordinates, FloorplanAssignment, Narrative, UnitRow } from "./schema/property-facts.js";
|
|
9
10
|
import { AuthorImage, ContactRow, ImageCollectionValue, ImageValue, PlaybackConfig } from "./schema/runtime-values.js";
|
|
10
|
-
import {
|
|
11
|
-
import { Facts, FactsAddress, FactsContact, FactsDocument, FactsDocumentNote, FactsFloorPlan, FactsNarrative, FactsPhoto, FactsTour, FactsUnit, FactsVideo } from "./packages/internal/template-contracts/dist/facts-view.js";
|
|
12
|
-
import { ComputeBinding, compute } from "./schema/compute.js";
|
|
13
|
-
import { TextStructure } from "./schema/fill-spec.js";
|
|
14
|
-
import { BuiltDecision, ChosenRows, DecisionKind, DisplayChoice, NamedRows, RowOrigination, chooseFrom, contactAssign, documentAssign, imageAssign, listFill, nameRows, textBlock, tourAssign, videoAssign } from "./schema/fill-builders.js";
|
|
15
|
-
import { CropConfig, DisplayEntryInput, DocumentSlotDef, ImageSlotDef, ListRecordSlotDef, ListSlotDef, NumberSlotDef, PoiSlotDef, SelectSlotDef, SlotSource, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, document, image, list, number, poi, select, text, tour, url, video } from "./schema/slot-builders.js";
|
|
11
|
+
import { FillBinding, FillCount, FillFor, FillInput, FillOptionName, fill } from "./schema/fill-builders.js";
|
|
16
12
|
import { DocumentSlot, ImageSlot, ListFieldSlot, ListItemSlot, ListSlot, NumberSlot, PoiSlot, SelectSlot, TextSlot, TourSlot, UrlSlot, VideoSlot } from "./schema/slot-types.js";
|
|
13
|
+
import { SlotRef } from "./schema/slot-ref.js";
|
|
14
|
+
import { CollectionRowValues, DerivedFactRef, DirectFactRef, FactNamespace, fact } from "./schema/fact.js";
|
|
17
15
|
import "./schema/section-schema.js";
|
|
18
16
|
import { RowValue, SlotValue } from "./schema/section-props.js";
|
|
19
17
|
import { UseEditorResult, useEditor } from "./packages/internal/island-runtime/dist/use-editor.js";
|
|
@@ -21,11 +19,12 @@ import { useCaptureReady } from "./packages/internal/island-runtime/dist/use-cap
|
|
|
21
19
|
import { useIslandId } from "./packages/internal/island-runtime/dist/use-island-id.js";
|
|
22
20
|
import { IslandMarker, IslandMarkerProps } from "./islands/marker.js";
|
|
23
21
|
import { BoundSlotValue, FieldBinding, ItemBinding, RowBinding, SlotBinding, SlotBindingMap, bindItems } from "./primitives/slot-bindings.js";
|
|
24
|
-
import {
|
|
22
|
+
import { ComputeBinding, compute } from "./schema/compute.js";
|
|
23
|
+
import { CropConfig, DisplayEntryInput, DisplayFill, DocumentSlotDef, ImageSlotDef, ListRecordSlotDef, ListSlotDef, NumberSlotDef, PoiSlotDef, SelectSlotDef, SlotSource, TextSlotDef, TourSlotDef, UrlSlotDef, VideoSlotDef, document, image, list, number, poi, select, text, tour, url, video } from "./schema/slot-builders.js";
|
|
24
|
+
import { SectionOptions } from "./section/declare.js";
|
|
25
25
|
import { SectionContractProps, SectionPlacementProps, SectionRenderBindings, SectionValue, section } from "./section/section.js";
|
|
26
26
|
import { DocumentFormat, FormatIdentity, ImageFormat, PhysicalLength } from "./packages/internal/format-geometry/dist/format.js";
|
|
27
27
|
import { WebsiteFormat } from "./schema/format.js";
|
|
28
|
-
import { Edit, ReconcileContext, ReconcileRule, ReconcileRuleOptions, SetEdit, SiteValues, SiteViewOf, rule, set } from "./template/reconcile.js";
|
|
29
28
|
import { CanvasInput, CanvasesInput, DefineTemplateInput, OutputClass, PageComponent, RenderedPage, TemplateCanvas, TemplatePage, TemplatePreview, TemplateScope, TemplateValue, WebsitePage, defineTemplate } from "./template/define-template.js";
|
|
30
29
|
import { FrameShell } from "./primitives/FrameShell.js";
|
|
31
30
|
import { Image } from "./primitives/Image.js";
|
|
@@ -51,4 +50,4 @@ import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, insta
|
|
|
51
50
|
*/
|
|
52
51
|
declare const CONCRETE_VERSION: string;
|
|
53
52
|
//#endregion
|
|
54
|
-
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, type AuthorImage, type BoundSlotValue,
|
|
53
|
+
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, type AuthorImage, type BoundSlotValue, CONCRETE_VERSION, type CanvasInput, type CanvasesInput, type CollectionRowValues, type ComparableRow, type ComputeBinding, type ContactRow, type Coordinates, type CropConfig, type DefineTemplateInput, type DerivedFactRef, type DirectFactRef, type DisplayEntryInput, type DisplayFill, type DocumentCollectionValue, type DocumentFormat, type DocumentSlot, type DocumentSlotDef, type DocumentValue, EDITOR_BRIDGE_PROP, EDITOR_BRIDGE_PROTOCOL, EditorBridge, EditorBridgeSelection, EditorSelection, type FactNamespace, type FactsAddress, type FactsContact, type FactsDocument, type FactsDocumentNote, type FactsFloorPlan, type FactsPhoto, type FactsTour, type FactsUnit, type FactsVideo, type FieldBinding, type FillBinding, type FillCount, type FillFor, type FillInput, type FillOptionName, type FloorplanAssignment, type FormatIdentity, FrameShell, ISLAND_CAPTURE_HOLDS_GLOBAL, ISLAND_ELEMENT, Image, type ImageCollectionValue, type ImageFormat, type ImageSlot, type ImageSlotDef, type ImageValue, IslandComponent, IslandEditor, IslandEditorOptions, IslandMarker, type IslandMarkerProps, IslandModule, IslandProps, IslandPropsError, IslandServerFrame, type ItemBinding, type ListFieldSlot, type ListItemSlot, type ListRecordSlotDef, type ListSlot, type ListSlotDef, type Narrative, type NumberSlot, type NumberSlotDef, type OutputClass, type PageComponent, type PhysicalLength, type PicturePlan, type PictureSourceSpec, type PlaybackConfig, type PoiPhoto, type PoiRow, type PoiSlot, type PoiSlotDef, type RenderedPage, type ResponsiveImage, type ResponsiveSource, type RowBinding, type RowValue, Section, type SectionContractProps, type SectionOptions, type SectionPlacementProps, type SectionRenderBindings, type SectionValue, type SelectSlot, type SelectSlotDef, Slot, type SlotBinding, type SlotBindingMap, SlotGroup, type SlotRef, type SlotSource, type SlotValue, type TemplateCanvas, type TemplatePage, type TemplatePreview, type TemplateScope, type TemplateValue, type TextSlot, type TextSlotDef, Tour, type TourCollectionValue, type TourSlot, type TourSlotDef, type TourValue, type UnitRow, type UrlSlot, type UrlSlotDef, type UseEditorResult, type ValueBinding, Video, type VideoCollectionValue, type VideoSlot, type VideoSlotDef, type VideoValue, type WebsiteFormat, type WebsitePage, a4Landscape, a4Portrait, bindItems, compute, deck16x9, defineTemplate, deserializeIslandProps, document, facebookPost, fact, fill, halfLetterFlyer, image, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, number, poi, postcard6x4, postcard7x5, presets, section, select, serializeIslandProps, text, tour, url, useCaptureReady, useEditor, useIslandId, video, website, xPost };
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { useIslandId } from "./packages/internal/island-runtime/dist/use-island-
|
|
|
6
6
|
import { IslandMarker } from "./islands/marker.js";
|
|
7
7
|
import { bindItems } from "./primitives/slot-bindings.js";
|
|
8
8
|
import { compute } from "./schema/compute.js";
|
|
9
|
+
import { fill } from "./schema/fill-builders.js";
|
|
9
10
|
import { section } from "./section/section.js";
|
|
10
11
|
import { defineTemplate } from "./template/define-template.js";
|
|
11
|
-
import { rule, set } from "./template/reconcile.js";
|
|
12
12
|
import { FrameShell } from "./primitives/FrameShell.js";
|
|
13
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";
|
|
14
14
|
import { Image } from "./primitives/Image.js";
|
|
@@ -19,20 +19,11 @@ import { Video } from "./primitives/Video.js";
|
|
|
19
19
|
import { Slot } from "./primitives/slot.js";
|
|
20
20
|
import { document, image, list, number, poi, select, text, tour, url, video } from "./schema/slot-builders.js";
|
|
21
21
|
import { fact } from "./schema/fact.js";
|
|
22
|
-
import { chooseFrom, contactAssign, documentAssign, imageAssign, listFill, nameRows, textBlock, tourAssign, videoAssign } from "./schema/fill-builders.js";
|
|
23
22
|
import { presets } from "./schema/format-presets.js";
|
|
24
23
|
import { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost } from "./schema/formats.js";
|
|
25
24
|
|
|
26
25
|
//#region src/index.ts
|
|
27
|
-
/**
|
|
28
|
-
* The published version of this package.
|
|
29
|
-
*
|
|
30
|
-
* Read from package.json and inlined at build time, so it cannot drift: changesets
|
|
31
|
-
* owns package.json's version, and a hardcoded constant would have to be hand-edited
|
|
32
|
-
* on every release. src/index.test.ts asserts it against package.json to prove the
|
|
33
|
-
* inlining actually happened.
|
|
34
|
-
*/
|
|
35
26
|
const CONCRETE_VERSION = version;
|
|
36
27
|
|
|
37
28
|
//#endregion
|
|
38
|
-
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, Section, Slot, SlotGroup, Tour, Video, a4Landscape, a4Portrait, bindItems,
|
|
29
|
+
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, Section, Slot, SlotGroup, Tour, Video, a4Landscape, a4Portrait, bindItems, compute, deck16x9, defineTemplate, deserializeIslandProps, document, facebookPost, fact, fill, halfLetterFlyer, image, instagramPortrait, instagramSquare, instagramStory, islandId, letterLandscape, letterPortrait, linkedinPost, list, number, poi, postcard6x4, postcard7x5, presets, section, select, serializeIslandProps, text, tour, url, useCaptureReady, useEditor, useIslandId, video, website, xPost };
|
|
@@ -4,10 +4,6 @@ import { dirname, resolve } from "node:path";
|
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
|
|
6
6
|
//#region src/islands/client-module.ts
|
|
7
|
-
/**
|
|
8
|
-
* Whether source text opens with a `"use client"` directive — among the leading
|
|
9
|
-
* string-literal statements (the directive prologue). Anything else ends the prologue.
|
|
10
|
-
*/
|
|
11
7
|
function hasClientDirective(text) {
|
|
12
8
|
let i = 0;
|
|
13
9
|
while (i < text.length) {
|
|
@@ -44,7 +40,6 @@ function mtimeOf(path) {
|
|
|
44
40
|
return;
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
|
-
/** Whether the file at `path` opens with a `"use client"` directive. An unreadable or missing file is not a client module. */
|
|
48
43
|
function isClientFile(path) {
|
|
49
44
|
const absolute = resolve(path);
|
|
50
45
|
const mtime = mtimeOf(absolute);
|
|
@@ -74,7 +69,6 @@ function firstFile(base) {
|
|
|
74
69
|
candidates.push(base, ...SOURCE_EXTS.map((ext) => base + ext), ...SOURCE_EXTS.map((ext) => `${base}/index${ext}`));
|
|
75
70
|
return candidates.find((candidate) => mtimeOf(candidate) !== void 0) ?? null;
|
|
76
71
|
}
|
|
77
|
-
/** The tsconfig `paths` resolver of the nearest tsconfig.json above `fromFile`, or `null`. */
|
|
78
72
|
function pathsResolverFor(fromFile) {
|
|
79
73
|
const config = ts.findConfigFile(dirname(fromFile), (file) => ts.sys.fileExists(file));
|
|
80
74
|
if (config === void 0) return null;
|
|
@@ -82,11 +76,6 @@ function pathsResolverFor(fromFile) {
|
|
|
82
76
|
if (!pathsResolvers.has(key)) pathsResolvers.set(key, createPathsResolver(ts, dirname(config)));
|
|
83
77
|
return pathsResolvers.get(key) ?? null;
|
|
84
78
|
}
|
|
85
|
-
/**
|
|
86
|
-
* The workspace file an import specifier, written in `fromFile`, names: a relative
|
|
87
|
-
* specifier, or one mapped by the workspace tsconfig's `paths` (the scaffold's `@/*`).
|
|
88
|
-
* `null` for a package specifier, or when no candidate is a real file.
|
|
89
|
-
*/
|
|
90
79
|
function resolveImportedFile(specifier, fromFile) {
|
|
91
80
|
if (specifier.startsWith(".")) return firstFile(resolve(dirname(fromFile), specifier));
|
|
92
81
|
const mapped = pathsResolverFor(resolve(fromFile))?.(specifier);
|
package/dist/islands/marker.js
CHANGED
|
@@ -3,39 +3,6 @@ import { IslandIdContext } from "./island-id.js";
|
|
|
3
3
|
import { Fragment, createElement, useContext } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/islands/marker.tsx
|
|
6
|
-
/**
|
|
7
|
-
* Wrap a client component's server-rendered output in the island DOM shape: a
|
|
8
|
-
* layout-invisible custom element carrying the island's key and id, plus a sibling
|
|
9
|
-
* `<script type="application/json">` payload the browser runtime reads the props
|
|
10
|
-
* back out of. This is the one place that shape is written — every renderer and
|
|
11
|
-
* every "use client" wrapping goes through it.
|
|
12
|
-
*
|
|
13
|
-
* Both nodes set `suppressHydrationWarning`, scoped to themselves (it does not
|
|
14
|
-
* descend, so a real mismatch inside the island still reports). A NESTED island's
|
|
15
|
-
* marker is rendered on the client as well as the server — that is what lets its
|
|
16
|
-
* parent island's client render match the markup SSR produced — and `islandId` comes
|
|
17
|
-
* from `useId`, which counts from the root of the tree being rendered. The server
|
|
18
|
-
* renders a whole section under an `identifierPrefix`; the client hydrates a subtree
|
|
19
|
-
* rooted at one marker, with no prefix. The two ids therefore diverge by construction
|
|
20
|
-
* and cannot be reconciled by passing a prefix. That divergence is inert ON THESE TWO
|
|
21
|
-
* NODES: React leaves the server's ids in the DOM, the marker and its payload come from
|
|
22
|
-
* the same `islandId` in one render so they stay paired under either outcome, and a
|
|
23
|
-
* nested marker's id is never read — `hydrateIslands` skips nested markers, leaving
|
|
24
|
-
* them to their parent.
|
|
25
|
-
*
|
|
26
|
-
* It is NOT inert one node deeper, which is why this marker also opens the island-id
|
|
27
|
-
* context. An id the island component puts on its own markup carries no
|
|
28
|
-
* `suppressHydrationWarning` and would report the same divergence as a real mismatch,
|
|
29
|
-
* so an author composes one from `useIslandId()` instead of `useId` — and what that
|
|
30
|
-
* hook reads is the id provided here, or, once the browser has taken the island over,
|
|
31
|
-
* the identical string `hydrateIslands` read back off this marker's own attribute.
|
|
32
|
-
* Only the OUTERMOST marker provides: a nested one defers to the enclosing value,
|
|
33
|
-
* because its own id is exactly the one that diverges.
|
|
34
|
-
*
|
|
35
|
-
* No children means no server-rendered output, and the marker says so on itself with
|
|
36
|
-
* `data-tr-island-frameless` — the browser loader mounts such an island fresh rather
|
|
37
|
-
* than hydrating it against markup that was never emitted.
|
|
38
|
-
*/
|
|
39
6
|
function IslandMarker({ islandKey, islandId, props, children }) {
|
|
40
7
|
const enclosing = useContext(IslandIdContext);
|
|
41
8
|
return createElement(Fragment, null, createElement(ISLAND_ELEMENT, {
|
|
@@ -523,12 +523,6 @@ var mrg = function(a, b) {
|
|
|
523
523
|
var wbytes = function(d, b, v) {
|
|
524
524
|
for (; v; ++b) d[b] = v, v >>>= 8;
|
|
525
525
|
};
|
|
526
|
-
/**
|
|
527
|
-
* Compresses data with DEFLATE without any wrapper
|
|
528
|
-
* @param data The data to compress
|
|
529
|
-
* @param opts The compression options
|
|
530
|
-
* @returns The deflated version of the data
|
|
531
|
-
*/
|
|
532
526
|
function deflateSync(data, opts) {
|
|
533
527
|
return dopt(data, opts || {}, 0, 0);
|
|
534
528
|
}
|
|
@@ -550,13 +544,6 @@ try {
|
|
|
550
544
|
td.decode(et, { stream: true });
|
|
551
545
|
tds = 1;
|
|
552
546
|
} catch (e) {}
|
|
553
|
-
/**
|
|
554
|
-
* Converts a string into a Uint8Array for use with compression/decompression methods
|
|
555
|
-
* @param str The string to encode
|
|
556
|
-
* @param latin1 Whether or not to interpret the data as Latin-1. This should
|
|
557
|
-
* not need to be true unless decoding a binary string.
|
|
558
|
-
* @returns The string encoded in UTF-8/Latin-1 binary
|
|
559
|
-
*/
|
|
560
547
|
function strToU8(str, latin1) {
|
|
561
548
|
if (latin1) {
|
|
562
549
|
var ar_1 = new u8(str.length);
|
|
@@ -634,13 +621,6 @@ var wzf = function(o, b, c, d, e) {
|
|
|
634
621
|
wbytes(o, b + 12, d);
|
|
635
622
|
wbytes(o, b + 16, e);
|
|
636
623
|
};
|
|
637
|
-
/**
|
|
638
|
-
* Synchronously creates a ZIP file. Prefer using `zip` for better performance
|
|
639
|
-
* with more than one file.
|
|
640
|
-
* @param data The directory structure for the ZIP archive
|
|
641
|
-
* @param opts The main options, merged with per-file options
|
|
642
|
-
* @returns The generated ZIP archive
|
|
643
|
-
*/
|
|
644
624
|
function zipSync(data, opts) {
|
|
645
625
|
if (!opts) opts = {};
|
|
646
626
|
var r = {};
|