@mintjamsinc/ichigojs 0.1.7 → 0.1.9

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,11 +1,25 @@
1
+ /**
2
+ * Standard directive names used in the framework.
3
+ */
1
4
  export declare enum StandardDirectiveName {
5
+ /** Conditional rendering directives (if). */
2
6
  V_IF = "v-if",
7
+ /** Conditional rendering directives (else if). */
3
8
  V_ELSE_IF = "v-else-if",
9
+ /** Conditional rendering directives (else). */
4
10
  V_ELSE = "v-else",
11
+ /** Conditional rendering directives (show). */
5
12
  V_SHOW = "v-show",
13
+ /** List rendering directives. */
6
14
  V_FOR = "v-for",
15
+ /** Event handling directives. */
7
16
  V_ON = "v-on",
17
+ /** Attribute binding directives. */
8
18
  V_BIND = "v-bind",
19
+ /** Two-way data binding directives. */
9
20
  V_MODEL = "v-model",
10
- V_RESIZE = "v-resize"
21
+ /** Slot content insertion directives. */
22
+ V_RESIZE = "v-resize",
23
+ /** Intersection observer directives. */
24
+ V_INTERSECTION = "v-intersection"
11
25
  }
@@ -58,6 +58,15 @@ export declare class VBindDirective implements VDirective {
58
58
  * If this directive is binding the "key" attribute, it will be handled by the VForDirective.
59
59
  */
60
60
  get isKey(): boolean;
61
+ /**
62
+ * Indicates if this directive is binding the "options" attribute or any of its sub-properties (e.g., "options.intersection").
63
+ * The "options" attribute is special and is used for passing options to certain directives like VIntersectionDirective.
64
+ */
65
+ get isOptions(): boolean;
66
+ /**
67
+ * Gets the name of the attribute being bound (e.g., "src", "class", "options", "options.intersection").
68
+ */
69
+ get attributeName(): string | undefined;
61
70
  /**
62
71
  * Gets the original expression string from the directive.
63
72
  */
@@ -4,6 +4,11 @@ import { VConditionalDirectiveContext } from "./VConditionalDirectiveContext";
4
4
  import { VDirective } from "./VDirective";
5
5
  import { VDirectiveParseContext } from "./VDirectiveParseContext";
6
6
  import { VDOMUpdater } from "../VDOMUpdater";
7
+ /**
8
+ * Base class for conditional directives such as v-if, v-else-if, and v-else.
9
+ * This class manages the rendering of the associated virtual node based on the evaluation of the directive's condition.
10
+ * It also coordinates with other related conditional directives to ensure only one block is rendered at a time.
11
+ */
7
12
  export declare abstract class VConditionalDirective implements VDirective {
8
13
  #private;
9
14
  /**
@@ -3,6 +3,11 @@ import { VNode } from "../VNode";
3
3
  import { VBindingsPreparer } from "../VBindingsPreparer";
4
4
  import { VDOMUpdater } from "../VDOMUpdater";
5
5
  import { VBindDirective } from "./VBindDirective";
6
+ /**
7
+ * Manages directives associated with a virtual node (VNode).
8
+ * This class is responsible for parsing, storing, and managing the lifecycle of directives.
9
+ * It also provides access to bindings preparers and DOM updaters from the associated directives.
10
+ */
6
11
  export declare class VDirectiveManager {
7
12
  #private;
8
13
  constructor(vNode: VNode);
@@ -32,6 +37,19 @@ export declare class VDirectiveManager {
32
37
  * If no such directive exists, this returns undefined.
33
38
  */
34
39
  get keyDirective(): VBindDirective | undefined;
40
+ /**
41
+ * Gets a record of VBindDirectives for options specific to certain directives.
42
+ * The keys are directive names (e.g., 'options', 'options.intersection').
43
+ */
44
+ get optionsDirectives(): Record<string, VBindDirective | undefined>;
45
+ /**
46
+ * Gets the VBindDirective for options specific to the given directive name.
47
+ * Searches in order: `:options.{directive}` -> `:options`
48
+ *
49
+ * @param directive The directive name (e.g., 'intersection', 'resize')
50
+ * @returns The VBindDirective instance or undefined
51
+ */
52
+ optionsDirective(directive: string): VBindDirective | undefined;
35
53
  /**
36
54
  * Cleans up any resources used by the directive handler.
37
55
  */
@@ -1,5 +1,9 @@
1
1
  import { VDirectiveParseContext } from "./VDirectiveParseContext";
2
2
  import { VDirectiveParser } from "./VDirectiveParser";
3
+ /**
4
+ * Registry for managing directive parsers.
5
+ * This class allows registering, unregistering, and finding directive parsers.
6
+ */
3
7
  export declare class VDirectiveParserRegistry {
4
8
  #private;
5
9
  /**
@@ -0,0 +1,91 @@
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 observing element intersection with viewport or ancestor elements using IntersectionObserver.
8
+ * The `v-intersection` directive allows you to respond to changes in an element's visibility.
9
+ *
10
+ * Example usage:
11
+ * <div v-intersection="handleIntersection">Observable content</div>
12
+ * <div v-intersection="handleIntersection" :options.intersection="{threshold: 0.5}">Observable content</div>
13
+ *
14
+ * The handler receives IntersectionObserverEntry array as the first argument and $ctx as the second:
15
+ * handleIntersection(entries, $ctx) {
16
+ * const entry = entries[0];
17
+ * if (entry.isIntersecting) {
18
+ * console.log('Element is visible!');
19
+ * }
20
+ * }
21
+ *
22
+ * Options can be provided via :options or :options.intersection attribute:
23
+ * :options="{root: null, threshold: 0.5, rootMargin: '0px'}"
24
+ * :options.intersection="{root: null, threshold: 0.5, rootMargin: '0px'}"
25
+ *
26
+ * This directive is useful for lazy-loading, infinite scrolling, animation triggers,
27
+ * and other features that depend on element visibility.
28
+ */
29
+ export declare class VIntersectionDirective implements VDirective {
30
+ #private;
31
+ /**
32
+ * @param context The context for parsing the directive.
33
+ */
34
+ constructor(context: VDirectiveParseContext);
35
+ /**
36
+ * @inheritdoc
37
+ */
38
+ get name(): string;
39
+ /**
40
+ * @inheritdoc
41
+ */
42
+ get vNode(): VNode;
43
+ /**
44
+ * @inheritdoc
45
+ */
46
+ get needsAnchor(): boolean;
47
+ /**
48
+ * @inheritdoc
49
+ */
50
+ get bindingsPreparer(): VBindingsPreparer | undefined;
51
+ /**
52
+ * @inheritdoc
53
+ */
54
+ get domUpdater(): VDOMUpdater | undefined;
55
+ /**
56
+ * @inheritdoc
57
+ */
58
+ get templatize(): boolean;
59
+ /**
60
+ * @inheritdoc
61
+ */
62
+ get dependentIdentifiers(): string[];
63
+ /**
64
+ * @inheritdoc
65
+ */
66
+ get onMount(): (() => void) | undefined;
67
+ /**
68
+ * @inheritdoc
69
+ */
70
+ get onMounted(): (() => void) | undefined;
71
+ /**
72
+ * @inheritdoc
73
+ */
74
+ get onUpdate(): (() => void) | undefined;
75
+ /**
76
+ * @inheritdoc
77
+ */
78
+ get onUpdated(): (() => void) | undefined;
79
+ /**
80
+ * @inheritdoc
81
+ */
82
+ get onUnmount(): (() => void) | undefined;
83
+ /**
84
+ * @inheritdoc
85
+ */
86
+ get onUnmounted(): (() => void) | undefined;
87
+ /**
88
+ * @inheritdoc
89
+ */
90
+ destroy(): void;
91
+ }
@@ -19,7 +19,7 @@ import { VDOMUpdater } from "../VDOMUpdater";
19
19
  * @mounted="onMounted" - Called after the element is inserted into the DOM
20
20
  * @update="onUpdate" - Called before the element is updated
21
21
  * @updated="onUpdated" - Called after the element is updated
22
- * @unmount="onUnmount" - Called before the element is removed from the DOM
22
+ * @unmount="onUnmount" - Called before VNode cleanup begins
23
23
  * @unmounted="onUnmounted" - Called after VNode cleanup is complete (element reference still available)
24
24
  *
25
25
  * This directive is essential for handling user interactions and lifecycle events in your application.
@@ -0,0 +1,105 @@
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
+ * Configuration options for the v-performance directive.
8
+ */
9
+ export interface VPerformanceOptions {
10
+ /**
11
+ * The type(s) of performance entries to observe.
12
+ * Can be a single type or an array of types.
13
+ * Common types: 'mark', 'measure', 'navigation', 'resource', 'paint', 'element', 'largest-contentful-paint', 'layout-shift'
14
+ */
15
+ entryTypes?: string | string[];
16
+ /**
17
+ * Whether to include buffered entries (entries that occurred before the observer was created).
18
+ * Default: false
19
+ */
20
+ buffered?: boolean;
21
+ }
22
+ /**
23
+ * Directive for observing performance entries using PerformanceObserver.
24
+ * The `v-performance` directive allows you to monitor various performance metrics.
25
+ *
26
+ * Example usage:
27
+ * <div v-performance="handlePerformance">Performance monitoring</div>
28
+ * <div v-performance="{ handler: handlePerformance, options: { entryTypes: ['measure', 'mark'], buffered: true } }">
29
+ * Advanced monitoring
30
+ * </div>
31
+ *
32
+ * The handler receives PerformanceObserverEntryList and PerformanceObserver as the first two arguments,
33
+ * and $ctx as the third:
34
+ * handlePerformance(list, observer, $ctx) {
35
+ * list.getEntries().forEach(entry => {
36
+ * console.log(`${entry.entryType}: ${entry.name} - ${entry.duration}ms`);
37
+ * });
38
+ * }
39
+ *
40
+ * This directive is useful for monitoring application performance, custom metrics,
41
+ * and identifying performance bottlenecks.
42
+ */
43
+ export declare class VPerformanceDirective implements VDirective {
44
+ #private;
45
+ /**
46
+ * @param context The context for parsing the directive.
47
+ */
48
+ constructor(context: VDirectiveParseContext);
49
+ /**
50
+ * @inheritdoc
51
+ */
52
+ get name(): string;
53
+ /**
54
+ * @inheritdoc
55
+ */
56
+ get vNode(): VNode;
57
+ /**
58
+ * @inheritdoc
59
+ */
60
+ get needsAnchor(): boolean;
61
+ /**
62
+ * @inheritdoc
63
+ */
64
+ get bindingsPreparer(): VBindingsPreparer | undefined;
65
+ /**
66
+ * @inheritdoc
67
+ */
68
+ get domUpdater(): VDOMUpdater | undefined;
69
+ /**
70
+ * @inheritdoc
71
+ */
72
+ get templatize(): boolean;
73
+ /**
74
+ * @inheritdoc
75
+ */
76
+ get dependentIdentifiers(): string[];
77
+ /**
78
+ * @inheritdoc
79
+ */
80
+ get onMount(): (() => void) | undefined;
81
+ /**
82
+ * @inheritdoc
83
+ */
84
+ get onMounted(): (() => void) | undefined;
85
+ /**
86
+ * @inheritdoc
87
+ */
88
+ get onUpdate(): (() => void) | undefined;
89
+ /**
90
+ * @inheritdoc
91
+ */
92
+ get onUpdated(): (() => void) | undefined;
93
+ /**
94
+ * @inheritdoc
95
+ */
96
+ get onUnmount(): (() => void) | undefined;
97
+ /**
98
+ * @inheritdoc
99
+ */
100
+ get onUnmounted(): (() => void) | undefined;
101
+ /**
102
+ * @inheritdoc
103
+ */
104
+ destroy(): void;
105
+ }
@@ -9,6 +9,7 @@ import { VDOMUpdater } from "../VDOMUpdater";
9
9
  *
10
10
  * Example usage:
11
11
  * <div v-resize="handleResize">Resizable content</div>
12
+ * <div v-resize="handleResize" :options.resize="{box: 'border-box'}">Resizable content</div>
12
13
  *
13
14
  * The handler receives ResizeObserverEntry array as the first argument and $ctx as the second:
14
15
  * handleResize(entries, $ctx) {
@@ -16,6 +17,10 @@ import { VDOMUpdater } from "../VDOMUpdater";
16
17
  * console.log(`Size: ${width}x${height}`);
17
18
  * }
18
19
  *
20
+ * Options can be provided via :options or :options.resize attribute:
21
+ * :options="{box: 'border-box'}"
22
+ * :options.resize="{box: 'content-box'}"
23
+ *
19
24
  * This directive is useful for responsive layouts, charts, and other components
20
25
  * that need to adapt to size changes.
21
26
  */
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Utility class for analyzing JavaScript expressions to extract variable and function dependencies.
3
+ */
1
4
  export declare class ExpressionUtils {
2
5
  /**
3
6
  * Extracts variable and function names used in the expression.
@@ -2,8 +2,12 @@
2
2
  * Log level enumeration.
3
3
  */
4
4
  export declare enum LogLevel {
5
+ /** Debug level */
5
6
  DEBUG = "debug",
7
+ /** Info level */
6
8
  INFO = "info",
9
+ /** Warning level */
7
10
  WARN = "warn",
11
+ /** Error level */
8
12
  ERROR = "error"
9
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintjamsinc/ichigojs",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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",