@flashist/appframework 0.0.224 → 0.0.226

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashist/appframework",
3
- "version": "0.0.224",
3
+ "version": "0.0.226",
4
4
  "scripts": {
5
5
  "build": "gulp",
6
6
  "publish:patch": "npm version patch && npm run build && cd ./dist && npm publish",
@@ -21,7 +21,7 @@ export class PagesView extends AppResizableContainer {
21
21
  // let tempPageClass = pagesModuleState.pageIdToViewClassMap[singlePageId];
22
22
  // this.viewStack.addViewClass(tempPageClass, singlePageId);
23
23
  // }
24
- const appState = appStorage().getState();
24
+ const appState = appStorage().getMutableState();
25
25
  let pageIds = Object.keys(appState.pages.pageIdToViewClassMap);
26
26
  for (let singlePageId of pageIds) {
27
27
  let tempPageClass = appState.pages.pageIdToViewClassMap[singlePageId];
@@ -1 +1 @@
1
- {"version":3,"file":"PagesView.js","sourceRoot":"","sources":["../../../src/pages/views/PagesView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,EAAE,mCAAmC,EAAE,MAAM,mEAAmE,CAAC;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,MAAM,OAAO,SAAU,SAAQ,qBAAqB;IAMtC,YAAY,CAAC,GAAG,IAAI;QAC1B,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAEzB,6CAA6C;QAE7C,IAAI,CAAC,SAAS,GAAG,IAAI,mCAAmC,EAAgB,CAAC;QACzE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9B,wEAAwE;QACxE,6DAA6D;QAC7D,6CAA6C;QAC7C,iFAAiF;QACjF,4EAA4E;QAC5E,qDAAqD;QAErD,8DAA8D;QAC9D,IAAI;QAEJ,oHAAoH;QACpH,8EAA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AAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAES,YAAY;QAClB,KAAK,CAAC,YAAY,EAAE,CAAC;QAErB,6CAA6C;QAC7C,uBAAuB;QACvB,sCAAsC;QACtC,0BAA0B;QAC1B,KAAK;QACL,gDAAgD;QAChD,cAAc;QAEd,QAAQ;QACR,IAAI;IACR,CAAC;IAED,qCAAqC;IACrC,8BAA8B;IAC9B,IAAI;IAEG,eAAe;QAClB,IAAI,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,EAAE,CAAC,QAAQ,EAAoB,CAAC,KAAK,CAAC,MAAM,CAAC;QAEnF,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAES,OAAO;QACb,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAE5D,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;YAC7B,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,EAAE;gBAC1C,UAAU,EAAE,CAAC,MAAM,EAAoB,CACnC,8BAA8B,EAC9B;oBACI,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;oBAC7C,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;iBAChD,CACJ,CAAC;aACL;SACJ;IACL,CAAC;CACJ"}
@@ -27,7 +27,7 @@ export declare class AppStateStorage extends BaseObjectWithGlobalDispatcher {
27
27
 
28
28
  * @returns
29
29
  */
30
- changePropertyWrapper<StateType extends object>(): <WrapperStateType extends Partial<Flatten<StateType, never>[DeepKeyType]>, DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType) => <WrapperDeepKeyType extends keyof Flatten<WrapperStateType, never>>(wrapperKey: WrapperDeepKeyType, value: DeepPartial<Flatten<WrapperStateType, never>[WrapperDeepKeyType]>) => void;
30
+ changePropertyWrapper<StateType extends object>(): <WrapperStateType extends Partial<Flatten<StateType, never>[DeepKeyType]>, DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType) => <WrapperDeepKeyType extends keyof Flatten<WrapperStateType, never>>(wrapperKey: WrapperDeepKeyType, value: DeepPartial<Flatten<WrapperStateType, never>[WrapperDeepKeyType], {}>) => void;
31
31
  protected isInitialized: boolean;
32
32
  protected state: object;
33
33
  protected pathsHelperDataCache: {
@@ -44,9 +44,9 @@ export declare class AppStateStorage extends BaseObjectWithGlobalDispatcher {
44
44
  getValue<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType) => Partial<Flatten<StateType, never>[DeepKeyType]>;
45
45
  protected innerGetValue<StateType, DeepKeyType extends keyof Flatten<StateType>, ValueType extends Flatten<StateType>[DeepKeyType]>(stateForTypings: StateType, deepKey: DeepKeyType): Partial<ValueType>;
46
46
  protected processStateAction<StateType, DeepKeyType extends keyof Flatten<StateType>, ValueType extends Flatten<StateType>[DeepKeyType]>(stateForTypings: StateType, deepKey: DeepKeyType, config: IAppStateChangeConfigVO<ValueType>): any;
47
- substitute<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType, value: DeepPartial<Flatten<StateType, never>[DeepKeyType]>) => void;
47
+ substitute<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType, value: DeepPartial<Flatten<StateType, never>[DeepKeyType], {}>) => void;
48
48
  protected innerSubstitute<StateType, DeepKeyType extends keyof Flatten<StateType>, ValueType extends Flatten<StateType>[DeepKeyType]>(stateForTypings: StateType, deepKey: DeepKeyType, value: DeepPartial<ValueType>): void;
49
- change<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType, value: DeepPartial<Flatten<StateType, never>[DeepKeyType]>) => void;
49
+ change<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>>(key: DeepKeyType, value: DeepPartial<Flatten<StateType, never>[DeepKeyType], {}>) => void;
50
50
  protected innerChange<StateType, DeepKeyType extends keyof Flatten<StateType>, ValueType extends Flatten<StateType>[DeepKeyType]>(stateForTypings: StateType, deepKey: DeepKeyType, value: DeepPartial<ValueType>): void;
51
51
  delete<StateType extends object>(): <DeepKeyType extends keyof Flatten<StateType, never>, ValueType extends Flatten<StateType, never>[DeepKeyType] & any[] = Flatten<StateType, never>[DeepKeyType] & any[]>(key: DeepKeyType) => Flatten<StateType, never>[DeepKeyType];
52
52
  protected innerDelete<StateType, DeepKeyType extends keyof Flatten<StateType>, ValueType extends Flatten<StateType>[DeepKeyType]>(stateForTypings: StateType, deepKey: DeepKeyType): ValueType;
@@ -1,3 +1,83 @@
1
- export type DeepPartial<T> = T extends object ? {
2
- [P in keyof T]?: DeepPartial<T[P]>;
3
- } : T;
1
+ import { BuiltIns } from "./DeepReadableTypings";
2
+ /**
3
+ @see DeepPartial
4
+ */
5
+ export type DeepPartialOptions = {
6
+ /**
7
+ Whether to affect the individual elements of arrays and tuples.
8
+
9
+ @default false
10
+ */
11
+ readonly recurseIntoArrays?: boolean;
12
+ };
13
+ /**
14
+ Create a type from another type with all keys and nested keys set to optional.
15
+
16
+ Use-cases:
17
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
18
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
19
+
20
+ @example
21
+ ```
22
+ import type {DeepPartial} from 'type-fest';
23
+
24
+ const settings: Settings = {
25
+ textEditor: {
26
+ fontSize: 14;
27
+ fontColor: '#000000';
28
+ fontWeight: 400;
29
+ }
30
+ autocomplete: false;
31
+ autosave: true;
32
+ };
33
+
34
+ const applySavedSettings = (savedSettings: DeepPartial<Settings>) => {
35
+ return {...settings, ...savedSettings};
36
+ }
37
+
38
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
39
+ ```
40
+
41
+ By default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:
42
+
43
+ ```
44
+ import type {DeepPartial} from 'type-fest';
45
+
46
+ interface Settings {
47
+ languages: string[];
48
+ }
49
+
50
+ const partialSettings: DeepPartial<Settings, {recurseIntoArrays: true}> = {
51
+ languages: [undefined]
52
+ };
53
+ ```
54
+
55
+ @category Object
56
+ @category Array
57
+ @category Set
58
+ @category Map
59
+ */
60
+ export type DeepPartial<T, Options extends DeepPartialOptions = {}> = T extends BuiltIns ? T : T extends Map<infer KeyType, infer ValueType> ? DeepPartialMap<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? DeepPartialSet<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? DeepPartialReadonlyMap<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? DeepPartialReadonlySet<ItemType, Options> : T extends ((...arguments_: any[]) => unknown) ? T | undefined : T extends object ? T extends ReadonlyArray<infer ItemType> ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartial<ItemType | undefined, Options>> : Array<DeepPartial<ItemType | undefined, Options>> : DeepPartialObject<T, Options> : T : DeepPartialObject<T, Options> : unknown;
61
+ /**
62
+ Same as `DeepPartial`, but accepts only `Map`s and as inputs. Internal helper for `DeepPartial`.
63
+ */
64
+ type DeepPartialMap<KeyType, ValueType, Options extends DeepPartialOptions> = {} & Map<DeepPartial<KeyType, Options>, DeepPartial<ValueType, Options>>;
65
+ /**
66
+ Same as `DeepPartial`, but accepts only `Set`s as inputs. Internal helper for `DeepPartial`.
67
+ */
68
+ type DeepPartialSet<T, Options extends DeepPartialOptions> = {} & Set<DeepPartial<T, Options>>;
69
+ /**
70
+ Same as `DeepPartial`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `DeepPartial`.
71
+ */
72
+ type DeepPartialReadonlyMap<KeyType, ValueType, Options extends DeepPartialOptions> = {} & ReadonlyMap<DeepPartial<KeyType, Options>, DeepPartial<ValueType, Options>>;
73
+ /**
74
+ Same as `DeepPartial`, but accepts only `ReadonlySet`s as inputs. Internal helper for `DeepPartial`.
75
+ */
76
+ type DeepPartialReadonlySet<T, Options extends DeepPartialOptions> = {} & ReadonlySet<DeepPartial<T, Options>>;
77
+ /**
78
+ Same as `DeepPartial`, but accepts only `object`s as inputs. Internal helper for `DeepPartial`.
79
+ */
80
+ type DeepPartialObject<ObjectType extends object, Options extends DeepPartialOptions> = {
81
+ [KeyType in keyof ObjectType]?: DeepPartial<ObjectType[KeyType], Options>;
82
+ };
83
+ export {};
@@ -1,3 +1,58 @@
1
- export type DeepReadonly<T> = T extends Function ? T : T extends object ? {
2
- readonly [K in keyof T]: DeepReadonly<T[K]>;
3
- } : T extends never ? never : T;
1
+ export type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
2
+ (...arguments_: infer A): unknown;
3
+ (...arguments_: any[]): unknown;
4
+ } ? unknown[] extends A ? false : true : false;
5
+ export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
6
+ export type BuiltIns = Primitive | Date | RegExp;
7
+ /**
8
+ Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively.
9
+
10
+ This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
11
+
12
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
13
+
14
+ @example
15
+ ```
16
+ // data.json
17
+ {
18
+ "foo": ["bar"]
19
+ }
20
+
21
+ // main.ts
22
+ import type {DeepReadonly} from 'type-fest';
23
+ import dataJson = require('./data.json');
24
+
25
+ const data: DeepReadonly<typeof dataJson> = dataJson;
26
+
27
+ export default data;
28
+
29
+ // test.ts
30
+ import data from './main';
31
+
32
+ data.foo.push('bar');
33
+ //=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
34
+ ```
35
+
36
+ Note that types containing overloaded functions are not made deeply readonly due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).
37
+
38
+ @category Object
39
+ @category Array
40
+ @category Set
41
+ @category Map
42
+ */
43
+ export type DeepReadonly<T> = T extends BuiltIns ? T : T extends (...arguments_: any[]) => unknown ? {} extends DeepReadonlyObject<T> ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & DeepReadonlyObject<T> : T extends Readonly<ReadonlyMap<infer KeyType, infer ValueType>> ? DeepReadonlyMap<KeyType, ValueType> : T extends Readonly<ReadonlySet<infer ItemType>> ? DeepReadonlySet<ItemType> : T extends readonly [] | readonly [...never[]] ? readonly [] : T extends readonly [infer U, ...infer V] ? readonly [DeepReadonly<U>, ...DeepReadonly<V>] : T extends readonly [...infer U, infer V] ? readonly [...DeepReadonly<U>, DeepReadonly<V>] : T extends ReadonlyArray<infer ItemType> ? ReadonlyArray<DeepReadonly<ItemType>> : T extends object ? DeepReadonlyObject<T> : unknown;
44
+ /**
45
+ Same as `DeepReadonly`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `DeepReadonly`.
46
+ */
47
+ type DeepReadonlyMap<KeyType, ValueType> = {} & Readonly<ReadonlyMap<DeepReadonly<KeyType>, DeepReadonly<ValueType>>>;
48
+ /**
49
+ Same as `DeepReadonly`, but accepts only `ReadonlySet`s as inputs. Internal helper for `DeepReadonly`.
50
+ */
51
+ type DeepReadonlySet<ItemType> = {} & Readonly<ReadonlySet<DeepReadonly<ItemType>>>;
52
+ /**
53
+ Same as `DeepReadonly`, but accepts only `object`s as inputs. Internal helper for `DeepReadonly`.
54
+ */
55
+ type DeepReadonlyObject<ObjectType extends object> = {
56
+ readonly [KeyType in keyof ObjectType]: DeepReadonly<ObjectType[KeyType]>;
57
+ };
58
+ export {};