atom.io 0.9.3 → 0.9.5

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.
@@ -49,20 +49,21 @@ function struct(options, store = internal.IMPLICIT.STORE) {
49
49
  return [atoms, structState];
50
50
  }
51
51
  var capitalize2 = (str) => str[0].toUpperCase() + str.slice(1);
52
+ var nameFamily = (topKey, subKey) => `find` + capitalize2(topKey) + capitalize2(subKey) + `State`;
52
53
  function structFamily(options) {
53
- const atoms = Object.keys(options.default).reduce((acc, key) => {
54
- const atomFamilyName = `find` + capitalize2(options.key) + capitalize2(key) + `State`;
54
+ const atoms = Object.keys(options.default).reduce((acc, subKey) => {
55
+ const atomFamilyName = nameFamily(options.key, subKey);
55
56
  acc[atomFamilyName] = internal.createAtomFamily({
56
- key: `${options.key}.${key}`,
57
- default: options.default[key]
57
+ key: `${options.key}.${subKey}`,
58
+ default: options.default[subKey]
58
59
  });
59
60
  return acc;
60
61
  }, {});
61
62
  const findStructState = internal.createSelectorFamily({
62
63
  key: options.key,
63
64
  get: (id) => ({ get }) => {
64
- return Object.keys(options.default).reduce((acc, key) => {
65
- acc[key] = get(atoms[key](id));
65
+ return Object.keys(options.default).reduce((acc, subKey) => {
66
+ acc[subKey] = get(atoms[nameFamily(options.key, subKey)](id));
66
67
  return acc;
67
68
  }, {});
68
69
  }
@@ -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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;AACrD,UAAM,iBACL,SAASA,YAAW,QAAQ,GAAG,IAAIA,YAAW,GAAG,IAAI;AACtD,QAAI,cAAc,IAAI,iBAAiB;AAAA,MACtC,KAAK,GAAG,QAAQ,GAAG,IAAI,GAAG;AAAA,MAC1B,SAAU,QAAQ,QAAgB,GAAG;AAAA,IACtC,CAAC;AACD,WAAO;AAAA,EACR,GAAG,CAAC,CAAQ;AACZ,QAAM,kBAAkB,qBAAqB;AAAA,IAC5C,KAAK,QAAQ;AAAA,IACb,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,MAAM;AACzB,aAAO,OAAO,KAAK,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,QAAQ;AACxD,YAAI,GAAG,IAAI,IAAK,MAAc,GAAG,EAAE,EAAE,CAAC;AACtC,eAAO;AAAA,MACR,GAAG,CAAC,CAAQ;AAAA,IACb;AAAA,EACD,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)\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)\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, key) => {\n\t\tconst atomFamilyName =\n\t\t\t`find` + capitalize(options.key) + capitalize(key) + `State`\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${key}`,\n\t\t\tdefault: (options.default as any)[key],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget: (id) => ({ get }) => {\n\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\tacc[key] = get((atoms as any)[key](id))\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n"]}
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,iBAAO;AAAA,QACR,GAAG,CAAC,CAAQ;AAAA,MACb;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,E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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"]}
@@ -47,20 +47,21 @@ function struct(options, store = IMPLICIT.STORE) {
47
47
  return [atoms, structState];
48
48
  }
49
49
  var capitalize2 = (str) => str[0].toUpperCase() + str.slice(1);
50
+ var nameFamily = (topKey, subKey) => `find` + capitalize2(topKey) + capitalize2(subKey) + `State`;
50
51
  function structFamily(options) {
51
- const atoms = Object.keys(options.default).reduce((acc, key) => {
52
- const atomFamilyName = `find` + capitalize2(options.key) + capitalize2(key) + `State`;
52
+ const atoms = Object.keys(options.default).reduce((acc, subKey) => {
53
+ const atomFamilyName = nameFamily(options.key, subKey);
53
54
  acc[atomFamilyName] = createAtomFamily({
54
- key: `${options.key}.${key}`,
55
- default: options.default[key]
55
+ key: `${options.key}.${subKey}`,
56
+ default: options.default[subKey]
56
57
  });
57
58
  return acc;
58
59
  }, {});
59
60
  const findStructState = createSelectorFamily({
60
61
  key: options.key,
61
62
  get: (id) => ({ get }) => {
62
- return Object.keys(options.default).reduce((acc, key) => {
63
- acc[key] = get(atoms[key](id));
63
+ return Object.keys(options.default).reduce((acc, subKey) => {
64
+ acc[subKey] = get(atoms[nameFamily(options.key, subKey)](id));
64
65
  return acc;
65
66
  }, {});
66
67
  }
@@ -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,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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AG,EAAE,EAAE,CAAC;AACtC,eAAO;AAAA,MACR,GAAG,CAAC,CAAQ;AAAA,IACb;AAAA,EACD,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)\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)\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, key) => {\n\t\tconst atomFamilyName =\n\t\t\t`find` + capitalize(options.key) + capitalize(key) + `State`\n\t\tacc[atomFamilyName] = createAtomFamily({\n\t\t\tkey: `${options.key}.${key}`,\n\t\t\tdefault: (options.default as any)[key],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState = createSelectorFamily({\n\t\tkey: options.key,\n\t\tget: (id) => ({ get }) => {\n\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\tacc[key] = get((atoms as any)[key](id))\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n\treturn [atoms, findStructState]\n}\n"]}
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,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;AAI/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,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AAO;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"]}
@@ -2,6 +2,8 @@ import type * as AtomIO from "atom.io"
2
2
  import { createAtomFamily, createSelectorFamily } from "atom.io/internal"
3
3
 
4
4
  const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1)
5
+ const nameFamily = (topKey: string, subKey: string) =>
6
+ `find` + capitalize(topKey) + capitalize(subKey) + `State`
5
7
 
6
8
  export function structFamily<
7
9
  Struct extends object,
@@ -23,23 +25,24 @@ export function structFamily<
23
25
  keyof Struct as `find${Capitalize<Key & string>}${Capitalize<
24
26
  K & string
25
27
  >}State`]: AtomIO.AtomFamily<Struct[K], string>
26
- } = Object.keys(options.default).reduce((acc, key) => {
27
- const atomFamilyName =
28
- `find` + capitalize(options.key) + capitalize(key) + `State`
28
+ } = Object.keys(options.default).reduce((acc, subKey) => {
29
+ const atomFamilyName = nameFamily(options.key, subKey)
29
30
  acc[atomFamilyName] = createAtomFamily({
30
- key: `${options.key}.${key}`,
31
- default: (options.default as any)[key],
31
+ key: `${options.key}.${subKey}`,
32
+ default: (options.default as any)[subKey],
32
33
  })
33
34
  return acc
34
35
  }, {} as any)
35
36
  const findStructState = createSelectorFamily({
36
37
  key: options.key,
37
- get: (id) => ({ get }) => {
38
- return Object.keys(options.default).reduce((acc, key) => {
39
- acc[key] = get((atoms as any)[key](id))
40
- return acc
41
- }, {} as any)
42
- },
38
+ get:
39
+ (id) =>
40
+ ({ get }) => {
41
+ return Object.keys(options.default).reduce((acc, subKey) => {
42
+ acc[subKey] = get((atoms as any)[nameFamily(options.key, subKey)](id))
43
+ return acc
44
+ }, {} as any)
45
+ },
43
46
  })
44
47
  return [atoms, findStructState]
45
48
  }
@@ -5,6 +5,8 @@ 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`
8
10
 
9
11
  export function struct<
10
12
  Struct extends { [key: string]: unknown },
@@ -321,6 +321,7 @@ declare const isSelectorDefault: (key: string, store?: Store) => boolean;
321
321
  declare const cacheValue: (key: string, value: unknown, subject: Subject<StateUpdate<unknown>>, store?: Store) => void;
322
322
  declare const readCachedValue: <T>(key: string, store?: Store) => T;
323
323
  declare const isValueCached: (key: string, store?: Store) => boolean;
324
+ declare const evictCachedValue: (key: string, store?: Store) => void;
324
325
 
325
326
  declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store?: Store): AtomFamily<T, K>;
326
327
 
@@ -355,4 +356,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
355
356
 
356
357
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
357
358
 
358
- export { Atom, FamilyTracker, Fated, Future, IMPLICIT, Loadable, Modify, MutableAtom, OperationProgress, ReadonlySelector, Selector, Signal, Store, StoreCore, Subject, TRANSACTION_PHASES, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate, Tracker, Transaction, TransactionIdle, TransactionPhase, TransactionStatus, TransactionUpdateInProgress, Transceiver, TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, 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 };
359
+ export { Atom, FamilyTracker, Fated, Future, IMPLICIT, Loadable, Modify, MutableAtom, OperationProgress, ReadonlySelector, Selector, Signal, Store, StoreCore, Subject, TRANSACTION_PHASES, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate, Tracker, Transaction, TransactionIdle, TransactionPhase, TransactionStatus, TransactionUpdateInProgress, Transceiver, TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, 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 };
@@ -321,6 +321,7 @@ declare const isSelectorDefault: (key: string, store?: Store) => boolean;
321
321
  declare const cacheValue: (key: string, value: unknown, subject: Subject<StateUpdate<unknown>>, store?: Store) => void;
322
322
  declare const readCachedValue: <T>(key: string, store?: Store) => T;
323
323
  declare const isValueCached: (key: string, store?: Store) => boolean;
324
+ declare const evictCachedValue: (key: string, store?: Store) => void;
324
325
 
325
326
  declare function createAtomFamily<T, K extends Json.Serializable>(options: AtomFamilyOptions<T, K>, store?: Store): AtomFamily<T, K>;
326
327
 
@@ -355,4 +356,4 @@ declare const setState__INTERNAL: <T>(state: Atom<T> | Selector<T>, value: T | (
355
356
 
356
357
  declare const subscribeToRootAtoms: <T>(state: ReadonlySelector<T> | Selector<T>, store: Store) => (() => void)[] | null;
357
358
 
358
- export { Atom, FamilyTracker, Fated, Future, IMPLICIT, Loadable, Modify, MutableAtom, OperationProgress, ReadonlySelector, Selector, Signal, Store, StoreCore, Subject, TRANSACTION_PHASES, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate, Tracker, Transaction, TransactionIdle, TransactionPhase, TransactionStatus, TransactionUpdateInProgress, Transceiver, TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, 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 };
359
+ export { Atom, FamilyTracker, Fated, Future, IMPLICIT, Loadable, Modify, MutableAtom, OperationProgress, ReadonlySelector, Selector, Signal, Store, StoreCore, Subject, TRANSACTION_PHASES, Timeline, TimelineAtomUpdate, TimelineSelectorUpdate, TimelineTransactionUpdate, Tracker, Transaction, TransactionIdle, TransactionPhase, TransactionStatus, TransactionUpdateInProgress, Transceiver, TransceiverMode, abortTransaction, addAtomToTimeline, applyTransaction, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtom, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelectorFamily, createSelector, createSelectorFamily, deleteAtom, deposit, evictCachedValue, getJsonToken, getState__INTERNAL, getUpdateToken, isAtomDefault, isAtomMutable, isAtomTokenMutable, isDone, isSelectorDefault, isTransceiver, isValueCached, lookup, lookupSelectorSources, 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 };
@@ -925,6 +925,16 @@ var cacheValue = (key, value, subject, store = IMPLICIT.STORE) => {
925
925
  };
926
926
  var readCachedValue = (key, store = IMPLICIT.STORE) => target(store).valueMap.get(key);
927
927
  var isValueCached = (key, store = IMPLICIT.STORE) => target(store).valueMap.has(key);
928
+ var evictCachedValue = (key, store = IMPLICIT.STORE) => {
929
+ var _a;
930
+ const core = target(store);
931
+ const currentValue = core.valueMap.get(key);
932
+ if (currentValue instanceof Future) {
933
+ currentValue.cancel();
934
+ }
935
+ core.valueMap.delete(key);
936
+ (_a = store.config.logger) == null ? void 0 : _a.info(` xx evicted "${key}"`);
937
+ };
928
938
  var Tracker = class {
929
939
  constructor(mutableState, store = IMPLICIT.STORE) {
930
940
  this.unsubscribeFromInnerValue = null;
@@ -1254,7 +1264,7 @@ var emitUpdate = (state, update, store) => {
1254
1264
 
1255
1265
  // src/set-state/evict-downstream.ts
1256
1266
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1257
- var _a, _b, _c, _d, _e, _f, _g;
1267
+ var _a, _b, _c, _d, _e, _f;
1258
1268
  const core = target(store);
1259
1269
  const downstreamKeys = core.selectorAtoms.getRelatedKeys(state.key);
1260
1270
  (_b = store.config.logger) == null ? void 0 : _b.info(
@@ -1277,8 +1287,7 @@ var evictDownStream = (state, store = IMPLICIT.STORE) => {
1277
1287
  );
1278
1288
  return;
1279
1289
  }
1280
- core.valueMap.delete(key);
1281
- (_g = store.config.logger) == null ? void 0 : _g.info(` xx evicted "${key}"`);
1290
+ evictCachedValue(key, store);
1282
1291
  markDone(key, store);
1283
1292
  }
1284
1293
  }
@@ -1848,6 +1857,7 @@ exports.createSelector = createSelector;
1848
1857
  exports.createSelectorFamily = createSelectorFamily;
1849
1858
  exports.deleteAtom = deleteAtom;
1850
1859
  exports.deposit = deposit;
1860
+ exports.evictCachedValue = evictCachedValue;
1851
1861
  exports.getJsonToken = getJsonToken;
1852
1862
  exports.getState__INTERNAL = getState__INTERNAL;
1853
1863
  exports.getUpdateToken = getUpdateToken;