canvasframework 0.3.12 → 0.3.13

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.
@@ -89,7 +89,7 @@ import FeatureFlags from '../manager/FeatureFlags.js';
89
89
 
90
90
  // WebGL Adapter
91
91
  import WebGLCanvasAdapter from './WebGLCanvasAdapter.js';
92
- import ui from './UIBuilder.js';
92
+ import ui, { createRef } from './UIBuilder.js';
93
93
 
94
94
  // theme
95
95
  export const lightTheme = {
package/core/UIBuilder.js CHANGED
@@ -132,6 +132,13 @@ const Components = {
132
132
  Stack
133
133
  };
134
134
 
135
+ /**
136
+ * Crée un objet ref pour stocker une référence
137
+ */
138
+ export function createRef() {
139
+ return { current: null };
140
+ }
141
+
135
142
  /**
136
143
  * DSL déclaratif pour CanvasFramework
137
144
  */
@@ -162,7 +169,15 @@ class UIBuilder {
162
169
  return null;
163
170
  }
164
171
 
165
- const instance = new ComponentClass(framework, node.props);
172
+ // Extraire la ref des props si elle existe
173
+ const { ref, ...componentProps } = node.props;
174
+
175
+ const instance = new ComponentClass(framework, componentProps);
176
+
177
+ // ✅ Si une ref est fournie, y stocker l'instance
178
+ if (ref && typeof ref === 'object' && 'current' in ref) {
179
+ ref.current = instance;
180
+ }
166
181
 
167
182
  // ✅ Ajouter au framework UNIQUEMENT si ce n'est pas un enfant de Card
168
183
  const isChildOfCard = parent && parent.constructor?.name === 'Card';
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // Core
4
4
  export { default as CanvasFramework } from './core/CanvasFramework.js';
5
5
  export { default as Component } from './core/Component.js';
6
- export { default as ui } from './core/UIBuilder.js';
6
+ export { default as ui, createRef } from './core/UIBuilder.js';
7
7
 
8
8
  // Components
9
9
  export { default as Button } from './components/Button.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasframework",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Canvas-based cross-platform UI framework (Material & Cupertino)",
5
5
  "type": "module",
6
6
  "main": "./index.js",