@wunderweb/core 0.0.0-stage → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wunderwerk software GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/core/1.yaml ADDED
@@ -0,0 +1,364 @@
1
+ # wunderweb core schema, major version 1: the contract. Compile with
2
+ # `wunderweb generate`.
3
+ #
4
+ # The contract says what a page accepts, not which blocks exist. It holds the
5
+ # roles and how they nest, the traits, token types and scales, primitive and
6
+ # object types, the rich text / SVG vocabulary and the mechanisms (Page,
7
+ # Fragment, Include with slots, page: links, dialogs). Every block other than
8
+ # Include is project-owned: it lives in the project's blocks directory
9
+ # (blocks/<Name>/block.yaml), usually installed from a registry.
10
+ #
11
+ # Published versions are immutable except for additive (minor) changes:
12
+ # new optional fields, new types. Breaking changes go to 2.yaml with a
13
+ # content migration.
14
+ #
15
+ # Notation
16
+ # name: Type required (present and non-empty)
17
+ # name?: Type optional
18
+ # name?: {type: Type, default: …, doc: …} long form
19
+ #
20
+ # Type expressions
21
+ # Name type, role or block
22
+ # A | B union
23
+ # T[] list
24
+ # Responsive<T> per-breakpoint map {base?: T, md?: T, …}; mobile first, a value applies upward
25
+ # builtins string, number, integer, boolean
26
+ #
27
+ # Block instance = {type: <BlockName>, id?: string, …fields}.
28
+ # Block `defaults` apply to unset fields. Merge: objects merge key by key,
29
+ # Responsive<T> maps and lists are replaced as a whole (a set `ratio: {lg: …}`
30
+ # drops a default `ratio: {sm: …}`). A Responsive value without `base` means
31
+ # the CSS initial value below its first breakpoint, not the default; lint
32
+ # rejects one that drops a default's `base` (restate it, or `base: {}`).
33
+ #
34
+ # A project theme (theme.yaml) sets token values (colors, button variants,
35
+ # breakpoints, container sizes), adds optional fields to core object types
36
+ # (`extend`) and extends the rich text vocabulary.
37
+ #
38
+ # There are no escape hatches: no class names, no inline CSS, and rich text
39
+ # is limited to a typography vocabulary (see richText).
40
+ #
41
+ # Nesting is fixed by the roles (no recursion). A block joins roles with
42
+ # `in`; a block's slots accept only lower roles:
43
+ #
44
+ # Page / Fragment
45
+ # └─ PageBlock Row | Include | blocks with in: [PageBlock] (e.g. Section)
46
+ # └─ Row Content | in: [Row] (e.g. SideBySide, Tiles)
47
+ # └─ Content Leaf | in: [Content] (e.g. Stack)
48
+ # └─ Leaf in: [Leaf] (e.g. Text, Card)
49
+ # Surround slots (before / after) on any block: Inline (in: [Inline]).
50
+
51
+ version: 1
52
+ roots: [Page, Fragment]
53
+
54
+ # ----------------------------------------------------------------- roles
55
+
56
+ # Ordered from the highest to the lowest. Members are roles or blocks;
57
+ # project blocks join with `in`. A role nobody joins accepts nothing.
58
+ roles:
59
+ PageBlock:
60
+ doc: Top-level block of a page or fragment.
61
+ members: [Row, Include]
62
+ Row:
63
+ doc: Block that lays out Content side by side or in a grid.
64
+ members: [Content]
65
+ Content:
66
+ doc: Block holding Leaf blocks, or a Leaf.
67
+ members: [Leaf]
68
+ Leaf:
69
+ doc: Content block without block slots (text, media, card, …).
70
+ members: []
71
+ Inline:
72
+ doc: Block allowed in the surround slots (before / after) of any block.
73
+ members: []
74
+
75
+ # ----------------------------------------------------------------- rich text
76
+
77
+ # Closed vocabulary for RichText: typography and vertical rhythm only. Box
78
+ # layout (flex, width, shadow, position, …) belongs to blocks. Themes add
79
+ # classes (type scale, highlights, inline buttons) and data attributes.
80
+ richText:
81
+ elements: [p, h1, h2, h3, h4, h5, h6, ul, ol, li, strong, b, em, i, u, s, sup, sub, a, br, span, hr, blockquote, section, table, thead, tbody, tfoot, tr, th, td, caption]
82
+ attributes: [href, target, rel, title, id, scope, colspan, rowspan, class, start, reversed]
83
+ # measure-*: max width of one block-level text element (p, h1-h6, li, blockquote),
84
+ # the element box centered in the text column; its text keeps its alignment.
85
+ classes: [text-align-left, text-align-center, text-align-right, text-align-justify, font-bold,
86
+ measure-xs, measure-sm, measure-md, measure-lg, measure-xl, measure-2xl, measure-3xl, measure-4xl, measure-5xl,
87
+ mt-0, mt-1, mt-2, mt-3, mt-4, mt-5, mt-6, mt-8, mt-10, mt-12, mt-16,
88
+ mb-0, mb-1, mb-2, mb-3, mb-4, mb-5, mb-6, mb-8, mb-10, mb-12, mb-16, m-0]
89
+ classPatterns: []
90
+ # Classes marking an inline call-to-action link; only allowed inside prose.
91
+ buttonClasses: []
92
+ # data-* attributes allowed on any element (editor bookkeeping, no styling).
93
+ dataAttributes: []
94
+ # SVG: shapes and paint servers only - no text, images, links, styles or scripts.
95
+ svgElements: [svg, g, defs, path, rect, circle, ellipse, line, polyline, polygon, clipPath, mask, linearGradient, radialGradient, stop, pattern, use, title, symbol]
96
+ svgAttributes: [viewBox, xmlns, width, height, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-dasharray, d, x, y, x1, y1, x2, y2, cx, cy, r, rx, ry, points, transform, opacity, fill-opacity, stroke-opacity, fill-rule, clip-rule, clip-path, mask, id, href, offset, stop-color, stop-opacity, gradientUnits, gradientTransform, patternUnits, preserveAspectRatio, aria-hidden, role, focusable, version]
97
+
98
+ # ----------------------------------------------------------------- types
99
+
100
+ types:
101
+ # Tokens (themes replace these)
102
+
103
+ Breakpoint:
104
+ doc: Min viewport width in px.
105
+ enum: {base: 0, sm: 640, md: 768, lg: 1024, xl: 1280, 2xl: 1536}
106
+
107
+ Color:
108
+ doc: Theme color token.
109
+ enum: [white, black]
110
+
111
+ ButtonVariant:
112
+ doc: Theme button style.
113
+ enum: [primary, secondary]
114
+
115
+ ContainerSize:
116
+ doc: Content width of a box; its background stays full width.
117
+ enum: [default]
118
+
119
+ # Scales
120
+
121
+ Spacing:
122
+ doc: Spacing scale step, 1 = 0.25rem (4px).
123
+ enum: [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96]
124
+
125
+ SignedSpacing:
126
+ doc: Spacing step; negative pulls the box over its neighbour.
127
+ enum: [-96, -80, -72, -64, -56, -48, -40, -32, -28, -24, -20, -16, -12, -10, -8, -6, -4, -3, -2, -1, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96]
128
+
129
+ Radius: {enum: [none, sm, md, lg, xl, 2xl, 3xl, full], doc: Corner radius token.}
130
+ Shadow: {enum: [none, sm, md, lg, xl, 2xl], doc: Elevation token.}
131
+ NamedWidth: {enum: [xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl, 7xl, prose], doc: Named max width (Tailwind scale).}
132
+ NamedHeight: {enum: [25vh, 50vh, 75vh, 100vh], doc: Share of the viewport height.}
133
+ Px: {type: integer, min: 0, max: 4000, doc: CSS pixels.}
134
+ MaxWidth: NamedWidth | Px
135
+ MinHeight: NamedHeight | Px
136
+ Size: {enum: [sm, md, lg, xl]}
137
+
138
+ # Primitives
139
+
140
+ Hex: {type: string, pattern: "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$", doc: "CSS hex color, e.g. #f5ede4."}
141
+ Paint: Color | Hex
142
+ Opacity: {type: number, min: 0, max: 1}
143
+ Blur: {type: number, min: 0, doc: Blur radius in px.}
144
+ Span: {type: integer, min: 1, max: 24}
145
+ Percent: {type: number, min: 0, max: 100}
146
+ Seconds: {type: integer, min: 1, max: 600}
147
+ BorderWidth: {type: integer, min: 1, max: 8, doc: px}
148
+ RichText: {type: string, doc: "HTML limited to the rich text vocabulary."}
149
+ Svg: {type: string, doc: "Inline SVG markup: one <svg> root, no scripts, handlers or root style."}
150
+ Url: {type: string, pattern: "^(https?://|/(?!/)|#|mailto:|tel:|page:[a-z][a-z0-9-]*(#[a-z][a-z0-9_-]*)?$|consent:settings$)", doc: "Absolute http(s) URL, root-relative path, mailto:, tel:, #anchor, page:<id>[#anchor] (page in the current locale) or consent:settings (opens the cookie settings; needs a consent section in the site config)."}
151
+ Anchor: {type: string, pattern: "^[a-z][a-z0-9_-]*$", doc: "Element id, target of #anchor links."}
152
+ Path: {type: string, pattern: "^/([a-z0-9][a-z0-9._~-]*(/[a-z0-9][a-z0-9._~-]*)*)?$", doc: "Site path without locale prefix and trailing slash."}
153
+ Ref: {type: string, pattern: "^[a-z][a-z0-9-]*$", doc: Fragment id.}
154
+ AspectRatio: {type: string, pattern: "^[1-9][0-9]?:[1-9][0-9]?$", doc: "width:height, e.g. 16:9."}
155
+
156
+ # Enums
157
+
158
+ BackgroundPosition:
159
+ doc: cover | contain | fill stretch the asset; anchors keep its natural size.
160
+ enum: [cover, contain, fill, top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right]
161
+ Corner: {enum: [top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right]}
162
+ AssetKind: {enum: [image, video, remote-video], doc: remote-video = YouTube / Vimeo URL.}
163
+ LinkTarget: {enum: [_self, _blank]}
164
+ Align: {enum: [start, center, end, stretch]}
165
+ Justify: {enum: [start, center, end, between]}
166
+ TextAlign: {enum: [start, center, end, justify]}
167
+ EdgeShape: {enum: [straight, wave, slant, curve], doc: Shape of a box edge; cuts into the neighbour.}
168
+ GradientKind: {enum: [linear, radial]}
169
+ Shape: {enum: [rect, rounded, circle]}
170
+ LineStyle: {enum: [solid, dashed, dotted]}
171
+
172
+ # Objects
173
+
174
+ Asset:
175
+ doc: "Image or video. A root-relative url resolves against the configured asset base (e.g. an S3 bucket)."
176
+ fields:
177
+ kind: AssetKind
178
+ url: Url
179
+ alt?: string
180
+ width?: integer
181
+ height?: integer
182
+ poster?: {type: Url, doc: Video preview image.}
183
+
184
+ Link:
185
+ fields:
186
+ url: Url
187
+ label?: string
188
+ target?: LinkTarget
189
+ rel?: string
190
+
191
+ Button:
192
+ doc: "Needs url or opens, unless the field holding it is marked actionOptional (e.g. a form submit)."
193
+ fields:
194
+ label: {type: string, doc: Visible text; with iconOnly the accessible name.}
195
+ url?: {type: Url, doc: "#anchor scrolls, e.g. to a form."}
196
+ opens?: {type: Ref, doc: "Fragment shown in a dialog; the page renders each dialog once. With an #anchor url the dialog is the fallback, used when the anchor is not on the page."}
197
+ iconOnly?: {type: boolean, doc: "Show only the icon, e.g. a scroll-down chevron."}
198
+ variant?: ButtonVariant
199
+ icon?: Svg
200
+ size?: Size
201
+ target?: LinkTarget
202
+ rel?: string
203
+ title?: string
204
+
205
+ Icon:
206
+ doc: SVG or short text glyph (e.g. a step number). Needs svg or text.
207
+ fields:
208
+ svg?: Svg
209
+ text?: {type: string, doc: "Glyph instead of an SVG, e.g. \"1\"."}
210
+ color?: Paint
211
+ background?: {type: Paint, doc: Fills the shape behind the icon.}
212
+ shape?: Shape
213
+ size?: Size
214
+
215
+ Sides:
216
+ fields:
217
+ top?: Spacing
218
+ right?: Spacing
219
+ bottom?: Spacing
220
+ left?: Spacing
221
+
222
+ SignedSides:
223
+ doc: Negative only vertically (overlap with the block above / below).
224
+ fields:
225
+ top?: SignedSpacing
226
+ right?: Spacing
227
+ bottom?: SignedSpacing
228
+ left?: Spacing
229
+
230
+ BoxLayout:
231
+ doc: "Inside of the box: its children are stacked (before, content, after)."
232
+ fields:
233
+ container?: {type: ContainerSize, doc: Constrain the children to the page container; background stays full width.}
234
+ alignX?: {type: Align, doc: Horizontal alignment of the children.}
235
+ alignY?: {type: Justify, doc: "Vertical distribution of the children (needs height, e.g. minHeight)."}
236
+ padding?: Responsive<Sides>
237
+ gap?: {type: Responsive<Spacing>, doc: Gap between the children.}
238
+ minHeight?: Responsive<MinHeight>
239
+ textAlign?: {type: Responsive<TextAlign>, doc: "Inherited by all text in the box. A text-align-* class on an element wins over it (unless a block documents otherwise)."}
240
+ clip?: {type: boolean, doc: "Clip overflowing children, e.g. decorations."}
241
+
242
+ Placement:
243
+ doc: "Outside of the box: how it sits in its parent."
244
+ fields:
245
+ maxWidth?: Responsive<MaxWidth>
246
+ x?: {type: Responsive<Align>, doc: "Horizontal self-alignment, e.g. center a narrow block."}
247
+ y?: {type: Responsive<Align>, doc: Vertical self-alignment in a row or cell.}
248
+ margin?: Responsive<SignedSides>
249
+ colSpan?: {type: Responsive<Span>, doc: "Only in slots whose block allows it (rule childPlace), e.g. grid tiles."}
250
+ rowSpan?: {type: Responsive<Span>, doc: "Only in slots whose block allows it (rule childPlace), e.g. grid tiles."}
251
+
252
+ GradientStop:
253
+ fields:
254
+ color: Paint
255
+ at?: {type: Percent, doc: Position of the stop.}
256
+ opacity?: Opacity
257
+
258
+ Gradient:
259
+ fields:
260
+ kind: GradientKind
261
+ angle?: {type: number, doc: "Linear only, degrees; 180 = top to bottom."}
262
+ center?: {type: Corner, doc: Radial only.}
263
+ stops: GradientStop[]
264
+
265
+ Background:
266
+ doc: Layers, back to front - base, asset, color overlay, gradients, content.
267
+ fields:
268
+ base?: {type: Color, doc: Fill behind the asset (shows while it loads or where it is transparent).}
269
+ color?: {type: Paint, doc: Overlay color over the asset; with opacity a tint.}
270
+ asset?: Asset
271
+ position?: {type: BackgroundPosition, default: cover}
272
+ opacity?: {type: Opacity, doc: "Applies to the color overlay if set, else to the asset."}
273
+ blur?: {type: Blur, doc: Blurs the asset.}
274
+ gradients?: {type: "Gradient[]", doc: First is on top.}
275
+ parallax?: {type: boolean, doc: The asset scrolls slower than the page.}
276
+
277
+ Border:
278
+ fields:
279
+ width: BorderWidth
280
+ color?: Paint
281
+ style?: LineStyle
282
+
283
+ Appearance:
284
+ doc: Unset = block default.
285
+ fields:
286
+ textColor?: Color
287
+ rounded?: Radius
288
+ shadow?: Shadow
289
+ border?: Border
290
+
291
+ Edges:
292
+ fields:
293
+ top?: EdgeShape
294
+ bottom?: EdgeShape
295
+
296
+ Decoration:
297
+ doc: "Graphic pinned to the box, e.g. an ornament overlapping its edge. Takes no space, never clipped by its own box; clipped by the nearest ancestor with layout.clip."
298
+ fields:
299
+ svg: Svg
300
+ anchor: Corner
301
+ offsetX?: {type: integer, doc: "px from the anchored side; negative = outside the box."}
302
+ offsetY?: {type: integer, doc: px from the anchored side.}
303
+ width?: Px
304
+ visible?: Responsive<boolean>
305
+
306
+ Slot:
307
+ doc: Override for Include.with.
308
+ fields:
309
+ slot: {type: Anchor, doc: Slot id in the fragment.}
310
+ block: {type: PageBlock, doc: "Replacement: any PageBlock-role block except Include; must be allowed where the slot sits (checked after substitution)."}
311
+
312
+ Page:
313
+ doc: "Locale = content folder. Pages with the same id in different locales are translations."
314
+ fields:
315
+ id?: {type: Ref, doc: "Translation id, shared across locales; target of page:<id> links. Unset = file name."}
316
+ title: string
317
+ description?: {type: string, doc: Meta description.}
318
+ image?: {type: Asset, doc: Social preview image.}
319
+ noindex?: boolean
320
+ path: {type: Path, doc: "URL path without the locale prefix, e.g. /meine-seite; / = home."}
321
+ chrome?: {type: boolean, default: true, doc: false = no site header and footer.}
322
+ header?: {type: Ref, doc: Header fragment. Unset = site default.}
323
+ footer?: {type: Ref, doc: Footer fragment. Unset = site default.}
324
+ blocks: PageBlock[]
325
+
326
+ Fragment:
327
+ doc: Reusable blocks, placed with Include (shared sections, header, footer).
328
+ fields:
329
+ fragment: Ref
330
+ title?: string
331
+ blocks: PageBlock[]
332
+
333
+ # ----------------------------------------------------------------- traits (field groups mixed into blocks)
334
+
335
+ traits:
336
+ Box:
337
+ anchor?: Anchor
338
+ slot?: {type: Anchor, doc: "In a fragment: id a page can replace via Include.with."}
339
+ layout?: BoxLayout
340
+ place?: Placement
341
+ background?: Background
342
+ appearance?: Appearance
343
+ edges?: Edges
344
+ decorations?: Decoration[]
345
+ visible?: {type: Responsive<boolean>, doc: "Per breakpoint, e.g. {base: false, lg: true}. Hides the whole block including before / after and background."}
346
+
347
+ Surround:
348
+ before?: Inline[]
349
+ after?: Inline[]
350
+
351
+ Linkable:
352
+ link?: {type: Link, doc: Makes the whole block clickable.}
353
+
354
+ # ----------------------------------------------------------------- blocks
355
+
356
+ # The only core block: a mechanism (fragment expansion, slots), not layout.
357
+ blocks:
358
+ Include:
359
+ doc: Places a fragment's blocks here.
360
+ fields:
361
+ ref: Ref
362
+ with?:
363
+ type: "Slot[]"
364
+ doc: "Per-page content for slots of the fragment: a block with the same slot id is replaced."
@@ -0,0 +1,2 @@
1
+ import { A as JsonSchema, C as BlockIds, D as takenIds, E as newBlockId, N as Walker, O as withNewIds, S as BlockAt, T as idsToAssign, _ as splitPath, a as Rect, b as withDefaults, c as PathEdit, d as applyEdit, f as applyEdits, g as shiftPath, h as resolveEdit, i as FromBridge, l as anchorEdit, m as joinPath, n as BoxModel, o as ToBridge, p as findBlock, r as Edges, s as EditError, t as isPlain, u as anchorPath, v as valueAtPath, w as blockIds, x as BLOCK_ID_PATTERN, y as effectiveDefault } from "./plain-Bgb2JEYy.mjs";
2
+ export { BLOCK_ID_PATTERN, type BlockAt, type BlockIds, type BoxModel, type Edges, EditError, type FromBridge, type JsonSchema, type PathEdit, type Rect, type ToBridge, Walker, anchorEdit, anchorPath, applyEdit, applyEdits, blockIds, effectiveDefault, findBlock, idsToAssign, isPlain, joinPath, newBlockId, resolveEdit, shiftPath, splitPath, takenIds, valueAtPath, withDefaults, withNewIds };
@@ -0,0 +1,2 @@
1
+ import { _ as idsToAssign, a as anchorEdit, b as withNewIds, c as applyEdits, d as resolveEdit, f as shiftPath, g as blockIds, h as BLOCK_ID_PATTERN, i as EditError, l as findBlock, m as valueAtPath, n as withDefaults, o as anchorPath, p as splitPath, r as Walker, s as applyEdit, t as effectiveDefault, u as joinPath, v as newBlockId, x as isPlain, y as takenIds } from "./defaults-DzKP-xzh.mjs";
2
+ export { BLOCK_ID_PATTERN, EditError, Walker, anchorEdit, anchorPath, applyEdit, applyEdits, blockIds, effectiveDefault, findBlock, idsToAssign, isPlain, joinPath, newBlockId, resolveEdit, shiftPath, splitPath, takenIds, valueAtPath, withDefaults, withNewIds };
@@ -0,0 +1,208 @@
1
+ //#region src/consent.d.ts
2
+ /** Google Consent Mode v2 signals a category may grant. */
3
+ export declare const GOOGLE_SIGNALS: readonly ["ad_storage", "ad_user_data", "ad_personalization", "analytics_storage", "functionality_storage", "personalization_storage", "security_storage"];
4
+ /**
5
+ * When the vendor scripts (gtag.js, fbevents.js) are added to the page:
6
+ * `idle` after the page's load event, when the main thread is idle (they
7
+ * stay off the critical path; commands queue until then), `eager` at once.
8
+ */
9
+ export declare const LOAD_STRATEGIES: readonly ["idle", "eager"];
10
+ export type LoadStrategy = (typeof LOAD_STRATEGIES)[number];
11
+ /** Category of remote videos and embeds. */
12
+ export declare const MEDIA = "media";
13
+ /** Url opening the consent settings (Buttons render a button). */
14
+ export declare const SETTINGS_URL = "consent:settings";
15
+ /** Element id of the settings dialog; in-page links to it open it. */
16
+ export declare const SETTINGS_ID = "wc-consent-settings";
17
+ /** Marks an element that opens the settings (rich text links). */
18
+ export declare const OPEN_ATTR = "data-wc-consent-open";
19
+ /** localStorage key of the stored choice. */
20
+ export declare const STORAGE_KEY = "wc-consent";
21
+ /** The `consent` section of wunderweb.config.yaml. */
22
+ export interface ConsentConfig {
23
+ /** Raise to ask every visitor again (e.g. a new vendor). */
24
+ version: number;
25
+ /** A stored choice older than this asks again. Default 365. */
26
+ maxAgeDays?: number;
27
+ /** Privacy page, usually page:<id> (resolved per locale). */
28
+ privacy?: string;
29
+ /** Hostnames where vendors may load (never previews or localhost). */
30
+ hosts: string[];
31
+ /**
32
+ * When the vendor scripts are added: `idle` (default) after the load
33
+ * event when the browser is idle, `eager` at once.
34
+ */
35
+ load?: LoadStrategy;
36
+ /** Category id → the Google consent signals it grants. */
37
+ categories: Record<string, string[]>;
38
+ vendors?: {
39
+ /** Google tags (GA4 G-…, Google Ads AW-…): always loaded, Advanced Consent Mode. */
40
+ google?: {
41
+ ids: string[];
42
+ };
43
+ /** Meta Pixel: loaded only once its category is granted. */
44
+ meta?: {
45
+ id: string;
46
+ category: string;
47
+ };
48
+ };
49
+ /** Self-hosted tools without cookies that need no consent (named in the dialog). */
50
+ cookieless?: string[];
51
+ /** Theme tokens of banner, dialog and gates. */
52
+ style?: Partial<ConsentStyle>;
53
+ /** Per locale overrides of the built-in texts. */
54
+ text?: Record<string, ConsentTextOverride>;
55
+ }
56
+ export interface ConsentStyle {
57
+ /** Color token of the banner, dialog and gate background. */
58
+ surface: string;
59
+ /** Color token of their text. */
60
+ text: string;
61
+ /** ButtonVariant of "accept all", and of "only necessary" unless `reject` is set. */
62
+ choice: string;
63
+ /** Quieter ButtonVariant ("save selection" in the dialog, "always allow" in gates). */
64
+ quiet: string;
65
+ /**
66
+ * ButtonVariant of "only necessary", when it should differ from `choice`.
67
+ * Default: `choice`. Legal risk: Austrian and German authorities and
68
+ * courts (DSB, BVwG ORF 2026, DSK, VG Hannover 2025) hold a rejection
69
+ * that is less prominent than the consent to make the consent invalid.
70
+ */
71
+ reject?: string;
72
+ }
73
+ export interface CategoryText {
74
+ label: string;
75
+ description: string;
76
+ /** Vendors named under the category, besides the configured ones (e.g. YouTube). */
77
+ vendors?: string[];
78
+ }
79
+ /** Every text of banner, dialog and gates in one locale. `{vendor}`, `{tools}` are filled in. */
80
+ export interface ConsentText {
81
+ banner: {
82
+ title: string;
83
+ body: string;
84
+ acceptAll: string;
85
+ reject: string;
86
+ settings: string;
87
+ };
88
+ dialog: {
89
+ title: string;
90
+ body: string;
91
+ save: string;
92
+ acceptAll: string;
93
+ reject: string;
94
+ close: string;
95
+ always: string;
96
+ vendors: string;
97
+ cookieless: string;
98
+ };
99
+ privacy: string;
100
+ necessary: CategoryText;
101
+ categories: Record<string, CategoryText>;
102
+ gate: {
103
+ notice: string;
104
+ loadOnce: string;
105
+ allow: string;
106
+ open: string;
107
+ };
108
+ }
109
+ export interface ConsentTextOverride {
110
+ banner?: Partial<ConsentText["banner"]>;
111
+ dialog?: Partial<ConsentText["dialog"]>;
112
+ privacy?: string;
113
+ necessary?: Partial<CategoryText>;
114
+ categories?: Record<string, Partial<CategoryText>>;
115
+ gate?: Partial<ConsentText["gate"]>;
116
+ }
117
+ /** A category as the page shows it. */
118
+ export interface PageCategory {
119
+ id: string;
120
+ signals: string[];
121
+ label: string;
122
+ description: string;
123
+ vendors: string[];
124
+ }
125
+ /** What a page needs to ask for consent: config and texts of its locale. */
126
+ export interface PageConsent {
127
+ version: number;
128
+ maxAgeDays: number;
129
+ hosts: string[];
130
+ /** When the vendor scripts are added; missing: idle. */
131
+ load?: LoadStrategy;
132
+ categories: PageCategory[];
133
+ google?: {
134
+ ids: string[];
135
+ };
136
+ meta?: {
137
+ id: string;
138
+ category: string;
139
+ };
140
+ /** Resolved privacy page url. */
141
+ privacy?: string;
142
+ cookieless: string[];
143
+ style: ConsentStyle;
144
+ text: ConsentText;
145
+ }
146
+ /** What a consent gate shows: vendor, texts with the vendor filled in. */
147
+ export interface GateData {
148
+ category: string;
149
+ vendor: string;
150
+ privacy?: string;
151
+ /** Preview image: only from the site itself (it shows before consent). */
152
+ poster?: string;
153
+ style: ConsentStyle;
154
+ text: {
155
+ notice: string;
156
+ loadOnce: string;
157
+ allow: string;
158
+ open: string;
159
+ privacy: string;
160
+ };
161
+ }
162
+ /** Config of the client script (head and body part). */
163
+ export interface ClientConsent {
164
+ key: string;
165
+ version: number;
166
+ maxAgeDays: number;
167
+ hosts: string[];
168
+ /** When the vendor scripts are added. */
169
+ load: LoadStrategy;
170
+ /** Category id → Google signals. */
171
+ categories: Record<string, string[]>;
172
+ google?: {
173
+ ids: string[];
174
+ };
175
+ meta?: {
176
+ id: string;
177
+ category: string;
178
+ };
179
+ }
180
+ /** Built-in texts: German and English; other locales get English. */
181
+ export declare const BUILTIN_TEXT: Record<string, ConsentText>;
182
+ export interface ConsentProblem {
183
+ level: "error" | "warning";
184
+ /** Dotted path in the config, e.g. consent.vendors.meta.category */
185
+ at: string;
186
+ message: string;
187
+ }
188
+ /** What the checks compare the config against: tokens and pages of the site. */
189
+ export interface ConsentContext {
190
+ locales: string[];
191
+ colors: string[];
192
+ variants: string[];
193
+ /** Page ids of the default locale (privacy page; other locales fall back to it). */
194
+ pages: Set<string>;
195
+ }
196
+ /** Problems of a `consent` section (undefined: none configured). */
197
+ export declare function checkConsent(consent: unknown, ctx: ConsentContext): ConsentProblem[];
198
+ /** Built-in texts of a locale with the site's overrides. */
199
+ export declare function consentText(consent: Pick<ConsentConfig, "text">, locale: string): ConsentText;
200
+ /** The consent of a page in `locale`; `url` resolves the privacy link. */
201
+ export declare function pageConsent(consent: ConsentConfig, locale: string, url: (u: string) => string): PageConsent;
202
+ /** What a consent gate for `vendor` in `category` shows. */
203
+ export declare function gateOf(consent: PageConsent, category: string, vendor: string, labels?: Partial<GateData["text"]>): GateData;
204
+ /** Vendor of a remote video url: YouTube, Vimeo, else its host. */
205
+ export declare function videoVendor(url: string): string;
206
+ /** Config of the client script; `extraHosts` (tests: localhost) extend the allowed hosts. */
207
+ export declare function clientConsent(consent: PageConsent, extraHosts?: string[]): ClientConsent;
208
+ //#endregion