@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.d.mts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType, ShallowRef, ComputedRef, VNode, Ref, Component } from 'vue';
3
- import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, UIElement } from '@json-render/core';
3
+ import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, DirectiveDefinition, UIElement } from '@json-render/core';
4
4
  export { ComputedFunction, Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
5
5
  export { VueSchema, VueSpec, schema } from './schema.mjs';
6
+ import * as zod from 'zod';
7
+ import * as zod_v4_core from 'zod/v4/core';
6
8
 
7
9
  /**
8
10
  * State context value
@@ -708,6 +710,8 @@ interface JSONUIProviderProps {
708
710
  validationFunctions?: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
709
711
  /** Named functions for `$computed` expressions in props */
710
712
  functions?: Record<string, ComputedFunction>;
713
+ /** Custom directives for user-defined `$`-prefixed dynamic values */
714
+ directives?: DirectiveDefinition[];
711
715
  onStateChange?: (changes: Array<{
712
716
  path: string;
713
717
  value: unknown;
@@ -745,6 +749,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
745
749
  type: PropType<Record<string, ComputedFunction>>;
746
750
  default: undefined;
747
751
  };
752
+ directives: {
753
+ type: PropType<DirectiveDefinition[]>;
754
+ default: undefined;
755
+ };
748
756
  onStateChange: {
749
757
  type: PropType<(changes: Array<{
750
758
  path: string;
@@ -783,6 +791,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
783
791
  type: PropType<Record<string, ComputedFunction>>;
784
792
  default: undefined;
785
793
  };
794
+ directives: {
795
+ type: PropType<DirectiveDefinition[]>;
796
+ default: undefined;
797
+ };
786
798
  onStateChange: {
787
799
  type: PropType<(changes: Array<{
788
800
  path: string;
@@ -800,6 +812,7 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
800
812
  handlers: Record<string, (params: Record<string, unknown>) => Promise<unknown> | unknown>;
801
813
  navigate: (path: string) => void;
802
814
  functions: Record<string, ComputedFunction>;
815
+ directives: DirectiveDefinition<zod.ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>[];
803
816
  validationFunctions: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
804
817
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
805
818
  /**
@@ -851,6 +864,8 @@ interface CreateRendererProps {
851
864
  }>) => void;
852
865
  /** Named functions for `$computed` expressions in props */
853
866
  functions?: Record<string, ComputedFunction>;
867
+ /** Custom directives for user-defined `$`-prefixed dynamic values */
868
+ directives?: DirectiveDefinition[];
854
869
  loading?: boolean;
855
870
  fallback?: Component;
856
871
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType, ShallowRef, ComputedRef, VNode, Ref, Component } from 'vue';
3
- import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, UIElement } from '@json-render/core';
3
+ import { StateStore, StateModel, VisibilityCondition, VisibilityContext, ActionHandler, ResolvedAction, ActionBinding, ActionConfirm, ValidationFunction, ValidationResult, ValidationConfig, Catalog, InferCatalogComponents, InferComponentProps, InferCatalogActions, InferActionParams, Spec, FlatElement, SchemaDefinition, ComputedFunction, DirectiveDefinition, UIElement } from '@json-render/core';
4
4
  export { ComputedFunction, Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
5
5
  export { VueSchema, VueSpec, schema } from './schema.js';
6
+ import * as zod from 'zod';
7
+ import * as zod_v4_core from 'zod/v4/core';
6
8
 
7
9
  /**
8
10
  * State context value
@@ -708,6 +710,8 @@ interface JSONUIProviderProps {
708
710
  validationFunctions?: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
709
711
  /** Named functions for `$computed` expressions in props */
710
712
  functions?: Record<string, ComputedFunction>;
713
+ /** Custom directives for user-defined `$`-prefixed dynamic values */
714
+ directives?: DirectiveDefinition[];
711
715
  onStateChange?: (changes: Array<{
712
716
  path: string;
713
717
  value: unknown;
@@ -745,6 +749,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
745
749
  type: PropType<Record<string, ComputedFunction>>;
746
750
  default: undefined;
747
751
  };
752
+ directives: {
753
+ type: PropType<DirectiveDefinition[]>;
754
+ default: undefined;
755
+ };
748
756
  onStateChange: {
749
757
  type: PropType<(changes: Array<{
750
758
  path: string;
@@ -783,6 +791,10 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
783
791
  type: PropType<Record<string, ComputedFunction>>;
784
792
  default: undefined;
785
793
  };
794
+ directives: {
795
+ type: PropType<DirectiveDefinition[]>;
796
+ default: undefined;
797
+ };
786
798
  onStateChange: {
787
799
  type: PropType<(changes: Array<{
788
800
  path: string;
@@ -800,6 +812,7 @@ declare const JSONUIProvider: vue.DefineComponent<vue.ExtractPropTypes<{
800
812
  handlers: Record<string, (params: Record<string, unknown>) => Promise<unknown> | unknown>;
801
813
  navigate: (path: string) => void;
802
814
  functions: Record<string, ComputedFunction>;
815
+ directives: DirectiveDefinition<zod.ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>[];
803
816
  validationFunctions: Record<string, (value: unknown, args?: Record<string, unknown>) => boolean>;
804
817
  }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
805
818
  /**
@@ -851,6 +864,8 @@ interface CreateRendererProps {
851
864
  }>) => void;
852
865
  /** Named functions for `$computed` expressions in props */
853
866
  functions?: Record<string, ComputedFunction>;
867
+ /** Custom directives for user-defined `$`-prefixed dynamic values */
868
+ directives?: DirectiveDefinition[];
854
869
  loading?: boolean;
855
870
  fallback?: Component;
856
871
  }
package/dist/index.js CHANGED
@@ -1354,6 +1354,29 @@ function useFunctions() {
1354
1354
  (0, import_vue7.computed)(() => EMPTY_FUNCTIONS)
1355
1355
  );
1356
1356
  }
1357
+ var DIRECTIVES_KEY = /* @__PURE__ */ Symbol("json-render:directives");
1358
+ var DirectivesProvider = (0, import_vue7.defineComponent)({
1359
+ name: "DirectivesProvider",
1360
+ props: {
1361
+ directives: {
1362
+ type: Array,
1363
+ default: void 0
1364
+ }
1365
+ },
1366
+ setup(props, { slots }) {
1367
+ const registry = (0, import_vue7.computed)(
1368
+ () => props.directives ? (0, import_core7.createDirectiveRegistry)(props.directives) : void 0
1369
+ );
1370
+ (0, import_vue7.provide)(DIRECTIVES_KEY, registry);
1371
+ return () => slots.default?.();
1372
+ }
1373
+ });
1374
+ function useDirectives() {
1375
+ return (0, import_vue7.inject)(
1376
+ DIRECTIVES_KEY,
1377
+ (0, import_vue7.computed)(() => void 0)
1378
+ );
1379
+ }
1357
1380
  var ElementErrorBoundary = (0, import_vue7.defineComponent)({
1358
1381
  name: "ElementErrorBoundary",
1359
1382
  props: {
@@ -1441,6 +1464,7 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
1441
1464
  const { execute } = useActions();
1442
1465
  const { getSnapshot, state: watchState } = useStateStore();
1443
1466
  const functions = useFunctions();
1467
+ const directives = useDirectives();
1444
1468
  const fullCtx = (0, import_vue7.computed)(() => {
1445
1469
  const base = repeatScope ? {
1446
1470
  ...visibilityCtx.value,
@@ -1449,6 +1473,7 @@ var ElementRenderer = (0, import_vue7.defineComponent)({
1449
1473
  repeatBasePath: repeatScope.basePath
1450
1474
  } : { ...visibilityCtx.value };
1451
1475
  base.functions = functions.value;
1476
+ base.directives = directives.value;
1452
1477
  return base;
1453
1478
  });
1454
1479
  const emitEvent = async (eventName) => {
@@ -1728,6 +1753,10 @@ var JSONUIProvider = (0, import_vue7.defineComponent)({
1728
1753
  type: Object,
1729
1754
  default: void 0
1730
1755
  },
1756
+ directives: {
1757
+ type: Array,
1758
+ default: void 0
1759
+ },
1731
1760
  onStateChange: {
1732
1761
  type: Function,
1733
1762
  default: void 0
@@ -1755,10 +1784,16 @@ var JSONUIProvider = (0, import_vue7.defineComponent)({
1755
1784
  FunctionsProvider,
1756
1785
  { functions: props.functions },
1757
1786
  {
1758
- default: () => [
1759
- slots.default?.(),
1760
- (0, import_vue7.h)(ConfirmationDialogManager)
1761
- ]
1787
+ default: () => (0, import_vue7.h)(
1788
+ DirectivesProvider,
1789
+ { directives: props.directives },
1790
+ {
1791
+ default: () => [
1792
+ slots.default?.(),
1793
+ (0, import_vue7.h)(ConfirmationDialogManager)
1794
+ ]
1795
+ }
1796
+ )
1762
1797
  }
1763
1798
  )
1764
1799
  }
@@ -1864,6 +1899,10 @@ function createRenderer(catalog, components) {
1864
1899
  type: Object,
1865
1900
  default: void 0
1866
1901
  },
1902
+ directives: {
1903
+ type: Array,
1904
+ default: void 0
1905
+ },
1867
1906
  loading: {
1868
1907
  type: Boolean,
1869
1908
  default: void 0
@@ -1902,15 +1941,21 @@ function createRenderer(catalog, components) {
1902
1941
  FunctionsProvider,
1903
1942
  { functions: rendererProps.functions },
1904
1943
  {
1905
- default: () => [
1906
- (0, import_vue7.h)(Renderer, {
1907
- spec: rendererProps.spec,
1908
- registry,
1909
- loading: rendererProps.loading,
1910
- fallback: rendererProps.fallback
1911
- }),
1912
- (0, import_vue7.h)(ConfirmationDialogManager)
1913
- ]
1944
+ default: () => (0, import_vue7.h)(
1945
+ DirectivesProvider,
1946
+ { directives: rendererProps.directives },
1947
+ {
1948
+ default: () => [
1949
+ (0, import_vue7.h)(Renderer, {
1950
+ spec: rendererProps.spec,
1951
+ registry,
1952
+ loading: rendererProps.loading,
1953
+ fallback: rendererProps.fallback
1954
+ }),
1955
+ (0, import_vue7.h)(ConfirmationDialogManager)
1956
+ ]
1957
+ }
1958
+ )
1914
1959
  }
1915
1960
  )
1916
1961
  }