@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { Templatable, FlatTemplatable } from "tempstream";
|
|
3
|
+
import { Page } from "./page.js";
|
|
4
|
+
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
5
|
+
import { FormControl } from "../forms/controls/controls.js";
|
|
6
|
+
import { FormField } from "../forms/fields/field.js";
|
|
7
|
+
import { NumberField } from "../forms/fields/number.js";
|
|
8
|
+
import { TextBasedSimpleField } from "../forms/fields/simple-form-field.js";
|
|
9
|
+
import { FormDataValue } from "../forms/form-types.js";
|
|
10
|
+
export declare const BasePagePropsShape: {};
|
|
11
|
+
export type BasePageProps = ShapeToType<typeof BasePagePropsShape>;
|
|
12
|
+
export declare const DEFAULT_ITEMS_PER_PAGE = 12;
|
|
13
|
+
export declare const BaseListPageFields: {
|
|
14
|
+
readonly page: NumberField<1, false>;
|
|
15
|
+
readonly itemsPerPage: NumberField<12, false>;
|
|
16
|
+
readonly sort: TextBasedSimpleField<false, import("../forms/controls/simple-input.js").SimpleInput<import("../forms/controls/simple-input.js").SimpleInputOptions>>;
|
|
17
|
+
};
|
|
18
|
+
export type ListSort = {
|
|
19
|
+
field: string;
|
|
20
|
+
order: "asc" | "desc";
|
|
21
|
+
};
|
|
22
|
+
export declare abstract class ListPage<ItemType, F extends typeof BaseListPageFields> extends Page<F> {
|
|
23
|
+
abstract getItems(ctx: Context, page: number, itemsPerPage: number | null, values: Record<string, FormDataValue>): Promise<ItemType[]>;
|
|
24
|
+
abstract getTotalPages(ctx: Context, itemsPerPage: number, values: Record<string, FormDataValue>): Promise<number>;
|
|
25
|
+
abstract renderItem(ctx: Context, item: ItemType, index: number): Promise<FlatTemplatable>;
|
|
26
|
+
filterFields: Record<string, FormField>;
|
|
27
|
+
filterControls: FormControl[];
|
|
28
|
+
init(): void;
|
|
29
|
+
renderListContainer(_: Context, content: Templatable): FlatTemplatable;
|
|
30
|
+
getPaginationConfig(ctx: Context): Promise<{
|
|
31
|
+
page: number;
|
|
32
|
+
itemsPerPage: number | null;
|
|
33
|
+
}>;
|
|
34
|
+
renderItems(ctx: Context, values?: Record<string, FormDataValue>, items?: ItemType[]): Promise<FlatTemplatable>;
|
|
35
|
+
renderPagination(ctx: Context, values: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
36
|
+
private renderPageButton;
|
|
37
|
+
getFilterValues(ctx: Context): Promise<Record<string, unknown>>;
|
|
38
|
+
getSort(ctx: Context): Promise<ListSort | null>;
|
|
39
|
+
makeSortLink(ctx: Context, field: string, order: "asc" | "desc" | null): string;
|
|
40
|
+
renderFilters(ctx: Context): Promise<FlatTemplatable>;
|
|
41
|
+
renderHeading(ctx: Context, field: string, label?: string): Promise<FlatTemplatable>;
|
|
42
|
+
getDefaultSort(_: Context): ListSort | null;
|
|
43
|
+
renderTableHead(ctx: Context, fields: {
|
|
44
|
+
field: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
}[]): FlatTemplatable;
|
|
47
|
+
render(ctx: Context): Promise<FlatTemplatable>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
5
|
+
import type { FieldsToShape, FormField } from "../forms/fields/field.js";
|
|
6
|
+
import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
|
|
7
|
+
import { Mountable } from "./mountable.js";
|
|
8
|
+
export type PageErrorMessage = {
|
|
9
|
+
type: "access" | "internal";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export type Fields = Record<string, FormField<boolean, any>>;
|
|
13
|
+
type Resolved<T> = T extends Promise<infer X> ? X : never;
|
|
14
|
+
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
|
|
15
|
+
export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
|
|
16
|
+
fields: F;
|
|
17
|
+
field_names_prefix: string;
|
|
18
|
+
form_id: string;
|
|
19
|
+
abstract controls: FormControl[];
|
|
20
|
+
constructor();
|
|
21
|
+
init(): void;
|
|
22
|
+
makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
|
|
23
|
+
validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
|
|
24
|
+
valid: boolean;
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
|
+
validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
|
+
valid: boolean;
|
|
30
|
+
field_errors: Partial<Record<keyof Fields, string>>;
|
|
31
|
+
form_messages: FormMessage[];
|
|
32
|
+
}>;
|
|
33
|
+
renderControls(fctx: FormControlContext): FlatTemplatable;
|
|
34
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
35
|
+
renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
36
|
+
abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
37
|
+
getParsedValues(ctx: Context): Promise<{
|
|
38
|
+
[field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
|
|
39
|
+
}>;
|
|
40
|
+
getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
5
|
+
import type { FieldsToShape, FormField } from "../forms/fields/field.js";
|
|
6
|
+
import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
|
|
7
|
+
import { Mountable } from "./mountable.js";
|
|
8
|
+
export type PageErrorMessage = {
|
|
9
|
+
type: "access" | "internal";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export type Fields = Record<string, FormField<boolean, any>>;
|
|
13
|
+
type Resolved<T> = T extends Promise<infer X> ? X : never;
|
|
14
|
+
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
|
|
15
|
+
export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
|
|
16
|
+
fields: F;
|
|
17
|
+
field_names_prefix: string;
|
|
18
|
+
form_id: string;
|
|
19
|
+
abstract controls: FormControl[];
|
|
20
|
+
constructor();
|
|
21
|
+
init(): void;
|
|
22
|
+
makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_name_prefix?: string, form_id?: string): FormControlContext;
|
|
23
|
+
validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
|
|
24
|
+
valid: boolean;
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
|
+
validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
|
+
valid: boolean;
|
|
30
|
+
field_errors: Partial<Record<keyof Fields, string>>;
|
|
31
|
+
form_messages: FormMessage[];
|
|
32
|
+
}>;
|
|
33
|
+
renderControls(fctx: FormControlContext): FlatTemplatable;
|
|
34
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
35
|
+
renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
36
|
+
abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
37
|
+
getParsedValues(ctx: Context): Promise<{
|
|
38
|
+
[field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
|
|
39
|
+
}>;
|
|
40
|
+
getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
2
|
import { Context } from "koa";
|
|
3
3
|
import { FlatTemplatable } from "tempstream";
|
|
4
|
-
import { FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
4
|
+
import { FieldMessages, FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
5
5
|
import type { FieldsToShape, FormField } from "../forms/fields/field.js";
|
|
6
6
|
import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
|
|
7
7
|
import { Mountable } from "./mountable.js";
|
|
@@ -11,7 +11,7 @@ export type PageErrorMessage = {
|
|
|
11
11
|
};
|
|
12
12
|
export type Fields = Record<string, FormField<boolean, any>>;
|
|
13
13
|
type Resolved<T> = T extends Promise<infer X> ? X : never;
|
|
14
|
-
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["
|
|
14
|
+
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
|
|
15
15
|
export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
|
|
16
16
|
fields: F;
|
|
17
17
|
field_names_prefix: string;
|
|
@@ -27,7 +27,7 @@ export declare abstract class MountableWithFields<F extends Fields = Fields> ext
|
|
|
27
27
|
getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
28
|
validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
29
|
valid: boolean;
|
|
30
|
-
field_errors:
|
|
30
|
+
field_errors: FieldMessages;
|
|
31
31
|
form_messages: FormMessage[];
|
|
32
32
|
}>;
|
|
33
33
|
renderControls(fctx: FormControlContext): FlatTemplatable;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ShapeToType } from "@sealcode/ts-predicates";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import { FieldMessages, FormControl, FormControlContext } from "../forms/controls/form-control.js";
|
|
5
|
+
import type { FieldsToShape, FormField } from "../forms/fields/field.js";
|
|
6
|
+
import type { FormDataValue, FormMessage, FormData } from "../forms/form-types.js";
|
|
7
|
+
import { Mountable } from "./mountable.js";
|
|
8
|
+
export type PageErrorMessage = {
|
|
9
|
+
type: "access" | "internal";
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export type Fields = Record<string, FormField<boolean, any>>;
|
|
13
|
+
type Resolved<T> = T extends Promise<infer X> ? X : never;
|
|
14
|
+
type ParsedValue<T extends FormField> = Resolved<ReturnType<T["getParsedValue"]>>["parsed"];
|
|
15
|
+
export declare abstract class MountableWithFields<F extends Fields = Fields> extends Mountable {
|
|
16
|
+
fields: F;
|
|
17
|
+
field_names_prefix: string;
|
|
18
|
+
form_id: string;
|
|
19
|
+
abstract controls: FormControl[];
|
|
20
|
+
constructor();
|
|
21
|
+
init(): void;
|
|
22
|
+
makeFormControlContext(ctx: Context, data: FormData, validate: boolean, field_messages: FieldMessages, field_name_prefix?: string, form_id?: string): FormControlContext;
|
|
23
|
+
validateValues(_ctx: Context, _data: Record<string, FormDataValue>): Promise<{
|
|
24
|
+
valid: boolean;
|
|
25
|
+
error: string;
|
|
26
|
+
}>;
|
|
27
|
+
getInitialValues(_ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
28
|
+
validate(ctx: Context, values: Record<string, FormDataValue>): Promise<{
|
|
29
|
+
valid: boolean;
|
|
30
|
+
field_errors: Partial<Record<keyof Fields, string>>;
|
|
31
|
+
form_messages: FormMessage[];
|
|
32
|
+
}>;
|
|
33
|
+
renderControls(fctx: FormControlContext): FlatTemplatable;
|
|
34
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
35
|
+
renderMessages(_: Context, data: FormData<keyof Fields>): FlatTemplatable;
|
|
36
|
+
abstract extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
37
|
+
getParsedValues(ctx: Context): Promise<{
|
|
38
|
+
[field in keyof F]: F[field] extends FormField<true> ? Exclude<ParsedValue<F[field]>, null> : ParsedValue<F[field]>;
|
|
39
|
+
}>;
|
|
40
|
+
getDatabaseValues(ctx: Context): Promise<ShapeToType<FieldsToShape<F>>>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
export declare abstract class Mountable {
|
|
4
|
+
init(): void;
|
|
5
|
+
abstract mount(router: Router, path: string): void;
|
|
6
|
+
abstract canAccess(ctx: Context): Promise<{
|
|
7
|
+
canAccess: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { FlatTemplatable } from "tempstream";
|
|
4
|
+
import type { FormDataValue } from "../forms/form-types.js";
|
|
5
|
+
import { Fields, MountableWithFields, PageErrorMessage } from "./mountable-with-fields.js";
|
|
6
|
+
import { PagePropsParser } from "./props-parser.js";
|
|
7
|
+
export declare abstract class Page<F extends Fields = Record<string, never>> extends MountableWithFields<F> {
|
|
8
|
+
propsParser: PagePropsParser<Record<keyof Fields, unknown>>;
|
|
9
|
+
controls: never[];
|
|
10
|
+
mount(router: Router, path: string): void;
|
|
11
|
+
canAccess(_: Context): Promise<{
|
|
12
|
+
canAccess: boolean;
|
|
13
|
+
message: string;
|
|
14
|
+
}>;
|
|
15
|
+
renderError(_: Context, error: PageErrorMessage): Promise<FlatTemplatable>;
|
|
16
|
+
abstract render(ctx: Context): Promise<FlatTemplatable>;
|
|
17
|
+
extractRawValues(ctx: Context): Promise<Record<string, FormDataValue>>;
|
|
18
|
+
}
|
package/@types/page/page.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Context } from "koa";
|
|
2
|
+
import { FormDataValue } from "../forms/form-types.js";
|
|
3
|
+
import type { BasePageProps } from "./list.js";
|
|
4
|
+
export type EncodedProps = Record<string, unknown>;
|
|
5
|
+
export declare abstract class PagePropsParser<PropsType> {
|
|
6
|
+
abstract decode(ctx: Context): Record<string, FormDataValue>;
|
|
7
|
+
abstract encode(props: Record<string, FormData>): EncodedProps;
|
|
8
|
+
abstract getHTMLInputName(prop_name: string): string;
|
|
9
|
+
overwriteProp(ctx: Context, new_props: Partial<PropsType>): EncodedProps;
|
|
10
|
+
}
|
|
11
|
+
export declare class AllQueryParams<PropsType extends BasePageProps> extends PagePropsParser<PropsType> {
|
|
12
|
+
decode(ctx: Context): Record<string, FormDataValue>;
|
|
13
|
+
encode(props: PropsType): Record<string, unknown>;
|
|
14
|
+
getHTMLInputName(prop_name: string): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Router from "@koa/router";
|
|
2
|
+
import { Context } from "koa";
|
|
3
|
+
import { Templatable } from "tempstream";
|
|
4
|
+
import { Mountable } from "./mountable.js";
|
|
5
|
+
export type StatefulPageActionDescription<ActionName> = {
|
|
6
|
+
action: ActionName;
|
|
7
|
+
label?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
} | ActionName;
|
|
11
|
+
export type StateAndMetadata<State, Actions> = {
|
|
12
|
+
state: State;
|
|
13
|
+
inputs: Record<string, string>;
|
|
14
|
+
action: keyof Actions;
|
|
15
|
+
action_args: string;
|
|
16
|
+
} | {
|
|
17
|
+
state: State;
|
|
18
|
+
inputs: Record<string, string>;
|
|
19
|
+
action: null;
|
|
20
|
+
action_args: null;
|
|
21
|
+
$: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export type StatefulPageActionArgument<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = {
|
|
24
|
+
ctx: Context;
|
|
25
|
+
state: State;
|
|
26
|
+
inputs: Record<string, string>;
|
|
27
|
+
args: Args;
|
|
28
|
+
page: StatefulPage<any, any>;
|
|
29
|
+
};
|
|
30
|
+
export type StatefulPageAction<State extends Record<string, unknown>, Args extends unknown[] = unknown[]> = (obj: StatefulPageActionArgument<State, Args>) => State | Promise<State>;
|
|
31
|
+
export type ExtractStatefulPageActionArgs<X> = X extends StatefulPageAction<any, infer Args> ? Args : never;
|
|
32
|
+
export declare abstract class StatefulPage<State extends Record<string, unknown>, Actions extends Record<string, StatefulPageAction<State>>> extends Mountable {
|
|
33
|
+
abstract actions: Actions;
|
|
34
|
+
abstract getInitialState(ctx: Context): State | Promise<State>;
|
|
35
|
+
abstract render(ctx: Context, state: State, inputs: Record<string, string>): Templatable | Promise<Templatable>;
|
|
36
|
+
canAccess(_ctx: Context): Promise<{
|
|
37
|
+
canAccess: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
}>;
|
|
40
|
+
constructor();
|
|
41
|
+
abstract wrapInLayout(ctx: Context, content: Templatable, state: State): Templatable;
|
|
42
|
+
wrapInForm(context: Context, state: State, content: Templatable): Promise<Templatable>;
|
|
43
|
+
extractActionAndLabel<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>): {
|
|
44
|
+
action: string;
|
|
45
|
+
label: string;
|
|
46
|
+
content: string;
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
};
|
|
49
|
+
makeActionURL<ActionName extends keyof Actions>(action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
50
|
+
makeActionButton<ActionName extends keyof Actions>(_state: State, action_description: StatefulPageActionDescription<ActionName>, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
51
|
+
makeActionCallback<ActionName extends keyof Actions>(action_description: {
|
|
52
|
+
action: ActionName;
|
|
53
|
+
label?: string;
|
|
54
|
+
} | ActionName, ...args: ExtractStatefulPageActionArgs<Actions[ActionName]>): string;
|
|
55
|
+
rerender(): string;
|
|
56
|
+
preprocessState(values: State): Promise<State>;
|
|
57
|
+
preprocessOverrides(_context: Context, _state: State, values: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
58
|
+
serializeState(_context: Context, state: State): Promise<string>;
|
|
59
|
+
deserializeState(_context: Context, s: string): Promise<State>;
|
|
60
|
+
extractState(ctx: Context): Promise<StateAndMetadata<State, Actions>>;
|
|
61
|
+
mount(router: Router, path: string): void;
|
|
62
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function registerExternalControllers(
|
|
2
|
-
export declare function registerExternalStyles(
|
|
1
|
+
export declare function registerExternalControllers(_args: Record<string, string | boolean>): Promise<void>;
|
|
2
|
+
export declare function registerExternalStyles(_args: Record<string, string | boolean>): Promise<void>;
|
|
@@ -10,7 +10,5 @@ declare const defaults: {
|
|
|
10
10
|
other_methods: string;
|
|
11
11
|
success_message: string;
|
|
12
12
|
};
|
|
13
|
-
export declare function formTemplate(action_name: string,
|
|
14
|
-
success_message: string;
|
|
15
|
-
}): Promise<string>;
|
|
13
|
+
export declare function formTemplate(action_name: string, _params?: Partial<typeof defaults>): Promise<string>;
|
|
16
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function jddComponentTemplate(component_name: string): string
|
|
1
|
+
export declare function jddComponentTemplate(component_name: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function pageTemplate(action_name: string
|
|
1
|
+
export declare function pageTemplate(action_name: string): Promise<string>;
|
package/@types/templates/shared/shared-crud-form-fields.d.sync-conflict-20250918-184306-TFDLWFG.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sharedCrudFormFields(collection_name: string, newfilefullpath: string): Promise<string>;
|
|
@@ -1,68 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type FieldHandlerResult = {
|
|
3
|
-
imports: Partial<{
|
|
4
|
-
shared: string;
|
|
5
|
-
edit: string;
|
|
6
|
-
}>;
|
|
7
|
-
hide_field: boolean;
|
|
8
|
-
field: string;
|
|
9
|
-
hide_control: boolean;
|
|
10
|
-
controls: string;
|
|
11
|
-
is_required: boolean;
|
|
12
|
-
is_required_expr: string;
|
|
13
|
-
fields_var: string;
|
|
14
|
-
top_level_shared: string;
|
|
15
|
-
name: string;
|
|
16
|
-
hide_initial_value_edit: boolean;
|
|
17
|
-
initial_value_edit: Partial<{
|
|
18
|
-
main_value: string;
|
|
19
|
-
parsed_value: string;
|
|
20
|
-
fallback_value: string;
|
|
21
|
-
}> | string;
|
|
22
|
-
hide_initial_value_create: boolean;
|
|
23
|
-
initial_value_create: string;
|
|
24
|
-
pre_edit: string;
|
|
25
|
-
post_edit: string;
|
|
26
|
-
pre_create: string;
|
|
27
|
-
post_create: string;
|
|
28
|
-
sealious_value: (result: Exclude<FieldHandlerResult, "sealious_value">) => string;
|
|
29
|
-
hide_sealious_value: boolean;
|
|
30
|
-
fallback_value_sealious: string;
|
|
31
|
-
main_value_sealious: string;
|
|
32
|
-
};
|
|
33
|
-
export type FieldHandler<Defaults extends Partial<FieldHandlerResult>, Result extends Partial<FieldHandlerResult>> = (collection_name: string, field: ExtractedFieldInfo, importPath: (path: string) => string, defaults: Defaults, all_other_handlers: Record<string, FieldHandler<FieldHandlerResult, Partial<FieldHandlerResult>> | undefined>, fields_var?: string) => Promise<Result>;
|
|
34
|
-
export declare const field_handlers: Record<Exclude<string, "default">, FieldHandler<FieldHandlerResult, Partial<FieldHandlerResult>> | undefined> & {
|
|
35
|
-
default: FieldHandler<Record<string, never>, FieldHandlerResult>;
|
|
36
|
-
};
|
|
37
|
-
export declare function getFieldHandler(collection_name: string, field: ExtractedFieldInfo, importPath: (path: string) => string, fields_var?: string): Promise<{
|
|
38
|
-
imports: Partial<{
|
|
39
|
-
shared: string;
|
|
40
|
-
edit: string;
|
|
41
|
-
}>;
|
|
42
|
-
hide_field: boolean;
|
|
43
|
-
field: string;
|
|
44
|
-
hide_control: boolean;
|
|
45
|
-
controls: string;
|
|
46
|
-
is_required: boolean;
|
|
47
|
-
is_required_expr: string;
|
|
48
|
-
fields_var: string;
|
|
49
|
-
top_level_shared: string;
|
|
50
|
-
name: string;
|
|
51
|
-
hide_initial_value_edit: boolean;
|
|
52
|
-
initial_value_edit: string | Partial<{
|
|
53
|
-
main_value: string;
|
|
54
|
-
parsed_value: string;
|
|
55
|
-
fallback_value: string;
|
|
56
|
-
}>;
|
|
57
|
-
hide_initial_value_create: boolean;
|
|
58
|
-
initial_value_create: string;
|
|
59
|
-
pre_edit: string;
|
|
60
|
-
post_edit: string;
|
|
61
|
-
pre_create: string;
|
|
62
|
-
post_create: string;
|
|
63
|
-
sealious_value: (result: FieldHandlerResult) => string;
|
|
64
|
-
hide_sealious_value: boolean;
|
|
65
|
-
fallback_value_sealious: string;
|
|
66
|
-
main_value_sealious: string;
|
|
67
|
-
}>;
|
|
68
|
-
export declare function sharedCrudFormFields(collection_name: string, newfilefullpath: string): Promise<string>;
|
|
1
|
+
export declare function sharedCrudFormFields(collection_name: string): Promise<string>;
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jddComponentTemplate } from "./jdd-component.js";
|
|
3
|
-
import { LongRunningProcessTemplate } from "./long-running-process.js";
|
|
4
|
-
import { multiformTemplate } from "./multiform.js";
|
|
5
|
-
import { pageTemplate } from "./page.js";
|
|
6
|
-
import { postTemplate } from "./post.js";
|
|
7
|
-
import { redirectTemplate } from "./redirect.js";
|
|
8
|
-
import { statefulPageTemplate } from "./stateful-page.js";
|
|
9
|
-
import { jddEditorTemplate } from "./jdd-editor.js";
|
|
10
|
-
export declare const Templates: {
|
|
11
|
-
page: typeof pageTemplate;
|
|
12
|
-
form: typeof formTemplate;
|
|
13
|
-
list: (action_name: string, newfilefullpath: string) => Promise<string>;
|
|
14
|
-
multiform: typeof multiformTemplate;
|
|
15
|
-
redirect: typeof redirectTemplate;
|
|
16
|
-
post: typeof postTemplate;
|
|
17
|
-
sreact: typeof statefulPageTemplate;
|
|
18
|
-
lpr: typeof LongRunningProcessTemplate;
|
|
19
|
-
jdd: typeof jddComponentTemplate;
|
|
20
|
-
"jdd-editor": typeof jddEditorTemplate;
|
|
21
|
-
};
|
|
1
|
+
export declare const Templates: Record<string, (action: string, params: any) => Promise<string>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import EventEmitter from "events";
|
|
2
|
+
export declare const callSealgenBin: () => string;
|
|
3
|
+
export declare class RealAppTest {
|
|
4
|
+
node_pid: number;
|
|
5
|
+
app_port: number;
|
|
6
|
+
mongo_port: number;
|
|
7
|
+
app_path: string;
|
|
8
|
+
container_name: string;
|
|
9
|
+
emitter: EventEmitter<[never]>;
|
|
10
|
+
static init(): Promise<RealAppTest>;
|
|
11
|
+
start(): Promise<void>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
runSealgenCommand(command: string): Promise<void>;
|
|
14
|
+
build(): Promise<void>;
|
|
15
|
+
throwIfItKillsTheApp<T>(cb: () => Promise<T>): Promise<T>;
|
|
16
|
+
httpGET(path: string): Promise<{
|
|
17
|
+
status: number;
|
|
18
|
+
response: string;
|
|
19
|
+
}>;
|
|
20
|
+
httpPOST(path: string, body: Record<string, unknown>): Promise<{
|
|
21
|
+
status: number;
|
|
22
|
+
response: string;
|
|
23
|
+
}>;
|
|
24
|
+
addFile(target_path: string, content: string): Promise<void>;
|
|
25
|
+
fullURL(path: string): string;
|
|
26
|
+
}
|
package/@types/utils/extract-fields-from-collection.d.sync-conflict-20250918-184312-TFDLWFG.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormField } from "../forms/fields/field.js";
|
|
2
|
+
export type ExtractedFieldInfo = {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
target: string | null;
|
|
6
|
+
referencing_collection: string | null;
|
|
7
|
+
referencing_field: string | null;
|
|
8
|
+
intermediary_field_that_points_there: string | null;
|
|
9
|
+
is_readonly: boolean;
|
|
10
|
+
is_required: boolean;
|
|
11
|
+
subfields: {
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
|
|
16
|
+
form_field: FormField;
|
|
17
|
+
};
|
|
18
|
+
export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormField } from "../forms/fields/field.js";
|
|
1
2
|
export type ExtractedFieldInfo = {
|
|
2
3
|
name: string;
|
|
3
4
|
type: string;
|
|
@@ -11,4 +12,7 @@ export type ExtractedFieldInfo = {
|
|
|
11
12
|
name: string;
|
|
12
13
|
}[];
|
|
13
14
|
};
|
|
14
|
-
export
|
|
15
|
+
export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
|
|
16
|
+
form_field: FormField;
|
|
17
|
+
};
|
|
18
|
+
export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
|
package/@types/utils/extract-fields-from-collection.sync-conflict-20250918-222045-TFDLWFG.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormField } from "../forms/fields/field.js";
|
|
2
|
+
export type ExtractedFieldInfo = {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
target: string | null;
|
|
6
|
+
referencing_collection: string | null;
|
|
7
|
+
referencing_field: string | null;
|
|
8
|
+
intermediary_field_that_points_there: string | null;
|
|
9
|
+
is_readonly: boolean;
|
|
10
|
+
is_required: boolean;
|
|
11
|
+
subfields: {
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
export type ExtractedFieldInfoWithFormField = ExtractedFieldInfo & {
|
|
16
|
+
form_field: FormField;
|
|
17
|
+
};
|
|
18
|
+
export default function extract_fields_from_collection(collection_name: string): Promise<ExtractedFieldInfoWithFormField[]>;
|
package/README.md
CHANGED
|
@@ -67,3 +67,8 @@ You can add these commands to your module's `package.json` postinstall script to
|
|
|
67
67
|
5. If the path is already present, it doesn't add a duplicate
|
|
68
68
|
|
|
69
69
|
This ensures that when your module is installed as a dependency, the parent project will automatically know where to find your controllers and styles.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Attributions
|
|
73
|
+
|
|
74
|
+
File icon - Gnome Project
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="m 28 8 h 50 l 30.042969 29.917969 v 74.058593 c 0 4.433594 -3.609375 8.023438 -8.042969 8.023438 h -72 c -4.433594 0 -8 -3.566406 -8 -8 v -96 c 0 -4.433594 3.566406 -8 8 -8 z m 0 0" fill="#f6f5f4"/>
|
|
4
|
+
<path d="m 78 8 v 22 c 0 4.433594 3.609375 7.921875 8.042969 7.921875 l 22 -0.003906 z m 0 0" fill="#deddda"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
5
|
+
|
|
6
|
+
export default defineConfig(
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
tseslint.configs.recommended,
|
|
9
|
+
tseslint.configs.recommendedTypeChecked,
|
|
10
|
+
eslintConfigPrettier,
|
|
11
|
+
{
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parserOptions: {
|
|
14
|
+
projectService: true,
|
|
15
|
+
tsconfigRootDir: import.meta.dirname,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
rules: {
|
|
21
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
22
|
+
"prefer-const": "warn",
|
|
23
|
+
"no-console": ["error", { allow: ["warn", "error", "info"] }],
|
|
24
|
+
"no-await-in-loop": "error",
|
|
25
|
+
"@typescript-eslint/require-await": "off",
|
|
26
|
+
"@typescript-eslint/prefer-promise-reject-errors": "off",
|
|
27
|
+
"@typescript-eslint/no-unused-vars": [
|
|
28
|
+
"error",
|
|
29
|
+
{
|
|
30
|
+
args: "after-used",
|
|
31
|
+
argsIgnorePattern: "^_",
|
|
32
|
+
caughtErrorsIgnorePattern: "^_",
|
|
33
|
+
destructuredArrayIgnorePattern: "^_",
|
|
34
|
+
varsIgnorePattern: "^_",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defineConfig({
|
|
40
|
+
files: ["src/**/*.test.ts"],
|
|
41
|
+
rules: {
|
|
42
|
+
"no-empty-pattern": "off",
|
|
43
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
44
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
45
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
46
|
+
"prefer-const": "off",
|
|
47
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
48
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
49
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
50
|
+
"no-await-in-loop": "off",
|
|
51
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
52
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
53
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
);
|