valdres 0.2.0-pre.1 → 0.2.0-pre.3

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 (78) hide show
  1. package/dist/index.js +3 -6
  2. package/dist/types/{src/types → types}/Atom.d.ts +1 -0
  3. package/dist/types/{src/types → types}/AtomFamily.d.ts +1 -0
  4. package/dist/types/{src/types → types}/AtomOptions.d.ts +1 -0
  5. package/package.json +1 -1
  6. /package/dist/types/{src/atom.d.ts → atom.d.ts} +0 -0
  7. /package/dist/types/{src/atomFamily.d.ts → atomFamily.d.ts} +0 -0
  8. /package/dist/types/{src/createStoreWithSelectorSet.d.ts → createStoreWithSelectorSet.d.ts} +0 -0
  9. /package/dist/types/{src/errors → errors}/SelectorCircularDependencyError.d.ts +0 -0
  10. /package/dist/types/{src/errors → errors}/SelectorEvaluationError.d.ts +0 -0
  11. /package/dist/types/{src/errors → errors}/lib/generateSelectorTrace.d.ts +0 -0
  12. /package/dist/types/{src/globalStore.d.ts → globalStore.d.ts} +0 -0
  13. /package/dist/types/{src/index.d.ts → index.d.ts} +0 -0
  14. /package/dist/types/{src/indexConstructor.d.ts → indexConstructor.d.ts} +0 -0
  15. /package/dist/types/{src/lib → lib}/atomFamilyAtom.d.ts +0 -0
  16. /package/dist/types/{src/lib → lib}/createAtomFamily.d.ts +0 -0
  17. /package/dist/types/{src/lib → lib}/createGlobalAtomFamily.d.ts +0 -0
  18. /package/dist/types/{src/lib → lib}/createStoreData.d.ts +0 -0
  19. /package/dist/types/{src/lib → lib}/deleteFamilyAtom.d.ts +0 -0
  20. /package/dist/types/{src/lib → lib}/equal.d.ts +0 -0
  21. /package/dist/types/{src/lib → lib}/getState.d.ts +0 -0
  22. /package/dist/types/{src/lib → lib}/globalAtom.d.ts +0 -0
  23. /package/dist/types/{src/lib → lib}/initAtom.d.ts +0 -0
  24. /package/dist/types/{src/lib → lib}/initSelector.d.ts +0 -0
  25. /package/dist/types/{src/lib → lib}/isFunction.d.ts +0 -0
  26. /package/dist/types/{src/lib → lib}/isProd.d.ts +0 -0
  27. /package/dist/types/{src/lib → lib}/propagateUpdatedAtoms.d.ts +0 -0
  28. /package/dist/types/{src/lib → lib}/resetAtom.d.ts +0 -0
  29. /package/dist/types/{src/lib → lib}/setAtom.d.ts +0 -0
  30. /package/dist/types/{src/lib → lib}/setAtoms.d.ts +0 -0
  31. /package/dist/types/{src/lib → lib}/setValueInData.d.ts +0 -0
  32. /package/dist/types/{src/lib → lib}/stableStringify.d.ts +0 -0
  33. /package/dist/types/{src/lib → lib}/storeFromStoreData.d.ts +0 -0
  34. /package/dist/types/{src/lib → lib}/stringifyFamilyArgs.d.ts +0 -0
  35. /package/dist/types/{src/lib → lib}/subscribe.d.ts +0 -0
  36. /package/dist/types/{src/lib → lib}/transaction.d.ts +0 -0
  37. /package/dist/types/{src/lib → lib}/unsubscribe.d.ts +0 -0
  38. /package/dist/types/{src/selector.d.ts → selector.d.ts} +0 -0
  39. /package/dist/types/{src/selectorFamily.d.ts → selectorFamily.d.ts} +0 -0
  40. /package/dist/types/{src/store.d.ts → store.d.ts} +0 -0
  41. /package/dist/types/{src/types → types}/AtomDefaultValue.d.ts +0 -0
  42. /package/dist/types/{src/types → types}/AtomFamilyAtom.d.ts +0 -0
  43. /package/dist/types/{src/types → types}/AtomFamilyDefaultValue.d.ts +0 -0
  44. /package/dist/types/{src/types → types}/AtomFamilyGlobalAtom.d.ts +0 -0
  45. /package/dist/types/{src/types → types}/AtomFamilySelector.d.ts +0 -0
  46. /package/dist/types/{src/types → types}/AtomOnInit.d.ts +0 -0
  47. /package/dist/types/{src/types → types}/AtomOnSet.d.ts +0 -0
  48. /package/dist/types/{src/types → types}/EqualFunc.d.ts +0 -0
  49. /package/dist/types/{src/types → types}/Family.d.ts +0 -0
  50. /package/dist/types/{src/types → types}/FamilyKey.d.ts +0 -0
  51. /package/dist/types/{src/types → types}/GetValue.d.ts +0 -0
  52. /package/dist/types/{src/types → types}/GlobalAtom.d.ts +0 -0
  53. /package/dist/types/{src/types → types}/GlobalAtomGetSelfFunc.d.ts +0 -0
  54. /package/dist/types/{src/types → types}/GlobalAtomResetSelfFunc.d.ts +0 -0
  55. /package/dist/types/{src/types → types}/GlobalAtomSetSelfFunc.d.ts +0 -0
  56. /package/dist/types/{src/types → types}/ResetAtom.d.ts +0 -0
  57. /package/dist/types/{src/types → types}/Selector.d.ts +0 -0
  58. /package/dist/types/{src/types → types}/SelectorFamily.d.ts +0 -0
  59. /package/dist/types/{src/types → types}/SelectorOptions.d.ts +0 -0
  60. /package/dist/types/{src/types → types}/SetAtom.d.ts +0 -0
  61. /package/dist/types/{src/types → types}/SetAtomValue.d.ts +0 -0
  62. /package/dist/types/{src/types → types}/State.d.ts +0 -0
  63. /package/dist/types/{src/types → types}/Store.d.ts +0 -0
  64. /package/dist/types/{src/types → types}/StoreData.d.ts +0 -0
  65. /package/dist/types/{src/types → types}/SubscribeFn.d.ts +0 -0
  66. /package/dist/types/{src/types → types}/Subscription.d.ts +0 -0
  67. /package/dist/types/{src/types → types}/TransactionFn.d.ts +0 -0
  68. /package/dist/types/{src/types → types}/TransactionInterface.d.ts +0 -0
  69. /package/dist/types/{src/utils → utils}/deepFreeze.d.ts +0 -0
  70. /package/dist/types/{src/utils → utils}/isAtom.d.ts +0 -0
  71. /package/dist/types/{src/utils → utils}/isAtomFamily.d.ts +0 -0
  72. /package/dist/types/{src/utils → utils}/isFamily.d.ts +0 -0
  73. /package/dist/types/{src/utils → utils}/isFamilyAtom.d.ts +0 -0
  74. /package/dist/types/{src/utils → utils}/isFamilySelector.d.ts +0 -0
  75. /package/dist/types/{src/utils → utils}/isFamilyState.d.ts +0 -0
  76. /package/dist/types/{src/utils → utils}/isPromiseLike.d.ts +0 -0
  77. /package/dist/types/{src/utils → utils}/isSelector.d.ts +0 -0
  78. /package/dist/types/{src/utils → utils}/isSelectorFamily.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- // src/index.ts
2
- import { version } from "../package.json";
3
-
4
1
  // src/lib/equal.ts
5
2
  var hasElementType = typeof Element !== "undefined";
6
3
  var hasMap = typeof Map === "function";
@@ -190,7 +187,7 @@ var isProd = () => {
190
187
 
191
188
  // src/lib/setValueInData.ts
192
189
  var setValueInData = (atom, value, data) => {
193
- if (isProd()) {
190
+ if (atom.mutable || isProd()) {
194
191
  data.values.set(atom, value);
195
192
  return value;
196
193
  } else {
@@ -1329,9 +1326,9 @@ var isFamilySelector = (state) => isFamilyState(state) && isSelector(state);
1329
1326
 
1330
1327
  // src/index.ts
1331
1328
  if (globalThis.__valdres__) {
1332
- throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${version}`);
1329
+ throw new Error(`Error! An instance of valdres is already loaded. Loaded: ${globalThis.__valdres__}. Attempted to load: ${"0.2.0-pre.3"}`);
1333
1330
  } else {
1334
- globalThis.__valdres__ = version;
1331
+ globalThis.__valdres__ = "0.2.0-pre.3";
1335
1332
  }
1336
1333
  export {
1337
1334
  store,
@@ -10,5 +10,6 @@ export type Atom<Value = unknown> = {
10
10
  onSet?: AtomOnSet<Value>;
11
11
  onMount?: () => void | (() => void);
12
12
  maxAge?: number;
13
+ mutable?: boolean;
13
14
  staleWhileRevalidate?: number;
14
15
  };
@@ -5,5 +5,6 @@ export type AtomFamily<Value extends any, Args extends [any, ...any[]] = [any, .
5
5
  release: (...args: Args) => void;
6
6
  equal: EqualFunc<Value>;
7
7
  name?: string;
8
+ mutable?: boolean;
8
9
  __valdresAtomFamilyMap: Map<Value, AtomFamilyAtom<Value, Args>>;
9
10
  };
@@ -8,6 +8,7 @@ export type AtomOptions<Value = unknown> = {
8
8
  onSet?: AtomOnSet<Value>;
9
9
  onMount?: () => () => void;
10
10
  maxAge?: number;
11
+ mutable?: boolean;
11
12
  staleWhileRevalidate?: number;
12
13
  equal?: EqualFunc<Value>;
13
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valdres",
3
- "version": "0.2.0-pre.1",
3
+ "version": "0.2.0-pre.3",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Eigil Sagafos"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes