@soxa-ui/vue 0.0.0-stage → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -2
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/adapter/common/createVueAdapterContext.d.ts +36 -0
- package/dist/adapter/common/createVueAdapterContext.js +45 -0
- package/dist/adapter/common/icon.d.ts +2 -0
- package/dist/adapter/common/icon.js +45 -0
- package/dist/adapter/common/index.d.ts +6 -0
- package/dist/adapter/common/naming.d.ts +12 -0
- package/dist/adapter/common/naming.js +8 -0
- package/dist/adapter/common/profile.d.ts +13 -0
- package/dist/adapter/common/profile.js +8 -0
- package/dist/adapter/common/useSplitAttrs.d.ts +11 -0
- package/dist/adapter/common/useSplitAttrs.js +24 -0
- package/dist/adapter/elevator/elevator.class.d.ts +12 -0
- package/dist/adapter/elevator/elevator.class.js +20 -0
- package/dist/adapter/elevator/factory.d.ts +2 -0
- package/dist/adapter/elevator/factory.js +5 -0
- package/dist/adapter/elevator/index.d.ts +2 -0
- package/dist/adapter/index.d.ts +6 -0
- package/dist/adapter/locale/LocaleProvider.d.ts +38 -0
- package/dist/adapter/locale/LocaleProvider.js +41 -0
- package/dist/adapter/locale/index.d.ts +2 -0
- package/dist/adapter/locale/key.d.ts +7 -0
- package/dist/adapter/locale/key.js +8 -0
- package/dist/adapter/runtime/exposeRoot.d.ts +21 -0
- package/dist/adapter/runtime/exposeRoot.js +25 -0
- package/dist/adapter/runtime/index.d.ts +4 -0
- package/dist/adapter/runtime/useAdapter.d.ts +69 -0
- package/dist/adapter/runtime/useAdapter.js +117 -0
- package/dist/adapter/runtime/useCollectionAdapter.d.ts +34 -0
- package/dist/adapter/runtime/useCollectionAdapter.js +25 -0
- package/dist/adapter/runtime/view.d.ts +53 -0
- package/dist/adapter/runtime/view.js +103 -0
- package/dist/adapter/static/index.d.ts +4 -0
- package/dist/adapter/static/useEmits.d.ts +13 -0
- package/dist/adapter/static/useEmits.js +19 -0
- package/dist/adapter/static/useExpose.d.ts +69 -0
- package/dist/adapter/static/useExpose.js +18 -0
- package/dist/adapter/static/useProps.d.ts +8 -0
- package/dist/adapter/static/useProps.js +16 -0
- package/dist/adapter/toasts/index.d.ts +3 -0
- package/dist/adapter/toasts/render.d.ts +8 -0
- package/dist/adapter/toasts/render.js +12 -0
- package/dist/adapter/toasts/types.d.ts +11 -0
- package/dist/adapter/toasts/useToasts.d.ts +17 -0
- package/dist/adapter/toasts/useToasts.js +24 -0
- package/dist/components/accordion/Accordion.js +37 -0
- package/dist/components/accordion/Accordion.vue.d.ts +256 -0
- package/dist/components/accordion/Accordion.vue_vue_type_script_lang.js +9 -0
- package/dist/components/accordion/base.component.d.ts +12 -0
- package/dist/components/accordion/base.component.js +16 -0
- package/dist/components/accordion/index.d.ts +734 -0
- package/dist/components/accordion/index.js +9 -0
- package/dist/components/accordion/item/Item.js +69 -0
- package/dist/components/accordion/item/Item.vue.d.ts +188 -0
- package/dist/components/accordion/item/Item.vue_vue_type_script_lang.js +13 -0
- package/dist/components/accordion/item/base.component.d.ts +12 -0
- package/dist/components/accordion/item/base.component.js +16 -0
- package/dist/components/accordion/item/index.d.ts +5 -0
- package/dist/components/accordion/item/index.js +6 -0
- package/dist/components/accordion/item/setup.component.d.ts +47 -0
- package/dist/components/accordion/item/setup.component.js +36 -0
- package/dist/components/accordion/setup.component.d.ts +35 -0
- package/dist/components/accordion/setup.component.js +32 -0
- package/dist/components/button/Button.js +26 -0
- package/dist/components/button/Button.vue.d.ts +61 -0
- package/dist/components/button/Button.vue_vue_type_script_lang.js +5 -0
- package/dist/components/button/base.component.d.ts +12 -0
- package/dist/components/button/base.component.js +13 -0
- package/dist/components/button/index.d.ts +4 -0
- package/dist/components/button/index.js +6 -0
- package/dist/components/button/setup.component.d.ts +33 -0
- package/dist/components/button/setup.component.js +20 -0
- package/dist/components/calendar/Calendar.js +174 -0
- package/dist/components/calendar/Calendar.vue.d.ts +1366 -0
- package/dist/components/calendar/Calendar.vue_vue_type_script_lang.js +19 -0
- package/dist/components/calendar/base.component.d.ts +12 -0
- package/dist/components/calendar/base.component.js +16 -0
- package/dist/components/calendar/index.d.ts +2801 -0
- package/dist/components/calendar/index.js +9 -0
- package/dist/components/calendar/item/Item.js +22 -0
- package/dist/components/calendar/item/Item.vue.d.ts +32 -0
- package/dist/components/calendar/item/Item.vue_vue_type_script_lang.js +5 -0
- package/dist/components/calendar/item/base.component.d.ts +12 -0
- package/dist/components/calendar/item/base.component.js +16 -0
- package/dist/components/calendar/item/index.d.ts +5 -0
- package/dist/components/calendar/item/index.js +6 -0
- package/dist/components/calendar/item/setup.component.d.ts +28 -0
- package/dist/components/calendar/item/setup.component.js +35 -0
- package/dist/components/calendar/setup.component.d.ts +50 -0
- package/dist/components/calendar/setup.component.js +47 -0
- package/dist/components/check-box/CheckBox.js +50 -0
- package/dist/components/check-box/CheckBox.vue.d.ts +134 -0
- package/dist/components/check-box/CheckBox.vue_vue_type_script_lang.js +5 -0
- package/dist/components/check-box/base.component.d.ts +64 -0
- package/dist/components/check-box/base.component.js +15 -0
- package/dist/components/check-box/index.d.ts +4 -0
- package/dist/components/check-box/index.js +6 -0
- package/dist/components/check-box/setup.component.d.ts +97 -0
- package/dist/components/check-box/setup.component.js +29 -0
- package/dist/components/component/base.component.d.ts +12 -0
- package/dist/components/component/index.d.ts +1 -0
- package/dist/components/component-view/ComponentView.js +21 -0
- package/dist/components/component-view/ComponentView.vue.d.ts +30 -0
- package/dist/components/component-view/ComponentView.vue_vue_type_script_lang.js +5 -0
- package/dist/components/component-view/base.component.d.ts +12 -0
- package/dist/components/component-view/base.component.js +13 -0
- package/dist/components/component-view/index.d.ts +5 -0
- package/dist/components/component-view/index.js +6 -0
- package/dist/components/component-view/setup.component.d.ts +20 -0
- package/dist/components/component-view/setup.component.js +20 -0
- package/dist/components/control/base.component.d.ts +12 -0
- package/dist/components/control/index.d.ts +1 -0
- package/dist/components/date-input/DateInput.js +74 -0
- package/dist/components/date-input/DateInput.vue.d.ts +197 -0
- package/dist/components/date-input/DateInput.vue_vue_type_script_lang.js +13 -0
- package/dist/components/date-input/base.component.d.ts +12 -0
- package/dist/components/date-input/base.component.js +13 -0
- package/dist/components/date-input/index.d.ts +4 -0
- package/dist/components/date-input/index.js +6 -0
- package/dist/components/date-input/setup.component.d.ts +46 -0
- package/dist/components/date-input/setup.component.js +30 -0
- package/dist/components/date-picker/DatePicker.js +178 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +3310 -0
- package/dist/components/date-picker/DatePicker.vue_vue_type_script_lang.js +19 -0
- package/dist/components/date-picker/base.component.d.ts +12 -0
- package/dist/components/date-picker/base.component.js +13 -0
- package/dist/components/date-picker/index.d.ts +5 -0
- package/dist/components/date-picker/index.js +6 -0
- package/dist/components/date-picker/setup.component.d.ts +83 -0
- package/dist/components/date-picker/setup.component.js +54 -0
- package/dist/components/dialog/Dialog.js +63 -0
- package/dist/components/dialog/Dialog.vue.d.ts +197 -0
- package/dist/components/dialog/Dialog.vue_vue_type_script_lang.js +20 -0
- package/dist/components/dialog/base.component.d.ts +12 -0
- package/dist/components/dialog/base.component.js +13 -0
- package/dist/components/dialog/index.d.ts +4 -0
- package/dist/components/dialog/index.js +6 -0
- package/dist/components/dialog/setup.component.d.ts +56 -0
- package/dist/components/dialog/setup.component.js +41 -0
- package/dist/components/drag-and-drop/DragAndDrop.js +10 -0
- package/dist/components/drag-and-drop/DragAndDrop.vue.d.ts +19 -0
- package/dist/components/drag-and-drop/DragAndDrop.vue_vue_type_script_lang.js +5 -0
- package/dist/components/drag-and-drop/base.component.d.ts +12 -0
- package/dist/components/drag-and-drop/base.component.js +13 -0
- package/dist/components/drag-and-drop/index.d.ts +4 -0
- package/dist/components/drag-and-drop/index.js +6 -0
- package/dist/components/drag-and-drop/setup.component.d.ts +17 -0
- package/dist/components/drag-and-drop/setup.component.js +21 -0
- package/dist/components/drawer/Drawer.js +57 -0
- package/dist/components/drawer/Drawer.vue.d.ts +191 -0
- package/dist/components/drawer/Drawer.vue_vue_type_script_lang.js +20 -0
- package/dist/components/drawer/base.component.d.ts +12 -0
- package/dist/components/drawer/base.component.js +13 -0
- package/dist/components/drawer/index.d.ts +4 -0
- package/dist/components/drawer/index.js +6 -0
- package/dist/components/drawer/setup.component.d.ts +54 -0
- package/dist/components/drawer/setup.component.js +39 -0
- package/dist/components/field/Field.js +42 -0
- package/dist/components/field/Field.vue.d.ts +97 -0
- package/dist/components/field/Field.vue_vue_type_script_lang.js +9 -0
- package/dist/components/field/base.component.d.ts +12 -0
- package/dist/components/field/base.component.js +13 -0
- package/dist/components/field/index.d.ts +4 -0
- package/dist/components/field/index.js +6 -0
- package/dist/components/field/setup.component.d.ts +28 -0
- package/dist/components/field/setup.component.js +29 -0
- package/dist/components/frame/Frame.js +26 -0
- package/dist/components/frame/Frame.vue.d.ts +95 -0
- package/dist/components/frame/Frame.vue_vue_type_script_lang.js +17 -0
- package/dist/components/frame/base.component.d.ts +12 -0
- package/dist/components/frame/base.component.js +13 -0
- package/dist/components/frame/index.d.ts +4 -0
- package/dist/components/frame/index.js +6 -0
- package/dist/components/frame/setup.component.d.ts +44 -0
- package/dist/components/frame/setup.component.js +23 -0
- package/dist/components/icon/Icon.js +18 -0
- package/dist/components/icon/Icon.vue.d.ts +52 -0
- package/dist/components/icon/Icon.vue_vue_type_script_lang.js +5 -0
- package/dist/components/icon/base.component.d.ts +12 -0
- package/dist/components/icon/base.component.js +13 -0
- package/dist/components/icon/index.d.ts +4 -0
- package/dist/components/icon/index.js +6 -0
- package/dist/components/icon/setup.component.d.ts +30 -0
- package/dist/components/icon/setup.component.js +20 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/input/Input.js +71 -0
- package/dist/components/input/Input.vue.d.ts +191 -0
- package/dist/components/input/Input.vue_vue_type_script_lang.js +13 -0
- package/dist/components/input/base.component.d.ts +12 -0
- package/dist/components/input/base.component.js +13 -0
- package/dist/components/input/index.d.ts +4 -0
- package/dist/components/input/index.js +6 -0
- package/dist/components/input/setup.component.d.ts +44 -0
- package/dist/components/input/setup.component.js +28 -0
- package/dist/components/input-control/base.component.d.ts +12 -0
- package/dist/components/input-control/index.d.ts +1 -0
- package/dist/components/interactive/base.component.d.ts +12 -0
- package/dist/components/interactive/index.d.ts +1 -0
- package/dist/components/item-row/ItemRow.js +26 -0
- package/dist/components/item-row/ItemRow.vue.d.ts +74 -0
- package/dist/components/item-row/ItemRow.vue_vue_type_script_lang.js +18 -0
- package/dist/components/item-row/index.d.ts +4 -0
- package/dist/components/item-row/index.js +6 -0
- package/dist/components/item-row/setup.component.d.ts +33 -0
- package/dist/components/item-row/setup.component.js +20 -0
- package/dist/components/label/Label.js +23 -0
- package/dist/components/label/Label.vue.d.ts +38 -0
- package/dist/components/label/Label.vue_vue_type_script_lang.js +5 -0
- package/dist/components/label/base.component.d.ts +12 -0
- package/dist/components/label/base.component.js +13 -0
- package/dist/components/label/index.d.ts +4 -0
- package/dist/components/label/index.js +6 -0
- package/dist/components/label/setup.component.d.ts +20 -0
- package/dist/components/label/setup.component.js +20 -0
- package/dist/components/list-box/ListBox.js +101 -0
- package/dist/components/list-box/ListBox.vue.d.ts +313 -0
- package/dist/components/list-box/ListBox.vue_vue_type_script_lang.js +13 -0
- package/dist/components/list-box/base.component.d.ts +12 -0
- package/dist/components/list-box/base.component.js +16 -0
- package/dist/components/list-box/group/Group.js +24 -0
- package/dist/components/list-box/group/Group.vue.d.ts +32 -0
- package/dist/components/list-box/group/Group.vue_vue_type_script_lang.js +5 -0
- package/dist/components/list-box/group/base.component.d.ts +12 -0
- package/dist/components/list-box/group/base.component.js +13 -0
- package/dist/components/list-box/group/index.d.ts +5 -0
- package/dist/components/list-box/group/index.js +6 -0
- package/dist/components/list-box/group/setup.component.d.ts +25 -0
- package/dist/components/list-box/group/setup.component.js +26 -0
- package/dist/components/list-box/index.d.ts +892 -0
- package/dist/components/list-box/index.js +17 -0
- package/dist/components/list-box/item/Item.js +69 -0
- package/dist/components/list-box/item/Item.vue.d.ts +203 -0
- package/dist/components/list-box/item/Item.vue_vue_type_script_lang.js +24 -0
- package/dist/components/list-box/item/base.component.d.ts +12 -0
- package/dist/components/list-box/item/base.component.js +16 -0
- package/dist/components/list-box/item/index.d.ts +5 -0
- package/dist/components/list-box/item/index.js +6 -0
- package/dist/components/list-box/item/setup.component.d.ts +51 -0
- package/dist/components/list-box/item/setup.component.js +36 -0
- package/dist/components/list-box/setup.component.d.ts +41 -0
- package/dist/components/list-box/setup.component.js +34 -0
- package/dist/components/menu/Menu.js +149 -0
- package/dist/components/menu/Menu.vue.d.ts +825 -0
- package/dist/components/menu/Menu.vue_vue_type_script_lang.js +19 -0
- package/dist/components/menu/base.component.d.ts +12 -0
- package/dist/components/menu/base.component.js +16 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.js +51 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.vue.d.ts +192 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.vue_vue_type_script_lang.js +19 -0
- package/dist/components/menu/checkbox-item/base.component.d.ts +12 -0
- package/dist/components/menu/checkbox-item/base.component.js +16 -0
- package/dist/components/menu/checkbox-item/index.d.ts +5 -0
- package/dist/components/menu/checkbox-item/index.js +6 -0
- package/dist/components/menu/checkbox-item/setup.component.d.ts +55 -0
- package/dist/components/menu/checkbox-item/setup.component.js +44 -0
- package/dist/components/menu/group/Group.js +24 -0
- package/dist/components/menu/group/Group.vue.d.ts +32 -0
- package/dist/components/menu/group/Group.vue_vue_type_script_lang.js +5 -0
- package/dist/components/menu/group/base.component.d.ts +12 -0
- package/dist/components/menu/group/base.component.js +13 -0
- package/dist/components/menu/group/index.d.ts +5 -0
- package/dist/components/menu/group/index.js +6 -0
- package/dist/components/menu/group/setup.component.d.ts +24 -0
- package/dist/components/menu/group/setup.component.js +25 -0
- package/dist/components/menu/index.d.ts +3005 -0
- package/dist/components/menu/index.js +36 -0
- package/dist/components/menu/item/Item.js +38 -0
- package/dist/components/menu/item/Item.vue.d.ts +140 -0
- package/dist/components/menu/item/Item.vue_vue_type_script_lang.js +16 -0
- package/dist/components/menu/item/base.component.d.ts +12 -0
- package/dist/components/menu/item/base.component.js +16 -0
- package/dist/components/menu/item/index.d.ts +5 -0
- package/dist/components/menu/item/index.js +6 -0
- package/dist/components/menu/item/setup.component.d.ts +53 -0
- package/dist/components/menu/item/setup.component.js +41 -0
- package/dist/components/menu/popover-item/PopoverItem.js +65 -0
- package/dist/components/menu/popover-item/PopoverItem.vue.d.ts +296 -0
- package/dist/components/menu/popover-item/PopoverItem.vue_vue_type_script_lang.js +22 -0
- package/dist/components/menu/popover-item/base.component.d.ts +12 -0
- package/dist/components/menu/popover-item/base.component.js +16 -0
- package/dist/components/menu/popover-item/index.d.ts +5 -0
- package/dist/components/menu/popover-item/index.js +6 -0
- package/dist/components/menu/popover-item/setup.component.d.ts +74 -0
- package/dist/components/menu/popover-item/setup.component.js +50 -0
- package/dist/components/menu/radio-group/RadioGroup.js +24 -0
- package/dist/components/menu/radio-group/RadioGroup.vue.d.ts +34 -0
- package/dist/components/menu/radio-group/RadioGroup.vue_vue_type_script_lang.js +5 -0
- package/dist/components/menu/radio-group/base.component.d.ts +12 -0
- package/dist/components/menu/radio-group/base.component.js +13 -0
- package/dist/components/menu/radio-group/index.d.ts +5 -0
- package/dist/components/menu/radio-group/index.js +6 -0
- package/dist/components/menu/radio-group/setup.component.d.ts +26 -0
- package/dist/components/menu/radio-group/setup.component.js +27 -0
- package/dist/components/menu/radio-item/RadioItem.js +49 -0
- package/dist/components/menu/radio-item/RadioItem.vue.d.ts +141 -0
- package/dist/components/menu/radio-item/RadioItem.vue_vue_type_script_lang.js +15 -0
- package/dist/components/menu/radio-item/base.component.d.ts +12 -0
- package/dist/components/menu/radio-item/base.component.js +16 -0
- package/dist/components/menu/radio-item/index.d.ts +5 -0
- package/dist/components/menu/radio-item/index.js +6 -0
- package/dist/components/menu/radio-item/setup.component.d.ts +56 -0
- package/dist/components/menu/radio-item/setup.component.js +44 -0
- package/dist/components/menu/separator/Separator.js +18 -0
- package/dist/components/menu/separator/Separator.vue.d.ts +30 -0
- package/dist/components/menu/separator/Separator.vue_vue_type_script_lang.js +5 -0
- package/dist/components/menu/separator/base.component.d.ts +12 -0
- package/dist/components/menu/separator/base.component.js +13 -0
- package/dist/components/menu/separator/index.d.ts +5 -0
- package/dist/components/menu/separator/index.js +6 -0
- package/dist/components/menu/separator/setup.component.d.ts +20 -0
- package/dist/components/menu/separator/setup.component.js +20 -0
- package/dist/components/menu/setup.component.d.ts +42 -0
- package/dist/components/menu/setup.component.js +43 -0
- package/dist/components/menu/submenu/Submenu.js +171 -0
- package/dist/components/menu/submenu/Submenu.vue.d.ts +495 -0
- package/dist/components/menu/submenu/Submenu.vue_vue_type_script_lang.js +51 -0
- package/dist/components/menu/submenu/base.component.d.ts +12 -0
- package/dist/components/menu/submenu/base.component.js +21 -0
- package/dist/components/menu/submenu/index.d.ts +5 -0
- package/dist/components/menu/submenu/index.js +6 -0
- package/dist/components/menu/submenu/setup.component.d.ts +76 -0
- package/dist/components/menu/submenu/setup.component.js +60 -0
- package/dist/components/number-input/NumberInput.js +119 -0
- package/dist/components/number-input/NumberInput.vue.d.ts +203 -0
- package/dist/components/number-input/NumberInput.vue_vue_type_script_lang.js +13 -0
- package/dist/components/number-input/base.component.d.ts +12 -0
- package/dist/components/number-input/base.component.js +13 -0
- package/dist/components/number-input/index.d.ts +4 -0
- package/dist/components/number-input/index.js +6 -0
- package/dist/components/number-input/setup.component.d.ts +54 -0
- package/dist/components/number-input/setup.component.js +38 -0
- package/dist/components/pagination/Pagination.js +85 -0
- package/dist/components/pagination/Pagination.vue.d.ts +277 -0
- package/dist/components/pagination/Pagination.vue_vue_type_script_lang.js +15 -0
- package/dist/components/pagination/base.component.d.ts +12 -0
- package/dist/components/pagination/base.component.js +16 -0
- package/dist/components/pagination/index.d.ts +10 -0
- package/dist/components/pagination/index.js +11 -0
- package/dist/components/pagination/item/Item.js +35 -0
- package/dist/components/pagination/item/Item.vue.d.ts +101 -0
- package/dist/components/pagination/item/Item.vue_vue_type_script_lang.js +16 -0
- package/dist/components/pagination/item/base.component.d.ts +12 -0
- package/dist/components/pagination/item/base.component.js +16 -0
- package/dist/components/pagination/item/index.d.ts +6 -0
- package/dist/components/pagination/item/index.js +7 -0
- package/dist/components/pagination/item/setup.component.d.ts +30 -0
- package/dist/components/pagination/item/setup.component.js +36 -0
- package/dist/components/pagination/setup.component.d.ts +51 -0
- package/dist/components/pagination/setup.component.js +48 -0
- package/dist/components/popover/Popover.js +70 -0
- package/dist/components/popover/Popover.vue.d.ts +264 -0
- package/dist/components/popover/Popover.vue_vue_type_script_lang.js +15 -0
- package/dist/components/popover/base.component.d.ts +12 -0
- package/dist/components/popover/base.component.js +13 -0
- package/dist/components/popover/index.d.ts +4 -0
- package/dist/components/popover/index.js +6 -0
- package/dist/components/popover/setup.component.d.ts +47 -0
- package/dist/components/popover/setup.component.js +34 -0
- package/dist/components/progress-linear/ProgressLinear.js +22 -0
- package/dist/components/progress-linear/ProgressLinear.vue.d.ts +58 -0
- package/dist/components/progress-linear/ProgressLinear.vue_vue_type_script_lang.js +5 -0
- package/dist/components/progress-linear/base.component.d.ts +12 -0
- package/dist/components/progress-linear/base.component.js +13 -0
- package/dist/components/progress-linear/index.d.ts +4 -0
- package/dist/components/progress-linear/index.js +6 -0
- package/dist/components/progress-linear/setup.component.d.ts +33 -0
- package/dist/components/progress-linear/setup.component.js +25 -0
- package/dist/components/progress-spinner/ProgressSpinner.js +47 -0
- package/dist/components/progress-spinner/ProgressSpinner.vue.d.ts +56 -0
- package/dist/components/progress-spinner/ProgressSpinner.vue_vue_type_script_lang.js +5 -0
- package/dist/components/progress-spinner/base.component.d.ts +12 -0
- package/dist/components/progress-spinner/base.component.js +13 -0
- package/dist/components/progress-spinner/index.d.ts +4 -0
- package/dist/components/progress-spinner/index.js +6 -0
- package/dist/components/progress-spinner/setup.component.d.ts +32 -0
- package/dist/components/progress-spinner/setup.component.js +24 -0
- package/dist/components/radio-group/RadioGroup.js +36 -0
- package/dist/components/radio-group/RadioGroup.vue.d.ts +135 -0
- package/dist/components/radio-group/RadioGroup.vue_vue_type_script_lang.js +9 -0
- package/dist/components/radio-group/base.component.d.ts +12 -0
- package/dist/components/radio-group/base.component.js +16 -0
- package/dist/components/radio-group/index.d.ts +370 -0
- package/dist/components/radio-group/index.js +9 -0
- package/dist/components/radio-group/item/Item.js +42 -0
- package/dist/components/radio-group/item/Item.vue.d.ts +65 -0
- package/dist/components/radio-group/item/Item.vue_vue_type_script_lang.js +5 -0
- package/dist/components/radio-group/item/base.component.d.ts +12 -0
- package/dist/components/radio-group/item/base.component.js +16 -0
- package/dist/components/radio-group/item/index.d.ts +5 -0
- package/dist/components/radio-group/item/index.js +6 -0
- package/dist/components/radio-group/item/setup.component.d.ts +46 -0
- package/dist/components/radio-group/item/setup.component.js +38 -0
- package/dist/components/radio-group/setup.component.d.ts +43 -0
- package/dist/components/radio-group/setup.component.js +40 -0
- package/dist/components/rating/Rating.js +54 -0
- package/dist/components/rating/Rating.vue.d.ts +77 -0
- package/dist/components/rating/Rating.vue_vue_type_script_lang.js +5 -0
- package/dist/components/rating/base.component.d.ts +12 -0
- package/dist/components/rating/base.component.js +13 -0
- package/dist/components/rating/index.d.ts +4 -0
- package/dist/components/rating/index.js +6 -0
- package/dist/components/rating/setup.component.d.ts +51 -0
- package/dist/components/rating/setup.component.js +35 -0
- package/dist/components/scroller/Scroller.js +57 -0
- package/dist/components/scroller/Scroller.vue.d.ts +171 -0
- package/dist/components/scroller/Scroller.vue_vue_type_script_lang.js +13 -0
- package/dist/components/scroller/base.component.d.ts +12 -0
- package/dist/components/scroller/base.component.js +13 -0
- package/dist/components/scroller/index.d.ts +4 -0
- package/dist/components/scroller/index.js +6 -0
- package/dist/components/scroller/setup.component.d.ts +47 -0
- package/dist/components/scroller/setup.component.js +35 -0
- package/dist/components/select/Select.js +151 -0
- package/dist/components/select/Select.vue.d.ts +1598 -0
- package/dist/components/select/Select.vue_vue_type_script_lang.js +21 -0
- package/dist/components/select/base.component.d.ts +12 -0
- package/dist/components/select/base.component.js +16 -0
- package/dist/components/select/group/Group.js +24 -0
- package/dist/components/select/group/Group.vue.d.ts +32 -0
- package/dist/components/select/group/Group.vue_vue_type_script_lang.js +5 -0
- package/dist/components/select/group/base.component.d.ts +12 -0
- package/dist/components/select/group/base.component.js +13 -0
- package/dist/components/select/group/index.d.ts +5 -0
- package/dist/components/select/group/index.js +6 -0
- package/dist/components/select/group/setup.component.d.ts +24 -0
- package/dist/components/select/group/setup.component.js +25 -0
- package/dist/components/select/index.d.ts +17 -0
- package/dist/components/select/index.js +19 -0
- package/dist/components/select/item/Item.js +67 -0
- package/dist/components/select/item/Item.vue.d.ts +228 -0
- package/dist/components/select/item/Item.vue_vue_type_script_lang.js +51 -0
- package/dist/components/select/item/base.component.d.ts +12 -0
- package/dist/components/select/item/base.component.js +16 -0
- package/dist/components/select/item/index.d.ts +5 -0
- package/dist/components/select/item/index.js +6 -0
- package/dist/components/select/item/setup.component.d.ts +58 -0
- package/dist/components/select/item/setup.component.js +43 -0
- package/dist/components/select/setup.component.d.ts +89 -0
- package/dist/components/select/setup.component.js +60 -0
- package/dist/components/skeleton/Skeleton.js +25 -0
- package/dist/components/skeleton/Skeleton.vue.d.ts +42 -0
- package/dist/components/skeleton/Skeleton.vue_vue_type_script_lang.js +5 -0
- package/dist/components/skeleton/base.component.d.ts +12 -0
- package/dist/components/skeleton/base.component.js +13 -0
- package/dist/components/skeleton/index.d.ts +4 -0
- package/dist/components/skeleton/index.js +6 -0
- package/dist/components/skeleton/setup.component.d.ts +22 -0
- package/dist/components/skeleton/setup.component.js +20 -0
- package/dist/components/slider/Slider.js +75 -0
- package/dist/components/slider/Slider.vue.d.ts +87 -0
- package/dist/components/slider/Slider.vue_vue_type_script_lang.js +5 -0
- package/dist/components/slider/base.component.d.ts +12 -0
- package/dist/components/slider/base.component.js +13 -0
- package/dist/components/slider/index.d.ts +4 -0
- package/dist/components/slider/index.js +6 -0
- package/dist/components/slider/setup.component.d.ts +46 -0
- package/dist/components/slider/setup.component.js +34 -0
- package/dist/components/stylable/base.component.d.ts +12 -0
- package/dist/components/stylable/index.d.ts +1 -0
- package/dist/components/switch/Switch.js +49 -0
- package/dist/components/switch/Switch.vue.d.ts +76 -0
- package/dist/components/switch/Switch.vue_vue_type_script_lang.js +5 -0
- package/dist/components/switch/base.component.d.ts +12 -0
- package/dist/components/switch/base.component.js +13 -0
- package/dist/components/switch/index.d.ts +4 -0
- package/dist/components/switch/index.js +6 -0
- package/dist/components/switch/setup.component.d.ts +43 -0
- package/dist/components/switch/setup.component.js +24 -0
- package/dist/components/table/Table.js +94 -0
- package/dist/components/table/Table.vue.d.ts +564 -0
- package/dist/components/table/Table.vue_vue_type_script_lang.js +15 -0
- package/dist/components/table/base.component.d.ts +12 -0
- package/dist/components/table/base.component.js +16 -0
- package/dist/components/table/column/Column.js +59 -0
- package/dist/components/table/column/Column.vue.d.ts +143 -0
- package/dist/components/table/column/Column.vue_vue_type_script_lang.js +13 -0
- package/dist/components/table/column/base.component.d.ts +12 -0
- package/dist/components/table/column/base.component.js +13 -0
- package/dist/components/table/column/index.d.ts +5 -0
- package/dist/components/table/column/index.js +6 -0
- package/dist/components/table/column/setup.component.d.ts +37 -0
- package/dist/components/table/column/setup.component.js +39 -0
- package/dist/components/table/index.d.ts +1512 -0
- package/dist/components/table/index.js +18 -0
- package/dist/components/table/row/Cells.js +40 -0
- package/dist/components/table/row/Cells.vue.d.ts +65 -0
- package/dist/components/table/row/Cells.vue_vue_type_script_lang.js +61 -0
- package/dist/components/table/row/Row.js +55 -0
- package/dist/components/table/row/Row.vue.d.ts +193 -0
- package/dist/components/table/row/Row.vue_vue_type_script_lang.js +13 -0
- package/dist/components/table/row/base.component.d.ts +12 -0
- package/dist/components/table/row/base.component.js +16 -0
- package/dist/components/table/row/index.d.ts +5 -0
- package/dist/components/table/row/index.js +6 -0
- package/dist/components/table/row/setup.component.d.ts +33 -0
- package/dist/components/table/row/setup.component.js +38 -0
- package/dist/components/table/setup.component.d.ts +68 -0
- package/dist/components/table/setup.component.js +59 -0
- package/dist/components/tabs/Tabs.js +56 -0
- package/dist/components/tabs/Tabs.vue.d.ts +267 -0
- package/dist/components/tabs/Tabs.vue_vue_type_script_lang.js +9 -0
- package/dist/components/tabs/base.component.d.ts +12 -0
- package/dist/components/tabs/base.component.js +16 -0
- package/dist/components/tabs/collection.types.d.ts +1 -0
- package/dist/components/tabs/content/Content.js +20 -0
- package/dist/components/tabs/content/Content.vue.d.ts +40 -0
- package/dist/components/tabs/content/Content.vue_vue_type_script_lang.js +5 -0
- package/dist/components/tabs/content/base.component.d.ts +12 -0
- package/dist/components/tabs/content/base.component.js +16 -0
- package/dist/components/tabs/content/index.d.ts +5 -0
- package/dist/components/tabs/content/index.js +6 -0
- package/dist/components/tabs/content/setup.component.d.ts +31 -0
- package/dist/components/tabs/content/setup.component.js +34 -0
- package/dist/components/tabs/index.d.ts +804 -0
- package/dist/components/tabs/index.js +18 -0
- package/dist/components/tabs/item/Item.js +61 -0
- package/dist/components/tabs/item/Item.vue.d.ts +188 -0
- package/dist/components/tabs/item/Item.vue_vue_type_script_lang.js +13 -0
- package/dist/components/tabs/item/base.component.d.ts +12 -0
- package/dist/components/tabs/item/base.component.js +16 -0
- package/dist/components/tabs/item/index.d.ts +5 -0
- package/dist/components/tabs/item/index.js +6 -0
- package/dist/components/tabs/item/setup.component.d.ts +47 -0
- package/dist/components/tabs/item/setup.component.js +36 -0
- package/dist/components/tabs/setup.component.d.ts +41 -0
- package/dist/components/tabs/setup.component.js +34 -0
- package/dist/components/tags/Tags.js +40 -0
- package/dist/components/tags/Tags.vue.d.ts +319 -0
- package/dist/components/tags/Tags.vue_vue_type_script_lang.js +9 -0
- package/dist/components/tags/base.component.d.ts +12 -0
- package/dist/components/tags/base.component.js +16 -0
- package/dist/components/tags/index.d.ts +915 -0
- package/dist/components/tags/index.js +9 -0
- package/dist/components/tags/item/Item.js +64 -0
- package/dist/components/tags/item/Item.vue.d.ts +289 -0
- package/dist/components/tags/item/Item.vue_vue_type_script_lang.js +61 -0
- package/dist/components/tags/item/base.component.d.ts +12 -0
- package/dist/components/tags/item/base.component.js +16 -0
- package/dist/components/tags/item/index.d.ts +5 -0
- package/dist/components/tags/item/index.js +6 -0
- package/dist/components/tags/item/setup.component.d.ts +43 -0
- package/dist/components/tags/item/setup.component.js +36 -0
- package/dist/components/tags/setup.component.d.ts +35 -0
- package/dist/components/tags/setup.component.js +32 -0
- package/dist/components/textable/base.component.d.ts +12 -0
- package/dist/components/textable/index.d.ts +1 -0
- package/dist/components/textarea/Textarea.js +48 -0
- package/dist/components/textarea/Textarea.vue.d.ts +90 -0
- package/dist/components/textarea/Textarea.vue_vue_type_script_lang.js +5 -0
- package/dist/components/textarea/base.component.d.ts +12 -0
- package/dist/components/textarea/base.component.js +13 -0
- package/dist/components/textarea/index.d.ts +4 -0
- package/dist/components/textarea/index.js +6 -0
- package/dist/components/textarea/setup.component.d.ts +54 -0
- package/dist/components/textarea/setup.component.js +33 -0
- package/dist/components/toasts/Toasts.js +51 -0
- package/dist/components/toasts/Toasts.vue.d.ts +281 -0
- package/dist/components/toasts/Toasts.vue_vue_type_script_lang.js +17 -0
- package/dist/components/toasts/base.component.d.ts +12 -0
- package/dist/components/toasts/base.component.js +16 -0
- package/dist/components/toasts/index.d.ts +9 -0
- package/dist/components/toasts/index.js +11 -0
- package/dist/components/toasts/item/Item.js +64 -0
- package/dist/components/toasts/item/Item.vue.d.ts +230 -0
- package/dist/components/toasts/item/Item.vue_vue_type_script_lang.js +22 -0
- package/dist/components/toasts/item/base.component.d.ts +12 -0
- package/dist/components/toasts/item/base.component.js +16 -0
- package/dist/components/toasts/item/index.d.ts +6 -0
- package/dist/components/toasts/item/index.js +7 -0
- package/dist/components/toasts/item/setup.component.d.ts +51 -0
- package/dist/components/toasts/item/setup.component.js +60 -0
- package/dist/components/toasts/setup.component.d.ts +34 -0
- package/dist/components/toasts/setup.component.js +42 -0
- package/dist/components/tooltip/Tooltip.js +40 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +134 -0
- package/dist/components/tooltip/Tooltip.vue_vue_type_script_lang.js +9 -0
- package/dist/components/tooltip/base.component.d.ts +12 -0
- package/dist/components/tooltip/base.component.js +13 -0
- package/dist/components/tooltip/index.d.ts +4 -0
- package/dist/components/tooltip/index.js +6 -0
- package/dist/components/tooltip/setup.component.d.ts +32 -0
- package/dist/components/tooltip/setup.component.js +25 -0
- package/dist/components/value-control/base.component.d.ts +12 -0
- package/dist/components/value-control/index.d.ts +1 -0
- package/dist/components/virtual/Virtual.js +10 -0
- package/dist/components/virtual/Virtual.vue.d.ts +21 -0
- package/dist/components/virtual/Virtual.vue_vue_type_script_lang.js +5 -0
- package/dist/components/virtual/base.component.d.ts +12 -0
- package/dist/components/virtual/base.component.js +13 -0
- package/dist/components/virtual/index.d.ts +4 -0
- package/dist/components/virtual/index.js +6 -0
- package/dist/components/virtual/setup.component.d.ts +22 -0
- package/dist/components/virtual/setup.component.js +26 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +60 -0
- package/dist/types/common.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +56 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAdapter — the one Vue hook of the project.
|
|
3
|
+
*
|
|
4
|
+
* 1. Binds the component to Vue through the exchange `adapter.connect()` in
|
|
5
|
+
* `setup()`: the state record, the inputs, the events and `update:<prop>`
|
|
6
|
+
* for `v-model`
|
|
7
|
+
* 2. Accepts the component: `adapter.attach()` in `setup()`
|
|
8
|
+
* 3. Binds the root DOM element to `TElementPlugin` through the context
|
|
9
|
+
* 4. Calls `adapter.detach()` when the unmount begins and `adapter.destroy()`
|
|
10
|
+
* when it ends
|
|
11
|
+
*
|
|
12
|
+
* The template gets a view of the binding (`./view.ts`): a component with
|
|
13
|
+
* facades joins them with `joinBindings`, and adds its own values with
|
|
14
|
+
* `extendBinding`.
|
|
15
|
+
*/
|
|
16
|
+
import { type Ref } from 'vue';
|
|
17
|
+
import { type IAdapterContext, type IComponentContract, type TInstanceState } from '@soxa-ui/setup';
|
|
18
|
+
import type { IPluginBundle } from '@soxa-ui/plugins';
|
|
19
|
+
/** The public properties and getters of the controller (`TInstance`), without its methods. */
|
|
20
|
+
export type TExtractControllerState<TInstance> = {
|
|
21
|
+
[K in keyof TInstance as TInstance[K] extends (...args: never[]) => unknown ? never : K]: TInstance[K];
|
|
22
|
+
};
|
|
23
|
+
/** Props as the template sees them: refs among them are unwrapped, as a `setup()` result's are. */
|
|
24
|
+
export type TUnwrapRefs<T> = {
|
|
25
|
+
[K in keyof T]: T[K] extends Ref<infer U> ? U : T[K];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* What `useAdapter` returns and the template sees:
|
|
29
|
+
* - `ctrl` — the controller instance
|
|
30
|
+
* - `plugins` — the plugin bundle
|
|
31
|
+
* - `rootElement` — the ref of the root, when the bundle has `TElementPlugin`
|
|
32
|
+
* - the state (`TBindingState`)
|
|
33
|
+
*/
|
|
34
|
+
export type TBinding<C extends IComponentContract, TProps> = TBindingFields<C> & TBindingState<C, TProps>;
|
|
35
|
+
/** The fields of a component's view: read before its state. */
|
|
36
|
+
export type TBindingFields<C extends IComponentContract> = {
|
|
37
|
+
ctrl: C['instance'];
|
|
38
|
+
plugins: IPluginBundle | null;
|
|
39
|
+
rootElement?: Ref<Element | null>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The state in types: the props `TProps`, the instance properties and the
|
|
43
|
+
* plugin outputs of the contract — the latter of the same kind as in the other
|
|
44
|
+
* adapters (`TInstanceState`): a snapshot, read-only, an optional key.
|
|
45
|
+
*/
|
|
46
|
+
export type TBindingState<C extends IComponentContract, TProps> = TUnwrapRefs<TProps> & TExtractControllerState<C['instance']> & TInstanceState<C['plugins']['outputs']>;
|
|
47
|
+
/**
|
|
48
|
+
* The typed state record (`TBindingState`).
|
|
49
|
+
*
|
|
50
|
+
* The boundary between runtime and type, one for `useAdapter` and
|
|
51
|
+
* `useCollectionAdapter` — as `toInstanceState` in the other adapters. The
|
|
52
|
+
* record is filled by the descriptor from the same instance and the same
|
|
53
|
+
* plugins the contract `C` describes, but by property names — the descriptor
|
|
54
|
+
* holds that link, TypeScript does not see it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function toBindingState<C extends IComponentContract, TProps>(record: Readonly<Record<string, unknown>>): TBindingState<C, TProps>;
|
|
57
|
+
/**
|
|
58
|
+
* What `useAdapter` and `useCollectionAdapter` share: the subscriptions, the
|
|
59
|
+
* acceptance and the cleanup. Returns the state record of the context.
|
|
60
|
+
*/
|
|
61
|
+
export declare function useAdapterParts(adapter: IAdapterContext, props: object, emit?: (event: string, ...args: unknown[]) => void): Readonly<Record<string, unknown>>;
|
|
62
|
+
/**
|
|
63
|
+
* The binding of a component: its fields and its state.
|
|
64
|
+
*
|
|
65
|
+
* The component writes no generics: the instance and the plugin outputs come
|
|
66
|
+
* from the contract in the context type (`createVueAdapterContext` infers it),
|
|
67
|
+
* the props from `props` themselves.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useAdapter<C extends IComponentContract, TProps extends object>(adapter: IAdapterContext<C>, props: TProps, emit?: (event: string, ...args: unknown[]) => void): TBinding<C, TProps>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { VueProfile } from "../common/profile.js";
|
|
2
|
+
import { bindingOf } from "./view.js";
|
|
3
|
+
import { getCurrentInstance, onBeforeUnmount, onBeforeUpdate, onUnmounted, ref, shallowReactive, watch } from "vue";
|
|
4
|
+
import { TElementPlugin } from "@soxa-ui/plugins";
|
|
5
|
+
//#region src/adapter/runtime/useAdapter.ts
|
|
6
|
+
/**
|
|
7
|
+
* useAdapter — the one Vue hook of the project.
|
|
8
|
+
*
|
|
9
|
+
* 1. Binds the component to Vue through the exchange `adapter.connect()` in
|
|
10
|
+
* `setup()`: the state record, the inputs, the events and `update:<prop>`
|
|
11
|
+
* for `v-model`
|
|
12
|
+
* 2. Accepts the component: `adapter.attach()` in `setup()`
|
|
13
|
+
* 3. Binds the root DOM element to `TElementPlugin` through the context
|
|
14
|
+
* 4. Calls `adapter.detach()` when the unmount begins and `adapter.destroy()`
|
|
15
|
+
* when it ends
|
|
16
|
+
*
|
|
17
|
+
* The template gets a view of the binding (`./view.ts`): a component with
|
|
18
|
+
* facades joins them with `joinBindings`, and adds its own values with
|
|
19
|
+
* `extendBinding`.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The typed state record (`TBindingState`).
|
|
23
|
+
*
|
|
24
|
+
* The boundary between runtime and type, one for `useAdapter` and
|
|
25
|
+
* `useCollectionAdapter` — as `toInstanceState` in the other adapters. The
|
|
26
|
+
* record is filled by the descriptor from the same instance and the same
|
|
27
|
+
* plugins the contract `C` describes, but by property names — the descriptor
|
|
28
|
+
* holds that link, TypeScript does not see it.
|
|
29
|
+
*/
|
|
30
|
+
function toBindingState(record) {
|
|
31
|
+
return record;
|
|
32
|
+
}
|
|
33
|
+
/** Adds a key to a plain record like an assignment would, but keeps the record a fast object. */
|
|
34
|
+
function define(record, name, value) {
|
|
35
|
+
Object.defineProperty(record, name, {
|
|
36
|
+
value,
|
|
37
|
+
writable: true,
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What `useAdapter` and `useCollectionAdapter` share: the subscriptions, the
|
|
44
|
+
* acceptance and the cleanup. Returns the state record of the context.
|
|
45
|
+
*/
|
|
46
|
+
function useAdapterParts(adapter, props, emit) {
|
|
47
|
+
const link = adapter.connect(VueProfile);
|
|
48
|
+
const offs = [];
|
|
49
|
+
const record = {};
|
|
50
|
+
const state = shallowReactive(record);
|
|
51
|
+
offs.push(link.state.subscribe((name, value) => {
|
|
52
|
+
if (Object.hasOwn(record, name)) state[name] = value;
|
|
53
|
+
else define(record, name, value);
|
|
54
|
+
}));
|
|
55
|
+
const instance = getCurrentInstance();
|
|
56
|
+
let vnode = instance?.vnode;
|
|
57
|
+
onBeforeUpdate(() => {
|
|
58
|
+
if (!instance || instance.vnode === vnode) return;
|
|
59
|
+
vnode = instance.vnode;
|
|
60
|
+
link.inputs.full(props);
|
|
61
|
+
});
|
|
62
|
+
adapter.attach();
|
|
63
|
+
if (emit) adapter.events.on("detach", link.events.listen((name, args) => emit(name, ...args)));
|
|
64
|
+
onBeforeUnmount(() => adapter.detach());
|
|
65
|
+
onUnmounted(() => {
|
|
66
|
+
offs.forEach((off) => off());
|
|
67
|
+
adapter.destroy();
|
|
68
|
+
});
|
|
69
|
+
return state;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The node behind a template ref: Vue puts a component's instance there when
|
|
73
|
+
* the root is drawn by a component (Icon's `tag` is its glyph), and the node
|
|
74
|
+
* is that instance's `$el`.
|
|
75
|
+
*/
|
|
76
|
+
function elementOf(root) {
|
|
77
|
+
if (root instanceof Element) return root;
|
|
78
|
+
const el = typeof root === "object" && root !== null ? Reflect.get(root, "$el") : null;
|
|
79
|
+
return el instanceof Element ? el : null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The ref of the root bound to `TElementPlugin`, only where the bundle has
|
|
83
|
+
* the plugin: headless layers do not. A facade shares the component's bundle
|
|
84
|
+
* and has no node of its own, so `useCollectionAdapter` does not call this.
|
|
85
|
+
*
|
|
86
|
+
* The plugin gets the node, whatever the template wrote into the ref
|
|
87
|
+
* (`elementOf`): a component's instance in `TElementPlugin` gave no
|
|
88
|
+
* `element:ready`, and the plugins of Icon with a glyph never got a node.
|
|
89
|
+
*/
|
|
90
|
+
function useRootElement(adapter) {
|
|
91
|
+
if (!adapter.bundle?.get(TElementPlugin)) return void 0;
|
|
92
|
+
const rootElement = ref(null);
|
|
93
|
+
watch(rootElement, (root) => adapter.bindElement(elementOf(root)), { flush: "post" });
|
|
94
|
+
return rootElement;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The binding of a component: its fields and its state.
|
|
98
|
+
*
|
|
99
|
+
* The component writes no generics: the instance and the plugin outputs come
|
|
100
|
+
* from the contract in the context type (`createVueAdapterContext` infers it),
|
|
101
|
+
* the props from `props` themselves.
|
|
102
|
+
*/
|
|
103
|
+
function useAdapter(adapter, props, emit) {
|
|
104
|
+
const state = toBindingState(useAdapterParts(adapter, props, emit));
|
|
105
|
+
const rootElement = useRootElement(adapter);
|
|
106
|
+
const fields = rootElement ? {
|
|
107
|
+
ctrl: adapter.instance,
|
|
108
|
+
plugins: adapter.bundle,
|
|
109
|
+
rootElement
|
|
110
|
+
} : {
|
|
111
|
+
ctrl: adapter.instance,
|
|
112
|
+
plugins: adapter.bundle
|
|
113
|
+
};
|
|
114
|
+
return bindingOf(fields, state);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
export { toBindingState, useAdapter, useAdapterParts };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IAdapterContext, IComponentContract } from '@soxa-ui/setup';
|
|
2
|
+
import type { IPluginBundle } from '@soxa-ui/plugins';
|
|
3
|
+
import { type TBindingState } from './useAdapter';
|
|
4
|
+
/**
|
|
5
|
+
* The same as `TBinding`, without `ctrl` and `rootElement`.
|
|
6
|
+
*
|
|
7
|
+
* `TProps` are the component's props, the collection ones among them; the
|
|
8
|
+
* instance of the contract `C` is the facade. From them the template gets the
|
|
9
|
+
* types of `items`, `selected` and the rest the collection hands over.
|
|
10
|
+
*
|
|
11
|
+
* Built as an intersection, not through `Omit<TBinding, …>`: `Omit` flattens
|
|
12
|
+
* the intersection, and `items` of the declared prop stops merging with
|
|
13
|
+
* `items` of the facade — the template sees a union without `uid`.
|
|
14
|
+
*/
|
|
15
|
+
export type TCollectionBinding<C extends IComponentContract, TProps> = {
|
|
16
|
+
plugins: IPluginBundle | null;
|
|
17
|
+
} & TBindingState<C, TProps>;
|
|
18
|
+
/**
|
|
19
|
+
* The adapter of a collection facade — the facade of the owner and of an item:
|
|
20
|
+
* everything `useAdapter` does except what belongs to the component.
|
|
21
|
+
*
|
|
22
|
+
* - `ctrl` of a facade would be the `T*CollectionFacade`, while the template
|
|
23
|
+
* waits for the component under that name;
|
|
24
|
+
* - a facade has no root: it shares the component's bundle and has no node of
|
|
25
|
+
* its own, so it gets neither a root ref nor a `watch` on it — a ref the
|
|
26
|
+
* template never bound, on every item and owner of a collection.
|
|
27
|
+
*
|
|
28
|
+
* `plugins` stays: it is the **same** bundle for both contexts — the second
|
|
29
|
+
* one is created with `{ bundle: adapter.bundle }`.
|
|
30
|
+
*
|
|
31
|
+
* The component joins its binding with the facades' in `joinBindings` — one
|
|
32
|
+
* view, its fields first, then the states in order.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useCollectionAdapter<C extends IComponentContract, TProps extends object>(adapter: IAdapterContext<C>, props: TProps, emit?: (event: string, ...args: unknown[]) => void): TCollectionBinding<C, TProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { bindingOf } from "./view.js";
|
|
2
|
+
import { toBindingState, useAdapterParts } from "./useAdapter.js";
|
|
3
|
+
//#region src/adapter/runtime/useCollectionAdapter.ts
|
|
4
|
+
/**
|
|
5
|
+
* The adapter of a collection facade — the facade of the owner and of an item:
|
|
6
|
+
* everything `useAdapter` does except what belongs to the component.
|
|
7
|
+
*
|
|
8
|
+
* - `ctrl` of a facade would be the `T*CollectionFacade`, while the template
|
|
9
|
+
* waits for the component under that name;
|
|
10
|
+
* - a facade has no root: it shares the component's bundle and has no node of
|
|
11
|
+
* its own, so it gets neither a root ref nor a `watch` on it — a ref the
|
|
12
|
+
* template never bound, on every item and owner of a collection.
|
|
13
|
+
*
|
|
14
|
+
* `plugins` stays: it is the **same** bundle for both contexts — the second
|
|
15
|
+
* one is created with `{ bundle: adapter.bundle }`.
|
|
16
|
+
*
|
|
17
|
+
* The component joins its binding with the facades' in `joinBindings` — one
|
|
18
|
+
* view, its fields first, then the states in order.
|
|
19
|
+
*/
|
|
20
|
+
function useCollectionAdapter(adapter, props, emit) {
|
|
21
|
+
const state = toBindingState(useAdapterParts(adapter, props, emit));
|
|
22
|
+
return bindingOf({ plugins: adapter.bundle }, state);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useCollectionAdapter };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The binding view — what `setup()` of a component hands its template.
|
|
3
|
+
*
|
|
4
|
+
* One `Proxy` per component with a handler shared by the module. It reads the
|
|
5
|
+
* view's fields first — `ctrl`, `plugins`, `rootElement` and the component's
|
|
6
|
+
* own values — and then the state records of its contexts in order: the
|
|
7
|
+
* component's, then its facades'. Facade names are prefixed
|
|
8
|
+
* (docs/agents/collections.md, «Имена props фасада префиксуются»), so no name
|
|
9
|
+
* lives in two records.
|
|
10
|
+
*
|
|
11
|
+
* A state record is `shallowReactive` and written by the binding's
|
|
12
|
+
* subscription. Vue creates a `Dep` for a key only when an effect reads it —
|
|
13
|
+
* the render: a property the markup does not read costs a slot of the record
|
|
14
|
+
* and nothing else, and a read on the server or in `setup()` creates nothing.
|
|
15
|
+
* A `shallowRef` per property cost a `RefImpl` and a `Dep` on every property,
|
|
16
|
+
* read by the markup or not — and it reads fewer than half of them
|
|
17
|
+
* (benchmarks/pages/vue.md, 869fmjnaq).
|
|
18
|
+
*
|
|
19
|
+
* Not a getter per property: a closure over the context with a pair of
|
|
20
|
+
* accessors weighs about as much as the `RefImpl` with its `Dep`. Not a
|
|
21
|
+
* spread: it reads every value once, in `setup()`, and unties the markup from
|
|
22
|
+
* the core — hence `joinBindings` and `extendBinding`, which build one flat
|
|
23
|
+
* view again.
|
|
24
|
+
*
|
|
25
|
+
* Presence, keys and descriptors come from the records themselves, untracked:
|
|
26
|
+
* Vue looks a template name up with `hasOwn` on the `setup()` result and, in
|
|
27
|
+
* development, lists its keys. A key with the value `undefined` is present:
|
|
28
|
+
* the subscription hands every property over at once, and a name Vue did not
|
|
29
|
+
* find there on the first read it resolves elsewhere for good. The view is
|
|
30
|
+
* read-only — the state goes core → Vue only; the template ref reaches
|
|
31
|
+
* `rootElement` through the ref itself, the way `proxyRefs` writes a ref.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* The view of a context: its fields, then its state record. The boundary
|
|
35
|
+
* between runtime and type, as `toInstanceState` in the other adapters: the
|
|
36
|
+
* proxy reads every field and every property of the state, but TypeScript
|
|
37
|
+
* does not see that.
|
|
38
|
+
*/
|
|
39
|
+
export declare function bindingOf<TFields extends object, TState extends object>(fields: TFields, state: TState): TFields & TState;
|
|
40
|
+
/**
|
|
41
|
+
* The binding of a component and its facades — one view for the markup: the
|
|
42
|
+
* fields of all of them, the component's winning (a facade carries only the
|
|
43
|
+
* same bundle in `plugins`), and their states in order. The hooks are still
|
|
44
|
+
* called in their order: `attach` and `onUnmounted` go by it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function joinBindings<TOwner extends object, TFacade extends object>(owner: TOwner, facade: TFacade): TOwner & TFacade;
|
|
47
|
+
export declare function joinBindings<TOwner extends object, TFacade extends object, TOwnerFacade extends object>(owner: TOwner, facade: TFacade, ownerFacade: TOwnerFacade): TOwner & TFacade & TOwnerFacade;
|
|
48
|
+
/**
|
|
49
|
+
* The binding with the component's own values — icon tags, an inner instance,
|
|
50
|
+
* attribute groups: they win over a state property of the same name, as a
|
|
51
|
+
* spread after the binding did.
|
|
52
|
+
*/
|
|
53
|
+
export declare function extendBinding<TView extends object, TValues extends object>(binding: TView, values: TValues): Omit<TView, keyof TValues> & TValues;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { toRaw } from "vue";
|
|
2
|
+
//#region src/adapter/runtime/view.ts
|
|
3
|
+
/**
|
|
4
|
+
* The binding view — what `setup()` of a component hands its template.
|
|
5
|
+
*
|
|
6
|
+
* One `Proxy` per component with a handler shared by the module. It reads the
|
|
7
|
+
* view's fields first — `ctrl`, `plugins`, `rootElement` and the component's
|
|
8
|
+
* own values — and then the state records of its contexts in order: the
|
|
9
|
+
* component's, then its facades'. Facade names are prefixed
|
|
10
|
+
* (docs/agents/collections.md, «Имена props фасада префиксуются»), so no name
|
|
11
|
+
* lives in two records.
|
|
12
|
+
*
|
|
13
|
+
* A state record is `shallowReactive` and written by the binding's
|
|
14
|
+
* subscription. Vue creates a `Dep` for a key only when an effect reads it —
|
|
15
|
+
* the render: a property the markup does not read costs a slot of the record
|
|
16
|
+
* and nothing else, and a read on the server or in `setup()` creates nothing.
|
|
17
|
+
* A `shallowRef` per property cost a `RefImpl` and a `Dep` on every property,
|
|
18
|
+
* read by the markup or not — and it reads fewer than half of them
|
|
19
|
+
* (benchmarks/pages/vue.md, 869fmjnaq).
|
|
20
|
+
*
|
|
21
|
+
* Not a getter per property: a closure over the context with a pair of
|
|
22
|
+
* accessors weighs about as much as the `RefImpl` with its `Dep`. Not a
|
|
23
|
+
* spread: it reads every value once, in `setup()`, and unties the markup from
|
|
24
|
+
* the core — hence `joinBindings` and `extendBinding`, which build one flat
|
|
25
|
+
* view again.
|
|
26
|
+
*
|
|
27
|
+
* Presence, keys and descriptors come from the records themselves, untracked:
|
|
28
|
+
* Vue looks a template name up with `hasOwn` on the `setup()` result and, in
|
|
29
|
+
* development, lists its keys. A key with the value `undefined` is present:
|
|
30
|
+
* the subscription hands every property over at once, and a name Vue did not
|
|
31
|
+
* find there on the first read it resolves elsewhere for good. The view is
|
|
32
|
+
* read-only — the state goes core → Vue only; the template ref reaches
|
|
33
|
+
* `rootElement` through the ref itself, the way `proxyRefs` writes a ref.
|
|
34
|
+
*/
|
|
35
|
+
/** What a view reads: its fields, then the state records in order. */
|
|
36
|
+
var TViewParts = class {
|
|
37
|
+
fields;
|
|
38
|
+
states;
|
|
39
|
+
constructor(fields, states) {
|
|
40
|
+
this.fields = fields;
|
|
41
|
+
this.states = states;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/** The parts behind a view: only joining and extending ask for them. */
|
|
45
|
+
var PARTS = Symbol("soxa.binding.parts");
|
|
46
|
+
/** Where the key lives — the fields or a state record. Reads no value and tracks nothing. */
|
|
47
|
+
function sourceOf({ fields, states }, key) {
|
|
48
|
+
if (Object.hasOwn(fields, key)) return fields;
|
|
49
|
+
for (const state of states) if (Object.hasOwn(state, key)) return state;
|
|
50
|
+
}
|
|
51
|
+
var VIEW = {
|
|
52
|
+
get: (parts, key) => {
|
|
53
|
+
if (key === PARTS) return parts;
|
|
54
|
+
const source = sourceOf(parts, key);
|
|
55
|
+
return source && Reflect.get(source, key);
|
|
56
|
+
},
|
|
57
|
+
has: (parts, key) => sourceOf(parts, key) !== void 0,
|
|
58
|
+
ownKeys: ({ fields, states }) => [.../* @__PURE__ */ new Set([...Reflect.ownKeys(fields), ...states.flatMap((state) => Reflect.ownKeys(toRaw(state)))])],
|
|
59
|
+
getOwnPropertyDescriptor: (parts, key) => {
|
|
60
|
+
const source = sourceOf(parts, key);
|
|
61
|
+
return source && Reflect.getOwnPropertyDescriptor(source, key);
|
|
62
|
+
},
|
|
63
|
+
set: () => false,
|
|
64
|
+
defineProperty: () => false,
|
|
65
|
+
deleteProperty: () => false
|
|
66
|
+
};
|
|
67
|
+
function viewOf(fields, states) {
|
|
68
|
+
return new Proxy(new TViewParts(fields, states), VIEW);
|
|
69
|
+
}
|
|
70
|
+
function partsOf(binding) {
|
|
71
|
+
const parts = Reflect.get(binding, PARTS);
|
|
72
|
+
if (!(parts instanceof TViewParts)) throw new Error("[soxa] Not a binding: expected the result of useAdapter or useCollectionAdapter");
|
|
73
|
+
return parts;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The view of a context: its fields, then its state record. The boundary
|
|
77
|
+
* between runtime and type, as `toInstanceState` in the other adapters: the
|
|
78
|
+
* proxy reads every field and every property of the state, but TypeScript
|
|
79
|
+
* does not see that.
|
|
80
|
+
*/
|
|
81
|
+
function bindingOf(fields, state) {
|
|
82
|
+
return viewOf(fields, [state]);
|
|
83
|
+
}
|
|
84
|
+
function joinBindings(owner, ...facades) {
|
|
85
|
+
const parts = [owner, ...facades].map(partsOf);
|
|
86
|
+
const fields = {};
|
|
87
|
+
for (const part of [...parts].reverse()) Object.assign(fields, part.fields);
|
|
88
|
+
return viewOf(fields, parts.flatMap(({ states }) => states));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The binding with the component's own values — icon tags, an inner instance,
|
|
92
|
+
* attribute groups: they win over a state property of the same name, as a
|
|
93
|
+
* spread after the binding did.
|
|
94
|
+
*/
|
|
95
|
+
function extendBinding(binding, values) {
|
|
96
|
+
const { fields, states } = partsOf(binding);
|
|
97
|
+
return viewOf({
|
|
98
|
+
...fields,
|
|
99
|
+
...values
|
|
100
|
+
}, states);
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { bindingOf, extendBinding, joinBindings };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Статический хелпер для сборки emits во Vue Options API (base.component.ts).
|
|
3
|
+
*
|
|
4
|
+
* Выполняется на этапе объявления компонента (Build Time),
|
|
5
|
+
* не имеет сайд-эффектов и не тянет реактивный runtime.
|
|
6
|
+
*/
|
|
7
|
+
import { type IComponentDescriptor } from '@soxa-ui/setup';
|
|
8
|
+
/**
|
|
9
|
+
* События ядра, триггеры свойств и `update:<prop>` для `v-model` — всё из
|
|
10
|
+
* поверхности: объявление и эмит ходят по ней одной, иначе Vue ругался бы на
|
|
11
|
+
* необъявленное событие.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useEmits(descriptor: IComponentDescriptor): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VueProfile } from "../common/profile.js";
|
|
2
|
+
import { TSurface } from "@soxa-ui/setup";
|
|
3
|
+
//#region src/adapter/static/useEmits.ts
|
|
4
|
+
/**
|
|
5
|
+
* Статический хелпер для сборки emits во Vue Options API (base.component.ts).
|
|
6
|
+
*
|
|
7
|
+
* Выполняется на этапе объявления компонента (Build Time),
|
|
8
|
+
* не имеет сайд-эффектов и не тянет реактивный runtime.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* События ядра, триггеры свойств и `update:<prop>` для `v-model` — всё из
|
|
12
|
+
* поверхности: объявление и эмит ходят по ней одной, иначе Vue ругался бы на
|
|
13
|
+
* необъявленное событие.
|
|
14
|
+
*/
|
|
15
|
+
function useEmits(descriptor) {
|
|
16
|
+
return [...TSurface.of(descriptor, VueProfile).exportEvents];
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { useEmits };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed instance: what the consumer's `ref` sees of a component.
|
|
3
|
+
*
|
|
4
|
+
* A component has two control surfaces — props with events, and `ctrl`
|
|
5
|
+
* (AGENTS.md, «Две поверхности управления») — and `ref` is the way to the
|
|
6
|
+
* root, `$el`, not a third one. So the instance is closed from outside: it
|
|
7
|
+
* gives the own properties of Vue (`$el`, `$props`, `$slots`…) and not the
|
|
8
|
+
* bindings of the template — `ctrl`, the state, the outputs of plugins. The
|
|
9
|
+
* root `$el` comes from Vue itself, and for a component whose template root is
|
|
10
|
+
* a teleport, from `exposeRoot`.
|
|
11
|
+
*
|
|
12
|
+
* Two records close it, the run time and the type, and both are needed:
|
|
13
|
+
* vue-tsc checks the template of a component by the public type of its
|
|
14
|
+
* instance, so an option the type sees would close the template too.
|
|
15
|
+
*
|
|
16
|
+
* - `useExpose()` — the `expose` option of a component (`setup.component.ts`),
|
|
17
|
+
* closes the instance at run time;
|
|
18
|
+
* - `TClosedComponent` — the type of a component at its export, closes the
|
|
19
|
+
* instance in the type.
|
|
20
|
+
*/
|
|
21
|
+
import type { ComponentCustomProperties, ComponentPublicInstance } from 'vue';
|
|
22
|
+
/**
|
|
23
|
+
* The `expose` option of a component: an empty list — the instance opens
|
|
24
|
+
* nothing but the properties of Vue.
|
|
25
|
+
*
|
|
26
|
+
* Every component has its own: Vue does not take it from `extends` (it warns
|
|
27
|
+
* and ignores it), so `base.component.ts` has none.
|
|
28
|
+
*
|
|
29
|
+
* The type is `string[]`, not an empty tuple: from `expose: []` vue-tsc would
|
|
30
|
+
* infer the closed type of the instance and check the template of the
|
|
31
|
+
* component by it too — every binding would vanish from the template. The
|
|
32
|
+
* type is closed by `TClosedComponent`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useExpose(): string[];
|
|
35
|
+
/**
|
|
36
|
+
* The named keys of a type, without its index signatures: `string`, `number`
|
|
37
|
+
* and patterns such as `$${string}`. An object with no properties
|
|
38
|
+
* (`Record<never, never>`) satisfies an index signature and never a named key.
|
|
39
|
+
*/
|
|
40
|
+
type TNamedKeys<T> = keyof {
|
|
41
|
+
[K in keyof T as Record<never, never> extends Record<K, unknown> ? never : K]: T[K];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The properties Vue gives on the closed instance: `$el`, `$props`, `$slots`,
|
|
45
|
+
* `$emit`… The globals of the application (`ComponentCustomProperties`) the
|
|
46
|
+
* closed instance does not give. Only the named ones are subtracted: Nuxt
|
|
47
|
+
* types the injections of its plugins with a pattern, `$${string}`, and
|
|
48
|
+
* subtracting it would take `$props` away and with it the check of the props
|
|
49
|
+
* in templates.
|
|
50
|
+
*/
|
|
51
|
+
type TInstanceKeys = Exclude<TNamedKeys<ComponentPublicInstance>, TNamedKeys<ComponentCustomProperties>>;
|
|
52
|
+
/** The closed instance in the type: only the properties of Vue, no template bindings. */
|
|
53
|
+
export type TClosedInstance<TInstance extends ComponentPublicInstance> = Pick<TInstance, TInstanceKeys>;
|
|
54
|
+
/**
|
|
55
|
+
* A component whose instance is closed (`useExpose`): its props, events and
|
|
56
|
+
* slots stay — vue-tsc takes them from `$props`, `$emit` and `$slots` — while
|
|
57
|
+
* the instance from `ref` is typed by the properties of Vue.
|
|
58
|
+
*
|
|
59
|
+
* The type is set at the export of the component, not by an option: the
|
|
60
|
+
* template needs the open type, the consumer the closed one (see the head of
|
|
61
|
+
* the file). There is no cast here: the open instance is a subtype of the
|
|
62
|
+
* closed one, and the component is assigned to this type as it is, under the
|
|
63
|
+
* check of the compiler.
|
|
64
|
+
*
|
|
65
|
+
* The constructor is replaced as a whole (`Omit` drops the signature of the
|
|
66
|
+
* original): with two `new` signatures the original, open one would be chosen.
|
|
67
|
+
*/
|
|
68
|
+
export type TClosedComponent<TComponent extends new (...args: any[]) => ComponentPublicInstance> = Omit<TComponent, never> & (new (...args: any[]) => TClosedInstance<InstanceType<TComponent>>);
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/adapter/static/useExpose.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `expose` option of a component: an empty list — the instance opens
|
|
4
|
+
* nothing but the properties of Vue.
|
|
5
|
+
*
|
|
6
|
+
* Every component has its own: Vue does not take it from `extends` (it warns
|
|
7
|
+
* and ignores it), so `base.component.ts` has none.
|
|
8
|
+
*
|
|
9
|
+
* The type is `string[]`, not an empty tuple: from `expose: []` vue-tsc would
|
|
10
|
+
* infer the closed type of the instance and check the template of the
|
|
11
|
+
* component by it too — every binding would vanish from the template. The
|
|
12
|
+
* type is closed by `TClosedComponent`.
|
|
13
|
+
*/
|
|
14
|
+
function useExpose() {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { useExpose };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Статический хелпер для сборки props во Vue Options API (base.component.ts).
|
|
3
|
+
*
|
|
4
|
+
* Выполняется на этапе объявления компонента (Build Time),
|
|
5
|
+
* не имеет сайд-эффектов и не тянет реактивный runtime.
|
|
6
|
+
*/
|
|
7
|
+
import { type IComponentDescriptor } from '@soxa-ui/setup';
|
|
8
|
+
export declare function useProps(descriptor: IComponentDescriptor): Record<string, unknown>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VueProfile } from "../common/profile.js";
|
|
2
|
+
import { TSurface } from "@soxa-ui/setup";
|
|
3
|
+
//#region src/adapter/static/useProps.ts
|
|
4
|
+
/**
|
|
5
|
+
* Статический хелпер для сборки props во Vue Options API (base.component.ts).
|
|
6
|
+
*
|
|
7
|
+
* Выполняется на этапе объявления компонента (Build Time),
|
|
8
|
+
* не имеет сайд-эффектов и не тянет реактивный runtime.
|
|
9
|
+
*/
|
|
10
|
+
function useProps(descriptor) {
|
|
11
|
+
const vueProps = {};
|
|
12
|
+
for (const [propName, config] of Object.entries(TSurface.of(descriptor, VueProfile).exportProps)) vueProps[propName] = { ...config };
|
|
13
|
+
return vueProps;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { useProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TToastRender } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Своё содержимое тоста — компонент Vue: объект определения или функция
|
|
4
|
+
* (функциональный компонент, класс). Ядро держит `render` как `unknown`, и
|
|
5
|
+
* разметка тоста рисует его, только когда это компонент: проверкой, а не
|
|
6
|
+
* приведением.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isToastRender(value: unknown): value is TToastRender;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/adapter/toasts/render.ts
|
|
2
|
+
/**
|
|
3
|
+
* Своё содержимое тоста — компонент Vue: объект определения или функция
|
|
4
|
+
* (функциональный компонент, класс). Ядро держит `render` как `unknown`, и
|
|
5
|
+
* разметка тоста рисует его, только когда это компонент: проверкой, а не
|
|
6
|
+
* приведением.
|
|
7
|
+
*/
|
|
8
|
+
function isToastRender(value) {
|
|
9
|
+
return typeof value === "function" || typeof value === "object" && value !== null;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { isToastRender };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { IToastsItem } from '@soxa-ui/core';
|
|
3
|
+
/**
|
|
4
|
+
* Своё содержимое тоста во Vue (`render`) — компонент, которому тост приходит
|
|
5
|
+
* пропом `toast`: кнопка «Отменить» внутри может его закрыть
|
|
6
|
+
* (`toast.close()`). Ядро значение не читает, поэтому там оно `unknown`, а
|
|
7
|
+
* тип ему даёт API адаптера (`useToasts()`).
|
|
8
|
+
*/
|
|
9
|
+
export type TToastRender = Component<{
|
|
10
|
+
toast: IToastsItem;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IToastsApi } from '@soxa-ui/core';
|
|
2
|
+
import type { TToastRender } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* API тостов ближайшего `<Toasts>` выше по дереву: `const { show } = useToasts()`.
|
|
5
|
+
*
|
|
6
|
+
* Менеджер опускает API лифтом (`TToastsApiExtension`), и здесь он берётся тем
|
|
7
|
+
* же лифтом — `inject` Vue, поэтому звать `useToasts()` можно только
|
|
8
|
+
* синхронно в `setup()` компонента под менеджером. `show` — поле со стрелкой:
|
|
9
|
+
* деструктуризация не теряет `this`.
|
|
10
|
+
*
|
|
11
|
+
* Своё содержимое (`render`) здесь типизировано компонентом Vue с пропом
|
|
12
|
+
* `toast`: ядро значение не читает, и тип ему даёт адаптер.
|
|
13
|
+
*
|
|
14
|
+
* Менеджера выше нет — ошибка: тост показать негде, и молчаливый `show`,
|
|
15
|
+
* который ничего не делает, спрятал бы забытый `<Toasts>`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useToasts(): IToastsApi<TToastRender>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { VueElevatorFactory } from "../elevator/factory.js";
|
|
2
|
+
import { TOASTS_ELEVATOR } from "@soxa-ui/setup";
|
|
3
|
+
//#region src/adapter/toasts/useToasts.ts
|
|
4
|
+
/**
|
|
5
|
+
* API тостов ближайшего `<Toasts>` выше по дереву: `const { show } = useToasts()`.
|
|
6
|
+
*
|
|
7
|
+
* Менеджер опускает API лифтом (`TToastsApiExtension`), и здесь он берётся тем
|
|
8
|
+
* же лифтом — `inject` Vue, поэтому звать `useToasts()` можно только
|
|
9
|
+
* синхронно в `setup()` компонента под менеджером. `show` — поле со стрелкой:
|
|
10
|
+
* деструктуризация не теряет `this`.
|
|
11
|
+
*
|
|
12
|
+
* Своё содержимое (`render`) здесь типизировано компонентом Vue с пропом
|
|
13
|
+
* `toast`: ядро значение не читает, и тип ему даёт адаптер.
|
|
14
|
+
*
|
|
15
|
+
* Менеджера выше нет — ошибка: тост показать негде, и молчаливый `show`,
|
|
16
|
+
* который ничего не делает, спрятал бы забытый `<Toasts>`.
|
|
17
|
+
*/
|
|
18
|
+
function useToasts() {
|
|
19
|
+
const api = VueElevatorFactory(TOASTS_ELEVATOR).up();
|
|
20
|
+
if (!api) throw new Error("useToasts(): выше по дереву нет <Toasts>. Оберните приложение менеджером: <Toasts><App /></Toasts>");
|
|
21
|
+
return api;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useToasts };
|