@sealcode/sealgen 0.18.10 → 0.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.xunit +74 -69
- package/@types/add-crud.d.sync-conflict-20250918-184311-TFDLWFG.ts +1 -0
- package/@types/builders/colors-builder.d.sync-conflict-20250918-184323-TFDLWFG.ts +10 -0
- package/@types/builders/colors-builder.d.ts +1 -1
- package/@types/builders/fonts-builder.d.sync-conflict-20250918-184322-TFDLWFG.ts +7 -0
- package/@types/builders/fonts-builder.d.ts +1 -1
- package/@types/controllers/table-add-button.d.ts +6 -0
- package/@types/controllers/table-add-button.stimulus.d.ts +6 -0
- package/@types/crud-field-snippets.d.sync-conflict-20250918-184323-TFDLWFG.ts +1 -0
- package/@types/crud-field-snippets.d.ts +1 -3
- package/@types/forms/controls/array.d.sync-conflict-20250918-184306-TFDLWFG.ts +33 -0
- package/@types/forms/controls/array.d.ts +1 -3
- package/@types/forms/controls/array.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/autocomplete.d.sync-conflict-20250918-222042-TFDLWFG.ts +22 -0
- package/@types/forms/controls/autocomplete.d.ts +1 -1
- package/@types/forms/controls/checkbox-group.d.sync-conflict-20250918-184319-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkbox-group.d.ts +3 -3
- package/@types/forms/controls/checkboxed-list-input.d.sync-conflict-20250918-184323-TFDLWFG.ts +21 -0
- package/@types/forms/controls/checkboxed-list-input.d.ts +3 -3
- package/@types/forms/controls/controls.d.ts +2 -2
- package/@types/forms/controls/derived-frame.d.sync-conflict-20250918-184314-TFDLWFG.ts +19 -0
- package/@types/forms/controls/derived-frame.d.ts +0 -2
- package/@types/forms/controls/dropdown.d.sync-conflict-20250918-222044-TFDLWFG.ts +30 -0
- package/@types/forms/controls/dropdown.d.ts +1 -1
- package/@types/forms/controls/file.d.sync-conflict-20250918-222045-TFDLWFG.ts +13 -0
- package/@types/forms/controls/file.d.ts +1 -2
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-184322-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.sync-conflict-20250918-222046-TFDLWFG.ts +19 -0
- package/@types/forms/controls/form-control.d.ts +7 -4
- package/@types/forms/controls/image.d.ts +19 -0
- package/@types/forms/controls/image.test.d.ts +1 -0
- package/@types/forms/controls/multiple-files.d.sync-conflict-20250918-184318-TFDLWFG.ts +42 -0
- package/@types/forms/controls/multiple-files.d.ts +3 -1
- package/@types/forms/controls/multiple-images.d.ts +19 -0
- package/@types/forms/controls/number.d.sync-conflict-20250918-222046-TFDLWFG.ts +13 -0
- package/@types/forms/controls/number.d.ts +1 -1
- package/@types/forms/controls/photo.d.sync-conflict-20250918-184321-TFDLWFG.ts +19 -0
- package/@types/forms/controls/photo.d.ts +3 -5
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-184310-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.sync-conflict-20250918-222042-TFDLWFG.ts +33 -0
- package/@types/forms/controls/simple-input.d.ts +5 -4
- package/@types/forms/controls/simple-input.sync-conflict-20250918-222045-TFDLWFG.d.ts +33 -0
- package/@types/forms/controls/single-reference.d.ts +3 -2
- package/@types/forms/controls/table.d.sync-conflict-20250918-184302-TFDLWFG.ts +39 -0
- package/@types/forms/controls/table.d.ts +8 -3
- package/@types/forms/controls/table.sync-conflict-20250918-222042-TFDLWFG.d.ts +39 -0
- package/@types/forms/controls/textarea.d.sync-conflict-20250918-222045-TFDLWFG.ts +25 -0
- package/@types/forms/controls/textarea.d.ts +3 -3
- package/@types/forms/fields/boolean.d.sync-conflict-20250918-184325-TFDLWFG.ts +22 -0
- package/@types/forms/fields/boolean.d.ts +6 -1
- package/@types/forms/fields/boolean.sync-conflict-20250918-222042-TFDLWFG.d.ts +22 -0
- package/@types/forms/fields/checkboxed-list.d.sync-conflict-20250918-184325-TFDLWFG.ts +23 -0
- package/@types/forms/fields/checkboxed-list.d.ts +3 -1
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-184319-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.sync-conflict-20250918-222047-TFDLWFG.ts +22 -0
- package/@types/forms/fields/collection-field.d.ts +8 -1
- package/@types/forms/fields/color.d.ts +4 -0
- package/@types/forms/fields/coordinates.d.sync-conflict-20250918-222044-TFDLWFG.ts +14 -0
- package/@types/forms/fields/coordinates.d.ts +14 -0
- package/@types/forms/fields/date.d.ts +13 -0
- package/@types/forms/fields/datetime.d.sync-conflict-20250918-222050-TFDLWFG.ts +4 -0
- package/@types/forms/fields/datetime.d.ts +14 -0
- package/@types/forms/fields/deep-reverse-single-reference-list.d.ts +20 -0
- package/@types/forms/fields/deep-reverse-single-reference-table.d.ts +16 -0
- package/@types/forms/fields/email.d.sync-conflict-20250918-184303-TFDLWFG.ts +8 -0
- package/@types/forms/fields/email.d.ts +3 -0
- package/@types/forms/fields/enum-multiple-sealious.d.ts +16 -0
- package/@types/forms/fields/enum-multiple-sealious.sync-conflict-20250918-222047-TFDLWFG.d.ts +16 -0
- package/@types/forms/fields/field.d.sync-conflict-20250918-184306-TFDLWFG.ts +70 -0
- package/@types/forms/fields/field.d.ts +37 -5
- package/@types/forms/fields/fields.d.sync-conflict-20250918-184314-TFDLWFG.ts +29 -0
- package/@types/forms/fields/fields.d.ts +23 -8
- package/@types/forms/fields/file.d.sync-conflict-20250918-184310-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.sync-conflict-20250918-222046-TFDLWFG.ts +23 -0
- package/@types/forms/fields/file.d.ts +11 -5
- package/@types/forms/fields/file.sync-conflict-20250918-222049-TFDLWFG.d.ts +23 -0
- package/@types/forms/fields/float.d.ts +4 -0
- package/@types/forms/fields/get-field-for-sealious.d.sync-conflict-20250918-222046-TFDLWFG.ts +29 -0
- package/@types/forms/fields/get-field-for-sealious.d.ts +31 -0
- package/@types/forms/fields/get-field-for-sealious.sync-conflict-20250918-222042-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/html.d.ts +6 -0
- package/@types/forms/fields/image.d.sync-conflict-20250918-222042-TFDLWFG.ts +5 -0
- package/@types/forms/fields/image.d.ts +5 -0
- package/@types/forms/fields/int.d.ts +6 -0
- package/@types/forms/fields/json.d.ts +13 -0
- package/@types/forms/fields/markdown.d.ts +6 -0
- package/@types/forms/fields/multiple-files.d.sync-conflict-20250918-184304-TFDLWFG.ts +16 -0
- package/@types/forms/fields/multiple-files.d.ts +3 -1
- package/@types/forms/fields/number.d.sync-conflict-20250918-184317-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.sync-conflict-20250918-222047-TFDLWFG.ts +25 -0
- package/@types/forms/fields/number.d.ts +3 -1
- package/@types/forms/fields/password.d.ts +5 -0
- package/@types/forms/fields/pick-from-list-sealious.d.ts +11 -0
- package/@types/forms/fields/pick-from-list.d.sync-conflict-20250918-184322-TFDLWFG.ts +15 -0
- package/@types/forms/fields/pick-from-list.d.ts +4 -3
- package/@types/forms/fields/proxy-field.d.sync-conflict-20250918-184307-TFDLWFG.ts +15 -0
- package/@types/forms/fields/proxy-field.d.ts +3 -1
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-184305-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.sync-conflict-20250918-222045-TFDLWFG.ts +21 -0
- package/@types/forms/fields/regexp.d.ts +6 -1
- package/@types/forms/fields/regexp.sync-conflict-20250918-222047-TFDLWFG.d.ts +21 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-184309-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.sync-conflict-20250918-222044-TFDLWFG.ts +29 -0
- package/@types/forms/fields/simple-form-field.d.ts +23 -3
- package/@types/forms/fields/simple-form-field.sync-conflict-20250918-222049-TFDLWFG.d.ts +29 -0
- package/@types/forms/fields/single-reference.d.ts +19 -0
- package/@types/forms/fields/single-reference.sync-conflict-20250918-222043-TFDLWFG.d.ts +10 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-184302-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.sync-conflict-20250918-222049-TFDLWFG.ts +27 -0
- package/@types/forms/fields/structured-array.d.ts +19 -10
- package/@types/forms/fields/structured-array.sync-conflict-20250918-222047-TFDLWFG.d.ts +27 -0
- package/@types/forms/fields/table.d.sync-conflict-20250918-184303-TFDLWFG.ts +16 -0
- package/@types/forms/fields/table.d.ts +3 -0
- package/@types/forms/fields/text.d.ts +6 -0
- package/@types/forms/fields/url.d.ts +6 -0
- package/@types/forms/form-types.d.sync-conflict-20250918-222045-TFDLWFG.ts +26 -0
- package/@types/forms/form-types.d.ts +2 -0
- package/@types/forms/form.d.sync-conflict-20250918-184315-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.sync-conflict-20250918-222049-TFDLWFG.ts +32 -0
- package/@types/forms/form.d.ts +10 -8
- package/@types/forms/form.sync-conflict-20250918-222049-TFDLWFG.d.ts +33 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-184318-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.sync-conflict-20250918-222047-TFDLWFG.ts +6 -0
- package/@types/forms/form.test.d.ts +2 -2
- package/@types/forms/multiform.d.sync-conflict-20250918-184308-TFDLWFG.ts +23 -0
- package/@types/forms/multiform.d.ts +1 -2
- package/@types/forms/multiform.sync-conflict-20250918-222044-TFDLWFG.d.ts +23 -0
- package/@types/index.d.sync-conflict-20250918-184316-TFDLWFG.ts +46 -0
- package/@types/index.d.ts +2 -2
- package/@types/mount.d.sync-conflict-20250918-184320-TFDLWFG.ts +6 -0
- package/@types/mount.d.ts +0 -1
- package/@types/page/list.d.sync-conflict-20250918-184318-TFDLWFG.ts +48 -0
- package/@types/page/list.d.sync-conflict-20250918-222046-TFDLWFG.ts +48 -0
- package/@types/page/list.d.ts +2 -2
- package/@types/page/list.sync-conflict-20250918-222048-TFDLWFG.d.ts +48 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-184321-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.sync-conflict-20250918-222046-TFDLWFG.ts +42 -0
- package/@types/page/mountable-with-fields.d.ts +3 -3
- package/@types/page/mountable-with-fields.sync-conflict-20250918-222044-TFDLWFG.d.ts +42 -0
- package/@types/page/mountable.d.sync-conflict-20250918-184306-TFDLWFG.ts +10 -0
- package/@types/page/mountable.d.ts +0 -1
- package/@types/page/page.d.sync-conflict-20250918-184320-TFDLWFG.ts +18 -0
- package/@types/page/page.d.ts +0 -1
- package/@types/page/props-parser.d.sync-conflict-20250918-184305-TFDLWFG.ts +15 -0
- package/@types/page/props-parser.d.ts +0 -1
- package/@types/page/stateful-page.d.sync-conflict-20250918-184326-TFDLWFG.ts +62 -0
- package/@types/page/stateful-page.d.ts +0 -1
- package/@types/register-external.d.ts +2 -2
- package/@types/templates/form.d.ts +1 -3
- package/@types/templates/jdd-component.d.ts +1 -1
- package/@types/templates/page.d.ts +1 -1
- package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts +1 -0
- package/@types/templates/shared/shared-crud-form-fields.d.ts +1 -68
- package/@types/templates/templates.d.ts +1 -21
- package/@types/test_utils/test-on-real-app.d.sync-conflict-20250918-184320-TFDLWFG.ts +26 -0
- package/@types/test_utils/test-on-real-app.d.ts +0 -1
- package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts +18 -0
- package/@types/utils/extract-fields-from-collection.d.ts +5 -1
- package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts +18 -0
- package/@types/utils/wrap-attributes.d.ts +3 -0
- package/README.md +5 -0
- package/assets/file-icon.svg +5 -0
- package/eslint.config.mjs +56 -0
- package/lib/add-crud.js +77 -89
- package/lib/add-jdd-component.js +3 -3
- package/lib/add-list-route.test.js +1 -1
- package/lib/add-route.js +2 -9
- package/lib/build.js +6 -4
- package/lib/builders/backend-ts-builder.js +0 -1
- package/lib/builders/colors-builder.js +11 -8
- package/lib/builders/fonts-builder.js +0 -1
- package/lib/builders/frontend-ts-builder.js +0 -1
- package/lib/cli.js +4 -7
- package/lib/components/tabs.js +36 -36
- package/lib/controllers/table-add-button.stimulus.js +35 -0
- package/lib/esbuild-plugins/rewrite-asset-imports.js +7 -10
- package/lib/forms/controls/array.js +25 -22
- package/lib/forms/controls/big-radio-group.js +2 -2
- package/lib/forms/controls/checkbox-group.js +7 -7
- package/lib/forms/controls/checkboxed-list-input.js +7 -1
- package/lib/forms/controls/checkboxed-list-input.test.js +6 -6
- package/lib/forms/controls/controls.js +2 -2
- package/lib/forms/controls/derived-frame.js +8 -4
- package/lib/forms/controls/derived.js +1 -1
- package/lib/forms/controls/dropdown.js +5 -3
- package/lib/forms/controls/editable-collection-subset.js +2 -2
- package/lib/forms/controls/file.js +26 -2
- package/lib/forms/controls/file.test.js +2 -2
- package/lib/forms/controls/form-control.js +1 -1
- package/lib/forms/controls/hidden-input.js +4 -1
- package/lib/forms/controls/{photo.js → image.js} +6 -7
- package/lib/forms/controls/{photo.test.js → image.test.js} +8 -23
- package/lib/forms/controls/multiple-files.js +10 -1
- package/lib/forms/controls/{multiple-photos.js → multiple-images.js} +3 -3
- package/lib/forms/controls/simple-input.js +13 -12
- package/lib/forms/controls/single-reference.js +4 -0
- package/lib/forms/controls/single-reference.test.js +1 -1
- package/lib/forms/controls/table.js +62 -25
- package/lib/forms/controls/textarea.js +5 -3
- package/lib/forms/controls/tickable.js +13 -5
- package/lib/forms/fields/boolean.js +14 -0
- package/lib/forms/fields/checkboxed-list.js +4 -0
- package/lib/forms/fields/collection-field.js +9 -0
- package/lib/forms/fields/color.js +10 -0
- package/lib/forms/fields/coordinates.js +49 -0
- package/lib/forms/fields/date.js +34 -0
- package/lib/forms/fields/datetime.js +46 -0
- package/lib/forms/fields/deep-reverse-single-reference-list.js +81 -0
- package/lib/forms/fields/deep-reverse-single-reference-table.js +122 -0
- package/lib/forms/fields/email.js +7 -0
- package/lib/forms/fields/enum-multiple-sealious.js +32 -0
- package/lib/forms/fields/field.js +32 -4
- package/lib/forms/fields/field.test.js +8 -8
- package/lib/forms/fields/fields.js +23 -8
- package/lib/forms/fields/file.js +33 -9
- package/lib/forms/fields/file.test.js +5 -17
- package/lib/forms/fields/float.js +10 -0
- package/lib/forms/fields/get-field-for-sealious.js +213 -0
- package/lib/forms/fields/html.js +14 -0
- package/lib/forms/fields/image.js +13 -0
- package/lib/forms/fields/int.js +23 -0
- package/lib/forms/fields/json.js +31 -0
- package/lib/forms/fields/markdown.js +14 -0
- package/lib/forms/fields/multiple-files.js +4 -0
- package/lib/forms/fields/number.js +6 -0
- package/lib/forms/fields/password.js +13 -0
- package/lib/forms/fields/pick-from-list-sealious.js +17 -0
- package/lib/forms/fields/pick-from-list.js +6 -2
- package/lib/forms/fields/proxy-field.js +3 -0
- package/lib/forms/fields/regexp.js +14 -0
- package/lib/forms/fields/simple-form-field.js +61 -2
- package/lib/forms/fields/single-reference.js +44 -0
- package/lib/forms/fields/structured-array.js +61 -12
- package/lib/forms/fields/table.js +29 -2
- package/lib/forms/fields/text.js +17 -0
- package/lib/forms/fields/url.js +17 -0
- package/lib/forms/form.js +30 -14
- package/lib/forms/form.test.js +5 -7
- package/lib/forms/multiform.js +10 -9
- package/lib/forms/multiform.test.js +5 -5
- package/lib/generate-collections.js +2 -3
- package/lib/generate-components.js +2 -3
- package/lib/generate-routes.js +3 -5
- package/lib/generate-routes.test.js +7 -16
- package/lib/generate-stimulus.js +4 -4
- package/lib/get-fonts.js +29 -27
- package/lib/index.js +1 -0
- package/lib/make-env.js +1 -1
- package/lib/make-hidden-inputs.js +4 -4
- package/lib/mount.js +11 -1
- package/lib/notifier.js +3 -4
- package/lib/page/list.js +20 -15
- package/lib/page/mountable-with-fields.js +14 -6
- package/lib/page/mountable-with-fields.test.js +1 -1
- package/lib/page/mountable.js +0 -1
- package/lib/page/page.js +0 -1
- package/lib/register-external.js +4 -4
- package/lib/templates/form.js +9 -10
- package/lib/templates/jdd-component.js +1 -1
- package/lib/templates/jdd-editor.js +1 -1
- package/lib/templates/multiform.js +4 -4
- package/lib/templates/page.js +1 -3
- package/lib/templates/shared/collection-create-form.js +31 -44
- package/lib/templates/shared/collection-edit-form.js +43 -81
- package/lib/templates/shared/collection-list.js +13 -21
- package/lib/templates/shared/shared-crud-form-fields.js +28 -98
- package/lib/test_utils/exec_async.js +3 -3
- package/lib/test_utils/test-on-real-app.js +12 -14
- package/lib/utils/extract-fields-from-collection.js +60 -20
- package/lib/utils/make-slug.js +1 -1
- package/lib/utils/wrap-attributes.js +20 -0
- package/lib/utils/write-file.js +1 -1
- package/package.json +11 -9
- package/src/add-collection.ts +1 -3
- package/src/add-crud.ts +84 -100
- package/src/add-jdd-component.ts +4 -5
- package/src/add-list-route.test.ts +1 -1
- package/src/add-route.ts +3 -13
- package/src/build.ts +6 -4
- package/src/builders/backend-ts-builder.ts +0 -1
- package/src/builders/builder.ts +4 -1
- package/src/builders/colors-builder.ts +11 -9
- package/src/builders/css-builder.ts +4 -1
- package/src/builders/fonts-builder.ts +0 -1
- package/src/builders/frontend-ts-builder.ts +0 -1
- package/src/cli.ts +5 -7
- package/src/components/tabs.ts +38 -37
- package/src/components/toggle-modal.ts +1 -1
- package/src/controllers/table-add-button.stimulus.ts +35 -0
- package/src/esbuild-plugins/rewrite-asset-imports.ts +7 -10
- package/src/forms/controls/array.ts +35 -36
- package/src/forms/controls/autocomplete.ts +2 -2
- package/src/forms/controls/big-radio-group.ts +4 -4
- package/src/forms/controls/checkbox-group.ts +10 -10
- package/src/forms/controls/checkboxed-list-input.test.ts +6 -6
- package/src/forms/controls/checkboxed-list-input.ts +16 -8
- package/src/forms/controls/controls.ts +2 -2
- package/src/forms/controls/derived-frame.ts +16 -11
- package/src/forms/controls/derived.ts +7 -6
- package/src/forms/controls/dropdown.ts +13 -13
- package/src/forms/controls/editable-collection-subset.ts +4 -3
- package/src/forms/controls/field-group.ts +1 -1
- package/src/forms/controls/file.test.ts +4 -2
- package/src/forms/controls/file.ts +30 -7
- package/src/forms/controls/form-control.ts +8 -3
- package/src/forms/controls/hidden-input.ts +5 -1
- package/src/forms/controls/html.ts +1 -0
- package/src/forms/controls/{photo.test.ts → image.test.ts} +7 -24
- package/src/forms/controls/{photo.ts → image.ts} +4 -6
- package/src/forms/controls/multiple-files.ts +23 -8
- package/src/forms/controls/{multiple-photos.ts → multiple-images.ts} +2 -2
- package/src/forms/controls/number.ts +1 -1
- package/src/forms/controls/simple-input.ts +21 -33
- package/src/forms/controls/single-reference.test.ts +1 -1
- package/src/forms/controls/single-reference.ts +11 -3
- package/src/forms/controls/table.ts +87 -33
- package/src/forms/controls/textarea.ts +7 -5
- package/src/forms/controls/tickable.ts +13 -7
- package/src/forms/fields/boolean.ts +27 -2
- package/src/forms/fields/checkboxed-list.ts +11 -2
- package/src/forms/fields/collection-field.ts +21 -3
- package/src/forms/fields/color.ts +9 -0
- package/src/forms/fields/coordinates.ts +66 -0
- package/src/forms/fields/date.ts +50 -0
- package/src/forms/fields/datetime.ts +66 -0
- package/src/forms/fields/deep-reverse-single-reference-list.ts +130 -0
- package/src/forms/fields/deep-reverse-single-reference-table.ts +213 -0
- package/src/forms/fields/email.ts +10 -1
- package/src/forms/fields/enum-multiple-sealious.ts +48 -0
- package/src/forms/fields/existing-sealious-value.ts +1 -1
- package/src/forms/fields/field.test.ts +8 -8
- package/src/forms/fields/field.ts +98 -11
- package/src/forms/fields/fields.ts +23 -8
- package/src/forms/fields/file.test.ts +5 -17
- package/src/forms/fields/file.ts +44 -16
- package/src/forms/fields/float.ts +9 -0
- package/src/forms/fields/get-field-for-sealious.ts +337 -0
- package/src/forms/fields/html.ts +15 -0
- package/src/forms/fields/image.ts +12 -0
- package/src/forms/fields/int.ts +25 -0
- package/src/forms/fields/json.ts +48 -0
- package/src/forms/fields/markdown.ts +15 -0
- package/src/forms/fields/multiple-files.ts +10 -1
- package/src/forms/fields/number.ts +10 -3
- package/src/forms/fields/password.ts +13 -0
- package/src/forms/fields/pick-from-list-sealious.ts +22 -0
- package/src/forms/fields/pick-from-list.ts +8 -4
- package/src/forms/fields/proxy-field.ts +7 -1
- package/src/forms/fields/regexp.ts +27 -1
- package/src/forms/fields/simple-form-field.ts +103 -7
- package/src/forms/fields/single-reference.ts +62 -0
- package/src/forms/fields/structured-array.ts +111 -18
- package/src/forms/fields/table.ts +39 -16
- package/src/forms/fields/text.ts +18 -0
- package/src/forms/fields/url.ts +20 -0
- package/src/forms/form-types.ts +5 -4
- package/src/forms/form.test.ts +5 -7
- package/src/forms/form.ts +42 -23
- package/src/forms/forms.css +0 -85
- package/src/forms/multiform.test.ts +9 -9
- package/src/forms/multiform.ts +12 -10
- package/src/generate-collections.ts +2 -3
- package/src/generate-components.ts +2 -3
- package/src/generate-routes.test.ts +7 -16
- package/src/generate-routes.ts +6 -10
- package/src/generate-stimulus.ts +4 -5
- package/src/get-fonts.ts +32 -30
- package/src/index.ts +2 -1
- package/src/make-env.ts +1 -1
- package/src/make-hidden-inputs.ts +8 -7
- package/src/mount.ts +16 -7
- package/src/notifier.ts +4 -7
- package/src/page/default-list-filters.ts +1 -0
- package/src/page/list.ts +33 -28
- package/src/page/mountable-with-fields.test.ts +1 -1
- package/src/page/mountable-with-fields.ts +21 -12
- package/src/page/mountable.ts +0 -1
- package/src/page/page.ts +2 -3
- package/src/page/props-parser.ts +1 -1
- package/src/page/sealious-list.ts +1 -1
- package/src/page/stateful-page.ts +6 -10
- package/src/register-external.ts +5 -5
- package/src/templates/form.ts +9 -11
- package/src/templates/jdd-component.ts +1 -1
- package/src/templates/jdd-editor.ts +2 -4
- package/src/templates/list.ts +0 -1
- package/src/templates/multiform.ts +4 -4
- package/src/templates/page.ts +1 -6
- package/src/templates/shared/collection-create-form.ts +34 -71
- package/src/templates/shared/collection-edit-form.ts +46 -108
- package/src/templates/shared/collection-list.ts +13 -21
- package/src/templates/shared/item-delete.ts +0 -1
- package/src/templates/shared/shared-crud-form-fields.ts +38 -177
- package/src/templates/templates.ts +5 -1
- package/src/test_utils/exec_async.ts +3 -4
- package/src/test_utils/test-on-real-app.ts +13 -14
- package/src/utils/browser-creator.js +0 -1
- package/src/utils/exec.ts +0 -1
- package/src/utils/extract-fields-from-collection.ts +76 -25
- package/src/utils/input-wrapper.ts +1 -1
- package/src/utils/make-slug.ts +1 -1
- package/src/utils/wrap-attributes.ts +17 -0
- package/src/utils/write-file.ts +1 -1
- package/.eslintrc.cjs +0 -39
- package/lib/add-verbose-crud.js +0 -119
- package/lib/crud-field-snippets.js +0 -52
- package/lib/find-css-includes.js +0 -3
- package/lib/forms/controls/reverse-single-reference.js +0 -1
- package/lib/forms/fields/enum-multiple.js +0 -47
- package/lib/forms/fields/enum-multiple.test.js +0 -27
- package/lib/forms/fields/enum.js +0 -41
- package/lib/forms/fields/enum.test.js +0 -21
- package/lib/forms/fields/reverse-single-reference.js +0 -17
- package/lib/templates/shared/handlers/boolean.js +0 -14
- package/lib/templates/shared/handlers/date.js +0 -8
- package/lib/templates/shared/handlers/deep-reverse-single-reference.js +0 -209
- package/lib/templates/shared/handlers/default.js +0 -49
- package/lib/templates/shared/handlers/enum.js +0 -19
- package/lib/templates/shared/handlers/file.js +0 -23
- package/lib/templates/shared/handlers/image.js +0 -32
- package/lib/templates/shared/handlers/int.js +0 -11
- package/lib/templates/shared/handlers/jdd.js +0 -10
- package/lib/templates/shared/handlers/single-reference.js +0 -12
- package/lib/templates/shared/handlers/structured-array.js +0 -33
- package/src/add-verbose-crud.ts +0 -138
- package/src/crud-field-snippets.ts +0 -57
- package/src/find-css-includes.ts +0 -3
- package/src/forms/controls/reverse-single-reference.ts +0 -50
- package/src/forms/fields/enum-multiple.test.ts +0 -31
- package/src/forms/fields/enum-multiple.ts +0 -62
- package/src/forms/fields/enum.test.ts +0 -25
- package/src/forms/fields/enum.ts +0 -56
- package/src/forms/fields/reverse-single-reference.ts +0 -20
- package/src/templates/shared/handlers/boolean.ts +0 -18
- package/src/templates/shared/handlers/date.ts +0 -12
- package/src/templates/shared/handlers/deep-reverse-single-reference.ts +0 -244
- package/src/templates/shared/handlers/default.ts +0 -64
- package/src/templates/shared/handlers/enum.ts +0 -23
- package/src/templates/shared/handlers/file.ts +0 -27
- package/src/templates/shared/handlers/image.ts +0 -45
- package/src/templates/shared/handlers/int.ts +0 -15
- package/src/templates/shared/handlers/jdd.ts +0 -14
- package/src/templates/shared/handlers/single-reference.ts +0 -16
- package/src/templates/shared/handlers/structured-array.ts +0 -42
|
@@ -3,15 +3,20 @@ import { exec } from "./utils.js";
|
|
|
3
3
|
const target_locreq = _locreq(process.cwd());
|
|
4
4
|
import { promises as fs } from "fs";
|
|
5
5
|
import { is, predicates } from "@sealcode/ts-predicates";
|
|
6
|
+
import { sealiousFieldInfoToFormField } from "../forms/fields/get-field-for-sealious.js";
|
|
6
7
|
const counter = function* () {
|
|
7
8
|
let i = 0;
|
|
8
9
|
while (true) {
|
|
9
10
|
yield i++;
|
|
10
11
|
}
|
|
11
12
|
}();
|
|
13
|
+
const cache = {};
|
|
12
14
|
async function extract_fields_from_collection(collection_name) {
|
|
15
|
+
if (cache[collection_name]) {
|
|
16
|
+
return cache[collection_name];
|
|
17
|
+
}
|
|
13
18
|
const extractor_code = `import {default as the_app} from "./app.js";
|
|
14
|
-
const c = new the_app().collections["${collection_name}"];
|
|
19
|
+
const c = new the_app({}).collections["${collection_name}"];
|
|
15
20
|
const fields = [];
|
|
16
21
|
for (const field_name in c.fields){
|
|
17
22
|
let field = c.fields[field_name];
|
|
@@ -21,14 +26,17 @@ for (const field_name in c.fields){
|
|
|
21
26
|
let referencing_field = null;
|
|
22
27
|
let intermediary_field_that_points_there = null;
|
|
23
28
|
let is_readonly = false;
|
|
24
|
-
let is_required = field.required;
|
|
29
|
+
let is_required = field.required || false;
|
|
25
30
|
let subfields = [];
|
|
26
|
-
if(["derived-value", "cached-value", "settable-by"].includes(type)){
|
|
31
|
+
if(["derived-value", "cached-value", "settable-by", "control-access"].includes(type)){
|
|
27
32
|
type = field.virtual_field.typeName;
|
|
28
33
|
}
|
|
29
34
|
if(["derived-value", "cached-value", "reverse-single-reference"].includes(field.typeName)){
|
|
30
35
|
is_readonly = true;
|
|
31
36
|
}
|
|
37
|
+
if(type == "single-reference"){
|
|
38
|
+
target = field.target_collection;
|
|
39
|
+
}
|
|
32
40
|
if(type == "deep-reverse-single-reference" || type =="reverse-single-reference"){
|
|
33
41
|
target = field.target_collection;
|
|
34
42
|
referencing_collection = field.referencing_collection;
|
|
@@ -46,24 +54,56 @@ for (const field_name in c.fields){
|
|
|
46
54
|
`dist/back/___extract_fields--${counter.next().value || 0}.js`
|
|
47
55
|
);
|
|
48
56
|
await fs.writeFile(extractor_code_path, extractor_code);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
const result = exec("node", [extractor_code_path]).then(async ({ stdout }) => {
|
|
58
|
+
await fs.unlink(extractor_code_path);
|
|
59
|
+
const ret = JSON.parse(stdout);
|
|
60
|
+
if (!is(
|
|
61
|
+
ret,
|
|
62
|
+
predicates.array(
|
|
63
|
+
predicates.shape({
|
|
64
|
+
name: predicates.string,
|
|
65
|
+
type: predicates.string,
|
|
66
|
+
is_readonly: predicates.boolean,
|
|
67
|
+
target: predicates.or(
|
|
68
|
+
predicates.string,
|
|
69
|
+
predicates.null
|
|
70
|
+
),
|
|
71
|
+
referencing_collection: predicates.or(
|
|
72
|
+
predicates.string,
|
|
73
|
+
predicates.null
|
|
74
|
+
),
|
|
75
|
+
referencing_field: predicates.or(
|
|
76
|
+
predicates.string,
|
|
77
|
+
predicates.null
|
|
78
|
+
),
|
|
79
|
+
is_required: predicates.boolean,
|
|
80
|
+
intermediary_field_that_points_there: predicates.or(
|
|
81
|
+
predicates.string,
|
|
82
|
+
predicates.null
|
|
83
|
+
),
|
|
84
|
+
subfields: predicates.array(
|
|
85
|
+
predicates.shape({ name: predicates.string })
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
)
|
|
89
|
+
)) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
"Encountered a problem while extracting the names of fields from collection. Got: " + stdout
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const result2 = await Promise.all(
|
|
95
|
+
ret.map(async (field_info) => ({
|
|
96
|
+
...field_info,
|
|
97
|
+
form_field: await sealiousFieldInfoToFormField(field_info)
|
|
98
|
+
}))
|
|
64
99
|
);
|
|
65
|
-
|
|
66
|
-
|
|
100
|
+
return result2;
|
|
101
|
+
}).catch((e) => {
|
|
102
|
+
console.error("ERROR", e);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
});
|
|
105
|
+
cache[collection_name] = result;
|
|
106
|
+
return result;
|
|
67
107
|
}
|
|
68
108
|
export {
|
|
69
109
|
extract_fields_from_collection as default
|
package/lib/utils/make-slug.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function needsQuotes(str) {
|
|
2
|
+
try {
|
|
3
|
+
new Function(`var obj = { ${str}: 1 };`);
|
|
4
|
+
return false;
|
|
5
|
+
} catch {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function wrapAttribute(name) {
|
|
10
|
+
return needsQuotes(name) ? `["${name}"]` : `.${name}`;
|
|
11
|
+
}
|
|
12
|
+
function wrapKeyName(name) {
|
|
13
|
+
return needsQuotes(name) ? `["${name}"]` : `${name}`;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
needsQuotes,
|
|
17
|
+
wrapAttribute,
|
|
18
|
+
wrapKeyName
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=wrap-attributes.js.map
|
package/lib/utils/write-file.js
CHANGED
|
@@ -3,7 +3,7 @@ import { resolve } from "path";
|
|
|
3
3
|
async function writeFile(path, content) {
|
|
4
4
|
await fs.mkdir(resolve(path, "../"), { recursive: true });
|
|
5
5
|
await fs.writeFile(path, content);
|
|
6
|
-
console.
|
|
6
|
+
console.info(`${path} created`);
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
9
|
writeFile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sealcode/sealgen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "Module to automate adding routes and collections to a sealious application",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"@types/wcag-contrast": "^3.0.3",
|
|
40
40
|
"@types/ws": "^8.5.10",
|
|
41
41
|
"@types/yargs": "^17.0.32",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
43
|
-
"@typescript-eslint/parser": "^
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.44.0",
|
|
44
44
|
"axios": "^1.6.7",
|
|
45
45
|
"chalk": "^5.3.0",
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"eslint-config-prettier": "^8.
|
|
48
|
-
"eslint-plugin-prettier": "^
|
|
46
|
+
"eslint": "^9.36.0",
|
|
47
|
+
"eslint-config-prettier": "^8.10.2",
|
|
48
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
49
49
|
"eslint-plugin-with-tsc-error": "^0.0.7",
|
|
50
50
|
"get-port": "^5.1.1",
|
|
51
51
|
"koa-body": "^5.0.0",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"playwright": "^1.29.2",
|
|
56
56
|
"source-map-support": "^0.5.21",
|
|
57
57
|
"ts-node": "^10.9.1",
|
|
58
|
-
"typescript": "
|
|
58
|
+
"typescript": "5.9",
|
|
59
|
+
"typescript-eslint": "^8.44.0",
|
|
59
60
|
"wait-port": "^1.0.4"
|
|
60
61
|
},
|
|
61
62
|
"types": "./@types/index.d.ts",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"locreq": "^3.0.0",
|
|
78
79
|
"md5": "^2.3.0",
|
|
79
80
|
"merge": "^2.1.1",
|
|
80
|
-
"prettier": "^
|
|
81
|
+
"prettier": "^3.6.2",
|
|
81
82
|
"prompts": "^2.4.2",
|
|
82
83
|
"recursive-readdir": "^2.2.3",
|
|
83
84
|
"tempfile": "^5.0.0",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"koa": "^2.13.0",
|
|
92
93
|
"koa-responsive-image-router": "^0.2.24",
|
|
93
|
-
"sealious": "^0.21"
|
|
94
|
+
"sealious": "^0.21.20",
|
|
95
|
+
"stimulus": "^3.2.2"
|
|
94
96
|
}
|
|
95
97
|
}
|
package/src/add-collection.ts
CHANGED
|
@@ -25,8 +25,7 @@ export async function addCollection(
|
|
|
25
25
|
},
|
|
26
26
|
]);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
const collection_name: string = response.collection_name;
|
|
28
|
+
const collection_name: string = response.collection_name as string;
|
|
30
29
|
|
|
31
30
|
if (!collection_name) {
|
|
32
31
|
throw new Error("Empty collection name, please try again");
|
|
@@ -36,7 +35,6 @@ export async function addCollection(
|
|
|
36
35
|
);
|
|
37
36
|
|
|
38
37
|
if (existsSync(file_path)) {
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
38
|
console.error(`ERROR: File ${file_path} already exists.`);
|
|
41
39
|
return;
|
|
42
40
|
}
|
package/src/add-crud.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import _locreq from "locreq";
|
|
2
|
-
import prompts from "prompts";
|
|
3
|
-
|
|
4
2
|
import { escape_url_params } from "./utils/escape-url-params.js";
|
|
3
|
+
import prompts from "prompts";
|
|
5
4
|
import { toKebabCase, toPascalCase } from "js-convert-case";
|
|
6
5
|
import { listCollections } from "./utils/list-collections.js";
|
|
7
|
-
import {
|
|
8
|
-
makeDefaultDisplayFields,
|
|
9
|
-
makeDefaultFilterFields,
|
|
10
|
-
} from "./templates/shared/collection-list.js";
|
|
6
|
+
import { collectionListTemplate } from "./templates/shared/collection-list.js";
|
|
11
7
|
import { writeFile } from "./utils/write-file.js";
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import { getFieldHandler } from "./templates/shared/shared-crud-form-fields.js";
|
|
8
|
+
import { curryImportPath, importPath } from "./utils/import-path.js";
|
|
9
|
+
import { sharedCrudFormFields } from "./templates/shared/shared-crud-form-fields.js";
|
|
15
10
|
import { generateRoutes } from "./generate-routes.js";
|
|
16
|
-
import {
|
|
11
|
+
import { createItemFormTemplate } from "./templates/shared/collection-create-form.js";
|
|
12
|
+
import { editItemFormTemplate } from "./templates/shared/collection-edit-form.js";
|
|
13
|
+
import { itemDeleteTemplate } from "./templates/shared/item-delete.js";
|
|
17
14
|
|
|
18
15
|
export async function addCRUD(
|
|
19
16
|
params: Partial<{ [key in "collection" | "url"]: string }>,
|
|
@@ -27,9 +24,7 @@ export async function addCRUD(
|
|
|
27
24
|
name: "collection",
|
|
28
25
|
message:
|
|
29
26
|
"Which sealious collection do you like to add CRUD forms for?",
|
|
30
|
-
choices: (
|
|
31
|
-
await listCollections()
|
|
32
|
-
).map((collection) => ({
|
|
27
|
+
choices: (await listCollections()).map((collection) => ({
|
|
33
28
|
title: collection,
|
|
34
29
|
value: collection,
|
|
35
30
|
})),
|
|
@@ -38,7 +33,7 @@ export async function addCRUD(
|
|
|
38
33
|
type: "text",
|
|
39
34
|
name: "url",
|
|
40
35
|
message:
|
|
41
|
-
"Enter a full absolute path for the new route (for example: /admin/users/): ",
|
|
36
|
+
"Enter a full absolute path for the new route (for example: /admin/users/:id/edit): ",
|
|
42
37
|
validate: (s: string) =>
|
|
43
38
|
s.trim()[0] == "/" ? true : "Should start with a '/'",
|
|
44
39
|
initial: function (_, { collection }: { collection: string }) {
|
|
@@ -46,103 +41,92 @@ export async function addCRUD(
|
|
|
46
41
|
},
|
|
47
42
|
},
|
|
48
43
|
]);
|
|
49
|
-
|
|
50
44
|
const collection_name = response.collection as string;
|
|
51
45
|
const url = response.url as string;
|
|
46
|
+
const list_action_name = toPascalCase(collection_name) + "CRUDList";
|
|
47
|
+
const create_action_name = toPascalCase(collection_name) + "CRUDCreate";
|
|
48
|
+
const edit_action_name = toPascalCase(collection_name) + "CRUDEdit";
|
|
49
|
+
const delete_action_name = toPascalCase(collection_name) + "CRUDDelete";
|
|
52
50
|
|
|
53
51
|
/* create the list endpoint */
|
|
54
52
|
const list_path = target_locreq.resolve(
|
|
55
|
-
`src/back/routes/${escape_url_params(url)}/index.
|
|
53
|
+
`src/back/routes/${escape_url_params(url)}/index.list.tsx`
|
|
56
54
|
);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
const list_content = await collectionListTemplate(
|
|
56
|
+
collection_name,
|
|
57
|
+
list_action_name,
|
|
58
|
+
list_path,
|
|
59
|
+
{
|
|
60
|
+
post_import_js: `import { ${create_action_name}URL, ${edit_action_name}URL, ${delete_action_name}URL } from "${importPath(
|
|
61
|
+
list_path,
|
|
62
|
+
"src/back/routes/urls.ts"
|
|
63
|
+
)}";`,
|
|
64
|
+
post_header_html: `<a href={${create_action_name}URL}> Create </a>`,
|
|
65
|
+
render_item: (
|
|
66
|
+
collection_name: string
|
|
67
|
+
) => ` async renderItem(ctx: Context, item: CollectionItem<typeof ${toPascalCase(
|
|
68
|
+
collection_name
|
|
69
|
+
)}>) {
|
|
70
|
+
return <tr>
|
|
71
|
+
{displayFields.map(({ field, format }) => {
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-explicit-any
|
|
73
|
+
const value = item.get(field as any);
|
|
74
|
+
return <td>{format ? format(value, item) : value}</td>;
|
|
75
|
+
})}
|
|
76
|
+
<td><div class="sealious-list__actions">
|
|
77
|
+
<a href={${edit_action_name}URL(item.id)}>Edit</a>
|
|
78
|
+
<a data-turbo-method="POST" data-turbo-confirm="Delete item?" href={${delete_action_name}URL(item.id)}>Delete</a>
|
|
79
|
+
</div>
|
|
80
|
+
</td>
|
|
81
|
+
</tr>;
|
|
82
|
+
}`,
|
|
83
|
+
}
|
|
75
84
|
);
|
|
85
|
+
await writeFile(list_path, list_content);
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)} } from "src/back/collections/collections.js";
|
|
84
|
-
import html from "src/back/html.js";
|
|
85
|
-
|
|
86
|
-
export const actionName = "${toPascalCase(collection_name)}CRUD";
|
|
87
|
-
|
|
88
|
-
const edit_fields = <const>
|
|
89
|
-
{
|
|
90
|
-
${field_handler_results
|
|
91
|
-
.filter(({ hide_field }) => !hide_field)
|
|
92
|
-
.map(({ field }) => field)
|
|
93
|
-
.filter((e) => e != "")
|
|
94
|
-
.join(",\n")}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const edit_controls = [
|
|
99
|
-
${field_handler_results
|
|
100
|
-
.filter(({ hide_control }) => !hide_control)
|
|
101
|
-
.map(({ controls }) => controls)
|
|
102
|
-
.filter((e) => e != "")
|
|
103
|
-
.join(",\n")}
|
|
104
|
-
]
|
|
87
|
+
/* create the shared fields file */
|
|
88
|
+
const fields_path = target_locreq.resolve(
|
|
89
|
+
`src/back/routes/${escape_url_params(url)}/shared.ts`
|
|
90
|
+
);
|
|
91
|
+
const fields_content = await sharedCrudFormFields(collection_name);
|
|
92
|
+
await writeFile(fields_path, fields_content);
|
|
105
93
|
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
collection_name
|
|
114
|
-
|
|
115
|
-
|
|
94
|
+
/* create the create endpoint */
|
|
95
|
+
const create_path = target_locreq.resolve(
|
|
96
|
+
`src/back/routes/${escape_url_params(url)}/create.form.ts`
|
|
97
|
+
);
|
|
98
|
+
const create_content = await createItemFormTemplate(
|
|
99
|
+
create_action_name,
|
|
100
|
+
create_path,
|
|
101
|
+
collection_name,
|
|
102
|
+
list_action_name
|
|
103
|
+
);
|
|
104
|
+
await writeFile(create_path, create_content);
|
|
116
105
|
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
106
|
+
/* create the edit endpoint */
|
|
107
|
+
const edit_path = target_locreq.resolve(
|
|
108
|
+
`src/back/routes/${escape_url_params(url)}/[id]/edit.form.ts`
|
|
109
|
+
);
|
|
110
|
+
const edit_content = await editItemFormTemplate(
|
|
111
|
+
edit_action_name,
|
|
112
|
+
edit_path,
|
|
113
|
+
collection_name,
|
|
114
|
+
list_action_name
|
|
115
|
+
);
|
|
116
|
+
await writeFile(edit_path, edit_content);
|
|
125
117
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
edit_controls,
|
|
139
|
-
form_value_to_sealious_value: {},
|
|
140
|
-
sealious_value_to_form_value: {},
|
|
141
|
-
post_edit: async () => {},
|
|
142
|
-
post_create: async () => {},
|
|
143
|
-
});
|
|
144
|
-
`;
|
|
145
|
-
await writeFile(list_path, await formatWithPrettier(list_content));
|
|
118
|
+
/* create the actual delete endpoint */
|
|
119
|
+
const delete_path = target_locreq.resolve(
|
|
120
|
+
`src/back/routes/${escape_url_params(url)}/[id]/delete.page.tsx`
|
|
121
|
+
);
|
|
122
|
+
const base_import_path = curryImportPath(delete_path);
|
|
123
|
+
const delete_content = await itemDeleteTemplate(
|
|
124
|
+
delete_action_name,
|
|
125
|
+
collection_name,
|
|
126
|
+
list_action_name,
|
|
127
|
+
base_import_path
|
|
128
|
+
);
|
|
129
|
+
await writeFile(delete_path, delete_content);
|
|
146
130
|
|
|
147
131
|
await generateRoutes();
|
|
148
132
|
}
|
package/src/add-jdd-component.ts
CHANGED
|
@@ -19,12 +19,11 @@ export async function addJDDComponent(): Promise<void> {
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
if (existsSync(file_path)) {
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
22
|
console.error(`ERROR: File ${file_path} already exists.`);
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
25
|
await fs.mkdir(resolve(file_path, "../"), { recursive: true });
|
|
27
|
-
await fs.writeFile(file_path, jddComponentTemplate(component_name));
|
|
26
|
+
await fs.writeFile(file_path, await jddComponentTemplate(component_name));
|
|
28
27
|
|
|
29
28
|
const css_file_path = target_locreq.resolve(
|
|
30
29
|
`src/back/jdd-components/${toKebabCase(component_name)}/${toKebabCase(
|
|
@@ -36,8 +35,8 @@ export async function addJDDComponent(): Promise<void> {
|
|
|
36
35
|
`.${toKebabCase(component_name)} {
|
|
37
36
|
}`
|
|
38
37
|
);
|
|
39
|
-
|
|
40
|
-
console.
|
|
41
|
-
console.
|
|
38
|
+
|
|
39
|
+
console.info(`Created ${file_path}`);
|
|
40
|
+
console.info(`Created ${css_file_path}`);
|
|
42
41
|
await generateComponents();
|
|
43
42
|
}
|
|
@@ -4,7 +4,7 @@ import { RealAppTest } from "./test_utils/test-on-real-app.js";
|
|
|
4
4
|
import { collectionTemplate } from "./templates/collection.js";
|
|
5
5
|
import assert from "node:assert";
|
|
6
6
|
|
|
7
|
-
describe("single-reference
|
|
7
|
+
describe("single-reference", () => {
|
|
8
8
|
let page: Page;
|
|
9
9
|
before(async () => {
|
|
10
10
|
const browser = await getBrowser();
|
package/src/add-route.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { existsSync, promises as fs } from "fs";
|
|
|
2
2
|
import _locreq from "locreq";
|
|
3
3
|
import { resolve } from "path";
|
|
4
4
|
import { generateRoutes } from "./generate-routes.js";
|
|
5
|
-
import { testTemplate } from "./templates/route-test.js";
|
|
6
5
|
import { escape_url_params } from "./utils/escape-url-params.js";
|
|
7
6
|
import prompts from "prompts";
|
|
8
7
|
import { Templates } from "./templates/templates.js";
|
|
@@ -68,28 +67,19 @@ export async function addRoute(
|
|
|
68
67
|
const test_file_path = target_locreq.resolve(
|
|
69
68
|
`src/back/routes/${base_file_name}.test.ts`
|
|
70
69
|
);
|
|
71
|
-
const template = Templates[mode
|
|
70
|
+
const template = Templates[mode];
|
|
72
71
|
|
|
73
72
|
if (!template) {
|
|
74
73
|
throw new Error(`Could not get template ${mode}`);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
if (existsSync(file_path)) {
|
|
78
|
-
// eslint-disable-next-line no-console
|
|
79
77
|
console.error(`ERROR: File ${file_path} already exists.`);
|
|
80
78
|
return;
|
|
81
79
|
}
|
|
82
80
|
await fs.mkdir(resolve(file_path, "../"), { recursive: true });
|
|
83
81
|
await fs.writeFile(file_path, await template(action, file_path));
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
test_file_path,
|
|
87
|
-
await testTemplate(action, file_path)
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
// eslint-disable-next-line no-console
|
|
91
|
-
console.log(`${file_path} created`);
|
|
92
|
-
// eslint-disable-next-line no-console
|
|
93
|
-
console.log(`${test_file_path} created`);
|
|
82
|
+
console.info(`${file_path} created`);
|
|
83
|
+
console.info(`${test_file_path} created`);
|
|
94
84
|
await generateRoutes();
|
|
95
85
|
}
|
package/src/build.ts
CHANGED
|
@@ -64,7 +64,7 @@ async function build(watch: boolean): Promise<void> {
|
|
|
64
64
|
copy_to_public.map(async ({ from, to }) => {
|
|
65
65
|
try {
|
|
66
66
|
await fs.stat(resolve(project_dir, "public", to));
|
|
67
|
-
} catch (
|
|
67
|
+
} catch (_e) {
|
|
68
68
|
await fs.mkdir(resolve(project_dir, "public", to, "../"), {
|
|
69
69
|
recursive: true,
|
|
70
70
|
});
|
|
@@ -94,12 +94,14 @@ async function build(watch: boolean): Promise<void> {
|
|
|
94
94
|
];
|
|
95
95
|
await Promise.all(builders.map((b) => b.build()));
|
|
96
96
|
if (watch) {
|
|
97
|
-
const watcher = chokidar.watch("src", {
|
|
97
|
+
const watcher = chokidar.watch(["src", ...controller_dirs], {
|
|
98
|
+
ignoreInitial: true,
|
|
99
|
+
});
|
|
98
100
|
const port = await get_notifier_port();
|
|
99
101
|
const notifier = make_notifier(port, 8080); // TODO: parse the app config to get the actual port
|
|
100
102
|
await write_notifier_config(watch, port);
|
|
101
103
|
watcher.on("all", (_, file_path) => {
|
|
102
|
-
console.
|
|
104
|
+
console.info("Detected a change!", file_path);
|
|
103
105
|
builders.forEach((builder) => {
|
|
104
106
|
const owns_a_file = builder.ownsFile(file_path);
|
|
105
107
|
if (owns_a_file) {
|
|
@@ -123,7 +125,7 @@ export async function buildProject({
|
|
|
123
125
|
try {
|
|
124
126
|
await build(watch);
|
|
125
127
|
} catch (e) {
|
|
126
|
-
console.
|
|
128
|
+
console.error("CAUGHT!");
|
|
127
129
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
128
130
|
console.error(e.message);
|
|
129
131
|
if (!watch) {
|
package/src/builders/builder.ts
CHANGED
|
@@ -4,7 +4,10 @@ export abstract class Builder {
|
|
|
4
4
|
abstract _build(): Promise<void>;
|
|
5
5
|
abstract dispose(): Promise<void>;
|
|
6
6
|
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
public project_dir: string,
|
|
9
|
+
public style_dirs: string[]
|
|
10
|
+
) {}
|
|
8
11
|
|
|
9
12
|
public ongoing_build: Promise<void> | null = null;
|
|
10
13
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
1
|
import { build } from "esbuild";
|
|
3
2
|
import tempfile from "tempfile";
|
|
4
3
|
import { promises as fs } from "fs";
|
|
@@ -26,7 +25,6 @@ export class ColorsBuilder extends Builder {
|
|
|
26
25
|
return file_path == COLORS_TS_PATH;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
30
28
|
async dispose(): Promise<void> {}
|
|
31
29
|
|
|
32
30
|
async _build() {
|
|
@@ -242,8 +240,12 @@ export class ColorsBuilder extends Builder {
|
|
|
242
240
|
|
|
243
241
|
.hex {
|
|
244
242
|
padding: 8px;
|
|
245
|
-
font-family:
|
|
246
|
-
|
|
243
|
+
font-family:
|
|
244
|
+
Menlo,
|
|
245
|
+
Consolas,
|
|
246
|
+
Monaco,
|
|
247
|
+
Liberation Mono,
|
|
248
|
+
Lucida Console,
|
|
247
249
|
monospace;
|
|
248
250
|
opacity: 0.5;
|
|
249
251
|
visibility: hidden;
|
|
@@ -433,16 +435,16 @@ export class ColorsBuilder extends Builder {
|
|
|
433
435
|
)
|
|
434
436
|
? \`var(--color-\${box.getAttribute(
|
|
435
437
|
"data-color-group-name"
|
|
436
|
-
|
|
438
|
+
)}-\${box.getAttribute(
|
|
437
439
|
"data-color-name"
|
|
438
|
-
|
|
440
|
+
)})\`
|
|
439
441
|
: \`var(--color-\${box.getAttribute(
|
|
440
442
|
"data-color-group-name"
|
|
441
|
-
|
|
443
|
+
)}-\${box.getAttribute(
|
|
442
444
|
"data-color-name"
|
|
443
|
-
|
|
445
|
+
)}-\${box.getAttribute(
|
|
444
446
|
"data-color-shade-number"
|
|
445
|
-
|
|
447
|
+
)})\`;
|
|
446
448
|
navigator.clipboard.writeText(css_var);
|
|
447
449
|
pop_toast();
|
|
448
450
|
}
|
|
@@ -7,7 +7,10 @@ import { Builder } from "./builder.js";
|
|
|
7
7
|
|
|
8
8
|
export class CSSClump {
|
|
9
9
|
public files: string[] = [];
|
|
10
|
-
constructor(
|
|
10
|
+
constructor(
|
|
11
|
+
public project_dir: string,
|
|
12
|
+
public name: string
|
|
13
|
+
) {}
|
|
11
14
|
|
|
12
15
|
addFile(full_path: string) {
|
|
13
16
|
this.files.push(full_path);
|