annil 1.2.0 → 1.2.2-dev.202312100

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 (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -4
  3. package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.d.ts +1 -1
  4. package/dist/api/DefineComponent/collectOptionsForComponent.d.ts +24 -4
  5. package/dist/api/DefineComponent/collectOptionsForComponent.js +11 -3
  6. package/dist/api/DefineComponent/collectOptionsForComponent.js.map +1 -1
  7. package/dist/api/DefineComponent/index.d.ts +8 -23
  8. package/dist/api/DefineComponent/index.js +1 -1
  9. package/dist/api/DefineComponent/index.js.map +1 -1
  10. package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +1 -1
  11. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +1 -1
  12. package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.d.ts +1 -0
  13. package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.js.map +1 -1
  14. package/dist/api/RootComponent/CustomEvents/test/normal.test.d.ts +2 -0
  15. package/dist/api/RootComponent/CustomEvents/test/normal.test.js +1 -0
  16. package/dist/api/RootComponent/CustomEvents/test/normal.test.js.map +1 -1
  17. package/dist/api/RootComponent/Instance/CustomEventMethods.d.ts +1 -1
  18. package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js +2 -0
  19. package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js.map +1 -1
  20. package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js +2 -0
  21. package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js.map +1 -1
  22. package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +1 -1
  23. package/dist/behaviors/BComputedAndWatch/computedUpdater.js +10 -1
  24. package/dist/behaviors/BComputedAndWatch/computedUpdater.js.map +1 -1
  25. package/dist/behaviors/BComputedAndWatch/index.js.map +1 -1
  26. package/dist/behaviors/BComputedAndWatch/initComputed.js +10 -1
  27. package/dist/behaviors/BComputedAndWatch/initComputed.js.map +1 -1
  28. package/dist/behaviors/BStore.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/api/DefineComponent/NameOrPage/NameOrPathOption.ts +1 -1
  31. package/src/api/DefineComponent/collectOptionsForComponent.ts +69 -108
  32. package/src/api/DefineComponent/index.ts +10 -30
  33. package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +1 -1
  34. package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +1 -0
  35. package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +1 -0
  36. package/src/api/RootComponent/CustomEvents/test/normal.test.ts +2 -0
  37. package/src/api/RootComponent/Instance/CustomEventMethods.ts +2 -2
  38. package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +5 -2
  39. package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +5 -2
  40. package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +1 -1
  41. package/src/behaviors/BComputedAndWatch/computedUpdater.ts +12 -5
  42. package/src/behaviors/BComputedAndWatch/index.ts +2 -2
  43. package/src/behaviors/BComputedAndWatch/initComputed.ts +13 -4
  44. package/src/behaviors/BStore.ts +2 -1
  45. package/src/behaviors/BbeforeCreated.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  * 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
6
6
 
7
+ ## [1.2.2-dev.202312100](https://github.com/missannil/annil/compare/v1.2.1...v1.2.2-dev.202312100) (2023-12-10)
8
+
9
+
10
+ ### type
11
+
12
+ * 修改了customEvents字段的类型,允许undefined类型 ([2c1c35a](https://github.com/missannil/annil/commit/2c1c35a8581016c2e0eb9cfeb01f2ed6e4f8d53c))
13
+
14
+ ## [1.2.1](https://github.com/missannil/annil/compare/v1.2.0...v1.2.1) (2023-12-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * 修复计算属性中使用this的问题 ([d9d1635](https://github.com/missannil/annil/commit/d9d1635489a8a4fb4db9c387c2b3e182ea415445))
20
+
7
21
  ## [1.2.0](https://github.com/missannil/annil/compare/v1.2.0-beta.4...v1.2.0) (2023-12-07)
8
22
 
9
23
 
package/README.md CHANGED
@@ -27,12 +27,10 @@ annil(安奈儿)是微信小程序原生开发插件,提供了新的组件构建
27
27
 
28
28
  ### 特点
29
29
 
30
- - **API功能更全面**
30
+ - **API功能更全面 **
31
31
 
32
- 新的组件API(相较原生Component/Page)加入了`computed`、`watch`、`store(全局响应式数据基于mobx)`等功能,使开发更便捷。
32
+ 新的组件API(相较原生Component/Page)加入了`computed`、`watch`、`store(全局响应式数据基于mobx)`等功能,使开发更便捷。[示例](./doc/demo/firstMeeting.md)
33
33
 
34
- ```ts
35
- ```
36
34
  - **复杂组件解决方案**
37
35
 
38
36
  新的组件API把组件逻辑部分解耦为根组件逻辑和子组件逻辑,与wxml元素一一对应。彻底解决原生API书写复杂组件时代码逻辑耦合的问题。
@@ -1,6 +1,6 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
2
  import type { Includes } from "../../../types/includes";
3
- export type NameOrPageOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
3
+ export type NameOrPathOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
4
4
  path: TPath;
5
5
  } : {
6
6
  name: TName & IfExtends<TName, "", () => "⚠️组件名不可为空⚠️", IfExtends<Includes<TName, "_">, true, () => "⚠️组件名不可包含下划线 _ ⚠️", unknown>>;
@@ -1,4 +1,24 @@
1
- import type { RootComponentTrueOptions } from "../RootComponent";
2
- import type { SubComponentTrueOptions } from "../SubComponent";
3
- import type { FinalOptionsOfComponent } from ".";
4
- export declare function collectOptionsForComponent(rootComponentOption: RootComponentTrueOptions | undefined, subComponentsList: SubComponentTrueOptions[] | undefined): FinalOptionsOfComponent;
1
+ import type { Func } from "hry-types/src/Misc/_api";
2
+ import type { WMComponent } from "../../types/OfficialTypeAlias";
3
+ import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
4
+ import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
5
+ import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
6
+ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
7
+ import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
8
+ import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
9
+ import type { DefineComponentOption } from ".";
10
+ export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
11
+ export type FinalOptionsOfComponent = {
12
+ isPage?: boolean;
13
+ options?: WMComponent.Options;
14
+ properties?: Record<string, any>;
15
+ data?: DataConstraint;
16
+ store?: StoreConstraint;
17
+ computed?: ComputedConstraint;
18
+ observers?: Record<string, Func>;
19
+ behaviors?: string[];
20
+ methods?: MethodsConstraint;
21
+ watch?: Record<string, Func>;
22
+ lifetimes?: LifetimesConstraint;
23
+ } & PageLifetimesOption<false, object>;
24
+ export declare function collectOptionsForComponent(defineComponentOption: DefineComponentOption): FinalOptionsOfComponent;
@@ -6,14 +6,20 @@ import { INNERMARKER } from "../../utils/InnerMarker";
6
6
  import { isEmptyObject } from "../../utils/isEmptyObject";
7
7
  function onLoadReceivedDataHandle(option) {
8
8
  const innerData = option[INNERMARKER.url];
9
- if (innerData !== INNERMARKER.url)
9
+ if (innerData === undefined)
10
10
  return;
11
+ if (innerData !== INNERMARKER.url) {
12
+ const decodeOption = JSON.parse(decodeURIComponent(innerData));
13
+ for (const key in decodeOption) {
14
+ option[key] = decodeOption[key];
15
+ }
16
+ }
11
17
  delete option[INNERMARKER.url];
12
18
  this.setData(option);
13
19
  }
14
20
  function loadReceivedDataHandle(option) {
15
21
  const innerData = option[INNERMARKER.url];
16
- if (innerData === undefined)
22
+ if (innerData === undefined || innerData == INNERMARKER.url)
17
23
  return;
18
24
  const decodeOption = JSON.parse(decodeURIComponent(innerData));
19
25
  for (const key in decodeOption) {
@@ -118,8 +124,10 @@ function collectRootComponentOption(finalOptions, funcOptions, rootComponentOpti
118
124
  funcFieldsCollect(rootComponentOptions, funcOptions);
119
125
  otherFieldsHandle(finalOptions, rootComponentOptions);
120
126
  }
121
- export function collectOptionsForComponent(rootComponentOption, subComponentsList) {
127
+ export function collectOptionsForComponent(defineComponentOption) {
122
128
  var _a, _b;
129
+ const rootComponentOption = defineComponentOption.rootComponent;
130
+ const subComponentsList = defineComponentOption.subComponents;
123
131
  const finalOptionsForComponent = {
124
132
  options: {
125
133
  addGlobalClass: true,
@@ -1 +1 @@
1
- {"version":3,"file":"collectOptionsForComponent.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/collectOptionsForComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAmB1D,SAAS,wBAAwB,CAE/B,MAA8C;IAE9C,MAAM,SAAS,GAAuB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAG9D,IAAI,SAAS,KAAK,WAAW,CAAC,GAAG;QAAE,OAAO;IAE1C,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC;AAMD,SAAS,sBAAsB,CAE7B,MAA8C;IAE9C,MAAM,SAAS,GAAuB,MAAM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wB,CAAC,aAAa,0CAAE,IAAI;WACvC,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;IAG1F,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;QAEpC,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAQ,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;IAED,wBAAwB,CAAC,SAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAExD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"collectOptionsForComponent.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/collectOptionsForComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAgD1D,SAAS,wBAAwB,CAE/B,MAA8C;IAE9C,MAAM,SAAS,GAAuB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAG9D,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IACpC,IAAI,SAAS,KAAK,WAAW,CAAC,GAAG,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/D,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,C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CAAC,OAAO,IAAI,uBAAuB,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAG5G,CAAA,MAAA,wBAAwB,CAAC,OAAO,0CAAE,MAAM;WACnC,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAGtG,CAAA,MAAA,wBAAwB,CAAC,aAAa,0CAAE,IAAI;WACvC,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;IAK1F,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;QAEpC,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAQ,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;IAED,wBAAwB,CAAC,SAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAExD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
@@ -1,37 +1,22 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { Func } from "hry-types/src/Misc/Func";
3
- import type { WMComponent } from "../../types/OfficialTypeAlias";
4
- import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
5
2
  import type { RootComponentDoc } from "../RootComponent/RootComponentDoc";
6
3
  import type { SubComponentDoc } from "../SubComponent/SubComponentDoc";
7
- import type { NameOrPageOption as NameOrPathOption } from "./NameOrPage/NameOrPathOption";
4
+ import type { NameOrPathOption } from "./NameOrPage/NameOrPathOption";
8
5
  import type { CreateComponentDoc } from "./ReturnType/CreateComponentDoc";
9
6
  import type { CreatePageDoc } from "./ReturnType/CreatePageDoc";
10
7
  import type { RootComponentOption } from "./RootComponent/RootComponentOption";
11
8
  import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
12
- import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
13
- import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
14
- import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
15
- import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
16
- import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
9
+ import type { RootComponentTrueOptions } from "../RootComponent";
17
10
  type Path = `/${string}`;
18
11
  type RootOptions<TRootComponentDoc extends RootComponentDoc, TSubComponentTuple extends SubComponentDoc[], TName extends string, TPath extends Path> = NameOrPathOption<TName, TPath, TRootComponentDoc["isPage"] & {}> & RootComponentOption<TRootComponentDoc> & SubComponentsOption<TSubComponentTuple>;
19
12
  interface DefineComponentConstructor {
20
13
  <TRootComponentDoc extends RootComponentDoc = {}, TSubComponentTuple extends SubComponentDoc[] = [], TName extends string = "", TPath extends Path = "/">(options: RootOptions<TRootComponentDoc, TSubComponentTuple, TName, TPath>): IfExtends<"", TName, CreatePageDoc<TRootComponentDoc, TPath>, CreateComponentDoc<TRootComponentDoc, TName, TSubComponentTuple>>;
21
14
  }
22
- export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
23
- export type FinalOptionsOfComponent = {
24
- isPage?: boolean;
25
- options?: WMComponent.Options;
26
- properties?: Record<string, any>;
27
- data?: DataConstraint;
28
- store?: StoreConstraint;
29
- computed?: ComputedConstraint;
30
- observers?: Record<string, Func>;
31
- behaviors?: string[];
32
- methods?: MethodsConstraint;
33
- watch?: Record<string, Func>;
34
- lifetimes?: LifetimesConstraint;
35
- } & PageLifetimesOption<false, object>;
15
+ export type DefineComponentOption = {
16
+ name?: string;
17
+ path?: string;
18
+ rootComponent?: RootComponentTrueOptions;
19
+ subComponents?: SubComponentDoc[];
20
+ };
36
21
  export declare const DefineComponent: DefineComponentConstructor;
37
22
  export {};
@@ -1,5 +1,5 @@
1
1
  import { collectOptionsForComponent } from "./collectOptionsForComponent";
2
2
  export const DefineComponent = function (options) {
3
- Component(collectOptionsForComponent(options.rootComponent, options.subComponents));
3
+ Component(collectOptionsForComponent(options));
4
4
  };
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAwD1E,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IACzE,SAAS,CACP,0BAA0B,CAAC,OAAO,CAAC,aAAyC,EAAE,OAAO,CAAC,aAAa,CAAC,CACrG,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AA2C1E,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IAEzE,SAAS,CACP,0BAA0B,CAAC,OAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { DetailedType } from "../../../types/DetailedType";
2
- type SimpleCustomeEvents = DetailedType | null;
2
+ type SimpleCustomeEvents = DetailedType | null | undefined;
3
3
  export type SimpleCustomeEventsList = SimpleCustomeEvents[];
4
4
  export type ShortCustomeEvents = SimpleCustomeEvents | SimpleCustomeEventsList;
5
5
  type BubblesConfig = {
@@ -2,7 +2,7 @@ import type { DetailedType } from "../../../types/DetailedType";
2
2
  import type { InferDetailedType } from "../../../types/InferDetailedType";
3
3
  import type { CustomEventConstraint, FullCustomEvents, ShortCustomeEvents, SimpleCustomeEventsList } from "./CustomEventConstraint";
4
4
  import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
5
- export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
5
+ export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends undefined ? undefined : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
6
6
  export type GetFullCustomEventsDoc<T extends FullCustomEvents> = GetShortCustomEventsDoc<T["detail"]> | AddTagForCustomEventsDoc<T["options"]>;
7
7
  export type GetCustomEventDoc<T extends CustomEventConstraint> = {
8
8
  [k in keyof T]: T[k] extends ShortCustomeEvents ? GetShortCustomEventsDoc<T[k]> : GetShortCustomEventsDoc<T[k]["detail"]> | AddTagForCustomEventsDoc<T[k]["options"]>;
@@ -3,6 +3,7 @@ import { type ListExpected, type NullExpected, type StrExpected, type UnionStrEx
3
3
  export type Mock_CustomEventsDocExpected = {
4
4
  str: StrExpected;
5
5
  null: NullExpected;
6
+ nothing: undefined;
6
7
  unionStr: UnionStrExpected;
7
8
  union: ListExpected;
8
9
  bubbles: bubblesExpected;
@@ -1 +1 @@
1
- {"version":3,"file":"GetCustomEventDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAiBlD,QAAuE,CAAC"}
1
+ {"version":3,"file":"GetCustomEventDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAkBlD,QAAuE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type DetailedType } from "../../../..";
2
2
  export declare const mock_shortCustomEvents: {
3
3
  str: StringConstructor;
4
+ nothing: undefined;
4
5
  null: null;
5
6
  unionStr: DetailedType<"male" | "female">;
6
7
  union: (StringConstructor | DetailedType<0 | 1 | 2> | null)[];
@@ -91,6 +92,7 @@ export declare const mock_customEvents: {
91
92
  };
92
93
  };
93
94
  str: StringConstructor;
95
+ nothing: undefined;
94
96
  null: null;
95
97
  unionStr: DetailedType<"male" | "female">;
96
98
  union: (StringConstructor | DetailedType<0 | 1 | 2> | null)[];
@@ -2,6 +2,7 @@ import { Checking } from "hry-types";
2
2
  import { RootComponent } from "../../../..";
3
3
  export const mock_shortCustomEvents = {
4
4
  str: String,
5
+ nothing: undefined,
5
6
  null: null,
6
7
  unionStr: String,
7
8
  union: [String, Number, null],
@@ -1 +1 @@
1
- {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAc/D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,MAAyC;IACnD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;CACZ,CAAC;AAK/C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC3B;IACD,YAAY,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAChC;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/C;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAyC;QACjD,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC3C;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;QACzD,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAChD;IACD,6BAA6B,EAAE;QAC7B,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/D;CACyC,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAC5B,sBAAsB,GACtB,qBAAqB,CACO,CAAC;AAElC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAC9B,YAAY,EAAE,iBAAiB;CAChC,CAAC,CAAC;AAoBH,QAA4C,CAAC;AAE7C,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC;IACnC,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAGH,QAA4C,CAAC;AAE7C,MAAM,eAAe,GAAG,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;AAG5C,QAA+C,CAAC"}
1
+ {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAc/D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,MAAyC;IACnD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;CACZ,CAAC;AAK/C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC3B;IACD,YAAY,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAChC;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/C;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAyC;QACjD,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC3C;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;QACzD,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAChD;IACD,6BAA6B,EAAE;QAC7B,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/D;CACyC,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAC5B,sBAAsB,GACtB,qBAAqB,CACO,CAAC;AAElC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAC9B,YAAY,EAAE,iBAAiB;CAChC,CAAC,CAAC;AAqBH,QAA4C,CAAC;AAE7C,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC;IACnC,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAGH,QAA4C,CAAC;AAE7C,MAAM,eAAe,GAAG,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;AAG5C,QAA+C,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
2
  import type { CustomEventsTags } from "../CustomEvents/CustomEventsTag";
3
3
  export type CustomEventMethods<O extends object> = {
4
- [k in keyof O]: IfExtends<Exclude<O[k], CustomEventsTags> & {}, never, () => void, (detail: Exclude<O[k], CustomEventsTags>) => void>;
4
+ [k in keyof O]: IfExtends<Exclude<O[k], CustomEventsTags>, undefined, () => void, (detail: Exclude<O[k], CustomEventsTags>) => void>;
5
5
  };
@@ -6,6 +6,7 @@ RootComponent()({
6
6
  num: Number,
7
7
  union: [String, Number],
8
8
  null: null,
9
+ undefined: undefined,
9
10
  bubbles: {
10
11
  detail: String,
11
12
  options: {
@@ -52,6 +53,7 @@ RootComponent()({
52
53
  Checking;
53
54
  Checking;
54
55
  Checking;
56
+ Checking;
55
57
  },
56
58
  },
57
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CustomEventsDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAAiD,CAAC;YAElD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAwE,CAAC;QAC3E,CAAC;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"CustomEventsDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAA6D,CAAC;YAE9D,QAAsD,CAAC;YAEvD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAoF,CAAC;QACvF,CAAC;KACF;CACF,CAAC,CAAC"}
@@ -6,6 +6,7 @@ RootComponent()({
6
6
  num: Number,
7
7
  union: [String, Number],
8
8
  null: null,
9
+ undefined: undefined,
9
10
  bubbles: {
10
11
  detail: String,
11
12
  options: {
@@ -52,6 +53,7 @@ RootComponent()({
52
53
  Checking;
53
54
  Checking;
54
55
  Checking;
56
+ Checking;
55
57
  },
56
58
  },
57
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../../src/api/RootComponent/Instance/test/customEvents/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAAiD,CAAC;YAElD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAwE,CAAC;QAC3E,CAAC;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../../src/api/RootComponent/Instance/test/customEvents/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAA6D,CAAC;YAE9D,QAAsD,CAAC;YAEvD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAoF,CAAC;QACvF,CAAC;KACF;CACF,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
2
2
  import type { WMCompLifetimes } from "../../../types/OfficialTypeAlias";
3
- import type { FinalOptionsOfComponent } from "../../DefineComponent";
3
+ import type { FinalOptionsOfComponent } from "../../DefineComponent/collectOptionsForComponent";
4
4
  export type LifetimesConstraint = ComputeIntersection<WMCompLifetimes["lifetimes"] & {
5
5
  beforeCreate?: (options: FinalOptionsOfComponent) => void;
6
6
  }>;
@@ -14,7 +14,16 @@ export function computedUpdater(isUpdated = false) {
14
14
  }
15
15
  if (changed) {
16
16
  const newDependences = [];
17
- const newValue = itemCache.method.call(Object.assign(Object.assign({}, this), { data: deepProxy(this.data, newDependences) }));
17
+ const _this = this;
18
+ const computedThis = new Proxy({ data: deepProxy(this.data, newDependences) }, {
19
+ get(target, key) {
20
+ if (key === "data") {
21
+ return Reflect.get(target, key);
22
+ }
23
+ return Reflect.get(_this, key);
24
+ },
25
+ });
26
+ const newValue = itemCache.method.call(computedThis);
18
27
  this.setData({
19
28
  [key]: unwrap(newValue),
20
29
  });
@@ -1 +1 @@
1
- {"version":3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edInfo(computedKeys, computedFunc, key) {
13
13
  const dependences = [];
14
14
  let initValue;
15
- initValue = computedFunc.call(Object.assign(Object.assign({}, this), { data: deepProxy(this.data, dependences) }));
15
+ const _this = this;
16
+ const computedThis = new Proxy({ data: deepProxy(this.data, dependences) }, {
17
+ get(target, key) {
18
+ if (key === "data") {
19
+ return Reflect.get(target, key);
20
+ }
21
+ return Reflect.get(_this, key);
22
+ },
23
+ });
24
+ initValue = computedFunc.call(computedThis);
16
25
  if (isValidDependences(dependences, computedKeys)) {
17
26
  initValue = unwrap(initValue);
18
27
  this.setData({
@@ -1 +1 @@
1
- {"version":3,"file":"initComputed.js","sourceRoot":"","sources":["../../../src/behaviors/BComputedAndWatch/initComputed.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAYlD,SAAS,kBAAkB,CAAC,WAAiC,EAAE,YAAsB;IACnF,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,WAAW,EAAE,CAAC;QAG/C,IAAI,GAAG,KAAK,SAAS,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAE7B,YAAsB,EACtB,YAAkB,EAClB,GAAW;IAGX,MAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,IAAI,SAAkB,CAAC;IAEvB,SAAS,GAAG,YAAY,CAAC,IAAI,iCACxB,IAAI,KACP,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,IACvC,CAAC;IAYH,IAAI,kBAAkB,CAAC,WAAW,E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AAE,CAAC,CAAC;YAG7C,OAAO,CAAC,OAAO,KAAf,OAAO,CAAC,OAAO,GAAK,EAAE,EAAC;YAEvB,OAAO,CAAC,OAAO,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC;YAEpD,OAAO,OAAO,CAAC,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,SAAS,EAAE;QACT,OAAO;;YAEL,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,eAAe,oDAAI,CAAC;YAC7C,IAAI,CAAC,WAAW;gBAAE,OAAO;YACzB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAgB,CAAC;YAEpE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YAEnB,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBAE9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAC3B,WAAW,CAAC,GAAG,CAAC,EAChB,CAAC,KAAc,EAAE,EAAE;oBAEjB,IAAI,CAAC,OAAO,CAAC;wBACX,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;qBACnB,CAAC,CAAC;gBACL,CAAC,EACD;oBACE,MAAM,EAAE,QAAQ,CAAC,UAAU;iBAC5B,CACF,CAAC;YACJ,CAAC;YACD,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAC5C,CAAC;QAED,QAAQ;YAEN,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;KACF;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "annil",
3
- "version": "1.2.0",
3
+ "version": "1.2.2-dev.202312100",
4
4
  "description": "微信小程序(原生开发)插件",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
@@ -4,7 +4,7 @@ import type { Includes } from "../../../types/includes";
4
4
  /**
5
5
  * 根据IsPage,生成name或path字段
6
6
  */
7
- export type NameOrPageOption<
7
+ export type NameOrPathOption<
8
8
  TName extends string,
9
9
  TPath extends `/${string}`,
10
10
  IsPage extends boolean,
@@ -4,18 +4,48 @@ import { BComputedAndWatch } from "../../behaviors/BComputedAndWatch";
4
4
  import { initComputed } from "../../behaviors/BComputedAndWatch/initComputed";
5
5
  import type { Instance } from "../../behaviors/BComputedAndWatch/types";
6
6
  import { BStore } from "../../behaviors/BStore";
7
+ import type { WMComponent } from "../../types/OfficialTypeAlias";
7
8
  import { INNERMARKER } from "../../utils/InnerMarker";
8
9
  import { isEmptyObject } from "../../utils/isEmptyObject";
9
10
  import type { RootComponentTrueOptions } from "../RootComponent";
11
+ import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
10
12
  import type {
11
13
  CustomEventConstraint,
12
14
  CustomEvents,
13
15
  FullCustomEvents,
14
16
  } from "../RootComponent/CustomEvents/CustomEventConstraint";
17
+ import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
15
18
  import type { EventsConstraint } from "../RootComponent/Events/EventsConstraint";
16
19
  import type { PageInstance } from "../RootComponent/Instance/RootComponentInstance";
20
+ import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
21
+ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
22
+ import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
23
+ import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
17
24
  import type { SubComponentTrueOptions } from "../SubComponent";
18
- import type { FinalOptionsOfComponent, FuncOptions } from ".";
25
+ import type { DefineComponentOption } from ".";
26
+ /**
27
+ * 临时的函数配置项
28
+ * 把根组件与子组件中配置类型为函数的相同字段配置收集在一起(数组)
29
+ */
30
+ export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
31
+
32
+ /**
33
+ * 最终传入原生Component的配置项
34
+ */
35
+ export type FinalOptionsOfComponent = {
36
+ isPage?: boolean;
37
+ options?: WMComponent.Options;
38
+ properties?: Record<string, any>;
39
+ data?: DataConstraint;
40
+ store?: StoreConstraint;
41
+ computed?: ComputedConstraint;
42
+ observers?: Record<string, Func>;
43
+ behaviors?: string[];
44
+ methods?: MethodsConstraint;
45
+ watch?: Record<string, Func>;
46
+ lifetimes?: LifetimesConstraint;
47
+ } & PageLifetimesOption<false, object>;
48
+
19
49
  /**
20
50
  * 原生Component会对传入的对象字段匹配的properties字段setData赋值。不符合字段或Page时不会赋值。
21
51
  * 此函数为给实例setData赋值,默认传递值与properties相符(ts类型安全)。
@@ -30,13 +60,41 @@ function onLoadReceivedDataHandle(
30
60
  ) {
31
61
  const innerData: string | undefined = option[INNERMARKER.url];
32
62
 
33
- // 情况1为undefined,2为INNERMARKER.url所以innerData !== INNERMARKER.url表示没有通过插件提供的API传值
34
- if (innerData !== INNERMARKER.url) return;
63
+ // 情况1为undefined,2为INNERMARKER.url有值但不是本身,说明没有组件中的写了load(因为组件的load提前解析这个参数),3所以innerData等于 INNERMARKER.url即有组件配置了load(提前解析了)
64
+ if (innerData === undefined) return;
65
+ if (innerData !== INNERMARKER.url) {
66
+ // 需要情况2 需要解析
67
+ const decodeOption = JSON.parse(decodeURIComponent(innerData));
68
+ for (const key in decodeOption) {
69
+ option[key] = decodeOption[key];
70
+ }
71
+ }
35
72
 
36
73
  delete option[INNERMARKER.url];
37
74
 
38
75
  this.setData(option);
39
76
  }
77
+ // 类型保护
78
+ // function isPageInstance(ins: Instance): ins is PageInstance & InstanceCustomFields {
79
+ // return (ins as PageInstance).route !== undefined;
80
+ // }
81
+ /**
82
+ * 验证path是否正确
83
+ * @param path - 配置路径
84
+ * @returns
85
+ */
86
+ // function pathCheck(path: string | undefined) {
87
+ // return function(this: Instance) {
88
+ // if (isPageInstance(this)) {
89
+ // const route = this.route;
90
+ // if (route !== path) {
91
+ // throw Error(
92
+ // `[ /${route} ] DefinedComponent的配置字段path值错误,应为: /${route}`,
93
+ // );
94
+ // }
95
+ // }
96
+ // };
97
+ // }
40
98
  /**
41
99
  * 针对通过 navigateTo传过来的数据对组件load周期传入数据解析
42
100
  * @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
@@ -47,8 +105,8 @@ function loadReceivedDataHandle(
47
105
  option: Record<typeof INNERMARKER.url, string>,
48
106
  ) {
49
107
  const innerData: string | undefined = option[INNERMARKER.url];
50
- // 未使用自定义的navigateTo
51
- if (innerData === undefined) return;
108
+ // 未使用自定义的navigateTo 或者在之前的load中已经被解析过了
109
+ if (innerData === undefined || innerData == INNERMARKER.url) return;
52
110
  const decodeOption = JSON.parse(decodeURIComponent(innerData));
53
111
 
54
112
  // 使用navigateTo API
@@ -76,64 +134,6 @@ function hijack(config: object, field: string, before: Func[] = [], after: Func[
76
134
  return;
77
135
  }
78
136
 
79
- /**
80
- * onLoad生命周期劫持函数
81
- */
82
- /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
83
- // function onLoadHijack(
84
- // options: FinalOptionsOfComponent,
85
- // before: Func[],
86
- // after: Func[] = [],
87
- // ) {
88
- // options.methods ||= {};
89
-
90
- // const cloneOpt = deepClone(options);
91
- // const originalOnLoad: Func | undefined = options.methods.onLoad;
92
-
93
- // options.methods.onLoad = function(props: unknown) {
94
- // before.forEach((func) => {
95
- // func.call(this, props, cloneOpt);
96
- // });
97
-
98
- // originalOnLoad?.call(this, props);
99
-
100
- // after.forEach((func) => {
101
- // func.call(this, props, cloneOpt);
102
- // });
103
- // };
104
- // }
105
- /**
106
- * 劫持pageLifetimes中的load字段
107
- */
108
- /* istanbul ignore next */
109
- // function loadHijack(
110
- // options: FinalOptionsOfComponent,
111
- // before: Func[],
112
- // after: Func[] = [],
113
- // ) {
114
- // /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
115
- // options.lifetimes ||= {};
116
-
117
- // const originalAttached: Func | undefined = options.lifetimes.attached;
118
-
119
- // options.lifetimes.attached = function() {
120
- // before.forEach((func) => {
121
- // func.call(this, options);
122
- // });
123
-
124
- // originalAttached?.call(this);
125
-
126
- // /* istanbul ignore next */
127
- // after.forEach((func) => {
128
- // func.call(this, options);
129
- // });
130
- // };
131
- // }
132
- /**
133
- * 内部保护字段 即不允许配置的字段名(所有方法下)
134
- */
135
- // const INNERFIELDS = ["disposer"];
136
-
137
137
  /**
138
138
  * 报错的形式避免输入字段和内部字段冲突,保证config下不包含内部预定字段(列表)
139
139
  */
@@ -270,49 +270,6 @@ function customEventsHandle(
270
270
  }
271
271
  }
272
272
  }
273
- /**
274
- * 触发各个组件的页面load事件
275
- */
276
- /* istanbul ignore next */
277
- // function triggerCompLoad(this: Instance, props: object) {
278
- // if (!this.__compLoadList__) return;
279
- // this.__compLoadList__.forEach((loadFunc) => {
280
- // loadFunc(props);
281
- // });
282
- // }
283
- /* istanbul ignore next */
284
- // function getPageInstance(pageId: string): Instance {
285
- // const pagestack = getCurrentPages() as unknown as Instance[];
286
- // let pageInstance: Instance;
287
- // pagestack.some((instance) => {
288
- // if (instance.getPageId() === pageId) {
289
- // pageInstance = instance;
290
-
291
- // return true;
292
- // }
293
-
294
- // return false;
295
- // });
296
-
297
- // // @ts-ignore pagestack中一定赋值了
298
- // return pageInstance;
299
- // }
300
- /**
301
- * 收集组件pageLifetimes下的load周期函数到页面实例的__loadFunList__
302
- */
303
- /* istanbul ignore next */
304
- // function collectLoadLifetimesOfComponent(this: Instance, finalOptionsForComponent: FinalOptionsOfComponent) {
305
- // const loadFunc = finalOptionsForComponent.pageLifetimes?.load;
306
-
307
- // console.log(loadFunc, finalOptionsForComponent);
308
-
309
- // if (!loadFunc) return;
310
-
311
- // const pageInstance = getPageInstance(this.getPageId());
312
- // const __compLoadList__: Function[] = (pageInstance.__compLoadList__ ||= []);
313
-
314
- // __compLoadList__.push(loadFunc.bind(this));
315
- // }
316
273
  /**
317
274
  * 收集 rootComponentOptions 配置到 finalOptions 和 funcOptions 中
318
275
  * @param finalOptions - 收集配置对象
@@ -336,6 +293,7 @@ function collectRootComponentOption(
336
293
 
337
294
  otherFieldsHandle(finalOptions, rootComponentOptions);
338
295
  }
296
+
339
297
  /**
340
298
  * 返回一个由rootComponentOption和subComponentsList配置整合的对象
341
299
  * @param rootComponentOption -
@@ -343,9 +301,10 @@ function collectRootComponentOption(
343
301
  * @returns FinalOptionsForComponent
344
302
  */
345
303
  export function collectOptionsForComponent(
346
- rootComponentOption: RootComponentTrueOptions | undefined,
347
- subComponentsList: SubComponentTrueOptions[] | undefined,
304
+ defineComponentOption: DefineComponentOption,
348
305
  ): FinalOptionsOfComponent {
306
+ const rootComponentOption = defineComponentOption.rootComponent;
307
+ const subComponentsList = defineComponentOption.subComponents;
349
308
  const finalOptionsForComponent: FinalOptionsOfComponent = {
350
309
  // default options
351
310
  options: {
@@ -387,6 +346,8 @@ export function collectOptionsForComponent(
387
346
  finalOptionsForComponent.pageLifetimes?.load
388
347
  && hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle], []);
389
348
 
349
+ // hijack(finalOptionsForComponent.lifetimes!, "attached", [pathCheck(defineComponentOption.path)], []);
350
+
390
351
  /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
391
352
  if (finalOptionsForComponent.isPage) {
392
353
  // 页面时删除预设的虚拟组件字段
@@ -1,22 +1,14 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { Func } from "hry-types/src/Misc/Func";
3
- import type { WMComponent } from "../../types/OfficialTypeAlias";
4
2
 
5
- import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
6
3
  import type { RootComponentDoc } from "../RootComponent/RootComponentDoc";
7
4
  import type { SubComponentDoc } from "../SubComponent/SubComponentDoc";
8
- import type { NameOrPageOption as NameOrPathOption } from "./NameOrPage/NameOrPathOption";
5
+ import type { NameOrPathOption } from "./NameOrPage/NameOrPathOption";
9
6
  import type { CreateComponentDoc } from "./ReturnType/CreateComponentDoc";
10
7
  import type { CreatePageDoc } from "./ReturnType/CreatePageDoc";
11
8
  import type { RootComponentOption } from "./RootComponent/RootComponentOption";
12
9
  import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
13
10
 
14
11
  import type { RootComponentTrueOptions } from "../RootComponent";
15
- import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
16
- import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
17
- import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
18
- import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
19
- import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
20
12
  import { collectOptionsForComponent } from "./collectOptionsForComponent";
21
13
 
22
14
  type Path = `/${string}`;
@@ -50,31 +42,19 @@ interface DefineComponentConstructor {
50
42
  >;
51
43
  }
52
44
 
53
- /**
54
- * 临时的函数配置项
55
- * 把根组件与子组件中配置类型为函数的相同字段配置收集在一起(数组)
56
- */
57
- export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
45
+ export type DefineComponentOption = {
46
+ name?: string;
47
+ path?: string;
48
+ rootComponent?: RootComponentTrueOptions;
49
+ subComponents?: SubComponentDoc[];
50
+ };
58
51
 
59
52
  /**
60
- * 最终传入原生Component的配置项
53
+ * 把根组件选项和子组件选项转化为原生Component API选项并执行
61
54
  */
62
- export type FinalOptionsOfComponent = {
63
- isPage?: boolean;
64
- options?: WMComponent.Options;
65
- properties?: Record<string, any>;
66
- data?: DataConstraint;
67
- store?: StoreConstraint;
68
- computed?: ComputedConstraint;
69
- observers?: Record<string, Func>;
70
- behaviors?: string[];
71
- methods?: MethodsConstraint;
72
- watch?: Record<string, Func>;
73
- lifetimes?: LifetimesConstraint;
74
- } & PageLifetimesOption<false, object>;
75
-
76
55
  export const DefineComponent: DefineComponentConstructor = function(options): any {
56
+ // console.log("---------------------------");
77
57
  Component(
78
- collectOptionsForComponent(options.rootComponent as RootComponentTrueOptions, options.subComponents),
58
+ collectOptionsForComponent(options as DefineComponentOption),
79
59
  );
80
60
  };
@@ -1,6 +1,6 @@
1
1
  import type { DetailedType } from "../../../types/DetailedType";
2
2
 
3
- type SimpleCustomeEvents = DetailedType | null;
3
+ type SimpleCustomeEvents = DetailedType | null | undefined;
4
4
 
5
5
  export type SimpleCustomeEventsList = SimpleCustomeEvents[];
6
6
 
@@ -10,6 +10,7 @@ import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
10
10
 
11
11
  export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T>
12
12
  : T extends null ? null
13
+ : T extends undefined ? undefined
13
14
  : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]>
14
15
  : never;
15
16
 
@@ -17,6 +17,7 @@ type Mock_CustomEventsDoc = GetCustomEventDoc<typeof mock_customEvents>;
17
17
  export type Mock_CustomEventsDocExpected = {
18
18
  str: StrExpected;
19
19
  null: NullExpected;
20
+ nothing: undefined;
20
21
  unionStr: UnionStrExpected;
21
22
  union: ListExpected;
22
23
  bubbles: bubblesExpected;
@@ -15,6 +15,7 @@ import type {
15
15
  */
16
16
  export const mock_shortCustomEvents = {
17
17
  str: String,
18
+ nothing: undefined,
18
19
  null: null,
19
20
  unionStr: String as DetailedType<"male" | "female">,
20
21
  union: [String, Number as DetailedType<0 | 1 | 2>, null],
@@ -64,6 +65,7 @@ type RootDoc = {
64
65
  // 简写字段 值类型为事件参数e的detail类型
65
66
  str: string;
66
67
  null: null;
68
+ nothing: undefined;
67
69
  unionStr: "male" | "female";
68
70
  union: string | 0 | 1 | 2 | null;
69
71
  // 带options字段 通过联合类型加入。
@@ -3,8 +3,8 @@ import type { CustomEventsTags } from "../CustomEvents/CustomEventsTag";
3
3
 
4
4
  export type CustomEventMethods<O extends object> = {
5
5
  [k in keyof O]: IfExtends<
6
- Exclude<O[k], CustomEventsTags> & {},
7
- never,
6
+ Exclude<O[k], CustomEventsTags>,
7
+ undefined,
8
8
  () => void,
9
9
  (detail: Exclude<O[k], CustomEventsTags>) => void
10
10
  >;
@@ -7,6 +7,7 @@ RootComponent()({
7
7
  num: Number as DetailedType<1 | 2>,
8
8
  union: [String as DetailedType<"male" | "femal">, Number],
9
9
  null: null,
10
+ undefined: undefined,
10
11
  bubbles: {
11
12
  detail: String,
12
13
  options: {
@@ -50,7 +51,9 @@ RootComponent()({
50
51
 
51
52
  Checking<(detail: "male" | "femal" | number) => void, typeof this.union, Test.Pass>;
52
53
 
53
- Checking<() => void, typeof this.null, Test.Pass>;
54
+ Checking<(detail: null) => void, typeof this.null, Test.Pass>;
55
+
56
+ Checking<() => void, typeof this.undefined, Test.Pass>;
54
57
 
55
58
  Checking<(detail: string) => void, typeof this.str, Test.Pass>;
56
59
 
@@ -60,7 +63,7 @@ RootComponent()({
60
63
 
61
64
  Checking<(detail: number) => void, typeof this.capturePhaseComposed, Test.Pass>;
62
65
 
63
- Checking<() => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
66
+ Checking<(detail: null) => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
64
67
  },
65
68
  },
66
69
  });
@@ -8,6 +8,7 @@ RootComponent()({
8
8
  num: Number as DetailedType<1 | 2>,
9
9
  union: [String as DetailedType<"male" | "femal">, Number],
10
10
  null: null,
11
+ undefined: undefined,
11
12
  bubbles: {
12
13
  detail: String,
13
14
  options: {
@@ -51,7 +52,9 @@ RootComponent()({
51
52
 
52
53
  Checking<(detail: "male" | "femal" | number) => void, typeof this.union, Test.Pass>;
53
54
 
54
- Checking<() => void, typeof this.null, Test.Pass>;
55
+ Checking<(detail: null) => void, typeof this.null, Test.Pass>;
56
+
57
+ Checking<() => void, typeof this.undefined, Test.Pass>;
55
58
 
56
59
  Checking<(detail: string) => void, typeof this.str, Test.Pass>;
57
60
 
@@ -61,7 +64,7 @@ RootComponent()({
61
64
 
62
65
  Checking<(detail: number) => void, typeof this.capturePhaseComposed, Test.Pass>;
63
66
 
64
- Checking<() => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
67
+ Checking<(detail: null) => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
65
68
  },
66
69
  },
67
70
  });
@@ -1,6 +1,6 @@
1
1
  import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
2
2
  import type { WMCompLifetimes } from "../../../types/OfficialTypeAlias";
3
- import type { FinalOptionsOfComponent } from "../../DefineComponent";
3
+ import type { FinalOptionsOfComponent } from "../../DefineComponent/collectOptionsForComponent";
4
4
 
5
5
  export type LifetimesConstraint = // 官方组件生命周期
6
6
  ComputeIntersection<
@@ -25,15 +25,22 @@ export function computedUpdater(this: Instance, isUpdated = false): boolean {
25
25
  break;
26
26
  }
27
27
  }
28
-
29
28
  if (changed) {
30
29
  const newDependences: ComputedDependence[] = [];
31
-
32
- const newValue = itemCache.method.call({
33
- ...this,
34
- data: deepProxy(this.data, newDependences),
30
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
31
+ const _this = this;
32
+ const computedThis = new Proxy({ data: deepProxy(this.data, newDependences) }, {
33
+ get(target, key) {
34
+ if (key === "data") {
35
+ return Reflect.get(target, key);
36
+ }
37
+
38
+ return Reflect.get(_this, key);
39
+ },
35
40
  });
36
41
 
42
+ const newValue = itemCache.method.call(computedThis);
43
+
37
44
  // 更新值不会立即再次进入**函数,而是当前**函数运行完毕后触发**函数,
38
45
  this.setData({
39
46
  [key]: unwrap(newValue),
@@ -1,8 +1,8 @@
1
1
  import type { Func } from "hry-types/src/Misc/Func";
2
- import type { FinalOptionsOfComponent } from "../../api/DefineComponent";
2
+
3
+ import type { FinalOptionsOfComponent } from "../../api/DefineComponent/collectOptionsForComponent";
3
4
  import { deepClone } from "../../utils/deepClone";
4
5
  import { deleteProtoField } from "../../utils/deleteProtoField";
5
-
6
6
  import { isEmptyObject } from "../../utils/isEmptyObject";
7
7
  import { getPathsValue } from "./getPathsValue";
8
8
  import { initComputed } from "./initComputed";
@@ -37,11 +37,20 @@ export function getComputedInfo(
37
37
  // 建立当前计算字段的依赖
38
38
  const dependences: ComputedDependence[] = [];
39
39
  let initValue: unknown;
40
- // try {
41
- initValue = computedFunc.call({
42
- ...this,
43
- data: deepProxy(this.data, dependences),
40
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
41
+ const _this = this;
42
+ const computedThis = new Proxy({ data: deepProxy(this.data, dependences) }, {
43
+ get(target, key) {
44
+ if (key === "data") {
45
+ return Reflect.get(target, key);
46
+ }
47
+
48
+ return Reflect.get(_this, key);
49
+ },
44
50
  });
51
+
52
+ initValue = computedFunc.call(computedThis);
53
+
45
54
  // } catch (error) {
46
55
  // // 为js开发考虑使用了 this.data.xxx.age 当xxx为undefined时
47
56
  // if (!isValidDependences(dependences, computedKeys)) {
@@ -1,5 +1,6 @@
1
1
  import type mobx from "mobx";
2
- import type { FinalOptionsOfComponent } from "../api/DefineComponent";
2
+
3
+ import type { FinalOptionsOfComponent } from "../api/DefineComponent/collectOptionsForComponent";
3
4
  import { deleteProtoField } from "../utils/deleteProtoField";
4
5
  import type { Instance } from "./BComputedAndWatch/types";
5
6
 
@@ -1,4 +1,4 @@
1
- import type { FinalOptionsOfComponent } from "../api/DefineComponent";
1
+ import type { FinalOptionsOfComponent } from "../api/DefineComponent/collectOptionsForComponent";
2
2
 
3
3
  export const BBeforeCreate = Behavior({
4
4
  definitionFilter(options: FinalOptionsOfComponent) {