@reidelsaltres/pureper 0.1.130 → 0.1.134
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/out/foundation/HMLEParserReborn.d.ts +47 -0
- package/out/foundation/HMLEParserReborn.d.ts.map +1 -0
- package/out/foundation/HMLEParserReborn.js +764 -0
- package/out/foundation/HMLEParserReborn.js.map +1 -0
- package/out/foundation/Triplet.d.ts.map +1 -1
- package/out/foundation/Triplet.js +2 -2
- package/out/foundation/Triplet.js.map +1 -1
- package/out/foundation/api/Observer.d.ts +17 -0
- package/out/foundation/api/Observer.d.ts.map +1 -0
- package/out/foundation/api/Observer.js +36 -0
- package/out/foundation/api/Observer.js.map +1 -0
- package/out/foundation/hmle/Expression.d.ts +1 -0
- package/out/foundation/hmle/Expression.d.ts.map +1 -0
- package/out/foundation/hmle/Expression.js +1 -0
- package/out/foundation/hmle/Expression.js.map +1 -0
- package/package.json +2 -2
- package/src/foundation/HMLEParser.md +117 -0
- package/src/foundation/HMLEParserReborn.ts +856 -0
- package/src/foundation/Triplet.ts +2 -1
- package/src/foundation/api/Observer.ts +41 -0
- package/src/foundation/hmle/Expression.ts +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule — represents a single parsing rule with its own check and execution logic.
|
|
3
|
+
* Rules can apply to any of the 3 parsing stages or to specific ones.
|
|
4
|
+
*/
|
|
5
|
+
export interface Rule {
|
|
6
|
+
name: string;
|
|
7
|
+
/** Stage 1: text parsing — returns transformed string or null if rule doesn't apply */
|
|
8
|
+
parseText?: (parser: HMLEParserReborn, content: string, scope?: Record<string, any>, dynamicVars?: Set<string>) => string | null;
|
|
9
|
+
/** Stage 3: hydration — processes template elements in DOM */
|
|
10
|
+
hydrate?: (parser: HMLEParserReborn, template: HTMLTemplateElement, scope?: Record<string, any>) => void;
|
|
11
|
+
/** Optional: element-level hydration (stage 2/DOM parse) */
|
|
12
|
+
elementHydrate?: (parser: HMLEParserReborn, el: Element, scope?: Record<string, any>) => void;
|
|
13
|
+
}
|
|
14
|
+
export default class HMLEParserReborn {
|
|
15
|
+
private rules;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Add a custom rule to the parser
|
|
19
|
+
*/
|
|
20
|
+
addRule(rule: Rule): this;
|
|
21
|
+
/**
|
|
22
|
+
* Get registered rules
|
|
23
|
+
*/
|
|
24
|
+
getRules(): Rule[];
|
|
25
|
+
static isIdentifier(s: string): boolean;
|
|
26
|
+
evaluate(expr: string, scope?: Record<string, any>): any;
|
|
27
|
+
stringify(v: any): string;
|
|
28
|
+
/**
|
|
29
|
+
* Stage 1: Parsing — parse HMLE as text, execute STATIC RULES.
|
|
30
|
+
* Observable values are left as <template ...> placeholders for Stage 3.
|
|
31
|
+
*/
|
|
32
|
+
parse(content: string, scope?: Record<string, any>): string;
|
|
33
|
+
/**
|
|
34
|
+
* Stage 2: DOM Parsing — parse HMLE text to DOM, create <template> for dynamic rules.
|
|
35
|
+
* Created templates are preserved for reuse when Observable updates.
|
|
36
|
+
*/
|
|
37
|
+
parseToDOM(content: string, scope?: Record<string, any>): DocumentFragment;
|
|
38
|
+
/**
|
|
39
|
+
* Stage 3: Hydration — remove templates and execute dynamic rules.
|
|
40
|
+
*/
|
|
41
|
+
hydrate(fragment: DocumentFragment | Element, scope?: Record<string, any>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Process {{EXP:expr}} placeholders in element attributes
|
|
44
|
+
*/
|
|
45
|
+
private hydrateAttributeExpressions;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=HMLEParserReborn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HMLEParserReborn.d.ts","sourceRoot":"","sources":["../../src/foundation/HMLEParserReborn.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,SAAS,C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