@ostack.tech/kform-scaffolder 0.32.5 → 0.33.0-SNAPSHOT.20260319184938

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.
@@ -1,1770 +1,1501 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useDroppable, useDraggable, useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, DragOverlay } from "@dnd-kit/core";
3
- import { createContext, useContext, useCallback, useMemo, useRef, useLayoutEffect as useLayoutEffect$1, useState } from "react";
1
+ import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
2
+ import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
4
3
  import { create } from "zustand";
5
4
  import { persist } from "zustand/middleware";
6
5
  import { fileOpen, fileSave, supported } from "browser-fs-access";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import JSZip from "jszip";
8
8
  import { render } from "ejs";
9
+ //#region src/Schematic.ts
9
10
  function createSchematic(schematic) {
10
- return {
11
- id: self.crypto.randomUUID(),
12
- kind: "",
13
- ...schematic
14
- };
11
+ return {
12
+ id: self.crypto.randomUUID(),
13
+ kind: "",
14
+ ...schematic
15
+ };
15
16
  }
16
17
  function moveSchematic(schematic, moveId, parentId, sortBefore) {
17
- const { schematic: schematicWithoutFrom, removed: fromSchematic } = remove(
18
- schematic,
19
- moveId
20
- );
21
- return add(schematicWithoutFrom, fromSchematic, parentId, sortBefore);
18
+ const { schematic: schematicWithoutFrom, removed: fromSchematic } = remove(schematic, moveId);
19
+ return add(schematicWithoutFrom, fromSchematic, parentId, sortBefore);
22
20
  }
23
21
  function remove(schematic, id) {
24
- if (schematic.id === id) {
25
- return { schematic: null, removed: schematic };
26
- }
27
- if (!schematic.children) {
28
- return { schematic, removed: null };
29
- }
30
- const newChildren = [];
31
- let removed = null;
32
- for (const child of schematic.children) {
33
- const { schematic: newChild, removed: removedChild } = remove(child, id);
34
- if (newChild !== null) {
35
- newChildren.push(newChild);
36
- }
37
- if (removedChild !== null) {
38
- removed = removedChild;
39
- }
40
- }
41
- return { schematic: { ...schematic, children: newChildren }, removed };
22
+ if (schematic.id === id) return {
23
+ schematic: null,
24
+ removed: schematic
25
+ };
26
+ if (!schematic.children) return {
27
+ schematic,
28
+ removed: null
29
+ };
30
+ const newChildren = [];
31
+ let removed = null;
32
+ for (const child of schematic.children) {
33
+ const { schematic: newChild, removed: removedChild } = remove(child, id);
34
+ if (newChild !== null) newChildren.push(newChild);
35
+ if (removedChild !== null) removed = removedChild;
36
+ }
37
+ return {
38
+ schematic: {
39
+ ...schematic,
40
+ children: newChildren
41
+ },
42
+ removed
43
+ };
42
44
  }
43
45
  function add(schematic, toAdd, parentId, sortBefore) {
44
- if (schematic.id === parentId) {
45
- const oldChildren = schematic.children ?? [];
46
- const index = sortBefore === null ? oldChildren.length : oldChildren.findIndex((c) => c.id === sortBefore);
47
- return {
48
- ...schematic,
49
- children: [
50
- ...oldChildren.slice(0, index),
51
- toAdd,
52
- ...oldChildren.slice(index)
53
- ]
54
- };
55
- }
56
- if (!schematic.children) {
57
- return schematic;
58
- }
59
- return {
60
- ...schematic,
61
- children: schematic.children.map(
62
- (child) => add(child, toAdd, parentId, sortBefore)
63
- )
64
- };
65
- }
66
- const SchematicBuilderContext = createContext(null);
46
+ if (schematic.id === parentId) {
47
+ const oldChildren = schematic.children ?? [];
48
+ const index = sortBefore === null ? oldChildren.length : oldChildren.findIndex((c) => c.id === sortBefore);
49
+ return {
50
+ ...schematic,
51
+ children: [
52
+ ...oldChildren.slice(0, index),
53
+ toAdd,
54
+ ...oldChildren.slice(index)
55
+ ]
56
+ };
57
+ }
58
+ if (!schematic.children) return schematic;
59
+ return {
60
+ ...schematic,
61
+ children: schematic.children.map((child) => add(child, toAdd, parentId, sortBefore))
62
+ };
63
+ }
64
+ //#endregion
65
+ //#region src/SchematicBuilderContext.ts
66
+ var SchematicBuilderContext = createContext(null);
67
67
  function useSchematicBuilderContext() {
68
- const context = useContext(SchematicBuilderContext);
69
- if (context === null) {
70
- throw new Error("Schematic builder not in context.");
71
- }
72
- return context;
68
+ const context = useContext(SchematicBuilderContext);
69
+ if (context === null) throw new Error("Schematic builder not in context.");
70
+ return context;
73
71
  }
72
+ //#endregion
73
+ //#region src/actions/LoadSchematic.tsx
74
74
  function LoadSchematic() {
75
- const { name, setSchematic, latestSchematicFileHandleRef } = useSchematicBuilderContext();
76
- return /* @__PURE__ */ jsx(
77
- "button",
78
- {
79
- className: "builder-icon-button builder-action builder-load-schematic",
80
- type: "button",
81
- onClick: async () => {
82
- try {
83
- const file = await fileOpen({
84
- extensions: [".json"],
85
- mimeTypes: ["application/json"],
86
- description: "Form schematic",
87
- id: name
88
- });
89
- latestSchematicFileHandleRef.current = file.handle ?? null;
90
- const content = JSON.parse(await file.text());
91
- setSchematic(() => content);
92
- } catch (err) {
93
- if (err instanceof DOMException && err.name === "AbortError") {
94
- return;
95
- }
96
- alert(`Unable to load schematic: ${err?.toString()}`);
97
- }
98
- },
99
- title: "Load schematic",
100
- "aria-label": "Load schematic",
101
- children: "📂"
102
- }
103
- );
104
- }
75
+ const { name, setSchematic, latestSchematicFileHandleRef } = useSchematicBuilderContext();
76
+ return /* @__PURE__ */ jsx("button", {
77
+ className: "builder-icon-button builder-action builder-load-schematic",
78
+ type: "button",
79
+ onClick: async () => {
80
+ try {
81
+ const file = await fileOpen({
82
+ extensions: [".json"],
83
+ mimeTypes: ["application/json"],
84
+ description: "Form schematic",
85
+ id: name
86
+ });
87
+ latestSchematicFileHandleRef.current = file.handle ?? null;
88
+ const content = JSON.parse(await file.text());
89
+ setSchematic(() => content);
90
+ } catch (err) {
91
+ if (err instanceof DOMException && err.name === "AbortError") return;
92
+ alert(`Unable to load schematic: ${err?.toString()}`);
93
+ }
94
+ },
95
+ title: "Load schematic",
96
+ "aria-label": "Load schematic",
97
+ children: "📂"
98
+ });
99
+ }
100
+ //#endregion
101
+ //#region src/actions/SaveSchematic.tsx
105
102
  function SaveSchematic() {
106
- const { name, getRootSchematic, latestSchematicFileHandleRef } = useSchematicBuilderContext();
107
- return /* @__PURE__ */ jsx(
108
- "button",
109
- {
110
- className: "builder-icon-button builder-action builder-save-schematic",
111
- type: "button",
112
- onClick: async () => {
113
- try {
114
- const schematic = getRootSchematic();
115
- latestSchematicFileHandleRef.current = await fileSave(
116
- new Blob([JSON.stringify(schematic, null, 2)]),
117
- {
118
- fileName: `${schematic.name}-schematic.json`,
119
- extensions: [".json"],
120
- mimeTypes: ["application/json"],
121
- description: "Form schematic",
122
- id: name
123
- },
124
- latestSchematicFileHandleRef.current
125
- );
126
- if (supported) {
127
- alert(
128
- `Schematic saved successfully as “${latestSchematicFileHandleRef.current?.name ?? "unknown"}”.`
129
- );
130
- }
131
- } catch (err) {
132
- if (err instanceof DOMException && err.name === "AbortError") {
133
- return;
134
- }
135
- alert(`Unable to save schematic: ${err?.toString()}`);
136
- }
137
- },
138
- title: "Save schematic",
139
- "aria-label": "Save schematic",
140
- children: "💾"
141
- }
142
- );
143
- }
103
+ const { name, getRootSchematic, latestSchematicFileHandleRef } = useSchematicBuilderContext();
104
+ return /* @__PURE__ */ jsx("button", {
105
+ className: "builder-icon-button builder-action builder-save-schematic",
106
+ type: "button",
107
+ onClick: async () => {
108
+ try {
109
+ const schematic = getRootSchematic();
110
+ latestSchematicFileHandleRef.current = await fileSave(new Blob([JSON.stringify(schematic, null, 2)]), {
111
+ fileName: `${schematic.name}-schematic.json`,
112
+ extensions: [".json"],
113
+ mimeTypes: ["application/json"],
114
+ description: "Form schematic",
115
+ id: name
116
+ }, latestSchematicFileHandleRef.current);
117
+ if (supported) alert(`Schematic saved successfully as “${latestSchematicFileHandleRef.current?.name ?? "unknown"}”.`);
118
+ } catch (err) {
119
+ if (err instanceof DOMException && err.name === "AbortError") return;
120
+ alert(`Unable to save schematic: ${err?.toString()}`);
121
+ }
122
+ },
123
+ title: "Save schematic",
124
+ "aria-label": "Save schematic",
125
+ children: "💾"
126
+ });
127
+ }
128
+ //#endregion
129
+ //#region src/scaffolding/configScaffolder.ts
130
+ /** Returns a new scaffolder with its data merged with the provided data. */
144
131
  function configScaffolder(scaffolder, data) {
145
- return (schematic, originalData) => scaffolder(schematic, { ...originalData, ...data });
132
+ return (schematic, originalData) => scaffolder(schematic, {
133
+ ...originalData,
134
+ ...data
135
+ });
146
136
  }
137
+ //#endregion
138
+ //#region src/util/join.ts
147
139
  function join(s1, s2, separator) {
148
- return !s1 || !s2 ? s1 || s2 || "" : `${s1}${s1.endsWith(separator) ? "" : separator}${s2}`;
140
+ return !s1 || !s2 ? s1 || s2 || "" : `${s1}${s1.endsWith(separator) ? "" : separator}${s2}`;
149
141
  }
150
142
  function joinPaths(path1, path2) {
151
- return join(path1, path2, "/");
143
+ return join(path1, path2, "/");
152
144
  }
153
145
  function joinPackages(pkg1, pkg2) {
154
- return join(pkg1, pkg2, ".");
146
+ return join(pkg1, pkg2, ".");
155
147
  }
148
+ //#endregion
149
+ //#region src/scaffolding/scaffold.ts
156
150
  function scaffold(schematic, scaffolders, options) {
157
- const files = /* @__PURE__ */ new Map();
158
- const data = {
159
- schematicKinds: options.schematicKinds,
160
- rootSchematic: schematic,
161
- files,
162
- currentPath: options.basePath ?? "/",
163
- currentPackage: joinPackages(options.basePackage, schematic.packageSuffix),
164
- currentDir: options.baseDir
165
- };
166
- for (const scaffolder of scaffolders) {
167
- scaffolder(schematic, data);
168
- }
169
- return Array.from(files).map(([path, file]) => ({
170
- path,
171
- content: file.getContent(),
172
- base64: file.base64,
173
- binary: file.binary,
174
- executable: file.executable
175
- }));
176
- }
151
+ const files = /* @__PURE__ */ new Map();
152
+ const data = {
153
+ schematicKinds: options.schematicKinds,
154
+ rootSchematic: schematic,
155
+ files,
156
+ currentPath: options.basePath ?? "/",
157
+ currentPackage: joinPackages(options.basePackage, schematic.packageSuffix),
158
+ currentDir: options.baseDir
159
+ };
160
+ for (const scaffolder of scaffolders) scaffolder(schematic, data);
161
+ return Array.from(files).map(([path, file]) => ({
162
+ path,
163
+ content: file.getContent(),
164
+ base64: file.base64,
165
+ binary: file.binary,
166
+ executable: file.executable
167
+ }));
168
+ }
169
+ //#endregion
170
+ //#region src/scaffolding/useScaffolder.ts
177
171
  function useScaffolder() {
178
- const {
179
- basePath,
180
- basePackage,
181
- baseDir,
182
- schematicKinds,
183
- scaffolders,
184
- scaffoldingData,
185
- getRootSchematic
186
- } = useSchematicBuilderContext();
187
- return useCallback(() => {
188
- const schematic = getRootSchematic();
189
- let actualScaffolders = typeof scaffolders === "function" ? scaffolders(schematic) : scaffolders;
190
- const actualScaffoldingData = typeof scaffoldingData === "function" ? scaffoldingData(schematic) : scaffoldingData;
191
- if (actualScaffoldingData) {
192
- actualScaffolders = actualScaffolders.map(
193
- (scaffolder) => configScaffolder(scaffolder, actualScaffoldingData)
194
- );
195
- }
196
- return scaffold(schematic, actualScaffolders, {
197
- schematicKinds,
198
- basePath,
199
- basePackage,
200
- baseDir: typeof baseDir === "function" ? baseDir(schematic) : baseDir
201
- });
202
- }, [
203
- baseDir,
204
- basePackage,
205
- basePath,
206
- getRootSchematic,
207
- scaffolders,
208
- scaffoldingData,
209
- schematicKinds
210
- ]);
211
- }
172
+ const { basePath, basePackage, baseDir, schematicKinds, scaffolders, scaffoldingData, getRootSchematic } = useSchematicBuilderContext();
173
+ return useCallback(() => {
174
+ const schematic = getRootSchematic();
175
+ let actualScaffolders = typeof scaffolders === "function" ? scaffolders(schematic) : scaffolders;
176
+ const actualScaffoldingData = typeof scaffoldingData === "function" ? scaffoldingData(schematic) : scaffoldingData;
177
+ if (actualScaffoldingData) actualScaffolders = actualScaffolders.map((scaffolder) => configScaffolder(scaffolder, actualScaffoldingData));
178
+ return scaffold(schematic, actualScaffolders, {
179
+ schematicKinds,
180
+ basePath,
181
+ basePackage,
182
+ baseDir: typeof baseDir === "function" ? baseDir(schematic) : baseDir
183
+ });
184
+ }, [
185
+ baseDir,
186
+ basePackage,
187
+ basePath,
188
+ getRootSchematic,
189
+ scaffolders,
190
+ scaffoldingData,
191
+ schematicKinds
192
+ ]);
193
+ }
194
+ //#endregion
195
+ //#region src/actions/ScaffoldToZip.tsx
212
196
  function ScaffoldToZip() {
213
- const { getRootSchematic, name } = useSchematicBuilderContext();
214
- const scaffold2 = useScaffolder();
215
- return /* @__PURE__ */ jsx(
216
- "button",
217
- {
218
- className: "builder-input builder-action builder-scaffold-zip",
219
- type: "submit",
220
- onClick: async (evt) => {
221
- evt.preventDefault();
222
- try {
223
- const schematic = getRootSchematic();
224
- const files = scaffold2();
225
- const zip = new JSZip();
226
- for (const { path, content, base64, binary, executable } of files) {
227
- zip.file(path, content, {
228
- base64,
229
- binary,
230
- unixPermissions: executable ? "755" : void 0
231
- });
232
- }
233
- const fileHandle = await fileSave(
234
- zip.generateAsync({ platform: "UNIX", type: "blob" }),
235
- {
236
- fileName: `${schematic.name}.zip`,
237
- extensions: [".zip"],
238
- mimeTypes: ["application/zip"],
239
- description: "Form scaffolding",
240
- id: name
241
- }
242
- );
243
- if (supported) {
244
- alert(
245
- `Project scaffolded successfully in “${fileHandle?.name ?? "unknown"}”.`
246
- );
247
- }
248
- } catch (err) {
249
- if (err instanceof DOMException && err.name === "AbortError") {
250
- return;
251
- }
252
- alert(`Unable to scaffold project: ${err?.toString()}`);
253
- }
254
- },
255
- children: "Scaffold 🏗️"
256
- }
257
- );
258
- }
197
+ const { getRootSchematic, name } = useSchematicBuilderContext();
198
+ const scaffold = useScaffolder();
199
+ return /* @__PURE__ */ jsx("button", {
200
+ className: "builder-input builder-action builder-scaffold-zip",
201
+ type: "submit",
202
+ onClick: async (evt) => {
203
+ evt.preventDefault();
204
+ try {
205
+ const schematic = getRootSchematic();
206
+ const files = scaffold();
207
+ const zip = new JSZip();
208
+ for (const { path, content, base64, binary, executable } of files) zip.file(path, content, {
209
+ base64,
210
+ binary,
211
+ unixPermissions: executable ? "755" : void 0
212
+ });
213
+ const fileHandle = await fileSave(zip.generateAsync({
214
+ platform: "UNIX",
215
+ type: "blob"
216
+ }), {
217
+ fileName: `${schematic.name}.zip`,
218
+ extensions: [".zip"],
219
+ mimeTypes: ["application/zip"],
220
+ description: "Form scaffolding",
221
+ id: name
222
+ });
223
+ if (supported) alert(`Project scaffolded successfully in “${fileHandle?.name ?? "unknown"}”.`);
224
+ } catch (err) {
225
+ if (err instanceof DOMException && err.name === "AbortError") return;
226
+ alert(`Unable to scaffold project: ${err?.toString()}`);
227
+ }
228
+ },
229
+ children: "Scaffold 🏗️"
230
+ });
231
+ }
232
+ //#endregion
233
+ //#region src/configs/util/useConfig.ts
259
234
  function useConfig(configName, defaultValue) {
260
- const { useSchematic, setSchematic } = useSchematicBuilderContext();
261
- const configValue = useSchematic(
262
- (schematic) => schematic.config?.[configName] ?? defaultValue
263
- );
264
- const setConfigValue = useCallback(
265
- (configValue2) => setSchematic((schematic) => ({
266
- config: {
267
- ...schematic.config,
268
- [configName]: typeof configValue2 === "function" ? configValue2(schematic.config?.[configName]) : configValue2
269
- }
270
- })),
271
- [configName, setSchematic]
272
- );
273
- return useMemo(
274
- () => [configValue, setConfigValue],
275
- [configValue, setConfigValue]
276
- );
277
- }
278
- function UseFileBase64SerializerConfig({
279
- disabled
280
- }) {
281
- const [config, setConfig] = useConfig("useFileBase64Serializer", false);
282
- return /* @__PURE__ */ jsx("div", { className: "builder-config-field", children: /* @__PURE__ */ jsxs("label", { children: [
283
- /* @__PURE__ */ jsx(
284
- "input",
285
- {
286
- type: "checkbox",
287
- checked: config,
288
- onChange: (evt) => setConfig(evt.target.checked),
289
- disabled
290
- }
291
- ),
292
- "Use ",
293
- /* @__PURE__ */ jsx("code", { children: "File.Base64Serializer" })
294
- ] }) });
295
- }
296
- function UseTableValuesSerializerConfig({
297
- disabled
298
- }) {
299
- const [config, setConfig] = useConfig("useTableValuesSerializer", false);
300
- return /* @__PURE__ */ jsx("div", { className: "builder-config-field", children: /* @__PURE__ */ jsxs("label", { children: [
301
- /* @__PURE__ */ jsx(
302
- "input",
303
- {
304
- type: "checkbox",
305
- checked: config,
306
- onChange: (evt) => setConfig(evt.target.checked),
307
- disabled
308
- }
309
- ),
310
- "Use ",
311
- /* @__PURE__ */ jsx("code", { children: "Table.ValuesSerializer" })
312
- ] }) });
313
- }
314
- const DEFAULT_IMPORTS = [
315
- /^kotlin\.[^.]+$/,
316
- /^kotlin\.annotation\.[^.]+$/,
317
- /^kotlin\.collections\.[^.]+$/,
318
- /^kotlin\.comparisons\.[^.]+$/,
319
- /^kotlin\.io\.[^.]+$/,
320
- /^kotlin\.ranges\.[^.]+$/,
321
- /^kotlin\.sequences\.[^.]+$/,
322
- /^kotlin\.text\.[^.]+$/
235
+ const { useSchematic, setSchematic } = useSchematicBuilderContext();
236
+ const configValue = useSchematic((schematic) => schematic.config?.[configName] ?? defaultValue);
237
+ const setConfigValue = useCallback((configValue) => setSchematic((schematic) => ({ config: {
238
+ ...schematic.config,
239
+ [configName]: typeof configValue === "function" ? configValue(schematic.config?.[configName]) : configValue
240
+ } })), [configName, setSchematic]);
241
+ return useMemo(() => [configValue, setConfigValue], [configValue, setConfigValue]);
242
+ }
243
+ //#endregion
244
+ //#region src/configs/UseFileBase64SerializerConfig.tsx
245
+ function UseFileBase64SerializerConfig({ disabled }) {
246
+ const [config, setConfig] = useConfig("useFileBase64Serializer", false);
247
+ return /* @__PURE__ */ jsx("div", {
248
+ className: "builder-config-field",
249
+ children: /* @__PURE__ */ jsxs("label", { children: [
250
+ /* @__PURE__ */ jsx("input", {
251
+ type: "checkbox",
252
+ checked: config,
253
+ onChange: (evt) => setConfig(evt.target.checked),
254
+ disabled
255
+ }),
256
+ "Use ",
257
+ /* @__PURE__ */ jsx("code", { children: "File.Base64Serializer" })
258
+ ] })
259
+ });
260
+ }
261
+ //#endregion
262
+ //#region src/configs/UseTableValuesSerializerConfig.tsx
263
+ function UseTableValuesSerializerConfig({ disabled }) {
264
+ const [config, setConfig] = useConfig("useTableValuesSerializer", false);
265
+ return /* @__PURE__ */ jsx("div", {
266
+ className: "builder-config-field",
267
+ children: /* @__PURE__ */ jsxs("label", { children: [
268
+ /* @__PURE__ */ jsx("input", {
269
+ type: "checkbox",
270
+ checked: config,
271
+ onChange: (evt) => setConfig(evt.target.checked),
272
+ disabled
273
+ }),
274
+ "Use ",
275
+ /* @__PURE__ */ jsx("code", { children: "Table.ValuesSerializer" })
276
+ ] })
277
+ });
278
+ }
279
+ //#endregion
280
+ //#region src/scaffolding/kotlin/util/defaultImports.ts
281
+ var DEFAULT_IMPORTS = [
282
+ /^kotlin\.[^.]+$/,
283
+ /^kotlin\.annotation\.[^.]+$/,
284
+ /^kotlin\.collections\.[^.]+$/,
285
+ /^kotlin\.comparisons\.[^.]+$/,
286
+ /^kotlin\.io\.[^.]+$/,
287
+ /^kotlin\.ranges\.[^.]+$/,
288
+ /^kotlin\.sequences\.[^.]+$/,
289
+ /^kotlin\.text\.[^.]+$/
323
290
  ];
324
291
  function isDefaultKtImport(qualifiedName) {
325
- return DEFAULT_IMPORTS.some((i) => i.test(qualifiedName));
292
+ return DEFAULT_IMPORTS.some((i) => i.test(qualifiedName));
326
293
  }
294
+ //#endregion
295
+ //#region src/scaffolding/kotlin/KtFile.ts
327
296
  function ktFile(data) {
328
- return {
329
- package: data.currentPackage ?? "",
330
- imports: /* @__PURE__ */ new Set(),
331
- declarations: [],
332
- getContent: ktFileContent
333
- };
297
+ return {
298
+ package: data.currentPackage ?? "",
299
+ imports: /* @__PURE__ */ new Set(),
300
+ declarations: [],
301
+ getContent: ktFileContent
302
+ };
334
303
  }
335
304
  function ktFileContent() {
336
- return [
337
- // Package
338
- this.package && `package ${this.package}`,
339
- // Imports
340
- Array.from(this.imports).filter((i) => !isDefaultKtImport(i)).sort().map((i) => `import ${i}`).join("\n"),
341
- // Declarations
342
- ...this.declarations
343
- ].filter((s) => s).join("\n\n") + "\n";
344
- }
305
+ return [
306
+ this.package && `package ${this.package}`,
307
+ Array.from(this.imports).filter((i) => !isDefaultKtImport(i)).sort().map((i) => `import ${i}`).join("\n"),
308
+ ...this.declarations
309
+ ].filter((s) => s).join("\n\n") + "\n";
310
+ }
311
+ //#endregion
312
+ //#region src/scaffolding/kotlin/util/simpleKtName.ts
345
313
  function simpleKtName(qualifiedName) {
346
- return qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1);
347
- }
348
- const JS_EXPORT = "kotlin.js.JsExport";
349
- const SERIALIZABLE = "kotlinx.serialization.Serializable";
350
- function annotate(annotations, code2) {
351
- if (!annotations || annotations.length === 0) {
352
- return code2;
353
- }
354
- return [
355
- ...typeof annotations === "string" ? [annotations] : annotations,
356
- code2
357
- ].join("\n");
358
- }
359
- function jsExport(code2, data) {
360
- data.currentFile.imports.add(JS_EXPORT);
361
- return annotate(`@${simpleKtName(JS_EXPORT)}`, code2);
362
- }
363
- function serializable(code2, data) {
364
- data.currentFile.imports.add(SERIALIZABLE);
365
- return annotate(`@${simpleKtName(SERIALIZABLE)}`, code2);
366
- }
314
+ return qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1);
315
+ }
316
+ //#endregion
317
+ //#region src/scaffolding/kotlin/util/annotations.ts
318
+ var JS_EXPORT = "kotlin.js.JsExport";
319
+ var SERIALIZABLE = "kotlinx.serialization.Serializable";
320
+ function annotate(annotations, code) {
321
+ if (!annotations || annotations.length === 0) return code;
322
+ return [...typeof annotations === "string" ? [annotations] : annotations, code].join("\n");
323
+ }
324
+ function jsExport(code, data) {
325
+ data.currentFile.imports.add(JS_EXPORT);
326
+ return annotate(`@${simpleKtName(JS_EXPORT)}`, code);
327
+ }
328
+ function serializable(code, data) {
329
+ data.currentFile.imports.add(SERIALIZABLE);
330
+ return annotate(`@${simpleKtName(SERIALIZABLE)}`, code);
331
+ }
332
+ //#endregion
333
+ //#region src/scaffolding/scaffolders/scaffoldModels.ts
367
334
  function scaffoldModels(schematic, data) {
368
- const fileName = joinPaths(data.currentDir, `${schematic.name}.kt`);
369
- let file = data.files.get(fileName);
370
- if (!file) {
371
- data.files.set(fileName, file = ktFile(data));
372
- }
373
- scaffoldModelDeclaration(schematic, { ...data, currentFile: file });
335
+ const fileName = joinPaths(data.currentDir, `${schematic.name}.kt`);
336
+ let file = data.files.get(fileName);
337
+ if (!file) data.files.set(fileName, file = ktFile(data));
338
+ scaffoldModelDeclaration(schematic, {
339
+ ...data,
340
+ currentFile: file
341
+ });
374
342
  }
375
343
  function scaffoldModelDeclaration(schematic, data) {
376
- const schematicKind = data.schematicKinds.get(schematic.kind);
377
- if (!schematicKind) {
378
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
379
- }
380
- const nDecls = data.currentFile.declarations.length;
381
- data.currentFile.declarations.push("");
382
- const decl = schematicKind.scaffoldModel?.(schematic, data) ?? `typealias ${schematic.name} = ${scaffoldType(schematic, data)}`;
383
- data.currentFile.declarations[nDecls] = schematicKind.scaffoldModel ? jsExport(serializable(decl, data), data) : decl;
344
+ const schematicKind = data.schematicKinds.get(schematic.kind);
345
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
346
+ const nDecls = data.currentFile.declarations.length;
347
+ data.currentFile.declarations.push("");
348
+ const decl = schematicKind.scaffoldModel?.(schematic, data) ?? `typealias ${schematic.name} = ${scaffoldType(schematic, data)}`;
349
+ data.currentFile.declarations[nDecls] = schematicKind.scaffoldModel ? jsExport(serializable(decl, data), data) : decl;
384
350
  }
385
351
  function scaffoldPropertyAnnotations(schematic, data) {
386
- const schematicKind = data.schematicKinds.get(schematic.kind);
387
- if (!schematicKind) {
388
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
389
- }
390
- return typeof schematicKind.propertyAnnotations === "function" ? schematicKind.propertyAnnotations(schematic, data) : schematicKind.propertyAnnotations;
352
+ const schematicKind = data.schematicKinds.get(schematic.kind);
353
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
354
+ return typeof schematicKind.propertyAnnotations === "function" ? schematicKind.propertyAnnotations(schematic, data) : schematicKind.propertyAnnotations;
391
355
  }
392
356
  function scaffoldType(schematic, data) {
393
- const schematicKind = data.schematicKinds.get(schematic.kind);
394
- if (!schematicKind) {
395
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
396
- }
397
- const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
398
- const schematicName = schematic.name || schematicKind.name;
399
- if (schematicPackage !== data.currentPackage) {
400
- data.currentFile.imports.add(joinPackages(schematicPackage, schematicName));
401
- }
402
- if (schematicKind.package == null && schematicPackage !== data.currentPackage) {
403
- scaffoldModels(schematic, {
404
- ...data,
405
- currentPackage: joinPackages(
406
- data.currentPackage,
407
- schematic.packageSuffix
408
- ),
409
- currentDir: joinPaths(
410
- data.currentDir,
411
- schematic.packageSuffix?.replace(".", "/")
412
- )
413
- });
414
- } else if (schematicKind.scaffoldModel) {
415
- scaffoldModelDeclaration(schematic, data);
416
- }
417
- return (schematicKind.scaffoldType?.(schematic, data) ?? schematicName) + (schematic.nullable ? "?" : "");
357
+ const schematicKind = data.schematicKinds.get(schematic.kind);
358
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
359
+ const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
360
+ const schematicName = schematic.name || schematicKind.name;
361
+ if (schematicPackage !== data.currentPackage) data.currentFile.imports.add(joinPackages(schematicPackage, schematicName));
362
+ if (schematicKind.package == null && schematicPackage !== data.currentPackage) scaffoldModels(schematic, {
363
+ ...data,
364
+ currentPackage: joinPackages(data.currentPackage, schematic.packageSuffix),
365
+ currentDir: joinPaths(data.currentDir, schematic.packageSuffix?.replace(".", "/"))
366
+ });
367
+ else if (schematicKind.scaffoldModel) scaffoldModelDeclaration(schematic, data);
368
+ return (schematicKind.scaffoldType?.(schematic, data) ?? schematicName) + (schematic.nullable ? "?" : "");
418
369
  }
419
370
  function scaffoldDefaultValue(schematic, data) {
420
- const schematicKind = data.schematicKinds.get(schematic.kind);
421
- if (!schematicKind) {
422
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
423
- }
424
- return schematic.nullable ? "null" : typeof schematicKind.defaultValue === "function" ? schematicKind.defaultValue(schematic, data) : schematicKind.defaultValue;
425
- }
426
- const SPLIT_LOWER_UPPER_RE = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu");
427
- const SPLIT_UPPER_UPPER_RE = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu");
428
- const SPLIT_SEPARATE_NUMBER_RE = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u");
429
- const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
430
- const SPLIT_REPLACE_VALUE = "$1\0$2";
431
- const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
371
+ const schematicKind = data.schematicKinds.get(schematic.kind);
372
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
373
+ return schematic.nullable ? "null" : typeof schematicKind.defaultValue === "function" ? schematicKind.defaultValue(schematic, data) : schematicKind.defaultValue;
374
+ }
375
+ //#endregion
376
+ //#region ../../node_modules/change-case/dist/index.js
377
+ var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
378
+ var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
379
+ var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
380
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
381
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
382
+ var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
383
+ /**
384
+ * Split any cased input strings into an array of words.
385
+ */
432
386
  function split(value) {
433
- let result = value.trim();
434
- result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
435
- result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
436
- let start = 0;
437
- let end = result.length;
438
- while (result.charAt(start) === "\0")
439
- start++;
440
- if (start === end)
441
- return [];
442
- while (result.charAt(end - 1) === "\0")
443
- end--;
444
- return result.slice(start, end).split(/\0/g);
445
- }
387
+ let result = value.trim();
388
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
389
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
390
+ let start = 0;
391
+ let end = result.length;
392
+ while (result.charAt(start) === "\0") start++;
393
+ if (start === end) return [];
394
+ while (result.charAt(end - 1) === "\0") end--;
395
+ return result.slice(start, end).split(/\0/g);
396
+ }
397
+ /**
398
+ * Split the input string into an array of words, separating numbers.
399
+ */
446
400
  function splitSeparateNumbers(value) {
447
- const words = split(value);
448
- for (let i = 0; i < words.length; i++) {
449
- const word = words[i];
450
- const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
451
- if (match) {
452
- const offset = match.index + (match[1] ?? match[2]).length;
453
- words.splice(i, 1, word.slice(0, offset), word.slice(offset));
454
- }
455
- }
456
- return words;
457
- }
401
+ const words = split(value);
402
+ for (let i = 0; i < words.length; i++) {
403
+ const word = words[i];
404
+ const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
405
+ if (match) {
406
+ const offset = match.index + (match[1] ?? match[2]).length;
407
+ words.splice(i, 1, word.slice(0, offset), word.slice(offset));
408
+ }
409
+ }
410
+ return words;
411
+ }
412
+ /**
413
+ * Convert a string to camel case (`fooBar`).
414
+ */
458
415
  function camelCase(input, options) {
459
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
460
- const lower = lowerFactory(options?.locale);
461
- const upper = upperFactory(options?.locale);
462
- const transform = pascalCaseTransformFactory(lower, upper);
463
- return prefix + words.map((word, index) => {
464
- if (index === 0)
465
- return lower(word);
466
- return transform(word, index);
467
- }).join("") + suffix;
468
- }
416
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
417
+ const lower = lowerFactory(options?.locale);
418
+ const upper = upperFactory(options?.locale);
419
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
420
+ return prefix + words.map((word, index) => {
421
+ if (index === 0) return lower(word);
422
+ return transform(word, index);
423
+ }).join(options?.delimiter ?? "") + suffix;
424
+ }
425
+ /**
426
+ * Convert a string to pascal case (`FooBar`).
427
+ */
469
428
  function pascalCase(input, options) {
470
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
471
- const lower = lowerFactory(options?.locale);
472
- const upper = upperFactory(options?.locale);
473
- const transform = pascalCaseTransformFactory(lower, upper);
474
- return prefix + words.map(transform).join("") + suffix;
429
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
430
+ const lower = lowerFactory(options?.locale);
431
+ const upper = upperFactory(options?.locale);
432
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
433
+ return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
475
434
  }
476
435
  function lowerFactory(locale) {
477
- return (input) => input.toLocaleLowerCase(locale);
436
+ return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
478
437
  }
479
438
  function upperFactory(locale) {
480
- return (input) => input.toLocaleUpperCase(locale);
439
+ return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
440
+ }
441
+ function capitalCaseTransformFactory(lower, upper) {
442
+ return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
481
443
  }
482
444
  function pascalCaseTransformFactory(lower, upper) {
483
- return (word, index) => {
484
- const char0 = word[0];
485
- const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
486
- return initial + lower(word.slice(1));
487
- };
445
+ return (word, index) => {
446
+ const char0 = word[0];
447
+ return (index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0)) + lower(word.slice(1));
448
+ };
488
449
  }
489
450
  function splitPrefixSuffix(input, options = {}) {
490
- const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
491
- const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
492
- const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
493
- let prefixIndex = 0;
494
- let suffixIndex = input.length;
495
- while (prefixIndex < input.length) {
496
- const char = input.charAt(prefixIndex);
497
- if (!prefixCharacters.includes(char))
498
- break;
499
- prefixIndex++;
500
- }
501
- while (suffixIndex > prefixIndex) {
502
- const index = suffixIndex - 1;
503
- const char = input.charAt(index);
504
- if (!suffixCharacters.includes(char))
505
- break;
506
- suffixIndex = index;
507
- }
508
- return [
509
- input.slice(0, prefixIndex),
510
- splitFn(input.slice(prefixIndex, suffixIndex)),
511
- input.slice(suffixIndex)
512
- ];
513
- }
451
+ const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
452
+ const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
453
+ const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
454
+ let prefixIndex = 0;
455
+ let suffixIndex = input.length;
456
+ while (prefixIndex < input.length) {
457
+ const char = input.charAt(prefixIndex);
458
+ if (!prefixCharacters.includes(char)) break;
459
+ prefixIndex++;
460
+ }
461
+ while (suffixIndex > prefixIndex) {
462
+ const index = suffixIndex - 1;
463
+ const char = input.charAt(index);
464
+ if (!suffixCharacters.includes(char)) break;
465
+ suffixIndex = index;
466
+ }
467
+ return [
468
+ input.slice(0, prefixIndex),
469
+ splitFn(input.slice(prefixIndex, suffixIndex)),
470
+ input.slice(suffixIndex)
471
+ ];
472
+ }
473
+ //#endregion
474
+ //#region src/util/boolDataAttr.ts
475
+ /** Value for a data attribute given a condition. */
514
476
  function boolDataAttr(condition) {
515
- return condition ? "" : void 0;
516
- }
517
- const preventDrag = {
518
- onKeyDown: (evt) => evt.stopPropagation(),
519
- onPointerDown: (evt) => evt.stopPropagation()
477
+ return condition ? "" : void 0;
478
+ }
479
+ //#endregion
480
+ //#region src/util/preventDrag.ts
481
+ /** Properties used to prevent an element from being dragged. */
482
+ var preventDrag = {
483
+ onKeyDown: (evt) => evt.stopPropagation(),
484
+ onPointerDown: (evt) => evt.stopPropagation()
520
485
  };
486
+ //#endregion
487
+ //#region src/schematicBuilders/util/ChildMarker.tsx
521
488
  function ChildMarker() {
522
- const { schematicKinds, useSchematic, setSchematic } = useSchematicBuilderContext();
523
- const kind = useSchematic((schematic) => schematic.kind);
524
- const collapsed = useSchematic((schematic) => schematic.collapsed);
525
- const Builder = schematicKinds.get(kind)?.builder;
526
- return Builder ? /* @__PURE__ */ jsx(
527
- "button",
528
- {
529
- type: "button",
530
- className: "builder-child-marker",
531
- title: collapsed ? "Expand" : "Collapse",
532
- onClick: () => setSchematic((schematic) => ({
533
- collapsed: !schematic.collapsed
534
- })),
535
- ...preventDrag,
536
- children: collapsed ? "▸" : "▾"
537
- }
538
- ) : /* @__PURE__ */ jsx("span", { className: "builder-child-marker", children: "•" });
539
- }
489
+ const { schematicKinds, useSchematic, setSchematic } = useSchematicBuilderContext();
490
+ const kind = useSchematic((schematic) => schematic.kind);
491
+ const collapsed = useSchematic((schematic) => schematic.collapsed);
492
+ return schematicKinds.get(kind)?.builder ? /* @__PURE__ */ jsx("button", {
493
+ type: "button",
494
+ className: "builder-child-marker",
495
+ title: collapsed ? "Expand" : "Collapse",
496
+ onClick: () => setSchematic((schematic) => ({ collapsed: !schematic.collapsed })),
497
+ ...preventDrag,
498
+ children: collapsed ? "▸" : "▾"
499
+ }) : /* @__PURE__ */ jsx("span", {
500
+ className: "builder-child-marker",
501
+ children: "•"
502
+ });
503
+ }
504
+ //#endregion
505
+ //#region src/schematicBuilders/util/ChildRemove.tsx
540
506
  function ChildRemove() {
541
- const { removeSchematic } = useSchematicBuilderContext();
542
- return /* @__PURE__ */ jsx(
543
- "button",
544
- {
545
- className: "builder-icon-button builder-child-remove",
546
- type: "button",
547
- title: "Remove",
548
- onClick: removeSchematic,
549
- ...preventDrag,
550
- children: "×"
551
- }
552
- );
553
- }
554
- const KIND_PLACEHOLDER = "--KIND--";
507
+ const { removeSchematic } = useSchematicBuilderContext();
508
+ return /* @__PURE__ */ jsx("button", {
509
+ className: "builder-icon-button builder-child-remove",
510
+ type: "button",
511
+ title: "Remove",
512
+ onClick: removeSchematic,
513
+ ...preventDrag,
514
+ children: "×"
515
+ });
516
+ }
517
+ //#endregion
518
+ //#region src/schematicBuilders/util/KindSelect.tsx
519
+ var KIND_PLACEHOLDER = "--KIND--";
555
520
  function KindSelect() {
556
- const { schematicKinds, useSchematic, setSchematic, parentChildName } = useSchematicBuilderContext();
557
- const kind = useSchematic((schematic) => schematic.kind);
558
- return /* @__PURE__ */ jsxs(
559
- "select",
560
- {
561
- className: "builder-input builder-schema",
562
- value: kind,
563
- onChange: (evt) => {
564
- const schematicKind = schematicKinds.get(evt.target.value);
565
- setSchematic({
566
- kind: evt.target.value,
567
- packageSuffix: schematicKind?.defaultPackageSuffix?.(
568
- parentChildName
569
- ),
570
- name: schematicKind?.defaultName?.(parentChildName),
571
- collapsed: false,
572
- nullable: schematicKind?.nullable ?? schematicKind?.defaultNullable,
573
- children: schematicKind?.initChildren?.(parentChildName)
574
- });
575
- },
576
- required: true,
577
- style: {
578
- width: `calc(${(kind || KIND_PLACEHOLDER).length}ch + 1.85rem)`
579
- },
580
- ...preventDrag,
581
- children: [
582
- /* @__PURE__ */ jsx("option", { children: KIND_PLACEHOLDER }),
583
- Array.from(schematicKinds.values()).filter((kind2) => !kind2.internal).map((kind2) => /* @__PURE__ */ jsx("option", { value: kind2.kind, children: kind2.kind }, kind2.kind))
584
- ]
585
- }
586
- );
587
- }
521
+ const { schematicKinds, useSchematic, setSchematic, parentChildName } = useSchematicBuilderContext();
522
+ const kind = useSchematic((schematic) => schematic.kind);
523
+ return /* @__PURE__ */ jsxs("select", {
524
+ className: "builder-input builder-schema",
525
+ value: kind,
526
+ onChange: (evt) => {
527
+ const schematicKind = schematicKinds.get(evt.target.value);
528
+ setSchematic({
529
+ kind: evt.target.value,
530
+ packageSuffix: schematicKind?.defaultPackageSuffix?.(parentChildName),
531
+ name: schematicKind?.defaultName?.(parentChildName),
532
+ collapsed: false,
533
+ nullable: schematicKind?.nullable ?? schematicKind?.defaultNullable,
534
+ children: schematicKind?.initChildren?.(parentChildName)
535
+ });
536
+ },
537
+ required: true,
538
+ style: { width: `calc(${(kind || KIND_PLACEHOLDER).length}ch + 1.85rem)` },
539
+ ...preventDrag,
540
+ children: [/* @__PURE__ */ jsx("option", { children: KIND_PLACEHOLDER }), Array.from(schematicKinds.values()).filter((kind) => !kind.internal).map((kind) => /* @__PURE__ */ jsx("option", {
541
+ value: kind.kind,
542
+ children: kind.kind
543
+ }, kind.kind))]
544
+ });
545
+ }
546
+ //#endregion
547
+ //#region src/schematicBuilders/util/NullableInput.tsx
588
548
  function NullableInput() {
589
- const { schematicKinds, useSchematic, setSchematic } = useSchematicBuilderContext();
590
- const kind = useSchematic((schematic) => schematic.kind);
591
- const nullable = useSchematic((schematic) => !!schematic.nullable);
592
- const schematicKind = schematicKinds.get(kind);
593
- const showInput = schematicKind && schematicKind.nullable === void 0;
594
- return showInput && /* @__PURE__ */ jsx(
595
- "input",
596
- {
597
- className: "builder-input builder-nullable",
598
- type: "checkbox",
599
- title: "Nullable?",
600
- checked: nullable,
601
- onChange: (evt) => setSchematic({ nullable: evt.target.checked }),
602
- ...preventDrag
603
- }
604
- );
605
- }
606
- const PACKAGE_PLACEHOLDER = "package.suffix";
607
- const NAME_PLACEHOLDER = "ClassName";
549
+ const { schematicKinds, useSchematic, setSchematic } = useSchematicBuilderContext();
550
+ const kind = useSchematic((schematic) => schematic.kind);
551
+ const nullable = useSchematic((schematic) => !!schematic.nullable);
552
+ const schematicKind = schematicKinds.get(kind);
553
+ return schematicKind && schematicKind.nullable === void 0 && /* @__PURE__ */ jsx("input", {
554
+ className: "builder-input builder-nullable",
555
+ type: "checkbox",
556
+ title: "Nullable?",
557
+ checked: nullable,
558
+ onChange: (evt) => setSchematic({ nullable: evt.target.checked }),
559
+ ...preventDrag
560
+ });
561
+ }
562
+ //#endregion
563
+ //#region src/schematicBuilders/util/PackageNameInput.tsx
564
+ var PACKAGE_PLACEHOLDER = "package.suffix";
565
+ var NAME_PLACEHOLDER = "ClassName";
608
566
  function PackageNameInput() {
609
- const { useSchematic, setSchematic, parentPackage } = useSchematicBuilderContext();
610
- const pkgRef = useRef(null);
611
- const packageSuffix = useSchematic((schematic) => schematic.packageSuffix);
612
- const name = useSchematic((schematic) => schematic.name);
613
- return /* @__PURE__ */ jsxs("div", { className: "builder-package-name", children: [
614
- parentPackage && /* @__PURE__ */ jsxs("span", { className: "builder-package-prefix", children: [
615
- parentPackage,
616
- "."
617
- ] }),
618
- /* @__PURE__ */ jsx(
619
- "input",
620
- {
621
- className: "builder-input builder-package",
622
- placeholder: PACKAGE_PLACEHOLDER,
623
- value: packageSuffix ?? "",
624
- onChange: (evt) => setSchematic({ packageSuffix: evt.target.value }),
625
- pattern: "(([a-z_][a-z0-9_]*)(\\.([a-z_][a-z0-9_]*))*)?",
626
- style: { width: `${(packageSuffix || PACKAGE_PLACEHOLDER).length}ch` },
627
- ...preventDrag,
628
- ref: pkgRef
629
- }
630
- ),
631
- /* @__PURE__ */ jsx(
632
- "button",
633
- {
634
- type: "button",
635
- className: "builder-icon-button builder-edit-package",
636
- onClick: () => {
637
- const pkgInput = pkgRef.current;
638
- pkgInput.style.display = "initial";
639
- pkgInput.focus();
640
- pkgInput.style.display = "";
641
- },
642
- children: "🖉"
643
- }
644
- ),
645
- /* @__PURE__ */ jsx("span", { className: "builder-operator", children: "." }),
646
- /* @__PURE__ */ jsx(
647
- "input",
648
- {
649
- className: "builder-input builder-name",
650
- placeholder: NAME_PLACEHOLDER,
651
- value: name ?? "",
652
- onChange: (evt) => setSchematic({ name: evt.target.value }),
653
- required: true,
654
- pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
655
- style: { width: `${(name || NAME_PLACEHOLDER).length}ch` },
656
- ...preventDrag
657
- }
658
- )
659
- ] });
660
- }
661
- const CLASS_DND_TYPE = "class-field";
567
+ const { useSchematic, setSchematic, parentPackage } = useSchematicBuilderContext();
568
+ const pkgRef = useRef(null);
569
+ const packageSuffix = useSchematic((schematic) => schematic.packageSuffix);
570
+ const name = useSchematic((schematic) => schematic.name);
571
+ return /* @__PURE__ */ jsxs("div", {
572
+ className: "builder-package-name",
573
+ children: [
574
+ parentPackage && /* @__PURE__ */ jsxs("span", {
575
+ className: "builder-package-prefix",
576
+ children: [parentPackage, "."]
577
+ }),
578
+ /* @__PURE__ */ jsx("input", {
579
+ className: "builder-input builder-package",
580
+ placeholder: PACKAGE_PLACEHOLDER,
581
+ value: packageSuffix ?? "",
582
+ onChange: (evt) => setSchematic({ packageSuffix: evt.target.value }),
583
+ pattern: "(([a-z_][a-z0-9_]*)(\\.([a-z_][a-z0-9_]*))*)?",
584
+ style: { width: `${(packageSuffix || PACKAGE_PLACEHOLDER).length}ch` },
585
+ ...preventDrag,
586
+ ref: pkgRef
587
+ }),
588
+ /* @__PURE__ */ jsx("button", {
589
+ type: "button",
590
+ className: "builder-icon-button builder-edit-package",
591
+ onClick: () => {
592
+ const pkgInput = pkgRef.current;
593
+ pkgInput.style.display = "initial";
594
+ pkgInput.focus();
595
+ pkgInput.style.display = "";
596
+ },
597
+ children: "🖉"
598
+ }),
599
+ /* @__PURE__ */ jsx("span", {
600
+ className: "builder-operator",
601
+ children: "."
602
+ }),
603
+ /* @__PURE__ */ jsx("input", {
604
+ className: "builder-input builder-name",
605
+ placeholder: NAME_PLACEHOLDER,
606
+ value: name ?? "",
607
+ onChange: (evt) => setSchematic({ name: evt.target.value }),
608
+ required: true,
609
+ pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
610
+ style: { width: `${(name || NAME_PLACEHOLDER).length}ch` },
611
+ ...preventDrag
612
+ })
613
+ ]
614
+ });
615
+ }
616
+ //#endregion
617
+ //#region src/schematicBuilders/ClassBuilder.tsx
618
+ var CLASS_DND_TYPE = "class-field";
662
619
  function ClassBuilder() {
663
- const schematicBuilderContext = useSchematicBuilderContext();
664
- const { useSchematic, setSchematic, draggedSchematic, disableDrop } = schematicBuilderContext;
665
- const id = useSchematic((schematic) => schematic.id);
666
- const packageSuffix = useSchematic((schematic) => schematic.packageSuffix);
667
- const fields = useSchematic((schematic) => schematic.children) ?? [];
668
- const shouldIgnoreDrop = draggedSchematic != null && draggedSchematic.id === fields.at(-1)?.id;
669
- const { setNodeRef: setDroppableRef, isOver } = useDroppable({
670
- id: `${id}-append`,
671
- data: { parentId: id, sortBefore: null, ignored: shouldIgnoreDrop },
672
- disabled: disableDrop || draggedSchematic?.type !== CLASS_DND_TYPE
673
- });
674
- return /* @__PURE__ */ jsxs("div", { className: "class-builder builder", children: [
675
- /* @__PURE__ */ jsx(PackageNameInput, {}),
676
- fields.length === 0 && /* @__PURE__ */ jsx(
677
- "div",
678
- {
679
- className: "builder-empty",
680
- "data-over": boolDataAttr(isOver),
681
- ref: setDroppableRef,
682
- children: "No fields."
683
- }
684
- ),
685
- fields.length > 0 && /* @__PURE__ */ jsxs("ul", { className: "builder-children", children: [
686
- fields.map((field, i) => /* @__PURE__ */ jsx(
687
- SchematicBuilderContext.Provider,
688
- {
689
- value: {
690
- ...schematicBuilderContext,
691
- useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[i])),
692
- setSchematic: (toSet) => setSchematic((schematic) => ({
693
- ...schematic,
694
- children: schematic.children.map(
695
- (f) => field === f ? {
696
- ...f,
697
- ...typeof toSet === "function" ? toSet(f) : toSet
698
- } : f
699
- )
700
- })),
701
- removeSchematic: () => setSchematic((schematic) => ({
702
- ...schematic,
703
- children: schematic.children.filter((f) => f !== field)
704
- })),
705
- parentPackage: joinPackages(
706
- schematicBuilderContext.parentPackage,
707
- packageSuffix
708
- ),
709
- parentId: id,
710
- ignoreDrop: draggedSchematic != null && draggedSchematic.id === fields[i - 1]?.id
711
- },
712
- children: /* @__PURE__ */ jsx(ClassFieldBuilder, {})
713
- },
714
- field.id
715
- )),
716
- /* @__PURE__ */ jsx(
717
- "li",
718
- {
719
- className: "builder-child-droppable",
720
- "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
721
- ref: setDroppableRef
722
- }
723
- )
724
- ] }),
725
- /* @__PURE__ */ jsx(
726
- "button",
727
- {
728
- className: "builder-input builder-new-child",
729
- type: "button",
730
- onClick: () => {
731
- setSchematic((schematic) => ({
732
- ...schematic,
733
- children: [
734
- ...schematic.children ?? [],
735
- createSchematic({ childName: "" })
736
- ]
737
- }));
738
- },
739
- ...preventDrag,
740
- children: "Add field"
741
- }
742
- )
743
- ] });
744
- }
745
- const CHILD_NAME_PLACEHOLDER$1 = "fieldName";
620
+ const schematicBuilderContext = useSchematicBuilderContext();
621
+ const { useSchematic, setSchematic, draggedSchematic, disableDrop } = schematicBuilderContext;
622
+ const id = useSchematic((schematic) => schematic.id);
623
+ const packageSuffix = useSchematic((schematic) => schematic.packageSuffix);
624
+ const fields = useSchematic((schematic) => schematic.children) ?? [];
625
+ const shouldIgnoreDrop = draggedSchematic != null && draggedSchematic.id === fields.at(-1)?.id;
626
+ const { setNodeRef: setDroppableRef, isOver } = useDroppable({
627
+ id: `${id}-append`,
628
+ data: {
629
+ parentId: id,
630
+ sortBefore: null,
631
+ ignored: shouldIgnoreDrop
632
+ },
633
+ disabled: disableDrop || draggedSchematic?.type !== "class-field"
634
+ });
635
+ return /* @__PURE__ */ jsxs("div", {
636
+ className: "class-builder builder",
637
+ children: [
638
+ /* @__PURE__ */ jsx(PackageNameInput, {}),
639
+ fields.length === 0 && /* @__PURE__ */ jsx("div", {
640
+ className: "builder-empty",
641
+ "data-over": boolDataAttr(isOver),
642
+ ref: setDroppableRef,
643
+ children: "No fields."
644
+ }),
645
+ fields.length > 0 && /* @__PURE__ */ jsxs("ul", {
646
+ className: "builder-children",
647
+ children: [fields.map((field, i) => /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
648
+ value: {
649
+ ...schematicBuilderContext,
650
+ useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[i])),
651
+ setSchematic: (toSet) => setSchematic((schematic) => ({
652
+ ...schematic,
653
+ children: schematic.children.map((f) => field === f ? {
654
+ ...f,
655
+ ...typeof toSet === "function" ? toSet(f) : toSet
656
+ } : f)
657
+ })),
658
+ removeSchematic: () => setSchematic((schematic) => ({
659
+ ...schematic,
660
+ children: schematic.children.filter((f) => f !== field)
661
+ })),
662
+ parentPackage: joinPackages(schematicBuilderContext.parentPackage, packageSuffix),
663
+ parentId: id,
664
+ ignoreDrop: draggedSchematic != null && draggedSchematic.id === fields[i - 1]?.id
665
+ },
666
+ children: /* @__PURE__ */ jsx(ClassFieldBuilder, {})
667
+ }, field.id)), /* @__PURE__ */ jsx("li", {
668
+ className: "builder-child-droppable",
669
+ "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
670
+ ref: setDroppableRef
671
+ })]
672
+ }),
673
+ /* @__PURE__ */ jsx("button", {
674
+ className: "builder-input builder-new-child",
675
+ type: "button",
676
+ onClick: () => {
677
+ setSchematic((schematic) => ({
678
+ ...schematic,
679
+ children: [...schematic.children ?? [], createSchematic({ childName: "" })]
680
+ }));
681
+ },
682
+ ...preventDrag,
683
+ children: "Add field"
684
+ })
685
+ ]
686
+ });
687
+ }
688
+ var CHILD_NAME_PLACEHOLDER$1 = "fieldName";
746
689
  function ClassFieldBuilder() {
747
- const schematicBuilderContext = useSchematicBuilderContext();
748
- const {
749
- schematicKinds,
750
- useSchematic,
751
- setSchematic,
752
- draggedSchematic,
753
- parentId,
754
- disableDrop,
755
- ignoreDrop
756
- } = schematicBuilderContext;
757
- const id = useSchematic((schematic) => schematic.id);
758
- const childName = useSchematic((schematic) => schematic.childName);
759
- const kind = useSchematic((schematic) => schematic.kind);
760
- const nullable = useSchematic((schematic) => schematic.nullable);
761
- const collapsed = useSchematic((schematic) => schematic.collapsed);
762
- const Builder = schematicKinds.get(kind)?.builder;
763
- const {
764
- attributes,
765
- listeners,
766
- setNodeRef: setDraggableRef,
767
- isDragging
768
- } = useDraggable({
769
- id,
770
- data: {
771
- type: CLASS_DND_TYPE,
772
- node: /* @__PURE__ */ jsxs(Fragment, { children: [
773
- [childName, kind].filter((s) => s).join(": "),
774
- nullable ? "?" : ""
775
- ] })
776
- }
777
- });
778
- const shouldIgnoreDrop = isDragging || ignoreDrop;
779
- const { setNodeRef: setDroppableRef, isOver } = useDroppable({
780
- id,
781
- data: { parentId, sortBefore: id, ignored: shouldIgnoreDrop },
782
- disabled: disableDrop || draggedSchematic?.type !== CLASS_DND_TYPE
783
- });
784
- return /* @__PURE__ */ jsxs(Fragment, { children: [
785
- /* @__PURE__ */ jsx(
786
- "li",
787
- {
788
- className: "builder-child-droppable",
789
- "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
790
- ref: setDroppableRef
791
- }
792
- ),
793
- /* @__PURE__ */ jsxs(
794
- "li",
795
- {
796
- className: "builder-child class-builder-field",
797
- "data-dragging": boolDataAttr(isDragging),
798
- ...listeners,
799
- ...attributes,
800
- ref: setDraggableRef,
801
- "data-collapsible": boolDataAttr(Builder != null),
802
- children: [
803
- /* @__PURE__ */ jsxs("div", { className: "builder-child-content", children: [
804
- /* @__PURE__ */ jsx(ChildMarker, {}),
805
- /* @__PURE__ */ jsx(
806
- "input",
807
- {
808
- className: "builder-input class-builder-field-id",
809
- placeholder: CHILD_NAME_PLACEHOLDER$1,
810
- value: childName,
811
- onChange: (evt) => setSchematic({ childName: evt.target.value }),
812
- required: true,
813
- pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
814
- style: {
815
- width: `${(childName || CHILD_NAME_PLACEHOLDER$1).length}ch`
816
- },
817
- ...preventDrag
818
- }
819
- ),
820
- /* @__PURE__ */ jsx("span", { className: "builder-operator", children: "∶" }),
821
- /* @__PURE__ */ jsx(
822
- SchematicBuilderContext.Provider,
823
- {
824
- value: { ...schematicBuilderContext, parentChildName: childName },
825
- children: /* @__PURE__ */ jsx(KindSelect, {})
826
- }
827
- ),
828
- /* @__PURE__ */ jsx(NullableInput, {}),
829
- /* @__PURE__ */ jsx(ChildRemove, {})
830
- ] }),
831
- Builder && !collapsed && /* @__PURE__ */ jsx(
832
- SchematicBuilderContext.Provider,
833
- {
834
- value: {
835
- ...schematicBuilderContext,
836
- parentChildName: childName,
837
- disableDrop: disableDrop || isDragging
838
- },
839
- children: /* @__PURE__ */ jsx(Builder, {})
840
- }
841
- )
842
- ]
843
- }
844
- )
845
- ] });
846
- }
847
- const ENUM_DND_TYPE = "enum-entry";
690
+ const schematicBuilderContext = useSchematicBuilderContext();
691
+ const { schematicKinds, useSchematic, setSchematic, draggedSchematic, parentId, disableDrop, ignoreDrop } = schematicBuilderContext;
692
+ const id = useSchematic((schematic) => schematic.id);
693
+ const childName = useSchematic((schematic) => schematic.childName);
694
+ const kind = useSchematic((schematic) => schematic.kind);
695
+ const nullable = useSchematic((schematic) => schematic.nullable);
696
+ const collapsed = useSchematic((schematic) => schematic.collapsed);
697
+ const Builder = schematicKinds.get(kind)?.builder;
698
+ const { attributes, listeners, setNodeRef: setDraggableRef, isDragging } = useDraggable({
699
+ id,
700
+ data: {
701
+ type: CLASS_DND_TYPE,
702
+ node: /* @__PURE__ */ jsxs(Fragment, { children: [[childName, kind].filter((s) => s).join(": "), nullable ? "?" : ""] })
703
+ }
704
+ });
705
+ const shouldIgnoreDrop = isDragging || ignoreDrop;
706
+ const { setNodeRef: setDroppableRef, isOver } = useDroppable({
707
+ id,
708
+ data: {
709
+ parentId,
710
+ sortBefore: id,
711
+ ignored: shouldIgnoreDrop
712
+ },
713
+ disabled: disableDrop || draggedSchematic?.type !== "class-field"
714
+ });
715
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("li", {
716
+ className: "builder-child-droppable",
717
+ "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
718
+ ref: setDroppableRef
719
+ }), /* @__PURE__ */ jsxs("li", {
720
+ className: "builder-child class-builder-field",
721
+ "data-dragging": boolDataAttr(isDragging),
722
+ ...listeners,
723
+ ...attributes,
724
+ ref: setDraggableRef,
725
+ "data-collapsible": boolDataAttr(Builder != null),
726
+ children: [/* @__PURE__ */ jsxs("div", {
727
+ className: "builder-child-content",
728
+ children: [
729
+ /* @__PURE__ */ jsx(ChildMarker, {}),
730
+ /* @__PURE__ */ jsx("input", {
731
+ className: "builder-input class-builder-field-id",
732
+ placeholder: CHILD_NAME_PLACEHOLDER$1,
733
+ value: childName,
734
+ onChange: (evt) => setSchematic({ childName: evt.target.value }),
735
+ required: true,
736
+ pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
737
+ style: { width: `${(childName || CHILD_NAME_PLACEHOLDER$1).length}ch` },
738
+ ...preventDrag
739
+ }),
740
+ /* @__PURE__ */ jsx("span", {
741
+ className: "builder-operator",
742
+ children: "∶"
743
+ }),
744
+ /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
745
+ value: {
746
+ ...schematicBuilderContext,
747
+ parentChildName: childName
748
+ },
749
+ children: /* @__PURE__ */ jsx(KindSelect, {})
750
+ }),
751
+ /* @__PURE__ */ jsx(NullableInput, {}),
752
+ /* @__PURE__ */ jsx(ChildRemove, {})
753
+ ]
754
+ }), Builder && !collapsed && /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
755
+ value: {
756
+ ...schematicBuilderContext,
757
+ parentChildName: childName,
758
+ disableDrop: disableDrop || isDragging
759
+ },
760
+ children: /* @__PURE__ */ jsx(Builder, {})
761
+ })]
762
+ })] });
763
+ }
764
+ //#endregion
765
+ //#region src/schematicBuilders/EnumBuilder.tsx
766
+ var ENUM_DND_TYPE = "enum-entry";
848
767
  function EnumBuilder() {
849
- const schematicBuilderContext = useSchematicBuilderContext();
850
- const { useSchematic, setSchematic, draggedSchematic, disableDrop } = schematicBuilderContext;
851
- const id = useSchematic((schematic) => schematic.id);
852
- const fields = useSchematic((schematic) => schematic.children) ?? [];
853
- const shouldIgnoreDrop = draggedSchematic != null && draggedSchematic.id === fields.at(-1)?.id;
854
- const { setNodeRef: setDroppableRef, isOver } = useDroppable({
855
- id: `${id}-append`,
856
- data: { parentId: id, sortBefore: null, ignored: shouldIgnoreDrop },
857
- disabled: disableDrop || draggedSchematic?.type !== ENUM_DND_TYPE
858
- });
859
- return /* @__PURE__ */ jsxs("div", { className: "enum-builder builder", children: [
860
- /* @__PURE__ */ jsx(PackageNameInput, {}),
861
- fields.length === 0 && /* @__PURE__ */ jsx(
862
- "div",
863
- {
864
- className: "builder-empty",
865
- "data-over": boolDataAttr(isOver),
866
- ref: setDroppableRef,
867
- children: "No entries."
868
- }
869
- ),
870
- fields.length > 0 && /* @__PURE__ */ jsxs("ul", { className: "builder-children", children: [
871
- fields.map((field, i) => /* @__PURE__ */ jsx(
872
- SchematicBuilderContext.Provider,
873
- {
874
- value: {
875
- ...schematicBuilderContext,
876
- useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[i])),
877
- setSchematic: (toSet) => setSchematic((schematic) => ({
878
- ...schematic,
879
- children: schematic.children.map(
880
- (f) => field === f ? {
881
- ...f,
882
- ...typeof toSet === "function" ? toSet(f) : toSet
883
- } : f
884
- )
885
- })),
886
- removeSchematic: () => setSchematic((schematic) => ({
887
- ...schematic,
888
- children: schematic.children.filter((f) => f !== field)
889
- })),
890
- parentId: id,
891
- ignoreDrop: draggedSchematic != null && draggedSchematic.id === fields[i - 1]?.id
892
- },
893
- children: /* @__PURE__ */ jsx(EnumEntryBuilder, {})
894
- },
895
- field.id
896
- )),
897
- /* @__PURE__ */ jsx(
898
- "li",
899
- {
900
- className: "builder-child-droppable",
901
- "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
902
- ref: setDroppableRef
903
- }
904
- )
905
- ] }),
906
- /* @__PURE__ */ jsx(
907
- "button",
908
- {
909
- className: "builder-input builder-new-child",
910
- type: "button",
911
- onClick: () => {
912
- setSchematic((schematic) => ({
913
- ...schematic,
914
- children: [
915
- ...schematic.children ?? [],
916
- createSchematic({ childName: "" })
917
- ]
918
- }));
919
- },
920
- ...preventDrag,
921
- children: "Add entry"
922
- }
923
- )
924
- ] });
925
- }
926
- const CHILD_NAME_PLACEHOLDER = "ENTRY_NAME";
768
+ const schematicBuilderContext = useSchematicBuilderContext();
769
+ const { useSchematic, setSchematic, draggedSchematic, disableDrop } = schematicBuilderContext;
770
+ const id = useSchematic((schematic) => schematic.id);
771
+ const fields = useSchematic((schematic) => schematic.children) ?? [];
772
+ const shouldIgnoreDrop = draggedSchematic != null && draggedSchematic.id === fields.at(-1)?.id;
773
+ const { setNodeRef: setDroppableRef, isOver } = useDroppable({
774
+ id: `${id}-append`,
775
+ data: {
776
+ parentId: id,
777
+ sortBefore: null,
778
+ ignored: shouldIgnoreDrop
779
+ },
780
+ disabled: disableDrop || draggedSchematic?.type !== "enum-entry"
781
+ });
782
+ return /* @__PURE__ */ jsxs("div", {
783
+ className: "enum-builder builder",
784
+ children: [
785
+ /* @__PURE__ */ jsx(PackageNameInput, {}),
786
+ fields.length === 0 && /* @__PURE__ */ jsx("div", {
787
+ className: "builder-empty",
788
+ "data-over": boolDataAttr(isOver),
789
+ ref: setDroppableRef,
790
+ children: "No entries."
791
+ }),
792
+ fields.length > 0 && /* @__PURE__ */ jsxs("ul", {
793
+ className: "builder-children",
794
+ children: [fields.map((field, i) => /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
795
+ value: {
796
+ ...schematicBuilderContext,
797
+ useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[i])),
798
+ setSchematic: (toSet) => setSchematic((schematic) => ({
799
+ ...schematic,
800
+ children: schematic.children.map((f) => field === f ? {
801
+ ...f,
802
+ ...typeof toSet === "function" ? toSet(f) : toSet
803
+ } : f)
804
+ })),
805
+ removeSchematic: () => setSchematic((schematic) => ({
806
+ ...schematic,
807
+ children: schematic.children.filter((f) => f !== field)
808
+ })),
809
+ parentId: id,
810
+ ignoreDrop: draggedSchematic != null && draggedSchematic.id === fields[i - 1]?.id
811
+ },
812
+ children: /* @__PURE__ */ jsx(EnumEntryBuilder, {})
813
+ }, field.id)), /* @__PURE__ */ jsx("li", {
814
+ className: "builder-child-droppable",
815
+ "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
816
+ ref: setDroppableRef
817
+ })]
818
+ }),
819
+ /* @__PURE__ */ jsx("button", {
820
+ className: "builder-input builder-new-child",
821
+ type: "button",
822
+ onClick: () => {
823
+ setSchematic((schematic) => ({
824
+ ...schematic,
825
+ children: [...schematic.children ?? [], createSchematic({ childName: "" })]
826
+ }));
827
+ },
828
+ ...preventDrag,
829
+ children: "Add entry"
830
+ })
831
+ ]
832
+ });
833
+ }
834
+ var CHILD_NAME_PLACEHOLDER = "ENTRY_NAME";
927
835
  function EnumEntryBuilder() {
928
- const schematicBuilderContext = useSchematicBuilderContext();
929
- const {
930
- schematicKinds,
931
- useSchematic,
932
- setSchematic,
933
- draggedSchematic,
934
- parentId,
935
- disableDrop,
936
- ignoreDrop
937
- } = schematicBuilderContext;
938
- const id = useSchematic((schematic) => schematic.id);
939
- const childName = useSchematic((schematic) => schematic.childName);
940
- const kind = useSchematic((schematic) => schematic.kind);
941
- const Builder = schematicKinds.get(kind)?.builder;
942
- const {
943
- attributes,
944
- listeners,
945
- setNodeRef: setDraggableRef,
946
- isDragging
947
- } = useDraggable({
948
- id,
949
- data: {
950
- type: ENUM_DND_TYPE,
951
- node: /* @__PURE__ */ jsx(Fragment, { children: [childName, kind].filter((s) => s).join(": ") })
952
- }
953
- });
954
- const shouldIgnoreDrop = isDragging || ignoreDrop;
955
- const { setNodeRef: setDroppableRef, isOver } = useDroppable({
956
- id,
957
- data: { parentId, sortBefore: id, ignored: shouldIgnoreDrop },
958
- disabled: disableDrop || draggedSchematic?.type !== ENUM_DND_TYPE
959
- });
960
- return /* @__PURE__ */ jsxs(Fragment, { children: [
961
- /* @__PURE__ */ jsx(
962
- "li",
963
- {
964
- className: "builder-child-droppable",
965
- "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
966
- ref: setDroppableRef
967
- }
968
- ),
969
- /* @__PURE__ */ jsx(
970
- "li",
971
- {
972
- className: "builder-child",
973
- "data-dragging": boolDataAttr(isDragging),
974
- ...listeners,
975
- ...attributes,
976
- ref: setDraggableRef,
977
- "data-collapsible": boolDataAttr(Builder != null),
978
- children: /* @__PURE__ */ jsxs("div", { className: "builder-child-content", children: [
979
- /* @__PURE__ */ jsx(ChildMarker, {}),
980
- /* @__PURE__ */ jsx(
981
- "input",
982
- {
983
- className: "builder-input enum-builder-entry-id",
984
- placeholder: CHILD_NAME_PLACEHOLDER,
985
- value: childName,
986
- onChange: (evt) => setSchematic({ childName: evt.target.value }),
987
- required: true,
988
- pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
989
- style: {
990
- width: `${(childName || CHILD_NAME_PLACEHOLDER).length}ch`
991
- },
992
- ...preventDrag
993
- }
994
- ),
995
- /* @__PURE__ */ jsx(ChildRemove, {})
996
- ] })
997
- }
998
- )
999
- ] });
1000
- }
1001
- function ListableBuilder({
1002
- showKindSelect = true
1003
- }) {
1004
- const schematicBuilderContext = useSchematicBuilderContext();
1005
- const { useSchematic, setSchematic } = schematicBuilderContext;
1006
- const id = useSchematic((schematic) => schematic.id);
1007
- return /* @__PURE__ */ jsx("div", { className: "listable-builder builder", children: /* @__PURE__ */ jsx(
1008
- SchematicBuilderContext.Provider,
1009
- {
1010
- value: {
1011
- ...schematicBuilderContext,
1012
- useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[0])),
1013
- setSchematic: (toSet) => setSchematic((schematic) => ({
1014
- ...schematic,
1015
- children: [
1016
- {
1017
- ...schematic.children[0],
1018
- ...typeof toSet === "function" ? toSet(schematic.children[0]) : toSet
1019
- }
1020
- ]
1021
- })),
1022
- removeSchematic: () => {
1023
- },
1024
- parentId: id
1025
- },
1026
- children: /* @__PURE__ */ jsx(ListableItemBuilder, { showKindSelect })
1027
- }
1028
- ) });
836
+ const { schematicKinds, useSchematic, setSchematic, draggedSchematic, parentId, disableDrop, ignoreDrop } = useSchematicBuilderContext();
837
+ const id = useSchematic((schematic) => schematic.id);
838
+ const childName = useSchematic((schematic) => schematic.childName);
839
+ const kind = useSchematic((schematic) => schematic.kind);
840
+ const Builder = schematicKinds.get(kind)?.builder;
841
+ const { attributes, listeners, setNodeRef: setDraggableRef, isDragging } = useDraggable({
842
+ id,
843
+ data: {
844
+ type: ENUM_DND_TYPE,
845
+ node: /* @__PURE__ */ jsx(Fragment, { children: [childName, kind].filter((s) => s).join(": ") })
846
+ }
847
+ });
848
+ const shouldIgnoreDrop = isDragging || ignoreDrop;
849
+ const { setNodeRef: setDroppableRef, isOver } = useDroppable({
850
+ id,
851
+ data: {
852
+ parentId,
853
+ sortBefore: id,
854
+ ignored: shouldIgnoreDrop
855
+ },
856
+ disabled: disableDrop || draggedSchematic?.type !== "enum-entry"
857
+ });
858
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("li", {
859
+ className: "builder-child-droppable",
860
+ "data-over": boolDataAttr(isOver && !shouldIgnoreDrop),
861
+ ref: setDroppableRef
862
+ }), /* @__PURE__ */ jsx("li", {
863
+ className: "builder-child",
864
+ "data-dragging": boolDataAttr(isDragging),
865
+ ...listeners,
866
+ ...attributes,
867
+ ref: setDraggableRef,
868
+ "data-collapsible": boolDataAttr(Builder != null),
869
+ children: /* @__PURE__ */ jsxs("div", {
870
+ className: "builder-child-content",
871
+ children: [
872
+ /* @__PURE__ */ jsx(ChildMarker, {}),
873
+ /* @__PURE__ */ jsx("input", {
874
+ className: "builder-input enum-builder-entry-id",
875
+ placeholder: CHILD_NAME_PLACEHOLDER,
876
+ value: childName,
877
+ onChange: (evt) => setSchematic({ childName: evt.target.value }),
878
+ required: true,
879
+ pattern: "[a-zA-Z_][a-zA-Z0-9_]*",
880
+ style: { width: `${(childName || CHILD_NAME_PLACEHOLDER).length}ch` },
881
+ ...preventDrag
882
+ }),
883
+ /* @__PURE__ */ jsx(ChildRemove, {})
884
+ ]
885
+ })
886
+ })] });
887
+ }
888
+ //#endregion
889
+ //#region src/schematicBuilders/ListableBuilder.tsx
890
+ function ListableBuilder({ showKindSelect = true }) {
891
+ const schematicBuilderContext = useSchematicBuilderContext();
892
+ const { useSchematic, setSchematic } = schematicBuilderContext;
893
+ const id = useSchematic((schematic) => schematic.id);
894
+ return /* @__PURE__ */ jsx("div", {
895
+ className: "listable-builder builder",
896
+ children: /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
897
+ value: {
898
+ ...schematicBuilderContext,
899
+ useSchematic: (selector) => useSchematic((schematic) => selector(schematic.children[0])),
900
+ setSchematic: (toSet) => setSchematic((schematic) => ({
901
+ ...schematic,
902
+ children: [{
903
+ ...schematic.children[0],
904
+ ...typeof toSet === "function" ? toSet(schematic.children[0]) : toSet
905
+ }]
906
+ })),
907
+ removeSchematic: () => {},
908
+ parentId: id
909
+ },
910
+ children: /* @__PURE__ */ jsx(ListableItemBuilder, { showKindSelect })
911
+ })
912
+ });
1029
913
  }
1030
914
  function ListableBuilderWithoutKindSelect() {
1031
- return /* @__PURE__ */ jsx(ListableBuilder, { showKindSelect: false });
1032
- }
1033
- function ListableItemBuilder({
1034
- showKindSelect = true
1035
- }) {
1036
- const { schematicKinds, useSchematic } = useSchematicBuilderContext();
1037
- const kind = useSchematic((schematic) => schematic.kind);
1038
- const Builder = schematicKinds.get(kind)?.builder;
1039
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1040
- showKindSelect && /* @__PURE__ */ jsx(KindSelect, {}),
1041
- Builder && /* @__PURE__ */ jsx(Builder, {})
1042
- ] });
1043
- }
1044
- const LF = /\r?\n/;
1045
- const EMPTY_LINE = /^\s*$/;
1046
- const SPACE = /\s/;
1047
- const LF_AFFIX = /(^\r?\n)|(\r?\n$)/g;
915
+ return /* @__PURE__ */ jsx(ListableBuilder, { showKindSelect: false });
916
+ }
917
+ function ListableItemBuilder({ showKindSelect = true }) {
918
+ const { schematicKinds, useSchematic } = useSchematicBuilderContext();
919
+ const kind = useSchematic((schematic) => schematic.kind);
920
+ const Builder = schematicKinds.get(kind)?.builder;
921
+ return /* @__PURE__ */ jsxs(Fragment, { children: [showKindSelect && /* @__PURE__ */ jsx(KindSelect, {}), Builder && /* @__PURE__ */ jsx(Builder, {})] });
922
+ }
923
+ //#endregion
924
+ //#region src/util/code.ts
925
+ var LF = /\r?\n/;
926
+ var EMPTY_LINE = /^\s*$/;
927
+ var SPACE = /\s/;
928
+ var LF_AFFIX = /(^\r?\n)|(\r?\n$)/g;
929
+ /** Tag function used to aid in the construction of code blocks. */
1048
930
  function code(strings, ...values) {
1049
- const minIndent = Math.min(
1050
- ...strings.join("").split(LF).filter(isNotEmpty).map(indentWidth)
1051
- );
1052
- let result = "";
1053
- for (let i = 0; i < values.length; ++i) {
1054
- const trimmedString = trimNoninitialLines(strings[i], minIndent);
1055
- result += trimmedString;
1056
- result += indentNoninitialLines(
1057
- String(values[i]),
1058
- indentWidth(trimmedString.split(LF).at(-1))
1059
- );
1060
- }
1061
- result += trimNoninitialLines(strings.at(-1), minIndent);
1062
- return result.replace(LF_AFFIX, "");
931
+ const minIndent = Math.min(...strings.join("").split(LF).filter(isNotEmpty).map(indentWidth));
932
+ let result = "";
933
+ for (let i = 0; i < values.length; ++i) {
934
+ const trimmedString = trimNoninitialLines(strings[i], minIndent);
935
+ result += trimmedString;
936
+ result += indentNoninitialLines(String(values[i]), indentWidth(trimmedString.split(LF).at(-1)));
937
+ }
938
+ result += trimNoninitialLines(strings.at(-1), minIndent);
939
+ return result.replace(LF_AFFIX, "");
1063
940
  }
1064
941
  function isNotEmpty(line) {
1065
- return !EMPTY_LINE.test(line);
942
+ return !EMPTY_LINE.test(line);
1066
943
  }
1067
944
  function indentWidth(line) {
1068
- let width = 0;
1069
- for (const c of line) {
1070
- if (!SPACE.test(c)) {
1071
- break;
1072
- }
1073
- ++width;
1074
- }
1075
- return width;
1076
- }
1077
- function indentNoninitialLines(str, indentWidth2) {
1078
- const lines = str.split(LF);
1079
- const resultLines = [lines[0]];
1080
- for (let i = 1; i < lines.length; ++i) {
1081
- const line = lines[i];
1082
- resultLines.push(line && " ".repeat(indentWidth2) + line);
1083
- }
1084
- return resultLines.join("\n");
1085
- }
1086
- function trimNoninitialLines(str, indentWidth2) {
1087
- const lines = str.split(LF);
1088
- const resultLines = [lines[0]];
1089
- for (let i = 1; i < lines.length; ++i) {
1090
- resultLines.push(lines[i].slice(indentWidth2));
1091
- }
1092
- return resultLines.join("\n");
1093
- }
1094
- const NULLABLE_SCHEMA = "tech.ostack.kform.schemas.NullableSchema";
1095
- const anySchematicKind = {
1096
- kind: "Any",
1097
- package: "kotlin",
1098
- name: "Any",
1099
- schema: "tech.ostack.kform.schemas.AnySchema",
1100
- nullable: false,
1101
- defaultValue: "null",
1102
- scaffoldType: () => "Any?"
945
+ let width = 0;
946
+ for (const c of line) {
947
+ if (!SPACE.test(c)) break;
948
+ ++width;
949
+ }
950
+ return width;
951
+ }
952
+ function indentNoninitialLines(str, indentWidth) {
953
+ const lines = str.split(LF);
954
+ const resultLines = [lines[0]];
955
+ for (let i = 1; i < lines.length; ++i) {
956
+ const line = lines[i];
957
+ resultLines.push(line && " ".repeat(indentWidth) + line);
958
+ }
959
+ return resultLines.join("\n");
960
+ }
961
+ function trimNoninitialLines(str, indentWidth) {
962
+ const lines = str.split(LF);
963
+ const resultLines = [lines[0]];
964
+ for (let i = 1; i < lines.length; ++i) resultLines.push(lines[i].slice(indentWidth));
965
+ return resultLines.join("\n");
966
+ }
967
+ //#endregion
968
+ //#region src/SchematicKind.ts
969
+ var NULLABLE_SCHEMA = "tech.ostack.kform.schemas.NullableSchema";
970
+ var anySchematicKind = {
971
+ kind: "Any",
972
+ package: "kotlin",
973
+ name: "Any",
974
+ schema: "tech.ostack.kform.schemas.AnySchema",
975
+ nullable: false,
976
+ defaultValue: "null",
977
+ scaffoldType: () => "Any?"
1103
978
  };
1104
- const bigDecimalSchematicKind = {
1105
- kind: "BigDecimal",
1106
- package: "tech.ostack.kform.datatypes",
1107
- name: "BigDecimal",
1108
- schema: "tech.ostack.kform.schemas.BigDecimalSchema",
1109
- defaultNullable: true,
1110
- defaultValue: "BigDecimal.ZERO"
979
+ var bigDecimalSchematicKind = {
980
+ kind: "BigDecimal",
981
+ package: "tech.ostack.kform.datatypes",
982
+ name: "BigDecimal",
983
+ schema: "tech.ostack.kform.schemas.BigDecimalSchema",
984
+ defaultNullable: true,
985
+ defaultValue: "BigDecimal.ZERO"
1111
986
  };
1112
- const bigIntegerSchematicKind = {
1113
- kind: "BigInteger",
1114
- package: "tech.ostack.kform.datatypes",
1115
- name: "BigInteger",
1116
- schema: "tech.ostack.kform.schemas.BigIntegerSchema",
1117
- defaultNullable: true,
1118
- defaultValue: "BigInteger.ZERO"
987
+ var bigIntegerSchematicKind = {
988
+ kind: "BigInteger",
989
+ package: "tech.ostack.kform.datatypes",
990
+ name: "BigInteger",
991
+ schema: "tech.ostack.kform.schemas.BigIntegerSchema",
992
+ defaultNullable: true,
993
+ defaultValue: "BigInteger.ZERO"
1119
994
  };
1120
- const booleanSchematicKind = {
1121
- kind: "Boolean",
1122
- package: "kotlin",
1123
- name: "Boolean",
1124
- schema: "tech.ostack.kform.schemas.BooleanSchema",
1125
- defaultValue: "false"
995
+ var booleanSchematicKind = {
996
+ kind: "Boolean",
997
+ package: "kotlin",
998
+ name: "Boolean",
999
+ schema: "tech.ostack.kform.schemas.BooleanSchema",
1000
+ defaultValue: "false"
1126
1001
  };
1127
- const byteSchematicKind = {
1128
- kind: "Byte",
1129
- package: "kotlin",
1130
- name: "Byte",
1131
- schema: "tech.ostack.kform.schemas.ByteSchema",
1132
- defaultNullable: true,
1133
- defaultValue: "0.toByte()"
1002
+ var byteSchematicKind = {
1003
+ kind: "Byte",
1004
+ package: "kotlin",
1005
+ name: "Byte",
1006
+ schema: "tech.ostack.kform.schemas.ByteSchema",
1007
+ defaultNullable: true,
1008
+ defaultValue: "0.toByte()"
1134
1009
  };
1135
- const charSchematicKind = {
1136
- kind: "Char",
1137
- package: "kotlin",
1138
- name: "Char",
1139
- schema: "tech.ostack.kform.schemas.CharSchema",
1140
- defaultNullable: true,
1141
- defaultValue: "0.toChar()"
1010
+ var charSchematicKind = {
1011
+ kind: "Char",
1012
+ package: "kotlin",
1013
+ name: "Char",
1014
+ schema: "tech.ostack.kform.schemas.CharSchema",
1015
+ defaultNullable: true,
1016
+ defaultValue: "0.toChar()"
1142
1017
  };
1143
- const classSchematicKind = {
1144
- kind: "Class",
1145
- schema: "tech.ostack.kform.schemas.ClassSchema",
1146
- defaultValue: (schematic) => `${schematic.name}()`,
1147
- builder: ClassBuilder,
1148
- initChildren: () => [],
1149
- defaultPackageSuffix: (childName) => childName.toLowerCase(),
1150
- defaultName: (childName) => pascalCase(childName),
1151
- scaffoldModel: (schematic, data) => code`
1018
+ var classSchematicKind = {
1019
+ kind: "Class",
1020
+ schema: "tech.ostack.kform.schemas.ClassSchema",
1021
+ defaultValue: (schematic) => `${schematic.name}()`,
1022
+ builder: ClassBuilder,
1023
+ initChildren: () => [],
1024
+ defaultPackageSuffix: (childName) => childName.toLowerCase(),
1025
+ defaultName: (childName) => pascalCase(childName),
1026
+ scaffoldModel: (schematic, data) => code`
1152
1027
  data class ${schematic.name}(
1153
1028
  ${schematic.children?.map((childSchematic) => {
1154
- const childData = {
1155
- ...data,
1156
- currentPath: joinPaths(
1157
- data.currentPath,
1158
- childSchematic.childName
1159
- )
1160
- };
1161
- return annotate(
1162
- scaffoldPropertyAnnotations(childSchematic, childData),
1163
- `var ${childSchematic.childName}: ${scaffoldType(
1164
- childSchematic,
1165
- childData
1166
- )} = ${scaffoldDefaultValue(childSchematic, childData)}`
1167
- );
1168
- }).join(",\n")}
1029
+ const childData = {
1030
+ ...data,
1031
+ currentPath: joinPaths(data.currentPath, childSchematic.childName)
1032
+ };
1033
+ return annotate(scaffoldPropertyAnnotations(childSchematic, childData), `var ${childSchematic.childName}: ${scaffoldType(childSchematic, childData)} = ${scaffoldDefaultValue(childSchematic, childData)}`);
1034
+ }).join(",\n")}
1169
1035
  )
1170
1036
  `,
1171
- scaffoldSchema: (schematic, data) => code`
1037
+ scaffoldSchema: (schematic, data) => code`
1172
1038
  ClassSchema {
1173
- ${schematic.children?.map(
1174
- (childSchematic) => `${schematic.name}::${childSchematic.childName} { ${scaffoldSchema(
1175
- childSchematic,
1176
- {
1177
- ...data,
1178
- currentPath: joinPaths(
1179
- data.currentPath,
1180
- childSchematic.childName
1181
- )
1182
- }
1183
- )} }`
1184
- ).join("\n")}
1039
+ ${schematic.children?.map((childSchematic) => `${schematic.name}::${childSchematic.childName} { ${scaffoldSchema(childSchematic, {
1040
+ ...data,
1041
+ currentPath: joinPaths(data.currentPath, childSchematic.childName)
1042
+ })} }`).join("\n")}
1185
1043
  }
1186
1044
  `
1187
1045
  };
1188
- const doubleSchematicKind = {
1189
- kind: "Double",
1190
- package: "kotlin",
1191
- name: "Double",
1192
- schema: "tech.ostack.kform.schemas.DoubleSchema",
1193
- defaultNullable: true,
1194
- defaultValue: "0.0"
1046
+ var doubleSchematicKind = {
1047
+ kind: "Double",
1048
+ package: "kotlin",
1049
+ name: "Double",
1050
+ schema: "tech.ostack.kform.schemas.DoubleSchema",
1051
+ defaultNullable: true,
1052
+ defaultValue: "0.0"
1195
1053
  };
1196
- const enumSchematicKind = {
1197
- kind: "Enum",
1198
- schema: "tech.ostack.kform.schemas.EnumSchema",
1199
- defaultNullable: true,
1200
- defaultValue: (schematic) => `${schematic.name}.${schematic.children?.[0].childName}`,
1201
- builder: EnumBuilder,
1202
- initChildren: () => [],
1203
- defaultName: (childName) => pascalCase(childName),
1204
- scaffoldModel: (schematic) => code`
1054
+ var enumSchematicKind = {
1055
+ kind: "Enum",
1056
+ schema: "tech.ostack.kform.schemas.EnumSchema",
1057
+ defaultNullable: true,
1058
+ defaultValue: (schematic) => `${schematic.name}.${schematic.children?.[0].childName}`,
1059
+ builder: EnumBuilder,
1060
+ initChildren: () => [],
1061
+ defaultName: (childName) => pascalCase(childName),
1062
+ scaffoldModel: (schematic) => code`
1205
1063
  enum class ${schematic.name} {
1206
1064
  ${schematic.children?.map((childSchematic) => childSchematic.childName).join(",\n")}
1207
1065
  }
1208
1066
  `
1209
1067
  };
1210
- const fileSchematicKind = {
1211
- kind: "File",
1212
- package: "tech.ostack.kform.datatypes",
1213
- name: "File",
1214
- schema: "tech.ostack.kform.schemas.FileSchema",
1215
- defaultNullable: true,
1216
- defaultValue: (_schematic, data) => {
1217
- data.currentFile.imports.add(
1218
- "tech.ostack.kform.datatypes.emptyPlaceholderFile"
1219
- );
1220
- return "emptyPlaceholderFile()";
1221
- },
1222
- propertyAnnotations: (_schematic, data) => data.useFileBase64Serializer ? "@Serializable(with = File.Base64Serializer::class)" : void 0
1068
+ var fileSchematicKind = {
1069
+ kind: "File",
1070
+ package: "tech.ostack.kform.datatypes",
1071
+ name: "File",
1072
+ schema: "tech.ostack.kform.schemas.FileSchema",
1073
+ defaultNullable: true,
1074
+ defaultValue: (_schematic, data) => {
1075
+ data.currentFile.imports.add("tech.ostack.kform.datatypes.emptyPlaceholderFile");
1076
+ return "emptyPlaceholderFile()";
1077
+ },
1078
+ propertyAnnotations: (_schematic, data) => data.useFileBase64Serializer ? "@Serializable(with = File.Base64Serializer::class)" : void 0
1223
1079
  };
1224
- const floatSchematicKind = {
1225
- kind: "Float",
1226
- package: "kotlin",
1227
- name: "Float",
1228
- schema: "tech.ostack.kform.schemas.FloatSchema",
1229
- defaultNullable: true,
1230
- defaultValue: "0f"
1080
+ var floatSchematicKind = {
1081
+ kind: "Float",
1082
+ package: "kotlin",
1083
+ name: "Float",
1084
+ schema: "tech.ostack.kform.schemas.FloatSchema",
1085
+ defaultNullable: true,
1086
+ defaultValue: "0f"
1231
1087
  };
1232
- const instantSchematicKind = {
1233
- kind: "Instant",
1234
- package: "kotlin.time",
1235
- name: "Instant",
1236
- schema: "tech.ostack.kform.schemas.InstantSchema",
1237
- defaultNullable: true,
1238
- defaultValue: "Instant.fromEpochMilliseconds(0)",
1239
- propertyAnnotations: (_schematic, data) => {
1240
- data.currentFile.imports.add("kotlin.OptIn").add("kotlin.time.ExperimentalTime");
1241
- return "@OptIn(ExperimentalTime::class)";
1242
- }
1088
+ var instantSchematicKind = {
1089
+ kind: "Instant",
1090
+ package: "kotlin.time",
1091
+ name: "Instant",
1092
+ schema: "tech.ostack.kform.schemas.InstantSchema",
1093
+ defaultNullable: true,
1094
+ defaultValue: "Instant.fromEpochMilliseconds(0)"
1243
1095
  };
1244
- const intSchematicKind = {
1245
- kind: "Int",
1246
- package: "kotlin",
1247
- name: "Int",
1248
- schema: "tech.ostack.kform.schemas.IntSchema",
1249
- defaultNullable: true,
1250
- defaultValue: "0"
1096
+ var intSchematicKind = {
1097
+ kind: "Int",
1098
+ package: "kotlin",
1099
+ name: "Int",
1100
+ schema: "tech.ostack.kform.schemas.IntSchema",
1101
+ defaultNullable: true,
1102
+ defaultValue: "0"
1251
1103
  };
1252
- const listSchematicKind = {
1253
- kind: "List",
1254
- package: "kotlin.collections",
1255
- name: "List",
1256
- schema: "tech.ostack.kform.schemas.ListSchema",
1257
- defaultValue: "emptyList()",
1258
- builder: ListableBuilder,
1259
- initChildren: () => [createSchematic()],
1260
- scaffoldType: (schematic, data) => `List<${scaffoldType(schematic.children[0], {
1261
- ...data,
1262
- currentPath: joinPaths(data.currentPath, "*")
1263
- })}>`,
1264
- scaffoldSchema: (schematic, data) => `ListSchema { ${scaffoldSchema(schematic.children[0], {
1265
- ...data,
1266
- currentPath: joinPaths(data.currentPath, "*")
1267
- })} }`
1104
+ var listSchematicKind = {
1105
+ kind: "List",
1106
+ package: "kotlin.collections",
1107
+ name: "List",
1108
+ schema: "tech.ostack.kform.schemas.ListSchema",
1109
+ defaultValue: "emptyList()",
1110
+ builder: ListableBuilder,
1111
+ initChildren: () => [createSchematic()],
1112
+ scaffoldType: (schematic, data) => `List<${scaffoldType(schematic.children[0], {
1113
+ ...data,
1114
+ currentPath: joinPaths(data.currentPath, "*")
1115
+ })}>`,
1116
+ scaffoldSchema: (schematic, data) => `ListSchema { ${scaffoldSchema(schematic.children[0], {
1117
+ ...data,
1118
+ currentPath: joinPaths(data.currentPath, "*")
1119
+ })} }`
1268
1120
  };
1269
- const localDateSchematicKind = {
1270
- kind: "LocalDate",
1271
- package: "kotlinx.datetime",
1272
- name: "LocalDate",
1273
- schema: "tech.ostack.kform.schemas.LocalDateSchema",
1274
- defaultNullable: true,
1275
- defaultValue: "LocalDate(1970, 1, 1)"
1121
+ var localDateSchematicKind = {
1122
+ kind: "LocalDate",
1123
+ package: "kotlinx.datetime",
1124
+ name: "LocalDate",
1125
+ schema: "tech.ostack.kform.schemas.LocalDateSchema",
1126
+ defaultNullable: true,
1127
+ defaultValue: "LocalDate(1970, 1, 1)"
1276
1128
  };
1277
- const localDateTimeSchematicKind = {
1278
- kind: "LocalDateTime",
1279
- package: "kotlinx.datetime",
1280
- name: "LocalDateTime",
1281
- schema: "tech.ostack.kform.schemas.LocalDateTimeSchema",
1282
- defaultNullable: true,
1283
- defaultValue: "LocalDateTime(1970, 1, 1, 0, 0)"
1129
+ var localDateTimeSchematicKind = {
1130
+ kind: "LocalDateTime",
1131
+ package: "kotlinx.datetime",
1132
+ name: "LocalDateTime",
1133
+ schema: "tech.ostack.kform.schemas.LocalDateTimeSchema",
1134
+ defaultNullable: true,
1135
+ defaultValue: "LocalDateTime(1970, 1, 1, 0, 0)"
1284
1136
  };
1285
- const longSchematicKind = {
1286
- kind: "Long",
1287
- package: "kotlin",
1288
- name: "Long",
1289
- schema: "tech.ostack.kform.schemas.LongSchema",
1290
- defaultNullable: true,
1291
- defaultValue: "0L"
1137
+ var longSchematicKind = {
1138
+ kind: "Long",
1139
+ package: "kotlin",
1140
+ name: "Long",
1141
+ schema: "tech.ostack.kform.schemas.LongSchema",
1142
+ defaultNullable: true,
1143
+ defaultValue: "0L"
1292
1144
  };
1293
- const shortSchematicKind = {
1294
- kind: "Short",
1295
- package: "kotlin",
1296
- name: "Short",
1297
- schema: "tech.ostack.kform.schemas.ShortSchema",
1298
- defaultNullable: true,
1299
- defaultValue: "0.toShort()"
1145
+ var shortSchematicKind = {
1146
+ kind: "Short",
1147
+ package: "kotlin",
1148
+ name: "Short",
1149
+ schema: "tech.ostack.kform.schemas.ShortSchema",
1150
+ defaultNullable: true,
1151
+ defaultValue: "0.toShort()"
1300
1152
  };
1301
- const stringSchematicKind = {
1302
- kind: "String",
1303
- package: "kotlin",
1304
- name: "String",
1305
- schema: "tech.ostack.kform.schemas.StringSchema",
1306
- defaultValue: '""'
1153
+ var stringSchematicKind = {
1154
+ kind: "String",
1155
+ package: "kotlin",
1156
+ name: "String",
1157
+ schema: "tech.ostack.kform.schemas.StringSchema",
1158
+ defaultValue: "\"\""
1307
1159
  };
1308
- const tableSchematicKind = {
1309
- kind: "Table",
1310
- package: "tech.ostack.kform.datatypes",
1311
- name: "Table",
1312
- schema: "tech.ostack.kform.schemas.TableSchema",
1313
- defaultValue: (_schematic, data) => {
1314
- data.currentFile.imports.add("tech.ostack.kform.datatypes.tableOf");
1315
- return "tableOf()";
1316
- },
1317
- builder: ListableBuilder,
1318
- initChildren: () => [createSchematic()],
1319
- propertyAnnotations: (_schematic, data) => data.useTableValuesSerializer ? "@Serializable(with = Table.ValuesSerializer::class)" : void 0,
1320
- scaffoldType: (schematic, data) => `Table<${scaffoldType(schematic.children[0], {
1321
- ...data,
1322
- currentPath: joinPaths(data.currentPath, "*")
1323
- })}>`,
1324
- scaffoldSchema: (schematic, data) => `TableSchema { ${scaffoldSchema(schematic.children[0], {
1325
- ...data,
1326
- currentPath: joinPaths(data.currentPath, "*")
1327
- })} }`
1160
+ var tableSchematicKind = {
1161
+ kind: "Table",
1162
+ package: "tech.ostack.kform.datatypes",
1163
+ name: "Table",
1164
+ schema: "tech.ostack.kform.schemas.TableSchema",
1165
+ defaultValue: (_schematic, data) => {
1166
+ data.currentFile.imports.add("tech.ostack.kform.datatypes.tableOf");
1167
+ return "tableOf()";
1168
+ },
1169
+ builder: ListableBuilder,
1170
+ initChildren: () => [createSchematic()],
1171
+ propertyAnnotations: (_schematic, data) => data.useTableValuesSerializer ? "@Serializable(with = Table.ValuesSerializer::class)" : void 0,
1172
+ scaffoldType: (schematic, data) => `Table<${scaffoldType(schematic.children[0], {
1173
+ ...data,
1174
+ currentPath: joinPaths(data.currentPath, "*")
1175
+ })}>`,
1176
+ scaffoldSchema: (schematic, data) => `TableSchema { ${scaffoldSchema(schematic.children[0], {
1177
+ ...data,
1178
+ currentPath: joinPaths(data.currentPath, "*")
1179
+ })} }`
1328
1180
  };
1329
- const defaultSchematicKinds = [
1330
- anySchematicKind,
1331
- bigDecimalSchematicKind,
1332
- bigIntegerSchematicKind,
1333
- booleanSchematicKind,
1334
- byteSchematicKind,
1335
- charSchematicKind,
1336
- classSchematicKind,
1337
- doubleSchematicKind,
1338
- enumSchematicKind,
1339
- fileSchematicKind,
1340
- floatSchematicKind,
1341
- instantSchematicKind,
1342
- intSchematicKind,
1343
- listSchematicKind,
1344
- localDateSchematicKind,
1345
- localDateTimeSchematicKind,
1346
- longSchematicKind,
1347
- shortSchematicKind,
1348
- stringSchematicKind,
1349
- tableSchematicKind
1181
+ var defaultSchematicKinds = [
1182
+ anySchematicKind,
1183
+ bigDecimalSchematicKind,
1184
+ bigIntegerSchematicKind,
1185
+ booleanSchematicKind,
1186
+ byteSchematicKind,
1187
+ charSchematicKind,
1188
+ classSchematicKind,
1189
+ doubleSchematicKind,
1190
+ enumSchematicKind,
1191
+ fileSchematicKind,
1192
+ floatSchematicKind,
1193
+ instantSchematicKind,
1194
+ intSchematicKind,
1195
+ listSchematicKind,
1196
+ localDateSchematicKind,
1197
+ localDateTimeSchematicKind,
1198
+ longSchematicKind,
1199
+ shortSchematicKind,
1200
+ stringSchematicKind,
1201
+ tableSchematicKind
1350
1202
  ];
1203
+ //#endregion
1204
+ //#region src/scaffolding/scaffolders/scaffoldSchemas.ts
1351
1205
  function scaffoldSchemas(schematic, data) {
1352
- const fileName = joinPaths(data.currentDir, `${schematic.name}Schema.kt`);
1353
- let file = data.files.get(fileName);
1354
- if (!file) {
1355
- data.files.set(fileName, file = ktFile(data));
1356
- data.files.set(
1357
- joinPaths(data.currentDir, `${schematic.name}Validations.kt`),
1358
- ktFile(data)
1359
- );
1360
- }
1361
- scaffoldSchemaDeclaration(schematic, { ...data, currentFile: file });
1206
+ const fileName = joinPaths(data.currentDir, `${schematic.name}Schema.kt`);
1207
+ let file = data.files.get(fileName);
1208
+ if (!file) {
1209
+ data.files.set(fileName, file = ktFile(data));
1210
+ data.files.set(joinPaths(data.currentDir, `${schematic.name}Validations.kt`), ktFile(data));
1211
+ }
1212
+ scaffoldSchemaDeclaration(schematic, {
1213
+ ...data,
1214
+ currentFile: file
1215
+ });
1362
1216
  }
1363
1217
  function scaffoldSchemaDeclaration(schematic, data) {
1364
- const schematicKind = data.schematicKinds.get(schematic.kind);
1365
- if (!schematicKind) {
1366
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
1367
- }
1368
- const nDecls = data.currentFile.declarations.length;
1369
- data.currentFile.declarations.push("");
1370
- const decl = `val ${schematic.name}Schema = ${schematicKind.scaffoldSchema?.(schematic, data) ?? `${simpleKtName(schematicKind.schema)}()`}`;
1371
- data.currentFile.imports.add(schematicKind.schema);
1372
- data.currentFile.declarations[nDecls] = data.currentPath === "/" ? jsExport(decl, data) : decl;
1218
+ const schematicKind = data.schematicKinds.get(schematic.kind);
1219
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
1220
+ const nDecls = data.currentFile.declarations.length;
1221
+ data.currentFile.declarations.push("");
1222
+ const decl = `val ${schematic.name}Schema = ${schematicKind.scaffoldSchema?.(schematic, data) ?? `${simpleKtName(schematicKind.schema)}()`}`;
1223
+ data.currentFile.imports.add(schematicKind.schema);
1224
+ data.currentFile.declarations[nDecls] = data.currentPath === "/" ? jsExport(decl, data) : decl;
1373
1225
  }
1374
1226
  function scaffoldSchema(schematic, data) {
1375
- const schematicKind = data.schematicKinds.get(schematic.kind);
1376
- if (!schematicKind) {
1377
- throw new Error(`Unknown schematic kind ${schematic.kind}`);
1378
- }
1379
- const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
1380
- let scaffoldedSchema;
1381
- if (schematicKind.package == null && schematicPackage !== data.currentPackage) {
1382
- scaffoldedSchema = `${schematic.name}Schema`;
1383
- data.currentFile.imports.add(`${schematicPackage}.${scaffoldedSchema}`);
1384
- scaffoldSchemas(schematic, {
1385
- ...data,
1386
- currentPackage: joinPackages(
1387
- data.currentPackage,
1388
- schematic.packageSuffix
1389
- ),
1390
- currentDir: joinPaths(
1391
- data.currentDir,
1392
- schematic.packageSuffix?.replace(".", "/")
1393
- )
1394
- });
1395
- } else {
1396
- scaffoldedSchema = schematicKind.scaffoldSchema?.(schematic, data) ?? `${simpleKtName(schematicKind.schema)}()`;
1397
- data.currentFile.imports.add(schematicKind.schema);
1398
- }
1399
- if (schematic.nullable) {
1400
- data.currentFile.imports.add(NULLABLE_SCHEMA);
1401
- return `${simpleKtName(NULLABLE_SCHEMA)} { ${scaffoldedSchema} }`;
1402
- }
1403
- return scaffoldedSchema;
1404
- }
1405
- const serializerKt = "package <%= filePackage %>\n\nimport kotlin.js.JsExport\nimport kotlin.jvm.JvmOverloads\nimport kotlinx.serialization.json.Json\n\n/** Base JSON configuration. */\nprivate val JSON_CONFIG = Json.Default\n/** Pretty JSON configuration. */\nprivate val JSON_CONFIG_PRETTY = Json(JSON_CONFIG) { prettyPrint = true }\n\n/** JSON configuration. */\n@JvmOverloads\nfun jsonConfig(prettyPrint: Boolean = false): Json =\n if (prettyPrint) JSON_CONFIG_PRETTY else JSON_CONFIG\n\n@JsExport\n@JvmOverloads\nfun encode<%= formClass %>ToString(<%= formVar %>: <%= formClass %>, prettyPrint: Boolean = false): String =\n jsonConfig(prettyPrint).encodeToString(<%= formVar %>)\n\n@JsExport\nfun decode<%= formClass %>FromString(json: String): <%= formClass %> =\n jsonConfig().decodeFromString(json)\n";
1227
+ const schematicKind = data.schematicKinds.get(schematic.kind);
1228
+ if (!schematicKind) throw new Error(`Unknown schematic kind ${schematic.kind}`);
1229
+ const schematicPackage = schematicKind.package ?? joinPackages(data.currentPackage, schematic.packageSuffix);
1230
+ let scaffoldedSchema;
1231
+ if (schematicKind.package == null && schematicPackage !== data.currentPackage) {
1232
+ scaffoldedSchema = `${schematic.name}Schema`;
1233
+ data.currentFile.imports.add(`${schematicPackage}.${scaffoldedSchema}`);
1234
+ scaffoldSchemas(schematic, {
1235
+ ...data,
1236
+ currentPackage: joinPackages(data.currentPackage, schematic.packageSuffix),
1237
+ currentDir: joinPaths(data.currentDir, schematic.packageSuffix?.replace(".", "/"))
1238
+ });
1239
+ } else {
1240
+ scaffoldedSchema = schematicKind.scaffoldSchema?.(schematic, data) ?? `${simpleKtName(schematicKind.schema)}()`;
1241
+ data.currentFile.imports.add(schematicKind.schema);
1242
+ }
1243
+ if (schematic.nullable) {
1244
+ data.currentFile.imports.add(NULLABLE_SCHEMA);
1245
+ return `${simpleKtName(NULLABLE_SCHEMA)} { ${scaffoldedSchema} }`;
1246
+ }
1247
+ return scaffoldedSchema;
1248
+ }
1249
+ //#endregion
1250
+ //#region src/scaffolding/templates/Serializer.kt.ejs?raw
1251
+ var Serializer_kt_default = "package <%= filePackage %>\n\nimport kotlin.js.JsExport\nimport kotlin.jvm.JvmOverloads\nimport kotlinx.serialization.json.Json\n\n/** Base JSON configuration. */\nprivate val JSON_CONFIG = Json.Default\n/** Pretty JSON configuration. */\nprivate val JSON_CONFIG_PRETTY = Json(JSON_CONFIG) { prettyPrint = true }\n\n/** JSON configuration. */\n@JvmOverloads\nfun jsonConfig(prettyPrint: Boolean = false): Json =\n if (prettyPrint) JSON_CONFIG_PRETTY else JSON_CONFIG\n\n@JsExport\n@JvmOverloads\nfun encode<%= formClass %>ToString(<%= formVar %>: <%= formClass %>, prettyPrint: Boolean = false): String =\n jsonConfig(prettyPrint).encodeToString(<%= formVar %>)\n\n@JsExport\nfun decode<%= formClass %>FromString(json: String): <%= formClass %> =\n jsonConfig().decodeFromString(json)\n";
1252
+ //#endregion
1253
+ //#region src/scaffolding/templating/EjsTemplateFile.ts
1406
1254
  function ejsTemplateFile(content, ejsData, { base64, binary, executable, ...ejsOptions } = {}) {
1407
- return {
1408
- content,
1409
- ejsData,
1410
- base64,
1411
- binary,
1412
- executable,
1413
- ejsOptions,
1414
- getContent: ejsTemplateFileContent
1415
- };
1255
+ return {
1256
+ content,
1257
+ ejsData,
1258
+ base64,
1259
+ binary,
1260
+ executable,
1261
+ ejsOptions,
1262
+ getContent: ejsTemplateFileContent
1263
+ };
1416
1264
  }
1417
1265
  function ejsTemplateFileContent() {
1418
- return render(this.content, this.ejsData, {
1419
- strict: true,
1420
- destructuredLocals: Object.keys(this.ejsData ?? {}),
1421
- ...this.ejsOptions
1422
- });
1423
- }
1266
+ return render(this.content, this.ejsData, {
1267
+ strict: true,
1268
+ destructuredLocals: Object.keys(this.ejsData ?? {}),
1269
+ ...this.ejsOptions
1270
+ });
1271
+ }
1272
+ //#endregion
1273
+ //#region src/scaffolding/templating/util/addEjsTemplateFile.ts
1424
1274
  function addEjsTemplateFile(data, fileName, content, ejsData, options) {
1425
- data.files.set(
1426
- joinPaths(data.currentDir, fileName),
1427
- ejsTemplateFile(content, ejsData, options)
1428
- );
1275
+ data.files.set(joinPaths(data.currentDir, fileName), ejsTemplateFile(content, ejsData, options));
1429
1276
  }
1277
+ //#endregion
1278
+ //#region src/scaffolding/scaffolders/scaffoldSerializer.ts
1430
1279
  function scaffoldSerializer(schematic, data) {
1431
- addEjsTemplateFile(data, `${schematic.name}Serializer.kt`, serializerKt, {
1432
- filePackage: data.currentPackage,
1433
- formVar: camelCase(schematic.name),
1434
- formClass: schematic.name
1435
- });
1436
- }
1437
- const validatorKt = "package <%= filePackage %>\n\nimport tech.ostack.kform.ExternalContexts\nimport tech.ostack.kform.FormValidator\nimport tech.ostack.kform.LocatedValidationError\nimport tech.ostack.kform.LocatedValidationWarning\nimport tech.ostack.kform.test.assertContainsMatchingIssue\nimport tech.ostack.kform.test.assertNotContainsMatchingIssue\n\nval <%= formVar %>Validator by lazy { FormValidator(<%= formClass %>Schema) }\n\nfun validate<%= formClass %>(\n <%= formVar %>: <%= formClass %>,\n path: String,\n externalContexts: ExternalContexts = emptyMap(),\n) = <%= formVar %>Validator.validate(<%= formVar %>, path, externalContexts)\n\nsuspend fun assert<%= formClass %>ContainsError(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertContainsMatchingIssue(\n LocatedValidationError(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>NotContainsError(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertNotContainsMatchingIssue(\n LocatedValidationError(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>ContainsWarning(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertContainsMatchingIssue(\n LocatedValidationWarning(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>NotContainsWarning(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertNotContainsMatchingIssue(\n LocatedValidationWarning(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n";
1280
+ addEjsTemplateFile(data, `${schematic.name}Serializer.kt`, Serializer_kt_default, {
1281
+ filePackage: data.currentPackage,
1282
+ formVar: camelCase(schematic.name),
1283
+ formClass: schematic.name
1284
+ });
1285
+ }
1286
+ //#endregion
1287
+ //#region src/scaffolding/templates/Validator.kt.ejs?raw
1288
+ var Validator_kt_default = "package <%= filePackage %>\n\nimport tech.ostack.kform.ExternalContexts\nimport tech.ostack.kform.FormValidator\nimport tech.ostack.kform.LocatedValidationError\nimport tech.ostack.kform.LocatedValidationWarning\nimport tech.ostack.kform.test.assertContainsMatchingIssue\nimport tech.ostack.kform.test.assertNotContainsMatchingIssue\n\nval <%= formVar %>Validator by lazy { FormValidator(<%= formClass %>Schema) }\n\nfun validate<%= formClass %>(\n <%= formVar %>: <%= formClass %>,\n path: String,\n externalContexts: ExternalContexts = emptyMap(),\n) = <%= formVar %>Validator.validate(<%= formVar %>, path, externalContexts)\n\nsuspend fun assert<%= formClass %>ContainsError(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertContainsMatchingIssue(\n LocatedValidationError(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>NotContainsError(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertNotContainsMatchingIssue(\n LocatedValidationError(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>ContainsWarning(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertContainsMatchingIssue(\n LocatedValidationWarning(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n\nsuspend fun assert<%= formClass %>NotContainsWarning(\n path: String,\n code: String,\n <%= formVar %>: <%= formClass %>,\n externalContexts: ExternalContexts = emptyMap(),\n) =\n assertNotContainsMatchingIssue(\n LocatedValidationWarning(path, code),\n validate<%= formClass %>(<%= formVar %>, path, externalContexts),\n )\n";
1289
+ //#endregion
1290
+ //#region src/scaffolding/scaffolders/scaffoldValidator.ts
1438
1291
  function scaffoldValidator(schematic, data) {
1439
- addEjsTemplateFile(data, `${schematic.name}Validator.kt`, validatorKt, {
1440
- filePackage: data.currentPackage,
1441
- formVar: camelCase(schematic.name),
1442
- formClass: schematic.name
1443
- });
1444
- }
1445
- const useLayoutEffect = typeof document !== "undefined" ? useLayoutEffect$1 : () => {
1446
- };
1292
+ addEjsTemplateFile(data, `${schematic.name}Validator.kt`, Validator_kt_default, {
1293
+ filePackage: data.currentPackage,
1294
+ formVar: camelCase(schematic.name),
1295
+ formClass: schematic.name
1296
+ });
1297
+ }
1298
+ //#endregion
1299
+ //#region src/util/useLayoutEffect.ts
1300
+ /** `useLayoutEffect` hook which performs a noop when run on the server. */
1301
+ var useLayoutEffect$1 = typeof document !== "undefined" ? useLayoutEffect : () => {};
1302
+ //#endregion
1303
+ //#region src/util/useMeasure.ts
1304
+ /**
1305
+ * Hook that tracks the dimensions of an HTML element using the Resize Observer
1306
+ * API + window resize.
1307
+ */
1447
1308
  function useMeasure(element, setMeasurement) {
1448
- useLayoutEffect(() => {
1449
- if (!element) {
1450
- setMeasurement(void 0);
1451
- return;
1452
- }
1453
- const cb = () => setMeasurement(element.getBoundingClientRect());
1454
- cb();
1455
- const observer = new ResizeObserver(([entry]) => entry && cb());
1456
- observer.observe(element);
1457
- window.addEventListener("resize", cb);
1458
- return () => {
1459
- observer.disconnect();
1460
- window.removeEventListener("resize", cb);
1461
- setMeasurement(void 0);
1462
- };
1463
- }, [element, setMeasurement]);
1464
- }
1465
- function SchematicBuilderConfig({
1466
- children
1467
- }) {
1468
- const [anchorEl, setAnchorEl] = useState(null);
1469
- const [popoverEl, setPopoverEl] = useState(null);
1470
- useMeasure(anchorEl, (measurement) => {
1471
- if (popoverEl && measurement) {
1472
- popoverEl.style.setProperty("--anchor-top", `${measurement.top}px`);
1473
- popoverEl.style.setProperty("--anchor-left", `${measurement.left}px`);
1474
- popoverEl.style.setProperty("--anchor-bottom", `${measurement.bottom}px`);
1475
- popoverEl.style.setProperty("--anchor-right", `${measurement.right}px`);
1476
- popoverEl.style.setProperty("--anchor-width", `${measurement.width}px`);
1477
- popoverEl.style.setProperty("--anchor-height", `${measurement.height}px`);
1478
- }
1479
- });
1480
- useMeasure(popoverEl, (measurement) => {
1481
- if (popoverEl && measurement) {
1482
- popoverEl.style.setProperty("--width", `${measurement.width}px`);
1483
- popoverEl.style.setProperty("--height", `${measurement.height}px`);
1484
- }
1485
- });
1486
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1487
- /* @__PURE__ */ jsx(
1488
- "button",
1489
- {
1490
- type: "button",
1491
- className: "builder-icon-button builder-action builder-config-schematic",
1492
- popoverTarget: "builder-config-popover",
1493
- title: "Config",
1494
- "aria-label": "Config",
1495
- ref: setAnchorEl,
1496
- children: "⚙️"
1497
- }
1498
- ),
1499
- /* @__PURE__ */ jsx("div", { popover: "", id: "builder-config-popover", ref: setPopoverEl, children })
1500
- ] });
1501
- }
1502
- const kotlinMainData = {
1503
- currentDir: "shared/src/commonMain/kotlin"
1504
- };
1505
- const kotlinTestData = {
1506
- currentDir: "shared/src/commonTest/kotlin"
1507
- };
1508
- function SchematicBuilder({
1509
- name = "kform",
1510
- title = document.title,
1511
- basePath,
1512
- basePackage,
1513
- baseDir,
1514
- defaultRootClassPackage = "org.example",
1515
- defaultRootClassName = "MyForm",
1516
- schematicKinds = defaultSchematicKinds,
1517
- scaffolders = [
1518
- configScaffolder(scaffoldSchemas, kotlinMainData),
1519
- configScaffolder(scaffoldModels, kotlinMainData),
1520
- configScaffolder(scaffoldSerializer, kotlinMainData),
1521
- configScaffolder(scaffoldValidator, kotlinTestData)
1522
- ],
1523
- scaffoldingData = (schematic) => schematic.config,
1524
- actions = /* @__PURE__ */ jsxs(Fragment, { children: [
1525
- /* @__PURE__ */ jsx(LoadSchematic, {}),
1526
- /* @__PURE__ */ jsx(SaveSchematic, {}),
1527
- /* @__PURE__ */ jsx(ScaffoldToZip, {})
1528
- ] }),
1529
- configs = /* @__PURE__ */ jsxs(Fragment, { children: [
1530
- /* @__PURE__ */ jsx(UseFileBase64SerializerConfig, {}),
1531
- /* @__PURE__ */ jsx(UseTableValuesSerializerConfig, {})
1532
- ] }),
1533
- version = "0.32.5"
1534
- }) {
1535
- const [useSchematic] = useState(
1536
- () => create(
1537
- persist(
1538
- () => createSchematic({
1539
- kind: classSchematicKind.kind,
1540
- packageSuffix: defaultRootClassPackage,
1541
- name: defaultRootClassName,
1542
- children: []
1543
- }),
1544
- { name }
1545
- )
1546
- )
1547
- );
1548
- const schematicKindsMap = useMemo(
1549
- () => new Map(
1550
- schematicKinds.sort((t1, t2) => t1.kind.localeCompare(t2.kind)).map((t) => [t.kind, t])
1551
- ),
1552
- [schematicKinds]
1553
- );
1554
- const latestSchematicFileHandleRef = useRef(
1555
- null
1556
- );
1557
- const [draggedSchematic, setDraggedSchematic] = useState(null);
1558
- const sensors = useSensors(
1559
- useSensor(PointerSensor, {
1560
- activationConstraint: { distance: 10, delay: 400, tolerance: 20 }
1561
- }),
1562
- useSensor(KeyboardSensor)
1563
- );
1564
- return /* @__PURE__ */ jsx(
1565
- SchematicBuilderContext.Provider,
1566
- {
1567
- value: {
1568
- name,
1569
- basePath,
1570
- basePackage,
1571
- baseDir,
1572
- schematicKinds: schematicKindsMap,
1573
- scaffolders,
1574
- scaffoldingData,
1575
- getRootSchematic: useSchematic.getState,
1576
- useSchematic,
1577
- // eslint-disable-next-line @typescript-eslint/unbound-method
1578
- setSchematic: useSchematic.setState,
1579
- removeSchematic: () => {
1580
- },
1581
- parentPackage: basePackage,
1582
- draggedSchematic,
1583
- latestSchematicFileHandleRef
1584
- },
1585
- children: /* @__PURE__ */ jsxs(
1586
- DndContext,
1587
- {
1588
- sensors,
1589
- collisionDetection: closestCenter,
1590
- onDragStart: (evt) => setDraggedSchematic({
1591
- id: evt.active.id,
1592
- ...evt.active.data.current
1593
- }),
1594
- onDragEnd: (evt) => {
1595
- const { parentId, sortBefore, ignored } = evt.over?.data.current ?? {};
1596
- if (!ignored) {
1597
- useSchematic.setState(
1598
- (schematic) => moveSchematic(
1599
- schematic,
1600
- evt.active.id,
1601
- parentId,
1602
- sortBefore
1603
- )
1604
- );
1605
- }
1606
- setDraggedSchematic(null);
1607
- },
1608
- children: [
1609
- /* @__PURE__ */ jsxs("form", { className: "builder-root", children: [
1610
- /* @__PURE__ */ jsxs("header", { className: "builder-header", children: [
1611
- /* @__PURE__ */ jsx("h1", { className: "builder-title", children: title }),
1612
- version && /* @__PURE__ */ jsx("div", { className: "builder-version", children: version }),
1613
- /* @__PURE__ */ jsxs("div", { className: "builder-actions", children: [
1614
- configs && /* @__PURE__ */ jsx(SchematicBuilderConfig, { children: configs }),
1615
- actions
1616
- ] })
1617
- ] }),
1618
- /* @__PURE__ */ jsx(ClassBuilder, {})
1619
- ] }),
1620
- /* @__PURE__ */ jsx(DragOverlay, { children: draggedSchematic && /* @__PURE__ */ jsx("div", { className: "builder-dragged", children: draggedSchematic.node }) })
1621
- ]
1622
- }
1623
- )
1624
- }
1625
- );
1626
- }
1309
+ useLayoutEffect$1(() => {
1310
+ if (!element) {
1311
+ setMeasurement(void 0);
1312
+ return;
1313
+ }
1314
+ const cb = () => setMeasurement(element.getBoundingClientRect());
1315
+ cb();
1316
+ const observer = new ResizeObserver(([entry]) => entry && cb());
1317
+ observer.observe(element);
1318
+ window.addEventListener("resize", cb);
1319
+ return () => {
1320
+ observer.disconnect();
1321
+ window.removeEventListener("resize", cb);
1322
+ setMeasurement(void 0);
1323
+ };
1324
+ }, [element, setMeasurement]);
1325
+ }
1326
+ //#endregion
1327
+ //#region src/SchematicBuilderConfig.tsx
1328
+ function SchematicBuilderConfig({ children }) {
1329
+ const [anchorEl, setAnchorEl] = useState(null);
1330
+ const [popoverEl, setPopoverEl] = useState(null);
1331
+ useMeasure(anchorEl, (measurement) => {
1332
+ if (popoverEl && measurement) {
1333
+ popoverEl.style.setProperty("--anchor-top", `${measurement.top}px`);
1334
+ popoverEl.style.setProperty("--anchor-left", `${measurement.left}px`);
1335
+ popoverEl.style.setProperty("--anchor-bottom", `${measurement.bottom}px`);
1336
+ popoverEl.style.setProperty("--anchor-right", `${measurement.right}px`);
1337
+ popoverEl.style.setProperty("--anchor-width", `${measurement.width}px`);
1338
+ popoverEl.style.setProperty("--anchor-height", `${measurement.height}px`);
1339
+ }
1340
+ });
1341
+ useMeasure(popoverEl, (measurement) => {
1342
+ if (popoverEl && measurement) {
1343
+ popoverEl.style.setProperty("--width", `${measurement.width}px`);
1344
+ popoverEl.style.setProperty("--height", `${measurement.height}px`);
1345
+ }
1346
+ });
1347
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
1348
+ type: "button",
1349
+ className: "builder-icon-button builder-action builder-config-schematic",
1350
+ popoverTarget: "builder-config-popover",
1351
+ title: "Config",
1352
+ "aria-label": "Config",
1353
+ ref: setAnchorEl,
1354
+ children: "⚙️"
1355
+ }), /* @__PURE__ */ jsx("div", {
1356
+ popover: "",
1357
+ id: "builder-config-popover",
1358
+ ref: setPopoverEl,
1359
+ children
1360
+ })] });
1361
+ }
1362
+ //#endregion
1363
+ //#region src/SchematicBuilder.tsx
1364
+ var kotlinMainData = { currentDir: "shared/src/commonMain/kotlin" };
1365
+ var kotlinTestData = { currentDir: "shared/src/commonTest/kotlin" };
1366
+ function SchematicBuilder({ name = "kform", title = document.title, basePath, basePackage, baseDir, defaultRootClassPackage = "org.example", defaultRootClassName = "MyForm", schematicKinds = defaultSchematicKinds, scaffolders = [
1367
+ configScaffolder(scaffoldSchemas, kotlinMainData),
1368
+ configScaffolder(scaffoldModels, kotlinMainData),
1369
+ configScaffolder(scaffoldSerializer, kotlinMainData),
1370
+ configScaffolder(scaffoldValidator, kotlinTestData)
1371
+ ], scaffoldingData = (schematic) => schematic.config, actions = /* @__PURE__ */ jsxs(Fragment, { children: [
1372
+ /* @__PURE__ */ jsx(LoadSchematic, {}),
1373
+ /* @__PURE__ */ jsx(SaveSchematic, {}),
1374
+ /* @__PURE__ */ jsx(ScaffoldToZip, {})
1375
+ ] }), configs = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(UseFileBase64SerializerConfig, {}), /* @__PURE__ */ jsx(UseTableValuesSerializerConfig, {})] }), version = "0.33.0-SNAPSHOT" }) {
1376
+ const [useSchematic] = useState(() => create(persist(() => createSchematic({
1377
+ kind: classSchematicKind.kind,
1378
+ packageSuffix: defaultRootClassPackage,
1379
+ name: defaultRootClassName,
1380
+ children: []
1381
+ }), { name })));
1382
+ const schematicKindsMap = useMemo(() => new Map(schematicKinds.sort((t1, t2) => t1.kind.localeCompare(t2.kind)).map((t) => [t.kind, t])), [schematicKinds]);
1383
+ const latestSchematicFileHandleRef = useRef(null);
1384
+ const [draggedSchematic, setDraggedSchematic] = useState(null);
1385
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: {
1386
+ distance: 10,
1387
+ delay: 400,
1388
+ tolerance: 20
1389
+ } }), useSensor(KeyboardSensor));
1390
+ return /* @__PURE__ */ jsx(SchematicBuilderContext.Provider, {
1391
+ value: {
1392
+ name,
1393
+ basePath,
1394
+ basePackage,
1395
+ baseDir,
1396
+ schematicKinds: schematicKindsMap,
1397
+ scaffolders,
1398
+ scaffoldingData,
1399
+ getRootSchematic: useSchematic.getState,
1400
+ useSchematic,
1401
+ setSchematic: useSchematic.setState,
1402
+ removeSchematic: () => {},
1403
+ parentPackage: basePackage,
1404
+ draggedSchematic,
1405
+ latestSchematicFileHandleRef
1406
+ },
1407
+ children: /* @__PURE__ */ jsxs(DndContext, {
1408
+ sensors,
1409
+ collisionDetection: closestCenter,
1410
+ onDragStart: (evt) => setDraggedSchematic({
1411
+ id: evt.active.id,
1412
+ ...evt.active.data.current
1413
+ }),
1414
+ onDragEnd: (evt) => {
1415
+ const { parentId, sortBefore, ignored } = evt.over?.data.current ?? {};
1416
+ if (!ignored) useSchematic.setState((schematic) => moveSchematic(schematic, evt.active.id, parentId, sortBefore));
1417
+ setDraggedSchematic(null);
1418
+ },
1419
+ children: [/* @__PURE__ */ jsxs("form", {
1420
+ className: "builder-root",
1421
+ children: [/* @__PURE__ */ jsxs("header", {
1422
+ className: "builder-header",
1423
+ children: [
1424
+ /* @__PURE__ */ jsx("h1", {
1425
+ className: "builder-title",
1426
+ children: title
1427
+ }),
1428
+ version && /* @__PURE__ */ jsx("div", {
1429
+ className: "builder-version",
1430
+ children: version
1431
+ }),
1432
+ /* @__PURE__ */ jsxs("div", {
1433
+ className: "builder-actions",
1434
+ children: [configs && /* @__PURE__ */ jsx(SchematicBuilderConfig, { children: configs }), actions]
1435
+ })
1436
+ ]
1437
+ }), /* @__PURE__ */ jsx(ClassBuilder, {})]
1438
+ }), /* @__PURE__ */ jsx(DragOverlay, { children: draggedSchematic && /* @__PURE__ */ jsx("div", {
1439
+ className: "builder-dragged",
1440
+ children: draggedSchematic.node
1441
+ }) })]
1442
+ })
1443
+ });
1444
+ }
1445
+ //#endregion
1446
+ //#region src/scaffolding/templating/TemplateFile.ts
1627
1447
  function templateFile(content, options) {
1628
- return {
1629
- ...options,
1630
- content,
1631
- getContent: templateFileContent
1632
- };
1448
+ return {
1449
+ ...options,
1450
+ content,
1451
+ getContent: templateFileContent
1452
+ };
1633
1453
  }
1634
1454
  function templateFileContent() {
1635
- return this.content;
1455
+ return this.content;
1636
1456
  }
1457
+ //#endregion
1458
+ //#region src/scaffolding/templating/util/addTemplateFile.ts
1637
1459
  function addTemplateFile(data, fileName, content, options) {
1638
- data.files.set(
1639
- joinPaths(data.currentDir, fileName),
1640
- templateFile(content, options)
1641
- );
1460
+ data.files.set(joinPaths(data.currentDir, fileName), templateFile(content, options));
1642
1461
  }
1462
+ //#endregion
1463
+ //#region src/scaffolding/typescript/TsFile.ts
1643
1464
  function tsFile() {
1644
- return {
1645
- imports: [],
1646
- declarations: [],
1647
- getContent: tsFileContent
1648
- };
1465
+ return {
1466
+ imports: [],
1467
+ declarations: [],
1468
+ getContent: tsFileContent
1469
+ };
1649
1470
  }
1650
1471
  function tsFileContent() {
1651
- const importStatements = tsImportsToStatements(this.imports);
1652
- return [
1653
- // Imports
1654
- importStatements.sort((i1, i2) => i1.moduleName.localeCompare(i2.moduleName)).map((i) => tsImportStatementToString(i)).join("\n"),
1655
- // Declarations
1656
- ...this.declarations
1657
- ].filter((s) => s).join("\n\n") + "\n";
1472
+ return [tsImportsToStatements(this.imports).sort((i1, i2) => i1.moduleName.localeCompare(i2.moduleName)).map((i) => tsImportStatementToString(i)).join("\n"), ...this.declarations].filter((s) => s).join("\n\n") + "\n";
1658
1473
  }
1659
1474
  function tsImportsToStatements(imports) {
1660
- const importsStatements = /* @__PURE__ */ new Map();
1661
- for (const imp of imports) {
1662
- let statement = importsStatements.get(imp.moduleName);
1663
- if (!statement) {
1664
- importsStatements.set(
1665
- imp.moduleName,
1666
- statement = { moduleName: imp.moduleName }
1667
- );
1668
- }
1669
- if (imp.isDefault) {
1670
- statement.defaultImport = imp.name;
1671
- } else if (imp.isNamespace) {
1672
- statement.namespaceImport = imp.name;
1673
- } else if (imp.isType) {
1674
- (statement.typedImports ??= /* @__PURE__ */ new Set()).add(imp.name);
1675
- } else if (imp.name) {
1676
- (statement.namedImports ??= /* @__PURE__ */ new Set()).add(imp.name);
1677
- }
1678
- }
1679
- return Array.from(importsStatements.values());
1475
+ const importsStatements = /* @__PURE__ */ new Map();
1476
+ for (const imp of imports) {
1477
+ let statement = importsStatements.get(imp.moduleName);
1478
+ if (!statement) importsStatements.set(imp.moduleName, statement = { moduleName: imp.moduleName });
1479
+ if (imp.isDefault) statement.defaultImport = imp.name;
1480
+ else if (imp.isNamespace) statement.namespaceImport = imp.name;
1481
+ else if (imp.isType) (statement.typedImports ??= /* @__PURE__ */ new Set()).add(imp.name);
1482
+ else if (imp.name) (statement.namedImports ??= /* @__PURE__ */ new Set()).add(imp.name);
1483
+ }
1484
+ return Array.from(importsStatements.values());
1680
1485
  }
1681
1486
  function tsImportStatementToString(importStatement) {
1682
- const namedImportsArr = [
1683
- .../* @__PURE__ */ new Set([
1684
- ...importStatement.namedImports ?? [],
1685
- ...importStatement.typedImports ?? []
1686
- ])
1687
- ].sort((i1, i2) => i1.localeCompare(i2));
1688
- const allNamedImportsAreTyped = namedImportsArr.every(
1689
- (i) => !importStatement.namedImports?.has(i)
1690
- );
1691
- const namedImports = namedImportsArr.length > 0 ? allNamedImportsAreTyped ? `type { ${namedImportsArr.join(", ")} }` : `{ ${namedImportsArr.map(
1692
- (i) => importStatement.namedImports?.has(i) ? i : `type ${i}`
1693
- ).join(", ")} }` : null;
1694
- const defaultImport = importStatement.defaultImport || null;
1695
- const namespaceImport = importStatement.namespaceImport ? `* as ${importStatement.namespaceImport}` : null;
1696
- const allImports = [defaultImport, namespaceImport, namedImports].filter((s) => s).join(", ");
1697
- const moduleName = JSON.stringify(importStatement.moduleName);
1698
- return allImports ? `import ${allImports} from ${moduleName};` : `import ${moduleName};`;
1699
- }
1700
- export {
1701
- CLASS_DND_TYPE,
1702
- ClassBuilder,
1703
- ClassFieldBuilder,
1704
- ENUM_DND_TYPE,
1705
- EnumBuilder,
1706
- EnumEntryBuilder,
1707
- ListableBuilder,
1708
- ListableBuilderWithoutKindSelect,
1709
- ListableItemBuilder,
1710
- LoadSchematic,
1711
- NULLABLE_SCHEMA,
1712
- SaveSchematic,
1713
- ScaffoldToZip,
1714
- SchematicBuilder,
1715
- SchematicBuilderContext,
1716
- UseFileBase64SerializerConfig,
1717
- UseTableValuesSerializerConfig,
1718
- addEjsTemplateFile,
1719
- addTemplateFile,
1720
- annotate,
1721
- anySchematicKind,
1722
- bigDecimalSchematicKind,
1723
- bigIntegerSchematicKind,
1724
- boolDataAttr,
1725
- booleanSchematicKind,
1726
- byteSchematicKind,
1727
- charSchematicKind,
1728
- classSchematicKind,
1729
- code,
1730
- configScaffolder,
1731
- createSchematic,
1732
- defaultSchematicKinds,
1733
- doubleSchematicKind,
1734
- ejsTemplateFile,
1735
- enumSchematicKind,
1736
- fileSchematicKind,
1737
- floatSchematicKind,
1738
- instantSchematicKind,
1739
- intSchematicKind,
1740
- joinPackages,
1741
- joinPaths,
1742
- jsExport,
1743
- ktFile,
1744
- listSchematicKind,
1745
- localDateSchematicKind,
1746
- localDateTimeSchematicKind,
1747
- longSchematicKind,
1748
- moveSchematic,
1749
- preventDrag,
1750
- scaffold,
1751
- scaffoldDefaultValue,
1752
- scaffoldModels,
1753
- scaffoldPropertyAnnotations,
1754
- scaffoldSchema,
1755
- scaffoldSchemas,
1756
- scaffoldSerializer,
1757
- scaffoldType,
1758
- scaffoldValidator,
1759
- serializable,
1760
- shortSchematicKind,
1761
- simpleKtName,
1762
- stringSchematicKind,
1763
- tableSchematicKind,
1764
- templateFile,
1765
- tsFile,
1766
- useConfig,
1767
- useScaffolder,
1768
- useSchematicBuilderContext
1769
- };
1770
- //# sourceMappingURL=ostack-kform-scaffolder.js.map
1487
+ const namedImportsArr = [...new Set([...importStatement.namedImports ?? [], ...importStatement.typedImports ?? []])].sort((i1, i2) => i1.localeCompare(i2));
1488
+ const allNamedImportsAreTyped = namedImportsArr.every((i) => !importStatement.namedImports?.has(i));
1489
+ const namedImports = namedImportsArr.length > 0 ? allNamedImportsAreTyped ? `type { ${namedImportsArr.join(", ")} }` : `{ ${namedImportsArr.map((i) => importStatement.namedImports?.has(i) ? i : `type ${i}`).join(", ")} }` : null;
1490
+ const allImports = [
1491
+ importStatement.defaultImport || null,
1492
+ importStatement.namespaceImport ? `* as ${importStatement.namespaceImport}` : null,
1493
+ namedImports
1494
+ ].filter((s) => s).join(", ");
1495
+ const moduleName = JSON.stringify(importStatement.moduleName);
1496
+ return allImports ? `import ${allImports} from ${moduleName};` : `import ${moduleName};`;
1497
+ }
1498
+ //#endregion
1499
+ export { CLASS_DND_TYPE, ClassBuilder, ClassFieldBuilder, ENUM_DND_TYPE, EnumBuilder, EnumEntryBuilder, ListableBuilder, ListableBuilderWithoutKindSelect, ListableItemBuilder, LoadSchematic, NULLABLE_SCHEMA, SaveSchematic, ScaffoldToZip, SchematicBuilder, SchematicBuilderContext, UseFileBase64SerializerConfig, UseTableValuesSerializerConfig, addEjsTemplateFile, addTemplateFile, annotate, anySchematicKind, bigDecimalSchematicKind, bigIntegerSchematicKind, boolDataAttr, booleanSchematicKind, byteSchematicKind, charSchematicKind, classSchematicKind, code, configScaffolder, createSchematic, defaultSchematicKinds, doubleSchematicKind, ejsTemplateFile, enumSchematicKind, fileSchematicKind, floatSchematicKind, instantSchematicKind, intSchematicKind, joinPackages, joinPaths, jsExport, ktFile, listSchematicKind, localDateSchematicKind, localDateTimeSchematicKind, longSchematicKind, moveSchematic, preventDrag, scaffold, scaffoldDefaultValue, scaffoldModels, scaffoldPropertyAnnotations, scaffoldSchema, scaffoldSchemas, scaffoldSerializer, scaffoldType, scaffoldValidator, serializable, shortSchematicKind, simpleKtName, stringSchematicKind, tableSchematicKind, templateFile, tsFile, useConfig, useScaffolder, useSchematicBuilderContext };
1500
+
1501
+ //# sourceMappingURL=ostack-kform-scaffolder.js.map