aberdeen 1.0.6 → 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)
@@ -127,7 +127,7 @@ function runQueue() {
127
127
  sortedQueue = undefined;
128
128
  runQueueDepth = 0;
129
129
  time = Date.now() - time;
130
- if (time > 1)
130
+ if (time > 9)
131
131
  console.debug(`Aberdeen queue took ${time}ms`);
132
132
  }
133
133
  function partToStr(part) {
@@ -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
  }
@@ -419,6 +422,7 @@ class OnEachScope extends Scope {
419
422
  for (const scope of this.byIndex.values()) {
420
423
  scope.delete();
421
424
  }
425
+ sortedQueue?.remove(this);
422
426
  this.byIndex.clear();
423
427
  setTimeout(() => {
424
428
  this.sortedSet.clear();
@@ -443,6 +447,7 @@ class OnEachItemScope extends ContentScope {
443
447
  this.parent = parent;
444
448
  this.itemIndex = itemIndex;
445
449
  this.parentElement = parent.parentElement;
450
+ this.inSvgNamespace = currentScope.inSvgNamespace;
446
451
  this.parent.byIndex.set(this.itemIndex, this);
447
452
  this.lastChild = this;
448
453
  if (topRedraw)
@@ -944,7 +949,12 @@ function $(...args) {
944
949
  err = `Tag '${arg}' cannot contain space`;
945
950
  break;
946
951
  } else {
947
- 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
+ }
948
958
  if (classes)
949
959
  result.className = classes.replaceAll(".", " ");
950
960
  if (text)
@@ -954,6 +964,9 @@ function $(...args) {
954
964
  savedCurrentScope = currentScope;
955
965
  }
956
966
  const newScope = new ChainedScope(result, true);
967
+ if (arg === "svg") {
968
+ newScope.inSvgNamespace = true;
969
+ }
957
970
  newScope.lastChild = result.lastChild || undefined;
958
971
  if (topRedrawScope === currentScope)
959
972
  topRedrawScope = newScope;
@@ -1204,5 +1217,5 @@ export {
1204
1217
  $
1205
1218
  };
1206
1219
 
1207
- //# debugId=7D3AE73408804D7B64756E2164756E21
1220
+ //# debugId=E7B46BDF501F944C64756E2164756E21
1208
1221
  //# sourceMappingURL=aberdeen.js.map