thunderous 2.3.6 → 2.3.8

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 CHANGED
@@ -50,8 +50,6 @@ var DEFAULT_RENDER_OPTIONS = {
50
50
 
51
51
  // src/signals.ts
52
52
  var subscriber = null;
53
- var updateQueue = /* @__PURE__ */ new Set();
54
- var isBatchingUpdates = false;
55
53
  var createSignal = (initVal, options) => {
56
54
  const subscribers = /* @__PURE__ */ new Set();
57
55
  let value = initVal;
@@ -60,18 +58,16 @@ var createSignal = (initVal, options) => {
60
58
  subscribers.add(subscriber);
61
59
  }
62
60
  if (options?.debugMode === true || getterOptions?.debugMode === true) {
63
- queueMicrotask(() => {
64
- let label = "anonymous signal";
65
- if (options?.label !== void 0) {
66
- label = `(${options.label})`;
67
- if (getterOptions?.label !== void 0) {
68
- label += ` ${getterOptions.label}`;
69
- }
70
- } else if (getterOptions?.label !== void 0) {
71
- label = getterOptions.label;
61
+ let label = "anonymous signal";
62
+ if (options?.label !== void 0) {
63
+ label = `(${options.label})`;
64
+ if (getterOptions?.label !== void 0) {
65
+ label += ` ${getterOptions.label}`;
72
66
  }
73
- console.log("Signal retrieved:", { value, subscribers, label });
74
- });
67
+ } else if (getterOptions?.label !== void 0) {
68
+ label = getterOptions.label;
69
+ }
70
+ console.log("Signal retrieved:", { value, subscribers, label });
75
71
  }
76
72
  return value;
77
73
  };
@@ -82,36 +78,23 @@ var createSignal = (initVal, options) => {
82
78
  const oldValue = value;
83
79
  value = newValue;
84
80
  for (const fn of subscribers) {
85
- updateQueue.add(fn);
81
+ try {
82
+ fn();
83
+ } catch (error) {
84
+ console.error("Error in subscriber:", { error, oldValue, newValue, fn });
85
+ }
86
86
  }
87
- if (!isBatchingUpdates) {
88
- isBatchingUpdates = true;
89
- queueMicrotask(() => {
90
- while (updateQueue.size > 0) {
91
- const updates = Array.from(updateQueue);
92
- updateQueue.clear();
93
- for (const fn of updates) {
94
- try {
95
- fn();
96
- } catch (error) {
97
- console.error("Error in subscriber:", { error, oldValue, newValue, fn });
98
- }
99
- }
87
+ if (options?.debugMode === true || setterOptions?.debugMode === true) {
88
+ let label = "anonymous signal";
89
+ if (options?.label !== void 0) {
90
+ label = `(${options.label})`;
91
+ if (setterOptions?.label !== void 0) {
92
+ label += ` ${setterOptions.label}`;
100
93
  }
101
- if (options?.debugMode === true || setterOptions?.debugMode === true) {
102
- let label = "anonymous signal";
103
- if (options?.label !== void 0) {
104
- label = `(${options.label})`;
105
- if (setterOptions?.label !== void 0) {
106
- label += ` ${setterOptions.label}`;
107
- }
108
- } else if (setterOptions?.label !== void 0) {
109
- label = setterOptions.label;
110
- }
111
- console.log("Signal set:", { oldValue, newValue, subscribers, label });
112
- }
113
- isBatchingUpdates = false;
114
- });
94
+ } else if (setterOptions?.label !== void 0) {
95
+ label = setterOptions.label;
96
+ }
97
+ console.log("Signal set:", { oldValue, newValue, subscribers, label });
115
98
  }
116
99
  };
117
100
  return [getter, setter];
@@ -297,7 +280,7 @@ var renderState = {
297
280
  signalMap: /* @__PURE__ */ new Map(),
298
281
  callbackMap: /* @__PURE__ */ new Map(),
299
282
  fragmentMap: /* @__PURE__ */ new Map(),
300
- registry: customElements
283
+ registry: typeof customElements !== "undefined" ? customElements : {}
301
284
  };
302
285
  var logValueError = (value) => {
303
286
  console.error(
package/dist/index.js CHANGED
@@ -15,8 +15,6 @@ var DEFAULT_RENDER_OPTIONS = {
15
15
 
16
16
  // src/signals.ts
17
17
  var subscriber = null;
18
- var updateQueue = /* @__PURE__ */ new Set();
19
- var isBatchingUpdates = false;
20
18
  var createSignal = (initVal, options) => {
21
19
  const subscribers = /* @__PURE__ */ new Set();
22
20
  let value = initVal;
@@ -25,18 +23,16 @@ var createSignal = (initVal, options) => {
25
23
  subscribers.add(subscriber);
26
24
  }
27
25
  if (options?.debugMode === true || getterOptions?.debugMode === true) {
28
- queueMicrotask(() => {
29
- let label = "anonymous signal";
30
- if (options?.label !== void 0) {
31
- label = `(${options.label})`;
32
- if (getterOptions?.label !== void 0) {
33
- label += ` ${getterOptions.label}`;
34
- }
35
- } else if (getterOptions?.label !== void 0) {
36
- label = getterOptions.label;
26
+ let label = "anonymous signal";
27
+ if (options?.label !== void 0) {
28
+ label = `(${options.label})`;
29
+ if (getterOptions?.label !== void 0) {
30
+ label += ` ${getterOptions.label}`;
37
31
  }
38
- console.log("Signal retrieved:", { value, subscribers, label });
39
- });
32
+ } else if (getterOptions?.label !== void 0) {
33
+ label = getterOptions.label;
34
+ }
35
+ console.log("Signal retrieved:", { value, subscribers, label });
40
36
  }
41
37
  return value;
42
38
  };
@@ -47,36 +43,23 @@ var createSignal = (initVal, options) => {
47
43
  const oldValue = value;
48
44
  value = newValue;
49
45
  for (const fn of subscribers) {
50
- updateQueue.add(fn);
46
+ try {
47
+ fn();
48
+ } catch (error) {
49
+ console.error("Error in subscriber:", { error, oldValue, newValue, fn });
50
+ }
51
51
  }
52
- if (!isBatchingUpdates) {
53
- isBatchingUpdates = true;
54
- queueMicrotask(() => {
55
- while (updateQueue.size > 0) {
56
- const updates = Array.from(updateQueue);
57
- updateQueue.clear();
58
- for (const fn of updates) {
59
- try {
60
- fn();
61
- } catch (error) {
62
- console.error("Error in subscriber:", { error, oldValue, newValue, fn });
63
- }
64
- }
52
+ if (options?.debugMode === true || setterOptions?.debugMode === true) {
53
+ let label = "anonymous signal";
54
+ if (options?.label !== void 0) {
55
+ label = `(${options.label})`;
56
+ if (setterOptions?.label !== void 0) {
57
+ label += ` ${setterOptions.label}`;
65
58
  }
66
- if (options?.debugMode === true || setterOptions?.debugMode === true) {
67
- let label = "anonymous signal";
68
- if (options?.label !== void 0) {
69
- label = `(${options.label})`;
70
- if (setterOptions?.label !== void 0) {
71
- label += ` ${setterOptions.label}`;
72
- }
73
- } else if (setterOptions?.label !== void 0) {
74
- label = setterOptions.label;
75
- }
76
- console.log("Signal set:", { oldValue, newValue, subscribers, label });
77
- }
78
- isBatchingUpdates = false;
79
- });
59
+ } else if (setterOptions?.label !== void 0) {
60
+ label = setterOptions.label;
61
+ }
62
+ console.log("Signal set:", { oldValue, newValue, subscribers, label });
80
63
  }
81
64
  };
82
65
  return [getter, setter];
@@ -262,7 +245,7 @@ var renderState = {
262
245
  signalMap: /* @__PURE__ */ new Map(),
263
246
  callbackMap: /* @__PURE__ */ new Map(),
264
247
  fragmentMap: /* @__PURE__ */ new Map(),
265
- registry: customElements
248
+ registry: typeof customElements !== "undefined" ? customElements : {}
266
249
  };
267
250
  var logValueError = (value) => {
268
251
  console.error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thunderous",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",