@homepages/concrete 4.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 +359 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +18 -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 +22 -36
- 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 +5 -30
- 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.d.ts +3 -2
- 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 +33 -18
- 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/runtime-values.d.ts +6 -18
- package/dist/schema/section-nav.js +0 -15
- package/dist/schema/section-props.d.ts +7 -9
- 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,131 +0,0 @@
|
|
|
1
|
-
//#region ../../internal/fill-vocabulary/dist/facts.js
|
|
2
|
-
/**
|
|
3
|
-
* Canonical top-level ARRAY fields a fill-spec decision may `iterate:` over.
|
|
4
|
-
*
|
|
5
|
-
* `videos` is the hosted-video candidate pool and is iterable — a
|
|
6
|
-
* video_collection section renders N videos, exactly the shape `iterate:`
|
|
7
|
-
* exists for. It is deliberately absent from `FACTS_READABLE`: nothing grounds
|
|
8
|
-
* prose on the pool yet, and `reads: videos` is additive to legalize later.
|
|
9
|
-
*/
|
|
10
|
-
const FACTS_ARRAY_FIELDS = [
|
|
11
|
-
"units",
|
|
12
|
-
"photos",
|
|
13
|
-
"videos",
|
|
14
|
-
"floor_plans",
|
|
15
|
-
"contacts",
|
|
16
|
-
"tours",
|
|
17
|
-
"comparables"
|
|
18
|
-
];
|
|
19
|
-
/** Whether `value` names an iterable property-facts array. */
|
|
20
|
-
function isIterableFactsField(value) {
|
|
21
|
-
return FACTS_ARRAY_FIELDS.includes(value);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The facts keys an author may name in a fill-spec's `reads`, and therefore
|
|
25
|
-
* the keys the fill executor's relevance slice carries on demand. The two are
|
|
26
|
-
* one set on purpose: a key legal to declare but absent from the slice
|
|
27
|
-
* validates and then grounds nothing.
|
|
28
|
-
*
|
|
29
|
-
* `tours` is BOTH readable and iterable — a section may ground prose on it and
|
|
30
|
-
* may `iterate:` it to render one row per 3D tour on the property.
|
|
31
|
-
*
|
|
32
|
-
* `comparables` is both as well: a pricing-strategy narrative grounds its prose
|
|
33
|
-
* on the rows (`reads: ["comparables"]`), and a comps table renders one row per
|
|
34
|
-
* comparable. The numbers on such a slide are never written by fill — they are
|
|
35
|
-
* a `compute()` over the same rows — which is exactly why the rows themselves
|
|
36
|
-
* must be readable.
|
|
37
|
-
*/
|
|
38
|
-
const FACTS_READABLE = [
|
|
39
|
-
"tours",
|
|
40
|
-
"floor_plans",
|
|
41
|
-
"photos",
|
|
42
|
-
"comparables"
|
|
43
|
-
];
|
|
44
|
-
/**
|
|
45
|
-
* Whether `value` names a declarable read. A `reads` entry may be dotted
|
|
46
|
-
* (`"floor_plans.units"`); the slice copies whole top-level keys, so only the
|
|
47
|
-
* base segment is the claim being checked.
|
|
48
|
-
*/
|
|
49
|
-
function isReadableFactsKey(value) {
|
|
50
|
-
const base = value.split(".")[0] ?? value;
|
|
51
|
-
return FACTS_READABLE.includes(base);
|
|
52
|
-
}
|
|
53
|
-
const SCALAR = { kind: "scalar" };
|
|
54
|
-
/** Every named field terminal — the common case, since most fact leaves are strings or numbers. */
|
|
55
|
-
function scalars(...names) {
|
|
56
|
-
return Object.fromEntries(names.map((name) => [name, SCALAR]));
|
|
57
|
-
}
|
|
58
|
-
function object(fields) {
|
|
59
|
-
return {
|
|
60
|
-
kind: "object",
|
|
61
|
-
fields
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function listOf(element) {
|
|
65
|
-
return {
|
|
66
|
-
kind: "array",
|
|
67
|
-
element
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const ADDRESS = object(scalars("display", "street", "street_no_type", "city", "state", "postal", "unit"));
|
|
71
|
-
const NARRATIVE = object(scalars("description"));
|
|
72
|
-
const TOUR = object(scalars("id", "url", "provider"));
|
|
73
|
-
const DOCUMENT_NOTE = object(scalars("upload_id", "notes"));
|
|
74
|
-
const PHOTO = object({
|
|
75
|
-
...scalars("id", "caption"),
|
|
76
|
-
tags: listOf(SCALAR)
|
|
77
|
-
});
|
|
78
|
-
const UNIT = object({
|
|
79
|
-
...scalars("unit_id", "unit_label", "beds", "baths", "sqft", "price", "position"),
|
|
80
|
-
floor_plans: listOf(object(scalars("id", "upload_id", "floor_label", "position")))
|
|
81
|
-
});
|
|
82
|
-
const FLOOR_PLAN = object({
|
|
83
|
-
...scalars("id", "upload_id", "page_index", "processed_s3_key"),
|
|
84
|
-
unit_assignments: listOf(object(scalars("unit_label", "floor_label", "position")))
|
|
85
|
-
});
|
|
86
|
-
const COMPARABLE = object(scalars("id", "address_street", "address_city", "address_state", "address_postal", "address", "lat", "lng", "distance_m", "status", "price", "price_period", "sale_date", "beds", "baths", "sqft", "photo_url", "source_url", "source_name"));
|
|
87
|
-
/**
|
|
88
|
-
* Every root a `${facts.<root>…}` prompt reference may name, and the shape of
|
|
89
|
-
* what sits beneath it.
|
|
90
|
-
*
|
|
91
|
-
* This is the SLICE's key space, not the whole fact graph: the interpolator
|
|
92
|
-
* expands a prompt against the per-section relevance slice, so a root the slice
|
|
93
|
-
* does not carry substitutes the empty string and ships blank grounding with no
|
|
94
|
-
* error anywhere. That is what `assertInterpolationContract` rejects — and it
|
|
95
|
-
* rejects a bad segment BELOW a root on the same argument, which is why these
|
|
96
|
-
* are shapes rather than a flat scalar/structured flag.
|
|
97
|
-
*
|
|
98
|
-
* The `primary_contact_*` roots are VIRTUAL: they are not canonical facts keys
|
|
99
|
-
* (a contact card holds them), and the slice denormalizes them under these
|
|
100
|
-
* historical names so pinned fill-specs keep resolving. Every other root is a
|
|
101
|
-
* real `PropertyFactsSchema` top-level key whose whole shape `facts.test.ts`
|
|
102
|
-
* checks against the canonical schema.
|
|
103
|
-
*/
|
|
104
|
-
const FACTS_INTERPOLABLE_ROOTS = {
|
|
105
|
-
address: ADDRESS,
|
|
106
|
-
narrative: NARRATIVE,
|
|
107
|
-
units: listOf(UNIT),
|
|
108
|
-
photos: listOf(PHOTO),
|
|
109
|
-
document_notes: listOf(DOCUMENT_NOTE),
|
|
110
|
-
tours: listOf(TOUR),
|
|
111
|
-
floor_plans: listOf(FLOOR_PLAN),
|
|
112
|
-
comparables: listOf(COMPARABLE),
|
|
113
|
-
lat: SCALAR,
|
|
114
|
-
lon: SCALAR,
|
|
115
|
-
property_type: SCALAR,
|
|
116
|
-
listing_intent: SCALAR,
|
|
117
|
-
primary_contact_name: SCALAR,
|
|
118
|
-
primary_contact_title: SCALAR,
|
|
119
|
-
primary_contact_bio: SCALAR,
|
|
120
|
-
primary_contact_email: SCALAR,
|
|
121
|
-
primary_contact_phone: SCALAR,
|
|
122
|
-
primary_contact_address: SCALAR,
|
|
123
|
-
primary_contact_website_url: SCALAR,
|
|
124
|
-
primary_contact_instagram_url: SCALAR,
|
|
125
|
-
primary_contact_linkedin_url: SCALAR,
|
|
126
|
-
primary_contact_x_url: SCALAR,
|
|
127
|
-
primary_contact_facebook_url: SCALAR
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
|
-
export { FACTS_ARRAY_FIELDS, FACTS_INTERPOLABLE_ROOTS, FACTS_READABLE, isIterableFactsField, isReadableFactsKey };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region ../../internal/template-contracts/dist/slot-overrides.js
|
|
2
|
-
/**
|
|
3
|
-
* Whether the user owns this slot's whole value — the one read every unbidden
|
|
4
|
-
* rewriter gates on.
|
|
5
|
-
*/
|
|
6
|
-
function isSlotOverridden(overrides, slotId) {
|
|
7
|
-
return overrides?.scalar?.[slotId] === true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { isSlotOverridden };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/schema/fill-spec.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* The shapes a `text-block` decision may ask the model for — the whole
|
|
5
|
-
* `structure` vocabulary, declared once so the meta-schema below and the
|
|
6
|
-
* `textBlock` builder's authoring type are the same fact rather than two.
|
|
7
|
-
*
|
|
8
|
-
* Three are prose. `value` is not: it is a bare figure, name or label with its
|
|
9
|
-
* unit ("$4,250,000", "5.85%", "Built 1978") for a fact-sheet cell, and the
|
|
10
|
-
* executor tells the model to write no sentence around it. Without it every
|
|
11
|
-
* short text slot came back as a sentence, because `single_sentence` was the
|
|
12
|
-
* shortest shape an author could ask for.
|
|
13
|
-
*/
|
|
14
|
-
declare const TEXT_STRUCTURES: readonly ["single_sentence", "paragraph", "bullet_list", "value"];
|
|
15
|
-
/** The prose shape a `text-block` decision asks the model to generate. */
|
|
16
|
-
type TextStructure = (typeof TEXT_STRUCTURES)[number];
|
|
17
|
-
//#endregion
|
|
18
|
-
export { TEXT_STRUCTURES, TextStructure };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Facts } from "../packages/internal/template-contracts/dist/facts-view.js";
|
|
2
|
-
import { SlotRef } from "../section/declare.js";
|
|
3
|
-
//#region src/template/reconcile.d.ts
|
|
4
|
-
/** Replace a slot's value on the section instance the composition placed. */
|
|
5
|
-
interface SetEdit {
|
|
6
|
-
readonly op: "set";
|
|
7
|
-
readonly section: string;
|
|
8
|
-
readonly slot: string;
|
|
9
|
-
readonly value: unknown;
|
|
10
|
-
}
|
|
11
|
-
/** The edits a reconcile rule may return — today exactly one kind, `set`. */
|
|
12
|
-
type Edit = SetEdit;
|
|
13
|
-
/**
|
|
14
|
-
* The erased site shape a STORED rule's fn runs over: one flat namespace keyed by
|
|
15
|
-
* section key, each entry holding that instance's current slot values. A shared
|
|
16
|
-
* instance appears once however many pages render it.
|
|
17
|
-
*/
|
|
18
|
-
type SiteValues = Record<string, Record<string, unknown>>;
|
|
19
|
-
/**
|
|
20
|
-
* The `site` view a rule body receives, typed by the rule's own `reads`: exactly
|
|
21
|
-
* the sections and slots it declared, each value `unknown`. A slot the body reads
|
|
22
|
-
* without declaring is a compile error, which is the contract — an undeclared
|
|
23
|
-
* read is a slot whose edits never re-run the rule.
|
|
24
|
-
*/
|
|
25
|
-
type SiteViewOf<Reads extends readonly SlotRef[]> = { readonly [S in Reads[number]["section"]]: { readonly [K in Extract<Reads[number], {
|
|
26
|
-
readonly section: S;
|
|
27
|
-
}>["slot"]]: unknown; }; };
|
|
28
|
-
/** The arguments a `rule()` body receives. */
|
|
29
|
-
interface ReconcileContext<Reads extends readonly SlotRef[]> {
|
|
30
|
-
readonly site: SiteViewOf<Reads>;
|
|
31
|
-
/** The same derive-time view a `compute()` callback receives. */
|
|
32
|
-
readonly facts: Facts;
|
|
33
|
-
}
|
|
34
|
-
/** The declaration block `rule()` takes between its description and its body. */
|
|
35
|
-
interface ReconcileRuleOptions<Reads extends readonly SlotRef[]> {
|
|
36
|
-
/**
|
|
37
|
-
* Every slot the rule's body reads off `site`. Required, because the editor's
|
|
38
|
-
* propagate trigger matches an edited slot against this set: an undeclared slot
|
|
39
|
-
* means a user edit to it will not re-run the rule. An empty list is legal and
|
|
40
|
-
* meaningful — a rule that reads only `facts`, which no slot edit should trigger.
|
|
41
|
-
*/
|
|
42
|
-
readonly reads: Reads;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* One authored rule: a description (used in failure logs), the slots it reads and
|
|
46
|
-
* its pure function. Stored against the erased `SiteValues` so rules over different
|
|
47
|
-
* read sets share one transport type; `rule()` gives the author the reads-typed
|
|
48
|
-
* view at the call site.
|
|
49
|
-
*/
|
|
50
|
-
interface ReconcileRule {
|
|
51
|
-
readonly description: string;
|
|
52
|
-
readonly reads: readonly SlotRef[];
|
|
53
|
-
readonly fn: (ctx: {
|
|
54
|
-
readonly site: SiteValues;
|
|
55
|
-
readonly facts: Facts;
|
|
56
|
-
}) => readonly Edit[];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Declare a cross-section rule. `site` is typed by `reads`, so a slot the body
|
|
60
|
-
* reads must be declared; an `async` body fails to typecheck — its `Promise`
|
|
61
|
-
* return is not assignable to `readonly Edit[]`.
|
|
62
|
-
*/
|
|
63
|
-
declare function rule<const Reads extends readonly SlotRef[]>(description: string, options: ReconcileRuleOptions<Reads>, fn: (ctx: ReconcileContext<Reads>) => readonly Edit[]): ReconcileRule;
|
|
64
|
-
/** The one edit verb: replace `ref`'s slot on the instance the composition placed for its section. */
|
|
65
|
-
declare function set(ref: SlotRef, value: unknown): SetEdit;
|
|
66
|
-
//#endregion
|
|
67
|
-
export { Edit, ReconcileContext, ReconcileRule, ReconcileRuleOptions, SetEdit, SiteValues, SiteViewOf, rule, set };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/template/reconcile.ts
|
|
2
|
-
/**
|
|
3
|
-
* Declare a cross-section rule. `site` is typed by `reads`, so a slot the body
|
|
4
|
-
* reads must be declared; an `async` body fails to typecheck — its `Promise`
|
|
5
|
-
* return is not assignable to `readonly Edit[]`.
|
|
6
|
-
*/
|
|
7
|
-
function rule(description, options, fn) {
|
|
8
|
-
return {
|
|
9
|
-
description,
|
|
10
|
-
reads: options.reads,
|
|
11
|
-
fn
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
/** The one edit verb: replace `ref`'s slot on the instance the composition placed for its section. */
|
|
15
|
-
function set(ref, value) {
|
|
16
|
-
return {
|
|
17
|
-
op: "set",
|
|
18
|
-
section: ref.section,
|
|
19
|
-
slot: ref.slot,
|
|
20
|
-
value
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { rule, set };
|