@qw-ui/core 0.3.0-next.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -37
- package/dist/action-sheet/action-sheet.d.ts +110 -0
- package/dist/action-sheet/index.d.ts +2 -0
- package/dist/action-sheet/index.js +2 -0
- package/dist/action-sheet-Cvcr1S_m.js +183 -0
- package/dist/action-sheet-Cvcr1S_m.js.map +1 -0
- package/dist/area-picker/area-picker.d.ts +113 -0
- package/dist/area-picker/index.d.ts +1 -0
- package/dist/area-picker/index.js +348 -0
- package/dist/area-picker/index.js.map +1 -0
- package/dist/aria-description-CimD2M_C.js +13 -0
- package/dist/aria-description-CimD2M_C.js.map +1 -0
- package/dist/aria-description.d.ts +2 -0
- package/dist/avatar/avatar-load.d.ts +76 -0
- package/dist/avatar/avatar.d.ts +22 -5
- package/dist/avatar/index.d.ts +1 -0
- package/dist/avatar/index.js +57 -18
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar-load-w9dq05oV.js +139 -0
- package/dist/avatar-load-w9dq05oV.js.map +1 -0
- package/dist/back-top/back-top.d.ts +77 -0
- package/dist/back-top/index.d.ts +1 -0
- package/dist/back-top/index.js +189 -0
- package/dist/back-top/index.js.map +1 -0
- package/dist/badge/badge.d.ts +85 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +88 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/button/button.d.ts +13 -0
- package/dist/button/index.js +3 -5
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/calendar.d.ts +100 -0
- package/dist/calendar/index.d.ts +1 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar-CmpK3stz.js +363 -0
- package/dist/calendar-CmpK3stz.js.map +1 -0
- package/dist/card/card.d.ts +68 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/card/index.js +2 -0
- package/dist/card-DRtWa6Cr.js +107 -0
- package/dist/card-DRtWa6Cr.js.map +1 -0
- package/dist/cascader/cascader.d.ts +115 -0
- package/dist/cascader/index.d.ts +1 -0
- package/dist/cascader/index.js +2 -0
- package/dist/cascader-D-xMjs7P.js +333 -0
- package/dist/cascader-D-xMjs7P.js.map +1 -0
- package/dist/cell/cell.d.ts +41 -0
- package/dist/cell/index.d.ts +1 -0
- package/dist/cell/index.js +43 -0
- package/dist/cell/index.js.map +1 -0
- package/dist/check-list/check-list.d.ts +78 -0
- package/dist/check-list/index.d.ts +2 -0
- package/dist/check-list/index.js +2 -0
- package/dist/check-list-BvZHQt5w.js +60 -0
- package/dist/check-list-BvZHQt5w.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +59 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox-BlndJrz5.js +127 -0
- package/dist/checkbox-BlndJrz5.js.map +1 -0
- package/dist/checkbox-group/checkbox-group.d.ts +86 -0
- package/dist/checkbox-group/index.d.ts +3 -0
- package/dist/checkbox-group/index.js +2 -0
- package/dist/checkbox-group-gGfsTv-e.js +223 -0
- package/dist/checkbox-group-gGfsTv-e.js.map +1 -0
- package/dist/choice-group-C4c9m0qe.js +373 -0
- package/dist/choice-group-C4c9m0qe.js.map +1 -0
- package/dist/circle/circle.d.ts +97 -0
- package/dist/circle/index.d.ts +1 -0
- package/dist/circle/index.js +119 -0
- package/dist/circle/index.js.map +1 -0
- package/dist/collapse/collapse.d.ts +98 -0
- package/dist/collapse/index.d.ts +2 -0
- package/dist/collapse/index.js +2 -0
- package/dist/collapse-B969h7-H.js +226 -0
- package/dist/collapse-B969h7-H.js.map +1 -0
- package/dist/countdown/countdown.d.ts +114 -0
- package/dist/countdown/index.d.ts +1 -0
- package/dist/countdown/index.js +309 -0
- package/dist/countdown/index.js.map +1 -0
- package/dist/date-picker/date-picker.d.ts +168 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +401 -0
- package/dist/date-picker/index.js.map +1 -0
- package/dist/descriptions/descriptions.d.ts +69 -0
- package/dist/descriptions/index.d.ts +1 -0
- package/dist/descriptions/index.js +86 -0
- package/dist/descriptions/index.js.map +1 -0
- package/dist/dialog/dialog.d.ts +61 -43
- package/dist/dialog/index.js +73 -19
- package/dist/dialog/index.js.map +1 -1
- package/dist/divider/divider.d.ts +18 -2
- package/dist/divider/index.js +20 -2
- package/dist/divider/index.js.map +1 -1
- package/dist/dropdown/dropdown.d.ts +172 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +467 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/ellipsis/ellipsis-layout.d.ts +34 -0
- package/dist/ellipsis/ellipsis.d.ts +88 -0
- package/dist/ellipsis/index.d.ts +2 -0
- package/dist/ellipsis/index.js +320 -0
- package/dist/ellipsis/index.js.map +1 -0
- package/dist/empty/empty-illustration.d.ts +3 -0
- package/dist/empty/empty.d.ts +43 -1
- package/dist/empty/index.js +2 -21
- package/dist/empty-CAgyvhUI.js +166 -0
- package/dist/empty-CAgyvhUI.js.map +1 -0
- package/dist/field/field.d.ts +95 -0
- package/dist/field/index.d.ts +2 -0
- package/dist/field/index.js +2 -0
- package/dist/field-DMHGIMZF.js +241 -0
- package/dist/field-DMHGIMZF.js.map +1 -0
- package/dist/floating-bubble/floating-bubble.d.ts +116 -0
- package/dist/floating-bubble/index.d.ts +1 -0
- package/dist/floating-bubble/index.js +333 -0
- package/dist/floating-bubble/index.js.map +1 -0
- package/dist/floating-panel/floating-panel.d.ts +80 -0
- package/dist/floating-panel/index.d.ts +2 -0
- package/dist/floating-panel/index.js +2 -0
- package/dist/floating-panel-Cbm5njBJ.js +363 -0
- package/dist/floating-panel-Cbm5njBJ.js.map +1 -0
- package/dist/footer/footer.d.ts +94 -0
- package/dist/footer/index.d.ts +1 -0
- package/dist/footer/index.js +154 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/form/connect.d.ts +6 -0
- package/dist/form/form.d.ts +100 -0
- package/dist/form/ids.d.ts +14 -0
- package/dist/form/index.d.ts +13 -0
- package/dist/form/index.js +3 -0
- package/dist/form/methods.d.ts +5 -0
- package/dist/form/model.d.ts +24 -0
- package/dist/form/native.d.ts +25 -0
- package/dist/form/rules.d.ts +40 -0
- package/dist/form/ssr.d.ts +7 -0
- package/dist/form/types.d.ts +150 -0
- package/dist/form-BAGkIEMY.js +1354 -0
- package/dist/form-BAGkIEMY.js.map +1 -0
- package/dist/format-BDUY0C_c.js +89 -0
- package/dist/format-BDUY0C_c.js.map +1 -0
- package/dist/gesture-_SRHIvBm.js +30 -0
- package/dist/gesture-_SRHIvBm.js.map +1 -0
- package/dist/grid/grid-item.d.ts +22 -0
- package/dist/grid/grid.d.ts +42 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +73 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/icon/icon.d.ts +37 -1
- package/dist/icon/identity.d.ts +3 -0
- package/dist/icon/index.js +2 -20
- package/dist/icon-Cgdbnk1u.js +77 -0
- package/dist/icon-Cgdbnk1u.js.map +1 -0
- package/dist/image/image-load.d.ts +24 -0
- package/dist/image/image.d.ts +45 -8
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +116 -14
- package/dist/image/index.js.map +1 -1
- package/dist/image-preview/image-preview.d.ts +124 -0
- package/dist/image-preview/index.d.ts +1 -0
- package/dist/image-preview/index.js +450 -0
- package/dist/image-preview/index.js.map +1 -0
- package/dist/index-bar/index-bar.d.ts +121 -0
- package/dist/index-bar/index.d.ts +1 -0
- package/dist/index-bar/index.js +386 -0
- package/dist/index-bar/index.js.map +1 -0
- package/dist/index.d.ts +115 -10
- package/dist/index.js +151 -11
- package/dist/index.js.map +1 -0
- package/dist/infinite-scroll/index.d.ts +1 -0
- package/dist/infinite-scroll/index.js +248 -0
- package/dist/infinite-scroll/index.js.map +1 -0
- package/dist/infinite-scroll/infinite-scroll.d.ts +95 -0
- package/dist/input/index.js +181 -22
- package/dist/input/index.js.map +1 -1
- package/dist/input/input.d.ts +44 -1
- package/dist/layer-IpFrl5--.js +414 -0
- package/dist/layer-IpFrl5--.js.map +1 -0
- package/dist/layout-BRSqi4AQ.js +43 -0
- package/dist/layout-BRSqi4AQ.js.map +1 -0
- package/dist/layout.d.ts +13 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/list.d.ts +30 -0
- package/dist/list-6-iz-Irh.js +28 -0
- package/dist/list-6-iz-Irh.js.map +1 -0
- package/dist/loading/index.js +45 -2
- package/dist/loading/index.js.map +1 -1
- package/dist/loading/loading.d.ts +45 -2
- package/dist/modal-dialog-machine-CF9_z3Dm.js +487 -0
- package/dist/modal-dialog-machine-CF9_z3Dm.js.map +1 -0
- package/dist/modal-dialog-machine.d.ts +21 -0
- package/dist/modal-dismissable-lifetime.d.ts +21 -0
- package/dist/modal-registry.d.ts +24 -0
- package/dist/modal-render-hydration.d.ts +35 -0
- package/dist/modal-render-runtime.d.ts +19 -0
- package/dist/modal-render-scope.d.ts +63 -0
- package/dist/nav-bar/index.d.ts +1 -0
- package/dist/nav-bar/index.js +115 -0
- package/dist/nav-bar/index.js.map +1 -0
- package/dist/nav-bar/nav-bar.d.ts +76 -0
- package/dist/notice-bar/index.d.ts +2 -0
- package/dist/notice-bar/index.js +2 -0
- package/dist/notice-bar/notice-bar.d.ts +103 -0
- package/dist/notice-bar-DMpwLvRb.js +231 -0
- package/dist/notice-bar-DMpwLvRb.js.map +1 -0
- package/dist/notify/index.d.ts +1 -0
- package/dist/notify/index.js +251 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/notify.d.ts +123 -0
- package/dist/number-keyboard/index.d.ts +1 -0
- package/dist/number-keyboard/index.js +333 -0
- package/dist/number-keyboard/index.js.map +1 -0
- package/dist/number-keyboard/number-keyboard.d.ts +141 -0
- package/dist/overlay-panel/index.d.ts +2 -0
- package/dist/overlay-panel/index.js +2 -0
- package/dist/overlay-panel/overlay-panel.d.ts +20 -0
- package/dist/overlay-panel-Z_qdKeBj.js +26 -0
- package/dist/overlay-panel-Z_qdKeBj.js.map +1 -0
- package/dist/page-indicator/index.d.ts +1 -0
- package/dist/page-indicator/index.js +138 -0
- package/dist/page-indicator/index.js.map +1 -0
- package/dist/page-indicator/page-indicator.d.ts +93 -0
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/index.js +198 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/pagination.d.ts +125 -0
- package/dist/password-input/index.d.ts +1 -0
- package/dist/password-input/index.js +317 -0
- package/dist/password-input/index.js.map +1 -0
- package/dist/password-input/password-input.d.ts +144 -0
- package/dist/picker/index.d.ts +8 -0
- package/dist/picker/index.js +2 -0
- package/dist/picker/picker-machine.d.ts +80 -0
- package/dist/picker/picker.d.ts +121 -0
- package/dist/picker/platform.d.ts +84 -0
- package/dist/picker/selection-connect.d.ts +90 -0
- package/dist/picker/selection-model.d.ts +211 -0
- package/dist/picker-BykFntQN.js +1675 -0
- package/dist/picker-BykFntQN.js.map +1 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +253 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/layer.d.ts +44 -0
- package/dist/popover/popover.d.ts +104 -0
- package/dist/popover/positioning.d.ts +132 -0
- package/dist/popup/index.d.ts +2 -0
- package/dist/popup/index.js +2 -0
- package/dist/popup/popup.d.ts +60 -0
- package/dist/popup-z5d8IYCt.js +576 -0
- package/dist/popup-z5d8IYCt.js.map +1 -0
- package/dist/portal-BHCNTWhg.js +78 -0
- package/dist/portal-BHCNTWhg.js.map +1 -0
- package/dist/portal.d.ts +61 -0
- package/dist/price/format.d.ts +19 -0
- package/dist/price/index.d.ts +1 -0
- package/dist/price/index.js +154 -0
- package/dist/price/index.js.map +1 -0
- package/dist/price/price.d.ts +88 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/progress.d.ts +32 -0
- package/dist/progress-f3iYEfdA.js +37 -0
- package/dist/progress-f3iYEfdA.js.map +1 -0
- package/dist/pull-refresh/index.d.ts +1 -0
- package/dist/pull-refresh/index.js +414 -0
- package/dist/pull-refresh/index.js.map +1 -0
- package/dist/pull-refresh/pull-refresh.d.ts +118 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +2 -0
- package/dist/radio-group/radio-group.d.ts +78 -0
- package/dist/radio-group-BOIMuqnS.js +230 -0
- package/dist/radio-group-BOIMuqnS.js.map +1 -0
- package/dist/rate/index.d.ts +1 -0
- package/dist/rate/index.js +2 -0
- package/dist/rate/rate-form.d.ts +28 -0
- package/dist/rate/rate.d.ts +144 -0
- package/dist/rate-5XsU2QkY.js +631 -0
- package/dist/rate-5XsU2QkY.js.map +1 -0
- package/dist/reorder/index.d.ts +1 -0
- package/dist/reorder/index.js +720 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/reorder.d.ts +190 -0
- package/dist/result/index.d.ts +1 -0
- package/dist/result/index.js +123 -0
- package/dist/result/index.js.map +1 -0
- package/dist/result/result.d.ts +88 -0
- package/dist/safe-area/index.d.ts +1 -0
- package/dist/safe-area/index.js +42 -0
- package/dist/safe-area/index.js.map +1 -0
- package/dist/safe-area/safe-area.d.ts +28 -0
- package/dist/search-bar/index.js +4 -2
- package/dist/search-bar/index.js.map +1 -1
- package/dist/search-bar/search-bar.d.ts +6 -0
- package/dist/segmented/index.d.ts +2 -0
- package/dist/segmented/index.js +2 -0
- package/dist/segmented/segmented.d.ts +127 -0
- package/dist/segmented-BaU38_L4.js +367 -0
- package/dist/segmented-BaU38_L4.js.map +1 -0
- package/dist/selection-form-BOM_odUk.js +88 -0
- package/dist/selection-form-BOM_odUk.js.map +1 -0
- package/dist/selection-form.d.ts +27 -0
- package/dist/selection-ivXqO1eu.js +55 -0
- package/dist/selection-ivXqO1eu.js.map +1 -0
- package/dist/selection.d.ts +29 -0
- package/dist/selector/choice-group.d.ts +114 -0
- package/dist/selector/index.d.ts +2 -0
- package/dist/selector/index.js +2 -0
- package/dist/selector/selector.d.ts +90 -0
- package/dist/selector-BU2MMJ4N.js +93 -0
- package/dist/selector-BU2MMJ4N.js.map +1 -0
- package/dist/share-sheet/index.d.ts +1 -0
- package/dist/share-sheet/index.js +138 -0
- package/dist/share-sheet/index.js.map +1 -0
- package/dist/share-sheet/share-sheet.d.ts +139 -0
- package/dist/side-nav/index.d.ts +1 -0
- package/dist/side-nav/index.js +99 -0
- package/dist/side-nav/index.js.map +1 -0
- package/dist/side-nav/side-nav.d.ts +94 -0
- package/dist/skeleton/index.js +51 -2
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/skeleton.d.ts +34 -3
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +482 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slider/slider.d.ts +174 -0
- package/dist/space/index.d.ts +1 -0
- package/dist/space/index.js +52 -0
- package/dist/space/index.js.map +1 -0
- package/dist/space/space.d.ts +46 -0
- package/dist/statistic/index.d.ts +1 -0
- package/dist/statistic/index.js +152 -0
- package/dist/statistic/index.js.map +1 -0
- package/dist/statistic/statistic.d.ts +101 -0
- package/dist/stepper/index.d.ts +1 -0
- package/dist/stepper/index.js +172 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/stepper/stepper.d.ts +161 -0
- package/dist/steps/index.d.ts +1 -0
- package/dist/steps/index.js +72 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/steps.d.ts +67 -0
- package/dist/sticky/index.d.ts +1 -0
- package/dist/sticky/index.js +145 -0
- package/dist/sticky/index.js.map +1 -0
- package/dist/sticky/sticky.d.ts +70 -0
- package/dist/swipe-action/index.d.ts +1 -0
- package/dist/swipe-action/index.js +417 -0
- package/dist/swipe-action/index.js.map +1 -0
- package/dist/swipe-action/swipe-action.d.ts +148 -0
- package/dist/swiper/gesture.d.ts +32 -0
- package/dist/swiper/index.d.ts +1 -0
- package/dist/swiper/index.js +2 -0
- package/dist/swiper/swiper.d.ts +177 -0
- package/dist/swiper-BKivDkHp.js +550 -0
- package/dist/swiper-BKivDkHp.js.map +1 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +168 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/switch/switch.d.ts +142 -0
- package/dist/tabbar/index.d.ts +1 -0
- package/dist/tabbar/index.js +95 -0
- package/dist/tabbar/index.js.map +1 -0
- package/dist/tabbar/tabbar.d.ts +119 -0
- package/dist/tabs/index.js +22 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/tabs.d.ts +12 -8
- package/dist/tag/index.js +123 -2
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.d.ts +67 -1
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -242
- package/dist/textarea/platform.d.ts +22 -0
- package/dist/textarea/textarea.d.ts +169 -46
- package/dist/textarea-qbnruDUG.js +775 -0
- package/dist/textarea-qbnruDUG.js.map +1 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +228 -0
- package/dist/time-picker/index.js.map +1 -0
- package/dist/time-picker/time-picker.d.ts +83 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +131 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/timeline.d.ts +79 -0
- package/dist/toast/index.js +47 -4
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/toast.d.ts +26 -3
- package/dist/top-bar/index.js +16 -2
- package/dist/top-bar/index.js.map +1 -1
- package/dist/top-bar/top-bar.d.ts +13 -2
- package/dist/tree-select/index.d.ts +1 -0
- package/dist/tree-select/index.js +512 -0
- package/dist/tree-select/index.js.map +1 -0
- package/dist/tree-select/tree-select.d.ts +215 -0
- package/dist/typography/index.d.ts +1 -0
- package/dist/typography/index.js +82 -0
- package/dist/typography/index.js.map +1 -0
- package/dist/typography/typography.d.ts +54 -0
- package/dist/upload/index.d.ts +1 -0
- package/dist/upload/index.js +458 -0
- package/dist/upload/index.js.map +1 -0
- package/dist/upload/upload.d.ts +172 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +445 -0
- package/dist/virtual-list/index.js.map +1 -0
- package/dist/virtual-list/virtual-list.d.ts +160 -0
- package/dist/visual-manifest.d.ts +27 -0
- package/dist/watermark/index.d.ts +1 -0
- package/dist/watermark/index.js +260 -0
- package/dist/watermark/index.js.map +1 -0
- package/dist/watermark/watermark.d.ts +106 -0
- package/package.json +417 -44
- package/dist/empty/index.js.map +0 -1
- package/dist/icon/index.js.map +0 -1
- package/dist/textarea/index.js.map +0 -1
package/dist/empty/index.js
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Empty 契约 — 原型 A(无状态),core 无 machine 也无共享枚举。
|
|
4
|
-
* 本目录是 Empty 的"源头锚点":契约文档与 demo 清单在 ./docs/ 下维护,
|
|
5
|
-
* 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。
|
|
6
|
-
* 渲染契约:`data-scope="empty"`,data-part 为 root / icon / title / description / actions。
|
|
7
|
-
*
|
|
8
|
-
* data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
|
|
9
|
-
*/
|
|
10
|
-
/** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */
|
|
11
|
-
const EMPTY_PARTS = [
|
|
12
|
-
"root",
|
|
13
|
-
"icon",
|
|
14
|
-
"title",
|
|
15
|
-
"description",
|
|
16
|
-
"actions"
|
|
17
|
-
];
|
|
18
|
-
//#endregion
|
|
19
|
-
export { EMPTY_PARTS };
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { a as resolveEmptyState, i as getEmptyRootProps, n as getEmptyIllustration, r as getEmptyPartProps, t as EMPTY_PARTS } from "../empty-CAgyvhUI.js";
|
|
2
|
+
export { EMPTY_PARTS, getEmptyIllustration, getEmptyPartProps, getEmptyRootProps, resolveEmptyState };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
//#region src/empty/empty-illustration.ts
|
|
2
|
+
const EMPTY_ILLUSTRATION_ASSET = {
|
|
3
|
+
"tag": "svg",
|
|
4
|
+
"attrs": {
|
|
5
|
+
"viewBox": "0 0 120 120",
|
|
6
|
+
"width": "120",
|
|
7
|
+
"height": "120",
|
|
8
|
+
"fill": "none",
|
|
9
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
10
|
+
"aria-hidden": "true"
|
|
11
|
+
},
|
|
12
|
+
"children": [
|
|
13
|
+
{
|
|
14
|
+
"tag": "defs",
|
|
15
|
+
"attrs": {},
|
|
16
|
+
"children": [{
|
|
17
|
+
"tag": "linearGradient",
|
|
18
|
+
"attrs": {
|
|
19
|
+
"id": "doc",
|
|
20
|
+
"x1": "19",
|
|
21
|
+
"y1": "20",
|
|
22
|
+
"x2": "98.29",
|
|
23
|
+
"y2": "89.38",
|
|
24
|
+
"gradientUnits": "userSpaceOnUse"
|
|
25
|
+
},
|
|
26
|
+
"children": [{
|
|
27
|
+
"tag": "stop",
|
|
28
|
+
"attrs": {
|
|
29
|
+
"stop-color": "#222222",
|
|
30
|
+
"stop-opacity": "0.1"
|
|
31
|
+
},
|
|
32
|
+
"children": []
|
|
33
|
+
}, {
|
|
34
|
+
"tag": "stop",
|
|
35
|
+
"attrs": {
|
|
36
|
+
"offset": "1",
|
|
37
|
+
"stop-color": "#D8D8D8",
|
|
38
|
+
"stop-opacity": "0.02"
|
|
39
|
+
},
|
|
40
|
+
"children": []
|
|
41
|
+
}]
|
|
42
|
+
}, {
|
|
43
|
+
"tag": "linearGradient",
|
|
44
|
+
"attrs": {
|
|
45
|
+
"id": "wifi",
|
|
46
|
+
"x1": "66",
|
|
47
|
+
"y1": "75",
|
|
48
|
+
"x2": "101",
|
|
49
|
+
"y2": "99.58",
|
|
50
|
+
"gradientUnits": "userSpaceOnUse"
|
|
51
|
+
},
|
|
52
|
+
"children": [{
|
|
53
|
+
"tag": "stop",
|
|
54
|
+
"attrs": { "stop-color": "#CCCCCC" },
|
|
55
|
+
"children": []
|
|
56
|
+
}, {
|
|
57
|
+
"tag": "stop",
|
|
58
|
+
"attrs": {
|
|
59
|
+
"offset": "1",
|
|
60
|
+
"stop-color": "#EFEFEF"
|
|
61
|
+
},
|
|
62
|
+
"children": []
|
|
63
|
+
}]
|
|
64
|
+
}]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"tag": "path",
|
|
68
|
+
"attrs": {
|
|
69
|
+
"transform": "translate(19 20)",
|
|
70
|
+
"fill-rule": "evenodd",
|
|
71
|
+
"clip-rule": "evenodd",
|
|
72
|
+
"d": "M0 10C0 4.47715 4.47715 0 10 0H60C65.5229 0 70 4.47715 70 10V70C70 75.5229 65.5229 80 60 80H10C4.47715 80 0 75.5229 0 70V10ZM16 17.5C16 16.1193 17.1193 15 18.5 15H50.5C51.8807 15 53 16.1193 53 17.5C53 18.8807 51.8807 20 50.5 20H18.5C17.1193 20 16 18.8807 16 17.5ZM18.5 32C17.1193 32 16 33.1193 16 34.5C16 35.8807 17.1193 37 18.5 37H50.5C51.8807 37 53 35.8807 53 34.5C53 33.1193 51.8807 32 50.5 32H18.5Z",
|
|
73
|
+
"fill": "url(#doc)"
|
|
74
|
+
},
|
|
75
|
+
"children": []
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"tag": "g",
|
|
79
|
+
"attrs": {
|
|
80
|
+
"transform": "translate(66 75)",
|
|
81
|
+
"fill": "url(#wifi)"
|
|
82
|
+
},
|
|
83
|
+
"children": [
|
|
84
|
+
{
|
|
85
|
+
"tag": "path",
|
|
86
|
+
"attrs": { "d": "M17.5156 0C11.2706 0 5.34603 2.33603 0.796994 6.57058L0 7.31249L0.774158 8.07793L3.29835 10.5779L4.02532 11.297L4.77588 10.6095C8.25388 7.41396 12.7717 5.64852 17.5004 5.64852C22.2291 5.64852 26.7545 7.41396 30.2249 10.6095L30.9754 11.297L31.7016 10.5779L34.2266 8.07793L35 7.31249L34.203 6.56984C29.67 2.33676 23.737 0 17.5156 0Z" },
|
|
87
|
+
"children": []
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"tag": "path",
|
|
91
|
+
"attrs": { "d": "M28.5598 12.5317C25.5271 9.78909 21.6114 8.28174 17.5313 8.28174H16.8355L16.8279 8.29644C12.9822 8.45306 9.32459 9.94571 6.46393 12.5317L5.64258 13.2736L6.43196 14.0545L8.98813 16.5861L9.6991 17.2891L10.4497 16.6332C12.4273 14.8979 14.9363 13.9376 17.5077 13.9376C20.095 13.9376 22.604 14.8986 24.5809 16.6332L25.3315 17.2891L26.0424 16.5861L28.5986 14.0545L29.388 13.2736L28.5598 12.5317Z" },
|
|
92
|
+
"children": []
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"tag": "path",
|
|
96
|
+
"attrs": { "d": "M16.7999 24.2862C17.201 24.682 17.8458 24.6818 18.2466 24.2857L22.4014 20.1797L23.2296 19.3598L22.323 18.6172C21.1195 17.7275 19.7904 17.0547 17.5159 17.0547C15.2497 17.0547 14.0067 17.79 12.7095 18.6172L11.8105 19.3598L12.6388 20.1797L16.7999 24.2862Z" },
|
|
97
|
+
"children": []
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/empty/empty.ts
|
|
105
|
+
/**
|
|
106
|
+
* Empty 契约 — 原型 A(无状态),Core 为三栈结构与原有插画的唯一来源。
|
|
107
|
+
* 本目录是 Empty 的"源头锚点":契约文档与 demo 清单在 ./docs/ 下维护,
|
|
108
|
+
* 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。
|
|
109
|
+
* 渲染契约:`data-scope="empty"`,data-part 为 root / icon / title / description / actions。
|
|
110
|
+
*
|
|
111
|
+
* data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。
|
|
112
|
+
*/
|
|
113
|
+
/** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */
|
|
114
|
+
const EMPTY_PARTS = [
|
|
115
|
+
"root",
|
|
116
|
+
"icon",
|
|
117
|
+
"title",
|
|
118
|
+
"description",
|
|
119
|
+
"actions"
|
|
120
|
+
];
|
|
121
|
+
/** Resolve structure once, with explicit channel presence overriding scalars. */
|
|
122
|
+
function resolveEmptyState(props = {}, presence = {}) {
|
|
123
|
+
return {
|
|
124
|
+
iconMode: props.hideIcon === true ? "hidden" : presence.icon ? "custom" : "default",
|
|
125
|
+
hasTitle: presence.title === true || props.title != null,
|
|
126
|
+
hasDescription: presence.description === true || props.description != null,
|
|
127
|
+
hasActions: presence.default === true,
|
|
128
|
+
titleFromContent: presence.title === true,
|
|
129
|
+
descriptionFromContent: presence.description === true
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** Plain passive Empty root. */
|
|
133
|
+
function getEmptyRootProps() {
|
|
134
|
+
return getEmptyPartProps("root");
|
|
135
|
+
}
|
|
136
|
+
/** Shared stable selectors for Empty structure. */
|
|
137
|
+
function getEmptyPartProps(part) {
|
|
138
|
+
return {
|
|
139
|
+
"data-scope": "empty",
|
|
140
|
+
"data-part": part
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** Copy the original illustration with injectively scoped local SVG references. */
|
|
144
|
+
function getEmptyIllustration(identity) {
|
|
145
|
+
if (!identity.length) throw new Error("Empty illustration requires a nonempty stable identity");
|
|
146
|
+
let encoded = "";
|
|
147
|
+
for (let index = 0; index < identity.length; index++) encoded += identity.charCodeAt(index).toString(16).padStart(4, "0");
|
|
148
|
+
const prefix = `qw-empty-${encoded}-`;
|
|
149
|
+
const copy = (source) => ({
|
|
150
|
+
tag: source.tag,
|
|
151
|
+
attrs: Object.fromEntries(Object.entries(source.attrs).map(([key, value]) => [key, key === "id" ? `${prefix}${value}` : value.replace(/url\(#(doc|wifi)\)/g, (_original, local) => `url(#${prefix}${local})`)])),
|
|
152
|
+
children: source.children.map(copy)
|
|
153
|
+
});
|
|
154
|
+
const vector = copy(EMPTY_ILLUSTRATION_ASSET);
|
|
155
|
+
return {
|
|
156
|
+
...vector,
|
|
157
|
+
attrs: {
|
|
158
|
+
...vector.attrs,
|
|
159
|
+
focusable: "false"
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
export { resolveEmptyState as a, getEmptyRootProps as i, getEmptyIllustration as n, getEmptyPartProps as r, EMPTY_PARTS as t };
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=empty-CAgyvhUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-CAgyvhUI.js","names":[],"sources":["../src/empty/empty-illustration.ts","../src/empty/empty.ts"],"sourcesContent":["/** Original 015-empty decorative SVG asset; retained gradient colors are asset data, not component chrome. */\nimport type { EmptyVectorNode } from \"./empty.js\";\n\nexport const EMPTY_ILLUSTRATION_ASSET: EmptyVectorNode = {\n \"tag\": \"svg\",\n \"attrs\": {\n \"viewBox\": \"0 0 120 120\",\n \"width\": \"120\",\n \"height\": \"120\",\n \"fill\": \"none\",\n \"xmlns\": \"http://www.w3.org/2000/svg\",\n \"aria-hidden\": \"true\"\n },\n \"children\": [\n {\n \"tag\": \"defs\",\n \"attrs\": {},\n \"children\": [\n {\n \"tag\": \"linearGradient\",\n \"attrs\": {\n \"id\": \"doc\",\n \"x1\": \"19\",\n \"y1\": \"20\",\n \"x2\": \"98.29\",\n \"y2\": \"89.38\",\n \"gradientUnits\": \"userSpaceOnUse\"\n },\n \"children\": [\n {\n \"tag\": \"stop\",\n \"attrs\": {\n \"stop-color\": \"#222222\",\n \"stop-opacity\": \"0.1\"\n },\n \"children\": []\n },\n {\n \"tag\": \"stop\",\n \"attrs\": {\n \"offset\": \"1\",\n \"stop-color\": \"#D8D8D8\",\n \"stop-opacity\": \"0.02\"\n },\n \"children\": []\n }\n ]\n },\n {\n \"tag\": \"linearGradient\",\n \"attrs\": {\n \"id\": \"wifi\",\n \"x1\": \"66\",\n \"y1\": \"75\",\n \"x2\": \"101\",\n \"y2\": \"99.58\",\n \"gradientUnits\": \"userSpaceOnUse\"\n },\n \"children\": [\n {\n \"tag\": \"stop\",\n \"attrs\": {\n \"stop-color\": \"#CCCCCC\"\n },\n \"children\": []\n },\n {\n \"tag\": \"stop\",\n \"attrs\": {\n \"offset\": \"1\",\n \"stop-color\": \"#EFEFEF\"\n },\n \"children\": []\n }\n ]\n }\n ]\n },\n {\n \"tag\": \"path\",\n \"attrs\": {\n \"transform\": \"translate(19 20)\",\n \"fill-rule\": \"evenodd\",\n \"clip-rule\": \"evenodd\",\n \"d\": \"M0 10C0 4.47715 4.47715 0 10 0H60C65.5229 0 70 4.47715 70 10V70C70 75.5229 65.5229 80 60 80H10C4.47715 80 0 75.5229 0 70V10ZM16 17.5C16 16.1193 17.1193 15 18.5 15H50.5C51.8807 15 53 16.1193 53 17.5C53 18.8807 51.8807 20 50.5 20H18.5C17.1193 20 16 18.8807 16 17.5ZM18.5 32C17.1193 32 16 33.1193 16 34.5C16 35.8807 17.1193 37 18.5 37H50.5C51.8807 37 53 35.8807 53 34.5C53 33.1193 51.8807 32 50.5 32H18.5Z\",\n \"fill\": \"url(#doc)\"\n },\n \"children\": []\n },\n {\n \"tag\": \"g\",\n \"attrs\": {\n \"transform\": \"translate(66 75)\",\n \"fill\": \"url(#wifi)\"\n },\n \"children\": [\n {\n \"tag\": \"path\",\n \"attrs\": {\n \"d\": \"M17.5156 0C11.2706 0 5.34603 2.33603 0.796994 6.57058L0 7.31249L0.774158 8.07793L3.29835 10.5779L4.02532 11.297L4.77588 10.6095C8.25388 7.41396 12.7717 5.64852 17.5004 5.64852C22.2291 5.64852 26.7545 7.41396 30.2249 10.6095L30.9754 11.297L31.7016 10.5779L34.2266 8.07793L35 7.31249L34.203 6.56984C29.67 2.33676 23.737 0 17.5156 0Z\"\n },\n \"children\": []\n },\n {\n \"tag\": \"path\",\n \"attrs\": {\n \"d\": \"M28.5598 12.5317C25.5271 9.78909 21.6114 8.28174 17.5313 8.28174H16.8355L16.8279 8.29644C12.9822 8.45306 9.32459 9.94571 6.46393 12.5317L5.64258 13.2736L6.43196 14.0545L8.98813 16.5861L9.6991 17.2891L10.4497 16.6332C12.4273 14.8979 14.9363 13.9376 17.5077 13.9376C20.095 13.9376 22.604 14.8986 24.5809 16.6332L25.3315 17.2891L26.0424 16.5861L28.5986 14.0545L29.388 13.2736L28.5598 12.5317Z\"\n },\n \"children\": []\n },\n {\n \"tag\": \"path\",\n \"attrs\": {\n \"d\": \"M16.7999 24.2862C17.201 24.682 17.8458 24.6818 18.2466 24.2857L22.4014 20.1797L23.2296 19.3598L22.323 18.6172C21.1195 17.7275 19.7904 17.0547 17.5159 17.0547C15.2497 17.0547 14.0067 17.79 12.7095 18.6172L11.8105 19.3598L12.6388 20.1797L16.7999 24.2862Z\"\n },\n \"children\": []\n }\n ]\n }\n ]\n};\n","import { EMPTY_ILLUSTRATION_ASSET } from \"./empty-illustration.js\";\n\n/**\n * Empty 契约 — 原型 A(无状态),Core 为三栈结构与原有插画的唯一来源。\n * 本目录是 Empty 的\"源头锚点\":契约文档与 demo 清单在 ./docs/ 下维护,\n * 双栈实现(React props / Vue props+slots)必须与 docs 清单严格对齐。\n * 渲染契约:`data-scope=\"empty\"`,data-part 为 root / icon / title / description / actions。\n *\n * data-part 词表以运行时常量数组为唯一事实源(类型从常量推导),__test__ 直接锁死。\n */\n\n/** Empty 各渲染部位全集(data-part 取值),双栈与 styles-core 共用。 */\nexport const EMPTY_PARTS = [\"root\", \"icon\", \"title\", \"description\", \"actions\"] as const;\n\n/** Empty 各渲染部位(data-part 取值)。 */\nexport type EmptyPart = (typeof EMPTY_PARTS)[number];\n\n/** Scalar Empty inputs; framework-rich values use content presence. */\nexport interface QwEmptyProps {\n title?: string | null;\n description?: string | null;\n hideIcon?: boolean;\n}\n\n/** Content presence distinguishes omitted from explicitly empty SSR channels. */\nexport interface EmptyContentPresence {\n readonly icon?: boolean;\n readonly title?: boolean;\n readonly description?: boolean;\n readonly default?: boolean;\n}\n\n/** Shared passive structure decisions; no generated role or live region. */\nexport interface EmptyState {\n readonly iconMode: \"default\" | \"custom\" | \"hidden\";\n readonly hasTitle: boolean;\n readonly hasDescription: boolean;\n readonly hasActions: boolean;\n readonly titleFromContent: boolean;\n readonly descriptionFromContent: boolean;\n}\n\n/** Resolve structure once, with explicit channel presence overriding scalars. */\nexport function resolveEmptyState(props: QwEmptyProps = {}, presence: EmptyContentPresence = {}): EmptyState {\n return {\n iconMode: props.hideIcon === true ? \"hidden\" : presence.icon ? \"custom\" : \"default\",\n hasTitle: presence.title === true || props.title != null,\n hasDescription: presence.description === true || props.description != null,\n hasActions: presence.default === true,\n titleFromContent: presence.title === true,\n descriptionFromContent: presence.description === true,\n };\n}\n\n/** Plain passive Empty root. */\nexport function getEmptyRootProps() {\n return getEmptyPartProps(\"root\");\n}\n\n/** Shared stable selectors for Empty structure. */\nexport function getEmptyPartProps(part: EmptyPart) {\n return { \"data-scope\": \"empty\" as const, \"data-part\": part };\n}\n\n/** Framework-independent retained original vector asset. */\nexport interface EmptyVectorNode {\n readonly tag: string;\n readonly attrs: Readonly<Record<string, string>>;\n readonly children: readonly EmptyVectorNode[];\n}\n\n/** Copy the original illustration with injectively scoped local SVG references. */\nexport function getEmptyIllustration(identity: string): EmptyVectorNode {\n if (!identity.length) throw new Error(\"Empty illustration requires a nonempty stable identity\");\n let encoded = \"\";\n for (let index = 0; index < identity.length; index++) encoded += identity.charCodeAt(index).toString(16).padStart(4, \"0\");\n const prefix = `qw-empty-${encoded}-`;\n const copy = (source: EmptyVectorNode): EmptyVectorNode => ({\n tag: source.tag,\n attrs: Object.fromEntries(Object.entries(source.attrs).map(([key, value]) => [key, key === \"id\" ? `${prefix}${value}` : value.replace(/url\\(#(doc|wifi)\\)/g, (_original, local: string) => `url(#${prefix}${local})`)])),\n children: source.children.map(copy),\n });\n const vector = copy(EMPTY_ILLUSTRATION_ASSET);\n return { ...vector, attrs: { ...vector.attrs, focusable: \"false\" } };\n}\n"],"mappings":";AAGA,MAAa,2BAA4C;CACvD,OAAO;CACP,SAAS;EACP,WAAW;EACX,SAAS;EACT,UAAU;EACV,QAAQ;EACR,SAAS;EACT,eAAe;CACjB;CACA,YAAY;EACV;GACE,OAAO;GACP,SAAS,CAAC;GACV,YAAY,CACV;IACE,OAAO;IACP,SAAS;KACP,MAAM;KACN,MAAM;KACN,MAAM;KACN,MAAM;KACN,MAAM;KACN,iBAAiB;IACnB;IACA,YAAY,CACV;KACE,OAAO;KACP,SAAS;MACP,cAAc;MACd,gBAAgB;KAClB;KACA,YAAY,CAAC;IACf,GACA;KACE,OAAO;KACP,SAAS;MACP,UAAU;MACV,cAAc;MACd,gBAAgB;KAClB;KACA,YAAY,CAAC;IACf,CACF;GACF,GACA;IACE,OAAO;IACP,SAAS;KACP,MAAM;KACN,MAAM;KACN,MAAM;KACN,MAAM;KACN,MAAM;KACN,iBAAiB;IACnB;IACA,YAAY,CACV;KACE,OAAO;KACP,SAAS,EACP,cAAc,UAChB;KACA,YAAY,CAAC;IACf,GACA;KACE,OAAO;KACP,SAAS;MACP,UAAU;MACV,cAAc;KAChB;KACA,YAAY,CAAC;IACf,CACF;GACF,CACF;EACF;EACA;GACE,OAAO;GACP,SAAS;IACP,aAAa;IACb,aAAa;IACb,aAAa;IACb,KAAK;IACL,QAAQ;GACV;GACA,YAAY,CAAC;EACf;EACA;GACE,OAAO;GACP,SAAS;IACP,aAAa;IACb,QAAQ;GACV;GACA,YAAY;IACV;KACE,OAAO;KACP,SAAS,EACP,KAAK,6UACP;KACA,YAAY,CAAC;IACf;IACA;KACE,OAAO;KACP,SAAS,EACP,KAAK,wYACP;KACA,YAAY,CAAC;IACf;IACA;KACE,OAAO;KACP,SAAS,EACP,KAAK,+PACP;KACA,YAAY,CAAC;IACf;GACF;EACF;CACF;AACF;;;;;;;;;;;;AC5GA,MAAa,cAAc;CAAC;CAAQ;CAAQ;CAAS;CAAe;AAAS;;AA+B7E,SAAgB,k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"];
|
|
3
|
+
export declare const FIELD_LAYOUTS: readonly ["stacked", "inline"];
|
|
4
|
+
export declare const FIELD_PARTS: readonly ["root", "label", "required", "control", "description", "error", "status"];
|
|
5
|
+
export type FieldLabelMode = (typeof FIELD_LABEL_MODES)[number];
|
|
6
|
+
export type FieldLayout = (typeof FIELD_LAYOUTS)[number];
|
|
7
|
+
/** Pure association/feedback container; Form owns value and validation. */
|
|
8
|
+
export interface QwFieldProps {
|
|
9
|
+
/** Adapters supply an SSR-safe identity when omitted. */
|
|
10
|
+
id?: string;
|
|
11
|
+
name?: QwNamePath;
|
|
12
|
+
label?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
errors?: string[];
|
|
15
|
+
controlId?: string;
|
|
16
|
+
/** label links an actual labelable input; control avoids duplicate own names. */
|
|
17
|
+
labelMode?: FieldLabelMode;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
invalid?: boolean;
|
|
21
|
+
validating?: boolean;
|
|
22
|
+
layout?: FieldLayout;
|
|
23
|
+
validatingLabel?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolvedFieldState {
|
|
26
|
+
id: string;
|
|
27
|
+
key?: string;
|
|
28
|
+
label: string;
|
|
29
|
+
description: string;
|
|
30
|
+
errors: string[];
|
|
31
|
+
controlId?: string;
|
|
32
|
+
labelMode: FieldLabelMode;
|
|
33
|
+
labelTag: "label" | "span";
|
|
34
|
+
layout: FieldLayout;
|
|
35
|
+
required: boolean;
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
invalid: boolean;
|
|
38
|
+
validating: boolean;
|
|
39
|
+
validatingLabel: string;
|
|
40
|
+
labelId: string;
|
|
41
|
+
descriptionId: string;
|
|
42
|
+
errorId: string;
|
|
43
|
+
statusId: string;
|
|
44
|
+
describedBy?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function resolveFieldState(props: QwFieldProps): ResolvedFieldState;
|
|
47
|
+
export declare function getFieldRootProps(state: ResolvedFieldState): {
|
|
48
|
+
"data-scope": "field";
|
|
49
|
+
"data-part": string;
|
|
50
|
+
id: string;
|
|
51
|
+
"data-field-key": string | undefined;
|
|
52
|
+
"data-label-mode": "control" | "custom" | "label";
|
|
53
|
+
"data-layout": "inline" | "stacked";
|
|
54
|
+
"data-required": string | undefined;
|
|
55
|
+
"data-disabled": string | undefined;
|
|
56
|
+
"data-invalid": string | undefined;
|
|
57
|
+
"aria-busy": true | undefined;
|
|
58
|
+
};
|
|
59
|
+
export declare function getFieldLabelProps(state: ResolvedFieldState): {
|
|
60
|
+
"data-scope": "field";
|
|
61
|
+
"data-part": string;
|
|
62
|
+
id: string;
|
|
63
|
+
htmlFor: string | undefined;
|
|
64
|
+
hidden: boolean;
|
|
65
|
+
};
|
|
66
|
+
export declare function getFieldRequiredProps(state: ResolvedFieldState): {
|
|
67
|
+
"data-scope": "field";
|
|
68
|
+
"data-part": string;
|
|
69
|
+
hidden: boolean;
|
|
70
|
+
"aria-hidden": boolean;
|
|
71
|
+
};
|
|
72
|
+
export declare function getFieldControlProps(_state: ResolvedFieldState): {
|
|
73
|
+
"data-scope": "field";
|
|
74
|
+
"data-part": string;
|
|
75
|
+
};
|
|
76
|
+
export declare function getFieldDescriptionProps(state: ResolvedFieldState): {
|
|
77
|
+
"data-scope": "field";
|
|
78
|
+
"data-part": string;
|
|
79
|
+
id: string;
|
|
80
|
+
hidden: boolean;
|
|
81
|
+
};
|
|
82
|
+
export declare function getFieldErrorProps(state: ResolvedFieldState): {
|
|
83
|
+
"data-scope": "field";
|
|
84
|
+
"data-part": string;
|
|
85
|
+
id: string;
|
|
86
|
+
role: "alert";
|
|
87
|
+
hidden: boolean;
|
|
88
|
+
};
|
|
89
|
+
export declare function getFieldStatusProps(state: ResolvedFieldState): {
|
|
90
|
+
"data-scope": "field";
|
|
91
|
+
"data-part": string;
|
|
92
|
+
id: string;
|
|
93
|
+
role: "status";
|
|
94
|
+
hidden: boolean;
|
|
95
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { FIELD_LABEL_MODES, FIELD_LAYOUTS, FIELD_PARTS, resolveFieldState, getFieldRootProps, getFieldLabelProps, getFieldRequiredProps, getFieldControlProps, getFieldDescriptionProps, getFieldErrorProps, getFieldStatusProps } from "./field.js";
|
|
2
|
+
export type { FieldLabelMode, FieldLayout, QwFieldProps, ResolvedFieldState } from "./field.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getFieldDescriptionProps, c as getFieldRequiredProps, d as resolveFieldState, i as getFieldControlProps, l as getFieldRootProps, n as FIELD_LAYOUTS, o as getFieldErrorProps, r as FIELD_PARTS, s as getFieldLabelProps, t as FIELD_LABEL_MODES, u as getFieldStatusProps } from "../field-DMHGIMZF.js";
|
|
2
|
+
export { FIELD_LABEL_MODES, FIELD_LAYOUTS, FIELD_PARTS, getFieldControlProps, getFieldDescriptionProps, getFieldErrorProps, getFieldLabelProps, getFieldRequiredProps, getFieldRootProps, getFieldStatusProps, resolveFieldState };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
//#region src/form/model.ts
|
|
2
|
+
const forbidden = /* @__PURE__ */ new Set([
|
|
3
|
+
"__proto__",
|
|
4
|
+
"constructor",
|
|
5
|
+
"prototype"
|
|
6
|
+
]);
|
|
7
|
+
const plain = (value) => !!value && typeof value === "object" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));
|
|
8
|
+
/** Strings are literal single segments, never implicit dot/bracket parsing. */
|
|
9
|
+
function normalizeFormNamePath(name) {
|
|
10
|
+
const path = typeof name === "string" ? [name] : Array.isArray(name) ? [...name] : [];
|
|
11
|
+
if (!path.length || path.length > 64 || path.some((segment) => typeof segment === "string" ? !segment.length || forbidden.has(segment) : typeof segment !== "number" || !Number.isSafeInteger(segment) || segment < 0)) throw new TypeError("Form name paths require nonempty safe string/integer segments without prototype names");
|
|
12
|
+
return path;
|
|
13
|
+
}
|
|
14
|
+
function formFieldKey(name) {
|
|
15
|
+
return JSON.stringify(normalizeFormNamePath(name));
|
|
16
|
+
}
|
|
17
|
+
function formFieldNativeName(name) {
|
|
18
|
+
return normalizeFormNamePath(name).map((segment, index) => index ? `[${segment}]` : String(segment)).join("");
|
|
19
|
+
}
|
|
20
|
+
function copy(value, ancestors, depth) {
|
|
21
|
+
if (depth > 64) throw new TypeError("Form values exceed maximum depth");
|
|
22
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
23
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
24
|
+
if (!Array.isArray(value) && !plain(value)) throw new TypeError("Form values must be finite plain JSON without undefined, classes or functions");
|
|
25
|
+
if (ancestors.has(value)) throw new TypeError("Cyclic Form values");
|
|
26
|
+
ancestors.add(value);
|
|
27
|
+
let result;
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
const entries = [];
|
|
30
|
+
for (let index = 0; index < value.length; index++) {
|
|
31
|
+
if (!Object.hasOwn(value, index)) throw new TypeError("Form JSON arrays must be dense");
|
|
32
|
+
entries.push(copy(value[index], ancestors, depth + 1));
|
|
33
|
+
}
|
|
34
|
+
result = entries;
|
|
35
|
+
} else result = Object.fromEntries(Object.entries(value).map(([key, child]) => [key, copy(child, ancestors, depth + 1)]));
|
|
36
|
+
ancestors.delete(value);
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
function cloneFormValue(value) {
|
|
40
|
+
return copy(value, /* @__PURE__ */ new Set(), 0);
|
|
41
|
+
}
|
|
42
|
+
function cloneFormValues(values = {}) {
|
|
43
|
+
if (!plain(values)) throw new TypeError("Form values root must be a plain record");
|
|
44
|
+
return cloneFormValue(values);
|
|
45
|
+
}
|
|
46
|
+
/** Fresh recursively frozen validator snapshot; never freeze caller storage. */
|
|
47
|
+
function freezeFormValues(values) {
|
|
48
|
+
const freeze = (value) => {
|
|
49
|
+
if (value && typeof value === "object") {
|
|
50
|
+
Object.values(value).forEach(freeze);
|
|
51
|
+
Object.freeze(value);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const cloned = cloneFormValues(values);
|
|
55
|
+
freeze(cloned);
|
|
56
|
+
return cloned;
|
|
57
|
+
}
|
|
58
|
+
/** Canonical comparison keeps object key order from manufacturing dirty changes. */
|
|
59
|
+
function formValueFingerprint(value) {
|
|
60
|
+
const canonical = (node) => Array.isArray(node) ? node.map(canonical) : plain(node) ? Object.fromEntries(Object.keys(node).sort().map((key) => [key, canonical(node[key])])) : node;
|
|
61
|
+
return value === void 0 ? "undefined" : JSON.stringify(canonical(value));
|
|
62
|
+
}
|
|
63
|
+
function formValuesEqual(a, b) {
|
|
64
|
+
return !!b && formValueFingerprint(a) === formValueFingerprint(b);
|
|
65
|
+
}
|
|
66
|
+
function getFormValue(values, name) {
|
|
67
|
+
let current = values;
|
|
68
|
+
for (const segment of normalizeFormNamePath(name)) {
|
|
69
|
+
if (!current || typeof current !== "object" || Array.isArray(current) && typeof segment !== "number" || !Object.hasOwn(current, segment)) return void 0;
|
|
70
|
+
current = current[segment];
|
|
71
|
+
}
|
|
72
|
+
return current === void 0 ? void 0 : cloneFormValue(current);
|
|
73
|
+
}
|
|
74
|
+
function hasFormValue(values, name) {
|
|
75
|
+
return getFormValue(values, name) !== void 0;
|
|
76
|
+
}
|
|
77
|
+
/** Immutable path update. Dense arrays retain explicit JSON semantics. */
|
|
78
|
+
function setFormValue(values, name, value) {
|
|
79
|
+
const path = normalizeFormNamePath(name), result = cloneFormValues(values), nextValue = value === void 0 ? void 0 : cloneFormValue(value);
|
|
80
|
+
let current = result;
|
|
81
|
+
for (let index = 0; index < path.length; index++) {
|
|
82
|
+
const segment = path[index], last = index === path.length - 1;
|
|
83
|
+
if (Array.isArray(current)) {
|
|
84
|
+
if (typeof segment !== "number" || segment > 4294967293) throw new TypeError("Form array paths require valid numeric indexes");
|
|
85
|
+
if (segment - current.length > 1e4) throw new RangeError("Form sparse array expansion exceeds 10000 missing positions");
|
|
86
|
+
if (last && nextValue === void 0) {
|
|
87
|
+
if (segment < current.length) current.splice(segment, 1);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
while (current.length <= segment) current.push(null);
|
|
91
|
+
}
|
|
92
|
+
const record = current;
|
|
93
|
+
if (last) {
|
|
94
|
+
if (nextValue === void 0) delete record[segment];
|
|
95
|
+
else Object.defineProperty(record, segment, {
|
|
96
|
+
value: nextValue,
|
|
97
|
+
enumerable: true,
|
|
98
|
+
configurable: true,
|
|
99
|
+
writable: true
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
const existing = record[segment];
|
|
104
|
+
if (!(Array.isArray(existing) || plain(existing))) {
|
|
105
|
+
const child = typeof path[index + 1] === "number" ? [] : {};
|
|
106
|
+
Object.defineProperty(record, segment, {
|
|
107
|
+
value: child,
|
|
108
|
+
enumerable: true,
|
|
109
|
+
configurable: true,
|
|
110
|
+
writable: true
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
current = record[segment];
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
/** Object recursion, array replacement; all inputs and outputs are independent. */
|
|
118
|
+
function mergeFormValues(values, patch) {
|
|
119
|
+
const result = cloneFormValues(values), safePatch = cloneFormValues(patch);
|
|
120
|
+
const merge = (target, source) => {
|
|
121
|
+
for (const [key, value] of Object.entries(source)) if (plain(value) && plain(target[key])) merge(target[key], value);
|
|
122
|
+
else Object.defineProperty(target, key, {
|
|
123
|
+
value,
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
writable: true
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
merge(result, safePatch);
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/field/field.ts
|
|
134
|
+
const FIELD_LABEL_MODES = [
|
|
135
|
+
"label",
|
|
136
|
+
"control",
|
|
137
|
+
"custom"
|
|
138
|
+
];
|
|
139
|
+
const FIELD_LAYOUTS = ["stacked", "inline"];
|
|
140
|
+
const FIELD_PARTS = [
|
|
141
|
+
"root",
|
|
142
|
+
"label",
|
|
143
|
+
"required",
|
|
144
|
+
"control",
|
|
145
|
+
"description",
|
|
146
|
+
"error",
|
|
147
|
+
"status"
|
|
148
|
+
];
|
|
149
|
+
const part = (name) => ({
|
|
150
|
+
"data-scope": "field",
|
|
151
|
+
"data-part": name
|
|
152
|
+
});
|
|
153
|
+
function resolveFieldState(props) {
|
|
154
|
+
if (typeof props.id !== "string" || !props.id.trim()) throw new TypeError("Field requires a nonempty stable identity");
|
|
155
|
+
const labelMode = FIELD_LABEL_MODES.includes(props.labelMode) ? props.labelMode : "label";
|
|
156
|
+
const label = props.label ?? "";
|
|
157
|
+
if (labelMode !== "control" && !label.trim()) throw new TypeError("Field requires a nonempty label unless the control names itself");
|
|
158
|
+
if (labelMode === "label" && !props.controlId?.trim()) throw new TypeError("Field label mode requires an actual labelable control id");
|
|
159
|
+
if (props.errors !== void 0 && (!Array.isArray(props.errors) || props.errors.some((error) => typeof error !== "string"))) throw new TypeError("Field errors must be strings");
|
|
160
|
+
const errors = [...new Set((props.errors ?? []).filter((error) => !!error.trim()))], id = `field:${props.id}`;
|
|
161
|
+
const description = props.description ?? "", descriptionId = `${id}:description`, errorId = `${id}:error`;
|
|
162
|
+
return {
|
|
163
|
+
id,
|
|
164
|
+
key: props.name === void 0 ? void 0 : formFieldKey(props.name),
|
|
165
|
+
label,
|
|
166
|
+
description,
|
|
167
|
+
errors,
|
|
168
|
+
controlId: props.controlId,
|
|
169
|
+
labelMode,
|
|
170
|
+
labelTag: labelMode === "label" ? "label" : "span",
|
|
171
|
+
layout: props.layout === "inline" ? "inline" : "stacked",
|
|
172
|
+
required: !!props.required,
|
|
173
|
+
disabled: !!props.disabled,
|
|
174
|
+
invalid: !!props.invalid || !!errors.length,
|
|
175
|
+
validating: !!props.validating,
|
|
176
|
+
validatingLabel: props.validatingLabel ?? "正在校验",
|
|
177
|
+
labelId: `${id}:label`,
|
|
178
|
+
descriptionId,
|
|
179
|
+
errorId,
|
|
180
|
+
statusId: `${id}:status`,
|
|
181
|
+
describedBy: [description ? descriptionId : "", errors.length ? errorId : ""].filter(Boolean).join(" ") || void 0
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function getFieldRootProps(state) {
|
|
185
|
+
return {
|
|
186
|
+
...part("root"),
|
|
187
|
+
id: state.id,
|
|
188
|
+
"data-field-key": state.key,
|
|
189
|
+
"data-label-mode": state.labelMode,
|
|
190
|
+
"data-layout": state.layout,
|
|
191
|
+
"data-required": state.required ? "" : void 0,
|
|
192
|
+
"data-disabled": state.disabled ? "" : void 0,
|
|
193
|
+
"data-invalid": state.invalid ? "" : void 0,
|
|
194
|
+
"aria-busy": state.validating || void 0
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function getFieldLabelProps(state) {
|
|
198
|
+
return {
|
|
199
|
+
...part("label"),
|
|
200
|
+
id: state.labelId,
|
|
201
|
+
htmlFor: state.labelMode === "label" ? state.controlId : void 0,
|
|
202
|
+
hidden: state.labelMode === "control"
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function getFieldRequiredProps(state) {
|
|
206
|
+
return {
|
|
207
|
+
...part("required"),
|
|
208
|
+
hidden: !state.required || state.labelMode === "control",
|
|
209
|
+
"aria-hidden": true
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function getFieldControlProps(_state) {
|
|
213
|
+
return part("control");
|
|
214
|
+
}
|
|
215
|
+
function getFieldDescriptionProps(state) {
|
|
216
|
+
return {
|
|
217
|
+
...part("description"),
|
|
218
|
+
id: state.descriptionId,
|
|
219
|
+
hidden: !state.description
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function getFieldErrorProps(state) {
|
|
223
|
+
return {
|
|
224
|
+
...part("error"),
|
|
225
|
+
id: state.errorId,
|
|
226
|
+
role: "alert",
|
|
227
|
+
hidden: !state.errors.length
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function getFieldStatusProps(state) {
|
|
231
|
+
return {
|
|
232
|
+
...part("status"),
|
|
233
|
+
id: state.statusId,
|
|
234
|
+
role: "status",
|
|
235
|
+
hidden: !state.validating
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
export { setFormValue as C, normalizeFormNamePath as S, formValuesEqual as _, getFieldDescriptionProps as a, hasFormValue as b, getFieldRequiredProps as c, resolveFieldState as d, cloneFormValue as f, formValueFingerprint as g, formFieldNativeName as h, getFieldControlProps as i, getFieldRootProps as l, formFieldKey as m, FIELD_LAYOUTS as n, getFieldErrorProps as o, cloneFormValues as p, FIELD_PARTS as r, getFieldLabelProps as s, FIELD_LABEL_MODES as t, getFieldStatusProps as u, freezeFormValues as v, mergeFormValues as x, getFormValue as y };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=field-DMHGIMZF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-DMHGIMZF.js","names":[],"sources":["../src/form/model.ts","../src/field/field.ts"],"sourcesContent":["/** Finite JSON values form the public value/SSR boundary. */\nexport type QwFormValue = string | number | boolean | null | QwFormValue[] | { [key: string]: QwFormValue };\nexport type QwFormValues = Record<string, QwFormValue>;\nexport type QwNamePath = string | readonly (string | number)[];\nexport type FormNamePath = (string | number)[];\nconst forbidden = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\nconst plain = (value: unknown): value is Record<string, QwFormValue> => !!value && typeof value === \"object\" && !Array.isArray(value) && [Object.prototype, null].includes(Object.getPrototypeOf(value));\n\n/** Strings are literal single segments, never implicit dot/bracket parsing. */\nexport function normalizeFormNamePath(name: unknown): FormNamePath {\n const path = typeof name === \"string\" ? [name] : Array.isArray(name) ? [...name] : [];\n if (!path.length || path.length > 64 || path.some((segment) => typeof segment === \"string\" ? !segment.length || forbidden.has(segment) : typeof segment !== \"number\" || !Number.isSafeInteger(segment) || segment < 0)) throw new TypeError(\"Form name paths require nonempty safe string/integer segments without prototype names\");\n return path as FormNamePath;\n}\nexport function formFieldKey(name: QwNamePath): string { return JSON.stringify(normalizeFormNamePath(name)); }\nexport function formFieldNativeName(name: QwNamePath): string { return normalizeFormNamePath(name).map((segment, index) => index ? `[${segment}]` : String(segment)).join(\"\"); }\n\nfunction copy(value: unknown, ancestors: Set<object>, depth: number): QwFormValue {\n if (depth > 64) throw new TypeError(\"Form values exceed maximum depth\");\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"number\" && Number.isFinite(value)) return value;\n if (!Array.isArray(value) && !plain(value)) throw new TypeError(\"Form values must be finite plain JSON without undefined, classes or functions\");\n if (ancestors.has(value)) throw new TypeError(\"Cyclic Form values\");\n ancestors.add(value);\n let result: QwFormValue;\n if (Array.isArray(value)) {\n const entries: QwFormValue[] = [];\n for (let index = 0; index < value.length; index++) {\n if (!Object.hasOwn(value, index)) throw new TypeError(\"Form JSON arrays must be dense\");\n entries.push(copy(value[index], ancestors, depth + 1));\n }\n result = entries;\n } else result = Object.fromEntries(Object.entries(value).map(([key, child]) => [key, copy(child, ancestors, depth + 1)]));\n ancestors.delete(value);\n return result;\n}\nexport function cloneFormValue(value: unknown): QwFormValue { return copy(value, new Set(), 0); }\nexport function cloneFormValues(values: unknown = {}): QwFormValues {\n if (!plain(values)) throw new TypeError(\"Form values root must be a plain record\");\n return cloneFormValue(values) as QwFormValues;\n}\n/** Fresh recursively frozen validator snapshot; never freeze caller storage. */\nexport function freezeFormValues(values: QwFormValues): Readonly<QwFormValues> {\n const freeze = (value: QwFormValue): void => { if (value && typeof value === \"object\") { Object.values(value).forEach(freeze); Object.freeze(value); } };\n const cloned = cloneFormValues(values); freeze(cloned); return cloned;\n}\n/** Canonical comparison keeps object key order from manufacturing dirty changes. */\nexport function formValueFingerprint(value: QwFormValue | undefined): string {\n const canonical = (node: QwFormValue): QwFormValue => Array.isArray(node) ? node.map(canonical) : plain(node) ? Object.fromEntries(Object.keys(node).sort().map((key) => [key, canonical(node[key]!)])) : node;\n return value === undefined ? \"undefined\" : JSON.stringify(canonical(value));\n}\nexport function formValuesEqual(a: QwFormValues, b: QwFormValues | undefined): boolean { return !!b && formValueFingerprint(a) === formValueFingerprint(b); }\nexport function getFormValue(values: QwFormValues, name: QwNamePath): QwFormValue | undefined {\n let current: QwFormValue | undefined = values;\n for (const segment of normalizeFormNamePath(name)) {\n if (!current || typeof current !== \"object\" || (Array.isArray(current) && typeof segment !== \"number\") || !Object.hasOwn(current, segment)) return undefined;\n current = (current as Record<string | number, QwFormValue>)[segment];\n }\n return current === undefined ? undefined : cloneFormValue(current);\n}\nexport function hasFormValue(values: QwFormValues, name: QwNamePath): boolean { return getFormValue(values, name) !== undefined; }\n\n/** Immutable path update. Dense arrays retain explicit JSON semantics. */\nexport function setFormValue(values: QwFormValues, name: QwNamePath, value: QwFormValue | undefined): QwFormValues {\n const path = normalizeFormNamePath(name), result = cloneFormValues(values), nextValue = value === undefined ? undefined : cloneFormValue(value);\n let current: Record<string, QwFormValue> | QwFormValue[] = result;\n for (let index = 0; index < path.length; index++) {\n const segment = path[index]!, last = index === path.length - 1;\n if (Array.isArray(current)) {\n if (typeof segment !== \"number\" || segment > 0xffffffff - 2) throw new TypeError(\"Form array paths require valid numeric indexes\");\n if (segment - current.length > 10_000) throw new RangeError(\"Form sparse array expansion exceeds 10000 missing positions\");\n if (last && nextValue === undefined) { if (segment < current.length) current.splice(segment, 1); break; }\n while (current.length <= segment) current.push(null);\n }\n const record = current as Record<string | number, QwFormValue>;\n if (last) { if (nextValue === undefined) delete record[segment]; else Object.defineProperty(record, segment, { value: nextValue, enumerable: true, configurable: true, writable: true }); break; }\n const existing = record[segment], container = Array.isArray(existing) || plain(existing);\n if (!container) {\n const child = typeof path[index + 1] === \"number\" ? [] : {};\n Object.defineProperty(record, segment, { value: child, enumerable: true, configurable: true, writable: true });\n }\n current = record[segment] as Record<string, QwFormValue> | QwFormValue[];\n }\n return result;\n}\n/** Object recursion, array replacement; all inputs and outputs are independent. */\nexport function mergeFormValues(values: QwFormValues, patch: QwFormValues): QwFormValues {\n const result = cloneFormValues(values), safePatch = cloneFormValues(patch);\n const merge = (target: Record<string, QwFormValue>, source: Record<string, QwFormValue>) => {\n for (const [key, value] of Object.entries(source)) {\n if (plain(value) && plain(target[key])) merge(target[key] as Record<string, QwFormValue>, value);\n else Object.defineProperty(target, key, { value, enumerable: true, configurable: true, writable: true });\n }\n };\n merge(result, safePatch); return result;\n}\n","import { formFieldKey, type QwNamePath } from \"../form/model.js\";\nexport const FIELD_LABEL_MODES = [\"label\", \"control\", \"custom\"] as const;\nexport const FIELD_LAYOUTS = [\"stacked\", \"inline\"] as const;\nexport const FIELD_PARTS = [\"root\", \"label\", \"required\", \"control\", \"description\", \"error\", \"status\"] as const;\nexport type FieldLabelMode = (typeof FIELD_LABEL_MODES)[number];\nexport type FieldLayout = (typeof FIELD_LAYOUTS)[number];\n/** Pure association/feedback container; Form owns value and validation. */\nexport interface QwFieldProps {\n /** Adapters supply an SSR-safe identity when omitted. */\n id?: string;\n name?: QwNamePath;\n label?: string;\n description?: string;\n errors?: string[];\n controlId?: string;\n /** label links an actual labelable input; control avoids duplicate own names. */\n labelMode?: FieldLabelMode;\n required?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n validating?: boolean;\n layout?: FieldLayout;\n validatingLabel?: string;\n}\nexport interface ResolvedFieldState {\n id: string; key?: string; label: string; description: string; errors: string[]; controlId?: string;\n labelMode: FieldLabelMode; labelTag: \"label\" | \"span\"; layout: FieldLayout;\n required: boolean; disabled: boolean; invalid: boolean; validating: boolean; validatingLabel: string;\n labelId: string; descriptionId: string; errorId: string; statusId: string; describedBy?: string;\n}\nconst part = (name: string) => ({ \"data-scope\": \"field\" as const, \"data-part\": name });\nexport function resolveFieldState(props: QwFieldProps): ResolvedFieldState {\n if (typeof props.id !== \"string\" || !props.id.trim()) throw new TypeError(\"Field requires a nonempty stable identity\");\n const labelMode = FIELD_LABEL_MODES.includes(props.labelMode!) ? props.labelMode! : \"label\";\n const label = props.label ?? \"\";\n if (labelMode !== \"control\" && !label.trim()) throw new TypeError(\"Field requires a nonempty label unless the control names itself\");\n if (labelMode === \"label\" && !props.controlId?.trim()) throw new TypeError(\"Field label mode requires an actual labelable control id\");\n if (props.errors !== undefined && (!Array.isArray(props.errors) || props.errors.some((error) => typeof error !== \"string\"))) throw new TypeError(\"Field errors must be strings\");\n const errors = [...new Set((props.errors ?? []).filter((error) => !!error.trim()))], id = `field:${props.id}`;\n const description = props.description ?? \"\", descriptionId = `${id}:description`, errorId = `${id}:error`;\n return { id, key: props.name === undefined ? undefined : formFieldKey(props.name), label, description, errors, controlId: props.controlId,\n labelMode, labelTag: labelMode === \"label\" ? \"label\" : \"span\", layout: props.layout === \"inline\" ? \"inline\" : \"stacked\",\n required: !!props.required, disabled: !!props.disabled, invalid: !!props.invalid || !!errors.length, validating: !!props.validating,\n validatingLabel: props.validatingLabel ?? \"正在校验\", labelId: `${id}:label`, descriptionId, errorId, statusId: `${id}:status`,\n describedBy: [description ? descriptionId : \"\", errors.length ? errorId : \"\"].filter(Boolean).join(\" \") || undefined };\n}\nexport function getFieldRootProps(state: ResolvedFieldState) { return { ...part(\"root\"), id: state.id, \"data-field-key\": state.key, \"data-label-mode\": state.labelMode, \"data-layout\": state.layout, \"data-required\": state.required ? \"\" : undefined, \"data-disabled\": state.disabled ? \"\" : undefined, \"data-invalid\": state.invalid ? \"\" : undefined, \"aria-busy\": state.validating || undefined }; }\nexport function getFieldLabelProps(state: ResolvedFieldState) { return { ...part(\"label\"), id: state.labelId, htmlFor: state.labelMode === \"label\" ? state.controlId : undefined, hidden: state.labelMode === \"control\" }; }\nexport function getFieldRequiredProps(state: ResolvedFieldState) { return { ...part(\"required\"), hidden: !state.required || state.labelMode === \"control\", \"aria-hidden\": true }; }\nexport function getFieldControlProps(_state: ResolvedFieldState) { return part(\"control\"); }\nexport function getFieldDescriptionProps(state: ResolvedFieldState) { return { ...part(\"description\"), id: state.descriptionId, hidden: !state.description }; }\nexport function getFieldErrorProps(state: ResolvedFieldState) { return { ...part(\"error\"), id: state.errorId, role: \"alert\" as const, hidden: !state.errors.length }; }\nexport function getFieldStatusProps(state: ResolvedFieldState) { return { ...part(\"status\"), id: state.statusId, role: \"status\" as const, hidden: !state.validating }; }\n"],"mappings":";AAKA,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAa;CAAe;AAAW,CAAC;AACnE,MAAM,SAAS,UAAyD,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,KAAK,CAAC,OAAO,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,eAAe,KAAK,CAAC;;AAGvM,SAAgB,sBAAsB,MAA6B;CACjE,MAAM,OAAO,OAAO,SAAS,WAAW,CAAC,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC;CACpF,IAAI,CAAC,KAAK,UAAU,KAAK,SAAS,MAAM,KAAK,MAAM,YAAY,OAAO,YAAY,WAAW,CAAC,QAAQ,UAAU,UAAU,IAAI,OAAO,IAAI,OAAO,YAAY,YAAY,CAAC,OAAO,cAAc,OAAO,KAAK,UAAU,CAAC,GAAG,MAAM,IAAI,UAAU,uFAAuF;CACnU,OAAO;AACT;AACA,SAAgB,aAAa,MAA0B;CAAE,OAAO,KAAK,UAAU,sBAAsB,IAAI,CAAC;AAAG;AAC7G,SAAgB,oBAAoB,MAA0B;CAAE,OAAO,sBAAsB,IAAI,CAAC,CAAC,KAAK,SAAS,UAAU,QAAQ,IAAI,QAAQ,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE;AAAG;AAE/K,SAAS,KAAK,OAAgB,WAAwB,OAA4B;CAChF,IAAI,QAAQ,IAAI,MAAM,IAAI,UAAU,kCAAkC;CACtE,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO;CACtF,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK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