atom.io 0.6.0 → 0.6.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 (38) hide show
  1. package/dist/index.d.mts +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/src/timeline.ts +1 -1
  7. package/json/dist/index.d.mts +0 -18
  8. package/json/dist/index.d.ts +0 -18
  9. package/json/dist/index.js +0 -51
  10. package/json/dist/index.js.map +0 -1
  11. package/json/dist/index.mjs +0 -15
  12. package/json/dist/index.mjs.map +0 -1
  13. package/react/dist/index.d.mts +0 -24
  14. package/react/dist/index.d.ts +0 -24
  15. package/react/dist/index.js +0 -83
  16. package/react/dist/index.js.map +0 -1
  17. package/react/dist/index.mjs +0 -41
  18. package/react/dist/index.mjs.map +0 -1
  19. package/react-devtools/dist/index.css +0 -26
  20. package/react-devtools/dist/index.css.map +0 -1
  21. package/react-devtools/dist/index.d.mts +0 -15
  22. package/react-devtools/dist/index.d.ts +0 -15
  23. package/react-devtools/dist/index.js +0 -1582
  24. package/react-devtools/dist/index.js.map +0 -1
  25. package/react-devtools/dist/index.mjs +0 -1554
  26. package/react-devtools/dist/index.mjs.map +0 -1
  27. package/realtime/dist/index.d.mts +0 -27
  28. package/realtime/dist/index.d.ts +0 -27
  29. package/realtime/dist/index.js +0 -191
  30. package/realtime/dist/index.js.map +0 -1
  31. package/realtime/dist/index.mjs +0 -152
  32. package/realtime/dist/index.mjs.map +0 -1
  33. package/realtime-react/dist/index.d.mts +0 -45
  34. package/realtime-react/dist/index.d.ts +0 -45
  35. package/realtime-react/dist/index.js +0 -213
  36. package/realtime-react/dist/index.js.map +0 -1
  37. package/realtime-react/dist/index.mjs +0 -168
  38. package/realtime-react/dist/index.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atom.io",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Reactive state graph for React, Preact, and vanilla",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/timeline.ts CHANGED
@@ -14,7 +14,7 @@ export type TimelineToken = {
14
14
 
15
15
  export type TimelineOptions = {
16
16
  key: string
17
- atoms: (AtomFamily<any> | AtomToken<any>)[]
17
+ atoms: (AtomFamily<any, any> | AtomToken<any>)[]
18
18
  }
19
19
 
20
20
  export type TimelineUpdate =
@@ -1,18 +0,0 @@
1
- import * as AtomIO from 'atom.io';
2
-
3
- type JsonInterface<T, J extends Json = Json> = {
4
- toJson: (t: T) => J;
5
- fromJson: (json: J) => T;
6
- };
7
-
8
- type Primitive = boolean | number | string | null;
9
- type Serializable = Primitive | Readonly<{
10
- [key: string]: Serializable;
11
- }> | ReadonlyArray<Serializable>;
12
- type JsonObj<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
13
- type JsonArr<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
14
- type Json = JsonArr | JsonObj | Primitive;
15
-
16
- declare const selectJson: <T, J extends Json>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: AtomIO.Store) => AtomIO.SelectorToken<J>;
17
-
18
- export { selectJson };
@@ -1,18 +0,0 @@
1
- import * as AtomIO from 'atom.io';
2
-
3
- type JsonInterface<T, J extends Json = Json> = {
4
- toJson: (t: T) => J;
5
- fromJson: (json: J) => T;
6
- };
7
-
8
- type Primitive = boolean | number | string | null;
9
- type Serializable = Primitive | Readonly<{
10
- [key: string]: Serializable;
11
- }> | ReadonlyArray<Serializable>;
12
- type JsonObj<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
13
- type JsonArr<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
14
- type Json = JsonArr | JsonObj | Primitive;
15
-
16
- declare const selectJson: <T, J extends Json>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: AtomIO.Store) => AtomIO.SelectorToken<J>;
17
-
18
- export { selectJson };
@@ -1,51 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // ../src/json/index.ts
30
- var json_exports = {};
31
- __export(json_exports, {
32
- selectJson: () => selectJson
33
- });
34
- module.exports = __toCommonJS(json_exports);
35
-
36
- // ../src/json/select-json.ts
37
- var AtomIO = __toESM(require("atom.io"));
38
- var selectJson = (atom, transform, store = AtomIO.__INTERNAL__.IMPLICIT.STORE) => AtomIO.__INTERNAL__.selector__INTERNAL(
39
- {
40
- key: `${atom.key}JSON`,
41
- get: ({ get }) => transform.toJson(get(atom)),
42
- set: ({ set }, newValue) => set(atom, transform.fromJson(newValue))
43
- },
44
- void 0,
45
- store
46
- );
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- selectJson
50
- });
51
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/json/index.ts","../../src/json/select-json.ts"],"sourcesContent":["export * from \"./select-json\"\n","import * as AtomIO from \"atom.io\"\n\nimport type { Json, JsonInterface } from \"~/packages/anvl/src/json\"\n\nexport const selectJson = <T, J extends Json>(\n atom: AtomIO.AtomToken<T>,\n transform: JsonInterface<T, J>,\n store: AtomIO.Store = AtomIO.__INTERNAL__.IMPLICIT.STORE\n): AtomIO.SelectorToken<J> =>\n AtomIO.__INTERNAL__.selector__INTERNAL(\n {\n key: `${atom.key}JSON`,\n get: ({ get }) => transform.toJson(get(atom)),\n set: ({ set }, newValue) => set(atom, transform.fromJson(newValue)),\n },\n undefined,\n store\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,aAAwB;AAIjB,IAAM,aAAa,CACxB,MACA,WACA,QAA6B,oBAAa,SAAS,UAE5C,oBAAa;AAAA,EAClB;AAAA,IACE,KAAK,GAAG,KAAK,GAAG;AAAA,IAChB,KAAK,CAAC,EAAE,IAAI,MAAM,UAAU,OAAO,IAAI,IAAI,CAAC;AAAA,IAC5C,KAAK,CAAC,EAAE,IAAI,GAAG,aAAa,IAAI,MAAM,UAAU,SAAS,QAAQ,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,15 +0,0 @@
1
- // ../src/json/select-json.ts
2
- import * as AtomIO from "atom.io";
3
- var selectJson = (atom, transform, store = AtomIO.__INTERNAL__.IMPLICIT.STORE) => AtomIO.__INTERNAL__.selector__INTERNAL(
4
- {
5
- key: `${atom.key}JSON`,
6
- get: ({ get }) => transform.toJson(get(atom)),
7
- set: ({ set }, newValue) => set(atom, transform.fromJson(newValue))
8
- },
9
- void 0,
10
- store
11
- );
12
- export {
13
- selectJson
14
- };
15
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/json/select-json.ts"],"sourcesContent":["import * as AtomIO from \"atom.io\"\n\nimport type { Json, JsonInterface } from \"~/packages/anvl/src/json\"\n\nexport const selectJson = <T, J extends Json>(\n atom: AtomIO.AtomToken<T>,\n transform: JsonInterface<T, J>,\n store: AtomIO.Store = AtomIO.__INTERNAL__.IMPLICIT.STORE\n): AtomIO.SelectorToken<J> =>\n AtomIO.__INTERNAL__.selector__INTERNAL(\n {\n key: `${atom.key}JSON`,\n get: ({ get }) => transform.toJson(get(atom)),\n set: ({ set }, newValue) => set(atom, transform.fromJson(newValue)),\n },\n undefined,\n store\n )\n"],"mappings":";AAAA,YAAY,YAAY;AAIjB,IAAM,aAAa,CACxB,MACA,WACA,QAA6B,oBAAa,SAAS,UAE5C,oBAAa;AAAA,EAClB;AAAA,IACE,KAAK,GAAG,KAAK,GAAG;AAAA,IAChB,KAAK,CAAC,EAAE,IAAI,MAAM,UAAU,OAAO,IAAI,IAAI,CAAC;AAAA,IAC5C,KAAK,CAAC,EAAE,IAAI,GAAG,aAAa,IAAI,MAAM,UAAU,SAAS,QAAQ,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import * as AtomIO from 'atom.io';
3
-
4
- declare const StoreContext: React.Context<AtomIO.__INTERNAL__.Store>;
5
- declare const StoreProvider: React.FC<{
6
- children: React.ReactNode;
7
- store?: AtomIO.Store;
8
- }>;
9
-
10
- type Modifier<T> = (thing: T) => T;
11
-
12
- type StoreHooks = {
13
- useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void;
14
- useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T;
15
- useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void];
16
- };
17
- declare const storeHooks: StoreHooks;
18
- declare function useI<T>(token: AtomIO.StateToken<T>): (next: Modifier<T> | T) => void;
19
- declare function useO<T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>): T;
20
- declare function useIO<T>(token: AtomIO.StateToken<T>): [T, (next: Modifier<T> | T) => void];
21
- declare function useStore<T>(token: AtomIO.StateToken<T>): [T, (next: Modifier<T> | T) => void];
22
- declare function useStore<T>(token: AtomIO.ReadonlySelectorToken<T>): T;
23
-
24
- export { StoreContext, StoreHooks, StoreProvider, storeHooks, useI, useIO, useO, useStore };
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import * as AtomIO from 'atom.io';
3
-
4
- declare const StoreContext: React.Context<AtomIO.__INTERNAL__.Store>;
5
- declare const StoreProvider: React.FC<{
6
- children: React.ReactNode;
7
- store?: AtomIO.Store;
8
- }>;
9
-
10
- type Modifier<T> = (thing: T) => T;
11
-
12
- type StoreHooks = {
13
- useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void;
14
- useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T;
15
- useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void];
16
- };
17
- declare const storeHooks: StoreHooks;
18
- declare function useI<T>(token: AtomIO.StateToken<T>): (next: Modifier<T> | T) => void;
19
- declare function useO<T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>): T;
20
- declare function useIO<T>(token: AtomIO.StateToken<T>): [T, (next: Modifier<T> | T) => void];
21
- declare function useStore<T>(token: AtomIO.StateToken<T>): [T, (next: Modifier<T> | T) => void];
22
- declare function useStore<T>(token: AtomIO.ReadonlySelectorToken<T>): T;
23
-
24
- export { StoreContext, StoreHooks, StoreProvider, storeHooks, useI, useIO, useO, useStore };
@@ -1,83 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // ../src/react/index.ts
30
- var react_exports = {};
31
- __export(react_exports, {
32
- StoreContext: () => StoreContext,
33
- StoreProvider: () => StoreProvider,
34
- storeHooks: () => storeHooks,
35
- useI: () => useI,
36
- useIO: () => useIO,
37
- useO: () => useO,
38
- useStore: () => useStore
39
- });
40
- module.exports = __toCommonJS(react_exports);
41
-
42
- // ../src/react/store-context.tsx
43
- var React = __toESM(require("react"));
44
- var AtomIO = __toESM(require("atom.io"));
45
- var import_jsx_runtime = require("@emotion/react/jsx-runtime");
46
- var StoreContext = React.createContext(
47
- AtomIO.__INTERNAL__.IMPLICIT.STORE
48
- );
49
- var StoreProvider = ({ children, store = AtomIO.__INTERNAL__.IMPLICIT.STORE }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StoreContext.Provider, { value: store, children });
50
-
51
- // ../src/react/store-hooks.ts
52
- var React2 = __toESM(require("react"));
53
- var AtomIO2 = __toESM(require("atom.io"));
54
- var storeHooks = { useI, useO, useIO };
55
- function useI(token) {
56
- const store = React2.useContext(StoreContext);
57
- const update = (next) => AtomIO2.setState(token, next, store);
58
- return update;
59
- }
60
- function useO(token) {
61
- const store = React2.useContext(StoreContext);
62
- return React2.useSyncExternalStore(
63
- (observe) => AtomIO2.subscribe(token, observe, store),
64
- () => AtomIO2.getState(token, store)
65
- );
66
- }
67
- function useIO(token) {
68
- return [useO(token), useI(token)];
69
- }
70
- function useStore(token) {
71
- return token.type === `readonly_selector` ? useO(token) : useIO(token);
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- StoreContext,
76
- StoreProvider,
77
- storeHooks,
78
- useI,
79
- useIO,
80
- useO,
81
- useStore
82
- });
83
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/index.ts","../../src/react/store-context.tsx","../../src/react/store-hooks.ts"],"sourcesContent":["export * from \"./store-context\"\nexport * from \"./store-hooks\"\n","import * as React from \"react\"\n\nimport * as AtomIO from \"atom.io\"\n\nexport const StoreContext = React.createContext<AtomIO.Store>(\n AtomIO.__INTERNAL__.IMPLICIT.STORE\n)\n\nexport const StoreProvider: React.FC<{\n children: React.ReactNode\n store?: AtomIO.Store\n}> = ({ children, store = AtomIO.__INTERNAL__.IMPLICIT.STORE }) => (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n)\n","import * as React from \"react\"\n\nimport * as AtomIO from \"atom.io\"\n\nimport type { Modifier } from \"~/packages/anvl/src/function\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport type StoreHooks = {\n useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void\n useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T\n useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void]\n}\nexport const storeHooks: StoreHooks = { useI, useO, useIO }\n\nexport function useI<T>(\n token: AtomIO.StateToken<T>\n): (next: Modifier<T> | T) => void {\n const store = React.useContext(StoreContext)\n const update = (next: Modifier<T> | T) => AtomIO.setState(token, next, store)\n return update\n}\n\nexport function useO<T>(\n token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>\n): T {\n const store = React.useContext(StoreContext)\n return React.useSyncExternalStore<T>(\n (observe) => AtomIO.subscribe(token, observe, store),\n () => AtomIO.getState(token, store)\n )\n}\n\nexport function useIO<T>(\n token: AtomIO.StateToken<T>\n): [T, (next: Modifier<T> | T) => void] {\n return [useO(token), useI(token)]\n}\n\nexport function useStore<T>(\n token: AtomIO.StateToken<T>\n): [T, (next: Modifier<T> | T) => void]\nexport function useStore<T>(token: AtomIO.ReadonlySelectorToken<T>): T\nexport function useStore<T>(\n token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>\n): T | [T, (next: Modifier<T> | T) => void] {\n return token.type === `readonly_selector` ? useO(token) : useIO(token)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAEvB,aAAwB;AAUtB;AARK,IAAM,eAAqB;AAAA,EACzB,oBAAa,SAAS;AAC/B;AAEO,IAAM,gBAGR,CAAC,EAAE,UAAU,QAAe,oBAAa,SAAS,MAAM,MAC3D,4CAAC,aAAa,UAAb,EAAsB,OAAO,OAAQ,UAAS;;;ACZjD,IAAAA,SAAuB;AAEvB,IAAAC,UAAwB;AAWjB,IAAM,aAAyB,EAAE,MAAM,MAAM,MAAM;AAEnD,SAAS,KACd,OACiC;AACjC,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,SAAS,CAAC,SAAiC,iBAAS,OAAO,MAAM,KAAK;AAC5E,SAAO;AACT;AAEO,SAAS,KACd,OACG;AACH,QAAM,QAAc,kBAAW,YAAY;AAC3C,SAAa;AAAA,IACX,CAAC,YAAmB,kBAAU,OAAO,SAAS,KAAK;AAAA,IACnD,MAAa,iBAAS,OAAO,KAAK;AAAA,EACpC;AACF;AAEO,SAAS,MACd,OACsC;AACtC,SAAO,CAAC,KAAK,KAAK,GAAG,KAAK,KAAK,CAAC;AAClC;AAMO,SAAS,SACd,OAC0C;AAC1C,SAAO,MAAM,SAAS,sBAAsB,KAAK,KAAK,IAAI,MAAM,KAAK;AACvE;","names":["React","AtomIO"]}
@@ -1,41 +0,0 @@
1
- // ../src/react/store-context.tsx
2
- import * as React from "react";
3
- import * as AtomIO from "atom.io";
4
- import { jsx } from "@emotion/react/jsx-runtime";
5
- var StoreContext = React.createContext(
6
- AtomIO.__INTERNAL__.IMPLICIT.STORE
7
- );
8
- var StoreProvider = ({ children, store = AtomIO.__INTERNAL__.IMPLICIT.STORE }) => /* @__PURE__ */ jsx(StoreContext.Provider, { value: store, children });
9
-
10
- // ../src/react/store-hooks.ts
11
- import * as React2 from "react";
12
- import * as AtomIO2 from "atom.io";
13
- var storeHooks = { useI, useO, useIO };
14
- function useI(token) {
15
- const store = React2.useContext(StoreContext);
16
- const update = (next) => AtomIO2.setState(token, next, store);
17
- return update;
18
- }
19
- function useO(token) {
20
- const store = React2.useContext(StoreContext);
21
- return React2.useSyncExternalStore(
22
- (observe) => AtomIO2.subscribe(token, observe, store),
23
- () => AtomIO2.getState(token, store)
24
- );
25
- }
26
- function useIO(token) {
27
- return [useO(token), useI(token)];
28
- }
29
- function useStore(token) {
30
- return token.type === `readonly_selector` ? useO(token) : useIO(token);
31
- }
32
- export {
33
- StoreContext,
34
- StoreProvider,
35
- storeHooks,
36
- useI,
37
- useIO,
38
- useO,
39
- useStore
40
- };
41
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react/store-context.tsx","../../src/react/store-hooks.ts"],"sourcesContent":["import * as React from \"react\"\n\nimport * as AtomIO from \"atom.io\"\n\nexport const StoreContext = React.createContext<AtomIO.Store>(\n AtomIO.__INTERNAL__.IMPLICIT.STORE\n)\n\nexport const StoreProvider: React.FC<{\n children: React.ReactNode\n store?: AtomIO.Store\n}> = ({ children, store = AtomIO.__INTERNAL__.IMPLICIT.STORE }) => (\n <StoreContext.Provider value={store}>{children}</StoreContext.Provider>\n)\n","import * as React from \"react\"\n\nimport * as AtomIO from \"atom.io\"\n\nimport type { Modifier } from \"~/packages/anvl/src/function\"\n\nimport { StoreContext } from \"./store-context\"\n\nexport type StoreHooks = {\n useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void\n useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T\n useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void]\n}\nexport const storeHooks: StoreHooks = { useI, useO, useIO }\n\nexport function useI<T>(\n token: AtomIO.StateToken<T>\n): (next: Modifier<T> | T) => void {\n const store = React.useContext(StoreContext)\n const update = (next: Modifier<T> | T) => AtomIO.setState(token, next, store)\n return update\n}\n\nexport function useO<T>(\n token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>\n): T {\n const store = React.useContext(StoreContext)\n return React.useSyncExternalStore<T>(\n (observe) => AtomIO.subscribe(token, observe, store),\n () => AtomIO.getState(token, store)\n )\n}\n\nexport function useIO<T>(\n token: AtomIO.StateToken<T>\n): [T, (next: Modifier<T> | T) => void] {\n return [useO(token), useI(token)]\n}\n\nexport function useStore<T>(\n token: AtomIO.StateToken<T>\n): [T, (next: Modifier<T> | T) => void]\nexport function useStore<T>(token: AtomIO.ReadonlySelectorToken<T>): T\nexport function useStore<T>(\n token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>\n): T | [T, (next: Modifier<T> | T) => void] {\n return token.type === `readonly_selector` ? useO(token) : useIO(token)\n}\n"],"mappings":";AAAA,YAAY,WAAW;AAEvB,YAAY,YAAY;AAUtB;AARK,IAAM,eAAqB;AAAA,EACzB,oBAAa,SAAS;AAC/B;AAEO,IAAM,gBAGR,CAAC,EAAE,UAAU,QAAe,oBAAa,SAAS,MAAM,MAC3D,oBAAC,aAAa,UAAb,EAAsB,OAAO,OAAQ,UAAS;;;ACZjD,YAAYA,YAAW;AAEvB,YAAYC,aAAY;AAWjB,IAAM,aAAyB,EAAE,MAAM,MAAM,MAAM;AAEnD,SAAS,KACd,OACiC;AACjC,QAAM,QAAc,kBAAW,YAAY;AAC3C,QAAM,SAAS,CAAC,SAAiC,iBAAS,OAAO,MAAM,KAAK;AAC5E,SAAO;AACT;AAEO,SAAS,KACd,OACG;AACH,QAAM,QAAc,kBAAW,YAAY;AAC3C,SAAa;AAAA,IACX,CAAC,YAAmB,kBAAU,OAAO,SAAS,KAAK;AAAA,IACnD,MAAa,iBAAS,OAAO,KAAK;AAAA,EACpC;AACF;AAEO,SAAS,MACd,OACsC;AACtC,SAAO,CAAC,KAAK,KAAK,GAAG,KAAK,KAAK,CAAC;AAClC;AAMO,SAAS,SACd,OAC0C;AAC1C,SAAO,MAAM,SAAS,sBAAsB,KAAK,KAAK,IAAI,MAAM,KAAK;AACvE;","names":["React","AtomIO"]}
@@ -1,26 +0,0 @@
1
- /* ../src/react-devtools/devtools.scss */
2
- main.atom_io_devtools {
3
- --fg-color: #eee;
4
- --bg-color: #111;
5
- @media (prefers-color-scheme: light) {
6
- --fg-color: #222;
7
- --bg-color: #ccc;
8
- }
9
- box-sizing: border-box;
10
- color: var(--fg-color);
11
- background-color: var(--bg-color);
12
- border: 2px solid var(--fg-color);
13
- position: fixed;
14
- right: 0;
15
- bottom: 0;
16
- height: 100%;
17
- display: flex;
18
- flex-flow: column;
19
- max-height: 800px;
20
- width: 100%;
21
- max-width: 460px;
22
- overflow-y: scroll;
23
- padding: 5px;
24
- header { display: flex; justify-content: space-between; h1 { font-size: inherit; margin: 0; } } main { overflow-y: scroll; flex-grow: 1; section { margin-top: 30px; h2 { font-size: inherit; margin: 0; } .node { border: 1px solid var(--fg-color); padding: 5px; margin: 5px; overflow-x: scroll; } } } footer { display: flex; justify-content: flex-end; button { cursor: pointer; background: none; border: none; padding: none; position: absolute; right: 0; bottom: 0; } } .json_editor { input { font-size: 20px; font-family: theia; border: none; border-bottom: 1px solid; background: none; &:disabled { border: none; } } button { background: none; margin-left: auto; color: #777; border: none; font-family: theia; font-size: 14px; margin: none; padding: 4px; padding-bottom: 6px; cursor: pointer; &:hover { color: #333; background-color: #aaa; } } select { font-family: theia; font-size: 14px; background: none; border: none; color: #777; @media (prefers-color-scheme: light) { color: #999; } } .json_editor_unofficial { background-color: #777; button { color: #333; } } .json_editor_missing { background-color: #f055; } .json_editor_key { input { color: #999; @media (prefers-color-scheme: light) { color: #777; } } } .json_editor_object { border-left: 2px solid #333; padding-left: 20px; @media (prefers-color-scheme: light) { border-color: #ccc; } .json_editor_properties { > * { border-bottom: 2px solid #333; margin-bottom: 2px; } } } };
25
- }
26
- /*# sourceMappingURL=index.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/react-devtools/devtools.scss"],"sourcesContent":["main.atom_io_devtools {\n --fg-color: #eee;\n --bg-color: #111;\n @media (prefers-color-scheme: light) {\n --fg-color: #222;\n --bg-color: #ccc;\n }\n box-sizing: border-box;\n color: var(--fg-color);\n background-color: var(--bg-color);\n border: 2px solid var(--fg-color);\n position: fixed;\n right: 0;\n bottom: 0;\n height: 100%;\n display: flex;\n flex-flow: column;\n max-height: 800px;\n width: 100%;\n max-width: 460px;\n overflow-y: scroll;\n padding: 5px;\n header {\n display: flex;\n justify-content: space-between;\n h1 {\n font-size: inherit;\n margin: 0;\n }\n }\n main {\n overflow-y: scroll;\n flex-grow: 1;\n section {\n margin-top: 30px;\n h2 {\n font-size: inherit;\n margin: 0;\n }\n .node {\n border: 1px solid var(--fg-color);\n padding: 5px;\n margin: 5px;\n overflow-x: scroll;\n }\n }\n }\n footer {\n display: flex;\n justify-content: flex-end;\n button {\n cursor: pointer;\n background: none;\n border: none;\n padding: none;\n position: absolute;\n right: 0;\n bottom: 0;\n }\n }\n\n .json_editor {\n input {\n font-size: 20px;\n font-family: theia;\n border: none;\n border-bottom: 1px solid;\n background: none;\n &:disabled {\n border: none;\n }\n }\n button {\n background: none;\n margin-left: auto;\n color: #777;\n border: none;\n font-family: theia;\n font-size: 14px;\n margin: none;\n padding: 4px;\n padding-bottom: 6px;\n cursor: pointer;\n &:hover {\n color: #333;\n background-color: #aaa;\n }\n }\n select {\n font-family: theia;\n font-size: 14px;\n background: none;\n border: none;\n color: #777;\n @media (prefers-color-scheme: light) {\n color: #999;\n }\n }\n .json_editor_unofficial {\n background-color: #777;\n button {\n color: #333;\n }\n }\n .json_editor_missing {\n background-color: #f055;\n }\n .json_editor_key {\n input {\n color: #999;\n @media (prefers-color-scheme: light) {\n color: #777;\n }\n }\n }\n .json_editor_object {\n border-left: 2px solid #333;\n padding-left: 20px;\n @media (prefers-color-scheme: light) {\n border-color: #ccc;\n }\n .json_editor_properties {\n > * {\n border-bottom: 2px solid #333;\n margin-bottom: 2px;\n }\n }\n }\n }\n}\n"],"mappings":";AAAA;AACE;AACA;AACA;AACE;AACA;AAAA;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;","names":[]}
@@ -1,15 +0,0 @@
1
- import { FC } from 'react';
2
- import * as AtomIO from 'atom.io';
3
-
4
- type Modifier<T> = (thing: T) => T;
5
-
6
- type StoreHooks = {
7
- useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void;
8
- useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T;
9
- useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void];
10
- };
11
-
12
- declare const composeDevtools: (storeHooks: StoreHooks) => FC;
13
- declare const AtomIODevtools: FC;
14
-
15
- export { AtomIODevtools, composeDevtools };
@@ -1,15 +0,0 @@
1
- import { FC } from 'react';
2
- import * as AtomIO from 'atom.io';
3
-
4
- type Modifier<T> = (thing: T) => T;
5
-
6
- type StoreHooks = {
7
- useI: <T>(token: AtomIO.StateToken<T>) => (next: Modifier<T> | T) => void;
8
- useO: <T>(token: AtomIO.ReadonlySelectorToken<T> | AtomIO.StateToken<T>) => T;
9
- useIO: <T>(token: AtomIO.StateToken<T>) => [T, (next: Modifier<T> | T) => void];
10
- };
11
-
12
- declare const composeDevtools: (storeHooks: StoreHooks) => FC;
13
- declare const AtomIODevtools: FC;
14
-
15
- export { AtomIODevtools, composeDevtools };