@perkyzz/emvb 0.9.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/admin/agents-api.ts +45 -0
- package/src/admin/editor/A11yCopilot.tsx +1 -1
- package/src/admin/editor/Editor.tsx +297 -248
- package/src/admin/editor/Timeline.tsx +2 -1
- package/src/admin/editor/TopBar.tsx +4 -2
- package/src/admin/editor/canvas/CanvasFrame.tsx +2 -2
- package/src/admin/editor/canvas/DeviceBar.tsx +17 -9
- package/src/admin/editor/canvas/canvas-scale.ts +2 -2
- package/src/admin/editor/canvas/use-canvas-session.ts +2 -2
- package/src/admin/editor/co-design.ts +190 -0
- package/src/admin/editor/dnd/new-element.ts +26 -4
- package/src/admin/editor/editor-chrome.tsx +3 -3
- package/src/admin/editor/editor-commands.ts +8 -3
- package/src/admin/editor/element-chrome.ts +3 -1
- package/src/admin/editor/extension-manifests.ts +20 -0
- package/src/admin/editor/extensions/ExtensionPanels.tsx +26 -0
- package/src/admin/editor/extensions-context.tsx +27 -0
- package/src/admin/editor/feature-css.ts +17 -0
- package/src/admin/editor/palette-items.ts +2 -2
- package/src/admin/editor/panels/AddPanel.tsx +31 -1
- package/src/admin/editor/panels/AgentRequestBox.tsx +116 -0
- package/src/admin/editor/panels/ClassesSection.tsx +9 -6
- package/src/admin/editor/panels/CoDesignPanel.tsx +170 -0
- package/src/admin/editor/panels/ColorControl.tsx +2 -2
- package/src/admin/editor/panels/ElementPanel.tsx +49 -14
- package/src/admin/editor/panels/LanguagesSection.tsx +152 -0
- package/src/admin/editor/panels/LayersPanel.tsx +10 -6
- package/src/admin/editor/panels/LeftPanel.tsx +33 -5
- package/src/admin/editor/panels/PageSettings.tsx +4 -0
- package/src/admin/editor/panels/SettingsPanel.tsx +21 -2
- package/src/admin/editor/panels/SiteStylesDrawer.tsx +7 -7
- package/src/admin/editor/panels/settings/BackgroundControls.tsx +72 -15
- package/src/admin/editor/panels/settings/BackgroundFill.tsx +8 -6
- package/src/admin/editor/panels/settings/BoxControl.tsx +5 -5
- package/src/admin/editor/panels/settings/EffectsControls.tsx +104 -9
- package/src/admin/editor/panels/settings/FieldControl.tsx +9 -3
- package/src/admin/editor/panels/settings/IconControls.tsx +14 -11
- package/src/admin/editor/panels/settings/LengthRow.tsx +27 -16
- package/src/admin/editor/panels/settings/LoopControl.tsx +269 -0
- package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +1 -1
- package/src/admin/editor/panels/settings/MotionControl.tsx +12 -11
- package/src/admin/editor/panels/settings/QueryStyleRows.tsx +7 -4
- package/src/admin/editor/panels/settings/StyleRow.tsx +113 -13
- package/src/admin/editor/panels/settings/TextMarksControl.tsx +247 -0
- package/src/admin/editor/panels/settings/VariableBinding.tsx +2 -2
- package/src/admin/editor/panels/settings/background-mode.ts +14 -11
- package/src/admin/editor/panels/settings/box-link-name.ts +1 -1
- package/src/admin/editor/panels/settings/box-sides.ts +22 -14
- package/src/admin/editor/panels/settings/heading-warning.ts +5 -1
- package/src/admin/editor/panels/settings/length-units.ts +53 -1
- package/src/admin/editor/panels/settings/query-style.ts +3 -3
- package/src/admin/editor/panels/settings/style-sections.ts +51 -10
- package/src/admin/editor/panels/style-target.ts +9 -7
- package/src/admin/editor/presence.ts +60 -0
- package/src/admin/editor/store.ts +6 -2
- package/src/admin/editor/useCoDesign.ts +177 -0
- package/src/admin/editor/useEditorCommands.ts +4 -4
- package/src/admin/editor/useExtensions.ts +45 -0
- package/src/admin/editor/useNodeActions.ts +15 -6
- package/src/admin/editor/useProposals.ts +81 -0
- package/src/admin/languages-api.ts +61 -0
- package/src/admin/pages/AgentSetup.tsx +148 -0
- package/src/admin/pages/AgentsPage.tsx +9 -26
- package/src/admin/pages/CreateDialog.tsx +15 -0
- package/src/admin/pages/ImportButton.tsx +18 -0
- package/src/admin/pages/ImportElementorDialog.tsx +669 -0
- package/src/admin/pages/ImportPageLinks.tsx +86 -0
- package/src/admin/pages/PageList.tsx +15 -1
- package/src/admin/pages/ThemePartList.tsx +15 -1
- package/src/admin/pages/section-head.tsx +27 -0
- package/src/admin/proposals-api.ts +91 -0
- package/src/admin/ui.ts +39 -2
- package/src/astro/content-port.ts +14 -1
- package/src/astro/resolve-theme.ts +14 -1
- package/src/astro/resolve.ts +89 -2
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +44 -14
- package/src/core/arrange.ts +5 -1
- package/src/core/bounded-array.ts +31 -0
- package/src/core/clipboard.ts +9 -0
- package/src/core/contract.ts +285 -0
- package/src/core/css/generate.ts +89 -20
- package/src/core/css/trace.ts +18 -9
- package/src/core/css-keywords.ts +51 -1
- package/src/core/design/cascade.ts +12 -9
- package/src/core/design/classes.ts +4 -5
- package/src/core/design/devices.ts +13 -13
- package/src/core/design/states.ts +5 -3
- package/src/core/design/transfer.ts +5 -0
- package/src/core/design/variables.ts +17 -4
- package/src/core/elements/dynamic-elements.ts +3 -3
- package/src/core/elements/index.ts +73 -9
- package/src/core/extensions/define.ts +13 -0
- package/src/core/extensions/index.ts +41 -0
- package/src/core/extensions/namespace.ts +82 -0
- package/src/core/extensions/normalize.ts +141 -0
- package/src/core/extensions/placeholder.ts +41 -0
- package/src/core/extensions/registry.ts +94 -0
- package/src/core/extensions/render-ext.ts +118 -0
- package/src/core/extensions/safe-nodes.ts +93 -0
- package/src/core/extensions/schema.ts +112 -0
- package/src/core/extensions/types.ts +159 -0
- package/src/core/forms/binding.ts +1 -1
- package/src/core/history/diff.ts +1 -1
- package/src/core/import/elementor/atomic.ts +1595 -0
- package/src/core/import/elementor/classes.ts +127 -0
- package/src/core/import/elementor/context.ts +429 -0
- package/src/core/import/elementor/counter-steps.ts +72 -0
- package/src/core/import/elementor/css.ts +445 -0
- package/src/core/import/elementor/html.ts +500 -0
- package/src/core/import/elementor/index.ts +949 -0
- package/src/core/import/elementor/inline-marks.ts +81 -0
- package/src/core/import/elementor/snapshots.ts +48 -0
- package/src/core/import/elementor/style.ts +409 -0
- package/src/core/import/elementor/values.ts +241 -0
- package/src/core/import/elementor/widgets.ts +1897 -0
- package/src/core/index.ts +82 -0
- package/src/core/json-schema.ts +107 -0
- package/src/core/limits.ts +19 -0
- package/src/core/migrate/index.ts +6 -1
- package/src/core/migrate/v18.ts +222 -0
- package/src/core/perf/meter.ts +5 -5
- package/src/core/proposals-safety.ts +102 -0
- package/src/core/proposals.ts +357 -0
- package/src/core/recipes/index.ts +2 -2
- package/src/core/render/extras.ts +3 -3
- package/src/core/render/index.ts +140 -20
- package/src/core/render/loop.ts +1 -1
- package/src/core/render/section.ts +4 -4
- package/src/core/render/vnode.ts +1 -1
- package/src/core/sanitize/css.ts +125 -10
- package/src/core/sanitize/motion.ts +116 -0
- package/src/core/saved-sections.ts +6 -0
- package/src/core/schema/descriptors.ts +3 -1
- package/src/core/schema/design.ts +2 -1
- package/src/core/schema/layout.ts +82 -14
- package/src/core/schema/style.ts +251 -114
- package/src/core/text-marks.ts +227 -0
- package/src/core/theme/dynamic.ts +9 -4
- package/src/core/theme/float.ts +1 -0
- package/src/core/theme/popup-rules.ts +17 -1
- package/src/core/translatable.ts +34 -0
- package/src/core/validate.ts +13 -1
- package/src/index.ts +24 -0
- package/src/mcp/errors.ts +3 -1
- package/src/mcp/ports.ts +67 -0
- package/src/mcp/prompts.ts +1 -11
- package/src/mcp/proposals.ts +281 -0
- package/src/mcp/read.ts +10 -9
- package/src/mcp/tools.ts +71 -3
- package/src/mcp/write.ts +66 -11
- package/src/server/agent-settings.ts +5 -1
- package/src/server/mcp-routes.ts +15 -0
- package/src/server/plugin.ts +35 -2
- package/src/server/presence.ts +78 -0
- package/src/server/proposals.ts +261 -0
- package/src/server/requests.ts +196 -0
- package/src/server/tools-served.ts +45 -0
package/src/core/css/generate.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { cssTypeName } from "../schema/layout.ts";
|
|
2
|
+
import { MARK_CSS } from "../text-marks.ts";
|
|
1
3
|
import { DEFAULT_FLUID_RANGE, fluidClamp } from "../design/tokens.ts";
|
|
2
4
|
import type { FluidRange, LengthVariable } from "../schema/design.ts";
|
|
3
5
|
import type { DesignSystem } from "../schema/design.ts";
|
|
@@ -17,8 +19,8 @@ import {
|
|
|
17
19
|
type StateDeclarations,
|
|
18
20
|
} from "../sanitize/css.ts";
|
|
19
21
|
import { STYLE_STATES, type StyleStateName } from "../schema/state-names.ts";
|
|
20
|
-
import { DEVICE_MEDIA, type
|
|
21
|
-
import { MOTION_KEYFRAMES } from "../sanitize/motion.ts";
|
|
22
|
+
import { DEVICE_MEDIA, type Device } from "../theme/popup-rules.ts";
|
|
23
|
+
import { LOOP_KEYFRAMES, MOTION_KEYFRAMES } from "../sanitize/motion.ts";
|
|
22
24
|
|
|
23
25
|
export type CssInput = {
|
|
24
26
|
design: DesignSystem;
|
|
@@ -28,10 +30,11 @@ export type CssInput = {
|
|
|
28
30
|
id: string;
|
|
29
31
|
declarations: Declaration[];
|
|
30
32
|
states?: StateDeclarations;
|
|
31
|
-
/**
|
|
33
|
+
/** Laptop (W-956), tablet and mobile overrides (W-096). Desktop stays in `declarations`. */
|
|
34
|
+
laptop?: Declaration[];
|
|
32
35
|
tablet?: Declaration[];
|
|
33
36
|
mobile?: Declaration[];
|
|
34
|
-
hiddenOn?: readonly
|
|
37
|
+
hiddenOn?: readonly Device[];
|
|
35
38
|
/** W-443: an image with a caption, rendered inside a figure that hides with it. */
|
|
36
39
|
figure?: boolean;
|
|
37
40
|
/** Container-query overrides (W-346). */
|
|
@@ -42,12 +45,14 @@ export type CssInput = {
|
|
|
42
45
|
previewStates?: boolean;
|
|
43
46
|
/** When a node rendered a background video (W-110). */
|
|
44
47
|
backgroundVideo?: boolean;
|
|
48
|
+
/** W-952: when a List is drawn as numbered steps. */
|
|
49
|
+
listSteps?: boolean;
|
|
45
50
|
/**
|
|
46
51
|
* Editor canvas only (W-116): the device the canvas previews. Device rules then follow this
|
|
47
52
|
* device instead of the frame's width, so the Desktop canvas never picks up tablet styles in a
|
|
48
53
|
* narrow window. Without it, the rules sit in their media queries as usual.
|
|
49
54
|
*/
|
|
50
|
-
previewDevice?:
|
|
55
|
+
previewDevice?: Device;
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
/** Focus is keyboard focus (W-089): `:focus-visible`, never `:focus`. */
|
|
@@ -123,6 +128,10 @@ function declare<T extends { id: string }>(
|
|
|
123
128
|
const usesMotion = (declarations: readonly Declaration[]) =>
|
|
124
129
|
declarations.some((d) => d.property === "animation" && /\bemvb-m[otsrb]\b/.test(d.value));
|
|
125
130
|
|
|
131
|
+
/** W-938: declarations that play a loop. */
|
|
132
|
+
const usesLoop = (declarations: readonly Declaration[]) =>
|
|
133
|
+
declarations.some((d) => d.property === "animation" && /\bemvb-l[otsrb]\b/.test(d.value));
|
|
134
|
+
|
|
126
135
|
/**
|
|
127
136
|
* Cascade order (R-021 / W-030 / W-089): variables on `.emvb-root`, base CSS, shared
|
|
128
137
|
* `.emvb-k-<id>` class rules, then local `.emvb-e-<id>` (local wins). Each selector's `:hover`,
|
|
@@ -137,6 +146,7 @@ export function generateCss({
|
|
|
137
146
|
localRules,
|
|
138
147
|
previewStates = false,
|
|
139
148
|
backgroundVideo = false,
|
|
149
|
+
listSteps = false,
|
|
140
150
|
previewDevice,
|
|
141
151
|
}: CssInput): string {
|
|
142
152
|
const { colors, fonts, fontSizes, spacings } = design.variables;
|
|
@@ -150,6 +160,8 @@ export function generateCss({
|
|
|
150
160
|
const entrances: string[] = [];
|
|
151
161
|
/** W-319: any scroll motion on the page, so its keyframes are sent. */
|
|
152
162
|
let motion = false;
|
|
163
|
+
/** W-938: any loop on the page, so its keyframes are sent. */
|
|
164
|
+
let loops = false;
|
|
153
165
|
const rules = (selector: string, declarations: Declaration[], states: StateDeclarations) => [
|
|
154
166
|
block(selector, declarations),
|
|
155
167
|
...STYLE_STATES.map((state) =>
|
|
@@ -165,6 +177,7 @@ export function generateCss({
|
|
|
165
177
|
if (declarations.some((d) => d.property === "transition")) animated.push(selector);
|
|
166
178
|
if (declarations.some((d) => d.property === "animation")) entrances.push(selector);
|
|
167
179
|
if (usesMotion(declarations)) motion = true;
|
|
180
|
+
if (usesLoop(declarations)) loops = true;
|
|
168
181
|
return declarations;
|
|
169
182
|
};
|
|
170
183
|
const classes = (design.classes ?? []).flatMap((cls) => {
|
|
@@ -188,10 +201,17 @@ export function generateCss({
|
|
|
188
201
|
{
|
|
189
202
|
selector: `.${className}`,
|
|
190
203
|
// W-210: a device that sets one background layer keeps the layers it inherits.
|
|
191
|
-
|
|
204
|
+
laptop: styleDeclarations(withInheritedLayers(cls.devices?.laptop, cls.style ?? {}))
|
|
192
205
|
.declarations,
|
|
206
|
+
tablet: styleDeclarations(
|
|
207
|
+
withInheritedLayers(cls.devices?.tablet, { ...cls.style, ...cls.devices?.laptop }),
|
|
208
|
+
).declarations,
|
|
193
209
|
mobile: styleDeclarations(
|
|
194
|
-
withInheritedLayers(cls.devices?.mobile, {
|
|
210
|
+
withInheritedLayers(cls.devices?.mobile, {
|
|
211
|
+
...cls.style,
|
|
212
|
+
...cls.devices?.laptop,
|
|
213
|
+
...cls.devices?.tablet,
|
|
214
|
+
}),
|
|
195
215
|
).declarations,
|
|
196
216
|
hiddenOn: cls.hiddenOn,
|
|
197
217
|
// W-571: the page root is never hidden (W-567), not even by a class.
|
|
@@ -202,6 +222,7 @@ export function generateCss({
|
|
|
202
222
|
}),
|
|
203
223
|
...localRules.map((rule) => ({
|
|
204
224
|
selector: `.emvb-e-${rule.id}`,
|
|
225
|
+
laptop: rule.laptop ?? [],
|
|
205
226
|
tablet: rule.tablet ?? [],
|
|
206
227
|
mobile: rule.mobile ?? [],
|
|
207
228
|
hiddenOn: rule.hiddenOn,
|
|
@@ -209,37 +230,55 @@ export function generateCss({
|
|
|
209
230
|
})),
|
|
210
231
|
];
|
|
211
232
|
/** A device block: in its media query, or, for a previewed device, on or off outright. */
|
|
212
|
-
const forDevices = (devices: readonly
|
|
233
|
+
const forDevices = (devices: readonly Device[], query: string, body: string) => {
|
|
213
234
|
if (!body) return "";
|
|
214
235
|
if (previewDevice === undefined) return `@media ${query}{${body}}`;
|
|
215
236
|
return devices.includes(previewDevice) ? body : "";
|
|
216
237
|
};
|
|
217
|
-
const at = (query: string, which: "tablet" | "mobile") =>
|
|
238
|
+
const at = (query: string, which: "laptop" | "tablet" | "mobile") =>
|
|
218
239
|
forDevices(
|
|
219
|
-
which === "
|
|
240
|
+
which === "laptop"
|
|
241
|
+
? ["laptop", "tablet", "mobile"]
|
|
242
|
+
: which === "tablet"
|
|
243
|
+
? ["tablet", "mobile"]
|
|
244
|
+
: ["mobile"],
|
|
220
245
|
query,
|
|
221
246
|
responsive.map((rule) => block(rule.selector, rule[which])).join(""),
|
|
222
247
|
);
|
|
223
|
-
|
|
248
|
+
/**
|
|
249
|
+
* W-956: Desktop and Laptop hidden together keep the one `min-width: 1025px` rule every page
|
|
250
|
+
* saved before Laptop had; hidden on only one of them, each gets its own range.
|
|
251
|
+
*/
|
|
252
|
+
const hide = (devices: readonly Device[], query: string) => {
|
|
253
|
+
const hidden = (rule: { hiddenOn?: readonly Device[] | undefined }) => {
|
|
254
|
+
const on = rule.hiddenOn ?? [];
|
|
255
|
+
if (devices.includes("desktop") && devices.includes("laptop"))
|
|
256
|
+
return on.includes("desktop") && on.includes("laptop");
|
|
257
|
+
if (devices[0] === "desktop") return on.includes("desktop") && !on.includes("laptop");
|
|
258
|
+
if (devices[0] === "laptop") return on.includes("laptop") && !on.includes("desktop");
|
|
259
|
+
return on.includes(devices[0] as Device);
|
|
260
|
+
};
|
|
224
261
|
// W-443: a captioned image hides its figure too, or the caption stayed on its own.
|
|
225
262
|
const selectors = responsive
|
|
226
|
-
.filter(
|
|
263
|
+
.filter(hidden)
|
|
227
264
|
.flatMap((rule) =>
|
|
228
265
|
"figure" in rule && rule.figure
|
|
229
266
|
? [rule.selector, `.emvb-figure:has(>${rule.selector},>a>${rule.selector})`]
|
|
230
267
|
: ["hideSelector" in rule && rule.hideSelector ? rule.hideSelector : rule.selector],
|
|
231
268
|
);
|
|
232
269
|
return forDevices(
|
|
233
|
-
|
|
270
|
+
devices,
|
|
234
271
|
query,
|
|
235
272
|
selectors.length > 0 ? `${selectors.join(",")}{display:none}` : "",
|
|
236
273
|
);
|
|
237
274
|
};
|
|
238
275
|
for (const rule of responsive) {
|
|
239
|
-
if (usesMotion(rule.tablet) || usesMotion(rule.mobile))
|
|
276
|
+
if (usesMotion(rule.laptop) || usesMotion(rule.tablet) || usesMotion(rule.mobile))
|
|
277
|
+
motion = true;
|
|
278
|
+
if (usesLoop(rule.laptop) || usesLoop(rule.tablet) || usesLoop(rule.mobile)) loops = true;
|
|
240
279
|
if (
|
|
241
280
|
!entrances.includes(rule.selector) &&
|
|
242
|
-
[...rule.tablet, ...rule.mobile].some((d) => d.property === "animation")
|
|
281
|
+
[...rule.laptop, ...rule.tablet, ...rule.mobile].some((d) => d.property === "animation")
|
|
243
282
|
) {
|
|
244
283
|
entrances.push(rule.selector);
|
|
245
284
|
}
|
|
@@ -251,6 +290,7 @@ export function generateCss({
|
|
|
251
290
|
const query = rule.query ?? [];
|
|
252
291
|
const selector = `.emvb-e-${rule.id}`;
|
|
253
292
|
if (usesMotion(query)) motion = true;
|
|
293
|
+
if (usesLoop(query)) loops = true;
|
|
254
294
|
if (!entrances.includes(selector) && query.some((d) => d.property === "animation")) {
|
|
255
295
|
entrances.push(selector);
|
|
256
296
|
}
|
|
@@ -258,11 +298,12 @@ export function generateCss({
|
|
|
258
298
|
animated.push(selector);
|
|
259
299
|
}
|
|
260
300
|
}
|
|
261
|
-
|
|
301
|
+
const sheet = [
|
|
262
302
|
entrances.length > 0
|
|
263
303
|
? "@keyframes emvb-fade{from{opacity:0}to{opacity:1}}@keyframes emvb-fade-up{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}@keyframes emvb-fade-down{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}@keyframes emvb-slide-up{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}@keyframes emvb-slide-down{from{opacity:0;transform:translateY(-16px)}to{opacity:1;transform:none}}@keyframes emvb-scale{from{opacity:0;transform:scale(0.96)}to{opacity:1;transform:none}}"
|
|
264
304
|
: "",
|
|
265
305
|
entrances.length > 0 && motion ? MOTION_KEYFRAMES : "",
|
|
306
|
+
entrances.length > 0 && loops ? LOOP_KEYFRAMES : "",
|
|
266
307
|
block(".emvb-root", variables),
|
|
267
308
|
defaultsCss,
|
|
268
309
|
backgroundVideo
|
|
@@ -272,7 +313,11 @@ export function generateCss({
|
|
|
272
313
|
// W-801: a looping video kept playing for visitors who ask for reduced motion.
|
|
273
314
|
"@media (prefers-reduced-motion: reduce){.emvb-bg-video{display:none}}"
|
|
274
315
|
: "",
|
|
275
|
-
...[...usedTypes]
|
|
316
|
+
...[...usedTypes]
|
|
317
|
+
.toSorted((a, b) =>
|
|
318
|
+
cssTypeName(a) < cssTypeName(b) ? -1 : cssTypeName(a) > cssTypeName(b) ? 1 : 0,
|
|
319
|
+
)
|
|
320
|
+
.map((type) => baseCss.get(type) ?? ""),
|
|
276
321
|
...classes,
|
|
277
322
|
...locals,
|
|
278
323
|
...localRules
|
|
@@ -281,11 +326,14 @@ export function generateCss({
|
|
|
281
326
|
(rule) =>
|
|
282
327
|
`@container (min-width:${rule.queryMin}px){${block(`.emvb-e-${rule.id}`, rule.query ?? [])}}`,
|
|
283
328
|
),
|
|
329
|
+
at(DEVICE_MEDIA.laptop, "laptop"),
|
|
284
330
|
at(DEVICE_MEDIA.tablet, "tablet"),
|
|
285
331
|
at(DEVICE_MEDIA.mobile, "mobile"),
|
|
286
|
-
hide("desktop", DEVICE_MEDIA.hideDesktop),
|
|
287
|
-
hide("
|
|
288
|
-
hide("
|
|
332
|
+
hide(["desktop", "laptop"], DEVICE_MEDIA.hideDesktop),
|
|
333
|
+
hide(["desktop"], DEVICE_MEDIA.hideDesktopOnly),
|
|
334
|
+
hide(["laptop"], DEVICE_MEDIA.hideLaptop),
|
|
335
|
+
hide(["tablet"], DEVICE_MEDIA.hideTablet),
|
|
336
|
+
hide(["mobile"], DEVICE_MEDIA.hideMobile),
|
|
289
337
|
animated.length > 0
|
|
290
338
|
? `@media (prefers-reduced-motion: reduce){${animated.join(",")}{transition:none}}`
|
|
291
339
|
: "",
|
|
@@ -293,4 +341,25 @@ export function generateCss({
|
|
|
293
341
|
? `@media (prefers-reduced-motion: reduce){${entrances.join(",")}{animation:none}}`
|
|
294
342
|
: "",
|
|
295
343
|
].join("");
|
|
344
|
+
// W-952: list marker colour and size, and numbered steps, only on pages that use them, so
|
|
345
|
+
// every page saved before them keeps the exact CSS it had.
|
|
346
|
+
return [
|
|
347
|
+
sheet,
|
|
348
|
+
sheet.includes("--emvb-marker-") ? LIST_MARKER_CSS : "",
|
|
349
|
+
listSteps ? LIST_STEPS_CSS : "",
|
|
350
|
+
sheet.includes("--emvb-mark-") ? MARK_CSS : "",
|
|
351
|
+
].join("");
|
|
296
352
|
}
|
|
353
|
+
|
|
354
|
+
/** Markers take the list's marker colour and size when it sets them (W-952). */
|
|
355
|
+
const LIST_MARKER_CSS =
|
|
356
|
+
".emvb-list>li::marker{color:var(--emvb-marker-color,inherit);font-size:var(--emvb-marker-size,inherit)}";
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Numbered steps (W-952): each number in a circle beside its item, counted by the list's own
|
|
360
|
+
* `list-item` counter so Start at still applies.
|
|
361
|
+
*/
|
|
362
|
+
const LIST_STEPS_CSS =
|
|
363
|
+
".emvb-list--steps{list-style:none;padding-inline-start:0;display:flex;flex-direction:column;gap:0.75em}" +
|
|
364
|
+
".emvb-list--steps>li{display:flex;align-items:flex-start;gap:0.75em;counter-increment:list-item}" +
|
|
365
|
+
".emvb-list--steps>li::before{content:counter(list-item);flex:none;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-width:2em;height:2em;padding:0 0.4em;border-radius:999px;border:2px solid var(--emvb-marker-color,currentColor);color:var(--emvb-marker-color,currentColor);font-size:var(--emvb-marker-size,1em);font-weight:600;line-height:1}";
|
package/src/core/css/trace.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { DefaultStyleTag, DesignSystem } from "../schema/design.ts";
|
|
2
2
|
import type { LayoutNode } from "../schema/layout.ts";
|
|
3
3
|
import type { StyleStateName } from "../schema/state-names.ts";
|
|
4
|
-
import
|
|
4
|
+
import { flattenMotion } from "../migrate/v18.ts";
|
|
5
|
+
import type { FlatStyleProps, StyleProps } from "../schema/style.ts";
|
|
5
6
|
|
|
6
|
-
export type TraceDevice = "desktop" | "tablet" | "mobile";
|
|
7
|
+
export type TraceDevice = "desktop" | "laptop" | "tablet" | "mobile";
|
|
7
8
|
|
|
8
9
|
/** Where one style value comes from (W-318). */
|
|
9
10
|
export type StyleSource = {
|
|
@@ -38,7 +39,7 @@ export function defaultTagFor(node: LayoutNode): DefaultStyleTag | undefined {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
const LAYER = { desktop: "Desktop", tablet: "Tablet", mobile: "Mobile" } as const;
|
|
42
|
+
const LAYER = { desktop: "Desktop", laptop: "Laptop", tablet: "Tablet", mobile: "Mobile" } as const;
|
|
42
43
|
const STATE_LABEL: Record<StyleStateName, string> = {
|
|
43
44
|
hover: "Hover",
|
|
44
45
|
focus: "Focus",
|
|
@@ -50,7 +51,7 @@ type Owner = {
|
|
|
50
51
|
label: string;
|
|
51
52
|
classId?: string;
|
|
52
53
|
style?: StyleProps;
|
|
53
|
-
devices?: { tablet?: StyleProps; mobile?: StyleProps };
|
|
54
|
+
devices?: { laptop?: StyleProps; tablet?: StyleProps; mobile?: StyleProps };
|
|
54
55
|
states?: Partial<Record<StyleStateName, StyleProps>>;
|
|
55
56
|
};
|
|
56
57
|
|
|
@@ -65,7 +66,7 @@ export function styleLayers(
|
|
|
65
66
|
design: DesignSystem,
|
|
66
67
|
device: TraceDevice = "desktop",
|
|
67
68
|
state: StyleStateName | "normal" = "normal",
|
|
68
|
-
): { source: Omit<StyleSource, "value">; style:
|
|
69
|
+
): { source: Omit<StyleSource, "value">; style: FlatStyleProps }[] {
|
|
69
70
|
const layers: { source: Omit<StyleSource, "value">; style: StyleProps }[] = [];
|
|
70
71
|
const tag = defaultTagFor(node);
|
|
71
72
|
const tagStyle = tag ? design.defaults?.[tag] : undefined;
|
|
@@ -103,7 +104,10 @@ export function styleLayers(
|
|
|
103
104
|
...(owner.classId ? { classId: owner.classId } : {}),
|
|
104
105
|
};
|
|
105
106
|
if (owner.style) layers.push({ source: { ...base, layer: LAYER.desktop }, style: owner.style });
|
|
106
|
-
if (device !== "desktop" && owner.devices?.
|
|
107
|
+
if (device !== "desktop" && owner.devices?.laptop) {
|
|
108
|
+
layers.push({ source: { ...base, layer: LAYER.laptop }, style: owner.devices.laptop });
|
|
109
|
+
}
|
|
110
|
+
if ((device === "tablet" || device === "mobile") && owner.devices?.tablet) {
|
|
107
111
|
layers.push({ source: { ...base, layer: LAYER.tablet }, style: owner.devices.tablet });
|
|
108
112
|
}
|
|
109
113
|
if (device === "mobile" && owner.devices?.mobile) {
|
|
@@ -125,7 +129,12 @@ export function styleLayers(
|
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
|
-
|
|
132
|
+
// W-925: traced by the flat motion keys the style rows use.
|
|
133
|
+
const traced: { source: Omit<StyleSource, "value">; style: FlatStyleProps }[] = [];
|
|
134
|
+
for (const { source, style } of layers) {
|
|
135
|
+
traced.push({ source, style: flattenMotion(style) as FlatStyleProps });
|
|
136
|
+
}
|
|
137
|
+
return traced;
|
|
129
138
|
}
|
|
130
139
|
|
|
131
140
|
/** Where each set property of a node comes from (W-318), by property name. */
|
|
@@ -160,10 +169,10 @@ export function inheritedStyle(
|
|
|
160
169
|
design: DesignSystem,
|
|
161
170
|
device: TraceDevice,
|
|
162
171
|
state: StyleStateName | "normal",
|
|
163
|
-
):
|
|
172
|
+
): FlatStyleProps {
|
|
164
173
|
const layers = styleLayers(node, design, device, state);
|
|
165
174
|
// Drop the layer being edited: the element's own on this device and state.
|
|
166
175
|
const editing = state !== "normal" ? STATE_LABEL[state] : LAYER[device];
|
|
167
176
|
const below = layers.filter((l) => !(l.source.kind === "local" && l.source.layer === editing));
|
|
168
|
-
return Object.assign({}, ...below.map((l) => l.style)) as
|
|
177
|
+
return Object.assign({}, ...below.map((l) => l.style)) as FlatStyleProps;
|
|
169
178
|
}
|
package/src/core/css-keywords.ts
CHANGED
|
@@ -22,6 +22,9 @@ export const JUSTIFY_CONTENT = [
|
|
|
22
22
|
|
|
23
23
|
export const ALIGN_ITEMS = ["stretch", "flex-start", "flex-end", "center", "baseline"] as const;
|
|
24
24
|
|
|
25
|
+
/** W-954: one child's own cross-axis alignment; `auto` follows the parent's Align. */
|
|
26
|
+
export const ALIGN_SELF = ["auto", ...ALIGN_ITEMS] as const;
|
|
27
|
+
|
|
25
28
|
export const TEXT_ALIGNS = ["left", "center", "right", "justify"] as const;
|
|
26
29
|
|
|
27
30
|
export const TEXT_TRANSFORMS = ["none", "uppercase", "lowercase", "capitalize"] as const;
|
|
@@ -32,6 +35,45 @@ export const BORDER_STYLES = ["none", "solid", "dashed", "dotted"] as const;
|
|
|
32
35
|
|
|
33
36
|
export const OVERFLOWS = ["visible", "hidden", "clip", "scroll", "auto"] as const;
|
|
34
37
|
|
|
38
|
+
/**
|
|
39
|
+
* W-952: how a List marks its items. Number styles make it numbered; `steps` puts each number
|
|
40
|
+
* in a circle (numbered steps).
|
|
41
|
+
*/
|
|
42
|
+
export const LIST_MARKERS = [
|
|
43
|
+
"disc",
|
|
44
|
+
"circle",
|
|
45
|
+
"square",
|
|
46
|
+
"decimal",
|
|
47
|
+
"decimal-leading-zero",
|
|
48
|
+
"lower-alpha",
|
|
49
|
+
"upper-alpha",
|
|
50
|
+
"lower-roman",
|
|
51
|
+
"upper-roman",
|
|
52
|
+
"steps",
|
|
53
|
+
"none",
|
|
54
|
+
] as const;
|
|
55
|
+
export type ListMarker = (typeof LIST_MARKERS)[number];
|
|
56
|
+
|
|
57
|
+
/** List markers that count (the list is an `<ol>`). */
|
|
58
|
+
export const NUMBERED_MARKERS: ReadonlySet<string> = new Set([
|
|
59
|
+
"decimal",
|
|
60
|
+
"decimal-leading-zero",
|
|
61
|
+
"lower-alpha",
|
|
62
|
+
"upper-alpha",
|
|
63
|
+
"lower-roman",
|
|
64
|
+
"upper-roman",
|
|
65
|
+
"steps",
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
/** W-957: upright or italic text. */
|
|
69
|
+
export const FONT_STYLES = ["normal", "italic"] as const;
|
|
70
|
+
|
|
71
|
+
/** W-957: how spaces and line breaks wrap. */
|
|
72
|
+
export const WHITE_SPACES = ["normal", "nowrap", "pre-line", "pre-wrap"] as const;
|
|
73
|
+
|
|
74
|
+
/** W-957: whether long words may break to fit. */
|
|
75
|
+
export const OVERFLOW_WRAPS = ["normal", "break-word", "anywhere"] as const;
|
|
76
|
+
|
|
35
77
|
export const OBJECT_FITS = ["fill", "contain", "cover", "none", "scale-down"] as const;
|
|
36
78
|
|
|
37
79
|
export const POSITIONS = ["static", "relative", "absolute", "fixed", "sticky"] as const;
|
|
@@ -64,7 +106,15 @@ export const FONT_WEIGHTS = [
|
|
|
64
106
|
|
|
65
107
|
export const TRANSITION_EASINGS = ["ease", "ease-in", "ease-out", "ease-in-out", "linear"] as const;
|
|
66
108
|
|
|
67
|
-
export const TRANSITION_PROPERTIES = [
|
|
109
|
+
export const TRANSITION_PROPERTIES = [
|
|
110
|
+
"all",
|
|
111
|
+
"colors",
|
|
112
|
+
"opacity",
|
|
113
|
+
"shadow",
|
|
114
|
+
"filter",
|
|
115
|
+
// W-953: the move, scale and rotate of a transform (a hover lift).
|
|
116
|
+
"transform",
|
|
117
|
+
] as const;
|
|
68
118
|
|
|
69
119
|
export const BACKGROUND_SIZES = ["auto", "cover", "contain"] as const;
|
|
70
120
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { flattenMotion } from "../migrate/v18.ts";
|
|
2
|
+
import type { FlatStyleProps, StyleProps } from "../schema/style.ts";
|
|
2
3
|
|
|
3
4
|
/** Classes the element uses, in Site styles list order. Later entries win, matching the CSS. */
|
|
4
5
|
export function classStylesInListOrder(
|
|
5
|
-
classes: ReadonlyArray<{ id: string; style?: StyleProps }> | undefined,
|
|
6
|
+
classes: ReadonlyArray<{ id: string; style?: StyleProps | FlatStyleProps }> | undefined,
|
|
6
7
|
appliedIds: readonly string[],
|
|
7
|
-
): Array<StyleProps | undefined> {
|
|
8
|
+
): Array<StyleProps | FlatStyleProps | undefined> {
|
|
8
9
|
const applied = new Set(appliedIds);
|
|
9
10
|
return (classes ?? []).filter((cls) => applied.has(cls.id)).map((cls) => cls.style);
|
|
10
11
|
}
|
|
@@ -13,16 +14,18 @@ export function classStylesInListOrder(
|
|
|
13
14
|
* Merge class styles, then local. Later entries win (R-021 / W-030).
|
|
14
15
|
* Pass classes from `classStylesInListOrder`, not from the order written on the element.
|
|
15
16
|
* Pure — does not consult CSS; used for editor computed-style tables and unit tests.
|
|
17
|
+
* The result uses the flat motion keys (W-925), so a class's entrance and another's scroll motion
|
|
18
|
+
* both survive, as they do in the CSS.
|
|
16
19
|
*/
|
|
17
20
|
export function resolveCascade(
|
|
18
|
-
classStylesInAppliedOrder: ReadonlyArray<StyleProps | undefined>,
|
|
19
|
-
local?: StyleProps,
|
|
20
|
-
):
|
|
21
|
+
classStylesInAppliedOrder: ReadonlyArray<StyleProps | FlatStyleProps | undefined>,
|
|
22
|
+
local?: StyleProps | FlatStyleProps,
|
|
23
|
+
): FlatStyleProps {
|
|
21
24
|
const out: Record<string, unknown> = {};
|
|
22
25
|
for (const style of classStylesInAppliedOrder) {
|
|
23
26
|
if (!style) continue;
|
|
24
|
-
Object.assign(out, style);
|
|
27
|
+
Object.assign(out, flattenMotion(style));
|
|
25
28
|
}
|
|
26
|
-
if (local) Object.assign(out, local);
|
|
27
|
-
return out as
|
|
29
|
+
if (local) Object.assign(out, flattenMotion(local));
|
|
30
|
+
return out as FlatStyleProps;
|
|
28
31
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { clipText } from "../limits.ts";
|
|
2
2
|
import type { DesignSystem } from "../schema/design.ts";
|
|
3
3
|
import type { Layout, LayoutNode } from "../schema/layout.ts";
|
|
4
|
-
import
|
|
4
|
+
import { patchNestedStyle } from "../migrate/v18.ts";
|
|
5
|
+
import type { StylePatch, StyleProps } from "../schema/style.ts";
|
|
5
6
|
import { localStyleOf, withLocalStyle } from "../local-style.ts";
|
|
6
7
|
import { forEachNode, slugify, updateNode } from "../tree-ops.ts";
|
|
7
8
|
|
|
@@ -230,12 +231,10 @@ export function editClass(
|
|
|
230
231
|
export function patchClassStyle(
|
|
231
232
|
design: DesignSystem,
|
|
232
233
|
classId: string,
|
|
233
|
-
patch:
|
|
234
|
+
patch: StylePatch,
|
|
234
235
|
): DesignSystem {
|
|
235
236
|
return editClass(design, classId, (next) => {
|
|
236
|
-
|
|
237
|
-
for (const [key, value] of Object.entries(patch)) if (value === undefined) delete style[key];
|
|
238
|
-
next.style = style as StyleProps;
|
|
237
|
+
next.style = patchNestedStyle(next.style, patch) as StyleProps;
|
|
239
238
|
return next;
|
|
240
239
|
});
|
|
241
240
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { DesignSystem } from "../schema/design.ts";
|
|
2
2
|
import { editClass } from "./classes.ts";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { patchNestedStyle } from "../migrate/v18.ts";
|
|
4
|
+
import type { DeviceStyles, StylePatch, StyleProps } from "../schema/style.ts";
|
|
5
|
+
import { DEVICES, type Device, type StyleDevice } from "../theme/popup-rules.ts";
|
|
5
6
|
|
|
6
|
-
export type ResponsiveDevice =
|
|
7
|
+
export type ResponsiveDevice = StyleDevice;
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Merge `patch` into one device's overrides (W-096). `undefined` clears a key. An emptied device
|
|
@@ -12,14 +13,13 @@ export type ResponsiveDevice = "tablet" | "mobile";
|
|
|
12
13
|
export function patchDeviceStyle(
|
|
13
14
|
devices: DeviceStyles | undefined,
|
|
14
15
|
device: ResponsiveDevice,
|
|
15
|
-
patch:
|
|
16
|
+
patch: StylePatch,
|
|
16
17
|
): DeviceStyles | undefined {
|
|
17
|
-
const merged
|
|
18
|
-
for (const key of Object.keys(merged)) if (merged[key] === undefined) delete merged[key];
|
|
18
|
+
const merged = patchNestedStyle(devices?.[device], patch);
|
|
19
19
|
const next: DeviceStyles = { ...devices };
|
|
20
20
|
if (Object.keys(merged).length > 0) next[device] = merged as StyleProps;
|
|
21
21
|
else delete next[device];
|
|
22
|
-
return next.tablet || next.mobile ? next : undefined;
|
|
22
|
+
return next.laptop || next.tablet || next.mobile ? next : undefined;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/** `patchDeviceStyle` on a design class. Pure. */
|
|
@@ -27,7 +27,7 @@ export function patchClassDevices(
|
|
|
27
27
|
design: DesignSystem,
|
|
28
28
|
classId: string,
|
|
29
29
|
device: ResponsiveDevice,
|
|
30
|
-
patch:
|
|
30
|
+
patch: StylePatch,
|
|
31
31
|
): DesignSystem {
|
|
32
32
|
return editClass(design, classId, (next) => {
|
|
33
33
|
const devices = patchDeviceStyle(next.devices, device, patch);
|
|
@@ -37,14 +37,14 @@ export function patchClassDevices(
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/** Add or remove one device. The result stays in desktop, tablet, mobile order, or undefined. */
|
|
40
|
+
/** Add or remove one device. The result stays in desktop, laptop, tablet, mobile order, or undefined. */
|
|
41
41
|
export function toggleHidden(
|
|
42
|
-
hidden: readonly
|
|
43
|
-
device:
|
|
44
|
-
):
|
|
42
|
+
hidden: readonly Device[] | undefined,
|
|
43
|
+
device: Device,
|
|
44
|
+
): Device[] | undefined {
|
|
45
45
|
const set = new Set(hidden ?? []);
|
|
46
46
|
if (set.has(device)) set.delete(device);
|
|
47
47
|
else set.add(device);
|
|
48
|
-
const next =
|
|
48
|
+
const next = DEVICES.filter((item) => set.has(item));
|
|
49
49
|
return next.length > 0 ? next : undefined;
|
|
50
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DesignSystem } from "../schema/design.ts";
|
|
2
2
|
import { editClass } from "./classes.ts";
|
|
3
3
|
import { STYLE_STATES, type StyleStateName } from "../schema/state-names.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { StylePatch, StyleStates } from "../schema/style.ts";
|
|
5
5
|
|
|
6
6
|
type StateStyle = NonNullable<StyleStates[StyleStateName]>;
|
|
7
7
|
|
|
@@ -12,11 +12,13 @@ type StateStyle = NonNullable<StyleStates[StyleStateName]>;
|
|
|
12
12
|
export function patchStates(
|
|
13
13
|
states: StyleStates | undefined,
|
|
14
14
|
state: StyleStateName,
|
|
15
|
-
patch:
|
|
15
|
+
patch: StylePatch,
|
|
16
16
|
): StyleStates | undefined {
|
|
17
17
|
const merged: Record<string, unknown> = { ...states?.[state], ...patch };
|
|
18
18
|
for (const key of Object.keys(merged)) if (merged[key] === undefined) delete merged[key];
|
|
19
|
+
// Motion is not a state style; the flat `transition` key is the one the editor sends.
|
|
19
20
|
delete merged["transition"];
|
|
21
|
+
delete merged["motion"];
|
|
20
22
|
const next: StyleStates = { ...states };
|
|
21
23
|
if (Object.keys(merged).length > 0) next[state] = merged as StateStyle;
|
|
22
24
|
else delete next[state];
|
|
@@ -32,7 +34,7 @@ export function patchClassState(
|
|
|
32
34
|
design: DesignSystem,
|
|
33
35
|
classId: string,
|
|
34
36
|
state: StyleStateName,
|
|
35
|
-
patch:
|
|
37
|
+
patch: StylePatch,
|
|
36
38
|
): DesignSystem {
|
|
37
39
|
return editClass(design, classId, (next) => {
|
|
38
40
|
const states = patchStates(next.states, state, patch);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { clipText, MAX_DESIGN_BYTES } from "../limits.ts";
|
|
2
2
|
import { DesignSystem as DesignSystemSchema, DESIGN_SCHEMA_VERSION } from "../schema/design.ts";
|
|
3
3
|
import type { DesignSystem } from "../schema/design.ts";
|
|
4
|
+
import { restoreExtras, splitDesignExtras } from "../contract.ts";
|
|
4
5
|
import { DESIGN_MIGRATIONS, upgradeLayout } from "../migrate/index.ts";
|
|
5
6
|
import type { Layout } from "../schema/layout.ts";
|
|
6
7
|
import { findClassUsages, nameKey } from "./classes.ts";
|
|
@@ -100,8 +101,12 @@ export function designFromJson(text: string): DesignImport {
|
|
|
100
101
|
: "That file is not an EmVB design document.",
|
|
101
102
|
};
|
|
102
103
|
}
|
|
104
|
+
const extras = splitDesignExtras(upgraded.doc);
|
|
105
|
+
if (extras.issues.length > 0)
|
|
106
|
+
return { ok: false, message: "That file is not an EmVB design document." };
|
|
103
107
|
const result = DesignSystemSchema.safeParse(upgraded.doc);
|
|
104
108
|
if (!result.success) return { ok: false, message: "That file is not an EmVB design document." };
|
|
109
|
+
restoreExtras(result.data, extras.extras);
|
|
105
110
|
// W-619: every reference points at an id, so two classes (or two variables of one kind) with
|
|
106
111
|
// the same id can't both be kept; the editor never writes such a file.
|
|
107
112
|
const repeated = repeatedId(result.data);
|
|
@@ -50,7 +50,13 @@ export function forEachStyleRef(
|
|
|
50
50
|
style.gradient?.stops.forEach((stop, index) => {
|
|
51
51
|
visit(stop.color, `gradient.stops.${index}`);
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
const overlay = style.overlay;
|
|
54
|
+
if (overlay && "color" in overlay) visit(overlay.color, "overlay.color");
|
|
55
|
+
if (overlay && "gradient" in overlay) {
|
|
56
|
+
overlay.gradient.stops.forEach((stop, index) => {
|
|
57
|
+
visit(stop.color, `overlay.gradient.stops.${index}`);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
function collectStyleUsages(
|
|
@@ -64,7 +70,7 @@ function collectStyleUsages(
|
|
|
64
70
|
});
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
const RESPONSIVE = ["tablet", "mobile"] as const;
|
|
73
|
+
const RESPONSIVE = ["laptop", "tablet", "mobile"] as const;
|
|
68
74
|
|
|
69
75
|
/** Style, state styles and device overrides. A nested usage is `<state|device>.<prop>`. */
|
|
70
76
|
function collectAllUsages(
|
|
@@ -150,7 +156,14 @@ function stripRefsFromStyle(
|
|
|
150
156
|
delete next["gradient"];
|
|
151
157
|
changed = true;
|
|
152
158
|
}
|
|
153
|
-
|
|
159
|
+
// W-949: a gradient overlay goes with any of its stops, as a gradient does.
|
|
160
|
+
const overlay = style.overlay;
|
|
161
|
+
if (
|
|
162
|
+
overlay &&
|
|
163
|
+
("color" in overlay
|
|
164
|
+
? matches(overlay.color, id, kind)
|
|
165
|
+
: overlay.gradient.stops.some((stop) => matches(stop.color, id, kind)))
|
|
166
|
+
) {
|
|
154
167
|
delete next["overlay"];
|
|
155
168
|
changed = true;
|
|
156
169
|
}
|
|
@@ -194,7 +207,7 @@ function stripRefsFromDevices(
|
|
|
194
207
|
else delete next[device];
|
|
195
208
|
}
|
|
196
209
|
if (!changed) return devices;
|
|
197
|
-
return next.tablet || next.mobile ? next : undefined;
|
|
210
|
+
return next.laptop || next.tablet || next.mobile ? next : undefined;
|
|
198
211
|
}
|
|
199
212
|
|
|
200
213
|
/** Style, states and device overrides with the refs removed. Same object when nothing changed. */
|
|
@@ -248,7 +248,7 @@ export const loop: ElementDefinition<LoopNode> = {
|
|
|
248
248
|
"field=value pairs separated by semicolons, such as category=news; team=design. A taxonomy works too. The same field twice matches either value.",
|
|
249
249
|
},
|
|
250
250
|
{
|
|
251
|
-
key: "
|
|
251
|
+
key: "partId",
|
|
252
252
|
kind: "text",
|
|
253
253
|
label: "Loop item",
|
|
254
254
|
optional: true,
|
|
@@ -380,9 +380,9 @@ export const pagination: ElementDefinition<PaginationNode> = {
|
|
|
380
380
|
|
|
381
381
|
export const section: ElementDefinition<SectionNode> = {
|
|
382
382
|
baseCss: ".emvb-section{display:flex;flex-direction:column;min-width:0}",
|
|
383
|
-
defaults: () => ({ type: "
|
|
383
|
+
defaults: () => ({ type: "part-ref", props: {}, children: [] }),
|
|
384
384
|
descriptor: {
|
|
385
|
-
type: "
|
|
385
|
+
type: "part-ref",
|
|
386
386
|
// "Theme section": it embeds a Section theme part; the layout Section is its own element (W-155).
|
|
387
387
|
name: "Theme section",
|
|
388
388
|
group: "layout",
|