@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,934 @@
|
|
|
1
|
+
// ../../src/components/map-menu/html.ts
|
|
2
|
+
import { Effect as Effect3, Redacted as Redacted2, Schema as Schema3, Stream as Stream2 } from "effect";
|
|
3
|
+
import { Mount } from "effect/ui";
|
|
4
|
+
import { Html } from "effect/ui/html";
|
|
5
|
+
import { Combobox, Dialog } from "effect/ui/kit";
|
|
6
|
+
import { LocateFixed, MapPin, Minus, Plus, Search as Search2 } from "lucide";
|
|
7
|
+
|
|
8
|
+
// ../../src/components/effectcn/button.ts
|
|
9
|
+
import {
|
|
10
|
+
Button as KitButton
|
|
11
|
+
} from "effect/ui/kit";
|
|
12
|
+
|
|
13
|
+
// ../../src/lib/utils.ts
|
|
14
|
+
import { cn } from "cn";
|
|
15
|
+
|
|
16
|
+
// ../../src/components/effectcn/button.ts
|
|
17
|
+
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";
|
|
18
|
+
var variants = {
|
|
19
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
20
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-accent",
|
|
21
|
+
outline: "border-input bg-background text-foreground shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
22
|
+
ghost: "text-foreground hover:bg-accent hover:text-accent-foreground",
|
|
23
|
+
brand: "bg-brand-soft text-brand-soft-foreground hover:bg-brand-soft/85",
|
|
24
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/85",
|
|
25
|
+
link: "h-auto px-0 text-foreground underline decoration-transparent underline-offset-4 hover:decoration-current"
|
|
26
|
+
};
|
|
27
|
+
var sizes = {
|
|
28
|
+
default: "",
|
|
29
|
+
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
30
|
+
lg: "h-10 px-5 text-sm",
|
|
31
|
+
icon: "w-8.5 px-0",
|
|
32
|
+
"icon-sm": "h-7 w-7 rounded-sm px-0"
|
|
33
|
+
};
|
|
34
|
+
var buttonVariants = (options = {}) => cn(base, variants[options.variant ?? "default"], sizes[options.size ?? "default"], options.class);
|
|
35
|
+
var Button = (h, options = {}) => KitButton(h, {
|
|
36
|
+
element: options.element,
|
|
37
|
+
onPress: options.onPress,
|
|
38
|
+
props: options.loading ? { ...options.props, disabled: true, focusableWhenDisabled: true } : options.props
|
|
39
|
+
}).class(buttonVariants(options)).attr("data-loading", options.loading ? "" : undefined);
|
|
40
|
+
|
|
41
|
+
// ../../src/components/effectcn/combobox.ts
|
|
42
|
+
var icon = (h, path) => h.el("svg").attrs({
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
fill: "none",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
"stroke-width": "2",
|
|
47
|
+
"stroke-linecap": "round",
|
|
48
|
+
"stroke-linejoin": "round",
|
|
49
|
+
"aria-hidden": "true"
|
|
50
|
+
}).children(h.el("path").attr("d", path));
|
|
51
|
+
var ComboboxClear = (h, combobox, options = {}) => combobox.clear({
|
|
52
|
+
element: h.button.class(cn("text-muted-foreground hover:bg-accent hover:text-foreground grid size-6 shrink-0 place-items-center rounded-sm transition-colors duration-150 data-[disabled]:pointer-events-none [&_svg]:size-3.5", options.class))
|
|
53
|
+
})?.children(icon(h, "M18 6L6 18M6 6l12 12"));
|
|
54
|
+
var ComboboxPositioner = (h, combobox, options = {}) => combobox.positioner(h.div.class(cn("outline-none", options.class)));
|
|
55
|
+
var ComboboxPopup = (h, combobox, options = {}) => combobox.popup(h.div.class(cn("bg-popover text-foreground shadow-float box-border flex max-h-[min(var(--available-height),20rem)] w-[var(--anchor-width)] max-w-[var(--available-width)] min-w-48 origin-[var(--transform-origin)] flex-col overflow-hidden rounded-lg border text-[13px] transition-[opacity,scale] duration-150 outline-none data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0", options.class)));
|
|
56
|
+
var ComboboxEmpty = (h, combobox, options = {}) => combobox.empty(h.div.class(cn("text-muted-foreground px-3 py-5 text-center empty:hidden", options.class)));
|
|
57
|
+
var ComboboxItem = (h, combobox, options) => combobox.item({
|
|
58
|
+
element: h.div.class(cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:text-muted-foreground flex min-h-7.5 cursor-default items-center justify-between gap-2 rounded-sm px-2 py-1 leading-snug select-none data-[disabled]:opacity-60 data-[selected]:font-medium", options.class)),
|
|
59
|
+
value: options.value
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// ../../src/components/effectcn/input.ts
|
|
63
|
+
import {
|
|
64
|
+
Input as KitInput
|
|
65
|
+
} from "effect/ui/kit";
|
|
66
|
+
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";
|
|
67
|
+
var sizes2 = {
|
|
68
|
+
default: "",
|
|
69
|
+
sm: "h-7 rounded-sm px-2.5 text-xs",
|
|
70
|
+
lg: "h-10 px-3.5 text-sm"
|
|
71
|
+
};
|
|
72
|
+
var inputVariants = (options = {}) => cn(base2, sizes2[options.size ?? "default"], options.class);
|
|
73
|
+
|
|
74
|
+
// ../../src/components/effectcn/dialog.ts
|
|
75
|
+
var DialogBackdrop = (h, dialog, options = {}) => dialog.backdrop(h.div.class(cn("fixed inset-0 bg-[color-mix(in_oklab,var(--shadow-color,#000)_45%,transparent)] transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", options.class)));
|
|
76
|
+
var DialogViewport = (h, dialog, options = {}) => dialog.viewport(h.div.class(cn("pointer-events-none fixed inset-0 grid place-items-center p-4", options.class)));
|
|
77
|
+
var DialogPopup = (h, dialog, options = {}) => dialog.popup(h.div.class(cn("bg-popover text-popover-foreground pointer-events-auto relative flex max-h-full w-full max-w-[440px] flex-col gap-4 rounded-lg border p-6 text-sm shadow-lg outline-none", "transition-[opacity,scale,translate,filter] duration-200 ease-out data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[nested-dialog-open]:-translate-y-[calc(14px*var(--nested-dialogs))] data-[nested-dialog-open]:scale-[calc(1-0.05*var(--nested-dialogs))] data-[nested-dialog-open]:brightness-95", options.class)));
|
|
78
|
+
var DialogTitle = (h, dialog, options = {}) => dialog.title(h.h2.class(cn("m-0 border-0 p-0 text-[16px] leading-snug font-semibold tracking-tight", options.class)));
|
|
79
|
+
|
|
80
|
+
// ../../src/components/map-menu/html.ts
|
|
81
|
+
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
82
|
+
|
|
83
|
+
// ../../src/lib/lucide-effect.ts
|
|
84
|
+
import {
|
|
85
|
+
ArrowDown as arrowDown,
|
|
86
|
+
ArrowUp as arrowUp,
|
|
87
|
+
ListFilter as listFilter,
|
|
88
|
+
Check as check,
|
|
89
|
+
ChevronLeft as chevronLeft,
|
|
90
|
+
ChevronDown as chevronDown,
|
|
91
|
+
ChevronRight as chevronRight,
|
|
92
|
+
ChevronsLeft as chevronsLeft,
|
|
93
|
+
ChevronsRight as chevronsRight,
|
|
94
|
+
ChevronsUpDown as chevronsUpDown,
|
|
95
|
+
Copy as copy,
|
|
96
|
+
Download as download,
|
|
97
|
+
Eye as eye,
|
|
98
|
+
EyeOff as eyeOff,
|
|
99
|
+
Ellipsis as ellipsis,
|
|
100
|
+
FileJson as fileJson,
|
|
101
|
+
FileText as fileText,
|
|
102
|
+
GripVertical as gripVertical,
|
|
103
|
+
Image as image,
|
|
104
|
+
LayoutGrid as layoutGrid,
|
|
105
|
+
LoaderCircle as loaderCircle,
|
|
106
|
+
Mail as mail,
|
|
107
|
+
Paperclip as paperclip,
|
|
108
|
+
RefreshCw as refreshCw,
|
|
109
|
+
RotateCcw as rotateCcw,
|
|
110
|
+
Rows3 as rows3,
|
|
111
|
+
Search as search,
|
|
112
|
+
Settings2 as settings2,
|
|
113
|
+
TriangleAlert as triangleAlert,
|
|
114
|
+
X as x
|
|
115
|
+
} from "lucide";
|
|
116
|
+
var createLucideIcon = (icon) => (h, {
|
|
117
|
+
size = 24,
|
|
118
|
+
color = "currentColor",
|
|
119
|
+
strokeWidth = 2,
|
|
120
|
+
className
|
|
121
|
+
} = {}) => h.svg.attrs({
|
|
122
|
+
class: className,
|
|
123
|
+
width: String(size),
|
|
124
|
+
height: String(size),
|
|
125
|
+
viewBox: "0 0 24 24",
|
|
126
|
+
fill: "none",
|
|
127
|
+
stroke: color,
|
|
128
|
+
"stroke-width": String(strokeWidth),
|
|
129
|
+
"stroke-linecap": "round",
|
|
130
|
+
"stroke-linejoin": "round",
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}).children(...icon.map(([tag, attributes]) => {
|
|
133
|
+
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
134
|
+
switch (tag) {
|
|
135
|
+
case "path":
|
|
136
|
+
return h.path.attrs(attrs);
|
|
137
|
+
case "circle":
|
|
138
|
+
return h.circle.attrs(attrs);
|
|
139
|
+
case "ellipse":
|
|
140
|
+
return h.ellipse.attrs(attrs);
|
|
141
|
+
case "line":
|
|
142
|
+
return h.line.attrs(attrs);
|
|
143
|
+
case "polyline":
|
|
144
|
+
return h.polyline.attrs(attrs);
|
|
145
|
+
case "polygon":
|
|
146
|
+
return h.polygon.attrs(attrs);
|
|
147
|
+
case "rect":
|
|
148
|
+
return h.rect.attrs(attrs);
|
|
149
|
+
default:
|
|
150
|
+
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
var Check = createLucideIcon(check);
|
|
154
|
+
var ArrowDown = createLucideIcon(arrowDown);
|
|
155
|
+
var ArrowUp = createLucideIcon(arrowUp);
|
|
156
|
+
var ListFilter = createLucideIcon(listFilter);
|
|
157
|
+
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
158
|
+
var ChevronDown = createLucideIcon(chevronDown);
|
|
159
|
+
var ChevronRight = createLucideIcon(chevronRight);
|
|
160
|
+
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
161
|
+
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
162
|
+
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
163
|
+
var Copy = createLucideIcon(copy);
|
|
164
|
+
var Download = createLucideIcon(download);
|
|
165
|
+
var Eye = createLucideIcon(eye);
|
|
166
|
+
var EyeOff = createLucideIcon(eyeOff);
|
|
167
|
+
var Ellipsis = createLucideIcon(ellipsis);
|
|
168
|
+
var FileJson = createLucideIcon(fileJson);
|
|
169
|
+
var FileText = createLucideIcon(fileText);
|
|
170
|
+
var GripVertical = createLucideIcon(gripVertical);
|
|
171
|
+
var Image = createLucideIcon(image);
|
|
172
|
+
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
173
|
+
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
174
|
+
var Mail = createLucideIcon(mail);
|
|
175
|
+
var Paperclip = createLucideIcon(paperclip);
|
|
176
|
+
var RefreshCw = createLucideIcon(refreshCw);
|
|
177
|
+
var RotateCcw = createLucideIcon(rotateCcw);
|
|
178
|
+
var Rows3 = createLucideIcon(rows3);
|
|
179
|
+
var Search = createLucideIcon(search);
|
|
180
|
+
var Settings2 = createLucideIcon(settings2);
|
|
181
|
+
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
182
|
+
var X = createLucideIcon(x);
|
|
183
|
+
|
|
184
|
+
// ../../src/components/map-menu/classes.ts
|
|
185
|
+
var mapMenuClasses = {
|
|
186
|
+
resultTitle: "block text-sm font-medium wrap-anywhere",
|
|
187
|
+
resultDescription: "text-muted-foreground mt-1 block text-xs wrap-anywhere",
|
|
188
|
+
status: "text-muted-foreground p-3 text-sm",
|
|
189
|
+
error: "text-destructive p-3 text-sm"
|
|
190
|
+
};
|
|
191
|
+
var resolveMapMenuClasses = (overrides) => ({
|
|
192
|
+
...mapMenuClasses,
|
|
193
|
+
...overrides
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// ../../src/components/map-menu/google-viewport.ts
|
|
197
|
+
import { Effect, Queue, Stream } from "effect";
|
|
198
|
+
|
|
199
|
+
// ../../src/components/map-menu/google-maps.ts
|
|
200
|
+
var scriptId = "krak-stack-google-maps-script";
|
|
201
|
+
var callback = "__krakStackGoogleMapsInit";
|
|
202
|
+
var loads = new WeakMap;
|
|
203
|
+
var ready = (api) => Boolean(api?.maps?.Map && api.maps.Marker && api.maps.Circle && api.maps.event);
|
|
204
|
+
var loadGoogleMaps = (document, apiKey) => {
|
|
205
|
+
const window = document.defaultView;
|
|
206
|
+
if (!window)
|
|
207
|
+
return Promise.reject(new Error("Google Maps requires a browser."));
|
|
208
|
+
if (ready(window.google))
|
|
209
|
+
return Promise.resolve(window.google);
|
|
210
|
+
const previous = loads.get(document);
|
|
211
|
+
if (previous)
|
|
212
|
+
return previous;
|
|
213
|
+
const promise = new Promise((resolve, reject) => {
|
|
214
|
+
const existing = document.getElementById(scriptId);
|
|
215
|
+
const created = document.createElement("script");
|
|
216
|
+
const script = existing ?? created;
|
|
217
|
+
const cleanup = () => {
|
|
218
|
+
window.clearTimeout(timeout);
|
|
219
|
+
script.removeEventListener("error", failed);
|
|
220
|
+
script.removeEventListener("load", loaded);
|
|
221
|
+
window.__krakStackGoogleMapsInit = undefined;
|
|
222
|
+
};
|
|
223
|
+
const failed = () => {
|
|
224
|
+
cleanup();
|
|
225
|
+
script.remove();
|
|
226
|
+
reject(new Error("Google Maps failed to load."));
|
|
227
|
+
};
|
|
228
|
+
const initialized = () => {
|
|
229
|
+
if (!ready(window.google))
|
|
230
|
+
return failed();
|
|
231
|
+
cleanup();
|
|
232
|
+
resolve(window.google);
|
|
233
|
+
};
|
|
234
|
+
const loaded = () => {
|
|
235
|
+
if (ready(window.google))
|
|
236
|
+
initialized();
|
|
237
|
+
};
|
|
238
|
+
const timeout = window.setTimeout(failed, 30000);
|
|
239
|
+
window.__krakStackGoogleMapsInit = initialized;
|
|
240
|
+
script.addEventListener("error", failed);
|
|
241
|
+
script.addEventListener("load", loaded);
|
|
242
|
+
if (!existing) {
|
|
243
|
+
created.id = scriptId;
|
|
244
|
+
created.async = true;
|
|
245
|
+
created.src = `https://maps.googleapis.com/maps/api/js?key=${encodeURIComponent(apiKey)}&loading=async&callback=${callback}`;
|
|
246
|
+
document.head.append(created);
|
|
247
|
+
}
|
|
248
|
+
}).catch((error) => {
|
|
249
|
+
loads.delete(document);
|
|
250
|
+
throw error;
|
|
251
|
+
});
|
|
252
|
+
loads.set(document, promise);
|
|
253
|
+
return promise;
|
|
254
|
+
};
|
|
255
|
+
var clampZoom = (zoom, min, max) => Math.min(max, Math.max(min, zoom));
|
|
256
|
+
var mapOptions = (center, zoom, interactive, minZoom, maxZoom) => ({
|
|
257
|
+
center,
|
|
258
|
+
zoom: clampZoom(zoom, minZoom, maxZoom),
|
|
259
|
+
clickableIcons: interactive,
|
|
260
|
+
disableDefaultUI: true,
|
|
261
|
+
draggable: interactive,
|
|
262
|
+
fullscreenControl: false,
|
|
263
|
+
gestureHandling: interactive ? "auto" : "none",
|
|
264
|
+
keyboardShortcuts: interactive,
|
|
265
|
+
mapTypeControl: false,
|
|
266
|
+
maxZoom,
|
|
267
|
+
minZoom,
|
|
268
|
+
scrollwheel: interactive,
|
|
269
|
+
streetViewControl: false,
|
|
270
|
+
zoomControl: false
|
|
271
|
+
});
|
|
272
|
+
var mapPinIcon = (color) => `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="40" height="48" viewBox="0 0 40 48"><path d="M20 46s15-14.3 15-27A15 15 0 1 0 5 19c0 12.7 15 27 15 27Z" fill="${color.replace(/[&"'<>]/g, "")}" stroke="white" stroke-width="3"/><circle cx="20" cy="19" r="6" fill="white"/></svg>`)}`;
|
|
273
|
+
|
|
274
|
+
// ../../src/components/map-menu/google-viewport.ts
|
|
275
|
+
var origin = { lat: 0, lng: 0 };
|
|
276
|
+
var mapZoomBounds = { min: 3, max: 18 };
|
|
277
|
+
var failure = (reason) => ({
|
|
278
|
+
_tag: "MapViewportFailure",
|
|
279
|
+
reason
|
|
280
|
+
});
|
|
281
|
+
var createViewport = (element, api, status, zoom) => {
|
|
282
|
+
const window = element.ownerDocument.defaultView;
|
|
283
|
+
const { Map, Marker, Circle, event } = api.maps;
|
|
284
|
+
const { min, max } = mapZoomBounds;
|
|
285
|
+
const map = new Map(element, mapOptions(origin, 4, true, min, max));
|
|
286
|
+
let marker;
|
|
287
|
+
let circle;
|
|
288
|
+
let viewport;
|
|
289
|
+
let frame = 0;
|
|
290
|
+
const fit = () => {
|
|
291
|
+
const bounds = circle?.getBounds()?.toJSON();
|
|
292
|
+
if (bounds && element.clientWidth && element.clientHeight)
|
|
293
|
+
map.fitBounds(bounds, 40);
|
|
294
|
+
};
|
|
295
|
+
const attempt = (action) => {
|
|
296
|
+
try {
|
|
297
|
+
action();
|
|
298
|
+
} catch {
|
|
299
|
+
Queue.offerUnsafe(status, failure("load"));
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const scheduleFit = () => {
|
|
303
|
+
window.cancelAnimationFrame(frame);
|
|
304
|
+
frame = window.requestAnimationFrame(() => {
|
|
305
|
+
frame = window.requestAnimationFrame(() => attempt(fit));
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
let width = element.clientWidth;
|
|
309
|
+
let height = element.clientHeight;
|
|
310
|
+
const observer = globalThis.ResizeObserver === undefined ? undefined : new ResizeObserver(() => {
|
|
311
|
+
if (width === element.clientWidth && height === element.clientHeight)
|
|
312
|
+
return;
|
|
313
|
+
width = element.clientWidth;
|
|
314
|
+
height = element.clientHeight;
|
|
315
|
+
if (circle)
|
|
316
|
+
scheduleFit();
|
|
317
|
+
});
|
|
318
|
+
observer?.observe(element);
|
|
319
|
+
const reportZoom = () => Queue.offerUnsafe(zoom, map.getZoom() ?? 4);
|
|
320
|
+
const zoomListener = event.addListener(map, "zoom_changed", reportZoom);
|
|
321
|
+
reportZoom();
|
|
322
|
+
Queue.offerUnsafe(status, "ready");
|
|
323
|
+
const host = {
|
|
324
|
+
status: Stream.fromQueue(status),
|
|
325
|
+
zoomChanges: Stream.fromQueue(zoom),
|
|
326
|
+
update: (next) => Effect.sync(() => attempt(() => {
|
|
327
|
+
const centerChanged = viewport?.center?.lat !== next.center?.lat || viewport?.center?.lng !== next.center?.lng;
|
|
328
|
+
const radiusChanged = viewport?.radiusKm !== next.radiusKm;
|
|
329
|
+
const colorChanged = viewport?.overlayColor !== next.overlayColor;
|
|
330
|
+
if (viewport && !centerChanged && !radiusChanged && !colorChanged)
|
|
331
|
+
return;
|
|
332
|
+
viewport = next;
|
|
333
|
+
const { center, radiusKm, overlayColor } = next;
|
|
334
|
+
if (centerChanged || radiusChanged) {
|
|
335
|
+
map.setCenter(center ?? origin);
|
|
336
|
+
if (!center || radiusKm === null)
|
|
337
|
+
map.setZoom(center ? 15 : 4);
|
|
338
|
+
}
|
|
339
|
+
if (center) {
|
|
340
|
+
if (!marker)
|
|
341
|
+
marker = new Marker({
|
|
342
|
+
map,
|
|
343
|
+
position: center,
|
|
344
|
+
icon: mapPinIcon(overlayColor)
|
|
345
|
+
});
|
|
346
|
+
else {
|
|
347
|
+
if (centerChanged)
|
|
348
|
+
marker.setPosition(center);
|
|
349
|
+
if (colorChanged)
|
|
350
|
+
marker.setIcon(mapPinIcon(overlayColor));
|
|
351
|
+
}
|
|
352
|
+
} else if (marker) {
|
|
353
|
+
marker.setMap(null);
|
|
354
|
+
event.clearInstanceListeners(marker);
|
|
355
|
+
marker = undefined;
|
|
356
|
+
}
|
|
357
|
+
if (center && radiusKm !== null) {
|
|
358
|
+
const style = {
|
|
359
|
+
fillColor: overlayColor,
|
|
360
|
+
fillOpacity: 0.12,
|
|
361
|
+
strokeColor: overlayColor,
|
|
362
|
+
strokeOpacity: 0.82,
|
|
363
|
+
strokeWeight: 2
|
|
364
|
+
};
|
|
365
|
+
if (!circle)
|
|
366
|
+
circle = new Circle({
|
|
367
|
+
...style,
|
|
368
|
+
map,
|
|
369
|
+
center,
|
|
370
|
+
radius: radiusKm * 1000,
|
|
371
|
+
clickable: false
|
|
372
|
+
});
|
|
373
|
+
else {
|
|
374
|
+
if (centerChanged)
|
|
375
|
+
circle.setCenter(center);
|
|
376
|
+
if (radiusChanged)
|
|
377
|
+
circle.setRadius(radiusKm * 1000);
|
|
378
|
+
if (colorChanged)
|
|
379
|
+
circle.setOptions(style);
|
|
380
|
+
}
|
|
381
|
+
if (centerChanged || radiusChanged)
|
|
382
|
+
scheduleFit();
|
|
383
|
+
} else if (circle) {
|
|
384
|
+
circle.setMap(null);
|
|
385
|
+
event.clearInstanceListeners(circle);
|
|
386
|
+
circle = undefined;
|
|
387
|
+
window.cancelAnimationFrame(frame);
|
|
388
|
+
}
|
|
389
|
+
})),
|
|
390
|
+
zoom: (direction) => Effect.sync(() => attempt(() => {
|
|
391
|
+
map.setZoom(clampZoom((map.getZoom() ?? 4) + (direction === "in" ? 1 : -1), min, max));
|
|
392
|
+
})),
|
|
393
|
+
fitSelection: Effect.sync(() => attempt(fit))
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
host,
|
|
397
|
+
close: () => {
|
|
398
|
+
window.cancelAnimationFrame(frame);
|
|
399
|
+
observer?.disconnect();
|
|
400
|
+
zoomListener.remove();
|
|
401
|
+
if (marker) {
|
|
402
|
+
marker.setMap(null);
|
|
403
|
+
event.clearInstanceListeners(marker);
|
|
404
|
+
}
|
|
405
|
+
if (circle) {
|
|
406
|
+
circle.setMap(null);
|
|
407
|
+
event.clearInstanceListeners(circle);
|
|
408
|
+
}
|
|
409
|
+
event.clearInstanceListeners(map);
|
|
410
|
+
element.replaceChildren();
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
var googleMapsViewport = (browserKey) => ({
|
|
415
|
+
mount: (element) => Effect.gen(function* () {
|
|
416
|
+
const apiKey = browserKey.trim();
|
|
417
|
+
if (!apiKey)
|
|
418
|
+
return yield* Effect.fail(failure("configuration"));
|
|
419
|
+
const api = yield* Effect.tryPromise({
|
|
420
|
+
try: () => loadGoogleMaps(element.ownerDocument, apiKey),
|
|
421
|
+
catch: () => failure("load")
|
|
422
|
+
});
|
|
423
|
+
const status = yield* Queue.sliding(1);
|
|
424
|
+
const zoom = yield* Queue.sliding(1);
|
|
425
|
+
const resource = yield* Effect.acquireRelease(Effect.try({
|
|
426
|
+
try: () => createViewport(element, api, status, zoom),
|
|
427
|
+
catch: () => {
|
|
428
|
+
element.replaceChildren();
|
|
429
|
+
return failure("load");
|
|
430
|
+
}
|
|
431
|
+
}), ({ close }) => Effect.sync(close));
|
|
432
|
+
return resource.host;
|
|
433
|
+
})
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// ../../src/components/map-menu/index.ts
|
|
437
|
+
import { Effect as Effect2, Redacted, Schema as Schema2 } from "effect";
|
|
438
|
+
import { Command, Component, UiSchema } from "effect/ui";
|
|
439
|
+
|
|
440
|
+
// ../../src/components/map-menu/schema.ts
|
|
441
|
+
import { Schema, Struct } from "effect";
|
|
442
|
+
var MapMenuMode;
|
|
443
|
+
((MapMenuMode) => {
|
|
444
|
+
MapMenuMode["Point"] = "point";
|
|
445
|
+
MapMenuMode["Radius"] = "radius";
|
|
446
|
+
})(MapMenuMode ||= {});
|
|
447
|
+
var MapMenuPresentation;
|
|
448
|
+
((MapMenuPresentation) => {
|
|
449
|
+
MapMenuPresentation["Dialog"] = "dialog";
|
|
450
|
+
MapMenuPresentation["Inline"] = "inline";
|
|
451
|
+
})(MapMenuPresentation ||= {});
|
|
452
|
+
var messageKeys = [
|
|
453
|
+
"title",
|
|
454
|
+
"location",
|
|
455
|
+
"placeholder",
|
|
456
|
+
"clear",
|
|
457
|
+
"close",
|
|
458
|
+
"currentLocation",
|
|
459
|
+
"searchWithin",
|
|
460
|
+
"suggestions",
|
|
461
|
+
"loading",
|
|
462
|
+
"noResults",
|
|
463
|
+
"searchHint",
|
|
464
|
+
"ipNotice",
|
|
465
|
+
"browserNotice",
|
|
466
|
+
"radiusHint",
|
|
467
|
+
"cancel",
|
|
468
|
+
"confirm",
|
|
469
|
+
"confirmError"
|
|
470
|
+
];
|
|
471
|
+
var MapMenuMessagesSchema = Schema.Record(Schema.Literals(messageKeys), Schema.String);
|
|
472
|
+
var Translations = Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Record(Schema.Literals(messageKeys), Schema.optionalKey(Schema.String))));
|
|
473
|
+
var MapMenuPointSchema = Schema.Struct({
|
|
474
|
+
lat: Schema.Finite,
|
|
475
|
+
lng: Schema.Finite
|
|
476
|
+
}).annotate({ identifier: "MapMenuPoint" });
|
|
477
|
+
var MapMenuLocationSchema = Schema.Struct({
|
|
478
|
+
id: Schema.String,
|
|
479
|
+
label: Schema.String,
|
|
480
|
+
title: Schema.optional(Schema.String),
|
|
481
|
+
details: Schema.optional(Schema.String),
|
|
482
|
+
center: MapMenuPointSchema
|
|
483
|
+
}).annotate({ identifier: "MapMenuLocation" });
|
|
484
|
+
var MapMenuClassesOverridesSchema = Schema.Record(Schema.Literals(Struct.keys(mapMenuClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "MapMenuClassesOverrides" });
|
|
485
|
+
var MapMenuSharedPropsSchema = Schema.Struct({
|
|
486
|
+
classes: Schema.optional(MapMenuClassesOverridesSchema),
|
|
487
|
+
input: Schema.String,
|
|
488
|
+
selectedLocation: Schema.NullOr(MapMenuLocationSchema),
|
|
489
|
+
suggestions: Schema.Array(MapMenuLocationSchema),
|
|
490
|
+
locating: Schema.optional(Schema.Boolean),
|
|
491
|
+
loadingSuggestions: Schema.optional(Schema.Boolean),
|
|
492
|
+
suggestionsError: Schema.optional(Schema.String),
|
|
493
|
+
error: Schema.optional(Schema.String),
|
|
494
|
+
provenance: Schema.optional(Schema.Literals(["ip", "browser"])),
|
|
495
|
+
overlayColor: Schema.optional(Schema.String),
|
|
496
|
+
className: Schema.optional(Schema.String),
|
|
497
|
+
confirmClassName: Schema.optional(Schema.String),
|
|
498
|
+
locale: Schema.optional(Schema.String),
|
|
499
|
+
messages: Schema.optional(Translations)
|
|
500
|
+
}).annotate({ identifier: "MapMenuSharedProps" });
|
|
501
|
+
var MapMenuViewportSchema = Schema.Struct({
|
|
502
|
+
center: Schema.NullOr(MapMenuPointSchema),
|
|
503
|
+
radiusKm: Schema.NullOr(Schema.Finite),
|
|
504
|
+
overlayColor: Schema.String
|
|
505
|
+
}).annotate({ identifier: "MapMenuViewport" });
|
|
506
|
+
var MapMenuBrowserKey = Schema.Redacted(Schema.String, {
|
|
507
|
+
disallowJsonEncode: true
|
|
508
|
+
});
|
|
509
|
+
var MapMenuHtmlPropsSchema = Schema.Struct({
|
|
510
|
+
...MapMenuSharedPropsSchema.fields,
|
|
511
|
+
apiKey: Schema.optional(MapMenuBrowserKey),
|
|
512
|
+
mode: Schema.optional(Schema.Enum(MapMenuMode)),
|
|
513
|
+
presentation: Schema.optional(Schema.Enum(MapMenuPresentation)),
|
|
514
|
+
open: Schema.optional(Schema.Boolean),
|
|
515
|
+
radiusKm: Schema.optional(Schema.Finite.check(Schema.isGreaterThan(0))),
|
|
516
|
+
radiusOptions: Schema.optional(Schema.Array(Schema.Finite.check(Schema.isGreaterThan(0)))),
|
|
517
|
+
canUseCurrentLocation: Schema.optional(Schema.Boolean)
|
|
518
|
+
}).annotate({ identifier: "MapMenuHtmlProps" });
|
|
519
|
+
var MapMenuSelectionSchema = Schema.Struct({
|
|
520
|
+
location: MapMenuLocationSchema,
|
|
521
|
+
radiusKm: Schema.optionalKey(Schema.Finite)
|
|
522
|
+
}).annotate({ identifier: "MapMenuSelection" });
|
|
523
|
+
|
|
524
|
+
// ../../src/components/map-menu/index.ts
|
|
525
|
+
var mapMenuSelectionMatches = ({
|
|
526
|
+
selectedLocation,
|
|
527
|
+
input
|
|
528
|
+
}) => selectedLocation?.label === input.trim();
|
|
529
|
+
var mapMenuRadiiKm = [
|
|
530
|
+
1,
|
|
531
|
+
2,
|
|
532
|
+
5,
|
|
533
|
+
10,
|
|
534
|
+
20,
|
|
535
|
+
40,
|
|
536
|
+
50,
|
|
537
|
+
60,
|
|
538
|
+
80,
|
|
539
|
+
100,
|
|
540
|
+
250,
|
|
541
|
+
500
|
|
542
|
+
];
|
|
543
|
+
var labels = {
|
|
544
|
+
en: {
|
|
545
|
+
title: "Choose your location",
|
|
546
|
+
location: "City or address",
|
|
547
|
+
placeholder: "Search a city or address…",
|
|
548
|
+
clear: "Clear location",
|
|
549
|
+
close: "Close",
|
|
550
|
+
currentLocation: "Use my location",
|
|
551
|
+
searchWithin: "Search within",
|
|
552
|
+
suggestions: "Location suggestions",
|
|
553
|
+
loading: "Finding matching places…",
|
|
554
|
+
noResults: "No matching places. Try a city or address.",
|
|
555
|
+
searchHint: "Search for a place and choose a suggestion to preview it on the map.",
|
|
556
|
+
ipNotice: "Using your approximate location from your IP address.",
|
|
557
|
+
browserNotice: "Using your browser location.",
|
|
558
|
+
radiusHint: "The circle shows your search area.",
|
|
559
|
+
cancel: "Cancel",
|
|
560
|
+
confirm: "Use this location",
|
|
561
|
+
confirmError: "Your location could not be saved. Try again."
|
|
562
|
+
},
|
|
563
|
+
fr: {
|
|
564
|
+
title: "Choisir votre lieu",
|
|
565
|
+
location: "Ville ou adresse",
|
|
566
|
+
placeholder: "Rechercher une ville ou une adresse…",
|
|
567
|
+
clear: "Effacer le lieu",
|
|
568
|
+
close: "Fermer",
|
|
569
|
+
currentLocation: "Utiliser ma position",
|
|
570
|
+
searchWithin: "Rechercher dans un rayon de",
|
|
571
|
+
suggestions: "Suggestions de lieux",
|
|
572
|
+
loading: "Recherche de lieux…",
|
|
573
|
+
noResults: "Aucun lieu correspondant. Essayez une ville ou une adresse.",
|
|
574
|
+
searchHint: "Recherchez un lieu et choisissez une suggestion pour le voir sur la carte.",
|
|
575
|
+
ipNotice: "Position approximative obtenue à partir de votre adresse IP.",
|
|
576
|
+
browserNotice: "Position fournie par votre navigateur.",
|
|
577
|
+
radiusHint: "Le cercle indique votre zone de recherche.",
|
|
578
|
+
cancel: "Annuler",
|
|
579
|
+
confirm: "Utiliser ce lieu",
|
|
580
|
+
confirmError: "Votre lieu n’a pas pu être enregistré. Réessayez."
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var mapMenuMessages = (locale = "en", messages) => {
|
|
584
|
+
const base = locale.split("-")[0] ?? locale;
|
|
585
|
+
return {
|
|
586
|
+
...base === "fr" ? labels.fr : labels.en,
|
|
587
|
+
...messages?.[base],
|
|
588
|
+
...messages?.[locale]
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
var MapMenuEvent = UiSchema.TaggedEnum({
|
|
592
|
+
InputChanged: { input: Schema2.String },
|
|
593
|
+
LocationSelected: { location: MapMenuLocationSchema },
|
|
594
|
+
RadiusChanged: { radiusKm: Schema2.Finite },
|
|
595
|
+
CurrentLocationRequested: {},
|
|
596
|
+
OpenChanged: { open: Schema2.Boolean },
|
|
597
|
+
Cancelled: {},
|
|
598
|
+
Confirmed: {}
|
|
599
|
+
});
|
|
600
|
+
var CameraAction = Schema2.Literals(["in", "out", "fit"]);
|
|
601
|
+
var MapMenuMessage = UiSchema.TaggedEnum({
|
|
602
|
+
Edited: { input: Schema2.String },
|
|
603
|
+
SuggestionsOpened: {},
|
|
604
|
+
SuggestionsClosed: {},
|
|
605
|
+
Picked: { id: Schema2.String },
|
|
606
|
+
RadiusPicked: { radiusKm: Schema2.Finite },
|
|
607
|
+
Locate: {},
|
|
608
|
+
Cancel: {},
|
|
609
|
+
Confirm: {},
|
|
610
|
+
Finished: { success: Schema2.Boolean },
|
|
611
|
+
CameraRequested: { action: CameraAction },
|
|
612
|
+
MapStatus: {
|
|
613
|
+
status: Schema2.Literals(["loading", "ready", "configuration", "load"])
|
|
614
|
+
},
|
|
615
|
+
ZoomChanged: { zoom: Schema2.Finite }
|
|
616
|
+
});
|
|
617
|
+
var Selection = Schema2.Redacted(MapMenuSelectionSchema, {
|
|
618
|
+
disallowJsonEncode: true
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
class SaveMapSelection extends Command.Service()("map-menu/SaveSelection", { args: { selection: Selection }, success: MapMenuMessage }) {
|
|
622
|
+
static layerFromSave = (save) => SaveMapSelection.toLayer(({ selection }) => Effect2.suspend(() => save(Redacted.value(selection))).pipe(Effect2.match({
|
|
623
|
+
onSuccess: () => MapMenuMessage.Finished({ success: true }),
|
|
624
|
+
onFailure: () => MapMenuMessage.Finished({ success: false })
|
|
625
|
+
})));
|
|
626
|
+
}
|
|
627
|
+
var CameraRequest = Schema2.Struct({
|
|
628
|
+
action: CameraAction,
|
|
629
|
+
revision: Schema2.Int
|
|
630
|
+
});
|
|
631
|
+
var mapMenuOptions = {
|
|
632
|
+
name: "MapMenu",
|
|
633
|
+
props: MapMenuHtmlPropsSchema,
|
|
634
|
+
model: Schema2.Struct({
|
|
635
|
+
suggestionsOpen: Schema2.Boolean,
|
|
636
|
+
save: Schema2.Literals(["idle", "pending", "failed"]),
|
|
637
|
+
mapStatus: Schema2.Literals(["loading", "ready", "configuration", "load"]),
|
|
638
|
+
zoom: Schema2.NullOr(Schema2.Finite),
|
|
639
|
+
camera: Schema2.NullOr(CameraRequest)
|
|
640
|
+
}),
|
|
641
|
+
message: MapMenuMessage,
|
|
642
|
+
events: MapMenuEvent,
|
|
643
|
+
restore: false
|
|
644
|
+
};
|
|
645
|
+
var inline = (props) => props.presentation === "inline" /* Inline */;
|
|
646
|
+
var visible = (props) => inline(props) || props.open === true;
|
|
647
|
+
var mapMenuCanConfirm = (props) => visible(props) && !props.locating && mapMenuSelectionMatches(props) && (props.mode === "point" /* Point */ || props.radiusKm !== undefined);
|
|
648
|
+
var update = Component.define(mapMenuOptions).update({
|
|
649
|
+
Edited: ($, { input }) => $.model.save === "pending" ? $.model : $.evolve({
|
|
650
|
+
suggestionsOpen: Boolean(input.trim()),
|
|
651
|
+
save: "idle"
|
|
652
|
+
}).emit(MapMenuEvent.InputChanged({ input })),
|
|
653
|
+
SuggestionsOpened: ($) => $.model.save === "pending" ? $.model : $.evolve({ suggestionsOpen: true }),
|
|
654
|
+
SuggestionsClosed: ($) => $.evolve({ suggestionsOpen: false }),
|
|
655
|
+
Picked: ($, { id }) => {
|
|
656
|
+
if ($.model.save === "pending")
|
|
657
|
+
return $.model;
|
|
658
|
+
const location = $.props.suggestions.slice(0, 3).find((item) => item.id === id);
|
|
659
|
+
return location ? $.evolve({ suggestionsOpen: false, save: "idle" }).emit(MapMenuEvent.InputChanged({ input: location.label })).emit(MapMenuEvent.LocationSelected({ location })) : $.model;
|
|
660
|
+
},
|
|
661
|
+
RadiusPicked: ($, { radiusKm }) => $.model.save === "pending" || $.props.mode === "point" /* Point */ || !($.props.radiusOptions ?? mapMenuRadiiKm).includes(radiusKm) ? $.model : $.emit(MapMenuEvent.RadiusChanged({ radiusKm })),
|
|
662
|
+
Locate: ($) => $.model.save !== "pending" && $.props.canUseCurrentLocation && !$.props.locating ? $.evolve({ suggestionsOpen: false }).emit(MapMenuEvent.CurrentLocationRequested()) : $.model,
|
|
663
|
+
Cancel: ($) => $.model.save === "pending" ? $.model : $.evolve({ save: "idle", suggestionsOpen: false }).emit(inline($.props) ? MapMenuEvent.Cancelled() : MapMenuEvent.OpenChanged({ open: false })),
|
|
664
|
+
Confirm: ($) => {
|
|
665
|
+
const { selectedLocation, mode, radiusKm } = $.props;
|
|
666
|
+
if ($.model.save === "pending" || !selectedLocation || !mapMenuCanConfirm($.props))
|
|
667
|
+
return $.model;
|
|
668
|
+
const selection = mode === "point" /* Point */ || radiusKm === undefined ? { location: selectedLocation } : { location: selectedLocation, radiusKm };
|
|
669
|
+
return $.evolve({ save: "pending", suggestionsOpen: false }).run(SaveMapSelection.make({ selection: Redacted.make(selection) }));
|
|
670
|
+
},
|
|
671
|
+
Finished: ($, { success }) => {
|
|
672
|
+
if ($.model.save !== "pending")
|
|
673
|
+
return $.model;
|
|
674
|
+
if (!success)
|
|
675
|
+
return $.evolve({ save: "failed" });
|
|
676
|
+
const next = $.evolve({ save: "idle" }).emit(MapMenuEvent.Confirmed());
|
|
677
|
+
return inline($.props) ? next : next.emit(MapMenuEvent.OpenChanged({ open: false }));
|
|
678
|
+
},
|
|
679
|
+
CameraRequested: ($, { action }) => $.model.mapStatus === "ready" ? $.evolve({
|
|
680
|
+
camera: { action, revision: ($.model.camera?.revision ?? 0) + 1 }
|
|
681
|
+
}) : $.model,
|
|
682
|
+
MapStatus: ($, { status }) => $.evolve({
|
|
683
|
+
mapStatus: status,
|
|
684
|
+
zoom: status === "ready" ? $.model.zoom : null
|
|
685
|
+
}),
|
|
686
|
+
ZoomChanged: ($, { zoom }) => $.evolve({ zoom })
|
|
687
|
+
});
|
|
688
|
+
var mapMenuBehaviours = {
|
|
689
|
+
init: () => ({
|
|
690
|
+
suggestionsOpen: false,
|
|
691
|
+
save: "idle",
|
|
692
|
+
mapStatus: "loading",
|
|
693
|
+
zoom: null,
|
|
694
|
+
camera: null
|
|
695
|
+
}),
|
|
696
|
+
update
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// ../../src/components/map-menu/html.ts
|
|
700
|
+
var LocateIcon = createLucideIcon(LocateFixed);
|
|
701
|
+
var Pin = createLucideIcon(MapPin);
|
|
702
|
+
var ZoomIn = createLucideIcon(Plus);
|
|
703
|
+
var ZoomOut = createLucideIcon(Minus);
|
|
704
|
+
var SearchIcon = createLucideIcon(Search2);
|
|
705
|
+
var isOptionId = Schema3.is(Schema3.String);
|
|
706
|
+
var PreventSearchSubmit = Mount.make("MapMenu/PreventSearchSubmit", {}, (node) => {
|
|
707
|
+
const prevent = (event) => {
|
|
708
|
+
if (event.key === "Enter" && !event.isComposing)
|
|
709
|
+
event.preventDefault();
|
|
710
|
+
};
|
|
711
|
+
return Effect3.acquireRelease(Effect3.sync(() => node.addEventListener("keydown", prevent)), () => Effect3.sync(() => node.removeEventListener("keydown", prevent))).pipe(Effect3.andThen(Effect3.never));
|
|
712
|
+
});
|
|
713
|
+
var canvasCopy = {
|
|
714
|
+
en: {
|
|
715
|
+
map: "Google map",
|
|
716
|
+
loading: "Loading map...",
|
|
717
|
+
unavailable: "Map unavailable",
|
|
718
|
+
key: "Provide a Google Maps API key to display the map.",
|
|
719
|
+
failed: "Google Maps could not be loaded. Try again later.",
|
|
720
|
+
fit: "Show selected area",
|
|
721
|
+
in: "Zoom in",
|
|
722
|
+
out: "Zoom out"
|
|
723
|
+
},
|
|
724
|
+
fr: {
|
|
725
|
+
map: "Carte Google",
|
|
726
|
+
loading: "Chargement de la carte...",
|
|
727
|
+
unavailable: "Carte indisponible",
|
|
728
|
+
key: "Fournissez une clé d’API Google Maps pour afficher la carte.",
|
|
729
|
+
failed: "Impossible de charger Google Maps. Réessayez plus tard.",
|
|
730
|
+
fit: "Afficher la zone sélectionnée",
|
|
731
|
+
in: "Zoom avant",
|
|
732
|
+
out: "Zoom arrière"
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
var makeMapMenu = (viewportHost) => {
|
|
736
|
+
const Canvas = Mount.makeStream("MapMenu/Canvas", {
|
|
737
|
+
args: {
|
|
738
|
+
apiKey: Schema3.optional(MapMenuBrowserKey),
|
|
739
|
+
viewport: MapMenuViewportSchema,
|
|
740
|
+
camera: Schema3.NullOr(CameraRequest)
|
|
741
|
+
}
|
|
742
|
+
}, (node, _, changes) => changes.pipe(Stream2.changesWith((a, b) => viewportHost !== undefined || a.apiKey === b.apiKey || a.apiKey !== undefined && b.apiKey !== undefined && Redacted2.value(a.apiKey).trim() === Redacted2.value(b.apiKey).trim()), Stream2.switchMap(({ apiKey, camera }) => {
|
|
743
|
+
let revision = camera?.revision;
|
|
744
|
+
const host = viewportHost ?? googleMapsViewport(apiKey ? Redacted2.value(apiKey) : "");
|
|
745
|
+
return Stream2.succeed(MapMenuMessage.MapStatus({ status: "loading" })).pipe(Stream2.concat(Stream2.scoped(Stream2.unwrap(host.mount(node).pipe(Effect3.map((map) => {
|
|
746
|
+
const input = changes.pipe(Stream2.runForEach(({ viewport, camera }) => Effect3.gen(function* () {
|
|
747
|
+
yield* map.update(viewport);
|
|
748
|
+
if (!camera || camera.revision === revision)
|
|
749
|
+
return;
|
|
750
|
+
revision = camera.revision;
|
|
751
|
+
yield* camera.action === "fit" ? map.fitSelection : map.zoom(camera.action);
|
|
752
|
+
})));
|
|
753
|
+
return map.status.pipe(Stream2.map((status) => MapMenuMessage.MapStatus({
|
|
754
|
+
status: status === "ready" || status === "loading" ? status : status.reason
|
|
755
|
+
})), Stream2.merge(map.zoomChanges?.pipe(Stream2.map((zoom) => MapMenuMessage.ZoomChanged({ zoom }))) ?? Stream2.empty), Stream2.merge(Stream2.never), Stream2.mergeEffect(input));
|
|
756
|
+
}))))), Stream2.catch((error) => Stream2.succeed(MapMenuMessage.MapStatus({ status: error.reason }))));
|
|
757
|
+
})));
|
|
758
|
+
const ResponsiveViewport = Mount.make("MapMenu/VisualViewport", {}, (node) => Effect3.suspend(() => {
|
|
759
|
+
const viewport = node.ownerDocument.defaultView?.visualViewport;
|
|
760
|
+
if (!viewport)
|
|
761
|
+
return Effect3.never;
|
|
762
|
+
const sync = () => {
|
|
763
|
+
node.style.setProperty("--map-viewport-height", `${viewport.height}px`);
|
|
764
|
+
node.style.setProperty("--map-viewport-top", `${viewport.offsetTop}px`);
|
|
765
|
+
};
|
|
766
|
+
return Effect3.acquireRelease(Effect3.sync(() => {
|
|
767
|
+
sync();
|
|
768
|
+
viewport.addEventListener("resize", sync);
|
|
769
|
+
viewport.addEventListener("scroll", sync);
|
|
770
|
+
}), () => Effect3.sync(() => {
|
|
771
|
+
viewport.removeEventListener("resize", sync);
|
|
772
|
+
viewport.removeEventListener("scroll", sync);
|
|
773
|
+
})).pipe(Effect3.andThen(Effect3.never));
|
|
774
|
+
}));
|
|
775
|
+
return Html.component({
|
|
776
|
+
...mapMenuOptions,
|
|
777
|
+
reads: { locale: krakstackLocaleRead }
|
|
778
|
+
}).make({
|
|
779
|
+
...mapMenuBehaviours,
|
|
780
|
+
view: (h, model) => {
|
|
781
|
+
const mapMenuClasses = resolveMapMenuClasses(h.props.classes);
|
|
782
|
+
const props = h.props;
|
|
783
|
+
const locale = props.locale ?? h.reads.locale?.locale ?? "en";
|
|
784
|
+
const labels = mapMenuMessages(locale, props.messages);
|
|
785
|
+
const mapLabels = locale.split("-")[0] === "fr" ? canvasCopy.fr : canvasCopy.en;
|
|
786
|
+
const isInline = props.presentation === "inline" /* Inline */;
|
|
787
|
+
const radiusEnabled = props.mode !== "point" /* Point */;
|
|
788
|
+
const pending = model.save === "pending";
|
|
789
|
+
const radius = radiusEnabled && props.selectedLocation ? props.radiusKm ?? null : null;
|
|
790
|
+
const color = props.overlayColor ?? "#f56476";
|
|
791
|
+
const options = props.suggestions.slice(0, 3);
|
|
792
|
+
const id = h.id("location");
|
|
793
|
+
const notice = props.provenance === "ip" ? labels.ipNotice : props.provenance === "browser" ? labels.browserNotice : mapMenuSelectionMatches(props) ? undefined : labels.searchHint;
|
|
794
|
+
const cameraButton = (action, Icon, disabled = false) => Button(h, {
|
|
795
|
+
variant: "ghost",
|
|
796
|
+
class: "size-11 rounded-none",
|
|
797
|
+
props: { type: "button", disabled },
|
|
798
|
+
onPress: MapMenuMessage.CameraRequested({ action })
|
|
799
|
+
}).attrs({
|
|
800
|
+
"data-slot": "map-menu-control",
|
|
801
|
+
"aria-label": mapLabels[action],
|
|
802
|
+
title: mapLabels[action]
|
|
803
|
+
}).children(Icon(h, { size: 16 }));
|
|
804
|
+
const content = (focus, showCanvas) => h.div.class("flex min-h-0 flex-1 flex-col gap-4 overflow-auto").children(h.fieldset.attr("data-slot", "map-menu-toolbar").class("grid min-w-0 shrink-0 gap-3").children(h.div.class("flex min-w-0 flex-wrap items-end gap-3").children(h.div.class("grid min-w-0 flex-1 basis-64 gap-2").children(h.label.attr("for", id).class("text-sm font-medium").children(labels.location), Combobox(h, {
|
|
805
|
+
props: {
|
|
806
|
+
id,
|
|
807
|
+
open: model.suggestionsOpen && !pending,
|
|
808
|
+
inputValue: props.input,
|
|
809
|
+
value: props.selectedLocation?.id ?? null,
|
|
810
|
+
filter: "none",
|
|
811
|
+
disabled: pending,
|
|
812
|
+
openOnInputClick: Boolean(props.input.trim() && !mapMenuSelectionMatches(props)),
|
|
813
|
+
items: options.map((location) => ({
|
|
814
|
+
value: location.id,
|
|
815
|
+
label: location.label
|
|
816
|
+
})),
|
|
817
|
+
sideOffset: 4
|
|
818
|
+
},
|
|
819
|
+
onEmit: {
|
|
820
|
+
RequestedOpen: ({ reason }) => reason !== "input-change" ? MapMenuMessage.SuggestionsOpened() : undefined,
|
|
821
|
+
RequestedClose: () => MapMenuMessage.SuggestionsClosed(),
|
|
822
|
+
RequestedInputValue: ({ inputValue, reason }) => reason === "input-change" || reason === "clear-press" ? MapMenuMessage.Edited({ input: inputValue }) : undefined,
|
|
823
|
+
Picked: ({ value }) => isOptionId(value) ? MapMenuMessage.Picked({ id: value }) : undefined,
|
|
824
|
+
Highlighted: () => {
|
|
825
|
+
return;
|
|
826
|
+
},
|
|
827
|
+
Settled: () => {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
view: (box) => h.div(box.inputGroup(h.div.class("flex min-h-8.5 w-full items-center rounded-md border border-input bg-background pe-1 shadow-sm transition-[border-color,box-shadow] duration-150 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/15 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50")).children(SearchIcon(h, {
|
|
832
|
+
size: 16,
|
|
833
|
+
className: "ms-3 shrink-0 text-muted-foreground"
|
|
834
|
+
}), box.input(h.input.onMount(PreventSearchSubmit({})).attrs({
|
|
835
|
+
placeholder: labels.placeholder,
|
|
836
|
+
autocomplete: "off",
|
|
837
|
+
autofocus: focus ? "" : undefined
|
|
838
|
+
}).class("h-8 min-w-0 flex-1 bg-transparent px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed")), ComboboxClear(h, box)?.attr("aria-label", labels.clear)?.children(X(h, { size: 16 }))), ComboboxPositioner(h, box).children(ComboboxPopup(h, box).children(box.list(h.div.class("min-h-0 flex-1 scroll-py-1 overflow-y-auto p-1 outline-none data-[empty]:p-0").attrs({
|
|
839
|
+
"aria-label": labels.suggestions,
|
|
840
|
+
"aria-busy": props.loadingSuggestions ? "true" : undefined
|
|
841
|
+
})).children(box.items.map(({ value, label }) => {
|
|
842
|
+
const place = options.find(({ id }) => id === value);
|
|
843
|
+
return ComboboxItem(h, box, {
|
|
844
|
+
class: "justify-start text-start",
|
|
845
|
+
value
|
|
846
|
+
}).attr("aria-label", label).children(Pin(h, {
|
|
847
|
+
size: 16,
|
|
848
|
+
color,
|
|
849
|
+
className: "shrink-0"
|
|
850
|
+
}), h.span.class("min-w-0").children(h.span.class(mapMenuClasses.resultTitle).children(place?.title ?? label), place?.details && h.span.class(mapMenuClasses.resultDescription).children(place.details)));
|
|
851
|
+
})), props.loadingSuggestions ? h.p.attr("role", "status").class(mapMenuClasses.status).children(labels.loading) : props.suggestionsError ? h.p.attr("role", "alert").class(mapMenuClasses.error).children(props.suggestionsError) : ComboboxEmpty(h, box).children(labels.noResults))))
|
|
852
|
+
})), props.canUseCurrentLocation && Button(h, {
|
|
853
|
+
variant: "outline",
|
|
854
|
+
props: {
|
|
855
|
+
type: "button",
|
|
856
|
+
disabled: pending || props.locating
|
|
857
|
+
},
|
|
858
|
+
onPress: MapMenuMessage.Locate()
|
|
859
|
+
}).attr("data-slot", "map-menu-current").children(LocateIcon(h, { size: 16 }), labels.currentLocation)), notice && h.p.attrs({
|
|
860
|
+
role: "status",
|
|
861
|
+
"data-slot": "map-menu-provenance"
|
|
862
|
+
}).class("flex items-start gap-2 text-xs text-muted-foreground").children(Pin(h, { size: 16 }), notice), radiusEnabled && h.label.class("flex items-center gap-3 text-sm font-medium").children(labels.searchWithin, h.select.class(inputVariants({
|
|
863
|
+
class: "w-auto disabled:opacity-50"
|
|
864
|
+
})).disabled(pending).value(String(props.radiusKm ?? "")).on("change", ({ value }) => MapMenuMessage.RadiusPicked({ radiusKm: Number(value) })).children((props.radiusOptions ?? mapMenuRadiiKm).map((option) => h.option.key(String(option)).attr("value", String(option)).children(`${option} Km`))))), showCanvas && h.div.attr("data-slot", "map-menu-map").class(isInline ? "relative h-80 shrink-0 sm:h-96" : "relative min-h-56 flex-1 basis-56").children(h.div.attr("data-slot", "map-menu-renderer").class("relative isolate h-full min-w-0 overflow-hidden rounded-md border bg-muted").children(h.div.attrs({
|
|
865
|
+
"data-slot": "map-menu-canvas",
|
|
866
|
+
role: "region",
|
|
867
|
+
"aria-label": mapLabels.map
|
|
868
|
+
}).class("h-full w-full").onMount(Canvas({
|
|
869
|
+
apiKey: props.apiKey,
|
|
870
|
+
viewport: {
|
|
871
|
+
center: props.selectedLocation?.center ?? null,
|
|
872
|
+
radiusKm: radius,
|
|
873
|
+
overlayColor: color
|
|
874
|
+
},
|
|
875
|
+
camera: model.camera
|
|
876
|
+
})), model.mapStatus === "ready" && h.div.attr("data-slot", "map-menu-controls").class("absolute top-3 right-3 z-10 grid divide-y overflow-hidden rounded-md border bg-card shadow-md").children(radius !== null && cameraButton("fit", LocateIcon), cameraButton("in", ZoomIn, model.zoom !== null && model.zoom >= mapZoomBounds.max), cameraButton("out", ZoomOut, model.zoom !== null && model.zoom <= mapZoomBounds.min)), model.mapStatus === "loading" && h.div.attr("role", "status").class("absolute inset-0 grid place-items-center bg-background/75 text-sm text-muted-foreground").children(mapLabels.loading), (model.mapStatus === "configuration" || model.mapStatus === "load") && h.div.attr("role", "alert").class("absolute inset-0 grid place-content-center gap-2 bg-background/85 p-6 text-center").children(h.strong.children(mapLabels.unavailable), h.p.class("text-xs text-muted-foreground").children(model.mapStatus === "configuration" ? mapLabels.key : mapLabels.failed)), radius !== null && h.p.class("pointer-events-none absolute bottom-7 left-3 rounded bg-card px-2.5 py-1.5 text-xs text-muted-foreground shadow-sm").children(labels.radiusHint))), h.div.class("flex shrink-0 flex-wrap items-center justify-end gap-2").children((props.error || model.save === "failed") && h.p.attr("role", "alert").class("me-auto text-sm text-destructive").children(props.error ?? labels.confirmError), Button(h, {
|
|
877
|
+
variant: "outline",
|
|
878
|
+
class: "min-h-11",
|
|
879
|
+
props: { type: "button", disabled: pending },
|
|
880
|
+
onPress: MapMenuMessage.Cancel()
|
|
881
|
+
}).children(labels.cancel), Button(h, {
|
|
882
|
+
class: `min-h-11 ${props.confirmClassName ?? ""}`,
|
|
883
|
+
loading: pending,
|
|
884
|
+
props: {
|
|
885
|
+
type: "button",
|
|
886
|
+
disabled: pending || !mapMenuCanConfirm(props)
|
|
887
|
+
},
|
|
888
|
+
onPress: MapMenuMessage.Confirm()
|
|
889
|
+
}).attr("data-slot", "map-menu-confirm").children(labels.confirm)));
|
|
890
|
+
if (isInline)
|
|
891
|
+
return h.section.attrs({
|
|
892
|
+
role: "group",
|
|
893
|
+
"aria-label": labels.title,
|
|
894
|
+
"data-slot": "map-menu",
|
|
895
|
+
"data-presentation": "inline"
|
|
896
|
+
}).class(`min-w-0 ${props.className ?? ""}`).children(content(false, true));
|
|
897
|
+
return Dialog(h, {
|
|
898
|
+
props: { open: props.open === true, disablePointerDismissal: pending },
|
|
899
|
+
onEmit: {
|
|
900
|
+
RequestedOpen: () => {
|
|
901
|
+
return;
|
|
902
|
+
},
|
|
903
|
+
RequestedClose: () => model.suggestionsOpen ? MapMenuMessage.SuggestionsClosed() : MapMenuMessage.Cancel(),
|
|
904
|
+
Settled: () => {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
view: (dialog) => h.div(dialog.portal(h.div)?.children(DialogBackdrop(h, dialog), DialogViewport(h, dialog, {
|
|
909
|
+
class: "top-[var(--map-viewport-top,0px)] bottom-auto h-[var(--map-viewport-height,100dvh)] p-0 sm:p-6"
|
|
910
|
+
}).onMount(ResponsiveViewport({})).children(DialogPopup(h, dialog, {
|
|
911
|
+
class: `h-full max-w-none rounded-none bg-muted sm:h-[min(46.75rem,100%)] sm:max-w-[840px] sm:rounded-lg ${props.className ?? ""}`
|
|
912
|
+
}).attrs({
|
|
913
|
+
"data-slot": "map-menu",
|
|
914
|
+
"data-presentation": "dialog"
|
|
915
|
+
}).children(h.div.class("flex shrink-0 items-center justify-between gap-3").children(DialogTitle(h, dialog).children(labels.title), Button(h, {
|
|
916
|
+
variant: "ghost",
|
|
917
|
+
class: "size-11",
|
|
918
|
+
props: { type: "button", disabled: pending },
|
|
919
|
+
onPress: MapMenuMessage.Cancel()
|
|
920
|
+
}).attr("aria-label", labels.close).children(X(h, { size: 16 }))), content(true, props.open === true)))))
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
};
|
|
925
|
+
var MapMenu = makeMapMenu();
|
|
926
|
+
export {
|
|
927
|
+
MapMenu,
|
|
928
|
+
MapMenuMode,
|
|
929
|
+
MapMenuPresentation,
|
|
930
|
+
SaveMapSelection,
|
|
931
|
+
googleMapsViewport,
|
|
932
|
+
makeMapMenu,
|
|
933
|
+
mapMenuRadiiKm
|
|
934
|
+
};
|