annil 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE +1 -1
- package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.d.ts +3 -3
- package/dist/api/DefineComponent/NameOrPage/test/error.test.js +4 -0
- package/dist/api/DefineComponent/NameOrPage/test/error.test.js.map +1 -1
- package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.d.ts +2 -2
- package/dist/api/DefineComponent/ReturnType/CreatePageDoc.d.ts +2 -2
- package/dist/api/DefineComponent/ReturnType/test/normalComponentDoc.test.js.map +1 -1
- package/dist/api/DefineComponent/ReturnType/test/normalPageDoc.test.js +1 -1
- package/dist/api/DefineComponent/ReturnType/test/normalPageDoc.test.js.map +1 -1
- package/dist/api/DefineComponent/SubComponents/test/normal.test.js.map +1 -1
- package/dist/api/DefineComponent/index.d.ts +1 -1
- package/dist/api/RootComponent/Properties/GetOptionalDoc.d.ts +3 -4
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.d.ts +3 -4
- package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +3 -4
- package/dist/api/RootComponent/Store/test/normal.test.js +3 -1
- package/dist/api/RootComponent/Store/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/index.d.ts +5 -4
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/api/SubComponent/SubData/test/normal.test.js.map +1 -1
- package/dist/api/SubComponent/index.d.ts +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js.map +1 -1
- package/dist/types/ComponentDocExtension.d.ts +7 -0
- package/dist/types/ComponentDocExtension.js +2 -0
- package/dist/types/ComponentDocExtension.js.map +1 -0
- package/dist/types/ComputeObj.d.ts +3 -0
- package/dist/types/ComputeObj.js +2 -0
- package/dist/types/ComputeObj.js.map +1 -0
- package/dist/types/GetComponentPrefix.d.ts +2 -1
- package/dist/types/includes.d.ts +1 -0
- package/dist/types/includes.js +2 -0
- package/dist/types/includes.js.map +1 -0
- package/package.json +11 -7
- package/src/api/DefineComponent/NameOrPage/NameOrPathOption.ts +13 -8
- package/src/api/DefineComponent/NameOrPage/test/error.test.ts +10 -4
- package/src/api/DefineComponent/NameOrPage/test/normal.test.ts +2 -2
- package/src/api/DefineComponent/ReturnType/CreateComponentDoc.ts +2 -2
- package/src/api/DefineComponent/ReturnType/CreatePageDoc.ts +2 -2
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +19 -47
- package/src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts +3 -3
- package/src/api/DefineComponent/RootComponent/RootComponentOption.ts +3 -0
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +6 -12
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +3 -4
- package/src/api/DefineComponent/index.ts +1 -1
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +0 -2
- package/src/api/RootComponent/Properties/GetOptionalDoc.ts +10 -11
- package/src/api/RootComponent/Properties/GetPropertiesDoc.ts +6 -16
- package/src/api/RootComponent/Properties/GetRequiredDoc.ts +25 -15
- package/src/api/RootComponent/Store/test/normal.test.ts +11 -1
- package/src/api/RootComponent/index.ts +6 -5
- package/src/api/SubComponent/SubData/test/normal.test.ts +5 -2
- package/src/api/SubComponent/index.ts +2 -2
- package/src/index.ts +5 -4
- package/src/types/ComponentDocExtension.ts +36 -0
- package/src/types/ComputeObj.ts +1 -0
- package/src/types/GetComponentPrefix.ts +15 -13
- package/src/types/includes.ts +3 -0
- package/dist/api/DefineComponent/SubComponents/test/error.test.d.ts +0 -0
- package/dist/api/DefineComponent/SubComponents/test/error.test.js +0 -2
- package/dist/api/DefineComponent/SubComponents/test/error.test.js.map +0 -1
- package/dist/types/CompDocExtends.d.ts +0 -8
- package/dist/types/CompDocExtends.js +0 -2
- package/dist/types/CompDocExtends.js.map +0 -1
- package/dist/types/Drop.d.ts +0 -2
- package/dist/types/Drop.js +0 -2
- package/dist/types/Drop.js.map +0 -1
- package/dist/types/DropStr.d.ts +0 -1
- package/dist/types/DropStr.js +0 -2
- package/dist/types/DropStr.js.map +0 -1
- package/dist/types/RestorePropertiesDoc.d.ts +0 -0
- package/dist/types/RestorePropertiesDoc.js +0 -2
- package/dist/types/RestorePropertiesDoc.js.map +0 -1
- package/src/api/DefineComponent/SubComponents/test/error.test.ts +0 -14
- package/src/types/CompDocExtends.ts +0 -14
- package/src/types/Drop.ts +0 -18
- package/src/types/DropStr.ts +0 -5
- package/src/types/RestorePropertiesDoc.ts +0 -26
- package/tsconfig.json +0 -29
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ComputeIntersectionDeep } from "hry-types/src/Object/ComputeIntersectionDeep";
|
|
2
|
-
import type { ComponentDoc } from "../api/DefineComponent/ReturnType/ComponentDoc";
|
|
3
|
-
import type { UnionToComma } from "./UnionToComma.test";
|
|
4
|
-
type _Validator<T, ExistingKeys extends PropertyKey, DuplicateKeys extends PropertyKey = Extract<keyof T, ExistingKeys>> = [DuplicateKeys] extends [never] ? object : `重复的字段${UnionToComma<DuplicateKeys & string>}`;
|
|
5
|
-
export type CompDocExtends<TSubComp extends ComponentDoc, Ext extends _Validator<Ext, keyof (TSubComp["properties"])> = {}> = ComputeIntersectionDeep<TSubComp & {
|
|
6
|
-
properties: Ext;
|
|
7
|
-
}>;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompDocExtends.js","sourceRoot":"","sources":["../../src/types/CompDocExtends.ts"],"names":[],"mappings":""}
|
package/dist/types/Drop.d.ts
DELETED
package/dist/types/Drop.js
DELETED
package/dist/types/Drop.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drop.js","sourceRoot":"","sources":["../../src/types/Drop.ts"],"names":[],"mappings":""}
|
package/dist/types/DropStr.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type DropStr<S1 extends string, S2 extends string> = S1 extends `${infer Head}${S2}${infer Tail}` ? DropStr<`${Head}${Tail}`, S2> : S1;
|
package/dist/types/DropStr.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropStr.js","sourceRoot":"","sources":["../../src/types/DropStr.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RestorePropertiesDoc.js","sourceRoot":"","sources":["../../src/types/RestorePropertiesDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// import type { SubComponentDoc } from "../../../SubComponent/SubComponentDoc";
|
|
2
|
-
// import { DefineComponent } from "../..";
|
|
3
|
-
|
|
4
|
-
// const B = { properties: { aaa: 456 } } satisfies SubComponentDoc;
|
|
5
|
-
// const C = { properties: { aaa: 456 } } satisfies SubComponentDoc;
|
|
6
|
-
// const D = { properties: { bbb: 456 } } satisfies SubComponentDoc;
|
|
7
|
-
// const E = { properties: { bbb: 456 } } satisfies SubComponentDoc;
|
|
8
|
-
// const A = { properties: { ccc: 123 } } satisfies SubComponentDoc;
|
|
9
|
-
|
|
10
|
-
// DefineComponent({
|
|
11
|
-
// name: "test",
|
|
12
|
-
// // @ts-expect-error 重复的properties字段 aaa 、 bbb
|
|
13
|
-
// subComponents: [A, B, C, D, E],
|
|
14
|
-
// });
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComputeIntersectionDeep } from "hry-types/src/Object/ComputeIntersectionDeep";
|
|
2
|
-
import type { ComponentDoc } from "../api/DefineComponent/ReturnType/ComponentDoc";
|
|
3
|
-
import type { UnionToComma } from "./UnionToComma.test";
|
|
4
|
-
|
|
5
|
-
type _Validator<
|
|
6
|
-
T,
|
|
7
|
-
ExistingKeys extends PropertyKey,
|
|
8
|
-
DuplicateKeys extends PropertyKey = Extract<keyof T, ExistingKeys>,
|
|
9
|
-
> = [DuplicateKeys] extends [never] ? object : `重复的字段${UnionToComma<DuplicateKeys & string>}`;
|
|
10
|
-
|
|
11
|
-
export type CompDocExtends<
|
|
12
|
-
TSubComp extends ComponentDoc,
|
|
13
|
-
Ext extends _Validator<Ext, keyof (TSubComp["properties"])> = {},
|
|
14
|
-
> = ComputeIntersectionDeep<TSubComp & { properties: Ext }>;
|
package/src/types/Drop.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Equals } from "hry-types/src/Any/Equals";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 从' T '中删除' A '项
|
|
5
|
-
* @param T - 元组类型
|
|
6
|
-
* @param A - 任意类型
|
|
7
|
-
* @returns [[unknown[]]]
|
|
8
|
-
* @example
|
|
9
|
-
*/
|
|
10
|
-
export type Drop<T extends unknown[], A> = T extends [infer Head, ...infer Rest]
|
|
11
|
-
? Equals<A, Head> extends true ? Rest : Drop<[...Rest, Head], A>
|
|
12
|
-
: T;
|
|
13
|
-
|
|
14
|
-
// // type Test = Drop<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3>[number];
|
|
15
|
-
|
|
16
|
-
// // type TestExpect = [4, 5, 6, 8, 7, 9, 10, 1, 2][number];
|
|
17
|
-
|
|
18
|
-
// // Checking<Test, TestExpect, Test.Pass>;
|
package/src/types/DropStr.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// import type { ComponentDoc } from "../api/DefineComponent/CreateDoc/ComponentDoc";
|
|
2
|
-
// import type { Drop } from "./Drop";
|
|
3
|
-
|
|
4
|
-
// import type { ListOfSamePrimitive } from "./ListOfSamePrimitive";
|
|
5
|
-
// import type { ReStorePropTypeOfList } from "./ReStorePropTypeOfList";
|
|
6
|
-
// import type { DetailedType } from "./DetailedType";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 还原properties描述
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* type doc = {properties:{a:'1'|'2',b:boolean,c:string[],d:{name:string}}}
|
|
13
|
-
* type test = ReStorePropertiesDoc<doc>
|
|
14
|
-
* //=> {a: "1" | "2" | {type: "1" | "2"; value?: "1" | "2";}; b: boolean | {type: boolean; value?: boolean;}; c: string[] | {type: string[]; value?: string[];}; d: {name: string;} | {type: {name: string;}; value?: {name: string;};}}
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
// type ReStorePropertiesDoc<T extends ComponentDoc> = {
|
|
18
|
-
// [k in keyof T]?: ListOfSamePrimitive<T[k]> extends infer R extends unknown[]
|
|
19
|
-
// ? R["length"] extends 1 ? DetailedType<R[0]> | { type: DetailedType<R[0]>; value: R[0] }
|
|
20
|
-
// : {
|
|
21
|
-
// type: DetailedType<R[0]>;
|
|
22
|
-
// value?: R[0];
|
|
23
|
-
// optionalTypes?: ReStorePropTypeOfList<Drop<R, R[0]>>[number][];
|
|
24
|
-
// }
|
|
25
|
-
// : never;
|
|
26
|
-
// };
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": ["ES2022", "DOM"], // jest中用到了DOM类型
|
|
4
|
-
"target": "ES2017",
|
|
5
|
-
"module": "ES2022",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"strictFunctionTypes": false, // e: Dataset<{ id: string }>会报错。
|
|
8
|
-
"exactOptionalPropertyTypes": true, // 带有?标志的属性类型不在包含undefined
|
|
9
|
-
"skipLibCheck": true, // 跳过声明文件的类型检查(.d.ts),除了你引用的, 默认false(不跳过)。
|
|
10
|
-
"moduleResolution": "Bundler", // 模块解析策略 //5.0 新值 bundler
|
|
11
|
-
"noImplicitAny": true, // 不允许隐式的any类型
|
|
12
|
-
"esModuleInterop": true, // 默认false 将 CommonJS/AMD/UMD 模块视为类似于 ES6 模块,但有缺陷。
|
|
13
|
-
"removeComments": true, // 去除注释
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"noImplicitReturns": true, // 隐式函数返回
|
|
16
|
-
"forceConsistentCasingInFileNames": true, // 区分文件名的大小写
|
|
17
|
-
"noUnusedLocals": true, // 报告未使用局部变量的错误
|
|
18
|
-
"noUnusedParameters": false, // 报告函数中未使用参数的错误
|
|
19
|
-
"suppressImplicitAnyIndexErrors": true, // 为true关闭隐式索引错误,但很激进,建议使用@ts-ignore
|
|
20
|
-
"isolatedModules": true, // 独立模块(必须有导入或导出) 默认false
|
|
21
|
-
"preserveValueImports": true, // 引入类型加type
|
|
22
|
-
"ignoreDeprecations": "5.0",
|
|
23
|
-
"noFallthroughCasesInSwitch": true, // 报告switch语句中漏接情况的错误
|
|
24
|
-
"allowSyntheticDefaultImports": true, // esModuleInterop 为true时自动true
|
|
25
|
-
// 默认加载所有@types下的包 types指定具体的包,其他拒绝。包含上级目录
|
|
26
|
-
"types": ["hry-types", "mobx", "jest", "miniprogram-api-typings"]
|
|
27
|
-
},
|
|
28
|
-
"include": ["**/*.ts"]
|
|
29
|
-
}
|