@mintjamsinc/ichigojs 0.1.67 → 0.1.68
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 +146 -7
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +146 -7
- 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 +146 -7
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/VBindings.d.ts +7 -0
- package/dist/types/ichigo/util/ReactiveProxy.d.ts +47 -1
- package/package.json +1 -1
|
@@ -56,6 +56,13 @@ export declare class VBindings {
|
|
|
56
56
|
* @param key The binding name.
|
|
57
57
|
*/
|
|
58
58
|
remove(key: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Releases all external proxy subscriptions held by these bindings.
|
|
61
|
+
* Should be called when the owning application is unmounted so the parent
|
|
62
|
+
* application's reactive objects do not keep references to listener closures
|
|
63
|
+
* (and through them, this bindings instance) alive.
|
|
64
|
+
*/
|
|
65
|
+
destroy(): void;
|
|
59
66
|
/**
|
|
60
67
|
* Sets a binding value without triggering onChange callback.
|
|
61
68
|
* This is useful for internal updates that shouldn't trigger reactivity.
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A listener notified when something changes inside a reactive subtree.
|
|
3
|
+
* Receives the full source path of the changed property (e.g. "items[0].name").
|
|
4
|
+
*/
|
|
5
|
+
type ReactiveListener = (changedPath?: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* A dispatcher owns the set of listeners attached to a given proxy subtree.
|
|
8
|
+
* The same dispatcher instance is shared by every nested proxy reached
|
|
9
|
+
* through a single outermost create() call, so changes at any depth fan out
|
|
10
|
+
* to every subscriber once.
|
|
11
|
+
*/
|
|
12
|
+
type ReactiveDispatcher = {
|
|
13
|
+
listeners: Set<ReactiveListener>;
|
|
14
|
+
};
|
|
1
15
|
/**
|
|
2
16
|
* Utility class for creating reactive proxies that automatically track changes.
|
|
3
17
|
*/
|
|
@@ -22,6 +36,13 @@ export declare class ReactiveProxy {
|
|
|
22
36
|
* This allows retrieving the source path of an object for computed property mapping.
|
|
23
37
|
*/
|
|
24
38
|
private static proxyPaths;
|
|
39
|
+
/**
|
|
40
|
+
* Dispatchers per (target, path). Every target reached while walking a proxy
|
|
41
|
+
* subtree registers an entry pointing at the same dispatcher as the outermost
|
|
42
|
+
* proxy of that subtree, so callers can look up the dispatcher from any
|
|
43
|
+
* intermediate proxy when subscribing.
|
|
44
|
+
*/
|
|
45
|
+
private static dispatchers;
|
|
25
46
|
/**
|
|
26
47
|
* A Map to store path aliases.
|
|
27
48
|
* Key: alias path (e.g., "editingNestedStep.steps")
|
|
@@ -36,9 +57,33 @@ export declare class ReactiveProxy {
|
|
|
36
57
|
* @param target The object to make reactive.
|
|
37
58
|
* @param onChange Callback function to call when the object changes. Receives the full path of the changed property.
|
|
38
59
|
* @param path The current path in the object tree (used internally for nested objects).
|
|
60
|
+
* @param inheritedDispatcher Internal: the dispatcher inherited from an enclosing create() call when wrapping a nested target. External callers must omit this.
|
|
39
61
|
* @returns A reactive proxy of the target object.
|
|
40
62
|
*/
|
|
41
|
-
static create<T extends object>(target: T, onChange
|
|
63
|
+
static create<T extends object>(target: T, onChange?: (changedPath?: string) => void, path?: string, inheritedDispatcher?: ReactiveDispatcher): T;
|
|
64
|
+
/**
|
|
65
|
+
* Looks up the dispatcher associated with (target, path), or installs a new one.
|
|
66
|
+
* When called for a nested target during proxy walking, the enclosing dispatcher
|
|
67
|
+
* is reused so a single subtree fans out changes through one notification path.
|
|
68
|
+
*/
|
|
69
|
+
private static resolveDispatcher;
|
|
70
|
+
/**
|
|
71
|
+
* Invokes every listener attached to the dispatcher.
|
|
72
|
+
* Iterates a snapshot of the listener set so unsubscribing during dispatch is safe.
|
|
73
|
+
*/
|
|
74
|
+
private static dispatch;
|
|
75
|
+
/**
|
|
76
|
+
* Subscribes a listener to changes inside the subtree of an existing reactive proxy.
|
|
77
|
+
*
|
|
78
|
+
* The listener is scoped by the proxy's source path: only changes at or below that
|
|
79
|
+
* path are delivered, which lets a child component receive notifications when the
|
|
80
|
+
* nested contents of a prop change even though the prop reference itself is unchanged.
|
|
81
|
+
*
|
|
82
|
+
* @param proxyOrTarget A proxy returned from create(), or the underlying target object.
|
|
83
|
+
* @param listener Called with the full source path of every relevant change.
|
|
84
|
+
* @returns A function that removes the subscription.
|
|
85
|
+
*/
|
|
86
|
+
static subscribe(proxyOrTarget: object, listener: ReactiveListener): () => void;
|
|
42
87
|
/**
|
|
43
88
|
* Checks if the given object is a reactive proxy.
|
|
44
89
|
*
|
|
@@ -118,3 +163,4 @@ export declare class ReactiveProxy {
|
|
|
118
163
|
*/
|
|
119
164
|
static doesChangeMatchIdentifier(changePath: string, identifier: string): boolean;
|
|
120
165
|
}
|
|
166
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintjamsinc/ichigojs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.68",
|
|
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",
|