@alekstar79/draggable-resizable-container 1.0.3 → 1.0.4
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.d.ts +2 -2
- package/dist/index.es.js +257 -179
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +42 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
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
|
|
4
|
-
import Q, { reactive as
|
|
5
|
-
import { clamp as
|
|
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";
|
|
5
|
+
import { clamp as v, deepMerge as et, debounce as z } from "@alekstar79/utility";
|
|
6
6
|
class it {
|
|
7
7
|
constructor(t) {
|
|
8
|
-
|
|
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
|
|
28
|
-
|
|
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,
|
|
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`),
|
|
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
|
|
73
|
+
class vt {
|
|
74
74
|
constructor(t) {
|
|
75
|
-
|
|
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 (
|
|
95
|
-
console.error(`[ContentCreator] Failed to load template: ${t.template}`,
|
|
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
|
|
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
|
|
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
|
|
181
|
-
if (!
|
|
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
|
|
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;
|
|
@@ -234,8 +310,8 @@ class J {
|
|
|
234
310
|
}
|
|
235
311
|
}
|
|
236
312
|
let u;
|
|
237
|
-
async function
|
|
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,
|
|
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
|
|
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:
|
|
254
|
-
t.register({ name: s, source:
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
|
|
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 (
|
|
336
|
-
console.error(`Error in event listener for ${String(t)}:`,
|
|
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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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),
|
|
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(
|
|
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
|
|
511
|
-
if (t.top &&
|
|
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 (
|
|
514
|
-
t.edge =
|
|
589
|
+
else if (r.length === 1)
|
|
590
|
+
t.edge = r[0];
|
|
515
591
|
else {
|
|
516
592
|
const o = {
|
|
517
593
|
top: e.top,
|
|
@@ -519,7 +595,7 @@ class ht {
|
|
|
519
595
|
bottom: s - e.bottom,
|
|
520
596
|
left: e.left
|
|
521
597
|
};
|
|
522
|
-
t.edge =
|
|
598
|
+
t.edge = r.reduce(
|
|
523
599
|
(h, d) => o[d] < o[h] ? d : h
|
|
524
600
|
);
|
|
525
601
|
}
|
|
@@ -546,8 +622,8 @@ class ht {
|
|
|
546
622
|
const y = class y extends ht {
|
|
547
623
|
constructor(e, i) {
|
|
548
624
|
super(e, i);
|
|
549
|
-
|
|
550
|
-
|
|
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) {
|
|
@@ -586,7 +662,7 @@ const y = class y extends ht {
|
|
|
586
662
|
return this.lastEdge;
|
|
587
663
|
}
|
|
588
664
|
};
|
|
589
|
-
|
|
665
|
+
a(y, "instance");
|
|
590
666
|
let P = y;
|
|
591
667
|
function dt(c = {}, t = []) {
|
|
592
668
|
const e = P.init(c.edgeThreshold, t);
|
|
@@ -596,7 +672,7 @@ function dt(c = {}, t = []) {
|
|
|
596
672
|
}
|
|
597
673
|
const g = class g {
|
|
598
674
|
constructor() {
|
|
599
|
-
|
|
675
|
+
a(this, "draggable", []);
|
|
600
676
|
}
|
|
601
677
|
zIndex(t) {
|
|
602
678
|
return `${g.highestZIndex + this.draggable.findIndex((e) => e === t)}`;
|
|
@@ -611,9 +687,9 @@ 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
|
-
|
|
690
|
+
a(g, "inatance"), a(g, "highestZIndex", 1e3), a(g, "init", () => g.inatance ?? (g.inatance = new g()));
|
|
615
691
|
let O = g;
|
|
616
|
-
function
|
|
692
|
+
function G() {
|
|
617
693
|
return {
|
|
618
694
|
width: window.innerWidth || document.documentElement.clientWidth,
|
|
619
695
|
height: window.innerHeight || document.documentElement.clientHeight
|
|
@@ -622,7 +698,7 @@ function V() {
|
|
|
622
698
|
function lt() {
|
|
623
699
|
return O.init();
|
|
624
700
|
}
|
|
625
|
-
const
|
|
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
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
-
|
|
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 =
|
|
744
|
+
if (e.width = v(
|
|
669
745
|
t.width,
|
|
670
|
-
i.minWidth ||
|
|
746
|
+
i.minWidth || f.MINWIDTH,
|
|
671
747
|
i.maxWidth || 1 / 0
|
|
672
|
-
), e.height =
|
|
748
|
+
), e.height = v(
|
|
673
749
|
t.height,
|
|
674
|
-
i.minHeight ||
|
|
750
|
+
i.minHeight || f.MINHEIGHT,
|
|
675
751
|
i.maxHeight || 1 / 0
|
|
676
752
|
), this.shouldConstrainToViewport()) {
|
|
677
|
-
const
|
|
678
|
-
e.x =
|
|
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
|
-
|
|
759
|
+
a(this, "domUpdateEffect", k(() => {
|
|
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:
|
|
701
|
-
minHeight:
|
|
776
|
+
minWidth: f.MINWIDTH,
|
|
777
|
+
minHeight: f.MINHEIGHT
|
|
702
778
|
},
|
|
703
779
|
autoAdjust: {
|
|
704
780
|
enabled: !1,
|
|
@@ -742,7 +818,7 @@ const v = class v {
|
|
|
742
818
|
*/
|
|
743
819
|
handleViewportResize() {
|
|
744
820
|
if (!this.shouldConstrainToViewport()) return;
|
|
745
|
-
const t =
|
|
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,
|
|
846
|
+
const i = t.contentRect, r = { ...this.getState() };
|
|
771
847
|
let o = !1;
|
|
772
848
|
if (e.width) {
|
|
773
849
|
const h = this.getMaxWidthConstraint(), d = Math.min(i.width, h);
|
|
774
|
-
Math.abs(
|
|
850
|
+
Math.abs(r.width - d) > 1 && (r.width = d, o = !0);
|
|
775
851
|
}
|
|
776
852
|
if (e.height) {
|
|
777
853
|
const h = this.getMaxHeightConstraint(), d = Math.min(i.height, h);
|
|
778
|
-
Math.abs(
|
|
854
|
+
Math.abs(r.height - d) > 1 && (r.height = d, o = !0);
|
|
779
855
|
}
|
|
780
|
-
o && (this.setState(
|
|
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),
|
|
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:
|
|
925
|
-
y:
|
|
926
|
-
width:
|
|
927
|
-
height:
|
|
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
|
/**
|
|
@@ -989,11 +1065,11 @@ const v = class v {
|
|
|
989
1065
|
* Setup reactive monitoring for container metrics
|
|
990
1066
|
*/
|
|
991
1067
|
setupReactiveMonitoring() {
|
|
992
|
-
const t =
|
|
1068
|
+
const t = k(() => {
|
|
993
1069
|
const { state: i } = this.stateChangeStream;
|
|
994
1070
|
});
|
|
995
1071
|
this.reactiveEffects.push(t);
|
|
996
|
-
const e =
|
|
1072
|
+
const e = k(() => {
|
|
997
1073
|
const i = this.eventEmitter.getMetrics();
|
|
998
1074
|
i.state.errorCount > 10 && console.warn("[ContainerManager] High error count in event system:", i.state.errorCount);
|
|
999
1075
|
});
|
|
@@ -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,
|
|
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,
|
|
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",
|
|
1252
|
+
const i = this.reactiveState.draggingDirection, s = i === "vertical", r = i === "horizontal";
|
|
1177
1253
|
return {
|
|
1178
1254
|
clientX: s ? this.startX : t,
|
|
1179
|
-
clientY:
|
|
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,
|
|
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);
|
|
1278
1354
|
this.setState({
|
|
1279
1355
|
x: l,
|
|
1280
1356
|
y: S,
|
|
1281
|
-
width:
|
|
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
|
-
|
|
1324
|
-
let
|
|
1325
|
-
const
|
|
1399
|
+
a(f, "MINWIDTH", 200), a(f, "MINHEIGHT", 45);
|
|
1400
|
+
let V = f;
|
|
1401
|
+
const x = class x {
|
|
1326
1402
|
constructor(t = {}) {
|
|
1327
1403
|
// Plugin state
|
|
1328
|
-
|
|
1404
|
+
a(this, "reactiveState", $({
|
|
1329
1405
|
snapStep: 10,
|
|
1330
1406
|
enabled: !0,
|
|
1331
1407
|
isActive: !1,
|
|
1332
1408
|
lastPosition: null
|
|
1333
1409
|
}));
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
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
|
|
1417
|
+
return x._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,
|
|
1441
|
+
var s, r;
|
|
1366
1442
|
if (!this.manager || this.manager.getMode() === "pinned") return;
|
|
1367
|
-
t.preventDefault(), (
|
|
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,
|
|
1460
|
+
let s = e - this.startX, r = i - this.startY;
|
|
1385
1461
|
if (this.reactiveState.enabled) {
|
|
1386
|
-
const d = this.applySnapping(s,
|
|
1387
|
-
s = d.deltaX,
|
|
1462
|
+
const d = this.applySnapping(s, r);
|
|
1463
|
+
s = d.deltaX, r = d.deltaY;
|
|
1388
1464
|
}
|
|
1389
1465
|
const o = {
|
|
1390
1466
|
x: this.startState.x + s,
|
|
1391
|
-
y: this.startState.y +
|
|
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,15 +1526,15 @@ const k = class k {
|
|
|
1450
1526
|
this.reactiveState.isActive = !1, this.reactiveState.lastPosition = null;
|
|
1451
1527
|
}
|
|
1452
1528
|
};
|
|
1453
|
-
|
|
1454
|
-
let U =
|
|
1529
|
+
a(x, "_pluginId", Symbol("SnappingPlugin"));
|
|
1530
|
+
let U = x;
|
|
1455
1531
|
const R = class R {
|
|
1456
1532
|
constructor(t = {}) {
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1533
|
+
a(this, "dockedContainers", /* @__PURE__ */ new Map());
|
|
1534
|
+
a(this, "occupiedEdges", /* @__PURE__ */ new Map());
|
|
1535
|
+
a(this, "tracker", dt({ 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() {
|
|
@@ -1571,11 +1647,11 @@ 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,
|
|
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:
|
|
1654
|
+
right: r
|
|
1579
1655
|
}).filter(([d, l]) => l >= -this.edgeThreshold && l <= this.edgeThreshold).sort((d, l) => d[1] - l[1]);
|
|
1580
1656
|
return h.length > 0 ? h[0][0] : null;
|
|
1581
1657
|
}
|
|
@@ -1583,14 +1659,14 @@ const R = class R {
|
|
|
1583
1659
|
* Dock container to specified edge
|
|
1584
1660
|
*/
|
|
1585
1661
|
dockContainer(t, e) {
|
|
1586
|
-
const i = window.getComputedStyle(t), s = t.getBoundingClientRect(),
|
|
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:
|
|
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,
|
|
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
|
-
|
|
1756
|
+
a(R, "_pluginId", Symbol("EdgeDockingPlugin"));
|
|
1681
1757
|
let j = R;
|
|
1682
1758
|
const n = class n {
|
|
1683
1759
|
constructor() {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1760
|
+
a(this, "manager");
|
|
1761
|
+
a(this, "containerId");
|
|
1762
|
+
a(this, "isDemoContainer", !1);
|
|
1687
1763
|
// Эффект для автоматического сохранения при изменении состояния
|
|
1688
|
-
|
|
1764
|
+
a(this, "autoSaveEffect");
|
|
1689
1765
|
}
|
|
1690
1766
|
get pluginId() {
|
|
1691
1767
|
return n._pluginId;
|
|
@@ -1722,7 +1798,7 @@ const n = class n {
|
|
|
1722
1798
|
const t = z(() => {
|
|
1723
1799
|
this.isDemoContainer && this.saveState();
|
|
1724
1800
|
}, 300);
|
|
1725
|
-
this.autoSaveEffect =
|
|
1801
|
+
this.autoSaveEffect = k(() => {
|
|
1726
1802
|
this.manager.getState(), this.manager.getMode(), t();
|
|
1727
1803
|
});
|
|
1728
1804
|
}
|
|
@@ -1845,13 +1921,13 @@ const n = class n {
|
|
|
1845
1921
|
}
|
|
1846
1922
|
}
|
|
1847
1923
|
saveState() {
|
|
1848
|
-
!this.manager || !this.containerId || !this.isDemoContainer ||
|
|
1849
|
-
var
|
|
1924
|
+
!this.manager || !this.containerId || !this.isDemoContainer || D(() => {
|
|
1925
|
+
var b;
|
|
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(),
|
|
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 = {
|
|
1852
1928
|
...i,
|
|
1853
1929
|
mode: s,
|
|
1854
|
-
draggingDirection:
|
|
1930
|
+
draggingDirection: r,
|
|
1855
1931
|
isMaximized: e,
|
|
1856
1932
|
containerType: o,
|
|
1857
1933
|
title: h,
|
|
@@ -1879,17 +1955,17 @@ const n = class n {
|
|
|
1879
1955
|
const i = t.getState(), s = t.getMode();
|
|
1880
1956
|
if (!n.isDemoContainer(e)) {
|
|
1881
1957
|
n.containers = n.containers.filter(
|
|
1882
|
-
(
|
|
1958
|
+
(T) => T.containerId !== e
|
|
1883
1959
|
);
|
|
1884
1960
|
return;
|
|
1885
1961
|
}
|
|
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,
|
|
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 = {
|
|
1887
1963
|
...i,
|
|
1888
1964
|
mode: s,
|
|
1889
1965
|
draggingDirection: h,
|
|
1890
1966
|
isMaximized: d,
|
|
1891
1967
|
isEdgeDocked: p,
|
|
1892
|
-
dockEdge:
|
|
1968
|
+
dockEdge: b || void 0,
|
|
1893
1969
|
containerType: l,
|
|
1894
1970
|
title: S,
|
|
1895
1971
|
color: E,
|
|
@@ -1906,25 +1982,25 @@ const n = class n {
|
|
|
1906
1982
|
n.STORAGE_KEY,
|
|
1907
1983
|
JSON.stringify(N)
|
|
1908
1984
|
);
|
|
1909
|
-
} catch (
|
|
1910
|
-
console.error("[StatePersistencePlugin] Failed to save to localStorage:",
|
|
1985
|
+
} catch (T) {
|
|
1986
|
+
console.error("[StatePersistencePlugin] Failed to save to localStorage:", T);
|
|
1911
1987
|
}
|
|
1912
1988
|
n.reactiveState.containerStates[e] = A, n.containers = n.containers.filter(
|
|
1913
|
-
(
|
|
1989
|
+
(T) => T.containerId !== e
|
|
1914
1990
|
), n.addToClosedQueue(e);
|
|
1915
1991
|
}
|
|
1916
1992
|
/**
|
|
1917
1993
|
* Save all containers state (for global events) - including closed ones
|
|
1918
1994
|
*/
|
|
1919
1995
|
static saveAllContainers() {
|
|
1920
|
-
|
|
1996
|
+
D(() => {
|
|
1921
1997
|
const t = n.getAllStates();
|
|
1922
1998
|
n.containers.filter(({ isDemo: e }) => e).forEach(({ manager: e, containerId: i }) => {
|
|
1923
|
-
var
|
|
1924
|
-
const s = e.getState(),
|
|
1999
|
+
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;
|
|
1925
2001
|
t[i] = {
|
|
1926
2002
|
...s,
|
|
1927
|
-
mode:
|
|
2003
|
+
mode: r,
|
|
1928
2004
|
draggingDirection: h,
|
|
1929
2005
|
isMaximized: d,
|
|
1930
2006
|
containerType: l,
|
|
@@ -1932,7 +2008,7 @@ const n = class n {
|
|
|
1932
2008
|
color: E,
|
|
1933
2009
|
useSnapping: M,
|
|
1934
2010
|
isClosed: !1,
|
|
1935
|
-
parentElementId:
|
|
2011
|
+
parentElementId: b,
|
|
1936
2012
|
closedTimestamp: 0,
|
|
1937
2013
|
resize: w,
|
|
1938
2014
|
isDemoContainer: !0
|
|
@@ -1994,14 +2070,14 @@ const n = class n {
|
|
|
1994
2070
|
try {
|
|
1995
2071
|
const i = n.getAllStates(), s = i[t];
|
|
1996
2072
|
if (s) {
|
|
1997
|
-
const
|
|
1998
|
-
i[t] =
|
|
2073
|
+
const r = { ...s, ...e };
|
|
2074
|
+
i[t] = r, localStorage.setItem(
|
|
1999
2075
|
n.STORAGE_KEY,
|
|
2000
2076
|
JSON.stringify(i)
|
|
2001
|
-
), n.reactiveState.containerStates[t] =
|
|
2077
|
+
), n.reactiveState.containerStates[t] = r;
|
|
2002
2078
|
} else {
|
|
2003
2079
|
console.warn(`[StatePersistencePlugin] No state found for container ${t}, creating new state`);
|
|
2004
|
-
const
|
|
2080
|
+
const r = {
|
|
2005
2081
|
x: 0,
|
|
2006
2082
|
y: 0,
|
|
2007
2083
|
width: 300,
|
|
@@ -2014,10 +2090,10 @@ const n = class n {
|
|
|
2014
2090
|
isDemoContainer: n.isDemoContainer(t),
|
|
2015
2091
|
...e
|
|
2016
2092
|
};
|
|
2017
|
-
i[t] =
|
|
2093
|
+
i[t] = r, localStorage.setItem(
|
|
2018
2094
|
n.STORAGE_KEY,
|
|
2019
2095
|
JSON.stringify(i)
|
|
2020
|
-
), n.reactiveState.containerStates[t] =
|
|
2096
|
+
), n.reactiveState.containerStates[t] = r;
|
|
2021
2097
|
}
|
|
2022
2098
|
} catch (i) {
|
|
2023
2099
|
console.error("[StatePersistencePlugin] Failed to update container state:", i);
|
|
@@ -2027,7 +2103,7 @@ const n = class n {
|
|
|
2027
2103
|
* Clear all saved states from localStorage
|
|
2028
2104
|
*/
|
|
2029
2105
|
static clearStorage() {
|
|
2030
|
-
|
|
2106
|
+
D(() => {
|
|
2031
2107
|
n.reactiveState.containerStates = {}, n.closedQueue.length = 0, n.demoContainers.length = 0, n.reactiveState.isSaving = !1, n.reactiveState.lastSaved = null, n.reactiveState.pendingChanges = !1;
|
|
2032
2108
|
}), localStorage.removeItem(n.STORAGE_KEY), localStorage.removeItem(n.CLOSED_QUEUE_KEY), localStorage.removeItem(n.DEMO_CONTAINERS_KEY), n.containers = [];
|
|
2033
2109
|
}
|
|
@@ -2037,7 +2113,7 @@ const n = class n {
|
|
|
2037
2113
|
static initializeReactiveState() {
|
|
2038
2114
|
try {
|
|
2039
2115
|
const t = n.getAllStates(), e = n.getClosedQueue(), i = n.getDemoContainers();
|
|
2040
|
-
|
|
2116
|
+
D(() => {
|
|
2041
2117
|
n.reactiveState.containerStates = t, n.closedQueue.length = 0, n.closedQueue.push(...e), n.demoContainers.length = 0, n.demoContainers.push(...i);
|
|
2042
2118
|
});
|
|
2043
2119
|
} catch (t) {
|
|
@@ -2066,8 +2142,8 @@ const n = class n {
|
|
|
2066
2142
|
if (t) {
|
|
2067
2143
|
const s = JSON.parse(t);
|
|
2068
2144
|
console.log(`[StatePersistencePlugin] Number of states: ${Object.keys(s).length}`), console.log("[StatePersistencePlugin] State keys:", Object.keys(s));
|
|
2069
|
-
for (const [
|
|
2070
|
-
console.log(`[StatePersistencePlugin] State ${
|
|
2145
|
+
for (const [r, o] of Object.entries(s))
|
|
2146
|
+
console.log(`[StatePersistencePlugin] State ${r}:`, {
|
|
2071
2147
|
isDemoContainer: o.isDemoContainer,
|
|
2072
2148
|
isClosed: o.isClosed,
|
|
2073
2149
|
title: o.title
|
|
@@ -2091,22 +2167,22 @@ const n = class n {
|
|
|
2091
2167
|
));
|
|
2092
2168
|
}
|
|
2093
2169
|
};
|
|
2094
|
-
|
|
2095
|
-
|
|
2170
|
+
a(n, "_pluginId", Symbol("StatePersistencePlugin")), a(n, "STORAGE_KEY", "containerManagerState"), a(n, "CLOSED_QUEUE_KEY", "containerManagerClosedQueue"), a(n, "DEMO_CONTAINERS_KEY", "containerManagerDemoContainers"), // Статическое реактивное состояние для всех плагинов
|
|
2171
|
+
a(n, "reactiveState", $({
|
|
2096
2172
|
isSaving: !1,
|
|
2097
2173
|
lastSaved: null,
|
|
2098
2174
|
pendingChanges: !1,
|
|
2099
2175
|
containerStates: {},
|
|
2100
2176
|
closedQueue: [],
|
|
2101
2177
|
demoContainers: []
|
|
2102
|
-
})),
|
|
2178
|
+
})), a(n, "isGlobalEventsInitialized", !1), a(n, "containers", []);
|
|
2103
2179
|
let H = n;
|
|
2104
2180
|
H.initializeReactiveState();
|
|
2105
2181
|
const L = class L {
|
|
2106
2182
|
constructor() {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2183
|
+
a(this, "manager");
|
|
2184
|
+
a(this, "containerName", "");
|
|
2185
|
+
a(this, "notificationSystem", null);
|
|
2110
2186
|
}
|
|
2111
2187
|
get pluginId() {
|
|
2112
2188
|
return L._pluginId;
|
|
@@ -2200,19 +2276,21 @@ const L = class L {
|
|
|
2200
2276
|
}
|
|
2201
2277
|
}
|
|
2202
2278
|
};
|
|
2203
|
-
|
|
2279
|
+
a(L, "_pluginId", Symbol("LoggingPlugin"));
|
|
2204
2280
|
let K = L;
|
|
2205
2281
|
export {
|
|
2206
2282
|
pt as ContainerInitializer,
|
|
2207
|
-
|
|
2208
|
-
|
|
2283
|
+
V as ContainerManager,
|
|
2284
|
+
vt as ContentCreator,
|
|
2209
2285
|
j as EdgeDockingPlugin,
|
|
2210
2286
|
K as LoggingPlugin,
|
|
2211
2287
|
it as NotificationSystem,
|
|
2212
2288
|
U as SnappingPlugin,
|
|
2213
2289
|
H as StatePersistencePlugin,
|
|
2290
|
+
ft as StatsManager,
|
|
2214
2291
|
J as TemplateLoader,
|
|
2215
|
-
|
|
2216
|
-
|
|
2292
|
+
lt as getState,
|
|
2293
|
+
Et as getTemplateLoader,
|
|
2294
|
+
St as initializeTemplateSystem
|
|
2217
2295
|
};
|
|
2218
2296
|
//# sourceMappingURL=index.es.js.map
|