@salesforce/ui-design-mode 12.9.0 → 12.11.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/dist/authoring/core/DesignPropertyPanelRoot.d.cts +7 -1
- package/dist/authoring/core/DesignPropertyPanelRoot.d.ts +7 -1
- package/dist/authoring/core/DesignPropertyPanelRoot.d.ts.map +1 -1
- package/dist/authoring/core/editors/ImageEditor.d.cts +3 -5
- package/dist/authoring/core/editors/ImageEditor.d.ts +3 -5
- package/dist/authoring/core/editors/ImageEditor.d.ts.map +1 -1
- package/dist/authoring/core/labels/labels.d.cts +0 -9
- package/dist/authoring/core/labels/labels.d.ts +0 -9
- package/dist/authoring/core/labels/labels.d.ts.map +1 -1
- package/dist/authoring/core/utils/backgroundImageEdit.d.cts +22 -0
- package/dist/authoring/core/utils/backgroundImageEdit.d.ts +22 -0
- package/dist/authoring/core/utils/backgroundImageEdit.d.ts.map +1 -0
- package/dist/authoring/host/index.cjs +36 -18
- package/dist/authoring/host/index.d.cts +46 -36
- package/dist/authoring/host/index.d.ts +46 -36
- package/dist/authoring/host/index.d.ts.map +1 -1
- package/dist/authoring/host/index.js +36 -18
- package/dist/authoring/react/index.js +4 -4
- package/dist/authoring/web-component/index.js +21 -21
- package/dist/protocol/messageTypes.d.cts +11 -7
- package/dist/protocol/messageTypes.d.ts +11 -7
- package/dist/protocol/messageTypes.d.ts.map +1 -1
- package/dist/protocol/version.cjs +1 -1
- package/dist/protocol/version.js +1 -1
- package/dist/runtime/design-mode-interactions.js +44 -18
- package/dist/runtime/interactions/communicationManager.d.cts +10 -8
- package/dist/runtime/interactions/communicationManager.d.ts +10 -8
- package/dist/runtime/interactions/communicationManager.d.ts.map +1 -1
- package/dist/runtime/interactions/interactionsController.d.cts +1 -2
- package/dist/runtime/interactions/interactionsController.d.ts +1 -2
- package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
- package/dist/shared/cssUrlLayers.cjs +4 -0
- package/dist/shared/cssUrlLayers.d.cts +40 -0
- package/dist/shared/cssUrlLayers.d.ts +40 -0
- package/dist/shared/cssUrlLayers.d.ts.map +1 -0
- package/dist/shared/cssUrlLayers.js +4 -0
- package/package.json +1 -1
|
@@ -69,7 +69,7 @@ export interface TextChangeMessage {
|
|
|
69
69
|
* is NOT a license to set arbitrary DOM attributes. The iframe runtime applies
|
|
70
70
|
* it through a per-tag whitelist (see `mediaAppliers` in
|
|
71
71
|
* interactionsController.ts): each tag's applier reads only the attribute keys
|
|
72
|
-
* valid for that tag (for `img`: `src`/`alt
|
|
72
|
+
* valid for that tag (for `img`: `src`/`alt`) and ignores any
|
|
73
73
|
* others, so an unexpected key never reaches the element. Keep that whitelist
|
|
74
74
|
* authoritative — do not switch the apply path to spreading this map.
|
|
75
75
|
*/
|
|
@@ -142,23 +142,27 @@ export interface ComponentStyleValue {
|
|
|
142
142
|
/**
|
|
143
143
|
* Editable attributes reported for an `<img>` element on selection. Strings
|
|
144
144
|
* mirror the raw HTML attribute values; missing attributes are reported as `""`.
|
|
145
|
-
*
|
|
146
|
-
* `width` / `height` are unitless integer strings (px); `""` means the attribute
|
|
147
|
-
* is absent and the image renders at its intrinsic size.
|
|
148
145
|
*/
|
|
149
146
|
export interface ImageMediaInfo {
|
|
150
147
|
tag: "img";
|
|
151
148
|
src: string;
|
|
152
149
|
alt: string;
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Reported for a non-`<img>` element whose `background-image` paints a `url()`
|
|
153
|
+
* layer. `src` is the first `url()` layer's inner path; always non-empty
|
|
154
|
+
* (gradient-only / image-less backgrounds report no media).
|
|
155
|
+
*/
|
|
156
|
+
export interface BackgroundImageMediaInfo {
|
|
157
|
+
tag: "background-image";
|
|
158
|
+
src: string;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
161
|
* Discriminated union of media-element metadata, keyed by `tag`. To support a
|
|
158
162
|
* new media tag in future, add a variant here and a matching case in the
|
|
159
163
|
* runtime's `getMediaInfo`.
|
|
160
164
|
*/
|
|
161
|
-
export type MediaInfo = ImageMediaInfo;
|
|
165
|
+
export type MediaInfo = ImageMediaInfo | BackgroundImageMediaInfo;
|
|
162
166
|
/** Selected-component payload carried by `component-selected`. */
|
|
163
167
|
export interface ComponentData {
|
|
164
168
|
name?: string;
|
|
@@ -69,7 +69,7 @@ export interface TextChangeMessage {
|
|
|
69
69
|
* is NOT a license to set arbitrary DOM attributes. The iframe runtime applies
|
|
70
70
|
* it through a per-tag whitelist (see `mediaAppliers` in
|
|
71
71
|
* interactionsController.ts): each tag's applier reads only the attribute keys
|
|
72
|
-
* valid for that tag (for `img`: `src`/`alt
|
|
72
|
+
* valid for that tag (for `img`: `src`/`alt`) and ignores any
|
|
73
73
|
* others, so an unexpected key never reaches the element. Keep that whitelist
|
|
74
74
|
* authoritative — do not switch the apply path to spreading this map.
|
|
75
75
|
*/
|
|
@@ -142,23 +142,27 @@ export interface ComponentStyleValue {
|
|
|
142
142
|
/**
|
|
143
143
|
* Editable attributes reported for an `<img>` element on selection. Strings
|
|
144
144
|
* mirror the raw HTML attribute values; missing attributes are reported as `""`.
|
|
145
|
-
*
|
|
146
|
-
* `width` / `height` are unitless integer strings (px); `""` means the attribute
|
|
147
|
-
* is absent and the image renders at its intrinsic size.
|
|
148
145
|
*/
|
|
149
146
|
export interface ImageMediaInfo {
|
|
150
147
|
tag: "img";
|
|
151
148
|
src: string;
|
|
152
149
|
alt: string;
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Reported for a non-`<img>` element whose `background-image` paints a `url()`
|
|
153
|
+
* layer. `src` is the first `url()` layer's inner path; always non-empty
|
|
154
|
+
* (gradient-only / image-less backgrounds report no media).
|
|
155
|
+
*/
|
|
156
|
+
export interface BackgroundImageMediaInfo {
|
|
157
|
+
tag: "background-image";
|
|
158
|
+
src: string;
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
157
161
|
* Discriminated union of media-element metadata, keyed by `tag`. To support a
|
|
158
162
|
* new media tag in future, add a variant here and a matching case in the
|
|
159
163
|
* runtime's `getMediaInfo`.
|
|
160
164
|
*/
|
|
161
|
-
export type MediaInfo = ImageMediaInfo;
|
|
165
|
+
export type MediaInfo = ImageMediaInfo | BackgroundImageMediaInfo;
|
|
162
166
|
/** Selected-component payload carried by `component-selected`. */
|
|
163
167
|
export interface ComponentData {
|
|
164
168
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../src/protocol/messageTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,qBAAqB,CAAC;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IAC1C,IAAI,EAAE,sBAAsB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM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AG,qBAA8B,CAAC;AACtE,eAAO,MAAM,wBAAwB,EAAG,sBAA+B,CAAC;AACxE,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AACxD,eAAO,MAAM,eAAe,EAAG,aAAsB,CAAC;AACtD,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AACxD,eAAO,MAAM,kBAAkB,EAAG,gBAAyB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,EAAG,0BAAmC,CAAC;AAChF,eAAO,MAAM,sBAAsB,EAAG,oBAA6B,CAAC;AACpE,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AAIxD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAG,gBAAyB,CAAC"}
|
package/dist/protocol/version.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
];
|
|
57
57
|
|
|
58
58
|
// src/protocol/version.ts
|
|
59
|
-
var UI_DESIGN_MODE_VERSION = "12.
|
|
59
|
+
var UI_DESIGN_MODE_VERSION = "12.11.0";
|
|
60
60
|
|
|
61
61
|
// src/runtime/interactions/utils/sourceUtils.ts
|
|
62
62
|
function parseRequiredInt(value) {
|
|
@@ -307,22 +307,57 @@
|
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
// src/shared/cssUrlLayers.ts
|
|
311
|
+
var CSS_URL_TOKEN_SOURCE = `url\\(\\s*(['"]?)([^'")]+)\\1\\s*\\)`;
|
|
312
|
+
var CSS_URL_TOKEN = new RegExp(CSS_URL_TOKEN_SOURCE, "i");
|
|
313
|
+
function splitCssLayers(value) {
|
|
314
|
+
const layers = [];
|
|
315
|
+
let depth = 0;
|
|
316
|
+
let current = "";
|
|
317
|
+
for (const ch of value) {
|
|
318
|
+
if (ch === "(") depth++;
|
|
319
|
+
else if (ch === ")") depth--;
|
|
320
|
+
if (ch === "," && depth === 0) {
|
|
321
|
+
layers.push(current.trim());
|
|
322
|
+
current = "";
|
|
323
|
+
} else {
|
|
324
|
+
current += ch;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (current.trim() !== "") layers.push(current.trim());
|
|
328
|
+
return layers;
|
|
329
|
+
}
|
|
330
|
+
function findFirstUrlLayer(value) {
|
|
331
|
+
const layers = splitCssLayers((value ?? "").trim());
|
|
332
|
+
for (let index = 0; index < layers.length; index++) {
|
|
333
|
+
const layer = layers[index] ?? "";
|
|
334
|
+
const match = CSS_URL_TOKEN.exec(layer);
|
|
335
|
+
if (match?.[2]) return { index, layer, path: match[2].trim() };
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
function firstUrlLayerPath(value) {
|
|
340
|
+
return findFirstUrlLayer(value)?.path ?? "";
|
|
341
|
+
}
|
|
342
|
+
|
|
310
343
|
// src/runtime/interactions/communicationManager.ts
|
|
311
|
-
function getMediaInfo(element) {
|
|
344
|
+
function getMediaInfo(element, styles) {
|
|
312
345
|
switch (element.tagName) {
|
|
313
346
|
case "IMG": {
|
|
314
347
|
const img = element;
|
|
315
348
|
return {
|
|
316
349
|
tag: "img",
|
|
317
350
|
src: img.getAttribute("src") ?? "",
|
|
318
|
-
alt: img.getAttribute("alt") ?? ""
|
|
319
|
-
width: img.getAttribute("width") ?? "",
|
|
320
|
-
height: img.getAttribute("height") ?? ""
|
|
351
|
+
alt: img.getAttribute("alt") ?? ""
|
|
321
352
|
};
|
|
322
353
|
}
|
|
323
|
-
default:
|
|
324
|
-
return void 0;
|
|
325
354
|
}
|
|
355
|
+
const backgroundImage = (styles ?? getElementStyles(element)).backgroundImage;
|
|
356
|
+
const src = firstUrlLayerPath(backgroundImage?.inline || backgroundImage?.computed);
|
|
357
|
+
if (src) {
|
|
358
|
+
return { tag: "background-image", src };
|
|
359
|
+
}
|
|
360
|
+
return void 0;
|
|
326
361
|
}
|
|
327
362
|
var CommunicationManager = class {
|
|
328
363
|
constructor() {
|
|
@@ -337,7 +372,7 @@
|
|
|
337
372
|
const debugSource = getSourceFromDataAttributes(element);
|
|
338
373
|
const textType = element.dataset?.textType ?? "none";
|
|
339
374
|
const hasNonEditableText = TEXT_TAGS.includes(element.tagName) && (textType === "dynamic" || textType === "mixed");
|
|
340
|
-
const media = getMediaInfo(element);
|
|
375
|
+
const media = getMediaInfo(element, styles);
|
|
341
376
|
try {
|
|
342
377
|
if (window.parent !== window) {
|
|
343
378
|
window.parent.postMessage(
|
|
@@ -1378,14 +1413,6 @@
|
|
|
1378
1413
|
const img = el;
|
|
1379
1414
|
if (attrs.src !== void 0) img.setAttribute("src", attrs.src);
|
|
1380
1415
|
if (attrs.alt !== void 0) img.setAttribute("alt", attrs.alt);
|
|
1381
|
-
if (attrs.width !== void 0) {
|
|
1382
|
-
if (attrs.width === "") img.removeAttribute("width");
|
|
1383
|
-
else img.setAttribute("width", attrs.width);
|
|
1384
|
-
}
|
|
1385
|
-
if (attrs.height !== void 0) {
|
|
1386
|
-
if (attrs.height === "") img.removeAttribute("height");
|
|
1387
|
-
else img.setAttribute("height", attrs.height);
|
|
1388
|
-
}
|
|
1389
1416
|
}
|
|
1390
1417
|
};
|
|
1391
1418
|
var InteractionsController = class {
|
|
@@ -1584,8 +1611,7 @@
|
|
|
1584
1611
|
/**
|
|
1585
1612
|
* Apply attribute changes to all elements at the given source location whose
|
|
1586
1613
|
* `tagName` matches `tag` (case-insensitive). Per-tag appliers declare which
|
|
1587
|
-
* attributes are valid and how empty-string values are handled
|
|
1588
|
-
* `img`, an empty `width`/`height` clears the attribute).
|
|
1614
|
+
* attributes are valid and how empty-string values are handled.
|
|
1589
1615
|
*
|
|
1590
1616
|
* No-op if the tag has no registered applier. When `sourceLocation` is
|
|
1591
1617
|
* omitted (live edit), the source is read from the currently selected
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { MediaInfo } from '../../protocol.cjs';
|
|
2
|
+
import { getElementStyles } from './utils/cssUtils.cjs';
|
|
2
3
|
export type { MediaInfo };
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Editable media metadata for a selected element, or `undefined` if none (the
|
|
6
|
+
* caller then omits `media` from the payload):
|
|
7
|
+
* 1. `<img>` → `img` variant (raw `src`/`alt`/`width`/`height`).
|
|
8
|
+
* 2. Any other element painting a `background-image` `url()` layer →
|
|
9
|
+
* `background-image` variant. Read inline-if-set-else-computed, matching the
|
|
10
|
+
* Background Color editor; gradient-only backgrounds have no `url()`, so none.
|
|
5
11
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* omits the `media` field from the `component-selected` payload).
|
|
9
|
-
*
|
|
10
|
-
* @param element - The selected DOM element.
|
|
11
|
-
* @returns The media info variant for the element's tag, or `undefined` if the tag is not media.
|
|
12
|
+
* @param styles - Pre-computed styles from `getElementStyles`, threaded in to
|
|
13
|
+
* avoid a second `getComputedStyle`; recomputed when omitted (tests).
|
|
12
14
|
*/
|
|
13
|
-
export declare function getMediaInfo(element: HTMLElement): MediaInfo | undefined;
|
|
15
|
+
export declare function getMediaInfo(element: HTMLElement, styles?: ReturnType<typeof getElementStyles>): MediaInfo | undefined;
|
|
14
16
|
export declare class CommunicationManager {
|
|
15
17
|
constructor();
|
|
16
18
|
/**
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { MediaInfo } from '../../protocol.js';
|
|
2
|
+
import { getElementStyles } from './utils/cssUtils.js';
|
|
2
3
|
export type { MediaInfo };
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Editable media metadata for a selected element, or `undefined` if none (the
|
|
6
|
+
* caller then omits `media` from the payload):
|
|
7
|
+
* 1. `<img>` → `img` variant (raw `src`/`alt`/`width`/`height`).
|
|
8
|
+
* 2. Any other element painting a `background-image` `url()` layer →
|
|
9
|
+
* `background-image` variant. Read inline-if-set-else-computed, matching the
|
|
10
|
+
* Background Color editor; gradient-only backgrounds have no `url()`, so none.
|
|
5
11
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* omits the `media` field from the `component-selected` payload).
|
|
9
|
-
*
|
|
10
|
-
* @param element - The selected DOM element.
|
|
11
|
-
* @returns The media info variant for the element's tag, or `undefined` if the tag is not media.
|
|
12
|
+
* @param styles - Pre-computed styles from `getElementStyles`, threaded in to
|
|
13
|
+
* avoid a second `getComputedStyle`; recomputed when omitted (tests).
|
|
12
14
|
*/
|
|
13
|
-
export declare function getMediaInfo(element: HTMLElement): MediaInfo | undefined;
|
|
15
|
+
export declare function getMediaInfo(element: HTMLElement, styles?: ReturnType<typeof getElementStyles>): MediaInfo | undefined;
|
|
14
16
|
export declare class CommunicationManager {
|
|
15
17
|
constructor();
|
|
16
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAMN,KAAK,SAAS,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAMN,KAAK,SAAS,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAUpD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,SAAS,GAAG,SAAS,CAkBvB;AAED,qBAAa,oBAAoB;;IAKhC;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAiDnD;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAyBnF;;OAEG;IACH,4BAA4B,IAAI,IAAI;CAmBpC"}
|
|
@@ -67,8 +67,7 @@ export declare class InteractionsController {
|
|
|
67
67
|
/**
|
|
68
68
|
* Apply attribute changes to all elements at the given source location whose
|
|
69
69
|
* `tagName` matches `tag` (case-insensitive). Per-tag appliers declare which
|
|
70
|
-
* attributes are valid and how empty-string values are handled
|
|
71
|
-
* `img`, an empty `width`/`height` clears the attribute).
|
|
70
|
+
* attributes are valid and how empty-string values are handled.
|
|
72
71
|
*
|
|
73
72
|
* No-op if the tag has no registered applier. When `sourceLocation` is
|
|
74
73
|
* omitted (live edit), the source is read from the currently selected
|
|
@@ -67,8 +67,7 @@ export declare class InteractionsController {
|
|
|
67
67
|
/**
|
|
68
68
|
* Apply attribute changes to all elements at the given source location whose
|
|
69
69
|
* `tagName` matches `tag` (case-insensitive). Per-tag appliers declare which
|
|
70
|
-
* attributes are valid and how empty-string values are handled
|
|
71
|
-
* `img`, an empty `width`/`height` clears the attribute).
|
|
70
|
+
* attributes are valid and how empty-string values are handled.
|
|
72
71
|
*
|
|
73
72
|
* No-op if the tag has no registered applier. When `sourceLocation` is
|
|
74
73
|
* omitted (live edit), the source is read from the currently selected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AA6C7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,UAAO;IA2E1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAalB;;;;OAIG;IACH,MAAM,CAAC,cAAc,GAAE,SAAS,MAAM,EAAO,GAAG,IAAI;IAMpD;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAoCxE,OAAO,CAAC,cAAc;IAWtB;;;;;OAKG;IACH,gBAAgB,CACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,cAAc,EAC/B,QAAQ,CAAC,EAAE,OAAO,GAChB,IAAI;IAwBP,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAOpE;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CACf,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,GAC7B,IAAI;IAWP;;OAEG;IACH,OAAO,IAAI,IAAI;CAKf"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Pure CSS background-layer helpers shared by the runtime (SELECT), the
|
|
8
|
+
* authoring panel (write-back), and the build tracer (via the `authoring/host`
|
|
9
|
+
* re-export of {@link CSS_URL_TOKEN_SOURCE}). No DOM, no `node:*` — dependency-
|
|
10
|
+
* free, so each bundle compiles its own copy from one definition.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Source for a CSS `url(...)` token; the inner reference is capture group 2.
|
|
14
|
+
* Exported as a raw string, not a compiled `RegExp`, so each consumer picks its
|
|
15
|
+
* own flags and no stateful `lastIndex` is shared. Always compile with `i`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CSS_URL_TOKEN_SOURCE = "url\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)";
|
|
18
|
+
/**
|
|
19
|
+
* Splits a comma-separated CSS value into layers, ignoring commas nested in
|
|
20
|
+
* function parens (e.g. `linear-gradient(135deg, red, blue)` is one layer).
|
|
21
|
+
*/
|
|
22
|
+
export declare function splitCssLayers(value: string): string[];
|
|
23
|
+
/** The first `url()` layer located within a (possibly multi-layer) value. */
|
|
24
|
+
export interface UrlLayerMatch {
|
|
25
|
+
/** Index of the layer in {@link splitCssLayers} order (first-listed is 0 / top). */
|
|
26
|
+
index: number;
|
|
27
|
+
/** The full layer text, e.g. `url("a.png")`. */
|
|
28
|
+
layer: string;
|
|
29
|
+
/** The inner reference with any surrounding quotes stripped, e.g. `a.png`. */
|
|
30
|
+
path: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The first layer carrying a `url()` token, or `null` for a value with none
|
|
34
|
+
* (empty, `none`, gradient-only). Splits into layers first, so a `url()` inside
|
|
35
|
+
* a gradient's args isn't mistaken for the image layer.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findFirstUrlLayer(value: string | null | undefined): UrlLayerMatch | null;
|
|
38
|
+
/** Inner path of the first `url()` layer (quotes stripped), or `""` if none. */
|
|
39
|
+
export declare function firstUrlLayerPath(value: string | null | undefined): string;
|
|
40
|
+
//# sourceMappingURL=cssUrlLayers.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Pure CSS background-layer helpers shared by the runtime (SELECT), the
|
|
8
|
+
* authoring panel (write-back), and the build tracer (via the `authoring/host`
|
|
9
|
+
* re-export of {@link CSS_URL_TOKEN_SOURCE}). No DOM, no `node:*` — dependency-
|
|
10
|
+
* free, so each bundle compiles its own copy from one definition.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Source for a CSS `url(...)` token; the inner reference is capture group 2.
|
|
14
|
+
* Exported as a raw string, not a compiled `RegExp`, so each consumer picks its
|
|
15
|
+
* own flags and no stateful `lastIndex` is shared. Always compile with `i`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CSS_URL_TOKEN_SOURCE = "url\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)";
|
|
18
|
+
/**
|
|
19
|
+
* Splits a comma-separated CSS value into layers, ignoring commas nested in
|
|
20
|
+
* function parens (e.g. `linear-gradient(135deg, red, blue)` is one layer).
|
|
21
|
+
*/
|
|
22
|
+
export declare function splitCssLayers(value: string): string[];
|
|
23
|
+
/** The first `url()` layer located within a (possibly multi-layer) value. */
|
|
24
|
+
export interface UrlLayerMatch {
|
|
25
|
+
/** Index of the layer in {@link splitCssLayers} order (first-listed is 0 / top). */
|
|
26
|
+
index: number;
|
|
27
|
+
/** The full layer text, e.g. `url("a.png")`. */
|
|
28
|
+
layer: string;
|
|
29
|
+
/** The inner reference with any surrounding quotes stripped, e.g. `a.png`. */
|
|
30
|
+
path: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The first layer carrying a `url()` token, or `null` for a value with none
|
|
34
|
+
* (empty, `none`, gradient-only). Splits into layers first, so a `url()` inside
|
|
35
|
+
* a gradient's args isn't mistaken for the image layer.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findFirstUrlLayer(value: string | null | undefined): UrlLayerMatch | null;
|
|
38
|
+
/** Inner path of the first `url()` layer (quotes stripped), or `""` if none. */
|
|
39
|
+
export declare function firstUrlLayerPath(value: string | null | undefined): string;
|
|
40
|
+
//# sourceMappingURL=cssUrlLayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssUrlLayers.d.ts","sourceRoot":"","sources":["../../src/shared/cssUrlLayers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,2CAA2C,CAAC;AAK7E;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBtD;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC7B,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAQxF;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE1E"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-design-mode",
|
|
3
3
|
"description": "Hybrid editor (design-mode) authoring UI, iframe runtime, source-locator, and protocol for Salesforce UI Bundles",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.11.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|