@homepages/concrete 11.0.0 → 12.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 +19 -0
- package/codemods/manifest.json +6 -0
- package/dist/artifact/playground/client/assets/index-BcLGpWLR.js +1266 -0
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +39 -40
- package/dist/base.css +17 -57
- package/dist/cli/capture/capture.js +8 -6
- package/dist/cli/dev/workspace-reader.js +1 -0
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/fill-bake/dist/compute-reads.js +1 -1
- package/dist/packages/internal/fill-bake/dist/held-rows.js +2 -0
- package/dist/packages/internal/fill-bake/dist/index.js +1 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +3 -11
- package/dist/packages/internal/format-geometry/dist/format.d.ts +2 -8
- package/dist/packages/internal/format-geometry/dist/geometry.js +2 -13
- package/dist/packages/internal/template-contracts/dist/fact-registry.js +1 -1
- package/dist/primitives/FrameShell.d.ts +5 -2
- package/dist/primitives/FrameShell.js +2 -1
- package/dist/rules/registry.js +1 -1
- package/dist/schema/format.d.ts +0 -1
- package/dist/schema/format.js +1 -2
- package/dist/schema/manifest.js +18 -24
- package/dist/site-analytics.js +6 -1
- package/dist/site-runtime/window-height.js +19 -0
- package/dist/template/define-template.d.ts +11 -0
- package/dist/template/define-template.js +1 -0
- package/dist/template/materialize.js +2 -0
- package/guide/reference/cli/INDEX.md +2 -2
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +1 -1
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +2 -2
- package/package.json +1 -1
- package/dist/artifact/playground/client/assets/index-ByeGGedv.js +0 -1259
package/dist/base.css
CHANGED
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
* - The section box model (.concrete-section, emitted by the <Section> primitive)
|
|
19
19
|
* - The frame shell's static half (.concrete-frame, emitted by the <FrameShell> primitive)
|
|
20
20
|
* and the window witness that holds every host to the geometry it owes that shell
|
|
21
|
-
* - A folded print's sheet (.concrete-sheet): the panels' frames side by side, the
|
|
22
|
-
* window contract moved up to the sheet
|
|
23
21
|
* - The <Image>/<Video>/<Tour> box's geometry default (.concrete-image-block), layered so
|
|
24
22
|
* an author's own width utility beats it
|
|
25
23
|
* - The <Image>/<Video> frame's placeholder fill (.concrete-image-frame)
|
|
@@ -123,32 +121,7 @@
|
|
|
123
121
|
* extended symmetrically by the bleed. */
|
|
124
122
|
--concrete-frame-window-w: calc(var(--frame-w) + 2 * var(--frame-bleed));
|
|
125
123
|
--concrete-frame-window-h: calc(var(--frame-h) + 2 * var(--frame-bleed));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* A folded print's sheet: `panels` consecutive page frames side by side on one
|
|
129
|
-
* printed sheet side. Like `.concrete-frame`, the class is derived in
|
|
130
|
-
* `@homepages/format-geometry` (SHEET_ROOT_CLASS) and only styled here; only a
|
|
131
|
-
* print document's assembler emits it, so the canvas and every lone frame never
|
|
132
|
-
* see one.
|
|
133
|
-
*
|
|
134
|
-
* The sheet takes over the frame's window contract: in a print document the
|
|
135
|
-
* sheet is the window and the paper, so it fills the window, clips at its edge,
|
|
136
|
-
* and the witness measures the window against the sheet's bleed box — the
|
|
137
|
-
* panels' trim widths side by side, extended by the bleed on the sheet's outer
|
|
138
|
-
* edges only. */
|
|
139
|
-
.concrete-sheet {
|
|
140
|
-
position: relative;
|
|
141
|
-
width: 100vw;
|
|
142
|
-
height: 100vh;
|
|
143
|
-
overflow: clip;
|
|
144
|
-
display: flex;
|
|
145
|
-
|
|
146
|
-
--concrete-frame-window-w: calc(var(--sheet-w) + 2 * var(--frame-bleed));
|
|
147
|
-
--concrete-frame-window-h: calc(var(--sheet-h) + 2 * var(--frame-bleed));
|
|
148
|
-
}
|
|
149
124
|
|
|
150
|
-
.concrete-frame,
|
|
151
|
-
.concrete-sheet {
|
|
152
125
|
/* 1 when the real window misses the owed one on either axis, 0 when it does not.
|
|
153
126
|
* max(d, -d) is an absolute difference and `/ 1px` makes it a plain number. The
|
|
154
127
|
* -1 is the tolerance: a browser window is whole CSS px while a physical format's
|
|
@@ -179,8 +152,7 @@
|
|
|
179
152
|
* pixels and identical layout to one with no witness at all. On a mismatch it covers
|
|
180
153
|
* the artifact and names both geometries, because a frame measured against the wrong
|
|
181
154
|
* box is not a preview of anything and must not read as one. */
|
|
182
|
-
.concrete-frame::after
|
|
183
|
-
.concrete-sheet::after {
|
|
155
|
+
.concrete-frame::after {
|
|
184
156
|
counter-reset:
|
|
185
157
|
concrete-frame-owed-w calc(var(--concrete-frame-window-w) / 1px)
|
|
186
158
|
concrete-frame-owed-h calc(var(--concrete-frame-window-h) / 1px)
|
|
@@ -212,33 +184,12 @@
|
|
|
212
184
|
flex-shrink: 0;
|
|
213
185
|
}
|
|
214
186
|
|
|
215
|
-
/* A page
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
* The window witness is the sheet's alone; a panel measuring 100vw against its
|
|
222
|
-
* own box would always cry mismatch. */
|
|
223
|
-
.concrete-sheet > .concrete-frame {
|
|
224
|
-
flex-shrink: 0;
|
|
225
|
-
width: calc(var(--frame-w) + 2 * var(--frame-bleed));
|
|
226
|
-
height: calc(var(--frame-h) + 2 * var(--frame-bleed));
|
|
227
|
-
margin-right: calc(-2 * var(--frame-bleed));
|
|
228
|
-
clip-path: inset(0 var(--frame-bleed));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.concrete-sheet > .concrete-frame:first-child {
|
|
232
|
-
clip-path: inset(0 var(--frame-bleed) 0 0);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.concrete-sheet > .concrete-frame:last-child {
|
|
236
|
-
margin-right: 0;
|
|
237
|
-
clip-path: inset(0 0 0 var(--frame-bleed));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.concrete-sheet > .concrete-frame::after {
|
|
241
|
-
content: none;
|
|
187
|
+
/* A row page (`direction: "row"`, stamped `data-direction` by every host) lays its
|
|
188
|
+
* sections side by side: a folded piece's printed side, one section per panel. The
|
|
189
|
+
* rule above still holds on the main axis, so an over-wide row overflows measurably;
|
|
190
|
+
* each section sets its own width, and the cross axis stretches it the frame tall. */
|
|
191
|
+
.concrete-frame[data-direction="row"] {
|
|
192
|
+
flex-direction: row;
|
|
242
193
|
}
|
|
243
194
|
|
|
244
195
|
/* The geometry DEFAULT of every <Image>/<Video>/<Tour> box — the unframed element
|
|
@@ -296,6 +247,15 @@
|
|
|
296
247
|
* token as the screen its card stands for — a constant, so one pass settles it
|
|
297
248
|
* — and a box sized from the window therefore writes ONE thing and is honest on
|
|
298
249
|
* both surfaces. Spell it as a floor (`min-height`), never a fixed height, so
|
|
299
|
-
* content taller than a screen still grows the box instead of overflowing it.
|
|
250
|
+
* content taller than a screen still grows the box instead of overflowing it.
|
|
251
|
+
*
|
|
252
|
+
* On a published page the site runtime (site-runtime/window-height.ts) pins this
|
|
253
|
+
* to the height measured at load, in px, and measures again only when the width
|
|
254
|
+
* changes. `100svh` is meant to hold still while a browser's toolbars collapse,
|
|
255
|
+
* but an embedder that never declares its toolbars to the engine (Chrome on iOS,
|
|
256
|
+
* an in-app browser) lets it follow them like `100dvh`, and every box sized from
|
|
257
|
+
* it then resizes under the visitor's finger mid-scroll, jumping all content
|
|
258
|
+
* below. The declaration here is what a page shows before that script runs and
|
|
259
|
+
* what a no-script reader keeps. */
|
|
300
260
|
--concrete-window-h: 100svh;
|
|
301
261
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { captureViewport, printPageSize
|
|
1
|
+
import { captureViewport, printPageSize } from "../../packages/internal/format-geometry/dist/capture.js";
|
|
2
2
|
import { CAPTURE_WAIT_UNTIL, settleCapture } from "../../packages/internal/capture-settle/dist/settle.js";
|
|
3
3
|
import "../../packages/internal/capture-settle/dist/index.js";
|
|
4
4
|
import { bundlePages } from "./bundle.js";
|
|
@@ -48,8 +48,10 @@ function createCapturer(options) {
|
|
|
48
48
|
throw new CaptureUnavailableError(`chromium is not available — run: npx playwright install chromium\n(${err instanceof Error ? err.message : String(err)})`);
|
|
49
49
|
}
|
|
50
50
|
}));
|
|
51
|
-
const withPage = async (
|
|
52
|
-
const
|
|
51
|
+
const withPage = async (format, run) => {
|
|
52
|
+
const browser = await pool.acquire();
|
|
53
|
+
const viewport = captureViewport(format);
|
|
54
|
+
const page = await browser.newPage({
|
|
53
55
|
viewport: {
|
|
54
56
|
width: viewport.width,
|
|
55
57
|
height: viewport.height
|
|
@@ -68,8 +70,8 @@ function createCapturer(options) {
|
|
|
68
70
|
return new Uint8Array(await page.screenshot({ fullPage: false }));
|
|
69
71
|
};
|
|
70
72
|
return {
|
|
71
|
-
screenshot: (url, format) => withPage(
|
|
72
|
-
bundle: (entries, format) => withPage(
|
|
73
|
+
screenshot: (url, format) => withPage(format, (page) => shoot(page, url)),
|
|
74
|
+
bundle: (entries, format) => withPage(format, async (page) => {
|
|
73
75
|
const members = [];
|
|
74
76
|
for (const entry of entries) members.push({
|
|
75
77
|
name: entry.name,
|
|
@@ -77,7 +79,7 @@ function createCapturer(options) {
|
|
|
77
79
|
});
|
|
78
80
|
return new Uint8Array(bundlePages(members));
|
|
79
81
|
}),
|
|
80
|
-
print: (url, format) => withPage(
|
|
82
|
+
print: (url, format) => withPage(format, async (page) => {
|
|
81
83
|
await page.emulateMedia({ media: "screen" });
|
|
82
84
|
await page.goto(url, { waitUntil: CAPTURE_WAIT_UNTIL });
|
|
83
85
|
await settleCapture(settleHost(page));
|
|
@@ -158,6 +158,7 @@ var DevWorkspace = class {
|
|
|
158
158
|
id: page.id,
|
|
159
159
|
label: page.label,
|
|
160
160
|
..."path" in page && typeof page.path === "string" ? { path: page.path } : {},
|
|
161
|
+
..."direction" in page ? { direction: page.direction } : {},
|
|
161
162
|
sections: page.sections.map((s) => ({
|
|
162
163
|
instanceId: s.instance_id,
|
|
163
164
|
section: s.section
|
|
@@ -171,7 +171,7 @@ function applyComputeReads(input) {
|
|
|
171
171
|
const inst = working.get(decl.instanceId);
|
|
172
172
|
if (inst === void 0) return false;
|
|
173
173
|
if (decl.kind === "display") return writeDisplay(inst, decl, facts, (ref) => readStored(targetOf(decl, ref), ref.slot), rowReaderOf(decl));
|
|
174
|
-
if (isSlotOverridden(inst.slot_overrides, decl.key)) return false;
|
|
174
|
+
if (decl.kind !== "mirror" && isSlotOverridden(inst.slot_overrides, decl.key)) return false;
|
|
175
175
|
const settled = valueOf(inst, decl);
|
|
176
176
|
if (settled === void 0 || sameValue(storedRefValue(inst, decl.key), settled.value)) return false;
|
|
177
177
|
writeSlot(inst, decl.key, settled.value);
|
|
@@ -6,6 +6,7 @@ import { bakeDisplayEntries, bakePropertyRefSlots, boundFactKey, derivedSource,
|
|
|
6
6
|
import { mergeLinkedValue } from "./linked-merge.js";
|
|
7
7
|
import { mergeSourcedItems } from "./item-merge.js";
|
|
8
8
|
import { applyComputeReads, storedRefValue } from "./compute-reads.js";
|
|
9
|
+
import "./held-rows.js";
|
|
9
10
|
import "./item-overrides.js";
|
|
10
11
|
import "./stored-row-reader.js";
|
|
11
12
|
|
|
@@ -18,21 +18,13 @@ function captureViewport(format) {
|
|
|
18
18
|
deviceScaleFactor: geometry.deviceScaleFactor
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function printViewport(format) {
|
|
22
|
-
const geometry = resolveFormatGeometry(format);
|
|
23
|
-
return {
|
|
24
|
-
width: Math.round(geometry.sheetWidth),
|
|
25
|
-
height: Math.round(geometry.sheetHeight),
|
|
26
|
-
deviceScaleFactor: geometry.deviceScaleFactor
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
21
|
function printPageSize(format) {
|
|
30
22
|
const geometry = resolveFormatGeometry(format);
|
|
31
23
|
return {
|
|
32
|
-
width: `${geometry.
|
|
33
|
-
height: `${geometry.
|
|
24
|
+
width: `${geometry.pointWidth / 72}in`,
|
|
25
|
+
height: `${geometry.pointHeight / 72}in`
|
|
34
26
|
};
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
//#endregion
|
|
38
|
-
export { FRAME_ROOT_CLASS, captureViewport, frameTokens, printPageSize
|
|
30
|
+
export { FRAME_ROOT_CLASS, captureViewport, frameTokens, printPageSize };
|
|
@@ -25,13 +25,8 @@ type ImageFormat = FormatIdentity & {
|
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* A document format is either a pixel sheet (decks) or a physical print size
|
|
28
|
-
* with a capture `dpi
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `panels` is fold geometry: `width`/`height` is then ONE panel, and a printed
|
|
32
|
-
* sheet carries that many consecutive pages side by side (a tri-fold is a 6 × 9 in
|
|
33
|
-
* panel with `panels: 3`). The sheet is derived, never declared; absent means one
|
|
34
|
-
* page per sheet, which is every unfolded document.
|
|
28
|
+
* with a capture `dpi` and optional `bleed`. The union keeps a physical width
|
|
29
|
+
* from ever pairing with a pixel height.
|
|
35
30
|
*/
|
|
36
31
|
type DocumentFormat = FormatIdentity & ({
|
|
37
32
|
readonly width: number;
|
|
@@ -41,7 +36,6 @@ type DocumentFormat = FormatIdentity & ({
|
|
|
41
36
|
readonly height: PhysicalLength;
|
|
42
37
|
readonly dpi: number;
|
|
43
38
|
readonly bleed?: PhysicalLength;
|
|
44
|
-
readonly panels?: number;
|
|
45
39
|
});
|
|
46
40
|
//#endregion
|
|
47
41
|
export { DocumentFormat, FormatIdentity, ImageFormat, PhysicalLength };
|
|
@@ -21,12 +21,7 @@ function resolveFormatGeometry(format) {
|
|
|
21
21
|
pixelHeight: format.height,
|
|
22
22
|
pointWidth: format.width / CSS_PX_PER_INCH * 72,
|
|
23
23
|
pointHeight: format.height / CSS_PX_PER_INCH * 72,
|
|
24
|
-
bleedPoints: 0
|
|
25
|
-
panels: 1,
|
|
26
|
-
sheetWidth: format.width,
|
|
27
|
-
sheetHeight: format.height,
|
|
28
|
-
sheetPointWidth: format.width / CSS_PX_PER_INCH * 72,
|
|
29
|
-
sheetPointHeight: format.height / CSS_PX_PER_INCH * 72
|
|
24
|
+
bleedPoints: 0
|
|
30
25
|
};
|
|
31
26
|
const physical = format;
|
|
32
27
|
const widthIn = toInches(physical.width);
|
|
@@ -38,7 +33,6 @@ function resolveFormatGeometry(format) {
|
|
|
38
33
|
const viewportWidth = frameWidth + 2 * bleed;
|
|
39
34
|
const viewportHeight = frameHeight + 2 * bleed;
|
|
40
35
|
const deviceScaleFactor = physical.dpi / CSS_PX_PER_INCH;
|
|
41
|
-
const panels = physical.panels ?? 1;
|
|
42
36
|
return {
|
|
43
37
|
frameWidth,
|
|
44
38
|
frameHeight,
|
|
@@ -50,12 +44,7 @@ function resolveFormatGeometry(format) {
|
|
|
50
44
|
pixelHeight: Math.round(viewportHeight * deviceScaleFactor),
|
|
51
45
|
pointWidth: (widthIn + 2 * bleedIn) * 72,
|
|
52
46
|
pointHeight: (heightIn + 2 * bleedIn) * 72,
|
|
53
|
-
bleedPoints: bleedIn * 72
|
|
54
|
-
panels,
|
|
55
|
-
sheetWidth: panels * frameWidth + 2 * bleed,
|
|
56
|
-
sheetHeight: viewportHeight,
|
|
57
|
-
sheetPointWidth: (panels * widthIn + 2 * bleedIn) * 72,
|
|
58
|
-
sheetPointHeight: (heightIn + 2 * bleedIn) * 72
|
|
47
|
+
bleedPoints: bleedIn * 72
|
|
59
48
|
};
|
|
60
49
|
}
|
|
61
50
|
|
|
@@ -507,7 +507,7 @@ const commercial_spaces = page({
|
|
|
507
507
|
}
|
|
508
508
|
})
|
|
509
509
|
}));
|
|
510
|
-
const COMPARABLES_BRIEF = "
|
|
510
|
+
const COMPARABLES_BRIEF = "List the comparable properties the uploads present: other properties an upload sets beside the property it markets, so that property's price and specs can be weighed against theirs. They appear as rows of a sales or rent comparables table, as panels with their own photo and figures, as numbered pins in a map legend, or as lines in a survey of recent trades. The property the uploads market is the one this request is for, whatever address they print for it; in a building, it is the building and every unit the uploads market in it. It is never a comparable, even where it appears in a comparables table or at the centre of a comparables map, and an upload presenting it or one of its units for itself, such as its listing sheet, brochure, price list or market history, presents no comparable. Another unit of its building is a comparable only where an upload sets it beside the property as one, such as a sister unit's earlier sale in a comps table. A market or area average, a portfolio total, or anything else that is not one property is not a comparable. Read every upload whole, including tables that continue onto the next page. Each figure is what an upload prints as text for that property, copied exactly, and a listing's remarks word for word: never counted off a floor plan, a photo or a map, never worked out from other figures (a price per unit times a unit count, a price over a size, the days between two dates, a yearly fee made monthly, an average of rows), and never carried over from a neighbouring row, a summary or the property itself. A studio has one bedroom. A property listed in several places is one item carrying every figure those places state. A figure no upload states for that property is null. When no upload sets another property beside the one it markets, return no items.";
|
|
511
511
|
const comparablePlace = address({ label: "Address" });
|
|
512
512
|
const comparableSaleDate = date({ label: "Sale date" });
|
|
513
513
|
const comparables = page({
|
|
@@ -4,6 +4,8 @@ import { ReactNode } from "react";
|
|
|
4
4
|
//#region src/primitives/FrameShell.d.ts
|
|
5
5
|
type Props = {
|
|
6
6
|
format: ImageFormat | DocumentFormat;
|
|
7
|
+
/** The page's declared direction; a row page stamps `data-direction="row"`, a column page nothing. */
|
|
8
|
+
direction?: "column" | "row";
|
|
7
9
|
children: ReactNode;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
@@ -12,7 +14,8 @@ type Props = {
|
|
|
12
14
|
* document a window that is exactly the format's bleed box, and the static
|
|
13
15
|
* half of the contract (`.concrete-frame`, from the base stylesheet) fills
|
|
14
16
|
* that window, clips at the shell's own edge, and lays sections out as a
|
|
15
|
-
* rigid flex column
|
|
17
|
+
* rigid flex column, or a rigid flex row on a page declaring
|
|
18
|
+
* `direction: "row"` (`flex-shrink: 0` on every direct child, so an
|
|
16
19
|
* overflowing stack overflows measurably instead of being silently
|
|
17
20
|
* compressed). The shell sets the three geometry tokens
|
|
18
21
|
* (`--frame-w`/`--frame-h`/`--frame-bleed`) — the declared geometry, for
|
|
@@ -24,6 +27,6 @@ type Props = {
|
|
|
24
27
|
* shell draws nothing: trim and bleed guides are host chrome, never markup, so
|
|
25
28
|
* rendered bytes are identical in every host.
|
|
26
29
|
*/
|
|
27
|
-
declare function FrameShell({ format, children }: Props): import("react").JSX.Element;
|
|
30
|
+
declare function FrameShell({ format, direction, children }: Props): import("react").JSX.Element;
|
|
28
31
|
//#endregion
|
|
29
32
|
export { FrameShell };
|
|
@@ -2,10 +2,11 @@ import { FRAME_ROOT_CLASS, frameTokens } from "../packages/internal/format-geome
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/primitives/FrameShell.tsx
|
|
5
|
-
function FrameShell({ format, children }) {
|
|
5
|
+
function FrameShell({ format, direction = "column", children }) {
|
|
6
6
|
return /* @__PURE__ */ jsx("div", {
|
|
7
7
|
className: FRAME_ROOT_CLASS,
|
|
8
8
|
"data-format": format.id,
|
|
9
|
+
"data-direction": direction === "row" ? "row" : void 0,
|
|
9
10
|
style: frameTokens(format),
|
|
10
11
|
children
|
|
11
12
|
});
|
package/dist/rules/registry.js
CHANGED
|
@@ -267,7 +267,7 @@ const AUTHORED_RULES = [
|
|
|
267
267
|
id: "pages/composition-invalid",
|
|
268
268
|
venue: "probe",
|
|
269
269
|
stage: "composition",
|
|
270
|
-
summary: "The composition the pages place breaks a page, canvas
|
|
270
|
+
summary: "The composition the pages place breaks a page, canvas or instance rule."
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
273
|
id: "relations/section-cycle",
|
package/dist/schema/format.d.ts
CHANGED
package/dist/schema/format.js
CHANGED
|
@@ -25,8 +25,7 @@ const DocumentFormatSchema = z.union([z.object({
|
|
|
25
25
|
width: physicalLength("positive"),
|
|
26
26
|
height: physicalLength("positive"),
|
|
27
27
|
dpi: z.number().min(72).max(600),
|
|
28
|
-
bleed: physicalLength("non-negative").optional()
|
|
29
|
-
panels: z.number().int().min(2).optional()
|
|
28
|
+
bleed: physicalLength("non-negative").optional()
|
|
30
29
|
}).strict()]);
|
|
31
30
|
const WebsiteFormatSchema = z.object(identityFields).omit({ preset: true }).strict();
|
|
32
31
|
|
package/dist/schema/manifest.js
CHANGED
|
@@ -32,6 +32,7 @@ const RenderedPage = z.object({
|
|
|
32
32
|
id: z.string().min(1),
|
|
33
33
|
label: z.string().min(1),
|
|
34
34
|
optional: z.boolean().default(false),
|
|
35
|
+
direction: z.enum(["column", "row"]).default("column"),
|
|
35
36
|
sections: z.array(SectionInstance).min(1)
|
|
36
37
|
}).strict();
|
|
37
38
|
const TemplateCanvas = z.object({
|
|
@@ -213,6 +214,23 @@ function refineRenderedRules(manifest, ctx) {
|
|
|
213
214
|
path: ["pages"],
|
|
214
215
|
message: `A rendered template needs at least one non-optional page; every page of "${manifest.key}" is optional.`
|
|
215
216
|
});
|
|
217
|
+
manifest.pages.forEach((page, pageIdx) => {
|
|
218
|
+
if (page.direction !== "row") return;
|
|
219
|
+
page.sections.forEach((instance, sectionIdx) => {
|
|
220
|
+
if (instance.required) return;
|
|
221
|
+
ctx.addIssue({
|
|
222
|
+
code: z.ZodIssueCode.custom,
|
|
223
|
+
path: [
|
|
224
|
+
"pages",
|
|
225
|
+
pageIdx,
|
|
226
|
+
"sections",
|
|
227
|
+
sectionIdx,
|
|
228
|
+
"required"
|
|
229
|
+
],
|
|
230
|
+
message: `Page "${page.id}" lays its sections out in a row, but section "${instance.section}" is not required: a row page's sections are its panels and every one prints, so declare the section \`required: true\`.`
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|
|
216
234
|
const seenFormatIds = /* @__PURE__ */ new Set();
|
|
217
235
|
manifest.formats.forEach((format, formatIdx) => {
|
|
218
236
|
const variantError = formatVariantNameError(format.id);
|
|
@@ -235,30 +253,6 @@ function refineRenderedRules(manifest, ctx) {
|
|
|
235
253
|
message: `Duplicate format id "${format.id}".`
|
|
236
254
|
});
|
|
237
255
|
seenFormatIds.add(format.id);
|
|
238
|
-
const panels = "panels" in format ? format.panels : void 0;
|
|
239
|
-
if (panels !== void 0) {
|
|
240
|
-
if (manifest.pages.length % panels !== 0) ctx.addIssue({
|
|
241
|
-
code: z.ZodIssueCode.custom,
|
|
242
|
-
path: [
|
|
243
|
-
"formats",
|
|
244
|
-
formatIdx,
|
|
245
|
-
"panels"
|
|
246
|
-
],
|
|
247
|
-
message: `Format "${format.id}" folds ${panels} panels to a sheet, so the template's page count must be a multiple of ${panels}; "${manifest.key}" declares ${manifest.pages.length}. Each page is one panel, listed in the order the sheets print.`
|
|
248
|
-
});
|
|
249
|
-
manifest.pages.forEach((page, pageIdx) => {
|
|
250
|
-
if (!page.optional) return;
|
|
251
|
-
ctx.addIssue({
|
|
252
|
-
code: z.ZodIssueCode.custom,
|
|
253
|
-
path: [
|
|
254
|
-
"pages",
|
|
255
|
-
pageIdx,
|
|
256
|
-
"optional"
|
|
257
|
-
],
|
|
258
|
-
message: `Page "${page.id}" is optional, but format "${format.id}" folds ${panels} panels to a sheet: every panel prints, so no page of a folded format may be optional.`
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
256
|
if (!presetGeometryMatches(format)) ctx.addIssue({
|
|
263
257
|
code: z.ZodIssueCode.custom,
|
|
264
258
|
path: [
|
package/dist/site-analytics.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { initAnalytics } from "./site-runtime/analytics.js";
|
|
2
2
|
import { initSiteIntegrations } from "./site-runtime/site-integrations.js";
|
|
3
|
+
import { initWindowHeight } from "./site-runtime/window-height.js";
|
|
3
4
|
|
|
4
5
|
//#region src/site-runtime/analytics-entry.ts
|
|
5
6
|
if (typeof window !== "undefined") {
|
|
6
7
|
const run = () => {
|
|
7
|
-
for (const init of [
|
|
8
|
+
for (const init of [
|
|
9
|
+
initWindowHeight,
|
|
10
|
+
initAnalytics,
|
|
11
|
+
initSiteIntegrations
|
|
12
|
+
]) try {
|
|
8
13
|
init();
|
|
9
14
|
} catch {}
|
|
10
15
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/site-runtime/window-height.ts
|
|
2
|
+
const WINDOW_HEIGHT_PROPERTY = "--concrete-window-h";
|
|
3
|
+
function initWindowHeight() {
|
|
4
|
+
const root = document.documentElement;
|
|
5
|
+
let pinnedWidth = window.innerWidth;
|
|
6
|
+
const pin = () => {
|
|
7
|
+
const height = window.innerHeight;
|
|
8
|
+
if (height > 0) root.style.setProperty(WINDOW_HEIGHT_PROPERTY, `${String(height)}px`);
|
|
9
|
+
};
|
|
10
|
+
pin();
|
|
11
|
+
window.addEventListener("resize", () => {
|
|
12
|
+
if (window.innerWidth === pinnedWidth) return;
|
|
13
|
+
pinnedWidth = window.innerWidth;
|
|
14
|
+
pin();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { WINDOW_HEIGHT_PROPERTY, initWindowHeight };
|
|
@@ -35,10 +35,19 @@ interface PageBase {
|
|
|
35
35
|
/** A website page: addressed by a URL path — `"/"` for the root, else one lowercase-kebab segment. */
|
|
36
36
|
interface WebsitePage extends PageBase {
|
|
37
37
|
readonly path: string;
|
|
38
|
+
readonly direction?: never;
|
|
38
39
|
}
|
|
39
40
|
/** A rendered class's page — a sheet, a slide, a frame — is not addressed by URL. */
|
|
40
41
|
interface RenderedPage extends PageBase {
|
|
41
42
|
readonly path?: never;
|
|
43
|
+
/**
|
|
44
|
+
* How the page's frame lays its sections out: `"column"` (the default) stacks them,
|
|
45
|
+
* `"row"` sets them side by side, each section setting its own width. A folded print
|
|
46
|
+
* piece declares one row page per printed side, one section per panel; every section
|
|
47
|
+
* of a row page must be `required` and declare no `visibility` rule, since a panel
|
|
48
|
+
* that dropped out would shift every later one onto the wrong fold.
|
|
49
|
+
*/
|
|
50
|
+
readonly direction?: "column" | "row";
|
|
42
51
|
}
|
|
43
52
|
/** One editing canvas: its canvas-bar label and the page ids it presents, in display order. */
|
|
44
53
|
interface CanvasInput<PageId extends string> {
|
|
@@ -93,6 +102,8 @@ interface TemplatePage {
|
|
|
93
102
|
readonly label: string;
|
|
94
103
|
readonly path?: string;
|
|
95
104
|
readonly optional: boolean;
|
|
105
|
+
/** Rendered pages only, as authored; absent is a column. */
|
|
106
|
+
readonly direction?: "column" | "row";
|
|
96
107
|
readonly page: PageComponent;
|
|
97
108
|
}
|
|
98
109
|
/** One canvas as the template value carries it — declared, or the stamped class default. */
|
|
@@ -19,6 +19,7 @@ function defineTemplate(input) {
|
|
|
19
19
|
label: page.label,
|
|
20
20
|
...page.path === void 0 ? {} : { path: page.path },
|
|
21
21
|
optional: page.optional ?? false,
|
|
22
|
+
...page.direction === void 0 ? {} : { direction: page.direction },
|
|
22
23
|
page: page.page
|
|
23
24
|
}));
|
|
24
25
|
if (pages.length === 0) throw new Error(`Template "${input.key}" declares no pages. \`pages\` is the site map — declare at least one.`);
|
|
@@ -17,6 +17,7 @@ function materializeTemplate(template, options = {}) {
|
|
|
17
17
|
throw new Error(`Page "${page.id}"${where === "" ? "" : ` (${where})`} emits markup that is not a section: ${excerpt(recorded.markup)}. A page may contain only sections and components that contain only sections — the platform has nowhere to put page markup.`);
|
|
18
18
|
}
|
|
19
19
|
for (const placement of recorded.placements) {
|
|
20
|
+
if (page.direction === "row" && "visibility" in placement.section.display) throw new Error(`Page "${page.id}" lays its sections out in a row, but section "${placement.key}" declares a \`display.visibility\` rule: a row page's sections are its panels and every one prints, so a section placed on one may not switch itself off. Draw an empty panel instead of hiding it.`);
|
|
20
21
|
placements.push(placement);
|
|
21
22
|
const prior = sectionOfInstance.get(placement.instance);
|
|
22
23
|
if (prior !== void 0 && prior !== placement.key) throw new Error(`Instance "${placement.instance}" names two sections: "${prior}" and "${placement.key}" (on page "${page.id}"). An instance id is one section's; name the second placement with \`instance\`.`);
|
|
@@ -34,6 +35,7 @@ function materializeTemplate(template, options = {}) {
|
|
|
34
35
|
label: page.label,
|
|
35
36
|
...page.path === void 0 ? {} : { path: page.path },
|
|
36
37
|
optional: page.optional,
|
|
38
|
+
...page.direction === void 0 ? {} : { direction: page.direction },
|
|
37
39
|
sections: recorded.placements.map((placement) => ({
|
|
38
40
|
section: placement.key,
|
|
39
41
|
instance_id: placement.instance,
|
|
@@ -3,7 +3,7 @@ purpose: Every `concrete` command, with its full flag surface, exit codes and co
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# Command reference
|
|
@@ -79,7 +79,7 @@ of its flags.
|
|
|
79
79
|
|
|
80
80
|
## Versions
|
|
81
81
|
|
|
82
|
-
These pages describe `@homepages/concrete` **>=
|
|
82
|
+
These pages describe `@homepages/concrete` **>=12.0.0 <13.0.0**. The range, rather than
|
|
83
83
|
the exact version they were generated from: this reference is committed build output,
|
|
84
84
|
so a page stamped with a patch version would be stale the day it shipped.
|
|
85
85
|
`concrete --version` prints the installed one.
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete build` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete build
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete check` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete check
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete dev` command — its flags, exit codes and constraints.
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete dev
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property add` command — its flags, exit codes and const
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property add
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete property list` command — its flags, exit codes and cons
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete property list
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete publish` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete publish
|
|
@@ -3,7 +3,7 @@ purpose: The `concrete upgrade` command — its flags, exit codes and constraint
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete command table
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/INDEX.md]
|
|
8
8
|
---
|
|
9
9
|
# concrete upgrade
|
|
@@ -3,7 +3,7 @@ purpose: Every rule `concrete check` grades, by the stage that grades it, in the
|
|
|
3
3
|
mode: reference
|
|
4
4
|
status: generated
|
|
5
5
|
generated_from: the concrete rule registry
|
|
6
|
-
applies_to: "@homepages/concrete >=
|
|
6
|
+
applies_to: "@homepages/concrete >=12.0.0 <13.0.0"
|
|
7
7
|
related: [reference/cli/check.md]
|
|
8
8
|
---
|
|
9
9
|
# Rule reference
|
|
@@ -78,7 +78,7 @@ Each page is rendered once under the page probe, and the composition it places p
|
|
|
78
78
|
|---|---|---|
|
|
79
79
|
| `concrete/pages/non-section-markup` | probe | A page emits markup that is not a section; a page may contain only sections. |
|
|
80
80
|
| `concrete/pages/section-not-exported` | probe | A page places a section no module exports, so the build cannot bundle it alone. |
|
|
81
|
-
| `concrete/pages/composition-invalid` | probe | The composition the pages place breaks a page, canvas
|
|
81
|
+
| `concrete/pages/composition-invalid` | probe | The composition the pages place breaks a page, canvas or instance rule. |
|
|
82
82
|
|
|
83
83
|
## relations
|
|
84
84
|
|