@ethereal-nexus/core 1.1.0 → 1.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/decorators/index.d.mts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +25 -4
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +25 -4
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/decorators/webcomponent/index.d.mts +1 -1
- package/dist/decorators/webcomponent/index.d.ts +1 -1
- package/dist/decorators/webcomponent/index.js +25 -4
- package/dist/decorators/webcomponent/index.js.map +1 -1
- package/dist/decorators/webcomponent/index.mjs +25 -4
- 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 +25 -4
- package/dist/decorators/webcomponent/webcomponent.js.map +1 -1
- package/dist/decorators/webcomponent/webcomponent.mjs +25 -4
- package/dist/decorators/webcomponent/webcomponent.mjs.map +1 -1
- package/dist/functions/component/component.d.mts +3 -4
- package/dist/functions/component/component.d.ts +3 -4
- package/dist/functions/component/component.js +3 -16
- package/dist/functions/component/component.js.map +1 -1
- package/dist/functions/component/component.mjs +3 -16
- package/dist/functions/component/component.mjs.map +1 -1
- package/dist/functions/component/index.d.mts +1 -1
- package/dist/functions/component/index.d.ts +1 -1
- package/dist/functions/component/index.js +3 -16
- package/dist/functions/component/index.js.map +1 -1
- package/dist/functions/component/index.mjs +3 -16
- package/dist/functions/component/index.mjs.map +1 -1
- package/dist/functions/index.d.mts +1 -1
- package/dist/functions/index.d.ts +1 -1
- package/dist/functions/index.js +3 -16
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs +3 -16
- package/dist/functions/index.mjs.map +1 -1
- package/dist/functions/parse/index.d.mts +1 -1
- package/dist/functions/parse/index.d.ts +1 -1
- package/dist/functions/parse/parse.d.mts +1 -1
- package/dist/functions/parse/parse.d.ts +1 -1
- package/dist/functions/parse/parsePrimitives.d.mts +1 -1
- package/dist/functions/parse/parsePrimitives.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -20
- package/dist/index.mjs.map +1 -1
- package/dist/schema/calendar/calendar.d.mts +1 -1
- package/dist/schema/calendar/calendar.d.ts +1 -1
- package/dist/schema/calendar/index.d.mts +1 -1
- package/dist/schema/calendar/index.d.ts +1 -1
- package/dist/schema/checkbox/checkbox.d.mts +1 -1
- package/dist/schema/checkbox/checkbox.d.ts +1 -1
- package/dist/schema/checkbox/index.d.mts +1 -1
- package/dist/schema/checkbox/index.d.ts +1 -1
- package/dist/schema/datamodel/datamodel.d.mts +1 -1
- package/dist/schema/datamodel/datamodel.d.ts +1 -1
- package/dist/schema/datamodel/index.d.mts +1 -1
- package/dist/schema/datamodel/index.d.ts +1 -1
- package/dist/schema/datasource/datasource.d.mts +1 -1
- package/dist/schema/datasource/datasource.d.ts +1 -1
- package/dist/schema/datasource/index.d.mts +1 -1
- package/dist/schema/datasource/index.d.ts +1 -1
- package/dist/schema/dialog/condition.d.mts +1 -1
- package/dist/schema/dialog/condition.d.ts +1 -1
- package/dist/schema/dialog/dialog.d.mts +1 -1
- package/dist/schema/dialog/dialog.d.ts +1 -1
- package/dist/schema/dialog/index.d.mts +1 -1
- package/dist/schema/dialog/index.d.ts +1 -1
- package/dist/schema/dialog/tabs.d.mts +1 -1
- package/dist/schema/dialog/tabs.d.ts +1 -1
- package/dist/schema/dialog/types.d.mts +1 -1
- package/dist/schema/dialog/types.d.ts +1 -1
- package/dist/schema/dynamic/dynamic.d.mts +1 -1
- package/dist/schema/dynamic/dynamic.d.ts +1 -1
- package/dist/schema/dynamic/index.d.mts +1 -1
- package/dist/schema/dynamic/index.d.ts +1 -1
- package/dist/schema/group/group.d.mts +1 -1
- package/dist/schema/group/group.d.ts +1 -1
- package/dist/schema/group/index.d.mts +1 -1
- package/dist/schema/group/index.d.ts +1 -1
- package/dist/schema/hidden/hidden.d.mts +1 -1
- package/dist/schema/hidden/hidden.d.ts +1 -1
- package/dist/schema/hidden/index.d.mts +1 -1
- package/dist/schema/hidden/index.d.ts +1 -1
- package/dist/schema/image/image.d.mts +1 -1
- package/dist/schema/image/image.d.ts +1 -1
- package/dist/schema/image/index.d.mts +1 -1
- package/dist/schema/image/index.d.ts +1 -1
- package/dist/schema/multifield/index.d.mts +1 -1
- package/dist/schema/multifield/index.d.ts +1 -1
- package/dist/schema/multifield/multifield.d.mts +1 -1
- package/dist/schema/multifield/multifield.d.ts +1 -1
- package/dist/schema/navigation/index.d.mts +1 -1
- package/dist/schema/navigation/index.d.ts +1 -1
- package/dist/schema/navigation/navigation.d.mts +1 -1
- package/dist/schema/navigation/navigation.d.ts +1 -1
- package/dist/schema/object/index.d.mts +1 -1
- package/dist/schema/object/index.d.ts +1 -1
- package/dist/schema/object/object.d.mts +1 -1
- package/dist/schema/object/object.d.ts +1 -1
- package/dist/schema/optional/index.d.mts +1 -1
- package/dist/schema/optional/index.d.ts +1 -1
- package/dist/schema/optional/optional.d.mts +1 -1
- package/dist/schema/optional/optional.d.ts +1 -1
- package/dist/schema/pathbrowser/index.d.mts +1 -1
- package/dist/schema/pathbrowser/index.d.ts +1 -1
- package/dist/schema/pathbrowser/pathbrowser.d.mts +1 -1
- package/dist/schema/pathbrowser/pathbrowser.d.ts +1 -1
- package/dist/schema/rte/index.d.mts +1 -1
- package/dist/schema/rte/index.d.ts +1 -1
- package/dist/schema/rte/rte.d.mts +1 -1
- package/dist/schema/rte/rte.d.ts +1 -1
- package/dist/schema/select/index.d.mts +1 -1
- package/dist/schema/select/index.d.ts +1 -1
- package/dist/schema/select/select.d.mts +1 -1
- package/dist/schema/select/select.d.ts +1 -1
- package/dist/schema/text/index.d.mts +1 -1
- package/dist/schema/text/index.d.ts +1 -1
- package/dist/schema/text/text.d.mts +1 -1
- package/dist/schema/text/text.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/infer.d.mts +1 -1
- package/dist/types/infer.d.ts +1 -1
- package/dist/types/object.d.mts +1 -1
- package/dist/types/object.d.ts +1 -1
- package/dist/types/object.js.map +1 -1
- package/dist/types/schema.d.mts +1 -1
- package/dist/types/schema.d.ts +1 -1
- package/dist/{types-Cvbi87LT.d.ts → types-5qjjdXLi.d.ts} +1 -7
- package/dist/{types-DUGwdG43.d.mts → types-CUiyZnDu.d.mts} +1 -7
- package/package.json +3 -2
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
// src/functions/component/component.ts
|
|
2
|
-
function component(config, dialog
|
|
3
|
-
const slotsParse = slots ? Object.entries(slots).map(
|
|
4
|
-
([key, slot]) => ({
|
|
5
|
-
id: key,
|
|
6
|
-
name: key,
|
|
7
|
-
...slot._parse()
|
|
8
|
-
})
|
|
9
|
-
) : [];
|
|
10
|
-
const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {
|
|
11
|
-
acc[key] = slot._primitive();
|
|
12
|
-
return acc;
|
|
13
|
-
}, {}) : [];
|
|
2
|
+
function component(config, dialog) {
|
|
14
3
|
return {
|
|
15
4
|
type: "component",
|
|
16
5
|
dialog,
|
|
17
6
|
_parse() {
|
|
18
7
|
return {
|
|
19
8
|
...config,
|
|
20
|
-
...dialog._parse()
|
|
21
|
-
dynamiczones: slotsParse
|
|
9
|
+
...dialog._parse()
|
|
22
10
|
};
|
|
23
11
|
},
|
|
24
12
|
_primitive() {
|
|
25
13
|
return {
|
|
26
|
-
...dialog._primitive()
|
|
27
|
-
...slotsPrimitives
|
|
14
|
+
...dialog._primitive()
|
|
28
15
|
};
|
|
29
16
|
},
|
|
30
17
|
...config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput
|
|
1
|
+
{"version":3,"sources":["../../../src/functions/component/component.ts"],"sourcesContent":["import { BaseSchema, ComponentModel } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries> extends BaseSchema<ObjectOutput<TEntries>>, Partial<ComponentModel> {\n type: 'component';\n dialog: DialogSchema<TEntries>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialog: DialogSchema<TEntries>,\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog,\n _parse() {\n return {\n ...config,\n ...dialog._parse(),\n };\n },\n _primitive() {\n return {\n ...dialog._primitive() as object,\n };\n },\n ...config,\n };\n}"],"mappings":";AASO,SAAS,UACd,QACA,QAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,OAAO,OAAO;AAAA,MACnB;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,QACL,GAAG,OAAO,WAAW;AAAA,MACvB;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
|
|
@@ -2,7 +2,7 @@ export { parse } from './parse/parse.mjs';
|
|
|
2
2
|
export { parsePrimitives } from './parse/parsePrimitives.mjs';
|
|
3
3
|
export { ComponentSchema, component } from './component/component.mjs';
|
|
4
4
|
import '../schema/dialog/dialog.mjs';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-CUiyZnDu.mjs';
|
|
6
6
|
import '../types/webcomponent.mjs';
|
|
7
7
|
import '../types/utils.mjs';
|
|
8
8
|
import '../types/component.mjs';
|
|
@@ -2,7 +2,7 @@ export { parse } from './parse/parse.js';
|
|
|
2
2
|
export { parsePrimitives } from './parse/parsePrimitives.js';
|
|
3
3
|
export { ComponentSchema, component } from './component/component.js';
|
|
4
4
|
import '../schema/dialog/dialog.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-5qjjdXLi.js';
|
|
6
6
|
import '../types/webcomponent.js';
|
|
7
7
|
import '../types/utils.js';
|
|
8
8
|
import '../types/component.js';
|
package/dist/functions/index.js
CHANGED
|
@@ -37,32 +37,19 @@ function parsePrimitives(schema) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// src/functions/component/component.ts
|
|
40
|
-
function component(config, dialog
|
|
41
|
-
const slotsParse = slots ? Object.entries(slots).map(
|
|
42
|
-
([key, slot]) => ({
|
|
43
|
-
id: key,
|
|
44
|
-
name: key,
|
|
45
|
-
...slot._parse()
|
|
46
|
-
})
|
|
47
|
-
) : [];
|
|
48
|
-
const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {
|
|
49
|
-
acc[key] = slot._primitive();
|
|
50
|
-
return acc;
|
|
51
|
-
}, {}) : [];
|
|
40
|
+
function component(config, dialog) {
|
|
52
41
|
return {
|
|
53
42
|
type: "component",
|
|
54
43
|
dialog,
|
|
55
44
|
_parse() {
|
|
56
45
|
return {
|
|
57
46
|
...config,
|
|
58
|
-
...dialog._parse()
|
|
59
|
-
dynamiczones: slotsParse
|
|
47
|
+
...dialog._parse()
|
|
60
48
|
};
|
|
61
49
|
},
|
|
62
50
|
_primitive() {
|
|
63
51
|
return {
|
|
64
|
-
...dialog._primitive()
|
|
65
|
-
...slotsPrimitives
|
|
52
|
+
...dialog._primitive()
|
|
66
53
|
};
|
|
67
54
|
},
|
|
68
55
|
...config
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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> extends BaseSchema<ObjectOutput<TEntries>>, Partial<ComponentModel> {\n type: 'component';\n dialog: DialogSchema<TEntries>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialog: DialogSchema<TEntries>,\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog,\n _parse() {\n return {\n ...config,\n ...dialog._parse(),\n };\n },\n _primitive() {\n return {\n ...dialog._primitive() as object,\n };\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,QAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,OAAO,OAAO;AAAA,MACnB;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,QACL,GAAG,OAAO,WAAW;AAAA,MACvB;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
|
package/dist/functions/index.mjs
CHANGED
|
@@ -9,32 +9,19 @@ function parsePrimitives(schema) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// src/functions/component/component.ts
|
|
12
|
-
function component(config, dialog
|
|
13
|
-
const slotsParse = slots ? Object.entries(slots).map(
|
|
14
|
-
([key, slot]) => ({
|
|
15
|
-
id: key,
|
|
16
|
-
name: key,
|
|
17
|
-
...slot._parse()
|
|
18
|
-
})
|
|
19
|
-
) : [];
|
|
20
|
-
const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {
|
|
21
|
-
acc[key] = slot._primitive();
|
|
22
|
-
return acc;
|
|
23
|
-
}, {}) : [];
|
|
12
|
+
function component(config, dialog) {
|
|
24
13
|
return {
|
|
25
14
|
type: "component",
|
|
26
15
|
dialog,
|
|
27
16
|
_parse() {
|
|
28
17
|
return {
|
|
29
18
|
...config,
|
|
30
|
-
...dialog._parse()
|
|
31
|
-
dynamiczones: slotsParse
|
|
19
|
+
...dialog._parse()
|
|
32
20
|
};
|
|
33
21
|
},
|
|
34
22
|
_primitive() {
|
|
35
23
|
return {
|
|
36
|
-
...dialog._primitive()
|
|
37
|
-
...slotsPrimitives
|
|
24
|
+
...dialog._primitive()
|
|
38
25
|
};
|
|
39
26
|
},
|
|
40
27
|
...config
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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> extends BaseSchema<ObjectOutput<TEntries>>, Partial<ComponentModel> {\n type: 'component';\n dialog: DialogSchema<TEntries>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialog: DialogSchema<TEntries>,\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog,\n _parse() {\n return {\n ...config,\n ...dialog._parse(),\n };\n },\n _primitive() {\n return {\n ...dialog._primitive() as object,\n };\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,QAC2B;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,SAAS;AACP,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG,OAAO,OAAO;AAAA,MACnB;AAAA,IACF;AAAA,IACA,aAAa;AACX,aAAO;AAAA,QACL,GAAG,OAAO,WAAW;AAAA,MACvB;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parse } from './parse.mjs';
|
|
2
2
|
export { parsePrimitives } from './parsePrimitives.mjs';
|
|
3
3
|
import '../../schema/dialog/dialog.mjs';
|
|
4
|
-
import '../../types-
|
|
4
|
+
import '../../types-CUiyZnDu.mjs';
|
|
5
5
|
import '../../types/webcomponent.mjs';
|
|
6
6
|
import '../../types/utils.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parse } from './parse.js';
|
|
2
2
|
export { parsePrimitives } from './parsePrimitives.js';
|
|
3
3
|
import '../../schema/dialog/dialog.js';
|
|
4
|
-
import '../../types-
|
|
4
|
+
import '../../types-5qjjdXLi.js';
|
|
5
5
|
import '../../types/webcomponent.js';
|
|
6
6
|
import '../../types/utils.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DialogSchema } from '../../schema/dialog/dialog.mjs';
|
|
2
2
|
import { WebcomponentPropTypes } from '../../types/webcomponent.mjs';
|
|
3
|
-
import { f as ObjectEntries } from '../../types-
|
|
3
|
+
import { f as ObjectEntries } from '../../types-CUiyZnDu.mjs';
|
|
4
4
|
import '../../types/utils.mjs';
|
|
5
5
|
|
|
6
6
|
declare function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>): Record<string, WebcomponentPropTypes>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DialogSchema } from '../../schema/dialog/dialog.js';
|
|
2
2
|
import { WebcomponentPropTypes } from '../../types/webcomponent.js';
|
|
3
|
-
import { f as ObjectEntries } from '../../types-
|
|
3
|
+
import { f as ObjectEntries } from '../../types-5qjjdXLi.js';
|
|
4
4
|
import '../../types/utils.js';
|
|
5
5
|
|
|
6
6
|
declare function parsePrimitives<T extends ObjectEntries>(schema: DialogSchema<T>): Record<string, WebcomponentPropTypes>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DialogSchema, dialog } from './schema/dialog/dialog.mjs';
|
|
2
2
|
export { Condition } from './schema/dialog/condition.mjs';
|
|
3
|
-
export { d as BaseFieldInput, B as BaseSchema, b as ConditionFn, a as ConditionOperators, C as Conditions, c as ConditionsArgument, F as Field, O as OptionalSchema, e as Output, o as optional } from './types-
|
|
3
|
+
export { d as BaseFieldInput, B as BaseSchema, b as ConditionFn, a as ConditionOperators, C as Conditions, c as ConditionsArgument, F as Field, O as OptionalSchema, e as Output, o as optional } from './types-CUiyZnDu.mjs';
|
|
4
4
|
export { Tabs } from './schema/dialog/tabs.mjs';
|
|
5
5
|
export { MultifieldSchema, multifield } from './schema/multifield/multifield.mjs';
|
|
6
6
|
export { TextSchema, text } from './schema/text/text.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DialogSchema, dialog } from './schema/dialog/dialog.js';
|
|
2
2
|
export { Condition } from './schema/dialog/condition.js';
|
|
3
|
-
export { d as BaseFieldInput, B as BaseSchema, b as ConditionFn, a as ConditionOperators, C as Conditions, c as ConditionsArgument, F as Field, O as OptionalSchema, e as Output, o as optional } from './types-
|
|
3
|
+
export { d as BaseFieldInput, B as BaseSchema, b as ConditionFn, a as ConditionOperators, C as Conditions, c as ConditionsArgument, F as Field, O as OptionalSchema, e as Output, o as optional } from './types-5qjjdXLi.js';
|
|
4
4
|
export { Tabs } from './schema/dialog/tabs.js';
|
|
5
5
|
export { MultifieldSchema, multifield } from './schema/multifield/multifield.js';
|
|
6
6
|
export { TextSchema, text } from './schema/text/text.js';
|
package/dist/index.js
CHANGED
|
@@ -565,32 +565,19 @@ function parsePrimitives(schema) {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
// src/functions/component/component.ts
|
|
568
|
-
function component(config, dialog2
|
|
569
|
-
const slotsParse = slots ? Object.entries(slots).map(
|
|
570
|
-
([key, slot]) => ({
|
|
571
|
-
id: key,
|
|
572
|
-
name: key,
|
|
573
|
-
...slot._parse()
|
|
574
|
-
})
|
|
575
|
-
) : [];
|
|
576
|
-
const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {
|
|
577
|
-
acc[key] = slot._primitive();
|
|
578
|
-
return acc;
|
|
579
|
-
}, {}) : [];
|
|
568
|
+
function component(config, dialog2) {
|
|
580
569
|
return {
|
|
581
570
|
type: "component",
|
|
582
571
|
dialog: dialog2,
|
|
583
572
|
_parse() {
|
|
584
573
|
return {
|
|
585
574
|
...config,
|
|
586
|
-
...dialog2._parse()
|
|
587
|
-
dynamiczones: slotsParse
|
|
575
|
+
...dialog2._parse()
|
|
588
576
|
};
|
|
589
577
|
},
|
|
590
578
|
_primitive() {
|
|
591
579
|
return {
|
|
592
|
-
...dialog2._primitive()
|
|
593
|
-
...slotsPrimitives
|
|
580
|
+
...dialog2._primitive()
|
|
594
581
|
};
|
|
595
582
|
},
|
|
596
583
|
...config
|
|
@@ -604,13 +591,34 @@ function webcomponent(schema, options) {
|
|
|
604
591
|
} : void 0;
|
|
605
592
|
return (component2) => {
|
|
606
593
|
const name = pascalToKebab(component2.displayName);
|
|
594
|
+
class StyledWebComponent extends (0, import_react_to_web_component.default)(component2, {
|
|
595
|
+
shadow: "open",
|
|
596
|
+
props
|
|
597
|
+
}) {
|
|
598
|
+
connectedCallback() {
|
|
599
|
+
super.connectedCallback();
|
|
600
|
+
queueMicrotask(() => {
|
|
601
|
+
const cssUrlsAttr = this.getAttribute("data-css-urls");
|
|
602
|
+
if (cssUrlsAttr) {
|
|
603
|
+
const cssUrlsArray = JSON.parse(cssUrlsAttr.replace(/'/g, '"'));
|
|
604
|
+
const slotTemplate = document.createElement("template");
|
|
605
|
+
const getImportsFromUrlsArray = (urls) => urls.map((url) => `<link rel="preload" as="style" onload="this.rel='stylesheet'" type="text/css" href="${url}">`).join("\n");
|
|
606
|
+
slotTemplate.innerHTML = `<style>
|
|
607
|
+
::slotted(*) {
|
|
608
|
+
display: block !important;
|
|
609
|
+
}
|
|
610
|
+
</style>
|
|
611
|
+
${getImportsFromUrlsArray(cssUrlsArray)}
|
|
612
|
+
`;
|
|
613
|
+
this.shadowRoot?.appendChild(slotTemplate.content.cloneNode(true));
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
607
618
|
if (!window.customElements.get(name)) {
|
|
608
619
|
customElements.define(
|
|
609
620
|
name,
|
|
610
|
-
|
|
611
|
-
shadow: "open",
|
|
612
|
-
props
|
|
613
|
-
})
|
|
621
|
+
StyledWebComponent
|
|
614
622
|
);
|
|
615
623
|
}
|
|
616
624
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/schema/dialog/tabs.ts","../src/schema/dialog/condition.ts","../src/utils/pathToArray.ts","../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/rte/rte.ts","../src/schema/dynamic/dynamic.ts","../src/schema/calendar/calendar.ts","../src/schema/datasource/datasource.ts","../src/schema/group/group.ts","../src/schema/datamodel/datamodel.ts","../src/schema/navigation/navigation.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["export * from \"./schema/dialog\";\n\nexport * from \"./schema/multifield\";\nexport * from \"./schema/text\";\nexport * from \"./schema/checkbox\";\nexport * from \"./schema/pathbrowser\";\nexport * from \"./schema/image\";\nexport * from \"./schema/select\";\nexport * from \"./schema/rte\";\nexport * from \"./schema/dynamic\";\nexport * from \"./schema/calendar\";\nexport * from \"./schema/datasource\";\nexport * from \"./schema/group\";\nexport * from \"./schema/datamodel\";\nexport * from \"./schema/navigation\";\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 { EntryMask } from '../../types';\nimport { Field } from './types';\n\nexport class Tabs<TEntries> {\n private tabs = new Map<string, EntryMask<TEntries>>();\n\n addTab(name: string, entries: EntryMask<TEntries>) {\n this.tabs.set(name, entries);\n }\n\n parse(entries: Field[]) {\n const result = []\n const usedEntries = new Set();\n\n if(this.tabs.size === 0) {\n return entries\n }\n\n for(const [name, mask] of this.tabs) {\n const children = []\n\n if(!mask) {\n throw new Error(`Entry \"${String(name)}\" does not have an appropriate tab configuration.`);\n }\n\n for(const [key,] of Object.entries(mask)) {\n const field = entries.find(f => f.id === key)\n\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(name)}.${String(key)}\" is already used in another tab.`);\n }\n\n if(!field) {\n throw new Error(`Field with id \"${key}\" not found`);\n }\n\n children.push(entries.find(f => f.id === key))\n }\n\n result.push({\n type: 'tab',\n label: name,\n id: `tab_${name.toLowerCase().replaceAll(' ', '')}`,\n children\n })\n }\n\n return [{\n type: 'tabs',\n id: 'tabs',\n children: result\n }]\n }\n}","import { NestedPaths } from '../../types';\nimport { ConditionFn, ConditionOperators, Conditions, Field } from './types';\nimport { ObjectEntries } from '../../types/object';\n\nfunction addConditionToField(fields: Field[], path: string, condition: Conditions): void {\n const keys = path.split('.');\n let currentFields = fields;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const field = currentFields.find(f => f.id === key);\n\n if (!field) {\n throw new Error(`Field with id \"${key}\" not found`);\n }\n\n if (i === keys.length - 1) {\n field.condition = condition;\n } else {\n if (!field.children) {\n throw new Error(`Field with id \"${key}\" has no children`);\n }\n\n const nextKey = keys[i + 1];\n if(nextKey === '$this') {\n field.condition = condition;\n break;\n }\n currentFields = field.children;\n }\n }\n}\n\nexport class Condition<TEntries extends ObjectEntries> {\n private conditions = new Map<string, Conditions>();\n\n addCondition(field: NestedPaths<TEntries>, condition: ConditionFn<TEntries>) {\n const operators: ConditionOperators<TEntries> = {\n eq: (field, value) => ({ operator: 'eq', field, value }),\n neq: (field, value) => ({ operator: 'neq', field, value }),\n exists: (field) => ({ operator: 'exists', field }),\n and: (...operations) => ({ operator: 'and', value: operations }),\n or: (...operations) => ({ operator: 'or', value: operations })\n };\n\n this.conditions.set(field, condition(operators));\n }\n\n parse(entries: Field[]) {\n for (let [key, value] of this.conditions) {\n addConditionToField(entries, key, value)\n }\n\n return entries;\n }\n}\n","interface PathValue {\n path: string[];\n value: any;\n}\n\nexport function pathToArray(obj: Record<string, any>, parentPath: string[] = []): PathValue[] {\n const result: PathValue[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n const currentPath = [...parentPath, key];\n\n if (typeof value === 'object' && !value.hasOwnProperty('operator') && !Array.isArray(value)) {\n // If the value is an object, recurse into it\n result.push(...pathToArray(value, currentPath));\n } else {\n // If the value is not an object, store the path and value\n result.push({ path: currentPath, value });\n }\n }\n\n return result;\n}","import { BaseSchema, EntryMask, NestedPaths } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { Tabs } from './tabs';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { Condition } from './condition';\nimport { pathToArray } from '../../utils/pathToArray';\nimport { ConditionsArgument } from './types';\n\nexport interface DialogSchema<TEntries extends ObjectEntries> extends BaseSchema<ObjectOutput<TEntries>> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => DialogSchema<TEntries>;\n conditions: (conditions: ConditionsArgument<TEntries>) => DialogSchema<TEntries>;\n}\n\nclass DialogBuilder<TEntries extends ObjectEntries> implements DialogSchema<TEntries> {\n private conditionsModule: Condition<TEntries>;\n private tabsModule: Tabs<TEntries>;\n private readonly entries: TEntries;\n readonly type = 'dialog';\n\n constructor(entries: TEntries) {\n this.entries = entries;\n this.conditionsModule = new Condition<TEntries>();\n this.tabsModule = new Tabs<TEntries>();\n }\n\n conditions(conditions: ConditionsArgument<TEntries>) {\n const conditionsArray = pathToArray(conditions)\n for (const condition of conditionsArray) {\n this.conditionsModule.addCondition(condition.path.join('.') as NestedPaths<TEntries>, condition.value);\n }\n return this;\n }\n\n tabs(tabs: Record<string, EntryMask<TEntries>>) {\n for (const [key, tab] of Object.entries(tabs)) {\n this.tabsModule.addTab(key as any, tab!);\n }\n return this;\n }\n\n _parse() {\n const dialog = Object.entries(this.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 const dialogWithConditions = this.conditionsModule.parse(dialog);\n const dialogWithTabs = this.tabsModule.parse(dialogWithConditions);\n return {\n dialog: dialogWithTabs\n };\n }\n\n _primitive() {\n const result: Record<string, WebcomponentPropTypes> = {};\n\n for (const [key, entry] of Object.entries(this.entries)) {\n const type = entry._primitive();\n if (typeof type === 'string') {\n result[key] = type;\n }\n }\n\n return result;\n }\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries) {\n return new DialogBuilder(entries)\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, required} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n required,\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,tooltip, required} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n tooltip,\n required\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 showastoggle?: boolean\n}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label, tooltip, showastoggle = false} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n tooltip,\n showastoggle\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, tooltip, required} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n tooltip,\n required\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}\n\nexport function image(input: ImageInput): ImageSchema {\n const {label, tooltip, required} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, BaseSchema } from '../../types';\n\ntype ReadonlyObject<T> = {\n readonly [K in keyof T]: T[K];\n};\n\nexport interface SelectSchema<T, TMultiple extends boolean = false> extends BaseSchema<TMultiple extends true ? T[] : T> {\n /**\n * The schema type.\n */\n type: 'select';\n multiple: TMultiple\n}\n\ninterface SelectInput extends BaseFieldInput {\n placeholder?: string;\n multiple?: boolean;\n values: {\n value: string;\n label: string;\n }[];\n}\n\n\ntype ValuesType<T extends { values: readonly { value: string }[] }> = T['values'][number]['value'];\n\nexport function select<const T extends SelectInput, TMultiple extends boolean= T['multiple'] extends true ? true : false>(input: T): SelectSchema<ValuesType<ReadonlyObject<T>>, TMultiple>{\n const { label, values, tooltip, placeholder, multiple = false, required } = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n multiple,\n values,\n tooltip,\n placeholder,\n required\n };\n },\n _primitive() {\n return multiple ? 'json' : 'string';\n },\n ...input,\n multiple: multiple as TMultiple,\n };\n}\n","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder?: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label, tooltip, required} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import {\n BaseSchema,\n} from '../../types';\n\nexport interface DynamicZoneSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'dynamic';\n}\n\ninterface DynamicInput {\n}\n\nexport function dynamic(input: DynamicInput): DynamicZoneSchema {\n return {\n type: 'dynamic',\n _parse() {\n return {\n type: 'dynamic',\n };\n },\n _primitive() {\n return 'string';\n },\n ...input,\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CalendarSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'calendar';\n}\n\ninterface CalendarInput extends BaseFieldInput {\n placeholder?: string;\n valueformat: string;\n displayformat: string;\n headerformat: string;\n startday?: string;\n min?: string;\n max?: string;\n}\n\nexport function calendar(input: CalendarInput): CalendarSchema {\n const {valueformat,startday=0,min,max, placeholder, label,tooltip,required} = input;\n\n return {\n type: 'calendar',\n _parse() {\n return {\n type: 'calendar',\n label,\n valueformat,\n placeholder,\n startday,\n tooltip,\n min,\n max,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\nimport { SelectSchema } from '../select';\ntype DataSourceOutputType<Multiple extends boolean> = Multiple extends true ? string[] : string;\n\nexport interface DataSourceSchema<Multiple extends boolean = false> extends BaseSchema<DataSourceOutputType<Multiple>> {\n /**\n * The schema type.\n */\n type: 'datasource';\n}\n\ninterface DataSourceBody {\n [key: string]: any;\n}\ninterface DataSourceInput extends BaseFieldInput {\n placeholder?: string;\n url: string;\n multiple?: boolean;\n body: DataSourceBody;\n}\n\nexport function datasource<Multiple extends boolean = false>(input: DataSourceInput & { multiple?: Multiple }): DataSourceSchema<Multiple> {\n const {label, body, url, tooltip,placeholder, multiple = false as Multiple, required } = input;\n\n return {\n type: 'datasource',\n _parse() {\n return {\n type: 'datasource',\n label,\n url,\n multiple,\n body,\n tooltip,\n placeholder,\n required,\n }\n },\n _primitive() {\n return multiple ? 'json' : 'string';\n },\n ...input,\n }\n}\n","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput,\n} from '../../types';\n\nexport interface GroupSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<{\n active: boolean;\n} & InferOutput<TChildren>> {\n readonly type: 'group';\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 toggle?: boolean;\n}\n\nexport function group<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): GroupSchema<TChildren> {\n const { label, children, tooltip, toggle } = input;\n const childrenParse = children._parse();\n\n return {\n type: 'group',\n _parse() {\n return {\n type: 'group',\n label,\n tooltip,\n toggle,\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 DataModelSchema<TOutput extends Record<string, any> = Record<string, any>> extends BaseSchema<TOutput> { /**\n * The schema type.\n */\n type: 'datamodel';\n}\n\ninterface DataModelInput extends BaseFieldInput {\n placeholder?: string;\n}\n\nexport function datamodel(input: DataModelInput): DataModelSchema {\n const {placeholder, label,tooltip, required} = input;\n\n return {\n type: 'datamodel',\n _parse() {\n return {\n type: 'datamodel',\n label,\n placeholder,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'json'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface NavigationSchema extends BaseSchema<NavigationItemSchema[]> { /**\n * The schema type.\n */\n type: 'navigation';\n}\n\nexport interface NavigationItemSchema {\n id: string;\n children: NavigationItemSchema[];\n active: boolean;\n url: string;\n title: string;\n}\n\n\ninterface DataModelInput extends BaseFieldInput {\n placeholder?: string;\n showChildrenCheckbox?: boolean;\n showRootLevel?: boolean;\n}\n\nexport function navigation(input: DataModelInput): NavigationSchema {\n const {placeholder, label,tooltip, required, showChildrenCheckbox, showRootLevel} = input;\n\n return {\n type: 'navigation',\n _parse() {\n return {\n type: 'navigation',\n label,\n placeholder,\n tooltip,\n required,\n showChildrenCheckbox,\n showRootLevel,\n }\n },\n _primitive() {\n return 'json'\n },\n ...input,\n }\n}","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!)\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name,\n r2wc(component, {\n shadow: 'open',\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, SlotEntries } from '../../types/object';\nimport { DialogSchema } from '../../schema/dialog';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface ComponentSchema<TEntries extends ObjectEntries, TSlots extends SlotEntries | undefined> extends BaseSchema<ObjectOutput<TEntries & TSlots>>, Partial<ComponentModel> {\n type: 'component';\n dialog: DialogSchema<TEntries>;\n slots?: TSlots,\n}\n\nexport function component<TEntries extends ObjectEntries, TSlots extends SlotEntries | undefined>(\n config: Partial<ComponentModel>,\n dialog: DialogSchema<TEntries>,\n slots?: TSlots,\n): ComponentSchema<TEntries, TSlots> {\n\n const slotsParse = slots ? Object.entries(slots).map(([key, slot]) => (\n {\n id: key,\n name: key,\n ...slot._parse(),\n }),\n ) : [];\n const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {\n acc[key] = slot._primitive();\n return acc\n }, {} as Record<string, WebcomponentPropTypes | Record<string, WebcomponentPropTypes>>) : [];\n\n return {\n type: 'component',\n dialog,\n _parse() {\n return {\n ...config,\n ...dialog._parse(),\n dynamiczones: slotsParse,\n };\n },\n _primitive() {\n return {\n ...dialog._primitive() as object,\n ...slotsPrimitives as object,\n };\n },\n ...config,\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,OAAN,MAAqB;AAAA,EAArB;AACL,wBAAQ,QAAO,oBAAI,IAAiC;AAAA;AAAA,EAEpD,OAAO,MAAc,SAA8B;AACjD,SAAK,KAAK,IAAI,MAAM,OAAO;AAAA,EAC7B;AAAA,EAEA,MAAM,SAAkB;AACtB,UAAM,SAAS,CAAC;AAChB,UAAM,cAAc,oBAAI,IAAI;AAE5B,QAAG,KAAK,KAAK,SAAS,GAAG;AACvB,aAAO;AAAA,IACT;AAEA,eAAU,CAAC,MAAM,IAAI,KAAK,KAAK,MAAM;AACnC,YAAM,WAAW,CAAC;AAElB,UAAG,CAAC,MAAM;AACR,cAAM,IAAI,MAAM,UAAU,OAAO,IAAI,CAAC,mDAAmD;AAAA,MAC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c"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/schema/dialog/tabs.ts","../src/schema/dialog/condition.ts","../src/utils/pathToArray.ts","../src/schema/dialog/dialog.ts","../src/schema/multifield/multifield.ts","../src/schema/text/text.ts","../src/schema/checkbox/checkbox.ts","../src/schema/pathbrowser/pathbrowser.ts","../src/schema/image/image.ts","../src/schema/select/select.ts","../src/schema/rte/rte.ts","../src/schema/dynamic/dynamic.ts","../src/schema/calendar/calendar.ts","../src/schema/datasource/datasource.ts","../src/schema/group/group.ts","../src/schema/datamodel/datamodel.ts","../src/schema/navigation/navigation.ts","../src/schema/hidden/hidden.ts","../src/schema/optional/optional.ts","../src/schema/object/object.ts","../src/decorators/webcomponent/webcomponent.ts","../src/utils/pascalToKebab.ts","../src/functions/parse/parse.ts","../src/functions/parse/parsePrimitives.ts","../src/functions/component/component.ts"],"sourcesContent":["export * from \"./schema/dialog\";\n\nexport * from \"./schema/multifield\";\nexport * from \"./schema/text\";\nexport * from \"./schema/checkbox\";\nexport * from \"./schema/pathbrowser\";\nexport * from \"./schema/image\";\nexport * from \"./schema/select\";\nexport * from \"./schema/rte\";\nexport * from \"./schema/dynamic\";\nexport * from \"./schema/calendar\";\nexport * from \"./schema/datasource\";\nexport * from \"./schema/group\";\nexport * from \"./schema/datamodel\";\nexport * from \"./schema/navigation\";\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 { EntryMask } from '../../types';\nimport { Field } from './types';\n\nexport class Tabs<TEntries> {\n private tabs = new Map<string, EntryMask<TEntries>>();\n\n addTab(name: string, entries: EntryMask<TEntries>) {\n this.tabs.set(name, entries);\n }\n\n parse(entries: Field[]) {\n const result = []\n const usedEntries = new Set();\n\n if(this.tabs.size === 0) {\n return entries\n }\n\n for(const [name, mask] of this.tabs) {\n const children = []\n\n if(!mask) {\n throw new Error(`Entry \"${String(name)}\" does not have an appropriate tab configuration.`);\n }\n\n for(const [key,] of Object.entries(mask)) {\n const field = entries.find(f => f.id === key)\n\n if (usedEntries.has(key)) {\n throw new Error(`Entry \"${String(name)}.${String(key)}\" is already used in another tab.`);\n }\n\n if(!field) {\n throw new Error(`Field with id \"${key}\" not found`);\n }\n\n children.push(entries.find(f => f.id === key))\n }\n\n result.push({\n type: 'tab',\n label: name,\n id: `tab_${name.toLowerCase().replaceAll(' ', '')}`,\n children\n })\n }\n\n return [{\n type: 'tabs',\n id: 'tabs',\n children: result\n }]\n }\n}","import { NestedPaths } from '../../types';\nimport { ConditionFn, ConditionOperators, Conditions, Field } from './types';\nimport { ObjectEntries } from '../../types/object';\n\nfunction addConditionToField(fields: Field[], path: string, condition: Conditions): void {\n const keys = path.split('.');\n let currentFields = fields;\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const field = currentFields.find(f => f.id === key);\n\n if (!field) {\n throw new Error(`Field with id \"${key}\" not found`);\n }\n\n if (i === keys.length - 1) {\n field.condition = condition;\n } else {\n if (!field.children) {\n throw new Error(`Field with id \"${key}\" has no children`);\n }\n\n const nextKey = keys[i + 1];\n if(nextKey === '$this') {\n field.condition = condition;\n break;\n }\n currentFields = field.children;\n }\n }\n}\n\nexport class Condition<TEntries extends ObjectEntries> {\n private conditions = new Map<string, Conditions>();\n\n addCondition(field: NestedPaths<TEntries>, condition: ConditionFn<TEntries>) {\n const operators: ConditionOperators<TEntries> = {\n eq: (field, value) => ({ operator: 'eq', field, value }),\n neq: (field, value) => ({ operator: 'neq', field, value }),\n exists: (field) => ({ operator: 'exists', field }),\n and: (...operations) => ({ operator: 'and', value: operations }),\n or: (...operations) => ({ operator: 'or', value: operations })\n };\n\n this.conditions.set(field, condition(operators));\n }\n\n parse(entries: Field[]) {\n for (let [key, value] of this.conditions) {\n addConditionToField(entries, key, value)\n }\n\n return entries;\n }\n}\n","interface PathValue {\n path: string[];\n value: any;\n}\n\nexport function pathToArray(obj: Record<string, any>, parentPath: string[] = []): PathValue[] {\n const result: PathValue[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n const currentPath = [...parentPath, key];\n\n if (typeof value === 'object' && !value.hasOwnProperty('operator') && !Array.isArray(value)) {\n // If the value is an object, recurse into it\n result.push(...pathToArray(value, currentPath));\n } else {\n // If the value is not an object, store the path and value\n result.push({ path: currentPath, value });\n }\n }\n\n return result;\n}","import { BaseSchema, EntryMask, NestedPaths } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\nimport { Tabs } from './tabs';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { Condition } from './condition';\nimport { pathToArray } from '../../utils/pathToArray';\nimport { ConditionsArgument } from './types';\n\nexport interface DialogSchema<TEntries extends ObjectEntries> extends BaseSchema<ObjectOutput<TEntries>> {\n type: 'dialog';\n tabs: (tabs: Record<string, EntryMask<TEntries>>) => DialogSchema<TEntries>;\n conditions: (conditions: ConditionsArgument<TEntries>) => DialogSchema<TEntries>;\n}\n\nclass DialogBuilder<TEntries extends ObjectEntries> implements DialogSchema<TEntries> {\n private conditionsModule: Condition<TEntries>;\n private tabsModule: Tabs<TEntries>;\n private readonly entries: TEntries;\n readonly type = 'dialog';\n\n constructor(entries: TEntries) {\n this.entries = entries;\n this.conditionsModule = new Condition<TEntries>();\n this.tabsModule = new Tabs<TEntries>();\n }\n\n conditions(conditions: ConditionsArgument<TEntries>) {\n const conditionsArray = pathToArray(conditions)\n for (const condition of conditionsArray) {\n this.conditionsModule.addCondition(condition.path.join('.') as NestedPaths<TEntries>, condition.value);\n }\n return this;\n }\n\n tabs(tabs: Record<string, EntryMask<TEntries>>) {\n for (const [key, tab] of Object.entries(tabs)) {\n this.tabsModule.addTab(key as any, tab!);\n }\n return this;\n }\n\n _parse() {\n const dialog = Object.entries(this.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 const dialogWithConditions = this.conditionsModule.parse(dialog);\n const dialogWithTabs = this.tabsModule.parse(dialogWithConditions);\n return {\n dialog: dialogWithTabs\n };\n }\n\n _primitive() {\n const result: Record<string, WebcomponentPropTypes> = {};\n\n for (const [key, entry] of Object.entries(this.entries)) {\n const type = entry._primitive();\n if (typeof type === 'string') {\n result[key] = type;\n }\n }\n\n return result;\n }\n}\n\nexport function dialog<TEntries extends ObjectEntries>(entries: TEntries) {\n return new DialogBuilder(entries)\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, required} = input;\n const childrenParse = children._parse();\n\n return {\n type: 'multifield',\n _parse() {\n return {\n type: 'multifield',\n label,\n required,\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,tooltip, required} = input;\n\n return {\n type: 'textfield',\n _parse() {\n return {\n type: 'textfield',\n label,\n placeholder,\n tooltip,\n required\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 showastoggle?: boolean\n}\n\nexport function checkbox(input: CheckBoxInput): CheckBoxSchema {\n const {label, tooltip, showastoggle = false} = input;\n\n return {\n type: 'checkbox',\n _parse() {\n return {\n type: 'checkbox',\n label,\n tooltip,\n showastoggle\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, tooltip, required} = input;\n\n return {\n type: 'pathbrowser',\n _parse() {\n return {\n type: 'pathbrowser',\n label,\n placeholder,\n tooltip,\n required\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}\n\nexport function image(input: ImageInput): ImageSchema {\n const {label, tooltip, required} = input;\n\n return {\n type: 'image',\n _parse() {\n return {\n type: 'image',\n label,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, BaseSchema } from '../../types';\n\ntype ReadonlyObject<T> = {\n readonly [K in keyof T]: T[K];\n};\n\nexport interface SelectSchema<T, TMultiple extends boolean = false> extends BaseSchema<TMultiple extends true ? T[] : T> {\n /**\n * The schema type.\n */\n type: 'select';\n multiple: TMultiple\n}\n\ninterface SelectInput extends BaseFieldInput {\n placeholder?: string;\n multiple?: boolean;\n values: {\n value: string;\n label: string;\n }[];\n}\n\n\ntype ValuesType<T extends { values: readonly { value: string }[] }> = T['values'][number]['value'];\n\nexport function select<const T extends SelectInput, TMultiple extends boolean= T['multiple'] extends true ? true : false>(input: T): SelectSchema<ValuesType<ReadonlyObject<T>>, TMultiple>{\n const { label, values, tooltip, placeholder, multiple = false, required } = input;\n\n return {\n type: 'select',\n _parse() {\n return {\n type: 'select',\n label,\n multiple,\n values,\n tooltip,\n placeholder,\n required\n };\n },\n _primitive() {\n return multiple ? 'json' : 'string';\n },\n ...input,\n multiple: multiple as TMultiple,\n };\n}\n","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface RichTextEditorSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'richtexteditor';\n}\n\ninterface RichTextEditorInput extends BaseFieldInput {\n placeholder?: string;\n}\n\nexport function rte(input: RichTextEditorInput): RichTextEditorSchema {\n const {placeholder, label, tooltip, required} = input;\n\n return {\n type: 'richtexteditor',\n _parse() {\n return {\n type: 'richtexteditor',\n label,\n placeholder,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import {\n BaseSchema,\n} from '../../types';\n\nexport interface DynamicZoneSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'dynamic';\n}\n\ninterface DynamicInput {\n}\n\nexport function dynamic(input: DynamicInput): DynamicZoneSchema {\n return {\n type: 'dynamic',\n _parse() {\n return {\n type: 'dynamic',\n };\n },\n _primitive() {\n return 'string';\n },\n ...input,\n };\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface CalendarSchema<TOutput extends string = string> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'calendar';\n}\n\ninterface CalendarInput extends BaseFieldInput {\n placeholder?: string;\n valueformat: string;\n displayformat: string;\n headerformat: string;\n startday?: string;\n min?: string;\n max?: string;\n}\n\nexport function calendar(input: CalendarInput): CalendarSchema {\n const {valueformat,startday=0,min,max, placeholder, label,tooltip,required} = input;\n\n return {\n type: 'calendar',\n _parse() {\n return {\n type: 'calendar',\n label,\n valueformat,\n placeholder,\n startday,\n tooltip,\n min,\n max,\n required\n }\n },\n _primitive() {\n return 'string'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\nimport { SelectSchema } from '../select';\ntype DataSourceOutputType<Multiple extends boolean> = Multiple extends true ? string[] : string;\n\nexport interface DataSourceSchema<Multiple extends boolean = false> extends BaseSchema<DataSourceOutputType<Multiple>> {\n /**\n * The schema type.\n */\n type: 'datasource';\n}\n\ninterface DataSourceBody {\n [key: string]: any;\n}\ninterface DataSourceInput extends BaseFieldInput {\n placeholder?: string;\n url: string;\n multiple?: boolean;\n body: DataSourceBody;\n}\n\nexport function datasource<Multiple extends boolean = false>(input: DataSourceInput & { multiple?: Multiple }): DataSourceSchema<Multiple> {\n const {label, body, url, tooltip,placeholder, multiple = false as Multiple, required } = input;\n\n return {\n type: 'datasource',\n _parse() {\n return {\n type: 'datasource',\n label,\n url,\n multiple,\n body,\n tooltip,\n placeholder,\n required,\n }\n },\n _primitive() {\n return multiple ? 'json' : 'string';\n },\n ...input,\n }\n}\n","import {\n BaseFieldInput,\n BaseSchema,\n InferOutput,\n} from '../../types';\n\nexport interface GroupSchema<\n TChildren extends BaseSchema<unknown>,\n> extends BaseSchema<{\n active: boolean;\n} & InferOutput<TChildren>> {\n readonly type: 'group';\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 toggle?: boolean;\n}\n\nexport function group<const TChildren extends BaseSchema<unknown>>(input: MultifieldInput<TChildren>): GroupSchema<TChildren> {\n const { label, children, tooltip, toggle } = input;\n const childrenParse = children._parse();\n\n return {\n type: 'group',\n _parse() {\n return {\n type: 'group',\n label,\n tooltip,\n toggle,\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 DataModelSchema<TOutput extends Record<string, any> = Record<string, any>> extends BaseSchema<TOutput> { /**\n * The schema type.\n */\n type: 'datamodel';\n}\n\ninterface DataModelInput extends BaseFieldInput {\n placeholder?: string;\n}\n\nexport function datamodel(input: DataModelInput): DataModelSchema {\n const {placeholder, label,tooltip, required} = input;\n\n return {\n type: 'datamodel',\n _parse() {\n return {\n type: 'datamodel',\n label,\n placeholder,\n tooltip,\n required\n }\n },\n _primitive() {\n return 'json'\n },\n ...input,\n }\n}","import { BaseFieldInput, type BaseSchema } from '../../types';\n\nexport interface NavigationSchema extends BaseSchema<NavigationItemSchema[]> { /**\n * The schema type.\n */\n type: 'navigation';\n}\n\nexport interface NavigationItemSchema {\n id: string;\n children: NavigationItemSchema[];\n active: boolean;\n url: string;\n title: string;\n}\n\n\ninterface DataModelInput extends BaseFieldInput {\n placeholder?: string;\n showChildrenCheckbox?: boolean;\n showRootLevel?: boolean;\n}\n\nexport function navigation(input: DataModelInput): NavigationSchema {\n const {placeholder, label,tooltip, required, showChildrenCheckbox, showRootLevel} = input;\n\n return {\n type: 'navigation',\n _parse() {\n return {\n type: 'navigation',\n label,\n placeholder,\n tooltip,\n required,\n showChildrenCheckbox,\n showRootLevel,\n }\n },\n _primitive() {\n return 'json'\n },\n ...input,\n }\n}","import { type BaseSchema } from '../../types';\nimport { type WebcomponentPropTypes } from '../../types/webcomponent';\n\nexport interface HiddenSchema extends BaseSchema<string> {\n /**\n * The schema type.\n */\n type: 'hidden';\n}\n\ninterface HiddenInput {\n type: WebcomponentPropTypes\n}\n\n/**\n * Creates a hidden schema.\n *\n * @param input The type of input for the webcomponent binding.\n *\n * @returns A hidden schema.\n */\nexport function hidden(input: HiddenInput): HiddenSchema {\n const {type} = input;\n\n return {\n type: 'hidden',\n _parse() {\n //Explicitly hidding this input from the parse final result.\n return this;\n },\n _primitive() {\n return type\n },\n }\n}","import { BaseSchema, Output } from '../../types';\n\n/**\n * Optional schema type.\n */\nexport interface OptionalSchema<\n TWrapped extends BaseSchema,\n TOutput = Output<TWrapped> | undefined\n> extends BaseSchema<TOutput> {\n /**\n * The schema type.\n */\n type: 'optional';\n /**\n * The wrapped schema.\n */\n wrapped: TWrapped;\n}\n\n\n/**\n * Creates an optional schema.\n *\n * @param wrapped The wrapped schema.\n *\n * @returns A optional schema.\n */\nexport function optional<TWrapped extends BaseSchema>(\n wrapped: TWrapped\n): OptionalSchema<TWrapped> {\n return {\n type: 'optional',\n wrapped,\n _primitive() {\n return this.wrapped._primitive();\n },\n _parse() {\n return this.wrapped._parse();\n },\n };\n}","import type { BaseSchema } from '../../types';\nimport { ObjectEntries, ObjectOutput } from '../../types/object';\n\nexport interface ObjectSchema<TEntries extends ObjectEntries, TOutput = ObjectOutput<TEntries>> extends BaseSchema<TOutput> {\n type: 'object';\n}\n\nexport function object<TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries> {\n return {\n type: 'object',\n _parse() {\n return Object.entries(entries)\n .map(([key, entry]) => ({\n id: key,\n name: key,\n ...entry._parse()\n }))\n .filter((entry: object) => {\n if('type' in entry){\n return entry.type !== 'hidden'\n }\n })\n },\n _primitive() {\n return 'json'\n }\n };\n}","import type React from 'react';\nimport r2wc from '@r2wc/react-to-web-component';\nimport { DialogSchema } from '../../schema/dialog';\nimport { pascalToKebab } from '../../utils/pascalToKebab';\nimport { parsePrimitives } from '../../functions';\nimport { WebcomponentPropTypes } from '../../types/webcomponent';\nimport { ObjectEntries } from '../../types/object';\n\ntype BaseOptions = {}\n\nexport function webcomponent<T extends ObjectEntries>(schema?: DialogSchema<T>, options?: BaseOptions) {\n const props: Record<string, WebcomponentPropTypes> | undefined = schema ? {\n ...parsePrimitives(schema),\n } : undefined;\n\n return <P extends {} = {}>(component: React.ComponentType<P>) => {\n const name = pascalToKebab(component.displayName!);\n\n class StyledWebComponent extends r2wc(component, {\n shadow: 'open',\n props,\n }) {\n connectedCallback() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n super.connectedCallback();\n queueMicrotask(() => {\n\n const cssUrlsAttr = this.getAttribute('data-css-urls');\n if (cssUrlsAttr) {\n const cssUrlsArray: string[] = JSON.parse(cssUrlsAttr.replace(/'/g, '\"'));\n const slotTemplate = document.createElement('template');\n const getImportsFromUrlsArray = (urls: string[]) => urls.map((url) => `<link rel=\"preload\" as=\"style\" onload=\"this.rel='stylesheet'\" type=\"text/css\" href=\"${url}\">`).join('\\n');\n slotTemplate.innerHTML = `<style>\n ::slotted(*) {\n display: block !important;\n }\n </style>\n ${getImportsFromUrlsArray(cssUrlsArray)}\n`;\n this.shadowRoot?.appendChild(slotTemplate.content.cloneNode(true));\n }\n });\n }\n }\n\n\n if (!window.customElements.get(name)) {\n customElements.define(\n name, StyledWebComponent,\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> extends BaseSchema<ObjectOutput<TEntries>>, Partial<ComponentModel> {\n type: 'component';\n dialog: DialogSchema<TEntries>;\n}\n\nexport function component<TEntries extends ObjectEntries>(\n config: Partial<ComponentModel>,\n dialog: DialogSchema<TEntries>,\n): ComponentSchema<TEntries> {\n\n return {\n type: 'component',\n dialog,\n _parse() {\n return {\n ...config,\n ...dialog._parse(),\n };\n },\n _primitive() {\n return {\n ...dialog._primitive() as object,\n };\n },\n ...config,\n };\n}"],"mappings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C/D,UAAM,OAAO,cAAcA,WAAU,WAAY;AAAA,IAEjD,MAAM,+BAA2B,8BAAAC,SAAKD,YAAW;AAAA,MAC/C,QAAQ;AAAA,MACR;AAAA,IACF,CAAC,EAAE;AAAA,MACD,oBAAoB;AAGlB,cAAM,kBAAkB;AACxB,uBAAe,MAAM;AAEnB,gBAAM,cAAc,KAAK,aAAa,eAAe;AACrD,cAAI,aAAa;AACf,kBAAM,eAAyB,KAAK,MAAM,YAAY,QAAQ,MAAM,GAAG,CAAC;AACxE,kBAAM,eAAe,SAAS,cAAc,UAAU;AACtD,kBAAM,0BAA0B,CAAC,SAAmB,KAAK,IAAI,CAAC,QAAQ,uFAAuF,GAAG,IAAI,EAAE,KAAK,IAAI;AAC/K,yBAAa,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKnB,wBAAwB,YAAY,CAAC;AAAA;AAE3C,iBAAK,YAAY,YAAY,aAAa,QAAQ,UAAU,IAAI,CAAC;AAAA,UACnE;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAGA,QAAI,CAAC,OAAO,eAAe,IAAI,IAAI,GAAG;AACpC,qBAAe;AAAA,QACb;AAAA,QAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;","names":["field","dialog","dialog","component","r2wc"]}
|
package/dist/index.mjs
CHANGED
|
@@ -509,32 +509,19 @@ function parsePrimitives(schema) {
|
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
// src/functions/component/component.ts
|
|
512
|
-
function component(config, dialog2
|
|
513
|
-
const slotsParse = slots ? Object.entries(slots).map(
|
|
514
|
-
([key, slot]) => ({
|
|
515
|
-
id: key,
|
|
516
|
-
name: key,
|
|
517
|
-
...slot._parse()
|
|
518
|
-
})
|
|
519
|
-
) : [];
|
|
520
|
-
const slotsPrimitives = slots ? Object.entries(slots).reduce((acc, [key, slot]) => {
|
|
521
|
-
acc[key] = slot._primitive();
|
|
522
|
-
return acc;
|
|
523
|
-
}, {}) : [];
|
|
512
|
+
function component(config, dialog2) {
|
|
524
513
|
return {
|
|
525
514
|
type: "component",
|
|
526
515
|
dialog: dialog2,
|
|
527
516
|
_parse() {
|
|
528
517
|
return {
|
|
529
518
|
...config,
|
|
530
|
-
...dialog2._parse()
|
|
531
|
-
dynamiczones: slotsParse
|
|
519
|
+
...dialog2._parse()
|
|
532
520
|
};
|
|
533
521
|
},
|
|
534
522
|
_primitive() {
|
|
535
523
|
return {
|
|
536
|
-
...dialog2._primitive()
|
|
537
|
-
...slotsPrimitives
|
|
524
|
+
...dialog2._primitive()
|
|
538
525
|
};
|
|
539
526
|
},
|
|
540
527
|
...config
|
|
@@ -548,13 +535,34 @@ function webcomponent(schema, options) {
|
|
|
548
535
|
} : void 0;
|
|
549
536
|
return (component2) => {
|
|
550
537
|
const name = pascalToKebab(component2.displayName);
|
|
538
|
+
class StyledWebComponent extends r2wc(component2, {
|
|
539
|
+
shadow: "open",
|
|
540
|
+
props
|
|
541
|
+
}) {
|
|
542
|
+
connectedCallback() {
|
|
543
|
+
super.connectedCallback();
|
|
544
|
+
queueMicrotask(() => {
|
|
545
|
+
const cssUrlsAttr = this.getAttribute("data-css-urls");
|
|
546
|
+
if (cssUrlsAttr) {
|
|
547
|
+
const cssUrlsArray = JSON.parse(cssUrlsAttr.replace(/'/g, '"'));
|
|
548
|
+
const slotTemplate = document.createElement("template");
|
|
549
|
+
const getImportsFromUrlsArray = (urls) => urls.map((url) => `<link rel="preload" as="style" onload="this.rel='stylesheet'" type="text/css" href="${url}">`).join("\n");
|
|
550
|
+
slotTemplate.innerHTML = `<style>
|
|
551
|
+
::slotted(*) {
|
|
552
|
+
display: block !important;
|
|
553
|
+
}
|
|
554
|
+
</style>
|
|
555
|
+
${getImportsFromUrlsArray(cssUrlsArray)}
|
|
556
|
+
`;
|
|
557
|
+
this.shadowRoot?.appendChild(slotTemplate.content.cloneNode(true));
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
551
562
|
if (!window.customElements.get(name)) {
|
|
552
563
|
customElements.define(
|
|
553
564
|
name,
|
|
554
|
-
|
|
555
|
-
shadow: "open",
|
|
556
|
-
props
|
|
557
|
-
})
|
|
565
|
+
StyledWebComponent
|
|
558
566
|
);
|
|
559
567
|
}
|
|
560
568
|
};
|