thunderous 0.3.1 → 0.3.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 CHANGED
@@ -174,12 +174,19 @@ var html = (strings, ...values) => {
174
174
  const textList = attr.value.split(signalBindingRegex);
175
175
  createEffect(() => {
176
176
  let newText = "";
177
+ let hasNull = false;
177
178
  for (const text of textList) {
178
179
  const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
179
180
  const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : null;
180
- newText += signal !== null ? signal() : text;
181
+ const value = signal !== null ? signal() : text;
182
+ if (value === null) hasNull = true;
183
+ newText += value;
184
+ }
185
+ if (hasNull && newText === "null") {
186
+ child.removeAttribute(attr.name);
187
+ } else {
188
+ child.setAttribute(attr.name, newText);
181
189
  }
182
- child.setAttribute(attr.name, newText);
183
190
  });
184
191
  } else if (callbackBindingRegex.test(attr.value)) {
185
192
  const getRootNode = child.getRootNode.bind(child);
package/dist/index.js CHANGED
@@ -143,12 +143,19 @@ var html = (strings, ...values) => {
143
143
  const textList = attr.value.split(signalBindingRegex);
144
144
  createEffect(() => {
145
145
  let newText = "";
146
+ let hasNull = false;
146
147
  for (const text of textList) {
147
148
  const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
148
149
  const signal = uniqueKey !== text ? signalMap.get(uniqueKey) : null;
149
- newText += signal !== null ? signal() : text;
150
+ const value = signal !== null ? signal() : text;
151
+ if (value === null) hasNull = true;
152
+ newText += value;
153
+ }
154
+ if (hasNull && newText === "null") {
155
+ child.removeAttribute(attr.name);
156
+ } else {
157
+ child.setAttribute(attr.name, newText);
150
158
  }
151
- child.setAttribute(attr.name, newText);
152
159
  });
153
160
  } else if (callbackBindingRegex.test(attr.value)) {
154
161
  const getRootNode = child.getRootNode.bind(child);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thunderous",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",