assign-gingerly 0.0.65 → 0.0.66
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/README.md +26 -8
- package/assignFrom.js +3 -3
- package/assignFrom.ts +6 -5
- package/assignFromAsync.js +3 -3
- package/assignFromAsync.ts +5 -5
- package/assignGingerly.js +52 -10
- package/assignGingerly.ts +53 -10
- package/assignTentatively.js +8 -0
- package/assignTentatively.ts +6 -0
- package/{builtInEmoji.ts → emojis.js} +46 -34
- package/emojis.ts +52 -0
- package/getValues.js +0 -1
- package/getValues.ts +1 -1
- package/handlers/addEventListener.js +153 -0
- package/handlers/addEventListener.ts +178 -0
- package/handlers/lazyLoad.js +3 -3
- package/handlers/lazyLoad.ts +3 -3
- package/handlers/manageTemplateList.js +47 -20
- package/handlers/manageTemplateList.ts +50 -20
- package/inferencer/types/assign-gingerly/types.d.ts +58 -0
- package/package.json +4 -4
- package/types/assign-gingerly/types.d.ts +39 -23
- package/builtInEmoji.js +0 -26
|
@@ -250,8 +250,21 @@ export type IEnhancementRegistryItem<T = any> = EnhancementConfig<T>;
|
|
|
250
250
|
export interface IAssignGingerlyOptions {
|
|
251
251
|
registry?: typeof EnhancementRegistry | EnhancementRegistry;
|
|
252
252
|
bypassChecks?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Method names to call during path evaluation (e.g., for `?.method()` calls)
|
|
255
|
+
*/
|
|
253
256
|
withMethods?: string[] | Set<string>;
|
|
257
|
+
/**
|
|
258
|
+
* Alias mappings for property and method names.
|
|
259
|
+
*/
|
|
254
260
|
aka?: Record<string, string>;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Shorthand for binding method aliases from the source object.
|
|
264
|
+
* Each entry maps an alias to a method name and is normalized into
|
|
265
|
+
* the existing withMethods + aka behavior.
|
|
266
|
+
*/
|
|
267
|
+
akaMethods?: Record<string, string>;
|
|
255
268
|
|
|
256
269
|
/**
|
|
257
270
|
* AbortSignal for cleaning up reactive subscriptions (@eachTime)
|
|
@@ -838,3 +851,48 @@ export declare class LazyLoadHandler implements AssignFromHandler {
|
|
|
838
851
|
assign(lhsTarget: any, resolvedParams: Record<string, any>, options?: any): Promise<void>;
|
|
839
852
|
protected onCloneInserted(nodes: Node[], lhsTarget: Element, resolvedParams: Record<string, any>): Promise<void>;
|
|
840
853
|
}
|
|
854
|
+
|
|
855
|
+
//#region Event Handler
|
|
856
|
+
|
|
857
|
+
export interface AssignDispatchVector {
|
|
858
|
+
toTarget?: Record<string, any>,
|
|
859
|
+
toHost?: Record<string, any>,
|
|
860
|
+
toLHS?: Record<string, any>,
|
|
861
|
+
withOptions?: AssignFromOptions,
|
|
862
|
+
toTargetOptions?: AssignFromOptions,
|
|
863
|
+
toHostOptions?: AssignFromOptions,
|
|
864
|
+
toLHSOptions?: AssignFromOptions,
|
|
865
|
+
dispatch?: DispatchEventConfig
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export interface DispatchEventConfig{
|
|
869
|
+
type?: string,
|
|
870
|
+
eventCtr?: string | typeof Event | typeof CustomEvent,
|
|
871
|
+
detail?: any,
|
|
872
|
+
bubbles?: boolean,
|
|
873
|
+
cancelable?: boolean,
|
|
874
|
+
composed?: boolean
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
export interface AddEventListenerConfig extends AssignDispatchVector {
|
|
879
|
+
on: string,
|
|
880
|
+
get?: {
|
|
881
|
+
abortController?: string | AbortController,
|
|
882
|
+
|
|
883
|
+
nudge?: boolean,
|
|
884
|
+
options?: AddEventListenerOptions,
|
|
885
|
+
//make this part of dispatch?
|
|
886
|
+
stopPropagation?: boolean,
|
|
887
|
+
preventDefault?: boolean
|
|
888
|
+
dispatch?: DispatchEventConfig
|
|
889
|
+
},
|
|
890
|
+
|
|
891
|
+
fromLHS?: AssignDispatchVector,
|
|
892
|
+
fromHost?: AssignDispatchVector,
|
|
893
|
+
fromEvent?: AssignDispatchVector,
|
|
894
|
+
fromTarget?: AssignDispatchVector,
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
}
|
|
898
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assign-gingerly",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
4
|
"description": "This package provides a utility function for carefully merging one object into another.",
|
|
5
5
|
"homepage": "https://github.com/bahrus/assign-gingerly#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"default": "./assignFromAsync-extension.js",
|
|
159
159
|
"types": "./assignFromAsync-extension.ts"
|
|
160
160
|
},
|
|
161
|
-
"./
|
|
162
|
-
"default": "./
|
|
163
|
-
"types": "./
|
|
161
|
+
"./emojis.js": {
|
|
162
|
+
"default": "./emojis.js",
|
|
163
|
+
"types": "./emojis.ts"
|
|
164
164
|
},
|
|
165
165
|
"./assignFeatures.js": {
|
|
166
166
|
"default": "./assignFeatures.js",
|
|
@@ -745,11 +745,11 @@ export interface LazyLoadResolvedParams {
|
|
|
745
745
|
* Used for SSR placeholder content (e.g., "Loading..." text) that disappears once real content loads. */
|
|
746
746
|
placeholder?: string;
|
|
747
747
|
/** Assignment config applied to cloned content before insertion.
|
|
748
|
-
* Same shape as manageTemplateList's fromEachItem: {
|
|
748
|
+
* Same shape as manageTemplateList's fromEachItem: { toClone, withOptions } or { configs: [...] } */
|
|
749
749
|
assign?: {
|
|
750
|
-
|
|
750
|
+
toClone?: Record<string, any>;
|
|
751
751
|
withOptions?: Record<string, any>;
|
|
752
|
-
configs?: Array<{
|
|
752
|
+
configs?: Array<{ toClone?: Record<string, any>; withOptions?: Record<string, any> }>;
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
755
|
|
|
@@ -795,7 +795,7 @@ export interface LazyLoadSwitchResolvedParams extends Omit<LazyLoadResolvedParam
|
|
|
795
795
|
}
|
|
796
796
|
|
|
797
797
|
export interface FromEachItemConfig {
|
|
798
|
-
|
|
798
|
+
toClone?: Record<string, any>;
|
|
799
799
|
withOptions?: AssignFromOptions;
|
|
800
800
|
resolve?: {
|
|
801
801
|
key?: string;
|
|
@@ -854,28 +854,44 @@ export declare class LazyLoadHandler implements AssignFromHandler {
|
|
|
854
854
|
|
|
855
855
|
//#region Event Handler
|
|
856
856
|
|
|
857
|
-
export interface
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
857
|
+
export interface AssignDispatchVector {
|
|
858
|
+
toTarget?: Record<string, any>,
|
|
859
|
+
toHost?: Record<string, any>,
|
|
860
|
+
toLHS?: Record<string, any>,
|
|
861
861
|
withOptions?: AssignFromOptions,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
export interface
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
862
|
+
toTargetOptions?: AssignFromOptions,
|
|
863
|
+
toHostOptions?: AssignFromOptions,
|
|
864
|
+
toLHSOptions?: AssignFromOptions,
|
|
865
|
+
dispatch?: DispatchEventConfig
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export interface DispatchEventConfig{
|
|
869
|
+
type?: string,
|
|
870
|
+
eventCtr?: string | typeof Event | typeof CustomEvent,
|
|
871
|
+
detail?: any,
|
|
872
|
+
bubbles?: boolean,
|
|
873
|
+
cancelable?: boolean,
|
|
874
|
+
composed?: boolean
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
export interface AddEventListenerConfig extends AssignDispatchVector {
|
|
879
|
+
on: string,
|
|
880
|
+
get?: {
|
|
881
|
+
abortController?: string | AbortController,
|
|
882
|
+
|
|
883
|
+
nudge?: boolean,
|
|
884
|
+
options?: AddEventListenerOptions,
|
|
885
|
+
//make this part of dispatch?
|
|
886
|
+
stopPropagation?: boolean,
|
|
887
|
+
preventDefault?: boolean
|
|
888
|
+
dispatch?: DispatchEventConfig
|
|
874
889
|
},
|
|
875
890
|
|
|
876
|
-
fromLHS?:
|
|
877
|
-
|
|
878
|
-
fromEvent?:
|
|
891
|
+
fromLHS?: AssignDispatchVector,
|
|
892
|
+
fromHost?: AssignDispatchVector,
|
|
893
|
+
fromEvent?: AssignDispatchVector,
|
|
894
|
+
fromTarget?: AssignDispatchVector,
|
|
879
895
|
|
|
880
896
|
|
|
881
897
|
}
|
package/builtInEmoji.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* builtInEmoji.js — Predefined emoji aliases for built-in handlers.
|
|
3
|
-
*
|
|
4
|
-
* Import and spread into the `handlers` option for concise handler configs:
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* import { builtInEmoji } from 'assign-gingerly/builtInEmoji.js';
|
|
8
|
-
*
|
|
9
|
-
* assignFrom(target, {
|
|
10
|
-
* '?.el =>': { do: '🔗', get: { value: ['?.first', ' ', '?.last'] } }
|
|
11
|
-
* }, { from: vm, handlers: builtInEmoji });
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Emoji → built-in handler name mapping.
|
|
16
|
-
*/
|
|
17
|
-
export const builtInEmoji = {
|
|
18
|
-
'📦': 'builtIns.lazyLoad',
|
|
19
|
-
'🎚️': 'builtIns.lazyLoadSwitch',
|
|
20
|
-
'🔗': 'builtIns.join',
|
|
21
|
-
'🏷️': 'builtIns.microDataJoin',
|
|
22
|
-
'📋': 'builtIns.manageTemplateList',
|
|
23
|
-
'📊': 'builtIns.rangeSelector',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export default builtInEmoji;
|