@superblocksteam/library 2.0.6-next.71 → 2.0.6-next.73

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.
@@ -46,7 +46,7 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
46
46
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
47
47
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
48
48
  var __privateMethod = (obj, member, method4) => (__accessCheck(obj, member, "access private method"), method4);
49
- var _removeSourceIdElement_dec, _setSourceIdElement_dec, _setActiveRootInstanceId_dec, _init, _updateLocation_dec, _init2, _cancelApi_dec, _runApi_dec, _init3, _renameWidget_dec, _setWidgetProperty_dec, _setWidgetProperties_dec, _writeRuntimeProperties_dec, _deleteComponents_dec, _dropComponent_dec, _createComponent_dec, _batchUpdate_dec, _clearPendingTransactions_dec, _addPendingTransaction_dec, _executeOrAddToBatch_dec, _init4, _addOptimisticCreateWidget_dec, _processRootWidget_dec, _init5, _refreshPositionsAndGetDropConstraints_dec, _init6, _updateChildPositions_dec, _setWidgetPosition_dec, _setActiveTargetRect_dec, _setActiveDragRect_dec, _setDropTargetId_dec, _setInvalidDropTarget_dec, _setValidRootIds_dec, _cancelNewComponentDrag_dec, _startNewComponentDrag_dec, _setIsDragging_dec, _setWidgetFeatures_dec, _init7;
49
+ var _updateLocation_dec, _init, _cancelApi_dec, _runApi_dec, _init2, _removeSourceIdElement_dec, _setSourceIdElement_dec, _setActiveRootInstanceId_dec, _init3, _renameWidget_dec, _setWidgetProperty_dec, _setWidgetProperties_dec, _writeRuntimeProperties_dec, _deleteComponents_dec, _dropComponent_dec, _createComponent_dec, _batchUpdate_dec, _clearPendingTransactions_dec, _addPendingTransaction_dec, _executeOrAddToBatch_dec, _init4, _addOptimisticCreateWidget_dec, _processRootWidget_dec, _init5, _refreshPositionsAndGetDropConstraints_dec, _init6, _updateChildPositions_dec, _setWidgetPosition_dec, _setActiveTargetRect_dec, _setActiveDragRect_dec, _setDropTargetId_dec, _setInvalidDropTarget_dec, _setValidRootIds_dec, _cancelNewComponentDrag_dec, _startNewComponentDrag_dec, _setIsDragging_dec, _setWidgetFeatures_dec, _init7;
50
50
  import * as React from "react";
51
51
  import React__default, { isValidElement as isValidElement$1, version as version$2, createContext, useContext, useEffect, useRef, useLayoutEffect as useLayoutEffect$2, Component, useState, useMemo as useMemo$2, useCallback, forwardRef, useImperativeHandle, cloneElement as cloneElement$1, createElement, Suspense, Children, memo, useReducer, useSyncExternalStore, PureComponent, createRef } from "react";
52
52
  import { S as SvgClose, a as SvgSystemDanger, b as SvgSystemInfo, c as SvgSystemError, d as SvgSystemSuccess, e as SvgPlus, f as SvgHide, g as SvgChevronDown, h as SvgEmptyCheckbox, i as SvgMinus, j as SvgCheckmark, k as SvgPlay, l as SvgDownload, m as SvgTrash, n as SvgFilter, o as SvgFreeze, p as SvgSort, q as SvgEllipsis, r as SvgCrossXs, s as SvgClark } from "./icons-lSlfQ50w.js";
@@ -42979,113 +42979,6 @@ const getDynamicBindings = (dynamicString) => {
42979
42979
  function getStableScopeId(scopeName) {
42980
42980
  return generatePredictableId(`sc-${scopeName}`);
42981
42981
  }
42982
- const getWidgetAnchorName = (instanceId) => {
42983
- return `--widget-${instanceId}`;
42984
- };
42985
- const getWidgetRectAnchorName = (instanceId) => {
42986
- return `--widget-rect-${instanceId}`;
42987
- };
42988
- const getWidgetDropAreaAnchorName = (instanceId, widgetType) => {
42989
- if (widgetType === "SbModal" || widgetType === "SbSlideout") {
42990
- return `--widget-drop-area-${instanceId}`;
42991
- }
42992
- return `--widget-${instanceId}`;
42993
- };
42994
- const getEditWrapperId = (instanceId) => {
42995
- return `sb-edit-wrapper-${instanceId}`;
42996
- };
42997
- const getEditWrapperIdWithType = (instanceId, widgetType) => {
42998
- if (widgetType === "SbModal" || widgetType === "SbSlideout") {
42999
- return `sb-edit-wrapper-for-${widgetType}-${instanceId}`;
43000
- }
43001
- return `sb-edit-wrapper-${instanceId}`;
43002
- };
43003
- const getBoundingBoxForWidget = (instanceId) => {
43004
- var _a2;
43005
- return (_a2 = getWidgetNode(instanceId)) == null ? void 0 : _a2.getBoundingClientRect();
43006
- };
43007
- const getFirstInstanceElement = (element) => {
43008
- let current = element;
43009
- while (current) {
43010
- const instanceId = current.getAttribute(WIDGET_INSTANCE_ID_ATTRIBUTE);
43011
- if (instanceId) {
43012
- return {
43013
- element: current,
43014
- instanceId
43015
- };
43016
- }
43017
- current = current.firstElementChild;
43018
- }
43019
- return null;
43020
- };
43021
- const getWidgetNode = (instanceId) => {
43022
- const widgetMeta = getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(instanceId);
43023
- const sourceId = widgetMeta == null ? void 0 : widgetMeta.sourceId;
43024
- const type5 = widgetMeta == null ? void 0 : widgetMeta.type;
43025
- const editWrapperId = getEditWrapperIdWithType(instanceId, type5);
43026
- const wrapperElem = document.getElementById(editWrapperId);
43027
- return wrapperElem == null ? void 0 : wrapperElem.querySelector(
43028
- `[${WIDGET_SOURCE_ID_ATTRIBUTE}="${sourceId}"]`
43029
- );
43030
- };
43031
- const getIsComponentInInteractionLayer = (instanceId) => {
43032
- const editStore2 = getEditStore();
43033
- const activeRootInstanceId = editStore2.interactionLayerManager.activeRootInstanceId;
43034
- const isDropTargetInInteractionLayer = (
43035
- // if active root id is undefined, we are in the page and can drop anywhere
43036
- !activeRootInstanceId || instanceId && (instanceId === activeRootInstanceId || editStore2.runtimeEntitiesManager.isChildOf(
43037
- instanceId,
43038
- activeRootInstanceId
43039
- ))
43040
- );
43041
- return isDropTargetInInteractionLayer;
43042
- };
43043
- _setActiveRootInstanceId_dec = [action], _setSourceIdElement_dec = [action], _removeSourceIdElement_dec = [action];
43044
- class InteractionLayerManager {
43045
- constructor() {
43046
- __runInitializers(_init, 5, this);
43047
- /**
43048
- * The id of the root element that is currently being interacted with
43049
- * the root can be SbPage, SbModal or SbSlideout
43050
- * If set to undefined, the interaction layer will be the SbPage
43051
- * if set to the detached component id, the inteactoin layer will be disabled on the page
43052
- */
43053
- __publicField(this, "activeRootInstanceId");
43054
- __publicField(this, "sourceIdElements", /* @__PURE__ */ new Map());
43055
- makeAutoObservable(this);
43056
- }
43057
- setActiveRootInstanceId(rootInstanceId) {
43058
- this.activeRootInstanceId = rootInstanceId;
43059
- }
43060
- setSourceIdElement(el2, sourceId) {
43061
- const { element, instanceId } = getFirstInstanceElement(el2) ?? {};
43062
- if (!element || !instanceId) {
43063
- return;
43064
- }
43065
- this.sourceIdElements.set(instanceId, { sourceId, element });
43066
- return instanceId;
43067
- }
43068
- removeSourceIdElement(instanceId) {
43069
- this.sourceIdElements.delete(instanceId);
43070
- }
43071
- getSourceIdElements(sourceId) {
43072
- const elements = [];
43073
- for (const [instanceId, info] of this.sourceIdElements.entries()) {
43074
- if (info.sourceId === sourceId) {
43075
- elements.push({
43076
- element: info.element,
43077
- instanceId
43078
- });
43079
- }
43080
- }
43081
- return elements;
43082
- }
43083
- }
43084
- _init = __decoratorStart(null);
43085
- __decorateElement(_init, 1, "setActiveRootInstanceId", _setActiveRootInstanceId_dec, InteractionLayerManager);
43086
- __decorateElement(_init, 1, "setSourceIdElement", _setSourceIdElement_dec, InteractionLayerManager);
43087
- __decorateElement(_init, 1, "removeSourceIdElement", _removeSourceIdElement_dec, InteractionLayerManager);
43088
- __decoratorMetadata(_init, InteractionLayerManager);
43089
42982
  function cleanObject(obj) {
43090
42983
  obj = toJS(obj);
43091
42984
  if (!obj || typeof obj !== "object") {
@@ -83886,7 +83779,7 @@ function registerStores(stores) {
83886
83779
  internalStores = { ...internalStores, ...stores };
83887
83780
  if (SUPPORTED_MODES.includes("production")) {
83888
83781
  if (Object.keys(internalStores).length === Object.keys(stores).length) {
83889
- import("./devtools-consolidated-BUaLyAXz.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83782
+ import("./devtools-consolidated-B12UVG-h.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
83890
83783
  setRegisteredStores(internalStores);
83891
83784
  initializeCustomDevTools();
83892
83785
  }).catch((error) => {
@@ -83899,7 +83792,7 @@ function registerStores(stores) {
83899
83792
  }
83900
83793
  }
83901
83794
  const DevToolsInternal = React__default.lazy(() => {
83902
- return import("./devtools-consolidated-BUaLyAXz.js").then((module2) => ({
83795
+ return import("./devtools-consolidated-B12UVG-h.js").then((module2) => ({
83903
83796
  default: module2.CustomDevTools
83904
83797
  }));
83905
83798
  });
@@ -85107,7 +85000,7 @@ class EntityManager {
85107
85000
  _updateLocation_dec = [action];
85108
85001
  class LocationStore {
85109
85002
  constructor(rootStore2) {
85110
- __runInitializers(_init2, 5, this);
85003
+ __runInitializers(_init, 5, this);
85111
85004
  __publicField(this, "route");
85112
85005
  __publicField(this, "rootStore");
85113
85006
  this.rootStore = rootStore2;
@@ -85150,9 +85043,9 @@ class LocationStore {
85150
85043
  };
85151
85044
  }
85152
85045
  }
85153
- _init2 = __decoratorStart(null);
85154
- __decorateElement(_init2, 1, "updateLocation", _updateLocation_dec, LocationStore);
85155
- __decoratorMetadata(_init2, LocationStore);
85046
+ _init = __decoratorStart(null);
85047
+ __decorateElement(_init, 1, "updateLocation", _updateLocation_dec, LocationStore);
85048
+ __decoratorMetadata(_init, LocationStore);
85156
85049
  function getApiDeps(entitiesState, scopeId, apiDepCandidates) {
85157
85050
  const apiDepEntries = apiDepCandidates.map((candidateName) => {
85158
85051
  const [entityName, ...rest] = splitJSPath(candidateName) ?? [];
@@ -85509,7 +85402,7 @@ const decodeBytestringsInV2ExecutionResponse = (response) => {
85509
85402
  _runApi_dec = [action], _cancelApi_dec = [action];
85510
85403
  class ApiManager {
85511
85404
  constructor(rootStore2) {
85512
- __runInitializers(_init3, 5, this);
85405
+ __runInitializers(_init2, 5, this);
85513
85406
  __publicField(this, "baseUrl");
85514
85407
  __publicField(this, "token");
85515
85408
  __publicField(this, "accessToken");
@@ -85692,10 +85585,10 @@ class ApiManager {
85692
85585
  });
85693
85586
  }
85694
85587
  }
85695
- _init3 = __decoratorStart(null);
85696
- __decorateElement(_init3, 1, "runApi", _runApi_dec, ApiManager);
85697
- __decorateElement(_init3, 1, "cancelApi", _cancelApi_dec, ApiManager);
85698
- __decoratorMetadata(_init3, ApiManager);
85588
+ _init2 = __decoratorStart(null);
85589
+ __decorateElement(_init2, 1, "runApi", _runApi_dec, ApiManager);
85590
+ __decorateElement(_init2, 1, "cancelApi", _cancelApi_dec, ApiManager);
85591
+ __decoratorMetadata(_init2, ApiManager);
85699
85592
  const richTypes = { Date: true, RegExp: true, String: true, Number: true };
85700
85593
  function diff(obj, newObj, options = { cyclesFix: true }, _stack = []) {
85701
85594
  var _a2, _b2;
@@ -86328,6 +86221,267 @@ const rootStore$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
86328
86221
  __proto__: null,
86329
86222
  default: rootStore
86330
86223
  }, Symbol.toStringTag, { value: "Module" }));
86224
+ const WithLayoutContainerTypes = /* @__PURE__ */ new Set([
86225
+ "SbContainer",
86226
+ "SbColumn",
86227
+ "SbModal",
86228
+ "SbSlideout"
86229
+ ]);
86230
+ const VStackLikeContainerTypes = /* @__PURE__ */ new Set(["SbPage"]);
86231
+ const HStackLikeContainerTypes = /* @__PURE__ */ new Set(["SbSection"]);
86232
+ const StackLikeContainerTypes = /* @__PURE__ */ new Set([
86233
+ ...VStackLikeContainerTypes,
86234
+ ...HStackLikeContainerTypes
86235
+ ]);
86236
+ const detachedComponentTypeList = ["SbModal", "SbSlideout"];
86237
+ const DetachedComponentTypes = new Set(
86238
+ detachedComponentTypeList
86239
+ );
86240
+ function rule(description, restriction) {
86241
+ return {
86242
+ description,
86243
+ restriction
86244
+ };
86245
+ }
86246
+ const restrictions = [
86247
+ rule(
86248
+ "Draggable type must be draggable",
86249
+ ({ draggedType }) => !isTypeDraggable(draggedType)
86250
+ ),
86251
+ rule(
86252
+ "Drop target type must be droppable",
86253
+ ({ dropTargetType }) => !isTypeDroppable(dropTargetType)
86254
+ ),
86255
+ rule(
86256
+ "Columns can only be dropped on sections",
86257
+ ({ draggedType, dropTargetType }) => {
86258
+ return draggedType === "SbColumn" && dropTargetType !== "SbSection";
86259
+ }
86260
+ ),
86261
+ rule(
86262
+ "Sections can only be dropped on pages",
86263
+ ({ draggedType, dropTargetType }) => {
86264
+ return draggedType === "SbSection" && dropTargetType !== "SbPage";
86265
+ }
86266
+ ),
86267
+ rule(
86268
+ "Only sections can be dropped on non-empty pages",
86269
+ ({ draggedType, dropTargetType, dropTargetEmpty }) => {
86270
+ return draggedType !== "SbSection" && dropTargetType === "SbPage" && !dropTargetEmpty;
86271
+ }
86272
+ ),
86273
+ rule(
86274
+ "Only columns can be dropped on non-empty sections",
86275
+ ({ draggedType, dropTargetType, dropTargetEmpty }) => {
86276
+ return draggedType !== "SbColumn" && dropTargetType === "SbSection" && !dropTargetEmpty;
86277
+ }
86278
+ )
86279
+ ];
86280
+ const isDragAndDropTypeValid = ({
86281
+ draggedType,
86282
+ dropTargetType,
86283
+ dropTargetEmpty,
86284
+ isDraggingNewComponent
86285
+ }) => {
86286
+ const actualDraggedType = isDraggingNewComponent && (draggedType === "SbModal" || draggedType === "SbSlideout") ? "SbButton" : draggedType;
86287
+ const triggeredRestriction = restrictions.find(
86288
+ (restriction) => restriction.restriction({
86289
+ draggedType: actualDraggedType,
86290
+ dropTargetType,
86291
+ dropTargetEmpty,
86292
+ isDraggingNewComponent
86293
+ })
86294
+ );
86295
+ return triggeredRestriction == null;
86296
+ };
86297
+ const isTypeDroppable = (type5) => {
86298
+ const component = rootStore.componentRegistry.getComponent(type5);
86299
+ if (component && component.isDroppable === true) {
86300
+ return true;
86301
+ }
86302
+ return false;
86303
+ };
86304
+ const isTypeDraggable = (type5) => {
86305
+ return type5 !== "SbPage" && type5 !== "SbSlideout" && type5 !== "SbModal";
86306
+ };
86307
+ const isContentDraggable = (type5) => {
86308
+ return isTypeDraggable(type5) && type5 !== "SbColumn" && type5 !== "SbSection";
86309
+ };
86310
+ function shouldWrapInSectionAndColumn(type5, parentType) {
86311
+ if (DetachedComponentTypes.has(type5)) {
86312
+ return false;
86313
+ }
86314
+ return parentType === "SbPage" && type5 !== "SbSection" || parentType === "SbSection" && type5 !== "SbColumn";
86315
+ }
86316
+ const filterSafeStackDimensionProperties = (existingProps) => {
86317
+ const { width, height, size: size2 } = existingProps;
86318
+ let safeHeight;
86319
+ let safeWidth;
86320
+ let safeSize;
86321
+ if ((height == null ? void 0 : height.mode) === "px" || (height == null ? void 0 : height.mode) === "fit" || (height == null ? void 0 : height.mode) === "fill") {
86322
+ safeHeight = Property.Dimension(height);
86323
+ }
86324
+ if ((width == null ? void 0 : width.mode) === "px" || (width == null ? void 0 : width.mode) === "fit" || (width == null ? void 0 : width.mode) === "fill") {
86325
+ safeWidth = Property.Dimension(width);
86326
+ }
86327
+ if ((size2 == null ? void 0 : size2.mode) === "px") {
86328
+ safeSize = Property.Dimension(size2);
86329
+ }
86330
+ return {
86331
+ width: safeWidth,
86332
+ height: safeHeight,
86333
+ size: safeSize
86334
+ };
86335
+ };
86336
+ const filterSafeGridDimensionProperties = (existingProps) => {
86337
+ const { width, height, size: size2 } = existingProps;
86338
+ const safeDimensions = {};
86339
+ if ((height == null ? void 0 : height.mode) === "rows" || (height == null ? void 0 : height.mode) === "fit") {
86340
+ safeDimensions.height = Property.Dimension(height);
86341
+ }
86342
+ if ((width == null ? void 0 : width.mode) === "columns") {
86343
+ safeDimensions.width = Property.Dimension(width);
86344
+ }
86345
+ if ((size2 == null ? void 0 : size2.mode) === "columns") {
86346
+ safeDimensions.size = Property.Dimension(size2);
86347
+ }
86348
+ return safeDimensions;
86349
+ };
86350
+ const defaultSizeForComponent = (componentType, isFreeform, draggedDimensions) => {
86351
+ if (componentType === "SbIcon") {
86352
+ return {};
86353
+ }
86354
+ const height = Property.Dimension(Dim.fit());
86355
+ if (isFreeform) {
86356
+ const guWidth = (draggedDimensions == null ? void 0 : draggedDimensions.widthGU) ?? 4;
86357
+ return {
86358
+ height,
86359
+ width: Property.Dimension(Dim.col(guWidth))
86360
+ };
86361
+ }
86362
+ switch (componentType) {
86363
+ case "SbText":
86364
+ case "SbButton":
86365
+ case "SbCheckbox":
86366
+ case "SbSwitch":
86367
+ return { height, width: Property.Dimension(Dim.fit()) };
86368
+ case "SbImage":
86369
+ return {
86370
+ height,
86371
+ width: Property.Dimension(Dim.px((draggedDimensions == null ? void 0 : draggedDimensions.widthPx) ?? 288))
86372
+ // Matches widget config response. This should never be undefined though.
86373
+ };
86374
+ default:
86375
+ return { height, width: Property.Dimension(Dim.fill()) };
86376
+ }
86377
+ };
86378
+ const getWidgetAnchorName = (instanceId) => {
86379
+ return `--widget-${instanceId}`;
86380
+ };
86381
+ const getWidgetRectAnchorName = (instanceId) => {
86382
+ return `--widget-rect-${instanceId}`;
86383
+ };
86384
+ const getWidgetDropAreaAnchorName = (instanceId, widgetType) => {
86385
+ if (widgetType && DetachedComponentTypes.has(widgetType)) {
86386
+ return `--widget-drop-area-${instanceId}`;
86387
+ }
86388
+ return `--widget-${instanceId}`;
86389
+ };
86390
+ const getEditWrapperId = (instanceId) => {
86391
+ return `sb-edit-wrapper-${instanceId}`;
86392
+ };
86393
+ const getEditWrapperIdWithType = (instanceId, widgetType) => {
86394
+ if (widgetType && DetachedComponentTypes.has(widgetType)) {
86395
+ return `sb-edit-wrapper-for-${widgetType}-${instanceId}`;
86396
+ }
86397
+ return `sb-edit-wrapper-${instanceId}`;
86398
+ };
86399
+ const getBoundingBoxForWidget = (instanceId) => {
86400
+ var _a2;
86401
+ return (_a2 = getWidgetNode(instanceId)) == null ? void 0 : _a2.getBoundingClientRect();
86402
+ };
86403
+ const getFirstInstanceElement = (element) => {
86404
+ let current = element;
86405
+ while (current) {
86406
+ const instanceId = current.getAttribute(WIDGET_INSTANCE_ID_ATTRIBUTE);
86407
+ if (instanceId) {
86408
+ return {
86409
+ element: current,
86410
+ instanceId
86411
+ };
86412
+ }
86413
+ current = current.firstElementChild;
86414
+ }
86415
+ return null;
86416
+ };
86417
+ const getWidgetNode = (instanceId) => {
86418
+ const widgetMeta = getEditStore().runtimeEntitiesManager.getEditorWidgetMeta(instanceId);
86419
+ const sourceId = widgetMeta == null ? void 0 : widgetMeta.sourceId;
86420
+ const type5 = widgetMeta == null ? void 0 : widgetMeta.type;
86421
+ const editWrapperId = getEditWrapperIdWithType(instanceId, type5);
86422
+ const wrapperElem = document.getElementById(editWrapperId);
86423
+ return wrapperElem == null ? void 0 : wrapperElem.querySelector(
86424
+ `[${WIDGET_SOURCE_ID_ATTRIBUTE}="${sourceId}"]`
86425
+ );
86426
+ };
86427
+ const getIsComponentInInteractionLayer = (instanceId) => {
86428
+ const editStore2 = getEditStore();
86429
+ const activeRootInstanceId = editStore2.interactionLayerManager.activeRootInstanceId;
86430
+ const isDropTargetInInteractionLayer = (
86431
+ // if active root id is undefined, we are in the page and can drop anywhere
86432
+ !activeRootInstanceId || instanceId && (instanceId === activeRootInstanceId || editStore2.runtimeEntitiesManager.isChildOf(
86433
+ instanceId,
86434
+ activeRootInstanceId
86435
+ ))
86436
+ );
86437
+ return isDropTargetInInteractionLayer;
86438
+ };
86439
+ _setActiveRootInstanceId_dec = [action], _setSourceIdElement_dec = [action], _removeSourceIdElement_dec = [action];
86440
+ class InteractionLayerManager {
86441
+ constructor() {
86442
+ __runInitializers(_init3, 5, this);
86443
+ /**
86444
+ * The id of the root element that is currently being interacted with
86445
+ * the root can be SbPage, SbModal or SbSlideout
86446
+ * If set to undefined, the interaction layer will be the SbPage
86447
+ * if set to the detached component id, the inteactoin layer will be disabled on the page
86448
+ */
86449
+ __publicField(this, "activeRootInstanceId");
86450
+ __publicField(this, "sourceIdElements", /* @__PURE__ */ new Map());
86451
+ makeAutoObservable(this);
86452
+ }
86453
+ setActiveRootInstanceId(rootInstanceId) {
86454
+ this.activeRootInstanceId = rootInstanceId;
86455
+ }
86456
+ setSourceIdElement(el2, sourceId) {
86457
+ const { element, instanceId } = getFirstInstanceElement(el2) ?? {};
86458
+ if (!element || !instanceId) {
86459
+ return;
86460
+ }
86461
+ this.sourceIdElements.set(instanceId, { sourceId, element });
86462
+ return instanceId;
86463
+ }
86464
+ removeSourceIdElement(instanceId) {
86465
+ this.sourceIdElements.delete(instanceId);
86466
+ }
86467
+ getSourceIdElements(sourceId) {
86468
+ const elements = [];
86469
+ for (const [instanceId, info] of this.sourceIdElements.entries()) {
86470
+ if (info.sourceId === sourceId) {
86471
+ elements.push({
86472
+ element: info.element,
86473
+ instanceId
86474
+ });
86475
+ }
86476
+ }
86477
+ return elements;
86478
+ }
86479
+ }
86480
+ _init3 = __decoratorStart(null);
86481
+ __decorateElement(_init3, 1, "setActiveRootInstanceId", _setActiveRootInstanceId_dec, InteractionLayerManager);
86482
+ __decorateElement(_init3, 1, "setSourceIdElement", _setSourceIdElement_dec, InteractionLayerManager);
86483
+ __decorateElement(_init3, 1, "removeSourceIdElement", _removeSourceIdElement_dec, InteractionLayerManager);
86484
+ __decoratorMetadata(_init3, InteractionLayerManager);
86331
86485
  const generateId = () => {
86332
86486
  return Math.random().toString(36).substring(2, 15);
86333
86487
  };
@@ -87919,160 +88073,6 @@ _init5 = __decoratorStart(null);
87919
88073
  __decorateElement(_init5, 1, "processRootWidget", _processRootWidget_dec, RuntimeEntitiesManager);
87920
88074
  __decorateElement(_init5, 1, "addOptimisticCreateWidget", _addOptimisticCreateWidget_dec, RuntimeEntitiesManager);
87921
88075
  __decoratorMetadata(_init5, RuntimeEntitiesManager);
87922
- const WithLayoutContainerTypes = /* @__PURE__ */ new Set([
87923
- "SbContainer",
87924
- "SbColumn",
87925
- "SbModal",
87926
- "SbSlideout"
87927
- ]);
87928
- const VStackLikeContainerTypes = /* @__PURE__ */ new Set(["SbPage"]);
87929
- const HStackLikeContainerTypes = /* @__PURE__ */ new Set(["SbSection"]);
87930
- const StackLikeContainerTypes = /* @__PURE__ */ new Set([
87931
- ...VStackLikeContainerTypes,
87932
- ...HStackLikeContainerTypes
87933
- ]);
87934
- const detachedComponentTypeList = ["SbModal", "SbSlideout"];
87935
- const DetachedComponentTypes = new Set(
87936
- detachedComponentTypeList
87937
- );
87938
- function rule(description, restriction) {
87939
- return {
87940
- description,
87941
- restriction
87942
- };
87943
- }
87944
- const restrictions = [
87945
- rule(
87946
- "Draggable type must be draggable",
87947
- ({ draggedType }) => !isTypeDraggable(draggedType)
87948
- ),
87949
- rule(
87950
- "Drop target type must be droppable",
87951
- ({ dropTargetType }) => !isTypeDroppable(dropTargetType)
87952
- ),
87953
- rule(
87954
- "Columns can only be dropped on sections",
87955
- ({ draggedType, dropTargetType }) => {
87956
- return draggedType === "SbColumn" && dropTargetType !== "SbSection";
87957
- }
87958
- ),
87959
- rule(
87960
- "Sections can only be dropped on pages",
87961
- ({ draggedType, dropTargetType }) => {
87962
- return draggedType === "SbSection" && dropTargetType !== "SbPage";
87963
- }
87964
- ),
87965
- rule(
87966
- "Only sections can be dropped on non-empty pages",
87967
- ({ draggedType, dropTargetType, dropTargetEmpty }) => {
87968
- return draggedType !== "SbSection" && dropTargetType === "SbPage" && !dropTargetEmpty;
87969
- }
87970
- ),
87971
- rule(
87972
- "Only columns can be dropped on non-empty sections",
87973
- ({ draggedType, dropTargetType, dropTargetEmpty }) => {
87974
- return draggedType !== "SbColumn" && dropTargetType === "SbSection" && !dropTargetEmpty;
87975
- }
87976
- )
87977
- ];
87978
- const isDragAndDropTypeValid = ({
87979
- draggedType,
87980
- dropTargetType,
87981
- dropTargetEmpty,
87982
- isDraggingNewComponent
87983
- }) => {
87984
- const actualDraggedType = isDraggingNewComponent && (draggedType === "SbModal" || draggedType === "SbSlideout") ? "SbButton" : draggedType;
87985
- const triggeredRestriction = restrictions.find(
87986
- (restriction) => restriction.restriction({
87987
- draggedType: actualDraggedType,
87988
- dropTargetType,
87989
- dropTargetEmpty,
87990
- isDraggingNewComponent
87991
- })
87992
- );
87993
- return triggeredRestriction == null;
87994
- };
87995
- const isTypeDroppable = (type5) => {
87996
- const component = rootStore.componentRegistry.getComponent(type5);
87997
- if (component && component.isDroppable === true) {
87998
- return true;
87999
- }
88000
- return false;
88001
- };
88002
- const isTypeDraggable = (type5) => {
88003
- return type5 !== "SbPage" && type5 !== "SbSlideout" && type5 !== "SbModal";
88004
- };
88005
- const isContentDraggable = (type5) => {
88006
- return isTypeDraggable(type5) && type5 !== "SbColumn" && type5 !== "SbSection";
88007
- };
88008
- function shouldWrapInSectionAndColumn(type5, parentType) {
88009
- if (DetachedComponentTypes.has(type5)) {
88010
- return false;
88011
- }
88012
- return parentType === "SbPage" && type5 !== "SbSection" || parentType === "SbSection" && type5 !== "SbColumn";
88013
- }
88014
- const filterSafeStackDimensionProperties = (existingProps) => {
88015
- const { width, height, size: size2 } = existingProps;
88016
- let safeHeight;
88017
- let safeWidth;
88018
- let safeSize;
88019
- if ((height == null ? void 0 : height.mode) === "px" || (height == null ? void 0 : height.mode) === "fit" || (height == null ? void 0 : height.mode) === "fill") {
88020
- safeHeight = Property.Dimension(height);
88021
- }
88022
- if ((width == null ? void 0 : width.mode) === "px" || (width == null ? void 0 : width.mode) === "fit" || (width == null ? void 0 : width.mode) === "fill") {
88023
- safeWidth = Property.Dimension(width);
88024
- }
88025
- if ((size2 == null ? void 0 : size2.mode) === "px") {
88026
- safeSize = Property.Dimension(size2);
88027
- }
88028
- return {
88029
- width: safeWidth,
88030
- height: safeHeight,
88031
- size: safeSize
88032
- };
88033
- };
88034
- const filterSafeGridDimensionProperties = (existingProps) => {
88035
- const { width, height, size: size2 } = existingProps;
88036
- const safeDimensions = {};
88037
- if ((height == null ? void 0 : height.mode) === "rows" || (height == null ? void 0 : height.mode) === "fit") {
88038
- safeDimensions.height = Property.Dimension(height);
88039
- }
88040
- if ((width == null ? void 0 : width.mode) === "columns") {
88041
- safeDimensions.width = Property.Dimension(width);
88042
- }
88043
- if ((size2 == null ? void 0 : size2.mode) === "columns") {
88044
- safeDimensions.size = Property.Dimension(size2);
88045
- }
88046
- return safeDimensions;
88047
- };
88048
- const defaultSizeForComponent = (componentType, isFreeform, draggedDimensions) => {
88049
- if (componentType === "SbIcon") {
88050
- return {};
88051
- }
88052
- const height = Property.Dimension(Dim.fit());
88053
- if (isFreeform) {
88054
- const guWidth = (draggedDimensions == null ? void 0 : draggedDimensions.widthGU) ?? 4;
88055
- return {
88056
- height,
88057
- width: Property.Dimension(Dim.col(guWidth))
88058
- };
88059
- }
88060
- switch (componentType) {
88061
- case "SbText":
88062
- case "SbButton":
88063
- case "SbCheckbox":
88064
- case "SbSwitch":
88065
- return { height, width: Property.Dimension(Dim.fit()) };
88066
- case "SbImage":
88067
- return {
88068
- height,
88069
- width: Property.Dimension(Dim.px((draggedDimensions == null ? void 0 : draggedDimensions.widthPx) ?? 288))
88070
- // Matches widget config response. This should never be undefined though.
88071
- };
88072
- default:
88073
- return { height, width: Property.Dimension(Dim.fill()) };
88074
- }
88075
- };
88076
88076
  const isWidgetGrid = (widget) => {
88077
88077
  var _a2;
88078
88078
  if (!widget) {
@@ -91318,14 +91318,14 @@ function getLoaderFn$1(options) {
91318
91318
  if (!(loader === "all")) return [3, 3];
91319
91319
  return [4, import(
91320
91320
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
91321
- "./allPathsLoader-DWutM7hr.js"
91321
+ "./allPathsLoader-DW8drVZx.js"
91322
91322
  )];
91323
91323
  case 2:
91324
91324
  return [2, _b2.sent().allPathsLoader];
91325
91325
  case 3:
91326
91326
  return [4, import(
91327
91327
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
91328
- "./splitPathsBySizeLoader-BDi1wIry.js"
91328
+ "./splitPathsBySizeLoader-CBpRm4CP.js"
91329
91329
  )];
91330
91330
  case 4:
91331
91331
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -116461,6 +116461,7 @@ const Collisions = observer(
116461
116461
  GridDots,
116462
116462
  {
116463
116463
  parentInstanceId,
116464
+ parentType: parentMeta == null ? void 0 : parentMeta.type,
116464
116465
  tileWidth,
116465
116466
  tileHeight,
116466
116467
  targetPadding
@@ -116516,7 +116517,13 @@ const DotsPattern = qe$1.div`
116516
116517
  const GridDots = observer(
116517
116518
  (props2) => {
116518
116519
  var _a2, _b2, _c2, _d2;
116519
- const { parentInstanceId, tileWidth, tileHeight, targetPadding } = props2;
116520
+ const {
116521
+ parentInstanceId,
116522
+ parentType,
116523
+ tileWidth,
116524
+ tileHeight,
116525
+ targetPadding
116526
+ } = props2;
116520
116527
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
116521
116528
  "div",
116522
116529
  {
@@ -116527,7 +116534,11 @@ const GridDots = observer(
116527
116534
  left: "anchor(left)",
116528
116535
  right: "anchor(right)",
116529
116536
  bottom: "anchor(bottom)",
116530
- positionAnchor: getWidgetAnchorName(parentInstanceId),
116537
+ // do not use getWidgetAnchorName, for detached widget, interaction layer will be child of anchored element, anchor will not work. Drop area is at same level of interaction layer, so it works.
116538
+ positionAnchor: getWidgetDropAreaAnchorName(
116539
+ parentInstanceId,
116540
+ parentType
116541
+ ),
116531
116542
  width: "unset",
116532
116543
  height: "unset",
116533
116544
  ...targetPadding && {
@@ -138204,20 +138215,26 @@ const Overlay = qe$1.div`
138204
138215
  background-color: transparent;
138205
138216
  }
138206
138217
 
138218
+ &[data-has-opened="false"] {
138219
+ animation: none !important;
138220
+ opacity: 0 !important;
138221
+ }
138222
+
138207
138223
  &[data-state="open"] {
138208
- animation: ${fadeIn} 0.3s ease-in-out;
138224
+ animation: ${fadeIn} 0.3s ease-in-out forwards;
138209
138225
  }
138210
138226
 
138211
138227
  &[data-state="closed"] {
138212
- animation: ${fadeOut} 0.3s ease-in-out;
138228
+ animation: ${fadeOut} 0.3s ease-in-out forwards;
138213
138229
  }
138214
138230
  `;
138215
- const SlideoutOverlay = React__default.forwardRef(({ hasBackdrop, isOpen }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
138231
+ const SlideoutOverlay = React__default.forwardRef(({ hasBackdrop, isOpen, hasOpened }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
138216
138232
  Overlay,
138217
138233
  {
138218
138234
  ref: ref2,
138219
138235
  "data-has-backdrop": hasBackdrop,
138220
- "data-state": isOpen ? "open" : "closed"
138236
+ "data-state": isOpen ? "open" : "closed",
138237
+ "data-has-opened": hasOpened ? "true" : "false"
138221
138238
  }
138222
138239
  ));
138223
138240
  SlideoutOverlay.displayName = "SlideoutOverlay";
@@ -138228,17 +138245,24 @@ const StyledDialogContent = qe$1(Content)`
138228
138245
  height: 100%;
138229
138246
  padding: 0;
138230
138247
  z-index: ${Layers$1.dialog};
138231
- box-shadow:
138232
- 0 3px 6px -4px rgba(0, 0, 0, 0.12),
138233
- 0 6px 16px 0 rgba(0, 0, 0, 0.08),
138234
- 0 9px 28px 8px rgba(0, 0, 0, 0.05);
138248
+ &[data-state="open"] {
138249
+ box-shadow:
138250
+ 0 3px 6px -4px rgba(0, 0, 0, 0.12),
138251
+ 0 6px 16px 0 rgba(0, 0, 0, 0.08),
138252
+ 0 9px 28px 8px rgba(0, 0, 0, 0.05);
138253
+ }
138254
+
138255
+ &[data-has-opened="false"] {
138256
+ animation: none !important;
138257
+ transform: translateX(100%) !important;
138258
+ }
138235
138259
 
138236
138260
  &[data-state="open"] {
138237
- animation: ${slideIn} 0.3s ease-in-out;
138261
+ animation: ${slideIn} 0.3s ease-in-out forwards;
138238
138262
  }
138239
138263
 
138240
138264
  &[data-state="closed"] {
138241
- animation: ${slideOut} 0.3s ease-in-out;
138265
+ animation: ${slideOut} 0.3s ease-in-out forwards;
138242
138266
  }
138243
138267
  `;
138244
138268
  const getParent2 = () => {
@@ -138361,17 +138385,24 @@ const SlideoutComponent = (props2) => {
138361
138385
  },
138362
138386
  [closeOnClickOutside, onClose2]
138363
138387
  );
138388
+ const hasOpenedRef = React__default.useRef(false);
138389
+ React__default.useEffect(() => {
138390
+ if (props2.isOpen) {
138391
+ hasOpenedRef.current = true;
138392
+ }
138393
+ }, [props2.isOpen]);
138364
138394
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
138365
138395
  Root$1,
138366
138396
  {
138367
138397
  open: props2.isOpen,
138368
138398
  modal: !props2.isEditing,
138369
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Portal$1, { container: getParent2(), children: [
138399
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$1, { container: getParent2(), forceMount: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { pointerEvents: props2.isOpen ? "auto" : "none" }, children: [
138370
138400
  /* @__PURE__ */ jsxRuntimeExports.jsx(
138371
138401
  SlideoutOverlay,
138372
138402
  {
138373
138403
  hasBackdrop: props2.hasBackdrop,
138374
- isOpen: props2.isOpen
138404
+ isOpen: props2.isOpen,
138405
+ hasOpened: hasOpenedRef.current
138375
138406
  }
138376
138407
  ),
138377
138408
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -138384,6 +138415,7 @@ const SlideoutComponent = (props2) => {
138384
138415
  "data-test": "slideout-component",
138385
138416
  id: `slideout-component-${props2.name}`,
138386
138417
  "data-superblocks": `slideout-component-${props2.name}`,
138418
+ "data-has-opened": hasOpenedRef.current ? "true" : "false",
138387
138419
  children: [
138388
138420
  /* @__PURE__ */ jsxRuntimeExports.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
138389
138421
  CloseButton,
@@ -138419,7 +138451,7 @@ const SlideoutComponent = (props2) => {
138419
138451
  ]
138420
138452
  }
138421
138453
  )
138422
- ] })
138454
+ ] }) })
138423
138455
  }
138424
138456
  );
138425
138457
  };
@@ -148370,14 +148402,14 @@ function getLoaderFn(options) {
148370
148402
  if (!(loader === "all")) return [3, 3];
148371
148403
  return [4, import(
148372
148404
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
148373
- "./allPathsLoader-CNN9R2Rh.js"
148405
+ "./allPathsLoader-ShoJD-rd.js"
148374
148406
  )];
148375
148407
  case 2:
148376
148408
  return [2, _b2.sent().allPathsLoader];
148377
148409
  case 3:
148378
148410
  return [4, import(
148379
148411
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
148380
- "./splitPathsBySizeLoader-XfZ-1ll3.js"
148412
+ "./splitPathsBySizeLoader-CgkpRfe9.js"
148381
148413
  )];
148382
148414
  case 4:
148383
148415
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -196856,8 +196888,16 @@ const fixCursorSnapOffset = (args) => {
196856
196888
  top: y4 - height / 2
196857
196889
  }
196858
196890
  };
196891
+ const editStore2 = getEditStore();
196859
196892
  const collisions = rectIntersection(updated);
196860
- const sortedCollisions = collisions.map((collision) => {
196893
+ const sortedCollisions = collisions.filter((collision) => {
196894
+ const activeRootInstanceId = editStore2.interactionLayerManager.activeRootInstanceId;
196895
+ if (!activeRootInstanceId) return true;
196896
+ return collision.id === activeRootInstanceId || editStore2.runtimeEntitiesManager.isChildOf(
196897
+ collision.id,
196898
+ activeRootInstanceId
196899
+ );
196900
+ }).map((collision) => {
196861
196901
  var _a2, _b2;
196862
196902
  const rect = (_b2 = (_a2 = collision.data) == null ? void 0 : _a2.droppableContainer) == null ? void 0 : _b2.rect.current;
196863
196903
  const pointerInside = rect && x3 >= rect.left && x3 <= rect.right && y4 >= rect.top && y4 <= rect.bottom;
@@ -200178,4 +200218,4 @@ export {
200178
200218
  SbVariable as y,
200179
200219
  SbTimer as z
200180
200220
  };
200181
- //# sourceMappingURL=index-CJ3tumTb.js.map
200221
+ //# sourceMappingURL=index-BLsacbxP.js.map