@mintjamsinc/ichigojs 0.1.8 → 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.
- package/README.md +19 -0
- package/dist/ichigo.esm.js +48 -5
- 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 +48 -5
- 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/directives/StandardDirectiveName.d.ts +13 -0
- package/dist/types/ichigo/directives/VConditionalDirective.d.ts +5 -0
- package/dist/types/ichigo/directives/VDirectiveParserRegistry.d.ts +4 -0
- package/dist/types/ichigo/directives/VPerformanceDirective.d.ts +105 -0
- package/dist/types/ichigo/directives/VResizeDirective.d.ts +5 -0
- package/dist/types/ichigo/util/ExpressionUtils.d.ts +3 -0
- package/dist/types/ichigo/util/LogLevel.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -200,8 +200,27 @@ methods: {
|
|
200
200
|
}
|
201
201
|
```
|
202
202
|
|
203
|
+
**With custom options:**
|
204
|
+
|
205
|
+
```html
|
206
|
+
<div v-resize="onResize"
|
207
|
+
:options.resize="{box: 'border-box'}">
|
208
|
+
Observe border-box dimensions
|
209
|
+
</div>
|
210
|
+
```
|
211
|
+
|
212
|
+
You can also use `:options` for generic options:
|
213
|
+
|
214
|
+
```html
|
215
|
+
<div v-resize="onResize"
|
216
|
+
:options="{box: 'content-box'}">
|
217
|
+
Resizable content
|
218
|
+
</div>
|
219
|
+
```
|
220
|
+
|
203
221
|
**Features:**
|
204
222
|
- Native ResizeObserver API for efficient resize detection
|
223
|
+
- Custom box model via `:options.resize` or `:options`
|
205
224
|
- Automatic cleanup in destroy phase
|
206
225
|
- Access to element, VNode, and userData via `$ctx`
|
207
226
|
|
package/dist/ichigo.esm.js
CHANGED
@@ -3,6 +3,10 @@ class VComponentRegistry {
|
|
3
3
|
}
|
4
4
|
|
5
5
|
// Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
|
6
|
+
/**
|
7
|
+
* Registry for managing directive parsers.
|
8
|
+
* This class allows registering, unregistering, and finding directive parsers.
|
9
|
+
*/
|
6
10
|
class VDirectiveParserRegistry {
|
7
11
|
/**
|
8
12
|
* The list of registered directive parsers.
|
@@ -43,17 +47,30 @@ class VDirectiveParserRegistry {
|
|
43
47
|
}
|
44
48
|
|
45
49
|
// Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
|
50
|
+
/**
|
51
|
+
* Standard directive names used in the framework.
|
52
|
+
*/
|
46
53
|
var StandardDirectiveName;
|
47
54
|
(function (StandardDirectiveName) {
|
55
|
+
/** Conditional rendering directives (if). */
|
48
56
|
StandardDirectiveName["V_IF"] = "v-if";
|
57
|
+
/** Conditional rendering directives (else if). */
|
49
58
|
StandardDirectiveName["V_ELSE_IF"] = "v-else-if";
|
59
|
+
/** Conditional rendering directives (else). */
|
50
60
|
StandardDirectiveName["V_ELSE"] = "v-else";
|
61
|
+
/** Conditional rendering directives (show). */
|
51
62
|
StandardDirectiveName["V_SHOW"] = "v-show";
|
63
|
+
/** List rendering directives. */
|
52
64
|
StandardDirectiveName["V_FOR"] = "v-for";
|
65
|
+
/** Event handling directives. */
|
53
66
|
StandardDirectiveName["V_ON"] = "v-on";
|
67
|
+
/** Attribute binding directives. */
|
54
68
|
StandardDirectiveName["V_BIND"] = "v-bind";
|
69
|
+
/** Two-way data binding directives. */
|
55
70
|
StandardDirectiveName["V_MODEL"] = "v-model";
|
71
|
+
/** Slot content insertion directives. */
|
56
72
|
StandardDirectiveName["V_RESIZE"] = "v-resize";
|
73
|
+
/** Intersection observer directives. */
|
57
74
|
StandardDirectiveName["V_INTERSECTION"] = "v-intersection";
|
58
75
|
})(StandardDirectiveName || (StandardDirectiveName = {}));
|
59
76
|
|
@@ -6575,6 +6592,9 @@ base.MethodDefinition = base.PropertyDefinition = base.Property = function (node
|
|
6575
6592
|
};
|
6576
6593
|
|
6577
6594
|
// Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
|
6595
|
+
/**
|
6596
|
+
* Utility class for analyzing JavaScript expressions to extract variable and function dependencies.
|
6597
|
+
*/
|
6578
6598
|
class ExpressionUtils {
|
6579
6599
|
/**
|
6580
6600
|
* Extracts variable and function names used in the expression.
|
@@ -8311,6 +8331,11 @@ class VConditionalDirectiveContext {
|
|
8311
8331
|
}
|
8312
8332
|
|
8313
8333
|
// Copyright (c) 2025 MintJams Inc. Licensed under MIT License.
|
8334
|
+
/**
|
8335
|
+
* Base class for conditional directives such as v-if, v-else-if, and v-else.
|
8336
|
+
* This class manages the rendering of the associated virtual node based on the evaluation of the directive's condition.
|
8337
|
+
* It also coordinates with other related conditional directives to ensure only one block is rendered at a time.
|
8338
|
+
*/
|
8314
8339
|
class VConditionalDirective {
|
8315
8340
|
/**
|
8316
8341
|
* The virtual node to which this directive is applied.
|
@@ -9903,6 +9928,7 @@ class VOnDirective {
|
|
9903
9928
|
*
|
9904
9929
|
* Example usage:
|
9905
9930
|
* <div v-resize="handleResize">Resizable content</div>
|
9931
|
+
* <div v-resize="handleResize" :options.resize="{box: 'border-box'}">Resizable content</div>
|
9906
9932
|
*
|
9907
9933
|
* The handler receives ResizeObserverEntry array as the first argument and $ctx as the second:
|
9908
9934
|
* handleResize(entries, $ctx) {
|
@@ -9910,6 +9936,10 @@ class VOnDirective {
|
|
9910
9936
|
* console.log(`Size: ${width}x${height}`);
|
9911
9937
|
* }
|
9912
9938
|
*
|
9939
|
+
* Options can be provided via :options or :options.resize attribute:
|
9940
|
+
* :options="{box: 'border-box'}"
|
9941
|
+
* :options.resize="{box: 'content-box'}"
|
9942
|
+
*
|
9913
9943
|
* This directive is useful for responsive layouts, charts, and other components
|
9914
9944
|
* that need to adapt to size changes.
|
9915
9945
|
*/
|
@@ -10002,11 +10032,24 @@ class VResizeDirective {
|
|
10002
10032
|
const element = this.#vNode.node;
|
10003
10033
|
const handler = this.#handlerWrapper;
|
10004
10034
|
return () => {
|
10035
|
+
// Get options from :options.resize or :options directive
|
10036
|
+
let optionsDirective = this.#vNode.directiveManager?.optionsDirective('resize');
|
10037
|
+
// Evaluate the options expression
|
10038
|
+
let options;
|
10039
|
+
if (optionsDirective && optionsDirective.expression) {
|
10040
|
+
// Evaluate the options expression
|
10041
|
+
const identifiers = optionsDirective.dependentIdentifiers;
|
10042
|
+
const values = identifiers.map(id => this.#vNode.bindings?.get(id));
|
10043
|
+
const args = identifiers.join(", ");
|
10044
|
+
const funcBody = `return (${optionsDirective.expression});`;
|
10045
|
+
const func = new Function(args, funcBody);
|
10046
|
+
options = func(...values);
|
10047
|
+
}
|
10005
10048
|
// Create ResizeObserver and start observing
|
10006
10049
|
this.#resizeObserver = new ResizeObserver((entries) => {
|
10007
10050
|
handler(entries);
|
10008
10051
|
});
|
10009
|
-
this.#resizeObserver.observe(element);
|
10052
|
+
this.#resizeObserver.observe(element, options);
|
10010
10053
|
};
|
10011
10054
|
}
|
10012
10055
|
/**
|
@@ -10365,13 +10408,13 @@ class VStandardDirectiveParser {
|
|
10365
10408
|
*/
|
10366
10409
|
var LogLevel;
|
10367
10410
|
(function (LogLevel) {
|
10368
|
-
|
10411
|
+
/** Debug level */
|
10369
10412
|
LogLevel["DEBUG"] = "debug";
|
10370
|
-
|
10413
|
+
/** Info level */
|
10371
10414
|
LogLevel["INFO"] = "info";
|
10372
|
-
|
10415
|
+
/** Warning level */
|
10373
10416
|
LogLevel["WARN"] = "warn";
|
10374
|
-
|
10417
|
+
/** Error level */
|
10375
10418
|
LogLevel["ERROR"] = "error";
|
10376
10419
|
})(LogLevel || (LogLevel = {}));
|
10377
10420
|
|