@mintjamsinc/ichigojs 0.1.0 → 0.1.1
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.esm.js +969 -698
- package/dist/ichigo.esm.js.map +1 -1
- package/dist/ichigo.esm.min.js +1 -1
- package/dist/ichigo.esm.min.js.map +1 -1
- package/dist/ichigo.umd.js +969 -698
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/ichigo.umd.min.js.map +1 -1
- package/dist/types/ichigo/VApplication.d.ts +1 -19
- package/dist/types/ichigo/VBindings.d.ts +53 -3
- package/dist/types/ichigo/VBindingsInit.d.ts +15 -0
- package/dist/types/ichigo/VBindingsPreparer.d.ts +4 -6
- package/dist/types/ichigo/VDOMUpdater.d.ts +2 -2
- package/dist/types/ichigo/VNode.d.ts +24 -8
- package/dist/types/ichigo/VNodeInit.d.ts +3 -7
- package/dist/types/ichigo/directives/VBindDirective.d.ts +8 -0
- package/dist/types/ichigo/directives/VConditionalDirective.d.ts +8 -0
- package/dist/types/ichigo/directives/VConditionalDirectiveContext.d.ts +5 -0
- package/dist/types/ichigo/directives/VDirective.d.ts +17 -0
- package/dist/types/ichigo/directives/VForDirective.d.ts +8 -0
- package/dist/types/ichigo/directives/VModelDirective.d.ts +8 -0
- package/dist/types/ichigo/directives/VOnDirective.d.ts +8 -0
- package/dist/types/ichigo/directives/VShowDirective.d.ts +8 -0
- package/package.json +1 -1
@@ -31,7 +31,7 @@ export declare class VApplication {
|
|
31
31
|
/**
|
32
32
|
* Gets the bindings for the virtual application.
|
33
33
|
*/
|
34
|
-
get bindings(): VBindings;
|
34
|
+
get bindings(): VBindings | undefined;
|
35
35
|
/**
|
36
36
|
* Gets the log manager.
|
37
37
|
*/
|
@@ -40,27 +40,9 @@ export declare class VApplication {
|
|
40
40
|
* Gets the function dependencies for the virtual application.
|
41
41
|
*/
|
42
42
|
get functionDependencies(): Record<string, string[]>;
|
43
|
-
/**
|
44
|
-
* Gets the list of identifiers that can trigger updates.
|
45
|
-
*/
|
46
|
-
get preparableIdentifiers(): string[];
|
47
43
|
/**
|
48
44
|
* Mounts the application.
|
49
45
|
* @param selectors The CSS selectors to identify the root element.
|
50
46
|
*/
|
51
47
|
mount(selectors: string): void;
|
52
|
-
/**
|
53
|
-
* Schedules a DOM update in the next microtask.
|
54
|
-
* Multiple calls within the same event loop will be batched into a single update.
|
55
|
-
*/
|
56
|
-
scheduleUpdate(): void;
|
57
|
-
/**
|
58
|
-
* Executes an immediate DOM update.
|
59
|
-
*/
|
60
|
-
update(): void;
|
61
|
-
/**
|
62
|
-
* Executes a callback after the next DOM update.
|
63
|
-
* @param callback The callback to execute.
|
64
|
-
*/
|
65
|
-
nextTick(callback: () => void): void;
|
66
48
|
}
|
@@ -1,9 +1,59 @@
|
|
1
|
+
import { VBindingsInit } from "./VBindingsInit";
|
1
2
|
/**
|
2
3
|
* A dictionary representing bindings for a virtual node.
|
4
|
+
* The key is the binding name, and the value is the binding value.
|
5
|
+
* Supports hierarchical lookup through parent bindings.
|
3
6
|
*/
|
4
|
-
export
|
7
|
+
export declare class VBindings {
|
8
|
+
#private;
|
5
9
|
/**
|
6
|
-
*
|
10
|
+
* Creates a new instance of VBindings.
|
11
|
+
* @param parent The parent bindings, if any.
|
7
12
|
*/
|
8
|
-
|
13
|
+
constructor(args?: VBindingsInit);
|
14
|
+
/**
|
15
|
+
* Gets the raw bindings.
|
16
|
+
* If a key is not found locally, it searches parent bindings recursively.
|
17
|
+
*/
|
18
|
+
get raw(): Record<string, any>;
|
19
|
+
/**
|
20
|
+
* Indicates whether there are any changed identifiers.
|
21
|
+
*/
|
22
|
+
get hasChanges(): boolean;
|
23
|
+
/**
|
24
|
+
* Gets the list of changed identifiers.
|
25
|
+
*/
|
26
|
+
get changes(): string[];
|
27
|
+
/**
|
28
|
+
* Indicates whether this is the root bindings (i.e., has no parent).
|
29
|
+
*/
|
30
|
+
get isRoot(): boolean;
|
31
|
+
/**
|
32
|
+
* Clears the set of changed identifiers.
|
33
|
+
*/
|
34
|
+
clearChanges(): void;
|
35
|
+
/**
|
36
|
+
* Sets a binding value.
|
37
|
+
* @param key The binding name.
|
38
|
+
* @param value The binding value.
|
39
|
+
*/
|
40
|
+
set(key: string, value: any): void;
|
41
|
+
/**
|
42
|
+
* Gets a binding value.
|
43
|
+
* @param key The binding name.
|
44
|
+
* @returns The binding value, or undefined if not found.
|
45
|
+
*/
|
46
|
+
get(key: string): any;
|
47
|
+
/**
|
48
|
+
* Checks if a binding exists.
|
49
|
+
* @param key The binding name.
|
50
|
+
* @param recursive Whether to search parent bindings. Default is true.
|
51
|
+
* @returns True if the binding exists, false otherwise.
|
52
|
+
*/
|
53
|
+
has(key: string, recursive?: boolean): boolean;
|
54
|
+
/**
|
55
|
+
* Removes a local binding.
|
56
|
+
* @param key The binding name.
|
57
|
+
*/
|
58
|
+
remove(key: string): void;
|
9
59
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { VBindings } from "./VBindings";
|
2
|
+
/**
|
3
|
+
* Initialization arguments for bindings.
|
4
|
+
*/
|
5
|
+
export interface VBindingsInit {
|
6
|
+
/**
|
7
|
+
* The parent bindings, if any.
|
8
|
+
*/
|
9
|
+
parent?: VBindings;
|
10
|
+
/**
|
11
|
+
* The change tracker, if any.
|
12
|
+
* @param identifier The identifier that changed.
|
13
|
+
*/
|
14
|
+
onChange?: (identifier: string) => void;
|
15
|
+
}
|
@@ -1,13 +1,12 @@
|
|
1
|
-
import { VBindings } from "./VBindings";
|
2
1
|
/**
|
3
2
|
* Interface representing a preparer for VBindings in the virtual DOM.
|
4
3
|
*/
|
5
4
|
export interface VBindingsPreparer {
|
6
5
|
/**
|
7
|
-
* The list of identifiers that this preparer
|
8
|
-
*
|
6
|
+
* The list of identifiers that this preparer depends on.
|
7
|
+
* Changes to these identifiers may trigger the need to prepare bindings again.
|
9
8
|
*/
|
10
|
-
get
|
9
|
+
get dependentIdentifiers(): string[];
|
11
10
|
/**
|
12
11
|
* The list of identifiers that can be prepared by this preparer.
|
13
12
|
* This is a subset of the identifiers property.
|
@@ -17,7 +16,6 @@ export interface VBindingsPreparer {
|
|
17
16
|
* Prepares the given VBindings for use in the virtual DOM.
|
18
17
|
* This method is called before the bindings are applied to the DOM.
|
19
18
|
* It allows for any necessary transformations or initializations of the bindings.
|
20
|
-
* @param bindings The original VBindings to be prepared.
|
21
19
|
*/
|
22
|
-
prepareBindings(
|
20
|
+
prepareBindings(): void;
|
23
21
|
}
|
@@ -5,10 +5,10 @@
|
|
5
5
|
*/
|
6
6
|
export interface VDOMUpdater {
|
7
7
|
/**
|
8
|
-
*
|
8
|
+
* The list of identifiers that this updater depends on.
|
9
9
|
* Changes to these identifiers may trigger the updater to apply changes to the DOM.
|
10
10
|
*/
|
11
|
-
get
|
11
|
+
get dependentIdentifiers(): string[];
|
12
12
|
/**
|
13
13
|
* Applies the changes from the virtual DOM to the actual DOM.
|
14
14
|
* This method is called when the identifiers change or when an update is needed.
|
@@ -3,7 +3,11 @@ import { VBindings } from "./VBindings";
|
|
3
3
|
import { VCloser } from "./VCloser";
|
4
4
|
import { VDirectiveManager } from "./directives/VDirectiveManager";
|
5
5
|
import { VNodeInit } from "./VNodeInit";
|
6
|
-
|
6
|
+
/**
|
7
|
+
* Represents a virtual node in the virtual DOM.
|
8
|
+
* A virtual node corresponds to a real DOM node and contains additional information for data binding and directives.
|
9
|
+
* This class is responsible for managing the state and behavior of the virtual node, including its bindings, directives, and child nodes.
|
10
|
+
*/
|
7
11
|
export declare class VNode {
|
8
12
|
#private;
|
9
13
|
/**
|
@@ -50,7 +54,7 @@ export declare class VNode {
|
|
50
54
|
/**
|
51
55
|
* The data bindings associated with this virtual node, if any.
|
52
56
|
*/
|
53
|
-
get bindings(): VBindings
|
57
|
+
get bindings(): VBindings;
|
54
58
|
/**
|
55
59
|
* The directive manager associated with this virtual node.
|
56
60
|
* This manages any directives applied to the node.
|
@@ -78,22 +82,34 @@ export declare class VNode {
|
|
78
82
|
* The list of identifiers for this virtual node.
|
79
83
|
* This includes variable and function names used in expressions.
|
80
84
|
*/
|
81
|
-
get
|
85
|
+
get dependentIdentifiers(): string[];
|
82
86
|
get preparableIdentifiers(): string[];
|
83
87
|
/**
|
84
88
|
* Updates the virtual node and its children based on the current bindings.
|
85
89
|
* This method evaluates any expressions in text nodes and applies effectors from directives.
|
86
90
|
* It also recursively updates child virtual nodes.
|
87
91
|
* @param context The context for the update operation.
|
92
|
+
* This includes the current bindings and a list of identifiers that have changed.
|
88
93
|
*/
|
89
|
-
update(
|
94
|
+
update(): void;
|
90
95
|
/**
|
91
|
-
*
|
92
|
-
* This
|
93
|
-
*
|
96
|
+
* Forces an update of the virtual node and its children, regardless of changed identifiers.
|
97
|
+
* This method evaluates any expressions in text nodes and applies effectors from directives.
|
98
|
+
* It also recursively updates child virtual nodes.
|
99
|
+
* This is useful when an immediate update is needed, bypassing the usual change detection.
|
100
|
+
*/
|
101
|
+
forceUpdate(): void;
|
102
|
+
/**
|
103
|
+
* Adds a child virtual node to this virtual node.
|
104
|
+
* @param child The child virtual node to add.
|
105
|
+
*/
|
106
|
+
addChild(child: VNode): void;
|
107
|
+
/**
|
108
|
+
* Adds a dependent virtual node that relies on this node's bindings.
|
109
|
+
* @param dependent The dependent virtual node to add.
|
94
110
|
* @returns A list of closers to unregister the dependency, or undefined if no dependency was added.
|
95
111
|
*/
|
96
|
-
|
112
|
+
addDependent(dependent: VNode): VCloser[] | undefined;
|
97
113
|
/**
|
98
114
|
* Cleans up any resources used by this virtual node.
|
99
115
|
* This method is called when the virtual node is no longer needed.
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { VApplication } from "./VApplication";
|
2
2
|
import { VBindings } from "./VBindings";
|
3
|
-
import { VBindingsPreparer } from "./VBindingsPreparer";
|
4
3
|
import { VNode } from "./VNode";
|
5
4
|
/**
|
6
5
|
* Initialization arguments for a virtual node.
|
@@ -19,11 +18,8 @@ export interface VNodeInit {
|
|
19
18
|
*/
|
20
19
|
parentVNode?: VNode;
|
21
20
|
/**
|
22
|
-
* The
|
21
|
+
* The bindings associated with this virtual node.
|
22
|
+
* This is optional and may be undefined if there are no bindings.
|
23
23
|
*/
|
24
|
-
bindings
|
25
|
-
/**
|
26
|
-
* The preparer for VBindings, if any.
|
27
|
-
*/
|
28
|
-
bindingsPreparer?: VBindingsPreparer;
|
24
|
+
bindings?: VBindings;
|
29
25
|
}
|
@@ -44,6 +44,14 @@ export declare class VBindDirective implements VDirective {
|
|
44
44
|
* @inheritdoc
|
45
45
|
*/
|
46
46
|
get domUpdater(): VDOMUpdater | undefined;
|
47
|
+
/**
|
48
|
+
* @inheritdoc
|
49
|
+
*/
|
50
|
+
get templatize(): boolean;
|
51
|
+
/**
|
52
|
+
* @inheritdoc
|
53
|
+
*/
|
54
|
+
get dependentIdentifiers(): string[];
|
47
55
|
/**
|
48
56
|
* Indicates if this directive is binding the "key" attribute.
|
49
57
|
* The "key" attribute is special and is used for optimizing rendering of lists.
|
@@ -30,6 +30,14 @@ export declare abstract class VConditionalDirective implements VDirective {
|
|
30
30
|
* @inheritdoc
|
31
31
|
*/
|
32
32
|
get domUpdater(): VDOMUpdater | undefined;
|
33
|
+
/**
|
34
|
+
* @inheritdoc
|
35
|
+
*/
|
36
|
+
get templatize(): boolean;
|
37
|
+
/**
|
38
|
+
* @inheritdoc
|
39
|
+
*/
|
40
|
+
get dependentIdentifiers(): string[];
|
33
41
|
/**
|
34
42
|
* The context for managing related conditional directives (v-if, v-else-if, v-else).
|
35
43
|
*/
|
@@ -4,6 +4,11 @@ import { VConditionalDirective } from "./VConditionalDirective";
|
|
4
4
|
*/
|
5
5
|
export declare class VConditionalDirectiveContext {
|
6
6
|
#private;
|
7
|
+
/**
|
8
|
+
* Gets a list of all variable and function names used in the expressions of the associated directives.
|
9
|
+
* This is useful for determining dependencies for re-evaluation when data changes.
|
10
|
+
*/
|
11
|
+
get allDependentIdentifiers(): string[];
|
7
12
|
/**
|
8
13
|
* Adds a directive (v-else-if or v-else) to the conditional context.
|
9
14
|
* @param directive The directive to add.
|
@@ -40,6 +40,23 @@ export interface VDirective {
|
|
40
40
|
* If the directive does not need to update the DOM, this may return undefined.
|
41
41
|
*/
|
42
42
|
get domUpdater(): VDOMUpdater | undefined;
|
43
|
+
/**
|
44
|
+
* Indicates whether this directive requires the template content to be preserved.
|
45
|
+
* If true, the original template content will be kept intact and used as needed by the directive.
|
46
|
+
* This is typically true for directives that need to re-render or clone the template content,
|
47
|
+
* such as v-for and v-if.
|
48
|
+
* If false, the template content may be modified or removed as part of the directive's processing.
|
49
|
+
* Directives that do not need to preserve the original template content should return false.
|
50
|
+
* This property is used by the VNode to determine how to handle the template content.
|
51
|
+
* Note: This property should be implemented as a getter to allow dynamic evaluation based on directive state.
|
52
|
+
*/
|
53
|
+
get templatize(): boolean;
|
54
|
+
/**
|
55
|
+
* Gets the list of dependent identifiers for this directive.
|
56
|
+
* These are the variable and function names that the directive depends on.
|
57
|
+
* @returns An array of dependent identifier names.
|
58
|
+
*/
|
59
|
+
get dependentIdentifiers(): string[];
|
43
60
|
/**
|
44
61
|
* Cleans up any resources used by the directive.
|
45
62
|
* This method is called when the directive is no longer needed.
|
@@ -44,6 +44,14 @@ export declare class VForDirective implements VDirective {
|
|
44
44
|
* @inheritdoc
|
45
45
|
*/
|
46
46
|
get domUpdater(): VDOMUpdater | undefined;
|
47
|
+
/**
|
48
|
+
* @inheritdoc
|
49
|
+
*/
|
50
|
+
get templatize(): boolean;
|
51
|
+
/**
|
52
|
+
* @inheritdoc
|
53
|
+
*/
|
54
|
+
get dependentIdentifiers(): string[];
|
47
55
|
/**
|
48
56
|
* @inheritdoc
|
49
57
|
*/
|
@@ -40,6 +40,14 @@ export declare class VModelDirective implements VDirective {
|
|
40
40
|
* @inheritdoc
|
41
41
|
*/
|
42
42
|
get domUpdater(): VDOMUpdater | undefined;
|
43
|
+
/**
|
44
|
+
* @inheritdoc
|
45
|
+
*/
|
46
|
+
get templatize(): boolean;
|
47
|
+
/**
|
48
|
+
* @inheritdoc
|
49
|
+
*/
|
50
|
+
get dependentIdentifiers(): string[];
|
43
51
|
/**
|
44
52
|
* @inheritdoc
|
45
53
|
*/
|
@@ -42,6 +42,14 @@ export declare class VOnDirective implements VDirective {
|
|
42
42
|
* @inheritdoc
|
43
43
|
*/
|
44
44
|
get domUpdater(): VDOMUpdater | undefined;
|
45
|
+
/**
|
46
|
+
* @inheritdoc
|
47
|
+
*/
|
48
|
+
get templatize(): boolean;
|
49
|
+
/**
|
50
|
+
* @inheritdoc
|
51
|
+
*/
|
52
|
+
get dependentIdentifiers(): string[];
|
45
53
|
/**
|
46
54
|
* @inheritdoc
|
47
55
|
*/
|
@@ -39,6 +39,14 @@ export declare class VShowDirective implements VDirective {
|
|
39
39
|
* @inheritdoc
|
40
40
|
*/
|
41
41
|
get domUpdater(): VDOMUpdater | undefined;
|
42
|
+
/**
|
43
|
+
* @inheritdoc
|
44
|
+
*/
|
45
|
+
get templatize(): boolean;
|
46
|
+
/**
|
47
|
+
* @inheritdoc
|
48
|
+
*/
|
49
|
+
get dependentIdentifiers(): string[];
|
42
50
|
/**
|
43
51
|
* Makes the node visible by resetting its display style.
|
44
52
|
* If the node is already visible, no action is taken.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mintjamsinc/ichigojs",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.1",
|
4
4
|
"description": "ichigo.js - Simple and intuitive reactive framework. Lightweight, fast, and user-friendly virtual DOM library",
|
5
5
|
"main": "./dist/ichigo.umd.js",
|
6
6
|
"module": "./dist/ichigo.esm.js",
|