@angular-wave/angular.ts 0.16.0 → 0.17.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/@types/angular.d.ts +4 -0
- package/@types/animations/animate-css-driver.d.ts +10 -2
- package/@types/animations/animate-css.d.ts +8 -14
- package/@types/animations/animation.d.ts +1 -3
- package/@types/animations/cache/animate-cache.d.ts +99 -0
- package/@types/animations/cache/interface.d.ts +17 -0
- package/@types/animations/interface.d.ts +15 -18
- package/@types/animations/raf/raf-scheduler.d.ts +37 -0
- package/@types/core/compile/interface.d.ts +36 -5
- package/@types/core/interpolate/interface.d.ts +7 -1
- package/@types/core/parse/ast/ast-node.d.ts +75 -38
- package/@types/core/parse/ast/ast.d.ts +0 -3
- package/@types/core/parse/interface.d.ts +2 -2
- package/@types/core/parse/interpreter.d.ts +22 -10
- package/@types/core/scope/interface.d.ts +14 -4
- package/@types/core/scope/scope.d.ts +65 -22
- package/@types/directive/form/form.d.ts +16 -4
- package/@types/directive/model/model.d.ts +6 -4
- package/@types/filters/order-by.d.ts +13 -0
- package/@types/interface.d.ts +3 -3
- package/@types/router/path/path-node.d.ts +1 -1
- package/@types/router/resolve/resolve-context.d.ts +1 -1
- package/@types/router/transition/hook-registry.d.ts +1 -1
- package/@types/router/url/url-matcher.d.ts +1 -1
- package/@types/services/sce/interface.d.ts +1 -4
- package/@types/services/sce/sce.d.ts +7 -2
- package/@types/shared/common.d.ts +100 -39
- package/@types/shared/node.d.ts +5 -5
- package/@types/shared/strings.d.ts +2 -2
- package/dist/angular-ts.esm.js +1620 -1037
- package/dist/angular-ts.umd.js +1620 -1037
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/@types/animations/animate-cache.d.ts +0 -94
- package/@types/animations/raf-scheduler.d.ts +0 -35
package/@types/angular.d.ts
CHANGED
|
@@ -85,6 +85,10 @@ export class Angular extends EventTarget {
|
|
|
85
85
|
requires?: Array<string>,
|
|
86
86
|
configFn?: ng.Injectable<any>,
|
|
87
87
|
): NgModule;
|
|
88
|
+
/**
|
|
89
|
+
* @param {CustomEvent} event
|
|
90
|
+
*/
|
|
91
|
+
dispatchEvent(event: CustomEvent): boolean;
|
|
88
92
|
/**
|
|
89
93
|
* Use this function to manually start up AngularTS application.
|
|
90
94
|
*
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("./animation.js").AnimationProvider} $$animationProvider
|
|
3
|
+
*/
|
|
4
|
+
export function AnimateCssDriverProvider(
|
|
5
|
+
$$animationProvider: import("./animation.js").AnimationProvider,
|
|
6
|
+
): void;
|
|
2
7
|
export class AnimateCssDriverProvider {
|
|
3
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @param {import("./animation.js").AnimationProvider} $$animationProvider
|
|
10
|
+
*/
|
|
11
|
+
constructor($$animationProvider: import("./animation.js").AnimationProvider);
|
|
4
12
|
/**
|
|
5
13
|
* @returns {Function}
|
|
6
14
|
*/
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
export function AnimateCssProvider(): void;
|
|
2
2
|
export class AnimateCssProvider {
|
|
3
|
-
$get: (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
) => {
|
|
12
|
-
$$willAnimate: boolean;
|
|
13
|
-
start(): any;
|
|
14
|
-
end: () => void;
|
|
15
|
-
})
|
|
16
|
-
)[];
|
|
3
|
+
$get: (() => (
|
|
4
|
+
element: HTMLElement,
|
|
5
|
+
initialOptions: ng.AnimationOptions,
|
|
6
|
+
) => {
|
|
7
|
+
$$willAnimate: boolean;
|
|
8
|
+
start(): any;
|
|
9
|
+
end: () => void;
|
|
10
|
+
})[];
|
|
17
11
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export function AnimationProvider(): void;
|
|
2
2
|
export class AnimationProvider {
|
|
3
|
-
drivers:
|
|
3
|
+
drivers: string[];
|
|
4
4
|
$get: (
|
|
5
5
|
| string
|
|
6
6
|
| ((
|
|
7
7
|
$rootScope: ng.RootScopeService,
|
|
8
8
|
$injector: ng.InjectorService,
|
|
9
|
-
$$rAFScheduler: import("./raf-scheduler.js").RafScheduler,
|
|
10
|
-
$$animateCache: any,
|
|
11
9
|
) => (elementParam: any, event: any, options: any) => AnimateRunner)
|
|
12
10
|
)[];
|
|
13
11
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation cache responsible for:
|
|
3
|
+
* - Generating stable animation cache keys
|
|
4
|
+
* - Tracking cached animation results
|
|
5
|
+
* - Avoiding repeated animation work
|
|
6
|
+
*
|
|
7
|
+
* Cache keys are scoped per parent node to prevent collisions between
|
|
8
|
+
* structurally identical nodes in different DOM subtrees.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export class AnimateCache {
|
|
13
|
+
/**
|
|
14
|
+
* Generates a stable cache key for an animation invocation.
|
|
15
|
+
*
|
|
16
|
+
* The key is derived from:
|
|
17
|
+
* - The node's parent (used as a cache namespace)
|
|
18
|
+
* - The animation method (e.g. enter, leave, addClass)
|
|
19
|
+
* - The node's current CSS class state
|
|
20
|
+
* - Any classes being added or removed
|
|
21
|
+
*
|
|
22
|
+
* If the node is not attached to the DOM, the node itself is used
|
|
23
|
+
* as the parent scope to avoid key collisions.
|
|
24
|
+
*
|
|
25
|
+
* @param {HTMLElement} node
|
|
26
|
+
* Target element being animated.
|
|
27
|
+
* @param {string} method
|
|
28
|
+
* Animation method name.
|
|
29
|
+
* @param {string} [addClass]
|
|
30
|
+
* CSS class scheduled to be added during the animation.
|
|
31
|
+
* @param {string} [removeClass]
|
|
32
|
+
* CSS class scheduled to be removed during the animation.
|
|
33
|
+
*
|
|
34
|
+
* @returns {string}
|
|
35
|
+
* A unique, deterministic cache key.
|
|
36
|
+
*/
|
|
37
|
+
_cacheKey(
|
|
38
|
+
node: HTMLElement,
|
|
39
|
+
method: string,
|
|
40
|
+
addClass?: string,
|
|
41
|
+
removeClass?: string,
|
|
42
|
+
): string;
|
|
43
|
+
/**
|
|
44
|
+
* Determines whether a cache entry exists but is marked as invalid.
|
|
45
|
+
*
|
|
46
|
+
* This is typically used to detect animations that were previously
|
|
47
|
+
* cached but resolved without a duration.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} key
|
|
50
|
+
* Cache key to test.
|
|
51
|
+
* @returns {boolean}
|
|
52
|
+
* True if an invalid cache entry exists, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
_containsCachedAnimationWithoutDuration(key: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Clears all cached animation entries.
|
|
57
|
+
*
|
|
58
|
+
* Does not reset parent IDs.
|
|
59
|
+
*
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
_flush(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the number of times a cache entry has been used.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} key
|
|
67
|
+
* Cache key to query.
|
|
68
|
+
* @returns {number}
|
|
69
|
+
* Usage count, or 0 if the entry does not exist.
|
|
70
|
+
*/
|
|
71
|
+
_count(key: string): number;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves the cached value associated with a cache key.
|
|
74
|
+
*
|
|
75
|
+
* @param {string} key
|
|
76
|
+
* Cache key to retrieve.
|
|
77
|
+
* @returns {any}
|
|
78
|
+
* Cached value, or undefined if not present.
|
|
79
|
+
*/
|
|
80
|
+
_get(key: string): any;
|
|
81
|
+
/**
|
|
82
|
+
* Inserts or updates a cache entry.
|
|
83
|
+
*
|
|
84
|
+
* Existing entries will have their usage count incremented
|
|
85
|
+
* and their value replaced.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} key
|
|
88
|
+
* Cache key.
|
|
89
|
+
* @param {any} value
|
|
90
|
+
* Value to cache.
|
|
91
|
+
* @param {boolean} isValid
|
|
92
|
+
* Whether the cached value is considered valid.
|
|
93
|
+
*
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
_put(key: string, value: any, isValid: boolean): void;
|
|
97
|
+
#private;
|
|
98
|
+
}
|
|
99
|
+
export const animateCache: AnimateCache;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal cache entry used to track animation results and usage.
|
|
3
|
+
*/
|
|
4
|
+
export interface CacheEntry {
|
|
5
|
+
/**
|
|
6
|
+
* Number of times this cache entry has been accessed or reused.
|
|
7
|
+
*/
|
|
8
|
+
total: number;
|
|
9
|
+
/**
|
|
10
|
+
* Cached animation result (typically an animation runner or metadata).
|
|
11
|
+
*/
|
|
12
|
+
value: any;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the cached animation is considered valid (e.g. has a duration).
|
|
15
|
+
*/
|
|
16
|
+
isValid: boolean;
|
|
17
|
+
}
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { AnimateRunner } from "./runner/animate-runner.js";
|
|
2
2
|
import { QueuePhase } from "./queue/interface.ts";
|
|
3
|
-
export type RafScheduler = {
|
|
4
|
-
/**
|
|
5
|
-
* Schedules a list of functions to run on the next animation frame(s).
|
|
6
|
-
* @param tasks - The tasks to be scheduled.
|
|
7
|
-
*/
|
|
8
|
-
(tasks: Array<() => void>): void;
|
|
9
|
-
/**
|
|
10
|
-
* Internal queue of scheduled task arrays.
|
|
11
|
-
*/
|
|
12
|
-
_queue: Array<Array<() => void>>;
|
|
13
|
-
/**
|
|
14
|
-
* Waits until the animation frame is quiet before running the provided function.
|
|
15
|
-
* Cancels any previous animation frame requests.
|
|
16
|
-
* @param fn - The function to run when the frame is quiet.
|
|
17
|
-
*/
|
|
18
|
-
_waitUntilQuiet(fn: () => void): void;
|
|
19
|
-
};
|
|
20
3
|
export interface AnimationHost {
|
|
21
4
|
/** Pause animation. */
|
|
22
5
|
pause?: () => void;
|
|
@@ -100,10 +83,24 @@ export interface AnimationOptions {
|
|
|
100
83
|
tempClasses: string | string[];
|
|
101
84
|
/** Optional DOM operation callback executed before animation */
|
|
102
85
|
domOperation?: () => void;
|
|
103
|
-
|
|
86
|
+
onDone?: () => void;
|
|
87
|
+
_domOperationFired?: boolean;
|
|
104
88
|
$$prepared?: boolean;
|
|
89
|
+
$$skipPreparationClasses?: boolean;
|
|
90
|
+
cleanupStyles?: boolean;
|
|
105
91
|
preparationClasses?: string;
|
|
106
92
|
activeClasses?: string;
|
|
93
|
+
duration?: number | string;
|
|
94
|
+
event?: string | string[];
|
|
95
|
+
easing?: string;
|
|
96
|
+
delay?: string;
|
|
97
|
+
structural?: boolean;
|
|
98
|
+
transitionStyle?: string;
|
|
99
|
+
staggerIndex?: number;
|
|
100
|
+
skipBlocking?: boolean;
|
|
101
|
+
stagger?: number | string;
|
|
102
|
+
keyframeStyle?: string;
|
|
103
|
+
applyClassesEarly?: boolean;
|
|
107
104
|
}
|
|
108
105
|
export interface AnimateJsRunner {
|
|
109
106
|
$$willAnimate: true;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A requestAnimationFrame-based scheduler.
|
|
3
|
+
*/
|
|
4
|
+
export class RafScheduler {
|
|
5
|
+
/**
|
|
6
|
+
* Internal task queue, where each item is an array of functions to run.
|
|
7
|
+
* @type {Array<() => void>}
|
|
8
|
+
*/
|
|
9
|
+
_queue: Array<() => void>;
|
|
10
|
+
/**
|
|
11
|
+
* ID of the currently scheduled animation frame (if any).
|
|
12
|
+
* Used for cancellation and tracking.
|
|
13
|
+
* @type {number|null}
|
|
14
|
+
*/
|
|
15
|
+
_cancelFn: number | null;
|
|
16
|
+
/**
|
|
17
|
+
* Processes the next batch of tasks in the animation frame.
|
|
18
|
+
* Executes the first group of functions in the queue, then
|
|
19
|
+
* schedules the next frame if needed.
|
|
20
|
+
*/
|
|
21
|
+
_nextTick(): void;
|
|
22
|
+
/**
|
|
23
|
+
* The main scheduler function.
|
|
24
|
+
* Accepts an array of functions and schedules them to run in the next available frame(s).
|
|
25
|
+
*
|
|
26
|
+
* @param {Array<() => void>} tasks
|
|
27
|
+
*/
|
|
28
|
+
_schedule(tasks: Array<() => void>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Cancels any pending frame and runs the given function once the frame is idle.
|
|
31
|
+
* Useful for debounced updates.
|
|
32
|
+
*
|
|
33
|
+
* @param {Function} fn - Function to run when the animation frame is quiet.
|
|
34
|
+
*/
|
|
35
|
+
_waitUntilQuiet(fn: Function): void;
|
|
36
|
+
}
|
|
37
|
+
export const rafScheduler: RafScheduler;
|
|
@@ -2,6 +2,7 @@ import type { Scope } from "../scope/scope.js";
|
|
|
2
2
|
import type { NodeRef } from "../../shared/noderef.js";
|
|
3
3
|
type TranscludedNodes = Node | Node[] | NodeList | null;
|
|
4
4
|
type TranscludeFnCb = (clone?: TranscludedNodes, scope?: Scope | null) => void;
|
|
5
|
+
export type ChildTranscludeOrLinkFn = TranscludeFn | PublicLinkFn;
|
|
5
6
|
/**
|
|
6
7
|
* A function passed as the fifth argument to a `PublicLinkFn` link function.
|
|
7
8
|
* It behaves like a linking function, with the `scope` argument automatically created
|
|
@@ -12,13 +13,33 @@ type TranscludeFnCb = (clone?: TranscludedNodes, scope?: Scope | null) => void;
|
|
|
12
13
|
export type TranscludeFn = {
|
|
13
14
|
(cb: TranscludeFnCb): void;
|
|
14
15
|
(scope: Scope, cb?: TranscludeFnCb): void;
|
|
15
|
-
|
|
16
|
+
_slots?: any;
|
|
16
17
|
};
|
|
18
|
+
export type CloneAttachFn = (
|
|
19
|
+
clone: Node | Element | NodeList,
|
|
20
|
+
scope?: Scope,
|
|
21
|
+
) => void;
|
|
17
22
|
/**
|
|
18
23
|
* A specialized version of `TranscludeFn` with the scope argument already bound.
|
|
19
24
|
* This function requires no parameters and returns the same result as `TranscludeFn`.
|
|
20
25
|
*/
|
|
21
|
-
export
|
|
26
|
+
export interface BoundTranscludeFn {
|
|
27
|
+
(
|
|
28
|
+
scope?: Scope,
|
|
29
|
+
cloneAttachFn?: CloneAttachFn,
|
|
30
|
+
transcludeControllers?: unknown,
|
|
31
|
+
_futureParentElement?: Node | Element,
|
|
32
|
+
scopeToChild?: Scope,
|
|
33
|
+
): Node | Element | NodeList;
|
|
34
|
+
_slots: Record<string, SlotTranscludeFn | null | undefined>;
|
|
35
|
+
}
|
|
36
|
+
export type SlotTranscludeFn = (
|
|
37
|
+
scope?: Scope,
|
|
38
|
+
cloneAttachFn?: CloneAttachFn,
|
|
39
|
+
transcludeControllers?: unknown,
|
|
40
|
+
_futureParentElement?: Node | Element,
|
|
41
|
+
scopeToChild?: Scope,
|
|
42
|
+
) => Node | Element | NodeList;
|
|
22
43
|
/**
|
|
23
44
|
* Represents a simple change in a watched value.
|
|
24
45
|
*/
|
|
@@ -60,17 +81,27 @@ export interface LinkFnMapping {
|
|
|
60
81
|
* Function that compiles a list of nodes and returns a composite linking function.
|
|
61
82
|
*/
|
|
62
83
|
export type CompileNodesFn = () => CompositeLinkFn;
|
|
84
|
+
export type ChildLinkFn = (
|
|
85
|
+
scope: Scope,
|
|
86
|
+
nodeRef: NodeRef,
|
|
87
|
+
_parentBoundTranscludeFn: BoundTranscludeFn | null,
|
|
88
|
+
) => void;
|
|
63
89
|
/**
|
|
64
90
|
* A function used to link a specific node.
|
|
65
91
|
*/
|
|
66
|
-
export type NodeLinkFn = (
|
|
92
|
+
export type NodeLinkFn = (
|
|
93
|
+
childLinkFn: ChildLinkFn | null,
|
|
94
|
+
scope: Scope,
|
|
95
|
+
node: Node | Element,
|
|
96
|
+
boundTranscludeFn: BoundTranscludeFn | null,
|
|
97
|
+
) => void;
|
|
67
98
|
/**
|
|
68
99
|
* Context information for a NodeLinkFn.
|
|
69
100
|
*/
|
|
70
101
|
export interface NodeLinkFnCtx {
|
|
71
102
|
nodeLinkFn: NodeLinkFn;
|
|
72
103
|
terminal: boolean;
|
|
73
|
-
transclude:
|
|
104
|
+
transclude: ChildTranscludeOrLinkFn;
|
|
74
105
|
transcludeOnThisElement: boolean;
|
|
75
106
|
templateOnThisElement: boolean;
|
|
76
107
|
newScope: boolean;
|
|
@@ -85,6 +116,6 @@ export type ApplyDirectivesToNodeFn = () => NodeLinkFn;
|
|
|
85
116
|
export type CompositeLinkFn = (
|
|
86
117
|
scope: Scope,
|
|
87
118
|
$linkNode: NodeRef,
|
|
88
|
-
|
|
119
|
+
_parentBoundTranscludeFn?: Function,
|
|
89
120
|
) => void;
|
|
90
121
|
export {};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export interface InterpolationFunction {
|
|
2
2
|
expressions: any[];
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Evaluate the interpolation.
|
|
5
|
+
* @param context - The scope/context
|
|
6
|
+
* @param cb - Optional callback when expressions change
|
|
7
|
+
*/
|
|
8
|
+
(context: any, cb?: (val: any) => void): any;
|
|
9
|
+
exp: string;
|
|
4
10
|
}
|
|
5
11
|
export interface InterpolateService {
|
|
6
12
|
(
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { ASTType } from "../ast-type.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
|
|
2
|
+
/** The kind of an object property */
|
|
3
|
+
export type PropertyKind = "init" | "get" | "set";
|
|
4
|
+
/** Base properties for all AST nodes */
|
|
5
|
+
interface BaseNode {
|
|
6
6
|
/** The type of the AST node. */
|
|
7
7
|
type: ASTType;
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
/** Indicates whether the node depends on non-shallow state. */
|
|
9
|
+
isPure?: boolean;
|
|
10
|
+
/** Indicates whether the expression is a constant. */
|
|
11
|
+
constant?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** A node that contains a list of statements, e.g., Program or BlockStatement */
|
|
14
|
+
export interface BodyNode extends BaseNode {
|
|
15
|
+
/** The body of the program or block. Always present; empty if no statements. */
|
|
16
|
+
body: ASTNode[];
|
|
17
|
+
/** Optional list of expressions to observe for changes (Angular-specific). */
|
|
18
|
+
toWatch: ASTNode[];
|
|
19
|
+
}
|
|
20
|
+
/** Expression nodes, e.g., BinaryExpression, UnaryExpression, ConditionalExpression, CallExpression, MemberExpression */
|
|
21
|
+
export interface ExpressionNode extends BaseNode {
|
|
22
|
+
/** The single expression contained by an ExpressionStatement. */
|
|
23
|
+
expression?: ASTNode;
|
|
24
|
+
/** The left-hand side of a binary or logical expression. */
|
|
21
25
|
left?: ASTNode;
|
|
22
|
-
/** The right-hand side of a binary expression. */
|
|
26
|
+
/** The right-hand side of a binary or logical expression. */
|
|
23
27
|
right?: ASTNode;
|
|
24
28
|
/** The argument of a unary expression. */
|
|
25
29
|
argument?: ASTNode;
|
|
@@ -29,30 +33,63 @@ export type ASTNode = {
|
|
|
29
33
|
alternate?: ASTNode;
|
|
30
34
|
/** The consequent expression of a conditional expression. */
|
|
31
35
|
consequent?: ASTNode;
|
|
32
|
-
/** The
|
|
33
|
-
body?: ASTNode[];
|
|
34
|
-
/** A list of expressions to observe in a program or block statement. */
|
|
35
|
-
toWatch?: ASTNode[];
|
|
36
|
-
/** The expression of an expression statement. */
|
|
37
|
-
expression?: ASTNode;
|
|
38
|
-
/** The callee of a call expression. */
|
|
36
|
+
/** The callee of a function or method call expression. */
|
|
39
37
|
callee?: ASTNode;
|
|
40
|
-
/** The arguments of a call expression. */
|
|
38
|
+
/** The arguments of a function or method call expression. */
|
|
41
39
|
arguments?: ASTNode[];
|
|
42
|
-
/**
|
|
43
|
-
prefix?: boolean;
|
|
44
|
-
/** The object of a member expression. */
|
|
40
|
+
/** The object of a member expression (e.g., `obj` in `obj.prop`). */
|
|
45
41
|
object?: ASTNode;
|
|
46
|
-
/** The property of a member expression. */
|
|
42
|
+
/** The property of a member expression (e.g., `prop` in `obj.prop`). */
|
|
47
43
|
property?: ASTNode;
|
|
48
|
-
/** Indicates if
|
|
44
|
+
/** Indicates if the member expression is computed (`obj[prop]` vs `obj.prop`). */
|
|
49
45
|
computed?: boolean;
|
|
50
|
-
/** The operator of a binary or logical expression. */
|
|
46
|
+
/** The operator of a binary or logical expression, e.g., "+", "*", "&&". */
|
|
51
47
|
operator?: string;
|
|
52
|
-
/** Indicates if the expression should be filtered. */
|
|
48
|
+
/** Indicates if the expression should be filtered (Angular-specific). */
|
|
53
49
|
filter?: boolean;
|
|
54
|
-
/** Indicates
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
/** Indicates if the unary operator is a prefix, e.g., `++i` vs `i++`. */
|
|
51
|
+
prefix?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Leaf node representing a literal or identifier */
|
|
54
|
+
export interface LiteralNode extends BaseNode {
|
|
55
|
+
/** The value of a literal node, e.g., number, string, boolean. */
|
|
56
|
+
value?: any;
|
|
57
|
+
/** The name of an identifier node. */
|
|
58
|
+
name?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Node representing an array literal */
|
|
61
|
+
export interface ArrayNode extends BaseNode {
|
|
62
|
+
/** The elements of the array. */
|
|
63
|
+
elements: ASTNode[];
|
|
64
|
+
}
|
|
65
|
+
/** Node representing an object literal */
|
|
66
|
+
export interface ObjectNode extends BaseNode {
|
|
67
|
+
/** The properties of the object. */
|
|
68
|
+
properties: ASTNode[];
|
|
69
|
+
}
|
|
70
|
+
/** Node representing a single property of an object literal */
|
|
71
|
+
export interface ObjectPropertyNode extends BaseNode {
|
|
72
|
+
/** Property kind (only "init" is used in Angular expressions) */
|
|
73
|
+
kind: "init";
|
|
74
|
+
/** Property key: identifier, literal, or expression */
|
|
75
|
+
key: ASTNode;
|
|
76
|
+
/** Property value expression */
|
|
77
|
+
value: ASTNode;
|
|
78
|
+
/** Whether the property key is computed (`{ [expr]: value }`) */
|
|
79
|
+
computed: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Statement node that wraps an expression */
|
|
82
|
+
export interface ExpressionStatementNode extends BaseNode {
|
|
83
|
+
/** The expression contained in this statement. */
|
|
84
|
+
expression: ASTNode;
|
|
85
|
+
}
|
|
86
|
+
/** The union type covering all AST nodes */
|
|
87
|
+
export type ASTNode =
|
|
88
|
+
| BodyNode
|
|
89
|
+
| ExpressionNode
|
|
90
|
+
| LiteralNode
|
|
91
|
+
| ArrayNode
|
|
92
|
+
| ObjectNode
|
|
93
|
+
| ObjectPropertyNode
|
|
94
|
+
| ExpressionStatementNode;
|
|
95
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DecoratedASTNode } from "./interpreter.js";
|
|
2
1
|
import type { Scope } from "../scope/scope.js";
|
|
2
|
+
import { BodyNode } from "./ast/ast-node.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Describes metadata and behavior for a compiled AngularTS expression.
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ export interface CompiledExpressionProps {
|
|
|
11
11
|
/** Optional flag for pure expressions. */
|
|
12
12
|
_isPure?: boolean;
|
|
13
13
|
/** AST node decorated with metadata. */
|
|
14
|
-
_decoratedNode:
|
|
14
|
+
_decoratedNode: BodyNode;
|
|
15
15
|
/** Expression inputs; may be an array or a function. */
|
|
16
16
|
_inputs?: any[] | Function;
|
|
17
17
|
/**
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* @returns {boolean}
|
|
4
4
|
*/
|
|
5
5
|
export function isAssignable(ast: any): boolean;
|
|
6
|
+
/** @typedef {import("./ast/ast-node.ts").ASTNode} ASTNode */
|
|
7
|
+
/** @typedef {import("./ast/ast-node.ts").BodyNode} BodyNode */
|
|
8
|
+
/** @typedef {import("./ast/ast-node.ts").ExpressionNode} ExpressionNode */
|
|
9
|
+
/** @typedef {import("./ast/ast-node.ts").ArrayNode} ArrayNode */
|
|
10
|
+
/** @typedef {import("./ast/ast-node.ts").LiteralNode} LiteralNode */
|
|
11
|
+
/** @typedef {import("./ast/ast-node.ts").ObjectNode} ObjectNode */
|
|
12
|
+
/** @typedef {import("./ast/ast-node.ts").ObjectPropertyNode} ObjectPropertyNode */
|
|
13
|
+
/** @typedef {import("./interface.ts").CompiledExpression} CompiledExpression */
|
|
14
|
+
/** @typedef {import("./interface.ts").CompiledExpressionFunction} CompiledExpressionFunction */
|
|
6
15
|
export const PURITY_ABSOLUTE: 1;
|
|
7
16
|
export const PURITY_RELATIVE: 2;
|
|
8
17
|
export class ASTInterpreter {
|
|
@@ -14,12 +23,10 @@ export class ASTInterpreter {
|
|
|
14
23
|
_$filter: ng.FilterService;
|
|
15
24
|
/**
|
|
16
25
|
* Compiles the AST into a function.
|
|
17
|
-
* @param {
|
|
18
|
-
* @returns {
|
|
26
|
+
* @param {ASTNode} ast - The AST to compile.
|
|
27
|
+
* @returns {CompiledExpression}
|
|
19
28
|
*/
|
|
20
|
-
compile(
|
|
21
|
-
ast: import("./ast/ast.js").ASTNode,
|
|
22
|
-
): import("./interface.ts").CompiledExpression;
|
|
29
|
+
compile(ast: ASTNode): CompiledExpression;
|
|
23
30
|
/**
|
|
24
31
|
* Unary plus operation.
|
|
25
32
|
* @param {function} argument - The argument function.
|
|
@@ -218,8 +225,13 @@ export class ASTInterpreter {
|
|
|
218
225
|
): Function;
|
|
219
226
|
#private;
|
|
220
227
|
}
|
|
221
|
-
export type
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
export type ASTNode = import("./ast/ast-node.ts").ASTNode;
|
|
229
|
+
export type BodyNode = import("./ast/ast-node.ts").BodyNode;
|
|
230
|
+
export type ExpressionNode = import("./ast/ast-node.ts").ExpressionNode;
|
|
231
|
+
export type ArrayNode = import("./ast/ast-node.ts").ArrayNode;
|
|
232
|
+
export type LiteralNode = import("./ast/ast-node.ts").LiteralNode;
|
|
233
|
+
export type ObjectNode = import("./ast/ast-node.ts").ObjectNode;
|
|
234
|
+
export type ObjectPropertyNode = import("./ast/ast-node.ts").ObjectPropertyNode;
|
|
235
|
+
export type CompiledExpression = import("./interface.ts").CompiledExpression;
|
|
236
|
+
export type CompiledExpressionFunction =
|
|
237
|
+
import("./interface.ts").CompiledExpressionFunction;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { CompiledExpression } from "../parse/interface.ts";
|
|
2
2
|
export type ListenerFn = (newValue?: any, originalTarget?: object) => void;
|
|
3
|
-
export type NonScope = string[] | boolean
|
|
3
|
+
export type NonScope = string[] | boolean;
|
|
4
|
+
export interface NonScopeMarked {
|
|
5
|
+
$nonscope?: NonScope;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
constructor?: {
|
|
8
|
+
$nonscope?: NonScope;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
4
11
|
export interface Listener {
|
|
5
12
|
originalTarget: any;
|
|
6
13
|
listenerFn: ListenerFn;
|
|
@@ -9,17 +16,16 @@ export interface Listener {
|
|
|
9
16
|
scopeId: number;
|
|
10
17
|
property: string[];
|
|
11
18
|
watchProp?: string;
|
|
12
|
-
foreignListener?: ProxyConstructor;
|
|
13
19
|
}
|
|
14
20
|
export interface ScopeEvent {
|
|
15
21
|
/**
|
|
16
22
|
* the scope on which the event was $emit-ed or $broadcast-ed.
|
|
17
23
|
*/
|
|
18
|
-
targetScope: ng.Scope
|
|
24
|
+
targetScope: typeof Proxy<ng.Scope>;
|
|
19
25
|
/**
|
|
20
26
|
* the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
|
|
21
27
|
*/
|
|
22
|
-
currentScope: ng.Scope;
|
|
28
|
+
currentScope: typeof Proxy<ng.Scope> | null;
|
|
23
29
|
/**
|
|
24
30
|
* name of the event.
|
|
25
31
|
*/
|
|
@@ -32,6 +38,10 @@ export interface ScopeEvent {
|
|
|
32
38
|
* calling preventDefault sets defaultPrevented flag to true.
|
|
33
39
|
*/
|
|
34
40
|
preventDefault(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Whether propagation has been stopped
|
|
43
|
+
*/
|
|
44
|
+
stopped: boolean;
|
|
35
45
|
/**
|
|
36
46
|
* true if preventDefault was called.
|
|
37
47
|
*/
|