@ethereal-nexus/core 0.1.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/LICENSE +201 -0
- package/dist/decorators/index.d.mts +8 -0
- package/dist/decorators/index.d.ts +8 -0
- package/dist/decorators/index.js +71 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/index.mjs +34 -0
- package/dist/decorators/index.mjs.map +1 -0
- package/dist/decorators/webcomponent/index.d.mts +8 -0
- package/dist/decorators/webcomponent/index.d.ts +8 -0
- package/dist/decorators/webcomponent/index.js +71 -0
- package/dist/decorators/webcomponent/index.js.map +1 -0
- package/dist/decorators/webcomponent/index.mjs +34 -0
- package/dist/decorators/webcomponent/index.mjs.map +1 -0
- package/dist/decorators/webcomponent/webcomponent.d.mts +12 -0
- package/dist/decorators/webcomponent/webcomponent.d.ts +12 -0
- package/dist/decorators/webcomponent/webcomponent.js +69 -0
- package/dist/decorators/webcomponent/webcomponent.js.map +1 -0
- package/dist/decorators/webcomponent/webcomponent.mjs +34 -0
- package/dist/decorators/webcomponent/webcomponent.mjs.map +1 -0
- package/dist/functions/index.d.mts +8 -0
- package/dist/functions/index.d.ts +8 -0
- package/dist/functions/index.js +44 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/index.mjs +16 -0
- package/dist/functions/index.mjs.map +1 -0
- package/dist/functions/parse/index.d.mts +8 -0
- package/dist/functions/parse/index.d.ts +8 -0
- package/dist/functions/parse/index.js +44 -0
- package/dist/functions/parse/index.js.map +1 -0
- package/dist/functions/parse/index.mjs +16 -0
- package/dist/functions/parse/index.mjs.map +1 -0
- package/dist/functions/parse/parse.d.mts +12 -0
- package/dist/functions/parse/parse.d.ts +12 -0
- package/dist/functions/parse/parse.js +35 -0
- package/dist/functions/parse/parse.js.map +1 -0
- package/dist/functions/parse/parse.mjs +10 -0
- package/dist/functions/parse/parse.mjs.map +1 -0
- package/dist/functions/parse/parsePrimitives.d.mts +10 -0
- package/dist/functions/parse/parsePrimitives.d.ts +10 -0
- package/dist/functions/parse/parsePrimitives.js +33 -0
- package/dist/functions/parse/parsePrimitives.js.map +1 -0
- package/dist/functions/parse/parsePrimitives.mjs +8 -0
- package/dist/functions/parse/parsePrimitives.mjs.map +1 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +329 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +280 -0
- package/dist/index.mjs.map +1 -0
- package/dist/schema/checkbox/checkbox.d.mts +14 -0
- package/dist/schema/checkbox/checkbox.d.ts +14 -0
- package/dist/schema/checkbox/checkbox.js +46 -0
- package/dist/schema/checkbox/checkbox.js.map +1 -0
- package/dist/schema/checkbox/checkbox.mjs +21 -0
- package/dist/schema/checkbox/checkbox.mjs.map +1 -0
- package/dist/schema/checkbox/index.d.mts +3 -0
- package/dist/schema/checkbox/index.d.ts +3 -0
- package/dist/schema/checkbox/index.js +48 -0
- package/dist/schema/checkbox/index.js.map +1 -0
- package/dist/schema/checkbox/index.mjs +21 -0
- package/dist/schema/checkbox/index.mjs.map +1 -0
- package/dist/schema/dialog/dialog.d.mts +13 -0
- package/dist/schema/dialog/dialog.d.ts +13 -0
- package/dist/schema/dialog/dialog.js +92 -0
- package/dist/schema/dialog/dialog.js.map +1 -0
- package/dist/schema/dialog/dialog.mjs +67 -0
- package/dist/schema/dialog/dialog.mjs.map +1 -0
- package/dist/schema/dialog/index.d.mts +6 -0
- package/dist/schema/dialog/index.d.ts +6 -0
- package/dist/schema/dialog/index.js +94 -0
- package/dist/schema/dialog/index.js.map +1 -0
- package/dist/schema/dialog/index.mjs +67 -0
- package/dist/schema/dialog/index.mjs.map +1 -0
- package/dist/schema/hidden/hidden.d.mts +22 -0
- package/dist/schema/hidden/hidden.d.ts +22 -0
- package/dist/schema/hidden/hidden.js +42 -0
- package/dist/schema/hidden/hidden.js.map +1 -0
- package/dist/schema/hidden/hidden.mjs +17 -0
- package/dist/schema/hidden/hidden.mjs.map +1 -0
- package/dist/schema/hidden/index.d.mts +3 -0
- package/dist/schema/hidden/index.d.ts +3 -0
- package/dist/schema/hidden/index.js +44 -0
- package/dist/schema/hidden/index.js.map +1 -0
- package/dist/schema/hidden/index.mjs +17 -0
- package/dist/schema/hidden/index.mjs.map +1 -0
- package/dist/schema/image/image.d.mts +15 -0
- package/dist/schema/image/image.d.ts +15 -0
- package/dist/schema/image/image.js +47 -0
- package/dist/schema/image/image.js.map +1 -0
- package/dist/schema/image/image.mjs +22 -0
- package/dist/schema/image/image.mjs.map +1 -0
- package/dist/schema/image/index.d.mts +3 -0
- package/dist/schema/image/index.d.ts +3 -0
- package/dist/schema/image/index.js +49 -0
- package/dist/schema/image/index.js.map +1 -0
- package/dist/schema/image/index.mjs +22 -0
- package/dist/schema/image/index.mjs.map +1 -0
- package/dist/schema/multifield/index.d.mts +4 -0
- package/dist/schema/multifield/index.d.ts +4 -0
- package/dist/schema/multifield/index.js +50 -0
- package/dist/schema/multifield/index.js.map +1 -0
- package/dist/schema/multifield/index.mjs +23 -0
- package/dist/schema/multifield/index.mjs.map +1 -0
- package/dist/schema/multifield/multifield.d.mts +17 -0
- package/dist/schema/multifield/multifield.d.ts +17 -0
- package/dist/schema/multifield/multifield.js +48 -0
- package/dist/schema/multifield/multifield.js.map +1 -0
- package/dist/schema/multifield/multifield.mjs +23 -0
- package/dist/schema/multifield/multifield.mjs.map +1 -0
- package/dist/schema/object/index.d.mts +6 -0
- package/dist/schema/object/index.d.ts +6 -0
- package/dist/schema/object/index.js +51 -0
- package/dist/schema/object/index.js.map +1 -0
- package/dist/schema/object/index.mjs +24 -0
- package/dist/schema/object/index.mjs.map +1 -0
- package/dist/schema/object/object.d.mts +12 -0
- package/dist/schema/object/object.d.ts +12 -0
- package/dist/schema/object/object.js +49 -0
- package/dist/schema/object/object.js.map +1 -0
- package/dist/schema/object/object.mjs +24 -0
- package/dist/schema/object/object.mjs.map +1 -0
- package/dist/schema/optional/index.d.mts +3 -0
- package/dist/schema/optional/index.d.ts +3 -0
- package/dist/schema/optional/index.js +44 -0
- package/dist/schema/optional/index.js.map +1 -0
- package/dist/schema/optional/index.mjs +17 -0
- package/dist/schema/optional/index.mjs.map +1 -0
- package/dist/schema/optional/optional.d.mts +26 -0
- package/dist/schema/optional/optional.d.ts +26 -0
- package/dist/schema/optional/optional.js +42 -0
- package/dist/schema/optional/optional.js.map +1 -0
- package/dist/schema/optional/optional.mjs +17 -0
- package/dist/schema/optional/optional.mjs.map +1 -0
- package/dist/schema/pathbrowser/index.d.mts +3 -0
- package/dist/schema/pathbrowser/index.d.ts +3 -0
- package/dist/schema/pathbrowser/index.js +49 -0
- package/dist/schema/pathbrowser/index.js.map +1 -0
- package/dist/schema/pathbrowser/index.mjs +22 -0
- package/dist/schema/pathbrowser/index.mjs.map +1 -0
- package/dist/schema/pathbrowser/pathbrowser.d.mts +15 -0
- package/dist/schema/pathbrowser/pathbrowser.d.ts +15 -0
- package/dist/schema/pathbrowser/pathbrowser.js +47 -0
- package/dist/schema/pathbrowser/pathbrowser.js.map +1 -0
- package/dist/schema/pathbrowser/pathbrowser.mjs +22 -0
- package/dist/schema/pathbrowser/pathbrowser.mjs.map +1 -0
- package/dist/schema/select/index.d.mts +3 -0
- package/dist/schema/select/index.d.ts +3 -0
- package/dist/schema/select/index.js +49 -0
- package/dist/schema/select/index.js.map +1 -0
- package/dist/schema/select/index.mjs +22 -0
- package/dist/schema/select/index.mjs.map +1 -0
- package/dist/schema/select/select.d.mts +18 -0
- package/dist/schema/select/select.d.ts +18 -0
- package/dist/schema/select/select.js +47 -0
- package/dist/schema/select/select.js.map +1 -0
- package/dist/schema/select/select.mjs +22 -0
- package/dist/schema/select/select.mjs.map +1 -0
- package/dist/schema/text/index.d.mts +3 -0
- package/dist/schema/text/index.d.ts +3 -0
- package/dist/schema/text/index.js +49 -0
- package/dist/schema/text/index.js.map +1 -0
- package/dist/schema/text/index.mjs +22 -0
- package/dist/schema/text/index.mjs.map +1 -0
- package/dist/schema/text/text.d.mts +15 -0
- package/dist/schema/text/text.d.ts +15 -0
- package/dist/schema/text/text.js +47 -0
- package/dist/schema/text/text.js.map +1 -0
- package/dist/schema/text/text.mjs +22 -0
- package/dist/schema/text/text.mjs.map +1 -0
- package/dist/types/index.d.mts +5 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/infer.d.mts +9 -0
- package/dist/types/infer.d.ts +9 -0
- package/dist/types/infer.js +19 -0
- package/dist/types/infer.js.map +1 -0
- package/dist/types/infer.mjs +1 -0
- package/dist/types/infer.mjs.map +1 -0
- package/dist/types/object.d.mts +39 -0
- package/dist/types/object.d.ts +39 -0
- package/dist/types/object.js +19 -0
- package/dist/types/object.js.map +1 -0
- package/dist/types/object.mjs +1 -0
- package/dist/types/object.mjs.map +1 -0
- package/dist/types/props.d.mts +13 -0
- package/dist/types/props.d.ts +13 -0
- package/dist/types/props.js +19 -0
- package/dist/types/props.js.map +1 -0
- package/dist/types/props.mjs +1 -0
- package/dist/types/props.mjs.map +1 -0
- package/dist/types/schema.d.mts +42 -0
- package/dist/types/schema.d.ts +42 -0
- package/dist/types/schema.js +19 -0
- package/dist/types/schema.js.map +1 -0
- package/dist/types/schema.mjs +1 -0
- package/dist/types/schema.mjs.map +1 -0
- package/dist/types/utils.d.mts +32 -0
- package/dist/types/utils.d.ts +32 -0
- package/dist/types/utils.js +19 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types/utils.mjs +1 -0
- package/dist/types/utils.mjs.map +1 -0
- package/dist/types/webcomponent.d.mts +7 -0
- package/dist/types/webcomponent.d.ts +7 -0
- package/dist/types/webcomponent.js +19 -0
- package/dist/types/webcomponent.js.map +1 -0
- package/dist/types/webcomponent.mjs +1 -0
- package/dist/types/webcomponent.mjs.map +1 -0
- package/dist/utils/pascalToKebab.d.mts +3 -0
- package/dist/utils/pascalToKebab.d.ts +3 -0
- package/dist/utils/pascalToKebab.js +33 -0
- package/dist/utils/pascalToKebab.js.map +1 -0
- package/dist/utils/pascalToKebab.mjs +8 -0
- package/dist/utils/pascalToKebab.mjs.map +1 -0
- package/package.json +37 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
checkbox: () => checkbox,
|
|
34
|
+
dialog: () => dialog,
|
|
35
|
+
hidden: () => hidden,
|
|
36
|
+
image: () => image,
|
|
37
|
+
multifield: () => multifield,
|
|
38
|
+
object: () => object,
|
|
39
|
+
optional: () => optional,
|
|
40
|
+
parse: () => parse,
|
|
41
|
+
parsePrimitives: () => parsePrimitives,
|
|
42
|
+
pathbrowser: () => pathbrowser,
|
|
43
|
+
select: () => select,
|
|
44
|
+
text: () => text,
|
|
45
|
+
webcomponent: () => webcomponent
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
48
|
+
|
|
49
|
+
// src/schema/dialog/dialog.ts
|
|
50
|
+
function dialog(entries) {
|
|
51
|
+
return {
|
|
52
|
+
type: "dialog",
|
|
53
|
+
tabs(tabs) {
|
|
54
|
+
return {
|
|
55
|
+
...this,
|
|
56
|
+
tabs: void 0,
|
|
57
|
+
_parse() {
|
|
58
|
+
const usedEntries = /* @__PURE__ */ new Set();
|
|
59
|
+
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
60
|
+
const children = Object.entries(value).map(([key, value2]) => {
|
|
61
|
+
if (value2 === true) {
|
|
62
|
+
if (usedEntries.has(key)) {
|
|
63
|
+
throw new Error(`Entry "${String(tabKey)}.${String(key)}" is already used in another tab.`);
|
|
64
|
+
}
|
|
65
|
+
usedEntries.add(key);
|
|
66
|
+
return {
|
|
67
|
+
id: key,
|
|
68
|
+
...entries[key]._parse()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
type: "tab",
|
|
74
|
+
label: tabKey,
|
|
75
|
+
id: `tab_${tabKey.toLowerCase().replaceAll(" ", "")}`,
|
|
76
|
+
children
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
type: "tabs",
|
|
81
|
+
id: "tabs",
|
|
82
|
+
children: tabsArray
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
_parse() {
|
|
88
|
+
return Object.entries(entries).map(([key, entry]) => ({
|
|
89
|
+
id: key,
|
|
90
|
+
name: key,
|
|
91
|
+
...entry._parse()
|
|
92
|
+
})).filter((entry) => {
|
|
93
|
+
if ("type" in entry) {
|
|
94
|
+
return entry.type !== "hidden";
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
_primitive() {
|
|
99
|
+
return Object.entries(entries).reduce(
|
|
100
|
+
(acc, [key, entry]) => {
|
|
101
|
+
const type = entry._primitive();
|
|
102
|
+
if (typeof type === "string") {
|
|
103
|
+
acc[key] = type;
|
|
104
|
+
}
|
|
105
|
+
return acc;
|
|
106
|
+
},
|
|
107
|
+
{}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/schema/multifield/multifield.ts
|
|
114
|
+
function multifield(input) {
|
|
115
|
+
const { label, children } = input;
|
|
116
|
+
const childrenParse = children._parse();
|
|
117
|
+
return {
|
|
118
|
+
type: "multifield",
|
|
119
|
+
_parse() {
|
|
120
|
+
return {
|
|
121
|
+
type: "multifield",
|
|
122
|
+
label,
|
|
123
|
+
children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
_primitive() {
|
|
127
|
+
return "json";
|
|
128
|
+
},
|
|
129
|
+
...input
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/schema/text/text.ts
|
|
134
|
+
function text(input) {
|
|
135
|
+
const { placeholder, label } = input;
|
|
136
|
+
return {
|
|
137
|
+
type: "textfield",
|
|
138
|
+
_parse() {
|
|
139
|
+
return {
|
|
140
|
+
type: "textfield",
|
|
141
|
+
label,
|
|
142
|
+
placeholder
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
_primitive() {
|
|
146
|
+
return "string";
|
|
147
|
+
},
|
|
148
|
+
...input
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/schema/checkbox/checkbox.ts
|
|
153
|
+
function checkbox(input) {
|
|
154
|
+
const { label } = input;
|
|
155
|
+
return {
|
|
156
|
+
type: "checkbox",
|
|
157
|
+
_parse() {
|
|
158
|
+
return {
|
|
159
|
+
type: "checkbox",
|
|
160
|
+
label
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
_primitive() {
|
|
164
|
+
return "boolean";
|
|
165
|
+
},
|
|
166
|
+
...input
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/schema/pathbrowser/pathbrowser.ts
|
|
171
|
+
function pathbrowser(input) {
|
|
172
|
+
const { placeholder, label } = input;
|
|
173
|
+
return {
|
|
174
|
+
type: "pathbrowser",
|
|
175
|
+
_parse() {
|
|
176
|
+
return {
|
|
177
|
+
type: "pathbrowser",
|
|
178
|
+
label,
|
|
179
|
+
placeholder
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
_primitive() {
|
|
183
|
+
return "string";
|
|
184
|
+
},
|
|
185
|
+
...input
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/schema/image/image.ts
|
|
190
|
+
function image(input) {
|
|
191
|
+
const { placeholder, label } = input;
|
|
192
|
+
return {
|
|
193
|
+
type: "image",
|
|
194
|
+
_parse() {
|
|
195
|
+
return {
|
|
196
|
+
type: "image",
|
|
197
|
+
label,
|
|
198
|
+
placeholder
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
_primitive() {
|
|
202
|
+
return "string";
|
|
203
|
+
},
|
|
204
|
+
...input
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/schema/select/select.ts
|
|
209
|
+
function select(input) {
|
|
210
|
+
const { label, values } = input;
|
|
211
|
+
return {
|
|
212
|
+
type: "select",
|
|
213
|
+
_parse() {
|
|
214
|
+
return {
|
|
215
|
+
type: "select",
|
|
216
|
+
label,
|
|
217
|
+
values
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
_primitive() {
|
|
221
|
+
return "string";
|
|
222
|
+
},
|
|
223
|
+
...input
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/schema/hidden/hidden.ts
|
|
228
|
+
function hidden(input) {
|
|
229
|
+
const { type } = input;
|
|
230
|
+
return {
|
|
231
|
+
type: "hidden",
|
|
232
|
+
_parse() {
|
|
233
|
+
return this;
|
|
234
|
+
},
|
|
235
|
+
_primitive() {
|
|
236
|
+
return type;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/schema/optional/optional.ts
|
|
242
|
+
function optional(wrapped) {
|
|
243
|
+
return {
|
|
244
|
+
type: "optional",
|
|
245
|
+
wrapped,
|
|
246
|
+
_primitive() {
|
|
247
|
+
return this.wrapped._primitive();
|
|
248
|
+
},
|
|
249
|
+
_parse() {
|
|
250
|
+
return this.wrapped._parse();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/schema/object/object.ts
|
|
256
|
+
function object(entries) {
|
|
257
|
+
return {
|
|
258
|
+
type: "object",
|
|
259
|
+
_parse() {
|
|
260
|
+
return Object.entries(entries).map(([key, entry]) => ({
|
|
261
|
+
id: key,
|
|
262
|
+
name: key,
|
|
263
|
+
...entry._parse()
|
|
264
|
+
})).filter((entry) => {
|
|
265
|
+
if ("type" in entry) {
|
|
266
|
+
return entry.type !== "hidden";
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
_primitive() {
|
|
271
|
+
return "json";
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/decorators/webcomponent/webcomponent.ts
|
|
277
|
+
var import_react_to_web_component = __toESM(require("@r2wc/react-to-web-component"));
|
|
278
|
+
|
|
279
|
+
// src/utils/pascalToKebab.ts
|
|
280
|
+
function pascalToKebab(pascalCaseString) {
|
|
281
|
+
return pascalCaseString.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/functions/parse/parse.ts
|
|
285
|
+
function parse(schema) {
|
|
286
|
+
return {
|
|
287
|
+
dialog: schema._parse()
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// src/functions/parse/parsePrimitives.ts
|
|
292
|
+
function parsePrimitives(schema) {
|
|
293
|
+
return schema._primitive();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/decorators/webcomponent/webcomponent.ts
|
|
297
|
+
function webcomponent(schema, options) {
|
|
298
|
+
const props = {
|
|
299
|
+
...parsePrimitives(schema)
|
|
300
|
+
};
|
|
301
|
+
return (component) => {
|
|
302
|
+
const name = pascalToKebab(component.displayName);
|
|
303
|
+
if (!window.customElements.get(name)) {
|
|
304
|
+
customElements.define(
|
|
305
|
+
name,
|
|
306
|
+
(0, import_react_to_web_component.default)(component, {
|
|
307
|
+
props
|
|
308
|
+
})
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
314
|
+
0 && (module.exports = {
|
|
315
|
+
checkbox,
|
|
316
|
+
dialog,
|
|
317
|
+
hidden,
|
|
318
|
+
image,
|
|
319
|
+
multifield,
|
|
320
|
+
object,
|
|
321
|
+
optional,
|
|
322
|
+
parse,
|
|
323
|
+
parsePrimitives,
|
|
324
|
+
pathbrowser,
|
|
325
|
+
select,
|
|
326
|
+
text,
|
|
327
|
+
webcomponent
|
|
328
|
+
});
|
|
329
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,wBAA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AS,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,YACA,8BAAAC,SAAK,WAAW;AAAA,UACd;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;","names":["value","r2wc"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// src/schema/dialog/dialog.ts
|
|
2
|
+
function dialog(entries) {
|
|
3
|
+
return {
|
|
4
|
+
type: "dialog",
|
|
5
|
+
tabs(tabs) {
|
|
6
|
+
return {
|
|
7
|
+
...this,
|
|
8
|
+
tabs: void 0,
|
|
9
|
+
_parse() {
|
|
10
|
+
const usedEntries = /* @__PURE__ */ new Set();
|
|
11
|
+
const tabsArray = Object.entries(tabs).map(([tabKey, value]) => {
|
|
12
|
+
const children = Object.entries(value).map(([key, value2]) => {
|
|
13
|
+
if (value2 === true) {
|
|
14
|
+
if (usedEntries.has(key)) {
|
|
15
|
+
throw new Error(`Entry "${String(tabKey)}.${String(key)}" is already used in another tab.`);
|
|
16
|
+
}
|
|
17
|
+
usedEntries.add(key);
|
|
18
|
+
return {
|
|
19
|
+
id: key,
|
|
20
|
+
...entries[key]._parse()
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
type: "tab",
|
|
26
|
+
label: tabKey,
|
|
27
|
+
id: `tab_${tabKey.toLowerCase().replaceAll(" ", "")}`,
|
|
28
|
+
children
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
type: "tabs",
|
|
33
|
+
id: "tabs",
|
|
34
|
+
children: tabsArray
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
_parse() {
|
|
40
|
+
return Object.entries(entries).map(([key, entry]) => ({
|
|
41
|
+
id: key,
|
|
42
|
+
name: key,
|
|
43
|
+
...entry._parse()
|
|
44
|
+
})).filter((entry) => {
|
|
45
|
+
if ("type" in entry) {
|
|
46
|
+
return entry.type !== "hidden";
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
_primitive() {
|
|
51
|
+
return Object.entries(entries).reduce(
|
|
52
|
+
(acc, [key, entry]) => {
|
|
53
|
+
const type = entry._primitive();
|
|
54
|
+
if (typeof type === "string") {
|
|
55
|
+
acc[key] = type;
|
|
56
|
+
}
|
|
57
|
+
return acc;
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/schema/multifield/multifield.ts
|
|
66
|
+
function multifield(input) {
|
|
67
|
+
const { label, children } = input;
|
|
68
|
+
const childrenParse = children._parse();
|
|
69
|
+
return {
|
|
70
|
+
type: "multifield",
|
|
71
|
+
_parse() {
|
|
72
|
+
return {
|
|
73
|
+
type: "multifield",
|
|
74
|
+
label,
|
|
75
|
+
children: Array.isArray(childrenParse) ? childrenParse : [childrenParse]
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
_primitive() {
|
|
79
|
+
return "json";
|
|
80
|
+
},
|
|
81
|
+
...input
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/schema/text/text.ts
|
|
86
|
+
function text(input) {
|
|
87
|
+
const { placeholder, label } = input;
|
|
88
|
+
return {
|
|
89
|
+
type: "textfield",
|
|
90
|
+
_parse() {
|
|
91
|
+
return {
|
|
92
|
+
type: "textfield",
|
|
93
|
+
label,
|
|
94
|
+
placeholder
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
_primitive() {
|
|
98
|
+
return "string";
|
|
99
|
+
},
|
|
100
|
+
...input
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/schema/checkbox/checkbox.ts
|
|
105
|
+
function checkbox(input) {
|
|
106
|
+
const { label } = input;
|
|
107
|
+
return {
|
|
108
|
+
type: "checkbox",
|
|
109
|
+
_parse() {
|
|
110
|
+
return {
|
|
111
|
+
type: "checkbox",
|
|
112
|
+
label
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
_primitive() {
|
|
116
|
+
return "boolean";
|
|
117
|
+
},
|
|
118
|
+
...input
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/schema/pathbrowser/pathbrowser.ts
|
|
123
|
+
function pathbrowser(input) {
|
|
124
|
+
const { placeholder, label } = input;
|
|
125
|
+
return {
|
|
126
|
+
type: "pathbrowser",
|
|
127
|
+
_parse() {
|
|
128
|
+
return {
|
|
129
|
+
type: "pathbrowser",
|
|
130
|
+
label,
|
|
131
|
+
placeholder
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
_primitive() {
|
|
135
|
+
return "string";
|
|
136
|
+
},
|
|
137
|
+
...input
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/schema/image/image.ts
|
|
142
|
+
function image(input) {
|
|
143
|
+
const { placeholder, label } = input;
|
|
144
|
+
return {
|
|
145
|
+
type: "image",
|
|
146
|
+
_parse() {
|
|
147
|
+
return {
|
|
148
|
+
type: "image",
|
|
149
|
+
label,
|
|
150
|
+
placeholder
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
_primitive() {
|
|
154
|
+
return "string";
|
|
155
|
+
},
|
|
156
|
+
...input
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/schema/select/select.ts
|
|
161
|
+
function select(input) {
|
|
162
|
+
const { label, values } = input;
|
|
163
|
+
return {
|
|
164
|
+
type: "select",
|
|
165
|
+
_parse() {
|
|
166
|
+
return {
|
|
167
|
+
type: "select",
|
|
168
|
+
label,
|
|
169
|
+
values
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
_primitive() {
|
|
173
|
+
return "string";
|
|
174
|
+
},
|
|
175
|
+
...input
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/schema/hidden/hidden.ts
|
|
180
|
+
function hidden(input) {
|
|
181
|
+
const { type } = input;
|
|
182
|
+
return {
|
|
183
|
+
type: "hidden",
|
|
184
|
+
_parse() {
|
|
185
|
+
return this;
|
|
186
|
+
},
|
|
187
|
+
_primitive() {
|
|
188
|
+
return type;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/schema/optional/optional.ts
|
|
194
|
+
function optional(wrapped) {
|
|
195
|
+
return {
|
|
196
|
+
type: "optional",
|
|
197
|
+
wrapped,
|
|
198
|
+
_primitive() {
|
|
199
|
+
return this.wrapped._primitive();
|
|
200
|
+
},
|
|
201
|
+
_parse() {
|
|
202
|
+
return this.wrapped._parse();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/schema/object/object.ts
|
|
208
|
+
function object(entries) {
|
|
209
|
+
return {
|
|
210
|
+
type: "object",
|
|
211
|
+
_parse() {
|
|
212
|
+
return Object.entries(entries).map(([key, entry]) => ({
|
|
213
|
+
id: key,
|
|
214
|
+
name: key,
|
|
215
|
+
...entry._parse()
|
|
216
|
+
})).filter((entry) => {
|
|
217
|
+
if ("type" in entry) {
|
|
218
|
+
return entry.type !== "hidden";
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
_primitive() {
|
|
223
|
+
return "json";
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/decorators/webcomponent/webcomponent.ts
|
|
229
|
+
import r2wc from "@r2wc/react-to-web-component";
|
|
230
|
+
|
|
231
|
+
// src/utils/pascalToKebab.ts
|
|
232
|
+
function pascalToKebab(pascalCaseString) {
|
|
233
|
+
return pascalCaseString.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// src/functions/parse/parse.ts
|
|
237
|
+
function parse(schema) {
|
|
238
|
+
return {
|
|
239
|
+
dialog: schema._parse()
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/functions/parse/parsePrimitives.ts
|
|
244
|
+
function parsePrimitives(schema) {
|
|
245
|
+
return schema._primitive();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/decorators/webcomponent/webcomponent.ts
|
|
249
|
+
function webcomponent(schema, options) {
|
|
250
|
+
const props = {
|
|
251
|
+
...parsePrimitives(schema)
|
|
252
|
+
};
|
|
253
|
+
return (component) => {
|
|
254
|
+
const name = pascalToKebab(component.displayName);
|
|
255
|
+
if (!window.customElements.get(name)) {
|
|
256
|
+
customElements.define(
|
|
257
|
+
name,
|
|
258
|
+
r2wc(component, {
|
|
259
|
+
props
|
|
260
|
+
})
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
export {
|
|
266
|
+
checkbox,
|
|
267
|
+
dialog,
|
|
268
|
+
hidden,
|
|
269
|
+
image,
|
|
270
|
+
multifield,
|
|
271
|
+
object,
|
|
272
|
+
optional,
|
|
273
|
+
parse,
|
|
274
|
+
parsePrimitives,
|
|
275
|
+
pathbrowser,
|
|
276
|
+
select,
|
|
277
|
+
text,
|
|
278
|
+
webcomponent
|
|
279
|
+
};
|
|
280
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +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;AAAA,YACL,MAAM;AAAA,YACN,IAAI;AAAA,YACJ,UAAU;AAAA,UACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AACP,aAAO,OAAO,QAAQ,OAAO,EAC1B,IAAI,CA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B;AAAA,EACF;AACF;;;ACjCO,SAAS,OAAuC,SAA2C;AAChG,SAAO;AAAA,IACL,MAAM;AAAA,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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseSchema, BaseFieldInput } from '../../types/schema.mjs';
|
|
2
|
+
import '../../types/webcomponent.mjs';
|
|
3
|
+
|
|
4
|
+
interface CheckBoxSchema<TOutput extends boolean = boolean> extends BaseSchema<TOutput> {
|
|
5
|
+
/**
|
|
6
|
+
* The schema type.
|
|
7
|
+
*/
|
|
8
|
+
type: 'checkbox';
|
|
9
|
+
}
|
|
10
|
+
interface CheckBoxInput extends BaseFieldInput {
|
|
11
|
+
}
|
|
12
|
+
declare function checkbox(input: CheckBoxInput): CheckBoxSchema;
|
|
13
|
+
|
|
14
|
+
export { type CheckBoxSchema, checkbox };
|