@json-render/solid 0.19.0 → 0.21.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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  elementTreeSchema,
3
3
  schema
4
- } from "./chunk-XTSB6FIM.mjs";
4
+ } from "./chunk-ZTWTJIEL.mjs";
5
5
 
6
6
  // src/contexts/state.tsx
7
7
  import { createComponent as _$createComponent } from "solid-js/web";
@@ -547,11 +547,8 @@ function ActionProvider(props) {
547
547
  handler,
548
548
  setState: set,
549
549
  navigate: props.navigate,
550
- executeAction: async (name) => {
551
- const subBinding = {
552
- action: name
553
- };
554
- await execute(subBinding);
550
+ executeAction: async (binding2) => {
551
+ await execute(binding2);
555
552
  }
556
553
  });
557
554
  } finally {
@@ -570,11 +567,8 @@ function ActionProvider(props) {
570
567
  handler,
571
568
  setState: set,
572
569
  navigate: props.navigate,
573
- executeAction: async (name) => {
574
- const subBinding = {
575
- action: name
576
- };
577
- await execute(subBinding);
570
+ executeAction: async (binding2) => {
571
+ await execute(binding2);
578
572
  }
579
573
  });
580
574
  } finally {
@@ -695,7 +689,7 @@ import { insert as _$insert2 } from "solid-js/web";
695
689
  import { memo as _$memo2 } from "solid-js/web";
696
690
  import { createComponent as _$createComponent6 } from "solid-js/web";
697
691
  import { createContext as createContext6, useContext as useContext6, createMemo as createMemo3, createEffect as createEffect3, createSignal as createSignal4, onCleanup as onCleanup2, ErrorBoundary, Show, For } from "solid-js";
698
- import { resolveElementProps, resolveBindings, resolveActionParam, evaluateVisibility as evaluateVisibility2, getByPath as getByPath2, isDevtoolsActive, subscribeDevtoolsActive, createDirectiveRegistry } from "@json-render/core";
692
+ import { resolveElementProps, resolveBindings, resolveActionParam, resolveRepeatItemStatePath, resolveRepeatStatePath, evaluateVisibility as evaluateVisibility2, getByPath as getByPath2, isDevtoolsActive, subscribeDevtoolsActive, createDirectiveRegistry } from "@json-render/core";
699
693
  var _tmpl$2 = /* @__PURE__ */ _$template2(`<span style=display:contents>`);
700
694
  var EMPTY_FUNCTIONS = {};
701
695
  var FunctionsContext = createContext6(EMPTY_FUNCTIONS);
@@ -984,8 +978,15 @@ function ElementRendererContent(props) {
984
978
  function RepeatChildren(props) {
985
979
  const stateStore = useStateStore();
986
980
  const repeat = () => props.element.repeat;
987
- const statePath = () => repeat().statePath;
988
- const items = () => getByPath2(stateStore.state, statePath()) ?? [];
981
+ const parentScope = useRepeatScope();
982
+ const statePath = () => {
983
+ const resolved = resolveRepeatStatePath(repeat().statePath, parentScope?.basePath);
984
+ if (resolved === void 0) {
985
+ console.warn("[json-render/solid] $item in repeat.statePath used outside of a repeat scope");
986
+ }
987
+ return resolved;
988
+ };
989
+ const items = () => statePath() === void 0 ? [] : getByPath2(stateStore.state, statePath()) ?? [];
989
990
  return _$createComponent6(For, {
990
991
  get each() {
991
992
  return items();
@@ -1001,7 +1002,7 @@ function RepeatChildren(props) {
1001
1002
  return index();
1002
1003
  },
1003
1004
  get basePath() {
1004
- return `${statePath()}/${index()}`;
1005
+ return resolveRepeatItemStatePath(statePath(), index());
1005
1006
  },
1006
1007
  get children() {
1007
1008
  return _$createComponent6(For, {