@superblocksteam/library 2.0.41-next.9 → 2.0.42-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.map +1 -1
- package/dist/index.js +209 -112
- package/dist/index.js.map +1 -1
- package/dist/root-store-DbFURfA3.js +4 -0
- package/dist/{root-store-D4uiJaOf.js → root-store-mvrXQD3h.js} +8 -4
- package/dist/{root-store-D4uiJaOf.js.map → root-store-mvrXQD3h.js.map} +1 -1
- package/package.json +3 -3
- package/dist/root-store-Q_vdc108.js +0 -4
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, 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-mvrXQD3h.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";
|
|
@@ -7,7 +7,7 @@ import * as React$1 from "react";
|
|
|
7
7
|
import React, { Component, Suspense, createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
8
8
|
import styled, { keyframes } from "styled-components";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { Dim, Dim as Dim$1, INSTANCE_ID_ATTRIBUTE, INSTANCE_ID_ATTRIBUTE as INSTANCE_ID_ATTRIBUTE$1, NATIVE_COMPONENT_TYPES, NO_CONTENT_ATTRIBUTE, NO_CONTENT_ATTRIBUTE as NO_CONTENT_ATTRIBUTE$1, PAGE_COMPONENT_TYPE, PROCESSED_TRANSACTIONS_ATTRIBUTE, Property, Property as Property$1, ROOT_WIDGET_ATTRIBUTE, SB, SB as SB$1, SOURCE_ID_ATTRIBUTE, WIDGET_INDEX_WITHIN_PARENT, WIDGET_PARENT_INSTANCE_ID_ATTRIBUTE, generateSourceId, getBindingIdentifier, getRuntimeComputedExpression, getStableScopeId, isBindingEqual, isBindingString, isDimension, isEntityWithBindingIdentifier, isPropertyInfo, predictableNameGenerator, withBindingIdentifier } from "@superblocksteam/library-shared";
|
|
10
|
+
import { Dim, Dim as Dim$1, INSTANCE_ID_ATTRIBUTE, INSTANCE_ID_ATTRIBUTE as INSTANCE_ID_ATTRIBUTE$1, NATIVE_COMPONENT_TYPES, NO_CONTENT_ATTRIBUTE, NO_CONTENT_ATTRIBUTE as NO_CONTENT_ATTRIBUTE$1, PAGE_COMPONENT_TYPE, PROCESSED_TRANSACTIONS_ATTRIBUTE, Property, Property as Property$1, ROOT_WIDGET_ATTRIBUTE, SB, SB as SB$1, SOURCE_ID_ATTRIBUTE, WIDGET_DISABLE_DND, WIDGET_INDEX_WITHIN_PARENT, WIDGET_PARENT_INSTANCE_ID_ATTRIBUTE, generateSourceId, getBindingIdentifier, getRuntimeComputedExpression, getStableScopeId, isBindingEqual, isBindingString, isDimension, isEntityWithBindingIdentifier, isPropertyInfo, predictableNameGenerator, withBindingIdentifier } from "@superblocksteam/library-shared";
|
|
11
11
|
import { action, autorun, computed as computed$1, isObservable, makeAutoObservable, makeObservable, observable, reaction, runInAction, toJS, when } from "mobx";
|
|
12
12
|
import { Link, Outlet, UNSAFE_DataRouterContext, generatePath, generatePath as generatePath$1, useLocation, useNavigate, useParams, useRouteError } from "react-router";
|
|
13
13
|
import { ISocketWithClientAuth, OBS_TAG_APPLICATION_ID, connectWebSocket, createISocketClient } from "@superblocksteam/shared";
|
|
@@ -15,8 +15,8 @@ import { trace } from "@opentelemetry/api";
|
|
|
15
15
|
import { observer } from "mobx-react-lite";
|
|
16
16
|
import { compile, middleware, prefixer, serialize, stringify } from "stylis";
|
|
17
17
|
import polyfill from "@oddbird/css-anchor-positioning/fn";
|
|
18
|
-
import * as Popover from "@radix-ui/react-popover";
|
|
19
18
|
import { DndContext, DragOverlay, PointerSensor, rectIntersection, useDndMonitor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
|
|
19
|
+
import * as Popover from "@radix-ui/react-popover";
|
|
20
20
|
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";
|
|
@@ -89,7 +89,8 @@ const PASSTHROUGH_KEYS = [
|
|
|
89
89
|
ROOT_WIDGET_ATTRIBUTE,
|
|
90
90
|
INSTANCE_ID_ATTRIBUTE$1,
|
|
91
91
|
WIDGET_PARENT_INSTANCE_ID_ATTRIBUTE,
|
|
92
|
-
WIDGET_INDEX_WITHIN_PARENT
|
|
92
|
+
WIDGET_INDEX_WITHIN_PARENT,
|
|
93
|
+
WIDGET_DISABLE_DND
|
|
93
94
|
];
|
|
94
95
|
const usePassthroughProps = (props) => {
|
|
95
96
|
const passThroughItems = PASSTHROUGH_KEYS.map((key) => props[key]);
|
|
@@ -2193,6 +2194,40 @@ const InternalContainer = (props) => {
|
|
|
2193
2194
|
});
|
|
2194
2195
|
};
|
|
2195
2196
|
|
|
2197
|
+
//#endregion
|
|
2198
|
+
//#region src/lib/internal-details/internal-components/spinner.tsx
|
|
2199
|
+
const Spinner = styled.span`
|
|
2200
|
+
width: 50px;
|
|
2201
|
+
height: 50px;
|
|
2202
|
+
border: 4px solid #e0e1e5;
|
|
2203
|
+
border-bottom-color: #8c95a1;
|
|
2204
|
+
border-radius: 50%;
|
|
2205
|
+
display: inline-block;
|
|
2206
|
+
box-sizing: border-box;
|
|
2207
|
+
animation: rotation 0.5s linear infinite;
|
|
2208
|
+
|
|
2209
|
+
@keyframes rotation {
|
|
2210
|
+
0% {
|
|
2211
|
+
transform: rotate(0deg);
|
|
2212
|
+
}
|
|
2213
|
+
100% {
|
|
2214
|
+
transform: rotate(360deg);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
`;
|
|
2218
|
+
const FullPageSpinner = () => {
|
|
2219
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2220
|
+
style: {
|
|
2221
|
+
display: "flex",
|
|
2222
|
+
justifyContent: "center",
|
|
2223
|
+
alignItems: "center",
|
|
2224
|
+
height: "100svh",
|
|
2225
|
+
width: "100%"
|
|
2226
|
+
},
|
|
2227
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
2228
|
+
});
|
|
2229
|
+
};
|
|
2230
|
+
|
|
2196
2231
|
//#endregion
|
|
2197
2232
|
//#region src/lib/internal-details/css-constants.ts
|
|
2198
2233
|
const CSS_CLASSES = {
|
|
@@ -2200,6 +2235,98 @@ const CSS_CLASSES = {
|
|
|
2200
2235
|
ANCHOR_NAME: "sb-anchor-name"
|
|
2201
2236
|
};
|
|
2202
2237
|
|
|
2238
|
+
//#endregion
|
|
2239
|
+
//#region src/edit-mode/dnd/hooks/use-component-draggable.ts
|
|
2240
|
+
function useComponentDraggable({ instanceId, disableDrag }) {
|
|
2241
|
+
return useDraggable({
|
|
2242
|
+
id: instanceId,
|
|
2243
|
+
disabled: disableDrag,
|
|
2244
|
+
data: { instanceId }
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/edit-mode/dnd/use-draggable-widget.ts
|
|
2250
|
+
function useDraggableWidget(props) {
|
|
2251
|
+
const editStore = getEditStore();
|
|
2252
|
+
const disableDrag = props.disableDrag || editStore.ui.dnd.isDraggingNewComponent;
|
|
2253
|
+
const specificWidgetDragDisabled = !editStore.ui.dnd.canDragWidget(props.instanceId);
|
|
2254
|
+
const { setNodeRef, isDragging, listeners, attributes } = useComponentDraggable({
|
|
2255
|
+
instanceId: props.instanceId,
|
|
2256
|
+
disableDrag: disableDrag ?? false
|
|
2257
|
+
});
|
|
2258
|
+
const onPointerDown = useCallback((e) => {
|
|
2259
|
+
if (e.target instanceof HTMLElement && e.target.dataset.ignoreDnd) return;
|
|
2260
|
+
if (specificWidgetDragDisabled) e.stopPropagation();
|
|
2261
|
+
else listeners?.onPointerDown(e);
|
|
2262
|
+
}, [specificWidgetDragDisabled, listeners]);
|
|
2263
|
+
const onPointerMove = useCallback((e) => {
|
|
2264
|
+
if (specificWidgetDragDisabled) e.stopPropagation();
|
|
2265
|
+
else listeners?.onPointerMove(e);
|
|
2266
|
+
}, [specificWidgetDragDisabled, listeners]);
|
|
2267
|
+
return useMemo(() => {
|
|
2268
|
+
return {
|
|
2269
|
+
...listeners,
|
|
2270
|
+
...attributes,
|
|
2271
|
+
className: "sb-draggable-wrapper",
|
|
2272
|
+
"data-is-dragged": isDragging,
|
|
2273
|
+
onPointerDown,
|
|
2274
|
+
onPointerMove,
|
|
2275
|
+
setNodeRef
|
|
2276
|
+
};
|
|
2277
|
+
}, [
|
|
2278
|
+
listeners,
|
|
2279
|
+
attributes,
|
|
2280
|
+
isDragging,
|
|
2281
|
+
onPointerDown,
|
|
2282
|
+
onPointerMove,
|
|
2283
|
+
setNodeRef
|
|
2284
|
+
]);
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
//#endregion
|
|
2288
|
+
//#region src/lib/internal-details/draggable-context-provider.tsx
|
|
2289
|
+
const DraggablePropsContext = createContext({
|
|
2290
|
+
instanceId: void 0,
|
|
2291
|
+
props: {
|
|
2292
|
+
className: void 0,
|
|
2293
|
+
ref: null
|
|
2294
|
+
}
|
|
2295
|
+
});
|
|
2296
|
+
const DraggablePropsProvider = ({ identifier, disableDrag, children }) => {
|
|
2297
|
+
const draggableWidgetProps = useDraggableWidget({
|
|
2298
|
+
instanceId: identifier.instanceId,
|
|
2299
|
+
disableDrag
|
|
2300
|
+
});
|
|
2301
|
+
const setNodeRef = draggableWidgetProps.setNodeRef;
|
|
2302
|
+
const handleRef = useCallback((el) => {
|
|
2303
|
+
setNodeRef(el);
|
|
2304
|
+
}, [setNodeRef]);
|
|
2305
|
+
const value = useMemo(() => {
|
|
2306
|
+
return {
|
|
2307
|
+
instanceId: identifier.instanceId,
|
|
2308
|
+
props: {
|
|
2309
|
+
...draggableWidgetProps,
|
|
2310
|
+
ref: handleRef
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
}, [
|
|
2314
|
+
draggableWidgetProps,
|
|
2315
|
+
handleRef,
|
|
2316
|
+
identifier.instanceId
|
|
2317
|
+
]);
|
|
2318
|
+
return /* @__PURE__ */ jsx(DraggablePropsContext.Provider, {
|
|
2319
|
+
value,
|
|
2320
|
+
children
|
|
2321
|
+
});
|
|
2322
|
+
};
|
|
2323
|
+
const EMPTY_PROPS = {};
|
|
2324
|
+
const useMyDraggableProps = (instanceId) => {
|
|
2325
|
+
const contextValue = useContext(DraggablePropsContext);
|
|
2326
|
+
if (contextValue.instanceId !== instanceId) return EMPTY_PROPS;
|
|
2327
|
+
return contextValue.props;
|
|
2328
|
+
};
|
|
2329
|
+
|
|
2203
2330
|
//#endregion
|
|
2204
2331
|
//#region src/lib/user-facing/assets/icons/close.svg
|
|
2205
2332
|
var _path$4;
|
|
@@ -3172,6 +3299,33 @@ const WrappedReactiveComponent = (props) => {
|
|
|
3172
3299
|
};
|
|
3173
3300
|
var reactive_component_default = WrappedReactiveComponent;
|
|
3174
3301
|
|
|
3302
|
+
//#endregion
|
|
3303
|
+
//#region src/lib/internal-details/editor-reactive-component.tsx
|
|
3304
|
+
const mergeProps = (props1, props2) => {
|
|
3305
|
+
const mergedClassName = props1.className && props2.className ? `${props1.className} ${props2.className}` : props1.className || props2.className;
|
|
3306
|
+
const mergedStyle = {
|
|
3307
|
+
...props1.style,
|
|
3308
|
+
...props2.style
|
|
3309
|
+
};
|
|
3310
|
+
return {
|
|
3311
|
+
...props1,
|
|
3312
|
+
...props2,
|
|
3313
|
+
style: mergedStyle,
|
|
3314
|
+
className: mergedClassName
|
|
3315
|
+
};
|
|
3316
|
+
};
|
|
3317
|
+
const EditorReactiveComponent = (props) => {
|
|
3318
|
+
const { editorProps,...restProps } = props;
|
|
3319
|
+
const myDraggableProps = useMyDraggableProps(props.identifier.instanceId);
|
|
3320
|
+
const mergedEditorProps = useMemo(() => {
|
|
3321
|
+
return mergeProps(editorProps ?? {}, myDraggableProps);
|
|
3322
|
+
}, [editorProps, myDraggableProps]);
|
|
3323
|
+
return /* @__PURE__ */ jsx(reactive_component_default, {
|
|
3324
|
+
...restProps,
|
|
3325
|
+
editorProps: mergedEditorProps
|
|
3326
|
+
});
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3175
3329
|
//#endregion
|
|
3176
3330
|
//#region src/lib/utils/is-component-type-detached.ts
|
|
3177
3331
|
function isComponentTypeDetached(componentType) {
|
|
@@ -3253,14 +3407,19 @@ const getWidgetNode = (instanceId) => {
|
|
|
3253
3407
|
const type = root_store_default.nameManager.getExistingIdentifier(instanceId)?.type;
|
|
3254
3408
|
return document?.querySelector(`[data-sb-selector="${getEditWrapperIdWithType(instanceId, type)}"]`);
|
|
3255
3409
|
};
|
|
3256
|
-
const doesInteractionLayerContainInstance = (possibleParent, possibleChild) => {
|
|
3410
|
+
const doesInteractionLayerContainInstance = (possibleParent, possibleChild, handleNewlyCreatedComponents = false) => {
|
|
3257
3411
|
if (!possibleParent || !possibleChild) return false;
|
|
3258
3412
|
const editStore = getEditStore();
|
|
3259
3413
|
const parentMeta = editStore.runtimeEntitiesManager.getEditorWidgetMeta(possibleParent);
|
|
3260
3414
|
const childMeta = editStore.runtimeEntitiesManager.getEditorWidgetMeta(possibleChild);
|
|
3415
|
+
if (!childMeta?.interactionLayerInstanceId && handleNewlyCreatedComponents) return true;
|
|
3261
3416
|
if (editStore.interactionLayerManager.interactionLayerInstanceIds.has(possibleParent)) return possibleChild === possibleParent || childMeta?.interactionLayerInstanceId === possibleParent;
|
|
3262
3417
|
return parentMeta?.interactionLayerInstanceId === childMeta?.interactionLayerInstanceId;
|
|
3263
3418
|
};
|
|
3419
|
+
const isPage = (instanceId) => {
|
|
3420
|
+
if (!instanceId) return false;
|
|
3421
|
+
return getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(instanceId)?.type === NATIVE_COMPONENT_TYPES.Page;
|
|
3422
|
+
};
|
|
3264
3423
|
|
|
3265
3424
|
//#endregion
|
|
3266
3425
|
//#region src/edit-mode/dnd/hooks/use-widget-node-ref.ts
|
|
@@ -3399,45 +3558,6 @@ const DroppableWidget = observer((props) => {
|
|
|
3399
3558
|
});
|
|
3400
3559
|
var droppable_widget_default = DroppableWidget;
|
|
3401
3560
|
|
|
3402
|
-
//#endregion
|
|
3403
|
-
//#region src/edit-mode/dnd/hooks/use-component-draggable.ts
|
|
3404
|
-
function useComponentDraggable({ instanceId, disableDrag }) {
|
|
3405
|
-
return useDraggable({
|
|
3406
|
-
id: instanceId,
|
|
3407
|
-
disabled: disableDrag,
|
|
3408
|
-
data: { instanceId }
|
|
3409
|
-
});
|
|
3410
|
-
}
|
|
3411
|
-
|
|
3412
|
-
//#endregion
|
|
3413
|
-
//#region src/edit-mode/dnd/use-draggable-widget.ts
|
|
3414
|
-
function useDraggableWidget(props) {
|
|
3415
|
-
const editStore = getEditStore();
|
|
3416
|
-
const disableDrag = props.disableDrag || editStore.ui.dnd.isDraggingNewComponent;
|
|
3417
|
-
const specificWidgetDragDisabled = !editStore.ui.dnd.canDragWidget(props.instanceId);
|
|
3418
|
-
const { setNodeRef, isDragging, listeners, attributes } = useComponentDraggable({
|
|
3419
|
-
instanceId: props.instanceId,
|
|
3420
|
-
disableDrag: disableDrag ?? false
|
|
3421
|
-
});
|
|
3422
|
-
const onPointerDown = useCallback((e) => {
|
|
3423
|
-
if (specificWidgetDragDisabled) e.stopPropagation();
|
|
3424
|
-
else listeners?.onPointerDown(e);
|
|
3425
|
-
}, [specificWidgetDragDisabled, listeners]);
|
|
3426
|
-
const onPointerMove = useCallback((e) => {
|
|
3427
|
-
if (specificWidgetDragDisabled) e.stopPropagation();
|
|
3428
|
-
else listeners?.onPointerMove(e);
|
|
3429
|
-
}, [specificWidgetDragDisabled, listeners]);
|
|
3430
|
-
return {
|
|
3431
|
-
...listeners,
|
|
3432
|
-
...attributes,
|
|
3433
|
-
className: "sb-draggable-wrapper",
|
|
3434
|
-
"data-is-dragged": isDragging,
|
|
3435
|
-
onPointerDown,
|
|
3436
|
-
onPointerMove,
|
|
3437
|
-
setNodeRef
|
|
3438
|
-
};
|
|
3439
|
-
}
|
|
3440
|
-
|
|
3441
3561
|
//#endregion
|
|
3442
3562
|
//#region src/edit-mode/hooks/use-right-click-menu.ts
|
|
3443
3563
|
function useRightClickMenu({ sourceId }) {
|
|
@@ -4561,18 +4681,6 @@ const EditWrapper = observer(function EditWrapper$1(props) {
|
|
|
4561
4681
|
});
|
|
4562
4682
|
const isDroppable = isEntityDroppable({ type: props.type });
|
|
4563
4683
|
const disableDrag = !isDraggable || !isContentDraggable(props.type);
|
|
4564
|
-
const draggableWidgetProps = useDraggableWidget({
|
|
4565
|
-
instanceId: props.identifier.instanceId,
|
|
4566
|
-
disableDrag
|
|
4567
|
-
});
|
|
4568
|
-
const { setDraggableNodeRef, draggableClassName, draggableProps } = useMemo(() => {
|
|
4569
|
-
const { setNodeRef: setDraggableNodeRef$1, className: draggableClassName$1,...draggableProps$1 } = draggableWidgetProps;
|
|
4570
|
-
return {
|
|
4571
|
-
setDraggableNodeRef: setDraggableNodeRef$1,
|
|
4572
|
-
draggableClassName: draggableClassName$1,
|
|
4573
|
-
draggableProps: draggableProps$1
|
|
4574
|
-
};
|
|
4575
|
-
}, [draggableWidgetProps]);
|
|
4576
4684
|
const { onContextMenu } = useRightClickMenu({ sourceId: props.identifier.sourceId });
|
|
4577
4685
|
const showVisibilityBackground = props.widgetProps.isVisible === false && !editStore.ui.getSelectedSourceIds().includes(props.identifier.sourceId);
|
|
4578
4686
|
const handleClick = useCallback((ev) => {
|
|
@@ -4592,13 +4700,10 @@ const EditWrapper = observer(function EditWrapper$1(props) {
|
|
|
4592
4700
|
stopPropagation();
|
|
4593
4701
|
}, [props.identifier.sourceId, props.identifier.instanceId]);
|
|
4594
4702
|
const [dropTargetElem, setDropTargetElem] = useState(null);
|
|
4595
|
-
const handleRef = useCallback((el) => {
|
|
4596
|
-
setDraggableNodeRef(el);
|
|
4597
|
-
}, [setDraggableNodeRef]);
|
|
4598
4703
|
const isEmpty$1 = React.Children.count(children) === 0;
|
|
4599
4704
|
const editorProps = useMemo(() => {
|
|
4600
4705
|
const testProps = identifier.name.isAnonymous ? {} : { "data-test": `component-${identifier.name.value}` };
|
|
4601
|
-
const componentClassName = `${CSS_CLASSES.ANCHOR_NAME}
|
|
4706
|
+
const componentClassName = `${CSS_CLASSES.ANCHOR_NAME}`;
|
|
4602
4707
|
const componentStyle = createAnchorNameStyle({ instanceId: props.identifier.instanceId });
|
|
4603
4708
|
return {
|
|
4604
4709
|
[INSTANCE_ID_ATTRIBUTE$1]: identifier.instanceId,
|
|
@@ -4608,23 +4713,18 @@ const EditWrapper = observer(function EditWrapper$1(props) {
|
|
|
4608
4713
|
"data-sb-selector": getEditWrapperId(props.identifier.instanceId),
|
|
4609
4714
|
onClick: handleClick,
|
|
4610
4715
|
onContextMenu,
|
|
4611
|
-
|
|
4612
|
-
...testProps,
|
|
4613
|
-
...draggableProps
|
|
4716
|
+
...testProps
|
|
4614
4717
|
};
|
|
4615
4718
|
}, [
|
|
4616
4719
|
identifier,
|
|
4617
|
-
draggableProps,
|
|
4618
|
-
draggableClassName,
|
|
4619
4720
|
handleClick,
|
|
4620
|
-
handleRef,
|
|
4621
4721
|
onContextMenu,
|
|
4622
4722
|
props.identifier.instanceId,
|
|
4623
4723
|
isEmpty$1
|
|
4624
4724
|
]);
|
|
4625
4725
|
const node = /* @__PURE__ */ jsx(ParentIdentifierProvider, {
|
|
4626
4726
|
identifier,
|
|
4627
|
-
children: /* @__PURE__ */ jsxs(
|
|
4727
|
+
children: /* @__PURE__ */ jsxs(EditorReactiveComponent, {
|
|
4628
4728
|
Component: props.component,
|
|
4629
4729
|
identifier,
|
|
4630
4730
|
widgetProps: props.widgetProps,
|
|
@@ -4646,6 +4746,11 @@ const EditWrapper = observer(function EditWrapper$1(props) {
|
|
|
4646
4746
|
widgetProps: props.widgetProps,
|
|
4647
4747
|
children: node
|
|
4648
4748
|
}) : node;
|
|
4749
|
+
if (isDraggable) content = /* @__PURE__ */ jsx(DraggablePropsProvider, {
|
|
4750
|
+
identifier: props.identifier,
|
|
4751
|
+
disableDrag,
|
|
4752
|
+
children: content
|
|
4753
|
+
});
|
|
4649
4754
|
if (isDroppable) content = /* @__PURE__ */ jsx(droppable_widget_default, {
|
|
4650
4755
|
instanceId: props.identifier.instanceId,
|
|
4651
4756
|
dropTargetElem,
|
|
@@ -5949,7 +6054,10 @@ async function connectSocket(serverUrl, { peerId, userId, applicationId, onClose
|
|
|
5949
6054
|
clientImport: [async (payload) => {
|
|
5950
6055
|
const { importPath } = payload;
|
|
5951
6056
|
try {
|
|
5952
|
-
await import(
|
|
6057
|
+
await import(
|
|
6058
|
+
/* @vite-ignore */
|
|
6059
|
+
`${importPath}?v=${Date.now()}`
|
|
6060
|
+
);
|
|
5953
6061
|
return;
|
|
5954
6062
|
} catch (error) {
|
|
5955
6063
|
const err = error;
|
|
@@ -6252,6 +6360,18 @@ const propertiesDefinition$4 = {
|
|
|
6252
6360
|
|
|
6253
6361
|
//#endregion
|
|
6254
6362
|
//#region src/lib/user-facing/components/page/index.tsx
|
|
6363
|
+
const SpinnerFadeIn = styled.div`
|
|
6364
|
+
display: contents;
|
|
6365
|
+
animation: fadein 0.2s ease-in-out forwards;
|
|
6366
|
+
@keyframes fadein {
|
|
6367
|
+
0% {
|
|
6368
|
+
opacity: 0;
|
|
6369
|
+
}
|
|
6370
|
+
100% {
|
|
6371
|
+
opacity: 1;
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
`;
|
|
6255
6375
|
const Page = registerComponentInternal(NATIVE_COMPONENT_TYPES.Page, { propertiesDefinition: propertiesDefinition$4 }, (props) => {
|
|
6256
6376
|
const { name, isAnonymous, style, onLoad, editorProps,...other } = props;
|
|
6257
6377
|
const { scopeId } = useScope();
|
|
@@ -6260,6 +6380,10 @@ const Page = registerComponentInternal(NATIVE_COMPONENT_TYPES.Page, { properties
|
|
|
6260
6380
|
onLoad?.();
|
|
6261
6381
|
});
|
|
6262
6382
|
}, [onLoad, scopeId]);
|
|
6383
|
+
const [initializing, setInitializing] = useState(true);
|
|
6384
|
+
useEffect(() => {
|
|
6385
|
+
setInitializing(false);
|
|
6386
|
+
}, []);
|
|
6263
6387
|
return /* @__PURE__ */ jsx("div", {
|
|
6264
6388
|
style: {
|
|
6265
6389
|
height: "100%",
|
|
@@ -6275,7 +6399,7 @@ const Page = registerComponentInternal(NATIVE_COMPONENT_TYPES.Page, { properties
|
|
|
6275
6399
|
...style
|
|
6276
6400
|
},
|
|
6277
6401
|
...other,
|
|
6278
|
-
children: props.children
|
|
6402
|
+
children: initializing ? /* @__PURE__ */ jsx(SpinnerFadeIn, { children: /* @__PURE__ */ jsx(FullPageSpinner, {}) }) : props.children
|
|
6279
6403
|
})
|
|
6280
6404
|
});
|
|
6281
6405
|
}).editorConfig(editorConfig$1);
|
|
@@ -6389,11 +6513,11 @@ const propertiesDefinition$2 = {
|
|
|
6389
6513
|
})
|
|
6390
6514
|
}),
|
|
6391
6515
|
functions: Section.category(PropsPanelCategory.Functions).children({
|
|
6392
|
-
set: Prop.function(function(
|
|
6516
|
+
set: Prop.function(function(value) {
|
|
6393
6517
|
const widget = this;
|
|
6394
6518
|
widget.value = value;
|
|
6395
6519
|
}),
|
|
6396
|
-
reset: Prop.function(function(
|
|
6520
|
+
reset: Prop.function(function() {
|
|
6397
6521
|
const widget = this;
|
|
6398
6522
|
widget.value = widget.defaultValue;
|
|
6399
6523
|
})
|
|
@@ -6496,10 +6620,10 @@ var SuspensibleAPI = class {
|
|
|
6496
6620
|
get error() {
|
|
6497
6621
|
return this._error;
|
|
6498
6622
|
}
|
|
6499
|
-
async run(options
|
|
6623
|
+
async run(options) {
|
|
6500
6624
|
this._isLoading = true;
|
|
6501
6625
|
this._error = void 0;
|
|
6502
|
-
this._promise = this._runFn(options
|
|
6626
|
+
this._promise = this._runFn(options).then(action((data) => {
|
|
6503
6627
|
this._response = data;
|
|
6504
6628
|
this._isLoading = false;
|
|
6505
6629
|
return data;
|
|
@@ -6540,10 +6664,10 @@ const propertiesDefinition = {
|
|
|
6540
6664
|
}).readable()
|
|
6541
6665
|
}),
|
|
6542
6666
|
functions: Section.category("Derived").children({
|
|
6543
|
-
run: Prop.function(async function(
|
|
6667
|
+
run: Prop.function(async function(args) {
|
|
6544
6668
|
const api = this;
|
|
6545
6669
|
try {
|
|
6546
|
-
const result = await api._suspensibleApi.run(
|
|
6670
|
+
const result = await api._suspensibleApi.run(args);
|
|
6547
6671
|
await api.onSuccess?.();
|
|
6548
6672
|
return result;
|
|
6549
6673
|
} catch (error) {
|
|
@@ -6551,7 +6675,7 @@ const propertiesDefinition = {
|
|
|
6551
6675
|
throw error;
|
|
6552
6676
|
}
|
|
6553
6677
|
}),
|
|
6554
|
-
cancel: Prop.function(async function(
|
|
6678
|
+
cancel: Prop.function(async function() {
|
|
6555
6679
|
await this._suspensibleApi.cancel();
|
|
6556
6680
|
})
|
|
6557
6681
|
}),
|
|
@@ -6559,7 +6683,7 @@ const propertiesDefinition = {
|
|
|
6559
6683
|
const api = this;
|
|
6560
6684
|
return new SuspensibleAPI({
|
|
6561
6685
|
runFn: async (options) => {
|
|
6562
|
-
const result = await root_store_default.apis.runApi(api.name, api.scopeId, options
|
|
6686
|
+
const result = await root_store_default.apis.runApi(api.name, api.scopeId, options).catch((err) => ({
|
|
6563
6687
|
error: err,
|
|
6564
6688
|
data: null
|
|
6565
6689
|
}));
|
|
@@ -6584,40 +6708,6 @@ const SbApi = registerEntity(SbEntityType.API, { propertiesDefinition }, ({ onSu
|
|
|
6584
6708
|
};
|
|
6585
6709
|
});
|
|
6586
6710
|
|
|
6587
|
-
//#endregion
|
|
6588
|
-
//#region src/lib/internal-details/internal-components/spinner.tsx
|
|
6589
|
-
const Spinner = styled.span`
|
|
6590
|
-
width: 50px;
|
|
6591
|
-
height: 50px;
|
|
6592
|
-
border: 4px solid #e0e1e5;
|
|
6593
|
-
border-bottom-color: #8c95a1;
|
|
6594
|
-
border-radius: 50%;
|
|
6595
|
-
display: inline-block;
|
|
6596
|
-
box-sizing: border-box;
|
|
6597
|
-
animation: rotation 0.5s linear infinite;
|
|
6598
|
-
|
|
6599
|
-
@keyframes rotation {
|
|
6600
|
-
0% {
|
|
6601
|
-
transform: rotate(0deg);
|
|
6602
|
-
}
|
|
6603
|
-
100% {
|
|
6604
|
-
transform: rotate(360deg);
|
|
6605
|
-
}
|
|
6606
|
-
}
|
|
6607
|
-
`;
|
|
6608
|
-
const FullPageSpinner = () => {
|
|
6609
|
-
return /* @__PURE__ */ jsx("div", {
|
|
6610
|
-
style: {
|
|
6611
|
-
display: "flex",
|
|
6612
|
-
justifyContent: "center",
|
|
6613
|
-
alignItems: "center",
|
|
6614
|
-
height: "100svh",
|
|
6615
|
-
width: "100%"
|
|
6616
|
-
},
|
|
6617
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
6618
|
-
});
|
|
6619
|
-
};
|
|
6620
|
-
|
|
6621
6711
|
//#endregion
|
|
6622
6712
|
//#region src/lib/internal-details/lib/features/injected-features.ts
|
|
6623
6713
|
function useGetCurrentUserQuery() {
|
|
@@ -6979,6 +7069,13 @@ const useHandleDnDEvents = () => {
|
|
|
6979
7069
|
const editStore = getEditStore();
|
|
6980
7070
|
let possibleNewComponentId;
|
|
6981
7071
|
try {
|
|
7072
|
+
const activeData = event.active?.data.current;
|
|
7073
|
+
if (activeData?.instanceId) {
|
|
7074
|
+
if (!!editStore.runtimeEntitiesManager.getEditorWidgetMeta(activeData.instanceId)?.props?.[WIDGET_DISABLE_DND]) {
|
|
7075
|
+
editorBridge.sendNotification("error", "This component can't be moved because it's defined in code. Ask Clark to move it.");
|
|
7076
|
+
return;
|
|
7077
|
+
}
|
|
7078
|
+
}
|
|
6982
7079
|
if (!editStore.ui.dnd.isProspectiveDropValid) {
|
|
6983
7080
|
editorBridge.sendNotification("error", "You cannot drop a component here.");
|
|
6984
7081
|
return;
|
|
@@ -10271,7 +10368,7 @@ function useDialogEditing(props) {
|
|
|
10271
10368
|
if (isEditing && instanceId) {
|
|
10272
10369
|
if (prevIsOpenRef.current !== isOpen && !(prevIsOpenRef.current === void 0 && isOpen === false)) return;
|
|
10273
10370
|
if (isOpen) {
|
|
10274
|
-
if (selectedInstanceId && selectedInstanceId !== instanceId && !doesInteractionLayerContainInstance(instanceId, selectedInstanceId)) update((entity) => {
|
|
10371
|
+
if (selectedInstanceId && selectedInstanceId !== instanceId && !doesInteractionLayerContainInstance(instanceId, selectedInstanceId, true) && !isPage(selectedInstanceId)) update((entity) => {
|
|
10275
10372
|
set(entity, isOpenPropertyName, false);
|
|
10276
10373
|
});
|
|
10277
10374
|
} else if (selectedInstanceId === instanceId || selectedInstanceId && doesInteractionLayerContainInstance(instanceId, selectedInstanceId)) update((entity) => {
|