@groupteknology/vuno 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -27
- package/dist/module.d.mts +14 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +80 -13
- package/dist/runtime/app/assets/css/dialog.css +1 -0
- package/dist/runtime/app/assets/css/main.css +1 -0
- package/dist/runtime/app/assets/css/stylesheet.css +1 -0
- package/dist/runtime/app/assets/css/theme.css +1 -0
- package/dist/runtime/app/assets/css/tokens.css +1 -0
- package/dist/runtime/app/components/Alert/Alert.d.vue.ts +20 -0
- package/dist/runtime/app/components/Alert/Alert.theme.d.ts +13 -0
- package/dist/runtime/app/components/Alert/Alert.theme.js +13 -0
- package/dist/runtime/app/components/Alert/Alert.vue +59 -0
- package/dist/runtime/app/components/Alert/Alert.vue.d.ts +20 -0
- package/dist/runtime/app/components/App/App.d.vue.ts +52 -0
- package/dist/runtime/app/components/App/App.vue +150 -0
- package/dist/runtime/app/components/App/App.vue.d.ts +52 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.d.vue.ts +7 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.vue +39 -0
- package/dist/runtime/app/components/App/internal/Overlay/Overlay.vue.d.ts +7 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.d.vue.ts +8 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.vue +19 -0
- package/dist/runtime/app/components/App/internal/OverlayItem/OverlayItem.vue.d.ts +8 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.d.vue.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.theme.d.ts +13 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.theme.js +18 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.vue +64 -0
- package/dist/runtime/app/components/App/internal/Toast/Toast.vue.d.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.d.vue.ts +11 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.theme.d.ts +15 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.theme.js +16 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.vue +100 -0
- package/dist/runtime/app/components/App/internal/Toaster/Toaster.vue.d.ts +11 -0
- package/dist/runtime/app/components/Avatar/Avatar.d.vue.ts +27 -0
- package/dist/runtime/app/components/Avatar/Avatar.theme.d.ts +30 -0
- package/dist/runtime/app/components/Avatar/Avatar.theme.js +22 -0
- package/dist/runtime/app/components/Avatar/Avatar.vue +51 -0
- package/dist/runtime/app/components/Avatar/Avatar.vue.d.ts +27 -0
- package/dist/runtime/app/components/Badge/Badge.d.vue.ts +40 -0
- package/dist/runtime/app/components/Badge/Badge.theme.d.ts +40 -0
- package/dist/runtime/app/components/Badge/Badge.theme.js +22 -0
- package/dist/runtime/app/components/Badge/Badge.vue +28 -0
- package/dist/runtime/app/components/Badge/Badge.vue.d.ts +40 -0
- package/dist/runtime/app/components/Button/Button.d.vue.ts +49 -0
- package/dist/runtime/app/components/Button/Button.theme.d.ts +88 -0
- package/dist/runtime/app/components/Button/Button.theme.js +59 -0
- package/dist/runtime/app/components/Button/Button.vue +78 -0
- package/dist/runtime/app/components/Button/Button.vue.d.ts +49 -0
- package/dist/runtime/app/components/Card/Card.d.vue.ts +94 -0
- package/dist/runtime/app/components/Card/Card.theme.d.ts +57 -0
- package/dist/runtime/app/components/Card/Card.theme.js +62 -0
- package/dist/runtime/app/components/Card/Card.vue +45 -0
- package/dist/runtime/app/components/Card/Card.vue.d.ts +94 -0
- package/dist/runtime/app/components/Code/Code.d.vue.ts +19 -0
- package/dist/runtime/app/components/Code/Code.theme.d.ts +11 -0
- package/dist/runtime/app/components/Code/Code.theme.js +12 -0
- package/dist/runtime/app/components/Code/Code.vue +109 -0
- package/dist/runtime/app/components/Code/Code.vue.d.ts +19 -0
- package/dist/runtime/app/components/Confirm/Confirm.d.vue.ts +35 -0
- package/dist/runtime/app/components/Confirm/Confirm.theme.d.ts +12 -0
- package/dist/runtime/app/components/Confirm/Confirm.theme.js +13 -0
- package/dist/runtime/app/components/Confirm/Confirm.vue +83 -0
- package/dist/runtime/app/components/Confirm/Confirm.vue.d.ts +35 -0
- package/dist/runtime/app/components/Container/Container.d.vue.ts +42 -0
- package/dist/runtime/app/components/Container/Container.theme.d.ts +53 -0
- package/dist/runtime/app/components/Container/Container.theme.js +31 -0
- package/dist/runtime/app/components/Container/Container.vue +20 -0
- package/dist/runtime/app/components/Container/Container.vue.d.ts +42 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.d.vue.ts +26 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.theme.d.ts +16 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.theme.js +13 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.vue +26 -0
- package/dist/runtime/app/components/ControlGroup/ControlGroup.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.theme.d.ts +12 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.theme.js +13 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.vue +173 -0
- package/dist/runtime/app/components/FieldArray/FieldArray.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.theme.js +2 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.vue +39 -0
- package/dist/runtime/app/components/FieldCheckbox/FieldCheckbox.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.d.vue.ts +40 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.theme.d.ts +30 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.theme.js +10 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.vue +40 -0
- package/dist/runtime/app/components/FieldCheckbox/internal/Checkbox/Checkbox.vue.d.ts +40 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.theme.d.ts +27 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.theme.js +18 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.vue +88 -0
- package/dist/runtime/app/components/FieldColor/FieldColor.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.theme.js +2 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.vue +51 -0
- package/dist/runtime/app/components/FieldCurrency/FieldCurrency.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.theme.js +2 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.vue +99 -0
- package/dist/runtime/app/components/FieldFile/FieldFile.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.d.vue.ts +66 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.theme.d.ts +88 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.theme.js +55 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.vue +187 -0
- package/dist/runtime/app/components/FieldFile/internal/FileUpload/FileUpload.vue.d.ts +66 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.d.vue.ts +24 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.theme.js +2 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.vue +61 -0
- package/dist/runtime/app/components/FieldInput/FieldInput.vue.d.ts +24 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.theme.js +2 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.vue +47 -0
- package/dist/runtime/app/components/FieldNumber/FieldNumber.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.theme.js +2 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.vue +62 -0
- package/dist/runtime/app/components/FieldPassword/FieldPassword.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.theme.js +2 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.vue +41 -0
- package/dist/runtime/app/components/FieldRadio/FieldRadio.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.d.vue.ts +32 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.theme.d.ts +54 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.theme.js +31 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.vue +80 -0
- package/dist/runtime/app/components/FieldRadio/internal/RadioGroup/RadioGroup.vue.d.ts +32 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.d.vue.ts +17 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.theme.d.ts +6 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.theme.js +7 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.vue +74 -0
- package/dist/runtime/app/components/FieldSearch/FieldSearch.vue.d.ts +17 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.theme.js +2 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.vue +45 -0
- package/dist/runtime/app/components/FieldSelect/FieldSelect.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.d.vue.ts +97 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.theme.d.ts +36 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.theme.js +49 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.vue +196 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/Select.vue.d.ts +97 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/option.d.ts +25 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/option.js +6 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/useVunoSelectState.d.ts +30 -0
- package/dist/runtime/app/components/FieldSelect/internal/Select/useVunoSelectState.js +142 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.theme.js +2 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.vue +113 -0
- package/dist/runtime/app/components/FieldSlug/FieldSlug.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.theme.js +2 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.vue +37 -0
- package/dist/runtime/app/components/FieldSwitch/FieldSwitch.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.theme.d.ts +39 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.theme.js +20 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.vue +46 -0
- package/dist/runtime/app/components/FieldSwitch/internal/Switch/Switch.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.d.vue.ts +13 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.theme.js +2 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.vue +41 -0
- package/dist/runtime/app/components/FieldTags/FieldTags.vue.d.ts +13 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.theme.d.ts +34 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.theme.js +20 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.vue +97 -0
- package/dist/runtime/app/components/FieldTags/internal/TagsInput/TagsInput.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.d.vue.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.theme.d.ts +5 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.theme.js +2 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.vue +45 -0
- package/dist/runtime/app/components/FieldTextarea/FieldTextarea.vue.d.ts +26 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.d.vue.ts +34 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.theme.d.ts +36 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.theme.js +37 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.vue +43 -0
- package/dist/runtime/app/components/FieldTextarea/internal/Textarea/Textarea.vue.d.ts +34 -0
- package/dist/runtime/app/components/Form/Form.d.vue.ts +52 -0
- package/dist/runtime/app/components/Form/Form.theme.d.ts +9 -0
- package/dist/runtime/app/components/Form/Form.theme.js +10 -0
- package/dist/runtime/app/components/Form/Form.vue +129 -0
- package/dist/runtime/app/components/Form/Form.vue.d.ts +52 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.d.vue.ts +7 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.vue +67 -0
- package/dist/runtime/app/components/Form/internal/FormFieldRenderer/FormFieldRenderer.vue.d.ts +7 -0
- package/dist/runtime/app/components/Form/internal/grid.d.ts +9 -0
- package/dist/runtime/app/components/Form/internal/grid.js +91 -0
- package/dist/runtime/app/components/Form/internal/standard-schema.d.ts +29 -0
- package/dist/runtime/app/components/Form/internal/standard-schema.js +15 -0
- package/dist/runtime/app/components/Form/internal/useVunoFormState.d.ts +43 -0
- package/dist/runtime/app/components/Form/internal/useVunoFormState.js +81 -0
- package/dist/runtime/app/components/FormField/FormField.d.vue.ts +35 -0
- package/dist/runtime/app/components/FormField/FormField.theme.d.ts +62 -0
- package/dist/runtime/app/components/FormField/FormField.theme.js +28 -0
- package/dist/runtime/app/components/FormField/FormField.vue +124 -0
- package/dist/runtime/app/components/FormField/FormField.vue.d.ts +35 -0
- package/dist/runtime/app/components/FormModal/FormModal.d.vue.ts +63 -0
- package/dist/runtime/app/components/FormModal/FormModal.theme.d.ts +8 -0
- package/dist/runtime/app/components/FormModal/FormModal.theme.js +9 -0
- package/dist/runtime/app/components/FormModal/FormModal.vue +95 -0
- package/dist/runtime/app/components/FormModal/FormModal.vue.d.ts +63 -0
- package/dist/runtime/app/components/FormSection/FormSection.d.vue.ts +15 -0
- package/dist/runtime/app/components/FormSection/FormSection.theme.d.ts +12 -0
- package/dist/runtime/app/components/FormSection/FormSection.theme.js +14 -0
- package/dist/runtime/app/components/FormSection/FormSection.vue +45 -0
- package/dist/runtime/app/components/FormSection/FormSection.vue.d.ts +15 -0
- package/dist/runtime/app/components/Icon/Icon.d.vue.ts +6 -0
- package/dist/runtime/app/components/Icon/Icon.vue +32 -0
- package/dist/runtime/app/components/Icon/Icon.vue.d.ts +6 -0
- package/dist/runtime/app/components/Menu/Menu.d.vue.ts +36 -0
- package/dist/runtime/app/components/Menu/Menu.theme.d.ts +17 -0
- package/dist/runtime/app/components/Menu/Menu.theme.js +20 -0
- package/dist/runtime/app/components/Menu/Menu.vue +182 -0
- package/dist/runtime/app/components/Menu/Menu.vue.d.ts +36 -0
- package/dist/runtime/app/components/Modal/Modal.d.vue.ts +43 -0
- package/dist/runtime/app/components/Modal/Modal.theme.d.ts +59 -0
- package/dist/runtime/app/components/Modal/Modal.theme.js +47 -0
- package/dist/runtime/app/components/Modal/Modal.vue +215 -0
- package/dist/runtime/app/components/Modal/Modal.vue.d.ts +43 -0
- package/dist/runtime/app/components/Navbar/Navbar.d.vue.ts +45 -0
- package/dist/runtime/app/components/Navbar/Navbar.theme.d.ts +31 -0
- package/dist/runtime/app/components/Navbar/Navbar.theme.js +32 -0
- package/dist/runtime/app/components/Navbar/Navbar.vue +47 -0
- package/dist/runtime/app/components/Navbar/Navbar.vue.d.ts +45 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.d.vue.ts +38 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.theme.d.ts +32 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.theme.js +35 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.vue +187 -0
- package/dist/runtime/app/components/NavigationList/NavigationList.vue.d.ts +38 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.d.vue.ts +31 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.theme.d.ts +26 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.theme.js +27 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.vue +236 -0
- package/dist/runtime/app/components/NavigationMenu/NavigationMenu.vue.d.ts +31 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.d.vue.ts +14 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.theme.d.ts +9 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.theme.js +10 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.vue +81 -0
- package/dist/runtime/app/components/NavigationToc/NavigationToc.vue.d.ts +14 -0
- package/dist/runtime/app/components/Page/Page.d.vue.ts +40 -0
- package/dist/runtime/app/components/Page/Page.theme.d.ts +32 -0
- package/dist/runtime/app/components/Page/Page.theme.js +31 -0
- package/dist/runtime/app/components/Page/Page.vue +132 -0
- package/dist/runtime/app/components/Page/Page.vue.d.ts +40 -0
- package/dist/runtime/app/components/Pagination/Pagination.d.vue.ts +33 -0
- package/dist/runtime/app/components/Pagination/Pagination.theme.d.ts +13 -0
- package/dist/runtime/app/components/Pagination/Pagination.theme.js +14 -0
- package/dist/runtime/app/components/Pagination/Pagination.vue +129 -0
- package/dist/runtime/app/components/Pagination/Pagination.vue.d.ts +33 -0
- package/dist/runtime/app/components/Slideover/Slideover.d.vue.ts +43 -0
- package/dist/runtime/app/components/Slideover/Slideover.theme.d.ts +35 -0
- package/dist/runtime/app/components/Slideover/Slideover.theme.js +24 -0
- package/dist/runtime/app/components/Slideover/Slideover.vue +58 -0
- package/dist/runtime/app/components/Slideover/Slideover.vue.d.ts +43 -0
- package/dist/runtime/app/components/State/State.d.vue.ts +14 -0
- package/dist/runtime/app/components/State/State.theme.d.ts +19 -0
- package/dist/runtime/app/components/State/State.theme.js +26 -0
- package/dist/runtime/app/components/State/State.vue +66 -0
- package/dist/runtime/app/components/State/State.vue.d.ts +14 -0
- package/dist/runtime/app/components/Table/Table.d.vue.ts +80 -0
- package/dist/runtime/app/components/Table/Table.theme.d.ts +50 -0
- package/dist/runtime/app/components/Table/Table.theme.js +64 -0
- package/dist/runtime/app/components/Table/Table.vue +483 -0
- package/dist/runtime/app/components/Table/Table.vue.d.ts +80 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.vue +26 -0
- package/dist/runtime/app/components/Table/internal/CellBadge/CellBadge.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.theme.d.ts +21 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.theme.js +11 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.vue +32 -0
- package/dist/runtime/app/components/Table/internal/CellBoolean/CellBoolean.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.vue +16 -0
- package/dist/runtime/app/components/Table/internal/CellCurrency/CellCurrency.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.vue +21 -0
- package/dist/runtime/app/components/Table/internal/CellDate/CellDate.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.vue +24 -0
- package/dist/runtime/app/components/Table/internal/CellImage/CellImage.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.theme.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.theme.js +4 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.vue +17 -0
- package/dist/runtime/app/components/Table/internal/CellNumber/CellNumber.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.d.vue.ts +5 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.theme.d.ts +13 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.theme.js +11 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.vue +16 -0
- package/dist/runtime/app/components/Table/internal/CellText/CellText.vue.d.ts +5 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.d.vue.ts +22 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.vue +48 -0
- package/dist/runtime/app/components/Table/internal/TableCell/TableCell.vue.d.ts +22 -0
- package/dist/runtime/app/components/Table/internal/column.d.ts +9 -0
- package/dist/runtime/app/components/Table/internal/column.js +5 -0
- package/dist/runtime/app/components/Table/internal/query.d.ts +18 -0
- package/dist/runtime/app/components/Table/internal/query.js +8 -0
- package/dist/runtime/app/components/Table/internal/selection.d.ts +29 -0
- package/dist/runtime/app/components/Table/internal/selection.js +10 -0
- package/dist/runtime/app/components/Table/internal/useVunoTable.d.ts +93 -0
- package/dist/runtime/app/components/Table/internal/useVunoTable.js +153 -0
- package/dist/runtime/app/components/Table/internal/useVunoTableSelection.d.ts +21 -0
- package/dist/runtime/app/components/Table/internal/useVunoTableSelection.js +29 -0
- package/dist/runtime/app/components/Tabs/Tabs.d.vue.ts +49 -0
- package/dist/runtime/app/components/Tabs/Tabs.theme.d.ts +32 -0
- package/dist/runtime/app/components/Tabs/Tabs.theme.js +23 -0
- package/dist/runtime/app/components/Tabs/Tabs.vue +119 -0
- package/dist/runtime/app/components/Tabs/Tabs.vue.d.ts +49 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.d.vue.ts +40 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.theme.d.ts +12 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.theme.js +13 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.vue +139 -0
- package/dist/runtime/app/components/Tooltip/Tooltip.vue.d.ts +40 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.d.vue.ts +41 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.theme.d.ts +50 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.theme.js +38 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.vue +33 -0
- package/dist/runtime/app/components/internal/ControlShell/ControlShell.vue.d.ts +41 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.d.vue.ts +23 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.vue +63 -0
- package/dist/runtime/app/components/internal/FieldShell/FieldShell.vue.d.ts +23 -0
- package/dist/runtime/app/components/internal/Input/Input.d.vue.ts +52 -0
- package/dist/runtime/app/components/internal/Input/Input.theme.d.ts +30 -0
- package/dist/runtime/app/components/internal/Input/Input.theme.js +21 -0
- package/dist/runtime/app/components/internal/Input/Input.vue +66 -0
- package/dist/runtime/app/components/internal/Input/Input.vue.d.ts +52 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.d.vue.ts +36 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.theme.d.ts +31 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.theme.js +26 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.vue +221 -0
- package/dist/runtime/app/components/internal/NumberInput/NumberInput.vue.d.ts +36 -0
- package/dist/runtime/app/components/internal/NumberInput/number.d.ts +42 -0
- package/dist/runtime/app/components/internal/NumberInput/number.js +64 -0
- package/dist/runtime/app/composables/defineShortcuts.d.ts +19 -0
- package/dist/runtime/app/composables/defineShortcuts.js +68 -0
- package/dist/runtime/app/composables/internal/useVunoAnchor.d.ts +45 -0
- package/dist/runtime/app/composables/internal/useVunoAnchor.js +35 -0
- package/dist/runtime/app/composables/internal/useVunoControlGroup.d.ts +17 -0
- package/dist/runtime/app/composables/internal/useVunoControlGroup.js +18 -0
- package/dist/runtime/app/composables/internal/useVunoPortal.d.ts +18 -0
- package/dist/runtime/app/composables/internal/useVunoPortal.js +12 -0
- package/dist/runtime/app/composables/useConfirm.d.ts +15 -0
- package/dist/runtime/app/composables/useConfirm.js +5 -0
- package/dist/runtime/app/composables/useContext.d.ts +11 -0
- package/dist/runtime/app/composables/useContext.js +9 -0
- package/dist/runtime/app/composables/useCrud.d.ts +23 -0
- package/dist/runtime/app/composables/useCrud.js +153 -0
- package/dist/runtime/app/composables/useField.d.ts +10 -0
- package/dist/runtime/app/composables/useField.js +42 -0
- package/dist/runtime/app/composables/useForm.d.ts +5 -0
- package/dist/runtime/app/composables/useForm.js +9 -0
- package/dist/runtime/app/composables/useModal.d.ts +21 -0
- package/dist/runtime/app/composables/useModal.js +24 -0
- package/dist/runtime/app/composables/useOverlay.d.ts +22 -0
- package/dist/runtime/app/composables/useOverlay.js +10 -0
- package/dist/runtime/app/composables/useTableQuery.d.ts +10 -0
- package/dist/runtime/app/composables/useTableQuery.js +126 -0
- package/dist/runtime/app/composables/useTheme.d.ts +31 -0
- package/dist/runtime/app/composables/useTheme.js +29 -0
- package/dist/runtime/app/composables/useToast.d.ts +28 -0
- package/dist/runtime/app/composables/useToast.js +13 -0
- package/dist/runtime/app/internal/keys.d.ts +43 -0
- package/dist/runtime/app/internal/keys.js +8 -0
- package/dist/runtime/app/internal/slots.d.ts +22 -0
- package/dist/runtime/app/internal/slots.js +24 -0
- package/dist/runtime/app/plugins/vue-query.d.ts +8 -0
- package/dist/runtime/app/plugins/vue-query.js +13 -0
- package/dist/runtime/app/theme/icons.d.ts +2 -0
- package/dist/runtime/app/theme/icons.js +43 -0
- package/dist/runtime/app/theme/index.d.ts +1168 -0
- package/dist/runtime/app/theme/index.js +120 -0
- package/dist/runtime/app/theme/messages.d.ts +2 -0
- package/dist/runtime/app/theme/messages.js +70 -0
- package/dist/runtime/app/theme/shared.d.ts +42 -0
- package/dist/runtime/app/theme/shared.js +24 -0
- package/dist/runtime/app/types/alert.d.ts +13 -0
- package/dist/runtime/app/types/alert.js +0 -0
- package/dist/runtime/app/types/app-config.d.ts +8 -0
- package/dist/runtime/app/types/app-config.js +1 -0
- package/dist/runtime/app/types/app.d.ts +83 -0
- package/dist/runtime/app/types/app.js +0 -0
- package/dist/runtime/app/types/base.d.ts +78 -0
- package/dist/runtime/app/types/base.js +0 -0
- package/dist/runtime/app/types/confirm.d.ts +19 -0
- package/dist/runtime/app/types/confirm.js +0 -0
- package/dist/runtime/app/types/crud.d.ts +108 -0
- package/dist/runtime/app/types/crud.js +0 -0
- package/dist/runtime/app/types/field-type.d.ts +4 -0
- package/dist/runtime/app/types/field-type.js +0 -0
- package/dist/runtime/app/types/field.d.ts +233 -0
- package/dist/runtime/app/types/field.js +0 -0
- package/dist/runtime/app/types/form.d.ts +67 -0
- package/dist/runtime/app/types/form.js +0 -0
- package/dist/runtime/app/types/index.d.ts +16 -0
- package/dist/runtime/app/types/index.js +1 -0
- package/dist/runtime/app/types/page.d.ts +61 -0
- package/dist/runtime/app/types/page.js +0 -0
- package/dist/runtime/app/types/responsive.d.ts +8 -0
- package/dist/runtime/app/types/responsive.js +0 -0
- package/dist/runtime/app/types/shortcuts.d.ts +44 -0
- package/dist/runtime/app/types/shortcuts.js +0 -0
- package/dist/runtime/app/types/slots.d.ts +30 -0
- package/dist/runtime/app/types/slots.js +0 -0
- package/dist/runtime/app/types/state.d.ts +35 -0
- package/dist/runtime/app/types/state.js +0 -0
- package/dist/runtime/app/types/table.d.ts +287 -0
- package/dist/runtime/app/types/table.js +0 -0
- package/dist/runtime/app/types/theme.d.ts +251 -0
- package/dist/runtime/app/types/theme.js +0 -0
- package/dist/runtime/app/utils/format.d.ts +18 -0
- package/dist/runtime/app/utils/format.js +36 -0
- package/dist/runtime/app/utils/pagination.d.ts +41 -0
- package/dist/runtime/app/utils/pagination.js +32 -0
- package/dist/runtime/app/utils/path.d.ts +16 -0
- package/dist/runtime/app/utils/path.js +76 -0
- package/dist/runtime/app/utils/query-key.d.ts +20 -0
- package/dist/runtime/app/utils/query-key.js +7 -0
- package/dist/runtime/app/utils/theme.d.ts +44 -0
- package/dist/runtime/app/utils/theme.js +43 -0
- package/dist/types.d.mts +3 -11
- package/package.json +18 -3
- package/dist/module.d.cts +0 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { arrow, autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
2
|
+
import { onScopeDispose, toValue } from "vue";
|
|
3
|
+
export function useVunoAnchor(options = {}) {
|
|
4
|
+
let stop;
|
|
5
|
+
async function place(reference, floating) {
|
|
6
|
+
const edge = toValue(options.boundary);
|
|
7
|
+
const overflow = { padding: 8, ...edge ? { boundary: edge } : {} };
|
|
8
|
+
const middleware = [offset(toValue(options.distance) ?? 4), flip(overflow), shift(overflow)];
|
|
9
|
+
const arrowElement = toValue(options.arrowElement);
|
|
10
|
+
if (arrowElement) middleware.push(arrow({ element: arrowElement }));
|
|
11
|
+
middleware.push(...options.middleware?.() ?? []);
|
|
12
|
+
const position = await computePosition(reference, floating, {
|
|
13
|
+
middleware,
|
|
14
|
+
placement: toValue(options.placement) ?? "bottom-start",
|
|
15
|
+
strategy: "fixed"
|
|
16
|
+
});
|
|
17
|
+
if (!floating.isConnected) return;
|
|
18
|
+
Object.assign(floating.style, { left: `${position.x}px`, top: `${position.y}px` });
|
|
19
|
+
options.onPlaced?.(position);
|
|
20
|
+
}
|
|
21
|
+
function anchor(reference, floating) {
|
|
22
|
+
release();
|
|
23
|
+
if (!reference || !floating) return;
|
|
24
|
+
stop = autoUpdate(reference, floating, () => void place(reference, floating), {
|
|
25
|
+
elementResize: typeof ResizeObserver !== "undefined",
|
|
26
|
+
layoutShift: typeof IntersectionObserver !== "undefined"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function release() {
|
|
30
|
+
stop?.();
|
|
31
|
+
stop = void 0;
|
|
32
|
+
}
|
|
33
|
+
onScopeDispose(release, true);
|
|
34
|
+
return { anchor, release };
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { VunoSize } from '#vuno/types/base';
|
|
3
|
+
import type { VunoControlOrientation } from '#vuno/types/field';
|
|
4
|
+
type VunoControlGroupContext = {
|
|
5
|
+
orientation?: VunoControlOrientation;
|
|
6
|
+
size?: VunoSize;
|
|
7
|
+
};
|
|
8
|
+
/** Provee el contexto sin exponer la clave de inyección a sus consumidores. */
|
|
9
|
+
export declare function provideVunoControlGroup(context: MaybeRefOrGetter<VunoControlGroupContext>): void;
|
|
10
|
+
/** Contexto visual del grupo más cercano; no añade semántica al control. */
|
|
11
|
+
export declare function useVunoControlGroup(): {
|
|
12
|
+
orientation: ComputedRef<VunoControlOrientation | undefined>;
|
|
13
|
+
size: ComputedRef<VunoSize | undefined>;
|
|
14
|
+
};
|
|
15
|
+
/** Impide que las acciones internas de un control se comporten como hijos del grupo exterior. */
|
|
16
|
+
export declare function resetControlGroup(): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { computed, inject, provide, toValue } from "vue";
|
|
2
|
+
const vunoControlGroupInjectionKey = Symbol("vuno.control-group");
|
|
3
|
+
export function provideVunoControlGroup(context) {
|
|
4
|
+
provide(
|
|
5
|
+
vunoControlGroupInjectionKey,
|
|
6
|
+
computed(() => toValue(context))
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export function useVunoControlGroup() {
|
|
10
|
+
const group = inject(vunoControlGroupInjectionKey, void 0);
|
|
11
|
+
return {
|
|
12
|
+
orientation: computed(() => group?.value.orientation),
|
|
13
|
+
size: computed(() => group?.value.size)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function resetControlGroup() {
|
|
17
|
+
provideVunoControlGroup({});
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { VunoPortalTarget } from '#vuno/types/base';
|
|
3
|
+
/**
|
|
4
|
+
* Dónde montar un desplegable para que se vea.
|
|
5
|
+
*
|
|
6
|
+
* Un `<dialog>` abierto con `showModal()` vive en la **capa superior** del
|
|
7
|
+
* navegador, que está por encima de cualquier `z-index`. Un desplegable que se
|
|
8
|
+
* monte en `body` —lo que hacen por defecto los componentes de Nuxt UI— queda
|
|
9
|
+
* por debajo de esa capa: se abre de verdad, con su `aria-expanded` y su
|
|
10
|
+
* `listbox` en el DOM, colocado en el sitio correcto, y no se ve. El campo
|
|
11
|
+
* parece roto sin que nada falle.
|
|
12
|
+
*
|
|
13
|
+
* La salida es montarlo **dentro** del propio diálogo, que ya está en la capa
|
|
14
|
+
* superior. Fuera de un modal no hay nada que proveer y se usa `body`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useVunoPortal(target?: MaybeRefOrGetter<undefined | VunoPortalTarget>): ComputedRef<string>;
|
|
17
|
+
/** Lo llama quien abre una capa superior, para que sus campos la encuentren. */
|
|
18
|
+
export declare function provideVunoPortal(target: VunoPortalTarget): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed, inject, provide, toValue } from "vue";
|
|
2
|
+
const vunoPortalInjectionKey = Symbol("vuno-portal");
|
|
3
|
+
export function useVunoPortal(target) {
|
|
4
|
+
const injected = inject(vunoPortalInjectionKey, true);
|
|
5
|
+
return computed(() => {
|
|
6
|
+
const resolved = toValue(target) ?? injected;
|
|
7
|
+
return resolved === true ? "body" : resolved;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export function provideVunoPortal(target) {
|
|
11
|
+
provide(vunoPortalInjectionKey, target);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VunoConfirmRequest } from '#vuno/types/app';
|
|
2
|
+
/**
|
|
3
|
+
* Pide confirmación desde el código y espera la respuesta.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* if (await confirm({ title: `¿Eliminar ${row.sku}?` })) await borrar(row)
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* El componente `VConfirm` sigue estando para quien quiera colocarlo y
|
|
10
|
+
* controlarlo. Esto existe porque lo otro obliga a llevar un `ref` de apertura y
|
|
11
|
+
* otro de la fila pendiente por cada acción confirmable, y eso se abandona: los
|
|
12
|
+
* dos primeros proyectos que usaron el módulo se quedaron con su diálogo propio,
|
|
13
|
+
* y los dos tenían una función como esta.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useConfirm(): (request: VunoConfirmRequest) => Promise<boolean>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VunoContext } from '#vuno/types/app';
|
|
2
|
+
export type { VunoContext } from '#vuno/types/app';
|
|
3
|
+
/**
|
|
4
|
+
* El contexto global del módulo, provisto por `<VApp>`.
|
|
5
|
+
*
|
|
6
|
+
* Lanza en vez de degradar a un valor vacío: lo que hay aquí —los overlays—
|
|
7
|
+
* necesita un sitio del árbol donde pintarse, y sin `<VApp>` una llamada a
|
|
8
|
+
* `confirm()` devolvería una promesa que no resuelve nunca. Es mejor un error
|
|
9
|
+
* en la primera ejecución que un diálogo que no aparece.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useContext(): VunoContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { vunoContextInjectionKey } from "#vuno/internal/keys";
|
|
3
|
+
export function useContext() {
|
|
4
|
+
const context = inject(vunoContextInjectionKey, null);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("[Vuno] useContext() debe utilizarse dentro de <VApp>.");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { VunoCrud, VunoCrudOptions } from '#vuno/types/crud';
|
|
2
|
+
import type { VunoTableRow } from '#vuno/types/table';
|
|
3
|
+
/**
|
|
4
|
+
* El ciclo completo de una pantalla de mantenimiento: listar, dar de alta o
|
|
5
|
+
* editar en un modal, borrar con confirmación, refrescar la caché y avisar.
|
|
6
|
+
*
|
|
7
|
+
* Existe porque ese ciclo es idéntico en todas las entidades y, escrito a mano,
|
|
8
|
+
* son unas cien líneas por pantalla en las que es fácil olvidar justo lo que no
|
|
9
|
+
* se ve: invalidar la caché, avisar del fallo o distinguir un listado vacío de
|
|
10
|
+
* uno que no se pudo cargar.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const crud = useCrud({
|
|
14
|
+
* key: 'brands',
|
|
15
|
+
* list: (query) => $fetch('/api/brands', { query }),
|
|
16
|
+
* create: (form) => $fetch('/api/brands', { body: form, method: 'POST' }),
|
|
17
|
+
* update: (id, form) => $fetch(`/api/brands/${id}`, { body: form, method: 'PATCH' }),
|
|
18
|
+
* remove: (row) => $fetch(`/api/brands/${row.id}`, { method: 'DELETE' }),
|
|
19
|
+
* emptyForm: () => ({ name: '', slug: '' }),
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useCrud<TRow extends VunoTableRow, TForm extends Record<string, unknown>>(options: VunoCrudOptions<TRow, TForm>): VunoCrud<TRow, TForm>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
2
|
+
import { computed, onServerPrefetch, ref, shallowRef, toValue } from "vue";
|
|
3
|
+
import { useToast } from "#vuno/composables/useToast";
|
|
4
|
+
import { getPath } from "#vuno/utils/path";
|
|
5
|
+
import { resolveQueryKey } from "#vuno/utils/query-key";
|
|
6
|
+
import { useTableQuery } from "./useTableQuery.js";
|
|
7
|
+
import { useMessages } from "./useTheme.js";
|
|
8
|
+
export function useCrud(options) {
|
|
9
|
+
const toast = useToast();
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
const messages = useMessages();
|
|
12
|
+
const query = options.query ?? useTableQuery();
|
|
13
|
+
const resolvedKey = computed(() => resolveQueryKey(toValue(options.key)));
|
|
14
|
+
const baseKey = computed(() => resolvedKey.value.segments);
|
|
15
|
+
const isEnabled = computed(() => resolvedKey.value.ready && (toValue(options.enabled) ?? true));
|
|
16
|
+
const rowKey = options.rowKey ?? "id";
|
|
17
|
+
const text = computed(() => ({
|
|
18
|
+
created: options.messages?.created ?? messages.value.created,
|
|
19
|
+
createFailed: options.messages?.createFailed ?? messages.value.saveFailed,
|
|
20
|
+
deleted: options.messages?.deleted ?? messages.value.deleted,
|
|
21
|
+
deleteFailed: options.messages?.deleteFailed ?? messages.value.deleteFailed,
|
|
22
|
+
updated: options.messages?.updated ?? messages.value.updated,
|
|
23
|
+
updateFailed: options.messages?.updateFailed ?? messages.value.saveFailed
|
|
24
|
+
}));
|
|
25
|
+
const { data, isError, isPending, refetch, suspense } = useQuery({
|
|
26
|
+
// Sin esto, cambiar de filtro o de página deja `data` en undefined
|
|
27
|
+
// mientras llega la respuesta y la tabla parpadea enseñando su estado
|
|
28
|
+
// vacío. Con los datos anteriores en pantalla, el cambio no salta.
|
|
29
|
+
enabled: isEnabled,
|
|
30
|
+
placeholderData: keepPreviousData,
|
|
31
|
+
queryKey: computed(() => [...baseKey.value, query.value]),
|
|
32
|
+
// La consulta forma parte de la clave: otra página u otro filtro es otra
|
|
33
|
+
// consulta, y así cada una se cachea por separado.
|
|
34
|
+
queryFn: () => options.list(query.value)
|
|
35
|
+
});
|
|
36
|
+
onServerPrefetch(async () => {
|
|
37
|
+
if (options.server === false) return;
|
|
38
|
+
if (!isEnabled.value) return;
|
|
39
|
+
try {
|
|
40
|
+
await suspense();
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const items = computed(() => resolvedKey.value.ready ? data.value?.data ?? [] : []);
|
|
45
|
+
const total = computed(() => resolvedKey.value.ready ? data.value?.total ?? 0 : 0);
|
|
46
|
+
const failure = computed(
|
|
47
|
+
() => isError.value ? {
|
|
48
|
+
// Sin valor propio los deja en `undefined` y el estado de
|
|
49
|
+
// fallo cae a los textos globales de `vuno.messages`.
|
|
50
|
+
hint: options.messages?.listFailedHint,
|
|
51
|
+
title: options.messages?.listFailed,
|
|
52
|
+
retry: () => void refetch()
|
|
53
|
+
} : void 0
|
|
54
|
+
);
|
|
55
|
+
function invalidate() {
|
|
56
|
+
if (!resolvedKey.value.ready) return;
|
|
57
|
+
void queryClient.invalidateQueries({ queryKey: baseKey.value });
|
|
58
|
+
}
|
|
59
|
+
const formOpen = ref(false);
|
|
60
|
+
const editing = shallowRef(null);
|
|
61
|
+
const state = ref(options.emptyForm());
|
|
62
|
+
const save = useMutation({
|
|
63
|
+
onError: (error) => {
|
|
64
|
+
toast.error({ description: describe(error), title: editing.value ? text.value.updateFailed : text.value.createFailed });
|
|
65
|
+
},
|
|
66
|
+
onSuccess: (result) => {
|
|
67
|
+
invalidate();
|
|
68
|
+
formOpen.value = false;
|
|
69
|
+
toast.success({ title: result === "updated" ? text.value.updated : text.value.created });
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Sin la función que toca no se anuncia nada.
|
|
73
|
+
*
|
|
74
|
+
* `create` y `update` son opcionales porque hay pantallas que solo
|
|
75
|
+
* listan o solo editan, pero con el formulario ya enviado la opción
|
|
76
|
+
* de no hacer nada no existe: se guardaba el vacío y salía «Creado
|
|
77
|
+
* correctamente», así que el aviso de éxito tapaba que el cambio no
|
|
78
|
+
* había salido de la pantalla. Peor aún al editar sin `update`, donde
|
|
79
|
+
* además se anunciaba un alta. Falla, que es lo honesto, y el texto
|
|
80
|
+
* dice qué falta por conectar.
|
|
81
|
+
*/
|
|
82
|
+
mutationFn: async (form) => {
|
|
83
|
+
const row = editing.value;
|
|
84
|
+
if (row) {
|
|
85
|
+
if (!options.update) throw new Error("[Vuno] useCrud: falta la funci\xF3n `update`, as\xED que no hay d\xF3nde guardar la edici\xF3n.");
|
|
86
|
+
await options.update(getPath(row, rowKey), form);
|
|
87
|
+
return "updated";
|
|
88
|
+
}
|
|
89
|
+
if (!options.create) throw new Error("[Vuno] useCrud: falta la funci\xF3n `create`, as\xED que no hay d\xF3nde guardar el alta.");
|
|
90
|
+
await options.create(form);
|
|
91
|
+
return "created";
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
function openCreate() {
|
|
95
|
+
editing.value = null;
|
|
96
|
+
state.value = options.emptyForm();
|
|
97
|
+
formOpen.value = true;
|
|
98
|
+
}
|
|
99
|
+
function openEdit(row) {
|
|
100
|
+
editing.value = row;
|
|
101
|
+
state.value = options.toForm ? options.toForm(row) : { ...row };
|
|
102
|
+
formOpen.value = true;
|
|
103
|
+
}
|
|
104
|
+
const confirmOpen = ref(false);
|
|
105
|
+
const deleting = shallowRef(null);
|
|
106
|
+
const remove = useMutation({
|
|
107
|
+
onError: (error) => {
|
|
108
|
+
toast.error({ description: describe(error), title: text.value.deleteFailed });
|
|
109
|
+
},
|
|
110
|
+
onSuccess: () => {
|
|
111
|
+
invalidate();
|
|
112
|
+
confirmOpen.value = false;
|
|
113
|
+
deleting.value = null;
|
|
114
|
+
toast.success({ title: text.value.deleted });
|
|
115
|
+
},
|
|
116
|
+
mutationFn: async (row) => {
|
|
117
|
+
if (!options.remove) throw new Error("[Vuno] useCrud: falta la funci\xF3n `remove`, as\xED que no hay d\xF3nde ejecutar el borrado.");
|
|
118
|
+
await options.remove(row);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
function askDelete(row) {
|
|
122
|
+
deleting.value = row;
|
|
123
|
+
confirmOpen.value = true;
|
|
124
|
+
}
|
|
125
|
+
function confirmDelete() {
|
|
126
|
+
if (deleting.value) remove.mutate(deleting.value);
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
askDelete,
|
|
130
|
+
confirmDelete,
|
|
131
|
+
confirmOpen,
|
|
132
|
+
deleting,
|
|
133
|
+
editing,
|
|
134
|
+
failure,
|
|
135
|
+
formOpen,
|
|
136
|
+
invalidate,
|
|
137
|
+
isDeleting: remove.isPending,
|
|
138
|
+
isEnabled,
|
|
139
|
+
isPending,
|
|
140
|
+
isSaving: save.isPending,
|
|
141
|
+
items,
|
|
142
|
+
openCreate,
|
|
143
|
+
openEdit,
|
|
144
|
+
query,
|
|
145
|
+
refetch,
|
|
146
|
+
state,
|
|
147
|
+
total,
|
|
148
|
+
submit: () => save.mutate(state.value)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function describe(error) {
|
|
152
|
+
return error instanceof Error ? error.message : void 0;
|
|
153
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
2
|
+
export declare function useField<TValue = unknown>(name: MaybeRefOrGetter<string | undefined>, model?: Ref<TValue | undefined>): {
|
|
3
|
+
name: import("vue").ComputedRef<string | undefined>;
|
|
4
|
+
dirty: import("vue").ComputedRef<boolean>;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
setTouched: (touched?: boolean) => void;
|
|
7
|
+
setValue: (newValue: TValue) => void;
|
|
8
|
+
touched: import("vue").ComputedRef<boolean>;
|
|
9
|
+
value: import("vue").WritableComputedRef<TValue | undefined, TValue | undefined>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { computed, toValue } from "vue";
|
|
2
|
+
import { useForm } from "./useForm.js";
|
|
3
|
+
export function useField(name, model) {
|
|
4
|
+
const form = useForm({ optional: true });
|
|
5
|
+
if (!form && !model) throw new Error("[Vuno] useField() necesita un <VForm> o un modelo externo.");
|
|
6
|
+
const resolvedName = computed(() => toValue(name));
|
|
7
|
+
const value = computed({
|
|
8
|
+
get() {
|
|
9
|
+
const fieldName = resolvedName.value;
|
|
10
|
+
if (form && fieldName) return form.getValue(fieldName);
|
|
11
|
+
return model?.value;
|
|
12
|
+
},
|
|
13
|
+
set(newValue) {
|
|
14
|
+
const fieldName = resolvedName.value;
|
|
15
|
+
if (form && fieldName) {
|
|
16
|
+
form.setValue(fieldName, newValue);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (model) model.value = newValue;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const dirty = computed(() => form && resolvedName.value ? form.isDirty(resolvedName.value) : false);
|
|
23
|
+
const touched = computed(() => form && resolvedName.value ? form.isTouched(resolvedName.value) : false);
|
|
24
|
+
function reset() {
|
|
25
|
+
if (form && resolvedName.value) form.resetField(resolvedName.value);
|
|
26
|
+
}
|
|
27
|
+
function setTouched(touched2 = true) {
|
|
28
|
+
if (form && resolvedName.value) form.setTouched(resolvedName.value, touched2);
|
|
29
|
+
}
|
|
30
|
+
function setValue(newValue) {
|
|
31
|
+
value.value = newValue;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
name: resolvedName,
|
|
35
|
+
dirty,
|
|
36
|
+
reset,
|
|
37
|
+
setTouched,
|
|
38
|
+
setValue,
|
|
39
|
+
touched,
|
|
40
|
+
value
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VunoFormContext, VunoFormState } from '#vuno/types/form';
|
|
2
|
+
export declare function useForm<TState extends VunoFormState = VunoFormState>(): VunoFormContext<TState>;
|
|
3
|
+
export declare function useForm<TState extends VunoFormState = VunoFormState>(options: {
|
|
4
|
+
optional: true;
|
|
5
|
+
}): null | VunoFormContext<TState>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { vunoFormInjectionKey } from "#vuno/internal/keys";
|
|
3
|
+
export function useForm(options) {
|
|
4
|
+
const form = inject(vunoFormInjectionKey, null);
|
|
5
|
+
if (!form && !options?.optional) {
|
|
6
|
+
throw new Error("[Vuno] useForm() debe utilizarse dentro de <VForm>.");
|
|
7
|
+
}
|
|
8
|
+
return form;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abre los modales del proyecto por su clave.
|
|
3
|
+
*
|
|
4
|
+
* El convenio es una carpeta `components/modal/` y un componente por modal:
|
|
5
|
+
* `components/modal/ModalProduct.vue` se abre con `open('product')`. Nuxt ya
|
|
6
|
+
* registra esos componentes por su nombre, así que no hay nada que registrar:
|
|
7
|
+
* la clave **es** el nombre, y un modal que existe se puede abrir.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const modal = useModal()
|
|
11
|
+
* const saved = await modal.open('product', { id: row.id })
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* El componente recibe `open` y los props que le pases, y resuelve la promesa
|
|
15
|
+
* emitiendo `close` con su resultado. Se pinta en `<VApp>` y no en la pantalla
|
|
16
|
+
* que lo abrió, así que sobrevive a navegar y no arrastra la promesa consigo.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useModal(): {
|
|
19
|
+
close: () => void;
|
|
20
|
+
open: <TResult = unknown>(key: string, props?: Record<string, unknown>) => Promise<TResult | undefined>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getCurrentInstance } from "vue";
|
|
2
|
+
import { useContext } from "./useContext.js";
|
|
3
|
+
export function useModal() {
|
|
4
|
+
const context = useContext();
|
|
5
|
+
const instance = getCurrentInstance();
|
|
6
|
+
function resolve(key) {
|
|
7
|
+
const registry = { ...instance?.root.appContext.components, ...instance?.appContext.components };
|
|
8
|
+
const name = toComponentName(key);
|
|
9
|
+
const component = registry[name] ?? registry[key];
|
|
10
|
+
if (!component) {
|
|
11
|
+
const available = Object.keys(registry).filter((entry) => entry.startsWith("Modal"));
|
|
12
|
+
throw new Error(`[Vuno] No se encontr\xF3 el modal \xAB${name}\xBB. Debe existir en components/modal/ y llamarse ${name}.vue. ` + (available.length > 0 ? `Registrados: ${available.join(", ")}.` : `No hay ninguno registrado (${Object.keys(registry).length} componentes en total).`));
|
|
13
|
+
}
|
|
14
|
+
return component;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
close: context.closeAll,
|
|
18
|
+
open: (key, props) => context.open(resolve(key), props)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function toComponentName(key) {
|
|
22
|
+
const pascal = key.split(/[-_\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
23
|
+
return pascal.startsWith("Modal") ? pascal : `Modal${pascal}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abre overlays desde el código, sin colocarlos en la plantilla.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* const overlay = useOverlay()
|
|
6
|
+
* const elegido = await overlay.open<Producto>(SelectorDeProducto, { categoria })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* El componente recibe `open` y resuelve la promesa emitiendo `close` con su
|
|
10
|
+
* resultado. Cerrarlo con Escape o pulsando fuera resuelve con `undefined`, de
|
|
11
|
+
* modo que ninguna espera se queda colgada.
|
|
12
|
+
*
|
|
13
|
+
* Se pintan todos en `<VApp>`, no en la pantalla que los pidió: un diálogo
|
|
14
|
+
* montado dentro de la pantalla que lo abre se desmonta con ella, y su promesa
|
|
15
|
+
* no resuelve nunca. El apilado lo lleva el propio registro.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useOverlay(): {
|
|
18
|
+
alert: (request: import("../types/app.js").VunoAlertRequest) => Promise<void>;
|
|
19
|
+
closeAll: () => void;
|
|
20
|
+
confirm: (request: import("../types/app.js").VunoConfirmRequest) => Promise<boolean>;
|
|
21
|
+
open: <TResult = unknown>(component: import("vue").Component, props?: Record<string, unknown>) => Promise<TResult | undefined>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { VunoTableQuery, VunoTableQueryOptions } from '#vuno/types/table';
|
|
3
|
+
/**
|
|
4
|
+
* Estado de consulta para `<VTable v-model:query>`.
|
|
5
|
+
*
|
|
6
|
+
* Sin `url` es un `ref` normal. Con `url: true` se sincroniza en los dos
|
|
7
|
+
* sentidos con la query string, de modo que navegar atrás o pegar el enlace
|
|
8
|
+
* en otra pestaña reproduce la misma vista.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useTableQuery(options?: VunoTableQueryOptions): Ref<VunoTableQuery>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { computed, ref, watch } from "vue";
|
|
2
|
+
import { useRoute, useRouter } from "#imports";
|
|
3
|
+
import { isEqual } from "#vuno/utils/path";
|
|
4
|
+
const FILTER_JSON_PREFIX = "~vuno-json:";
|
|
5
|
+
export function useTableQuery(options = {}) {
|
|
6
|
+
const defaults = {
|
|
7
|
+
filters: options.filters ?? {},
|
|
8
|
+
page: options.page ?? 1,
|
|
9
|
+
pageSize: options.pageSize ?? 25,
|
|
10
|
+
search: options.search ?? "",
|
|
11
|
+
sort: typeof options.sort === "string" ? { column: options.sort, direction: "asc" } : options.sort ?? null
|
|
12
|
+
};
|
|
13
|
+
const normalize = (value) => ({ ...value, sort: value.sort ?? defaults.sort });
|
|
14
|
+
if (!options.url) {
|
|
15
|
+
const local = ref({ ...defaults });
|
|
16
|
+
return computed({
|
|
17
|
+
get: () => local.value,
|
|
18
|
+
set: (value) => {
|
|
19
|
+
local.value = normalize(value);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
const prefix = options.prefix ?? "";
|
|
26
|
+
const keys = {
|
|
27
|
+
direction: `${prefix}direction`,
|
|
28
|
+
page: `${prefix}page`,
|
|
29
|
+
pageSize: `${prefix}pageSize`,
|
|
30
|
+
search: `${prefix}search`,
|
|
31
|
+
sort: `${prefix}sort`
|
|
32
|
+
};
|
|
33
|
+
const filterKeys = options.filterKeys ?? Object.keys(defaults.filters);
|
|
34
|
+
const readFilters = () => {
|
|
35
|
+
const filters = { ...defaults.filters };
|
|
36
|
+
for (const key of filterKeys) {
|
|
37
|
+
const raw = route.query[`${prefix}${key}`];
|
|
38
|
+
if (raw === void 0) continue;
|
|
39
|
+
filters[key] = readFilterValue(readString(raw, ""));
|
|
40
|
+
}
|
|
41
|
+
return filters;
|
|
42
|
+
};
|
|
43
|
+
const fromRoute = () => {
|
|
44
|
+
const column = readString(route.query[keys.sort], "");
|
|
45
|
+
return {
|
|
46
|
+
filters: readFilters(),
|
|
47
|
+
page: readNumber(route.query[keys.page], defaults.page),
|
|
48
|
+
pageSize: readNumber(route.query[keys.pageSize], defaults.pageSize),
|
|
49
|
+
search: readString(route.query[keys.search], defaults.search),
|
|
50
|
+
// Sin parámetro se cae al orden por defecto.
|
|
51
|
+
sort: column ? { column, direction: readString(route.query[keys.direction], "asc") === "desc" ? "desc" : "asc" } : defaults.sort
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const state = ref(fromRoute());
|
|
55
|
+
const toRouteQuery = (value) => {
|
|
56
|
+
const next = { ...route.query };
|
|
57
|
+
next[keys.page] = value.page === defaults.page ? void 0 : String(value.page);
|
|
58
|
+
next[keys.pageSize] = value.pageSize === defaults.pageSize ? void 0 : String(value.pageSize);
|
|
59
|
+
next[keys.search] = value.search === "" ? void 0 : value.search;
|
|
60
|
+
const isDefaultSort = value.sort?.column === defaults.sort?.column && value.sort?.direction === defaults.sort?.direction;
|
|
61
|
+
if (!value.sort || isDefaultSort) {
|
|
62
|
+
next[keys.sort] = void 0;
|
|
63
|
+
next[keys.direction] = void 0;
|
|
64
|
+
} else {
|
|
65
|
+
next[keys.sort] = value.sort.column;
|
|
66
|
+
next[keys.direction] = value.sort.direction;
|
|
67
|
+
}
|
|
68
|
+
for (const key of filterKeys) {
|
|
69
|
+
next[`${prefix}${key}`] = isEqual(value.filters[key], defaults.filters[key]) ? void 0 : serializeFilterValue(value.filters[key]);
|
|
70
|
+
}
|
|
71
|
+
for (const key of Object.keys(next)) {
|
|
72
|
+
if (next[key] === void 0) delete next[key];
|
|
73
|
+
}
|
|
74
|
+
return next;
|
|
75
|
+
};
|
|
76
|
+
const serialized = computed(() => JSON.stringify(toRouteQuery(state.value)));
|
|
77
|
+
watch(serialized, () => {
|
|
78
|
+
const to = { query: toRouteQuery(state.value) };
|
|
79
|
+
void (options.history === "push" ? router.push(to) : router.replace(to));
|
|
80
|
+
});
|
|
81
|
+
watch(
|
|
82
|
+
() => route.query,
|
|
83
|
+
() => {
|
|
84
|
+
const next = fromRoute();
|
|
85
|
+
if (JSON.stringify(next) !== JSON.stringify(state.value)) {
|
|
86
|
+
state.value = next;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
return computed({
|
|
91
|
+
get: () => state.value,
|
|
92
|
+
set: (value) => {
|
|
93
|
+
state.value = normalize(value);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function readNumber(value, fallback) {
|
|
98
|
+
const parsed = Number(Array.isArray(value) ? value[0] : value);
|
|
99
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
100
|
+
}
|
|
101
|
+
function readString(value, fallback) {
|
|
102
|
+
const raw = Array.isArray(value) ? value[0] : value;
|
|
103
|
+
return typeof raw === "string" ? raw : fallback;
|
|
104
|
+
}
|
|
105
|
+
function readFilterValue(value) {
|
|
106
|
+
if (value === "true") return true;
|
|
107
|
+
if (value === "false") return false;
|
|
108
|
+
if (!value.startsWith(FILTER_JSON_PREFIX)) return value;
|
|
109
|
+
try {
|
|
110
|
+
return JSON.parse(value.slice(FILTER_JSON_PREFIX.length));
|
|
111
|
+
} catch {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function serializeFilterValue(value) {
|
|
116
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
117
|
+
if (typeof value === "boolean" || typeof value === "bigint" || typeof value === "number" || typeof value === "string") {
|
|
118
|
+
return String(value);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const serialized = JSON.stringify(value);
|
|
122
|
+
return serialized === void 0 ? void 0 : `${FILTER_JSON_PREFIX}${serialized}`;
|
|
123
|
+
} catch {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { VunoSlots } from '#vuno/types/base';
|
|
3
|
+
import type { VunoResolvedSlots, VunoVariantsOf } from '#vuno/types/slots';
|
|
4
|
+
import type { VunoIcons, VunoMessages, VunoThemeKey } from '#vuno/types/theme';
|
|
5
|
+
/**
|
|
6
|
+
* Resuelve las clases de un componente del módulo.
|
|
7
|
+
*
|
|
8
|
+
* Devuelve cadenas, no `VunoSlots`: ese tipo describe lo que se puede
|
|
9
|
+
* *escribir* —el tema, el `app.config` y la prop `ui` admiten un array de
|
|
10
|
+
* clases por comodidad—, y `mergeSlots` lo funde a una sola cadena antes de
|
|
11
|
+
* devolverlo. Un slot ausente sigue siendo `undefined`. Anunciar aquí el tipo
|
|
12
|
+
* de entrada obligaba a cada componente que pasa un slot a una prop de cadena
|
|
13
|
+
* —`enterActiveClass` y compañía de `TransitionGroup`— a afirmar un `string`
|
|
14
|
+
* que el compilador no podía comprobar.
|
|
15
|
+
*
|
|
16
|
+
* @param key Clave del tema (`fieldInput`, `form`, ...).
|
|
17
|
+
* @param ui Override de la instancia, normalmente `props.ui`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useTheme<TKey extends VunoThemeKey>(key: TKey, ui?: MaybeRefOrGetter<undefined | VunoSlots>, variants?: MaybeRefOrGetter<undefined | VunoVariantsOf<TKey>>): ComputedRef<VunoResolvedSlots<TKey>>;
|
|
20
|
+
export declare function useIcons(): ComputedRef<VunoIcons>;
|
|
21
|
+
/**
|
|
22
|
+
* El idioma con el que se formatea lo que lleva formato: fechas, números y
|
|
23
|
+
* monedas. Sale de `app.config`, como los textos y los iconos.
|
|
24
|
+
*
|
|
25
|
+
* El respaldo es el castellano y no el del navegador, por la misma razón que
|
|
26
|
+
* lo son los mensajes por defecto: el módulo trae unos y el proyecto los
|
|
27
|
+
* cambia en un sitio. Y además un idioma adivinado del navegador rompería el
|
|
28
|
+
* render en servidor, que no tiene ninguno.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useLocale(): ComputedRef<string>;
|
|
31
|
+
export declare function useMessages(): ComputedRef<VunoMessages>;
|