@perkyzz/emvb 0.1.0 → 0.2.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/README.md +6 -4
- package/THIRD_PARTY_NOTICES.md +32 -0
- package/licenses/fontawesome-free.LICENSE +165 -0
- package/licenses/lucide-static.LICENSE +43 -0
- package/licenses/remixicon.LICENSE +201 -0
- package/licenses/tabler-icons.LICENSE +21 -0
- package/package.json +9 -5
- package/src/admin/api.ts +27 -0
- package/src/admin/content-api.ts +72 -9
- package/src/admin/editor/Editor.tsx +89 -14
- package/src/admin/editor/EditorOverlay.tsx +12 -0
- package/src/admin/editor/SmallScreenNotice.tsx +4 -3
- package/src/admin/editor/TopBar.tsx +76 -12
- package/src/admin/editor/canvas/CanvasFrame.tsx +224 -43
- package/src/admin/editor/canvas/DeviceBar.tsx +43 -2
- package/src/admin/editor/canvas/SelectionOverlay.tsx +60 -6
- package/src/admin/editor/canvas/canvas-events.ts +20 -7
- package/src/admin/editor/canvas/tab-reveal.ts +66 -0
- package/src/admin/editor/canvas/vnode-react.tsx +21 -1
- package/src/admin/editor/dialogs.tsx +39 -0
- package/src/admin/editor/dnd/drop-target.ts +63 -16
- package/src/admin/editor/dnd/new-element.ts +76 -1
- package/src/admin/editor/editor-css.ts +101 -15
- package/src/admin/editor/host.ts +30 -0
- package/src/admin/editor/icons/IconLibraryDialog.tsx +850 -0
- package/src/admin/editor/icons/library.ts +243 -0
- package/src/admin/editor/icons/set-format.ts +29 -0
- package/src/admin/editor/icons/sets/fontawesome.json +1 -0
- package/src/admin/editor/icons/sets/lucide.json +1 -0
- package/src/admin/editor/icons/sets/remix.json +1 -0
- package/src/admin/editor/icons/sets/tabler.json +1 -0
- package/src/admin/editor/panels/AddPanel.tsx +7 -3
- package/src/admin/editor/panels/ClassesSection.tsx +44 -6
- package/src/admin/editor/panels/ColorControl.tsx +268 -21
- package/src/admin/editor/panels/ElementPanel.tsx +237 -93
- package/src/admin/editor/panels/LayersPanel.tsx +303 -66
- package/src/admin/editor/panels/LeftPanel.tsx +4 -0
- package/src/admin/editor/panels/PageSettings.tsx +134 -5
- package/src/admin/editor/panels/SettingsPanel.tsx +12 -0
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +158 -2
- package/src/admin/editor/panels/TriggersEditor.tsx +19 -2
- package/src/admin/editor/panels/VariableSection.tsx +47 -9
- package/src/admin/editor/panels/color-space.ts +195 -0
- package/src/admin/editor/panels/settings/AdvancedFields.tsx +119 -0
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +153 -55
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +221 -0
- package/src/admin/editor/panels/settings/BoxControl.tsx +271 -0
- package/src/admin/editor/panels/settings/ChoiceGroup.tsx +138 -0
- package/src/admin/editor/panels/settings/ClassChipInput.tsx +104 -2
- package/src/admin/editor/panels/settings/DraftTextField.tsx +44 -3
- package/src/admin/editor/panels/settings/EffectsControls.tsx +25 -16
- package/src/admin/editor/panels/settings/FieldBindControl.tsx +53 -17
- package/src/admin/editor/panels/settings/FieldControl.tsx +129 -9
- package/src/admin/editor/panels/settings/FormBindControl.tsx +14 -5
- package/src/admin/editor/panels/settings/IconControls.tsx +438 -0
- package/src/admin/editor/panels/settings/IconPicker.tsx +133 -72
- package/src/admin/editor/panels/settings/ItemList.tsx +199 -0
- package/src/admin/editor/panels/settings/LengthRow.tsx +97 -61
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +10 -4
- package/src/admin/editor/panels/settings/MediaPicker.tsx +4 -2
- package/src/admin/editor/panels/settings/StateSwitcher.tsx +1 -1
- package/src/admin/editor/panels/settings/StyleRow.tsx +158 -75
- package/src/admin/editor/panels/settings/VariableBinding.tsx +5 -1
- package/src/admin/editor/panels/settings/advanced-rules.ts +63 -0
- package/src/admin/editor/panels/settings/background-mode.ts +112 -0
- package/src/admin/editor/panels/settings/box-link-name.ts +38 -0
- package/src/admin/editor/panels/settings/box-sides.ts +153 -0
- package/src/admin/editor/panels/settings/button-url.ts +27 -0
- package/src/admin/editor/panels/settings/class-suggest.ts +5 -3
- package/src/admin/editor/panels/settings/form-names.ts +38 -0
- package/src/admin/editor/panels/settings/heading-warning.ts +25 -0
- package/src/admin/editor/panels/settings/image-alt.ts +25 -0
- package/src/admin/editor/panels/settings/length-units.ts +40 -7
- package/src/admin/editor/panels/settings/loop-context.ts +26 -0
- package/src/admin/editor/panels/settings/style-sections.ts +114 -11
- package/src/admin/editor/panels/settings/svg-images.ts +14 -0
- package/src/admin/editor/panels/site-list.tsx +3 -0
- package/src/admin/editor/restore-deleted.ts +80 -0
- package/src/admin/editor/shortcuts.ts +1 -1
- package/src/admin/editor/store.ts +35 -7
- package/src/admin/editor/useEditorCommands.ts +66 -5
- package/src/admin/editor/useEditorData.ts +29 -3
- package/src/admin/editor/useEditorShortcuts.ts +34 -2
- package/src/admin/editor/useNodeActions.ts +68 -6
- package/src/admin/editor/useSave.ts +60 -3
- package/src/admin/entry-status.ts +19 -0
- package/src/admin/icon-uploads-api.ts +44 -0
- package/src/admin/pages/PageList.tsx +22 -2
- package/src/admin/pages/ThemePartList.tsx +23 -4
- package/src/admin/pages/list-kit.tsx +52 -2
- package/src/admin/setup/spec.ts +7 -0
- package/src/admin/theme-api.ts +61 -14
- package/src/admin/ui.ts +17 -4
- package/src/astro/EmVBPage.astro +28 -2
- package/src/astro/floats/EmVBFloatsRuntime.astro +9 -0
- package/src/astro/floats/index.ts +1 -0
- package/src/astro/floats/runtime.ts +78 -0
- package/src/astro/forms-definitions.ts +22 -0
- package/src/astro/index.ts +1 -0
- package/src/astro/menu/EmVBMenuRuntime.astro +9 -0
- package/src/astro/menu/index.ts +1 -0
- package/src/astro/menu/runtime.ts +37 -0
- package/src/astro/popups/runtime.ts +54 -4
- package/src/astro/render.ts +47 -13
- package/src/astro/resolve-theme.ts +168 -24
- package/src/astro/tabs/runtime.ts +6 -1
- package/src/astro/theme-context.ts +25 -5
- package/src/astro/theme-posts.ts +19 -1
- package/src/constants.ts +1 -1
- package/src/core/arrange.ts +98 -10
- package/src/core/clipboard.ts +91 -9
- package/src/core/css/generate.ts +21 -4
- package/src/core/design/classes.ts +95 -9
- package/src/core/design/transfer.ts +101 -2
- package/src/core/design/variables.ts +51 -11
- package/src/core/elements/dynamic-elements.ts +57 -5
- package/src/core/elements/field-id.ts +6 -0
- package/src/core/elements/form-elements.ts +23 -8
- package/src/core/elements/index.ts +267 -49
- package/src/core/elements/menu.ts +190 -0
- package/src/core/forms/definition.ts +11 -0
- package/src/core/index.ts +67 -3
- package/src/core/limits.ts +2 -0
- package/src/core/migrate/index.ts +51 -1
- package/src/core/nesting.ts +51 -0
- package/src/core/render/context.ts +7 -0
- package/src/core/render/dynamic-post.ts +39 -11
- package/src/core/render/extras.ts +22 -3
- package/src/core/render/form.ts +134 -36
- package/src/core/render/index.ts +123 -25
- package/src/core/render/loop.ts +10 -3
- package/src/core/render/pagination.ts +76 -0
- package/src/core/render/section.ts +5 -1
- package/src/core/render/tabs.ts +8 -4
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +197 -17
- package/src/core/sanitize/embed-url.ts +64 -7
- package/src/core/sanitize/svg-upload.ts +203 -0
- package/src/core/sanitize/svg.ts +102 -21
- package/src/core/schema/descriptors.ts +4 -0
- package/src/core/schema/design.ts +7 -2
- package/src/core/schema/layout.ts +210 -19
- package/src/core/schema/style.ts +87 -8
- package/src/core/tabs/presence.ts +9 -0
- package/src/core/theme/conditions.ts +4 -1
- package/src/core/theme/dynamic.ts +10 -0
- package/src/core/theme/float.ts +113 -0
- package/src/core/theme/pagination.ts +97 -0
- package/src/core/theme/part-types.ts +2 -0
- package/src/core/theme/popup-markup.ts +3 -1
- package/src/core/theme/popup-rules.ts +4 -3
- package/src/server/hooks.ts +20 -0
- package/src/server/icon-routes.ts +79 -0
- package/src/server/plugin.ts +5 -1
package/src/core/sanitize/svg.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { sanitizeMediaUrl } from "./media-url.ts";
|
|
2
1
|
import type { VNode } from "../render/vnode.ts";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -101,9 +100,23 @@ const ATTR_ALLOW = new Set([
|
|
|
101
100
|
"mask",
|
|
102
101
|
]);
|
|
103
102
|
|
|
104
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Hard reject before parse — script/handlers/foreignObject/style/a/iframe. `data:` is checked per
|
|
105
|
+
* attribute value instead (only an `<image>` may carry an embedded raster, W-231).
|
|
106
|
+
*/
|
|
105
107
|
const FORBIDDEN =
|
|
106
|
-
/<script\b|<\/script\b|\bon[a-z]+\s*=|javascript
|
|
108
|
+
/<script\b|<\/script\b|\bon[a-z]+\s*=|javascript:|<\s*foreignObject\b|<\s*style\b|<\s*iframe\b|<\s*a\b/i;
|
|
109
|
+
|
|
110
|
+
/** W-231: the image sources an SVG may show — the site's media library, or an embedded raster. */
|
|
111
|
+
const SVG_IMAGE_MEDIA = /^\/_emdash\/api\/media\/file\/[\w.~%-]+(?:\/[\w.~%-]+)*$/;
|
|
112
|
+
const SVG_IMAGE_DATA = /^data:image\/(?:png|jpeg|webp|gif);base64,[A-Za-z0-9+/]+={0,2}$/;
|
|
113
|
+
|
|
114
|
+
/** True for an `<image>` href the site serves itself (media library) or embeds (raster data). */
|
|
115
|
+
export function isAllowedSvgImageHref(value: string): boolean {
|
|
116
|
+
const trimmed = value.trim();
|
|
117
|
+
if (SVG_IMAGE_DATA.test(trimmed)) return true;
|
|
118
|
+
return SVG_IMAGE_MEDIA.test(trimmed) && !/(?:^|\/)\.\.?(?:\/|$)/.test(trimmed);
|
|
119
|
+
}
|
|
107
120
|
|
|
108
121
|
/** Transform attributes take only a list of SVG transform functions with the right arity. */
|
|
109
122
|
const TRANSFORM_ATTRS = new Set(["transform", "gradientTransform", "patternTransform"]);
|
|
@@ -142,42 +155,74 @@ const URL_HASH_REF = /^url\(\s*#[A-Za-z_][\w.-]*\s*\)$/i;
|
|
|
142
155
|
const MAX_MARKUP = 32_768;
|
|
143
156
|
|
|
144
157
|
type Tok =
|
|
145
|
-
| {
|
|
158
|
+
| {
|
|
159
|
+
kind: "open";
|
|
160
|
+
tag: string;
|
|
161
|
+
attrs: Record<string, string>;
|
|
162
|
+
selfClosing: boolean;
|
|
163
|
+
/** W-231: an `<image>` pointing outside the site; left out with everything inside it. */
|
|
164
|
+
external?: boolean;
|
|
165
|
+
}
|
|
146
166
|
| { kind: "close"; tag: string }
|
|
147
167
|
| { kind: "text"; value: string };
|
|
148
168
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
const NAMED_ENTITIES: Record<string, string> = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Decodes the XML entities pasted SVG may carry (`<`, `&`, `'`, `&`…) once, so text
|
|
173
|
+
* and attribute values hold the characters they stand for and are escaped exactly once on output
|
|
174
|
+
* (W-186). Unknown or out-of-range references stay as written.
|
|
175
|
+
*/
|
|
176
|
+
function decodeEntities(raw: string): string {
|
|
177
|
+
return raw.replace(/&(#x[0-9a-f]{1,6}|#[0-9]{1,7}|[a-z]+);/gi, (whole, ref: string) => {
|
|
178
|
+
if (ref.startsWith("#")) {
|
|
179
|
+
const code =
|
|
180
|
+
ref[1] === "x" || ref[1] === "X" ? parseInt(ref.slice(2), 16) : Number(ref.slice(1));
|
|
181
|
+
return code > 0 && code <= 0x10ffff && !(code >= 0xd800 && code <= 0xdfff)
|
|
182
|
+
? String.fromCodePoint(code)
|
|
183
|
+
: whole;
|
|
184
|
+
}
|
|
185
|
+
return NAMED_ENTITIES[ref] ?? whole;
|
|
186
|
+
});
|
|
156
187
|
}
|
|
157
188
|
|
|
158
189
|
function isSafeHref(tag: string, name: string, value: string): boolean {
|
|
159
190
|
if (name !== "href" && name !== "xlink:href") return true;
|
|
160
191
|
if (tag === "use") return FRAGMENT_HREF.test(value);
|
|
161
|
-
|
|
192
|
+
// Image hrefs are judged in parseAttrs: an external one drops the image, not the whole SVG.
|
|
193
|
+
if (tag === "image") return true;
|
|
162
194
|
// Other tags should not carry href.
|
|
163
195
|
return false;
|
|
164
196
|
}
|
|
165
197
|
|
|
198
|
+
const isHrefName = (name: string) => name === "href" || name === "xlink:href";
|
|
199
|
+
|
|
166
200
|
function isSafeUrlRefAttr(name: string, value: string): boolean {
|
|
167
201
|
if (name !== "clip-path" && name !== "mask") return true;
|
|
168
202
|
if (value === "none") return true;
|
|
169
203
|
return URL_HASH_REF.test(value);
|
|
170
204
|
}
|
|
171
205
|
|
|
172
|
-
|
|
206
|
+
type ParsedAttrs = { attrs: Record<string, string>; external: boolean };
|
|
207
|
+
|
|
208
|
+
function parseAttrs(tag: string, raw: string): ParsedAttrs | undefined {
|
|
173
209
|
const attrs: Record<string, string> = {};
|
|
210
|
+
let external = false;
|
|
174
211
|
const re = /([A-Za-z_:][-A-Za-z0-9_:]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
175
212
|
let match: RegExpExecArray | null;
|
|
176
213
|
while ((match = re.exec(raw))) {
|
|
177
214
|
const name = match[1] ?? "";
|
|
178
215
|
if (!ATTR_ALLOW.has(name)) continue;
|
|
179
|
-
const value =
|
|
216
|
+
const value = decodeEntities(match[2] ?? match[3] ?? "");
|
|
180
217
|
if (/[<>`]|javascript:/i.test(value)) return undefined;
|
|
218
|
+
const imageHref = tag === "image" && isHrefName(name);
|
|
219
|
+
if (imageHref && !isAllowedSvgImageHref(value)) {
|
|
220
|
+
// An embedded non-raster (data:image/svg+xml, data:text/html…) still refuses the whole SVG.
|
|
221
|
+
if (/data:/i.test(value)) return undefined;
|
|
222
|
+
external = true;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (!imageHref && /data:/i.test(value)) return undefined;
|
|
181
226
|
if (TRANSFORM_ATTRS.has(name) && !isTransformList(value)) return undefined;
|
|
182
227
|
if (!isSafeHref(tag, name, value)) return undefined;
|
|
183
228
|
if (!isSafeUrlRefAttr(name, value)) return undefined;
|
|
@@ -187,7 +232,7 @@ function parseAttrs(tag: string, raw: string): Record<string, string> | undefine
|
|
|
187
232
|
}
|
|
188
233
|
if (/\bon[a-z]+\s*=/i.test(raw)) return undefined;
|
|
189
234
|
if (/\bstyle\s*=/i.test(raw)) return undefined;
|
|
190
|
-
return attrs;
|
|
235
|
+
return { attrs, external };
|
|
191
236
|
}
|
|
192
237
|
|
|
193
238
|
/** One tag's inner text (between `<` and `>`) as a token, or undefined when it isn't allowed. */
|
|
@@ -201,8 +246,12 @@ function tagToken(body: string): Tok | undefined {
|
|
|
201
246
|
const space = openBody.search(/\s/);
|
|
202
247
|
const tag = (space < 0 ? openBody : openBody.slice(0, space)).toLowerCase();
|
|
203
248
|
if (!SVG_TAGS.has(tag)) return undefined;
|
|
204
|
-
const
|
|
205
|
-
|
|
249
|
+
const parsed = parseAttrs(tag, space < 0 ? "" : openBody.slice(space));
|
|
250
|
+
if (!parsed) return undefined;
|
|
251
|
+
const { attrs, external } = parsed;
|
|
252
|
+
return external
|
|
253
|
+
? { kind: "open", tag, attrs, selfClosing, external }
|
|
254
|
+
: { kind: "open", tag, attrs, selfClosing };
|
|
206
255
|
}
|
|
207
256
|
|
|
208
257
|
function tokenize(input: string): Tok[] | undefined {
|
|
@@ -213,7 +262,9 @@ function tokenize(input: string): Tok[] | undefined {
|
|
|
213
262
|
const next = input.indexOf("<", i);
|
|
214
263
|
const end = next < 0 ? input.length : next;
|
|
215
264
|
const text = input.slice(i, end);
|
|
216
|
-
|
|
265
|
+
// `data:` stays refused in text, as it was before image data was allowed (W-091).
|
|
266
|
+
if (/data:/i.test(text)) return undefined;
|
|
267
|
+
if (text.trim()) tokens.push({ kind: "text", value: decodeEntities(text) });
|
|
217
268
|
i = end;
|
|
218
269
|
continue;
|
|
219
270
|
}
|
|
@@ -234,8 +285,12 @@ function tokenize(input: string): Tok[] | undefined {
|
|
|
234
285
|
return tokens;
|
|
235
286
|
}
|
|
236
287
|
|
|
237
|
-
|
|
288
|
+
/** Stands in for an external `<image>` while building; its parent leaves it out. */
|
|
289
|
+
const LEFT_OUT: VNode = { tag: "image", attrs: {}, children: [] };
|
|
290
|
+
|
|
291
|
+
function build(tokens: Tok[]): { tree: VNode; images: number } | undefined {
|
|
238
292
|
let index = 0;
|
|
293
|
+
let images = 0;
|
|
239
294
|
|
|
240
295
|
const read = (): VNode | string | undefined => {
|
|
241
296
|
const tok = tokens[index];
|
|
@@ -247,6 +302,10 @@ function build(tokens: Tok[]): VNode | undefined {
|
|
|
247
302
|
if (tok.kind === "close") return undefined;
|
|
248
303
|
index += 1;
|
|
249
304
|
if (tok.selfClosing) {
|
|
305
|
+
if (tok.external) {
|
|
306
|
+
images += 1;
|
|
307
|
+
return LEFT_OUT;
|
|
308
|
+
}
|
|
250
309
|
return { tag: tok.tag, attrs: { ...tok.attrs }, children: [] };
|
|
251
310
|
}
|
|
252
311
|
const children: (VNode | string)[] = [];
|
|
@@ -260,23 +319,45 @@ function build(tokens: Tok[]): VNode | undefined {
|
|
|
260
319
|
}
|
|
261
320
|
const child = read();
|
|
262
321
|
if (child === undefined) return undefined;
|
|
322
|
+
if (child === LEFT_OUT) continue;
|
|
263
323
|
if (typeof child !== "string" || TEXT_TAGS.has(tok.tag)) children.push(child);
|
|
264
324
|
}
|
|
325
|
+
if (tok.external) {
|
|
326
|
+
images += 1;
|
|
327
|
+
return LEFT_OUT;
|
|
328
|
+
}
|
|
265
329
|
return { tag: tok.tag, attrs: { ...tok.attrs }, children };
|
|
266
330
|
};
|
|
267
331
|
|
|
268
332
|
const root = read();
|
|
269
333
|
if (!root || typeof root === "string" || root.tag !== "svg") return undefined;
|
|
270
334
|
if (index !== tokens.length) return undefined;
|
|
271
|
-
return root;
|
|
335
|
+
return { tree: root, images };
|
|
272
336
|
}
|
|
273
337
|
|
|
338
|
+
/** A sanitized SVG and how many external `<image>`s were left out of it (W-231). */
|
|
339
|
+
export type SvgReport = { tree: VNode | undefined; images: number };
|
|
340
|
+
|
|
274
341
|
/**
|
|
275
342
|
* Parse pasted SVG into an allowlisted VNode tree (R-032 / W-073 / W-079).
|
|
276
343
|
* Rejects scripts, handlers, foreignObject, style, anchors, and unsafe urls.
|
|
277
|
-
* Allows fragment-only `use`
|
|
344
|
+
* Allows fragment-only `use` hrefs; `image` keeps only media-library or raster-data hrefs (W-231).
|
|
278
345
|
*/
|
|
279
346
|
export function sanitizeSvgMarkup(raw: string): VNode | undefined {
|
|
347
|
+
return sanitizeSvgReport(raw).tree;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* `sanitizeSvgMarkup` plus the number of `<image>`s left out because they point outside the site
|
|
352
|
+
* (W-231). Only media-library paths (`/_emdash/api/media/file/…`) and embedded PNG, JPEG, WebP or
|
|
353
|
+
* GIF data are kept, so a pasted SVG can't load a tracking pixel or a remote picture. Render calls
|
|
354
|
+
* this on every build, so stored SVGs follow without a migration.
|
|
355
|
+
*/
|
|
356
|
+
export function sanitizeSvgReport(raw: string): SvgReport {
|
|
357
|
+
return parseSvg(raw) ?? { tree: undefined, images: 0 };
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function parseSvg(raw: string): { tree: VNode; images: number } | undefined {
|
|
280
361
|
if (typeof raw !== "string") return undefined;
|
|
281
362
|
const trimmed = raw.trim();
|
|
282
363
|
if (!trimmed || trimmed.length > MAX_MARKUP) return undefined;
|
|
@@ -21,6 +21,10 @@ export type FieldDescriptor = {
|
|
|
21
21
|
/** Shown under the control when the value is invalid. */
|
|
22
22
|
message?: string;
|
|
23
23
|
optional?: boolean;
|
|
24
|
+
/** Highest value a whole-number field accepts, matching its schema (W-223). */
|
|
25
|
+
max?: number;
|
|
26
|
+
/** Props that hold this field's tablet and mobile values (W-139); unset follows the wider device. */
|
|
27
|
+
devices?: { tablet: string; mobile: string };
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
export type ElementDescriptor = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { DeviceStyles, HiddenOn, StyleProps, StyleStates } from "./style.ts";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
export const DESIGN_SCHEMA_VERSION =
|
|
4
|
+
/** 12 since W-160: class gradients use the same stops as layouts. v11 `{ angle, from, to }` upgrades on read. */
|
|
5
|
+
export const DESIGN_SCHEMA_VERSION = 12;
|
|
6
6
|
|
|
7
7
|
/** Tags a site can give a starting style. Classes and local styles still win. */
|
|
8
8
|
export const DEFAULT_STYLE_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "a", "button"] as const;
|
|
@@ -60,6 +60,11 @@ export const DesignSystem = z.strictObject({
|
|
|
60
60
|
spacings: z.array(LengthVariable).max(100).optional(),
|
|
61
61
|
}),
|
|
62
62
|
classes: z.array(StyleClass).max(100).optional(),
|
|
63
|
+
/**
|
|
64
|
+
* Site text direction (W-230). Unset is left to right. Rendered as `dir` on every EmVB root
|
|
65
|
+
* and returned to hosts for `<html dir>`. Layout uses logical properties, so styles flip.
|
|
66
|
+
*/
|
|
67
|
+
direction: z.enum(["ltr", "rtl", "auto"]).optional(),
|
|
63
68
|
/** Starting styles for HTML tags, emitted under `:where(.emvb-root)` so a class still wins. */
|
|
64
69
|
defaults: z
|
|
65
70
|
.strictObject({
|