@ethereal-nexus/core 0.2.0 → 0.2.2

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.
Files changed (42) hide show
  1. package/dist/functions/component/component.d.mts +15 -0
  2. package/dist/functions/component/component.d.ts +15 -0
  3. package/dist/functions/component/component.js +46 -0
  4. package/dist/functions/component/component.js.map +1 -0
  5. package/dist/functions/component/component.mjs +21 -0
  6. package/dist/functions/component/component.mjs.map +1 -0
  7. package/dist/functions/component/index.d.mts +8 -0
  8. package/dist/functions/component/index.d.ts +8 -0
  9. package/dist/functions/component/index.js +48 -0
  10. package/dist/functions/component/index.js.map +1 -0
  11. package/dist/functions/component/index.mjs +21 -0
  12. package/dist/functions/component/index.mjs.map +1 -0
  13. package/dist/functions/index.d.mts +5 -12
  14. package/dist/functions/index.d.ts +5 -12
  15. package/dist/index.d.mts +3 -2
  16. package/dist/index.d.ts +3 -2
  17. package/dist/index.js +21 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +20 -0
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/schema/rte/index.d.mts +3 -0
  22. package/dist/schema/rte/index.d.ts +3 -0
  23. package/dist/schema/rte/index.js +49 -0
  24. package/dist/schema/rte/index.js.map +1 -0
  25. package/dist/schema/rte/index.mjs +22 -0
  26. package/dist/schema/rte/index.mjs.map +1 -0
  27. package/dist/schema/rte/rte.d.mts +15 -0
  28. package/dist/schema/rte/rte.d.ts +15 -0
  29. package/dist/schema/rte/rte.js +47 -0
  30. package/dist/schema/rte/rte.js.map +1 -0
  31. package/dist/schema/rte/rte.mjs +22 -0
  32. package/dist/schema/rte/rte.mjs.map +1 -0
  33. package/dist/{component-oiRVWRBc.d.mts → types/component.d.mts} +1 -1
  34. package/dist/{component-oiRVWRBc.d.ts → types/component.d.ts} +1 -1
  35. package/dist/types/component.js +19 -0
  36. package/dist/types/component.js.map +1 -0
  37. package/dist/types/component.mjs +1 -0
  38. package/dist/types/component.mjs.map +1 -0
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/package.json +1 -1
  42. /package/{LICENSE → LICENSE.md} +0 -0
@@ -0,0 +1,15 @@
1
+ import { BaseSchema } from '../../types/schema.mjs';
2
+ import { ComponentModel } from '../../types/component.mjs';
3
+ import { ObjectEntries, ObjectOutput } from '../../types/object.mjs';
4
+ import { DialogSchema } from '../../schema/dialog/dialog.mjs';
5
+ import '../../types/webcomponent.mjs';
6
+ import '../../schema/optional/optional.mjs';
7
+ import '../../types/utils.mjs';
8
+
9
+ interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {
10
+ type: 'component';
11
+ dialog: Omit<DialogSchema<TEntries>, 'tabs'>;
12
+ }
13
+ declare function component<TEntries extends ObjectEntries>(config: Partial<ComponentModel>, dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>): ComponentSchema<TEntries>;
14
+
15
+ export { type ComponentSchema, component };
@@ -0,0 +1,15 @@
1
+ import { BaseSchema } from '../../types/schema.js';
2
+ import { ComponentModel } from '../../types/component.js';
3
+ import { ObjectEntries, ObjectOutput } from '../../types/object.js';
4
+ import { DialogSchema } from '../../schema/dialog/dialog.js';
5
+ import '../../types/webcomponent.js';
6
+ import '../../schema/optional/optional.js';
7
+ import '../../types/utils.js';
8
+
9
+ interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {
10
+ type: 'component';
11
+ dialog: Omit<DialogSchema<TEntries>, 'tabs'>;
12
+ }
13
+ declare function component<TEntries extends ObjectEntries>(config: Partial<ComponentModel>, dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>): ComponentSchema<TEntries>;
14
+
15
+ export { type ComponentSchema, component };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/functions/component/component.ts
21
+ var component_exports = {};
22
+ __export(component_exports, {
23
+ component: () => component
24
+ });
25
+ module.exports = __toCommonJS(component_exports);
26
+ function component(config, dialogInstance) {
27
+ return {
28
+ type: "component",
29
+ dialog: dialogInstance,
30
+ _parse() {
31
+ return {
32
+ ...config,
33
+ ...dialogInstance._parse()
34
+ };
35
+ },
36
+ _primitive() {
37
+ return dialogInstance._primitive();
38
+ },
39
+ ...config
40
+ };
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ component
45
+ });
46
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ // src/functions/component/component.ts
2
+ function component(config, dialogInstance) {
3
+ return {
4
+ type: "component",
5
+ dialog: dialogInstance,
6
+ _parse() {
7
+ return {
8
+ ...config,
9
+ ...dialogInstance._parse()
10
+ };
11
+ },
12
+ _primitive() {
13
+ return dialogInstance._primitive();
14
+ },
15
+ ...config
16
+ };
17
+ }
18
+ export {
19
+ component
20
+ };
21
+ //# sourceMappingURL=component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";AASO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,8 @@
1
+ export { ComponentSchema, component } from './component.mjs';
2
+ import '../../types/schema.mjs';
3
+ import '../../types/webcomponent.mjs';
4
+ import '../../types/component.mjs';
5
+ import '../../types/object.mjs';
6
+ import '../../schema/optional/optional.mjs';
7
+ import '../../types/utils.mjs';
8
+ import '../../schema/dialog/dialog.mjs';
@@ -0,0 +1,8 @@
1
+ export { ComponentSchema, component } from './component.js';
2
+ import '../../types/schema.js';
3
+ import '../../types/webcomponent.js';
4
+ import '../../types/component.js';
5
+ import '../../types/object.js';
6
+ import '../../schema/optional/optional.js';
7
+ import '../../types/utils.js';
8
+ import '../../schema/dialog/dialog.js';
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/functions/component/index.ts
21
+ var component_exports = {};
22
+ __export(component_exports, {
23
+ component: () => component
24
+ });
25
+ module.exports = __toCommonJS(component_exports);
26
+
27
+ // src/functions/component/component.ts
28
+ function component(config, dialogInstance) {
29
+ return {
30
+ type: "component",
31
+ dialog: dialogInstance,
32
+ _parse() {
33
+ return {
34
+ ...config,
35
+ ...dialogInstance._parse()
36
+ };
37
+ },
38
+ _primitive() {
39
+ return dialogInstance._primitive();
40
+ },
41
+ ...config
42
+ };
43
+ }
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ component
47
+ });
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/functions/component/index.ts","../../../src/functions/component/component.ts"],"sourcesContent":["export * from './component';\n","import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ // src/functions/component/component.ts
2
+ function component(config, dialogInstance) {
3
+ return {
4
+ type: "component",
5
+ dialog: dialogInstance,
6
+ _parse() {
7
+ return {
8
+ ...config,
9
+ ...dialogInstance._parse()
10
+ };
11
+ },
12
+ _primitive() {
13
+ return dialogInstance._primitive();
14
+ },
15
+ ...config
16
+ };
17
+ }
18
+ export {
19
+ component
20
+ };
21
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";AASO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -1,17 +1,10 @@
1
1
  export { parse } from './parse/parse.mjs';
2
2
  export { parsePrimitives } from './parse/parsePrimitives.mjs';
3
- import { BaseSchema } from '../types/schema.mjs';
4
- import { C as ComponentModel } from '../component-oiRVWRBc.mjs';
5
- import { ObjectEntries, ObjectOutput } from '../types/object.mjs';
6
- import { DialogSchema } from '../schema/dialog/dialog.mjs';
3
+ export { ComponentSchema, component } from './component/component.mjs';
4
+ import '../schema/dialog/dialog.mjs';
7
5
  import '../types/utils.mjs';
6
+ import '../types/schema.mjs';
8
7
  import '../types/webcomponent.mjs';
8
+ import '../types/object.mjs';
9
9
  import '../schema/optional/optional.mjs';
10
-
11
- interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {
12
- type: 'component';
13
- dialog: Omit<DialogSchema<TEntries>, 'tabs'>;
14
- }
15
- declare function component<TEntries extends ObjectEntries>(config: Partial<ComponentModel>, dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>): ComponentSchema<TEntries>;
16
-
17
- export { type ComponentSchema, component };
10
+ import '../types/component.mjs';
@@ -1,17 +1,10 @@
1
1
  export { parse } from './parse/parse.js';
2
2
  export { parsePrimitives } from './parse/parsePrimitives.js';
3
- import { BaseSchema } from '../types/schema.js';
4
- import { C as ComponentModel } from '../component-oiRVWRBc.js';
5
- import { ObjectEntries, ObjectOutput } from '../types/object.js';
6
- import { DialogSchema } from '../schema/dialog/dialog.js';
3
+ export { ComponentSchema, component } from './component/component.js';
4
+ import '../schema/dialog/dialog.js';
7
5
  import '../types/utils.js';
6
+ import '../types/schema.js';
8
7
  import '../types/webcomponent.js';
8
+ import '../types/object.js';
9
9
  import '../schema/optional/optional.js';
10
-
11
- interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {
12
- type: 'component';
13
- dialog: Omit<DialogSchema<TEntries>, 'tabs'>;
14
- }
15
- declare function component<TEntries extends ObjectEntries>(config: Partial<ComponentModel>, dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>): ComponentSchema<TEntries>;
16
-
17
- export { type ComponentSchema, component };
10
+ import '../types/component.js';
package/dist/index.d.mts CHANGED
@@ -5,6 +5,7 @@ export { CheckBoxSchema, checkbox } from './schema/checkbox/checkbox.mjs';
5
5
  export { PathBrowserSchema, pathbrowser } from './schema/pathbrowser/pathbrowser.mjs';
6
6
  export { ImageSchema, image } from './schema/image/image.mjs';
7
7
  export { SelectSchema, select } from './schema/select/select.mjs';
8
+ export { RichTextEditorSchema, rte } from './schema/rte/rte.mjs';
8
9
  export { HiddenSchema, hidden } from './schema/hidden/hidden.mjs';
9
10
  export { OptionalSchema, optional } from './schema/optional/optional.mjs';
10
11
  export { ObjectSchema, object } from './schema/object/object.mjs';
@@ -12,11 +13,11 @@ export { GetServerSideProps } from './types/props.mjs';
12
13
  export { EntryMask, RequireAtLeastOne, ResolveObject } from './types/utils.mjs';
13
14
  export { BaseFieldInput, BaseSchema, Output } from './types/schema.mjs';
14
15
  export { InferOutput } from './types/infer.mjs';
15
- export { C as ComponentModel } from './component-oiRVWRBc.mjs';
16
+ export { ComponentModel } from './types/component.mjs';
16
17
  export { webcomponent } from './decorators/webcomponent/webcomponent.mjs';
17
18
  export { parse } from './functions/parse/parse.mjs';
18
19
  export { parsePrimitives } from './functions/parse/parsePrimitives.mjs';
19
- export { ComponentSchema, component } from './functions/index.mjs';
20
+ export { ComponentSchema, component } from './functions/component/component.mjs';
20
21
  import './types/object.mjs';
21
22
  import './types/webcomponent.mjs';
22
23
  import 'react';
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { CheckBoxSchema, checkbox } from './schema/checkbox/checkbox.js';
5
5
  export { PathBrowserSchema, pathbrowser } from './schema/pathbrowser/pathbrowser.js';
6
6
  export { ImageSchema, image } from './schema/image/image.js';
7
7
  export { SelectSchema, select } from './schema/select/select.js';
8
+ export { RichTextEditorSchema, rte } from './schema/rte/rte.js';
8
9
  export { HiddenSchema, hidden } from './schema/hidden/hidden.js';
9
10
  export { OptionalSchema, optional } from './schema/optional/optional.js';
10
11
  export { ObjectSchema, object } from './schema/object/object.js';
@@ -12,11 +13,11 @@ export { GetServerSideProps } from './types/props.js';
12
13
  export { EntryMask, RequireAtLeastOne, ResolveObject } from './types/utils.js';
13
14
  export { BaseFieldInput, BaseSchema, Output } from './types/schema.js';
14
15
  export { InferOutput } from './types/infer.js';
15
- export { C as ComponentModel } from './component-oiRVWRBc.js';
16
+ export { ComponentModel } from './types/component.js';
16
17
  export { webcomponent } from './decorators/webcomponent/webcomponent.js';
17
18
  export { parse } from './functions/parse/parse.js';
18
19
  export { parsePrimitives } from './functions/parse/parsePrimitives.js';
19
- export { ComponentSchema, component } from './functions/index.js';
20
+ export { ComponentSchema, component } from './functions/component/component.js';
20
21
  import './types/object.js';
21
22
  import './types/webcomponent.js';
22
23
  import 'react';
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __export(src_exports, {
41
41
  parse: () => parse,
42
42
  parsePrimitives: () => parsePrimitives,
43
43
  pathbrowser: () => pathbrowser,
44
+ rte: () => rte,
44
45
  select: () => select,
45
46
  text: () => text,
46
47
  webcomponent: () => webcomponent
@@ -231,6 +232,25 @@ function select(input) {
231
232
  };
232
233
  }
233
234
 
235
+ // src/schema/rte/rte.ts
236
+ function rte(input) {
237
+ const { placeholder, label } = input;
238
+ return {
239
+ type: "richtexteditor",
240
+ _parse() {
241
+ return {
242
+ type: "richtexteditor",
243
+ label,
244
+ placeholder
245
+ };
246
+ },
247
+ _primitive() {
248
+ return "string";
249
+ },
250
+ ...input
251
+ };
252
+ }
253
+
234
254
  // src/schema/hidden/hidden.ts
235
255
  function hidden(input) {
236
256
  const { type } = input;
@@ -346,6 +366,7 @@ function webcomponent(schema, options) {
346
366
  parse,
347
367
  parsePrimitives,
348
368
  pathbrowser,
369
+ rte,
349
370
  select,
350
371
  text,
351
372
  webcomponent
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["export * from \"./schema/dialog\";\n\nexport * from \"./schema/multifield\";\nexport * from \"./schema/text\";\nexport * from \"./schema/checkbox\";\nexport * from \"./schema/pathbrowser\";\nexport * from \"./schema/image\";\nexport * from \"./schema/select\";\n\nexport * from \"./schema/hidden\";\nexport * from \"./schema/optional\";\nexport * from \"./schema/object\";\n\nexport * from \"./types\";\n\nexport * from \"./decorators\"\nexport * from \"./functions\"","import { BaseSchema, EntryMask } from '../../types';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface DialogSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries): DialogSchema<TEntries> {\n return {\n type: 'dialog',\n tabs(tabs) {\n return {\n ...this,\n tabs: undefined,\n component: undefined,\n _parse() {\n const usedEntries = new Set<keyof TEntries>();\n\n const tabsArray = Object.entries(tabs)\n .map(([tabKey, value]) => {\n\n const children = Object.entries(value).map(([key, value]) => {\n if (value === true) {\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(tabKey)}.${String(key)}\" is already used in another tab.`);\n }\n usedEntries.add(key);\n return {\n id: key,\n ...entries[key]._parse()\n };\n }\n });\n\n return {\n type: 'tab',\n label: tabKey,\n id: `tab_${tabKey.toLowerCase().replaceAll(' ', '')}`,\n children\n };\n });\n\n return {\n dialog: [{\n type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }]\n };\n }\n };\n },\n _parse() {\n const dialog = Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if ('type' in entry) {\n return entry.type !== 'hidden';\n }\n });\n\n return {\n dialog\n };\n },\n _primitive() {\n return Object.entries(entries)\n .reduce(\n (acc: Record<string, WebcomponentPropTypes>, [key, entry]) => {\n const type = entry._primitive();\n if (typeof type === 'string') {\n acc[key] = type;\n }\n return acc;\n }, {});\n }\n };\n}","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput\n} from '../../types';\n\nexport interface MultifieldSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<InferOutput<TChildren>[]> {\n readonly type: 'multifield';\n /**\n * The children item schema.\n */\n readonly children: TChildren;\n}\n\ninterface MultifieldInput<TChildren extends BaseSchema<unknown>> extends BaseFieldInput {\n children: TChildren\n}\n\nexport function multifield<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): MultifieldSchema<TChildren> {\n const {label, children} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]\n }\n },\n _primitive() {\n return 'json'\n },\n ...input\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface TextSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'textfield';\n}\n\ninterface TextInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function text(input: TextInput): TextSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CheckBoxSchema<TOutput extends boolean = boolean> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'checkbox';\n}\n\ninterface CheckBoxInput extends BaseFieldInput {}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n }\n },\n _primitive() {\n return 'boolean'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface PathBrowserSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'pathbrowser';\n}\n\ninterface PathBrowserInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function pathbrowser(input: PathBrowserInput): PathBrowserSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface ImageSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'image';\n}\n\ninterface ImageInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function image(input: ImageInput): ImageSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface SelectSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'select';\n}\n\ninterface SelectInput extends BaseFieldInput {\n values: {\n value: string,\n label: string,\n }[]\n}\n\nexport function select(input: SelectInput): SelectSchema {\n const {label, values} = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n values,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}\n","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!)\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name,\n r2wc(component, {\n props,\n }),\n );\n }\n }\n}","export function pascalToKebab(pascalCaseString: string) {\n return pascalCaseString\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n}","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._parse()\n}","import { DialogSchema } from '../../schema/dialog';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._primitive() as Record<string, WebcomponentPropTypes>\n}","import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,OAAO,EAC1B,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO;AAAA,QACtB,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,GAAG,MAAM,OAAO;AAAA,MAClB,EAAE,EACD,OAAO,CAAC,UAAkB;AACzB,YAAG,UAAU,OAAM;AACjB,iBAAO,MAAM,SAAS;AAAA,QACxB;AAAA,MACF,CAAC;AAAA,IACL;AAAA,IACA,aAAa;AACX,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;AC1BA,oCAAiB;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACDO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;;;ACDO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;ACGO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AJlBO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoBC,eAAsC;AAC/D,UAAM,OAAO,cAAcA,WAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,YACA,8BAAAC,SAAKD,YAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value","dialog","component","r2wc"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/rte/rte.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["export * from \"./schema/dialog\";\n\nexport * from \"./schema/multifield\";\nexport * from \"./schema/text\";\nexport * from \"./schema/checkbox\";\nexport * from \"./schema/pathbrowser\";\nexport * from \"./schema/image\";\nexport * from \"./schema/select\";\nexport * from \"./schema/rte\";\n\nexport * from \"./schema/hidden\";\nexport * from \"./schema/optional\";\nexport * from \"./schema/object\";\n\nexport * from \"./types\";\n\nexport * from \"./decorators\"\nexport * from \"./functions\"","import { BaseSchema, EntryMask } from '../../types';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface DialogSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries): DialogSchema<TEntries> {\n return {\n type: 'dialog',\n tabs(tabs) {\n return {\n ...this,\n tabs: undefined,\n component: undefined,\n _parse() {\n const usedEntries = new Set<keyof TEntries>();\n\n const tabsArray = Object.entries(tabs)\n .map(([tabKey, value]) => {\n\n const children = Object.entries(value).map(([key, value]) => {\n if (value === true) {\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(tabKey)}.${String(key)}\" is already used in another tab.`);\n }\n usedEntries.add(key);\n return {\n id: key,\n ...entries[key]._parse()\n };\n }\n });\n\n return {\n type: 'tab',\n label: tabKey,\n id: `tab_${tabKey.toLowerCase().replaceAll(' ', '')}`,\n children\n };\n });\n\n return {\n dialog: [{\n type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }]\n };\n }\n };\n },\n _parse() {\n const dialog = Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if ('type' in entry) {\n return entry.type !== 'hidden';\n }\n });\n\n return {\n dialog\n };\n },\n _primitive() {\n return Object.entries(entries)\n .reduce(\n (acc: Record<string, WebcomponentPropTypes>, [key, entry]) => {\n const type = entry._primitive();\n if (typeof type === 'string') {\n acc[key] = type;\n }\n return acc;\n }, {});\n }\n };\n}","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput\n} from '../../types';\n\nexport interface MultifieldSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<InferOutput<TChildren>[]> {\n readonly type: 'multifield';\n /**\n * The children item schema.\n */\n readonly children: TChildren;\n}\n\ninterface MultifieldInput<TChildren extends BaseSchema<unknown>> extends BaseFieldInput {\n children: TChildren\n}\n\nexport function multifield<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): MultifieldSchema<TChildren> {\n const {label, children} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]\n }\n },\n _primitive() {\n return 'json'\n },\n ...input\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface TextSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'textfield';\n}\n\ninterface TextInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function text(input: TextInput): TextSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CheckBoxSchema<TOutput extends boolean = boolean> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'checkbox';\n}\n\ninterface CheckBoxInput extends BaseFieldInput {}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n }\n },\n _primitive() {\n return 'boolean'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface PathBrowserSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'pathbrowser';\n}\n\ninterface PathBrowserInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function pathbrowser(input: PathBrowserInput): PathBrowserSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface ImageSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'image';\n}\n\ninterface ImageInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function image(input: ImageInput): ImageSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface SelectSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'select';\n}\n\ninterface SelectInput extends BaseFieldInput {\n values: {\n value: string,\n label: string,\n }[]\n}\n\nexport function select(input: SelectInput): SelectSchema {\n const {label, values} = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n values,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}\n","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!)\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name,\n r2wc(component, {\n props,\n }),\n );\n }\n }\n}","export function pascalToKebab(pascalCaseString: string) {\n return pascalCaseString\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n}","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._parse()\n}","import { DialogSchema } from '../../schema/dialog';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._primitive() as Record<string, WebcomponentPropTypes>\n}","import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,OAAuC,SAA2C;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK,MAAM;AACT,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AACP,gBAAM,cAAc,oBAAI,IAAoB;AAE5C,gBAAM,YAAY,OAAO,QAAQ,IAAI,EAClC,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM;AAExB,kBAAM,WAAW,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAKA,MAAK,MAAM;AAC3D,kBAAIA,WAAU,MAAM;AAClB,oBAAI,YAAY,IAAI,GAAG,GAAG;AACxB,wBAAM,IAAI,MAAM,UAAU,OAAO,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,mCAAmC;AAAA,gBAC5F;AACA,4BAAY,IAAI,GAAG;AACnB,uBAAO;AAAA,kBACL,IAAI;AAAA,kBACJ,GAAG,QAAQ,GAAG,EAAE,OAAO;AAAA,gBACzB;AAAA,cACF;AAAA,YACF,CAAC;AAED,mBAAO;AAAA,cACL,MAAM;AAAA,cACN,OAAO;AAAA,cACP,IAAI,OAAO,OAAO,YAAY,EAAE,WAAW,KAAK,EAAE,CAAC;AAAA,cACnD;AAAA,YACF;AAAA,UACF,CAA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,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AJlBO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoBC,eAAsC;AAC/D,UAAM,OAAO,cAAcA,WAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,YACA,8BAAAC,SAAKD,YAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value","dialog","component","r2wc"]}
package/dist/index.mjs CHANGED
@@ -182,6 +182,25 @@ function select(input) {
182
182
  };
183
183
  }
184
184
 
185
+ // src/schema/rte/rte.ts
186
+ function rte(input) {
187
+ const { placeholder, label } = input;
188
+ return {
189
+ type: "richtexteditor",
190
+ _parse() {
191
+ return {
192
+ type: "richtexteditor",
193
+ label,
194
+ placeholder
195
+ };
196
+ },
197
+ _primitive() {
198
+ return "string";
199
+ },
200
+ ...input
201
+ };
202
+ }
203
+
185
204
  // src/schema/hidden/hidden.ts
186
205
  function hidden(input) {
187
206
  const { type } = input;
@@ -296,6 +315,7 @@ export {
296
315
  parse,
297
316
  parsePrimitives,
298
317
  pathbrowser,
318
+ rte,
299
319
  select,
300
320
  text,
301
321
  webcomponent
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, EntryMask } from '../../types';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface DialogSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries): DialogSchema<TEntries> {\n return {\n type: 'dialog',\n tabs(tabs) {\n return {\n ...this,\n tabs: undefined,\n component: undefined,\n _parse() {\n const usedEntries = new Set<keyof TEntries>();\n\n const tabsArray = Object.entries(tabs)\n .map(([tabKey, value]) => {\n\n const children = Object.entries(value).map(([key, value]) => {\n if (value === true) {\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(tabKey)}.${String(key)}\" is already used in another tab.`);\n }\n usedEntries.add(key);\n return {\n id: key,\n ...entries[key]._parse()\n };\n }\n });\n\n return {\n type: 'tab',\n label: tabKey,\n id: `tab_${tabKey.toLowerCase().replaceAll(' ', '')}`,\n children\n };\n });\n\n return {\n dialog: [{\n type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }]\n };\n }\n };\n },\n _parse() {\n const dialog = Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if ('type' in entry) {\n return entry.type !== 'hidden';\n }\n });\n\n return {\n dialog\n };\n },\n _primitive() {\n return Object.entries(entries)\n .reduce(\n (acc: Record<string, WebcomponentPropTypes>, [key, entry]) => {\n const type = entry._primitive();\n if (typeof type === 'string') {\n acc[key] = type;\n }\n return acc;\n }, {});\n }\n };\n}","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput\n} from '../../types';\n\nexport interface MultifieldSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<InferOutput<TChildren>[]> {\n readonly type: 'multifield';\n /**\n * The children item schema.\n */\n readonly children: TChildren;\n}\n\ninterface MultifieldInput<TChildren extends BaseSchema<unknown>> extends BaseFieldInput {\n children: TChildren\n}\n\nexport function multifield<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): MultifieldSchema<TChildren> {\n const {label, children} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]\n }\n },\n _primitive() {\n return 'json'\n },\n ...input\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface TextSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'textfield';\n}\n\ninterface TextInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function text(input: TextInput): TextSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CheckBoxSchema<TOutput extends boolean = boolean> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'checkbox';\n}\n\ninterface CheckBoxInput extends BaseFieldInput {}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n }\n },\n _primitive() {\n return 'boolean'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface PathBrowserSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'pathbrowser';\n}\n\ninterface PathBrowserInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function pathbrowser(input: PathBrowserInput): PathBrowserSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface ImageSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'image';\n}\n\ninterface ImageInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function image(input: ImageInput): ImageSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface SelectSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'select';\n}\n\ninterface SelectInput extends BaseFieldInput {\n values: {\n value: string,\n label: string,\n }[]\n}\n\nexport function select(input: SelectInput): SelectSchema {\n const {label, values} = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n values,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}\n","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!)\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name,\n r2wc(component, {\n props,\n }),\n );\n }\n }\n}","export function pascalToKebab(pascalCaseString: string) {\n return pascalCaseString\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n}","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._parse()\n}","import { DialogSchema } from '../../schema/dialog';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._primitive() as Record<string, WebcomponentPropTypes>\n}","import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";AASO,SAAS,OAAuC,SAA2C;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK,MAAM;AACT,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AACP,gBAAM,cAAc,oBAAI,IAAoB;AAE5C,gBAAM,YAAY,OAAO,QAAQ,IAAI,EAClC,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM;AAExB,kBAAM,WAAW,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAKA,MAAK,MAAM;AAC3D,kBAAIA,WAAU,MAAM;AAClB,oBAAI,YAAY,IAAI,GAAG,GAAG;AACxB,wBAAM,IAAI,MAAM,UAAU,OAAO,MAAM,CAAC,IAAI,OAAO,GAAG,CAA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SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AJlBO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoBC,eAAsC;AAC/D,UAAM,OAAO,cAAcA,WAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAKA,YAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value","dialog","component"]}
1
+ {"version":3,"sources":["../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/rte/rte.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, EntryMask } from '../../types';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface DialogSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries): DialogSchema<TEntries> {\n return {\n type: 'dialog',\n tabs(tabs) {\n return {\n ...this,\n tabs: undefined,\n component: undefined,\n _parse() {\n const usedEntries = new Set<keyof TEntries>();\n\n const tabsArray = Object.entries(tabs)\n .map(([tabKey, value]) => {\n\n const children = Object.entries(value).map(([key, value]) => {\n if (value === true) {\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(tabKey)}.${String(key)}\" is already used in another tab.`);\n }\n usedEntries.add(key);\n return {\n id: key,\n ...entries[key]._parse()\n };\n }\n });\n\n return {\n type: 'tab',\n label: tabKey,\n id: `tab_${tabKey.toLowerCase().replaceAll(' ', '')}`,\n children\n };\n });\n\n return {\n dialog: [{\n type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }]\n };\n }\n };\n },\n _parse() {\n const dialog = Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if ('type' in entry) {\n return entry.type !== 'hidden';\n }\n });\n\n return {\n dialog\n };\n },\n _primitive() {\n return Object.entries(entries)\n .reduce(\n (acc: Record<string, WebcomponentPropTypes>, [key, entry]) => {\n const type = entry._primitive();\n if (typeof type === 'string') {\n acc[key] = type;\n }\n return acc;\n }, {});\n }\n };\n}","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput\n} from '../../types';\n\nexport interface MultifieldSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<InferOutput<TChildren>[]> {\n readonly type: 'multifield';\n /**\n * The children item schema.\n */\n readonly children: TChildren;\n}\n\ninterface MultifieldInput<TChildren extends BaseSchema<unknown>> extends BaseFieldInput {\n children: TChildren\n}\n\nexport function multifield<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): MultifieldSchema<TChildren> {\n const {label, children} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]\n }\n },\n _primitive() {\n return 'json'\n },\n ...input\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface TextSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'textfield';\n}\n\ninterface TextInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function text(input: TextInput): TextSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CheckBoxSchema<TOutput extends boolean = boolean> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'checkbox';\n}\n\ninterface CheckBoxInput extends BaseFieldInput {}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n }\n },\n _primitive() {\n return 'boolean'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface PathBrowserSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'pathbrowser';\n}\n\ninterface PathBrowserInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function pathbrowser(input: PathBrowserInput): PathBrowserSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface ImageSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'image';\n}\n\ninterface ImageInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function image(input: ImageInput): ImageSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface SelectSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'select';\n}\n\ninterface SelectInput extends BaseFieldInput {\n values: {\n value: string,\n label: string,\n }[]\n}\n\nexport function select(input: SelectInput): SelectSchema {\n const {label, values} = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n values,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}\n","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!)\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name,\n r2wc(component, {\n props,\n }),\n );\n }\n }\n}","export function pascalToKebab(pascalCaseString: string) {\n return pascalCaseString\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase();\n}","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._parse()\n}","import { DialogSchema } from '../../schema/dialog';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return schema._primitive() as Record<string, WebcomponentPropTypes>\n}","import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput>, Partial<ComponentModel> {\n type: 'component';\n dialog: Omit<DialogSchema<TEntries>, 'tabs'>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialogInstance: Omit<DialogSchema<TEntries>, 'tabs'>\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog: dialogInstance,\n _parse() {\n return {\n ...config,\n ...dialogInstance._parse()\n };\n },\n _primitive() {\n return dialogInstance._primitive();\n },\n ...config,\n };\n}"],"mappings":";AASO,SAAS,OAAuC,SAA2C;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK,MAAM;AACT,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,QACN,WAAW;AAAA,QACX,SAAS;AACP,gBAAM,cAAc,oBAAI,IAAoB;AAE5C,gBAAM,YAAY,OAAO,QAAQ,IAAI,EAClC,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM;AAExB,kBAAM,WAAW,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAKA,MAAK,MAAM;AAC3D,kBAAIA,WAAU,MAAM;AAClB,oBAAI,YAAY,IAAI,GAAG,GAAG;AACxB,wBAAM,IAAI,MAAM,UAAU,OAAO,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,mCAAmC;AAAA,gBAC5F;AACA,4BAAY,IAAI,GAAG;AACnB,uBAAO;AAAA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ACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACDO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;;;ACDO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;ACGO,SAAS,UACd,QACA,gBAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,eAAe,OAAO;AAAA,MAC3B;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,eAAe,WAAW;AAAA,IACnC;AAAA,IACA,GAAG;AAAA,EACL;AACF;;;AJlBO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoBC,eAAsC;AAC/D,UAAM,OAAO,cAAcA,WAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAKA,YAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value","dialog","component"]}
@@ -0,0 +1,3 @@
1
+ export { RichTextEditorSchema, rte } from './rte.mjs';
2
+ import '../../types/schema.mjs';
3
+ import '../../types/webcomponent.mjs';
@@ -0,0 +1,3 @@
1
+ export { RichTextEditorSchema, rte } from './rte.js';
2
+ import '../../types/schema.js';
3
+ import '../../types/webcomponent.js';
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/schema/rte/index.ts
21
+ var rte_exports = {};
22
+ __export(rte_exports, {
23
+ rte: () => rte
24
+ });
25
+ module.exports = __toCommonJS(rte_exports);
26
+
27
+ // src/schema/rte/rte.ts
28
+ function rte(input) {
29
+ const { placeholder, label } = input;
30
+ return {
31
+ type: "richtexteditor",
32
+ _parse() {
33
+ return {
34
+ type: "richtexteditor",
35
+ label,
36
+ placeholder
37
+ };
38
+ },
39
+ _primitive() {
40
+ return "string";
41
+ },
42
+ ...input
43
+ };
44
+ }
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ rte
48
+ });
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/schema/rte/index.ts","../../../src/schema/rte/rte.ts"],"sourcesContent":["export * from './rte'","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,IAAI,OAAkD;AACpE,QAAM,EAAC,aAAa,MAAK,IAAI;AAE7B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,aAAO;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,22 @@
1
+ // src/schema/rte/rte.ts
2
+ function rte(input) {
3
+ const { placeholder, label } = input;
4
+ return {
5
+ type: "richtexteditor",
6
+ _parse() {
7
+ return {
8
+ type: "richtexteditor",
9
+ label,
10
+ placeholder
11
+ };
12
+ },
13
+ _primitive() {
14
+ return "string";
15
+ },
16
+ ...input
17
+ };
18
+ }
19
+ export {
20
+ rte
21
+ };
22
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/schema/rte/rte.ts"],"sourcesContent":["import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}"],"mappings":";AAaO,SAAS,IAAI,OAAkD;AACpE,QAAM,EAAC,aAAa,MAAK,IAAI;AAE7B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,aAAO;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,15 @@
1
+ import { BaseSchema, BaseFieldInput } from '../../types/schema.mjs';
2
+ import '../../types/webcomponent.mjs';
3
+
4
+ interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {
5
+ /**
6
+ * The schema type.
7
+ */
8
+ type: 'richtexteditor';
9
+ }
10
+ interface RichTextEditorInput extends BaseFieldInput {
11
+ placeholder: string;
12
+ }
13
+ declare function rte(input: RichTextEditorInput): RichTextEditorSchema;
14
+
15
+ export { type RichTextEditorSchema, rte };
@@ -0,0 +1,15 @@
1
+ import { BaseSchema, BaseFieldInput } from '../../types/schema.js';
2
+ import '../../types/webcomponent.js';
3
+
4
+ interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {
5
+ /**
6
+ * The schema type.
7
+ */
8
+ type: 'richtexteditor';
9
+ }
10
+ interface RichTextEditorInput extends BaseFieldInput {
11
+ placeholder: string;
12
+ }
13
+ declare function rte(input: RichTextEditorInput): RichTextEditorSchema;
14
+
15
+ export { type RichTextEditorSchema, rte };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/schema/rte/rte.ts
21
+ var rte_exports = {};
22
+ __export(rte_exports, {
23
+ rte: () => rte
24
+ });
25
+ module.exports = __toCommonJS(rte_exports);
26
+ function rte(input) {
27
+ const { placeholder, label } = input;
28
+ return {
29
+ type: "richtexteditor",
30
+ _parse() {
31
+ return {
32
+ type: "richtexteditor",
33
+ label,
34
+ placeholder
35
+ };
36
+ },
37
+ _primitive() {
38
+ return "string";
39
+ },
40
+ ...input
41
+ };
42
+ }
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ rte
46
+ });
47
+ //# sourceMappingURL=rte.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/schema/rte/rte.ts"],"sourcesContent":["import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,IAAI,OAAkD;AACpE,QAAM,EAAC,aAAa,MAAK,IAAI;AAE7B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,aAAO;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -0,0 +1,22 @@
1
+ // src/schema/rte/rte.ts
2
+ function rte(input) {
3
+ const { placeholder, label } = input;
4
+ return {
5
+ type: "richtexteditor",
6
+ _parse() {
7
+ return {
8
+ type: "richtexteditor",
9
+ label,
10
+ placeholder
11
+ };
12
+ },
13
+ _primitive() {
14
+ return "string";
15
+ },
16
+ ...input
17
+ };
18
+ }
19
+ export {
20
+ rte
21
+ };
22
+ //# sourceMappingURL=rte.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/schema/rte/rte.ts"],"sourcesContent":["import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}"],"mappings":";AAaO,SAAS,IAAI,OAAkD;AACpE,QAAM,EAAC,aAAa,MAAK,IAAI;AAE7B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,aAAO;AAAA,QACL,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
@@ -6,4 +6,4 @@ type ComponentModel = {
6
6
  readme: string;
7
7
  };
8
8
 
9
- export type { ComponentModel as C };
9
+ export type { ComponentModel };
@@ -6,4 +6,4 @@ type ComponentModel = {
6
6
  readme: string;
7
7
  };
8
8
 
9
- export type { ComponentModel as C };
9
+ export type { ComponentModel };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/component.ts
17
+ var component_exports = {};
18
+ module.exports = __toCommonJS(component_exports);
19
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/component.ts"],"sourcesContent":["export type ComponentModel = {\n name: string,\n title: string,\n slug: string,\n version: string,\n readme: string,\n}"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -2,5 +2,5 @@ export { GetServerSideProps } from './props.mjs';
2
2
  export { EntryMask, RequireAtLeastOne, ResolveObject } from './utils.mjs';
3
3
  export { BaseFieldInput, BaseSchema, Output } from './schema.mjs';
4
4
  export { InferOutput } from './infer.mjs';
5
- export { C as ComponentModel } from '../component-oiRVWRBc.mjs';
5
+ export { ComponentModel } from './component.mjs';
6
6
  import './webcomponent.mjs';
@@ -2,5 +2,5 @@ export { GetServerSideProps } from './props.js';
2
2
  export { EntryMask, RequireAtLeastOne, ResolveObject } from './utils.js';
3
3
  export { BaseFieldInput, BaseSchema, Output } from './schema.js';
4
4
  export { InferOutput } from './infer.js';
5
- export { C as ComponentModel } from '../component-oiRVWRBc.js';
5
+ export { ComponentModel } from './component.js';
6
6
  import './webcomponent.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethereal-nexus/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
File without changes