aberdeen 1.0.7 → 1.0.8

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/README.md CHANGED
@@ -12,7 +12,7 @@ Aberdeen's approach is refreshingly simple:
12
12
  - ⏩ **Fast:** No virtual DOM. Aberdeen intelligently updates only the minimal, necessary parts of your UI when proxied data changes.
13
13
  - 👥 **Awesome lists**: It's very easy and performant to reactively display data sorted by whatever you like.
14
14
  - 🔬 **Tiny:** Around 5KB (minimized and gzipped) and with zero runtime dependencies.
15
- - 🔋 **Batteries included**: Comes with client-side routing, revertible patches for optimistic user-interface updates, component-local CSS, helper functions for transforming reactive data (mapping, partitioning, filtering, etc) and hide/unhide transition effects. No bikeshedding required!
15
+ - 🔋 **Batteries included**: Comes with client-side routing, revertible patches for optimistic user-interface updates, component-local CSS, SVG support, helper functions for transforming reactive data (mapping, partitioning, filtering, etc) and hide/unhide transition effects. No bikeshedding required!
16
16
 
17
17
  ## Why *not* use Aberdeen?
18
18
 
package/dist/aberdeen.js CHANGED
@@ -44,8 +44,8 @@ class ReverseSortedSet {
44
44
  }
45
45
  get(indexValue) {
46
46
  const keyProp = this.keyProp;
47
- let current = this.tail;
48
47
  let prev;
48
+ let current = this.tail;
49
49
  for (let l = this.symbols.length - 1;l >= 0; l--) {
50
50
  const symbol = this.symbols[l];
51
51
  while ((prev = current[symbol]) && prev[keyProp] > indexValue)
@@ -164,6 +164,7 @@ class Scope {
164
164
 
165
165
  class ContentScope extends Scope {
166
166
  cleaners;
167
+ inSvgNamespace = false;
167
168
  constructor(cleaners = []) {
168
169
  super();
169
170
  this.cleaners = cleaners;
@@ -207,6 +208,7 @@ class ChainedScope extends ContentScope {
207
208
  constructor(parentElement, useParentCleaners = false) {
208
209
  super(useParentCleaners ? currentScope.cleaners : []);
209
210
  this.parentElement = parentElement;
211
+ this.inSvgNamespace = currentScope.inSvgNamespace;
210
212
  if (parentElement === currentScope.parentElement) {
211
213
  this.prevSibling = currentScope.getChildPrevSibling();
212
214
  currentScope.lastChild = this;
@@ -255,6 +257,7 @@ class MountScope extends ContentScope {
255
257
  super();
256
258
  this.parentElement = parentElement;
257
259
  this.renderer = renderer;
260
+ this.inSvgNamespace = currentScope.inSvgNamespace;
258
261
  this.redraw();
259
262
  currentScope.cleaners.push(this);
260
263
  }
@@ -444,6 +447,7 @@ class OnEachItemScope extends ContentScope {
444
447
  this.parent = parent;
445
448
  this.itemIndex = itemIndex;
446
449
  this.parentElement = parent.parentElement;
450
+ this.inSvgNamespace = currentScope.inSvgNamespace;
447
451
  this.parent.byIndex.set(this.itemIndex, this);
448
452
  this.lastChild = this;
449
453
  if (topRedraw)
@@ -945,7 +949,12 @@ function $(...args) {
945
949
  err = `Tag '${arg}' cannot contain space`;
946
950
  break;
947
951
  } else {
948
- result = document.createElement(arg);
952
+ const useNamespace = currentScope.inSvgNamespace || arg === "svg";
953
+ if (useNamespace) {
954
+ result = document.createElementNS("http://www.w3.org/2000/svg", arg);
955
+ } else {
956
+ result = document.createElement(arg);
957
+ }
949
958
  if (classes)
950
959
  result.className = classes.replaceAll(".", " ");
951
960
  if (text)
@@ -955,6 +964,9 @@ function $(...args) {
955
964
  savedCurrentScope = currentScope;
956
965
  }
957
966
  const newScope = new ChainedScope(result, true);
967
+ if (arg === "svg") {
968
+ newScope.inSvgNamespace = true;
969
+ }
958
970
  newScope.lastChild = result.lastChild || undefined;
959
971
  if (topRedrawScope === currentScope)
960
972
  topRedrawScope = newScope;
@@ -1205,5 +1217,5 @@ export {
1205
1217
  $
1206
1218
  };
1207
1219
 
1208
- //# debugId=22FD247DC29D103664756E2164756E21
1220
+ //# debugId=E7B46BDF501F944C64756E2164756E21
1209
1221
  //# sourceMappingURL=aberdeen.js.map