@alekstar79/draggable-resizable-container 1.0.2 → 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 +3 -2
- package/dist/index.es.js +1407 -81
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +117 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/media-BMYuYfio.js +25 -0
- package/dist/media-BMYuYfio.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/stats-CfbjjoNm.js +36 -0
- package/dist/stats-CfbjjoNm.js.map +1 -0
- package/dist/tasks-dygJ8dHT.js +34 -0
- package/dist/tasks-dygJ8dHT.js.map +1 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import './index.css';var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
4
|
-
import
|
|
5
|
-
import { clamp as
|
|
6
|
-
class
|
|
1
|
+
import './index.css';var Z = Object.defineProperty;
|
|
2
|
+
var _ = (c, t, e) => t in c ? Z(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
|
|
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
|
+
class it {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
a(this, "container");
|
|
9
9
|
this.container = t || this.createContainer();
|
|
@@ -60,17 +60,17 @@ class R {
|
|
|
60
60
|
this.container.removeChild(this.container.firstChild);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
new
|
|
64
|
-
class
|
|
63
|
+
new it();
|
|
64
|
+
class pt {
|
|
65
65
|
/**
|
|
66
66
|
* Create container element with proper initialization
|
|
67
67
|
*/
|
|
68
68
|
static createContainerElement(t, e, i, s, r) {
|
|
69
|
-
const
|
|
70
|
-
return
|
|
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`), 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;
|
|
@@ -106,10 +106,86 @@ class k {
|
|
|
106
106
|
this.templateLoader = t;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
class C {
|
|
109
|
+
class ft {
|
|
111
110
|
constructor() {
|
|
112
|
-
|
|
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
|
+
}
|
|
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);
|
|
186
|
+
class I {
|
|
187
|
+
constructor() {
|
|
188
|
+
m(this, "templates", /* @__PURE__ */ new Map()), m(this, "lastUpdated", /* @__PURE__ */ new Map());
|
|
113
189
|
}
|
|
114
190
|
register(t) {
|
|
115
191
|
if (!t.name.trim()) throw new Error("Template name cannot be empty");
|
|
@@ -138,9 +214,9 @@ class C {
|
|
|
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
|
}
|
|
145
221
|
set(t, e) {
|
|
146
222
|
this.cache.set(t, { content: e, timestamp: Date.now() });
|
|
@@ -159,9 +235,9 @@ class L {
|
|
|
159
235
|
return this.cache.size;
|
|
160
236
|
}
|
|
161
237
|
}
|
|
162
|
-
class
|
|
238
|
+
class J {
|
|
163
239
|
constructor(t, e = {}) {
|
|
164
|
-
|
|
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;
|
|
@@ -173,27 +249,27 @@ class A {
|
|
|
173
249
|
async loadTemplate(t, e = 2) {
|
|
174
250
|
const i = performance.now(), s = this.retryQueue.get(t) ?? 0;
|
|
175
251
|
if (this.metrics.totalLoads++, this.config.cache) {
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
252
|
+
const o = this.cache.get(t);
|
|
253
|
+
if (o) return this.metrics.totalHits++, this.updateCacheHitRate(), o;
|
|
178
254
|
}
|
|
179
255
|
this.metrics.totalMisses++;
|
|
180
256
|
const r = this.registry.get(t);
|
|
181
257
|
if (!r) {
|
|
182
|
-
const
|
|
183
|
-
return this.metrics.totalErrors++, this.config.onError(
|
|
258
|
+
const o = this.createError(`Template "${t}" not found. Available: ${this.registry.list().join(", ")}`, t, s);
|
|
259
|
+
return this.metrics.totalErrors++, this.config.onError(o), this.config.fallbackTemplate;
|
|
184
260
|
}
|
|
185
261
|
try {
|
|
186
|
-
let
|
|
187
|
-
if (typeof
|
|
188
|
-
const h = this.createError("Template source must return a string, got " + typeof
|
|
262
|
+
let o = typeof r.source == "function" ? await r.source() : r.source;
|
|
263
|
+
if (typeof o != "string") {
|
|
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;
|
|
190
266
|
}
|
|
191
|
-
return this.config.cache && this.cache.set(t,
|
|
192
|
-
} catch (
|
|
193
|
-
const h =
|
|
194
|
-
if (s < e) return this.retryQueue.set(t, s + 1), this.config.onWarn(`Retrying template "${t}" (attempt ${s + 1}/${e})`), await new Promise((
|
|
195
|
-
const
|
|
196
|
-
return this.metrics.totalErrors++, this.config.onError(
|
|
267
|
+
return this.config.cache && this.cache.set(t, o), this.retryQueue.delete(t), this.recordLoadTime(i), o;
|
|
268
|
+
} catch (o) {
|
|
269
|
+
const h = o instanceof Error ? o : new Error(String(o));
|
|
270
|
+
if (s < e) return this.retryQueue.set(t, s + 1), this.config.onWarn(`Retrying template "${t}" (attempt ${s + 1}/${e})`), await new Promise((l) => setTimeout(l, 100 * Math.pow(2, s))), this.loadTemplate(t, e);
|
|
271
|
+
const d = this.createError(`Failed to load template "${t}": ${h.message}`, t, s);
|
|
272
|
+
return this.metrics.totalErrors++, this.config.onError(d), this.retryQueue.delete(t), this.config.fallbackTemplate;
|
|
197
273
|
}
|
|
198
274
|
}
|
|
199
275
|
async loadTemplates(t) {
|
|
@@ -233,12 +309,373 @@ class A {
|
|
|
233
309
|
this.config.enableMetrics && (this.metrics.cacheHitRate = this.metrics.totalHits / this.metrics.totalLoads);
|
|
234
310
|
}
|
|
235
311
|
}
|
|
236
|
-
|
|
312
|
+
let u;
|
|
313
|
+
async function rt(c = []) {
|
|
314
|
+
const t = new I();
|
|
315
|
+
let e = {};
|
|
316
|
+
try {
|
|
317
|
+
e = /* @__PURE__ */ Object.assign({
|
|
318
|
+
"../demo/templates/media.html": () => import("./media-BMYuYfio.js").then((s) => s.default),
|
|
319
|
+
"../demo/templates/stats.html": () => import("./stats-CfbjjoNm.js").then((s) => s.default),
|
|
320
|
+
"../demo/templates/tasks.html": () => import("./tasks-dygJ8dHT.js").then((s) => s.default)
|
|
321
|
+
});
|
|
322
|
+
const i = {};
|
|
323
|
+
Object.entries(e).forEach(([s, r]) => {
|
|
324
|
+
var h;
|
|
325
|
+
const o = (h = s.split("/").pop()) == null ? void 0 : h.replace(/\.html$/, "");
|
|
326
|
+
o && (i[o] = async () => typeof r == "function" ? await r() : String(r));
|
|
327
|
+
}), await t.registerBulk(i);
|
|
328
|
+
} catch (i) {
|
|
329
|
+
console.error("[TemplateLoader] Failed to load templates:", i), c.forEach(({ name: s, source: r }) => {
|
|
330
|
+
t.register({ name: s, source: r });
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return new J(t, {
|
|
334
|
+
environment: "development",
|
|
335
|
+
cache: !0,
|
|
336
|
+
cacheTTL: 36e5,
|
|
337
|
+
enableMetrics: !0,
|
|
338
|
+
fallbackTemplate: '<div class="template-error">Template not found</div>',
|
|
339
|
+
onError: (i) => console.error(`[TemplateLoader Error] ${i.templateName}:`, i.message),
|
|
340
|
+
onWarn: (i) => console.warn(`[TemplateLoader] ${i}`)
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function ot() {
|
|
344
|
+
const c = new I();
|
|
345
|
+
return new J(c, {
|
|
346
|
+
environment: "production",
|
|
347
|
+
cache: !0,
|
|
348
|
+
cacheTTL: 36e5,
|
|
349
|
+
enableMetrics: !1,
|
|
350
|
+
onWarn: (t) => console.warn(`[TemplateLoader] ${t}`),
|
|
351
|
+
onError: (t) => {
|
|
352
|
+
console.warn(`Template load failed: ${t.templateName}`);
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
async function St() {
|
|
357
|
+
return u || (// @ts-ignore - Vite environment variable
|
|
358
|
+
typeof process < "u" && process.env && process.env.NODE_ENV === "development" ? u = await rt() : (u = ot(), u.registry.register({
|
|
359
|
+
name: "media",
|
|
360
|
+
source: async () => (await fetch("./templates/media.html")).text(),
|
|
361
|
+
metadata: {
|
|
362
|
+
version: "1.0",
|
|
363
|
+
description: "Media card",
|
|
364
|
+
cached: !0
|
|
365
|
+
}
|
|
366
|
+
}), u.registry.register({
|
|
367
|
+
name: "userProfile",
|
|
368
|
+
source: '<div class="user-profile"><h2>Profile</h2></div>',
|
|
369
|
+
metadata: {
|
|
370
|
+
version: "1.0",
|
|
371
|
+
description: "User profile card",
|
|
372
|
+
cached: !0
|
|
373
|
+
}
|
|
374
|
+
})), u);
|
|
375
|
+
}
|
|
376
|
+
function Et() {
|
|
377
|
+
if (!u)
|
|
378
|
+
throw new Error("Template system not initialized. Call initializeTemplateSystem() first.");
|
|
379
|
+
return u;
|
|
380
|
+
}
|
|
381
|
+
function ct(c, [t, e]) {
|
|
382
|
+
return e ? { ...c, [t]: e } : c;
|
|
383
|
+
}
|
|
384
|
+
class W {
|
|
385
|
+
constructor(t) {
|
|
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);
|
|
393
|
+
Object.assign(this, t);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
class X {
|
|
397
|
+
constructor() {
|
|
398
|
+
a(this, "listeners", {});
|
|
399
|
+
}
|
|
400
|
+
on(t, e) {
|
|
401
|
+
return this.listeners[t] || (this.listeners[t] = /* @__PURE__ */ new Set()), this.listeners[t].add(e), () => {
|
|
402
|
+
var i;
|
|
403
|
+
(i = this.off) == null || i.call(this, t, e);
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
emit(t, e) {
|
|
407
|
+
var i;
|
|
408
|
+
(i = this.listeners[t]) == null || i.forEach((s) => {
|
|
409
|
+
try {
|
|
410
|
+
s(e);
|
|
411
|
+
} catch (r) {
|
|
412
|
+
console.error(`Error in event listener for ${String(t)}:`, r);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
off(t, e) {
|
|
417
|
+
var i;
|
|
418
|
+
(i = this.listeners[t]) == null || i.delete(e);
|
|
419
|
+
}
|
|
420
|
+
destroy() {
|
|
421
|
+
this.listeners = {};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
class ht {
|
|
425
|
+
constructor(t = 50, e, i = null) {
|
|
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", {
|
|
435
|
+
top: !1,
|
|
436
|
+
right: !1,
|
|
437
|
+
bottom: !1,
|
|
438
|
+
left: !1,
|
|
439
|
+
edge: null
|
|
440
|
+
});
|
|
441
|
+
this.edgeThreshold = t, this.targets = e instanceof Set ? e : new Set(e), this.root = i, e && e.forEach((s) => this.targets.add(s)), this.checkBoundaries = this.checkBoundaries.bind(this);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Start tracking the approach to the edges
|
|
445
|
+
*/
|
|
446
|
+
start() {
|
|
447
|
+
this.isActive || (this.isActive = !0, this.setupMouseTracking(), this.checkBoundaries());
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Stop tracking
|
|
451
|
+
*/
|
|
452
|
+
stop() {
|
|
453
|
+
this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.isActive = !1;
|
|
454
|
+
}
|
|
455
|
+
addTarget(t) {
|
|
456
|
+
this.targets.add(t);
|
|
457
|
+
}
|
|
458
|
+
removeTarget(t) {
|
|
459
|
+
this.targets.delete(t), this.currentEdges.delete(t);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Subscribe to boundary changes
|
|
463
|
+
*/
|
|
464
|
+
onChange(t) {
|
|
465
|
+
return this.callbacks.add(t), () => {
|
|
466
|
+
this.callbacks.delete(t);
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Get current information about cursor boundaries
|
|
471
|
+
*/
|
|
472
|
+
getCursorEdgeInfo() {
|
|
473
|
+
return { ...this.currentCursorEdge };
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Update threshold (distance to edge)
|
|
477
|
+
*/
|
|
478
|
+
setEdgeThreshold(t) {
|
|
479
|
+
if (t < 0)
|
|
480
|
+
throw new Error("Edge threshold must be non-negative");
|
|
481
|
+
this.edgeThreshold = t;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Set up Mouse Tracking
|
|
485
|
+
*/
|
|
486
|
+
setupMouseTracking() {
|
|
487
|
+
document.addEventListener("mousemove", (t) => {
|
|
488
|
+
this.currentMousePos = { x: t.clientX, y: t.clientY };
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
getViewportSize() {
|
|
492
|
+
return this.root ? { width: this.root.clientWidth, height: this.root.clientHeight } : { width: window.innerWidth, height: window.innerHeight };
|
|
493
|
+
}
|
|
494
|
+
getRelativeRect(t) {
|
|
495
|
+
const e = t.getBoundingClientRect();
|
|
496
|
+
if (!this.root) return e;
|
|
497
|
+
const i = this.root.getBoundingClientRect();
|
|
498
|
+
return {
|
|
499
|
+
x: e.left - i.left,
|
|
500
|
+
y: e.top - i.top,
|
|
501
|
+
top: e.top - i.top,
|
|
502
|
+
bottom: e.bottom - i.top,
|
|
503
|
+
left: e.left - i.left,
|
|
504
|
+
right: e.right - i.left,
|
|
505
|
+
height: e.height,
|
|
506
|
+
width: e.width,
|
|
507
|
+
toJSON: () => {
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
getCursorPosition() {
|
|
512
|
+
if (!this.root) return this.currentMousePos;
|
|
513
|
+
const t = this.root.getBoundingClientRect();
|
|
514
|
+
return {
|
|
515
|
+
x: this.currentMousePos.x - t.left,
|
|
516
|
+
y: this.currentMousePos.y - t.top
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Check the proximity to the borders (element and cursor)
|
|
521
|
+
*/
|
|
522
|
+
checkBoundaries() {
|
|
523
|
+
this.targets.forEach((e) => {
|
|
524
|
+
const i = this.checkElementBoundaries(e), s = this.currentEdges.get(e);
|
|
525
|
+
(!s || this.hasEdgeChanged(s, i)) && (this.currentEdges.set(e, i), this.notifyCallbacks(new W({ ...i, source: "element", element: e })));
|
|
526
|
+
});
|
|
527
|
+
const t = this.checkCursorBoundaries();
|
|
528
|
+
this.hasEdgeChanged(this.currentCursorEdge, t) && (this.currentCursorEdge = t, this.notifyCallbacks(new W({ ...t, source: "cursor", element: null }))), this.isActive && (this.rafId = requestAnimationFrame(
|
|
529
|
+
this.checkBoundaries
|
|
530
|
+
));
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Emulating Bounding Rect for cursor
|
|
534
|
+
*/
|
|
535
|
+
getCursorBoundingClientRect() {
|
|
536
|
+
const { x: t, y: e } = this.getCursorPosition();
|
|
537
|
+
return {
|
|
538
|
+
x: t,
|
|
539
|
+
y: e,
|
|
540
|
+
top: e,
|
|
541
|
+
bottom: e,
|
|
542
|
+
left: t,
|
|
543
|
+
right: t,
|
|
544
|
+
width: 0,
|
|
545
|
+
height: 0,
|
|
546
|
+
toJSON: () => {
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Check the boundaries of an element
|
|
552
|
+
*/
|
|
553
|
+
checkElementBoundaries(t) {
|
|
554
|
+
const { width: e, height: i } = this.getViewportSize(), s = this.getRelativeRect(t), r = {
|
|
555
|
+
top: s.top < this.edgeThreshold,
|
|
556
|
+
right: s.right > e - this.edgeThreshold,
|
|
557
|
+
bottom: s.bottom > i - this.edgeThreshold,
|
|
558
|
+
left: s.left < this.edgeThreshold,
|
|
559
|
+
edge: null
|
|
560
|
+
};
|
|
561
|
+
return this.determineEdge(r, s, e, i), r;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Check the boundaries of a cursor
|
|
565
|
+
*/
|
|
566
|
+
checkCursorBoundaries() {
|
|
567
|
+
const t = this.getCursorBoundingClientRect(), e = window.innerWidth, i = window.innerHeight, s = {
|
|
568
|
+
top: t.top < this.edgeThreshold,
|
|
569
|
+
right: t.right > e - this.edgeThreshold,
|
|
570
|
+
bottom: t.bottom > i - this.edgeThreshold,
|
|
571
|
+
left: t.left < this.edgeThreshold,
|
|
572
|
+
edge: null
|
|
573
|
+
};
|
|
574
|
+
return this.determineEdge(s, t, e, i), s;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Check if the state has changed
|
|
578
|
+
*/
|
|
579
|
+
hasEdgeChanged(t, e) {
|
|
580
|
+
return t.top !== e.top || t.right !== e.right || t.bottom !== e.bottom || t.left !== e.left;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Determine a priority edge-side (or several)
|
|
584
|
+
*/
|
|
585
|
+
determineEdge(t, e, i, s) {
|
|
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)
|
|
588
|
+
t.edge = null;
|
|
589
|
+
else if (r.length === 1)
|
|
590
|
+
t.edge = r[0];
|
|
591
|
+
else {
|
|
592
|
+
const o = {
|
|
593
|
+
top: e.top,
|
|
594
|
+
right: i - e.right,
|
|
595
|
+
bottom: s - e.bottom,
|
|
596
|
+
left: e.left
|
|
597
|
+
};
|
|
598
|
+
t.edge = r.reduce(
|
|
599
|
+
(h, d) => o[d] < o[h] ? d : h
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Notify all subscribers of the change
|
|
605
|
+
*/
|
|
606
|
+
notifyCallbacks(t) {
|
|
607
|
+
this.callbacks.forEach((e) => {
|
|
608
|
+
try {
|
|
609
|
+
e(t);
|
|
610
|
+
} catch (i) {
|
|
611
|
+
console.error("Error in boundary change callback:", i);
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Clear resources
|
|
617
|
+
*/
|
|
618
|
+
destroy() {
|
|
619
|
+
this.stop(), this.callbacks.clear();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
const y = class y extends ht {
|
|
623
|
+
constructor(e, i) {
|
|
624
|
+
super(e, i);
|
|
625
|
+
a(this, "lastEdge", {});
|
|
626
|
+
a(this, "emitter", null);
|
|
627
|
+
this.onChange(this.onBoundaryChange.bind(this)), this.start();
|
|
628
|
+
}
|
|
629
|
+
static init(e, i) {
|
|
630
|
+
return y.instance ?? (y.instance = new y(e, i));
|
|
631
|
+
}
|
|
632
|
+
changed({ edge: e, source: i, element: s }) {
|
|
633
|
+
return e !== this.lastEdge.edge || i !== this.lastEdge.source || s !== this.lastEdge.element;
|
|
634
|
+
}
|
|
635
|
+
onBoundaryChange({ edge: e, source: i, element: s }) {
|
|
636
|
+
this.changed({ edge: e, source: i, element: s }) && (this.lastEdge = Object.entries({ edge: e, source: i, element: s }).reduce(ct, {}), s ? e ? this.onEdgeEnter({ edge: e, source: i, element: s }) : this.onEdgeLeave(this.lastEdge) : e ? this.onCursorEnter({ edge: e, source: i }) : this.onCursorLeave(this.lastEdge));
|
|
637
|
+
}
|
|
638
|
+
onEdgeEnter(e) {
|
|
639
|
+
var i;
|
|
640
|
+
(i = this.emitter) == null || i.emit("edge:enter", e);
|
|
641
|
+
}
|
|
642
|
+
onEdgeLeave(e) {
|
|
643
|
+
var i;
|
|
644
|
+
(i = this.emitter) == null || i.emit("edge:leave", e);
|
|
645
|
+
}
|
|
646
|
+
onCursorEnter(e) {
|
|
647
|
+
var i;
|
|
648
|
+
(i = this.emitter) == null || i.emit("cursor:enter", e);
|
|
649
|
+
}
|
|
650
|
+
onCursorLeave(e) {
|
|
651
|
+
var i;
|
|
652
|
+
(i = this.emitter) == null || i.emit("cursor:leave", e);
|
|
653
|
+
}
|
|
654
|
+
setEmitter(e) {
|
|
655
|
+
this.emitter = e;
|
|
656
|
+
}
|
|
657
|
+
on(e, i) {
|
|
658
|
+
var s;
|
|
659
|
+
(s = this.emitter) == null || s.on(e, i);
|
|
660
|
+
}
|
|
661
|
+
getCurrentEdge() {
|
|
662
|
+
return this.lastEdge;
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
a(y, "instance");
|
|
666
|
+
let P = y;
|
|
667
|
+
function dt(c = {}, t = []) {
|
|
668
|
+
const e = P.init(c.edgeThreshold, t);
|
|
669
|
+
return c.emitter && e.setEmitter(
|
|
670
|
+
c.emitter instanceof X ? c.emitter : new X()
|
|
671
|
+
), e;
|
|
672
|
+
}
|
|
673
|
+
const g = class g {
|
|
237
674
|
constructor() {
|
|
238
675
|
a(this, "draggable", []);
|
|
239
676
|
}
|
|
240
677
|
zIndex(t) {
|
|
241
|
-
return `${
|
|
678
|
+
return `${g.highestZIndex + this.draggable.findIndex((e) => e === t)}`;
|
|
242
679
|
}
|
|
243
680
|
push(t) {
|
|
244
681
|
return this.draggable = [.../* @__PURE__ */ new Set([...this.draggable, t])], this;
|
|
@@ -250,18 +687,18 @@ const c = class c {
|
|
|
250
687
|
return this.draggable.sort((e, i) => e === t ? 1 : i === t ? -1 : 0), this;
|
|
251
688
|
}
|
|
252
689
|
};
|
|
253
|
-
a(
|
|
254
|
-
let
|
|
255
|
-
function
|
|
690
|
+
a(g, "inatance"), a(g, "highestZIndex", 1e3), a(g, "init", () => g.inatance ?? (g.inatance = new g()));
|
|
691
|
+
let O = g;
|
|
692
|
+
function G() {
|
|
256
693
|
return {
|
|
257
694
|
width: window.innerWidth || document.documentElement.clientWidth,
|
|
258
695
|
height: window.innerHeight || document.documentElement.clientHeight
|
|
259
696
|
};
|
|
260
697
|
}
|
|
261
|
-
function
|
|
262
|
-
return
|
|
698
|
+
function lt() {
|
|
699
|
+
return O.init();
|
|
263
700
|
}
|
|
264
|
-
const
|
|
701
|
+
const f = class f {
|
|
265
702
|
/**
|
|
266
703
|
* Create a new container manager instance with reactive state management
|
|
267
704
|
* @param container - HTML element to manage
|
|
@@ -289,7 +726,7 @@ const g = class g {
|
|
|
289
726
|
a(this, "resizeObserver", null);
|
|
290
727
|
a(this, "parentResizeObserver", null);
|
|
291
728
|
a(this, "zIndexState");
|
|
292
|
-
a(this, "reactiveState",
|
|
729
|
+
a(this, "reactiveState", $({
|
|
293
730
|
x: 0,
|
|
294
731
|
y: 0,
|
|
295
732
|
width: 0,
|
|
@@ -298,28 +735,28 @@ const g = class g {
|
|
|
298
735
|
draggingDirection: "all"
|
|
299
736
|
}));
|
|
300
737
|
// Computed state with applied constraints
|
|
301
|
-
a(this, "constrainedState",
|
|
738
|
+
a(this, "constrainedState", tt(() => {
|
|
302
739
|
var s;
|
|
303
740
|
const t = this.reactiveState;
|
|
304
741
|
if (!this.config) return { ...t };
|
|
305
742
|
let e = { ...t };
|
|
306
743
|
const { boundaries: i } = this.config;
|
|
307
|
-
if (e.width =
|
|
744
|
+
if (e.width = v(
|
|
308
745
|
t.width,
|
|
309
|
-
i.minWidth ||
|
|
746
|
+
i.minWidth || f.MINWIDTH,
|
|
310
747
|
i.maxWidth || 1 / 0
|
|
311
|
-
), e.height =
|
|
748
|
+
), e.height = v(
|
|
312
749
|
t.height,
|
|
313
|
-
i.minHeight ||
|
|
750
|
+
i.minHeight || f.MINHEIGHT,
|
|
314
751
|
i.maxHeight || 1 / 0
|
|
315
752
|
), this.shouldConstrainToViewport()) {
|
|
316
|
-
const r =
|
|
317
|
-
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);
|
|
318
755
|
}
|
|
319
756
|
return (s = this.config) != null && s.constrainToParent && (e = this.constrainToParent(e)), e;
|
|
320
757
|
}));
|
|
321
758
|
// Automatic DOM updates with reactive effect
|
|
322
|
-
a(this, "domUpdateEffect",
|
|
759
|
+
a(this, "domUpdateEffect", k(() => {
|
|
323
760
|
var e;
|
|
324
761
|
const t = this.constrainedState.value;
|
|
325
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", {
|
|
@@ -329,15 +766,15 @@ const g = class g {
|
|
|
329
766
|
element: this.container
|
|
330
767
|
}));
|
|
331
768
|
}));
|
|
332
|
-
this.config =
|
|
769
|
+
this.config = et({
|
|
333
770
|
_uid: "",
|
|
334
771
|
mode: "smooth",
|
|
335
772
|
constrainToViewport: !1,
|
|
336
773
|
draggingDirection: "all",
|
|
337
774
|
constrainToParent: !1,
|
|
338
775
|
boundaries: {
|
|
339
|
-
minWidth:
|
|
340
|
-
minHeight:
|
|
776
|
+
minWidth: f.MINWIDTH,
|
|
777
|
+
minHeight: f.MINHEIGHT
|
|
341
778
|
},
|
|
342
779
|
autoAdjust: {
|
|
343
780
|
enabled: !1,
|
|
@@ -348,9 +785,9 @@ const g = class g {
|
|
|
348
785
|
enabled: !0,
|
|
349
786
|
directions: ["se"]
|
|
350
787
|
}
|
|
351
|
-
}, e), this.container = t, this.zIndexState =
|
|
788
|
+
}, e), this.container = t, this.zIndexState = lt();
|
|
352
789
|
const i = this.getCurrentState();
|
|
353
|
-
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
|
|
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();
|
|
354
791
|
}
|
|
355
792
|
/**
|
|
356
793
|
* Set up ResizeObserver to track viewport and parent size changes
|
|
@@ -381,7 +818,7 @@ const g = class g {
|
|
|
381
818
|
*/
|
|
382
819
|
handleViewportResize() {
|
|
383
820
|
if (!this.shouldConstrainToViewport()) return;
|
|
384
|
-
const t =
|
|
821
|
+
const t = G(), i = { ...this.getState() };
|
|
385
822
|
let s = !1;
|
|
386
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", {
|
|
387
824
|
type: "viewportResize",
|
|
@@ -407,16 +844,16 @@ const g = class g {
|
|
|
407
844
|
const { autoAdjust: e } = this.config;
|
|
408
845
|
if (!(e != null && e.enabled)) return;
|
|
409
846
|
const i = t.contentRect, r = { ...this.getState() };
|
|
410
|
-
let
|
|
847
|
+
let o = !1;
|
|
411
848
|
if (e.width) {
|
|
412
|
-
const h = this.getMaxWidthConstraint(),
|
|
413
|
-
Math.abs(r.width -
|
|
849
|
+
const h = this.getMaxWidthConstraint(), d = Math.min(i.width, h);
|
|
850
|
+
Math.abs(r.width - d) > 1 && (r.width = d, o = !0);
|
|
414
851
|
}
|
|
415
852
|
if (e.height) {
|
|
416
|
-
const h = this.getMaxHeightConstraint(),
|
|
417
|
-
Math.abs(r.height -
|
|
853
|
+
const h = this.getMaxHeightConstraint(), d = Math.min(i.height, h);
|
|
854
|
+
Math.abs(r.height - d) > 1 && (r.height = d, o = !0);
|
|
418
855
|
}
|
|
419
|
-
|
|
856
|
+
o && (this.setState(r), this.eventEmitter.emit("autoAdjust", {
|
|
420
857
|
type: "autoAdjust",
|
|
421
858
|
state: this.getState(),
|
|
422
859
|
mode: this.reactiveState.mode,
|
|
@@ -558,12 +995,12 @@ const g = class g {
|
|
|
558
995
|
const i = e.getBoundingClientRect();
|
|
559
996
|
if (i.width === 0 || i.height === 0)
|
|
560
997
|
return t;
|
|
561
|
-
const s = Math.max(0, i.width - t.width), r = Math.max(0, i.height - t.height),
|
|
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;
|
|
562
999
|
return {
|
|
563
|
-
x:
|
|
564
|
-
y:
|
|
565
|
-
width:
|
|
566
|
-
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)
|
|
567
1004
|
};
|
|
568
1005
|
}
|
|
569
1006
|
/**
|
|
@@ -628,11 +1065,11 @@ const g = class g {
|
|
|
628
1065
|
* Setup reactive monitoring for container metrics
|
|
629
1066
|
*/
|
|
630
1067
|
setupReactiveMonitoring() {
|
|
631
|
-
const t =
|
|
1068
|
+
const t = k(() => {
|
|
632
1069
|
const { state: i } = this.stateChangeStream;
|
|
633
1070
|
});
|
|
634
1071
|
this.reactiveEffects.push(t);
|
|
635
|
-
const e =
|
|
1072
|
+
const e = k(() => {
|
|
636
1073
|
const i = this.eventEmitter.getMetrics();
|
|
637
1074
|
i.state.errorCount > 10 && console.warn("[ContainerManager] High error count in event system:", i.state.errorCount);
|
|
638
1075
|
});
|
|
@@ -738,8 +1175,8 @@ const g = class g {
|
|
|
738
1175
|
const { clientX: e, clientY: i } = this.directionResolver(
|
|
739
1176
|
t instanceof MouseEvent ? t.clientX : t.touches[0].clientX,
|
|
740
1177
|
t instanceof MouseEvent ? t.clientY : t.touches[0].clientY
|
|
741
|
-
), s = e - this.startX, r = i - this.startY,
|
|
742
|
-
this.setState(
|
|
1178
|
+
), s = e - this.startX, r = i - this.startY, o = this.applyMovementMode(s, r);
|
|
1179
|
+
this.setState(o), this.eventEmitter.emit("drag", {
|
|
743
1180
|
type: "drag",
|
|
744
1181
|
state: this.getState(),
|
|
745
1182
|
mode: this.reactiveState.mode,
|
|
@@ -776,8 +1213,8 @@ const g = class g {
|
|
|
776
1213
|
*/
|
|
777
1214
|
onResizeMove(t) {
|
|
778
1215
|
if (!this.isResizing || !this.resizeDirection) return;
|
|
779
|
-
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,
|
|
780
|
-
this.setState(
|
|
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);
|
|
1217
|
+
this.setState(o), this.eventEmitter.emit("resize", {
|
|
781
1218
|
type: "resize",
|
|
782
1219
|
state: this.getState(),
|
|
783
1220
|
mode: this.reactiveState.mode,
|
|
@@ -913,12 +1350,12 @@ const g = class g {
|
|
|
913
1350
|
const t = this.container.parentElement.getBoundingClientRect(), e = this.getState();
|
|
914
1351
|
if (t.width === 0 || t.height === 0)
|
|
915
1352
|
return;
|
|
916
|
-
const i = e.width, s = e.height, r = Math.min(i, t.width),
|
|
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);
|
|
917
1354
|
this.setState({
|
|
918
|
-
x:
|
|
919
|
-
y,
|
|
1355
|
+
x: l,
|
|
1356
|
+
y: S,
|
|
920
1357
|
width: r,
|
|
921
|
-
height:
|
|
1358
|
+
height: o
|
|
922
1359
|
}), this.eventEmitter.emit("parentRecalculated", {
|
|
923
1360
|
type: "parentRecalculated",
|
|
924
1361
|
state: this.getState(),
|
|
@@ -959,12 +1396,901 @@ const g = class g {
|
|
|
959
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);
|
|
960
1397
|
}
|
|
961
1398
|
};
|
|
962
|
-
a(
|
|
963
|
-
let
|
|
1399
|
+
a(f, "MINWIDTH", 200), a(f, "MINHEIGHT", 45);
|
|
1400
|
+
let V = f;
|
|
1401
|
+
const x = class x {
|
|
1402
|
+
constructor(t = {}) {
|
|
1403
|
+
// Plugin state
|
|
1404
|
+
a(this, "reactiveState", $({
|
|
1405
|
+
snapStep: 10,
|
|
1406
|
+
enabled: !0,
|
|
1407
|
+
isActive: !1,
|
|
1408
|
+
lastPosition: null
|
|
1409
|
+
}));
|
|
1410
|
+
a(this, "manager");
|
|
1411
|
+
a(this, "startState", null);
|
|
1412
|
+
a(this, "startX", 0);
|
|
1413
|
+
a(this, "startY", 0);
|
|
1414
|
+
this.reactiveState.snapStep = t.snapStep ?? 10, this.reactiveState.enabled = t.enabled ?? !0, this.onDragMove = this.onDragMove.bind(this), this.onDragEnd = this.onDragEnd.bind(this);
|
|
1415
|
+
}
|
|
1416
|
+
get pluginId() {
|
|
1417
|
+
return x._pluginId;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Install plugin on container manager instance with reactive state
|
|
1421
|
+
*/
|
|
1422
|
+
install(t, e) {
|
|
1423
|
+
this.manager = t, e && (this.reactiveState.snapStep = e.snapStep ?? this.reactiveState.snapStep, this.reactiveState.enabled = e.enabled ?? this.reactiveState.enabled), this.overrideDragMethods(), this.addPluginMethods();
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* Override drag handling methods to add snapping functionality
|
|
1427
|
+
*/
|
|
1428
|
+
overrideDragMethods() {
|
|
1429
|
+
if (!this.manager) return;
|
|
1430
|
+
const t = this.manager.getContainer().querySelector(".drag-handle");
|
|
1431
|
+
t && (t.onmousedown = (e) => {
|
|
1432
|
+
this.onDragStart(e);
|
|
1433
|
+
}, t.ontouchstart = (e) => {
|
|
1434
|
+
this.onDragStart(e);
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Handle drag start event with snapping support
|
|
1439
|
+
*/
|
|
1440
|
+
onDragStart(t) {
|
|
1441
|
+
var s, r;
|
|
1442
|
+
if (!this.manager || this.manager.getMode() === "pinned") return;
|
|
1443
|
+
t.preventDefault(), (r = (s = this.manager).bringToFront) == null || r.call(s), this.reactiveState.isActive = !0;
|
|
1444
|
+
const e = t instanceof MouseEvent ? t.clientX : t.touches[0].clientX, i = t instanceof MouseEvent ? t.clientY : t.touches[0].clientY;
|
|
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", {
|
|
1446
|
+
type: "drag",
|
|
1447
|
+
state: this.startState,
|
|
1448
|
+
mode: this.manager.getMode()
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Handle drag movement with reactive snapping
|
|
1453
|
+
*/
|
|
1454
|
+
onDragMove(t) {
|
|
1455
|
+
if (!this.reactiveState.isActive || !this.manager || !this.startState) return;
|
|
1456
|
+
const { clientX: e, clientY: i } = this.manager.directionResolver(
|
|
1457
|
+
t instanceof MouseEvent ? t.clientX : t.touches[0].clientX,
|
|
1458
|
+
t instanceof MouseEvent ? t.clientY : t.touches[0].clientY
|
|
1459
|
+
);
|
|
1460
|
+
let s = e - this.startX, r = i - this.startY;
|
|
1461
|
+
if (this.reactiveState.enabled) {
|
|
1462
|
+
const d = this.applySnapping(s, r);
|
|
1463
|
+
s = d.deltaX, r = d.deltaY;
|
|
1464
|
+
}
|
|
1465
|
+
const o = {
|
|
1466
|
+
x: this.startState.x + s,
|
|
1467
|
+
y: this.startState.y + r,
|
|
1468
|
+
width: this.startState.width,
|
|
1469
|
+
height: this.startState.height
|
|
1470
|
+
}, h = this.manager.config;
|
|
1471
|
+
h != null && h.constrainToViewport && this.constrainToViewport(o), this.manager.setState(o), this.reactiveState.lastPosition = { x: o.x, y: o.y }, this.manager.emitPluginEvent("drag", {
|
|
1472
|
+
type: "drag",
|
|
1473
|
+
state: o,
|
|
1474
|
+
mode: this.manager.getMode()
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Handle drag end event
|
|
1479
|
+
*/
|
|
1480
|
+
onDragEnd() {
|
|
1481
|
+
this.manager && (this.reactiveState.isActive = !1, this.reactiveState.lastPosition = null, this.startState = null, document.removeEventListener("mousemove", this.onDragMove), document.removeEventListener("mouseup", this.onDragEnd), document.removeEventListener("touchmove", this.onDragMove), document.removeEventListener("touchend", this.onDragEnd), this.manager.emitPluginEvent("dragEnd", {
|
|
1482
|
+
type: "drag",
|
|
1483
|
+
state: this.manager.getState(),
|
|
1484
|
+
mode: this.manager.getMode()
|
|
1485
|
+
}));
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Apply snapping to drag movement based on current mode
|
|
1489
|
+
*/
|
|
1490
|
+
applySnapping(t, e) {
|
|
1491
|
+
return {
|
|
1492
|
+
deltaX: this.snapToGrid(t, this.reactiveState.snapStep),
|
|
1493
|
+
deltaY: this.snapToGrid(e, this.reactiveState.snapStep)
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* Snap value to grid using reactive step
|
|
1498
|
+
*/
|
|
1499
|
+
snapToGrid(t, e) {
|
|
1500
|
+
return Math.round(t / e) * e;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Constrain container to viewport boundaries
|
|
1504
|
+
*/
|
|
1505
|
+
constrainToViewport(t) {
|
|
1506
|
+
const e = window.innerWidth || document.documentElement.clientWidth, i = window.innerHeight || document.documentElement.clientHeight;
|
|
1507
|
+
t.x = Math.max(0, Math.min(t.x, e - t.width)), t.y = Math.max(0, Math.min(t.y, i - t.height));
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Add plugin methods to container manager
|
|
1511
|
+
*/
|
|
1512
|
+
addPluginMethods() {
|
|
1513
|
+
this.manager.setSnapStep = (t) => {
|
|
1514
|
+
this.reactiveState.snapStep = t, this.manager.emitPluginEvent("snapStepChanged", { snapStep: t });
|
|
1515
|
+
}, this.manager.setSnappingEnabled = (t) => {
|
|
1516
|
+
this.reactiveState.enabled = t, this.manager.emitPluginEvent("snappingEnabledChanged", { enabled: t });
|
|
1517
|
+
}, this.manager.getSnappingConfig = () => ({
|
|
1518
|
+
snapStep: this.reactiveState.snapStep,
|
|
1519
|
+
enabled: this.reactiveState.enabled
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Clean up plugin resources
|
|
1524
|
+
*/
|
|
1525
|
+
destroy() {
|
|
1526
|
+
this.reactiveState.isActive = !1, this.reactiveState.lastPosition = null;
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
a(x, "_pluginId", Symbol("SnappingPlugin"));
|
|
1530
|
+
let U = x;
|
|
1531
|
+
const R = class R {
|
|
1532
|
+
constructor(t = {}) {
|
|
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");
|
|
1538
|
+
this.edgeThreshold = t.edgeThreshold ?? 30, this.occupiedEdges.set("top", null), this.occupiedEdges.set("bottom", null), this.occupiedEdges.set("left", null), this.occupiedEdges.set("right", null);
|
|
1539
|
+
}
|
|
1540
|
+
get pluginId() {
|
|
1541
|
+
return R._pluginId;
|
|
1542
|
+
}
|
|
1543
|
+
install(t) {
|
|
1544
|
+
this.manager = t, this.tracker.addTarget(this.manager.getContainer()), this.tracker.on("edge:enter", (e) => {
|
|
1545
|
+
e.source === "element" && e.element === this.manager.getContainer() && this.handleEdgeEnter(e.edge);
|
|
1546
|
+
}), this.tracker.on("edge:leave", (e) => {
|
|
1547
|
+
e.source === "element" && e.element === this.manager.getContainer() && this.handleEdgeLeave(e.edge);
|
|
1548
|
+
}), this.attachEventHandlers();
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Handle edge enter for visual feedback
|
|
1552
|
+
*/
|
|
1553
|
+
handleEdgeEnter(t) {
|
|
1554
|
+
const e = this.manager.getContainer();
|
|
1555
|
+
this.isEdgeOccupied(t) ? e.classList.add("edge-dock-hint", `edge-dock-hint-${t}`, "edge-dock-blocked") : e.classList.add("edge-dock-hint", `edge-dock-hint-${t}`);
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Handle edge leave - remove visual feedback
|
|
1559
|
+
*/
|
|
1560
|
+
handleEdgeLeave(t) {
|
|
1561
|
+
this.manager.getContainer().classList.remove("edge-dock-hint", `edge-dock-hint-${t}`, "edge-dock-blocked");
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Check if an edge is occupied by another container
|
|
1565
|
+
*/
|
|
1566
|
+
isEdgeOccupied(t) {
|
|
1567
|
+
return this.occupiedEdges.get(t) !== null;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Attach event handlers to container manager
|
|
1571
|
+
*/
|
|
1572
|
+
attachEventHandlers() {
|
|
1573
|
+
const t = this.manager.getContainer();
|
|
1574
|
+
t.addEventListener("mouseenter", this.onMouseEnter.bind(this)), t.addEventListener("mouseleave", this.onMouseLeave.bind(this)), this.manager.on("dragStart", (e) => {
|
|
1575
|
+
this.onDragStart(e.element);
|
|
1576
|
+
}), this.manager.on("drag", (e) => {
|
|
1577
|
+
this.onDrag(e.element);
|
|
1578
|
+
}), this.manager.on("dragEnd", (e) => {
|
|
1579
|
+
this.onDragEnd(e.element);
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Handle mouse enter - show docked container
|
|
1584
|
+
*/
|
|
1585
|
+
onMouseEnter() {
|
|
1586
|
+
const t = this.manager.getContainer();
|
|
1587
|
+
this.isContainerDocked(t) && t.classList.add("edge-docked-visible");
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Handle mouse leave - hide docked container
|
|
1591
|
+
*/
|
|
1592
|
+
onMouseLeave() {
|
|
1593
|
+
const t = this.manager.getContainer();
|
|
1594
|
+
this.isContainerDocked(t) && t.classList.remove("edge-docked-visible");
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Handle drag start - undock if docked
|
|
1598
|
+
*/
|
|
1599
|
+
onDragStart(t) {
|
|
1600
|
+
t.classList.remove(
|
|
1601
|
+
"edge-dock-hint",
|
|
1602
|
+
"edge-dock-blocked",
|
|
1603
|
+
"edge-docked-visible",
|
|
1604
|
+
"edge-dock-hint-top",
|
|
1605
|
+
"edge-dock-hint-bottom",
|
|
1606
|
+
"edge-dock-hint-left",
|
|
1607
|
+
"edge-dock-hint-right"
|
|
1608
|
+
);
|
|
1609
|
+
const e = this.dockedContainers.get(t);
|
|
1610
|
+
e && this.undockContainer(t, e);
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Handle drag - update edge hints based on position
|
|
1614
|
+
*/
|
|
1615
|
+
onDrag(t) {
|
|
1616
|
+
const e = t.getBoundingClientRect(), i = this.getClosestEdge(e);
|
|
1617
|
+
this.updateEdgeHints(t, i);
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Handle drag end - dock if close to edge
|
|
1621
|
+
*/
|
|
1622
|
+
onDragEnd(t) {
|
|
1623
|
+
const e = t.getBoundingClientRect(), i = this.getClosestEdge(e);
|
|
1624
|
+
t.classList.remove(
|
|
1625
|
+
"edge-dock-hint",
|
|
1626
|
+
"edge-dock-blocked",
|
|
1627
|
+
"edge-dock-hint-top",
|
|
1628
|
+
"edge-dock-hint-bottom",
|
|
1629
|
+
"edge-dock-hint-left",
|
|
1630
|
+
"edge-dock-hint-right"
|
|
1631
|
+
), i && !this.isEdgeOccupied(i) && this.dockContainer(t, i);
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Update visual hints for edge docking
|
|
1635
|
+
*/
|
|
1636
|
+
updateEdgeHints(t, e) {
|
|
1637
|
+
t.classList.remove(
|
|
1638
|
+
"edge-dock-hint",
|
|
1639
|
+
"edge-dock-blocked",
|
|
1640
|
+
"edge-dock-hint-top",
|
|
1641
|
+
"edge-dock-hint-bottom",
|
|
1642
|
+
"edge-dock-hint-left",
|
|
1643
|
+
"edge-dock-hint-right"
|
|
1644
|
+
), e && (this.isEdgeOccupied(e) ? t.classList.add("edge-dock-hint", `edge-dock-hint-${e}`, "edge-dock-blocked") : t.classList.add("edge-dock-hint", `edge-dock-hint-${e}`));
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Get the closest edge to the container
|
|
1648
|
+
*/
|
|
1649
|
+
getClosestEdge(t) {
|
|
1650
|
+
const e = t.top, i = t.left, s = window.innerHeight - t.bottom, r = window.innerWidth - t.right, h = Object.entries({
|
|
1651
|
+
top: e,
|
|
1652
|
+
bottom: s,
|
|
1653
|
+
left: i,
|
|
1654
|
+
right: r
|
|
1655
|
+
}).filter(([d, l]) => l >= -this.edgeThreshold && l <= this.edgeThreshold).sort((d, l) => d[1] - l[1]);
|
|
1656
|
+
return h.length > 0 ? h[0][0] : null;
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Dock container to specified edge
|
|
1660
|
+
*/
|
|
1661
|
+
dockContainer(t, e) {
|
|
1662
|
+
const i = window.getComputedStyle(t), s = t.getBoundingClientRect(), r = {
|
|
1663
|
+
x: s.left,
|
|
1664
|
+
y: s.top
|
|
1665
|
+
};
|
|
1666
|
+
this.dockedContainers.set(t, {
|
|
1667
|
+
element: t,
|
|
1668
|
+
edge: e,
|
|
1669
|
+
screenPosition: r,
|
|
1670
|
+
originalPosition: {
|
|
1671
|
+
top: parseFloat(i.top) || s.top,
|
|
1672
|
+
left: parseFloat(i.left) || s.left,
|
|
1673
|
+
width: s.width,
|
|
1674
|
+
height: s.height,
|
|
1675
|
+
transform: i.transform,
|
|
1676
|
+
position: i.position
|
|
1677
|
+
}
|
|
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);
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Apply proper positioning for each edge to prevent shifting
|
|
1682
|
+
*/
|
|
1683
|
+
applyEdgePositioning(t, e, i) {
|
|
1684
|
+
const s = t.getBoundingClientRect();
|
|
1685
|
+
switch (e) {
|
|
1686
|
+
case "top":
|
|
1687
|
+
t.style.left = `${i.x}px`, t.style.width = `${s.width}px`;
|
|
1688
|
+
break;
|
|
1689
|
+
case "bottom":
|
|
1690
|
+
t.style.left = `${i.x}px`, t.style.width = `${s.width}px`;
|
|
1691
|
+
break;
|
|
1692
|
+
case "left":
|
|
1693
|
+
t.style.top = `${i.y}px`, t.style.height = `${s.height}px`;
|
|
1694
|
+
break;
|
|
1695
|
+
case "right":
|
|
1696
|
+
t.style.top = `${i.y}px`, t.style.height = `${s.height}px`;
|
|
1697
|
+
break;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Undock container from edge
|
|
1702
|
+
*/
|
|
1703
|
+
undockContainer(t, e) {
|
|
1704
|
+
this.dockedContainers.delete(t), this.occupiedEdges.set(e.edge, null), t.classList.remove(
|
|
1705
|
+
"edge-docked",
|
|
1706
|
+
"edge-docked-visible",
|
|
1707
|
+
"edge-docked-top",
|
|
1708
|
+
"edge-docked-bottom",
|
|
1709
|
+
"edge-docked-left",
|
|
1710
|
+
"edge-docked-right"
|
|
1711
|
+
), t.removeAttribute("data-docked"), t.removeAttribute("data-docked-edge"), t.style.top = "", t.style.bottom = "", t.style.left = "", t.style.right = "", t.style.width = "", t.style.height = "", t.style.transform = "", t.style.position = "", this.restoreOriginalPosition(t, e);
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Restore container to its original position without shifting
|
|
1715
|
+
*/
|
|
1716
|
+
restoreOriginalPosition(t, e) {
|
|
1717
|
+
this.manager.setState({
|
|
1718
|
+
x: e.screenPosition.x,
|
|
1719
|
+
y: e.screenPosition.y,
|
|
1720
|
+
width: e.originalPosition.width,
|
|
1721
|
+
height: e.originalPosition.height
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Get the docked container for a specific edge
|
|
1726
|
+
*/
|
|
1727
|
+
getDockedContainer(t) {
|
|
1728
|
+
const e = this.occupiedEdges.get(t);
|
|
1729
|
+
return e && this.dockedContainers.get(e) || null;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Check if container is docked
|
|
1733
|
+
*/
|
|
1734
|
+
isContainerDocked(t) {
|
|
1735
|
+
return this.dockedContainers.has(t);
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Get the edge where container is docked
|
|
1739
|
+
*/
|
|
1740
|
+
getContainerDockEdge(t) {
|
|
1741
|
+
const e = this.dockedContainers.get(t);
|
|
1742
|
+
return e ? e.edge : null;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Clean up resources
|
|
1746
|
+
*/
|
|
1747
|
+
destroy() {
|
|
1748
|
+
const t = this.manager.getContainer();
|
|
1749
|
+
t.removeEventListener("mouseenter", this.onMouseEnter.bind(this)), t.removeEventListener("mouseleave", this.onMouseLeave.bind(this)), this.dockedContainers.forEach((e, i) => {
|
|
1750
|
+
this.undockContainer(i, e);
|
|
1751
|
+
}), this.dockedContainers.clear(), this.occupiedEdges.forEach((e, i) => {
|
|
1752
|
+
this.occupiedEdges.set(i, null);
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
a(R, "_pluginId", Symbol("EdgeDockingPlugin"));
|
|
1757
|
+
let j = R;
|
|
1758
|
+
const n = class n {
|
|
1759
|
+
constructor() {
|
|
1760
|
+
a(this, "manager");
|
|
1761
|
+
a(this, "containerId");
|
|
1762
|
+
a(this, "isDemoContainer", !1);
|
|
1763
|
+
// Эффект для автоматического сохранения при изменении состояния
|
|
1764
|
+
a(this, "autoSaveEffect");
|
|
1765
|
+
}
|
|
1766
|
+
get pluginId() {
|
|
1767
|
+
return n._pluginId;
|
|
1768
|
+
}
|
|
1769
|
+
// Вычисляемое свойство для доступа к состояниям
|
|
1770
|
+
static get containerStates() {
|
|
1771
|
+
return n.reactiveState.containerStates;
|
|
1772
|
+
}
|
|
1773
|
+
static get closedQueue() {
|
|
1774
|
+
return n.reactiveState.closedQueue;
|
|
1775
|
+
}
|
|
1776
|
+
static get demoContainers() {
|
|
1777
|
+
return n.reactiveState.demoContainers;
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Install plugin on container manager instance with reactive state management
|
|
1781
|
+
*/
|
|
1782
|
+
install(t, e) {
|
|
1783
|
+
if (this.manager = t, this.containerId = e == null ? void 0 : e.containerId, this.isDemoContainer = (e == null ? void 0 : e.isDemo) || !1, !this.containerId) {
|
|
1784
|
+
console.warn("[StatePersistencePlugin] containerId is required for state persistence");
|
|
1785
|
+
return;
|
|
1786
|
+
}
|
|
1787
|
+
n.containers.push({
|
|
1788
|
+
manager: t,
|
|
1789
|
+
containerId: this.containerId,
|
|
1790
|
+
isDemo: this.isDemoContainer
|
|
1791
|
+
}), this.isDemoContainer && n.registerDemoContainer(this.containerId), n.isGlobalEventsInitialized || (n.initializeGlobalEvents(), n.isGlobalEventsInitialized = !0), this.isDemoContainer && this.setupAutoSaveEffect(), this.bindContainerEvents();
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Set up reactive auto-save effect for container state changes
|
|
1795
|
+
*/
|
|
1796
|
+
setupAutoSaveEffect() {
|
|
1797
|
+
if (!this.manager || !this.containerId) return;
|
|
1798
|
+
const t = z(() => {
|
|
1799
|
+
this.isDemoContainer && this.saveState();
|
|
1800
|
+
}, 300);
|
|
1801
|
+
this.autoSaveEffect = k(() => {
|
|
1802
|
+
this.manager.getState(), this.manager.getMode(), t();
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Bind to container-specific events to save state on changes
|
|
1807
|
+
* Simplified since most saving handled using effects
|
|
1808
|
+
*/
|
|
1809
|
+
bindContainerEvents() {
|
|
1810
|
+
this.manager && (this.manager.on("dragStart", () => {
|
|
1811
|
+
}), this.manager.on("dragEnd", () => {
|
|
1812
|
+
this.isDemoContainer && this.saveState();
|
|
1813
|
+
}), this.manager.on("resizeEnd", () => {
|
|
1814
|
+
this.isDemoContainer && this.saveState();
|
|
1815
|
+
}), this.manager.onPluginEvent("maximizeChanged", () => {
|
|
1816
|
+
this.isDemoContainer && this.saveState();
|
|
1817
|
+
}), this.manager.onPluginEvent("directionChanged", () => {
|
|
1818
|
+
this.isDemoContainer && this.saveState();
|
|
1819
|
+
}));
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Initialize global event handlers for all containers
|
|
1823
|
+
*/
|
|
1824
|
+
static initializeGlobalEvents() {
|
|
1825
|
+
window.addEventListener("beforeunload", () => {
|
|
1826
|
+
n.saveAllContainers();
|
|
1827
|
+
}), document.addEventListener("visibilitychange", () => {
|
|
1828
|
+
document.hidden && n.saveAllContainers();
|
|
1829
|
+
}), window.addEventListener("resize", z(() => {
|
|
1830
|
+
n.saveAllContainers();
|
|
1831
|
+
}, 500));
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Register a container as a demo container
|
|
1835
|
+
*/
|
|
1836
|
+
static registerDemoContainer(t) {
|
|
1837
|
+
try {
|
|
1838
|
+
n.demoContainers.includes(t) || (n.demoContainers.push(t), n.saveDemoContainersToStorage());
|
|
1839
|
+
} catch (e) {
|
|
1840
|
+
console.error("[StatePersistencePlugin] Failed to register demo container:", e);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Save demo containers to localStorage
|
|
1845
|
+
*/
|
|
1846
|
+
static saveDemoContainersToStorage() {
|
|
1847
|
+
try {
|
|
1848
|
+
localStorage.setItem(
|
|
1849
|
+
n.DEMO_CONTAINERS_KEY,
|
|
1850
|
+
JSON.stringify(n.demoContainers)
|
|
1851
|
+
);
|
|
1852
|
+
} catch (t) {
|
|
1853
|
+
console.error("[StatePersistencePlugin] Failed to save demo containers:", t);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
/**
|
|
1857
|
+
* Get list of all demo containers
|
|
1858
|
+
*/
|
|
1859
|
+
static getDemoContainers() {
|
|
1860
|
+
try {
|
|
1861
|
+
const t = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
|
|
1862
|
+
return t ? JSON.parse(t) : [];
|
|
1863
|
+
} catch (t) {
|
|
1864
|
+
return console.error("[StatePersistencePlugin] Failed to parse demo containers:", t), [];
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Check if a container is a demo container
|
|
1869
|
+
*/
|
|
1870
|
+
static isDemoContainer(t) {
|
|
1871
|
+
return n.getDemoContainers().includes(t);
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Get all saved states from localStorage
|
|
1875
|
+
*/
|
|
1876
|
+
static getAllStates() {
|
|
1877
|
+
try {
|
|
1878
|
+
const t = localStorage.getItem(n.STORAGE_KEY);
|
|
1879
|
+
return t ? JSON.parse(t) : {};
|
|
1880
|
+
} catch (t) {
|
|
1881
|
+
return console.error("[StatePersistencePlugin] Failed to parse stored states:", t), {};
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* Add container ID to closed containers queue
|
|
1886
|
+
*/
|
|
1887
|
+
static addToClosedQueue(t) {
|
|
1888
|
+
if (!n.isDemoContainer(t)) {
|
|
1889
|
+
console.log(`[StatePersistencePlugin] Skipping closed queue for non-demo container: ${t}`);
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (!n.getContainerState(t)) {
|
|
1893
|
+
console.error(`[StatePersistencePlugin] Cannot add ${t} to closed queue: state not found`);
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
const i = n.closedQueue, s = i.indexOf(t);
|
|
1897
|
+
s > -1 && i.splice(s, 1), i.push(t), n.saveClosedQueueToStorage();
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Save closed queue to localStorage
|
|
1901
|
+
*/
|
|
1902
|
+
static saveClosedQueueToStorage() {
|
|
1903
|
+
try {
|
|
1904
|
+
localStorage.setItem(
|
|
1905
|
+
n.CLOSED_QUEUE_KEY,
|
|
1906
|
+
JSON.stringify(n.closedQueue)
|
|
1907
|
+
);
|
|
1908
|
+
} catch (t) {
|
|
1909
|
+
console.error("[StatePersistencePlugin] Failed to save closed queue:", t);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Get closed containers queue (LIFO - last in first out)
|
|
1914
|
+
*/
|
|
1915
|
+
static getClosedQueue() {
|
|
1916
|
+
try {
|
|
1917
|
+
const t = localStorage.getItem(n.CLOSED_QUEUE_KEY);
|
|
1918
|
+
return t ? JSON.parse(t) : [];
|
|
1919
|
+
} catch (t) {
|
|
1920
|
+
return console.error("[StatePersistencePlugin] Failed to parse closed queue:", t), [];
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
saveState() {
|
|
1924
|
+
!this.manager || !this.containerId || !this.isDemoContainer || D(() => {
|
|
1925
|
+
var b;
|
|
1926
|
+
n.reactiveState.isSaving = !0, n.reactiveState.pendingChanges = !0;
|
|
1927
|
+
const t = this.manager.getContainer(), e = t.dataset.maximized === "true", i = this.manager.getState(), s = this.manager.getMode(), r = this.manager.getDirection(), o = t.dataset.containerType || "unknown", h = t.dataset.title, d = t.dataset.color, l = t.dataset.useSnapping === "true", S = (b = this.manager.config) == null ? void 0 : b.resize, E = t.parentElement, M = E && E !== document.body ? E.id || `parent-${this.containerId}` : void 0, w = {
|
|
1928
|
+
...i,
|
|
1929
|
+
mode: s,
|
|
1930
|
+
draggingDirection: r,
|
|
1931
|
+
isMaximized: e,
|
|
1932
|
+
containerType: o,
|
|
1933
|
+
title: h,
|
|
1934
|
+
color: d,
|
|
1935
|
+
useSnapping: l,
|
|
1936
|
+
isClosed: !1,
|
|
1937
|
+
parentElementId: M,
|
|
1938
|
+
closedTimestamp: 0,
|
|
1939
|
+
resize: S,
|
|
1940
|
+
isDemoContainer: !0
|
|
1941
|
+
};
|
|
1942
|
+
n.reactiveState.containerStates[this.containerId] = w;
|
|
1943
|
+
const p = n.getAllStates();
|
|
1944
|
+
p[this.containerId] = w, localStorage.setItem(
|
|
1945
|
+
n.STORAGE_KEY,
|
|
1946
|
+
JSON.stringify(p)
|
|
1947
|
+
), n.reactiveState.lastSaved = Date.now(), n.reactiveState.isSaving = !1;
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Save container state with current manager state before closing
|
|
1952
|
+
*/
|
|
1953
|
+
static saveContainerStateBeforeClose(t, e) {
|
|
1954
|
+
var Y, B, F;
|
|
1955
|
+
const i = t.getState(), s = t.getMode();
|
|
1956
|
+
if (!n.isDemoContainer(e)) {
|
|
1957
|
+
n.containers = n.containers.filter(
|
|
1958
|
+
(T) => T.containerId !== e
|
|
1959
|
+
);
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
const o = t.getContainer(), h = t.getDirection(), d = o.dataset.maximized === "true", l = o.dataset.containerType || "unknown", S = o.dataset.title, E = o.dataset.color, M = o.dataset.useSnapping === "true", w = (Y = t.config) == null ? void 0 : Y.resize, p = ((B = t.isEdgeDocked) == null ? void 0 : B.call(t)) || !1, b = ((F = t.getDockEdge) == null ? void 0 : F.call(t)) || null, C = o.parentElement, q = C && C !== document.body ? C.id || `parent-${e}` : void 0, A = {
|
|
1963
|
+
...i,
|
|
1964
|
+
mode: s,
|
|
1965
|
+
draggingDirection: h,
|
|
1966
|
+
isMaximized: d,
|
|
1967
|
+
isEdgeDocked: p,
|
|
1968
|
+
dockEdge: b || void 0,
|
|
1969
|
+
containerType: l,
|
|
1970
|
+
title: S,
|
|
1971
|
+
color: E,
|
|
1972
|
+
useSnapping: M,
|
|
1973
|
+
isClosed: !0,
|
|
1974
|
+
parentElementId: q,
|
|
1975
|
+
closedTimestamp: Date.now(),
|
|
1976
|
+
resize: w,
|
|
1977
|
+
isDemoContainer: !0
|
|
1978
|
+
}, N = n.getAllStates();
|
|
1979
|
+
N[e] = A;
|
|
1980
|
+
try {
|
|
1981
|
+
localStorage.setItem(
|
|
1982
|
+
n.STORAGE_KEY,
|
|
1983
|
+
JSON.stringify(N)
|
|
1984
|
+
);
|
|
1985
|
+
} catch (T) {
|
|
1986
|
+
console.error("[StatePersistencePlugin] Failed to save to localStorage:", T);
|
|
1987
|
+
}
|
|
1988
|
+
n.reactiveState.containerStates[e] = A, n.containers = n.containers.filter(
|
|
1989
|
+
(T) => T.containerId !== e
|
|
1990
|
+
), n.addToClosedQueue(e);
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Save all containers state (for global events) - including closed ones
|
|
1994
|
+
*/
|
|
1995
|
+
static saveAllContainers() {
|
|
1996
|
+
D(() => {
|
|
1997
|
+
const t = n.getAllStates();
|
|
1998
|
+
n.containers.filter(({ isDemo: e }) => e).forEach(({ manager: e, containerId: i }) => {
|
|
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;
|
|
2001
|
+
t[i] = {
|
|
2002
|
+
...s,
|
|
2003
|
+
mode: r,
|
|
2004
|
+
draggingDirection: h,
|
|
2005
|
+
isMaximized: d,
|
|
2006
|
+
containerType: l,
|
|
2007
|
+
title: S,
|
|
2008
|
+
color: E,
|
|
2009
|
+
useSnapping: M,
|
|
2010
|
+
isClosed: !1,
|
|
2011
|
+
parentElementId: b,
|
|
2012
|
+
closedTimestamp: 0,
|
|
2013
|
+
resize: w,
|
|
2014
|
+
isDemoContainer: !0
|
|
2015
|
+
};
|
|
2016
|
+
}), n.reactiveState.containerStates = t, localStorage.setItem(
|
|
2017
|
+
n.STORAGE_KEY,
|
|
2018
|
+
JSON.stringify(t)
|
|
2019
|
+
), n.reactiveState.lastSaved = Date.now();
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
/**
|
|
2023
|
+
* Remove the most recently closed container from queue and return its ID
|
|
2024
|
+
*/
|
|
2025
|
+
static popLastClosedContainer() {
|
|
2026
|
+
try {
|
|
2027
|
+
const t = n.closedQueue;
|
|
2028
|
+
if (t.length === 0) return null;
|
|
2029
|
+
const e = t.pop();
|
|
2030
|
+
return n.saveClosedQueueToStorage(), e;
|
|
2031
|
+
} catch (t) {
|
|
2032
|
+
return console.error("[StatePersistencePlugin] Failed to pop last closed container:", t), null;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Check if there are any closed containers that can be restored
|
|
2037
|
+
*/
|
|
2038
|
+
static hasClosedContainers() {
|
|
2039
|
+
return n.closedQueue.length > 0;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Get saved state for specific container (including closed ones)
|
|
2043
|
+
*/
|
|
2044
|
+
static getContainerState(t) {
|
|
2045
|
+
try {
|
|
2046
|
+
const e = n.containerStates[t];
|
|
2047
|
+
if (e) return e;
|
|
2048
|
+
const s = n.getAllStates()[t];
|
|
2049
|
+
return s ? (n.reactiveState.containerStates[t] = s, s) : null;
|
|
2050
|
+
} catch (e) {
|
|
2051
|
+
return console.error("[StatePersistencePlugin] Failed to get container state:", e), null;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* Get all container states including closed ones
|
|
2056
|
+
*/
|
|
2057
|
+
static getAllContainerStates() {
|
|
2058
|
+
return n.getAllStates();
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Check if container state exists (including closed)
|
|
2062
|
+
*/
|
|
2063
|
+
static hasContainerState(t) {
|
|
2064
|
+
return n.getContainerState(t) !== null;
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Update container state in storage
|
|
2068
|
+
*/
|
|
2069
|
+
static updateContainerState(t, e) {
|
|
2070
|
+
try {
|
|
2071
|
+
const i = n.getAllStates(), s = i[t];
|
|
2072
|
+
if (s) {
|
|
2073
|
+
const r = { ...s, ...e };
|
|
2074
|
+
i[t] = r, localStorage.setItem(
|
|
2075
|
+
n.STORAGE_KEY,
|
|
2076
|
+
JSON.stringify(i)
|
|
2077
|
+
), n.reactiveState.containerStates[t] = r;
|
|
2078
|
+
} else {
|
|
2079
|
+
console.warn(`[StatePersistencePlugin] No state found for container ${t}, creating new state`);
|
|
2080
|
+
const r = {
|
|
2081
|
+
x: 0,
|
|
2082
|
+
y: 0,
|
|
2083
|
+
width: 300,
|
|
2084
|
+
height: 200,
|
|
2085
|
+
mode: "smooth",
|
|
2086
|
+
draggingDirection: "all",
|
|
2087
|
+
isMaximized: !1,
|
|
2088
|
+
containerType: "unknown",
|
|
2089
|
+
isClosed: !1,
|
|
2090
|
+
isDemoContainer: n.isDemoContainer(t),
|
|
2091
|
+
...e
|
|
2092
|
+
};
|
|
2093
|
+
i[t] = r, localStorage.setItem(
|
|
2094
|
+
n.STORAGE_KEY,
|
|
2095
|
+
JSON.stringify(i)
|
|
2096
|
+
), n.reactiveState.containerStates[t] = r;
|
|
2097
|
+
}
|
|
2098
|
+
} catch (i) {
|
|
2099
|
+
console.error("[StatePersistencePlugin] Failed to update container state:", i);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
/**
|
|
2103
|
+
* Clear all saved states from localStorage
|
|
2104
|
+
*/
|
|
2105
|
+
static clearStorage() {
|
|
2106
|
+
D(() => {
|
|
2107
|
+
n.reactiveState.containerStates = {}, n.closedQueue.length = 0, n.demoContainers.length = 0, n.reactiveState.isSaving = !1, n.reactiveState.lastSaved = null, n.reactiveState.pendingChanges = !1;
|
|
2108
|
+
}), localStorage.removeItem(n.STORAGE_KEY), localStorage.removeItem(n.CLOSED_QUEUE_KEY), localStorage.removeItem(n.DEMO_CONTAINERS_KEY), n.containers = [];
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Initialize reactive state from localStorage on plugin load
|
|
2112
|
+
*/
|
|
2113
|
+
static initializeReactiveState() {
|
|
2114
|
+
try {
|
|
2115
|
+
const t = n.getAllStates(), e = n.getClosedQueue(), i = n.getDemoContainers();
|
|
2116
|
+
D(() => {
|
|
2117
|
+
n.reactiveState.containerStates = t, n.closedQueue.length = 0, n.closedQueue.push(...e), n.demoContainers.length = 0, n.demoContainers.push(...i);
|
|
2118
|
+
});
|
|
2119
|
+
} catch (t) {
|
|
2120
|
+
console.error("[StatePersistencePlugin] Failed to initialize reactive state:", t);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Get plugin metrics and statistics
|
|
2125
|
+
*/
|
|
2126
|
+
static getMetrics() {
|
|
2127
|
+
return {
|
|
2128
|
+
totalContainers: Object.keys(n.containerStates).length,
|
|
2129
|
+
demoContainers: n.demoContainers.length,
|
|
2130
|
+
closedContainers: n.closedQueue.length,
|
|
2131
|
+
lastSaved: n.reactiveState.lastSaved,
|
|
2132
|
+
isSaving: n.reactiveState.isSaving
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Debug method to check the current state of localStorage
|
|
2137
|
+
*/
|
|
2138
|
+
static debugStorage() {
|
|
2139
|
+
console.log("[StatePersistencePlugin] === START DEBUG INFO ===");
|
|
2140
|
+
try {
|
|
2141
|
+
const t = localStorage.getItem(n.STORAGE_KEY);
|
|
2142
|
+
if (t) {
|
|
2143
|
+
const s = JSON.parse(t);
|
|
2144
|
+
console.log(`[StatePersistencePlugin] Number of states: ${Object.keys(s).length}`), console.log("[StatePersistencePlugin] State keys:", Object.keys(s));
|
|
2145
|
+
for (const [r, o] of Object.entries(s))
|
|
2146
|
+
console.log(`[StatePersistencePlugin] State ${r}:`, {
|
|
2147
|
+
isDemoContainer: o.isDemoContainer,
|
|
2148
|
+
isClosed: o.isClosed,
|
|
2149
|
+
title: o.title
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
const e = localStorage.getItem(n.CLOSED_QUEUE_KEY);
|
|
2153
|
+
console.log("[StatePersistencePlugin] Closed queue:", e ? JSON.parse(e) : []);
|
|
2154
|
+
const i = localStorage.getItem(n.DEMO_CONTAINERS_KEY);
|
|
2155
|
+
console.log("[StatePersistencePlugin] Demo containers:", i ? JSON.parse(i) : []);
|
|
2156
|
+
} catch (t) {
|
|
2157
|
+
console.error("[StatePersistencePlugin] Debug error:", t);
|
|
2158
|
+
}
|
|
2159
|
+
console.log("[StatePersistencePlugin] === END DEBUG INFO ===");
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Clean up plugin resources
|
|
2163
|
+
*/
|
|
2164
|
+
destroy() {
|
|
2165
|
+
this.autoSaveEffect && (this.autoSaveEffect(), this.autoSaveEffect = void 0), this.containerId && (n.containers = n.containers.filter(
|
|
2166
|
+
(t) => t.containerId !== this.containerId
|
|
2167
|
+
));
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
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", $({
|
|
2172
|
+
isSaving: !1,
|
|
2173
|
+
lastSaved: null,
|
|
2174
|
+
pendingChanges: !1,
|
|
2175
|
+
containerStates: {},
|
|
2176
|
+
closedQueue: [],
|
|
2177
|
+
demoContainers: []
|
|
2178
|
+
})), a(n, "isGlobalEventsInitialized", !1), a(n, "containers", []);
|
|
2179
|
+
let H = n;
|
|
2180
|
+
H.initializeReactiveState();
|
|
2181
|
+
const L = class L {
|
|
2182
|
+
constructor() {
|
|
2183
|
+
a(this, "manager");
|
|
2184
|
+
a(this, "containerName", "");
|
|
2185
|
+
a(this, "notificationSystem", null);
|
|
2186
|
+
}
|
|
2187
|
+
get pluginId() {
|
|
2188
|
+
return L._pluginId;
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Install plugin on container manager instance
|
|
2192
|
+
*/
|
|
2193
|
+
install(t, e) {
|
|
2194
|
+
this.manager = t, this.containerName = (e == null ? void 0 : e.containerName) || `Container-${Math.random().toString(36).substring(2, 11)}`, this.notificationSystem = e == null ? void 0 : e.notificationSystem, this.bindEvents();
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Bind to container events
|
|
2198
|
+
*/
|
|
2199
|
+
bindEvents() {
|
|
2200
|
+
this.manager && (this.logResize = z(this.logResize.bind(this), 250), this.logDrag = z(this.logDrag.bind(this), 250), this.logViewportResize = z(this.logViewportResize.bind(this), 250), this.logSnapStep = z(this.logSnapStep.bind(this), 250), this.manager.on("modeChange", (t) => {
|
|
2201
|
+
this.logModeChange(t.mode);
|
|
2202
|
+
}), this.manager.on("resize", (t) => {
|
|
2203
|
+
this.logResize(t.state);
|
|
2204
|
+
}), this.manager.on("resizeEnd", (t) => {
|
|
2205
|
+
this.logResize(t.state);
|
|
2206
|
+
}), this.manager.on("drag", (t) => {
|
|
2207
|
+
this.logDrag(t.state);
|
|
2208
|
+
}), this.manager.on("dragEnd", (t) => {
|
|
2209
|
+
this.logDrag(t.state);
|
|
2210
|
+
}), this.manager.on("viewportResize", (t) => {
|
|
2211
|
+
this.logViewportResize(t.state);
|
|
2212
|
+
}), this.manager.onPluginEvent("snappingEnabledChanged", (t) => {
|
|
2213
|
+
this.logSnappingEnabled(t.enabled);
|
|
2214
|
+
}), this.manager.onPluginEvent("snapStepChanged", (t) => {
|
|
2215
|
+
this.logSnapStep(t.snapStep);
|
|
2216
|
+
}), this.manager.onPluginEvent("directionChanged", (t) => {
|
|
2217
|
+
this.logDirectionChange(t.direction);
|
|
2218
|
+
}));
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Log resize event
|
|
2222
|
+
*/
|
|
2223
|
+
logResize(t) {
|
|
2224
|
+
const e = `Resized to ${Math.round(t.width)}×${Math.round(t.height)}`;
|
|
2225
|
+
this.showNotification(e, "info");
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* Log drag event
|
|
2229
|
+
*/
|
|
2230
|
+
logDrag(t) {
|
|
2231
|
+
const e = `Moved to (${Math.round(t.x)}, ${Math.round(t.y)})`;
|
|
2232
|
+
this.showNotification(e, "info");
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Log mode change event
|
|
2236
|
+
*/
|
|
2237
|
+
logModeChange(t) {
|
|
2238
|
+
const e = `Mode changed to ${t}`;
|
|
2239
|
+
this.showNotification(e, "warning");
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Log viewport resize adjustment event
|
|
2243
|
+
*/
|
|
2244
|
+
logViewportResize(t) {
|
|
2245
|
+
const e = `Adjusted position to (${Math.round(t.x)}, ${Math.round(t.y)}) due to window resize`;
|
|
2246
|
+
this.showNotification(e, "info");
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Log snapping enabled/disabled
|
|
2250
|
+
*/
|
|
2251
|
+
logSnappingEnabled(t) {
|
|
2252
|
+
const e = `Snapping ${t ? "enabled" : "disabled"}`;
|
|
2253
|
+
this.showNotification(e, t ? "success" : "warning");
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Log snap step change
|
|
2257
|
+
*/
|
|
2258
|
+
logSnapStep(t) {
|
|
2259
|
+
const e = `Snap step changed to ${t}px`;
|
|
2260
|
+
this.showNotification(e, "info");
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* Log direction change
|
|
2264
|
+
*/
|
|
2265
|
+
logDirectionChange(t) {
|
|
2266
|
+
const e = `Drag direction: ${t}`;
|
|
2267
|
+
this.showNotification(e, "info");
|
|
2268
|
+
}
|
|
2269
|
+
/**
|
|
2270
|
+
* Show notification using notification system
|
|
2271
|
+
*/
|
|
2272
|
+
showNotification(t, e) {
|
|
2273
|
+
if (this.notificationSystem) {
|
|
2274
|
+
const i = `${this.containerName}: ${t}`;
|
|
2275
|
+
this.notificationSystem.show(i, e);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
a(L, "_pluginId", Symbol("LoggingPlugin"));
|
|
2280
|
+
let K = L;
|
|
964
2281
|
export {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
2282
|
+
pt as ContainerInitializer,
|
|
2283
|
+
V as ContainerManager,
|
|
2284
|
+
vt as ContentCreator,
|
|
2285
|
+
j as EdgeDockingPlugin,
|
|
2286
|
+
K as LoggingPlugin,
|
|
2287
|
+
it as NotificationSystem,
|
|
2288
|
+
U as SnappingPlugin,
|
|
2289
|
+
H as StatePersistencePlugin,
|
|
2290
|
+
ft as StatsManager,
|
|
2291
|
+
J as TemplateLoader,
|
|
2292
|
+
lt as getState,
|
|
2293
|
+
Et as getTemplateLoader,
|
|
2294
|
+
St as initializeTemplateSystem
|
|
969
2295
|
};
|
|
970
2296
|
//# sourceMappingURL=index.es.js.map
|