@alekstar79/draggable-resizable-container 1.0.4 → 1.0.5

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.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './index.css';var Z = Object.defineProperty;
2
2
  var _ = (c, t, e) => t in c ? Z(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
3
  var a = (c, t, e) => _(c, typeof t != "symbol" ? t + "" : t, e);
4
- import Q, { reactive as $, computed as tt, effect as k, batch as D } from "@alekstar79/reactive-event-system";
4
+ import Q, { reactive as $, computed as tt, effect as x, batch as k } from "@alekstar79/reactive-event-system";
5
5
  import { clamp as v, deepMerge as et, debounce as z } from "@alekstar79/utility";
6
6
  class it {
7
7
  constructor(t) {
@@ -267,9 +267,9 @@ class J {
267
267
  return this.config.cache && this.cache.set(t, o), this.retryQueue.delete(t), this.recordLoadTime(i), o;
268
268
  } catch (o) {
269
269
  const h = o instanceof Error ? o : new Error(String(o));
270
- if (s < e) return this.retryQueue.set(t, s + 1), this.config.onWarn(`Retrying template "${t}" (attempt ${s + 1}/${e})`), await new Promise((l) => setTimeout(l, 100 * Math.pow(2, s))), this.loadTemplate(t, e);
271
- const d = this.createError(`Failed to load template "${t}": ${h.message}`, t, s);
272
- return this.metrics.totalErrors++, this.config.onError(d), this.retryQueue.delete(t), this.config.fallbackTemplate;
270
+ if (s < e) return this.retryQueue.set(t, s + 1), this.config.onWarn(`Retrying template "${t}" (attempt ${s + 1}/${e})`), await new Promise((d) => setTimeout(d, 100 * Math.pow(2, s))), this.loadTemplate(t, e);
271
+ const l = this.createError(`Failed to load template "${t}": ${h.message}`, t, s);
272
+ return this.metrics.totalErrors++, this.config.onError(l), this.retryQueue.delete(t), this.config.fallbackTemplate;
273
273
  }
274
274
  }
275
275
  async loadTemplates(t) {
@@ -596,7 +596,7 @@ class ht {
596
596
  left: e.left
597
597
  };
598
598
  t.edge = r.reduce(
599
- (h, d) => o[d] < o[h] ? d : h
599
+ (h, l) => o[l] < o[h] ? l : h
600
600
  );
601
601
  }
602
602
  }
@@ -619,7 +619,7 @@ class ht {
619
619
  this.stop(), this.callbacks.clear();
620
620
  }
621
621
  }
622
- const y = class y extends ht {
622
+ const b = class b extends ht {
623
623
  constructor(e, i) {
624
624
  super(e, i);
625
625
  a(this, "lastEdge", {});
@@ -627,7 +627,7 @@ const y = class y extends ht {
627
627
  this.onChange(this.onBoundaryChange.bind(this)), this.start();
628
628
  }
629
629
  static init(e, i) {
630
- return y.instance ?? (y.instance = new y(e, i));
630
+ return b.instance ?? (b.instance = new b(e, i));
631
631
  }
632
632
  changed({ edge: e, source: i, element: s }) {
633
633
  return e !== this.lastEdge.edge || i !== this.lastEdge.source || s !== this.lastEdge.element;
@@ -662,9 +662,9 @@ const y = class y extends ht {
662
662
  return this.lastEdge;
663
663
  }
664
664
  };
665
- a(y, "instance");
666
- let P = y;
667
- function dt(c = {}, t = []) {
665
+ a(b, "instance");
666
+ let P = b;
667
+ function lt(c = {}, t = []) {
668
668
  const e = P.init(c.edgeThreshold, t);
669
669
  return c.emitter && e.setEmitter(
670
670
  c.emitter instanceof X ? c.emitter : new X()
@@ -695,7 +695,7 @@ function G() {
695
695
  height: window.innerHeight || document.documentElement.clientHeight
696
696
  };
697
697
  }
698
- function lt() {
698
+ function dt() {
699
699
  return O.init();
700
700
  }
701
701
  const f = class f {
@@ -756,7 +756,7 @@ const f = class f {
756
756
  return (s = this.config) != null && s.constrainToParent && (e = this.constrainToParent(e)), e;
757
757
  }));
758
758
  // Automatic DOM updates with reactive effect
759
- a(this, "domUpdateEffect", k(() => {
759
+ a(this, "domUpdateEffect", x(() => {
760
760
  var e;
761
761
  const t = this.constrainedState.value;
762
762
  this.container && (this.container.style.left = `${t.x}px`, this.container.style.top = `${t.y}px`, this.container.style.width = `${t.width}px`, this.container.style.height = `${t.height}px`, (e = this.eventEmitter) == null || e.emit("stateChange", {
@@ -785,7 +785,7 @@ const f = class f {
785
785
  enabled: !0,
786
786
  directions: ["se"]
787
787
  }
788
- }, e), this.container = t, this.zIndexState = lt();
788
+ }, e), this.container = t, this.zIndexState = dt();
789
789
  const i = this.getCurrentState();
790
790
  this.reactiveState.x = i.x, this.reactiveState.y = i.y, this.reactiveState.width = i.width, this.reactiveState.height = i.height, this.reactiveState.mode = this.config.mode, this.reactiveState.draggingDirection = this.config.draggingDirection, this.eventEmitter = new Q({ enableMetrics: !0 }), this.pluginEventEmitter = new Q({ enableMetrics: !0 }), this.stateChangeStream = this.eventEmitter.stream("stateChange"), this.dragStream = this.eventEmitter.stream("drag"), this.resizeStream = this.eventEmitter.stream("resize"), this.startState = this.getState(), this.setupEventMiddleware(), this.initializeHandles(), this.bindEvents(), this.setupResizeObservers(), this.setupReactiveMonitoring();
791
791
  }
@@ -846,12 +846,12 @@ const f = class f {
846
846
  const i = t.contentRect, r = { ...this.getState() };
847
847
  let o = !1;
848
848
  if (e.width) {
849
- const h = this.getMaxWidthConstraint(), d = Math.min(i.width, h);
850
- Math.abs(r.width - d) > 1 && (r.width = d, o = !0);
849
+ const h = this.getMaxWidthConstraint(), l = Math.min(i.width, h);
850
+ Math.abs(r.width - l) > 1 && (r.width = l, o = !0);
851
851
  }
852
852
  if (e.height) {
853
- const h = this.getMaxHeightConstraint(), d = Math.min(i.height, h);
854
- Math.abs(r.height - d) > 1 && (r.height = d, o = !0);
853
+ const h = this.getMaxHeightConstraint(), l = Math.min(i.height, h);
854
+ Math.abs(r.height - l) > 1 && (r.height = l, o = !0);
855
855
  }
856
856
  o && (this.setState(r), this.eventEmitter.emit("autoAdjust", {
857
857
  type: "autoAdjust",
@@ -1065,11 +1065,11 @@ const f = class f {
1065
1065
  * Setup reactive monitoring for container metrics
1066
1066
  */
1067
1067
  setupReactiveMonitoring() {
1068
- const t = k(() => {
1068
+ const t = x(() => {
1069
1069
  const { state: i } = this.stateChangeStream;
1070
1070
  });
1071
1071
  this.reactiveEffects.push(t);
1072
- const e = k(() => {
1072
+ const e = x(() => {
1073
1073
  const i = this.eventEmitter.getMetrics();
1074
1074
  i.state.errorCount > 10 && console.warn("[ContainerManager] High error count in event system:", i.state.errorCount);
1075
1075
  });
@@ -1350,9 +1350,9 @@ const f = class f {
1350
1350
  const t = this.container.parentElement.getBoundingClientRect(), e = this.getState();
1351
1351
  if (t.width === 0 || t.height === 0)
1352
1352
  return;
1353
- const i = e.width, s = e.height, r = Math.min(i, t.width), o = Math.min(s, t.height), h = e.x, d = e.y, l = Math.min(h, t.width - r), S = Math.min(d, t.height - o);
1353
+ const i = e.width, s = e.height, r = Math.min(i, t.width), o = Math.min(s, t.height), h = e.x, l = e.y, d = Math.min(h, t.width - r), S = Math.min(l, t.height - o);
1354
1354
  this.setState({
1355
- x: l,
1355
+ x: d,
1356
1356
  y: S,
1357
1357
  width: r,
1358
1358
  height: o
@@ -1398,7 +1398,7 @@ const f = class f {
1398
1398
  };
1399
1399
  a(f, "MINWIDTH", 200), a(f, "MINHEIGHT", 45);
1400
1400
  let V = f;
1401
- const x = class x {
1401
+ const R = class R {
1402
1402
  constructor(t = {}) {
1403
1403
  // Plugin state
1404
1404
  a(this, "reactiveState", $({
@@ -1414,7 +1414,7 @@ const x = class x {
1414
1414
  this.reactiveState.snapStep = t.snapStep ?? 10, this.reactiveState.enabled = t.enabled ?? !0, this.onDragMove = this.onDragMove.bind(this), this.onDragEnd = this.onDragEnd.bind(this);
1415
1415
  }
1416
1416
  get pluginId() {
1417
- return x._pluginId;
1417
+ return R._pluginId;
1418
1418
  }
1419
1419
  /**
1420
1420
  * Install plugin on container manager instance with reactive state
@@ -1459,8 +1459,8 @@ const x = class x {
1459
1459
  );
1460
1460
  let s = e - this.startX, r = i - this.startY;
1461
1461
  if (this.reactiveState.enabled) {
1462
- const d = this.applySnapping(s, r);
1463
- s = d.deltaX, r = d.deltaY;
1462
+ const l = this.applySnapping(s, r);
1463
+ s = l.deltaX, r = l.deltaY;
1464
1464
  }
1465
1465
  const o = {
1466
1466
  x: this.startState.x + s,
@@ -1526,19 +1526,19 @@ const x = class x {
1526
1526
  this.reactiveState.isActive = !1, this.reactiveState.lastPosition = null;
1527
1527
  }
1528
1528
  };
1529
- a(x, "_pluginId", Symbol("SnappingPlugin"));
1530
- let U = x;
1531
- const R = class R {
1529
+ a(R, "_pluginId", Symbol("SnappingPlugin"));
1530
+ let U = R;
1531
+ const L = class L {
1532
1532
  constructor(t = {}) {
1533
1533
  a(this, "dockedContainers", /* @__PURE__ */ new Map());
1534
1534
  a(this, "occupiedEdges", /* @__PURE__ */ new Map());
1535
- a(this, "tracker", dt({ emitter: !0, edgeThreshold: 20 }));
1535
+ a(this, "tracker", lt({ emitter: !0, edgeThreshold: 20 }));
1536
1536
  a(this, "manager");
1537
1537
  a(this, "edgeThreshold");
1538
1538
  this.edgeThreshold = t.edgeThreshold ?? 30, this.occupiedEdges.set("top", null), this.occupiedEdges.set("bottom", null), this.occupiedEdges.set("left", null), this.occupiedEdges.set("right", null);
1539
1539
  }
1540
1540
  get pluginId() {
1541
- return R._pluginId;
1541
+ return L._pluginId;
1542
1542
  }
1543
1543
  install(t) {
1544
1544
  this.manager = t, this.tracker.addTarget(this.manager.getContainer()), this.tracker.on("edge:enter", (e) => {
@@ -1652,7 +1652,7 @@ const R = class R {
1652
1652
  bottom: s,
1653
1653
  left: i,
1654
1654
  right: r
1655
- }).filter(([d, l]) => l >= -this.edgeThreshold && l <= this.edgeThreshold).sort((d, l) => d[1] - l[1]);
1655
+ }).filter(([l, d]) => d >= -this.edgeThreshold && d <= this.edgeThreshold).sort((l, d) => l[1] - d[1]);
1656
1656
  return h.length > 0 ? h[0][0] : null;
1657
1657
  }
1658
1658
  /**
@@ -1753,13 +1753,13 @@ const R = class R {
1753
1753
  });
1754
1754
  }
1755
1755
  };
1756
- a(R, "_pluginId", Symbol("EdgeDockingPlugin"));
1757
- let j = R;
1756
+ a(L, "_pluginId", Symbol("EdgeDockingPlugin"));
1757
+ let j = L;
1758
1758
  const n = class n {
1759
1759
  constructor() {
1760
1760
  a(this, "manager");
1761
1761
  a(this, "containerId");
1762
- a(this, "isDemoContainer", !1);
1762
+ a(this, "storable", !0);
1763
1763
  // Эффект для автоматического сохранения при изменении состояния
1764
1764
  a(this, "autoSaveEffect");
1765
1765
  }
@@ -1773,22 +1773,22 @@ const n = class n {
1773
1773
  static get closedQueue() {
1774
1774
  return n.reactiveState.closedQueue;
1775
1775
  }
1776
- static get demoContainers() {
1777
- return n.reactiveState.demoContainers;
1776
+ static get storableContainers() {
1777
+ return n.reactiveState.storableContainers;
1778
1778
  }
1779
1779
  /**
1780
1780
  * Install plugin on container manager instance with reactive state management
1781
1781
  */
1782
1782
  install(t, e) {
1783
- if (this.manager = t, this.containerId = e == null ? void 0 : e.containerId, this.isDemoContainer = (e == null ? void 0 : e.isDemo) || !1, !this.containerId) {
1783
+ if (this.manager = t, this.containerId = e == null ? void 0 : e.containerId, this.storable = (e == null ? void 0 : e.storable) ?? !0, !this.containerId) {
1784
1784
  console.warn("[StatePersistencePlugin] containerId is required for state persistence");
1785
1785
  return;
1786
1786
  }
1787
1787
  n.containers.push({
1788
1788
  manager: t,
1789
1789
  containerId: this.containerId,
1790
- isDemo: this.isDemoContainer
1791
- }), this.isDemoContainer && n.registerDemoContainer(this.containerId), n.isGlobalEventsInitialized || (n.initializeGlobalEvents(), n.isGlobalEventsInitialized = !0), this.isDemoContainer && this.setupAutoSaveEffect(), this.bindContainerEvents();
1790
+ storable: this.storable
1791
+ }), this.storable && n.registerContainer(this.containerId), n.isGlobalEventsInitialized || (n.initializeGlobalEvents(), n.isGlobalEventsInitialized = !0), this.storable && this.setupAutoSaveEffect(), this.bindContainerEvents();
1792
1792
  }
1793
1793
  /**
1794
1794
  * Set up reactive auto-save effect for container state changes
@@ -1796,9 +1796,9 @@ const n = class n {
1796
1796
  setupAutoSaveEffect() {
1797
1797
  if (!this.manager || !this.containerId) return;
1798
1798
  const t = z(() => {
1799
- this.isDemoContainer && this.saveState();
1799
+ this.storable && this.saveState();
1800
1800
  }, 300);
1801
- this.autoSaveEffect = k(() => {
1801
+ this.autoSaveEffect = x(() => {
1802
1802
  this.manager.getState(), this.manager.getMode(), t();
1803
1803
  });
1804
1804
  }
@@ -1809,13 +1809,13 @@ const n = class n {
1809
1809
  bindContainerEvents() {
1810
1810
  this.manager && (this.manager.on("dragStart", () => {
1811
1811
  }), this.manager.on("dragEnd", () => {
1812
- this.isDemoContainer && this.saveState();
1812
+ this.storable && this.saveState();
1813
1813
  }), this.manager.on("resizeEnd", () => {
1814
- this.isDemoContainer && this.saveState();
1814
+ this.storable && this.saveState();
1815
1815
  }), this.manager.onPluginEvent("maximizeChanged", () => {
1816
- this.isDemoContainer && this.saveState();
1816
+ this.storable && this.saveState();
1817
1817
  }), this.manager.onPluginEvent("directionChanged", () => {
1818
- this.isDemoContainer && this.saveState();
1818
+ this.storable && this.saveState();
1819
1819
  }));
1820
1820
  }
1821
1821
  /**
@@ -1833,42 +1833,42 @@ const n = class n {
1833
1833
  /**
1834
1834
  * Register a container as a demo container
1835
1835
  */
1836
- static registerDemoContainer(t) {
1836
+ static registerContainer(t) {
1837
1837
  try {
1838
- n.demoContainers.includes(t) || (n.demoContainers.push(t), n.saveDemoContainersToStorage());
1838
+ n.storableContainers.includes(t) || (n.storableContainers.push(t), n.saveContainersToStorage());
1839
1839
  } catch (e) {
1840
- console.error("[StatePersistencePlugin] Failed to register demo container:", e);
1840
+ console.error("[StatePersistencePlugin] Failed to register container:", e);
1841
1841
  }
1842
1842
  }
1843
1843
  /**
1844
1844
  * Save demo containers to localStorage
1845
1845
  */
1846
- static saveDemoContainersToStorage() {
1846
+ static saveContainersToStorage() {
1847
1847
  try {
1848
1848
  localStorage.setItem(
1849
- n.DEMO_CONTAINERS_KEY,
1850
- JSON.stringify(n.demoContainers)
1849
+ n.STORABLE_CONTAINERS_KEY,
1850
+ JSON.stringify(n.storableContainers)
1851
1851
  );
1852
1852
  } catch (t) {
1853
- console.error("[StatePersistencePlugin] Failed to save demo containers:", t);
1853
+ console.error("[StatePersistencePlugin] Failed to save containers:", t);
1854
1854
  }
1855
1855
  }
1856
1856
  /**
1857
1857
  * Get list of all demo containers
1858
1858
  */
1859
- static getDemoContainers() {
1859
+ static getContainers() {
1860
1860
  try {
1861
- const t = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
1861
+ const t = localStorage.getItem(n.STORABLE_CONTAINERS_KEY);
1862
1862
  return t ? JSON.parse(t) : [];
1863
1863
  } catch (t) {
1864
- return console.error("[StatePersistencePlugin] Failed to parse demo containers:", t), [];
1864
+ return console.error("[StatePersistencePlugin] Failed to parse containers:", t), [];
1865
1865
  }
1866
1866
  }
1867
1867
  /**
1868
1868
  * Check if a container is a demo container
1869
1869
  */
1870
- static isDemoContainer(t) {
1871
- return n.getDemoContainers().includes(t);
1870
+ static isStorableContainer(t) {
1871
+ return n.getContainers().includes(t);
1872
1872
  }
1873
1873
  /**
1874
1874
  * Get all saved states from localStorage
@@ -1885,8 +1885,8 @@ const n = class n {
1885
1885
  * Add container ID to closed containers queue
1886
1886
  */
1887
1887
  static addToClosedQueue(t) {
1888
- if (!n.isDemoContainer(t)) {
1889
- console.log(`[StatePersistencePlugin] Skipping closed queue for non-demo container: ${t}`);
1888
+ if (!n.isStorableContainer(t)) {
1889
+ console.log(`[StatePersistencePlugin] Skipping closed queue for non-storable container: ${t}`);
1890
1890
  return;
1891
1891
  }
1892
1892
  if (!n.getContainerState(t)) {
@@ -1921,27 +1921,27 @@ const n = class n {
1921
1921
  }
1922
1922
  }
1923
1923
  saveState() {
1924
- !this.manager || !this.containerId || !this.isDemoContainer || D(() => {
1925
- var b;
1924
+ !this.manager || !this.containerId || !this.storable || k(() => {
1925
+ var w;
1926
1926
  n.reactiveState.isSaving = !0, n.reactiveState.pendingChanges = !0;
1927
- const t = this.manager.getContainer(), e = t.dataset.maximized === "true", i = this.manager.getState(), s = this.manager.getMode(), r = this.manager.getDirection(), o = t.dataset.containerType || "unknown", h = t.dataset.title, d = t.dataset.color, l = t.dataset.useSnapping === "true", S = (b = this.manager.config) == null ? void 0 : b.resize, E = t.parentElement, M = E && E !== document.body ? E.id || `parent-${this.containerId}` : void 0, w = {
1927
+ const t = this.manager.getContainer(), e = t.dataset.maximized === "true", i = this.manager.getState(), s = this.manager.getMode(), r = this.manager.getDirection(), o = t.dataset.containerType || "unknown", h = t.dataset.title, l = t.dataset.color, d = t.dataset.useSnapping === "true", S = (w = this.manager.config) == null ? void 0 : w.resize, E = t.parentElement, M = E && E !== document.body ? E.id || `parent-${this.containerId}` : void 0, y = {
1928
1928
  ...i,
1929
1929
  mode: s,
1930
1930
  draggingDirection: r,
1931
1931
  isMaximized: e,
1932
1932
  containerType: o,
1933
1933
  title: h,
1934
- color: d,
1935
- useSnapping: l,
1934
+ color: l,
1935
+ useSnapping: d,
1936
1936
  isClosed: !1,
1937
1937
  parentElementId: M,
1938
1938
  closedTimestamp: 0,
1939
1939
  resize: S,
1940
- isDemoContainer: !0
1940
+ storable: !0
1941
1941
  };
1942
- n.reactiveState.containerStates[this.containerId] = w;
1942
+ n.reactiveState.containerStates[this.containerId] = y;
1943
1943
  const p = n.getAllStates();
1944
- p[this.containerId] = w, localStorage.setItem(
1944
+ p[this.containerId] = y, localStorage.setItem(
1945
1945
  n.STORAGE_KEY,
1946
1946
  JSON.stringify(p)
1947
1947
  ), n.reactiveState.lastSaved = Date.now(), n.reactiveState.isSaving = !1;
@@ -1952,29 +1952,28 @@ const n = class n {
1952
1952
  */
1953
1953
  static saveContainerStateBeforeClose(t, e) {
1954
1954
  var Y, B, F;
1955
- const i = t.getState(), s = t.getMode();
1956
- if (!n.isDemoContainer(e)) {
1955
+ if (!n.isStorableContainer(e)) {
1957
1956
  n.containers = n.containers.filter(
1958
1957
  (T) => T.containerId !== e
1959
1958
  );
1960
1959
  return;
1961
1960
  }
1962
- const o = t.getContainer(), h = t.getDirection(), d = o.dataset.maximized === "true", l = o.dataset.containerType || "unknown", S = o.dataset.title, E = o.dataset.color, M = o.dataset.useSnapping === "true", w = (Y = t.config) == null ? void 0 : Y.resize, p = ((B = t.isEdgeDocked) == null ? void 0 : B.call(t)) || !1, b = ((F = t.getDockEdge) == null ? void 0 : F.call(t)) || null, C = o.parentElement, q = C && C !== document.body ? C.id || `parent-${e}` : void 0, A = {
1963
- ...i,
1964
- mode: s,
1961
+ const s = t.getState(), r = t.getMode(), o = t.getContainer(), h = t.getDirection(), l = o.dataset.maximized === "true", d = o.dataset.containerType || "unknown", S = o.dataset.title, E = o.dataset.color, M = o.dataset.useSnapping === "true", y = (Y = t.config) == null ? void 0 : Y.resize, p = ((B = t.isEdgeDocked) == null ? void 0 : B.call(t)) || !1, w = ((F = t.getDockEdge) == null ? void 0 : F.call(t)) || null, C = o.parentElement, q = C && C !== document.body ? C.id || `parent-${e}` : void 0, A = {
1962
+ ...s,
1963
+ mode: r,
1965
1964
  draggingDirection: h,
1966
- isMaximized: d,
1965
+ isMaximized: l,
1967
1966
  isEdgeDocked: p,
1968
- dockEdge: b || void 0,
1969
- containerType: l,
1967
+ dockEdge: w || void 0,
1968
+ containerType: d,
1970
1969
  title: S,
1971
1970
  color: E,
1972
1971
  useSnapping: M,
1973
1972
  isClosed: !0,
1974
1973
  parentElementId: q,
1975
1974
  closedTimestamp: Date.now(),
1976
- resize: w,
1977
- isDemoContainer: !0
1975
+ resize: y,
1976
+ storable: !0
1978
1977
  }, N = n.getAllStates();
1979
1978
  N[e] = A;
1980
1979
  try {
@@ -1993,25 +1992,25 @@ const n = class n {
1993
1992
  * Save all containers state (for global events) - including closed ones
1994
1993
  */
1995
1994
  static saveAllContainers() {
1996
- D(() => {
1995
+ k(() => {
1997
1996
  const t = n.getAllStates();
1998
- n.containers.filter(({ isDemo: e }) => e).forEach(({ manager: e, containerId: i }) => {
1997
+ n.containers.filter((e) => !("storable" in e && e.storable === !1)).forEach(({ manager: e, containerId: i }) => {
1999
1998
  var C;
2000
- const s = e.getState(), r = e.getMode(), o = e.getContainer(), h = e.getDirection(), d = o.dataset.maximized === "true", l = o.dataset.containerType || "unknown", S = o.dataset.title, E = o.dataset.color, M = o.dataset.useSnapping === "true", w = (C = e.config) == null ? void 0 : C.resize, p = o.parentElement, b = p && p !== document.body ? p.id || `parent-${i}` : void 0;
1999
+ const s = e.getState(), r = e.getMode(), o = e.getContainer(), h = e.getDirection(), l = o.dataset.maximized === "true", d = o.dataset.containerType || "unknown", S = o.dataset.title, E = o.dataset.color, M = o.dataset.useSnapping === "true", y = (C = e.config) == null ? void 0 : C.resize, p = o.parentElement, w = p && p !== document.body ? p.id || `parent-${i}` : void 0;
2001
2000
  t[i] = {
2002
2001
  ...s,
2003
2002
  mode: r,
2004
2003
  draggingDirection: h,
2005
- isMaximized: d,
2006
- containerType: l,
2004
+ isMaximized: l,
2005
+ containerType: d,
2007
2006
  title: S,
2008
2007
  color: E,
2009
2008
  useSnapping: M,
2010
2009
  isClosed: !1,
2011
- parentElementId: b,
2010
+ parentElementId: w,
2012
2011
  closedTimestamp: 0,
2013
- resize: w,
2014
- isDemoContainer: !0
2012
+ resize: y,
2013
+ storable: !0
2015
2014
  };
2016
2015
  }), n.reactiveState.containerStates = t, localStorage.setItem(
2017
2016
  n.STORAGE_KEY,
@@ -2087,7 +2086,7 @@ const n = class n {
2087
2086
  isMaximized: !1,
2088
2087
  containerType: "unknown",
2089
2088
  isClosed: !1,
2090
- isDemoContainer: n.isDemoContainer(t),
2089
+ storable: n.isStorableContainer(t),
2091
2090
  ...e
2092
2091
  };
2093
2092
  i[t] = r, localStorage.setItem(
@@ -2103,18 +2102,18 @@ const n = class n {
2103
2102
  * Clear all saved states from localStorage
2104
2103
  */
2105
2104
  static clearStorage() {
2106
- D(() => {
2107
- n.reactiveState.containerStates = {}, n.closedQueue.length = 0, n.demoContainers.length = 0, n.reactiveState.isSaving = !1, n.reactiveState.lastSaved = null, n.reactiveState.pendingChanges = !1;
2108
- }), localStorage.removeItem(n.STORAGE_KEY), localStorage.removeItem(n.CLOSED_QUEUE_KEY), localStorage.removeItem(n.DEMO_CONTAINERS_KEY), n.containers = [];
2105
+ k(() => {
2106
+ n.reactiveState.containerStates = {}, n.closedQueue.length = 0, n.storableContainers.length = 0, n.reactiveState.isSaving = !1, n.reactiveState.lastSaved = null, n.reactiveState.pendingChanges = !1;
2107
+ }), localStorage.removeItem(n.STORAGE_KEY), localStorage.removeItem(n.CLOSED_QUEUE_KEY), localStorage.removeItem(n.STORABLE_CONTAINERS_KEY), n.containers = [];
2109
2108
  }
2110
2109
  /**
2111
2110
  * Initialize reactive state from localStorage on plugin load
2112
2111
  */
2113
2112
  static initializeReactiveState() {
2114
2113
  try {
2115
- const t = n.getAllStates(), e = n.getClosedQueue(), i = n.getDemoContainers();
2116
- D(() => {
2117
- n.reactiveState.containerStates = t, n.closedQueue.length = 0, n.closedQueue.push(...e), n.demoContainers.length = 0, n.demoContainers.push(...i);
2114
+ const t = n.getAllStates(), e = n.getClosedQueue(), i = n.getContainers();
2115
+ k(() => {
2116
+ n.reactiveState.containerStates = t, n.closedQueue.length = 0, n.closedQueue.push(...e), n.storableContainers.length = 0, n.storableContainers.push(...i);
2118
2117
  });
2119
2118
  } catch (t) {
2120
2119
  console.error("[StatePersistencePlugin] Failed to initialize reactive state:", t);
@@ -2126,7 +2125,7 @@ const n = class n {
2126
2125
  static getMetrics() {
2127
2126
  return {
2128
2127
  totalContainers: Object.keys(n.containerStates).length,
2129
- demoContainers: n.demoContainers.length,
2128
+ demoContainers: n.storableContainers.length,
2130
2129
  closedContainers: n.closedQueue.length,
2131
2130
  lastSaved: n.reactiveState.lastSaved,
2132
2131
  isSaving: n.reactiveState.isSaving
@@ -2144,15 +2143,15 @@ const n = class n {
2144
2143
  console.log(`[StatePersistencePlugin] Number of states: ${Object.keys(s).length}`), console.log("[StatePersistencePlugin] State keys:", Object.keys(s));
2145
2144
  for (const [r, o] of Object.entries(s))
2146
2145
  console.log(`[StatePersistencePlugin] State ${r}:`, {
2147
- isDemoContainer: o.isDemoContainer,
2146
+ storable: o.storable,
2148
2147
  isClosed: o.isClosed,
2149
2148
  title: o.title
2150
2149
  });
2151
2150
  }
2152
2151
  const e = localStorage.getItem(n.CLOSED_QUEUE_KEY);
2153
2152
  console.log("[StatePersistencePlugin] Closed queue:", e ? JSON.parse(e) : []);
2154
- const i = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
2155
- console.log("[StatePersistencePlugin] Demo containers:", i ? JSON.parse(i) : []);
2153
+ const i = localStorage.getItem(n.STORABLE_CONTAINERS_KEY);
2154
+ console.log("[StatePersistencePlugin] Storable containers:", i ? JSON.parse(i) : []);
2156
2155
  } catch (t) {
2157
2156
  console.error("[StatePersistencePlugin] Debug error:", t);
2158
2157
  }
@@ -2167,25 +2166,25 @@ const n = class n {
2167
2166
  ));
2168
2167
  }
2169
2168
  };
2170
- a(n, "_pluginId", Symbol("StatePersistencePlugin")), a(n, "STORAGE_KEY", "containerManagerState"), a(n, "CLOSED_QUEUE_KEY", "containerManagerClosedQueue"), a(n, "DEMO_CONTAINERS_KEY", "containerManagerDemoContainers"), // Статическое реактивное состояние для всех плагинов
2169
+ a(n, "_pluginId", Symbol("StatePersistencePlugin")), a(n, "STORAGE_KEY", "containerManagerState"), a(n, "CLOSED_QUEUE_KEY", "containerManagerClosedQueue"), a(n, "STORABLE_CONTAINERS_KEY", "containerManagerStorableContainers"), // Статическое реактивное состояние для всех плагинов
2171
2170
  a(n, "reactiveState", $({
2172
2171
  isSaving: !1,
2173
2172
  lastSaved: null,
2174
2173
  pendingChanges: !1,
2175
2174
  containerStates: {},
2176
2175
  closedQueue: [],
2177
- demoContainers: []
2176
+ storableContainers: []
2178
2177
  })), a(n, "isGlobalEventsInitialized", !1), a(n, "containers", []);
2179
2178
  let H = n;
2180
2179
  H.initializeReactiveState();
2181
- const L = class L {
2180
+ const D = class D {
2182
2181
  constructor() {
2183
2182
  a(this, "manager");
2184
2183
  a(this, "containerName", "");
2185
2184
  a(this, "notificationSystem", null);
2186
2185
  }
2187
2186
  get pluginId() {
2188
- return L._pluginId;
2187
+ return D._pluginId;
2189
2188
  }
2190
2189
  /**
2191
2190
  * Install plugin on container manager instance
@@ -2276,8 +2275,8 @@ const L = class L {
2276
2275
  }
2277
2276
  }
2278
2277
  };
2279
- a(L, "_pluginId", Symbol("LoggingPlugin"));
2280
- let K = L;
2278
+ a(D, "_pluginId", Symbol("LoggingPlugin"));
2279
+ let K = D;
2281
2280
  export {
2282
2281
  pt as ContainerInitializer,
2283
2282
  V as ContainerManager,
@@ -2289,7 +2288,7 @@ export {
2289
2288
  H as StatePersistencePlugin,
2290
2289
  ft as StatsManager,
2291
2290
  J as TemplateLoader,
2292
- lt as getState,
2291
+ dt as getState,
2293
2292
  Et as getTemplateLoader,
2294
2293
  St as initializeTemplateSystem
2295
2294
  };