@trunkjs/content-pane 1.0.0 → 1.0.1
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/CHANGELOG.md +4 -0
- package/components/tj-content-pane/TjContentPane.d.ts +1 -1
- package/index.js +42 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 1.0.1 (2025-08-11)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for content-pane to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
1
5
|
# 1.0.0 (2025-08-11)
|
|
2
6
|
|
|
3
7
|
This was a version bump only for content-pane to align it with other projects, there were no code changes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactiveElement } from 'lit';
|
|
2
2
|
declare const ContentAreaElement2_base: (abstract new (...args: any[]) => {
|
|
3
|
-
"__#
|
|
3
|
+
"__#2365@#debugCached": boolean | null;
|
|
4
4
|
invalidateDebugCache(): void;
|
|
5
5
|
readonly _debug: boolean | null;
|
|
6
6
|
log(...args: any[]): void;
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var E = (n, t, r) => t in n ? C(n, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var h = (n, t, r) => E(n, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { unsafeCSS as A, LitElement as N, html as _, ReactiveElement as L } from "lit";
|
|
5
5
|
import { property as k, customElement as x } from "lit/decorators.js";
|
|
6
|
-
import { create_element as
|
|
6
|
+
import { create_element as w, LoggingMixin as I, Stopwatch as T, waitForDomContentLoaded as P } from "@trunkjs/browser-utils";
|
|
7
7
|
class S {
|
|
8
8
|
constructor(t, r = !1) {
|
|
9
9
|
h(this, "rootNode");
|
|
@@ -35,7 +35,7 @@ class S {
|
|
|
35
35
|
return o;
|
|
36
36
|
}
|
|
37
37
|
createNewContainerNode(t, r) {
|
|
38
|
-
const o = this.getAttributeRecords(t, t.tagName === "HR"), e =
|
|
38
|
+
const o = this.getAttributeRecords(t, t.tagName === "HR"), e = w("section", o);
|
|
39
39
|
return e.__IT = r, e;
|
|
40
40
|
}
|
|
41
41
|
arrangeSingleNode(t, r) {
|
|
@@ -69,12 +69,12 @@ class S {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
const $ = ":host{--border-color: red;--background-color: lightgray;font-family:Arial,sans-serif}#error-fixed-indicator{position:fixed;top:10px;right:10px;cursor:pointer;z-index:100000;padding:5px 10px;width:auto;max-width:90vw;min-width:100px;height:auto;box-shadow:0 4px 8px #0003;border:5px solid white;color:#fff;background-color:red;animation:blink 1s infinite;border-radius:15px;font-size:20px;font-weight:700;font-family:Arial,sans-serif}@keyframes blink{0%,to{background-color:#000}50%{background-color:red}}#error{background-color:var(--background-color);border:3px solid var(--border-color);padding:10px;margin:10px;border-radius:5px}h1{color:red;font-size:24px;margin:0}.error-details{font-size:14px;max-height:200px;overflow:auto}";
|
|
72
|
-
var
|
|
72
|
+
var y = Object.defineProperty, j = Object.getOwnPropertyDescriptor, M = (n, t, r) => t in n ? y(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r, v = (n, t, r, o) => {
|
|
73
73
|
for (var e = o > 1 ? void 0 : o ? j(t, r) : t, s = n.length - 1, i; s >= 0; s--)
|
|
74
74
|
(i = n[s]) && (e = (o ? i(t, r, e) : i(e)) || e);
|
|
75
|
-
return o && e &&
|
|
76
|
-
},
|
|
77
|
-
let
|
|
75
|
+
return o && e && y(t, r, e), e;
|
|
76
|
+
}, O = (n, t, r) => M(n, t + "", r);
|
|
77
|
+
let f = class extends N {
|
|
78
78
|
constructor(t = "An error occurred", r) {
|
|
79
79
|
super();
|
|
80
80
|
h(this, "originalCode");
|
|
@@ -101,76 +101,77 @@ let p = class extends N {
|
|
|
101
101
|
`;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
O(f, "styles", [A($)]);
|
|
105
|
+
v([
|
|
106
106
|
k({ type: String, reflect: !0 })
|
|
107
|
-
],
|
|
108
|
-
|
|
107
|
+
], f.prototype, "message", 2);
|
|
108
|
+
f = v([
|
|
109
109
|
x("tj-error-element")
|
|
110
|
-
],
|
|
111
|
-
function
|
|
110
|
+
], f);
|
|
111
|
+
function R(n, { allowAttributes: t = !0, ignoreGaps: r = !0 } = {}) {
|
|
112
112
|
let o = "div", e = null, s = [], i = [], l = {};
|
|
113
|
-
const
|
|
113
|
+
const d = /(^[a-z][\w-]*)|#[\w-]+|\.[\w:-]+|\[\s*([\w-]+)(?:\s*=\s*(['"]?)(.*?)\3)?\s*\]/gi;
|
|
114
114
|
let a = 0;
|
|
115
115
|
for (; ; ) {
|
|
116
|
-
const u =
|
|
116
|
+
const u = d.exec(n);
|
|
117
117
|
if (!u || u.index !== a) {
|
|
118
118
|
if (!r && u && u.index > a)
|
|
119
119
|
break;
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
else if (
|
|
125
|
-
else if (
|
|
126
|
-
if (!t) throw new Error(`Attributes not allowed: '${
|
|
127
|
-
const
|
|
128
|
-
i.push({ name:
|
|
129
|
-
} else o =
|
|
130
|
-
a +=
|
|
122
|
+
const c = u[0];
|
|
123
|
+
if (c[0] === "#") e = c.slice(1);
|
|
124
|
+
else if (c[0] === ".") s.push(c.slice(1));
|
|
125
|
+
else if (c[0] === "[") {
|
|
126
|
+
if (!t) throw new Error(`Attributes not allowed: '${c}'`);
|
|
127
|
+
const p = u[2], m = u[4] || void 0;
|
|
128
|
+
i.push({ name: p, value: m }), l[p] = m;
|
|
129
|
+
} else o = c;
|
|
130
|
+
a += c.length;
|
|
131
131
|
}
|
|
132
132
|
return { tag: o, id: e, classes: s, attrs: i, attrsMap: l, length: a, rest: n.slice(a) };
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function D(n) {
|
|
135
135
|
return typeof n.beforeLayoutCallback == "function";
|
|
136
136
|
}
|
|
137
137
|
function F(n, t, r) {
|
|
138
|
+
var u, c;
|
|
138
139
|
console.log("Applying layout to element:", n, "with layout:", r);
|
|
139
|
-
const o = /^(\+|-|)([0-9]+\.?[0-9]*);?/, e = r.replace(o, ""), s =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
let
|
|
140
|
+
const o = /^(\+|-|)([0-9]+\.?[0-9]*);?/, e = r.replace(o, ""), s = R(e), i = { class: "" };
|
|
141
|
+
s.attrsMap.class && (i.class = s.attrsMap.class + " "), i.class += s.classes.join(" "), i.id = s.id, ((u = i.class) == null ? void 0 : u.trim()) === "" && delete i.class, ((c = i.id) == null ? void 0 : c.trim()) === "" && delete i.id;
|
|
142
|
+
const l = s.tag || "div";
|
|
143
|
+
let d = !1, a = w(l, { ...i, layoutOrig: r });
|
|
143
144
|
if (l.includes("-") && !customElements.get(l))
|
|
144
|
-
console.warn(`Custom element <${l}> is not registered.`), a = new
|
|
145
|
+
console.warn(`Custom element <${l}> is not registered.`), a = new f(`Custom element <${l}> is not registered.`, n.outerHTML), n.replaceWith(a), a.append(n), d = !0;
|
|
145
146
|
else {
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
const p = Array.from(n.children);
|
|
148
|
+
D(a) && (d = a.beforeLayoutCallback(n, a, p) === !1), console.log(
|
|
148
149
|
"Replacement element created:",
|
|
149
150
|
a,
|
|
150
151
|
"with children:",
|
|
151
|
-
|
|
152
|
+
p,
|
|
152
153
|
"skipChildren:",
|
|
153
|
-
|
|
154
|
+
d
|
|
154
155
|
), a.__ORIG_ELEMENT__ = n, a.append(...Array.from(n.children)), n.replaceWith(a);
|
|
155
156
|
}
|
|
156
157
|
return {
|
|
157
158
|
replacementElement: a,
|
|
158
|
-
skipChildren:
|
|
159
|
+
skipChildren: d
|
|
159
160
|
};
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function g(n, t = {}) {
|
|
162
163
|
console.log("applyLayout called with element:", n, "and options:", t);
|
|
163
164
|
const { recursive: r = !0 } = t;
|
|
164
165
|
let o = [];
|
|
165
166
|
if (Array.isArray(n))
|
|
166
|
-
return n.forEach((l) => o.push(...
|
|
167
|
+
return n.forEach((l) => o.push(...g(l, t))), o;
|
|
167
168
|
if (!(n instanceof HTMLElement))
|
|
168
169
|
return [];
|
|
169
170
|
const e = n.getAttribute("layout");
|
|
170
171
|
let s = !1, i = n;
|
|
171
172
|
if (e && ({ replacementElement: i, skipChildren: s } = F(n, t, e)), r && !s) {
|
|
172
173
|
const l = Array.from(i.children);
|
|
173
|
-
console.log("Applying layout to children:", l, "of element:", i), l.forEach((
|
|
174
|
+
console.log("Applying layout to children:", l, "of element:", i), l.forEach((d) => o.push(...g(d, t)));
|
|
174
175
|
}
|
|
175
176
|
return o;
|
|
176
177
|
}
|
|
@@ -193,7 +194,7 @@ let b = class extends I(L) {
|
|
|
193
194
|
const n = new T("SectionTreeBuilder");
|
|
194
195
|
await P(), super.connectedCallback();
|
|
195
196
|
const t = new S(this), r = Array.from(this.children);
|
|
196
|
-
t.arrange(r),
|
|
197
|
+
t.arrange(r), g(Array.from(this.children), { recursive: !0 }), n.lap("after arrange");
|
|
197
198
|
}
|
|
198
199
|
};
|
|
199
200
|
b = z([
|
|
@@ -206,14 +207,14 @@ function V(n, t, r) {
|
|
|
206
207
|
if (i.length > 0)
|
|
207
208
|
for (const l of i) {
|
|
208
209
|
o.push(l);
|
|
209
|
-
for (const [
|
|
210
|
-
l.setAttribute(
|
|
210
|
+
for (const [d, a] of Object.entries(r))
|
|
211
|
+
l.setAttribute(d, a);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
return o;
|
|
214
215
|
}
|
|
215
216
|
export {
|
|
216
217
|
b as ContentAreaElement2,
|
|
217
|
-
|
|
218
|
+
g as applyLayout,
|
|
218
219
|
V as attrAssign
|
|
219
220
|
};
|