@mintjamsinc/ichigojs 0.1.86 → 0.1.87
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/ichigo.cjs +1668 -1419
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +1668 -1419
- package/dist/ichigo.esm.js.map +1 -1
- package/dist/ichigo.esm.min.js +1 -1
- package/dist/ichigo.min.cjs +1 -1
- package/dist/ichigo.umd.js +1668 -1419
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/VBindings.d.ts +16 -0
- package/dist/types/ichigo/VBindingsPreparer.d.ts +6 -0
- package/dist/types/ichigo/VDOMUpdater.d.ts +6 -0
- package/dist/types/ichigo/VTextEvaluator.d.ts +6 -0
- package/dist/types/ichigo/directives/VConditionalDirective.d.ts +5 -0
- package/dist/types/ichigo/directives/VConditionalDirectiveContext.d.ts +5 -0
- package/dist/types/ichigo/util/ExpressionEvaluator.d.ts +18 -0
- package/dist/types/ichigo/util/ReactiveProxy.d.ts +34 -0
- package/package.json +1 -1
|
@@ -134,4 +134,20 @@ export declare class VBindings {
|
|
|
134
134
|
* global aliases (computed properties etc.).
|
|
135
135
|
*/
|
|
136
136
|
doesChangeMatchIdentifier(changePath: string, identifier: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Checks whether any of the changes affects an expression with the given identifiers.
|
|
139
|
+
*
|
|
140
|
+
* An identifier with a run-time index ("frames[*].url" for frames[i].url) normally
|
|
141
|
+
* matches a change at any index. When trackedPaths holds the paths the expression read
|
|
142
|
+
* during its last evaluation, the identifier is narrowed to the concrete paths among
|
|
143
|
+
* them ("frames[0].url"), so a write to another element is ignored. When no recorded
|
|
144
|
+
* path fits the identifier (not evaluated yet, a raw object, a short-circuited read),
|
|
145
|
+
* the identifier keeps matching every index.
|
|
146
|
+
*
|
|
147
|
+
* @param changes The change paths of the current update cycle.
|
|
148
|
+
* @param identifiers The identifiers the expression depends on.
|
|
149
|
+
* @param trackedPaths The paths read during the expression's last evaluation, if recorded.
|
|
150
|
+
* @returns True if some change matches some identifier.
|
|
151
|
+
*/
|
|
152
|
+
isAffected(changes: string[], identifiers: string[], trackedPaths?: ReadonlySet<string>): boolean;
|
|
137
153
|
}
|
|
@@ -7,6 +7,12 @@ export interface VBindingsPreparer {
|
|
|
7
7
|
* Changes to these identifiers may trigger the need to prepare bindings again.
|
|
8
8
|
*/
|
|
9
9
|
get dependentIdentifiers(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The source paths the preparer's expressions read during their last evaluation,
|
|
12
|
+
* when a dependent identifier has an index known only at run time ("items[*].name").
|
|
13
|
+
* A change is then matched against these concrete paths instead of every index.
|
|
14
|
+
*/
|
|
15
|
+
readonly trackedPaths?: ReadonlySet<string>;
|
|
10
16
|
/**
|
|
11
17
|
* The list of identifiers that can be prepared by this preparer.
|
|
12
18
|
* This is a subset of the identifiers property.
|
|
@@ -9,6 +9,12 @@ export interface VDOMUpdater {
|
|
|
9
9
|
* Changes to these identifiers may trigger the updater to apply changes to the DOM.
|
|
10
10
|
*/
|
|
11
11
|
get dependentIdentifiers(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* The source paths the updater's expressions read during their last evaluation,
|
|
14
|
+
* when a dependent identifier has an index known only at run time ("items[*].name").
|
|
15
|
+
* A change is then matched against these concrete paths instead of every index.
|
|
16
|
+
*/
|
|
17
|
+
readonly trackedPaths?: ReadonlySet<string>;
|
|
12
18
|
/**
|
|
13
19
|
* Applies the changes from the virtual DOM to the actual DOM.
|
|
14
20
|
* This method is called when the identifiers change or when an update is needed.
|
|
@@ -21,6 +21,12 @@ export declare class VTextEvaluator {
|
|
|
21
21
|
* Gets the list of identifiers extracted from the text expressions.
|
|
22
22
|
*/
|
|
23
23
|
get identifiers(): string[];
|
|
24
|
+
/**
|
|
25
|
+
* The source paths read through reactive proxies during the last evaluation.
|
|
26
|
+
* Recorded only when an expression has a run-time index ("items[i].name");
|
|
27
|
+
* undefined before the first evaluation and for texts without such an index.
|
|
28
|
+
*/
|
|
29
|
+
get trackedPaths(): ReadonlySet<string> | undefined;
|
|
24
30
|
/**
|
|
25
31
|
* Evaluates the text with the provided bindings and returns the resulting string.
|
|
26
32
|
* @param bindings The bindings to use for evaluating the expressions.
|
|
@@ -43,6 +43,11 @@ export declare abstract class VConditionalDirective implements VDirective {
|
|
|
43
43
|
* @inheritdoc
|
|
44
44
|
*/
|
|
45
45
|
get dependentIdentifiers(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* The paths the condition read during its last evaluation, when it has an index
|
|
48
|
+
* known only at run time (see ExpressionEvaluator.trackedPaths).
|
|
49
|
+
*/
|
|
50
|
+
get trackedPaths(): ReadonlySet<string> | undefined;
|
|
46
51
|
/**
|
|
47
52
|
* The context for managing related conditional directives (v-if, v-else-if, v-else).
|
|
48
53
|
*/
|
|
@@ -9,6 +9,11 @@ export declare class VConditionalDirectiveContext {
|
|
|
9
9
|
* This is useful for determining dependencies for re-evaluation when data changes.
|
|
10
10
|
*/
|
|
11
11
|
get allDependentIdentifiers(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* The paths the conditions of the chain read during their last evaluation, united
|
|
14
|
+
* across directives, or undefined when no condition has a run-time index.
|
|
15
|
+
*/
|
|
16
|
+
get trackedPaths(): ReadonlySet<string> | undefined;
|
|
12
17
|
/**
|
|
13
18
|
* Adds a directive (v-else-if or v-else) to the conditional context.
|
|
14
19
|
* @param directive The directive to add.
|
|
@@ -53,6 +53,16 @@ export declare class ExpressionEvaluator {
|
|
|
53
53
|
* Additional context variables (e.g., 'event', '$ctx').
|
|
54
54
|
*/
|
|
55
55
|
private readonly additionalContext?;
|
|
56
|
+
/**
|
|
57
|
+
* Whether any identifier has an index known only at run time ("items[*].name").
|
|
58
|
+
* Only then are the paths read during evaluation worth recording.
|
|
59
|
+
*/
|
|
60
|
+
private readonly hasDynamicIndex;
|
|
61
|
+
/**
|
|
62
|
+
* The source paths read through reactive proxies during the last evaluation,
|
|
63
|
+
* or undefined before the first evaluation and when nothing is recorded.
|
|
64
|
+
*/
|
|
65
|
+
private trackedPathSet?;
|
|
56
66
|
/**
|
|
57
67
|
* Private constructor. Use ExpressionEvaluator.create() to create instances.
|
|
58
68
|
*/
|
|
@@ -82,6 +92,14 @@ export declare class ExpressionEvaluator {
|
|
|
82
92
|
* @returns The result of the expression evaluation.
|
|
83
93
|
*/
|
|
84
94
|
evaluate(): any;
|
|
95
|
+
/**
|
|
96
|
+
* The source paths read through reactive proxies during the last evaluation,
|
|
97
|
+
* recorded only for an expression with a run-time index ("items[i].name").
|
|
98
|
+
* Each evaluation replaces the previous set, so a path read for a former
|
|
99
|
+
* index value is dropped as soon as the expression runs with the new one.
|
|
100
|
+
* Undefined before the first evaluation and for expressions without such an index.
|
|
101
|
+
*/
|
|
102
|
+
get trackedPaths(): ReadonlySet<string> | undefined;
|
|
85
103
|
/**
|
|
86
104
|
* Evaluates the expression and returns the result as a boolean.
|
|
87
105
|
*
|
|
@@ -55,6 +55,40 @@ export declare class ReactiveProxy {
|
|
|
55
55
|
* identifier and whether descendants of the path also match.
|
|
56
56
|
*/
|
|
57
57
|
private static pathPatterns;
|
|
58
|
+
/**
|
|
59
|
+
* The set collecting the paths read through any proxy while track() runs, or
|
|
60
|
+
* undefined when no expression is being tracked.
|
|
61
|
+
*/
|
|
62
|
+
private static tracker?;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a property key is spelled as an array index ("0", "12") rather than a
|
|
65
|
+
* property name. Both the proxy and the expression analyzer decide between
|
|
66
|
+
* "items[0]" and "items.name" with this test alone, so a numeric key on a plain
|
|
67
|
+
* object and a numeric key on an array get the same spelling.
|
|
68
|
+
*
|
|
69
|
+
* @param key The property key as a string.
|
|
70
|
+
* @returns True if the key is a canonical non-negative integer.
|
|
71
|
+
*/
|
|
72
|
+
static isIndexKey(key: string): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Appends a property key to a source path the way change paths are reported:
|
|
75
|
+
* an index in brackets ("items[0]"), a name after a dot ("user.name").
|
|
76
|
+
*
|
|
77
|
+
* @param path The path of the containing object, or "" for a root binding.
|
|
78
|
+
* @param key The property key being appended.
|
|
79
|
+
* @returns The joined path.
|
|
80
|
+
*/
|
|
81
|
+
static joinPath(path: string, key: string | symbol): string;
|
|
82
|
+
/**
|
|
83
|
+
* Runs fn while recording, into paths, the source path of every property read
|
|
84
|
+
* through a reactive proxy. Nested calls record into the innermost set only;
|
|
85
|
+
* the previous set is restored when fn returns or throws.
|
|
86
|
+
*
|
|
87
|
+
* @param paths The set that receives the paths read.
|
|
88
|
+
* @param fn The function to run.
|
|
89
|
+
* @returns The value fn returns.
|
|
90
|
+
*/
|
|
91
|
+
static track<T>(paths: Set<string>, fn: () => T): T;
|
|
58
92
|
/**
|
|
59
93
|
* The `Object.prototype.toString` tags of the *only* value types we deeply
|
|
60
94
|
* proxy. Everything else is returned untouched (raw).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintjamsinc/ichigojs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.87",
|
|
4
4
|
"description": "ichigo.js - Simple and intuitive reactive framework. Lightweight, fast, and user-friendly virtual DOM library",
|
|
5
5
|
"main": "./dist/ichigo.cjs",
|
|
6
6
|
"module": "./dist/ichigo.esm.js",
|