@ethereal-nexus/core 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-oiRVWRBc.d.mts +9 -0
- package/dist/component-oiRVWRBc.d.ts +9 -0
- package/dist/decorators/index.js +2 -2
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +2 -2
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/decorators/webcomponent/index.js +2 -2
- package/dist/decorators/webcomponent/index.js.map +1 -1
- package/dist/decorators/webcomponent/index.mjs +2 -2
- package/dist/decorators/webcomponent/index.mjs.map +1 -1
- package/dist/decorators/webcomponent/webcomponent.d.mts +1 -1
- package/dist/decorators/webcomponent/webcomponent.d.ts +1 -1
- package/dist/decorators/webcomponent/webcomponent.js +2 -2
- package/dist/decorators/webcomponent/webcomponent.js.map +1 -1
- package/dist/decorators/webcomponent/webcomponent.mjs +2 -2
- package/dist/decorators/webcomponent/webcomponent.mjs.map +1 -1
- package/dist/functions/index.d.mts +12 -3
- package/dist/functions/index.d.ts +12 -3
- package/dist/functions/index.js +21 -3
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +20 -3
- package/dist/functions/index.mjs.map +1 -1
- package/dist/functions/parse/index.js +1 -3
- package/dist/functions/parse/index.js.map +1 -1
- package/dist/functions/parse/index.mjs +1 -3
- package/dist/functions/parse/index.mjs.map +1 -1
- package/dist/functions/parse/parse.d.mts +1 -3
- package/dist/functions/parse/parse.d.ts +1 -3
- package/dist/functions/parse/parse.js +1 -3
- package/dist/functions/parse/parse.js.map +1 -1
- package/dist/functions/parse/parse.mjs +1 -3
- package/dist/functions/parse/parse.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -14
- package/dist/index.mjs.map +1 -1
- package/dist/schema/dialog/dialog.js +12 -6
- package/dist/schema/dialog/dialog.js.map +1 -1
- package/dist/schema/dialog/dialog.mjs +12 -6
- package/dist/schema/dialog/dialog.mjs.map +1 -1
- package/dist/schema/dialog/index.js +12 -6
- package/dist/schema/dialog/index.js.map +1 -1
- package/dist/schema/dialog/index.mjs +12 -6
- package/dist/schema/dialog/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/decorators/index.js
CHANGED
|
@@ -49,9 +49,9 @@ function parsePrimitives(schema) {
|
|
|
49
49
|
|
|
50
50
|
// src/decorators/webcomponent/webcomponent.ts
|
|
51
51
|
function webcomponent(schema, options) {
|
|
52
|
-
const props = {
|
|
52
|
+
const props = schema ? {
|
|
53
53
|
...parsePrimitives(schema)
|
|
54
|
-
};
|
|
54
|
+
} : void 0;
|
|
55
55
|
return (component) => {
|
|
56
56
|
const name = pascalToKebab(component.displayName);
|
|
57
57
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/decorators/index.ts","../../src/decorators/webcomponent/webcomponent.ts","../../src/utils/pascalToKebab.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './webcomponent'","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
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/index.ts","../../src/decorators/webcomponent/webcomponent.ts","../../src/utils/pascalToKebab.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './webcomponent'","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 { 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}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oCAAiB;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,YACA,8BAAAA,SAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["r2wc"]}
|
|
@@ -13,9 +13,9 @@ function parsePrimitives(schema) {
|
|
|
13
13
|
|
|
14
14
|
// src/decorators/webcomponent/webcomponent.ts
|
|
15
15
|
function webcomponent(schema, options) {
|
|
16
|
-
const props = {
|
|
16
|
+
const props = schema ? {
|
|
17
17
|
...parsePrimitives(schema)
|
|
18
|
-
};
|
|
18
|
+
} : void 0;
|
|
19
19
|
return (component) => {
|
|
20
20
|
const name = pascalToKebab(component.displayName);
|
|
21
21
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/decorators/webcomponent/webcomponent.ts","../../src/utils/pascalToKebab.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"sources":["../../src/decorators/webcomponent/webcomponent.ts","../../src/utils/pascalToKebab.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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 { 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}"],"mappings":";AACA,OAAO,UAAU;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -49,9 +49,9 @@ function parsePrimitives(schema) {
|
|
|
49
49
|
|
|
50
50
|
// src/decorators/webcomponent/webcomponent.ts
|
|
51
51
|
function webcomponent(schema, options) {
|
|
52
|
-
const props = {
|
|
52
|
+
const props = schema ? {
|
|
53
53
|
...parsePrimitives(schema)
|
|
54
|
-
};
|
|
54
|
+
} : void 0;
|
|
55
55
|
return (component) => {
|
|
56
56
|
const name = pascalToKebab(component.displayName);
|
|
57
57
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/decorators/webcomponent/index.ts","../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './webcomponent'","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
|
|
1
|
+
{"version":3,"sources":["../../../src/decorators/webcomponent/index.ts","../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './webcomponent'","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 { 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}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oCAAiB;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,YACA,8BAAAA,SAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["r2wc"]}
|
|
@@ -13,9 +13,9 @@ function parsePrimitives(schema) {
|
|
|
13
13
|
|
|
14
14
|
// src/decorators/webcomponent/webcomponent.ts
|
|
15
15
|
function webcomponent(schema, options) {
|
|
16
|
-
const props = {
|
|
16
|
+
const props = schema ? {
|
|
17
17
|
...parsePrimitives(schema)
|
|
18
|
-
};
|
|
18
|
+
} : void 0;
|
|
19
19
|
return (component) => {
|
|
20
20
|
const name = pascalToKebab(component.displayName);
|
|
21
21
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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 { 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}"],"mappings":";AACA,OAAO,UAAU;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -7,6 +7,6 @@ import '../../types/webcomponent.mjs';
|
|
|
7
7
|
import '../../schema/optional/optional.mjs';
|
|
8
8
|
|
|
9
9
|
type BaseOptions = {};
|
|
10
|
-
declare function webcomponent<T extends ObjectEntries>(schema
|
|
10
|
+
declare function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions): <P extends {} = {}>(component: React.ComponentType<P>) => void;
|
|
11
11
|
|
|
12
12
|
export { webcomponent };
|
|
@@ -7,6 +7,6 @@ import '../../types/webcomponent.js';
|
|
|
7
7
|
import '../../schema/optional/optional.js';
|
|
8
8
|
|
|
9
9
|
type BaseOptions = {};
|
|
10
|
-
declare function webcomponent<T extends ObjectEntries>(schema
|
|
10
|
+
declare function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions): <P extends {} = {}>(component: React.ComponentType<P>) => void;
|
|
11
11
|
|
|
12
12
|
export { webcomponent };
|
|
@@ -47,9 +47,9 @@ function parsePrimitives(schema) {
|
|
|
47
47
|
|
|
48
48
|
// src/decorators/webcomponent/webcomponent.ts
|
|
49
49
|
function webcomponent(schema, options) {
|
|
50
|
-
const props = {
|
|
50
|
+
const props = schema ? {
|
|
51
51
|
...parsePrimitives(schema)
|
|
52
|
-
};
|
|
52
|
+
} : void 0;
|
|
53
53
|
return (component) => {
|
|
54
54
|
const name = pascalToKebab(component.displayName);
|
|
55
55
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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 { 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}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAiB;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,YACA,8BAAAA,SAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["r2wc"]}
|
|
@@ -13,9 +13,9 @@ function parsePrimitives(schema) {
|
|
|
13
13
|
|
|
14
14
|
// src/decorators/webcomponent/webcomponent.ts
|
|
15
15
|
function webcomponent(schema, options) {
|
|
16
|
-
const props = {
|
|
16
|
+
const props = schema ? {
|
|
17
17
|
...parsePrimitives(schema)
|
|
18
|
-
};
|
|
18
|
+
} : void 0;
|
|
19
19
|
return (component) => {
|
|
20
20
|
const name = pascalToKebab(component.displayName);
|
|
21
21
|
if (!window.customElements.get(name)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"sources":["../../../src/decorators/webcomponent/webcomponent.ts","../../../src/utils/pascalToKebab.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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 { 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}"],"mappings":";AACA,OAAO,UAAU;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACAO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AFIO,SAAS,aAAsC,QAA0B,SAAuB;AACrG,QAAM,QAA2D,SAAS;AAAA,IACxE,GAAG,gBAAgB,MAAM;AAAA,EAC3B,IAAI;AAEJ,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { parse } from './parse/parse.mjs';
|
|
2
2
|
export { parsePrimitives } from './parse/parsePrimitives.mjs';
|
|
3
|
-
import '../schema
|
|
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';
|
|
4
7
|
import '../types/utils.mjs';
|
|
5
|
-
import '../types/schema.mjs';
|
|
6
8
|
import '../types/webcomponent.mjs';
|
|
7
|
-
import '../types/object.mjs';
|
|
8
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 };
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { parse } from './parse/parse.js';
|
|
2
2
|
export { parsePrimitives } from './parse/parsePrimitives.js';
|
|
3
|
-
import '../schema
|
|
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';
|
|
4
7
|
import '../types/utils.js';
|
|
5
|
-
import '../types/schema.js';
|
|
6
8
|
import '../types/webcomponent.js';
|
|
7
|
-
import '../types/object.js';
|
|
8
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 };
|
package/dist/functions/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/functions/index.ts
|
|
21
21
|
var functions_exports = {};
|
|
22
22
|
__export(functions_exports, {
|
|
23
|
+
component: () => component,
|
|
23
24
|
parse: () => parse,
|
|
24
25
|
parsePrimitives: () => parsePrimitives
|
|
25
26
|
});
|
|
@@ -27,17 +28,34 @@ module.exports = __toCommonJS(functions_exports);
|
|
|
27
28
|
|
|
28
29
|
// src/functions/parse/parse.ts
|
|
29
30
|
function parse(schema) {
|
|
30
|
-
return
|
|
31
|
-
dialog: schema._parse()
|
|
32
|
-
};
|
|
31
|
+
return schema._parse();
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
// src/functions/parse/parsePrimitives.ts
|
|
36
35
|
function parsePrimitives(schema) {
|
|
37
36
|
return schema._primitive();
|
|
38
37
|
}
|
|
38
|
+
|
|
39
|
+
// src/functions/component/component.ts
|
|
40
|
+
function component(config, dialogInstance) {
|
|
41
|
+
return {
|
|
42
|
+
type: "component",
|
|
43
|
+
dialog: dialogInstance,
|
|
44
|
+
_parse() {
|
|
45
|
+
return {
|
|
46
|
+
...config,
|
|
47
|
+
...dialogInstance._parse()
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
_primitive() {
|
|
51
|
+
return dialogInstance._primitive();
|
|
52
|
+
},
|
|
53
|
+
...config
|
|
54
|
+
};
|
|
55
|
+
}
|
|
39
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
57
|
0 && (module.exports = {
|
|
58
|
+
component,
|
|
41
59
|
parse,
|
|
42
60
|
parsePrimitives
|
|
43
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/functions/index.ts","../../src/functions/parse/parse.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './parse'\n","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../src/functions/index.ts","../../src/functions/parse/parse.ts","../../src/functions/parse/parsePrimitives.ts","../../src/functions/component/component.ts"],"sourcesContent":["export * from './parse'\nexport * from './component'\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;;;ACGO,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;","names":[]}
|
package/dist/functions/index.mjs
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
// src/functions/parse/parse.ts
|
|
2
2
|
function parse(schema) {
|
|
3
|
-
return
|
|
4
|
-
dialog: schema._parse()
|
|
5
|
-
};
|
|
3
|
+
return schema._parse();
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
// src/functions/parse/parsePrimitives.ts
|
|
9
7
|
function parsePrimitives(schema) {
|
|
10
8
|
return schema._primitive();
|
|
11
9
|
}
|
|
10
|
+
|
|
11
|
+
// src/functions/component/component.ts
|
|
12
|
+
function component(config, dialogInstance) {
|
|
13
|
+
return {
|
|
14
|
+
type: "component",
|
|
15
|
+
dialog: dialogInstance,
|
|
16
|
+
_parse() {
|
|
17
|
+
return {
|
|
18
|
+
...config,
|
|
19
|
+
...dialogInstance._parse()
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
_primitive() {
|
|
23
|
+
return dialogInstance._primitive();
|
|
24
|
+
},
|
|
25
|
+
...config
|
|
26
|
+
};
|
|
27
|
+
}
|
|
12
28
|
export {
|
|
29
|
+
component,
|
|
13
30
|
parse,
|
|
14
31
|
parsePrimitives
|
|
15
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/functions/parse/parse.ts","../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../src/functions/parse/parse.ts","../../src/functions/parse/parsePrimitives.ts","../../src/functions/component/component.ts"],"sourcesContent":["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":";AAGO,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;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/functions/parse/index.ts","../../../src/functions/parse/parse.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './parse'\nexport * from './parsePrimitives'","import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../src/functions/parse/index.ts","../../../src/functions/parse/parse.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["export * from './parse'\nexport * from './parsePrimitives'","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}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;;;ACDO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/functions/parse/parse.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../src/functions/parse/parse.ts","../../../src/functions/parse/parsePrimitives.ts"],"sourcesContent":["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}"],"mappings":";AAGO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;;;ACDO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -5,8 +5,6 @@ import '../../types/schema.mjs';
|
|
|
5
5
|
import '../../types/webcomponent.mjs';
|
|
6
6
|
import '../../schema/optional/optional.mjs';
|
|
7
7
|
|
|
8
|
-
declare function parse<T extends ObjectEntries>(schema: DialogSchema<T>):
|
|
9
|
-
dialog: object;
|
|
10
|
-
};
|
|
8
|
+
declare function parse<T extends ObjectEntries>(schema: DialogSchema<T>): object;
|
|
11
9
|
|
|
12
10
|
export { parse };
|
|
@@ -5,8 +5,6 @@ import '../../types/schema.js';
|
|
|
5
5
|
import '../../types/webcomponent.js';
|
|
6
6
|
import '../../schema/optional/optional.js';
|
|
7
7
|
|
|
8
|
-
declare function parse<T extends ObjectEntries>(schema: DialogSchema<T>):
|
|
9
|
-
dialog: object;
|
|
10
|
-
};
|
|
8
|
+
declare function parse<T extends ObjectEntries>(schema: DialogSchema<T>): object;
|
|
11
9
|
|
|
12
10
|
export { parse };
|
|
@@ -24,9 +24,7 @@ __export(parse_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(parse_exports);
|
|
26
26
|
function parse(schema) {
|
|
27
|
-
return
|
|
28
|
-
dialog: schema._parse()
|
|
29
|
-
};
|
|
27
|
+
return schema._parse();
|
|
30
28
|
}
|
|
31
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
30
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/functions/parse/parse.ts"],"sourcesContent":["import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../src/functions/parse/parse.ts"],"sourcesContent":["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}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/functions/parse/parse.ts"],"sourcesContent":["import { DialogSchema } from '../../schema/dialog';\nimport { ObjectEntries } from '../../types/object';\n\nexport function parse<T extends ObjectEntries>(schema: DialogSchema<T>) {\n return
|
|
1
|
+
{"version":3,"sources":["../../../src/functions/parse/parse.ts"],"sourcesContent":["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}"],"mappings":";AAGO,SAAS,MAA+B,QAAyB;AACtE,SAAO,OAAO,OAAO;AACvB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -12,9 +12,11 @@ export { GetServerSideProps } from './types/props.mjs';
|
|
|
12
12
|
export { EntryMask, RequireAtLeastOne, ResolveObject } from './types/utils.mjs';
|
|
13
13
|
export { BaseFieldInput, BaseSchema, Output } from './types/schema.mjs';
|
|
14
14
|
export { InferOutput } from './types/infer.mjs';
|
|
15
|
+
export { C as ComponentModel } from './component-oiRVWRBc.mjs';
|
|
15
16
|
export { webcomponent } from './decorators/webcomponent/webcomponent.mjs';
|
|
16
17
|
export { parse } from './functions/parse/parse.mjs';
|
|
17
18
|
export { parsePrimitives } from './functions/parse/parsePrimitives.mjs';
|
|
19
|
+
export { ComponentSchema, component } from './functions/index.mjs';
|
|
18
20
|
import './types/object.mjs';
|
|
19
21
|
import './types/webcomponent.mjs';
|
|
20
22
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export { GetServerSideProps } from './types/props.js';
|
|
|
12
12
|
export { EntryMask, RequireAtLeastOne, ResolveObject } from './types/utils.js';
|
|
13
13
|
export { BaseFieldInput, BaseSchema, Output } from './types/schema.js';
|
|
14
14
|
export { InferOutput } from './types/infer.js';
|
|
15
|
+
export { C as ComponentModel } from './component-oiRVWRBc.js';
|
|
15
16
|
export { webcomponent } from './decorators/webcomponent/webcomponent.js';
|
|
16
17
|
export { parse } from './functions/parse/parse.js';
|
|
17
18
|
export { parsePrimitives } from './functions/parse/parsePrimitives.js';
|
|
19
|
+
export { ComponentSchema, component } from './functions/index.js';
|
|
18
20
|
import './types/object.js';
|
|
19
21
|
import './types/webcomponent.js';
|
|
20
22
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
checkbox: () => checkbox,
|
|
34
|
+
component: () => component,
|
|
34
35
|
dialog: () => dialog,
|
|
35
36
|
hidden: () => hidden,
|
|
36
37
|
image: () => image,
|
|
@@ -54,6 +55,7 @@ function dialog(entries) {
|
|
|
54
55
|
return {
|
|
55
56
|
...this,
|
|
56
57
|
tabs: void 0,
|
|
58
|
+
component: void 0,
|
|
57
59
|
_parse() {
|
|
58
60
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
59
61
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -76,16 +78,18 @@ function dialog(entries) {
|
|
|
76
78
|
children
|
|
77
79
|
};
|
|
78
80
|
});
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
return {
|
|
82
|
+
dialog: [{
|
|
83
|
+
type: "tabs",
|
|
84
|
+
id: "tabs",
|
|
85
|
+
children: tabsArray
|
|
86
|
+
}]
|
|
87
|
+
};
|
|
84
88
|
}
|
|
85
89
|
};
|
|
86
90
|
},
|
|
87
91
|
_parse() {
|
|
88
|
-
|
|
92
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
89
93
|
id: key,
|
|
90
94
|
name: key,
|
|
91
95
|
...entry._parse()
|
|
@@ -94,6 +98,9 @@ function dialog(entries) {
|
|
|
94
98
|
return entry.type !== "hidden";
|
|
95
99
|
}
|
|
96
100
|
});
|
|
101
|
+
return {
|
|
102
|
+
dialog: dialog2
|
|
103
|
+
};
|
|
97
104
|
},
|
|
98
105
|
_primitive() {
|
|
99
106
|
return Object.entries(entries).reduce(
|
|
@@ -283,9 +290,7 @@ function pascalToKebab(pascalCaseString) {
|
|
|
283
290
|
|
|
284
291
|
// src/functions/parse/parse.ts
|
|
285
292
|
function parse(schema) {
|
|
286
|
-
return
|
|
287
|
-
dialog: schema._parse()
|
|
288
|
-
};
|
|
293
|
+
return schema._parse();
|
|
289
294
|
}
|
|
290
295
|
|
|
291
296
|
// src/functions/parse/parsePrimitives.ts
|
|
@@ -293,17 +298,35 @@ function parsePrimitives(schema) {
|
|
|
293
298
|
return schema._primitive();
|
|
294
299
|
}
|
|
295
300
|
|
|
301
|
+
// src/functions/component/component.ts
|
|
302
|
+
function component(config, dialogInstance) {
|
|
303
|
+
return {
|
|
304
|
+
type: "component",
|
|
305
|
+
dialog: dialogInstance,
|
|
306
|
+
_parse() {
|
|
307
|
+
return {
|
|
308
|
+
...config,
|
|
309
|
+
...dialogInstance._parse()
|
|
310
|
+
};
|
|
311
|
+
},
|
|
312
|
+
_primitive() {
|
|
313
|
+
return dialogInstance._primitive();
|
|
314
|
+
},
|
|
315
|
+
...config
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
296
319
|
// src/decorators/webcomponent/webcomponent.ts
|
|
297
320
|
function webcomponent(schema, options) {
|
|
298
|
-
const props = {
|
|
321
|
+
const props = schema ? {
|
|
299
322
|
...parsePrimitives(schema)
|
|
300
|
-
};
|
|
301
|
-
return (
|
|
302
|
-
const name = pascalToKebab(
|
|
323
|
+
} : void 0;
|
|
324
|
+
return (component2) => {
|
|
325
|
+
const name = pascalToKebab(component2.displayName);
|
|
303
326
|
if (!window.customElements.get(name)) {
|
|
304
327
|
customElements.define(
|
|
305
328
|
name,
|
|
306
|
-
(0, import_react_to_web_component.default)(
|
|
329
|
+
(0, import_react_to_web_component.default)(component2, {
|
|
307
330
|
props
|
|
308
331
|
})
|
|
309
332
|
);
|
|
@@ -313,6 +336,7 @@ function webcomponent(schema, options) {
|
|
|
313
336
|
// Annotate the CommonJS export names for ESM import in node:
|
|
314
337
|
0 && (module.exports = {
|
|
315
338
|
checkbox,
|
|
339
|
+
component,
|
|
316
340
|
dialog,
|
|
317
341
|
hidden,
|
|
318
342
|
image,
|
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"],"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 _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 type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }];\n }\n }\n },\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 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> = {\n ...parsePrimitives(schema),\n };\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 {\n dialog: schema._parse()\n }\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}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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,kBAAGA,WAAU,MAAM;AACjB,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,UAC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":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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ function dialog(entries) {
|
|
|
6
6
|
return {
|
|
7
7
|
...this,
|
|
8
8
|
tabs: void 0,
|
|
9
|
+
component: void 0,
|
|
9
10
|
_parse() {
|
|
10
11
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
11
12
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -28,16 +29,18 @@ function dialog(entries) {
|
|
|
28
29
|
children
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
return {
|
|
33
|
+
dialog: [{
|
|
34
|
+
type: "tabs",
|
|
35
|
+
id: "tabs",
|
|
36
|
+
children: tabsArray
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
},
|
|
39
42
|
_parse() {
|
|
40
|
-
|
|
43
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
41
44
|
id: key,
|
|
42
45
|
name: key,
|
|
43
46
|
...entry._parse()
|
|
@@ -46,6 +49,9 @@ function dialog(entries) {
|
|
|
46
49
|
return entry.type !== "hidden";
|
|
47
50
|
}
|
|
48
51
|
});
|
|
52
|
+
return {
|
|
53
|
+
dialog: dialog2
|
|
54
|
+
};
|
|
49
55
|
},
|
|
50
56
|
_primitive() {
|
|
51
57
|
return Object.entries(entries).reduce(
|
|
@@ -235,9 +241,7 @@ function pascalToKebab(pascalCaseString) {
|
|
|
235
241
|
|
|
236
242
|
// src/functions/parse/parse.ts
|
|
237
243
|
function parse(schema) {
|
|
238
|
-
return
|
|
239
|
-
dialog: schema._parse()
|
|
240
|
-
};
|
|
244
|
+
return schema._parse();
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
// src/functions/parse/parsePrimitives.ts
|
|
@@ -245,17 +249,35 @@ function parsePrimitives(schema) {
|
|
|
245
249
|
return schema._primitive();
|
|
246
250
|
}
|
|
247
251
|
|
|
252
|
+
// src/functions/component/component.ts
|
|
253
|
+
function component(config, dialogInstance) {
|
|
254
|
+
return {
|
|
255
|
+
type: "component",
|
|
256
|
+
dialog: dialogInstance,
|
|
257
|
+
_parse() {
|
|
258
|
+
return {
|
|
259
|
+
...config,
|
|
260
|
+
...dialogInstance._parse()
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
_primitive() {
|
|
264
|
+
return dialogInstance._primitive();
|
|
265
|
+
},
|
|
266
|
+
...config
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
248
270
|
// src/decorators/webcomponent/webcomponent.ts
|
|
249
271
|
function webcomponent(schema, options) {
|
|
250
|
-
const props = {
|
|
272
|
+
const props = schema ? {
|
|
251
273
|
...parsePrimitives(schema)
|
|
252
|
-
};
|
|
253
|
-
return (
|
|
254
|
-
const name = pascalToKebab(
|
|
274
|
+
} : void 0;
|
|
275
|
+
return (component2) => {
|
|
276
|
+
const name = pascalToKebab(component2.displayName);
|
|
255
277
|
if (!window.customElements.get(name)) {
|
|
256
278
|
customElements.define(
|
|
257
279
|
name,
|
|
258
|
-
r2wc(
|
|
280
|
+
r2wc(component2, {
|
|
259
281
|
props
|
|
260
282
|
})
|
|
261
283
|
);
|
|
@@ -264,6 +286,7 @@ function webcomponent(schema, options) {
|
|
|
264
286
|
}
|
|
265
287
|
export {
|
|
266
288
|
checkbox,
|
|
289
|
+
component,
|
|
267
290
|
dialog,
|
|
268
291
|
hidden,
|
|
269
292
|
image,
|
package/dist/index.mjs.map
CHANGED
|
@@ -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"],"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 _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 type: 'tabs',\n id: 'tabs',\n children: tabsArray\n }];\n }\n }\n },\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 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> = {\n ...parsePrimitives(schema),\n };\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 {\n dialog: schema._parse()\n }\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}"],"mappings":";AASO,SAAS,OAAuC,SAA2C;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK,MAAM;AACT,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,QACN,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,kBAAGA,WAAU,MAAM;AACjB,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,CAAC;AAEH,iBAAO,CAAC;AAAA,YACN,MAAM;AAAA,YACN,IAAI;AAAA,YACJ,UAAU;AAAA,UACZ,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AACP,aAAO,OAAO,QAAQ,OAAO,EAC1B,IAAI,CAAC,CAAC,KAAK,KAAK,OAAO;AAAA,QACtB,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,GAAG,MA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IACN,SAAS;AACP,aAAO,OAAO,QAAQ,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,OAAO,UAAU;;;ACDV,SAAS,cAAc,kBAA0B;AACtD,SAAO,iBACJ,QAAQ,mBAAmB,OAAO,EAClC,YAAY;AACjB;;;ACDO,SAAS,MAA+B,QAAyB;AACtE,SAAO;AAAA,IACL,QAAQ,OAAO,OAAO;AAAA,EACxB;AACF;;;ACHO,SAAS,gBAAyC,QAAyB;AAChF,SAAO,OAAO,WAAW;AAC3B;;;AHIO,SAAS,aAAsC,QAAyB,SAAuB;AACpG,QAAM,QAA+C;AAAA,IACnD,GAAG,gBAAgB,MAAM;AAAA,EAC3B;AAEA,SAAO,CAAoB,cAAsC;AAC/D,UAAM,OAAO,cAAc,UAAU,WAAY;AAEjD,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QACA,KAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value"]}
|
|
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,CAAC,mCAAmC;AAAA,gBAC5F;AACA,4BAAY,IAAI,GAAG;AACnB,uBAAO;AAAA,kBACL,IAAI;AAAA,kBACJ,GAA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O;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"]}
|
|
@@ -30,6 +30,7 @@ function dialog(entries) {
|
|
|
30
30
|
return {
|
|
31
31
|
...this,
|
|
32
32
|
tabs: void 0,
|
|
33
|
+
component: void 0,
|
|
33
34
|
_parse() {
|
|
34
35
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
35
36
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -52,16 +53,18 @@ function dialog(entries) {
|
|
|
52
53
|
children
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
return {
|
|
57
|
+
dialog: [{
|
|
58
|
+
type: "tabs",
|
|
59
|
+
id: "tabs",
|
|
60
|
+
children: tabsArray
|
|
61
|
+
}]
|
|
62
|
+
};
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
65
|
},
|
|
63
66
|
_parse() {
|
|
64
|
-
|
|
67
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
65
68
|
id: key,
|
|
66
69
|
name: key,
|
|
67
70
|
...entry._parse()
|
|
@@ -70,6 +73,9 @@ function dialog(entries) {
|
|
|
70
73
|
return entry.type !== "hidden";
|
|
71
74
|
}
|
|
72
75
|
});
|
|
76
|
+
return {
|
|
77
|
+
dialog: dialog2
|
|
78
|
+
};
|
|
73
79
|
},
|
|
74
80
|
_primitive() {
|
|
75
81
|
return Object.entries(entries).reduce(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/schema/dialog/dialog.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'
|
|
1
|
+
{"version":3,"sources":["../../../src/schema/dialog/dialog.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}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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,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,CAAC;AAEH,iBAAO;AAAA,YACL,QAAQ,CAAC;AAAA,cACP,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AACP,YAAMC,UAAS,OAAO,QAAQ,OAAO,EAClC,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,YAAI,UAAU,OAAO;AACnB,iBAAO,MAAM,SAAS;AAAA,QACxB;AAAA,MACF,CAAC;AAEH,aAAO;AAAA,QACL,QAAAA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,OAAO,QAAQ,OAAO,EAC1B;AAAA,QACC,CAAC,KAA4C,CAAC,KAAK,KAAK,MAAM;AAC5D,gBAAM,OAAO,MAAM,WAAW;AAC9B,cAAI,OAAO,SAAS,UAAU;AAC5B,gBAAI,GAAG,IAAI;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,QAAG,CAAC;AAAA,MAAC;AAAA,IACX;AAAA,EACF;AACF;","names":["value","dialog"]}
|
|
@@ -6,6 +6,7 @@ function dialog(entries) {
|
|
|
6
6
|
return {
|
|
7
7
|
...this,
|
|
8
8
|
tabs: void 0,
|
|
9
|
+
component: void 0,
|
|
9
10
|
_parse() {
|
|
10
11
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
11
12
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -28,16 +29,18 @@ function dialog(entries) {
|
|
|
28
29
|
children
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
return {
|
|
33
|
+
dialog: [{
|
|
34
|
+
type: "tabs",
|
|
35
|
+
id: "tabs",
|
|
36
|
+
children: tabsArray
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
},
|
|
39
42
|
_parse() {
|
|
40
|
-
|
|
43
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
41
44
|
id: key,
|
|
42
45
|
name: key,
|
|
43
46
|
...entry._parse()
|
|
@@ -46,6 +49,9 @@ function dialog(entries) {
|
|
|
46
49
|
return entry.type !== "hidden";
|
|
47
50
|
}
|
|
48
51
|
});
|
|
52
|
+
return {
|
|
53
|
+
dialog: dialog2
|
|
54
|
+
};
|
|
49
55
|
},
|
|
50
56
|
_primitive() {
|
|
51
57
|
return Object.entries(entries).reduce(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/schema/dialog/dialog.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'
|
|
1
|
+
{"version":3,"sources":["../../../src/schema/dialog/dialog.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}"],"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,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,CAAC;AAEH,iBAAO;AAAA,YACL,QAAQ,CAAC;AAAA,cACP,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AACP,YAAMC,UAAS,OAAO,QAAQ,OAAO,EAClC,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,YAAI,UAAU,OAAO;AACnB,iBAAO,MAAM,SAAS;AAAA,QACxB;AAAA,MACF,CAAC;AAEH,aAAO;AAAA,QACL,QAAAA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,OAAO,QAAQ,OAAO,EAC1B;AAAA,QACC,CAAC,KAA4C,CAAC,KAAK,KAAK,MAAM;AAC5D,gBAAM,OAAO,MAAM,WAAW;AAC9B,cAAI,OAAO,SAAS,UAAU;AAC5B,gBAAI,GAAG,IAAI;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,QAAG,CAAC;AAAA,MAAC;AAAA,IACX;AAAA,EACF;AACF;","names":["value","dialog"]}
|
|
@@ -32,6 +32,7 @@ function dialog(entries) {
|
|
|
32
32
|
return {
|
|
33
33
|
...this,
|
|
34
34
|
tabs: void 0,
|
|
35
|
+
component: void 0,
|
|
35
36
|
_parse() {
|
|
36
37
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
37
38
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -54,16 +55,18 @@ function dialog(entries) {
|
|
|
54
55
|
children
|
|
55
56
|
};
|
|
56
57
|
});
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
return {
|
|
59
|
+
dialog: [{
|
|
60
|
+
type: "tabs",
|
|
61
|
+
id: "tabs",
|
|
62
|
+
children: tabsArray
|
|
63
|
+
}]
|
|
64
|
+
};
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
67
|
},
|
|
65
68
|
_parse() {
|
|
66
|
-
|
|
69
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
67
70
|
id: key,
|
|
68
71
|
name: key,
|
|
69
72
|
...entry._parse()
|
|
@@ -72,6 +75,9 @@ function dialog(entries) {
|
|
|
72
75
|
return entry.type !== "hidden";
|
|
73
76
|
}
|
|
74
77
|
});
|
|
78
|
+
return {
|
|
79
|
+
dialog: dialog2
|
|
80
|
+
};
|
|
75
81
|
},
|
|
76
82
|
_primitive() {
|
|
77
83
|
return Object.entries(entries).reduce(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/schema/dialog/index.ts","../../../src/schema/dialog/dialog.ts"],"sourcesContent":["export * from './dialog';\n","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'
|
|
1
|
+
{"version":3,"sources":["../../../src/schema/dialog/index.ts","../../../src/schema/dialog/dialog.ts"],"sourcesContent":["export * from './dialog';\n","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}"],"mappings":";;;;;;;;;;;;;;;;;;;;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;AA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KAAK,KAAK,MAAM;AAC5D,gBAAM,OAAO,MAAM,WAAW;AAC9B,cAAI,OAAO,SAAS,UAAU;AAC5B,gBAAI,GAAG,IAAI;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,QAAG,CAAC;AAAA,MAAC;AAAA,IACX;AAAA,EACF;AACF;","names":["value","dialog"]}
|
|
@@ -6,6 +6,7 @@ function dialog(entries) {
|
|
|
6
6
|
return {
|
|
7
7
|
...this,
|
|
8
8
|
tabs: void 0,
|
|
9
|
+
component: void 0,
|
|
9
10
|
_parse() {
|
|
10
11
|
const usedEntries = /* @__PURE__ */ new Set();
|
|
11
12
|
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
@@ -28,16 +29,18 @@ function dialog(entries) {
|
|
|
28
29
|
children
|
|
29
30
|
};
|
|
30
31
|
});
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
return {
|
|
33
|
+
dialog: [{
|
|
34
|
+
type: "tabs",
|
|
35
|
+
id: "tabs",
|
|
36
|
+
children: tabsArray
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
},
|
|
39
42
|
_parse() {
|
|
40
|
-
|
|
43
|
+
const dialog2 = Object.entries(entries).map(([key, entry]) => ({
|
|
41
44
|
id: key,
|
|
42
45
|
name: key,
|
|
43
46
|
...entry._parse()
|
|
@@ -46,6 +49,9 @@ function dialog(entries) {
|
|
|
46
49
|
return entry.type !== "hidden";
|
|
47
50
|
}
|
|
48
51
|
});
|
|
52
|
+
return {
|
|
53
|
+
dialog: dialog2
|
|
54
|
+
};
|
|
49
55
|
},
|
|
50
56
|
_primitive() {
|
|
51
57
|
return Object.entries(entries).reduce(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/schema/dialog/dialog.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'
|
|
1
|
+
{"version":3,"sources":["../../../src/schema/dialog/dialog.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}"],"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,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,CAAC;AAEH,iBAAO;AAAA,YACL,QAAQ,CAAC;AAAA,cACP,MAAM;AAAA,cACN,IAAI;AAAA,cACJ,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AACP,YAAMC,UAAS,OAAO,QAAQ,OAAO,EAClC,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,YAAI,UAAU,OAAO;AACnB,iBAAO,MAAM,SAAS;AAAA,QACxB;AAAA,MACF,CAAC;AAEH,aAAO;AAAA,QACL,QAAAA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO,OAAO,QAAQ,OAAO,EAC1B;AAAA,QACC,CAAC,KAA4C,CAAC,KAAK,KAAK,MAAM;AAC5D,gBAAM,OAAO,MAAM,WAAW;AAC9B,cAAI,OAAO,SAAS,UAAU;AAC5B,gBAAI,GAAG,IAAI;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,QAAG,CAAC;AAAA,MAAC;AAAA,IACX;AAAA,EACF;AACF;","names":["value","dialog"]}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -2,4 +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
6
|
import './webcomponent.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +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
6
|
import './webcomponent.js';
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './props'\nexport * from './utils'\nexport * from './schema'\nexport * from './infer'"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from './props'\nexport * from './utils'\nexport * from './schema'\nexport * from './infer'\nexport { ComponentModel } from './component';"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/types/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/utils.ts"],"sourcesContent":["/**\n * Resolve type.\n *\n * Hint: This type has no effect and is only used so that TypeScript displays\n * the final type in the preview instead of the utility types used.\n */\ntype Resolve<T> = T;\n\n/**\n * Resolve object type.\n *\n * Hint: This type has no effect and is only used so that TypeScript displays\n * the final type in the preview instead of the utility types used.\n */\nexport type ResolveObject<T> = Resolve<{ [k in keyof T]: T[k] }>;\n\n/**\n * Create a type that requires at least one of the keys in the object.\n */\nexport type RequireAtLeastOne<TObject> = {\n [Key in keyof TObject]: Required<Pick<TObject, Key>> &\n Partial<Object>;\n}[keyof TObject]\n\n/**\n * Make a mask for an object.\n *\n * Receives an object and make a object with the keys, but only a boolean value\n */\nexport type EntryMask<T> = RequireAtLeastOne<{ [key in keyof T]?: boolean }
|
|
1
|
+
{"version":3,"sources":["../../src/types/utils.ts"],"sourcesContent":["/**\n * Resolve type.\n *\n * Hint: This type has no effect and is only used so that TypeScript displays\n * the final type in the preview instead of the utility types used.\n */\ntype Resolve<T> = T;\n\n/**\n * Resolve object type.\n *\n * Hint: This type has no effect and is only used so that TypeScript displays\n * the final type in the preview instead of the utility types used.\n */\nexport type ResolveObject<T> = Resolve<{ [k in keyof T]: T[k] }>;\n\n/**\n * Create a type that requires at least one of the keys in the object.\n */\nexport type RequireAtLeastOne<TObject> = {\n [Key in keyof TObject]: Required<Pick<TObject, Key>> &\n Partial<Object>;\n}[keyof TObject]\n\n/**\n * Make a mask for an object.\n *\n * Receives an object and make a object with the keys, but only a boolean value\n */\nexport type EntryMask<T> = RequireAtLeastOne<{ [key in keyof T]?: boolean }>;\n\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|