@mintjamsinc/ichigojs 0.1.2 → 0.1.4
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 +75 -1
- package/dist/ichigo.esm.js +507 -84
- 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 +507 -84
- 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/VBindingsInit.d.ts +5 -0
- package/dist/types/ichigo/directives/VBindDirective.d.ts +24 -0
- package/dist/types/ichigo/directives/VConditionalDirective.d.ts +24 -0
- package/dist/types/ichigo/directives/VDirective.d.ts +30 -0
- package/dist/types/ichigo/directives/VForDirective.d.ts +24 -0
- package/dist/types/ichigo/directives/VModelDirective.d.ts +24 -0
- package/dist/types/ichigo/directives/VOnDirective.d.ts +35 -2
- package/dist/types/ichigo/directives/VShowDirective.d.ts +24 -0
- package/dist/types/ichigo/util/VLogManager.d.ts +15 -0
- package/dist/types/ichigo/util/VLogger.d.ts +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -11,6 +11,7 @@ A simple and intuitive reactive framework. Lightweight, fast, and user-friendly
|
|
11
11
|
- ⚡ **Reactive Proxy System** - Automatic change detection without manual triggers
|
12
12
|
- 🎯 **Computed Properties** - Automatic dependency tracking and re-evaluation
|
13
13
|
- 🔄 **Two-way Binding** - `v-model` with modifiers (`.lazy`, `.number`, `.trim`)
|
14
|
+
- 🔌 **Lifecycle Hooks** - `@mount`, `@mounted`, `@update`, `@updated`, `@unmount`, `@unmounted`
|
14
15
|
- 📦 **Lightweight** - Minimal bundle size
|
15
16
|
- 🚀 **High Performance** - Efficient batched updates via microtask queue
|
16
17
|
- 💪 **TypeScript** - Written in TypeScript with full type support
|
@@ -158,6 +159,71 @@ Event handling with modifiers:
|
|
158
159
|
|
159
160
|
Supported modifiers: `.stop`, `.prevent`, `.capture`, `.self`, `.once`
|
160
161
|
|
162
|
+
#### Lifecycle Hooks
|
163
|
+
|
164
|
+
Lifecycle hooks allow you to run code at specific stages of an element's lifecycle:
|
165
|
+
|
166
|
+
```html
|
167
|
+
<div v-if="show"
|
168
|
+
@mount="onMount"
|
169
|
+
@mounted="onMounted"
|
170
|
+
@update="onUpdate"
|
171
|
+
@updated="onUpdated"
|
172
|
+
@unmount="onUnmount"
|
173
|
+
@unmounted="onUnmounted">
|
174
|
+
Content
|
175
|
+
</div>
|
176
|
+
```
|
177
|
+
|
178
|
+
**Available hooks:**
|
179
|
+
|
180
|
+
- `@mount` - Called before the element is inserted into the DOM
|
181
|
+
- `@mounted` - Called after the element is inserted into the DOM
|
182
|
+
- `@update` - Called before the element is updated
|
183
|
+
- `@updated` - Called after the element is updated
|
184
|
+
- `@unmount` - Called before the element is removed from the DOM
|
185
|
+
- `@unmounted` - Called after the element is removed from the DOM
|
186
|
+
|
187
|
+
**Use cases:**
|
188
|
+
|
189
|
+
```javascript
|
190
|
+
methods: {
|
191
|
+
onMounted(el) {
|
192
|
+
// Initialize third-party library (el is the DOM element)
|
193
|
+
const canvas = el.querySelector('canvas');
|
194
|
+
canvas._chartInstance = new Chart(canvas.getContext('2d'), { /* ... */ });
|
195
|
+
},
|
196
|
+
onUpdated(el) {
|
197
|
+
// Update chart with new data
|
198
|
+
const canvas = el.querySelector('canvas');
|
199
|
+
canvas._chartInstance?.update();
|
200
|
+
},
|
201
|
+
onUnmounted(el) {
|
202
|
+
// Clean up resources
|
203
|
+
const canvas = el.querySelector('canvas');
|
204
|
+
canvas._chartInstance?.destroy();
|
205
|
+
delete canvas._chartInstance;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
```
|
209
|
+
|
210
|
+
**Works with v-if and v-for:**
|
211
|
+
|
212
|
+
```html
|
213
|
+
<!-- With v-if: hooks called on show/hide -->
|
214
|
+
<div v-if="isVisible" @mounted="onShow" @unmounted="onHide">
|
215
|
+
Conditional content
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<!-- With v-for: hooks called for each item -->
|
219
|
+
<div v-for="item in items"
|
220
|
+
:key="item.id"
|
221
|
+
@mounted="onItemAdded"
|
222
|
+
@unmounted="onItemRemoved">
|
223
|
+
{{ item.name }}
|
224
|
+
</div>
|
225
|
+
```
|
226
|
+
|
161
227
|
#### v-model
|
162
228
|
|
163
229
|
Two-way data binding:
|
@@ -258,7 +324,15 @@ VDOM.createApp<AppData>({
|
|
258
324
|
|
259
325
|
## Examples
|
260
326
|
|
261
|
-
See the [
|
327
|
+
See the [docs](https://mintjamsinc.github.io/ichigojs/) for live examples:
|
328
|
+
|
329
|
+
- **Basic Usage** - Getting started with ichigo.js
|
330
|
+
- **Todo List** - Complete task management application
|
331
|
+
- **Component System** - Reusable components with props and events
|
332
|
+
- **Advanced Features**:
|
333
|
+
- **Lifecycle Hooks** - CSS animations and Chart.js integration
|
334
|
+
- **Anime.js Integration** - Particle animations and morphing shapes
|
335
|
+
- **Chart.js Integration** - Dynamic charts with automatic updates
|
262
336
|
|
263
337
|
## API Reference
|
264
338
|
|