thunderous 0.6.1 → 0.6.2
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.cjs +20 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +20 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1223,6 +1223,14 @@ var DEFAULT_RENDER_OPTIONS = {
|
|
1223
1223
|
mode: "closed"
|
1224
1224
|
}
|
1225
1225
|
};
|
1226
|
+
var TrackableCustomElementRegistry = class extends CustomElementRegistry {
|
1227
|
+
__tagNames = /* @__PURE__ */ new Set();
|
1228
|
+
define(tagName, constructor) {
|
1229
|
+
super.define(tagName, constructor);
|
1230
|
+
this.__tagNames.add(tagName);
|
1231
|
+
}
|
1232
|
+
};
|
1233
|
+
window.CustomElementRegistry = TrackableCustomElementRegistry;
|
1226
1234
|
var getPropName = (attrName) => attrName.replace(/^([A-Z]+)/, (_, letter) => letter.toLowerCase()).replace(/(-|_| )([a-zA-Z])/g, (_, letter) => letter.toUpperCase());
|
1227
1235
|
var customElement = (render, options) => {
|
1228
1236
|
const {
|
@@ -1372,6 +1380,18 @@ You must set an initial value before calling a property signal's getter.
|
|
1372
1380
|
}
|
1373
1381
|
});
|
1374
1382
|
fragment.host = this;
|
1383
|
+
const registry = shadowRootOptions.registry instanceof CustomElementRegistry ? shadowRootOptions.registry : shadowRootOptions.registry?.eject();
|
1384
|
+
const tempContainer = document.createElement("div");
|
1385
|
+
tempContainer.append(fragment.cloneNode(true));
|
1386
|
+
const fragmentContent = tempContainer.innerHTML;
|
1387
|
+
root.innerHTML = fragmentContent;
|
1388
|
+
if (registry !== void 0 && registry.__tagNames !== void 0) {
|
1389
|
+
for (const tagName of registry.__tagNames) {
|
1390
|
+
const upgradedElement = root.querySelector(tagName);
|
1391
|
+
const nonUpgradedElement = fragment.querySelector(tagName);
|
1392
|
+
nonUpgradedElement.replaceWith(upgradedElement);
|
1393
|
+
}
|
1394
|
+
}
|
1375
1395
|
setInnerHTML(root, fragment);
|
1376
1396
|
}
|
1377
1397
|
static get formAssociated() {
|
package/dist/index.d.cts
CHANGED
@@ -89,6 +89,11 @@ type RenderOptions = {
|
|
89
89
|
};
|
90
90
|
};
|
91
91
|
type RenderFunction<Props extends CustomElementProps> = (args: RenderArgs<Props>) => DocumentFragment;
|
92
|
+
declare global {
|
93
|
+
interface CustomElementRegistry {
|
94
|
+
__tagNames: Set<string>;
|
95
|
+
}
|
96
|
+
}
|
92
97
|
/**
|
93
98
|
* Create a custom element that can be defined for use in the DOM.
|
94
99
|
* @example
|
package/dist/index.d.ts
CHANGED
@@ -89,6 +89,11 @@ type RenderOptions = {
|
|
89
89
|
};
|
90
90
|
};
|
91
91
|
type RenderFunction<Props extends CustomElementProps> = (args: RenderArgs<Props>) => DocumentFragment;
|
92
|
+
declare global {
|
93
|
+
interface CustomElementRegistry {
|
94
|
+
__tagNames: Set<string>;
|
95
|
+
}
|
96
|
+
}
|
92
97
|
/**
|
93
98
|
* Create a custom element that can be defined for use in the DOM.
|
94
99
|
* @example
|
package/dist/index.js
CHANGED
@@ -1191,6 +1191,14 @@ var DEFAULT_RENDER_OPTIONS = {
|
|
1191
1191
|
mode: "closed"
|
1192
1192
|
}
|
1193
1193
|
};
|
1194
|
+
var TrackableCustomElementRegistry = class extends CustomElementRegistry {
|
1195
|
+
__tagNames = /* @__PURE__ */ new Set();
|
1196
|
+
define(tagName, constructor) {
|
1197
|
+
super.define(tagName, constructor);
|
1198
|
+
this.__tagNames.add(tagName);
|
1199
|
+
}
|
1200
|
+
};
|
1201
|
+
window.CustomElementRegistry = TrackableCustomElementRegistry;
|
1194
1202
|
var getPropName = (attrName) => attrName.replace(/^([A-Z]+)/, (_, letter) => letter.toLowerCase()).replace(/(-|_| )([a-zA-Z])/g, (_, letter) => letter.toUpperCase());
|
1195
1203
|
var customElement = (render, options) => {
|
1196
1204
|
const {
|
@@ -1340,6 +1348,18 @@ You must set an initial value before calling a property signal's getter.
|
|
1340
1348
|
}
|
1341
1349
|
});
|
1342
1350
|
fragment.host = this;
|
1351
|
+
const registry = shadowRootOptions.registry instanceof CustomElementRegistry ? shadowRootOptions.registry : shadowRootOptions.registry?.eject();
|
1352
|
+
const tempContainer = document.createElement("div");
|
1353
|
+
tempContainer.append(fragment.cloneNode(true));
|
1354
|
+
const fragmentContent = tempContainer.innerHTML;
|
1355
|
+
root.innerHTML = fragmentContent;
|
1356
|
+
if (registry !== void 0 && registry.__tagNames !== void 0) {
|
1357
|
+
for (const tagName of registry.__tagNames) {
|
1358
|
+
const upgradedElement = root.querySelector(tagName);
|
1359
|
+
const nonUpgradedElement = fragment.querySelector(tagName);
|
1360
|
+
nonUpgradedElement.replaceWith(upgradedElement);
|
1361
|
+
}
|
1362
|
+
}
|
1343
1363
|
setInnerHTML(root, fragment);
|
1344
1364
|
}
|
1345
1365
|
static get formAssociated() {
|