@mintjamsinc/ichigojs 0.1.22 → 0.1.24

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 CHANGED
@@ -27,6 +27,46 @@ A simple and intuitive reactive framework. Lightweight, fast, and user-friendly
27
27
  npm install @mintjamsinc/ichigojs
28
28
  ```
29
29
 
30
+ ### Bundle Formats
31
+
32
+ ichigo.js provides multiple bundle formats to suit different use cases:
33
+
34
+ #### ESM (ES Modules)
35
+ Use with modern bundlers or native ES modules:
36
+ ```javascript
37
+ import { VDOM } from '@mintjamsinc/ichigojs';
38
+ ```
39
+
40
+ **Files:**
41
+ - `dist/ichigo.esm.js` - Development build with source maps
42
+ - `dist/ichigo.esm.min.js` - Production build (minified)
43
+
44
+ #### CommonJS
45
+ Use with Node.js or older bundlers:
46
+ ```javascript
47
+ const { VDOM } = require('@mintjamsinc/ichigojs');
48
+ ```
49
+
50
+ **Files:**
51
+ - `dist/ichigo.cjs` - Development build with source maps
52
+ - `dist/ichigo.min.cjs` - Production build (minified)
53
+
54
+ #### UMD (Universal Module Definition)
55
+ Use via `<script>` tag in browser:
56
+ ```html
57
+ <script src="node_modules/@mintjamsinc/ichigojs/dist/ichigo.umd.js"></script>
58
+ <script>
59
+ const { VDOM } = window.ichigo;
60
+ // Use VDOM here
61
+ </script>
62
+ ```
63
+
64
+ **Files:**
65
+ - `dist/ichigo.umd.js` - Development build with source maps
66
+ - `dist/ichigo.umd.min.js` - Production build (minified)
67
+
68
+ **Note:** The UMD build exposes `window.ichigo` with all exports (`VDOM`, `ReactiveProxy`, `VComponent`, `VComponentRegistry`).
69
+
30
70
  ## Quick Start
31
71
 
32
72
  ```html
@@ -90,6 +130,51 @@ VDOM.createApp({
90
130
  }).mount('#app');
91
131
  ```
92
132
 
133
+ ### Marking Objects as Non-Reactive
134
+
135
+ Use `$markRaw()` to prevent objects from being wrapped in a reactive proxy. This is useful when storing third-party library instances or large data structures that don't need reactivity.
136
+
137
+ ```javascript
138
+ VDOM.createApp({
139
+ data() {
140
+ return {
141
+ // Regular reactive data
142
+ count: 0,
143
+
144
+ // Mark as non-reactive
145
+ chart: null,
146
+ bigData: null
147
+ };
148
+ },
149
+ methods: {
150
+ initChart($ctx) {
151
+ // Create Chart.js instance and mark as non-reactive
152
+ const chartInstance = new Chart(canvas, { /* ... */ });
153
+ this.chart = this.$markRaw(chartInstance);
154
+
155
+ // Large dataset that doesn't need reactivity
156
+ const data = fetchLargeDataset();
157
+ this.bigData = this.$markRaw(data);
158
+ }
159
+ }
160
+ }).mount('#app');
161
+ ```
162
+
163
+ **When to use `$markRaw()`:**
164
+
165
+ - Third-party library instances (Chart.js, Three.js, etc.)
166
+ - Large arrays or objects that don't need change detection
167
+ - Objects with complex internal state that shouldn't be proxied
168
+ - DOM elements or other built-in objects with internal slots
169
+
170
+ **Note:** Objects marked with `$markRaw()` won't trigger updates when modified. Use reactive properties to trigger updates when needed:
171
+
172
+ ```javascript
173
+ // Update reactive trigger after modifying non-reactive data
174
+ this.bigData.push(newItem); // Won't trigger update
175
+ this.count++; // Triggers update
176
+ ```
177
+
93
178
  ### Computed Properties
94
179
 
95
180
  Computed properties automatically track their dependencies and re-evaluate when dependencies change.