@krak-stack/registry 0.10.19 → 0.11.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/CHANGELOG.md +105 -0
- package/README.md +28 -7
- package/dist/components/agent/index.d.ts +454 -0
- package/dist/components/agent/react.d.ts +55 -0
- package/dist/components/agent/react.js +2594 -0
- package/dist/components/agent/schema.d.ts +55 -0
- package/dist/components/animated-list/classes.d.ts +9 -0
- package/dist/components/animated-list/html.d.ts +11 -0
- package/dist/components/animated-list/html.js +533 -0
- package/dist/components/animated-list/index.d.ts +205 -0
- package/dist/components/animated-list/react.d.ts +11 -0
- package/dist/components/animated-list/react.js +711 -0
- package/dist/components/animated-list/schema.d.ts +44 -0
- package/dist/components/animated-number/html.d.ts +19 -0
- package/dist/components/animated-number/html.js +101 -0
- package/dist/components/animated-number/index.d.ts +80 -0
- package/dist/components/{ui/animated-number.d.ts → animated-number/react.d.ts} +2 -7
- package/dist/components/animated-number/react.js +278 -0
- package/dist/components/animated-number/schema.d.ts +9 -0
- package/dist/components/app-brand/classes.d.ts +11 -0
- package/dist/components/app-brand/html.d.ts +26 -0
- package/dist/components/app-brand/html.js +78 -0
- package/dist/components/app-brand/react.d.ts +12 -0
- package/dist/components/app-brand/react.js +86 -0
- package/dist/components/app-brand/schema.d.ts +36 -0
- package/dist/components/app-switcher/classes.d.ts +15 -0
- package/dist/components/app-switcher/html.d.ts +72 -0
- package/dist/components/app-switcher/html.js +327 -0
- package/dist/components/app-switcher/index.d.ts +47 -0
- package/dist/components/app-switcher/react.d.ts +12 -0
- package/dist/components/{ui/app-switcher.js → app-switcher/react.js} +84 -15
- package/dist/components/app-switcher/schema.d.ts +39 -0
- package/dist/components/async-action-button/classes.d.ts +11 -0
- package/dist/components/async-action-button/html.d.ts +46 -0
- package/dist/components/async-action-button/html.js +266 -0
- package/dist/components/async-action-button/index.d.ts +73 -0
- package/dist/components/async-action-button/react.d.ts +10 -0
- package/dist/components/async-action-button/react.js +378 -0
- package/dist/components/async-action-button/schema.d.ts +28 -0
- package/dist/{services/events/client/audit-log-table.d.ts → components/audit-log-table/react.d.ts} +2 -2
- package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js} +2195 -918
- package/dist/components/auto-height/html.d.ts +8 -0
- package/dist/components/auto-height/html.js +81 -0
- package/dist/components/auto-height/index.d.ts +2 -0
- package/dist/components/{ui/auto-height.d.ts → auto-height/react.d.ts} +2 -4
- package/dist/components/auto-height/react.js +75 -0
- package/dist/components/auto-height/schema.d.ts +7 -0
- package/dist/components/bulk-list-input/classes.d.ts +7 -0
- package/dist/components/bulk-list-input/html.d.ts +41 -0
- package/dist/components/bulk-list-input/html.js +265 -0
- package/dist/components/bulk-list-input/index.d.ts +76 -0
- package/dist/components/bulk-list-input/react.d.ts +12 -0
- package/dist/components/{ui/bulk-list-input.js → bulk-list-input/react.js} +71 -4
- package/dist/components/bulk-list-input/schema.d.ts +33 -0
- package/dist/components/choice-cards/classes.d.ts +19 -0
- package/dist/components/choice-cards/html.d.ts +76 -0
- package/dist/components/choice-cards/html.js +237 -0
- package/dist/components/choice-cards/index.d.ts +1 -0
- package/dist/components/choice-cards/react.d.ts +21 -0
- package/dist/components/{ui/choice-cards.js → choice-cards/react.js} +29 -10
- package/dist/components/choice-cards/schema.d.ts +100 -0
- package/dist/components/code-block/classes.d.ts +13 -0
- package/dist/components/code-block/html.d.ts +21 -0
- package/dist/components/code-block/html.js +381 -0
- package/dist/components/code-block/index.d.ts +4 -0
- package/dist/components/code-block/react.d.ts +4 -0
- package/dist/components/code-block/react.js +493 -0
- package/dist/components/code-block/schema.d.ts +29 -0
- package/dist/components/color-input/classes.d.ts +9 -0
- package/dist/components/color-input/html.d.ts +48 -0
- package/dist/components/color-input/html.js +187 -0
- package/dist/components/color-input/index.d.ts +88 -0
- package/dist/components/color-input/react.d.ts +7 -0
- package/dist/components/{ui/color-picker.js → color-input/react.js} +165 -233
- package/dist/components/color-input/schema.d.ts +40 -0
- package/dist/components/copy-button/html.d.ts +48 -0
- package/dist/components/copy-button/html.js +266 -0
- package/dist/components/copy-button/index.d.ts +73 -0
- package/dist/components/copy-button/react.d.ts +12 -0
- package/dist/components/copy-button/react.js +388 -0
- package/dist/components/copy-button/schema.d.ts +37 -0
- package/dist/components/copy-value/html.d.ts +37 -0
- package/dist/components/copy-value/html.js +426 -0
- package/dist/components/copy-value/index.d.ts +57 -0
- package/dist/components/copy-value/react.d.ts +9 -0
- package/dist/components/copy-value/react.js +682 -0
- package/dist/components/copy-value/schema.d.ts +45 -0
- package/dist/components/cron-input/classes.d.ts +25 -0
- package/dist/components/cron-input/html.d.ts +36 -0
- package/dist/components/cron-input/html.js +204 -0
- package/dist/components/cron-input/index.d.ts +59 -0
- package/dist/components/cron-input/react.d.ts +7 -0
- package/dist/components/{ui/cron-expression-editor.js → cron-input/react.js} +126 -54
- package/dist/components/cron-input/schema.d.ts +24 -0
- package/dist/components/danger-confirmation/classes.d.ts +7 -0
- package/dist/components/danger-confirmation/html.d.ts +39 -0
- package/dist/components/danger-confirmation/html.js +227 -0
- package/dist/components/danger-confirmation/index.d.ts +113 -0
- package/dist/components/{ui/danger-confirmation.d.ts → danger-confirmation/react.d.ts} +3 -12
- package/dist/components/danger-confirmation/react.js +550 -0
- package/dist/components/danger-confirmation/schema.d.ts +34 -0
- package/dist/components/data-table/classes.d.ts +63 -0
- package/dist/components/data-table/html.d.ts +1938 -0
- package/dist/components/data-table/html.js +2682 -0
- package/dist/components/data-table/index.d.ts +2686 -0
- package/dist/components/data-table/react.d.ts +578 -0
- package/dist/components/{ui/data-table.js → data-table/react.js} +2189 -906
- package/dist/components/data-table/schema.d.ts +3012 -0
- package/dist/components/date-input/classes.d.ts +17 -0
- package/dist/components/date-input/html.d.ts +60 -0
- package/dist/components/date-input/html.js +418 -0
- package/dist/components/date-input/index.d.ts +91 -0
- package/dist/components/date-input/react.d.ts +10 -0
- package/dist/components/{ui/date-picker.js → date-input/react.js} +233 -79
- package/dist/components/date-input/schema.d.ts +41 -0
- package/dist/components/editable-text/classes.d.ts +17 -0
- package/dist/components/editable-text/html.d.ts +51 -0
- package/dist/components/editable-text/html.js +370 -0
- package/dist/components/editable-text/index.d.ts +143 -0
- package/dist/components/editable-text/react.d.ts +6 -0
- package/dist/components/editable-text/react.js +499 -0
- package/dist/components/editable-text/schema.d.ts +31 -0
- package/dist/components/editing-locale-switcher/classes.d.ts +7 -0
- package/dist/components/editing-locale-switcher/html.d.ts +27 -0
- package/dist/components/editing-locale-switcher/html.js +250 -0
- package/dist/components/editing-locale-switcher/index.d.ts +52 -0
- package/dist/components/editing-locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/editing-locale-switcher.js → editing-locale-switcher/react.js} +70 -17
- package/dist/components/editing-locale-switcher/schema.d.ts +16 -0
- package/dist/components/{ui/effect-form.d.ts → effect-form/react.d.ts} +2 -2
- package/dist/components/{ui/effect-form.js → effect-form/react.js} +309 -83
- package/dist/components/effectcn/alert-dialog.d.ts +13 -0
- package/dist/components/effectcn/button.d.ts +31 -0
- package/dist/components/effectcn/calendar.d.ts +12 -0
- package/dist/components/effectcn/checkbox.d.ts +10 -0
- package/dist/components/effectcn/combobox.d.ts +25 -0
- package/dist/components/effectcn/dialog.d.ts +19 -0
- package/dist/components/effectcn/field.d.ts +11 -0
- package/dist/components/effectcn/file-drop.d.ts +8 -0
- package/dist/components/effectcn/input.d.ts +26 -0
- package/dist/components/effectcn/menu.d.ts +85 -0
- package/dist/components/effectcn/menubar.d.ts +8 -0
- package/dist/components/effectcn/popover.d.ts +18 -0
- package/dist/components/effectcn/scroll-area.d.ts +12 -0
- package/dist/components/effectcn/select.d.ts +68 -0
- package/dist/components/effectcn/toast.d.ts +29 -0
- package/dist/components/email-composer/index.d.ts +229 -0
- package/dist/components/email-composer/labels.d.ts +12 -0
- package/dist/components/email-composer/react.d.ts +5 -0
- package/dist/components/email-composer/react.js +1354 -0
- package/dist/components/email-composer/schema.d.ts +42 -0
- package/dist/components/email-editor/classes.d.ts +21 -0
- package/dist/components/email-editor/html.d.ts +360 -0
- package/dist/components/email-editor/html.js +1706 -0
- package/dist/components/email-editor/index.d.ts +693 -0
- package/dist/components/{ui/email-editor.d.ts → email-editor/labels.d.ts} +1 -19
- package/dist/components/email-editor/legacy-editor.html.d.ts +160 -0
- package/dist/components/email-editor/react.d.ts +11 -0
- package/dist/components/{ui/email-editor.js → email-editor/react.js} +1057 -712
- package/dist/components/email-editor/schema.d.ts +162 -0
- package/dist/components/error-component/classes.d.ts +7 -0
- package/dist/components/error-component/html.d.ts +120 -0
- package/dist/components/error-component/html.js +346 -0
- package/dist/components/error-component/index.d.ts +69 -0
- package/dist/components/error-component/react.d.ts +8 -0
- package/dist/components/error-component/react.js +744 -0
- package/dist/components/error-component/schema.d.ts +56 -0
- package/dist/components/file-input/classes.d.ts +7 -0
- package/dist/components/file-input/html.d.ts +95 -0
- package/dist/components/file-input/html.js +368 -0
- package/dist/components/file-input/index.d.ts +99 -0
- package/dist/components/file-input/react.d.ts +11 -0
- package/dist/components/{ui/file-picker.js → file-input/react.js} +122 -19
- package/dist/components/file-input/schema.d.ts +37 -0
- package/dist/components/{ui/form.d.ts → form/react.d.ts} +4 -4
- package/dist/components/{ui/form.js → form/react.js} +314 -84
- package/dist/components/icon-input/html.d.ts +55 -0
- package/dist/components/icon-input/html.js +538 -0
- package/dist/components/icon-input/index.d.ts +143 -0
- package/dist/components/icon-input/react.d.ts +6 -0
- package/dist/components/{ui/icon-input.js → icon-input/react.js} +459 -89
- package/dist/components/icon-input/schema.d.ts +23 -0
- package/dist/components/image-crop-editor/classes.d.ts +19 -0
- package/dist/components/image-crop-editor/html.d.ts +66 -0
- package/dist/components/image-crop-editor/html.js +561 -0
- package/dist/components/image-crop-editor/index.d.ts +183 -0
- package/dist/components/image-crop-editor/react.d.ts +8 -0
- package/dist/components/image-crop-editor/react.js +802 -0
- package/dist/components/image-crop-editor/schema.d.ts +54 -0
- package/dist/components/krakstack-provider/html.d.ts +17 -0
- package/dist/components/krakstack-provider/html.js +37 -0
- package/dist/components/krakstack-provider/index.d.ts +7 -0
- package/dist/components/krakstack-provider/react.d.ts +8 -0
- package/dist/components/{ui/krakstack-provider.js → krakstack-provider/react.js} +14 -5
- package/dist/components/krakstack-provider/schema.d.ts +6 -0
- package/dist/components/loading/classes.d.ts +5 -0
- package/dist/components/loading/html.d.ts +18 -0
- package/dist/components/loading/html.js +166 -0
- package/dist/components/loading/index.d.ts +6 -0
- package/dist/components/loading/react.d.ts +4 -0
- package/dist/components/loading/react.js +51 -0
- package/dist/components/loading/schema.d.ts +23 -0
- package/dist/components/locale-switcher/html.d.ts +22 -0
- package/dist/components/locale-switcher/html.js +264 -0
- package/dist/components/locale-switcher/index.d.ts +50 -0
- package/dist/components/locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/locale-switcher.js → locale-switcher/react.js} +55 -22
- package/dist/components/locale-switcher/schema.d.ts +12 -0
- package/dist/components/map-menu/classes.d.ts +13 -0
- package/dist/components/map-menu/google-maps.d.ts +80 -0
- package/dist/components/map-menu/google-viewport.d.ts +7 -0
- package/dist/components/map-menu/html.d.ts +274 -0
- package/dist/components/map-menu/html.js +934 -0
- package/dist/components/map-menu/index.d.ts +246 -0
- package/dist/components/map-menu/map.d.ts +47 -0
- package/dist/components/map-menu/react.d.ts +40 -0
- package/dist/components/{ui/map-menu.js → map-menu/react.js} +502 -141
- package/dist/components/map-menu/schema.d.ts +132 -0
- package/dist/components/markdown/classes.d.ts +1 -0
- package/dist/components/markdown/html.d.ts +23 -0
- package/dist/components/markdown/html.js +510 -0
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/react.d.ts +3 -0
- package/dist/components/markdown/react.js +546 -0
- package/dist/components/markdown/schema.d.ts +20 -0
- package/dist/components/notification-menu/classes.d.ts +11 -0
- package/dist/components/notification-menu/html.d.ts +67 -0
- package/dist/components/notification-menu/html.js +425 -0
- package/dist/components/notification-menu/index.d.ts +132 -0
- package/dist/components/notification-menu/react.d.ts +57 -0
- package/dist/components/notification-menu/react.js +829 -0
- package/dist/components/notification-menu/schema.d.ts +59 -0
- package/dist/components/pagination/classes.d.ts +19 -0
- package/dist/components/pagination/html.d.ts +49 -0
- package/dist/components/pagination/html.js +387 -0
- package/dist/components/pagination/index.d.ts +109 -0
- package/dist/components/pagination/react.d.ts +9 -0
- package/dist/components/{ui/pagination.js → pagination/react.js} +130 -30
- package/dist/components/pagination/schema.d.ts +36 -0
- package/dist/components/phone-number-input/classes.d.ts +17 -0
- package/dist/components/phone-number-input/html.d.ts +52 -0
- package/dist/components/phone-number-input/html.js +655 -0
- package/dist/components/phone-number-input/index.d.ts +59 -0
- package/dist/components/phone-number-input/react.d.ts +11 -0
- package/dist/components/{ui/phone-number-input.js → phone-number-input/react.js} +368 -138
- package/dist/components/phone-number-input/schema.d.ts +31 -0
- package/dist/components/presence-transition/html.d.ts +13 -0
- package/dist/components/presence-transition/html.js +128 -0
- package/dist/components/presence-transition/index.d.ts +57 -0
- package/dist/components/{ui/presence-transition.d.ts → presence-transition/react.d.ts} +3 -5
- package/dist/components/presence-transition/react.js +293 -0
- package/dist/components/presence-transition/schema.d.ts +7 -0
- package/dist/components/registry-previews/component-example.d.ts +31 -0
- package/dist/components/registry-previews/component-example.js +679 -0
- package/dist/components/registry-previews/html-preview.d.ts +17 -0
- package/dist/components/registry-previews/html-preview.js +83 -0
- package/dist/components/rich-text-editor/classes.d.ts +15 -0
- package/dist/components/rich-text-editor/engine.d.ts +9 -0
- package/dist/components/rich-text-editor/html.d.ts +246 -0
- package/dist/components/rich-text-editor/html.js +830 -0
- package/dist/components/rich-text-editor/index.d.ts +453 -0
- package/dist/components/rich-text-editor/labels.d.ts +42 -0
- package/dist/components/rich-text-editor/react.d.ts +19 -0
- package/dist/components/rich-text-editor/react.js +1175 -0
- package/dist/components/rich-text-editor/schema.d.ts +116 -0
- package/dist/components/search-menu/classes.d.ts +9 -0
- package/dist/components/search-menu/html.d.ts +127 -0
- package/dist/components/search-menu/html.js +432 -0
- package/dist/components/search-menu/index.d.ts +85 -0
- package/dist/components/search-menu/react.d.ts +18 -0
- package/dist/components/{ui/search-menu.js → search-menu/react.js} +290 -31
- package/dist/components/search-menu/schema.d.ts +78 -0
- package/dist/components/select-with-custom-input/classes.d.ts +17 -0
- package/dist/components/select-with-custom-input/html.d.ts +60 -0
- package/dist/components/select-with-custom-input/html.js +238 -0
- package/dist/components/select-with-custom-input/index.d.ts +114 -0
- package/dist/components/select-with-custom-input/react.d.ts +7 -0
- package/dist/components/{ui/select-with-custom-input.js → select-with-custom-input/react.js} +134 -29
- package/dist/components/select-with-custom-input/schema.d.ts +54 -0
- package/dist/components/sidebar-layout/classes.d.ts +21 -0
- package/dist/components/sidebar-layout/html.d.ts +97 -0
- package/dist/components/sidebar-layout/html.js +361 -0
- package/dist/components/sidebar-layout/index.d.ts +57 -0
- package/dist/components/sidebar-layout/react.d.ts +30 -0
- package/dist/components/{ui/sidebar-layout.js → sidebar-layout/react.js} +353 -39
- package/dist/components/sidebar-layout/schema.d.ts +54 -0
- package/dist/components/stats-card/classes.d.ts +11 -0
- package/dist/components/stats-card/html.d.ts +15 -0
- package/dist/components/stats-card/html.js +55 -0
- package/dist/components/stats-card/react.d.ts +7 -0
- package/dist/components/{ui/stats-card.js → stats-card/react.js} +19 -15
- package/dist/components/stats-card/schema.d.ts +14 -0
- package/dist/components/stepper/classes.d.ts +39 -0
- package/dist/components/stepper/html.d.ts +107 -0
- package/dist/components/stepper/html.js +397 -0
- package/dist/components/stepper/index.d.ts +83 -0
- package/dist/components/stepper/react.d.ts +17 -0
- package/dist/components/{ui/stepper.js → stepper/react.js} +120 -21
- package/dist/components/stepper/schema.d.ts +52 -0
- package/dist/components/support/classes.d.ts +55 -0
- package/dist/components/support/form.d.ts +19 -0
- package/dist/components/support/html.d.ts +266 -0
- package/dist/components/support/html.js +604 -0
- package/dist/components/support/index.d.ts +226 -0
- package/dist/components/support/multipart.d.ts +21 -0
- package/dist/components/support/react.d.ts +54 -0
- package/dist/components/support/react.js +1252 -0
- package/dist/components/support/schema.d.ts +69 -0
- package/dist/components/support.d.ts +1 -66
- package/dist/components/theme-switcher/html.d.ts +28 -0
- package/dist/components/theme-switcher/html.js +288 -0
- package/dist/components/theme-switcher/index.d.ts +59 -0
- package/dist/components/{ui/theme-switcher.d.ts → theme-switcher/react.d.ts} +4 -12
- package/dist/components/{ui/theme-switcher.js → theme-switcher/react.js} +69 -35
- package/dist/components/theme-switcher/schema.d.ts +33 -0
- package/dist/components/time-input/classes.d.ts +23 -0
- package/dist/components/time-input/html.d.ts +75 -0
- package/dist/components/time-input/html.js +571 -0
- package/dist/components/time-input/index.d.ts +164 -0
- package/dist/components/time-input/react.d.ts +7 -0
- package/dist/components/{ui/time-picker.js → time-input/react.js} +286 -114
- package/dist/components/time-input/schema.d.ts +96 -0
- package/dist/components/timezone-input/classes.d.ts +13 -0
- package/dist/components/timezone-input/html.d.ts +58 -0
- package/dist/components/timezone-input/html.js +804 -0
- package/dist/components/timezone-input/index.d.ts +170 -0
- package/dist/components/timezone-input/react.d.ts +9 -0
- package/dist/components/{ui/timezone-select.js → timezone-input/react.js} +493 -106
- package/dist/components/timezone-input/schema.d.ts +43 -0
- package/dist/components/toast/classes.d.ts +7 -0
- package/dist/components/toast/html.d.ts +34 -0
- package/dist/components/toast/html.js +280 -0
- package/dist/components/toast/index.d.ts +10 -0
- package/dist/components/toast/react.d.ts +9 -0
- package/dist/components/{ui/toast.js → toast/react.js} +35 -15
- package/dist/components/toast/schema.d.ts +24 -0
- package/dist/{services/events/client/tracking-notice.d.ts → components/tracking-notice/react.d.ts} +7 -1
- package/dist/{services/events/client/tracking-notice.js → components/tracking-notice/react.js} +13 -7
- package/dist/components/ui/animated-list.d.ts +1 -21
- package/dist/components/ui/app-brand.d.ts +1 -33
- package/dist/components/ui/async-action-button.d.ts +1 -17
- package/dist/components/ui/code-block.d.ts +1 -14
- package/dist/components/ui/copy-button.d.ts +1 -21
- package/dist/components/ui/data-table.d.ts +1 -584
- package/dist/components/ui/krakstack-provider.d.ts +1 -9
- package/dist/components/ui/loading.d.ts +1 -13
- package/dist/components/ui/pagination.d.ts +1 -47
- package/dist/components/ui/rich-text-editor.d.ts +1 -70
- package/dist/components/ui/search-menu.d.ts +1 -36
- package/dist/components/ui/select.js +159 -0
- package/dist/components/ui/sidebar-layout.d.ts +1 -40
- package/dist/components/ui/virtualized-combobox.d.ts +1 -59
- package/dist/components/unsaved-changes-guard/html.d.ts +34 -0
- package/dist/components/unsaved-changes-guard/html.js +172 -0
- package/dist/components/unsaved-changes-guard/index.d.ts +56 -0
- package/dist/components/unsaved-changes-guard/react.d.ts +4 -0
- package/dist/components/{ui/unsaved-changes-guard.js → unsaved-changes-guard/react.js} +74 -11
- package/dist/components/unsaved-changes-guard/schema.d.ts +37 -0
- package/dist/components/upload-attachment/classes.d.ts +11 -0
- package/dist/components/upload-attachment/html.d.ts +84 -0
- package/dist/components/upload-attachment/html.js +312 -0
- package/dist/components/upload-attachment/index.d.ts +72 -0
- package/dist/components/upload-attachment/react.d.ts +9 -0
- package/dist/components/{ui/upload-attachment.js → upload-attachment/react.js} +114 -17
- package/dist/components/upload-attachment/schema.d.ts +53 -0
- package/dist/components/virtualized-combobox/classes.d.ts +7 -0
- package/dist/components/virtualized-combobox/html.d.ts +97 -0
- package/dist/components/virtualized-combobox/html.js +310 -0
- package/dist/components/virtualized-combobox/index.d.ts +182 -0
- package/dist/components/virtualized-combobox/react.d.ts +31 -0
- package/dist/components/{ui/virtualized-combobox.js → virtualized-combobox/react.js} +160 -40
- package/dist/components/virtualized-combobox/schema.d.ts +92 -0
- package/dist/components/webhook-delivery-table/html.d.ts +216 -0
- package/dist/components/webhook-delivery-table/html.js +3008 -0
- package/dist/components/webhook-delivery-table/index.d.ts +405 -0
- package/dist/components/webhook-delivery-table/react.d.ts +13 -0
- package/dist/{services/webhooks/client/delivery-table.js → components/webhook-delivery-table/react.js} +2475 -956
- package/dist/components/webhook-delivery-table/schema.d.ts +134 -0
- package/dist/lib/docs.d.ts +17 -1
- package/dist/lib/docs.integrations.server.js +358 -73
- package/dist/lib/docs.js +861 -293
- package/dist/lib/docs.server.js +342 -57
- package/dist/lib/documentation-toolkit.d.ts +4 -4
- package/dist/lib/documentation-toolkit.js +354 -69
- package/dist/lib/effect-ui-adapter/model-runtime.d.ts +17 -0
- package/dist/lib/effect-ui-adapter/use-model.d.ts +9 -0
- package/dist/lib/effectcn-form.d.ts +3 -0
- package/dist/lib/effectcn-form.js +54 -0
- package/dist/lib/email-composer/index.d.ts +12 -0
- package/dist/lib/email-composer/index.js +110 -0
- package/dist/lib/email-composer/schema.d.ts +14 -0
- package/dist/lib/email-composer/schema.js +13 -0
- package/dist/lib/email-document/legacy-rich-text/editor.d.ts +70 -0
- package/dist/lib/email-document/legacy-rich-text/model.d.ts +19 -0
- package/dist/lib/email-document/legacy-rich-text/schema.d.ts +65 -0
- package/dist/lib/email-document/legacy-rich-text/tiptap.d.ts +39 -0
- package/dist/lib/email-document/model.d.ts +1 -1
- package/dist/lib/email-document/model.js +2 -2
- package/dist/lib/email-document/render.js +2 -2
- package/dist/lib/email-document/schema.js +1 -1
- package/dist/lib/httpapi-toolkit.d.ts +1 -1
- package/dist/lib/lucide-effect.d.ts +39 -0
- package/dist/lib/markdown/content.d.ts +1 -12
- package/dist/lib/rich-text/model.d.ts +5 -19
- package/dist/lib/rich-text/model.js +79 -111
- package/dist/lib/rich-text/schema.d.ts +5 -55
- package/dist/lib/rich-text/schema.js +17 -36
- package/dist/lib/rich-text/tiptap.d.ts +12 -0
- package/dist/lib/webfetch-toolkit.d.ts +1 -1
- package/dist/services/agent/client/index.js +695 -179
- package/dist/services/agent/client/widget.d.ts +1 -55
- package/dist/services/notification/client/index.js +138 -27
- package/dist/services/notification/client/notification-menu.d.ts +1 -85
- package/dist/services/notification/public.js +138 -27
- package/dist/services/opentelemetry/browser.js +15 -9
- package/dist/services/webhooks/index.d.ts +4 -3
- package/package.json +199 -137
- package/dist/components/support-dialog.js +0 -881
- package/dist/components/support.js +0 -881
- package/dist/components/ui/animated-list.js +0 -414
- package/dist/components/ui/animated-number.js +0 -75
- package/dist/components/ui/app-brand.js +0 -126
- package/dist/components/ui/app-switcher.d.ts +0 -26
- package/dist/components/ui/async-action-button.js +0 -149
- package/dist/components/ui/auto-height.js +0 -86
- package/dist/components/ui/bulk-list-input.d.ts +0 -25
- package/dist/components/ui/choice-cards.d.ts +0 -33
- package/dist/components/ui/code-block.js +0 -221
- package/dist/components/ui/color-picker.d.ts +0 -31
- package/dist/components/ui/copy-button.js +0 -138
- package/dist/components/ui/copy-value.d.ts +0 -24
- package/dist/components/ui/copy-value.js +0 -352
- package/dist/components/ui/cron-expression-editor.d.ts +0 -16
- package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
- package/dist/components/ui/danger-confirmation.js +0 -398
- package/dist/components/ui/date-picker.d.ts +0 -33
- package/dist/components/ui/date-picker.schema.d.ts +0 -9
- package/dist/components/ui/editable-text.d.ts +0 -19
- package/dist/components/ui/editable-text.js +0 -341
- package/dist/components/ui/editing-locale-switcher.d.ts +0 -11
- package/dist/components/ui/error-component.d.ts +0 -34
- package/dist/components/ui/error-component.js +0 -387
- package/dist/components/ui/file-picker.d.ts +0 -37
- package/dist/components/ui/icon-input.d.ts +0 -58
- package/dist/components/ui/image-crop-editor.d.ts +0 -41
- package/dist/components/ui/image-crop-editor.js +0 -417
- package/dist/components/ui/loading.js +0 -39
- package/dist/components/ui/locale-switcher.d.ts +0 -11
- package/dist/components/ui/map-menu-map.d.ts +0 -115
- package/dist/components/ui/map-menu.d.ts +0 -87
- package/dist/components/ui/phone-number-input.d.ts +0 -22
- package/dist/components/ui/phone-number-input.schema.d.ts +0 -7
- package/dist/components/ui/presence-transition.js +0 -94
- package/dist/components/ui/rich-text-editor.js +0 -1135
- package/dist/components/ui/select-with-custom-input.d.ts +0 -36
- package/dist/components/ui/stats-card.d.ts +0 -12
- package/dist/components/ui/stepper.d.ts +0 -37
- package/dist/components/ui/time-picker.d.ts +0 -50
- package/dist/components/ui/time-picker.schema.d.ts +0 -28
- package/dist/components/ui/timezone-select.d.ts +0 -57
- package/dist/components/ui/timezone-select.schema.d.ts +0 -9
- package/dist/components/ui/toast.d.ts +0 -18
- package/dist/components/ui/unsaved-changes-guard.d.ts +0 -16
- package/dist/components/ui/upload-attachment.d.ts +0 -39
- package/dist/lib/rich-text/dom.d.ts +0 -40
- package/dist/services/notification/persistence/drizzle.d.ts +0 -868
- package/dist/services/notification/persistence/drizzle.js +0 -214
- package/dist/services/notification/persistence/index.d.ts +0 -2
- package/dist/services/notification/persistence/index.js +0 -227
- package/dist/services/notification/persistence/schema.d.ts +0 -143
- package/dist/services/notification/persistence/schema.js +0 -118
- package/dist/services/webhooks/client/delivery-table.d.ts +0 -62
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
// ../../src/components/image-crop-editor/react.tsx
|
|
2
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
3
|
+
|
|
4
|
+
// ../../src/components/async-action-button/react.tsx
|
|
5
|
+
import { Check, LoaderCircle, RotateCcw } from "lucide-react";
|
|
6
|
+
import { Component as Component2 } from "effect/ui";
|
|
7
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
8
|
+
|
|
9
|
+
// ../../src/components/ui/button.tsx
|
|
10
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
|
|
13
|
+
// ../../src/lib/utils.ts
|
|
14
|
+
import { cn } from "cn";
|
|
15
|
+
|
|
16
|
+
// ../../src/components/ui/button.tsx
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
19
|
+
variants: {
|
|
20
|
+
variant: {
|
|
21
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
22
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
23
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
24
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
25
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
26
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
30
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
31
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
32
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
33
|
+
icon: "size-9",
|
|
34
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
35
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
36
|
+
"icon-lg": "size-10"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
size: "default"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function Button({
|
|
45
|
+
className,
|
|
46
|
+
variant = "default",
|
|
47
|
+
size = "default",
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
51
|
+
"data-slot": "button",
|
|
52
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ../../src/components/async-action-button/react.tsx
|
|
58
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
59
|
+
|
|
60
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
61
|
+
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
62
|
+
import {
|
|
63
|
+
createContext,
|
|
64
|
+
useCallback,
|
|
65
|
+
useContext,
|
|
66
|
+
useEffect,
|
|
67
|
+
useLayoutEffect,
|
|
68
|
+
useRef,
|
|
69
|
+
useState,
|
|
70
|
+
useSyncExternalStore
|
|
71
|
+
} from "react";
|
|
72
|
+
|
|
73
|
+
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
74
|
+
import { MessageLog, Renderer, View } from "effect/ui";
|
|
75
|
+
import { BrowserHost, Html } from "effect/ui/html";
|
|
76
|
+
import { Cause, Effect, Fiber } from "effect";
|
|
77
|
+
var node = () => ({ children: [] });
|
|
78
|
+
var modelHost = (commit) => {
|
|
79
|
+
const remove = (child) => {
|
|
80
|
+
if (!child.parent)
|
|
81
|
+
return;
|
|
82
|
+
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
83
|
+
delete child.parent;
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
createElement: node,
|
|
87
|
+
createText: node,
|
|
88
|
+
setText: () => {},
|
|
89
|
+
setAttr: () => {},
|
|
90
|
+
setProp: () => {},
|
|
91
|
+
setEvents: () => {},
|
|
92
|
+
insertBefore: (parent, child, before) => {
|
|
93
|
+
if (child === before)
|
|
94
|
+
return;
|
|
95
|
+
remove(child);
|
|
96
|
+
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
97
|
+
parent.children.splice(index, 0, child);
|
|
98
|
+
child.parent = parent;
|
|
99
|
+
},
|
|
100
|
+
remove,
|
|
101
|
+
parentOf: (child) => child.parent,
|
|
102
|
+
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
103
|
+
elements: ["html"],
|
|
104
|
+
controlled: new Set,
|
|
105
|
+
runsMounts: false,
|
|
106
|
+
commit
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
110
|
+
let currentProps = props;
|
|
111
|
+
let root;
|
|
112
|
+
let active = true;
|
|
113
|
+
let failure;
|
|
114
|
+
const publish = () => {
|
|
115
|
+
if (!active)
|
|
116
|
+
return;
|
|
117
|
+
if (failure) {
|
|
118
|
+
publishSnapshot({ error: failure });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const current = root?.model();
|
|
122
|
+
if (current !== undefined)
|
|
123
|
+
publishSnapshot({ model: current });
|
|
124
|
+
};
|
|
125
|
+
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
126
|
+
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
127
|
+
head: false,
|
|
128
|
+
onEmit,
|
|
129
|
+
fallback: ({ cause }) => {
|
|
130
|
+
failure = new Error("Effect UI root failed", {
|
|
131
|
+
cause: Cause.squash(cause)
|
|
132
|
+
});
|
|
133
|
+
return View.text("");
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
if (!active)
|
|
137
|
+
return;
|
|
138
|
+
root = mounted;
|
|
139
|
+
if (props !== currentProps)
|
|
140
|
+
mounted.setProps(currentProps);
|
|
141
|
+
publish();
|
|
142
|
+
return yield* Effect.never;
|
|
143
|
+
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
144
|
+
return {
|
|
145
|
+
send: (message) => {
|
|
146
|
+
root?.send(message);
|
|
147
|
+
publish();
|
|
148
|
+
},
|
|
149
|
+
setProps: (next) => {
|
|
150
|
+
currentProps = next;
|
|
151
|
+
root?.setProps(next);
|
|
152
|
+
},
|
|
153
|
+
dispose: () => {
|
|
154
|
+
active = false;
|
|
155
|
+
root = undefined;
|
|
156
|
+
Effect.runFork(Fiber.interrupt(fiber));
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
162
|
+
"use client";
|
|
163
|
+
var ModelMessageLogContext = createContext(undefined);
|
|
164
|
+
var useModel = (component, props, options = {}) => {
|
|
165
|
+
const contextLog = useContext(ModelMessageLogContext);
|
|
166
|
+
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
167
|
+
const [store] = useState(() => {
|
|
168
|
+
const initial = { model: component.init(props).model };
|
|
169
|
+
let snapshot = initial;
|
|
170
|
+
const listeners = new Set;
|
|
171
|
+
return {
|
|
172
|
+
subscribe: (listener) => {
|
|
173
|
+
listeners.add(listener);
|
|
174
|
+
return () => {
|
|
175
|
+
listeners.delete(listener);
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
getSnapshot: () => snapshot,
|
|
179
|
+
getServerSnapshot: () => initial,
|
|
180
|
+
publish: (next) => {
|
|
181
|
+
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
182
|
+
return;
|
|
183
|
+
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
184
|
+
return;
|
|
185
|
+
snapshot = next;
|
|
186
|
+
listeners.forEach((listener) => listener());
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
191
|
+
const committed = useRef(props);
|
|
192
|
+
const onEmit = useRef(options.onEmit);
|
|
193
|
+
const runtime = useRef(undefined);
|
|
194
|
+
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
195
|
+
useLayoutEffect(() => {
|
|
196
|
+
onEmit.current = options.onEmit;
|
|
197
|
+
committed.current = props;
|
|
198
|
+
runtime.current?.setProps(props);
|
|
199
|
+
}, [props, options.onEmit]);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
if (messageLog === null)
|
|
202
|
+
return;
|
|
203
|
+
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
204
|
+
runtime.current = mounted;
|
|
205
|
+
return () => {
|
|
206
|
+
runtime.current = undefined;
|
|
207
|
+
mounted.dispose();
|
|
208
|
+
};
|
|
209
|
+
}, [component, messageLog, store]);
|
|
210
|
+
if ("error" in snapshot)
|
|
211
|
+
throw snapshot.error;
|
|
212
|
+
return { model: snapshot.model, send };
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// ../../src/components/async-action-button/classes.ts
|
|
216
|
+
var asyncActionButtonClasses = {
|
|
217
|
+
root: "inline-flex min-w-0 flex-col items-start gap-2",
|
|
218
|
+
pendingIcon: "motion-safe:animate-spin",
|
|
219
|
+
error: "text-destructive text-sm"
|
|
220
|
+
};
|
|
221
|
+
var resolveAsyncActionButtonClasses = (overrides) => ({
|
|
222
|
+
...asyncActionButtonClasses,
|
|
223
|
+
...overrides
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// ../../src/components/async-action-button/index.ts
|
|
227
|
+
import { Effect as Effect2, Schema as Schema2 } from "effect";
|
|
228
|
+
import { Command, Component, UiSchema, View as View2 } from "effect/ui";
|
|
229
|
+
|
|
230
|
+
// ../../src/components/async-action-button/schema.ts
|
|
231
|
+
import { Schema, Struct } from "effect";
|
|
232
|
+
var Overrides = Schema.Struct({
|
|
233
|
+
pending: Schema.optional(Schema.String),
|
|
234
|
+
success: Schema.optional(Schema.String),
|
|
235
|
+
retry: Schema.optional(Schema.String),
|
|
236
|
+
error: Schema.optional(Schema.String)
|
|
237
|
+
}).annotate({ identifier: "AsyncActionButtonMessageOverrides" });
|
|
238
|
+
var Translations = Schema.Record(Schema.String, Schema.UndefinedOr(Overrides));
|
|
239
|
+
var AsyncActionButtonModelProps = Schema.Struct({
|
|
240
|
+
disabled: Schema.optional(Schema.Boolean)
|
|
241
|
+
}).annotate({ identifier: "AsyncActionButtonModelProps" });
|
|
242
|
+
var AsyncActionButtonClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(asyncActionButtonClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "AsyncActionButtonClassesOverrides" });
|
|
243
|
+
var AsyncActionButtonPropsSchema = Schema.Struct({
|
|
244
|
+
classes: Schema.optional(AsyncActionButtonClassesOverridesSchema),
|
|
245
|
+
...AsyncActionButtonModelProps.fields,
|
|
246
|
+
locale: Schema.optional(Schema.String),
|
|
247
|
+
messages: Schema.optional(Translations),
|
|
248
|
+
className: Schema.optional(Schema.String),
|
|
249
|
+
containerClassName: Schema.optional(Schema.String)
|
|
250
|
+
}).annotate({ identifier: "AsyncActionButtonSharedProps" });
|
|
251
|
+
|
|
252
|
+
// ../../src/components/async-action-button/index.ts
|
|
253
|
+
var labels = {
|
|
254
|
+
en: {
|
|
255
|
+
pending: "Working…",
|
|
256
|
+
success: "Completed",
|
|
257
|
+
retry: "Try again",
|
|
258
|
+
error: "The action failed. Please try again."
|
|
259
|
+
},
|
|
260
|
+
fr: {
|
|
261
|
+
pending: "En cours…",
|
|
262
|
+
success: "Terminé",
|
|
263
|
+
retry: "Réessayer",
|
|
264
|
+
error: "L’action a échoué. Veuillez réessayer."
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
var getAsyncActionButtonMessages = (locale = "en", messages) => ({
|
|
268
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
269
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
270
|
+
...messages?.[locale]
|
|
271
|
+
});
|
|
272
|
+
var AsyncActionButtonMessage = UiSchema.TaggedEnum({
|
|
273
|
+
Activated: {},
|
|
274
|
+
Finished: { success: Schema2.Boolean }
|
|
275
|
+
}).annotate({ identifier: "AsyncActionButtonMessage" });
|
|
276
|
+
|
|
277
|
+
class RunAsyncAction extends Command.Service()("async-action-button/RunAsyncAction", { args: {}, success: AsyncActionButtonMessage }) {
|
|
278
|
+
static layerFromEffect = (run) => RunAsyncAction.toLayer(() => Effect2.suspend(run).pipe(Effect2.match({
|
|
279
|
+
onSuccess: () => AsyncActionButtonMessage.Finished({ success: true }),
|
|
280
|
+
onFailure: () => AsyncActionButtonMessage.Finished({ success: false })
|
|
281
|
+
})));
|
|
282
|
+
static layerFromAction = (run) => RunAsyncAction.layerFromEffect(() => Effect2.tryPromise(() => run()));
|
|
283
|
+
}
|
|
284
|
+
var asyncActionButtonOptions = {
|
|
285
|
+
name: "AsyncActionButton",
|
|
286
|
+
props: AsyncActionButtonModelProps,
|
|
287
|
+
model: Schema2.Struct({
|
|
288
|
+
status: Schema2.Literals(["idle", "pending", "success", "error"])
|
|
289
|
+
}).annotate({ identifier: "AsyncActionButtonModel" }),
|
|
290
|
+
message: AsyncActionButtonMessage,
|
|
291
|
+
restore: false
|
|
292
|
+
};
|
|
293
|
+
var Definition = Component.define(asyncActionButtonOptions);
|
|
294
|
+
var update = Definition.update({
|
|
295
|
+
Activated: ($) => $.props.disabled || $.model.status === "pending" ? $.model : $.evolve({ status: "pending" }).run(RunAsyncAction.make({})),
|
|
296
|
+
Finished: ($, { success }) => $.model.status === "pending" ? $.evolve({ status: success ? "success" : "error" }) : $.model
|
|
297
|
+
});
|
|
298
|
+
var asyncActionButtonBehaviours = {
|
|
299
|
+
init: () => ({ status: "idle" }),
|
|
300
|
+
update
|
|
301
|
+
};
|
|
302
|
+
var AsyncActionButtonModel = Definition.make({
|
|
303
|
+
...asyncActionButtonBehaviours,
|
|
304
|
+
view: () => View2.text("")
|
|
305
|
+
});
|
|
306
|
+
var getAsyncActionButtonFeedback = (status, copy) => ({
|
|
307
|
+
label: status === "idle" ? undefined : status === "error" ? copy.retry : copy[status],
|
|
308
|
+
announcement: status === "idle" ? "" : copy[status]
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// ../../src/components/async-action-button/react.tsx
|
|
312
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
313
|
+
"use client";
|
|
314
|
+
var AsyncActionButton = ({
|
|
315
|
+
classes: classOverrides,
|
|
316
|
+
onAction,
|
|
317
|
+
onPendingChange,
|
|
318
|
+
children,
|
|
319
|
+
disabled,
|
|
320
|
+
locale: override,
|
|
321
|
+
messages,
|
|
322
|
+
containerClassName,
|
|
323
|
+
...props
|
|
324
|
+
}) => {
|
|
325
|
+
const asyncActionButtonClasses = resolveAsyncActionButtonClasses(classOverrides);
|
|
326
|
+
const copy = getAsyncActionButtonMessages(useKrakstackLocale(override), messages);
|
|
327
|
+
const callbacks = useRef2({ onAction, onPendingChange });
|
|
328
|
+
useLayoutEffect2(() => {
|
|
329
|
+
callbacks.current = { onAction, onPendingChange };
|
|
330
|
+
}, [onAction, onPendingChange]);
|
|
331
|
+
const [component] = useState2(() => AsyncActionButtonModel.pipe(Component2.provide(RunAsyncAction.layerFromAction(async () => {
|
|
332
|
+
const { onAction, onPendingChange } = callbacks.current;
|
|
333
|
+
onPendingChange?.(true);
|
|
334
|
+
try {
|
|
335
|
+
await onAction();
|
|
336
|
+
} finally {
|
|
337
|
+
onPendingChange?.(false);
|
|
338
|
+
}
|
|
339
|
+
}))));
|
|
340
|
+
const {
|
|
341
|
+
model: { status },
|
|
342
|
+
send
|
|
343
|
+
} = useModel(component, {
|
|
344
|
+
disabled: disabled ?? false
|
|
345
|
+
});
|
|
346
|
+
const { label, announcement } = getAsyncActionButtonFeedback(status, copy);
|
|
347
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
348
|
+
"data-slot": "async-action-button",
|
|
349
|
+
"data-state": status,
|
|
350
|
+
className: cn(asyncActionButtonClasses.root, containerClassName),
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
353
|
+
...props,
|
|
354
|
+
type: "button",
|
|
355
|
+
disabled: disabled || status === "pending",
|
|
356
|
+
"aria-busy": status === "pending",
|
|
357
|
+
onClick: () => send(AsyncActionButtonMessage.Activated()),
|
|
358
|
+
children: [
|
|
359
|
+
status === "pending" ? /* @__PURE__ */ jsx2(LoaderCircle, {
|
|
360
|
+
"aria-hidden": "true",
|
|
361
|
+
className: asyncActionButtonClasses.pendingIcon
|
|
362
|
+
}) : status === "success" ? /* @__PURE__ */ jsx2(Check, {
|
|
363
|
+
"aria-hidden": "true"
|
|
364
|
+
}) : status === "error" ? /* @__PURE__ */ jsx2(RotateCcw, {
|
|
365
|
+
"aria-hidden": "true"
|
|
366
|
+
}) : null,
|
|
367
|
+
label ?? children
|
|
368
|
+
]
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ jsx2("span", {
|
|
371
|
+
"data-slot": "async-action-feedback",
|
|
372
|
+
role: "status",
|
|
373
|
+
className: status === "error" ? asyncActionButtonClasses.error : "sr-only",
|
|
374
|
+
children: announcement
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// ../../src/components/ui/async-action-button.tsx
|
|
381
|
+
"use client";
|
|
382
|
+
|
|
383
|
+
// ../../src/components/image-crop-editor/react.tsx
|
|
384
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider/react";
|
|
385
|
+
|
|
386
|
+
// ../../src/components/image-crop-editor/classes.ts
|
|
387
|
+
var imageCropEditorClasses = {
|
|
388
|
+
root: "grid min-w-0 gap-4",
|
|
389
|
+
viewport: "bg-muted mx-auto w-full max-w-md touch-none overflow-hidden rounded-lg border select-none",
|
|
390
|
+
hint: "text-muted-foreground text-sm",
|
|
391
|
+
controls: "grid min-w-0 gap-3",
|
|
392
|
+
control: "grid gap-1 text-sm",
|
|
393
|
+
slider: "accent-primary w-full",
|
|
394
|
+
actions: "flex flex-wrap gap-2"
|
|
395
|
+
};
|
|
396
|
+
var resolveImageCropEditorClasses = (overrides) => ({
|
|
397
|
+
...imageCropEditorClasses,
|
|
398
|
+
...overrides
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// ../../src/components/image-crop-editor/index.ts
|
|
402
|
+
import { Schema as Schema4 } from "effect";
|
|
403
|
+
import { Component as Component3, UiSchema as UiSchema2 } from "effect/ui";
|
|
404
|
+
|
|
405
|
+
// ../../src/components/image-crop-editor/schema.ts
|
|
406
|
+
import { Schema as Schema3, Struct as Struct2 } from "effect";
|
|
407
|
+
var ImageCropStateSchema = Schema3.Struct({
|
|
408
|
+
x: Schema3.Number,
|
|
409
|
+
y: Schema3.Number,
|
|
410
|
+
zoom: Schema3.Number,
|
|
411
|
+
rotation: Schema3.Literals([0, 90, 180, 270])
|
|
412
|
+
}).annotate({ identifier: "ImageCropState" });
|
|
413
|
+
var Overrides2 = Schema3.Struct({
|
|
414
|
+
zoom: Schema3.optional(Schema3.String),
|
|
415
|
+
horizontal: Schema3.optional(Schema3.String),
|
|
416
|
+
vertical: Schema3.optional(Schema3.String),
|
|
417
|
+
rotate: Schema3.optional(Schema3.String),
|
|
418
|
+
reset: Schema3.optional(Schema3.String),
|
|
419
|
+
export: Schema3.optional(Schema3.String),
|
|
420
|
+
loading: Schema3.optional(Schema3.String),
|
|
421
|
+
loadError: Schema3.optional(Schema3.String),
|
|
422
|
+
help: Schema3.optional(Schema3.String),
|
|
423
|
+
exportError: Schema3.optional(Schema3.String)
|
|
424
|
+
}).annotate({ identifier: "ImageCropEditorMessageOverrides" });
|
|
425
|
+
var ImageCropEditorClassesOverridesSchema = Schema3.Record(Schema3.Literals(Struct2.keys(imageCropEditorClasses)), Schema3.optionalKey(Schema3.String)).annotate({ identifier: "ImageCropEditorClassesOverrides" });
|
|
426
|
+
var ImageCropEditorPropsSchema = Schema3.Struct({
|
|
427
|
+
classes: Schema3.optional(ImageCropEditorClassesOverridesSchema),
|
|
428
|
+
src: Schema3.String,
|
|
429
|
+
label: Schema3.String,
|
|
430
|
+
value: ImageCropStateSchema,
|
|
431
|
+
aspectRatio: Schema3.optional(Schema3.Number),
|
|
432
|
+
maxOutputSize: Schema3.optional(Schema3.Number),
|
|
433
|
+
disabled: Schema3.optional(Schema3.Boolean),
|
|
434
|
+
className: Schema3.optional(Schema3.String),
|
|
435
|
+
locale: Schema3.optional(Schema3.String),
|
|
436
|
+
messages: Schema3.optional(Schema3.Record(Schema3.String, Overrides2))
|
|
437
|
+
}).annotate({ identifier: "ImageCropEditorProps" });
|
|
438
|
+
var ImageCropBlob = Schema3.Redacted(Schema3.declare((value) => typeof Blob !== "undefined" && value instanceof Blob)).annotate({ identifier: "ImageCropBlob" });
|
|
439
|
+
|
|
440
|
+
// ../../src/components/image-crop-editor/index.ts
|
|
441
|
+
var defaultMessages = {
|
|
442
|
+
en: {
|
|
443
|
+
zoom: "Zoom",
|
|
444
|
+
horizontal: "Horizontal position",
|
|
445
|
+
vertical: "Vertical position",
|
|
446
|
+
rotate: "Rotate 90°",
|
|
447
|
+
reset: "Reset crop",
|
|
448
|
+
export: "Export image",
|
|
449
|
+
loading: "Loading image…",
|
|
450
|
+
loadError: "The image could not be loaded. Check the source and its cross-origin policy.",
|
|
451
|
+
help: "Drag to position the image, or use the position and zoom sliders with the arrow keys.",
|
|
452
|
+
exportError: "Could not export the image. Check image permissions and try again."
|
|
453
|
+
},
|
|
454
|
+
fr: {
|
|
455
|
+
zoom: "Zoom",
|
|
456
|
+
horizontal: "Position horizontale",
|
|
457
|
+
vertical: "Position verticale",
|
|
458
|
+
rotate: "Pivoter de 90°",
|
|
459
|
+
reset: "Réinitialiser le cadrage",
|
|
460
|
+
export: "Exporter l’image",
|
|
461
|
+
loading: "Chargement de l’image…",
|
|
462
|
+
loadError: "Impossible de charger l’image. Vérifiez sa source et sa politique d’accès interorigine.",
|
|
463
|
+
help: "Faites glisser l’image ou utilisez les curseurs de position et de zoom avec les touches fléchées.",
|
|
464
|
+
exportError: "Impossible d’exporter l’image. Vérifiez les autorisations de l’image et réessayez."
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
var getImageCropMessages = (locale = "en", messages) => ({
|
|
468
|
+
...locale.startsWith("fr") ? defaultMessages.fr : defaultMessages.en,
|
|
469
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
470
|
+
...messages?.[locale]
|
|
471
|
+
});
|
|
472
|
+
var defaultCrop = {
|
|
473
|
+
x: 50,
|
|
474
|
+
y: 50,
|
|
475
|
+
zoom: 1,
|
|
476
|
+
rotation: 0
|
|
477
|
+
};
|
|
478
|
+
var rotateCrop = (value) => ({
|
|
479
|
+
...value,
|
|
480
|
+
rotation: value.rotation === 0 ? 90 : value.rotation === 90 ? 180 : value.rotation === 180 ? 270 : 0
|
|
481
|
+
});
|
|
482
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, Number.isFinite(value) ? value : min));
|
|
483
|
+
var getImageCropGeometry = (width, height, value, aspectRatio = 1) => {
|
|
484
|
+
const rotated = value.rotation === 90 || value.rotation === 270;
|
|
485
|
+
const sourceWidth = rotated ? height : width;
|
|
486
|
+
const sourceHeight = rotated ? width : height;
|
|
487
|
+
const ratio = clamp(aspectRatio, 0.1, 10);
|
|
488
|
+
const cropWidth = Math.min(sourceWidth, sourceHeight * ratio) / clamp(value.zoom, 1, 4);
|
|
489
|
+
const cropHeight = cropWidth / ratio;
|
|
490
|
+
return {
|
|
491
|
+
x: (sourceWidth - cropWidth) * clamp(value.x, 0, 100) / 100,
|
|
492
|
+
y: (sourceHeight - cropHeight) * clamp(value.y, 0, 100) / 100,
|
|
493
|
+
width: cropWidth,
|
|
494
|
+
height: cropHeight,
|
|
495
|
+
sourceWidth,
|
|
496
|
+
sourceHeight
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
var imageCropTransform = (width, height, rotation) => rotation === 90 ? `translate(${height} 0) rotate(90)` : rotation === 180 ? `translate(${width} ${height}) rotate(180)` : rotation === 270 ? `translate(0 ${width}) rotate(270)` : undefined;
|
|
500
|
+
var dragImageCrop = (value, crop, viewportWidth, dx, dy) => {
|
|
501
|
+
if (viewportWidth <= 0)
|
|
502
|
+
return value;
|
|
503
|
+
const scale = viewportWidth / crop.width;
|
|
504
|
+
const travelX = crop.sourceWidth - crop.width;
|
|
505
|
+
const travelY = crop.sourceHeight - crop.height;
|
|
506
|
+
return {
|
|
507
|
+
...value,
|
|
508
|
+
x: travelX > 0 ? clamp(value.x - dx / scale / travelX * 100, 0, 100) : 50,
|
|
509
|
+
y: travelY > 0 ? clamp(value.y - dy / scale / travelY * 100, 0, 100) : 50
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
var exportCropPng = (image, value, aspectRatio = 1, maxOutputSize = 2048) => {
|
|
513
|
+
const { naturalWidth: width, naturalHeight: height } = image;
|
|
514
|
+
const crop = getImageCropGeometry(width, height, value, aspectRatio);
|
|
515
|
+
const canvas = image.ownerDocument.createElement("canvas");
|
|
516
|
+
const scale = Math.min(1, clamp(maxOutputSize, 1, 8192) / Math.max(crop.width, crop.height));
|
|
517
|
+
canvas.width = Math.max(1, Math.round(crop.width * scale));
|
|
518
|
+
canvas.height = Math.max(1, Math.round(crop.height * scale));
|
|
519
|
+
const context = canvas.getContext("2d");
|
|
520
|
+
if (!context || !width || !height)
|
|
521
|
+
return Promise.reject(new Error("CanvasUnavailable"));
|
|
522
|
+
context.scale(canvas.width / crop.width, canvas.height / crop.height);
|
|
523
|
+
context.translate(-crop.x, -crop.y);
|
|
524
|
+
if (value.rotation === 90) {
|
|
525
|
+
context.translate(height, 0);
|
|
526
|
+
context.rotate(Math.PI / 2);
|
|
527
|
+
}
|
|
528
|
+
if (value.rotation === 180) {
|
|
529
|
+
context.translate(width, height);
|
|
530
|
+
context.rotate(Math.PI);
|
|
531
|
+
}
|
|
532
|
+
if (value.rotation === 270) {
|
|
533
|
+
context.translate(0, width);
|
|
534
|
+
context.rotate(-Math.PI / 2);
|
|
535
|
+
}
|
|
536
|
+
context.drawImage(image, 0, 0);
|
|
537
|
+
return new Promise((resolve, reject) => canvas.toBlob((blob) => blob ? resolve(blob) : reject(new Error("ImageEncodingFailed")), "image/png"));
|
|
538
|
+
};
|
|
539
|
+
var Size = Schema4.Struct({ width: Schema4.Int, height: Schema4.Int }).annotate({
|
|
540
|
+
identifier: "ImageCropSize"
|
|
541
|
+
});
|
|
542
|
+
var Drag = Schema4.Struct({
|
|
543
|
+
pointer: Schema4.Int,
|
|
544
|
+
x: Schema4.Number,
|
|
545
|
+
y: Schema4.Number,
|
|
546
|
+
value: ImageCropStateSchema
|
|
547
|
+
}).annotate({ identifier: "ImageCropDrag" });
|
|
548
|
+
var ImageCropMessage = UiSchema2.TaggedEnum({
|
|
549
|
+
Loaded: { size: Schema4.NullOr(Size) },
|
|
550
|
+
SliderChanged: {
|
|
551
|
+
control: Schema4.Literals(["x", "y", "zoom"]),
|
|
552
|
+
value: Schema4.Number
|
|
553
|
+
},
|
|
554
|
+
Rotated: {},
|
|
555
|
+
Reset: {},
|
|
556
|
+
Exported: {},
|
|
557
|
+
ExportFailed: {},
|
|
558
|
+
ExportSucceeded: { blob: ImageCropBlob },
|
|
559
|
+
DragStarted: { pointer: Schema4.Int, x: Schema4.Number, y: Schema4.Number },
|
|
560
|
+
Dragged: {
|
|
561
|
+
pointer: Schema4.Int,
|
|
562
|
+
x: Schema4.Number,
|
|
563
|
+
y: Schema4.Number,
|
|
564
|
+
width: Schema4.Number
|
|
565
|
+
},
|
|
566
|
+
DragEnded: { pointer: Schema4.Int }
|
|
567
|
+
}).annotate({ identifier: "ImageCropMessage" });
|
|
568
|
+
var ImageCropEvents = UiSchema2.TaggedEnum({
|
|
569
|
+
ValueChanged: { value: ImageCropStateSchema },
|
|
570
|
+
Export: { blob: ImageCropBlob }
|
|
571
|
+
}).annotate({ identifier: "ImageCropEvents" });
|
|
572
|
+
var imageCropEditorOptions = {
|
|
573
|
+
name: "ImageCropEditor",
|
|
574
|
+
props: ImageCropEditorPropsSchema,
|
|
575
|
+
model: Schema4.Struct({
|
|
576
|
+
size: Schema4.NullOr(Size),
|
|
577
|
+
loaded: Schema4.Boolean,
|
|
578
|
+
exportStatus: Schema4.Literals(["idle", "pending", "success", "error"]),
|
|
579
|
+
drag: Schema4.NullOr(Drag)
|
|
580
|
+
}).annotate({ identifier: "ImageCropEditorModel" }),
|
|
581
|
+
message: ImageCropMessage,
|
|
582
|
+
events: ImageCropEvents,
|
|
583
|
+
restore: false
|
|
584
|
+
};
|
|
585
|
+
var locked = ({ model, props }) => props.disabled || !model.size || model.exportStatus === "pending";
|
|
586
|
+
var change = ($, value) => locked($) ? $.model : $.set($.model).emit(ImageCropEvents.ValueChanged({ value }));
|
|
587
|
+
var imageCropEditorBehaviours = {
|
|
588
|
+
init: () => ({
|
|
589
|
+
size: null,
|
|
590
|
+
loaded: false,
|
|
591
|
+
exportStatus: "idle",
|
|
592
|
+
drag: null
|
|
593
|
+
}),
|
|
594
|
+
update: Component3.define(imageCropEditorOptions).update({
|
|
595
|
+
Loaded: ($, { size }) => $.evolve({ size, loaded: true }),
|
|
596
|
+
SliderChanged: ($, { control, value }) => change($, { ...$.props.value, [control]: value }),
|
|
597
|
+
Rotated: ($) => change($, rotateCrop($.props.value)),
|
|
598
|
+
Reset: ($) => change($, defaultCrop),
|
|
599
|
+
Exported: ($) => locked($) ? $.model : $.evolve({ exportStatus: "pending", drag: null }),
|
|
600
|
+
ExportFailed: ($) => $.evolve({ exportStatus: "error" }),
|
|
601
|
+
ExportSucceeded: ($, { blob }) => $.evolve({ exportStatus: "success" }).emit(ImageCropEvents.Export({ blob })),
|
|
602
|
+
DragStarted: ($, { pointer, x, y }) => locked($) || $.model.drag ? $.model : $.evolve({ drag: { pointer, x, y, value: $.props.value } }),
|
|
603
|
+
Dragged: ($, { pointer, x, y, width }) => {
|
|
604
|
+
const { drag, size } = $.model;
|
|
605
|
+
if (!size || !drag || drag.pointer !== pointer)
|
|
606
|
+
return $.model;
|
|
607
|
+
const crop = getImageCropGeometry(size.width, size.height, drag.value, $.props.aspectRatio);
|
|
608
|
+
return change($, dragImageCrop(drag.value, crop, width, x - drag.x, y - drag.y));
|
|
609
|
+
},
|
|
610
|
+
DragEnded: ($, { pointer }) => $.model.drag?.pointer === pointer ? $.evolve({ drag: null }) : $.model
|
|
611
|
+
})
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
// ../../src/components/image-crop-editor/react.tsx
|
|
615
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
616
|
+
var ImageCropEditor = (props) => /* @__PURE__ */ jsx3(ImageCropSession, {
|
|
617
|
+
...props
|
|
618
|
+
}, props.src);
|
|
619
|
+
var ImageCropSession = ({
|
|
620
|
+
classes: classOverrides,
|
|
621
|
+
src,
|
|
622
|
+
label,
|
|
623
|
+
value,
|
|
624
|
+
onValueChange,
|
|
625
|
+
onExport,
|
|
626
|
+
aspectRatio = 1,
|
|
627
|
+
maxOutputSize = 2048,
|
|
628
|
+
disabled,
|
|
629
|
+
className,
|
|
630
|
+
locale: override,
|
|
631
|
+
messages
|
|
632
|
+
}) => {
|
|
633
|
+
const imageCropEditorClasses = resolveImageCropEditorClasses(classOverrides);
|
|
634
|
+
const locale = useKrakstackLocale2(override);
|
|
635
|
+
const copy = getImageCropMessages(locale, messages);
|
|
636
|
+
const image = useRef3(null);
|
|
637
|
+
const [size, setSize] = useState3();
|
|
638
|
+
const [failed, setFailed] = useState3(false);
|
|
639
|
+
const [pending, setPending] = useState3(false);
|
|
640
|
+
const attachImage = useCallback2((element) => {
|
|
641
|
+
image.current = element;
|
|
642
|
+
if (!element?.complete)
|
|
643
|
+
return;
|
|
644
|
+
if (element.naturalWidth > 0) {
|
|
645
|
+
setSize({ width: element.naturalWidth, height: element.naturalHeight });
|
|
646
|
+
} else
|
|
647
|
+
setFailed(true);
|
|
648
|
+
}, []);
|
|
649
|
+
const mounted = useRef3(false);
|
|
650
|
+
useEffect2(() => {
|
|
651
|
+
mounted.current = true;
|
|
652
|
+
return () => {
|
|
653
|
+
mounted.current = false;
|
|
654
|
+
};
|
|
655
|
+
}, []);
|
|
656
|
+
const drag = useRef3(null);
|
|
657
|
+
const crop = size ? getImageCropGeometry(size.width, size.height, value, aspectRatio) : undefined;
|
|
658
|
+
const transform = size ? imageCropTransform(size.width, size.height, value.rotation) : undefined;
|
|
659
|
+
const locked = disabled || pending;
|
|
660
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
661
|
+
"data-slot": "image-crop-editor",
|
|
662
|
+
className,
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ jsx3("img", {
|
|
665
|
+
ref: attachImage,
|
|
666
|
+
src,
|
|
667
|
+
crossOrigin: "anonymous",
|
|
668
|
+
alt: "",
|
|
669
|
+
className: "hidden",
|
|
670
|
+
onLoad: (event) => setSize({
|
|
671
|
+
width: event.currentTarget.naturalWidth,
|
|
672
|
+
height: event.currentTarget.naturalHeight
|
|
673
|
+
}),
|
|
674
|
+
onError: () => {
|
|
675
|
+
setFailed(true);
|
|
676
|
+
setSize(undefined);
|
|
677
|
+
}
|
|
678
|
+
}, src),
|
|
679
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
680
|
+
className: imageCropEditorClasses.root,
|
|
681
|
+
children: [
|
|
682
|
+
crop && size ? /* @__PURE__ */ jsx3("svg", {
|
|
683
|
+
"data-slot": "image-crop-preview",
|
|
684
|
+
role: "img",
|
|
685
|
+
"aria-label": label,
|
|
686
|
+
viewBox: `${crop.x} ${crop.y} ${crop.width} ${crop.height}`,
|
|
687
|
+
className: imageCropEditorClasses.viewport,
|
|
688
|
+
style: {
|
|
689
|
+
aspectRatio: crop.width / crop.height,
|
|
690
|
+
cursor: locked ? "default" : "move"
|
|
691
|
+
},
|
|
692
|
+
onPointerDown: (event) => {
|
|
693
|
+
if (locked || !event.isPrimary || event.button !== 0)
|
|
694
|
+
return;
|
|
695
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
696
|
+
drag.current = {
|
|
697
|
+
pointerId: event.pointerId,
|
|
698
|
+
x: event.clientX,
|
|
699
|
+
y: event.clientY,
|
|
700
|
+
value
|
|
701
|
+
};
|
|
702
|
+
},
|
|
703
|
+
onPointerMove: (event) => {
|
|
704
|
+
const start = drag.current;
|
|
705
|
+
if (locked || !start || start.pointerId !== event.pointerId)
|
|
706
|
+
return;
|
|
707
|
+
onValueChange(dragImageCrop(start.value, crop, event.currentTarget.getBoundingClientRect().width, event.clientX - start.x, event.clientY - start.y));
|
|
708
|
+
},
|
|
709
|
+
onPointerUp: () => {
|
|
710
|
+
drag.current = null;
|
|
711
|
+
},
|
|
712
|
+
onPointerCancel: () => {
|
|
713
|
+
drag.current = null;
|
|
714
|
+
},
|
|
715
|
+
onLostPointerCapture: () => {
|
|
716
|
+
drag.current = null;
|
|
717
|
+
},
|
|
718
|
+
children: /* @__PURE__ */ jsx3("image", {
|
|
719
|
+
href: src,
|
|
720
|
+
width: size.width,
|
|
721
|
+
height: size.height,
|
|
722
|
+
transform
|
|
723
|
+
})
|
|
724
|
+
}) : /* @__PURE__ */ jsx3("p", {
|
|
725
|
+
role: failed ? "alert" : "status",
|
|
726
|
+
children: failed ? copy.loadError : copy.loading
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ jsx3("p", {
|
|
729
|
+
"data-slot": "image-crop-help",
|
|
730
|
+
className: imageCropEditorClasses.hint,
|
|
731
|
+
children: copy.help
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ jsxs2("fieldset", {
|
|
734
|
+
"data-slot": "image-crop-controls",
|
|
735
|
+
disabled: locked || !crop,
|
|
736
|
+
className: imageCropEditorClasses.controls,
|
|
737
|
+
children: [
|
|
738
|
+
["zoom", "x", "y"].map((key) => /* @__PURE__ */ jsxs2("label", {
|
|
739
|
+
className: imageCropEditorClasses.control,
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ jsx3("span", {
|
|
742
|
+
children: key === "zoom" ? copy.zoom : key === "x" ? copy.horizontal : copy.vertical
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ jsx3("input", {
|
|
745
|
+
"data-slot": "image-crop-slider",
|
|
746
|
+
"data-control": key,
|
|
747
|
+
type: "range",
|
|
748
|
+
min: key === "zoom" ? 1 : 0,
|
|
749
|
+
max: key === "zoom" ? 4 : 100,
|
|
750
|
+
step: key === "zoom" ? 0.01 : 1,
|
|
751
|
+
value: value[key],
|
|
752
|
+
onChange: (event) => onValueChange({
|
|
753
|
+
...value,
|
|
754
|
+
[key]: event.currentTarget.valueAsNumber
|
|
755
|
+
}),
|
|
756
|
+
className: imageCropEditorClasses.slider
|
|
757
|
+
})
|
|
758
|
+
]
|
|
759
|
+
}, key)),
|
|
760
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
761
|
+
"data-slot": "image-crop-actions",
|
|
762
|
+
className: imageCropEditorClasses.actions,
|
|
763
|
+
children: [
|
|
764
|
+
/* @__PURE__ */ jsx3(Button, {
|
|
765
|
+
type: "button",
|
|
766
|
+
variant: "outline",
|
|
767
|
+
onClick: () => onValueChange(rotateCrop(value)),
|
|
768
|
+
children: copy.rotate
|
|
769
|
+
}),
|
|
770
|
+
/* @__PURE__ */ jsx3(Button, {
|
|
771
|
+
type: "button",
|
|
772
|
+
variant: "outline",
|
|
773
|
+
onClick: () => onValueChange(defaultCrop),
|
|
774
|
+
children: copy.reset
|
|
775
|
+
})
|
|
776
|
+
]
|
|
777
|
+
})
|
|
778
|
+
]
|
|
779
|
+
}),
|
|
780
|
+
/* @__PURE__ */ jsx3(AsyncActionButton, {
|
|
781
|
+
locale,
|
|
782
|
+
disabled: disabled || !crop,
|
|
783
|
+
onPendingChange: setPending,
|
|
784
|
+
messages: { [locale]: { error: copy.exportError } },
|
|
785
|
+
onAction: async () => {
|
|
786
|
+
if (!crop || !image.current || !size)
|
|
787
|
+
return;
|
|
788
|
+
const blob = await exportCropPng(image.current, value, aspectRatio, maxOutputSize);
|
|
789
|
+
if (mounted.current)
|
|
790
|
+
await onExport(blob);
|
|
791
|
+
},
|
|
792
|
+
children: copy.export
|
|
793
|
+
})
|
|
794
|
+
]
|
|
795
|
+
})
|
|
796
|
+
]
|
|
797
|
+
});
|
|
798
|
+
};
|
|
799
|
+
export {
|
|
800
|
+
ImageCropEditor,
|
|
801
|
+
getImageCropGeometry
|
|
802
|
+
};
|