@superblocksteam/library 2.0.20 → 2.0.21-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.
Files changed (26) hide show
  1. package/dist/{allPaths-CrcRC_Hg.js → allPaths-DHaJam_4.js} +2 -2
  2. package/dist/{allPaths-CrcRC_Hg.js.map → allPaths-DHaJam_4.js.map} +1 -1
  3. package/dist/{allPaths-B3CsE-4d.js → allPaths-DqSYto3G.js} +2 -2
  4. package/dist/{allPaths-B3CsE-4d.js.map → allPaths-DqSYto3G.js.map} +1 -1
  5. package/dist/{allPathsLoader-CM3qFtpk.js → allPathsLoader-DlXa_Ean.js} +3 -3
  6. package/dist/{allPathsLoader-CbhZCOLq.js.map → allPathsLoader-DlXa_Ean.js.map} +1 -1
  7. package/dist/{allPathsLoader-CbhZCOLq.js → allPathsLoader-PrrgrK2q.js} +3 -3
  8. package/dist/{allPathsLoader-CM3qFtpk.js.map → allPathsLoader-PrrgrK2q.js.map} +1 -1
  9. package/dist/{devtools-consolidated-3ekbDKtc.js → devtools-consolidated-DcfmUvsu.js} +2 -2
  10. package/dist/{devtools-consolidated-3ekbDKtc.js.map → devtools-consolidated-DcfmUvsu.js.map} +1 -1
  11. package/dist/{index-DoQuZXxx.js → index-COYupQHJ.js} +240 -257
  12. package/dist/{index-DoQuZXxx.js.map → index-COYupQHJ.js.map} +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/{splitPathsBySizeLoader-BbneuAAM.js → splitPathsBySizeLoader-Dbmx5rN1.js} +2 -2
  15. package/dist/{splitPathsBySizeLoader-BbneuAAM.js.map → splitPathsBySizeLoader-Dbmx5rN1.js.map} +1 -1
  16. package/dist/{splitPathsBySizeLoader-CJaleIID.js → splitPathsBySizeLoader-Pl9Bep92.js} +2 -2
  17. package/dist/{splitPathsBySizeLoader-CJaleIID.js.map → splitPathsBySizeLoader-Pl9Bep92.js.map} +1 -1
  18. package/dist-types/edit-mode/dnd/get-allowed-children.d.ts +2 -0
  19. package/dist-types/edit-mode/dnd/utils.d.ts +9 -1
  20. package/dist-types/edit-mode/features/properties-panel-manager.d.ts +2 -2
  21. package/dist-types/lib/internal-details/sb-wrapper.d.ts +1 -1
  22. package/dist-types/lib/user-facing/internal-index.d.ts +1 -1
  23. package/dist-types/lib/user-facing/properties-panel/props-builder.d.ts +6 -4
  24. package/dist-types/lib/utils/is-component-type-detached.d.ts +1 -0
  25. package/package.json +2 -2
  26. package/dist-types/lib/internal-details/sb-wrapper-notes.d.ts +0 -1
@@ -96123,8 +96123,8 @@ class Prop {
96123
96123
  static event() {
96124
96124
  return new Prop("event");
96125
96125
  }
96126
- static children(config2) {
96127
- return new ChildrenProp(config2);
96126
+ static children() {
96127
+ return new ChildrenProp();
96128
96128
  }
96129
96129
  static function(implementation) {
96130
96130
  const prop = new Prop("function");
@@ -96441,16 +96441,9 @@ class RecordProp extends Prop {
96441
96441
  }
96442
96442
  }
96443
96443
  class ChildrenProp extends Prop {
96444
- constructor(config2) {
96444
+ constructor() {
96445
96445
  super("children");
96446
96446
  __publicField(this, "typeString", "children");
96447
- __publicField(this, "allowedChildren");
96448
- this.allowedChildren = config2 == null ? void 0 : config2.allowedChildren;
96449
- }
96450
- getConfig() {
96451
- return {
96452
- allowedChildren: this.allowedChildren
96453
- };
96454
96447
  }
96455
96448
  }
96456
96449
  class UnionProp extends Prop {
@@ -96857,7 +96850,7 @@ function registerStores(stores) {
96857
96850
  internalStores = { ...internalStores, ...stores };
96858
96851
  if (SUPPORTED_MODES.includes("production")) {
96859
96852
  if (Object.keys(internalStores).length === Object.keys(stores).length) {
96860
- import("./devtools-consolidated-3ekbDKtc.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
96853
+ import("./devtools-consolidated-DcfmUvsu.js").then(({ initializeCustomDevTools, setRegisteredStores }) => {
96861
96854
  setRegisteredStores(internalStores);
96862
96855
  initializeCustomDevTools();
96863
96856
  }).catch((error) => {
@@ -96870,7 +96863,7 @@ function registerStores(stores) {
96870
96863
  }
96871
96864
  }
96872
96865
  const DevToolsInternal = React__default.lazy(() => {
96873
- return import("./devtools-consolidated-3ekbDKtc.js").then((module2) => ({
96866
+ return import("./devtools-consolidated-DcfmUvsu.js").then((module2) => ({
96874
96867
  default: module2.CustomDevTools
96875
96868
  }));
96876
96869
  });
@@ -99517,150 +99510,13 @@ const rootStore$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
99517
99510
  __proto__: null,
99518
99511
  default: rootStore
99519
99512
  }, Symbol.toStringTag, { value: "Module" }));
99520
- const detachedComponentTypeList = ["Modal", "Slideout"];
99521
- const DetachedComponentTypes = new Set(
99522
- detachedComponentTypeList
99523
- );
99524
- function rule(description, restriction) {
99525
- return {
99526
- description,
99527
- restriction
99528
- };
99529
- }
99530
- const restrictions = [
99531
- rule(
99532
- "Draggable type must be draggable",
99533
- ({ draggedType }) => !isTypeDraggable(draggedType)
99534
- ),
99535
- rule(
99536
- "Drop target type must be droppable",
99537
- ({ dropTargetType }) => !isTypeDroppable(dropTargetType)
99538
- ),
99539
- rule(
99540
- "Columns can only be dropped on sections",
99541
- ({ draggedType, dropTargetType }) => {
99542
- return draggedType === "Column" && dropTargetType !== "Section";
99543
- }
99544
- ),
99545
- rule(
99546
- "Sections can only be dropped on pages",
99547
- ({ draggedType, dropTargetType }) => {
99548
- return draggedType === "Section" && dropTargetType !== "Page";
99549
- }
99550
- ),
99551
- rule(
99552
- "Only sections can be dropped on non-empty pages",
99553
- ({ draggedType, dropTargetType, dropTargetEmpty }) => {
99554
- return draggedType !== "Section" && dropTargetType === "Page" && !dropTargetEmpty;
99555
- }
99556
- ),
99557
- rule(
99558
- "Only columns can be dropped on non-empty sections",
99559
- ({ draggedType, dropTargetType, dropTargetEmpty }) => {
99560
- return draggedType !== "Column" && dropTargetType === "Section" && !dropTargetEmpty;
99561
- }
99562
- )
99563
- ];
99564
- const isDragAndDropTypeValid = ({
99565
- draggedType,
99566
- dropTargetType,
99567
- dropTargetEmpty,
99568
- isDraggingNewComponent
99569
- }) => {
99570
- const actualDraggedType = isDraggingNewComponent && (draggedType === "Modal" || draggedType === "Slideout") ? "Button" : draggedType;
99571
- const triggeredRestriction = restrictions.find(
99572
- (restriction) => restriction.restriction({
99573
- draggedType: actualDraggedType,
99574
- dropTargetType,
99575
- dropTargetEmpty,
99576
- isDraggingNewComponent
99577
- })
99578
- );
99579
- return triggeredRestriction == null;
99580
- };
99581
- const isTypeDroppable = (type5) => {
99582
- const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
99583
- return (editorConfig2 == null ? void 0 : editorConfig2.isDroppable) === true;
99584
- };
99585
- const isTypeDraggable = (type5) => {
99586
- const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
99587
- return (editorConfig2 == null ? void 0 : editorConfig2.isDraggable) !== false;
99588
- };
99589
- const isContentDraggable = (type5) => {
99590
- if (!isTypeDraggable(type5)) {
99591
- return false;
99592
- }
99593
- const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
99594
- return (editorConfig2 == null ? void 0 : editorConfig2.isContentDraggable) !== false;
99595
- };
99596
- function shouldWrapInSectionAndColumn(type5, parentType) {
99597
- if (DetachedComponentTypes.has(type5)) {
99513
+ function isComponentTypeDetached(componentType) {
99514
+ if (!componentType) {
99598
99515
  return false;
99599
99516
  }
99600
- return parentType === "Page" && type5 !== "Section" || parentType === "Section" && type5 !== "Column";
99517
+ const editorConfig2 = rootStore.componentRegistry.getEditorConfig(componentType);
99518
+ return (editorConfig2 == null ? void 0 : editorConfig2.isDetached) ?? false;
99601
99519
  }
99602
- const filterSafeStackDimensionProperties = (existingProps) => {
99603
- const { width, height, size: size2 } = existingProps;
99604
- let safeHeight;
99605
- let safeWidth;
99606
- let safeSize;
99607
- if ((height == null ? void 0 : height.mode) === "px" || (height == null ? void 0 : height.mode) === "fit" || (height == null ? void 0 : height.mode) === "fill") {
99608
- safeHeight = Property.Dimension(height);
99609
- }
99610
- if ((width == null ? void 0 : width.mode) === "px" || (width == null ? void 0 : width.mode) === "fit" || (width == null ? void 0 : width.mode) === "fill") {
99611
- safeWidth = Property.Dimension(width);
99612
- }
99613
- if ((size2 == null ? void 0 : size2.mode) === "px") {
99614
- safeSize = Property.Dimension(size2);
99615
- }
99616
- return {
99617
- width: safeWidth,
99618
- height: safeHeight,
99619
- size: safeSize
99620
- };
99621
- };
99622
- const filterSafeGridDimensionProperties = (existingProps) => {
99623
- const { width, height, size: size2 } = existingProps;
99624
- const safeDimensions = {};
99625
- if ((height == null ? void 0 : height.mode) === "rows" || (height == null ? void 0 : height.mode) === "fit") {
99626
- safeDimensions.height = Property.Dimension(height);
99627
- }
99628
- if ((width == null ? void 0 : width.mode) === "columns") {
99629
- safeDimensions.width = Property.Dimension(width);
99630
- }
99631
- if ((size2 == null ? void 0 : size2.mode) === "columns") {
99632
- safeDimensions.size = Property.Dimension(size2);
99633
- }
99634
- return safeDimensions;
99635
- };
99636
- const defaultSizeForComponent = (componentType, isFreeform, draggedDimensions) => {
99637
- if (componentType === "Icon") {
99638
- return {};
99639
- }
99640
- const height = Property.Dimension(Dim.fit());
99641
- if (isFreeform) {
99642
- const guWidth = (draggedDimensions == null ? void 0 : draggedDimensions.widthGU) ?? 4;
99643
- return {
99644
- height,
99645
- width: Property.Dimension(Dim.col(guWidth))
99646
- };
99647
- }
99648
- switch (componentType) {
99649
- case "Text":
99650
- case "Button":
99651
- case "Checkbox":
99652
- case "Switch":
99653
- return { height, width: Property.Dimension(Dim.fit()) };
99654
- case "Image":
99655
- return {
99656
- height,
99657
- width: Property.Dimension(Dim.px((draggedDimensions == null ? void 0 : draggedDimensions.widthPx) ?? 288))
99658
- // Matches widget config response. This should never be undefined though.
99659
- };
99660
- default:
99661
- return { height, width: Property.Dimension(Dim.fill()) };
99662
- }
99663
- };
99664
99520
  const getWidgetAnchorName = (instanceId) => {
99665
99521
  return `--widget-${instanceId}`;
99666
99522
  };
@@ -99668,7 +99524,7 @@ const getWidgetRectAnchorName = (instanceId) => {
99668
99524
  return `--widget-rect-${instanceId}`;
99669
99525
  };
99670
99526
  const getWidgetDropAreaAnchorName = (instanceId, widgetType) => {
99671
- if (widgetType && DetachedComponentTypes.has(widgetType)) {
99527
+ if (widgetType && isComponentTypeDetached(widgetType)) {
99672
99528
  return `--widget-drop-area-${instanceId}`;
99673
99529
  }
99674
99530
  return `--widget-${instanceId}`;
@@ -99677,7 +99533,7 @@ const getEditWrapperId = (instanceId) => {
99677
99533
  return `sb-edit-wrapper-${instanceId}`;
99678
99534
  };
99679
99535
  const getEditWrapperIdWithType = (instanceId, widgetType) => {
99680
- if (widgetType && DetachedComponentTypes.has(widgetType)) {
99536
+ if (widgetType && isComponentTypeDetached(widgetType)) {
99681
99537
  return `sb-edit-wrapper-for-${widgetType}-${instanceId}`;
99682
99538
  }
99683
99539
  return `sb-edit-wrapper-${instanceId}`;
@@ -104636,14 +104492,14 @@ function getLoaderFn$1(options) {
104636
104492
  if (!(loader === "all")) return [3, 3];
104637
104493
  return [4, import(
104638
104494
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
104639
- "./allPathsLoader-CM3qFtpk.js"
104495
+ "./allPathsLoader-PrrgrK2q.js"
104640
104496
  )];
104641
104497
  case 2:
104642
104498
  return [2, _b2.sent().allPathsLoader];
104643
104499
  case 3:
104644
104500
  return [4, import(
104645
104501
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
104646
- "./splitPathsBySizeLoader-CJaleIID.js"
104502
+ "./splitPathsBySizeLoader-Pl9Bep92.js"
104647
104503
  )];
104648
104504
  case 4:
104649
104505
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -129675,6 +129531,177 @@ function useComponentDroppable({
129675
129531
  }
129676
129532
  });
129677
129533
  }
129534
+ const ALLOWED_CHILDREN_COMPONENT_TYPES = {
129535
+ Page: ["Section"],
129536
+ Section: ["Column"]
129537
+ };
129538
+ const RESTRICT_PARENT_TYPES = {
129539
+ Page: [],
129540
+ Section: ["Page"],
129541
+ Column: ["Section", "Page"]
129542
+ };
129543
+ const getAllowedChildrenComponentTypes = (componentType) => {
129544
+ return ALLOWED_CHILDREN_COMPONENT_TYPES[componentType];
129545
+ };
129546
+ function isNestable(componentType, parentType) {
129547
+ var _a2;
129548
+ if (parentType && RESTRICT_PARENT_TYPES[componentType] && !((_a2 = RESTRICT_PARENT_TYPES[componentType]) == null ? void 0 : _a2.includes(parentType))) {
129549
+ return false;
129550
+ }
129551
+ return true;
129552
+ }
129553
+ const detachedComponentTypeList = ["Modal", "Slideout"];
129554
+ new Set(
129555
+ detachedComponentTypeList
129556
+ );
129557
+ function rule(description, restriction) {
129558
+ return {
129559
+ description,
129560
+ restriction
129561
+ };
129562
+ }
129563
+ const restrictions = [
129564
+ rule(
129565
+ "Draggable type must be draggable",
129566
+ ({ draggedType }) => !isTypeDraggable(draggedType)
129567
+ ),
129568
+ rule(
129569
+ "Drop target type must be droppable",
129570
+ ({ dropTargetType }) => !isTypeDroppable(dropTargetType)
129571
+ ),
129572
+ rule(
129573
+ "Columns can only be dropped on sections",
129574
+ ({ draggedType, dropTargetType }) => {
129575
+ return draggedType === "Column" && dropTargetType !== "Section";
129576
+ }
129577
+ ),
129578
+ rule(
129579
+ "Sections can only be dropped on pages",
129580
+ ({ draggedType, dropTargetType }) => {
129581
+ return draggedType === "Section" && dropTargetType !== "Page";
129582
+ }
129583
+ ),
129584
+ rule(
129585
+ "Only sections can be dropped on non-empty pages",
129586
+ ({ draggedType, dropTargetType, dropTargetEmpty }) => {
129587
+ return draggedType !== "Section" && dropTargetType === "Page" && !dropTargetEmpty;
129588
+ }
129589
+ ),
129590
+ rule(
129591
+ "Only columns can be dropped on non-empty sections",
129592
+ ({ draggedType, dropTargetType, dropTargetEmpty }) => {
129593
+ return draggedType !== "Column" && dropTargetType === "Section" && !dropTargetEmpty;
129594
+ }
129595
+ )
129596
+ ];
129597
+ const isDragAndDropTypeValid = ({
129598
+ draggedType,
129599
+ dropTargetType,
129600
+ dropTargetEmpty,
129601
+ isDraggingNewComponent
129602
+ }) => {
129603
+ const actualDraggedType = isDraggingNewComponent && (draggedType === "Modal" || draggedType === "Slideout") ? "Button" : draggedType;
129604
+ const triggeredRestriction = restrictions.find(
129605
+ (restriction) => restriction.restriction({
129606
+ draggedType: actualDraggedType,
129607
+ dropTargetType,
129608
+ dropTargetEmpty,
129609
+ isDraggingNewComponent
129610
+ })
129611
+ );
129612
+ return triggeredRestriction == null;
129613
+ };
129614
+ const isTypeDroppable = (type5) => {
129615
+ const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
129616
+ return (editorConfig2 == null ? void 0 : editorConfig2.isDroppable) === true;
129617
+ };
129618
+ const isTypeDraggable = (type5) => {
129619
+ const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
129620
+ return (editorConfig2 == null ? void 0 : editorConfig2.isDraggable) !== false;
129621
+ };
129622
+ const isContentDraggable = (type5) => {
129623
+ if (!isTypeDraggable(type5)) {
129624
+ return false;
129625
+ }
129626
+ const editorConfig2 = rootStore.componentRegistry.getEditorConfig(type5);
129627
+ return (editorConfig2 == null ? void 0 : editorConfig2.isContentDraggable) !== false;
129628
+ };
129629
+ function shouldWrapComponent(type5, parentType) {
129630
+ if (isComponentTypeDetached(type5)) {
129631
+ return [false];
129632
+ }
129633
+ if (!parentType) {
129634
+ return [false];
129635
+ }
129636
+ const allowedChildren = getAllowedChildrenComponentTypes(parentType);
129637
+ if (allowedChildren === void 0 || allowedChildren.includes(type5)) {
129638
+ return [false];
129639
+ } else {
129640
+ return [true, allowedChildren == null ? void 0 : allowedChildren[0]];
129641
+ }
129642
+ }
129643
+ const filterSafeStackDimensionProperties = (existingProps) => {
129644
+ const { width, height, size: size2 } = existingProps;
129645
+ let safeHeight;
129646
+ let safeWidth;
129647
+ let safeSize;
129648
+ if ((height == null ? void 0 : height.mode) === "px" || (height == null ? void 0 : height.mode) === "fit" || (height == null ? void 0 : height.mode) === "fill") {
129649
+ safeHeight = Property.Dimension(height);
129650
+ }
129651
+ if ((width == null ? void 0 : width.mode) === "px" || (width == null ? void 0 : width.mode) === "fit" || (width == null ? void 0 : width.mode) === "fill") {
129652
+ safeWidth = Property.Dimension(width);
129653
+ }
129654
+ if ((size2 == null ? void 0 : size2.mode) === "px") {
129655
+ safeSize = Property.Dimension(size2);
129656
+ }
129657
+ return {
129658
+ width: safeWidth,
129659
+ height: safeHeight,
129660
+ size: safeSize
129661
+ };
129662
+ };
129663
+ const filterSafeGridDimensionProperties = (existingProps) => {
129664
+ const { width, height, size: size2 } = existingProps;
129665
+ const safeDimensions = {};
129666
+ if ((height == null ? void 0 : height.mode) === "rows" || (height == null ? void 0 : height.mode) === "fit") {
129667
+ safeDimensions.height = Property.Dimension(height);
129668
+ }
129669
+ if ((width == null ? void 0 : width.mode) === "columns") {
129670
+ safeDimensions.width = Property.Dimension(width);
129671
+ }
129672
+ if ((size2 == null ? void 0 : size2.mode) === "columns") {
129673
+ safeDimensions.size = Property.Dimension(size2);
129674
+ }
129675
+ return safeDimensions;
129676
+ };
129677
+ const defaultSizeForComponent = (componentType, isFreeform, draggedDimensions) => {
129678
+ if (componentType === "Icon") {
129679
+ return {};
129680
+ }
129681
+ const height = Property.Dimension(Dim.fit());
129682
+ if (isFreeform) {
129683
+ const guWidth = (draggedDimensions == null ? void 0 : draggedDimensions.widthGU) ?? 4;
129684
+ return {
129685
+ height,
129686
+ width: Property.Dimension(Dim.col(guWidth))
129687
+ };
129688
+ }
129689
+ switch (componentType) {
129690
+ case "Text":
129691
+ case "Button":
129692
+ case "Checkbox":
129693
+ case "Switch":
129694
+ return { height, width: Property.Dimension(Dim.fit()) };
129695
+ case "Image":
129696
+ return {
129697
+ height,
129698
+ width: Property.Dimension(Dim.px((draggedDimensions == null ? void 0 : draggedDimensions.widthPx) ?? 288))
129699
+ // Matches widget config response. This should never be undefined though.
129700
+ };
129701
+ default:
129702
+ return { height, width: Property.Dimension(Dim.fill()) };
129703
+ }
129704
+ };
129678
129705
  const DroppableWidget = observer(
129679
129706
  (props2) => {
129680
129707
  var _a2;
@@ -130067,15 +130094,6 @@ function getComponentBaseProperties(componentType, parentInfo, editorTemplateCre
130067
130094
  children: (editorTemplateCreateRequest == null ? void 0 : editorTemplateCreateRequest.children) ?? []
130068
130095
  };
130069
130096
  }
130070
- function checkComponentForParentTypeBeforeCreating(componentType, parentType) {
130071
- if (componentType === "Section" && parentType !== "Page") {
130072
- return false;
130073
- }
130074
- if (componentType === "Column" && parentType !== "Section" && parentType !== "Page") {
130075
- return false;
130076
- }
130077
- return true;
130078
- }
130079
130097
  function getCreateAtParentElement(relativeParent, createAt) {
130080
130098
  if (createAt === "root") {
130081
130099
  const parentInstanceId = getEditStore().runtimeEntitiesManager.widgets.getAnyInstanceIdForSourceId(
@@ -130106,10 +130124,8 @@ async function createComponent({
130106
130124
  }) {
130107
130125
  var _a2, _b2;
130108
130126
  const parentInfo = getParentInfo(parent);
130109
- if (!checkComponentForParentTypeBeforeCreating(componentType, parentInfo.type)) {
130110
- console.error(
130111
- `${componentType} cannot be added to ${parentInfo.type} directly`
130112
- );
130127
+ if (!isNestable(componentType, parentInfo.type)) {
130128
+ console.error(`${componentType} cannot be nested under ${parentInfo.type}`);
130113
130129
  return;
130114
130130
  }
130115
130131
  const editorTemplates = rootStore.componentRegistry.getEditorTemplates(componentType);
@@ -130140,11 +130156,8 @@ async function createComponent({
130140
130156
  baseProperties: baseProperties2
130141
130157
  }) {
130142
130158
  const type5 = (editorTemplateCreateRequest2 == null ? void 0 : editorTemplateCreateRequest2.type) ?? componentType;
130143
- const willWrapInSectionAndColumn = shouldWrapInSectionAndColumn(
130144
- type5,
130145
- parentInfo.type
130146
- );
130147
- const isGridLike = willWrapInSectionAndColumn && type5 !== "Column" ? true : parentInfo.isGridLike;
130159
+ const [shouldWrap, wrapInType] = shouldWrapComponent(type5, parentInfo.type);
130160
+ const isGridLike = shouldWrap && type5 !== "Column" ? true : parentInfo.isGridLike;
130148
130161
  const { properties: propertiesFromType, children } = getComponentBaseProperties(
130149
130162
  type5,
130150
130163
  {
@@ -130169,11 +130182,8 @@ async function createComponent({
130169
130182
  scopeName,
130170
130183
  id: editStore2.operationManager.generateSourceId()
130171
130184
  };
130172
- if (willWrapInSectionAndColumn) {
130173
- primaryComponent = wrapInSectionColumnIfDroppingOnPage(
130174
- primaryComponent,
130175
- parentInfo.type
130176
- );
130185
+ if (shouldWrap) {
130186
+ primaryComponent = wrapComponentIfNecessary(primaryComponent, wrapInType);
130177
130187
  }
130178
130188
  return primaryComponent;
130179
130189
  }
@@ -130213,54 +130223,25 @@ async function createComponent({
130213
130223
  }
130214
130224
  return createRequests.at(-1).id;
130215
130225
  }
130216
- function wrapInSectionColumnIfDroppingOnPage(primaryComponent, parentType) {
130217
- const { properties: sectionProperties } = getComponentBaseProperties(
130218
- "Section",
130219
- {
130220
- isGridLike: false
130221
- // parent is a page
130222
- }
130223
- );
130224
- if (primaryComponent.tagName === "Column") {
130225
- return {
130226
- parentElement: primaryComponent.parentElement,
130227
- tagName: "Section",
130228
- id: getEditStore().operationManager.generateSourceId(),
130229
- properties: sectionProperties,
130230
- children: [primaryComponent]
130231
- };
130226
+ function wrapComponentIfNecessary(primaryComponent, wrapInType) {
130227
+ if (!wrapInType) {
130228
+ return primaryComponent;
130232
130229
  }
130233
- const { properties: columnProperties } = getComponentBaseProperties(
130234
- "Column",
130235
- {
130236
- isGridLike: false
130237
- // parent is section
130238
- }
130230
+ const { properties: properties2 } = getComponentBaseProperties(wrapInType, {
130231
+ isGridLike: false
130232
+ // parent is a page (TODO: it was hardcoded, make it dynamic?)
130233
+ });
130234
+ const [_15, continueWrappingInType] = shouldWrapComponent(
130235
+ primaryComponent.tagName,
130236
+ wrapInType
130239
130237
  );
130240
- if (parentType === "Section") {
130241
- return {
130242
- parentElement: primaryComponent.parentElement,
130243
- tagName: "Column",
130244
- id: getEditStore().operationManager.generateSourceId(),
130245
- properties: columnProperties,
130246
- children: [primaryComponent]
130247
- };
130248
- }
130249
130238
  return {
130250
130239
  parentElement: primaryComponent.parentElement,
130251
- tagName: "Section",
130240
+ tagName: wrapInType,
130252
130241
  id: getEditStore().operationManager.generateSourceId(),
130253
- properties: sectionProperties,
130242
+ properties: properties2,
130254
130243
  children: [
130255
- {
130256
- tagName: "Column",
130257
- id: getEditStore().operationManager.generateSourceId(),
130258
- properties: {
130259
- ...columnProperties,
130260
- layout: Property.Static("vertical")
130261
- },
130262
- children: [primaryComponent]
130263
- }
130244
+ wrapComponentIfNecessary(primaryComponent, continueWrappingInType)
130264
130245
  ]
130265
130246
  };
130266
130247
  }
@@ -130403,7 +130384,7 @@ const handleStackDropWithinCanvas = (params) => {
130403
130384
  if (!draggedType) {
130404
130385
  throw new Error(`Missing dragged type: ${draggedId}`);
130405
130386
  }
130406
- const shouldWrap = shouldWrapInSectionAndColumn(draggedType, dropTargetType);
130387
+ const [shouldWrap] = shouldWrapComponent(draggedType, dropTargetType);
130407
130388
  const activeDragRect = editStore2.ui.dnd.activeDragRect;
130408
130389
  if (shouldWrap) {
130409
130390
  dropComponentInWrappingSectionOrColumn({
@@ -131644,10 +131625,6 @@ function useWidgetHover(rootType) {
131644
131625
  };
131645
131626
  }, [rootType]);
131646
131627
  }
131647
- const DETACHED_COMPONENT_TYPES = [
131648
- "Modal",
131649
- "Slideout"
131650
- ];
131651
131628
  const InteractionLayer = observer(
131652
131629
  (props2) => {
131653
131630
  useWidgetHover(props2.rootType);
@@ -131680,9 +131657,7 @@ const InteractionLayer = observer(
131680
131657
  if (!isActive2) {
131681
131658
  return null;
131682
131659
  }
131683
- const interactionRectsForSelectedElements = selectedElements.filter(
131684
- (info) => !DETACHED_COMPONENT_TYPES.includes(info.type)
131685
- ).map((info) => {
131660
+ const interactionRectsForSelectedElements = selectedElements.filter((info) => !isComponentTypeDetached(info.type)).map((info) => {
131686
131661
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
131687
131662
  InteractionRect,
131688
131663
  {
@@ -131692,7 +131667,9 @@ const InteractionLayer = observer(
131692
131667
  info.sourceId
131693
131668
  );
131694
131669
  });
131695
- const interactionRectIfDetachedComponent = DETACHED_COMPONENT_TYPES.includes(props2.rootType) && /* @__PURE__ */ jsxRuntimeExports.jsx(
131670
+ const interactionRectIfDetachedComponent = isComponentTypeDetached(
131671
+ props2.rootType
131672
+ ) && /* @__PURE__ */ jsxRuntimeExports.jsx(
131696
131673
  InteractionRect,
131697
131674
  {
131698
131675
  isDragging: false,
@@ -132192,9 +132169,11 @@ function useTrackRuntimeWidget(instanceId, params) {
132192
132169
  stableEffectOptions
132193
132170
  );
132194
132171
  }
132195
- const registerComponent$1 = (type5, config2, Component3) => {
132172
+ const registerComponentInternal = (type5, config2, Component3) => {
132196
132173
  const managedProps = createManagedPropsList(config2.propertiesDefinition);
132197
- const isDroppable = !!managedProps.find((p) => p.dataType === "children");
132174
+ const isDroppable = !!managedProps.find(
132175
+ (p) => p.dataType === "children"
132176
+ );
132198
132177
  rootStore.onEditorRegistered(() => {
132199
132178
  getEditStore().propertiesPanelManager.setPropertiesDefinition(
132200
132179
  type5,
@@ -132988,7 +132967,7 @@ const propertiesDefinition$i = {
132988
132967
  })
132989
132968
  })
132990
132969
  };
132991
- const Button$3 = registerComponent$1(
132970
+ const Button$3 = registerComponentInternal(
132992
132971
  "Button",
132993
132972
  {
132994
132973
  propertiesDefinition: propertiesDefinition$i,
@@ -133540,7 +133519,7 @@ const propertiesDefinition$h = {
133540
133519
  loading: loading()
133541
133520
  })
133542
133521
  };
133543
- const Section2 = registerComponent$1(
133522
+ const Section2 = registerComponentInternal(
133544
133523
  "Section",
133545
133524
  {
133546
133525
  propertiesDefinition: propertiesDefinition$h
@@ -134057,7 +134036,7 @@ const InternalContainer = (props2) => {
134057
134036
  }
134058
134037
  );
134059
134038
  };
134060
- const Container = registerComponent$1(
134039
+ const Container = registerComponentInternal(
134061
134040
  "Container",
134062
134041
  {
134063
134042
  propertiesDefinition: propertiesDefinition$g
@@ -134109,7 +134088,7 @@ const propertiesDefinition$f = {
134109
134088
  };
134110
134089
  const CONTAINER_MIN_WIDTH = Dim.px(0);
134111
134090
  const CONTAINER_FILL_DIM = Dim.fill();
134112
- const Column = registerComponent$1(
134091
+ const Column = registerComponentInternal(
134113
134092
  "Column",
134114
134093
  {
134115
134094
  propertiesDefinition: propertiesDefinition$f
@@ -141711,7 +141690,7 @@ const propertiesDefinition$e = {
141711
141690
  })
141712
141691
  })
141713
141692
  };
141714
- const Input2 = registerComponent$1(
141693
+ const Input2 = registerComponentInternal(
141715
141694
  "Input",
141716
141695
  {
141717
141696
  propertiesDefinition: propertiesDefinition$e
@@ -141878,9 +141857,7 @@ const editorConfig$a = {
141878
141857
  };
141879
141858
  const propertiesDefinition$d = {
141880
141859
  contents: Section$1.category(PropsPanelCategory.Content).children({
141881
- children: Prop.children({
141882
- allowedChildren: ["Section"]
141883
- }),
141860
+ children: Prop.children(),
141884
141861
  columns: Prop.array().readAndWrite().propertiesPanel({
141885
141862
  label: "Sections",
141886
141863
  controlType: "SECTION_LIST",
@@ -141911,7 +141888,7 @@ const propertiesDefinition$d = {
141911
141888
  })
141912
141889
  })
141913
141890
  };
141914
- const Page = registerComponent$1(
141891
+ const Page = registerComponentInternal(
141915
141892
  "Page",
141916
141893
  {
141917
141894
  propertiesDefinition: propertiesDefinition$d
@@ -148898,7 +148875,7 @@ const useIconContainerStyles = ({
148898
148875
  };
148899
148876
  }, [iconGap, horizontalAlign]);
148900
148877
  };
148901
- const Text$1 = registerComponent$1(
148878
+ const Text$1 = registerComponentInternal(
148902
148879
  "Text",
148903
148880
  {
148904
148881
  propertiesDefinition: propertiesDefinition$c
@@ -149422,7 +149399,7 @@ const propertiesDefinition$b = {
149422
149399
  isOpen: Prop.boolean().readable().default(false).docs({ description: "Whether the modal is currently open and visible" })
149423
149400
  })
149424
149401
  };
149425
- const Modal = registerComponent$1(
149402
+ const Modal = registerComponentInternal(
149426
149403
  "Modal",
149427
149404
  {
149428
149405
  propertiesDefinition: propertiesDefinition$b
@@ -151865,7 +151842,7 @@ const SlideoutComponent = (props2) => {
151865
151842
  }
151866
151843
  );
151867
151844
  };
151868
- const Slideout = registerComponent$1(
151845
+ const Slideout = registerComponentInternal(
151869
151846
  "Slideout",
151870
151847
  {
151871
151848
  propertiesDefinition: propertiesDefinition$a
@@ -162009,14 +161986,14 @@ function getLoaderFn(options) {
162009
161986
  if (!(loader === "all")) return [3, 3];
162010
161987
  return [4, import(
162011
161988
  /* webpackChunkName: "blueprint-icons-all-paths-loader" */
162012
- "./allPathsLoader-CbhZCOLq.js"
161989
+ "./allPathsLoader-DlXa_Ean.js"
162013
161990
  )];
162014
161991
  case 2:
162015
161992
  return [2, _b2.sent().allPathsLoader];
162016
161993
  case 3:
162017
161994
  return [4, import(
162018
161995
  /* webpackChunkName: "blueprint-icons-split-paths-by-size-loader" */
162019
- "./splitPathsBySizeLoader-BbneuAAM.js"
161996
+ "./splitPathsBySizeLoader-Dbmx5rN1.js"
162020
161997
  )];
162021
161998
  case 4:
162022
161999
  return [2, _b2.sent().splitPathsBySizeLoader];
@@ -193451,7 +193428,7 @@ const EMPTY_ARRAY = [];
193451
193428
  const EMPTY_OBJ = {};
193452
193429
  const noop = () => {
193453
193430
  };
193454
- const Table = registerComponent$1(
193431
+ const Table = registerComponentInternal(
193455
193432
  "Table",
193456
193433
  {
193457
193434
  propertiesDefinition: propertiesDefinition$9
@@ -197696,7 +197673,7 @@ const DropdownStyleOverrides = qe$1.div`
197696
197673
  ${(props2) => props2.$vertical ? labelStyle.vertical : labelStyle.horizontal}
197697
197674
  }
197698
197675
  `;
197699
- const Dropdown = registerComponent$1(
197676
+ const Dropdown = registerComponentInternal(
197700
197677
  "Dropdown",
197701
197678
  {
197702
197679
  propertiesDefinition: propertiesDefinition$8
@@ -197937,7 +197914,7 @@ const Dropdown = registerComponent$1(
197937
197914
  ) }) });
197938
197915
  }
197939
197916
  ).editorConfig(editorConfig$5).addEditorTemplate(editorTemplate$5);
197940
- const CustomComponent = registerComponent$1(
197917
+ const CustomComponent = registerComponentInternal(
197941
197918
  "CustomComponent",
197942
197919
  {
197943
197920
  propertiesDefinition: {}
@@ -198015,7 +197992,7 @@ function registerComponent(name, propertiesDefinition2, component) {
198015
197992
  } else {
198016
197993
  allSections = propertiesDefinition2;
198017
197994
  }
198018
- return registerComponent$1(
197995
+ return registerComponentInternal(
198019
197996
  name,
198020
197997
  {
198021
197998
  propertiesDefinition: allSections,
@@ -198228,7 +198205,7 @@ const CheckboxContainer = qe$1.div`
198228
198205
  flex-direction: column;
198229
198206
  align-items: flex-start;
198230
198207
  `;
198231
- const Checkbox = registerComponent$1(
198208
+ const Checkbox = registerComponentInternal(
198232
198209
  "Checkbox",
198233
198210
  {
198234
198211
  propertiesDefinition: propertiesDefinition$7
@@ -198620,7 +198597,7 @@ const DatePickerContainer = qe$1.div`
198620
198597
  align-items: flex-start;
198621
198598
  width: 100%;
198622
198599
  `;
198623
- const DatePicker = registerComponent$1(
198600
+ const DatePicker = registerComponentInternal(
198624
198601
  "DatePicker",
198625
198602
  {
198626
198603
  propertiesDefinition: propertiesDefinition$6
@@ -198960,7 +198937,7 @@ const SwitchContainer = qe$1.div`
198960
198937
  flex-direction: column;
198961
198938
  align-items: flex-start;
198962
198939
  `;
198963
- const Switch = registerComponent$1(
198940
+ const Switch = registerComponentInternal(
198964
198941
  "Switch",
198965
198942
  {
198966
198943
  propertiesDefinition: propertiesDefinition$5
@@ -199070,7 +199047,7 @@ const propertiesDefinition$4 = {
199070
199047
  const StyledContainer = qe$1.div`
199071
199048
  overflow: hidden;
199072
199049
  `;
199073
- const Icon = registerComponent$1(
199050
+ const Icon = registerComponentInternal(
199074
199051
  "Icon",
199075
199052
  {
199076
199053
  propertiesDefinition: propertiesDefinition$4
@@ -199347,7 +199324,7 @@ const ImageContainer = qe$1.div`
199347
199324
  align-items: flex-start;
199348
199325
  overflow-y: hidden;
199349
199326
  `;
199350
- const Image = registerComponent$1(
199327
+ const Image = registerComponentInternal(
199351
199328
  "Image",
199352
199329
  {
199353
199330
  propertiesDefinition: propertiesDefinition$3
@@ -200589,6 +200566,12 @@ const EmbedWrapper$2 = (props2) => {
200589
200566
  case "operations/editor:selectWidgets": {
200590
200567
  const sourceIds = action2.payload.sourceIds;
200591
200568
  getEditStore().ui.setSelectedSourceIds(sourceIds);
200569
+ const instanceIds = sourceIds.map((sourceId) => {
200570
+ return getEditStore().runtimeEntitiesManager.widgets.getAnyInstanceIdForSourceId(
200571
+ sourceId
200572
+ );
200573
+ });
200574
+ getEditStore().ui.setSelectedInstanceIds(instanceIds);
200592
200575
  break;
200593
200576
  }
200594
200577
  case "RUN_API": {
@@ -203158,4 +203141,4 @@ export {
203158
203141
  setQueryParams as y,
203159
203142
  download as z
203160
203143
  };
203161
- //# sourceMappingURL=index-DoQuZXxx.js.map
203144
+ //# sourceMappingURL=index-COYupQHJ.js.map