thunderous 0.4.0 → 0.4.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/dist/index.cjs +10 -6
- package/dist/index.js +10 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -166,15 +166,19 @@ var html = (strings, ...values) => {
|
|
166
166
|
const textList = child.data.split(signalBindingRegex);
|
167
167
|
textList.forEach((text, i) => {
|
168
168
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
169
|
-
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) :
|
170
|
-
const
|
171
|
-
const newNode =
|
169
|
+
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
|
170
|
+
const newValue = signal !== void 0 ? signal() : text;
|
171
|
+
const newNode = (() => {
|
172
|
+
if (typeof newValue === "string") return new Text(newValue);
|
173
|
+
if (newValue instanceof DocumentFragment) return newValue;
|
174
|
+
return new Text("");
|
175
|
+
})();
|
172
176
|
if (i === 0) {
|
173
177
|
child.replaceWith(newNode);
|
174
178
|
} else {
|
175
179
|
element.insertBefore(newNode, child.nextSibling);
|
176
180
|
}
|
177
|
-
if (signal !==
|
181
|
+
if (signal !== void 0 && newNode instanceof Text) {
|
178
182
|
createEffect(() => {
|
179
183
|
newNode.data = signal();
|
180
184
|
});
|
@@ -190,8 +194,8 @@ var html = (strings, ...values) => {
|
|
190
194
|
let hasNull = false;
|
191
195
|
for (const text of textList) {
|
192
196
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
193
|
-
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) :
|
194
|
-
const value = signal !==
|
197
|
+
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
|
198
|
+
const value = signal !== void 0 ? signal() : text;
|
195
199
|
if (value === null) hasNull = true;
|
196
200
|
newText += value;
|
197
201
|
}
|
package/dist/index.js
CHANGED
@@ -124,15 +124,19 @@ var html = (strings, ...values) => {
|
|
124
124
|
const textList = child.data.split(signalBindingRegex);
|
125
125
|
textList.forEach((text, i) => {
|
126
126
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
127
|
-
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) :
|
128
|
-
const
|
129
|
-
const newNode =
|
127
|
+
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
|
128
|
+
const newValue = signal !== void 0 ? signal() : text;
|
129
|
+
const newNode = (() => {
|
130
|
+
if (typeof newValue === "string") return new Text(newValue);
|
131
|
+
if (newValue instanceof DocumentFragment) return newValue;
|
132
|
+
return new Text("");
|
133
|
+
})();
|
130
134
|
if (i === 0) {
|
131
135
|
child.replaceWith(newNode);
|
132
136
|
} else {
|
133
137
|
element.insertBefore(newNode, child.nextSibling);
|
134
138
|
}
|
135
|
-
if (signal !==
|
139
|
+
if (signal !== void 0 && newNode instanceof Text) {
|
136
140
|
createEffect(() => {
|
137
141
|
newNode.data = signal();
|
138
142
|
});
|
@@ -148,8 +152,8 @@ var html = (strings, ...values) => {
|
|
148
152
|
let hasNull = false;
|
149
153
|
for (const text of textList) {
|
150
154
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
151
|
-
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) :
|
152
|
-
const value = signal !==
|
155
|
+
const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : void 0;
|
156
|
+
const value = signal !== void 0 ? signal() : text;
|
153
157
|
if (value === null) hasNull = true;
|
154
158
|
newText += value;
|
155
159
|
}
|