@homepages/concrete 5.0.0 → 6.0.1
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 +342 -0
- package/README.md +28 -17
- package/codemods/fill-is-a-source.mjs +533 -0
- package/codemods/manifest.json +16 -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 -16
- 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 +66 -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,4 +1,9 @@
|
|
|
1
1
|
//#region src/primitives/picture-sources.ts
|
|
2
|
+
function resolveSizes(sizes, loading) {
|
|
3
|
+
if (loading === "eager") return sizes;
|
|
4
|
+
if (sizes && /^\s*auto\s*(,|$)/i.test(sizes)) return sizes;
|
|
5
|
+
return `auto, ${sizes ?? "100vw"}`;
|
|
6
|
+
}
|
|
2
7
|
function capSrcset(srcset, maxRungWidth) {
|
|
3
8
|
const entries = srcset.split(",").map((s) => s.trim()).filter(Boolean).map((cand) => {
|
|
4
9
|
const m = cand.match(/(\d+)w\s*$/);
|
|
@@ -49,4 +54,4 @@ function buildPictureSources(args) {
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
//#endregion
|
|
52
|
-
export { buildPictureSources };
|
|
57
|
+
export { buildPictureSources, resolveSizes };
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/primitives/probe-context.ts
|
|
4
|
-
/** The active probe, or `null` in an ordinary render. */
|
|
5
4
|
const ProbeContext = createContext(null);
|
|
6
5
|
const GroupContext = createContext(null);
|
|
7
|
-
/**
|
|
8
|
-
* Called by every value-rendering primitive with the binding it marks. Under the groups
|
|
9
|
-
* probe, a SLOT binding (one carrying `id`) rendered inside a declared group records
|
|
10
|
-
* its membership; a row-field binding (`field`) is not a slot and records nothing.
|
|
11
|
-
*/
|
|
12
6
|
function useSlotProbe(binding) {
|
|
13
7
|
const probe = useContext(ProbeContext);
|
|
14
8
|
const group = useContext(GroupContext);
|
|
15
9
|
if (probe?.kind === "groups" && group !== null && "id" in binding) probe.member(binding.id, group.id);
|
|
16
10
|
}
|
|
17
|
-
/** Called by `SlotGroup` in its declared form: records the card under the groups probe. */
|
|
18
11
|
function useGroupProbe(group) {
|
|
19
12
|
const probe = useContext(ProbeContext);
|
|
20
13
|
if (probe?.kind === "groups" && group !== null) probe.group(group.id, group.label);
|
|
@@ -108,8 +108,6 @@ function normalizeValue(def, value) {
|
|
|
108
108
|
default: return value;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
/** Is this (normalized) video value non-blank? A poster-only value — a pending
|
|
112
|
-
* transcode — is present and still renders. */
|
|
113
111
|
function videoValuePresent(value) {
|
|
114
112
|
return Boolean(value?.url) || Boolean(value?.poster);
|
|
115
113
|
}
|
|
@@ -138,35 +136,6 @@ function itemPresentValue(def, value) {
|
|
|
138
136
|
if (isRecord(slot.fields)) return rowPresent(slot.fields, value);
|
|
139
137
|
return slot.element == null ? value != null : presentValue(slot.element, value);
|
|
140
138
|
}
|
|
141
|
-
/**
|
|
142
|
-
* Bind a section's schema to the values its renderer received.
|
|
143
|
-
*
|
|
144
|
-
* ```tsx
|
|
145
|
-
* import { bindSlots, defineSchema, Section, Slot, text } from "@homepages/concrete";
|
|
146
|
-
* import type { SectionProps } from "@homepages/concrete";
|
|
147
|
-
*
|
|
148
|
-
* const schema = defineSchema({
|
|
149
|
-
* label: "Contact",
|
|
150
|
-
* anchor: "contact",
|
|
151
|
-
* slots: { phone: text.short({ label: "Phone" }) },
|
|
152
|
-
* });
|
|
153
|
-
* type Props = SectionProps<typeof schema>;
|
|
154
|
-
*
|
|
155
|
-
* export default function Contact({ slots }: Props) {
|
|
156
|
-
* const slot = bindSlots(schema, slots);
|
|
157
|
-
* return (
|
|
158
|
-
* <Section>
|
|
159
|
-
* <Slot.Text slot={slot.phone} as="span" />
|
|
160
|
-
* </Section>
|
|
161
|
-
* );
|
|
162
|
-
* }
|
|
163
|
-
* ```
|
|
164
|
-
*
|
|
165
|
-
* The returned map is keyed and typed off `typeof schema`, so a mistyped slot id is a
|
|
166
|
-
* compile error rather than an `undefined` that renders nothing. Call it per render:
|
|
167
|
-
* bindings are fresh objects with no memoised identity, which is harmless because they
|
|
168
|
-
* are only read, never used as a React key or dependency.
|
|
169
|
-
*/
|
|
170
139
|
function bindSlots(schema, slots) {
|
|
171
140
|
const bindings = {};
|
|
172
141
|
for (const [id, def] of Object.entries(schema.slots)) {
|
|
@@ -196,26 +165,11 @@ function bindRowFields(binding, index) {
|
|
|
196
165
|
}
|
|
197
166
|
return fields;
|
|
198
167
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Does this def declare a RECORD item — the one item shape whose members carry
|
|
201
|
-
* field bindings? Read off the declared `fields`: the item, not the type name,
|
|
202
|
-
* is what decides.
|
|
203
|
-
*/
|
|
204
168
|
function isRecordItemDef(def) {
|
|
205
169
|
if (typeof def !== "object" || def == null) return false;
|
|
206
170
|
const { type, fields } = def;
|
|
207
171
|
return type === "list" && isRecord(fields);
|
|
208
172
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Bind a list slot's items for iteration — the one idiom for rendering anything
|
|
211
|
-
* multi-item: `bindItems(slot.units).map((unit) => …)` is an ordinary React
|
|
212
|
-
* array, so clones, splits, and free-form markup are plain JavaScript rather
|
|
213
|
-
* than list-primitive modes.
|
|
214
|
-
*
|
|
215
|
-
* Accepts a top-level list binding or a row field's list binding (a `list`
|
|
216
|
-
* declared inside a record item); a non-list binding is a compile error. An
|
|
217
|
-
* empty or absent value yields `[]`.
|
|
218
|
-
*/
|
|
219
173
|
function bindItems(binding) {
|
|
220
174
|
const values = binding.value ?? [];
|
|
221
175
|
const slotName = "id" in binding ? binding.id : binding.field;
|
|
@@ -4,17 +4,6 @@ import { identityMarkerAttrs } from "./marker-attrs.js";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/primitives/slot-document.tsx
|
|
7
|
-
/**
|
|
8
|
-
* Slot.Document — renders the slot's document as one anchor, with the author's
|
|
9
|
-
* children as its contents. Opens in a new tab by default (`target="_blank"`,
|
|
10
|
-
* `rel="noopener noreferrer"`); both are ordinary props and an author may
|
|
11
|
-
* override either.
|
|
12
|
-
*
|
|
13
|
-
* An unfilled slot renders the same marked element with no `href` — a
|
|
14
|
-
* placeholder that is still selectable in the editor, never a dead link.
|
|
15
|
-
* Never a text leaf: the value is a URL in an attribute, and what the element
|
|
16
|
-
* says is the author's markup.
|
|
17
|
-
*/
|
|
18
7
|
function SlotDocument(props) {
|
|
19
8
|
const { slot, as, children, selectable = true, ...rest } = props;
|
|
20
9
|
useSlotProbe(slot);
|
|
@@ -3,15 +3,6 @@ import { ATTR_SLOT_GROUP, ATTR_SLOT_ITEM, ATTR_SLOT_UNSELECTABLE } from "../pack
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/primitives/slot-group.tsx
|
|
6
|
-
/**
|
|
7
|
-
* Render `as` (a host element or component, `div` by default) carrying the unit's
|
|
8
|
-
* marker: `<SlotGroup id="address" label="Property address">` emits
|
|
9
|
-
* `data-slot-group="address"` and declares the card; `<SlotGroup slot={item}>` over a
|
|
10
|
-
* collection row's `ItemBinding` emits `data-slot-item` — so the editor outlines and
|
|
11
|
-
* edits the container as one sidebar card. Rendering the same unit again (a clone
|
|
12
|
-
* slide, a second layout branch) is just another `SlotGroup` with the same id or
|
|
13
|
-
* binding; every copy is live.
|
|
14
|
-
*/
|
|
15
6
|
function SlotGroup(props) {
|
|
16
7
|
const { id, label, slot, as, selectable = true, children, ...rest } = props;
|
|
17
8
|
const declared = slot === void 0 && id !== void 0 && label !== void 0 ? {
|
|
@@ -25,21 +25,6 @@ function isPosterSlot(def) {
|
|
|
25
25
|
const type = def.type;
|
|
26
26
|
return type === "video" || type === "tour";
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Slot.Image — binds `<Image>` to a slot. The mobile-crop breakpoint comes from the
|
|
30
|
-
* slot's OWN declared `crop.mobile.breakpoint`, so the cut the cropper made is the cut
|
|
31
|
-
* the page serves; everything else — `frame`, `fit`, `className`, `rendition`, the HTML
|
|
32
|
-
* passthrough — is `<Image>`'s own prop, with `<Image>`'s own default. See `./Image.js`
|
|
33
|
-
* for the framed/unframed/empty render contract this wraps.
|
|
34
|
-
*
|
|
35
|
-
* **Over a video or tour slot it renders that asset's poster.** A template that wants a
|
|
36
|
-
* still of the video or 3D tour the user picked binds THAT slot to this primitive — there
|
|
37
|
-
* is no separate poster slot to keep in agreement, and no second primitive to learn. The
|
|
38
|
-
* identity marker names that slot, so a click on the poster opens its card and a new pick
|
|
39
|
-
* repatches this element. A poster that does not exist yet — a transcode still running,
|
|
40
|
-
* or a tour provider that published no thumbnail — renders `<Image>`'s ordinary empty
|
|
41
|
-
* rect. `rendition` has no effect here: a poster carries no per-view crop.
|
|
42
|
-
*/
|
|
43
28
|
function SlotImage(props) {
|
|
44
29
|
const { slot, selectable = true, ...rest } = props;
|
|
45
30
|
useSlotProbe(slot);
|
|
@@ -54,11 +39,6 @@ function SlotImage(props) {
|
|
|
54
39
|
...markerAttrs
|
|
55
40
|
});
|
|
56
41
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Slot.Video — binds `<Video>` to a slot: `playback` comes from the slot's own declared
|
|
59
|
-
* `def`; `frame` and the rest are `<Video>`'s own props with its own defaults. See
|
|
60
|
-
* `./Video.js` for the framed/unframed/poster-only render contract.
|
|
61
|
-
*/
|
|
62
42
|
function SlotVideo(props) {
|
|
63
43
|
const { slot, selectable = true, ...rest } = props;
|
|
64
44
|
useSlotProbe(slot);
|
|
@@ -73,13 +53,6 @@ function SlotVideo(props) {
|
|
|
73
53
|
...markerAttrs
|
|
74
54
|
});
|
|
75
55
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Slot.Tour — binds `<Tour>` to a slot. `frame` and the rest are `<Tour>`'s own props
|
|
78
|
-
* with its own defaults. See `./Tour.js` for the framed/unframed/empty render contract.
|
|
79
|
-
*
|
|
80
|
-
* Bind the SAME slot to `Slot.Image` to render the tour's thumbnail instead — or beside
|
|
81
|
-
* this one, for two positions from one selection.
|
|
82
|
-
*/
|
|
83
56
|
function SlotTour(props) {
|
|
84
57
|
const { slot, selectable = true, ...rest } = props;
|
|
85
58
|
useSlotProbe(slot);
|
|
@@ -4,13 +4,9 @@ import { identityMarkerAttrs } from "./marker-attrs.js";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/primitives/slot-scalar.tsx
|
|
7
|
-
/** `value == null` catches null AND undefined; `""` is the empty-string blank. `0`/`false`
|
|
8
|
-
* are NOT blank (a number slot legitimately holds 0). */
|
|
9
7
|
function isBlank(value) {
|
|
10
8
|
return value == null || value === "";
|
|
11
9
|
}
|
|
12
|
-
/** Split a multiline string into text nodes separated by `<br>`. The editor learns `<br>`
|
|
13
|
-
* (host side), so a multiline value keeps its text leaf and types live. */
|
|
14
10
|
function renderMultiline(text) {
|
|
15
11
|
return text.split("\n").flatMap((line, i) => i === 0 ? [line] : [/* @__PURE__ */ jsx("br", {}, i), line]);
|
|
16
12
|
}
|
package/dist/primitives/slot.js
CHANGED
|
@@ -5,12 +5,6 @@ import { SlotImage, SlotTour, SlotVideo } from "./slot-media.js";
|
|
|
5
5
|
import { SlotNumber, SlotSelect, SlotText, SlotUrl } from "./slot-scalar.js";
|
|
6
6
|
|
|
7
7
|
//#region src/primitives/slot.ts
|
|
8
|
-
/**
|
|
9
|
-
* The slot-authoring namespace: one component per slot kind, each rendering its
|
|
10
|
-
* value and marking it for the editor, plus `Slot.Group` — the unit container of
|
|
11
|
-
* a declared schema group or one collection row. `Slot.Text`, `Slot.List`, and so
|
|
12
|
-
* on are accessed off this one imported name rather than as separate exports.
|
|
13
|
-
*/
|
|
14
8
|
const Slot = {
|
|
15
9
|
Text: SlotText,
|
|
16
10
|
Number: SlotNumber,
|
package/dist/rules/registry.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { SECTION_CONTRACT_CATALOG } from "../packages/internal/section-contracts/dist/catalog.js";
|
|
2
2
|
|
|
3
3
|
//#region src/rules/registry.ts
|
|
4
|
-
/**
|
|
5
|
-
* The stages, in run order. No stage aborts the run: a stage whose input an earlier
|
|
6
|
-
* stage could not produce is reported as skipped, never as passed.
|
|
7
|
-
*/
|
|
8
4
|
const CHECK_STAGES = [
|
|
9
5
|
{
|
|
10
6
|
id: "workspace",
|
|
@@ -22,13 +18,17 @@ const CHECK_STAGES = [
|
|
|
22
18
|
id: "composition",
|
|
23
19
|
summary: "Each page is rendered once under the page probe, and the composition it places parses."
|
|
24
20
|
},
|
|
21
|
+
{
|
|
22
|
+
id: "relations",
|
|
23
|
+
summary: "What one placed section's declarations read off another: the sections are placed, the graph is a DAG, and no fill reads a computed value."
|
|
24
|
+
},
|
|
25
25
|
{
|
|
26
26
|
id: "stylesheet",
|
|
27
27
|
summary: "The CSS import graph of `template.ts` compiles into the template stylesheet exactly as `build` compiles it."
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: "logic",
|
|
31
|
-
summary: "Every placed section's logic bundle
|
|
31
|
+
summary: "Every placed section's logic bundle builds exactly as `build` builds it."
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
id: "fixtures",
|
|
@@ -80,6 +80,18 @@ const AUTHORED_RULES = [
|
|
|
80
80
|
stage: "workspace",
|
|
81
81
|
summary: "Two different exported sections declare the same key."
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
id: "workspace/crlf-text",
|
|
85
|
+
venue: "tree",
|
|
86
|
+
stage: "workspace",
|
|
87
|
+
summary: "A text file in the workspace has CRLF line endings, so the same commit would build a different version than an LF checkout."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "workspace/unportable-name",
|
|
91
|
+
venue: "tree",
|
|
92
|
+
stage: "workspace",
|
|
93
|
+
summary: "A source file name, the template key, a section key or a fixture id would not name the same file on Windows and macOS: two differ only by case or Unicode form, or one is a reserved device name (`con`, `nul`, `com1`…), ends in a dot or a space, or carries a character Windows refuses in a file name (`:`, `\\`, `?`, `*`, a control character…). A key or id must also be NFC."
|
|
94
|
+
},
|
|
83
95
|
{
|
|
84
96
|
id: "typecheck/error",
|
|
85
97
|
venue: "tree",
|
|
@@ -249,7 +261,31 @@ const AUTHORED_RULES = [
|
|
|
249
261
|
id: "pages/composition-invalid",
|
|
250
262
|
venue: "probe",
|
|
251
263
|
stage: "composition",
|
|
252
|
-
summary: "The composition the pages place breaks a page, canvas
|
|
264
|
+
summary: "The composition the pages place breaks a page, canvas or instance rule."
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "relations/section-cycle",
|
|
268
|
+
venue: "probe",
|
|
269
|
+
stage: "relations",
|
|
270
|
+
summary: "The placed sections read each other in a loop; a template's sections form a DAG."
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: "relations/unplaced-read",
|
|
274
|
+
venue: "probe",
|
|
275
|
+
stage: "relations",
|
|
276
|
+
summary: "A declaration reads a section no page places, so the read resolves to no instance."
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: "relations/fill-reads-computed",
|
|
280
|
+
venue: "probe",
|
|
281
|
+
stage: "relations",
|
|
282
|
+
summary: "A fill decision reads a sourced slot (a fact, a `compute()` or a mirror), which settles only after every fill has run."
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "relations/mirror-type",
|
|
286
|
+
venue: "probe",
|
|
287
|
+
stage: "relations",
|
|
288
|
+
summary: "A slot mirroring another slot holds a different kind of value than its upstream."
|
|
253
289
|
},
|
|
254
290
|
{
|
|
255
291
|
id: "fixtures/none",
|
|
@@ -425,18 +461,6 @@ const AUTHORED_RULES = [
|
|
|
425
461
|
stage: "logic",
|
|
426
462
|
summary: "A placed section's logic bundle fails to build, as when React reaches it through a compute closure."
|
|
427
463
|
},
|
|
428
|
-
{
|
|
429
|
-
id: "logic/template-build-failed",
|
|
430
|
-
venue: "tree",
|
|
431
|
-
stage: "logic",
|
|
432
|
-
summary: "The template's logic bundle fails to build or to evaluate."
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
id: "logic/reconcile-not-exported",
|
|
436
|
-
venue: "tree",
|
|
437
|
-
stage: "logic",
|
|
438
|
-
summary: "`defineTemplate` is handed reconcile rules `template.ts` does not export as `reconcile`, so the logic bundle drops them."
|
|
439
|
-
},
|
|
440
464
|
{
|
|
441
465
|
id: "css/tailwind-import",
|
|
442
466
|
venue: "tree",
|
|
@@ -462,7 +486,6 @@ const AUTHORED_RULES = [
|
|
|
462
486
|
summary: "A stylesheet declares `@layer sections` or `@layer template`, the layers the framework retired; author CSS is unlayered."
|
|
463
487
|
}
|
|
464
488
|
];
|
|
465
|
-
/** The id a contract assertion is reported under. */
|
|
466
489
|
function contractRuleId(id) {
|
|
467
490
|
return `contract/${id}`;
|
|
468
491
|
}
|
|
@@ -472,24 +495,19 @@ const CONTRACT_RULES = SECTION_CONTRACT_CATALOG.map((doc) => ({
|
|
|
472
495
|
stage: "contracts",
|
|
473
496
|
summary: doc.summary
|
|
474
497
|
}));
|
|
475
|
-
/** The full rule catalog, stages in run order. Renaming an id is a breaking change. */
|
|
476
498
|
const CONCRETE_RULES = [...AUTHORED_RULES, ...CONTRACT_RULES];
|
|
477
499
|
const BY_ID = new Map(CONCRETE_RULES.map((rule) => [rule.id, rule]));
|
|
478
|
-
/** Is `id` a registered rule? */
|
|
479
500
|
function isConcreteRuleId(id) {
|
|
480
501
|
return BY_ID.has(id);
|
|
481
502
|
}
|
|
482
|
-
/** The registered rule with this id. Throws for an unregistered one: a rule absent from the registry cannot run. */
|
|
483
503
|
function ruleById(id) {
|
|
484
504
|
const rule = BY_ID.get(id);
|
|
485
505
|
if (rule === void 0) throw new Error(`"${id}" is not a registered Concrete rule.`);
|
|
486
506
|
return rule;
|
|
487
507
|
}
|
|
488
|
-
/** The registered ESLint rule an engine id reports under, or `undefined`. */
|
|
489
508
|
function eslintRuleByEngineId(engineId) {
|
|
490
509
|
return CONCRETE_RULES.find((rule) => rule.venue === "eslint" && rule.engineId === engineId);
|
|
491
510
|
}
|
|
492
|
-
/** The id as a violation reports it: `concrete/<id>`. */
|
|
493
511
|
function qualify(id) {
|
|
494
512
|
return `concrete/${id}`;
|
|
495
513
|
}
|
package/dist/schema/compute.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComputeRead, RefValues } from "./slot-ref.js";
|
|
2
2
|
//#region src/schema/compute.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Collapses to `never` for any `Promise`-returning `T`, so a `compute()`
|
|
@@ -6,17 +6,55 @@ import { Facts } from "../packages/internal/template-contracts/dist/facts-view.j
|
|
|
6
6
|
* the call site instead of silently running async at derive time.
|
|
7
7
|
*/
|
|
8
8
|
type NoPromise<T> = T extends Promise<unknown> ? never : T;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The stored handle, as every runner calls it: one value per ref in its `reads`, in
|
|
11
|
+
* order — none for a constant. One transport type across every read set, so no runner
|
|
12
|
+
* needs a cast of its own.
|
|
13
|
+
*/
|
|
14
|
+
type ComputeFn<T = unknown> = (...values: readonly unknown[]) => T;
|
|
15
|
+
/**
|
|
16
|
+
* The authoring marker `compute()` produces — read back by `getComputed`.
|
|
17
|
+
*
|
|
18
|
+
* `reads` is what every consumer reads: `defineSchema` serializes it onto the slot,
|
|
19
|
+
* the fixture resolver runs the handle positionally from it, and
|
|
20
|
+
* `usedFactsFromSchema` takes its fact keys. A constant's list is empty.
|
|
21
|
+
*/
|
|
10
22
|
interface ComputeBinding<T> {
|
|
11
23
|
readonly kind: "compute";
|
|
12
|
-
readonly fn:
|
|
24
|
+
readonly fn: ComputeFn<T>;
|
|
25
|
+
/** The refs this binding declared, a sibling slot's own const among them. */
|
|
26
|
+
readonly reads: readonly ComputeRead[];
|
|
13
27
|
}
|
|
14
28
|
/**
|
|
15
|
-
* Marks a slot's value as derived
|
|
16
|
-
*
|
|
29
|
+
* Marks a slot's value as derived at render time rather than bound to a source
|
|
30
|
+
* field. `fn` must be synchronous — see `NoPromise`.
|
|
31
|
+
*
|
|
32
|
+
* `compute({ reads }, fn)` hands the callback one argument per ref, in `reads`
|
|
33
|
+
* order: a fact ref's own value, a slot ref's value `| undefined` (the upstream
|
|
34
|
+
* section may be unplaced, disabled, or empty). A slot of the SAME section is read
|
|
35
|
+
* through its own const — `reads: [headline]` — since `Section.slots.*` does not
|
|
36
|
+
* exist until the section is declared. `compute(() => X)` reads nothing: a constant,
|
|
37
|
+
* called with no arguments.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { compute, fact, text } from "@homepages/concrete";
|
|
42
|
+
* import { Hero } from "../hero/section";
|
|
43
|
+
*
|
|
44
|
+
* text.short({
|
|
45
|
+
* label: "Property name",
|
|
46
|
+
* source: compute(
|
|
47
|
+
* { reads: [fact.property.address, Hero.slots.property_name] },
|
|
48
|
+
* (address, heroName) => heroName ?? address.street ?? "",
|
|
49
|
+
* ),
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
17
52
|
*/
|
|
18
|
-
declare function compute<T>(fn: (
|
|
53
|
+
declare function compute<T>(fn: () => NoPromise<T>): ComputeBinding<T>;
|
|
54
|
+
declare function compute<T, const Reads extends readonly ComputeRead[]>(options: {
|
|
55
|
+
readonly reads: Reads;
|
|
56
|
+
}, fn: (...values: RefValues<Reads>) => NoPromise<T>): ComputeBinding<T>;
|
|
19
57
|
/** Reads a schema's `COMPUTED` handle→fn map, or `{}` when none is attached. */
|
|
20
|
-
declare function getComputed(schema: unknown): Record<string,
|
|
58
|
+
declare function getComputed(schema: unknown): Record<string, ComputeFn>;
|
|
21
59
|
//#endregion
|
|
22
|
-
export { ComputeBinding, NoPromise, compute, getComputed };
|
|
60
|
+
export { ComputeBinding, ComputeFn, NoPromise, compute, getComputed };
|
package/dist/schema/compute.js
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
//#region src/schema/compute.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
function compute(a, b) {
|
|
3
|
+
if (typeof a === "function") return {
|
|
4
|
+
kind: "compute",
|
|
5
|
+
fn: a,
|
|
6
|
+
reads: []
|
|
7
|
+
};
|
|
7
8
|
return {
|
|
8
9
|
kind: "compute",
|
|
9
|
-
fn
|
|
10
|
+
fn: b,
|
|
11
|
+
reads: [...a.reads]
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
|
-
|
|
14
|
+
const MIRROR_MARK = Symbol.for("@homepages/concrete:mirror");
|
|
15
|
+
const MIRROR = Object.defineProperty((value) => value, MIRROR_MARK, { value: true });
|
|
16
|
+
function mirror(upstream) {
|
|
17
|
+
return {
|
|
18
|
+
kind: "compute",
|
|
19
|
+
fn: MIRROR,
|
|
20
|
+
reads: [upstream]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function isMirrorFn(fn) {
|
|
24
|
+
return typeof fn === "function" && fn[MIRROR_MARK] === true;
|
|
25
|
+
}
|
|
13
26
|
function isComputeBinding(x) {
|
|
14
27
|
return typeof x === "object" && x !== null && "kind" in x && x.kind === "compute" && "fn" in x && typeof x.fn === "function";
|
|
15
28
|
}
|
|
16
|
-
/**
|
|
17
|
-
* The non-enumerable key `defineSchema` attaches a schema's handle→fn map
|
|
18
|
-
* under. A symbol key so the map rides on the schema object invisibly to
|
|
19
|
-
* `JSON.stringify`/`Object.keys`/Zod — the whole point of the seam is that a
|
|
20
|
-
* `compute()` fn never has to survive serialization to `SectionSchema.parse`.
|
|
21
|
-
*/
|
|
22
29
|
const COMPUTED = Symbol("compute:handles");
|
|
23
|
-
/** Reads a schema's `COMPUTED` handle→fn map, or `{}` when none is attached. */
|
|
24
30
|
function getComputed(schema) {
|
|
25
31
|
if (typeof schema !== "object" || schema === null) return {};
|
|
26
32
|
return schema[COMPUTED] ?? {};
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
//#endregion
|
|
30
|
-
export { COMPUTED, compute, getComputed, isComputeBinding };
|
|
36
|
+
export { COMPUTED, compute, getComputed, isComputeBinding, isMirrorFn, mirror };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Slot } from "./slot-types.js";
|
|
1
2
|
import { GroupDefOf, GroupIdsOfLayout, SectionLayoutEntry } from "./layout.js";
|
|
2
3
|
import { DisplayEntryInput } from "./slot-builders.js";
|
|
3
|
-
import { Slot } from "./slot-types.js";
|
|
4
4
|
//#region src/schema/define-schema.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* The authored `display:` block: section `visibility` and `variant`, each an
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { COMPUTED, isComputeBinding } from "./compute.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isFillBinding } from "./fill-builders.js";
|
|
3
|
+
import { fillMark } from "./fill-declaration.js";
|
|
3
4
|
import { groupsFromLayout } from "./layout.js";
|
|
5
|
+
import { isSiblingSlot, serializeRef } from "./slot-ref.js";
|
|
4
6
|
|
|
5
7
|
//#region src/schema/define-schema.ts
|
|
8
|
+
function derivedSource(transform, reads) {
|
|
9
|
+
if (reads === void 0 || reads.length === 0) return {
|
|
10
|
+
kind: "derived",
|
|
11
|
+
transform
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
kind: "derived",
|
|
15
|
+
transform,
|
|
16
|
+
reads: reads.map(serializeRef)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function siblingResolver(sectionKey, slots) {
|
|
20
|
+
const keyOf = new Map(Object.entries(slots).map(([key, slot]) => [slot, key]));
|
|
21
|
+
return (at, reads) => reads?.map((read) => {
|
|
22
|
+
if (!isSiblingSlot(read)) return read;
|
|
23
|
+
const slot = keyOf.get(read);
|
|
24
|
+
if (slot === void 0) throw new Error(`\`${at}\` reads the slot "${read.label}", which is not a slot of this section. Read another section's slot through its ref (\`Section.slots.<key>\`), and a sibling through the const the section's \`slots\` record holds.`);
|
|
25
|
+
if (sectionKey === void 0) throw new Error(`\`${at}\` reads its sibling slot "${slot}", which needs the section's key — declare it with \`section()\`.`);
|
|
26
|
+
return {
|
|
27
|
+
section: sectionKey,
|
|
28
|
+
slot
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
6
32
|
function emitDisplay(display, computed) {
|
|
7
33
|
const out = {};
|
|
8
34
|
for (const key of ["visibility", "variant"]) {
|
|
@@ -11,23 +37,19 @@ function emitDisplay(display, computed) {
|
|
|
11
37
|
const emitted = { cases: [...entry.cases] };
|
|
12
38
|
if (entry.locked === true) emitted.locked = true;
|
|
13
39
|
if (isComputeBinding(entry.source)) {
|
|
40
|
+
const sibling = entry.source.reads?.find(isSiblingSlot);
|
|
41
|
+
if (sibling !== void 0) throw new Error(`\`display.${key}\` reads the section's own slot "${sibling.label}". A display entry settles which of the section's slots exist, so it may read facts and other sections only.`);
|
|
14
42
|
computed[`display.${key}`] = entry.source.fn;
|
|
15
|
-
emitted.source = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
if (entry.
|
|
43
|
+
emitted.source = derivedSource(`display.${key}`, entry.source.reads);
|
|
44
|
+
} else if (isFillBinding(entry.source)) emitted.fill = {
|
|
45
|
+
pick: entry.source.brief,
|
|
46
|
+
...fillMark(entry.source)
|
|
47
|
+
};
|
|
48
|
+
else if (entry.source !== void 0) emitted.source = entry.source;
|
|
21
49
|
out[key] = emitted;
|
|
22
50
|
}
|
|
23
51
|
return out;
|
|
24
52
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Declare a section's schema from `label` + per-kind slot builders. Returns the
|
|
27
|
-
* authored `{ meta, slots }` shape CI serializes, with `SectionProps<typeof
|
|
28
|
-
* schema>` byte-identical to the hand-written `as const` form.
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
53
|
function defineSchema(input) {
|
|
32
54
|
const computed = {};
|
|
33
55
|
const meta = {
|
|
@@ -37,16 +59,14 @@ function defineSchema(input) {
|
|
|
37
59
|
...input.layout !== void 0 ? { groups: groupsFromLayout(input.layout) } : {}
|
|
38
60
|
};
|
|
39
61
|
const slots = {};
|
|
62
|
+
const resolveReads = siblingResolver(input.key, input.slots);
|
|
40
63
|
for (const [key, slot] of Object.entries(input.slots)) {
|
|
41
64
|
let emitted = slot;
|
|
42
65
|
if (isComputeBinding(slot.source)) {
|
|
43
66
|
computed[key] = slot.source.fn;
|
|
44
67
|
emitted = {
|
|
45
68
|
...emitted,
|
|
46
|
-
source:
|
|
47
|
-
kind: "derived",
|
|
48
|
-
transform: key
|
|
49
|
-
}
|
|
69
|
+
source: derivedSource(key, resolveReads(key, slot.source.reads))
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
72
|
const when = slot.when;
|