@superblocksteam/library 2.0.42-next.48 → 2.0.42-next.49
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.js +67 -105
- 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-DHEbJGYN.js → root-store-DSXdJ9lh.js} +24 -45
- package/dist/root-store-DSXdJ9lh.js.map +1 -0
- package/package.json +2 -2
- package/dist/root-store-B9bo79E9.js +0 -4
- package/dist/root-store-DHEbJGYN.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, 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-
|
|
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";
|
|
@@ -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,
|
|
@@ -3136,13 +3133,10 @@ const ShimmerDiv = styled.div`
|
|
|
3136
3133
|
*/
|
|
3137
3134
|
function SuspenseFallback({ style, noBorderRadius }) {
|
|
3138
3135
|
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
3136
|
return /* @__PURE__ */ jsx(ShimmerDiv, {
|
|
3143
|
-
$backgroundColor:
|
|
3144
|
-
$shimmerHighlight:
|
|
3145
|
-
$borderRadius: borderRadius
|
|
3137
|
+
$backgroundColor: theme?.colors?.neutral50 || "#f8f9fa",
|
|
3138
|
+
$shimmerHighlight: theme?.colors?.neutral100 || "#ffffff",
|
|
3139
|
+
$borderRadius: noBorderRadius ? "0px" : theme?.borderRadius.value + theme?.borderRadius.mode,
|
|
3146
3140
|
style: style?.(),
|
|
3147
3141
|
className: CSS_CLASSES.ANCHOR_NAME,
|
|
3148
3142
|
"data-test": "suspense-fallback"
|
|
@@ -3679,8 +3673,7 @@ const DropLayer = observer((props) => {
|
|
|
3679
3673
|
const isDropTargetStackLike = editStore.ui.dnd.isDropTargetStackLike;
|
|
3680
3674
|
const dropTargetId = editStore.ui.dnd.dropTargetId;
|
|
3681
3675
|
const isDropTargetInInteractionLayer = doesInteractionLayerContainInstance(props.rootInstanceId, dropTargetId);
|
|
3682
|
-
|
|
3683
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [possibleStackDrop && /* @__PURE__ */ jsx(StackDropPreview, {}), /* @__PURE__ */ jsx(DragOverlay, {
|
|
3676
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [editStore.ui.dnd.isDragging && isDropTargetInInteractionLayer && Boolean(draggedWidgetType && dropTargetWidgetType) && isDropTargetStackLike && /* @__PURE__ */ jsx(StackDropPreview, {}), /* @__PURE__ */ jsx(DragOverlay, {
|
|
3684
3677
|
modifiers: [snapCenterToCursor],
|
|
3685
3678
|
dropAnimation: null
|
|
3686
3679
|
})] });
|
|
@@ -3891,9 +3884,8 @@ function InteractionRectActions(props) {
|
|
|
3891
3884
|
const isAiTaggingEnabled = getEditStore().ai.getIsTaggingEnabled();
|
|
3892
3885
|
const shouldHideActions = !isPrimaryInstanceId;
|
|
3893
3886
|
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
3887
|
return /* @__PURE__ */ jsxs("div", {
|
|
3896
|
-
className: `sb-edit-interaction-rect-actions ${
|
|
3888
|
+
className: `sb-edit-interaction-rect-actions ${isAiTaggingEnabled && (aiContextMode === AiContextMode.AUTO_SELECT || aiContextMode === AiContextMode.HIGHLIGHT && type === "TARGETED") ? "sb-edit-actions-target-mode" : ""}`,
|
|
3897
3889
|
"data-sb-actions-id": instanceId,
|
|
3898
3890
|
style: {
|
|
3899
3891
|
...shouldHideActions ? { display: "none !important" } : {},
|
|
@@ -4136,7 +4128,7 @@ const useWidgetErrors = (params) => {
|
|
|
4136
4128
|
};
|
|
4137
4129
|
const useSelectionElements = (params) => {
|
|
4138
4130
|
const { focusedInstanceId, selectedInstanceIds, targetedSourceIds, aiContextMode, rootId } = params;
|
|
4139
|
-
const
|
|
4131
|
+
const visibleTargetedComponents = useViewportIntersection(useMemo(() => {
|
|
4140
4132
|
const components = [];
|
|
4141
4133
|
targetedSourceIds.forEach((sourceId) => {
|
|
4142
4134
|
const sourceInstanceIds = getEditStore().runtimeEntitiesManager.widgets.getAllInstanceIdsForSourceId(sourceId);
|
|
@@ -4146,8 +4138,7 @@ const useSelectionElements = (params) => {
|
|
|
4146
4138
|
})));
|
|
4147
4139
|
});
|
|
4148
4140
|
return components;
|
|
4149
|
-
}, [targetedSourceIds, rootId]);
|
|
4150
|
-
const visibleTargetedComponents = useViewportIntersection(allTargetedComponents);
|
|
4141
|
+
}, [targetedSourceIds, rootId]));
|
|
4151
4142
|
return useObserverMemo(() => {
|
|
4152
4143
|
const selectedRects = [];
|
|
4153
4144
|
visibleTargetedComponents.forEach((component) => {
|
|
@@ -4405,28 +4396,26 @@ const InteractionLayer = observer((props) => {
|
|
|
4405
4396
|
}, [handleCanvasClick]);
|
|
4406
4397
|
const isAiEditing = editStore.ai.getIsEditing();
|
|
4407
4398
|
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
4399
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", {
|
|
4426
4400
|
className: "sb-interaction-layer-wrapper",
|
|
4427
4401
|
children: [
|
|
4428
|
-
|
|
4429
|
-
|
|
4402
|
+
selectedElements.filter((info) => {
|
|
4403
|
+
const id = getEditWrapperIdWithType(info.instanceId, info.type);
|
|
4404
|
+
const element = document.querySelector(`[data-sb-selector="${id}"]`);
|
|
4405
|
+
return !isComponentTypeDetached(info.type) && element != null;
|
|
4406
|
+
}).map((info, index) => {
|
|
4407
|
+
return /* @__PURE__ */ jsx(InteractionRect, {
|
|
4408
|
+
isDragging: editStore.ui.dnd.isDragging,
|
|
4409
|
+
...info
|
|
4410
|
+
}, info.instanceId + info.selectionType + index);
|
|
4411
|
+
}),
|
|
4412
|
+
isComponentTypeDetached(props.rootType) ? /* @__PURE__ */ jsx(InteractionRect, {
|
|
4413
|
+
isDragging: false,
|
|
4414
|
+
selectionType: "FOCUSED",
|
|
4415
|
+
instanceId: props.rootInstanceId,
|
|
4416
|
+
displayName: props.rootName ?? "Unknown",
|
|
4417
|
+
hideRectBorder: false
|
|
4418
|
+
}, props.rootInstanceId) : null,
|
|
4430
4419
|
Object.entries(widgetWithErrors).map(([id, { name }]) => /* @__PURE__ */ jsx(InteractionRect, {
|
|
4431
4420
|
isDragging: false,
|
|
4432
4421
|
selectionType: "ERROR",
|
|
@@ -4791,9 +4780,7 @@ function getRgbArrayFromHex(hex) {
|
|
|
4791
4780
|
];
|
|
4792
4781
|
}
|
|
4793
4782
|
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];
|
|
4783
|
+
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
4784
|
}
|
|
4798
4785
|
function checkContrast(foreground, background) {
|
|
4799
4786
|
const textColor = getRgbArrayFromHex(foreground);
|
|
@@ -4816,11 +4803,10 @@ const getPrimaryVariants = (primaryColor, neutralColor) => {
|
|
|
4816
4803
|
const shouldLighten = tinycolor(primaryColor).isDark();
|
|
4817
4804
|
const primary500 = neutralColor ? adjustForReadability(primaryColor, neutralColor) : primaryColor;
|
|
4818
4805
|
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
4806
|
return {
|
|
4821
4807
|
primary500,
|
|
4822
4808
|
primary600,
|
|
4823
|
-
primary700
|
|
4809
|
+
primary700: shouldLighten ? tinycolor(primary600).lighten(5).toHexString() : tinycolor(primary600).darken(5).toHexString()
|
|
4824
4810
|
};
|
|
4825
4811
|
};
|
|
4826
4812
|
function generateThemeColors({ themePrimaryColor, palette, isDarkMode }) {
|
|
@@ -4922,7 +4908,7 @@ function generateTheme(userDefinedTheme, overrides, overrideMode) {
|
|
|
4922
4908
|
fontFamily: typeFace,
|
|
4923
4909
|
textColor: { default: generatedColors.neutral700 }
|
|
4924
4910
|
};
|
|
4925
|
-
|
|
4911
|
+
return merge({
|
|
4926
4912
|
version: 5,
|
|
4927
4913
|
colors: generatedColors,
|
|
4928
4914
|
fontFamily: typeFace,
|
|
@@ -5475,8 +5461,7 @@ function generateTheme(userDefinedTheme, overrides, overrideMode) {
|
|
|
5475
5461
|
disabled: generatedColors.neutral300,
|
|
5476
5462
|
error: generatedColors.danger
|
|
5477
5463
|
} } }
|
|
5478
|
-
};
|
|
5479
|
-
return merge(theme, overrides);
|
|
5464
|
+
}, overrides);
|
|
5480
5465
|
}
|
|
5481
5466
|
|
|
5482
5467
|
//#endregion
|
|
@@ -5990,8 +5975,7 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, onClose
|
|
|
5990
5975
|
root_store_default.editStore?.connectionManager.initializeSocket();
|
|
5991
5976
|
try {
|
|
5992
5977
|
let stopSocketHeartbeat;
|
|
5993
|
-
const
|
|
5994
|
-
const isocket = new ISocketWithClientAuth(ws, void 0, {
|
|
5978
|
+
const socket = createISocketClient(new ISocketWithClientAuth(await connectWebSocket(wsUrl.toString()), void 0, {
|
|
5995
5979
|
nonVisualEdit: [async () => {
|
|
5996
5980
|
getEditStore().ui.selectWidget(null);
|
|
5997
5981
|
}],
|
|
@@ -6080,8 +6064,7 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, onClose
|
|
|
6080
6064
|
connectionTimeoutInSeconds: void 0,
|
|
6081
6065
|
noResponseTimeoutInSeconds: 60
|
|
6082
6066
|
}
|
|
6083
|
-
});
|
|
6084
|
-
const socket = createISocketClient(isocket);
|
|
6067
|
+
}));
|
|
6085
6068
|
console.log("connected to socket");
|
|
6086
6069
|
stopSocketHeartbeat = startSocketHeartbeat(socket);
|
|
6087
6070
|
root_store_default.editStore?.connectionManager.connect();
|
|
@@ -6125,11 +6108,9 @@ function generateAndSendComponentDocs(options) {
|
|
|
6125
6108
|
//#endregion
|
|
6126
6109
|
//#region src/lib/internal-details/identifier-normalizer.ts
|
|
6127
6110
|
const getNormalizedIdInfo = (params) => {
|
|
6128
|
-
const name = params.bind?.entityName;
|
|
6129
|
-
const scopeId = params.bind?.scopeId ?? params.fallbackScopeId;
|
|
6130
6111
|
return {
|
|
6131
|
-
name,
|
|
6132
|
-
scopeId
|
|
6112
|
+
name: params.bind?.entityName,
|
|
6113
|
+
scopeId: params.bind?.scopeId ?? params.fallbackScopeId
|
|
6133
6114
|
};
|
|
6134
6115
|
};
|
|
6135
6116
|
|
|
@@ -6882,11 +6863,10 @@ const fixCursorSnapOffset = (args) => {
|
|
|
6882
6863
|
if (!a.pointerInside && b.pointerInside) return 1;
|
|
6883
6864
|
return (bData?.depth ?? 0) - (aData?.depth ?? 0);
|
|
6884
6865
|
});
|
|
6885
|
-
const
|
|
6866
|
+
const result = bubblingToParentIfFar({
|
|
6886
6867
|
...updated,
|
|
6887
6868
|
collisions: sortedCollisions
|
|
6888
|
-
};
|
|
6889
|
-
const result = bubblingToParentIfFar(modifiedArgs);
|
|
6869
|
+
});
|
|
6890
6870
|
if (result[0]) result[0].data = {
|
|
6891
6871
|
...result[0].data ?? {},
|
|
6892
6872
|
injectedCollisionRect: updated.collisionRect
|
|
@@ -7084,16 +7064,14 @@ const useHandleDnDEvents = () => {
|
|
|
7084
7064
|
const draggedId = event.active?.id ? String(event.active?.id) : null;
|
|
7085
7065
|
if (dropTargetId !== editStore.ui.dnd.dropTargetId) throw new Error("Drop target id and drag over id do not match");
|
|
7086
7066
|
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");
|
|
7067
|
+
if (editStore.ui.dnd.isDropTargetStackLike) possibleNewComponentId = await handleStackDrop({
|
|
7068
|
+
dropInfo: editStore.ui.dnd.stack.refreshPositionsAndGetDropIndex(),
|
|
7069
|
+
isDraggingNewComponent: editStore.ui.dnd.isDraggingNewComponent,
|
|
7070
|
+
newComponentType: editStore.ui.dnd.dragToCanvasComponentType,
|
|
7071
|
+
dropTargetId,
|
|
7072
|
+
draggedId
|
|
7073
|
+
});
|
|
7074
|
+
else throw new Error("Grid is no longer supported");
|
|
7097
7075
|
} catch (e) {
|
|
7098
7076
|
console.error("Error dropping item", e);
|
|
7099
7077
|
} finally {
|
|
@@ -7126,11 +7104,8 @@ const DragHandlerComponent = () => {
|
|
|
7126
7104
|
return null;
|
|
7127
7105
|
};
|
|
7128
7106
|
const DnDProvider = (props) => {
|
|
7129
|
-
const pointerSensor = useSensor(PointerSensor, pointerConfig);
|
|
7130
|
-
const customPointerSensor = useSensor(CustomPointerSensor);
|
|
7131
|
-
const sensors = useSensors(pointerSensor, customPointerSensor);
|
|
7132
7107
|
return /* @__PURE__ */ jsxs(DndContext, {
|
|
7133
|
-
sensors,
|
|
7108
|
+
sensors: useSensors(useSensor(PointerSensor, pointerConfig), useSensor(CustomPointerSensor)),
|
|
7134
7109
|
collisionDetection: collision_detection_default,
|
|
7135
7110
|
children: [props.children, /* @__PURE__ */ jsx(DragHandlerComponent, {})]
|
|
7136
7111
|
});
|
|
@@ -7581,8 +7556,7 @@ var PropertiesPanelManager = class {
|
|
|
7581
7556
|
if (!props?.type) return { sections: [] };
|
|
7582
7557
|
const propertiesDefinition$5 = this.propertiesDefinitions.get(props.type);
|
|
7583
7558
|
if (!propertiesDefinition$5) return { sections: [] };
|
|
7584
|
-
|
|
7585
|
-
return createPropertiesPanelDefinition(propertiesDefinition$5, props, state);
|
|
7559
|
+
return createPropertiesPanelDefinition(propertiesDefinition$5, props, this.entityManager.getState(scopeId));
|
|
7586
7560
|
}
|
|
7587
7561
|
trackPropertiesPanel(scopeId, instanceId, sourceId) {
|
|
7588
7562
|
if (this.propertiesPanelTrackerDisposer) this.propertiesPanelTrackerDisposer();
|
|
@@ -8481,13 +8455,11 @@ const computeDragInfo = (params) => {
|
|
|
8481
8455
|
gapSize /= 2;
|
|
8482
8456
|
let offsetPx;
|
|
8483
8457
|
if (potentialIdx === filteredChildIds.length) {
|
|
8484
|
-
const
|
|
8485
|
-
const rect = childRects[lastInstanceId]?.[0];
|
|
8458
|
+
const rect = childRects[filteredChildIds[filteredChildIds.length - 1]]?.[0];
|
|
8486
8459
|
if (!rect) return;
|
|
8487
8460
|
offsetPx = major.end(rect) - DROP_LINE_THICKNESS / 2 + gapSize;
|
|
8488
8461
|
} else {
|
|
8489
|
-
const
|
|
8490
|
-
const rect = childRects[instanceId]?.[0];
|
|
8462
|
+
const rect = childRects[filteredChildIds[potentialIdx]]?.[0];
|
|
8491
8463
|
if (!rect) return;
|
|
8492
8464
|
offsetPx = major.start(rect) - DROP_LINE_THICKNESS / 2 - gapSize;
|
|
8493
8465
|
}
|
|
@@ -8525,8 +8497,7 @@ const computeDragInfo = (params) => {
|
|
|
8525
8497
|
let insertionIndex = filteredInsertionIndex;
|
|
8526
8498
|
if (insertionIndex === filteredChildIds.length) insertionIndex = childrenNodes.length;
|
|
8527
8499
|
else {
|
|
8528
|
-
const
|
|
8529
|
-
const originalIndex = childRects[widgetAtInsertionIndex]?.[1];
|
|
8500
|
+
const originalIndex = childRects[filteredChildIds[filteredInsertionIndex]]?.[1];
|
|
8530
8501
|
if (originalIndex != null) insertionIndex = originalIndex;
|
|
8531
8502
|
}
|
|
8532
8503
|
return {
|
|
@@ -8651,8 +8622,7 @@ var DragAndDropManager = class {
|
|
|
8651
8622
|
}
|
|
8652
8623
|
get isDropTargetStackLike() {
|
|
8653
8624
|
const dropTargetId = this.dropTargetId;
|
|
8654
|
-
|
|
8655
|
-
return isComponentStacklike(widgetMeta);
|
|
8625
|
+
return isComponentStacklike(dropTargetId ? getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetId) : void 0);
|
|
8656
8626
|
}
|
|
8657
8627
|
get draggedWidgetType() {
|
|
8658
8628
|
if (this.isDraggingNewComponent) return this._dragToCanvasComponentType;
|
|
@@ -8682,12 +8652,11 @@ var DragAndDropManager = class {
|
|
|
8682
8652
|
const draggedType = this.draggedWidgetType;
|
|
8683
8653
|
const dropTargetType = this.dropTargetWidgetType;
|
|
8684
8654
|
if (!draggedType || !dropTargetType) return false;
|
|
8685
|
-
const dropTargetEmpty = (dropTargetInstanceId && getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetInstanceId)?.children?.length === 0) ?? true;
|
|
8686
8655
|
return isDragAndDropTypeValid({
|
|
8687
8656
|
draggedType,
|
|
8688
8657
|
dropTargetType,
|
|
8689
8658
|
isDraggingNewComponent,
|
|
8690
|
-
dropTargetEmpty
|
|
8659
|
+
dropTargetEmpty: (dropTargetInstanceId && getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(dropTargetInstanceId)?.children?.length === 0) ?? true
|
|
8691
8660
|
});
|
|
8692
8661
|
}
|
|
8693
8662
|
canDragWidget(instanceId) {
|
|
@@ -9560,7 +9529,7 @@ const EmbedWrapper = (props) => {
|
|
|
9560
9529
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
9561
9530
|
if (root_store_default.windowOriginUrl) import("./utils-BCrSLIhM.js").then(({ initTracerProviderWithOrigin }) => {
|
|
9562
9531
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
9563
|
-
import("./logs-
|
|
9532
|
+
import("./logs-DDh7Anxs.js").then(({ initLibraryLoggerProvider }) => {
|
|
9564
9533
|
initLibraryLoggerProvider({
|
|
9565
9534
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
9566
9535
|
appId: event.data.payload.appId,
|
|
@@ -9740,9 +9709,8 @@ const EmbedWrapper = (props) => {
|
|
|
9740
9709
|
return getEditStore().onViteMessage(ViteMessageKind.ROUTE_CHANGE, async (message) => {
|
|
9741
9710
|
try {
|
|
9742
9711
|
const { route, routeTestParams } = message;
|
|
9743
|
-
const path = generatePath$1(route, routeTestParams);
|
|
9744
9712
|
await navigate({
|
|
9745
|
-
pathname:
|
|
9713
|
+
pathname: generatePath$1(route, routeTestParams),
|
|
9746
9714
|
search: location.search
|
|
9747
9715
|
});
|
|
9748
9716
|
} catch (error$1) {
|
|
@@ -9808,7 +9776,7 @@ const EmbedWrapper$1 = (props) => {
|
|
|
9808
9776
|
root_store_default.windowOriginUrl = event.data.payload.logContext.superblocks_window_origin_url;
|
|
9809
9777
|
if (root_store_default.windowOriginUrl) import("./utils-BCrSLIhM.js").then(({ initTracerProviderWithOrigin }) => {
|
|
9810
9778
|
initTracerProviderWithOrigin(root_store_default.windowOriginUrl);
|
|
9811
|
-
import("./logs-
|
|
9779
|
+
import("./logs-DDh7Anxs.js").then(({ initLibraryLoggerProvider }) => {
|
|
9812
9780
|
initLibraryLoggerProvider({
|
|
9813
9781
|
windowOriginUrl: root_store_default.windowOriginUrl,
|
|
9814
9782
|
appId: event.data.payload.appId,
|
|
@@ -9991,8 +9959,7 @@ const initializeStyles = (appName) => {
|
|
|
9991
9959
|
...VARIABLE_VALUES,
|
|
9992
9960
|
...componentVariableValues
|
|
9993
9961
|
};
|
|
9994
|
-
|
|
9995
|
-
createStyleSheetFromString(appName, `:${appName} {${variableDefns}}\n${stylesheet}`);
|
|
9962
|
+
createStyleSheetFromString(appName, `:${appName} {${Object.keys(allVariables).map((variable) => `${allVariables[variable]}: ${allVariableValues[variable]};`).join("\n")}}\n${stylesheet}`);
|
|
9996
9963
|
};
|
|
9997
9964
|
|
|
9998
9965
|
//#endregion
|
|
@@ -10000,11 +9967,10 @@ const initializeStyles = (appName) => {
|
|
|
10000
9967
|
const originalLog = console.log;
|
|
10001
9968
|
console.log = (...args) => {
|
|
10002
9969
|
try {
|
|
10003
|
-
|
|
9970
|
+
originalLog(...args.map((arg) => {
|
|
10004
9971
|
if (arg && typeof arg === "object" && (getBindingIdentifier(arg) || getBindingIdentifier(arg.bind ?? {}))) return JSON.parse(JSON.stringify(arg));
|
|
10005
9972
|
return arg;
|
|
10006
|
-
});
|
|
10007
|
-
originalLog(...processedArgs);
|
|
9973
|
+
}));
|
|
10008
9974
|
} catch {}
|
|
10009
9975
|
};
|
|
10010
9976
|
const loadApisIntoLibrary = async function loadApisIntoLibrary$1() {
|
|
@@ -10031,9 +9997,7 @@ const SbProvider = function SbProvider$1({ name = "codemode", settings, children
|
|
|
10031
9997
|
runApiInitialization();
|
|
10032
9998
|
}, [runApiInitialization]);
|
|
10033
9999
|
useEffect(() => {
|
|
10034
|
-
|
|
10035
|
-
const userAccessibleTheme$1 = generateTheme(mergedTheme, settings?.themeOverrides);
|
|
10036
|
-
setUserAccessibleTheme(userAccessibleTheme$1);
|
|
10000
|
+
setUserAccessibleTheme(generateTheme(merge(BASE_THEME_V5, settings?.theme), settings?.themeOverrides));
|
|
10037
10001
|
}, [settings?.theme, settings?.themeOverrides]);
|
|
10038
10002
|
useEffect(() => {
|
|
10039
10003
|
const resolvePromiseListener = (event) => {
|
|
@@ -10186,10 +10150,8 @@ function setQueryParams(queryParams = {}, preserveExistingQueryParams = true) {
|
|
|
10186
10150
|
function download(data, fileName, fileType) {
|
|
10187
10151
|
try {
|
|
10188
10152
|
const dataType = getType(data);
|
|
10189
|
-
if (dataType === Types.ARRAY || dataType === Types.OBJECT)
|
|
10190
|
-
|
|
10191
|
-
downloadjs(jsonString, fileName, fileType);
|
|
10192
|
-
} else downloadjs(data, fileName, fileType);
|
|
10153
|
+
if (dataType === Types.ARRAY || dataType === Types.OBJECT) downloadjs(JSON.stringify(data, null, 2), fileName, fileType);
|
|
10154
|
+
else downloadjs(data, fileName, fileType);
|
|
10193
10155
|
} catch (err) {
|
|
10194
10156
|
console.error("Failed to download:", err);
|
|
10195
10157
|
}
|