@omnitron-dev/prism 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/accessibility/index.d.ts +7 -151
- package/dist/accessibility/index.d.ts.map +1 -0
- package/dist/accessibility/index.js +0 -1
- package/dist/accessibility/index.js.map +1 -1
- package/dist/accessibility/vision-mode.d.ts +154 -0
- package/dist/accessibility/vision-mode.d.ts.map +1 -0
- package/dist/blocks/auth-block/auth-block.d.ts +107 -0
- package/dist/blocks/auth-block/auth-block.d.ts.map +1 -0
- package/dist/blocks/auth-block/guards.d.ts +262 -0
- package/dist/blocks/auth-block/guards.d.ts.map +1 -0
- package/dist/blocks/auth-block/index.d.ts +13 -0
- package/dist/blocks/auth-block/index.d.ts.map +1 -0
- package/dist/blocks/auth-block/types.d.ts +232 -0
- package/dist/blocks/auth-block/types.d.ts.map +1 -0
- package/dist/blocks/dashboard-block/dashboard-block.d.ts +53 -0
- package/dist/blocks/dashboard-block/dashboard-block.d.ts.map +1 -0
- package/dist/blocks/dashboard-block/index.d.ts +12 -0
- package/dist/blocks/dashboard-block/index.d.ts.map +1 -0
- package/dist/blocks/dashboard-block/types.d.ts +182 -0
- package/dist/blocks/dashboard-block/types.d.ts.map +1 -0
- package/dist/blocks/dashboard-block/use-dashboard-block.d.ts +95 -0
- package/dist/blocks/dashboard-block/use-dashboard-block.d.ts.map +1 -0
- package/dist/blocks/data-grid-block/data-grid-block.d.ts +81 -0
- package/dist/blocks/data-grid-block/data-grid-block.d.ts.map +1 -0
- package/dist/blocks/data-grid-block/index.d.ts +11 -0
- package/dist/blocks/data-grid-block/index.d.ts.map +1 -0
- package/dist/blocks/data-grid-block/types.d.ts +304 -0
- package/dist/blocks/data-grid-block/types.d.ts.map +1 -0
- package/dist/blocks/index.d.ts +10 -1235
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +141 -42
- package/dist/blocks/index.js.map +1 -1
- package/dist/{chunk-IZOIO7PA.js → chunk-472SOF76.js} +31 -22
- package/dist/chunk-472SOF76.js.map +1 -0
- package/dist/chunk-4Z5DE5GK.js +1579 -0
- package/dist/chunk-4Z5DE5GK.js.map +1 -0
- package/dist/chunk-52PQL67Q.js +559 -0
- package/dist/chunk-52PQL67Q.js.map +1 -0
- package/dist/chunk-75FQ5IW3.js +590 -0
- package/dist/chunk-75FQ5IW3.js.map +1 -0
- package/dist/{chunk-VAAIHNWQ.js → chunk-7G5D5PTC.js} +4 -3
- package/dist/chunk-7G5D5PTC.js.map +1 -0
- package/dist/{chunk-JDTC2SBY.js → chunk-AD4W7HYC.js} +2 -2
- package/dist/chunk-AD4W7HYC.js.map +1 -0
- package/dist/{chunk-SNKGGHBT.js → chunk-ADG4HZEP.js} +3 -3
- package/dist/chunk-ADG4HZEP.js.map +1 -0
- package/dist/{chunk-JNU4QHJK.js → chunk-AYYFMTMI.js} +5 -4
- package/dist/{chunk-JNU4QHJK.js.map → chunk-AYYFMTMI.js.map} +1 -1
- package/dist/chunk-BJE2AKD4.js +105 -0
- package/dist/chunk-BJE2AKD4.js.map +1 -0
- package/dist/{chunk-HO2GKTWJ.js → chunk-BRDWQVRT.js} +2 -2
- package/dist/chunk-BRDWQVRT.js.map +1 -0
- package/dist/{chunk-2FYNRDXR.js → chunk-DRFNMZLG.js} +2 -2
- package/dist/chunk-DRFNMZLG.js.map +1 -0
- package/dist/chunk-FF5RF32O.js +248 -0
- package/dist/chunk-FF5RF32O.js.map +1 -0
- package/dist/{chunk-KTCWPGON.js → chunk-GMIE6III.js} +561 -111
- package/dist/chunk-GMIE6III.js.map +1 -0
- package/dist/{chunk-BV32OJ2A.js → chunk-GUFHFEPZ.js} +2 -2
- package/dist/chunk-GUFHFEPZ.js.map +1 -0
- package/dist/chunk-GUGTDURV.js +826 -0
- package/dist/chunk-GUGTDURV.js.map +1 -0
- package/dist/chunk-HOXFSQUV.js +573 -0
- package/dist/chunk-HOXFSQUV.js.map +1 -0
- package/dist/chunk-JSQTYDPG.js +3 -0
- package/dist/{chunk-77KIJLPP.js.map → chunk-JSQTYDPG.js.map} +1 -1
- package/dist/{chunk-MEFT6XPH.js → chunk-KQ67XB6T.js} +351 -704
- package/dist/chunk-KQ67XB6T.js.map +1 -0
- package/dist/{chunk-YJMAQL3S.js → chunk-LOY2NPCO.js} +129 -635
- package/dist/chunk-LOY2NPCO.js.map +1 -0
- package/dist/{chunk-A2Z7NVGL.js → chunk-LSPFFEJT.js} +1026 -2128
- package/dist/chunk-LSPFFEJT.js.map +1 -0
- package/dist/{chunk-XXP3ZGU6.js → chunk-OKTLA23Q.js} +22 -14
- package/dist/chunk-OKTLA23Q.js.map +1 -0
- package/dist/chunk-PFT2BNYO.js +191 -0
- package/dist/chunk-PFT2BNYO.js.map +1 -0
- package/dist/chunk-PGHEP4JD.js +106 -0
- package/dist/chunk-PGHEP4JD.js.map +1 -0
- package/dist/chunk-PXXPLHIY.js +74 -0
- package/dist/chunk-PXXPLHIY.js.map +1 -0
- package/dist/chunk-SNZK5X6F.js +594 -0
- package/dist/chunk-SNZK5X6F.js.map +1 -0
- package/dist/chunk-SU3LVQ7N.js +518 -0
- package/dist/chunk-SU3LVQ7N.js.map +1 -0
- package/dist/{chunk-DDY7TLUI.js → chunk-XIXSSI3B.js} +28 -2
- package/dist/chunk-XIXSSI3B.js.map +1 -0
- package/dist/chunk-YHE7HXSG.js +206 -0
- package/dist/chunk-YHE7HXSG.js.map +1 -0
- package/dist/{chunk-XWL6J6IO.js → chunk-YSIG2XYH.js} +2 -2
- package/dist/chunk-YSIG2XYH.js.map +1 -0
- package/dist/cli/commands/add.d.ts +22 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/diff.d.ts +13 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/doctor.d.ts +13 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +13 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/list.d.ts +13 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/remove.d.ts +13 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/update.d.ts +13 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/config.d.ts +73 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/constants.d.ts +60 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/index.d.ts +27 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +38 -39
- package/dist/cli/index.js.map +1 -1
- package/dist/components/accordion/accordion.d.ts +149 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/index.d.ts +7 -0
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/admin-filters/admin-data-table.d.ts +185 -0
- package/dist/components/admin-filters/admin-data-table.d.ts.map +1 -0
- package/dist/components/admin-filters/amount-cell.d.ts +39 -0
- package/dist/components/admin-filters/amount-cell.d.ts.map +1 -0
- package/dist/components/admin-filters/filter-toolbar.d.ts +99 -0
- package/dist/components/admin-filters/filter-toolbar.d.ts.map +1 -0
- package/dist/components/admin-filters/index.d.ts +13 -0
- package/dist/components/admin-filters/index.d.ts.map +1 -0
- package/dist/components/admin-filters/status-chip.d.ts +55 -0
- package/dist/components/admin-filters/status-chip.d.ts.map +1 -0
- package/dist/components/alert/alert.d.ts +159 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/index.d.ts +7 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/animate/animate-border.d.ts +33 -0
- package/dist/components/animate/animate-border.d.ts.map +1 -0
- package/dist/components/animate/index.d.ts +3 -0
- package/dist/components/animate/index.d.ts.map +1 -0
- package/dist/components/animate/motion-lazy.d.ts +5 -0
- package/dist/components/animate/motion-lazy.d.ts.map +1 -0
- package/dist/components/avatar/avatar.d.ts +78 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -0
- package/dist/components/avatar/index.d.ts +7 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/badge/badge.d.ts +102 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/index.d.ts +7 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +100 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +7 -0
- package/dist/components/breadcrumbs/index.d.ts.map +1 -0
- package/dist/components/card/card.d.ts +127 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/index.d.ts +7 -0
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/components/carousel/carousel.d.ts +35 -0
- package/dist/components/carousel/carousel.d.ts.map +1 -0
- package/dist/components/carousel/classes.d.ts +35 -0
- package/dist/components/carousel/classes.d.ts.map +1 -0
- package/dist/components/carousel/index.d.ts +10 -0
- package/dist/components/carousel/index.d.ts.map +1 -0
- package/dist/components/carousel/types.d.ts +167 -0
- package/dist/components/carousel/types.d.ts.map +1 -0
- package/dist/components/carousel/use-carousel.d.ts +51 -0
- package/dist/components/carousel/use-carousel.d.ts.map +1 -0
- package/dist/components/changelog/changelog-entry.d.ts +10 -0
- package/dist/components/changelog/changelog-entry.d.ts.map +1 -0
- package/dist/components/changelog/changelog-timeline.d.ts +9 -0
- package/dist/components/changelog/changelog-timeline.d.ts.map +1 -0
- package/dist/components/changelog/index.d.ts +3 -0
- package/dist/components/changelog/index.d.ts.map +1 -0
- package/dist/components/chart/chart.d.ts +39 -0
- package/dist/components/chart/chart.d.ts.map +1 -0
- package/dist/components/chart/classes.d.ts +24 -0
- package/dist/components/chart/classes.d.ts.map +1 -0
- package/dist/components/chart/components/chart-legends.d.ts +24 -0
- package/dist/components/chart/components/chart-legends.d.ts.map +1 -0
- package/dist/components/chart/components/chart-loading.d.ts +21 -0
- package/dist/components/chart/components/chart-loading.d.ts.map +1 -0
- package/dist/components/chart/components/index.d.ts +8 -0
- package/dist/components/chart/components/index.d.ts.map +1 -0
- package/dist/components/chart/index.d.ts +14 -0
- package/dist/components/chart/index.d.ts.map +1 -0
- package/dist/components/chart/types.d.ts +264 -0
- package/dist/components/chart/types.d.ts.map +1 -0
- package/dist/components/chart/use-chart.d.ts +34 -0
- package/dist/components/chart/use-chart.d.ts.map +1 -0
- package/dist/components/command-palette/command-palette.d.ts +73 -0
- package/dist/components/command-palette/command-palette.d.ts.map +1 -0
- package/dist/components/command-palette/index.d.ts +7 -0
- package/dist/components/command-palette/index.d.ts.map +1 -0
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +89 -0
- package/dist/components/confirm-dialog/confirm-dialog.d.ts.map +1 -0
- package/dist/components/confirm-dialog/index.d.ts +7 -0
- package/dist/components/confirm-dialog/index.d.ts.map +1 -0
- package/dist/components/content-renderer/classes.d.ts +33 -0
- package/dist/components/content-renderer/classes.d.ts.map +1 -0
- package/dist/components/content-renderer/content-renderer.d.ts +37 -0
- package/dist/components/content-renderer/content-renderer.d.ts.map +1 -0
- package/dist/components/content-renderer/html-tags.d.ts +6 -0
- package/dist/components/content-renderer/html-tags.d.ts.map +1 -0
- package/dist/components/content-renderer/html-to-markdown.d.ts +7 -0
- package/dist/components/content-renderer/html-to-markdown.d.ts.map +1 -0
- package/dist/components/content-renderer/index.d.ts +7 -0
- package/dist/components/content-renderer/index.d.ts.map +1 -0
- package/dist/components/content-renderer/markdown.d.ts +23 -0
- package/dist/components/content-renderer/markdown.d.ts.map +1 -0
- package/dist/components/content-renderer/remark-spoiler.d.ts +9 -0
- package/dist/components/content-renderer/remark-spoiler.d.ts.map +1 -0
- package/dist/components/content-renderer/styles.d.ts +2 -0
- package/dist/components/content-renderer/styles.d.ts.map +1 -0
- package/dist/components/country-select/country-select.d.ts +101 -0
- package/dist/components/country-select/country-select.d.ts.map +1 -0
- package/dist/components/country-select/flag-icon.d.ts +36 -0
- package/dist/components/country-select/flag-icon.d.ts.map +1 -0
- package/dist/components/country-select/index.d.ts +5 -0
- package/dist/components/country-select/index.d.ts.map +1 -0
- package/dist/components/date-input/date-input.d.ts +27 -0
- package/dist/components/date-input/date-input.d.ts.map +1 -0
- package/dist/components/date-input/index.d.ts +4 -0
- package/dist/components/date-input/index.d.ts.map +1 -0
- package/dist/components/date-input/value.d.ts +9 -0
- package/dist/components/date-input/value.d.ts.map +1 -0
- package/dist/components/date-range-picker/date-range-input.d.ts +48 -0
- package/dist/components/date-range-picker/date-range-input.d.ts.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +39 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +7 -0
- package/dist/components/date-range-picker/index.d.ts.map +1 -0
- package/dist/components/date-range-picker/use-date-range-picker.d.ts +28 -0
- package/dist/components/date-range-picker/use-date-range-picker.d.ts.map +1 -0
- package/dist/components/deadline-chip/deadline-chip.d.ts +41 -0
- package/dist/components/deadline-chip/deadline-chip.d.ts.map +1 -0
- package/dist/components/deadline-chip/index.d.ts +7 -0
- package/dist/components/deadline-chip/index.d.ts.map +1 -0
- package/dist/components/doc-layout/doc-layout.d.ts +17 -0
- package/dist/components/doc-layout/doc-layout.d.ts.map +1 -0
- package/dist/components/doc-layout/doc-section-nav.d.ts +16 -0
- package/dist/components/doc-layout/doc-section-nav.d.ts.map +1 -0
- package/dist/components/doc-layout/doc-sidebar.d.ts +18 -0
- package/dist/components/doc-layout/doc-sidebar.d.ts.map +1 -0
- package/dist/components/doc-layout/index.d.ts +4 -0
- package/dist/components/doc-layout/index.d.ts.map +1 -0
- package/dist/components/doc-layout/index.js +6 -0
- package/dist/components/doc-layout/index.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +65 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/index.d.ts +7 -0
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/duration-picker/duration-picker.d.ts +24 -0
- package/dist/components/duration-picker/duration-picker.d.ts.map +1 -0
- package/dist/components/duration-picker/index.d.ts +2 -0
- package/dist/components/duration-picker/index.d.ts.map +1 -0
- package/dist/components/editor/classes.d.ts +52 -0
- package/dist/components/editor/classes.d.ts.map +1 -0
- package/dist/components/editor/editor.d.ts +15 -0
- package/dist/components/editor/editor.d.ts.map +1 -0
- package/dist/components/editor/extensions/clear-format.d.ts +3 -0
- package/dist/components/editor/extensions/clear-format.d.ts.map +1 -0
- package/dist/components/editor/extensions/index.d.ts +3 -0
- package/dist/components/editor/extensions/index.d.ts.map +1 -0
- package/dist/components/editor/extensions/text-transform.d.ts +20 -0
- package/dist/components/editor/extensions/text-transform.d.ts.map +1 -0
- package/dist/components/editor/icons/index.d.ts +34 -0
- package/dist/components/editor/icons/index.d.ts.map +1 -0
- package/dist/components/editor/index.d.ts +41 -104
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +3 -2
- package/dist/components/editor/presets.d.ts +3 -0
- package/dist/components/editor/presets.d.ts.map +1 -0
- package/dist/components/editor/styles.d.ts +2 -0
- package/dist/components/editor/styles.d.ts.map +1 -0
- package/dist/components/editor/toolbar/bubble-toolbar.d.ts +9 -0
- package/dist/components/editor/toolbar/bubble-toolbar.d.ts.map +1 -0
- package/dist/components/editor/toolbar/code-highlight-block.d.ts +3 -0
- package/dist/components/editor/toolbar/code-highlight-block.d.ts.map +1 -0
- package/dist/components/editor/toolbar/heading-block.d.ts +11 -0
- package/dist/components/editor/toolbar/heading-block.d.ts.map +1 -0
- package/dist/components/editor/toolbar/image-block.d.ts +11 -0
- package/dist/components/editor/toolbar/image-block.d.ts.map +1 -0
- package/dist/components/editor/toolbar/link-block.d.ts +13 -0
- package/dist/components/editor/toolbar/link-block.d.ts.map +1 -0
- package/dist/components/editor/toolbar/toolbar-item.d.ts +3 -0
- package/dist/components/editor/toolbar/toolbar-item.d.ts.map +1 -0
- package/dist/components/editor/toolbar/toolbar.d.ts +3 -0
- package/dist/components/editor/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/editor/toolbar/use-toolbar-state.d.ts +24 -0
- package/dist/components/editor/toolbar/use-toolbar-state.d.ts.map +1 -0
- package/dist/components/editor/types.d.ts +130 -0
- package/dist/components/editor/types.d.ts.map +1 -0
- package/dist/components/emoji-picker/emoji-picker.d.ts +24 -0
- package/dist/components/emoji-picker/emoji-picker.d.ts.map +1 -0
- package/dist/components/emoji-picker/emoji-search.d.ts +22 -0
- package/dist/components/emoji-picker/emoji-search.d.ts.map +1 -0
- package/dist/components/emoji-picker/emoji.d.ts +19 -0
- package/dist/components/emoji-picker/emoji.d.ts.map +1 -0
- package/dist/components/emoji-picker/index.d.ts +14 -0
- package/dist/components/emoji-picker/index.d.ts.map +1 -0
- package/dist/components/emoji-picker/index.js +3 -0
- package/dist/components/emoji-picker/index.js.map +1 -0
- package/dist/components/emoji-picker/twemoji-url.d.ts +26 -0
- package/dist/components/emoji-picker/twemoji-url.d.ts.map +1 -0
- package/dist/components/emoji-picker/types.d.ts +96 -0
- package/dist/components/emoji-picker/types.d.ts.map +1 -0
- package/dist/components/emoji-picker/use-emoji-data.d.ts +26 -0
- package/dist/components/emoji-picker/use-emoji-data.d.ts.map +1 -0
- package/dist/components/emoji-picker/use-recent-emojis.d.ts +16 -0
- package/dist/components/emoji-picker/use-recent-emojis.d.ts.map +1 -0
- package/dist/components/empty-content/empty-content.d.ts +92 -0
- package/dist/components/empty-content/empty-content.d.ts.map +1 -0
- package/dist/components/empty-content/index.d.ts +7 -0
- package/dist/components/empty-content/index.d.ts.map +1 -0
- package/dist/components/error-boundary/error-boundary.d.ts +162 -0
- package/dist/components/error-boundary/error-boundary.d.ts.map +1 -0
- package/dist/components/error-boundary/index.d.ts +7 -0
- package/dist/components/error-boundary/index.d.ts.map +1 -0
- package/dist/components/field/field-autocomplete.d.ts +74 -0
- package/dist/components/field/field-autocomplete.d.ts.map +1 -0
- package/dist/components/field/field-checkbox.d.ts +42 -0
- package/dist/components/field/field-checkbox.d.ts.map +1 -0
- package/dist/components/field/field-code.d.ts +80 -0
- package/dist/components/field/field-code.d.ts.map +1 -0
- package/dist/components/field/field-country-select.d.ts +84 -0
- package/dist/components/field/field-country-select.d.ts.map +1 -0
- package/dist/components/field/field-date-picker.d.ts +58 -0
- package/dist/components/field/field-date-picker.d.ts.map +1 -0
- package/dist/components/field/field-datetime-picker.d.ts +96 -0
- package/dist/components/field/field-datetime-picker.d.ts.map +1 -0
- package/dist/components/field/field-editor.d.ts +218 -0
- package/dist/components/field/field-editor.d.ts.map +1 -0
- package/dist/components/field/field-multi-checkbox.d.ts +91 -0
- package/dist/components/field/field-multi-checkbox.d.ts.map +1 -0
- package/dist/components/field/field-multi-select.d.ts +85 -0
- package/dist/components/field/field-multi-select.d.ts.map +1 -0
- package/dist/components/field/field-multi-switch.d.ts +93 -0
- package/dist/components/field/field-multi-switch.d.ts.map +1 -0
- package/dist/components/field/field-number.d.ts +50 -0
- package/dist/components/field/field-number.d.ts.map +1 -0
- package/dist/components/field/field-phone.d.ts +82 -0
- package/dist/components/field/field-phone.d.ts.map +1 -0
- package/dist/components/field/field-radio.d.ts +64 -0
- package/dist/components/field/field-radio.d.ts.map +1 -0
- package/dist/components/field/field-rating.d.ts +43 -0
- package/dist/components/field/field-rating.d.ts.map +1 -0
- package/dist/components/field/field-select.d.ts +50 -0
- package/dist/components/field/field-select.d.ts.map +1 -0
- package/dist/components/field/field-slider.d.ts +56 -0
- package/dist/components/field/field-slider.d.ts.map +1 -0
- package/dist/components/field/field-switch.d.ts +44 -0
- package/dist/components/field/field-switch.d.ts.map +1 -0
- package/dist/components/field/field-text.d.ts +38 -0
- package/dist/components/field/field-text.d.ts.map +1 -0
- package/dist/components/field/field-time-picker.d.ts +79 -0
- package/dist/components/field/field-time-picker.d.ts.map +1 -0
- package/dist/components/field/field-upload.d.ts +120 -0
- package/dist/components/field/field-upload.d.ts.map +1 -0
- package/dist/components/field/index.d.ts +149 -0
- package/dist/components/field/index.d.ts.map +1 -0
- package/dist/components/image/image.d.ts +79 -0
- package/dist/components/image/image.d.ts.map +1 -0
- package/dist/components/image/index.d.ts +7 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/index.css +4 -0
- package/dist/components/index.css.map +1 -1
- package/dist/components/index.d.ts +60 -7072
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +21 -11
- package/dist/components/knowledge-graph/edge-labels.d.ts +14 -0
- package/dist/components/knowledge-graph/edge-labels.d.ts.map +1 -0
- package/dist/components/knowledge-graph/graph.d.ts +56 -0
- package/dist/components/knowledge-graph/graph.d.ts.map +1 -0
- package/dist/components/knowledge-graph/index.css +176 -0
- package/dist/components/knowledge-graph/index.css.map +1 -0
- package/dist/components/knowledge-graph/index.d.ts +3 -0
- package/dist/components/knowledge-graph/index.d.ts.map +1 -0
- package/dist/components/knowledge-graph/index.js +795 -0
- package/dist/components/knowledge-graph/index.js.map +1 -0
- package/dist/components/knowledge-graph/label-layout.d.ts +28 -0
- package/dist/components/knowledge-graph/label-layout.d.ts.map +1 -0
- package/dist/components/knowledge-graph/label-store.d.ts +15 -0
- package/dist/components/knowledge-graph/label-store.d.ts.map +1 -0
- package/dist/components/knowledge-graph/model.d.ts +92 -0
- package/dist/components/knowledge-graph/model.d.ts.map +1 -0
- package/dist/components/label/index.d.ts +7 -0
- package/dist/components/label/index.d.ts.map +1 -0
- package/dist/components/label/label.d.ts +71 -0
- package/dist/components/label/label.d.ts.map +1 -0
- package/dist/components/lightbox/classes.d.ts +34 -0
- package/dist/components/lightbox/classes.d.ts.map +1 -0
- package/dist/components/lightbox/index.d.ts +11 -0
- package/dist/components/lightbox/index.d.ts.map +1 -0
- package/dist/components/lightbox/lightbox.d.ts +42 -0
- package/dist/components/lightbox/lightbox.d.ts.map +1 -0
- package/dist/components/lightbox/types.d.ts +233 -0
- package/dist/components/lightbox/types.d.ts.map +1 -0
- package/dist/components/lightbox/use-lightbox.d.ts +42 -0
- package/dist/components/lightbox/use-lightbox.d.ts.map +1 -0
- package/dist/components/loading-screen/index.d.ts +8 -0
- package/dist/components/loading-screen/index.d.ts.map +1 -0
- package/dist/components/loading-screen/loading-screen.d.ts +37 -0
- package/dist/components/loading-screen/loading-screen.d.ts.map +1 -0
- package/dist/components/loading-screen/splash-screen.d.ts +80 -0
- package/dist/components/loading-screen/splash-screen.d.ts.map +1 -0
- package/dist/components/map/Map.d.ts +39 -0
- package/dist/components/map/Map.d.ts.map +1 -0
- package/dist/components/map/MapCoverageLayer.d.ts +25 -0
- package/dist/components/map/MapCoverageLayer.d.ts.map +1 -0
- package/dist/components/map/MapMarker.d.ts +17 -0
- package/dist/components/map/MapMarker.d.ts.map +1 -0
- package/dist/components/map/MapPlaceSearch.d.ts +33 -0
- package/dist/components/map/MapPlaceSearch.d.ts.map +1 -0
- package/dist/components/map/MapPointPicker.d.ts +35 -0
- package/dist/components/map/MapPointPicker.d.ts.map +1 -0
- package/dist/components/map/coordinates.d.ts +10 -0
- package/dist/components/map/coordinates.d.ts.map +1 -0
- package/dist/components/map/index.css +4 -0
- package/dist/components/map/index.css.map +1 -0
- package/dist/components/map/index.d.ts +19 -0
- package/dist/components/map/index.d.ts.map +1 -0
- package/dist/components/map/index.js +3 -0
- package/dist/components/map/index.js.map +1 -0
- package/dist/components/mega-menu/index.d.ts +12 -0
- package/dist/components/mega-menu/index.d.ts.map +1 -0
- package/dist/components/mega-menu/mega-menu-horizontal.d.ts +41 -0
- package/dist/components/mega-menu/mega-menu-horizontal.d.ts.map +1 -0
- package/dist/components/mega-menu/mega-menu-mobile.d.ts +28 -0
- package/dist/components/mega-menu/mega-menu-mobile.d.ts.map +1 -0
- package/dist/components/mega-menu/mega-menu-vertical.d.ts +28 -0
- package/dist/components/mega-menu/mega-menu-vertical.d.ts.map +1 -0
- package/dist/components/mega-menu/styles.d.ts +18 -0
- package/dist/components/mega-menu/styles.d.ts.map +1 -0
- package/dist/components/mega-menu/types.d.ts +200 -0
- package/dist/components/mega-menu/types.d.ts.map +1 -0
- package/dist/components/menu/index.d.ts +7 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/menu.d.ts +144 -0
- package/dist/components/menu/menu.d.ts.map +1 -0
- package/dist/components/nav-card/index.d.ts +8 -0
- package/dist/components/nav-card/index.d.ts.map +1 -0
- package/dist/components/nav-card/nav-card-grid.d.ts +57 -0
- package/dist/components/nav-card/nav-card-grid.d.ts.map +1 -0
- package/dist/components/nav-card/nav-card.d.ts +69 -0
- package/dist/components/nav-card/nav-card.d.ts.map +1 -0
- package/dist/components/nav-section/components.d.ts +143 -0
- package/dist/components/nav-section/components.d.ts.map +1 -0
- package/dist/components/nav-section/index.d.ts +15 -0
- package/dist/components/nav-section/index.d.ts.map +1 -0
- package/dist/components/nav-section/nav-context.d.ts +80 -0
- package/dist/components/nav-section/nav-context.d.ts.map +1 -0
- package/dist/components/nav-section/nav-item.d.ts +20 -0
- package/dist/components/nav-section/nav-item.d.ts.map +1 -0
- package/dist/components/nav-section/nav-list.d.ts +25 -0
- package/dist/components/nav-section/nav-list.d.ts.map +1 -0
- package/dist/components/nav-section/nav-section-horizontal.d.ts +29 -0
- package/dist/components/nav-section/nav-section-horizontal.d.ts.map +1 -0
- package/dist/components/nav-section/nav-section-mini.d.ts +30 -0
- package/dist/components/nav-section/nav-section-mini.d.ts.map +1 -0
- package/dist/components/nav-section/nav-section-vertical.d.ts +37 -0
- package/dist/components/nav-section/nav-section-vertical.d.ts.map +1 -0
- package/dist/components/nav-section/styles.d.ts +35 -0
- package/dist/components/nav-section/styles.d.ts.map +1 -0
- package/dist/components/nav-section/types.d.ts +178 -0
- package/dist/components/nav-section/types.d.ts.map +1 -0
- package/dist/components/navigation-progress/index.d.ts +7 -0
- package/dist/components/navigation-progress/index.d.ts.map +1 -0
- package/dist/components/navigation-progress/navigation-progress.d.ts +36 -0
- package/dist/components/navigation-progress/navigation-progress.d.ts.map +1 -0
- package/dist/components/page-content/index.d.ts +7 -0
- package/dist/components/page-content/index.d.ts.map +1 -0
- package/dist/components/page-content/page-content.d.ts +55 -0
- package/dist/components/page-content/page-content.d.ts.map +1 -0
- package/dist/components/popover/index.d.ts +7 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/{popover-Dmw7SJLR.d.ts → components/popover/popover.d.ts} +11 -14
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/progress/countdown-ring.d.ts +60 -0
- package/dist/components/progress/countdown-ring.d.ts.map +1 -0
- package/dist/components/progress/index.d.ts +8 -0
- package/dist/components/progress/index.d.ts.map +1 -0
- package/dist/components/progress/progress.d.ts +106 -0
- package/dist/components/progress/progress.d.ts.map +1 -0
- package/dist/components/rail/index.d.ts +7 -0
- package/dist/components/rail/index.d.ts.map +1 -0
- package/dist/components/rail/rail.d.ts +39 -0
- package/dist/components/rail/rail.d.ts.map +1 -0
- package/dist/components/research/diagram-image.d.ts +11 -0
- package/dist/components/research/diagram-image.d.ts.map +1 -0
- package/dist/components/research/diagram.d.ts +8 -0
- package/dist/components/research/diagram.d.ts.map +1 -0
- package/dist/components/research/document.d.ts +33 -0
- package/dist/components/research/document.d.ts.map +1 -0
- package/dist/components/research/frontmatter.d.ts +15 -0
- package/dist/components/research/frontmatter.d.ts.map +1 -0
- package/dist/components/research/index.css +51 -0
- package/dist/components/research/index.css.map +1 -0
- package/dist/components/research/index.d.ts +3 -0
- package/dist/components/research/index.d.ts.map +1 -0
- package/dist/components/research/index.js +6 -0
- package/dist/components/research/index.js.map +1 -0
- package/dist/components/research/parse.d.ts +29 -0
- package/dist/components/research/parse.d.ts.map +1 -0
- package/dist/components/research-editor/block-commands.d.ts +20 -0
- package/dist/components/research-editor/block-commands.d.ts.map +1 -0
- package/dist/components/research-editor/block-controls.d.ts +13 -0
- package/dist/components/research-editor/block-controls.d.ts.map +1 -0
- package/dist/components/research-editor/editor.d.ts +75 -0
- package/dist/components/research-editor/editor.d.ts.map +1 -0
- package/dist/components/research-editor/extensions.d.ts +14 -0
- package/dist/components/research-editor/extensions.d.ts.map +1 -0
- package/dist/components/research-editor/index.css +332 -0
- package/dist/components/research-editor/index.css.map +1 -0
- package/dist/components/research-editor/index.d.ts +5 -0
- package/dist/components/research-editor/index.d.ts.map +1 -0
- package/dist/components/research-editor/index.js +1592 -0
- package/dist/components/research-editor/index.js.map +1 -0
- package/dist/components/research-editor/math-input.d.ts +32 -0
- package/dist/components/research-editor/math-input.d.ts.map +1 -0
- package/dist/components/research-editor/math-markup.d.ts +4 -0
- package/dist/components/research-editor/math-markup.d.ts.map +1 -0
- package/dist/components/research-editor/math-navigation.d.ts +6 -0
- package/dist/components/research-editor/math-navigation.d.ts.map +1 -0
- package/dist/components/research-editor/math-node.d.ts +11 -0
- package/dist/components/research-editor/math-node.d.ts.map +1 -0
- package/dist/components/research-editor/source.d.ts +19 -0
- package/dist/components/research-editor/source.d.ts.map +1 -0
- package/dist/components/scroll-spy/index.d.ts +3 -0
- package/dist/components/scroll-spy/index.d.ts.map +1 -0
- package/dist/components/scroll-spy/scroll-spy-provider.d.ts +26 -0
- package/dist/components/scroll-spy/scroll-spy-provider.d.ts.map +1 -0
- package/dist/components/scroll-spy/scroll-spy-section.d.ts +10 -0
- package/dist/components/scroll-spy/scroll-spy-section.d.ts.map +1 -0
- package/dist/components/scroll-to-top/index.d.ts +7 -0
- package/dist/components/scroll-to-top/index.d.ts.map +1 -0
- package/dist/components/scroll-to-top/scroll-to-top.d.ts +25 -0
- package/dist/components/scroll-to-top/scroll-to-top.d.ts.map +1 -0
- package/dist/components/scrollbar/index.d.ts +7 -0
- package/dist/components/scrollbar/index.d.ts.map +1 -0
- package/dist/components/scrollbar/scrollbar.d.ts +61 -0
- package/dist/components/scrollbar/scrollbar.d.ts.map +1 -0
- package/dist/components/search-input/index.d.ts +2 -0
- package/dist/components/search-input/index.d.ts.map +1 -0
- package/dist/components/search-input/search-input.d.ts +36 -0
- package/dist/components/search-input/search-input.d.ts.map +1 -0
- package/dist/components/settings/index.d.ts +10 -0
- package/dist/components/settings/index.d.ts.map +1 -0
- package/dist/components/settings/settings-drawer.d.ts +39 -0
- package/dist/components/settings/settings-drawer.d.ts.map +1 -0
- package/dist/components/settings/settings-provider.d.ts +106 -0
- package/dist/components/settings/settings-provider.d.ts.map +1 -0
- package/dist/components/skeleton/index.d.ts +7 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +77 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/snackbar/index.d.ts +7 -0
- package/dist/components/snackbar/index.d.ts.map +1 -0
- package/dist/components/snackbar/snackbar.d.ts +120 -0
- package/dist/components/snackbar/snackbar.d.ts.map +1 -0
- package/dist/components/sponsored-slot/index.d.ts +3 -0
- package/dist/components/sponsored-slot/index.d.ts.map +1 -0
- package/dist/components/sponsored-slot/sponsored-slot.d.ts +16 -0
- package/dist/components/sponsored-slot/sponsored-slot.d.ts.map +1 -0
- package/dist/components/sponsored-slot/types.d.ts +45 -0
- package/dist/components/sponsored-slot/types.d.ts.map +1 -0
- package/dist/components/stepper/index.d.ts +7 -0
- package/dist/components/stepper/index.d.ts.map +1 -0
- package/dist/components/stepper/stepper.d.ts +145 -0
- package/dist/components/stepper/stepper.d.ts.map +1 -0
- package/dist/components/svg-color/index.d.ts +7 -0
- package/dist/components/svg-color/index.d.ts.map +1 -0
- package/dist/components/svg-color/svg-color.d.ts +80 -0
- package/dist/components/svg-color/svg-color.d.ts.map +1 -0
- package/dist/components/table/index.d.ts +7 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +184 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +7 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/tabs.d.ts +146 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tag-cloud/index.d.ts +7 -0
- package/dist/components/tag-cloud/index.d.ts.map +1 -0
- package/dist/components/tag-cloud/tag-cloud.d.ts +58 -0
- package/dist/components/tag-cloud/tag-cloud.d.ts.map +1 -0
- package/dist/components/tiptap-renderer/index.d.ts +2 -0
- package/dist/components/tiptap-renderer/index.d.ts.map +1 -0
- package/dist/components/tiptap-renderer/tiptap-renderer.d.ts +46 -0
- package/dist/components/tiptap-renderer/tiptap-renderer.d.ts.map +1 -0
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +38 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/virtual-list/index.d.ts +7 -0
- package/dist/components/virtual-list/index.d.ts.map +1 -0
- package/dist/components/virtual-list/virtual-list.d.ts +64 -0
- package/dist/components/virtual-list/virtual-list.d.ts.map +1 -0
- package/dist/core/accessibility/index.d.ts +96 -0
- package/dist/core/accessibility/index.d.ts.map +1 -0
- package/dist/core/accessibility/skip-link.d.ts +31 -0
- package/dist/core/accessibility/skip-link.d.ts.map +1 -0
- package/dist/core/context.d.ts +99 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/hooks/use-boolean.d.ts +54 -0
- package/dist/core/hooks/use-boolean.d.ts.map +1 -0
- package/dist/core/hooks/use-breakpoints.d.ts +87 -0
- package/dist/core/hooks/use-breakpoints.d.ts.map +1 -0
- package/dist/core/hooks/use-click-outside.d.ts +26 -0
- package/dist/core/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/core/hooks/use-copy-to-clipboard.d.ts +66 -0
- package/dist/core/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/core/hooks/use-countdown.d.ts +105 -0
- package/dist/core/hooks/use-countdown.d.ts.map +1 -0
- package/dist/core/hooks/use-debounce.d.ts +64 -0
- package/dist/core/hooks/use-debounce.d.ts.map +1 -0
- package/dist/core/hooks/use-event-listener.d.ts +37 -0
- package/dist/core/hooks/use-event-listener.d.ts.map +1 -0
- package/dist/core/hooks/use-interval.d.ts +30 -0
- package/dist/core/hooks/use-interval.d.ts.map +1 -0
- package/dist/core/hooks/use-is-client.d.ts +24 -0
- package/dist/core/hooks/use-is-client.d.ts.map +1 -0
- package/dist/core/hooks/use-local-storage.d.ts +61 -0
- package/dist/core/hooks/use-local-storage.d.ts.map +1 -0
- package/dist/core/hooks/use-media-query.d.ts +107 -0
- package/dist/core/hooks/use-media-query.d.ts.map +1 -0
- package/dist/core/hooks/use-mounted.d.ts +33 -0
- package/dist/core/hooks/use-mounted.d.ts.map +1 -0
- package/dist/core/hooks/use-multi-select.d.ts +113 -0
- package/dist/core/hooks/use-multi-select.d.ts.map +1 -0
- package/dist/core/hooks/use-previous.d.ts +23 -0
- package/dist/core/hooks/use-previous.d.ts.map +1 -0
- package/dist/core/hooks/use-set-state.d.ts +56 -0
- package/dist/core/hooks/use-set-state.d.ts.map +1 -0
- package/dist/core/hooks/use-tabs.d.ts +74 -0
- package/dist/core/hooks/use-tabs.d.ts.map +1 -0
- package/dist/core/hooks/use-timeout.d.ts +37 -0
- package/dist/core/hooks/use-timeout.d.ts.map +1 -0
- package/dist/core/index.d.ts +36 -468
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +10 -7
- package/dist/core/provider-stack.d.ts +181 -0
- package/dist/core/provider-stack.d.ts.map +1 -0
- package/dist/core/provider.d.ts +72 -0
- package/dist/core/provider.d.ts.map +1 -0
- package/dist/forms/index.d.ts +6 -557
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +0 -1
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/schema-provider.d.ts +282 -0
- package/dist/forms/schema-provider.d.ts.map +1 -0
- package/dist/forms/schema-utils.d.ts +286 -0
- package/dist/forms/schema-utils.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +38 -8
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +12 -9
- package/dist/hooks/use-array.d.ts +126 -0
- package/dist/hooks/use-array.d.ts.map +1 -0
- package/dist/hooks/use-async.d.ts +88 -0
- package/dist/hooks/use-async.d.ts.map +1 -0
- package/dist/hooks/use-back-to-top.d.ts +57 -0
- package/dist/hooks/use-back-to-top.d.ts.map +1 -0
- package/dist/hooks/use-client-rect.d.ts +67 -0
- package/dist/hooks/use-client-rect.d.ts.map +1 -0
- package/dist/hooks/use-config-from-query.d.ts +98 -0
- package/dist/hooks/use-config-from-query.d.ts.map +1 -0
- package/dist/hooks/use-cookies.d.ts +62 -0
- package/dist/hooks/use-cookies.d.ts.map +1 -0
- package/dist/hooks/use-countdown-date.d.ts +47 -0
- package/dist/hooks/use-countdown-date.d.ts.map +1 -0
- package/dist/hooks/use-countdown-seconds.d.ts +83 -0
- package/dist/hooks/use-countdown-seconds.d.ts.map +1 -0
- package/dist/hooks/use-double-click.d.ts +67 -0
- package/dist/hooks/use-double-click.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.d.ts +66 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-image-dimensions.d.ts +124 -0
- package/dist/hooks/use-image-dimensions.d.ts.map +1 -0
- package/dist/hooks/use-infinite-scroll.d.ts +204 -0
- package/dist/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +93 -0
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +34 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/hooks/use-keyboard-shortcut.d.ts +112 -0
- package/dist/hooks/use-keyboard-shortcut.d.ts.map +1 -0
- package/dist/hooks/use-lazy-query.d.ts +132 -0
- package/dist/hooks/use-lazy-query.d.ts.map +1 -0
- package/dist/hooks/use-mutation.d.ts +141 -0
- package/dist/hooks/use-mutation.d.ts.map +1 -0
- package/dist/hooks/use-online-status.d.ts +56 -0
- package/dist/hooks/use-online-status.d.ts.map +1 -0
- package/dist/hooks/use-password-visibility.d.ts +83 -0
- package/dist/hooks/use-password-visibility.d.ts.map +1 -0
- package/dist/hooks/use-popover-hover.d.ts +78 -0
- package/dist/hooks/use-popover-hover.d.ts.map +1 -0
- package/dist/hooks/use-scroll-offset-top.d.ts +69 -0
- package/dist/hooks/use-scroll-offset-top.d.ts.map +1 -0
- package/dist/hooks/use-scroll-position.d.ts +96 -0
- package/dist/hooks/use-scroll-position.d.ts.map +1 -0
- package/dist/hooks/use-session-storage.d.ts +66 -0
- package/dist/hooks/use-session-storage.d.ts.map +1 -0
- package/dist/hooks/use-throttle.d.ts +67 -0
- package/dist/hooks/use-throttle.d.ts.map +1 -0
- package/dist/hooks/use-update-effect.d.ts +53 -0
- package/dist/hooks/use-update-effect.d.ts.map +1 -0
- package/dist/hooks/use-window-size.d.ts +132 -0
- package/dist/hooks/use-window-size.d.ts.map +1 -0
- package/dist/http/client.d.ts +74 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/index.d.ts +6 -229
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +0 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/types.d.ts +158 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/icons/context.d.ts +17 -0
- package/dist/icons/context.d.ts.map +1 -0
- package/dist/icons/controls.d.ts +51 -0
- package/dist/icons/controls.d.ts.map +1 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/theme.d.ts +4 -0
- package/dist/icons/theme.d.ts.map +1 -0
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +19 -2758
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -63
- package/dist/index.js.map +1 -1
- package/dist/layouts/auth/centered.d.ts +49 -0
- package/dist/layouts/auth/centered.d.ts.map +1 -0
- package/dist/layouts/auth/index.d.ts +12 -0
- package/dist/layouts/auth/index.d.ts.map +1 -0
- package/dist/layouts/auth/simple.d.ts +58 -0
- package/dist/layouts/auth/simple.d.ts.map +1 -0
- package/dist/layouts/auth/split.d.ts +81 -0
- package/dist/layouts/auth/split.d.ts.map +1 -0
- package/dist/layouts/core/context.d.ts +102 -0
- package/dist/layouts/core/context.d.ts.map +1 -0
- package/dist/layouts/core/css-vars.d.ts +43 -0
- package/dist/layouts/core/css-vars.d.ts.map +1 -0
- package/dist/layouts/core/header-section.d.ts +79 -0
- package/dist/layouts/core/header-section.d.ts.map +1 -0
- package/dist/layouts/core/index.d.ts +18 -0
- package/dist/layouts/core/index.d.ts.map +1 -0
- package/dist/layouts/core/layout-section.d.ts +64 -0
- package/dist/layouts/core/layout-section.d.ts.map +1 -0
- package/dist/layouts/core/user-menu.d.ts +88 -0
- package/dist/layouts/core/user-menu.d.ts.map +1 -0
- package/dist/layouts/dashboard/index.d.ts +10 -0
- package/dist/layouts/dashboard/index.d.ts.map +1 -0
- package/dist/layouts/dashboard/labels.d.ts +12 -0
- package/dist/layouts/dashboard/labels.d.ts.map +1 -0
- package/dist/layouts/dashboard/layout.d.ts +96 -0
- package/dist/layouts/dashboard/layout.d.ts.map +1 -0
- package/dist/layouts/dashboard/sidenav.d.ts +62 -0
- package/dist/layouts/dashboard/sidenav.d.ts.map +1 -0
- package/dist/layouts/dashboard/topnav.d.ts +41 -0
- package/dist/layouts/dashboard/topnav.d.ts.map +1 -0
- package/dist/layouts/index.d.ts +32 -850
- package/dist/layouts/index.d.ts.map +1 -0
- package/dist/layouts/index.js +8 -4
- package/dist/layouts/panel-layout.d.ts +35 -0
- package/dist/layouts/panel-layout.d.ts.map +1 -0
- package/dist/layouts/sidebar-toggle.d.ts +11 -0
- package/dist/layouts/sidebar-toggle.d.ts.map +1 -0
- package/dist/layouts/types.d.ts +317 -0
- package/dist/layouts/types.d.ts.map +1 -0
- package/dist/netron/context.d.ts +18 -0
- package/dist/netron/context.d.ts.map +1 -0
- package/dist/netron/hooks.d.ts +10 -0
- package/dist/netron/hooks.d.ts.map +1 -0
- package/dist/netron/index.d.ts +47 -4
- package/dist/netron/index.d.ts.map +1 -0
- package/dist/netron/index.js +1 -2
- package/dist/netron/types.d.ts +12 -0
- package/dist/netron/types.d.ts.map +1 -0
- package/dist/registry/index.d.ts +8 -341
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +1 -2
- package/dist/registry/installer.d.ts +137 -0
- package/dist/registry/installer.d.ts.map +1 -0
- package/dist/registry/manager.d.ts +196 -0
- package/dist/registry/manager.d.ts.map +1 -0
- package/dist/state/create-store.d.ts +164 -0
- package/dist/state/create-store.d.ts.map +1 -0
- package/dist/state/index.d.ts +12 -969
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +2 -3
- package/dist/state/settings-version.d.ts +255 -0
- package/dist/state/settings-version.d.ts.map +1 -0
- package/dist/state/stores/auth.d.ts +143 -0
- package/dist/state/stores/auth.d.ts.map +1 -0
- package/dist/state/stores/index.d.ts +10 -0
- package/dist/state/stores/index.d.ts.map +1 -0
- package/dist/state/stores/settings.d.ts +151 -0
- package/dist/state/stores/settings.d.ts.map +1 -0
- package/dist/state/stores/theme.d.ts +87 -0
- package/dist/state/stores/theme.d.ts.map +1 -0
- package/dist/state/stores/ui.d.ts +106 -0
- package/dist/state/stores/ui.d.ts.map +1 -0
- package/dist/theme/colors/base.d.ts +61 -0
- package/dist/theme/colors/base.d.ts.map +1 -0
- package/dist/theme/colors/index.d.ts +10 -0
- package/dist/theme/colors/index.d.ts.map +1 -0
- package/dist/theme/colors/luxury.d.ts +49 -0
- package/dist/theme/colors/luxury.d.ts.map +1 -0
- package/dist/theme/components/Autocomplete.d.ts +9 -0
- package/dist/theme/components/Autocomplete.d.ts.map +1 -0
- package/dist/theme/components/Button.d.ts +33 -0
- package/dist/theme/components/Button.d.ts.map +1 -0
- package/dist/theme/components/Card.d.ts +20 -0
- package/dist/theme/components/Card.d.ts.map +1 -0
- package/dist/theme/components/Chip.d.ts +29 -0
- package/dist/theme/components/Chip.d.ts.map +1 -0
- package/dist/theme/components/DataGrid.d.ts +15 -0
- package/dist/theme/components/DataGrid.d.ts.map +1 -0
- package/dist/theme/components/DatePicker.d.ts +19 -0
- package/dist/theme/components/DatePicker.d.ts.map +1 -0
- package/dist/theme/components/Dialog.d.ts +23 -0
- package/dist/theme/components/Dialog.d.ts.map +1 -0
- package/dist/theme/components/FormControls.d.ts +44 -0
- package/dist/theme/components/FormControls.d.ts.map +1 -0
- package/dist/theme/components/Tabs.d.ts +21 -0
- package/dist/theme/components/Tabs.d.ts.map +1 -0
- package/dist/theme/components/TextField.d.ts +87 -0
- package/dist/theme/components/TextField.d.ts.map +1 -0
- package/dist/theme/components/index.d.ts +27 -0
- package/dist/theme/components/index.d.ts.map +1 -0
- package/dist/theme/components/theme-utils.d.ts +42 -0
- package/dist/theme/components/theme-utils.d.ts.map +1 -0
- package/dist/theme/create-theme.d.ts +119 -0
- package/dist/theme/create-theme.d.ts.map +1 -0
- package/dist/theme/css-variables.d.ts +42 -0
- package/dist/theme/css-variables.d.ts.map +1 -0
- package/dist/theme/custom-shadows.d.ts +58 -0
- package/dist/theme/custom-shadows.d.ts.map +1 -0
- package/dist/theme/index.d.ts +23 -1045
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +6 -3
- package/dist/theme/mixins.d.ts +334 -0
- package/dist/theme/mixins.d.ts.map +1 -0
- package/dist/theme/opacity.d.ts +51 -0
- package/dist/theme/opacity.d.ts.map +1 -0
- package/dist/theme/palette/builder.d.ts +138 -0
- package/dist/theme/palette/builder.d.ts.map +1 -0
- package/dist/theme/palette/index.d.ts +7 -0
- package/dist/theme/palette/index.d.ts.map +1 -0
- package/dist/theme/palette/overrides.d.ts +23 -0
- package/dist/theme/palette/overrides.d.ts.map +1 -0
- package/dist/theme/palette.d.ts +43 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/dist/theme/presets/arctic.d.ts +13 -0
- package/dist/theme/presets/arctic.d.ts.map +1 -0
- package/dist/theme/presets/default.d.ts +13 -0
- package/dist/theme/presets/default.d.ts.map +1 -0
- package/dist/theme/presets/dracula.d.ts +27 -0
- package/dist/theme/presets/dracula.d.ts.map +1 -0
- package/dist/theme/presets/ember.d.ts +23 -0
- package/dist/theme/presets/ember.d.ts.map +1 -0
- package/dist/theme/presets/index.d.ts +39 -0
- package/dist/theme/presets/index.d.ts.map +1 -0
- package/dist/theme/presets/luxury.d.ts +13 -0
- package/dist/theme/presets/luxury.d.ts.map +1 -0
- package/dist/theme/presets/midnight.d.ts +23 -0
- package/dist/theme/presets/midnight.d.ts.map +1 -0
- package/dist/theme/presets/minimal.d.ts +23 -0
- package/dist/theme/presets/minimal.d.ts.map +1 -0
- package/dist/theme/presets/nature.d.ts +14 -0
- package/dist/theme/presets/nature.d.ts.map +1 -0
- package/dist/theme/presets/retro.d.ts +23 -0
- package/dist/theme/presets/retro.d.ts.map +1 -0
- package/dist/theme/shadows.d.ts +61 -0
- package/dist/theme/shadows.d.ts.map +1 -0
- package/dist/theme/typography.d.ts +24 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/utils/color.d.ts +295 -0
- package/dist/theme/utils/color.d.ts.map +1 -0
- package/dist/theme/utils/index.d.ts +7 -0
- package/dist/theme/utils/index.d.ts.map +1 -0
- package/dist/{registry-DQcIzW2s.d.ts → types/blocks.d.ts} +30 -191
- package/dist/types/blocks.d.ts.map +1 -0
- package/dist/{components-BCGZ-Rwt.d.ts → types/components.d.ts} +17 -20
- package/dist/types/components.d.ts.map +1 -0
- package/dist/{config-Pct0n_Kq.d.ts → types/config.d.ts} +14 -16
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -2
- package/dist/types/registry.d.ts +158 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/{theme-B4Q3Bg5o.d.ts → types/theme.d.ts} +31 -34
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +148 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/utils/async-lock.d.ts +169 -0
- package/dist/utils/async-lock.d.ts.map +1 -0
- package/dist/utils/cn.d.ts +80 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cookies.d.ts +68 -0
- package/dist/utils/cookies.d.ts.map +1 -0
- package/dist/utils/create-classes.d.ts +90 -0
- package/dist/utils/create-classes.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +201 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/fetch-interceptor.d.ts +230 -0
- package/dist/utils/fetch-interceptor.d.ts.map +1 -0
- package/dist/utils/font.d.ts +65 -0
- package/dist/utils/font.d.ts.map +1 -0
- package/dist/utils/format-crypto.d.ts +312 -0
- package/dist/utils/format-crypto.d.ts.map +1 -0
- package/dist/utils/format-date.d.ts +240 -0
- package/dist/utils/format-date.d.ts.map +1 -0
- package/dist/utils/format-number.d.ts +245 -0
- package/dist/utils/format-number.d.ts.map +1 -0
- package/dist/utils/i18n-text.d.ts +68 -0
- package/dist/utils/i18n-text.d.ts.map +1 -0
- package/dist/utils/index.d.ts +30 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/jwt.d.ts +227 -0
- package/dist/utils/jwt.d.ts.map +1 -0
- package/dist/utils/object.d.ts +96 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/refs.d.ts +60 -0
- package/dist/utils/refs.d.ts.map +1 -0
- package/dist/utils/rtl.d.ts +75 -0
- package/dist/utils/rtl.d.ts.map +1 -0
- package/dist/utils/storage.d.ts +190 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/string.d.ts +216 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/template-resolver.d.ts +12 -0
- package/dist/utils/template-resolver.d.ts.map +1 -0
- package/dist/utils/toast.d.ts +25 -0
- package/dist/utils/toast.d.ts.map +1 -0
- package/dist/utils/transform-number.d.ts +108 -0
- package/dist/utils/transform-number.d.ts.map +1 -0
- package/dist/utils/url.d.ts +198 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/package.json +120 -63
- package/dist/chunk-2FYNRDXR.js.map +0 -1
- package/dist/chunk-77KIJLPP.js +0 -37
- package/dist/chunk-A2Z7NVGL.js.map +0 -1
- package/dist/chunk-BV32OJ2A.js.map +0 -1
- package/dist/chunk-DDY7TLUI.js.map +0 -1
- package/dist/chunk-HO2GKTWJ.js.map +0 -1
- package/dist/chunk-IZOIO7PA.js.map +0 -1
- package/dist/chunk-JDTC2SBY.js.map +0 -1
- package/dist/chunk-KTCWPGON.js.map +0 -1
- package/dist/chunk-MEFT6XPH.js.map +0 -1
- package/dist/chunk-SNKGGHBT.js.map +0 -1
- package/dist/chunk-VAAIHNWQ.js.map +0 -1
- package/dist/chunk-XQXGE2PW.js +0 -16793
- package/dist/chunk-XQXGE2PW.js.map +0 -1
- package/dist/chunk-XWL6J6IO.js.map +0 -1
- package/dist/chunk-XXP3ZGU6.js.map +0 -1
- package/dist/chunk-YJMAQL3S.js.map +0 -1
- package/dist/index-nmJ8Muwg.d.ts +0 -2368
- package/dist/settings-CAC0qFjS.d.ts +0 -455
- package/dist/text-transform-D6MzzF7V.d.ts +0 -165
- package/dist/use-timeout-D7U3EAtH.d.ts +0 -808
package/dist/index.d.ts
CHANGED
|
@@ -1,2759 +1,20 @@
|
|
|
1
|
-
export { ActionColors, BackgroundColors, BuildPaletteOptions, COLOR_GROUPS, CreatePrismThemeOptions, PRESET_DISPLAY_NAMES, PRESET_INHERENT_MODE, PRESET_NAMES, SupportedLocale, TextColors, applyPrimaryOverride, arcticPreset, baseColors, basic, blue, buildAction, buildBackground, buildChartColors, buildPalette, buildPaletteColor, buildText, buildVibrant, componentOverrides, createButtonBaseOverrides, createButtonGroupOverrides, createButtonOverrides, createPaletteColorFromScale, createPrismTheme, createShadows, createTypography, cssVarRgba, cssVariables, customScrollbarMixin, darkShadow, darken, defaultDarkPalette, defaultLightPalette, defaultPreset, focusRingMixin, generateColorScale, generateColorScaleWithChannels, generateCssVariables, generatePaletteChannel, generatePaletteColorWithChannels, getContrastRatio, getContrastText, getLuminance, getPreset, getPresetDisplayName, glassMixin, green, grey, hexToHsl, hexToRgb, hexToRgbChannel, hideScrollbarMixin, hslToHex, invertColorScale, isLightColor, lightBlue, lighten, luxuryColors, luxuryError, luxuryInfo, luxuryNeutral, luxuryPreset, luxuryPrimary, luxurySecondary, luxurySuccess, luxuryWarning, mix, mixins, multiLineEllipsisMixin, orange, presetNames, purple, red, rgbToHex, rgba, shadows, textEllipsisMixin, typography } from './theme/index.js';
|
|
2
|
-
export { A as ActionPalette, B as BackgroundPalette, C as ChartPalette, a as ColorGroup, b as ColorScale, c as ColorScaleWithChannels, d as ColorShadeKey, e as CommonColors, f as ComponentDensity, g as ComponentsConfig, h as CssVariablesConfig, G as GreyScale, P as PaletteColor, i as PaletteColorWithChannels, j as PresetPalette, k as PrismTheme, S as SimplePaletteColor, T as TextPalette, l as ThemeConfig, m as ThemeContextValue, n as ThemeDirection, o as ThemeMode, p as ThemePalette, q as ThemePreset, r as ThemePresetDefinition, s as ThemeTypography, V as VibrantPalette } from './theme-B4Q3Bg5o.js';
|
|
3
|
-
export { ARIA_LABELS, AriaExpandedProps, PrismContext, PrismProvider, PrismProviderProps, ProviderConfig, ProviderEntry, ProviderStack, ProviderStackOptions, ProviderStackProps, SimpleProvider, SkipLink, SkipLinkProps, announceToScreenReader, combineAriaDescribedBy, composeProviders, conditionalProvider, createProviderStack, filterProviders, focusVisibleStyles, generateAriaId, getAriaExpanded, handleListKeyDown, srOnly, usePrismContext, withProviderProps } from './core/index.js';
|
|
4
|
-
export { C as CopyState, a as CountdownControls, b as CountdownState, S as SetState, U as UseCopyToClipboardOptions, c as UseCopyToClipboardReturn, d as UseCountdownOptions, e as UseCountdownReturn, f as UseMountedReturn, g as UseMultiSelectOptions, h as UseMultiSelectReturn, i as UseSetStateReturn, j as UseTimeoutReturn, u as useBoolean, k as useBreakpoints, l as useClickOutside, m as useCopyToClipboard, n as useCountdown, o as useDebounce, p as useDebounceCallback, q as useEventListener, r as useInterval, s as useIsClient, t as useLocalStorage, v as useMounted, w as useMultiSelect, x as usePrevious, y as useSetState, z as useTimeout } from './use-timeout-D7U3EAtH.js';
|
|
5
|
-
export { useMediaQuery } from '@mui/material';
|
|
6
|
-
export { Accordion, AccordionItem, AccordionProps, AdminDataTable, AdminDataTableProps, Alert, AlertProps, AlertSeverity, AlertVariant, AmountCell, AmountCellProps, AnimateBorder, AnimateBorderProps, AspectRatio, AutocompleteOption, Avatar, AvatarProps, AvatarShape, AvatarSize, Badge, BadgeColor, BadgeProps, BadgeSize, BadgeVariant, BooleanLabel, BreadcrumbLinkProps, Breadcrumbs, BreadcrumbsProps, BreadcrumbsSlotProps, BreadcrumbsSlots, Card, CardGrid, CardGridProps, CardProps, CardSection, CardSectionProps, CardSkeleton, CardSkeletonProps, CardVariant, Carousel, CarouselArrowProps, CarouselBreakpoint, CarouselDotsProps, CarouselProps, CarouselSlideType, ChangelogEntry, ChangelogTimeline, Chart, ChartLegends, ChartLegendsProps, ChartLoading, ChartLoadingProps, ChartOptions, ChartProps, ChartSeries, ChartType, CircularProgress, CircularProgressProps, ColumnDef, CommandAction, CommandPalette, CommandPaletteProps, ConfirmDialog, ConfirmDialogProps, ContentRenderer, ContentRendererProps, ContentRoot, ContentValue, ContextMenu, ContextMenuProps, CountBadge, CountBadgeProps, CountdownRing, CountdownRingProps, Country, CountryData, CountryOption, CountrySelect, CountrySelectProps, CustomAvatarGroup, CustomAvatarGroupProps, DateRangeInput, DateRangeInputProps, DateRangePicker, DateRangePickerProps, DateRangeValue, DeleteDialog, DeleteDialogProps, DocHeading, DocLayout, DocSectionNav, DocSidebar, DocSidebarItem, Drawer, DrawerAnchor, DrawerProps, DurationPicker, DurationPickerLabels, DurationPickerProps, EditorRenderProps, EditorToolbarConfig, EmptyContent, EmptyContentProps, ErrorBoundary, ErrorBoundaryProps, FallbackProps, Field, FieldAutocomplete, FieldAutocompleteProps, FieldCheckbox, FieldCheckboxProps, FieldCode, FieldCodeProps, FieldCountrySelect, FieldCountrySelectProps, FieldCustomEditor, FieldCustomEditorProps, FieldDatePicker, FieldDatePickerProps, FieldDateTimePicker, FieldDateTimePickerProps, FieldEditor, FieldEditorProps, FieldMultiCheckbox, FieldMultiCheckboxProps, FieldMultiSelect, FieldMultiSelectProps, FieldMultiSwitch, FieldMultiSwitchProps, FieldNumber, FieldNumberProps, FieldPhone, FieldPhoneProps, FieldRadio, FieldRadioProps, FieldRating, FieldRatingProps, FieldSelect, FieldSelectProps, FieldSlider, FieldSliderProps, FieldSwitch, FieldSwitchProps, FieldText, FieldTextProps, FieldTimePicker, FieldTimePickerProps, FieldUpload, FieldUploadAvatar, FieldUploadAvatarProps, FieldUploadBox, FieldUploadBoxProps, FieldUploadProps, FileValue, FilterConfig, FilterOption, FilterToolbar, FilterToolbarProps, FilterType, FilterValues, FlagIcon, FlagIconProps, FlagShape, FormAlert, FormAlertProps, IconProps, Image, ImageProps, ImageWithDefault, InlineAlert, InlineAlertProps, Label, LabelColor, LabelProps, LabelVariant, Lightbox, LightboxProps, LightboxSlide, LightboxThumbnailsProps, LightboxToolbarProps, LinearProgress, LinearProgressProps, LoadingEmptyContent, LoadingScreen, LoadingScreenProps, Markdown, MarkdownProps, MegaMenu, MegaMenuChildItem, MegaMenuChildSection, MegaMenu as MegaMenuHorizontal, MegaMenuItemDataProps, MegaMenuItemOptionsProps, MegaMenuItemProps, MegaMenuItemSlotProps, MegaMenuItemStateProps, MegaMenuListProps, MegaMenuMobile, MegaMenuMoreLink, MegaMenuProps, MegaMenuRenderProps, MegaMenuSlide, MegaMenuSlotProps, MegaMenuSubItemProps, MegaMenuSubListProps, MegaMenuTag, MegaMenuVariant, MegaMenuVertical, Menu, MenuItemDef, MenuItemType, MenuProps, MoreLinksProps, MotionLazy, MotionLazyProps, MultiCheckboxOption, MultiSelectOption, MultiSwitchOption, Nav, NavArrow, NavArrowProps, NavCard, NavCardGrid, NavCardGridProps, NavCardProps, NavCommonProps, NavGroupProps, NavIcon, NavIconProps, NavInfo, NavInfoProps, NavItem, NavItemBase, NavItemBaseProps, NavItemDataProps, NavItemOptionsProps, NavItemProps, NavItemRenderProps, NavItemSlotProps, NavItemStateProps, NavLi, NavLiProps, NavList, NavListProps, NavSection, NavSectionData, NavSectionHorizontal, NavSectionMini, NavSectionProps, NavSection as NavSectionVertical, NavSlotProps, NavSubList, NavSubListProps, NavSubheader, NavSubheaderProps, NavTexts, NavTextsProps, NavUl, NavUlProps, NavVariant, NavigationProgress, NavigationProgressProps, PageContent, PageContentProps, ParsedStackTrace, ProgressBar, ProgressBarProps, ProgressColor, RadioOption, ScrollSpyProvider, ScrollSpySection, ScrollToTop, ScrollToTopProps, Scrollbar, ScrollbarProps, SearchEmptyContent, SearchInput, SearchInputProps, SettingsContextValue, SettingsDrawer, SettingsDrawerProps, SettingsDrawerState, SettingsProvider, SettingsProviderProps, SettingsSection, SimpleAccordion, SimpleAccordionProps, SimpleSnackbar, SimpleSnackbarProps, Skeleton, SkeletonProps, SkeletonVariant, SnackbarContextValue, SnackbarOptions, SnackbarProvider, SnackbarProviderProps, SortOrder, Spinner, SpinnerProps, SplashScreen, SplashScreenProps, StackFrame, StatCard, StatCardProps, StatusChip, StatusChipProps, StatusColor, StatusDot, StatusDotProps, StatusDotStatus, StatusLabel, StepItem, Stepper, StepperActions, StepperActionsProps, StepperProps, SvgColor, SvgColorProps, TabItem, TabPanel, TabPanelProps, Table, TableColumn, TableProps, TableSkeleton, TableSkeletonProps, Tabs, TabsProps, TagCloud, TagCloudItem, TagCloudProps, TipTapDoc, TipTapMark, TipTapNode, TipTapRenderer, TipTapRendererProps, Tooltip, TooltipProps, UploadValue, UseAccordionOptions, UseAccordionReturn, UseCarouselOptions, UseCarouselReturn, UseDateRangePickerReturn, UseLightboxOptions, UseLightboxReturn, UseMenuReturn, UseStepperOptions, UseStepperReturn, UseTableOptions, UseTableReturn, UseTabsOptions, UseTabsReturn, VirtualList, VirtualListProps, animateBorderClasses, carouselClasses, chartClasses, contentClasses, createIconComponent, formatDateString, getErrorLocation, getNavCssVars, htmlToMarkdown, isMarkdownContent, lightboxClasses, megaMenuClasses, megaMenuCssVars, navSectionClasses, navSectionCssVars, parseDateString, parseStackTrace, registerTipTapNode, useAccordion, useCarousel, useChart, useDateRangePicker, useErrorBoundary, useLightbox, useMenu, useScrollSpy, useSettings, useSettingsDrawer, useSnackbar, useStepper, useTable, useTabs } from './components/index.js';
|
|
7
|
-
export { A as ArrowPlacement, C as CustomPopover, a as CustomPopoverProps, P as PopoverArrowProps, U as UsePopoverReturn, u as usePopover } from './popover-Dmw7SJLR.js';
|
|
8
|
-
export { b as Editor, d as EditorProps, g as EditorToolbarItem, a as EditorToolbarItemProps, E as EditorToolbarProps, R as ResolvedToolbar, f as ToolbarConfig, h as ToolbarPreset, i as editorClasses, r as resolveToolbar } from './text-transform-D6MzzF7V.js';
|
|
9
|
-
import { ClassValue } from 'clsx';
|
|
10
|
-
export { ClassValue } from 'clsx';
|
|
11
|
-
import { Ref, RefCallback, MutableRefObject } from 'react';
|
|
12
|
-
export { A as AsyncState, B as BreakpointChecks, a as Breakpoints, C as CookieOptions, D as DOMRectValue, I as ImageDimensions, b as InfiniteFetchFn, c as InfinitePage, d as InfiniteScrollState, K as KeyboardShortcut, L as LazyQueryState, M as MutationState, P as PageInfo, S as ScrollElValue, e as ScrollPosition, U as UrlConfigValues, f as UseArrayReturn, g as UseAsyncFnReturn, h as UseAsyncOptions, i as UseAsyncReturn, j as UseBackToTopReturn, k as UseClientRectReturn, l as UseConfigFromQueryOptions, m as UseConfigFromQueryReturn, n as UseCookiesOptions, o as UseCookiesReturn, p as UseCountdownDateReturn, q as UseCountdownSecondsReturn, r as UseDoubleClickProps, s as UseDoubleClickReturn, t as UseFocusTrapOptions, u as UseFocusTrapReturn, v as UseImageDimensionsOptions, w as UseImageDimensionsReturn, x as UseInfiniteScrollOptions, y as UseInfiniteScrollReturn, z as UseIntersectionObserverOptions, E as UseIntersectionObserverReturn, F as UseKeyboardShortcutOptions, G as UseLazyQueryOptions, H as UseLazyQueryReturn, J as UseMutationOptions, N as UseMutationReturn, O as UseOnlineStatusReturn, Q as UsePasswordVisibilityOptions, R as UsePasswordVisibilityReturn, T as UsePopoverHoverReturn, V as UseResponsiveQueryReturn, W as UseScrollOffsetTopReturn, X as UseScrollPositionOptions, Y as UseSessionStorageOptions, Z as UseSessionStorageReturn, _ as UseThrottleOptions, $ as UseWindowSizeOptions, a0 as WindowSize, a1 as cookiesAvailable, a2 as getCookie, a3 as removeCookie, a4 as setCookie, a5 as useArray, a6 as useAsync, a7 as useAsyncFn, a8 as useBackToTop, a9 as useBreakpoint, aa as useBreakpointChecks, ab as useClientRect, ac as useConfigFromQuery, ad as useCookies, ae as useCountdownDate, af as useCountdownSeconds, ag as useDoubleClick, ah as useEnterKey, ai as useEscapeKey, aj as useFocusTrap, ak as useImageDimensions, al as useInfiniteScroll, am as useIntersectionObserver, an as useIsomorphicLayoutEffect, ao as useKeyboardShortcut, ap as useLazyQuery, aq as useMultipleImageDimensions, ar as useMutation, as as useOnlineStatus, at as usePasswordVisibility, au as usePopoverHover, av as useResponsiveQuery, aw as useScrollLock, ax as useScrollOffsetTop, ay as useScrollPosition, az as useScrollToTop, aA as useSessionStorage, aB as useThrottle, aC as useThrottleCallback, aD as useUpdateEffect, aE as useUpdateLayoutEffect, aF as useWindowSize } from './index-nmJ8Muwg.js';
|
|
13
|
-
import { toast as toast$1 } from 'sonner';
|
|
14
|
-
export { InstallResult, InstallerOptions, PrismInstaller, RegistryManager, RegistryManagerOptions, ResolvedItem, SearchOptions, createInstaller, createRegistryManager, defaultRegistrySchema, registry } from './registry/index.js';
|
|
15
|
-
export { AuthCenteredContent, AuthCenteredContentProps, AuthCenteredLayout, AuthCenteredLayoutProps, AuthLayoutProps, AuthLayoutVariant, AuthSimpleLayout, AuthSimpleLayoutProps, AuthSplitContent, AuthSplitContentProps, AuthSplitIllustration, AuthSplitIllustrationProps, AuthSplitLayout, AuthSplitLayoutProps, DEFAULT_LAYOUT_CSS_VARS, DRAWER_WIDTHS, DashboardContent, DashboardContentProps, DashboardLayout, DashboardLayoutProps, HEADER_HEIGHTS, HeaderSection, HeaderSectionProps, HeaderSlots, HeaderToolbar, HeaderToolbarProps, LAYOUT_CSS_VARS, LayoutConfig, LayoutContext, LayoutContextValue, LayoutGlobalStyles, LayoutGlobalStylesProps, LayoutNavData, LayoutNavItem, LayoutNavSection, LayoutProvider, LayoutProviderProps, LayoutSection, LayoutSectionProps, MainSection, MainSectionProps, MobileSidenav, MobileSidenavProps, NavColorMode, NavigationMenuType, Sidenav, SidenavProps, SidenavVariant, SimpleCompactContent, SimpleCompactContentProps, TopnavVariant, defaultLayoutConfig, getBaseLayoutCssVars, getNavColorCssVars, mergeLayoutCssVars, useLayoutConfig, useLayoutContext, useNavActive, useSidenavVisible, useTopnavVisible } from './layouts/index.js';
|
|
16
|
-
export { B as ButtonVariant, C as CommonComponentProps, a as ComponentColor, b as ComponentSize, D as DataDisplayProps, E as ExtractVariantProps, F as FormFieldProps, I as InputProps, L as LayoutProps, P as PolymorphicComponentProps, S as SelectOption, c as SlotProps, W as WithIconProps } from './components-BCGZ-Rwt.js';
|
|
17
|
-
export { A as AuthContextValue, a as AuthProviderType, b as AuthState, c as AuthUser, B as BlockCategory, d as BlockConfig, e as BlockDefinition, f as BlockDependencies, g as BlockFile, h as BlockFileType, i as BlockNavItem, j as BlockNavSection, C as ComponentDefinition, k as ComponentDependencies, l as ComponentFile, m as ComponentFileType, D as DashboardBlockProps, n as DashboardNavType, o as DataGridProps, F as FormFieldSchema, p as FormFieldType, q as FormSchema, r as FormSectionSchema, G as GridCellParams, s as GridColumn, t as GridFilterItem, u as GridFilterModel, v as GridHeaderParams, w as GridSortModel, I as InstalledBlock, x as InstalledComponent, P as PrismLockfile, R as RegistryConfig, y as RegistrySchema, z as RemoteRegistryConfig, S as SidebarNavVariant, T as ThemeRegistryEntry, E as TopbarNavVariant } from './registry-DQcIzW2s.js';
|
|
18
|
-
export { D as DefineConfigFn, F as FeaturesConfig, P as PartialPrismConfig, a as PathsConfig, b as PrismConfig, c as PrismConfigFile, S as StyleConfig, d as StyleFramework, e as defaultPrismConfig } from './config-Pct0n_Kq.js';
|
|
19
|
-
export { AuthStatus, AuthStoreState, CreateStoreOptions, MigrationFn, StoreSelector, ThemeState, UIState, VersionMigration, VersionedPersistedState, VersionedSettingsConfig, authStore, checkSettingsVersion, clearSettings, createAddFieldMigration, createMigration, createPersistedStore, createPrismStore, createRemoveFieldMigration, createRenameMigration, createSelectors, createSettingsValidator, createTransformMigration, createUIStore, createVersionedPersistOptions, createVersionedStorage, exportSettings, getMigrationInfo, importSettings, runMigrations, themeStore, uiStore, useAuthStore, useThemeStore, useUIStore, validateMigrations } from './state/index.js';
|
|
20
|
-
export { N as NavColor, a as NavLayout, S as SettingsState, b as SettingsValues, g as getDefaultSettings, s as settingsStore, u as useSettingsStore } from './settings-CAC0qFjS.js';
|
|
21
|
-
export { AuthConfig, BackendConfig, BackendConnectionAware, BackendSchema, BackendStatus, CacheConfig, ConnectionAware, ConnectionAwareProps, ConnectionContextValue, DefaultOptions, DefaultsContextValue, DehydratedState, HydrationContextValue, IBackendClient, IMultiBackendClient, Middleware, MiddlewareContext, MultiBackendClientOptions, MultiBackendConnectionAware, MultiBackendProvider, MultiBackendProviderProps, MutationOptions, MutationResult, MutationStatus, NetronError, NetronProvider, NetronProviderProps, NetronReactClient, NetronReactClientConfig, RetryConfig as NetronRetryConfig, QueryKey, QueryOptions, QueryResult, QueryStatus, RequireAllBackends, RequireAnyBackend, RequireBackendConnection, RequireConnection, ServiceMethodHooks, ServiceOptions, SubscriptionOptions, SubscriptionResult, TransportType, TypedServiceProxy, createNetronClient, createServiceHook as createNetronServiceHook, useAllBackendsConnected, useAnyBackendConnected, useBackend, useBackendConnectionState, useBackendMutation, useBackendQuery, useBackendService, useDefaults, useHydration, useMultiBackend, useNetronClient, useNetronClientSafe, useNetronConnection, useMutation as useNetronMutation, useQuery as useNetronQuery, useService as useNetronService, useSubscription as useNetronSubscription } from '@omnitron-dev/netron-react';
|
|
22
|
-
export { AuthenticationClient, ConnectionState, MultiBackendClient, SessionTokenStorage, WebSocketClient, createMultiBackendClient } from '@omnitron-dev/netron-browser';
|
|
23
|
-
export { AuthGuard, AuthGuardProps, AuthProvider, AuthProviderProps, GuestGuard, GuestGuardProps, Hide, AuthContextValue as NetronAuthContextValue, AuthState as NetronAuthState, PermissionGuard, PermissionGuardProps, RoleGuard, RoleGuardProps, Show, User, useAuth, useAuthRequired, useIsAuthenticated, useUser } from '@omnitron-dev/netron-react/auth';
|
|
24
|
-
export { MutationCache, QueryCache, hashQueryKey, matchQueryKey } from '@omnitron-dev/netron-react/cache';
|
|
25
|
-
import '@mui/material/locale';
|
|
26
|
-
import '@mui/material/styles';
|
|
27
|
-
import 'dayjs';
|
|
28
|
-
import 'react/jsx-runtime';
|
|
29
|
-
import '@mui/material/Dialog';
|
|
30
|
-
import '@mui/material/TextField';
|
|
31
|
-
import '@mui/material/Autocomplete';
|
|
32
|
-
import '@mui/material/Box';
|
|
33
|
-
import '@mui/material/Avatar';
|
|
34
|
-
import '@mui/material/AvatarGroup';
|
|
35
|
-
import '@mui/material/Badge';
|
|
36
|
-
import '@mui/material/Card';
|
|
37
|
-
import '@mui/material/LinearProgress';
|
|
38
|
-
import '@mui/material/Alert';
|
|
39
|
-
import '@mui/material/Snackbar';
|
|
40
|
-
import '@mui/material/Table';
|
|
41
|
-
import 'react-hook-form';
|
|
42
|
-
import '@mui/material/Checkbox';
|
|
43
|
-
import '@mui/material/Switch';
|
|
44
|
-
import '@mui/material/FormControl';
|
|
45
|
-
import '@mui/material/Rating';
|
|
46
|
-
import '@mui/material/Slider';
|
|
47
|
-
import '@mui/material/FormGroup';
|
|
48
|
-
import '@mui/material/FormHelperText';
|
|
49
|
-
import '@mui/material/FormLabel';
|
|
50
|
-
import 'react-dropzone';
|
|
51
|
-
import '@mui/material/Skeleton';
|
|
52
|
-
import '@mui/material/CircularProgress';
|
|
53
|
-
import '@mui/material/Tabs';
|
|
54
|
-
import '@mui/material/Accordion';
|
|
55
|
-
import '@mui/material/Tooltip';
|
|
56
|
-
import '@mui/material/Breadcrumbs';
|
|
57
|
-
import '@mui/material/Paper';
|
|
58
|
-
import '@mui/material/Stepper';
|
|
59
|
-
import '@mui/material/ButtonBase';
|
|
60
|
-
import '@mui/material/Link';
|
|
61
|
-
import 'react-markdown';
|
|
62
|
-
import '@emotion/styled';
|
|
63
|
-
import '@mui/system';
|
|
64
|
-
import '@mui/material/Popover';
|
|
65
|
-
import '@tiptap/react';
|
|
66
|
-
import '@tiptap/core';
|
|
67
|
-
import 'class-variance-authority';
|
|
68
|
-
import 'immer';
|
|
69
|
-
import 'zustand';
|
|
70
|
-
import 'zustand/middleware';
|
|
71
|
-
|
|
72
1
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
* // Conditional classes
|
|
94
|
-
* cn('base-class', isActive && 'active', isDisabled && 'disabled')
|
|
95
|
-
*
|
|
96
|
-
* // With objects
|
|
97
|
-
* cn('base', { active: isActive, disabled: isDisabled })
|
|
98
|
-
*
|
|
99
|
-
* // With arrays
|
|
100
|
-
* cn(['class1', 'class2'], condition && 'class3')
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
declare function cn(...inputs: ClassValue[]): string;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* State props for mergeClasses.
|
|
107
|
-
* Values can be:
|
|
108
|
-
* - boolean: includes key as class name if true
|
|
109
|
-
* - undefined: excluded
|
|
110
|
-
* - [boolean, string]: includes string as class name if boolean is true
|
|
111
|
-
*/
|
|
112
|
-
type StateProps = {
|
|
113
|
-
[key: string]: boolean | undefined | [boolean, string];
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Merges class names with state-based class names.
|
|
117
|
-
*
|
|
118
|
-
* This utility provides an alternative API for state-based class toggling,
|
|
119
|
-
* particularly useful when class names differ from state keys.
|
|
120
|
-
*
|
|
121
|
-
* @param className - Base class name(s)
|
|
122
|
-
* @param state - State object with boolean or [boolean, className] values
|
|
123
|
-
* @returns Merged class names string
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```tsx
|
|
127
|
-
* // Basic state-based merging
|
|
128
|
-
* mergeClasses('item', {
|
|
129
|
-
* 'item--active': isActive,
|
|
130
|
-
* 'item--disabled': isDisabled,
|
|
131
|
-
* });
|
|
132
|
-
* // Output: 'item item--active' (if isActive is true)
|
|
133
|
-
*
|
|
134
|
-
* // With tuple format for different class names
|
|
135
|
-
* mergeClasses('btn', {
|
|
136
|
-
* primary: [isPrimary, 'btn-primary'],
|
|
137
|
-
* secondary: [isSecondary, 'btn-secondary'],
|
|
138
|
-
* });
|
|
139
|
-
*
|
|
140
|
-
* // With array of base classes
|
|
141
|
-
* mergeClasses(['nav', 'nav--main'], {
|
|
142
|
-
* 'nav--open': isOpen,
|
|
143
|
-
* });
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
declare function mergeClasses(className?: string | (string | undefined)[] | null, state?: StateProps): string;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Class Name Factory
|
|
150
|
-
*
|
|
151
|
-
* Creates prefixed CSS class names for consistent component styling.
|
|
152
|
-
* Uses a configurable prefix to avoid collisions with other libraries.
|
|
153
|
-
*
|
|
154
|
-
* @module @omnitron-dev/prism/utils/create-classes
|
|
155
|
-
*/
|
|
156
|
-
/**
|
|
157
|
-
* Default class prefix for Prism components.
|
|
158
|
-
* Can be overridden via PRISM_CLASS_PREFIX environment variable.
|
|
159
|
-
*/
|
|
160
|
-
declare const DEFAULT_CLASS_PREFIX = "prism";
|
|
161
|
-
/**
|
|
162
|
-
* Set the global class prefix for all Prism components.
|
|
163
|
-
*
|
|
164
|
-
* @param prefix - New class prefix to use
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```ts
|
|
168
|
-
* setClassPrefix('my-app');
|
|
169
|
-
* createClasses('button__root'); // => "my-app__button__root"
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
declare function setClassPrefix(prefix: string): void;
|
|
173
|
-
/**
|
|
174
|
-
* Get the current class prefix.
|
|
175
|
-
*
|
|
176
|
-
* @returns Current class prefix
|
|
177
|
-
*/
|
|
178
|
-
declare function getClassPrefix(): string;
|
|
179
|
-
/**
|
|
180
|
-
* Create a prefixed CSS class name.
|
|
181
|
-
*
|
|
182
|
-
* @param className - Class name suffix (e.g., "button__root")
|
|
183
|
-
* @returns Prefixed class name (e.g., "prism__button__root")
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* ```ts
|
|
187
|
-
* createClasses('chart__root')
|
|
188
|
-
* // => "prism__chart__root"
|
|
189
|
-
*
|
|
190
|
-
* createClasses('chart__loading')
|
|
191
|
-
* // => "prism__chart__loading"
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
declare function createClasses(className: string): string;
|
|
195
|
-
/**
|
|
196
|
-
* Create multiple prefixed CSS class names.
|
|
197
|
-
*
|
|
198
|
-
* @param classNames - Array of class name suffixes
|
|
199
|
-
* @returns Object mapping original names to prefixed names
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* ```ts
|
|
203
|
-
* const classes = createClassesObject(['root', 'loading', 'label']);
|
|
204
|
-
* // => { root: "prism__root", loading: "prism__loading", label: "prism__label" }
|
|
205
|
-
* ```
|
|
206
|
-
*/
|
|
207
|
-
declare function createClassesObject<T extends string>(classNames: readonly T[]): Record<T, string>;
|
|
208
|
-
/**
|
|
209
|
-
* Create a class name factory for a specific component.
|
|
210
|
-
*
|
|
211
|
-
* @param componentName - Component name (e.g., "chart", "button")
|
|
212
|
-
* @returns Function that creates prefixed class names for that component
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* ```ts
|
|
216
|
-
* const chartClass = createComponentClasses('chart');
|
|
217
|
-
* chartClass('root'); // => "prism__chart__root"
|
|
218
|
-
* chartClass('loading'); // => "prism__chart__loading"
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
declare function createComponentClasses(componentName: string): (suffix: string) => string;
|
|
222
|
-
/**
|
|
223
|
-
* Create a class name object for a specific component with predefined suffixes.
|
|
224
|
-
*
|
|
225
|
-
* @param componentName - Component name (e.g., "chart", "button")
|
|
226
|
-
* @param suffixes - Array of class name suffixes
|
|
227
|
-
* @returns Object mapping suffix names to prefixed class names
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* ```ts
|
|
231
|
-
* const chartClasses = createComponentClasses('chart', ['root', 'loading', 'label'] as const);
|
|
232
|
-
* chartClasses.root; // => "prism__chart__root"
|
|
233
|
-
* chartClasses.loading; // => "prism__chart__loading"
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
declare function createComponentClasses<T extends string>(componentName: string, suffixes: readonly T[]): Record<T, string>;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Ref Utilities
|
|
240
|
-
*
|
|
241
|
-
* Utilities for working with React refs.
|
|
242
|
-
*
|
|
243
|
-
* @module @omnitron-dev/prism/utils/refs
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Supported ref types for merging.
|
|
248
|
-
*/
|
|
249
|
-
type MergeableRef<T> = Ref<T> | RefCallback<T> | MutableRefObject<T> | null | undefined;
|
|
250
|
-
/**
|
|
251
|
-
* Merge multiple refs into a single callback ref.
|
|
252
|
-
* Useful when you need to pass a ref to a component that also needs
|
|
253
|
-
* to be used by a parent component or hook.
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* ```tsx
|
|
257
|
-
* const Component = forwardRef((props, ref) => {
|
|
258
|
-
* const localRef = useRef<HTMLDivElement>(null);
|
|
259
|
-
* const mergedRef = mergeRefs(ref, localRef);
|
|
260
|
-
* return <div ref={mergedRef} />;
|
|
261
|
-
* });
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* @param refs - Array of refs to merge
|
|
265
|
-
* @returns A callback ref that updates all provided refs
|
|
266
|
-
*/
|
|
267
|
-
declare function mergeRefs<T>(...refs: MergeableRef<T>[]): RefCallback<T>;
|
|
268
|
-
/**
|
|
269
|
-
* Create a ref setter that can be used with useImperativeHandle.
|
|
270
|
-
* Useful for exposing a subset of methods from a ref.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* ```tsx
|
|
274
|
-
* const Component = forwardRef<API, Props>((props, ref) => {
|
|
275
|
-
* const inputRef = useRef<HTMLInputElement>(null);
|
|
276
|
-
*
|
|
277
|
-
* useImperativeHandle(ref, () => ({
|
|
278
|
-
* focus: () => inputRef.current?.focus(),
|
|
279
|
-
* clear: () => { if (inputRef.current) inputRef.current.value = ''; },
|
|
280
|
-
* }), []);
|
|
281
|
-
*
|
|
282
|
-
* return <input ref={inputRef} />;
|
|
283
|
-
* });
|
|
284
|
-
* ```
|
|
285
|
-
*
|
|
286
|
-
* @param ref - The ref to set
|
|
287
|
-
* @param value - The value to set
|
|
288
|
-
*/
|
|
289
|
-
declare function setRef<T>(ref: MergeableRef<T>, value: T | null): void;
|
|
290
|
-
/**
|
|
291
|
-
* Check if a ref has a current value.
|
|
292
|
-
*
|
|
293
|
-
* @param ref - The ref to check
|
|
294
|
-
* @returns True if the ref has a current value
|
|
295
|
-
*/
|
|
296
|
-
declare function hasRefValue<T>(ref: MergeableRef<T>): ref is MutableRefObject<NonNullable<T>>;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Number Formatting Utilities
|
|
300
|
-
*
|
|
301
|
-
* Locale-aware number formatting utilities.
|
|
302
|
-
*
|
|
303
|
-
* @module @omnitron-dev/prism/utils/format-number
|
|
304
|
-
*/
|
|
305
|
-
interface FormatNumberOptions extends Intl.NumberFormatOptions {
|
|
306
|
-
/** Locale for formatting (default: 'en-US') */
|
|
307
|
-
locale?: string;
|
|
308
|
-
}
|
|
309
|
-
interface FormatCurrencyOptions extends FormatNumberOptions {
|
|
310
|
-
/** Currency code (default: 'USD') */
|
|
311
|
-
currency?: string;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Format a number with locale-aware formatting.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ```ts
|
|
318
|
-
* fNumber(1234567.89)
|
|
319
|
-
* // => "1,234,567.89"
|
|
320
|
-
*
|
|
321
|
-
* fNumber(1234567.89, { locale: 'de-DE' })
|
|
322
|
-
* // => "1.234.567,89"
|
|
323
|
-
*
|
|
324
|
-
* fNumber(0.1234, { style: 'percent' })
|
|
325
|
-
* // => "12%"
|
|
326
|
-
* ```
|
|
327
|
-
*/
|
|
328
|
-
declare function fNumber(value: number | string | null | undefined, options?: FormatNumberOptions): string;
|
|
329
|
-
/**
|
|
330
|
-
* Format a number as currency.
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```ts
|
|
334
|
-
* fCurrency(1234.56)
|
|
335
|
-
* // => "$1,234.56"
|
|
336
|
-
*
|
|
337
|
-
* fCurrency(1234.56, { currency: 'EUR', locale: 'de-DE' })
|
|
338
|
-
* // => "1.234,56 €"
|
|
339
|
-
*
|
|
340
|
-
* fCurrency(1234.56, { currency: 'JPY' })
|
|
341
|
-
* // => "¥1,235" (JPY has no decimal places)
|
|
342
|
-
* ```
|
|
343
|
-
*/
|
|
344
|
-
declare function fCurrency(value: number | string | null | undefined, options?: FormatCurrencyOptions): string;
|
|
345
|
-
/**
|
|
346
|
-
* Format a number as a percentage.
|
|
347
|
-
*
|
|
348
|
-
* @example
|
|
349
|
-
* ```ts
|
|
350
|
-
* fPercent(0.1234)
|
|
351
|
-
* // => "12.34%"
|
|
352
|
-
*
|
|
353
|
-
* fPercent(0.1234, { maximumFractionDigits: 0 })
|
|
354
|
-
* // => "12%"
|
|
355
|
-
*
|
|
356
|
-
* fPercent(1.5)
|
|
357
|
-
* // => "150%"
|
|
358
|
-
* ```
|
|
359
|
-
*/
|
|
360
|
-
declare function fPercent(value: number | string | null | undefined, options?: FormatNumberOptions): string;
|
|
361
|
-
/**
|
|
362
|
-
* Shorten a large number with K, M, B suffixes.
|
|
363
|
-
*
|
|
364
|
-
* @example
|
|
365
|
-
* ```ts
|
|
366
|
-
* fShortenNumber(1234)
|
|
367
|
-
* // => "1.23K"
|
|
368
|
-
*
|
|
369
|
-
* fShortenNumber(1234567)
|
|
370
|
-
* // => "1.23M"
|
|
371
|
-
*
|
|
372
|
-
* fShortenNumber(1234567890)
|
|
373
|
-
* // => "1.23B"
|
|
374
|
-
*
|
|
375
|
-
* fShortenNumber(1234567890000)
|
|
376
|
-
* // => "1.23T"
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
declare function fShortenNumber(value: number | string | null | undefined, decimals?: number): string;
|
|
380
|
-
/**
|
|
381
|
-
* Format bytes to human-readable size.
|
|
382
|
-
*
|
|
383
|
-
* @example
|
|
384
|
-
* ```ts
|
|
385
|
-
* fBytes(1024)
|
|
386
|
-
* // => "1 KB"
|
|
387
|
-
*
|
|
388
|
-
* fBytes(1048576)
|
|
389
|
-
* // => "1 MB"
|
|
390
|
-
*
|
|
391
|
-
* fBytes(1073741824)
|
|
392
|
-
* // => "1 GB"
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
|
-
declare function fBytes(bytes: number | string | null | undefined, decimals?: number): string;
|
|
396
|
-
/**
|
|
397
|
-
* Format number with ordinal suffix (1st, 2nd, 3rd, etc.)
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* ```ts
|
|
401
|
-
* fOrdinal(1)
|
|
402
|
-
* // => "1st"
|
|
403
|
-
*
|
|
404
|
-
* fOrdinal(22)
|
|
405
|
-
* // => "22nd"
|
|
406
|
-
*
|
|
407
|
-
* fOrdinal(33)
|
|
408
|
-
* // => "33rd"
|
|
409
|
-
*
|
|
410
|
-
* fOrdinal(44)
|
|
411
|
-
* // => "44th"
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
declare function fOrdinal(value: number | null | undefined): string;
|
|
415
|
-
/**
|
|
416
|
-
* Format a number with decimal places.
|
|
417
|
-
*
|
|
418
|
-
* @example
|
|
419
|
-
* ```ts
|
|
420
|
-
* fDecimal(1234.5678)
|
|
421
|
-
* // => "1234.57"
|
|
422
|
-
*
|
|
423
|
-
* fDecimal(1234.5678, 4)
|
|
424
|
-
* // => "1234.5678"
|
|
425
|
-
*
|
|
426
|
-
* fDecimal(1234)
|
|
427
|
-
* // => "1234.00"
|
|
428
|
-
* ```
|
|
429
|
-
*/
|
|
430
|
-
declare function fDecimal(value: number | string | null | undefined, decimals?: number): string;
|
|
431
|
-
/**
|
|
432
|
-
* Calculate percentage of a value relative to a total.
|
|
433
|
-
*
|
|
434
|
-
* @param value - The part value
|
|
435
|
-
* @param total - The total value
|
|
436
|
-
* @param decimals - Decimal places (default: 0)
|
|
437
|
-
* @returns Percentage number (0-100)
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ```ts
|
|
441
|
-
* getPercentage(25, 100)
|
|
442
|
-
* // => 25
|
|
443
|
-
*
|
|
444
|
-
* getPercentage(1, 3)
|
|
445
|
-
* // => 33
|
|
446
|
-
*
|
|
447
|
-
* getPercentage(1, 3, 2)
|
|
448
|
-
* // => 33.33
|
|
449
|
-
*
|
|
450
|
-
* getPercentage(50, 200)
|
|
451
|
-
* // => 25
|
|
452
|
-
* ```
|
|
453
|
-
*/
|
|
454
|
-
declare function getPercentage(value: number, total: number, decimals?: number): number;
|
|
455
|
-
/**
|
|
456
|
-
* Calculate percentage change between two values.
|
|
457
|
-
*
|
|
458
|
-
* @param current - Current value
|
|
459
|
-
* @param previous - Previous value
|
|
460
|
-
* @param decimals - Decimal places (default: 0)
|
|
461
|
-
* @returns Percentage change (positive = increase, negative = decrease)
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* ```ts
|
|
465
|
-
* calculatePercentageChange(150, 100)
|
|
466
|
-
* // => 50 (50% increase)
|
|
467
|
-
*
|
|
468
|
-
* calculatePercentageChange(50, 100)
|
|
469
|
-
* // => -50 (50% decrease)
|
|
470
|
-
*
|
|
471
|
-
* calculatePercentageChange(100, 100)
|
|
472
|
-
* // => 0 (no change)
|
|
473
|
-
*
|
|
474
|
-
* calculatePercentageChange(120, 100, 1)
|
|
475
|
-
* // => 20.0
|
|
476
|
-
* ```
|
|
477
|
-
*/
|
|
478
|
-
declare function calculatePercentageChange(current: number, previous: number, decimals?: number): number;
|
|
479
|
-
/**
|
|
480
|
-
* Get currency symbol for a currency code.
|
|
481
|
-
*
|
|
482
|
-
* @param currencyCode - ISO 4217 currency code (e.g., 'USD', 'EUR')
|
|
483
|
-
* @param locale - Locale for formatting (default: 'en-US')
|
|
484
|
-
* @returns Currency symbol (e.g., '$', '€', '¥')
|
|
485
|
-
*
|
|
486
|
-
* @example
|
|
487
|
-
* ```ts
|
|
488
|
-
* getCurrencySymbol('USD')
|
|
489
|
-
* // => "$"
|
|
490
|
-
*
|
|
491
|
-
* getCurrencySymbol('EUR')
|
|
492
|
-
* // => "€"
|
|
493
|
-
*
|
|
494
|
-
* getCurrencySymbol('JPY')
|
|
495
|
-
* // => "¥"
|
|
496
|
-
*
|
|
497
|
-
* getCurrencySymbol('GBP')
|
|
498
|
-
* // => "£"
|
|
499
|
-
* ```
|
|
500
|
-
*/
|
|
501
|
-
declare function getCurrencySymbol(currencyCode: string, locale?: string): string;
|
|
502
|
-
/**
|
|
503
|
-
* Format a number with +/- sign prefix.
|
|
504
|
-
*
|
|
505
|
-
* @param value - Number to format
|
|
506
|
-
* @param options - Formatting options
|
|
507
|
-
* @returns Formatted string with sign
|
|
508
|
-
*
|
|
509
|
-
* @example
|
|
510
|
-
* ```ts
|
|
511
|
-
* fNumberWithSign(25)
|
|
512
|
-
* // => "+25"
|
|
513
|
-
*
|
|
514
|
-
* fNumberWithSign(-25)
|
|
515
|
-
* // => "-25"
|
|
516
|
-
*
|
|
517
|
-
* fNumberWithSign(0)
|
|
518
|
-
* // => "0"
|
|
519
|
-
*
|
|
520
|
-
* fNumberWithSign(25.5, { maximumFractionDigits: 1 })
|
|
521
|
-
* // => "+25.5"
|
|
522
|
-
* ```
|
|
523
|
-
*/
|
|
524
|
-
declare function fNumberWithSign(value: number | string | null | undefined, options?: FormatNumberOptions): string;
|
|
525
|
-
/**
|
|
526
|
-
* Format a number as compact notation (1K, 1M, 1B).
|
|
527
|
-
* Uses Intl.NumberFormat with compact notation.
|
|
528
|
-
*
|
|
529
|
-
* @example
|
|
530
|
-
* ```ts
|
|
531
|
-
* fCompact(1234)
|
|
532
|
-
* // => "1.2K"
|
|
533
|
-
*
|
|
534
|
-
* fCompact(1234567)
|
|
535
|
-
* // => "1.2M"
|
|
536
|
-
*
|
|
537
|
-
* fCompact(1234567890)
|
|
538
|
-
* // => "1.2B"
|
|
539
|
-
* ```
|
|
540
|
-
*/
|
|
541
|
-
declare function fCompact(value: number | string | null | undefined, options?: FormatNumberOptions): string;
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Number Input Transform Utilities
|
|
545
|
-
*
|
|
546
|
-
* Three-phase number input handling for controlled inputs.
|
|
547
|
-
* Allows users to type freely while maintaining valid numeric state.
|
|
548
|
-
*
|
|
549
|
-
* @module @omnitron-dev/prism/utils/transform-number
|
|
550
|
-
*/
|
|
551
|
-
/**
|
|
552
|
-
* Options for number transformation.
|
|
553
|
-
*/
|
|
554
|
-
interface TransformNumberOptions {
|
|
555
|
-
/** Minimum allowed value */
|
|
556
|
-
min?: number;
|
|
557
|
-
/** Maximum allowed value */
|
|
558
|
-
max?: number;
|
|
559
|
-
/** Decimal places to allow */
|
|
560
|
-
decimals?: number;
|
|
561
|
-
/** Allow negative numbers */
|
|
562
|
-
allowNegative?: boolean;
|
|
563
|
-
/** Default value when input is empty or invalid */
|
|
564
|
-
defaultValue?: number;
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Parse a string to a number, handling edge cases.
|
|
568
|
-
*
|
|
569
|
-
* @param value - String value to parse
|
|
570
|
-
* @param options - Transformation options
|
|
571
|
-
* @returns Parsed number or undefined if invalid
|
|
572
|
-
*/
|
|
573
|
-
declare function parseNumber(value: string, options?: TransformNumberOptions): number | undefined;
|
|
574
|
-
/**
|
|
575
|
-
* Clamp a number to min/max bounds.
|
|
576
|
-
*
|
|
577
|
-
* @param value - Value to clamp
|
|
578
|
-
* @param options - Options with min/max
|
|
579
|
-
* @returns Clamped value
|
|
580
|
-
*/
|
|
581
|
-
declare function clampNumber(value: number, options?: TransformNumberOptions): number;
|
|
582
|
-
/**
|
|
583
|
-
* Round a number to specified decimal places.
|
|
584
|
-
*
|
|
585
|
-
* @param value - Value to round
|
|
586
|
-
* @param decimals - Number of decimal places
|
|
587
|
-
* @returns Rounded value
|
|
588
|
-
*/
|
|
589
|
-
declare function roundToDecimals(value: number, decimals: number): number;
|
|
590
|
-
/**
|
|
591
|
-
* Transform value during onChange (while typing).
|
|
592
|
-
* Allows intermediate states like empty string, single minus, or trailing decimal.
|
|
593
|
-
*
|
|
594
|
-
* @param value - Current input value
|
|
595
|
-
* @param options - Transformation options
|
|
596
|
-
* @returns Transformed string value (may include intermediate states)
|
|
597
|
-
*/
|
|
598
|
-
declare function transformOnChange(value: string, options?: TransformNumberOptions): string;
|
|
599
|
-
/**
|
|
600
|
-
* Transform value during onBlur (when input loses focus).
|
|
601
|
-
* Finalizes the value with proper formatting and validation.
|
|
602
|
-
*
|
|
603
|
-
* @param value - Current input value
|
|
604
|
-
* @param options - Transformation options
|
|
605
|
-
* @returns Finalized numeric value
|
|
606
|
-
*/
|
|
607
|
-
declare function transformOnBlur(value: string, options?: TransformNumberOptions): number;
|
|
608
|
-
/**
|
|
609
|
-
* Transform a number for display in an input.
|
|
610
|
-
* Converts number back to string representation.
|
|
611
|
-
*
|
|
612
|
-
* @param value - Numeric value
|
|
613
|
-
* @param options - Transformation options
|
|
614
|
-
* @returns String representation for input value
|
|
615
|
-
*/
|
|
616
|
-
declare function transformForDisplay(value: number | null | undefined, options?: TransformNumberOptions): string;
|
|
617
|
-
/**
|
|
618
|
-
* Create a complete number input handler.
|
|
619
|
-
* Returns handlers for onChange, onBlur, and value display.
|
|
620
|
-
*
|
|
621
|
-
* @example
|
|
622
|
-
* ```tsx
|
|
623
|
-
* const [price, setPrice] = useState(0);
|
|
624
|
-
* const handlers = createNumberInputHandlers({
|
|
625
|
-
* value: price,
|
|
626
|
-
* onChange: setPrice,
|
|
627
|
-
* min: 0,
|
|
628
|
-
* decimals: 2,
|
|
629
|
-
* });
|
|
630
|
-
*
|
|
631
|
-
* <TextField
|
|
632
|
-
* value={handlers.displayValue}
|
|
633
|
-
* onChange={(e) => handlers.handleChange(e.target.value)}
|
|
634
|
-
* onBlur={handlers.handleBlur}
|
|
635
|
-
* />
|
|
636
|
-
* ```
|
|
637
|
-
*
|
|
638
|
-
* @param config - Handler configuration
|
|
639
|
-
* @returns Object with handlers and display value
|
|
640
|
-
*/
|
|
641
|
-
declare function createNumberInputHandlers(config: {
|
|
642
|
-
value: number;
|
|
643
|
-
onChange: (value: number) => void;
|
|
644
|
-
options?: TransformNumberOptions;
|
|
645
|
-
}): {
|
|
646
|
-
displayValue: string;
|
|
647
|
-
handleChange: (value: string) => void;
|
|
648
|
-
handleBlur: () => void;
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Date Formatting Utilities
|
|
653
|
-
*
|
|
654
|
-
* Locale-aware date formatting utilities using Intl.DateTimeFormat.
|
|
655
|
-
* For more complex formatting, consider using dayjs or date-fns.
|
|
656
|
-
*
|
|
657
|
-
* @module @omnitron-dev/prism/utils/format-date
|
|
658
|
-
*/
|
|
659
|
-
type DateInput = Date | string | number | null | undefined;
|
|
660
|
-
interface FormatDateOptions extends Intl.DateTimeFormatOptions {
|
|
661
|
-
/** Locale for formatting (default: 'en-US') */
|
|
662
|
-
locale?: string;
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* Format a date with locale-aware formatting.
|
|
666
|
-
*
|
|
667
|
-
* @example
|
|
668
|
-
* ```ts
|
|
669
|
-
* fDate(new Date())
|
|
670
|
-
* // => "Jan 15, 2025"
|
|
671
|
-
*
|
|
672
|
-
* fDate(new Date(), { locale: 'ru-RU' })
|
|
673
|
-
* // => "15 янв. 2025 г."
|
|
674
|
-
*
|
|
675
|
-
* fDate('2025-01-15')
|
|
676
|
-
* // => "Jan 15, 2025"
|
|
677
|
-
* ```
|
|
678
|
-
*/
|
|
679
|
-
declare function fDate(date: DateInput, options?: FormatDateOptions): string;
|
|
680
|
-
/**
|
|
681
|
-
* Format a date with time.
|
|
682
|
-
*
|
|
683
|
-
* @example
|
|
684
|
-
* ```ts
|
|
685
|
-
* fDateTime(new Date())
|
|
686
|
-
* // => "Jan 15, 2025, 2:30 PM"
|
|
687
|
-
*
|
|
688
|
-
* fDateTime(new Date(), { hour12: false })
|
|
689
|
-
* // => "Jan 15, 2025, 14:30"
|
|
690
|
-
* ```
|
|
691
|
-
*/
|
|
692
|
-
declare function fDateTime(date: DateInput, options?: FormatDateOptions): string;
|
|
693
|
-
/**
|
|
694
|
-
* Format time only.
|
|
695
|
-
*
|
|
696
|
-
* @example
|
|
697
|
-
* ```ts
|
|
698
|
-
* fTime(new Date())
|
|
699
|
-
* // => "2:30 PM"
|
|
700
|
-
*
|
|
701
|
-
* fTime(new Date(), { hour12: false })
|
|
702
|
-
* // => "14:30"
|
|
703
|
-
*
|
|
704
|
-
* fTime(new Date(), { second: 'numeric' })
|
|
705
|
-
* // => "2:30:45 PM"
|
|
706
|
-
* ```
|
|
707
|
-
*/
|
|
708
|
-
declare function fTime(date: DateInput, options?: FormatDateOptions): string;
|
|
709
|
-
/**
|
|
710
|
-
* Format a date as ISO string (YYYY-MM-DD).
|
|
711
|
-
*
|
|
712
|
-
* @example
|
|
713
|
-
* ```ts
|
|
714
|
-
* fDateISO(new Date())
|
|
715
|
-
* // => "2025-01-15"
|
|
716
|
-
* ```
|
|
717
|
-
*/
|
|
718
|
-
declare function fDateISO(date: DateInput): string;
|
|
719
|
-
/**
|
|
720
|
-
* Format a timestamp as relative time (e.g., "2 hours ago").
|
|
721
|
-
*
|
|
722
|
-
* @example
|
|
723
|
-
* ```ts
|
|
724
|
-
* fRelativeTime(new Date(Date.now() - 3600000))
|
|
725
|
-
* // => "1 hour ago"
|
|
726
|
-
*
|
|
727
|
-
* fRelativeTime(new Date(Date.now() + 86400000))
|
|
728
|
-
* // => "in 1 day"
|
|
729
|
-
*
|
|
730
|
-
* fRelativeTime(new Date(Date.now() - 86400000 * 7))
|
|
731
|
-
* // => "1 week ago"
|
|
732
|
-
* ```
|
|
733
|
-
*/
|
|
734
|
-
declare function fRelativeTime(date: DateInput, options?: {
|
|
735
|
-
locale?: string;
|
|
736
|
-
}): string;
|
|
737
|
-
/**
|
|
738
|
-
* Format a duration in milliseconds to human-readable string.
|
|
739
|
-
*
|
|
740
|
-
* @example
|
|
741
|
-
* ```ts
|
|
742
|
-
* fDuration(3661000)
|
|
743
|
-
* // => "1h 1m 1s"
|
|
744
|
-
*
|
|
745
|
-
* fDuration(90000)
|
|
746
|
-
* // => "1m 30s"
|
|
747
|
-
*
|
|
748
|
-
* fDuration(1000)
|
|
749
|
-
* // => "1s"
|
|
750
|
-
* ```
|
|
751
|
-
*/
|
|
752
|
-
declare function fDuration(ms: number | null | undefined): string;
|
|
753
|
-
/**
|
|
754
|
-
* Check if a date is today.
|
|
755
|
-
*
|
|
756
|
-
* @example
|
|
757
|
-
* ```ts
|
|
758
|
-
* isToday(new Date())
|
|
759
|
-
* // => true
|
|
760
|
-
*
|
|
761
|
-
* isToday(new Date('2020-01-01'))
|
|
762
|
-
* // => false
|
|
763
|
-
* ```
|
|
764
|
-
*/
|
|
765
|
-
declare function isToday(date: DateInput): boolean;
|
|
766
|
-
/**
|
|
767
|
-
* Check if a date is yesterday.
|
|
768
|
-
*/
|
|
769
|
-
declare function isYesterday(date: DateInput): boolean;
|
|
770
|
-
/**
|
|
771
|
-
* Check if a date is within the current week.
|
|
772
|
-
*/
|
|
773
|
-
declare function isThisWeek(date: DateInput): boolean;
|
|
774
|
-
/**
|
|
775
|
-
* Check if a date is in the past.
|
|
776
|
-
*/
|
|
777
|
-
declare function isPast(date: DateInput): boolean;
|
|
778
|
-
/**
|
|
779
|
-
* Check if a date is in the future.
|
|
780
|
-
*/
|
|
781
|
-
declare function isFuture(date: DateInput): boolean;
|
|
782
|
-
/**
|
|
783
|
-
* Get the difference between two dates in days.
|
|
784
|
-
*/
|
|
785
|
-
declare function diffInDays(date1: DateInput, date2: DateInput): number;
|
|
786
|
-
/**
|
|
787
|
-
* Generate an array of dates between start and end.
|
|
788
|
-
*
|
|
789
|
-
* @param startDate - Start date
|
|
790
|
-
* @param endDate - End date
|
|
791
|
-
* @param interval - Interval in milliseconds (default: 1 day)
|
|
792
|
-
* @returns Array of Date objects
|
|
793
|
-
*
|
|
794
|
-
* @example
|
|
795
|
-
* ```ts
|
|
796
|
-
* const dates = getDates(
|
|
797
|
-
* new Date('2025-01-01'),
|
|
798
|
-
* new Date('2025-01-07')
|
|
799
|
-
* );
|
|
800
|
-
* // => [Date(Jan 1), Date(Jan 2), ..., Date(Jan 7)]
|
|
801
|
-
*
|
|
802
|
-
* // With custom interval (every 2 days)
|
|
803
|
-
* const dates = getDates(
|
|
804
|
-
* new Date('2025-01-01'),
|
|
805
|
-
* new Date('2025-01-07'),
|
|
806
|
-
* DAY_MS * 2
|
|
807
|
-
* );
|
|
808
|
-
* // => [Date(Jan 1), Date(Jan 3), Date(Jan 5), Date(Jan 7)]
|
|
809
|
-
* ```
|
|
810
|
-
*/
|
|
811
|
-
declare function getDates(startDate: DateInput, endDate: DateInput, interval?: number): Date[];
|
|
812
|
-
/**
|
|
813
|
-
* Duration preset for getPastDates.
|
|
814
|
-
*/
|
|
815
|
-
type DateDurationPreset = 'week' | 'month' | 'quarter' | 'year';
|
|
816
|
-
/**
|
|
817
|
-
* Get an array of dates for past duration.
|
|
818
|
-
*
|
|
819
|
-
* @param duration - Duration preset or number of days
|
|
820
|
-
* @returns Array of Date objects from past to present
|
|
821
|
-
*
|
|
822
|
-
* @example
|
|
823
|
-
* ```ts
|
|
824
|
-
* // Last 7 days
|
|
825
|
-
* const weekDates = getPastDates('week');
|
|
826
|
-
*
|
|
827
|
-
* // Last 30 days
|
|
828
|
-
* const monthDates = getPastDates('month');
|
|
829
|
-
*
|
|
830
|
-
* // Last 90 days
|
|
831
|
-
* const quarterDates = getPastDates('quarter');
|
|
832
|
-
*
|
|
833
|
-
* // Last 365 days
|
|
834
|
-
* const yearDates = getPastDates('year');
|
|
835
|
-
*
|
|
836
|
-
* // Custom: last 14 days
|
|
837
|
-
* const customDates = getPastDates(14);
|
|
838
|
-
* ```
|
|
839
|
-
*/
|
|
840
|
-
declare function getPastDates(duration: DateDurationPreset | number): Date[];
|
|
841
|
-
/**
|
|
842
|
-
* Get an array of dates for future duration.
|
|
843
|
-
*
|
|
844
|
-
* @param duration - Duration preset or number of days
|
|
845
|
-
* @returns Array of Date objects from present to future
|
|
846
|
-
*
|
|
847
|
-
* @example
|
|
848
|
-
* ```ts
|
|
849
|
-
* // Next 7 days
|
|
850
|
-
* const weekDates = getFutureDates('week');
|
|
851
|
-
*
|
|
852
|
-
* // Next 30 days
|
|
853
|
-
* const monthDates = getFutureDates('month');
|
|
854
|
-
*
|
|
855
|
-
* // Custom: next 14 days
|
|
856
|
-
* const customDates = getFutureDates(14);
|
|
857
|
-
* ```
|
|
858
|
-
*/
|
|
859
|
-
declare function getFutureDates(duration: DateDurationPreset | number): Date[];
|
|
860
|
-
/**
|
|
861
|
-
* Get start of day (midnight) for a date.
|
|
862
|
-
*
|
|
863
|
-
* @param date - Input date
|
|
864
|
-
* @returns Date set to 00:00:00.000
|
|
865
|
-
*/
|
|
866
|
-
declare function startOfDay(date: DateInput): Date | null;
|
|
867
|
-
/**
|
|
868
|
-
* Get end of day (23:59:59.999) for a date.
|
|
869
|
-
*
|
|
870
|
-
* @param date - Input date
|
|
871
|
-
* @returns Date set to 23:59:59.999
|
|
872
|
-
*/
|
|
873
|
-
declare function endOfDay(date: DateInput): Date | null;
|
|
874
|
-
/**
|
|
875
|
-
* Add days to a date.
|
|
876
|
-
*
|
|
877
|
-
* @param date - Input date
|
|
878
|
-
* @param days - Number of days to add (can be negative)
|
|
879
|
-
* @returns New date with days added
|
|
880
|
-
*/
|
|
881
|
-
declare function addDays(date: DateInput, days: number): Date | null;
|
|
882
|
-
/**
|
|
883
|
-
* Add months to a date.
|
|
884
|
-
*
|
|
885
|
-
* @param date - Input date
|
|
886
|
-
* @param months - Number of months to add (can be negative)
|
|
887
|
-
* @returns New date with months added
|
|
888
|
-
*/
|
|
889
|
-
declare function addMonths(date: DateInput, months: number): Date | null;
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* String Utilities
|
|
893
|
-
*
|
|
894
|
-
* Common string manipulation utilities.
|
|
895
|
-
*
|
|
896
|
-
* @module @omnitron-dev/prism/utils/string
|
|
897
|
-
*/
|
|
898
|
-
/**
|
|
899
|
-
* Truncate text with ellipsis.
|
|
900
|
-
*
|
|
901
|
-
* @example
|
|
902
|
-
* ```ts
|
|
903
|
-
* truncate('Hello, World!', 8)
|
|
904
|
-
* // => "Hello..."
|
|
905
|
-
*
|
|
906
|
-
* truncate('Short', 10)
|
|
907
|
-
* // => "Short"
|
|
908
|
-
*
|
|
909
|
-
* truncate('Hello, World!', 8, '…')
|
|
910
|
-
* // => "Hello, W…"
|
|
911
|
-
* ```
|
|
912
|
-
*/
|
|
913
|
-
declare function truncate(text: string | null | undefined, length: number, suffix?: string): string;
|
|
914
|
-
/**
|
|
915
|
-
* Get initials from a name.
|
|
916
|
-
*
|
|
917
|
-
* @example
|
|
918
|
-
* ```ts
|
|
919
|
-
* getInitials('John Doe')
|
|
920
|
-
* // => "JD"
|
|
921
|
-
*
|
|
922
|
-
* getInitials('Alice Bob Charlie')
|
|
923
|
-
* // => "AC"
|
|
924
|
-
*
|
|
925
|
-
* getInitials('SingleName')
|
|
926
|
-
* // => "SI"
|
|
927
|
-
* ```
|
|
928
|
-
*/
|
|
929
|
-
declare function getInitials(name: string | null | undefined): string;
|
|
930
|
-
/**
|
|
931
|
-
* Capitalize the first letter of a string.
|
|
932
|
-
*
|
|
933
|
-
* @example
|
|
934
|
-
* ```ts
|
|
935
|
-
* capitalize('hello world')
|
|
936
|
-
* // => "Hello world"
|
|
937
|
-
* ```
|
|
938
|
-
*/
|
|
939
|
-
declare function capitalize(text: string | null | undefined): string;
|
|
940
|
-
/**
|
|
941
|
-
* Capitalize the first letter of each word.
|
|
942
|
-
*
|
|
943
|
-
* @example
|
|
944
|
-
* ```ts
|
|
945
|
-
* titleCase('hello world')
|
|
946
|
-
* // => "Hello World"
|
|
947
|
-
*
|
|
948
|
-
* titleCase('the quick brown fox')
|
|
949
|
-
* // => "The Quick Brown Fox"
|
|
950
|
-
* ```
|
|
951
|
-
*/
|
|
952
|
-
declare function titleCase(text: string | null | undefined): string;
|
|
953
|
-
/**
|
|
954
|
-
* Convert string to kebab-case.
|
|
955
|
-
*
|
|
956
|
-
* @example
|
|
957
|
-
* ```ts
|
|
958
|
-
* kebabCase('Hello World')
|
|
959
|
-
* // => "hello-world"
|
|
960
|
-
*
|
|
961
|
-
* kebabCase('camelCaseString')
|
|
962
|
-
* // => "camel-case-string"
|
|
963
|
-
* ```
|
|
964
|
-
*/
|
|
965
|
-
declare function kebabCase(text: string | null | undefined): string;
|
|
966
|
-
/**
|
|
967
|
-
* Convert string to camelCase.
|
|
968
|
-
*
|
|
969
|
-
* @example
|
|
970
|
-
* ```ts
|
|
971
|
-
* camelCase('Hello World')
|
|
972
|
-
* // => "helloWorld"
|
|
973
|
-
*
|
|
974
|
-
* camelCase('kebab-case-string')
|
|
975
|
-
* // => "kebabCaseString"
|
|
976
|
-
* ```
|
|
977
|
-
*/
|
|
978
|
-
declare function camelCase(text: string | null | undefined): string;
|
|
979
|
-
/**
|
|
980
|
-
* Convert string to snake_case.
|
|
981
|
-
*
|
|
982
|
-
* @example
|
|
983
|
-
* ```ts
|
|
984
|
-
* snakeCase('Hello World')
|
|
985
|
-
* // => "hello_world"
|
|
986
|
-
*
|
|
987
|
-
* snakeCase('camelCaseString')
|
|
988
|
-
* // => "camel_case_string"
|
|
989
|
-
* ```
|
|
990
|
-
*/
|
|
991
|
-
declare function snakeCase(text: string | null | undefined): string;
|
|
992
|
-
/**
|
|
993
|
-
* Highlight search query in text by wrapping matches in <mark> tags.
|
|
994
|
-
*
|
|
995
|
-
* @example
|
|
996
|
-
* ```ts
|
|
997
|
-
* highlightText('Hello World', 'wor')
|
|
998
|
-
* // => "Hello <mark>Wor</mark>ld"
|
|
999
|
-
*
|
|
1000
|
-
* highlightText('Test Case', 'test', '<strong>', '</strong>')
|
|
1001
|
-
* // => "<strong>Test</strong> Case"
|
|
1002
|
-
* ```
|
|
1003
|
-
*/
|
|
1004
|
-
declare function highlightText(text: string | null | undefined, query: string | null | undefined, openTag?: string, closeTag?: string): string;
|
|
1005
|
-
/**
|
|
1006
|
-
* Escape special regex characters in a string.
|
|
1007
|
-
*
|
|
1008
|
-
* @example
|
|
1009
|
-
* ```ts
|
|
1010
|
-
* escapeRegExp('test.string+with[special]chars')
|
|
1011
|
-
* // => "test\\.string\\+with\\[special\\]chars"
|
|
1012
|
-
* ```
|
|
1013
|
-
*/
|
|
1014
|
-
declare function escapeRegExp(text: string): string;
|
|
1015
|
-
/**
|
|
1016
|
-
* Check if a string contains a substring (case-insensitive).
|
|
1017
|
-
*
|
|
1018
|
-
* @example
|
|
1019
|
-
* ```ts
|
|
1020
|
-
* containsIgnoreCase('Hello World', 'WORLD')
|
|
1021
|
-
* // => true
|
|
1022
|
-
*
|
|
1023
|
-
* containsIgnoreCase('Hello World', 'foo')
|
|
1024
|
-
* // => false
|
|
1025
|
-
* ```
|
|
1026
|
-
*/
|
|
1027
|
-
declare function containsIgnoreCase(text: string | null | undefined, search: string | null | undefined): boolean;
|
|
1028
|
-
/**
|
|
1029
|
-
* Check if a string is empty or whitespace only.
|
|
1030
|
-
*
|
|
1031
|
-
* @example
|
|
1032
|
-
* ```ts
|
|
1033
|
-
* isBlank('')
|
|
1034
|
-
* // => true
|
|
1035
|
-
*
|
|
1036
|
-
* isBlank(' ')
|
|
1037
|
-
* // => true
|
|
1038
|
-
*
|
|
1039
|
-
* isBlank('hello')
|
|
1040
|
-
* // => false
|
|
1041
|
-
* ```
|
|
1042
|
-
*/
|
|
1043
|
-
declare function isBlank(text: string | null | undefined): boolean;
|
|
1044
|
-
/**
|
|
1045
|
-
* Check if a string is a valid email address (basic check).
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* ```ts
|
|
1049
|
-
* isEmail('test@example.com')
|
|
1050
|
-
* // => true
|
|
1051
|
-
*
|
|
1052
|
-
* isEmail('invalid')
|
|
1053
|
-
* // => false
|
|
1054
|
-
* ```
|
|
1055
|
-
*/
|
|
1056
|
-
declare function isEmail(text: string | null | undefined): boolean;
|
|
1057
|
-
/**
|
|
1058
|
-
* Check if a string is a valid URL (basic check).
|
|
1059
|
-
*
|
|
1060
|
-
* @example
|
|
1061
|
-
* ```ts
|
|
1062
|
-
* isUrl('https://example.com')
|
|
1063
|
-
* // => true
|
|
1064
|
-
*
|
|
1065
|
-
* isUrl('not-a-url')
|
|
1066
|
-
* // => false
|
|
1067
|
-
* ```
|
|
1068
|
-
*/
|
|
1069
|
-
declare function isUrl(text: string | null | undefined): boolean;
|
|
1070
|
-
/**
|
|
1071
|
-
* Generate a random string of specified length.
|
|
1072
|
-
*
|
|
1073
|
-
* @example
|
|
1074
|
-
* ```ts
|
|
1075
|
-
* randomString(8)
|
|
1076
|
-
* // => "a3Bx9kPq"
|
|
1077
|
-
*
|
|
1078
|
-
* randomString(16, 'abc123')
|
|
1079
|
-
* // => "a1b3c2a1b3c2a1b3"
|
|
1080
|
-
* ```
|
|
1081
|
-
*/
|
|
1082
|
-
declare function randomString(length?: number, chars?: string): string;
|
|
1083
|
-
/**
|
|
1084
|
-
* Generate a UUID v4.
|
|
1085
|
-
*
|
|
1086
|
-
* @example
|
|
1087
|
-
* ```ts
|
|
1088
|
-
* uuid()
|
|
1089
|
-
* // => "550e8400-e29b-41d4-a716-446655440000"
|
|
1090
|
-
* ```
|
|
1091
|
-
*/
|
|
1092
|
-
declare function uuid(): string;
|
|
1093
|
-
/**
|
|
1094
|
-
* Generate a slug from text.
|
|
1095
|
-
*
|
|
1096
|
-
* @example
|
|
1097
|
-
* ```ts
|
|
1098
|
-
* slugify('Hello World!')
|
|
1099
|
-
* // => "hello-world"
|
|
1100
|
-
*
|
|
1101
|
-
* slugify('This is a Test String')
|
|
1102
|
-
* // => "this-is-a-test-string"
|
|
1103
|
-
* ```
|
|
1104
|
-
*/
|
|
1105
|
-
declare function slugify(text: string | null | undefined): string;
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* URL Utilities
|
|
1109
|
-
*
|
|
1110
|
-
* Safe URL handling, navigation helpers, and link utilities.
|
|
1111
|
-
*
|
|
1112
|
-
* @module @omnitron-dev/prism/utils/url
|
|
1113
|
-
*/
|
|
1114
|
-
/**
|
|
1115
|
-
* Options for safe return URL validation.
|
|
1116
|
-
*/
|
|
1117
|
-
interface SafeReturnUrlOptions {
|
|
1118
|
-
/** Allowed URL schemes (default: ['http:', 'https:']) */
|
|
1119
|
-
allowedSchemes?: string[];
|
|
1120
|
-
/** Allowed hosts (if empty, only relative URLs allowed) */
|
|
1121
|
-
allowedHosts?: string[];
|
|
1122
|
-
/** Whether to allow relative URLs (default: true) */
|
|
1123
|
-
allowRelative?: boolean;
|
|
1124
|
-
/** Default URL if validation fails */
|
|
1125
|
-
fallback?: string;
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Validate and sanitize a return URL to prevent open redirect vulnerabilities.
|
|
1129
|
-
* Only allows relative paths or URLs to explicitly allowed hosts.
|
|
1130
|
-
*
|
|
1131
|
-
* @example
|
|
1132
|
-
* ```tsx
|
|
1133
|
-
* // In a login callback
|
|
1134
|
-
* const returnUrl = safeReturnUrl(searchParams.get('redirect'), {
|
|
1135
|
-
* allowedHosts: ['app.example.com'],
|
|
1136
|
-
* fallback: '/dashboard',
|
|
1137
|
-
* });
|
|
1138
|
-
* router.push(returnUrl);
|
|
1139
|
-
* ```
|
|
1140
|
-
*
|
|
1141
|
-
* @param url - URL to validate
|
|
1142
|
-
* @param options - Validation options
|
|
1143
|
-
* @returns Safe URL or fallback
|
|
1144
|
-
*/
|
|
1145
|
-
declare function safeReturnUrl(url: string | null | undefined, options?: SafeReturnUrlOptions): string;
|
|
1146
|
-
/**
|
|
1147
|
-
* Check if a navigation link is currently active.
|
|
1148
|
-
*
|
|
1149
|
-
* Features:
|
|
1150
|
-
* - Removes trailing slashes and query parameters before comparison
|
|
1151
|
-
* - Ignores external links (https://...) and hash links (#section)
|
|
1152
|
-
* - Supports deep matching for nested routes
|
|
1153
|
-
* - Handles query parameter paths correctly
|
|
1154
|
-
*
|
|
1155
|
-
* @example
|
|
1156
|
-
* ```tsx
|
|
1157
|
-
* // Basic usage
|
|
1158
|
-
* isActiveLink('/dashboard', '/dashboard/user/list'); // true (deep match)
|
|
1159
|
-
* isActiveLink('/dashboard', '/dashboard/user/list', false); // false (exact match)
|
|
1160
|
-
*
|
|
1161
|
-
* // Query parameters
|
|
1162
|
-
* isActiveLink('/users', '/users?page=1'); // true
|
|
1163
|
-
*
|
|
1164
|
-
* // Hash links and external links
|
|
1165
|
-
* isActiveLink('/home', '#section'); // false
|
|
1166
|
-
* isActiveLink('/home', 'https://example.com'); // false
|
|
1167
|
-
*
|
|
1168
|
-
* // Navigation items
|
|
1169
|
-
* const navItems = [
|
|
1170
|
-
* { path: '/dashboard', label: 'Dashboard', exact: true },
|
|
1171
|
-
* { path: '/users', label: 'Users' },
|
|
1172
|
-
* { path: '/settings', label: 'Settings' },
|
|
1173
|
-
* ];
|
|
1174
|
-
*
|
|
1175
|
-
* navItems.map(item => (
|
|
1176
|
-
* <NavItem
|
|
1177
|
-
* key={item.path}
|
|
1178
|
-
* active={isActiveLink(location.pathname, item.path, !item.exact)}
|
|
1179
|
-
* >
|
|
1180
|
-
* {item.label}
|
|
1181
|
-
* </NavItem>
|
|
1182
|
-
* ));
|
|
1183
|
-
* ```
|
|
1184
|
-
*
|
|
1185
|
-
* @param currentPathname - Current location pathname
|
|
1186
|
-
* @param targetPath - The link's target path (can include query parameters)
|
|
1187
|
-
* @param deep - Whether to perform deep matching for nested routes (default: true)
|
|
1188
|
-
* @returns True if the link is active
|
|
1189
|
-
*/
|
|
1190
|
-
declare function isActiveLink(currentPathname: string, targetPath: string, deep?: boolean): boolean;
|
|
1191
|
-
/**
|
|
1192
|
-
* Check if a URL is external (different origin).
|
|
1193
|
-
*
|
|
1194
|
-
* @param url - URL to check
|
|
1195
|
-
* @param currentOrigin - Current page origin (default: window.location.origin)
|
|
1196
|
-
* @returns True if the URL is external
|
|
1197
|
-
*/
|
|
1198
|
-
declare function isExternalUrl(url: string, currentOrigin?: string): boolean;
|
|
1199
|
-
/**
|
|
1200
|
-
* Build a URL with query parameters.
|
|
1201
|
-
*
|
|
1202
|
-
* @example
|
|
1203
|
-
* ```tsx
|
|
1204
|
-
* const url = buildUrl('/search', {
|
|
1205
|
-
* q: 'hello world',
|
|
1206
|
-
* page: 1,
|
|
1207
|
-
* filter: ['active', 'recent'],
|
|
1208
|
-
* });
|
|
1209
|
-
* // Returns: '/search?q=hello+world&page=1&filter=active&filter=recent'
|
|
1210
|
-
* ```
|
|
1211
|
-
*
|
|
1212
|
-
* @param base - Base URL path
|
|
1213
|
-
* @param params - Query parameters
|
|
1214
|
-
* @returns URL with query string
|
|
1215
|
-
*/
|
|
1216
|
-
declare function buildUrl(base: string, params: Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined>): string;
|
|
1217
|
-
/**
|
|
1218
|
-
* Parse query parameters from a URL string.
|
|
1219
|
-
*
|
|
1220
|
-
* @param url - URL or query string
|
|
1221
|
-
* @returns Parsed parameters
|
|
1222
|
-
*/
|
|
1223
|
-
declare function parseQueryParams(url: string): Record<string, string | string[]>;
|
|
1224
|
-
/**
|
|
1225
|
-
* Get a single query parameter value.
|
|
1226
|
-
*
|
|
1227
|
-
* @param url - URL or query string
|
|
1228
|
-
* @param key - Parameter key
|
|
1229
|
-
* @returns Parameter value or undefined
|
|
1230
|
-
*/
|
|
1231
|
-
declare function getQueryParam(url: string, key: string): string | undefined;
|
|
1232
|
-
/**
|
|
1233
|
-
* Check if a URL has query parameters.
|
|
1234
|
-
*
|
|
1235
|
-
* @param url - URL to check
|
|
1236
|
-
* @returns True if URL has query parameters
|
|
1237
|
-
*
|
|
1238
|
-
* @example
|
|
1239
|
-
* ```ts
|
|
1240
|
-
* hasParams('/search?q=hello'); // true
|
|
1241
|
-
* hasParams('/search'); // false
|
|
1242
|
-
* ```
|
|
1243
|
-
*/
|
|
1244
|
-
declare function hasParams(url: string): boolean;
|
|
1245
|
-
/**
|
|
1246
|
-
* Remove query parameters from a URL.
|
|
1247
|
-
*
|
|
1248
|
-
* @param url - URL to process
|
|
1249
|
-
* @returns URL without query parameters
|
|
1250
|
-
*
|
|
1251
|
-
* @example
|
|
1252
|
-
* ```ts
|
|
1253
|
-
* removeParams('/search?q=hello'); // '/search'
|
|
1254
|
-
* removeParams('/search'); // '/search'
|
|
1255
|
-
* ```
|
|
1256
|
-
*/
|
|
1257
|
-
declare function removeParams(url: string): string;
|
|
1258
|
-
/**
|
|
1259
|
-
* Remove trailing slash from a path.
|
|
1260
|
-
*
|
|
1261
|
-
* @param pathname - Path to process
|
|
1262
|
-
* @returns Path without trailing slash
|
|
1263
|
-
*
|
|
1264
|
-
* @example
|
|
1265
|
-
* ```ts
|
|
1266
|
-
* removeLastSlash('/users/'); // '/users'
|
|
1267
|
-
* removeLastSlash('/users'); // '/users'
|
|
1268
|
-
* removeLastSlash('/'); // '/'
|
|
1269
|
-
* ```
|
|
1270
|
-
*/
|
|
1271
|
-
declare function removeLastSlash(pathname: string): string;
|
|
1272
|
-
/**
|
|
1273
|
-
* Check if a URL is an external link (starts with http:// or https://).
|
|
1274
|
-
*
|
|
1275
|
-
* @param url - URL to check
|
|
1276
|
-
* @returns True if external link
|
|
1277
|
-
*
|
|
1278
|
-
* @example
|
|
1279
|
-
* ```ts
|
|
1280
|
-
* isExternalLink('https://example.com'); // true
|
|
1281
|
-
* isExternalLink('/about'); // false
|
|
1282
|
-
* isExternalLink('#section'); // false
|
|
1283
|
-
* ```
|
|
1284
|
-
*/
|
|
1285
|
-
declare function isExternalLink(url: string): boolean;
|
|
1286
|
-
/**
|
|
1287
|
-
* Compare two paths for equality (ignoring trailing slashes and query params).
|
|
1288
|
-
*
|
|
1289
|
-
* @param targetUrl - Target URL
|
|
1290
|
-
* @param currentUrl - Current URL
|
|
1291
|
-
* @param options - Comparison options
|
|
1292
|
-
* @returns True if paths are equal
|
|
1293
|
-
*
|
|
1294
|
-
* @example
|
|
1295
|
-
* ```ts
|
|
1296
|
-
* isEqualPath('/users/', '/users'); // true
|
|
1297
|
-
* isEqualPath('/users?page=1', '/users'); // true
|
|
1298
|
-
* isEqualPath('/users', '/users/1', { deep: true }); // false
|
|
1299
|
-
* ```
|
|
1300
|
-
*/
|
|
1301
|
-
declare function isEqualPath(targetUrl: string, currentUrl: string, options?: {
|
|
1302
|
-
deep?: boolean;
|
|
1303
|
-
}): boolean;
|
|
1304
|
-
|
|
1305
|
-
/**
|
|
1306
|
-
* LocalStorage Utilities
|
|
1307
|
-
*
|
|
1308
|
-
* SSR-safe localStorage utilities with JSON serialization support.
|
|
1309
|
-
* Inspired by minimal-shared/utils/local-storage pattern.
|
|
1310
|
-
*
|
|
1311
|
-
* @module @omnitron-dev/prism/utils/storage
|
|
1312
|
-
*/
|
|
1313
|
-
interface StorageOptions {
|
|
1314
|
-
/** Storage to use (default: localStorage) */
|
|
1315
|
-
storage?: Storage;
|
|
1316
|
-
/** Serialize function (default: JSON.stringify) */
|
|
1317
|
-
serialize?: (value: unknown) => string;
|
|
1318
|
-
/** Deserialize function (default: JSON.parse) */
|
|
1319
|
-
deserialize?: (value: string) => unknown;
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* Check if localStorage is available in the current environment.
|
|
1323
|
-
* Handles SSR, private browsing, and quota exceeded scenarios.
|
|
1324
|
-
*
|
|
1325
|
-
* @example
|
|
1326
|
-
* ```ts
|
|
1327
|
-
* if (localStorageAvailable()) {
|
|
1328
|
-
* localStorage.setItem('key', 'value');
|
|
1329
|
-
* }
|
|
1330
|
-
* ```
|
|
1331
|
-
*/
|
|
1332
|
-
declare function localStorageAvailable(): boolean;
|
|
1333
|
-
/**
|
|
1334
|
-
* Check if sessionStorage is available in the current environment.
|
|
1335
|
-
*
|
|
1336
|
-
* @example
|
|
1337
|
-
* ```ts
|
|
1338
|
-
* if (sessionStorageAvailable()) {
|
|
1339
|
-
* sessionStorage.setItem('key', 'value');
|
|
1340
|
-
* }
|
|
1341
|
-
* ```
|
|
1342
|
-
*/
|
|
1343
|
-
declare function sessionStorageAvailable(): boolean;
|
|
1344
|
-
/**
|
|
1345
|
-
* Get a value from localStorage with automatic JSON parsing.
|
|
1346
|
-
* Returns defaultValue if key doesn't exist, parsing fails, or storage is unavailable.
|
|
1347
|
-
*
|
|
1348
|
-
* @param key - Storage key
|
|
1349
|
-
* @param defaultValue - Value to return if key doesn't exist or parsing fails
|
|
1350
|
-
* @param options - Storage options
|
|
1351
|
-
* @returns Parsed value or defaultValue
|
|
1352
|
-
*
|
|
1353
|
-
* @example
|
|
1354
|
-
* ```ts
|
|
1355
|
-
* // Simple value
|
|
1356
|
-
* const count = getStorage('count', 0);
|
|
1357
|
-
*
|
|
1358
|
-
* // Object value
|
|
1359
|
-
* const user = getStorage<User>('user', null);
|
|
1360
|
-
*
|
|
1361
|
-
* // With sessionStorage
|
|
1362
|
-
* const session = getStorage('session', null, {
|
|
1363
|
-
* storage: sessionStorage,
|
|
1364
|
-
* });
|
|
1365
|
-
* ```
|
|
1366
|
-
*/
|
|
1367
|
-
declare function getStorage<T>(key: string, defaultValue: T, options?: StorageOptions): T;
|
|
1368
|
-
/**
|
|
1369
|
-
* Set a value in localStorage with automatic JSON serialization.
|
|
1370
|
-
* Silently fails if storage is unavailable.
|
|
1371
|
-
*
|
|
1372
|
-
* @param key - Storage key
|
|
1373
|
-
* @param value - Value to store (will be JSON serialized)
|
|
1374
|
-
* @param options - Storage options
|
|
1375
|
-
* @returns true if successful, false otherwise
|
|
1376
|
-
*
|
|
1377
|
-
* @example
|
|
1378
|
-
* ```ts
|
|
1379
|
-
* // Simple value
|
|
1380
|
-
* setStorage('count', 42);
|
|
1381
|
-
*
|
|
1382
|
-
* // Object value
|
|
1383
|
-
* setStorage('user', { id: 1, name: 'John' });
|
|
1384
|
-
*
|
|
1385
|
-
* // With sessionStorage
|
|
1386
|
-
* setStorage('session', sessionData, {
|
|
1387
|
-
* storage: sessionStorage,
|
|
1388
|
-
* });
|
|
1389
|
-
* ```
|
|
1390
|
-
*/
|
|
1391
|
-
declare function setStorage<T>(key: string, value: T, options?: StorageOptions): boolean;
|
|
1392
|
-
/**
|
|
1393
|
-
* Remove a value from localStorage.
|
|
1394
|
-
* Silently fails if storage is unavailable.
|
|
1395
|
-
*
|
|
1396
|
-
* @param key - Storage key to remove
|
|
1397
|
-
* @param options - Storage options
|
|
1398
|
-
* @returns true if successful, false otherwise
|
|
1399
|
-
*
|
|
1400
|
-
* @example
|
|
1401
|
-
* ```ts
|
|
1402
|
-
* removeStorage('user');
|
|
1403
|
-
*
|
|
1404
|
-
* // From sessionStorage
|
|
1405
|
-
* removeStorage('session', { storage: sessionStorage });
|
|
1406
|
-
* ```
|
|
1407
|
-
*/
|
|
1408
|
-
declare function removeStorage(key: string, options?: Pick<StorageOptions, 'storage'>): boolean;
|
|
1409
|
-
/**
|
|
1410
|
-
* Clear all items from localStorage.
|
|
1411
|
-
* Silently fails if storage is unavailable.
|
|
1412
|
-
*
|
|
1413
|
-
* @param options - Storage options
|
|
1414
|
-
* @returns true if successful, false otherwise
|
|
1415
|
-
*
|
|
1416
|
-
* @example
|
|
1417
|
-
* ```ts
|
|
1418
|
-
* clearStorage();
|
|
1419
|
-
*
|
|
1420
|
-
* // Clear sessionStorage
|
|
1421
|
-
* clearStorage({ storage: sessionStorage });
|
|
1422
|
-
* ```
|
|
1423
|
-
*/
|
|
1424
|
-
declare function clearStorage(options?: Pick<StorageOptions, 'storage'>): boolean;
|
|
1425
|
-
/**
|
|
1426
|
-
* Get all keys from localStorage.
|
|
1427
|
-
*
|
|
1428
|
-
* @param options - Storage options
|
|
1429
|
-
* @returns Array of storage keys
|
|
1430
|
-
*
|
|
1431
|
-
* @example
|
|
1432
|
-
* ```ts
|
|
1433
|
-
* const keys = getStorageKeys();
|
|
1434
|
-
* // => ['user', 'settings', 'cart']
|
|
1435
|
-
* ```
|
|
1436
|
-
*/
|
|
1437
|
-
declare function getStorageKeys(options?: Pick<StorageOptions, 'storage'>): string[];
|
|
1438
|
-
/**
|
|
1439
|
-
* Get approximate size of localStorage in bytes.
|
|
1440
|
-
*
|
|
1441
|
-
* @param options - Storage options
|
|
1442
|
-
* @returns Size in bytes
|
|
1443
|
-
*
|
|
1444
|
-
* @example
|
|
1445
|
-
* ```ts
|
|
1446
|
-
* const sizeBytes = getStorageSize();
|
|
1447
|
-
* console.log(`Using ${sizeBytes} bytes of localStorage`);
|
|
1448
|
-
* ```
|
|
1449
|
-
*/
|
|
1450
|
-
declare function getStorageSize(options?: Pick<StorageOptions, 'storage'>): number;
|
|
1451
|
-
interface StorageWithExpiryOptions extends StorageOptions {
|
|
1452
|
-
/** Time to live in milliseconds */
|
|
1453
|
-
ttl: number;
|
|
1454
|
-
}
|
|
1455
|
-
/**
|
|
1456
|
-
* Set a value with expiration time.
|
|
1457
|
-
*
|
|
1458
|
-
* @param key - Storage key
|
|
1459
|
-
* @param value - Value to store
|
|
1460
|
-
* @param options - Options with TTL in milliseconds
|
|
1461
|
-
*
|
|
1462
|
-
* @example
|
|
1463
|
-
* ```ts
|
|
1464
|
-
* // Store for 1 hour
|
|
1465
|
-
* setStorageWithExpiry('session', sessionData, {
|
|
1466
|
-
* ttl: 60 * 60 * 1000,
|
|
1467
|
-
* });
|
|
1468
|
-
*
|
|
1469
|
-
* // Store for 24 hours
|
|
1470
|
-
* setStorageWithExpiry('cache', cacheData, {
|
|
1471
|
-
* ttl: 24 * 60 * 60 * 1000,
|
|
1472
|
-
* });
|
|
1473
|
-
* ```
|
|
1474
|
-
*/
|
|
1475
|
-
declare function setStorageWithExpiry<T>(key: string, value: T, options: StorageWithExpiryOptions): boolean;
|
|
1476
|
-
/**
|
|
1477
|
-
* Get a value that was stored with expiration.
|
|
1478
|
-
* Returns defaultValue if expired or not found.
|
|
1479
|
-
*
|
|
1480
|
-
* @param key - Storage key
|
|
1481
|
-
* @param defaultValue - Value to return if expired or not found
|
|
1482
|
-
* @param options - Storage options
|
|
1483
|
-
*
|
|
1484
|
-
* @example
|
|
1485
|
-
* ```ts
|
|
1486
|
-
* const session = getStorageWithExpiry<Session>('session', null);
|
|
1487
|
-
* if (!session) {
|
|
1488
|
-
* // Session expired or doesn't exist
|
|
1489
|
-
* redirectToLogin();
|
|
1490
|
-
* }
|
|
1491
|
-
* ```
|
|
1492
|
-
*/
|
|
1493
|
-
declare function getStorageWithExpiry<T>(key: string, defaultValue: T, options?: StorageOptions): T;
|
|
1494
|
-
|
|
1495
|
-
/**
|
|
1496
|
-
* Font Utilities
|
|
1497
|
-
*
|
|
1498
|
-
* Font family and unit conversion helpers.
|
|
1499
|
-
*
|
|
1500
|
-
* @module @omnitron-dev/prism/utils
|
|
1501
|
-
*/
|
|
1502
|
-
/**
|
|
1503
|
-
* Create a font family string with fallback stack.
|
|
1504
|
-
*
|
|
1505
|
-
* @param {string} [fontName] - Primary font name
|
|
1506
|
-
* @returns {string} Font family with fallbacks
|
|
1507
|
-
*
|
|
1508
|
-
* @example
|
|
1509
|
-
* ```ts
|
|
1510
|
-
* setFont('Inter'); // '"Inter", -apple-system, ...'
|
|
1511
|
-
* setFont(); // Default system font stack
|
|
1512
|
-
* ```
|
|
1513
|
-
*/
|
|
1514
|
-
declare function setFont(fontName?: string): string;
|
|
1515
|
-
/**
|
|
1516
|
-
* Convert rem to pixels.
|
|
1517
|
-
*
|
|
1518
|
-
* @param {string | number} value - Rem value (number or string like '1rem')
|
|
1519
|
-
* @returns {number} Value in pixels
|
|
1520
|
-
*
|
|
1521
|
-
* @example
|
|
1522
|
-
* ```ts
|
|
1523
|
-
* remToPx(1); // 16
|
|
1524
|
-
* remToPx('1rem'); // 16
|
|
1525
|
-
* remToPx(1.5); // 24
|
|
1526
|
-
* ```
|
|
1527
|
-
*/
|
|
1528
|
-
declare function remToPx(value: string | number): number;
|
|
1529
|
-
/**
|
|
1530
|
-
* Convert pixels to rem.
|
|
1531
|
-
*
|
|
1532
|
-
* @param {string | number} value - Pixel value (number or string like '16px')
|
|
1533
|
-
* @returns {string} Value in rem with unit
|
|
1534
|
-
*
|
|
1535
|
-
* @example
|
|
1536
|
-
* ```ts
|
|
1537
|
-
* pxToRem(16); // '1rem'
|
|
1538
|
-
* pxToRem('16px'); // '1rem'
|
|
1539
|
-
* pxToRem(24); // '1.5rem'
|
|
1540
|
-
* ```
|
|
1541
|
-
*/
|
|
1542
|
-
declare function pxToRem(value: string | number): string;
|
|
1543
|
-
/**
|
|
1544
|
-
* Create responsive font size based on viewport.
|
|
1545
|
-
*
|
|
1546
|
-
* @param {number} minSize - Minimum font size in px
|
|
1547
|
-
* @param {number} maxSize - Maximum font size in px
|
|
1548
|
-
* @param {number} [minWidth=320] - Minimum viewport width in px
|
|
1549
|
-
* @param {number} [maxWidth=1200] - Maximum viewport width in px
|
|
1550
|
-
* @returns {string} CSS clamp() value
|
|
1551
|
-
*
|
|
1552
|
-
* @example
|
|
1553
|
-
* ```ts
|
|
1554
|
-
* responsiveFontSize(14, 18);
|
|
1555
|
-
* // 'clamp(0.875rem, 0.7955rem + 0.3977vw, 1.125rem)'
|
|
1556
|
-
* ```
|
|
1557
|
-
*/
|
|
1558
|
-
declare function responsiveFontSize(minSize: number, maxSize: number, minWidth?: number, maxWidth?: number): string;
|
|
1559
|
-
|
|
1560
|
-
/**
|
|
1561
|
-
* Object Utilities
|
|
1562
|
-
*
|
|
1563
|
-
* Type-safe object manipulation helpers.
|
|
1564
|
-
*
|
|
1565
|
-
* @module @omnitron-dev/prism/utils
|
|
1566
|
-
*/
|
|
1567
|
-
/**
|
|
1568
|
-
* Check if an object has specific keys.
|
|
1569
|
-
*
|
|
1570
|
-
* Vacuously true when `keys` is empty, in line with `Array.every`
|
|
1571
|
-
* — "every key in the empty set is present" matches the standard
|
|
1572
|
-
* library and avoids surprising callers that pass a dynamically
|
|
1573
|
-
* derived list of required keys.
|
|
1574
|
-
*
|
|
1575
|
-
* @template T - Object type
|
|
1576
|
-
* @template K - Key type
|
|
1577
|
-
* @param {T | null | undefined} obj - Object to check
|
|
1578
|
-
* @param {K[]} keys - Keys to check for
|
|
1579
|
-
* @returns {boolean} True if object has all specified keys
|
|
1580
|
-
*
|
|
1581
|
-
* @example
|
|
1582
|
-
* ```ts
|
|
1583
|
-
* const user = { name: 'John', email: 'john@example.com' };
|
|
1584
|
-
* hasKeys(user, ['name', 'email']); // true
|
|
1585
|
-
* hasKeys(user, ['name', 'age']); // false
|
|
1586
|
-
* hasKeys(null, ['name']); // false
|
|
1587
|
-
* hasKeys(user, []); // true (vacuous)
|
|
1588
|
-
* ```
|
|
1589
|
-
*/
|
|
1590
|
-
declare function hasKeys<T extends object, K extends keyof T>(obj: T | null | undefined, keys: K[]): boolean;
|
|
1591
|
-
/**
|
|
1592
|
-
* Omit specific keys from an object.
|
|
1593
|
-
*
|
|
1594
|
-
* @template T - Object type
|
|
1595
|
-
* @template K - Keys to omit
|
|
1596
|
-
* @param {T} obj - Source object
|
|
1597
|
-
* @param {K[]} keys - Keys to omit
|
|
1598
|
-
* @returns {Omit<T, K>} New object without specified keys
|
|
1599
|
-
*
|
|
1600
|
-
* @example
|
|
1601
|
-
* ```ts
|
|
1602
|
-
* const user = { name: 'John', email: 'john@example.com', password: '...' };
|
|
1603
|
-
* omit(user, ['password']); // { name: 'John', email: 'john@example.com' }
|
|
1604
|
-
* ```
|
|
1605
|
-
*/
|
|
1606
|
-
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
1607
|
-
/**
|
|
1608
|
-
* Pick specific keys from an object.
|
|
1609
|
-
*
|
|
1610
|
-
* @template T - Object type
|
|
1611
|
-
* @template K - Keys to pick
|
|
1612
|
-
* @param {T} obj - Source object
|
|
1613
|
-
* @param {K[]} keys - Keys to pick
|
|
1614
|
-
* @returns {Pick<T, K>} New object with only specified keys
|
|
1615
|
-
*
|
|
1616
|
-
* @example
|
|
1617
|
-
* ```ts
|
|
1618
|
-
* const user = { name: 'John', email: 'john@example.com', password: '...' };
|
|
1619
|
-
* pick(user, ['name', 'email']); // { name: 'John', email: 'john@example.com' }
|
|
1620
|
-
* ```
|
|
1621
|
-
*/
|
|
1622
|
-
declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
1623
|
-
/**
|
|
1624
|
-
* Deep clone an object.
|
|
1625
|
-
*
|
|
1626
|
-
* @template T - Object type
|
|
1627
|
-
* @param {T} obj - Object to clone
|
|
1628
|
-
* @returns {T} Deep cloned object
|
|
1629
|
-
*
|
|
1630
|
-
* @example
|
|
1631
|
-
* ```ts
|
|
1632
|
-
* const original = { a: 1, b: { c: 2 } };
|
|
1633
|
-
* const cloned = deepClone(original);
|
|
1634
|
-
* cloned.b.c = 3; // original.b.c is still 2
|
|
1635
|
-
* ```
|
|
1636
|
-
*/
|
|
1637
|
-
declare function deepClone<T>(obj: T): T;
|
|
1638
|
-
/**
|
|
1639
|
-
* Check if a value is empty (null, undefined, empty string, empty array, empty object).
|
|
1640
|
-
*
|
|
1641
|
-
* @param {unknown} value - Value to check
|
|
1642
|
-
* @returns {boolean} True if empty
|
|
1643
|
-
*
|
|
1644
|
-
* @example
|
|
1645
|
-
* ```ts
|
|
1646
|
-
* isEmpty(null); // true
|
|
1647
|
-
* isEmpty(''); // true
|
|
1648
|
-
* isEmpty([]); // true
|
|
1649
|
-
* isEmpty({}); // true
|
|
1650
|
-
* isEmpty('hello'); // false
|
|
1651
|
-
* isEmpty([1]); // false
|
|
1652
|
-
* ```
|
|
1653
|
-
*/
|
|
1654
|
-
declare function isEmpty(value: unknown): boolean;
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* RTL (Right-to-Left) Utilities
|
|
1658
|
-
*
|
|
1659
|
-
* Helpers for RTL layout support and CSS transformation control.
|
|
1660
|
-
*
|
|
1661
|
-
* @module @omnitron-dev/prism/utils
|
|
1662
|
-
*/
|
|
1663
|
-
/**
|
|
1664
|
-
* Prevents automatic RTL (right-to-left) flipping of a CSS declaration.
|
|
1665
|
-
*
|
|
1666
|
-
* Many CSS-in-JS libraries and RTL plugins automatically flip directional
|
|
1667
|
-
* CSS properties (like margin-left → margin-right) for RTL layouts.
|
|
1668
|
-
* Use this function to prevent that behavior for specific declarations.
|
|
1669
|
-
*
|
|
1670
|
-
* Appends the `\/* @noflip *\/` comment which is recognized by:
|
|
1671
|
-
* - stylis (used by Emotion/styled-components)
|
|
1672
|
-
* - rtlcss
|
|
1673
|
-
* - cssjanus
|
|
1674
|
-
*
|
|
1675
|
-
* @param cssValue - A CSS declaration string (e.g., "margin-left: 10px")
|
|
1676
|
-
* @returns The same declaration with `\/* @noflip *\/` appended
|
|
1677
|
-
*
|
|
1678
|
-
* @example
|
|
1679
|
-
* ```tsx
|
|
1680
|
-
* import { noRtlFlip } from '@omnitron-dev/prism/utils';
|
|
1681
|
-
*
|
|
1682
|
-
* // In sx prop or styled components
|
|
1683
|
-
* const styles = {
|
|
1684
|
-
* // This margin-left will stay as margin-left even in RTL
|
|
1685
|
-
* marginLeft: noRtlFlip('10px'),
|
|
1686
|
-
*
|
|
1687
|
-
* // Or for full declarations
|
|
1688
|
-
* transform: noRtlFlip('translateX(100px)'),
|
|
1689
|
-
* };
|
|
1690
|
-
*
|
|
1691
|
-
* // Common use case: icons that shouldn't flip
|
|
1692
|
-
* <ChevronIcon sx={{ transform: noRtlFlip('rotate(0deg)') }} />
|
|
1693
|
-
*
|
|
1694
|
-
* // Progress indicators that fill from left regardless of RTL
|
|
1695
|
-
* <ProgressBar sx={{ left: noRtlFlip('0'), right: 'auto' }} />
|
|
1696
|
-
* ```
|
|
1697
|
-
*/
|
|
1698
|
-
declare function noRtlFlip(cssValue: unknown): string;
|
|
1699
|
-
/**
|
|
1700
|
-
* Check if the current document direction is RTL.
|
|
1701
|
-
*
|
|
1702
|
-
* @returns True if the document direction is RTL
|
|
1703
|
-
*
|
|
1704
|
-
* @example
|
|
1705
|
-
* ```tsx
|
|
1706
|
-
* const isRtl = isRtlDirection();
|
|
1707
|
-
*
|
|
1708
|
-
* // Conditional styling
|
|
1709
|
-
* const style = {
|
|
1710
|
-
* marginLeft: isRtl ? '0' : '10px',
|
|
1711
|
-
* marginRight: isRtl ? '10px' : '0',
|
|
1712
|
-
* };
|
|
1713
|
-
* ```
|
|
1714
|
-
*/
|
|
1715
|
-
declare function isRtlDirection(): boolean;
|
|
1716
|
-
/**
|
|
1717
|
-
* Get the appropriate directional property name based on RTL state.
|
|
1718
|
-
*
|
|
1719
|
-
* @param property - Base property name (e.g., 'left', 'marginLeft')
|
|
1720
|
-
* @param isRtl - Whether the layout is RTL
|
|
1721
|
-
* @returns The appropriate property name
|
|
1722
|
-
*
|
|
1723
|
-
* @example
|
|
1724
|
-
* ```tsx
|
|
1725
|
-
* const prop = getDirectionalProperty('left', isRtl);
|
|
1726
|
-
* // Returns 'right' if isRtl, 'left' otherwise
|
|
1727
|
-
* ```
|
|
1728
|
-
*/
|
|
1729
|
-
declare function getDirectionalProperty(property: 'left' | 'right' | 'marginLeft' | 'marginRight' | 'paddingLeft' | 'paddingRight', isRtl: boolean): string;
|
|
1730
|
-
|
|
1731
|
-
/**
|
|
1732
|
-
* AsyncLock Utility
|
|
1733
|
-
*
|
|
1734
|
-
* Prevents race conditions in async operations like token refresh.
|
|
1735
|
-
* Ensures only one operation runs at a time, with subsequent calls
|
|
1736
|
-
* waiting for and sharing the result of the in-flight operation.
|
|
1737
|
-
*
|
|
1738
|
-
* @module @omnitron-dev/prism/utils
|
|
1739
|
-
*/
|
|
1740
|
-
/**
|
|
1741
|
-
* Options for AsyncLock.
|
|
1742
|
-
*/
|
|
1743
|
-
interface AsyncLockOptions {
|
|
1744
|
-
/** Timeout in milliseconds for the lock acquisition (default: 30000) */
|
|
1745
|
-
timeout?: number;
|
|
1746
|
-
/** Custom error message for timeout */
|
|
1747
|
-
timeoutMessage?: string;
|
|
1748
|
-
}
|
|
1749
|
-
/**
|
|
1750
|
-
* Result from a locked operation.
|
|
1751
|
-
*/
|
|
1752
|
-
interface AsyncLockResult<T> {
|
|
1753
|
-
/** The result value */
|
|
1754
|
-
value: T;
|
|
1755
|
-
/** Whether this call executed the operation (vs waiting for another) */
|
|
1756
|
-
wasExecutor: boolean;
|
|
1757
|
-
}
|
|
1758
|
-
/**
|
|
1759
|
-
* State of the lock.
|
|
1760
|
-
*/
|
|
1761
|
-
type AsyncLockState = 'idle' | 'locked' | 'releasing';
|
|
1762
|
-
/**
|
|
1763
|
-
* AsyncLock prevents race conditions in concurrent async operations.
|
|
1764
|
-
*
|
|
1765
|
-
* Use cases:
|
|
1766
|
-
* - Token refresh: Multiple API calls fail simultaneously, only one should refresh
|
|
1767
|
-
* - Resource initialization: Expensive setup should happen once
|
|
1768
|
-
* - Cache population: Prevent thundering herd problem
|
|
1769
|
-
*
|
|
1770
|
-
* @example
|
|
1771
|
-
* ```tsx
|
|
1772
|
-
* import { AsyncLock } from '@omnitron-dev/prism/utils';
|
|
1773
|
-
*
|
|
1774
|
-
* const tokenRefreshLock = new AsyncLock({ timeout: 10000 });
|
|
1775
|
-
*
|
|
1776
|
-
* async function refreshToken(): Promise<string> {
|
|
1777
|
-
* const { value: newToken } = await tokenRefreshLock.acquire(
|
|
1778
|
-
* 'refresh-token',
|
|
1779
|
-
* async () => {
|
|
1780
|
-
* // This only runs once even if called concurrently
|
|
1781
|
-
* const response = await fetch('/auth/refresh', { method: 'POST' });
|
|
1782
|
-
* const data = await response.json();
|
|
1783
|
-
* return data.accessToken;
|
|
1784
|
-
* }
|
|
1785
|
-
* );
|
|
1786
|
-
* return newToken;
|
|
1787
|
-
* }
|
|
1788
|
-
*
|
|
1789
|
-
* // Multiple concurrent calls share the same result
|
|
1790
|
-
* const [token1, token2, token3] = await Promise.all([
|
|
1791
|
-
* refreshToken(), // Executes the actual refresh
|
|
1792
|
-
* refreshToken(), // Waits for first to complete
|
|
1793
|
-
* refreshToken(), // Waits for first to complete
|
|
1794
|
-
* ]);
|
|
1795
|
-
* // token1 === token2 === token3
|
|
1796
|
-
* ```
|
|
1797
|
-
*/
|
|
1798
|
-
declare class AsyncLock {
|
|
1799
|
-
private locks;
|
|
1800
|
-
private resolvers;
|
|
1801
|
-
private rejecters;
|
|
1802
|
-
private options;
|
|
1803
|
-
constructor(options?: AsyncLockOptions);
|
|
1804
|
-
/**
|
|
1805
|
-
* Current state of a specific lock.
|
|
1806
|
-
*/
|
|
1807
|
-
getState(key: string): AsyncLockState;
|
|
1808
|
-
/**
|
|
1809
|
-
* Check if a specific lock is currently held.
|
|
1810
|
-
*/
|
|
1811
|
-
isLocked(key: string): boolean;
|
|
1812
|
-
/**
|
|
1813
|
-
* Get all currently active lock keys.
|
|
1814
|
-
*/
|
|
1815
|
-
getActiveLocks(): string[];
|
|
1816
|
-
/**
|
|
1817
|
-
* Acquire the lock and execute the operation.
|
|
1818
|
-
* If the lock is already held, waits for the existing operation.
|
|
1819
|
-
*
|
|
1820
|
-
* @param key - Unique identifier for this lock
|
|
1821
|
-
* @param operation - Async operation to execute
|
|
1822
|
-
* @returns Result with the value and whether this call was the executor
|
|
1823
|
-
*/
|
|
1824
|
-
acquire<T>(key: string, operation: () => Promise<T>): Promise<AsyncLockResult<T>>;
|
|
1825
|
-
/**
|
|
1826
|
-
* Try to acquire the lock without waiting.
|
|
1827
|
-
* Returns immediately if lock is held.
|
|
1828
|
-
*
|
|
1829
|
-
* @param key - Unique identifier for this lock
|
|
1830
|
-
* @param operation - Async operation to execute
|
|
1831
|
-
* @returns Result or null if lock was already held
|
|
1832
|
-
*/
|
|
1833
|
-
tryAcquire<T>(key: string, operation: () => Promise<T>): Promise<AsyncLockResult<T> | null>;
|
|
1834
|
-
/**
|
|
1835
|
-
* Force release a lock (use with caution).
|
|
1836
|
-
* This will reject all waiters with the provided error.
|
|
1837
|
-
*/
|
|
1838
|
-
forceRelease(key: string, error?: Error): void;
|
|
1839
|
-
/**
|
|
1840
|
-
* Clear all locks (use with caution, e.g., on logout).
|
|
1841
|
-
*/
|
|
1842
|
-
clearAll(error?: Error): void;
|
|
1843
|
-
/**
|
|
1844
|
-
* Wait for a promise with timeout.
|
|
1845
|
-
*/
|
|
1846
|
-
private waitWithTimeout;
|
|
1847
|
-
}
|
|
1848
|
-
/**
|
|
1849
|
-
* Error thrown when lock acquisition times out.
|
|
1850
|
-
*/
|
|
1851
|
-
declare class AsyncLockTimeoutError extends Error {
|
|
1852
|
-
readonly name = "AsyncLockTimeoutError";
|
|
1853
|
-
constructor(message: string);
|
|
1854
|
-
}
|
|
1855
|
-
/**
|
|
1856
|
-
* Create a singleton AsyncLock instance for a specific use case.
|
|
1857
|
-
*
|
|
1858
|
-
* @example
|
|
1859
|
-
* ```tsx
|
|
1860
|
-
* import { createAsyncLock } from '@omnitron-dev/prism/utils';
|
|
1861
|
-
*
|
|
1862
|
-
* // Create a singleton lock for token refresh
|
|
1863
|
-
* const tokenLock = createAsyncLock({ timeout: 10000 });
|
|
1864
|
-
*
|
|
1865
|
-
* // Use in multiple places - same lock instance
|
|
1866
|
-
* async function apiCall() {
|
|
1867
|
-
* if (isTokenExpired()) {
|
|
1868
|
-
* await tokenLock.acquire('token', refreshToken);
|
|
1869
|
-
* }
|
|
1870
|
-
* // Make API call...
|
|
1871
|
-
* }
|
|
1872
|
-
* ```
|
|
1873
|
-
*/
|
|
1874
|
-
declare function createAsyncLock(options?: AsyncLockOptions): AsyncLock;
|
|
1875
|
-
/**
|
|
1876
|
-
* Create a pre-configured lock for token refresh operations.
|
|
1877
|
-
* Uses sensible defaults for auth token refresh scenarios.
|
|
1878
|
-
*/
|
|
1879
|
-
declare function createTokenRefreshLock(): AsyncLock;
|
|
1880
|
-
declare function withLock<T>(key: string, operation: () => Promise<T>, options?: AsyncLockOptions): Promise<T>;
|
|
1881
|
-
/**
|
|
1882
|
-
* Decorator factory for methods that should be locked.
|
|
1883
|
-
* Use with class methods to ensure single execution.
|
|
1884
|
-
*
|
|
1885
|
-
* @example
|
|
1886
|
-
* ```tsx
|
|
1887
|
-
* import { locked } from '@omnitron-dev/prism/utils';
|
|
1888
|
-
*
|
|
1889
|
-
* class AuthService {
|
|
1890
|
-
* @locked('refresh')
|
|
1891
|
-
* async refreshToken(): Promise<string> {
|
|
1892
|
-
* // Only one instance runs at a time
|
|
1893
|
-
* return await this.doRefresh();
|
|
1894
|
-
* }
|
|
1895
|
-
* }
|
|
1896
|
-
* ```
|
|
1897
|
-
*/
|
|
1898
|
-
declare function locked(key: string, options?: AsyncLockOptions): <T extends (...args: unknown[]) => Promise<unknown>>(_target: object, _propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
1899
|
-
|
|
1900
|
-
/**
|
|
1901
|
-
* Error Handling Utilities
|
|
1902
|
-
*
|
|
1903
|
-
* Comprehensive error handling with i18n support, error classification,
|
|
1904
|
-
* and retry logic for robust frontend applications.
|
|
1905
|
-
*
|
|
1906
|
-
* @module @omnitron-dev/prism/utils
|
|
1907
|
-
*/
|
|
1908
|
-
/**
|
|
1909
|
-
* Error codes for classification.
|
|
1910
|
-
*/
|
|
1911
|
-
type ErrorCode = 'AUTH_REQUIRED' | 'AUTH_EXPIRED' | 'AUTH_INVALID' | 'AUTH_FORBIDDEN' | 'AUTH_MFA_REQUIRED' | 'AUTH_DEVICE_BLOCKED' | 'NETWORK_ERROR' | 'NETWORK_TIMEOUT' | 'NETWORK_OFFLINE' | 'VALIDATION_ERROR' | 'VALIDATION_REQUIRED' | 'VALIDATION_FORMAT' | 'VALIDATION_RANGE' | 'SERVER_ERROR' | 'SERVER_UNAVAILABLE' | 'SERVER_MAINTENANCE' | 'NOT_FOUND' | 'CONFLICT' | 'RATE_LIMITED' | 'QUOTA_EXCEEDED' | 'UNKNOWN_ERROR' | string;
|
|
1912
|
-
/**
|
|
1913
|
-
* Severity levels for errors.
|
|
1914
|
-
*/
|
|
1915
|
-
type ErrorSeverity = 'error' | 'warning' | 'info';
|
|
1916
|
-
/**
|
|
1917
|
-
* Error context for i18n.
|
|
1918
|
-
*/
|
|
1919
|
-
interface ErrorContext$1 {
|
|
1920
|
-
/** Error code for lookup */
|
|
1921
|
-
code: ErrorCode;
|
|
1922
|
-
/** HTTP status code if applicable */
|
|
1923
|
-
status?: number;
|
|
1924
|
-
/** Field name for validation errors */
|
|
1925
|
-
field?: string;
|
|
1926
|
-
/** Additional interpolation values */
|
|
1927
|
-
values?: Record<string, string | number>;
|
|
1928
|
-
/** Original error message (fallback) */
|
|
1929
|
-
message?: string;
|
|
1930
|
-
/** Retry information */
|
|
1931
|
-
retryAfter?: number;
|
|
1932
|
-
/** Severity level */
|
|
1933
|
-
severity?: ErrorSeverity;
|
|
1934
|
-
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Translated error result.
|
|
1937
|
-
*/
|
|
1938
|
-
interface TranslatedError {
|
|
1939
|
-
/** Translated title */
|
|
1940
|
-
title: string;
|
|
1941
|
-
/** Translated message */
|
|
1942
|
-
message: string;
|
|
1943
|
-
/** Error code */
|
|
1944
|
-
code: ErrorCode;
|
|
1945
|
-
/** Severity */
|
|
1946
|
-
severity: ErrorSeverity;
|
|
1947
|
-
/** Action hint (e.g., "Please log in again") */
|
|
1948
|
-
action?: string;
|
|
1949
|
-
/** Retry after seconds */
|
|
1950
|
-
retryAfter?: number;
|
|
1951
|
-
/** Is this a retryable error */
|
|
1952
|
-
canRetry: boolean;
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Translation function type.
|
|
1956
|
-
*/
|
|
1957
|
-
type TranslateFn = (key: string, values?: Record<string, string | number>) => string;
|
|
1958
|
-
/**
|
|
1959
|
-
* Error messages dictionary type.
|
|
1960
|
-
*/
|
|
1961
|
-
interface ErrorMessages {
|
|
1962
|
-
[code: string]: {
|
|
1963
|
-
title: string;
|
|
1964
|
-
message: string;
|
|
1965
|
-
action?: string;
|
|
1966
|
-
};
|
|
1967
|
-
}
|
|
1968
|
-
/**
|
|
1969
|
-
* Default error messages in English.
|
|
1970
|
-
* Can be replaced with i18n translations.
|
|
1971
|
-
*/
|
|
1972
|
-
declare const DEFAULT_ERROR_MESSAGES: ErrorMessages;
|
|
1973
|
-
/**
|
|
1974
|
-
* Classify an error by HTTP status code.
|
|
1975
|
-
*/
|
|
1976
|
-
declare function classifyHttpError(status: number): ErrorCode;
|
|
1977
|
-
/**
|
|
1978
|
-
* Check if an error is a network error.
|
|
1979
|
-
*/
|
|
1980
|
-
declare function isNetworkError(error: unknown): boolean;
|
|
1981
|
-
/**
|
|
1982
|
-
* Check if an error is retryable.
|
|
1983
|
-
*/
|
|
1984
|
-
declare function isRetryableError(code: ErrorCode): boolean;
|
|
1985
|
-
/**
|
|
1986
|
-
* Get severity for an error code.
|
|
1987
|
-
*/
|
|
1988
|
-
declare function getErrorSeverity(code: ErrorCode): ErrorSeverity;
|
|
1989
|
-
/**
|
|
1990
|
-
* Create an error translator with custom messages or i18n function.
|
|
1991
|
-
*
|
|
1992
|
-
* @example
|
|
1993
|
-
* ```tsx
|
|
1994
|
-
* // With custom messages
|
|
1995
|
-
* const translate = createErrorTranslator({
|
|
1996
|
-
* messages: {
|
|
1997
|
-
* AUTH_REQUIRED: {
|
|
1998
|
-
* title: 'Необходима авторизация',
|
|
1999
|
-
* message: 'Пожалуйста, войдите в систему.',
|
|
2000
|
-
* },
|
|
2001
|
-
* },
|
|
2002
|
-
* });
|
|
2003
|
-
*
|
|
2004
|
-
* // With i18n library
|
|
2005
|
-
* const translate = createErrorTranslator({
|
|
2006
|
-
* t: (key, values) => i18n.t(key, values),
|
|
2007
|
-
* });
|
|
2008
|
-
*
|
|
2009
|
-
* const error = translate({ code: 'AUTH_REQUIRED', status: 401 });
|
|
2010
|
-
* // { title: 'Необходима авторизация', message: '...', ... }
|
|
2011
|
-
* ```
|
|
2012
|
-
*/
|
|
2013
|
-
declare function createErrorTranslator(options: {
|
|
2014
|
-
messages?: ErrorMessages;
|
|
2015
|
-
t?: TranslateFn;
|
|
2016
|
-
fallbackMessages?: ErrorMessages;
|
|
2017
|
-
}): (context: ErrorContext$1) => TranslatedError;
|
|
2018
|
-
/**
|
|
2019
|
-
* Extract error context from various error types.
|
|
2020
|
-
*
|
|
2021
|
-
* @example
|
|
2022
|
-
* ```tsx
|
|
2023
|
-
* try {
|
|
2024
|
-
* await api.call();
|
|
2025
|
-
* } catch (error) {
|
|
2026
|
-
* const context = extractErrorContext(error);
|
|
2027
|
-
* const translated = translateError(context);
|
|
2028
|
-
* showNotification(translated);
|
|
2029
|
-
* }
|
|
2030
|
-
* ```
|
|
2031
|
-
*/
|
|
2032
|
-
declare function extractErrorContext(error: unknown): ErrorContext$1;
|
|
2033
|
-
/**
|
|
2034
|
-
* Retry configuration.
|
|
2035
|
-
*/
|
|
2036
|
-
interface RetryConfig {
|
|
2037
|
-
/** Maximum number of retries */
|
|
2038
|
-
maxRetries?: number;
|
|
2039
|
-
/** Initial delay in ms */
|
|
2040
|
-
initialDelay?: number;
|
|
2041
|
-
/** Maximum delay in ms */
|
|
2042
|
-
maxDelay?: number;
|
|
2043
|
-
/** Exponential backoff factor */
|
|
2044
|
-
backoffFactor?: number;
|
|
2045
|
-
/** Add jitter to delays */
|
|
2046
|
-
jitter?: boolean;
|
|
2047
|
-
/** Custom retry condition */
|
|
2048
|
-
shouldRetry?: (error: unknown, attempt: number) => boolean;
|
|
2049
|
-
/** Called before each retry */
|
|
2050
|
-
onRetry?: (error: unknown, attempt: number, delay: number) => void;
|
|
2051
|
-
}
|
|
2052
|
-
/**
|
|
2053
|
-
* Execute an async operation with automatic retry.
|
|
2054
|
-
*
|
|
2055
|
-
* @example
|
|
2056
|
-
* ```tsx
|
|
2057
|
-
* const result = await withRetry(
|
|
2058
|
-
* () => fetch('/api/data'),
|
|
2059
|
-
* {
|
|
2060
|
-
* maxRetries: 3,
|
|
2061
|
-
* onRetry: (error, attempt, delay) => {
|
|
2062
|
-
* console.log(`Retry ${attempt} after ${delay}ms`);
|
|
2063
|
-
* },
|
|
2064
|
-
* }
|
|
2065
|
-
* );
|
|
2066
|
-
* ```
|
|
2067
|
-
*/
|
|
2068
|
-
declare function withRetry<T>(operation: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
2069
|
-
/**
|
|
2070
|
-
* Check if error is a chunk load error (code splitting failure).
|
|
2071
|
-
*/
|
|
2072
|
-
declare function isChunkLoadError(error: unknown): boolean;
|
|
2073
|
-
/**
|
|
2074
|
-
* Check if error is a session expiry error.
|
|
2075
|
-
*/
|
|
2076
|
-
declare function isSessionExpiredError(error: unknown): boolean;
|
|
2077
|
-
/**
|
|
2078
|
-
* Create a handler for error boundary recovery.
|
|
2079
|
-
*/
|
|
2080
|
-
declare function createErrorRecoveryHandler(options: {
|
|
2081
|
-
onChunkError?: () => void;
|
|
2082
|
-
onSessionExpired?: () => void;
|
|
2083
|
-
onNetworkError?: () => void;
|
|
2084
|
-
onGenericError?: (error: unknown) => void;
|
|
2085
|
-
}): (error: unknown) => void;
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
* Fetch Interceptor Factory
|
|
2089
|
-
*
|
|
2090
|
-
* A flexible fetch wrapper with support for request/response interceptors,
|
|
2091
|
-
* automatic token refresh, and retry logic.
|
|
2092
|
-
*
|
|
2093
|
-
* Designed for production applications that need centralized HTTP handling.
|
|
2094
|
-
*
|
|
2095
|
-
* @module @omnitron-dev/prism/utils
|
|
2096
|
-
*/
|
|
2097
|
-
|
|
2098
|
-
/**
|
|
2099
|
-
* Extended request init with additional options.
|
|
2100
|
-
*/
|
|
2101
|
-
interface FetchRequestInit extends RequestInit {
|
|
2102
|
-
/** Skip all interceptors for this request */
|
|
2103
|
-
skipInterceptors?: boolean;
|
|
2104
|
-
/** Skip request interceptors only */
|
|
2105
|
-
skipRequestInterceptors?: boolean;
|
|
2106
|
-
/** Skip response interceptors only */
|
|
2107
|
-
skipResponseInterceptors?: boolean;
|
|
2108
|
-
/** Custom timeout in milliseconds */
|
|
2109
|
-
timeout?: number;
|
|
2110
|
-
/** Enable automatic retry on failure */
|
|
2111
|
-
retry?: boolean | RetryConfig;
|
|
2112
|
-
/** Request metadata for logging/debugging */
|
|
2113
|
-
metadata?: Record<string, unknown>;
|
|
2114
|
-
}
|
|
2115
|
-
/**
|
|
2116
|
-
* Request interceptor context.
|
|
2117
|
-
*/
|
|
2118
|
-
interface RequestContext {
|
|
2119
|
-
url: string;
|
|
2120
|
-
init: FetchRequestInit;
|
|
2121
|
-
/** Original request info (can be string or Request) */
|
|
2122
|
-
input: RequestInfo | URL;
|
|
2123
|
-
/** Request metadata */
|
|
2124
|
-
metadata: Record<string, unknown>;
|
|
2125
|
-
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Response interceptor context.
|
|
2128
|
-
*/
|
|
2129
|
-
interface ResponseContext {
|
|
2130
|
-
response: Response;
|
|
2131
|
-
request: RequestContext;
|
|
2132
|
-
/** Time taken for the request in ms */
|
|
2133
|
-
duration: number;
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* Error interceptor context.
|
|
2137
|
-
*/
|
|
2138
|
-
interface ErrorContext {
|
|
2139
|
-
error: unknown;
|
|
2140
|
-
request: RequestContext;
|
|
2141
|
-
/** Time taken before error in ms */
|
|
2142
|
-
duration: number;
|
|
2143
|
-
/** Number of retry attempts made */
|
|
2144
|
-
retryCount: number;
|
|
2145
|
-
}
|
|
2146
|
-
/**
|
|
2147
|
-
* Request interceptor function.
|
|
2148
|
-
* Can modify the request or return a new one.
|
|
2149
|
-
*/
|
|
2150
|
-
type RequestInterceptor = (ctx: RequestContext) => RequestContext | Promise<RequestContext>;
|
|
2151
|
-
/**
|
|
2152
|
-
* Response interceptor function.
|
|
2153
|
-
* Can modify the response or return a new one.
|
|
2154
|
-
*/
|
|
2155
|
-
type ResponseInterceptor = (ctx: ResponseContext) => Response | Promise<Response>;
|
|
2156
|
-
/**
|
|
2157
|
-
* Error interceptor function.
|
|
2158
|
-
* Can handle the error, retry, or rethrow.
|
|
2159
|
-
*/
|
|
2160
|
-
type ErrorInterceptor = (ctx: ErrorContext) => Response | Promise<Response> | never;
|
|
2161
|
-
/**
|
|
2162
|
-
* Interceptor configuration.
|
|
2163
|
-
*/
|
|
2164
|
-
interface FetchInterceptorConfig {
|
|
2165
|
-
/** Base URL to prepend to relative paths */
|
|
2166
|
-
baseUrl?: string;
|
|
2167
|
-
/** Default headers for all requests */
|
|
2168
|
-
defaultHeaders?: HeadersInit;
|
|
2169
|
-
/** Default timeout in milliseconds (0 = no timeout) */
|
|
2170
|
-
defaultTimeout?: number;
|
|
2171
|
-
/** Request interceptors (run in order) */
|
|
2172
|
-
requestInterceptors?: RequestInterceptor[];
|
|
2173
|
-
/** Response interceptors (run in order) */
|
|
2174
|
-
responseInterceptors?: ResponseInterceptor[];
|
|
2175
|
-
/** Error interceptors (run in order, first to handle wins) */
|
|
2176
|
-
errorInterceptors?: ErrorInterceptor[];
|
|
2177
|
-
/** Default retry configuration */
|
|
2178
|
-
defaultRetry?: RetryConfig | false;
|
|
2179
|
-
/** Credentials mode for all requests */
|
|
2180
|
-
credentials?: RequestCredentials;
|
|
2181
|
-
}
|
|
2182
|
-
/**
|
|
2183
|
-
* Token refresh handler configuration.
|
|
2184
|
-
*/
|
|
2185
|
-
interface TokenRefreshConfig {
|
|
2186
|
-
/** Check if a response indicates token expiration */
|
|
2187
|
-
isTokenExpired: (response: Response) => boolean;
|
|
2188
|
-
/** Refresh the token (called when token is expired) */
|
|
2189
|
-
refreshToken: () => Promise<string | null>;
|
|
2190
|
-
/** Get the current access token */
|
|
2191
|
-
getAccessToken: () => string | null;
|
|
2192
|
-
/** Called when refresh fails (e.g., redirect to login) */
|
|
2193
|
-
onRefreshFailure?: () => void;
|
|
2194
|
-
/** Maximum number of refresh attempts */
|
|
2195
|
-
maxRefreshAttempts?: number;
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Fetch client interface.
|
|
2199
|
-
*/
|
|
2200
|
-
interface FetchClient {
|
|
2201
|
-
/** Make a fetch request */
|
|
2202
|
-
fetch: (input: RequestInfo | URL, init?: FetchRequestInit) => Promise<Response>;
|
|
2203
|
-
/** Add a request interceptor */
|
|
2204
|
-
addRequestInterceptor: (interceptor: RequestInterceptor) => () => void;
|
|
2205
|
-
/** Add a response interceptor */
|
|
2206
|
-
addResponseInterceptor: (interceptor: ResponseInterceptor) => () => void;
|
|
2207
|
-
/** Add an error interceptor */
|
|
2208
|
-
addErrorInterceptor: (interceptor: ErrorInterceptor) => () => void;
|
|
2209
|
-
/** Remove all interceptors */
|
|
2210
|
-
clearInterceptors: () => void;
|
|
2211
|
-
/** Get current configuration */
|
|
2212
|
-
getConfig: () => FetchInterceptorConfig;
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Create a fetch client with interceptor support.
|
|
2216
|
-
*
|
|
2217
|
-
* @example
|
|
2218
|
-
* ```tsx
|
|
2219
|
-
* // Basic usage
|
|
2220
|
-
* const api = createFetchClient({
|
|
2221
|
-
* baseUrl: 'https://api.example.com',
|
|
2222
|
-
* defaultHeaders: { 'Content-Type': 'application/json' },
|
|
2223
|
-
* defaultTimeout: 30000,
|
|
2224
|
-
* });
|
|
2225
|
-
*
|
|
2226
|
-
* // Add auth header interceptor
|
|
2227
|
-
* api.addRequestInterceptor(async (ctx) => {
|
|
2228
|
-
* const token = getAccessToken();
|
|
2229
|
-
* if (token) {
|
|
2230
|
-
* ctx.init.headers = {
|
|
2231
|
-
* ...ctx.init.headers,
|
|
2232
|
-
* Authorization: `Bearer ${token}`,
|
|
2233
|
-
* };
|
|
2234
|
-
* }
|
|
2235
|
-
* return ctx;
|
|
2236
|
-
* });
|
|
2237
|
-
*
|
|
2238
|
-
* // Add response logging
|
|
2239
|
-
* api.addResponseInterceptor(async (ctx) => {
|
|
2240
|
-
* console.log(`${ctx.request.init.method} ${ctx.request.url} - ${ctx.response.status} (${ctx.duration}ms)`);
|
|
2241
|
-
* return ctx.response;
|
|
2242
|
-
* });
|
|
2243
|
-
*
|
|
2244
|
-
* // Make requests
|
|
2245
|
-
* const response = await api.fetch('/users');
|
|
2246
|
-
* const data = await response.json();
|
|
2247
|
-
* ```
|
|
2248
|
-
*/
|
|
2249
|
-
declare function createFetchClient(config?: FetchInterceptorConfig): FetchClient;
|
|
2250
|
-
/**
|
|
2251
|
-
* Create a token refresh interceptor that automatically refreshes
|
|
2252
|
-
* expired tokens and retries failed requests.
|
|
2253
|
-
*
|
|
2254
|
-
* Uses AsyncLock to prevent multiple simultaneous refresh attempts.
|
|
2255
|
-
*
|
|
2256
|
-
* @example
|
|
2257
|
-
* ```tsx
|
|
2258
|
-
* const api = createFetchClient({ baseUrl: '/api' });
|
|
2259
|
-
*
|
|
2260
|
-
* const { addToClient } = createTokenRefreshInterceptor({
|
|
2261
|
-
* isTokenExpired: (response) => response.status === 401,
|
|
2262
|
-
* refreshToken: async () => {
|
|
2263
|
-
* const response = await fetch('/auth/refresh', { method: 'POST' });
|
|
2264
|
-
* const data = await response.json();
|
|
2265
|
-
* localStorage.setItem('token', data.accessToken);
|
|
2266
|
-
* return data.accessToken;
|
|
2267
|
-
* },
|
|
2268
|
-
* getAccessToken: () => localStorage.getItem('token'),
|
|
2269
|
-
* onRefreshFailure: () => {
|
|
2270
|
-
* localStorage.removeItem('token');
|
|
2271
|
-
* window.location.href = '/login';
|
|
2272
|
-
* },
|
|
2273
|
-
* });
|
|
2274
|
-
*
|
|
2275
|
-
* addToClient(api);
|
|
2276
|
-
* ```
|
|
2277
|
-
*/
|
|
2278
|
-
declare function createTokenRefreshInterceptor(config: TokenRefreshConfig): {
|
|
2279
|
-
addToClient: (client: FetchClient) => void;
|
|
2280
|
-
refreshLock: AsyncLock;
|
|
2281
|
-
};
|
|
2282
|
-
/**
|
|
2283
|
-
* Create a simple JSON API client.
|
|
2284
|
-
*
|
|
2285
|
-
* @example
|
|
2286
|
-
* ```tsx
|
|
2287
|
-
* const api = createJsonApiClient({
|
|
2288
|
-
* baseUrl: 'https://api.example.com',
|
|
2289
|
-
* getAuthToken: () => localStorage.getItem('token'),
|
|
2290
|
-
* });
|
|
2291
|
-
*
|
|
2292
|
-
* // GET request
|
|
2293
|
-
* const users = await api.get<User[]>('/users');
|
|
2294
|
-
*
|
|
2295
|
-
* // POST request
|
|
2296
|
-
* const newUser = await api.post<User>('/users', { name: 'John' });
|
|
2297
|
-
*
|
|
2298
|
-
* // DELETE request
|
|
2299
|
-
* await api.delete('/users/1');
|
|
2300
|
-
* ```
|
|
2301
|
-
*/
|
|
2302
|
-
declare function createJsonApiClient(options: {
|
|
2303
|
-
baseUrl?: string;
|
|
2304
|
-
getAuthToken?: () => string | null;
|
|
2305
|
-
defaultHeaders?: Record<string, string>;
|
|
2306
|
-
timeout?: number;
|
|
2307
|
-
}): {
|
|
2308
|
-
client: FetchClient;
|
|
2309
|
-
get: <T>(path: string) => Promise<T | null>;
|
|
2310
|
-
post: <T>(path: string, body?: unknown) => Promise<T | null>;
|
|
2311
|
-
put: <T>(path: string, body?: unknown) => Promise<T | null>;
|
|
2312
|
-
patch: <T>(path: string, body?: unknown) => Promise<T | null>;
|
|
2313
|
-
delete: <T>(path: string) => Promise<T | null>;
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
/**
|
|
2317
|
-
* JWT Utilities
|
|
2318
|
-
*
|
|
2319
|
-
* Client-side JWT decoding and validation utilities.
|
|
2320
|
-
* These utilities do NOT verify signatures - they only decode and check expiration.
|
|
2321
|
-
* For signature verification, use server-side libraries.
|
|
2322
|
-
*
|
|
2323
|
-
* @module @omnitron-dev/prism/utils
|
|
2324
|
-
*/
|
|
2325
|
-
/**
|
|
2326
|
-
* Standard JWT claims.
|
|
2327
|
-
* @see https://datatracker.ietf.org/doc/html/rfc7519#section-4.1
|
|
2328
|
-
*/
|
|
2329
|
-
interface JwtStandardClaims {
|
|
2330
|
-
/** Issuer */
|
|
2331
|
-
iss?: string;
|
|
2332
|
-
/** Subject */
|
|
2333
|
-
sub?: string;
|
|
2334
|
-
/** Audience */
|
|
2335
|
-
aud?: string | string[];
|
|
2336
|
-
/** Expiration time (Unix timestamp in seconds) */
|
|
2337
|
-
exp?: number;
|
|
2338
|
-
/** Not before (Unix timestamp in seconds) */
|
|
2339
|
-
nbf?: number;
|
|
2340
|
-
/** Issued at (Unix timestamp in seconds) */
|
|
2341
|
-
iat?: number;
|
|
2342
|
-
/** JWT ID */
|
|
2343
|
-
jti?: string;
|
|
2344
|
-
}
|
|
2345
|
-
/**
|
|
2346
|
-
* JWT payload with custom claims.
|
|
2347
|
-
* Extends standard claims with any additional properties.
|
|
2348
|
-
*/
|
|
2349
|
-
interface JwtPayload extends JwtStandardClaims {
|
|
2350
|
-
/** User ID (common custom claim) */
|
|
2351
|
-
userId?: string;
|
|
2352
|
-
/** Email (common custom claim) */
|
|
2353
|
-
email?: string;
|
|
2354
|
-
/** Roles (common custom claim) */
|
|
2355
|
-
roles?: string[];
|
|
2356
|
-
/** Permissions (common custom claim) */
|
|
2357
|
-
permissions?: string[];
|
|
2358
|
-
/** Any additional custom claims */
|
|
2359
|
-
[key: string]: unknown;
|
|
2360
|
-
}
|
|
2361
|
-
/**
|
|
2362
|
-
* JWT validation options.
|
|
2363
|
-
*/
|
|
2364
|
-
interface JwtValidationOptions {
|
|
2365
|
-
/** Clock skew tolerance in seconds (default: 60) */
|
|
2366
|
-
clockTolerance?: number;
|
|
2367
|
-
/** Require expiration claim (default: true) */
|
|
2368
|
-
requireExp?: boolean;
|
|
2369
|
-
}
|
|
2370
|
-
/**
|
|
2371
|
-
* JWT decode result.
|
|
2372
|
-
*/
|
|
2373
|
-
interface JwtDecodeResult<T extends JwtPayload = JwtPayload> {
|
|
2374
|
-
/** Decoded header */
|
|
2375
|
-
header: {
|
|
2376
|
-
alg: string;
|
|
2377
|
-
typ?: string;
|
|
2378
|
-
[key: string]: unknown;
|
|
2379
|
-
};
|
|
2380
|
-
/** Decoded payload */
|
|
2381
|
-
payload: T;
|
|
2382
|
-
/** Original signature (base64url encoded, NOT verified) */
|
|
2383
|
-
signature: string;
|
|
2384
|
-
}
|
|
2385
|
-
/**
|
|
2386
|
-
* Decode a JWT token without verifying the signature.
|
|
2387
|
-
*
|
|
2388
|
-
* ⚠️ WARNING: This function does NOT verify the signature.
|
|
2389
|
-
* Only use for client-side display purposes. Never trust decoded
|
|
2390
|
-
* data for authorization decisions without server-side verification.
|
|
2391
|
-
*
|
|
2392
|
-
* @param token - The JWT token string
|
|
2393
|
-
* @returns Decoded JWT parts (header, payload, signature)
|
|
2394
|
-
* @throws Error if the token is malformed
|
|
2395
|
-
*
|
|
2396
|
-
* @example
|
|
2397
|
-
* ```tsx
|
|
2398
|
-
* const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
|
|
2399
|
-
*
|
|
2400
|
-
* try {
|
|
2401
|
-
* const { header, payload } = jwtDecode(token);
|
|
2402
|
-
* console.log('Algorithm:', header.alg);
|
|
2403
|
-
* console.log('User ID:', payload.sub);
|
|
2404
|
-
* console.log('Expires:', new Date(payload.exp! * 1000));
|
|
2405
|
-
* } catch (error) {
|
|
2406
|
-
* console.error('Invalid token:', error.message);
|
|
2407
|
-
* }
|
|
2408
|
-
* ```
|
|
2409
|
-
*/
|
|
2410
|
-
declare function jwtDecode<T extends JwtPayload = JwtPayload>(token: string): JwtDecodeResult<T>;
|
|
2411
|
-
/**
|
|
2412
|
-
* Decode only the payload from a JWT token.
|
|
2413
|
-
* Convenience function when you only need the claims.
|
|
2414
|
-
*
|
|
2415
|
-
* @param token - The JWT token string
|
|
2416
|
-
* @returns Decoded payload
|
|
2417
|
-
* @throws Error if the token is malformed
|
|
2418
|
-
*
|
|
2419
|
-
* @example
|
|
2420
|
-
* ```tsx
|
|
2421
|
-
* const payload = jwtDecodePayload(token);
|
|
2422
|
-
* console.log('User:', payload.email);
|
|
2423
|
-
* ```
|
|
2424
|
-
*/
|
|
2425
|
-
declare function jwtDecodePayload<T extends JwtPayload = JwtPayload>(token: string): T;
|
|
2426
|
-
/**
|
|
2427
|
-
* Check if a JWT token is expired.
|
|
2428
|
-
*
|
|
2429
|
-
* @param token - The JWT token string
|
|
2430
|
-
* @param options - Validation options
|
|
2431
|
-
* @returns true if the token is expired or invalid, false if still valid
|
|
2432
|
-
*
|
|
2433
|
-
* @example
|
|
2434
|
-
* ```tsx
|
|
2435
|
-
* if (isTokenExpired(token)) {
|
|
2436
|
-
* // Redirect to login or refresh token
|
|
2437
|
-
* refreshAccessToken();
|
|
2438
|
-
* }
|
|
2439
|
-
* ```
|
|
2440
|
-
*/
|
|
2441
|
-
declare function isTokenExpired(token: string, options?: JwtValidationOptions): boolean;
|
|
2442
|
-
/**
|
|
2443
|
-
* Check if a JWT token is valid (not expired, not before nbf).
|
|
2444
|
-
*
|
|
2445
|
-
* @param token - The JWT token string
|
|
2446
|
-
* @param options - Validation options
|
|
2447
|
-
* @returns true if the token is valid, false otherwise
|
|
2448
|
-
*
|
|
2449
|
-
* @example
|
|
2450
|
-
* ```tsx
|
|
2451
|
-
* function AuthProvider({ children }) {
|
|
2452
|
-
* const [token] = useLocalStorage('accessToken');
|
|
2453
|
-
*
|
|
2454
|
-
* if (!token || !isValidToken(token)) {
|
|
2455
|
-
* return <Navigate to="/login" />;
|
|
2456
|
-
* }
|
|
2457
|
-
*
|
|
2458
|
-
* return children;
|
|
2459
|
-
* }
|
|
2460
|
-
* ```
|
|
2461
|
-
*/
|
|
2462
|
-
declare function isValidToken(token: string, options?: JwtValidationOptions): boolean;
|
|
2463
|
-
/**
|
|
2464
|
-
* Get time until token expires in seconds.
|
|
2465
|
-
* Returns 0 if token is already expired or invalid.
|
|
2466
|
-
*
|
|
2467
|
-
* @param token - The JWT token string
|
|
2468
|
-
* @returns Seconds until expiration, or 0 if expired/invalid
|
|
2469
|
-
*
|
|
2470
|
-
* @example
|
|
2471
|
-
* ```tsx
|
|
2472
|
-
* const secondsLeft = getTokenTimeLeft(token);
|
|
2473
|
-
*
|
|
2474
|
-
* if (secondsLeft < 300) {
|
|
2475
|
-
* // Less than 5 minutes left, refresh proactively
|
|
2476
|
-
* refreshToken();
|
|
2477
|
-
* }
|
|
2478
|
-
* ```
|
|
2479
|
-
*/
|
|
2480
|
-
declare function getTokenTimeLeft(token: string): number;
|
|
2481
|
-
/**
|
|
2482
|
-
* Get expiration date from token.
|
|
2483
|
-
*
|
|
2484
|
-
* @param token - The JWT token string
|
|
2485
|
-
* @returns Date object for expiration, or null if no exp claim or invalid token
|
|
2486
|
-
*
|
|
2487
|
-
* @example
|
|
2488
|
-
* ```tsx
|
|
2489
|
-
* const expiresAt = getTokenExpirationDate(token);
|
|
2490
|
-
* if (expiresAt) {
|
|
2491
|
-
* console.log('Token expires:', expiresAt.toLocaleString());
|
|
2492
|
-
* }
|
|
2493
|
-
* ```
|
|
2494
|
-
*/
|
|
2495
|
-
declare function getTokenExpirationDate(token: string): Date | null;
|
|
2496
|
-
/**
|
|
2497
|
-
* Safely get a claim from a token.
|
|
2498
|
-
*
|
|
2499
|
-
* @param token - The JWT token string
|
|
2500
|
-
* @param claim - The claim name to extract
|
|
2501
|
-
* @returns The claim value or undefined if not present/invalid
|
|
2502
|
-
*
|
|
2503
|
-
* @example
|
|
2504
|
-
* ```tsx
|
|
2505
|
-
* const userId = getTokenClaim(token, 'sub');
|
|
2506
|
-
* const roles = getTokenClaim<string[]>(token, 'roles') ?? [];
|
|
2507
|
-
* ```
|
|
2508
|
-
*/
|
|
2509
|
-
declare function getTokenClaim<T>(token: string, claim: string): T | undefined;
|
|
2510
|
-
/**
|
|
2511
|
-
* Get the subject (user identifier) from a token.
|
|
2512
|
-
*
|
|
2513
|
-
* @param token - The JWT token string
|
|
2514
|
-
* @returns The subject claim or undefined
|
|
2515
|
-
*/
|
|
2516
|
-
declare function getTokenSubject(token: string): string | undefined;
|
|
2517
|
-
/**
|
|
2518
|
-
* Check if token has a specific role.
|
|
2519
|
-
*
|
|
2520
|
-
* @param token - The JWT token string
|
|
2521
|
-
* @param role - The role to check for
|
|
2522
|
-
* @param rolesKey - The key in the payload containing roles (default: 'roles')
|
|
2523
|
-
* @returns true if the token contains the role
|
|
2524
|
-
*
|
|
2525
|
-
* @example
|
|
2526
|
-
* ```tsx
|
|
2527
|
-
* if (tokenHasRole(token, 'admin')) {
|
|
2528
|
-
* // Show admin features
|
|
2529
|
-
* }
|
|
2530
|
-
* ```
|
|
2531
|
-
*/
|
|
2532
|
-
declare function tokenHasRole(token: string, role: string, rolesKey?: string): boolean;
|
|
2533
|
-
/**
|
|
2534
|
-
* Check if token has a specific permission.
|
|
2535
|
-
*
|
|
2536
|
-
* @param token - The JWT token string
|
|
2537
|
-
* @param permission - The permission to check for
|
|
2538
|
-
* @param permissionsKey - The key in the payload containing permissions (default: 'permissions')
|
|
2539
|
-
* @returns true if the token contains the permission
|
|
2540
|
-
*/
|
|
2541
|
-
declare function tokenHasPermission(token: string, permission: string, permissionsKey?: string): boolean;
|
|
2542
|
-
|
|
2543
|
-
/**
|
|
2544
|
-
* Template variable resolver.
|
|
2545
|
-
*
|
|
2546
|
-
* Replaces `{{namespace.key}}` patterns in text with values from a context map.
|
|
2547
|
-
* Used for injecting dynamic config values into help content at render time.
|
|
2548
|
-
*
|
|
2549
|
-
* @example
|
|
2550
|
-
* resolveTemplateVariables("Fee: {{config.sellerFee}}%", { "config.sellerFee": "5" })
|
|
2551
|
-
* // => "Fee: 5%"
|
|
2552
|
-
*/
|
|
2553
|
-
declare function resolveTemplateVariables(text: string, context: Record<string, string | number>): string;
|
|
2554
|
-
|
|
2555
|
-
/**
|
|
2556
|
-
* i18n-text — generic locale resolution for bilingual / multilingual
|
|
2557
|
-
* JSONB payloads stored on backend DTOs.
|
|
2558
|
-
*
|
|
2559
|
-
* Design goals:
|
|
2560
|
-
*
|
|
2561
|
-
* - Zero hard-coded locale strings. Caller passes the viewer locale
|
|
2562
|
-
* and (optionally) a fallback order; the helper does the rest.
|
|
2563
|
-
* Adding a new locale to the platform is just config, not a code
|
|
2564
|
-
* edit in every consumer.
|
|
2565
|
-
* - Locale-agnostic API so it can serve marketplace categories,
|
|
2566
|
-
* achievement titles, paysys coin names, future post translations
|
|
2567
|
-
* — anywhere a `{ [lang]: string }` bag is stored.
|
|
2568
|
-
* - O(1) in the happy path (direct map access) with a deterministic
|
|
2569
|
-
* fallback walk.
|
|
2570
|
-
*
|
|
2571
|
-
* @module @omnitron-dev/prism/utils/i18n-text
|
|
2572
|
-
*/
|
|
2573
|
-
/** A bag of language-keyed strings. Keys are RFC 5646 language codes
|
|
2574
|
-
* (or just `'en'`, `'ru'` for simple two-locale platforms). */
|
|
2575
|
-
type I18nText = Record<string, string | undefined>;
|
|
2576
|
-
/** Object shape that carries both a localised bag and a legacy
|
|
2577
|
-
* scalar field as final fallback — the canonical wire format for
|
|
2578
|
-
* DAOS categories, achievements etc. */
|
|
2579
|
-
interface I18nResolvable {
|
|
2580
|
-
/** Bilingual / multilingual bag. */
|
|
2581
|
-
nameI18n?: I18nText | null;
|
|
2582
|
-
/** Last-resort legacy fallback. The backend keeps this populated
|
|
2583
|
-
* even after migrating to JSONB so single-locale consumers keep
|
|
2584
|
-
* working without an immediate refactor. */
|
|
2585
|
-
name?: string | null;
|
|
2586
|
-
}
|
|
2587
|
-
/**
|
|
2588
|
-
* Resolve a `{ nameI18n, name }` object to the viewer-preferred
|
|
2589
|
-
* locale, walking through optional fallbacks before bottoming out
|
|
2590
|
-
* on the legacy scalar.
|
|
2591
|
-
*
|
|
2592
|
-
* @example
|
|
2593
|
-
* ```ts
|
|
2594
|
-
* const label = resolveI18n(category, 'ru', ['en']);
|
|
2595
|
-
* // → category.nameI18n.ru
|
|
2596
|
-
* // ?? category.nameI18n.en
|
|
2597
|
-
* // ?? category.name
|
|
2598
|
-
* // ?? ''
|
|
2599
|
-
* ```
|
|
2600
|
-
*
|
|
2601
|
-
* @param obj The resolvable record (e.g. a category DTO).
|
|
2602
|
-
* @param lang Viewer's preferred language code.
|
|
2603
|
-
* @param fallback Ordered list of secondary languages to try before
|
|
2604
|
-
* the legacy scalar. Defaults to `['en']`.
|
|
2605
|
-
* @param field Override the I18nText key (defaults to `nameI18n`)
|
|
2606
|
-
* + the legacy scalar key (defaults to `name`).
|
|
2607
|
-
* Useful for `descriptionI18n` / `description`.
|
|
2608
|
-
*/
|
|
2609
|
-
declare function resolveI18n(obj: object | null | undefined, lang: string, fallback?: readonly string[], field?: {
|
|
2610
|
-
bag?: string;
|
|
2611
|
-
scalar?: string;
|
|
2612
|
-
}): string;
|
|
2613
|
-
/**
|
|
2614
|
-
* Build a stable searchable haystack from an i18n object — all
|
|
2615
|
-
* known translations concatenated lower-case so a single `.includes`
|
|
2616
|
-
* check matches against any locale.
|
|
2617
|
-
*
|
|
2618
|
-
* Useful inside `Autocomplete.filterOptions` to make EN-only users
|
|
2619
|
-
* find RU-only entries.
|
|
2620
|
-
*/
|
|
2621
|
-
declare function i18nHaystack(bag: object | null | undefined, extra?: readonly string[]): string;
|
|
2622
|
-
|
|
2623
|
-
/**
|
|
2624
|
-
* Toast wrapper with short-window deduplication.
|
|
2625
|
-
*
|
|
2626
|
-
* Problem: identical toast.error() calls fire twice in dev (React
|
|
2627
|
-
* StrictMode double-mounts every effect), and can also fire twice
|
|
2628
|
-
* in prod when a parent re-fetches mid-flight or a retry wrapper
|
|
2629
|
-
* surfaces the same error path. Sonner has no built-in dedupe, so
|
|
2630
|
-
* every duplicate landed as a separate snack-bar.
|
|
2631
|
-
*
|
|
2632
|
-
* Fix: collapse identical {method, message} calls inside a 1.5 s
|
|
2633
|
-
* window. The first call lands; subsequent identical calls within
|
|
2634
|
-
* the window are silently dropped. We DON'T forward to sonner's
|
|
2635
|
-
* own `id` option because then any later call with a different
|
|
2636
|
-
* message but the same id would *replace* the visible toast — we
|
|
2637
|
-
* want suppression, not replacement.
|
|
2638
|
-
*
|
|
2639
|
-
* Drop-in replacement for `import { toast } from 'sonner'`.
|
|
2640
|
-
* Same surface: error/success/info/warning + the passthroughs.
|
|
2641
|
-
*
|
|
2642
|
-
* Lives in prism so every UI app on the platform shares one
|
|
2643
|
-
* notification policy instead of each app reinventing it.
|
|
2644
|
-
*/
|
|
2645
|
-
|
|
2646
|
-
declare const toast: typeof toast$1;
|
|
2647
|
-
|
|
2648
|
-
/**
|
|
2649
|
-
* Canonical BTC / XMR amount formatter.
|
|
2650
|
-
*
|
|
2651
|
-
* Why this exists
|
|
2652
|
-
* ---------------
|
|
2653
|
-
* Pre-consolidation the platform had ~8 independent formatters,
|
|
2654
|
-
* each shipping its own opinion of precision:
|
|
2655
|
-
*
|
|
2656
|
-
* - `org-finances/formatBtc` → BTC 8, XMR 4
|
|
2657
|
-
* - `org-revenue-card` → BTC 4, XMR 4
|
|
2658
|
-
* - `orgs-overview/formatBtc` → tiered 8 → 4 → 2 by magnitude
|
|
2659
|
-
* - `shop-dashboard` → BTC 4
|
|
2660
|
-
* - `shop-categories` → BTC 8 with trailing-zero trim
|
|
2661
|
-
* - `finances/hooks` → BTC 8, XMR 8 (already canonical
|
|
2662
|
-
* but isolated from everyone else)
|
|
2663
|
-
* - `pages/finances DEFAULT_ASSETS` → XMR 12 (wire-precision leak)
|
|
2664
|
-
*
|
|
2665
|
-
* Result: a single dashboard showed BTC 4 in the KPI tile, BTC 8
|
|
2666
|
-
* in the Financial Overview tile, and BTC 6 in another corner —
|
|
2667
|
-
* three "truths" for the same value. This module is the single
|
|
2668
|
-
* source of truth from now on; all call sites import from here.
|
|
2669
|
-
*
|
|
2670
|
-
* Display vs wire precision
|
|
2671
|
-
* -------------------------
|
|
2672
|
-
* Wire precision (what the backend stores) is 8 for BTC, 12 for
|
|
2673
|
-
* XMR — those are the on-chain atomic units (satoshi, piconero).
|
|
2674
|
-
* Display precision is 8 for BOTH coins by platform convention:
|
|
2675
|
-
*
|
|
2676
|
-
* - 8 fractional digits is a satoshi-level read for BTC,
|
|
2677
|
-
* - 8 fractional digits for XMR is "good enough" for human eyes
|
|
2678
|
-
* and keeps the column widths symmetric. The last 4 digits of
|
|
2679
|
-
* XMR's wire value are dropped from display only — never from
|
|
2680
|
-
* storage, math, or wire transfers.
|
|
2681
|
-
*
|
|
2682
|
-
* The platform-wide symmetric formatting was a direct user-facing
|
|
2683
|
-
* request: the same coin column should align cleanly whether the
|
|
2684
|
-
* row holds BTC or XMR.
|
|
2685
|
-
*
|
|
2686
|
-
* If you need a *narrower* surface (a dense table, a stat-card
|
|
2687
|
-
* subtitle), use `{ trim: true }` to drop trailing zeros while
|
|
2688
|
-
* keeping the canonical precision as the cap. Don't bypass this
|
|
2689
|
-
* module with an ad-hoc `toFixed(N)` — that's exactly the entropy
|
|
2690
|
-
* we just cleaned up.
|
|
2691
|
-
*/
|
|
2692
|
-
/**
|
|
2693
|
-
* Canonical display-precision per supported coin. Use this when
|
|
2694
|
-
* you need the raw precision number (e.g. populating an input
|
|
2695
|
-
* field's `.toFixed(...)` to seed a "max balance" button). For
|
|
2696
|
-
* actual rendering of a value, prefer `formatCoinAmount`.
|
|
2697
|
-
*/
|
|
2698
|
-
declare const COIN_DISPLAY_DECIMALS: Readonly<Record<string, number>>;
|
|
2699
|
-
interface FormatCoinAmountOptions {
|
|
2700
|
-
/**
|
|
2701
|
-
* Append the uppercase coin symbol (`"0.00012345 BTC"`).
|
|
2702
|
-
* Default `true`. Disable for places where the symbol is
|
|
2703
|
-
* rendered separately (e.g. a chip beside the number).
|
|
2704
|
-
*/
|
|
2705
|
-
withSymbol?: boolean;
|
|
2706
|
-
/**
|
|
2707
|
-
* Trim trailing zeros after the decimal point. Useful in dense
|
|
2708
|
-
* tables where `0 BTC` reads cleaner than `0.00000000 BTC`. The
|
|
2709
|
-
* precision cap (8) is still honoured — we just drop tail
|
|
2710
|
-
* zeros up to and including the decimal point. Default `false`.
|
|
2711
|
-
*/
|
|
2712
|
-
trim?: boolean;
|
|
2713
|
-
/**
|
|
2714
|
-
* Override precision. ONLY use this for legacy back-compat
|
|
2715
|
-
* (e.g. a screen that genuinely needs to truncate at a non-
|
|
2716
|
-
* standard width). Prefer the default. Negative values clamp
|
|
2717
|
-
* to 0.
|
|
2718
|
-
*/
|
|
2719
|
-
precision?: number;
|
|
2720
|
-
/**
|
|
2721
|
-
* Custom symbol override. Defaults to `coin.toUpperCase()`. Set
|
|
2722
|
-
* this if you need a non-standard label (e.g. "₿" for BTC) —
|
|
2723
|
-
* but be aware that mixing symbols across the platform is what
|
|
2724
|
-
* this module was built to prevent.
|
|
2725
|
-
*/
|
|
2726
|
-
symbol?: string;
|
|
2727
|
-
}
|
|
2728
|
-
/**
|
|
2729
|
-
* Resolve the canonical display precision for a coin code.
|
|
2730
|
-
* Case-insensitive. Unknown codes fall back to 8.
|
|
2731
|
-
*/
|
|
2732
|
-
declare function getCoinDecimals(coin: string): number;
|
|
2733
|
-
/**
|
|
2734
|
-
* Format a crypto amount for display.
|
|
2735
|
-
*
|
|
2736
|
-
* Input can be a string (preferred — preserves full precision
|
|
2737
|
-
* end-to-end from the RPC wire) or a number. Non-finite / NaN
|
|
2738
|
-
* inputs render as the zero-shaped placeholder so the UI never
|
|
2739
|
-
* shows `NaN BTC`.
|
|
2740
|
-
*
|
|
2741
|
-
* @example
|
|
2742
|
-
* formatCoinAmount('0.001', 'BTC') // '0.00100000 BTC'
|
|
2743
|
-
* formatCoinAmount('0.001', 'BTC', { trim: true }) // '0.001 BTC'
|
|
2744
|
-
* formatCoinAmount(null, 'XMR') // '0.00000000 XMR'
|
|
2745
|
-
* formatCoinAmount('1.23456789', 'BTC', { withSymbol: false }) // '1.23456789'
|
|
2746
|
-
*/
|
|
2747
|
-
declare function formatCoinAmount(value: string | number | null | undefined, coin: string, options?: FormatCoinAmountOptions): string;
|
|
2748
|
-
/**
|
|
2749
|
-
* Render a multi-coin total map (e.g. revenue across coins)
|
|
2750
|
-
* as a single inline string: `"0.00010000 BTC · 0.00000000 XMR"`.
|
|
2751
|
-
*
|
|
2752
|
-
* Stable ordering by lower-cased coin code so BTC always appears
|
|
2753
|
-
* before XMR regardless of object-property iteration quirks.
|
|
2754
|
-
*/
|
|
2755
|
-
declare function formatCoinAmountList(totals: Partial<Record<string, string | number | null | undefined>>, options?: FormatCoinAmountOptions & {
|
|
2756
|
-
separator?: string;
|
|
2757
|
-
}): string;
|
|
2758
|
-
|
|
2759
|
-
export { AsyncLock, type AsyncLockOptions, type AsyncLockResult, type AsyncLockState, AsyncLockTimeoutError, COIN_DISPLAY_DECIMALS, DEFAULT_CLASS_PREFIX, DEFAULT_ERROR_MESSAGES, type DateDurationPreset, type DateInput, type ErrorCode, type ErrorContext$1 as ErrorContext, type ErrorInterceptor, type ErrorMessages, type ErrorSeverity, type FetchClient, type ErrorContext as FetchErrorContext, type FetchInterceptorConfig, type FetchRequestInit, type FormatCoinAmountOptions, type FormatCurrencyOptions, type FormatDateOptions, type FormatNumberOptions, type I18nResolvable, type I18nText, type JwtDecodeResult, type JwtPayload, type JwtStandardClaims, type JwtValidationOptions, type MergeableRef, type RequestContext, type RequestInterceptor, type ResponseContext, type ResponseInterceptor, type RetryConfig, type SafeReturnUrlOptions, type StateProps, type StorageOptions, type StorageWithExpiryOptions, type TokenRefreshConfig, type TransformNumberOptions, type TranslateFn, type TranslatedError, addDays, addMonths, buildUrl, calculatePercentageChange, camelCase, capitalize, clampNumber, classifyHttpError, clearStorage, cn, containsIgnoreCase, createAsyncLock, createClasses, createClassesObject, createComponentClasses, createErrorRecoveryHandler, createErrorTranslator, createFetchClient, createJsonApiClient, createNumberInputHandlers, createTokenRefreshInterceptor, createTokenRefreshLock, deepClone, diffInDays, endOfDay, escapeRegExp, extractErrorContext, fBytes, fCompact, fCurrency, fDate, fDateISO, fDateTime, fDecimal, fDuration, fNumber, fNumberWithSign, fOrdinal, fPercent, fRelativeTime, fShortenNumber, fTime, formatCoinAmount, formatCoinAmountList, getClassPrefix, getCoinDecimals, getCurrencySymbol, getDates, getDirectionalProperty, getErrorSeverity, getFutureDates, getInitials, getPastDates, getPercentage, getQueryParam, getStorage, getStorageKeys, getStorageSize, getStorageWithExpiry, getTokenClaim, getTokenExpirationDate, getTokenSubject, getTokenTimeLeft, hasKeys, hasParams, hasRefValue, highlightText, i18nHaystack, isActiveLink, isBlank, isChunkLoadError, isEmail, isEmpty, isEqualPath, isExternalLink, isExternalUrl, isFuture, isNetworkError, isPast, isRetryableError, isRtlDirection, isSessionExpiredError, isThisWeek, isToday, isTokenExpired, isUrl, isValidToken, isYesterday, jwtDecode, jwtDecodePayload, kebabCase, localStorageAvailable, locked, mergeClasses, mergeRefs, noRtlFlip, omit, parseNumber, parseQueryParams, pick, pxToRem, randomString, remToPx, removeLastSlash, removeParams, removeStorage, resolveI18n, resolveTemplateVariables, responsiveFontSize, roundToDecimals, safeReturnUrl, sessionStorageAvailable, setClassPrefix, setFont, setRef, setStorage, setStorageWithExpiry, slugify, snakeCase, startOfDay, titleCase, toast, tokenHasPermission, tokenHasRole, transformForDisplay, transformOnBlur, transformOnChange, truncate, uuid, withLock, withRetry };
|
|
2
|
+
* Prism Design System
|
|
3
|
+
*
|
|
4
|
+
* A powerful, production-ready design framework built on MUI.
|
|
5
|
+
* Combines the best of shadcn/ui's copy-paste model with MUI's robust
|
|
6
|
+
* component infrastructure.
|
|
7
|
+
*
|
|
8
|
+
* @module @omnitron-dev/prism
|
|
9
|
+
*/
|
|
10
|
+
export * from './theme/index.js';
|
|
11
|
+
export * from './core/index.js';
|
|
12
|
+
export * from './components/index.js';
|
|
13
|
+
export * from './utils/index.js';
|
|
14
|
+
export * from './registry/index.js';
|
|
15
|
+
export * from './layouts/index.js';
|
|
16
|
+
export * from './types/index.js';
|
|
17
|
+
export * from './state/index.js';
|
|
18
|
+
export * from './hooks/index.js';
|
|
19
|
+
export * from './netron/index.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|