tempest-react-sdk 0.47.0 → 0.49.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/dist/audio/sfx-pool.cjs +1 -1
- package/dist/audio/sfx-pool.cjs.map +1 -1
- package/dist/audio/sfx-pool.js +16 -7
- package/dist/audio/sfx-pool.js.map +1 -1
- package/dist/audio/use-sfx-pool.cjs +1 -1
- package/dist/audio/use-sfx-pool.cjs.map +1 -1
- package/dist/audio/use-sfx-pool.js +3 -8
- package/dist/audio/use-sfx-pool.js.map +1 -1
- package/dist/auth/passkey.cjs +1 -1
- package/dist/auth/passkey.cjs.map +1 -1
- package/dist/auth/passkey.js +79 -81
- package/dist/auth/passkey.js.map +1 -1
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +4 -4
- package/dist/components/AIChat/AIChatTurn.cjs +1 -1
- package/dist/components/AIChat/AIChatTurn.js +4 -4
- package/dist/components/AppBar/use-sticky-body-warning.cjs.map +1 -1
- package/dist/components/AppBar/use-sticky-body-warning.js.map +1 -1
- package/dist/components/BarList/BarList.cjs +1 -1
- package/dist/components/BarList/BarList.cjs.map +1 -1
- package/dist/components/BarList/BarList.js +31 -24
- package/dist/components/BarList/BarList.js.map +1 -1
- package/dist/components/BarList/bar-list-model.cjs +1 -1
- package/dist/components/BarList/bar-list-model.cjs.map +1 -1
- package/dist/components/BarList/bar-list-model.js +5 -5
- package/dist/components/BarList/bar-list-model.js.map +1 -1
- package/dist/components/ClickOutside/ClickOutside.cjs +1 -1
- package/dist/components/ClickOutside/ClickOutside.cjs.map +1 -1
- package/dist/components/ClickOutside/ClickOutside.js +13 -14
- package/dist/components/ClickOutside/ClickOutside.js.map +1 -1
- package/dist/components/DataTable/DataTable.cjs +1 -1
- package/dist/components/DataTable/DataTable.cjs.map +1 -1
- package/dist/components/DataTable/DataTable.js +131 -129
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/use-dev-warnings.cjs.map +1 -1
- package/dist/components/DataTable/use-dev-warnings.js.map +1 -1
- package/dist/components/FilterBar/filter-apply.cjs +1 -1
- package/dist/components/FilterBar/filter-apply.cjs.map +1 -1
- package/dist/components/FilterBar/filter-apply.js +35 -38
- package/dist/components/FilterBar/filter-apply.js.map +1 -1
- package/dist/components/FilterBar/filter-query.cjs +1 -1
- package/dist/components/FilterBar/filter-query.cjs.map +1 -1
- package/dist/components/FilterBar/filter-query.js +16 -13
- package/dist/components/FilterBar/filter-query.js.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +21 -21
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.js +91 -38
- package/dist/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.module.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.js +12 -8
- package/dist/components/Sidebar/Sidebar.module.js.map +1 -1
- package/dist/forms/masked-inputs.cjs +1 -1
- package/dist/forms/masked-inputs.js +12 -12
- package/dist/geo/use-position-tracker.cjs +1 -1
- package/dist/geo/use-position-tracker.cjs.map +1 -1
- package/dist/geo/use-position-tracker.js +25 -26
- package/dist/geo/use-position-tracker.js.map +1 -1
- package/dist/hooks/use-async.cjs +1 -1
- package/dist/hooks/use-async.cjs.map +1 -1
- package/dist/hooks/use-async.js +27 -30
- package/dist/hooks/use-async.js.map +1 -1
- package/dist/hooks/use-click-outside.cjs +1 -1
- package/dist/hooks/use-click-outside.cjs.map +1 -1
- package/dist/hooks/use-click-outside.js +8 -9
- package/dist/hooks/use-click-outside.js.map +1 -1
- package/dist/hooks/use-countdown.cjs +1 -1
- package/dist/hooks/use-countdown.cjs.map +1 -1
- package/dist/hooks/use-countdown.js +8 -13
- package/dist/hooks/use-countdown.js.map +1 -1
- package/dist/hooks/use-event-listener.cjs +1 -1
- package/dist/hooks/use-event-listener.cjs.map +1 -1
- package/dist/hooks/use-event-listener.js +6 -6
- package/dist/hooks/use-event-listener.js.map +1 -1
- package/dist/hooks/use-interval.cjs +1 -1
- package/dist/hooks/use-interval.cjs.map +1 -1
- package/dist/hooks/use-interval.js +5 -6
- package/dist/hooks/use-interval.js.map +1 -1
- package/dist/hooks/use-latest-ref.cjs.map +1 -1
- package/dist/hooks/use-latest-ref.js.map +1 -1
- package/dist/hooks/use-long-press-handlers.cjs +1 -1
- package/dist/hooks/use-long-press-handlers.cjs.map +1 -1
- package/dist/hooks/use-long-press-handlers.js +8 -10
- package/dist/hooks/use-long-press-handlers.js.map +1 -1
- package/dist/hooks/use-long-press.cjs +1 -1
- package/dist/hooks/use-long-press.cjs.map +1 -1
- package/dist/hooks/use-long-press.js +6 -6
- package/dist/hooks/use-long-press.js.map +1 -1
- package/dist/hooks/use-online.cjs +1 -1
- package/dist/hooks/use-online.cjs.map +1 -1
- package/dist/hooks/use-online.js +10 -10
- package/dist/hooks/use-online.js.map +1 -1
- package/dist/hooks/use-service-worker-update.cjs +1 -1
- package/dist/hooks/use-service-worker-update.cjs.map +1 -1
- package/dist/hooks/use-service-worker-update.js +24 -25
- package/dist/hooks/use-service-worker-update.js.map +1 -1
- package/dist/hooks/use-stable-callback.cjs +1 -1
- package/dist/hooks/use-stable-callback.cjs.map +1 -1
- package/dist/hooks/use-stable-callback.js +4 -3
- package/dist/hooks/use-stable-callback.js.map +1 -1
- package/dist/hooks/use-timeout.cjs +1 -1
- package/dist/hooks/use-timeout.cjs.map +1 -1
- package/dist/hooks/use-timeout.js +5 -6
- package/dist/hooks/use-timeout.js.map +1 -1
- package/dist/hooks/use-typewriter.cjs +1 -1
- package/dist/hooks/use-typewriter.cjs.map +1 -1
- package/dist/hooks/use-typewriter.js +9 -18
- package/dist/hooks/use-typewriter.js.map +1 -1
- package/dist/http/api-client.cjs +1 -1
- package/dist/http/api-client.cjs.map +1 -1
- package/dist/http/api-client.js +55 -46
- package/dist/http/api-client.js.map +1 -1
- package/dist/http/describe-api-error.cjs +1 -1
- package/dist/http/describe-api-error.cjs.map +1 -1
- package/dist/http/describe-api-error.js +15 -14
- package/dist/http/describe-api-error.js.map +1 -1
- package/dist/http/errors.cjs +1 -1
- package/dist/http/errors.cjs.map +1 -1
- package/dist/http/errors.js +49 -20
- package/dist/http/errors.js.map +1 -1
- package/dist/http/resumable-upload.cjs +1 -1
- package/dist/http/resumable-upload.cjs.map +1 -1
- package/dist/http/resumable-upload.js +60 -61
- package/dist/http/resumable-upload.js.map +1 -1
- package/dist/http/retry.cjs +1 -1
- package/dist/http/retry.cjs.map +1 -1
- package/dist/http/retry.js +20 -16
- package/dist/http/retry.js.map +1 -1
- package/dist/http/use-describe-api-error.cjs +1 -1
- package/dist/http/use-describe-api-error.cjs.map +1 -1
- package/dist/http/use-describe-api-error.js +14 -10
- package/dist/http/use-describe-api-error.js.map +1 -1
- package/dist/i18n/create-i18n.cjs +1 -1
- package/dist/i18n/create-i18n.cjs.map +1 -1
- package/dist/i18n/create-i18n.js +6 -6
- package/dist/i18n/create-i18n.js.map +1 -1
- package/dist/icons/Icon.cjs +1 -1
- package/dist/icons/Icon.cjs.map +1 -1
- package/dist/icons/Icon.js +15 -14
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/IconPicker.cjs +2 -0
- package/dist/icons/IconPicker.cjs.map +1 -0
- package/dist/icons/IconPicker.js +49 -0
- package/dist/icons/IconPicker.js.map +1 -0
- package/dist/icons/IconPicker.module.cjs +2 -0
- package/dist/icons/IconPicker.module.cjs.map +1 -0
- package/dist/icons/IconPicker.module.js +10 -0
- package/dist/icons/IconPicker.module.js.map +1 -0
- package/dist/icons/alias.cjs +2 -0
- package/dist/icons/alias.cjs.map +1 -0
- package/dist/icons/alias.js +9 -0
- package/dist/icons/alias.js.map +1 -0
- package/dist/icons/generated/loaders.cjs +1 -1
- package/dist/icons/generated/loaders.cjs.map +1 -1
- package/dist/icons/generated/loaders.js +273 -28
- package/dist/icons/generated/loaders.js.map +1 -1
- package/dist/icons/generated/shard-00.cjs +2 -0
- package/dist/icons/generated/shard-00.cjs.map +1 -0
- package/dist/icons/generated/shard-00.js +48 -0
- package/dist/icons/generated/shard-00.js.map +1 -0
- package/dist/icons/generated/shard-01.cjs +2 -0
- package/dist/icons/generated/shard-01.cjs.map +1 -0
- package/dist/icons/generated/shard-01.js +48 -0
- package/dist/icons/generated/shard-01.js.map +1 -0
- package/dist/icons/generated/shard-02.cjs +2 -0
- package/dist/icons/generated/shard-02.cjs.map +1 -0
- package/dist/icons/generated/shard-02.js +48 -0
- package/dist/icons/generated/shard-02.js.map +1 -0
- package/dist/icons/generated/shard-03.cjs +2 -0
- package/dist/icons/generated/shard-03.cjs.map +1 -0
- package/dist/icons/generated/shard-03.js +48 -0
- package/dist/icons/generated/shard-03.js.map +1 -0
- package/dist/icons/generated/shard-04.cjs +2 -0
- package/dist/icons/generated/shard-04.cjs.map +1 -0
- package/dist/icons/generated/shard-04.js +48 -0
- package/dist/icons/generated/shard-04.js.map +1 -0
- package/dist/icons/generated/shard-05.cjs +2 -0
- package/dist/icons/generated/shard-05.cjs.map +1 -0
- package/dist/icons/generated/shard-05.js +48 -0
- package/dist/icons/generated/shard-05.js.map +1 -0
- package/dist/icons/generated/shard-06.cjs +2 -0
- package/dist/icons/generated/shard-06.cjs.map +1 -0
- package/dist/icons/generated/shard-06.js +48 -0
- package/dist/icons/generated/shard-06.js.map +1 -0
- package/dist/icons/generated/shard-07.cjs +2 -0
- package/dist/icons/generated/shard-07.cjs.map +1 -0
- package/dist/icons/generated/shard-07.js +48 -0
- package/dist/icons/generated/shard-07.js.map +1 -0
- package/dist/icons/generated/shard-08.cjs +2 -0
- package/dist/icons/generated/shard-08.cjs.map +1 -0
- package/dist/icons/generated/shard-08.js +48 -0
- package/dist/icons/generated/shard-08.js.map +1 -0
- package/dist/icons/generated/shard-09.cjs +2 -0
- package/dist/icons/generated/shard-09.cjs.map +1 -0
- package/dist/icons/generated/shard-09.js +48 -0
- package/dist/icons/generated/shard-09.js.map +1 -0
- package/dist/icons/generated/shard-10.cjs +2 -0
- package/dist/icons/generated/shard-10.cjs.map +1 -0
- package/dist/icons/generated/shard-10.js +48 -0
- package/dist/icons/generated/shard-10.js.map +1 -0
- package/dist/icons/generated/shard-11.cjs +2 -0
- package/dist/icons/generated/shard-11.cjs.map +1 -0
- package/dist/icons/generated/shard-11.js +48 -0
- package/dist/icons/generated/shard-11.js.map +1 -0
- package/dist/icons/generated/shard-12.cjs +2 -0
- package/dist/icons/generated/shard-12.cjs.map +1 -0
- package/dist/icons/generated/shard-12.js +48 -0
- package/dist/icons/generated/shard-12.js.map +1 -0
- package/dist/icons/generated/shard-13.cjs +2 -0
- package/dist/icons/generated/shard-13.cjs.map +1 -0
- package/dist/icons/generated/shard-13.js +48 -0
- package/dist/icons/generated/shard-13.js.map +1 -0
- package/dist/icons/generated/shard-14.cjs +2 -0
- package/dist/icons/generated/shard-14.cjs.map +1 -0
- package/dist/icons/generated/shard-14.js +48 -0
- package/dist/icons/generated/shard-14.js.map +1 -0
- package/dist/icons/generated/shard-15.cjs +2 -0
- package/dist/icons/generated/shard-15.cjs.map +1 -0
- package/dist/icons/generated/shard-15.js +48 -0
- package/dist/icons/generated/shard-15.js.map +1 -0
- package/dist/icons/generated/shard-16.cjs +2 -0
- package/dist/icons/generated/shard-16.cjs.map +1 -0
- package/dist/icons/generated/shard-16.js +48 -0
- package/dist/icons/generated/shard-16.js.map +1 -0
- package/dist/icons/generated/shard-17.cjs +2 -0
- package/dist/icons/generated/shard-17.cjs.map +1 -0
- package/dist/icons/generated/shard-17.js +48 -0
- package/dist/icons/generated/shard-17.js.map +1 -0
- package/dist/icons/generated/shard-18.cjs +2 -0
- package/dist/icons/generated/shard-18.cjs.map +1 -0
- package/dist/icons/generated/shard-18.js +48 -0
- package/dist/icons/generated/shard-18.js.map +1 -0
- package/dist/icons/generated/shard-19.cjs +2 -0
- package/dist/icons/generated/shard-19.cjs.map +1 -0
- package/dist/icons/generated/shard-19.js +48 -0
- package/dist/icons/generated/shard-19.js.map +1 -0
- package/dist/icons/generated/shard-20.cjs +2 -0
- package/dist/icons/generated/shard-20.cjs.map +1 -0
- package/dist/icons/generated/shard-20.js +48 -0
- package/dist/icons/generated/shard-20.js.map +1 -0
- package/dist/icons/generated/shard-21.cjs +2 -0
- package/dist/icons/generated/shard-21.cjs.map +1 -0
- package/dist/icons/generated/shard-21.js +48 -0
- package/dist/icons/generated/shard-21.js.map +1 -0
- package/dist/icons/generated/shard-22.cjs +2 -0
- package/dist/icons/generated/shard-22.cjs.map +1 -0
- package/dist/icons/generated/shard-22.js +48 -0
- package/dist/icons/generated/shard-22.js.map +1 -0
- package/dist/icons/generated/shard-23.cjs +2 -0
- package/dist/icons/generated/shard-23.cjs.map +1 -0
- package/dist/icons/generated/shard-23.js +48 -0
- package/dist/icons/generated/shard-23.js.map +1 -0
- package/dist/icons/generated/shard-24.cjs +2 -0
- package/dist/icons/generated/shard-24.cjs.map +1 -0
- package/dist/icons/generated/shard-24.js +48 -0
- package/dist/icons/generated/shard-24.js.map +1 -0
- package/dist/icons/generated/shard-25.cjs +2 -0
- package/dist/icons/generated/shard-25.cjs.map +1 -0
- package/dist/icons/generated/shard-25.js +48 -0
- package/dist/icons/generated/shard-25.js.map +1 -0
- package/dist/icons/generated/shard-26.cjs +2 -0
- package/dist/icons/generated/shard-26.cjs.map +1 -0
- package/dist/icons/generated/shard-26.js +48 -0
- package/dist/icons/generated/shard-26.js.map +1 -0
- package/dist/icons/generated/shard-27.cjs +2 -0
- package/dist/icons/generated/shard-27.cjs.map +1 -0
- package/dist/icons/generated/shard-27.js +48 -0
- package/dist/icons/generated/shard-27.js.map +1 -0
- package/dist/icons/generated/shard-28.cjs +2 -0
- package/dist/icons/generated/shard-28.cjs.map +1 -0
- package/dist/icons/generated/shard-28.js +48 -0
- package/dist/icons/generated/shard-28.js.map +1 -0
- package/dist/icons/generated/shard-29.cjs +2 -0
- package/dist/icons/generated/shard-29.cjs.map +1 -0
- package/dist/icons/generated/shard-29.js +48 -0
- package/dist/icons/generated/shard-29.js.map +1 -0
- package/dist/icons/generated/shard-30.cjs +2 -0
- package/dist/icons/generated/shard-30.cjs.map +1 -0
- package/dist/icons/generated/shard-30.js +48 -0
- package/dist/icons/generated/shard-30.js.map +1 -0
- package/dist/icons/generated/shard-31.cjs +2 -0
- package/dist/icons/generated/shard-31.cjs.map +1 -0
- package/dist/icons/generated/shard-31.js +48 -0
- package/dist/icons/generated/shard-31.js.map +1 -0
- package/dist/icons/generated/shard-32.cjs +2 -0
- package/dist/icons/generated/shard-32.cjs.map +1 -0
- package/dist/icons/generated/shard-32.js +48 -0
- package/dist/icons/generated/shard-32.js.map +1 -0
- package/dist/icons/generated/shard-33.cjs +2 -0
- package/dist/icons/generated/shard-33.cjs.map +1 -0
- package/dist/icons/generated/shard-33.js +48 -0
- package/dist/icons/generated/shard-33.js.map +1 -0
- package/dist/icons/generated/shard-34.cjs +2 -0
- package/dist/icons/generated/shard-34.cjs.map +1 -0
- package/dist/icons/generated/shard-34.js +48 -0
- package/dist/icons/generated/shard-34.js.map +1 -0
- package/dist/icons/generated/shard-35.cjs +2 -0
- package/dist/icons/generated/shard-35.cjs.map +1 -0
- package/dist/icons/generated/shard-35.js +48 -0
- package/dist/icons/generated/shard-35.js.map +1 -0
- package/dist/icons/generated/shard-36.cjs +2 -0
- package/dist/icons/generated/shard-36.cjs.map +1 -0
- package/dist/icons/generated/shard-36.js +48 -0
- package/dist/icons/generated/shard-36.js.map +1 -0
- package/dist/icons/generated/shard-37.cjs +2 -0
- package/dist/icons/generated/shard-37.cjs.map +1 -0
- package/dist/icons/generated/shard-37.js +48 -0
- package/dist/icons/generated/shard-37.js.map +1 -0
- package/dist/icons/generated/shard-38.cjs +2 -0
- package/dist/icons/generated/shard-38.cjs.map +1 -0
- package/dist/icons/generated/shard-38.js +48 -0
- package/dist/icons/generated/shard-38.js.map +1 -0
- package/dist/icons/generated/shard-39.cjs +2 -0
- package/dist/icons/generated/shard-39.cjs.map +1 -0
- package/dist/icons/generated/shard-39.js +48 -0
- package/dist/icons/generated/shard-39.js.map +1 -0
- package/dist/icons/generated/shard-40.cjs +2 -0
- package/dist/icons/generated/shard-40.cjs.map +1 -0
- package/dist/icons/generated/shard-40.js +48 -0
- package/dist/icons/generated/shard-40.js.map +1 -0
- package/dist/icons/generated/shard-41.cjs +2 -0
- package/dist/icons/generated/shard-41.cjs.map +1 -0
- package/dist/icons/generated/shard-41.js +48 -0
- package/dist/icons/generated/shard-41.js.map +1 -0
- package/dist/icons/generated/shard-42.cjs +2 -0
- package/dist/icons/generated/shard-42.cjs.map +1 -0
- package/dist/icons/generated/shard-42.js +48 -0
- package/dist/icons/generated/shard-42.js.map +1 -0
- package/dist/icons/generated/shard-43.cjs +2 -0
- package/dist/icons/generated/shard-43.cjs.map +1 -0
- package/dist/icons/generated/shard-43.js +48 -0
- package/dist/icons/generated/shard-43.js.map +1 -0
- package/dist/icons/generated/shard-44.cjs +2 -0
- package/dist/icons/generated/shard-44.cjs.map +1 -0
- package/dist/icons/generated/shard-44.js +15 -0
- package/dist/icons/generated/shard-44.js.map +1 -0
- package/dist/icons/material-symbols.cjs +1 -1
- package/dist/icons/material-symbols.cjs.map +1 -1
- package/dist/icons/material-symbols.js +240 -1
- package/dist/icons/material-symbols.js.map +1 -1
- package/dist/icons/normalize-icon-name.cjs +2 -0
- package/dist/icons/normalize-icon-name.cjs.map +1 -0
- package/dist/icons/normalize-icon-name.js +9 -0
- package/dist/icons/normalize-icon-name.js.map +1 -0
- package/dist/icons/shard-cache.cjs +1 -1
- package/dist/icons/shard-cache.cjs.map +1 -1
- package/dist/icons/shard-cache.js +85 -32
- package/dist/icons/shard-cache.js.map +1 -1
- package/dist/icons/validate-icon-name.cjs +2 -0
- package/dist/icons/validate-icon-name.cjs.map +1 -0
- package/dist/icons/validate-icon-name.js +11 -0
- package/dist/icons/validate-icon-name.js.map +1 -0
- package/dist/icons-virtual-id.d.ts +24 -0
- package/dist/icons-virtual.cjs +2 -0
- package/dist/icons-virtual.cjs.map +1 -0
- package/dist/icons-virtual.d.ts +30 -22
- package/dist/icons-virtual.js +6 -0
- package/dist/icons-virtual.js.map +1 -0
- package/dist/icons.cjs +1 -1
- package/dist/icons.d.ts +282 -33
- package/dist/icons.js +11 -7
- package/dist/offline/create-offline-sync.cjs +1 -1
- package/dist/offline/create-offline-sync.cjs.map +1 -1
- package/dist/offline/create-offline-sync.js +17 -9
- package/dist/offline/create-offline-sync.js.map +1 -1
- package/dist/offline/use-offline-sync.cjs +1 -1
- package/dist/offline/use-offline-sync.cjs.map +1 -1
- package/dist/offline/use-offline-sync.js +7 -8
- package/dist/offline/use-offline-sync.js.map +1 -1
- package/dist/push/use-push-subscription.cjs +1 -1
- package/dist/push/use-push-subscription.cjs.map +1 -1
- package/dist/push/use-push-subscription.js +13 -12
- package/dist/push/use-push-subscription.js.map +1 -1
- package/dist/query/retry-policy.cjs +1 -1
- package/dist/query/retry-policy.cjs.map +1 -1
- package/dist/query/retry-policy.js +3 -3
- package/dist/query/retry-policy.js.map +1 -1
- package/dist/sse/use-event-stream.cjs +1 -1
- package/dist/sse/use-event-stream.cjs.map +1 -1
- package/dist/sse/use-event-stream.js +19 -20
- package/dist/sse/use-event-stream.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tabular/use-tabular-predictor.cjs +1 -1
- package/dist/tabular/use-tabular-predictor.cjs.map +1 -1
- package/dist/tabular/use-tabular-predictor.js +20 -17
- package/dist/tabular/use-tabular-predictor.js.map +1 -1
- package/dist/tempest-react-sdk.cjs +1 -1
- package/dist/tempest-react-sdk.d.ts +458 -213
- package/dist/tempest-react-sdk.js +328 -329
- package/dist/theme/ThemeProvider.cjs +1 -1
- package/dist/theme/ThemeProvider.cjs.map +1 -1
- package/dist/theme/ThemeProvider.js +12 -17
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/utils/base64.cjs +2 -0
- package/dist/utils/base64.cjs.map +1 -0
- package/dist/utils/base64.js +16 -0
- package/dist/utils/base64.js.map +1 -0
- package/dist/utils/compare-values.cjs +1 -1
- package/dist/utils/compare-values.cjs.map +1 -1
- package/dist/utils/compare-values.js +4 -3
- package/dist/utils/compare-values.js.map +1 -1
- package/dist/utils/compressed-storage.cjs +1 -1
- package/dist/utils/compressed-storage.cjs.map +1 -1
- package/dist/utils/compressed-storage.js +16 -46
- package/dist/utils/compressed-storage.js.map +1 -1
- package/dist/utils/dev-mode.cjs.map +1 -1
- package/dist/utils/dev-mode.js.map +1 -1
- package/dist/utils/storage.cjs +1 -1
- package/dist/utils/storage.cjs.map +1 -1
- package/dist/utils/storage.js +37 -17
- package/dist/utils/storage.js.map +1 -1
- package/dist/vision/use-camera-stream.cjs +1 -1
- package/dist/vision/use-camera-stream.cjs.map +1 -1
- package/dist/vision/use-camera-stream.js +34 -33
- package/dist/vision/use-camera-stream.js.map +1 -1
- package/dist/vite/base-url.cjs +2 -0
- package/dist/vite/base-url.cjs.map +1 -0
- package/dist/vite/base-url.js +8 -0
- package/dist/vite/base-url.js.map +1 -0
- package/dist/vite/tempest-icons.cjs +4 -4
- package/dist/vite/tempest-icons.cjs.map +1 -1
- package/dist/vite/tempest-icons.js +26 -26
- package/dist/vite/tempest-icons.js.map +1 -1
- package/dist/vite/tempest-pwa-dev-sw.cjs +1 -1
- package/dist/vite/tempest-pwa-dev-sw.cjs.map +1 -1
- package/dist/vite/tempest-pwa-dev-sw.js +54 -29
- package/dist/vite/tempest-pwa-dev-sw.js.map +1 -1
- package/dist/vite/tempest-pwa-manifest.cjs +2 -2
- package/dist/vite/tempest-pwa-manifest.cjs.map +1 -1
- package/dist/vite/tempest-pwa-manifest.js +15 -14
- package/dist/vite/tempest-pwa-manifest.js.map +1 -1
- package/dist/vite.d.ts +3 -3
- package/dist/ws/use-web-socket.cjs +1 -1
- package/dist/ws/use-web-socket.cjs.map +1 -1
- package/dist/ws/use-web-socket.js +40 -42
- package/dist/ws/use-web-socket.js.map +1 -1
- package/package.json +5 -2
- package/dist/icons/generated/shard-a.cjs +0 -2
- package/dist/icons/generated/shard-a.cjs.map +0 -1
- package/dist/icons/generated/shard-a.js +0 -114
- package/dist/icons/generated/shard-a.js.map +0 -1
- package/dist/icons/generated/shard-b.cjs +0 -2
- package/dist/icons/generated/shard-b.cjs.map +0 -1
- package/dist/icons/generated/shard-b.js +0 -158
- package/dist/icons/generated/shard-b.js.map +0 -1
- package/dist/icons/generated/shard-c.cjs +0 -2
- package/dist/icons/generated/shard-c.cjs.map +0 -1
- package/dist/icons/generated/shard-c.js +0 -269
- package/dist/icons/generated/shard-c.js.map +0 -1
- package/dist/icons/generated/shard-d.cjs +0 -2
- package/dist/icons/generated/shard-d.cjs.map +0 -1
- package/dist/icons/generated/shard-d.js +0 -62
- package/dist/icons/generated/shard-d.js.map +0 -1
- package/dist/icons/generated/shard-e.cjs +0 -2
- package/dist/icons/generated/shard-e.cjs.map +0 -1
- package/dist/icons/generated/shard-e.js +0 -33
- package/dist/icons/generated/shard-e.js.map +0 -1
- package/dist/icons/generated/shard-f.cjs +0 -2
- package/dist/icons/generated/shard-f.cjs.map +0 -1
- package/dist/icons/generated/shard-f.js +0 -145
- package/dist/icons/generated/shard-f.js.map +0 -1
- package/dist/icons/generated/shard-g.cjs +0 -2
- package/dist/icons/generated/shard-g.cjs.map +0 -1
- package/dist/icons/generated/shard-g.js +0 -61
- package/dist/icons/generated/shard-g.js.map +0 -1
- package/dist/icons/generated/shard-h.cjs +0 -2
- package/dist/icons/generated/shard-h.cjs.map +0 -1
- package/dist/icons/generated/shard-h.js +0 -62
- package/dist/icons/generated/shard-h.js.map +0 -1
- package/dist/icons/generated/shard-i.cjs +0 -2
- package/dist/icons/generated/shard-i.cjs.map +0 -1
- package/dist/icons/generated/shard-i.js +0 -30
- package/dist/icons/generated/shard-i.js.map +0 -1
- package/dist/icons/generated/shard-j.cjs +0 -2
- package/dist/icons/generated/shard-j.cjs.map +0 -1
- package/dist/icons/generated/shard-j.js +0 -10
- package/dist/icons/generated/shard-j.js.map +0 -1
- package/dist/icons/generated/shard-k.cjs +0 -2
- package/dist/icons/generated/shard-k.cjs.map +0 -1
- package/dist/icons/generated/shard-k.js +0 -16
- package/dist/icons/generated/shard-k.js.map +0 -1
- package/dist/icons/generated/shard-l.cjs +0 -2
- package/dist/icons/generated/shard-l.cjs.map +0 -1
- package/dist/icons/generated/shard-l.js +0 -92
- package/dist/icons/generated/shard-l.js.map +0 -1
- package/dist/icons/generated/shard-m.cjs +0 -2
- package/dist/icons/generated/shard-m.cjs.map +0 -1
- package/dist/icons/generated/shard-m.js +0 -143
- package/dist/icons/generated/shard-m.js.map +0 -1
- package/dist/icons/generated/shard-n.cjs +0 -2
- package/dist/icons/generated/shard-n.cjs.map +0 -1
- package/dist/icons/generated/shard-n.js +0 -24
- package/dist/icons/generated/shard-n.js.map +0 -1
- package/dist/icons/generated/shard-o.cjs +0 -2
- package/dist/icons/generated/shard-o.cjs.map +0 -1
- package/dist/icons/generated/shard-o.js +0 -17
- package/dist/icons/generated/shard-o.js.map +0 -1
- package/dist/icons/generated/shard-p.cjs +0 -2
- package/dist/icons/generated/shard-p.cjs.map +0 -1
- package/dist/icons/generated/shard-p.js +0 -114
- package/dist/icons/generated/shard-p.js.map +0 -1
- package/dist/icons/generated/shard-q.cjs +0 -2
- package/dist/icons/generated/shard-q.cjs.map +0 -1
- package/dist/icons/generated/shard-q.js +0 -10
- package/dist/icons/generated/shard-q.js.map +0 -1
- package/dist/icons/generated/shard-r.cjs +0 -2
- package/dist/icons/generated/shard-r.cjs.map +0 -1
- package/dist/icons/generated/shard-r.js +0 -79
- package/dist/icons/generated/shard-r.js.map +0 -1
- package/dist/icons/generated/shard-s.cjs +0 -2
- package/dist/icons/generated/shard-s.cjs.map +0 -1
- package/dist/icons/generated/shard-s.js +0 -256
- package/dist/icons/generated/shard-s.js.map +0 -1
- package/dist/icons/generated/shard-t.cjs +0 -2
- package/dist/icons/generated/shard-t.cjs.map +0 -1
- package/dist/icons/generated/shard-t.js +0 -109
- package/dist/icons/generated/shard-t.js.map +0 -1
- package/dist/icons/generated/shard-u.cjs +0 -2
- package/dist/icons/generated/shard-u.cjs.map +0 -1
- package/dist/icons/generated/shard-u.js +0 -50
- package/dist/icons/generated/shard-u.js.map +0 -1
- package/dist/icons/generated/shard-v.cjs +0 -2
- package/dist/icons/generated/shard-v.cjs.map +0 -1
- package/dist/icons/generated/shard-v.js +0 -30
- package/dist/icons/generated/shard-v.js.map +0 -1
- package/dist/icons/generated/shard-w.cjs +0 -2
- package/dist/icons/generated/shard-w.cjs.map +0 -1
- package/dist/icons/generated/shard-w.js +0 -48
- package/dist/icons/generated/shard-w.js.map +0 -1
- package/dist/icons/generated/shard-x.cjs +0 -2
- package/dist/icons/generated/shard-x.cjs.map +0 -1
- package/dist/icons/generated/shard-x.js +0 -10
- package/dist/icons/generated/shard-x.js.map +0 -1
- package/dist/icons/generated/shard-z.cjs +0 -2
- package/dist/icons/generated/shard-z.cjs.map +0 -1
- package/dist/icons/generated/shard-z.js +0 -25
- package/dist/icons/generated/shard-z.js.map +0 -1
package/dist/http/retry.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { isApiError as e, isRetriableStatus as t } from "./errors.js";
|
|
1
2
|
//#region src/http/retry.ts
|
|
2
|
-
function
|
|
3
|
+
function n(n) {
|
|
4
|
+
return !e(n) || t(n.status);
|
|
5
|
+
}
|
|
6
|
+
function r(e, t) {
|
|
3
7
|
return new Promise((n, r) => {
|
|
4
8
|
if (t?.aborted) {
|
|
5
9
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -11,25 +15,25 @@ function e(e, t) {
|
|
|
11
15
|
}, { once: !0 });
|
|
12
16
|
});
|
|
13
17
|
}
|
|
14
|
-
async function
|
|
15
|
-
let { retries:
|
|
16
|
-
for (;
|
|
17
|
-
if (
|
|
18
|
+
async function i(e, t = {}) {
|
|
19
|
+
let { retries: i = 3, initialDelay: a = 300, maxDelay: o = 1e4, respectRetryAfter: s = !0, shouldRetry: c = n, onRetry: l, signal: u } = t, d = 0, f;
|
|
20
|
+
for (; d < i;) {
|
|
21
|
+
if (u?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
18
22
|
try {
|
|
19
|
-
return await
|
|
20
|
-
} catch (
|
|
21
|
-
if (
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
attempt:
|
|
25
|
-
delay:
|
|
26
|
-
error:
|
|
27
|
-
}), await
|
|
23
|
+
return await e();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (f = e, d += 1, d >= i || !c(e, d)) throw e;
|
|
26
|
+
let t = s && typeof e?.retryAfter == "number" ? e.retryAfter * 1e3 : null, n = Math.min(t === null ? a * 2 ** (d - 1) : t, o);
|
|
27
|
+
l?.({
|
|
28
|
+
attempt: d,
|
|
29
|
+
delay: n,
|
|
30
|
+
error: e
|
|
31
|
+
}), await r(n, u);
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
|
-
throw
|
|
34
|
+
throw f;
|
|
31
35
|
}
|
|
32
36
|
//#endregion
|
|
33
|
-
export {
|
|
37
|
+
export { i as retry };
|
|
34
38
|
|
|
35
39
|
//# sourceMappingURL=retry.js.map
|
package/dist/http/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","names":[],"sources":["../../src/http/retry.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"retry.js","names":[],"sources":["../../src/http/retry.ts"],"sourcesContent":["import { isApiError, isRetriableStatus } from \"./errors\";\n\nexport interface RetryOptions {\n /** Max attempts (including the first). Default: 3. */\n retries?: number;\n /** Initial backoff in ms. Doubles each attempt, capped at `maxDelay`. Default: 300. */\n initialDelay?: number;\n /** Maximum delay between attempts. Default: 10_000. */\n maxDelay?: number;\n /**\n * Honor a `Retry-After` hint on the thrown error (`error.retryAfter`, in\n * seconds — populated by {@link createApiClient} on `429`/`503`). When\n * present it overrides the exponential backoff for that attempt. The value\n * is capped at `maxDelay`. Default: true.\n */\n respectRetryAfter?: boolean;\n /**\n * Return false to stop retrying for a specific error.\n *\n * Default: replay anything that is not a recognisable API error — a\n * transport failure has no status to judge — and, for one that is, only the\n * statuses {@link isRetriableStatus} accepts. A `403` on an admin-only\n * endpoint and a `404` for a deleted record are the server's final answer;\n * repeating them spends the caller's time to show the same error twice.\n */\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n /** Called before each retry with the upcoming delay. */\n onRetry?: (info: { attempt: number; delay: number; error: unknown }) => void;\n /** Cancel pending retries. */\n signal?: AbortSignal;\n}\n\n/**\n * The default {@link RetryOptions.shouldRetry}.\n *\n * Permissive about what it cannot classify and strict about what it can: an\n * error with no API shape may well be a transport failure, while an API error\n * carrying a deliberate refusal will answer the same on every attempt.\n *\n * @param error - Whatever the attempt threw.\n * @returns Whether the helper should try again.\n */\nfunction defaultShouldRetry(error: unknown): boolean {\n return !isApiError(error) || isRetriableStatus(error.status);\n}\n\nfunction wait(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (signal?.aborted) {\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n return;\n }\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n reject(new DOMException(\"Aborted\", \"AbortError\"));\n },\n { once: true },\n );\n });\n}\n\n/**\n * Run `factory()` with exponential backoff. Each attempt awaits an\n * increasing delay capped at `maxDelay`. Throws the last error if every\n * attempt fails.\n *\n * @example\n * const data = await retry(() => api.get(\"/flaky\"), { retries: 5 });\n */\nexport async function retry<T>(factory: () => Promise<T>, options: RetryOptions = {}): Promise<T> {\n const {\n retries = 3,\n initialDelay = 300,\n maxDelay = 10_000,\n respectRetryAfter = true,\n shouldRetry = defaultShouldRetry,\n onRetry,\n signal,\n } = options;\n\n let attempt = 0;\n let lastError: unknown;\n\n while (attempt < retries) {\n if (signal?.aborted) throw new DOMException(\"Aborted\", \"AbortError\");\n try {\n return await factory();\n } catch (error) {\n lastError = error;\n attempt += 1;\n if (attempt >= retries || !shouldRetry(error, attempt)) {\n throw error;\n }\n const retryAfter =\n respectRetryAfter &&\n typeof (error as { retryAfter?: unknown })?.retryAfter === \"number\"\n ? (error as { retryAfter: number }).retryAfter * 1000\n : null;\n const delay =\n retryAfter !== null\n ? Math.min(retryAfter, maxDelay)\n : Math.min(initialDelay * 2 ** (attempt - 1), maxDelay);\n onRetry?.({ attempt, delay, error });\n await wait(delay, signal);\n }\n }\n\n throw lastError;\n}\n"],"mappings":";;AA0CA,SAAS,EAAmB,GAAyB;CACjD,OAAO,CAAC,EAAW,CAAK,KAAK,EAAkB,EAAM,MAAM;AAC/D;AAEA,SAAS,EAAK,GAAY,GAAqC;CAC3D,OAAO,IAAI,SAAe,GAAS,MAAW;EAC1C,IAAI,GAAQ,SAAS;GACjB,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;GAChD;EACJ;EACA,IAAM,IAAQ,WAAW,GAAS,CAAE;EACpC,GAAQ,iBACJ,eACM;GAEF,AADA,aAAa,CAAK,GAClB,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;EACpD,GACA,EAAE,MAAM,GAAK,CACjB;CACJ,CAAC;AACL;AAUA,eAAsB,EAAS,GAA2B,IAAwB,CAAC,GAAe;CAC9F,IAAM,EACF,aAAU,GACV,kBAAe,KACf,cAAW,KACX,uBAAoB,IACpB,iBAAc,GACd,YACA,cACA,GAEA,IAAU,GACV;CAEJ,OAAO,IAAU,IAAS;EACtB,IAAI,GAAQ,SAAS,MAAM,IAAI,aAAa,WAAW,YAAY;EACnE,IAAI;GACA,OAAO,MAAM,EAAQ;EACzB,SAAS,GAAO;GAGZ,IAFA,IAAY,GACZ,KAAW,GACP,KAAW,KAAW,CAAC,EAAY,GAAO,CAAO,GACjD,MAAM;GAEV,IAAM,IACF,KACA,OAAQ,GAAoC,cAAe,WACpD,EAAiC,aAAa,MAC/C,MACJ,IAGI,KAAK,IAFX,MAAe,OAEA,IAAe,MAAM,IAAU,KAD/B,GACmC,CAAQ;GAE9D,AADA,IAAU;IAAE;IAAS;IAAO;GAAM,CAAC,GACnC,MAAM,EAAK,GAAO,CAAM;EAC5B;CACJ;CAEA,MAAM;AACV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./describe-api-error.cjs"),t=require("../i18n/I18nProvider.cjs");let n=require("react");function r(){let r=t.useOptionalI18n()?.t;return(0,n.useCallback)((t,n)=>{
|
|
1
|
+
const e=require("./describe-api-error.cjs"),t=require("../i18n/I18nProvider.cjs");let n=require("react");function r(t,n,r){let i=e.DEFAULT_API_ERROR_STRINGS[r];return t?.(n,void 0,{default:i})??i}function i(){let i=t.useOptionalI18n()?.t;return(0,n.useCallback)((t,n)=>e.describeApiError(t,n,{offline:r(i,e.API_ERROR_OFFLINE_KEY,`offline`),validation:r(i,e.API_ERROR_VALIDATION_KEY,`validation`)}),[i])}exports.useDescribeApiError=i;
|
|
2
2
|
//# sourceMappingURL=use-describe-api-error.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-describe-api-error.cjs","names":[],"sources":["../../src/http/use-describe-api-error.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport { useOptionalI18n } from \"../i18n/I18nProvider\";\nimport {\n API_ERROR_OFFLINE_KEY,\n DEFAULT_API_ERROR_STRINGS,\n describeApiError,\n} from \"./describe-api-error\";\n\n/**\n * {@link describeApiError} with its fixed sentences resolved through the active\n * `I18nProvider`.\n *\n * The funnel is not duplicated — this hook only supplies the strings and calls\n * the pure function. Which is also why both exist: the pure one runs in an\n * interceptor or a logger, where there is no React tree to read a context from,\n * and this one runs in a component without every caller passing translations\n * down by hand.\n *\n * Works with no provider at all: i18n is opt-in in this SDK, so a missing\n * provider — or a catalog that never defined `tempest.error.offline` — falls\n * back to the pt-BR default rather than crashing or printing the raw key.\n *\n * @example\n * const describe = useDescribeApiError();\n * const { mutate } = useMutation({\n * mutationFn: save,\n * onError: (error) => toast(describe(error, t(\"orders.saveFailed\"))),\n * });\n *\n * @returns A stable `(error, fallback) => string` function.\n */\nexport function useDescribeApiError(): (error: unknown, fallback: string) => string {\n const i18n = useOptionalI18n();\n const translate = i18n?.t;\n\n return useCallback(\n (error: unknown, fallback: string) => {\n
|
|
1
|
+
{"version":3,"file":"use-describe-api-error.cjs","names":[],"sources":["../../src/http/use-describe-api-error.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport type { I18n } from \"../i18n/create-i18n\";\nimport { useOptionalI18n } from \"../i18n/I18nProvider\";\nimport {\n API_ERROR_OFFLINE_KEY,\n API_ERROR_VALIDATION_KEY,\n DEFAULT_API_ERROR_STRINGS,\n describeApiError,\n} from \"./describe-api-error\";\n\n/**\n * {@link describeApiError} with its fixed sentences resolved through the active\n * `I18nProvider`.\n *\n * The funnel is not duplicated — this hook only supplies the strings and calls\n * the pure function. Which is also why both exist: the pure one runs in an\n * interceptor or a logger, where there is no React tree to read a context from,\n * and this one runs in a component without every caller passing translations\n * down by hand.\n *\n * Works with no provider at all: i18n is opt-in in this SDK, so a missing\n * provider — or a catalog that never defined `tempest.error.offline` — falls\n * back to the pt-BR default rather than crashing or printing the raw key.\n *\n * @example\n * const describe = useDescribeApiError();\n * const { mutate } = useMutation({\n * mutationFn: save,\n * onError: (error) => toast(describe(error, t(\"orders.saveFailed\"))),\n * });\n *\n * @returns A stable `(error, fallback) => string` function.\n */\n/**\n * Look one sentence up in the active catalog, falling back to the pt-BR default.\n *\n * The miss is the i18n layer's answer, through `t`'s `default`. It used to be\n * re-derived here by comparing the result against the key that had just been\n * passed in, which is wrong for a catalog that maps a key to itself —\n * `{ \"tempest.error.offline\": \"tempest.error.offline\" }`, which is what a\n * machine-generated or placeholder catalog produces. There the app's own\n * translation lost to the pt-BR default. Only the catalog's owner can answer\n * \"was this key defined\", and `lookup()` already knows.\n *\n * @param translate - The active catalog's `t`, if any provider is mounted.\n * @param key - The translation key to look up.\n * @param fallbackKey - Which {@link DEFAULT_API_ERROR_STRINGS} entry to use on a miss.\n * @returns The sentence to hand to `describeApiError`.\n */\nfunction resolve(\n translate: I18n[\"t\"] | undefined,\n key: string,\n fallbackKey: keyof typeof DEFAULT_API_ERROR_STRINGS,\n): string {\n const fallback = DEFAULT_API_ERROR_STRINGS[fallbackKey];\n return translate?.(key, undefined, { default: fallback }) ?? fallback;\n}\n\nexport function useDescribeApiError(): (error: unknown, fallback: string) => string {\n const i18n = useOptionalI18n();\n const translate = i18n?.t;\n\n return useCallback(\n (error: unknown, fallback: string) => {\n return describeApiError(error, fallback, {\n offline: resolve(translate, API_ERROR_OFFLINE_KEY, \"offline\"),\n validation: resolve(translate, API_ERROR_VALIDATION_KEY, \"validation\"),\n });\n },\n [translate],\n );\n}\n"],"mappings":"yGAkDA,SAAS,EACL,EACA,EACA,EACM,CACN,IAAM,EAAW,EAAA,0BAA0B,GAC3C,OAAO,IAAY,EAAK,IAAA,GAAW,CAAE,QAAS,CAAS,CAAC,GAAK,CACjE,CAEA,SAAgB,GAAoE,CAEhF,IAAM,EADO,EAAA,gBACK,CAAA,EAAM,EAExB,OAAA,EAAO,EAAA,YAAA,EACF,EAAgB,IACN,EAAA,iBAAiB,EAAO,EAAU,CACrC,QAAS,EAAQ,EAAW,EAAA,sBAAuB,SAAS,EAC5D,WAAY,EAAQ,EAAW,EAAA,yBAA0B,YAAY,CACzE,CAAC,EAEL,CAAC,CAAS,CACd,CACJ"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { API_ERROR_OFFLINE_KEY as e,
|
|
2
|
-
import { useOptionalI18n as
|
|
3
|
-
import { useCallback as
|
|
1
|
+
import { API_ERROR_OFFLINE_KEY as e, API_ERROR_VALIDATION_KEY as t, DEFAULT_API_ERROR_STRINGS as n, describeApiError as r } from "./describe-api-error.js";
|
|
2
|
+
import { useOptionalI18n as i } from "../i18n/I18nProvider.js";
|
|
3
|
+
import { useCallback as a } from "react";
|
|
4
4
|
//#region src/http/use-describe-api-error.ts
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function o(e, t, r) {
|
|
6
|
+
let i = n[r];
|
|
7
|
+
return e?.(t, void 0, { default: i }) ?? i;
|
|
8
|
+
}
|
|
9
|
+
function s() {
|
|
10
|
+
let n = i()?.t;
|
|
11
|
+
return a((i, a) => r(i, a, {
|
|
12
|
+
offline: o(n, e, "offline"),
|
|
13
|
+
validation: o(n, t, "validation")
|
|
14
|
+
}), [n]);
|
|
11
15
|
}
|
|
12
16
|
//#endregion
|
|
13
|
-
export {
|
|
17
|
+
export { s as useDescribeApiError };
|
|
14
18
|
|
|
15
19
|
//# sourceMappingURL=use-describe-api-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-describe-api-error.js","names":[],"sources":["../../src/http/use-describe-api-error.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport { useOptionalI18n } from \"../i18n/I18nProvider\";\nimport {\n API_ERROR_OFFLINE_KEY,\n DEFAULT_API_ERROR_STRINGS,\n describeApiError,\n} from \"./describe-api-error\";\n\n/**\n * {@link describeApiError} with its fixed sentences resolved through the active\n * `I18nProvider`.\n *\n * The funnel is not duplicated — this hook only supplies the strings and calls\n * the pure function. Which is also why both exist: the pure one runs in an\n * interceptor or a logger, where there is no React tree to read a context from,\n * and this one runs in a component without every caller passing translations\n * down by hand.\n *\n * Works with no provider at all: i18n is opt-in in this SDK, so a missing\n * provider — or a catalog that never defined `tempest.error.offline` — falls\n * back to the pt-BR default rather than crashing or printing the raw key.\n *\n * @example\n * const describe = useDescribeApiError();\n * const { mutate } = useMutation({\n * mutationFn: save,\n * onError: (error) => toast(describe(error, t(\"orders.saveFailed\"))),\n * });\n *\n * @returns A stable `(error, fallback) => string` function.\n */\nexport function useDescribeApiError(): (error: unknown, fallback: string) => string {\n const i18n = useOptionalI18n();\n const translate = i18n?.t;\n\n return useCallback(\n (error: unknown, fallback: string) => {\n
|
|
1
|
+
{"version":3,"file":"use-describe-api-error.js","names":[],"sources":["../../src/http/use-describe-api-error.ts"],"sourcesContent":["import { useCallback } from \"react\";\n\nimport type { I18n } from \"../i18n/create-i18n\";\nimport { useOptionalI18n } from \"../i18n/I18nProvider\";\nimport {\n API_ERROR_OFFLINE_KEY,\n API_ERROR_VALIDATION_KEY,\n DEFAULT_API_ERROR_STRINGS,\n describeApiError,\n} from \"./describe-api-error\";\n\n/**\n * {@link describeApiError} with its fixed sentences resolved through the active\n * `I18nProvider`.\n *\n * The funnel is not duplicated — this hook only supplies the strings and calls\n * the pure function. Which is also why both exist: the pure one runs in an\n * interceptor or a logger, where there is no React tree to read a context from,\n * and this one runs in a component without every caller passing translations\n * down by hand.\n *\n * Works with no provider at all: i18n is opt-in in this SDK, so a missing\n * provider — or a catalog that never defined `tempest.error.offline` — falls\n * back to the pt-BR default rather than crashing or printing the raw key.\n *\n * @example\n * const describe = useDescribeApiError();\n * const { mutate } = useMutation({\n * mutationFn: save,\n * onError: (error) => toast(describe(error, t(\"orders.saveFailed\"))),\n * });\n *\n * @returns A stable `(error, fallback) => string` function.\n */\n/**\n * Look one sentence up in the active catalog, falling back to the pt-BR default.\n *\n * The miss is the i18n layer's answer, through `t`'s `default`. It used to be\n * re-derived here by comparing the result against the key that had just been\n * passed in, which is wrong for a catalog that maps a key to itself —\n * `{ \"tempest.error.offline\": \"tempest.error.offline\" }`, which is what a\n * machine-generated or placeholder catalog produces. There the app's own\n * translation lost to the pt-BR default. Only the catalog's owner can answer\n * \"was this key defined\", and `lookup()` already knows.\n *\n * @param translate - The active catalog's `t`, if any provider is mounted.\n * @param key - The translation key to look up.\n * @param fallbackKey - Which {@link DEFAULT_API_ERROR_STRINGS} entry to use on a miss.\n * @returns The sentence to hand to `describeApiError`.\n */\nfunction resolve(\n translate: I18n[\"t\"] | undefined,\n key: string,\n fallbackKey: keyof typeof DEFAULT_API_ERROR_STRINGS,\n): string {\n const fallback = DEFAULT_API_ERROR_STRINGS[fallbackKey];\n return translate?.(key, undefined, { default: fallback }) ?? fallback;\n}\n\nexport function useDescribeApiError(): (error: unknown, fallback: string) => string {\n const i18n = useOptionalI18n();\n const translate = i18n?.t;\n\n return useCallback(\n (error: unknown, fallback: string) => {\n return describeApiError(error, fallback, {\n offline: resolve(translate, API_ERROR_OFFLINE_KEY, \"offline\"),\n validation: resolve(translate, API_ERROR_VALIDATION_KEY, \"validation\"),\n });\n },\n [translate],\n );\n}\n"],"mappings":";;;;AAkDA,SAAS,EACL,GACA,GACA,GACM;CACN,IAAM,IAAW,EAA0B;CAC3C,OAAO,IAAY,GAAK,KAAA,GAAW,EAAE,SAAS,EAAS,CAAC,KAAK;AACjE;AAEA,SAAgB,IAAoE;CAEhF,IAAM,IADO,EACK,CAAA,EAAM;CAExB,OAAO,GACF,GAAgB,MACN,EAAiB,GAAO,GAAU;EACrC,SAAS,EAAQ,GAAW,GAAuB,SAAS;EAC5D,YAAY,EAAQ,GAAW,GAA0B,YAAY;CACzE,CAAC,GAEL,CAAC,CAAS,CACd;AACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)}):e}function t(e,t,n,r){let i=e[t]?.[r];if(i!==void 0)return i;if(n){let t=e[n]?.[r];if(t!==void 0)return t}return null}function n(r){let{locale:i,fallbackLocale:a=null,messages:o}=r;function s(n,r){let
|
|
1
|
+
function e(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)}):e}function t(e,t,n,r){let i=e[t]?.[r];if(i!==void 0)return i;if(n){let t=e[n]?.[r];if(t!==void 0)return t}return null}function n(r){let{locale:i,fallbackLocale:a=null,messages:o}=r;function s(n,r,s){let c=t(o,i,a,n)??s?.default;return c===void 0?n:e(c,r)}function c(n,r,s,c){let l=t(o,i,a,`${n}${r===1?`_one`:`_other`}`)??t(o,i,a,n)??c?.default;return l===void 0?n:e(l,{count:r,...s??{}})}function l(e,t){return new Intl.NumberFormat(i,t).format(e)}function u(e,t){let n=typeof e==`string`?new Date(e):e;return Number.isNaN(n.getTime())?``:new Intl.DateTimeFormat(i,t).format(n)}return{locale:i,fallbackLocale:a,t:s,plural:c,formatNumber:l,formatDate:u,withLocale:e=>n({locale:e,fallbackLocale:a??void 0,messages:o})}}exports.createI18n=n;
|
|
2
2
|
//# sourceMappingURL=create-i18n.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-i18n.cjs","names":[],"sources":["../../src/i18n/create-i18n.ts"],"sourcesContent":["export type Messages = Record<string, string>;\nexport type Catalog = Record<string, Messages>;\nexport type InterpolationValues = Record<string, string | number>;\n\nexport interface CreateI18nOptions {\n /** Initial locale. */\n locale: string;\n /** Fallback locale used when a key is missing in the active locale. */\n fallbackLocale?: string;\n /** Catalog `{ [locale]: { [key]: \"...\" } }`. */\n messages: Catalog;\n}\n\nexport interface I18n {\n /** Currently active locale. */\n locale: string;\n /** Fallback locale (or `null` when not configured). */\n fallbackLocale: string | null;\n /**\n * Translate `key`, interpolating `{name}` placeholders from `params`.\n * Falls back to the configured fallback locale, then to the key itself.\n */\n t: (key: string, params?: InterpolationValues) => string;\n /**\n * Plural-aware translation. Tries `${key}_one` for `count === 1` and\n * `${key}_other` otherwise, with `{count}` available for interpolation.\n */\n plural: (key: string
|
|
1
|
+
{"version":3,"file":"create-i18n.cjs","names":[],"sources":["../../src/i18n/create-i18n.ts"],"sourcesContent":["export type Messages = Record<string, string>;\nexport type Catalog = Record<string, Messages>;\nexport type InterpolationValues = Record<string, string | number>;\n\nexport interface CreateI18nOptions {\n /** Initial locale. */\n locale: string;\n /** Fallback locale used when a key is missing in the active locale. */\n fallbackLocale?: string;\n /** Catalog `{ [locale]: { [key]: \"...\" } }`. */\n messages: Catalog;\n}\n\n/** Per-call options for {@link I18n.t} and {@link I18n.plural}. */\nexport interface TranslateOptions {\n /**\n * Text to use when the catalog defines neither the key nor its fallback.\n *\n * Without this, a miss returns the key, and a caller that wants its own text\n * instead has to *detect* the miss — which from the outside means comparing\n * the result against the key it just passed in. That heuristic is wrong for a\n * catalog that legitimately maps a key to itself, and it is what every\n * translatable string the SDK ships would otherwise have to copy.\n *\n * Interpolated like any other message, so a default carries `{placeholders}`\n * too and is not second-class.\n */\n default?: string;\n}\n\nexport interface I18n {\n /** Currently active locale. */\n locale: string;\n /** Fallback locale (or `null` when not configured). */\n fallbackLocale: string | null;\n /**\n * Translate `key`, interpolating `{name}` placeholders from `params`.\n * Falls back to the configured fallback locale, then to `options.default`,\n * then to the key itself.\n */\n t: (key: string, params?: InterpolationValues, options?: TranslateOptions) => string;\n /**\n * Plural-aware translation. Tries `${key}_one` for `count === 1` and\n * `${key}_other` otherwise, with `{count}` available for interpolation.\n * Falls back to `options.default`, then to the key itself.\n */\n plural: (\n key: string,\n count: number,\n params?: InterpolationValues,\n options?: TranslateOptions,\n ) => string;\n /** Format a number using `Intl.NumberFormat` on the active locale. */\n formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string;\n /** Format a Date using `Intl.DateTimeFormat` on the active locale. */\n formatDate: (value: Date | string, options?: Intl.DateTimeFormatOptions) => string;\n /** Build a new `I18n` instance pointing at a different locale. */\n withLocale: (locale: string) => I18n;\n}\n\nfunction interpolate(template: string, params?: InterpolationValues): string {\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = params[name];\n return value === undefined ? `{${name}}` : String(value);\n });\n}\n\nfunction lookup(\n catalog: Catalog,\n locale: string,\n fallback: string | null,\n key: string,\n): string | null {\n const direct = catalog[locale]?.[key];\n if (direct !== undefined) return direct;\n if (fallback) {\n const fallbackValue = catalog[fallback]?.[key];\n if (fallbackValue !== undefined) return fallbackValue;\n }\n return null;\n}\n\n/**\n * Create an i18n object with translation, pluralization and Intl helpers.\n *\n * The catalog is a plain `{ [locale]: { [key]: \"...\" } }` map — bring your\n * own keys, namespaces, or nested-key conventions. The SDK does not enforce\n * a schema so you can plug it into any string-loading pipeline.\n *\n * @example\n * const i18n = createI18n({\n * locale: \"pt-BR\",\n * fallbackLocale: \"en\",\n * messages: {\n * \"pt-BR\": {\n * \"greet\": \"Olá, {name}\",\n * \"alos_one\": \"{count} Alô\",\n * \"alos_other\": \"{count} Alôs\",\n * },\n * \"en\": { greet: \"Hi, {name}\", alos_one: \"{count} Alo\", alos_other: \"{count} Alos\" },\n * },\n * });\n * i18n.t(\"greet\", { name: \"Mau\" }); // \"Olá, Mau\"\n * i18n.plural(\"alos\", 3); // \"3 Alôs\"\n *\n * @example\n * // A key the catalog does not define, with text to show instead of the key.\n * i18n.t(\"cart.empty\", undefined, { default: \"Seu carrinho está vazio\" });\n */\nexport function createI18n(options: CreateI18nOptions): I18n {\n const { locale, fallbackLocale = null, messages } = options;\n\n function t(key: string, params?: InterpolationValues, options?: TranslateOptions): string {\n const template = lookup(messages, locale, fallbackLocale, key) ?? options?.default;\n if (template === undefined) return key;\n return interpolate(template, params);\n }\n\n function plural(\n key: string,\n count: number,\n params?: InterpolationValues,\n options?: TranslateOptions,\n ): string {\n const suffix = count === 1 ? \"_one\" : \"_other\";\n const template =\n lookup(messages, locale, fallbackLocale, `${key}${suffix}`) ??\n lookup(messages, locale, fallbackLocale, key) ??\n options?.default;\n if (template === undefined) return key;\n return interpolate(template, { count, ...(params ?? {}) });\n }\n\n function formatNumber(value: number, opts?: Intl.NumberFormatOptions): string {\n return new Intl.NumberFormat(locale, opts).format(value);\n }\n\n function formatDate(value: Date | string, opts?: Intl.DateTimeFormatOptions): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(locale, opts).format(date);\n }\n\n return {\n locale,\n fallbackLocale,\n t,\n plural,\n formatNumber,\n formatDate,\n withLocale: (nextLocale) =>\n createI18n({\n locale: nextLocale,\n fallbackLocale: fallbackLocale ?? undefined,\n messages,\n }),\n };\n}\n"],"mappings":"AA4DA,SAAS,EAAY,EAAkB,EAAsC,CAEzE,OADK,EACE,EAAS,QAAQ,cAAe,EAAQ,IAAiB,CAC5D,IAAM,EAAQ,EAAO,GACrB,OAAO,IAAU,IAAA,GAAY,IAAI,EAAK,GAAK,OAAO,CAAK,CAC3D,CAAC,EAJmB,CAKxB,CAEA,SAAS,EACL,EACA,EACA,EACA,EACa,CACb,IAAM,EAAS,EAAQ,EAAO,GAAG,GACjC,GAAI,IAAW,IAAA,GAAW,OAAO,EACjC,GAAI,EAAU,CACV,IAAM,EAAgB,EAAQ,EAAS,GAAG,GAC1C,GAAI,IAAkB,IAAA,GAAW,OAAO,CAC5C,CACA,OAAO,IACX,CA6BA,SAAgB,EAAW,EAAkC,CACzD,GAAM,CAAE,SAAQ,iBAAiB,KAAM,YAAa,EAEpD,SAAS,EAAE,EAAa,EAA8B,EAAoC,CACtF,IAAM,EAAW,EAAO,EAAU,EAAQ,EAAgB,CAAG,GAAK,GAAS,QAE3E,OADI,IAAa,IAAA,GAAkB,EAC5B,EAAY,EAAU,CAAM,CACvC,CAEA,SAAS,EACL,EACA,EACA,EACA,EACM,CAEN,IAAM,EACF,EAAO,EAAU,EAAQ,EAAgB,GAAG,IAFjC,IAAU,EAAI,OAAS,UAEwB,GAC1D,EAAO,EAAU,EAAQ,EAAgB,CAAG,GAC5C,GAAS,QAEb,OADI,IAAa,IAAA,GAAkB,EAC5B,EAAY,EAAU,CAAE,QAAO,GAAI,GAAU,CAAC,CAAG,CAAC,CAC7D,CAEA,SAAS,EAAa,EAAe,EAAyC,CAC1E,OAAO,IAAI,KAAK,aAAa,EAAQ,CAAI,CAAC,CAAC,OAAO,CAAK,CAC3D,CAEA,SAAS,EAAW,EAAsB,EAA2C,CACjF,IAAM,EAAO,OAAO,GAAU,SAAW,IAAI,KAAK,CAAK,EAAI,EAE3D,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,EAAU,GAClC,IAAI,KAAK,eAAe,EAAQ,CAAI,CAAC,CAAC,OAAO,CAAI,CAC5D,CAEA,MAAO,CACH,SACA,iBACA,IACA,SACA,eACA,aACA,WAAa,GACT,EAAW,CACP,OAAQ,EACR,eAAgB,GAAkB,IAAA,GAClC,UACJ,CAAC,CACT,CACJ"}
|
package/dist/i18n/create-i18n.js
CHANGED
|
@@ -16,13 +16,13 @@ function t(e, t, n, r) {
|
|
|
16
16
|
}
|
|
17
17
|
function n(r) {
|
|
18
18
|
let { locale: i, fallbackLocale: a = null, messages: o } = r;
|
|
19
|
-
function s(n, r) {
|
|
20
|
-
let
|
|
21
|
-
return
|
|
19
|
+
function s(n, r, s) {
|
|
20
|
+
let c = t(o, i, a, n) ?? s?.default;
|
|
21
|
+
return c === void 0 ? n : e(c, r);
|
|
22
22
|
}
|
|
23
|
-
function c(n, r, s) {
|
|
24
|
-
let
|
|
25
|
-
return
|
|
23
|
+
function c(n, r, s, c) {
|
|
24
|
+
let l = t(o, i, a, `${n}${r === 1 ? "_one" : "_other"}`) ?? t(o, i, a, n) ?? c?.default;
|
|
25
|
+
return l === void 0 ? n : e(l, {
|
|
26
26
|
count: r,
|
|
27
27
|
...s ?? {}
|
|
28
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-i18n.js","names":[],"sources":["../../src/i18n/create-i18n.ts"],"sourcesContent":["export type Messages = Record<string, string>;\nexport type Catalog = Record<string, Messages>;\nexport type InterpolationValues = Record<string, string | number>;\n\nexport interface CreateI18nOptions {\n /** Initial locale. */\n locale: string;\n /** Fallback locale used when a key is missing in the active locale. */\n fallbackLocale?: string;\n /** Catalog `{ [locale]: { [key]: \"...\" } }`. */\n messages: Catalog;\n}\n\nexport interface I18n {\n /** Currently active locale. */\n locale: string;\n /** Fallback locale (or `null` when not configured). */\n fallbackLocale: string | null;\n /**\n * Translate `key`, interpolating `{name}` placeholders from `params`.\n * Falls back to the configured fallback locale, then to the key itself.\n */\n t: (key: string, params?: InterpolationValues) => string;\n /**\n * Plural-aware translation. Tries `${key}_one` for `count === 1` and\n * `${key}_other` otherwise, with `{count}` available for interpolation.\n */\n plural: (key: string
|
|
1
|
+
{"version":3,"file":"create-i18n.js","names":[],"sources":["../../src/i18n/create-i18n.ts"],"sourcesContent":["export type Messages = Record<string, string>;\nexport type Catalog = Record<string, Messages>;\nexport type InterpolationValues = Record<string, string | number>;\n\nexport interface CreateI18nOptions {\n /** Initial locale. */\n locale: string;\n /** Fallback locale used when a key is missing in the active locale. */\n fallbackLocale?: string;\n /** Catalog `{ [locale]: { [key]: \"...\" } }`. */\n messages: Catalog;\n}\n\n/** Per-call options for {@link I18n.t} and {@link I18n.plural}. */\nexport interface TranslateOptions {\n /**\n * Text to use when the catalog defines neither the key nor its fallback.\n *\n * Without this, a miss returns the key, and a caller that wants its own text\n * instead has to *detect* the miss — which from the outside means comparing\n * the result against the key it just passed in. That heuristic is wrong for a\n * catalog that legitimately maps a key to itself, and it is what every\n * translatable string the SDK ships would otherwise have to copy.\n *\n * Interpolated like any other message, so a default carries `{placeholders}`\n * too and is not second-class.\n */\n default?: string;\n}\n\nexport interface I18n {\n /** Currently active locale. */\n locale: string;\n /** Fallback locale (or `null` when not configured). */\n fallbackLocale: string | null;\n /**\n * Translate `key`, interpolating `{name}` placeholders from `params`.\n * Falls back to the configured fallback locale, then to `options.default`,\n * then to the key itself.\n */\n t: (key: string, params?: InterpolationValues, options?: TranslateOptions) => string;\n /**\n * Plural-aware translation. Tries `${key}_one` for `count === 1` and\n * `${key}_other` otherwise, with `{count}` available for interpolation.\n * Falls back to `options.default`, then to the key itself.\n */\n plural: (\n key: string,\n count: number,\n params?: InterpolationValues,\n options?: TranslateOptions,\n ) => string;\n /** Format a number using `Intl.NumberFormat` on the active locale. */\n formatNumber: (value: number, options?: Intl.NumberFormatOptions) => string;\n /** Format a Date using `Intl.DateTimeFormat` on the active locale. */\n formatDate: (value: Date | string, options?: Intl.DateTimeFormatOptions) => string;\n /** Build a new `I18n` instance pointing at a different locale. */\n withLocale: (locale: string) => I18n;\n}\n\nfunction interpolate(template: string, params?: InterpolationValues): string {\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_match, name: string) => {\n const value = params[name];\n return value === undefined ? `{${name}}` : String(value);\n });\n}\n\nfunction lookup(\n catalog: Catalog,\n locale: string,\n fallback: string | null,\n key: string,\n): string | null {\n const direct = catalog[locale]?.[key];\n if (direct !== undefined) return direct;\n if (fallback) {\n const fallbackValue = catalog[fallback]?.[key];\n if (fallbackValue !== undefined) return fallbackValue;\n }\n return null;\n}\n\n/**\n * Create an i18n object with translation, pluralization and Intl helpers.\n *\n * The catalog is a plain `{ [locale]: { [key]: \"...\" } }` map — bring your\n * own keys, namespaces, or nested-key conventions. The SDK does not enforce\n * a schema so you can plug it into any string-loading pipeline.\n *\n * @example\n * const i18n = createI18n({\n * locale: \"pt-BR\",\n * fallbackLocale: \"en\",\n * messages: {\n * \"pt-BR\": {\n * \"greet\": \"Olá, {name}\",\n * \"alos_one\": \"{count} Alô\",\n * \"alos_other\": \"{count} Alôs\",\n * },\n * \"en\": { greet: \"Hi, {name}\", alos_one: \"{count} Alo\", alos_other: \"{count} Alos\" },\n * },\n * });\n * i18n.t(\"greet\", { name: \"Mau\" }); // \"Olá, Mau\"\n * i18n.plural(\"alos\", 3); // \"3 Alôs\"\n *\n * @example\n * // A key the catalog does not define, with text to show instead of the key.\n * i18n.t(\"cart.empty\", undefined, { default: \"Seu carrinho está vazio\" });\n */\nexport function createI18n(options: CreateI18nOptions): I18n {\n const { locale, fallbackLocale = null, messages } = options;\n\n function t(key: string, params?: InterpolationValues, options?: TranslateOptions): string {\n const template = lookup(messages, locale, fallbackLocale, key) ?? options?.default;\n if (template === undefined) return key;\n return interpolate(template, params);\n }\n\n function plural(\n key: string,\n count: number,\n params?: InterpolationValues,\n options?: TranslateOptions,\n ): string {\n const suffix = count === 1 ? \"_one\" : \"_other\";\n const template =\n lookup(messages, locale, fallbackLocale, `${key}${suffix}`) ??\n lookup(messages, locale, fallbackLocale, key) ??\n options?.default;\n if (template === undefined) return key;\n return interpolate(template, { count, ...(params ?? {}) });\n }\n\n function formatNumber(value: number, opts?: Intl.NumberFormatOptions): string {\n return new Intl.NumberFormat(locale, opts).format(value);\n }\n\n function formatDate(value: Date | string, opts?: Intl.DateTimeFormatOptions): string {\n const date = typeof value === \"string\" ? new Date(value) : value;\n if (Number.isNaN(date.getTime())) return \"\";\n return new Intl.DateTimeFormat(locale, opts).format(date);\n }\n\n return {\n locale,\n fallbackLocale,\n t,\n plural,\n formatNumber,\n formatDate,\n withLocale: (nextLocale) =>\n createI18n({\n locale: nextLocale,\n fallbackLocale: fallbackLocale ?? undefined,\n messages,\n }),\n };\n}\n"],"mappings":";AA4DA,SAAS,EAAY,GAAkB,GAAsC;CAEzE,OADK,IACE,EAAS,QAAQ,eAAe,GAAQ,MAAiB;EAC5D,IAAM,IAAQ,EAAO;EACrB,OAAO,MAAU,KAAA,IAAY,IAAI,EAAK,KAAK,OAAO,CAAK;CAC3D,CAAC,IAJmB;AAKxB;AAEA,SAAS,EACL,GACA,GACA,GACA,GACa;CACb,IAAM,IAAS,EAAQ,EAAO,GAAG;CACjC,IAAI,MAAW,KAAA,GAAW,OAAO;CACjC,IAAI,GAAU;EACV,IAAM,IAAgB,EAAQ,EAAS,GAAG;EAC1C,IAAI,MAAkB,KAAA,GAAW,OAAO;CAC5C;CACA,OAAO;AACX;AA6BA,SAAgB,EAAW,GAAkC;CACzD,IAAM,EAAE,WAAQ,oBAAiB,MAAM,gBAAa;CAEpD,SAAS,EAAE,GAAa,GAA8B,GAAoC;EACtF,IAAM,IAAW,EAAO,GAAU,GAAQ,GAAgB,CAAG,KAAK,GAAS;EAE3E,OADI,MAAa,KAAA,IAAkB,IAC5B,EAAY,GAAU,CAAM;CACvC;CAEA,SAAS,EACL,GACA,GACA,GACA,GACM;EAEN,IAAM,IACF,EAAO,GAAU,GAAQ,GAAgB,GAAG,IAFjC,MAAU,IAAI,SAAS,UAEwB,KAC1D,EAAO,GAAU,GAAQ,GAAgB,CAAG,KAC5C,GAAS;EAEb,OADI,MAAa,KAAA,IAAkB,IAC5B,EAAY,GAAU;GAAE;GAAO,GAAI,KAAU,CAAC;EAAG,CAAC;CAC7D;CAEA,SAAS,EAAa,GAAe,GAAyC;EAC1E,OAAO,IAAI,KAAK,aAAa,GAAQ,CAAI,CAAC,CAAC,OAAO,CAAK;CAC3D;CAEA,SAAS,EAAW,GAAsB,GAA2C;EACjF,IAAM,IAAO,OAAO,KAAU,WAAW,IAAI,KAAK,CAAK,IAAI;EAE3D,OADI,OAAO,MAAM,EAAK,QAAQ,CAAC,IAAU,KAClC,IAAI,KAAK,eAAe,GAAQ,CAAI,CAAC,CAAC,OAAO,CAAI;CAC5D;CAEA,OAAO;EACH;EACA;EACA;EACA;EACA;EACA;EACA,aAAa,MACT,EAAW;GACP,QAAQ;GACR,gBAAgB,KAAkB,KAAA;GAClC;EACJ,CAAC;CACT;AACJ"}
|
package/dist/icons/Icon.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../utils/dev-mode.cjs"),t=require("./icon-context.cjs"),n=require("./shard-cache.cjs"),
|
|
1
|
+
const e=require("../utils/dev-mode.cjs"),t=require("./icon-context.cjs"),n=require("./normalize-icon-name.cjs"),r=require("./shard-cache.cjs"),i=require("./use-icon.cjs");let a=require("react");function o({name:o,icon:s,size:l,strokeWidth:u,fallback:d=null,normalize:f=!0,...p}){let m=t.useIconContext(),h=o===void 0?void 0:f?n.normalizeIconName(o):o,g=i.useIcon(h),_=s??g;return _?(0,a.createElement)(_,{size:l??m?.size,strokeWidth:u??m?.strokeWidth,...p}):(e.isDevBuild()&&o!==void 0&&h!==void 0&&r.iconStatus(h)===`missing`&&c(o),d)}var s=new Set;function c(e){s.has(e)||(s.add(e),console.warn(`[tempest-react-sdk] <Icon name="${e}" /> — no such lucide icon. Slugs are kebab-case ("circle-alert", not "CircleAlert"); check against \`iconNames\`.`))}exports.Icon=o;
|
|
2
2
|
//# sourceMappingURL=Icon.cjs.map
|
package/dist/icons/Icon.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.cjs","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["import { createElement, type ReactNode, type SVGProps } from \"react\";\n\nimport type { IconName } from \"./generated/icon-name\";\nimport { useIconContext } from \"./icon-context\";\nimport { iconStatus } from \"./shard-cache\";\nimport { useIcon } from \"./use-icon\";\nimport { isDevBuild } from \"../utils\";\n\
|
|
1
|
+
{"version":3,"file":"Icon.cjs","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["import { createElement, type ReactNode, type SVGProps } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\n\nimport type { IconName } from \"./generated/icon-name\";\nimport { useIconContext } from \"./icon-context\";\nimport { normalizeIconName } from \"./normalize-icon-name\";\nimport { iconStatus } from \"./shard-cache\";\nimport { useIcon } from \"./use-icon\";\nimport { isDevBuild } from \"../utils/dev-mode\";\n\ninterface IconBaseProps extends Omit<SVGProps<SVGSVGElement>, \"ref\" | \"name\"> {\n /** Width and height in px. Defaults to the provider's value, then lucide's `24`. */\n size?: number | string;\n /** Stroke width. Defaults to the provider's value, then lucide's `2`. */\n strokeWidth?: number;\n /**\n * Rendered while the icon's shard is in flight, and for a slug that does not\n * exist at all. Defaults to nothing.\n *\n * Pass a same-sized placeholder when the surrounding layout would otherwise\n * shift. Note that a slug already in the registry or the cache never renders\n * this — it resolves during render.\n */\n fallback?: ReactNode;\n /**\n * Clean up `name` before looking it up. Default `true`.\n *\n * A stored `icon_code` arrives dirty — `shopping_cart`, `\" Save\"`, a slug\n * lucide deprecated two releases ago — and normalizing is what makes those\n * render instead of falling back. `false` asks for a strict lookup, for the\n * case where you want an unexpected spelling to be visible rather than\n * quietly repaired.\n *\n * Ignored when the icon is passed as a component.\n */\n normalize?: boolean;\n}\n\n/**\n * Address the icon by slug — the reason this component exists.\n *\n * The slug is typed as the union of every name lucide ships, so a typo is a\n * compile error, while still accepting a plain `string` for the case that\n * motivates the whole module: a name arriving from an API, a CMS or a config\n * table.\n */\ninterface IconByNameProps extends IconBaseProps {\n name: IconName | (string & {});\n icon?: never;\n}\n\n/**\n * Address the icon by component, for a call site that already imported it.\n *\n * No lookup, no registry, no shard: the component is rendered as passed. It is\n * there so a screen mixing literal icons with data-driven ones can keep using one\n * component instead of alternating between `<Icon name>` and `<Wrench />`, which\n * is what makes the shared `size`/`strokeWidth` defaults apply to both.\n */\ninterface IconByComponentProps extends IconBaseProps {\n icon: LucideIcon;\n name?: never;\n}\n\nexport type IconProps = IconByNameProps | IconByComponentProps;\n\n/**\n * Render a lucide icon by slug.\n *\n * All ~2000 lucide icons are addressable, without the cost that makes\n * `lucide-react`'s own `DynamicIcon` unusable: its icon map holds a dynamic\n * `import()` per icon, so a bundler has to emit ~2000 chunk boundaries and the\n * browser floods with requests. Here a slug the app wrote as a literal is\n * resolved from a static registry, and a slug only known at runtime pulls a\n * single shard covering every icon sharing its initial letter.\n *\n * An unknown slug renders `fallback` (nothing, by default) and warns in dev only\n * — it never throws, because a bad name from an API must not take down the tree.\n *\n * `name` is normalized before the lookup, so a stored `icon_code` renders whether\n * it was written `shopping_cart`, `\" Save\"` or under a slug lucide has since\n * deprecated. Pass `normalize={false}` for a strict lookup.\n *\n * @example\n * <Icon name=\"save\" size={18} />\n * <Icon name={row.iconSlug} fallback={<span className=\"skeleton\" />} />\n * <Icon icon={Wrench} size={18} />\n */\nexport function Icon({\n name,\n icon,\n size,\n strokeWidth,\n fallback = null,\n normalize = true,\n ...rest\n}: IconProps): ReactNode {\n const context = useIconContext();\n const slug = name === undefined ? undefined : normalize ? normalizeIconName(name) : name;\n const fromSlug = useIcon(slug);\n const resolved = icon ?? fromSlug;\n\n if (!resolved) {\n if (isDevBuild() && name !== undefined && slug !== undefined) {\n if (iconStatus(slug) === \"missing\") warnUnknownIcon(name);\n }\n return fallback;\n }\n\n return createElement(resolved, {\n size: size ?? context?.size,\n strokeWidth: strokeWidth ?? context?.strokeWidth,\n ...rest,\n });\n}\n\nconst warnedSlugs = new Set<string>();\n\n/**\n * Warn once per unknown slug.\n *\n * Once, because `<Icon>` re-renders and a warning per render would bury the\n * console; the set is never cleared, since a slug that does not exist will not\n * start existing within the life of the page.\n *\n * Reports the name **as written**, not the normalized slug: the reader is the\n * developer who typed it, and `\"CircleAlert\"` is a far more useful thing to see in\n * the console than the `\"circlealert\"` it normalizes to.\n *\n * @param name - The slug that resolved to nothing, as passed.\n */\nfunction warnUnknownIcon(name: string): void {\n if (warnedSlugs.has(name)) return;\n warnedSlugs.add(name);\n console.warn(\n `[tempest-react-sdk] <Icon name=\"${name}\" /> — no such lucide icon. ` +\n `Slugs are kebab-case (\"circle-alert\", not \"CircleAlert\"); check against \\`iconNames\\`.`,\n );\n}\n"],"mappings":"kMAwFA,SAAgB,EAAK,CACjB,OACA,OACA,OACA,cACA,WAAW,KACX,YAAY,GACZ,GAAG,GACkB,CACrB,IAAM,EAAU,EAAA,eAAe,EACzB,EAAO,IAAS,IAAA,GAAY,IAAA,GAAY,EAAY,EAAA,kBAAkB,CAAI,EAAI,EAC9E,EAAW,EAAA,QAAQ,CAAI,EACvB,EAAW,GAAQ,EASzB,OAPK,GAOL,EAAO,EAAA,cAAA,CAAc,EAAU,CAC3B,KAAM,GAAQ,GAAS,KACvB,YAAa,GAAe,GAAS,YACrC,GAAG,CACP,CAAC,GAVO,EAAA,WAAW,GAAK,IAAS,IAAA,IAAa,IAAS,IAAA,IAC3C,EAAA,WAAW,CAAI,IAAM,WAAW,EAAgB,CAAI,EAErD,EAQf,CAEA,IAAM,EAAc,IAAI,IAexB,SAAS,EAAgB,EAAoB,CACrC,EAAY,IAAI,CAAI,IACxB,EAAY,IAAI,CAAI,EACpB,QAAQ,KACJ,mCAAmC,EAAK,mHAE5C,EACJ"}
|
package/dist/icons/Icon.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { isDevBuild as e } from "../utils/dev-mode.js";
|
|
2
2
|
import { useIconContext as t } from "./icon-context.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { normalizeIconName as n } from "./normalize-icon-name.js";
|
|
4
|
+
import { iconStatus as r } from "./shard-cache.js";
|
|
5
|
+
import { useIcon as i } from "./use-icon.js";
|
|
6
|
+
import { createElement as a } from "react";
|
|
6
7
|
//#region src/icons/Icon.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
return
|
|
10
|
-
size:
|
|
11
|
-
strokeWidth:
|
|
12
|
-
...
|
|
13
|
-
}) : (e() &&
|
|
8
|
+
function o({ name: o, icon: s, size: l, strokeWidth: u, fallback: d = null, normalize: f = !0, ...p }) {
|
|
9
|
+
let m = t(), h = o === void 0 ? void 0 : f ? n(o) : o, g = i(h), _ = s ?? g;
|
|
10
|
+
return _ ? a(_, {
|
|
11
|
+
size: l ?? m?.size,
|
|
12
|
+
strokeWidth: u ?? m?.strokeWidth,
|
|
13
|
+
...p
|
|
14
|
+
}) : (e() && o !== void 0 && h !== void 0 && r(h) === "missing" && c(o), d);
|
|
14
15
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
var s = /* @__PURE__ */ new Set();
|
|
17
|
+
function c(e) {
|
|
18
|
+
s.has(e) || (s.add(e), console.warn(`[tempest-react-sdk] <Icon name="${e}" /> — no such lucide icon. Slugs are kebab-case ("circle-alert", not "CircleAlert"); check against \`iconNames\`.`));
|
|
18
19
|
}
|
|
19
20
|
//#endregion
|
|
20
|
-
export {
|
|
21
|
+
export { o as Icon };
|
|
21
22
|
|
|
22
23
|
//# sourceMappingURL=Icon.js.map
|
package/dist/icons/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["import { createElement, type ReactNode, type SVGProps } from \"react\";\n\nimport type { IconName } from \"./generated/icon-name\";\nimport { useIconContext } from \"./icon-context\";\nimport { iconStatus } from \"./shard-cache\";\nimport { useIcon } from \"./use-icon\";\nimport { isDevBuild } from \"../utils\";\n\
|
|
1
|
+
{"version":3,"file":"Icon.js","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["import { createElement, type ReactNode, type SVGProps } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\n\nimport type { IconName } from \"./generated/icon-name\";\nimport { useIconContext } from \"./icon-context\";\nimport { normalizeIconName } from \"./normalize-icon-name\";\nimport { iconStatus } from \"./shard-cache\";\nimport { useIcon } from \"./use-icon\";\nimport { isDevBuild } from \"../utils/dev-mode\";\n\ninterface IconBaseProps extends Omit<SVGProps<SVGSVGElement>, \"ref\" | \"name\"> {\n /** Width and height in px. Defaults to the provider's value, then lucide's `24`. */\n size?: number | string;\n /** Stroke width. Defaults to the provider's value, then lucide's `2`. */\n strokeWidth?: number;\n /**\n * Rendered while the icon's shard is in flight, and for a slug that does not\n * exist at all. Defaults to nothing.\n *\n * Pass a same-sized placeholder when the surrounding layout would otherwise\n * shift. Note that a slug already in the registry or the cache never renders\n * this — it resolves during render.\n */\n fallback?: ReactNode;\n /**\n * Clean up `name` before looking it up. Default `true`.\n *\n * A stored `icon_code` arrives dirty — `shopping_cart`, `\" Save\"`, a slug\n * lucide deprecated two releases ago — and normalizing is what makes those\n * render instead of falling back. `false` asks for a strict lookup, for the\n * case where you want an unexpected spelling to be visible rather than\n * quietly repaired.\n *\n * Ignored when the icon is passed as a component.\n */\n normalize?: boolean;\n}\n\n/**\n * Address the icon by slug — the reason this component exists.\n *\n * The slug is typed as the union of every name lucide ships, so a typo is a\n * compile error, while still accepting a plain `string` for the case that\n * motivates the whole module: a name arriving from an API, a CMS or a config\n * table.\n */\ninterface IconByNameProps extends IconBaseProps {\n name: IconName | (string & {});\n icon?: never;\n}\n\n/**\n * Address the icon by component, for a call site that already imported it.\n *\n * No lookup, no registry, no shard: the component is rendered as passed. It is\n * there so a screen mixing literal icons with data-driven ones can keep using one\n * component instead of alternating between `<Icon name>` and `<Wrench />`, which\n * is what makes the shared `size`/`strokeWidth` defaults apply to both.\n */\ninterface IconByComponentProps extends IconBaseProps {\n icon: LucideIcon;\n name?: never;\n}\n\nexport type IconProps = IconByNameProps | IconByComponentProps;\n\n/**\n * Render a lucide icon by slug.\n *\n * All ~2000 lucide icons are addressable, without the cost that makes\n * `lucide-react`'s own `DynamicIcon` unusable: its icon map holds a dynamic\n * `import()` per icon, so a bundler has to emit ~2000 chunk boundaries and the\n * browser floods with requests. Here a slug the app wrote as a literal is\n * resolved from a static registry, and a slug only known at runtime pulls a\n * single shard covering every icon sharing its initial letter.\n *\n * An unknown slug renders `fallback` (nothing, by default) and warns in dev only\n * — it never throws, because a bad name from an API must not take down the tree.\n *\n * `name` is normalized before the lookup, so a stored `icon_code` renders whether\n * it was written `shopping_cart`, `\" Save\"` or under a slug lucide has since\n * deprecated. Pass `normalize={false}` for a strict lookup.\n *\n * @example\n * <Icon name=\"save\" size={18} />\n * <Icon name={row.iconSlug} fallback={<span className=\"skeleton\" />} />\n * <Icon icon={Wrench} size={18} />\n */\nexport function Icon({\n name,\n icon,\n size,\n strokeWidth,\n fallback = null,\n normalize = true,\n ...rest\n}: IconProps): ReactNode {\n const context = useIconContext();\n const slug = name === undefined ? undefined : normalize ? normalizeIconName(name) : name;\n const fromSlug = useIcon(slug);\n const resolved = icon ?? fromSlug;\n\n if (!resolved) {\n if (isDevBuild() && name !== undefined && slug !== undefined) {\n if (iconStatus(slug) === \"missing\") warnUnknownIcon(name);\n }\n return fallback;\n }\n\n return createElement(resolved, {\n size: size ?? context?.size,\n strokeWidth: strokeWidth ?? context?.strokeWidth,\n ...rest,\n });\n}\n\nconst warnedSlugs = new Set<string>();\n\n/**\n * Warn once per unknown slug.\n *\n * Once, because `<Icon>` re-renders and a warning per render would bury the\n * console; the set is never cleared, since a slug that does not exist will not\n * start existing within the life of the page.\n *\n * Reports the name **as written**, not the normalized slug: the reader is the\n * developer who typed it, and `\"CircleAlert\"` is a far more useful thing to see in\n * the console than the `\"circlealert\"` it normalizes to.\n *\n * @param name - The slug that resolved to nothing, as passed.\n */\nfunction warnUnknownIcon(name: string): void {\n if (warnedSlugs.has(name)) return;\n warnedSlugs.add(name);\n console.warn(\n `[tempest-react-sdk] <Icon name=\"${name}\" /> — no such lucide icon. ` +\n `Slugs are kebab-case (\"circle-alert\", not \"CircleAlert\"); check against \\`iconNames\\`.`,\n );\n}\n"],"mappings":";;;;;;;AAwFA,SAAgB,EAAK,EACjB,SACA,SACA,SACA,gBACA,cAAW,MACX,eAAY,IACZ,GAAG,KACkB;CACrB,IAAM,IAAU,EAAe,GACzB,IAAO,MAAS,KAAA,IAAY,KAAA,IAAY,IAAY,EAAkB,CAAI,IAAI,GAC9E,IAAW,EAAQ,CAAI,GACvB,IAAW,KAAQ;CASzB,OAPK,IAOE,EAAc,GAAU;EAC3B,MAAM,KAAQ,GAAS;EACvB,aAAa,KAAe,GAAS;EACrC,GAAG;CACP,CAAC,KAVO,EAAW,KAAK,MAAS,KAAA,KAAa,MAAS,KAAA,KAC3C,EAAW,CAAI,MAAM,aAAW,EAAgB,CAAI,GAErD;AAQf;AAEA,IAAM,oBAAc,IAAI,IAAY;AAepC,SAAS,EAAgB,GAAoB;CACrC,EAAY,IAAI,CAAI,MACxB,EAAY,IAAI,CAAI,GACpB,QAAQ,KACJ,mCAAmC,EAAK,mHAE5C;AACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("../utils/cn.cjs"),t=require("./generated/icon-names.cjs"),n=require("./normalize-icon-name.cjs"),r=require("./Icon.cjs"),i=require("./validate-icon-name.cjs"),a=require("./IconPicker.module.cjs");let o=require("react"),s=require("react/jsx-runtime");function c({value:c,onChange:l,limit:u=40,previewSize:d=20,invalidMessage:f,emptyPreview:p=null,className:m,...h}){let g=(0,o.useId)(),_=(0,o.useRef)(null),v=i.validateIconName(c,f),y=(0,o.useMemo)(()=>{let e=n.normalizeIconName(c);return(e===``?t.iconNames:t.iconNames.filter(t=>t.includes(e))).slice(0,u)},[c,u]);return(0,o.useEffect)(()=>{_.current?.setCustomValidity(v??``)},[v]),(0,s.jsxs)(`span`,{className:e.cn(a.default.picker,m),children:[(0,s.jsx)(`span`,{className:a.default.preview,"aria-hidden":`true`,children:v===void 0&&c.trim()!==``?(0,s.jsx)(r.Icon,{name:c,size:d,fallback:p}):p}),(0,s.jsx)(`input`,{...h,ref:_,type:`text`,className:a.default.input,list:g,value:c,"aria-invalid":v!==void 0||void 0,onChange:e=>l(n.normalizeIconName(e.target.value))}),(0,s.jsx)(`datalist`,{id:g,children:y.map(e=>(0,s.jsx)(`option`,{value:e},e))})]})}exports.IconPicker=c;
|
|
2
|
+
//# sourceMappingURL=IconPicker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconPicker.cjs","names":[],"sources":["../../src/icons/IconPicker.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cn } from \"../utils/cn\";\nimport { iconNames } from \"./generated/icon-names\";\nimport { Icon } from \"./Icon\";\nimport { normalizeIconName } from \"./normalize-icon-name\";\nimport { validateIconName } from \"./validate-icon-name\";\nimport styles from \"./IconPicker.module.css\";\n\n/**\n * @tempest-limits props-count — value/onChange are the field, limit/placeholder\n * the suggestion list, and previewSize/invalidMessage the two things a form\n * around it needs to restyle or translate.\n */\nexport interface IconPickerProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"onChange\" | \"list\" | \"type\"\n> {\n /** The chosen slug. Always canonical — see `onChange`. */\n value: string;\n /**\n * Fires with the **canonical** slug on every keystroke.\n *\n * Legacy spellings are normalized on the way out (`Shopping_Cart` →\n * `shopping-cart`, `alert-circle` → `circle-alert`), so what a form stores is\n * what `<Icon>` resolves without further cleanup.\n */\n onChange: (slug: string) => void;\n /**\n * How many suggestions to render. Default `40`.\n *\n * There are 2024 slugs, and building every one as an `<option>` on each\n * keystroke freezes the datalist — which is the reason this prop exists rather\n * than a \"show everything\" default.\n */\n limit?: number;\n /** Size of the preview glyph, in px. Default `20`. */\n previewSize?: number;\n /** Overrides the message shown for a slug that does not exist. */\n invalidMessage?: string;\n /** Rendered in the preview box while nothing valid is chosen. */\n emptyPreview?: ReactNode;\n}\n\n/**\n * An icon field: native autocomplete over every lucide slug, plus a preview.\n *\n * Every panel that lets someone choose an icon was rewriting this — filter the\n * list, cap the suggestions, build the `<datalist>`, and block submit when the\n * typed name does not exist. That last step is the one that matters: without it\n * an invalid value reaches the database and only shows up later as a missing icon\n * on every screen that renders the record.\n *\n * Validation is wired to the **native** form: the input carries a custom validity\n * message, so a plain `<form>` refuses to submit and the browser points at the\n * field. `validateIconName` is exported for react-hook-form and zod.\n *\n * Built on `<datalist>` rather than a custom listbox on purpose: keyboard,\n * screen-reader and mobile behaviour come from the platform, and the component\n * stays small enough that its cost is the slug list it has to import — ~7 KB\n * brotli, which only a picker pays.\n *\n * @example\n * const [icon, setIcon] = useState(\"\");\n *\n * <form onSubmit={save}>\n * <IconPicker value={icon} onChange={setIcon} required />\n * <button type=\"submit\">Salvar</button>\n * </form>\n */\nexport function IconPicker({\n value,\n onChange,\n limit = 40,\n previewSize = 20,\n invalidMessage,\n emptyPreview = null,\n className,\n ...rest\n}: IconPickerProps): ReactNode {\n const listId = useId();\n const input = useRef<HTMLInputElement>(null);\n const error = validateIconName(value, invalidMessage);\n\n const suggestions = useMemo(() => {\n const query = normalizeIconName(value);\n const matches = query === \"\" ? iconNames : iconNames.filter((name) => name.includes(query));\n return matches.slice(0, limit);\n }, [value, limit]);\n\n useEffect(() => {\n input.current?.setCustomValidity(error ?? \"\");\n }, [error]);\n\n return (\n <span className={cn(styles.picker, className)}>\n <span className={styles.preview} aria-hidden=\"true\">\n {error === undefined && value.trim() !== \"\" ? (\n <Icon name={value} size={previewSize} fallback={emptyPreview} />\n ) : (\n emptyPreview\n )}\n </span>\n <input\n {...rest}\n ref={input}\n type=\"text\"\n className={styles.input}\n list={listId}\n value={value}\n aria-invalid={error !== undefined || undefined}\n onChange={(event) => onChange(normalizeIconName(event.target.value))}\n />\n <datalist id={listId}>\n {suggestions.map((name) => (\n <option key={name} value={name} />\n ))}\n </datalist>\n </span>\n );\n}\n"],"mappings":"2QAsEA,SAAgB,EAAW,CACvB,QACA,WACA,QAAQ,GACR,cAAc,GACd,iBACA,eAAe,KACf,YACA,GAAG,GACwB,CAC3B,IAAM,GAAA,EAAS,EAAA,MAAA,CAAM,EACf,GAAA,EAAQ,EAAA,OAAA,CAAyB,IAAI,EACrC,EAAQ,EAAA,iBAAiB,EAAO,CAAc,EAE9C,GAAA,EAAc,EAAA,QAAA,KAAc,CAC9B,IAAM,EAAQ,EAAA,kBAAkB,CAAK,EAErC,OADgB,IAAU,GAAK,EAAA,UAAY,EAAA,UAAU,OAAQ,GAAS,EAAK,SAAS,CAAK,CAAC,EAAA,CAC3E,MAAM,EAAG,CAAK,CACjC,EAAG,CAAC,EAAO,CAAK,CAAC,EAMjB,OAJA,EAAA,EAAA,UAAA,KAAgB,CACZ,EAAM,SAAS,kBAAkB,GAAS,EAAE,CAChD,EAAG,CAAC,CAAK,CAAC,GAGN,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAW,EAAA,GAAG,EAAA,QAAO,OAAQ,CAAS,EAA5C,SAAA,EACI,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,QAAS,cAAY,OACxC,SAAA,IAAU,IAAA,IAAa,EAAM,KAAK,IAAM,IACrC,EAAA,EAAA,IAAA,CAAC,EAAA,KAAD,CAAM,KAAM,EAAO,KAAM,EAAa,SAAU,CAAe,CAAA,EAE/D,CAEF,CAAA,GACN,EAAA,EAAA,IAAA,CAAC,QAAD,CACI,GAAI,EACJ,IAAK,EACL,KAAK,OACL,UAAW,EAAA,QAAO,MAClB,KAAM,EACC,QACP,eAAc,IAAU,IAAA,IAAa,IAAA,GACrC,SAAW,GAAU,EAAS,EAAA,kBAAkB,EAAM,OAAO,KAAK,CAAC,CACtE,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,WAAD,CAAU,GAAI,EACT,SAAA,EAAY,IAAK,IACd,EAAA,EAAA,IAAA,CAAC,SAAD,CAAmB,MAAO,CAAO,EAApB,CAAoB,CACpC,CACK,CAAA,CACR,GAEd"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cn as e } from "../utils/cn.js";
|
|
2
|
+
import { iconNames as t } from "./generated/icon-names.js";
|
|
3
|
+
import { normalizeIconName as n } from "./normalize-icon-name.js";
|
|
4
|
+
import { Icon as r } from "./Icon.js";
|
|
5
|
+
import { validateIconName as i } from "./validate-icon-name.js";
|
|
6
|
+
import a from "./IconPicker.module.js";
|
|
7
|
+
import { useEffect as o, useId as s, useMemo as c, useRef as l } from "react";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
//#region src/icons/IconPicker.tsx
|
|
10
|
+
function f({ value: f, onChange: p, limit: m = 40, previewSize: h = 20, invalidMessage: g, emptyPreview: _ = null, className: v, ...y }) {
|
|
11
|
+
let b = s(), x = l(null), S = i(f, g), C = c(() => {
|
|
12
|
+
let e = n(f);
|
|
13
|
+
return (e === "" ? t : t.filter((t) => t.includes(e))).slice(0, m);
|
|
14
|
+
}, [f, m]);
|
|
15
|
+
return o(() => {
|
|
16
|
+
x.current?.setCustomValidity(S ?? "");
|
|
17
|
+
}, [S]), /* @__PURE__ */ d("span", {
|
|
18
|
+
className: e(a.picker, v),
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ u("span", {
|
|
21
|
+
className: a.preview,
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: S === void 0 && f.trim() !== "" ? /* @__PURE__ */ u(r, {
|
|
24
|
+
name: f,
|
|
25
|
+
size: h,
|
|
26
|
+
fallback: _
|
|
27
|
+
}) : _
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ u("input", {
|
|
30
|
+
...y,
|
|
31
|
+
ref: x,
|
|
32
|
+
type: "text",
|
|
33
|
+
className: a.input,
|
|
34
|
+
list: b,
|
|
35
|
+
value: f,
|
|
36
|
+
"aria-invalid": S !== void 0 || void 0,
|
|
37
|
+
onChange: (e) => p(n(e.target.value))
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ u("datalist", {
|
|
40
|
+
id: b,
|
|
41
|
+
children: C.map((e) => /* @__PURE__ */ u("option", { value: e }, e))
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { f as IconPicker };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=IconPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconPicker.js","names":[],"sources":["../../src/icons/IconPicker.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\n\nimport { cn } from \"../utils/cn\";\nimport { iconNames } from \"./generated/icon-names\";\nimport { Icon } from \"./Icon\";\nimport { normalizeIconName } from \"./normalize-icon-name\";\nimport { validateIconName } from \"./validate-icon-name\";\nimport styles from \"./IconPicker.module.css\";\n\n/**\n * @tempest-limits props-count — value/onChange are the field, limit/placeholder\n * the suggestion list, and previewSize/invalidMessage the two things a form\n * around it needs to restyle or translate.\n */\nexport interface IconPickerProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"value\" | \"onChange\" | \"list\" | \"type\"\n> {\n /** The chosen slug. Always canonical — see `onChange`. */\n value: string;\n /**\n * Fires with the **canonical** slug on every keystroke.\n *\n * Legacy spellings are normalized on the way out (`Shopping_Cart` →\n * `shopping-cart`, `alert-circle` → `circle-alert`), so what a form stores is\n * what `<Icon>` resolves without further cleanup.\n */\n onChange: (slug: string) => void;\n /**\n * How many suggestions to render. Default `40`.\n *\n * There are 2024 slugs, and building every one as an `<option>` on each\n * keystroke freezes the datalist — which is the reason this prop exists rather\n * than a \"show everything\" default.\n */\n limit?: number;\n /** Size of the preview glyph, in px. Default `20`. */\n previewSize?: number;\n /** Overrides the message shown for a slug that does not exist. */\n invalidMessage?: string;\n /** Rendered in the preview box while nothing valid is chosen. */\n emptyPreview?: ReactNode;\n}\n\n/**\n * An icon field: native autocomplete over every lucide slug, plus a preview.\n *\n * Every panel that lets someone choose an icon was rewriting this — filter the\n * list, cap the suggestions, build the `<datalist>`, and block submit when the\n * typed name does not exist. That last step is the one that matters: without it\n * an invalid value reaches the database and only shows up later as a missing icon\n * on every screen that renders the record.\n *\n * Validation is wired to the **native** form: the input carries a custom validity\n * message, so a plain `<form>` refuses to submit and the browser points at the\n * field. `validateIconName` is exported for react-hook-form and zod.\n *\n * Built on `<datalist>` rather than a custom listbox on purpose: keyboard,\n * screen-reader and mobile behaviour come from the platform, and the component\n * stays small enough that its cost is the slug list it has to import — ~7 KB\n * brotli, which only a picker pays.\n *\n * @example\n * const [icon, setIcon] = useState(\"\");\n *\n * <form onSubmit={save}>\n * <IconPicker value={icon} onChange={setIcon} required />\n * <button type=\"submit\">Salvar</button>\n * </form>\n */\nexport function IconPicker({\n value,\n onChange,\n limit = 40,\n previewSize = 20,\n invalidMessage,\n emptyPreview = null,\n className,\n ...rest\n}: IconPickerProps): ReactNode {\n const listId = useId();\n const input = useRef<HTMLInputElement>(null);\n const error = validateIconName(value, invalidMessage);\n\n const suggestions = useMemo(() => {\n const query = normalizeIconName(value);\n const matches = query === \"\" ? iconNames : iconNames.filter((name) => name.includes(query));\n return matches.slice(0, limit);\n }, [value, limit]);\n\n useEffect(() => {\n input.current?.setCustomValidity(error ?? \"\");\n }, [error]);\n\n return (\n <span className={cn(styles.picker, className)}>\n <span className={styles.preview} aria-hidden=\"true\">\n {error === undefined && value.trim() !== \"\" ? (\n <Icon name={value} size={previewSize} fallback={emptyPreview} />\n ) : (\n emptyPreview\n )}\n </span>\n <input\n {...rest}\n ref={input}\n type=\"text\"\n className={styles.input}\n list={listId}\n value={value}\n aria-invalid={error !== undefined || undefined}\n onChange={(event) => onChange(normalizeIconName(event.target.value))}\n />\n <datalist id={listId}>\n {suggestions.map((name) => (\n <option key={name} value={name} />\n ))}\n </datalist>\n </span>\n );\n}\n"],"mappings":";;;;;;;;;AAsEA,SAAgB,EAAW,EACvB,UACA,aACA,WAAQ,IACR,iBAAc,IACd,mBACA,kBAAe,MACf,cACA,GAAG,KACwB;CAC3B,IAAM,IAAS,EAAM,GACf,IAAQ,EAAyB,IAAI,GACrC,IAAQ,EAAiB,GAAO,CAAc,GAE9C,IAAc,QAAc;EAC9B,IAAM,IAAQ,EAAkB,CAAK;EAErC,QADgB,MAAU,KAAK,IAAY,EAAU,QAAQ,MAAS,EAAK,SAAS,CAAK,CAAC,EAAA,CAC3E,MAAM,GAAG,CAAK;CACjC,GAAG,CAAC,GAAO,CAAK,CAAC;CAMjB,OAJA,QAAgB;EACZ,EAAM,SAAS,kBAAkB,KAAS,EAAE;CAChD,GAAG,CAAC,CAAK,CAAC,GAGN,kBAAC,QAAD;EAAM,WAAW,EAAG,EAAO,QAAQ,CAAS;EAA5C,UAAA;GACI,kBAAC,QAAD;IAAM,WAAW,EAAO;IAAS,eAAY;IACxC,UAAA,MAAU,KAAA,KAAa,EAAM,KAAK,MAAM,KACrC,kBAAC,GAAD;KAAM,MAAM;KAAO,MAAM;KAAa,UAAU;IAAe,CAAA,IAE/D;GAEF,CAAA;GACN,kBAAC,SAAD;IACI,GAAI;IACJ,KAAK;IACL,MAAK;IACL,WAAW,EAAO;IAClB,MAAM;IACC;IACP,gBAAc,MAAU,KAAA,KAAa,KAAA;IACrC,WAAW,MAAU,EAAS,EAAkB,EAAM,OAAO,KAAK,CAAC;GACtE,CAAA;GACD,kBAAC,YAAD;IAAU,IAAI;IACT,UAAA,EAAY,KAAK,MACd,kBAAC,UAAD,EAAmB,OAAO,EAAO,GAApB,CAAoB,CACpC;GACK,CAAA;EACR;;AAEd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconPicker.module.cjs","names":[],"sources":["../../src/icons/IconPicker.module.css"],"sourcesContent":[".picker {\n display: inline-flex;\n align-items: center;\n gap: var(--tempest-space-2);\n font-family: var(--tempest-font-sans);\n}\n\n.preview {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 34px;\n height: 34px;\n border: 1px solid var(--tempest-border);\n border-radius: var(--tempest-radius-md);\n background: var(--tempest-surface);\n color: var(--tempest-text);\n}\n\n.input {\n flex: 1 1 auto;\n min-width: 0;\n padding: var(--tempest-space-2) var(--tempest-space-3);\n border: 1px solid var(--tempest-border);\n border-radius: var(--tempest-radius-md);\n background: var(--tempest-bg);\n color: var(--tempest-text);\n font-family: inherit;\n font-size: var(--tempest-text-sm);\n min-height: 34px;\n}\n\n.input:focus-visible {\n outline: 2px solid var(--tempest-primary);\n outline-offset: 1px;\n}\n\n.input[aria-invalid=\"true\"] {\n border-color: var(--tempest-danger);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/icons/IconPicker.module.css
|
|
2
|
+
var e = "tempest_picker_TP94V", t = "tempest_preview_lo-Gg", n = "tempest_input_5dPK-", r = {
|
|
3
|
+
picker: e,
|
|
4
|
+
preview: t,
|
|
5
|
+
input: n
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { r as default, n as input, e as picker, t as preview };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=IconPicker.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconPicker.module.js","names":[],"sources":["../../src/icons/IconPicker.module.css"],"sourcesContent":[".picker {\n display: inline-flex;\n align-items: center;\n gap: var(--tempest-space-2);\n font-family: var(--tempest-font-sans);\n}\n\n.preview {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 34px;\n height: 34px;\n border: 1px solid var(--tempest-border);\n border-radius: var(--tempest-radius-md);\n background: var(--tempest-surface);\n color: var(--tempest-text);\n}\n\n.input {\n flex: 1 1 auto;\n min-width: 0;\n padding: var(--tempest-space-2) var(--tempest-space-3);\n border: 1px solid var(--tempest-border);\n border-radius: var(--tempest-radius-md);\n background: var(--tempest-bg);\n color: var(--tempest-text);\n font-family: inherit;\n font-size: var(--tempest-text-sm);\n min-height: 34px;\n}\n\n.input:focus-visible {\n outline: 2px solid var(--tempest-primary);\n outline-offset: 1px;\n}\n\n.input[aria-invalid=\"true\"] {\n border-color: var(--tempest-danger);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.cjs","names":[],"sources":["../../src/icons/alias.ts"],"sourcesContent":["import { iconAliases } from \"./generated/aliases\";\n\n/**\n * Map a slug to the canonical slug that owns the icon.\n *\n * Lucide keeps 257 deprecated aliases (`alert-circle` → `circle-alert`), and a\n * slug persisted in a database years ago is exactly the case this feature exists\n * for, so an alias must keep resolving after a lucide bump renames it. Resolution\n * happens before the shard lookup, since only canonical slugs are sharded.\n *\n * Its own module, not part of `shard-cache`: everything that merely *names* an\n * icon needs this — `normalizeIconName`, `validateIconName`, a form checking a\n * value before submit — and none of that needs the shard loader index. Sharing a\n * module made a validator that never renders anything drag in all 45 shard\n * modules.\n *\n * @param slug - Any icon slug, canonical or deprecated.\n * @returns The canonical slug.\n */\nexport function resolveIconAlias(slug: string): string {\n return iconAliases[slug] ?? slug;\n}\n"],"mappings":"2CAmBA,SAAgB,EAAiB,EAAsB,CACnD,OAAO,EAAA,YAAY,IAAS,CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","names":[],"sources":["../../src/icons/alias.ts"],"sourcesContent":["import { iconAliases } from \"./generated/aliases\";\n\n/**\n * Map a slug to the canonical slug that owns the icon.\n *\n * Lucide keeps 257 deprecated aliases (`alert-circle` → `circle-alert`), and a\n * slug persisted in a database years ago is exactly the case this feature exists\n * for, so an alias must keep resolving after a lucide bump renames it. Resolution\n * happens before the shard lookup, since only canonical slugs are sharded.\n *\n * Its own module, not part of `shard-cache`: everything that merely *names* an\n * icon needs this — `normalizeIconName`, `validateIconName`, a form checking a\n * value before submit — and none of that needs the shard loader index. Sharing a\n * module made a validator that never renders anything drag in all 45 shard\n * modules.\n *\n * @param slug - Any icon slug, canonical or deprecated.\n * @returns The canonical slug.\n */\nexport function resolveIconAlias(slug: string): string {\n return iconAliases[slug] ?? slug;\n}\n"],"mappings":";;AAmBA,SAAgB,EAAiB,GAAsB;CACnD,OAAO,EAAY,MAAS;AAChC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={a:()=>Promise.resolve().then(()=>require("./shard-
|
|
1
|
+
var e=[{id:`shard-00`,from:`a-arrow-down`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-00.cjs"))},{id:`shard-01`,from:`amphora`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-01.cjs"))},{id:`shard-02`,from:`arrow-right-left`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-02.cjs"))},{id:`shard-03`,from:`badge-pound-sterling`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-03.cjs"))},{id:`shard-04`,from:`bell-electric`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-04.cjs"))},{id:`shard-05`,from:`book-image`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-05.cjs"))},{id:`shard-06`,from:`briefcase-conveyor-belt`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-06.cjs"))},{id:`shard-07`,from:`calendar-x`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-07.cjs"))},{id:`shard-08`,from:`chart-line`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-08.cjs"))},{id:`shard-09`,from:`circle-alert`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-09.cjs"))},{id:`shard-10`,from:`circle-small`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-10.cjs"))},{id:`shard-11`,from:`clock-fading`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-11.cjs"))},{id:`shard-12`,from:`concierge-bell`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-12.cjs"))},{id:`shard-13`,from:`database-arrow-up`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-13.cjs"))},{id:`shard-14`,from:`download`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-14.cjs"))},{id:`shard-15`,from:`face-slightly-frowning`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-15.cjs"))},{id:`shard-16`,from:`file-pen`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-16.cjs"))},{id:`shard-17`,from:`flashlight-off`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-17.cjs"))},{id:`shard-18`,from:`folder-up`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-18.cjs"))},{id:`shard-19`,from:`git-pull-request-closed`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-19.cjs"))},{id:`shard-20`,from:`hard-drive-download`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-20.cjs"))},{id:`shard-21`,from:`ice-cream-bowl`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-21.cjs"))},{id:`shard-22`,from:`languages`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-22.cjs"))},{id:`shard-23`,from:`list-checks`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-23.cjs"))},{id:`shard-24`,from:`mail-minus`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-24.cjs"))},{id:`shard-25`,from:`message-circle-dashed`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-25.cjs"))},{id:`shard-26`,from:`minimize-2`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-26.cjs"))},{id:`shard-27`,from:`move-horizontal`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-27.cjs"))},{id:`shard-28`,from:`package-open`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-28.cjs"))},{id:`shard-29`,from:`pen`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-29.cjs"))},{id:`shard-30`,from:`play-off`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-30.cjs"))},{id:`shard-31`,from:`receipt-japanese-yen`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-31.cjs"))},{id:`shard-32`,from:`rotate-ccw-key`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-32.cjs"))},{id:`shard-33`,from:`scan-text`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-33.cjs"))},{id:`shard-34`,from:`shield-ellipsis`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-34.cjs"))},{id:`shard-35`,from:`smartphone`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-35.cjs"))},{id:`shard-36`,from:`square-arrow-up-right`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-36.cjs"))},{id:`shard-37`,from:`square-power`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-37.cjs"))},{id:`shard-38`,from:`sticky-note-x`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-38.cjs"))},{id:`shard-39`,from:`tally-3`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-39.cjs"))},{id:`shard-40`,from:`timer-reset`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-40.cjs"))},{id:`shard-41`,from:`tv-minimal`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-41.cjs"))},{id:`shard-42`,from:`user-x`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-42.cjs"))},{id:`shard-43`,from:`waves-ladder`,size:40,load:()=>Promise.resolve().then(()=>require("./shard-43.cjs"))},{id:`shard-44`,from:`zodiac-pisces`,size:7,load:()=>Promise.resolve().then(()=>require("./shard-44.cjs"))}];exports.iconShards=e;
|
|
2
2
|
//# sourceMappingURL=loaders.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.cjs","names":[],"sources":["../../../src/icons/generated/loaders.ts"],"sourcesContent":["// GENERATED by scripts/gen-icons.mjs — do not edit.\n// Run `npm run gen:icons` after bumping lucide-react.\n\nimport type { LucideIcon } from \"lucide-react\";\n\n
|
|
1
|
+
{"version":3,"file":"loaders.cjs","names":[],"sources":["../../../src/icons/generated/loaders.ts"],"sourcesContent":["// GENERATED by scripts/gen-icons.mjs — do not edit.\n// Run `npm run gen:icons` after bumping lucide-react.\n\nimport type { LucideIcon } from \"lucide-react\";\n\n/** One lazily fetched range of icons. */\nexport interface IconShard {\n /** The chunk's module id — what shows up in a bundle and in a 404. */\n id: string;\n /** First slug in the range, in sort order. Its lower bound. */\n from: string;\n /** How many icons the range holds. */\n size: number;\n /** The dynamic import for the chunk. */\n load: () => Promise<{ default: Record<string, LucideIcon> }>;\n}\n\n/**\n * Every shard, in slug order.\n *\n * These are the only references to the shard modules, which is what keeps them\n * out of whatever chunk imports `Icon`: a bundler that sees no static edge to a\n * shard emits it as an async chunk fetched on first use.\n *\n * Sorted by `from`, so the owning shard for a slug is a binary search over this\n * array — 45 comparisons' worth of index instead of the 2000-entry\n * slug→chunk map that makes lucide's own `dynamicIconImports` cost 120 KB in the\n * main chunk.\n */\nexport const iconShards: readonly IconShard[] = [\n { id: \"shard-00\", from: \"a-arrow-down\", size: 40, load: () => import(\"./shard-00\") },\n { id: \"shard-01\", from: \"amphora\", size: 40, load: () => import(\"./shard-01\") },\n { id: \"shard-02\", from: \"arrow-right-left\", size: 40, load: () => import(\"./shard-02\") },\n { id: \"shard-03\", from: \"badge-pound-sterling\", size: 40, load: () => import(\"./shard-03\") },\n { id: \"shard-04\", from: \"bell-electric\", size: 40, load: () => import(\"./shard-04\") },\n { id: \"shard-05\", from: \"book-image\", size: 40, load: () => import(\"./shard-05\") },\n { id: \"shard-06\", from: \"briefcase-conveyor-belt\", size: 40, load: () => import(\"./shard-06\") },\n { id: \"shard-07\", from: \"calendar-x\", size: 40, load: () => import(\"./shard-07\") },\n { id: \"shard-08\", from: \"chart-line\", size: 40, load: () => import(\"./shard-08\") },\n { id: \"shard-09\", from: \"circle-alert\", size: 40, load: () => import(\"./shard-09\") },\n { id: \"shard-10\", from: \"circle-small\", size: 40, load: () => import(\"./shard-10\") },\n { id: \"shard-11\", from: \"clock-fading\", size: 40, load: () => import(\"./shard-11\") },\n { id: \"shard-12\", from: \"concierge-bell\", size: 40, load: () => import(\"./shard-12\") },\n { id: \"shard-13\", from: \"database-arrow-up\", size: 40, load: () => import(\"./shard-13\") },\n { id: \"shard-14\", from: \"download\", size: 40, load: () => import(\"./shard-14\") },\n { id: \"shard-15\", from: \"face-slightly-frowning\", size: 40, load: () => import(\"./shard-15\") },\n { id: \"shard-16\", from: \"file-pen\", size: 40, load: () => import(\"./shard-16\") },\n { id: \"shard-17\", from: \"flashlight-off\", size: 40, load: () => import(\"./shard-17\") },\n { id: \"shard-18\", from: \"folder-up\", size: 40, load: () => import(\"./shard-18\") },\n { id: \"shard-19\", from: \"git-pull-request-closed\", size: 40, load: () => import(\"./shard-19\") },\n { id: \"shard-20\", from: \"hard-drive-download\", size: 40, load: () => import(\"./shard-20\") },\n { id: \"shard-21\", from: \"ice-cream-bowl\", size: 40, load: () => import(\"./shard-21\") },\n { id: \"shard-22\", from: \"languages\", size: 40, load: () => import(\"./shard-22\") },\n { id: \"shard-23\", from: \"list-checks\", size: 40, load: () => import(\"./shard-23\") },\n { id: \"shard-24\", from: \"mail-minus\", size: 40, load: () => import(\"./shard-24\") },\n { id: \"shard-25\", from: \"message-circle-dashed\", size: 40, load: () => import(\"./shard-25\") },\n { id: \"shard-26\", from: \"minimize-2\", size: 40, load: () => import(\"./shard-26\") },\n { id: \"shard-27\", from: \"move-horizontal\", size: 40, load: () => import(\"./shard-27\") },\n { id: \"shard-28\", from: \"package-open\", size: 40, load: () => import(\"./shard-28\") },\n { id: \"shard-29\", from: \"pen\", size: 40, load: () => import(\"./shard-29\") },\n { id: \"shard-30\", from: \"play-off\", size: 40, load: () => import(\"./shard-30\") },\n { id: \"shard-31\", from: \"receipt-japanese-yen\", size: 40, load: () => import(\"./shard-31\") },\n { id: \"shard-32\", from: \"rotate-ccw-key\", size: 40, load: () => import(\"./shard-32\") },\n { id: \"shard-33\", from: \"scan-text\", size: 40, load: () => import(\"./shard-33\") },\n { id: \"shard-34\", from: \"shield-ellipsis\", size: 40, load: () => import(\"./shard-34\") },\n { id: \"shard-35\", from: \"smartphone\", size: 40, load: () => import(\"./shard-35\") },\n { id: \"shard-36\", from: \"square-arrow-up-right\", size: 40, load: () => import(\"./shard-36\") },\n { id: \"shard-37\", from: \"square-power\", size: 40, load: () => import(\"./shard-37\") },\n { id: \"shard-38\", from: \"sticky-note-x\", size: 40, load: () => import(\"./shard-38\") },\n { id: \"shard-39\", from: \"tally-3\", size: 40, load: () => import(\"./shard-39\") },\n { id: \"shard-40\", from: \"timer-reset\", size: 40, load: () => import(\"./shard-40\") },\n { id: \"shard-41\", from: \"tv-minimal\", size: 40, load: () => import(\"./shard-41\") },\n { id: \"shard-42\", from: \"user-x\", size: 40, load: () => import(\"./shard-42\") },\n { id: \"shard-43\", from: \"waves-ladder\", size: 40, load: () => import(\"./shard-43\") },\n { id: \"shard-44\", from: \"zodiac-pisces\", size: 7, load: () => import(\"./shard-44\") },\n];\n"],"mappings":"AA6BA,IAAa,EAAmC,CAC5C,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,UAAW,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC9E,CAAE,GAAI,WAAY,KAAM,mBAAoB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACvF,CAAE,GAAI,WAAY,KAAM,uBAAwB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC3F,CAAE,GAAI,WAAY,KAAM,gBAAiB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACpF,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,0BAA2B,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC9F,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,iBAAkB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACrF,CAAE,GAAI,WAAY,KAAM,oBAAqB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACxF,CAAE,GAAI,WAAY,KAAM,WAAY,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC/E,CAAE,GAAI,WAAY,KAAM,yBAA0B,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC7F,CAAE,GAAI,WAAY,KAAM,WAAY,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC/E,CAAE,GAAI,WAAY,KAAM,iBAAkB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACrF,CAAE,GAAI,WAAY,KAAM,YAAa,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAChF,CAAE,GAAI,WAAY,KAAM,0BAA2B,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC9F,CAAE,GAAI,WAAY,KAAM,sBAAuB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC1F,CAAE,GAAI,WAAY,KAAM,iBAAkB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACrF,CAAE,GAAI,WAAY,KAAM,YAAa,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAChF,CAAE,GAAI,WAAY,KAAM,cAAe,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAClF,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,wBAAyB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC5F,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,kBAAmB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACtF,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,MAAO,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC1E,CAAE,GAAI,WAAY,KAAM,WAAY,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC/E,CAAE,GAAI,WAAY,KAAM,uBAAwB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC3F,CAAE,GAAI,WAAY,KAAM,iBAAkB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACrF,CAAE,GAAI,WAAY,KAAM,YAAa,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAChF,CAAE,GAAI,WAAY,KAAM,kBAAmB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACtF,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,wBAAyB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC5F,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,gBAAiB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACpF,CAAE,GAAI,WAAY,KAAM,UAAW,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC9E,CAAE,GAAI,WAAY,KAAM,cAAe,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAClF,CAAE,GAAI,WAAY,KAAM,aAAc,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACjF,CAAE,GAAI,WAAY,KAAM,SAAU,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EAC7E,CAAE,GAAI,WAAY,KAAM,eAAgB,KAAM,GAAI,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,EACnF,CAAE,GAAI,WAAY,KAAM,gBAAiB,KAAM,EAAG,SAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAY,gBAAA,CAAA,CAAqB,CACvF"}
|