@orangelogic/design-system 2.21.0-pr77329.3 → 2.22.0-pr77364.9

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.
@@ -142035,7 +142035,7 @@ var zVt = Object.defineProperty, FVt = Object.getOwnPropertyDescriptor, Ur = (n,
142035
142035
  };
142036
142036
  let Ar = class extends Fn {
142037
142037
  constructor() {
142038
- super(), this.localize = new nr(this), this.configsController = new ca(this.localize), this.initialData = "", this.device = "desktop", this.devices = HQ, this.autoInit = !1, this.pageId = "", this.allowDuplicateBlocks = !1, this.mode = qd.Template, this.contentBuilder = null, this.ready = !1, this.editingComponent = null, this.isGalleryConfigOpen = !1, this.hoveredComponent = void 0, this.hoveredComponentPlacement = "top", this.defaultRowGap = 0, this.containerDropdowns = [], this.containerDropdownStateMap = {}, this.distance = void 0, this.toolbar = [], this.toolbarActive = !1, this.childSelected = void 0, this.mousePosition = { x: 0, y: 0 }, this._teamSpaceRoles = [], this.canvasDocument = null, this._dsm = null, this.hasBoundUpdate = !1, this.newlyAddedComponentTimeout = null, this.initializeCustomFrame = eLt(), this.containerDropdownObservers = [], this.nextMapHoveredBadgeState = null, this.deselectAll = this.deselectAll.bind(this), this.handleCanvasClick = this.handleCanvasClick.bind(this), this.handleCanvasKeydown = this.handleCanvasKeydown.bind(this), this.handleDataSourceChange = this.handleDataSourceChange.bind(this), this.handleCanvasMouseMove = this.handleCanvasMouseMove.bind(this), this.handleTemplateManagerUpdated = this.handleTemplateManagerUpdated.bind(this), this.handleCanvasScroll = this.handleCanvasScroll.bind(this);
142038
+ super(), this.localize = new nr(this), this.configsController = new ca(this.localize), this.initialData = "", this.device = "desktop", this.devices = HQ, this.autoInit = !1, this.pageId = "", this.allowDuplicateBlocks = !1, this.mode = qd.Template, this.contentBuilder = null, this.ready = !1, this.editingComponent = null, this.isGalleryConfigOpen = !1, this.hoveredComponent = void 0, this.hoveredComponentPlacement = "top", this.defaultRowGap = 0, this.containerDropdowns = [], this.containerDropdownStateMap = {}, this.distance = void 0, this.toolbar = [], this.toolbarActive = !1, this.childSelected = void 0, this.mousePosition = { x: 0, y: 0 }, this._teamSpaceRoles = [], this.canvasDocument = null, this._dsm = null, this.hasBoundUpdate = !1, this.newlyAddedComponentTimeout = null, this.initializeCustomFrame = eLt(), this.containerDropdownObservers = [], this.nextMapHoveredBadgeState = null, this.deselectAll = this.deselectAll.bind(this), this.handleCanvasClick = this.handleCanvasClick.bind(this), this.handleRootToolbarRightClick = this.handleRootToolbarRightClick.bind(this), this.handleCanvasKeydown = this.handleCanvasKeydown.bind(this), this.handleDataSourceChange = this.handleDataSourceChange.bind(this), this.handleCanvasMouseMove = this.handleCanvasMouseMove.bind(this), this.handleTemplateManagerUpdated = this.handleTemplateManagerUpdated.bind(this), this.handleCanvasScroll = this.handleCanvasScroll.bind(this);
142039
142039
  }
142040
142040
  get teamSpaceRoles() {
142041
142041
  return this._teamSpaceRoles;
@@ -142192,10 +142192,13 @@ let Ar = class extends Fn {
142192
142192
  * Deselect all components in the content builder.
142193
142193
  */
142194
142194
  deselectAll() {
142195
- if (!this.contentBuilder)
142196
- return;
142197
- const n = this.contentBuilder.getSelected();
142198
- n && n.trigger("disable"), this.hoveredComponent = void 0, this.contentBuilder.select();
142195
+ if (this.contentBuilder)
142196
+ try {
142197
+ const n = this.contentBuilder.getSelected();
142198
+ n && n.trigger("disable"), this.hoveredComponent = void 0, this.contentBuilder.select();
142199
+ } catch {
142200
+ throw new Error("handle deselect all error");
142201
+ }
142199
142202
  }
142200
142203
  async fetchTeamSpaceRoles() {
142201
142204
  return await j3t();
@@ -142339,6 +142342,10 @@ let Ar = class extends Fn {
142339
142342
  const n = this.contentBuilder?.getSelected(), e = this.childSelected;
142340
142343
  n && !e && this.contentBuilder?.trigger("component:selected", n), this.toggleToolbarAndBadge();
142341
142344
  }
142345
+ handleRootToolbarRightClick(n) {
142346
+ const e = n.target;
142347
+ n.button === 2 && e instanceof Element && e.closest(".gjs-toolbar") && (n.preventDefault(), n.stopImmediatePropagation());
142348
+ }
142342
142349
  handleCanvasClick(n) {
142343
142350
  n.target.closest("[data-cms5-page-viewer__page-content]") || this.deselectAll();
142344
142351
  }
@@ -142349,12 +142356,20 @@ let Ar = class extends Fn {
142349
142356
  if (!t || t.get("type") === "wrapper" || t === i)
142350
142357
  this.deselectAll();
142351
142358
  else if (t.get("selectable"))
142352
- this.contentBuilder.select(t);
142359
+ try {
142360
+ this.contentBuilder.select(t);
142361
+ } catch {
142362
+ throw new Error("handle canvas keydown error");
142363
+ }
142353
142364
  else {
142354
142365
  let o = t.parent();
142355
142366
  for (; o && o !== r && o !== i; ) {
142356
142367
  if (o.get("selectable")) {
142357
- this.contentBuilder.select(o);
142368
+ try {
142369
+ this.contentBuilder.select(o);
142370
+ } catch {
142371
+ throw new Error("handle canvas keydown error 2");
142372
+ }
142358
142373
  return;
142359
142374
  }
142360
142375
  o = o.parent();
@@ -142503,27 +142518,31 @@ let Ar = class extends Fn {
142503
142518
  return;
142504
142519
  this.contentBuilder.Canvas.getFrameEl().setAttribute("title", "content-builder-frame"), this.updateFrameSize(), this._teamSpaceRoles = await this.fetchTeamSpaceRoles();
142505
142520
  }), this.contentBuilder?.on("load", async (t) => {
142506
- t.UndoManager.stop();
142507
- const r = this.canvasDocument?.getElementById("Form1");
142508
- r && r.addEventListener("scroll", this.handleCanvasScroll);
142521
+ this.contentBuilder?.getEl()?.addEventListener(
142522
+ "mousedown",
142523
+ this.handleRootToolbarRightClick,
142524
+ !0
142525
+ ), t.UndoManager.stop();
142526
+ const i = this.canvasDocument?.getElementById("Form1");
142527
+ i && i.addEventListener("scroll", this.handleCanvasScroll);
142509
142528
  try {
142510
142529
  t.getWrapper()?.set({
142511
142530
  highlightable: !1,
142512
142531
  hoverable: !1,
142513
142532
  selectable: !1
142514
142533
  });
142515
- const i = t.getWrapper(), o = t.Canvas.getBody().querySelector(
142534
+ const o = t.getWrapper(), a = t.Canvas.getBody().querySelector(
142516
142535
  "[data-cms5-page-viewer]"
142517
142536
  );
142518
- if (!i)
142537
+ if (!o)
142519
142538
  return;
142520
- let a = "12px";
142521
- if (o) {
142522
- const l = getComputedStyle(o).getPropertyValue("--row-gap").trim();
142523
- l && (a = l);
142539
+ let s = "12px";
142540
+ if (a) {
142541
+ const c = getComputedStyle(a).getPropertyValue("--row-gap").trim();
142542
+ c && (s = c);
142524
142543
  }
142525
- const s = Number.parseFloat(a || "12px");
142526
- this.defaultRowGap = Number.isFinite(s) ? s : 12, i.findType(ot.Column).length === 0 ? t.addComponents({
142544
+ const l = Number.parseFloat(s || "12px");
142545
+ this.defaultRowGap = Number.isFinite(l) ? l : 12, o.findType(ot.Column).length === 0 ? t.addComponents({
142527
142546
  copyable: !1,
142528
142547
  editable: !1,
142529
142548
  highlightable: !1,
@@ -142533,12 +142552,12 @@ let Ar = class extends Fn {
142533
142552
  style: {
142534
142553
  "--flex-content": "none",
142535
142554
  "--padding": "4px",
142536
- "--row-gap": a
142555
+ "--row-gap": s
142537
142556
  },
142538
142557
  toolbar: [],
142539
142558
  type: ot.Column
142540
- }) : i.findType(ot.Column)?.forEach((l, c) => {
142541
- c === 0 && l.set({
142559
+ }) : o.findType(ot.Column)?.forEach((c, d) => {
142560
+ d === 0 && c.set({
142542
142561
  copyable: !1,
142543
142562
  editable: !1,
142544
142563
  highlightable: !1,
@@ -142548,14 +142567,14 @@ let Ar = class extends Fn {
142548
142567
  style: {
142549
142568
  "--flex-content": "none",
142550
142569
  "--padding": "4px",
142551
- "--row-gap": a
142570
+ "--row-gap": s
142552
142571
  }
142553
- }), l.set({
142572
+ }), c.set({
142554
142573
  draggable: '[data-gjs-type="BlockColumns"]',
142555
142574
  droppable: '[data-gjs-type="BlockButton"], [data-gjs-type="BlockColumns"], [data-gjs-type="BlockDivider"], [data-gjs-type="BlockHeader"], [data-gjs-type="BlockImage"], [data-gjs-type="BlockText"], [data-gjs-type="BlockVideo"], [data-gjs-type="BlockFontKit"], [data-gjs-type="BlockCarousel"], [data-gjs-type="BlockGallery"], [data-gjs-type="BlockTabs"], [data-gjs-type="BlockAccordion"], [data-gjs-type="BlockSearchBox"], [data-gjs-type="BlockColorSwatches"]'
142556
142575
  });
142557
- }), this.dsm?.getAll().forEach((l) => {
142558
- l.records.on("add", this.handleDataSourceChange);
142576
+ }), this.dsm?.getAll().forEach((c) => {
142577
+ c.records.on("add", this.handleDataSourceChange);
142559
142578
  }), this.updateDataSourceEntries(), this.resetDirtyCount();
142560
142579
  } finally {
142561
142580
  t.UndoManager.start();
@@ -142656,7 +142675,12 @@ let Ar = class extends Fn {
142656
142675
  }), this.contentBuilder?.on(
142657
142676
  "component:drag:end",
142658
142677
  ({ target: t }) => {
142659
- this.contentBuilder && (this.contentBuilder.select(), this.contentBuilder.select(t));
142678
+ if (this.contentBuilder)
142679
+ try {
142680
+ this.contentBuilder.select(), this.contentBuilder.select(t);
142681
+ } catch {
142682
+ throw new Error("handle component:drag:end error");
142683
+ }
142660
142684
  }
142661
142685
  ), this.contentBuilder?.on("canvas:frame:load:body", ({ window: t }) => {
142662
142686
  this.canvasDocument = t.document, t.document.addEventListener("click", this.handleCanvasClick), t.document.addEventListener("keydown", this.handleCanvasKeydown), t.document.addEventListener("mousemove", this.handleCanvasMouseMove), t.document.addEventListener(
@@ -142730,12 +142754,17 @@ let Ar = class extends Fn {
142730
142754
  "cx-template-manager-updated",
142731
142755
  this.handleTemplateManagerUpdated
142732
142756
  );
142733
- const n = this.canvasDocument?.getElementById("Form1");
142734
- n && n.removeEventListener("scroll", this.handleCanvasScroll);
142757
+ const e = this.canvasDocument?.getElementById("Form1");
142758
+ e && e.removeEventListener("scroll", this.handleCanvasScroll);
142735
142759
  }
142736
- this.contentBuilder?.destroy(), this.hasBoundUpdate = !1, this.newlyAddedComponentTimeout && clearTimeout(this.newlyAddedComponentTimeout);
142737
- for (const n of this.containerDropdownObservers)
142738
- n.disconnect?.();
142760
+ const n = this.contentBuilder?.getEl();
142761
+ n && n.removeEventListener(
142762
+ "mousedown",
142763
+ this.handleRootToolbarRightClick,
142764
+ !0
142765
+ ), this.contentBuilder?.destroy(), this.hasBoundUpdate = !1, this.newlyAddedComponentTimeout && clearTimeout(this.newlyAddedComponentTimeout);
142766
+ for (const e of this.containerDropdownObservers)
142767
+ e.disconnect?.();
142739
142768
  this.containerDropdownObservers = [];
142740
142769
  }
142741
142770
  handleBuilderPropsChange() {