@superblocksteam/library 2.0.162-next.2 → 2.0.163-next.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/{early-console-buffer-BJWsc4E3.js → early-console-buffer-DMR1SCsN.js} +3 -10
- package/dist/early-console-buffer-DMR1SCsN.js.map +1 -0
- package/dist/jsx-dev-runtime/index.js +2 -2
- package/dist/{jsx-wrapper-CAKd0FsI.js → jsx-wrapper-BGGZod5X.js} +2 -2
- package/dist/{jsx-wrapper-CAKd0FsI.js.map → jsx-wrapper-BGGZod5X.js.map} +1 -1
- package/dist/lib/index.d.ts +30 -218
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +102 -1256
- package/dist/lib/index.js.map +1 -1
- package/dist/{logs-DwKJqoRc.js → logs-CUUgkcJf.js} +2 -2
- package/dist/{logs-DwKJqoRc.js.map → logs-CUUgkcJf.js.map} +1 -1
- package/dist/{root-store-DFc-KUI6.js → root-store-CtsStoaR.js} +40 -298
- package/dist/root-store-CtsStoaR.js.map +1 -0
- package/dist/{sdk-api-discovery-ChkM2xTd.js → sdk-api-discovery-DdbqEI70.js} +2 -2
- package/dist/{sdk-api-discovery-ChkM2xTd.js.map → sdk-api-discovery-DdbqEI70.js.map} +1 -1
- package/dist/{utils-Blrvh8kW.js → utils-DXaAwgS_.js} +2 -2
- package/dist/{utils-Blrvh8kW.js.map → utils-DXaAwgS_.js.map} +1 -1
- package/package.json +8 -10
- package/dist/early-console-buffer-BJWsc4E3.js.map +0 -1
- package/dist/root-store-DFc-KUI6.js.map +0 -1
package/dist/lib/index.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { n as consoleLogAttributes, t as LibraryEarlyConsoleBuffer } from "../early-console-buffer-
|
|
2
|
-
import { A as Section, C as iframeMessageHandler, D as createManagedPropsList, E as isEditMode,
|
|
3
|
-
import { n as initTracerProviderWithOrigin } from "../utils-
|
|
4
|
-
import { r as updateSdkApiSourceCode, t as discoverAndRegisterSdkApis } from "../sdk-api-discovery-
|
|
5
|
-
import { a as FixWithClarkButton, c as ErrorContent, d as ErrorMessage$1, f as ErrorStack, g as StyledClarkIcon, h as SecondaryButton, i as getWidgetRectAnchorName, l as ErrorDetails, m as ErrorTitle, n as useJSXContext, o as ActionsContainer, p as ErrorSummary, r as getWidgetAnchorName, s as ErrorContainer, u as ErrorIconContainer } from "../jsx-wrapper-
|
|
6
|
-
import { action,
|
|
1
|
+
import { n as consoleLogAttributes, t as LibraryEarlyConsoleBuffer } from "../early-console-buffer-DMR1SCsN.js";
|
|
2
|
+
import { A as Section, C as iframeMessageHandler, D as createManagedPropsList, E as isEditMode, O as Prop, S as getParentOrigin, T as sendMessageImmediately, _ as generateId, a as tracker, b as editorBridge, c as resolveById, d as useSuperblocksContext, f as useSuperblocksDataTags, g as embedStore, h as useSuperblocksUser, i as getContextFromTraceHeaders, k as PropsCategory, l as SuperblocksContextProvider, m as useSuperblocksProfiles, n as root_store_default, o as addNewPromise, p as useSuperblocksGroups, r as createIframeSpan, s as rejectById, t as ORCHESTRATOR_EXECUTE_RESPONSE_SIZE_LIMIT_FLAG, u as getAppMode, v as sendNotification, w as isEmbeddedBySuperblocksFirstParty, x as getEditStore, y as colors } from "../root-store-CtsStoaR.js";
|
|
3
|
+
import { n as initTracerProviderWithOrigin } from "../utils-DXaAwgS_.js";
|
|
4
|
+
import { r as updateSdkApiSourceCode, t as discoverAndRegisterSdkApis } from "../sdk-api-discovery-DdbqEI70.js";
|
|
5
|
+
import { a as FixWithClarkButton, c as ErrorContent, d as ErrorMessage$1, f as ErrorStack, g as StyledClarkIcon, h as SecondaryButton, i as getWidgetRectAnchorName, l as ErrorDetails, m as ErrorTitle, n as useJSXContext, o as ActionsContainer, p as ErrorSummary, r as getWidgetAnchorName, s as ErrorContainer, u as ErrorIconContainer } from "../jsx-wrapper-BGGZod5X.js";
|
|
6
|
+
import { action, computed, makeAutoObservable, makeObservable, observable, reaction, when } from "mobx";
|
|
7
7
|
import { UNSAFE_DataRouterContext, generatePath, useLocation, useNavigate, useParams, useRouteError } from "react-router";
|
|
8
|
-
import {
|
|
8
|
+
import { NATIVE_COMPONENT_TYPES, NO_SELECT_ATTRIBUTE, Property, SELECTOR_ID_ATTRIBUTE, SOURCE_ID_ATTRIBUTE, URL_PARAMS, generateSourceId, getBindingIdentifier, getDevServerAuthorizationRejectionReason, hasCompactJwtShape } from "@superblocksteam/library-shared";
|
|
9
9
|
import * as React$1 from "react";
|
|
10
10
|
import React, { Suspense, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { isEqual } from "lodash";
|
|
12
12
|
import { ISocketWithClientAuth, OBS_TAG_APPLICATION_ID, connectWebSocket, createISocketClient } from "@superblocksteam/shared";
|
|
13
13
|
import styled from "styled-components";
|
|
14
|
-
import { AiContextMode, AiGenerationState, ViteMessageKind } from "@superblocksteam/library-shared/types";
|
|
14
|
+
import { AiContextMode, AiGenerationState, ViteMessageKind, normalizeInteractionMode } from "@superblocksteam/library-shared/types";
|
|
15
15
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
import { metrics, trace } from "@opentelemetry/api";
|
|
17
|
-
import defaultTheme from "tailwindcss/defaultTheme";
|
|
18
|
-
import postcss from "postcss";
|
|
19
|
-
import colors from "tailwindcss/colors";
|
|
20
17
|
import { Observer, observer } from "mobx-react-lite";
|
|
21
18
|
import useSWR, { mutate } from "swr";
|
|
22
19
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
@@ -247,7 +244,7 @@ function installDynamicImportErrorReporter(options = {}) {
|
|
|
247
244
|
* Register a component to be used with the framework.
|
|
248
245
|
*
|
|
249
246
|
* @param Component - The React component or HTML element name (e.g., "div") to register. Can be a React functional component, class component, or intrinsic element string.
|
|
250
|
-
* @param propertiesDefinition - The
|
|
247
|
+
* @param propertiesDefinition - The runtime schema for the component's managed properties.
|
|
251
248
|
*
|
|
252
249
|
* @returns A chainable object that provides methods for editor integration (addEditorTemplate and editorConfig).
|
|
253
250
|
*/
|
|
@@ -256,9 +253,6 @@ const registerComponentInternal = (Component, propertiesDefinition) => {
|
|
|
256
253
|
if (!type) throw new Error(`Component must have a name or displayName property, or be a string. Received: ${Component}`);
|
|
257
254
|
const managedProps = createManagedPropsList(propertiesDefinition);
|
|
258
255
|
const isDroppable = !!managedProps.find((p) => p.path === "children" && p.dataType === "jsx");
|
|
259
|
-
root_store_default.onEditorRegistered(() => {
|
|
260
|
-
getEditStore().propertiesPanelManager.setPropertiesDefinition(type, propertiesDefinition);
|
|
261
|
-
});
|
|
262
256
|
root_store_default.componentRegistry.addComponent(type, Component, propertiesDefinition);
|
|
263
257
|
root_store_default.componentRegistry.addManagedProps(type, managedProps ?? []);
|
|
264
258
|
const defaultEditorConfig = {};
|
|
@@ -289,492 +283,7 @@ const registerComponentInternal = (Component, propertiesDefinition) => {
|
|
|
289
283
|
return chainableComponent;
|
|
290
284
|
};
|
|
291
285
|
//#endregion
|
|
292
|
-
//#region src/lib/user-facing/properties-panel/mixins/inline-styles-category.ts
|
|
293
|
-
/**
|
|
294
|
-
* Creates a standardized inline styles section for use in properties panels.
|
|
295
|
-
* This provides a consistent interface for applying inline CSS styles across components.
|
|
296
|
-
*
|
|
297
|
-
* @param options - Configuration options to override defaults
|
|
298
|
-
* @returns A Section with PropsCategory.Styles containing a style prop
|
|
299
|
-
*/
|
|
300
|
-
const inlineStylesCategory = (options = {}) => {
|
|
301
|
-
const styleProp = Prop.any().propertiesPanel({
|
|
302
|
-
label: "Inline Styles",
|
|
303
|
-
controlType: "INLINE_STYLE_BUILDER",
|
|
304
|
-
description: "Custom inline CSS styles",
|
|
305
|
-
isRemovable: true,
|
|
306
|
-
defaultOnAdd: {},
|
|
307
|
-
collapsibleHeader: true,
|
|
308
|
-
...options
|
|
309
|
-
});
|
|
310
|
-
const originalToDefinition = styleProp.toDefinition.bind(styleProp);
|
|
311
|
-
styleProp.toDefinition = function(props) {
|
|
312
|
-
const styleValue = props?.style;
|
|
313
|
-
if (!styleValue || typeof styleValue === "string" && styleValue.trim() === "" || typeof styleValue === "object" && !Array.isArray(styleValue) && Object.keys(styleValue).length === 0) return;
|
|
314
|
-
return originalToDefinition(props);
|
|
315
|
-
};
|
|
316
|
-
return Section.category(PropsCategory.Styles).children({ style: styleProp }).propertiesPanel({ showHeader: false });
|
|
317
|
-
};
|
|
318
|
-
//#endregion
|
|
319
|
-
//#region src/lib/user-facing/properties-panel/mixins/convert-rem-to-pixels.ts
|
|
320
|
-
let cachedRootFontSize = void 0;
|
|
321
|
-
const getRootFontSize = () => {
|
|
322
|
-
if (cachedRootFontSize !== void 0) return cachedRootFontSize;
|
|
323
|
-
if (typeof window !== "undefined" && typeof document !== "undefined") try {
|
|
324
|
-
const rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
|
|
325
|
-
const parsed = parseFloat(rootFontSize);
|
|
326
|
-
if (!isNaN(parsed) && parsed > 0) {
|
|
327
|
-
cachedRootFontSize = parsed;
|
|
328
|
-
return cachedRootFontSize;
|
|
329
|
-
}
|
|
330
|
-
} catch {
|
|
331
|
-
console.error("Error getting root font size, using fallback of 16px");
|
|
332
|
-
}
|
|
333
|
-
return 16;
|
|
334
|
-
};
|
|
335
|
-
/**
|
|
336
|
-
* Converts CSS values with rem units to pixel values.
|
|
337
|
-
* Uses the actual computed root font size from the browser.
|
|
338
|
-
*
|
|
339
|
-
* @param value - CSS value (e.g., "1rem", "16px", "0.25rem")
|
|
340
|
-
* @returns Converted value in pixels if input was in rem, otherwise returns original value
|
|
341
|
-
*
|
|
342
|
-
* @example
|
|
343
|
-
* convertRemToPixels("1rem") // "16px" (assuming default root font size)
|
|
344
|
-
* convertRemToPixels("0.5rem") // "8px"
|
|
345
|
-
* convertRemToPixels("16px") // "16px" (unchanged)
|
|
346
|
-
* convertRemToPixels("100%") // "100%" (unchanged)
|
|
347
|
-
*/
|
|
348
|
-
function convertRemToPixels(value) {
|
|
349
|
-
const remMatch = value.match(/^([\d.]+)rem$/);
|
|
350
|
-
if (!remMatch) return value;
|
|
351
|
-
const pixelValue = parseFloat(remMatch[1]) * getRootFontSize();
|
|
352
|
-
return `${Math.abs(pixelValue - Math.round(pixelValue)) < 1e-4 ? Math.round(pixelValue) : pixelValue}px`;
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
//#region src/lib/user-facing/properties-panel/mixins/extract-variables.ts
|
|
356
|
-
async function extractCSSVariablesFromContent(cssContent) {
|
|
357
|
-
const variables = {
|
|
358
|
-
root: {},
|
|
359
|
-
dark: {},
|
|
360
|
-
theme: {}
|
|
361
|
-
};
|
|
362
|
-
try {
|
|
363
|
-
const extractVariablesPlugin = () => {
|
|
364
|
-
return {
|
|
365
|
-
postcssPlugin: "extract-variables",
|
|
366
|
-
Once(root) {
|
|
367
|
-
root.walkRules((rule) => {
|
|
368
|
-
if (rule.selector === ":root") rule.walkDecls((decl) => {
|
|
369
|
-
if (decl.prop.startsWith("--")) variables.root[decl.prop] = decl.value;
|
|
370
|
-
});
|
|
371
|
-
else if (rule.selector === ".dark") rule.walkDecls((decl) => {
|
|
372
|
-
if (decl.prop.startsWith("--")) variables.dark[decl.prop] = decl.value;
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
root.walkAtRules("theme", (atRule) => {
|
|
376
|
-
if (atRule.params === "inline") atRule.walkDecls((decl) => {
|
|
377
|
-
if (decl.prop.startsWith("--")) variables.theme[decl.prop] = decl.value;
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
};
|
|
383
|
-
extractVariablesPlugin.postcssPlugin = "extract-variables";
|
|
384
|
-
await postcss([extractVariablesPlugin()]).process(cssContent, { from: void 0 });
|
|
385
|
-
return variables;
|
|
386
|
-
} catch (error) {
|
|
387
|
-
throw new Error(`Failed to extract CSS variables: ${error instanceof Error ? error.message : String(error)}`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
async function extractCSSVariables() {
|
|
391
|
-
const styleSheets = Array.from(document.styleSheets);
|
|
392
|
-
let cssContent = "";
|
|
393
|
-
for (const sheet of styleSheets) try {
|
|
394
|
-
const text = Array.from(sheet.cssRules || []).map((rule) => rule.cssText).join("\n");
|
|
395
|
-
cssContent += text;
|
|
396
|
-
} catch (e) {
|
|
397
|
-
console.warn("Cannot access stylesheet:", sheet.href, e);
|
|
398
|
-
}
|
|
399
|
-
return extractCSSVariablesFromContent(cssContent);
|
|
400
|
-
}
|
|
401
|
-
function getCachedCSSVariables() {
|
|
402
|
-
return globalThis.__CSS_VARIABLES_CACHE__ || null;
|
|
403
|
-
}
|
|
404
|
-
async function initializeCSSVariables() {
|
|
405
|
-
if (globalThis.__CSS_VARIABLES_CACHE__) return globalThis.__CSS_VARIABLES_CACHE__;
|
|
406
|
-
if (globalThis.__CSS_VARIABLES_LOADING__ && globalThis.__CSS_VARIABLES_PROMISE__) return globalThis.__CSS_VARIABLES_PROMISE__;
|
|
407
|
-
globalThis.__CSS_VARIABLES_LOADING__ = true;
|
|
408
|
-
globalThis.__CSS_VARIABLES_PROMISE__ = extractCSSVariables().then((variables) => {
|
|
409
|
-
globalThis.__CSS_VARIABLES_CACHE__ = variables;
|
|
410
|
-
globalThis.__CSS_VARIABLES_LOADING__ = false;
|
|
411
|
-
return variables;
|
|
412
|
-
}).catch((error) => {
|
|
413
|
-
console.error("Failed to extract CSS variables:", error);
|
|
414
|
-
const fallback = {
|
|
415
|
-
root: {},
|
|
416
|
-
dark: {},
|
|
417
|
-
theme: {}
|
|
418
|
-
};
|
|
419
|
-
globalThis.__CSS_VARIABLES_CACHE__ = fallback;
|
|
420
|
-
globalThis.__CSS_VARIABLES_LOADING__ = false;
|
|
421
|
-
return fallback;
|
|
422
|
-
});
|
|
423
|
-
return globalThis.__CSS_VARIABLES_PROMISE__;
|
|
424
|
-
}
|
|
425
|
-
//#endregion
|
|
426
|
-
//#region src/lib/user-facing/properties-panel/mixins/style-tokens-size.ts
|
|
427
|
-
let cachedSizePresets = null;
|
|
428
|
-
const height = defaultTheme.height({
|
|
429
|
-
theme: () => "",
|
|
430
|
-
colors
|
|
431
|
-
});
|
|
432
|
-
const width = defaultTheme.width({
|
|
433
|
-
theme: () => "",
|
|
434
|
-
colors
|
|
435
|
-
});
|
|
436
|
-
const minWidth = defaultTheme.minWidth({
|
|
437
|
-
theme: () => "",
|
|
438
|
-
colors
|
|
439
|
-
});
|
|
440
|
-
const maxWidth = defaultTheme.maxWidth({
|
|
441
|
-
theme: () => "",
|
|
442
|
-
colors
|
|
443
|
-
});
|
|
444
|
-
const minHeight = defaultTheme.minHeight({
|
|
445
|
-
theme: () => "",
|
|
446
|
-
colors
|
|
447
|
-
});
|
|
448
|
-
const maxHeight = defaultTheme.maxHeight({
|
|
449
|
-
theme: () => "",
|
|
450
|
-
colors
|
|
451
|
-
});
|
|
452
|
-
const spacing = defaultTheme.spacing;
|
|
453
|
-
function isSizeValue(value) {
|
|
454
|
-
const trimmedValue = value.trim().toLowerCase();
|
|
455
|
-
return /^\d+px$/.test(trimmedValue) || /^\d+(\.\d+)?rem$/.test(trimmedValue) || /^\d+(\.\d+)?em$/.test(trimmedValue) || /^\d+(\.\d+)?%$/.test(trimmedValue) || /^\d+(\.\d+)?(vw|vh|vmin|vmax|dvw|dvh|lvw|lvh|svw|svh)$/.test(trimmedValue) || /^\d+(\.\d+)?(fr|ch|ex|ic|cap|lh|rlh)$/.test(trimmedValue) || [
|
|
456
|
-
"auto",
|
|
457
|
-
"inherit",
|
|
458
|
-
"initial",
|
|
459
|
-
"unset",
|
|
460
|
-
"revert",
|
|
461
|
-
"revert-layer",
|
|
462
|
-
"max-content",
|
|
463
|
-
"min-content",
|
|
464
|
-
"fit-content",
|
|
465
|
-
"stretch",
|
|
466
|
-
"none",
|
|
467
|
-
"0",
|
|
468
|
-
"1",
|
|
469
|
-
"2",
|
|
470
|
-
"3",
|
|
471
|
-
"4",
|
|
472
|
-
"5",
|
|
473
|
-
"6",
|
|
474
|
-
"7",
|
|
475
|
-
"8",
|
|
476
|
-
"9",
|
|
477
|
-
"10",
|
|
478
|
-
"11",
|
|
479
|
-
"12",
|
|
480
|
-
"14",
|
|
481
|
-
"16",
|
|
482
|
-
"20",
|
|
483
|
-
"24",
|
|
484
|
-
"28",
|
|
485
|
-
"32",
|
|
486
|
-
"36",
|
|
487
|
-
"40",
|
|
488
|
-
"44",
|
|
489
|
-
"48",
|
|
490
|
-
"52",
|
|
491
|
-
"56",
|
|
492
|
-
"60",
|
|
493
|
-
"64",
|
|
494
|
-
"72",
|
|
495
|
-
"80",
|
|
496
|
-
"96"
|
|
497
|
-
].includes(trimmedValue);
|
|
498
|
-
}
|
|
499
|
-
function getSizePresets() {
|
|
500
|
-
if (cachedSizePresets) return cachedSizePresets;
|
|
501
|
-
const cssVariables = getCachedCSSVariables();
|
|
502
|
-
if (!cssVariables) return [];
|
|
503
|
-
const sizePresets = [];
|
|
504
|
-
const addCssSize = (prop, value) => {
|
|
505
|
-
if (isSizeValue(value)) {
|
|
506
|
-
const label = prop.replace("--", "").replace(/-/g, " ");
|
|
507
|
-
sizePresets.push({
|
|
508
|
-
label,
|
|
509
|
-
value: `(${prop})`,
|
|
510
|
-
rawValue: convertRemToPixels(value),
|
|
511
|
-
type: "system"
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
for (const [prop, value] of Object.entries(cssVariables.root)) addCssSize(prop, value);
|
|
516
|
-
for (const [prop, value] of Object.entries(cssVariables.theme)) addCssSize(prop, value);
|
|
517
|
-
for (const [prop, value] of Object.entries(cssVariables.dark)) addCssSize(prop, value);
|
|
518
|
-
for (const [key, value] of Object.entries(spacing)) sizePresets.push({
|
|
519
|
-
label: key,
|
|
520
|
-
value: key,
|
|
521
|
-
rawValue: convertRemToPixels(value),
|
|
522
|
-
type: "tailwind"
|
|
523
|
-
});
|
|
524
|
-
const allWidth = {
|
|
525
|
-
...width,
|
|
526
|
-
...minWidth,
|
|
527
|
-
...maxWidth
|
|
528
|
-
};
|
|
529
|
-
const allHeight = {
|
|
530
|
-
...height,
|
|
531
|
-
...minHeight,
|
|
532
|
-
...maxHeight
|
|
533
|
-
};
|
|
534
|
-
const heightPresets = [...sizePresets];
|
|
535
|
-
const widthPresets = [...sizePresets];
|
|
536
|
-
for (const [key, value] of Object.entries(allWidth)) if (typeof value === "string") widthPresets.push({
|
|
537
|
-
label: key,
|
|
538
|
-
value: key,
|
|
539
|
-
rawValue: convertRemToPixels(value),
|
|
540
|
-
type: "tailwind"
|
|
541
|
-
});
|
|
542
|
-
for (const [key, value] of Object.entries(allHeight)) if (typeof value === "string") heightPresets.push({
|
|
543
|
-
label: key,
|
|
544
|
-
value: key,
|
|
545
|
-
rawValue: convertRemToPixels(value),
|
|
546
|
-
type: "tailwind"
|
|
547
|
-
});
|
|
548
|
-
const seen = /* @__PURE__ */ new Set();
|
|
549
|
-
const uniqueHeightPresets = heightPresets.filter((preset) => {
|
|
550
|
-
if (seen.has(preset.value)) return false;
|
|
551
|
-
seen.add(preset.value);
|
|
552
|
-
return true;
|
|
553
|
-
});
|
|
554
|
-
seen.clear();
|
|
555
|
-
const uniqueWidthPresets = widthPresets.filter((preset) => {
|
|
556
|
-
if (seen.has(preset.value)) return false;
|
|
557
|
-
seen.add(preset.value);
|
|
558
|
-
return true;
|
|
559
|
-
});
|
|
560
|
-
seen.clear();
|
|
561
|
-
cachedSizePresets = {
|
|
562
|
-
height: uniqueHeightPresets,
|
|
563
|
-
width: uniqueWidthPresets,
|
|
564
|
-
spacing: sizePresets.filter((preset) => {
|
|
565
|
-
if (seen.has(preset.value)) return false;
|
|
566
|
-
seen.add(preset.value);
|
|
567
|
-
return true;
|
|
568
|
-
})
|
|
569
|
-
};
|
|
570
|
-
return cachedSizePresets;
|
|
571
|
-
}
|
|
572
|
-
//#endregion
|
|
573
|
-
//#region src/lib/user-facing/properties-panel/mixins/style-tokens-border.ts
|
|
574
|
-
let cachedBorderPresets = null;
|
|
575
|
-
const borderWidth = defaultTheme.borderWidth;
|
|
576
|
-
const borderRadius = defaultTheme.borderRadius;
|
|
577
|
-
const boxShadow = defaultTheme.boxShadow;
|
|
578
|
-
const DEFAULT_KEY = "DEFAULT";
|
|
579
|
-
function isBoxShadowValue(value) {
|
|
580
|
-
const trimmedValue = value.trim().toLowerCase();
|
|
581
|
-
const isBoxShadow = /^(0|none|inset|outset|shadow-sm|shadow|shadow-md|shadow-lg|shadow-xl|shadow-2xl|shadow-inner|shadow-none)$/.test(trimmedValue);
|
|
582
|
-
if (isBoxShadow) return true;
|
|
583
|
-
return isBoxShadow || /^(inset\s+)?(-?\d+(\.\d+)?(px|rem|em|%)?(\s+|$)){2,4}([a-z]+\(.*?\)|#[0-9a-f]{3,8}|[a-z]+)?(\s*,\s*(inset\s+)?(-?\d+(\.\d+)?(px|rem|em|%)?(\s+|$)){2,4}([a-z]+\(.*?\)|#[0-9a-f]{3,8}|[a-z]+)?)*$/i.test(trimmedValue);
|
|
584
|
-
}
|
|
585
|
-
function formatLabel(key) {
|
|
586
|
-
return key.toLowerCase();
|
|
587
|
-
}
|
|
588
|
-
function getBorderPresets() {
|
|
589
|
-
if (cachedBorderPresets) return cachedBorderPresets;
|
|
590
|
-
const cssVariables = getCachedCSSVariables();
|
|
591
|
-
if (!cssVariables) return [];
|
|
592
|
-
const sizePresets = [];
|
|
593
|
-
const boxShadowPresets = [];
|
|
594
|
-
const addCssSize = (prop, value) => {
|
|
595
|
-
if (isSizeValue(value)) {
|
|
596
|
-
const label = formatLabel(prop.replace("--", "").replace(/-/g, " "));
|
|
597
|
-
sizePresets.push({
|
|
598
|
-
label,
|
|
599
|
-
value: `(${prop})`,
|
|
600
|
-
rawValue: convertRemToPixels(value),
|
|
601
|
-
type: "system"
|
|
602
|
-
});
|
|
603
|
-
} else if (isBoxShadowValue(value)) {
|
|
604
|
-
const label = formatLabel(prop.replace("--", "").replace(/-/g, " "));
|
|
605
|
-
boxShadowPresets.push({
|
|
606
|
-
label,
|
|
607
|
-
value: `(${prop})`,
|
|
608
|
-
rawValue: value,
|
|
609
|
-
type: "system"
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
for (const [prop, value] of Object.entries(cssVariables.root)) addCssSize(prop, value);
|
|
614
|
-
for (const [prop, value] of Object.entries(cssVariables.theme)) addCssSize(prop, value);
|
|
615
|
-
for (const [prop, value] of Object.entries(cssVariables.dark)) addCssSize(prop, value);
|
|
616
|
-
const borderWidthPresets = [...sizePresets];
|
|
617
|
-
const borderRadiusPresets = [...sizePresets];
|
|
618
|
-
function addTailwindProperty(presets, key, value, valueConverter) {
|
|
619
|
-
if (key === DEFAULT_KEY && typeof value === "string") presets.push({
|
|
620
|
-
label: "default",
|
|
621
|
-
value: "",
|
|
622
|
-
rawValue: valueConverter ? valueConverter(value) : convertRemToPixels(value),
|
|
623
|
-
type: "tailwind"
|
|
624
|
-
});
|
|
625
|
-
else if (typeof value === "string") presets.push({
|
|
626
|
-
label: formatLabel(key),
|
|
627
|
-
value: key,
|
|
628
|
-
rawValue: valueConverter ? valueConverter(value) : convertRemToPixels(value),
|
|
629
|
-
type: "tailwind"
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
for (const [key, value] of Object.entries(borderWidth)) addTailwindProperty(borderWidthPresets, key, value, convertRemToPixels);
|
|
633
|
-
for (const [key, value] of Object.entries(borderRadius)) addTailwindProperty(borderRadiusPresets, key, value, convertRemToPixels);
|
|
634
|
-
for (const [key, value] of Object.entries(boxShadow)) addTailwindProperty(boxShadowPresets, key, value);
|
|
635
|
-
const seen = /* @__PURE__ */ new Set();
|
|
636
|
-
const uniqueBorderWidthPresets = borderWidthPresets.filter((preset) => {
|
|
637
|
-
if (seen.has(preset.value)) return false;
|
|
638
|
-
seen.add(preset.value);
|
|
639
|
-
return true;
|
|
640
|
-
});
|
|
641
|
-
seen.clear();
|
|
642
|
-
const uniqueBorderRadiusPresets = borderRadiusPresets.filter((preset) => {
|
|
643
|
-
if (seen.has(preset.value)) return false;
|
|
644
|
-
seen.add(preset.value);
|
|
645
|
-
return true;
|
|
646
|
-
});
|
|
647
|
-
seen.clear();
|
|
648
|
-
cachedBorderPresets = {
|
|
649
|
-
borderWidth: uniqueBorderWidthPresets,
|
|
650
|
-
borderRadius: uniqueBorderRadiusPresets,
|
|
651
|
-
boxShadow: boxShadowPresets.filter((preset) => {
|
|
652
|
-
if (seen.has(preset.value)) return false;
|
|
653
|
-
seen.add(preset.value);
|
|
654
|
-
return true;
|
|
655
|
-
})
|
|
656
|
-
};
|
|
657
|
-
return cachedBorderPresets;
|
|
658
|
-
}
|
|
659
|
-
//#endregion
|
|
660
|
-
//#region src/lib/user-facing/properties-panel/mixins/style-tokens-color.ts
|
|
661
|
-
let cachedColorPresets = null;
|
|
662
|
-
function isColorValue(value) {
|
|
663
|
-
const trimmedValue = value.trim().toLowerCase();
|
|
664
|
-
return trimmedValue.startsWith("#") || trimmedValue.startsWith("rgb(") || trimmedValue.startsWith("rgba(") || trimmedValue.startsWith("hsl(") || trimmedValue.startsWith("hsla(") || trimmedValue.startsWith("oklch(") || trimmedValue.startsWith("oklab(") || trimmedValue.startsWith("lch(") || trimmedValue.startsWith("lab(") || trimmedValue.startsWith("color(") || trimmedValue.startsWith("hwb(") || [
|
|
665
|
-
"transparent",
|
|
666
|
-
"currentcolor",
|
|
667
|
-
"inherit",
|
|
668
|
-
"initial",
|
|
669
|
-
"unset",
|
|
670
|
-
"red",
|
|
671
|
-
"blue",
|
|
672
|
-
"green",
|
|
673
|
-
"black",
|
|
674
|
-
"white",
|
|
675
|
-
"gray",
|
|
676
|
-
"yellow",
|
|
677
|
-
"orange",
|
|
678
|
-
"purple",
|
|
679
|
-
"pink",
|
|
680
|
-
"brown"
|
|
681
|
-
].includes(trimmedValue);
|
|
682
|
-
}
|
|
683
|
-
function getColorPresets() {
|
|
684
|
-
if (cachedColorPresets) return cachedColorPresets;
|
|
685
|
-
const cssVariables = getCachedCSSVariables();
|
|
686
|
-
if (!cssVariables) return [];
|
|
687
|
-
const colorPresets = [];
|
|
688
|
-
const addCssColor = (prop, value) => {
|
|
689
|
-
if (isColorValue(value)) {
|
|
690
|
-
const label = prop.replace("--", "").replace(/-/g, " ");
|
|
691
|
-
colorPresets.push({
|
|
692
|
-
label,
|
|
693
|
-
value: prop.replace("--", ""),
|
|
694
|
-
rawValue: value,
|
|
695
|
-
type: "system"
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
for (const [prop, value] of Object.entries(cssVariables.root)) addCssColor(prop, value);
|
|
700
|
-
for (const [prop, value] of Object.entries(cssVariables.theme)) addCssColor(prop, value);
|
|
701
|
-
for (const [prop, value] of Object.entries(cssVariables.dark)) addCssColor(prop, value);
|
|
702
|
-
for (const [colorName, colorShades] of Object.entries(colors)) if (typeof colorShades === "object" && colorShades !== null) {
|
|
703
|
-
for (const [shade, colorValue] of Object.entries(colorShades)) if (typeof colorValue === "string") colorPresets.push({
|
|
704
|
-
label: `${colorName} ${shade}`,
|
|
705
|
-
value: `${colorName}-${shade}`,
|
|
706
|
-
rawValue: colorValue,
|
|
707
|
-
type: "tailwind"
|
|
708
|
-
});
|
|
709
|
-
} else if (typeof colorShades === "string") colorPresets.push({
|
|
710
|
-
label: colorName,
|
|
711
|
-
value: colorName,
|
|
712
|
-
rawValue: colorShades,
|
|
713
|
-
type: "tailwind"
|
|
714
|
-
});
|
|
715
|
-
const seen = /* @__PURE__ */ new Set();
|
|
716
|
-
const uniquePresets = colorPresets.filter((preset) => {
|
|
717
|
-
if (seen.has(preset.value)) return false;
|
|
718
|
-
seen.add(preset.value);
|
|
719
|
-
return true;
|
|
720
|
-
});
|
|
721
|
-
cachedColorPresets = uniquePresets;
|
|
722
|
-
return uniquePresets;
|
|
723
|
-
}
|
|
724
|
-
//#endregion
|
|
725
|
-
//#region src/lib/user-facing/properties-panel/mixins/styles-category.ts
|
|
726
|
-
/**
|
|
727
|
-
* Creates a standardized styles section for use in properties panels.
|
|
728
|
-
* This provides a consistent interface for applying Tailwind CSS classes across components.
|
|
729
|
-
*
|
|
730
|
-
* @example
|
|
731
|
-
* // Basic usage with defaults
|
|
732
|
-
* styles: tailwindStylesCategory()
|
|
733
|
-
*
|
|
734
|
-
* // Override with prioritizedTailwindProperties. These properties will always be shown in the properties panel, event when not set.
|
|
735
|
-
* styles: tailwindStylesCategory({prioritizedTailwindProperties: ["rounded", "text-color"]})
|
|
736
|
-
*
|
|
737
|
-
* @param options - Configuration options to override defaults
|
|
738
|
-
* @returns A Section with PropsCategory.Styles containing a className prop
|
|
739
|
-
*/
|
|
740
|
-
const tailwindStylesCategory = (props) => {
|
|
741
|
-
const { prioritizedTailwindProperties } = props ?? {};
|
|
742
|
-
return Section.category(PropsCategory.Appearance).children({ className: Prop.string().propertiesPanel({
|
|
743
|
-
controlType: "TAILWIND_CLASS_BUILDER",
|
|
744
|
-
themePresets: function() {
|
|
745
|
-
return {
|
|
746
|
-
...getSizePresets(),
|
|
747
|
-
...getBorderPresets(),
|
|
748
|
-
colors: getColorPresets()
|
|
749
|
-
};
|
|
750
|
-
},
|
|
751
|
-
prioritizedTailwindProperties
|
|
752
|
-
}) });
|
|
753
|
-
};
|
|
754
|
-
//#endregion
|
|
755
286
|
//#region src/lib/user-facing/components/custom/register-custom-component.tsx
|
|
756
|
-
const defaultSectionsTemplate = () => ({
|
|
757
|
-
appearance: tailwindStylesCategory(),
|
|
758
|
-
styles: inlineStylesCategory()
|
|
759
|
-
});
|
|
760
|
-
function convertToSections(propertiesDefinition) {
|
|
761
|
-
return {
|
|
762
|
-
content: Section.category(PropsCategory.Content).children(Object.fromEntries(Object.entries(propertiesDefinition).filter(([, prop]) => prop.type !== "eventHandler"))),
|
|
763
|
-
events: Section.category(PropsCategory.EventHandlers).children(Object.fromEntries(Object.entries(propertiesDefinition).filter(([, prop]) => prop.type === "eventHandler")))
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
function mergeSections(sections, defaultSections) {
|
|
767
|
-
const allCurrentProps = Object.values(sections).flatMap((section) => Object.keys(section.props));
|
|
768
|
-
Object.entries(defaultSections).forEach(([sectionName, section]) => {
|
|
769
|
-
Object.entries(section.props).forEach(([propName, prop]) => {
|
|
770
|
-
if (!allCurrentProps.includes(propName)) {
|
|
771
|
-
if (!sections[sectionName]) sections[sectionName] = defaultSections[sectionName];
|
|
772
|
-
sections[sectionName].add({ [propName]: prop });
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
});
|
|
776
|
-
return sections;
|
|
777
|
-
}
|
|
778
287
|
/**
|
|
779
288
|
* Registers a custom React component or HTML element with Superblocks.
|
|
780
289
|
*
|
|
@@ -811,56 +320,31 @@ function mergeSections(sections, defaultSections) {
|
|
|
811
320
|
* ```
|
|
812
321
|
*/
|
|
813
322
|
function registerComponent(component, propertiesDefinition) {
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
|
|
323
|
+
const sections = {};
|
|
324
|
+
for (const [name, definition] of Object.entries(propertiesDefinition ?? {})) if (definition instanceof Section) sections[name] = Section.category(definition.category).children({
|
|
325
|
+
...sections[name]?.props,
|
|
326
|
+
...definition.props
|
|
327
|
+
});
|
|
328
|
+
else if (definition instanceof Prop) {
|
|
329
|
+
const isEvent = definition.type === "eventHandler";
|
|
330
|
+
const key = isEvent ? "events" : "content";
|
|
331
|
+
sections[key] ??= Section.category(isEvent ? PropsCategory.EventHandlers : PropsCategory.Content);
|
|
332
|
+
sections[key].add({ [name]: definition });
|
|
333
|
+
}
|
|
334
|
+
return registerComponentInternal(component, sections);
|
|
817
335
|
}
|
|
818
336
|
//#endregion
|
|
819
337
|
//#region src/lib/user-facing/components/html/html-property-panels.ts
|
|
820
|
-
const TYPOGRAPHY_PRIORITIZED_PROPERTIES = [
|
|
821
|
-
"font-family",
|
|
822
|
-
"font-size",
|
|
823
|
-
"font-weight",
|
|
824
|
-
"font-style",
|
|
825
|
-
"line-height",
|
|
826
|
-
"letter-spacing",
|
|
827
|
-
"text-align",
|
|
828
|
-
"text-color",
|
|
829
|
-
"text-decoration",
|
|
830
|
-
"text-transform"
|
|
831
|
-
];
|
|
832
|
-
const CONTAINER_PRIORITIZED_PROPERTIES = [
|
|
833
|
-
"display",
|
|
834
|
-
"p",
|
|
835
|
-
"m",
|
|
836
|
-
"width",
|
|
837
|
-
"height",
|
|
838
|
-
"background-color",
|
|
839
|
-
"rounded",
|
|
840
|
-
"border-width",
|
|
841
|
-
"border-style",
|
|
842
|
-
"overflow"
|
|
843
|
-
];
|
|
844
338
|
const htmlTagSectionsTemplate = (params) => {
|
|
845
339
|
const sections = {};
|
|
846
|
-
if (params.hasChildren) sections.contentSection = Section.category(PropsCategory.Content).children({ children: Prop.jsx()
|
|
847
|
-
label: "Children",
|
|
848
|
-
description: "The content of the element"
|
|
849
|
-
}) });
|
|
850
|
-
sections.appearance = tailwindStylesCategory({ prioritizedTailwindProperties: params.prioritizedTailwindProperties });
|
|
340
|
+
if (params.hasChildren) sections.contentSection = Section.category(PropsCategory.Content).children({ children: Prop.jsx() });
|
|
851
341
|
return sections;
|
|
852
342
|
};
|
|
853
343
|
const htmlTagSectionsTemplateForTypography = () => {
|
|
854
|
-
return htmlTagSectionsTemplate({
|
|
855
|
-
hasChildren: true,
|
|
856
|
-
prioritizedTailwindProperties: TYPOGRAPHY_PRIORITIZED_PROPERTIES
|
|
857
|
-
});
|
|
344
|
+
return htmlTagSectionsTemplate({ hasChildren: true });
|
|
858
345
|
};
|
|
859
346
|
const htmlTagSectionsTemplateForContainers = () => {
|
|
860
|
-
return htmlTagSectionsTemplate({
|
|
861
|
-
hasChildren: true,
|
|
862
|
-
prioritizedTailwindProperties: CONTAINER_PRIORITIZED_PROPERTIES
|
|
863
|
-
});
|
|
347
|
+
return htmlTagSectionsTemplate({ hasChildren: true });
|
|
864
348
|
};
|
|
865
349
|
//#endregion
|
|
866
350
|
//#region src/lib/user-facing/components/html/register-html-elements.ts
|
|
@@ -1103,14 +587,10 @@ const handleBootstrapResponse = (event) => {
|
|
|
1103
587
|
if (event.data.payload.branchName) root_store_default.setBranchName(event.data.payload.branchName);
|
|
1104
588
|
if (event.data.payload.commitId) root_store_default.setCommitId(event.data.payload.commitId);
|
|
1105
589
|
root_store_default.apis.notifyBootstrapComplete();
|
|
1106
|
-
const featureFlags = event.data.payload.featureFlags;
|
|
1107
|
-
if (featureFlags && root_store_default.editStore) {
|
|
1108
|
-
if (featureFlags["ui.disable-design-mode"]) root_store_default.editStore.setDesignModeDisabled(true);
|
|
1109
|
-
}
|
|
1110
590
|
root_store_default.windowOriginUrl = event.data.payload.logContext?.superblocks_window_origin_url;
|
|
1111
|
-
if (root_store_default.windowOriginUrl) import("../utils-
|
|
591
|
+
if (root_store_default.windowOriginUrl) import("../utils-DXaAwgS_.js").then((n) => n.r).then(({ initTracerProviderWithOrigin }) => {
|
|
1112
592
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
1113
|
-
import("../logs-
|
|
593
|
+
import("../logs-CUUgkcJf.js").then(({ initLibraryLoggerProvider }) => {
|
|
1114
594
|
initLibraryLoggerProvider({
|
|
1115
595
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
1116
596
|
appId: event.data.payload.appId,
|
|
@@ -2299,96 +1779,6 @@ function BuildErrorModal({ isOpen, error, onClose }) {
|
|
|
2299
1779
|
});
|
|
2300
1780
|
}
|
|
2301
1781
|
//#endregion
|
|
2302
|
-
//#region src/edit-mode/create-component.ts
|
|
2303
|
-
function getParentInfo(parent) {
|
|
2304
|
-
const selectorIds = Array.from(getEditStore().runtimeTrackingStore.getSelectorIdsForSourceId(parent.id));
|
|
2305
|
-
return { type: (selectorIds.length > 0 ? getEditStore().runtimeTrackingStore.getComponent(selectorIds[0]) : void 0)?.type };
|
|
2306
|
-
}
|
|
2307
|
-
function getComponentBaseProperties(componentType, _parentInfo, editorTemplateCreateRequest) {
|
|
2308
|
-
let properties = {};
|
|
2309
|
-
const editorTemplates = root_store_default.componentRegistry.getEditorTemplates(componentType);
|
|
2310
|
-
if (editorTemplates && editorTemplates.length > 1) throw new Error(`Multiple editor templates are not supported yet. Found ${editorTemplates.length} for component type: ${componentType}.`);
|
|
2311
|
-
if (editorTemplateCreateRequest?.properties) properties = {
|
|
2312
|
-
...properties,
|
|
2313
|
-
...editorTemplateCreateRequest.properties
|
|
2314
|
-
};
|
|
2315
|
-
return {
|
|
2316
|
-
properties: { ...properties },
|
|
2317
|
-
children: editorTemplateCreateRequest?.children ?? []
|
|
2318
|
-
};
|
|
2319
|
-
}
|
|
2320
|
-
function getCreateAtParentElement(relativeParent, createAt) {
|
|
2321
|
-
if (createAt === "root") {
|
|
2322
|
-
const currentSelectors = Array.from(getEditStore().runtimeTrackingStore.getSelectorIdsForSourceId(relativeParent.id));
|
|
2323
|
-
if (currentSelectors.length === 0) throw new Error(`No selector found for parent: ${relativeParent.id}`);
|
|
2324
|
-
const appSelectorId = getEditStore().runtimeTrackingStore.getClosestAncestorByType(currentSelectors[0], "App");
|
|
2325
|
-
if (!appSelectorId) throw new Error(`App component not found for parent: ${relativeParent.id}`);
|
|
2326
|
-
const appComponent = getEditStore().runtimeTrackingStore.getComponent(appSelectorId);
|
|
2327
|
-
if (!appComponent) throw new Error(`App component not found for selector: ${appSelectorId}`);
|
|
2328
|
-
return { source: { id: appComponent.sourceId } };
|
|
2329
|
-
} else return { source: relativeParent };
|
|
2330
|
-
}
|
|
2331
|
-
async function createComponent({ componentType, parent, scopeName, baseProperties = {}, skipSecondaryComponentsCreation, otherComponentsUpdates }) {
|
|
2332
|
-
const parentInfo = getParentInfo(parent);
|
|
2333
|
-
const editorTemplates = root_store_default.componentRegistry.getEditorTemplates(componentType);
|
|
2334
|
-
if (editorTemplates && editorTemplates.length > 1) throw new Error(`Multiple editor templates are not supported yet. Found ${editorTemplates.length} for component type: ${componentType}.`);
|
|
2335
|
-
const context = {
|
|
2336
|
-
parentInfo,
|
|
2337
|
-
defaultTagNames: root_store_default.componentRegistry.defaultTagNames,
|
|
2338
|
-
selfTagName: componentType,
|
|
2339
|
-
generateUniqueName: (prefix) => `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
|
|
2340
|
-
};
|
|
2341
|
-
const editorTemplateCreateRequest = editorTemplates?.[0]?.create?.(context);
|
|
2342
|
-
const primaryEditorTemplateCreateRequest = Array.isArray(editorTemplateCreateRequest) ? editorTemplateCreateRequest[0] : editorTemplateCreateRequest;
|
|
2343
|
-
if (editorTemplateCreateRequest && primaryEditorTemplateCreateRequest?.type !== componentType) throw new Error(`When defining a ${Array.isArray(editorTemplateCreateRequest) ? "multiple" : "single"} component to be created on an EditorTemplate, the type must match with the component being created. got: ${primaryEditorTemplateCreateRequest?.type} when it should have been ${componentType}`);
|
|
2344
|
-
const editorTemplateCreateRequests = Array.isArray(editorTemplateCreateRequest) ? editorTemplateCreateRequest : [editorTemplateCreateRequest];
|
|
2345
|
-
const editStore = getEditStore();
|
|
2346
|
-
function editorTemplateCreateRequestToInternalCreateRequest({ editorTemplateCreateRequest, baseProperties }) {
|
|
2347
|
-
const type = editorTemplateCreateRequest?.type ?? componentType;
|
|
2348
|
-
const { properties: propertiesFromType, children } = getComponentBaseProperties(type, parentInfo, editorTemplateCreateRequest);
|
|
2349
|
-
const properties = {
|
|
2350
|
-
...propertiesFromType,
|
|
2351
|
-
...baseProperties
|
|
2352
|
-
};
|
|
2353
|
-
return {
|
|
2354
|
-
parentElement: getCreateAtParentElement(parent, editorTemplateCreateRequest?.createAt),
|
|
2355
|
-
tagName: type,
|
|
2356
|
-
properties,
|
|
2357
|
-
children,
|
|
2358
|
-
scopeName,
|
|
2359
|
-
id: editStore.operationManager.generateSourceId()
|
|
2360
|
-
};
|
|
2361
|
-
}
|
|
2362
|
-
const createRequests = editorTemplateCreateRequests.map((editorTemplateCreateRequest, index) => editorTemplateCreateRequestToInternalCreateRequest({
|
|
2363
|
-
editorTemplateCreateRequest,
|
|
2364
|
-
baseProperties: index === 0 ? baseProperties : {}
|
|
2365
|
-
}));
|
|
2366
|
-
const hasOtherComponentsUpdates = otherComponentsUpdates && Object.keys(otherComponentsUpdates).length > 0;
|
|
2367
|
-
const hasMultipleCreateComponents = editorTemplateCreateRequests.length > 1 && !skipSecondaryComponentsCreation;
|
|
2368
|
-
if (hasOtherComponentsUpdates || hasMultipleCreateComponents) {
|
|
2369
|
-
const performOtherComponentsUpdates = (otherComponentsUpdates) => {
|
|
2370
|
-
Object.entries(otherComponentsUpdates).forEach(([sourceId, updates]) => {
|
|
2371
|
-
editStore.operationManager.setWidgetProperties({
|
|
2372
|
-
sourceId,
|
|
2373
|
-
properties: updates
|
|
2374
|
-
});
|
|
2375
|
-
});
|
|
2376
|
-
};
|
|
2377
|
-
editStore.operationManager.batchUpdate(() => {
|
|
2378
|
-
if (skipSecondaryComponentsCreation) editStore.operationManager.createComponent(createRequests[0]);
|
|
2379
|
-
else createRequests.forEach((createRequest) => {
|
|
2380
|
-
editStore.operationManager.createComponent(createRequest);
|
|
2381
|
-
});
|
|
2382
|
-
if (hasOtherComponentsUpdates) performOtherComponentsUpdates(otherComponentsUpdates);
|
|
2383
|
-
});
|
|
2384
|
-
} else editStore.operationManager.createComponent(createRequests[0]);
|
|
2385
|
-
/**
|
|
2386
|
-
* Returns the single id, or the the last component if there are multiple.
|
|
2387
|
-
* See EditorTemplate's definition to understand why.
|
|
2388
|
-
*/
|
|
2389
|
-
return createRequests.at(-1).id;
|
|
2390
|
-
}
|
|
2391
|
-
//#endregion
|
|
2392
1782
|
//#region src/edit-mode/features/ai-store.ts
|
|
2393
1783
|
var AiManager = class {
|
|
2394
1784
|
_isTaggingEnabled = true;
|
|
@@ -3077,9 +2467,6 @@ var OperationManager = class {
|
|
|
3077
2467
|
get pendingDeleteOperations() {
|
|
3078
2468
|
return this.pendingTransactions.filter((t) => t.type === "editor:deleteComponents");
|
|
3079
2469
|
}
|
|
3080
|
-
get pendingSetPropertiesOperations() {
|
|
3081
|
-
return this.pendingTransactions.filter((t) => t.type === "editor:setProperties");
|
|
3082
|
-
}
|
|
3083
2470
|
get hasPendingOperations() {
|
|
3084
2471
|
return this.pendingTransactions.length > 0;
|
|
3085
2472
|
}
|
|
@@ -3104,7 +2491,6 @@ var OperationManager = class {
|
|
|
3104
2491
|
if (this.waitingForBatch) this.batchOperations.push(opWithId);
|
|
3105
2492
|
else switch (operation.type) {
|
|
3106
2493
|
case "editor:moveComponent": return editorBridge.editOpRequest("editor:moveComponent", payload);
|
|
3107
|
-
case "editor:setProperties": return editorBridge.editOpRequest("editor:setProperties", payload);
|
|
3108
2494
|
case "editor:createComponent": return editorBridge.editOpRequest("editor:createComponent", payload);
|
|
3109
2495
|
case "editor:deleteComponents": return editorBridge.editOpRequest("editor:deleteComponents", payload);
|
|
3110
2496
|
}
|
|
@@ -3204,32 +2590,6 @@ var OperationManager = class {
|
|
|
3204
2590
|
});
|
|
3205
2591
|
break;
|
|
3206
2592
|
}
|
|
3207
|
-
case "editor:setProperties": {
|
|
3208
|
-
const { type, payload } = operation;
|
|
3209
|
-
this.addPendingTransaction({
|
|
3210
|
-
type,
|
|
3211
|
-
id: payload.transaction.id,
|
|
3212
|
-
payload
|
|
3213
|
-
});
|
|
3214
|
-
break;
|
|
3215
|
-
}
|
|
3216
|
-
case "editor:deleteProperties": {
|
|
3217
|
-
const { payload } = operation;
|
|
3218
|
-
const asSetProperties = {
|
|
3219
|
-
element: { source: { id: payload.element.source.id } },
|
|
3220
|
-
properties: Object.fromEntries(payload.properties.map((p) => [p, {
|
|
3221
|
-
type: "STATIC",
|
|
3222
|
-
value: void 0,
|
|
3223
|
-
__info: true
|
|
3224
|
-
}]))
|
|
3225
|
-
};
|
|
3226
|
-
this.addPendingTransaction({
|
|
3227
|
-
type: "editor:setProperties",
|
|
3228
|
-
id: batchTransactionId ?? payload.transaction.id,
|
|
3229
|
-
payload: asSetProperties
|
|
3230
|
-
});
|
|
3231
|
-
break;
|
|
3232
|
-
}
|
|
3233
2593
|
default: console.error("Unknown edit operation", operation);
|
|
3234
2594
|
}
|
|
3235
2595
|
};
|
|
@@ -3242,34 +2602,6 @@ var OperationManager = class {
|
|
|
3242
2602
|
for (const update of payload.updates) addOperation(update, payload.transaction.id);
|
|
3243
2603
|
} else addOperation(operation);
|
|
3244
2604
|
}
|
|
3245
|
-
@action writeRuntimeProperties(sourceId, transactionId, updates) {
|
|
3246
|
-
this.addPendingTransaction({
|
|
3247
|
-
type: "editor:setProperties",
|
|
3248
|
-
id: transactionId,
|
|
3249
|
-
payload: {
|
|
3250
|
-
element: { source: { id: sourceId } },
|
|
3251
|
-
properties: updates
|
|
3252
|
-
}
|
|
3253
|
-
});
|
|
3254
|
-
}
|
|
3255
|
-
@action setWidgetProperties({ sourceId, properties, callback }) {
|
|
3256
|
-
const payload = {
|
|
3257
|
-
element: { source: { id: sourceId } },
|
|
3258
|
-
properties
|
|
3259
|
-
};
|
|
3260
|
-
this.executeOrAddToBatch({
|
|
3261
|
-
type: "editor:setProperties",
|
|
3262
|
-
payload,
|
|
3263
|
-
callback
|
|
3264
|
-
});
|
|
3265
|
-
}
|
|
3266
|
-
@action setWidgetProperty({ sourceId, property, value, callback }) {
|
|
3267
|
-
this.setWidgetProperties({
|
|
3268
|
-
sourceId,
|
|
3269
|
-
properties: { [property]: value },
|
|
3270
|
-
callback
|
|
3271
|
-
});
|
|
3272
|
-
}
|
|
3273
2605
|
async ensureFilesSynced() {
|
|
3274
2606
|
await source_update_api_default.ensureFilesSynced();
|
|
3275
2607
|
}
|
|
@@ -3278,68 +2610,6 @@ var OperationManager = class {
|
|
|
3278
2610
|
}
|
|
3279
2611
|
};
|
|
3280
2612
|
//#endregion
|
|
3281
|
-
//#region src/edit-mode/features/properties-panel-manager.ts
|
|
3282
|
-
var PropertiesPanelManager = class {
|
|
3283
|
-
propertiesDefinitions = /* @__PURE__ */ new Map();
|
|
3284
|
-
propertiesPanelTrackerDisposer = null;
|
|
3285
|
-
_propertyLookupCache = /* @__PURE__ */ new Map();
|
|
3286
|
-
removeHotReloadListener = null;
|
|
3287
|
-
constructor(editStore, componentsManager) {
|
|
3288
|
-
this.editStore = editStore;
|
|
3289
|
-
this.componentsManager = componentsManager;
|
|
3290
|
-
makeAutoObservable(this, { _propertyLookupCache: false });
|
|
3291
|
-
this.attachHotReloadListener();
|
|
3292
|
-
}
|
|
3293
|
-
getPropertiesPanel(selectorId) {
|
|
3294
|
-
const component = this.editStore.runtimeTrackingStore.getComponent(selectorId);
|
|
3295
|
-
const props = component?.props;
|
|
3296
|
-
if (!component?.type) return { sections: [] };
|
|
3297
|
-
const componentType = component.displayName || component.type;
|
|
3298
|
-
if (!componentType) return { sections: [] };
|
|
3299
|
-
const propertiesDefinition = this.propertiesDefinitions.get(componentType);
|
|
3300
|
-
if (!propertiesDefinition) return { sections: [] };
|
|
3301
|
-
return createPropertiesPanelDefinition(propertiesDefinition, props ?? {});
|
|
3302
|
-
}
|
|
3303
|
-
trackPropertiesPanel(selectorId) {
|
|
3304
|
-
if (this.propertiesPanelTrackerDisposer) this.propertiesPanelTrackerDisposer();
|
|
3305
|
-
const sourceId = this.editStore.runtimeTrackingStore.getSourceId(selectorId);
|
|
3306
|
-
if (!sourceId) return;
|
|
3307
|
-
this.propertiesPanelTrackerDisposer = autorun(() => {
|
|
3308
|
-
const propertiesPanel = this.getPropertiesPanel(selectorId);
|
|
3309
|
-
editorBridge.addPropertiesPanel(sourceId, propertiesPanel);
|
|
3310
|
-
}, { name: `trackPropertiesPanel[${selectorId}]` });
|
|
3311
|
-
}
|
|
3312
|
-
untrackPropertiesPanel() {
|
|
3313
|
-
this.propertiesPanelTrackerDisposer?.();
|
|
3314
|
-
this.propertiesPanelTrackerDisposer = null;
|
|
3315
|
-
}
|
|
3316
|
-
getPropertiesDefinition(type) {
|
|
3317
|
-
return this.propertiesDefinitions.get(type);
|
|
3318
|
-
}
|
|
3319
|
-
setPropertiesDefinition(widgetType, propertiesDefinition) {
|
|
3320
|
-
this.propertiesDefinitions.set(widgetType, propertiesDefinition);
|
|
3321
|
-
}
|
|
3322
|
-
updatePropertiesDefinitionForType(type) {
|
|
3323
|
-
console.log("[internal] [NOOP] updatePropertiesDefinitionForType: ", type);
|
|
3324
|
-
}
|
|
3325
|
-
computeAndApplySideEffectsForPropertyUpdate(payload) {
|
|
3326
|
-
console.log("[internal] [NOOP] computeAndApplySideEffectsForPropertyUpdate");
|
|
3327
|
-
return { [payload.sourceId]: payload.updates };
|
|
3328
|
-
}
|
|
3329
|
-
/**
|
|
3330
|
-
* When a custom component's source code is updated, we want to update the properties definition for that component.
|
|
3331
|
-
* In order to do that, we need to listen to vite's hot reload events. We can't put import.meta.hot calls in the library
|
|
3332
|
-
* because Vite just compiled all of those out in library builds, so we inject a listener from the plugin instead.
|
|
3333
|
-
* https://github.com/vitejs/vite/blob/v6.2/packages/vite/src/node/plugins/define.ts#L37
|
|
3334
|
-
*/
|
|
3335
|
-
attachHotReloadListener() {
|
|
3336
|
-
this.removeHotReloadListener?.();
|
|
3337
|
-
this.removeHotReloadListener = this.editStore.onViteMessage(ViteMessageKind.UPDATE_CUSTOM_COMPONENT, (message) => {
|
|
3338
|
-
this.updatePropertiesDefinitionForType(message.component);
|
|
3339
|
-
});
|
|
3340
|
-
}
|
|
3341
|
-
};
|
|
3342
|
-
//#endregion
|
|
3343
2613
|
//#region src/edit-mode/runtime-graph/observable-graph.ts
|
|
3344
2614
|
var ObservableGraph = class extends Graph {
|
|
3345
2615
|
constructor(args) {
|
|
@@ -3556,143 +2826,9 @@ var RuntimeTrackingStore = class {
|
|
|
3556
2826
|
}
|
|
3557
2827
|
};
|
|
3558
2828
|
//#endregion
|
|
3559
|
-
//#region src/edit-mode/features/resizing-store.ts
|
|
3560
|
-
var ResizingManager = class {
|
|
3561
|
-
_activeResizes = /* @__PURE__ */ new Map();
|
|
3562
|
-
constructor(root) {
|
|
3563
|
-
this.root = root;
|
|
3564
|
-
makeAutoObservable(this);
|
|
3565
|
-
startEditorSync({
|
|
3566
|
-
store: this,
|
|
3567
|
-
storeId: "resizing",
|
|
3568
|
-
projection(store) {
|
|
3569
|
-
const resize = store.activeResize;
|
|
3570
|
-
return {
|
|
3571
|
-
isResizing: resize != null,
|
|
3572
|
-
activeResize: resize ? {
|
|
3573
|
-
width: resize.widthToUpdate,
|
|
3574
|
-
height: resize.heightToUpdate
|
|
3575
|
-
} : null
|
|
3576
|
-
};
|
|
3577
|
-
}
|
|
3578
|
-
});
|
|
3579
|
-
}
|
|
3580
|
-
get activeResize() {
|
|
3581
|
-
const selectedSourceId = this.root.editStore?.ui.getSelectedSourceIds()[0];
|
|
3582
|
-
if (!selectedSourceId) return null;
|
|
3583
|
-
return this._activeResizes.get(selectedSourceId);
|
|
3584
|
-
}
|
|
3585
|
-
isLockedAspectRatio(selectorId) {
|
|
3586
|
-
const component = this.root.editStore?.runtimeTrackingStore.getComponent(selectorId);
|
|
3587
|
-
return (component?.type ? this.root.componentRegistry.getEditorConfig(component?.type) : null)?.isFixedAspectRatio === true;
|
|
3588
|
-
}
|
|
3589
|
-
startResizing(dragStartX, dragStartY, selectorId, position) {
|
|
3590
|
-
const component = this.root.editStore?.runtimeTrackingStore.getComponent(selectorId);
|
|
3591
|
-
if (!component) {
|
|
3592
|
-
console.error(`Could not find component ${selectorId}`);
|
|
3593
|
-
return;
|
|
3594
|
-
}
|
|
3595
|
-
this._activeResizes.set(component.sourceId, {
|
|
3596
|
-
selectorId,
|
|
3597
|
-
sourceId: component.sourceId,
|
|
3598
|
-
dragStartX,
|
|
3599
|
-
dragStartY,
|
|
3600
|
-
start: {
|
|
3601
|
-
width: (component?.props?.width)?.value ?? (component?.props?.size)?.value ?? 0,
|
|
3602
|
-
height: (component?.props?.height)?.value ?? 0
|
|
3603
|
-
},
|
|
3604
|
-
resizedPosition: position,
|
|
3605
|
-
widthToUpdate: null,
|
|
3606
|
-
heightToUpdate: null,
|
|
3607
|
-
isApplyingResize: false
|
|
3608
|
-
});
|
|
3609
|
-
}
|
|
3610
|
-
calculateDimension(baseValue, delta) {
|
|
3611
|
-
return Math.floor(Math.max(baseValue + delta, 0));
|
|
3612
|
-
}
|
|
3613
|
-
handleResizeDimension(params) {
|
|
3614
|
-
const { resizeState, dimension, delta, canResize, position } = params;
|
|
3615
|
-
if (!canResize) return;
|
|
3616
|
-
const isHorizontal = dimension === "width";
|
|
3617
|
-
const startValue = resizeState.start[dimension];
|
|
3618
|
-
let newValue = null;
|
|
3619
|
-
if (position.includes(isHorizontal ? "left" : "top")) newValue = this.calculateDimension(startValue, -delta);
|
|
3620
|
-
else if (position.includes(isHorizontal ? "right" : "bottom")) newValue = this.calculateDimension(startValue, delta);
|
|
3621
|
-
return () => {
|
|
3622
|
-
if (newValue) resizeState[`${dimension}ToUpdate`] = Dim.px(newValue);
|
|
3623
|
-
};
|
|
3624
|
-
}
|
|
3625
|
-
resizeWidget(currentX, currentY, selectorId, canResizeWidth, canResizeHeight) {
|
|
3626
|
-
const sourceId = this.root.editStore?.runtimeTrackingStore.getSourceId(selectorId);
|
|
3627
|
-
const component = this.root.editStore?.runtimeTrackingStore.getComponent(selectorId);
|
|
3628
|
-
if (!component?.type) return;
|
|
3629
|
-
const resizeState = sourceId && this._activeResizes.get(sourceId);
|
|
3630
|
-
if (!resizeState) return;
|
|
3631
|
-
const widthMode = (component?.props?.width)?.mode;
|
|
3632
|
-
const heightMode = (component?.props?.height)?.mode;
|
|
3633
|
-
const lockedAspectRatio = this.isLockedAspectRatio(selectorId);
|
|
3634
|
-
const deltaX = currentX - resizeState.dragStartX;
|
|
3635
|
-
const deltaY = lockedAspectRatio ? deltaX : currentY - resizeState.dragStartY;
|
|
3636
|
-
const updateWidth = this.handleResizeDimension({
|
|
3637
|
-
resizeState,
|
|
3638
|
-
dimension: "width",
|
|
3639
|
-
delta: deltaX,
|
|
3640
|
-
canResize: canResizeWidth,
|
|
3641
|
-
mode: widthMode,
|
|
3642
|
-
position: resizeState.resizedPosition
|
|
3643
|
-
});
|
|
3644
|
-
const updateHeight = this.handleResizeDimension({
|
|
3645
|
-
resizeState,
|
|
3646
|
-
dimension: "height",
|
|
3647
|
-
delta: deltaY,
|
|
3648
|
-
canResize: canResizeHeight,
|
|
3649
|
-
mode: heightMode,
|
|
3650
|
-
position: resizeState.resizedPosition
|
|
3651
|
-
});
|
|
3652
|
-
if (updateWidth) updateWidth();
|
|
3653
|
-
if (updateHeight) updateHeight();
|
|
3654
|
-
this._activeResizes.set(sourceId, resizeState);
|
|
3655
|
-
}
|
|
3656
|
-
pendingResize(sourceId) {
|
|
3657
|
-
const resizeState = this._activeResizes.get(sourceId);
|
|
3658
|
-
if (!resizeState) return null;
|
|
3659
|
-
return {
|
|
3660
|
-
width: resizeState.widthToUpdate,
|
|
3661
|
-
height: resizeState.heightToUpdate
|
|
3662
|
-
};
|
|
3663
|
-
}
|
|
3664
|
-
get hasAnyPendingResize() {
|
|
3665
|
-
return Array.from(this._activeResizes.values()).some((state) => state.widthToUpdate || state.heightToUpdate);
|
|
3666
|
-
}
|
|
3667
|
-
get pendingResizes() {
|
|
3668
|
-
return Array.from(this._activeResizes.values()).filter((state) => !state.isApplyingResize);
|
|
3669
|
-
}
|
|
3670
|
-
applyResize(selectorId) {
|
|
3671
|
-
const sourceId = this.root.editStore?.runtimeTrackingStore.getSourceId(selectorId);
|
|
3672
|
-
const type = (this.root.editStore?.runtimeTrackingStore.getComponent(selectorId))?.type;
|
|
3673
|
-
if (!type) return;
|
|
3674
|
-
const resizeState = sourceId && this._activeResizes.get(sourceId);
|
|
3675
|
-
if (!resizeState) return;
|
|
3676
|
-
resizeState.isApplyingResize = true;
|
|
3677
|
-
const properties = {
|
|
3678
|
-
...resizeState.heightToUpdate && type !== "Icon" && { height: Property$1.Dimension(resizeState.heightToUpdate) },
|
|
3679
|
-
...resizeState.widthToUpdate && type !== "Icon" && { width: Property$1.Dimension(resizeState.widthToUpdate) },
|
|
3680
|
-
...resizeState.widthToUpdate && type === "Icon" && { size: Property$1.Dimension(resizeState.widthToUpdate) }
|
|
3681
|
-
};
|
|
3682
|
-
if (Object.keys(properties).length > 0) this.root.editStore?.operationManager.setWidgetProperties({
|
|
3683
|
-
sourceId: resizeState.sourceId,
|
|
3684
|
-
properties,
|
|
3685
|
-
callback: () => {
|
|
3686
|
-
this._activeResizes.delete(sourceId);
|
|
3687
|
-
}
|
|
3688
|
-
});
|
|
3689
|
-
}
|
|
3690
|
-
};
|
|
3691
|
-
//#endregion
|
|
3692
2829
|
//#region src/edit-mode/features/ui-store.ts
|
|
3693
2830
|
const MULTI_SELECT_ENABLED = false;
|
|
3694
2831
|
var UIStore = class {
|
|
3695
|
-
resizing;
|
|
3696
2832
|
_selectedSourceIds = [];
|
|
3697
2833
|
_selectedSelectorIds = [];
|
|
3698
2834
|
_focusedSelectorId = null;
|
|
@@ -3701,7 +2837,6 @@ var UIStore = class {
|
|
|
3701
2837
|
constructor(root, editStore) {
|
|
3702
2838
|
this.root = root;
|
|
3703
2839
|
this.editStore = editStore;
|
|
3704
|
-
this.resizing = new ResizingManager(root);
|
|
3705
2840
|
makeObservable(this, {
|
|
3706
2841
|
_selectedSourceIds: observable,
|
|
3707
2842
|
_selectedSelectorIds: observable,
|
|
@@ -3709,6 +2844,7 @@ var UIStore = class {
|
|
|
3709
2844
|
setSelectedSourceIds: action,
|
|
3710
2845
|
setSelectedSelectorIds: action,
|
|
3711
2846
|
setFocusedIds: action,
|
|
2847
|
+
selectSource: action,
|
|
3712
2848
|
selectWidget: action
|
|
3713
2849
|
});
|
|
3714
2850
|
}
|
|
@@ -3758,19 +2894,8 @@ var UIStore = class {
|
|
|
3758
2894
|
}
|
|
3759
2895
|
setSelectedSourceIds(sourceIds) {
|
|
3760
2896
|
this.newComponentSelectPromise?.cancel();
|
|
3761
|
-
this.subscribeNewSourceIdsToRuntimeSync(sourceIds);
|
|
3762
2897
|
this._selectedSourceIds = sourceIds;
|
|
3763
2898
|
}
|
|
3764
|
-
subscribeNewSourceIdsToRuntimeSync(sourceIds) {
|
|
3765
|
-
const previousSourceIds = new Set(this._selectedSourceIds);
|
|
3766
|
-
const newSourceIds = new Set(sourceIds);
|
|
3767
|
-
previousSourceIds.forEach((sourceId) => {
|
|
3768
|
-
if (!newSourceIds.has(sourceId)) this.editStore.runtimeSubscriptionsStore.unsubscribe(sourceId);
|
|
3769
|
-
});
|
|
3770
|
-
newSourceIds.forEach((sourceId) => {
|
|
3771
|
-
if (!previousSourceIds.has(sourceId)) this.editStore.runtimeSubscriptionsStore.subscribe(sourceId);
|
|
3772
|
-
});
|
|
3773
|
-
}
|
|
3774
2899
|
setSelectedSelectorIds(selectorIds) {
|
|
3775
2900
|
this.newComponentSelectPromise?.cancel();
|
|
3776
2901
|
this._selectedSelectorIds = selectorIds;
|
|
@@ -3778,6 +2903,20 @@ var UIStore = class {
|
|
|
3778
2903
|
setFocusedIds(selectorId) {
|
|
3779
2904
|
this._focusedSelectorId = selectorId;
|
|
3780
2905
|
}
|
|
2906
|
+
selectSource(sourceId) {
|
|
2907
|
+
const selectorIds = this.getMostRelevantSelectorIdsForSourceId(sourceId);
|
|
2908
|
+
if (!sourceId || selectorIds.length === 0) {
|
|
2909
|
+
this.setSelectedSourceIds([]);
|
|
2910
|
+
this.setSelectedSelectorIds([]);
|
|
2911
|
+
this.setFocusedIds(null);
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
if (!this.isSourceSelected(sourceId)) {
|
|
2915
|
+
this.setSelectedSourceIds([sourceId]);
|
|
2916
|
+
this.setSelectedSelectorIds(selectorIds);
|
|
2917
|
+
this.setFocusedIds(selectorIds[0]);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
3781
2920
|
selectWidget(selectorId, _addToSelection = false) {
|
|
3782
2921
|
this.newComponentSelectPromise?.cancel();
|
|
3783
2922
|
const addToSelection = _addToSelection && MULTI_SELECT_ENABLED;
|
|
@@ -3787,17 +2926,13 @@ var UIStore = class {
|
|
|
3787
2926
|
editorBridge.selectWidgets([]);
|
|
3788
2927
|
this.setSelectedSourceIds([]);
|
|
3789
2928
|
this.setSelectedSelectorIds([]);
|
|
3790
|
-
this.editStore.propertiesPanelManager.untrackPropertiesPanel();
|
|
3791
|
-
if (this.editStore.interactionMode === "design") this.editStore.setDesignModeLocked(false);
|
|
3792
2929
|
return;
|
|
3793
2930
|
}
|
|
3794
2931
|
const sourceIds = addToSelection ? [...this._selectedSourceIds, sourceId] : [sourceId];
|
|
3795
2932
|
const selectorIds = addToSelection ? [...this._selectedSelectorIds, selectorId] : [selectorId];
|
|
3796
2933
|
this.setSelectedSourceIds(sourceIds);
|
|
3797
2934
|
this.setSelectedSelectorIds(selectorIds);
|
|
3798
|
-
this.editStore.propertiesPanelManager.trackPropertiesPanel(selectorId);
|
|
3799
2935
|
editorBridge.selectWidgets(sourceIds, selectorId);
|
|
3800
|
-
if (this.editStore.interactionMode === "design") this.editStore.setDesignModeLocked(true);
|
|
3801
2936
|
}
|
|
3802
2937
|
/**
|
|
3803
2938
|
* This is cursed because component selection actually needs to be done by instance ids, but
|
|
@@ -3815,129 +2950,6 @@ var UIStore = class {
|
|
|
3815
2950
|
}
|
|
3816
2951
|
};
|
|
3817
2952
|
//#endregion
|
|
3818
|
-
//#region src/edit-mode/runtime-sync/builders.ts
|
|
3819
|
-
const MAX_SUBTREE_DEPTH = 30;
|
|
3820
|
-
function buildComposite(editStore, params) {
|
|
3821
|
-
const { sourceId } = params;
|
|
3822
|
-
const runtimeStore = editStore.runtimeTrackingStore;
|
|
3823
|
-
const selectorIds = editStore.ui.getMostRelevantSelectorIdsForSourceId(sourceId);
|
|
3824
|
-
if (selectorIds.length === 0) return null;
|
|
3825
|
-
const selectorId = selectorIds[0];
|
|
3826
|
-
const componentNode = runtimeStore.getComponent(selectorId);
|
|
3827
|
-
if (!componentNode) return null;
|
|
3828
|
-
const component = {
|
|
3829
|
-
selectorId: componentNode.selectorId,
|
|
3830
|
-
sourceId: componentNode.sourceId,
|
|
3831
|
-
type: getComponentType(componentNode),
|
|
3832
|
-
displayName: runtimeStore.getDisplayName(selectorId),
|
|
3833
|
-
isSbComponent: componentNode.isSbComponent,
|
|
3834
|
-
isHtmlElement: componentNode.isHtmlElement,
|
|
3835
|
-
props: componentNode.props
|
|
3836
|
-
};
|
|
3837
|
-
const parentSelectorId = runtimeStore.getComponentParent(selectorId);
|
|
3838
|
-
return {
|
|
3839
|
-
component,
|
|
3840
|
-
parent: parentSelectorId ? buildComponentData(runtimeStore, parentSelectorId) : null,
|
|
3841
|
-
children: buildChildren(runtimeStore, selectorId),
|
|
3842
|
-
path: buildPathToRoot(runtimeStore, selectorId),
|
|
3843
|
-
subtree: buildSubtreeNode(runtimeStore, selectorId, MAX_SUBTREE_DEPTH) ?? void 0
|
|
3844
|
-
};
|
|
3845
|
-
}
|
|
3846
|
-
function buildComponentData(store, selectorId) {
|
|
3847
|
-
const componentNode = store.getComponent(selectorId);
|
|
3848
|
-
if (!componentNode) return null;
|
|
3849
|
-
return {
|
|
3850
|
-
selectorId: componentNode.selectorId,
|
|
3851
|
-
sourceId: componentNode.sourceId,
|
|
3852
|
-
type: getComponentType(componentNode),
|
|
3853
|
-
displayName: store.getDisplayName(selectorId),
|
|
3854
|
-
isSbComponent: componentNode.isSbComponent,
|
|
3855
|
-
isHtmlElement: componentNode.isHtmlElement,
|
|
3856
|
-
props: componentNode.props
|
|
3857
|
-
};
|
|
3858
|
-
}
|
|
3859
|
-
function buildChildren(store, selectorId) {
|
|
3860
|
-
return store.getComponentChildren(selectorId).map((childId) => buildComponentData(store, childId)).filter(Boolean);
|
|
3861
|
-
}
|
|
3862
|
-
function buildPathToRoot(store, selectorId) {
|
|
3863
|
-
const path = [];
|
|
3864
|
-
let current = selectorId;
|
|
3865
|
-
const visited = /* @__PURE__ */ new Set();
|
|
3866
|
-
while (current && !visited.has(current)) {
|
|
3867
|
-
visited.add(current);
|
|
3868
|
-
const component = store.getComponent(current);
|
|
3869
|
-
if (component && !component.noSelect) path.unshift({
|
|
3870
|
-
selectorId: component.selectorId,
|
|
3871
|
-
sourceId: component.sourceId,
|
|
3872
|
-
displayName: store.getDisplayName(current),
|
|
3873
|
-
type: getComponentType(component)
|
|
3874
|
-
});
|
|
3875
|
-
current = store.getComponentParent(current);
|
|
3876
|
-
}
|
|
3877
|
-
if (current && visited.has(current)) console.warn(`[RuntimeSync] Cycle detected in component graph at ${current}`);
|
|
3878
|
-
return path;
|
|
3879
|
-
}
|
|
3880
|
-
function buildSubtreeNode(store, selectorId, remainingDepth) {
|
|
3881
|
-
const component = store.getComponent(selectorId);
|
|
3882
|
-
if (!component) return null;
|
|
3883
|
-
const children = [];
|
|
3884
|
-
if (remainingDepth > 0) {
|
|
3885
|
-
const childSelectorIds = store.getComponentChildren(selectorId);
|
|
3886
|
-
for (const childId of childSelectorIds) {
|
|
3887
|
-
const childNode = buildSubtreeNode(store, childId, remainingDepth - 1);
|
|
3888
|
-
if (childNode) children.push(childNode);
|
|
3889
|
-
}
|
|
3890
|
-
}
|
|
3891
|
-
return {
|
|
3892
|
-
selectorId,
|
|
3893
|
-
sourceId: component.sourceId,
|
|
3894
|
-
displayName: store.getDisplayName(selectorId),
|
|
3895
|
-
type: getComponentType(component),
|
|
3896
|
-
children
|
|
3897
|
-
};
|
|
3898
|
-
}
|
|
3899
|
-
function getComponentType(component) {
|
|
3900
|
-
if (typeof component.type === "function") return component.type.name;
|
|
3901
|
-
if (typeof component.type === "string") return component.type;
|
|
3902
|
-
return "Component";
|
|
3903
|
-
}
|
|
3904
|
-
//#endregion
|
|
3905
|
-
//#region src/edit-mode/runtime-sync/runtime-subscriptions-store.ts
|
|
3906
|
-
/**
|
|
3907
|
-
* MobX store that manages runtime component subscriptions.
|
|
3908
|
-
* Tracks which components are subscribed and builds fresh composites on-demand.
|
|
3909
|
-
* The subscriptions getter allows startEditorSync reactions to track deep observables
|
|
3910
|
-
* from buildComposite, eliminating the need for manual reaction management.
|
|
3911
|
-
*/
|
|
3912
|
-
var RuntimeSubscriptionsStore = class {
|
|
3913
|
-
subscribedSourceIds = observable.set();
|
|
3914
|
-
constructor(editStore) {
|
|
3915
|
-
this.editStore = editStore;
|
|
3916
|
-
makeAutoObservable(this, {
|
|
3917
|
-
subscribe: action,
|
|
3918
|
-
unsubscribe: action,
|
|
3919
|
-
clearAll: action,
|
|
3920
|
-
subscriptions: computed
|
|
3921
|
-
});
|
|
3922
|
-
}
|
|
3923
|
-
subscribe(sourceId) {
|
|
3924
|
-
this.subscribedSourceIds.add(sourceId);
|
|
3925
|
-
}
|
|
3926
|
-
unsubscribe(sourceId) {
|
|
3927
|
-
this.subscribedSourceIds.delete(sourceId);
|
|
3928
|
-
}
|
|
3929
|
-
clearAll() {
|
|
3930
|
-
this.subscribedSourceIds.clear();
|
|
3931
|
-
}
|
|
3932
|
-
get subscriptions() {
|
|
3933
|
-
const out = {};
|
|
3934
|
-
this.subscribedSourceIds.forEach((sourceId) => {
|
|
3935
|
-
out[sourceId] = buildComposite(this.editStore, { sourceId });
|
|
3936
|
-
});
|
|
3937
|
-
return out;
|
|
3938
|
-
}
|
|
3939
|
-
};
|
|
3940
|
-
//#endregion
|
|
3941
2953
|
//#region src/edit-mode/edit-store.ts
|
|
3942
2954
|
const isSessionRecordingEnabled = () => {
|
|
3943
2955
|
return window._SB_ENABLE_SESSION_RECORDING ?? false;
|
|
@@ -3945,62 +2957,37 @@ const isSessionRecordingEnabled = () => {
|
|
|
3945
2957
|
var EditStore = class {
|
|
3946
2958
|
ui;
|
|
3947
2959
|
operationManager;
|
|
3948
|
-
propertiesPanelManager;
|
|
3949
2960
|
runtimeTrackingStore;
|
|
3950
2961
|
connectionManager;
|
|
3951
2962
|
ai;
|
|
3952
|
-
runtimeSubscriptionsStore;
|
|
3953
2963
|
isInitialized = false;
|
|
3954
2964
|
recordingInitialized = false;
|
|
3955
2965
|
interactionMode = "interactive";
|
|
3956
2966
|
lastInteractionMode = "interactive";
|
|
3957
|
-
isDesignModeLocked = false;
|
|
3958
|
-
designModeDisabled = false;
|
|
3959
2967
|
viteMessageListeners = /* @__PURE__ */ new Map();
|
|
3960
2968
|
constructor(rootStore) {
|
|
3961
2969
|
this.ui = new UIStore(rootStore, this);
|
|
3962
2970
|
this.operationManager = new OperationManager();
|
|
3963
|
-
this.propertiesPanelManager = new PropertiesPanelManager(this, rootStore.componentRegistry);
|
|
3964
2971
|
this.runtimeTrackingStore = new RuntimeTrackingStore(this);
|
|
3965
|
-
this.runtimeSubscriptionsStore = new RuntimeSubscriptionsStore(this);
|
|
3966
2972
|
this.connectionManager = new ConnectionManager();
|
|
3967
2973
|
this.ai = new AiManager(this.runtimeTrackingStore);
|
|
3968
2974
|
makeObservable(this, {
|
|
3969
2975
|
isInitialized: observable,
|
|
3970
2976
|
interactionMode: observable,
|
|
3971
|
-
isDesignModeLocked: observable,
|
|
3972
|
-
designModeDisabled: observable,
|
|
3973
2977
|
setIsInitialized: action,
|
|
3974
|
-
setInteractionMode: action
|
|
3975
|
-
setDesignModeLocked: action,
|
|
3976
|
-
setDesignModeDisabled: action
|
|
2978
|
+
setInteractionMode: action
|
|
3977
2979
|
});
|
|
3978
2980
|
}
|
|
3979
2981
|
setIsInitialized(isInitialized) {
|
|
3980
2982
|
if (this.isInitialized) return;
|
|
3981
2983
|
this.isInitialized = isInitialized;
|
|
3982
|
-
if (isInitialized) startEditorSync({
|
|
3983
|
-
store: this.runtimeSubscriptionsStore,
|
|
3984
|
-
storeId: "runtimeSync",
|
|
3985
|
-
projection: (store) => store.subscriptions
|
|
3986
|
-
});
|
|
3987
|
-
}
|
|
3988
|
-
setDesignModeDisabled(disabled) {
|
|
3989
|
-
this.designModeDisabled = disabled;
|
|
3990
|
-
if (disabled && this.lastInteractionMode === "design") this.lastInteractionMode = "interactive";
|
|
3991
2984
|
}
|
|
3992
2985
|
setInteractionMode(mode, notifyEditor = false) {
|
|
3993
|
-
if (this.designModeDisabled && mode === "design") mode = "interactive";
|
|
3994
2986
|
if (this.interactionMode === mode) return;
|
|
3995
2987
|
this.lastInteractionMode = this.interactionMode;
|
|
3996
2988
|
this.interactionMode = mode;
|
|
3997
|
-
if (mode === "design") this.isDesignModeLocked = false;
|
|
3998
|
-
else if (this.lastInteractionMode === "design") this.isDesignModeLocked = false;
|
|
3999
2989
|
if (notifyEditor) editorBridge.setInteractionMode(mode);
|
|
4000
2990
|
}
|
|
4001
|
-
setDesignModeLocked(locked) {
|
|
4002
|
-
this.isDesignModeLocked = locked;
|
|
4003
|
-
}
|
|
4004
2991
|
onViteMessage(kind, callback) {
|
|
4005
2992
|
this.viteMessageListeners.set(kind, [...this.viteMessageListeners.get(kind) || [], callback]);
|
|
4006
2993
|
return () => {
|
|
@@ -4355,7 +3342,7 @@ function convertPercentageInTransform(transformValue, width, height) {
|
|
|
4355
3342
|
//#endregion
|
|
4356
3343
|
//#region src/edit-mode/interaction-layer/interaction-rect.tsx
|
|
4357
3344
|
const useSelectionElements = (params) => {
|
|
4358
|
-
const { focusedSelectorId, selectedSourceIds, selectedSelectorIds, targetedSourceIds, aiContextMode
|
|
3345
|
+
const { focusedSelectorId, selectedSourceIds, selectedSelectorIds, targetedSourceIds, aiContextMode } = params;
|
|
4359
3346
|
const visibleTargetedComponents = useMemo(() => {
|
|
4360
3347
|
const components = [];
|
|
4361
3348
|
targetedSourceIds.forEach((sourceId) => {
|
|
@@ -4380,7 +3367,7 @@ const useSelectionElements = (params) => {
|
|
|
4380
3367
|
});
|
|
4381
3368
|
});
|
|
4382
3369
|
selectedSourceIds.forEach((sourceId) => {
|
|
4383
|
-
|
|
3370
|
+
selectedSelectorIds.forEach((selectorId) => {
|
|
4384
3371
|
const component = getEditStore().runtimeTrackingStore.getComponent(selectorId);
|
|
4385
3372
|
if (component && !targetedSourceIds.includes(component.sourceId)) {
|
|
4386
3373
|
const displayName = getEditStore().runtimeTrackingStore.getDisplayName(selectorId);
|
|
@@ -4394,11 +3381,11 @@ const useSelectionElements = (params) => {
|
|
|
4394
3381
|
}
|
|
4395
3382
|
});
|
|
4396
3383
|
});
|
|
4397
|
-
if (focusedSelectorId &&
|
|
3384
|
+
if (focusedSelectorId && aiContextMode === AiContextMode.AUTO_SELECT) {
|
|
4398
3385
|
const { type, displayName, sourceId } = selectDisplayNameAndVisibility(focusedSelectorId);
|
|
4399
3386
|
if (sourceId) selectedRects.push({
|
|
4400
3387
|
selectorId: focusedSelectorId,
|
|
4401
|
-
sourceId
|
|
3388
|
+
sourceId,
|
|
4402
3389
|
displayName,
|
|
4403
3390
|
selectionType: "FOCUSED",
|
|
4404
3391
|
type
|
|
@@ -4411,8 +3398,7 @@ const useSelectionElements = (params) => {
|
|
|
4411
3398
|
selectedSelectorIds,
|
|
4412
3399
|
focusedSelectorId,
|
|
4413
3400
|
aiContextMode,
|
|
4414
|
-
targetedSourceIds
|
|
4415
|
-
interactionMode
|
|
3401
|
+
targetedSourceIds
|
|
4416
3402
|
]);
|
|
4417
3403
|
};
|
|
4418
3404
|
const InteractionRectTargetBorder = ({ selectorId }) => {
|
|
@@ -4541,16 +3527,6 @@ function EditorHotkeys({ children }) {
|
|
|
4541
3527
|
enableOnTags: ["TEXTAREA", "INPUT"],
|
|
4542
3528
|
enableOnContentEditable: true
|
|
4543
3529
|
});
|
|
4544
|
-
useEditorHotkeys("command+d, ctrl+d", (e) => {
|
|
4545
|
-
e.preventDefault();
|
|
4546
|
-
e.stopPropagation();
|
|
4547
|
-
const editStore = getEditStore();
|
|
4548
|
-
editorBridge.setAiContextMode(AiContextMode.SILENT);
|
|
4549
|
-
editStore.setInteractionMode("design", true);
|
|
4550
|
-
}, {
|
|
4551
|
-
enableOnTags: ["TEXTAREA", "INPUT"],
|
|
4552
|
-
enableOnContentEditable: true
|
|
4553
|
-
});
|
|
4554
3530
|
useEditorHotkeys("esc", (e) => {
|
|
4555
3531
|
e.preventDefault();
|
|
4556
3532
|
e.stopPropagation();
|
|
@@ -4569,7 +3545,7 @@ function EditorHotkeys({ children }) {
|
|
|
4569
3545
|
editStore.ui.selectWidget(null);
|
|
4570
3546
|
editorBridge.setAiContextMode(AiContextMode.SILENT);
|
|
4571
3547
|
const lastInteractionMode = editStore.lastInteractionMode;
|
|
4572
|
-
if (editStore.interactionMode === "interactive"
|
|
3548
|
+
if (editStore.interactionMode === "interactive") editStore.setInteractionMode("full-preview", true);
|
|
4573
3549
|
else editStore.setInteractionMode(lastInteractionMode, true);
|
|
4574
3550
|
}, {
|
|
4575
3551
|
enableOnTags: [
|
|
@@ -4812,7 +3788,7 @@ function installEditModeErrorCapture(deps = {}) {
|
|
|
4812
3788
|
//#endregion
|
|
4813
3789
|
//#region src/edit-mode/screenshot-handler.ts
|
|
4814
3790
|
let cleanupCallback$1 = void 0;
|
|
4815
|
-
const MAX_SCREENSHOT_DIMENSION =
|
|
3791
|
+
const MAX_SCREENSHOT_DIMENSION = 1568;
|
|
4816
3792
|
const SCREENSHOT_WEBP_QUALITY = .8;
|
|
4817
3793
|
const MAX_SCREENSHOT_BYTES = 256 * 1024;
|
|
4818
3794
|
/** Decreasing webp qualities tried, in order, to fit {@link MAX_SCREENSHOT_BYTES}. */
|
|
@@ -5174,25 +4150,17 @@ function initializeTaggedElementMetadataHandler() {
|
|
|
5174
4150
|
let _setReloadKey;
|
|
5175
4151
|
let latestConnectionStartTime;
|
|
5176
4152
|
if (import.meta.hot) {
|
|
5177
|
-
console.debug("[internal] [iframe-wrappers] registering reload listeners");
|
|
5178
4153
|
import.meta.hot.on("sb:force-remount-after-reload", () => {
|
|
5179
4154
|
tracker.dontSkipUntilNextReload();
|
|
5180
4155
|
_setReloadKey?.((currentKey) => currentKey + 1);
|
|
5181
4156
|
});
|
|
5182
4157
|
import.meta.hot.on("vite:beforeFullReload", () => {
|
|
5183
4158
|
if (!isEmbeddedBySuperblocksFirstParty()) return;
|
|
5184
|
-
console.debug("[internal] [iframe-wrappers] vite:beforeFullReload");
|
|
5185
4159
|
editorBridge.sendAppFrameWillReload();
|
|
5186
4160
|
});
|
|
5187
4161
|
import.meta.hot.on("vite:beforeUpdate", (args) => {
|
|
5188
4162
|
try {
|
|
5189
|
-
|
|
5190
|
-
const pathStr = paths.join(", ");
|
|
5191
|
-
console.debug("[internal] [iframe-wrappers] vite:beforeUpdate", pathStr);
|
|
5192
|
-
if (paths.some((path) => path.includes("server/apis/index.ts")) && isEditMode() && root_store_default.sdkApiEnabled) {
|
|
5193
|
-
console.debug("[internal] [iframe-wrappers] API registry updated, re-discovering APIs");
|
|
5194
|
-
discoverAndRegisterSdkApis();
|
|
5195
|
-
}
|
|
4163
|
+
if ((args?.updates ?? []).map((update) => update.path).some((path) => path.includes("server/apis/index.ts")) && isEditMode() && root_store_default.sdkApiEnabled) discoverAndRegisterSdkApis();
|
|
5196
4164
|
} catch (error) {
|
|
5197
4165
|
console.warn("[internal] [iframe-wrappers] vite:beforeUpdate error:", error);
|
|
5198
4166
|
}
|
|
@@ -5203,7 +4171,6 @@ if (isEditMode()) {
|
|
|
5203
4171
|
const setupInitializer = () => {
|
|
5204
4172
|
if (!isEmbeddedBySuperblocksFirstParty()) return;
|
|
5205
4173
|
const handleInit = async ({ data }) => {
|
|
5206
|
-
console.debug("[internal] [iframe-wrappers] handling sb-init");
|
|
5207
4174
|
latestConnectionStartTime = data.payload.connectionStartTime;
|
|
5208
4175
|
if (data.payload.windowOriginUrl) initTracerProviderWithOrigin(data.payload.windowOriginUrl);
|
|
5209
4176
|
initializeEditStore();
|
|
@@ -5218,7 +4185,7 @@ if (isEditMode()) {
|
|
|
5218
4185
|
editStore.ai.startEditing();
|
|
5219
4186
|
if (aiState.editingComponents) editStore.ai.setEditingComponents(aiState.editingComponents);
|
|
5220
4187
|
}
|
|
5221
|
-
if (interactionMode) editStore.setInteractionMode(interactionMode);
|
|
4188
|
+
if (interactionMode) editStore.setInteractionMode(normalizeInteractionMode(interactionMode));
|
|
5222
4189
|
if (data.payload.sessionRecordingKey && data.payload.userId && data.payload.appId) editStore.startRecording({
|
|
5223
4190
|
userId: data.payload.userId,
|
|
5224
4191
|
appId: data.payload.appId,
|
|
@@ -5293,7 +4260,6 @@ const IframeConnected = observer(function IframeConnected(props) {
|
|
|
5293
4260
|
const [reloadKey, setReloadKey] = useState(0);
|
|
5294
4261
|
_setReloadKey = setReloadKey;
|
|
5295
4262
|
useEffect(() => {
|
|
5296
|
-
console.debug("[internal] [iframe-wrappers] sending ready");
|
|
5297
4263
|
editorBridge.sendReady(latestConnectionStartTime);
|
|
5298
4264
|
}, []);
|
|
5299
4265
|
useEffect(() => {
|
|
@@ -5315,10 +4281,7 @@ const IframeConnected = observer(function IframeConnected(props) {
|
|
|
5315
4281
|
const connectionStatus = root_store_default.editStore?.connectionManager.connectionStatus;
|
|
5316
4282
|
if (connectionStatus === "pre-init" || connectionStatus === "connecting") return /* @__PURE__ */ jsx(FullPageSpinner, {});
|
|
5317
4283
|
if (isPossiblyEditor && root_store_default.editStore?.isInitialized && typeof window !== "undefined") return /* @__PURE__ */ jsx(React.Fragment, { children: props.children }, reloadKey);
|
|
5318
|
-
if (isEditMode())
|
|
5319
|
-
console.log("In edit mode, but editor has not initialized yet");
|
|
5320
|
-
return null;
|
|
5321
|
-
}
|
|
4284
|
+
if (isEditMode()) return null;
|
|
5322
4285
|
return /* @__PURE__ */ jsx(React.Fragment, { children: props.children }, reloadKey);
|
|
5323
4286
|
});
|
|
5324
4287
|
const WithUserWrapper$1 = (props) => {
|
|
@@ -5368,60 +4331,18 @@ const EmbedWrapper$2 = (props) => {
|
|
|
5368
4331
|
if (event.data.payload.dpRoutingConfig) root_store_default.apis.dpRoutingConfig = event.data.payload.dpRoutingConfig;
|
|
5369
4332
|
};
|
|
5370
4333
|
iframeMessageHandler.addEventListener("sb-update-active-agents", updateActiveAgentsListener);
|
|
5371
|
-
const
|
|
4334
|
+
const selectSourceListener = (event) => {
|
|
5372
4335
|
const sourceId = event.data.payload.sourceId;
|
|
5373
|
-
|
|
5374
|
-
if (!sourceId || selectorIds.length === 0) {
|
|
5375
|
-
getEditStore().ui.setSelectedSourceIds([]);
|
|
5376
|
-
getEditStore().ui.setSelectedSelectorIds([]);
|
|
5377
|
-
getEditStore().ui.setFocusedIds(null);
|
|
5378
|
-
return;
|
|
5379
|
-
}
|
|
5380
|
-
if (!getEditStore().ui.isSourceSelected(sourceId)) {
|
|
5381
|
-
getEditStore().ui.setSelectedSourceIds([sourceId]);
|
|
5382
|
-
getEditStore().ui.setSelectedSelectorIds(Array.from(selectorIds));
|
|
5383
|
-
getEditStore().ui.setFocusedIds(Array.from(selectorIds)[0]);
|
|
5384
|
-
}
|
|
5385
|
-
getEditStore().propertiesPanelManager.trackPropertiesPanel(selectorIds[0]);
|
|
4336
|
+
getEditStore().ui.selectSource(sourceId);
|
|
5386
4337
|
};
|
|
5387
|
-
iframeMessageHandler.addEventListener("sb-
|
|
4338
|
+
iframeMessageHandler.addEventListener("sb-select-source", selectSourceListener);
|
|
5388
4339
|
const editOperationAcknowledgeListener = (event) => {
|
|
5389
4340
|
getEditStore().operationManager.acknowledgeEditOperation(event.data.payload);
|
|
5390
4341
|
};
|
|
5391
4342
|
iframeMessageHandler.addEventListener("sb-edit-operation-acknowledge", editOperationAcknowledgeListener);
|
|
5392
|
-
const updatePropertyWithEffectsListener = (event) => {
|
|
5393
|
-
const payload = {
|
|
5394
|
-
sourceId: event.data.payload.sourceId,
|
|
5395
|
-
updates: event.data.payload.updates
|
|
5396
|
-
};
|
|
5397
|
-
const propUpdates = getEditStore().propertiesPanelManager.computeAndApplySideEffectsForPropertyUpdate(payload);
|
|
5398
|
-
editorBridge.resolvePromise(event.data.payload.callbackId, propUpdates);
|
|
5399
|
-
editorBridge.resolvePromise(event.data.payload.callbackId, payload.updates);
|
|
5400
|
-
Object.keys(propUpdates).forEach((sourceId) => {
|
|
5401
|
-
getEditStore().operationManager.writeRuntimeProperties(sourceId, event.data.payload.transaction.id, propUpdates[sourceId]);
|
|
5402
|
-
});
|
|
5403
|
-
getEditStore().operationManager.writeRuntimeProperties(payload.sourceId, event.data.payload.transaction.id, payload.updates);
|
|
5404
|
-
};
|
|
5405
|
-
iframeMessageHandler.addEventListener("sb-update-property-with-effects", updatePropertyWithEffectsListener);
|
|
5406
|
-
const createComponentListener = async (event) => {
|
|
5407
|
-
const { componentType, parent, scopeName, baseProperties, skipSecondaryComponentsCreation, otherComponentsUpdates } = event.data.payload;
|
|
5408
|
-
try {
|
|
5409
|
-
await createComponent({
|
|
5410
|
-
componentType,
|
|
5411
|
-
parent,
|
|
5412
|
-
scopeName,
|
|
5413
|
-
baseProperties,
|
|
5414
|
-
skipSecondaryComponentsCreation,
|
|
5415
|
-
otherComponentsUpdates
|
|
5416
|
-
});
|
|
5417
|
-
} catch (error) {
|
|
5418
|
-
console.error("Failed to create component:", error);
|
|
5419
|
-
}
|
|
5420
|
-
};
|
|
5421
|
-
iframeMessageHandler.addEventListener("sb-create-component", createComponentListener);
|
|
5422
4343
|
const setInteractionModeListener = async (event) => {
|
|
5423
4344
|
const { interactionMode } = event.data.payload;
|
|
5424
|
-
root_store_default.editStore?.setInteractionMode(interactionMode);
|
|
4345
|
+
root_store_default.editStore?.setInteractionMode(normalizeInteractionMode(interactionMode));
|
|
5425
4346
|
};
|
|
5426
4347
|
iframeMessageHandler.addEventListener("set-interaction-mode", setInteractionModeListener);
|
|
5427
4348
|
const aiUpdatesListener = (event) => {
|
|
@@ -5454,13 +4375,8 @@ const EmbedWrapper$2 = (props) => {
|
|
|
5454
4375
|
iframeMessageHandler.removeEventListener("sb-bootstrap-response", bootstrapResponseListener);
|
|
5455
4376
|
iframeMessageHandler.removeEventListener("sb-update-active-agents", updateActiveAgentsListener);
|
|
5456
4377
|
iframeMessageHandler.removeEventListener("sb-edit-operation-acknowledge", editOperationAcknowledgeListener);
|
|
5457
|
-
iframeMessageHandler.removeEventListener("sb-
|
|
5458
|
-
iframeMessageHandler.removeEventListener("sb-retrieve-property-panel-props", retrievePropertyPanelPropsListener);
|
|
5459
|
-
iframeMessageHandler.removeEventListener("sb-create-component", createComponentListener);
|
|
4378
|
+
iframeMessageHandler.removeEventListener("sb-select-source", selectSourceListener);
|
|
5460
4379
|
iframeMessageHandler.removeEventListener("ai-updates", aiUpdatesListener);
|
|
5461
|
-
try {
|
|
5462
|
-
getEditStore().runtimeSubscriptionsStore.clearAll();
|
|
5463
|
-
} catch {}
|
|
5464
4380
|
};
|
|
5465
4381
|
}, []);
|
|
5466
4382
|
useEmbedMessageListeners(navigate, superblocksContext);
|
|
@@ -5488,18 +4404,6 @@ const EmbedWrapper$2 = (props) => {
|
|
|
5488
4404
|
}
|
|
5489
4405
|
case "RUN_API": {
|
|
5490
4406
|
const { apiName, traceHeaders, callId, isTestRun, inputs } = action.payload;
|
|
5491
|
-
console.debug("[internal] [iframe-wrappers] Received RUN_API:", {
|
|
5492
|
-
apiName,
|
|
5493
|
-
callId
|
|
5494
|
-
});
|
|
5495
|
-
console.log("[iframe-wrappers] Received RUN_API:", {
|
|
5496
|
-
apiName,
|
|
5497
|
-
callId,
|
|
5498
|
-
isTestRun,
|
|
5499
|
-
hasInputs: !!inputs,
|
|
5500
|
-
inputs,
|
|
5501
|
-
traceHeaders
|
|
5502
|
-
});
|
|
5503
4407
|
if (root_store_default.sdkApiEnabled) {
|
|
5504
4408
|
const executionId = generateId();
|
|
5505
4409
|
const inputRecord = inputs ?? {};
|
|
@@ -5557,37 +4461,30 @@ const EmbedWrapper$2 = (props) => {
|
|
|
5557
4461
|
}
|
|
5558
4462
|
});
|
|
5559
4463
|
});
|
|
5560
|
-
} else if (isTestRun) {
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
inputs
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
});
|
|
5572
|
-
}
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
},
|
|
5585
|
-
callId,
|
|
5586
|
-
isTestRun: false
|
|
5587
|
-
}).catch((error) => {
|
|
5588
|
-
console.error(`Failed to run API ${apiName}:`, error);
|
|
5589
|
-
});
|
|
5590
|
-
}
|
|
4464
|
+
} else if (isTestRun) root_store_default.apis.runApiByPath({
|
|
4465
|
+
path: getApiPath(apiName),
|
|
4466
|
+
inputs: {
|
|
4467
|
+
...traceHeaders,
|
|
4468
|
+
...inputs
|
|
4469
|
+
},
|
|
4470
|
+
isTestRun: true
|
|
4471
|
+
}).catch((error) => {
|
|
4472
|
+
console.error(`Failed to test API ${apiName}:`, error);
|
|
4473
|
+
});
|
|
4474
|
+
else if (callId) root_store_default.apis.rerunApiByCallId(callId).catch((error) => {
|
|
4475
|
+
console.error(`Failed to re-run API with callId ${callId}:`, error);
|
|
4476
|
+
});
|
|
4477
|
+
else root_store_default.apis.runApiByPath({
|
|
4478
|
+
path: getApiPath(apiName),
|
|
4479
|
+
inputs: {
|
|
4480
|
+
...traceHeaders,
|
|
4481
|
+
...inputs
|
|
4482
|
+
},
|
|
4483
|
+
callId,
|
|
4484
|
+
isTestRun: false
|
|
4485
|
+
}).catch((error) => {
|
|
4486
|
+
console.error(`Failed to run API ${apiName}:`, error);
|
|
4487
|
+
});
|
|
5591
4488
|
break;
|
|
5592
4489
|
}
|
|
5593
4490
|
}
|
|
@@ -5848,12 +4745,9 @@ function getElementsInScope(containerElement, allElements, editStore) {
|
|
|
5848
4745
|
}
|
|
5849
4746
|
function useWidgetHover() {
|
|
5850
4747
|
const editStore = getEditStore();
|
|
5851
|
-
const interactionMode = editStore.interactionMode;
|
|
5852
4748
|
const aiContextMode = editStore.ai.getAiContextMode();
|
|
5853
4749
|
useEffect(() => {
|
|
5854
|
-
|
|
5855
|
-
const isTargetMode = aiContextMode === AiContextMode.AUTO_SELECT;
|
|
5856
|
-
if (!isDesignMode && !isTargetMode) return;
|
|
4750
|
+
if (aiContextMode !== AiContextMode.AUTO_SELECT) return;
|
|
5857
4751
|
const rootElement = document.body;
|
|
5858
4752
|
const handleMouseMove = (event) => {
|
|
5859
4753
|
const selectorId = getMostRelevantWidgetAtPoint({
|
|
@@ -5874,11 +4768,7 @@ function useWidgetHover() {
|
|
|
5874
4768
|
rootElement?.removeEventListener("mousemove", throttledHandleMouseMove);
|
|
5875
4769
|
rootElement?.removeEventListener("mouseleave", handleMouseLeave);
|
|
5876
4770
|
};
|
|
5877
|
-
}, [
|
|
5878
|
-
interactionMode,
|
|
5879
|
-
aiContextMode,
|
|
5880
|
-
editStore.ui
|
|
5881
|
-
]);
|
|
4771
|
+
}, [aiContextMode, editStore.ui]);
|
|
5882
4772
|
}
|
|
5883
4773
|
function useWidgetClick() {
|
|
5884
4774
|
useEffect(() => {
|
|
@@ -5899,27 +4789,19 @@ function useWidgetClick() {
|
|
|
5899
4789
|
});
|
|
5900
4790
|
if (!selectorId) return;
|
|
5901
4791
|
const component = editStore.runtimeTrackingStore.getComponent(selectorId);
|
|
5902
|
-
if (!component)
|
|
5903
|
-
console.log("[internal] [useWidgetClick] No component found for selectorId");
|
|
5904
|
-
return;
|
|
5905
|
-
}
|
|
4792
|
+
if (!component) return;
|
|
5906
4793
|
const sourceId = component.sourceId;
|
|
5907
4794
|
const { displayName } = selectDisplayNameAndVisibility(selectorId);
|
|
5908
|
-
|
|
5909
|
-
if (editStore.interactionMode === "design" || isTargettingComponent) {
|
|
4795
|
+
if (editStore.ai.shouldToggleComponentInAiContext() || event.altKey) {
|
|
5910
4796
|
event.preventDefault();
|
|
5911
4797
|
event.stopPropagation();
|
|
5912
|
-
}
|
|
5913
|
-
if (isTargettingComponent) {
|
|
5914
|
-
console.log("[internal] [useWidgetClick] Toggling component in AI context");
|
|
5915
4798
|
editorBridge.toggleComponentInAiContext(sourceId, selectorId, displayName);
|
|
5916
4799
|
return;
|
|
5917
4800
|
}
|
|
5918
4801
|
editStore.ui.selectWidget(selectorId, event.shiftKey === true);
|
|
5919
4802
|
};
|
|
5920
4803
|
const handlePointerDown = (event) => {
|
|
5921
|
-
|
|
5922
|
-
if ((editStore.interactionMode === "design" || isTargetMode) && !isInsideInteractionLayer(event.target)) {
|
|
4804
|
+
if (editStore.ai.shouldToggleComponentInAiContext() && !isInsideInteractionLayer(event.target)) {
|
|
5923
4805
|
event.preventDefault();
|
|
5924
4806
|
event.stopPropagation();
|
|
5925
4807
|
}
|
|
@@ -5934,15 +4816,13 @@ function useWidgetClick() {
|
|
|
5934
4816
|
}
|
|
5935
4817
|
const InteractionLayer = observer(({ containerElement, layerId }) => {
|
|
5936
4818
|
const editStore = getEditStore();
|
|
5937
|
-
const interactionMode = editStore.interactionMode;
|
|
5938
4819
|
const allSelectedElements = useSelectionElements({
|
|
5939
4820
|
focusedSourceId: editStore.ui.getFocusedSourceId(),
|
|
5940
4821
|
focusedSelectorId: editStore.ui.getFocusedSelectorId(),
|
|
5941
4822
|
selectedSelectorIds: editStore.ui.getSelectedSelectorIds(),
|
|
5942
4823
|
selectedSourceIds: editStore.ui.getSelectedSourceIds(),
|
|
5943
4824
|
targetedSourceIds: editStore.ai.getTargetedComponents(),
|
|
5944
|
-
aiContextMode: editStore.ai.getAiContextMode()
|
|
5945
|
-
interactionMode
|
|
4825
|
+
aiContextMode: editStore.ai.getAiContextMode()
|
|
5946
4826
|
});
|
|
5947
4827
|
const selectedElementsInScope = React.useMemo(() => getElementsInScope(containerElement, allSelectedElements, editStore), [
|
|
5948
4828
|
containerElement,
|
|
@@ -5967,14 +4847,10 @@ const InteractionLayer = observer(({ containerElement, layerId }) => {
|
|
|
5967
4847
|
container.remove();
|
|
5968
4848
|
setPortalContainer(null);
|
|
5969
4849
|
};
|
|
5970
|
-
}, [
|
|
5971
|
-
containerElement,
|
|
5972
|
-
layerId,
|
|
5973
|
-
editStore.interactionMode
|
|
5974
|
-
]);
|
|
4850
|
+
}, [containerElement, layerId]);
|
|
5975
4851
|
if (!portalContainer) return null;
|
|
5976
4852
|
return ReactDOM.createPortal(/* @__PURE__ */ jsx("div", {
|
|
5977
|
-
style:
|
|
4853
|
+
style: { "--primary-rect-color": "#0087E0" },
|
|
5978
4854
|
children: interactionRectsForSelectedElements
|
|
5979
4855
|
}), portalContainer);
|
|
5980
4856
|
});
|
|
@@ -6024,49 +4900,16 @@ const InteractionLayerManager = observer(() => {
|
|
|
6024
4900
|
}, layerId);
|
|
6025
4901
|
}) });
|
|
6026
4902
|
});
|
|
6027
|
-
function useGlobalContextMenu() {
|
|
6028
|
-
useEffect(() => {
|
|
6029
|
-
const rootElement = document.body;
|
|
6030
|
-
const handleContextMenu = (event) => {
|
|
6031
|
-
if (event.defaultPrevented) return;
|
|
6032
|
-
if (!rootElement) return;
|
|
6033
|
-
const editStore = getEditStore();
|
|
6034
|
-
const isDesignMode = editStore.interactionMode === "design";
|
|
6035
|
-
const isTargetMode = editStore.ai.shouldToggleComponentInAiContext();
|
|
6036
|
-
if (!isDesignMode || isTargetMode) return;
|
|
6037
|
-
const selectorId = getMostRelevantWidgetAtPoint({
|
|
6038
|
-
x: event.clientX,
|
|
6039
|
-
y: event.clientY,
|
|
6040
|
-
rootElement
|
|
6041
|
-
});
|
|
6042
|
-
if (!selectorId) return;
|
|
6043
|
-
const component = editStore.runtimeTrackingStore.getComponent(selectorId);
|
|
6044
|
-
if (!component) return;
|
|
6045
|
-
const sourceId = component.sourceId;
|
|
6046
|
-
event.preventDefault();
|
|
6047
|
-
event.stopPropagation();
|
|
6048
|
-
editorBridge.registerContextMenuClick(sourceId, selectorId, event.clientX, event.clientY);
|
|
6049
|
-
};
|
|
6050
|
-
rootElement?.addEventListener("contextmenu", handleContextMenu, { capture: true });
|
|
6051
|
-
return () => {
|
|
6052
|
-
rootElement?.removeEventListener("contextmenu", handleContextMenu, { capture: true });
|
|
6053
|
-
};
|
|
6054
|
-
}, []);
|
|
6055
|
-
}
|
|
6056
4903
|
const ExternalInteractionLayer = observer(() => {
|
|
6057
4904
|
const isEditStoreInitialized = Boolean(root_store_default.editStore?.isInitialized);
|
|
6058
|
-
useGlobalContextMenu();
|
|
6059
|
-
const isDesignMode = root_store_default.editStore?.interactionMode === "design";
|
|
6060
4905
|
const isTargetMode = root_store_default.editStore?.ai.shouldToggleComponentInAiContext();
|
|
6061
4906
|
const isHighlightMode = root_store_default.editStore?.ai.getAiContextMode() === AiContextMode.HIGHLIGHT;
|
|
6062
4907
|
const hasSelectedWidget = (root_store_default.editStore?.ui.getSelectedSourceIds().length ?? 0) > 0;
|
|
6063
|
-
if (!(isEditStoreInitialized && (
|
|
6064
|
-
const pencilCursor = `url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.12" d="M11.8703 5.81338C10.8293 5.47941 10.0738 4.50819 10.0626 3.35904L10.7109 2.71072C11.4229 1.99876 12.5772 1.99877 13.2892 2.71075C14.0011 3.42272 14.0011 4.57702 13.2892 5.28897L13.2083 5.36988C12.8412 5.73698 12.3436 5.9652 11.8703 5.81338Z" fill="black" stroke="black" stroke-width="0.125"/><path d="M10.0001 3.33308L4.18981 9.14329C3.6314 9.7017 3.25077 10.4129 3.0959 11.1873L2.66675 13.333L4.8125 12.9039C5.58686 12.749 6.29806 12.3684 6.85646 11.81L12.6667 5.99967M10.0001 3.33308L10.6668 2.66633C11.4032 1.92996 12.5971 1.92997 13.3335 2.66636V2.66636C14.0698 3.40273 14.0698 4.59661 13.3335 5.33297L12.6667 5.99967M10.0001 3.33308C10.0001 4.8058 11.194 5.99967 12.6667 5.99967" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M10.0001 3.33308L4.18981 9.14329C3.6314 9.7017 3.25077 10.4129 3.0959 11.1873L2.66675 13.333L4.8125 12.9039C5.58686 12.749 6.29806 12.3684 6.85646 11.81L12.6667 5.99967M10.0001 3.33308L10.6668 2.66633C11.4032 1.92996 12.5971 1.92997 13.3335 2.66636V2.66636C14.0698 3.40273 14.0698 4.59661 13.3335 5.33297L12.6667 5.99967M10.0001 3.33308C10.0001 4.8058 11.194 5.99967 12.6667 5.99967" stroke="black" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>') 0 16, auto`;
|
|
4908
|
+
if (!(isEditStoreInitialized && (isTargetMode || isHighlightMode || hasSelectedWidget))) return null;
|
|
6065
4909
|
const targetCursor = `url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.12" fill-rule="evenodd" clip-rule="evenodd" d="M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM8 9.26316C8.69762 9.26316 9.26316 8.69762 9.26316 8C9.26316 7.30238 8.69762 6.73684 8 6.73684C7.30238 6.73684 6.73684 7.30238 6.73684 8C6.73684 8.69762 7.30238 9.26316 8 9.26316Z" fill="black"/><path d="M14 8C14 11.3137 11.3137 14 8 14M14 8C14 4.68629 11.3137 2 8 2M14 8H12M8 14C4.68629 14 2 11.3137 2 8M8 14V12M2 8C2 4.68629 4.68629 2 8 2M2 8H4M8 2V4M9.26316 8C9.26316 8.69762 8.69762 9.26316 8 9.26316C7.30238 9.26316 6.73684 8.69762 6.73684 8C6.73684 7.30238 7.30238 6.73684 8 6.73684C8.69762 6.73684 9.26316 7.30238 9.26316 8Z" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M14 8C14 11.3137 11.3137 14 8 14M14 8C14 4.68629 11.3137 2 8 2M14 8H12M8 14C4.68629 14 2 11.3137 2 8M8 14V12M2 8C2 4.68629 4.68629 2 8 2M2 8H4M8 2V4M9.26316 8C9.26316 8.69762 8.69762 9.26316 8 9.26316C7.30238 9.26316 6.73684 8.69762 6.73684 8C6.73684 7.30238 7.30238 6.73684 8 6.73684C8.69762 6.73684 9.26316 7.30238 9.26316 8Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/></svg>') 8 8, auto`;
|
|
6066
4910
|
let cursorStyle = "";
|
|
6067
4911
|
if (isTargetMode) cursorStyle = `* { cursor: ${targetCursor} !important; }`;
|
|
6068
|
-
|
|
6069
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(InteractionLayerManager, {}), cursorStyle && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: cursorStyle } })] });
|
|
4912
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(InteractionLayerManager, {}), cursorStyle && /* @__PURE__ */ jsx("style", { children: cursorStyle })] });
|
|
6070
4913
|
});
|
|
6071
4914
|
//#endregion
|
|
6072
4915
|
//#region src/lib/internal-details/request-bootstrap.ts
|
|
@@ -6454,10 +5297,7 @@ const SbProvider = function SbProvider({ name = "codemode", children, className,
|
|
|
6454
5297
|
initializeStyles(name);
|
|
6455
5298
|
}, [name]);
|
|
6456
5299
|
useEffect(() => {
|
|
6457
|
-
if (isEditMode())
|
|
6458
|
-
initializeCSSVariables();
|
|
6459
|
-
reportSbProviderRenderedEditMode();
|
|
6460
|
-
}
|
|
5300
|
+
if (isEditMode()) reportSbProviderRenderedEditMode();
|
|
6461
5301
|
}, []);
|
|
6462
5302
|
if (!isApisInitialized) return /* @__PURE__ */ jsx(FullPageSpinner, {});
|
|
6463
5303
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -6479,6 +5319,12 @@ const editorConfig = {
|
|
|
6479
5319
|
isDraggable: false
|
|
6480
5320
|
};
|
|
6481
5321
|
//#endregion
|
|
5322
|
+
//#region src/lib/user-facing/properties-panel/mixins/styles-category.ts
|
|
5323
|
+
/** @deprecated Accepted for source compatibility. Returns an empty section. */
|
|
5324
|
+
const tailwindStylesCategory = (_props) => {
|
|
5325
|
+
return Section.category(PropsCategory.Appearance);
|
|
5326
|
+
};
|
|
5327
|
+
//#endregion
|
|
6482
5328
|
//#region src/lib/user-facing/components/app/props.ts
|
|
6483
5329
|
const propertiesDefinition = {
|
|
6484
5330
|
contents: Section.category(PropsCategory.Content).children({ children: Prop.jsx() }),
|
|
@@ -7343,11 +6189,11 @@ const Title = styled.h3`
|
|
|
7343
6189
|
margin-bottom: 0.5rem;
|
|
7344
6190
|
`;
|
|
7345
6191
|
const ErrorMessage = styled.p`
|
|
7346
|
-
color: ${colors
|
|
6192
|
+
color: ${colors.GREY_500};
|
|
7347
6193
|
`;
|
|
7348
6194
|
const Button = styled.button`
|
|
7349
|
-
border: 1px solid ${colors
|
|
7350
|
-
color: ${colors
|
|
6195
|
+
border: 1px solid ${colors.GREY_100};
|
|
6196
|
+
color: ${colors.GREY_600};
|
|
7351
6197
|
border-radius: 6px;
|
|
7352
6198
|
padding: 2px 6px;
|
|
7353
6199
|
font-size: 1rem;
|
|
@@ -7355,7 +6201,7 @@ const Button = styled.button`
|
|
|
7355
6201
|
cursor: pointer;
|
|
7356
6202
|
|
|
7357
6203
|
&:hover {
|
|
7358
|
-
background-color: ${colors
|
|
6204
|
+
background-color: ${colors.GREY_100};
|
|
7359
6205
|
}
|
|
7360
6206
|
`;
|
|
7361
6207
|
const ErrorComponent = ({ title, errorMessage, buttonText, handleButtonClick, errorCode, buttonPath, image: overrideImage, secondaryButtonAction, secondaryButtonText, hideActions }) => {
|