@taicode/common-web 3.0.1 → 3.2.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/output/components/alert-dialog.d.ts +20 -0
- package/output/components/alert-dialog.d.ts.map +1 -0
- package/output/components/alert-dialog.js +65 -0
- package/output/components/alert.d.ts +11 -0
- package/output/components/alert.d.ts.map +1 -0
- package/output/components/alert.js +38 -0
- package/output/components/avatar.d.ts +13 -0
- package/output/components/avatar.d.ts.map +1 -0
- package/output/components/avatar.js +40 -0
- package/output/components/badge.d.ts +10 -0
- package/output/components/badge.d.ts.map +1 -0
- package/output/components/badge.js +31 -0
- package/output/components/button.d.ts +12 -0
- package/output/components/button.d.ts.map +1 -0
- package/output/components/button.js +44 -0
- package/output/components/card.d.ts +8 -0
- package/output/components/card.d.ts.map +1 -0
- package/output/components/card.js +38 -0
- package/output/components/checkbox.d.ts +5 -0
- package/output/components/checkbox.d.ts.map +1 -0
- package/output/components/checkbox.js +21 -0
- package/output/components/command.d.ts +20 -0
- package/output/components/command.d.ts.map +1 -0
- package/output/components/command.js +55 -0
- package/output/components/dialog.d.ts +20 -0
- package/output/components/dialog.d.ts.map +1 -0
- package/output/components/dialog.js +58 -0
- package/output/components/direction.d.ts +9 -0
- package/output/components/direction.d.ts.map +1 -0
- package/output/components/direction.js +10 -0
- package/output/components/dropdown-menu.d.ts +29 -0
- package/output/components/dropdown-menu.d.ts.map +1 -0
- package/output/components/dropdown-menu.js +78 -0
- package/output/components/field.d.ts +39 -0
- package/output/components/field.d.ts.map +1 -0
- package/output/components/field.js +102 -0
- package/output/components/index.d.ts +36 -0
- package/output/components/index.d.ts.map +1 -0
- package/output/components/index.js +35 -0
- package/output/components/input-group.d.ts +17 -0
- package/output/components/input-group.d.ts.map +1 -0
- package/output/components/input-group.js +75 -0
- package/output/components/input.d.ts +3 -0
- package/output/components/input.d.ts.map +1 -0
- package/output/components/input.js +19 -0
- package/output/components/item.d.ts +25 -0
- package/output/components/item.d.ts.map +1 -0
- package/output/components/item.js +89 -0
- package/output/components/json-view/index.d.ts +11 -0
- package/output/components/json-view/index.d.ts.map +1 -0
- package/output/components/json-view/index.js +52 -0
- package/output/components/kbd.d.ts +4 -0
- package/output/components/kbd.d.ts.map +1 -0
- package/output/components/kbd.js +22 -0
- package/output/components/label.d.ts +5 -0
- package/output/components/label.d.ts.map +1 -0
- package/output/components/label.js +20 -0
- package/output/{loading-button → components/loading-button}/index.d.ts +1 -1
- package/output/components/loading-button/index.d.ts.map +1 -0
- package/output/{loading-button → components/loading-button}/index.js +3 -7
- package/output/components/loading-button/index.test.d.ts.map +1 -0
- package/output/{loading-button → components/loading-button}/index.test.js +4 -4
- package/output/components/native-select.d.ts +9 -0
- package/output/components/native-select.d.ts.map +1 -0
- package/output/components/native-select.js +28 -0
- package/output/components/page-state.d.ts +19 -0
- package/output/components/page-state.d.ts.map +1 -0
- package/output/components/page-state.js +13 -0
- package/output/components/popover.d.ts +11 -0
- package/output/components/popover.d.ts.map +1 -0
- package/output/components/popover.js +44 -0
- package/output/components/progress.d.ts +5 -0
- package/output/components/progress.d.ts.map +1 -0
- package/output/components/progress.js +21 -0
- package/output/components/radio-group.d.ts +6 -0
- package/output/components/radio-group.d.ts.map +1 -0
- package/output/components/radio-group.js +25 -0
- package/output/components/scroll-area.d.ts +6 -0
- package/output/components/scroll-area.d.ts.map +1 -0
- package/output/components/scroll-area.js +24 -0
- package/output/components/select.d.ts +17 -0
- package/output/components/select.d.ts.map +1 -0
- package/output/components/select.js +58 -0
- package/output/components/separator.d.ts +6 -0
- package/output/components/separator.d.ts.map +1 -0
- package/output/components/separator.js +19 -0
- package/output/components/sheet.d.ts +16 -0
- package/output/components/sheet.d.ts.map +1 -0
- package/output/components/sheet.js +58 -0
- package/output/components/size-provider/index.d.ts +2 -0
- package/output/components/size-provider/index.d.ts.map +1 -0
- package/output/components/size-provider/index.js +1 -0
- package/output/{size-provider → components/size-provider}/size-provider.d.ts +1 -1
- package/output/components/size-provider/size-provider.d.ts.map +1 -0
- package/output/{size-provider → components/size-provider}/size-provider.js +1 -1
- package/output/components/skeleton.d.ts +3 -0
- package/output/components/skeleton.d.ts.map +1 -0
- package/output/{catalyst/divider.js → components/skeleton.js} +4 -4
- package/output/components/sonner.d.ts +8 -0
- package/output/components/sonner.d.ts.map +1 -0
- package/output/components/sonner.js +34 -0
- package/output/components/spinner.d.ts +3 -0
- package/output/components/spinner.d.ts.map +1 -0
- package/output/{catalyst/divider.jsx → components/spinner.js} +7 -4
- package/output/components/switch.d.ts +8 -0
- package/output/components/switch.d.ts.map +1 -0
- package/output/components/switch.js +20 -0
- package/output/components/table.d.ts +11 -0
- package/output/components/table.d.ts.map +1 -0
- package/output/components/table.js +47 -0
- package/output/components/tabs.d.ts +12 -0
- package/output/components/tabs.d.ts.map +1 -0
- package/output/components/tabs.js +45 -0
- package/output/components/textarea.d.ts +4 -0
- package/output/components/textarea.d.ts.map +1 -0
- package/output/components/textarea.js +19 -0
- package/output/components/theme-switcher.d.ts +6 -0
- package/output/components/theme-switcher.d.ts.map +1 -0
- package/output/components/theme-switcher.js +19 -0
- package/output/{toaster → components/toaster}/index.d.ts +1 -1
- package/output/components/toaster/index.d.ts.map +1 -0
- package/output/{toaster → components/toaster}/index.js +1 -1
- package/output/components/tooltip.d.ts +8 -0
- package/output/components/tooltip.d.ts.map +1 -0
- package/output/components/tooltip.js +33 -0
- package/output/features/confirm-dialog/index.d.ts +39 -0
- package/output/features/confirm-dialog/index.d.ts.map +1 -0
- package/output/features/confirm-dialog/index.js +19 -0
- package/output/features/input-confirm/index.d.ts +26 -0
- package/output/features/input-confirm/index.d.ts.map +1 -0
- package/output/features/input-confirm/index.js +59 -0
- package/output/{signin → features/signin}/context.d.ts +1 -2
- package/output/features/signin/context.d.ts.map +1 -0
- package/output/{signin → features/signin}/context.js +3 -3
- package/output/{signin → features/signin}/index.d.ts +4 -4
- package/output/features/signin/index.d.ts.map +1 -0
- package/output/{signin → features/signin}/index.js +9 -9
- package/output/{signin → features/signin}/service.d.ts +1 -1
- package/output/features/signin/service.d.ts.map +1 -0
- package/output/{signin → features/signin}/service.js +1 -4
- package/output/features/signin/service.test.d.ts.map +1 -0
- package/output/{signin → features/signin}/service.test.js +1 -1
- package/output/features/signin/types.d.ts.map +1 -0
- package/output/hooks/use-loading/index.d.ts +6 -0
- package/output/hooks/use-loading/index.d.ts.map +1 -0
- package/output/hooks/use-loading/index.js +14 -0
- package/output/hooks/use-loading/index.test.d.ts +2 -0
- package/output/hooks/use-loading/index.test.d.ts.map +1 -0
- package/output/hooks/use-loading/index.test.js +24 -0
- package/output/hooks/use-mobile/index.d.ts +2 -0
- package/output/hooks/use-mobile/index.d.ts.map +1 -0
- package/output/hooks/use-mobile/index.js +16 -0
- package/output/hooks/use-observer/index.d.ts +2 -0
- package/output/hooks/use-observer/index.d.ts.map +1 -0
- package/output/hooks/use-observer/index.js +1 -0
- package/output/hooks/use-observer/use-observer.d.ts.map +1 -0
- package/output/{helpers → hooks}/use-observer/use-observer.js +2 -2
- package/output/hooks/use-observer/use-observer.test.d.ts.map +1 -0
- package/output/{use-observer → hooks/use-observer}/use-observer.test.js +2 -2
- package/output/hooks/use-offline/index.d.ts +6 -0
- package/output/hooks/use-offline/index.d.ts.map +1 -0
- package/output/hooks/use-offline/index.js +19 -0
- package/output/layout/app/index.d.ts +34 -0
- package/output/layout/app/index.d.ts.map +1 -0
- package/output/layout/app/index.js +34 -0
- package/output/layout/dashboard/index.d.ts +58 -0
- package/output/layout/dashboard/index.d.ts.map +1 -0
- package/output/layout/dashboard/index.js +71 -0
- package/output/layout/index.d.ts +3 -0
- package/output/layout/index.d.ts.map +1 -0
- package/output/layout/index.js +2 -0
- package/output/services/cache-api/cache-api.d.ts.map +1 -0
- package/output/{cache-api → services/cache-api}/cache-api.js +1 -1
- package/output/services/cache-api/cache-api.test.d.ts.map +1 -0
- package/output/{cache-api → services/cache-api}/cache-api.test.js +1 -1
- package/output/services/cache-api/index.d.ts +2 -0
- package/output/services/cache-api/index.d.ts.map +1 -0
- package/output/services/cache-api/index.js +1 -0
- package/output/{service → services/service}/index.d.ts +1 -1
- package/output/services/service/index.d.ts.map +1 -0
- package/output/{service → services/service}/index.js +1 -1
- package/output/services/service/service.d.ts +135 -0
- package/output/services/service/service.d.ts.map +1 -0
- package/output/services/service/service.js +276 -0
- package/output/services/service/service.test.d.ts.map +1 -0
- package/output/{service → services/service}/service.test.js +1 -1
- package/output/services/side-cache/index.d.ts +2 -0
- package/output/services/side-cache/index.d.ts.map +1 -0
- package/output/services/side-cache/index.js +1 -0
- package/output/services/side-cache/side-cache.d.ts.map +1 -0
- package/output/services/side-cache/side-cache.test.d.ts.map +1 -0
- package/output/{side-cache → services/side-cache}/side-cache.test.js +1 -1
- package/output/utils/avatar/index.d.ts +28 -0
- package/output/utils/avatar/index.d.ts.map +1 -0
- package/output/utils/avatar/index.js +35 -0
- package/output/utils/cn/index.d.ts +3 -0
- package/output/utils/cn/index.d.ts.map +1 -0
- package/output/utils/cn/index.js +5 -0
- package/output/utils/cn/index.test.d.ts +2 -0
- package/output/utils/cn/index.test.d.ts.map +1 -0
- package/output/utils/cn/index.test.js +7 -0
- package/output/utils/delay/index.d.ts +2 -0
- package/output/utils/delay/index.d.ts.map +1 -0
- package/output/utils/delay/index.js +5 -0
- package/output/utils/form/index.d.ts +3 -0
- package/output/utils/form/index.d.ts.map +1 -0
- package/output/utils/form/index.js +1 -0
- package/output/utils/performance/index.d.ts +82 -0
- package/output/utils/performance/index.d.ts.map +1 -0
- package/output/utils/performance/index.js +129 -0
- package/output/utils/redirect/index.d.ts +6 -0
- package/output/utils/redirect/index.d.ts.map +1 -0
- package/output/utils/redirect/index.js +32 -0
- package/package.json +117 -28
- package/styles.css +123 -0
- package/output/cache-api/cache-api.d.ts.map +0 -1
- package/output/cache-api/cache-api.test.d.ts.map +0 -1
- package/output/cache-api/index.d.ts +0 -2
- package/output/cache-api/index.d.ts.map +0 -1
- package/output/cache-api/index.js +0 -1
- package/output/catalyst/alert.d.ts +0 -29
- package/output/catalyst/alert.d.ts.map +0 -1
- package/output/catalyst/alert.js +0 -46
- package/output/catalyst/alert.jsx +0 -55
- package/output/catalyst/auth-layout.d.ts +0 -5
- package/output/catalyst/auth-layout.d.ts.map +0 -1
- package/output/catalyst/auth-layout.js +0 -4
- package/output/catalyst/auth-layout.jsx +0 -7
- package/output/catalyst/avatar.d.ts +0 -16
- package/output/catalyst/avatar.d.ts.map +0 -1
- package/output/catalyst/avatar.js +0 -30
- package/output/catalyst/avatar.jsx +0 -45
- package/output/catalyst/badge.d.ts +0 -35
- package/output/catalyst/badge.d.ts.map +0 -1
- package/output/catalyst/badge.js +0 -46
- package/output/catalyst/badge.jsx +0 -53
- package/output/catalyst/button.d.ts +0 -59
- package/output/catalyst/button.d.ts.map +0 -1
- package/output/catalyst/button.js +0 -181
- package/output/catalyst/button.jsx +0 -187
- package/output/catalyst/checkbox.d.ts +0 -37
- package/output/catalyst/checkbox.d.ts.map +0 -1
- package/output/catalyst/checkbox.js +0 -97
- package/output/catalyst/checkbox.jsx +0 -105
- package/output/catalyst/combobox.d.ts +0 -20
- package/output/catalyst/combobox.d.ts.map +0 -1
- package/output/catalyst/combobox.js +0 -101
- package/output/catalyst/combobox.jsx +0 -120
- package/output/catalyst/description-list.d.ts +0 -4
- package/output/catalyst/description-list.d.ts.map +0 -1
- package/output/catalyst/description-list.js +0 -25
- package/output/catalyst/description-list.jsx +0 -24
- package/output/catalyst/dialog.d.ts +0 -29
- package/output/catalyst/dialog.d.ts.map +0 -1
- package/output/catalyst/dialog.js +0 -46
- package/output/catalyst/dialog.jsx +0 -55
- package/output/catalyst/divider.d.ts +0 -4
- package/output/catalyst/divider.d.ts.map +0 -1
- package/output/catalyst/dropdown.d.ts +0 -33
- package/output/catalyst/dropdown.d.ts.map +0 -1
- package/output/catalyst/dropdown.js +0 -99
- package/output/catalyst/dropdown.jsx +0 -102
- package/output/catalyst/fieldset.d.ts +0 -22
- package/output/catalyst/fieldset.d.ts.map +0 -1
- package/output/catalyst/fieldset.js +0 -42
- package/output/catalyst/fieldset.jsx +0 -41
- package/output/catalyst/heading.d.ts +0 -7
- package/output/catalyst/heading.d.ts.map +0 -1
- package/output/catalyst/heading.js +0 -23
- package/output/catalyst/heading.jsx +0 -22
- package/output/catalyst/input.d.ts +0 -11
- package/output/catalyst/input.d.ts.map +0 -1
- package/output/catalyst/input.js +0 -70
- package/output/catalyst/input.jsx +0 -73
- package/output/catalyst/link.d.ts +0 -13
- package/output/catalyst/link.d.ts.map +0 -1
- package/output/catalyst/link.js +0 -37
- package/output/catalyst/link.jsx +0 -14
- package/output/catalyst/listbox.d.ts +0 -16
- package/output/catalyst/listbox.d.ts.map +0 -1
- package/output/catalyst/listbox.js +0 -99
- package/output/catalyst/listbox.jsx +0 -120
- package/output/catalyst/navbar.d.ts +0 -16
- package/output/catalyst/navbar.d.ts.map +0 -1
- package/output/catalyst/navbar.js +0 -59
- package/output/catalyst/navbar.jsx +0 -67
- package/output/catalyst/pagination.d.ts +0 -18
- package/output/catalyst/pagination.d.ts.map +0 -1
- package/output/catalyst/pagination.js +0 -35
- package/output/catalyst/pagination.jsx +0 -52
- package/output/catalyst/radio.d.ts +0 -38
- package/output/catalyst/radio.d.ts.map +0 -1
- package/output/catalyst/radio.js +0 -100
- package/output/catalyst/radio.jsx +0 -103
- package/output/catalyst/select.d.ts +0 -6
- package/output/catalyst/select.d.ts.map +0 -1
- package/output/catalyst/select.js +0 -52
- package/output/catalyst/select.jsx +0 -59
- package/output/catalyst/sidebar-layout.d.ts +0 -6
- package/output/catalyst/sidebar-layout.d.ts.map +0 -1
- package/output/catalyst/sidebar-layout.js +0 -18
- package/output/catalyst/sidebar-layout.jsx +0 -58
- package/output/catalyst/sidebar.d.ts +0 -20
- package/output/catalyst/sidebar.d.ts.map +0 -1
- package/output/catalyst/sidebar.js +0 -77
- package/output/catalyst/sidebar.jsx +0 -85
- package/output/catalyst/stacked-layout.d.ts +0 -6
- package/output/catalyst/stacked-layout.d.ts.map +0 -1
- package/output/catalyst/stacked-layout.js +0 -18
- package/output/catalyst/stacked-layout.jsx +0 -55
- package/output/catalyst/switch.d.ts +0 -37
- package/output/catalyst/switch.d.ts.map +0 -1
- package/output/catalyst/switch.js +0 -160
- package/output/catalyst/switch.jsx +0 -161
- package/output/catalyst/table.d.ts +0 -17
- package/output/catalyst/table.d.ts.map +0 -1
- package/output/catalyst/table.js +0 -56
- package/output/catalyst/table.jsx +0 -68
- package/output/catalyst/text.d.ts +0 -6
- package/output/catalyst/text.d.ts.map +0 -1
- package/output/catalyst/text.js +0 -30
- package/output/catalyst/text.jsx +0 -29
- package/output/catalyst/textarea.d.ts +0 -7
- package/output/catalyst/textarea.d.ts.map +0 -1
- package/output/catalyst/textarea.js +0 -48
- package/output/catalyst/textarea.jsx +0 -49
- package/output/catalyst-config/catalyst-config.d.ts +0 -14
- package/output/catalyst-config/catalyst-config.d.ts.map +0 -1
- package/output/catalyst-config/catalyst-config.js +0 -14
- package/output/catalyst-config/index.d.ts +0 -3
- package/output/catalyst-config/index.d.ts.map +0 -1
- package/output/catalyst-config/index.js +0 -1
- package/output/helpers/cache-api/cache-api.d.ts +0 -13
- package/output/helpers/cache-api/cache-api.d.ts.map +0 -1
- package/output/helpers/cache-api/cache-api.js +0 -114
- package/output/helpers/cache-api/cache-api.test.d.ts +0 -2
- package/output/helpers/cache-api/cache-api.test.d.ts.map +0 -1
- package/output/helpers/cache-api/cache-api.test.js +0 -348
- package/output/helpers/cache-api/index.d.ts +0 -2
- package/output/helpers/cache-api/index.d.ts.map +0 -1
- package/output/helpers/cache-api/index.js +0 -1
- package/output/helpers/service/index.d.ts +0 -1
- package/output/helpers/service/index.d.ts.map +0 -1
- package/output/helpers/service/index.js +0 -1
- package/output/helpers/service/service.d.ts +0 -5
- package/output/helpers/service/service.d.ts.map +0 -1
- package/output/helpers/service/service.js +0 -2
- package/output/helpers/side-cache/index.d.ts +0 -2
- package/output/helpers/side-cache/index.d.ts.map +0 -1
- package/output/helpers/side-cache/index.js +0 -1
- package/output/helpers/side-cache/side-cache.d.ts +0 -10
- package/output/helpers/side-cache/side-cache.d.ts.map +0 -1
- package/output/helpers/side-cache/side-cache.js +0 -137
- package/output/helpers/side-cache/side-cache.test.d.ts.map +0 -1
- package/output/helpers/side-cache/side-cache.test.js +0 -179
- package/output/helpers/use-observer/index.d.ts +0 -2
- package/output/helpers/use-observer/index.d.ts.map +0 -1
- package/output/helpers/use-observer/index.js +0 -1
- package/output/helpers/use-observer/use-observer.d.ts.map +0 -1
- package/output/helpers/use-observer/use-observer.test.d.ts.map +0 -1
- package/output/helpers/use-observer/use-observer.test.jsx +0 -134
- package/output/loading-button/index.d.ts.map +0 -1
- package/output/loading-button/index.test.d.ts.map +0 -1
- package/output/service/index.d.ts.map +0 -1
- package/output/service/service.d.ts +0 -286
- package/output/service/service.d.ts.map +0 -1
- package/output/service/service.js +0 -351
- package/output/service/service.test.d.ts.map +0 -1
- package/output/service/service.test.jsx +0 -367
- package/output/side-cache/index.d.ts +0 -2
- package/output/side-cache/index.d.ts.map +0 -1
- package/output/side-cache/index.js +0 -1
- package/output/side-cache/side-cache.d.ts.map +0 -1
- package/output/side-cache/side-cache.test.d.ts +0 -2
- package/output/side-cache/side-cache.test.d.ts.map +0 -1
- package/output/signin/context.d.ts.map +0 -1
- package/output/signin/index.d.ts.map +0 -1
- package/output/signin/service.d.ts.map +0 -1
- package/output/signin/service.test.d.ts.map +0 -1
- package/output/signin/types.d.ts.map +0 -1
- package/output/size-provider/index.d.ts +0 -2
- package/output/size-provider/index.d.ts.map +0 -1
- package/output/size-provider/index.js +0 -1
- package/output/size-provider/size-provider.d.ts.map +0 -1
- package/output/toaster/index.d.ts.map +0 -1
- package/output/use-observer/index.d.ts +0 -2
- package/output/use-observer/index.d.ts.map +0 -1
- package/output/use-observer/index.js +0 -1
- package/output/use-observer/use-observer.d.ts +0 -3
- package/output/use-observer/use-observer.d.ts.map +0 -1
- package/output/use-observer/use-observer.js +0 -16
- package/output/use-observer/use-observer.test.d.ts +0 -2
- package/output/use-observer/use-observer.test.d.ts.map +0 -1
- package/output/use-observer/use-observer.test.jsx +0 -134
- /package/output/{loading-button → components/loading-button}/index.test.d.ts +0 -0
- /package/output/{service → features/signin}/service.test.d.ts +0 -0
- /package/output/{signin → features/signin}/types.d.ts +0 -0
- /package/output/{signin → features/signin}/types.js +0 -0
- /package/output/{helpers → hooks}/use-observer/use-observer.d.ts +0 -0
- /package/output/{helpers → hooks}/use-observer/use-observer.test.d.ts +0 -0
- /package/output/{cache-api → services/cache-api}/cache-api.d.ts +0 -0
- /package/output/{cache-api → services/cache-api}/cache-api.test.d.ts +0 -0
- /package/output/{signin → services/service}/service.test.d.ts +0 -0
- /package/output/{side-cache → services/side-cache}/side-cache.d.ts +0 -0
- /package/output/{side-cache → services/side-cache}/side-cache.js +0 -0
- /package/output/{helpers → services}/side-cache/side-cache.test.d.ts +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Metric } from 'web-vitals';
|
|
2
|
+
/**
|
|
3
|
+
* 性能指标类型
|
|
4
|
+
*/
|
|
5
|
+
export interface PerformanceMetrics {
|
|
6
|
+
cls?: Metric;
|
|
7
|
+
fcp?: Metric;
|
|
8
|
+
inp?: Metric;
|
|
9
|
+
lcp?: Metric;
|
|
10
|
+
ttfb?: Metric;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 性能监控配置
|
|
14
|
+
*/
|
|
15
|
+
export interface PerformanceMonitorConfig {
|
|
16
|
+
/**
|
|
17
|
+
* 是否启用性能监控
|
|
18
|
+
*/
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 是否在控制台输出日志
|
|
22
|
+
*/
|
|
23
|
+
logToConsole: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 性能指标上报回调
|
|
26
|
+
*/
|
|
27
|
+
onMetric?: (metric: Metric) => void;
|
|
28
|
+
/**
|
|
29
|
+
* 错误追踪回调
|
|
30
|
+
*/
|
|
31
|
+
onError?: (error: Error) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 性能监控器类
|
|
35
|
+
*/
|
|
36
|
+
export declare class PerformanceMonitor {
|
|
37
|
+
private config;
|
|
38
|
+
private metrics;
|
|
39
|
+
private isInitialized;
|
|
40
|
+
constructor(config?: Partial<PerformanceMonitorConfig>);
|
|
41
|
+
/**
|
|
42
|
+
* 初始化性能监控
|
|
43
|
+
*/
|
|
44
|
+
init(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 处理性能指标
|
|
47
|
+
*/
|
|
48
|
+
private handleMetric;
|
|
49
|
+
/**
|
|
50
|
+
* 输出性能指标到控制台
|
|
51
|
+
*/
|
|
52
|
+
private logMetric;
|
|
53
|
+
/**
|
|
54
|
+
* 设置错误追踪
|
|
55
|
+
*/
|
|
56
|
+
private setupErrorTracking;
|
|
57
|
+
/**
|
|
58
|
+
* 处理错误
|
|
59
|
+
*/
|
|
60
|
+
private handleError;
|
|
61
|
+
/**
|
|
62
|
+
* 获取当前收集的所有性能指标
|
|
63
|
+
*/
|
|
64
|
+
getMetrics(): PerformanceMetrics;
|
|
65
|
+
/**
|
|
66
|
+
* 手动记录自定义性能指标
|
|
67
|
+
*/
|
|
68
|
+
recordCustomMetric(name: string, value: number, metadata?: Record<string, unknown>): void;
|
|
69
|
+
/**
|
|
70
|
+
* 手动报告错误
|
|
71
|
+
*/
|
|
72
|
+
reportError(error: Error | string): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 获取性能监控器单例
|
|
76
|
+
*/
|
|
77
|
+
export declare function getPerformanceMonitor(config?: Partial<PerformanceMonitorConfig>): PerformanceMonitor;
|
|
78
|
+
/**
|
|
79
|
+
* 初始化性能监控(便捷函数)
|
|
80
|
+
*/
|
|
81
|
+
export declare function initPerformanceMonitoring(config?: Partial<PerformanceMonitorConfig>): void;
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/utils/performance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,YAAY,CAAA;AAE5E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AAUD;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,aAAa,CAAQ;gBAEjB,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC;IAItD;;OAEG;IACH,IAAI,IAAI,IAAI;IAsBZ;;OAEG;IACH,OAAO,CAAC,YAAY;IAYpB;;OAEG;IACH,OAAO,CAAC,SAAS;IAWjB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,UAAU,IAAI,kBAAkB;IAIhC;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAkBzF;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI;CAIzC;AAKD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,kBAAkB,CAKpG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAG1F"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { onCLS, onFCP, onINP, onLCP, onTTFB } from 'web-vitals';
|
|
2
|
+
/**
|
|
3
|
+
* 默认配置
|
|
4
|
+
*/
|
|
5
|
+
const defaultConfig = {
|
|
6
|
+
enabled: true,
|
|
7
|
+
logToConsole: true,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 性能监控器类
|
|
11
|
+
*/
|
|
12
|
+
export class PerformanceMonitor {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.metrics = {};
|
|
15
|
+
this.isInitialized = false;
|
|
16
|
+
this.config = Object.assign(Object.assign({}, defaultConfig), config);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 初始化性能监控
|
|
20
|
+
*/
|
|
21
|
+
init() {
|
|
22
|
+
if (this.isInitialized || !this.config.enabled) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this.isInitialized = true;
|
|
26
|
+
// 注册 Core Web Vitals 监听器
|
|
27
|
+
onCLS(this.handleMetric.bind(this));
|
|
28
|
+
onFCP(this.handleMetric.bind(this));
|
|
29
|
+
onINP(this.handleMetric.bind(this));
|
|
30
|
+
onLCP(this.handleMetric.bind(this));
|
|
31
|
+
onTTFB(this.handleMetric.bind(this));
|
|
32
|
+
// 注册全局错误监听器
|
|
33
|
+
this.setupErrorTracking();
|
|
34
|
+
if (this.config.logToConsole) {
|
|
35
|
+
console.log('[PerformanceMonitor] 性能监控已初始化');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 处理性能指标
|
|
40
|
+
*/
|
|
41
|
+
handleMetric(metric) {
|
|
42
|
+
this.metrics[metric.name.toLowerCase()] = metric;
|
|
43
|
+
if (this.config.logToConsole) {
|
|
44
|
+
this.logMetric(metric);
|
|
45
|
+
}
|
|
46
|
+
if (this.config.onMetric) {
|
|
47
|
+
this.config.onMetric(metric);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 输出性能指标到控制台
|
|
52
|
+
*/
|
|
53
|
+
logMetric(metric) {
|
|
54
|
+
const { name, value, rating } = metric;
|
|
55
|
+
const color = rating === 'good' ? '#22c55e' : rating === 'needs-improvement' ? '#eab308' : '#ef4444';
|
|
56
|
+
console.log(`%c[Performance] ${name}: ${value.toFixed(2)} (${rating})`, `color: ${color}; font-weight: bold;`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 设置错误追踪
|
|
60
|
+
*/
|
|
61
|
+
setupErrorTracking() {
|
|
62
|
+
window.addEventListener('error', (event) => {
|
|
63
|
+
this.handleError(event.error || new Error(event.message));
|
|
64
|
+
});
|
|
65
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
66
|
+
this.handleError(new Error(`Unhandled Promise Rejection: ${event.reason}`));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 处理错误
|
|
71
|
+
*/
|
|
72
|
+
handleError(error) {
|
|
73
|
+
if (this.config.logToConsole) {
|
|
74
|
+
console.error('[PerformanceMonitor] 捕获到错误:', error);
|
|
75
|
+
}
|
|
76
|
+
if (this.config.onError) {
|
|
77
|
+
this.config.onError(error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 获取当前收集的所有性能指标
|
|
82
|
+
*/
|
|
83
|
+
getMetrics() {
|
|
84
|
+
return Object.assign({}, this.metrics);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 手动记录自定义性能指标
|
|
88
|
+
*/
|
|
89
|
+
recordCustomMetric(name, value, metadata) {
|
|
90
|
+
const customMetric = {
|
|
91
|
+
name,
|
|
92
|
+
value,
|
|
93
|
+
rating: value < 100 ? 'good' : value < 300 ? 'needs-improvement' : 'poor',
|
|
94
|
+
delta: value,
|
|
95
|
+
entries: [],
|
|
96
|
+
id: `custom-${Date.now()}`,
|
|
97
|
+
navigationType: 'navigate',
|
|
98
|
+
};
|
|
99
|
+
this.handleMetric(customMetric);
|
|
100
|
+
if (this.config.logToConsole && metadata) {
|
|
101
|
+
console.log('[PerformanceMonitor] 自定义指标元数据:', metadata);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 手动报告错误
|
|
106
|
+
*/
|
|
107
|
+
reportError(error) {
|
|
108
|
+
const errorObj = typeof error === 'string' ? new Error(error) : error;
|
|
109
|
+
this.handleError(errorObj);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// 创建单例实例
|
|
113
|
+
let monitorInstance = null;
|
|
114
|
+
/**
|
|
115
|
+
* 获取性能监控器单例
|
|
116
|
+
*/
|
|
117
|
+
export function getPerformanceMonitor(config) {
|
|
118
|
+
if (!monitorInstance) {
|
|
119
|
+
monitorInstance = new PerformanceMonitor(config);
|
|
120
|
+
}
|
|
121
|
+
return monitorInstance;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 初始化性能监控(便捷函数)
|
|
125
|
+
*/
|
|
126
|
+
export function initPerformanceMonitoring(config) {
|
|
127
|
+
const monitor = getPerformanceMonitor(config);
|
|
128
|
+
monitor.init();
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/utils/redirect/index.ts"],"names":[],"mappings":"AAEA,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAA;CACf;AAgBD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAwBzG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const LOCALE_SEGMENT_REGEX = /^\/(zh-CN|en-US)(\/|$)/;
|
|
2
|
+
function withLocalePrefix(pathname, locale) {
|
|
3
|
+
const normalizedPathname = pathname.startsWith('/') ? pathname : `/${pathname}`;
|
|
4
|
+
if (LOCALE_SEGMENT_REGEX.test(normalizedPathname)) {
|
|
5
|
+
return normalizedPathname;
|
|
6
|
+
}
|
|
7
|
+
if (normalizedPathname === '/') {
|
|
8
|
+
return `/${locale}`;
|
|
9
|
+
}
|
|
10
|
+
return `/${locale}${normalizedPathname}`;
|
|
11
|
+
}
|
|
12
|
+
export function resolveSafeRedirect(redirect, locale) {
|
|
13
|
+
if (!(redirect === null || redirect === void 0 ? void 0 : redirect.trim())) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const url = new URL(redirect, window.location.origin);
|
|
18
|
+
if (!['http:', 'https:'].includes(url.protocol)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (url.origin !== window.location.origin) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const pathname = withLocalePrefix(url.pathname, locale);
|
|
25
|
+
return {
|
|
26
|
+
target: `${pathname}${url.search}${url.hash}`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,64 +1,153 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taicode/common-web",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"author": "Alain",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16.0.0"
|
|
10
|
+
},
|
|
7
11
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
},
|
|
13
|
-
"./
|
|
14
|
-
"types": "./output/
|
|
15
|
-
"
|
|
16
|
-
|
|
12
|
+
"./styles.css": "./styles.css",
|
|
13
|
+
"./ui": {
|
|
14
|
+
"types": "./output/components/index.d.ts",
|
|
15
|
+
"default": "./output/components/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./service": {
|
|
18
|
+
"types": "./output/services/service/index.d.ts",
|
|
19
|
+
"default": "./output/services/service/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./toaster": {
|
|
22
|
+
"types": "./output/components/toaster/index.d.ts",
|
|
23
|
+
"default": "./output/components/toaster/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./loading-button": {
|
|
26
|
+
"types": "./output/components/loading-button/index.d.ts",
|
|
27
|
+
"default": "./output/components/loading-button/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./size-provider": {
|
|
30
|
+
"types": "./output/components/size-provider/index.d.ts",
|
|
31
|
+
"default": "./output/components/size-provider/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./use-loading": {
|
|
34
|
+
"types": "./output/hooks/use-loading/index.d.ts",
|
|
35
|
+
"default": "./output/hooks/use-loading/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./use-observer": {
|
|
38
|
+
"types": "./output/hooks/use-observer/index.d.ts",
|
|
39
|
+
"default": "./output/hooks/use-observer/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./cn": {
|
|
42
|
+
"types": "./output/utils/cn/index.d.ts",
|
|
43
|
+
"default": "./output/utils/cn/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./cache-api": {
|
|
46
|
+
"types": "./output/services/cache-api/index.d.ts",
|
|
47
|
+
"default": "./output/services/cache-api/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./side-cache": {
|
|
50
|
+
"types": "./output/services/side-cache/index.d.ts",
|
|
51
|
+
"default": "./output/services/side-cache/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./signin": {
|
|
54
|
+
"types": "./output/features/signin/index.d.ts",
|
|
55
|
+
"default": "./output/features/signin/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./vite-config": {
|
|
58
|
+
"types": "./output/vite-config/index.d.ts",
|
|
59
|
+
"default": "./output/vite-config/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./features/*": {
|
|
62
|
+
"types": "./output/features/*/index.d.ts",
|
|
63
|
+
"default": "./output/features/*/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./components/*": {
|
|
66
|
+
"types": "./output/components/*/index.d.ts",
|
|
67
|
+
"default": "./output/components/*/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./hooks/*": {
|
|
70
|
+
"types": "./output/hooks/*/index.d.ts",
|
|
71
|
+
"default": "./output/hooks/*/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./services/*": {
|
|
74
|
+
"types": "./output/services/*/index.d.ts",
|
|
75
|
+
"default": "./output/services/*/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./utils/*": {
|
|
78
|
+
"types": "./output/utils/*/index.d.ts",
|
|
79
|
+
"default": "./output/utils/*/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./layout": {
|
|
82
|
+
"types": "./output/layout/index.d.ts",
|
|
83
|
+
"default": "./output/layout/index.js"
|
|
84
|
+
},
|
|
85
|
+
"./layout/*": {
|
|
86
|
+
"types": "./output/layout/*/index.d.ts",
|
|
87
|
+
"default": "./output/layout/*/index.js"
|
|
17
88
|
}
|
|
18
89
|
},
|
|
19
90
|
"files": [
|
|
20
|
-
"output"
|
|
91
|
+
"output",
|
|
92
|
+
"styles.css"
|
|
21
93
|
],
|
|
22
94
|
"scripts": {
|
|
23
95
|
"test": "vitest",
|
|
24
96
|
"test:ui": "vitest --ui",
|
|
25
97
|
"test:run": "vitest run",
|
|
26
98
|
"prepublishOnly": "npm run build",
|
|
27
|
-
"build": "tsc -p tsconfig.json",
|
|
28
|
-
"dev": "tsc -p tsconfig.json --watch"
|
|
99
|
+
"build": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json",
|
|
100
|
+
"dev": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json --watch",
|
|
101
|
+
"pack:local": "pnpm build && mkdir -p ../../.local-packages && pnpm pack --pack-destination ../../.local-packages"
|
|
29
102
|
},
|
|
30
103
|
"peerDependencies": {
|
|
31
|
-
"@heroicons/react": "^2.2.0",
|
|
32
104
|
"@needle-di/core": ">=1.0.0",
|
|
33
|
-
"@
|
|
105
|
+
"@heroicons/react": "^2.2.0",
|
|
106
|
+
"@taicode/common-base": "^3.1.0",
|
|
34
107
|
"@types/react": ">=18",
|
|
35
108
|
"mobx": ">=6",
|
|
36
109
|
"mobx-react-lite": "^4.1.1",
|
|
37
110
|
"react": ">=18"
|
|
38
111
|
},
|
|
39
112
|
"dependencies": {
|
|
40
|
-
"@headlessui/react": "^2.2.
|
|
113
|
+
"@headlessui/react": "^2.2.9",
|
|
41
114
|
"@heroicons/react": "^2.2.0",
|
|
42
115
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
43
116
|
"@radix-ui/react-slot": "^1.2.4",
|
|
44
117
|
"class-variance-authority": "^0.7.1",
|
|
45
118
|
"clsx": "^2.1.1",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
119
|
+
"cmdk": "^1.1.1",
|
|
120
|
+
"framer-motion": "^12.34.3",
|
|
121
|
+
"jsoneditor": "^10.4.2",
|
|
122
|
+
"lucide-react": "^0.468.0",
|
|
123
|
+
"radix-ui": "^1.4.3",
|
|
124
|
+
"react-hook-form": "^7.71.2",
|
|
125
|
+
"sonner": "^1.7.4",
|
|
126
|
+
"tailwind-merge": "^3.5.0",
|
|
127
|
+
"web-vitals": "^5.1.0"
|
|
49
128
|
},
|
|
50
129
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@testing-library/
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
130
|
+
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
131
|
+
"@needle-di/core": "^1.1.1",
|
|
132
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
133
|
+
"@testing-library/react": "^14.3.1",
|
|
134
|
+
"@types/react": "^18.3.28",
|
|
135
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
136
|
+
"@types/jsoneditor": "^9.9.6",
|
|
137
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
138
|
+
"@vitest/ui": "^3.2.7",
|
|
56
139
|
"execa": "^8.0.1",
|
|
57
|
-
"jsdom": "^23.
|
|
58
|
-
"mobx": "^6.
|
|
140
|
+
"jsdom": "^23.2.0",
|
|
141
|
+
"mobx": "^6.15.0",
|
|
59
142
|
"mobx-react-lite": "^4.1.1",
|
|
60
|
-
"react": "^18.
|
|
143
|
+
"react": "^18.3.1",
|
|
144
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
61
145
|
"type-detect": "^4.1.0",
|
|
62
|
-
"
|
|
146
|
+
"vite": "^5.4.20",
|
|
147
|
+
"vite-plugin-i18next-loader": "^3.0.1",
|
|
148
|
+
"vite-plugin-pwa": "^0.21.2",
|
|
149
|
+
"vite-plugin-svgr": "^4.5.0",
|
|
150
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
151
|
+
"vitest": "^3.2.7"
|
|
63
152
|
}
|
|
64
153
|
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@custom-variant dark (&:is(.dark *));
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--background: oklch(1 0 0);
|
|
5
|
+
--foreground: oklch(0.145 0 0);
|
|
6
|
+
--card: oklch(1 0 0);
|
|
7
|
+
--card-foreground: oklch(0.145 0 0);
|
|
8
|
+
--popover: oklch(1 0 0);
|
|
9
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
10
|
+
--primary: oklch(0.205 0 0);
|
|
11
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
12
|
+
--secondary: oklch(0.97 0 0);
|
|
13
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
14
|
+
--muted: oklch(0.97 0 0);
|
|
15
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
16
|
+
--accent: oklch(0.97 0 0);
|
|
17
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
18
|
+
--destructive: oklch(0.58 0.22 27);
|
|
19
|
+
--border: oklch(0.922 0 0);
|
|
20
|
+
--input: oklch(0.922 0 0);
|
|
21
|
+
--ring: oklch(0.708 0 0);
|
|
22
|
+
--chart-1: oklch(0.809 0.105 251.813);
|
|
23
|
+
--chart-2: oklch(0.623 0.214 259.815);
|
|
24
|
+
--chart-3: oklch(0.546 0.245 262.881);
|
|
25
|
+
--chart-4: oklch(0.488 0.243 264.376);
|
|
26
|
+
--chart-5: oklch(0.424 0.199 265.638);
|
|
27
|
+
--radius: 0.625rem;
|
|
28
|
+
--sidebar: oklch(0.985 0 0);
|
|
29
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
30
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
31
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
32
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
33
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
34
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
35
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dark {
|
|
39
|
+
--background: oklch(0.145 0 0);
|
|
40
|
+
--foreground: oklch(0.985 0 0);
|
|
41
|
+
--card: oklch(0.205 0 0);
|
|
42
|
+
--card-foreground: oklch(0.985 0 0);
|
|
43
|
+
--popover: oklch(0.205 0 0);
|
|
44
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
45
|
+
--primary: oklch(0.87 0 0);
|
|
46
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
47
|
+
--secondary: oklch(0.269 0 0);
|
|
48
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
49
|
+
--muted: oklch(0.269 0 0);
|
|
50
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
51
|
+
--accent: oklch(0.371 0 0);
|
|
52
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
53
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
54
|
+
--border: oklch(1 0 0 / 10%);
|
|
55
|
+
--input: oklch(1 0 0 / 15%);
|
|
56
|
+
--ring: oklch(0.556 0 0);
|
|
57
|
+
--chart-1: oklch(0.809 0.105 251.813);
|
|
58
|
+
--chart-2: oklch(0.623 0.214 259.815);
|
|
59
|
+
--chart-3: oklch(0.546 0.245 262.881);
|
|
60
|
+
--chart-4: oklch(0.488 0.243 264.376);
|
|
61
|
+
--chart-5: oklch(0.424 0.199 265.638);
|
|
62
|
+
--sidebar: oklch(0.205 0 0);
|
|
63
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
64
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
65
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
66
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
67
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
68
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
69
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@theme inline {
|
|
73
|
+
--font-sans: 'Inter Variable', sans-serif;
|
|
74
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
75
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
76
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
77
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
78
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
79
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
80
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
81
|
+
--color-sidebar: var(--sidebar);
|
|
82
|
+
--color-chart-5: var(--chart-5);
|
|
83
|
+
--color-chart-4: var(--chart-4);
|
|
84
|
+
--color-chart-3: var(--chart-3);
|
|
85
|
+
--color-chart-2: var(--chart-2);
|
|
86
|
+
--color-chart-1: var(--chart-1);
|
|
87
|
+
--color-ring: var(--ring);
|
|
88
|
+
--color-input: var(--input);
|
|
89
|
+
--color-border: var(--border);
|
|
90
|
+
--color-destructive: var(--destructive);
|
|
91
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
92
|
+
--color-accent: var(--accent);
|
|
93
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
94
|
+
--color-muted: var(--muted);
|
|
95
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
96
|
+
--color-secondary: var(--secondary);
|
|
97
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
98
|
+
--color-primary: var(--primary);
|
|
99
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
100
|
+
--color-popover: var(--popover);
|
|
101
|
+
--color-card-foreground: var(--card-foreground);
|
|
102
|
+
--color-card: var(--card);
|
|
103
|
+
--color-foreground: var(--foreground);
|
|
104
|
+
--color-background: var(--background);
|
|
105
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
106
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
107
|
+
--radius-lg: var(--radius);
|
|
108
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
109
|
+
--radius-2xl: calc(var(--radius) + 8px);
|
|
110
|
+
--radius-3xl: calc(var(--radius) + 12px);
|
|
111
|
+
--radius-4xl: calc(var(--radius) + 16px);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@layer base {
|
|
115
|
+
* {
|
|
116
|
+
@apply border-border outline-ring/50;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
html,
|
|
120
|
+
body {
|
|
121
|
+
@apply font-sans bg-background text-foreground;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-api.d.ts","sourceRoot":"","sources":["../../source/cache-api/cache-api.ts"],"names":[],"mappings":"AAKA,KAAK,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;AAE3E,qBAAa,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC;IAW9B,OAAO,CAAC,IAAI;IATxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAG3C,OAAO,CAAC,QAAQ,CAAe;IAI/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAI;gBAEhB,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAIvC,IACI,OAAO,IAAI,OAAO,CAErB;IAED,IACI,KAAK,IAAI,OAAO,CAEnB;IAED,IACI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAGK,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAuBlC;;;OAGG;IAEG,OAAO,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,CAAC,CAAC;IAcjD;;OAEG;IAEG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-api.test.d.ts","sourceRoot":"","sources":["../../source/cache-api/cache-api.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/cache-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CacheApi } from './cache-api';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Headless from '@headlessui/react';
|
|
2
|
-
import type React from 'react';
|
|
3
|
-
import { Text } from './text';
|
|
4
|
-
declare const sizes: {
|
|
5
|
-
xs: string;
|
|
6
|
-
sm: string;
|
|
7
|
-
md: string;
|
|
8
|
-
lg: string;
|
|
9
|
-
xl: string;
|
|
10
|
-
'2xl': string;
|
|
11
|
-
'3xl': string;
|
|
12
|
-
'4xl': string;
|
|
13
|
-
'5xl': string;
|
|
14
|
-
};
|
|
15
|
-
export declare function Alert({ size, className, children, ...props }: {
|
|
16
|
-
size?: keyof typeof sizes;
|
|
17
|
-
className?: string;
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
} & Omit<Headless.DialogProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare function AlertTitle({ className, ...props }: {
|
|
21
|
-
className?: string;
|
|
22
|
-
} & Omit<Headless.DialogTitleProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function AlertDescription({ className, ...props }: {
|
|
24
|
-
className?: string;
|
|
25
|
-
} & Omit<Headless.DescriptionProps<typeof Text>, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export declare function AlertBody({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export declare function AlertActions({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../source/catalyst/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,QAAA,MAAM,KAAK;;;;;;;;;;CAUV,CAAA;AAED,wBAAgB,KAAK,CAAC,EACpB,IAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,IAAI,CACpF,QAAQ,CAAC,WAAW,EACpB,IAAI,GAAG,WAAW,CACnB,2CAyBA;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,GAAG,WAAW,CAAC,2CAU9E;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,2CAQ3F;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,2CAEvF;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,2CAU1F"}
|
package/output/catalyst/alert.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as Headless from '@headlessui/react';
|
|
14
|
-
import clsx from 'clsx';
|
|
15
|
-
import { Text } from './text';
|
|
16
|
-
const sizes = {
|
|
17
|
-
xs: 'sm:max-w-xs',
|
|
18
|
-
sm: 'sm:max-w-sm',
|
|
19
|
-
md: 'sm:max-w-md',
|
|
20
|
-
lg: 'sm:max-w-lg',
|
|
21
|
-
xl: 'sm:max-w-xl',
|
|
22
|
-
'2xl': 'sm:max-w-2xl',
|
|
23
|
-
'3xl': 'sm:max-w-3xl',
|
|
24
|
-
'4xl': 'sm:max-w-4xl',
|
|
25
|
-
'5xl': 'sm:max-w-5xl',
|
|
26
|
-
};
|
|
27
|
-
export function Alert(_a) {
|
|
28
|
-
var { size = 'md', className, children } = _a, props = __rest(_a, ["size", "className", "children"]);
|
|
29
|
-
return (_jsxs(Headless.Dialog, Object.assign({}, props, { children: [_jsx(Headless.DialogBackdrop, { transition: true, className: "fixed inset-0 flex w-screen justify-center overflow-y-auto bg-zinc-950/15 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-zinc-950/50" }), _jsx("div", { className: "fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0", children: _jsx("div", { className: "grid min-h-full grid-rows-[1fr_auto_1fr] justify-items-center p-8 sm:grid-rows-[1fr_auto_3fr] sm:p-4", children: _jsx(Headless.DialogPanel, { transition: true, className: clsx(className, sizes[size], 'row-start-2 w-full rounded-2xl bg-white p-8 shadow-lg ring-1 ring-zinc-950/10 sm:rounded-2xl sm:p-6 dark:bg-zinc-900 dark:ring-white/10 forced-colors:outline', 'transition duration-100 will-change-transform data-closed:opacity-0 data-enter:ease-out data-closed:data-enter:scale-95 data-leave:ease-in'), children: children }) }) })] })));
|
|
30
|
-
}
|
|
31
|
-
export function AlertTitle(_a) {
|
|
32
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
33
|
-
return (_jsx(Headless.DialogTitle, Object.assign({}, props, { className: clsx(className, 'text-center text-base/6 font-semibold text-balance text-zinc-950 sm:text-left sm:text-sm/6 sm:text-wrap dark:text-white') })));
|
|
34
|
-
}
|
|
35
|
-
export function AlertDescription(_a) {
|
|
36
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
37
|
-
return (_jsx(Headless.Description, Object.assign({ as: Text }, props, { className: clsx(className, 'mt-2 text-center text-pretty sm:text-left') })));
|
|
38
|
-
}
|
|
39
|
-
export function AlertBody(_a) {
|
|
40
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
41
|
-
return _jsx("div", Object.assign({}, props, { className: clsx(className, 'mt-4') }));
|
|
42
|
-
}
|
|
43
|
-
export function AlertActions(_a) {
|
|
44
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
45
|
-
return (_jsx("div", Object.assign({}, props, { className: clsx(className, 'mt-6 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:mt-4 sm:flex-row sm:*:w-auto') })));
|
|
46
|
-
}
|