aberdeen 1.18.0 → 1.18.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.
Files changed (80) hide show
  1. package/dist/src/aberdeen.d.ts +2 -0
  2. package/dist/src/aberdeen.js +25 -9
  3. package/dist/src/aberdeen.js.map +3 -3
  4. package/dist/tests/fakedom.js +20 -3
  5. package/dist/tests/fakedom.js.map +3 -3
  6. package/dist/tests/helpers.js +20 -3
  7. package/dist/tests/helpers.js.map +3 -3
  8. package/dist-docs/Tutorial/index.html +4 -4
  9. package/dist-docs/aberdeen/A/index.html +3 -2
  10. package/dist-docs/aberdeen/CUSTOM_DUMP/index.html +2 -2
  11. package/dist-docs/aberdeen/NO_COPY/index.html +2 -2
  12. package/dist-docs/aberdeen/OPAQUE/index.html +2 -2
  13. package/dist-docs/aberdeen/PromiseProxy/index.html +5 -5
  14. package/dist-docs/aberdeen/clean/index.html +2 -2
  15. package/dist-docs/aberdeen/clone/index.html +2 -2
  16. package/dist-docs/aberdeen/copy/index.html +3 -3
  17. package/dist-docs/aberdeen/count/index.html +2 -2
  18. package/dist-docs/aberdeen/cssVars/index.html +2 -2
  19. package/dist-docs/aberdeen/darkMode/index.html +2 -2
  20. package/dist-docs/aberdeen/default/index.html +3 -2
  21. package/dist-docs/aberdeen/derive/index.html +2 -2
  22. package/dist-docs/aberdeen/disableCreateDestroy/index.html +2 -2
  23. package/dist-docs/aberdeen/dump/index.html +2 -2
  24. package/dist-docs/aberdeen/index.html +2 -2
  25. package/dist-docs/aberdeen/insertCss/index.html +2 -2
  26. package/dist-docs/aberdeen/insertGlobalCss/index.html +2 -2
  27. package/dist-docs/aberdeen/invertString/index.html +2 -2
  28. package/dist-docs/aberdeen/isEmpty/index.html +2 -2
  29. package/dist-docs/aberdeen/map/index.html +4 -4
  30. package/dist-docs/aberdeen/merge/index.html +3 -3
  31. package/dist-docs/aberdeen/mount/index.html +2 -2
  32. package/dist-docs/aberdeen/multiMap/index.html +4 -4
  33. package/dist-docs/aberdeen/onEach/index.html +2 -2
  34. package/dist-docs/aberdeen/partition/index.html +4 -4
  35. package/dist-docs/aberdeen/peek/index.html +5 -5
  36. package/dist-docs/aberdeen/proxy/index.html +2 -2
  37. package/dist-docs/aberdeen/ref/index.html +2 -2
  38. package/dist-docs/aberdeen/runQueue/index.html +2 -2
  39. package/dist-docs/aberdeen/setErrorHandler/index.html +2 -2
  40. package/dist-docs/aberdeen/setSpacingCssVars/index.html +2 -2
  41. package/dist-docs/aberdeen/unmountAll/index.html +2 -2
  42. package/dist-docs/aberdeen/unproxy/index.html +2 -2
  43. package/dist-docs/assets/aberdeen/aberdeen.d.ts +2 -0
  44. package/dist-docs/assets/aberdeen/aberdeen.js +25 -9
  45. package/dist-docs/assets/aberdeen/aberdeen.js.map +3 -3
  46. package/dist-docs/assets/search.js +1 -1
  47. package/dist-docs/dispatcher/Dispatcher/index.html +4 -4
  48. package/dist-docs/dispatcher/MATCH_FAILED/index.html +2 -2
  49. package/dist-docs/dispatcher/MATCH_REST/index.html +2 -2
  50. package/dist-docs/dispatcher/index.html +2 -2
  51. package/dist-docs/hierarchy.html +1 -1
  52. package/dist-docs/index.html +2 -2
  53. package/dist-docs/media/CHANGELOG.md +11 -0
  54. package/dist-docs/modules.html +1 -1
  55. package/dist-docs/prediction/applyCanon/index.html +2 -2
  56. package/dist-docs/prediction/applyPrediction/index.html +2 -2
  57. package/dist-docs/prediction/index.html +2 -2
  58. package/dist-docs/route/Route/index.html +9 -9
  59. package/dist-docs/route/back/index.html +2 -2
  60. package/dist-docs/route/current/index.html +2 -2
  61. package/dist-docs/route/go/index.html +2 -2
  62. package/dist-docs/route/index.html +2 -2
  63. package/dist-docs/route/interceptLinks/index.html +2 -2
  64. package/dist-docs/route/matchCurrent/index.html +2 -2
  65. package/dist-docs/route/persistScroll/index.html +2 -2
  66. package/dist-docs/route/push/index.html +2 -2
  67. package/dist-docs/route/setLog/index.html +2 -2
  68. package/dist-docs/route/up/index.html +2 -2
  69. package/dist-docs/sitemap.xml +59 -59
  70. package/dist-docs/transitions/grow/index.html +2 -2
  71. package/dist-docs/transitions/index.html +2 -2
  72. package/dist-docs/transitions/shrink/index.html +2 -2
  73. package/package.json +1 -1
  74. package/skill/SKILL.md +5 -2
  75. package/skill/aberdeen.md +56 -54
  76. package/skill/dispatcher.md +6 -6
  77. package/skill/prediction.md +3 -3
  78. package/skill/route.md +18 -18
  79. package/skill/transitions.md +3 -3
  80. package/src/aberdeen.ts +30 -11
@@ -449,6 +449,8 @@ export declare function disableCreateDestroy(): void;
449
449
  *
450
450
  * Also, when the value is a string starting with `$`, it is treated as a reference to a CSS variable, expanding to `var(--variableName)`. For numeric variable names (which can't be used directly as CSS custom property names), Aberdeen prefixes them with `m`, so `$3` expands to `var(--m3)`. This is primarily intended for use with {@link setSpacingCssVars}, which initializes spacing variables named `0` through `12` with an exponential spacing scale.
451
451
  *
452
+ * To *set* a CSS custom property inline on an element, use a `--name` or (symmetrically with the `$`-reference syntax above) a `$name` key. For example `A('div --primary:red')` and `A('div $primary:red')` both set `--primary` to `red`.
453
+ *
452
454
  * @returns The most inner DOM element that was created (not counting text nodes nor elements created by content functions), or the current element if no new element was created. You should normally not need to use the return value - use this function's DOM manipulation abilities instead. One valid use case is when integrating with non-Aberdeen code that requires a reference to a DOM element.
453
455
  *
454
456
  * @example Create Element
@@ -115,7 +115,10 @@ function undoSideEffects(el, se) {
115
115
  value ? el.classList.add(key) : el.classList.remove(key);
116
116
  break;
117
117
  case 1 /* Style */:
118
- el.style[key] = value == null ? "" : value;
118
+ if (key[0] === "-" && key[1] === "-")
119
+ value ? el.style.setProperty(key, value) : el.style.removeProperty(key);
120
+ else
121
+ el.style[key] = value == null ? "" : value;
119
122
  break;
120
123
  case 2 /* Prop */:
121
124
  el[key] = value;
@@ -704,8 +707,10 @@ function isEmpty(proxied) {
704
707
  subscribe(target, ANY_SYMBOL, (index, newData, oldData) => {
705
708
  if (newData === EMPTY !== (oldData === EMPTY)) {
706
709
  const newEmpty = isObjEmpty(target);
707
- scope.onChange(target, EMPTY, newEmpty, oldEmpty);
708
- oldEmpty = newEmpty;
710
+ if (newEmpty !== oldEmpty) {
711
+ scope.onChange(target, EMPTY, newEmpty, oldEmpty);
712
+ oldEmpty = newEmpty;
713
+ }
709
714
  }
710
715
  });
711
716
  return oldEmpty;
@@ -1248,7 +1253,7 @@ function setSpacingCssVars(base = 1, unit = "rem") {
1248
1253
  cssVars[i] = 2 ** (i - 3) * base + unit;
1249
1254
  }
1250
1255
  }
1251
- var CSS_VAR_PATTERN = /(\burl\([^)]*\))|("[^"]*")|(^| )\$([\w-]+)/g;
1256
+ var CSS_VAR_PATTERN = /(\burl\([^)]*\))|("[^"]*")|(^|[\s(,])\$([\w-]+)/g;
1252
1257
  var DIGIT_FIRST = /^\d/;
1253
1258
  function cssVarRef(value) {
1254
1259
  if (value.indexOf("$") < 0)
@@ -1685,16 +1690,27 @@ function applyArg(el, key, value) {
1685
1690
  list.remove(...classes);
1686
1691
  } else if (key[0] === "$") {
1687
1692
  key = key.substring(1);
1693
+ if (key[0] === "$")
1694
+ key = "--" + key.substring(1);
1688
1695
  const val = value == null || value === false ? "" : typeof value === "string" ? cssVarRef(value) : String(value);
1689
1696
  const expanded = CSS_SHORT[key] || key;
1690
1697
  const style = el.style;
1691
1698
  const setOwn = el === currentScope.el;
1692
1699
  const props = typeof expanded === "string" ? [expanded] : expanded;
1693
1700
  for (const prop of props) {
1694
- const cm = toCamel(prop);
1695
- if (setOwn)
1696
- recordSideEffect(currentScope, 1 /* Style */, cm, style[cm]);
1697
- style[cm] = val;
1701
+ if (prop[0] === "-" && prop[1] === "-") {
1702
+ if (setOwn)
1703
+ recordSideEffect(currentScope, 1 /* Style */, prop, style.getPropertyValue(prop));
1704
+ if (val === "")
1705
+ style.removeProperty(prop);
1706
+ else
1707
+ style.setProperty(prop, val);
1708
+ } else {
1709
+ const cm = toCamel(prop);
1710
+ if (setOwn)
1711
+ recordSideEffect(currentScope, 1 /* Style */, cm, style[cm]);
1712
+ style[cm] = val;
1713
+ }
1698
1714
  }
1699
1715
  } else if (value == null) {} else if (key in SPECIAL_PROPS) {
1700
1716
  SPECIAL_PROPS[key](el, value);
@@ -1983,5 +1999,5 @@ export {
1983
1999
  A
1984
2000
  };
1985
2001
 
1986
- //# debugId=F455E457CF1E8D7364756E2164756E21
2002
+ //# debugId=3B000DCA54AF8FFA64756E2164756E21
1987
2003
  //# sourceMappingURL=aberdeen.js.map