@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
|
@@ -4,6 +4,7 @@ import { CmsSpace, CmsImage, CmsFolderItemsResult, CmsContentDetailResult, CmsTh
|
|
|
4
4
|
import { ChangeSetEntry } from './history/changeSet.cjs';
|
|
5
5
|
import { ChangeContext } from './history/historyService.cjs';
|
|
6
6
|
import { PanelLabels } from './labels/labels.cjs';
|
|
7
|
+
export declare const IMAGE_SOURCE_EDITOR_LS_KEY = "designMode.imageSourceEditorEnabled";
|
|
7
8
|
/** Selected-component subset the panel renders. Mirrors the protocol payload. */
|
|
8
9
|
export type DesignPanelComponent = Pick<ComponentData, "name" | "tagName" | "debugSource" | "hasNonEditableText" | "media">;
|
|
9
10
|
/** Per-property inline + computed style values pushed from the host. */
|
|
@@ -47,7 +48,7 @@ export interface DesignPropertyPanelProps {
|
|
|
47
48
|
/** User clicked the selected component's source-file link. */
|
|
48
49
|
onOpenSourceFile?: (payload: OpenSourceFilePayload) => void;
|
|
49
50
|
/**
|
|
50
|
-
* Apply a media-element change (e.g. `<img src>`/`alt
|
|
51
|
+
* Apply a media-element change (e.g. `<img src>`/`alt`) to the
|
|
51
52
|
* surface. The host posts a `media-change` to the preview iframe. Present only
|
|
52
53
|
* when the selected component is a media element (`component.media`).
|
|
53
54
|
*/
|
|
@@ -72,6 +73,11 @@ export interface DesignPropertyPanelProps {
|
|
|
72
73
|
* Defaults to `false` — the standard header.
|
|
73
74
|
*/
|
|
74
75
|
compactHeader?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Force the Image Source section on/off for an `<img>` selection. Omitted →
|
|
78
|
+
* the localStorage override, else off (temporary gate, W-23714307).
|
|
79
|
+
*/
|
|
80
|
+
imageSourceEditorEnabled?: boolean;
|
|
75
81
|
/**
|
|
76
82
|
* Fully-resolved, localized strings for everything the panel renders. Optional:
|
|
77
83
|
* omit it (VS Code) and the panel renders its English defaults; pass a complete
|
|
@@ -4,6 +4,7 @@ import { CmsSpace, CmsImage, CmsFolderItemsResult, CmsContentDetailResult, CmsTh
|
|
|
4
4
|
import { ChangeSetEntry } from './history/changeSet.js';
|
|
5
5
|
import { ChangeContext } from './history/historyService.js';
|
|
6
6
|
import { PanelLabels } from './labels/labels.js';
|
|
7
|
+
export declare const IMAGE_SOURCE_EDITOR_LS_KEY = "designMode.imageSourceEditorEnabled";
|
|
7
8
|
/** Selected-component subset the panel renders. Mirrors the protocol payload. */
|
|
8
9
|
export type DesignPanelComponent = Pick<ComponentData, "name" | "tagName" | "debugSource" | "hasNonEditableText" | "media">;
|
|
9
10
|
/** Per-property inline + computed style values pushed from the host. */
|
|
@@ -47,7 +48,7 @@ export interface DesignPropertyPanelProps {
|
|
|
47
48
|
/** User clicked the selected component's source-file link. */
|
|
48
49
|
onOpenSourceFile?: (payload: OpenSourceFilePayload) => void;
|
|
49
50
|
/**
|
|
50
|
-
* Apply a media-element change (e.g. `<img src>`/`alt
|
|
51
|
+
* Apply a media-element change (e.g. `<img src>`/`alt`) to the
|
|
51
52
|
* surface. The host posts a `media-change` to the preview iframe. Present only
|
|
52
53
|
* when the selected component is a media element (`component.media`).
|
|
53
54
|
*/
|
|
@@ -72,6 +73,11 @@ export interface DesignPropertyPanelProps {
|
|
|
72
73
|
* Defaults to `false` — the standard header.
|
|
73
74
|
*/
|
|
74
75
|
compactHeader?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Force the Image Source section on/off for an `<img>` selection. Omitted →
|
|
78
|
+
* the localStorage override, else off (temporary gate, W-23714307).
|
|
79
|
+
*/
|
|
80
|
+
imageSourceEditorEnabled?: boolean;
|
|
75
81
|
/**
|
|
76
82
|
* Fully-resolved, localized strings for everything the panel renders. Optional:
|
|
77
83
|
* omit it (VS Code) and the panel renders its English defaults; pass a complete
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignPropertyPanelRoot.d.ts","sourceRoot":"","sources":["../../../src/authoring/core/DesignPropertyPanelRoot.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DesignPropertyPanelRoot.d.ts","sourceRoot":"","sources":["../../../src/authoring/core/DesignPropertyPanelRoot.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAEX,aAAa,EACb,mBAAmB,EAEnB,cAAc,EACd,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAoB,KAAK,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAEN,KAAK,aAAa,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA0BlE,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAiFhF,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACtC,aAAa,EACb,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,oBAAoB,GAAG,OAAO,CACnE,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEjE,yFAAyF;AACzF,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAErD,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,qFAAqF;AACrF,MAAM,WAAW,wBAAwB;I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a,GAAG,IAAI,CAAC;IACvF,OAAO,IAAI,OAAO,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC;CACnB;AAguBD,eAAO,MAAM,mBAAmB,4GA2nB9B,CAAC;AAEH;;;GAGG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,KAAK,EAAE,wBAAwB,EAC/B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,QAK1C"}
|
|
@@ -23,8 +23,6 @@ export interface CmsImage {
|
|
|
23
23
|
/** Editable `<img>` attributes other than `src`, mirroring what the iframe honors. */
|
|
24
24
|
export interface ImageAttributes {
|
|
25
25
|
alt: string;
|
|
26
|
-
width: string;
|
|
27
|
-
height: string;
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* A page of CMS folder items pushed from the host in response to
|
|
@@ -66,9 +64,9 @@ export interface ImageEditorProps {
|
|
|
66
64
|
value: string;
|
|
67
65
|
onChange: (value: string) => void;
|
|
68
66
|
id?: string;
|
|
69
|
-
/** Current alt
|
|
67
|
+
/** Current alt value; shown as an editable field below the source tabs. */
|
|
70
68
|
attributes?: ImageAttributes;
|
|
71
|
-
/** Apply a non-`src` attribute change (alt
|
|
69
|
+
/** Apply a non-`src` attribute change (alt). */
|
|
72
70
|
onAttributeChange?: (attribute: keyof ImageAttributes, value: string) => void;
|
|
73
71
|
/** Available CMS workspaces, pushed from the host after {@link onFetchCmsSpaces}. */
|
|
74
72
|
cmsSpaces?: CmsSpace[];
|
|
@@ -101,7 +99,7 @@ export interface ImageEditorProps {
|
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
103
101
|
* Image-source editor: pick an `<img>` source via CMS browse, local file, or a
|
|
104
|
-
* direct URL, plus edit alt
|
|
102
|
+
* direct URL, plus edit alt. All host I/O (CMS fetches, local file
|
|
105
103
|
* picking, importing) is supplied via optional callback + data props so the
|
|
106
104
|
* shared panel stays host-agnostic; absent callbacks make that action inert.
|
|
107
105
|
*/
|
|
@@ -23,8 +23,6 @@ export interface CmsImage {
|
|
|
23
23
|
/** Editable `<img>` attributes other than `src`, mirroring what the iframe honors. */
|
|
24
24
|
export interface ImageAttributes {
|
|
25
25
|
alt: string;
|
|
26
|
-
width: string;
|
|
27
|
-
height: string;
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* A page of CMS folder items pushed from the host in response to
|
|
@@ -66,9 +64,9 @@ export interface ImageEditorProps {
|
|
|
66
64
|
value: string;
|
|
67
65
|
onChange: (value: string) => void;
|
|
68
66
|
id?: string;
|
|
69
|
-
/** Current alt
|
|
67
|
+
/** Current alt value; shown as an editable field below the source tabs. */
|
|
70
68
|
attributes?: ImageAttributes;
|
|
71
|
-
/** Apply a non-`src` attribute change (alt
|
|
69
|
+
/** Apply a non-`src` attribute change (alt). */
|
|
72
70
|
onAttributeChange?: (attribute: keyof ImageAttributes, value: string) => void;
|
|
73
71
|
/** Available CMS workspaces, pushed from the host after {@link onFetchCmsSpaces}. */
|
|
74
72
|
cmsSpaces?: CmsSpace[];
|
|
@@ -101,7 +99,7 @@ export interface ImageEditorProps {
|
|
|
101
99
|
}
|
|
102
100
|
/**
|
|
103
101
|
* Image-source editor: pick an `<img>` source via CMS browse, local file, or a
|
|
104
|
-
* direct URL, plus edit alt
|
|
102
|
+
* direct URL, plus edit alt. All host I/O (CMS fetches, local file
|
|
105
103
|
* picking, importing) is supplied via optional callback + data props so the
|
|
106
104
|
* shared panel stays host-agnostic; absent callbacks make that action inert.
|
|
107
105
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageEditor.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/editors/ImageEditor.tsx"],"names":[],"mappings":"AASA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,0FAA0F;AAC1F,KAAK,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageEditor.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/editors/ImageEditor.tsx"],"names":[],"mappings":"AASA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,0FAA0F;AAC1F,KAAK,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;AAmCnD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,sFAAsF;AACtF,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+EAA+E;AAC/E,MAAM,WAAW,sBAAsB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,0FAA0F;AAC1F,MAAM,WAAW,kBAAkB;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xC,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAClF,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,+DAA+D;IAC/D,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAGpC,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC,qFAAqF;IACrF,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B;AAsiBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,EAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,GACX,EAAE,gBAAgB,2CAyOlB"}
|
|
@@ -103,9 +103,6 @@ export interface PanelLabels {
|
|
|
103
103
|
previewAlt: string;
|
|
104
104
|
altText: string;
|
|
105
105
|
altPlaceholder: string;
|
|
106
|
-
width: string;
|
|
107
|
-
height: string;
|
|
108
|
-
autoPlaceholder: string;
|
|
109
106
|
workspace: string;
|
|
110
107
|
selectWorkspace: string;
|
|
111
108
|
selectImage: string;
|
|
@@ -367,12 +364,6 @@ export declare const REQUIRED_LABEL_KEYS: readonly [{
|
|
|
367
364
|
readonly path: "editors.image.altText";
|
|
368
365
|
}, {
|
|
369
366
|
readonly path: "editors.image.altPlaceholder";
|
|
370
|
-
}, {
|
|
371
|
-
readonly path: "editors.image.width";
|
|
372
|
-
}, {
|
|
373
|
-
readonly path: "editors.image.height";
|
|
374
|
-
}, {
|
|
375
|
-
readonly path: "editors.image.autoPlaceholder";
|
|
376
367
|
}, {
|
|
377
368
|
readonly path: "editors.image.workspace";
|
|
378
369
|
}, {
|
|
@@ -103,9 +103,6 @@ export interface PanelLabels {
|
|
|
103
103
|
previewAlt: string;
|
|
104
104
|
altText: string;
|
|
105
105
|
altPlaceholder: string;
|
|
106
|
-
width: string;
|
|
107
|
-
height: string;
|
|
108
|
-
autoPlaceholder: string;
|
|
109
106
|
workspace: string;
|
|
110
107
|
selectWorkspace: string;
|
|
111
108
|
selectImage: string;
|
|
@@ -367,12 +364,6 @@ export declare const REQUIRED_LABEL_KEYS: readonly [{
|
|
|
367
364
|
readonly path: "editors.image.altText";
|
|
368
365
|
}, {
|
|
369
366
|
readonly path: "editors.image.altPlaceholder";
|
|
370
|
-
}, {
|
|
371
|
-
readonly path: "editors.image.width";
|
|
372
|
-
}, {
|
|
373
|
-
readonly path: "editors.image.height";
|
|
374
|
-
}, {
|
|
375
|
-
readonly path: "editors.image.autoPlaceholder";
|
|
376
367
|
}, {
|
|
377
368
|
readonly path: "editors.image.workspace";
|
|
378
369
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/labels/labels.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAE3B,OAAO,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,qBAAqB,EAAE,MAAM,CAAC;QAC9B,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,qBAAqB,EAAE,MAAM,CAAC;QAC9B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,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|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Replaces the first `url()` layer with `newUrl`, keeping other layers in
|
|
8
|
+
* place. With no existing `url()` layer, adds it as the top (first-listed)
|
|
9
|
+
* layer. `newUrl` is double-quoted to tolerate spaces/parens.
|
|
10
|
+
*/
|
|
11
|
+
export declare function replaceFirstUrlLayer(value: string | null | undefined, newUrl: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Drops the first `url()` layer, keeping the rest. Collapses to `none` when the
|
|
14
|
+
* removal empties the background (so it still wins the cascade over a class).
|
|
15
|
+
*/
|
|
16
|
+
export declare function removeFirstUrlLayer(value: string | null | undefined): string;
|
|
17
|
+
/**
|
|
18
|
+
* The `background-image` to write for an edit: an empty `newUrl` (Clear) removes
|
|
19
|
+
* the first `url()` layer; any other value swaps it in.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeBackgroundImageEdit(currentBackgroundImage: string | null | undefined, newUrl: string): string;
|
|
22
|
+
//# sourceMappingURL=backgroundImageEdit.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Replaces the first `url()` layer with `newUrl`, keeping other layers in
|
|
8
|
+
* place. With no existing `url()` layer, adds it as the top (first-listed)
|
|
9
|
+
* layer. `newUrl` is double-quoted to tolerate spaces/parens.
|
|
10
|
+
*/
|
|
11
|
+
export declare function replaceFirstUrlLayer(value: string | null | undefined, newUrl: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Drops the first `url()` layer, keeping the rest. Collapses to `none` when the
|
|
14
|
+
* removal empties the background (so it still wins the cascade over a class).
|
|
15
|
+
*/
|
|
16
|
+
export declare function removeFirstUrlLayer(value: string | null | undefined): string;
|
|
17
|
+
/**
|
|
18
|
+
* The `background-image` to write for an edit: an empty `newUrl` (Clear) removes
|
|
19
|
+
* the first `url()` layer; any other value swaps it in.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeBackgroundImageEdit(currentBackgroundImage: string | null | undefined, newUrl: string): string;
|
|
22
|
+
//# sourceMappingURL=backgroundImageEdit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backgroundImageEdit.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/utils/backgroundImageEdit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAe7F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAU5E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,sBAAsB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjD,MAAM,EAAE,MAAM,GACZ,MAAM,CAIR"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const cssUrlLayers = require("../../shared/cssUrlLayers.cjs");
|
|
4
|
+
const ASSETS_ROOT = "src/assets";
|
|
5
|
+
const IMAGE_SUBDIR = "images";
|
|
6
|
+
const ASSETS_DIR = `${ASSETS_ROOT}/${IMAGE_SUBDIR}`;
|
|
7
|
+
const DEV_URL_PREFIX = `/${ASSETS_DIR}`;
|
|
5
8
|
const MAX_FILENAME_COLLISIONS = 1e3;
|
|
6
|
-
const
|
|
7
|
-
"image/png": "
|
|
8
|
-
"image/jpeg": "
|
|
9
|
-
"image/gif": "
|
|
10
|
-
"image/webp": "
|
|
11
|
-
"image/
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
9
|
+
const IMAGE_FORMATS = [
|
|
10
|
+
{ mime: "image/png", ext: "png" },
|
|
11
|
+
{ mime: "image/jpeg", ext: "jpg", aliases: ["jpeg"] },
|
|
12
|
+
{ mime: "image/gif", ext: "gif" },
|
|
13
|
+
{ mime: "image/webp", ext: "webp" },
|
|
14
|
+
{ mime: "image/avif", ext: "avif" },
|
|
15
|
+
{ mime: "image/svg+xml", ext: "svg" }
|
|
16
|
+
];
|
|
17
|
+
const EXT_BY_MIME = Object.fromEntries(
|
|
18
|
+
IMAGE_FORMATS.map((f) => [f.mime, `.${f.ext}`])
|
|
19
|
+
);
|
|
20
|
+
const MIME_BY_EXT = Object.fromEntries(
|
|
21
|
+
IMAGE_FORMATS.flatMap((f) => [f.ext, ...f.aliases ?? []].map((ext) => [ext, f.mime]))
|
|
22
|
+
);
|
|
21
23
|
const normalizeSeparators = (p) => p.replace(/\\/g, "/");
|
|
22
24
|
const dirname = (p) => {
|
|
23
25
|
const normalized = normalizeSeparators(p).replace(/\/+$/, "");
|
|
@@ -36,6 +38,19 @@ const extname = (filename) => {
|
|
|
36
38
|
return idx <= 0 ? "" : base.slice(idx);
|
|
37
39
|
};
|
|
38
40
|
const joinPath = (...segments) => segments.map((s) => normalizeSeparators(s)).join("/").replace(/\/{2,}/g, "/");
|
|
41
|
+
const TRACEABLE_ASSET_EXTENSIONS = new Set(Object.keys(MIME_BY_EXT));
|
|
42
|
+
const KNOWN_EXT_PATTERN = new RegExp(`\\.(${[...TRACEABLE_ASSET_EXTENSIONS].join("|")})$`, "i");
|
|
43
|
+
const resolveAssetRef = (raw) => {
|
|
44
|
+
if (typeof raw !== "string" || raw.length === 0) return null;
|
|
45
|
+
if (raw.startsWith("//") || /^[a-z][a-z0-9+.-]*:/i.test(raw)) return null;
|
|
46
|
+
const withoutQueryHash = raw.split(/[?#]/)[0] ?? "";
|
|
47
|
+
const normalized = normalizeSeparators(withoutQueryHash).replace(/^\/+/, "");
|
|
48
|
+
if (!normalized.startsWith(`${ASSETS_ROOT}/`)) return null;
|
|
49
|
+
if (normalized.split("/").includes("..")) return null;
|
|
50
|
+
const ext = extname(normalized).slice(1).toLowerCase();
|
|
51
|
+
if (!TRACEABLE_ASSET_EXTENSIONS.has(ext)) return null;
|
|
52
|
+
return { assetPath: normalized };
|
|
53
|
+
};
|
|
39
54
|
const mimeTypeForFilename = (filename) => {
|
|
40
55
|
const ext = extname(filename).slice(1).toLowerCase();
|
|
41
56
|
return MIME_BY_EXT[ext] ?? "image/png";
|
|
@@ -43,7 +58,7 @@ const mimeTypeForFilename = (filename) => {
|
|
|
43
58
|
const sanitizeFilename = (name, contentType) => {
|
|
44
59
|
const ext = EXT_BY_MIME[contentType] || ".png";
|
|
45
60
|
const baseOnly = name.split(/[/\\]/).pop() ?? name;
|
|
46
|
-
const withoutExt = baseOnly.replace(
|
|
61
|
+
const withoutExt = baseOnly.replace(KNOWN_EXT_PATTERN, "");
|
|
47
62
|
const safe = withoutExt.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
48
63
|
return (safe || "image") + ext;
|
|
49
64
|
};
|
|
@@ -101,11 +116,14 @@ const saveImageToAssets = async (appRoot, filename, bytes, fs) => {
|
|
|
101
116
|
return savedName;
|
|
102
117
|
};
|
|
103
118
|
const assetDevUrl = (filename) => `${DEV_URL_PREFIX}/${filename}`;
|
|
119
|
+
exports.CSS_URL_TOKEN_SOURCE = cssUrlLayers.CSS_URL_TOKEN_SOURCE;
|
|
104
120
|
exports.ASSETS_DIR = ASSETS_DIR;
|
|
121
|
+
exports.ASSETS_ROOT = ASSETS_ROOT;
|
|
105
122
|
exports.DEV_URL_PREFIX = DEV_URL_PREFIX;
|
|
106
123
|
exports.assetDevUrl = assetDevUrl;
|
|
107
124
|
exports.dataUriForImage = dataUriForImage;
|
|
108
125
|
exports.findAppRoot = findAppRoot;
|
|
109
126
|
exports.mimeTypeForFilename = mimeTypeForFilename;
|
|
127
|
+
exports.resolveAssetRef = resolveAssetRef;
|
|
110
128
|
exports.sanitizeFilename = sanitizeFilename;
|
|
111
129
|
exports.saveImageToAssets = saveImageToAssets;
|
|
@@ -4,34 +4,19 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* `/authoring/host` entry: host-neutral
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* sanitization, and MIME lookup.
|
|
7
|
+
* `/authoring/host` entry: host-neutral policy for importing an image into a
|
|
8
|
+
* previewed app — app-root discovery, the `src/assets/images` placement
|
|
9
|
+
* convention, content-dedupe, dev-URL shape, filename sanitization, MIME lookup.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 2. a {@link FileSystemAdapter} over its filesystem.
|
|
17
|
-
* Everything else lives here so it isn't re-implemented and kept in sync per
|
|
18
|
-
* surface.
|
|
19
|
-
*
|
|
20
|
-
* Environment-neutral by construction: no `vscode`, no `@salesforce/core`, and
|
|
21
|
-
* no `node:path` / `node:fs`. Path work is plain string ops (separators are
|
|
22
|
-
* normalized at the boundary) and the only I/O seam is the injected
|
|
23
|
-
* `FileSystemAdapter`, so the same compiled code runs in a Node host (VS Code)
|
|
24
|
-
* and a browser/LWC host (Codey Studio). This matches the `no-host-imports`
|
|
25
|
-
* boundary that also guards `authoring/core`.
|
|
11
|
+
* Shared across surfaces (VS Code, Codey Studio, …); each supplies only a native
|
|
12
|
+
* file picker and a {@link FileSystemAdapter}. Environment-neutral by
|
|
13
|
+
* construction (no `vscode`/`@salesforce/core`/`node:*`), so the same compiled
|
|
14
|
+
* code runs in a Node or browser host — matching the `no-host-imports` boundary.
|
|
26
15
|
*/
|
|
27
16
|
/**
|
|
28
|
-
*
|
|
29
|
-
* (`vscode.workspace.fs`, `node:fs`, an in-memory store,
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `stat` returns whether the path exists (an exists-boolean keeps the surface
|
|
33
|
-
* adapter tiny — a thrown "not found" becomes `false`); the other three mirror
|
|
34
|
-
* the operations the import pipeline needs.
|
|
17
|
+
* Filesystem seam each surface implements over its own backend
|
|
18
|
+
* (`vscode.workspace.fs`, `node:fs`, an in-memory store, …). Paths use `/`
|
|
19
|
+
* separators. `stat` returns an exists-boolean rather than throwing on "missing".
|
|
35
20
|
*/
|
|
36
21
|
export interface FileSystemAdapter {
|
|
37
22
|
/** Resolve to `true` if `path` exists, `false` otherwise (never throws for "missing"). */
|
|
@@ -44,16 +29,43 @@ export interface FileSystemAdapter {
|
|
|
44
29
|
mkdir(path: string): Promise<void>;
|
|
45
30
|
}
|
|
46
31
|
/**
|
|
47
|
-
* The app-relative
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
* The app-relative root every traceable asset ref sits under — broader than
|
|
33
|
+
* {@link ASSETS_DIR}, since a ref may point at any file under `src/assets`. The
|
|
34
|
+
* tracer keys on this prefix; {@link ASSETS_DIR} / {@link DEV_URL_PREFIX} derive
|
|
35
|
+
* from it so they can't drift.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ASSETS_ROOT = "src/assets";
|
|
38
|
+
/**
|
|
39
|
+
* The app-relative directory imported images are written under. Sits under the
|
|
40
|
+
* app root so the dev server serves it at {@link DEV_URL_PREFIX}.
|
|
53
41
|
*/
|
|
54
42
|
export declare const ASSETS_DIR = "src/assets/images";
|
|
55
43
|
/** Root-relative URL prefix the dev server serves {@link ASSETS_DIR} at. */
|
|
56
44
|
export declare const DEV_URL_PREFIX = "/src/assets/images";
|
|
45
|
+
/**
|
|
46
|
+
* The url() token source, re-exported from `shared/cssUrlLayers` so the build
|
|
47
|
+
* tracer imports it from its single host entry point (alongside
|
|
48
|
+
* {@link resolveAssetRef} / {@link ASSETS_ROOT}) and shares the runtime's rule.
|
|
49
|
+
*/
|
|
50
|
+
export { CSS_URL_TOKEN_SOURCE } from '../../shared/cssUrlLayers.cjs';
|
|
51
|
+
/** A traceable asset reference resolved from a raw attribute string. */
|
|
52
|
+
export interface ResolvedAssetRef {
|
|
53
|
+
/**
|
|
54
|
+
* App-root-relative POSIX path to the source asset, with any leading slash,
|
|
55
|
+
* `?query`, and `#hash` stripped -- e.g. `"src/assets/images/hero.png"`.
|
|
56
|
+
*/
|
|
57
|
+
assetPath: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether an attribute string is a traceable asset ref, and the file it points
|
|
61
|
+
* at. Shared with the build-time tracer plugin so the match rule can't drift.
|
|
62
|
+
*
|
|
63
|
+
* A ref iff, after normalizing separators and stripping `?query`/`#hash` and a
|
|
64
|
+
* single leading slash, it sits under {@link ASSETS_ROOT}`/` and ends in a known
|
|
65
|
+
* image extension. Absolute / protocol-relative / `data:` URLs and `..`
|
|
66
|
+
* traversal are not matched.
|
|
67
|
+
*/
|
|
68
|
+
export declare const resolveAssetRef: (raw: string) => ResolvedAssetRef | null;
|
|
57
69
|
/** Best-effort MIME type for a filename's extension; defaults to image/png. */
|
|
58
70
|
export declare const mimeTypeForFilename: (filename: string) => string;
|
|
59
71
|
/**
|
|
@@ -67,11 +79,9 @@ export declare const sanitizeFilename: (name: string, contentType: string) => st
|
|
|
67
79
|
/** Build a base64 `data:` URI for image bytes — usable as a preview `<img src>` in any host. */
|
|
68
80
|
export declare const dataUriForImage: (bytes: Uint8Array, contentType: string) => string;
|
|
69
81
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* derived from the edited element's own source location. Returns `undefined` if no
|
|
74
|
-
* `package.json` is found before reaching the filesystem root.
|
|
82
|
+
* Nearest ancestor of `sourceFilePath` containing a `package.json` — the app
|
|
83
|
+
* root, derived from the edited element's own source rather than the workspace
|
|
84
|
+
* or dev-server cwd. `undefined` if none before the filesystem root.
|
|
75
85
|
*/
|
|
76
86
|
export declare const findAppRoot: (sourceFilePath: string, fs: FileSystemAdapter) => Promise<string | undefined>;
|
|
77
87
|
/**
|
|
@@ -4,34 +4,19 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* `/authoring/host` entry: host-neutral
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* sanitization, and MIME lookup.
|
|
7
|
+
* `/authoring/host` entry: host-neutral policy for importing an image into a
|
|
8
|
+
* previewed app — app-root discovery, the `src/assets/images` placement
|
|
9
|
+
* convention, content-dedupe, dev-URL shape, filename sanitization, MIME lookup.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 2. a {@link FileSystemAdapter} over its filesystem.
|
|
17
|
-
* Everything else lives here so it isn't re-implemented and kept in sync per
|
|
18
|
-
* surface.
|
|
19
|
-
*
|
|
20
|
-
* Environment-neutral by construction: no `vscode`, no `@salesforce/core`, and
|
|
21
|
-
* no `node:path` / `node:fs`. Path work is plain string ops (separators are
|
|
22
|
-
* normalized at the boundary) and the only I/O seam is the injected
|
|
23
|
-
* `FileSystemAdapter`, so the same compiled code runs in a Node host (VS Code)
|
|
24
|
-
* and a browser/LWC host (Codey Studio). This matches the `no-host-imports`
|
|
25
|
-
* boundary that also guards `authoring/core`.
|
|
11
|
+
* Shared across surfaces (VS Code, Codey Studio, …); each supplies only a native
|
|
12
|
+
* file picker and a {@link FileSystemAdapter}. Environment-neutral by
|
|
13
|
+
* construction (no `vscode`/`@salesforce/core`/`node:*`), so the same compiled
|
|
14
|
+
* code runs in a Node or browser host — matching the `no-host-imports` boundary.
|
|
26
15
|
*/
|
|
27
16
|
/**
|
|
28
|
-
*
|
|
29
|
-
* (`vscode.workspace.fs`, `node:fs`, an in-memory store,
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `stat` returns whether the path exists (an exists-boolean keeps the surface
|
|
33
|
-
* adapter tiny — a thrown "not found" becomes `false`); the other three mirror
|
|
34
|
-
* the operations the import pipeline needs.
|
|
17
|
+
* Filesystem seam each surface implements over its own backend
|
|
18
|
+
* (`vscode.workspace.fs`, `node:fs`, an in-memory store, …). Paths use `/`
|
|
19
|
+
* separators. `stat` returns an exists-boolean rather than throwing on "missing".
|
|
35
20
|
*/
|
|
36
21
|
export interface FileSystemAdapter {
|
|
37
22
|
/** Resolve to `true` if `path` exists, `false` otherwise (never throws for "missing"). */
|
|
@@ -44,16 +29,43 @@ export interface FileSystemAdapter {
|
|
|
44
29
|
mkdir(path: string): Promise<void>;
|
|
45
30
|
}
|
|
46
31
|
/**
|
|
47
|
-
* The app-relative
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
* The app-relative root every traceable asset ref sits under — broader than
|
|
33
|
+
* {@link ASSETS_DIR}, since a ref may point at any file under `src/assets`. The
|
|
34
|
+
* tracer keys on this prefix; {@link ASSETS_DIR} / {@link DEV_URL_PREFIX} derive
|
|
35
|
+
* from it so they can't drift.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ASSETS_ROOT = "src/assets";
|
|
38
|
+
/**
|
|
39
|
+
* The app-relative directory imported images are written under. Sits under the
|
|
40
|
+
* app root so the dev server serves it at {@link DEV_URL_PREFIX}.
|
|
53
41
|
*/
|
|
54
42
|
export declare const ASSETS_DIR = "src/assets/images";
|
|
55
43
|
/** Root-relative URL prefix the dev server serves {@link ASSETS_DIR} at. */
|
|
56
44
|
export declare const DEV_URL_PREFIX = "/src/assets/images";
|
|
45
|
+
/**
|
|
46
|
+
* The url() token source, re-exported from `shared/cssUrlLayers` so the build
|
|
47
|
+
* tracer imports it from its single host entry point (alongside
|
|
48
|
+
* {@link resolveAssetRef} / {@link ASSETS_ROOT}) and shares the runtime's rule.
|
|
49
|
+
*/
|
|
50
|
+
export { CSS_URL_TOKEN_SOURCE } from '../../shared/cssUrlLayers.js';
|
|
51
|
+
/** A traceable asset reference resolved from a raw attribute string. */
|
|
52
|
+
export interface ResolvedAssetRef {
|
|
53
|
+
/**
|
|
54
|
+
* App-root-relative POSIX path to the source asset, with any leading slash,
|
|
55
|
+
* `?query`, and `#hash` stripped -- e.g. `"src/assets/images/hero.png"`.
|
|
56
|
+
*/
|
|
57
|
+
assetPath: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether an attribute string is a traceable asset ref, and the file it points
|
|
61
|
+
* at. Shared with the build-time tracer plugin so the match rule can't drift.
|
|
62
|
+
*
|
|
63
|
+
* A ref iff, after normalizing separators and stripping `?query`/`#hash` and a
|
|
64
|
+
* single leading slash, it sits under {@link ASSETS_ROOT}`/` and ends in a known
|
|
65
|
+
* image extension. Absolute / protocol-relative / `data:` URLs and `..`
|
|
66
|
+
* traversal are not matched.
|
|
67
|
+
*/
|
|
68
|
+
export declare const resolveAssetRef: (raw: string) => ResolvedAssetRef | null;
|
|
57
69
|
/** Best-effort MIME type for a filename's extension; defaults to image/png. */
|
|
58
70
|
export declare const mimeTypeForFilename: (filename: string) => string;
|
|
59
71
|
/**
|
|
@@ -67,11 +79,9 @@ export declare const sanitizeFilename: (name: string, contentType: string) => st
|
|
|
67
79
|
/** Build a base64 `data:` URI for image bytes — usable as a preview `<img src>` in any host. */
|
|
68
80
|
export declare const dataUriForImage: (bytes: Uint8Array, contentType: string) => string;
|
|
69
81
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* derived from the edited element's own source location. Returns `undefined` if no
|
|
74
|
-
* `package.json` is found before reaching the filesystem root.
|
|
82
|
+
* Nearest ancestor of `sourceFilePath` containing a `package.json` — the app
|
|
83
|
+
* root, derived from the edited element's own source rather than the workspace
|
|
84
|
+
* or dev-server cwd. `undefined` if none before the filesystem root.
|
|
75
85
|
*/
|
|
76
86
|
export declare const findAppRoot: (sourceFilePath: string, fs: FileSystemAdapter) => Promise<string | undefined>;
|
|
77
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authoring/host/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authoring/host/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,0FAA0F;IAC1F,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,uDAAuD;IACvD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,kFAAkF;IAClF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,eAAe,CAAC;AAKxC;;;GAGG;AACH,eAAO,MAAM,UAAU,sBAAmC,CAAC;AAE3D,4EAA4E;AAC5E,eAAO,MAAM,cAAc,uBAAmB,CAAC;AAE/C;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAiFpE,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,KAAG,gBAAgB,GAAG,IAmBhE,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,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