@farm.js/react 0.1.0-beta.37 → 0.1.0-beta.39

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
@@ -1123,6 +1123,15 @@ Generated callback refs give directly patched host elements stable private targe
1123
1123
  React-owned component may therefore return `null`, a fragment, or multiple host nodes without
1124
1124
  shifting an unrelated compiler binding. These refs do not add attributes to SSR output.
1125
1125
 
1126
+ Custom element tags and customized built-ins using `is` remain React-owned rather than receiving
1127
+ compiler attribute writes or host descriptors. React controls property setters, attributes, events,
1128
+ and element creation according to the installed React version, including during hydration.
1129
+
1130
+ State-dependent `contentEditable` bindings and non-literal `contentEditable` values in host
1131
+ descriptors remain React-owned. This preserves the difference between explicit `false` (not editable)
1132
+ and an absent value (inherit from the parent). Literal strings on ordinary direct hosts remain
1133
+ eligible for compilation.
1134
+
1126
1135
  `title` and `meta` elements inside conditional, keyed, or recursive host descriptors remain
1127
1136
  React-owned. React decides their document placement and cleanup, including React 19 head placement
1128
1137
  and the `itemProp` exception. The compiler does not implement a separate metadata manager.
package/dist/vite.cjs CHANGED
@@ -3327,7 +3327,7 @@ function isForeignContent(element) {
3327
3327
  }
3328
3328
  function reactOwnedAttribute(name, attribute) {
3329
3329
  if (name === "defaultValue" || name === "defaultChecked") return true;
3330
- return (name === "spellCheck" || name === "draggable") && !core.types.isStringLiteral(attribute.value);
3330
+ return (name === "spellCheck" || name === "draggable" || name === "contentEditable") && !core.types.isStringLiteral(attribute.value);
3331
3331
  }
3332
3332
  function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters, keyedTargetReactiveByValue) {
3333
3333
  if (renderCallback.async || renderCallback.generator || renderCallback.params.length < 1 || renderCallback.params.length > 2 || !core.types.isIdentifier(renderCallback.params[0]) || renderCallback.params[1] !== void 0 && !core.types.isIdentifier(renderCallback.params[1])) {
@@ -3349,6 +3349,7 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
3349
3349
  return "compiled keyed rows support host elements only";
3350
3350
  }
3351
3351
  if (isForeignContent(element)) return "compiled keyed rows do not support SVG yet";
3352
+ if (tag.name.includes("-")) return "custom elements require React ownership";
3352
3353
  if (tag.name === "script") return "script elements require React ownership";
3353
3354
  if (tag.name === "title" || tag.name === "meta") {
3354
3355
  return "document metadata requires React ownership";
@@ -3382,6 +3383,7 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
3382
3383
  }
3383
3384
  const name = jsxAttributeName(attribute);
3384
3385
  if (!name) return "compiled keyed rows do not support namespaced JSX attributes";
3386
+ if (name === "is") return "customized built-in elements require React ownership";
3385
3387
  if (name === "ref" || name === "dangerouslySetInnerHTML" || reactOwnedAttribute(name, attribute)) {
3386
3388
  return `compiled keyed row ${name} requires React ownership`;
3387
3389
  }
@@ -3751,6 +3753,7 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
3751
3753
  return "compiler-owned conditionals support host elements only";
3752
3754
  }
3753
3755
  if (isForeignContent(element)) return "compiler-owned conditionals do not support SVG yet";
3756
+ if (tag.name.includes("-")) return "custom elements require React ownership";
3754
3757
  if (tag.name === "script") return "script elements require React ownership";
3755
3758
  if (tag.name === "title" || tag.name === "meta") {
3756
3759
  return "document metadata requires React ownership";
@@ -3762,6 +3765,7 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
3762
3765
  }
3763
3766
  const name = jsxAttributeName(attribute);
3764
3767
  if (!name) return "compiler-owned conditionals do not support namespaced JSX attributes";
3768
+ if (name === "is") return "customized built-in elements require React ownership";
3765
3769
  if (reactOwnedAttribute(name, attribute)) {
3766
3770
  return `compiler-owned conditional ${name} requires React ownership`;
3767
3771
  }
@@ -3880,6 +3884,7 @@ function analyzeRecursiveHostTree(branch, statesByValue, safeGlobals, listNames,
3880
3884
  if (isForeignContent(element)) {
3881
3885
  return "recursive compiler-owned blocks do not support SVG yet";
3882
3886
  }
3887
+ if (tag.name.includes("-")) return "custom elements require React ownership";
3883
3888
  if (tag.name === "script") return "script elements require React ownership";
3884
3889
  if (tag.name === "title" || tag.name === "meta") {
3885
3890
  return "document metadata requires React ownership";
@@ -3890,6 +3895,7 @@ function analyzeRecursiveHostTree(branch, statesByValue, safeGlobals, listNames,
3890
3895
  }
3891
3896
  const name = jsxAttributeName(attribute);
3892
3897
  if (!name) return "recursive compiler-owned blocks do not support namespaced attributes";
3898
+ if (name === "is") return "customized built-in elements require React ownership";
3893
3899
  if (reactOwnedAttribute(name, attribute)) {
3894
3900
  return `recursive compiler-owned block ${name} requires React ownership`;
3895
3901
  }
@@ -6158,10 +6164,12 @@ function analyzeHostTree(root, statesByValue, safeGlobals, conditionalExpression
6158
6164
  if (!core.types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
6159
6165
  return "compiled trees currently support host elements only";
6160
6166
  }
6167
+ if (tag.name.includes("-")) return "custom elements require React ownership";
6161
6168
  for (const attribute of element.openingElement.attributes) {
6162
6169
  if (core.types.isJSXSpreadAttribute(attribute)) return "JSX attribute spreads are not supported yet";
6163
6170
  const name = jsxAttributeName(attribute);
6164
6171
  if (!name) return "namespaced JSX attributes are not supported yet";
6172
+ if (name === "is") return "customized built-in elements require React ownership";
6165
6173
  if (name === "ref" || name === "dangerouslySetInnerHTML") {
6166
6174
  return `${name} requires React ownership`;
6167
6175
  }
@@ -6171,6 +6179,7 @@ function analyzeHostTree(root, statesByValue, safeGlobals, conditionalExpression
6171
6179
  const expression = attribute.value.expression;
6172
6180
  const dependencies = collectStateDependencies(expression, statesByValue);
6173
6181
  if (dependencies.length === 0) continue;
6182
+ if (name === "contentEditable") return "stateful contentEditable requires React ownership";
6174
6183
  if (/^on[A-Z]/.test(name)) {
6175
6184
  if (!core.types.isArrowFunctionExpression(expression) && !core.types.isFunctionExpression(expression)) {
6176
6185
  return "stateful event handler selection requires React ownership";