thunderous 0.3.2 → 0.3.3
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 +24 -12
- package/dist/index.js +13 -12
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
1
3
|
var __defProp = Object.defineProperty;
|
2
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
4
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
8
|
var __export = (target, all) => {
|
6
9
|
for (var name in all)
|
@@ -14,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
14
17
|
}
|
15
18
|
return to;
|
16
19
|
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
17
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
29
|
|
19
30
|
// src/index.ts
|
@@ -57,15 +68,15 @@ var createSignal = (initVal, options) => {
|
|
57
68
|
if (subscriber !== null) {
|
58
69
|
subscribers.add(subscriber);
|
59
70
|
}
|
60
|
-
if (
|
71
|
+
if (options?.debugMode || getterOptions?.debugMode) {
|
61
72
|
requestAnimationFrame(() => {
|
62
73
|
let label = "anonymous signal";
|
63
|
-
if (
|
74
|
+
if (options?.label !== void 0) {
|
64
75
|
label = `(${options.label})`;
|
65
|
-
if (
|
76
|
+
if (getterOptions?.label !== void 0) {
|
66
77
|
label += ` ${getterOptions.label}`;
|
67
78
|
}
|
68
|
-
} else if (
|
79
|
+
} else if (getterOptions?.label !== void 0) {
|
69
80
|
label = getterOptions.label;
|
70
81
|
}
|
71
82
|
console.log("Signal retrieved:", { value, subscribers, label });
|
@@ -91,14 +102,14 @@ var createSignal = (initVal, options) => {
|
|
91
102
|
console.error("Error in subscriber:", { error, oldValue, newValue, fn });
|
92
103
|
}
|
93
104
|
}
|
94
|
-
if (
|
105
|
+
if (options?.debugMode || setterOptions?.debugMode) {
|
95
106
|
let label = "anonymous signal";
|
96
|
-
if (
|
107
|
+
if (options?.label !== void 0) {
|
97
108
|
label = `(${options.label})`;
|
98
|
-
if (
|
109
|
+
if (setterOptions?.label !== void 0) {
|
99
110
|
label += ` ${setterOptions.label}`;
|
100
111
|
}
|
101
|
-
} else if (
|
112
|
+
} else if (setterOptions?.label !== void 0) {
|
102
113
|
label = setterOptions.label;
|
103
114
|
}
|
104
115
|
console.log("Signal set:", { oldValue, newValue, subscribers, label });
|
@@ -132,6 +143,7 @@ var createEffect = (fn) => {
|
|
132
143
|
};
|
133
144
|
|
134
145
|
// src/render.ts
|
146
|
+
var import_dompurify = __toESM(require("dompurify"), 1);
|
135
147
|
var html = (strings, ...values) => {
|
136
148
|
let innerHTML = "";
|
137
149
|
const signalMap = /* @__PURE__ */ new Map();
|
@@ -144,6 +156,7 @@ var html = (strings, ...values) => {
|
|
144
156
|
}
|
145
157
|
innerHTML += string + String(value);
|
146
158
|
});
|
159
|
+
import_dompurify.default.sanitize(innerHTML);
|
147
160
|
const fragment = parseFragment(innerHTML);
|
148
161
|
const callbackBindingRegex = /(\{\{callback:.+\}\})/;
|
149
162
|
const signalBindingRegex = /(\{\{signal:.+\}\})/;
|
@@ -205,8 +218,7 @@ var html = (strings, ...values) => {
|
|
205
218
|
parseChildren(fragment);
|
206
219
|
return fragment;
|
207
220
|
};
|
208
|
-
var
|
209
|
-
var adoptedStylesSupported = typeof window !== "undefined" && ((_a = window.ShadowRoot) == null ? void 0 : _a.prototype.hasOwnProperty("adoptedStyleSheets")) && ((_b = window.CSSStyleSheet) == null ? void 0 : _b.prototype.hasOwnProperty("replace"));
|
221
|
+
var adoptedStylesSupported = typeof window !== "undefined" && window.ShadowRoot?.prototype.hasOwnProperty("adoptedStyleSheets") && window.CSSStyleSheet?.prototype.hasOwnProperty("replace");
|
210
222
|
var isCSSStyleSheet = (stylesheet) => {
|
211
223
|
return typeof CSSStyleSheet !== "undefined" && stylesheet instanceof CSSStyleSheet;
|
212
224
|
};
|
@@ -288,7 +300,7 @@ var customElement = (render, options) => {
|
|
288
300
|
__customCallbackFns = /* @__PURE__ */ new Map();
|
289
301
|
#shadowRoot = attachShadow ? this.attachShadow(shadowRootOptions) : null;
|
290
302
|
#internals = this.attachInternals();
|
291
|
-
#observer =
|
303
|
+
#observer = options?.observedAttributes !== void 0 ? null : new MutationObserver((mutations) => {
|
292
304
|
for (const mutation of mutations) {
|
293
305
|
const attrName = mutation.attributeName;
|
294
306
|
if (mutation.type !== "attributes" || attrName === null) continue;
|
@@ -450,7 +462,7 @@ var customElement = (render, options) => {
|
|
450
462
|
}
|
451
463
|
attributeChangedCallback(name, oldValue, newValue) {
|
452
464
|
const [, attrSetter] = this.#attrSignals[name] ?? [];
|
453
|
-
attrSetter
|
465
|
+
attrSetter?.(newValue);
|
454
466
|
const prop = this.#attributesAsPropertiesMap.get(name);
|
455
467
|
if (prop !== void 0) {
|
456
468
|
this[prop.prop] = newValue === null ? null : prop.coerce(newValue);
|
package/dist/index.js
CHANGED
@@ -26,15 +26,15 @@ var createSignal = (initVal, options) => {
|
|
26
26
|
if (subscriber !== null) {
|
27
27
|
subscribers.add(subscriber);
|
28
28
|
}
|
29
|
-
if (
|
29
|
+
if (options?.debugMode || getterOptions?.debugMode) {
|
30
30
|
requestAnimationFrame(() => {
|
31
31
|
let label = "anonymous signal";
|
32
|
-
if (
|
32
|
+
if (options?.label !== void 0) {
|
33
33
|
label = `(${options.label})`;
|
34
|
-
if (
|
34
|
+
if (getterOptions?.label !== void 0) {
|
35
35
|
label += ` ${getterOptions.label}`;
|
36
36
|
}
|
37
|
-
} else if (
|
37
|
+
} else if (getterOptions?.label !== void 0) {
|
38
38
|
label = getterOptions.label;
|
39
39
|
}
|
40
40
|
console.log("Signal retrieved:", { value, subscribers, label });
|
@@ -60,14 +60,14 @@ var createSignal = (initVal, options) => {
|
|
60
60
|
console.error("Error in subscriber:", { error, oldValue, newValue, fn });
|
61
61
|
}
|
62
62
|
}
|
63
|
-
if (
|
63
|
+
if (options?.debugMode || setterOptions?.debugMode) {
|
64
64
|
let label = "anonymous signal";
|
65
|
-
if (
|
65
|
+
if (options?.label !== void 0) {
|
66
66
|
label = `(${options.label})`;
|
67
|
-
if (
|
67
|
+
if (setterOptions?.label !== void 0) {
|
68
68
|
label += ` ${setterOptions.label}`;
|
69
69
|
}
|
70
|
-
} else if (
|
70
|
+
} else if (setterOptions?.label !== void 0) {
|
71
71
|
label = setterOptions.label;
|
72
72
|
}
|
73
73
|
console.log("Signal set:", { oldValue, newValue, subscribers, label });
|
@@ -101,6 +101,7 @@ var createEffect = (fn) => {
|
|
101
101
|
};
|
102
102
|
|
103
103
|
// src/render.ts
|
104
|
+
import DOMPurify from "dompurify";
|
104
105
|
var html = (strings, ...values) => {
|
105
106
|
let innerHTML = "";
|
106
107
|
const signalMap = /* @__PURE__ */ new Map();
|
@@ -113,6 +114,7 @@ var html = (strings, ...values) => {
|
|
113
114
|
}
|
114
115
|
innerHTML += string + String(value);
|
115
116
|
});
|
117
|
+
DOMPurify.sanitize(innerHTML);
|
116
118
|
const fragment = parseFragment(innerHTML);
|
117
119
|
const callbackBindingRegex = /(\{\{callback:.+\}\})/;
|
118
120
|
const signalBindingRegex = /(\{\{signal:.+\}\})/;
|
@@ -174,8 +176,7 @@ var html = (strings, ...values) => {
|
|
174
176
|
parseChildren(fragment);
|
175
177
|
return fragment;
|
176
178
|
};
|
177
|
-
var
|
178
|
-
var adoptedStylesSupported = typeof window !== "undefined" && ((_a = window.ShadowRoot) == null ? void 0 : _a.prototype.hasOwnProperty("adoptedStyleSheets")) && ((_b = window.CSSStyleSheet) == null ? void 0 : _b.prototype.hasOwnProperty("replace"));
|
179
|
+
var adoptedStylesSupported = typeof window !== "undefined" && window.ShadowRoot?.prototype.hasOwnProperty("adoptedStyleSheets") && window.CSSStyleSheet?.prototype.hasOwnProperty("replace");
|
179
180
|
var isCSSStyleSheet = (stylesheet) => {
|
180
181
|
return typeof CSSStyleSheet !== "undefined" && stylesheet instanceof CSSStyleSheet;
|
181
182
|
};
|
@@ -257,7 +258,7 @@ var customElement = (render, options) => {
|
|
257
258
|
__customCallbackFns = /* @__PURE__ */ new Map();
|
258
259
|
#shadowRoot = attachShadow ? this.attachShadow(shadowRootOptions) : null;
|
259
260
|
#internals = this.attachInternals();
|
260
|
-
#observer =
|
261
|
+
#observer = options?.observedAttributes !== void 0 ? null : new MutationObserver((mutations) => {
|
261
262
|
for (const mutation of mutations) {
|
262
263
|
const attrName = mutation.attributeName;
|
263
264
|
if (mutation.type !== "attributes" || attrName === null) continue;
|
@@ -419,7 +420,7 @@ var customElement = (render, options) => {
|
|
419
420
|
}
|
420
421
|
attributeChangedCallback(name, oldValue, newValue) {
|
421
422
|
const [, attrSetter] = this.#attrSignals[name] ?? [];
|
422
|
-
attrSetter
|
423
|
+
attrSetter?.(newValue);
|
423
424
|
const prop = this.#attributesAsPropertiesMap.get(name);
|
424
425
|
if (prop !== void 0) {
|
425
426
|
this[prop.prop] = newValue === null ? null : prop.coerce(newValue);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thunderous",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.3",
|
4
4
|
"description": "",
|
5
5
|
"type": "module",
|
6
6
|
"main": "./dist/index.cjs",
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"build": "tsup src/index.ts --format cjs,esm --dts --no-clean"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
+
"@types/dompurify": "^3.0.5",
|
37
38
|
"@types/eslint": "^8.56.10",
|
38
39
|
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
39
40
|
"@typescript-eslint/parser": "^7.1.1",
|
@@ -45,5 +46,8 @@
|
|
45
46
|
"prettier": "^3.3.3",
|
46
47
|
"tsup": "^8.3.0",
|
47
48
|
"typescript": "^5.6.3"
|
49
|
+
},
|
50
|
+
"dependencies": {
|
51
|
+
"dompurify": "^3.1.7"
|
48
52
|
}
|
49
53
|
}
|