@json-render/solid 0.18.0 → 0.19.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.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +34 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -695,13 +695,17 @@ import { insert as _$insert2 } from "solid-js/web";
|
|
|
695
695
|
import { memo as _$memo2 } from "solid-js/web";
|
|
696
696
|
import { createComponent as _$createComponent6 } from "solid-js/web";
|
|
697
697
|
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 } from "@json-render/core";
|
|
698
|
+
import { resolveElementProps, resolveBindings, resolveActionParam, evaluateVisibility as evaluateVisibility2, getByPath as getByPath2, isDevtoolsActive, subscribeDevtoolsActive, createDirectiveRegistry } from "@json-render/core";
|
|
699
699
|
var _tmpl$2 = /* @__PURE__ */ _$template2(`<span style=display:contents>`);
|
|
700
700
|
var EMPTY_FUNCTIONS = {};
|
|
701
701
|
var FunctionsContext = createContext6(EMPTY_FUNCTIONS);
|
|
702
702
|
function useFunctions() {
|
|
703
703
|
return useContext6(FunctionsContext) ?? EMPTY_FUNCTIONS;
|
|
704
704
|
}
|
|
705
|
+
var DirectivesContext = createContext6(void 0);
|
|
706
|
+
function useDirectives() {
|
|
707
|
+
return useContext6(DirectivesContext);
|
|
708
|
+
}
|
|
705
709
|
function useDevtoolsActive() {
|
|
706
710
|
const [active, setActive] = createSignal4(isDevtoolsActive());
|
|
707
711
|
const unsub = subscribeDevtoolsActive(() => setActive(isDevtoolsActive()));
|
|
@@ -719,6 +723,7 @@ function ElementRenderer(props) {
|
|
|
719
723
|
const stateStore = useStateStore();
|
|
720
724
|
const getSnapshot = () => stateStore.getSnapshot();
|
|
721
725
|
const functions = useFunctions();
|
|
726
|
+
const directives = useDirectives();
|
|
722
727
|
const fullCtx = createMemo3(() => {
|
|
723
728
|
const repeatItem = repeatScope?.item;
|
|
724
729
|
const repeatIndex = repeatScope?.index;
|
|
@@ -736,7 +741,8 @@ function ElementRenderer(props) {
|
|
|
736
741
|
...repeatBasePath !== void 0 ? {
|
|
737
742
|
repeatBasePath
|
|
738
743
|
} : {},
|
|
739
|
-
functions
|
|
744
|
+
functions,
|
|
745
|
+
directives
|
|
740
746
|
};
|
|
741
747
|
});
|
|
742
748
|
const isVisible = createMemo3(() => props.element.visible === void 0 ? true : evaluateVisibility2(props.element.visible, fullCtx()));
|
|
@@ -1072,6 +1078,7 @@ function Renderer(props) {
|
|
|
1072
1078
|
});
|
|
1073
1079
|
}
|
|
1074
1080
|
function JSONUIProvider(props) {
|
|
1081
|
+
const directiveRegistry = createMemo3(() => props.directives ? createDirectiveRegistry(props.directives) : void 0);
|
|
1075
1082
|
return _$createComponent6(StateProvider, {
|
|
1076
1083
|
get store() {
|
|
1077
1084
|
return props.store;
|
|
@@ -1103,7 +1110,14 @@ function JSONUIProvider(props) {
|
|
|
1103
1110
|
return props.functions ?? EMPTY_FUNCTIONS;
|
|
1104
1111
|
},
|
|
1105
1112
|
get children() {
|
|
1106
|
-
return
|
|
1113
|
+
return _$createComponent6(DirectivesContext.Provider, {
|
|
1114
|
+
get value() {
|
|
1115
|
+
return directiveRegistry();
|
|
1116
|
+
},
|
|
1117
|
+
get children() {
|
|
1118
|
+
return [_$memo2(() => props.children), _$createComponent6(ConfirmationDialogManager, {})];
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1107
1121
|
}
|
|
1108
1122
|
});
|
|
1109
1123
|
}
|
|
@@ -1189,6 +1203,7 @@ function defineRegistry(_catalog, options) {
|
|
|
1189
1203
|
function createRenderer(catalog, components) {
|
|
1190
1204
|
const registry = components;
|
|
1191
1205
|
return function CatalogRenderer(props) {
|
|
1206
|
+
const directiveRegistry = createMemo3(() => props.directives ? createDirectiveRegistry(props.directives) : void 0);
|
|
1192
1207
|
const actionHandlers = () => props.onAction ? new Proxy({}, {
|
|
1193
1208
|
get: (_target, prop) => {
|
|
1194
1209
|
return (params) => props.onAction(prop, params);
|
|
@@ -1220,18 +1235,25 @@ function createRenderer(catalog, components) {
|
|
|
1220
1235
|
return props.functions ?? EMPTY_FUNCTIONS;
|
|
1221
1236
|
},
|
|
1222
1237
|
get children() {
|
|
1223
|
-
return
|
|
1224
|
-
get
|
|
1225
|
-
return
|
|
1226
|
-
},
|
|
1227
|
-
registry,
|
|
1228
|
-
get loading() {
|
|
1229
|
-
return props.loading;
|
|
1238
|
+
return _$createComponent6(DirectivesContext.Provider, {
|
|
1239
|
+
get value() {
|
|
1240
|
+
return directiveRegistry();
|
|
1230
1241
|
},
|
|
1231
|
-
get
|
|
1232
|
-
return
|
|
1242
|
+
get children() {
|
|
1243
|
+
return [_$createComponent6(Renderer, {
|
|
1244
|
+
get spec() {
|
|
1245
|
+
return props.spec;
|
|
1246
|
+
},
|
|
1247
|
+
registry,
|
|
1248
|
+
get loading() {
|
|
1249
|
+
return props.loading;
|
|
1250
|
+
},
|
|
1251
|
+
get fallback() {
|
|
1252
|
+
return props.fallback;
|
|
1253
|
+
}
|
|
1254
|
+
}), _$createComponent6(ConfirmationDialogManager, {})];
|
|
1233
1255
|
}
|
|
1234
|
-
})
|
|
1256
|
+
});
|
|
1235
1257
|
}
|
|
1236
1258
|
});
|
|
1237
1259
|
}
|