@perkyzz/emvb 0.4.0 → 0.6.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 +23 -3
- package/THIRD_PARTY_NOTICES.md +23 -1
- package/licenses/exif-js.LICENSE +21 -0
- package/licenses/fflate.LICENSE +21 -0
- package/licenses/glfx.js.LICENSE +19 -0
- package/licenses/mini-photo-editor.LICENSE +21 -0
- package/licenses/photocn.LICENSE +21 -0
- package/package.json +5 -3
- package/src/admin/agents-api.ts +39 -0
- package/src/admin/editor/CommandPalette.tsx +43 -2
- package/src/admin/editor/Editor.tsx +33 -0
- package/src/admin/editor/Timeline.tsx +108 -6
- package/src/admin/editor/collection-previews.ts +6 -1
- package/src/admin/editor/editor-chrome.tsx +49 -0
- package/src/admin/editor/editor-commands.ts +13 -0
- package/src/admin/editor/editor-css.ts +7 -0
- package/src/admin/editor/feature-css.ts +22 -3
- package/src/admin/editor/palette.ts +6 -2
- package/src/admin/editor/panels/ColorControl.tsx +24 -12
- package/src/admin/editor/panels/ElementPanel.tsx +1 -1
- package/src/admin/editor/panels/LayersPanel.tsx +13 -3
- package/src/admin/editor/panels/TokenScales.tsx +4 -2
- package/src/admin/editor/panels/VariableSection.tsx +5 -3
- package/src/admin/editor/panels/color-space.ts +12 -1
- package/src/admin/editor/panels/settings/AdvancedFields.tsx +84 -28
- package/src/admin/editor/panels/settings/AudienceEditor.tsx +42 -4
- package/src/admin/editor/panels/settings/DraftTextField.tsx +38 -9
- package/src/admin/editor/panels/settings/FieldControl.tsx +24 -7
- package/src/admin/editor/panels/settings/IconPicker.tsx +21 -1
- package/src/admin/editor/panels/settings/ImageSourcesField.tsx +111 -0
- package/src/admin/editor/panels/settings/MediaPicker.tsx +156 -7
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +178 -0
- package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +76 -0
- package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
- package/src/admin/editor/panels/settings/link-rules.ts +19 -0
- package/src/admin/editor/panels/settings/number-input.ts +11 -0
- package/src/admin/editor/panels/settings/query-style.ts +65 -0
- package/src/admin/editor/panels/variable-values.ts +18 -2
- package/src/admin/editor/remote-change.ts +67 -0
- package/src/admin/editor/store.ts +7 -3
- package/src/admin/image-editor/BlurFocus.tsx +112 -0
- package/src/admin/image-editor/Canvas.tsx +261 -0
- package/src/admin/image-editor/CropOverlay.tsx +390 -0
- package/src/admin/image-editor/CurvesPanel.tsx +394 -0
- package/src/admin/image-editor/ExportDialog.tsx +354 -0
- package/src/admin/image-editor/ImageEditButton.tsx +83 -0
- package/src/admin/image-editor/ImageEditorDialog.tsx +786 -0
- package/src/admin/image-editor/MetadataPanel.tsx +183 -0
- package/src/admin/image-editor/announce.tsx +65 -0
- package/src/admin/image-editor/crop-geometry.ts +161 -0
- package/src/admin/image-editor/curve-math.ts +177 -0
- package/src/admin/image-editor/data-url-fetch.ts +59 -0
- package/src/admin/image-editor/engine.ts +55 -0
- package/src/admin/image-editor/exif.ts +82 -0
- package/src/admin/image-editor/flatten.ts +54 -0
- package/src/admin/image-editor/gpu-fit.ts +81 -0
- package/src/admin/image-editor/image-editor-css.ts +398 -0
- package/src/admin/image-editor/load.ts +109 -0
- package/src/admin/image-editor/panels.tsx +287 -0
- package/src/admin/image-editor/parts.tsx +565 -0
- package/src/admin/image-editor/save.ts +125 -0
- package/src/admin/image-editor/tone-panels.tsx +338 -0
- package/src/admin/image-editor/tools.ts +59 -0
- package/src/admin/image-editor/worker.ts +111 -0
- package/src/admin/index.tsx +3 -1
- package/src/admin/media-api.ts +132 -2
- package/src/admin/pages/AgentsPage.tsx +274 -0
- package/src/admin/ui.ts +33 -0
- package/src/astro/EmVBPage.astro +11 -2
- package/src/astro/floats/runtime.ts +10 -0
- package/src/astro/popups/runtime.ts +15 -0
- package/src/astro/render.ts +3 -0
- package/src/astro/resolve-theme.ts +15 -4
- package/src/astro/tabs/runtime.ts +60 -1
- package/src/astro/visitor.ts +4 -3
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +202 -26
- package/src/core/arrange.ts +13 -3
- package/src/core/css/generate.ts +9 -1
- package/src/core/data/bindings.ts +12 -6
- package/src/core/design/classes.ts +5 -3
- package/src/core/design/diff.ts +3 -1
- package/src/core/design/merge.ts +3 -1
- package/src/core/design/transfer.ts +13 -2
- package/src/core/design/variables.ts +2 -1
- package/src/core/elements/dynamic-elements.ts +9 -1
- package/src/core/elements/form-elements.ts +18 -3
- package/src/core/elements/index.ts +39 -11
- package/src/core/elements/plain-text.ts +2 -2
- package/src/core/forms/binding.ts +148 -1
- package/src/core/history/diff.ts +32 -4
- package/src/core/image-edit/schema.ts +145 -0
- package/src/core/image-edit/summary.ts +58 -0
- package/src/core/index.ts +14 -0
- package/src/core/limits.ts +10 -0
- package/src/core/migrate/index.ts +3 -1
- package/src/core/perf/meter.ts +9 -1
- package/src/core/render/dynamic-post.ts +23 -6
- package/src/core/render/form.ts +36 -11
- package/src/core/render/index.ts +75 -15
- package/src/core/render/pagination.ts +21 -2
- package/src/core/sanitize/embed-url.ts +7 -1
- package/src/core/sanitize/href.ts +13 -1
- package/src/core/schema/descriptors.ts +4 -1
- package/src/core/schema/layout.ts +21 -4
- package/src/core/share/link.ts +9 -3
- package/src/core/stable-json.ts +15 -0
- package/src/core/theme/dynamic.ts +32 -24
- package/src/core/theme/pagination.ts +30 -3
- package/src/core/theme/popup-rules.ts +10 -5
- package/src/mcp/errors.ts +44 -0
- package/src/mcp/index.ts +4 -0
- package/src/mcp/ports.ts +85 -0
- package/src/mcp/prompts.ts +76 -0
- package/src/mcp/publish.ts +60 -0
- package/src/mcp/queue.ts +19 -0
- package/src/mcp/rate-limit.ts +80 -0
- package/src/mcp/read.ts +486 -0
- package/src/mcp/refs.ts +84 -0
- package/src/mcp/settings.ts +18 -0
- package/src/mcp/tools.ts +265 -0
- package/src/mcp/write.ts +664 -0
- package/src/server/agent-settings.ts +159 -0
- package/src/server/design-routes.ts +71 -17
- package/src/server/icon-routes.ts +13 -6
- package/src/server/mcp-routes.ts +323 -0
- package/src/server/plugin.ts +32 -2
|
@@ -297,7 +297,7 @@ const button: ElementDefinition<ButtonNode> = {
|
|
|
297
297
|
{ value: "lg", label: "Large" },
|
|
298
298
|
],
|
|
299
299
|
},
|
|
300
|
-
{ key: "iconGap", kind: "int", label: "Gap (px)", optional: true },
|
|
300
|
+
{ key: "iconGap", kind: "int", label: "Gap (px)", optional: true, min: 0, max: 64 },
|
|
301
301
|
],
|
|
302
302
|
},
|
|
303
303
|
build: (node, attrs) => {
|
|
@@ -418,8 +418,8 @@ const image: ElementDefinition<ImageNode> = {
|
|
|
418
418
|
},
|
|
419
419
|
{ key: "newTab", kind: "boolean", label: "Open link in a new tab", optional: true },
|
|
420
420
|
{ key: "caption", kind: "text", label: "Caption", optional: true },
|
|
421
|
-
{ key: "focalX", kind: "int", label: "Focal point X (%)", optional: true },
|
|
422
|
-
{ key: "focalY", kind: "int", label: "Focal point Y (%)", optional: true },
|
|
421
|
+
{ key: "focalX", kind: "int", label: "Focal point X (%)", optional: true, min: 0, max: 100 },
|
|
422
|
+
{ key: "focalY", kind: "int", label: "Focal point Y (%)", optional: true, min: 0, max: 100 },
|
|
423
423
|
{
|
|
424
424
|
key: "width",
|
|
425
425
|
kind: "int",
|
|
@@ -434,6 +434,7 @@ const image: ElementDefinition<ImageNode> = {
|
|
|
434
434
|
optional: true,
|
|
435
435
|
message: "Height must be a positive whole number.",
|
|
436
436
|
},
|
|
437
|
+
{ key: "sources", kind: "image-sources", label: "Extra sizes (srcset)", optional: true },
|
|
437
438
|
],
|
|
438
439
|
},
|
|
439
440
|
build: (node, attrs) => {
|
|
@@ -457,7 +458,7 @@ const image: ElementDefinition<ImageNode> = {
|
|
|
457
458
|
if (decorative) imgAttrs.role = "presentation";
|
|
458
459
|
if (node.props.width !== undefined) imgAttrs.width = String(node.props.width);
|
|
459
460
|
if (node.props.height !== undefined) imgAttrs.height = String(node.props.height);
|
|
460
|
-
const sources = imageSources(node.props.
|
|
461
|
+
const sources = imageSources(src, node.props.sources, node.props.width);
|
|
461
462
|
if (sources) {
|
|
462
463
|
imgAttrs.srcset = sources;
|
|
463
464
|
imgAttrs.sizes = "100vw";
|
|
@@ -484,22 +485,45 @@ const image: ElementDefinition<ImageNode> = {
|
|
|
484
485
|
},
|
|
485
486
|
};
|
|
486
487
|
|
|
488
|
+
const validSourceWidth = (width: unknown): width is number =>
|
|
489
|
+
Number.isInteger(width) && (width as number) >= 1 && (width as number) <= 8000;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* W-428: a same-site path may hold a space ("/uploads/my photo.jpg"); in srcset that space ends
|
|
493
|
+
* the URL, so the size was dropped. It's encoded; full addresses can't hold spaces anyway.
|
|
494
|
+
*/
|
|
495
|
+
const srcsetUrl = (url: string | undefined): string | undefined => url?.replaceAll(" ", "%20");
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* W-385: with `w` descriptors the browser picks only from srcset and ignores `src`, so the main
|
|
499
|
+
* image is listed too when its width is known (its own source entry, else the Width field).
|
|
500
|
+
*/
|
|
487
501
|
function imageSources(
|
|
488
502
|
src: string,
|
|
489
503
|
sources: { src: string; width: number }[] | undefined,
|
|
504
|
+
width: number | undefined,
|
|
490
505
|
): string | undefined {
|
|
491
506
|
if (!sources || sources.length === 0) return undefined;
|
|
492
507
|
const parts: string[] = [];
|
|
493
508
|
const seen = new Set<string>();
|
|
509
|
+
let srcWidth: number | undefined;
|
|
494
510
|
for (const source of sources) {
|
|
495
|
-
const url = sanitizeMediaUrl(source.src);
|
|
511
|
+
const url = srcsetUrl(sanitizeMediaUrl(source.src));
|
|
512
|
+
if (!validSourceWidth(source.width)) continue;
|
|
513
|
+
if (url === srcsetUrl(src)) {
|
|
514
|
+
srcWidth ??= source.width;
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
496
517
|
// A comma or space is another srcset candidate, so one field would request a second host.
|
|
497
|
-
if (!url || /[\s,]/.test(url) ||
|
|
498
|
-
if (!Number.isInteger(source.width) || source.width < 1 || source.width > 8000) continue;
|
|
518
|
+
if (!url || /[\s,]/.test(url) || seen.has(url)) continue;
|
|
499
519
|
seen.add(url);
|
|
500
520
|
parts.push(`${url} ${source.width}w`);
|
|
501
521
|
}
|
|
502
|
-
|
|
522
|
+
if (parts.length === 0) return undefined;
|
|
523
|
+
srcWidth ??= validSourceWidth(width) ? width : undefined;
|
|
524
|
+
const main = srcsetUrl(src);
|
|
525
|
+
if (srcWidth !== undefined && main && !/[\s,]/.test(main)) parts.push(`${main} ${srcWidth}w`);
|
|
526
|
+
return parts.join(", ");
|
|
503
527
|
}
|
|
504
528
|
|
|
505
529
|
/** Root stroke widths the Stroke width control can override (W-237); Lucide and Tabler use 2. */
|
|
@@ -957,6 +981,10 @@ const layoutSection: ElementDefinition<LayoutSectionNode> = {
|
|
|
957
981
|
},
|
|
958
982
|
};
|
|
959
983
|
|
|
984
|
+
/** W-394: shown when a custom track line can't be saved. */
|
|
985
|
+
const TRACKS_HINT =
|
|
986
|
+
"Up to 12 tracks, one per line: 1fr, 2fr, 3fr, auto, min-content, max-content, or a length.";
|
|
987
|
+
|
|
960
988
|
const grid: ElementDefinition<GridNode> = {
|
|
961
989
|
baseCss: ".emvb-grid{display:grid;min-width:0}",
|
|
962
990
|
defaults: () => ({ type: "grid", props: { columns: 3 }, children: [] }),
|
|
@@ -981,21 +1009,21 @@ const grid: ElementDefinition<GridNode> = {
|
|
|
981
1009
|
kind: "list-items",
|
|
982
1010
|
label: "Custom tracks",
|
|
983
1011
|
optional: true,
|
|
984
|
-
message:
|
|
1012
|
+
message: TRACKS_HINT,
|
|
985
1013
|
},
|
|
986
1014
|
{
|
|
987
1015
|
key: "columnTracksTablet",
|
|
988
1016
|
kind: "list-items",
|
|
989
1017
|
label: "Custom tracks on tablet",
|
|
990
1018
|
optional: true,
|
|
991
|
-
message:
|
|
1019
|
+
message: `${TRACKS_HINT} Leave empty to follow the desktop tracks.`,
|
|
992
1020
|
},
|
|
993
1021
|
{
|
|
994
1022
|
key: "columnTracksMobile",
|
|
995
1023
|
kind: "list-items",
|
|
996
1024
|
label: "Custom tracks on mobile",
|
|
997
1025
|
optional: true,
|
|
998
|
-
message:
|
|
1026
|
+
message: `${TRACKS_HINT} Leave empty to follow the next wider device.`,
|
|
999
1027
|
},
|
|
1000
1028
|
...BOX_LINK_FIELDS,
|
|
1001
1029
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_TEXT_LENGTH } from "../limits.ts";
|
|
1
|
+
import { clipText, MAX_TEXT_LENGTH } from "../limits.ts";
|
|
2
2
|
import type { LayoutNode } from "../schema/layout.ts";
|
|
3
3
|
|
|
4
4
|
/** Elements whose visible words are one `props.text` string (W-097). */
|
|
@@ -23,7 +23,7 @@ export function isMultilineText(node: LayoutNode): boolean {
|
|
|
23
23
|
/** The string a canvas edit may store. Over-long text is cut to the schema limit. */
|
|
24
24
|
export function commitPlainText(text: string, multiline: boolean): string {
|
|
25
25
|
const flat = multiline ? text : text.replaceAll("\n", "");
|
|
26
|
-
return flat
|
|
26
|
+
return clipText(flat, MAX_TEXT_LENGTH);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export function withPlainText(node: LayoutNode, text: string): LayoutNode {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isFormNode, type Layout, type LayoutNode } from "../schema/layout.ts";
|
|
2
|
-
import {
|
|
2
|
+
import { audienceSummary } from "../audience/rules.ts";
|
|
3
|
+
import { forEachNode, nodeChildren, someNode } from "../tree-ops.ts";
|
|
3
4
|
import { fieldsOf, type FormDefinitions } from "./definition.ts";
|
|
4
5
|
|
|
5
6
|
export type MissingRequiredField = {
|
|
@@ -50,3 +51,149 @@ export function findMissingRequiredFields(
|
|
|
50
51
|
export function layoutHasForm(layout: Layout): boolean {
|
|
51
52
|
return someNode(layout.root, (node) => isFormNode(node) && node.props.formId.trim() !== "");
|
|
52
53
|
}
|
|
54
|
+
|
|
55
|
+
/** A field as the forms plugin defines it; only what the checks below read. */
|
|
56
|
+
export type RequiredFieldInfo = { name: string; label: string; required: boolean };
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A required field visitors can't fill (W-511): `missing` has no control in the form; `hidden`
|
|
60
|
+
* has its controls hidden on some device, where the form then can never be sent (the forms
|
|
61
|
+
* client checks the hidden control and writes its error where nobody sees it).
|
|
62
|
+
*/
|
|
63
|
+
export type RequiredFieldIssue =
|
|
64
|
+
| { kind: "missing"; formNodeId: string; field: string; label: string }
|
|
65
|
+
| {
|
|
66
|
+
kind: "hidden";
|
|
67
|
+
formNodeId: string;
|
|
68
|
+
field: string;
|
|
69
|
+
label: string;
|
|
70
|
+
/** The bound control (the first one, when the field is bound more than once). */
|
|
71
|
+
nodeId: string;
|
|
72
|
+
devices: string[];
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
kind: "audience";
|
|
76
|
+
formNodeId: string;
|
|
77
|
+
field: string;
|
|
78
|
+
label: string;
|
|
79
|
+
nodeId: string;
|
|
80
|
+
/** Who sees it, e.g. "Only CA · returning", or "Variant B of A/B test hero". */
|
|
81
|
+
who: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const FIELD_TYPES = new Set(["text-input", "textarea", "select", "checkbox", "radio"]);
|
|
85
|
+
const DEVICE_ORDER = ["desktop", "tablet", "mobile"];
|
|
86
|
+
|
|
87
|
+
/** Each bound field's controls, with the devices each is hidden on (itself or an ancestor). */
|
|
88
|
+
type Control = { nodeId: string; hidden: Set<string>; who?: string };
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* W-513: who an element is limited to, by a Visitors rule or as one arm of an A/B test, or
|
|
92
|
+
* undefined when everyone sees it.
|
|
93
|
+
*/
|
|
94
|
+
function restriction(node: LayoutNode): string | undefined {
|
|
95
|
+
const audience = node.audience;
|
|
96
|
+
if (audience) {
|
|
97
|
+
const { hide, timeZone: _zone, ...rules } = audience;
|
|
98
|
+
if (hide || Object.values(rules).some((rule) => rule !== undefined)) {
|
|
99
|
+
return audienceSummary(audience);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (node.variant) {
|
|
103
|
+
return `Variant ${node.variant.arm.toUpperCase()} of A/B test ${node.variant.test}`;
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function boundControls(form: LayoutNode): Map<string, Control[]> {
|
|
109
|
+
const found = new Map<string, Control[]>();
|
|
110
|
+
const walk = (node: LayoutNode, inherited: ReadonlySet<string>, limited: string | undefined) => {
|
|
111
|
+
const own = (node as { hiddenOn?: readonly string[] }).hiddenOn ?? [];
|
|
112
|
+
const hidden = own.length ? new Set([...inherited, ...own]) : inherited;
|
|
113
|
+
const who = limited ?? restriction(node);
|
|
114
|
+
if (FIELD_TYPES.has(node.type)) {
|
|
115
|
+
const field = (node.props as { field?: unknown }).field;
|
|
116
|
+
if (typeof field === "string" && field) {
|
|
117
|
+
const control: Control = { nodeId: node.id, hidden: new Set(hidden) };
|
|
118
|
+
if (who) control.who = who;
|
|
119
|
+
found.set(field, [...(found.get(field) ?? []), control]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const child of nodeChildren(node)) walk(child, hidden, who);
|
|
123
|
+
};
|
|
124
|
+
// The form's own hiddenOn or audience hides the whole form, which loses no answers: not counted.
|
|
125
|
+
for (const child of nodeChildren(form)) walk(child, new Set(), undefined);
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Two controls that split the visitors between them (A and B of one test, or "Only X" and
|
|
131
|
+
* "Hidden for X") still reach everyone.
|
|
132
|
+
*/
|
|
133
|
+
function coversEveryone(controls: readonly Control[]): boolean {
|
|
134
|
+
const who = new Set(controls.map((control) => control.who));
|
|
135
|
+
for (const label of who) {
|
|
136
|
+
if (!label) continue;
|
|
137
|
+
const ab = /^Variant ([AB]) of (A\/B test .+)$/.exec(label);
|
|
138
|
+
if (ab && who.has(`Variant ${ab[1] === "A" ? "B" : "A"} of ${ab[2]}`)) return true;
|
|
139
|
+
if (label.startsWith("Only ") && who.has(`Hidden for ${label.slice(5)}`)) return true;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** W-511: required fields of the form element's definition that visitors can't fill. */
|
|
145
|
+
export function requiredFieldIssues(
|
|
146
|
+
form: LayoutNode,
|
|
147
|
+
fields: readonly RequiredFieldInfo[],
|
|
148
|
+
): RequiredFieldIssue[] {
|
|
149
|
+
const controls = boundControls(form);
|
|
150
|
+
const issues: RequiredFieldIssue[] = [];
|
|
151
|
+
for (const field of fields) {
|
|
152
|
+
if (!field.required) continue;
|
|
153
|
+
const label = field.label.trim() || field.name;
|
|
154
|
+
const bound = controls.get(field.name);
|
|
155
|
+
if (!bound?.length) {
|
|
156
|
+
issues.push({ kind: "missing", formNodeId: form.id, field: field.name, label });
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
// Hidden on a device only when every control for the field is hidden there.
|
|
160
|
+
const devices = DEVICE_ORDER.filter((device) => bound.every((c) => c.hidden.has(device)));
|
|
161
|
+
if (devices.length) {
|
|
162
|
+
issues.push({
|
|
163
|
+
kind: "hidden",
|
|
164
|
+
formNodeId: form.id,
|
|
165
|
+
field: field.name,
|
|
166
|
+
label,
|
|
167
|
+
nodeId: (bound[0] as { nodeId: string }).nodeId,
|
|
168
|
+
devices,
|
|
169
|
+
});
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
// W-513: only some visitors see every control for the field; the rest can't send the form.
|
|
173
|
+
const first = bound[0] as Control;
|
|
174
|
+
if (bound.every((control) => control.who !== undefined) && !coversEveryone(bound)) {
|
|
175
|
+
issues.push({
|
|
176
|
+
kind: "audience",
|
|
177
|
+
formNodeId: form.id,
|
|
178
|
+
field: field.name,
|
|
179
|
+
label,
|
|
180
|
+
nodeId: first.nodeId,
|
|
181
|
+
who: first.who as string,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return issues;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** The sentence the editor and describe_page show for one issue (W-511). */
|
|
189
|
+
export function requiredFieldIssueText(issue: RequiredFieldIssue): string {
|
|
190
|
+
if (issue.kind === "missing") {
|
|
191
|
+
return `“${issue.label}” is required by the form but has no field here, so the form can't be sent. Add a field bound to ${issue.field}, or make it optional in Forms.`;
|
|
192
|
+
}
|
|
193
|
+
if (issue.kind === "audience") {
|
|
194
|
+
return `“${issue.label}” is required but shown only to some visitors (${issue.who}), so everyone else can't send the form. Remove the rule from the field, or make it optional in Forms.`;
|
|
195
|
+
}
|
|
196
|
+
const where =
|
|
197
|
+
issue.devices.length === 3 ? "on every device" : `on ${issue.devices.join(" and ")}`;
|
|
198
|
+
return `“${issue.label}” is required but hidden ${where}, so visitors there can't send the form. Show the field there, or make it optional in Forms.`;
|
|
199
|
+
}
|
package/src/core/history/diff.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { withFreshIds } from "../arrange.ts";
|
|
2
2
|
import { MAX_NODES } from "../limits.ts";
|
|
3
|
+
import { stableJson } from "../stable-json.ts";
|
|
3
4
|
import type { Layout, LayoutNode } from "../schema/layout.ts";
|
|
4
5
|
import { insertNode, nodeChildren, updateNode } from "../tree-ops.ts";
|
|
5
6
|
|
|
@@ -12,10 +13,13 @@ export type SectionChange = {
|
|
|
12
13
|
edits: number;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* A stable text of a node without its children, to tell edits from unchanged nodes. Key order
|
|
18
|
+
* is ignored, so the same element saved and reloaded doesn't count as edited (W-518).
|
|
19
|
+
*/
|
|
16
20
|
function own(node: LayoutNode): string {
|
|
17
21
|
const { children: _children, ...rest } = node as LayoutNode & { children?: unknown };
|
|
18
|
-
return
|
|
22
|
+
return stableJson(rest);
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
function index(node: LayoutNode, into = new Map<string, LayoutNode>()): Map<string, LayoutNode> {
|
|
@@ -96,6 +100,27 @@ export function diffSections(older: Layout, current: Layout): SectionChange[] {
|
|
|
96
100
|
return changes;
|
|
97
101
|
}
|
|
98
102
|
|
|
103
|
+
/** `node` without the CSS ids that `taken` already holds, so a restored section never repeats one. */
|
|
104
|
+
function withoutTakenHtmlIds(node: LayoutNode, taken: Set<string>): LayoutNode {
|
|
105
|
+
const kids = nodeChildren(node);
|
|
106
|
+
const { htmlId, ...rest } = node;
|
|
107
|
+
const keep = htmlId && !taken.has(htmlId) ? { htmlId } : {};
|
|
108
|
+
const out = { ...rest, ...keep } as LayoutNode;
|
|
109
|
+
if (kids.length === 0) return out;
|
|
110
|
+
return { ...out, children: kids.map((child) => withoutTakenHtmlIds(child, taken)) } as LayoutNode;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const htmlIdsOf = (node: LayoutNode, skip?: LayoutNode): Set<string> => {
|
|
114
|
+
const ids = new Set<string>();
|
|
115
|
+
const walk = (n: LayoutNode) => {
|
|
116
|
+
if (n === skip) return;
|
|
117
|
+
if (n.htmlId) ids.add(n.htmlId);
|
|
118
|
+
for (const child of nodeChildren(n)) walk(child);
|
|
119
|
+
};
|
|
120
|
+
walk(node);
|
|
121
|
+
return ids;
|
|
122
|
+
};
|
|
123
|
+
|
|
99
124
|
const count = (node: LayoutNode): number =>
|
|
100
125
|
1 + nodeChildren(node).reduce((sum, child) => sum + count(child), 0);
|
|
101
126
|
|
|
@@ -116,11 +141,14 @@ export function restoreSection(
|
|
|
116
141
|
const elsewhere = new Set(index(current.root).keys());
|
|
117
142
|
if (replacing) for (const id of index(replacing).keys()) elsewhere.delete(id);
|
|
118
143
|
const clashes = [...index(section).keys()].some((id) => elsewhere.has(id));
|
|
119
|
-
|
|
144
|
+
// CSS ids another section took since then stay there: a repeat made the page fail to save (W-517).
|
|
145
|
+
const takenHtml = htmlIdsOf(current.root, replacing);
|
|
146
|
+
const fresh = clashes ? withFreshIds(current, section) : section;
|
|
147
|
+
const incoming = withoutTakenHtmlIds(fresh, takenHtml);
|
|
120
148
|
const size = count(current.root) - (replacing ? count(replacing) : 0) + count(incoming);
|
|
121
149
|
if (size > MAX_NODES) return { ok: false, reason: "The page would have too many elements." };
|
|
122
150
|
if (replacing && !clashes) {
|
|
123
|
-
return { ok: true, layout: updateNode(current, sectionId, () => structuredClone(
|
|
151
|
+
return { ok: true, layout: updateNode(current, sectionId, () => structuredClone(incoming)) };
|
|
124
152
|
}
|
|
125
153
|
// Removed (or renewed): after the nearest earlier section that is still on the page.
|
|
126
154
|
const before = new Set(older.root.children.slice(0, oldIndex).map((n) => n.id));
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Editor-only record of an image edit (W-481, D-061). Stored on `image.props.edit`; never
|
|
5
|
+
* rendered. `src`/`mediaId`/`width`/`height` on the element point at the edited file, this
|
|
6
|
+
* record points back at the untouched original and holds the photocn recipe to re-open it.
|
|
7
|
+
*
|
|
8
|
+
* The recipe mirrors photocn's `RecipeV1` but is strict and capped, so a crafted recipe can't
|
|
9
|
+
* bloat the layout or crash the renderer. This module has no photocn import (core stays pure).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Max JSON size of a recipe, in UTF-8 bytes. */
|
|
13
|
+
export const IMAGE_EDIT_RECIPE_MAX_BYTES = 16 * 1024;
|
|
14
|
+
/** Max points per tone curve channel. */
|
|
15
|
+
export const IMAGE_EDIT_CURVE_POINTS_MAX = 32;
|
|
16
|
+
|
|
17
|
+
const Slider = z.number().finite().min(-1).max(1);
|
|
18
|
+
const Unit = z.number().finite().min(0).max(1);
|
|
19
|
+
|
|
20
|
+
const Lights = z
|
|
21
|
+
.strictObject({
|
|
22
|
+
brightness: Slider,
|
|
23
|
+
exposure: Slider,
|
|
24
|
+
gamma: Slider,
|
|
25
|
+
contrast: Slider,
|
|
26
|
+
shadows: Slider,
|
|
27
|
+
highlights: Slider,
|
|
28
|
+
bloom: Slider,
|
|
29
|
+
})
|
|
30
|
+
.partial();
|
|
31
|
+
const Colors = z
|
|
32
|
+
.strictObject({
|
|
33
|
+
temperature: Slider,
|
|
34
|
+
tint: Slider,
|
|
35
|
+
vibrance: Slider,
|
|
36
|
+
saturation: Slider,
|
|
37
|
+
sepia: Slider,
|
|
38
|
+
})
|
|
39
|
+
.partial();
|
|
40
|
+
const Effects = z.strictObject({ clarity: Slider, noise: Slider, vignette: Slider }).partial();
|
|
41
|
+
const Blur = z
|
|
42
|
+
.strictObject({
|
|
43
|
+
bokehstrength: Unit,
|
|
44
|
+
bokehlensout: Unit,
|
|
45
|
+
gaussianstrength: Unit,
|
|
46
|
+
gaussianlensout: Unit,
|
|
47
|
+
centerX: Unit,
|
|
48
|
+
centerY: Unit,
|
|
49
|
+
})
|
|
50
|
+
.partial();
|
|
51
|
+
|
|
52
|
+
const CurvePoint = z.tuple([Unit, Unit]);
|
|
53
|
+
const CurveChannel = z.array(CurvePoint).min(2).max(IMAGE_EDIT_CURVE_POINTS_MAX).nullable();
|
|
54
|
+
const Curves = z.tuple([CurveChannel, CurveChannel, CurveChannel, CurveChannel]);
|
|
55
|
+
|
|
56
|
+
/** Corner targets may sit a little outside the frame (perspective pulls). */
|
|
57
|
+
const Corner = z.tuple([z.number().finite().min(-2).max(3), z.number().finite().min(-2).max(3)]);
|
|
58
|
+
const Rect = z
|
|
59
|
+
.strictObject({
|
|
60
|
+
x: Unit,
|
|
61
|
+
y: Unit,
|
|
62
|
+
width: z.number().finite().gt(0).max(1),
|
|
63
|
+
height: z.number().finite().gt(0).max(1),
|
|
64
|
+
})
|
|
65
|
+
.refine(
|
|
66
|
+
(r) => r.x + r.width <= 1.000001 && r.y + r.height <= 1.000001,
|
|
67
|
+
"The crop must stay inside the image",
|
|
68
|
+
);
|
|
69
|
+
const Geometry = z
|
|
70
|
+
.strictObject({
|
|
71
|
+
quarterTurns: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]),
|
|
72
|
+
flipX: z.boolean(),
|
|
73
|
+
straighten: z.number().finite().min(-45).max(45),
|
|
74
|
+
perspectiveX: Slider,
|
|
75
|
+
perspectiveY: Slider,
|
|
76
|
+
corners: z.tuple([Corner, Corner, Corner, Corner]).nullable(),
|
|
77
|
+
crop: Rect.nullable(),
|
|
78
|
+
aspectRatio: z.number().finite().min(0.01).max(100).nullable(),
|
|
79
|
+
})
|
|
80
|
+
.partial();
|
|
81
|
+
|
|
82
|
+
/** photocn filter labels are short names ("juno"); unknown ones are ignored by the renderer. */
|
|
83
|
+
const FilterLabel = z.string().regex(/^[A-Za-z0-9 _-]{1,32}$/, "Filter names are short words");
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A blend image must be a same-site path or an https URL; `data:` blends (picked files) are
|
|
87
|
+
* refused because they would put a whole image into the layout.
|
|
88
|
+
*/
|
|
89
|
+
const BlendSrc = z
|
|
90
|
+
.string()
|
|
91
|
+
.max(2000)
|
|
92
|
+
.refine(
|
|
93
|
+
(s) => /^\/(?!\/)/.test(s) || /^https:\/\//i.test(s),
|
|
94
|
+
"Blend images must be a site path or an https URL",
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export const ImageEditRecipe = z.strictObject({
|
|
98
|
+
version: z.literal(1),
|
|
99
|
+
name: z.string().max(80).optional(),
|
|
100
|
+
lights: Lights.optional(),
|
|
101
|
+
colors: Colors.optional(),
|
|
102
|
+
effects: Effects.optional(),
|
|
103
|
+
blur: Blur.optional(),
|
|
104
|
+
curves: Curves.optional(),
|
|
105
|
+
blend: z.strictObject({ src: BlendSrc, mix: Unit }).optional(),
|
|
106
|
+
filters: z.strictObject({ label: FilterLabel, strength: Unit.optional() }).optional(),
|
|
107
|
+
geometry: Geometry.optional(),
|
|
108
|
+
});
|
|
109
|
+
export type ImageEditRecipe = z.infer<typeof ImageEditRecipe>;
|
|
110
|
+
|
|
111
|
+
export const IMAGE_EDIT_FORMATS = ["webp", "jpeg", "png"] as const;
|
|
112
|
+
|
|
113
|
+
export const ImageEditOutput = z.strictObject({
|
|
114
|
+
format: z.enum(IMAGE_EDIT_FORMATS),
|
|
115
|
+
/** 0..1 for webp and jpeg. */
|
|
116
|
+
quality: z.number().finite().min(0.1).max(1).optional(),
|
|
117
|
+
/** The longest side was capped to this many pixels. */
|
|
118
|
+
maxSide: z.number().int().min(16).max(10000).optional(),
|
|
119
|
+
stripGps: z.boolean(),
|
|
120
|
+
});
|
|
121
|
+
export type ImageEditOutput = z.infer<typeof ImageEditOutput>;
|
|
122
|
+
|
|
123
|
+
function byteLength(value: unknown): number {
|
|
124
|
+
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const ImageEdit = z.strictObject({
|
|
128
|
+
/** Our record version. */
|
|
129
|
+
v: z.literal(1),
|
|
130
|
+
engine: z.literal("photocn"),
|
|
131
|
+
engineVersion: z
|
|
132
|
+
.string()
|
|
133
|
+
.regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]{1,32})?$/, "A version like 0.1.2"),
|
|
134
|
+
recipe: ImageEditRecipe.refine((r) => byteLength(r) <= IMAGE_EDIT_RECIPE_MAX_BYTES, {
|
|
135
|
+
message: `The edit recipe is larger than ${IMAGE_EDIT_RECIPE_MAX_BYTES / 1024} KB`,
|
|
136
|
+
}),
|
|
137
|
+
/** The untouched source in the media library. */
|
|
138
|
+
originalMediaId: z.string().min(1).max(128).optional(),
|
|
139
|
+
/** Same-origin URL of the source, for re-opening when the media item is gone. */
|
|
140
|
+
originalSrc: z.string().min(1).max(2000),
|
|
141
|
+
output: ImageEditOutput,
|
|
142
|
+
/** ISO 8601 timestamp of the save. */
|
|
143
|
+
editedAt: z.iso.datetime({ offset: true }),
|
|
144
|
+
});
|
|
145
|
+
export type ImageEdit = z.infer<typeof ImageEdit>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ImageEditRecipe } from "./schema.ts";
|
|
2
|
+
|
|
3
|
+
const LABELS: Record<string, string> = {
|
|
4
|
+
brightness: "Brightness",
|
|
5
|
+
exposure: "Exposure",
|
|
6
|
+
gamma: "Gamma",
|
|
7
|
+
contrast: "Contrast",
|
|
8
|
+
shadows: "Shadows",
|
|
9
|
+
highlights: "Highlights",
|
|
10
|
+
bloom: "Bloom",
|
|
11
|
+
temperature: "Temperature",
|
|
12
|
+
tint: "Tint",
|
|
13
|
+
vibrance: "Vibrance",
|
|
14
|
+
saturation: "Saturation",
|
|
15
|
+
sepia: "Sepia",
|
|
16
|
+
clarity: "Clarity",
|
|
17
|
+
noise: "Grain",
|
|
18
|
+
vignette: "Vignette",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const signed = (n: number) => `${n > 0 ? "+" : ""}${Math.round(n * 100)}`;
|
|
22
|
+
const title = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* One line for the "Edited" badge tooltip and the Info panel, e.g.
|
|
26
|
+
* "Juno 80% · Cropped · Rotated · Exposure +20 · Saturation -15".
|
|
27
|
+
* At most `max` parts; the rest are counted ("+2 more").
|
|
28
|
+
*/
|
|
29
|
+
export function summarizeImageEdit(recipe: ImageEditRecipe, max = 5): string {
|
|
30
|
+
const parts: string[] = [];
|
|
31
|
+
if (recipe.filters) {
|
|
32
|
+
const s = recipe.filters.strength;
|
|
33
|
+
parts.push(
|
|
34
|
+
s === undefined || s >= 1
|
|
35
|
+
? title(recipe.filters.label)
|
|
36
|
+
: `${title(recipe.filters.label)} ${Math.round(s * 100)}%`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const g = recipe.geometry;
|
|
40
|
+
if (g) {
|
|
41
|
+
if (g.crop || g.aspectRatio) parts.push("Cropped");
|
|
42
|
+
if (g.quarterTurns || (g.straighten !== undefined && g.straighten !== 0)) parts.push("Rotated");
|
|
43
|
+
if (g.flipX) parts.push("Flipped");
|
|
44
|
+
if (g.perspectiveX || g.perspectiveY || g.corners) parts.push("Perspective");
|
|
45
|
+
}
|
|
46
|
+
for (const section of [recipe.lights, recipe.colors, recipe.effects]) {
|
|
47
|
+
for (const [key, value] of Object.entries(section ?? {})) {
|
|
48
|
+
if (typeof value === "number" && value !== 0)
|
|
49
|
+
parts.push(`${LABELS[key] ?? key} ${signed(value)}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (recipe.curves?.some((c) => c !== null)) parts.push("Curves");
|
|
53
|
+
if (recipe.blur && Object.values(recipe.blur).some((v) => v)) parts.push("Blur");
|
|
54
|
+
if (recipe.blend) parts.push("Blend");
|
|
55
|
+
if (parts.length === 0) return "No changes";
|
|
56
|
+
if (parts.length <= max) return parts.join(" · ");
|
|
57
|
+
return `${parts.slice(0, max).join(" · ")} · +${parts.length - max} more`;
|
|
58
|
+
}
|
package/src/core/index.ts
CHANGED
|
@@ -150,7 +150,11 @@ export { classStylesInListOrder, resolveCascade } from "./design/cascade.ts";
|
|
|
150
150
|
export {
|
|
151
151
|
findMissingRequiredFields,
|
|
152
152
|
layoutHasForm,
|
|
153
|
+
requiredFieldIssues,
|
|
154
|
+
requiredFieldIssueText,
|
|
153
155
|
type MissingRequiredField,
|
|
156
|
+
type RequiredFieldInfo,
|
|
157
|
+
type RequiredFieldIssue,
|
|
154
158
|
} from "./forms/binding.ts";
|
|
155
159
|
export {
|
|
156
160
|
fieldsOf,
|
|
@@ -390,6 +394,7 @@ export {
|
|
|
390
394
|
archivePageTitle,
|
|
391
395
|
DEFAULT_PER_PAGE,
|
|
392
396
|
loopPerPage,
|
|
397
|
+
paginationTitleText,
|
|
393
398
|
MAX_ARCHIVE_PAGE,
|
|
394
399
|
paginationItems,
|
|
395
400
|
splitArchivePage,
|
|
@@ -499,3 +504,12 @@ export {
|
|
|
499
504
|
type ShareRead,
|
|
500
505
|
} from "./share/link.ts";
|
|
501
506
|
export { canvasStyleUrls, MAX_CANVAS_STYLES } from "./canvas-styles.ts";
|
|
507
|
+
export {
|
|
508
|
+
IMAGE_EDIT_CURVE_POINTS_MAX,
|
|
509
|
+
IMAGE_EDIT_FORMATS,
|
|
510
|
+
IMAGE_EDIT_RECIPE_MAX_BYTES,
|
|
511
|
+
ImageEdit,
|
|
512
|
+
ImageEditOutput,
|
|
513
|
+
ImageEditRecipe,
|
|
514
|
+
} from "./image-edit/schema.ts";
|
|
515
|
+
export { summarizeImageEdit } from "./image-edit/summary.ts";
|
package/src/core/limits.ts
CHANGED
|
@@ -7,3 +7,13 @@ export const MAX_NODES = 2000;
|
|
|
7
7
|
export const MAX_TEXT_LENGTH = 2000;
|
|
8
8
|
/** Tabs show at most this many panels; the CSS-only switcher has a rule per tab. */
|
|
9
9
|
export const MAX_TABS = 12;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* W-509: `text` cut to at most `max` UTF-16 units, as schema limits count, without leaving half
|
|
13
|
+
* of an emoji (a lone surrogate) at the end.
|
|
14
|
+
*/
|
|
15
|
+
export function clipText(text: string, max: number): string {
|
|
16
|
+
if (text.length <= max) return text;
|
|
17
|
+
const code = text.charCodeAt(max - 1);
|
|
18
|
+
return text.slice(0, code >= 0xd800 && code <= 0xdbff ? max - 1 : max);
|
|
19
|
+
}
|
|
@@ -16,7 +16,8 @@ export type Migration = (doc: Record<string, unknown>) => Record<string, unknown
|
|
|
16
16
|
* (bindings, and the rest of the W-307 feature batch), and v13 → v14 (W-329 onward) adds
|
|
17
17
|
* optional fields only (audience segments, Loop options, `ch` and negative margins), and
|
|
18
18
|
* v14 → v15 (W-341 onward) adds optional fields only (direction, image link and caption,
|
|
19
|
-
* button icons, table of contents, container queries)
|
|
19
|
+
* button icons, table of contents, container queries), and layout v15 → v16 (W-481) adds the
|
|
20
|
+
* optional image `edit` record. Every other value is unchanged.
|
|
20
21
|
*/
|
|
21
22
|
const unchanged: Migration = (doc) => doc;
|
|
22
23
|
|
|
@@ -74,6 +75,7 @@ export const LAYOUT_MIGRATIONS: Readonly<Record<number, Migration>> = {
|
|
|
74
75
|
12: unchanged,
|
|
75
76
|
13: unchanged,
|
|
76
77
|
14: unchanged,
|
|
78
|
+
15: unchanged,
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
/** `DESIGN_MIGRATIONS[n]` upgrades a version-n design document to version n + 1. */
|
package/src/core/perf/meter.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { DesignSystem } from "../schema/design.ts";
|
|
|
2
2
|
import { isParentNode, type Layout, type LayoutNode } from "../schema/layout.ts";
|
|
3
3
|
import { renderPage } from "../render/index.ts";
|
|
4
4
|
import type { ThemeDynamicData } from "../theme/dynamic.ts";
|
|
5
|
+
import { resolveEmbedUrl } from "../sanitize/embed-url.ts";
|
|
5
6
|
import { layoutScripts, SCRIPT_BYTES, type PageScript } from "./scripts.ts";
|
|
6
7
|
|
|
7
8
|
/** Budgets per page (W-310), in bytes over the wire. Generous for a marketing page. */
|
|
@@ -58,6 +59,11 @@ const hasBackgroundImage = (node: LayoutNode): boolean => {
|
|
|
58
59
|
});
|
|
59
60
|
};
|
|
60
61
|
|
|
62
|
+
const isPlayerEmbed = (node: LayoutNode): boolean => {
|
|
63
|
+
const url = (node.props as { url?: unknown }).url;
|
|
64
|
+
return typeof url === "string" && resolveEmbedUrl(url)?.kind === "iframe";
|
|
65
|
+
};
|
|
66
|
+
|
|
61
67
|
/** Images and embeds under a node, with their estimated weight. */
|
|
62
68
|
function media(node: LayoutNode): { images: number; bytes: number; embeds: number } {
|
|
63
69
|
let images = 0;
|
|
@@ -75,7 +81,9 @@ function media(node: LayoutNode): { images: number; bytes: number; embeds: numbe
|
|
|
75
81
|
images += 1;
|
|
76
82
|
bytes += IMAGE_GUESS;
|
|
77
83
|
}
|
|
78
|
-
|
|
84
|
+
// W-508: only a YouTube or Vimeo player is a third-party embed; a media-library video loads
|
|
85
|
+
// its metadata only, and a missing or refused URL renders nothing.
|
|
86
|
+
if (n.type === "video" && isPlayerEmbed(n)) {
|
|
79
87
|
embeds += 1;
|
|
80
88
|
bytes += EMBED_BYTES;
|
|
81
89
|
}
|