mol_wire_dom 0.0.1490 → 0.0.1491

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/node.mjs CHANGED
@@ -176,11 +176,11 @@ var $;
176
176
  function $mol_dev_format_button(label, click) {
177
177
  return $mol_dev_format_auto({
178
178
  [$.$mol_dev_format_head]() {
179
- return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
179
+ return $.$mol_dev_format_span({ color: 'cornflowerblue' }, label);
180
180
  },
181
181
  [$.$mol_dev_format_body]() {
182
182
  Promise.resolve().then(click);
183
- return $mol_dev_format_span({});
183
+ return $.$mol_dev_format_span({});
184
184
  }
185
185
  });
186
186
  }
@@ -202,7 +202,7 @@ var $;
202
202
  return $mol_dev_format_native(val);
203
203
  }
204
204
  if (val instanceof Error) {
205
- return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
205
+ return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
206
206
  }
207
207
  if (val instanceof Promise) {
208
208
  return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
@@ -274,28 +274,23 @@ var $;
274
274
  ];
275
275
  }
276
276
  $.$mol_dev_format_element = $mol_dev_format_element;
277
- function $mol_dev_format_span(style, ...content) {
278
- return $mol_dev_format_element('span', {
279
- ...style,
280
- }, ...content);
281
- }
282
- $.$mol_dev_format_span = $mol_dev_format_span;
277
+ $.$mol_dev_format_span = $mol_dev_format_element.bind(null, 'span');
283
278
  $.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
284
279
  $.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
285
280
  $.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
286
281
  $.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
287
282
  $.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
288
283
  $.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
289
- $.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
284
+ $.$mol_dev_format_accent = $.$mol_dev_format_span.bind(null, {
290
285
  'color': 'magenta',
291
286
  });
292
- $.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
287
+ $.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
293
288
  'font-weight': 'bold',
294
289
  });
295
- $.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
290
+ $.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
296
291
  'color': 'green',
297
292
  });
298
- $.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
293
+ $.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
299
294
  'color': 'gray',
300
295
  });
301
296
  $.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
@@ -1743,15 +1738,22 @@ var $;
1743
1738
  return function $mol_wire_task_get(host, args) {
1744
1739
  const sub = $mol_wire_auto();
1745
1740
  const existen = sub?.track_next();
1741
+ let cause = '';
1746
1742
  reuse: if (existen) {
1747
1743
  if (!existen.temp)
1748
1744
  break reuse;
1749
- if (existen.host !== host)
1745
+ if (existen.task !== task) {
1746
+ cause = 'task';
1750
1747
  break reuse;
1751
- if (existen.task !== task)
1748
+ }
1749
+ if (existen.host !== host) {
1750
+ cause = 'host';
1752
1751
  break reuse;
1753
- if (!$mol_compare_deep(existen.args, args))
1752
+ }
1753
+ if (!$mol_compare_deep(existen.args, args)) {
1754
+ cause = 'args';
1754
1755
  break reuse;
1756
+ }
1755
1757
  return existen;
1756
1758
  }
1757
1759
  const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
@@ -1759,11 +1761,11 @@ var $;
1759
1761
  if (existen?.temp) {
1760
1762
  $$.$mol_log3_warn({
1761
1763
  place: '$mol_wire_task',
1762
- message: `Non idempotency`,
1764
+ message: `Different ${cause} on restart`,
1763
1765
  sub,
1764
- pubs: [...sub?.pub_list ?? [], existen],
1766
+ prev: existen,
1765
1767
  next,
1766
- hint: 'Ignore it',
1768
+ hint: 'Maybe required additional memoization',
1767
1769
  });
1768
1770
  }
1769
1771
  return next;
package/node.test.js CHANGED
@@ -167,11 +167,11 @@ var $;
167
167
  function $mol_dev_format_button(label, click) {
168
168
  return $mol_dev_format_auto({
169
169
  [$.$mol_dev_format_head]() {
170
- return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
170
+ return $.$mol_dev_format_span({ color: 'cornflowerblue' }, label);
171
171
  },
172
172
  [$.$mol_dev_format_body]() {
173
173
  Promise.resolve().then(click);
174
- return $mol_dev_format_span({});
174
+ return $.$mol_dev_format_span({});
175
175
  }
176
176
  });
177
177
  }
@@ -193,7 +193,7 @@ var $;
193
193
  return $mol_dev_format_native(val);
194
194
  }
195
195
  if (val instanceof Error) {
196
- return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
196
+ return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
197
197
  }
198
198
  if (val instanceof Promise) {
199
199
  return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
@@ -265,28 +265,23 @@ var $;
265
265
  ];
266
266
  }
267
267
  $.$mol_dev_format_element = $mol_dev_format_element;
268
- function $mol_dev_format_span(style, ...content) {
269
- return $mol_dev_format_element('span', {
270
- ...style,
271
- }, ...content);
272
- }
273
- $.$mol_dev_format_span = $mol_dev_format_span;
268
+ $.$mol_dev_format_span = $mol_dev_format_element.bind(null, 'span');
274
269
  $.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
275
270
  $.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
276
271
  $.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
277
272
  $.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
278
273
  $.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
279
274
  $.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
280
- $.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
275
+ $.$mol_dev_format_accent = $.$mol_dev_format_span.bind(null, {
281
276
  'color': 'magenta',
282
277
  });
283
- $.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
278
+ $.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
284
279
  'font-weight': 'bold',
285
280
  });
286
- $.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
281
+ $.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
287
282
  'color': 'green',
288
283
  });
289
- $.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
284
+ $.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
290
285
  'color': 'gray',
291
286
  });
292
287
  $.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
@@ -1734,15 +1729,22 @@ var $;
1734
1729
  return function $mol_wire_task_get(host, args) {
1735
1730
  const sub = $mol_wire_auto();
1736
1731
  const existen = sub?.track_next();
1732
+ let cause = '';
1737
1733
  reuse: if (existen) {
1738
1734
  if (!existen.temp)
1739
1735
  break reuse;
1740
- if (existen.host !== host)
1736
+ if (existen.task !== task) {
1737
+ cause = 'task';
1741
1738
  break reuse;
1742
- if (existen.task !== task)
1739
+ }
1740
+ if (existen.host !== host) {
1741
+ cause = 'host';
1743
1742
  break reuse;
1744
- if (!$mol_compare_deep(existen.args, args))
1743
+ }
1744
+ if (!$mol_compare_deep(existen.args, args)) {
1745
+ cause = 'args';
1745
1746
  break reuse;
1747
+ }
1746
1748
  return existen;
1747
1749
  }
1748
1750
  const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
@@ -1750,11 +1752,11 @@ var $;
1750
1752
  if (existen?.temp) {
1751
1753
  $$.$mol_log3_warn({
1752
1754
  place: '$mol_wire_task',
1753
- message: `Non idempotency`,
1755
+ message: `Different ${cause} on restart`,
1754
1756
  sub,
1755
- pubs: [...sub?.pub_list ?? [], existen],
1757
+ prev: existen,
1756
1758
  next,
1757
- hint: 'Ignore it',
1759
+ hint: 'Maybe required additional memoization',
1758
1760
  });
1759
1761
  }
1760
1762
  return next;