@plastic-js/plastic 1.0.7 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plastic-js/plastic",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "main": "src/index.js",
5
5
  "access": "public",
6
6
  "sideEffects": false,
@@ -60,7 +60,7 @@
60
60
  "@testing-library/jest-dom": "^6.9.1",
61
61
  "@vitejs/plugin-react": "^6.0.2",
62
62
  "@vitejs/plugin-vue": "^6.0.7",
63
- "@plastic-js/babel-preset-plastic": "^0.1.7",
63
+ "@plastic-js/babel-preset-plastic": "^0.1.8",
64
64
  "eslint": "^9.39.2",
65
65
  "eslint-config-janus": "^9.0.21",
66
66
  "eslint-plugin-mocha": "^11.3.0",
@@ -1263,6 +1263,14 @@ const insert = (parent, accessor, marker = null)=> {
1263
1263
  // change. Class and style go through the existing helpers so the
1264
1264
  // merge/diff semantics stay identical to the JSX path.
1265
1265
  const setProp = (element, key, accessor)=> {
1266
+ if (key === 'ref'){
1267
+ // babel-preset-plastic's template fast path always emits refs as
1268
+ // `() => refCallback` thunks — unwrap once. Calling the accessor as
1269
+ // a probe would invoke a direct callback with undefined, so we don't.
1270
+ const ref = typeof accessor === 'function' ? accessor() : accessor
1271
+ applyRefProp(element, ref)
1272
+ return
1273
+ }
1266
1274
  // Event handlers (onClick, etc.) — the babel transform emits them as
1267
1275
  // `() => handler` thunks. Resolve once to the handler and attach a single
1268
1276
  // listener that re-reads the current accessor at dispatch time (so a signal