@superblocksteam/library 2.0.42-next.9 → 2.0.43-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/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +312 -306
- package/dist/index.js.map +1 -1
- package/dist/{logs-ivxzrJPP.js → logs-DDh7Anxs.js} +10 -11
- package/dist/{logs-ivxzrJPP.js.map → logs-DDh7Anxs.js.map} +1 -1
- package/dist/root-store-4FotQ8o2.js +4 -0
- package/dist/{root-store-mvrXQD3h.js → root-store-DSXdJ9lh.js} +193 -45
- package/dist/root-store-DSXdJ9lh.js.map +1 -0
- package/package.json +3 -3
- package/dist/root-store-DbFURfA3.js +0 -4
- package/dist/root-store-mvrXQD3h.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { early_console_buffer_default } from "./early-console-buffer-DWTLgla0.js";
|
|
2
|
-
import { CLASS_NAMES, DEFAULT_ANONYMOUS_SOURCE_ID, DevTools, EventFlow, GLOBAL_SCOPE_ID, LazyFunction, NavigationEvent, Prop, PropsPanelCategory, RecordProp, Section, VALIDATORS, addNewPromise, colors, createInternalPropsList, createManagedPropsList, createPropertiesPanelDefinition, editorBridge, generateId, getEditStore, getName, iframeMessageHandler, isEditMode, isEmbeddedBySuperblocksFirstParty, isLocalLink, isName, isNameEqual, navigation, rejectById, resolveById, root_store_default, run_event_handlers_default, sendNotification, startEditorSync, system_error_default } from "./root-store-
|
|
2
|
+
import { CLASS_NAMES, DEFAULT_ANONYMOUS_SOURCE_ID, DevTools, EventFlow, FileManager, GLOBAL_SCOPE_ID, LazyFunction, NavigationEvent, Prop, PropsPanelCategory, RecordProp, Section, VALIDATORS, addNewPromise, colors, createInternalPropsList, createManagedPropsList, createPropertiesPanelDefinition, editorBridge, generateId, getEditStore, getFileWithUploadId, getName, iframeMessageHandler, isEditMode, isEmbeddedBySuperblocksFirstParty, isLocalLink, isName, isNameEqual, navigation, rejectById, resolveById, root_store_default, run_event_handlers_default, sendNotification, startEditorSync, system_error_default } from "./root-store-DSXdJ9lh.js";
|
|
3
3
|
import "./utils-CCBWAYIM.js";
|
|
4
4
|
import { AiContextMode, AiGenerationState, BindingMetaSymbol, SbEntityType, StateVarPersistence, StateVarPersistence as StateVarPersistence$1, ThemeMode, TriggerStepType, ViteMessageKind, isValidStepDef, sbEntitySymbol } from "@superblocksteam/library-shared/types";
|
|
5
5
|
import _, { get, isEmpty, isEqual, isNumber, isObject, merge, set, throttle } from "lodash";
|
|
@@ -21,9 +21,9 @@ import { snapCenterToCursor } from "@dnd-kit/modifiers";
|
|
|
21
21
|
import { Root, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger } from "@radix-ui/react-tooltip";
|
|
22
22
|
import tinycolor from "tinycolor2";
|
|
23
23
|
import { APCAcontrast, sRGBtoY } from "apca-w3";
|
|
24
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
24
25
|
import posthog from "posthog-js";
|
|
25
26
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
26
|
-
import * as Dialog from "@radix-ui/react-dialog";
|
|
27
27
|
import equal from "@superblocksteam/fast-deep-equal/es6";
|
|
28
28
|
import copy from "copy-to-clipboard";
|
|
29
29
|
import downloadjs from "downloadjs";
|
|
@@ -1221,8 +1221,7 @@ const cyrb53 = (str, seed = 0) => {
|
|
|
1221
1221
|
const styleWithPrefix = (prefix) => (strings, ...params) => {
|
|
1222
1222
|
const style = String.raw(strings, ...params);
|
|
1223
1223
|
const namespace = prefix + cyrb53(style).toString(36);
|
|
1224
|
-
|
|
1225
|
-
insertStyleRule(parsed);
|
|
1224
|
+
insertStyleRule(serialize(compile(`.${namespace}{${style}}`), middleware([prefixer, stringify])));
|
|
1226
1225
|
return namespace;
|
|
1227
1226
|
};
|
|
1228
1227
|
const styleAsClass = styleWithPrefix("s");
|
|
@@ -2056,14 +2055,13 @@ Section.category(PropsPanelCategory.Layout).add({
|
|
|
2056
2055
|
});
|
|
2057
2056
|
const InternalStack = observer(({ direction = "column", spacing: spacing$1, children, shouldScrollContents: shouldScrollContents$1, className,...props }) => {
|
|
2058
2057
|
const { height, width,...rest } = props;
|
|
2059
|
-
const combinedClassName = [...useStackClasses({
|
|
2060
|
-
direction,
|
|
2061
|
-
verticalAlign: props.verticalAlign,
|
|
2062
|
-
horizontalAlign: props.horizontalAlign,
|
|
2063
|
-
shouldScrollContents: shouldScrollContents$1
|
|
2064
|
-
}), className].filter(Boolean).join(" ");
|
|
2065
2058
|
return /* @__PURE__ */ jsx("div", {
|
|
2066
|
-
className:
|
|
2059
|
+
className: [...useStackClasses({
|
|
2060
|
+
direction,
|
|
2061
|
+
verticalAlign: props.verticalAlign,
|
|
2062
|
+
horizontalAlign: props.horizontalAlign,
|
|
2063
|
+
shouldScrollContents: shouldScrollContents$1
|
|
2064
|
+
}), className].filter(Boolean).join(" "),
|
|
2067
2065
|
...rest,
|
|
2068
2066
|
ref: props.dropTargetRef,
|
|
2069
2067
|
children
|
|
@@ -2175,9 +2173,8 @@ const InternalContainer = (props) => {
|
|
|
2175
2173
|
style,
|
|
2176
2174
|
shouldApplyEmptyContainerMinHeight
|
|
2177
2175
|
]);
|
|
2178
|
-
const classes = useMemo(() => [...componentClasses, props.className].join(" "), [componentClasses, props.className]);
|
|
2179
2176
|
return /* @__PURE__ */ jsx(StyledContainerWrapper, {
|
|
2180
|
-
className:
|
|
2177
|
+
className: useMemo(() => [...componentClasses, props.className].join(" "), [componentClasses, props.className]),
|
|
2181
2178
|
style: containerStyle,
|
|
2182
2179
|
...passThroughProps,
|
|
2183
2180
|
"data-container-layout": props.layout,
|
|
@@ -2672,6 +2669,8 @@ const ErrorMessage$1 = styled.p`
|
|
|
2672
2669
|
line-height: 1.5715;
|
|
2673
2670
|
text-align: center;
|
|
2674
2671
|
flex-shrink: 0;
|
|
2672
|
+
margin-top: 0;
|
|
2673
|
+
margin-bottom: 16px;
|
|
2675
2674
|
`;
|
|
2676
2675
|
const ErrorDetails = styled.details`
|
|
2677
2676
|
margin-top: 24px;
|
|
@@ -2683,6 +2682,7 @@ const ErrorDetails = styled.details`
|
|
|
2683
2682
|
0px 0px 1px 0px #22272f52,
|
|
2684
2683
|
0px 1px 3px 0px #22272f1f;
|
|
2685
2684
|
flex-shrink: 0;
|
|
2685
|
+
font-family: Inter;
|
|
2686
2686
|
|
|
2687
2687
|
&[open] summary {
|
|
2688
2688
|
margin-bottom: 12px;
|
|
@@ -2828,9 +2828,10 @@ const FixWithClarkButtonContainer = styled.button`
|
|
|
2828
2828
|
cursor: not-allowed;
|
|
2829
2829
|
}
|
|
2830
2830
|
`;
|
|
2831
|
-
function FixWithClarkButton({ identifier, error }) {
|
|
2832
|
-
const isAiEditing = root_store_default.editStore?.ai.getIsEditing();
|
|
2831
|
+
function FixWithClarkButton({ identifier, error, onClick }) {
|
|
2832
|
+
const isAiEditing = root_store_default.editStore?.ai.getIsEditing() ?? false;
|
|
2833
2833
|
const handleFixWithAi = () => {
|
|
2834
|
+
onClick?.();
|
|
2834
2835
|
if (identifier) editorBridge.addComponentToAiContext(identifier.sourceId, identifier.instanceId);
|
|
2835
2836
|
const prompt = buildRuntimeErrorPrompt(error);
|
|
2836
2837
|
editorBridge.aiGenerate(prompt, true);
|
|
@@ -3136,13 +3137,10 @@ const ShimmerDiv = styled.div`
|
|
|
3136
3137
|
*/
|
|
3137
3138
|
function SuspenseFallback({ style, noBorderRadius }) {
|
|
3138
3139
|
const { theme } = useTheme$1();
|
|
3139
|
-
const backgroundColor = theme?.colors?.neutral50 || "#f8f9fa";
|
|
3140
|
-
const shimmerHighlight = theme?.colors?.neutral100 || "#ffffff";
|
|
3141
|
-
const borderRadius$1 = noBorderRadius ? "0px" : theme?.borderRadius.value + theme?.borderRadius.mode;
|
|
3142
3140
|
return /* @__PURE__ */ jsx(ShimmerDiv, {
|
|
3143
|
-
$backgroundColor:
|
|
3144
|
-
$shimmerHighlight:
|
|
3145
|
-
$borderRadius: borderRadius
|
|
3141
|
+
$backgroundColor: theme?.colors?.neutral50 || "#f8f9fa",
|
|
3142
|
+
$shimmerHighlight: theme?.colors?.neutral100 || "#ffffff",
|
|
3143
|
+
$borderRadius: noBorderRadius ? "0px" : theme?.borderRadius.value + theme?.borderRadius.mode,
|
|
3146
3144
|
style: style?.(),
|
|
3147
3145
|
className: CSS_CLASSES.ANCHOR_NAME,
|
|
3148
3146
|
"data-test": "suspense-fallback"
|
|
@@ -3679,8 +3677,7 @@ const DropLayer = observer((props) => {
|
|
|
3679
3677
|
const isDropTargetStackLike = editStore.ui.dnd.isDropTargetStackLike;
|
|
3680
3678
|
const dropTargetId = editStore.ui.dnd.dropTargetId;
|
|
3681
3679
|
const isDropTargetInInteractionLayer = doesInteractionLayerContainInstance(props.rootInstanceId, dropTargetId);
|
|
3682
|
-
|
|
3683
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [possibleStackDrop && /* @__PURE__ */ jsx(StackDropPreview, {}), /* @__PURE__ */ jsx(DragOverlay, {
|
|
3680
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [editStore.ui.dnd.isDragging && isDropTargetInInteractionLayer && Boolean(draggedWidgetType && dropTargetWidgetType) && isDropTargetStackLike && /* @__PURE__ */ jsx(StackDropPreview, {}), /* @__PURE__ */ jsx(DragOverlay, {
|
|
3684
3681
|
modifiers: [snapCenterToCursor],
|
|
3685
3682
|
dropAnimation: null
|
|
3686
3683
|
})] });
|
|
@@ -3891,9 +3888,8 @@ function InteractionRectActions(props) {
|
|
|
3891
3888
|
const isAiTaggingEnabled = getEditStore().ai.getIsTaggingEnabled();
|
|
3892
3889
|
const shouldHideActions = !isPrimaryInstanceId;
|
|
3893
3890
|
const shouldShowAddToChatButton = isAiTaggingEnabled && (aiContextMode === AiContextMode.SILENT || aiContextMode === AiContextMode.HIGHLIGHT && type !== "TARGETED");
|
|
3894
|
-
const shouldShowAiPurplePill = isAiTaggingEnabled && (aiContextMode === AiContextMode.AUTO_SELECT || aiContextMode === AiContextMode.HIGHLIGHT && type === "TARGETED");
|
|
3895
3891
|
return /* @__PURE__ */ jsxs("div", {
|
|
3896
|
-
className: `sb-edit-interaction-rect-actions ${
|
|
3892
|
+
className: `sb-edit-interaction-rect-actions ${isAiTaggingEnabled && (aiContextMode === AiContextMode.AUTO_SELECT || aiContextMode === AiContextMode.HIGHLIGHT && type === "TARGETED") ? "sb-edit-actions-target-mode" : ""}`,
|
|
3897
3893
|
"data-sb-actions-id": instanceId,
|
|
3898
3894
|
style: {
|
|
3899
3895
|
...shouldHideActions ? { display: "none !important" } : {},
|
|
@@ -4136,7 +4132,7 @@ const useWidgetErrors = (params) => {
|
|
|
4136
4132
|
};
|
|
4137
4133
|
const useSelectionElements = (params) => {
|
|
4138
4134
|
const { focusedInstanceId, selectedInstanceIds, targetedSourceIds, aiContextMode, rootId } = params;
|
|
4139
|
-
const
|
|
4135
|
+
const visibleTargetedComponents = useViewportIntersection(useMemo(() => {
|
|
4140
4136
|
const components = [];
|
|
4141
4137
|
targetedSourceIds.forEach((sourceId) => {
|
|
4142
4138
|
const sourceInstanceIds = getEditStore().runtimeEntitiesManager.widgets.getAllInstanceIdsForSourceId(sourceId);
|
|
@@ -4146,8 +4142,7 @@ const useSelectionElements = (params) => {
|
|
|
4146
4142
|
})));
|
|
4147
4143
|
});
|
|
4148
4144
|
return components;
|
|
4149
|
-
}, [targetedSourceIds, rootId]);
|
|
4150
|
-
const visibleTargetedComponents = useViewportIntersection(allTargetedComponents);
|
|
4145
|
+
}, [targetedSourceIds, rootId]));
|
|
4151
4146
|
return useObserverMemo(() => {
|
|
4152
4147
|
const selectedRects = [];
|
|
4153
4148
|
visibleTargetedComponents.forEach((component) => {
|
|
@@ -4405,28 +4400,26 @@ const InteractionLayer = observer((props) => {
|
|
|
4405
4400
|
}, [handleCanvasClick]);
|
|
4406
4401
|
const isAiEditing = editStore.ai.getIsEditing();
|
|
4407
4402
|
if (!isActive || isAiEditing) return null;
|
|
4408
|
-
const interactionRectsForSelectedElements = selectedElements.filter((info) => {
|
|
4409
|
-
const id = getEditWrapperIdWithType(info.instanceId, info.type);
|
|
4410
|
-
const element = document.querySelector(`[data-sb-selector="${id}"]`);
|
|
4411
|
-
return !isComponentTypeDetached(info.type) && element != null;
|
|
4412
|
-
}).map((info, index) => {
|
|
4413
|
-
return /* @__PURE__ */ jsx(InteractionRect, {
|
|
4414
|
-
isDragging: editStore.ui.dnd.isDragging,
|
|
4415
|
-
...info
|
|
4416
|
-
}, info.instanceId + info.selectionType + index);
|
|
4417
|
-
});
|
|
4418
|
-
const interactionRectIfDetachedComponent = isComponentTypeDetached(props.rootType) ? /* @__PURE__ */ jsx(InteractionRect, {
|
|
4419
|
-
isDragging: false,
|
|
4420
|
-
selectionType: "FOCUSED",
|
|
4421
|
-
instanceId: props.rootInstanceId,
|
|
4422
|
-
displayName: props.rootName ?? "Unknown",
|
|
4423
|
-
hideRectBorder: false
|
|
4424
|
-
}, props.rootInstanceId) : null;
|
|
4425
4403
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", {
|
|
4426
4404
|
className: "sb-interaction-layer-wrapper",
|
|
4427
4405
|
children: [
|
|
4428
|
-
|
|
4429
|
-
|
|
4406
|
+
selectedElements.filter((info) => {
|
|
4407
|
+
const id = getEditWrapperIdWithType(info.instanceId, info.type);
|
|
4408
|
+
const element = document.querySelector(`[data-sb-selector="${id}"]`);
|
|
4409
|
+
return !isComponentTypeDetached(info.type) && element != null;
|
|
4410
|
+
}).map((info, index) => {
|
|
4411
|
+
return /* @__PURE__ */ jsx(InteractionRect, {
|
|
4412
|
+
isDragging: editStore.ui.dnd.isDragging,
|
|
4413
|
+
...info
|
|
4414
|
+
}, info.instanceId + info.selectionType + index);
|
|
4415
|
+
}),
|
|
4416
|
+
isComponentTypeDetached(props.rootType) ? /* @__PURE__ */ jsx(InteractionRect, {
|
|
4417
|
+
isDragging: false,
|
|
4418
|
+
selectionType: "FOCUSED",
|
|
4419
|
+
instanceId: props.rootInstanceId,
|
|
4420
|
+
displayName: props.rootName ?? "Unknown",
|
|
4421
|
+
hideRectBorder: false
|
|
4422
|
+
}, props.rootInstanceId) : null,
|
|
4430
4423
|
Object.entries(widgetWithErrors).map(([id, { name }]) => /* @__PURE__ */ jsx(InteractionRect, {
|
|
4431
4424
|
isDragging: false,
|
|
4432
4425
|
selectionType: "ERROR",
|
|
@@ -4791,9 +4784,7 @@ function getRgbArrayFromHex(hex) {
|
|
|
4791
4784
|
];
|
|
4792
4785
|
}
|
|
4793
4786
|
function chooseContrastTextColor(primaryColor) {
|
|
4794
|
-
|
|
4795
|
-
const darkContrast = checkContrast(DARK_MODE_NEUTRALS[0], primaryColor);
|
|
4796
|
-
return whiteContrast >= darkContrast - CONTRAST_TEXT_THRESHOLD ? LIGHT_MODE_NEUTRALS[0] : DARK_MODE_NEUTRALS[0];
|
|
4787
|
+
return checkContrast(LIGHT_MODE_NEUTRALS[0], primaryColor) >= checkContrast(DARK_MODE_NEUTRALS[0], primaryColor) - CONTRAST_TEXT_THRESHOLD ? LIGHT_MODE_NEUTRALS[0] : DARK_MODE_NEUTRALS[0];
|
|
4797
4788
|
}
|
|
4798
4789
|
function checkContrast(foreground, background) {
|
|
4799
4790
|
const textColor = getRgbArrayFromHex(foreground);
|
|
@@ -4816,11 +4807,10 @@ const getPrimaryVariants = (primaryColor, neutralColor) => {
|
|
|
4816
4807
|
const shouldLighten = tinycolor(primaryColor).isDark();
|
|
4817
4808
|
const primary500 = neutralColor ? adjustForReadability(primaryColor, neutralColor) : primaryColor;
|
|
4818
4809
|
const primary600 = shouldLighten ? tinycolor(primary500).lighten(10).toHexString() : tinycolor(primary500).darken(10).toHexString();
|
|
4819
|
-
const primary700 = shouldLighten ? tinycolor(primary600).lighten(5).toHexString() : tinycolor(primary600).darken(5).toHexString();
|
|
4820
4810
|
return {
|
|
4821
4811
|
primary500,
|
|
4822
4812
|
primary600,
|
|
4823
|
-
primary700
|
|
4813
|
+
primary700: shouldLighten ? tinycolor(primary600).lighten(5).toHexString() : tinycolor(primary600).darken(5).toHexString()
|
|
4824
4814
|
};
|
|
4825
4815
|
};
|
|
4826
4816
|
function generateThemeColors({ themePrimaryColor, palette, isDarkMode }) {
|
|
@@ -4922,7 +4912,7 @@ function generateTheme(userDefinedTheme, overrides, overrideMode) {
|
|
|
4922
4912
|
fontFamily: typeFace,
|
|
4923
4913
|
textColor: { default: generatedColors.neutral700 }
|
|
4924
4914
|
};
|
|
4925
|
-
|
|
4915
|
+
return merge({
|
|
4926
4916
|
version: 5,
|
|
4927
4917
|
colors: generatedColors,
|
|
4928
4918
|
fontFamily: typeFace,
|
|
@@ -5475,8 +5465,7 @@ function generateTheme(userDefinedTheme, overrides, overrideMode) {
|
|
|
5475
5465
|
disabled: generatedColors.neutral300,
|
|
5476
5466
|
error: generatedColors.danger
|
|
5477
5467
|
} } }
|
|
5478
|
-
};
|
|
5479
|
-
return merge(theme, overrides);
|
|
5468
|
+
}, overrides);
|
|
5480
5469
|
}
|
|
5481
5470
|
|
|
5482
5471
|
//#endregion
|
|
@@ -5990,8 +5979,7 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, onClose
|
|
|
5990
5979
|
root_store_default.editStore?.connectionManager.initializeSocket();
|
|
5991
5980
|
try {
|
|
5992
5981
|
let stopSocketHeartbeat;
|
|
5993
|
-
const
|
|
5994
|
-
const isocket = new ISocketWithClientAuth(ws, void 0, {
|
|
5982
|
+
const socket = createISocketClient(new ISocketWithClientAuth(await connectWebSocket(wsUrl.toString()), void 0, {
|
|
5995
5983
|
nonVisualEdit: [async () => {
|
|
5996
5984
|
getEditStore().ui.selectWidget(null);
|
|
5997
5985
|
}],
|
|
@@ -6080,8 +6068,7 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, onClose
|
|
|
6080
6068
|
connectionTimeoutInSeconds: void 0,
|
|
6081
6069
|
noResponseTimeoutInSeconds: 60
|
|
6082
6070
|
}
|
|
6083
|
-
});
|
|
6084
|
-
const socket = createISocketClient(isocket);
|
|
6071
|
+
}));
|
|
6085
6072
|
console.log("connected to socket");
|
|
6086
6073
|
stopSocketHeartbeat = startSocketHeartbeat(socket);
|
|
6087
6074
|
root_store_default.editStore?.connectionManager.connect();
|
|
@@ -6125,11 +6112,9 @@ function generateAndSendComponentDocs(options) {
|
|
|
6125
6112
|
//#endregion
|
|
6126
6113
|
//#region src/lib/internal-details/identifier-normalizer.ts
|
|
6127
6114
|
const getNormalizedIdInfo = (params) => {
|
|
6128
|
-
const name = params.bind?.entityName;
|
|
6129
|
-
const scopeId = params.bind?.scopeId ?? params.fallbackScopeId;
|
|
6130
6115
|
return {
|
|
6131
|
-
name,
|
|
6132
|
-
scopeId
|
|
6116
|
+
name: params.bind?.entityName,
|
|
6117
|
+
scopeId: params.bind?.scopeId ?? params.fallbackScopeId
|
|
6133
6118
|
};
|
|
6134
6119
|
};
|
|
6135
6120
|
|
|
@@ -6719,6 +6704,241 @@ function useGetCurrentUserQuery() {
|
|
|
6719
6704
|
}, []);
|
|
6720
6705
|
}
|
|
6721
6706
|
|
|
6707
|
+
//#endregion
|
|
6708
|
+
//#region src/edit-mode/build-error-notification.tsx
|
|
6709
|
+
const ModalOverlay = styled(Dialog.Overlay)`
|
|
6710
|
+
position: fixed;
|
|
6711
|
+
inset: 0;
|
|
6712
|
+
background: rgba(0, 0, 0, 0.5);
|
|
6713
|
+
z-index: 1000;
|
|
6714
|
+
animation: fadeIn 0.2s ease-out;
|
|
6715
|
+
|
|
6716
|
+
@keyframes fadeIn {
|
|
6717
|
+
from {
|
|
6718
|
+
opacity: 0;
|
|
6719
|
+
}
|
|
6720
|
+
to {
|
|
6721
|
+
opacity: 1;
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6724
|
+
`;
|
|
6725
|
+
const ModalContent = styled(Dialog.Content)`
|
|
6726
|
+
position: fixed;
|
|
6727
|
+
top: 50%;
|
|
6728
|
+
left: 50%;
|
|
6729
|
+
transform: translate(-50%, -50%);
|
|
6730
|
+
background: white;
|
|
6731
|
+
border-radius: 8px;
|
|
6732
|
+
box-shadow:
|
|
6733
|
+
0 0 1px rgba(0, 0, 0, 0.1),
|
|
6734
|
+
0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
6735
|
+
0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
6736
|
+
max-width: 650px;
|
|
6737
|
+
max-height: 80vh;
|
|
6738
|
+
width: 90vw;
|
|
6739
|
+
padding: 16px;
|
|
6740
|
+
overflow-y: auto;
|
|
6741
|
+
z-index: 1001;
|
|
6742
|
+
animation: slideIn 0.2s ease-out;
|
|
6743
|
+
scrollbar-width: thin;
|
|
6744
|
+
|
|
6745
|
+
@keyframes slideIn {
|
|
6746
|
+
from {
|
|
6747
|
+
opacity: 0;
|
|
6748
|
+
transform: translate(-50%, -50%) scale(0.95);
|
|
6749
|
+
}
|
|
6750
|
+
to {
|
|
6751
|
+
opacity: 1;
|
|
6752
|
+
transform: translate(-50%, -50%) scale(1);
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
|
|
6756
|
+
&:focus {
|
|
6757
|
+
outline: none;
|
|
6758
|
+
}
|
|
6759
|
+
`;
|
|
6760
|
+
const InnerModalContent = styled.div`
|
|
6761
|
+
position: relative;
|
|
6762
|
+
padding: 2.5rem;
|
|
6763
|
+
`;
|
|
6764
|
+
const ModalCloseButtonContainer = styled.div`
|
|
6765
|
+
position: sticky;
|
|
6766
|
+
top: 0;
|
|
6767
|
+
width: 100%;
|
|
6768
|
+
display: flex;
|
|
6769
|
+
justify-content: flex-end;
|
|
6770
|
+
`;
|
|
6771
|
+
const ModalCloseButton = styled(Dialog.Close)`
|
|
6772
|
+
height: fit-content;
|
|
6773
|
+
background: none;
|
|
6774
|
+
border: none;
|
|
6775
|
+
color: #6c7689;
|
|
6776
|
+
cursor: pointer;
|
|
6777
|
+
padding: 4px;
|
|
6778
|
+
border-radius: 4px;
|
|
6779
|
+
transition: background-color 0.2s;
|
|
6780
|
+
|
|
6781
|
+
&:hover {
|
|
6782
|
+
background-color: #f3f4f6;
|
|
6783
|
+
}
|
|
6784
|
+
|
|
6785
|
+
&:focus {
|
|
6786
|
+
outline: 2px solid #08a4ff;
|
|
6787
|
+
outline-offset: 2px;
|
|
6788
|
+
}
|
|
6789
|
+
`;
|
|
6790
|
+
const ErrorNotificationButton = styled.button`
|
|
6791
|
+
position: fixed;
|
|
6792
|
+
right: 16px;
|
|
6793
|
+
bottom: 16px;
|
|
6794
|
+
z-index: 1000;
|
|
6795
|
+
background: none;
|
|
6796
|
+
border: none;
|
|
6797
|
+
padding: 0;
|
|
6798
|
+
cursor: pointer;
|
|
6799
|
+
outline: none;
|
|
6800
|
+
`;
|
|
6801
|
+
const ErrorNotificationContent = styled.div`
|
|
6802
|
+
background: #ef4444;
|
|
6803
|
+
color: white;
|
|
6804
|
+
padding: 12px 16px;
|
|
6805
|
+
border-radius: 6px;
|
|
6806
|
+
font-size: 14px;
|
|
6807
|
+
font-weight: 500;
|
|
6808
|
+
line-height: 1.4;
|
|
6809
|
+
max-width: 40rem;
|
|
6810
|
+
box-shadow:
|
|
6811
|
+
0 10px 25px -5px rgba(0, 0, 0, 0.1),
|
|
6812
|
+
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
6813
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
6814
|
+
backdrop-filter: blur(10px);
|
|
6815
|
+
display: flex;
|
|
6816
|
+
align-items: center;
|
|
6817
|
+
gap: 8px;
|
|
6818
|
+
transition: all 0.2s ease;
|
|
6819
|
+
|
|
6820
|
+
&:hover {
|
|
6821
|
+
transform: translateY(-2px);
|
|
6822
|
+
box-shadow:
|
|
6823
|
+
0 20px 25px -5px rgba(0, 0, 0, 0.15),
|
|
6824
|
+
0 10px 10px -5px rgba(0, 0, 0, 0.1);
|
|
6825
|
+
}
|
|
6826
|
+
`;
|
|
6827
|
+
const ErrorText = styled.span`
|
|
6828
|
+
overflow: hidden;
|
|
6829
|
+
text-overflow: ellipsis;
|
|
6830
|
+
white-space: nowrap;
|
|
6831
|
+
`;
|
|
6832
|
+
const ErrorIcon = styled.svg`
|
|
6833
|
+
flex-shrink: 0;
|
|
6834
|
+
`;
|
|
6835
|
+
function BuildErrorNotification() {
|
|
6836
|
+
const [currentError, setCurrentError] = useState(null);
|
|
6837
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
6838
|
+
const lastBuildError = useRef(null);
|
|
6839
|
+
useEffect(() => {
|
|
6840
|
+
if (typeof window !== "undefined" && window.__SB_MARK_APP_LOADED) window.__SB_MARK_APP_LOADED();
|
|
6841
|
+
if (import.meta.hot) {
|
|
6842
|
+
import.meta.hot.on("vite:error", (payload) => {
|
|
6843
|
+
const error = payload?.err || payload;
|
|
6844
|
+
const errorMessage = error?.message || String(error);
|
|
6845
|
+
let buildError;
|
|
6846
|
+
if (error?.name === "ImportError" || error?.importPath) buildError = {
|
|
6847
|
+
errorType: "import",
|
|
6848
|
+
error: errorMessage,
|
|
6849
|
+
stack: error?.stack || "",
|
|
6850
|
+
importPath: error?.importPath || "unknown"
|
|
6851
|
+
};
|
|
6852
|
+
else if (errorMessage.includes("Failed to resolve import")) {
|
|
6853
|
+
const importMatch = errorMessage.match(/Failed to resolve import ["'](.+?)["']/);
|
|
6854
|
+
buildError = {
|
|
6855
|
+
errorType: "import",
|
|
6856
|
+
error: errorMessage,
|
|
6857
|
+
stack: error?.stack || "",
|
|
6858
|
+
importPath: importMatch ? importMatch[1] : "unknown"
|
|
6859
|
+
};
|
|
6860
|
+
} else buildError = {
|
|
6861
|
+
errorType: "general",
|
|
6862
|
+
error: errorMessage,
|
|
6863
|
+
stack: error?.stack
|
|
6864
|
+
};
|
|
6865
|
+
setCurrentError(buildError);
|
|
6866
|
+
});
|
|
6867
|
+
import.meta.hot.on("vite:beforeUpdate", () => {
|
|
6868
|
+
setCurrentError(null);
|
|
6869
|
+
setIsModalOpen(false);
|
|
6870
|
+
});
|
|
6871
|
+
}
|
|
6872
|
+
}, []);
|
|
6873
|
+
useEffect(() => {
|
|
6874
|
+
if (currentError && !isEqual(lastBuildError.current, currentError)) {
|
|
6875
|
+
setIsModalOpen(true);
|
|
6876
|
+
lastBuildError.current = currentError;
|
|
6877
|
+
}
|
|
6878
|
+
}, [currentError]);
|
|
6879
|
+
if (!currentError) return null;
|
|
6880
|
+
const displayCornerError = !isModalOpen;
|
|
6881
|
+
const errorText = currentError.errorType === "import" ? "Import Error" : "Build Error";
|
|
6882
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BuildErrorModal, {
|
|
6883
|
+
isOpen: isModalOpen,
|
|
6884
|
+
error: currentError,
|
|
6885
|
+
onClose: () => setIsModalOpen(false)
|
|
6886
|
+
}), displayCornerError ? /* @__PURE__ */ jsx(ErrorNotificationButton, {
|
|
6887
|
+
onClick: () => setIsModalOpen(true),
|
|
6888
|
+
children: /* @__PURE__ */ jsxs(ErrorNotificationContent, { children: [/* @__PURE__ */ jsxs(ErrorIcon, {
|
|
6889
|
+
width: "16",
|
|
6890
|
+
height: "16",
|
|
6891
|
+
viewBox: "0 0 16 16",
|
|
6892
|
+
fill: "currentColor",
|
|
6893
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8z" }), /* @__PURE__ */ jsx("path", { d: "M7.002 11a1 1 0 112 0 1 1 0 01-2 0zM7.1 4.995a.905.905 0 111.8 0l-.35 3.507a.552.552 0 01-1.1 0L7.1 4.995z" })]
|
|
6894
|
+
}), /* @__PURE__ */ jsx(ErrorText, { children: errorText })] })
|
|
6895
|
+
}) : null] });
|
|
6896
|
+
}
|
|
6897
|
+
function BuildErrorModal({ isOpen, error, onClose }) {
|
|
6898
|
+
if (!error) return null;
|
|
6899
|
+
const title = error.errorType === "import" ? "Import error" : "Build error";
|
|
6900
|
+
const message = error.errorType === "import" ? /* @__PURE__ */ jsxs(Fragment, { children: ["Error importing ", /* @__PURE__ */ jsx("code", { children: error.importPath })] }) : "An error occurred during the build process";
|
|
6901
|
+
const details = error.stack && error.stack.trim() ? `${error.error}\n${error.stack}` : error.error;
|
|
6902
|
+
const errorObj = new Error(error.error);
|
|
6903
|
+
errorObj.stack = details || error.error;
|
|
6904
|
+
if (error.errorType === "import") errorObj.name = "ImportError";
|
|
6905
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
6906
|
+
open: isOpen,
|
|
6907
|
+
onOpenChange: onClose,
|
|
6908
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
6909
|
+
"data-test": "build-error-modal",
|
|
6910
|
+
children: [/* @__PURE__ */ jsx(ModalCloseButtonContainer, { children: /* @__PURE__ */ jsx(ModalCloseButton, {
|
|
6911
|
+
"aria-label": "Close error dialog",
|
|
6912
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
6913
|
+
width: "16",
|
|
6914
|
+
height: "16",
|
|
6915
|
+
viewBox: "0 0 16 16",
|
|
6916
|
+
fill: "currentColor",
|
|
6917
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12.8 4.4L11.6 3.2 8 6.8 4.4 3.2 3.2 4.4 6.8 8 3.2 11.6 4.4 12.8 8 9.2 11.6 12.8 12.8 11.6 9.2 8z" })
|
|
6918
|
+
})
|
|
6919
|
+
}) }), /* @__PURE__ */ jsxs(InnerModalContent, { children: [
|
|
6920
|
+
/* @__PURE__ */ jsx(ErrorIconContainer, { children: /* @__PURE__ */ jsx(StyledClarkIcon, {}) }),
|
|
6921
|
+
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
6922
|
+
asChild: true,
|
|
6923
|
+
children: /* @__PURE__ */ jsx(ErrorTitle, { children: title })
|
|
6924
|
+
}),
|
|
6925
|
+
/* @__PURE__ */ jsx(ErrorMessage$1, {
|
|
6926
|
+
"data-test": "build-error-message",
|
|
6927
|
+
children: message
|
|
6928
|
+
}),
|
|
6929
|
+
/* @__PURE__ */ jsxs(ActionsContainer, { children: [/* @__PURE__ */ jsx(FixWithClarkButton, {
|
|
6930
|
+
error: errorObj,
|
|
6931
|
+
onClick: onClose
|
|
6932
|
+
}), /* @__PURE__ */ jsx(SecondaryButton, {
|
|
6933
|
+
onClick: () => window.location.reload(),
|
|
6934
|
+
children: "Refresh page"
|
|
6935
|
+
})] }),
|
|
6936
|
+
details ? /* @__PURE__ */ jsxs(ErrorDetails, { children: [/* @__PURE__ */ jsx(ErrorSummary, { children: "Full details" }), /* @__PURE__ */ jsx(ErrorStack, { children: details })] }) : error.errorType === "general" && error.error ? /* @__PURE__ */ jsxs(ErrorDetails, { children: [/* @__PURE__ */ jsx(ErrorSummary, { children: "Error details" }), /* @__PURE__ */ jsx(ErrorStack, { children: error.error })] }) : null
|
|
6937
|
+
] })]
|
|
6938
|
+
})] })
|
|
6939
|
+
});
|
|
6940
|
+
}
|
|
6941
|
+
|
|
6722
6942
|
//#endregion
|
|
6723
6943
|
//#region src/edit-mode/dnd/is-nestable.ts
|
|
6724
6944
|
function isNestable(componentType, _parentType) {
|
|
@@ -6882,11 +7102,10 @@ const fixCursorSnapOffset = (args) => {
|
|
|
6882
7102
|
if (!a.pointerInside && b.pointerInside) return 1;
|
|
6883
7103
|
return (bData?.depth ?? 0) - (aData?.depth ?? 0);
|
|
6884
7104
|
});
|
|
6885
|
-
const
|
|
7105
|
+
const result = bubblingToParentIfFar({
|
|
6886
7106
|
...updated,
|
|
6887
7107
|
collisions: sortedCollisions
|
|
6888
|
-
};
|
|
6889
|
-
const result = bubblingToParentIfFar(modifiedArgs);
|
|
7108
|
+
});
|
|
6890
7109
|
if (result[0]) result[0].data = {
|
|
6891
7110
|
...result[0].data ?? {},
|
|
6892
7111
|
injectedCollisionRect: updated.collisionRect
|
|
@@ -7084,16 +7303,14 @@ const useHandleDnDEvents = () => {
|
|
|
7084
7303
|
const draggedId = event.active?.id ? String(event.active?.id) : null;
|
|
7085
7304
|
if (dropTargetId !== editStore.ui.dnd.dropTargetId) throw new Error("Drop target id and drag over id do not match");
|
|
7086
7305
|
if (!dropTargetId) throw new Error("No drop target id");
|
|
7087
|
-
if (editStore.ui.dnd.isDropTargetStackLike) {
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
});
|
|
7096
|
-
} else throw new Error("Grid is no longer supported");
|
|
7306
|
+
if (editStore.ui.dnd.isDropTargetStackLike) possibleNewComponentId = await handleStackDrop({
|
|
7307
|
+
dropInfo: editStore.ui.dnd.stack.refreshPositionsAndGetDropIndex(),
|
|
7308
|
+
isDraggingNewComponent: editStore.ui.dnd.isDraggingNewComponent,
|
|
7309
|
+
newComponentType: editStore.ui.dnd.dragToCanvasComponentType,
|
|
7310
|
+
dropTargetId,
|
|
7311
|
+
draggedId
|
|
7312
|
+
});
|
|
7313
|
+
else throw new Error("Grid is no longer supported");
|
|
7097
7314
|
} catch (e) {
|
|
7098
7315
|
console.error("Error dropping item", e);
|
|
7099
7316
|
} finally {
|
|
@@ -7126,11 +7343,8 @@ const DragHandlerComponent = () => {
|
|
|
7126
7343
|
return null;
|
|
7127
7344
|
};
|
|
7128
7345
|
const DnDProvider = (props) => {
|
|
7129
|
-
const pointerSensor = useSensor(PointerSensor, pointerConfig);
|
|
7130
|
-
const customPointerSensor = useSensor(CustomPointerSensor);
|
|
7131
|
-
const sensors = useSensors(pointerSensor, customPointerSensor);
|
|
7132
7346
|
return /* @__PURE__ */ jsxs(DndContext, {
|
|
7133
|
-
sensors,
|
|
7347
|
+
sensors: useSensors(useSensor(PointerSensor, pointerConfig), useSensor(CustomPointerSensor)),
|
|
7134
7348
|
collisionDetection: collision_detection_default,
|
|
7135
7349
|
children: [props.children, /* @__PURE__ */ jsx(DragHandlerComponent, {})]
|
|
7136
7350
|
});
|
|
@@ -7581,8 +7795,7 @@ var PropertiesPanelManager = class {
|
|
|
7581
7795
|
if (!props?.type) return { sections: [] };
|
|
7582
7796
|
const propertiesDefinition$5 = this.propertiesDefinitions.get(props.type);
|
|
7583
7797
|
if (!propertiesDefinition$5) return { sections: [] };
|
|
7584
|
-
|
|
7585
|
-
return createPropertiesPanelDefinition(propertiesDefinition$5, props, state);
|
|
7798
|
+
return createPropertiesPanelDefinition(propertiesDefinition$5, props, this.entityManager.getState(scopeId));
|
|
7586
7799
|
}
|
|
7587
7800
|
trackPropertiesPanel(scopeId, instanceId, sourceId) {
|
|
7588
7801
|
if (this.propertiesPanelTrackerDisposer) this.propertiesPanelTrackerDisposer();
|
|
@@ -8481,13 +8694,11 @@ const computeDragInfo = (params) => {
|
|
|
8481
8694
|
gapSize /= 2;
|
|
8482
8695
|
let offsetPx;
|
|
8483
8696
|
if (potentialIdx === filteredChildIds.length) {
|
|
8484
|
-
const
|
|
8485
|
-
const rect = childRects[lastInstanceId]?.[0];
|
|
8697
|
+
const rect = childRects[filteredChildIds[filteredChildIds.length - 1]]?.[0];
|
|
8486
8698
|
if (!rect) return;
|
|
8487
8699
|
offsetPx = major.end(rect) - DROP_LINE_THICKNESS / 2 + gapSize;
|
|
8488
8700
|
} else {
|
|
8489
|
-
const
|
|
8490
|
-
const rect = childRects[instanceId]?.[0];
|
|
8701
|
+
const rect = childRects[filteredChildIds[potentialIdx]]?.[0];
|
|
8491
8702
|
if (!rect) return;
|
|
8492
8703
|
offsetPx = major.start(rect) - DROP_LINE_THICKNESS / 2 - gapSize;
|
|
8493
8704
|
}
|
|
@@ -8525,8 +8736,7 @@ const computeDragInfo = (params) => {
|
|
|
8525
8736
|
let insertionIndex = filteredInsertionIndex;
|
|
8526
8737
|
if (insertionIndex === filteredChildIds.length) insertionIndex = childrenNodes.length;
|
|
8527
8738
|
else {
|
|
8528
|
-
const
|
|
8529
|
-
const originalIndex = childRects[widgetAtInsertionIndex]?.[1];
|
|
8739
|
+
const originalIndex = childRects[filteredChildIds[filteredInsertionIndex]]?.[1];
|
|
8530
8740
|
if (originalIndex != null) insertionIndex = originalIndex;
|
|
8531
8741
|
}
|
|
8532
8742
|
return {
|
|
@@ -8651,8 +8861,7 @@ var DragAndDropManager = class {
|
|
|
8651
8861
|
}
|
|
8652
8862
|
get isDropTargetStackLike() {
|
|
8653
8863
|
const dropTargetId = this.dropTargetId;
|
|
8654
|
-
|
|
8655
|
-
return isComponentStacklike(widgetMeta);
|
|
8864
|
+
return isComponentStacklike(dropTargetId ? getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetId) : void 0);
|
|
8656
8865
|
}
|
|
8657
8866
|
get draggedWidgetType() {
|
|
8658
8867
|
if (this.isDraggingNewComponent) return this._dragToCanvasComponentType;
|
|
@@ -8682,12 +8891,11 @@ var DragAndDropManager = class {
|
|
|
8682
8891
|
const draggedType = this.draggedWidgetType;
|
|
8683
8892
|
const dropTargetType = this.dropTargetWidgetType;
|
|
8684
8893
|
if (!draggedType || !dropTargetType) return false;
|
|
8685
|
-
const dropTargetEmpty = (dropTargetInstanceId && getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetInstanceId)?.children?.length === 0) ?? true;
|
|
8686
8894
|
return isDragAndDropTypeValid({
|
|
8687
8895
|
draggedType,
|
|
8688
8896
|
dropTargetType,
|
|
8689
8897
|
isDraggingNewComponent,
|
|
8690
|
-
dropTargetEmpty
|
|
8898
|
+
dropTargetEmpty: (dropTargetInstanceId && getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetInstanceId)?.children?.length === 0) ?? true
|
|
8691
8899
|
});
|
|
8692
8900
|
}
|
|
8693
8901
|
canDragWidget(instanceId) {
|
|
@@ -9135,7 +9343,6 @@ var EditStore = class {
|
|
|
9135
9343
|
isInitialized = false;
|
|
9136
9344
|
recordingInitialized = false;
|
|
9137
9345
|
isLivePreview = false;
|
|
9138
|
-
currentImportError = null;
|
|
9139
9346
|
viteMessageListeners = /* @__PURE__ */ new Map();
|
|
9140
9347
|
constructor(rootStore) {
|
|
9141
9348
|
this.ui = new ui_store_default(rootStore, this);
|
|
@@ -9148,8 +9355,7 @@ var EditStore = class {
|
|
|
9148
9355
|
makeObservable(this, {
|
|
9149
9356
|
isInitialized: observable,
|
|
9150
9357
|
isLivePreview: observable,
|
|
9151
|
-
setIsInitialized: action
|
|
9152
|
-
currentImportError: observable
|
|
9358
|
+
setIsInitialized: action
|
|
9153
9359
|
});
|
|
9154
9360
|
startEditorSync({
|
|
9155
9361
|
storeId: "scope",
|
|
@@ -9171,19 +9377,10 @@ var EditStore = class {
|
|
|
9171
9377
|
setIsInitialized(isInitialized) {
|
|
9172
9378
|
if (this.isInitialized) return;
|
|
9173
9379
|
this.isInitialized = isInitialized;
|
|
9174
|
-
this.setupImportErrorListener();
|
|
9175
9380
|
}
|
|
9176
9381
|
setIsLivePreview(isLivePreview) {
|
|
9177
9382
|
this.isLivePreview = isLivePreview;
|
|
9178
9383
|
}
|
|
9179
|
-
setupImportErrorListener() {
|
|
9180
|
-
this.onViteMessage(ViteMessageKind.IMPORT_ERROR, (message) => {
|
|
9181
|
-
this.currentImportError = message;
|
|
9182
|
-
});
|
|
9183
|
-
this.onViteMessage(ViteMessageKind.CLEAR_IMPORT_ERROR, () => {
|
|
9184
|
-
this.currentImportError = null;
|
|
9185
|
-
});
|
|
9186
|
-
}
|
|
9187
9384
|
onViteMessage(kind, callback) {
|
|
9188
9385
|
this.viteMessageListeners.set(kind, [...this.viteMessageListeners.get(kind) || [], callback]);
|
|
9189
9386
|
return () => {
|
|
@@ -9279,190 +9476,6 @@ function EditorHotkeys({ children }) {
|
|
|
9279
9476
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9280
9477
|
}
|
|
9281
9478
|
|
|
9282
|
-
//#endregion
|
|
9283
|
-
//#region src/edit-mode/import-error-notification.tsx
|
|
9284
|
-
const ModalOverlay = styled(Dialog.Overlay)`
|
|
9285
|
-
position: fixed;
|
|
9286
|
-
inset: 0;
|
|
9287
|
-
background: rgba(0, 0, 0, 0.5);
|
|
9288
|
-
z-index: 1000;
|
|
9289
|
-
animation: fadeIn 0.2s ease-out;
|
|
9290
|
-
|
|
9291
|
-
@keyframes fadeIn {
|
|
9292
|
-
from {
|
|
9293
|
-
opacity: 0;
|
|
9294
|
-
}
|
|
9295
|
-
to {
|
|
9296
|
-
opacity: 1;
|
|
9297
|
-
}
|
|
9298
|
-
}
|
|
9299
|
-
`;
|
|
9300
|
-
const ModalContent = styled(Dialog.Content)`
|
|
9301
|
-
position: fixed;
|
|
9302
|
-
top: 50%;
|
|
9303
|
-
left: 50%;
|
|
9304
|
-
transform: translate(-50%, -50%);
|
|
9305
|
-
background: white;
|
|
9306
|
-
border-radius: 8px;
|
|
9307
|
-
box-shadow:
|
|
9308
|
-
0 0 1px rgba(0, 0, 0, 0.1),
|
|
9309
|
-
0 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
9310
|
-
0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
9311
|
-
max-width: 650px;
|
|
9312
|
-
max-height: 80vh;
|
|
9313
|
-
width: 90vw;
|
|
9314
|
-
padding: 16px;
|
|
9315
|
-
overflow-y: auto;
|
|
9316
|
-
z-index: 1001;
|
|
9317
|
-
animation: slideIn 0.2s ease-out;
|
|
9318
|
-
scrollbar-width: thin;
|
|
9319
|
-
|
|
9320
|
-
@keyframes slideIn {
|
|
9321
|
-
from {
|
|
9322
|
-
opacity: 0;
|
|
9323
|
-
transform: translate(-50%, -50%) scale(0.95);
|
|
9324
|
-
}
|
|
9325
|
-
to {
|
|
9326
|
-
opacity: 1;
|
|
9327
|
-
transform: translate(-50%, -50%) scale(1);
|
|
9328
|
-
}
|
|
9329
|
-
}
|
|
9330
|
-
|
|
9331
|
-
&:focus {
|
|
9332
|
-
outline: none;
|
|
9333
|
-
}
|
|
9334
|
-
`;
|
|
9335
|
-
const InnerModalContent = styled.div`
|
|
9336
|
-
position: relative;
|
|
9337
|
-
padding: 40px;
|
|
9338
|
-
`;
|
|
9339
|
-
const ModalCloseButtonContainer = styled.div`
|
|
9340
|
-
position: sticky;
|
|
9341
|
-
top: 0;
|
|
9342
|
-
width: 100%;
|
|
9343
|
-
display: flex;
|
|
9344
|
-
justify-content: flex-end;
|
|
9345
|
-
`;
|
|
9346
|
-
const ModalCloseButton = styled(Dialog.Close)`
|
|
9347
|
-
height: fit-content;
|
|
9348
|
-
background: none;
|
|
9349
|
-
border: none;
|
|
9350
|
-
color: #6c7689;
|
|
9351
|
-
cursor: pointer;
|
|
9352
|
-
padding: 4px;
|
|
9353
|
-
border-radius: 4px;
|
|
9354
|
-
transition: background-color 0.2s;
|
|
9355
|
-
|
|
9356
|
-
&:hover {
|
|
9357
|
-
background-color: #f3f4f6;
|
|
9358
|
-
}
|
|
9359
|
-
|
|
9360
|
-
&:focus {
|
|
9361
|
-
outline: 2px solid #08a4ff;
|
|
9362
|
-
outline-offset: 2px;
|
|
9363
|
-
}
|
|
9364
|
-
`;
|
|
9365
|
-
const ErrorNotificationButton = styled.button`
|
|
9366
|
-
position: fixed;
|
|
9367
|
-
right: 16px;
|
|
9368
|
-
bottom: 16px;
|
|
9369
|
-
z-index: 1000;
|
|
9370
|
-
background: none;
|
|
9371
|
-
border: none;
|
|
9372
|
-
padding: 0;
|
|
9373
|
-
cursor: pointer;
|
|
9374
|
-
outline: none;
|
|
9375
|
-
`;
|
|
9376
|
-
const ErrorNotificationContent = styled.div`
|
|
9377
|
-
background: #ef4444;
|
|
9378
|
-
color: white;
|
|
9379
|
-
padding: 12px 16px;
|
|
9380
|
-
border-radius: 6px;
|
|
9381
|
-
font-size: 14px;
|
|
9382
|
-
font-weight: 500;
|
|
9383
|
-
line-height: 1.4;
|
|
9384
|
-
max-width: 320px;
|
|
9385
|
-
box-shadow:
|
|
9386
|
-
0 10px 25px -5px rgba(0, 0, 0, 0.1),
|
|
9387
|
-
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
9388
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
9389
|
-
backdrop-filter: blur(10px);
|
|
9390
|
-
display: flex;
|
|
9391
|
-
align-items: center;
|
|
9392
|
-
gap: 8px;
|
|
9393
|
-
transition: all 0.2s ease;
|
|
9394
|
-
|
|
9395
|
-
&:hover {
|
|
9396
|
-
transform: translateY(-2px);
|
|
9397
|
-
box-shadow:
|
|
9398
|
-
0 20px 25px -5px rgba(0, 0, 0, 0.15),
|
|
9399
|
-
0 10px 10px -5px rgba(0, 0, 0, 0.1);
|
|
9400
|
-
}
|
|
9401
|
-
`;
|
|
9402
|
-
const ErrorText = styled.span`
|
|
9403
|
-
overflow: hidden;
|
|
9404
|
-
text-overflow: ellipsis;
|
|
9405
|
-
white-space: nowrap;
|
|
9406
|
-
`;
|
|
9407
|
-
const ErrorIcon = styled.svg`
|
|
9408
|
-
flex-shrink: 0;
|
|
9409
|
-
`;
|
|
9410
|
-
const ImportErrorNotification = observer(function ImportErrorNotification$1() {
|
|
9411
|
-
const editStore = root_store_default.editStore;
|
|
9412
|
-
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
9413
|
-
const lastImportError = useRef(null);
|
|
9414
|
-
if (!editStore || !editStore.isInitialized || !editStore.currentImportError) return null;
|
|
9415
|
-
if (!isModalOpen && !isEqual(lastImportError.current, editStore.currentImportError)) {
|
|
9416
|
-
setIsModalOpen(true);
|
|
9417
|
-
lastImportError.current = editStore.currentImportError;
|
|
9418
|
-
}
|
|
9419
|
-
const displayCornerError = !isModalOpen && !!editStore.currentImportError;
|
|
9420
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ImportErrorModal, {
|
|
9421
|
-
isOpen: isModalOpen,
|
|
9422
|
-
error: editStore.currentImportError,
|
|
9423
|
-
onClose: () => setIsModalOpen(false)
|
|
9424
|
-
}), displayCornerError ? /* @__PURE__ */ jsx(ErrorNotificationButton, {
|
|
9425
|
-
onClick: () => setIsModalOpen(true),
|
|
9426
|
-
children: /* @__PURE__ */ jsxs(ErrorNotificationContent, { children: [/* @__PURE__ */ jsxs(ErrorIcon, {
|
|
9427
|
-
width: "16",
|
|
9428
|
-
height: "16",
|
|
9429
|
-
viewBox: "0 0 16 16",
|
|
9430
|
-
fill: "currentColor",
|
|
9431
|
-
children: [/* @__PURE__ */ jsx("path", { d: "M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8z" }), /* @__PURE__ */ jsx("path", { d: "M7.002 11a1 1 0 112 0 1 1 0 01-2 0zM7.1 4.995a.905.905 0 111.8 0l-.35 3.507a.552.552 0 01-1.1 0L7.1 4.995z" })]
|
|
9432
|
-
}), /* @__PURE__ */ jsx(ErrorText, { children: "Import Error" })] })
|
|
9433
|
-
}) : null] });
|
|
9434
|
-
});
|
|
9435
|
-
function ImportErrorModal({ isOpen, error, onClose }) {
|
|
9436
|
-
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
9437
|
-
open: isOpen,
|
|
9438
|
-
onOpenChange: onClose,
|
|
9439
|
-
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
9440
|
-
"data-test": "import-error-modal",
|
|
9441
|
-
children: [/* @__PURE__ */ jsx(ModalCloseButtonContainer, { children: /* @__PURE__ */ jsx(ModalCloseButton, {
|
|
9442
|
-
"aria-label": "Close error dialog",
|
|
9443
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
9444
|
-
width: "16",
|
|
9445
|
-
height: "16",
|
|
9446
|
-
viewBox: "0 0 16 16",
|
|
9447
|
-
fill: "currentColor",
|
|
9448
|
-
children: /* @__PURE__ */ jsx("path", { d: "M12.8 4.4L11.6 3.2 8 6.8 4.4 3.2 3.2 4.4 6.8 8 3.2 11.6 4.4 12.8 8 9.2 11.6 12.8 12.8 11.6 9.2 8z" })
|
|
9449
|
-
})
|
|
9450
|
-
}) }), /* @__PURE__ */ jsxs(InnerModalContent, { children: [
|
|
9451
|
-
/* @__PURE__ */ jsx(ErrorIconContainer, { children: /* @__PURE__ */ jsx(StyledClarkIcon, {}) }),
|
|
9452
|
-
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
9453
|
-
asChild: true,
|
|
9454
|
-
children: /* @__PURE__ */ jsx(ErrorTitle, { children: "Import error" })
|
|
9455
|
-
}),
|
|
9456
|
-
/* @__PURE__ */ jsxs(ErrorMessage$1, {
|
|
9457
|
-
"data-test": "import-error-message",
|
|
9458
|
-
children: ["Error importing ", error?.importPath]
|
|
9459
|
-
}),
|
|
9460
|
-
error ? /* @__PURE__ */ jsxs(ErrorDetails, { children: [/* @__PURE__ */ jsx(ErrorSummary, { children: "Full details" }), /* @__PURE__ */ jsx(ErrorStack, { children: error.stack })] }) : null
|
|
9461
|
-
] })]
|
|
9462
|
-
})] })
|
|
9463
|
-
});
|
|
9464
|
-
}
|
|
9465
|
-
|
|
9466
9479
|
//#endregion
|
|
9467
9480
|
//#region src/edit-mode/iframe-wrappers.tsx
|
|
9468
9481
|
const IframeConnected = observer(function IframeConnected$1(props) {
|
|
@@ -9560,7 +9573,7 @@ const EmbedWrapper = (props) => {
|
|
|
9560
9573
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
9561
9574
|
if (root_store_default.windowOriginUrl) import("./utils-BCrSLIhM.js").then(({ initTracerProviderWithOrigin }) => {
|
|
9562
9575
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
9563
|
-
import("./logs-
|
|
9576
|
+
import("./logs-DDh7Anxs.js").then(({ initLibraryLoggerProvider }) => {
|
|
9564
9577
|
initLibraryLoggerProvider({
|
|
9565
9578
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
9566
9579
|
appId: event.data.payload.appId,
|
|
@@ -9740,9 +9753,8 @@ const EmbedWrapper = (props) => {
|
|
|
9740
9753
|
return getEditStore().onViteMessage(ViteMessageKind.ROUTE_CHANGE, async (message) => {
|
|
9741
9754
|
try {
|
|
9742
9755
|
const { route, routeTestParams } = message;
|
|
9743
|
-
const path = generatePath$1(route, routeTestParams);
|
|
9744
9756
|
await navigate({
|
|
9745
|
-
pathname:
|
|
9757
|
+
pathname: generatePath$1(route, routeTestParams),
|
|
9746
9758
|
search: location.search
|
|
9747
9759
|
});
|
|
9748
9760
|
} catch (error$1) {
|
|
@@ -9765,7 +9777,7 @@ const EmbedWrapper = (props) => {
|
|
|
9765
9777
|
}
|
|
9766
9778
|
return /* @__PURE__ */ jsx(FullPageSpinner, {});
|
|
9767
9779
|
}
|
|
9768
|
-
return /* @__PURE__ */ jsx(WithUserWrapper$1, { children: /* @__PURE__ */ jsxs(IframeConnected, { children: [/* @__PURE__ */ jsx(
|
|
9780
|
+
return /* @__PURE__ */ jsx(WithUserWrapper$1, { children: /* @__PURE__ */ jsxs(IframeConnected, { children: [/* @__PURE__ */ jsx(BuildErrorNotification, {}), /* @__PURE__ */ jsx(EditorHotkeys, { children: props.children })] }) });
|
|
9769
9781
|
};
|
|
9770
9782
|
|
|
9771
9783
|
//#endregion
|
|
@@ -9808,7 +9820,7 @@ const EmbedWrapper$1 = (props) => {
|
|
|
9808
9820
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
9809
9821
|
if (root_store_default.windowOriginUrl) import("./utils-BCrSLIhM.js").then(({ initTracerProviderWithOrigin }) => {
|
|
9810
9822
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
9811
|
-
import("./logs-
|
|
9823
|
+
import("./logs-DDh7Anxs.js").then(({ initLibraryLoggerProvider }) => {
|
|
9812
9824
|
initLibraryLoggerProvider({
|
|
9813
9825
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
9814
9826
|
appId: event.data.payload.appId,
|
|
@@ -9991,8 +10003,7 @@ const initializeStyles = (appName) => {
|
|
|
9991
10003
|
...VARIABLE_VALUES,
|
|
9992
10004
|
...componentVariableValues
|
|
9993
10005
|
};
|
|
9994
|
-
|
|
9995
|
-
createStyleSheetFromString(appName, `:${appName} {${variableDefns}}\n${stylesheet}`);
|
|
10006
|
+
createStyleSheetFromString(appName, `:${appName} {${Object.keys(allVariables).map((variable) => `${allVariables[variable]}: ${allVariableValues[variable]};`).join("\n")}}\n${stylesheet}`);
|
|
9996
10007
|
};
|
|
9997
10008
|
|
|
9998
10009
|
//#endregion
|
|
@@ -10000,11 +10011,10 @@ const initializeStyles = (appName) => {
|
|
|
10000
10011
|
const originalLog = console.log;
|
|
10001
10012
|
console.log = (...args) => {
|
|
10002
10013
|
try {
|
|
10003
|
-
|
|
10014
|
+
originalLog(...args.map((arg) => {
|
|
10004
10015
|
if (arg && typeof arg === "object" && (getBindingIdentifier(arg) || getBindingIdentifier(arg.bind ?? {}))) return JSON.parse(JSON.stringify(arg));
|
|
10005
10016
|
return arg;
|
|
10006
|
-
});
|
|
10007
|
-
originalLog(...processedArgs);
|
|
10017
|
+
}));
|
|
10008
10018
|
} catch {}
|
|
10009
10019
|
};
|
|
10010
10020
|
const loadApisIntoLibrary = async function loadApisIntoLibrary$1() {
|
|
@@ -10031,9 +10041,7 @@ const SbProvider = function SbProvider$1({ name = "codemode", settings, children
|
|
|
10031
10041
|
runApiInitialization();
|
|
10032
10042
|
}, [runApiInitialization]);
|
|
10033
10043
|
useEffect(() => {
|
|
10034
|
-
|
|
10035
|
-
const userAccessibleTheme$1 = generateTheme(mergedTheme, settings?.themeOverrides);
|
|
10036
|
-
setUserAccessibleTheme(userAccessibleTheme$1);
|
|
10044
|
+
setUserAccessibleTheme(generateTheme(merge(BASE_THEME_V5, settings?.theme), settings?.themeOverrides));
|
|
10037
10045
|
}, [settings?.theme, settings?.themeOverrides]);
|
|
10038
10046
|
useEffect(() => {
|
|
10039
10047
|
const resolvePromiseListener = (event) => {
|
|
@@ -10186,10 +10194,8 @@ function setQueryParams(queryParams = {}, preserveExistingQueryParams = true) {
|
|
|
10186
10194
|
function download(data, fileName, fileType) {
|
|
10187
10195
|
try {
|
|
10188
10196
|
const dataType = getType(data);
|
|
10189
|
-
if (dataType === Types.ARRAY || dataType === Types.OBJECT)
|
|
10190
|
-
|
|
10191
|
-
downloadjs(jsonString, fileName, fileType);
|
|
10192
|
-
} else downloadjs(data, fileName, fileType);
|
|
10197
|
+
if (dataType === Types.ARRAY || dataType === Types.OBJECT) downloadjs(JSON.stringify(data, null, 2), fileName, fileType);
|
|
10198
|
+
else downloadjs(data, fileName, fileType);
|
|
10193
10199
|
} catch (err) {
|
|
10194
10200
|
console.error("Failed to download:", err);
|
|
10195
10201
|
}
|
|
@@ -11411,5 +11417,5 @@ var droppable_container_default = DroppableContainer;
|
|
|
11411
11417
|
early_console_buffer_default.getInstance().patchEarly();
|
|
11412
11418
|
|
|
11413
11419
|
//#endregion
|
|
11414
|
-
export { App, Dim, droppable_container_default as DroppableContainer, Embed, Env, EventFlow, Global, INSTANCE_ID_ATTRIBUTE, interaction_layer_default as InteractionLayer, InternalContainer, Link, sb_provider_default as MakeEditableWithSuperblocks, NO_CONTENT_ATTRIBUTE, Outlet, PORTAL_ROOT_ID, Page, page_not_found_default as PageNotFound, Prop, Property, Section as PropertyPanelSection, PropsPanelCategory, RouteLoadError, SB, SbApi, SbEvent, sb_provider_default as SbProvider, StateVar, StateVarPersistence, Theme, Timer, TriggerStepType, UnstyledInternalContainer, computed, containerLayout as containerLayoutProps, copyToClipboard, createRoot, createScope, download, generatePath, loading as loadingProp, logoutIntegrations, margin as marginProp, navigateTo, registerApp, registerComponent, registerPage, registerScope, setQueryParams, shouldScrollContents as shouldScrollContentsProps, size as sizeProp, useDialogEditing, use_editor_default as useEditor, usePopoverRootElement, useTheme, useUpdateProperties, visible as visibleProp, widthWithoutFit as widthWithoutFitProp };
|
|
11420
|
+
export { App, BuildErrorModal, Dim, droppable_container_default as DroppableContainer, Embed, Env, EventFlow, FileManager, Global, INSTANCE_ID_ATTRIBUTE, interaction_layer_default as InteractionLayer, InternalContainer, Link, sb_provider_default as MakeEditableWithSuperblocks, NO_CONTENT_ATTRIBUTE, Outlet, PORTAL_ROOT_ID, Page, page_not_found_default as PageNotFound, Prop, Property, Section as PropertyPanelSection, PropsPanelCategory, RouteLoadError, SB, SbApi, SbEvent, sb_provider_default as SbProvider, StateVar, StateVarPersistence, Theme, Timer, TriggerStepType, UnstyledInternalContainer, computed, containerLayout as containerLayoutProps, copyToClipboard, createRoot, createScope, download, editorBridge, generatePath, getFileWithUploadId, loading as loadingProp, logoutIntegrations, margin as marginProp, navigateTo, registerApp, registerComponent, registerPage, registerScope, setQueryParams, shouldScrollContents as shouldScrollContentsProps, size as sizeProp, useDialogEditing, use_editor_default as useEditor, usePopoverRootElement, useTheme, useUpdateProperties, visible as visibleProp, widthWithoutFit as widthWithoutFitProp };
|
|
11415
11421
|
//# sourceMappingURL=index.js.map
|