r-state-tree 0.4.6 → 0.5.0

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.
@@ -1,5 +1,5 @@
1
1
  import { batch, Signal, signal, computed as computed$1, untracked, effect } from "@preact/signals-core";
2
- import { ReadonlySignal, Signal as Signal2, batch as batch2, effect as effect2, signal as signal2, untracked as untracked2 } from "@preact/signals-core";
2
+ import { Signal as Signal2, batch as batch2, effect as effect2, signal as signal2, untracked as untracked2 } from "@preact/signals-core";
3
3
  var lib = {};
4
4
  var hasRequiredLib;
5
5
  function requireLib() {
@@ -16,6 +16,8 @@ var CommonCfgTypes = /* @__PURE__ */ ((CommonCfgTypes2) => {
16
16
  })(CommonCfgTypes || {});
17
17
  var ModelCfgTypes = /* @__PURE__ */ ((ModelCfgTypes2) => {
18
18
  ModelCfgTypes2["state"] = "state";
19
+ ModelCfgTypes2["stateShallow"] = "stateShallow";
20
+ ModelCfgTypes2["stateSignal"] = "stateSignal";
19
21
  ModelCfgTypes2["id"] = "id";
20
22
  ModelCfgTypes2["modelRef"] = "modelRef";
21
23
  return ModelCfgTypes2;
@@ -26,6 +28,8 @@ var StoreCfgTypes = /* @__PURE__ */ ((StoreCfgTypes2) => {
26
28
  })(StoreCfgTypes || {});
27
29
  var ObservableCfgTypes = /* @__PURE__ */ ((ObservableCfgTypes2) => {
28
30
  ObservableCfgTypes2["observable"] = "observable";
31
+ ObservableCfgTypes2["observableShallow"] = "observableShallow";
32
+ ObservableCfgTypes2["observableSignal"] = "observableSignal";
29
33
  ObservableCfgTypes2["computed"] = "computed";
30
34
  return ObservableCfgTypes2;
31
35
  })(ObservableCfgTypes || {});
@@ -42,6 +46,14 @@ const stateType = {
42
46
  type: "state"
43
47
  /* state */
44
48
  };
49
+ const stateShallowType = {
50
+ type: "stateShallow"
51
+ /* stateShallow */
52
+ };
53
+ const stateSignalType = {
54
+ type: "stateSignal"
55
+ /* stateSignal */
56
+ };
45
57
  const modelRefType = Object.assign(
46
58
  function(childType2) {
47
59
  return { type: "modelRef", childType: childType2 };
@@ -84,6 +96,12 @@ function getPropertyType(key, obj) {
84
96
  switch (config.type) {
85
97
  case ObservableCfgTypes.computed:
86
98
  return "computed";
99
+ case ObservableCfgTypes.observableShallow:
100
+ case ModelCfgTypes.stateShallow:
101
+ return "observableShallow";
102
+ case ObservableCfgTypes.observableSignal:
103
+ case ModelCfgTypes.stateSignal:
104
+ return "observableSignal";
87
105
  case ModelCfgTypes.state:
88
106
  case ObservableCfgTypes.observable:
89
107
  case ModelCfgTypes.id:
@@ -352,6 +370,7 @@ class ObjectAdministration extends Administration {
352
370
  }
353
371
  switch (type) {
354
372
  case "observable":
373
+ case "observableShallow":
355
374
  case "action": {
356
375
  if (key in this.source) {
357
376
  this.valuesMap.reportObserved(key, this.source[key]);
@@ -363,8 +382,21 @@ class ObjectAdministration extends Administration {
363
382
  if (type === "observable") {
364
383
  return getObservable(this.get(key));
365
384
  }
385
+ if (type === "observableShallow") {
386
+ return getShallowObservable(this.get(key));
387
+ }
366
388
  return getAction(this.get(key));
367
389
  }
390
+ case "observableSignal": {
391
+ if (key in this.source) {
392
+ this.valuesMap.reportObserved(key, this.source[key]);
393
+ }
394
+ this.atom.reportObserved();
395
+ if (this.atom.observing) {
396
+ this.hasMap.reportObserved(key);
397
+ }
398
+ return this.get(key);
399
+ }
368
400
  case "computed": {
369
401
  return this.callComputed(key);
370
402
  }
@@ -572,13 +604,31 @@ function createComputed(fn, context = null) {
572
604
  }
573
605
  };
574
606
  }
575
- function observable(value, context) {
607
+ function observableImpl(value, context) {
576
608
  if (context && typeof context === "object" && "kind" in context) {
577
609
  context.metadata[context.name] = { type: "observable" };
578
610
  return value;
579
611
  }
580
612
  return getObservable(value);
581
613
  }
614
+ function shallowDecorator(value, context) {
615
+ if (context && typeof context === "object" && "kind" in context) {
616
+ context.metadata[context.name] = { type: "observableShallow" };
617
+ return value;
618
+ }
619
+ throw new Error("observable.shallow can only be used as a decorator");
620
+ }
621
+ function signalDecorator(value, context) {
622
+ if (context && typeof context === "object" && "kind" in context) {
623
+ context.metadata[context.name] = { type: "observableSignal" };
624
+ return value;
625
+ }
626
+ throw new Error("observable.signal can only be used as a decorator");
627
+ }
628
+ const observable = Object.assign(observableImpl, {
629
+ shallow: shallowDecorator,
630
+ signal: signalDecorator
631
+ });
582
632
  function computed(value, context) {
583
633
  if (context && typeof context === "object" && "kind" in context) {
584
634
  context.metadata[context.name] = { type: "computed" };
@@ -790,6 +840,9 @@ class CollectionAdministration extends Administration {
790
840
  const value = sourceMap.get(targetKey) ?? sourceMap.get(key);
791
841
  if (has) {
792
842
  this.valuesMap.reportObserved(key, value);
843
+ if (isShallowObservable(this.proxy)) {
844
+ return value;
845
+ }
793
846
  return getObservable(value);
794
847
  }
795
848
  return void 0;
@@ -978,6 +1031,9 @@ class ArrayAdministration extends Administration {
978
1031
  get(index) {
979
1032
  this.atom.reportObserved();
980
1033
  this.valuesMap.reportObserved(index, this.source[index]);
1034
+ if (isShallowObservable(this.proxy)) {
1035
+ return this.source[index];
1036
+ }
981
1037
  return getObservable(this.source[index]);
982
1038
  }
983
1039
  set(index, newValue) {
@@ -1243,6 +1299,39 @@ function getObservable(value) {
1243
1299
  }
1244
1300
  return value;
1245
1301
  }
1302
+ const shallowObservables = /* @__PURE__ */ new WeakSet();
1303
+ function isShallowObservable(obj) {
1304
+ if (!obj || typeof obj !== "object") return false;
1305
+ return shallowObservables.has(obj);
1306
+ }
1307
+ function getShallowObservable(value) {
1308
+ if (!value) {
1309
+ return value;
1310
+ }
1311
+ const existingAdm = getAdministration(value);
1312
+ if (existingAdm) {
1313
+ return existingAdm.proxy;
1314
+ }
1315
+ if ((typeof value === "object" || typeof value === "function") && !Object.isFrozen(value)) {
1316
+ const obj = value;
1317
+ let Adm = null;
1318
+ if (Array.isArray(obj)) {
1319
+ Adm = ArrayAdministration;
1320
+ } else if (obj instanceof Map || obj instanceof WeakMap) {
1321
+ Adm = CollectionAdministration;
1322
+ } else if (obj instanceof Set || obj instanceof WeakSet) {
1323
+ Adm = CollectionAdministration;
1324
+ }
1325
+ if (Adm) {
1326
+ const adm = new Adm(obj);
1327
+ administrationMap.set(adm.proxy, adm);
1328
+ administrationMap.set(adm.source, adm);
1329
+ shallowObservables.add(adm.proxy);
1330
+ return adm.proxy;
1331
+ }
1332
+ }
1333
+ return value;
1334
+ }
1246
1335
  function isObservable(obj) {
1247
1336
  if (!obj || typeof obj !== "object") return false;
1248
1337
  const adm = getAdministration(obj);
@@ -1316,6 +1405,33 @@ function getDiff(o1, o2, getConfig) {
1316
1405
  }
1317
1406
  return Object.keys(diff).length > 0 ? diff : null;
1318
1407
  }
1408
+ const MAX_MOUNT_DEPTH = 100;
1409
+ const mountingStack = [];
1410
+ function formatMountFrame(frame) {
1411
+ const childSegment = frame.childName === void 0 ? "" : `.${String(frame.childName)}`;
1412
+ return `${frame.storeName}${childSegment}`;
1413
+ }
1414
+ function formatMountChain(frame) {
1415
+ const chain = [...mountingStack, frame];
1416
+ const maxParts = 6;
1417
+ if (chain.length > maxParts) {
1418
+ const start = chain.slice(0, 3);
1419
+ const end = chain.slice(-2);
1420
+ return [
1421
+ ...start,
1422
+ { storeName: "...", modelsKeys: [], childName: void 0 },
1423
+ ...end
1424
+ ].map(formatMountFrame).join(" -> ");
1425
+ }
1426
+ return chain.map(formatMountFrame).join(" -> ");
1427
+ }
1428
+ function createCircularMountError(frame) {
1429
+ const chain = formatMountChain(frame);
1430
+ const models = frame.modelsKeys.length === 0 ? "no models provided" : `models: ${frame.modelsKeys.join(", ")}`;
1431
+ return new Error(
1432
+ `r-state-tree: detected circular store/model creation while mounting ${chain} (using ${models}). Passing models into child stores during mount can create recursive wiring. Move child store/model creation into storeDidMount or break the cycle.`
1433
+ );
1434
+ }
1319
1435
  function updateProps(props, newProps) {
1320
1436
  untracked(() => {
1321
1437
  batch(() => {
@@ -1335,6 +1451,35 @@ function updateProps(props, newProps) {
1335
1451
  function getStoreAdm(store) {
1336
1452
  return getAdministration(store);
1337
1453
  }
1454
+ function validateStoreChildValue(value, propertyName) {
1455
+ if (value === null || value === void 0) {
1456
+ return;
1457
+ }
1458
+ if (Array.isArray(value)) {
1459
+ const invalidItem = value.find(
1460
+ (item) => item !== null && (typeof item !== "object" || !("Type" in item) || !("props" in item) || typeof item.Type !== "function" || typeof item.props !== "object")
1461
+ );
1462
+ if (invalidItem !== void 0) {
1463
+ throw new Error(
1464
+ `r-state-tree: child property '${String(
1465
+ propertyName
1466
+ )}' must be a StoreElement ({ Type, props, key }), an array of StoreElements, or null/undefined. Found invalid array item: ${typeof invalidItem}`
1467
+ );
1468
+ }
1469
+ return;
1470
+ }
1471
+ if (typeof value === "object" && value !== null && "Type" in value && "props" in value) {
1472
+ const element = value;
1473
+ if (typeof element.Type === "function" && typeof element.props === "object") {
1474
+ return;
1475
+ }
1476
+ }
1477
+ throw new Error(
1478
+ `r-state-tree: child property '${String(
1479
+ propertyName
1480
+ )}' must be a StoreElement ({ Type, props, key }), an array of StoreElements, or null/undefined. Found: ${typeof value}`
1481
+ );
1482
+ }
1338
1483
  class StoreAdministration extends PreactObjectAdministration {
1339
1484
  static proxyTraps = Object.assign(
1340
1485
  {},
@@ -1402,7 +1547,7 @@ class StoreAdministration extends PreactObjectAdministration {
1402
1547
  }
1403
1548
  });
1404
1549
  childStoreData.value.set(stores);
1405
- stores.forEach((s) => getStoreAdm(s).mount(this));
1550
+ stores.forEach((s) => getStoreAdm(s).mount(this, name));
1406
1551
  return stores;
1407
1552
  }
1408
1553
  const newStores = /* @__PURE__ */ new Set();
@@ -1453,7 +1598,7 @@ class StoreAdministration extends PreactObjectAdministration {
1453
1598
  batch(() => childStoreData.value.set(stores));
1454
1599
  }
1455
1600
  removedStores.forEach((s) => getStoreAdm(s).unmount());
1456
- newStores.forEach((s) => getStoreAdm(s).mount(this));
1601
+ newStores.forEach((s) => getStoreAdm(s).mount(this, name));
1457
1602
  return stores;
1458
1603
  }
1459
1604
  setSingleStore(name, element) {
@@ -1472,7 +1617,7 @@ class StoreAdministration extends PreactObjectAdministration {
1472
1617
  }
1473
1618
  const childStore = this.createChildStore(element);
1474
1619
  batch(() => childStoreData.value.set(childStore));
1475
- getStoreAdm(childStore).mount(this);
1620
+ getStoreAdm(childStore).mount(this, name);
1476
1621
  return childStore;
1477
1622
  } else {
1478
1623
  batch(() => updateProps(oldStore.props, props));
@@ -1484,6 +1629,7 @@ class StoreAdministration extends PreactObjectAdministration {
1484
1629
  const storeElement = childStoreData.listener.track(
1485
1630
  () => childStoreData.computed.get()
1486
1631
  );
1632
+ validateStoreChildValue(storeElement, name);
1487
1633
  Array.isArray(storeElement) ? this.setStoreList(name, storeElement) : this.setSingleStore(name, storeElement);
1488
1634
  }
1489
1635
  getComputedGetter(name) {
@@ -1504,6 +1650,7 @@ class StoreAdministration extends PreactObjectAdministration {
1504
1650
  const storeElement = childStoreData.listener.track(
1505
1651
  () => childStoreData.computed.get()
1506
1652
  );
1653
+ validateStoreChildValue(storeElement, name);
1507
1654
  Array.isArray(storeElement) ? this.setStoreList(name, storeElement) : this.setSingleStore(name, storeElement);
1508
1655
  return childStoreData.value.get();
1509
1656
  }
@@ -1513,6 +1660,7 @@ class StoreAdministration extends PreactObjectAdministration {
1513
1660
  return this.initializeStore(name);
1514
1661
  } else {
1515
1662
  const storeElement = untracked(() => childStoreData.computed.get());
1663
+ validateStoreChildValue(storeElement, name);
1516
1664
  Array.isArray(storeElement) ? this.setStoreList(name, storeElement) : this.setSingleStore(name, storeElement);
1517
1665
  return childStoreData.value.get();
1518
1666
  }
@@ -1561,18 +1709,36 @@ class StoreAdministration extends PreactObjectAdministration {
1561
1709
  this.reactionsUnsub.push(unsub);
1562
1710
  return unsub;
1563
1711
  }
1564
- mount(parent = null) {
1565
- this.parent = parent || null;
1566
- this.childStoreDataMap.forEach(({ value }) => {
1567
- const stores = value.get();
1568
- if (Array.isArray(stores)) {
1569
- stores?.forEach((s) => getStoreAdm(s)?.mount(this));
1570
- } else if (stores) {
1571
- getStoreAdm(stores)?.mount(this);
1712
+ mount(parent = null, childName) {
1713
+ const frame = {
1714
+ storeName: this.proxy.constructor.name || "Store",
1715
+ childName,
1716
+ modelsKeys: Object.keys(this.proxy.props?.models ?? {})
1717
+ };
1718
+ if (mountingStack.length + 1 > MAX_MOUNT_DEPTH) {
1719
+ throw createCircularMountError(frame);
1720
+ }
1721
+ mountingStack.push(frame);
1722
+ try {
1723
+ this.parent = parent || null;
1724
+ this.childStoreDataMap.forEach(({ value }, name) => {
1725
+ const stores = value.get();
1726
+ if (Array.isArray(stores)) {
1727
+ stores?.forEach((s) => getStoreAdm(s)?.mount(this, name));
1728
+ } else if (stores) {
1729
+ getStoreAdm(stores)?.mount(this, name);
1730
+ }
1731
+ });
1732
+ this.mounted = true;
1733
+ batch(() => this.proxy.storeDidMount?.());
1734
+ } catch (error) {
1735
+ if (error instanceof RangeError && /call stack/i.test(error.message)) {
1736
+ throw createCircularMountError(frame);
1572
1737
  }
1573
- });
1574
- this.mounted = true;
1575
- batch(() => this.proxy.storeDidMount?.());
1738
+ throw error;
1739
+ } finally {
1740
+ mountingStack.pop();
1741
+ }
1576
1742
  }
1577
1743
  unmount() {
1578
1744
  this.proxy.storeWillUnmount?.();
@@ -1890,6 +2056,30 @@ function getSnapshotRefId(snapshot) {
1890
2056
  }
1891
2057
  return snapshot[keys[0]];
1892
2058
  }
2059
+ function validateModelChildValue(value, propertyName) {
2060
+ if (value === null || value === void 0) {
2061
+ return;
2062
+ }
2063
+ if (value instanceof Model) {
2064
+ return;
2065
+ }
2066
+ if (Array.isArray(value)) {
2067
+ const invalidItem = value.find((item) => !(item instanceof Model));
2068
+ if (invalidItem !== void 0) {
2069
+ throw new Error(
2070
+ `r-state-tree: child property '${String(
2071
+ propertyName
2072
+ )}' must be a Model instance, an array of Model instances, or null/undefined. Found invalid array item: ${typeof invalidItem}`
2073
+ );
2074
+ }
2075
+ return;
2076
+ }
2077
+ throw new Error(
2078
+ `r-state-tree: child property '${String(
2079
+ propertyName
2080
+ )}' must be a Model instance, an array of Model instances, or null/undefined. Found: ${typeof value}`
2081
+ );
2082
+ }
1893
2083
  class ModelAdministration extends PreactObjectAdministration {
1894
2084
  static proxyTraps = Object.assign(
1895
2085
  {},
@@ -1923,6 +2113,7 @@ class ModelAdministration extends PreactObjectAdministration {
1923
2113
  return true;
1924
2114
  }
1925
2115
  case CommonCfgTypes.child: {
2116
+ validateModelChildValue(value, name);
1926
2117
  if (Array.isArray(value)) {
1927
2118
  adm.setModels(name, value);
1928
2119
  return true;
@@ -1935,7 +2126,9 @@ class ModelAdministration extends PreactObjectAdministration {
1935
2126
  adm.setId(name, value);
1936
2127
  break;
1937
2128
  }
1938
- case ModelCfgTypes.state: {
2129
+ case ModelCfgTypes.state:
2130
+ case ModelCfgTypes.stateShallow:
2131
+ case ModelCfgTypes.stateSignal: {
1939
2132
  adm.setState(name, value);
1940
2133
  break;
1941
2134
  }
@@ -2029,6 +2222,7 @@ class ModelAdministration extends PreactObjectAdministration {
2029
2222
  }
2030
2223
  }
2031
2224
  setModel(name, newModel) {
2225
+ validateModelChildValue(newModel, name);
2032
2226
  const currentValue = this.proxy[name];
2033
2227
  if (currentValue === newModel) {
2034
2228
  return;
@@ -2048,6 +2242,7 @@ class ModelAdministration extends PreactObjectAdministration {
2048
2242
  }
2049
2243
  }
2050
2244
  setModels(name, newModelsSource) {
2245
+ validateModelChildValue(newModelsSource, name);
2051
2246
  const newModels = createObservableWithCustomAdministration(
2052
2247
  [],
2053
2248
  ChildModelsAdministration
@@ -2203,6 +2398,8 @@ class ModelAdministration extends PreactObjectAdministration {
2203
2398
  return Object.keys(this.configuration).reduce((json, key) => {
2204
2399
  switch (this.configuration[key].type) {
2205
2400
  case ModelCfgTypes.state:
2401
+ case ModelCfgTypes.stateShallow:
2402
+ case ModelCfgTypes.stateSignal:
2206
2403
  case ModelCfgTypes.id:
2207
2404
  json[key] = clone(getSource(this.proxy[key]));
2208
2405
  break;
@@ -2268,6 +2465,8 @@ class ModelAdministration extends PreactObjectAdministration {
2268
2465
  const value = snapshot[key];
2269
2466
  switch (type) {
2270
2467
  case ModelCfgTypes.state:
2468
+ case ModelCfgTypes.stateShallow:
2469
+ case ModelCfgTypes.stateSignal:
2271
2470
  this.proxy[key] = value;
2272
2471
  break;
2273
2472
  case ModelCfgTypes.modelRef:
@@ -2483,11 +2682,13 @@ const child = makeChildDecorator(childType);
2483
2682
  const modelRef = makeChildDecorator(modelRefType);
2484
2683
  const model = makeDecorator(modelType);
2485
2684
  const id = makeDecorator(idType);
2486
- const state = makeDecorator(stateType);
2685
+ const state = Object.assign(makeDecorator(stateType), {
2686
+ shallow: makeDecorator(stateShallowType),
2687
+ signal: makeDecorator(stateSignalType)
2688
+ });
2487
2689
  export {
2488
2690
  Model,
2489
2691
  Observable,
2490
- ReadonlySignal,
2491
2692
  Signal2 as Signal,
2492
2693
  Store,
2493
2694
  applySnapshot,
@@ -1,4 +1,4 @@
1
- import { Props, StoreProps, StoreConfiguration } from "../types";
1
+ import type { Props, StoreProps, StoreConfiguration } from "../types";
2
2
  export declare function allowNewStore<T>(fn: () => T): T;
3
3
  type CreateStoreProps<T extends Record<string, any>> = {
4
4
  [K in keyof T as undefined extends T[K] ? K : never]?: T[K] extends infer U ? U extends undefined ? never : undefined extends U ? U | undefined : U : never;
@@ -1,6 +1,6 @@
1
1
  import { PreactObjectAdministration as ObjectAdministration } from "../observables";
2
- import Store from "./Store";
3
- import { StoreConfiguration, Props } from "../types";
2
+ import type Store from "./Store";
3
+ import type { StoreConfiguration, Props } from "../types";
4
4
  export declare function updateProps(props: Props, newProps: Props): void;
5
5
  export declare function getStoreAdm(store: Store): StoreAdministration;
6
6
  export declare class StoreAdministration<StoreType extends Store = Store> extends ObjectAdministration<Store> {
@@ -25,6 +25,6 @@ export declare class StoreAdministration<StoreType extends Store = Store> extend
25
25
  getContextValue<T>(contextId: symbol, provideSymbol: symbol, defaultValue: T | undefined, hasDefault: boolean): T;
26
26
  private lookupContextValue;
27
27
  reaction<T>(track: () => T, callback: (a: T) => void): () => void;
28
- mount(parent?: StoreAdministration | null): void;
28
+ mount(parent?: StoreAdministration | null, childName?: PropertyKey): void;
29
29
  unmount(): void;
30
30
  }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import Store from "./store/Store";
2
- import Model from "./model/Model";
1
+ import type Store from "./store/Store";
2
+ import type Model from "./model/Model";
3
3
  export type StoreElement = {
4
4
  Type: new (...args: unknown[]) => Store;
5
5
  props: Props;
@@ -34,6 +34,8 @@ export declare enum CommonCfgTypes {
34
34
  }
35
35
  export declare enum ModelCfgTypes {
36
36
  state = "state",
37
+ stateShallow = "stateShallow",
38
+ stateSignal = "stateSignal",
37
39
  id = "id",
38
40
  modelRef = "modelRef"
39
41
  }
@@ -42,6 +44,8 @@ export declare enum StoreCfgTypes {
42
44
  }
43
45
  export declare enum ObservableCfgTypes {
44
46
  observable = "observable",
47
+ observableShallow = "observableShallow",
48
+ observableSignal = "observableSignal",
45
49
  computed = "computed"
46
50
  }
47
51
  export type ConfigurationTypes = CommonCfgTypes | ModelCfgTypes | StoreCfgTypes | ObservableCfgTypes;
@@ -70,11 +74,15 @@ export declare const childType: ((childType: Function) => ConfigurationType) & {
70
74
  type: CommonCfgTypes;
71
75
  };
72
76
  export declare const stateType: ConfigurationType;
77
+ export declare const stateShallowType: ConfigurationType;
78
+ export declare const stateSignalType: ConfigurationType;
73
79
  export declare const modelRefType: ((childType: Function) => ConfigurationType) & {
74
80
  type: ModelCfgTypes;
75
81
  };
76
82
  export declare const idType: ConfigurationType;
77
83
  export declare const modelType: ConfigurationType;
78
84
  export declare const observableType: ConfigurationType;
85
+ export declare const observableShallowType: ConfigurationType;
86
+ export declare const observableSignalType: ConfigurationType;
79
87
  export declare const computedType: ConfigurationType;
80
88
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ModelConfiguration } from "./types";
1
+ import type { ModelConfiguration } from "./types";
2
2
  export declare function getPropertyDescriptor(obj: object, key: PropertyKey): PropertyDescriptor | undefined;
3
3
  export declare function getParentConstructor(Ctor: Function | undefined): Function | undefined;
4
4
  export declare function clone<T>(val: T): T;
package/package.json CHANGED
@@ -1,59 +1,58 @@
1
1
  {
2
- "name": "r-state-tree",
3
- "version": "0.4.6",
4
- "description": "reactive state management library",
5
- "main": "dist/r-state-tree.cjs",
6
- "module": "dist/r-state-tree.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/r-state-tree.js",
12
- "require": "./dist/r-state-tree.cjs"
13
- }
14
- },
15
- "files": [
16
- "dist/*",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "scripts": {
21
- "test": "vitest run",
22
- "test:watch": "vitest",
23
- "test:cover": "vitest run --coverage",
24
- "build": "vite build && pnpm run build:types",
25
- "build:types": "tsc --emitDeclarationOnly",
26
- "lint": "eslint ./src ./tests --ext .ts",
27
- "format": "prettier --cache --write \"src/**/*.ts\" \"tests/**/*.ts\"",
28
- "prepublishOnly": "pnpm run build"
29
- },
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/melnikov-s/r-state-tree.git"
33
- },
34
- "author": "Sergey Melnikov",
35
- "license": "MIT",
36
- "bugs": {
37
- "url": "https://github.com/melnikov-s/r-state-tree/issues"
38
- },
39
- "homepage": "https://github.com/melnikov-s/r-state-tree#readme",
40
- "devDependencies": {
41
- "@tsmetadata/polyfill": "^1.1.3",
42
- "@typescript-eslint/eslint-plugin": "^5.8.1",
43
- "@typescript-eslint/parser": "^5.8.1",
44
- "eslint": "^8.5.0",
45
- "eslint-config-airbnb": "^19.0.4",
46
- "eslint-config-prettier": "^8.3.0",
47
- "eslint-import-resolver-typescript": "^2.5.0",
48
- "eslint-plugin-import": "^2.25.3",
49
- "eslint-plugin-prettier": "^4.0.0",
50
- "prettier": "^2.8.4",
51
- "tslib": "^2.5.0",
52
- "typescript": "5.9.3",
53
- "vite": "7.1.9",
54
- "vitest": "3.2.4"
55
- },
56
- "dependencies": {
57
- "@preact/signals-core": "^1.12.1"
58
- }
59
- }
2
+ "name": "r-state-tree",
3
+ "version": "0.5.0",
4
+ "description": "reactive state management library",
5
+ "main": "dist/r-state-tree.cjs",
6
+ "module": "dist/r-state-tree.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/r-state-tree.js",
12
+ "require": "./dist/r-state-tree.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist/*",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/melnikov-s/r-state-tree.git"
23
+ },
24
+ "author": "Sergey Melnikov",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/melnikov-s/r-state-tree/issues"
28
+ },
29
+ "homepage": "https://github.com/melnikov-s/r-state-tree#readme",
30
+ "devDependencies": {
31
+ "@tsmetadata/polyfill": "^1.1.3",
32
+ "@typescript-eslint/eslint-plugin": "^5.8.1",
33
+ "@typescript-eslint/parser": "^5.8.1",
34
+ "eslint": "^8.5.0",
35
+ "eslint-config-airbnb": "^19.0.4",
36
+ "eslint-config-prettier": "^8.3.0",
37
+ "eslint-import-resolver-typescript": "^2.5.0",
38
+ "eslint-plugin-import": "^2.25.3",
39
+ "eslint-plugin-prettier": "^4.0.0",
40
+ "prettier": "^2.8.4",
41
+ "tslib": "^2.5.0",
42
+ "typescript": "5.9.3",
43
+ "vite": "7.1.9",
44
+ "vitest": "3.2.4"
45
+ },
46
+ "dependencies": {
47
+ "@preact/signals-core": "^1.12.1"
48
+ },
49
+ "scripts": {
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:cover": "vitest run --coverage",
53
+ "build": "vite build && pnpm run build:types",
54
+ "build:types": "tsc --emitDeclarationOnly",
55
+ "lint": "eslint ./src ./tests --ext .ts",
56
+ "format": "prettier --cache --write \"src/**/*.ts\" \"tests/**/*.ts\""
57
+ }
58
+ }