@nextrap/ntl-2col 0.1.4 → 2.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/index.js CHANGED
@@ -1,738 +1,57 @@
1
- class _t {
2
- /**
3
- *
4
- * @param delay Debounce delay in milliseconds
5
- * @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
6
- */
7
- constructor(t, e = !1) {
8
- this.delay = t, this.max_delay = e, this.timeout = null, this.startTimeWithMs = 0;
9
- }
10
- async wait() {
11
- return this.startTimeWithMs === 0 && (this.startTimeWithMs = Date.now()), this.timeout && (this.max_delay === !1 || this.startTimeWithMs + this.max_delay > Date.now()) && clearTimeout(this.timeout), new Promise((t) => {
12
- this.timeout = setTimeout(() => {
13
- this.startTimeWithMs = 0, t(!0);
14
- }, this.delay);
15
- });
16
- }
17
- debounce(t) {
18
- this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(() => {
19
- t();
20
- }, this.delay);
21
- }
22
- }
23
- const w = {
24
- xs: { name: "xs", minWidth: 0 },
25
- sm: { name: "sm", minWidth: 576 },
26
- md: { name: "md", minWidth: 768 },
27
- lg: { name: "lg", minWidth: 992 },
28
- xl: { name: "xl", minWidth: 1200 },
29
- xxl: { name: "xxl", minWidth: 1400 }
30
- };
31
- let S = w.xs;
32
- function L() {
33
- const r = window.innerWidth;
34
- let t = w.xs;
35
- for (const e in w) {
36
- const s = w[e];
37
- r >= s.minWidth && (t = s);
38
- }
39
- return t;
40
- }
41
- function mt(r) {
42
- if (typeof r == "string" && r.endsWith("px") && (r = parseInt(r.replace("px", ""))), typeof r == "string") {
43
- if (r = w[r], !r)
44
- throw new Error(
45
- `Breakpoint ${r} not found. Defined breakpoints are: ${Object.keys(w).join(", ")}`
46
- );
47
- } else typeof r == "number" && (r = { name: "c", minWidth: r });
48
- return window.innerWidth >= r.minWidth;
49
- }
50
- if (!window.__nextrap_current_breakpoint) {
51
- window.__nextrap_current_breakpoint = L();
52
- const r = new _t(200, 500);
53
- window.addEventListener("resize", async () => {
54
- if (await r.wait(), S !== L()) {
55
- S = L(), window.__nextrap_current_breakpoint = S;
56
- const t = new CustomEvent("breakpoint-changed", {
57
- detail: { breakpoint: S }
58
- });
59
- console.log("Breakpoint changed", S), window.dispatchEvent(t);
60
- }
61
- });
62
- }
63
- /**
64
- * @license
65
- * Copyright 2019 Google LLC
66
- * SPDX-License-Identifier: BSD-3-Clause
67
- */
68
- const k = globalThis, V = k.ShadowRoot && (k.ShadyCSS === void 0 || k.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, lt = Symbol(), Q = /* @__PURE__ */ new WeakMap();
69
- let ct = class {
70
- constructor(t, e, s) {
71
- if (this._$cssResult$ = !0, s !== lt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
72
- this.cssText = t, this.t = e;
73
- }
74
- get styleSheet() {
75
- let t = this.o;
76
- const e = this.t;
77
- if (V && t === void 0) {
78
- const s = e !== void 0 && e.length === 1;
79
- s && (t = Q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Q.set(e, t));
80
- }
81
- return t;
82
- }
83
- toString() {
84
- return this.cssText;
85
- }
86
- };
87
- const F = (r) => new ct(typeof r == "string" ? r : r + "", void 0, lt), yt = (r, t) => {
88
- if (V) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
89
- else for (const e of t) {
90
- const s = document.createElement("style"), i = k.litNonce;
91
- i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
92
- }
93
- }, X = V ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
94
- let e = "";
95
- for (const s of t.cssRules) e += s.cssText;
96
- return F(e);
97
- })(r) : r;
98
- /**
99
- * @license
100
- * Copyright 2017 Google LLC
101
- * SPDX-License-Identifier: BSD-3-Clause
102
- */
103
- const { is: gt, defineProperty: vt, getOwnPropertyDescriptor: At, getOwnPropertyNames: wt, getOwnPropertySymbols: Et, getPrototypeOf: bt } = Object, _ = globalThis, Y = _.trustedTypes, St = Y ? Y.emptyScript : "", j = _.reactiveElementPolyfillSupport, C = (r, t) => r, W = { toAttribute(r, t) {
104
- switch (t) {
105
- case Boolean:
106
- r = r ? St : null;
107
- break;
108
- case Object:
109
- case Array:
110
- r = r == null ? r : JSON.stringify(r);
111
- }
112
- return r;
113
- }, fromAttribute(r, t) {
114
- let e = r;
115
- switch (t) {
116
- case Boolean:
117
- e = r !== null;
118
- break;
119
- case Number:
120
- e = r === null ? null : Number(r);
121
- break;
122
- case Object:
123
- case Array:
124
- try {
125
- e = JSON.parse(r);
126
- } catch {
127
- e = null;
128
- }
129
- }
1
+ import { nextrap_element as l } from "@nextrap/nt-core";
2
+ import { html as p, unsafeCSS as d } from "lit";
3
+ import { customElement as m } from "lit/decorators.js";
4
+ import { resetStyle as c } from "@nextrap/style-reset";
5
+ const h = ":host{--gap: var(--nt-spacing-layout);--container-width: var(--nt-container-width, 100%);--inner-padding: var(--nt-space-3);--section-bg: transparent;--cols: 6;--breakpoint: md;background:var(--section-bg);display:block}#container{margin-left:var(--container-margin-left, auto);margin-right:var(--container-margin-right, auto);width:var(--container-render-width, var(--container-width));box-sizing:border-box}#wrapper{box-sizing:border-box;--aside-width: 100%;display:flex;flex-direction:column;flex-wrap:wrap;gap:var(--gap);align-items:stretch}#header,#footer,#top,#bottom{width:100%;box-sizing:border-box}#header:has(.slot-empty),#footer:has(.slot-empty),#top:has(.slot-empty),#bottom:has(.slot-empty){display:none}#top{order:0;flex:0 0 auto}#main{box-sizing:border-box;order:1;min-width:0}#aside{box-sizing:border-box;order:2;min-width:0}#bottom{order:3;flex:0 0 auto}:host([mode=mobile]) #container{margin-left:0;margin-right:0;width:100%}:host([mode=mobile]) #main,:host([mode=mobile]) #aside{width:100%;flex:0 0 100%}:host([mode=mobile].mobile-reverse) #aside{order:1}:host([mode=mobile].mobile-reverse) #main{order:2}:host([mode=desktop].desktop-reverse) #wrapper{flex-direction:row-reverse}:host([mode=desktop]) #wrapper{flex-direction:row;--main-width: calc(100% * var(--cols, 1) / 12)}:host([mode=desktop]) #wrapper:has(#aside>.slot-empty){flex-direction:column}:host([mode=desktop]) #wrapper:has(#aside>.slot-empty) #main{width:100%;flex-basis:100%}:host([mode=desktop]) #wrapper #main{width:var(--main-width);flex:0 0 var(--main-width);box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-start}:host([mode=desktop]) #wrapper #aside{flex:1 1 0;box-sizing:border-box}:host([mode=desktop]) #aside{width:auto;min-width:0;flex:1 1 0;box-sizing:border-box}:host([mode=desktop]) #aside:has(.slot-empty){display:none}";
6
+ var b = Object.getOwnPropertyDescriptor, v = (r, a, n, i) => {
7
+ for (var e = i > 1 ? void 0 : i ? b(a, n) : a, t = r.length - 1, s; t >= 0; t--)
8
+ (s = r[t]) && (e = s(e) || e);
130
9
  return e;
131
- } }, J = (r, t) => !gt(r, t), tt = { attribute: !0, type: String, converter: W, reflect: !1, useDefault: !1, hasChanged: J };
132
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
133
- let y = class extends HTMLElement {
134
- static addInitializer(t) {
135
- this._$Ei(), (this.l ?? (this.l = [])).push(t);
136
- }
137
- static get observedAttributes() {
138
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
139
- }
140
- static createProperty(t, e = tt) {
141
- if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
142
- const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
143
- i !== void 0 && vt(this.prototype, t, i);
144
- }
145
- }
146
- static getPropertyDescriptor(t, e, s) {
147
- const { get: i, set: n } = At(this.prototype, t) ?? { get() {
148
- return this[e];
149
- }, set(o) {
150
- this[e] = o;
151
- } };
152
- return { get: i, set(o) {
153
- const h = i == null ? void 0 : i.call(this);
154
- n == null || n.call(this, o), this.requestUpdate(t, h, s);
155
- }, configurable: !0, enumerable: !0 };
156
- }
157
- static getPropertyOptions(t) {
158
- return this.elementProperties.get(t) ?? tt;
159
- }
160
- static _$Ei() {
161
- if (this.hasOwnProperty(C("elementProperties"))) return;
162
- const t = bt(this);
163
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
164
- }
165
- static finalize() {
166
- if (this.hasOwnProperty(C("finalized"))) return;
167
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
168
- const e = this.properties, s = [...wt(e), ...Et(e)];
169
- for (const i of s) this.createProperty(i, e[i]);
170
- }
171
- const t = this[Symbol.metadata];
172
- if (t !== null) {
173
- const e = litPropertyMetadata.get(t);
174
- if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
175
- }
176
- this._$Eh = /* @__PURE__ */ new Map();
177
- for (const [e, s] of this.elementProperties) {
178
- const i = this._$Eu(e, s);
179
- i !== void 0 && this._$Eh.set(i, e);
180
- }
181
- this.elementStyles = this.finalizeStyles(this.styles);
182
- }
183
- static finalizeStyles(t) {
184
- const e = [];
185
- if (Array.isArray(t)) {
186
- const s = new Set(t.flat(1 / 0).reverse());
187
- for (const i of s) e.unshift(X(i));
188
- } else t !== void 0 && e.push(X(t));
189
- return e;
190
- }
191
- static _$Eu(t, e) {
192
- const s = e.attribute;
193
- return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
194
- }
195
- constructor() {
196
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
197
- }
198
- _$Ev() {
199
- var t;
200
- this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
201
- }
202
- addController(t) {
203
- var e;
204
- (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
205
- }
206
- removeController(t) {
207
- var e;
208
- (e = this._$EO) == null || e.delete(t);
209
- }
210
- _$E_() {
211
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
212
- for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
213
- t.size > 0 && (this._$Ep = t);
214
- }
215
- createRenderRoot() {
216
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
217
- return yt(t, this.constructor.elementStyles), t;
218
- }
219
- connectedCallback() {
220
- var t;
221
- this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
222
- var s;
223
- return (s = e.hostConnected) == null ? void 0 : s.call(e);
224
- });
225
- }
226
- enableUpdating(t) {
227
- }
228
- disconnectedCallback() {
229
- var t;
230
- (t = this._$EO) == null || t.forEach((e) => {
231
- var s;
232
- return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
233
- });
234
- }
235
- attributeChangedCallback(t, e, s) {
236
- this._$AK(t, s);
237
- }
238
- _$ET(t, e) {
239
- var n;
240
- const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
241
- if (i !== void 0 && s.reflect === !0) {
242
- const o = (((n = s.converter) == null ? void 0 : n.toAttribute) !== void 0 ? s.converter : W).toAttribute(e, s.type);
243
- this._$Em = t, o == null ? this.removeAttribute(i) : this.setAttribute(i, o), this._$Em = null;
244
- }
245
- }
246
- _$AK(t, e) {
247
- var n, o;
248
- const s = this.constructor, i = s._$Eh.get(t);
249
- if (i !== void 0 && this._$Em !== i) {
250
- const h = s.getPropertyOptions(i), a = typeof h.converter == "function" ? { fromAttribute: h.converter } : ((n = h.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? h.converter : W;
251
- this._$Em = i;
252
- const c = a.fromAttribute(e, h.type);
253
- this[i] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(i)) ?? c, this._$Em = null;
254
- }
255
- }
256
- requestUpdate(t, e, s) {
257
- var i;
258
- if (t !== void 0) {
259
- const n = this.constructor, o = this[t];
260
- if (s ?? (s = n.getPropertyOptions(t)), !((s.hasChanged ?? J)(o, e) || s.useDefault && s.reflect && o === ((i = this._$Ej) == null ? void 0 : i.get(t)) && !this.hasAttribute(n._$Eu(t, s)))) return;
261
- this.C(t, e, s);
262
- }
263
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
264
- }
265
- C(t, e, { useDefault: s, reflect: i, wrapped: n }, o) {
266
- s && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), i === !0 && this._$Em !== t && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t));
267
- }
268
- async _$EP() {
269
- this.isUpdatePending = !0;
270
- try {
271
- await this._$ES;
272
- } catch (e) {
273
- Promise.reject(e);
274
- }
275
- const t = this.scheduleUpdate();
276
- return t != null && await t, !this.isUpdatePending;
277
- }
278
- scheduleUpdate() {
279
- return this.performUpdate();
280
- }
281
- performUpdate() {
282
- var s;
283
- if (!this.isUpdatePending) return;
284
- if (!this.hasUpdated) {
285
- if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
286
- for (const [n, o] of this._$Ep) this[n] = o;
287
- this._$Ep = void 0;
288
- }
289
- const i = this.constructor.elementProperties;
290
- if (i.size > 0) for (const [n, o] of i) {
291
- const { wrapped: h } = o, a = this[n];
292
- h !== !0 || this._$AL.has(n) || a === void 0 || this.C(n, void 0, o, a);
293
- }
294
- }
295
- let t = !1;
296
- const e = this._$AL;
297
- try {
298
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
299
- var n;
300
- return (n = i.hostUpdate) == null ? void 0 : n.call(i);
301
- }), this.update(e)) : this._$EM();
302
- } catch (i) {
303
- throw t = !1, this._$EM(), i;
304
- }
305
- t && this._$AE(e);
306
- }
307
- willUpdate(t) {
308
- }
309
- _$AE(t) {
310
- var e;
311
- (e = this._$EO) == null || e.forEach((s) => {
312
- var i;
313
- return (i = s.hostUpdated) == null ? void 0 : i.call(s);
314
- }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
315
- }
316
- _$EM() {
317
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
318
- }
319
- get updateComplete() {
320
- return this.getUpdateComplete();
321
- }
322
- getUpdateComplete() {
323
- return this._$ES;
324
- }
325
- shouldUpdate(t) {
326
- return !0;
327
- }
328
- update(t) {
329
- this._$Eq && (this._$Eq = this._$Eq.forEach((e) => this._$ET(e, this[e]))), this._$EM();
330
- }
331
- updated(t) {
332
- }
333
- firstUpdated(t) {
334
- }
335
- };
336
- y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[C("elementProperties")] = /* @__PURE__ */ new Map(), y[C("finalized")] = /* @__PURE__ */ new Map(), j == null || j({ ReactiveElement: y }), (_.reactiveElementVersions ?? (_.reactiveElementVersions = [])).push("2.1.1");
337
- /**
338
- * @license
339
- * Copyright 2017 Google LLC
340
- * SPDX-License-Identifier: BSD-3-Clause
341
- */
342
- const P = globalThis, D = P.trustedTypes, et = D ? D.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, dt = "$lit$", f = `lit$${Math.random().toFixed(9).slice(2)}$`, pt = "?" + f, xt = `<${pt}>`, A = document, O = () => A.createComment(""), T = (r) => r === null || typeof r != "object" && typeof r != "function", K = Array.isArray, Ct = (r) => K(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", I = `[
343
- \f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, st = /-->/g, it = />/g, m = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
344
- \f\r"'\`<>=]|("|')|))|$)`, "g"), rt = /'/g, nt = /"/g, ut = /^(?:script|style|textarea|title)$/i, Pt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), Ut = Pt(1), E = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), ot = /* @__PURE__ */ new WeakMap(), g = A.createTreeWalker(A, 129);
345
- function $t(r, t) {
346
- if (!K(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
347
- return et !== void 0 ? et.createHTML(t) : t;
348
- }
349
- const Ot = (r, t) => {
350
- const e = r.length - 1, s = [];
351
- let i, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = x;
352
- for (let h = 0; h < e; h++) {
353
- const a = r[h];
354
- let c, p, l = -1, u = 0;
355
- for (; u < a.length && (o.lastIndex = u, p = o.exec(a), p !== null); ) u = o.lastIndex, o === x ? p[1] === "!--" ? o = st : p[1] !== void 0 ? o = it : p[2] !== void 0 ? (ut.test(p[2]) && (i = RegExp("</" + p[2], "g")), o = m) : p[3] !== void 0 && (o = m) : o === m ? p[0] === ">" ? (o = i ?? x, l = -1) : p[1] === void 0 ? l = -2 : (l = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? m : p[3] === '"' ? nt : rt) : o === nt || o === rt ? o = m : o === st || o === it ? o = x : (o = m, i = void 0);
356
- const $ = o === m && r[h + 1].startsWith("/>") ? " " : "";
357
- n += o === x ? a + xt : l >= 0 ? (s.push(c), a.slice(0, l) + dt + a.slice(l) + f + $) : a + f + (l === -2 ? h : $);
358
- }
359
- return [$t(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
360
- };
361
- class M {
362
- constructor({ strings: t, _$litType$: e }, s) {
363
- let i;
364
- this.parts = [];
365
- let n = 0, o = 0;
366
- const h = t.length - 1, a = this.parts, [c, p] = Ot(t, e);
367
- if (this.el = M.createElement(c, s), g.currentNode = this.el.content, e === 2 || e === 3) {
368
- const l = this.el.content.firstChild;
369
- l.replaceWith(...l.childNodes);
370
- }
371
- for (; (i = g.nextNode()) !== null && a.length < h; ) {
372
- if (i.nodeType === 1) {
373
- if (i.hasAttributes()) for (const l of i.getAttributeNames()) if (l.endsWith(dt)) {
374
- const u = p[o++], $ = i.getAttribute(l).split(f), R = /([.?@])?(.*)/.exec(u);
375
- a.push({ type: 1, index: n, name: R[2], strings: $, ctor: R[1] === "." ? Mt : R[1] === "?" ? Ht : R[1] === "@" ? Nt : B }), i.removeAttribute(l);
376
- } else l.startsWith(f) && (a.push({ type: 6, index: n }), i.removeAttribute(l));
377
- if (ut.test(i.tagName)) {
378
- const l = i.textContent.split(f), u = l.length - 1;
379
- if (u > 0) {
380
- i.textContent = D ? D.emptyScript : "";
381
- for (let $ = 0; $ < u; $++) i.append(l[$], O()), g.nextNode(), a.push({ type: 2, index: ++n });
382
- i.append(l[u], O());
383
- }
384
- }
385
- } else if (i.nodeType === 8) if (i.data === pt) a.push({ type: 2, index: n });
386
- else {
387
- let l = -1;
388
- for (; (l = i.data.indexOf(f, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += f.length - 1;
389
- }
390
- n++;
391
- }
392
- }
393
- static createElement(t, e) {
394
- const s = A.createElement("template");
395
- return s.innerHTML = t, s;
396
- }
397
- }
398
- function b(r, t, e = r, s) {
399
- var o, h;
400
- if (t === E) return t;
401
- let i = s !== void 0 ? (o = e._$Co) == null ? void 0 : o[s] : e._$Cl;
402
- const n = T(t) ? void 0 : t._$litDirective$;
403
- return (i == null ? void 0 : i.constructor) !== n && ((h = i == null ? void 0 : i._$AO) == null || h.call(i, !1), n === void 0 ? i = void 0 : (i = new n(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = b(r, i._$AS(r, t.values), i, s)), t;
404
- }
405
- class Tt {
406
- constructor(t, e) {
407
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
408
- }
409
- get parentNode() {
410
- return this._$AM.parentNode;
411
- }
412
- get _$AU() {
413
- return this._$AM._$AU;
414
- }
415
- u(t) {
416
- const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? A).importNode(e, !0);
417
- g.currentNode = i;
418
- let n = g.nextNode(), o = 0, h = 0, a = s[0];
419
- for (; a !== void 0; ) {
420
- if (o === a.index) {
421
- let c;
422
- a.type === 2 ? c = new N(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Rt(n, this, t)), this._$AV.push(c), a = s[++h];
423
- }
424
- o !== (a == null ? void 0 : a.index) && (n = g.nextNode(), o++);
425
- }
426
- return g.currentNode = A, i;
427
- }
428
- p(t) {
429
- let e = 0;
430
- for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
431
- }
432
- }
433
- class N {
434
- get _$AU() {
435
- var t;
436
- return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
437
- }
438
- constructor(t, e, s, i) {
439
- this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
440
- }
441
- get parentNode() {
442
- let t = this._$AA.parentNode;
443
- const e = this._$AM;
444
- return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
445
- }
446
- get startNode() {
447
- return this._$AA;
448
- }
449
- get endNode() {
450
- return this._$AB;
451
- }
452
- _$AI(t, e = this) {
453
- t = b(this, t, e), T(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== E && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ct(t) ? this.k(t) : this._(t);
454
- }
455
- O(t) {
456
- return this._$AA.parentNode.insertBefore(t, this._$AB);
457
- }
458
- T(t) {
459
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
460
- }
461
- _(t) {
462
- this._$AH !== d && T(this._$AH) ? this._$AA.nextSibling.data = t : this.T(A.createTextNode(t)), this._$AH = t;
463
- }
464
- $(t) {
465
- var n;
466
- const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = M.createElement($t(s.h, s.h[0]), this.options)), s);
467
- if (((n = this._$AH) == null ? void 0 : n._$AD) === i) this._$AH.p(e);
468
- else {
469
- const o = new Tt(i, this), h = o.u(this.options);
470
- o.p(e), this.T(h), this._$AH = o;
471
- }
472
- }
473
- _$AC(t) {
474
- let e = ot.get(t.strings);
475
- return e === void 0 && ot.set(t.strings, e = new M(t)), e;
476
- }
477
- k(t) {
478
- K(this._$AH) || (this._$AH = [], this._$AR());
479
- const e = this._$AH;
480
- let s, i = 0;
481
- for (const n of t) i === e.length ? e.push(s = new N(this.O(O()), this.O(O()), this, this.options)) : s = e[i], s._$AI(n), i++;
482
- i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
483
- }
484
- _$AR(t = this._$AA.nextSibling, e) {
485
- var s;
486
- for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t !== this._$AB; ) {
487
- const i = t.nextSibling;
488
- t.remove(), t = i;
489
- }
490
- }
491
- setConnected(t) {
492
- var e;
493
- this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
494
- }
495
- }
496
- class B {
497
- get tagName() {
498
- return this.element.tagName;
499
- }
500
- get _$AU() {
501
- return this._$AM._$AU;
502
- }
503
- constructor(t, e, s, i, n) {
504
- this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = n, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = d;
505
- }
506
- _$AI(t, e = this, s, i) {
507
- const n = this.strings;
508
- let o = !1;
509
- if (n === void 0) t = b(this, t, e, 0), o = !T(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
510
- else {
511
- const h = t;
512
- let a, c;
513
- for (t = n[0], a = 0; a < n.length - 1; a++) c = b(this, h[s + a], e, a), c === E && (c = this._$AH[a]), o || (o = !T(c) || c !== this._$AH[a]), c === d ? t = d : t !== d && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c;
514
- }
515
- o && !i && this.j(t);
516
- }
517
- j(t) {
518
- t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
519
- }
520
- }
521
- class Mt extends B {
522
- constructor() {
523
- super(...arguments), this.type = 3;
524
- }
525
- j(t) {
526
- this.element[this.name] = t === d ? void 0 : t;
527
- }
528
- }
529
- class Ht extends B {
530
- constructor() {
531
- super(...arguments), this.type = 4;
532
- }
533
- j(t) {
534
- this.element.toggleAttribute(this.name, !!t && t !== d);
535
- }
536
- }
537
- class Nt extends B {
538
- constructor(t, e, s, i, n) {
539
- super(t, e, s, i, n), this.type = 5;
540
- }
541
- _$AI(t, e = this) {
542
- if ((t = b(this, t, e, 0) ?? d) === E) return;
543
- const s = this._$AH, i = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== d && (s === d || i);
544
- i && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
545
- }
546
- handleEvent(t) {
547
- var e;
548
- typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
549
- }
550
- }
551
- class Rt {
552
- constructor(t, e, s) {
553
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
554
- }
555
- get _$AU() {
556
- return this._$AM._$AU;
557
- }
558
- _$AI(t) {
559
- b(this, t);
560
- }
561
- }
562
- const z = P.litHtmlPolyfillSupport;
563
- z == null || z(M, N), (P.litHtmlVersions ?? (P.litHtmlVersions = [])).push("3.3.1");
564
- const kt = (r, t, e) => {
565
- const s = (e == null ? void 0 : e.renderBefore) ?? t;
566
- let i = s._$litPart$;
567
- if (i === void 0) {
568
- const n = (e == null ? void 0 : e.renderBefore) ?? null;
569
- s._$litPart$ = i = new N(t.insertBefore(O(), n), n, void 0, e ?? {});
570
- }
571
- return i._$AI(r), i;
572
10
  };
573
- /**
574
- * @license
575
- * Copyright 2017 Google LLC
576
- * SPDX-License-Identifier: BSD-3-Clause
577
- */
578
- const v = globalThis;
579
- class U extends y {
580
- constructor() {
581
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
582
- }
583
- createRenderRoot() {
584
- var e;
585
- const t = super.createRenderRoot();
586
- return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
587
- }
588
- update(t) {
589
- const e = this.render();
590
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions);
591
- }
11
+ let o = class extends l({
12
+ breakpoints: !0,
13
+ subLayoutApply: !0,
14
+ slotVisibility: !0,
15
+ eventBinding: !1
16
+ }) {
592
17
  connectedCallback() {
593
- var t;
594
- super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
595
- }
596
- disconnectedCallback() {
597
- var t;
598
- super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
18
+ super.connectedCallback(), this.classList.add("ntl-2col");
599
19
  }
600
20
  render() {
601
- return E;
602
- }
603
- }
604
- var ht;
605
- U._$litElement$ = !0, U.finalized = !0, (ht = v.litElementHydrateSupport) == null || ht.call(v, { LitElement: U });
606
- const q = v.litElementPolyfillSupport;
607
- q == null || q({ LitElement: U });
608
- (v.litElementVersions ?? (v.litElementVersions = [])).push("4.2.1");
609
- /**
610
- * @license
611
- * Copyright 2017 Google LLC
612
- * SPDX-License-Identifier: BSD-3-Clause
613
- */
614
- const Wt = (r) => (t, e) => {
615
- e !== void 0 ? e.addInitializer(() => {
616
- customElements.define(r, t);
617
- }) : customElements.define(r, t);
618
- };
619
- /**
620
- * @license
621
- * Copyright 2017 Google LLC
622
- * SPDX-License-Identifier: BSD-3-Clause
623
- */
624
- const Dt = { attribute: !0, type: String, converter: W, reflect: !1, hasChanged: J }, Bt = (r = Dt, t, e) => {
625
- const { kind: s, metadata: i } = e;
626
- let n = globalThis.litPropertyMetadata.get(i);
627
- if (n === void 0 && globalThis.litPropertyMetadata.set(i, n = /* @__PURE__ */ new Map()), s === "setter" && ((r = Object.create(r)).wrapped = !0), n.set(e.name, r), s === "accessor") {
628
- const { name: o } = e;
629
- return { set(h) {
630
- const a = t.get.call(this);
631
- t.set.call(this, h), this.requestUpdate(o, a, r);
632
- }, init(h) {
633
- return h !== void 0 && this.C(o, void 0, r, h), h;
634
- } };
635
- }
636
- if (s === "setter") {
637
- const { name: o } = e;
638
- return function(h) {
639
- const a = this[o];
640
- t.call(this, h), this.requestUpdate(o, a, r);
641
- };
642
- }
643
- throw Error("Unsupported decorator location: " + s);
644
- };
645
- function ft(r) {
646
- return (t, e) => typeof e == "object" ? Bt(r, t, e) : ((s, i, n) => {
647
- const o = i.hasOwnProperty(n);
648
- return i.constructor.createProperty(n, s), o ? Object.getOwnPropertyDescriptor(i, n) : void 0;
649
- })(r, t, e);
650
- }
651
- function Lt(r, t) {
652
- const e = document.createElement("template");
653
- return e.innerHTML = r.trim(), t.append(e.content.cloneNode(!0)), new Proxy({}, {
654
- get(s, i) {
655
- if (i === "fragment")
656
- return t;
657
- if (typeof i == "string") {
658
- const n = t.getElementById(i);
659
- if (!n)
660
- throw new Error(`❌ Unknown id '${i}'.`);
661
- return n;
662
- }
663
- }
664
- });
665
- }
666
- const G = class G extends y {
667
- constructor(t) {
668
- super();
669
- const e = this.createRenderRoot();
670
- this.$ = Lt(t, e);
671
- }
672
- connectedCallback() {
673
- super.connectedCallback();
674
- let t = this.css;
675
- Array.isArray(t) || (t = [t]);
676
- const e = t.map((s) => s instanceof ct ? s.styleSheet : F(s).styleSheet);
677
- this.shadowRoot.adoptedStyleSheets = e;
678
- }
679
- };
680
- G.DEFINITION = {
681
- classes: [],
682
- attributes: {}
683
- };
684
- let at = G;
685
- const jt = ":host{--container-width: var(--nt-container-width, 100%);--gap: var(--nt-base-gap);--x-direction: row;--y-direction: column}:host(.desktop-reverse){--x-direction: row-reverse}:host(.mobile-reverse){--y-direction: column-reverse}:host(.alternate:nth-child(odd)) .row div[part=main]{order:2}:host(.alternate:nth-child(odd)) .row div[part=aside]{order:1}#row{width:var(--container-width);display:flex;gap:var(--gap)}#row.row{flex-direction:var(--x-direction)}#row.row div[part=main]{width:calc(100% * var(--cols, 1) / 12)}#row.row div[part=aside]{width:calc(100% * (12 - var(--cols, 1)) / 12)}#row.col{flex-direction:var(--y-direction)}#row.col slot{width:100%}div[part]{display:flex;flex-grow:1}div[part]:has(slot.is-empty){display:none}section{width:var(--container-width);margin:0 auto}";
686
- var It = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Z = (r, t, e, s) => {
687
- for (var i = s > 1 ? void 0 : s ? zt(t, e) : t, n = r.length - 1, o; n >= 0; n--)
688
- (o = r[n]) && (i = (s ? o(t, e, i) : o(i)) || i);
689
- return s && i && It(t, e, i), i;
690
- };
691
- let H = class extends U {
692
- constructor() {
693
- super(...arguments), this.breakAt = "md", this.cols = 6;
694
- }
695
- connectedCallback() {
696
- super.connectedCallback(), window.addEventListener("breakpoint-changed", () => this.requestUpdate());
697
- }
698
- firstUpdated(r) {
699
- var t;
700
- super.firstUpdated(r), (t = this.shadowRoot) == null || t.querySelectorAll("slot").forEach((e) => {
701
- e.assignedElements().length === 0 ? e.classList.add("is-empty") : e.classList.remove("is-empty");
702
- });
703
- }
704
- render() {
705
- const r = mt(this.breakAt);
706
- return Ut`
707
- <section part="section" style="--cols: ${this.cols};">
708
- <div part="top">
709
- <slot name="top"></slot>
21
+ return p`
22
+ <div part="container" id="container">
23
+ <div part="header" id="header">
24
+ <slot name="header" data-query="@var(--ntl-2col-header-selector) | :scope > .header"></slot>
710
25
  </div>
711
- <div id="row" class="${r ? "row" : "col"}">
712
- <div part="main">
26
+ <div part="wrapper" id="wrapper">
27
+ <div part="top" id="top">
28
+ <slot name="top" data-query="@var(--ntl-2col-top-selector) | :scope > .top"></slot>
29
+ </div>
30
+ <div part="main" id="main">
713
31
  <slot></slot>
714
32
  </div>
715
- <div part="aside">
716
- <slot name="aside"></slot>
33
+ <div part="aside" id="aside">
34
+ <slot
35
+ name="aside"
36
+ data-query="@var(--ntl-2col-aside-selector) | :scope > .aside | :scope > p:has(img)"
37
+ data-set-attribute-class="auto"
38
+ ></slot>
39
+ </div>
40
+ <div part="bottom" id="bottom">
41
+ <slot name="bottom" data-query="@var(--ntl-2col-bottom-selector) | :scope > .bottom"></slot>
717
42
  </div>
718
43
  </div>
719
- <div part="bottom">
720
- <slot name="bottom"></slot>
44
+ <div part="footer" id="footer">
45
+ <slot name="footer" data-query="@var(--ntl-2col-footer-selector) | :scope > .footer"></slot>
721
46
  </div>
722
- </section>
47
+ </div>
723
48
  `;
724
49
  }
725
50
  };
726
- H.styles = [F(jt)];
727
- Z([
728
- ft({ type: String, reflect: !0 })
729
- ], H.prototype, "breakAt", 2);
730
- Z([
731
- ft({ type: Number, reflect: !0 })
732
- ], H.prototype, "cols", 2);
733
- H = Z([
734
- Wt("ntl-2col")
735
- ], H);
51
+ o.styles = [d(c), d(h)];
52
+ o = v([
53
+ m("ntl-2col")
54
+ ], o);
736
55
  export {
737
- H as Ntl2Col
56
+ o as Ntl2Col
738
57
  };