mount-observer 0.1.29 → 0.1.30
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.
|
@@ -60,7 +60,6 @@ export class EMCParserScriptHandler extends EvtRt {
|
|
|
60
60
|
detail: { parserName },
|
|
61
61
|
bubbles: true
|
|
62
62
|
}));
|
|
63
|
-
console.log(`Registered parser "${parserName}" from ${src}`);
|
|
64
63
|
}
|
|
65
64
|
catch (error) {
|
|
66
65
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -76,8 +76,6 @@ export class EMCParserScriptHandler extends EvtRt {
|
|
|
76
76
|
bubbles: true
|
|
77
77
|
}));
|
|
78
78
|
|
|
79
|
-
console.log(`Registered parser "${parserName}" from ${src}`);
|
|
80
|
-
|
|
81
79
|
} catch (error) {
|
|
82
80
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
83
81
|
console.error(`Failed to load parser "${parserName}" from "${src}":`, errorMessage);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mount-observer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "Observe and act on css matches.",
|
|
5
5
|
"main": "MountObserver.js",
|
|
6
6
|
"module": "MountObserver.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"assign-gingerly": "0.0.
|
|
8
|
+
"assign-gingerly": "0.0.28",
|
|
9
9
|
"id-generation": "0.0.4"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
@@ -112,7 +112,7 @@ export type ParserFunction<T = any> =
|
|
|
112
112
|
| ((attrValue: string | null) => any)
|
|
113
113
|
| ((attrValue: string | null, context?: ParserContext<T>) => any);
|
|
114
114
|
|
|
115
|
-
export interface AttrConfig<T =
|
|
115
|
+
export interface AttrConfig<T = unknown, TParserConfig = unknown> {
|
|
116
116
|
/**
|
|
117
117
|
* Type of the property value (JSON-serializable string format)
|
|
118
118
|
*/
|
|
@@ -152,6 +152,12 @@ export interface AttrConfig<T = any> {
|
|
|
152
152
|
| ParserFunction<T>
|
|
153
153
|
| string
|
|
154
154
|
;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* configuration information needed by a custom parser to properly
|
|
158
|
+
* parse the attribute.
|
|
159
|
+
*/
|
|
160
|
+
parserConfig?: TParserConfig;
|
|
155
161
|
|
|
156
162
|
/**
|
|
157
163
|
* Default value to use when attribute is missing
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface Specifier {
|
|
2
|
+
selector?: string;
|
|
3
|
+
prop?: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface EndUserProps{
|
|
7
|
+
invokeParamSets: Array<InvokingParameters>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface AllProps extends EndUserProps{
|
|
11
|
+
enhancedElement: Element;
|
|
12
|
+
rawStatements: Array<string>,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type AP = AllProps;
|
|
16
|
+
|
|
17
|
+
export type PAP = Partial<AP>;
|
|
18
|
+
|
|
19
|
+
export type ProPAP = Promise<PAP>
|
|
20
|
+
|
|
21
|
+
export interface Actions{
|
|
22
|
+
hydrate(self: AP): ProPAP;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface InvokingParameters {
|
|
26
|
+
remoteSpecifier: Specifier,
|
|
27
|
+
localEventType?: string,
|
|
28
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for nested-regex-groups
|
|
3
|
+
*
|
|
4
|
+
* These types can be imported in JavaScript files using JSDoc:
|
|
5
|
+
* @example
|
|
6
|
+
* // In JavaScript:
|
|
7
|
+
* /** @type {import('nested-regex-groups').ParseResult} *\/
|
|
8
|
+
* const result = parser('input');
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Result of a successful parse operation
|
|
13
|
+
*/
|
|
14
|
+
export interface ParseSuccess<T = any> {
|
|
15
|
+
success: true;
|
|
16
|
+
value: T;
|
|
17
|
+
matched: string;
|
|
18
|
+
rest: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Result of a failed parse operation
|
|
23
|
+
*/
|
|
24
|
+
export interface ParseFailure {
|
|
25
|
+
success: false;
|
|
26
|
+
error: string;
|
|
27
|
+
position?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Union type for parse results
|
|
32
|
+
*/
|
|
33
|
+
export type ParseResult<T = any> = ParseSuccess<T> | ParseFailure;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A pattern definition with metadata (internal use with compiled RegExp)
|
|
37
|
+
*/
|
|
38
|
+
export interface ParsePattern {
|
|
39
|
+
name: string;
|
|
40
|
+
regex: RegExp;
|
|
41
|
+
description?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Optional mapping from regex group names to dot-notation paths
|
|
44
|
+
* Example: { user_name: 'user.name', user_domain: 'user.domain' }
|
|
45
|
+
*/
|
|
46
|
+
groupMap?: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Pattern configuration for parsePatterns and parsePattern functions
|
|
51
|
+
* Used when loading patterns from JSON or defining patterns as strings
|
|
52
|
+
*/
|
|
53
|
+
export interface PatternConfig {
|
|
54
|
+
name: string;
|
|
55
|
+
pattern: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Options for nestedRegex function
|
|
61
|
+
*/
|
|
62
|
+
export interface NestedRegexOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Optional name for the pattern (used in error messages)
|
|
65
|
+
*/
|
|
66
|
+
name?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Optional mapping from regex group names to dot-notation paths
|
|
69
|
+
* Example: { user_name: 'user.name', user_domain: 'user.domain' }
|
|
70
|
+
*/
|
|
71
|
+
groupMap?: Record<string, string>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Options for creating a parser
|
|
76
|
+
*/
|
|
77
|
+
export interface ParserOptions {
|
|
78
|
+
/**
|
|
79
|
+
* If true, returns detailed error information when no pattern matches
|
|
80
|
+
*/
|
|
81
|
+
verbose?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Result type for parsing multiple statements
|
|
86
|
+
*/
|
|
87
|
+
export interface StatementsResult<T = any> {
|
|
88
|
+
success: boolean;
|
|
89
|
+
statements: Array<{
|
|
90
|
+
pattern?: string;
|
|
91
|
+
value?: T;
|
|
92
|
+
error?: string;
|
|
93
|
+
matched?: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|