@servlyadmin/runtime-core 0.1.20 → 0.1.22

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
@@ -19569,6 +19569,18 @@ function attachEventHandlers(domElement, element, eventHandlers, context, elemen
19569
19569
  }
19570
19570
  }
19571
19571
  }
19572
+ if (isRootElement && context.props && state?.renderingStack?.size === 0) {
19573
+ for (const [propName, value] of Object.entries(context.props)) {
19574
+ if (propName.startsWith("on") && propName.length > 2 && typeof value === "function") {
19575
+ const domEventName = propName.slice(2).toLowerCase();
19576
+ if (!elementState.eventListeners.has(domEventName)) {
19577
+ const handler = value;
19578
+ elementState.eventListeners.set(domEventName, handler);
19579
+ domElement.addEventListener(domEventName, handler);
19580
+ }
19581
+ }
19582
+ }
19583
+ }
19572
19584
  }
19573
19585
  function detachEventHandlers(elementState) {
19574
19586
  for (const [eventName, handler] of elementState.eventListeners) {
@@ -19685,6 +19697,9 @@ function resolveComponentViewInputs(bindings, context, parentInputs) {
19685
19697
  for (const [key, binding] of Object.entries(bindings)) {
19686
19698
  if (!binding) continue;
19687
19699
  const source = (binding.source || "").toLowerCase();
19700
+ if (source === "function") {
19701
+ continue;
19702
+ }
19688
19703
  switch (source) {
19689
19704
  case "static":
19690
19705
  case "value":
@@ -19751,8 +19766,14 @@ function renderElement(element, tree, context, eventHandlers, elementStates, sta
19751
19766
  }
19752
19767
  const elementBindings = element.configuration?.bindings?.inputs;
19753
19768
  const resolvedInputs = elementBindings ? resolveComponentViewInputs(elementBindings, context, context.props) : {};
19769
+ const filteredContextProps = {};
19770
+ for (const [key, value] of Object.entries(context.props || {})) {
19771
+ if (typeof value !== "function") {
19772
+ filteredContextProps[key] = value;
19773
+ }
19774
+ }
19754
19775
  const elementContext = {
19755
- props: { ...context.props, ...resolvedInputs },
19776
+ props: { ...filteredContextProps, ...resolvedInputs },
19756
19777
  state: context.state,
19757
19778
  context: context.context
19758
19779
  };
package/dist/index.js CHANGED
@@ -2773,6 +2773,18 @@ function attachEventHandlers(domElement, element, eventHandlers, context, elemen
2773
2773
  }
2774
2774
  }
2775
2775
  }
2776
+ if (isRootElement && context.props && state?.renderingStack?.size === 0) {
2777
+ for (const [propName, value] of Object.entries(context.props)) {
2778
+ if (propName.startsWith("on") && propName.length > 2 && typeof value === "function") {
2779
+ const domEventName = propName.slice(2).toLowerCase();
2780
+ if (!elementState.eventListeners.has(domEventName)) {
2781
+ const handler = value;
2782
+ elementState.eventListeners.set(domEventName, handler);
2783
+ domElement.addEventListener(domEventName, handler);
2784
+ }
2785
+ }
2786
+ }
2787
+ }
2776
2788
  }
2777
2789
  function detachEventHandlers(elementState) {
2778
2790
  for (const [eventName, handler] of elementState.eventListeners) {
@@ -2889,6 +2901,9 @@ function resolveComponentViewInputs(bindings, context, parentInputs) {
2889
2901
  for (const [key, binding] of Object.entries(bindings)) {
2890
2902
  if (!binding) continue;
2891
2903
  const source = (binding.source || "").toLowerCase();
2904
+ if (source === "function") {
2905
+ continue;
2906
+ }
2892
2907
  switch (source) {
2893
2908
  case "static":
2894
2909
  case "value":
@@ -2955,8 +2970,14 @@ function renderElement(element, tree, context, eventHandlers, elementStates, sta
2955
2970
  }
2956
2971
  const elementBindings = element.configuration?.bindings?.inputs;
2957
2972
  const resolvedInputs = elementBindings ? resolveComponentViewInputs(elementBindings, context, context.props) : {};
2973
+ const filteredContextProps = {};
2974
+ for (const [key, value] of Object.entries(context.props || {})) {
2975
+ if (typeof value !== "function") {
2976
+ filteredContextProps[key] = value;
2977
+ }
2978
+ }
2958
2979
  const elementContext = {
2959
- props: { ...context.props, ...resolvedInputs },
2980
+ props: { ...filteredContextProps, ...resolvedInputs },
2960
2981
  state: context.state,
2961
2982
  context: context.context
2962
2983
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servlyadmin/runtime-core",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "Framework-agnostic core renderer for Servly components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",