@alekstar79/draggable-resizable-container 1.0.3 → 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,11 +1,11 @@
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
- var r = (c, t, e) => _(c, typeof t != "symbol" ? t + "" : t, e);
4
- import Q, { reactive as I, computed as tt, effect as x, batch as T } from "@alekstar79/reactive-event-system";
5
- import { clamp as f, deepMerge as et, debounce as z } from "@alekstar79/utility";
3
+ var a = (c, t, e) => _(c, typeof t != "symbol" ? t + "" : t, e);
4
+ import Q, { reactive as $, computed as tt, effect as x, batch as k } from "@alekstar79/reactive-event-system";
5
+ import { clamp as v, deepMerge as et, debounce as z } from "@alekstar79/utility";
6
6
  class it {
7
7
  constructor(t) {
8
- r(this, "container");
8
+ a(this, "container");
9
9
  this.container = t || this.createContainer();
10
10
  }
11
11
  /**
@@ -24,8 +24,8 @@ class it {
24
24
  show(t, e = "info") {
25
25
  const i = document.createElement("li"), s = this.removeToast.bind(this, i);
26
26
  i.innerHTML = this.getToastHTML(t, e), i.className = `toast ${e}`, i.timeoutId = window.setTimeout(s, 4e3);
27
- const a = i.querySelector(".icon");
28
- a && a.addEventListener("click", s), this.container.appendChild(i);
27
+ const r = i.querySelector(".icon");
28
+ r && r.addEventListener("click", s), this.container.appendChild(i);
29
29
  }
30
30
  /**
31
31
  * Generate toast HTML based on type
@@ -65,14 +65,14 @@ class pt {
65
65
  /**
66
66
  * Create container element with proper initialization
67
67
  */
68
- static createContainerElement(t, e, i, s, a) {
68
+ static createContainerElement(t, e, i, s, r) {
69
69
  const o = document.createElement("div");
70
- return o.className = "container advanced-container new", o.style.position = "absolute", o.style.width = `${t}px`, o.style.height = `${e}px`, i !== void 0 && (o.style.left = `${i}px`), s !== void 0 && (o.style.top = `${s}px`), a && (o.style.borderColor = a), o;
70
+ return o.className = "container advanced-container new", o.style.position = "absolute", o.style.width = `${t}px`, o.style.height = `${e}px`, i !== void 0 && (o.style.left = `${i}px`), s !== void 0 && (o.style.top = `${s}px`), r && (o.style.borderColor = r), o;
71
71
  }
72
72
  }
73
- class ft {
73
+ class vt {
74
74
  constructor(t) {
75
- r(this, "templateLoader");
75
+ a(this, "templateLoader");
76
76
  this.templateLoader = t;
77
77
  }
78
78
  /**
@@ -91,8 +91,8 @@ class ft {
91
91
  else if (t.template)
92
92
  try {
93
93
  s.innerHTML = await this.templateLoader.loadTemplate(t.template);
94
- } catch (a) {
95
- console.error(`[ContentCreator] Failed to load template: ${t.template}`, a), s.innerHTML = `<div class="template-error">Failed to load template: ${t.template}</div>`;
94
+ } catch (r) {
95
+ console.error(`[ContentCreator] Failed to load template: ${t.template}`, r), s.innerHTML = `<div class="template-error">Failed to load template: ${t.template}</div>`;
96
96
  }
97
97
  return s;
98
98
  } catch (i) {
@@ -106,8 +106,84 @@ class ft {
106
106
  this.templateLoader = t;
107
107
  }
108
108
  }
109
+ class ft {
110
+ constructor() {
111
+ a(this, "globalStatsElement", null);
112
+ }
113
+ /**
114
+ * Initialize stats manager
115
+ */
116
+ initialize(t) {
117
+ this.globalStatsElement = t;
118
+ }
119
+ /**
120
+ * Show container-specific statistics
121
+ */
122
+ showContainerStats(t) {
123
+ this.globalStatsElement && this.updateStatsPanel(this.generateContainerStatsHTML(t));
124
+ }
125
+ /**
126
+ * Show global statistics
127
+ */
128
+ showGlobalStats(t) {
129
+ this.globalStatsElement && this.updateStatsPanel(this.generateGlobalStatsHTML(t));
130
+ }
131
+ /**
132
+ * Generate HTML for container statistics
133
+ */
134
+ generateContainerStatsHTML(t) {
135
+ const e = t.hasSnapping && t.step !== void 0 ? `<div class="stat-item">
136
+ <span class="stat-label">Step:</span>
137
+ <span class="stat-value">${t.step}</span>
138
+ </div>` : "";
139
+ return `
140
+ <h4>Block Stats</h4>
141
+ <div class="stat-item">
142
+ <span class="stat-label">Active Block:</span>
143
+ <span class="stat-value">${t.activeBlock}</span>
144
+ </div>
145
+ <div class="stat-item">
146
+ <span class="stat-label">Lock:</span>
147
+ <span class="stat-value">${t.lock}</span>
148
+ </div>
149
+ <div class="stat-item">
150
+ <span class="stat-label">Direction:</span>
151
+ <span class="stat-value">${t.direction}</span>
152
+ </div>
153
+ ${e}`;
154
+ }
155
+ /**
156
+ * Generate HTML for global statistics
157
+ */
158
+ generateGlobalStatsHTML(t) {
159
+ return `
160
+ <h4>Global Stats</h4>
161
+ <div class="stat-item">
162
+ <span class="stat-label">Containers:</span>
163
+ <span class="stat-value">${t.containerCount}</span>
164
+ </div>
165
+ <div class="stat-item">
166
+ <span class="stat-label">Content Types:</span>
167
+ <span class="stat-value">${t.contentTypes}</span>
168
+ </div>
169
+ <div class="stat-item">
170
+ <span class="stat-label">Pinned Mode:</span>
171
+ <span class="stat-value">${t.pinnedMode}</span>
172
+ </div>
173
+ <div class="stat-item">
174
+ <span class="stat-label">With Snapping:</span>
175
+ <span class="stat-value">${t.snappingCount}</span>
176
+ </div>`;
177
+ }
178
+ /**
179
+ * Update stats panel with new HTML content
180
+ */
181
+ updateStatsPanel(t) {
182
+ this.globalStatsElement && (this.globalStatsElement.innerHTML = t);
183
+ }
184
+ }
109
185
  var st = Object.defineProperty, nt = (c, t, e) => t in c ? st(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e, m = (c, t, e) => nt(c, typeof t != "symbol" ? t + "" : t, e);
110
- class $ {
186
+ class I {
111
187
  constructor() {
112
188
  m(this, "templates", /* @__PURE__ */ new Map()), m(this, "lastUpdated", /* @__PURE__ */ new Map());
113
189
  }
@@ -138,7 +214,7 @@ class $ {
138
214
  return (e = this.templates.get(t)) == null ? void 0 : e.metadata;
139
215
  }
140
216
  }
141
- class rt {
217
+ class at {
142
218
  constructor(t = 36e5) {
143
219
  m(this, "cache", /* @__PURE__ */ new Map()), m(this, "ttl"), this.ttl = t;
144
220
  }
@@ -161,7 +237,7 @@ class rt {
161
237
  }
162
238
  class J {
163
239
  constructor(t, e = {}) {
164
- m(this, "cache"), m(this, "config"), m(this, "metrics"), m(this, "retryQueue", /* @__PURE__ */ new Map()), m(this, "registry"), this.registry = t ?? new $(), this.cache = new rt(e == null ? void 0 : e.cacheTTL), this.config = this.normalizeConfig(e), this.metrics = { totalLoads: 0, totalHits: 0, totalMisses: 0, totalErrors: 0, averageLoadTime: 0, cacheHitRate: 0 };
240
+ m(this, "cache"), m(this, "config"), m(this, "metrics"), m(this, "retryQueue", /* @__PURE__ */ new Map()), m(this, "registry"), this.registry = t ?? new I(), this.cache = new at(e == null ? void 0 : e.cacheTTL), this.config = this.normalizeConfig(e), this.metrics = { totalLoads: 0, totalHits: 0, totalMisses: 0, totalErrors: 0, averageLoadTime: 0, cacheHitRate: 0 };
165
241
  }
166
242
  normalizeConfig(t = {}) {
167
243
  var i;
@@ -177,13 +253,13 @@ class J {
177
253
  if (o) return this.metrics.totalHits++, this.updateCacheHitRate(), o;
178
254
  }
179
255
  this.metrics.totalMisses++;
180
- const a = this.registry.get(t);
181
- if (!a) {
256
+ const r = this.registry.get(t);
257
+ if (!r) {
182
258
  const o = this.createError(`Template "${t}" not found. Available: ${this.registry.list().join(", ")}`, t, s);
183
259
  return this.metrics.totalErrors++, this.config.onError(o), this.config.fallbackTemplate;
184
260
  }
185
261
  try {
186
- let o = typeof a.source == "function" ? await a.source() : a.source;
262
+ let o = typeof r.source == "function" ? await r.source() : r.source;
187
263
  if (typeof o != "string") {
188
264
  const h = this.createError("Template source must return a string, got " + typeof o, t, s);
189
265
  return this.metrics.totalErrors++, this.config.onError(h), this.config.fallbackTemplate;
@@ -191,9 +267,9 @@ class J {
191
267
  return this.config.cache && this.cache.set(t, o), this.retryQueue.delete(t), this.recordLoadTime(i), o;
192
268
  } catch (o) {
193
269
  const h = o instanceof Error ? o : new Error(String(o));
194
- 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);
195
- const d = this.createError(`Failed to load template "${t}": ${h.message}`, t, s);
196
- 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;
197
273
  }
198
274
  }
199
275
  async loadTemplates(t) {
@@ -234,8 +310,8 @@ class J {
234
310
  }
235
311
  }
236
312
  let u;
237
- async function at(c = []) {
238
- const t = new $();
313
+ async function rt(c = []) {
314
+ const t = new I();
239
315
  let e = {};
240
316
  try {
241
317
  e = /* @__PURE__ */ Object.assign({
@@ -244,14 +320,14 @@ async function at(c = []) {
244
320
  "../demo/templates/tasks.html": () => import("./tasks-dygJ8dHT.js").then((s) => s.default)
245
321
  });
246
322
  const i = {};
247
- Object.entries(e).forEach(([s, a]) => {
323
+ Object.entries(e).forEach(([s, r]) => {
248
324
  var h;
249
325
  const o = (h = s.split("/").pop()) == null ? void 0 : h.replace(/\.html$/, "");
250
- o && (i[o] = async () => typeof a == "function" ? await a() : String(a));
326
+ o && (i[o] = async () => typeof r == "function" ? await r() : String(r));
251
327
  }), await t.registerBulk(i);
252
328
  } catch (i) {
253
- console.error("[TemplateLoader] Failed to load templates:", i), c.forEach(({ name: s, source: a }) => {
254
- t.register({ name: s, source: a });
329
+ console.error("[TemplateLoader] Failed to load templates:", i), c.forEach(({ name: s, source: r }) => {
330
+ t.register({ name: s, source: r });
255
331
  });
256
332
  }
257
333
  return new J(t, {
@@ -265,7 +341,7 @@ async function at(c = []) {
265
341
  });
266
342
  }
267
343
  function ot() {
268
- const c = new $();
344
+ const c = new I();
269
345
  return new J(c, {
270
346
  environment: "production",
271
347
  cache: !0,
@@ -277,9 +353,9 @@ function ot() {
277
353
  }
278
354
  });
279
355
  }
280
- async function vt() {
356
+ async function St() {
281
357
  return u || (// @ts-ignore - Vite environment variable
282
- typeof process < "u" && process.env && process.env.NODE_ENV === "development" ? u = await at() : (u = ot(), u.registry.register({
358
+ typeof process < "u" && process.env && process.env.NODE_ENV === "development" ? u = await rt() : (u = ot(), u.registry.register({
283
359
  name: "media",
284
360
  source: async () => (await fetch("./templates/media.html")).text(),
285
361
  metadata: {
@@ -297,7 +373,7 @@ async function vt() {
297
373
  }
298
374
  })), u);
299
375
  }
300
- function St() {
376
+ function Et() {
301
377
  if (!u)
302
378
  throw new Error("Template system not initialized. Call initializeTemplateSystem() first.");
303
379
  return u;
@@ -307,19 +383,19 @@ function ct(c, [t, e]) {
307
383
  }
308
384
  class W {
309
385
  constructor(t) {
310
- r(this, "source", "cursor");
311
- r(this, "element", null);
312
- r(this, "top", !1);
313
- r(this, "right", !1);
314
- r(this, "bottom", !1);
315
- r(this, "left", !1);
316
- r(this, "edge", null);
386
+ a(this, "source", "cursor");
387
+ a(this, "element", null);
388
+ a(this, "top", !1);
389
+ a(this, "right", !1);
390
+ a(this, "bottom", !1);
391
+ a(this, "left", !1);
392
+ a(this, "edge", null);
317
393
  Object.assign(this, t);
318
394
  }
319
395
  }
320
396
  class X {
321
397
  constructor() {
322
- r(this, "listeners", {});
398
+ a(this, "listeners", {});
323
399
  }
324
400
  on(t, e) {
325
401
  return this.listeners[t] || (this.listeners[t] = /* @__PURE__ */ new Set()), this.listeners[t].add(e), () => {
@@ -332,8 +408,8 @@ class X {
332
408
  (i = this.listeners[t]) == null || i.forEach((s) => {
333
409
  try {
334
410
  s(e);
335
- } catch (a) {
336
- console.error(`Error in event listener for ${String(t)}:`, a);
411
+ } catch (r) {
412
+ console.error(`Error in event listener for ${String(t)}:`, r);
337
413
  }
338
414
  });
339
415
  }
@@ -347,15 +423,15 @@ class X {
347
423
  }
348
424
  class ht {
349
425
  constructor(t = 50, e, i = null) {
350
- r(this, "root");
351
- r(this, "edgeThreshold");
352
- r(this, "targets", /* @__PURE__ */ new Set());
353
- r(this, "currentEdges", /* @__PURE__ */ new Map());
354
- r(this, "rafId", null);
355
- r(this, "isActive", !1);
356
- r(this, "callbacks", /* @__PURE__ */ new Set());
357
- r(this, "currentMousePos", { x: 0, y: 0 });
358
- r(this, "currentCursorEdge", {
426
+ a(this, "root");
427
+ a(this, "edgeThreshold");
428
+ a(this, "targets", /* @__PURE__ */ new Set());
429
+ a(this, "currentEdges", /* @__PURE__ */ new Map());
430
+ a(this, "rafId", null);
431
+ a(this, "isActive", !1);
432
+ a(this, "callbacks", /* @__PURE__ */ new Set());
433
+ a(this, "currentMousePos", { x: 0, y: 0 });
434
+ a(this, "currentCursorEdge", {
359
435
  top: !1,
360
436
  right: !1,
361
437
  bottom: !1,
@@ -475,14 +551,14 @@ class ht {
475
551
  * Check the boundaries of an element
476
552
  */
477
553
  checkElementBoundaries(t) {
478
- const { width: e, height: i } = this.getViewportSize(), s = this.getRelativeRect(t), a = {
554
+ const { width: e, height: i } = this.getViewportSize(), s = this.getRelativeRect(t), r = {
479
555
  top: s.top < this.edgeThreshold,
480
556
  right: s.right > e - this.edgeThreshold,
481
557
  bottom: s.bottom > i - this.edgeThreshold,
482
558
  left: s.left < this.edgeThreshold,
483
559
  edge: null
484
560
  };
485
- return this.determineEdge(a, s, e, i), a;
561
+ return this.determineEdge(r, s, e, i), r;
486
562
  }
487
563
  /**
488
564
  * Check the boundaries of a cursor
@@ -507,11 +583,11 @@ class ht {
507
583
  * Determine a priority edge-side (or several)
508
584
  */
509
585
  determineEdge(t, e, i, s) {
510
- const a = [];
511
- if (t.top && a.push("top"), t.right && a.push("right"), t.bottom && a.push("bottom"), t.left && a.push("left"), a.length === 0)
586
+ const r = [];
587
+ if (t.top && r.push("top"), t.right && r.push("right"), t.bottom && r.push("bottom"), t.left && r.push("left"), r.length === 0)
512
588
  t.edge = null;
513
- else if (a.length === 1)
514
- t.edge = a[0];
589
+ else if (r.length === 1)
590
+ t.edge = r[0];
515
591
  else {
516
592
  const o = {
517
593
  top: e.top,
@@ -519,8 +595,8 @@ class ht {
519
595
  bottom: s - e.bottom,
520
596
  left: e.left
521
597
  };
522
- t.edge = a.reduce(
523
- (h, d) => o[d] < o[h] ? d : h
598
+ t.edge = r.reduce(
599
+ (h, l) => o[l] < o[h] ? l : h
524
600
  );
525
601
  }
526
602
  }
@@ -543,15 +619,15 @@ class ht {
543
619
  this.stop(), this.callbacks.clear();
544
620
  }
545
621
  }
546
- const y = class y extends ht {
622
+ const b = class b extends ht {
547
623
  constructor(e, i) {
548
624
  super(e, i);
549
- r(this, "lastEdge", {});
550
- r(this, "emitter", null);
625
+ a(this, "lastEdge", {});
626
+ a(this, "emitter", null);
551
627
  this.onChange(this.onBoundaryChange.bind(this)), this.start();
552
628
  }
553
629
  static init(e, i) {
554
- return y.instance ?? (y.instance = new y(e, i));
630
+ return b.instance ?? (b.instance = new b(e, i));
555
631
  }
556
632
  changed({ edge: e, source: i, element: s }) {
557
633
  return e !== this.lastEdge.edge || i !== this.lastEdge.source || s !== this.lastEdge.element;
@@ -586,9 +662,9 @@ const y = class y extends ht {
586
662
  return this.lastEdge;
587
663
  }
588
664
  };
589
- r(y, "instance");
590
- let P = y;
591
- function dt(c = {}, t = []) {
665
+ a(b, "instance");
666
+ let P = b;
667
+ function lt(c = {}, t = []) {
592
668
  const e = P.init(c.edgeThreshold, t);
593
669
  return c.emitter && e.setEmitter(
594
670
  c.emitter instanceof X ? c.emitter : new X()
@@ -596,7 +672,7 @@ function dt(c = {}, t = []) {
596
672
  }
597
673
  const g = class g {
598
674
  constructor() {
599
- r(this, "draggable", []);
675
+ a(this, "draggable", []);
600
676
  }
601
677
  zIndex(t) {
602
678
  return `${g.highestZIndex + this.draggable.findIndex((e) => e === t)}`;
@@ -611,18 +687,18 @@ const g = class g {
611
687
  return this.draggable.sort((e, i) => e === t ? 1 : i === t ? -1 : 0), this;
612
688
  }
613
689
  };
614
- r(g, "inatance"), r(g, "highestZIndex", 1e3), r(g, "init", () => g.inatance ?? (g.inatance = new g()));
690
+ a(g, "inatance"), a(g, "highestZIndex", 1e3), a(g, "init", () => g.inatance ?? (g.inatance = new g()));
615
691
  let O = g;
616
- function V() {
692
+ function G() {
617
693
  return {
618
694
  width: window.innerWidth || document.documentElement.clientWidth,
619
695
  height: window.innerHeight || document.documentElement.clientHeight
620
696
  };
621
697
  }
622
- function lt() {
698
+ function dt() {
623
699
  return O.init();
624
700
  }
625
- const v = class v {
701
+ const f = class f {
626
702
  /**
627
703
  * Create a new container manager instance with reactive state management
628
704
  * @param container - HTML element to manage
@@ -630,27 +706,27 @@ const v = class v {
630
706
  */
631
707
  constructor(t, e = {}) {
632
708
  // Streams for reactive event handling
633
- r(this, "dragStream");
634
- r(this, "resizeStream");
635
- r(this, "stateChangeStream");
636
- r(this, "eventEmitter");
637
- r(this, "pluginEventEmitter");
638
- r(this, "config");
639
- r(this, "container");
640
- r(this, "dragHandle");
641
- r(this, "resizeHandles", /* @__PURE__ */ new Map());
642
- r(this, "installedPlugins", /* @__PURE__ */ new Set());
643
- r(this, "reactiveEffects", []);
644
- r(this, "isDragging", !1);
645
- r(this, "isResizing", !1);
646
- r(this, "resizeDirection", null);
647
- r(this, "startX", 0);
648
- r(this, "startY", 0);
649
- r(this, "startState");
650
- r(this, "resizeObserver", null);
651
- r(this, "parentResizeObserver", null);
652
- r(this, "zIndexState");
653
- r(this, "reactiveState", I({
709
+ a(this, "dragStream");
710
+ a(this, "resizeStream");
711
+ a(this, "stateChangeStream");
712
+ a(this, "eventEmitter");
713
+ a(this, "pluginEventEmitter");
714
+ a(this, "config");
715
+ a(this, "container");
716
+ a(this, "dragHandle");
717
+ a(this, "resizeHandles", /* @__PURE__ */ new Map());
718
+ a(this, "installedPlugins", /* @__PURE__ */ new Set());
719
+ a(this, "reactiveEffects", []);
720
+ a(this, "isDragging", !1);
721
+ a(this, "isResizing", !1);
722
+ a(this, "resizeDirection", null);
723
+ a(this, "startX", 0);
724
+ a(this, "startY", 0);
725
+ a(this, "startState");
726
+ a(this, "resizeObserver", null);
727
+ a(this, "parentResizeObserver", null);
728
+ a(this, "zIndexState");
729
+ a(this, "reactiveState", $({
654
730
  x: 0,
655
731
  y: 0,
656
732
  width: 0,
@@ -659,28 +735,28 @@ const v = class v {
659
735
  draggingDirection: "all"
660
736
  }));
661
737
  // Computed state with applied constraints
662
- r(this, "constrainedState", tt(() => {
738
+ a(this, "constrainedState", tt(() => {
663
739
  var s;
664
740
  const t = this.reactiveState;
665
741
  if (!this.config) return { ...t };
666
742
  let e = { ...t };
667
743
  const { boundaries: i } = this.config;
668
- if (e.width = f(
744
+ if (e.width = v(
669
745
  t.width,
670
- i.minWidth || v.MINWIDTH,
746
+ i.minWidth || f.MINWIDTH,
671
747
  i.maxWidth || 1 / 0
672
- ), e.height = f(
748
+ ), e.height = v(
673
749
  t.height,
674
- i.minHeight || v.MINHEIGHT,
750
+ i.minHeight || f.MINHEIGHT,
675
751
  i.maxHeight || 1 / 0
676
752
  ), this.shouldConstrainToViewport()) {
677
- const a = V();
678
- e.x = f(t.x, 0, a.width - e.width), e.y = f(t.y, 0, a.height - e.height);
753
+ const r = G();
754
+ e.x = v(t.x, 0, r.width - e.width), e.y = v(t.y, 0, r.height - e.height);
679
755
  }
680
756
  return (s = this.config) != null && s.constrainToParent && (e = this.constrainToParent(e)), e;
681
757
  }));
682
758
  // Automatic DOM updates with reactive effect
683
- r(this, "domUpdateEffect", x(() => {
759
+ a(this, "domUpdateEffect", x(() => {
684
760
  var e;
685
761
  const t = this.constrainedState.value;
686
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", {
@@ -697,8 +773,8 @@ const v = class v {
697
773
  draggingDirection: "all",
698
774
  constrainToParent: !1,
699
775
  boundaries: {
700
- minWidth: v.MINWIDTH,
701
- minHeight: v.MINHEIGHT
776
+ minWidth: f.MINWIDTH,
777
+ minHeight: f.MINHEIGHT
702
778
  },
703
779
  autoAdjust: {
704
780
  enabled: !1,
@@ -709,7 +785,7 @@ const v = class v {
709
785
  enabled: !0,
710
786
  directions: ["se"]
711
787
  }
712
- }, e), this.container = t, this.zIndexState = lt();
788
+ }, e), this.container = t, this.zIndexState = dt();
713
789
  const i = this.getCurrentState();
714
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();
715
791
  }
@@ -742,7 +818,7 @@ const v = class v {
742
818
  */
743
819
  handleViewportResize() {
744
820
  if (!this.shouldConstrainToViewport()) return;
745
- const t = V(), i = { ...this.getState() };
821
+ const t = G(), i = { ...this.getState() };
746
822
  let s = !1;
747
823
  i.x + i.width > t.width && (i.x = Math.max(0, t.width - i.width), s = !0), i.y + i.height > t.height && (i.y = Math.max(0, t.height - i.height), s = !0), i.x < 0 && (i.x = 0, s = !0), i.y < 0 && (i.y = 0, s = !0), s && (this.setState(i), this.eventEmitter.emit("viewportResize", {
748
824
  type: "viewportResize",
@@ -767,17 +843,17 @@ const v = class v {
767
843
  handleParentResize(t) {
768
844
  const { autoAdjust: e } = this.config;
769
845
  if (!(e != null && e.enabled)) return;
770
- const i = t.contentRect, a = { ...this.getState() };
846
+ const i = t.contentRect, r = { ...this.getState() };
771
847
  let o = !1;
772
848
  if (e.width) {
773
- const h = this.getMaxWidthConstraint(), d = Math.min(i.width, h);
774
- Math.abs(a.width - d) > 1 && (a.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);
775
851
  }
776
852
  if (e.height) {
777
- const h = this.getMaxHeightConstraint(), d = Math.min(i.height, h);
778
- Math.abs(a.height - d) > 1 && (a.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);
779
855
  }
780
- o && (this.setState(a), this.eventEmitter.emit("autoAdjust", {
856
+ o && (this.setState(r), this.eventEmitter.emit("autoAdjust", {
781
857
  type: "autoAdjust",
782
858
  state: this.getState(),
783
859
  mode: this.reactiveState.mode,
@@ -919,12 +995,12 @@ const v = class v {
919
995
  const i = e.getBoundingClientRect();
920
996
  if (i.width === 0 || i.height === 0)
921
997
  return t;
922
- const s = Math.max(0, i.width - t.width), a = Math.max(0, i.height - t.height), o = i.width - t.x, h = i.height - t.y;
998
+ const s = Math.max(0, i.width - t.width), r = Math.max(0, i.height - t.height), o = i.width - t.x, h = i.height - t.y;
923
999
  return {
924
- x: f(t.x, 0, s),
925
- y: f(t.y, 0, a),
926
- width: f(t.width, 0, o),
927
- height: f(t.height, 0, h)
1000
+ x: v(t.x, 0, s),
1001
+ y: v(t.y, 0, r),
1002
+ width: v(t.width, 0, o),
1003
+ height: v(t.height, 0, h)
928
1004
  };
929
1005
  }
930
1006
  /**
@@ -1099,7 +1175,7 @@ const v = class v {
1099
1175
  const { clientX: e, clientY: i } = this.directionResolver(
1100
1176
  t instanceof MouseEvent ? t.clientX : t.touches[0].clientX,
1101
1177
  t instanceof MouseEvent ? t.clientY : t.touches[0].clientY
1102
- ), s = e - this.startX, a = i - this.startY, o = this.applyMovementMode(s, a);
1178
+ ), s = e - this.startX, r = i - this.startY, o = this.applyMovementMode(s, r);
1103
1179
  this.setState(o), this.eventEmitter.emit("drag", {
1104
1180
  type: "drag",
1105
1181
  state: this.getState(),
@@ -1137,7 +1213,7 @@ const v = class v {
1137
1213
  */
1138
1214
  onResizeMove(t) {
1139
1215
  if (!this.isResizing || !this.resizeDirection) return;
1140
- const e = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, i = t instanceof MouseEvent ? t.clientY : t.touches[0].clientY, s = e - this.startX, a = i - this.startY, o = this.calculateResizeState(s, a, this.resizeDirection);
1216
+ const e = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, i = t instanceof MouseEvent ? t.clientY : t.touches[0].clientY, s = e - this.startX, r = i - this.startY, o = this.calculateResizeState(s, r, this.resizeDirection);
1141
1217
  this.setState(o), this.eventEmitter.emit("resize", {
1142
1218
  type: "resize",
1143
1219
  state: this.getState(),
@@ -1173,10 +1249,10 @@ const v = class v {
1173
1249
  * Resolve coordinates based on current direction mode
1174
1250
  */
1175
1251
  directionResolver(t, e) {
1176
- const i = this.reactiveState.draggingDirection, s = i === "vertical", a = i === "horizontal";
1252
+ const i = this.reactiveState.draggingDirection, s = i === "vertical", r = i === "horizontal";
1177
1253
  return {
1178
1254
  clientX: s ? this.startX : t,
1179
- clientY: a ? this.startY : e
1255
+ clientY: r ? this.startY : e
1180
1256
  };
1181
1257
  }
1182
1258
  /**
@@ -1274,11 +1350,11 @@ const v = class v {
1274
1350
  const t = this.container.parentElement.getBoundingClientRect(), e = this.getState();
1275
1351
  if (t.width === 0 || t.height === 0)
1276
1352
  return;
1277
- const i = e.width, s = e.height, a = Math.min(i, t.width), o = Math.min(s, t.height), h = e.x, d = e.y, l = Math.min(h, t.width - a), 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);
1278
1354
  this.setState({
1279
- x: l,
1355
+ x: d,
1280
1356
  y: S,
1281
- width: a,
1357
+ width: r,
1282
1358
  height: o
1283
1359
  }), this.eventEmitter.emit("parentRecalculated", {
1284
1360
  type: "parentRecalculated",
@@ -1320,25 +1396,25 @@ const v = class v {
1320
1396
  }), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.parentResizeObserver && (this.parentResizeObserver.disconnect(), this.parentResizeObserver = null), this.installedPlugins.clear(), this.zIndexState.remove(this.config._uid);
1321
1397
  }
1322
1398
  };
1323
- r(v, "MINWIDTH", 200), r(v, "MINHEIGHT", 45);
1324
- let G = v;
1325
- const k = class k {
1399
+ a(f, "MINWIDTH", 200), a(f, "MINHEIGHT", 45);
1400
+ let V = f;
1401
+ const R = class R {
1326
1402
  constructor(t = {}) {
1327
1403
  // Plugin state
1328
- r(this, "reactiveState", I({
1404
+ a(this, "reactiveState", $({
1329
1405
  snapStep: 10,
1330
1406
  enabled: !0,
1331
1407
  isActive: !1,
1332
1408
  lastPosition: null
1333
1409
  }));
1334
- r(this, "manager");
1335
- r(this, "startState", null);
1336
- r(this, "startX", 0);
1337
- r(this, "startY", 0);
1410
+ a(this, "manager");
1411
+ a(this, "startState", null);
1412
+ a(this, "startX", 0);
1413
+ a(this, "startY", 0);
1338
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);
1339
1415
  }
1340
1416
  get pluginId() {
1341
- return k._pluginId;
1417
+ return R._pluginId;
1342
1418
  }
1343
1419
  /**
1344
1420
  * Install plugin on container manager instance with reactive state
@@ -1362,9 +1438,9 @@ const k = class k {
1362
1438
  * Handle drag start event with snapping support
1363
1439
  */
1364
1440
  onDragStart(t) {
1365
- var s, a;
1441
+ var s, r;
1366
1442
  if (!this.manager || this.manager.getMode() === "pinned") return;
1367
- t.preventDefault(), (a = (s = this.manager).bringToFront) == null || a.call(s), this.reactiveState.isActive = !0;
1443
+ t.preventDefault(), (r = (s = this.manager).bringToFront) == null || r.call(s), this.reactiveState.isActive = !0;
1368
1444
  const e = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, i = t instanceof MouseEvent ? t.clientY : t.touches[0].clientY;
1369
1445
  this.startX = e, this.startY = i, this.startState = this.manager.getState(), this.reactiveState.lastPosition = { x: this.startState.x, y: this.startState.y }, document.addEventListener("mousemove", this.onDragMove), document.addEventListener("mouseup", this.onDragEnd), document.addEventListener("touchmove", this.onDragMove), document.addEventListener("touchend", this.onDragEnd), this.manager.emitPluginEvent("dragStart", {
1370
1446
  type: "drag",
@@ -1381,14 +1457,14 @@ const k = class k {
1381
1457
  t instanceof MouseEvent ? t.clientX : t.touches[0].clientX,
1382
1458
  t instanceof MouseEvent ? t.clientY : t.touches[0].clientY
1383
1459
  );
1384
- let s = e - this.startX, a = i - this.startY;
1460
+ let s = e - this.startX, r = i - this.startY;
1385
1461
  if (this.reactiveState.enabled) {
1386
- const d = this.applySnapping(s, a);
1387
- s = d.deltaX, a = d.deltaY;
1462
+ const l = this.applySnapping(s, r);
1463
+ s = l.deltaX, r = l.deltaY;
1388
1464
  }
1389
1465
  const o = {
1390
1466
  x: this.startState.x + s,
1391
- y: this.startState.y + a,
1467
+ y: this.startState.y + r,
1392
1468
  width: this.startState.width,
1393
1469
  height: this.startState.height
1394
1470
  }, h = this.manager.config;
@@ -1450,19 +1526,19 @@ const k = class k {
1450
1526
  this.reactiveState.isActive = !1, this.reactiveState.lastPosition = null;
1451
1527
  }
1452
1528
  };
1453
- r(k, "_pluginId", Symbol("SnappingPlugin"));
1454
- let U = k;
1455
- const R = class R {
1529
+ a(R, "_pluginId", Symbol("SnappingPlugin"));
1530
+ let U = R;
1531
+ const L = class L {
1456
1532
  constructor(t = {}) {
1457
- r(this, "dockedContainers", /* @__PURE__ */ new Map());
1458
- r(this, "occupiedEdges", /* @__PURE__ */ new Map());
1459
- r(this, "tracker", dt({ emitter: !0, edgeThreshold: 20 }));
1460
- r(this, "manager");
1461
- r(this, "edgeThreshold");
1533
+ a(this, "dockedContainers", /* @__PURE__ */ new Map());
1534
+ a(this, "occupiedEdges", /* @__PURE__ */ new Map());
1535
+ a(this, "tracker", lt({ emitter: !0, edgeThreshold: 20 }));
1536
+ a(this, "manager");
1537
+ a(this, "edgeThreshold");
1462
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);
1463
1539
  }
1464
1540
  get pluginId() {
1465
- return R._pluginId;
1541
+ return L._pluginId;
1466
1542
  }
1467
1543
  install(t) {
1468
1544
  this.manager = t, this.tracker.addTarget(this.manager.getContainer()), this.tracker.on("edge:enter", (e) => {
@@ -1571,26 +1647,26 @@ const R = class R {
1571
1647
  * Get the closest edge to the container
1572
1648
  */
1573
1649
  getClosestEdge(t) {
1574
- const e = t.top, i = t.left, s = window.innerHeight - t.bottom, a = window.innerWidth - t.right, h = Object.entries({
1650
+ const e = t.top, i = t.left, s = window.innerHeight - t.bottom, r = window.innerWidth - t.right, h = Object.entries({
1575
1651
  top: e,
1576
1652
  bottom: s,
1577
1653
  left: i,
1578
- right: a
1579
- }).filter(([d, l]) => l >= -this.edgeThreshold && l <= this.edgeThreshold).sort((d, l) => d[1] - l[1]);
1654
+ right: r
1655
+ }).filter(([l, d]) => d >= -this.edgeThreshold && d <= this.edgeThreshold).sort((l, d) => l[1] - d[1]);
1580
1656
  return h.length > 0 ? h[0][0] : null;
1581
1657
  }
1582
1658
  /**
1583
1659
  * Dock container to specified edge
1584
1660
  */
1585
1661
  dockContainer(t, e) {
1586
- const i = window.getComputedStyle(t), s = t.getBoundingClientRect(), a = {
1662
+ const i = window.getComputedStyle(t), s = t.getBoundingClientRect(), r = {
1587
1663
  x: s.left,
1588
1664
  y: s.top
1589
1665
  };
1590
1666
  this.dockedContainers.set(t, {
1591
1667
  element: t,
1592
1668
  edge: e,
1593
- screenPosition: a,
1669
+ screenPosition: r,
1594
1670
  originalPosition: {
1595
1671
  top: parseFloat(i.top) || s.top,
1596
1672
  left: parseFloat(i.left) || s.left,
@@ -1599,7 +1675,7 @@ const R = class R {
1599
1675
  transform: i.transform,
1600
1676
  position: i.position
1601
1677
  }
1602
- }), this.occupiedEdges.set(e, t), t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.width = "", t.style.height = "", t.style.transform = "", t.classList.add("edge-docked", `edge-docked-${e}`), this.applyEdgePositioning(t, e, a), t.setAttribute("data-docked", "true"), t.setAttribute("data-docked-edge", e);
1678
+ }), this.occupiedEdges.set(e, t), t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.width = "", t.style.height = "", t.style.transform = "", t.classList.add("edge-docked", `edge-docked-${e}`), this.applyEdgePositioning(t, e, r), t.setAttribute("data-docked", "true"), t.setAttribute("data-docked-edge", e);
1603
1679
  }
1604
1680
  /**
1605
1681
  * Apply proper positioning for each edge to prevent shifting
@@ -1677,15 +1753,15 @@ const R = class R {
1677
1753
  });
1678
1754
  }
1679
1755
  };
1680
- r(R, "_pluginId", Symbol("EdgeDockingPlugin"));
1681
- let j = R;
1756
+ a(L, "_pluginId", Symbol("EdgeDockingPlugin"));
1757
+ let j = L;
1682
1758
  const n = class n {
1683
1759
  constructor() {
1684
- r(this, "manager");
1685
- r(this, "containerId");
1686
- r(this, "isDemoContainer", !1);
1760
+ a(this, "manager");
1761
+ a(this, "containerId");
1762
+ a(this, "storable", !0);
1687
1763
  // Эффект для автоматического сохранения при изменении состояния
1688
- r(this, "autoSaveEffect");
1764
+ a(this, "autoSaveEffect");
1689
1765
  }
1690
1766
  get pluginId() {
1691
1767
  return n._pluginId;
@@ -1697,22 +1773,22 @@ const n = class n {
1697
1773
  static get closedQueue() {
1698
1774
  return n.reactiveState.closedQueue;
1699
1775
  }
1700
- static get demoContainers() {
1701
- return n.reactiveState.demoContainers;
1776
+ static get storableContainers() {
1777
+ return n.reactiveState.storableContainers;
1702
1778
  }
1703
1779
  /**
1704
1780
  * Install plugin on container manager instance with reactive state management
1705
1781
  */
1706
1782
  install(t, e) {
1707
- 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) {
1708
1784
  console.warn("[StatePersistencePlugin] containerId is required for state persistence");
1709
1785
  return;
1710
1786
  }
1711
1787
  n.containers.push({
1712
1788
  manager: t,
1713
1789
  containerId: this.containerId,
1714
- isDemo: this.isDemoContainer
1715
- }), 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();
1716
1792
  }
1717
1793
  /**
1718
1794
  * Set up reactive auto-save effect for container state changes
@@ -1720,7 +1796,7 @@ const n = class n {
1720
1796
  setupAutoSaveEffect() {
1721
1797
  if (!this.manager || !this.containerId) return;
1722
1798
  const t = z(() => {
1723
- this.isDemoContainer && this.saveState();
1799
+ this.storable && this.saveState();
1724
1800
  }, 300);
1725
1801
  this.autoSaveEffect = x(() => {
1726
1802
  this.manager.getState(), this.manager.getMode(), t();
@@ -1733,13 +1809,13 @@ const n = class n {
1733
1809
  bindContainerEvents() {
1734
1810
  this.manager && (this.manager.on("dragStart", () => {
1735
1811
  }), this.manager.on("dragEnd", () => {
1736
- this.isDemoContainer && this.saveState();
1812
+ this.storable && this.saveState();
1737
1813
  }), this.manager.on("resizeEnd", () => {
1738
- this.isDemoContainer && this.saveState();
1814
+ this.storable && this.saveState();
1739
1815
  }), this.manager.onPluginEvent("maximizeChanged", () => {
1740
- this.isDemoContainer && this.saveState();
1816
+ this.storable && this.saveState();
1741
1817
  }), this.manager.onPluginEvent("directionChanged", () => {
1742
- this.isDemoContainer && this.saveState();
1818
+ this.storable && this.saveState();
1743
1819
  }));
1744
1820
  }
1745
1821
  /**
@@ -1757,42 +1833,42 @@ const n = class n {
1757
1833
  /**
1758
1834
  * Register a container as a demo container
1759
1835
  */
1760
- static registerDemoContainer(t) {
1836
+ static registerContainer(t) {
1761
1837
  try {
1762
- n.demoContainers.includes(t) || (n.demoContainers.push(t), n.saveDemoContainersToStorage());
1838
+ n.storableContainers.includes(t) || (n.storableContainers.push(t), n.saveContainersToStorage());
1763
1839
  } catch (e) {
1764
- console.error("[StatePersistencePlugin] Failed to register demo container:", e);
1840
+ console.error("[StatePersistencePlugin] Failed to register container:", e);
1765
1841
  }
1766
1842
  }
1767
1843
  /**
1768
1844
  * Save demo containers to localStorage
1769
1845
  */
1770
- static saveDemoContainersToStorage() {
1846
+ static saveContainersToStorage() {
1771
1847
  try {
1772
1848
  localStorage.setItem(
1773
- n.DEMO_CONTAINERS_KEY,
1774
- JSON.stringify(n.demoContainers)
1849
+ n.STORABLE_CONTAINERS_KEY,
1850
+ JSON.stringify(n.storableContainers)
1775
1851
  );
1776
1852
  } catch (t) {
1777
- console.error("[StatePersistencePlugin] Failed to save demo containers:", t);
1853
+ console.error("[StatePersistencePlugin] Failed to save containers:", t);
1778
1854
  }
1779
1855
  }
1780
1856
  /**
1781
1857
  * Get list of all demo containers
1782
1858
  */
1783
- static getDemoContainers() {
1859
+ static getContainers() {
1784
1860
  try {
1785
- const t = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
1861
+ const t = localStorage.getItem(n.STORABLE_CONTAINERS_KEY);
1786
1862
  return t ? JSON.parse(t) : [];
1787
1863
  } catch (t) {
1788
- return console.error("[StatePersistencePlugin] Failed to parse demo containers:", t), [];
1864
+ return console.error("[StatePersistencePlugin] Failed to parse containers:", t), [];
1789
1865
  }
1790
1866
  }
1791
1867
  /**
1792
1868
  * Check if a container is a demo container
1793
1869
  */
1794
- static isDemoContainer(t) {
1795
- return n.getDemoContainers().includes(t);
1870
+ static isStorableContainer(t) {
1871
+ return n.getContainers().includes(t);
1796
1872
  }
1797
1873
  /**
1798
1874
  * Get all saved states from localStorage
@@ -1809,8 +1885,8 @@ const n = class n {
1809
1885
  * Add container ID to closed containers queue
1810
1886
  */
1811
1887
  static addToClosedQueue(t) {
1812
- if (!n.isDemoContainer(t)) {
1813
- 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}`);
1814
1890
  return;
1815
1891
  }
1816
1892
  if (!n.getContainerState(t)) {
@@ -1845,27 +1921,27 @@ const n = class n {
1845
1921
  }
1846
1922
  }
1847
1923
  saveState() {
1848
- !this.manager || !this.containerId || !this.isDemoContainer || T(() => {
1849
- var C;
1924
+ !this.manager || !this.containerId || !this.storable || k(() => {
1925
+ var w;
1850
1926
  n.reactiveState.isSaving = !0, n.reactiveState.pendingChanges = !0;
1851
- const t = this.manager.getContainer(), e = t.dataset.maximized === "true", i = this.manager.getState(), s = this.manager.getMode(), a = this.manager.getDirection(), o = t.dataset.containerType || "unknown", h = t.dataset.title, d = t.dataset.color, l = t.dataset.useSnapping === "true", S = (C = this.manager.config) == null ? void 0 : C.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 = {
1852
1928
  ...i,
1853
1929
  mode: s,
1854
- draggingDirection: a,
1930
+ draggingDirection: r,
1855
1931
  isMaximized: e,
1856
1932
  containerType: o,
1857
1933
  title: h,
1858
- color: d,
1859
- useSnapping: l,
1934
+ color: l,
1935
+ useSnapping: d,
1860
1936
  isClosed: !1,
1861
1937
  parentElementId: M,
1862
1938
  closedTimestamp: 0,
1863
1939
  resize: S,
1864
- isDemoContainer: !0
1940
+ storable: !0
1865
1941
  };
1866
- n.reactiveState.containerStates[this.containerId] = w;
1942
+ n.reactiveState.containerStates[this.containerId] = y;
1867
1943
  const p = n.getAllStates();
1868
- p[this.containerId] = w, localStorage.setItem(
1944
+ p[this.containerId] = y, localStorage.setItem(
1869
1945
  n.STORAGE_KEY,
1870
1946
  JSON.stringify(p)
1871
1947
  ), n.reactiveState.lastSaved = Date.now(), n.reactiveState.isSaving = !1;
@@ -1876,29 +1952,28 @@ const n = class n {
1876
1952
  */
1877
1953
  static saveContainerStateBeforeClose(t, e) {
1878
1954
  var Y, B, F;
1879
- const i = t.getState(), s = t.getMode();
1880
- if (!n.isDemoContainer(e)) {
1955
+ if (!n.isStorableContainer(e)) {
1881
1956
  n.containers = n.containers.filter(
1882
- (D) => D.containerId !== e
1957
+ (T) => T.containerId !== e
1883
1958
  );
1884
1959
  return;
1885
1960
  }
1886
- 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, C = ((F = t.getDockEdge) == null ? void 0 : F.call(t)) || null, b = o.parentElement, q = b && b !== document.body ? b.id || `parent-${e}` : void 0, A = {
1887
- ...i,
1888
- 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,
1889
1964
  draggingDirection: h,
1890
- isMaximized: d,
1965
+ isMaximized: l,
1891
1966
  isEdgeDocked: p,
1892
- dockEdge: C || void 0,
1893
- containerType: l,
1967
+ dockEdge: w || void 0,
1968
+ containerType: d,
1894
1969
  title: S,
1895
1970
  color: E,
1896
1971
  useSnapping: M,
1897
1972
  isClosed: !0,
1898
1973
  parentElementId: q,
1899
1974
  closedTimestamp: Date.now(),
1900
- resize: w,
1901
- isDemoContainer: !0
1975
+ resize: y,
1976
+ storable: !0
1902
1977
  }, N = n.getAllStates();
1903
1978
  N[e] = A;
1904
1979
  try {
@@ -1906,36 +1981,36 @@ const n = class n {
1906
1981
  n.STORAGE_KEY,
1907
1982
  JSON.stringify(N)
1908
1983
  );
1909
- } catch (D) {
1910
- console.error("[StatePersistencePlugin] Failed to save to localStorage:", D);
1984
+ } catch (T) {
1985
+ console.error("[StatePersistencePlugin] Failed to save to localStorage:", T);
1911
1986
  }
1912
1987
  n.reactiveState.containerStates[e] = A, n.containers = n.containers.filter(
1913
- (D) => D.containerId !== e
1988
+ (T) => T.containerId !== e
1914
1989
  ), n.addToClosedQueue(e);
1915
1990
  }
1916
1991
  /**
1917
1992
  * Save all containers state (for global events) - including closed ones
1918
1993
  */
1919
1994
  static saveAllContainers() {
1920
- T(() => {
1995
+ k(() => {
1921
1996
  const t = n.getAllStates();
1922
- n.containers.filter(({ isDemo: e }) => e).forEach(({ manager: e, containerId: i }) => {
1923
- var b;
1924
- const s = e.getState(), a = 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 = (b = e.config) == null ? void 0 : b.resize, p = o.parentElement, C = p && p !== document.body ? p.id || `parent-${i}` : void 0;
1997
+ n.containers.filter((e) => !("storable" in e && e.storable === !1)).forEach(({ manager: e, containerId: i }) => {
1998
+ var C;
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;
1925
2000
  t[i] = {
1926
2001
  ...s,
1927
- mode: a,
2002
+ mode: r,
1928
2003
  draggingDirection: h,
1929
- isMaximized: d,
1930
- containerType: l,
2004
+ isMaximized: l,
2005
+ containerType: d,
1931
2006
  title: S,
1932
2007
  color: E,
1933
2008
  useSnapping: M,
1934
2009
  isClosed: !1,
1935
- parentElementId: C,
2010
+ parentElementId: w,
1936
2011
  closedTimestamp: 0,
1937
- resize: w,
1938
- isDemoContainer: !0
2012
+ resize: y,
2013
+ storable: !0
1939
2014
  };
1940
2015
  }), n.reactiveState.containerStates = t, localStorage.setItem(
1941
2016
  n.STORAGE_KEY,
@@ -1994,14 +2069,14 @@ const n = class n {
1994
2069
  try {
1995
2070
  const i = n.getAllStates(), s = i[t];
1996
2071
  if (s) {
1997
- const a = { ...s, ...e };
1998
- i[t] = a, localStorage.setItem(
2072
+ const r = { ...s, ...e };
2073
+ i[t] = r, localStorage.setItem(
1999
2074
  n.STORAGE_KEY,
2000
2075
  JSON.stringify(i)
2001
- ), n.reactiveState.containerStates[t] = a;
2076
+ ), n.reactiveState.containerStates[t] = r;
2002
2077
  } else {
2003
2078
  console.warn(`[StatePersistencePlugin] No state found for container ${t}, creating new state`);
2004
- const a = {
2079
+ const r = {
2005
2080
  x: 0,
2006
2081
  y: 0,
2007
2082
  width: 300,
@@ -2011,13 +2086,13 @@ const n = class n {
2011
2086
  isMaximized: !1,
2012
2087
  containerType: "unknown",
2013
2088
  isClosed: !1,
2014
- isDemoContainer: n.isDemoContainer(t),
2089
+ storable: n.isStorableContainer(t),
2015
2090
  ...e
2016
2091
  };
2017
- i[t] = a, localStorage.setItem(
2092
+ i[t] = r, localStorage.setItem(
2018
2093
  n.STORAGE_KEY,
2019
2094
  JSON.stringify(i)
2020
- ), n.reactiveState.containerStates[t] = a;
2095
+ ), n.reactiveState.containerStates[t] = r;
2021
2096
  }
2022
2097
  } catch (i) {
2023
2098
  console.error("[StatePersistencePlugin] Failed to update container state:", i);
@@ -2027,18 +2102,18 @@ const n = class n {
2027
2102
  * Clear all saved states from localStorage
2028
2103
  */
2029
2104
  static clearStorage() {
2030
- T(() => {
2031
- n.reactiveState.containerStates = {}, n.closedQueue.length = 0, n.demoContainers.length = 0, n.reactiveState.isSaving = !1, n.reactiveState.lastSaved = null, n.reactiveState.pendingChanges = !1;
2032
- }), 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 = [];
2033
2108
  }
2034
2109
  /**
2035
2110
  * Initialize reactive state from localStorage on plugin load
2036
2111
  */
2037
2112
  static initializeReactiveState() {
2038
2113
  try {
2039
- const t = n.getAllStates(), e = n.getClosedQueue(), i = n.getDemoContainers();
2040
- T(() => {
2041
- 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);
2042
2117
  });
2043
2118
  } catch (t) {
2044
2119
  console.error("[StatePersistencePlugin] Failed to initialize reactive state:", t);
@@ -2050,7 +2125,7 @@ const n = class n {
2050
2125
  static getMetrics() {
2051
2126
  return {
2052
2127
  totalContainers: Object.keys(n.containerStates).length,
2053
- demoContainers: n.demoContainers.length,
2128
+ demoContainers: n.storableContainers.length,
2054
2129
  closedContainers: n.closedQueue.length,
2055
2130
  lastSaved: n.reactiveState.lastSaved,
2056
2131
  isSaving: n.reactiveState.isSaving
@@ -2066,17 +2141,17 @@ const n = class n {
2066
2141
  if (t) {
2067
2142
  const s = JSON.parse(t);
2068
2143
  console.log(`[StatePersistencePlugin] Number of states: ${Object.keys(s).length}`), console.log("[StatePersistencePlugin] State keys:", Object.keys(s));
2069
- for (const [a, o] of Object.entries(s))
2070
- console.log(`[StatePersistencePlugin] State ${a}:`, {
2071
- isDemoContainer: o.isDemoContainer,
2144
+ for (const [r, o] of Object.entries(s))
2145
+ console.log(`[StatePersistencePlugin] State ${r}:`, {
2146
+ storable: o.storable,
2072
2147
  isClosed: o.isClosed,
2073
2148
  title: o.title
2074
2149
  });
2075
2150
  }
2076
2151
  const e = localStorage.getItem(n.CLOSED_QUEUE_KEY);
2077
2152
  console.log("[StatePersistencePlugin] Closed queue:", e ? JSON.parse(e) : []);
2078
- const i = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
2079
- 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) : []);
2080
2155
  } catch (t) {
2081
2156
  console.error("[StatePersistencePlugin] Debug error:", t);
2082
2157
  }
@@ -2091,25 +2166,25 @@ const n = class n {
2091
2166
  ));
2092
2167
  }
2093
2168
  };
2094
- r(n, "_pluginId", Symbol("StatePersistencePlugin")), r(n, "STORAGE_KEY", "containerManagerState"), r(n, "CLOSED_QUEUE_KEY", "containerManagerClosedQueue"), r(n, "DEMO_CONTAINERS_KEY", "containerManagerDemoContainers"), // Статическое реактивное состояние для всех плагинов
2095
- r(n, "reactiveState", I({
2169
+ a(n, "_pluginId", Symbol("StatePersistencePlugin")), a(n, "STORAGE_KEY", "containerManagerState"), a(n, "CLOSED_QUEUE_KEY", "containerManagerClosedQueue"), a(n, "STORABLE_CONTAINERS_KEY", "containerManagerStorableContainers"), // Статическое реактивное состояние для всех плагинов
2170
+ a(n, "reactiveState", $({
2096
2171
  isSaving: !1,
2097
2172
  lastSaved: null,
2098
2173
  pendingChanges: !1,
2099
2174
  containerStates: {},
2100
2175
  closedQueue: [],
2101
- demoContainers: []
2102
- })), r(n, "isGlobalEventsInitialized", !1), r(n, "containers", []);
2176
+ storableContainers: []
2177
+ })), a(n, "isGlobalEventsInitialized", !1), a(n, "containers", []);
2103
2178
  let H = n;
2104
2179
  H.initializeReactiveState();
2105
- const L = class L {
2180
+ const D = class D {
2106
2181
  constructor() {
2107
- r(this, "manager");
2108
- r(this, "containerName", "");
2109
- r(this, "notificationSystem", null);
2182
+ a(this, "manager");
2183
+ a(this, "containerName", "");
2184
+ a(this, "notificationSystem", null);
2110
2185
  }
2111
2186
  get pluginId() {
2112
- return L._pluginId;
2187
+ return D._pluginId;
2113
2188
  }
2114
2189
  /**
2115
2190
  * Install plugin on container manager instance
@@ -2200,19 +2275,21 @@ const L = class L {
2200
2275
  }
2201
2276
  }
2202
2277
  };
2203
- r(L, "_pluginId", Symbol("LoggingPlugin"));
2204
- let K = L;
2278
+ a(D, "_pluginId", Symbol("LoggingPlugin"));
2279
+ let K = D;
2205
2280
  export {
2206
2281
  pt as ContainerInitializer,
2207
- G as ContainerManager,
2208
- ft as ContentCreator,
2282
+ V as ContainerManager,
2283
+ vt as ContentCreator,
2209
2284
  j as EdgeDockingPlugin,
2210
2285
  K as LoggingPlugin,
2211
2286
  it as NotificationSystem,
2212
2287
  U as SnappingPlugin,
2213
2288
  H as StatePersistencePlugin,
2289
+ ft as StatsManager,
2214
2290
  J as TemplateLoader,
2215
- St as getTemplateLoader,
2216
- vt as initializeTemplateSystem
2291
+ dt as getState,
2292
+ Et as getTemplateLoader,
2293
+ St as initializeTemplateSystem
2217
2294
  };
2218
2295
  //# sourceMappingURL=index.es.js.map