@salesforce/ui-design-mode 12.6.3 → 12.7.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.ts.map +1 -1
- package/dist/authoring/core/editors/BoxDimensionEditor.d.ts.map +1 -1
- package/dist/authoring/core/editors/ColorEditor.d.cts +9 -7
- package/dist/authoring/core/editors/ColorEditor.d.ts +9 -7
- package/dist/authoring/core/editors/ColorEditor.d.ts.map +1 -1
- package/dist/authoring/core/utils/colorOcclusion.d.cts +185 -0
- package/dist/authoring/core/utils/colorOcclusion.d.ts +185 -0
- package/dist/authoring/core/utils/colorOcclusion.d.ts.map +1 -0
- package/dist/authoring/core/utils/colorUtils.d.cts +26 -0
- package/dist/authoring/core/utils/colorUtils.d.ts +26 -0
- package/dist/authoring/core/utils/colorUtils.d.ts.map +1 -1
- package/dist/authoring/react/index.js +4 -4
- package/dist/authoring/web-component/index.js +22 -22
- 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 +451 -94
- package/dist/runtime/interactions/eventHandlers.d.cts +17 -32
- package/dist/runtime/interactions/eventHandlers.d.ts +17 -32
- package/dist/runtime/interactions/eventHandlers.d.ts.map +1 -1
- package/dist/runtime/interactions/interactionsController.d.cts +1 -8
- package/dist/runtime/interactions/interactionsController.d.ts +1 -8
- package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
- package/dist/runtime/interactions/interceptOverlay.d.cts +172 -0
- package/dist/runtime/interactions/interceptOverlay.d.ts +172 -0
- package/dist/runtime/interactions/interceptOverlay.d.ts.map +1 -0
- package/dist/runtime/interactions/utils/cssUtils.d.cts +22 -0
- package/dist/runtime/interactions/utils/cssUtils.d.ts +22 -0
- package/dist/runtime/interactions/utils/cssUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/authoring/core/utils/backgroundOcclusion.d.cts +0 -48
- package/dist/authoring/core/utils/backgroundOcclusion.d.ts +0 -48
- package/dist/authoring/core/utils/backgroundOcclusion.d.ts.map +0 -1
|
@@ -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,EACX,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;
|
|
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,EACX,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,CA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AU,EAAE,CAAC;IAC9B,wCAAwC;IACxC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,CACX,KAAK,CAAC,aAAa,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAC1F,EAAE,CAAC;IACJ,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,KAAK,EACL,KAAU,EACV,QAAQ,EACR,EAAO,EACP,KAAyB,EACzB,WAAsC,EACtC,SAAiB,EACjB,aAAuB,EACvB,SAAS,EACT,WAAgB,EAChB,IAAI,EAAE,QAAQ,GACd,EAAE,uBAAuB,2CAqRzB"}
|
|
@@ -16,13 +16,15 @@ export interface ColorEditorProps {
|
|
|
16
16
|
/** Localized placeholder + static/composed aria; omit for English. */
|
|
17
17
|
aria?: ColorAriaLabels;
|
|
18
18
|
/**
|
|
19
|
-
* The
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* The image layer competing with this editor's color, whichever one applies:
|
|
20
|
+
* `background-image` for Background Color, `border-image-source` for Border
|
|
21
|
+
* Color, or `background-image` again for Text Color when the host has
|
|
22
|
+
* confirmed `background-clip: text` (the "gradient text" trick). When the
|
|
23
|
+
* element paints an image but has no color fill (transparent), the swatch
|
|
24
|
+
* previews that image and the value shows a read-only descriptor
|
|
25
|
+
* ("Gradient"/"Image") instead of the meaningless `rgba(0, 0, 0, 0)`. Picking
|
|
26
|
+
* a color then replaces the image (the host clears the occluding layer — see
|
|
27
|
+
* `computeColorOcclusionClears`).
|
|
26
28
|
*/
|
|
27
29
|
backgroundImage?: string;
|
|
28
30
|
}
|
|
@@ -16,13 +16,15 @@ export interface ColorEditorProps {
|
|
|
16
16
|
/** Localized placeholder + static/composed aria; omit for English. */
|
|
17
17
|
aria?: ColorAriaLabels;
|
|
18
18
|
/**
|
|
19
|
-
* The
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* The image layer competing with this editor's color, whichever one applies:
|
|
20
|
+
* `background-image` for Background Color, `border-image-source` for Border
|
|
21
|
+
* Color, or `background-image` again for Text Color when the host has
|
|
22
|
+
* confirmed `background-clip: text` (the "gradient text" trick). When the
|
|
23
|
+
* element paints an image but has no color fill (transparent), the swatch
|
|
24
|
+
* previews that image and the value shows a read-only descriptor
|
|
25
|
+
* ("Gradient"/"Image") instead of the meaningless `rgba(0, 0, 0, 0)`. Picking
|
|
26
|
+
* a color then replaces the image (the host clears the occluding layer — see
|
|
27
|
+
* `computeColorOcclusionClears`).
|
|
26
28
|
*/
|
|
27
29
|
backgroundImage?: string;
|
|
28
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorEditor.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/editors/ColorEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorEditor.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/editors/ColorEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoNhF,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,WAAW,EACrB,aAAa,GAAE,MAAuB;;;EAoBtC;AAwJD,KAAK,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;AAwBvD,MAAM,WAAW,gBAAgB;IAChC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kDAAkD;IAClD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,EAAY,EACZ,IAAI,EAAE,QAAQ,EACd,eAAe,GACf,EAAE,gBAAgB,2CAqlBlB"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color-occlusion policy.
|
|
8
|
+
*
|
|
9
|
+
* A color longhand and its competing image layer are separate paint layers: the
|
|
10
|
+
* image paints *on top of* the color. So when an element's class sets an opaque
|
|
11
|
+
* `background-image`, `border-image`, or (via `background-clip: text`) a
|
|
12
|
+
* gradient clipped to the text glyphs, a user's inline color edit
|
|
13
|
+
* (`background-color`, `border-color`, `color`) wins the cascade for the color
|
|
14
|
+
* longhand yet is never visible — the image covers it.
|
|
15
|
+
*
|
|
16
|
+
* This module decides, for a single color edit, whether an accompanying
|
|
17
|
+
* `<image-property>: none` write is needed so the color the user picked actually
|
|
18
|
+
* shows. It is pure (no DOM, no history) so it can be unit-tested in isolation
|
|
19
|
+
* and reused by any surface; the caller is responsible for applying + recording
|
|
20
|
+
* the returned clears (as one atomic change — see `recordStyleBatch`).
|
|
21
|
+
*/
|
|
22
|
+
/** A property write the caller should apply + record alongside the user's edit. */
|
|
23
|
+
export interface OcclusionClear {
|
|
24
|
+
property: string;
|
|
25
|
+
/** The occluding value being replaced (for undo). */
|
|
26
|
+
oldValue: string;
|
|
27
|
+
/** The neutral value that stops occluding (`"none"` for an image layer, `"currentcolor"` for `-webkit-text-fill-color`). */
|
|
28
|
+
newValue: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Normalizes a CSS image-layer value (`background-image`, `border-image-source`)
|
|
32
|
+
* to its painted value, or `""` when it paints nothing (empty, `none`, or a
|
|
33
|
+
* CSS-wide keyword). The keyword case covers a browser decomposing an inline
|
|
34
|
+
* shorthand that omits the image (e.g. `background: transparent`), which stamps
|
|
35
|
+
* the omitted longhand's inline value as the literal keyword `"initial"` —
|
|
36
|
+
* truthy, but not a real image. Single source of truth for "is this a painted
|
|
37
|
+
* image layer", shared by the occlusion policy and the panel's color editors so
|
|
38
|
+
* both agree on what counts as an image layer.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizePaintedImageLayer(value: string | null | undefined): string;
|
|
41
|
+
/** Whether a CSS image-layer value paints a visible layer. */
|
|
42
|
+
export declare function isPaintedImageLayer(value: string | null | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether a single `background-clip` value is the literal `text` keyword —
|
|
45
|
+
* the occlusion-clear predicate for un-clipping a background from the glyphs
|
|
46
|
+
* (reset value `"border-box"`, its CSS-initial default).
|
|
47
|
+
*/
|
|
48
|
+
export declare function isTextClip(value: string | null | undefined): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Splits a CSS comma-separated value list on top-level commas only, skipping
|
|
51
|
+
* commas nested inside function parens — e.g. `background-image` and
|
|
52
|
+
* `background-clip` are each such a list, one entry per background layer, but
|
|
53
|
+
* a gradient function's own argument list (`linear-gradient(135deg, red, blue)`)
|
|
54
|
+
* contains commas that must not be treated as layer separators.
|
|
55
|
+
*/
|
|
56
|
+
export declare function splitCssLayers(value: string): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Given a multi-layer `background-image` and its paired `background-clip`
|
|
59
|
+
* list, returns just the image layer(s) clipped to `targetClip` (e.g. the
|
|
60
|
+
* "gradient border" trick's `border-box` layer) — never the whole multi-layer
|
|
61
|
+
* value, whose first-listed layer would otherwise paint over it (CSS stacks
|
|
62
|
+
* background layers with the first-listed on top). Per spec, the number of
|
|
63
|
+
* layers is however many `background-image` lists; a shorter `background-clip`
|
|
64
|
+
* list cycles to match. Returns `""` when nothing matches.
|
|
65
|
+
*/
|
|
66
|
+
export declare function selectBackgroundLayersByClip(backgroundImage: string, backgroundClip: string, targetClip: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* The image layer(s) NOT clipped to `text` — everything visible as the box's
|
|
69
|
+
* own background, excluding whatever paints only within the glyph shapes.
|
|
70
|
+
* Inverse of `selectBackgroundLayersByClip` with a `"text"` target; used by
|
|
71
|
+
* Background Color's preview so a `text`-clipped "gradient text" layer never
|
|
72
|
+
* bleeds into the box's own swatch on a multi-layer background like
|
|
73
|
+
* `background-clip: text, padding-box`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function excludeTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether `background-color`'s own effective clip box is `text`. Unlike a
|
|
78
|
+
* `background-image` layer, `background-color` isn't itself layered — per
|
|
79
|
+
* spec its clip is always the LAST `background-clip` entry, resolved to
|
|
80
|
+
* `background-image`'s layer count by the same cycle/truncate rule
|
|
81
|
+
* `selectBackgroundLayersByClip` uses per-layer. For a multi-layer clip list
|
|
82
|
+
* like `text, padding-box`, the LAST entry (`padding-box`) governs color, so
|
|
83
|
+
* color is not text-clipped even though one image layer is.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isBackgroundColorClippedToText(backgroundImage: string, backgroundClip: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Replaces just the layer(s) resolved to `text` with `"none"`. The clear-time
|
|
88
|
+
* counterpart to `selectBackgroundLayersByClip`'s `"text"` selection: lets a
|
|
89
|
+
* Text Color edit stop an occluding glyph-clipped gradient without
|
|
90
|
+
* destroying an unrelated layer (e.g. the box's own `padding-box`
|
|
91
|
+
* background) sharing the same multi-layer `background-image`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function clearTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Replaces just the layer(s) NOT resolved to `text` with `"none"` — the
|
|
96
|
+
* clear-time counterpart to `excludeTextClippedLayers`. Lets a Background
|
|
97
|
+
* Color edit stop an occluding box-own layer without destroying an unrelated
|
|
98
|
+
* `text`-clipped layer (the "gradient text" trick) sharing the same
|
|
99
|
+
* multi-layer `background-image`. Call with the *already-updated*
|
|
100
|
+
* `background-clip` (see `clearBackgroundColorClip`) so a layer this same
|
|
101
|
+
* edit is un-clipping is treated as no-longer-text and gets cleared too.
|
|
102
|
+
*/
|
|
103
|
+
export declare function clearNonTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Resets `background-color`'s own effective clip position (see
|
|
106
|
+
* `isBackgroundColorClippedToText`) — the LAST resolved `background-clip`
|
|
107
|
+
* entry — to `"border-box"`, leaving any earlier entry (governing an
|
|
108
|
+
* unrelated image layer) untouched.
|
|
109
|
+
*/
|
|
110
|
+
export declare function clearBackgroundColorClip(backgroundImage: string, backgroundClip: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Whether a `-webkit-text-fill-color` value overrides `color` for glyph
|
|
113
|
+
* fill: true for a concrete authored value that actually diverges from
|
|
114
|
+
* `color`, including the deliberate `transparent` used by the "gradient
|
|
115
|
+
* text" trick — false for the neutral states that already defer to `color`
|
|
116
|
+
* (empty, a CSS-wide keyword, or the literal `currentcolor`). Unlike an
|
|
117
|
+
* image layer, "paints nothing" isn't the right test here: `transparent`
|
|
118
|
+
* paints nothing yet still occludes, because it pins the glyph fill instead
|
|
119
|
+
* of leaving it to track `color`.
|
|
120
|
+
*
|
|
121
|
+
* `resolvedColor` is the element's resolved `color` (inline, falling back to
|
|
122
|
+
* computed) for comparison, and is optional only so this still fits the
|
|
123
|
+
* generic `isOccluding: (value: string) => boolean` shape callers pass it as
|
|
124
|
+
* — every real caller supplies it. Without it, an *unset* fill (its
|
|
125
|
+
* CSS-initial value is `currentcolor`) can't be told apart from a real
|
|
126
|
+
* override here: `getComputedStyle` resolves an unset fill to a concrete
|
|
127
|
+
* `rgb()` equal to `color`, never the literal keyword, so treating any
|
|
128
|
+
* concrete value as occluding would fire on every element with a text color
|
|
129
|
+
* — writing a spurious inline `-webkit-text-fill-color` on the very first
|
|
130
|
+
* Text Color edit of an ordinary element.
|
|
131
|
+
*
|
|
132
|
+
* `hasInlineOverride` breaks that same equality tie the other way: a fill
|
|
133
|
+
* declared *inline* is never a browser default, no matter what it resolves
|
|
134
|
+
* to, so an inline value that happens to equal `resolvedColor` (e.g. someone
|
|
135
|
+
* manually reverted a gradient-text effect by copying the color into both
|
|
136
|
+
* properties instead of resetting fill to `currentcolor`) still occludes and
|
|
137
|
+
* must still be cleared. Only a fill with no inline declaration — genuinely
|
|
138
|
+
* unset, or authored only via a stylesheet rule that happens to duplicate
|
|
139
|
+
* `color` — falls back to the equality heuristic above, since neither case
|
|
140
|
+
* is distinguishable from the other without declaration-origin data this
|
|
141
|
+
* function isn't given.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isOccludingTextFillColor(value: string | null | undefined, resolvedColor?: string | null, hasInlineOverride?: boolean): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether a `background-clip` value gives corroborating evidence of the
|
|
146
|
+
* "gradient border via `background-clip`" trick — a fill layer clipped to
|
|
147
|
+
* `padding-box`/`content-box` paired with the real border gradient left at
|
|
148
|
+
* the `border-box` default — as opposed to an ordinary single-layer
|
|
149
|
+
* background that merely happens to sit behind a `border-color: transparent`
|
|
150
|
+
* (e.g. the common `border: <w> solid transparent` hover/focus idiom, used to
|
|
151
|
+
* reserve layout space without an authored border color). `background-clip`'s
|
|
152
|
+
* CSS-initial value is `border-box`, so a plain one-layer background — by far
|
|
153
|
+
* the common case — always resolves to the literal `"border-box"` here too;
|
|
154
|
+
* treating that alone as evidence of the trick misclassifies any
|
|
155
|
+
* transparent-border element with an ordinary background as having a
|
|
156
|
+
* "Gradient" border. Requiring an actual multi-layer clip with a non-border-box
|
|
157
|
+
* entry limits the match to the trick's own authoring shape.
|
|
158
|
+
*/
|
|
159
|
+
export declare function hasLayeredBorderReveal(backgroundClip: string | null | undefined): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Given the color edit the user just made and the *specific* property that
|
|
162
|
+
* would occlude it (`background-image` for `backgroundColor`,
|
|
163
|
+
* `border-image-source` for `borderColor`, `background-image` again for
|
|
164
|
+
* `color` when the caller has already confirmed it's gradient-text —
|
|
165
|
+
* `background-clip: text` — since an unrelated decorative background-image on
|
|
166
|
+
* a text element shouldn't be touched by a text-color edit, or
|
|
167
|
+
* `webkit-text-fill-color` for `color`), return the extra property write
|
|
168
|
+
* needed to keep the edit visible.
|
|
169
|
+
*
|
|
170
|
+
* Fires only for a non-empty color edit whose element has an occluding value
|
|
171
|
+
* (inline, falling back to computed). Returns `[]` in every other case —
|
|
172
|
+
* including when the occluder was already cleared inline (so we never re-emit
|
|
173
|
+
* a redundant clear on a second color tweak). We do not inspect an image
|
|
174
|
+
* layer's opacity: a partially-transparent image still visually competes with
|
|
175
|
+
* the color, and "set this solid color" reads as intent to replace the layer.
|
|
176
|
+
*
|
|
177
|
+
* @param newValue - The value the user set for the color property.
|
|
178
|
+
* @param occludingProperty - The property to clear if it occludes (camelCase, e.g. `backgroundImage`).
|
|
179
|
+
* @param computedOccluder - The element's computed value for `occludingProperty` (from `getElementStyles`).
|
|
180
|
+
* @param inlineOccluder - The element's inline value for `occludingProperty`, if any (already-applied edits).
|
|
181
|
+
* @param isOccluding - Whether a value paints over the color (default: a painted image layer).
|
|
182
|
+
* @param resetValue - The neutral value that stops occluding (default: `"none"`).
|
|
183
|
+
*/
|
|
184
|
+
export declare function computeColorOcclusionClears(newValue: string, occludingProperty: string, computedOccluder: string | undefined, inlineOccluder: string | undefined, isOccluding?: (value: string) => boolean, resetValue?: string): OcclusionClear[];
|
|
185
|
+
//# sourceMappingURL=colorOcclusion.d.ts.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color-occlusion policy.
|
|
8
|
+
*
|
|
9
|
+
* A color longhand and its competing image layer are separate paint layers: the
|
|
10
|
+
* image paints *on top of* the color. So when an element's class sets an opaque
|
|
11
|
+
* `background-image`, `border-image`, or (via `background-clip: text`) a
|
|
12
|
+
* gradient clipped to the text glyphs, a user's inline color edit
|
|
13
|
+
* (`background-color`, `border-color`, `color`) wins the cascade for the color
|
|
14
|
+
* longhand yet is never visible — the image covers it.
|
|
15
|
+
*
|
|
16
|
+
* This module decides, for a single color edit, whether an accompanying
|
|
17
|
+
* `<image-property>: none` write is needed so the color the user picked actually
|
|
18
|
+
* shows. It is pure (no DOM, no history) so it can be unit-tested in isolation
|
|
19
|
+
* and reused by any surface; the caller is responsible for applying + recording
|
|
20
|
+
* the returned clears (as one atomic change — see `recordStyleBatch`).
|
|
21
|
+
*/
|
|
22
|
+
/** A property write the caller should apply + record alongside the user's edit. */
|
|
23
|
+
export interface OcclusionClear {
|
|
24
|
+
property: string;
|
|
25
|
+
/** The occluding value being replaced (for undo). */
|
|
26
|
+
oldValue: string;
|
|
27
|
+
/** The neutral value that stops occluding (`"none"` for an image layer, `"currentcolor"` for `-webkit-text-fill-color`). */
|
|
28
|
+
newValue: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Normalizes a CSS image-layer value (`background-image`, `border-image-source`)
|
|
32
|
+
* to its painted value, or `""` when it paints nothing (empty, `none`, or a
|
|
33
|
+
* CSS-wide keyword). The keyword case covers a browser decomposing an inline
|
|
34
|
+
* shorthand that omits the image (e.g. `background: transparent`), which stamps
|
|
35
|
+
* the omitted longhand's inline value as the literal keyword `"initial"` —
|
|
36
|
+
* truthy, but not a real image. Single source of truth for "is this a painted
|
|
37
|
+
* image layer", shared by the occlusion policy and the panel's color editors so
|
|
38
|
+
* both agree on what counts as an image layer.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizePaintedImageLayer(value: string | null | undefined): string;
|
|
41
|
+
/** Whether a CSS image-layer value paints a visible layer. */
|
|
42
|
+
export declare function isPaintedImageLayer(value: string | null | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether a single `background-clip` value is the literal `text` keyword —
|
|
45
|
+
* the occlusion-clear predicate for un-clipping a background from the glyphs
|
|
46
|
+
* (reset value `"border-box"`, its CSS-initial default).
|
|
47
|
+
*/
|
|
48
|
+
export declare function isTextClip(value: string | null | undefined): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Splits a CSS comma-separated value list on top-level commas only, skipping
|
|
51
|
+
* commas nested inside function parens — e.g. `background-image` and
|
|
52
|
+
* `background-clip` are each such a list, one entry per background layer, but
|
|
53
|
+
* a gradient function's own argument list (`linear-gradient(135deg, red, blue)`)
|
|
54
|
+
* contains commas that must not be treated as layer separators.
|
|
55
|
+
*/
|
|
56
|
+
export declare function splitCssLayers(value: string): string[];
|
|
57
|
+
/**
|
|
58
|
+
* Given a multi-layer `background-image` and its paired `background-clip`
|
|
59
|
+
* list, returns just the image layer(s) clipped to `targetClip` (e.g. the
|
|
60
|
+
* "gradient border" trick's `border-box` layer) — never the whole multi-layer
|
|
61
|
+
* value, whose first-listed layer would otherwise paint over it (CSS stacks
|
|
62
|
+
* background layers with the first-listed on top). Per spec, the number of
|
|
63
|
+
* layers is however many `background-image` lists; a shorter `background-clip`
|
|
64
|
+
* list cycles to match. Returns `""` when nothing matches.
|
|
65
|
+
*/
|
|
66
|
+
export declare function selectBackgroundLayersByClip(backgroundImage: string, backgroundClip: string, targetClip: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* The image layer(s) NOT clipped to `text` — everything visible as the box's
|
|
69
|
+
* own background, excluding whatever paints only within the glyph shapes.
|
|
70
|
+
* Inverse of `selectBackgroundLayersByClip` with a `"text"` target; used by
|
|
71
|
+
* Background Color's preview so a `text`-clipped "gradient text" layer never
|
|
72
|
+
* bleeds into the box's own swatch on a multi-layer background like
|
|
73
|
+
* `background-clip: text, padding-box`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function excludeTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether `background-color`'s own effective clip box is `text`. Unlike a
|
|
78
|
+
* `background-image` layer, `background-color` isn't itself layered — per
|
|
79
|
+
* spec its clip is always the LAST `background-clip` entry, resolved to
|
|
80
|
+
* `background-image`'s layer count by the same cycle/truncate rule
|
|
81
|
+
* `selectBackgroundLayersByClip` uses per-layer. For a multi-layer clip list
|
|
82
|
+
* like `text, padding-box`, the LAST entry (`padding-box`) governs color, so
|
|
83
|
+
* color is not text-clipped even though one image layer is.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isBackgroundColorClippedToText(backgroundImage: string, backgroundClip: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Replaces just the layer(s) resolved to `text` with `"none"`. The clear-time
|
|
88
|
+
* counterpart to `selectBackgroundLayersByClip`'s `"text"` selection: lets a
|
|
89
|
+
* Text Color edit stop an occluding glyph-clipped gradient without
|
|
90
|
+
* destroying an unrelated layer (e.g. the box's own `padding-box`
|
|
91
|
+
* background) sharing the same multi-layer `background-image`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function clearTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Replaces just the layer(s) NOT resolved to `text` with `"none"` — the
|
|
96
|
+
* clear-time counterpart to `excludeTextClippedLayers`. Lets a Background
|
|
97
|
+
* Color edit stop an occluding box-own layer without destroying an unrelated
|
|
98
|
+
* `text`-clipped layer (the "gradient text" trick) sharing the same
|
|
99
|
+
* multi-layer `background-image`. Call with the *already-updated*
|
|
100
|
+
* `background-clip` (see `clearBackgroundColorClip`) so a layer this same
|
|
101
|
+
* edit is un-clipping is treated as no-longer-text and gets cleared too.
|
|
102
|
+
*/
|
|
103
|
+
export declare function clearNonTextClippedLayers(backgroundImage: string, backgroundClip: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Resets `background-color`'s own effective clip position (see
|
|
106
|
+
* `isBackgroundColorClippedToText`) — the LAST resolved `background-clip`
|
|
107
|
+
* entry — to `"border-box"`, leaving any earlier entry (governing an
|
|
108
|
+
* unrelated image layer) untouched.
|
|
109
|
+
*/
|
|
110
|
+
export declare function clearBackgroundColorClip(backgroundImage: string, backgroundClip: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* Whether a `-webkit-text-fill-color` value overrides `color` for glyph
|
|
113
|
+
* fill: true for a concrete authored value that actually diverges from
|
|
114
|
+
* `color`, including the deliberate `transparent` used by the "gradient
|
|
115
|
+
* text" trick — false for the neutral states that already defer to `color`
|
|
116
|
+
* (empty, a CSS-wide keyword, or the literal `currentcolor`). Unlike an
|
|
117
|
+
* image layer, "paints nothing" isn't the right test here: `transparent`
|
|
118
|
+
* paints nothing yet still occludes, because it pins the glyph fill instead
|
|
119
|
+
* of leaving it to track `color`.
|
|
120
|
+
*
|
|
121
|
+
* `resolvedColor` is the element's resolved `color` (inline, falling back to
|
|
122
|
+
* computed) for comparison, and is optional only so this still fits the
|
|
123
|
+
* generic `isOccluding: (value: string) => boolean` shape callers pass it as
|
|
124
|
+
* — every real caller supplies it. Without it, an *unset* fill (its
|
|
125
|
+
* CSS-initial value is `currentcolor`) can't be told apart from a real
|
|
126
|
+
* override here: `getComputedStyle` resolves an unset fill to a concrete
|
|
127
|
+
* `rgb()` equal to `color`, never the literal keyword, so treating any
|
|
128
|
+
* concrete value as occluding would fire on every element with a text color
|
|
129
|
+
* — writing a spurious inline `-webkit-text-fill-color` on the very first
|
|
130
|
+
* Text Color edit of an ordinary element.
|
|
131
|
+
*
|
|
132
|
+
* `hasInlineOverride` breaks that same equality tie the other way: a fill
|
|
133
|
+
* declared *inline* is never a browser default, no matter what it resolves
|
|
134
|
+
* to, so an inline value that happens to equal `resolvedColor` (e.g. someone
|
|
135
|
+
* manually reverted a gradient-text effect by copying the color into both
|
|
136
|
+
* properties instead of resetting fill to `currentcolor`) still occludes and
|
|
137
|
+
* must still be cleared. Only a fill with no inline declaration — genuinely
|
|
138
|
+
* unset, or authored only via a stylesheet rule that happens to duplicate
|
|
139
|
+
* `color` — falls back to the equality heuristic above, since neither case
|
|
140
|
+
* is distinguishable from the other without declaration-origin data this
|
|
141
|
+
* function isn't given.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isOccludingTextFillColor(value: string | null | undefined, resolvedColor?: string | null, hasInlineOverride?: boolean): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether a `background-clip` value gives corroborating evidence of the
|
|
146
|
+
* "gradient border via `background-clip`" trick — a fill layer clipped to
|
|
147
|
+
* `padding-box`/`content-box` paired with the real border gradient left at
|
|
148
|
+
* the `border-box` default — as opposed to an ordinary single-layer
|
|
149
|
+
* background that merely happens to sit behind a `border-color: transparent`
|
|
150
|
+
* (e.g. the common `border: <w> solid transparent` hover/focus idiom, used to
|
|
151
|
+
* reserve layout space without an authored border color). `background-clip`'s
|
|
152
|
+
* CSS-initial value is `border-box`, so a plain one-layer background — by far
|
|
153
|
+
* the common case — always resolves to the literal `"border-box"` here too;
|
|
154
|
+
* treating that alone as evidence of the trick misclassifies any
|
|
155
|
+
* transparent-border element with an ordinary background as having a
|
|
156
|
+
* "Gradient" border. Requiring an actual multi-layer clip with a non-border-box
|
|
157
|
+
* entry limits the match to the trick's own authoring shape.
|
|
158
|
+
*/
|
|
159
|
+
export declare function hasLayeredBorderReveal(backgroundClip: string | null | undefined): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Given the color edit the user just made and the *specific* property that
|
|
162
|
+
* would occlude it (`background-image` for `backgroundColor`,
|
|
163
|
+
* `border-image-source` for `borderColor`, `background-image` again for
|
|
164
|
+
* `color` when the caller has already confirmed it's gradient-text —
|
|
165
|
+
* `background-clip: text` — since an unrelated decorative background-image on
|
|
166
|
+
* a text element shouldn't be touched by a text-color edit, or
|
|
167
|
+
* `webkit-text-fill-color` for `color`), return the extra property write
|
|
168
|
+
* needed to keep the edit visible.
|
|
169
|
+
*
|
|
170
|
+
* Fires only for a non-empty color edit whose element has an occluding value
|
|
171
|
+
* (inline, falling back to computed). Returns `[]` in every other case —
|
|
172
|
+
* including when the occluder was already cleared inline (so we never re-emit
|
|
173
|
+
* a redundant clear on a second color tweak). We do not inspect an image
|
|
174
|
+
* layer's opacity: a partially-transparent image still visually competes with
|
|
175
|
+
* the color, and "set this solid color" reads as intent to replace the layer.
|
|
176
|
+
*
|
|
177
|
+
* @param newValue - The value the user set for the color property.
|
|
178
|
+
* @param occludingProperty - The property to clear if it occludes (camelCase, e.g. `backgroundImage`).
|
|
179
|
+
* @param computedOccluder - The element's computed value for `occludingProperty` (from `getElementStyles`).
|
|
180
|
+
* @param inlineOccluder - The element's inline value for `occludingProperty`, if any (already-applied edits).
|
|
181
|
+
* @param isOccluding - Whether a value paints over the color (default: a painted image layer).
|
|
182
|
+
* @param resetValue - The neutral value that stops occluding (default: `"none"`).
|
|
183
|
+
*/
|
|
184
|
+
export declare function computeColorOcclusionClears(newValue: string, occludingProperty: string, computedOccluder: string | undefined, inlineOccluder: string | undefined, isOccluding?: (value: string) => boolean, resetValue?: string): OcclusionClear[];
|
|
185
|
+
//# sourceMappingURL=colorOcclusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorOcclusion.d.ts","sourceRoot":"","sources":["../../../../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G;AACH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAMhG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,EAC7B,iBAAiB,UAAQ,GACvB,OAAO,CAMT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAGzF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,EACzB,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,WAAW,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAA6B,EAC7D,UAAU,SAAS,GACjB,cAAc,EAAE,CAclB"}
|
|
@@ -14,6 +14,32 @@ export declare function isValidColor(value: string | null | undefined): boolean;
|
|
|
14
14
|
* Parse any CSS color string to { r, g, b, a }.
|
|
15
15
|
*/
|
|
16
16
|
export declare function parseColorToRgba(value: string | null | undefined): RgbaColor;
|
|
17
|
+
/**
|
|
18
|
+
* Whether a captured style value is a CSS-wide keyword rather than an
|
|
19
|
+
* authored value. A browser decomposing an inline shorthand that omits one of
|
|
20
|
+
* its longhands (e.g. `background: <gradient>` with no color, or
|
|
21
|
+
* `background: transparent` with no image) stamps the *omitted* longhand's
|
|
22
|
+
* inline value as the literal keyword `"initial"` — not a real value, but
|
|
23
|
+
* truthy, so it wins a naive `value || fallback` chain.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isCssWideKeyword(value: string | null | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a captured style value is an authored color our editor can resolve
|
|
28
|
+
* on its own, rather than empty, a CSS-wide keyword, `currentcolor`, or an
|
|
29
|
+
* unresolved `var(...)` reference. Each of these needs the *real* element's
|
|
30
|
+
* cascade (resolved `color`, or a custom property's value) to mean anything;
|
|
31
|
+
* `isValidColor`/`parseColorToRgba` can't provide that standalone — canvas
|
|
32
|
+
* resolves `currentcolor` against an offscreen, unstyled element (always
|
|
33
|
+
* black) and silently no-ops on an unbound custom property (keeping its prior
|
|
34
|
+
* fillStyle) — both plausible-looking wrong answers, not parse failures.
|
|
35
|
+
* Discarding them here lets the computed style (already resolved against the
|
|
36
|
+
* real element) win instead. A longhand assignment like `border-color:
|
|
37
|
+
* var(--x, #f97316)` reaches here as the literal string (CSSOM preserves
|
|
38
|
+
* unresolved `var()` in the specified value); a shorthand like `background:
|
|
39
|
+
* var(--x, #f97316)` doesn't, since the browser can't statically decompose an
|
|
40
|
+
* unresolved var() into longhands — that one already reads back empty.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isAuthoredColorValue(value: string | null | undefined): boolean;
|
|
17
43
|
/**
|
|
18
44
|
* Convert RGBA object to CSS string.
|
|
19
45
|
*/
|
|
@@ -14,6 +14,32 @@ export declare function isValidColor(value: string | null | undefined): boolean;
|
|
|
14
14
|
* Parse any CSS color string to { r, g, b, a }.
|
|
15
15
|
*/
|
|
16
16
|
export declare function parseColorToRgba(value: string | null | undefined): RgbaColor;
|
|
17
|
+
/**
|
|
18
|
+
* Whether a captured style value is a CSS-wide keyword rather than an
|
|
19
|
+
* authored value. A browser decomposing an inline shorthand that omits one of
|
|
20
|
+
* its longhands (e.g. `background: <gradient>` with no color, or
|
|
21
|
+
* `background: transparent` with no image) stamps the *omitted* longhand's
|
|
22
|
+
* inline value as the literal keyword `"initial"` — not a real value, but
|
|
23
|
+
* truthy, so it wins a naive `value || fallback` chain.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isCssWideKeyword(value: string | null | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a captured style value is an authored color our editor can resolve
|
|
28
|
+
* on its own, rather than empty, a CSS-wide keyword, `currentcolor`, or an
|
|
29
|
+
* unresolved `var(...)` reference. Each of these needs the *real* element's
|
|
30
|
+
* cascade (resolved `color`, or a custom property's value) to mean anything;
|
|
31
|
+
* `isValidColor`/`parseColorToRgba` can't provide that standalone — canvas
|
|
32
|
+
* resolves `currentcolor` against an offscreen, unstyled element (always
|
|
33
|
+
* black) and silently no-ops on an unbound custom property (keeping its prior
|
|
34
|
+
* fillStyle) — both plausible-looking wrong answers, not parse failures.
|
|
35
|
+
* Discarding them here lets the computed style (already resolved against the
|
|
36
|
+
* real element) win instead. A longhand assignment like `border-color:
|
|
37
|
+
* var(--x, #f97316)` reaches here as the literal string (CSSOM preserves
|
|
38
|
+
* unresolved `var()` in the specified value); a shorthand like `background:
|
|
39
|
+
* var(--x, #f97316)` doesn't, since the browser can't statically decompose an
|
|
40
|
+
* unresolved var() into longhands — that one already reads back empty.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isAuthoredColorValue(value: string | null | undefined): boolean;
|
|
17
43
|
/**
|
|
18
44
|
* Convert RGBA object to CSS string.
|
|
19
45
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorUtils.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/utils/colorUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAKN,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,GAAG,EACR,MAAM,QAAQ,CAAC;AAYhB,MAAM,WAAW,SAAS;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAA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