@json-render/vue 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.mjs CHANGED
@@ -1272,6 +1272,7 @@ import {
1272
1272
  resolveActionParam,
1273
1273
  evaluateVisibility as evaluateVisibility2,
1274
1274
  getByPath as getByPath3,
1275
+ createDirectiveRegistry,
1275
1276
  isDevtoolsActive,
1276
1277
  subscribeDevtoolsActive
1277
1278
  } from "@json-render/core";
@@ -1297,6 +1298,29 @@ function useFunctions() {
1297
1298
  computed6(() => EMPTY_FUNCTIONS)
1298
1299
  );
1299
1300
  }
1301
+ var DIRECTIVES_KEY = /* @__PURE__ */ Symbol("json-render:directives");
1302
+ var DirectivesProvider = defineComponent6({
1303
+ name: "DirectivesProvider",
1304
+ props: {
1305
+ directives: {
1306
+ type: Array,
1307
+ default: void 0
1308
+ }
1309
+ },
1310
+ setup(props, { slots }) {
1311
+ const registry = computed6(
1312
+ () => props.directives ? createDirectiveRegistry(props.directives) : void 0
1313
+ );
1314
+ provide6(DIRECTIVES_KEY, registry);
1315
+ return () => slots.default?.();
1316
+ }
1317
+ });
1318
+ function useDirectives() {
1319
+ return inject6(
1320
+ DIRECTIVES_KEY,
1321
+ computed6(() => void 0)
1322
+ );
1323
+ }
1300
1324
  var ElementErrorBoundary = defineComponent6({
1301
1325
  name: "ElementErrorBoundary",
1302
1326
  props: {
@@ -1384,6 +1408,7 @@ var ElementRenderer = defineComponent6({
1384
1408
  const { execute } = useActions();
1385
1409
  const { getSnapshot, state: watchState } = useStateStore();
1386
1410
  const functions = useFunctions();
1411
+ const directives = useDirectives();
1387
1412
  const fullCtx = computed6(() => {
1388
1413
  const base = repeatScope ? {
1389
1414
  ...visibilityCtx.value,
@@ -1392,6 +1417,7 @@ var ElementRenderer = defineComponent6({
1392
1417
  repeatBasePath: repeatScope.basePath
1393
1418
  } : { ...visibilityCtx.value };
1394
1419
  base.functions = functions.value;
1420
+ base.directives = directives.value;
1395
1421
  return base;
1396
1422
  });
1397
1423
  const emitEvent = async (eventName) => {
@@ -1671,6 +1697,10 @@ var JSONUIProvider = defineComponent6({
1671
1697
  type: Object,
1672
1698
  default: void 0
1673
1699
  },
1700
+ directives: {
1701
+ type: Array,
1702
+ default: void 0
1703
+ },
1674
1704
  onStateChange: {
1675
1705
  type: Function,
1676
1706
  default: void 0
@@ -1698,10 +1728,16 @@ var JSONUIProvider = defineComponent6({
1698
1728
  FunctionsProvider,
1699
1729
  { functions: props.functions },
1700
1730
  {
1701
- default: () => [
1702
- slots.default?.(),
1703
- h2(ConfirmationDialogManager)
1704
- ]
1731
+ default: () => h2(
1732
+ DirectivesProvider,
1733
+ { directives: props.directives },
1734
+ {
1735
+ default: () => [
1736
+ slots.default?.(),
1737
+ h2(ConfirmationDialogManager)
1738
+ ]
1739
+ }
1740
+ )
1705
1741
  }
1706
1742
  )
1707
1743
  }
@@ -1807,6 +1843,10 @@ function createRenderer(catalog, components) {
1807
1843
  type: Object,
1808
1844
  default: void 0
1809
1845
  },
1846
+ directives: {
1847
+ type: Array,
1848
+ default: void 0
1849
+ },
1810
1850
  loading: {
1811
1851
  type: Boolean,
1812
1852
  default: void 0
@@ -1845,15 +1885,21 @@ function createRenderer(catalog, components) {
1845
1885
  FunctionsProvider,
1846
1886
  { functions: rendererProps.functions },
1847
1887
  {
1848
- default: () => [
1849
- h2(Renderer, {
1850
- spec: rendererProps.spec,
1851
- registry,
1852
- loading: rendererProps.loading,
1853
- fallback: rendererProps.fallback
1854
- }),
1855
- h2(ConfirmationDialogManager)
1856
- ]
1888
+ default: () => h2(
1889
+ DirectivesProvider,
1890
+ { directives: rendererProps.directives },
1891
+ {
1892
+ default: () => [
1893
+ h2(Renderer, {
1894
+ spec: rendererProps.spec,
1895
+ registry,
1896
+ loading: rendererProps.loading,
1897
+ fallback: rendererProps.fallback
1898
+ }),
1899
+ h2(ConfirmationDialogManager)
1900
+ ]
1901
+ }
1902
+ )
1857
1903
  }
1858
1904
  )
1859
1905
  }