@mintjamsinc/ichigojs 0.1.59 → 0.1.61

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.
@@ -1,5 +1,13 @@
1
1
  import { LogLevel } from "./util/LogLevel";
2
2
  import { WatcherDictionary } from "./VWatcherOptions";
3
+ /**
4
+ * Definition of a computed property. Either a getter function, or an object exposing both
5
+ * a getter and a setter (writable computed).
6
+ */
7
+ export type VComputedDefinition = (() => unknown) | {
8
+ get: () => unknown;
9
+ set: (value: any) => void;
10
+ };
3
11
  export interface VApplicationOptions {
4
12
  /**
5
13
  * A function that returns the initial data for the application.
@@ -8,10 +16,15 @@ export interface VApplicationOptions {
8
16
  data: () => unknown;
9
17
  /**
10
18
  * A dictionary of computed properties for the application.
11
- * Each key is the name of the computed property, and the value is a function that computes its value.
19
+ * Each key is the name of the computed property, and the value is either:
20
+ * - a getter function that computes its value (read-only computed), or
21
+ * - an object `{ get, set }` that exposes both a getter and a setter (writable computed).
22
+ *
23
+ * Writable computed properties allow expressions like `v-model="myComputed"` to assign through
24
+ * the `set` function, while reads still go through `get`.
12
25
  */
13
26
  computed?: {
14
- [key: string]: () => unknown;
27
+ [key: string]: VComputedDefinition;
15
28
  };
16
29
  /**
17
30
  * A dictionary of methods for the application.
@@ -63,6 +63,14 @@ export declare class VBindings {
63
63
  * @param value The binding value.
64
64
  */
65
65
  setSilent(key: string, value: any): void;
66
+ /**
67
+ * Registers a setter for a writable computed property. When the given key is assigned
68
+ * through the bindings proxy, the setter will be invoked instead of writing directly to
69
+ * the local store.
70
+ * @param key The computed property name.
71
+ * @param setter The setter function to invoke on assignment.
72
+ */
73
+ registerWritableComputed(key: string, setter: (value: any) => void): void;
66
74
  /**
67
75
  * Manually adds an identifier to the set of changed identifiers.
68
76
  * This is useful for computed properties that need to mark themselves as changed
@@ -29,5 +29,7 @@ export declare enum StandardDirectiveName {
29
29
  /** Raw HTML content directive. */
30
30
  V_HTML = "v-html",
31
31
  /** Text content directive. */
32
- V_TEXT = "v-text"
32
+ V_TEXT = "v-text",
33
+ /** Focus management directive. */
34
+ V_FOCUS = "v-focus"
33
35
  }
@@ -0,0 +1,87 @@
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 managing focus on form elements.
8
+ *
9
+ * Usage:
10
+ * <input v-focus> Focus once on mount.
11
+ * <input v-focus.select> Focus + select all on mount.
12
+ * <input v-focus="isOpen"> Focus when expression transitions from falsy to truthy.
13
+ * <input v-focus.select="isOpen"> Conditional focus + select all.
14
+ * <input v-focus.cursor-end="isOpen"> Conditional focus + place caret at end.
15
+ *
16
+ * Behavior notes:
17
+ * - Without an expression, the element is focused exactly once after mount.
18
+ * - With an expression, focus fires only on the falsy -> truthy edge,
19
+ * so the user is not repeatedly re-focused on every reactive update.
20
+ * - If the value is already truthy on mount, the element is focused.
21
+ * - Focus is deferred via requestAnimationFrame so that elements which
22
+ * become visible just before this directive runs (e.g. inside v-if /
23
+ * display:none containers) can still receive focus reliably.
24
+ */
25
+ export declare class VFocusDirective implements VDirective {
26
+ #private;
27
+ /**
28
+ * @param context The context for parsing the directive.
29
+ */
30
+ constructor(context: VDirectiveParseContext);
31
+ /**
32
+ * @inheritdoc
33
+ */
34
+ get name(): string;
35
+ /**
36
+ * @inheritdoc
37
+ */
38
+ get vNode(): VNode;
39
+ /**
40
+ * @inheritdoc
41
+ */
42
+ get needsAnchor(): boolean;
43
+ /**
44
+ * @inheritdoc
45
+ */
46
+ get bindingsPreparer(): VBindingsPreparer | undefined;
47
+ /**
48
+ * @inheritdoc
49
+ */
50
+ get domUpdater(): VDOMUpdater | undefined;
51
+ /**
52
+ * @inheritdoc
53
+ */
54
+ get templatize(): boolean;
55
+ /**
56
+ * @inheritdoc
57
+ */
58
+ get dependentIdentifiers(): string[];
59
+ /**
60
+ * @inheritdoc
61
+ */
62
+ get onMount(): (() => void) | undefined;
63
+ /**
64
+ * @inheritdoc
65
+ */
66
+ get onMounted(): (() => void) | undefined;
67
+ /**
68
+ * @inheritdoc
69
+ */
70
+ get onUpdate(): (() => void) | undefined;
71
+ /**
72
+ * @inheritdoc
73
+ */
74
+ get onUpdated(): (() => void) | undefined;
75
+ /**
76
+ * @inheritdoc
77
+ */
78
+ get onUnmount(): (() => void) | undefined;
79
+ /**
80
+ * @inheritdoc
81
+ */
82
+ get onUnmounted(): (() => void) | undefined;
83
+ /**
84
+ * @inheritdoc
85
+ */
86
+ destroy(): void;
87
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintjamsinc/ichigojs",
3
- "version": "0.1.59",
3
+ "version": "0.1.61",
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",