@narrative.io/jsonforms-provider-protocols 1.1.0-beta.11 → 1.1.0-beta.13

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.
@@ -4,7 +4,7 @@ import JfNumber from "./JfNumber.vue";
4
4
  import JfEnum from "./JfEnum.vue";
5
5
  import JfEnumArray from "./JfEnumArray.vue";
6
6
  import JfBoolean from "./JfBoolean.vue";
7
- import type { JsonFormsRendererRegistryEntry } from "@jsonforms/core";
8
- export declare const primevueRenderers: JsonFormsRendererRegistryEntry[];
7
+ export declare const primevueRenderers: unknown[];
8
+ export declare function registerPrimevueRenderers(jsonformsCore: any): unknown[];
9
9
  export { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AA+BxC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AA2BtE,eAAO,MAAM,iBAAiB,EAAE,8BAA8B,EAAO,CAAC;AA+CtE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vue/primevue/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAiCxC,eAAO,MAAM,iBAAiB,EAAE,OAAO,EAAO,CAAC;AAK/C,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,EAAE,CA0EvE;AAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC"}
@@ -1,9 +1,13 @@
1
- import _sfc_main$1 from "./JfText.vue.js";
2
- import _sfc_main from "./JfTextArea.vue.js";
3
- import _sfc_main$2 from "./JfNumber.vue.js";
4
- import _sfc_main$3 from "./JfEnum.vue.js";
5
- import _sfc_main$4 from "./JfEnumArray.vue.js";
6
- import _sfc_main$5 from "./JfBoolean.vue.js";
1
+ import "vue";
2
+ import "@jsonforms/vue";
3
+ import "@jsonforms/core";
4
+ import "primevue/inputtext";
5
+ import "primevue/autocomplete";
6
+ import "primevue/textarea";
7
+ import "primevue/inputnumber";
8
+ import "primevue/dropdown";
9
+ import "primevue/multiselect";
10
+ import "primevue/checkbox";
7
11
  const injectLayoutStyles = () => {
8
12
  if (typeof window !== "undefined" && typeof document !== "undefined") {
9
13
  if (!document.getElementById("jsonforms-primevue-styles")) {
@@ -28,63 +32,8 @@ const injectLayoutStyles = () => {
28
32
  }
29
33
  };
30
34
  injectLayoutStyles();
31
- const isScalarEnum = (s) => {
32
- const schema = s;
33
- return schema && schema.type !== "array" && (Array.isArray(schema.enum) || Array.isArray(schema.oneOf));
34
- };
35
- const isEnumArray = (s) => {
36
- const schema = s;
37
- return schema?.type === "array" && (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf));
38
- };
39
- const PRIME = 100;
40
35
  const primevueRenderers = [];
41
- Promise.resolve().then(async () => {
42
- const jsonformsCore = await import("@jsonforms/core");
43
- const {
44
- rankWith,
45
- isStringControl,
46
- or,
47
- isNumberControl,
48
- isIntegerControl,
49
- and,
50
- isControl,
51
- schemaMatches,
52
- isBooleanControl
53
- } = jsonformsCore;
54
- const isMultilineString = (uischema, schema) => {
55
- const controlUischema = uischema;
56
- return and(isStringControl, () => controlUischema?.options?.multi === true)(
57
- uischema,
58
- schema,
59
- {}
60
- );
61
- };
62
- primevueRenderers.push(
63
- // Multiline text has higher priority than regular text
64
- { tester: rankWith(PRIME + 4, isMultilineString), renderer: _sfc_main },
65
- { tester: rankWith(PRIME + 3, isStringControl), renderer: _sfc_main$1 },
66
- {
67
- tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),
68
- renderer: _sfc_main$2
69
- },
70
- {
71
- tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),
72
- renderer: _sfc_main$3
73
- },
74
- {
75
- tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),
76
- renderer: _sfc_main$4
77
- },
78
- { tester: rankWith(PRIME + 3, isBooleanControl), renderer: _sfc_main$5 }
79
- );
80
- });
81
36
  export {
82
- _sfc_main$5 as JfBoolean,
83
- _sfc_main$3 as JfEnum,
84
- _sfc_main$4 as JfEnumArray,
85
- _sfc_main$2 as JfNumber,
86
- _sfc_main$1 as JfText,
87
- _sfc_main as JfTextArea,
88
37
  primevueRenderers
89
38
  };
90
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/vue/primevue/index.ts"],"sourcesContent":["import JfText from \"./JfText.vue\";\nimport JfTextArea from \"./JfTextArea.vue\";\nimport JfNumber from \"./JfNumber.vue\";\nimport JfEnum from \"./JfEnum.vue\";\nimport JfEnumArray from \"./JfEnumArray.vue\";\nimport JfBoolean from \"./JfBoolean.vue\";\n\n// Auto-inject layout styles\nconst injectLayoutStyles = () => {\n if (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n if (!document.getElementById(\"jsonforms-primevue-styles\")) {\n const style = document.createElement(\"style\");\n style.id = \"jsonforms-primevue-styles\";\n style.textContent = `\n/* JSONForms PrimeVue Provider Protocols Layout Styles */\n.vertical-layout {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 1rem;\n width: 100%;\n}\n\n.vertical-layout-item {\n width: 100%;\n}\n `;\n document.head.appendChild(style);\n }\n }\n};\n\n// Inject styles when this module is imported\ninjectLayoutStyles();\n\n// Import types only to avoid circular dependencies\nimport type { JsonFormsRendererRegistryEntry } from \"@jsonforms/core\";\n\n// helpers for enum detection\nconst isScalarEnum = (s?: object) => {\n const schema = s as { type?: string; enum?: unknown[]; oneOf?: unknown[] };\n return (\n schema &&\n schema.type !== \"array\" &&\n (Array.isArray(schema.enum) || Array.isArray(schema.oneOf))\n );\n};\n\nconst isEnumArray = (s?: object) => {\n const schema = s as {\n type?: string;\n items?: { enum?: unknown[]; oneOf?: unknown[] };\n };\n return (\n schema?.type === \"array\" &&\n (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf))\n );\n};\n\n// Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)\nconst PRIME = 100;\n\n// Create empty array first, populate it after module initialization to avoid circular deps\nexport const primevueRenderers: JsonFormsRendererRegistryEntry[] = [];\n\n// Populate the renderers array after a microtask delay to avoid circular dependency\nPromise.resolve().then(async () => {\n const jsonformsCore = await import(\"@jsonforms/core\");\n const {\n rankWith,\n isStringControl,\n or,\n isNumberControl,\n isIntegerControl,\n and,\n isControl,\n schemaMatches,\n isBooleanControl,\n } = jsonformsCore;\n\n // helper for multiline detection moved inside async block\n const isMultilineString = (uischema: unknown, schema: unknown) => {\n const controlUischema = uischema as { options?: { multi?: boolean } };\n return and(isStringControl, () => controlUischema?.options?.multi === true)(\n uischema as Parameters<typeof isStringControl>[0],\n schema as Parameters<typeof isStringControl>[1],\n {} as Parameters<typeof isStringControl>[2],\n );\n };\n\n primevueRenderers.push(\n // Multiline text has higher priority than regular text\n { tester: rankWith(PRIME + 4, isMultilineString), renderer: JfTextArea },\n { tester: rankWith(PRIME + 3, isStringControl), renderer: JfText },\n {\n tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),\n renderer: JfNumber,\n },\n {\n tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),\n renderer: JfEnum,\n },\n {\n tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),\n renderer: JfEnumArray,\n },\n { tester: rankWith(PRIME + 3, isBooleanControl), renderer: JfBoolean },\n );\n});\n\nexport { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };\n"],"names":["JfTextArea","JfText","JfNumber","JfEnum","JfEnumArray","JfBoolean"],"mappings":";;;;;;AAQA,MAAM,qBAAqB,MAAM;AAC/B,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,QAAI,CAAC,SAAS,eAAe,2BAA2B,GAAG;AACzD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcpB,eAAS,KAAK,YAAY,KAAK;AAAA,IACjC;AAAA,EACF;AACF;AAGA,mBAAA;AAMA,MAAM,eAAe,CAAC,MAAe;AACnC,QAAM,SAAS;AACf,SACE,UACA,OAAO,SAAS,YACf,MAAM,QAAQ,OAAO,IAAI,KAAK,MAAM,QAAQ,OAAO,KAAK;AAE7D;AAEA,MAAM,cAAc,CAAC,MAAe;AAClC,QAAM,SAAS;AAIf,SACE,QAAQ,SAAS,YAChB,MAAM,QAAQ,OAAO,OAAO,IAAI,KAAK,MAAM,QAAQ,OAAO,OAAO,KAAK;AAE3E;AAGA,MAAM,QAAQ;AAGP,MAAM,oBAAsD,CAAA;AAGnE,QAAQ,QAAA,EAAU,KAAK,YAAY;AACjC,QAAM,gBAAgB,MAAM,OAAO,iBAAiB;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAGJ,QAAM,oBAAoB,CAAC,UAAmB,WAAoB;AAChE,UAAM,kBAAkB;AACxB,WAAO,IAAI,iBAAiB,MAAM,iBAAiB,SAAS,UAAU,IAAI;AAAA,MACxE;AAAA,MACA;AAAA,MACA,CAAA;AAAA,IAAC;AAAA,EAEL;AAEA,oBAAkB;AAAA;AAAA,IAEhB,EAAE,QAAQ,SAAS,QAAQ,GAAG,iBAAiB,GAAG,UAAUA,UAAA;AAAA,IAC5D,EAAE,QAAQ,SAAS,QAAQ,GAAG,eAAe,GAAG,UAAUC,YAAA;AAAA,IAC1D;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,GAAG,iBAAiB,gBAAgB,CAAC;AAAA,MACjE,UAAUC;AAAAA,IAAA;AAAA,IAEZ;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,YAAY,CAAC,CAAC;AAAA,MACvE,UAAUC;AAAAA,IAAA;AAAA,IAEZ;AAAA,MACE,QAAQ,SAAS,QAAQ,GAAG,IAAI,WAAW,cAAc,WAAW,CAAC,CAAC;AAAA,MACtE,UAAUC;AAAAA,IAAA;AAAA,IAEZ,EAAE,QAAQ,SAAS,QAAQ,GAAG,gBAAgB,GAAG,UAAUC,YAAA;AAAA,EAAU;AAEzE,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/vue/primevue/index.ts"],"sourcesContent":["import JfText from \"./JfText.vue\";\nimport JfTextArea from \"./JfTextArea.vue\";\nimport JfNumber from \"./JfNumber.vue\";\nimport JfEnum from \"./JfEnum.vue\";\nimport JfEnumArray from \"./JfEnumArray.vue\";\nimport JfBoolean from \"./JfBoolean.vue\";\n\n// Auto-inject layout styles\nconst injectLayoutStyles = () => {\n if (typeof window !== \"undefined\" && typeof document !== \"undefined\") {\n if (!document.getElementById(\"jsonforms-primevue-styles\")) {\n const style = document.createElement(\"style\");\n style.id = \"jsonforms-primevue-styles\";\n style.textContent = `\n/* JSONForms PrimeVue Provider Protocols Layout Styles */\n.vertical-layout {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 1rem;\n width: 100%;\n}\n\n.vertical-layout-item {\n width: 100%;\n}\n `;\n document.head.appendChild(style);\n }\n }\n};\n\n// Inject styles when this module is imported\ninjectLayoutStyles();\n\n// Return empty renderers array - let the consuming application handle renderer registration\n// This avoids all circular dependency and AJV schema compilation issues\n\nexport const primevueRenderers: unknown[] = [];\n\n// Export a function that can be called by the consumer to register renderers\n// This puts the burden on the consuming application to call this after JSONForms is fully loaded\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function registerPrimevueRenderers(jsonformsCore: any): unknown[] {\n const {\n rankWith,\n isStringControl,\n or,\n isNumberControl,\n isIntegerControl,\n and,\n isControl,\n schemaMatches,\n isBooleanControl,\n } = jsonformsCore;\n\n // Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)\n const PRIME = 100;\n\n // helpers for enum detection\n const isScalarEnum = (s?: object) => {\n const schema = s as {\n type?: string;\n enum?: unknown[];\n oneOf?: unknown[];\n };\n return (\n schema &&\n schema.type !== \"array\" &&\n (Array.isArray(schema.enum) || Array.isArray(schema.oneOf))\n );\n };\n\n const isEnumArray = (s?: object) => {\n const schema = s as {\n type?: string;\n items?: { enum?: unknown[]; oneOf?: unknown[] };\n };\n return (\n schema?.type === \"array\" &&\n (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf))\n );\n };\n\n // helper for multiline detection\n const isMultilineString = (uischema: unknown, schema: unknown) => {\n const controlUischema = uischema as { options?: { multi?: boolean } };\n return and(isStringControl, () => controlUischema?.options?.multi === true)(\n uischema as Parameters<typeof isStringControl>[0],\n schema as Parameters<typeof isStringControl>[1],\n {} as Parameters<typeof isStringControl>[2],\n );\n };\n\n const renderers = [\n // Multiline text has higher priority than regular text\n { tester: rankWith(PRIME + 4, isMultilineString), renderer: JfTextArea },\n { tester: rankWith(PRIME + 3, isStringControl), renderer: JfText },\n {\n tester: rankWith(PRIME + 4, or(isNumberControl, isIntegerControl)),\n renderer: JfNumber,\n },\n {\n tester: rankWith(PRIME + 5, and(isControl, schemaMatches(isScalarEnum))),\n renderer: JfEnum,\n },\n {\n tester: rankWith(PRIME + 6, and(isControl, schemaMatches(isEnumArray))),\n renderer: JfEnumArray,\n },\n { tester: rankWith(PRIME + 3, isBooleanControl), renderer: JfBoolean },\n ];\n\n // Update the exported array\n primevueRenderers.splice(0, primevueRenderers.length, ...renderers);\n\n return renderers;\n}\n\nexport { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };\n"],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,qBAAqB,MAAM;AAC/B,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,QAAI,CAAC,SAAS,eAAe,2BAA2B,GAAG;AACzD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcpB,eAAS,KAAK,YAAY,KAAK;AAAA,IACjC;AAAA,EACF;AACF;AAGA,mBAAA;AAKO,MAAM,oBAA+B,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/jsonforms-provider-protocols",
3
- "version": "1.1.0-beta.11",
3
+ "version": "1.1.0-beta.13",
4
4
  "description": "Dynamic data provider capabilities for JSONForms with Vue 3 integration",
5
5
  "type": "module",
6
6
  "author": "Narrative I/O",
@@ -33,39 +33,15 @@ const injectLayoutStyles = () => {
33
33
  // Inject styles when this module is imported
34
34
  injectLayoutStyles();
35
35
 
36
- // Import types only to avoid circular dependencies
37
- import type { JsonFormsRendererRegistryEntry } from "@jsonforms/core";
36
+ // Return empty renderers array - let the consuming application handle renderer registration
37
+ // This avoids all circular dependency and AJV schema compilation issues
38
38
 
39
- // helpers for enum detection
40
- const isScalarEnum = (s?: object) => {
41
- const schema = s as { type?: string; enum?: unknown[]; oneOf?: unknown[] };
42
- return (
43
- schema &&
44
- schema.type !== "array" &&
45
- (Array.isArray(schema.enum) || Array.isArray(schema.oneOf))
46
- );
47
- };
48
-
49
- const isEnumArray = (s?: object) => {
50
- const schema = s as {
51
- type?: string;
52
- items?: { enum?: unknown[]; oneOf?: unknown[] };
53
- };
54
- return (
55
- schema?.type === "array" &&
56
- (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf))
57
- );
58
- };
39
+ export const primevueRenderers: unknown[] = [];
59
40
 
60
- // Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)
61
- const PRIME = 100;
62
-
63
- // Create empty array first, populate it after module initialization to avoid circular deps
64
- export const primevueRenderers: JsonFormsRendererRegistryEntry[] = [];
65
-
66
- // Populate the renderers array after a microtask delay to avoid circular dependency
67
- Promise.resolve().then(async () => {
68
- const jsonformsCore = await import("@jsonforms/core");
41
+ // Export a function that can be called by the consumer to register renderers
42
+ // This puts the burden on the consuming application to call this after JSONForms is fully loaded
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ export function registerPrimevueRenderers(jsonformsCore: any): unknown[] {
69
45
  const {
70
46
  rankWith,
71
47
  isStringControl,
@@ -78,7 +54,35 @@ Promise.resolve().then(async () => {
78
54
  isBooleanControl,
79
55
  } = jsonformsCore;
80
56
 
81
- // helper for multiline detection moved inside async block
57
+ // Give PrimeVue renderers a high base rank; vanilla commonly uses small ranks (2–5)
58
+ const PRIME = 100;
59
+
60
+ // helpers for enum detection
61
+ const isScalarEnum = (s?: object) => {
62
+ const schema = s as {
63
+ type?: string;
64
+ enum?: unknown[];
65
+ oneOf?: unknown[];
66
+ };
67
+ return (
68
+ schema &&
69
+ schema.type !== "array" &&
70
+ (Array.isArray(schema.enum) || Array.isArray(schema.oneOf))
71
+ );
72
+ };
73
+
74
+ const isEnumArray = (s?: object) => {
75
+ const schema = s as {
76
+ type?: string;
77
+ items?: { enum?: unknown[]; oneOf?: unknown[] };
78
+ };
79
+ return (
80
+ schema?.type === "array" &&
81
+ (Array.isArray(schema.items?.enum) || Array.isArray(schema.items?.oneOf))
82
+ );
83
+ };
84
+
85
+ // helper for multiline detection
82
86
  const isMultilineString = (uischema: unknown, schema: unknown) => {
83
87
  const controlUischema = uischema as { options?: { multi?: boolean } };
84
88
  return and(isStringControl, () => controlUischema?.options?.multi === true)(
@@ -88,7 +92,7 @@ Promise.resolve().then(async () => {
88
92
  );
89
93
  };
90
94
 
91
- primevueRenderers.push(
95
+ const renderers = [
92
96
  // Multiline text has higher priority than regular text
93
97
  { tester: rankWith(PRIME + 4, isMultilineString), renderer: JfTextArea },
94
98
  { tester: rankWith(PRIME + 3, isStringControl), renderer: JfText },
@@ -105,7 +109,12 @@ Promise.resolve().then(async () => {
105
109
  renderer: JfEnumArray,
106
110
  },
107
111
  { tester: rankWith(PRIME + 3, isBooleanControl), renderer: JfBoolean },
108
- );
109
- });
112
+ ];
113
+
114
+ // Update the exported array
115
+ primevueRenderers.splice(0, primevueRenderers.length, ...renderers);
116
+
117
+ return renderers;
118
+ }
110
119
 
111
120
  export { JfText, JfTextArea, JfNumber, JfEnum, JfEnumArray, JfBoolean };