@contentstack/studio-react-editor 1.8.0 → 1.10.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/components/AddIcon.js +18 -0
- package/dist/components/AddIcon.js.map +1 -0
- package/dist/components/BuildingIllustration.js +1 -1
- package/dist/components/BuildingIllustration.js.map +1 -1
- package/dist/components/EditableRenderer.js +6 -4
- package/dist/components/EditableRenderer.js.map +1 -1
- package/dist/components/Element.js +60 -29
- package/dist/components/Element.js.map +1 -1
- package/dist/components/Slot.js +5 -4
- package/dist/components/Slot.js.map +1 -1
- package/dist/components/WelcomeState.js +44 -11
- package/dist/components/WelcomeState.js.map +1 -1
- package/dist/components/elements/ConditionBlock.js +7 -20
- package/dist/components/elements/ConditionBlock.js.map +1 -1
- package/dist/components/elements/SectionComposition.js +2 -1
- package/dist/components/elements/SectionComposition.js.map +1 -1
- package/dist/components/elements/SectionSlot.js +13 -42
- package/dist/components/elements/SectionSlot.js.map +1 -1
- package/dist/components/styles.js +71 -67
- package/dist/components/styles.js.map +1 -1
- package/dist/contexts/providers/edit-context.provider.js +2 -2
- package/dist/contexts/providers/edit-context.provider.js.map +1 -1
- package/dist/contexts/providers/selected-node.provider.js +7 -1
- package/dist/contexts/providers/selected-node.provider.js.map +1 -1
- package/dist/hooks/use-active-node-path.hook.js +1 -1
- package/dist/hooks/use-active-node-path.hook.js.map +1 -1
- package/dist/hooks/use-canvas-events.hook.js +2 -1
- package/dist/hooks/use-canvas-events.hook.js.map +1 -1
- package/dist/hooks/use-edit-context-listener.hook.js +2 -1
- package/dist/hooks/use-edit-context-listener.hook.js.map +1 -1
- package/dist/hooks/use-section-events.hook.js +2 -1
- package/dist/hooks/use-section-events.hook.js.map +1 -1
- package/dist/hooks/use-slot-copy-color.hook.js +54 -0
- package/dist/hooks/use-slot-copy-color.hook.js.map +1 -0
- package/dist/hooks/use-spec-data-listener.hook.js +153 -44
- package/dist/hooks/use-spec-data-listener.hook.js.map +1 -1
- package/dist/hooks/use-static-values-listener.hook.js +10 -2
- package/dist/hooks/use-static-values-listener.hook.js.map +1 -1
- package/dist/utils/backdrop-watcher.util.js +79 -0
- package/dist/utils/backdrop-watcher.util.js.map +1 -0
- package/dist/utils/copy-color.util.js +300 -0
- package/dist/utils/copy-color.util.js.map +1 -0
- package/dist/utils/renderer.util.js +103 -1
- package/dist/utils/renderer.util.js.map +1 -1
- package/package.json +9 -10
- package/LICENSE +0 -21
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour for Studio chrome that renders inside the customer's page.
|
|
3
|
+
*
|
|
4
|
+
* The chrome has no surface of its own, so its colour cannot be fixed: the page
|
|
5
|
+
* behind it may be anything. It resolves the page colour and picks one of two
|
|
6
|
+
* modes — light mode for a light page, dark mode for a dark one. Each mode is a
|
|
7
|
+
* set of Venus tokens, so the chrome looks like a Studio component rather than
|
|
8
|
+
* something tinted to match the page.
|
|
9
|
+
*
|
|
10
|
+
* Two modes and nothing in between is deliberate. An earlier version tinted the
|
|
11
|
+
* ink towards the page's own hue family, which cost contrast — a tint always
|
|
12
|
+
* sits inside the extreme it is derived from — and stopped looking like Venus.
|
|
13
|
+
*
|
|
14
|
+
* Where even the right mode cannot carry the text — a mid-tone page, far from
|
|
15
|
+
* both ends of the lightness range, where no ink reaches the readable bar — the
|
|
16
|
+
* chrome takes that mode's surface instead. That is the only case a surface
|
|
17
|
+
* appears.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The Venus tokens each mode is built from:
|
|
21
|
+
* `--color-font-black` / `--color-font-white` for primary ink,
|
|
22
|
+
* `--color-font-text-secondary-text-tarmac-grey-n-700` /
|
|
23
|
+
* `--color-bg-colors-milkybar-white-n-5` for secondary,
|
|
24
|
+
* `--color-bg-colors-pure-white` / `--color-brand-black-base` for the surface,
|
|
25
|
+
* `--color-bg-colors-dolphin-grey-n-200` for the light surface's edge, and
|
|
26
|
+
* `--color-bg-colors-tulip-purple-p-5` for the emphasised surface in light mode.
|
|
27
|
+
* Dark mode has no Venus counterpart for that last one — Venus is a light-mode
|
|
28
|
+
* system — so it is brand purple at 25% over the dark surface, the strength at
|
|
29
|
+
* which the tint reads against a plain card without competing with the copy.
|
|
30
|
+
*/
|
|
31
|
+
const STUDIO_CHROME_MODES = {
|
|
32
|
+
light: {
|
|
33
|
+
ink: "#222222",
|
|
34
|
+
secondary: "#475161",
|
|
35
|
+
surface: "#ffffff",
|
|
36
|
+
surfaceEdge: "#dde3ee",
|
|
37
|
+
emphasisSurface: "#f9f8ff",
|
|
38
|
+
},
|
|
39
|
+
dark: {
|
|
40
|
+
ink: "#ffffff",
|
|
41
|
+
secondary: "#f7f9fc",
|
|
42
|
+
surface: "#222222",
|
|
43
|
+
surfaceEdge: "rgba(255, 255, 255, 0.2)",
|
|
44
|
+
emphasisSurface: "#353153",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/** APCA minimum for a column of body text. Lc 90 is the preferred level. */
|
|
48
|
+
const LC_BODY_TEXT = 75;
|
|
49
|
+
/** APCA minimum for shorter content text that is not body copy — a label. */
|
|
50
|
+
const LC_CONTENT_TEXT = 60;
|
|
51
|
+
/**
|
|
52
|
+
* Page luminance either side of which the mode flips. Sits at the crossover
|
|
53
|
+
* where dark and light ink reach equal contrast against the page.
|
|
54
|
+
*/
|
|
55
|
+
const PAGE_TONE_CROSSOVER = 0.18;
|
|
56
|
+
const HEX_PATTERN = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i;
|
|
57
|
+
/**
|
|
58
|
+
* Matches the `rgb()` / `rgba()` serialisations `getComputedStyle` returns for
|
|
59
|
+
* `background-color`. Anything else (a modern `oklch()` / `color()` form, say)
|
|
60
|
+
* fails to parse and is treated as unresolvable, which drops the caller onto
|
|
61
|
+
* the treatment that needs no measurement rather than onto a guess.
|
|
62
|
+
*/
|
|
63
|
+
const RGB_PATTERN = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+)(%?))?\s*\)$/i;
|
|
64
|
+
/** Parses `#rrggbb` into channels. Returns null for any other form. */
|
|
65
|
+
function hexToRgb(hex) {
|
|
66
|
+
const match = HEX_PATTERN.exec(hex.trim());
|
|
67
|
+
if (!match)
|
|
68
|
+
return null;
|
|
69
|
+
return {
|
|
70
|
+
r: parseInt(match[1], 16),
|
|
71
|
+
g: parseInt(match[2], 16),
|
|
72
|
+
b: parseInt(match[3], 16),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const TRANSPARENT = { rgb: { r: 0, g: 0, b: 0 }, alpha: 0 };
|
|
76
|
+
/**
|
|
77
|
+
* Normalises any colour the browser accepts by painting one pixel of it and
|
|
78
|
+
* reading the pixel back.
|
|
79
|
+
*
|
|
80
|
+
* `getComputedStyle` returns the modern colour syntaxes verbatim rather than
|
|
81
|
+
* resolving them to `rgb()` — `oklch()`, `oklab()`, `lab()`, `lch()` and
|
|
82
|
+
* `color()` all come back as written, and `color-mix()` computes to `oklab()`.
|
|
83
|
+
* Tailwind v4's default palette is oklch, so without this a large share of
|
|
84
|
+
* customer pages cannot be measured at all. The older trick of round-tripping
|
|
85
|
+
* through `ctx.fillStyle` no longer normalises anything; only the pixel does.
|
|
86
|
+
*/
|
|
87
|
+
function paintedColor(value) {
|
|
88
|
+
if (typeof document === "undefined")
|
|
89
|
+
return null;
|
|
90
|
+
try {
|
|
91
|
+
const canvas = document.createElement("canvas");
|
|
92
|
+
const context = canvas.getContext?.("2d", {
|
|
93
|
+
willReadFrequently: true,
|
|
94
|
+
});
|
|
95
|
+
if (!context)
|
|
96
|
+
return null;
|
|
97
|
+
// Assigning an unparseable value to fillStyle is a silent no-op: it keeps
|
|
98
|
+
// whatever was there. Without this check an unreadable colour would come
|
|
99
|
+
// back as the previous fill — opaque black — which is a confident wrong
|
|
100
|
+
// answer where the honest one is "unknown". Probe with two different
|
|
101
|
+
// sentinels so a value that genuinely IS the sentinel is not mistaken for
|
|
102
|
+
// a rejection.
|
|
103
|
+
context.fillStyle = "#000000";
|
|
104
|
+
context.fillStyle = value;
|
|
105
|
+
const acceptedAsBlack = context.fillStyle !== "#000000";
|
|
106
|
+
context.fillStyle = "#ffffff";
|
|
107
|
+
context.fillStyle = value;
|
|
108
|
+
if (!acceptedAsBlack && context.fillStyle === "#ffffff")
|
|
109
|
+
return null;
|
|
110
|
+
context.clearRect(0, 0, 1, 1);
|
|
111
|
+
context.fillRect(0, 0, 1, 1);
|
|
112
|
+
const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
|
|
113
|
+
return { rgb: { r, g, b }, alpha: a / 255 };
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Canvas can be unavailable or refuse readback (privacy settings). Not
|
|
117
|
+
// knowing is a supported answer; guessing is not.
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parses a computed colour value into channels plus alpha.
|
|
123
|
+
*
|
|
124
|
+
* @returns null when the value cannot be read at all, which drops the caller
|
|
125
|
+
* onto a treatment that needs no measurement rather than onto a guess.
|
|
126
|
+
*/
|
|
127
|
+
function parseCssColor(value) {
|
|
128
|
+
const trimmed = value.trim();
|
|
129
|
+
// An empty computed value means nothing is painted here, which is
|
|
130
|
+
// transparent — distinct from a value we could not read.
|
|
131
|
+
if (trimmed === "" || trimmed === "transparent")
|
|
132
|
+
return TRANSPARENT;
|
|
133
|
+
const match = RGB_PATTERN.exec(trimmed);
|
|
134
|
+
if (!match)
|
|
135
|
+
return paintedColor(trimmed);
|
|
136
|
+
const rawAlpha = match[4] === undefined ? 1 : Number(match[4]);
|
|
137
|
+
const alpha = match[5] === "%" ? rawAlpha / 100 : rawAlpha;
|
|
138
|
+
return {
|
|
139
|
+
rgb: { r: Number(match[1]), g: Number(match[2]), b: Number(match[3]) },
|
|
140
|
+
alpha: Number.isFinite(alpha) ? Math.min(Math.max(alpha, 0), 1) : 1,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** WCAG relative luminance, 0 (black) to 1 (white). */
|
|
144
|
+
function relativeLuminance({ r, g, b }) {
|
|
145
|
+
const channel = (raw) => {
|
|
146
|
+
const srgb = raw / 255;
|
|
147
|
+
return srgb <= 0.04045
|
|
148
|
+
? srgb / 12.92
|
|
149
|
+
: Math.pow((srgb + 0.055) / 1.055, 2.4);
|
|
150
|
+
};
|
|
151
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
152
|
+
}
|
|
153
|
+
/* ---------------------------------------------------------------------------
|
|
154
|
+
* Perceptual contrast (APCA).
|
|
155
|
+
*
|
|
156
|
+
* WCAG 2's ratio is only perceptually accurate near the middle of the lightness
|
|
157
|
+
* range, which is exactly where this chrome keeps landing — a page that passes
|
|
158
|
+
* AA at 4.5:1 can still read as washed out. APCA holds across the range and
|
|
159
|
+
* scores body copy on its own scale, so it is what we design to; WCAG AA stays
|
|
160
|
+
* the compliance floor. Constants are SA98G, verbatim from the reference
|
|
161
|
+
* implementation (Myndex/apca-w3).
|
|
162
|
+
* ------------------------------------------------------------------------- */
|
|
163
|
+
const SA98G = {
|
|
164
|
+
mainTRC: 2.4,
|
|
165
|
+
sRco: 0.2126729,
|
|
166
|
+
sGco: 0.7151522,
|
|
167
|
+
sBco: 0.072175,
|
|
168
|
+
normBG: 0.56,
|
|
169
|
+
normTXT: 0.57,
|
|
170
|
+
revTXT: 0.62,
|
|
171
|
+
revBG: 0.65,
|
|
172
|
+
blkThrs: 0.022,
|
|
173
|
+
blkClmp: 1.414,
|
|
174
|
+
scaleBoW: 1.14,
|
|
175
|
+
scaleWoB: 1.14,
|
|
176
|
+
loBoWoffset: 0.027,
|
|
177
|
+
loWoBoffset: 0.027,
|
|
178
|
+
deltaYmin: 0.0005,
|
|
179
|
+
loClip: 0.1,
|
|
180
|
+
};
|
|
181
|
+
function screenLuminance({ r, g, b }) {
|
|
182
|
+
const channel = (raw) => Math.pow(raw / 255, SA98G.mainTRC);
|
|
183
|
+
return (SA98G.sRco * channel(r) + SA98G.sGco * channel(g) + SA98G.sBco * channel(b));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* APCA lightness contrast (Lc) between text and its background, 0-106.
|
|
187
|
+
*
|
|
188
|
+
* Unlike a WCAG ratio this is polarity-aware: light text on dark needs more
|
|
189
|
+
* separation than dark text on light for the same perceived contrast.
|
|
190
|
+
*/
|
|
191
|
+
function apcaContrast(text, background) {
|
|
192
|
+
const softClamp = (y) => y > SA98G.blkThrs ? y : y + Math.pow(SA98G.blkThrs - y, SA98G.blkClmp);
|
|
193
|
+
const textY = softClamp(screenLuminance(text));
|
|
194
|
+
const backgroundY = softClamp(screenLuminance(background));
|
|
195
|
+
if (Math.abs(backgroundY - textY) < SA98G.deltaYmin)
|
|
196
|
+
return 0;
|
|
197
|
+
let sapc;
|
|
198
|
+
let output;
|
|
199
|
+
if (backgroundY > textY) {
|
|
200
|
+
sapc =
|
|
201
|
+
(Math.pow(backgroundY, SA98G.normBG) - Math.pow(textY, SA98G.normTXT)) *
|
|
202
|
+
SA98G.scaleBoW;
|
|
203
|
+
output = sapc < SA98G.loClip ? 0 : sapc - SA98G.loBoWoffset;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
sapc =
|
|
207
|
+
(Math.pow(backgroundY, SA98G.revBG) - Math.pow(textY, SA98G.revTXT)) *
|
|
208
|
+
SA98G.scaleWoB;
|
|
209
|
+
output = sapc > -0.1 ? 0 : sapc + SA98G.loWoBoffset;
|
|
210
|
+
}
|
|
211
|
+
return Math.abs(output * 100);
|
|
212
|
+
}
|
|
213
|
+
/** Composites a translucent colour over an opaque one. */
|
|
214
|
+
function compositeOver(top, alpha, bottom) {
|
|
215
|
+
return {
|
|
216
|
+
r: top.r * alpha + bottom.r * (1 - alpha),
|
|
217
|
+
g: top.g * alpha + bottom.g * (1 - alpha),
|
|
218
|
+
b: top.b * alpha + bottom.b * (1 - alpha),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The colour a page shows where nothing paints a background: the viewport
|
|
223
|
+
* canvas is white in every browser unless the document sets otherwise.
|
|
224
|
+
*/
|
|
225
|
+
const CANVAS_DEFAULT = { r: 255, g: 255, b: 255 };
|
|
226
|
+
/**
|
|
227
|
+
* Resolves the opaque page colour behind `element` by walking its ancestors and
|
|
228
|
+
* compositing their background colours until they add up to full opacity.
|
|
229
|
+
*
|
|
230
|
+
* @returns null when the answer cannot be known from computed styles — any
|
|
231
|
+
* ancestor painting a `background-image` (a gradient, photo or sprite) while
|
|
232
|
+
* the stack is still translucent, or a background colour in a form we cannot
|
|
233
|
+
* parse. Callers should fall back to a treatment that needs no measurement.
|
|
234
|
+
*/
|
|
235
|
+
function resolveBackdropColor(element) {
|
|
236
|
+
if (typeof window === "undefined")
|
|
237
|
+
return null;
|
|
238
|
+
const layers = [];
|
|
239
|
+
let current = element;
|
|
240
|
+
let coverage = 0;
|
|
241
|
+
while (current && coverage < 1) {
|
|
242
|
+
const computed = window.getComputedStyle(current);
|
|
243
|
+
// A background-image paints above that element's background-colour, so
|
|
244
|
+
// whatever is underneath stops being knowable from computed styles.
|
|
245
|
+
if (computed.backgroundImage && computed.backgroundImage !== "none") {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const parsed = parseCssColor(computed.backgroundColor);
|
|
249
|
+
if (!parsed)
|
|
250
|
+
return null;
|
|
251
|
+
if (parsed.alpha > 0) {
|
|
252
|
+
layers.push(parsed);
|
|
253
|
+
coverage += parsed.alpha * (1 - coverage);
|
|
254
|
+
}
|
|
255
|
+
current = current.parentElement;
|
|
256
|
+
}
|
|
257
|
+
// Fold from the bottom layer up: the last one collected is the outermost.
|
|
258
|
+
let result = CANVAS_DEFAULT;
|
|
259
|
+
for (let index = layers.length - 1; index >= 0; index -= 1) {
|
|
260
|
+
result = compositeOver(layers[index].rgb, layers[index].alpha, result);
|
|
261
|
+
}
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
/** Which mode reads against a page: dark ink on a light page, and the reverse. */
|
|
265
|
+
function pickChromeMode(backdrop) {
|
|
266
|
+
return relativeLuminance(backdrop) >= PAGE_TONE_CROSSOVER ? "light" : "dark";
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Whether a one-line label on this page needs a stroke around its glyphs.
|
|
270
|
+
*
|
|
271
|
+
* A card can take a surface where the ink runs out; a bare label sitting
|
|
272
|
+
* directly on the customer's page cannot, and on the mid-tone band the ink
|
|
273
|
+
* alone does not reach even the label bar. A stroke in the opposite mode's ink
|
|
274
|
+
* gives each glyph its own local polarity without painting a fill behind it,
|
|
275
|
+
* which is the treatment a filled chip was rejected for.
|
|
276
|
+
*/
|
|
277
|
+
function needsStroke(mode, backdrop) {
|
|
278
|
+
const ink = hexToRgb(STUDIO_CHROME_MODES[mode].ink);
|
|
279
|
+
if (!ink)
|
|
280
|
+
return false;
|
|
281
|
+
return apcaContrast(ink, backdrop) < LC_CONTENT_TEXT;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Whether chrome on this page needs its mode's surface behind it.
|
|
285
|
+
*
|
|
286
|
+
* True only where the mode's own secondary ink cannot reach the body-text bar
|
|
287
|
+
* on the page itself. That is the mid-tone band: a mid grey sits far from both
|
|
288
|
+
* ends of the lightness range, so neither dark nor light ink separates from it
|
|
289
|
+
* enough to read. Everywhere else the chrome stays surfaceless, directly on the
|
|
290
|
+
* page.
|
|
291
|
+
*/
|
|
292
|
+
function needsSurface(mode, backdrop) {
|
|
293
|
+
const secondary = hexToRgb(STUDIO_CHROME_MODES[mode].secondary);
|
|
294
|
+
if (!secondary)
|
|
295
|
+
return false;
|
|
296
|
+
return apcaContrast(secondary, backdrop) < LC_BODY_TEXT;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export { LC_BODY_TEXT, LC_CONTENT_TEXT, STUDIO_CHROME_MODES, apcaContrast, hexToRgb, needsStroke, needsSurface, parseCssColor, pickChromeMode, relativeLuminance, resolveBackdropColor };
|
|
300
|
+
//# sourceMappingURL=copy-color.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-color.util.js","sources":["../../src/utils/copy-color.util.ts"],"sourcesContent":["/**\n * Colour for Studio chrome that renders inside the customer's page.\n *\n * The chrome has no surface of its own, so its colour cannot be fixed: the page\n * behind it may be anything. It resolves the page colour and picks one of two\n * modes — light mode for a light page, dark mode for a dark one. Each mode is a\n * set of Venus tokens, so the chrome looks like a Studio component rather than\n * something tinted to match the page.\n *\n * Two modes and nothing in between is deliberate. An earlier version tinted the\n * ink towards the page's own hue family, which cost contrast — a tint always\n * sits inside the extreme it is derived from — and stopped looking like Venus.\n *\n * Where even the right mode cannot carry the text — a mid-tone page, far from\n * both ends of the lightness range, where no ink reaches the readable bar — the\n * chrome takes that mode's surface instead. That is the only case a surface\n * appears.\n */\n\n/** An opaque colour in sRGB, channels 0-255. */\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\n/** Light mode for a light page, dark mode for a dark one. */\nexport type StudioChromeMode = \"light\" | \"dark\";\n\n/**\n * The Venus tokens each mode is built from:\n * `--color-font-black` / `--color-font-white` for primary ink,\n * `--color-font-text-secondary-text-tarmac-grey-n-700` /\n * `--color-bg-colors-milkybar-white-n-5` for secondary,\n * `--color-bg-colors-pure-white` / `--color-brand-black-base` for the surface,\n * `--color-bg-colors-dolphin-grey-n-200` for the light surface's edge, and\n * `--color-bg-colors-tulip-purple-p-5` for the emphasised surface in light mode.\n * Dark mode has no Venus counterpart for that last one — Venus is a light-mode\n * system — so it is brand purple at 25% over the dark surface, the strength at\n * which the tint reads against a plain card without competing with the copy.\n */\nexport const STUDIO_CHROME_MODES = {\n light: {\n ink: \"#222222\",\n secondary: \"#475161\",\n surface: \"#ffffff\",\n surfaceEdge: \"#dde3ee\",\n emphasisSurface: \"#f9f8ff\",\n },\n dark: {\n ink: \"#ffffff\",\n secondary: \"#f7f9fc\",\n surface: \"#222222\",\n surfaceEdge: \"rgba(255, 255, 255, 0.2)\",\n emphasisSurface: \"#353153\",\n },\n} as const;\n\n/** WCAG AA for normal-size text — the compliance floor. */\nexport const AA_CONTRAST = 4.5;\n\n/** APCA minimum for a column of body text. Lc 90 is the preferred level. */\nexport const LC_BODY_TEXT = 75;\n\n/** APCA minimum for shorter content text that is not body copy — a label. */\nexport const LC_CONTENT_TEXT = 60;\n\n/**\n * Page luminance either side of which the mode flips. Sits at the crossover\n * where dark and light ink reach equal contrast against the page.\n */\nconst PAGE_TONE_CROSSOVER = 0.18;\n\nconst HEX_PATTERN = /^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i;\n\n/**\n * Matches the `rgb()` / `rgba()` serialisations `getComputedStyle` returns for\n * `background-color`. Anything else (a modern `oklch()` / `color()` form, say)\n * fails to parse and is treated as unresolvable, which drops the caller onto\n * the treatment that needs no measurement rather than onto a guess.\n */\nconst RGB_PATTERN =\n /^rgba?\\(\\s*([\\d.]+)[,\\s]+([\\d.]+)[,\\s]+([\\d.]+)(?:\\s*[,/]\\s*([\\d.]+)(%?))?\\s*\\)$/i;\n\n/** Parses `#rrggbb` into channels. Returns null for any other form. */\nexport function hexToRgb(hex: string): Rgb | null {\n const match = HEX_PATTERN.exec(hex.trim());\n if (!match) return null;\n return {\n r: parseInt(match[1], 16),\n g: parseInt(match[2], 16),\n b: parseInt(match[3], 16),\n };\n}\n\nconst TRANSPARENT = { rgb: { r: 0, g: 0, b: 0 }, alpha: 0 };\n\n/**\n * Normalises any colour the browser accepts by painting one pixel of it and\n * reading the pixel back.\n *\n * `getComputedStyle` returns the modern colour syntaxes verbatim rather than\n * resolving them to `rgb()` — `oklch()`, `oklab()`, `lab()`, `lch()` and\n * `color()` all come back as written, and `color-mix()` computes to `oklab()`.\n * Tailwind v4's default palette is oklch, so without this a large share of\n * customer pages cannot be measured at all. The older trick of round-tripping\n * through `ctx.fillStyle` no longer normalises anything; only the pixel does.\n */\nfunction paintedColor(value: string): { rgb: Rgb; alpha: number } | null {\n if (typeof document === \"undefined\") return null;\n try {\n const canvas = document.createElement(\"canvas\");\n const context = (canvas as HTMLCanvasElement).getContext?.(\"2d\", {\n willReadFrequently: true,\n });\n if (!context) return null;\n\n // Assigning an unparseable value to fillStyle is a silent no-op: it keeps\n // whatever was there. Without this check an unreadable colour would come\n // back as the previous fill — opaque black — which is a confident wrong\n // answer where the honest one is \"unknown\". Probe with two different\n // sentinels so a value that genuinely IS the sentinel is not mistaken for\n // a rejection.\n context.fillStyle = \"#000000\";\n context.fillStyle = value;\n const acceptedAsBlack = context.fillStyle !== \"#000000\";\n context.fillStyle = \"#ffffff\";\n context.fillStyle = value;\n if (!acceptedAsBlack && context.fillStyle === \"#ffffff\") return null;\n\n context.clearRect(0, 0, 1, 1);\n context.fillRect(0, 0, 1, 1);\n const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;\n return { rgb: { r, g, b }, alpha: a / 255 };\n } catch {\n // Canvas can be unavailable or refuse readback (privacy settings). Not\n // knowing is a supported answer; guessing is not.\n return null;\n }\n}\n\n/**\n * Parses a computed colour value into channels plus alpha.\n *\n * @returns null when the value cannot be read at all, which drops the caller\n * onto a treatment that needs no measurement rather than onto a guess.\n */\nexport function parseCssColor(\n value: string,\n): { rgb: Rgb; alpha: number } | null {\n const trimmed = value.trim();\n // An empty computed value means nothing is painted here, which is\n // transparent — distinct from a value we could not read.\n if (trimmed === \"\" || trimmed === \"transparent\") return TRANSPARENT;\n\n const match = RGB_PATTERN.exec(trimmed);\n if (!match) return paintedColor(trimmed);\n\n const rawAlpha = match[4] === undefined ? 1 : Number(match[4]);\n const alpha = match[5] === \"%\" ? rawAlpha / 100 : rawAlpha;\n return {\n rgb: { r: Number(match[1]), g: Number(match[2]), b: Number(match[3]) },\n alpha: Number.isFinite(alpha) ? Math.min(Math.max(alpha, 0), 1) : 1,\n };\n}\n\n/** WCAG relative luminance, 0 (black) to 1 (white). */\nexport function relativeLuminance({ r, g, b }: Rgb): number {\n const channel = (raw: number): number => {\n const srgb = raw / 255;\n return srgb <= 0.04045\n ? srgb / 12.92\n : Math.pow((srgb + 0.055) / 1.055, 2.4);\n };\n return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);\n}\n\n/** WCAG contrast ratio between two opaque colours, 1 to 21. */\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const luminanceA = relativeLuminance(a);\n const luminanceB = relativeLuminance(b);\n const lighter = Math.max(luminanceA, luminanceB);\n const darker = Math.min(luminanceA, luminanceB);\n return (lighter + 0.05) / (darker + 0.05);\n}\n\n/* ---------------------------------------------------------------------------\n * Perceptual contrast (APCA).\n *\n * WCAG 2's ratio is only perceptually accurate near the middle of the lightness\n * range, which is exactly where this chrome keeps landing — a page that passes\n * AA at 4.5:1 can still read as washed out. APCA holds across the range and\n * scores body copy on its own scale, so it is what we design to; WCAG AA stays\n * the compliance floor. Constants are SA98G, verbatim from the reference\n * implementation (Myndex/apca-w3).\n * ------------------------------------------------------------------------- */\n\nconst SA98G = {\n mainTRC: 2.4,\n sRco: 0.2126729,\n sGco: 0.7151522,\n sBco: 0.072175,\n normBG: 0.56,\n normTXT: 0.57,\n revTXT: 0.62,\n revBG: 0.65,\n blkThrs: 0.022,\n blkClmp: 1.414,\n scaleBoW: 1.14,\n scaleWoB: 1.14,\n loBoWoffset: 0.027,\n loWoBoffset: 0.027,\n deltaYmin: 0.0005,\n loClip: 0.1,\n};\n\nfunction screenLuminance({ r, g, b }: Rgb): number {\n const channel = (raw: number): number => Math.pow(raw / 255, SA98G.mainTRC);\n return (\n SA98G.sRco * channel(r) + SA98G.sGco * channel(g) + SA98G.sBco * channel(b)\n );\n}\n\n/**\n * APCA lightness contrast (Lc) between text and its background, 0-106.\n *\n * Unlike a WCAG ratio this is polarity-aware: light text on dark needs more\n * separation than dark text on light for the same perceived contrast.\n */\nexport function apcaContrast(text: Rgb, background: Rgb): number {\n const softClamp = (y: number): number =>\n y > SA98G.blkThrs ? y : y + Math.pow(SA98G.blkThrs - y, SA98G.blkClmp);\n const textY = softClamp(screenLuminance(text));\n const backgroundY = softClamp(screenLuminance(background));\n if (Math.abs(backgroundY - textY) < SA98G.deltaYmin) return 0;\n\n let sapc: number;\n let output: number;\n if (backgroundY > textY) {\n sapc =\n (Math.pow(backgroundY, SA98G.normBG) - Math.pow(textY, SA98G.normTXT)) *\n SA98G.scaleBoW;\n output = sapc < SA98G.loClip ? 0 : sapc - SA98G.loBoWoffset;\n } else {\n sapc =\n (Math.pow(backgroundY, SA98G.revBG) - Math.pow(textY, SA98G.revTXT)) *\n SA98G.scaleWoB;\n output = sapc > -SA98G.loClip ? 0 : sapc + SA98G.loWoBoffset;\n }\n return Math.abs(output * 100);\n}\n\n/** Composites a translucent colour over an opaque one. */\nfunction compositeOver(top: Rgb, alpha: number, bottom: Rgb): Rgb {\n return {\n r: top.r * alpha + bottom.r * (1 - alpha),\n g: top.g * alpha + bottom.g * (1 - alpha),\n b: top.b * alpha + bottom.b * (1 - alpha),\n };\n}\n\n/**\n * The colour a page shows where nothing paints a background: the viewport\n * canvas is white in every browser unless the document sets otherwise.\n */\nconst CANVAS_DEFAULT: Rgb = { r: 255, g: 255, b: 255 };\n\n/**\n * Resolves the opaque page colour behind `element` by walking its ancestors and\n * compositing their background colours until they add up to full opacity.\n *\n * @returns null when the answer cannot be known from computed styles — any\n * ancestor painting a `background-image` (a gradient, photo or sprite) while\n * the stack is still translucent, or a background colour in a form we cannot\n * parse. Callers should fall back to a treatment that needs no measurement.\n */\nexport function resolveBackdropColor(element: Element): Rgb | null {\n if (typeof window === \"undefined\") return null;\n\n const layers: Array<{ rgb: Rgb; alpha: number }> = [];\n let current: Element | null = element;\n let coverage = 0;\n\n while (current && coverage < 1) {\n const computed = window.getComputedStyle(current);\n\n // A background-image paints above that element's background-colour, so\n // whatever is underneath stops being knowable from computed styles.\n if (computed.backgroundImage && computed.backgroundImage !== \"none\") {\n return null;\n }\n\n const parsed = parseCssColor(computed.backgroundColor);\n if (!parsed) return null;\n\n if (parsed.alpha > 0) {\n layers.push(parsed);\n coverage += parsed.alpha * (1 - coverage);\n }\n current = current.parentElement;\n }\n\n // Fold from the bottom layer up: the last one collected is the outermost.\n let result = CANVAS_DEFAULT;\n for (let index = layers.length - 1; index >= 0; index -= 1) {\n result = compositeOver(layers[index].rgb, layers[index].alpha, result);\n }\n return result;\n}\n\n/** Which mode reads against a page: dark ink on a light page, and the reverse. */\nexport function pickChromeMode(backdrop: Rgb): StudioChromeMode {\n return relativeLuminance(backdrop) >= PAGE_TONE_CROSSOVER ? \"light\" : \"dark\";\n}\n\n/**\n * Whether a one-line label on this page needs a stroke around its glyphs.\n *\n * A card can take a surface where the ink runs out; a bare label sitting\n * directly on the customer's page cannot, and on the mid-tone band the ink\n * alone does not reach even the label bar. A stroke in the opposite mode's ink\n * gives each glyph its own local polarity without painting a fill behind it,\n * which is the treatment a filled chip was rejected for.\n */\nexport function needsStroke(mode: StudioChromeMode, backdrop: Rgb): boolean {\n const ink = hexToRgb(STUDIO_CHROME_MODES[mode].ink);\n if (!ink) return false;\n return apcaContrast(ink, backdrop) < LC_CONTENT_TEXT;\n}\n\n/**\n * Whether chrome on this page needs its mode's surface behind it.\n *\n * True only where the mode's own secondary ink cannot reach the body-text bar\n * on the page itself. That is the mid-tone band: a mid grey sits far from both\n * ends of the lightness range, so neither dark nor light ink separates from it\n * enough to read. Everywhere else the chrome stays surfaceless, directly on the\n * page.\n */\nexport function needsSurface(mode: StudioChromeMode, backdrop: Rgb): boolean {\n const secondary = hexToRgb(STUDIO_CHROME_MODES[mode].secondary);\n if (!secondary) return false;\n return apcaContrast(secondary, backdrop) < LC_BODY_TEXT;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;AAYH;;;;;;;;;;;AAWG;AACI,MAAM,mBAAmB,GAAG;AACjC,IAAA,KAAK,EAAE;AACL,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,SAAS,EAA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,CAAC;IACxE;AACA,IAAA,OAAO,MAAM;AACf;AAEA;AACM,SAAU,cAAc,CAAC,QAAa,EAAA;AAC1C,IAAA,OAAO,iBAAiB,CAAC,QAAQ,CAAC,IAAI,mBAAmB,GAAG,OAAO,GAAG,MAAM;AAC9E;AAEA;;;;;;;;AAQG;AACG,SAAU,WAAW,CAAC,IAAsB,EAAE,QAAa,EAAA;IAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACnD,IAAA,IAAI,CAAC,GAAG;AAAE,QAAA,OAAO,KAAK;IACtB,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,eAAe;AACtD;AAEA;;;;;;;;AAQG;AACG,SAAU,YAAY,CAAC,IAAsB,EAAE,QAAa,EAAA;IAChE,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;AAC/D,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,KAAK;IAC5B,OAAO,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,YAAY;AACzD;;;;"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { NODE_TO_PARENT } from '@contentstack/studio-client';
|
|
2
|
+
import { getConditionHint, getBindingFieldPath, uidToDisplayName } from '@contentstack/studio-internal';
|
|
3
|
+
import { INTERNAL_COMPONENTS_NAMES } from '@contentstack/studio-registry';
|
|
4
|
+
|
|
1
5
|
const shouldRenderSlot = (componentRegistry, parent, nodes, isCompositionBeingEdited) => {
|
|
2
6
|
if (!isCompositionBeingEdited)
|
|
3
7
|
return false;
|
|
@@ -7,6 +11,104 @@ const shouldRenderSlot = (componentRegistry, parent, nodes, isCompositionBeingEd
|
|
|
7
11
|
const isEmpty = nodes.length === 0;
|
|
8
12
|
return isEmpty;
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Placeholder text for an empty slot owned by `parent`, or `undefined` for the
|
|
16
|
+
* plain "Drop Here".
|
|
17
|
+
*
|
|
18
|
+
* Covers the two hints a node can read off itself: the repeater advice, and a
|
|
19
|
+
* condition block's own empty slot. The third case — the single container inside
|
|
20
|
+
* a condition block — is handed down by the block instead; see
|
|
21
|
+
* `getConditionWellHint`.
|
|
22
|
+
*
|
|
23
|
+
* Repeater and condition hints are mutually exclusive by construction — a node
|
|
24
|
+
* cannot be both — so they share the single `hint` channel and need no
|
|
25
|
+
* precedence rule between them.
|
|
26
|
+
*/
|
|
27
|
+
const getSlotHint = (parent) => {
|
|
28
|
+
if (parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&
|
|
29
|
+
parent.metadata?.repeaterBindingFieldType) {
|
|
30
|
+
return "It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.";
|
|
31
|
+
}
|
|
32
|
+
if (parent.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)
|
|
33
|
+
return undefined;
|
|
34
|
+
return getConditionBlockHint(parent);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The hint a condition block hands down to `child` when the child's empty slot is
|
|
38
|
+
* the block's **drop well**, or `undefined` when it is not.
|
|
39
|
+
*
|
|
40
|
+
* A condition block is `display: contents`, so it has no drop area of its own.
|
|
41
|
+
* The well is therefore the block's own slot while the block is empty (handled by
|
|
42
|
+
* `getSlotHint`), and the slot of the single container placed inside it once one
|
|
43
|
+
* has been (typically the Box auto-inserted for modular-block / reference
|
|
44
|
+
* repeaters). Those two are mutually exclusive in time: the moment the Box
|
|
45
|
+
* exists, the block's own slot is filled and stops rendering a placeholder.
|
|
46
|
+
*
|
|
47
|
+
* The block computes this and passes it DOWN, rather than the container looking
|
|
48
|
+
* UP for its block. Elements are memoised on node identity, and editor state is
|
|
49
|
+
* structurally shared: setting the block's condition replaces the block and its
|
|
50
|
+
* ancestors but leaves the container the same object. A container that read the
|
|
51
|
+
* condition off its parent would therefore never re-render and keep the hint it
|
|
52
|
+
* drew before the condition existed. The block always re-renders when anything
|
|
53
|
+
* the hint depends on changes — its own condition, or the container filling —
|
|
54
|
+
* so deriving it there and passing it as a prop keeps the two in step.
|
|
55
|
+
*
|
|
56
|
+
* The rule is positional, not provenance-based: a Box the author dropped in
|
|
57
|
+
* themselves is treated exactly like the auto-inserted one, because its
|
|
58
|
+
* provenance is invisible to the author and should not change what the slot
|
|
59
|
+
* says. Depth stops at one hop — a well is a single slot, so a placeholder
|
|
60
|
+
* nested deeper is not standing in for the block's contents.
|
|
61
|
+
*/
|
|
62
|
+
const getConditionWellHint = (block, child) => {
|
|
63
|
+
if (block.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)
|
|
64
|
+
return undefined;
|
|
65
|
+
// The block must hold exactly this one node. With two empty containers there
|
|
66
|
+
// is no single well, and printing the hint on both would be noise.
|
|
67
|
+
const blockChildren = Object.values(block.slots || {}).flat();
|
|
68
|
+
if (blockChildren.length !== 1 || blockChildren[0]?.uid !== child.uid)
|
|
69
|
+
return undefined;
|
|
70
|
+
// And that node must itself be empty — once real content lands anywhere under
|
|
71
|
+
// the block, no slot beneath it is standing in for the block's contents.
|
|
72
|
+
if (Object.values(child.slots || {}).flat().length > 0)
|
|
73
|
+
return undefined;
|
|
74
|
+
return getConditionBlockHint(block);
|
|
75
|
+
};
|
|
76
|
+
/** The condition a block's drop well describes, as "When …" text. */
|
|
77
|
+
const getConditionBlockHint = (block) => {
|
|
78
|
+
// An `unsupported` hint means a condition IS set but cannot be described.
|
|
79
|
+
// "Drop Here" on its own is already a complete, correct message, so the well
|
|
80
|
+
// says nothing extra rather than guessing.
|
|
81
|
+
//
|
|
82
|
+
// `conditionDisplay` carries the display names resolved when the condition was
|
|
83
|
+
// authored. The helper falls back to the stored uids when it is absent, which
|
|
84
|
+
// is the permanent case for conditions written by the CLI or the API.
|
|
85
|
+
const hint = getConditionHint(block.metadata?.condition, block.metadata?.conditionDisplay, {
|
|
86
|
+
subject: getRepeaterFieldName(NODE_TO_PARENT.get(block)),
|
|
87
|
+
});
|
|
88
|
+
return hint?.kind === "info" ? `${hint.prefix} ${hint.value}` : undefined;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The field a Repeater iterates, as a display name — `hero_sections` → "Hero
|
|
92
|
+
* Sections".
|
|
93
|
+
*
|
|
94
|
+
* Recovers the subject of a condition whose own binding has collapsed into its
|
|
95
|
+
* value: a repeater-scoped condition's `path` is rewritten to the branch, but the
|
|
96
|
+
* Repeater it sits in still names the field. Used only as a fallback, so a name
|
|
97
|
+
* stamped at author time always wins.
|
|
98
|
+
*
|
|
99
|
+
* De-uid-ified deliberately, unlike a subject read from the condition's own
|
|
100
|
+
* binding. This is the same string the Repeater's own hint renders one row up in
|
|
101
|
+
* Layers ("Iterates Hero Sections"), so showing it raw here would make the two
|
|
102
|
+
* disagree about the same field.
|
|
103
|
+
*/
|
|
104
|
+
const getRepeaterFieldName = (node) => {
|
|
105
|
+
if (node?.type !== INTERNAL_COMPONENTS_NAMES.REPEATER)
|
|
106
|
+
return undefined;
|
|
107
|
+
const binding = node.props?.items?.binding;
|
|
108
|
+
const path = getBindingFieldPath(binding);
|
|
109
|
+
const field = path?.split(".").pop();
|
|
110
|
+
return field ? uidToDisplayName(field) : undefined;
|
|
111
|
+
};
|
|
10
112
|
|
|
11
|
-
export { shouldRenderSlot };
|
|
113
|
+
export { getConditionWellHint, getSlotHint, shouldRenderSlot };
|
|
12
114
|
//# sourceMappingURL=renderer.util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.util.js","sources":["../../src/utils/renderer.util.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"renderer.util.js","sources":["../../src/utils/renderer.util.ts"],"sourcesContent":["import { NODE_TO_PARENT } from \"@contentstack/studio-client\";\nimport type {\n Condition,\n ConditionDisplay,\n Node,\n} from \"@contentstack/studio-internal\";\nimport {\n getBindingFieldPath,\n getConditionHint,\n uidToDisplayName,\n} from \"@contentstack/studio-internal\";\nimport {\n ComponentRegistry,\n INTERNAL_COMPONENTS_NAMES,\n} from \"@contentstack/studio-registry\";\nimport { ReactNode } from \"react\";\n\nexport const shouldRenderSlot = (\n componentRegistry: ComponentRegistry<(props?: any) => ReactNode>,\n parent: Node,\n nodes: Node[],\n isCompositionBeingEdited: boolean,\n) => {\n if (!isCompositionBeingEdited) return false;\n if (!componentRegistry?.hasComponent(parent)) {\n return false;\n }\n const isEmpty = nodes.length === 0;\n\n return isEmpty;\n};\n\n/**\n * Placeholder text for an empty slot owned by `parent`, or `undefined` for the\n * plain \"Drop Here\".\n *\n * Covers the two hints a node can read off itself: the repeater advice, and a\n * condition block's own empty slot. The third case — the single container inside\n * a condition block — is handed down by the block instead; see\n * `getConditionWellHint`.\n *\n * Repeater and condition hints are mutually exclusive by construction — a node\n * cannot be both — so they share the single `hint` channel and need no\n * precedence rule between them.\n */\nexport const getSlotHint = (parent: Node): string | undefined => {\n if (\n parent.type === INTERNAL_COMPONENTS_NAMES.REPEATER &&\n parent.metadata?.repeaterBindingFieldType\n ) {\n return \"It is recommended to drop a condition block inside the repeater to handle Modular Blocks & References.\";\n }\n\n if (parent.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)\n return undefined;\n\n return getConditionBlockHint(parent);\n};\n\n/**\n * The hint a condition block hands down to `child` when the child's empty slot is\n * the block's **drop well**, or `undefined` when it is not.\n *\n * A condition block is `display: contents`, so it has no drop area of its own.\n * The well is therefore the block's own slot while the block is empty (handled by\n * `getSlotHint`), and the slot of the single container placed inside it once one\n * has been (typically the Box auto-inserted for modular-block / reference\n * repeaters). Those two are mutually exclusive in time: the moment the Box\n * exists, the block's own slot is filled and stops rendering a placeholder.\n *\n * The block computes this and passes it DOWN, rather than the container looking\n * UP for its block. Elements are memoised on node identity, and editor state is\n * structurally shared: setting the block's condition replaces the block and its\n * ancestors but leaves the container the same object. A container that read the\n * condition off its parent would therefore never re-render and keep the hint it\n * drew before the condition existed. The block always re-renders when anything\n * the hint depends on changes — its own condition, or the container filling —\n * so deriving it there and passing it as a prop keeps the two in step.\n *\n * The rule is positional, not provenance-based: a Box the author dropped in\n * themselves is treated exactly like the auto-inserted one, because its\n * provenance is invisible to the author and should not change what the slot\n * says. Depth stops at one hop — a well is a single slot, so a placeholder\n * nested deeper is not standing in for the block's contents.\n */\nexport const getConditionWellHint = (\n block: Node,\n child: Node,\n): string | undefined => {\n if (block.type !== INTERNAL_COMPONENTS_NAMES.CONDITION_BLOCK)\n return undefined;\n\n // The block must hold exactly this one node. With two empty containers there\n // is no single well, and printing the hint on both would be noise.\n const blockChildren = Object.values(block.slots || {}).flat();\n if (blockChildren.length !== 1 || blockChildren[0]?.uid !== child.uid)\n return undefined;\n\n // And that node must itself be empty — once real content lands anywhere under\n // the block, no slot beneath it is standing in for the block's contents.\n if (Object.values(child.slots || {}).flat().length > 0) return undefined;\n\n return getConditionBlockHint(block);\n};\n\n/** The condition a block's drop well describes, as \"When …\" text. */\nconst getConditionBlockHint = (block: Node): string | undefined => {\n // An `unsupported` hint means a condition IS set but cannot be described.\n // \"Drop Here\" on its own is already a complete, correct message, so the well\n // says nothing extra rather than guessing.\n //\n // `conditionDisplay` carries the display names resolved when the condition was\n // authored. The helper falls back to the stored uids when it is absent, which\n // is the permanent case for conditions written by the CLI or the API.\n const hint = getConditionHint(\n block.metadata?.condition as Condition | undefined,\n block.metadata?.conditionDisplay as ConditionDisplay | undefined,\n {\n subject: getRepeaterFieldName(\n NODE_TO_PARENT.get(block) as Node | undefined,\n ),\n },\n );\n return hint?.kind === \"info\" ? `${hint.prefix} ${hint.value}` : undefined;\n};\n\n/**\n * The field a Repeater iterates, as a display name — `hero_sections` → \"Hero\n * Sections\".\n *\n * Recovers the subject of a condition whose own binding has collapsed into its\n * value: a repeater-scoped condition's `path` is rewritten to the branch, but the\n * Repeater it sits in still names the field. Used only as a fallback, so a name\n * stamped at author time always wins.\n *\n * De-uid-ified deliberately, unlike a subject read from the condition's own\n * binding. This is the same string the Repeater's own hint renders one row up in\n * Layers (\"Iterates Hero Sections\"), so showing it raw here would make the two\n * disagree about the same field.\n */\nconst getRepeaterFieldName = (node?: Node): string | undefined => {\n if (node?.type !== INTERNAL_COMPONENTS_NAMES.REPEATER) return undefined;\n const binding = (node.props?.items as { binding?: any } | undefined)?.binding;\n const path = getBindingFieldPath(binding);\n const field = path?.split(\".\").pop();\n return field ? uidToDisplayName(field) : undefined;\n};\n"],"names":[],"mappings":";;;;AAiBO,MAAM,gBAAgB,GAAG,CAC9B,iBAAgE,EAChE,MAAY,EACZ,KAAa,EACb,wBAAiC,KAC/B;AACF,IAAA,IAAI,CAAC,wBAAwB;AAAE,QAAA,OAAO,KAAK;IAC3C,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE;AAC5C,QAAA,OAAO,KAAK;IACd;AACA,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC;AAElC,IAAA,OAAO,OAAO;AAChB;AAEA;;;;;;;;;;;;AAYG;AACI,MAAM,WAAW,GAAG,CAAC,MAAY,KAAwB;AAC9D,IAAA,IACE,MAAM,CAAC,IAAI,KAAK,yBAAyB,CAAC,QAAQ;AAClD,QAAA,MAAM,CAAC,QAAQ,EAAE,wBAAwB,EACzC;AACA,QAAA,OAAO,wGAAwG;IACjH;AAEA,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,yBAAyB,CAAC,eAAe;AAC3D,QAAA,OAAO,SAAS;AAElB,IAAA,OAAO,qBAAqB,CAAC,MAAM,CAAC;AACtC;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;MACU,oBAAoB,GAAG,CAClC,KAAW,EACX,KAAW,KACW;AACtB,IAAA,IAAI,KAAK,CAAC,IAAI,KAAK,yBAAyB,CAAC,eAAe;AAC1D,QAAA,OAAO,SAAS;;;AAIlB,IAAA,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,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;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/studio-react-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Contains all logic of editing for react based environment",
|
|
5
5
|
"author": "RavenColEvol <ravilamkoti@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/contentstack/composable-studio-sdk#readme",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@contentstack/common-config": "^1.2.
|
|
41
|
+
"@contentstack/common-config": "^1.2.5",
|
|
42
42
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
43
43
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
44
44
|
"@rollup/plugin-terser": "^1.0.0",
|
|
@@ -58,17 +58,16 @@
|
|
|
58
58
|
"typescript": "^5.2.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@contentstack/studio-client": "^
|
|
62
|
-
"@contentstack/studio-core": "^1.4.
|
|
63
|
-
"@contentstack/studio-internal": "^1.
|
|
64
|
-
"@contentstack/studio-messenger": "^3.
|
|
65
|
-
"@contentstack/studio-react-components": "^
|
|
66
|
-
"@contentstack/studio-registry": "^
|
|
61
|
+
"@contentstack/studio-client": "^4.0.0",
|
|
62
|
+
"@contentstack/studio-core": "^1.4.3",
|
|
63
|
+
"@contentstack/studio-internal": "^1.8.0",
|
|
64
|
+
"@contentstack/studio-messenger": "^3.2.0",
|
|
65
|
+
"@contentstack/studio-react-components": "^2.0.0",
|
|
66
|
+
"@contentstack/studio-registry": "^2.0.0",
|
|
67
67
|
"classnames": "^2.5.1",
|
|
68
68
|
"goober": "^2.1.16",
|
|
69
69
|
"immer": "^10.1.1",
|
|
70
70
|
"lodash-es": "^4.18.1",
|
|
71
71
|
"react-error-boundary": "^6.0.0"
|
|
72
|
-
}
|
|
73
|
-
"gitHead": "1e35733997b7c0e030296d3ebcf053aee69151a3"
|
|
72
|
+
}
|
|
74
73
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Contentstack
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|