@ng-org/alien-deepsignals 0.1.2-alpha.10 → 0.1.2-alpha.12

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 (47) hide show
  1. package/dist/core.d.ts +5 -1
  2. package/dist/core.d.ts.map +1 -1
  3. package/dist/core.js +11 -11
  4. package/dist/deepSignal.d.ts +1 -1
  5. package/dist/deepSignal.d.ts.map +1 -1
  6. package/dist/deepSignal.js +16 -27
  7. package/dist/hooks/react/index.js +2 -8
  8. package/dist/hooks/react/useDeepSignal.d.ts +2 -2
  9. package/dist/hooks/react/useDeepSignal.d.ts.map +1 -1
  10. package/dist/hooks/react/useDeepSignal.js +11 -13
  11. package/dist/hooks/svelte/index.js +2 -8
  12. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts +1 -1
  13. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts.map +1 -1
  14. package/dist/hooks/svelte/useDeepSignal.svelte.js +6 -9
  15. package/dist/hooks/svelte4/index.js +2 -8
  16. package/dist/hooks/svelte4/useDeepSignal.svelte.d.ts +1 -1
  17. package/dist/hooks/svelte4/useDeepSignal.svelte.d.ts.map +1 -1
  18. package/dist/hooks/svelte4/useDeepSignal.svelte.js +14 -17
  19. package/dist/hooks/vue/index.d.ts +1 -1
  20. package/dist/hooks/vue/index.d.ts.map +1 -1
  21. package/dist/hooks/vue/index.js +2 -8
  22. package/dist/hooks/vue/useDeepSignal.d.ts +1 -1
  23. package/dist/hooks/vue/useDeepSignal.d.ts.map +1 -1
  24. package/dist/hooks/vue/useDeepSignal.js +6 -9
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -27
  28. package/dist/iteratorHelpers.js +2 -6
  29. package/dist/test/frontend/astro-app/src/components/ReactPanel.d.ts.map +1 -1
  30. package/dist/test/frontend/astro-app/src/components/ReactPanel.jsx +13 -51
  31. package/dist/test/frontend/playwright/crossFrameworkHooks.spec.js +24 -26
  32. package/dist/test/frontend/utils/mockData.js +16 -21
  33. package/dist/test/frontend/utils/paths.js +2 -6
  34. package/dist/test/frontend/utils/renderMetrics.js +5 -12
  35. package/dist/test/frontend/utils/state.d.ts +1 -1
  36. package/dist/test/frontend/utils/state.js +13 -17
  37. package/dist/test/lib/deepSignalOptions.test.js +66 -68
  38. package/dist/test/lib/index.test.js +373 -375
  39. package/dist/test/lib/misc.test.js +98 -100
  40. package/dist/test/lib/watch.test.js +355 -357
  41. package/dist/types.d.ts +5 -1
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/types.js +1 -2
  44. package/dist/watch.d.ts +1 -1
  45. package/dist/watch.d.ts.map +1 -1
  46. package/dist/watch.js +6 -9
  47. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ReactPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/test/frontend/astro-app/src/components/ReactPanel.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAM1D,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EA6LvB,CAAC;AAwGF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"ReactPanel.d.ts","sourceRoot":"","sources":["../../../../../../src/test/frontend/astro-app/src/components/ReactPanel.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EA6LvB,CAAC;AAwGF,eAAe,UAAU,CAAC"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
2
  // All rights reserved.
4
3
  // Licensed under the Apache License, Version 2.0
@@ -8,55 +7,18 @@
8
7
  // notice may not be copied, modified, or distributed except
9
8
  // according to those terms.
10
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || (function () {
28
- var ownKeys = function(o) {
29
- ownKeys = Object.getOwnPropertyNames || function (o) {
30
- var ar = [];
31
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
- return ar;
33
- };
34
- return ownKeys(o);
35
- };
36
- return function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
- __setModuleDefault(result, mod);
41
- return result;
42
- };
43
- })();
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- const react_1 = __importStar(require("react"));
49
- const useDeepSignal_1 = __importDefault(require("../../../../../hooks/react/useDeepSignal"));
50
- const state_1 = require("../../../utils/state");
51
- const renderMetrics_1 = require("../../../utils/renderMetrics");
10
+ import React, { useEffect, useMemo, useRef } from "react";
11
+ import useDeepSignal from "../../../../../hooks/react/useDeepSignal.js";
12
+ import { sharedState } from "../../../utils/state.js";
13
+ import { recordRender, recordObjectRender, } from "../../../utils/renderMetrics.js";
52
14
  const ReactPanel = () => {
53
- const state = (0, useDeepSignal_1.default)(state_1.sharedState);
54
- const renderCount = (0, react_1.useRef)(0);
15
+ const state = useDeepSignal(sharedState);
16
+ const renderCount = useRef(0);
55
17
  renderCount.current += 1;
56
- (0, react_1.useEffect)(() => {
57
- (0, renderMetrics_1.recordRender)("react", renderCount.current);
18
+ useEffect(() => {
19
+ recordRender("react", renderCount.current);
58
20
  });
59
- const objectEntries = (0, react_1.useMemo)(() => {
21
+ const objectEntries = useMemo(() => {
60
22
  return [...state.objectSet];
61
23
  }, [state.objectSet]);
62
24
  return (<section>
@@ -193,10 +155,10 @@ const ReactPanel = () => {
193
155
  </section>);
194
156
  };
195
157
  const ObjectRow = ({ entry }) => {
196
- const rowRenderCount = (0, react_1.useRef)(0);
158
+ const rowRenderCount = useRef(0);
197
159
  rowRenderCount.current += 1;
198
- (0, react_1.useEffect)(() => {
199
- (0, renderMetrics_1.recordObjectRender)("react", entry["@id"], rowRenderCount.current);
160
+ useEffect(() => {
161
+ recordObjectRender("react", entry["@id"], rowRenderCount.current);
200
162
  });
201
163
  return (<div className="object-row" data-entry-id={entry["@id"]} data-render-count={rowRenderCount.current}>
202
164
  <span className="object-id">{entry["@id"]}</span>
@@ -235,4 +197,4 @@ const renderPrimitiveField = (label, options) => {
235
197
  <span data-role="value">{options.value}</span>
236
198
  </fieldset>);
237
199
  };
238
- exports.default = ReactPanel;
200
+ export default ReactPanel;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
2
  // All rights reserved.
4
3
  // Licensed under the Apache License, Version 2.0
@@ -8,11 +7,10 @@
8
7
  // notice may not be copied, modified, or distributed except
9
8
  // according to those terms.
10
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const test_1 = require("@playwright/test");
13
- const mockData_1 = require("../utils/mockData");
10
+ import { test, expect } from "@playwright/test";
11
+ import { mockTestObject } from "../utils/mockData.js";
14
12
  const frameworks = ["react", "vue", "svelte", "svelte4"];
15
- const alphaEntry = Array.from(mockData_1.mockTestObject.objectSet).find((entry) => entry["@id"] === "urn:object:alpha");
13
+ const alphaEntry = Array.from(mockTestObject.objectSet).find((entry) => entry["@id"] === "urn:object:alpha");
16
14
  if (!alphaEntry) {
17
15
  throw new Error("mock data must include an objectSet entry with @id urn:object:alpha");
18
16
  }
@@ -27,7 +25,7 @@ const createTextPlan = (key, nextValue) => ({
27
25
  },
28
26
  assert: async (page, framework) => {
29
27
  const field = fieldLocator(page, framework, key);
30
- await (0, test_1.expect)(field.locator("[data-role='value']")).toHaveText(nextValue);
28
+ await expect(field.locator("[data-role='value']")).toHaveText(nextValue);
31
29
  },
32
30
  });
33
31
  const createNumberPlan = (key, nextValue) => ({
@@ -40,7 +38,7 @@ const createNumberPlan = (key, nextValue) => ({
40
38
  },
41
39
  assert: async (page, framework) => {
42
40
  const field = fieldLocator(page, framework, key);
43
- await (0, test_1.expect)(field.locator("[data-role='value']")).toHaveText(String(nextValue));
41
+ await expect(field.locator("[data-role='value']")).toHaveText(String(nextValue));
44
42
  },
45
43
  });
46
44
  const createBooleanPlan = (key, nextValue) => ({
@@ -52,7 +50,7 @@ const createBooleanPlan = (key, nextValue) => ({
52
50
  },
53
51
  assert: async (page, framework) => {
54
52
  const field = fieldLocator(page, framework, key);
55
- await (0, test_1.expect)(field.locator("[data-role='value']")).toHaveText(String(nextValue));
53
+ await expect(field.locator("[data-role='value']")).toHaveText(String(nextValue));
56
54
  },
57
55
  });
58
56
  const createArrayPlan = (key, initialLength, additions) => ({
@@ -67,7 +65,7 @@ const createArrayPlan = (key, initialLength, additions) => ({
67
65
  assert: async (page, framework) => {
68
66
  const expectedLength = initialLength + additions;
69
67
  const field = fieldLocator(page, framework, key);
70
- await (0, test_1.expect)(field.locator("[data-role='array-length']")).toHaveText(`Length: ${expectedLength}`);
68
+ await expect(field.locator("[data-role='array-length']")).toHaveText(`Length: ${expectedLength}`);
71
69
  },
72
70
  });
73
71
  const createSetPlan = (key, initialSize, additions) => ({
@@ -82,7 +80,7 @@ const createSetPlan = (key, initialSize, additions) => ({
82
80
  assert: async (page, framework) => {
83
81
  const expectedSize = initialSize + additions;
84
82
  const field = fieldLocator(page, framework, key);
85
- await (0, test_1.expect)(field.locator("[data-role='set-size']")).toHaveText(`Size: ${expectedSize}`);
83
+ await expect(field.locator("[data-role='set-size']")).toHaveText(`Size: ${expectedSize}`);
86
84
  },
87
85
  });
88
86
  const createObjectSetPlan = (entryId, nextLabel, expectedCount) => ({
@@ -96,8 +94,8 @@ const createObjectSetPlan = (entryId, nextLabel, expectedCount) => ({
96
94
  },
97
95
  assert: async (page, framework) => {
98
96
  const entry = fieldLocator(page, framework, "objectSet").locator(`[data-entry-id='${entryId}']`);
99
- await (0, test_1.expect)(entry.locator("[data-role='count']")).toHaveText(String(expectedCount));
100
- await (0, test_1.expect)(entry.locator("input[data-role='label']")).toHaveValue(nextLabel);
97
+ await expect(entry.locator("[data-role='count']")).toHaveText(String(expectedCount));
98
+ await expect(entry.locator("input[data-role='label']")).toHaveValue(nextLabel);
101
99
  },
102
100
  });
103
101
  const fieldPlans = [
@@ -107,9 +105,9 @@ const fieldPlans = [
107
105
  createBooleanPlan("boolValue", false),
108
106
  createTextPlan("objectValue.nestedString", "nested_changed"),
109
107
  createNumberPlan("objectValue.nestedNum", 77),
110
- createArrayPlan("arrayValue", mockData_1.mockTestObject.arrayValue.length, 2),
111
- createArrayPlan("objectValue.nestedArray", mockData_1.mockTestObject.objectValue.nestedArray.length, 1),
112
- createSetPlan("setValue", mockData_1.mockTestObject.setValue.size, 1),
108
+ createArrayPlan("arrayValue", mockTestObject.arrayValue.length, 2),
109
+ createArrayPlan("objectValue.nestedArray", mockTestObject.objectValue.nestedArray.length, 1),
110
+ createSetPlan("setValue", mockTestObject.setValue.size, 1),
113
111
  createObjectSetPlan(alphaEntry["@id"], "Alpha updated", alphaEntry.count + 1),
114
112
  ];
115
113
  const getRenderCounts = (page) => page.evaluate(() => ({ ...(window.renderCounts ?? {}) }));
@@ -123,7 +121,7 @@ const waitForFrameworkReady = async (page, framework) => {
123
121
  throw new Error(`${framework} panel did not render within 10 seconds: ${error}`);
124
122
  }
125
123
  };
126
- test_1.test.beforeEach(async ({ page }) => {
124
+ test.beforeEach(async ({ page }) => {
127
125
  await page.goto("/");
128
126
  await waitForFrameworkReady(page, "react");
129
127
  await waitForFrameworkReady(page, "vue");
@@ -132,29 +130,29 @@ test_1.test.beforeEach(async ({ page }) => {
132
130
  await page.waitForFunction("window.testHarness?.ready === true");
133
131
  await page.evaluate(() => window.testHarness?.resetState());
134
132
  });
135
- (0, test_1.test)("components load", async ({ page }) => {
133
+ test("components load", async ({ page }) => {
136
134
  for (const framework of frameworks) {
137
- await (0, test_1.expect)(page.locator(`.${framework} .title`)).toBeDefined();
135
+ await expect(page.locator(`.${framework} .title`)).toBeDefined();
138
136
  }
139
137
  });
140
- test_1.test.describe("cross framework propagation", () => {
138
+ test.describe("cross framework propagation", () => {
141
139
  for (const source of frameworks) {
142
140
  for (const target of frameworks) {
143
141
  if (source === target)
144
142
  continue;
145
- (0, test_1.test)(`${source} edits propagate to ${target}`, async ({ page }) => {
146
- await test_1.test.step(`mutate in ${source}`, async () => {
143
+ test(`${source} edits propagate to ${target}`, async ({ page }) => {
144
+ await test.step(`mutate in ${source}`, async () => {
147
145
  for (const plan of fieldPlans) {
148
146
  await plan.mutate(page, source);
149
147
  }
150
148
  });
151
149
  await page.waitForTimeout(100);
152
- await test_1.test.step(`assert in ${target}`, async () => {
150
+ await test.step(`assert in ${target}`, async () => {
153
151
  for (const plan of fieldPlans) {
154
152
  await plan.assert(page, target);
155
153
  }
156
154
  });
157
- await test_1.test.step(`validate mutated source ${source}`, async () => {
155
+ await test.step(`validate mutated source ${source}`, async () => {
158
156
  for (const plan of fieldPlans) {
159
157
  await plan.assert(page, source);
160
158
  }
@@ -163,7 +161,7 @@ test_1.test.describe("cross framework propagation", () => {
163
161
  }
164
162
  }
165
163
  });
166
- (0, test_1.test)("hidden mutations do not trigger renders", async ({ page }) => {
164
+ test("hidden mutations do not trigger renders", async ({ page }) => {
167
165
  const before = await getRenderCounts(page);
168
166
  await page.evaluate(() => {
169
167
  if (window.sharedState) {
@@ -175,7 +173,7 @@ test_1.test.describe("cross framework propagation", () => {
175
173
  for (const framework of frameworks) {
176
174
  const previous = before[framework] ?? 0;
177
175
  const current = after[framework] ?? 0;
178
- (0, test_1.expect)(current).toBeGreaterThanOrEqual(previous);
179
- (0, test_1.expect)(current - previous).toBeLessThanOrEqual(2);
176
+ expect(current).toBeGreaterThanOrEqual(previous);
177
+ expect(current - previous).toBeLessThanOrEqual(2);
180
178
  }
181
179
  });
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
2
  // All rights reserved.
4
3
  // Licensed under the Apache License, Version 2.0
@@ -8,10 +7,6 @@
8
7
  // notice may not be copied, modified, or distributed except
9
8
  // according to those terms.
10
9
  // SPDX-License-Identifier: Apache-2.0 OR MIT
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.mockTestObject = void 0;
13
- exports.cloneDefaultObjectSet = cloneDefaultObjectSet;
14
- exports.buildInitialState = buildInitialState;
15
10
  const buildDefaultObjectSetEntries = () => {
16
11
  const baseEntries = [
17
12
  {
@@ -36,7 +31,7 @@ const buildDefaultObjectSetEntries = () => {
36
31
  return [...baseEntries, ...extraEntries];
37
32
  };
38
33
  const defaultObjectSetEntries = buildDefaultObjectSetEntries();
39
- exports.mockTestObject = Object.freeze({
34
+ export const mockTestObject = Object.freeze({
40
35
  type: "TestObject",
41
36
  stringValue: "string",
42
37
  numValue: 42,
@@ -58,26 +53,26 @@ exports.mockTestObject = Object.freeze({
58
53
  vue: 0,
59
54
  },
60
55
  });
61
- function cloneDefaultObjectSet() {
56
+ export function cloneDefaultObjectSet() {
62
57
  return defaultObjectSetEntries.map((entry) => ({ ...entry }));
63
58
  }
64
- function buildInitialState() {
59
+ export function buildInitialState() {
65
60
  return {
66
- type: exports.mockTestObject.type,
67
- stringValue: exports.mockTestObject.stringValue,
68
- numValue: exports.mockTestObject.numValue,
69
- boolValue: exports.mockTestObject.boolValue,
70
- nullValue: exports.mockTestObject.nullValue,
71
- hiddenValue: exports.mockTestObject.hiddenValue,
72
- arrayValue: [...exports.mockTestObject.arrayValue],
61
+ type: mockTestObject.type,
62
+ stringValue: mockTestObject.stringValue,
63
+ numValue: mockTestObject.numValue,
64
+ boolValue: mockTestObject.boolValue,
65
+ nullValue: mockTestObject.nullValue,
66
+ hiddenValue: mockTestObject.hiddenValue,
67
+ arrayValue: [...mockTestObject.arrayValue],
73
68
  objectValue: {
74
- nestedString: exports.mockTestObject.objectValue.nestedString,
75
- nestedNum: exports.mockTestObject.objectValue.nestedNum,
76
- nestedArray: [...exports.mockTestObject.objectValue.nestedArray],
69
+ nestedString: mockTestObject.objectValue.nestedString,
70
+ nestedNum: mockTestObject.objectValue.nestedNum,
71
+ nestedArray: [...mockTestObject.objectValue.nestedArray],
77
72
  },
78
- setValue: new Set(Array.from(exports.mockTestObject.setValue)),
79
- objectSet: new Set(Array.from(exports.mockTestObject.objectSet).map((entry) => ({ ...entry }))),
80
- count: exports.mockTestObject.count,
73
+ setValue: new Set(Array.from(mockTestObject.setValue)),
74
+ objectSet: new Set(Array.from(mockTestObject.objectSet).map((entry) => ({ ...entry }))),
75
+ count: mockTestObject.count,
81
76
  perfCounters: {
82
77
  react: 0,
83
78
  svelte: 0,
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getByPath = getByPath;
4
- exports.setByPath = setByPath;
5
1
  const toSegment = (segment) => segment.match(/^\d+$/) ? Number(segment) : segment;
6
- function getByPath(source, path) {
2
+ export function getByPath(source, path) {
7
3
  const segments = path.split(".").filter(Boolean).map(toSegment);
8
4
  return segments.reduce((acc, key) => {
9
5
  if (acc == null)
@@ -11,7 +7,7 @@ function getByPath(source, path) {
11
7
  return acc[key];
12
8
  }, source);
13
9
  }
14
- function setByPath(source, path, value) {
10
+ export function setByPath(source, path, value) {
15
11
  const segments = path.split(".").filter(Boolean).map(toSegment);
16
12
  if (!segments.length)
17
13
  return false;
@@ -1,35 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.recordRender = recordRender;
4
- exports.getRenderCount = getRenderCount;
5
- exports.snapshotRenderCounts = snapshotRenderCounts;
6
- exports.recordObjectRender = recordObjectRender;
7
- exports.snapshotObjectRenderCounts = snapshotObjectRenderCounts;
8
1
  const incrementRenderEvents = (framework) => {
9
2
  if (typeof window === "undefined")
10
3
  return;
11
4
  const events = (window.renderEventCounts ??= {});
12
5
  events[framework] = (events[framework] ?? 0) + 1;
13
6
  };
14
- function recordRender(framework, count) {
7
+ export function recordRender(framework, count) {
15
8
  if (typeof window === "undefined")
16
9
  return;
17
10
  const store = (window.renderCounts ??= {});
18
11
  store[framework] = count;
19
12
  incrementRenderEvents(framework);
20
13
  }
21
- function getRenderCount(framework) {
14
+ export function getRenderCount(framework) {
22
15
  if (typeof window === "undefined")
23
16
  return 0;
24
17
  return window.renderCounts?.[framework] ?? 0;
25
18
  }
26
- function snapshotRenderCounts() {
19
+ export function snapshotRenderCounts() {
27
20
  if (typeof window === "undefined")
28
21
  return {};
29
22
  const source = window.renderEventCounts ?? {};
30
23
  return Object.fromEntries(Object.entries(source));
31
24
  }
32
- function recordObjectRender(framework, objectId, count) {
25
+ export function recordObjectRender(framework, objectId, count) {
33
26
  if (typeof window === "undefined")
34
27
  return;
35
28
  const host = (window.objectRenderCounts ??= {});
@@ -37,7 +30,7 @@ function recordObjectRender(framework, objectId, count) {
37
30
  entries[objectId] = count;
38
31
  incrementRenderEvents(framework);
39
32
  }
40
- function snapshotObjectRenderCounts() {
33
+ export function snapshotObjectRenderCounts() {
41
34
  if (typeof window === "undefined")
42
35
  return {};
43
36
  const source = window.objectRenderCounts ?? {};
@@ -52,6 +52,6 @@ export type PerfScenarioResult = {
52
52
  runs?: PerfScenarioRun[];
53
53
  completedAt?: number;
54
54
  };
55
- export declare const sharedState: import("../../../types.js").DeepSignalObject<TestState>;
55
+ export declare const sharedState: import("../../../types.ts").DeepSignalObject<TestState>;
56
56
  export declare function resetSharedState(): void;
57
57
  //# sourceMappingURL=state.d.ts.map
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sharedState = void 0;
4
- exports.resetSharedState = resetSharedState;
5
- const deepSignal_js_1 = require("../../../deepSignal.js");
6
- const mockData_js_1 = require("./mockData.js");
7
- const paths_js_1 = require("./paths.js");
8
- const createState = () => (0, deepSignal_js_1.deepSignal)((0, mockData_js_1.buildInitialState)());
9
- exports.sharedState = createState();
1
+ import { deepSignal } from "../../../deepSignal.js";
2
+ import { buildInitialState } from "./mockData.js";
3
+ import { getByPath, setByPath } from "./paths.js";
4
+ const createState = () => deepSignal(buildInitialState());
5
+ export const sharedState = createState();
10
6
  const sharedStateListeners = new Set();
11
7
  const notifySharedStateListeners = () => {
12
8
  if (!sharedStateListeners.size)
@@ -22,12 +18,12 @@ const notifySharedStateListeners = () => {
22
18
  };
23
19
  const now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
24
20
  const microtask = () => new Promise((resolve) => setTimeout(resolve, 0));
25
- function resetSharedState() {
26
- const next = (0, mockData_js_1.buildInitialState)();
27
- for (const key of Object.keys(exports.sharedState)) {
28
- delete exports.sharedState[key];
21
+ export function resetSharedState() {
22
+ const next = buildInitialState();
23
+ for (const key of Object.keys(sharedState)) {
24
+ delete sharedState[key];
29
25
  }
30
- Object.assign(exports.sharedState, next);
26
+ Object.assign(sharedState, next);
31
27
  }
32
28
  const measure = async (mutator, settle = true) => {
33
29
  const start = now();
@@ -37,7 +33,7 @@ const measure = async (mutator, settle = true) => {
37
33
  return now() - start;
38
34
  };
39
35
  if (typeof window !== "undefined") {
40
- window.sharedState = exports.sharedState;
36
+ window.sharedState = sharedState;
41
37
  const harness = (window.testHarness ??= {
42
38
  resetState: () => undefined,
43
39
  noopMutation: () => undefined,
@@ -46,8 +42,8 @@ if (typeof window !== "undefined") {
46
42
  });
47
43
  harness.resetState = () => resetSharedState();
48
44
  harness.noopMutation = (path) => {
49
- const current = (0, paths_js_1.getByPath)(exports.sharedState, path);
50
- (0, paths_js_1.setByPath)(exports.sharedState, path, current);
45
+ const current = getByPath(sharedState, path);
46
+ setByPath(sharedState, path, current);
51
47
  };
52
48
  harness.ready = true;
53
49
  const perfSuite = (window.perfSuite ??= {