@soxa-ui/svelte 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 +219 -2
- package/dist/adapter/common/RoleIcon.svelte +25 -0
- package/dist/adapter/common/RoleIcon.svelte.d.ts +13 -0
- package/dist/adapter/common/click-action.d.ts +7 -0
- package/dist/adapter/common/click-action.js +11 -0
- package/dist/adapter/common/createSvelteAdapterContext.d.ts +12 -0
- package/dist/adapter/common/createSvelteAdapterContext.js +11 -0
- package/dist/adapter/common/handlers.d.ts +6 -0
- package/dist/adapter/common/handlers.js +11 -0
- package/dist/adapter/common/icon.d.ts +11 -0
- package/dist/adapter/common/icon.js +22 -0
- package/dist/adapter/common/index.d.ts +8 -0
- package/dist/adapter/common/index.js +8 -0
- package/dist/adapter/common/naming.d.ts +3 -0
- package/dist/adapter/common/naming.js +6 -0
- package/dist/adapter/common/profile.d.ts +2 -0
- package/dist/adapter/common/profile.js +2 -0
- package/dist/adapter/common/root.d.ts +77 -0
- package/dist/adapter/common/root.js +88 -0
- package/dist/adapter/elevator/elevator.class.d.ts +13 -0
- package/dist/adapter/elevator/elevator.class.js +27 -0
- package/dist/adapter/elevator/index.d.ts +2 -0
- package/dist/adapter/elevator/index.js +2 -0
- package/dist/adapter/elevator/useElevator.d.ts +6 -0
- package/dist/adapter/elevator/useElevator.js +9 -0
- package/dist/adapter/index.d.ts +5 -0
- package/dist/adapter/index.js +5 -0
- package/dist/adapter/locale/LocaleProvider.svelte +21 -0
- package/dist/adapter/locale/LocaleProvider.svelte.d.ts +4 -0
- package/dist/adapter/locale/context.d.ts +6 -0
- package/dist/adapter/locale/context.js +12 -0
- package/dist/adapter/locale/index.d.ts +2 -0
- package/dist/adapter/locale/index.js +1 -0
- package/dist/adapter/locale/types.d.ts +7 -0
- package/dist/adapter/locale/types.js +1 -0
- package/dist/adapter/runtime/Dynamic.svelte +54 -0
- package/dist/adapter/runtime/Dynamic.svelte.d.ts +25 -0
- package/dist/adapter/runtime/Teleport.svelte +96 -0
- package/dist/adapter/runtime/Teleport.svelte.d.ts +5 -0
- package/dist/adapter/runtime/TextSpan.svelte +28 -0
- package/dist/adapter/runtime/TextSpan.svelte.d.ts +8 -0
- package/dist/adapter/runtime/field-text.d.ts +29 -0
- package/dist/adapter/runtime/field-text.js +45 -0
- package/dist/adapter/runtime/index.d.ts +8 -0
- package/dist/adapter/runtime/index.js +7 -0
- package/dist/adapter/runtime/root-style.svelte.d.ts +27 -0
- package/dist/adapter/runtime/root-style.svelte.js +105 -0
- package/dist/adapter/runtime/runs.d.ts +13 -0
- package/dist/adapter/runtime/runs.js +20 -0
- package/dist/adapter/runtime/state.d.ts +8 -0
- package/dist/adapter/runtime/state.js +28 -0
- package/dist/adapter/runtime/tag.d.ts +11 -0
- package/dist/adapter/runtime/tag.js +4 -0
- package/dist/adapter/runtime/types.d.ts +8 -0
- package/dist/adapter/runtime/types.js +1 -0
- package/dist/adapter/runtime/useAdapter.svelte.d.ts +62 -0
- package/dist/adapter/runtime/useAdapter.svelte.js +228 -0
- package/dist/adapter/toasts/index.d.ts +3 -0
- package/dist/adapter/toasts/index.js +2 -0
- package/dist/adapter/toasts/render.d.ts +3 -0
- package/dist/adapter/toasts/render.js +4 -0
- package/dist/adapter/toasts/types.d.ts +6 -0
- package/dist/adapter/toasts/types.js +1 -0
- package/dist/adapter/toasts/useToasts.d.ts +7 -0
- package/dist/adapter/toasts/useToasts.js +13 -0
- package/dist/components/accordion/Accordion.svelte +43 -0
- package/dist/components/accordion/Accordion.svelte.d.ts +4 -0
- package/dist/components/accordion/base.component.d.ts +5 -0
- package/dist/components/accordion/base.component.js +1 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.js +7 -0
- package/dist/components/accordion/item/Item.svelte +84 -0
- package/dist/components/accordion/item/Item.svelte.d.ts +4 -0
- package/dist/components/accordion/item/base.component.d.ts +7 -0
- package/dist/components/accordion/item/base.component.js +1 -0
- package/dist/components/accordion/item/index.d.ts +3 -0
- package/dist/components/accordion/item/index.js +3 -0
- package/dist/components/accordion/item/setup.component.d.ts +57 -0
- package/dist/components/accordion/item/setup.component.js +15 -0
- package/dist/components/accordion/setup.component.d.ts +47 -0
- package/dist/components/accordion/setup.component.js +21 -0
- package/dist/components/button/Button.svelte +33 -0
- package/dist/components/button/Button.svelte.d.ts +4 -0
- package/dist/components/button/base.component.d.ts +7 -0
- package/dist/components/button/base.component.js +1 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button/setup.component.d.ts +43 -0
- package/dist/components/button/setup.component.js +10 -0
- package/dist/components/calendar/Calendar.svelte +193 -0
- package/dist/components/calendar/Calendar.svelte.d.ts +4 -0
- package/dist/components/calendar/base.component.d.ts +5 -0
- package/dist/components/calendar/base.component.js +1 -0
- package/dist/components/calendar/index.d.ts +6 -0
- package/dist/components/calendar/index.js +7 -0
- package/dist/components/calendar/item/Item.svelte +31 -0
- package/dist/components/calendar/item/Item.svelte.d.ts +4 -0
- package/dist/components/calendar/item/base.component.d.ts +6 -0
- package/dist/components/calendar/item/base.component.js +1 -0
- package/dist/components/calendar/item/index.d.ts +3 -0
- package/dist/components/calendar/item/index.js +3 -0
- package/dist/components/calendar/item/setup.component.d.ts +21 -0
- package/dist/components/calendar/item/setup.component.js +15 -0
- package/dist/components/calendar/setup.component.d.ts +47 -0
- package/dist/components/calendar/setup.component.js +19 -0
- package/dist/components/check-box/CheckBox.svelte +66 -0
- package/dist/components/check-box/CheckBox.svelte.d.ts +4 -0
- package/dist/components/check-box/base.component.d.ts +7 -0
- package/dist/components/check-box/base.component.js +1 -0
- package/dist/components/check-box/index.d.ts +3 -0
- package/dist/components/check-box/index.js +3 -0
- package/dist/components/check-box/setup.component.d.ts +51 -0
- package/dist/components/check-box/setup.component.js +11 -0
- package/dist/components/component/base.component.d.ts +5 -0
- package/dist/components/component/base.component.js +1 -0
- package/dist/components/component/index.d.ts +1 -0
- package/dist/components/component/index.js +1 -0
- package/dist/components/component-view/ComponentView.svelte +25 -0
- package/dist/components/component-view/ComponentView.svelte.d.ts +4 -0
- package/dist/components/component-view/base.component.d.ts +5 -0
- package/dist/components/component-view/base.component.js +1 -0
- package/dist/components/component-view/index.d.ts +3 -0
- package/dist/components/component-view/index.js +3 -0
- package/dist/components/component-view/setup.component.d.ts +17 -0
- package/dist/components/component-view/setup.component.js +10 -0
- package/dist/components/control/base.component.d.ts +5 -0
- package/dist/components/control/base.component.js +1 -0
- package/dist/components/control/index.d.ts +2 -0
- package/dist/components/control/index.js +2 -0
- package/dist/components/control/setup.component.d.ts +42 -0
- package/dist/components/control/setup.component.js +10 -0
- package/dist/components/date-input/DateInput.svelte +75 -0
- package/dist/components/date-input/DateInput.svelte.d.ts +4 -0
- package/dist/components/date-input/base.component.d.ts +6 -0
- package/dist/components/date-input/base.component.js +1 -0
- package/dist/components/date-input/index.d.ts +3 -0
- package/dist/components/date-input/index.js +3 -0
- package/dist/components/date-input/setup.component.d.ts +51 -0
- package/dist/components/date-input/setup.component.js +11 -0
- package/dist/components/date-picker/DatePicker.svelte +159 -0
- package/dist/components/date-picker/DatePicker.svelte.d.ts +4 -0
- package/dist/components/date-picker/base.component.d.ts +6 -0
- package/dist/components/date-picker/base.component.js +1 -0
- package/dist/components/date-picker/index.d.ts +3 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/date-picker/setup.component.d.ts +83 -0
- package/dist/components/date-picker/setup.component.js +11 -0
- package/dist/components/dialog/Dialog.svelte +90 -0
- package/dist/components/dialog/Dialog.svelte.d.ts +4 -0
- package/dist/components/dialog/base.component.d.ts +6 -0
- package/dist/components/dialog/base.component.js +1 -0
- package/dist/components/dialog/index.d.ts +3 -0
- package/dist/components/dialog/index.js +3 -0
- package/dist/components/dialog/setup.component.d.ts +57 -0
- package/dist/components/dialog/setup.component.js +10 -0
- package/dist/components/drag-and-drop/DragAndDrop.svelte +12 -0
- package/dist/components/drag-and-drop/DragAndDrop.svelte.d.ts +4 -0
- package/dist/components/drag-and-drop/base.component.d.ts +6 -0
- package/dist/components/drag-and-drop/base.component.js +1 -0
- package/dist/components/drag-and-drop/index.d.ts +3 -0
- package/dist/components/drag-and-drop/index.js +3 -0
- package/dist/components/drag-and-drop/setup.component.d.ts +10 -0
- package/dist/components/drag-and-drop/setup.component.js +11 -0
- package/dist/components/drawer/Drawer.svelte +69 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +4 -0
- package/dist/components/drawer/base.component.d.ts +6 -0
- package/dist/components/drawer/base.component.js +1 -0
- package/dist/components/drawer/index.d.ts +3 -0
- package/dist/components/drawer/index.js +3 -0
- package/dist/components/drawer/setup.component.d.ts +57 -0
- package/dist/components/drawer/setup.component.js +10 -0
- package/dist/components/field/Field.svelte +58 -0
- package/dist/components/field/Field.svelte.d.ts +4 -0
- package/dist/components/field/base.component.d.ts +5 -0
- package/dist/components/field/base.component.js +1 -0
- package/dist/components/field/index.d.ts +3 -0
- package/dist/components/field/index.js +3 -0
- package/dist/components/field/setup.component.d.ts +17 -0
- package/dist/components/field/setup.component.js +11 -0
- package/dist/components/frame/Frame.svelte +28 -0
- package/dist/components/frame/Frame.svelte.d.ts +4 -0
- package/dist/components/frame/base.component.d.ts +5 -0
- package/dist/components/frame/base.component.js +1 -0
- package/dist/components/frame/index.d.ts +3 -0
- package/dist/components/frame/index.js +3 -0
- package/dist/components/frame/setup.component.d.ts +65 -0
- package/dist/components/frame/setup.component.js +10 -0
- package/dist/components/icon/Icon.svelte +22 -0
- package/dist/components/icon/Icon.svelte.d.ts +4 -0
- package/dist/components/icon/base.component.d.ts +5 -0
- package/dist/components/icon/base.component.js +1 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/icon/setup.component.d.ts +37 -0
- package/dist/components/icon/setup.component.js +10 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/index.js +43 -0
- package/dist/components/input/Input.svelte +75 -0
- package/dist/components/input/Input.svelte.d.ts +4 -0
- package/dist/components/input/base.component.d.ts +7 -0
- package/dist/components/input/base.component.js +1 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.js +3 -0
- package/dist/components/input/setup.component.d.ts +51 -0
- package/dist/components/input/setup.component.js +11 -0
- package/dist/components/input-control/base.component.d.ts +6 -0
- package/dist/components/input-control/base.component.js +1 -0
- package/dist/components/input-control/index.d.ts +2 -0
- package/dist/components/input-control/index.js +2 -0
- package/dist/components/input-control/setup.component.d.ts +50 -0
- package/dist/components/input-control/setup.component.js +10 -0
- package/dist/components/interactive/base.component.d.ts +5 -0
- package/dist/components/interactive/base.component.js +1 -0
- package/dist/components/interactive/index.d.ts +2 -0
- package/dist/components/interactive/index.js +2 -0
- package/dist/components/interactive/setup.component.d.ts +16 -0
- package/dist/components/interactive/setup.component.js +10 -0
- package/dist/components/item-row/ItemRow.svelte +43 -0
- package/dist/components/item-row/ItemRow.svelte.d.ts +4 -0
- package/dist/components/item-row/index.d.ts +2 -0
- package/dist/components/item-row/index.js +2 -0
- package/dist/components/item-row/setup.component.d.ts +43 -0
- package/dist/components/item-row/setup.component.js +10 -0
- package/dist/components/label/Label.svelte +38 -0
- package/dist/components/label/Label.svelte.d.ts +4 -0
- package/dist/components/label/base.component.d.ts +5 -0
- package/dist/components/label/base.component.js +1 -0
- package/dist/components/label/index.d.ts +3 -0
- package/dist/components/label/index.js +3 -0
- package/dist/components/label/setup.component.d.ts +17 -0
- package/dist/components/label/setup.component.js +10 -0
- package/dist/components/list-box/ListBox.svelte +87 -0
- package/dist/components/list-box/ListBox.svelte.d.ts +4 -0
- package/dist/components/list-box/base.component.d.ts +7 -0
- package/dist/components/list-box/base.component.js +1 -0
- package/dist/components/list-box/group/Group.svelte +27 -0
- package/dist/components/list-box/group/Group.svelte.d.ts +4 -0
- package/dist/components/list-box/group/base.component.d.ts +5 -0
- package/dist/components/list-box/group/base.component.js +1 -0
- package/dist/components/list-box/group/index.d.ts +3 -0
- package/dist/components/list-box/group/index.js +3 -0
- package/dist/components/list-box/group/setup.component.d.ts +17 -0
- package/dist/components/list-box/group/setup.component.js +11 -0
- package/dist/components/list-box/index.d.ts +8 -0
- package/dist/components/list-box/index.js +9 -0
- package/dist/components/list-box/item/Item.svelte +72 -0
- package/dist/components/list-box/item/Item.svelte.d.ts +4 -0
- package/dist/components/list-box/item/base.component.d.ts +7 -0
- package/dist/components/list-box/item/base.component.js +1 -0
- package/dist/components/list-box/item/index.d.ts +3 -0
- package/dist/components/list-box/item/index.js +3 -0
- package/dist/components/list-box/item/setup.component.d.ts +61 -0
- package/dist/components/list-box/item/setup.component.js +15 -0
- package/dist/components/list-box/setup.component.d.ts +47 -0
- package/dist/components/list-box/setup.component.js +22 -0
- package/dist/components/menu/Menu.svelte +54 -0
- package/dist/components/menu/Menu.svelte.d.ts +4 -0
- package/dist/components/menu/base.component.d.ts +6 -0
- package/dist/components/menu/base.component.js +1 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.svelte +67 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.svelte.d.ts +4 -0
- package/dist/components/menu/checkbox-item/base.component.d.ts +7 -0
- package/dist/components/menu/checkbox-item/base.component.js +1 -0
- package/dist/components/menu/checkbox-item/index.d.ts +3 -0
- package/dist/components/menu/checkbox-item/index.js +3 -0
- package/dist/components/menu/checkbox-item/setup.component.d.ts +53 -0
- package/dist/components/menu/checkbox-item/setup.component.js +15 -0
- package/dist/components/menu/group/Group.svelte +27 -0
- package/dist/components/menu/group/Group.svelte.d.ts +4 -0
- package/dist/components/menu/group/base.component.d.ts +5 -0
- package/dist/components/menu/group/base.component.js +1 -0
- package/dist/components/menu/group/index.d.ts +3 -0
- package/dist/components/menu/group/index.js +3 -0
- package/dist/components/menu/group/setup.component.d.ts +17 -0
- package/dist/components/menu/group/setup.component.js +11 -0
- package/dist/components/menu/index.d.ts +20 -0
- package/dist/components/menu/index.js +30 -0
- package/dist/components/menu/item/Item.svelte +48 -0
- package/dist/components/menu/item/Item.svelte.d.ts +4 -0
- package/dist/components/menu/item/base.component.d.ts +8 -0
- package/dist/components/menu/item/base.component.js +1 -0
- package/dist/components/menu/item/index.d.ts +3 -0
- package/dist/components/menu/item/index.js +3 -0
- package/dist/components/menu/item/setup.component.d.ts +53 -0
- package/dist/components/menu/item/setup.component.js +15 -0
- package/dist/components/menu/popover-item/PopoverItem.svelte +79 -0
- package/dist/components/menu/popover-item/PopoverItem.svelte.d.ts +4 -0
- package/dist/components/menu/popover-item/base.component.d.ts +7 -0
- package/dist/components/menu/popover-item/base.component.js +1 -0
- package/dist/components/menu/popover-item/index.d.ts +3 -0
- package/dist/components/menu/popover-item/index.js +3 -0
- package/dist/components/menu/popover-item/setup.component.d.ts +75 -0
- package/dist/components/menu/popover-item/setup.component.js +15 -0
- package/dist/components/menu/radio-group/RadioGroup.svelte +27 -0
- package/dist/components/menu/radio-group/RadioGroup.svelte.d.ts +4 -0
- package/dist/components/menu/radio-group/base.component.d.ts +5 -0
- package/dist/components/menu/radio-group/base.component.js +1 -0
- package/dist/components/menu/radio-group/index.d.ts +3 -0
- package/dist/components/menu/radio-group/index.js +3 -0
- package/dist/components/menu/radio-group/setup.component.d.ts +17 -0
- package/dist/components/menu/radio-group/setup.component.js +13 -0
- package/dist/components/menu/radio-item/RadioItem.svelte +64 -0
- package/dist/components/menu/radio-item/RadioItem.svelte.d.ts +4 -0
- package/dist/components/menu/radio-item/base.component.d.ts +8 -0
- package/dist/components/menu/radio-item/base.component.js +1 -0
- package/dist/components/menu/radio-item/index.d.ts +3 -0
- package/dist/components/menu/radio-item/index.js +3 -0
- package/dist/components/menu/radio-item/setup.component.d.ts +53 -0
- package/dist/components/menu/radio-item/setup.component.js +15 -0
- package/dist/components/menu/separator/Separator.svelte +22 -0
- package/dist/components/menu/separator/Separator.svelte.d.ts +4 -0
- package/dist/components/menu/separator/base.component.d.ts +5 -0
- package/dist/components/menu/separator/base.component.js +1 -0
- package/dist/components/menu/separator/index.d.ts +3 -0
- package/dist/components/menu/separator/index.js +3 -0
- package/dist/components/menu/separator/setup.component.d.ts +17 -0
- package/dist/components/menu/separator/setup.component.js +10 -0
- package/dist/components/menu/setup.component.d.ts +35 -0
- package/dist/components/menu/setup.component.js +19 -0
- package/dist/components/menu/submenu/Submenu.svelte +180 -0
- package/dist/components/menu/submenu/Submenu.svelte.d.ts +15 -0
- package/dist/components/menu/submenu/base.component.d.ts +7 -0
- package/dist/components/menu/submenu/base.component.js +1 -0
- package/dist/components/menu/submenu/index.d.ts +3 -0
- package/dist/components/menu/submenu/index.js +3 -0
- package/dist/components/menu/submenu/setup.component.d.ts +79 -0
- package/dist/components/menu/submenu/setup.component.js +21 -0
- package/dist/components/number-input/NumberInput.svelte +119 -0
- package/dist/components/number-input/NumberInput.svelte.d.ts +4 -0
- package/dist/components/number-input/base.component.d.ts +7 -0
- package/dist/components/number-input/base.component.js +1 -0
- package/dist/components/number-input/index.d.ts +3 -0
- package/dist/components/number-input/index.js +3 -0
- package/dist/components/number-input/setup.component.d.ts +51 -0
- package/dist/components/number-input/setup.component.js +11 -0
- package/dist/components/pagination/Pagination.svelte +80 -0
- package/dist/components/pagination/Pagination.svelte.d.ts +4 -0
- package/dist/components/pagination/base.component.d.ts +6 -0
- package/dist/components/pagination/base.component.js +1 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.js +3 -0
- package/dist/components/pagination/item/Item.svelte +44 -0
- package/dist/components/pagination/item/Item.svelte.d.ts +4 -0
- package/dist/components/pagination/item/base.component.d.ts +6 -0
- package/dist/components/pagination/item/base.component.js +1 -0
- package/dist/components/pagination/item/index.d.ts +3 -0
- package/dist/components/pagination/item/index.js +3 -0
- package/dist/components/pagination/item/setup.component.d.ts +23 -0
- package/dist/components/pagination/item/setup.component.js +15 -0
- package/dist/components/pagination/setup.component.d.ts +47 -0
- package/dist/components/pagination/setup.component.js +19 -0
- package/dist/components/popover/Popover.svelte +72 -0
- package/dist/components/popover/Popover.svelte.d.ts +4 -0
- package/dist/components/popover/base.component.d.ts +6 -0
- package/dist/components/popover/base.component.js +1 -0
- package/dist/components/popover/index.d.ts +3 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/popover/setup.component.d.ts +47 -0
- package/dist/components/popover/setup.component.js +10 -0
- package/dist/components/progress-linear/ProgressLinear.svelte +29 -0
- package/dist/components/progress-linear/ProgressLinear.svelte.d.ts +4 -0
- package/dist/components/progress-linear/base.component.d.ts +5 -0
- package/dist/components/progress-linear/base.component.js +1 -0
- package/dist/components/progress-linear/index.d.ts +3 -0
- package/dist/components/progress-linear/index.js +3 -0
- package/dist/components/progress-linear/setup.component.d.ts +33 -0
- package/dist/components/progress-linear/setup.component.js +10 -0
- package/dist/components/progress-spinner/ProgressSpinner.svelte +35 -0
- package/dist/components/progress-spinner/ProgressSpinner.svelte.d.ts +4 -0
- package/dist/components/progress-spinner/base.component.d.ts +5 -0
- package/dist/components/progress-spinner/base.component.js +1 -0
- package/dist/components/progress-spinner/index.d.ts +3 -0
- package/dist/components/progress-spinner/index.js +3 -0
- package/dist/components/progress-spinner/setup.component.d.ts +33 -0
- package/dist/components/progress-spinner/setup.component.js +10 -0
- package/dist/components/radio-group/RadioGroup.svelte +34 -0
- package/dist/components/radio-group/RadioGroup.svelte.d.ts +4 -0
- package/dist/components/radio-group/base.component.d.ts +5 -0
- package/dist/components/radio-group/base.component.js +1 -0
- package/dist/components/radio-group/index.d.ts +6 -0
- package/dist/components/radio-group/index.js +7 -0
- package/dist/components/radio-group/item/Item.svelte +51 -0
- package/dist/components/radio-group/item/Item.svelte.d.ts +4 -0
- package/dist/components/radio-group/item/base.component.d.ts +8 -0
- package/dist/components/radio-group/item/base.component.js +1 -0
- package/dist/components/radio-group/item/index.d.ts +3 -0
- package/dist/components/radio-group/item/index.js +3 -0
- package/dist/components/radio-group/item/setup.component.d.ts +49 -0
- package/dist/components/radio-group/item/setup.component.js +15 -0
- package/dist/components/radio-group/setup.component.d.ts +47 -0
- package/dist/components/radio-group/setup.component.js +19 -0
- package/dist/components/rating/Rating.svelte +57 -0
- package/dist/components/rating/Rating.svelte.d.ts +4 -0
- package/dist/components/rating/base.component.d.ts +6 -0
- package/dist/components/rating/base.component.js +1 -0
- package/dist/components/rating/index.d.ts +3 -0
- package/dist/components/rating/index.js +3 -0
- package/dist/components/rating/setup.component.d.ts +51 -0
- package/dist/components/rating/setup.component.js +11 -0
- package/dist/components/scroller/Scroller.svelte +67 -0
- package/dist/components/scroller/Scroller.svelte.d.ts +4 -0
- package/dist/components/scroller/base.component.d.ts +6 -0
- package/dist/components/scroller/base.component.js +1 -0
- package/dist/components/scroller/index.d.ts +3 -0
- package/dist/components/scroller/index.js +3 -0
- package/dist/components/scroller/setup.component.d.ts +43 -0
- package/dist/components/scroller/setup.component.js +10 -0
- package/dist/components/select/Select.svelte +143 -0
- package/dist/components/select/Select.svelte.d.ts +4 -0
- package/dist/components/select/base.component.d.ts +7 -0
- package/dist/components/select/base.component.js +1 -0
- package/dist/components/select/group/Group.svelte +27 -0
- package/dist/components/select/group/Group.svelte.d.ts +4 -0
- package/dist/components/select/group/base.component.d.ts +5 -0
- package/dist/components/select/group/base.component.js +1 -0
- package/dist/components/select/group/index.d.ts +3 -0
- package/dist/components/select/group/index.js +3 -0
- package/dist/components/select/group/setup.component.d.ts +17 -0
- package/dist/components/select/group/setup.component.js +11 -0
- package/dist/components/select/index.d.ts +8 -0
- package/dist/components/select/index.js +9 -0
- package/dist/components/select/item/Item.svelte +74 -0
- package/dist/components/select/item/Item.svelte.d.ts +4 -0
- package/dist/components/select/item/base.component.d.ts +7 -0
- package/dist/components/select/item/base.component.js +1 -0
- package/dist/components/select/item/index.d.ts +3 -0
- package/dist/components/select/item/index.js +3 -0
- package/dist/components/select/item/setup.component.d.ts +61 -0
- package/dist/components/select/item/setup.component.js +15 -0
- package/dist/components/select/setup.component.d.ts +85 -0
- package/dist/components/select/setup.component.js +21 -0
- package/dist/components/skeleton/Skeleton.svelte +32 -0
- package/dist/components/skeleton/Skeleton.svelte.d.ts +4 -0
- package/dist/components/skeleton/base.component.d.ts +5 -0
- package/dist/components/skeleton/base.component.js +1 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/index.js +3 -0
- package/dist/components/skeleton/setup.component.d.ts +21 -0
- package/dist/components/skeleton/setup.component.js +10 -0
- package/dist/components/slider/Slider.svelte +68 -0
- package/dist/components/slider/Slider.svelte.d.ts +4 -0
- package/dist/components/slider/base.component.d.ts +6 -0
- package/dist/components/slider/base.component.js +1 -0
- package/dist/components/slider/index.d.ts +3 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/slider/setup.component.d.ts +43 -0
- package/dist/components/slider/setup.component.js +11 -0
- package/dist/components/stylable/base.component.d.ts +5 -0
- package/dist/components/stylable/base.component.js +1 -0
- package/dist/components/stylable/index.d.ts +2 -0
- package/dist/components/stylable/index.js +2 -0
- package/dist/components/stylable/setup.component.d.ts +16 -0
- package/dist/components/stylable/setup.component.js +10 -0
- package/dist/components/switch/Switch.svelte +43 -0
- package/dist/components/switch/Switch.svelte.d.ts +4 -0
- package/dist/components/switch/base.component.d.ts +7 -0
- package/dist/components/switch/base.component.js +1 -0
- package/dist/components/switch/index.d.ts +3 -0
- package/dist/components/switch/index.js +3 -0
- package/dist/components/switch/setup.component.d.ts +51 -0
- package/dist/components/switch/setup.component.js +11 -0
- package/dist/components/table/Table.svelte +79 -0
- package/dist/components/table/Table.svelte.d.ts +4 -0
- package/dist/components/table/base.component.d.ts +6 -0
- package/dist/components/table/base.component.js +1 -0
- package/dist/components/table/column/Column.svelte +70 -0
- package/dist/components/table/column/Column.svelte.d.ts +4 -0
- package/dist/components/table/column/base.component.d.ts +6 -0
- package/dist/components/table/column/base.component.js +1 -0
- package/dist/components/table/column/index.d.ts +3 -0
- package/dist/components/table/column/index.js +3 -0
- package/dist/components/table/column/setup.component.d.ts +17 -0
- package/dist/components/table/column/setup.component.js +10 -0
- package/dist/components/table/index.d.ts +8 -0
- package/dist/components/table/index.js +9 -0
- package/dist/components/table/row/Row.svelte +74 -0
- package/dist/components/table/row/Row.svelte.d.ts +4 -0
- package/dist/components/table/row/base.component.d.ts +6 -0
- package/dist/components/table/row/base.component.js +1 -0
- package/dist/components/table/row/index.d.ts +3 -0
- package/dist/components/table/row/index.js +3 -0
- package/dist/components/table/row/setup.component.d.ts +23 -0
- package/dist/components/table/row/setup.component.js +15 -0
- package/dist/components/table/setup.component.d.ts +53 -0
- package/dist/components/table/setup.component.js +23 -0
- package/dist/components/tabs/Tabs.svelte +64 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +4 -0
- package/dist/components/tabs/base.component.d.ts +7 -0
- package/dist/components/tabs/base.component.js +1 -0
- package/dist/components/tabs/content/Content.svelte +21 -0
- package/dist/components/tabs/content/Content.svelte.d.ts +4 -0
- package/dist/components/tabs/content/base.component.d.ts +5 -0
- package/dist/components/tabs/content/base.component.js +1 -0
- package/dist/components/tabs/content/index.d.ts +3 -0
- package/dist/components/tabs/content/index.js +3 -0
- package/dist/components/tabs/content/setup.component.d.ts +29 -0
- package/dist/components/tabs/content/setup.component.js +15 -0
- package/dist/components/tabs/index.d.ts +8 -0
- package/dist/components/tabs/index.js +9 -0
- package/dist/components/tabs/item/Item.svelte +74 -0
- package/dist/components/tabs/item/Item.svelte.d.ts +4 -0
- package/dist/components/tabs/item/base.component.d.ts +7 -0
- package/dist/components/tabs/item/base.component.js +1 -0
- package/dist/components/tabs/item/index.d.ts +3 -0
- package/dist/components/tabs/item/index.js +3 -0
- package/dist/components/tabs/item/setup.component.d.ts +57 -0
- package/dist/components/tabs/item/setup.component.js +15 -0
- package/dist/components/tabs/setup.component.d.ts +47 -0
- package/dist/components/tabs/setup.component.js +21 -0
- package/dist/components/tags/Tags.svelte +49 -0
- package/dist/components/tags/Tags.svelte.d.ts +4 -0
- package/dist/components/tags/base.component.d.ts +6 -0
- package/dist/components/tags/base.component.js +1 -0
- package/dist/components/tags/index.d.ts +6 -0
- package/dist/components/tags/index.js +7 -0
- package/dist/components/tags/item/Item.svelte +82 -0
- package/dist/components/tags/item/Item.svelte.d.ts +4 -0
- package/dist/components/tags/item/base.component.d.ts +7 -0
- package/dist/components/tags/item/base.component.js +1 -0
- package/dist/components/tags/item/index.d.ts +3 -0
- package/dist/components/tags/item/index.js +3 -0
- package/dist/components/tags/item/setup.component.d.ts +49 -0
- package/dist/components/tags/item/setup.component.js +15 -0
- package/dist/components/tags/setup.component.d.ts +47 -0
- package/dist/components/tags/setup.component.js +19 -0
- package/dist/components/textable/base.component.d.ts +5 -0
- package/dist/components/textable/base.component.js +1 -0
- package/dist/components/textable/index.d.ts +2 -0
- package/dist/components/textable/index.js +2 -0
- package/dist/components/textable/setup.component.d.ts +42 -0
- package/dist/components/textable/setup.component.js +10 -0
- package/dist/components/textarea/Textarea.svelte +42 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +4 -0
- package/dist/components/textarea/base.component.d.ts +7 -0
- package/dist/components/textarea/base.component.js +1 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/textarea/index.js +3 -0
- package/dist/components/textarea/setup.component.d.ts +55 -0
- package/dist/components/textarea/setup.component.js +11 -0
- package/dist/components/toasts/Toasts.svelte +58 -0
- package/dist/components/toasts/Toasts.svelte.d.ts +4 -0
- package/dist/components/toasts/base.component.d.ts +6 -0
- package/dist/components/toasts/base.component.js +1 -0
- package/dist/components/toasts/index.d.ts +3 -0
- package/dist/components/toasts/index.js +3 -0
- package/dist/components/toasts/item/Item.svelte +94 -0
- package/dist/components/toasts/item/Item.svelte.d.ts +4 -0
- package/dist/components/toasts/item/base.component.d.ts +6 -0
- package/dist/components/toasts/item/base.component.js +1 -0
- package/dist/components/toasts/item/index.d.ts +3 -0
- package/dist/components/toasts/item/index.js +3 -0
- package/dist/components/toasts/item/setup.component.d.ts +21 -0
- package/dist/components/toasts/item/setup.component.js +15 -0
- package/dist/components/toasts/setup.component.d.ts +25 -0
- package/dist/components/toasts/setup.component.js +21 -0
- package/dist/components/tooltip/Tooltip.svelte +37 -0
- package/dist/components/tooltip/Tooltip.svelte.d.ts +4 -0
- package/dist/components/tooltip/base.component.d.ts +6 -0
- package/dist/components/tooltip/base.component.js +1 -0
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/components/tooltip/setup.component.d.ts +31 -0
- package/dist/components/tooltip/setup.component.js +10 -0
- package/dist/components/value-control/base.component.d.ts +6 -0
- package/dist/components/value-control/base.component.js +1 -0
- package/dist/components/value-control/index.d.ts +2 -0
- package/dist/components/value-control/index.js +2 -0
- package/dist/components/value-control/setup.component.d.ts +42 -0
- package/dist/components/value-control/setup.component.js +10 -0
- package/dist/components/virtual/Virtual.svelte +12 -0
- package/dist/components/virtual/Virtual.svelte.d.ts +4 -0
- package/dist/components/virtual/base.component.d.ts +6 -0
- package/dist/components/virtual/base.component.js +1 -0
- package/dist/components/virtual/index.d.ts +3 -0
- package/dist/components/virtual/index.js +3 -0
- package/dist/components/virtual/setup.component.d.ts +10 -0
- package/dist/components/virtual/setup.component.js +11 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +5 -0
- package/dist/types.d.ts +41 -0
- package/dist/types.js +1 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuri Soldatov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,220 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @soxa-ui/svelte
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The Svelte adapter: Soxa UI components rendered on the headless models of the core.**
|
|
4
|
+
|
|
5
|
+
Part of [Soxa UI](https://github.com/youra-h/soxa-ui) — UI components with the logic written once: a
|
|
6
|
+
framework-agnostic core and thin adapters that render it in Vue, React, Angular, Svelte, Solid and
|
|
7
|
+
Web Components.
|
|
8
|
+
|
|
9
|
+
The adapter is wiring, not behavior: it connects a core model to Svelte's runes and renders the
|
|
10
|
+
markup — BEM classes `so-*` and `data-*` state attributes. Props, events and slots come from the
|
|
11
|
+
component descriptor, so they match the other five adapters; only the spelling is Svelte's: slots
|
|
12
|
+
are snippets, events arrive as callback props (`element:ready` → `onElementReady`), and the default
|
|
13
|
+
slot is `children`.
|
|
14
|
+
|
|
15
|
+
> **Status:** the Svelte adapter is in progress — Button, Icon, Label, Frame, ProgressSpinner,
|
|
16
|
+
> Skeleton, the fields Input, NumberInput (a number in the locale's format with − and + step
|
|
17
|
+
> buttons; the form gets the number), Textarea (multi-line, growing with its text, with a character
|
|
18
|
+
> counter), CheckBox and Switch, the form field `Field` (label, helper and error linked to the
|
|
19
|
+
> control inside it), the collections ListBox, Tabs, Accordion, RadioGroup and Tags
|
|
20
|
+
> (`<ListBox.Item>`, `<Tabs.Item>` with `<Tabs.Content>`, `<Accordion.Item>`,
|
|
21
|
+
> `<RadioGroup.Item>`, `<Tags.Item>` or `items`; tags close, select by mode and either wrap or
|
|
22
|
+
> scroll), Select (a combobox: `<Select.Item>` and `<Select.Group>` or `items`, `editable` with
|
|
23
|
+
> search or filter, tags in the field in `multiple`), Table (columns and rows as data — `columns`,
|
|
24
|
+
> `items` — with sorting, row selection, column resizing and reordering), the `Virtual` window for
|
|
25
|
+
> long lists (`<Virtual><ListBox items={…} /></Virtual>`, the same with `Select` and `Table`), the
|
|
26
|
+
> `DragAndDrop` wrapper that lets users reorder the items of Tabs, ListBox and Accordion by
|
|
27
|
+
> dragging (`<DragAndDrop onMove={…}><ListBox items={…} /></DragAndDrop>`, `onMoveBefore` can
|
|
28
|
+
> cancel),
|
|
29
|
+
> Slider, Rating, ProgressLinear, Scroller, Pagination, the dates — DateInput (a date or a date
|
|
30
|
+
> and time typed in parts in the locale's format, selected and copied as a whole), Calendar (month
|
|
31
|
+
> grids with a month and year picker; a day is `Calendar.Item`, its content — the `item` snippet)
|
|
32
|
+
> and DatePicker (a date field and a calendar in a panel: a single date or a range, with an optional
|
|
33
|
+
> confirmation) — and the overlays — Popover (a panel at a trigger with any content), Tooltip,
|
|
34
|
+
> Menu (an action menu at a button or on right click:
|
|
35
|
+
> `<Menu.Item>`, `<Menu.CheckboxItem>`, `<Menu.RadioGroup>` with `<Menu.RadioItem>`,
|
|
36
|
+
> `<Menu.Group>`, `<Menu.Separator>`, submenus `<Menu.Submenu>` and an item with its own panel
|
|
37
|
+
> `<Menu.PopoverItem>`, or `items` — an item with nested `items` is a submenu), Dialog (a modal
|
|
38
|
+
> window), Drawer (a panel that slides in at an edge) and Toasts (notifications shown from code
|
|
39
|
+
> with `useToasts()`) — are ported, the rest of the set is on its way. Icon renders the `tag` it is
|
|
40
|
+
> given: an element name, a Svelte component, or `roleIcon(role)` — the icon of that role from the
|
|
41
|
+
> registered icon pack. Frame teleports its panel into `target` (`body` by default) on the client;
|
|
42
|
+
> with `contained` it stays in place, on the server too. Dialog, Drawer, the region of Toasts, the
|
|
43
|
+
> list panel of Select and the panels of Menu are teleported the same way, and `ref` of Dialog and
|
|
44
|
+
> Drawer is the panel, of Toasts — the region. The server renders a Select from `items` with the
|
|
45
|
+
> text of the selected option (with tags in `multiple`); options given as markup live in the panel
|
|
46
|
+
> and join the collection on the client. The server renders a Menu as its trigger: the panel and
|
|
47
|
+
> its items appear on the client. The server renders a DatePicker as its field with the calendar
|
|
48
|
+
> button: the panel with the calendar appears on the client; a Calendar on its own the server
|
|
49
|
+
> renders in full, its month and year picker in place and hidden. The date field, the calendar and
|
|
50
|
+
> the DatePicker take their language from `LocaleProvider`: the order of parts, the first day of
|
|
51
|
+
> the week, the month names. A field — and Select — gives its class and style to the root and
|
|
52
|
+
> every other attribute to its `<input>` (a textarea — to its `<textarea>`); an item of a
|
|
53
|
+
> collection — a menu item too — gives them to its row; a list box and tabs give them to the list
|
|
54
|
+
> itself, `[role=listbox]` or `[role=tablist]`; a table gives them to the `<table>` itself, and its
|
|
55
|
+
> class, style and `ref` to the scroll viewport around it; a menu, like a popover, gives them to
|
|
56
|
+
> its root around the trigger. `Label` names the control it wraps; `LocaleProvider` gives a subtree
|
|
57
|
+
> its language and library strings, such as the name of the clear button of `Input`. See
|
|
58
|
+
> [the adapter table](https://github.com/youra-h/soxa-ui#components).
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install @soxa-ui/svelte @soxa-ui/setup @soxa-ui/theme-oren @soxa-ui/icons-material
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Install `@soxa-ui/setup` as a direct dependency for the `useIcons` and `useTheme` imports below.
|
|
67
|
+
Keep it on the same version as `@soxa-ui/svelte`.
|
|
68
|
+
|
|
69
|
+
Svelte `^5.55.10` is a peer dependency. The package ships its `.svelte` components uncompiled, so
|
|
70
|
+
your app's bundler compiles them with its Svelte plugin (for Vite, `@sveltejs/vite-plugin-svelte`).
|
|
71
|
+
A theme and an icon pack are separate packages — pick the ones you want.
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```svelte
|
|
76
|
+
<script lang="ts">
|
|
77
|
+
import { Button } from '@soxa-ui/svelte'
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<Button text="Save" onActionPress={() => console.log('pressed')} />
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The same component can be driven from code — pass a core instance as `ctrl`, and both sides see the
|
|
84
|
+
same state and events:
|
|
85
|
+
|
|
86
|
+
```svelte
|
|
87
|
+
<script lang="ts">
|
|
88
|
+
import { TButton } from '@soxa-ui/core'
|
|
89
|
+
import { Button } from '@soxa-ui/svelte'
|
|
90
|
+
|
|
91
|
+
const btn = new TButton({ text: 'Save' })
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<Button ctrl={btn} onActionPress={() => (btn.disabled = true)} />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
An icon from the registered pack — the root of `Icon` is an `<svg>` of that role:
|
|
98
|
+
|
|
99
|
+
```svelte
|
|
100
|
+
<script lang="ts">
|
|
101
|
+
import { Icon, roleIcon } from '@soxa-ui/svelte'
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<Icon tag={roleIcon('close')} aria_label="Close" />
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A check box has no text of its own — its visible name is the `Label` around it:
|
|
108
|
+
|
|
109
|
+
```svelte
|
|
110
|
+
<script lang="ts">
|
|
111
|
+
import { CheckBox, Label } from '@soxa-ui/svelte'
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<Label text="I agree">
|
|
115
|
+
<CheckBox onChangeValue={({ newValue }) => console.log(newValue)} />
|
|
116
|
+
</Label>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
A collection takes its items as markup parts or as data (`items`). Tabs keep their panels in the
|
|
120
|
+
`content` snippet, next to the list of tabs rather than inside it:
|
|
121
|
+
|
|
122
|
+
```svelte
|
|
123
|
+
<script lang="ts">
|
|
124
|
+
import { Tabs } from '@soxa-ui/svelte'
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<Tabs aria_label="Settings">
|
|
128
|
+
<Tabs.Item value="general" text="General" active />
|
|
129
|
+
<Tabs.Item value="privacy" text="Privacy" />
|
|
130
|
+
{#snippet content()}
|
|
131
|
+
<Tabs.Content value="general">General settings</Tabs.Content>
|
|
132
|
+
<Tabs.Content value="privacy">Privacy settings</Tabs.Content>
|
|
133
|
+
{/snippet}
|
|
134
|
+
</Tabs>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Items given as data are drawn by the owner, and their slots are the owner's `item-<slot>` snippets,
|
|
138
|
+
with the item in the scope. A snippet is opaque: an item cannot tell that it drew nothing, so a
|
|
139
|
+
snippet given to the owner replaces the item's own content for every item — draw the default
|
|
140
|
+
yourself where you need it.
|
|
141
|
+
|
|
142
|
+
A popover and a tooltip take their trigger as the `trigger` snippet: the trigger is the element of
|
|
143
|
+
the application, so the link to the panel (`aria-expanded`, `aria-controls`) and the pressed look
|
|
144
|
+
come to it in the scope:
|
|
145
|
+
|
|
146
|
+
```svelte
|
|
147
|
+
<script lang="ts">
|
|
148
|
+
import { Button, Popover } from '@soxa-ui/svelte'
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<Popover aria_label="Filters">
|
|
152
|
+
{#snippet trigger({ triggerAria, triggerDataset })}
|
|
153
|
+
<Button text="Filters" {...triggerAria} {...triggerDataset} />
|
|
154
|
+
{/snippet}
|
|
155
|
+
Any content: text, fields, buttons
|
|
156
|
+
</Popover>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Toasts are shown from code. The manager wraps the application, and any component under it takes
|
|
160
|
+
the API while it initializes; your own content of a toast is a Svelte component with a `toast`
|
|
161
|
+
prop:
|
|
162
|
+
|
|
163
|
+
```svelte
|
|
164
|
+
<!-- App.svelte -->
|
|
165
|
+
<Toasts>
|
|
166
|
+
<Page />
|
|
167
|
+
</Toasts>
|
|
168
|
+
|
|
169
|
+
<!-- Page.svelte -->
|
|
170
|
+
<script lang="ts">
|
|
171
|
+
import { Button, useToasts } from '@soxa-ui/svelte'
|
|
172
|
+
import Undo from './Undo.svelte'
|
|
173
|
+
|
|
174
|
+
const { show } = useToasts()
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<Button text="Delete" onclick={() => show({ text: 'Deleted', render: Undo })} />
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The application plugs in a theme and an icon pack once, in its entry point:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import { useIcons, useTheme } from '@soxa-ui/setup'
|
|
184
|
+
import * as material from '@soxa-ui/icons-material'
|
|
185
|
+
import oren from '@soxa-ui/theme-oren/setup'
|
|
186
|
+
|
|
187
|
+
import '@soxa-ui/theme-oren'
|
|
188
|
+
|
|
189
|
+
useIcons(material)
|
|
190
|
+
useTheme(oren)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`@soxa-ui/theme-oren` is the stylesheet of every component. To take only the components your
|
|
194
|
+
pages use, import their stylesheets instead — `@soxa-ui/theme-oren/button.css`,
|
|
195
|
+
`@soxa-ui/theme-oren/select.css`, one per component, each with the shared part of the theme
|
|
196
|
+
(the theme's README, [Only the components you use](https://github.com/youra-h/soxa-ui/tree/main/packages/themes/oren#only-the-components-you-use)).
|
|
197
|
+
|
|
198
|
+
## Documentation
|
|
199
|
+
|
|
200
|
+
- [Soxa UI README](https://github.com/youra-h/soxa-ui#readme) — the component set and what each
|
|
201
|
+
adapter implements so far.
|
|
202
|
+
- [Architecture overview](https://github.com/youra-h/soxa-ui/blob/main/docs/architecture.md) —
|
|
203
|
+
layers, descriptors, plugins, collections, adapters.
|
|
204
|
+
|
|
205
|
+
## Public API
|
|
206
|
+
|
|
207
|
+
The package entry exports application components, their consumer types, the locale provider,
|
|
208
|
+
and the supported icon and toast helpers. Component props, slots, events, refs and core models
|
|
209
|
+
passed through `ctrl` remain the supported ways to customize the UI. Models come from
|
|
210
|
+
`@soxa-ui/core`; theme, icon and external-plugin registration comes from `@soxa-ui/setup`.
|
|
211
|
+
|
|
212
|
+
Assembly functions, adapter profiles, bindings, generated metadata and rendering templates
|
|
213
|
+
are private implementation details. They are no longer exported from the package entry, and
|
|
214
|
+
there is no public `/internal` entry. Code that imported them must use the component contract
|
|
215
|
+
instead. Building a new adapter component from Soxa's assembly helpers is not a supported
|
|
216
|
+
public SDK.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
[MIT](https://github.com/youra-h/soxa-ui/blob/main/LICENSE)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getIcon } from '@soxa-ui/setup'
|
|
3
|
+
import type { Attachment } from 'svelte/attachments'
|
|
4
|
+
import type { TRoleIcon } from './icon'
|
|
5
|
+
import type { TRootNodeAttributes } from './root'
|
|
6
|
+
|
|
7
|
+
type TRoleIconProps = {
|
|
8
|
+
icon: TRoleIcon
|
|
9
|
+
/** Атрибуты корня `Icon`, разложенные на узел. */
|
|
10
|
+
attributes: TRootNodeAttributes
|
|
11
|
+
/** Привязка корня; нет её — `<svg>` часть компонента (отметка CheckBox). */
|
|
12
|
+
attach?: Attachment<Element>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { icon, attributes, attach }: TRoleIconProps = $props()
|
|
16
|
+
|
|
17
|
+
// Из реестра на отрисовке: `useIcons()` может прийти после `roleIcon`
|
|
18
|
+
const source = $derived(getIcon(icon.role))
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<!--
|
|
22
|
+
`<svg>` иконки по роли: корень `Icon` с меткой роли в `tag` и отметка
|
|
23
|
+
CheckBox. `body` — доверенный источник из пакета иконок, поэтому `{@html}`.
|
|
24
|
+
-->
|
|
25
|
+
<svg {...attributes} viewBox={source.viewBox} {@attach attach}>{@html source.body}</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Attachment } from 'svelte/attachments';
|
|
2
|
+
import type { TRoleIcon } from './icon';
|
|
3
|
+
import type { TRootNodeAttributes } from './root';
|
|
4
|
+
type TRoleIconProps = {
|
|
5
|
+
icon: TRoleIcon;
|
|
6
|
+
/** Атрибуты корня `Icon`, разложенные на узел. */
|
|
7
|
+
attributes: TRootNodeAttributes;
|
|
8
|
+
/** Привязка корня; нет её — `<svg>` часть компонента (отметка CheckBox). */
|
|
9
|
+
attach?: Attachment<Element>;
|
|
10
|
+
};
|
|
11
|
+
declare const RoleIcon: import("svelte").Component<TRoleIconProps, {}, "">;
|
|
12
|
+
type RoleIcon = ReturnType<typeof RoleIcon>;
|
|
13
|
+
export default RoleIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action of a part on a click (activate a tab, choose an option, close a
|
|
3
|
+
* panel) — a native listener on the part's node, given as its attachment
|
|
4
|
+
* (`{@attach}`). AGENTS.md (Svelte), «Клик части».
|
|
5
|
+
*/
|
|
6
|
+
import type { Attachment } from 'svelte/attachments';
|
|
7
|
+
export declare function clickAction(action: (event: Event) => void): Attachment<Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The action of a part on a click (activate a tab, choose an option, close a
|
|
3
|
+
* panel) — a native listener on the part's node, given as its attachment
|
|
4
|
+
* (`{@attach}`). AGENTS.md (Svelte), «Клик части».
|
|
5
|
+
*/
|
|
6
|
+
export function clickAction(action) {
|
|
7
|
+
return (node) => {
|
|
8
|
+
node.addEventListener('click', action);
|
|
9
|
+
return () => node.removeEventListener('click', action);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IAdapterContext, IAdapterContextConfig, IAdapterContextOptions, IComponentDescriptor, IPluginsContract, TContextContract } from '@soxa-ui/setup';
|
|
2
|
+
/** Опции `createAdapterContext`, но id монтирования обязателен: забытый ловят типы. */
|
|
3
|
+
export type TSvelteAdapterContextOptions<TInstance extends object> = IAdapterContextOptions<TInstance> & {
|
|
4
|
+
mountId: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Сборка компонента Svelte, как `createVueAdapterContext` у Vue: id
|
|
8
|
+
* монтирования — `$props.id()` компонента, локаль — ближайшего
|
|
9
|
+
* `LocaleProvider`. Зовётся при инициализации компонента.
|
|
10
|
+
* AGENTS.md (Svelte), «Сборка компонента».
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSvelteAdapterContext<TInstance extends object, TPlugins extends IPluginsContract>(descriptor: IComponentDescriptor<TContextContract<TInstance, TPlugins>>, options: TSvelteAdapterContextOptions<TInstance>, config?: IAdapterContextConfig): IAdapterContext<TContextContract<TInstance, TPlugins>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createAdapterContext } from '@soxa-ui/setup';
|
|
2
|
+
import { nearestLocale } from '../locale/context';
|
|
3
|
+
/**
|
|
4
|
+
* Сборка компонента Svelte, как `createVueAdapterContext` у Vue: id
|
|
5
|
+
* монтирования — `$props.id()` компонента, локаль — ближайшего
|
|
6
|
+
* `LocaleProvider`. Зовётся при инициализации компонента.
|
|
7
|
+
* AGENTS.md (Svelte), «Сборка компонента».
|
|
8
|
+
*/
|
|
9
|
+
export function createSvelteAdapterContext(descriptor, options, config) {
|
|
10
|
+
return createAdapterContext(descriptor, { ...options, locale: options.locale ?? nearestLocale() }, config);
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Своё, затем обработчик потребителя — на одном событии разметки: обработчик
|
|
3
|
+
* события в Svelte — атрибут, и потребительский из спреда занял бы место
|
|
4
|
+
* своего. Как `chainHandler` у Solid.
|
|
5
|
+
*/
|
|
6
|
+
export declare function chainHandler<TEvent>(own: (event: TEvent) => void, consumer: ((event: TEvent) => unknown) | null | undefined): (event: TEvent) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Своё, затем обработчик потребителя — на одном событии разметки: обработчик
|
|
3
|
+
* события в Svelte — атрибут, и потребительский из спреда занял бы место
|
|
4
|
+
* своего. Как `chainHandler` у Solid.
|
|
5
|
+
*/
|
|
6
|
+
export function chainHandler(own, consumer) {
|
|
7
|
+
return (event) => {
|
|
8
|
+
own(event);
|
|
9
|
+
consumer?.(event);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Иконка по роли — тег для `Icon`, как `roleIcon` у Vue. Компонент на лету
|
|
3
|
+
* Svelte не соберёт, поэтому это метка: по ней `Dynamic` рисует `RoleIcon`.
|
|
4
|
+
* Метка одна на роль — повторный вызов не меняет свойство `tag`. Ключа `tag`
|
|
5
|
+
* у неё нет: по нему `TIcon.getInstance` отличает пропсы иконки от тега.
|
|
6
|
+
*/
|
|
7
|
+
export declare class TRoleIcon {
|
|
8
|
+
readonly role: string;
|
|
9
|
+
constructor(role: string);
|
|
10
|
+
}
|
|
11
|
+
export declare function roleIcon(role: string): TRoleIcon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Иконка по роли — тег для `Icon`, как `roleIcon` у Vue. Компонент на лету
|
|
3
|
+
* Svelte не соберёт, поэтому это метка: по ней `Dynamic` рисует `RoleIcon`.
|
|
4
|
+
* Метка одна на роль — повторный вызов не меняет свойство `tag`. Ключа `tag`
|
|
5
|
+
* у неё нет: по нему `TIcon.getInstance` отличает пропсы иконки от тега.
|
|
6
|
+
*/
|
|
7
|
+
export class TRoleIcon {
|
|
8
|
+
role;
|
|
9
|
+
constructor(role) {
|
|
10
|
+
this.role = role;
|
|
11
|
+
Object.freeze(this);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const marks = new Map();
|
|
15
|
+
export function roleIcon(role) {
|
|
16
|
+
const known = marks.get(role);
|
|
17
|
+
if (known)
|
|
18
|
+
return known;
|
|
19
|
+
const mark = new TRoleIcon(role);
|
|
20
|
+
marks.set(role, mark);
|
|
21
|
+
return mark;
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SvelteProfile } from './profile';
|
|
2
|
+
export { SvelteNaming } from './naming';
|
|
3
|
+
export { createSvelteAdapterContext, type TSvelteAdapterContextOptions, } from './createSvelteAdapterContext';
|
|
4
|
+
export { toControlAttrs, toRootForward, toRootLayout, toRootProps, toShownStyleText, toStyleText, toWrappedRootProps, type TRootAttributes, type TRootForward, type TRootLayout, type TRootNodeAttributes, type TRootState, type TRootStyle, type TRootStyleLayers, type TStyleProperties, type TWrappedRootAttributes, } from './root';
|
|
5
|
+
export { chainHandler } from './handlers';
|
|
6
|
+
export { clickAction } from './click-action';
|
|
7
|
+
export { roleIcon, TRoleIcon } from './icon';
|
|
8
|
+
export { default as RoleIcon } from './RoleIcon.svelte';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SvelteProfile } from './profile';
|
|
2
|
+
export { SvelteNaming } from './naming';
|
|
3
|
+
export { createSvelteAdapterContext, } from './createSvelteAdapterContext';
|
|
4
|
+
export { toControlAttrs, toRootForward, toRootLayout, toRootProps, toShownStyleText, toStyleText, toWrappedRootProps, } from './root';
|
|
5
|
+
export { chainHandler } from './handlers';
|
|
6
|
+
export { clickAction } from './click-action';
|
|
7
|
+
export { roleIcon, TRoleIcon } from './icon';
|
|
8
|
+
export { default as RoleIcon } from './RoleIcon.svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Имена поверхности: события — колбэк-пропы, как у React (`element:ready` → `onElementReady`). */
|
|
2
|
+
import { underscorePropNaming, callbackEventNaming } from '@soxa-ui/setup';
|
|
3
|
+
export const SvelteNaming = {
|
|
4
|
+
prop: underscorePropNaming,
|
|
5
|
+
event: callbackEventNaming,
|
|
6
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Раскладка корня — класс, стиль и атрибуты, которые во Vue сливает шаблон,
|
|
3
|
+
* а здесь одна склейка на все компоненты, как `toRootProps` у React.
|
|
4
|
+
* AGENTS.md (Svelte), «Атрибуты корня».
|
|
5
|
+
*/
|
|
6
|
+
import type { ClassValue } from 'svelte/elements';
|
|
7
|
+
import type { TAttributesMap } from '@soxa-ui/core';
|
|
8
|
+
/** Стиль, как его отдают плагины и ядро: имена — как в CSS (`z-index`, `--*`). */
|
|
9
|
+
export type TRootStyle = Readonly<Record<string, string | number>>;
|
|
10
|
+
/** Свойства стиля: имена — как в CSS, значения — строкой, пустых значений нет. */
|
|
11
|
+
export type TStyleProperties = Readonly<Record<string, string>>;
|
|
12
|
+
/** Стиль корня по слоям снизу вверх: из одноимённых свойств действует верхнее. */
|
|
13
|
+
export type TRootStyleLayers = {
|
|
14
|
+
/** Раскладка, стиль-выход компонента, место элемента коллекции. */
|
|
15
|
+
readonly below: TStyleProperties;
|
|
16
|
+
/** Стиль потребителя строкой, как он её написал. */
|
|
17
|
+
readonly forward: string | undefined;
|
|
18
|
+
/** `display: none` скрытого корня. */
|
|
19
|
+
readonly above: TStyleProperties;
|
|
20
|
+
};
|
|
21
|
+
/** Что корню нужно из состояния компонента. */
|
|
22
|
+
export type TRootState = {
|
|
23
|
+
readonly classes?: readonly string[];
|
|
24
|
+
readonly layout_styles?: TRootStyle;
|
|
25
|
+
/** Место элемента коллекции (`order` фасада); нет — своего места нет. */
|
|
26
|
+
readonly order?: number;
|
|
27
|
+
/** `false` прячет корень; нет ключа — корень виден всегда (Skeleton). */
|
|
28
|
+
readonly visible?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Класс и стиль от потребителя. */
|
|
31
|
+
export type TRootForward = {
|
|
32
|
+
readonly class?: ClassValue | null;
|
|
33
|
+
readonly style?: string | null;
|
|
34
|
+
};
|
|
35
|
+
export type TRootLayout = {
|
|
36
|
+
class: ClassValue;
|
|
37
|
+
style: TRootStyleLayers;
|
|
38
|
+
};
|
|
39
|
+
/** Атрибуты корня целиком: наборы ядра, атрибуты потребителя и раскладка. */
|
|
40
|
+
export type TRootAttributes = Record<string, unknown> & TRootLayout;
|
|
41
|
+
/** Обёртка корня и сам корень внутри неё — см. `toWrappedRootProps`. */
|
|
42
|
+
export type TWrappedRootAttributes = {
|
|
43
|
+
readonly wrapper: TRootAttributes;
|
|
44
|
+
readonly root: TRootAttributes;
|
|
45
|
+
};
|
|
46
|
+
/** Атрибуты на узле корня; `style` строкой — только в серверной разметке. */
|
|
47
|
+
export type TRootNodeAttributes = Record<string, unknown> & {
|
|
48
|
+
class: ClassValue;
|
|
49
|
+
style?: string;
|
|
50
|
+
};
|
|
51
|
+
/** `style` — стиль-выход компонента, его имя называет разметка (`fractionStyle`). */
|
|
52
|
+
export declare function toRootLayout(state: TRootState, forward: TRootForward, style?: TRootStyle): TRootLayout;
|
|
53
|
+
/** Стиль корня строкой атрибута — для серверной разметки. */
|
|
54
|
+
export declare function toStyleAttribute(style: TRootStyleLayers): string | undefined;
|
|
55
|
+
/** Стиль узла, который целиком пишет ядро (распорка окна ListBox), — строкой. */
|
|
56
|
+
export declare function toStyleText(styles: TRootStyle | undefined): string | undefined;
|
|
57
|
+
/** То же, и `display: none`, пока компонент скрыт, — подложка окна и панели. */
|
|
58
|
+
export declare function toShownStyleText(styles: TRootStyle | undefined, shown: boolean): string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Атрибуты корня: наборы ядра `sets` в порядке Vue, поверх них атрибуты
|
|
61
|
+
* потребителя `forward` (и его attachment-ы), класс и стиль — `toRootLayout`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function toRootProps(state: TRootState, sets: readonly (TAttributesMap | undefined)[], forward: TRootForward, style?: TRootStyle): TRootAttributes;
|
|
64
|
+
/**
|
|
65
|
+
* Корень внутри обёртки (окно таблицы вокруг `table`): обёртке — её класс,
|
|
66
|
+
* класс и стиль потребителя и скрытие, корню — остальное поверх его наборов.
|
|
67
|
+
* Состояние корню — поимённо: остаток деструктуризации прочёл бы все руны.
|
|
68
|
+
*/
|
|
69
|
+
export declare function toWrappedRootProps(state: TRootState, sets: readonly (TAttributesMap | undefined)[], forward: TRootForward, wrapper: string, style?: TRootStyle): TWrappedRootAttributes;
|
|
70
|
+
/** Класс и стиль потребителя — корню поля и обёртке таблицы. */
|
|
71
|
+
export declare function toRootForward(forward: TRootForward): TRootForward;
|
|
72
|
+
/**
|
|
73
|
+
* Остальное от потребителя — вложенному контролу: `<input>` поля, строке
|
|
74
|
+
* элемента, узлу списка. Аналог `useSplitAttrs` у Vue. Тип — атрибуты
|
|
75
|
+
* компонента, а не все пропсы: остаток сверяется с атрибутами контрола.
|
|
76
|
+
*/
|
|
77
|
+
export declare function toControlAttrs<TAttributes extends TRootForward>(forward: Partial<TAttributes>): Omit<Partial<TAttributes>, keyof TRootForward>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Раскладка корня — класс, стиль и атрибуты, которые во Vue сливает шаблон,
|
|
3
|
+
* а здесь одна склейка на все компоненты, как `toRootProps` у React.
|
|
4
|
+
* AGENTS.md (Svelte), «Атрибуты корня».
|
|
5
|
+
*/
|
|
6
|
+
const HIDDEN = { display: 'none' };
|
|
7
|
+
const NONE = {};
|
|
8
|
+
/** Значение — строкой; пустое свойства не задаёт. */
|
|
9
|
+
function toProperties(styles) {
|
|
10
|
+
const properties = {};
|
|
11
|
+
for (const [name, value] of Object.entries(styles ?? {})) {
|
|
12
|
+
if (value !== '')
|
|
13
|
+
properties[name] = String(value);
|
|
14
|
+
}
|
|
15
|
+
return properties;
|
|
16
|
+
}
|
|
17
|
+
function toDeclarations(properties) {
|
|
18
|
+
return Object.entries(properties).map(([name, value]) => `${name}: ${value}`);
|
|
19
|
+
}
|
|
20
|
+
/** Нет объявлений — `undefined`: атрибута `style` нет. */
|
|
21
|
+
function joinDeclarations(declarations) {
|
|
22
|
+
return declarations.length > 0 ? declarations.join('; ') : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** `style` — стиль-выход компонента, его имя называет разметка (`fractionStyle`). */
|
|
25
|
+
export function toRootLayout(state, forward, style) {
|
|
26
|
+
return {
|
|
27
|
+
class: [...(state.classes ?? []), forward.class],
|
|
28
|
+
style: {
|
|
29
|
+
below: {
|
|
30
|
+
...toProperties(state.layout_styles),
|
|
31
|
+
...toProperties(style),
|
|
32
|
+
...toProperties(state.order !== undefined ? { order: state.order } : undefined),
|
|
33
|
+
},
|
|
34
|
+
forward: forward.style || undefined,
|
|
35
|
+
above: state.visible === false ? HIDDEN : NONE,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Стиль корня строкой атрибута — для серверной разметки. */
|
|
40
|
+
export function toStyleAttribute(style) {
|
|
41
|
+
return joinDeclarations([
|
|
42
|
+
...toDeclarations(style.below),
|
|
43
|
+
...(style.forward ? [style.forward] : []),
|
|
44
|
+
...toDeclarations(style.above),
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
/** Стиль узла, который целиком пишет ядро (распорка окна ListBox), — строкой. */
|
|
48
|
+
export function toStyleText(styles) {
|
|
49
|
+
return joinDeclarations(toDeclarations(toProperties(styles)));
|
|
50
|
+
}
|
|
51
|
+
/** То же, и `display: none`, пока компонент скрыт, — подложка окна и панели. */
|
|
52
|
+
export function toShownStyleText(styles, shown) {
|
|
53
|
+
return toStyleText({ ...styles, ...(shown ? NONE : HIDDEN) });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Атрибуты корня: наборы ядра `sets` в порядке Vue, поверх них атрибуты
|
|
57
|
+
* потребителя `forward` (и его attachment-ы), класс и стиль — `toRootLayout`.
|
|
58
|
+
*/
|
|
59
|
+
export function toRootProps(state, sets, forward, style) {
|
|
60
|
+
const attributes = {};
|
|
61
|
+
for (const set of sets)
|
|
62
|
+
Object.assign(attributes, set);
|
|
63
|
+
return { ...attributes, ...forward, ...toRootLayout(state, forward, style) };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Корень внутри обёртки (окно таблицы вокруг `table`): обёртке — её класс,
|
|
67
|
+
* класс и стиль потребителя и скрытие, корню — остальное поверх его наборов.
|
|
68
|
+
* Состояние корню — поимённо: остаток деструктуризации прочёл бы все руны.
|
|
69
|
+
*/
|
|
70
|
+
export function toWrappedRootProps(state, sets, forward, wrapper, style) {
|
|
71
|
+
return {
|
|
72
|
+
wrapper: toRootProps({ classes: [wrapper], visible: state.visible }, [], toRootForward(forward)),
|
|
73
|
+
root: toRootProps({ classes: state.classes, layout_styles: state.layout_styles, order: state.order }, sets, toControlAttrs(forward), style),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Класс и стиль потребителя — корню поля и обёртке таблицы. */
|
|
77
|
+
export function toRootForward(forward) {
|
|
78
|
+
return { class: forward.class, style: forward.style };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Остальное от потребителя — вложенному контролу: `<input>` поля, строке
|
|
82
|
+
* элемента, узлу списка. Аналог `useSplitAttrs` у Vue. Тип — атрибуты
|
|
83
|
+
* компонента, а не все пропсы: остаток сверяется с атрибутами контрола.
|
|
84
|
+
*/
|
|
85
|
+
export function toControlAttrs(forward) {
|
|
86
|
+
const { class: _class, style: _style, ...control } = forward;
|
|
87
|
+
return control;
|
|
88
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Лифт одного ключа поверх контекста Svelte. `up()` отдаёт значение предка и
|
|
3
|
+
* после своего `down()` того же ключа: его до первой записи помнит слой
|
|
4
|
+
* сборки — общий для лифтов одной `useElevator()`. AGENTS.md (Svelte),
|
|
5
|
+
* «Контекст: лифт и локаль».
|
|
6
|
+
*/
|
|
7
|
+
import { TElevator } from '@soxa-ui/setup';
|
|
8
|
+
export declare class TSvelteElevator<T = any> extends TElevator<T> {
|
|
9
|
+
private readonly _inherited;
|
|
10
|
+
constructor(key: string | symbol, _inherited: Map<symbol, unknown>);
|
|
11
|
+
down(value: T): void;
|
|
12
|
+
up(): T | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Лифт одного ключа поверх контекста Svelte. `up()` отдаёт значение предка и
|
|
3
|
+
* после своего `down()` того же ключа: его до первой записи помнит слой
|
|
4
|
+
* сборки — общий для лифтов одной `useElevator()`. AGENTS.md (Svelte),
|
|
5
|
+
* «Контекст: лифт и локаль».
|
|
6
|
+
*/
|
|
7
|
+
import { getContext, setContext } from 'svelte';
|
|
8
|
+
import { TElevator } from '@soxa-ui/setup';
|
|
9
|
+
export class TSvelteElevator extends TElevator {
|
|
10
|
+
_inherited;
|
|
11
|
+
constructor(key, _inherited) {
|
|
12
|
+
super(key);
|
|
13
|
+
this._inherited = _inherited;
|
|
14
|
+
}
|
|
15
|
+
down(value) {
|
|
16
|
+
if (!this._inherited.has(this._key)) {
|
|
17
|
+
this._inherited.set(this._key, getContext(this._key));
|
|
18
|
+
}
|
|
19
|
+
setContext(this._key, value);
|
|
20
|
+
}
|
|
21
|
+
up() {
|
|
22
|
+
if (!this._inherited.has(this._key))
|
|
23
|
+
return getContext(this._key);
|
|
24
|
+
// Тип значения задаёт ключ лифта: под этим ключом кладут только `T`
|
|
25
|
+
return this._inherited.get(this._key);
|
|
26
|
+
}
|
|
27
|
+
}
|