aberdeen 1.18.1 → 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 (78) hide show
  1. package/dist/src/aberdeen.d.ts +2 -0
  2. package/dist/src/aberdeen.js +21 -7
  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 +2 -2
  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 +21 -7
  45. package/dist-docs/assets/aberdeen/aberdeen.js.map +3 -3
  46. package/dist-docs/dispatcher/Dispatcher/index.html +4 -4
  47. package/dist-docs/dispatcher/MATCH_FAILED/index.html +2 -2
  48. package/dist-docs/dispatcher/MATCH_REST/index.html +2 -2
  49. package/dist-docs/dispatcher/index.html +2 -2
  50. package/dist-docs/hierarchy.html +1 -1
  51. package/dist-docs/index.html +2 -2
  52. package/dist-docs/media/CHANGELOG.md +6 -0
  53. package/dist-docs/modules.html +1 -1
  54. package/dist-docs/prediction/applyCanon/index.html +2 -2
  55. package/dist-docs/prediction/applyPrediction/index.html +2 -2
  56. package/dist-docs/prediction/index.html +2 -2
  57. package/dist-docs/route/Route/index.html +9 -9
  58. package/dist-docs/route/back/index.html +2 -2
  59. package/dist-docs/route/current/index.html +2 -2
  60. package/dist-docs/route/go/index.html +2 -2
  61. package/dist-docs/route/index.html +2 -2
  62. package/dist-docs/route/interceptLinks/index.html +2 -2
  63. package/dist-docs/route/matchCurrent/index.html +2 -2
  64. package/dist-docs/route/persistScroll/index.html +2 -2
  65. package/dist-docs/route/push/index.html +2 -2
  66. package/dist-docs/route/setLog/index.html +2 -2
  67. package/dist-docs/route/up/index.html +2 -2
  68. package/dist-docs/sitemap.xml +59 -59
  69. package/dist-docs/transitions/grow/index.html +2 -2
  70. package/dist-docs/transitions/index.html +2 -2
  71. package/dist-docs/transitions/shrink/index.html +2 -2
  72. package/package.json +1 -1
  73. package/skill/aberdeen.md +56 -54
  74. package/skill/dispatcher.md +6 -6
  75. package/skill/prediction.md +3 -3
  76. package/skill/route.md +18 -18
  77. package/skill/transitions.md +3 -3
  78. package/src/aberdeen.ts +26 -9
@@ -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;
@@ -1250,7 +1253,7 @@ function setSpacingCssVars(base = 1, unit = "rem") {
1250
1253
  cssVars[i] = 2 ** (i - 3) * base + unit;
1251
1254
  }
1252
1255
  }
1253
- var CSS_VAR_PATTERN = /(\burl\([^)]*\))|("[^"]*")|(^| )\$([\w-]+)/g;
1256
+ var CSS_VAR_PATTERN = /(\burl\([^)]*\))|("[^"]*")|(^|[\s(,])\$([\w-]+)/g;
1254
1257
  var DIGIT_FIRST = /^\d/;
1255
1258
  function cssVarRef(value) {
1256
1259
  if (value.indexOf("$") < 0)
@@ -1687,16 +1690,27 @@ function applyArg(el, key, value) {
1687
1690
  list.remove(...classes);
1688
1691
  } else if (key[0] === "$") {
1689
1692
  key = key.substring(1);
1693
+ if (key[0] === "$")
1694
+ key = "--" + key.substring(1);
1690
1695
  const val = value == null || value === false ? "" : typeof value === "string" ? cssVarRef(value) : String(value);
1691
1696
  const expanded = CSS_SHORT[key] || key;
1692
1697
  const style = el.style;
1693
1698
  const setOwn = el === currentScope.el;
1694
1699
  const props = typeof expanded === "string" ? [expanded] : expanded;
1695
1700
  for (const prop of props) {
1696
- const cm = toCamel(prop);
1697
- if (setOwn)
1698
- recordSideEffect(currentScope, 1 /* Style */, cm, style[cm]);
1699
- 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
+ }
1700
1714
  }
1701
1715
  } else if (value == null) {} else if (key in SPECIAL_PROPS) {
1702
1716
  SPECIAL_PROPS[key](el, value);
@@ -1985,5 +1999,5 @@ export {
1985
1999
  A
1986
2000
  };
1987
2001
 
1988
- //# debugId=FD73580ACB58CF9D64756E2164756E21
2002
+ //# debugId=3B000DCA54AF8FFA64756E2164756E21
1989
2003
  //# sourceMappingURL=aberdeen.js.map