@webjsdev/core 0.7.29 → 0.7.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/core",
3
- "version": "0.7.29",
3
+ "version": "0.7.31",
4
4
  "type": "module",
5
5
  "description": "webjs core runtime - html/css tags, WebComponent base, isomorphic renderers",
6
6
  "types": "./index.d.ts",
package/src/component.js CHANGED
@@ -573,7 +573,7 @@ class WebComponentBase extends Base {
573
573
  `properties via the factory instead: \`class ${name} extends WebComponent({ ` +
574
574
  `count: Number })\`. Use the \`prop()\` helper for options ` +
575
575
  `(\`prop(Number, { reflect: true })\`) and set defaults in the ` +
576
- `constructor after \`super()\`. See https://docs.webjs.com/docs/components.`,
576
+ `constructor after \`super()\`. See https://docs.webjs.dev/docs/components.`,
577
577
  );
578
578
  }
579
579
  C = Object.getPrototypeOf(C);
@@ -264,6 +264,15 @@ function compile(tr) {
264
264
  statics,
265
265
  group,
266
266
  };
267
+ // The mixed attribute is rebuilt from ALL its holes' values, but
268
+ // it is anchored at a single part (group[0]). The later holes stay
269
+ // `noop`, so a change confined to one of them would be skipped by
270
+ // updateInstance's per-hole dirty-check and the attribute would go
271
+ // stale. Point every non-anchor member back at the anchor so a
272
+ // change to any hole re-applies the whole attribute.
273
+ for (let m = 1; m < group.length; m++) {
274
+ parts[group[m]] = { kind: 'noop', path: [], mixedAnchor: idx0 };
275
+ }
267
276
  mixedAttr = null;
268
277
  }
269
278
  state = 'in-tag';
@@ -488,7 +497,7 @@ function createInstance(tr, container) {
488
497
  * @returns {BoundPart}
489
498
  */
490
499
  function bindPart(p, root) {
491
- if (p.kind === 'noop') return /** @type any */ ({ kind: 'noop' });
500
+ if (p.kind === 'noop') return /** @type any */ ({ kind: 'noop', mixedAnchor: /** @type any */ (p).mixedAnchor });
492
501
  let node = /** @type Node */ (root);
493
502
  for (const i of p.path) node = node.childNodes[i];
494
503
  if (p.kind === 'child') {
@@ -533,7 +542,18 @@ function updateInstance(inst, values) {
533
542
  for (let i = 0; i < values.length; i++) {
534
543
  const next = values[i];
535
544
  if (Object.is(next, inst.lastValues[i])) continue;
536
- applyPart(inst.bound[i], next, inst.lastValues[i], values);
545
+ const bp = inst.bound[i];
546
+ // A hole that belongs to a mixed attribute (`class="a ${x} b ${y}"`) is a
547
+ // `noop` pointing at the attribute's anchor part; re-apply the anchor so the
548
+ // whole attribute is rebuilt from every hole's current value, not just the
549
+ // anchor hole's. Without this, a change confined to a non-anchor hole is
550
+ // dropped (the attribute goes stale).
551
+ const anchor = /** @type any */ (bp).mixedAnchor;
552
+ if (bp.kind === 'noop' && anchor != null) {
553
+ applyPart(inst.bound[anchor], values[anchor], inst.lastValues[anchor], values);
554
+ } else {
555
+ applyPart(bp, next, inst.lastValues[i], values);
556
+ }
537
557
  inst.lastValues[i] = next;
538
558
  }
539
559
  }