@ryupold/vode 0.12.0 → 0.12.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 (3) hide show
  1. package/package.json +1 -1
  2. package/src/vode.ts +5 -7
  3. package/vode.mjs +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Small web framework for minimal websites",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
package/src/vode.ts CHANGED
@@ -85,9 +85,7 @@ export type ContainerNode<S> = HTMLElement & {
85
85
  liveEffectCount: number,
86
86
  renderPatchCount: number,
87
87
  renderCount: number,
88
- renderTime: number,
89
- queueLengthBeforeRender: number,
90
- queueLengthAfterRender: number,
88
+ lastRenderTime: number,
91
89
  },
92
90
  }
93
91
  };
@@ -125,7 +123,7 @@ export function app<S extends object | unknown>(container: HTMLElement, initialS
125
123
  if (typeof dom !== "function") throw new Error("dom must be a function that returns a vode");
126
124
 
127
125
  const _vode = {} as ContainerNode<S>["_vode"];
128
- _vode.stats = { renderTime: 0, renderCount: 0, queueLengthBeforeRender: 0, queueLengthAfterRender: 0, liveEffectCount: 0, patchCount: 0, renderPatchCount: 0 };
126
+ _vode.stats = { lastRenderTime: 0, renderCount: 0, liveEffectCount: 0, patchCount: 0, renderPatchCount: 0 };
129
127
 
130
128
  Object.defineProperty(initialState, "patch", {
131
129
  enumerable: false, configurable: true,
@@ -190,7 +188,7 @@ export function app<S extends object | unknown>(container: HTMLElement, initialS
190
188
  } finally {
191
189
  _vode.isRendering = false;
192
190
  _vode.stats.renderCount++;
193
- _vode.stats.renderTime = Date.now() - sw;
191
+ _vode.stats.lastRenderTime = Date.now() - sw;
194
192
  if (_vode.q) {
195
193
  _vode.render();
196
194
  }
@@ -291,10 +289,10 @@ export function mergeClass(a: ClassProp, b: ClassProp): ClassProp {
291
289
  for (const item of a as string[]) {
292
290
  aa[item] = true;
293
291
  }
294
- for (const bKey of (<Record<string, any>>b).keys) {
292
+ for (const bKey of Object.keys(b)) {
295
293
  aa[bKey] = (<Record<string, boolean | null | undefined>>b)[bKey];
296
294
  }
297
- return b;
295
+ return aa;
298
296
  }
299
297
 
300
298
  throw new Error(`cannot merge classes of ${a} (${typeof a}) and ${b} (${typeof b})`);
package/vode.mjs CHANGED
@@ -23,7 +23,7 @@ function app(container, initialState, dom, ...initialPatches) {
23
23
  if (typeof dom !== "function")
24
24
  throw new Error("dom must be a function that returns a vode");
25
25
  const _vode = {};
26
- _vode.stats = { renderTime: 0, renderCount: 0, queueLengthBeforeRender: 0, queueLengthAfterRender: 0, liveEffectCount: 0, patchCount: 0, renderPatchCount: 0 };
26
+ _vode.stats = { lastRenderTime: 0, renderCount: 0, liveEffectCount: 0, patchCount: 0, renderPatchCount: 0 };
27
27
  Object.defineProperty(initialState, "patch", {
28
28
  enumerable: false,
29
29
  configurable: true,
@@ -93,7 +93,7 @@ function app(container, initialState, dom, ...initialPatches) {
93
93
  } finally {
94
94
  _vode.isRendering = false;
95
95
  _vode.stats.renderCount++;
96
- _vode.stats.renderTime = Date.now() - sw;
96
+ _vode.stats.lastRenderTime = Date.now() - sw;
97
97
  if (_vode.q) {
98
98
  _vode.render();
99
99
  }
@@ -164,10 +164,10 @@ function mergeClass(a, b) {
164
164
  for (const item of a) {
165
165
  aa[item] = true;
166
166
  }
167
- for (const bKey of b.keys) {
167
+ for (const bKey of Object.keys(b)) {
168
168
  aa[bKey] = b[bKey];
169
169
  }
170
- return b;
170
+ return aa;
171
171
  }
172
172
  throw new Error(`cannot merge classes of ${a} (${typeof a}) and ${b} (${typeof b})`);
173
173
  }