atom.io 0.10.4 → 0.11.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.
@@ -28,4 +28,14 @@ declare function structFamily<Struct extends object, Key extends string>(options
28
28
  AtomIO.ReadonlySelectorFamily<Struct>
29
29
  ];
30
30
 
31
- export { dict, struct, structFamily };
31
+ type Loadable<T> = Promise<T> | T;
32
+ type Fated<T, E extends Error = Error> = Loadable<E | T>;
33
+ /**
34
+ * Utility for handling loadable values
35
+ * @param loadable Loadable value
36
+ * @param fallback Fallback value until Loadable is resolved
37
+ * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value
38
+ */
39
+ declare function until<T>(loadable: Loadable<T>, fallback: T): T;
40
+
41
+ export { type Fated, type Loadable, dict, struct, structFamily, until };
@@ -28,4 +28,14 @@ declare function structFamily<Struct extends object, Key extends string>(options
28
28
  AtomIO.ReadonlySelectorFamily<Struct>
29
29
  ];
30
30
 
31
- export { dict, struct, structFamily };
31
+ type Loadable<T> = Promise<T> | T;
32
+ type Fated<T, E extends Error = Error> = Loadable<E | T>;
33
+ /**
34
+ * Utility for handling loadable values
35
+ * @param loadable Loadable value
36
+ * @param fallback Fallback value until Loadable is resolved
37
+ * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value
38
+ */
39
+ declare function until<T>(loadable: Loadable<T>, fallback: T): T;
40
+
41
+ export { type Fated, type Loadable, dict, struct, structFamily, until };
@@ -71,8 +71,17 @@ function structFamily(options) {
71
71
  return [atoms, findStructState];
72
72
  }
73
73
 
74
+ // src/until.ts
75
+ function until(loadable, fallback) {
76
+ if (loadable instanceof Promise) {
77
+ return fallback;
78
+ }
79
+ return loadable;
80
+ }
81
+
74
82
  exports.dict = dict;
75
83
  exports.struct = struct;
76
84
  exports.structFamily = structFamily;
85
+ exports.until = until;
77
86
  //# sourceMappingURL=out.js.map
78
87
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dict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AC;AAC7D,iBAAO;AAAA,QACR,GAAG,CAAC,CAAQ;AAAA,MACb;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,SAAO,CAAC,OAAO,WAAW;AAC3B;;;AC1DA,SAAS,kBAAkB,4BAA4B;AAEvD,IAAMC,cAAa,CAAC,QAAgB,IAAI,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACtE,IAAM,aAAa,CAAC,QAAgB,WACnC,SAASA,YAAW,MAAM,IAAIA,YAAW,MAAM,IAAI;AAE7C,SAAS,aAGd,SAWA;AACD,QAAM,QAKF,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AACxD,UAAM,iBAAiB,WAAW,QAAQ,KAAK,MAAM;AACrD,QAAI,cAAc,IAAI,iBAAiB;AAAA,MACtC,KAAK,GAAG,QAAQ,GAAG,IAAI,MAAM;AAAA,MAC7B,SAAU,QAAQ,QAAgB,MAAM;AAAA,IACzC,CAAC;AACD,WAAO;AAAA,EACR,GAAG,CAAC,CAAQ;AACZ,QAAM,kBAAkB,qBAAqB;AAAA,IAC5C,KAAK,QAAQ;AAAA,IACb,KACC,CAAC,OACD,CAAC,EAAE,IAAI,MAAM;AACZ,aAAO,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AAC3D,YAAI,MAAM,IAAI,IAAK,MAAc,WAAW,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;AACrE,eAAO;AAAA,MACR,GAAG,CAAC,CAAQ;AAAA,IACb;AAAA,EACF,CAAC;AACD,SAAO,CAAC,OAAO,eAAe;AAC/B","sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, createSelector } from \"atom.io/internal\"\nimport type { Json, Stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Json.Serializable>(\n\tfindState:\n\t\t| AtomIO.AtomFamily<State, Key>\n\t\t| AtomIO.ReadonlySelectorFamily<State, Key>\n\t\t| AtomIO.SelectorFamily<State, Key>,\n\tindex:\n\t\t| AtomIO.AtomToken<Key[]>\n\t\t| AtomIO.ReadonlySelectorToken<Key[]>\n\t\t| AtomIO.SelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlySelectorToken<{ [K in Stringified<Key>]: State }> {\n\treturn createSelector(\n\t\t{\n\t\t\tkey: `${findState.key}Dict`,\n\t\t\tget: ({ get }) => {\n\t\t\t\tconst keys = get(index)\n\t\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(findState(key))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT } from \"atom.io/internal\"\n\nimport { createAtom, createSelector } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameAtom = (topKey: string, subKey: string) =>\n\ttopKey + capitalize(subKey) + `State`\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t},\n\tAtomIO.ReadonlySelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createAtom(\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstore,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createSelector(\n\t\t{\n\t\t\tkey: options.key,\n\t\t\tget: ({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport { createAtomFamily, createSelectorFamily } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t},\n\tAtomIO.ReadonlySelectorFamily<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget:\n\t\t\t(id) =>\n\t\t\t({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\tacc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n"]}
1
+ {"version":3,"sources":["../src/dict.ts","../src/struct.ts","../src/struct-family.ts","../src/until.ts"],"names":["IMPLICIT","createSelector","capitalize"],"mappings":";AAEA,SAAS,UAAU,sBAAsB;AAGlC,SAAS,KACf,WAIA,OAIA,QAAe,SAAS,OAC2C;AACnE,SAAO;AAAA,IACN;AAAA,MACC,KAAK,GAAG,UAAU,GAAG;AAAA,MACrB,KAAK,CAAC,EAAE,IAAI,MAAM;AACjB,cAAM,OAAO,IAAI,KAAK;AACtB,eAAO,KAAK,OAAO,CAAC,KAAK,QAAQ;AAChC,cAAI,GAAG,IAAI,IAAI,UAAU,GAAG,CAAC;AAC7B,iBAAO;AAAA,QACR,GAAG,CAAC,CAAQ;AAAA,MACb;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;;;AC5BA,SAAS,YAAAA,iBAAgB;AAEzB,SAAS,YAAY,kBAAAC,uBAAsB;AAE3C,IAAM,aAAa,CAAC,QAAgB,IAAI,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AAE/D,SAAS,OAIf,SAIA,QAAeD,UAAS,OASvB;AACD,QAAM,QAKF,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,QAAQ;AACrD,UAAM,WAAW,QAAQ,MAAM,WAAW,GAAG,IAAI;AACjD,QAAI,QAAQ,IAAI;AAAA,MACf;AAAA,QACC,KAAK,GAAG,QAAQ,GAAG,IAAI,GAAG;AAAA,QAC1B,SAAS,QAAQ,QAAQ,GAAG;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAC,CAAQ;AACZ,QAAM,cAAcC;AAAA,IACnB;AAAA,MACC,KAAK,QAAQ;AAAA,MACb,KAAK,CAAC,EAAE,IAAI,MAAM;AACj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,WAAO;AAAA,EACR;AACA,SAAO;AACR","sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, createSelector } from \"atom.io/internal\"\nimport type { Json, Stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Json.Serializable>(\n\tfindState:\n\t\t| AtomIO.AtomFamily<State, Key>\n\t\t| AtomIO.ReadonlySelectorFamily<State, Key>\n\t\t| AtomIO.SelectorFamily<State, Key>,\n\tindex:\n\t\t| AtomIO.AtomToken<Key[]>\n\t\t| AtomIO.ReadonlySelectorToken<Key[]>\n\t\t| AtomIO.SelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlySelectorToken<{ [K in Stringified<Key>]: State }> {\n\treturn createSelector(\n\t\t{\n\t\t\tkey: `${findState.key}Dict`,\n\t\t\tget: ({ get }) => {\n\t\t\t\tconst keys = get(index)\n\t\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(findState(key))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT } from \"atom.io/internal\"\n\nimport { createAtom, createSelector } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t},\n\tAtomIO.ReadonlySelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createAtom(\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstore,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createSelector(\n\t\t{\n\t\t\tkey: options.key,\n\t\t\tget: ({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport { createAtomFamily, createSelectorFamily } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t},\n\tAtomIO.ReadonlySelectorFamily<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget:\n\t\t\t(id) =>\n\t\t\t({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\tacc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n","export type Loadable<T> = Promise<T> | T\nexport type Fated<T, E extends Error = Error> = Loadable<E | T>\n\n/**\n * Utility for handling loadable values\n * @param loadable Loadable value\n * @param fallback Fallback value until Loadable is resolved\n * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value\n */\nexport function until<T>(loadable: Loadable<T>, fallback: T): T {\n\tif (loadable instanceof Promise) {\n\t\treturn fallback\n\t}\n\treturn loadable\n}\n"]}
@@ -69,6 +69,14 @@ function structFamily(options) {
69
69
  return [atoms, findStructState];
70
70
  }
71
71
 
72
- export { dict, struct, structFamily };
72
+ // src/until.ts
73
+ function until(loadable, fallback) {
74
+ if (loadable instanceof Promise) {
75
+ return fallback;
76
+ }
77
+ return loadable;
78
+ }
79
+
80
+ export { dict, struct, structFamily, until };
73
81
  //# sourceMappingURL=out.js.map
74
82
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dict.ts","../src/struct.ts","../src/struct-family.ts"],"names":["IMPLICIT","createSelector","capitalize"],"mappings":";AAEA,SAAS,UAAU,sBAAsB;AAGlC,SAAS,KACf,WAIA,OAIA,QAAe,SAAS,OAC2C;AACnE,SAAO;AAAA,IACN;AAAA,MACC,KAAK,GAAG,UAAU,GAAG;AAAA,MACrB,KAAK,CAAC,EAAE,IAAI,MAAM;AACjB,cAAM,OAAO,IAAI,KAAK;AACtB,eAAO,KAAK,OAAO,CAAC,KAAK,QAAQ;AAChC,cAAI,GAAG,IAAI,IAAI,UAAU,GAAG,CAAC;AAC7B,i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AKF,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AACxD,UAAM,iBAAiB,WAAW,QAAQ,KAAK,MAAM;AACrD,QAAI,cAAc,IAAI,iBAAiB;AAAA,MACtC,KAAK,GAAG,QAAQ,GAAG,IAAI,MAAM;AAAA,MAC7B,SAAU,QAAQ,QAAgB,MAAM;AAAA,IACzC,CAAC;AACD,WAAO;AAAA,EACR,GAAG,CAAC,CAAQ;AACZ,QAAM,kBAAkB,qBAAqB;AAAA,IAC5C,KAAK,QAAQ;AAAA,IACb,KACC,CAAC,OACD,CAAC,EAAE,IAAI,MAAM;AACZ,aAAO,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AAC3D,YAAI,MAAM,IAAI,IAAK,MAAc,WAAW,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;AACrE,eAAO;AAAA,MACR,GAAG,CAAC,CAAQ;AAAA,IACb;AAAA,EACF,CAAC;AACD,SAAO,CAAC,OAAO,eAAe;AAC/B","sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, createSelector } from \"atom.io/internal\"\nimport type { Json, Stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Json.Serializable>(\n\tfindState:\n\t\t| AtomIO.AtomFamily<State, Key>\n\t\t| AtomIO.ReadonlySelectorFamily<State, Key>\n\t\t| AtomIO.SelectorFamily<State, Key>,\n\tindex:\n\t\t| AtomIO.AtomToken<Key[]>\n\t\t| AtomIO.ReadonlySelectorToken<Key[]>\n\t\t| AtomIO.SelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlySelectorToken<{ [K in Stringified<Key>]: State }> {\n\treturn createSelector(\n\t\t{\n\t\t\tkey: `${findState.key}Dict`,\n\t\t\tget: ({ get }) => {\n\t\t\t\tconst keys = get(index)\n\t\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(findState(key))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT } from \"atom.io/internal\"\n\nimport { createAtom, createSelector } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameAtom = (topKey: string, subKey: string) =>\n\ttopKey + capitalize(subKey) + `State`\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t},\n\tAtomIO.ReadonlySelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createAtom(\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstore,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createSelector(\n\t\t{\n\t\t\tkey: options.key,\n\t\t\tget: ({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport { createAtomFamily, createSelectorFamily } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t},\n\tAtomIO.ReadonlySelectorFamily<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget:\n\t\t\t(id) =>\n\t\t\t({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\tacc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n"]}
1
+ {"version":3,"sources":["../src/dict.ts","../src/struct.ts","../src/struct-family.ts","../src/until.ts"],"names":["IMPLICIT","createSelector","capitalize"],"mappings":";AAEA,SAAS,UAAU,sBAAsB;AAGlC,SAAS,KACf,WAIA,OAIA,QAAe,SAAS,OAC2C;AACnE,SAAO;AAAA,IACN;AAAA,MACC,KAAK,GAAG,UAAU,GAAG;AAAA,MACrB,KAAK,CAAC,EAAE,I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AAI,IAAI,MAAM,CAAC;AACtE,IAAM,aAAa,CAAC,QAAgB,WACnC,SAASA,YAAW,MAAM,IAAIA,YAAW,MAAM,IAAI;AAE7C,SAAS,aAGd,SAWA;AACD,QAAM,QAKF,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AACxD,UAAM,iBAAiB,WAAW,QAAQ,KAAK,MAAM;AACrD,QAAI,cAAc,IAAI,iBAAiB;AAAA,MACtC,KAAK,GAAG,QAAQ,GAAG,IAAI,MAAM;AAAA,MAC7B,SAAU,QAAQ,QAAgB,MAAM;AAAA,IACzC,CAAC;AACD,WAAO;AAAA,EACR,GAAG,CAAC,CAAQ;AACZ,QAAM,kBAAkB,qBAAqB;AAAA,IAC5C,KAAK,QAAQ;AAAA,IACb,KACC,CAAC,OACD,CAAC,EAAE,IAAI,MAAM;AACZ,aAAO,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AAC3D,YAAI,MAAM,IAAI,IAAK,MAAc,WAAW,QAAQ,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC;AACrE,eAAO;AAAA,MACR,GAAG,CAAC,CAAQ;AAAA,IACb;AAAA,EACF,CAAC;AACD,SAAO,CAAC,OAAO,eAAe;AAC/B;;;ACtCO,SAAS,MAAS,UAAuB,UAAgB;AAC/D,MAAI,oBAAoB,SAAS;AAChC,WAAO;AAAA,EACR;AACA,SAAO;AACR","sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT, createSelector } from \"atom.io/internal\"\nimport type { Json, Stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Json.Serializable>(\n\tfindState:\n\t\t| AtomIO.AtomFamily<State, Key>\n\t\t| AtomIO.ReadonlySelectorFamily<State, Key>\n\t\t| AtomIO.SelectorFamily<State, Key>,\n\tindex:\n\t\t| AtomIO.AtomToken<Key[]>\n\t\t| AtomIO.ReadonlySelectorToken<Key[]>\n\t\t| AtomIO.SelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlySelectorToken<{ [K in Stringified<Key>]: State }> {\n\treturn createSelector(\n\t\t{\n\t\t\tkey: `${findState.key}Dict`,\n\t\t\tget: ({ get }) => {\n\t\t\t\tconst keys = get(index)\n\t\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(findState(key))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport { IMPLICIT } from \"atom.io/internal\"\n\nimport { createAtom, createSelector } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t},\n\tAtomIO.ReadonlySelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.AtomToken<\n\t\t\tStruct[K]\n\t\t>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createAtom(\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t\tstore,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createSelector(\n\t\t{\n\t\t\tkey: options.key,\n\t\t\tget: ({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t\t},\n\t\tundefined,\n\t\tstore,\n\t)\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport { createAtomFamily, createSelectorFamily } from \"atom.io/internal\"\n\nconst capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t},\n\tAtomIO.ReadonlySelectorFamily<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in\n\t\t\tkeyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\t\tK & string\n\t\t\t>}State`]: AtomIO.AtomFamily<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget:\n\t\t\t(id) =>\n\t\t\t({ get }) => {\n\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\tacc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))\n\t\t\t\t\treturn acc\n\t\t\t\t}, {} as any)\n\t\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n","export type Loadable<T> = Promise<T> | T\nexport type Fated<T, E extends Error = Error> = Loadable<E | T>\n\n/**\n * Utility for handling loadable values\n * @param loadable Loadable value\n * @param fallback Fallback value until Loadable is resolved\n * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value\n */\nexport function until<T>(loadable: Loadable<T>, fallback: T): T {\n\tif (loadable instanceof Promise) {\n\t\treturn fallback\n\t}\n\treturn loadable\n}\n"]}
package/data/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./dict"
2
2
  export * from "./struct"
3
3
  export * from "./struct-family"
4
+ export * from "./until"
@@ -5,8 +5,6 @@ import { IMPLICIT } from "atom.io/internal"
5
5
  import { createAtom, createSelector } from "atom.io/internal"
6
6
 
7
7
  const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)
8
- const nameAtom = (topKey: string, subKey: string) =>
9
- topKey + capitalize(subKey) + `State`
10
8
 
11
9
  export function struct<
12
10
  Struct extends { [key: string]: unknown },
@@ -0,0 +1,15 @@
1
+ export type Loadable<T> = Promise<T> | T
2
+ export type Fated<T, E extends Error = Error> = Loadable<E | T>
3
+
4
+ /**
5
+ * Utility for handling loadable values
6
+ * @param loadable Loadable value
7
+ * @param fallback Fallback value until Loadable is resolved
8
+ * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value
9
+ */
10
+ export function until<T>(loadable: Loadable<T>, fallback: T): T {
11
+ if (loadable instanceof Promise) {
12
+ return fallback
13
+ }
14
+ return loadable
15
+ }
@@ -358,8 +358,6 @@ declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(op
358
358
  declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store?: Store): SelectorFamily<T, K>;
359
359
  declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store?: Store): ReadonlySelectorFamily<T, K>;
360
360
 
361
- type Loadable<T> = Promise<T> | T;
362
- type Fated<T, E extends Error = Error> = Loadable<E | T>;
363
361
  /**
364
362
  * A Promise that can be canceled.
365
363
  * @internal
@@ -384,4 +382,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
384
382
 
385
383
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
386
384
 
387
- export { type Atom, type AtomKey, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
385
+ export { type Atom, type AtomKey, FamilyTracker, Future, IMPLICIT, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
@@ -358,8 +358,6 @@ declare function createReadonlySelectorFamily<T, K extends Json.Serializable>(op
358
358
  declare function createSelectorFamily<T, K extends Json.Serializable>(options: SelectorFamilyOptions<T, K>, store?: Store): SelectorFamily<T, K>;
359
359
  declare function createSelectorFamily<T, K extends Json.Serializable>(options: ReadonlySelectorFamilyOptions<T, K>, store?: Store): ReadonlySelectorFamily<T, K>;
360
360
 
361
- type Loadable<T> = Promise<T> | T;
362
- type Fated<T, E extends Error = Error> = Loadable<E | T>;
363
361
  /**
364
362
  * A Promise that can be canceled.
365
363
  * @internal
@@ -384,4 +382,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
384
382
 
385
383
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
386
384
 
387
- export { type Atom, type AtomKey, FamilyTracker, type Fated, Future, IMPLICIT, type Loadable, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };
385
+ export { type Atom, type AtomKey, FamilyTracker, Future, IMPLICIT, type Modify, type MutableAtom, type OperationProgress, type ReadonlySelector, type ReadonlySelectorKey, type Selector, type SelectorKey, type Signal, type StateKey, Store, type StoreCore, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionIdle, type TransactionPhase, type TransactionStatus, type TransactionUpdateInProgress, type Transceiver, type TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getSelectorDependencyKeys, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomKey, isAtomMutable, isAtomTokenMutable, isDone, isReadonlySelectorKey, isSelectorDefault, isSelectorKey, isStateKey, isTransceiver, isValueCached, markAtomAsDefault, markAtomAsNotDefault, markDone, openOperation, readCachedValue, redoTransactionUpdate, redo__INTERNAL, registerSelector, setState__INTERNAL, subscribeToRootAtoms, target, timeline__INTERNAL, traceAllSelectorAtoms, traceSelectorAtoms, transaction__INTERNAL, undoTransactionUpdate, undo__INTERNAL, updateSelectorAtoms, withdraw, withdrawNewFamilyMember };