@woodger/antd 0.1.1 → 0.1.3
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/dist/affix/Affix.svelte +12 -4
- package/dist/affix/affix.types.d.ts +3 -2
- package/dist/alert/Alert.svelte +22 -14
- package/dist/alert/alert.types.d.ts +12 -11
- package/dist/anchor/Anchor.svelte +5 -2
- package/dist/anchor/AnchorLink.svelte +4 -1
- package/dist/anchor/anchor.types.d.ts +10 -9
- package/dist/app/App.svelte +2 -1
- package/dist/app/app.types.d.ts +3 -2
- package/dist/auto-complete/AutoComplete.svelte +209 -43
- package/dist/auto-complete/auto-complete.types.d.ts +34 -3
- package/dist/avatar/Avatar.svelte +46 -32
- package/dist/avatar/AvatarGroup.svelte +34 -11
- package/dist/avatar/AvatarGroupOverflow.svelte +27 -8
- package/dist/avatar/AvatarGroupOverflow.svelte.d.ts +2 -0
- package/dist/avatar/avatar-group-context.d.ts +10 -0
- package/dist/avatar/avatar-group-context.js +11 -0
- package/dist/avatar/avatar-group.engine.d.ts +13 -4
- package/dist/avatar/avatar-group.engine.js +18 -0
- package/dist/avatar/avatar-group.types.d.ts +11 -5
- package/dist/avatar/avatar.component.d.ts +7 -0
- package/dist/avatar/avatar.component.js +4 -0
- package/dist/avatar/avatar.types.d.ts +6 -4
- package/dist/badge/Badge.svelte +37 -17
- package/dist/badge/BadgeRibbon.svelte +26 -21
- package/dist/badge/badge-ribbon.dom.d.ts +2 -4
- package/dist/badge/badge-ribbon.dom.js +14 -10
- package/dist/badge/badge-ribbon.types.d.ts +12 -11
- package/dist/badge/badge-style.dom.d.ts +2 -2
- package/dist/badge/badge-style.dom.js +9 -5
- package/dist/badge/badge-style.engine.d.ts +5 -0
- package/dist/badge/badge-style.engine.js +9 -2
- package/dist/badge/badge.component.d.ts +7 -0
- package/dist/badge/badge.component.js +4 -0
- package/dist/badge/badge.engine.js +1 -1
- package/dist/badge/badge.types.d.ts +15 -11
- package/dist/border-beam/BorderBeam.svelte +9 -5
- package/dist/border-beam/border-beam.engine.d.ts +2 -2
- package/dist/border-beam/border-beam.engine.js +7 -12
- package/dist/border-beam/border-beam.types.d.ts +4 -3
- package/dist/breadcrumb/Breadcrumb.svelte +9 -3
- package/dist/breadcrumb/BreadcrumbEntry.svelte +6 -19
- package/dist/breadcrumb/breadcrumb.engine.d.ts +5 -2
- package/dist/breadcrumb/breadcrumb.engine.js +25 -2
- package/dist/breadcrumb/breadcrumb.types.d.ts +30 -18
- package/dist/button/Button.svelte +35 -10
- package/dist/button/ButtonLabel.svelte +23 -0
- package/dist/button/ButtonLabel.svelte.d.ts +13 -0
- package/dist/button/button.engine.d.ts +6 -0
- package/dist/button/button.engine.js +35 -0
- package/dist/button/button.types.d.ts +11 -8
- package/dist/calendar/CalendarCore.svelte +26 -18
- package/dist/calendar/calendar.component.d.ts +7 -0
- package/dist/calendar/calendar.component.js +4 -0
- package/dist/calendar/calendar.types.d.ts +8 -7
- package/dist/card/Card.svelte +61 -19
- package/dist/card/CardGrid.svelte +4 -1
- package/dist/card/CardMeta.svelte +4 -1
- package/dist/card/card-semantic.engine.d.ts +1 -1
- package/dist/card/card-semantic.engine.js +2 -2
- package/dist/card/card.component.d.ts +9 -0
- package/dist/card/card.component.js +5 -0
- package/dist/card/card.engine.d.ts +2 -0
- package/dist/card/card.engine.js +7 -0
- package/dist/card/card.types.d.ts +19 -19
- package/dist/carousel/Carousel.svelte +11 -5
- package/dist/carousel/carousel-settings.engine.d.ts +1 -1
- package/dist/carousel/carousel.types.d.ts +4 -3
- package/dist/cascader/Cascader.svelte +8 -3
- package/dist/cascader/Cascader.svelte.d.ts +13 -13
- package/dist/cascader/CascaderColumns.svelte +25 -27
- package/dist/cascader/CascaderColumns.svelte.d.ts +9 -7
- package/dist/cascader/CascaderCore.svelte +814 -133
- package/dist/cascader/CascaderCore.svelte.d.ts +14 -14
- package/dist/cascader/CascaderPanel.svelte +9 -3
- package/dist/cascader/CascaderPanel.svelte.d.ts +13 -13
- package/dist/cascader/cascader.component.d.ts +17 -0
- package/dist/cascader/cascader.component.js +9 -0
- package/dist/cascader/cascader.dom.d.ts +1 -1
- package/dist/cascader/cascader.dom.js +2 -2
- package/dist/cascader/cascader.engine.d.ts +51 -24
- package/dist/cascader/cascader.engine.js +69 -6
- package/dist/cascader/cascader.types.d.ts +132 -43
- package/dist/checkbox/Checkbox.svelte +19 -10
- package/dist/checkbox/CheckboxGroup.svelte +14 -6
- package/dist/checkbox/checkbox-group.types.d.ts +7 -4
- package/dist/checkbox/checkbox.component.d.ts +7 -0
- package/dist/checkbox/checkbox.component.js +4 -0
- package/dist/checkbox/checkbox.types.d.ts +15 -13
- package/dist/collapse/Collapse.svelte +43 -11
- package/dist/collapse/CollapseItemView.svelte +5 -4
- package/dist/collapse/CollapsePanel.svelte +35 -3
- package/dist/collapse/CollapsePanel.svelte.d.ts +3 -0
- package/dist/collapse/collapse-context.d.ts +5 -1
- package/dist/collapse/collapse.engine.d.ts +5 -5
- package/dist/collapse/collapse.types.d.ts +20 -14
- package/dist/color-picker/ColorPicker.svelte +171 -110
- package/dist/color-picker/ColorPickerPresets.svelte +9 -4
- package/dist/color-picker/color-picker-alignment.dom.d.ts +17 -0
- package/dist/color-picker/color-picker-alignment.dom.js +144 -0
- package/dist/color-picker/color-picker.types.d.ts +14 -13
- package/dist/component-refs.types.d.ts +45 -0
- package/dist/component-refs.types.js +1 -0
- package/dist/component.types.d.ts +13 -0
- package/dist/component.types.js +1 -0
- package/dist/config-provider/ConfigProvider.svelte +18 -6
- package/dist/config-provider/ConfigProvider.svelte.d.ts +2 -0
- package/dist/config-provider/config-context.d.ts +7 -0
- package/dist/config-provider/config-context.js +1 -0
- package/dist/config-provider/config-provider.component.d.ts +6 -0
- package/dist/config-provider/config-provider.component.js +10 -1
- package/dist/descriptions/Descriptions.svelte +22 -13
- package/dist/descriptions/DescriptionsCell.svelte +19 -19
- package/dist/descriptions/DescriptionsCell.svelte.d.ts +2 -1
- package/dist/descriptions/descriptions-semantic.engine.d.ts +2 -2
- package/dist/descriptions/descriptions-semantic.engine.js +2 -2
- package/dist/descriptions/descriptions.types.d.ts +13 -13
- package/dist/dialog/dialog-container.model.svelte.d.ts +1 -1
- package/dist/dialog/dialog-container.model.svelte.js +14 -2
- package/dist/dialog/dialog-focus.dom.d.ts +3 -1
- package/dist/dialog/dialog-focus.dom.js +8 -7
- package/dist/divider/Divider.svelte +24 -14
- package/dist/divider/divider.types.d.ts +6 -5
- package/dist/drawer/Drawer.svelte +35 -19
- package/dist/drawer/DrawerPanel.svelte +8 -6
- package/dist/drawer/drawer-ancestor-clip.dom.d.ts +15 -0
- package/dist/drawer/drawer-ancestor-clip.dom.js +145 -0
- package/dist/drawer/drawer-clip-plane.dom.d.ts +22 -0
- package/dist/drawer/drawer-clip-plane.dom.js +100 -0
- package/dist/drawer/drawer-clip-shape.dom.d.ts +5 -0
- package/dist/drawer/drawer-clip-shape.dom.js +52 -0
- package/dist/drawer/drawer-clip-style.dom.d.ts +34 -0
- package/dist/drawer/drawer-clip-style.dom.js +190 -0
- package/dist/drawer/drawer-layout.dom.d.ts +6 -0
- package/dist/drawer/drawer-layout.dom.js +240 -0
- package/dist/drawer/drawer-overflow.dom.d.ts +9 -0
- package/dist/drawer/drawer-overflow.dom.js +249 -0
- package/dist/drawer/drawer-overflow.engine.d.ts +54 -0
- package/dist/drawer/drawer-overflow.engine.js +205 -0
- package/dist/drawer/drawer-panel.engine.d.ts +3 -2
- package/dist/drawer/drawer-panel.engine.js +4 -5
- package/dist/drawer/drawer-svg-clip.dom.d.ts +9 -0
- package/dist/drawer/drawer-svg-clip.dom.js +394 -0
- package/dist/drawer/drawer.dom.d.ts +2 -0
- package/dist/drawer/drawer.dom.js +16 -6
- package/dist/drawer/drawer.types.d.ts +22 -21
- package/dist/dropdown/Dropdown.svelte +131 -26
- package/dist/dropdown/dropdown-position.dom.d.ts +3 -1
- package/dist/dropdown/dropdown-position.dom.js +18 -7
- package/dist/dropdown/dropdown.engine.d.ts +10 -7
- package/dist/dropdown/dropdown.engine.js +29 -13
- package/dist/dropdown/dropdown.types.d.ts +7 -6
- package/dist/empty/Empty.svelte +17 -11
- package/dist/empty/empty.types.d.ts +9 -8
- package/dist/flex/Flex.svelte +26 -9
- package/dist/flex/flex.types.d.ts +2 -1
- package/dist/float-button/FloatButton.svelte +24 -13
- package/dist/float-button/FloatButtonBackTop.svelte +6 -6
- package/dist/float-button/FloatButtonGroup.svelte +26 -24
- package/dist/float-button/float-button-context.d.ts +2 -1
- package/dist/float-button/float-button.component.d.ts +9 -0
- package/dist/float-button/float-button.component.js +5 -0
- package/dist/float-button/float-button.types.d.ts +10 -8
- package/dist/form/Form.svelte +241 -42
- package/dist/form/Form.svelte.d.ts +4 -4
- package/dist/form/FormErrorList.svelte +19 -69
- package/dist/form/FormItem.svelte +296 -71
- package/dist/form/FormItem.svelte.d.ts +34 -6
- package/dist/form/FormItemControlBinding.svelte +68 -0
- package/dist/form/FormItemControlBinding.svelte.d.ts +10 -0
- package/dist/form/FormItemMessages.svelte +142 -0
- package/dist/form/FormItemMessages.svelte.d.ts +23 -0
- package/dist/form/FormItemTooltip.svelte +2 -2
- package/dist/form/FormList.svelte +49 -4
- package/dist/form/FormMessageMotion.svelte +133 -0
- package/dist/form/FormMessageMotion.svelte.d.ts +18 -0
- package/dist/form/FormProvider.svelte +9 -0
- package/dist/form/FormProvider.svelte.d.ts +4 -0
- package/dist/form/form-context.d.ts +24 -6
- package/dist/form/form-context.js +18 -0
- package/dist/form/form-control.engine.d.ts +2 -0
- package/dist/form/form-control.engine.js +13 -0
- package/dist/form/form-error-list-state.svelte.d.ts +21 -0
- package/dist/form/form-error-list-state.svelte.js +77 -0
- package/dist/form/form-error-list.engine.js +3 -1
- package/dist/form/form-error-list.types.d.ts +3 -2
- package/dist/form/form-field.dom.js +27 -4
- package/dist/form/form-internal.d.ts +33 -8
- package/dist/form/form-internal.js +2 -0
- package/dist/form/form-item-status.d.ts +2 -1
- package/dist/form/form-item-status.js +3 -1
- package/dist/form/form-list-context.d.ts +4 -0
- package/dist/form/form-list-context.js +3 -0
- package/dist/form/form-list.types.d.ts +5 -2
- package/dist/form/form-no-style.engine.d.ts +6 -5
- package/dist/form/form-provider-context.d.ts +13 -0
- package/dist/form/form-provider-context.js +74 -0
- package/dist/form/form-ref.engine.d.ts +5 -0
- package/dist/form/form-ref.engine.js +43 -0
- package/dist/form/form-store.engine.d.ts +3 -1
- package/dist/form/form-store.engine.js +25 -3
- package/dist/form/form-update.engine.d.ts +29 -0
- package/dist/form/form-update.engine.js +40 -0
- package/dist/form/form-watch.svelte.d.ts +25 -0
- package/dist/form/form-watch.svelte.js +56 -0
- package/dist/form/form.component.d.ts +28 -0
- package/dist/form/form.component.js +25 -0
- package/dist/form/form.model.svelte.d.ts +25 -3
- package/dist/form/form.model.svelte.js +764 -191
- package/dist/form/form.types.d.ts +135 -24
- package/dist/form/validation-message.engine.d.ts +17 -3
- package/dist/form/validation-message.engine.js +39 -2
- package/dist/form/validation-messages.types.d.ts +11 -0
- package/dist/form/validation-nested.engine.d.ts +5 -4
- package/dist/form/validation.engine.d.ts +8 -6
- package/dist/form/validation.engine.js +2 -2
- package/dist/grid/Col.svelte +18 -21
- package/dist/grid/Row.svelte +13 -15
- package/dist/grid/grid.engine.d.ts +4 -1
- package/dist/grid/grid.engine.js +15 -3
- package/dist/grid/grid.svelte.d.ts +7 -0
- package/dist/grid/grid.svelte.js +30 -0
- package/dist/grid/grid.types.d.ts +5 -2
- package/dist/image/Image.svelte +148 -58
- package/dist/image/ImagePreview.svelte +284 -137
- package/dist/image/ImagePreview.svelte.d.ts +11 -2
- package/dist/image/ImagePreviewGroup.svelte +40 -7
- package/dist/image/ImagePreviewIcons.svelte +18 -0
- package/dist/image/ImagePreviewIcons.svelte.d.ts +29 -0
- package/dist/image/ImageProgress.svelte +87 -0
- package/dist/image/ImageProgress.svelte.d.ts +14 -0
- package/dist/image/image-group-context.d.ts +2 -1
- package/dist/image/image-prefix.engine.js +4 -0
- package/dist/image/image-preview-group.types.d.ts +9 -8
- package/dist/image/image-preview-motion.dom.d.ts +16 -0
- package/dist/image/image-preview-motion.dom.js +72 -0
- package/dist/image/image-semantic.engine.d.ts +40 -0
- package/dist/image/image-semantic.engine.js +57 -0
- package/dist/image/image.component.d.ts +7 -0
- package/dist/image/image.component.js +4 -0
- package/dist/image/image.types.d.ts +86 -12
- package/dist/index.d.ts +58 -48
- package/dist/index.js +26 -21
- package/dist/input/Input.svelte +76 -55
- package/dist/input/InputOTP.svelte +14 -9
- package/dist/input/InputPassword.svelte +15 -27
- package/dist/input/InputSearch.svelte +45 -19
- package/dist/input/TextArea.svelte +30 -32
- package/dist/input/input-otp.types.d.ts +12 -9
- package/dist/input/input-password.types.d.ts +6 -6
- package/dist/input/input-search.types.d.ts +8 -8
- package/dist/input/input-value.svelte.d.ts +7 -0
- package/dist/input/input-value.svelte.js +21 -0
- package/dist/input/input.component.d.ts +13 -0
- package/dist/input/input.component.js +12 -0
- package/dist/input/input.types.d.ts +13 -8
- package/dist/input/textarea.types.d.ts +12 -8
- package/dist/input-number/InputNumberAction.svelte +2 -2
- package/dist/input-number/InputNumberControl.svelte +36 -23
- package/dist/input-number/input-number.types.d.ts +16 -16
- package/dist/layout/Layout.svelte +7 -3
- package/dist/layout/LayoutPart.svelte +9 -3
- package/dist/layout/LayoutSider.svelte +27 -17
- package/dist/layout/layout.component.d.ts +13 -0
- package/dist/layout/layout.component.js +7 -0
- package/dist/layout/layout.types.d.ts +6 -5
- package/dist/listy/Listy.svelte +20 -14
- package/dist/listy/ListyGroupHeader.svelte +8 -2
- package/dist/listy/ListyGroupHeader.svelte.d.ts +2 -1
- package/dist/listy/ListyRaw.svelte +7 -9
- package/dist/listy/ListyVirtual.svelte +5 -2
- package/dist/listy/listy.types.d.ts +13 -10
- package/dist/masonry/Masonry.svelte +32 -20
- package/dist/masonry/MasonryItem.svelte +0 -1
- package/dist/masonry/masonry.types.d.ts +8 -7
- package/dist/mentions/Mentions.svelte +44 -9
- package/dist/mentions/MentionsListbox.svelte +2 -1
- package/dist/mentions/mentions.component.d.ts +7 -0
- package/dist/mentions/mentions.component.js +4 -0
- package/dist/mentions/mentions.engine.d.ts +35 -0
- package/dist/mentions/mentions.engine.js +7 -0
- package/dist/mentions/mentions.types.d.ts +12 -8
- package/dist/menu/Menu.svelte +13 -6
- package/dist/menu/MenuItem.svelte +23 -14
- package/dist/menu/MenuItemTooltip.svelte +2 -1
- package/dist/menu/MenuList.svelte +7 -4
- package/dist/menu/MenuSubMenu.svelte +109 -32
- package/dist/menu/menu-motion.engine.js +3 -28
- package/dist/menu/menu-motion.svelte.d.ts +1 -7
- package/dist/menu/menu-motion.svelte.js +1 -33
- package/dist/menu/menu-popup-align.dom.d.ts +1 -1
- package/dist/menu/menu-popup-align.engine.d.ts +2 -2
- package/dist/menu/menu-popup-align.engine.js +1 -4
- package/dist/menu/menu-semantic.engine.d.ts +8 -8
- package/dist/menu/menu-semantic.engine.js +16 -6
- package/dist/menu/menu.engine.d.ts +5 -1
- package/dist/menu/menu.engine.js +15 -0
- package/dist/menu/menu.types.d.ts +25 -22
- package/dist/message/MessageHolder.svelte +9 -6
- package/dist/message/MessageNotice.svelte +12 -9
- package/dist/message/MessageNotice.svelte.d.ts +2 -1
- package/dist/message/message-semantic.engine.d.ts +1 -1
- package/dist/message/message.model.svelte.d.ts +2 -1
- package/dist/message/message.model.svelte.js +2 -1
- package/dist/message/message.types.d.ts +12 -10
- package/dist/modal/Modal.svelte +229 -57
- package/dist/modal/ModalConfirmation.svelte +9 -10
- package/dist/modal/ModalFooterScope.svelte +15 -0
- package/dist/modal/ModalFooterScope.svelte.d.ts +7 -0
- package/dist/modal/modal-close.engine.d.ts +1 -1
- package/dist/modal/modal-layout.engine.d.ts +1 -1
- package/dist/modal/modal-layout.engine.js +20 -3
- package/dist/modal/modal-motion.dom.d.ts +1 -0
- package/dist/modal/modal-motion.dom.js +21 -5
- package/dist/modal/modal-named-motion.dom.d.ts +1 -1
- package/dist/modal/modal-named-motion.dom.js +1 -2
- package/dist/modal/modal-semantic.engine.d.ts +8 -7
- package/dist/modal/modal-semantic.engine.js +2 -2
- package/dist/modal/modal.types.d.ts +27 -18
- package/dist/motion/collapse-motion.engine.d.ts +3 -0
- package/dist/motion/collapse-motion.engine.js +31 -0
- package/dist/motion/css-motion.svelte.d.ts +7 -0
- package/dist/motion/css-motion.svelte.js +35 -0
- package/dist/notice/notice-queue.model.svelte.js +4 -0
- package/dist/notice/notice-semantic.engine.d.ts +10 -7
- package/dist/notice/notice-semantic.engine.js +9 -4
- package/dist/notification/NotificationHolder.svelte +7 -5
- package/dist/notification/NotificationList.svelte +5 -2
- package/dist/notification/NotificationList.svelte.d.ts +2 -1
- package/dist/notification/NotificationNotice.svelte +16 -18
- package/dist/notification/NotificationNotice.svelte.d.ts +2 -1
- package/dist/notification/notification.model.svelte.d.ts +2 -1
- package/dist/notification/notification.types.d.ts +12 -9
- package/dist/pagination/Pagination.svelte +90 -18
- package/dist/pagination/PaginationControl.svelte +2 -0
- package/dist/pagination/pagination.types.d.ts +19 -14
- package/dist/picker/DatePicker.svelte +9 -1
- package/dist/picker/DatePicker.svelte.d.ts +4 -4
- package/dist/picker/DatePickerCalendar.svelte +15 -12
- package/dist/picker/DatePickerCalendar.svelte.d.ts +2 -2
- package/dist/picker/DatePickerTimePanel.svelte +5 -1
- package/dist/picker/DatePickerTimePanel.svelte.d.ts +2 -4
- package/dist/picker/PickerTimeColumn.svelte +27 -12
- package/dist/picker/PickerTimeColumn.svelte.d.ts +3 -0
- package/dist/picker/PickerTimePanel.svelte +16 -0
- package/dist/picker/PickerTimePanel.svelte.d.ts +3 -0
- package/dist/picker/RangePicker.svelte +3 -1
- package/dist/picker/RangePickerCore.svelte +874 -363
- package/dist/picker/RangePickerCore.svelte.d.ts +1 -0
- package/dist/picker/SinglePicker.svelte +684 -309
- package/dist/picker/SinglePicker.svelte.d.ts +1 -0
- package/dist/picker/TimePicker.svelte +3 -1
- package/dist/picker/TimeRangePicker.svelte +2 -0
- package/dist/picker/date-picker-semantic.engine.d.ts +7 -6
- package/dist/picker/date-picker-semantic.engine.js +5 -4
- package/dist/picker/date-picker.types.d.ts +58 -30
- package/dist/picker/picker-adapter-props.engine.d.ts +2 -0
- package/dist/picker/picker-adapter-props.engine.js +4 -0
- package/dist/picker/picker-mask-input.model.svelte.js +9 -5
- package/dist/picker/picker-panel-updates.d.ts +6 -0
- package/dist/picker/picker-panel-updates.js +33 -0
- package/dist/picker/picker-popup-portal.dom.d.ts +49 -0
- package/dist/picker/picker-popup-portal.dom.js +49 -0
- package/dist/picker/picker-popup.dom.d.ts +14 -2
- package/dist/picker/picker-popup.dom.js +153 -40
- package/dist/picker/picker-popup.model.svelte.d.ts +33 -8
- package/dist/picker/picker-popup.model.svelte.js +149 -19
- package/dist/picker/picker-prefix.engine.js +4 -1
- package/dist/picker/picker-style.engine.d.ts +27 -0
- package/dist/picker/picker-style.engine.js +64 -0
- package/dist/picker/picker-time-scroll.model.svelte.d.ts +16 -0
- package/dist/picker/picker-time-scroll.model.svelte.js +31 -0
- package/dist/picker/range-picker-interaction.engine.d.ts +3 -2
- package/dist/picker/range-picker-interaction.engine.js +10 -4
- package/dist/picker/range-picker-popup.dom.d.ts +2 -0
- package/dist/picker/range-picker-popup.dom.js +47 -0
- package/dist/picker/range-picker.types.d.ts +13 -6
- package/dist/picker/time-picker-column.dom.d.ts +6 -1
- package/dist/picker/time-picker-column.dom.js +27 -3
- package/dist/picker/time-picker-props.engine.js +3 -2
- package/dist/picker/time-picker-semantic.engine.d.ts +6 -2
- package/dist/picker/time-picker-semantic.engine.js +32 -18
- package/dist/picker/time-picker.component.d.ts +4 -1
- package/dist/picker/time-picker.component.js +3 -1
- package/dist/picker/time-picker.types.d.ts +28 -24
- package/dist/picker/time-range-picker-semantic.engine.d.ts +2 -0
- package/dist/picker/time-range-picker-semantic.engine.js +6 -8
- package/dist/picker/time-range-picker.types.d.ts +5 -4
- package/dist/popconfirm/Popconfirm.svelte +48 -12
- package/dist/popconfirm/popconfirm.types.d.ts +17 -11
- package/dist/popover/Popover.svelte +65 -42
- package/dist/popover/popover.types.d.ts +19 -12
- package/dist/popup/PopupContentContext.svelte +14 -0
- package/dist/popup/PopupContentContext.svelte.d.ts +7 -0
- package/dist/popup/overlay-motion.css +86 -3
- package/dist/popup/overlay-portal-alignment.dom.d.ts +34 -0
- package/dist/popup/overlay-portal-alignment.dom.js +166 -0
- package/dist/popup/overlay-semantic.engine.d.ts +16 -15
- package/dist/popup/overlay-semantic.engine.js +5 -6
- package/dist/popup/popup-container.model.svelte.d.ts +4 -1
- package/dist/popup/popup-container.model.svelte.js +7 -2
- package/dist/popup/popup-css-motion.dom.d.ts +24 -0
- package/dist/{tree-select/tree-select-motion.dom.js → popup/popup-css-motion.dom.js} +13 -3
- package/dist/popup/popup-css-motion.model.svelte.d.ts +25 -0
- package/dist/popup/popup-css-motion.model.svelte.js +73 -0
- package/dist/popup/popup-geometry.dom.d.ts +16 -0
- package/dist/popup/popup-geometry.dom.js +97 -0
- package/dist/popup/popup-plane.engine.d.ts +6 -0
- package/dist/popup/popup-plane.engine.js +18 -0
- package/dist/popup/popup-portal-fit.dom.d.ts +3 -0
- package/dist/popup/popup-portal-fit.dom.js +81 -0
- package/dist/popup/popup-portal-projection.dom.d.ts +52 -0
- package/dist/popup/popup-portal-projection.dom.js +208 -0
- package/dist/popup/popup-position.engine.d.ts +5 -3
- package/dist/popup/popup.dom.d.ts +7 -1
- package/dist/popup/popup.dom.js +69 -22
- package/dist/popup/select-popup-motion.engine.d.ts +4 -0
- package/dist/popup/select-popup-motion.engine.js +18 -0
- package/dist/progress/Progress.svelte +58 -28
- package/dist/progress/ProgressCircle.svelte +40 -22
- package/dist/progress/ProgressCircle.svelte.d.ts +2 -1
- package/dist/progress/progress-circle.engine.d.ts +1 -1
- package/dist/progress/progress.types.d.ts +6 -5
- package/dist/qr-code/QRCode.svelte +12 -8
- package/dist/qr-code/qrcode.types.d.ts +10 -9
- package/dist/radio/Radio.svelte +19 -10
- package/dist/radio/RadioGroup.svelte +14 -6
- package/dist/radio/radio.component.d.ts +9 -0
- package/dist/radio/radio.component.js +5 -0
- package/dist/radio/radio.types.d.ts +20 -18
- package/dist/rate/Rate.svelte +8 -4
- package/dist/rate/rate.types.d.ts +5 -4
- package/dist/render-content.engine.d.ts +9 -0
- package/dist/render-content.engine.js +21 -0
- package/dist/result/Result.svelte +19 -13
- package/dist/result/result.types.d.ts +11 -10
- package/dist/segmented/Segmented.svelte +28 -15
- package/dist/segmented/segmented.engine.js +2 -1
- package/dist/segmented/segmented.types.d.ts +11 -11
- package/dist/select/Select.svelte +309 -69
- package/dist/select/select-editor-focus.dom.d.ts +14 -0
- package/dist/select/select-editor-focus.dom.js +51 -0
- package/dist/select/select-icons.engine.d.ts +2 -0
- package/dist/select/select-icons.engine.js +17 -8
- package/dist/select/select-mouse-boundary.dom.d.ts +7 -0
- package/dist/select/select-mouse-boundary.dom.js +57 -0
- package/dist/select/select-semantic.engine.d.ts +2 -2
- package/dist/select/select-style.engine.d.ts +2 -2
- package/dist/select/select-style.engine.js +24 -2
- package/dist/select/select-token.engine.d.ts +4 -0
- package/dist/select/select-token.engine.js +13 -0
- package/dist/select/select.types.d.ts +35 -12
- package/dist/skeleton/Skeleton.svelte +25 -15
- package/dist/skeleton/SkeletonElement.svelte +16 -8
- package/dist/skeleton/skeleton.types.d.ts +11 -10
- package/dist/slider/SliderRange.svelte +35 -53
- package/dist/slider/SliderSingle.svelte +58 -73
- package/dist/slider/SliderTooltip.svelte +322 -0
- package/dist/slider/SliderTooltip.svelte.d.ts +18 -0
- package/dist/slider/slider-handle.dom.d.ts +5 -0
- package/dist/slider/slider-handle.dom.js +60 -0
- package/dist/slider/slider-range.engine.d.ts +4 -2
- package/dist/slider/slider-range.engine.js +15 -0
- package/dist/slider/slider-range.types.d.ts +10 -8
- package/dist/slider/slider-semantic.engine.d.ts +1 -1
- package/dist/slider/slider-semantic.engine.js +2 -6
- package/dist/slider/slider.types.d.ts +5 -3
- package/dist/space/Space.svelte +35 -16
- package/dist/space/SpaceAddon.svelte +11 -5
- package/dist/space/SpaceCompact.svelte +7 -2
- package/dist/space/SpaceCompactItem.svelte +4 -1
- package/dist/space/space-compact.types.d.ts +6 -6
- package/dist/space/space.component.d.ts +9 -0
- package/dist/space/space.component.js +5 -0
- package/dist/space/space.engine.d.ts +5 -1
- package/dist/space/space.engine.js +32 -7
- package/dist/space/space.types.d.ts +15 -12
- package/dist/spin/Spin.svelte +25 -14
- package/dist/spin/spin.types.d.ts +5 -3
- package/dist/splitter/Splitter.svelte +15 -14
- package/dist/splitter/SplitterArrow.svelte.d.ts +1 -1
- package/dist/splitter/SplitterBar.svelte +2 -1
- package/dist/splitter/SplitterPanel.svelte +14 -2
- package/dist/splitter/SplitterPanel.svelte.d.ts +2 -1
- package/dist/splitter/SplitterPanelDeclaration.svelte +20 -0
- package/dist/splitter/SplitterPanelDeclaration.svelte.d.ts +4 -0
- package/dist/splitter/SplitterPanelDeclarations.svelte +16 -0
- package/dist/splitter/SplitterPanelDeclarations.svelte.d.ts +10 -0
- package/dist/splitter/SplitterRoot.svelte +18 -0
- package/dist/splitter/SplitterRoot.svelte.d.ts +4 -0
- package/dist/splitter/splitter-panel-context.d.ts +10 -0
- package/dist/splitter/splitter-panel-context.js +11 -0
- package/dist/splitter/splitter.component.d.ts +7 -0
- package/dist/splitter/splitter.component.js +6 -0
- package/dist/splitter/splitter.engine.d.ts +6 -1
- package/dist/splitter/splitter.engine.js +18 -0
- package/dist/splitter/splitter.types.d.ts +13 -10
- package/dist/statistic/Statistic.svelte +25 -12
- package/dist/statistic/statistic.component.d.ts +7 -0
- package/dist/statistic/statistic.component.js +4 -0
- package/dist/statistic/statistic.types.d.ts +6 -4
- package/dist/steps/StepIcon.svelte +4 -2
- package/dist/steps/StepIcon.svelte.d.ts +2 -1
- package/dist/steps/StepItem.svelte +12 -16
- package/dist/steps/Steps.svelte +9 -9
- package/dist/steps/steps-data.engine.d.ts +5 -4
- package/dist/steps/steps-expanded.types.d.ts +2 -1
- package/dist/steps/steps-icon-context.d.ts +2 -1
- package/dist/steps/steps.types.d.ts +4 -3
- package/dist/style/inline-style-layers.engine.d.ts +11 -0
- package/dist/style/inline-style-layers.engine.js +120 -0
- package/dist/style/inline-style.engine.d.ts +4 -0
- package/dist/style/inline-style.engine.js +17 -9
- package/dist/style/inline-style.types.d.ts +12 -0
- package/dist/style/inline-style.types.js +1 -0
- package/dist/style/semantic-style.engine.d.ts +18 -12
- package/dist/style/semantic-style.engine.js +15 -9
- package/dist/styles.css +1 -0
- package/dist/styles.css.d.ts +1 -0
- package/dist/switch/Switch.svelte +17 -9
- package/dist/switch/switch.types.d.ts +14 -12
- package/dist/table/Table.svelte +30 -21
- package/dist/table/Table.svelte.d.ts +4 -2
- package/dist/table/TableColumn.svelte +20 -0
- package/dist/table/TableColumn.svelte.d.ts +25 -0
- package/dist/table/TableColumnDeclarations.svelte +18 -0
- package/dist/table/TableColumnDeclarations.svelte.d.ts +10 -0
- package/dist/table/TableColumnGroup.svelte +31 -0
- package/dist/table/TableColumnGroup.svelte.d.ts +25 -0
- package/dist/table/TableRoot.svelte +55 -0
- package/dist/table/TableRoot.svelte.d.ts +29 -0
- package/dist/table/table-cell.engine.d.ts +14 -14
- package/dist/table/table-column-declarations.svelte.d.ts +22 -0
- package/dist/table/table-column-declarations.svelte.js +45 -0
- package/dist/table/table-semantic.engine.d.ts +18 -6
- package/dist/table/table-semantic.engine.js +14 -14
- package/dist/table/table.component.d.ts +10 -2
- package/dist/table/table.component.js +4 -1
- package/dist/table/table.types.d.ts +55 -25
- package/dist/tabs/Tabs.svelte +35 -18
- package/dist/tabs/TabsNav.svelte +33 -18
- package/dist/tabs/TabsNav.svelte.d.ts +2 -1
- package/dist/tabs/TabsOverflow.svelte +98 -122
- package/dist/tabs/TabsOverflow.svelte.d.ts +2 -1
- package/dist/tabs/TabsPanel.svelte +10 -5
- package/dist/tabs/TabsPanel.svelte.d.ts +4 -3
- package/dist/tabs/tabs-more-alignment.dom.d.ts +32 -0
- package/dist/tabs/tabs-more-alignment.dom.js +158 -0
- package/dist/tabs/tabs-more.dom.d.ts +69 -13
- package/dist/tabs/tabs-more.dom.js +76 -65
- package/dist/tabs/tabs-motion.dom.d.ts +2 -1
- package/dist/tabs/tabs-motion.dom.js +2 -1
- package/dist/tabs/tabs-motion.types.d.ts +4 -3
- package/dist/tabs/tabs-nav.types.d.ts +6 -7
- package/dist/tabs/tabs-semantic.engine.d.ts +18 -12
- package/dist/tabs/tabs-semantic.engine.js +70 -19
- package/dist/tabs/tabs.types.d.ts +35 -29
- package/dist/tag/CheckableTag.svelte +8 -4
- package/dist/tag/CheckableTagGroup.svelte +42 -32
- package/dist/tag/CheckableTagGroup.svelte.d.ts +12 -12
- package/dist/tag/Tag.svelte +14 -20
- package/dist/tag/tag-style.dom.d.ts +3 -1
- package/dist/tag/tag-style.dom.js +19 -1
- package/dist/tag/tag.component.d.ts +10 -0
- package/dist/tag/tag.component.js +5 -0
- package/dist/tag/tag.types.d.ts +30 -27
- package/dist/theme/theme-context.svelte.d.ts +2 -0
- package/dist/theme/theme-context.svelte.js +6 -1
- package/dist/timeline/Timeline.svelte +13 -5
- package/dist/timeline/timeline.engine.js +3 -1
- package/dist/timeline/timeline.types.d.ts +7 -6
- package/dist/tooltip/Tooltip.svelte +18 -10
- package/dist/tooltip/TooltipPopup.svelte +44 -22
- package/dist/tooltip/TooltipUniqueContent.svelte +3 -6
- package/dist/tooltip/TooltipUniqueContent.svelte.d.ts +0 -1
- package/dist/tooltip/TooltipUniquePopup.svelte +1 -1
- package/dist/tooltip/tooltip-popup.types.d.ts +6 -0
- package/dist/tooltip/tooltip.engine.d.ts +58 -2
- package/dist/tooltip/tooltip.engine.js +54 -27
- package/dist/tooltip/tooltip.types.d.ts +38 -13
- package/dist/tour/Tour.svelte +37 -14
- package/dist/tour/TourPanel.svelte +13 -12
- package/dist/tour/TourPanel.svelte.d.ts +2 -1
- package/dist/tour/tour.engine.d.ts +7 -2
- package/dist/tour/tour.engine.js +58 -11
- package/dist/tour/tour.types.d.ts +20 -19
- package/dist/transfer/Transfer.svelte +44 -36
- package/dist/transfer/TransferAction.svelte +6 -7
- package/dist/transfer/TransferAction.svelte.d.ts +3 -2
- package/dist/transfer/TransferCheckbox.svelte +9 -3
- package/dist/transfer/TransferCheckbox.svelte.d.ts +2 -1
- package/dist/transfer/TransferList.svelte +18 -0
- package/dist/transfer/TransferList.svelte.d.ts +45 -0
- package/dist/transfer/TransferOperation.svelte +43 -0
- package/dist/transfer/TransferOperation.svelte.d.ts +4 -0
- package/dist/transfer/TransferPagination.svelte +3 -1
- package/dist/transfer/TransferSearch.svelte +44 -0
- package/dist/transfer/TransferSearch.svelte.d.ts +4 -0
- package/dist/transfer/TransferSection.svelte +42 -30
- package/dist/transfer/TransferSection.svelte.d.ts +2 -4
- package/dist/transfer/transfer-style.engine.d.ts +7 -0
- package/dist/transfer/transfer-style.engine.js +33 -0
- package/dist/transfer/transfer.component.d.ts +12 -0
- package/dist/transfer/transfer.component.js +6 -0
- package/dist/transfer/transfer.types.d.ts +44 -4
- package/dist/tree/Tree.svelte +8 -5
- package/dist/tree/TreeMotion.svelte +5 -1
- package/dist/tree/tree-motion.dom.js +12 -3
- package/dist/tree/tree-motion.types.d.ts +4 -3
- package/dist/tree/tree-semantic.engine.d.ts +9 -2
- package/dist/tree/tree-semantic.engine.js +37 -3
- package/dist/tree/tree.component.d.ts +10 -0
- package/dist/tree/tree.component.js +5 -0
- package/dist/tree/tree.types.d.ts +8 -6
- package/dist/tree-select/TreeSelectControl.svelte +127 -89
- package/dist/tree-select/tree-select-align.engine.d.ts +2 -6
- package/dist/tree-select/tree-select-align.engine.js +1 -18
- package/dist/tree-select/tree-select-motion-frame.dom.d.ts +2 -5
- package/dist/tree-select/tree-select-semantic.engine.d.ts +6 -6
- package/dist/tree-select/tree-select-semantic.engine.js +50 -25
- package/dist/tree-select/tree-select-token.engine.d.ts +1 -3
- package/dist/tree-select/tree-select-token.engine.js +1 -13
- package/dist/tree-select/tree-select.types.d.ts +9 -5
- package/dist/types.d.ts +5 -2
- package/dist/typography/TypographyEditable.svelte +11 -5
- package/dist/typography/TypographyEditable.svelte.d.ts +3 -2
- package/dist/typography/TypographyElement.svelte +13 -7
- package/dist/typography/TypographyElement.svelte.d.ts +3 -2
- package/dist/typography/TypographyTooltip.svelte +19 -8
- package/dist/typography/typography-semantic.engine.d.ts +9 -2
- package/dist/typography/typography-semantic.engine.js +15 -4
- package/dist/typography/typography.component.d.ts +13 -0
- package/dist/typography/typography.component.js +7 -0
- package/dist/typography/typography.types.d.ts +8 -7
- package/dist/upload/Upload.svelte +44 -4
- package/dist/upload/Upload.svelte.d.ts +1 -1
- package/dist/upload/UploadDragger.svelte +3 -2
- package/dist/upload/UploadDragger.svelte.d.ts +4 -4
- package/dist/upload/UploadList.svelte.d.ts +1 -1
- package/dist/upload/UploadListItem.svelte +52 -11
- package/dist/upload/upload.component.d.ts +9 -0
- package/dist/upload/upload.component.js +5 -0
- package/dist/upload/upload.engine.d.ts +8 -2
- package/dist/upload/upload.engine.js +80 -4
- package/dist/upload/upload.types.d.ts +2 -1
- package/dist/utils/declaration-order.svelte.d.ts +12 -0
- package/dist/utils/declaration-order.svelte.js +53 -0
- package/dist/vendor/compute-scroll-into-view.d.ts +3 -1
- package/dist/vendor/compute-scroll-into-view.js +3 -2
- package/dist/vendor/date-picker-prefix.css.js +2 -2
- package/dist/vendor/dropdown-motion.css +105 -0
- package/dist/vendor/image-prefix.css.js +3 -3
- package/dist/vendor/image.css +16 -2
- package/dist/vendor/tree-select-popup-motion.css +112 -112
- package/dist/vendor/tree-select-popup-motion.css.js +2 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/watermark/Watermark.svelte +8 -6
- package/dist/watermark/watermark.types.d.ts +3 -2
- package/package.json +15 -4
- package/readme.md +2 -2
- package/dist/picker/time-range-picker-popup.dom.d.ts +0 -2
- package/dist/picker/time-range-picker-popup.dom.js +0 -42
- package/dist/tree-select/tree-select-motion-css.engine.d.ts +0 -2
- package/dist/tree-select/tree-select-motion-css.engine.js +0 -11
- package/dist/tree-select/tree-select-motion.dom.d.ts +0 -18
- package/dist/tree-select/tree-select-motion.engine.d.ts +0 -2
- package/dist/tree-select/tree-select-motion.engine.js +0 -5
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes, HTMLFormAttributes } from 'svelte/elements';
|
|
3
3
|
import type { FormValidationError } from './FormValidationError';
|
|
4
|
-
import type { FormInstance } from './form.model.svelte.js';
|
|
4
|
+
import type { FormFieldData, FormFieldSnapshot, FormInstance, SubmissionResult } from './form.model.svelte.js';
|
|
5
|
+
import type { FormValueProjection, PartialFormValues } from './form-store.engine';
|
|
5
6
|
import type { ColProps } from '../grid/grid.types';
|
|
6
7
|
import type { FormValues } from './validation.engine';
|
|
7
8
|
import type { ComponentSize, RenderEmptyContent, Variant } from '../types';
|
|
8
9
|
import type { Options, ScrollAction } from '../vendor/compute-scroll-into-view';
|
|
9
10
|
import type { TooltipProps } from '../tooltip/tooltip.types';
|
|
10
|
-
import type { ValidateMessages } from './validation-messages.types';
|
|
11
|
+
import type { FormFieldMessages, ValidateMessages } from './validation-messages.types';
|
|
11
12
|
import type { FormValidateStatus } from './form-error-list.types';
|
|
12
|
-
|
|
13
|
+
import type { CSSStyle } from '../style/inline-style.types';
|
|
14
|
+
export interface FormFeedbackInfo extends FormFieldMessages {
|
|
13
15
|
status: FormValidateStatus;
|
|
14
16
|
errors: readonly string[];
|
|
15
17
|
warnings: readonly string[];
|
|
@@ -25,8 +27,8 @@ export interface FormTooltipProps extends Omit<TooltipProps, 'children'> {
|
|
|
25
27
|
/** Content includes arrays; the object contains Tooltip options and a local icon. */
|
|
26
28
|
export type FormItemTooltip = FormTooltipProps | RenderEmptyContent;
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
+
* Scrolls to the field and its computed CSS scroll margins. Defaults to if-needed/nearest
|
|
31
|
+
* with focus left in place.
|
|
30
32
|
*/
|
|
31
33
|
export interface FormScrollOptions extends Options {
|
|
32
34
|
/** Native scrolling behavior or callback with calculated actions. */
|
|
@@ -50,26 +52,117 @@ export interface FormLocale {
|
|
|
50
52
|
/** Locale message templates. ConfigProvider.form and Form.validateMessages take precedence. */
|
|
51
53
|
defaultValidateMessages?: ValidateMessages;
|
|
52
54
|
}
|
|
53
|
-
/**
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
/** CSS text or camel-case declarations for an authored Form style. */
|
|
56
|
+
export type FormStyle = CSSStyle;
|
|
57
|
+
/** The root belongs to Form. The remaining slots belong to fields and ErrorList. */
|
|
58
|
+
export interface FormSemanticSlots<Value = string> {
|
|
59
|
+
root?: Value;
|
|
60
|
+
label?: Value;
|
|
61
|
+
content?: Value;
|
|
62
|
+
help?: Value;
|
|
63
|
+
helpItem?: Value;
|
|
64
|
+
extra?: Value;
|
|
61
65
|
}
|
|
62
66
|
/** Callback receives native props with allowed layout/disabled and default labels. */
|
|
63
|
-
export type FormSemantic = FormSemanticSlots | (<Values extends FormValues>(info: {
|
|
67
|
+
export type FormSemantic<Value = string> = FormSemanticSlots<Value> | (<Values extends FormValues>(info: {
|
|
64
68
|
props: FormProps<Values>;
|
|
65
|
-
}) => FormSemanticSlots | undefined);
|
|
69
|
+
}) => FormSemanticSlots<Value> | undefined);
|
|
70
|
+
/** Events that validate a field. An empty array or false disables control-triggered validation. */
|
|
71
|
+
export type FormValidateTrigger = string | readonly string[] | false;
|
|
72
|
+
/** Maps values between a named FormItem and its editor. */
|
|
73
|
+
export interface FormItemValueAdapter {
|
|
74
|
+
/** The event that writes a value through the control snippet. Defaults to onChange. */
|
|
75
|
+
trigger?: string;
|
|
76
|
+
/** The editor value prop and default event target key. Defaults to value. */
|
|
77
|
+
valuePropName?: string;
|
|
78
|
+
/** Reads a value from the editor's original event arguments. */
|
|
79
|
+
getValueFromEvent?(...args: unknown[]): unknown;
|
|
80
|
+
/** Maps the stored value to editor props and takes precedence over valuePropName on render. */
|
|
81
|
+
getValueProps?(value: unknown): Readonly<Record<string, unknown>>;
|
|
82
|
+
/** Synchronously normalizes a control edit using the previous field value and full store. */
|
|
83
|
+
normalize?(value: unknown, previousValue: unknown, previousValues: Readonly<FormValues>): unknown;
|
|
84
|
+
}
|
|
85
|
+
/** The value props and event dispatch supplied to the FormItem control snippet. */
|
|
86
|
+
export interface FormItemControl {
|
|
87
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
88
|
+
/** Forwards the editor's original arguments to the configured write and validation triggers. */
|
|
89
|
+
emit(event: string, ...args: unknown[]): void;
|
|
90
|
+
}
|
|
91
|
+
/** Identifies value writes while metadata, reset and validation notifications omit the source. */
|
|
92
|
+
export interface FormItemUpdateInfo {
|
|
93
|
+
readonly source?: 'internal' | 'external';
|
|
94
|
+
}
|
|
95
|
+
/** Selects render updates from ordered snapshots of the form store. */
|
|
96
|
+
export type FormItemShouldUpdate = boolean | {
|
|
97
|
+
compare(previous: Readonly<FormValues>, current: Readonly<FormValues>, info: FormItemUpdateInfo): boolean;
|
|
98
|
+
}['compare'];
|
|
99
|
+
/** Values observed by the render snippet and the live model for form actions. */
|
|
100
|
+
export interface FormItemRenderContext {
|
|
101
|
+
readonly values: Readonly<FormValues>;
|
|
102
|
+
readonly form: FormInstance<FormValues> | undefined;
|
|
103
|
+
/** The nearest Form's mounted handle, when the item has an owner. */
|
|
104
|
+
readonly ref?: FormRef<FormValues>;
|
|
105
|
+
}
|
|
106
|
+
/** The currently mounted named models in a FormProvider subtree. */
|
|
107
|
+
export type FormProviderForms = Readonly<Partial<Record<string, FormInstance<FormValues>>>>;
|
|
108
|
+
/** Imperative handles for the same named registrations as the model snapshot. */
|
|
109
|
+
export type FormProviderRefs = Readonly<Partial<Record<string, FormRef<FormValues>>>>;
|
|
110
|
+
export interface FormProviderChangeInfo {
|
|
111
|
+
changedFields: FormFieldSnapshot[];
|
|
112
|
+
forms: FormProviderForms;
|
|
113
|
+
readonly refs?: FormProviderRefs;
|
|
114
|
+
}
|
|
115
|
+
export interface FormProviderFinishInfo {
|
|
116
|
+
values: FormValues;
|
|
117
|
+
forms: FormProviderForms;
|
|
118
|
+
readonly refs?: FormProviderRefs;
|
|
119
|
+
}
|
|
120
|
+
/** Observes descendant forms without adding a DOM wrapper. */
|
|
121
|
+
export interface FormProviderProps {
|
|
122
|
+
children?: Snippet;
|
|
123
|
+
/** Accepted by the source provider, where it also has no effect. */
|
|
124
|
+
prefixCls?: string;
|
|
125
|
+
/** Receives edits and validation events, including for forms with an empty or omitted name. */
|
|
126
|
+
onFormChange?: (name: string | undefined, info: FormProviderChangeInfo) => void;
|
|
127
|
+
/** Receives successful submissions before the form's finish callback. */
|
|
128
|
+
onFormFinish?: (name: string | undefined, info: FormProviderFinishInfo) => void;
|
|
129
|
+
}
|
|
130
|
+
/** The whole form store and its live model, supplied to the form's render snippet. */
|
|
131
|
+
export interface FormRenderContext<Values extends FormValues = FormValues> {
|
|
132
|
+
readonly values: Readonly<Values>;
|
|
133
|
+
readonly form: FormInstance<Values>;
|
|
134
|
+
/** The Form's imperative handle after mount. */
|
|
135
|
+
readonly ref?: FormRef<Values>;
|
|
136
|
+
}
|
|
137
|
+
/** Root attributes and content forwarded to a custom Svelte component. */
|
|
138
|
+
export interface FormRootProps extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'class'>, Omit<HTMLFormAttributes, keyof HTMLAttributes<HTMLFormElement>> {
|
|
139
|
+
children: Snippet;
|
|
140
|
+
class?: string;
|
|
141
|
+
/** Forward with a bindable prop and bind:this on the custom host. */
|
|
142
|
+
nativeElement?: HTMLElement;
|
|
143
|
+
}
|
|
144
|
+
/** A mounted Form's imperative handle. It follows changes to the active model and host. */
|
|
145
|
+
export interface FormRef<Values extends FormValues = FormValues> extends FormInstance<Values> {
|
|
146
|
+
readonly nativeElement: HTMLElement | undefined;
|
|
147
|
+
/** Runs the mounted Form's submit callbacks, including when there is no native host. */
|
|
148
|
+
submit(): void;
|
|
149
|
+
submit(onFinish: (values: Values) => void | Promise<void>): Promise<SubmissionResult<Values>>;
|
|
150
|
+
}
|
|
66
151
|
/** Native form for reactive model, validation and asynchronous onFinish. */
|
|
67
|
-
export interface FormProps<Values extends FormValues> extends Omit<HTMLFormAttributes, 'children' | 'onsubmit' | 'onreset' | 'class'> {
|
|
68
|
-
/** An
|
|
69
|
-
form
|
|
152
|
+
export interface FormProps<Values extends FormValues> extends Omit<HTMLFormAttributes, 'children' | 'onsubmit' | 'onreset' | 'class' | 'style'> {
|
|
153
|
+
/** An explicit model. When omitted, Form owns an isolated instance. */
|
|
154
|
+
form?: FormInstance<Values>;
|
|
155
|
+
/** Fills missing values on attachment and provides defaults for subsequent resets. */
|
|
156
|
+
initialValues?: PartialFormValues<Values>;
|
|
157
|
+
/** Applies external field values and metadata after mounting, without change callbacks. */
|
|
158
|
+
fields?: readonly FormFieldData[];
|
|
70
159
|
/** CSS prefix root Form; empty/undefined inherit ConfigProvider regardless of FormItem. */
|
|
71
160
|
prefixCls?: string;
|
|
72
161
|
children: Snippet;
|
|
162
|
+
/** Renders content from the full current store in place of the children snippet. */
|
|
163
|
+
render?: Snippet<[FormRenderContext<Values>]>;
|
|
164
|
+
/** Binds the mounted form handle until the component unmounts. */
|
|
165
|
+
ref?: FormRef<Values>;
|
|
73
166
|
/** @defaultValue 'vertical' */
|
|
74
167
|
layout?: 'vertical' | 'horizontal' | 'inline';
|
|
75
168
|
/** Adds colon to the horizontal label; undefined inherits ConfigProvider.form, then true. */
|
|
@@ -94,10 +187,22 @@ export interface FormProps<Values extends FormValues> extends Omit<HTMLFormAttri
|
|
|
94
187
|
feedbackIcons?: FormFeedbackIcons;
|
|
95
188
|
/** Local groups replace config entirely; the message of a separate rule is more prioritized. */
|
|
96
189
|
validateMessages?: ValidateMessages;
|
|
97
|
-
/**
|
|
98
|
-
|
|
190
|
+
/** Default validation events for this form's fields. */
|
|
191
|
+
validateTrigger?: FormValidateTrigger;
|
|
192
|
+
/** Keeps field values after removal by default. Individual fields can override it. */
|
|
193
|
+
preserve?: boolean;
|
|
194
|
+
/** Clears model values when the last Form using this model detaches. */
|
|
195
|
+
clearOnDestroy?: boolean;
|
|
196
|
+
/** Native tag, Svelte component, or false to render without a wrapper. Defaults to form. */
|
|
197
|
+
component?: keyof HTMLElementTagNameMap | Component<FormRootProps> | false;
|
|
198
|
+
/** Handles a native reset after the form model has been reset. */
|
|
199
|
+
onreset?: FormRootProps['onreset'];
|
|
99
200
|
/** Defaults disabled for children; the nearest ConfigProvider and prop control priority. */
|
|
100
201
|
disabled?: boolean;
|
|
202
|
+
/** A control edit supplies the changed path and the values of the registered fields. */
|
|
203
|
+
onValuesChange?: (changedValues: FormValueProjection<Values>, allValues: FormValueProjection<Values>) => void;
|
|
204
|
+
/** Control edits and validation report the changed fields and the snapshot they came from. */
|
|
205
|
+
onFieldsChange?: (changedFields: FormFieldSnapshot[], allFields: FormFieldSnapshot[]) => void;
|
|
101
206
|
/** Is called after successful validation; Promise keeps submitting until completion. */
|
|
102
207
|
onFinish?: (values: Values) => void | Promise<void>;
|
|
103
208
|
/** Errors validation; outOfDate is distinguished by an outdated verification result. */
|
|
@@ -111,11 +216,17 @@ export interface FormProps<Values extends FormValues> extends Omit<HTMLFormAttri
|
|
|
111
216
|
onError?: (error: unknown) => void;
|
|
112
217
|
/** Semantic slots classes accumulate after ConfigProvider.form.classNames. */
|
|
113
218
|
classNames?: FormSemantic;
|
|
114
|
-
/**
|
|
115
|
-
styles?: FormSemantic
|
|
219
|
+
/** Authored styles for the root and field slots. Local declarations follow the provider. */
|
|
220
|
+
styles?: FormSemantic<FormStyle>;
|
|
221
|
+
/** Inline declarations for the form root. */
|
|
222
|
+
style?: FormStyle;
|
|
116
223
|
/** Additional class native wrapper; component = false does not create root. */
|
|
117
224
|
rootClassName?: string;
|
|
118
225
|
class?: string;
|
|
119
226
|
}
|
|
227
|
+
/** Actual Form component props also allow an empty form or a render-only form. */
|
|
228
|
+
export type FormComponentProps<Values extends FormValues> = Omit<FormProps<Values>, 'children'> & {
|
|
229
|
+
children?: Snippet;
|
|
230
|
+
};
|
|
120
231
|
/** Defaults Form; undefined inherits parent record, {} replaces it. */
|
|
121
232
|
export type FormConfig = Pick<FormProps<FormValues>, 'colon' | 'labelAlign' | 'labelWrap' | 'requiredMark' | 'class' | 'style' | 'classNames' | 'styles' | 'scrollToFirstError' | 'tooltip' | 'validateMessages'>;
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import type { FormValues, ValidationRule } from './validation.engine';
|
|
2
|
-
import type { ValidateMessages } from './validation-messages.types';
|
|
2
|
+
import type { FormFieldMessages, FormValidationMessage, ValidateMessages } from './validation-messages.types';
|
|
3
3
|
export interface ValidationMessageContext {
|
|
4
4
|
readonly name?: string;
|
|
5
5
|
readonly variables?: Readonly<Record<string, string>>;
|
|
6
6
|
readonly messages?: ValidateMessages;
|
|
7
7
|
}
|
|
8
|
+
/** Preserves the string API without evaluating a snippet outside component rendering. */
|
|
9
|
+
export declare function validationMessageTexts(messages: readonly FormValidationMessage[]): readonly string[];
|
|
10
|
+
/** Exposes the full list only when the text projection omits rendered content. */
|
|
11
|
+
export declare function richValidationMessages(messages: readonly FormValidationMessage[]): readonly FormValidationMessage[] | undefined;
|
|
12
|
+
/** Copies message records at model boundaries while retaining the original snippet. */
|
|
13
|
+
export declare function copyValidationMessages(messages: readonly FormValidationMessage[]): (string | import("svelte").Snippet<[]> | {
|
|
14
|
+
text: string;
|
|
15
|
+
content: import("svelte").Snippet<[]>;
|
|
16
|
+
})[];
|
|
17
|
+
/** Detaches field snapshots and keeps their string-only shape for ordinary messages. */
|
|
18
|
+
export declare function snapshotValidationMessages(errors?: readonly FormValidationMessage[], warnings?: readonly FormValidationMessage[]): FormFieldMessages & {
|
|
19
|
+
errors: string[];
|
|
20
|
+
warnings: string[];
|
|
21
|
+
};
|
|
8
22
|
/** Locale and ConfigProvider unite groups; Form replaces their top-level spread separately. */
|
|
9
23
|
export declare function mergeValidationMessages(...layers: readonly (ValidateMessages | undefined)[]): ValidateMessages;
|
|
10
24
|
/** Template formatting is adapted from async-validator; MIT: vendor/LICENSE.rc-async-validator. */
|
|
11
|
-
export declare function resolveValidationMessage<Values extends FormValues>(rule: ValidationRule<Values>, context: ValidationMessageContext | undefined, path: string | readonly [string, string], fallback: string, args?: readonly unknown[]):
|
|
25
|
+
export declare function resolveValidationMessage<Values extends FormValues>(rule: ValidationRule<Values>, context: ValidationMessageContext | undefined, path: string | readonly [string, string], fallback: string, args?: readonly unknown[]): FormValidationMessage;
|
|
12
26
|
/** rc-form single-pass substitution. A backslash preserves the literal ${variable}. */
|
|
13
|
-
export declare function formatValidationMessages<Values extends FormValues>(messages: readonly
|
|
27
|
+
export declare function formatValidationMessages<Values extends FormValues>(messages: readonly FormValidationMessage[], rule: ValidationRule<Values>, context?: ValidationMessageContext): readonly FormValidationMessage[];
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
/** Preserves the string API without evaluating a snippet outside component rendering. */
|
|
2
|
+
export function validationMessageTexts(messages) {
|
|
3
|
+
if (messages.every(message => typeof message === 'string')) {
|
|
4
|
+
return messages;
|
|
5
|
+
}
|
|
6
|
+
return messages.map(message => {
|
|
7
|
+
if (typeof message === 'function')
|
|
8
|
+
return '';
|
|
9
|
+
return message !== null && typeof message === 'object' ? message.text : message;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** Exposes the full list only when the text projection omits rendered content. */
|
|
13
|
+
export function richValidationMessages(messages) {
|
|
14
|
+
const hasContent = messages.some(message => typeof message === 'function'
|
|
15
|
+
|| message !== null && typeof message === 'object');
|
|
16
|
+
return hasContent ? messages : undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Copies message records at model boundaries while retaining the original snippet. */
|
|
19
|
+
export function copyValidationMessages(messages) {
|
|
20
|
+
return Array.from(messages, message => {
|
|
21
|
+
if (message === null || typeof message !== 'object')
|
|
22
|
+
return message;
|
|
23
|
+
return { text: message.text, content: message.content };
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Detaches field snapshots and keeps their string-only shape for ordinary messages. */
|
|
27
|
+
export function snapshotValidationMessages(errors = [], warnings = []) {
|
|
28
|
+
const errorMessages = richValidationMessages(errors);
|
|
29
|
+
const warningMessages = richValidationMessages(warnings);
|
|
30
|
+
return {
|
|
31
|
+
errors: [...validationMessageTexts(errors)],
|
|
32
|
+
warnings: [...validationMessageTexts(warnings)],
|
|
33
|
+
...(errorMessages && { errorMessages: copyValidationMessages(errorMessages) }),
|
|
34
|
+
...(warningMessages && { warningMessages: copyValidationMessages(warningMessages) })
|
|
35
|
+
};
|
|
36
|
+
}
|
|
1
37
|
/** Locale and ConfigProvider unite groups; Form replaces their top-level spread separately. */
|
|
2
38
|
export function mergeValidationMessages(...layers) {
|
|
3
39
|
let merged = {};
|
|
@@ -66,7 +102,7 @@ export function resolveValidationMessage(rule, context, path, fallback, args = [
|
|
|
66
102
|
}
|
|
67
103
|
/** rc-form single-pass substitution. A backslash preserves the literal ${variable}. */
|
|
68
104
|
export function formatValidationMessages(messages, rule, context) {
|
|
69
|
-
if (!messages.some(message => message.includes('${'))) {
|
|
105
|
+
if (!messages.some(message => typeof message === 'string' && message.includes('${'))) {
|
|
70
106
|
return messages;
|
|
71
107
|
}
|
|
72
108
|
const variables = {
|
|
@@ -77,7 +113,8 @@ export function formatValidationMessages(messages, rule, context) {
|
|
|
77
113
|
.join(', ') : '',
|
|
78
114
|
...context?.variables
|
|
79
115
|
};
|
|
80
|
-
return messages.map(message => message
|
|
116
|
+
return messages.map(message => typeof message === 'string'
|
|
117
|
+
? message.replace(/\\?\$\{\w+\}/g, substituteVariable) : message);
|
|
81
118
|
// Substitutes only the context's own variables. A backslash preserves the literal.
|
|
82
119
|
function substituteVariable(placeholder) {
|
|
83
120
|
if (placeholder.startsWith('\\')) {
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
/** Rule content can carry explicit text for consumers that read only the string metadata. */
|
|
3
|
+
export type FormValidationMessage = string | Snippet | {
|
|
4
|
+
readonly text: string;
|
|
5
|
+
readonly content: Snippet;
|
|
6
|
+
};
|
|
7
|
+
/** When present, a message list includes the strings and snippets in their original order. */
|
|
8
|
+
export interface FormFieldMessages {
|
|
9
|
+
errorMessages?: readonly FormValidationMessage[];
|
|
10
|
+
warningMessages?: readonly FormValidationMessage[];
|
|
11
|
+
}
|
|
1
12
|
/** Message pattern; function is called when the corresponding Sext error is errors. */
|
|
2
13
|
export type ValidateMessage = string | (() => string);
|
|
3
14
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { FormValues, ValidationRule } from './validation.engine';
|
|
2
|
+
import type { FormValidationMessage } from './validation-messages.types';
|
|
2
3
|
import { type ValidationMessageContext } from './validation-message.engine';
|
|
3
4
|
export interface ValidationMessages {
|
|
4
|
-
errors:
|
|
5
|
-
warnings:
|
|
5
|
+
errors: FormValidationMessage[];
|
|
6
|
+
warnings: FormValidationMessage[];
|
|
6
7
|
}
|
|
7
8
|
export interface ValidationAncestor {
|
|
8
9
|
readonly rule: object;
|
|
@@ -10,6 +11,6 @@ export interface ValidationAncestor {
|
|
|
10
11
|
readonly parent?: ValidationAncestor;
|
|
11
12
|
}
|
|
12
13
|
type ValidateChildren<Values extends FormValues> = (value: unknown, rules: readonly ValidationRule<Values>[], ancestor: ValidationAncestor, key: string) => Promise<ValidationMessages>;
|
|
13
|
-
export declare function collectValidationMessages<Values extends FormValues>(rule: ValidationRule<Values>, own: readonly
|
|
14
|
-
export declare function validateNestedRule<Values extends FormValues>(value: unknown, original: unknown, rule: ValidationRule<Values>, own: readonly
|
|
14
|
+
export declare function collectValidationMessages<Values extends FormValues>(rule: ValidationRule<Values>, own: readonly FormValidationMessage[], children: readonly ValidationMessages[]): ValidationMessages;
|
|
15
|
+
export declare function validateNestedRule<Values extends FormValues>(value: unknown, original: unknown, rule: ValidationRule<Values>, own: readonly FormValidationMessage[], validate: ValidateChildren<Values>, ancestor?: ValidationAncestor, identity?: object, context?: ValidationMessageContext): Promise<ValidationMessages>;
|
|
15
16
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ValidationRuleType } from './validation-type.engine';
|
|
2
2
|
import type { FormInstance } from './form.model.svelte';
|
|
3
|
+
import type { FormFieldMessages, FormValidationMessage } from './validation-messages.types';
|
|
4
|
+
import { type ValidationMessages } from './validation-nested.engine';
|
|
3
5
|
import { type ValidationMessageContext } from './validation-message.engine';
|
|
4
6
|
export type { ValidationRuleType } from './validation-type.engine';
|
|
5
7
|
/** The value of the field can be a scalar, an attached container or an instance of a class. */
|
|
@@ -12,6 +14,8 @@ export interface ValidationRule<Values extends FormValues = FormValues> {
|
|
|
12
14
|
required?: boolean;
|
|
13
15
|
/** By default false; the message falls into the warnings and does not block submit. */
|
|
14
16
|
warningOnly?: boolean;
|
|
17
|
+
/** Filters control events. Explicit and dependency validation still run this rule. */
|
|
18
|
+
validateTrigger?: string | readonly string[];
|
|
15
19
|
min?: number;
|
|
16
20
|
max?: number;
|
|
17
21
|
/** The exact number/length; the date compares timestamp. Priority over min/max. */
|
|
@@ -25,7 +29,8 @@ export interface ValidationRule<Values extends FormValues = FormValues> {
|
|
|
25
29
|
fields?: Readonly<Record<string, ValidationRule<Values> | readonly ValidationRule<Values>[]>>;
|
|
26
30
|
/** The rule of array elements; for object is applied to keys without its own fields rule. */
|
|
27
31
|
defaultField?: ValidationRule<Values>;
|
|
28
|
-
|
|
32
|
+
/** Text or a Svelte snippet rendered when this rule reports a failure. */
|
|
33
|
+
message?: FormValidationMessage;
|
|
29
34
|
/** Synchronously converts the value only for this rule, without recording the result in Form. */
|
|
30
35
|
transform?: (value: FormValue) => FormValue;
|
|
31
36
|
/** An explicit type replaces built-in validation while retaining the native value/values signature. */
|
|
@@ -38,13 +43,10 @@ export type FormRules<Values extends FormValues> = Partial<Record<FieldName<Valu
|
|
|
38
43
|
export declare function resolveValidationRules<Values extends FormValues>(rules: readonly FormRule<Values>[], form: FormInstance<Values>): readonly ValidationRule<Values>[];
|
|
39
44
|
export type FieldErrors<Values extends FormValues> = Partial<Record<FieldName<Values>, string[]>>;
|
|
40
45
|
/** Field errors retain the original path segments, including the difference between strings and numbers. */
|
|
41
|
-
export interface FieldError {
|
|
46
|
+
export interface FieldError extends FormFieldMessages {
|
|
42
47
|
name: (string | number)[];
|
|
43
48
|
errors: string[];
|
|
44
49
|
warnings: string[];
|
|
45
50
|
}
|
|
46
51
|
export declare function validateValue<Values extends FormValues>(value: FormValue, values: Readonly<Values>, rules: readonly ValidationRule<Values>[]): Promise<string[]>;
|
|
47
|
-
export declare function validateFieldValue<Values extends FormValues>(value: FormValue, values: Readonly<Values>, rules: readonly ValidationRule<Values>[], validateFirst?: boolean | 'parallel', context?: ValidationMessageContext): Promise<
|
|
48
|
-
errors: string[];
|
|
49
|
-
warnings: string[];
|
|
50
|
-
}>;
|
|
52
|
+
export declare function validateFieldValue<Values extends FormValues>(value: FormValue, values: Readonly<Values>, rules: readonly ValidationRule<Values>[], validateFirst?: boolean | 'parallel', context?: ValidationMessageContext): Promise<ValidationMessages>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { matchesValidationType, normalizeValidationType } from './validation-type.engine';
|
|
4
4
|
import { matchesValidationPattern } from './validation-format.engine';
|
|
5
5
|
import { collectValidationMessages, validateNestedRule } from './validation-nested.engine';
|
|
6
|
-
import { formatValidationMessages, resolveValidationMessage } from './validation-message.engine';
|
|
6
|
+
import { formatValidationMessages, resolveValidationMessage, validationMessageTexts } from './validation-message.engine';
|
|
7
7
|
// Reveals factories relative to the current Form, keeping an array without factories.
|
|
8
8
|
export function resolveValidationRules(rules, form) {
|
|
9
9
|
// Object-only arrays retain their existing identity and capture semantics.
|
|
@@ -15,7 +15,7 @@ export function resolveValidationRules(rules, form) {
|
|
|
15
15
|
// Returns blocking messages for the previous flat API check.
|
|
16
16
|
export async function validateValue(value, values, rules) {
|
|
17
17
|
const result = await validateFieldValue(value, values, rules);
|
|
18
|
-
return result.errors;
|
|
18
|
+
return [...validationMessageTexts(result.errors)];
|
|
19
19
|
}
|
|
20
20
|
// Begins to check the field without the state of recursion on the nested values.
|
|
21
21
|
export async function validateFieldValue(value, values, rules, validateFirst = false, context) {
|
package/dist/grid/Col.svelte
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useConfig } from '../config-provider/config-context';
|
|
3
3
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
4
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
5
|
-
import { getGridMediaScope } from './grid-style.engine';
|
|
4
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
6
5
|
import { getGridColPrefixCss, getGridColPrefixScope } from './grid-col-prefix.engine';
|
|
7
6
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
8
7
|
import { useGridRow } from './grid-context';
|
|
9
|
-
import { gridColClasses, gridHalfGutter, parseGridFlex } from './grid.engine';
|
|
8
|
+
import { gridColClasses, gridHalfGutter, gridInlineStyle, parseGridFlex } from './grid.engine';
|
|
10
9
|
import type { ColProps } from './grid.types';
|
|
11
10
|
|
|
12
11
|
let {
|
|
@@ -38,12 +37,11 @@
|
|
|
38
37
|
let prefixScope = $derived(getGridColPrefixScope(
|
|
39
38
|
componentPrefix, rootPrefix, designTokens.state.token
|
|
40
39
|
));
|
|
41
|
-
|
|
40
|
+
const runtimeStyles = useRuntimeStyles();
|
|
41
|
+
let prefixCss = $derived(runtimeStyles && getGridColPrefixCss(
|
|
42
42
|
componentPrefix, rootPrefix, designTokens.state.token
|
|
43
43
|
));
|
|
44
|
-
let
|
|
45
|
-
? getGridMediaScope(designTokens.state.token) : undefined);
|
|
46
|
-
let styleScope = $derived(prefixScope ?? mediaScope);
|
|
44
|
+
let styleScope = $derived(prefixScope ?? config.gridMediaScope);
|
|
47
45
|
const row = useGridRow();
|
|
48
46
|
let responsive = $derived(
|
|
49
47
|
gridColClasses(
|
|
@@ -51,8 +49,18 @@
|
|
|
51
49
|
componentPrefix, rootPrefix
|
|
52
50
|
)
|
|
53
51
|
);
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const colStyle = $derived.by(() => {
|
|
53
|
+
const layout: { paddingInline?: string; flex?: string; minWidth?: number; } = {};
|
|
54
|
+
const padding = gridHalfGutter(row?.gutter[0]);
|
|
55
|
+
if (padding !== undefined) layout.paddingInline = padding;
|
|
56
|
+
|
|
57
|
+
if (flex || flex === 0) {
|
|
58
|
+
layout.flex = parseGridFlex(flex);
|
|
59
|
+
if (row?.wrap === false) layout.minWidth = 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return gridInlineStyle(componentTheme.style, layout, style, responsive.variables);
|
|
63
|
+
});
|
|
56
64
|
</script>
|
|
57
65
|
|
|
58
66
|
{#if prefixCss}<ThemeScopeStyle css={prefixCss} scope={`grid-col-prefix:${prefixScope}`} />{/if}<div {...rest} {...responsive.attributes} bind:this={nativeElement} dir={config.direction} class={[
|
|
@@ -63,17 +71,6 @@
|
|
|
63
71
|
config.direction === 'rtl' && `${componentPrefix}-rtl`,
|
|
64
72
|
className
|
|
65
73
|
]}
|
|
66
|
-
style={
|
|
67
|
-
componentTheme.style,
|
|
68
|
-
padding && `padding-inline:${padding}`,
|
|
69
|
-
hasFlex && `flex:${parseGridFlex(flex!)}`,
|
|
70
|
-
hasFlex && row?.wrap === false && 'min-width:0',
|
|
71
|
-
style,
|
|
72
|
-
responsive.variables
|
|
73
|
-
].filter(
|
|
74
|
-
Boolean
|
|
75
|
-
).join(
|
|
76
|
-
';'
|
|
77
|
-
)}>
|
|
74
|
+
style={colStyle}>
|
|
78
75
|
{@render children?.()}
|
|
79
76
|
</div>
|
package/dist/grid/Row.svelte
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
5
5
|
import { getGridRowPrefixCss } from './grid-row-prefix.engine';
|
|
6
6
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
7
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
7
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
8
8
|
import { createBreakpoint } from './grid-breakpoint.model.svelte.js';
|
|
9
9
|
import { provideGridRow } from './grid-context';
|
|
10
10
|
import {
|
|
11
|
-
getGridMediaQueries, gridGutters, gridHalfGutter, gridResponsiveValue
|
|
11
|
+
getGridMediaQueries, gridGutters, gridHalfGutter, gridInlineStyle, gridResponsiveValue
|
|
12
12
|
} from './grid.engine';
|
|
13
13
|
import type { RowProps } from './grid.types';
|
|
14
14
|
|
|
@@ -21,12 +21,15 @@
|
|
|
21
21
|
wrap,
|
|
22
22
|
class: className = '',
|
|
23
23
|
style,
|
|
24
|
+
dir,
|
|
24
25
|
nativeElement = $bindable(),
|
|
25
26
|
...rest
|
|
26
27
|
}: RowProps = $props();
|
|
27
28
|
const config = useConfig();
|
|
28
29
|
let componentPrefix = $derived(config.getPrefixCls('row', prefixCls));
|
|
29
|
-
|
|
30
|
+
const runtimeStyles = useRuntimeStyles();
|
|
31
|
+
const hasCustomPrefix = $derived(componentPrefix !== 'ant-row');
|
|
32
|
+
let prefixCss = $derived(runtimeStyles && getGridRowPrefixCss(componentPrefix));
|
|
30
33
|
const componentTheme = useComponentTheme('Grid');
|
|
31
34
|
const designTokens = useDesignTokenContext();
|
|
32
35
|
const breakpoint = createBreakpoint();
|
|
@@ -40,6 +43,10 @@
|
|
|
40
43
|
let justification = $derived(gridResponsiveValue(justify, screens));
|
|
41
44
|
let margin = $derived(gridHalfGutter(gutters[0], true));
|
|
42
45
|
let rowGap = $derived(typeof gutters[1] === 'number' ? `${gutters[1]}px` : gutters[1]);
|
|
46
|
+
const rowStyle = $derived.by(() => {
|
|
47
|
+
const layout = margin === undefined ? { rowGap } : { marginInline: margin, rowGap };
|
|
48
|
+
return gridInlineStyle(componentTheme.style, layout, style);
|
|
49
|
+
});
|
|
43
50
|
provideGridRow({
|
|
44
51
|
get gutter() {
|
|
45
52
|
return gutters;
|
|
@@ -51,8 +58,8 @@
|
|
|
51
58
|
$effect(() => breakpoint.connect(window, mediaQueries));
|
|
52
59
|
</script>
|
|
53
60
|
|
|
54
|
-
{#if prefixCss}<ThemeScopeStyle css={prefixCss} scope={`grid-row-prefix:${componentPrefix}`} />{/if}<div {...rest} bind:this={nativeElement} dir={config.direction}
|
|
55
|
-
data-ant-grid-row-prefix={
|
|
61
|
+
{#if prefixCss}<ThemeScopeStyle css={prefixCss} scope={`grid-row-prefix:${componentPrefix}`} />{/if}<div {...rest} bind:this={nativeElement} dir={dir ?? config.direction}
|
|
62
|
+
data-ant-grid-row-prefix={hasCustomPrefix ? componentPrefix : undefined}
|
|
56
63
|
class={[
|
|
57
64
|
`${componentPrefix} ant-grid-css-var`,
|
|
58
65
|
componentTheme.className,
|
|
@@ -62,15 +69,6 @@
|
|
|
62
69
|
config.direction === 'rtl' && `${componentPrefix}-rtl`,
|
|
63
70
|
className
|
|
64
71
|
]}
|
|
65
|
-
style={
|
|
66
|
-
componentTheme.style,
|
|
67
|
-
margin && `margin-inline:${margin}`,
|
|
68
|
-
rowGap !== undefined && `row-gap:${rowGap}`,
|
|
69
|
-
style
|
|
70
|
-
].filter(
|
|
71
|
-
Boolean
|
|
72
|
-
).join(
|
|
73
|
-
';'
|
|
74
|
-
)}>
|
|
72
|
+
style={rowStyle}>
|
|
75
73
|
{@render children?.()}
|
|
76
74
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ColProps, GridGap, GridGutter, GridResponsive, GridScreenMap } from './grid.types';
|
|
2
2
|
import type { AliasToken } from '../theme/theme-token.types';
|
|
3
3
|
import type { GridBreakpoint } from './grid.types';
|
|
4
|
+
import type { CSSProperties, CSSStyle } from '../style/inline-style.types';
|
|
4
5
|
export declare const gridBreakpoints: readonly ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"];
|
|
5
6
|
export declare const gridMediaQueries: {
|
|
6
7
|
readonly xs: "(max-width: 575px)";
|
|
@@ -19,8 +20,10 @@ export declare function gridGutters(gutter: GridGutter | [GridGutter, GridGutter
|
|
|
19
20
|
export declare function parseGridFlex(value: string | number): string;
|
|
20
21
|
export declare function gridColClasses(props: ColProps, prefix?: string, rootPrefix?: string): {
|
|
21
22
|
classes: string[];
|
|
22
|
-
variables: string
|
|
23
|
+
variables: Record<`--${string}`, string>;
|
|
23
24
|
attributes: Record<string, string>;
|
|
24
25
|
};
|
|
26
|
+
/** Keeps object spread priority and preserves declaration order in authored CSS text. */
|
|
27
|
+
export declare function gridInlineStyle(theme: string | undefined, layout: CSSProperties, style: CSSStyle | undefined, responsive?: CSSProperties): string;
|
|
25
28
|
export declare function gridHalfGutter(value: GridGap, negative?: boolean): string | undefined;
|
|
26
29
|
export {};
|
package/dist/grid/grid.engine.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { inlineStyleText } from '../style/inline-style-layers.engine';
|
|
2
|
+
import { serializeCssProperties } from '../style/inline-style.engine';
|
|
1
3
|
export const gridBreakpoints = ['xxxl', 'xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
2
4
|
export const gridMediaQueries = {
|
|
3
5
|
xs: '(max-width: 575px)',
|
|
@@ -75,7 +77,7 @@ export function parseGridFlex(value) {
|
|
|
75
77
|
// Collects responsive classes, attributes and column variables without access to DOM.
|
|
76
78
|
export function gridColClasses(props, prefix = 'ant-col', rootPrefix = 'ant') {
|
|
77
79
|
const classes = [];
|
|
78
|
-
const variables =
|
|
80
|
+
const variables = {};
|
|
79
81
|
const attributes = {};
|
|
80
82
|
const namespace = rootPrefix.replace(/\./g, '');
|
|
81
83
|
if (props.span !== undefined) {
|
|
@@ -100,12 +102,22 @@ export function gridColClasses(props, prefix = 'ant-col', rootPrefix = 'ant') {
|
|
|
100
102
|
classes.push(`${prefix}-${breakpoint}-${key}-${options[key]}`);
|
|
101
103
|
if (options.flex || options.flex === 0) {
|
|
102
104
|
classes.push(`${prefix}-${breakpoint}-flex`);
|
|
103
|
-
|
|
105
|
+
const property = `--${namespace}-col-${breakpoint}-flex`;
|
|
106
|
+
variables[property] = parseGridFlex(options.flex);
|
|
104
107
|
}
|
|
105
108
|
if (classes.length !== previous)
|
|
106
109
|
attributes[`data-ant-col-${breakpoint}`] = '';
|
|
107
110
|
}
|
|
108
|
-
return { classes, variables
|
|
111
|
+
return { classes, variables, attributes };
|
|
112
|
+
}
|
|
113
|
+
/** Keeps object spread priority and preserves declaration order in authored CSS text. */
|
|
114
|
+
export function gridInlineStyle(theme, layout, style, responsive) {
|
|
115
|
+
if (style && typeof style === 'object') {
|
|
116
|
+
return inlineStyleText(theme, layout, style, responsive);
|
|
117
|
+
}
|
|
118
|
+
const layoutText = serializeCssProperties(layout);
|
|
119
|
+
const responsiveText = responsive && serializeCssProperties(responsive);
|
|
120
|
+
return inlineStyleText(theme, layoutText, style, responsiveText);
|
|
109
121
|
}
|
|
110
122
|
// Divides the gutter in half and chooses a sign for the Row and Col indentations.
|
|
111
123
|
export function gridHalfGutter(value, negative = false) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GridScreenMap } from './grid.types';
|
|
2
|
+
/** Returns the reactive breakpoint map for the calling component. */
|
|
3
|
+
declare function useBreakpoint(): Readonly<GridScreenMap>;
|
|
4
|
+
export declare const Grid: {
|
|
5
|
+
useBreakpoint: typeof useBreakpoint;
|
|
6
|
+
};
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Connects the public Grid hook to its owner component and the nearest global theme tokens.
|
|
2
|
+
import { untrack } from 'svelte';
|
|
3
|
+
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
4
|
+
import { createBreakpoint } from './grid-breakpoint.model.svelte.js';
|
|
5
|
+
import { getGridMediaQueries } from './grid.engine';
|
|
6
|
+
/** Returns the reactive breakpoint map for the calling component. */
|
|
7
|
+
function useBreakpoint() {
|
|
8
|
+
const designTokens = useDesignTokenContext();
|
|
9
|
+
const breakpoint = createBreakpoint();
|
|
10
|
+
const queries = $derived(designTokens.enabled
|
|
11
|
+
? getGridMediaQueries(designTokens.state.token)
|
|
12
|
+
: undefined);
|
|
13
|
+
// Read the lazy queries during initialization so invalid tokens also fail during SSR.
|
|
14
|
+
untrack(() => queries);
|
|
15
|
+
// The view keeps its identity while its keys and values follow the current media snapshot.
|
|
16
|
+
const screens = new Proxy({}, {
|
|
17
|
+
get: (_target, key) => Reflect.get(breakpoint.screens, key),
|
|
18
|
+
has: (_target, key) => Reflect.has(breakpoint.screens, key),
|
|
19
|
+
ownKeys: () => Reflect.ownKeys(breakpoint.screens),
|
|
20
|
+
getOwnPropertyDescriptor: (_target, key) => Reflect.getOwnPropertyDescriptor(breakpoint.screens, key),
|
|
21
|
+
set: () => false,
|
|
22
|
+
deleteProperty: () => false,
|
|
23
|
+
defineProperty: () => false,
|
|
24
|
+
preventExtensions: () => false,
|
|
25
|
+
setPrototypeOf: () => false
|
|
26
|
+
});
|
|
27
|
+
$effect(() => breakpoint.connect(window, queries));
|
|
28
|
+
return screens;
|
|
29
|
+
}
|
|
30
|
+
export const Grid = { useBreakpoint };
|