@homepages/concrete 1.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 +59 -0
- package/README.md +174 -0
- package/codemods/manifest.json +9 -0
- package/dist/artifact/playground/client/assets/index-BSA1yutg.css +1 -0
- package/dist/artifact/playground/client/assets/index-JloQyj8h.js +1101 -0
- package/dist/artifact/playground/client/index.html +13 -0
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -0
- package/dist/artifact/playground/host.mjs +127 -0
- package/dist/asset-modules.d.ts +99 -0
- package/dist/base.css +220 -0
- package/dist/browser/site-config.d.ts +18 -0
- package/dist/browser/site-config.js +56 -0
- package/dist/browser/submit-lead.d.ts +98 -0
- package/dist/browser/submit-lead.js +188 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +4 -0
- package/dist/cli/build/artifact.js +225 -0
- package/dist/cli/build/captures.js +67 -0
- package/dist/cli/build/esbuild.js +127 -0
- package/dist/cli/build/fixtures.js +96 -0
- package/dist/cli/build/icons.js +76 -0
- package/dist/cli/build/index.js +38 -0
- package/dist/cli/build/playground.js +31 -0
- package/dist/cli/build/sections.js +236 -0
- package/dist/cli/build/source.js +62 -0
- package/dist/cli/build/static.js +156 -0
- package/dist/cli/capture/bundle.js +37 -0
- package/dist/cli/capture/capture-browser.js +51 -0
- package/dist/cli/capture/capture.js +121 -0
- package/dist/cli/check/analyze.js +95 -0
- package/dist/cli/check/index.js +19 -0
- package/dist/cli/check/load-workspace.js +119 -0
- package/dist/cli/check/messages.js +16 -0
- package/dist/cli/check/render/class-conflicts.js +39 -0
- package/dist/cli/check/render/html.js +86 -0
- package/dist/cli/check/render/inputs.js +53 -0
- package/dist/cli/check/render/invariants.js +58 -0
- package/dist/cli/check/render/island-frames.js +72 -0
- package/dist/cli/check/render/marker-coverage.js +102 -0
- package/dist/cli/check/render/nav.js +64 -0
- package/dist/cli/check/report.js +73 -0
- package/dist/cli/check/stages/bundles.js +129 -0
- package/dist/cli/check/stages/composition.js +67 -0
- package/dist/cli/check/stages/contracts.js +22 -0
- package/dist/cli/check/stages/dependencies.js +261 -0
- package/dist/cli/check/stages/fixtures.js +74 -0
- package/dist/cli/check/stages/lint.js +41 -0
- package/dist/cli/check/stages/logic.js +63 -0
- package/dist/cli/check/stages/render.js +144 -0
- package/dist/cli/check/stages/sections.js +83 -0
- package/dist/cli/check/stages/stylesheet.js +31 -0
- package/dist/cli/check/stages/typecheck.js +68 -0
- package/dist/cli/check/stages/workspace.js +26 -0
- package/dist/cli/commands.js +342 -0
- package/dist/cli/currency/cache.js +89 -0
- package/dist/cli/currency/decide.js +65 -0
- package/dist/cli/currency/opt-out.js +16 -0
- package/dist/cli/currency/preamble.js +183 -0
- package/dist/cli/currency/prompt.js +28 -0
- package/dist/cli/currency/refresh.js +44 -0
- package/dist/cli/currency/resolve-latest.js +185 -0
- package/dist/cli/currency/version-order.js +38 -0
- package/dist/cli/dev/crop.js +22 -0
- package/dist/cli/dev/hmr.js +26 -0
- package/dist/cli/dev/http.js +129 -0
- package/dist/cli/dev/index.js +70 -0
- package/dist/cli/dev/islands.js +390 -0
- package/dist/cli/dev/load-template.js +46 -0
- package/dist/cli/dev/request-error.js +22 -0
- package/dist/cli/dev/server.js +307 -0
- package/dist/cli/dev/tsconfig-paths.js +95 -0
- package/dist/cli/dev/vite.js +85 -0
- package/dist/cli/dev/workspace-reader.js +274 -0
- package/dist/cli/io.d.ts +14 -0
- package/dist/cli/media/cache.js +125 -0
- package/dist/cli/media/derive.js +252 -0
- package/dist/cli/media/deriver-plugin.js +71 -0
- package/dist/cli/property/index.js +180 -0
- package/dist/cli/property/library.js +137 -0
- package/dist/cli/publish/client.js +119 -0
- package/dist/cli/publish/freshness.js +66 -0
- package/dist/cli/publish/git.js +43 -0
- package/dist/cli/publish/index.js +207 -0
- package/dist/cli/publish/pack.js +78 -0
- package/dist/cli/publish/report.js +98 -0
- package/dist/cli/publish/target.js +87 -0
- package/dist/cli/publish/wire.js +29 -0
- package/dist/cli/tar.js +87 -0
- package/dist/cli/upgrade/codemod.js +56 -0
- package/dist/cli/upgrade/index.js +263 -0
- package/dist/cli/upgrade/manifest.js +72 -0
- package/dist/cli/upgrade/plan.js +68 -0
- package/dist/cli/upgrade/stage.js +71 -0
- package/dist/cli/version.d.ts +12 -0
- package/dist/cli/version.js +15 -0
- package/dist/cli/workspace.js +108 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +94 -0
- package/dist/css/compile.js +77 -0
- package/dist/css/graph.js +109 -0
- package/dist/css/inline.js +132 -0
- package/dist/css/rules.js +65 -0
- package/dist/design-system/format-variants.js +127 -0
- package/dist/eslint/authoring.js +46 -0
- package/dist/eslint/correctness.js +42 -0
- package/dist/eslint/rules/editor-declaration.js +103 -0
- package/dist/eslint/rules/editor-reason.js +135 -0
- package/dist/eslint/rules/island-imports.js +20 -0
- package/dist/eslint/rules/jsx-visitor.js +20 -0
- package/dist/eslint/rules/no-client-runtime.js +88 -0
- package/dist/eslint/rules/no-editor-globals.js +60 -0
- package/dist/eslint/rules/no-hard-coded-color.js +183 -0
- package/dist/eslint/rules/no-inline-style.js +24 -0
- package/dist/eslint/rules/no-marker-literal.js +37 -0
- package/dist/eslint/rules/no-nondeterminism.js +44 -0
- package/dist/eslint/rules/no-px-breakpoint.js +44 -0
- package/dist/eslint/rules/no-raw-values.js +45 -0
- package/dist/eslint/rules/serializable-props.js +95 -0
- package/dist/eslint.d.ts +6 -0
- package/dist/eslint.js +26 -0
- package/dist/fixtures/brand.d.ts +4 -0
- package/dist/fixtures/brand.js +9 -0
- package/dist/fixtures/bundle-rule.js +67 -0
- package/dist/fixtures/canonical.d.ts +149 -0
- package/dist/fixtures/image-dimensions.js +59 -0
- package/dist/fixtures/load.js +154 -0
- package/dist/fixtures/media-plugin.js +141 -0
- package/dist/fixtures/media.js +165 -0
- package/dist/fixtures/property.js +210 -0
- package/dist/fixtures/resolve.js +202 -0
- package/dist/fixtures/rows.js +108 -0
- package/dist/fixtures/synthesize-empties.js +42 -0
- package/dist/fixtures.d.ts +213 -0
- package/dist/fixtures.js +37 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +37 -0
- package/dist/islands/client-module.js +97 -0
- package/dist/islands/marker.d.ts +43 -0
- package/dist/islands/marker.js +44 -0
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +687 -0
- package/dist/packages/external/concrete/package.js +5 -0
- package/dist/packages/internal/fact-interpolation/dist/index.js +22 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +111 -0
- package/dist/packages/internal/fill-bake/dist/display.js +9 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -0
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +170 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +32 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +131 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +73 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +404 -0
- package/dist/packages/internal/format-geometry/dist/format.d.ts +41 -0
- package/dist/packages/internal/format-geometry/dist/geometry.js +58 -0
- package/dist/packages/internal/format-geometry/dist/index.js +4 -0
- package/dist/packages/internal/image-descriptor/dist/index.d.ts +35 -0
- package/dist/packages/internal/image-ladder/dist/crop.js +82 -0
- package/dist/packages/internal/image-ladder/dist/encode.js +23 -0
- package/dist/packages/internal/image-ladder/dist/index.js +4 -0
- package/dist/packages/internal/image-ladder/dist/policy.js +102 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.d.ts +13 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +45 -0
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +176 -0
- package/dist/packages/internal/island-runtime/dist/contract.js +94 -0
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +15 -0
- package/dist/packages/internal/island-runtime/dist/index.d.ts +103 -0
- package/dist/packages/internal/island-runtime/dist/index.js +163 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +19 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +39 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.d.ts +22 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.js +54 -0
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +105 -0
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +25 -0
- package/dist/packages/internal/property-facts/dist/index.js +3 -0
- package/dist/packages/internal/property-facts/dist/property-facts-CSdkSuD7.js +181 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +59 -0
- package/dist/packages/internal/section-contracts/dist/catalog.js +102 -0
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/display-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +17 -0
- package/dist/packages/internal/section-contracts/dist/group-contract.js +21 -0
- package/dist/packages/internal/section-contracts/dist/index.js +26 -0
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +53 -0
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +70 -0
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +27 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +12 -0
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +22 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +18 -0
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/row-contract.js +37 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +38 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +181 -0
- package/dist/packages/internal/section-contracts/dist/select-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/source-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +15 -0
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/url-contract.js +20 -0
- package/dist/packages/internal/source-resolution/dist/index.js +222 -0
- package/dist/packages/internal/template-artifact/dist/hash.js +50 -0
- package/dist/packages/internal/template-artifact/dist/index.js +7 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +165 -0
- package/dist/packages/internal/template-artifact/dist/manifest.js +73 -0
- package/dist/packages/internal/template-artifact/dist/sha256.js +138 -0
- package/dist/packages/internal/template-artifact/dist/verify.js +275 -0
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +38 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.d.ts +10 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.js +17 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +33 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +81 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.js +136 -0
- package/dist/packages/internal/template-contracts/dist/layout.js +17 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +40 -0
- package/dist/packages/internal/template-contracts/dist/markers.js +41 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +63 -0
- package/dist/packages/internal/template-contracts/dist/select-key.js +13 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1112 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +1109 -0
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +11 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +45 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +63 -0
- package/dist/playground/host/page-state.js +12 -0
- package/dist/playground/host/paths.js +9 -0
- package/dist/playground/layout.js +24 -0
- package/dist/playground/wire.js +36 -0
- package/dist/playground-island-runtime.d.ts +3 -0
- package/dist/playground-island-runtime.js +4 -0
- package/dist/primitives/FrameShell.d.ts +29 -0
- package/dist/primitives/FrameShell.js +34 -0
- package/dist/primitives/Image.d.ts +119 -0
- package/dist/primitives/Image.js +173 -0
- package/dist/primitives/Section.d.ts +22 -0
- package/dist/primitives/Section.js +26 -0
- package/dist/primitives/Tour.d.ts +43 -0
- package/dist/primitives/Tour.js +72 -0
- package/dist/primitives/Video.d.ts +57 -0
- package/dist/primitives/Video.js +116 -0
- package/dist/primitives/embed-playback.js +50 -0
- package/dist/primitives/index.d.ts +11 -0
- package/dist/primitives/marker-attrs.js +44 -0
- package/dist/primitives/object-fit.js +11 -0
- package/dist/primitives/picture-sources.d.ts +24 -0
- package/dist/primitives/picture-sources.js +52 -0
- package/dist/primitives/probe-context.js +24 -0
- package/dist/primitives/slot-bindings.d.ts +96 -0
- package/dist/primitives/slot-bindings.js +226 -0
- package/dist/primitives/slot-document.d.ts +35 -0
- package/dist/primitives/slot-document.js +37 -0
- package/dist/primitives/slot-group.d.ts +40 -0
- package/dist/primitives/slot-group.js +45 -0
- package/dist/primitives/slot-list.d.ts +21 -0
- package/dist/primitives/slot-list.js +23 -0
- package/dist/primitives/slot-media.d.ts +71 -0
- package/dist/primitives/slot-media.js +98 -0
- package/dist/primitives/slot-scalar.d.ts +53 -0
- package/dist/primitives/slot-scalar.js +98 -0
- package/dist/primitives/slot.d.ts +26 -0
- package/dist/primitives/slot.js +28 -0
- package/dist/rules/registry.js +479 -0
- package/dist/schema/compute.d.ts +22 -0
- package/dist/schema/compute.js +30 -0
- package/dist/schema/define-schema.d.ts +27 -0
- package/dist/schema/define-schema.js +73 -0
- package/dist/schema/extract-fill-spec.js +246 -0
- package/dist/schema/extract-used-facts.js +176 -0
- package/dist/schema/fact.d.ts +65 -0
- package/dist/schema/fact.js +33 -0
- package/dist/schema/fill-builders.d.ts +387 -0
- package/dist/schema/fill-builders.js +263 -0
- package/dist/schema/fill-declaration.d.ts +76 -0
- package/dist/schema/fill-declaration.js +43 -0
- package/dist/schema/fill-spec.d.ts +18 -0
- package/dist/schema/fill-spec.js +170 -0
- package/dist/schema/format-presets.d.ts +27 -0
- package/dist/schema/format-presets.js +76 -0
- package/dist/schema/format.d.ts +22 -0
- package/dist/schema/format.js +40 -0
- package/dist/schema/formats.d.ts +6 -0
- package/dist/schema/formats.js +7 -0
- package/dist/schema/layout.d.ts +32 -0
- package/dist/schema/layout.js +30 -0
- package/dist/schema/manifest.js +300 -0
- package/dist/schema/property-facts.d.ts +83 -0
- package/dist/schema/runtime-values.d.ts +88 -0
- package/dist/schema/section-nav.d.ts +38 -0
- package/dist/schema/section-nav.js +29 -0
- package/dist/schema/section-props.d.ts +98 -0
- package/dist/schema/section-schema.d.ts +53 -0
- package/dist/schema/section-schema.js +54 -0
- package/dist/schema/slot-builders.d.ts +497 -0
- package/dist/schema/slot-builders.js +331 -0
- package/dist/schema/slot-types.d.ts +110 -0
- package/dist/schema/slot-types.js +187 -0
- package/dist/section/declare.d.ts +44 -0
- package/dist/section/declare.js +27 -0
- package/dist/section/discovery.js +76 -0
- package/dist/section/groups.js +74 -0
- package/dist/section/materialize.js +28 -0
- package/dist/section/placements.js +28 -0
- package/dist/section/section.d.ts +69 -0
- package/dist/section/section.js +101 -0
- package/dist/site-analytics.d.ts +1 -0
- package/dist/site-analytics.js +15 -0
- package/dist/site-runtime/analytics.js +97 -0
- package/dist/site-runtime/site-integrations.js +97 -0
- package/dist/styles.css +60 -0
- package/dist/template/define-template.d.ts +139 -0
- package/dist/template/define-template.js +98 -0
- package/dist/template/logic-build.js +191 -0
- package/dist/template/logic-shim.d.ts +43 -0
- package/dist/template/logic-shim.js +52 -0
- package/dist/template/logic-transform.js +92 -0
- package/dist/template/materialize.js +107 -0
- package/dist/template/reconcile.d.ts +67 -0
- package/dist/template/reconcile.js +25 -0
- package/dist/template/running-copy.js +58 -0
- package/guide/reference/cli/INDEX.md +79 -0
- package/guide/reference/cli/build.md +48 -0
- package/guide/reference/cli/check.md +49 -0
- package/guide/reference/cli/dev.md +46 -0
- package/guide/reference/cli/property-add.md +53 -0
- package/guide/reference/cli/property-list.md +46 -0
- package/guide/reference/cli/publish.md +54 -0
- package/guide/reference/cli/upgrade.md +48 -0
- package/guide/reference/rules/INDEX.md +190 -0
- package/package.json +137 -0
- package/tsconfig.base.json +16 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ReadableFactsKey } from "../packages/internal/fill-vocabulary/dist/facts.js";
|
|
2
|
+
import { ComputeBinding } from "./compute.js";
|
|
3
|
+
import { BuiltDecision, ChosenRows, DecisionKind, NamedRows } from "./fill-builders.js";
|
|
4
|
+
import { SlotSource } from "./slot-builders.js";
|
|
5
|
+
//#region src/schema/fill-declaration.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The key a slot builder attaches its `fill:` declaration under. Symbol-keyed so
|
|
8
|
+
* the declaration never reaches the serialized schema — read it back through
|
|
9
|
+
* `fillSpecFromSchema` rather than off the slot.
|
|
10
|
+
*/
|
|
11
|
+
declare const FILL: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* One entry of a fill spec's `reads`: a readable facts key, or a dotted path
|
|
14
|
+
* beneath one. The relevance slice copies whole top-level keys, so the base
|
|
15
|
+
* segment is the entire claim — the remainder documents which part of the fact
|
|
16
|
+
* the prompts use.
|
|
17
|
+
*/
|
|
18
|
+
type DeclarableRead = ReadableFactsKey | `${ReadableFactsKey}.${string}`;
|
|
19
|
+
/**
|
|
20
|
+
* The `[FILL]` member a slot builder's return type carries: the decision kind
|
|
21
|
+
* that slot may be filled with, present exactly when the author declared one.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately keyed on the KIND rather than on the exact decision the author
|
|
24
|
+
* passed. Carrying the precise type would mean a builder type parameter
|
|
25
|
+
* inferred from `fill:`, and every slot inside `defineSchema` is contextually
|
|
26
|
+
* typed by `Slot` — which fixes such a parameter before the argument is looked
|
|
27
|
+
* at, rejecting the declaration the call just took.
|
|
28
|
+
*/
|
|
29
|
+
type FillMark<D> = {
|
|
30
|
+
[FILL]?: D;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The `fill:` key a builder's options admit, decided by whether the slot is
|
|
34
|
+
* source-bound. A slot declares EXACTLY ONE of `source:` / `fill:` — a value
|
|
35
|
+
* baked from a fact is not also generated — so a source binding collapses this
|
|
36
|
+
* to `fill?: never`. `Legal` is the decision type that slot kind accepts;
|
|
37
|
+
* the binding-only kinds (`url`, `number`, a fact-sourced `select`) intersect
|
|
38
|
+
* nothing at all and so admit no `fill` key in either state. A hand-authored
|
|
39
|
+
* `select.of` is the exception: its vocabulary is written out, so a row field
|
|
40
|
+
* of that shape takes the countless `chooseFrom` and is planned per row.
|
|
41
|
+
*
|
|
42
|
+
* The naked (distributive) `HasSource` mirrors `SourceMark`/`WritebackOption`
|
|
43
|
+
* and is what makes the PERMISSIVE branch the fallback: inside `defineSchema` an
|
|
44
|
+
* unsourced builder call resolves `HasSource` to its whole constraint, which a
|
|
45
|
+
* `[HasSource] extends [undefined]` test would read as source-bound and reject
|
|
46
|
+
* the fill. Distributing leaves the unsourced arm in the union.
|
|
47
|
+
*/
|
|
48
|
+
type FillOption<HasSource, Legal> = HasSource extends SlotSource | ComputeBinding<unknown> ? {
|
|
49
|
+
fill?: never;
|
|
50
|
+
} : {
|
|
51
|
+
fill?: Legal;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* What a slot's `fill:` may hold: a built decision for an ordinary fillable
|
|
55
|
+
* slot, or — for a model-originated record list — the row origination itself
|
|
56
|
+
* (`chooseFrom` over a closed vocabulary, `nameRows` over an open one), which IS
|
|
57
|
+
* that slot's whole fill declaration.
|
|
58
|
+
*/
|
|
59
|
+
type SlotFill = BuiltDecision<DecisionKind> | ChosenRows | NamedRows;
|
|
60
|
+
/**
|
|
61
|
+
* The `reads` option every decision whose executor reads the fact slice admits:
|
|
62
|
+
* the fact keys THIS decision's brief needs beyond the slice's standing contents
|
|
63
|
+
* (the address, the units, the narrative, the primary contact), optionally dotted
|
|
64
|
+
* to name a path within one. Declared on the decision because its reason is that
|
|
65
|
+
* brief's wording. A `source:`-bound slot is baked from the full property facts
|
|
66
|
+
* and needs none.
|
|
67
|
+
*/
|
|
68
|
+
interface Readable {
|
|
69
|
+
/**
|
|
70
|
+
* Fact keys this decision's brief needs on the slice — `photos`, `tours`,
|
|
71
|
+
* `floor_plans`. The section's `reads` is the union over its decisions.
|
|
72
|
+
*/
|
|
73
|
+
reads?: readonly DeclarableRead[];
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { DeclarableRead, FILL, FillMark, FillOption, Readable, SlotFill };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/schema/fill-declaration.ts
|
|
2
|
+
/**
|
|
3
|
+
* The key a slot builder attaches its `fill:` declaration under. Symbol-keyed so
|
|
4
|
+
* the declaration never reaches the serialized schema — read it back through
|
|
5
|
+
* `fillSpecFromSchema` rather than off the slot.
|
|
6
|
+
*/
|
|
7
|
+
const FILL = Symbol.for("@homepages/concrete:fill:declaration");
|
|
8
|
+
/**
|
|
9
|
+
* The key a decision builder attaches its `reads` list under. NON-enumerable,
|
|
10
|
+
* unlike `FILL`, and that difference is load-bearing: extraction assembles each
|
|
11
|
+
* emitted decision by spreading the built one, and a spread skips a
|
|
12
|
+
* non-enumerable key, so the list never reaches a decision literal on the wire.
|
|
13
|
+
* The section's `reads` is materialized from these (`fillSpecFromSchema`).
|
|
14
|
+
*/
|
|
15
|
+
const READS = Symbol.for("@homepages/concrete:fill:reads");
|
|
16
|
+
/** The `[FILL]` property a builder spreads into its emitted slot — nothing when no fill was declared. */
|
|
17
|
+
function fillMark(fill) {
|
|
18
|
+
return fill !== void 0 ? { [FILL]: fill } : {};
|
|
19
|
+
}
|
|
20
|
+
/** Reads a slot's colocated `fill:` declaration, or `undefined` when it declares none. */
|
|
21
|
+
function getFill(slot) {
|
|
22
|
+
if (typeof slot !== "object" || slot === null) return void 0;
|
|
23
|
+
return slot[FILL];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Attaches a built decision's `reads` (non-enumerable, see `READS`) and returns
|
|
27
|
+
* the same object. No list, no key: an undeclaring decision reads as `[]`.
|
|
28
|
+
*/
|
|
29
|
+
function withReads(decision, reads) {
|
|
30
|
+
if (reads !== void 0) Object.defineProperty(decision, READS, {
|
|
31
|
+
value: [...reads],
|
|
32
|
+
enumerable: false
|
|
33
|
+
});
|
|
34
|
+
return decision;
|
|
35
|
+
}
|
|
36
|
+
/** Reads a decision's `reads` list, or `[]` when it declared none. */
|
|
37
|
+
function getReads(decision) {
|
|
38
|
+
if (typeof decision !== "object" || decision === null) return [];
|
|
39
|
+
return decision[READS] ?? [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FILL, READS, fillMark, getFill, getReads, withReads };
|
|
@@ -0,0 +1,18 @@
|
|
|
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 };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { DISPLAY_ENTRIES, REFERRAL_FIELDS } from "../packages/internal/template-contracts/dist/slot-catalog.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/schema/fill-spec.ts
|
|
5
|
+
const AbstentionBrief = z.string().min(1).optional();
|
|
6
|
+
const ContactAssignDecision = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
type: z.literal("contact-assign"),
|
|
9
|
+
pick: z.string(),
|
|
10
|
+
field: z.enum(REFERRAL_FIELDS),
|
|
11
|
+
none: AbstentionBrief,
|
|
12
|
+
produces: z.array(z.string()).min(1)
|
|
13
|
+
}).strict();
|
|
14
|
+
const ImageAssignBase = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
type: z.literal("image-assign"),
|
|
17
|
+
pick: z.string(),
|
|
18
|
+
none: AbstentionBrief,
|
|
19
|
+
produces: z.array(z.string()).min(1)
|
|
20
|
+
}).strict();
|
|
21
|
+
const ImageAssignDecision = ImageAssignBase.extend({ fallback: ContactAssignDecision.omit({
|
|
22
|
+
id: true,
|
|
23
|
+
produces: true
|
|
24
|
+
}).optional() }).strict();
|
|
25
|
+
const VideoAssignDecision = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
type: z.literal("video-assign"),
|
|
28
|
+
pick: z.string(),
|
|
29
|
+
none: AbstentionBrief,
|
|
30
|
+
produces: z.array(z.string()).min(1)
|
|
31
|
+
}).strict();
|
|
32
|
+
const TourAssignDecision = z.object({
|
|
33
|
+
id: z.string(),
|
|
34
|
+
type: z.literal("tour-assign"),
|
|
35
|
+
pick: z.string(),
|
|
36
|
+
none: AbstentionBrief,
|
|
37
|
+
produces: z.array(z.string()).min(1)
|
|
38
|
+
}).strict();
|
|
39
|
+
const DocumentAssignDecision = z.object({
|
|
40
|
+
id: z.string(),
|
|
41
|
+
type: z.literal("document-assign"),
|
|
42
|
+
pick: z.string(),
|
|
43
|
+
none: AbstentionBrief,
|
|
44
|
+
produces: z.array(z.string()).min(1)
|
|
45
|
+
}).strict();
|
|
46
|
+
/**
|
|
47
|
+
* The shapes a `text-block` decision may ask the model for — the whole
|
|
48
|
+
* `structure` vocabulary, declared once so the meta-schema below and the
|
|
49
|
+
* `textBlock` builder's authoring type are the same fact rather than two.
|
|
50
|
+
*
|
|
51
|
+
* Three are prose. `value` is not: it is a bare figure, name or label with its
|
|
52
|
+
* unit ("$4,250,000", "5.85%", "Built 1978") for a fact-sheet cell, and the
|
|
53
|
+
* executor tells the model to write no sentence around it. Without it every
|
|
54
|
+
* short text slot came back as a sentence, because `single_sentence` was the
|
|
55
|
+
* shortest shape an author could ask for.
|
|
56
|
+
*/
|
|
57
|
+
const TEXT_STRUCTURES = [
|
|
58
|
+
"single_sentence",
|
|
59
|
+
"paragraph",
|
|
60
|
+
"bullet_list",
|
|
61
|
+
"value"
|
|
62
|
+
];
|
|
63
|
+
const TextBlockDecision = z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
type: z.literal("text-block"),
|
|
66
|
+
cap: z.number().int().positive().optional(),
|
|
67
|
+
structure: z.enum(TEXT_STRUCTURES),
|
|
68
|
+
perspective: z.enum([
|
|
69
|
+
"first",
|
|
70
|
+
"second",
|
|
71
|
+
"third"
|
|
72
|
+
]).optional(),
|
|
73
|
+
voice: z.string(),
|
|
74
|
+
content: z.string().optional(),
|
|
75
|
+
none: AbstentionBrief,
|
|
76
|
+
produces: z.array(z.string()).min(1)
|
|
77
|
+
}).strict();
|
|
78
|
+
function nested(full) {
|
|
79
|
+
return full.omit({
|
|
80
|
+
id: true,
|
|
81
|
+
produces: true
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const NestedListFillDecision = z.object({
|
|
85
|
+
type: z.literal("list-fill"),
|
|
86
|
+
count: z.union([z.number().int().positive(), z.object({
|
|
87
|
+
min: z.number().int().nonnegative().optional(),
|
|
88
|
+
max: z.number().int().positive().optional()
|
|
89
|
+
}).strict()]).optional(),
|
|
90
|
+
cap: z.number().int().positive().optional(),
|
|
91
|
+
pick: z.string().optional(),
|
|
92
|
+
structureHint: z.string().optional(),
|
|
93
|
+
voice: z.string().optional(),
|
|
94
|
+
content: z.string().optional(),
|
|
95
|
+
none: AbstentionBrief
|
|
96
|
+
}).strict();
|
|
97
|
+
const SelectAssignNested = z.object({
|
|
98
|
+
type: z.literal("select-assign"),
|
|
99
|
+
pick: z.string(),
|
|
100
|
+
none: AbstentionBrief
|
|
101
|
+
}).strict();
|
|
102
|
+
const NestedDecision = z.discriminatedUnion("type", [
|
|
103
|
+
nested(ImageAssignBase),
|
|
104
|
+
nested(VideoAssignDecision),
|
|
105
|
+
nested(TourAssignDecision),
|
|
106
|
+
nested(DocumentAssignDecision),
|
|
107
|
+
nested(TextBlockDecision),
|
|
108
|
+
NestedListFillDecision,
|
|
109
|
+
SelectAssignNested
|
|
110
|
+
]);
|
|
111
|
+
const ListFillDecision = z.object({
|
|
112
|
+
id: z.string(),
|
|
113
|
+
type: z.literal("list-fill"),
|
|
114
|
+
mode: z.enum([
|
|
115
|
+
"choose",
|
|
116
|
+
"name",
|
|
117
|
+
"extract",
|
|
118
|
+
"facts",
|
|
119
|
+
"pool",
|
|
120
|
+
"curate"
|
|
121
|
+
]),
|
|
122
|
+
count: z.union([z.number().int().positive(), z.object({
|
|
123
|
+
min: z.number().int().nonnegative().optional(),
|
|
124
|
+
max: z.number().int().positive().optional()
|
|
125
|
+
}).strict()]).optional(),
|
|
126
|
+
order: z.literal("walkthrough").optional(),
|
|
127
|
+
cap: z.number().int().positive().optional(),
|
|
128
|
+
pick: z.string().optional(),
|
|
129
|
+
structureHint: z.string().optional(),
|
|
130
|
+
voice: z.string().optional(),
|
|
131
|
+
content: z.string().optional(),
|
|
132
|
+
iterate: z.string().optional(),
|
|
133
|
+
none: AbstentionBrief,
|
|
134
|
+
fields: z.record(z.string(), NestedDecision).optional(),
|
|
135
|
+
produces: z.array(z.string()).min(1)
|
|
136
|
+
}).strict();
|
|
137
|
+
const DisplaySelectDecision = z.object({
|
|
138
|
+
id: z.string(),
|
|
139
|
+
type: z.literal("display-select"),
|
|
140
|
+
entries: z.array(z.enum(DISPLAY_ENTRIES)).min(1),
|
|
141
|
+
produces: z.array(z.string()).max(0)
|
|
142
|
+
}).strict();
|
|
143
|
+
/**
|
|
144
|
+
* The closed set of fill decisions a section's fill spec may declare, one
|
|
145
|
+
* member per decision type (`image-assign`, `text-block`, `list-fill`,
|
|
146
|
+
* `display-select`, …). `type` discriminates which variant's config a given
|
|
147
|
+
* decision must satisfy.
|
|
148
|
+
*/
|
|
149
|
+
const Decision = z.discriminatedUnion("type", [
|
|
150
|
+
ListFillDecision,
|
|
151
|
+
ImageAssignDecision,
|
|
152
|
+
VideoAssignDecision,
|
|
153
|
+
TourAssignDecision,
|
|
154
|
+
DocumentAssignDecision,
|
|
155
|
+
ContactAssignDecision,
|
|
156
|
+
TextBlockDecision,
|
|
157
|
+
DisplaySelectDecision
|
|
158
|
+
]);
|
|
159
|
+
/**
|
|
160
|
+
* A section's whole authored fill spec: the fact paths it `reads` (defaults
|
|
161
|
+
* to `[]` when omitted) plus its ordered `decisions`. The serialized form
|
|
162
|
+
* lands in the section's published fill spec.
|
|
163
|
+
*/
|
|
164
|
+
const FillSpec = z.object({
|
|
165
|
+
reads: z.array(z.string()).default([]),
|
|
166
|
+
decisions: z.array(Decision)
|
|
167
|
+
}).strict();
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
export { Decision, FillSpec, TEXT_STRUCTURES };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DocumentFormat, ImageFormat } from "../packages/internal/format-geometry/dist/format.js";
|
|
2
|
+
import { WebsiteFormat } from "./format.js";
|
|
3
|
+
//#region src/schema/format-presets.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The v1 preset library, exported from the kit root. `presets.website` is the
|
|
6
|
+
* geometry-less singleton every website template's format set holds; the rest
|
|
7
|
+
* are the known social/print/deck sizes the picker renders as branded.
|
|
8
|
+
*/
|
|
9
|
+
declare const presets: {
|
|
10
|
+
readonly instagramSquare: ImageFormat;
|
|
11
|
+
readonly instagramPortrait: ImageFormat;
|
|
12
|
+
readonly instagramStory: ImageFormat;
|
|
13
|
+
readonly facebookPost: ImageFormat;
|
|
14
|
+
readonly linkedinPost: ImageFormat;
|
|
15
|
+
readonly xPost: ImageFormat;
|
|
16
|
+
readonly letterPortrait: DocumentFormat;
|
|
17
|
+
readonly letterLandscape: DocumentFormat;
|
|
18
|
+
readonly a4Portrait: DocumentFormat;
|
|
19
|
+
readonly a4Landscape: DocumentFormat;
|
|
20
|
+
readonly postcard6x4: DocumentFormat;
|
|
21
|
+
readonly postcard7x5: DocumentFormat;
|
|
22
|
+
readonly halfLetterFlyer: DocumentFormat;
|
|
23
|
+
readonly deck16x9: DocumentFormat;
|
|
24
|
+
readonly website: WebsiteFormat;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { presets };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//#region src/schema/format-presets.ts
|
|
2
|
+
const image = (id, label, category, width, height) => ({
|
|
3
|
+
id,
|
|
4
|
+
label,
|
|
5
|
+
category,
|
|
6
|
+
preset: id,
|
|
7
|
+
width,
|
|
8
|
+
height
|
|
9
|
+
});
|
|
10
|
+
const print = (id, label, category, width, height, bleed) => ({
|
|
11
|
+
id,
|
|
12
|
+
label,
|
|
13
|
+
category,
|
|
14
|
+
preset: id,
|
|
15
|
+
width,
|
|
16
|
+
height,
|
|
17
|
+
dpi: 300,
|
|
18
|
+
bleed
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The v1 preset library, exported from the kit root. `presets.website` is the
|
|
22
|
+
* geometry-less singleton every website template's format set holds; the rest
|
|
23
|
+
* are the known social/print/deck sizes the picker renders as branded.
|
|
24
|
+
*/
|
|
25
|
+
const presets = {
|
|
26
|
+
instagramSquare: image("instagram-square", "Instagram Square Post", "social-post", 1080, 1080),
|
|
27
|
+
instagramPortrait: image("instagram-portrait", "Instagram Portrait Post", "social-post", 1080, 1350),
|
|
28
|
+
instagramStory: image("instagram-story", "Instagram Story", "story", 1080, 1920),
|
|
29
|
+
facebookPost: image("facebook-post", "Facebook Post", "social-post", 1200, 630),
|
|
30
|
+
linkedinPost: image("linkedin-post", "LinkedIn Post", "social-post", 1200, 627),
|
|
31
|
+
xPost: image("x-post", "X Post", "social-post", 1600, 900),
|
|
32
|
+
letterPortrait: print("letter-portrait", "Letter Portrait", "brochure", "8.5in", "11in", "0.125in"),
|
|
33
|
+
letterLandscape: print("letter-landscape", "Letter Landscape", "brochure", "11in", "8.5in", "0.125in"),
|
|
34
|
+
a4Portrait: print("a4-portrait", "A4 Portrait", "brochure", "210mm", "297mm", "3mm"),
|
|
35
|
+
a4Landscape: print("a4-landscape", "A4 Landscape", "brochure", "297mm", "210mm", "3mm"),
|
|
36
|
+
postcard6x4: print("postcard-6x4", "Postcard 6 by 4", "postcard", "6in", "4in", "0.125in"),
|
|
37
|
+
postcard7x5: print("postcard-7x5", "Postcard 7 by 5", "postcard", "7in", "5in", "0.125in"),
|
|
38
|
+
halfLetterFlyer: print("half-letter-flyer", "Half-Letter Flyer", "flyer", "5.5in", "8.5in", "0.125in"),
|
|
39
|
+
deck16x9: {
|
|
40
|
+
id: "deck-16x9",
|
|
41
|
+
label: "Widescreen Deck",
|
|
42
|
+
category: "presentation",
|
|
43
|
+
preset: "deck-16x9",
|
|
44
|
+
width: 1920,
|
|
45
|
+
height: 1080
|
|
46
|
+
},
|
|
47
|
+
website: {
|
|
48
|
+
id: "website",
|
|
49
|
+
label: "Website",
|
|
50
|
+
category: "website"
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const RENDERED_PRESETS_BY_TAG = new Map(Object.values(presets).filter((preset) => preset.width !== void 0).map((preset) => [preset.id, preset]));
|
|
54
|
+
/**
|
|
55
|
+
* Whether a format's `preset` provenance tag is truthful. Untagged formats
|
|
56
|
+
* pass; a tagged one passes only when its geometry — width, height, dpi,
|
|
57
|
+
* bleed — exactly matches the library entry the tag names. Identity fields are
|
|
58
|
+
* NOT compared: re-labeling or re-categorizing a preset keeps the tag, because
|
|
59
|
+
* the category is browsing metadata, not geometry.
|
|
60
|
+
*/
|
|
61
|
+
function presetGeometryMatches(format) {
|
|
62
|
+
if (format.preset === void 0) return true;
|
|
63
|
+
const library = RENDERED_PRESETS_BY_TAG.get(format.preset);
|
|
64
|
+
if (library === void 0) return false;
|
|
65
|
+
const geometry = (value) => [
|
|
66
|
+
value.width,
|
|
67
|
+
value.height,
|
|
68
|
+
"dpi" in value ? value.dpi : void 0,
|
|
69
|
+
"bleed" in value ? value.bleed : void 0
|
|
70
|
+
];
|
|
71
|
+
const actual = geometry(format);
|
|
72
|
+
return geometry(library).every((field, index) => field === actual[index]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { presetGeometryMatches, presets };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ContentCategory } from "../packages/internal/template-contracts/dist/content-categories.js";
|
|
2
|
+
import { DocumentFormat, FormatIdentity, ImageFormat, PhysicalLength } from "../packages/internal/format-geometry/dist/format.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/schema/format.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The one geometry-less format: the website branch's singleton. The
|
|
7
|
+
* never-typed geometry fields keep a rendered format from flowing into a
|
|
8
|
+
* website slot and vice versa — the mix is unrepresentable, not a validation
|
|
9
|
+
* message.
|
|
10
|
+
*/
|
|
11
|
+
interface WebsiteFormat {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly category: ContentCategory;
|
|
15
|
+
readonly width?: never;
|
|
16
|
+
readonly height?: never;
|
|
17
|
+
readonly dpi?: never;
|
|
18
|
+
readonly bleed?: never;
|
|
19
|
+
readonly preset?: never;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type ContentCategory, type DocumentFormat, type FormatIdentity, type ImageFormat, type PhysicalLength, WebsiteFormat };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CONTENT_CATEGORIES } from "../packages/internal/template-contracts/dist/content-categories.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/schema/format.ts
|
|
5
|
+
const PHYSICAL_LENGTH_RE = /^\d+(?:\.\d+)?(?:in|mm)$/;
|
|
6
|
+
const physicalLength = (constraint) => z.string().regex(PHYSICAL_LENGTH_RE).refine((value) => constraint === "positive" ? Number.parseFloat(value) > 0 : true, { message: "physical length must be positive" });
|
|
7
|
+
const outputPixels = z.number().int().positive();
|
|
8
|
+
const identityFields = {
|
|
9
|
+
id: z.string().min(1),
|
|
10
|
+
label: z.string().min(1),
|
|
11
|
+
category: z.enum(CONTENT_CATEGORIES),
|
|
12
|
+
preset: z.string().min(1).optional()
|
|
13
|
+
};
|
|
14
|
+
/** Zod twin of `ImageFormat`. */
|
|
15
|
+
const ImageFormatSchema = z.object({
|
|
16
|
+
...identityFields,
|
|
17
|
+
width: outputPixels,
|
|
18
|
+
height: outputPixels
|
|
19
|
+
}).strict();
|
|
20
|
+
/**
|
|
21
|
+
* Zod twin of `DocumentFormat`: a strict union, so a mixed
|
|
22
|
+
* physical/pixel object or a pixel sheet carrying `dpi`/`bleed` matches no
|
|
23
|
+
* branch. The 72–600 dpi window matches the manifest parse rules.
|
|
24
|
+
*/
|
|
25
|
+
const DocumentFormatSchema = z.union([z.object({
|
|
26
|
+
...identityFields,
|
|
27
|
+
width: outputPixels,
|
|
28
|
+
height: outputPixels
|
|
29
|
+
}).strict(), z.object({
|
|
30
|
+
...identityFields,
|
|
31
|
+
width: physicalLength("positive"),
|
|
32
|
+
height: physicalLength("positive"),
|
|
33
|
+
dpi: z.number().min(72).max(600),
|
|
34
|
+
bleed: physicalLength("non-negative").optional()
|
|
35
|
+
}).strict()]);
|
|
36
|
+
/** Zod twin of {@link WebsiteFormat}: identity only, geometry rejected. */
|
|
37
|
+
const WebsiteFormatSchema = z.object(identityFields).omit({ preset: true }).strict();
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { DocumentFormatSchema, ImageFormatSchema, WebsiteFormatSchema };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DocumentFormat, ImageFormat } from "../packages/internal/format-geometry/dist/format.js";
|
|
2
|
+
import { WebsiteFormat } from "./format.js";
|
|
3
|
+
//#region src/schema/formats.d.ts
|
|
4
|
+
declare const website: WebsiteFormat, instagramSquare: ImageFormat, instagramPortrait: ImageFormat, instagramStory: ImageFormat, facebookPost: ImageFormat, linkedinPost: ImageFormat, xPost: ImageFormat, letterPortrait: DocumentFormat, letterLandscape: DocumentFormat, a4Portrait: DocumentFormat, a4Landscape: DocumentFormat, postcard6x4: DocumentFormat, postcard7x5: DocumentFormat, halfLetterFlyer: DocumentFormat, deck16x9: DocumentFormat;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { presets } from "./format-presets.js";
|
|
2
|
+
|
|
3
|
+
//#region src/schema/formats.ts
|
|
4
|
+
const { website, instagramSquare, instagramPortrait, instagramStory, facebookPost, linkedinPost, xPost, letterPortrait, letterLandscape, a4Portrait, a4Landscape, postcard6x4, postcard7x5, halfLetterFlyer, deck16x9 } = presets;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { a4Landscape, a4Portrait, deck16x9, facebookPost, halfLetterFlyer, instagramPortrait, instagramSquare, instagramStory, letterLandscape, letterPortrait, linkedinPost, postcard6x4, postcard7x5, website, xPost };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/schema/layout.d.ts
|
|
2
|
+
/** One layout row: a slot key (full-width) or a `[a, b]` 2-up pair, keyed to real slots. */
|
|
3
|
+
type LayoutRow<K extends string> = K | readonly [K, K];
|
|
4
|
+
/**
|
|
5
|
+
* A sidebar grouping card produced by `group(...)`. Structurally an object, so it
|
|
6
|
+
* is distinguishable at runtime from a bare `LayoutRow` (a string or array).
|
|
7
|
+
*
|
|
8
|
+
* `Id` is always a literal: `group` takes the id as its first argument, so every
|
|
9
|
+
* card's id is known at compile time — that literal is the key a Renderer reads
|
|
10
|
+
* off `bindGroups(schema).<id>`.
|
|
11
|
+
*/
|
|
12
|
+
interface GroupCard<K extends string, Id extends string = string> {
|
|
13
|
+
id: Id;
|
|
14
|
+
label: string;
|
|
15
|
+
members: readonly LayoutRow<K>[];
|
|
16
|
+
}
|
|
17
|
+
/** A section-level layout entry: a bare row or a `group(...)` card. */
|
|
18
|
+
type SectionLayoutEntry<K extends string> = LayoutRow<K> | GroupCard<K>;
|
|
19
|
+
/**
|
|
20
|
+
* One `meta.groups` entry as emitted from a `group(...)` card: `SlotGroupDefShape`
|
|
21
|
+
* with the card's id kept literal. That literal is what keeps `bindGroups` over a
|
|
22
|
+
* `defineSchema`-built section exact-keyed rather than `Record<string, …>`.
|
|
23
|
+
*/
|
|
24
|
+
interface GroupDefOf<Id extends string> {
|
|
25
|
+
id: Id;
|
|
26
|
+
label: string;
|
|
27
|
+
members: (string | [string, string])[];
|
|
28
|
+
}
|
|
29
|
+
/** The union of group ids a section layout declares; `never` when it holds no cards. */
|
|
30
|
+
type GroupIdsOfLayout<L extends readonly unknown[]> = Extract<L[number], GroupCard<string, string>>["id"];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { GroupCard, GroupDefOf, GroupIdsOfLayout, LayoutRow, SectionLayoutEntry };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/schema/layout.ts
|
|
2
|
+
function isGroupCard(entry) {
|
|
3
|
+
return typeof entry === "object" && entry !== null && !Array.isArray(entry);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The `meta.groups` array a section layout emits — one entry per `group(...)`
|
|
7
|
+
* card, in order. Bare rows contribute no group (each is its own default card),
|
|
8
|
+
* exactly as an ungrouped slot does in the hand-authored form.
|
|
9
|
+
*/
|
|
10
|
+
function groupsFromLayout(layout) {
|
|
11
|
+
return layout.filter(isGroupCard).map((card) => ({
|
|
12
|
+
id: card.id,
|
|
13
|
+
label: card.label,
|
|
14
|
+
members: toMembers(card.members)
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The `layout` array a record item emits from its bare-row layout. Order
|
|
19
|
+
* preserved; `item_order` is NOT emitted here — CI still derives it from
|
|
20
|
+
* `layout` at materialization, unchanged.
|
|
21
|
+
*/
|
|
22
|
+
function itemLayoutFromRows(rows) {
|
|
23
|
+
return toMembers(rows);
|
|
24
|
+
}
|
|
25
|
+
function toMembers(rows) {
|
|
26
|
+
return rows.map((row) => typeof row === "string" ? row : [row[0], row[1]]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { groupsFromLayout, itemLayoutFromRows };
|