@krak-stack/registry 0.10.20 → 0.11.2
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 +89 -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 +2440 -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/{ui/animated-list.js → animated-list/react.js} +199 -54
- 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 +124 -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 +224 -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} +1964 -847
- 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/{ui/code-block.js → code-block/react.js} +168 -50
- 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 +234 -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/{ui/copy-value.js → copy-value/react.js} +243 -65
- 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/{ui/danger-confirmation.js → danger-confirmation/react.js} +203 -205
- 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} +1958 -835
- 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 +345 -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} +461 -127
- 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} +600 -230
- 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/{ui/error-component.js → error-component/react.js} +281 -78
- 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} +305 -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 +648 -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 +392 -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 +139 -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 +525 -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} +365 -96
- 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} +128 -23
- 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} +199 -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 +1098 -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} +337 -104
- 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} +2278 -917
- 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 +341 -75
- package/dist/lib/docs.js +715 -299
- package/dist/lib/docs.server.js +325 -59
- package/dist/lib/documentation-toolkit.d.ts +4 -4
- package/dist/lib/documentation-toolkit.js +337 -71
- 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/effect-ui-adapter/use-model.js +158 -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 +530 -168
- 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 +185 -142
- package/dist/components/support-dialog.js +0 -881
- package/dist/components/support.js +0 -881
- 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/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/cron-expression-editor.d.ts +0 -16
- package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
- 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/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
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
// ../../src/components/rich-text-editor/html.ts
|
|
2
|
+
import { Effect, Queue, Schema as Schema6, Stream } from "effect";
|
|
3
|
+
import { Mount } from "effect/ui";
|
|
4
|
+
import { Html } from "effect/ui/html";
|
|
5
|
+
import { Menu, Select } from "effect/ui/kit";
|
|
6
|
+
import { Editor } from "@tiptap/core";
|
|
7
|
+
import { Bold, Braces, Italic, Link2, Redo2, Underline, Undo2 } from "lucide";
|
|
8
|
+
|
|
9
|
+
// ../../src/components/effectcn/button.ts
|
|
10
|
+
import {
|
|
11
|
+
Button as KitButton
|
|
12
|
+
} from "effect/ui/kit";
|
|
13
|
+
|
|
14
|
+
// ../../src/lib/utils.ts
|
|
15
|
+
import { cn } from "cn";
|
|
16
|
+
|
|
17
|
+
// ../../src/components/effectcn/button.ts
|
|
18
|
+
var base = "inline-flex h-8.5 shrink-0 items-center justify-center gap-1.5 rounded-md border border-transparent px-3.5 text-[13px] leading-none font-medium whitespace-nowrap no-underline select-none transition-[background-color,border-color,color,opacity] duration-150 active:translate-y-px data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 [&_svg]:size-[15px] [&_svg]:shrink-0 data-[loading]:before:size-3 data-[loading]:before:animate-spin data-[loading]:before:rounded-full data-[loading]:before:border-2 data-[loading]:before:border-current data-[loading]:before:border-r-transparent";
|
|
19
|
+
var variants = {
|
|
20
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
21
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-accent",
|
|
22
|
+
outline: "border-input bg-background text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
23
|
+
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
24
|
+
brand: "bg-brand-soft text-brand-soft-foreground hover:bg-brand-soft/85",
|
|
25
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85",
|
|
26
|
+
link: "h-auto px-0 text-foreground underline decoration-transparent underline-offset-4 hover:decoration-current"
|
|
27
|
+
};
|
|
28
|
+
var sizes = {
|
|
29
|
+
default: "",
|
|
30
|
+
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
31
|
+
lg: "h-10 px-5 text-sm",
|
|
32
|
+
icon: "w-8.5 px-0",
|
|
33
|
+
"icon-sm": "h-7 w-7 rounded-sm px-0"
|
|
34
|
+
};
|
|
35
|
+
var buttonVariants = (options = {}) => cn(base, variants[options.variant ?? "default"], sizes[options.size ?? "default"], options.class);
|
|
36
|
+
var Button = (h, options = {}) => KitButton(h, {
|
|
37
|
+
element: options.element,
|
|
38
|
+
onPress: options.onPress,
|
|
39
|
+
props: options.loading ? { ...options.props, disabled: true, focusableWhenDisabled: true } : options.props
|
|
40
|
+
}).class(buttonVariants(options)).attr("data-loading", options.loading ? "" : undefined);
|
|
41
|
+
|
|
42
|
+
// ../../src/components/effectcn/input.ts
|
|
43
|
+
import {
|
|
44
|
+
Input as KitInput
|
|
45
|
+
} from "effect/ui/kit";
|
|
46
|
+
var base2 = "block h-8.5 w-full min-w-0 rounded-md border border-input bg-background px-3 text-[13px] text-foreground shadow-sm outline-none " + "transition-[border-color,box-shadow] duration-150 placeholder:text-muted-foreground " + "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/20 " + "aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive/20 " + "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 " + "[&[readonly]]:bg-muted [&[readonly]]:text-muted-foreground [&[readonly]]:shadow-none " + "[&[type=file]]:cursor-pointer [&[type=file]]:pl-0 [&[type=file]]:leading-8 [&[type=file]]:text-muted-foreground " + "file:mr-3 file:h-8 file:cursor-pointer file:border-0 file:border-r file:border-solid file:border-input file:bg-muted file:px-3 " + "file:text-[13px] file:font-medium file:text-foreground";
|
|
47
|
+
var sizes2 = {
|
|
48
|
+
default: "",
|
|
49
|
+
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
50
|
+
lg: "h-10 px-3.5 text-sm"
|
|
51
|
+
};
|
|
52
|
+
var inputVariants = (options = {}) => cn(base2, sizes2[options.size ?? "default"], options.class);
|
|
53
|
+
var Input = (h, options) => KitInput(h, options).class(inputVariants(options));
|
|
54
|
+
|
|
55
|
+
// ../../src/components/effectcn/menu.ts
|
|
56
|
+
var popup = "max-h-[var(--available-height)] max-w-[min(320px,var(--available-width))] min-w-[200px] origin-[var(--transform-origin)] " + "overflow-y-auto rounded-lg border bg-popover p-1 text-[13px] leading-snug text-foreground shadow-float outline-none " + "transition-[opacity,scale] duration-150 ease-out data-[nested]:min-w-[150px] " + "data-[starting-style]:scale-95 data-[starting-style]:opacity-0 " + "data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-100 " + "data-[instant]:transition-none";
|
|
57
|
+
var item = "relative flex min-h-[30px] cursor-default items-center gap-2 rounded-sm px-2 whitespace-nowrap text-foreground " + "no-underline outline-none select-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground " + "data-[popup-open]:bg-accent data-[disabled]:opacity-45 " + "[&_svg]:size-[15px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground";
|
|
58
|
+
var tick = "before:absolute before:top-1/2 before:left-[10px] before:h-[5px] before:w-[9px] before:-translate-y-[70%] " + "before:-rotate-45 before:border-b-2 before:border-l-2 before:border-brand before:opacity-0 before:content-[''] " + "data-[checked]:before:opacity-100";
|
|
59
|
+
var dot = "before:absolute before:top-1/2 before:left-[12px] before:size-1.5 before:-translate-y-1/2 before:rounded-full " + "before:bg-brand before:opacity-0 before:content-[''] data-[checked]:before:opacity-100";
|
|
60
|
+
var submenuArrow = "after:ml-auto after:size-1.5 after:-translate-x-0.5 after:rotate-45 after:border-t-[1.5px] after:border-r-[1.5px] " + "after:border-muted-foreground after:content-['']";
|
|
61
|
+
var MenuPositioner = (h, menu, options = {}) => menu.positioner(h.div.class(cn("overflow-visible border-0 bg-transparent p-0 text-inherit outline-none", options.class)));
|
|
62
|
+
var MenuPopup = (h, menu, options = {}) => menu.popup(h.div.class(cn(popup, options.class)));
|
|
63
|
+
|
|
64
|
+
// ../../src/components/effectcn/select.ts
|
|
65
|
+
var triggerSizes = {
|
|
66
|
+
sm: "h-7 min-w-36 gap-1.5 rounded-sm pr-2 pl-2.5 text-xs",
|
|
67
|
+
default: "h-8.5 min-w-48 pr-2.5 pl-3 text-[13px]",
|
|
68
|
+
lg: "h-10 min-w-56 pr-3 pl-3.5 text-sm"
|
|
69
|
+
};
|
|
70
|
+
var popupSizes = {
|
|
71
|
+
sm: "text-xs [&_[role=option]]:min-h-6.5 [&_[role=option]]:px-1.5 [&_[role=option]]:py-0.5",
|
|
72
|
+
default: "text-[13px]",
|
|
73
|
+
lg: "text-sm [&_[role=option]]:min-h-8.5 [&_[role=option]]:px-2.5"
|
|
74
|
+
};
|
|
75
|
+
var SelectTrigger = (h, select, options = {}) => select.trigger(h.button.on("mousedown", () => {
|
|
76
|
+
return;
|
|
77
|
+
}, { preventDefault: "always" }).class(cn("border-input bg-background inline-flex items-center justify-between gap-2 rounded-md border text-start", "text-foreground leading-none whitespace-nowrap shadow-sm select-none", "hover:bg-accent data-[popup-open]:bg-accent transition-colors duration-150", "data-[disabled]:hover:bg-background data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", "data-[readonly]:bg-muted data-[readonly]:cursor-default", triggerSizes[options.size ?? "default"], options.class)));
|
|
78
|
+
var SelectValue = (h, select, options = {}) => select.value(h.span.class(cn("data-[placeholder]:text-muted-foreground min-w-0 truncate leading-snug", options.class)));
|
|
79
|
+
var SelectIcon = (h, select, options = {}) => select.icon(h.span.class(cn("border-muted-foreground mx-1 mb-[3px] size-[7px] shrink-0 rotate-45 border-r-[1.5px] border-b-[1.5px]", options.class)));
|
|
80
|
+
var SelectPositioner = (h, select, options = {}) => select.positioner(h.div.class(cn("outline-none data-[side=none]:my-2.5", options.class)));
|
|
81
|
+
var SelectPopup = (h, select, options = {}) => select.popup(h.div.class(cn("relative box-border max-w-[var(--available-width)] min-w-[max(var(--anchor-width),10rem)] overflow-y-auto", "bg-popover text-foreground shadow-float rounded-lg border p-1 outline-none", "max-h-[min(var(--available-height),20rem)] data-[side=none]:max-h-none", "origin-[var(--transform-origin)] transition-[opacity,scale] duration-150", "data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", "not-data-[side=none]:data-[ending-style]:scale-95 not-data-[side=none]:data-[starting-style]:scale-95", "data-[side=none]:[scrollbar-width:none]", "has-[>[data-slot=select-list]]:flex has-[>[data-slot=select-list]]:flex-col", "has-[>[data-slot=select-list]]:overflow-hidden has-[>[data-slot=select-list]]:p-0", popupSizes[options.size ?? "default"], options.class)));
|
|
82
|
+
var SelectItem = (h, select, options) => select.item({
|
|
83
|
+
element: h.div.class(cn("flex min-h-7.5 cursor-default scroll-my-1 items-center gap-2 rounded-sm px-2 py-1 leading-snug outline-none", "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground select-none", "data-[disabled]:text-muted-foreground data-[disabled]:opacity-60 data-[selected]:font-medium", "[&_svg]:text-muted-foreground [&_svg]:size-[15px] [&_svg]:shrink-0", options.class)),
|
|
84
|
+
value: options.value
|
|
85
|
+
});
|
|
86
|
+
var SelectItemText = (h, select, options = {}) => select.itemText(h.div.class(cn("min-w-0 flex-1 whitespace-nowrap", options.class)));
|
|
87
|
+
var SelectItemIndicator = (h, select, options) => select.itemIndicator({
|
|
88
|
+
element: h.span.class(cn("border-brand mr-1.5 mb-0.5 ml-2.5 h-[9px] w-[5px] shrink-0 rotate-45 border-r-[1.5px] border-b-[1.5px]", options.class)),
|
|
89
|
+
value: options.value
|
|
90
|
+
});
|
|
91
|
+
var scrollArrow = "inset-x-0 z-10 hidden h-6 cursor-default place-items-center rounded-lg bg-popover data-[visible]:grid " + "before:size-1.5 before:rotate-45 before:border-muted-foreground";
|
|
92
|
+
|
|
93
|
+
// ../../src/components/rich-text-editor/html.ts
|
|
94
|
+
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
95
|
+
|
|
96
|
+
// ../../src/lib/lucide-effect.ts
|
|
97
|
+
import {
|
|
98
|
+
ArrowDown as arrowDown,
|
|
99
|
+
ArrowUp as arrowUp,
|
|
100
|
+
ListFilter as listFilter,
|
|
101
|
+
Check as check,
|
|
102
|
+
ChevronLeft as chevronLeft,
|
|
103
|
+
ChevronDown as chevronDown,
|
|
104
|
+
ChevronRight as chevronRight,
|
|
105
|
+
ChevronsLeft as chevronsLeft,
|
|
106
|
+
ChevronsRight as chevronsRight,
|
|
107
|
+
ChevronsUpDown as chevronsUpDown,
|
|
108
|
+
Copy as copy,
|
|
109
|
+
Download as download,
|
|
110
|
+
Eye as eye,
|
|
111
|
+
EyeOff as eyeOff,
|
|
112
|
+
Ellipsis as ellipsis,
|
|
113
|
+
FileJson as fileJson,
|
|
114
|
+
FileText as fileText,
|
|
115
|
+
GripVertical as gripVertical,
|
|
116
|
+
Image as image,
|
|
117
|
+
LayoutGrid as layoutGrid,
|
|
118
|
+
LoaderCircle as loaderCircle,
|
|
119
|
+
Mail as mail,
|
|
120
|
+
Paperclip as paperclip,
|
|
121
|
+
RefreshCw as refreshCw,
|
|
122
|
+
RotateCcw as rotateCcw,
|
|
123
|
+
Rows3 as rows3,
|
|
124
|
+
Search as search,
|
|
125
|
+
Settings2 as settings2,
|
|
126
|
+
TriangleAlert as triangleAlert,
|
|
127
|
+
X as x
|
|
128
|
+
} from "lucide";
|
|
129
|
+
var createLucideIcon = (icon) => (h, {
|
|
130
|
+
size = 24,
|
|
131
|
+
color = "currentColor",
|
|
132
|
+
strokeWidth = 2,
|
|
133
|
+
className
|
|
134
|
+
} = {}) => h.svg.attrs({
|
|
135
|
+
class: className,
|
|
136
|
+
width: String(size),
|
|
137
|
+
height: String(size),
|
|
138
|
+
viewBox: "0 0 24 24",
|
|
139
|
+
fill: "none",
|
|
140
|
+
stroke: color,
|
|
141
|
+
"stroke-width": String(strokeWidth),
|
|
142
|
+
"stroke-linecap": "round",
|
|
143
|
+
"stroke-linejoin": "round",
|
|
144
|
+
"aria-hidden": "true"
|
|
145
|
+
}).children(...icon.map(([tag, attributes]) => {
|
|
146
|
+
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
147
|
+
switch (tag) {
|
|
148
|
+
case "path":
|
|
149
|
+
return h.path.attrs(attrs);
|
|
150
|
+
case "circle":
|
|
151
|
+
return h.circle.attrs(attrs);
|
|
152
|
+
case "ellipse":
|
|
153
|
+
return h.ellipse.attrs(attrs);
|
|
154
|
+
case "line":
|
|
155
|
+
return h.line.attrs(attrs);
|
|
156
|
+
case "polyline":
|
|
157
|
+
return h.polyline.attrs(attrs);
|
|
158
|
+
case "polygon":
|
|
159
|
+
return h.polygon.attrs(attrs);
|
|
160
|
+
case "rect":
|
|
161
|
+
return h.rect.attrs(attrs);
|
|
162
|
+
default:
|
|
163
|
+
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
164
|
+
}
|
|
165
|
+
}));
|
|
166
|
+
var Check = createLucideIcon(check);
|
|
167
|
+
var ArrowDown = createLucideIcon(arrowDown);
|
|
168
|
+
var ArrowUp = createLucideIcon(arrowUp);
|
|
169
|
+
var ListFilter = createLucideIcon(listFilter);
|
|
170
|
+
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
171
|
+
var ChevronDown = createLucideIcon(chevronDown);
|
|
172
|
+
var ChevronRight = createLucideIcon(chevronRight);
|
|
173
|
+
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
174
|
+
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
175
|
+
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
176
|
+
var Copy = createLucideIcon(copy);
|
|
177
|
+
var Download = createLucideIcon(download);
|
|
178
|
+
var Eye = createLucideIcon(eye);
|
|
179
|
+
var EyeOff = createLucideIcon(eyeOff);
|
|
180
|
+
var Ellipsis = createLucideIcon(ellipsis);
|
|
181
|
+
var FileJson = createLucideIcon(fileJson);
|
|
182
|
+
var FileText = createLucideIcon(fileText);
|
|
183
|
+
var GripVertical = createLucideIcon(gripVertical);
|
|
184
|
+
var Image = createLucideIcon(image);
|
|
185
|
+
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
186
|
+
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
187
|
+
var Mail = createLucideIcon(mail);
|
|
188
|
+
var Paperclip = createLucideIcon(paperclip);
|
|
189
|
+
var RefreshCw = createLucideIcon(refreshCw);
|
|
190
|
+
var RotateCcw = createLucideIcon(rotateCcw);
|
|
191
|
+
var Rows3 = createLucideIcon(rows3);
|
|
192
|
+
var Search = createLucideIcon(search);
|
|
193
|
+
var Settings2 = createLucideIcon(settings2);
|
|
194
|
+
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
195
|
+
var X = createLucideIcon(x);
|
|
196
|
+
|
|
197
|
+
// ../../src/lib/rich-text/tiptap.ts
|
|
198
|
+
import { Extension } from "@tiptap/core";
|
|
199
|
+
import Mention from "@tiptap/extension-mention";
|
|
200
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
201
|
+
import { Plugin } from "@tiptap/pm/state";
|
|
202
|
+
import { Schema as Schema2 } from "effect";
|
|
203
|
+
|
|
204
|
+
// ../../src/lib/rich-text/schema.ts
|
|
205
|
+
import { Schema } from "effect";
|
|
206
|
+
var RichTextLink = Schema.String.check(Schema.isMaxLength(2000), Schema.makeFilter((value) => {
|
|
207
|
+
if (/[\s\p{Cc}\\{}]/u.test(value))
|
|
208
|
+
return false;
|
|
209
|
+
const url = URL.parse(value);
|
|
210
|
+
return url !== null && ["https:", "mailto:"].includes(url.protocol) && !url.username && !url.password;
|
|
211
|
+
})).annotate({ identifier: "RichTextLink" });
|
|
212
|
+
var attributes = Schema.Record(Schema.String, Schema.Json);
|
|
213
|
+
var variableKey = Schema.String.check(Schema.isPattern(/^[a-zA-Z][a-zA-Z0-9_.]{0,79}$/));
|
|
214
|
+
var mark = Schema.Struct({
|
|
215
|
+
type: Schema.String,
|
|
216
|
+
attrs: Schema.optional(attributes)
|
|
217
|
+
}).check(Schema.makeFilter((value) => value.type !== "link" || Schema.is(RichTextLink)(value.attrs?.href)));
|
|
218
|
+
var TiptapNode = Schema.Struct({
|
|
219
|
+
type: Schema.String,
|
|
220
|
+
attrs: Schema.optional(attributes),
|
|
221
|
+
content: Schema.optional(Schema.mutable(Schema.Array(Schema.suspend(() => TiptapNode)))),
|
|
222
|
+
marks: Schema.optional(Schema.mutable(Schema.Array(mark))),
|
|
223
|
+
text: Schema.optional(Schema.String)
|
|
224
|
+
}).check(Schema.makeFilter((node) => node.type !== "mention" || Schema.is(variableKey)(node.attrs?.id))).annotate({ identifier: "TiptapNode" });
|
|
225
|
+
var RichTextDocument = TiptapNode.check(Schema.makeFilter((node) => node.type === "doc")).annotate({ identifier: "TiptapDocument" });
|
|
226
|
+
var RichTextVariable = Schema.Struct({
|
|
227
|
+
key: variableKey,
|
|
228
|
+
label: Schema.String,
|
|
229
|
+
type: Schema.Literals(["text", "url"]),
|
|
230
|
+
sample: Schema.String
|
|
231
|
+
}).annotate({ identifier: "RichTextVariable" });
|
|
232
|
+
|
|
233
|
+
// ../../src/lib/rich-text/tiptap.ts
|
|
234
|
+
var richTextMention = (variables = () => []) => Mention.configure({
|
|
235
|
+
deleteTriggerWithBackspace: true,
|
|
236
|
+
HTMLAttributes: {
|
|
237
|
+
class: "rounded bg-primary/10 px-1 font-mono text-primary",
|
|
238
|
+
contenteditable: "false"
|
|
239
|
+
},
|
|
240
|
+
renderText: ({ node }) => `{{${node.attrs.id}}}`,
|
|
241
|
+
renderHTML: ({ node }) => {
|
|
242
|
+
const id = Schema2.decodeUnknownSync(RichTextVariable.fields.key)(node.attrs.id);
|
|
243
|
+
const label = variables().find((variable) => variable.key === id)?.label ?? node.attrs.label ?? id;
|
|
244
|
+
return [
|
|
245
|
+
"span",
|
|
246
|
+
{
|
|
247
|
+
"data-type": "mention",
|
|
248
|
+
"data-id": id,
|
|
249
|
+
contenteditable: "false",
|
|
250
|
+
class: "rounded bg-primary/10 px-1 font-mono text-primary"
|
|
251
|
+
},
|
|
252
|
+
`{{${label}}}`
|
|
253
|
+
];
|
|
254
|
+
},
|
|
255
|
+
suggestion: { items: () => [] }
|
|
256
|
+
});
|
|
257
|
+
var richTextExtensions = ({
|
|
258
|
+
variables = () => []
|
|
259
|
+
} = {}) => [
|
|
260
|
+
StarterKit.configure({
|
|
261
|
+
link: {
|
|
262
|
+
openOnClick: false,
|
|
263
|
+
autolink: false,
|
|
264
|
+
linkOnPaste: false,
|
|
265
|
+
isAllowedUri: (url) => Schema2.is(RichTextLink)(url)
|
|
266
|
+
},
|
|
267
|
+
undoRedo: { depth: 100 },
|
|
268
|
+
heading: { levels: [1, 2, 3] }
|
|
269
|
+
}),
|
|
270
|
+
richTextMention(variables)
|
|
271
|
+
];
|
|
272
|
+
var richTextValidation = ({
|
|
273
|
+
maxLength,
|
|
274
|
+
onInvalid
|
|
275
|
+
}) => Extension.create({
|
|
276
|
+
name: "richTextValidation",
|
|
277
|
+
addProseMirrorPlugins: () => [
|
|
278
|
+
new Plugin({
|
|
279
|
+
filterTransaction: (transaction) => {
|
|
280
|
+
if (!transaction.docChanged)
|
|
281
|
+
return true;
|
|
282
|
+
const limit = maxLength();
|
|
283
|
+
const text = transaction.doc.textBetween(0, transaction.doc.content.size, `
|
|
284
|
+
`, (node) => node.type.name === "mention" ? `{{${node.attrs.id}}}` : "");
|
|
285
|
+
const valid = Schema2.is(RichTextDocument)(transaction.doc.toJSON()) && (limit === undefined || text.length <= limit);
|
|
286
|
+
onInvalid(!valid);
|
|
287
|
+
return valid;
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// ../../src/components/rich-text-editor/classes.ts
|
|
294
|
+
var richTextEditorClasses = {
|
|
295
|
+
toolbar: "bg-muted/30 flex flex-wrap items-center gap-1 border-b p-2",
|
|
296
|
+
linkForm: "flex flex-wrap items-end gap-2 border-b p-3",
|
|
297
|
+
linkField: "grid min-w-0 flex-1 gap-1 text-xs",
|
|
298
|
+
linkError: "text-destructive w-full text-xs",
|
|
299
|
+
editorError: "text-destructive px-4 pb-3 text-xs"
|
|
300
|
+
};
|
|
301
|
+
var resolveRichTextEditorClasses = (overrides) => ({
|
|
302
|
+
...richTextEditorClasses,
|
|
303
|
+
...overrides
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// ../../src/components/rich-text-editor/index.ts
|
|
307
|
+
import { Schema as Schema4 } from "effect";
|
|
308
|
+
import { Component, UiSchema, View } from "effect/ui";
|
|
309
|
+
|
|
310
|
+
// ../../src/components/rich-text-editor/schema.ts
|
|
311
|
+
import { Schema as Schema3, Struct } from "effect";
|
|
312
|
+
var RichTextEditorMessageFields = {
|
|
313
|
+
bold: Schema3.String,
|
|
314
|
+
italic: Schema3.String,
|
|
315
|
+
underline: Schema3.String,
|
|
316
|
+
undo: Schema3.String,
|
|
317
|
+
redo: Schema3.String,
|
|
318
|
+
link: Schema3.String,
|
|
319
|
+
unlink: Schema3.String,
|
|
320
|
+
linkUrl: Schema3.String,
|
|
321
|
+
apply: Schema3.String,
|
|
322
|
+
cancel: Schema3.String,
|
|
323
|
+
variable: Schema3.String,
|
|
324
|
+
paragraph: Schema3.String,
|
|
325
|
+
heading: Schema3.String,
|
|
326
|
+
bullet: Schema3.String,
|
|
327
|
+
numbered: Schema3.String,
|
|
328
|
+
toolbar: Schema3.String,
|
|
329
|
+
invalid: Schema3.String,
|
|
330
|
+
invalidLink: Schema3.String
|
|
331
|
+
};
|
|
332
|
+
var RichTextEditorCopy = Schema3.Struct(RichTextEditorMessageFields);
|
|
333
|
+
var RichTextEditorClassesOverridesSchema = Schema3.Record(Schema3.Literals(Struct.keys(richTextEditorClasses)), Schema3.optionalKey(Schema3.String)).annotate({ identifier: "RichTextEditorClassesOverrides" });
|
|
334
|
+
var RichTextEditorFields = {
|
|
335
|
+
classes: Schema3.optional(RichTextEditorClassesOverridesSchema),
|
|
336
|
+
value: RichTextDocument,
|
|
337
|
+
label: Schema3.String,
|
|
338
|
+
variables: Schema3.optional(Schema3.Array(RichTextVariable)),
|
|
339
|
+
disabled: Schema3.optional(Schema3.Boolean),
|
|
340
|
+
locale: Schema3.optional(Schema3.String),
|
|
341
|
+
messages: Schema3.optional(Schema3.Record(Schema3.String, Schema3.UndefinedOr(Schema3.Struct(Struct.map(RichTextEditorMessageFields, Schema3.optional))))),
|
|
342
|
+
className: Schema3.optional(Schema3.String),
|
|
343
|
+
maxLength: Schema3.optional(Schema3.Number)
|
|
344
|
+
};
|
|
345
|
+
var RichTextEditorPropsSchema = Schema3.Struct(RichTextEditorFields).annotate({ identifier: "RichTextEditorProps" });
|
|
346
|
+
|
|
347
|
+
// ../../src/components/rich-text-editor/labels.ts
|
|
348
|
+
var defaultMessages = {
|
|
349
|
+
en: {
|
|
350
|
+
bold: "Bold",
|
|
351
|
+
italic: "Italic",
|
|
352
|
+
underline: "Underline",
|
|
353
|
+
undo: "Undo",
|
|
354
|
+
redo: "Redo",
|
|
355
|
+
link: "Link",
|
|
356
|
+
unlink: "Remove link",
|
|
357
|
+
linkUrl: "Link URL",
|
|
358
|
+
apply: "Apply link",
|
|
359
|
+
cancel: "Cancel",
|
|
360
|
+
variable: "Insert variable",
|
|
361
|
+
paragraph: "Paragraph",
|
|
362
|
+
heading: "Heading",
|
|
363
|
+
bullet: "Bulleted list",
|
|
364
|
+
numbered: "Numbered list",
|
|
365
|
+
toolbar: "Text formatting",
|
|
366
|
+
invalid: "The content is too long or contains an unsupported value.",
|
|
367
|
+
invalidLink: "Enter an HTTPS or mailto link."
|
|
368
|
+
},
|
|
369
|
+
fr: {
|
|
370
|
+
bold: "Gras",
|
|
371
|
+
italic: "Italique",
|
|
372
|
+
underline: "Souligné",
|
|
373
|
+
undo: "Annuler",
|
|
374
|
+
redo: "Rétablir",
|
|
375
|
+
link: "Lien",
|
|
376
|
+
unlink: "Retirer le lien",
|
|
377
|
+
linkUrl: "URL du lien",
|
|
378
|
+
apply: "Appliquer le lien",
|
|
379
|
+
cancel: "Annuler",
|
|
380
|
+
variable: "Insérer une variable",
|
|
381
|
+
paragraph: "Paragraphe",
|
|
382
|
+
heading: "Titre",
|
|
383
|
+
bullet: "Liste à puces",
|
|
384
|
+
numbered: "Liste numérotée",
|
|
385
|
+
toolbar: "Mise en forme",
|
|
386
|
+
invalid: "Le contenu est trop long ou contient une valeur non prise en charge.",
|
|
387
|
+
invalidLink: "Saisissez un lien HTTPS ou mailto."
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// ../../src/components/rich-text-editor/index.ts
|
|
392
|
+
var richTextEditorMessages = (locale, messages) => ({
|
|
393
|
+
...locale.startsWith("fr") ? defaultMessages.fr : defaultMessages.en,
|
|
394
|
+
...messages?.[locale.split("-")[0] ?? locale],
|
|
395
|
+
...messages?.[locale]
|
|
396
|
+
});
|
|
397
|
+
var EditorAction = UiSchema.TaggedEnum({
|
|
398
|
+
Format: {
|
|
399
|
+
kind: Schema4.Literals([
|
|
400
|
+
"bold",
|
|
401
|
+
"italic",
|
|
402
|
+
"underline",
|
|
403
|
+
"paragraph",
|
|
404
|
+
"heading",
|
|
405
|
+
"bullet",
|
|
406
|
+
"numbered",
|
|
407
|
+
"undo",
|
|
408
|
+
"redo",
|
|
409
|
+
"unlink"
|
|
410
|
+
])
|
|
411
|
+
},
|
|
412
|
+
Insert: { key: Schema4.String },
|
|
413
|
+
Link: { href: RichTextLink }
|
|
414
|
+
}).annotate({ identifier: "RichTextEditorAction" });
|
|
415
|
+
var EditorStatus = Schema4.Struct({
|
|
416
|
+
ready: Schema4.Boolean,
|
|
417
|
+
undo: Schema4.Boolean,
|
|
418
|
+
redo: Schema4.Boolean,
|
|
419
|
+
bold: Schema4.Boolean,
|
|
420
|
+
italic: Schema4.Boolean,
|
|
421
|
+
underline: Schema4.Boolean,
|
|
422
|
+
block: Schema4.Literals(["paragraph", "heading", "bullet", "numbered"]),
|
|
423
|
+
href: Schema4.NullOr(Schema4.String)
|
|
424
|
+
});
|
|
425
|
+
var RichTextEditorEvents = UiSchema.TaggedEnum({
|
|
426
|
+
Changed: { value: RichTextDocument }
|
|
427
|
+
}).annotate({ identifier: "RichTextEditorEvents" });
|
|
428
|
+
var RichTextEditorMessage = UiSchema.TaggedEnum({
|
|
429
|
+
Changed: { value: RichTextDocument },
|
|
430
|
+
Status: { status: EditorStatus },
|
|
431
|
+
Invalid: { invalid: Schema4.Boolean },
|
|
432
|
+
Replaced: {},
|
|
433
|
+
SetToolbarPopup: {
|
|
434
|
+
popup: Schema4.Literals(["block", "variable"]),
|
|
435
|
+
open: Schema4.Boolean
|
|
436
|
+
},
|
|
437
|
+
ToggleLink: {},
|
|
438
|
+
EditLink: { link: Schema4.String },
|
|
439
|
+
ApplyLink: {},
|
|
440
|
+
CloseLink: {},
|
|
441
|
+
Action: { action: EditorAction }
|
|
442
|
+
}).annotate({ identifier: "RichTextEditorMessage" });
|
|
443
|
+
var modelOptions = {
|
|
444
|
+
name: "RichTextEditor",
|
|
445
|
+
props: RichTextEditorPropsSchema,
|
|
446
|
+
model: Schema4.Struct({
|
|
447
|
+
status: EditorStatus,
|
|
448
|
+
invalid: Schema4.Boolean,
|
|
449
|
+
toolbarPopup: Schema4.NullOr(Schema4.Literals(["block", "variable"])),
|
|
450
|
+
linkOpen: Schema4.Boolean,
|
|
451
|
+
link: Schema4.String,
|
|
452
|
+
linkError: Schema4.Boolean,
|
|
453
|
+
request: Schema4.NullOr(Schema4.Struct({ serial: Schema4.Int, action: EditorAction }))
|
|
454
|
+
}).annotate({ identifier: "RichTextEditorModel" }),
|
|
455
|
+
message: RichTextEditorMessage,
|
|
456
|
+
restore: false
|
|
457
|
+
};
|
|
458
|
+
var richTextEditorOptions = {
|
|
459
|
+
...modelOptions,
|
|
460
|
+
events: RichTextEditorEvents
|
|
461
|
+
};
|
|
462
|
+
var transition = (model, message, disabled) => {
|
|
463
|
+
switch (message._tag) {
|
|
464
|
+
case "Changed":
|
|
465
|
+
return model;
|
|
466
|
+
case "Status":
|
|
467
|
+
return { ...model, status: message.status };
|
|
468
|
+
case "Invalid":
|
|
469
|
+
return { ...model, invalid: message.invalid };
|
|
470
|
+
case "Replaced":
|
|
471
|
+
return { ...model, invalid: false, toolbarPopup: null, linkOpen: false };
|
|
472
|
+
case "SetToolbarPopup":
|
|
473
|
+
return {
|
|
474
|
+
...model,
|
|
475
|
+
toolbarPopup: disabled ? null : message.open ? message.popup : model.toolbarPopup === message.popup ? null : model.toolbarPopup
|
|
476
|
+
};
|
|
477
|
+
case "ToggleLink":
|
|
478
|
+
return {
|
|
479
|
+
...model,
|
|
480
|
+
linkOpen: !model.linkOpen,
|
|
481
|
+
link: model.status.href ?? "",
|
|
482
|
+
linkError: false
|
|
483
|
+
};
|
|
484
|
+
case "EditLink":
|
|
485
|
+
return { ...model, link: message.link };
|
|
486
|
+
case "ApplyLink":
|
|
487
|
+
if (disabled)
|
|
488
|
+
return model;
|
|
489
|
+
if (!Schema4.is(RichTextLink)(model.link))
|
|
490
|
+
return { ...model, linkError: true };
|
|
491
|
+
return {
|
|
492
|
+
...model,
|
|
493
|
+
linkOpen: false,
|
|
494
|
+
request: {
|
|
495
|
+
serial: (model.request?.serial ?? 0) + 1,
|
|
496
|
+
action: EditorAction.Link({ href: model.link })
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
case "CloseLink":
|
|
500
|
+
return { ...model, linkOpen: false };
|
|
501
|
+
case "Action":
|
|
502
|
+
if (disabled)
|
|
503
|
+
return model;
|
|
504
|
+
return {
|
|
505
|
+
...model,
|
|
506
|
+
linkOpen: message.action._tag === "Format" && message.action.kind === "unlink" ? false : model.linkOpen,
|
|
507
|
+
request: {
|
|
508
|
+
serial: (model.request?.serial ?? 0) + 1,
|
|
509
|
+
action: message.action
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
var update = ($, message) => transition($.model, message, $.props.disabled);
|
|
515
|
+
var richTextEditorBehaviours = {
|
|
516
|
+
init: () => ({
|
|
517
|
+
status: {
|
|
518
|
+
ready: false,
|
|
519
|
+
undo: false,
|
|
520
|
+
redo: false,
|
|
521
|
+
bold: false,
|
|
522
|
+
italic: false,
|
|
523
|
+
underline: false,
|
|
524
|
+
block: "paragraph",
|
|
525
|
+
href: null
|
|
526
|
+
},
|
|
527
|
+
invalid: false,
|
|
528
|
+
toolbarPopup: null,
|
|
529
|
+
linkOpen: false,
|
|
530
|
+
link: "",
|
|
531
|
+
linkError: false,
|
|
532
|
+
request: null
|
|
533
|
+
}),
|
|
534
|
+
update
|
|
535
|
+
};
|
|
536
|
+
var richTextEditorHtmlUpdate = ($, message) => message._tag === "Changed" && !$.props.disabled ? $.set($.model).emit(RichTextEditorEvents.Changed({ value: message.value })) : transition($.model, message, $.props.disabled);
|
|
537
|
+
var RichTextEditorModel = Component.define(modelOptions).make({
|
|
538
|
+
...richTextEditorBehaviours,
|
|
539
|
+
view: () => View.text("")
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// ../../src/components/rich-text-editor/engine.ts
|
|
543
|
+
import { Schema as Schema5 } from "effect";
|
|
544
|
+
import { closeHistory } from "@tiptap/pm/history";
|
|
545
|
+
import { EditorState } from "@tiptap/pm/state";
|
|
546
|
+
var replacementMeta = "krakstackExternalReplacement";
|
|
547
|
+
var replaceRichText = (editor, value) => {
|
|
548
|
+
const doc = editor.schema.nodeFromJSON(Schema5.decodeSync(RichTextDocument)(value));
|
|
549
|
+
doc.check();
|
|
550
|
+
if (!editor.state.doc.eq(doc)) {
|
|
551
|
+
editor.view.updateState(EditorState.create({
|
|
552
|
+
schema: editor.schema,
|
|
553
|
+
doc,
|
|
554
|
+
plugins: editor.state.plugins
|
|
555
|
+
}));
|
|
556
|
+
editor.view.dispatch(editor.state.tr.setMeta(replacementMeta, true));
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
var refreshMentionLabels = (editor, variables) => {
|
|
560
|
+
for (const chip of editor.view.dom.querySelectorAll('[data-type="mention"]')) {
|
|
561
|
+
const key = chip.getAttribute("data-id");
|
|
562
|
+
const text = `{{${variables.find((variable) => variable.key === key)?.label ?? key}}}`;
|
|
563
|
+
if (chip.textContent !== text)
|
|
564
|
+
chip.textContent = text;
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
var readEditorStatus = (editor) => ({
|
|
568
|
+
ready: true,
|
|
569
|
+
undo: editor.can().undo(),
|
|
570
|
+
redo: editor.can().redo(),
|
|
571
|
+
bold: editor.isActive("bold"),
|
|
572
|
+
italic: editor.isActive("italic"),
|
|
573
|
+
underline: editor.isActive("underline"),
|
|
574
|
+
block: editor.isActive("bulletList") ? "bullet" : editor.isActive("orderedList") ? "numbered" : editor.isActive("heading") ? "heading" : "paragraph",
|
|
575
|
+
href: editor.getAttributes("link").href ?? null
|
|
576
|
+
});
|
|
577
|
+
var runEditorAction = (editor, action, variables) => {
|
|
578
|
+
if (!editor.isEditable)
|
|
579
|
+
return;
|
|
580
|
+
if (action._tag === "Insert") {
|
|
581
|
+
const variable = variables.find(({ key }) => key === action.key);
|
|
582
|
+
if (!variable)
|
|
583
|
+
return;
|
|
584
|
+
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
585
|
+
editor.chain().focus().insertContent({
|
|
586
|
+
type: "mention",
|
|
587
|
+
attrs: { id: variable.key, label: variable.label }
|
|
588
|
+
}).run();
|
|
589
|
+
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const chain = editor.chain().focus();
|
|
593
|
+
if (action._tag === "Link") {
|
|
594
|
+
chain.extendMarkRange("link").setLink({ href: action.href }).run();
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
switch (action.kind) {
|
|
598
|
+
case "bold":
|
|
599
|
+
chain.toggleBold().run();
|
|
600
|
+
break;
|
|
601
|
+
case "italic":
|
|
602
|
+
chain.toggleItalic().run();
|
|
603
|
+
break;
|
|
604
|
+
case "underline":
|
|
605
|
+
chain.toggleUnderline().run();
|
|
606
|
+
break;
|
|
607
|
+
case "undo":
|
|
608
|
+
chain.undo().run();
|
|
609
|
+
break;
|
|
610
|
+
case "redo":
|
|
611
|
+
chain.redo().run();
|
|
612
|
+
break;
|
|
613
|
+
case "bullet":
|
|
614
|
+
chain.toggleBulletList().run();
|
|
615
|
+
break;
|
|
616
|
+
case "numbered":
|
|
617
|
+
chain.toggleOrderedList().run();
|
|
618
|
+
break;
|
|
619
|
+
case "heading":
|
|
620
|
+
chain.clearNodes().setHeading({ level: 2 }).run();
|
|
621
|
+
break;
|
|
622
|
+
case "paragraph":
|
|
623
|
+
chain.clearNodes().setParagraph().run();
|
|
624
|
+
break;
|
|
625
|
+
case "unlink":
|
|
626
|
+
chain.extendMarkRange("link").unsetLink().run();
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
var editorContentClass = "min-h-40 px-4 py-3 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset [&_h1]:text-2xl [&_h2]:text-xl [&_h3]:text-lg [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-6 [&_ol]:pl-6 [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:pl-4 [&_pre]:rounded [&_pre]:bg-muted [&_pre]:p-3";
|
|
631
|
+
|
|
632
|
+
// ../../src/components/rich-text-editor/html.ts
|
|
633
|
+
var contentArgs = {
|
|
634
|
+
props: RichTextEditorPropsSchema,
|
|
635
|
+
request: richTextEditorOptions.model.fields.request,
|
|
636
|
+
invalid: Schema6.Boolean,
|
|
637
|
+
errorId: Schema6.String
|
|
638
|
+
};
|
|
639
|
+
var icons = {
|
|
640
|
+
bold: createLucideIcon(Bold),
|
|
641
|
+
italic: createLucideIcon(Italic),
|
|
642
|
+
underline: createLucideIcon(Underline),
|
|
643
|
+
undo: createLucideIcon(Undo2),
|
|
644
|
+
redo: createLucideIcon(Redo2),
|
|
645
|
+
link: createLucideIcon(Link2)
|
|
646
|
+
};
|
|
647
|
+
var VariableIcon = createLucideIcon(Braces);
|
|
648
|
+
var blocks = ["paragraph", "heading", "bullet", "numbered"];
|
|
649
|
+
var makeRichTextEditor = (name, extensions) => {
|
|
650
|
+
const Attach = Mount.makeStream(`${name}.editor`, { args: contentArgs }, (node, initial, changes) => Stream.callback((queue) => Effect.gen(function* () {
|
|
651
|
+
let current = initial;
|
|
652
|
+
const variables = () => current.props.variables ?? [];
|
|
653
|
+
const attributes = () => ({
|
|
654
|
+
role: "textbox",
|
|
655
|
+
"aria-multiline": "true",
|
|
656
|
+
"aria-label": current.props.label,
|
|
657
|
+
"aria-disabled": String(!!current.props.disabled),
|
|
658
|
+
"aria-describedby": current.invalid ? current.errorId : "",
|
|
659
|
+
class: `${editorContentClass} text-sm leading-relaxed`
|
|
660
|
+
});
|
|
661
|
+
const send = (message) => Queue.offerUnsafe(queue, message);
|
|
662
|
+
let lastStatus = "";
|
|
663
|
+
const status = (editor) => {
|
|
664
|
+
const next = readEditorStatus(editor);
|
|
665
|
+
const key = JSON.stringify(next);
|
|
666
|
+
if (key === lastStatus)
|
|
667
|
+
return;
|
|
668
|
+
lastStatus = key;
|
|
669
|
+
send(RichTextEditorMessage.Status({ status: next }));
|
|
670
|
+
};
|
|
671
|
+
const editor = yield* Effect.acquireRelease(Effect.sync(() => new Editor({
|
|
672
|
+
element: node,
|
|
673
|
+
content: current.props.value,
|
|
674
|
+
editable: !current.props.disabled,
|
|
675
|
+
extensions: [
|
|
676
|
+
...extensions?.(variables) ?? richTextExtensions({ variables }),
|
|
677
|
+
richTextValidation({
|
|
678
|
+
maxLength: () => current.props.maxLength,
|
|
679
|
+
onInvalid: (invalid) => send(RichTextEditorMessage.Invalid({ invalid }))
|
|
680
|
+
})
|
|
681
|
+
],
|
|
682
|
+
editorProps: { attributes: attributes() },
|
|
683
|
+
onUpdate: ({ editor }) => send(RichTextEditorMessage.Changed({ value: editor.getJSON() })),
|
|
684
|
+
onTransaction: ({ editor, transaction }) => {
|
|
685
|
+
if (transaction.getMeta(replacementMeta))
|
|
686
|
+
send(RichTextEditorMessage.Replaced());
|
|
687
|
+
status(editor);
|
|
688
|
+
}
|
|
689
|
+
})), (editor) => Effect.sync(() => editor.destroy()));
|
|
690
|
+
status(editor);
|
|
691
|
+
yield* Stream.runForEach(changes, (next) => Effect.sync(() => {
|
|
692
|
+
const previous = current;
|
|
693
|
+
current = next;
|
|
694
|
+
if (previous.props.value !== next.props.value)
|
|
695
|
+
replaceRichText(editor, next.props.value);
|
|
696
|
+
if (previous.props.disabled !== next.props.disabled)
|
|
697
|
+
editor.setEditable(!next.props.disabled, false);
|
|
698
|
+
if (previous.props.label !== next.props.label || previous.props.disabled !== next.props.disabled || previous.invalid !== next.invalid || previous.errorId !== next.errorId) {
|
|
699
|
+
editor.setOptions({
|
|
700
|
+
editorProps: { attributes: attributes() }
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
if (previous.props.variables !== next.props.variables)
|
|
704
|
+
refreshMentionLabels(editor, variables());
|
|
705
|
+
if (next.request && next.request.serial !== previous.request?.serial)
|
|
706
|
+
runEditorAction(editor, next.request.action, variables());
|
|
707
|
+
}));
|
|
708
|
+
})));
|
|
709
|
+
return Html.component({
|
|
710
|
+
...richTextEditorOptions,
|
|
711
|
+
name,
|
|
712
|
+
reads: { localeConfig: krakstackLocaleRead }
|
|
713
|
+
}).make({
|
|
714
|
+
...richTextEditorBehaviours,
|
|
715
|
+
update: richTextEditorHtmlUpdate,
|
|
716
|
+
view: (h, model) => {
|
|
717
|
+
const richTextEditorClasses = resolveRichTextEditorClasses(h.props.classes);
|
|
718
|
+
const props = h.props;
|
|
719
|
+
const copy = richTextEditorMessages(props.locale ?? h.reads.localeConfig?.locale ?? "en", props.messages);
|
|
720
|
+
const { status } = model;
|
|
721
|
+
const disabled = !!props.disabled || !status.ready;
|
|
722
|
+
const errorId = h.id("error");
|
|
723
|
+
const format = (kind) => RichTextEditorMessage.Action({ action: EditorAction.Format({ kind }) });
|
|
724
|
+
const blockItems = blocks.map((value) => ({
|
|
725
|
+
value,
|
|
726
|
+
label: copy[value]
|
|
727
|
+
}));
|
|
728
|
+
const variableItems = (props.variables ?? []).map(({ key, label }) => ({
|
|
729
|
+
value: key,
|
|
730
|
+
label
|
|
731
|
+
}));
|
|
732
|
+
const iconButton = (key, message, pressed, blocked = false) => Button(h, {
|
|
733
|
+
element: h.button.on("mousedown", () => {
|
|
734
|
+
return;
|
|
735
|
+
}, {
|
|
736
|
+
preventDefault: "always"
|
|
737
|
+
}),
|
|
738
|
+
size: "icon-sm",
|
|
739
|
+
variant: pressed ? "secondary" : "ghost",
|
|
740
|
+
props: { type: "button", disabled: disabled || blocked },
|
|
741
|
+
onPress: message
|
|
742
|
+
}).attrs({
|
|
743
|
+
title: copy[key],
|
|
744
|
+
"aria-label": copy[key],
|
|
745
|
+
"aria-pressed": pressed === undefined ? undefined : pressed ? "true" : "false"
|
|
746
|
+
}).children(icons[key](h));
|
|
747
|
+
const button = (label, message, blocked = disabled) => Button(h, {
|
|
748
|
+
size: "sm",
|
|
749
|
+
variant: "outline",
|
|
750
|
+
props: { type: "button", disabled: blocked },
|
|
751
|
+
onPress: message
|
|
752
|
+
}).children(label);
|
|
753
|
+
return h.div.class(`bg-background text-foreground overflow-hidden rounded-xl border ${props.className ?? ""}`).attr("data-slot", "rich-text-editor").children(h.div.attrs({ role: "group", "aria-label": copy.toolbar }).class(richTextEditorClasses.toolbar).children(iconButton("undo", format("undo"), undefined, !status.undo), iconButton("redo", format("redo"), undefined, !status.redo), Select(h, {
|
|
754
|
+
props: {
|
|
755
|
+
open: !disabled && model.toolbarPopup === "block",
|
|
756
|
+
value: status.block,
|
|
757
|
+
items: blockItems,
|
|
758
|
+
disabled,
|
|
759
|
+
align: "start",
|
|
760
|
+
alignItemWithTrigger: false
|
|
761
|
+
},
|
|
762
|
+
onEmit: {
|
|
763
|
+
RequestedOpen: () => RichTextEditorMessage.SetToolbarPopup({ popup: "block", open: true }),
|
|
764
|
+
RequestedClose: () => RichTextEditorMessage.SetToolbarPopup({ popup: "block", open: false }),
|
|
765
|
+
Picked: ({ value }) => {
|
|
766
|
+
const kind = blocks.find((kind) => kind === value);
|
|
767
|
+
return kind ? format(kind) : undefined;
|
|
768
|
+
},
|
|
769
|
+
Settled: () => {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
view: (select) => h.div.children(SelectTrigger(h, select, { size: "sm", class: "min-w-0" }).attr("aria-label", copy.paragraph).children(SelectValue(h, select), SelectIcon(h, select)), SelectPositioner(h, select).children(SelectPopup(h, select, { size: "sm" }).children(...blockItems.map(({ value, label }) => SelectItem(h, select, { value }).children(SelectItemText(h, select).children(label), SelectItemIndicator(h, select, { value }))))))
|
|
774
|
+
}), iconButton("bold", format("bold"), status.bold), iconButton("italic", format("italic"), status.italic), iconButton("underline", format("underline"), status.underline), iconButton("link", RichTextEditorMessage.ToggleLink(), model.linkOpen || status.href !== null), variableItems.length > 0 && Menu(h, {
|
|
775
|
+
props: {
|
|
776
|
+
open: !disabled && model.toolbarPopup === "variable",
|
|
777
|
+
disabled,
|
|
778
|
+
align: "end",
|
|
779
|
+
items: variableItems
|
|
780
|
+
},
|
|
781
|
+
onEmit: {
|
|
782
|
+
RequestedOpen: () => RichTextEditorMessage.SetToolbarPopup({
|
|
783
|
+
popup: "variable",
|
|
784
|
+
open: true
|
|
785
|
+
}),
|
|
786
|
+
RequestedClose: () => RichTextEditorMessage.SetToolbarPopup({
|
|
787
|
+
popup: "variable",
|
|
788
|
+
open: false
|
|
789
|
+
}),
|
|
790
|
+
Picked: ({ value }) => RichTextEditorMessage.Action({
|
|
791
|
+
action: EditorAction.Insert({ key: value })
|
|
792
|
+
}),
|
|
793
|
+
Highlighted: () => {
|
|
794
|
+
return;
|
|
795
|
+
},
|
|
796
|
+
RequestedQuery: () => {
|
|
797
|
+
return;
|
|
798
|
+
},
|
|
799
|
+
Settled: () => {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
view: (menu) => h.div.class("ml-auto").children(menu.trigger({
|
|
804
|
+
element: h.button.class(buttonVariants({ variant: "outline", size: "sm" }))
|
|
805
|
+
}).children(VariableIcon(h, { size: 16 }), copy.variable), MenuPositioner(h, menu).children(MenuPopup(h, menu).children(...variableItems.map(({ value, label }) => menu.item({
|
|
806
|
+
element: h.div.class("cursor-default rounded-sm px-2 py-1.5 outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground"),
|
|
807
|
+
value
|
|
808
|
+
}).children(label)))))
|
|
809
|
+
})), model.linkOpen && h.div.class(richTextEditorClasses.linkForm).children(h.label.class(richTextEditorClasses.linkField).children(copy.linkUrl, Input(h, {
|
|
810
|
+
props: { value: model.link, disabled },
|
|
811
|
+
onUpdate: ({ value }) => RichTextEditorMessage.EditLink({ link: value })
|
|
812
|
+
}).attrs({
|
|
813
|
+
"aria-invalid": model.linkError ? "true" : "false",
|
|
814
|
+
placeholder: "https://"
|
|
815
|
+
}).on("keydown", ({ key }) => key === "Enter" ? RichTextEditorMessage.ApplyLink() : key === "Escape" ? RichTextEditorMessage.CloseLink() : undefined)), button(copy.apply, RichTextEditorMessage.ApplyLink()), status.href !== null && button(copy.unlink, format("unlink")), button(copy.cancel, RichTextEditorMessage.CloseLink(), false), model.linkError && h.p.attr("role", "alert").class(richTextEditorClasses.linkError).children(copy.invalidLink)), h.div.onMount(Attach({
|
|
816
|
+
props,
|
|
817
|
+
request: model.request,
|
|
818
|
+
invalid: model.invalid,
|
|
819
|
+
errorId
|
|
820
|
+
}).pipe(Mount.map((message) => message))), model.invalid && h.p.attrs({ id: errorId, role: "alert" }).class(richTextEditorClasses.editorError).children(copy.invalid));
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
var RichTextEditor = makeRichTextEditor("RichTextEditor");
|
|
825
|
+
export {
|
|
826
|
+
RichTextEditor,
|
|
827
|
+
RichTextEditorEvents,
|
|
828
|
+
RichTextEditorPropsSchema,
|
|
829
|
+
makeRichTextEditor
|
|
830
|
+
};
|