@krak-stack/registry 0.10.20 → 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 +83 -3
- package/README.md +11 -8
- 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} +2180 -909
- 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} +2174 -897
- 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} +63 -10
- 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} +302 -76
- 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/{ui/email-composer.js → email-composer/react.js} +618 -135
- 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 -21
- 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} +778 -256
- 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} +7 -7
- package/dist/components/{ui/form.js → form/react.js} +300 -74
- 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} +321 -83
- 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} +123 -23
- 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/{ui/rich-text-editor.js → rich-text-editor/react.js} +521 -100
- 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} +127 -22
- 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 -72
- package/dist/components/ui/search-menu.d.ts +1 -36
- 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} +2461 -948
- 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 +863 -295
- 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/schema.d.ts +14 -0
- 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 -0
- package/dist/lib/webfetch-toolkit.d.ts +1 -1
- package/dist/services/agent/client/index.js +697 -181
- 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 +181 -142
- 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/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/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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// ../../src/components/
|
|
2
|
-
import { Schema as
|
|
1
|
+
// ../../src/components/email-editor/react.tsx
|
|
2
|
+
import { Schema as Schema11 } from "effect";
|
|
3
3
|
import { Popover } from "@base-ui/react/popover";
|
|
4
4
|
import {
|
|
5
5
|
useId as useId3,
|
|
6
6
|
useMemo,
|
|
7
|
-
useRef as
|
|
8
|
-
useState as
|
|
7
|
+
useRef as useRef4,
|
|
8
|
+
useState as useState5
|
|
9
9
|
} from "react";
|
|
10
10
|
import {
|
|
11
11
|
Type,
|
|
@@ -240,17 +240,18 @@ function PopoverTitle({ className, ...props }) {
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
// ../../src/components/
|
|
243
|
+
// ../../src/components/animated-list/react.tsx
|
|
244
244
|
import {
|
|
245
|
-
useEffect as
|
|
245
|
+
useEffect as useEffect3,
|
|
246
246
|
useEffectEvent as useEffectEvent2,
|
|
247
247
|
useId,
|
|
248
|
-
useRef as
|
|
249
|
-
useState as
|
|
248
|
+
useRef as useRef3,
|
|
249
|
+
useState as useState3
|
|
250
250
|
} from "react";
|
|
251
251
|
import { GripVertical } from "lucide-react";
|
|
252
|
+
import { Component as Component2, View as View2 } from "effect/ui";
|
|
252
253
|
import { cn as cn2 } from "cn";
|
|
253
|
-
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
254
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
254
255
|
|
|
255
256
|
// ../../src/lib/krakmotion.ts
|
|
256
257
|
import {
|
|
@@ -284,26 +285,6 @@ var animateElement = (element, frames, duration, complete) => {
|
|
|
284
285
|
animation.cancel();
|
|
285
286
|
};
|
|
286
287
|
};
|
|
287
|
-
var useKeyedPresence = (items, getKey) => {
|
|
288
|
-
const [previous, setPrevious] = useState(items);
|
|
289
|
-
const [retained, setRetained] = useState(items);
|
|
290
|
-
if (previous !== items) {
|
|
291
|
-
const keys = new Set(items.map(getKey));
|
|
292
|
-
const next = [...items];
|
|
293
|
-
retained.forEach((item, index) => {
|
|
294
|
-
if (!keys.has(getKey(item)))
|
|
295
|
-
next.splice(Math.min(index, next.length), 0, item);
|
|
296
|
-
});
|
|
297
|
-
setPrevious(items);
|
|
298
|
-
setRetained(next);
|
|
299
|
-
}
|
|
300
|
-
const present = new Set(items.map(getKey));
|
|
301
|
-
return {
|
|
302
|
-
items: retained,
|
|
303
|
-
present,
|
|
304
|
-
remove: (key) => setRetained((current) => current.filter((item) => getKey(item) !== key))
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
288
|
var useListLayout = (ref, duration) => {
|
|
308
289
|
const previous = useRef(new Map);
|
|
309
290
|
const animations = useRef(new Map);
|
|
@@ -469,8 +450,205 @@ var useVerticalDrag = ({
|
|
|
469
450
|
};
|
|
470
451
|
};
|
|
471
452
|
|
|
472
|
-
// ../../src/
|
|
473
|
-
import {
|
|
453
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
454
|
+
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
455
|
+
import {
|
|
456
|
+
createContext,
|
|
457
|
+
useCallback,
|
|
458
|
+
useContext,
|
|
459
|
+
useEffect as useEffect2,
|
|
460
|
+
useLayoutEffect as useLayoutEffect2,
|
|
461
|
+
useRef as useRef2,
|
|
462
|
+
useState as useState2,
|
|
463
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
464
|
+
} from "react";
|
|
465
|
+
|
|
466
|
+
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
467
|
+
import { MessageLog, Renderer, View } from "effect/ui";
|
|
468
|
+
import { BrowserHost, Html } from "effect/ui/html";
|
|
469
|
+
import { Cause, Effect, Fiber } from "effect";
|
|
470
|
+
var node = () => ({ children: [] });
|
|
471
|
+
var modelHost = (commit) => {
|
|
472
|
+
const remove = (child) => {
|
|
473
|
+
if (!child.parent)
|
|
474
|
+
return;
|
|
475
|
+
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
476
|
+
delete child.parent;
|
|
477
|
+
};
|
|
478
|
+
return {
|
|
479
|
+
createElement: node,
|
|
480
|
+
createText: node,
|
|
481
|
+
setText: () => {},
|
|
482
|
+
setAttr: () => {},
|
|
483
|
+
setProp: () => {},
|
|
484
|
+
setEvents: () => {},
|
|
485
|
+
insertBefore: (parent, child, before) => {
|
|
486
|
+
if (child === before)
|
|
487
|
+
return;
|
|
488
|
+
remove(child);
|
|
489
|
+
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
490
|
+
parent.children.splice(index, 0, child);
|
|
491
|
+
child.parent = parent;
|
|
492
|
+
},
|
|
493
|
+
remove,
|
|
494
|
+
parentOf: (child) => child.parent,
|
|
495
|
+
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
496
|
+
elements: ["html"],
|
|
497
|
+
controlled: new Set,
|
|
498
|
+
runsMounts: false,
|
|
499
|
+
commit
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
503
|
+
let currentProps = props;
|
|
504
|
+
let root;
|
|
505
|
+
let active = true;
|
|
506
|
+
let failure;
|
|
507
|
+
const publish = () => {
|
|
508
|
+
if (!active)
|
|
509
|
+
return;
|
|
510
|
+
if (failure) {
|
|
511
|
+
publishSnapshot({ error: failure });
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const current = root?.model();
|
|
515
|
+
if (current !== undefined)
|
|
516
|
+
publishSnapshot({ model: current });
|
|
517
|
+
};
|
|
518
|
+
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
519
|
+
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
520
|
+
head: false,
|
|
521
|
+
onEmit,
|
|
522
|
+
fallback: ({ cause }) => {
|
|
523
|
+
failure = new Error("Effect UI root failed", {
|
|
524
|
+
cause: Cause.squash(cause)
|
|
525
|
+
});
|
|
526
|
+
return View.text("");
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
if (!active)
|
|
530
|
+
return;
|
|
531
|
+
root = mounted;
|
|
532
|
+
if (props !== currentProps)
|
|
533
|
+
mounted.setProps(currentProps);
|
|
534
|
+
publish();
|
|
535
|
+
return yield* Effect.never;
|
|
536
|
+
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
537
|
+
return {
|
|
538
|
+
send: (message) => {
|
|
539
|
+
root?.send(message);
|
|
540
|
+
publish();
|
|
541
|
+
},
|
|
542
|
+
setProps: (next) => {
|
|
543
|
+
currentProps = next;
|
|
544
|
+
root?.setProps(next);
|
|
545
|
+
},
|
|
546
|
+
dispose: () => {
|
|
547
|
+
active = false;
|
|
548
|
+
root = undefined;
|
|
549
|
+
Effect.runFork(Fiber.interrupt(fiber));
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
555
|
+
"use client";
|
|
556
|
+
var ModelMessageLogContext = createContext(undefined);
|
|
557
|
+
var useModel = (component, props, options = {}) => {
|
|
558
|
+
const contextLog = useContext(ModelMessageLogContext);
|
|
559
|
+
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
560
|
+
const [store] = useState2(() => {
|
|
561
|
+
const initial = { model: component.init(props).model };
|
|
562
|
+
let snapshot = initial;
|
|
563
|
+
const listeners = new Set;
|
|
564
|
+
return {
|
|
565
|
+
subscribe: (listener) => {
|
|
566
|
+
listeners.add(listener);
|
|
567
|
+
return () => {
|
|
568
|
+
listeners.delete(listener);
|
|
569
|
+
};
|
|
570
|
+
},
|
|
571
|
+
getSnapshot: () => snapshot,
|
|
572
|
+
getServerSnapshot: () => initial,
|
|
573
|
+
publish: (next) => {
|
|
574
|
+
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
575
|
+
return;
|
|
576
|
+
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
577
|
+
return;
|
|
578
|
+
snapshot = next;
|
|
579
|
+
listeners.forEach((listener) => listener());
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
const snapshot = useSyncExternalStore2(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
584
|
+
const committed = useRef2(props);
|
|
585
|
+
const onEmit = useRef2(options.onEmit);
|
|
586
|
+
const runtime = useRef2(undefined);
|
|
587
|
+
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
588
|
+
useLayoutEffect2(() => {
|
|
589
|
+
onEmit.current = options.onEmit;
|
|
590
|
+
committed.current = props;
|
|
591
|
+
runtime.current?.setProps(props);
|
|
592
|
+
}, [props, options.onEmit]);
|
|
593
|
+
useEffect2(() => {
|
|
594
|
+
if (messageLog === null)
|
|
595
|
+
return;
|
|
596
|
+
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
597
|
+
runtime.current = mounted;
|
|
598
|
+
return () => {
|
|
599
|
+
runtime.current = undefined;
|
|
600
|
+
mounted.dispose();
|
|
601
|
+
};
|
|
602
|
+
}, [component, messageLog, store]);
|
|
603
|
+
if ("error" in snapshot)
|
|
604
|
+
throw snapshot.error;
|
|
605
|
+
return { model: snapshot.model, send };
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
// ../../src/components/animated-list/classes.ts
|
|
609
|
+
var animatedListClasses = {
|
|
610
|
+
list: "relative grid gap-3",
|
|
611
|
+
dragHandle: "text-muted-foreground focus-visible:ring-ring inline-flex size-8 shrink-0 cursor-grab touch-none items-center justify-center rounded-md outline-none select-none focus-visible:ring-2 active:cursor-grabbing disabled:cursor-default disabled:opacity-50"
|
|
612
|
+
};
|
|
613
|
+
var resolveAnimatedListClasses = (overrides) => ({
|
|
614
|
+
...animatedListClasses,
|
|
615
|
+
...overrides
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// ../../src/components/animated-list/index.ts
|
|
619
|
+
import { Schema as Schema2, Stream } from "effect";
|
|
620
|
+
import { Component, Subscription, UiSchema } from "effect/ui";
|
|
621
|
+
|
|
622
|
+
// ../../src/components/animated-list/schema.ts
|
|
623
|
+
import { Predicate, Schema, Struct } from "effect";
|
|
624
|
+
var Position = Schema.declare((value) => Predicate.isFunction(value));
|
|
625
|
+
var MessageOverrides = Schema.Struct({
|
|
626
|
+
reorder: Schema.optional(Schema.String),
|
|
627
|
+
instructions: Schema.optional(Schema.String),
|
|
628
|
+
position: Schema.optional(Position)
|
|
629
|
+
});
|
|
630
|
+
var AnimatedListClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(animatedListClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "AnimatedListClassesOverrides" });
|
|
631
|
+
var AnimatedListPropsSchema = Schema.Struct({
|
|
632
|
+
classes: Schema.optional(AnimatedListClassesOverridesSchema),
|
|
633
|
+
duration: Schema.optional(Schema.Number),
|
|
634
|
+
className: Schema.optional(Schema.String),
|
|
635
|
+
itemClassName: Schema.optional(Schema.String),
|
|
636
|
+
label: Schema.optional(Schema.String),
|
|
637
|
+
dragOverflow: Schema.optional(Schema.Number),
|
|
638
|
+
locale: Schema.optional(Schema.String),
|
|
639
|
+
messages: Schema.optional(Schema.Record(Schema.String, Schema.UndefinedOr(MessageOverrides)))
|
|
640
|
+
}).annotate({ identifier: "AnimatedListProps" });
|
|
641
|
+
var AnimatedListRow = Schema.Struct({
|
|
642
|
+
key: Schema.String,
|
|
643
|
+
label: Schema.optional(Schema.String)
|
|
644
|
+
}).annotate({ identifier: "AnimatedListRow" });
|
|
645
|
+
var AnimatedListModelProps = Schema.Struct({
|
|
646
|
+
...AnimatedListPropsSchema.fields,
|
|
647
|
+
items: Schema.Array(AnimatedListRow),
|
|
648
|
+
reorderable: Schema.optional(Schema.Boolean)
|
|
649
|
+
}).annotate({ identifier: "AnimatedListModelProps" });
|
|
650
|
+
|
|
651
|
+
// ../../src/components/animated-list/index.ts
|
|
474
652
|
var labels = {
|
|
475
653
|
en: {
|
|
476
654
|
reorder: "Reorder",
|
|
@@ -483,7 +661,107 @@ var labels = {
|
|
|
483
661
|
position: (label, position, total) => `${label}, position ${position} sur ${total}.`
|
|
484
662
|
}
|
|
485
663
|
};
|
|
664
|
+
var animatedListCopy = (locale, messages) => ({
|
|
665
|
+
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
666
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
667
|
+
...messages?.[locale]
|
|
668
|
+
});
|
|
669
|
+
var reorderTarget = (key, index, total) => key === "Home" ? 0 : key === "End" ? total - 1 : key === "ArrowUp" ? Math.max(0, index - 1) : key === "ArrowDown" ? Math.min(total - 1, index + 1) : undefined;
|
|
670
|
+
var moveItem = (items, from, to) => {
|
|
671
|
+
if (from < 0 || from >= items.length || to < 0 || to >= items.length || from === to)
|
|
672
|
+
return;
|
|
673
|
+
const next = [...items];
|
|
674
|
+
next.splice(to, 0, ...next.splice(from, 1));
|
|
675
|
+
return next;
|
|
676
|
+
};
|
|
677
|
+
var retainedRows = (items, previous) => {
|
|
678
|
+
const keys = new Set(items.map((row) => row.key));
|
|
679
|
+
const next = [...items];
|
|
680
|
+
previous.forEach((row, index) => {
|
|
681
|
+
if (!keys.has(row.key))
|
|
682
|
+
next.splice(Math.min(index, next.length), 0, row);
|
|
683
|
+
});
|
|
684
|
+
return next;
|
|
685
|
+
};
|
|
686
|
+
var listAnnouncement = (items, key, copy) => {
|
|
687
|
+
const index = items.findIndex((row) => row.key === key);
|
|
688
|
+
const row = items[index];
|
|
689
|
+
return row ? copy.position(row.label ?? row.key, index + 1, items.length) : "";
|
|
690
|
+
};
|
|
691
|
+
var AnimatedListMessage = UiSchema.TaggedEnum({
|
|
692
|
+
Synced: {},
|
|
693
|
+
Exited: { key: Schema2.String },
|
|
694
|
+
Announced: { key: Schema2.String },
|
|
695
|
+
Moved: { key: Schema2.String, to: Schema2.Number }
|
|
696
|
+
});
|
|
697
|
+
var AnimatedListEvent = UiSchema.TaggedEnum({
|
|
698
|
+
Reordered: {
|
|
699
|
+
from: Schema2.Number,
|
|
700
|
+
to: Schema2.Number,
|
|
701
|
+
items: Schema2.Array(AnimatedListRow)
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
var animatedListOptions = {
|
|
705
|
+
name: "AnimatedList",
|
|
706
|
+
props: AnimatedListModelProps,
|
|
707
|
+
model: Schema2.Struct({
|
|
708
|
+
lastItems: Schema2.Array(AnimatedListRow),
|
|
709
|
+
rows: Schema2.Array(AnimatedListRow),
|
|
710
|
+
announcedKey: Schema2.NullOr(Schema2.String)
|
|
711
|
+
}).annotate({ identifier: "AnimatedListModel" }),
|
|
712
|
+
message: AnimatedListMessage,
|
|
713
|
+
restore: false
|
|
714
|
+
};
|
|
715
|
+
var Definition = Component.define(animatedListOptions);
|
|
716
|
+
var changed = Subscription.make("animated-list/changed", Stream.succeed(AnimatedListMessage.Synced()));
|
|
717
|
+
var listMove = (props, key, to) => {
|
|
718
|
+
const from = props.items.findIndex((row) => row.key === key);
|
|
719
|
+
const items = props.reorderable && moveItem(props.items, from, to);
|
|
720
|
+
return items ? { from, to, items } : undefined;
|
|
721
|
+
};
|
|
722
|
+
var updateAnimatedList = ({
|
|
723
|
+
model,
|
|
724
|
+
props
|
|
725
|
+
}, message) => {
|
|
726
|
+
switch (message._tag) {
|
|
727
|
+
case "Synced":
|
|
728
|
+
return {
|
|
729
|
+
...model,
|
|
730
|
+
lastItems: props.items,
|
|
731
|
+
rows: retainedRows(props.items, model.rows)
|
|
732
|
+
};
|
|
733
|
+
case "Exited":
|
|
734
|
+
return props.items.some((row) => row.key === message.key) ? model : {
|
|
735
|
+
...model,
|
|
736
|
+
rows: model.rows.filter((row) => row.key !== message.key)
|
|
737
|
+
};
|
|
738
|
+
case "Announced":
|
|
739
|
+
return { ...model, announcedKey: message.key };
|
|
740
|
+
case "Moved":
|
|
741
|
+
return listMove(props, message.key, message.to) ? { ...model, announcedKey: message.key } : model;
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
var update = Definition.update(updateAnimatedList);
|
|
745
|
+
var animatedListBehaviours = {
|
|
746
|
+
init: Definition.init(({ props }) => ({
|
|
747
|
+
lastItems: props.items,
|
|
748
|
+
rows: props.items,
|
|
749
|
+
announcedKey: null
|
|
750
|
+
})),
|
|
751
|
+
update,
|
|
752
|
+
subscriptions: Definition.subscriptions(({ model, props }) => [
|
|
753
|
+
(props.items.length !== model.lastItems.length || props.items.some(({ key, label }, index) => model.lastItems[index]?.key !== key || model.lastItems[index]?.label !== label)) && changed
|
|
754
|
+
])
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
// ../../src/components/animated-list/react.tsx
|
|
758
|
+
import { jsx as jsx5, jsxs as jsxs2, Fragment } from "react/jsx-runtime";
|
|
759
|
+
var Model = Component2.define(animatedListOptions).make({
|
|
760
|
+
...animatedListBehaviours,
|
|
761
|
+
view: () => View2.text("")
|
|
762
|
+
});
|
|
486
763
|
var AnimatedList = ({
|
|
764
|
+
classes: classOverrides,
|
|
487
765
|
items,
|
|
488
766
|
getKey,
|
|
489
767
|
children,
|
|
@@ -497,30 +775,45 @@ var AnimatedList = ({
|
|
|
497
775
|
locale: override,
|
|
498
776
|
messages
|
|
499
777
|
}) => {
|
|
778
|
+
const animatedListClasses = resolveAnimatedListClasses(classOverrides);
|
|
500
779
|
const locale = useKrakstackLocale(override);
|
|
501
|
-
const copy =
|
|
502
|
-
...locale.startsWith("fr") ? labels.fr : labels.en,
|
|
503
|
-
...messages?.[locale.split("-")[0] ?? locale],
|
|
504
|
-
...messages?.[locale]
|
|
505
|
-
};
|
|
780
|
+
const copy = animatedListCopy(locale, messages);
|
|
506
781
|
const instructions = useId();
|
|
507
|
-
const container =
|
|
508
|
-
const
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
782
|
+
const container = useRef3(null);
|
|
783
|
+
const descriptors = items.map((item) => ({
|
|
784
|
+
key: getKey(item),
|
|
785
|
+
label: getItemLabel?.(item)
|
|
786
|
+
}));
|
|
787
|
+
const { model, send } = useModel(Model, {
|
|
788
|
+
items: descriptors,
|
|
789
|
+
reorderable: !!onReorder
|
|
790
|
+
});
|
|
791
|
+
const retained = retainedRows(descriptors, model.rows);
|
|
792
|
+
const current = new Map(items.map((item) => [getKey(item), { item }]));
|
|
793
|
+
const [previous, setPrevious] = useState3(() => ({
|
|
794
|
+
items,
|
|
795
|
+
rows: model.rows,
|
|
796
|
+
rendered: current
|
|
797
|
+
}));
|
|
798
|
+
const rendered = new Map(retained.flatMap(({ key }) => {
|
|
799
|
+
const value = current.get(key) ?? previous.rendered.get(key);
|
|
800
|
+
return value ? [[key, value]] : [];
|
|
801
|
+
}));
|
|
802
|
+
if (previous.items !== items || previous.rows !== model.rows) {
|
|
803
|
+
setPrevious({ items, rows: model.rows, rendered });
|
|
804
|
+
}
|
|
805
|
+
const committed = useRef3(false);
|
|
806
|
+
useEffect3(() => {
|
|
807
|
+
committed.current = true;
|
|
808
|
+
}, []);
|
|
512
809
|
useListLayout(container, duration);
|
|
513
|
-
const announcement =
|
|
810
|
+
const announcement = listAnnouncement(descriptors, model.announcedKey, copy);
|
|
514
811
|
const move = (key, target) => {
|
|
515
812
|
const index = items.findIndex((item) => getKey(item) === key);
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const next = [...items];
|
|
519
|
-
const [item] = next.splice(index, 1);
|
|
520
|
-
if (item === undefined)
|
|
813
|
+
const next = onReorder && moveItem(items, index, target);
|
|
814
|
+
if (!next || !onReorder)
|
|
521
815
|
return;
|
|
522
|
-
|
|
523
|
-
setAnnouncedKey(key);
|
|
816
|
+
send(AnimatedListMessage.Announced({ key }));
|
|
524
817
|
onReorder(next);
|
|
525
818
|
};
|
|
526
819
|
return /* @__PURE__ */ jsxs2(Fragment, {
|
|
@@ -528,27 +821,30 @@ var AnimatedList = ({
|
|
|
528
821
|
/* @__PURE__ */ jsx5("ul", {
|
|
529
822
|
ref: container,
|
|
530
823
|
"data-slot": "animated-list",
|
|
531
|
-
className: cn2(
|
|
824
|
+
className: cn2(animatedListClasses.list, className),
|
|
532
825
|
"aria-label": label,
|
|
533
|
-
children: retained.
|
|
534
|
-
const
|
|
826
|
+
children: retained.map(({ key, label }) => {
|
|
827
|
+
const value = rendered.get(key);
|
|
828
|
+
if (!value)
|
|
829
|
+
return null;
|
|
535
830
|
const index = items.findIndex((candidate) => getKey(candidate) === key);
|
|
536
831
|
return /* @__PURE__ */ jsx5(ListItem, {
|
|
537
832
|
itemKey: key,
|
|
538
|
-
present:
|
|
539
|
-
|
|
833
|
+
present: current.has(key),
|
|
834
|
+
committed,
|
|
540
835
|
duration,
|
|
541
836
|
className: itemClassName,
|
|
837
|
+
handleClassName: animatedListClasses.dragHandle,
|
|
542
838
|
instructions,
|
|
543
|
-
handleLabel: `${copy.reorder}: ${
|
|
839
|
+
handleLabel: `${copy.reorder}: ${label ?? key}`,
|
|
544
840
|
reorderable: !!onReorder,
|
|
545
841
|
disabled: items.length < 2,
|
|
546
842
|
container,
|
|
547
843
|
dragOverflow,
|
|
548
|
-
onExit: () =>
|
|
844
|
+
onExit: () => send(AnimatedListMessage.Exited({ key })),
|
|
549
845
|
onMove: (target) => move(key, target),
|
|
550
|
-
onKeyMove: (direction) => move(key, direction
|
|
551
|
-
children: children(item)
|
|
846
|
+
onKeyMove: (direction) => move(key, reorderTarget(direction, index, items.length) ?? index),
|
|
847
|
+
children: children(value.item)
|
|
552
848
|
}, key);
|
|
553
849
|
})
|
|
554
850
|
}),
|
|
@@ -574,11 +870,12 @@ var AnimatedList = ({
|
|
|
574
870
|
var ListItem = ({
|
|
575
871
|
itemKey,
|
|
576
872
|
present,
|
|
577
|
-
|
|
873
|
+
committed,
|
|
578
874
|
duration,
|
|
579
875
|
className,
|
|
580
876
|
instructions,
|
|
581
877
|
handleLabel,
|
|
878
|
+
handleClassName,
|
|
582
879
|
reorderable,
|
|
583
880
|
disabled,
|
|
584
881
|
container,
|
|
@@ -588,10 +885,10 @@ var ListItem = ({
|
|
|
588
885
|
onKeyMove,
|
|
589
886
|
children
|
|
590
887
|
}) => {
|
|
591
|
-
const ref =
|
|
592
|
-
const mounted =
|
|
593
|
-
const lastPresent =
|
|
594
|
-
const transitioning =
|
|
888
|
+
const ref = useRef3(null);
|
|
889
|
+
const mounted = useRef3(false);
|
|
890
|
+
const lastPresent = useRef3(present);
|
|
891
|
+
const transitioning = useRef3(false);
|
|
595
892
|
const exit = useEffectEvent2(onExit);
|
|
596
893
|
const reduced = useReducedMotion();
|
|
597
894
|
const drag = useVerticalDrag({
|
|
@@ -601,11 +898,11 @@ var ListItem = ({
|
|
|
601
898
|
overflow: dragOverflow,
|
|
602
899
|
onMove
|
|
603
900
|
});
|
|
604
|
-
|
|
901
|
+
useEffect3(() => {
|
|
605
902
|
const element = ref.current;
|
|
606
903
|
const first = !mounted.current;
|
|
607
904
|
mounted.current = true;
|
|
608
|
-
if (!element || first &&
|
|
905
|
+
if (!element || first && !committed.current && present)
|
|
609
906
|
return;
|
|
610
907
|
if (!first && lastPresent.current === present && !transitioning.current)
|
|
611
908
|
return;
|
|
@@ -616,7 +913,7 @@ var ListItem = ({
|
|
|
616
913
|
if (!present)
|
|
617
914
|
exit();
|
|
618
915
|
});
|
|
619
|
-
}, [present,
|
|
916
|
+
}, [present, committed, duration, reduced]);
|
|
620
917
|
return /* @__PURE__ */ jsxs2("li", {
|
|
621
918
|
ref,
|
|
622
919
|
"data-slot": "animated-list-item",
|
|
@@ -631,7 +928,7 @@ var ListItem = ({
|
|
|
631
928
|
disabled: disabled || !present,
|
|
632
929
|
"aria-label": handleLabel,
|
|
633
930
|
"aria-describedby": instructions,
|
|
634
|
-
className:
|
|
931
|
+
className: handleClassName,
|
|
635
932
|
...drag,
|
|
636
933
|
onKeyDown: (event) => {
|
|
637
934
|
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
@@ -651,17 +948,16 @@ var ListItem = ({
|
|
|
651
948
|
]
|
|
652
949
|
});
|
|
653
950
|
};
|
|
654
|
-
|
|
655
951
|
// ../../src/lib/email-document/legacy-rich-text/editor.tsx
|
|
656
|
-
import { Option as Option2, Schema as
|
|
952
|
+
import { Option as Option2, Schema as Schema6 } from "effect";
|
|
657
953
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
658
954
|
import { EditorState } from "@tiptap/pm/state";
|
|
659
955
|
import { closeHistory } from "@tiptap/pm/history";
|
|
660
956
|
import {
|
|
661
|
-
useEffect as
|
|
957
|
+
useEffect as useEffect4,
|
|
662
958
|
useEffectEvent as useEffectEvent3,
|
|
663
959
|
useId as useId2,
|
|
664
|
-
useState as
|
|
960
|
+
useState as useState4
|
|
665
961
|
} from "react";
|
|
666
962
|
import {
|
|
667
963
|
Bold,
|
|
@@ -730,63 +1026,63 @@ function DropdownMenuItem({
|
|
|
730
1026
|
}
|
|
731
1027
|
|
|
732
1028
|
// ../../src/lib/email-document/legacy-rich-text/editor.tsx
|
|
733
|
-
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider";
|
|
1029
|
+
import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider/react";
|
|
734
1030
|
|
|
735
1031
|
// ../../src/lib/email-document/legacy-rich-text/schema.ts
|
|
736
|
-
import { Schema } from "effect";
|
|
737
|
-
var RichTextLink =
|
|
1032
|
+
import { Schema as Schema3 } from "effect";
|
|
1033
|
+
var RichTextLink = Schema3.String.check(Schema3.isMaxLength(2000), Schema3.makeFilter((value) => {
|
|
738
1034
|
if (/[\s\p{Cc}\\{}]/u.test(value))
|
|
739
1035
|
return false;
|
|
740
1036
|
const url = URL.parse(value);
|
|
741
1037
|
return url !== null && ["https:", "mailto:"].includes(url.protocol) && !url.username && !url.password;
|
|
742
1038
|
})).annotate({ identifier: "RichTextLink" });
|
|
743
|
-
var RichTextMarks =
|
|
744
|
-
bold:
|
|
745
|
-
italic:
|
|
746
|
-
underline:
|
|
747
|
-
href:
|
|
1039
|
+
var RichTextMarks = Schema3.Struct({
|
|
1040
|
+
bold: Schema3.optional(Schema3.Boolean),
|
|
1041
|
+
italic: Schema3.optional(Schema3.Boolean),
|
|
1042
|
+
underline: Schema3.optional(Schema3.Boolean),
|
|
1043
|
+
href: Schema3.optional(RichTextLink)
|
|
748
1044
|
}).annotate({ identifier: "RichTextMarks" });
|
|
749
|
-
var RichTextInline =
|
|
750
|
-
|
|
751
|
-
type:
|
|
752
|
-
text:
|
|
753
|
-
marks:
|
|
1045
|
+
var RichTextInline = Schema3.Union([
|
|
1046
|
+
Schema3.Struct({
|
|
1047
|
+
type: Schema3.Literal("text"),
|
|
1048
|
+
text: Schema3.String.check(Schema3.isMaxLength(20000)),
|
|
1049
|
+
marks: Schema3.optional(RichTextMarks)
|
|
754
1050
|
}),
|
|
755
|
-
|
|
756
|
-
type:
|
|
757
|
-
key:
|
|
758
|
-
marks:
|
|
1051
|
+
Schema3.Struct({
|
|
1052
|
+
type: Schema3.Literal("variable"),
|
|
1053
|
+
key: Schema3.String.check(Schema3.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
|
|
1054
|
+
marks: Schema3.optional(RichTextMarks)
|
|
759
1055
|
})
|
|
760
1056
|
]).annotate({ identifier: "RichTextInline" });
|
|
761
|
-
var RichTextBlockKind =
|
|
1057
|
+
var RichTextBlockKind = Schema3.Literals([
|
|
762
1058
|
"paragraph",
|
|
763
1059
|
"heading",
|
|
764
1060
|
"bullet",
|
|
765
1061
|
"numbered"
|
|
766
1062
|
]).annotate({ identifier: "RichTextBlockKind" });
|
|
767
|
-
var RichTextDocument =
|
|
768
|
-
version:
|
|
769
|
-
blocks:
|
|
1063
|
+
var RichTextDocument = Schema3.Struct({
|
|
1064
|
+
version: Schema3.Literal(1),
|
|
1065
|
+
blocks: Schema3.Array(Schema3.Struct({
|
|
770
1066
|
type: RichTextBlockKind,
|
|
771
|
-
content:
|
|
772
|
-
})).check(
|
|
773
|
-
}).check(
|
|
774
|
-
var RichTextVariable =
|
|
775
|
-
key:
|
|
776
|
-
label:
|
|
777
|
-
type:
|
|
778
|
-
sample:
|
|
1067
|
+
content: Schema3.Array(RichTextInline).check(Schema3.isMaxLength(2000))
|
|
1068
|
+
})).check(Schema3.isMinLength(1), Schema3.isMaxLength(100))
|
|
1069
|
+
}).check(Schema3.makeFilter((value) => value.blocks.reduce((size, block) => size + block.content.reduce((count, inline) => count + (inline.type === "text" ? inline.text.length : 1), 0), 0) <= 20000)).annotate({ identifier: "RichTextDocument" });
|
|
1070
|
+
var RichTextVariable = Schema3.Struct({
|
|
1071
|
+
key: Schema3.String.check(Schema3.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/)),
|
|
1072
|
+
label: Schema3.String,
|
|
1073
|
+
type: Schema3.Literals(["text", "url"]),
|
|
1074
|
+
sample: Schema3.String
|
|
779
1075
|
}).annotate({ identifier: "RichTextVariable" });
|
|
780
1076
|
|
|
781
1077
|
// ../../src/lib/email-document/legacy-rich-text/tiptap.ts
|
|
782
1078
|
import { Extension, Node } from "@tiptap/core";
|
|
783
1079
|
import { Plugin } from "@tiptap/pm/state";
|
|
784
1080
|
import StarterKit from "@tiptap/starter-kit";
|
|
785
|
-
import { Option, Schema as
|
|
1081
|
+
import { Option, Schema as Schema5 } from "effect";
|
|
786
1082
|
|
|
787
1083
|
// ../../src/lib/email-document/legacy-rich-text/model.ts
|
|
788
|
-
import { Schema as
|
|
789
|
-
var sameMarks =
|
|
1084
|
+
import { Schema as Schema4 } from "effect";
|
|
1085
|
+
var sameMarks = Schema4.toEquivalence(RichTextMarks);
|
|
790
1086
|
var richTextFromString = (text) => ({
|
|
791
1087
|
version: 1,
|
|
792
1088
|
blocks: text.split(/\r\n?|\n/).map((line) => ({
|
|
@@ -849,9 +1145,9 @@ var fromTiptapDocument = (doc) => {
|
|
|
849
1145
|
});
|
|
850
1146
|
blocks.push({ type: block.attrs.kind, content });
|
|
851
1147
|
});
|
|
852
|
-
return
|
|
1148
|
+
return Schema5.decodeUnknownOption(RichTextDocument)({ version: 1, blocks });
|
|
853
1149
|
};
|
|
854
|
-
var SingleLineDocument = RichTextDocument.check(
|
|
1150
|
+
var SingleLineDocument = RichTextDocument.check(Schema5.makeFilter((value) => value.blocks.length === 1 && value.blocks.every((block) => block.type === "paragraph" && block.content.every((inline) => !inline.marks && (inline.type !== "text" || !/[\r\n]/.test(inline.text)))))).annotate({ identifier: "SingleLineRichTextDocument" });
|
|
855
1151
|
var richTextExtensions = ({
|
|
856
1152
|
singleLine = false,
|
|
857
1153
|
maxLength = () => {
|
|
@@ -883,7 +1179,7 @@ var richTextExtensions = ({
|
|
|
883
1179
|
openOnClick: false,
|
|
884
1180
|
autolink: false,
|
|
885
1181
|
linkOnPaste: false,
|
|
886
|
-
isAllowedUri: (url) =>
|
|
1182
|
+
isAllowedUri: (url) => Schema5.is(RichTextLink)(url),
|
|
887
1183
|
HTMLAttributes: { class: "underline" }
|
|
888
1184
|
},
|
|
889
1185
|
undoRedo: { depth: 100 }
|
|
@@ -896,7 +1192,7 @@ var richTextExtensions = ({
|
|
|
896
1192
|
addAttributes: () => ({ kind: { default: "paragraph" } }),
|
|
897
1193
|
parseHTML: () => [{ tag: "p" }],
|
|
898
1194
|
renderHTML: ({ node }) => {
|
|
899
|
-
const kind =
|
|
1195
|
+
const kind = Schema5.decodeUnknownSync(RichTextBlockKind)(node.attrs.kind);
|
|
900
1196
|
if (kind === "heading")
|
|
901
1197
|
return ["h2", { class: "text-xl font-semibold" }, 0];
|
|
902
1198
|
return [
|
|
@@ -933,7 +1229,7 @@ var richTextExtensions = ({
|
|
|
933
1229
|
addAttributes: () => ({ key: { default: null } }),
|
|
934
1230
|
renderText: ({ node }) => `{{${node.attrs.key}}}`,
|
|
935
1231
|
renderHTML: ({ node }) => {
|
|
936
|
-
const key =
|
|
1232
|
+
const key = Schema5.decodeUnknownSync(Schema5.String)(node.attrs.key);
|
|
937
1233
|
return [
|
|
938
1234
|
"span",
|
|
939
1235
|
{
|
|
@@ -954,7 +1250,7 @@ var richTextExtensions = ({
|
|
|
954
1250
|
return true;
|
|
955
1251
|
const decoded = fromTiptapDocument(transaction.doc);
|
|
956
1252
|
const limit = maxLength();
|
|
957
|
-
const valid = Option.isSome(decoded) && (!singleLine ||
|
|
1253
|
+
const valid = Option.isSome(decoded) && (!singleLine || Schema5.is(SingleLineDocument)(decoded.value)) && (limit === undefined || richTextPlainText(decoded.value).length <= limit);
|
|
958
1254
|
onInvalid?.(!valid);
|
|
959
1255
|
return valid;
|
|
960
1256
|
}
|
|
@@ -1097,11 +1393,11 @@ var RichTextEditor = ({
|
|
|
1097
1393
|
...messages?.[locale.split("-")[0] ?? locale],
|
|
1098
1394
|
...messages?.[locale]
|
|
1099
1395
|
};
|
|
1100
|
-
const [error, setError] =
|
|
1101
|
-
const [linkOpen, setLinkOpen] =
|
|
1102
|
-
const [link, setLink] =
|
|
1103
|
-
const [linkError, setLinkError] =
|
|
1104
|
-
const [revision, setRevision] =
|
|
1396
|
+
const [error, setError] = useState4(false);
|
|
1397
|
+
const [linkOpen, setLinkOpen] = useState4(false);
|
|
1398
|
+
const [link, setLink] = useState4("");
|
|
1399
|
+
const [linkError, setLinkError] = useState4(false);
|
|
1400
|
+
const [revision, setRevision] = useState4(0);
|
|
1105
1401
|
const id = useId2();
|
|
1106
1402
|
const getMaxLength = useEffectEvent3(() => maxLength);
|
|
1107
1403
|
const getVariables = useEffectEvent3(() => variables);
|
|
@@ -1195,7 +1491,7 @@ var RichTextEditor = ({
|
|
|
1195
1491
|
editor.chain().insertContent({ type: "variable", attrs: { key } }).run();
|
|
1196
1492
|
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
1197
1493
|
};
|
|
1198
|
-
|
|
1494
|
+
useEffect4(() => {
|
|
1199
1495
|
if (!editor)
|
|
1200
1496
|
return;
|
|
1201
1497
|
const incoming = editor.schema.nodeFromJSON(toTiptapDocument(value, singleLine));
|
|
@@ -1208,12 +1504,12 @@ var RichTextEditor = ({
|
|
|
1208
1504
|
editor.view.dispatch(editor.state.tr.setMeta(externalReplacementMeta, true));
|
|
1209
1505
|
}
|
|
1210
1506
|
}, [editor, value, singleLine]);
|
|
1211
|
-
|
|
1507
|
+
useEffect4(() => {
|
|
1212
1508
|
if (!editor)
|
|
1213
1509
|
return;
|
|
1214
1510
|
editor.setEditable(!disabled, false);
|
|
1215
1511
|
}, [editor, disabled]);
|
|
1216
|
-
|
|
1512
|
+
useEffect4(() => {
|
|
1217
1513
|
if (!editor)
|
|
1218
1514
|
return;
|
|
1219
1515
|
for (const chip of editor.view.dom.querySelectorAll("[data-rich-variable]")) {
|
|
@@ -1384,7 +1680,7 @@ var RichTextEditor = ({
|
|
|
1384
1680
|
size: "sm",
|
|
1385
1681
|
disabled,
|
|
1386
1682
|
onClick: () => {
|
|
1387
|
-
if (!
|
|
1683
|
+
if (!Schema6.is(RichTextLink)(link)) {
|
|
1388
1684
|
setLinkError(true);
|
|
1389
1685
|
return;
|
|
1390
1686
|
}
|
|
@@ -1492,92 +1788,92 @@ function TabsContent({ className, ...props }) {
|
|
|
1492
1788
|
});
|
|
1493
1789
|
}
|
|
1494
1790
|
|
|
1495
|
-
// ../../src/components/
|
|
1496
|
-
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider";
|
|
1791
|
+
// ../../src/components/email-editor/react.tsx
|
|
1792
|
+
import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
|
|
1497
1793
|
|
|
1498
1794
|
// ../../src/lib/email-document/schema.ts
|
|
1499
|
-
import { Schema as
|
|
1500
|
-
var EmailImageUrl = RichTextLink.check(
|
|
1501
|
-
var EmailColor =
|
|
1502
|
-
var EmailAlignment =
|
|
1795
|
+
import { Schema as Schema7 } from "effect";
|
|
1796
|
+
var EmailImageUrl = RichTextLink.check(Schema7.isPattern(/^https:\/\//)).annotate({ identifier: "EmailImageUrl" });
|
|
1797
|
+
var EmailColor = Schema7.String.check(Schema7.isPattern(/^#[0-9a-fA-F]{6}$/)).annotate({ identifier: "EmailColor" });
|
|
1798
|
+
var EmailAlignment = Schema7.Literals([
|
|
1503
1799
|
"left",
|
|
1504
1800
|
"center",
|
|
1505
1801
|
"right"
|
|
1506
1802
|
]).annotate({ identifier: "EmailAlignment" });
|
|
1507
|
-
var EmailFont =
|
|
1803
|
+
var EmailFont = Schema7.Literals(["sans", "serif", "mono"]).annotate({
|
|
1508
1804
|
identifier: "EmailFont"
|
|
1509
1805
|
});
|
|
1510
|
-
var spacing =
|
|
1806
|
+
var spacing = Schema7.Int.check(Schema7.isBetween({ minimum: 0, maximum: 96 }));
|
|
1511
1807
|
var common = {
|
|
1512
|
-
id:
|
|
1808
|
+
id: Schema7.NonEmptyString.check(Schema7.isMaxLength(80)),
|
|
1513
1809
|
alignment: EmailAlignment,
|
|
1514
1810
|
paddingTop: spacing,
|
|
1515
1811
|
paddingBottom: spacing
|
|
1516
1812
|
};
|
|
1517
|
-
var EmailDestination =
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
type:
|
|
1813
|
+
var EmailDestination = Schema7.Union([
|
|
1814
|
+
Schema7.Struct({ type: Schema7.Literal("url"), url: RichTextLink }),
|
|
1815
|
+
Schema7.Struct({
|
|
1816
|
+
type: Schema7.Literal("variable"),
|
|
1521
1817
|
key: RichTextVariable.fields.key
|
|
1522
1818
|
})
|
|
1523
1819
|
]).annotate({ identifier: "EmailDestination" });
|
|
1524
|
-
var EmailElement =
|
|
1525
|
-
|
|
1820
|
+
var EmailElement = Schema7.Union([
|
|
1821
|
+
Schema7.Struct({
|
|
1526
1822
|
...common,
|
|
1527
|
-
type:
|
|
1823
|
+
type: Schema7.Literal("text"),
|
|
1528
1824
|
content: RichTextDocument
|
|
1529
1825
|
}),
|
|
1530
|
-
|
|
1826
|
+
Schema7.Struct({
|
|
1531
1827
|
...common,
|
|
1532
|
-
type:
|
|
1533
|
-
label:
|
|
1828
|
+
type: Schema7.Literal("button"),
|
|
1829
|
+
label: Schema7.String.check(Schema7.isMaxLength(200)),
|
|
1534
1830
|
destination: EmailDestination
|
|
1535
1831
|
}),
|
|
1536
|
-
|
|
1832
|
+
Schema7.Struct({
|
|
1537
1833
|
...common,
|
|
1538
|
-
type:
|
|
1834
|
+
type: Schema7.Literal("code"),
|
|
1539
1835
|
variable: RichTextVariable.fields.key
|
|
1540
1836
|
}),
|
|
1541
|
-
|
|
1837
|
+
Schema7.Struct({
|
|
1542
1838
|
...common,
|
|
1543
|
-
type:
|
|
1839
|
+
type: Schema7.Literals(["logo", "image"]),
|
|
1544
1840
|
src: EmailImageUrl,
|
|
1545
|
-
alt:
|
|
1546
|
-
width:
|
|
1841
|
+
alt: Schema7.String.check(Schema7.isMaxLength(200)),
|
|
1842
|
+
width: Schema7.Int.check(Schema7.isBetween({ minimum: 32, maximum: 560 }))
|
|
1547
1843
|
}),
|
|
1548
|
-
|
|
1549
|
-
|
|
1844
|
+
Schema7.Struct({ ...common, type: Schema7.Literal("divider") }),
|
|
1845
|
+
Schema7.Struct({ ...common, type: Schema7.Literal("spacer"), height: spacing })
|
|
1550
1846
|
]).annotate({ identifier: "EmailElement" });
|
|
1551
|
-
var subject =
|
|
1552
|
-
var EmailDocument =
|
|
1553
|
-
version:
|
|
1847
|
+
var subject = Schema7.String.check(Schema7.isMaxLength(200), Schema7.isPattern(/^[^\r\n]*$/));
|
|
1848
|
+
var EmailDocument = Schema7.Struct({
|
|
1849
|
+
version: Schema7.Literal(1),
|
|
1554
1850
|
subject,
|
|
1555
1851
|
preview: subject,
|
|
1556
|
-
appearance:
|
|
1852
|
+
appearance: Schema7.Struct({
|
|
1557
1853
|
background: EmailColor,
|
|
1558
1854
|
surface: EmailColor,
|
|
1559
1855
|
text: EmailColor,
|
|
1560
1856
|
primary: EmailColor,
|
|
1561
1857
|
primaryText: EmailColor,
|
|
1562
1858
|
font: EmailFont,
|
|
1563
|
-
radius:
|
|
1859
|
+
radius: Schema7.Int.check(Schema7.isBetween({ minimum: 0, maximum: 32 }))
|
|
1564
1860
|
}),
|
|
1565
|
-
elements:
|
|
1566
|
-
}).check(
|
|
1567
|
-
var EmailRenderInput =
|
|
1861
|
+
elements: Schema7.Array(EmailElement).check(Schema7.isMaxLength(40))
|
|
1862
|
+
}).check(Schema7.makeFilter((document2) => new Set(document2.elements.map((element) => element.id)).size === document2.elements.length)).annotate({ identifier: "EmailDocument" });
|
|
1863
|
+
var EmailRenderInput = Schema7.Struct({
|
|
1568
1864
|
document: EmailDocument,
|
|
1569
|
-
variables:
|
|
1570
|
-
values:
|
|
1571
|
-
requiredVariables:
|
|
1865
|
+
variables: Schema7.Array(RichTextVariable),
|
|
1866
|
+
values: Schema7.Record(Schema7.String, Schema7.String),
|
|
1867
|
+
requiredVariables: Schema7.optional(Schema7.Array(Schema7.String))
|
|
1572
1868
|
}).annotate({ identifier: "EmailRenderInput" });
|
|
1573
|
-
var EmailRenderResult =
|
|
1574
|
-
subject:
|
|
1575
|
-
html:
|
|
1576
|
-
text:
|
|
1869
|
+
var EmailRenderResult = Schema7.Struct({
|
|
1870
|
+
subject: Schema7.String,
|
|
1871
|
+
html: Schema7.String,
|
|
1872
|
+
text: Schema7.String
|
|
1577
1873
|
}).annotate({ identifier: "EmailRenderResult" });
|
|
1578
1874
|
|
|
1579
1875
|
// ../../src/lib/email-document/model.ts
|
|
1580
|
-
import { Schema as
|
|
1876
|
+
import { Schema as Schema8 } from "effect";
|
|
1581
1877
|
var emailElementTypes = [
|
|
1582
1878
|
"text",
|
|
1583
1879
|
"button",
|
|
@@ -1658,7 +1954,7 @@ var validateEmailDocument = ({
|
|
|
1658
1954
|
values,
|
|
1659
1955
|
requiredVariables = []
|
|
1660
1956
|
}) => {
|
|
1661
|
-
if (!
|
|
1957
|
+
if (!Schema8.is(EmailDocument)(document2))
|
|
1662
1958
|
return [{ code: "invalid-document" }];
|
|
1663
1959
|
const references = emailDocumentReferences(document2);
|
|
1664
1960
|
const issues = [];
|
|
@@ -1671,7 +1967,7 @@ var validateEmailDocument = ({
|
|
|
1671
1967
|
for (const element of document2.elements) {
|
|
1672
1968
|
if (element.type === "button" && element.destination.type === "variable") {
|
|
1673
1969
|
const key = element.destination.key;
|
|
1674
|
-
if (variables.find((variable) => variable.key === key)?.type !== "url" || values && !
|
|
1970
|
+
if (variables.find((variable) => variable.key === key)?.type !== "url" || values && !Schema8.is(RichTextLink)(values[key]))
|
|
1675
1971
|
issues.push({ code: "invalid-url", key });
|
|
1676
1972
|
}
|
|
1677
1973
|
}
|
|
@@ -1681,39 +1977,28 @@ var validateEmailDocument = ({
|
|
|
1681
1977
|
return issues;
|
|
1682
1978
|
};
|
|
1683
1979
|
|
|
1684
|
-
// ../../src/components/
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
onValueChange(value);
|
|
1699
|
-
},
|
|
1700
|
-
children: [
|
|
1701
|
-
/* @__PURE__ */ jsx9(SelectTrigger, {
|
|
1702
|
-
"aria-label": label,
|
|
1703
|
-
className: "w-full min-w-0 text-xs",
|
|
1704
|
-
children: /* @__PURE__ */ jsx9(SelectValue, {})
|
|
1705
|
-
}),
|
|
1706
|
-
/* @__PURE__ */ jsx9(SelectContent, {
|
|
1707
|
-
align: "start",
|
|
1708
|
-
alignItemWithTrigger: false,
|
|
1709
|
-
children: options.map((option) => /* @__PURE__ */ jsx9(SelectItem, {
|
|
1710
|
-
value: option.value,
|
|
1711
|
-
children: option.label
|
|
1712
|
-
}, option.value))
|
|
1713
|
-
})
|
|
1714
|
-
]
|
|
1980
|
+
// ../../src/components/email-editor/classes.ts
|
|
1981
|
+
var emailEditorClasses = {
|
|
1982
|
+
inspectorField: "grid min-w-0 gap-1.5 text-xs font-medium",
|
|
1983
|
+
inspector: "min-w-0 space-y-4",
|
|
1984
|
+
sectionHeading: "text-xs font-medium",
|
|
1985
|
+
previewPlaceholder: "p-8 text-center text-sm",
|
|
1986
|
+
image: "inline-block max-w-full",
|
|
1987
|
+
metadata: "text-muted-foreground text-xs",
|
|
1988
|
+
actionGrid: "grid grid-cols-2 gap-2",
|
|
1989
|
+
error: "text-destructive text-xs"
|
|
1990
|
+
};
|
|
1991
|
+
var resolveEmailEditorClasses = (overrides) => ({
|
|
1992
|
+
...emailEditorClasses,
|
|
1993
|
+
...overrides
|
|
1715
1994
|
});
|
|
1716
|
-
|
|
1995
|
+
|
|
1996
|
+
// ../../src/components/email-editor/index.ts
|
|
1997
|
+
import { Schema as Schema10 } from "effect";
|
|
1998
|
+
import { Component as Component3, UiSchema as UiSchema2 } from "effect/ui";
|
|
1999
|
+
|
|
2000
|
+
// ../../src/components/email-editor/labels.ts
|
|
2001
|
+
var defaultMessages = {
|
|
1717
2002
|
en: {
|
|
1718
2003
|
edit: "Design",
|
|
1719
2004
|
preview: "Preview",
|
|
@@ -1819,6 +2104,274 @@ var labels3 = {
|
|
|
1819
2104
|
local: "Glissez avec la poignée ou utilisez ses touches fléchées. Vos modifications restent dans cet éditeur."
|
|
1820
2105
|
}
|
|
1821
2106
|
};
|
|
2107
|
+
|
|
2108
|
+
// ../../src/components/email-editor/schema.ts
|
|
2109
|
+
import { Schema as Schema9, Struct as Struct2 } from "effect";
|
|
2110
|
+
var Overrides = Schema9.Struct({
|
|
2111
|
+
edit: Schema9.optional(Schema9.String),
|
|
2112
|
+
preview: Schema9.optional(Schema9.String),
|
|
2113
|
+
subject: Schema9.optional(Schema9.String),
|
|
2114
|
+
preheader: Schema9.optional(Schema9.String),
|
|
2115
|
+
add: Schema9.optional(Schema9.String),
|
|
2116
|
+
text: Schema9.optional(Schema9.String),
|
|
2117
|
+
button: Schema9.optional(Schema9.String),
|
|
2118
|
+
code: Schema9.optional(Schema9.String),
|
|
2119
|
+
logo: Schema9.optional(Schema9.String),
|
|
2120
|
+
image: Schema9.optional(Schema9.String),
|
|
2121
|
+
divider: Schema9.optional(Schema9.String),
|
|
2122
|
+
spacer: Schema9.optional(Schema9.String),
|
|
2123
|
+
content: Schema9.optional(Schema9.String),
|
|
2124
|
+
properties: Schema9.optional(Schema9.String),
|
|
2125
|
+
select: Schema9.optional(Schema9.String),
|
|
2126
|
+
alignment: Schema9.optional(Schema9.String),
|
|
2127
|
+
left: Schema9.optional(Schema9.String),
|
|
2128
|
+
center: Schema9.optional(Schema9.String),
|
|
2129
|
+
right: Schema9.optional(Schema9.String),
|
|
2130
|
+
paddingTop: Schema9.optional(Schema9.String),
|
|
2131
|
+
paddingBottom: Schema9.optional(Schema9.String),
|
|
2132
|
+
width: Schema9.optional(Schema9.String),
|
|
2133
|
+
height: Schema9.optional(Schema9.String),
|
|
2134
|
+
src: Schema9.optional(Schema9.String),
|
|
2135
|
+
alt: Schema9.optional(Schema9.String),
|
|
2136
|
+
label: Schema9.optional(Schema9.String),
|
|
2137
|
+
destination: Schema9.optional(Schema9.String),
|
|
2138
|
+
url: Schema9.optional(Schema9.String),
|
|
2139
|
+
variable: Schema9.optional(Schema9.String),
|
|
2140
|
+
insertVariable: Schema9.optional(Schema9.String),
|
|
2141
|
+
close: Schema9.optional(Schema9.String),
|
|
2142
|
+
duplicate: Schema9.optional(Schema9.String),
|
|
2143
|
+
remove: Schema9.optional(Schema9.String),
|
|
2144
|
+
background: Schema9.optional(Schema9.String),
|
|
2145
|
+
surface: Schema9.optional(Schema9.String),
|
|
2146
|
+
primary: Schema9.optional(Schema9.String),
|
|
2147
|
+
primaryText: Schema9.optional(Schema9.String),
|
|
2148
|
+
foreground: Schema9.optional(Schema9.String),
|
|
2149
|
+
font: Schema9.optional(Schema9.String),
|
|
2150
|
+
sans: Schema9.optional(Schema9.String),
|
|
2151
|
+
serif: Schema9.optional(Schema9.String),
|
|
2152
|
+
mono: Schema9.optional(Schema9.String),
|
|
2153
|
+
branding: Schema9.optional(Schema9.String),
|
|
2154
|
+
invalid: Schema9.optional(Schema9.String),
|
|
2155
|
+
newText: Schema9.optional(Schema9.String),
|
|
2156
|
+
newButton: Schema9.optional(Schema9.String),
|
|
2157
|
+
newImage: Schema9.optional(Schema9.String),
|
|
2158
|
+
empty: Schema9.optional(Schema9.String),
|
|
2159
|
+
editElement: Schema9.optional(Schema9.String),
|
|
2160
|
+
local: Schema9.optional(Schema9.String)
|
|
2161
|
+
});
|
|
2162
|
+
var EmailEditorClassesOverridesSchema = Schema9.Record(Schema9.Literals(Struct2.keys(emailEditorClasses)), Schema9.optionalKey(Schema9.String)).annotate({ identifier: "EmailEditorClassesOverrides" });
|
|
2163
|
+
var EmailEditorPropsSchema = Schema9.Struct({
|
|
2164
|
+
classes: Schema9.optional(EmailEditorClassesOverridesSchema),
|
|
2165
|
+
value: EmailDocument,
|
|
2166
|
+
variables: Schema9.optional(Schema9.Array(RichTextVariable)),
|
|
2167
|
+
requiredVariables: Schema9.optional(Schema9.Array(Schema9.String)),
|
|
2168
|
+
disabled: Schema9.optional(Schema9.Boolean),
|
|
2169
|
+
locale: Schema9.optional(Schema9.String),
|
|
2170
|
+
messages: Schema9.optional(Schema9.Record(Schema9.String, Schema9.UndefinedOr(Overrides)))
|
|
2171
|
+
}).annotate({ identifier: "EmailEditorProps" });
|
|
2172
|
+
|
|
2173
|
+
// ../../src/components/email-editor/index.ts
|
|
2174
|
+
var emailEditorMessages = (locale, messages) => ({
|
|
2175
|
+
...locale.startsWith("fr") ? defaultMessages.fr : defaultMessages.en,
|
|
2176
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
2177
|
+
...messages?.[locale]
|
|
2178
|
+
});
|
|
2179
|
+
var fonts = {
|
|
2180
|
+
sans: "Arial, sans-serif",
|
|
2181
|
+
serif: "Georgia, serif",
|
|
2182
|
+
mono: "'Courier New', monospace"
|
|
2183
|
+
};
|
|
2184
|
+
var createElement = (type, id, copy, variables) => newEmailElement(type, {
|
|
2185
|
+
id,
|
|
2186
|
+
text: copy.newText,
|
|
2187
|
+
button: copy.newButton,
|
|
2188
|
+
imageAlt: copy.newImage,
|
|
2189
|
+
codeVariable: variables.find(({ key }) => key === "code")?.key ?? variables.find(({ type }) => type === "text")?.key,
|
|
2190
|
+
urlVariable: variables.find(({ type }) => type === "url")?.key
|
|
2191
|
+
});
|
|
2192
|
+
var replaceElement = (value, element) => ({
|
|
2193
|
+
...value,
|
|
2194
|
+
elements: value.elements.map((item) => item.id === element.id ? element : item)
|
|
2195
|
+
});
|
|
2196
|
+
var duplicateElement = (value, target, id) => ({
|
|
2197
|
+
...value,
|
|
2198
|
+
elements: value.elements.flatMap((item) => item.id === target ? [item, { ...item, id }] : [item])
|
|
2199
|
+
});
|
|
2200
|
+
var removeElement = (value, target) => ({
|
|
2201
|
+
...value,
|
|
2202
|
+
elements: value.elements.filter(({ id }) => id !== target)
|
|
2203
|
+
});
|
|
2204
|
+
var moveElement = (value, source, target) => {
|
|
2205
|
+
const from = value.elements.findIndex(({ id }) => id === source);
|
|
2206
|
+
const to = value.elements.findIndex(({ id }) => id === target);
|
|
2207
|
+
if (from < 0 || to < 0 || from === to)
|
|
2208
|
+
return value;
|
|
2209
|
+
const elements = [...value.elements];
|
|
2210
|
+
const [element] = elements.splice(from, 1);
|
|
2211
|
+
if (!element)
|
|
2212
|
+
return value;
|
|
2213
|
+
elements.splice(to, 0, element);
|
|
2214
|
+
return { ...value, elements };
|
|
2215
|
+
};
|
|
2216
|
+
var initialActive = (value) => value.elements.find(({ type }) => type === "text")?.id ?? null;
|
|
2217
|
+
var EmailEditorEvents = UiSchema2.TaggedEnum({
|
|
2218
|
+
Changed: { value: EmailDocument }
|
|
2219
|
+
}).annotate({ identifier: "EmailEditorEvents" });
|
|
2220
|
+
var EmailEditorMessage = UiSchema2.TaggedEnum({
|
|
2221
|
+
Mode: { mode: Schema10.Literals(["design", "preview"]) },
|
|
2222
|
+
SetDesignPopover: {
|
|
2223
|
+
popover: Schema10.Literals(["add", "branding"]),
|
|
2224
|
+
open: Schema10.Boolean
|
|
2225
|
+
},
|
|
2226
|
+
Select: { id: Schema10.String },
|
|
2227
|
+
Close: {},
|
|
2228
|
+
Add: {
|
|
2229
|
+
id: Schema10.String,
|
|
2230
|
+
kind: Schema10.Literals(emailElementTypes),
|
|
2231
|
+
text: Schema10.String,
|
|
2232
|
+
button: Schema10.String,
|
|
2233
|
+
image: Schema10.String
|
|
2234
|
+
},
|
|
2235
|
+
Duplicate: { id: Schema10.String, target: Schema10.String },
|
|
2236
|
+
Remove: { id: Schema10.String },
|
|
2237
|
+
Move: { source: Schema10.String, target: Schema10.String },
|
|
2238
|
+
Content: { id: Schema10.String, content: RichTextDocument },
|
|
2239
|
+
Header: {
|
|
2240
|
+
key: Schema10.Literals(["subject", "preview"]),
|
|
2241
|
+
content: RichTextDocument
|
|
2242
|
+
},
|
|
2243
|
+
Appearance: {
|
|
2244
|
+
key: Schema10.Literals([
|
|
2245
|
+
"background",
|
|
2246
|
+
"surface",
|
|
2247
|
+
"primary",
|
|
2248
|
+
"primaryText",
|
|
2249
|
+
"text",
|
|
2250
|
+
"font"
|
|
2251
|
+
]),
|
|
2252
|
+
value: Schema10.String
|
|
2253
|
+
},
|
|
2254
|
+
Setting: {
|
|
2255
|
+
id: Schema10.String,
|
|
2256
|
+
key: Schema10.Literals([
|
|
2257
|
+
"alignment",
|
|
2258
|
+
"paddingTop",
|
|
2259
|
+
"paddingBottom",
|
|
2260
|
+
"label",
|
|
2261
|
+
"destination",
|
|
2262
|
+
"url",
|
|
2263
|
+
"variable",
|
|
2264
|
+
"src",
|
|
2265
|
+
"alt",
|
|
2266
|
+
"width",
|
|
2267
|
+
"height"
|
|
2268
|
+
]),
|
|
2269
|
+
value: Schema10.String
|
|
2270
|
+
}
|
|
2271
|
+
}).annotate({ identifier: "EmailEditorMessage" });
|
|
2272
|
+
var emailEditorOptions = {
|
|
2273
|
+
name: "EmailEditor",
|
|
2274
|
+
props: EmailEditorPropsSchema,
|
|
2275
|
+
model: Schema10.Struct({
|
|
2276
|
+
active: Schema10.NullOr(Schema10.String),
|
|
2277
|
+
settingsOpen: Schema10.Boolean,
|
|
2278
|
+
mode: Schema10.Literals(["design", "preview"]),
|
|
2279
|
+
designPopover: Schema10.NullOr(Schema10.Literals(["add", "branding"]))
|
|
2280
|
+
}).annotate({ identifier: "EmailEditorModel" }),
|
|
2281
|
+
message: EmailEditorMessage,
|
|
2282
|
+
events: EmailEditorEvents,
|
|
2283
|
+
restore: false
|
|
2284
|
+
};
|
|
2285
|
+
var update2 = Component3.define(emailEditorOptions).update({
|
|
2286
|
+
Mode: ($, { mode }) => $.evolve({ mode, designPopover: null }),
|
|
2287
|
+
SetDesignPopover: ($, { popover, open }) => $.evolve({
|
|
2288
|
+
designPopover: open ? popover : $.model.designPopover === popover ? null : $.model.designPopover
|
|
2289
|
+
}),
|
|
2290
|
+
Select: ($, { id }) => $.props.disabled ? $.model : $.evolve({ active: id, settingsOpen: true }),
|
|
2291
|
+
Close: ($) => $.evolve({ settingsOpen: false }),
|
|
2292
|
+
Add: ($, { kind, id, text, button, image }) => $.props.disabled || $.props.value.elements.length >= 40 ? $.model : $.evolve({ active: id, designPopover: null }).emit(EmailEditorEvents.Changed({
|
|
2293
|
+
value: {
|
|
2294
|
+
...$.props.value,
|
|
2295
|
+
elements: [
|
|
2296
|
+
...$.props.value.elements,
|
|
2297
|
+
createElement(kind, id, { newText: text, newButton: button, newImage: image }, $.props.variables ?? [])
|
|
2298
|
+
]
|
|
2299
|
+
}
|
|
2300
|
+
})),
|
|
2301
|
+
Duplicate: ($, { id, target }) => $.props.disabled || $.props.value.elements.length >= 40 ? $.model : $.evolve({ active: id }).emit(EmailEditorEvents.Changed({
|
|
2302
|
+
value: duplicateElement($.props.value, target, id)
|
|
2303
|
+
})),
|
|
2304
|
+
Remove: ($, { id }) => $.props.disabled ? $.model : $.evolve({ active: null, settingsOpen: false }).emit(EmailEditorEvents.Changed({
|
|
2305
|
+
value: removeElement($.props.value, id)
|
|
2306
|
+
})),
|
|
2307
|
+
Move: ($, { source, target }) => {
|
|
2308
|
+
const value = moveElement($.props.value, source, target);
|
|
2309
|
+
return $.props.disabled || value === $.props.value ? $.model : $.set($.model).emit(EmailEditorEvents.Changed({ value }));
|
|
2310
|
+
},
|
|
2311
|
+
Content: ($, { id, content }) => {
|
|
2312
|
+
const element = $.props.value.elements.find((item) => item.id === id);
|
|
2313
|
+
return $.props.disabled || element?.type !== "text" ? $.model : $.set($.model).emit(EmailEditorEvents.Changed({
|
|
2314
|
+
value: replaceElement($.props.value, { ...element, content })
|
|
2315
|
+
}));
|
|
2316
|
+
},
|
|
2317
|
+
Header: ($, { key, content }) => $.props.disabled ? $.model : $.set($.model).emit(EmailEditorEvents.Changed({
|
|
2318
|
+
value: { ...$.props.value, [key]: richTextPlainText(content) }
|
|
2319
|
+
})),
|
|
2320
|
+
Appearance: ($, { key, value }) => $.props.disabled ? $.model : $.set($.model).emit(EmailEditorEvents.Changed({
|
|
2321
|
+
value: {
|
|
2322
|
+
...$.props.value,
|
|
2323
|
+
appearance: { ...$.props.value.appearance, [key]: value }
|
|
2324
|
+
}
|
|
2325
|
+
})),
|
|
2326
|
+
Setting: ($, { id, key, value }) => {
|
|
2327
|
+
const element = $.props.value.elements.find((item) => item.id === id);
|
|
2328
|
+
if ($.props.disabled || !element)
|
|
2329
|
+
return $.model;
|
|
2330
|
+
const updated = key === "destination" && element.type === "button" ? {
|
|
2331
|
+
...element,
|
|
2332
|
+
destination: value === "__url" ? { type: "url", url: "https://example.com" } : { type: "variable", key: value }
|
|
2333
|
+
} : key === "url" && element.type === "button" ? { ...element, destination: { type: "url", url: value } } : {
|
|
2334
|
+
...element,
|
|
2335
|
+
[key]: key === "width" || key === "height" || key === "paddingTop" || key === "paddingBottom" ? value === "" ? 0 : Number(value) : value
|
|
2336
|
+
};
|
|
2337
|
+
return $.set($.model).emit(EmailEditorEvents.Changed({
|
|
2338
|
+
value: replaceElement($.props.value, updated)
|
|
2339
|
+
}));
|
|
2340
|
+
}
|
|
2341
|
+
});
|
|
2342
|
+
|
|
2343
|
+
// ../../src/components/email-editor/react.tsx
|
|
2344
|
+
import { jsx as jsx9, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
2345
|
+
var EmailEditorSelect = ({
|
|
2346
|
+
label,
|
|
2347
|
+
value,
|
|
2348
|
+
options,
|
|
2349
|
+
disabled,
|
|
2350
|
+
onValueChange
|
|
2351
|
+
}) => /* @__PURE__ */ jsxs5(Select, {
|
|
2352
|
+
items: options,
|
|
2353
|
+
value,
|
|
2354
|
+
disabled,
|
|
2355
|
+
onValueChange: (value) => {
|
|
2356
|
+
if (value !== null)
|
|
2357
|
+
onValueChange(value);
|
|
2358
|
+
},
|
|
2359
|
+
children: [
|
|
2360
|
+
/* @__PURE__ */ jsx9(SelectTrigger, {
|
|
2361
|
+
"aria-label": label,
|
|
2362
|
+
className: "w-full min-w-0 text-xs",
|
|
2363
|
+
children: /* @__PURE__ */ jsx9(SelectValue, {})
|
|
2364
|
+
}),
|
|
2365
|
+
/* @__PURE__ */ jsx9(SelectContent, {
|
|
2366
|
+
align: "start",
|
|
2367
|
+
alignItemWithTrigger: false,
|
|
2368
|
+
children: options.map((option) => /* @__PURE__ */ jsx9(SelectItem, {
|
|
2369
|
+
value: option.value,
|
|
2370
|
+
children: option.label
|
|
2371
|
+
}, option.value))
|
|
2372
|
+
})
|
|
2373
|
+
]
|
|
2374
|
+
});
|
|
1822
2375
|
var icons = {
|
|
1823
2376
|
text: Type,
|
|
1824
2377
|
button: MousePointer2,
|
|
@@ -1828,12 +2381,8 @@ var icons = {
|
|
|
1828
2381
|
divider: Minus,
|
|
1829
2382
|
spacer: Space
|
|
1830
2383
|
};
|
|
1831
|
-
var fonts = {
|
|
1832
|
-
sans: "Arial, sans-serif",
|
|
1833
|
-
serif: "Georgia, serif",
|
|
1834
|
-
mono: "'Courier New', monospace"
|
|
1835
|
-
};
|
|
1836
2384
|
var EmailEditor = ({
|
|
2385
|
+
classes: classOverrides,
|
|
1837
2386
|
value,
|
|
1838
2387
|
onChange,
|
|
1839
2388
|
variables = [],
|
|
@@ -1843,18 +2392,15 @@ var EmailEditor = ({
|
|
|
1843
2392
|
locale: override,
|
|
1844
2393
|
messages
|
|
1845
2394
|
}) => {
|
|
2395
|
+
const emailEditorClasses = resolveEmailEditorClasses(classOverrides);
|
|
1846
2396
|
const locale = useKrakstackLocale3(override);
|
|
1847
|
-
const copy =
|
|
1848
|
-
|
|
1849
|
-
...messages?.[locale.split("-")[0] ?? locale],
|
|
1850
|
-
...messages?.[locale]
|
|
1851
|
-
};
|
|
1852
|
-
const [active, setActive] = useState4(value.elements.find((element) => element.type === "text")?.id ?? null);
|
|
2397
|
+
const copy = emailEditorMessages(locale, messages);
|
|
2398
|
+
const [active, setActive] = useState5(() => initialActive(value));
|
|
1853
2399
|
const selected = value.elements.find((element) => element.id === active);
|
|
1854
|
-
const [view, setView] =
|
|
1855
|
-
const canvas =
|
|
1856
|
-
const elementSurfaces =
|
|
1857
|
-
const [settingsOpen, setSettingsOpen] =
|
|
2400
|
+
const [view, setView] = useState5("design");
|
|
2401
|
+
const canvas = useRef4(null);
|
|
2402
|
+
const elementSurfaces = useRef4(new Map);
|
|
2403
|
+
const [settingsOpen, setSettingsOpen] = useState5(false);
|
|
1858
2404
|
const settingsAnchor = useMemo(() => settingsOpen ? {
|
|
1859
2405
|
get contextElement() {
|
|
1860
2406
|
return canvas.current ?? undefined;
|
|
@@ -1866,28 +2412,18 @@ var EmailEditor = ({
|
|
|
1866
2412
|
}
|
|
1867
2413
|
} : null, [active, settingsOpen]);
|
|
1868
2414
|
const id = useId3();
|
|
1869
|
-
const [insertOpen, setInsertOpen] =
|
|
2415
|
+
const [insertOpen, setInsertOpen] = useState5(false);
|
|
1870
2416
|
const update = (element) => {
|
|
1871
2417
|
if (!disabled)
|
|
1872
|
-
onChange(
|
|
1873
|
-
...value,
|
|
1874
|
-
elements: value.elements.map((item) => item.id === element.id ? element : item)
|
|
1875
|
-
});
|
|
2418
|
+
onChange(replaceElement(value, element));
|
|
1876
2419
|
};
|
|
1877
2420
|
const add = (type) => {
|
|
1878
|
-
const element =
|
|
1879
|
-
id: crypto.randomUUID(),
|
|
1880
|
-
text: copy.newText,
|
|
1881
|
-
button: copy.newButton,
|
|
1882
|
-
imageAlt: copy.newImage,
|
|
1883
|
-
codeVariable: variables.find((variable) => variable.key === "code")?.key ?? variables.find((variable) => variable.type === "text")?.key,
|
|
1884
|
-
urlVariable: variables.find((variable) => variable.type === "url")?.key
|
|
1885
|
-
});
|
|
2421
|
+
const element = createElement(type, crypto.randomUUID(), copy, variables);
|
|
1886
2422
|
onChange({ ...value, elements: [...value.elements, element] });
|
|
1887
2423
|
setActive(element.id);
|
|
1888
2424
|
};
|
|
1889
2425
|
const field = (label, control) => /* @__PURE__ */ jsxs5("label", {
|
|
1890
|
-
className:
|
|
2426
|
+
className: emailEditorClasses.inspectorField,
|
|
1891
2427
|
children: [
|
|
1892
2428
|
label,
|
|
1893
2429
|
control
|
|
@@ -1900,7 +2436,7 @@ var EmailEditor = ({
|
|
|
1900
2436
|
};
|
|
1901
2437
|
return /* @__PURE__ */ jsxs5("div", {
|
|
1902
2438
|
"data-slot": "email-editor",
|
|
1903
|
-
className:
|
|
2439
|
+
className: emailEditorClasses.inspector,
|
|
1904
2440
|
children: [
|
|
1905
2441
|
/* @__PURE__ */ jsxs5(Tabs, {
|
|
1906
2442
|
value: view,
|
|
@@ -1938,7 +2474,7 @@ var EmailEditor = ({
|
|
|
1938
2474
|
className: "min-w-0 space-y-1.5",
|
|
1939
2475
|
children: [
|
|
1940
2476
|
/* @__PURE__ */ jsx9("p", {
|
|
1941
|
-
className:
|
|
2477
|
+
className: emailEditorClasses.sectionHeading,
|
|
1942
2478
|
children: label
|
|
1943
2479
|
}),
|
|
1944
2480
|
/* @__PURE__ */ jsx9(RichTextEditor, {
|
|
@@ -2081,7 +2617,7 @@ var EmailEditor = ({
|
|
|
2081
2617
|
...value,
|
|
2082
2618
|
appearance: {
|
|
2083
2619
|
...value.appearance,
|
|
2084
|
-
font:
|
|
2620
|
+
font: Schema11.decodeUnknownSync(EmailFont)(font)
|
|
2085
2621
|
}
|
|
2086
2622
|
})
|
|
2087
2623
|
}))
|
|
@@ -2101,19 +2637,19 @@ var EmailEditor = ({
|
|
|
2101
2637
|
"data-slot": "email-editor-canvas",
|
|
2102
2638
|
className: "min-w-0 rounded-xl border p-3 sm:p-4",
|
|
2103
2639
|
style: {
|
|
2104
|
-
backgroundColor:
|
|
2640
|
+
backgroundColor: Schema11.is(EmailColor)(value.appearance.background) ? value.appearance.background : "#f4f4f5"
|
|
2105
2641
|
},
|
|
2106
2642
|
children: /* @__PURE__ */ jsxs5("div", {
|
|
2107
2643
|
className: "min-w-0 rounded-lg p-2 shadow-sm sm:p-3",
|
|
2108
2644
|
style: {
|
|
2109
2645
|
...canvasVariables,
|
|
2110
|
-
backgroundColor:
|
|
2111
|
-
color:
|
|
2646
|
+
backgroundColor: Schema11.is(EmailColor)(value.appearance.surface) ? value.appearance.surface : "#ffffff",
|
|
2647
|
+
color: Schema11.is(EmailColor)(value.appearance.text) ? value.appearance.text : "#18181b",
|
|
2112
2648
|
fontFamily: fonts[value.appearance.font]
|
|
2113
2649
|
},
|
|
2114
2650
|
children: [
|
|
2115
2651
|
!value.elements.length ? /* @__PURE__ */ jsx9("p", {
|
|
2116
|
-
className:
|
|
2652
|
+
className: emailEditorClasses.previewPlaceholder,
|
|
2117
2653
|
children: copy.empty
|
|
2118
2654
|
}) : null,
|
|
2119
2655
|
/* @__PURE__ */ jsx9(AnimatedList, {
|
|
@@ -2219,11 +2755,11 @@ var EmailEditor = ({
|
|
|
2219
2755
|
onClick: () => setActive(element.id),
|
|
2220
2756
|
className: "w-full rounded-lg border border-[#e5e7eb] p-4 font-mono text-xl tracking-[0.2em]",
|
|
2221
2757
|
children: `{{${element.variable}}}`
|
|
2222
|
-
}) : element.type === "image" || element.type === "logo" ?
|
|
2758
|
+
}) : element.type === "image" || element.type === "logo" ? Schema11.is(RichTextLink)(element.src) ? /* @__PURE__ */ jsx9("img", {
|
|
2223
2759
|
src: element.src,
|
|
2224
2760
|
alt: element.alt,
|
|
2225
2761
|
width: element.width,
|
|
2226
|
-
className:
|
|
2762
|
+
className: emailEditorClasses.image
|
|
2227
2763
|
}) : /* @__PURE__ */ jsx9(Image, {
|
|
2228
2764
|
className: "mx-auto size-8"
|
|
2229
2765
|
}) : element.type === "divider" ? /* @__PURE__ */ jsx9("hr", {
|
|
@@ -2275,7 +2811,7 @@ var EmailEditor = ({
|
|
|
2275
2811
|
]
|
|
2276
2812
|
}),
|
|
2277
2813
|
!selected ? /* @__PURE__ */ jsx9("p", {
|
|
2278
|
-
className:
|
|
2814
|
+
className: emailEditorClasses.metadata,
|
|
2279
2815
|
children: copy.select
|
|
2280
2816
|
}) : /* @__PURE__ */ jsxs5("div", {
|
|
2281
2817
|
className: "grid min-w-0 items-end gap-3 sm:grid-cols-2 [&>label]:min-w-0",
|
|
@@ -2290,11 +2826,11 @@ var EmailEditor = ({
|
|
|
2290
2826
|
})),
|
|
2291
2827
|
onValueChange: (alignment) => update({
|
|
2292
2828
|
...selected,
|
|
2293
|
-
alignment:
|
|
2829
|
+
alignment: Schema11.decodeUnknownSync(EmailAlignment)(alignment)
|
|
2294
2830
|
})
|
|
2295
2831
|
})),
|
|
2296
2832
|
/* @__PURE__ */ jsx9("div", {
|
|
2297
|
-
className:
|
|
2833
|
+
className: emailEditorClasses.actionGrid,
|
|
2298
2834
|
children: ["paddingTop", "paddingBottom"].map((key) => /* @__PURE__ */ jsxs5("label", {
|
|
2299
2835
|
className: "grid gap-1.5 text-[11px]",
|
|
2300
2836
|
children: [
|
|
@@ -2424,20 +2960,9 @@ var EmailEditor = ({
|
|
|
2424
2960
|
variant: "outline",
|
|
2425
2961
|
disabled: disabled || value.elements.length >= 40,
|
|
2426
2962
|
onClick: () => {
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
};
|
|
2431
|
-
const index = value.elements.findIndex((element) => element.id === selected.id);
|
|
2432
|
-
onChange({
|
|
2433
|
-
...value,
|
|
2434
|
-
elements: [
|
|
2435
|
-
...value.elements.slice(0, index + 1),
|
|
2436
|
-
duplicate,
|
|
2437
|
-
...value.elements.slice(index + 1)
|
|
2438
|
-
]
|
|
2439
|
-
});
|
|
2440
|
-
setActive(duplicate.id);
|
|
2963
|
+
const id = crypto.randomUUID();
|
|
2964
|
+
onChange(duplicateElement(value, selected.id, id));
|
|
2965
|
+
setActive(id);
|
|
2441
2966
|
},
|
|
2442
2967
|
children: [
|
|
2443
2968
|
/* @__PURE__ */ jsx9(Copy, {
|
|
@@ -2454,10 +2979,7 @@ var EmailEditor = ({
|
|
|
2454
2979
|
disabled,
|
|
2455
2980
|
onClick: () => {
|
|
2456
2981
|
document.getElementById(`${id}-add`)?.focus();
|
|
2457
|
-
onChange(
|
|
2458
|
-
...value,
|
|
2459
|
-
elements: value.elements.filter((element) => element.id !== selected.id)
|
|
2460
|
-
});
|
|
2982
|
+
onChange(removeElement(value, selected.id));
|
|
2461
2983
|
setActive(null);
|
|
2462
2984
|
setSettingsOpen(false);
|
|
2463
2985
|
},
|
|
@@ -2480,7 +3002,7 @@ var EmailEditor = ({
|
|
|
2480
3002
|
]
|
|
2481
3003
|
}),
|
|
2482
3004
|
/* @__PURE__ */ jsx9("p", {
|
|
2483
|
-
className:
|
|
3005
|
+
className: emailEditorClasses.metadata,
|
|
2484
3006
|
children: copy.local
|
|
2485
3007
|
})
|
|
2486
3008
|
]
|
|
@@ -2489,7 +3011,7 @@ var EmailEditor = ({
|
|
|
2489
3011
|
}),
|
|
2490
3012
|
invalid ? /* @__PURE__ */ jsx9("p", {
|
|
2491
3013
|
role: "alert",
|
|
2492
|
-
className:
|
|
3014
|
+
className: emailEditorClasses.error,
|
|
2493
3015
|
children: copy.invalid
|
|
2494
3016
|
}) : null
|
|
2495
3017
|
]
|