@cajoa/core 0.7.0 → 0.9.0

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/dist/index.cjs CHANGED
@@ -211,7 +211,12 @@ function getRenderer() {
211
211
  function h(tag, props, ...children) {
212
212
  const r = getRenderer();
213
213
  const el = r.createElement(tag);
214
+ let ref;
214
215
  for (const [key, value] of Object.entries(props ?? {})) {
216
+ if (key === "ref") {
217
+ if (typeof value === "function") ref = value;
218
+ continue;
219
+ }
215
220
  if (typeof value === "function" && !key.startsWith("on")) {
216
221
  createEffect(() => r.setProp(el, key, value()));
217
222
  } else {
@@ -219,6 +224,8 @@ function h(tag, props, ...children) {
219
224
  }
220
225
  }
221
226
  appendChildren(el, children);
227
+ const onRef = ref;
228
+ if (onRef) untrack(() => onRef(el));
222
229
  return el;
223
230
  }
224
231
  function toNodes(value) {
package/dist/index.js CHANGED
@@ -165,7 +165,12 @@ function getRenderer() {
165
165
  function h(tag, props, ...children) {
166
166
  const r = getRenderer();
167
167
  const el = r.createElement(tag);
168
+ let ref;
168
169
  for (const [key, value] of Object.entries(props ?? {})) {
170
+ if (key === "ref") {
171
+ if (typeof value === "function") ref = value;
172
+ continue;
173
+ }
169
174
  if (typeof value === "function" && !key.startsWith("on")) {
170
175
  createEffect(() => r.setProp(el, key, value()));
171
176
  } else {
@@ -173,6 +178,8 @@ function h(tag, props, ...children) {
173
178
  }
174
179
  }
175
180
  appendChildren(el, children);
181
+ const onRef = ref;
182
+ if (onRef) untrack(() => onRef(el));
176
183
  return el;
177
184
  }
178
185
  function toNodes(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cajoa/core",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Cajoa core: signals, JSX runtime and the renderer interface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",