@mintjamsinc/ichigojs 0.1.73 → 0.1.75
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/README.md +99 -1
- package/dist/ichigo.cjs +369 -8
- package/dist/ichigo.cjs.map +1 -1
- package/dist/ichigo.esm.js +369 -8
- 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 +369 -8
- package/dist/ichigo.umd.js.map +1 -1
- package/dist/ichigo.umd.min.js +1 -1
- package/dist/types/ichigo/VApplication.d.ts +27 -0
- package/dist/types/ichigo/VBindings.d.ts +11 -0
- package/dist/types/ichigo/directives/StandardDirectiveName.d.ts +3 -1
- package/dist/types/ichigo/directives/VRefDirective.d.ts +94 -0
- package/dist/types/ichigo/directives/VStandardDirectiveParser.d.ts +1 -0
- package/package.json +1 -1
|
@@ -47,6 +47,11 @@ export declare class VApplication {
|
|
|
47
47
|
* Gets the function dependencies for the virtual application.
|
|
48
48
|
*/
|
|
49
49
|
get functionDependencies(): Record<string, string[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the template references registered via the `ref` directive (Vue's `$refs`). The same
|
|
52
|
+
* object is exposed to data(), methods, and expressions as `$refs`. Non-reactive by design.
|
|
53
|
+
*/
|
|
54
|
+
get refs(): Record<string, Element | Element[]>;
|
|
50
55
|
/**
|
|
51
56
|
* Mounts the application.
|
|
52
57
|
* @param target The CSS selector string or HTMLElement to mount the application to.
|
|
@@ -70,4 +75,26 @@ export declare class VApplication {
|
|
|
70
75
|
* @returns An array of dependent identifiers.
|
|
71
76
|
*/
|
|
72
77
|
resolveDependentIdentifiers(computedName: string, value: any): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Registers a template reference under the given name. Called by the `ref` directive during the
|
|
80
|
+
* mount phase. When {@param asArray} is true (the element lives inside a `v-for`), references
|
|
81
|
+
* accumulate into an array in registration order; otherwise the name holds a single element.
|
|
82
|
+
*
|
|
83
|
+
* Mutates the raw (non-reactive) `$refs` object directly, so this never schedules a render.
|
|
84
|
+
*
|
|
85
|
+
* @param name The ref name.
|
|
86
|
+
* @param element The element (or component host element) to register.
|
|
87
|
+
* @param asArray Whether to collect into an array (refs used inside a v-for).
|
|
88
|
+
*/
|
|
89
|
+
registerRef(name: string, element: Element, asArray: boolean): void;
|
|
90
|
+
/**
|
|
91
|
+
* Removes a template reference registered under the given name. Called by the `ref` directive
|
|
92
|
+
* during the unmount phase. The removal is identity-safe: an entry is only cleared when it still
|
|
93
|
+
* points at {@param element}, so a newly mounted element that reused the name is never clobbered
|
|
94
|
+
* by the teardown of the element it replaced.
|
|
95
|
+
*
|
|
96
|
+
* @param name The ref name.
|
|
97
|
+
* @param element The element whose registration should be removed.
|
|
98
|
+
*/
|
|
99
|
+
unregisterRef(name: string, element: Element): void;
|
|
73
100
|
}
|
|
@@ -38,6 +38,17 @@ export declare class VBindings {
|
|
|
38
38
|
* @param value The binding value.
|
|
39
39
|
*/
|
|
40
40
|
set(key: string, value: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets a binding value in THIS scope's own local store, without walking up to a
|
|
43
|
+
* parent scope. Used for scope-local variables (e.g. v-for loop items) that must
|
|
44
|
+
* shadow — never overwrite — an inherited binding of the same name. Contrast with
|
|
45
|
+
* {@link set}, which retargets a write of an inherited key to the owning parent so
|
|
46
|
+
* that reassignments mutate the original; a loop variable named like a root data /
|
|
47
|
+
* method / computed key (e.g. `t`) would otherwise clobber it.
|
|
48
|
+
* @param key The binding name.
|
|
49
|
+
* @param value The binding value.
|
|
50
|
+
*/
|
|
51
|
+
setLocal(key: string, value: any): void;
|
|
41
52
|
/**
|
|
42
53
|
* Gets a binding value.
|
|
43
54
|
* @param key The binding name.
|
|
@@ -31,5 +31,7 @@ export declare enum StandardDirectiveName {
|
|
|
31
31
|
/** Text content directive. */
|
|
32
32
|
V_TEXT = "v-text",
|
|
33
33
|
/** Focus management directive. */
|
|
34
|
-
V_FOCUS = "v-focus"
|
|
34
|
+
V_FOCUS = "v-focus",
|
|
35
|
+
/** Template reference directive (Vue's `ref` / `$refs`). */
|
|
36
|
+
REF = "ref"
|
|
35
37
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { VNode } from "../VNode";
|
|
2
|
+
import { VBindingsPreparer } from "../VBindingsPreparer";
|
|
3
|
+
import { VDirective } from "./VDirective";
|
|
4
|
+
import { VDirectiveParseContext } from "./VDirectiveParseContext";
|
|
5
|
+
import { VDOMUpdater } from "../VDOMUpdater";
|
|
6
|
+
/**
|
|
7
|
+
* Directive for registering template references (Vue's `ref` / `$refs`).
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* <input ref="search"> Static name. $refs.search === the element.
|
|
11
|
+
* <my-card ref="card"></my-card> On a component: $refs.card === the host element.
|
|
12
|
+
* <li v-for="i in items" ref="rows"> Inside v-for: $refs.rows === array of elements.
|
|
13
|
+
* <input :ref="dynamicName"> Dynamic name from an expression (evaluated at mount).
|
|
14
|
+
* <input :ref="el => collect(el)"> Function ref: called with the element on mount,
|
|
15
|
+
* and with null on unmount (great for v-for / dynamic).
|
|
16
|
+
*
|
|
17
|
+
* Behavior notes:
|
|
18
|
+
* - The reference is registered during the mount phase (before any `@mounted` hook fires) and
|
|
19
|
+
* removed during the unmount phase, mirroring Vue's lifecycle for `$refs`.
|
|
20
|
+
* - `$refs` is intentionally NON-reactive: registering or clearing a ref never schedules a render
|
|
21
|
+
* and must not be used to drive reactive template output (this matches Vue).
|
|
22
|
+
* - When the same `ref` name appears inside a `v-for` (i.e. one of the element's ancestors is a
|
|
23
|
+
* `v-for` template), the entries are collected into an array, in registration order. Reused
|
|
24
|
+
* v-for rows are not re-registered, so the array order is not guaranteed to match DOM order after
|
|
25
|
+
* reordering — the same caveat Vue documents.
|
|
26
|
+
* - Cleanup is identity-safe: a ref slot (or array entry) is only cleared when it still points at
|
|
27
|
+
* THIS element, so a freshly mounted element that reused the name is never clobbered by the
|
|
28
|
+
* teardown of the element it replaced.
|
|
29
|
+
*
|
|
30
|
+
* The directive is purely lifecycle-driven: it has no DOM updater and never templatizes the node.
|
|
31
|
+
*/
|
|
32
|
+
export declare class VRefDirective implements VDirective {
|
|
33
|
+
#private;
|
|
34
|
+
/**
|
|
35
|
+
* @param context The context for parsing the directive.
|
|
36
|
+
*/
|
|
37
|
+
constructor(context: VDirectiveParseContext);
|
|
38
|
+
/**
|
|
39
|
+
* @inheritdoc
|
|
40
|
+
*/
|
|
41
|
+
get name(): string;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
get vNode(): VNode;
|
|
46
|
+
/**
|
|
47
|
+
* @inheritdoc
|
|
48
|
+
*/
|
|
49
|
+
get needsAnchor(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @inheritdoc
|
|
52
|
+
*/
|
|
53
|
+
get bindingsPreparer(): VBindingsPreparer | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* @inheritdoc
|
|
56
|
+
*/
|
|
57
|
+
get domUpdater(): VDOMUpdater | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* @inheritdoc
|
|
60
|
+
*/
|
|
61
|
+
get templatize(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @inheritdoc
|
|
64
|
+
*/
|
|
65
|
+
get dependentIdentifiers(): string[];
|
|
66
|
+
/**
|
|
67
|
+
* @inheritdoc
|
|
68
|
+
*/
|
|
69
|
+
get onMount(): (() => void) | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* @inheritdoc
|
|
72
|
+
*/
|
|
73
|
+
get onMounted(): (() => void) | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* @inheritdoc
|
|
76
|
+
*/
|
|
77
|
+
get onUpdate(): (() => void) | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* @inheritdoc
|
|
80
|
+
*/
|
|
81
|
+
get onUpdated(): (() => void) | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* @inheritdoc
|
|
84
|
+
*/
|
|
85
|
+
get onUnmount(): (() => void) | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* @inheritdoc
|
|
88
|
+
*/
|
|
89
|
+
get onUnmounted(): (() => void) | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* @inheritdoc
|
|
92
|
+
*/
|
|
93
|
+
destroy(): void;
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintjamsinc/ichigojs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
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",
|