@cossackframework/renderer 0.5.1 → 0.6.0
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -90,7 +90,7 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
90
90
|
}
|
|
91
91
|
mount(e) {
|
|
92
92
|
this.addRenderListener((t) => {
|
|
93
|
-
t && (
|
|
93
|
+
t && (g(t) ? k(t, e) : k(m`${t}`, e));
|
|
94
94
|
}), this.requestUpdate();
|
|
95
95
|
}
|
|
96
96
|
addEventListener(e, t, n) {
|
|
@@ -133,37 +133,44 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
133
133
|
constructor(e, t, n) {
|
|
134
134
|
this.items = e, this.keyFn = t, this.templateFn = n;
|
|
135
135
|
}
|
|
136
|
-
}, s =
|
|
136
|
+
}, s = class {
|
|
137
|
+
value;
|
|
138
|
+
template;
|
|
139
|
+
constructor(e, t) {
|
|
140
|
+
this.value = e, this.template = t;
|
|
141
|
+
}
|
|
142
|
+
}, c = (e) => new a(e), l = (e, t, n) => n === void 0 ? new o(e, (e, t) => t, t) : new o(e, t, n), u = (e) => Object.keys(e).filter((t) => e[t]).join(" "), d = (e) => Object.keys(e).filter((t) => e[t] != null).map((t) => `${t}:${e[t]}`).join(";"), f = (e, t) => new s(e, t), p = class {
|
|
137
143
|
strings;
|
|
138
144
|
values;
|
|
139
145
|
_cossack_template_result = !0;
|
|
140
146
|
constructor(e, t) {
|
|
141
147
|
this.strings = e, this.values = t;
|
|
142
148
|
}
|
|
143
|
-
},
|
|
149
|
+
}, m = (e, ...t) => new p(e, t), h = (e, t = {}, n) => m`${{
|
|
144
150
|
_type: "COMPONENT",
|
|
145
151
|
clazz: e,
|
|
146
152
|
props: t,
|
|
147
153
|
children: n
|
|
148
|
-
}}`,
|
|
154
|
+
}}`, g = (e) => typeof e == "object" && !!e && e._cossack_template_result === !0, _ = class {
|
|
149
155
|
value;
|
|
150
156
|
constructor(e) {
|
|
151
157
|
this.value = e;
|
|
152
158
|
}
|
|
153
|
-
},
|
|
159
|
+
}, v = (e) => new _(e), y = (e) => e instanceof _, b = (e) => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), x = (t) => {
|
|
154
160
|
if (t == null || t === !1) return "";
|
|
155
|
-
if (Array.isArray(t)) return t.map(
|
|
156
|
-
if (
|
|
157
|
-
if (t instanceof a) return
|
|
158
|
-
if (t instanceof o) return t.items.map((e, n) =>
|
|
161
|
+
if (Array.isArray(t)) return t.map(x).join("");
|
|
162
|
+
if (g(t)) return w(t);
|
|
163
|
+
if (t instanceof a) return x(t.value);
|
|
164
|
+
if (t instanceof o) return t.items.map((e, n) => x(t.templateFn(e, n))).join("");
|
|
165
|
+
if (t instanceof s) return x(t.template);
|
|
159
166
|
if (e(t)) {
|
|
160
167
|
let e = new t.clazz();
|
|
161
168
|
Object.assign(e, t.props), "props" in e && (e.props = t.props), e.children = t.children, e.__parent = i.currentRenderingInstance, e.__parent && (e._id = `${e.__parent._id}:${e.__parent._childCounter++}`), e.connectedCallback(), n(e), e.willUpdate(/* @__PURE__ */ new Map());
|
|
162
169
|
let a = e.render(), o = "";
|
|
163
|
-
return a && (o =
|
|
170
|
+
return a && (o = g(a) ? w(a) : w(m`${a}`)), r(), o;
|
|
164
171
|
}
|
|
165
|
-
return
|
|
166
|
-
},
|
|
172
|
+
return y(t) ? t.value : typeof t == "function" || typeof t == "object" && t && "value" in t ? "" : b(t);
|
|
173
|
+
}, S = (e) => {
|
|
167
174
|
let t = "";
|
|
168
175
|
if (typeof e == "object" && e) for (let [n, r] of Object.entries(e)) {
|
|
169
176
|
if (n.startsWith("@")) continue;
|
|
@@ -172,10 +179,10 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
172
179
|
r && (t += ` ${n.slice(1)}`);
|
|
173
180
|
continue;
|
|
174
181
|
}
|
|
175
|
-
n.startsWith(".") && (e = n.slice(1)), typeof i == "boolean" ? i && (t += ` ${e}`) : typeof i == "function" || i != null && (t += ` ${e}="${
|
|
182
|
+
n.startsWith(".") && (e = n.slice(1)), typeof i == "boolean" ? i && (t += ` ${e}`) : typeof i == "function" || i != null && (t += ` ${e}="${b(i)}"`);
|
|
176
183
|
}
|
|
177
184
|
return t;
|
|
178
|
-
},
|
|
185
|
+
}, C = class {
|
|
179
186
|
resultObj;
|
|
180
187
|
result = "";
|
|
181
188
|
stringIdx = 0;
|
|
@@ -193,17 +200,17 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
193
200
|
let t = r[0], i = r[1];
|
|
194
201
|
this.result = this.result.substring(0, this.result.length - t.length);
|
|
195
202
|
let a = t.endsWith("\"") ? "\"" : t.endsWith("'") ? "'" : "", o = !0;
|
|
196
|
-
if (i === "..." ? (this.result = this.result.trimEnd(), this.result +=
|
|
203
|
+
if (i === "..." ? (this.result = this.result.trimEnd(), this.result += S(n)) : i.startsWith("@") ? this.result = this.result.trimEnd() : i.startsWith("?") ? n ? (this.result = this.result.trimEnd(), this.result += ` ${i.slice(1)}`) : this.result = this.result.trimEnd() : i.startsWith(".") ? n != null && n !== !1 ? (this.result = this.result.trimEnd(), this.result += ` ${i.slice(1)}="${x(n)}"`) : this.result = this.result.trimEnd() : (this.result += t, this.result += x(n), o = !1), a && o) {
|
|
197
204
|
let t = e[this.stringIdx + 1];
|
|
198
205
|
t && t.startsWith(a) && (this.charIdxForNext = 1);
|
|
199
206
|
}
|
|
200
|
-
} else this.result +=
|
|
207
|
+
} else this.result += x(n);
|
|
201
208
|
}
|
|
202
209
|
this.stringIdx++;
|
|
203
210
|
}
|
|
204
211
|
return this.result;
|
|
205
212
|
}
|
|
206
|
-
},
|
|
213
|
+
}, w = (e) => new C(e).scan(), T = class t {
|
|
207
214
|
startNode;
|
|
208
215
|
endNode;
|
|
209
216
|
componentInstance = null;
|
|
@@ -212,14 +219,21 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
212
219
|
_partKeys = [];
|
|
213
220
|
_cachedTemplateStrings = null;
|
|
214
221
|
_cachedParts = null;
|
|
222
|
+
_key = void 0;
|
|
223
|
+
_keySet = !1;
|
|
215
224
|
constructor(e, t) {
|
|
216
225
|
this.startNode = e, this.endNode = t;
|
|
217
226
|
}
|
|
218
227
|
update(t) {
|
|
219
|
-
this.componentInstance && (!e(t) || t.clazz !== this.componentInstance.constructor) && this.disposeComponent(), !(t instanceof o) && !Array.isArray(t) && this._childParts.length > 0 && this.clearChildParts(), e(t) ? this.updateComponent(t) : t instanceof o ? this.updateRepeat(t) : Array.isArray(t) ? this.updateArray(t) : this.updateNode(t);
|
|
228
|
+
this.componentInstance && (!e(t) || t.clazz !== this.componentInstance.constructor) && this.disposeComponent(), !(t instanceof o) && !Array.isArray(t) && this._childParts.length > 0 && this.clearChildParts(), e(t) ? this.updateComponent(t) : t instanceof o ? this.updateRepeat(t) : t instanceof s ? this.updateKey(t) : Array.isArray(t) ? this.updateArray(t) : this.updateNode(t);
|
|
229
|
+
}
|
|
230
|
+
teardownComponent(e) {
|
|
231
|
+
if (this.renderListener &&= (e.removeRenderListener(this.renderListener), null), e.disconnectedCallback(), typeof e.destroy == "function") try {
|
|
232
|
+
e.destroy();
|
|
233
|
+
} catch {}
|
|
220
234
|
}
|
|
221
235
|
disposeComponent() {
|
|
222
|
-
this.componentInstance && (this.
|
|
236
|
+
this.componentInstance && (this.teardownComponent(this.componentInstance), this.componentInstance = null, this._clearTemplateCache());
|
|
223
237
|
}
|
|
224
238
|
updateComponent(e) {
|
|
225
239
|
this.componentInstance || (this.componentInstance = new e.clazz(), this.componentInstance.__parent = i.currentRenderingInstance, this.componentInstance.__parent && (this.componentInstance._id = `${this.componentInstance.__parent._id}:${this.componentInstance.__parent._childCounter++}`), this.renderListener = (e) => {
|
|
@@ -242,6 +256,10 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
242
256
|
l ? (i.delete(c), l.startNode.previousSibling !== s && this.movePart(l, s), l.update(r(e, t))) : (l = this.createChildPart(s), l.update(r(e, t))), a.push(l), s = l.endNode;
|
|
243
257
|
}), i.forEach((e) => e.dispose()), this._childParts = a, this._partKeys = o;
|
|
244
258
|
}
|
|
259
|
+
updateKey(e) {
|
|
260
|
+
let t = !this._keySet || !Object.is(this._key, e.value);
|
|
261
|
+
this._keySet = !0, this._key = e.value, t && (this.componentInstance && this.disposeComponent(), this._clearTemplateCache(), this.clear()), this.updateNode(e.template);
|
|
262
|
+
}
|
|
245
263
|
updateArray(e) {
|
|
246
264
|
this._partKeys = [];
|
|
247
265
|
let t = Math.min(e.length, this._childParts.length);
|
|
@@ -270,27 +288,27 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
270
288
|
this._childParts.forEach((e) => e.dispose()), this._childParts = [], this._partKeys = [];
|
|
271
289
|
}
|
|
272
290
|
dispose() {
|
|
273
|
-
this.clear(), this._clearTemplateCache(), this.clearChildParts(), this.startNode.parentNode && this.startNode.parentNode.removeChild(this.startNode), this.endNode.parentNode && this.endNode.parentNode.removeChild(this.endNode), this.componentInstance
|
|
291
|
+
this.clear(), this._clearTemplateCache(), this.clearChildParts(), this.startNode.parentNode && this.startNode.parentNode.removeChild(this.startNode), this.endNode.parentNode && this.endNode.parentNode.removeChild(this.endNode), this.componentInstance &&= (this.teardownComponent(this.componentInstance), null);
|
|
274
292
|
}
|
|
275
293
|
updateNode(t) {
|
|
276
|
-
if (this.startNode.parentNode) if (
|
|
294
|
+
if (this.startNode.parentNode) if (g(t)) if (this._cachedTemplateStrings === t.strings && this._cachedParts) this._cachedParts.forEach((e, n) => {
|
|
277
295
|
e.update(t.values[n]);
|
|
278
296
|
});
|
|
279
297
|
else {
|
|
280
298
|
this._clearTemplateCache(), this.clear();
|
|
281
299
|
let e = document.createDocumentFragment();
|
|
282
|
-
|
|
283
|
-
let n =
|
|
300
|
+
k(t, e), this.startNode.parentNode.insertBefore(e, this.endNode);
|
|
301
|
+
let n = O.get(e.firstChild?.childNodes[0] || e);
|
|
284
302
|
n && (this._cachedTemplateStrings = n.strings, this._cachedParts = n.parts);
|
|
285
303
|
}
|
|
286
|
-
else if (
|
|
287
|
-
this._clearTemplateCache(), this.clear();
|
|
288
|
-
let e = document.createDocumentFragment();
|
|
289
|
-
O(f`${t}`, e), this.startNode.parentNode.insertBefore(e, this.endNode);
|
|
290
|
-
} else if (v(t)) {
|
|
304
|
+
else if (y(t)) {
|
|
291
305
|
this._clearTemplateCache(), this.clear();
|
|
292
306
|
let e = document.createElement("template");
|
|
293
307
|
e.innerHTML = t.value, this.startNode.parentNode.insertBefore(e.content, this.endNode);
|
|
308
|
+
} else if (e(t) || typeof t == "object" && t && !(t instanceof Node) && !Array.isArray(t)) {
|
|
309
|
+
this._clearTemplateCache(), this.clear();
|
|
310
|
+
let e = document.createDocumentFragment();
|
|
311
|
+
k(m`${t}`, e), this.startNode.parentNode.insertBefore(e, this.endNode);
|
|
294
312
|
} else if (t instanceof Node) this._clearTemplateCache(), this.clear(), this.startNode.parentNode.insertBefore(t, this.endNode);
|
|
295
313
|
else if (t == null || t === !1) this._clearTemplateCache(), this.clear();
|
|
296
314
|
else {
|
|
@@ -304,6 +322,7 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
304
322
|
}
|
|
305
323
|
}
|
|
306
324
|
_clearTemplateCache() {
|
|
325
|
+
if (this._cachedParts) for (let e of this._cachedParts) e && typeof e.dispose == "function" && e.dispose();
|
|
307
326
|
this._cachedTemplateStrings = null, this._cachedParts = null;
|
|
308
327
|
}
|
|
309
328
|
clear() {
|
|
@@ -313,7 +332,7 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
313
332
|
e.parentNode.removeChild(e), e = t;
|
|
314
333
|
}
|
|
315
334
|
}
|
|
316
|
-
},
|
|
335
|
+
}, E = class {
|
|
317
336
|
element;
|
|
318
337
|
previousValues = {};
|
|
319
338
|
constructor(e) {
|
|
@@ -332,24 +351,36 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
332
351
|
} else e.startsWith(".") ? this.element[e.slice(1)] = n : e.startsWith("?") ? n ? this.element.setAttribute(e.slice(1), "") : this.element.removeAttribute(e.slice(1)) : typeof n == "boolean" ? n ? this.element.setAttribute(e, "") : this.element.removeAttribute(e) : n != null && this.element.setAttribute(e, String(n));
|
|
333
352
|
this.previousValues = { ...t };
|
|
334
353
|
}
|
|
335
|
-
},
|
|
354
|
+
}, D = class {
|
|
336
355
|
element;
|
|
337
356
|
name;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
357
|
+
segments;
|
|
358
|
+
isMulti;
|
|
359
|
+
multiState;
|
|
360
|
+
constructor(e, t, n, r) {
|
|
341
361
|
this.element = e, this.name = t;
|
|
342
|
-
let
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
362
|
+
let i = [...n.matchAll(/__CRP_(\d+)__/g)];
|
|
363
|
+
this.segments = [];
|
|
364
|
+
let a = 0;
|
|
365
|
+
for (let e of i) {
|
|
366
|
+
let t = e.index;
|
|
367
|
+
this.segments.push(n.substring(a, t)), a = t + e[0].length;
|
|
368
|
+
}
|
|
369
|
+
this.segments.push(n.substring(a)), this.isMulti = i.length > 1, this.multiState = r ?? null;
|
|
347
370
|
}
|
|
348
371
|
update(e) {
|
|
349
372
|
if (e instanceof a && (e = e.value), this.name === "ref") {
|
|
350
373
|
typeof e == "function" ? e(this.element) : e && typeof e == "object" && "value" in e && (e.value = this.element), this.element.hasAttribute(this.name) && this.element.removeAttribute(this.name);
|
|
351
374
|
return;
|
|
352
375
|
}
|
|
376
|
+
if (this.isMulti && this.multiState) {
|
|
377
|
+
let { currentValues: t, position: n } = this.multiState;
|
|
378
|
+
t[n] = e;
|
|
379
|
+
let r = this.segments[0];
|
|
380
|
+
for (let e = 0; e < t.length; e++) r += String(t[e]) + this.segments[e + 1];
|
|
381
|
+
this.element.setAttribute(this.name, r);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
353
384
|
if (this.name.startsWith("@") && typeof e == "function") {
|
|
354
385
|
let t = this.name.slice(1), n = `__crp_handler_${t}`, r = this.element[n];
|
|
355
386
|
r && this.element.removeEventListener(t, r), this.element[n] = e, this.element.addEventListener(t, e), this.element.hasAttribute(this.name) && this.element.removeAttribute(this.name);
|
|
@@ -363,16 +394,17 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
363
394
|
else if (this.name === "checked" && this.element instanceof HTMLInputElement) {
|
|
364
395
|
let t = !!e;
|
|
365
396
|
this.element.checked !== t && (this.element.checked = t), t ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name);
|
|
366
|
-
} else typeof e == "boolean" ? e ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, this.
|
|
397
|
+
} else typeof e == "boolean" ? e ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, this.segments[0] + String(e) + this.segments[1]);
|
|
367
398
|
}
|
|
368
|
-
},
|
|
369
|
-
let n =
|
|
399
|
+
}, O = /* @__PURE__ */ new WeakMap(), k = (e, t) => {
|
|
400
|
+
let n = O.get(t);
|
|
370
401
|
if (n && n.strings === e.strings) {
|
|
371
402
|
n.parts.forEach((t, n) => {
|
|
372
403
|
t.update(e.values[n]);
|
|
373
404
|
});
|
|
374
405
|
return;
|
|
375
406
|
}
|
|
407
|
+
if (n) for (let e of n.parts) e && typeof e.dispose == "function" && e.dispose();
|
|
376
408
|
let r = [], i = e.values, a = "", o = !1, s = null, c = /(\.\.\.|[.@?]?[a-zA-Z0-9_-]+)=["']?$/;
|
|
377
409
|
for (let t = 0; t < e.strings.length - 1; t++) {
|
|
378
410
|
let n = e.strings[t];
|
|
@@ -398,15 +430,26 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
398
430
|
let t = e.nodeValue?.match(/CRP_(\d+)/);
|
|
399
431
|
if (t) {
|
|
400
432
|
let n = parseInt(t[1]), i = document.createComment("/CRP");
|
|
401
|
-
e.parentNode.insertBefore(i, e.nextSibling), r[n] = new
|
|
433
|
+
e.parentNode.insertBefore(i, e.nextSibling), r[n] = new T(e, i);
|
|
402
434
|
}
|
|
403
435
|
} else if (e.nodeType === Node.ELEMENT_NODE) {
|
|
404
436
|
let t = e;
|
|
405
437
|
Array.from(t.attributes).forEach((e) => {
|
|
406
|
-
let n = e.value.
|
|
407
|
-
if (n)
|
|
408
|
-
|
|
409
|
-
|
|
438
|
+
let n = [...e.value.matchAll(/__CRP_(\d+)__/g)];
|
|
439
|
+
if (n.length === 0) return;
|
|
440
|
+
if (n.length === 1) {
|
|
441
|
+
let i = parseInt(n[0][1]);
|
|
442
|
+
r[i] || (e.name === "..." ? (r[i] = new E(t), t.removeAttribute("...")) : r[i] = new D(t, e.name, e.value));
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (e.name === "...") return;
|
|
446
|
+
let i = n.map((e) => parseInt(e[1])), a = Array(n.length).fill(void 0);
|
|
447
|
+
for (let n = 0; n < i.length; n++) {
|
|
448
|
+
let o = i[n];
|
|
449
|
+
r[o] || (r[o] = new D(t, e.name, e.value, {
|
|
450
|
+
currentValues: a,
|
|
451
|
+
position: n
|
|
452
|
+
}));
|
|
410
453
|
}
|
|
411
454
|
});
|
|
412
455
|
}
|
|
@@ -417,10 +460,10 @@ var e = (e) => typeof e == "object" && !!e && e._type === "COMPONENT", t = [], n
|
|
|
417
460
|
for (; t.firstChild;) t.removeChild(t.firstChild);
|
|
418
461
|
t.appendChild(d);
|
|
419
462
|
}
|
|
420
|
-
|
|
463
|
+
O.set(t, {
|
|
421
464
|
strings: e.strings,
|
|
422
465
|
parts: r
|
|
423
466
|
});
|
|
424
467
|
};
|
|
425
468
|
//#endregion
|
|
426
|
-
export { e as S,
|
|
469
|
+
export { e as C, n as S, l as _, m as a, t as b, k as c, s as d, a as f, c as g, f as h, b as i, w as l, u as m, _ as n, g as o, o as p, h as r, y as s, p as t, v as u, d as v, r as x, i as y };
|
package/dist/cossack-html.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export declare class TemplateResult {
|
|
|
7
7
|
constructor(strings: TemplateStringsArray, values: unknown[]);
|
|
8
8
|
}
|
|
9
9
|
export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
|
|
10
|
-
export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
|
|
11
10
|
export declare const component: <T extends CossackElement>(clazz: new () => T, props?: Record<string, unknown>, children?: unknown) => TemplateResult;
|
|
12
11
|
export declare const isTemplateResult: (value: unknown) => value is TemplateResult;
|
|
13
12
|
export declare class UnsafeHTMLResult {
|
package/dist/directives.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export declare class RepeatResult {
|
|
|
8
8
|
readonly templateFn: (item: any, index: number) => unknown;
|
|
9
9
|
constructor(items: unknown[], keyFn: (item: any, index: number) => unknown, templateFn: (item: any, index: number) => unknown);
|
|
10
10
|
}
|
|
11
|
+
export declare class KeyResult {
|
|
12
|
+
readonly value: unknown;
|
|
13
|
+
readonly template: unknown;
|
|
14
|
+
constructor(value: unknown, template: unknown);
|
|
15
|
+
}
|
|
11
16
|
/**
|
|
12
17
|
* Checks against the DOM value instead of the previous rendered value.
|
|
13
18
|
* Usage: <input .value=${live(x)}>
|
|
@@ -28,4 +33,10 @@ export declare const classMap: (classInfo: Record<string, string | boolean | num
|
|
|
28
33
|
* Usage: style="${styleMap({ color: 'red' })}"
|
|
29
34
|
*/
|
|
30
35
|
export declare const styleMap: (styleInfo: Record<string, string | undefined | null>) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Forces its subtree to be recreated when `value` changes.
|
|
38
|
+
* Useful for re-triggering CSS animations and forcing remounts.
|
|
39
|
+
* Usage: html`${key(id, html`<child></child>`)}`
|
|
40
|
+
*/
|
|
41
|
+
export declare const key: (value: unknown, template: unknown) => KeyResult;
|
|
31
42
|
export type RefCallback = (el: Element | undefined) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, x, y as S } from "./cossack-html-QsGiJk7a.js";
|
|
2
2
|
//#region src/context.ts
|
|
3
|
-
function
|
|
3
|
+
function C(e) {
|
|
4
4
|
return {
|
|
5
5
|
id: Math.random().toString(36).slice(2),
|
|
6
6
|
defaultValue: e
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { S as CossackElement, o as KeyResult, s as LiveResult, h as RepeatResult, v as TemplateResult, p as UnsafeHTMLResult, f as classMap, g as component, C as createContext, u as escapeHtml, r as html, i as instanceStack, e as isComponentResult, m as isTemplateResult, _ as isUnsafeHTML, l as key, c as live, x as popCurrentInstance, t as pushCurrentInstance, a as render, d as renderToString, n as repeat, b as styleMap, y as unsafeHTML };
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as e, l as t } from "./cossack-html-
|
|
1
|
+
import { i as e, l as t } from "./cossack-html-QsGiJk7a.js";
|
|
2
2
|
//#region src/minify-html.ts
|
|
3
|
-
var n = /<(script|style|pre|textarea)\b[^>]*>[\s\S]*?<\/\1>/gi, r = RegExp(`<(${[
|
|
3
|
+
var n = /<(script|style|pre|textarea)\b[^>]*>[\s\S]*?<\/\1>/gi, r = RegExp(`<(${[.../* @__PURE__ */ new Set([
|
|
4
4
|
"area",
|
|
5
5
|
"base",
|
|
6
6
|
"br",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cossackframework/renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Light DOM rendering engine for the Cossack Framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,13 +28,11 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"htmlparser2": "^10.0.0",
|
|
32
|
-
"magic-string": "^0.30.21",
|
|
33
31
|
"oxlint": "^1.41.0",
|
|
34
|
-
"vite": "^8.
|
|
32
|
+
"vite": "^8.1.0",
|
|
35
33
|
"vite-plugin-dts": "^3.9.1",
|
|
36
34
|
"vite-tsconfig-paths": "^5.1.4",
|
|
37
|
-
"vitest": "^
|
|
35
|
+
"vitest": "^4.1.9"
|
|
38
36
|
},
|
|
39
37
|
"scripts": {
|
|
40
38
|
"build": "vite build",
|