@farm.js/react 0.1.0-beta.32 → 0.1.0-beta.33

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/client.d.mts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from '@farm.js/core/renderer/react/client';
2
2
  export { default } from '@farm.js/core/renderer/react/client';
3
+ import '@farm.js/core/renderer/react/server';
package/dist/client.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from '@farm.js/core/renderer/react/client';
2
2
  export { default } from '@farm.js/core/renderer/react/client';
3
+ import '@farm.js/core/renderer/react/server';
@@ -2550,7 +2550,7 @@ function readKeyedRowBindingValues(props, item, index) {
2550
2550
  var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
2551
2551
  function createKeyedRowInstance(props, document, key, item, index) {
2552
2552
  const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
2553
- const element = template ? template.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
2553
+ const element = template ? template.element.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
2554
2554
  const instance = {
2555
2555
  key,
2556
2556
  element,
@@ -2573,6 +2573,8 @@ function createKeyedRowInstance(props, document, key, item, index) {
2573
2573
  if (found) instance.targets = targets;
2574
2574
  if (template) {
2575
2575
  for (let bindingIndex = 0; bindingIndex < targets.length; bindingIndex += 1) {
2576
+ const value = instance.values[bindingIndex];
2577
+ if (typeof value === "string" && value === template.classNames[bindingIndex]) continue;
2576
2578
  commitKeyedRowBinding(
2577
2579
  props.bindings[bindingIndex],
2578
2580
  instance,
@@ -2598,10 +2600,20 @@ function keyedRowTemplate(props, element, targets) {
2598
2600
  }
2599
2601
  }
2600
2602
  const template = element.cloneNode(true);
2601
- for (const binding of props.bindings) {
2603
+ const classNames = [];
2604
+ const classTargets = /* @__PURE__ */ new Set();
2605
+ for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
2606
+ const binding = props.bindings[bindingIndex];
2602
2607
  if (binding.kind === "text") findCompilerHostTarget(template, binding.path).textContent = "";
2608
+ if (binding.kind === "attribute" && (binding.name === "className" || binding.name === "class")) {
2609
+ const target = targets[bindingIndex];
2610
+ if (!classTargets.has(target)) {
2611
+ classNames[bindingIndex] = target.getAttribute("class") ?? void 0;
2612
+ classTargets.add(target);
2613
+ }
2614
+ }
2603
2615
  }
2604
- return template;
2616
+ return { element: template, classNames };
2605
2617
  }
2606
2618
  function applyKeyedRowBindings(props, instance, item, index) {
2607
2619
  if (props.bindings.length < 2) {
@@ -6675,22 +6687,24 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6675
6687
  } else {
6676
6688
  applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
6677
6689
  }
6678
- const conditionalValues = this.readConditionalValues(
6679
- this.currentProps,
6680
- rows.items[index],
6681
- index
6682
- );
6683
- for (const [id, values] of conditionalValues) {
6684
- if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
6685
- conditionalChanges.push({
6686
- key,
6687
- id,
6688
- item: rows.items[index],
6689
- index
6690
- });
6690
+ if (options.conditionals) {
6691
+ const conditionalValues = this.readConditionalValues(
6692
+ this.currentProps,
6693
+ rows.items[index],
6694
+ index
6695
+ );
6696
+ for (const [id, values] of conditionalValues) {
6697
+ if (options.conditionals.changed(existing.conditionalValues.get(id), values)) {
6698
+ conditionalChanges.push({
6699
+ key,
6700
+ id,
6701
+ item: rows.items[index],
6702
+ index
6703
+ });
6704
+ }
6691
6705
  }
6706
+ existing.conditionalValues = conditionalValues;
6692
6707
  }
6693
- existing.conditionalValues = conditionalValues;
6694
6708
  existing.item = rows.items[index];
6695
6709
  existing.index = index;
6696
6710
  }
@@ -7655,6 +7669,14 @@ var keyedRowsPlainReorderHintedRuntimeFeature = {
7655
7669
  })
7656
7670
  })
7657
7671
  };
7672
+ var keyedRowsPlainMapReorderHintedRuntimeFeature = {
7673
+ name: "keyed-rows:plain-map-reorder-hinted",
7674
+ create: (owner) => ({
7675
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7676
+ keyedUpdates: keyedMapReorderUpdateRuntime
7677
+ })
7678
+ })
7679
+ };
7658
7680
  var keyedRowsMapReorderHintedRuntimeFeature = {
7659
7681
  name: "keyed-rows:map-reorder-hinted",
7660
7682
  create: (owner) => ({
@@ -8879,6 +8901,7 @@ exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
8879
8901
  exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
8880
8902
  exports.keyedRowsMappedRollingWindowHintedRuntimeFeature = keyedRowsMappedRollingWindowHintedRuntimeFeature;
8881
8903
  exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
8904
+ exports.keyedRowsPlainMapReorderHintedRuntimeFeature = keyedRowsPlainMapReorderHintedRuntimeFeature;
8882
8905
  exports.keyedRowsPlainReorderHintedRuntimeFeature = keyedRowsPlainReorderHintedRuntimeFeature;
8883
8906
  exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
8884
8907
  exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;