cogsbox-state 0.5.490 → 0.5.492
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/dist/CogsState.d.ts +2 -1
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.js.map +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +85 -87
- package/dist/Components.js.map +1 -1
- package/dist/plugins.d.ts +2 -1
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +70 -64
- package/src/Components.tsx +45 -46
- package/src/plugins.ts +27 -23
package/src/plugins.ts
CHANGED
|
@@ -27,14 +27,14 @@ export type ChainMethodContext<TOptions = any, THookReturn = any> = {
|
|
|
27
27
|
$update: (payload: any) => { synced: () => void };
|
|
28
28
|
$applyOperation: (operation: any, metaData?: Record<string, any>) => void;
|
|
29
29
|
getFieldMetaData: () => any;
|
|
30
|
-
setFieldMetaData: (data: Record<string, any>) => void;
|
|
31
|
-
removeFieldMetaData: () => void;
|
|
32
|
-
watchPluginMeta: (scope?: string) => void;
|
|
33
|
-
notifyPluginMeta: (scope?: string) => void;
|
|
34
|
-
getFieldRefs: () => RefObject<any>[];
|
|
35
|
-
getFieldElements: () => HTMLElement[];
|
|
36
|
-
setFieldDisabled: (disabled: boolean) => void;
|
|
37
|
-
};
|
|
30
|
+
setFieldMetaData: (data: Record<string, any>) => void;
|
|
31
|
+
removeFieldMetaData: () => void;
|
|
32
|
+
watchPluginMeta: (scope?: string) => void;
|
|
33
|
+
notifyPluginMeta: (scope?: string) => void;
|
|
34
|
+
getFieldRefs: () => RefObject<any>[];
|
|
35
|
+
getFieldElements: () => HTMLElement[];
|
|
36
|
+
setFieldDisabled: (disabled: boolean) => void;
|
|
37
|
+
};
|
|
38
38
|
|
|
39
39
|
export type ChainMethodHandler = (
|
|
40
40
|
ctx: ChainMethodContext<any, any>,
|
|
@@ -58,13 +58,17 @@ type ChainMethodCallable<THandler> = THandler extends (
|
|
|
58
58
|
? (...args: TArgs) => TReturn
|
|
59
59
|
: never;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
61
|
+
type LiteralStringKeys<T> = string extends keyof T
|
|
62
|
+
? never
|
|
63
|
+
: Extract<keyof T, string>;
|
|
64
|
+
|
|
65
|
+
export type ChainMethodCallables<TMethods> = {
|
|
66
|
+
[K in LiteralStringKeys<TMethods> as K extends string
|
|
67
|
+
? `$${K}`
|
|
68
|
+
: never]: TMethods[K] extends ChainMethodDefinition<infer TFn>
|
|
69
|
+
? ChainMethodCallable<TFn>
|
|
70
|
+
: never;
|
|
71
|
+
};
|
|
68
72
|
|
|
69
73
|
export type KeyedTypes<TMap extends Record<string, any>> = {
|
|
70
74
|
__key: 'keyed';
|
|
@@ -474,14 +478,14 @@ type ZodObjOutput<T extends z.ZodObject<any>> = {
|
|
|
474
478
|
type OutputOf<T extends z.ZodTypeAny> =
|
|
475
479
|
T extends z.ZodObject<any> ? Prettify<ZodObjOutput<T>> : z.output<T>;
|
|
476
480
|
|
|
477
|
-
type MethodFactory = <TArgs extends any[], TReturn>(
|
|
478
|
-
handler: (
|
|
479
|
-
ctx: ChainMethodContext<any, any>,
|
|
480
|
-
...args: TArgs
|
|
481
|
-
) => TReturn
|
|
482
|
-
) => ChainMethodDefinition<
|
|
483
|
-
(ctx: ChainMethodContext<any, any>, ...args: TArgs) => TReturn
|
|
484
|
-
>;
|
|
481
|
+
type MethodFactory = <TArgs extends any[], TReturn>(
|
|
482
|
+
handler: (
|
|
483
|
+
ctx: ChainMethodContext<any, any>,
|
|
484
|
+
...args: TArgs
|
|
485
|
+
) => TReturn
|
|
486
|
+
) => ChainMethodDefinition<
|
|
487
|
+
(ctx: ChainMethodContext<any, any>, ...args: TArgs) => TReturn
|
|
488
|
+
>;
|
|
485
489
|
|
|
486
490
|
type PathMethodFactory = MethodFactory & {
|
|
487
491
|
array: MethodFactory;
|