barakopress 0.3.0 → 0.4.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/README.md +862 -27
- package/dist/assets.d.ts +40 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +188 -0
- package/dist/assets.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +9 -0
- package/dist/bin.js.map +1 -0
- package/dist/blocks/bind.d.ts +39 -0
- package/dist/blocks/bind.d.ts.map +1 -0
- package/dist/blocks/bind.js +291 -0
- package/dist/blocks/bind.js.map +1 -0
- package/dist/blocks/bindings.d.ts +80 -0
- package/dist/blocks/bindings.d.ts.map +1 -0
- package/dist/blocks/bindings.js +281 -0
- package/dist/blocks/bindings.js.map +1 -0
- package/dist/blocks/built-in.d.ts +18 -0
- package/dist/blocks/built-in.d.ts.map +1 -0
- package/dist/blocks/built-in.js +191 -0
- package/dist/blocks/built-in.js.map +1 -0
- package/dist/blocks/data.d.ts +20 -0
- package/dist/blocks/data.d.ts.map +1 -0
- package/dist/blocks/data.js +131 -0
- package/dist/blocks/data.js.map +1 -0
- package/dist/blocks/library.d.ts +7 -0
- package/dist/blocks/library.d.ts.map +1 -0
- package/dist/blocks/library.js +398 -0
- package/dist/blocks/library.js.map +1 -0
- package/dist/blocks/presets.d.ts +68 -0
- package/dist/blocks/presets.d.ts.map +1 -0
- package/dist/blocks/presets.js +234 -0
- package/dist/blocks/presets.js.map +1 -0
- package/dist/blocks/primitives.d.ts +12 -0
- package/dist/blocks/primitives.d.ts.map +1 -0
- package/dist/blocks/primitives.js +577 -0
- package/dist/blocks/primitives.js.map +1 -0
- package/dist/blocks/registry.d.ts +23 -0
- package/dist/blocks/registry.d.ts.map +1 -0
- package/dist/blocks/registry.js +57 -0
- package/dist/blocks/registry.js.map +1 -0
- package/dist/blocks/render.d.ts +8 -0
- package/dist/blocks/render.d.ts.map +1 -0
- package/dist/blocks/render.js +24 -0
- package/dist/blocks/render.js.map +1 -0
- package/dist/blocks/schema.d.ts +123 -0
- package/dist/blocks/schema.d.ts.map +1 -0
- package/dist/blocks/schema.js +183 -0
- package/dist/blocks/schema.js.map +1 -0
- package/dist/blocks/tokens.d.ts +31 -0
- package/dist/blocks/tokens.d.ts.map +1 -0
- package/dist/blocks/tokens.js +111 -0
- package/dist/blocks/tokens.js.map +1 -0
- package/dist/cms.d.ts +82 -0
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +169 -3
- package/dist/cms.js.map +1 -1
- package/dist/collections.d.ts +67 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +217 -0
- package/dist/collections.js.map +1 -0
- package/dist/config.d.ts +273 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +208 -13
- package/dist/config.js.map +1 -1
- package/dist/delivery.d.ts +87 -1
- package/dist/delivery.d.ts.map +1 -1
- package/dist/delivery.js +316 -13
- package/dist/delivery.js.map +1 -1
- package/dist/env.d.ts +37 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +44 -0
- package/dist/env.js.map +1 -0
- package/dist/fonts.d.ts +53 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +170 -0
- package/dist/fonts.js.map +1 -0
- package/dist/index.d.ts +48 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +7 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +22 -5
- package/dist/markdown.js.map +1 -1
- package/dist/proxy.d.ts +18 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +83 -0
- package/dist/proxy.js.map +1 -0
- package/dist/related.d.ts +10 -0
- package/dist/related.d.ts.map +1 -1
- package/dist/related.js +10 -1
- package/dist/related.js.map +1 -1
- package/dist/revalidate-key.d.ts +9 -0
- package/dist/revalidate-key.d.ts.map +1 -0
- package/dist/revalidate-key.js +35 -0
- package/dist/revalidate-key.js.map +1 -0
- package/dist/routes/block-schema.d.ts +11 -0
- package/dist/routes/block-schema.d.ts.map +1 -0
- package/dist/routes/block-schema.js +54 -0
- package/dist/routes/block-schema.js.map +1 -0
- package/dist/routes/feed.d.ts +6 -2
- package/dist/routes/feed.d.ts.map +1 -1
- package/dist/routes/feed.js +38 -27
- package/dist/routes/feed.js.map +1 -1
- package/dist/routes/revalidate.d.ts +6 -1
- package/dist/routes/revalidate.d.ts.map +1 -1
- package/dist/routes/revalidate.js +60 -16
- package/dist/routes/revalidate.js.map +1 -1
- package/dist/routes/robots.d.ts +1 -1
- package/dist/routes/robots.d.ts.map +1 -1
- package/dist/routes/robots.js +11 -3
- package/dist/routes/robots.js.map +1 -1
- package/dist/routes/share.d.ts +11 -0
- package/dist/routes/share.d.ts.map +1 -0
- package/dist/routes/share.js +158 -0
- package/dist/routes/share.js.map +1 -0
- package/dist/routes/sitemap.d.ts +1 -1
- package/dist/routes/sitemap.d.ts.map +1 -1
- package/dist/routes/sitemap.js +51 -22
- package/dist/routes/sitemap.js.map +1 -1
- package/dist/screens/archive.d.ts +7 -5
- package/dist/screens/archive.d.ts.map +1 -1
- package/dist/screens/archive.js +10 -38
- package/dist/screens/archive.js.map +1 -1
- package/dist/screens/blog-index.d.ts +5 -8
- package/dist/screens/blog-index.d.ts.map +1 -1
- package/dist/screens/blog-index.js +9 -32
- package/dist/screens/blog-index.js.map +1 -1
- package/dist/screens/blog-post.d.ts +20 -11
- package/dist/screens/blog-post.d.ts.map +1 -1
- package/dist/screens/blog-post.js +21 -84
- package/dist/screens/blog-post.js.map +1 -1
- package/dist/screens/collection.d.ts +91 -0
- package/dist/screens/collection.d.ts.map +1 -0
- package/dist/screens/collection.js +206 -0
- package/dist/screens/collection.js.map +1 -0
- package/dist/screens/navigation.d.ts +16 -0
- package/dist/screens/navigation.d.ts.map +1 -0
- package/dist/screens/navigation.js +40 -0
- package/dist/screens/navigation.js.map +1 -0
- package/dist/screens/page.d.ts +59 -0
- package/dist/screens/page.d.ts.map +1 -0
- package/dist/screens/page.js +260 -0
- package/dist/screens/page.js.map +1 -0
- package/dist/screens/post-view.d.ts.map +1 -1
- package/dist/screens/post-view.js +3 -3
- package/dist/screens/post-view.js.map +1 -1
- package/dist/screens/site-layout.d.ts +20 -0
- package/dist/screens/site-layout.d.ts.map +1 -0
- package/dist/screens/site-layout.js +223 -0
- package/dist/screens/site-layout.js.map +1 -0
- package/dist/secret.d.ts +20 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +31 -0
- package/dist/secret.js.map +1 -0
- package/dist/site-route.d.ts +28 -0
- package/dist/site-route.d.ts.map +1 -0
- package/dist/site-route.js +104 -0
- package/dist/site-route.js.map +1 -0
- package/dist/site.d.ts +72 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +729 -0
- package/dist/site.js.map +1 -0
- package/dist/theme.d.ts +63 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +65 -0
- package/dist/theme.js.map +1 -1
- package/package.json +14 -1
- package/src/assets.tsx +233 -0
- package/src/bin.ts +7 -0
- package/src/blocks/bind.ts +393 -0
- package/src/blocks/bindings.ts +338 -0
- package/src/blocks/built-in.tsx +293 -0
- package/src/blocks/data.tsx +179 -0
- package/src/blocks/library.ts +459 -0
- package/src/blocks/presets.ts +319 -0
- package/src/blocks/primitives.tsx +811 -0
- package/src/blocks/registry.ts +65 -0
- package/src/blocks/render.tsx +37 -0
- package/src/blocks/schema.ts +330 -0
- package/src/blocks/tokens.ts +136 -0
- package/src/cms.ts +237 -2
- package/src/collections.ts +286 -0
- package/src/config.ts +478 -18
- package/src/delivery.ts +358 -16
- package/src/env.ts +68 -0
- package/src/fonts.ts +189 -0
- package/src/index.ts +205 -4
- package/src/markdown.ts +28 -5
- package/src/proxy.ts +93 -0
- package/src/related.ts +25 -3
- package/src/revalidate-key.ts +40 -0
- package/src/routes/block-schema.ts +71 -0
- package/src/routes/feed.ts +47 -22
- package/src/routes/revalidate.ts +68 -17
- package/src/routes/robots.ts +9 -3
- package/src/routes/share.ts +169 -0
- package/src/routes/sitemap.ts +52 -22
- package/src/screens/archive.tsx +14 -69
- package/src/screens/blog-index.tsx +9 -114
- package/src/screens/blog-post.tsx +26 -89
- package/src/screens/collection.tsx +388 -0
- package/src/screens/navigation.tsx +101 -0
- package/src/screens/page.tsx +381 -0
- package/src/screens/post-view.tsx +4 -4
- package/src/screens/site-layout.tsx +446 -0
- package/src/secret.ts +44 -0
- package/src/site-route.ts +116 -0
- package/src/site.ts +823 -0
- package/src/theme.ts +134 -0
package/dist/assets.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { type RenderMarkdownOptions } from "./markdown.js";
|
|
3
|
+
import type { PressTheme, SuppliedAsset } from "./theme.js";
|
|
4
|
+
/** The clear space a marked asset gets when it names none. A name from the theme's spacing scale. */
|
|
5
|
+
export declare const DEFAULT_CLEAR_SPACE = "md";
|
|
6
|
+
/**
|
|
7
|
+
* Everything the theme could do to a mark, turned off.
|
|
8
|
+
*
|
|
9
|
+
* Longhand where a shorthand would leave part of the property alone, and written once so the
|
|
10
|
+
* component path and the markdown path cannot come to mean different things.
|
|
11
|
+
*/
|
|
12
|
+
export declare const NO_TREATMENT: CSSProperties;
|
|
13
|
+
/** The entry for this image, if the site marked it as used as supplied. */
|
|
14
|
+
export declare function suppliedAssetFor(theme: PressTheme, src: string | undefined): SuppliedAsset | undefined;
|
|
15
|
+
/** What a block says about its own image: `asSupplied` marks it, `clearSpace` widens the space. */
|
|
16
|
+
export interface SuppliedProps {
|
|
17
|
+
asSupplied?: boolean;
|
|
18
|
+
clearSpace?: string;
|
|
19
|
+
}
|
|
20
|
+
/** The protection this image gets: the site's entry for it, the block's own mark, or neither. */
|
|
21
|
+
export declare function suppliedAssetOn(theme: PressTheme, src: string | undefined, block?: SuppliedProps): SuppliedAsset | undefined;
|
|
22
|
+
export declare function clearSpaceOf(theme: PressTheme, asset: SuppliedAsset): string;
|
|
23
|
+
export interface AssetProps {
|
|
24
|
+
src: string;
|
|
25
|
+
alt?: string;
|
|
26
|
+
theme: PressTheme;
|
|
27
|
+
/** What the caller would draw. Everything but position and size is dropped for a marked asset. */
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
loading?: "lazy" | "eager";
|
|
30
|
+
/** A block's own marking, when it has one. The site's list is read either way. */
|
|
31
|
+
supplied?: SuppliedProps;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every image the engine draws. An asset the site has not marked renders exactly as the caller
|
|
35
|
+
* asked, which is why nothing about an existing site changes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Asset({ src, alt, theme, style, loading, supplied }: AssetProps): ReactNode;
|
|
38
|
+
/** Markdown, with any marked asset in it drawn as supplied. */
|
|
39
|
+
export declare function renderProse(source: string, theme: PressTheme, options?: RenderMarkdownOptions): string;
|
|
40
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAyB5D,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,aAiB1B,CAAC;AA+CF,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAItG;AAcD,mGAAmG;AACnG,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iGAAiG;AACjG,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,GAAE,aAAkB,GAC1B,aAAa,GAAG,SAAS,CAM3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,CAE5E;AAED,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,kGAAkG;IAClG,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,SAAS,CA+B1F;AA2BD,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAetG"}
|
package/dist/assets.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { renderMarkdown } from "./markdown.js";
|
|
3
|
+
import { spaceOf, SPACES } from "./blocks/tokens.js";
|
|
4
|
+
/*
|
|
5
|
+
* Assets used exactly as supplied (barakoPress #29).
|
|
6
|
+
*
|
|
7
|
+
* Some marks arrive with an identity manual: never recoloured, never outlined, never put in a box,
|
|
8
|
+
* never crowded. A renderer that rounds a corner or drops a logo into a tinted panel breaks that
|
|
9
|
+
* without anyone noticing, because on screen it looks like a nice touch.
|
|
10
|
+
*
|
|
11
|
+
* So an asset can be marked as used as supplied. The file is drawn as it is, a minimum clear space
|
|
12
|
+
* is held around it, and nothing the theme or a block asks for reaches it: no tint, no border, no
|
|
13
|
+
* corner, no shadow, no filter, no crop. A block that wanted to frame it draws the mark alone.
|
|
14
|
+
*
|
|
15
|
+
* Two decisions worth stating.
|
|
16
|
+
*
|
|
17
|
+
* The list lives on the theme, next to the tokens, because the theme is the one thing every drawing
|
|
18
|
+
* path already carries: a block component is handed its props, its slots and the theme, and nothing
|
|
19
|
+
* else. A list a block cannot see is a rule that is silently not kept in blocks. Read it as the part
|
|
20
|
+
* of the theme that says what the theme may not touch.
|
|
21
|
+
*
|
|
22
|
+
* The rule is kept in one place, `Asset`, rather than at each `<img>`. A rule enforced in four
|
|
23
|
+
* places is a rule forgotten in the fifth, and the forgetting is invisible. `assets.test.tsx` walks
|
|
24
|
+
* every path an image is drawn through and fails if a new `<img` appears outside this file.
|
|
25
|
+
*/
|
|
26
|
+
/** The clear space a marked asset gets when it names none. A name from the theme's spacing scale. */
|
|
27
|
+
export const DEFAULT_CLEAR_SPACE = "md";
|
|
28
|
+
/**
|
|
29
|
+
* Everything the theme could do to a mark, turned off.
|
|
30
|
+
*
|
|
31
|
+
* Longhand where a shorthand would leave part of the property alone, and written once so the
|
|
32
|
+
* component path and the markdown path cannot come to mean different things.
|
|
33
|
+
*/
|
|
34
|
+
export const NO_TREATMENT = {
|
|
35
|
+
background: "none",
|
|
36
|
+
border: "0",
|
|
37
|
+
borderRadius: "0",
|
|
38
|
+
boxShadow: "none",
|
|
39
|
+
outline: "none",
|
|
40
|
+
filter: "none",
|
|
41
|
+
backdropFilter: "none",
|
|
42
|
+
mixBlendMode: "normal",
|
|
43
|
+
opacity: "1",
|
|
44
|
+
clipPath: "none",
|
|
45
|
+
maskImage: "none",
|
|
46
|
+
// Sizing is allowed, cropping is not: with both dimensions set the mark is fitted inside them
|
|
47
|
+
// rather than filled to them.
|
|
48
|
+
objectFit: "contain",
|
|
49
|
+
objectPosition: "center",
|
|
50
|
+
transform: "none",
|
|
51
|
+
};
|
|
52
|
+
/*
|
|
53
|
+
* The style a caller asked for, filtered.
|
|
54
|
+
*
|
|
55
|
+
* An allowlist rather than a list of banned properties: the point is that a treatment nobody has
|
|
56
|
+
* thought of yet is dropped by default. What survives is where the mark sits and how big it is.
|
|
57
|
+
* `OUTER` goes on the box that holds the clear space, `INNER` on the image inside it, because the
|
|
58
|
+
* clear space is outside the mark and a width belongs to the whole thing.
|
|
59
|
+
*/
|
|
60
|
+
const OUTER = new Set([
|
|
61
|
+
"display",
|
|
62
|
+
"width",
|
|
63
|
+
"maxWidth",
|
|
64
|
+
"minWidth",
|
|
65
|
+
"margin",
|
|
66
|
+
"marginTop",
|
|
67
|
+
"marginRight",
|
|
68
|
+
"marginBottom",
|
|
69
|
+
"marginLeft",
|
|
70
|
+
"marginBlock",
|
|
71
|
+
"marginInline",
|
|
72
|
+
"float",
|
|
73
|
+
"verticalAlign",
|
|
74
|
+
"flex",
|
|
75
|
+
"flexShrink",
|
|
76
|
+
"flexGrow",
|
|
77
|
+
"alignSelf",
|
|
78
|
+
]);
|
|
79
|
+
const INNER = new Set(["height", "maxHeight", "minHeight"]);
|
|
80
|
+
function only(style, names) {
|
|
81
|
+
const out = {};
|
|
82
|
+
for (const [name, value] of Object.entries(style ?? {})) {
|
|
83
|
+
if (names.has(name) && value !== undefined)
|
|
84
|
+
out[name] = value;
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
/** A URL without its query or fragment, so a mark resized by the CMS with `?w=480` is that mark. */
|
|
89
|
+
function markKey(url) {
|
|
90
|
+
const value = url.trim();
|
|
91
|
+
const marks = [value.indexOf("?"), value.indexOf("#")].filter((i) => i !== -1);
|
|
92
|
+
return marks.length > 0 ? value.slice(0, Math.min(...marks)) : value;
|
|
93
|
+
}
|
|
94
|
+
/** The entry for this image, if the site marked it as used as supplied. */
|
|
95
|
+
export function suppliedAssetFor(theme, src) {
|
|
96
|
+
if (!src)
|
|
97
|
+
return undefined;
|
|
98
|
+
const key = markKey(src);
|
|
99
|
+
return theme.asSupplied.find((asset) => markKey(asset.url) === key);
|
|
100
|
+
}
|
|
101
|
+
/*
|
|
102
|
+
* The clear space is a minimum, so when the site and the block both name one the wider wins. A
|
|
103
|
+
* block asking for room around a mark is honoured; a block asking for less than the site's minimum
|
|
104
|
+
* is not, which is the whole point of calling it a minimum.
|
|
105
|
+
*/
|
|
106
|
+
function widerSpace(a, b) {
|
|
107
|
+
const rank = (name) => SPACES.indexOf(name ?? "");
|
|
108
|
+
if (rank(a) === -1)
|
|
109
|
+
return rank(b) === -1 ? undefined : b;
|
|
110
|
+
if (rank(b) === -1)
|
|
111
|
+
return a;
|
|
112
|
+
return rank(a) >= rank(b) ? a : b;
|
|
113
|
+
}
|
|
114
|
+
/** The protection this image gets: the site's entry for it, the block's own mark, or neither. */
|
|
115
|
+
export function suppliedAssetOn(theme, src, block = {}) {
|
|
116
|
+
if (!src)
|
|
117
|
+
return undefined;
|
|
118
|
+
const site = suppliedAssetFor(theme, src);
|
|
119
|
+
if (!site && block.asSupplied !== true)
|
|
120
|
+
return undefined;
|
|
121
|
+
const clearSpace = widerSpace(site?.clearSpace, block.clearSpace);
|
|
122
|
+
return { url: src, ...(clearSpace ? { clearSpace } : {}) };
|
|
123
|
+
}
|
|
124
|
+
export function clearSpaceOf(theme, asset) {
|
|
125
|
+
return spaceOf(theme, asset.clearSpace, DEFAULT_CLEAR_SPACE);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Every image the engine draws. An asset the site has not marked renders exactly as the caller
|
|
129
|
+
* asked, which is why nothing about an existing site changes.
|
|
130
|
+
*/
|
|
131
|
+
export function Asset({ src, alt, theme, style, loading, supplied }) {
|
|
132
|
+
const asset = suppliedAssetOn(theme, src, supplied);
|
|
133
|
+
if (!asset) {
|
|
134
|
+
return _jsx("img", { src: src, alt: alt ?? "", loading: loading, style: style });
|
|
135
|
+
}
|
|
136
|
+
return (_jsx("span", { "data-as-supplied": "", style: {
|
|
137
|
+
// Inline-block so the box is the mark's own, and border-box so the clear space is
|
|
138
|
+
// inside whatever width the caller asked for instead of overflowing it on a phone.
|
|
139
|
+
display: "inline-block",
|
|
140
|
+
boxSizing: "border-box",
|
|
141
|
+
maxWidth: "100%",
|
|
142
|
+
...only(style, OUTER),
|
|
143
|
+
padding: clearSpaceOf(theme, asset),
|
|
144
|
+
// An inline-block sits on the text baseline, and the descender gap under it would
|
|
145
|
+
// make the clear space uneven.
|
|
146
|
+
lineHeight: 0,
|
|
147
|
+
...NO_TREATMENT,
|
|
148
|
+
}, children: _jsx("img", { src: src, alt: alt ?? "", loading: loading, style: { display: "block", maxWidth: "100%", ...only(style, INNER), ...NO_TREATMENT } }) }));
|
|
149
|
+
}
|
|
150
|
+
/* ------------------------------------------------------------------- markdown */
|
|
151
|
+
/*
|
|
152
|
+
* Markdown is the one path where the image is a string of HTML rather than a component, and the
|
|
153
|
+
* generated prose stylesheet gives every image in it a corner and a hairline. An inline style is
|
|
154
|
+
* what beats that, and it beats a consumer's own stylesheet too, which is why the declarations go on
|
|
155
|
+
* the tag rather than into another rule.
|
|
156
|
+
*/
|
|
157
|
+
function declarations(style) {
|
|
158
|
+
return Object.entries(style)
|
|
159
|
+
.map(([name, value]) => `${name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}:${css(String(value))}`)
|
|
160
|
+
.join(";");
|
|
161
|
+
}
|
|
162
|
+
/** A token is a configured string rather than a constant, so it cannot close the attribute early. */
|
|
163
|
+
function css(value) {
|
|
164
|
+
return value.replace(/["'<>;]/g, "");
|
|
165
|
+
}
|
|
166
|
+
const ENTITIES = { "&": "&", """: '"', "'": "'", "<": "<", ">": ">" };
|
|
167
|
+
function unescapeHtml(value) {
|
|
168
|
+
return value.replace(/&(amp|quot|#x27|lt|gt);/g, (entity) => ENTITIES[entity] ?? entity);
|
|
169
|
+
}
|
|
170
|
+
/** Markdown, with any marked asset in it drawn as supplied. */
|
|
171
|
+
export function renderProse(source, theme, options) {
|
|
172
|
+
const html = renderMarkdown(source, options);
|
|
173
|
+
if (theme.asSupplied.length === 0 || !html.includes("<img"))
|
|
174
|
+
return html;
|
|
175
|
+
return html.replace(/<img src="([^"]*)"/g, (tag, src) => {
|
|
176
|
+
const asset = suppliedAssetFor(theme, unescapeHtml(src));
|
|
177
|
+
if (!asset)
|
|
178
|
+
return tag;
|
|
179
|
+
const style = declarations({
|
|
180
|
+
...NO_TREATMENT,
|
|
181
|
+
boxSizing: "border-box",
|
|
182
|
+
maxWidth: "100%",
|
|
183
|
+
padding: clearSpaceOf(theme, asset),
|
|
184
|
+
});
|
|
185
|
+
return `<img style="${style}" src="${src}"`;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qGAAqG;AACrG,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB;IACvC,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,GAAG;IACX,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,QAAQ;IACtB,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,8FAA8F;IAC9F,8BAA8B;IAC9B,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,QAAQ;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O,CAAC,qBAAqB,EAAE,CAAC,GAAG,EAAE,GAAW,EAAE,EAAE;QAC5D,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK;YAAE,OAAO,GAAG,CAAC;QACvB,MAAM,KAAK,GAAG,YAAY,CAAC;YACvB,GAAG,YAAY;YACf,SAAS,EAAE,YAAY;YACvB,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC;SACtC,CAAC,CAAC;QACH,OAAO,eAAe,KAAK,UAAU,GAAG,GAAG,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCli } from "./revalidate-key.js";
|
|
3
|
+
const result = runCli(process.argv.slice(2), process.env);
|
|
4
|
+
if (result.out)
|
|
5
|
+
console.log(result.out);
|
|
6
|
+
if (result.err)
|
|
7
|
+
console.error(result.err);
|
|
8
|
+
process.exitCode = result.code;
|
|
9
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;AAC1D,IAAI,MAAM,CAAC,GAAG;IAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACxC,IAAI,MAAM,CAAC,GAAG;IAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1C,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PressConfig } from "../config.js";
|
|
2
|
+
import { type Item } from "../collections.js";
|
|
3
|
+
import type { Page } from "../cms.js";
|
|
4
|
+
import { type BindingProblem, type BindingScopes } from "./bindings.js";
|
|
5
|
+
import { type BlockRegistry, type ResolvedBlock } from "./schema.js";
|
|
6
|
+
export interface BindContext {
|
|
7
|
+
config: PressConfig;
|
|
8
|
+
registry: BlockRegistry;
|
|
9
|
+
budget: {
|
|
10
|
+
blocks: number;
|
|
11
|
+
reads: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface BindPageOptions {
|
|
15
|
+
config: PressConfig;
|
|
16
|
+
registry: BlockRegistry;
|
|
17
|
+
scopes: BindingScopes;
|
|
18
|
+
onProblem?: (problem: BindingProblem) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function bindBlocks(blocks: ResolvedBlock[], options: BindPageOptions): Promise<ResolvedBlock[]>;
|
|
21
|
+
/**
|
|
22
|
+
* What `{{item.X}}` reads.
|
|
23
|
+
*
|
|
24
|
+
* The entry's own fields come first under the names the tenant gave them, because a client's model
|
|
25
|
+
* is its own and `{{item.Headline}}` has to work. The engine's names are laid over them, so
|
|
26
|
+
* `{{item.Title}}` means the title whatever the field is called.
|
|
27
|
+
*/
|
|
28
|
+
export declare function itemScope(config: PressConfig, item: Item): Record<string, unknown>;
|
|
29
|
+
/** What `{{page.X}}` reads, the same way round: the entry's fields, then the engine's names. */
|
|
30
|
+
export declare function pageScope(page: Page): Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* What `{{site.X}}` reads: the tenant's site settings, with the identity the engine resolved laid
|
|
33
|
+
* over them. A build-time site has no settings entry and still answers `{{site.Name}}`, because the
|
|
34
|
+
* identity is where its name lives.
|
|
35
|
+
*/
|
|
36
|
+
export declare function siteScope(config: PressConfig, globals: Record<string, unknown>): Record<string, unknown>;
|
|
37
|
+
/** What `{{query.X}}` reads. Strings only, and one value per name: the first the URL carries. */
|
|
38
|
+
export declare function queryScope(params: Record<string, string | string[] | undefined> | URLSearchParams): Record<string, string>;
|
|
39
|
+
//# sourceMappingURL=bind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/blocks/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAyC,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAuC,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAW7G,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,aAAa,EACrB,MAAM,aAAa,CAAC;AAsCrB,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAED,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACjD;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAY5G;AA8OD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBlF;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAS7D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUxG;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW1H"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { collectionOf, getItem, listCollection } from "../collections.js";
|
|
2
|
+
import { BindingSource, bindText, hasBinding } from "./bindings.js";
|
|
3
|
+
import { MAX_SOURCES, MAX_SOURCE_ROWS, PAGER_BLOCK, REPEAT_BLOCK, SHOW_IF_BLOCK, SLOT_BLOCK, SOURCE_BLOCK, writePagerState, } from "./data.js";
|
|
4
|
+
import { MAX_BLOCKS, accepts, isBindable, } from "./schema.js";
|
|
5
|
+
export async function bindBlocks(blocks, options) {
|
|
6
|
+
const source = new BindingSource(options.scopes, {
|
|
7
|
+
locale: options.config.locale,
|
|
8
|
+
currency: options.config.currency,
|
|
9
|
+
onProblem: options.onProblem,
|
|
10
|
+
});
|
|
11
|
+
const ctx = {
|
|
12
|
+
config: options.config,
|
|
13
|
+
registry: options.registry,
|
|
14
|
+
budget: { blocks: MAX_BLOCKS, reads: MAX_SOURCES },
|
|
15
|
+
};
|
|
16
|
+
return bindList(blocks, { source }, ctx);
|
|
17
|
+
}
|
|
18
|
+
async function bindList(blocks, frame, ctx) {
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const block of blocks) {
|
|
21
|
+
if (ctx.budget.blocks <= 0)
|
|
22
|
+
break;
|
|
23
|
+
ctx.budget.blocks--;
|
|
24
|
+
out.push(...(await bindBlock(block, frame, ctx)));
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
async function bindBlock(block, frame, ctx) {
|
|
29
|
+
switch (block.definition.type) {
|
|
30
|
+
case SHOW_IF_BLOCK:
|
|
31
|
+
return bindShowIf(block, frame, ctx);
|
|
32
|
+
case SOURCE_BLOCK:
|
|
33
|
+
return bindSource(block, frame, ctx);
|
|
34
|
+
case REPEAT_BLOCK:
|
|
35
|
+
return bindRepeat(block, frame, ctx);
|
|
36
|
+
case SLOT_BLOCK:
|
|
37
|
+
return bindSlot(block, frame, ctx);
|
|
38
|
+
case PAGER_BLOCK:
|
|
39
|
+
return bindPager(block, frame);
|
|
40
|
+
}
|
|
41
|
+
const bound = await bindProps(block, frame.source, {});
|
|
42
|
+
if (!bound)
|
|
43
|
+
return [];
|
|
44
|
+
if (block.definition.preset)
|
|
45
|
+
return expandPreset(block, bound, frame, ctx);
|
|
46
|
+
return [{ ...block, props: bound, slots: await bindSlots(block, frame, ctx) }];
|
|
47
|
+
}
|
|
48
|
+
async function bindSlots(block, frame, ctx) {
|
|
49
|
+
const slots = {};
|
|
50
|
+
for (const [name, lists] of Object.entries(block.slots)) {
|
|
51
|
+
slots[name] = [];
|
|
52
|
+
for (const list of lists)
|
|
53
|
+
slots[name].push(await bindList(list, frame, ctx));
|
|
54
|
+
}
|
|
55
|
+
return slots;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A block's props with every placeholder resolved, or null when the block must not render.
|
|
59
|
+
*
|
|
60
|
+
* A bound value goes through the field that accepted the template, so a `url` field whose binding
|
|
61
|
+
* resolves to `javascript:` drops the block exactly as a stored one would. That second check is the
|
|
62
|
+
* point: the first ran against the placeholder, which says nothing about what it stands for.
|
|
63
|
+
*/
|
|
64
|
+
async function bindProps(block, source, options) {
|
|
65
|
+
const fields = block.definition.fields;
|
|
66
|
+
const props = { ...block.props };
|
|
67
|
+
for (const field of fields) {
|
|
68
|
+
const value = props[field.name];
|
|
69
|
+
if (typeof value !== "string" || !isBindable(field) || !hasBinding(value))
|
|
70
|
+
continue;
|
|
71
|
+
const { text } = await bindText(value, source);
|
|
72
|
+
if (text === "") {
|
|
73
|
+
if (options.allowEmpty) {
|
|
74
|
+
props[field.name] = "";
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (field.required)
|
|
78
|
+
return null;
|
|
79
|
+
delete props[field.name];
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (!accepts(field, text))
|
|
83
|
+
return null;
|
|
84
|
+
props[field.name] = text;
|
|
85
|
+
}
|
|
86
|
+
return props;
|
|
87
|
+
}
|
|
88
|
+
/** One prop bound on its own, for a control block that acts on the value rather than rendering it. */
|
|
89
|
+
async function boundString(block, source, name) {
|
|
90
|
+
const value = block.props[name];
|
|
91
|
+
if (typeof value !== "string")
|
|
92
|
+
return "";
|
|
93
|
+
if (!hasBinding(value))
|
|
94
|
+
return value;
|
|
95
|
+
return (await bindText(value, source)).text;
|
|
96
|
+
}
|
|
97
|
+
/* ------------------------------------------------------------- control blocks */
|
|
98
|
+
async function bindShowIf(block, frame, ctx) {
|
|
99
|
+
const value = (await boundString(block, frame.source, "value")).trim();
|
|
100
|
+
const equals = (await boundString(block, frame.source, "equals")).trim();
|
|
101
|
+
const met = equals === "" ? value !== "" : value === equals;
|
|
102
|
+
const show = block.props.unless === true ? !met : met;
|
|
103
|
+
if (!show)
|
|
104
|
+
return [];
|
|
105
|
+
return bindList(block.slots.content?.[0] ?? [], frame, ctx);
|
|
106
|
+
}
|
|
107
|
+
async function bindSlot(block, frame, ctx) {
|
|
108
|
+
const name = typeof block.props.name === "string" ? block.props.name : "";
|
|
109
|
+
const filled = frame.slots?.[name];
|
|
110
|
+
if (!filled)
|
|
111
|
+
return [];
|
|
112
|
+
const out = [];
|
|
113
|
+
// Each list binds in the scope it was written in, which is the one outside the preset. A block
|
|
114
|
+
// an editor dropped into a preset's slot reads the page, not the preset's props.
|
|
115
|
+
for (const list of filled)
|
|
116
|
+
out.push(...(await bindList(list.blocks, { source: list.source }, ctx)));
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function bindPager(block, frame) {
|
|
120
|
+
const pager = frame.rows?.pager;
|
|
121
|
+
if (!pager)
|
|
122
|
+
return [];
|
|
123
|
+
return [{ ...block, props: { ...block.props, state: writePagerState(pager) }, slots: {} }];
|
|
124
|
+
}
|
|
125
|
+
async function bindRepeat(block, frame, ctx) {
|
|
126
|
+
const content = block.slots.content?.[0] ?? [];
|
|
127
|
+
const items = frame.rows?.items ?? [];
|
|
128
|
+
const limit = typeof block.props.limit === "number" ? block.props.limit : MAX_SOURCE_ROWS;
|
|
129
|
+
if (items.length === 0) {
|
|
130
|
+
const empty = await boundString(block, frame.source, "empty");
|
|
131
|
+
return empty.trim() === "" ? [] : emptyText(ctx, empty);
|
|
132
|
+
}
|
|
133
|
+
const out = [];
|
|
134
|
+
for (const item of items.slice(0, limit)) {
|
|
135
|
+
if (ctx.budget.blocks <= 0)
|
|
136
|
+
break;
|
|
137
|
+
const scope = itemScope(ctx.config, item);
|
|
138
|
+
out.push(...(await bindList(content, { ...frame, source: frame.source.with({ item: () => scope }) }, ctx)));
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
/*
|
|
143
|
+
* "Nothing here" goes through the site's own `text` block rather than markup of its own, so it
|
|
144
|
+
* takes the site's typography and a site that replaced `text` sees its own. A repeat with no rows
|
|
145
|
+
* and no line renders nothing, which is right for a band that is simply not filled in yet.
|
|
146
|
+
*/
|
|
147
|
+
function emptyText(ctx, value) {
|
|
148
|
+
const definition = ctx.registry.get("text");
|
|
149
|
+
return definition ? [{ definition, props: { value }, slots: {} }] : [];
|
|
150
|
+
}
|
|
151
|
+
/* ------------------------------------------------------------------ source */
|
|
152
|
+
async function bindSource(block, frame, ctx) {
|
|
153
|
+
const content = block.slots.content?.[0] ?? [];
|
|
154
|
+
if (ctx.budget.reads <= 0)
|
|
155
|
+
return [];
|
|
156
|
+
ctx.budget.reads--;
|
|
157
|
+
const key = await boundString(block, frame.source, "collection");
|
|
158
|
+
if (!collectionOf(ctx.config, key))
|
|
159
|
+
return [];
|
|
160
|
+
const slug = (await boundString(block, frame.source, "slug")).trim();
|
|
161
|
+
const one = block.props.mode === "one" || (block.props.mode === undefined && slug !== "");
|
|
162
|
+
if (one) {
|
|
163
|
+
// A page whose slug comes from the URL and matches nothing renders the blocks around the
|
|
164
|
+
// source, not a 404. Only a route decides what a missing page means.
|
|
165
|
+
const item = slug === "" ? null : await read(() => getItem(ctx.config, key, slug));
|
|
166
|
+
if (!item)
|
|
167
|
+
return [];
|
|
168
|
+
const scope = itemScope(ctx.config, item);
|
|
169
|
+
return bindList(content, { ...frame, source: frame.source.with({ item: () => scope }), rows: { items: [item] } }, ctx);
|
|
170
|
+
}
|
|
171
|
+
const field = (await boundString(block, frame.source, "filterField")).trim();
|
|
172
|
+
const want = (await boundString(block, frame.source, "filterValue")).trim();
|
|
173
|
+
// A filter whose value bound to nothing would silently list everything, which for "the
|
|
174
|
+
// enrollments in this class" is every class. No value, no rows.
|
|
175
|
+
if (field !== "" && want === "")
|
|
176
|
+
return [];
|
|
177
|
+
const param = typeof block.props.pageParam === "string" ? block.props.pageParam : "";
|
|
178
|
+
const page = param === "" ? 1 : pageNumber(await frame.source.read("query"), param);
|
|
179
|
+
const pageSize = typeof block.props.pageSize === "number" ? block.props.pageSize : 12;
|
|
180
|
+
const loaded = await read(() => listCollection(ctx.config, key, {
|
|
181
|
+
page,
|
|
182
|
+
pageSize: Math.min(pageSize, MAX_SOURCE_ROWS),
|
|
183
|
+
filter: field !== "" ? { [field]: want } : undefined,
|
|
184
|
+
}));
|
|
185
|
+
const rows = {
|
|
186
|
+
items: loaded?.items ?? [],
|
|
187
|
+
...(param !== "" ? { pager: { param, page, hasNext: loaded?.hasNextPage ?? false } } : {}),
|
|
188
|
+
};
|
|
189
|
+
return bindList(content, { ...frame, rows }, ctx);
|
|
190
|
+
}
|
|
191
|
+
/** A page's read must not take the page down, which is the rule the feed and the sitemap follow. */
|
|
192
|
+
async function read(load) {
|
|
193
|
+
try {
|
|
194
|
+
return await load();
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
if (e && typeof e === "object" && "digest" in e)
|
|
198
|
+
throw e;
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function pageNumber(query, param) {
|
|
203
|
+
const raw = query && Object.hasOwn(query, param) ? query[param] : undefined;
|
|
204
|
+
const n = Number(typeof raw === "string" || typeof raw === "number" ? raw : NaN);
|
|
205
|
+
return Number.isInteger(n) && n >= 1 && n <= 10_000 ? n : 1;
|
|
206
|
+
}
|
|
207
|
+
/* ------------------------------------------------------------------ presets */
|
|
208
|
+
async function expandPreset(block, props, frame, ctx) {
|
|
209
|
+
const slots = {};
|
|
210
|
+
for (const [name, lists] of Object.entries(block.slots)) {
|
|
211
|
+
slots[name] = lists.map((blocks) => ({ blocks, source: frame.source }));
|
|
212
|
+
}
|
|
213
|
+
const inner = {
|
|
214
|
+
...frame,
|
|
215
|
+
source: frame.source.with({ props: () => props }),
|
|
216
|
+
slots,
|
|
217
|
+
};
|
|
218
|
+
return bindList(block.definition.preset ?? [], inner, ctx);
|
|
219
|
+
}
|
|
220
|
+
/* ------------------------------------------------------------------- scopes */
|
|
221
|
+
/**
|
|
222
|
+
* What `{{item.X}}` reads.
|
|
223
|
+
*
|
|
224
|
+
* The entry's own fields come first under the names the tenant gave them, because a client's model
|
|
225
|
+
* is its own and `{{item.Headline}}` has to work. The engine's names are laid over them, so
|
|
226
|
+
* `{{item.Title}}` means the title whatever the field is called.
|
|
227
|
+
*/
|
|
228
|
+
export function itemScope(config, item) {
|
|
229
|
+
const route = collectionOf(config, item.collection)?.route;
|
|
230
|
+
return {
|
|
231
|
+
...item.content.data,
|
|
232
|
+
Id: item.id,
|
|
233
|
+
Title: item.title,
|
|
234
|
+
Slug: item.slug,
|
|
235
|
+
Summary: item.summary,
|
|
236
|
+
Body: item.body,
|
|
237
|
+
Date: item.date,
|
|
238
|
+
Image: item.image,
|
|
239
|
+
ImageAlt: item.imageAlt,
|
|
240
|
+
Url: item.url,
|
|
241
|
+
Tags: item.tags,
|
|
242
|
+
Option: item.option,
|
|
243
|
+
Color: item.color,
|
|
244
|
+
...(route !== undefined && item.slug ? { Href: `${route}/${item.slug}` } : {}),
|
|
245
|
+
...Object.fromEntries(Object.entries(item.refs).map(([field, ref]) => [field, ref ? { ...ref } : undefined])),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
/** What `{{page.X}}` reads, the same way round: the entry's fields, then the engine's names. */
|
|
249
|
+
export function pageScope(page) {
|
|
250
|
+
return {
|
|
251
|
+
...(page.content?.data ?? {}),
|
|
252
|
+
Id: page.id,
|
|
253
|
+
Title: page.title,
|
|
254
|
+
Slug: page.slug,
|
|
255
|
+
Summary: page.summary,
|
|
256
|
+
Body: page.body,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* What `{{site.X}}` reads: the tenant's site settings, with the identity the engine resolved laid
|
|
261
|
+
* over them. A build-time site has no settings entry and still answers `{{site.Name}}`, because the
|
|
262
|
+
* identity is where its name lives.
|
|
263
|
+
*/
|
|
264
|
+
export function siteScope(config, globals) {
|
|
265
|
+
const s = config.site;
|
|
266
|
+
return {
|
|
267
|
+
...globals,
|
|
268
|
+
Name: s.name,
|
|
269
|
+
Tagline: s.tagline,
|
|
270
|
+
Url: s.url,
|
|
271
|
+
Logo: s.logo,
|
|
272
|
+
Copyright: s.copyright,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/** What `{{query.X}}` reads. Strings only, and one value per name: the first the URL carries. */
|
|
276
|
+
export function queryScope(params) {
|
|
277
|
+
const out = {};
|
|
278
|
+
if (params instanceof URLSearchParams) {
|
|
279
|
+
for (const [name, value] of params)
|
|
280
|
+
if (!(name in out))
|
|
281
|
+
out[name] = value;
|
|
282
|
+
return out;
|
|
283
|
+
}
|
|
284
|
+
for (const [name, value] of Object.entries(params)) {
|
|
285
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
286
|
+
if (typeof first === "string")
|
|
287
|
+
out[name] = first;
|
|
288
|
+
}
|
|
289
|
+
return out;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=bind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/blocks/bind.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAA2C,MAAM,eAAe,CAAC;AAC7G,OAAO,EACH,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,eAAe,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,UAAU,EACV,OAAO,EACP,UAAU,GAKb,MAAM,aAAa,CAAC;AAmDrB,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAuB,EAAE,OAAwB;IAC9E,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM;QAC7B,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;KAC/B,CAAC,CAAC;IACH,MAAM,GAAG,GAAgB;QACrB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,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