@luzmo/lucero 1.0.1-alpha.9 → 1.0.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/README.md +74 -9
- package/components/accordion/index.cjs +1 -26
- package/components/accordion/index.js +8 -164
- package/components/accordion-BHBIfsLU.cjs +43 -0
- package/components/accordion-DC7cjb1c.js +152 -0
- package/components/action-bar/index.cjs +1 -22
- package/components/action-bar/index.js +8 -90
- package/components/action-bar-BMHZ4e_p.cjs +39 -0
- package/components/action-bar-CmLjsljR.js +92 -0
- package/components/action-button/index.cjs +1 -7
- package/components/action-button/index.js +8 -144
- package/components/action-button-B4_UEJle.js +121 -0
- package/components/action-button-G0PWSrZo.cjs +24 -0
- package/components/action-group/index.cjs +1 -1
- package/components/action-group/index.js +11 -12
- package/components/action-group-CH8FTW0i.cjs +20 -0
- package/components/action-group-DYKpp-mz.js +211 -0
- package/components/action-menu/index.cjs +1 -39
- package/components/action-menu/index.js +8 -109
- package/components/action-menu-CJyB0mmO.cjs +56 -0
- package/components/action-menu-FiS1vhW7.js +105 -0
- package/components/avatar/avatar.d.ts +5 -0
- package/components/avatar/index.cjs +1 -7
- package/components/avatar/index.js +8 -64
- package/components/avatar-CyY_ZSD0.js +65 -0
- package/components/avatar-PulwjkMI.cjs +24 -0
- package/components/badge/badge.d.ts +35 -0
- package/components/{random-id-CqvckpWe.cjs → badge/index.cjs} +1 -1
- package/components/badge/index.d.ts +8 -0
- package/components/badge/index.js +25 -0
- package/components/badge-D1Ry32wi.cjs +23 -0
- package/components/badge-D6p2hPj8.js +94 -0
- package/components/button/button-base.d.ts +16 -0
- package/components/button/button.d.ts +38 -2
- package/components/button/index.cjs +1 -3
- package/components/button/index.js +9 -110
- package/components/button-CRNRP8P0.js +115 -0
- package/components/button-D3ZTogni.cjs +20 -0
- package/components/button-base-BYV3Lp3P.cjs +25 -0
- package/components/button-base-SHgEJgk2.js +123 -0
- package/components/button-group/index.cjs +1 -1
- package/components/button-group/index.js +8 -42
- package/components/button-group-CJVpgiLq.js +46 -0
- package/components/button-group-rEK_YaF3.cjs +18 -0
- package/components/calendar/calendar.d.ts +67 -0
- package/components/calendar/index.cjs +1 -1
- package/components/calendar/index.d.ts +1 -0
- package/components/calendar/index.js +8 -11
- package/components/calendar-CKr5T_zV.js +619 -0
- package/components/calendar-WRhzTEyZ.cjs +142 -0
- package/components/chat-message/chat-message.d.ts +139 -0
- package/components/{random-id-ByCz1xaq.js → chat-message/index.cjs} +1 -9
- package/components/chat-message/index.d.ts +8 -0
- package/components/chat-message/index.js +25 -0
- package/components/chat-message-CNE-mGuP.cjs +149 -0
- package/components/chat-message-DJgocVNj.js +2295 -0
- package/components/chat-message-group/chat-message-group.d.ts +50 -0
- package/components/{when-CDZyJPvd.cjs → chat-message-group/index.cjs} +1 -5
- package/components/chat-message-group/index.d.ts +7 -0
- package/components/chat-message-group/index.js +25 -0
- package/components/chat-message-group-B4U2MzHx.js +100 -0
- package/components/chat-message-group-COmhCN-R.cjs +24 -0
- package/components/checkbox/checkbox.d.ts +7 -0
- package/components/checkbox/index.cjs +1 -8
- package/components/checkbox/index.js +8 -79
- package/components/checkbox-CPS-tR_i.js +89 -0
- package/components/checkbox-DFwDrIdY.cjs +25 -0
- package/components/checkbox-mixin-C5sLMo5L.js +67 -0
- package/components/{checkbox-mixin-BDN0dBtS.cjs → checkbox-mixin-D4HeLrMj.cjs} +3 -3
- package/components/chunk-D-qHiVGv.cjs +18 -0
- package/components/close-button-BeXYep8K.js +42 -0
- package/components/close-button-BzapEpcF.cjs +18 -0
- package/components/color-area/index.cjs +1 -63
- package/components/color-area/index.js +8 -364
- package/components/color-area-DA3ps2-c.cjs +80 -0
- package/components/color-area-DViRjuKo.js +300 -0
- package/components/color-controller-DueaXfnX.cjs +18 -0
- package/components/color-controller-G2_v2xSl.js +247 -0
- package/components/color-field/color-field.d.ts +1 -0
- package/components/color-field/index.cjs +1 -6
- package/components/color-field/index.js +8 -68
- package/components/color-field-CxdIoSq6.js +75 -0
- package/components/color-field-D7_7z2A2.cjs +23 -0
- package/components/color-handle/index.cjs +1 -7
- package/components/color-handle/index.js +8 -56
- package/components/color-handle-BOusOFFx.js +62 -0
- package/components/color-handle-Cka48yPY.cjs +24 -0
- package/components/color-loupe/index.cjs +1 -1
- package/components/color-loupe/index.js +11 -12
- package/components/color-loupe-DMk8uWZW.cjs +56 -0
- package/components/color-loupe-bEzi2P0y.js +76 -0
- package/components/color-menu/index.cjs +1 -69
- package/components/color-menu/index.js +8 -189
- package/components/color-menu-DwbTxeqv.cjs +89 -0
- package/components/color-menu-Lxc9PTzl.js +183 -0
- package/components/color-palette/index.cjs +1 -1
- package/components/color-palette/index.js +8 -71
- package/components/color-palette-349EkPMg.cjs +18 -0
- package/components/color-palette-BAdaNySC.js +80 -0
- package/components/color-palette-group/index.cjs +1 -11
- package/components/color-palette-group/index.js +8 -188
- package/components/color-palette-group-BvP09zmT.cjs +28 -0
- package/components/color-palette-group-D8Mavsd2.js +163 -0
- package/components/color-picker/color-picker.d.ts +3 -3
- package/components/color-picker/index.cjs +1 -31
- package/components/color-picker/index.js +8 -128
- package/components/color-picker-CSWiU-X5.cjs +48 -0
- package/components/color-picker-DqjfTvYf.js +126 -0
- package/components/color-slider/index.cjs +1 -1
- package/components/color-slider/index.js +8 -11
- package/components/color-slider-DxjJ72ue.cjs +57 -0
- package/components/color-slider-ihAIFt5p.js +421 -0
- package/components/{condition-attribute-with-id-Dv4lSRbe.js → condition-attribute-with-id-DauPaLSS.cjs} +1 -14
- package/components/{query-assigned-nodes-C76XVPWY.js → condition-attribute-with-id-Duo51HZ7.js} +10 -18
- package/components/date-range-picker/date-range-picker.d.ts +184 -0
- package/components/{if-defined-C9YGdo33.cjs → date-range-picker/index.cjs} +1 -5
- package/components/date-range-picker/index.d.ts +8 -0
- package/components/date-range-picker/index.js +25 -0
- package/components/date-range-picker/types.d.ts +16 -0
- package/components/date-range-picker-BdRQep--.js +626 -0
- package/components/date-range-picker-CgitOe0i.cjs +187 -0
- package/components/date-time-picker/date-time-picker.d.ts +3 -3
- package/components/date-time-picker/index.cjs +1 -88
- package/components/date-time-picker/index.d.ts +1 -0
- package/components/date-time-picker/index.js +8 -1109
- package/components/date-time-picker/{types.d.ts → shared/types.d.ts} +1 -1
- package/components/date-time-picker-Bz8XwSOR.cjs +105 -0
- package/components/date-time-picker-Ct_ln8Ot.js +470 -0
- package/components/decorate-B2wePfNm.cjs +18 -0
- package/components/decorate-aGxJUVxg.js +91 -0
- package/components/{condition-attribute-with-id-DrQYZzFS.cjs → dependency-manger-CHy9t__e.cjs} +1 -1
- package/components/dependency-manger-DMrulWcJ.js +40 -0
- package/components/divider/index.cjs +1 -1
- package/components/divider/index.js +8 -44
- package/components/divider-Dn8XqbB6.cjs +18 -0
- package/components/divider-cU0lVwOp.js +59 -0
- package/components/divider.module-C65RfSUa.js +21 -0
- package/components/divider.module-CL60P_z8.cjs +18 -0
- package/components/element-resolution-Bs1x89vU.js +80 -0
- package/components/element-resolution-C0aiOB0Y.cjs +18 -0
- package/components/field-group/index.cjs +1 -1
- package/components/field-group/index.js +11 -12
- package/components/field-group-C7ROsWq3.js +57 -0
- package/components/field-group-OcI5Lgu7.cjs +23 -0
- package/components/field-label/index.cjs +1 -1
- package/components/field-label/index.js +11 -12
- package/components/field-label-BCl6R1uO.cjs +25 -0
- package/components/field-label-CtGCEmdp.js +87 -0
- package/components/focus-group-BshI1RpM.js +164 -0
- package/components/focus-group-SF8Kj7iB.cjs +18 -0
- package/components/focus-visible-B0NNezGc.cjs +18 -0
- package/components/focus-visible-CrooVCUu.js +58 -0
- package/components/focusable-BmS8IzhH.js +117 -0
- package/components/focusable-CupEoHmn.cjs +18 -0
- package/components/{base-BjTwmyRF.cjs → focusable-selectors-5n5liBn0.cjs} +1 -5
- package/components/{focusable-selectors-BgFlyFcY.cjs → focusable-selectors-Bg60_Kra.js} +13 -1
- package/components/{state-Deh-vKYE.js → get-label-from-slot-5vVnfSgN.js} +7 -11
- package/components/get-label-from-slot-LO_DZP60.cjs +18 -0
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +8 -71
- package/components/icon-B7hKwn_q.cjs +18 -0
- package/components/icon-CwBAE1eU.js +59 -0
- package/components/index.cjs +1 -1
- package/components/index.js +78 -176
- package/components/infield-button/index.cjs +1 -5
- package/components/infield-button/index.js +8 -47
- package/components/infield-button-B2z0dLzq.js +54 -0
- package/components/infield-button-BVKotWqr.cjs +22 -0
- package/components/label/index.cjs +1 -1
- package/components/label/index.js +8 -34
- package/components/label-ClJE2esm.js +41 -0
- package/components/label-CqolZbJo.cjs +18 -0
- package/components/language-resolution-BYemISJC.cjs +18 -0
- package/components/language-resolution-BpfGTC29.js +43 -0
- package/components/like-anchor-BZJXts_H.cjs +32 -0
- package/components/like-anchor-DeOXX-MX.js +46 -0
- package/components/manage-help-text-CF0xBh0F.js +81 -0
- package/components/manage-help-text-D9VbYRf_.cjs +30 -0
- package/components/menu/index.cjs +1 -66
- package/components/menu/index.js +8 -879
- package/components/menu/menu-item.d.ts +8 -1
- package/components/menu/menu.d.ts +1 -0
- package/components/menu--ukVtSq7.js +749 -0
- package/components/menu-DAA51y45.cjs +108 -0
- package/components/multi-language-field/index.cjs +1 -22
- package/components/multi-language-field/index.js +8 -131
- package/components/multi-language-field/multi-language-field.d.ts +1 -0
- package/components/multi-language-field-BzY75rOY.js +122 -0
- package/components/multi-language-field-DmoMyCBH.cjs +40 -0
- package/components/number-field/index.cjs +1 -40
- package/components/number-field/index.js +8 -453
- package/components/number-field/number-field.d.ts +145 -0
- package/components/number-field-B4RSFeTR.cjs +57 -0
- package/components/number-field-C66dTUMM.js +402 -0
- package/components/observe-slot-presence-BCqd3VSd.js +55 -0
- package/components/observe-slot-presence-Dx8hzNzK.cjs +18 -0
- package/components/observe-slot-text-BhTcGuHY.cjs +18 -0
- package/components/observe-slot-text-Ddf1OC6F.js +71 -0
- package/components/options/index.cjs +1 -84
- package/components/options/index.js +8 -1160
- package/components/options/option.d.ts +16 -0
- package/components/options/options.d.ts +44 -4
- package/components/options-BPNAm4MW.cjs +101 -0
- package/components/options-Dz-ejkxF.js +484 -0
- package/components/overlay/index.cjs +1 -56
- package/components/overlay/index.js +10 -329
- package/components/overlay/overlay.d.ts +12 -1
- package/components/overlay/virtual-trigger.d.ts +3 -2
- package/components/overlay-8tN0KPbR.js +1115 -0
- package/components/overlay-CMd2Dnpv.cjs +73 -0
- package/components/overlay-CwR_36OV.js +227 -0
- package/components/overlay-DdrfkOry.cjs +47 -0
- package/components/pending-state-DFcNf5rd.js +50 -0
- package/components/{pending-state-CaH1si5b.cjs → pending-state-DIeF18qg.cjs} +4 -3
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +11 -15
- package/components/picker/picker.d.ts +1 -0
- package/components/picker-C4RVOxLq.cjs +123 -0
- package/components/picker-agQW7YNo.js +394 -0
- package/components/picker-button/index.cjs +1 -20
- package/components/picker-button/index.js +8 -70
- package/components/picker-button-BLbeT3Yu.js +72 -0
- package/components/picker-button-D34YXyXp.cjs +37 -0
- package/components/platform-B7Sk7Qon.cjs +18 -0
- package/components/{platform-BM-uMWpX.js → platform-D4V_cOJF.js} +29 -38
- package/components/popover/index.cjs +1 -1
- package/components/popover/index.js +11 -12
- package/components/popover-DyC9xGhX.js +58 -0
- package/components/popover-dgL04x6P.cjs +30 -0
- package/components/progress-bar/index.cjs +18 -0
- package/components/progress-bar/index.d.ts +7 -0
- package/components/progress-bar/index.js +25 -0
- package/components/progress-bar/progress-bar.d.ts +34 -0
- package/components/progress-bar-BR28tISC.cjs +31 -0
- package/components/progress-bar-DHgFRml1.js +119 -0
- package/components/progress-circle/index.cjs +1 -1
- package/components/progress-circle/index.js +11 -12
- package/components/progress-circle-Cg_ua9Ff.js +78 -0
- package/components/progress-circle-DuzwUiGN.cjs +33 -0
- package/components/progress-steps/index.cjs +18 -0
- package/components/progress-steps/index.d.ts +8 -0
- package/components/progress-steps/index.js +25 -0
- package/components/progress-steps/progress-steps.d.ts +148 -0
- package/components/progress-steps/types.d.ts +32 -0
- package/components/progress-steps-Da8aZWx3.js +262 -0
- package/components/progress-steps-WriXaZpE.cjs +96 -0
- package/components/prompt-box/controllers/attachments-controller.d.ts +35 -0
- package/components/prompt-box/controllers/recording-controller.d.ts +23 -0
- package/components/prompt-box/controllers/rich-input-controller.d.ts +89 -0
- package/components/prompt-box/controllers/trigger-menu-controller.d.ts +107 -0
- package/components/prompt-box/index.cjs +18 -0
- package/components/prompt-box/index.d.ts +9 -0
- package/components/prompt-box/index.js +25 -0
- package/components/prompt-box/keyboard-focus-tracker.d.ts +3 -0
- package/components/prompt-box/prompt-box-templates.d.ts +10 -0
- package/components/prompt-box/prompt-box.d.ts +194 -0
- package/components/prompt-box/range-from-point.d.ts +21 -0
- package/components/prompt-box/selection-utils.d.ts +39 -0
- package/components/prompt-box/slot-state-sync.d.ts +10 -0
- package/components/prompt-box/types.d.ts +112 -0
- package/components/prompt-box-BEloQP-R.js +1506 -0
- package/components/prompt-box-DV8Smf3Q.cjs +282 -0
- package/components/radio/index.cjs +1 -5
- package/components/radio/index.js +8 -174
- package/components/radio-BzEPGUmQ.js +141 -0
- package/components/radio-d-2GUbYE.cjs +22 -0
- package/components/{if-defined-DOaE2coe.js → random-id-B51lUxUB.cjs} +1 -10
- package/components/{when-CDK1Tt5Y.js → random-id-Dd4boCPV.js} +5 -10
- package/components/{focusable-selectors-B4YgbghQ.js → rolldown-runtime-CAFD8bLK.js} +10 -13
- package/components/roving-tabindex-B7x5ePUB.cjs +18 -0
- package/components/roving-tabindex-BP6mQbXf.js +62 -0
- package/components/{directive-oAbCiebi.js → scaled-indicator-BcO2BOsf.js} +24 -26
- package/components/scaled-indicator-p8-3k2cJ.cjs +26 -0
- package/components/search/index.cjs +1 -28
- package/components/search/index.js +8 -114
- package/components/search-CmLfd2dF.js +94 -0
- package/components/search-DRTD4xsE.cjs +45 -0
- package/components/segments-factory-CHo9oQw7.cjs +18 -0
- package/components/segments-factory-D0IveW-q.js +417 -0
- package/components/select/index.cjs +1 -140
- package/components/select/index.js +8 -602
- package/components/select/select.d.ts +26 -17
- package/components/select--vrG59GQ.cjs +158 -0
- package/components/select-DPeI0jP9.js +518 -0
- package/components/{language-resolution-8yZa5r_P.js → sized-mixin-DaBoZkVS.js} +38 -35
- package/components/sized-mixin-StFA4y0J.cjs +18 -0
- package/components/skeleton-loader/index.cjs +18 -0
- package/components/skeleton-loader/index.d.ts +7 -0
- package/components/skeleton-loader/index.js +25 -0
- package/components/skeleton-loader/skeleton-loader.d.ts +22 -0
- package/components/skeleton-loader-B8NgELvX.cjs +18 -0
- package/components/skeleton-loader-C1XG3m_u.js +46 -0
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +8 -1141
- package/components/slider/slider.d.ts +2 -0
- package/components/slider-3QBnq0S8.js +96 -0
- package/components/slider-uXRKcOz5.cjs +18 -0
- package/components/slottable-request-event-DZ2Z_BLk.js +29 -0
- package/components/{base-D76d76ww.js → slottable-request-event-gAcEQan2.cjs} +1 -9
- package/components/status-light/index.cjs +18 -0
- package/components/status-light/index.d.ts +8 -0
- package/components/status-light/index.js +25 -0
- package/components/status-light/status-light.d.ts +26 -0
- package/components/status-light-Bf8jGu4G.js +85 -0
- package/components/status-light-CBaAFRUc.cjs +21 -0
- package/components/strategies-DhxJGIZT.js +137 -0
- package/components/strategies-kuvLVIKO.cjs +18 -0
- package/components/streaming-listener-2NcP7ys7.js +77 -0
- package/components/streaming-listener-BnDW38lt.cjs +18 -0
- package/components/suggestion/index.cjs +18 -0
- package/components/suggestion/index.d.ts +8 -0
- package/components/suggestion/index.js +25 -0
- package/components/suggestion/suggestion.d.ts +45 -0
- package/components/suggestion-CEJiW_7y.cjs +23 -0
- package/components/suggestion-DK5gxxDI.js +76 -0
- package/components/swatch/index.cjs +1 -32
- package/components/swatch/index.js +8 -325
- package/components/swatch-BLuV-hlF.js +271 -0
- package/components/swatch-G70JUe6I.cjs +49 -0
- package/components/switch/index.cjs +1 -5
- package/components/switch/index.js +8 -56
- package/components/switch-BdE-hI69.js +60 -0
- package/components/switch-KzkrF-ob.cjs +22 -0
- package/components/tabs/index.cjs +1 -76
- package/components/tabs/index.js +8 -619
- package/components/tabs/tabs.d.ts +3 -9
- package/components/tabs-BfTgzdid.cjs +76 -0
- package/components/tabs-BthdwrmW.js +434 -0
- package/components/tags/index.cjs +1 -15
- package/components/tags/index.d.ts +1 -0
- package/components/tags/index.js +8 -156
- package/components/tags/tag.d.ts +28 -0
- package/components/tags/tags.d.ts +3 -1
- package/components/tags-B89eYzsB.js +203 -0
- package/components/tags-OBPAvjdV.cjs +47 -0
- package/components/text-field/index.cjs +1 -4
- package/components/text-field/index.js +9 -45
- package/components/text-field/text-field.d.ts +27 -0
- package/components/text-field-A4Obzs4l.cjs +21 -0
- package/components/text-field-BoGAvXvh.js +44 -0
- package/components/text-field-Cs8HYRYL.js +256 -0
- package/components/text-field-FJr8ZUhI.cjs +81 -0
- package/components/text-field.module-Btsve-VN.js +21 -0
- package/components/text-field.module-D5oDP7MB.cjs +18 -0
- package/components/toast/index.cjs +1 -34
- package/components/toast/index.js +8 -136
- package/components/toast-CJSQUzoW.cjs +51 -0
- package/components/toast-DKwphMrp.js +133 -0
- package/components/tooltip/index.cjs +1 -28
- package/components/tooltip/index.js +8 -205
- package/components/tooltip/tooltip.d.ts +12 -1
- package/components/tooltip-C3O4AQ1l.js +192 -0
- package/components/tooltip-DY1trLtg.cjs +45 -0
- package/components/top-nav/index.cjs +18 -0
- package/components/top-nav/index.d.ts +10 -0
- package/components/top-nav/index.js +25 -0
- package/components/top-nav/top-nav-item.d.ts +26 -0
- package/components/top-nav/top-nav.d.ts +45 -0
- package/components/top-nav-DVQ5ASMa.js +203 -0
- package/components/top-nav-DlTojz8S.cjs +45 -0
- package/components/utils.cjs +1 -1
- package/components/utils.js +8 -25
- package/components/voice-recorder-477xPHRU.js +134 -0
- package/components/voice-recorder-BUtmSvPO.cjs +18 -0
- package/custom-elements.json +1 -1
- package/index.d.ts +11 -1
- package/package.json +134 -5
- package/utils/button-interaction-controllers/interaction-controller.d.ts +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/scaled-indicator.d.ts +8 -0
- package/utils/voice-recorder.d.ts +121 -0
- package/components/NumberFormatter-DewVDY5w.cjs +0 -18
- package/components/NumberFormatter-DgOUVrge.js +0 -136
- package/components/NumberParser-Dik4a0h-.cjs +0 -18
- package/components/NumberParser-ci9J5EKv.js +0 -173
- package/components/action-group-DBImibFn.js +0 -258
- package/components/action-group-DJGMcRHb.cjs +0 -20
- package/components/async-directive-BX1T1e1_.cjs +0 -22
- package/components/async-directive-BfcqVjDp.js +0 -82
- package/components/base-CBCg3yyw.cjs +0 -40
- package/components/base-WsynuqaS.js +0 -677
- package/components/button-base-DbkDzb71.js +0 -144
- package/components/button-base-XgPLmwP-.cjs +0 -25
- package/components/checkbox-mixin-Do7EgtpQ.js +0 -70
- package/components/class-map-Di1D_rCm.cjs +0 -22
- package/components/class-map-NbVXqBU0.js +0 -51
- package/components/clear-button-DQcRdcUa.js +0 -53
- package/components/clear-button-OFUFFe7G.cjs +0 -18
- package/components/close-button-Cbnb7XXj.cjs +0 -18
- package/components/close-button-CqHYZhum.js +0 -51
- package/components/color-controller-DTp1juRz.js +0 -3198
- package/components/color-controller-_ZwyhvaU.cjs +0 -18
- package/components/color-loupe-CaA_Lfkk.cjs +0 -56
- package/components/color-loupe-CmMsXbjT.js +0 -81
- package/components/dependency-manger-C5HCkMMB.cjs +0 -18
- package/components/dependency-manger-CEXvGQUV.js +0 -54
- package/components/directive-C7oCP5Bh.cjs +0 -22
- package/components/directive-helpers-Cm6gitnu.js +0 -62
- package/components/directive-helpers-DyIRTWwA.cjs +0 -22
- package/components/divider.module-DDvBo9zo.cjs +0 -18
- package/components/divider.module-DoQWQEIJ.js +0 -21
- package/components/element-resolution-BvRLGqIU.cjs +0 -18
- package/components/element-resolution-FCUT-wql.js +0 -91
- package/components/field-group-DXfBWrkO.js +0 -66
- package/components/field-group-DkGst3r5.cjs +0 -23
- package/components/field-label-CZ2zzChK.js +0 -106
- package/components/field-label-mO1AkUgR.cjs +0 -25
- package/components/flow-D-0MTYCm.js +0 -527
- package/components/flow-DM3dNAKs.cjs +0 -30
- package/components/focus-group-DHeTq18L.js +0 -218
- package/components/focus-group-DnxZUBhQ.cjs +0 -18
- package/components/focus-visible-B0P9aY_G.cjs +0 -18
- package/components/focus-visible-DBlJGoEW.js +0 -74
- package/components/focusable-BxtpnzWp.js +0 -153
- package/components/focusable-EbipgXRh.cjs +0 -18
- package/components/index-BwxgAdzi.cjs +0 -57
- package/components/index-Cl54m8Yh.js +0 -1490
- package/components/index-HjQa8tew.js +0 -1174
- package/components/index-Wq3qZJGh.cjs +0 -113
- package/components/language-resolution-DJzmyzZq.cjs +0 -18
- package/components/like-anchor-Bvn_vLQ8.js +0 -69
- package/components/like-anchor-sod1C1fR.cjs +0 -32
- package/components/luzmo-icons-4nDFv1Lq.js +0 -229
- package/components/luzmo-icons-D4IvHgVd.cjs +0 -29
- package/components/manage-help-text-DhgARkZX.cjs +0 -30
- package/components/manage-help-text-syYnjKGL.js +0 -92
- package/components/mutation-controller-DH7YOCyj.js +0 -52
- package/components/mutation-controller-DkOMCW-c.cjs +0 -22
- package/components/observe-slot-presence-CmVi0zTc.js +0 -68
- package/components/observe-slot-presence-bc9chhsi.cjs +0 -18
- package/components/observe-slot-text-BPfIQQtz.js +0 -87
- package/components/observe-slot-text-Ceb7SvYT.cjs +0 -18
- package/components/overlay-Cig9r6uU.js +0 -2747
- package/components/overlay-KSKMzzkh.cjs +0 -47
- package/components/pending-state-DTX7ggyF.js +0 -61
- package/components/picker-BfBP7XJN.js +0 -461
- package/components/picker-xIphqE6d.cjs +0 -123
- package/components/platform-BiXhwqk3.cjs +0 -18
- package/components/popover-DjX0aAnY.js +0 -67
- package/components/popover-KFfO0IYL.cjs +0 -30
- package/components/progress-circle-BvRJNuNo.cjs +0 -33
- package/components/progress-circle-DXH9z8-6.js +0 -97
- package/components/query-BL-TJj7K.cjs +0 -22
- package/components/query-D_KR_GUc.js +0 -51
- package/components/query-assigned-elements-DjfhL1cl.js +0 -36
- package/components/query-assigned-elements-DsKsfk7G.cjs +0 -22
- package/components/query-assigned-nodes-BcKWmGzy.cjs +0 -22
- package/components/roving-tabindex-By_fCy_e.cjs +0 -18
- package/components/roving-tabindex-DOg4z6ZU.js +0 -66
- package/components/sized-mixin-CPxE5C96.cjs +0 -18
- package/components/sized-mixin-D4ACoVUr.js +0 -63
- package/components/slottable-request-event-BfUUt1Mh.cjs +0 -18
- package/components/slottable-request-event-DggLA4Rx.js +0 -31
- package/components/state-D8JEtYqe.cjs +0 -22
- package/components/strategies-9indNIEb.js +0 -195
- package/components/strategies-BACP6MhR.cjs +0 -18
- package/components/streaming-listener-B00MvALi.cjs +0 -18
- package/components/streaming-listener-CP-JE6Fa.js +0 -91
- package/components/style-map-CeilmSgs.cjs +0 -22
- package/components/style-map-IgqIKvlE.js +0 -53
- package/components/text-field-BTkr42k4.cjs +0 -85
- package/components/text-field-ol9Ed5lQ.js +0 -314
- package/components/text-field.module-ColtFhf_.js +0 -21
- package/components/text-field.module-p_VF2tC_.cjs +0 -18
- package/components/unit-input/index.cjs +0 -43
- package/components/unit-input/index.d.ts +0 -7
- package/components/unit-input/index.js +0 -183
- package/components/unit-input/unit-input.d.ts +0 -33
- /package/components/date-time-picker/{helpers.d.ts → shared/helpers.d.ts} +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/date/day-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/date/month-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/date/year-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/date-time-segments.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/editable-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/literal-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/modifiers/clear-modifier.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/modifiers/decrement-modifier.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/modifiers/increment-modifier.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/modifiers/input-modifier.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/modifiers/segments-modifier.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/segments-factory.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/segments-formatter.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/time/day-period-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/time/hour-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/time/millisecond-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/time/minute-segment.d.ts +0 -0
- /package/components/date-time-picker/{segments → shared/segments}/time/second-segment.d.ts +0 -0
|
@@ -0,0 +1,1506 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
+
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
+
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
* SOFTWARE.
|
|
17
|
+
* */
|
|
18
|
+
import { n as e, t } from "./decorate-aGxJUVxg.js";
|
|
19
|
+
import { n } from "./sized-mixin-DaBoZkVS.js";
|
|
20
|
+
import "./icon-CwBAE1eU.js";
|
|
21
|
+
import "./action-button-B4_UEJle.js";
|
|
22
|
+
import { m as r } from "./overlay-8tN0KPbR.js";
|
|
23
|
+
import "./overlay-CwR_36OV.js";
|
|
24
|
+
import "./button-CRNRP8P0.js";
|
|
25
|
+
import "./text-field-BoGAvXvh.js";
|
|
26
|
+
import "./tags-B89eYzsB.js";
|
|
27
|
+
import { t as i } from "./voice-recorder-477xPHRU.js";
|
|
28
|
+
import { html as a, nothing as o, unsafeCSS as s } from "lit";
|
|
29
|
+
import { property as c, query as l, state as u } from "lit/decorators.js";
|
|
30
|
+
import { luzmoArrowEnter as d, luzmoArrowUp as f, luzmoCheck as p, luzmoClear as m, luzmoMicrophone as h } from "@luzmo/icons";
|
|
31
|
+
//#region src/components/prompt-box/controllers/attachments-controller.ts
|
|
32
|
+
var g = class {
|
|
33
|
+
constructor(e) {
|
|
34
|
+
this._attachments = [], this._idCounter = 0, this._host = e, e.addController(this);
|
|
35
|
+
}
|
|
36
|
+
hostConnected() {}
|
|
37
|
+
hostDisconnected() {
|
|
38
|
+
this._revokeAllPreviewUrls();
|
|
39
|
+
}
|
|
40
|
+
get attachments() {
|
|
41
|
+
return this._attachments;
|
|
42
|
+
}
|
|
43
|
+
get hasAttachments() {
|
|
44
|
+
return this._attachments.length > 0;
|
|
45
|
+
}
|
|
46
|
+
get imageAttachments() {
|
|
47
|
+
return this._attachments.filter((e) => this._isImageFile(e.file));
|
|
48
|
+
}
|
|
49
|
+
get fileAttachments() {
|
|
50
|
+
return this._attachments.filter((e) => !this._isImageFile(e.file));
|
|
51
|
+
}
|
|
52
|
+
addFiles(e) {
|
|
53
|
+
if (this._host.disabled || this._host.readonly || this._host.pending) return [];
|
|
54
|
+
let t = [];
|
|
55
|
+
for (let n of e) {
|
|
56
|
+
if (this._isImageFile(n) && !this._host.allowImages || !this._isImageFile(n) && !this._host.allowFiles || !this._isFileTypeAccepted(n)) continue;
|
|
57
|
+
let e = this._generateId(), r = {
|
|
58
|
+
file: n,
|
|
59
|
+
id: e
|
|
60
|
+
};
|
|
61
|
+
this._isImageFile(n) && (r.previewUrl = URL.createObjectURL(n)), this._attachments = [...this._attachments, r], t.push(e);
|
|
62
|
+
}
|
|
63
|
+
return t.length > 0 && (this._dispatchChange(), this._host.requestUpdate()), t;
|
|
64
|
+
}
|
|
65
|
+
removeAttachment(e) {
|
|
66
|
+
let t = this._attachments.find((t) => t.id === e);
|
|
67
|
+
t && (t.previewUrl && URL.revokeObjectURL(t.previewUrl), this._attachments = this._attachments.filter((t) => t.id !== e), this._dispatchChange(), this._host.requestUpdate());
|
|
68
|
+
}
|
|
69
|
+
clearAttachments() {
|
|
70
|
+
this._revokeAllPreviewUrls(), this._attachments = [], this._dispatchChange(), this._host.requestUpdate();
|
|
71
|
+
}
|
|
72
|
+
getAttachments() {
|
|
73
|
+
return [...this._attachments];
|
|
74
|
+
}
|
|
75
|
+
handlePastedImages(e) {
|
|
76
|
+
if (!this._host.allowImages || this._host.disabled || this._host.readonly || this._host.pending || !e) return !1;
|
|
77
|
+
let t = [];
|
|
78
|
+
for (let n of e.items) if (n.type.startsWith("image/")) {
|
|
79
|
+
let e = n.getAsFile();
|
|
80
|
+
e && t.push(e);
|
|
81
|
+
}
|
|
82
|
+
return t.length > 0 ? (this.addFiles(t), !0) : !1;
|
|
83
|
+
}
|
|
84
|
+
getAcceptAttribute() {
|
|
85
|
+
if (this._host.acceptedFileTypes.length > 0) return this._host.acceptedFileTypes.join(",");
|
|
86
|
+
let e = [];
|
|
87
|
+
return this._host.allowImages && e.push("image/*"), this._host.allowFiles && e.push("*/*"), e.join(",");
|
|
88
|
+
}
|
|
89
|
+
isImageFile(e) {
|
|
90
|
+
return this._isImageFile(e);
|
|
91
|
+
}
|
|
92
|
+
_isImageFile(e) {
|
|
93
|
+
return e.type.startsWith("image/");
|
|
94
|
+
}
|
|
95
|
+
_isFileTypeAccepted(e) {
|
|
96
|
+
if (this._host.acceptedFileTypes.length === 0) return !0;
|
|
97
|
+
let t = e.name.toLowerCase(), n = e.type.toLowerCase();
|
|
98
|
+
for (let e of this._host.acceptedFileTypes) {
|
|
99
|
+
let r = e.toLowerCase();
|
|
100
|
+
if (r.endsWith("/*")) {
|
|
101
|
+
let e = r.slice(0, -2);
|
|
102
|
+
if (n.startsWith(e + "/")) return !0;
|
|
103
|
+
} else if (n === r) return !0;
|
|
104
|
+
else if (r.startsWith(".") && t.endsWith(r)) return !0;
|
|
105
|
+
}
|
|
106
|
+
return !1;
|
|
107
|
+
}
|
|
108
|
+
_generateId() {
|
|
109
|
+
return `attachment-${++this._idCounter}-${Date.now()}`;
|
|
110
|
+
}
|
|
111
|
+
_revokeAllPreviewUrls() {
|
|
112
|
+
for (let e of this._attachments) e.previewUrl && URL.revokeObjectURL(e.previewUrl);
|
|
113
|
+
}
|
|
114
|
+
_dispatchChange() {
|
|
115
|
+
this._host.dispatchEvent(new CustomEvent("luzmo-attachments-change", {
|
|
116
|
+
bubbles: !0,
|
|
117
|
+
composed: !0,
|
|
118
|
+
detail: { attachments: this._attachments }
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
}, ee = class {
|
|
122
|
+
constructor(e) {
|
|
123
|
+
this._voiceRecorder = null, this.isRecording = !1, this.duration = 0, this.audioLevel = 0, this.shouldFocusFinishButton = !1, this._host = e, e.addController(this);
|
|
124
|
+
}
|
|
125
|
+
hostConnected() {}
|
|
126
|
+
hostDisconnected() {
|
|
127
|
+
this._destroy();
|
|
128
|
+
}
|
|
129
|
+
async start(e) {
|
|
130
|
+
if (!i.isSupported()) {
|
|
131
|
+
this._host.dispatchEvent(new CustomEvent("luzmo-record-error", {
|
|
132
|
+
bubbles: !0,
|
|
133
|
+
composed: !0,
|
|
134
|
+
detail: { error: "Voice recording is not supported in this browser" }
|
|
135
|
+
}));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (this.isRecording) {
|
|
139
|
+
this.stop();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.shouldFocusFinishButton = e, this._init(), this._voiceRecorder && (await this._voiceRecorder.startRecording() && (this.isRecording = !0, this.duration = 0, this.audioLevel = 0, this._host.requestUpdate()), this._host.dispatchEvent(new CustomEvent("luzmo-record", {
|
|
143
|
+
bubbles: !0,
|
|
144
|
+
composed: !0,
|
|
145
|
+
detail: { isRecording: this.isRecording }
|
|
146
|
+
})));
|
|
147
|
+
}
|
|
148
|
+
stop() {
|
|
149
|
+
this._voiceRecorder?.stopRecording();
|
|
150
|
+
}
|
|
151
|
+
cancel() {
|
|
152
|
+
this._voiceRecorder?.cancelRecording(), this.isRecording = !1, this.duration = 0, this.audioLevel = 0, this._host.requestUpdate(), this._host.dispatchEvent(new CustomEvent("luzmo-record-cancel", {
|
|
153
|
+
bubbles: !0,
|
|
154
|
+
composed: !0
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
formatDuration() {
|
|
158
|
+
return i.formatDuration(this.duration);
|
|
159
|
+
}
|
|
160
|
+
static isSupported() {
|
|
161
|
+
return i.isSupported();
|
|
162
|
+
}
|
|
163
|
+
_init() {
|
|
164
|
+
this._voiceRecorder || (this._voiceRecorder = new i({ maxDuration: 3e5 }), this._voiceRecorder.onStart(() => {
|
|
165
|
+
this.isRecording = !0, this._host.requestUpdate();
|
|
166
|
+
}).onStop((e) => {
|
|
167
|
+
this.isRecording = !1, this.duration = 0, this.audioLevel = 0, this._host.requestUpdate(), this._host.dispatchEvent(new CustomEvent("luzmo-recording-complete", {
|
|
168
|
+
bubbles: !0,
|
|
169
|
+
composed: !0,
|
|
170
|
+
detail: {
|
|
171
|
+
audioBlob: e.audioBlob,
|
|
172
|
+
duration: e.duration,
|
|
173
|
+
mimeType: e.mimeType
|
|
174
|
+
}
|
|
175
|
+
}));
|
|
176
|
+
}).onError((e) => {
|
|
177
|
+
this.isRecording = !1, this.duration = 0, this.audioLevel = 0, this._host.requestUpdate(), this._host.dispatchEvent(new CustomEvent("luzmo-record-error", {
|
|
178
|
+
bubbles: !0,
|
|
179
|
+
composed: !0,
|
|
180
|
+
detail: { error: e }
|
|
181
|
+
}));
|
|
182
|
+
}).onAudioLevel((e) => {
|
|
183
|
+
this.audioLevel = e, this._host.requestUpdate();
|
|
184
|
+
}).onDurationUpdate((e) => {
|
|
185
|
+
this.duration = e, this._host.requestUpdate();
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
_destroy() {
|
|
189
|
+
this._voiceRecorder &&= (this._voiceRecorder.destroy(), null), this.isRecording = !1, this.duration = 0, this.audioLevel = 0;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/components/prompt-box/range-from-point.ts
|
|
194
|
+
function _(e, t) {
|
|
195
|
+
let n = document.createRange();
|
|
196
|
+
return n.setStart(e, t), n.collapse(!0), n;
|
|
197
|
+
}
|
|
198
|
+
function v(e, t, n) {
|
|
199
|
+
let r = e.getBoundingClientRect(), i = t - r.left, a = n - r.top;
|
|
200
|
+
return i * i + a * a;
|
|
201
|
+
}
|
|
202
|
+
function y(e, t, n, r) {
|
|
203
|
+
let i = 0, a = t;
|
|
204
|
+
for (; a - i > 1;) {
|
|
205
|
+
let t = i + a >>> 1, r = document.createRange();
|
|
206
|
+
r.setStart(e, t), r.collapse(!0), r.getBoundingClientRect().left < n ? i = t : a = t;
|
|
207
|
+
}
|
|
208
|
+
let o = _(e, i), s = v(o, n, r), c = _(e, a), l = v(c, n, r);
|
|
209
|
+
return l < s && (o = c, s = l), {
|
|
210
|
+
range: o,
|
|
211
|
+
distSq: s
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function te(e, t, n, r) {
|
|
215
|
+
let i = null, a = Infinity;
|
|
216
|
+
for (let [o, s] of e.childNodes.entries()) if (s !== r) {
|
|
217
|
+
if (s.nodeType === Node.TEXT_NODE) {
|
|
218
|
+
let e = (s.textContent ?? "").length;
|
|
219
|
+
if (e === 0) continue;
|
|
220
|
+
let r = y(s, e, t, n);
|
|
221
|
+
r.distSq < a && (a = r.distSq, i = r.range);
|
|
222
|
+
} else if (s.nodeType === Node.ELEMENT_NODE) {
|
|
223
|
+
let r = s.getBoundingClientRect();
|
|
224
|
+
if (r.width === 0 && r.height === 0) continue;
|
|
225
|
+
let c = r.left + r.width / 2, l = _(e, o), u = _(e, o + 1), d = t < c ? l : u, f = n - (r.top + r.height / 2), p = t < c ? t - r.left : t - r.right, m = p * p + f * f;
|
|
226
|
+
m < a && (a = m, i = d);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!i) {
|
|
230
|
+
let t = document.createRange();
|
|
231
|
+
return t.selectNodeContents(e), t.collapse(!1), t;
|
|
232
|
+
}
|
|
233
|
+
return i;
|
|
234
|
+
}
|
|
235
|
+
function b(e, t, n, r, i) {
|
|
236
|
+
if (Number.isNaN(n) || Number.isNaN(r)) return null;
|
|
237
|
+
let a = null, o = e;
|
|
238
|
+
if (o?.caretPositionFromPoint) {
|
|
239
|
+
let e = o.caretPositionFromPoint(n, r);
|
|
240
|
+
e && (a = _(e.offsetNode, e.offset));
|
|
241
|
+
} else o?.caretRangeFromPoint && (a = o.caretRangeFromPoint(n, r));
|
|
242
|
+
if (!a) if ("caretPositionFromPoint" in document) {
|
|
243
|
+
let e = document.caretPositionFromPoint(n, r);
|
|
244
|
+
e && (a = _(e.offsetNode, e.offset));
|
|
245
|
+
} else "caretRangeFromPoint" in document && (a = document.caretRangeFromPoint(n, r));
|
|
246
|
+
return (!a || !t.contains(a.startContainer)) && (a = te(t, n, r, i)), a;
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/components/prompt-box/selection-utils.ts
|
|
250
|
+
function x(e) {
|
|
251
|
+
if (e) {
|
|
252
|
+
let t = e.getSelection?.();
|
|
253
|
+
if (t && t.rangeCount > 0) return t.getRangeAt(0);
|
|
254
|
+
}
|
|
255
|
+
let t = document.getSelection();
|
|
256
|
+
if (!t || t.rangeCount === 0) return null;
|
|
257
|
+
let n = t.getRangeAt(0);
|
|
258
|
+
if (!e || e.contains(n.startContainer)) return n;
|
|
259
|
+
let r = t;
|
|
260
|
+
if (e && r.getComposedRanges) try {
|
|
261
|
+
let t = r.getComposedRanges(e);
|
|
262
|
+
if (t.length > 0) {
|
|
263
|
+
let e = t[0], n = document.createRange();
|
|
264
|
+
return n.setStart(e.startContainer, e.startOffset), n.setEnd(e.endContainer, e.endOffset), n;
|
|
265
|
+
}
|
|
266
|
+
} catch {}
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
function S(e, t) {
|
|
270
|
+
let n = document.getSelection();
|
|
271
|
+
if (n) try {
|
|
272
|
+
n.setBaseAndExtent(e, t, e, t);
|
|
273
|
+
} catch {
|
|
274
|
+
let r = document.createRange();
|
|
275
|
+
r.setStart(e, t), r.collapse(!0), n.removeAllRanges(), n.addRange(r);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function C(e) {
|
|
279
|
+
return e === " " || e === "\n" || e === "\xA0";
|
|
280
|
+
}
|
|
281
|
+
function w(e) {
|
|
282
|
+
let t = x(e);
|
|
283
|
+
if (!t || !t.collapsed) return !1;
|
|
284
|
+
let n = t.startContainer, r = t.startOffset;
|
|
285
|
+
if (n.nodeType === Node.TEXT_NODE) {
|
|
286
|
+
if (r >= 2) return C(n.textContent?.charAt(r - 2) ?? "");
|
|
287
|
+
let e = n.previousSibling;
|
|
288
|
+
if (!e || e.nodeType === Node.ELEMENT_NODE && e.classList?.contains("element-badge")) return !0;
|
|
289
|
+
let t = e.textContent ?? "";
|
|
290
|
+
return t.length === 0 ? !0 : C(t.at(-1) ?? "");
|
|
291
|
+
}
|
|
292
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
293
|
+
if (r === 0) return !0;
|
|
294
|
+
let e = n.childNodes[r - 1];
|
|
295
|
+
if (!e || e.nodeType === Node.ELEMENT_NODE && e.classList?.contains("element-badge")) return !0;
|
|
296
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
297
|
+
let t = e.textContent ?? "";
|
|
298
|
+
return t.length === 0 ? !0 : C(t.at(-1) ?? "");
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return !1;
|
|
302
|
+
}
|
|
303
|
+
function T(e, t) {
|
|
304
|
+
let n = x(e);
|
|
305
|
+
if (!n) {
|
|
306
|
+
if (!t) return null;
|
|
307
|
+
let e = t.getBoundingClientRect();
|
|
308
|
+
return {
|
|
309
|
+
x: e.left,
|
|
310
|
+
y: e.bottom
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
let r = n.cloneRange();
|
|
314
|
+
r.collapse(!0);
|
|
315
|
+
let i = r.startContainer, a = r.startOffset;
|
|
316
|
+
if (i.nodeType === Node.TEXT_NODE && a > 0) {
|
|
317
|
+
let e = document.createRange();
|
|
318
|
+
e.setStart(i, a - 1), e.setEnd(i, a);
|
|
319
|
+
let t = e.getBoundingClientRect();
|
|
320
|
+
if (t.width > 0 || t.height > 0) return {
|
|
321
|
+
x: t.left,
|
|
322
|
+
y: t.bottom
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
let o = r.getBoundingClientRect();
|
|
326
|
+
if (o.width === 0 && o.height === 0 && o.x === 0) {
|
|
327
|
+
if (t) {
|
|
328
|
+
let e = t.getBoundingClientRect();
|
|
329
|
+
return {
|
|
330
|
+
x: e.left,
|
|
331
|
+
y: e.bottom
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
x: o.left,
|
|
338
|
+
y: o.bottom
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function ne(e, t) {
|
|
342
|
+
let n = x(e);
|
|
343
|
+
if (!n || !n.collapsed) return null;
|
|
344
|
+
let r = n.startContainer, i = n.startOffset;
|
|
345
|
+
if (r.nodeType !== Node.TEXT_NODE) return null;
|
|
346
|
+
let a = (r.textContent ?? "").slice(0, Math.max(0, i)), o = a.lastIndexOf(t);
|
|
347
|
+
return o === -1 ? null : a.slice(Math.max(0, o + 1));
|
|
348
|
+
}
|
|
349
|
+
function E(e, t) {
|
|
350
|
+
if (e.focus(), !t) return;
|
|
351
|
+
let n = e.querySelector(`[data-element-id="${t}"]`);
|
|
352
|
+
if (!n) return;
|
|
353
|
+
let r = n.nextSibling;
|
|
354
|
+
if (r && r.nodeType === Node.TEXT_NODE) {
|
|
355
|
+
let e = r.textContent ?? "", t = e.indexOf(" ");
|
|
356
|
+
S(r, t === -1 ? e.length : t + 1);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
let i = document.getSelection();
|
|
360
|
+
if (!i) return;
|
|
361
|
+
let a = document.createRange();
|
|
362
|
+
a.setStartAfter(n), a.collapse(!0), i.removeAllRanges(), i.addRange(a);
|
|
363
|
+
}
|
|
364
|
+
function re(e, t, n, r) {
|
|
365
|
+
let i = x(e);
|
|
366
|
+
if (i) {
|
|
367
|
+
let e = i.startContainer, r = i.startOffset;
|
|
368
|
+
if (e.nodeType === Node.TEXT_NODE && t.contains(e)) {
|
|
369
|
+
let t = e.textContent ?? "", i = t.slice(0, Math.max(0, r)).lastIndexOf(n);
|
|
370
|
+
if (i !== -1) {
|
|
371
|
+
e.textContent = t.slice(0, Math.max(0, i)) + t.slice(Math.max(0, r)), S(e, i);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
let a = n + (r ?? ""), o = document.createTreeWalker(t, NodeFilter.SHOW_TEXT), s;
|
|
377
|
+
for (; s = o.nextNode();) {
|
|
378
|
+
let e = s.textContent ?? "", n = e.lastIndexOf(a);
|
|
379
|
+
if (n !== -1) {
|
|
380
|
+
s.textContent = e.slice(0, Math.max(0, n)) + e.slice(Math.max(0, n + a.length)), t.focus(), S(s, n);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/components/prompt-box/types.ts
|
|
387
|
+
var D = "application/x-luzmo-element", O = class {
|
|
388
|
+
constructor(e) {
|
|
389
|
+
this._elements = /* @__PURE__ */ new Map(), this._idCounter = 0, this._dragCaret = null, this.isDragOver = !1, this.richInputElement = null, this.handleRichInput = () => {
|
|
390
|
+
this.syncValue(), this._host.dispatchEvent(new Event("input", {
|
|
391
|
+
bubbles: !0,
|
|
392
|
+
composed: !0
|
|
393
|
+
}));
|
|
394
|
+
}, this.handleRichPaste = (e) => {
|
|
395
|
+
if (e.preventDefault(), this._cannotEditRichContent()) return;
|
|
396
|
+
if (this._host.allowImages && e.clipboardData && this._host.handlePastedImages(e.clipboardData)) {
|
|
397
|
+
e.stopPropagation();
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
let t = e.clipboardData?.getData("text/plain") ?? "";
|
|
401
|
+
if (t) {
|
|
402
|
+
let e = x(this._host.shadowRoot);
|
|
403
|
+
if (e) {
|
|
404
|
+
e.deleteContents(), e.insertNode(document.createTextNode(t)), e.collapse(!1);
|
|
405
|
+
let n = document.getSelection();
|
|
406
|
+
n && (n.removeAllRanges(), n.addRange(e));
|
|
407
|
+
}
|
|
408
|
+
this.syncValue(), this._host.dispatchEvent(new Event("input", {
|
|
409
|
+
bubbles: !0,
|
|
410
|
+
composed: !0
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
}, this.handleRichDragOver = (e) => {
|
|
414
|
+
this._cannotEditRichContent() || e.dataTransfer?.types.includes("application/x-luzmo-element") && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), this.isDragOver = !0, this._host.requestUpdate(), this._positionCaretAtPoint(e.clientX, e.clientY), this._showDragCaret(e.clientX, e.clientY));
|
|
415
|
+
}, this.handleRichDragLeave = (e) => {
|
|
416
|
+
let t = e.relatedTarget;
|
|
417
|
+
(!t || !this.richInputElement?.contains(t)) && (this.isDragOver = !1, this._hideDragCaret(), this._host.requestUpdate());
|
|
418
|
+
}, this.handleRichDrop = (e) => {
|
|
419
|
+
if (e.preventDefault(), this.isDragOver = !1, this._hideDragCaret(), this._cannotEditRichContent()) {
|
|
420
|
+
this._host.requestUpdate();
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
let t = e.dataTransfer?.getData(D);
|
|
424
|
+
if (!t) {
|
|
425
|
+
this._host.requestUpdate();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
let n = JSON.parse(t);
|
|
430
|
+
if (n.elementType && n.label) {
|
|
431
|
+
this.richInputElement?.focus();
|
|
432
|
+
let t = this.richInputElement ? b(this._host.shadowRoot, this.richInputElement, e.clientX, e.clientY, this._dragCaret) : null;
|
|
433
|
+
this._insertElementAtRange(n.elementType, n.label, n.data ?? null, void 0, t);
|
|
434
|
+
}
|
|
435
|
+
this._host.requestUpdate();
|
|
436
|
+
} catch {
|
|
437
|
+
this._host.requestUpdate();
|
|
438
|
+
}
|
|
439
|
+
}, this._host = e, e.addController(this);
|
|
440
|
+
}
|
|
441
|
+
hostConnected() {}
|
|
442
|
+
hostDisconnected() {}
|
|
443
|
+
get elements() {
|
|
444
|
+
return this._elements;
|
|
445
|
+
}
|
|
446
|
+
get elementCount() {
|
|
447
|
+
return this._elements.size;
|
|
448
|
+
}
|
|
449
|
+
getSegments() {
|
|
450
|
+
return !this._host.allowElements || !this.richInputElement ? [{
|
|
451
|
+
type: "text",
|
|
452
|
+
value: this._host.value
|
|
453
|
+
}] : this._parseSegments();
|
|
454
|
+
}
|
|
455
|
+
setSegments(e) {
|
|
456
|
+
if (!this._host.allowElements) {
|
|
457
|
+
this._host.value = this._segmentsToPlainText(e);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this._elements.clear(), this._host.updateComplete.then(() => {
|
|
461
|
+
if (this.richInputElement) {
|
|
462
|
+
this.richInputElement.innerHTML = "";
|
|
463
|
+
for (let t of e) if (t.type === "text" && t.value) this.richInputElement.append(document.createTextNode(t.value));
|
|
464
|
+
else if (t.type === "element" && t.value) {
|
|
465
|
+
let e = { ...t.value };
|
|
466
|
+
e.id ||= this._generateId(), this._elements.set(e.id, e), this.richInputElement.append(this._createBadgeNode(e));
|
|
467
|
+
}
|
|
468
|
+
this.syncValue();
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
insertElement(e, t, n, r) {
|
|
473
|
+
return this._insertElementAtRange(e, t, n, r, null);
|
|
474
|
+
}
|
|
475
|
+
_insertElementAtRange(e, t, n, r, i) {
|
|
476
|
+
if (this._cannotEditRichContent() || this._host.acceptedElementTypes.length > 0 && !this._host.acceptedElementTypes.includes(e) || !this.richInputElement) return "";
|
|
477
|
+
let a = this._generateId(), o = {
|
|
478
|
+
id: a,
|
|
479
|
+
elementType: e,
|
|
480
|
+
label: t,
|
|
481
|
+
data: n,
|
|
482
|
+
icon: r
|
|
483
|
+
};
|
|
484
|
+
this._elements.set(a, o);
|
|
485
|
+
let s = this._createBadgeNode(o), c = this.richInputElement, l = !1, u = i === null ? this._getSelectionRange() : i;
|
|
486
|
+
if (u && c.contains(u.commonAncestorContainer)) {
|
|
487
|
+
u.deleteContents(), u.insertNode(s);
|
|
488
|
+
let e = s.previousSibling;
|
|
489
|
+
if (e?.nodeType === Node.TEXT_NODE) {
|
|
490
|
+
let t = e.previousSibling;
|
|
491
|
+
t?.classList?.contains("element-badge") && this._ensureSpaceAfter(t);
|
|
492
|
+
}
|
|
493
|
+
this._ensureSpaceAfter(s), E(c, a), l = !0;
|
|
494
|
+
}
|
|
495
|
+
return l || (c.append(s), this._ensureSpaceAfter(s), E(c, a)), this.syncValue(), this._host.dispatchEvent(new CustomEvent("luzmo-element-inserted", {
|
|
496
|
+
bubbles: !0,
|
|
497
|
+
composed: !0,
|
|
498
|
+
detail: { element: o }
|
|
499
|
+
})), a;
|
|
500
|
+
}
|
|
501
|
+
_getSelectionRange() {
|
|
502
|
+
return x(this._host.shadowRoot);
|
|
503
|
+
}
|
|
504
|
+
removeElement(e) {
|
|
505
|
+
let t = this._elements.get(e);
|
|
506
|
+
if (!t) return;
|
|
507
|
+
this._elements.delete(e);
|
|
508
|
+
let n = this.richInputElement?.querySelector(`[data-element-id="${e}"]`);
|
|
509
|
+
if (n) {
|
|
510
|
+
let e = n.nextSibling;
|
|
511
|
+
if (n.remove(), e && e.nodeType === Node.TEXT_NODE) {
|
|
512
|
+
let t = (e.textContent ?? "").replaceAll("", "");
|
|
513
|
+
t ? e.textContent = t : e.remove();
|
|
514
|
+
}
|
|
515
|
+
this.syncValue();
|
|
516
|
+
}
|
|
517
|
+
this._host.dispatchEvent(new CustomEvent("luzmo-element-removed", {
|
|
518
|
+
bubbles: !0,
|
|
519
|
+
composed: !0,
|
|
520
|
+
detail: { element: t }
|
|
521
|
+
}));
|
|
522
|
+
}
|
|
523
|
+
getElements() {
|
|
524
|
+
return [...this._elements.values()];
|
|
525
|
+
}
|
|
526
|
+
clearElements() {
|
|
527
|
+
this._elements.clear(), this.richInputElement && (this.richInputElement.innerHTML = "");
|
|
528
|
+
}
|
|
529
|
+
handleBadgeDelete(e) {
|
|
530
|
+
let t = x(this._host.shadowRoot);
|
|
531
|
+
if (!t || !t.collapsed) return !1;
|
|
532
|
+
let n = e === "Backspace" ? this._findBadgeBefore(t.startContainer, t.startOffset) : e === "Delete" ? this._findBadgeAfter(t.startContainer, t.startOffset) : null;
|
|
533
|
+
return n?.dataset.elementId ? (this.removeElement(n.dataset.elementId), !0) : !1;
|
|
534
|
+
}
|
|
535
|
+
_findBadgeBefore(e, t) {
|
|
536
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
537
|
+
let n = e.childNodes[t - 1];
|
|
538
|
+
if (n?.classList?.contains("element-badge")) return n;
|
|
539
|
+
} else if (e.nodeType === Node.TEXT_NODE) if (t === 0) {
|
|
540
|
+
let t = e.previousSibling;
|
|
541
|
+
if (t?.classList?.contains("element-badge")) return t;
|
|
542
|
+
} else {
|
|
543
|
+
let n = (e.textContent ?? "").slice(0, t);
|
|
544
|
+
if (/^[\u200B\uFEFF]*$/.test(n)) {
|
|
545
|
+
let t = e.previousSibling;
|
|
546
|
+
if (t?.classList?.contains("element-badge")) return t;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
_findBadgeAfter(e, t) {
|
|
552
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
553
|
+
let n = e.childNodes[t];
|
|
554
|
+
if (n?.classList?.contains("element-badge")) return n;
|
|
555
|
+
} else if (e.nodeType === Node.TEXT_NODE) {
|
|
556
|
+
let n = e.textContent ?? "";
|
|
557
|
+
if (t === n.length) {
|
|
558
|
+
let t = e.nextSibling;
|
|
559
|
+
if (t?.classList?.contains("element-badge")) return t;
|
|
560
|
+
} else {
|
|
561
|
+
let r = n.slice(t);
|
|
562
|
+
if (/^[\u200B\uFEFF]*$/.test(r)) {
|
|
563
|
+
let t = e.nextSibling;
|
|
564
|
+
if (t?.classList?.contains("element-badge")) return t;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
_segmentsToPlainText(e) {
|
|
571
|
+
return e.map((e) => e.type === "text" ? e.value ?? "" : e.value?.label ?? "").join("");
|
|
572
|
+
}
|
|
573
|
+
_cannotEditRichContent() {
|
|
574
|
+
return !this._host.allowElements || this._host.disabled || this._host.readonly || this._host.pending;
|
|
575
|
+
}
|
|
576
|
+
_cleanupSemanticallyEmptyRichInput(e) {
|
|
577
|
+
let t = this.richInputElement;
|
|
578
|
+
if (!t) return;
|
|
579
|
+
let n = this._elements.size === 0 && e.trim().length === 0, r = this._dragCaret?.parentNode === t;
|
|
580
|
+
!n || r || t.innerHTML === "" || (t.innerHTML = "", this._host.value = "");
|
|
581
|
+
}
|
|
582
|
+
syncValue() {
|
|
583
|
+
if (!this.richInputElement) return;
|
|
584
|
+
let e = this._parseSegments(), t = this._segmentsToPlainText(e);
|
|
585
|
+
this._host.value = t, this._cleanupSemanticallyEmptyRichInput(t), this._host.requestUpdate();
|
|
586
|
+
}
|
|
587
|
+
_parseSegments() {
|
|
588
|
+
if (!this.richInputElement) return [];
|
|
589
|
+
let e = [];
|
|
590
|
+
for (let t of this.richInputElement.childNodes) if (t.nodeType === Node.TEXT_NODE) {
|
|
591
|
+
let n = (t.textContent ?? "").replaceAll("", "");
|
|
592
|
+
n && e.push({
|
|
593
|
+
type: "text",
|
|
594
|
+
value: n
|
|
595
|
+
});
|
|
596
|
+
} else if (t.nodeType === Node.ELEMENT_NODE) {
|
|
597
|
+
let n = t;
|
|
598
|
+
if (n.classList.contains("drag-caret")) continue;
|
|
599
|
+
if (n.classList.contains("element-badge")) {
|
|
600
|
+
let t = n.dataset.elementId ?? "", r = this._elements.get(t);
|
|
601
|
+
r && e.push({
|
|
602
|
+
type: "element",
|
|
603
|
+
value: { ...r }
|
|
604
|
+
});
|
|
605
|
+
} else if (n.tagName === "BR") e.push({
|
|
606
|
+
type: "text",
|
|
607
|
+
value: "\n"
|
|
608
|
+
});
|
|
609
|
+
else {
|
|
610
|
+
let t = n.textContent ?? "";
|
|
611
|
+
t && e.push({
|
|
612
|
+
type: "text",
|
|
613
|
+
value: t
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return e;
|
|
618
|
+
}
|
|
619
|
+
_createBadgeNode(e) {
|
|
620
|
+
let t = document.createElement("span");
|
|
621
|
+
if (t.className = "element-badge", t.setAttribute("contenteditable", "false"), t.dataset.elementId = e.id, t.dataset.elementType = e.elementType, e.icon) {
|
|
622
|
+
let n = document.createElement("luzmo-icon");
|
|
623
|
+
n.icon = e.icon, n.setAttribute("size", "xxs"), n.className = "element-badge-icon", t.append(n);
|
|
624
|
+
}
|
|
625
|
+
let n = document.createElement("span");
|
|
626
|
+
n.className = "element-badge-label", n.textContent = e.label, t.append(n);
|
|
627
|
+
let r = document.createElement("button");
|
|
628
|
+
return r.type = "button", r.setAttribute("role", "button"), r.tabIndex = -1, r.className = "element-badge-remove", r.setAttribute("contenteditable", "false"), r.setAttribute("aria-label", `Remove ${e.label}`), r.textContent = "×", r.addEventListener("click", (t) => {
|
|
629
|
+
t.preventDefault(), t.stopPropagation(), this.removeElement(e.id);
|
|
630
|
+
}), t.append(r), t;
|
|
631
|
+
}
|
|
632
|
+
_ensureSpaceAfter(e) {
|
|
633
|
+
let t = e.nextSibling;
|
|
634
|
+
if (t && t.nodeType === Node.TEXT_NODE && t.textContent) {
|
|
635
|
+
let e = t.textContent;
|
|
636
|
+
if (e.startsWith("") && e.length > 1) return;
|
|
637
|
+
if (e.startsWith(" ")) {
|
|
638
|
+
t.textContent = "" + e;
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (/^\u200B+$/.test(e)) {
|
|
642
|
+
t.textContent = e + " ";
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
e.parentNode?.insertBefore(document.createTextNode(" "), t ?? null);
|
|
647
|
+
}
|
|
648
|
+
_showDragCaret(e, t) {
|
|
649
|
+
if (!this.richInputElement) {
|
|
650
|
+
this._hideDragCaret();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
let n = b(this._host.shadowRoot, this.richInputElement, e, t, this._dragCaret);
|
|
654
|
+
if (!n) {
|
|
655
|
+
this._hideDragCaret();
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
let r = n.getBoundingClientRect(), i = this.richInputElement.getBoundingClientRect(), a = r.left - i.left + this.richInputElement.scrollLeft, o = r.top - i.top + this.richInputElement.scrollTop, s = r.height;
|
|
659
|
+
if (s === 0) {
|
|
660
|
+
let e = getComputedStyle(this.richInputElement);
|
|
661
|
+
s = Number.parseFloat(e.lineHeight) || Number.parseFloat(e.fontSize) || 16, o = t - i.top + this.richInputElement.scrollTop - s / 2;
|
|
662
|
+
}
|
|
663
|
+
this._dragCaret || (this._dragCaret = document.createElement("div"), this._dragCaret.className = "drag-caret");
|
|
664
|
+
let c = this._dragCaret;
|
|
665
|
+
c.style.position = "absolute", c.style.top = `${o}px`, c.style.left = `${a}px`, c.style.height = `${s}px`, c.parentNode || (this.richInputElement.style.position = "relative", this.richInputElement.append(c));
|
|
666
|
+
}
|
|
667
|
+
_hideDragCaret() {
|
|
668
|
+
this._dragCaret?.remove();
|
|
669
|
+
}
|
|
670
|
+
_generateId() {
|
|
671
|
+
return `el-${++this._idCounter}-${Date.now()}`;
|
|
672
|
+
}
|
|
673
|
+
_positionCaretAtPoint(e, t) {
|
|
674
|
+
if (!this.richInputElement) return;
|
|
675
|
+
let n = b(this._host.shadowRoot, this.richInputElement, e, t, this._dragCaret);
|
|
676
|
+
if (n) {
|
|
677
|
+
let e = document.getSelection();
|
|
678
|
+
e && (e.removeAllRanges(), e.addRange(n));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}, k = class {
|
|
682
|
+
constructor(e) {
|
|
683
|
+
this._triggers = [], this.activeTrigger = null, this.searchString = "", this.virtualElement = null, this.highlightedIndex = 0, this.pointerMovedSinceKeyNav = !0, this.hoveredIndex = -1, this.filteredOptions = [], this.richInputElement = null, this.handleOverlayClosed = () => {
|
|
684
|
+
this.close();
|
|
685
|
+
}, this.handleOverlayKeydown = (e) => {
|
|
686
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close(), this.richInputElement?.focus());
|
|
687
|
+
}, this.handlePointerMove = () => {
|
|
688
|
+
this.pointerMovedSinceKeyNav = !0;
|
|
689
|
+
}, this._handleTriggerSelect = (e) => {
|
|
690
|
+
if (!this.activeTrigger) return;
|
|
691
|
+
let { elementType: t, label: n, data: r, icon: i } = e.detail;
|
|
692
|
+
this.selectOption({
|
|
693
|
+
label: n,
|
|
694
|
+
value: n,
|
|
695
|
+
data: r,
|
|
696
|
+
icon: i,
|
|
697
|
+
elementType: t
|
|
698
|
+
});
|
|
699
|
+
}, this._handleDocumentPointerDown = (e) => {
|
|
700
|
+
let t = e.composedPath(), n = this._host.shadowRoot?.querySelector("luzmo-overlay[part=\"trigger-menu-overlay\"]");
|
|
701
|
+
n && t.includes(n) || this.richInputElement && t.includes(this.richInputElement) || (this.close(), this.richInputElement?.focus());
|
|
702
|
+
}, this._host = e, e.addController(this);
|
|
703
|
+
}
|
|
704
|
+
hostConnected() {
|
|
705
|
+
this._host.addEventListener("luzmo-trigger-select", this._handleTriggerSelect);
|
|
706
|
+
}
|
|
707
|
+
hostDisconnected() {
|
|
708
|
+
document.removeEventListener("pointerdown", this._handleDocumentPointerDown, !0), this._host.removeEventListener("luzmo-trigger-select", this._handleTriggerSelect);
|
|
709
|
+
}
|
|
710
|
+
get triggers() {
|
|
711
|
+
return this._triggers;
|
|
712
|
+
}
|
|
713
|
+
set triggers(e) {
|
|
714
|
+
this._triggers = e, this.activeTrigger && this._updateFilteredOptions();
|
|
715
|
+
}
|
|
716
|
+
get activeConfig() {
|
|
717
|
+
if (this.activeTrigger) return this._triggers.find((e) => e.key === this.activeTrigger);
|
|
718
|
+
}
|
|
719
|
+
get hasTriggers() {
|
|
720
|
+
return this._triggers.length > 0;
|
|
721
|
+
}
|
|
722
|
+
getSlotName(e) {
|
|
723
|
+
return this._triggers.find((t) => t.key === e)?.slotName;
|
|
724
|
+
}
|
|
725
|
+
get allSlotNames() {
|
|
726
|
+
return this._triggers.map((e) => e.slotName).filter((e) => !!e);
|
|
727
|
+
}
|
|
728
|
+
handleInput(e) {
|
|
729
|
+
if (this.activeTrigger) {
|
|
730
|
+
let e = ne(this._host.shadowRoot, this.activeTrigger) ?? this._extractTriggerSearchFromContent(this.activeTrigger);
|
|
731
|
+
e === null ? this.close() : (this.searchString = e, this._updateFilteredOptions(), this.highlightedIndex = this._findSelectableIndex(0, 1), this._dispatchChange(!0), this._host.requestUpdate(), document.dispatchEvent(new Event("luzmo-update-overlays")));
|
|
732
|
+
} else this._detectTrigger(e);
|
|
733
|
+
}
|
|
734
|
+
open(e) {
|
|
735
|
+
if (!this._triggers.find((t) => t.key === e)) return;
|
|
736
|
+
let t = T(this._host.shadowRoot, this.richInputElement);
|
|
737
|
+
if (!t) return;
|
|
738
|
+
this.activeTrigger = e, this.searchString = "", this._updateFilteredOptions(), this.highlightedIndex = this._findSelectableIndex(0, 1);
|
|
739
|
+
let n = this.richInputElement?.getBoundingClientRect().top ?? t.y;
|
|
740
|
+
this.virtualElement ? this.virtualElement.updateBoundingClientRect(t.x, t.y, n) : this.virtualElement = new r(t.x, t.y, n), this._dispatchChange(!0), this._host.requestUpdate(), requestAnimationFrame(() => {
|
|
741
|
+
document.addEventListener("pointerdown", this._handleDocumentPointerDown, !0);
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
close() {
|
|
745
|
+
if (this.activeTrigger === null) return;
|
|
746
|
+
document.removeEventListener("pointerdown", this._handleDocumentPointerDown, !0);
|
|
747
|
+
let e = this.activeTrigger;
|
|
748
|
+
this.activeTrigger = null, this.searchString = "", this.filteredOptions = [], this.highlightedIndex = 0, this.hoveredIndex = -1, this._host.dispatchEvent(new CustomEvent("luzmo-trigger-change", {
|
|
749
|
+
bubbles: !0,
|
|
750
|
+
composed: !0,
|
|
751
|
+
detail: {
|
|
752
|
+
trigger: e,
|
|
753
|
+
open: !1,
|
|
754
|
+
searchString: ""
|
|
755
|
+
}
|
|
756
|
+
})), this._host.requestUpdate();
|
|
757
|
+
}
|
|
758
|
+
handleKeydown(e) {
|
|
759
|
+
return this.activeTrigger ? e.key === "Escape" ? (e.preventDefault(), this.close(), this.richInputElement?.focus(), !0) : e.key === "Tab" ? (this.close(), !1) : e.key === "ArrowDown" ? (e.preventDefault(), this._moveHighlight(1), !0) : e.key === "ArrowUp" ? (e.preventDefault(), this._moveHighlight(-1), !0) : e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), this._selectHighlighted(), !0) : !1 : !1;
|
|
760
|
+
}
|
|
761
|
+
_detectTrigger(e) {
|
|
762
|
+
if (this._host.disabled || this._host.readonly || this._host.pending) return;
|
|
763
|
+
let t = e?.data ?? "";
|
|
764
|
+
t.length !== 1 || !this._isTriggerKey(t) || w(this._host.shadowRoot) && this.open(t);
|
|
765
|
+
}
|
|
766
|
+
_extractTriggerSearchFromContent(e) {
|
|
767
|
+
let t = this.richInputElement?.textContent ?? "";
|
|
768
|
+
if (!t) return null;
|
|
769
|
+
let n = t.lastIndexOf(e);
|
|
770
|
+
if (n === -1) return null;
|
|
771
|
+
let r = t.slice(n + 1);
|
|
772
|
+
return r.includes(" ") || r.includes("\n") ? null : r;
|
|
773
|
+
}
|
|
774
|
+
_isTriggerKey(e) {
|
|
775
|
+
return this._triggers.some((t) => t.key === e);
|
|
776
|
+
}
|
|
777
|
+
_updateFilteredOptions() {
|
|
778
|
+
let e = this.activeConfig;
|
|
779
|
+
if (!e?.options) {
|
|
780
|
+
this.filteredOptions = [];
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
if (e.lazy) {
|
|
784
|
+
this.filteredOptions = e.options;
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
if (!this.searchString) {
|
|
788
|
+
this.filteredOptions = e.options;
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
let t = this.searchString.toLowerCase(), n = [], r = null;
|
|
792
|
+
for (let i of e.options) {
|
|
793
|
+
if (i.header) {
|
|
794
|
+
r = i;
|
|
795
|
+
continue;
|
|
796
|
+
}
|
|
797
|
+
(i.label.toLowerCase().includes(t) || (i.description?.toLowerCase().includes(t) ?? !1)) && (r &&= (n.push(r), null), n.push(i));
|
|
798
|
+
}
|
|
799
|
+
this.filteredOptions = n;
|
|
800
|
+
}
|
|
801
|
+
_findSelectableIndex(e, t) {
|
|
802
|
+
let n = this.filteredOptions.length;
|
|
803
|
+
if (n === 0) return -1;
|
|
804
|
+
let r = (e % n + n) % n;
|
|
805
|
+
for (let e = 0; e < n; e++) {
|
|
806
|
+
if (!this.filteredOptions[r].header) return r;
|
|
807
|
+
r = ((r + t) % n + n) % n;
|
|
808
|
+
}
|
|
809
|
+
return -1;
|
|
810
|
+
}
|
|
811
|
+
_moveHighlight(e) {
|
|
812
|
+
let t = this.filteredOptions.length;
|
|
813
|
+
if (t === 0) return;
|
|
814
|
+
let n = (this.highlightedIndex + e + t) % t;
|
|
815
|
+
n = this._findSelectableIndex(n, e), n !== -1 && (this.pointerMovedSinceKeyNav = !1, this.hoveredIndex = -1, this.highlightedIndex = n, this._host.requestUpdate(), requestAnimationFrame(() => {
|
|
816
|
+
this._host.shadowRoot?.querySelector(".trigger-option.highlighted")?.scrollIntoView({ block: "nearest" });
|
|
817
|
+
}));
|
|
818
|
+
}
|
|
819
|
+
_selectHighlighted() {
|
|
820
|
+
let e = this.filteredOptions[this.highlightedIndex];
|
|
821
|
+
if (!e) {
|
|
822
|
+
this.close();
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
this.selectOption(e);
|
|
826
|
+
}
|
|
827
|
+
selectOption(e) {
|
|
828
|
+
if (!this.activeTrigger || !this.richInputElement) return;
|
|
829
|
+
let t = this.activeTrigger, n = this.richInputElement, r = this._host.shadowRoot;
|
|
830
|
+
re(r, n, t, this.searchString);
|
|
831
|
+
let i = e.elementType ?? t, a = this._host.insertElement(i, e.label, e.data ?? null, e.icon);
|
|
832
|
+
E(n, a), this.close(), this._host.updateComplete.then(() => {
|
|
833
|
+
requestAnimationFrame(() => {
|
|
834
|
+
E(n, a);
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
_dispatchChange(e) {
|
|
839
|
+
this.activeTrigger && this._host.dispatchEvent(new CustomEvent("luzmo-trigger-change", {
|
|
840
|
+
bubbles: !0,
|
|
841
|
+
composed: !0,
|
|
842
|
+
detail: {
|
|
843
|
+
trigger: this.activeTrigger,
|
|
844
|
+
open: e,
|
|
845
|
+
searchString: this.searchString
|
|
846
|
+
}
|
|
847
|
+
}));
|
|
848
|
+
}
|
|
849
|
+
}, A = !1, j = 0;
|
|
850
|
+
function M() {
|
|
851
|
+
A = !0;
|
|
852
|
+
}
|
|
853
|
+
function N() {
|
|
854
|
+
A = !1;
|
|
855
|
+
}
|
|
856
|
+
function P() {
|
|
857
|
+
document.addEventListener("keydown", M, !0), document.addEventListener("mousedown", N, !0), document.addEventListener("pointerdown", N, !0);
|
|
858
|
+
}
|
|
859
|
+
function F() {
|
|
860
|
+
document.removeEventListener("keydown", M, !0), document.removeEventListener("mousedown", N, !0), document.removeEventListener("pointerdown", N, !0);
|
|
861
|
+
}
|
|
862
|
+
function I() {
|
|
863
|
+
j === 0 && typeof window < "u" && P(), j++;
|
|
864
|
+
}
|
|
865
|
+
function L() {
|
|
866
|
+
j--, j <= 0 && (j = 0, F());
|
|
867
|
+
}
|
|
868
|
+
function R() {
|
|
869
|
+
return A;
|
|
870
|
+
}
|
|
871
|
+
//#endregion
|
|
872
|
+
//#region src/components/prompt-box/prompt-box-templates.ts
|
|
873
|
+
function z(e, t, n) {
|
|
874
|
+
return a`
|
|
875
|
+
<div class="top-actions ${t ? "" : "empty"}" part="top-actions">
|
|
876
|
+
<slot name="top-actions" @slotchange=${n}></slot>
|
|
877
|
+
</div>
|
|
878
|
+
`;
|
|
879
|
+
}
|
|
880
|
+
function B(e, t, n) {
|
|
881
|
+
return a`
|
|
882
|
+
<div
|
|
883
|
+
class="bottom-actions ${t ? "" : "empty"}"
|
|
884
|
+
part="bottom-actions"
|
|
885
|
+
>
|
|
886
|
+
<slot name="bottom-actions" @slotchange=${n}></slot>
|
|
887
|
+
</div>
|
|
888
|
+
`;
|
|
889
|
+
}
|
|
890
|
+
function V(e) {
|
|
891
|
+
let t = [];
|
|
892
|
+
for (let n = 0; n < 5; n++) {
|
|
893
|
+
let r = 1 - Math.abs(n - 2) * .15, i = .3 + e.recordingController.audioLevel * .7 * r, o = Math.max(.2, Math.min(1, i));
|
|
894
|
+
t.push(a`
|
|
895
|
+
<span class="waveform-bar" style="--bar-height: ${o}"></span>
|
|
896
|
+
`);
|
|
897
|
+
}
|
|
898
|
+
return a`
|
|
899
|
+
<div class="waveform" part="waveform" aria-hidden="true">${t}</div>
|
|
900
|
+
`;
|
|
901
|
+
}
|
|
902
|
+
function H(e) {
|
|
903
|
+
let t = e.handleRecordButtonSlotChange, n = e.hasRecordButton, r = e.recordingController.isRecording, i = () => {
|
|
904
|
+
e.recordingController.cancel();
|
|
905
|
+
}, o = (t) => {
|
|
906
|
+
e.handleRecordClick(t);
|
|
907
|
+
};
|
|
908
|
+
return n || !e.recording ? a`<slot name="record-button" @slotchange=${t}></slot>` : r ? a`
|
|
909
|
+
<slot name="record-button" @slotchange=${t}></slot>
|
|
910
|
+
<div class="recording-ui" part="recording-ui">
|
|
911
|
+
<luzmo-action-button
|
|
912
|
+
class="cancel-recording-button"
|
|
913
|
+
part="cancel-recording-button"
|
|
914
|
+
.size=${e.size}
|
|
915
|
+
?disabled=${e.disabled}
|
|
916
|
+
@click=${i}
|
|
917
|
+
aria-label="Cancel recording"
|
|
918
|
+
>
|
|
919
|
+
<luzmo-icon
|
|
920
|
+
slot="icon"
|
|
921
|
+
.icon=${m}
|
|
922
|
+
.size=${e.size}
|
|
923
|
+
></luzmo-icon>
|
|
924
|
+
</luzmo-action-button>
|
|
925
|
+
${V(e)}
|
|
926
|
+
<span class="recording-duration" part="recording-duration">
|
|
927
|
+
${e.recordingController.formatDuration()}
|
|
928
|
+
</span>
|
|
929
|
+
<luzmo-button
|
|
930
|
+
class="finish-recording-button"
|
|
931
|
+
part="finish-recording-button"
|
|
932
|
+
.size=${e.size}
|
|
933
|
+
icon-only
|
|
934
|
+
variant="primary"
|
|
935
|
+
?disabled=${e.disabled}
|
|
936
|
+
@click=${o}
|
|
937
|
+
aria-label="Finish recording"
|
|
938
|
+
>
|
|
939
|
+
<luzmo-icon slot="icon" .icon=${p}></luzmo-icon>
|
|
940
|
+
</luzmo-button>
|
|
941
|
+
</div>
|
|
942
|
+
` : a`
|
|
943
|
+
<slot name="record-button" @slotchange=${t}></slot>
|
|
944
|
+
<luzmo-action-button
|
|
945
|
+
class="record-button"
|
|
946
|
+
part="record-button"
|
|
947
|
+
quiet
|
|
948
|
+
.size=${e.size}
|
|
949
|
+
?disabled=${e.disabled}
|
|
950
|
+
?readonly=${e.pending}
|
|
951
|
+
@click=${o}
|
|
952
|
+
aria-label="Record"
|
|
953
|
+
>
|
|
954
|
+
<luzmo-icon
|
|
955
|
+
slot="icon"
|
|
956
|
+
.icon=${h}
|
|
957
|
+
.size=${e.size}
|
|
958
|
+
></luzmo-icon>
|
|
959
|
+
</luzmo-action-button>
|
|
960
|
+
`;
|
|
961
|
+
}
|
|
962
|
+
function U(e) {
|
|
963
|
+
let t = e.handleSubmitButtonSlotChange, n = e.recordingController.isRecording, r = () => {
|
|
964
|
+
e.submit();
|
|
965
|
+
};
|
|
966
|
+
if (n || e.hasSubmitButton || e.hideSubmit && !e.hasSubmitButton) return a`<slot name="submit-button" @slotchange=${t}></slot>`;
|
|
967
|
+
let i = !!e.value.trim() || e.richInputController.elementCount > 0;
|
|
968
|
+
return a`
|
|
969
|
+
<slot name="submit-button" @slotchange=${t}></slot>
|
|
970
|
+
<luzmo-button
|
|
971
|
+
class="submit-button"
|
|
972
|
+
part="submit-button"
|
|
973
|
+
.size=${e.size}
|
|
974
|
+
icon-only
|
|
975
|
+
variant="primary"
|
|
976
|
+
?disabled=${e.disabled || e.disableSubmit || !e.pending && !i}
|
|
977
|
+
?pending=${e.pending}
|
|
978
|
+
@click=${r}
|
|
979
|
+
label="Submit"
|
|
980
|
+
>
|
|
981
|
+
<luzmo-icon slot="icon" .icon=${f}></luzmo-icon>
|
|
982
|
+
</luzmo-button>
|
|
983
|
+
`;
|
|
984
|
+
}
|
|
985
|
+
function ie(e, t) {
|
|
986
|
+
if (!t) return e;
|
|
987
|
+
let n = e.toLowerCase().indexOf(t.toLowerCase());
|
|
988
|
+
return n === -1 ? e : a`${e.slice(0, n)}<mark class="trigger-option-highlight">${e.slice(n, n + t.length)}</mark>${e.slice(n + t.length)}`;
|
|
989
|
+
}
|
|
990
|
+
function W(e, t) {
|
|
991
|
+
return a`
|
|
992
|
+
<div
|
|
993
|
+
class="trigger-option-header"
|
|
994
|
+
part="trigger-option-header"
|
|
995
|
+
role="presentation"
|
|
996
|
+
>
|
|
997
|
+
${t?.iconTemplate ? a`<span class="trigger-option-header-icon">${t.iconTemplate(e)}</span>` : e.icon ? a`<luzmo-icon
|
|
998
|
+
class="trigger-option-header-icon"
|
|
999
|
+
.icon=${e.icon}
|
|
1000
|
+
size="s"
|
|
1001
|
+
></luzmo-icon>` : o}
|
|
1002
|
+
<span class="trigger-option-header-label">${e.label}</span>
|
|
1003
|
+
</div>
|
|
1004
|
+
`;
|
|
1005
|
+
}
|
|
1006
|
+
function G(e, t, n, r, i) {
|
|
1007
|
+
let s = () => {
|
|
1008
|
+
e.selectTriggerOption(t);
|
|
1009
|
+
}, c = () => {
|
|
1010
|
+
e.triggerMenuController.pointerMovedSinceKeyNav && (e.triggerMenuController.hoveredIndex = n, e.highlightTriggerOption(n));
|
|
1011
|
+
}, l = () => {
|
|
1012
|
+
e.triggerMenuController.hoveredIndex === n && (e.triggerMenuController.hoveredIndex = -1, e.requestUpdate());
|
|
1013
|
+
}, u = n === r, f = n === e.triggerMenuController.hoveredIndex, p = e.triggerMenuController.searchString, m = a`${i?.iconTemplate ? a`<span class="trigger-option-icon">${i.iconTemplate(t)}</span>` : t.icon ? a`<luzmo-icon
|
|
1014
|
+
class="trigger-option-icon"
|
|
1015
|
+
.icon=${t.icon}
|
|
1016
|
+
size="s"
|
|
1017
|
+
></luzmo-icon>` : o}
|
|
1018
|
+
<div class="trigger-option-content">
|
|
1019
|
+
<span class="trigger-option-label"
|
|
1020
|
+
>${i?.highlightSearch && p ? ie(t.label, p) : t.label}</span
|
|
1021
|
+
>
|
|
1022
|
+
${t.description ? a`<span class="trigger-option-description"
|
|
1023
|
+
>${t.description}</span
|
|
1024
|
+
>` : o}
|
|
1025
|
+
</div>`;
|
|
1026
|
+
return a`
|
|
1027
|
+
<div
|
|
1028
|
+
class="trigger-option ${u ? "highlighted" : ""} ${f ? "hovered" : ""} ${t.description ? "has-description" : ""}"
|
|
1029
|
+
part="trigger-option"
|
|
1030
|
+
role="option"
|
|
1031
|
+
aria-selected=${u}
|
|
1032
|
+
@click=${s}
|
|
1033
|
+
@pointerenter=${c}
|
|
1034
|
+
@pointerleave=${l}
|
|
1035
|
+
>
|
|
1036
|
+
${m}
|
|
1037
|
+
${u ? a`<luzmo-icon
|
|
1038
|
+
class="trigger-option-enter-icon"
|
|
1039
|
+
.icon=${d}
|
|
1040
|
+
size="s"
|
|
1041
|
+
></luzmo-icon>` : o}
|
|
1042
|
+
</div>
|
|
1043
|
+
`;
|
|
1044
|
+
}
|
|
1045
|
+
function K(e, t, n, r) {
|
|
1046
|
+
let i = [];
|
|
1047
|
+
for (let [a, o] of t.entries()) o.header ? i.push(W(o, r)) : i.push(G(e, o, a, n, r));
|
|
1048
|
+
return a`
|
|
1049
|
+
<div
|
|
1050
|
+
class="trigger-options"
|
|
1051
|
+
part="trigger-options"
|
|
1052
|
+
role="listbox"
|
|
1053
|
+
@pointermove=${e.triggerMenuController.handlePointerMove}
|
|
1054
|
+
>
|
|
1055
|
+
${i}
|
|
1056
|
+
</div>
|
|
1057
|
+
`;
|
|
1058
|
+
}
|
|
1059
|
+
function q(e) {
|
|
1060
|
+
return a`<slot name=${e} style="display: none;"></slot>`;
|
|
1061
|
+
}
|
|
1062
|
+
function J(e) {
|
|
1063
|
+
let t = e.triggerMenuController;
|
|
1064
|
+
if (!t.hasTriggers) {
|
|
1065
|
+
let e = [];
|
|
1066
|
+
for (let n of t.allSlotNames) e.push(q(n));
|
|
1067
|
+
return a`${e}`;
|
|
1068
|
+
}
|
|
1069
|
+
let n = t.activeConfig, r = n?.slotName ?? null, i = t.filteredOptions.length > 0, s = t.activeTrigger !== null, c = [];
|
|
1070
|
+
for (let e of t.allSlotNames) e !== r && c.push(q(e));
|
|
1071
|
+
return a`
|
|
1072
|
+
<luzmo-overlay
|
|
1073
|
+
part="trigger-menu-overlay"
|
|
1074
|
+
type="manual"
|
|
1075
|
+
placement="bottom-start"
|
|
1076
|
+
receives-focus="auto"
|
|
1077
|
+
.triggerElement=${t.virtualElement}
|
|
1078
|
+
.open=${s}
|
|
1079
|
+
@luzmo-closed=${t.handleOverlayClosed}
|
|
1080
|
+
@keydown=${t.handleOverlayKeydown}
|
|
1081
|
+
>
|
|
1082
|
+
${s && r ? a`<slot name=${r}></slot>` : o}
|
|
1083
|
+
${s && i ? K(e, t.filteredOptions, t.highlightedIndex, n) : o}
|
|
1084
|
+
</luzmo-overlay>
|
|
1085
|
+
${c}
|
|
1086
|
+
`;
|
|
1087
|
+
}
|
|
1088
|
+
function Y(e) {
|
|
1089
|
+
let t = !e.readonly && !e.pending && !e.disabled, n = e.richInputController;
|
|
1090
|
+
return a`
|
|
1091
|
+
<div
|
|
1092
|
+
class="rich-input"
|
|
1093
|
+
part="rich-input"
|
|
1094
|
+
contenteditable=${t ? "true" : "false"}
|
|
1095
|
+
role="textbox"
|
|
1096
|
+
aria-multiline="true"
|
|
1097
|
+
aria-label=${e.placeholder || "Enter your message"}
|
|
1098
|
+
data-placeholder=${e.placeholder}
|
|
1099
|
+
@input=${e.handleRichInputEvent}
|
|
1100
|
+
@keydown=${e.handleRichKeydown}
|
|
1101
|
+
@paste=${n.handleRichPaste}
|
|
1102
|
+
@dragover=${n.handleRichDragOver}
|
|
1103
|
+
@dragleave=${n.handleRichDragLeave}
|
|
1104
|
+
@drop=${n.handleRichDrop}
|
|
1105
|
+
@focusin=${e.handleInputFocusIn}
|
|
1106
|
+
@focusout=${e.handleInputFocusOut}
|
|
1107
|
+
></div>
|
|
1108
|
+
`;
|
|
1109
|
+
}
|
|
1110
|
+
function ae(e) {
|
|
1111
|
+
return e.allowElements ? Y(e) : a`
|
|
1112
|
+
<luzmo-text-field
|
|
1113
|
+
class="input-field"
|
|
1114
|
+
part="input"
|
|
1115
|
+
placeholder=${e.placeholder}
|
|
1116
|
+
.value=${e.value}
|
|
1117
|
+
.size=${e.size}
|
|
1118
|
+
rows=${e.rows}
|
|
1119
|
+
?grows=${e.grows}
|
|
1120
|
+
max-rows=${e.maxRows}
|
|
1121
|
+
?readonly=${e.readonly || e.pending || e.disabled}
|
|
1122
|
+
maxlength=${e.maxlength > 0 ? e.maxlength : -1}
|
|
1123
|
+
multiline
|
|
1124
|
+
quiet
|
|
1125
|
+
label=${e.placeholder || "Enter your message"}
|
|
1126
|
+
@input=${e.handleInput}
|
|
1127
|
+
@keydown=${e.handleKeydown}
|
|
1128
|
+
@focusin=${e.handleInputFocusIn}
|
|
1129
|
+
@focusout=${e.handleInputFocusOut}
|
|
1130
|
+
hide-validation-icons
|
|
1131
|
+
></luzmo-text-field>
|
|
1132
|
+
`;
|
|
1133
|
+
}
|
|
1134
|
+
function oe(e, t) {
|
|
1135
|
+
return a`
|
|
1136
|
+
<div class="image-attachment" part="image-attachment">
|
|
1137
|
+
<img
|
|
1138
|
+
src=${t.previewUrl || ""}
|
|
1139
|
+
alt=${t.file.name}
|
|
1140
|
+
class="image-preview"
|
|
1141
|
+
/>
|
|
1142
|
+
<luzmo-clear-button
|
|
1143
|
+
class="attachment-remove"
|
|
1144
|
+
.size=${e.size}
|
|
1145
|
+
?disabled=${e.disabled || e.pending}
|
|
1146
|
+
label="Remove ${t.file.name}"
|
|
1147
|
+
data-attachment-id=${t.id}
|
|
1148
|
+
@click=${(t) => {
|
|
1149
|
+
let n = t.currentTarget.dataset.attachmentId;
|
|
1150
|
+
n && e.attachmentsController.removeAttachment(n);
|
|
1151
|
+
}}
|
|
1152
|
+
></luzmo-clear-button>
|
|
1153
|
+
</div>
|
|
1154
|
+
`;
|
|
1155
|
+
}
|
|
1156
|
+
function se(e, t) {
|
|
1157
|
+
return a`
|
|
1158
|
+
<luzmo-tag
|
|
1159
|
+
class="file-attachment"
|
|
1160
|
+
part="file-attachment"
|
|
1161
|
+
.size=${e.tagSize}
|
|
1162
|
+
deletable
|
|
1163
|
+
?disabled=${e.disabled || e.pending}
|
|
1164
|
+
data-attachment-id=${t.id}
|
|
1165
|
+
@delete=${(t) => {
|
|
1166
|
+
let n = t.target.dataset.attachmentId;
|
|
1167
|
+
n && (t.preventDefault(), e.attachmentsController.removeAttachment(n));
|
|
1168
|
+
}}
|
|
1169
|
+
>
|
|
1170
|
+
${t.file.name}
|
|
1171
|
+
</luzmo-tag>
|
|
1172
|
+
`;
|
|
1173
|
+
}
|
|
1174
|
+
function ce(e) {
|
|
1175
|
+
let t = e.attachmentsController;
|
|
1176
|
+
if (!t.hasAttachments) return o;
|
|
1177
|
+
let n = t.imageAttachments, r = t.fileAttachments, i = [];
|
|
1178
|
+
for (let t of n) i.push(oe(e, t));
|
|
1179
|
+
let s = [];
|
|
1180
|
+
for (let t of r) s.push(se(e, t));
|
|
1181
|
+
return a`
|
|
1182
|
+
<div class="attachments" part="attachments">
|
|
1183
|
+
${n.length > 0 ? a`
|
|
1184
|
+
<div class="image-attachments" part="image-attachments">
|
|
1185
|
+
${i}
|
|
1186
|
+
</div>
|
|
1187
|
+
` : o}
|
|
1188
|
+
${r.length > 0 ? a`
|
|
1189
|
+
<luzmo-tags
|
|
1190
|
+
class="file-attachments"
|
|
1191
|
+
part="file-attachments"
|
|
1192
|
+
.size=${e.tagSize}
|
|
1193
|
+
>
|
|
1194
|
+
${s}
|
|
1195
|
+
</luzmo-tags>
|
|
1196
|
+
` : o}
|
|
1197
|
+
</div>
|
|
1198
|
+
`;
|
|
1199
|
+
}
|
|
1200
|
+
function le(e) {
|
|
1201
|
+
return !e.allowImages && !e.allowFiles ? o : a`
|
|
1202
|
+
<input
|
|
1203
|
+
type="file"
|
|
1204
|
+
class="hidden-file-input"
|
|
1205
|
+
accept=${e.attachmentsController.getAcceptAttribute()}
|
|
1206
|
+
multiple
|
|
1207
|
+
@change=${(t) => {
|
|
1208
|
+
let n = t.target;
|
|
1209
|
+
n.files?.length && e.attachmentsController.addFiles([...n.files]), n.value = "";
|
|
1210
|
+
}}
|
|
1211
|
+
aria-hidden="true"
|
|
1212
|
+
tabindex="-1"
|
|
1213
|
+
/>
|
|
1214
|
+
`;
|
|
1215
|
+
}
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region src/components/prompt-box/slot-state-sync.ts
|
|
1218
|
+
var X = "luzmo-button, luzmo-action-button, luzmo-switch, luzmo-picker, luzmo-picker-button, luzmo-select, luzmo-text-field, luzmo-number-field";
|
|
1219
|
+
function Z(e) {
|
|
1220
|
+
let t = [];
|
|
1221
|
+
return e.matches(X) && t.push(e), t.push(...e.querySelectorAll(X)), t;
|
|
1222
|
+
}
|
|
1223
|
+
function ue(e, t, n) {
|
|
1224
|
+
if (!e) return;
|
|
1225
|
+
let r = e.querySelector("slot[name=\"submit-button\"]");
|
|
1226
|
+
for (let e of r?.assignedElements() ?? []) for (let r of Z(e)) n ? (r.setAttribute("pending", ""), r.removeAttribute("disabled"), r.removeAttribute("readonly")) : t ? (r.removeAttribute("pending"), r.setAttribute("disabled", ""), r.removeAttribute("readonly")) : (r.removeAttribute("pending"), r.removeAttribute("disabled"), r.removeAttribute("readonly"));
|
|
1227
|
+
for (let r of [
|
|
1228
|
+
"slot[name=\"top-actions\"]",
|
|
1229
|
+
"slot[name=\"bottom-actions\"]",
|
|
1230
|
+
"slot[name=\"record-button\"]"
|
|
1231
|
+
]) {
|
|
1232
|
+
let i = e.querySelector(r);
|
|
1233
|
+
for (let e of i?.assignedElements() ?? []) for (let r of Z(e)) t ? (r.setAttribute("disabled", ""), r.removeAttribute("readonly")) : n ? (r.removeAttribute("disabled"), r.setAttribute("readonly", "")) : (r.removeAttribute("disabled"), r.removeAttribute("readonly"));
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
function Q(e) {
|
|
1237
|
+
let t = [], n = new Set([
|
|
1238
|
+
"luzmo-switch",
|
|
1239
|
+
"luzmo-checkbox",
|
|
1240
|
+
"luzmo-radio"
|
|
1241
|
+
]);
|
|
1242
|
+
for (let r of e) for (let e of Z(r)) {
|
|
1243
|
+
let r = {
|
|
1244
|
+
element: e,
|
|
1245
|
+
name: e.getAttribute("name") || e.getAttribute("label") || void 0
|
|
1246
|
+
};
|
|
1247
|
+
"value" in e && (r.value = e.value);
|
|
1248
|
+
let i = e.tagName.toLowerCase();
|
|
1249
|
+
n.has(i) && "checked" in e && (r.checked = e.checked), t.push(r);
|
|
1250
|
+
}
|
|
1251
|
+
return t;
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/components/prompt-box/prompt-box.module.scss?inline
|
|
1255
|
+
var de = ":host{font-family:var(--luzmo-prompt-box-font-family,var(--prompt-box-font-family));font-size:var(--luzmo-prompt-box-font-size,var(--prompt-box-font-size));line-height:var(--luzmo-prompt-box-line-height,var(--prompt-box-line-height));color:var(--highcontrast-prompt-box-text-color,var(--luzmo-prompt-box-text-color,var(--prompt-box-text-color)));flex-direction:column;width:100%;display:flex}:host([disabled]){opacity:var(--luzmo-prompt-box-disabled-opacity,var(--prompt-box-disabled-opacity));pointer-events:none}.container{gap:var(--luzmo-prompt-box-gap,var(--prompt-box-gap));padding:var(--luzmo-prompt-box-vertical-padding,var(--prompt-box-vertical-padding)) var(--luzmo-prompt-box-horizontal-padding,var(--prompt-box-horizontal-padding));background-color:var(--highcontrast-prompt-box-background-color,var(--luzmo-prompt-box-background-color,var(--prompt-box-background-color)));border-radius:var(--luzmo-prompt-box-border-radius,var(--prompt-box-border-radius));border-width:var(--luzmo-prompt-box-border-width,var(--prompt-box-border-width));border-style:solid;border-color:var(--highcontrast-prompt-box-border-color,var(--luzmo-prompt-box-border-color,var(--prompt-box-border-color)));box-shadow:var(--luzmo-prompt-box-shadow,var(--prompt-box-shadow));transition:border-color var(--luzmo-prompt-box-animation-duration,var(--prompt-box-animation-duration)) ease-in-out, box-shadow var(--luzmo-prompt-box-animation-duration,var(--prompt-box-animation-duration)) ease-in-out;flex-direction:column;display:flex}.container.input-focused{border-color:var(--highcontrast-prompt-box-border-color-focus,var(--luzmo-prompt-box-border-color-focus,var(--prompt-box-border-color-focus)))}.container.drag-over{border-color:var(--luzmo-prompt-box-border-color-drag,var(--luzmo-primary,#0064fa))}:host(:focus-visible) .container,:host(.focus-visible) .container{border-color:var(--highcontrast-prompt-box-border-color-focus,var(--luzmo-prompt-box-border-color-focus,var(--prompt-box-border-color-focus)));box-shadow:var(--luzmo-prompt-box-shadow-focus,var(--prompt-box-shadow-focus))}:host(:focus){outline:none}.top-actions{align-items:center;gap:var(--luzmo-prompt-box-top-actions-gap,var(--prompt-box-top-actions-gap));opacity:var(--luzmo-prompt-box-actions-opacity,var(--prompt-box-actions-opacity,1));transition:opacity var(--luzmo-prompt-box-animation-duration,var(--prompt-box-animation-duration)) ease-in-out;flex-wrap:wrap;display:flex}.top-actions.empty{display:none}.hidden-file-input{opacity:0;pointer-events:none;width:0;height:0;position:absolute;overflow:hidden}.attachments{gap:var(--luzmo-prompt-box-attachments-gap,var(--prompt-box-attachments-gap,8px));flex-direction:column;display:flex}.image-attachments{gap:var(--luzmo-prompt-box-image-attachments-gap,var(--prompt-box-image-attachments-gap,8px));flex-wrap:wrap;display:flex}.image-attachment{width:var(--luzmo-prompt-box-image-preview-size,var(--prompt-box-image-preview-size,80px));height:var(--luzmo-prompt-box-image-preview-size,var(--prompt-box-image-preview-size,80px));border-radius:var(--luzmo-prompt-box-image-border-radius,var(--prompt-box-image-border-radius,8px));background-color:var(--luzmo-prompt-box-image-background,var(--prompt-box-image-background,#0000000d));display:inline-flex;position:relative;overflow:hidden}.image-preview{object-fit:cover;width:100%;height:100%}.attachment-remove{width:var(--luzmo-prompt-box-remove-button-size,var(--prompt-box-remove-button-size,24px));height:var(--luzmo-prompt-box-remove-button-size,var(--prompt-box-remove-button-size,24px));background-color:var(--luzmo-prompt-box-remove-button-background,var(--prompt-box-remove-button-background,#00000080));--luzmo-clear-button-icon-color:var(--luzmo-prompt-box-remove-button-icon-color,var(--prompt-box-remove-button-icon-color,#fff));border-radius:50%;position:absolute;top:4px;right:4px}.attachment-remove:hover{background-color:var(--luzmo-prompt-box-remove-button-background-hover,var(--prompt-box-remove-button-background-hover,#000000b3))}.file-attachments{--luzmo-tag-border-radius:16px;gap:var(--luzmo-prompt-box-file-attachments-gap,var(--prompt-box-file-attachments-gap,4px));flex-wrap:wrap;display:flex}.file-attachment{text-overflow:ellipsis;white-space:nowrap;max-width:200px;overflow:hidden}.input-wrapper{flex:1;display:flex;position:relative}.input-field{--luzmo-text-field-focus-indicator-width:0;--luzmo-text-field-border-width:0;--luzmo-text-field-width:100%;--luzmo-text-field-min-width:0;--luzmo-text-field-placeholder-text-color-default:var(--luzmo-prompt-box-placeholder-color,var(--prompt-box-placeholder-color));flex:1;width:100%;min-width:0}.actions-row{justify-content:space-between;align-items:center;gap:var(--luzmo-prompt-box-actions-gap,var(--prompt-box-actions-gap));display:flex}.bottom-actions{align-items:center;gap:var(--luzmo-prompt-box-bottom-actions-gap,var(--prompt-box-bottom-actions-gap));opacity:var(--luzmo-prompt-box-actions-opacity,var(--prompt-box-actions-opacity,1));transition:opacity var(--luzmo-prompt-box-animation-duration,var(--prompt-box-animation-duration)) ease-in-out;flex-wrap:wrap;flex:1;display:flex}.button-group{align-items:center;gap:var(--luzmo-prompt-box-button-group-gap,var(--prompt-box-button-group-gap));margin-left:auto;display:flex}.record-button,.cancel-recording-button{--luzmo-action-button-border-radius:var(--luzmo-prompt-box-record-button-border-radius,50%);--luzmo-action-button-focus-indicator-border-radius:var(--luzmo-prompt-box-record-button-focus-indicator-border-radius,50%)}.submit-button{margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start,var(--prompt-box-submit-button-margin-inline-start))}.recording-ui{align-items:center;gap:var(--luzmo-prompt-box-recording-gap,var(--prompt-box-recording-gap));display:flex}.waveform{align-items:center;gap:var(--luzmo-prompt-box-waveform-gap,var(--prompt-box-waveform-gap,3px));height:var(--luzmo-prompt-box-waveform-height,var(--prompt-box-waveform-height,24px));padding:0 4px;display:flex}.waveform-bar{width:var(--luzmo-prompt-box-waveform-bar-width,var(--prompt-box-waveform-bar-width,3px));height:calc(var(--bar-height,.3) * var(--luzmo-prompt-box-waveform-height,var(--prompt-box-waveform-height,24px)));background-color:var(--luzmo-prompt-box-waveform-bar-color,var(--prompt-box-waveform-bar-color,currentColor));border-radius:var(--luzmo-prompt-box-waveform-bar-radius,var(--prompt-box-waveform-bar-radius,2px));min-height:4px;transition:height 50ms ease-out;animation:1s ease-in-out infinite waveform-pulse}.waveform-bar:first-child{animation-delay:0s}.waveform-bar:nth-child(2){animation-delay:.1s}.waveform-bar:nth-child(3){animation-delay:.2s}.waveform-bar:nth-child(4){animation-delay:.1s}.waveform-bar:nth-child(5){animation-delay:0s}@keyframes waveform-pulse{0%,to{opacity:.6}50%{opacity:1}}.recording-duration{font-family:var(--luzmo-prompt-box-recording-duration-font-family,var(--prompt-box-recording-duration-font-family,monospace));font-size:var(--luzmo-prompt-box-recording-duration-font-size,var(--prompt-box-recording-duration-font-size,14px));font-weight:var(--luzmo-prompt-box-recording-duration-font-weight,var(--prompt-box-recording-duration-font-weight,500));color:var(--luzmo-prompt-box-recording-duration-color,var(--prompt-box-recording-duration-color,currentColor));text-align:center}.rich-input{width:100%;min-width:0;min-height:1.5em;max-height:var(--luzmo-prompt-box-max-height,var(--prompt-box-max-height,200px));padding:var(--luzmo-prompt-box-rich-input-padding,var(--prompt-box-rich-input-padding,4px 0));font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;white-space:pre-wrap;word-break:break-word;background:0 0;border:none;outline:none;flex:1;overflow-y:auto}.rich-input:empty:before{content:attr(data-placeholder);color:var(--luzmo-prompt-box-placeholder-color,var(--prompt-box-placeholder-color));pointer-events:none}.rich-input[contenteditable=false]{opacity:.5;cursor:default}.drag-caret{background:var(--luzmo-primary,#0064fa);pointer-events:none;border-radius:1px;width:2px}.element-badge{align-items:center;gap:var(--luzmo-prompt-box-badge-gap,var(--prompt-box-badge-gap,6px));vertical-align:baseline;padding:var(--luzmo-prompt-box-badge-padding,var(--prompt-box-badge-padding,1px 6px));background-color:var(--luzmo-prompt-box-badge-background,var(--prompt-box-badge-background,rgba(var(--luzmo-primary-rgb,0, 100, 250), .1)));color:var(--luzmo-prompt-box-badge-color,var(--prompt-box-badge-color,var(--luzmo-primary,#0064fa)));border-radius:var(--luzmo-prompt-box-badge-border-radius,var(--prompt-box-badge-border-radius,4px));font-size:var(--luzmo-prompt-box-badge-font-size,var(--prompt-box-badge-font-size,.9em));font-weight:var(--luzmo-prompt-box-badge-font-weight,var(--prompt-box-badge-font-weight,500));cursor:default;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:var(--luzmo-prompt-box-badge-max-width,var(--prompt-box-badge-max-width,200px));margin:0 1px;line-height:1.4;display:inline-flex}.element-badge-icon{flex-shrink:0;display:inline-flex}.element-badge-label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.element-badge-remove{appearance:none;font:inherit;color:inherit;width:var(--luzmo-prompt-box-badge-remove-size,var(--prompt-box-badge-remove-size,14px));height:var(--luzmo-prompt-box-badge-remove-size,var(--prompt-box-badge-remove-size,14px));font-size:var(--luzmo-prompt-box-badge-remove-font-size,var(--prompt-box-badge-remove-font-size,12px));cursor:pointer;opacity:.6;background:0 0;border:none;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;line-height:1;transition:opacity .1s,background-color .1s;display:inline-flex}.element-badge-remove:hover{opacity:1;background-color:var(--luzmo-prompt-box-badge-remove-hover-background,var(--prompt-box-badge-remove-hover-background,#0000001a))}.element-badge-remove:focus-visible{opacity:1;outline:2px solid var(--luzmo-primary,#0064fa);outline-offset:1px}:host([single-line]) .container{align-items:center;gap:var(--luzmo-prompt-box-single-line-gap,var(--prompt-box-single-line-gap));flex-direction:row}:host([single-line]) .top-actions{flex-wrap:nowrap;flex-shrink:0}:host([single-line]) .attachments{max-height:var(--luzmo-prompt-box-single-line-attachments-max-height,var(--prompt-box-single-line-attachments-max-height));flex-direction:row;flex-shrink:0;align-items:center;overflow:hidden}:host([single-line]) .image-attachments{flex-wrap:nowrap}:host([single-line]) .image-attachment{width:var(--luzmo-prompt-box-single-line-image-size,var(--prompt-box-single-line-image-size));height:var(--luzmo-prompt-box-single-line-image-size,var(--prompt-box-single-line-image-size))}:host([single-line]) .file-attachments{flex-wrap:nowrap}:host([single-line]) .input-wrapper{min-width:0}:host([single-line]) .input-field{--luzmo-text-area-min-block-size-quiet:auto;--luzmo-text-field-spacing-block-start:0px;--luzmo-text-field-spacing-block-end:0px}:host([single-line]) .rich-input{min-height:unset;padding:0}:host([single-line]) .actions-row{flex-shrink:0}:host([single-line]) .bottom-actions{flex-wrap:nowrap;flex:0}::slotted([slot=top-actions]),::slotted([slot=bottom-actions]){align-items:center;display:inline-flex}::slotted([slot=record-button]){display:inline-flex}::slotted([slot=submit-button]){margin-inline-start:var(--luzmo-prompt-box-submit-button-margin-inline-start,var(--prompt-box-submit-button-margin-inline-start));display:inline-flex}luzmo-overlay[part=trigger-menu-overlay]{--luzmo-overlay-min-width:0}.trigger-options{min-width:var(--luzmo-prompt-box-trigger-menu-min-width,var(--prompt-box-trigger-menu-min-width,250px));max-width:var(--luzmo-prompt-box-trigger-menu-max-width,var(--prompt-box-trigger-menu-max-width,400px));max-height:var(--luzmo-prompt-box-trigger-menu-max-height,var(--prompt-box-trigger-menu-max-height,300px));flex-direction:column;display:flex;overflow-y:auto}.trigger-options::-webkit-scrollbar{width:var(--luzmo-prompt-box-trigger-menu-scrollbar-width,var(--prompt-box-trigger-menu-scrollbar-width))}.trigger-options::-webkit-scrollbar-track{background:var(--luzmo-prompt-box-trigger-menu-scrollbar-track-background,var(--prompt-box-trigger-menu-scrollbar-track-background));border-radius:var(--luzmo-prompt-box-trigger-menu-scrollbar-track-border-radius,var(--prompt-box-trigger-menu-scrollbar-track-border-radius))}.trigger-options::-webkit-scrollbar-thumb{background:var(--luzmo-prompt-box-trigger-menu-scrollbar-thumb-background,var(--prompt-box-trigger-menu-scrollbar-thumb-background));border-radius:var(--luzmo-prompt-box-trigger-menu-scrollbar-thumb-border-radius,var(--prompt-box-trigger-menu-scrollbar-thumb-border-radius))}.trigger-options::-webkit-scrollbar-thumb:hover{background:var(--luzmo-prompt-box-trigger-menu-scrollbar-thumb-hover-background,var(--prompt-box-trigger-menu-scrollbar-thumb-hover-background))}.trigger-options{scrollbar-width:var(--luzmo-scrollbar-width,thin);scrollbar-color:var(--luzmo-prompt-box-trigger-menu-scrollbar-thumb-background,var(--prompt-box-trigger-menu-scrollbar-thumb-background)) var(--luzmo-prompt-box-trigger-menu-scrollbar-track-background,var(--prompt-box-trigger-menu-scrollbar-track-background));background-color:var(--luzmo-prompt-box-trigger-menu-background,var(--prompt-box-trigger-menu-background,var(--luzmo-background-color,#fff)));border:1px solid var(--luzmo-prompt-box-trigger-menu-border-color,var(--prompt-box-trigger-menu-border-color,var(--luzmo-border-color,#0000001a)));border-radius:var(--luzmo-prompt-box-trigger-menu-border-radius,var(--prompt-box-trigger-menu-border-radius,var(--luzmo-border-radius-100,8px)));box-shadow:0 2px 8px var(--luzmo-prompt-box-trigger-menu-shadow-color,var(--prompt-box-trigger-menu-shadow-color,#0000001f))}.trigger-option{align-items:center;gap:var(--luzmo-prompt-box-trigger-option-gap,var(--prompt-box-trigger-option-gap,10px));min-block-size:var(--luzmo-prompt-box-trigger-option-min-height,var(--prompt-box-trigger-option-min-height,var(--luzmo-component-height,32px)));padding-block:var(--luzmo-prompt-box-trigger-option-padding-block,var(--prompt-box-trigger-option-padding-block,4px));padding-inline:var(--luzmo-prompt-box-trigger-option-padding-inline,var(--prompt-box-trigger-option-padding-inline,10px));cursor:pointer;box-sizing:border-box;scroll-margin-block:var(--luzmo-prompt-box-trigger-option-min-height,var(--prompt-box-trigger-option-min-height,var(--luzmo-component-height,32px)));transition:background-color .1s;display:flex}.trigger-option.has-description{padding-block:var(--luzmo-prompt-box-trigger-option-description-padding-block,var(--prompt-box-trigger-option-description-padding-block,4px));min-block-size:auto}.trigger-option.hovered,.trigger-option.highlighted{background-color:var(--luzmo-prompt-box-trigger-option-background-hover,var(--prompt-box-trigger-option-background-hover,var(--luzmo-background-color-hover,#0000000f)))}.trigger-option-icon{width:var(--luzmo-prompt-box-trigger-option-icon-width,var(--prompt-box-trigger-option-icon-width,20px));color:var(--luzmo-prompt-box-trigger-option-icon-color,var(--prompt-box-trigger-option-icon-color,var(--luzmo-font-color,inherit)));font-size:var(--luzmo-prompt-box-trigger-option-icon-size,var(--prompt-box-trigger-option-icon-size,var(--luzmo-font-size,14px)));flex-shrink:0;justify-content:center;align-items:center;display:flex}.trigger-option-content{flex-direction:column;flex:1;min-width:0;display:flex;overflow:hidden}.trigger-option-label{font-size:var(--luzmo-prompt-box-trigger-option-font-size,var(--prompt-box-trigger-option-font-size,var(--luzmo-font-size,14px)));line-height:var(--luzmo-prompt-box-trigger-option-line-height,var(--prompt-box-trigger-option-line-height,var(--luzmo-line-height,1.4)));color:var(--luzmo-prompt-box-trigger-option-color,var(--prompt-box-trigger-option-color,var(--luzmo-font-color,#333)));white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.trigger-option-description{font-size:var(--luzmo-prompt-box-trigger-option-description-font-size,var(--prompt-box-trigger-option-description-font-size,var(--luzmo-font-size-xs,12px)));line-height:var(--luzmo-prompt-box-trigger-option-description-line-height,var(--prompt-box-trigger-option-description-line-height,var(--luzmo-line-height,1.4)));color:var(--luzmo-prompt-box-trigger-option-description-color,var(--prompt-box-trigger-option-description-color,var(--luzmo-font-color,#6e6e6e)));white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.trigger-option-enter-icon{color:var(--luzmo-prompt-box-trigger-option-enter-icon-color,var(--prompt-box-trigger-option-enter-icon-color,var(--luzmo-font-color-dimmed,#0006)));flex-shrink:0;justify-content:center;align-items:center;margin-inline-start:auto;display:flex}.trigger-option-highlight{background-color:var(--luzmo-prompt-box-trigger-option-highlight-background,var(--prompt-box-trigger-option-highlight-background,rgba(var(--luzmo-primary-rgb,0, 100, 250), .12)));color:inherit;border-radius:2px;padding:0 1px}.trigger-option-header{align-items:center;gap:var(--luzmo-prompt-box-trigger-option-header-gap,var(--prompt-box-trigger-option-header-gap,10px));min-block-size:var(--luzmo-prompt-box-trigger-option-min-height,var(--prompt-box-trigger-option-min-height,var(--luzmo-component-height,32px)));padding-block:var(--luzmo-prompt-box-trigger-option-header-padding-block,var(--prompt-box-trigger-option-header-padding-block,4px));padding-inline:var(--luzmo-prompt-box-trigger-option-header-padding-inline,var(--prompt-box-trigger-option-header-padding-inline,10px));background-color:var(--luzmo-prompt-box-trigger-option-header-background,var(--prompt-box-trigger-option-header-background));border-block-start:1px solid var(--luzmo-prompt-box-trigger-option-header-border-color,var(--prompt-box-trigger-option-header-border-color,var(--luzmo-border-color,#0000001f)));border-block-end:1px solid var(--luzmo-prompt-box-trigger-option-header-border-color,var(--prompt-box-trigger-option-header-border-color,var(--luzmo-border-color,#0000001f)));box-sizing:border-box;-webkit-user-select:none;user-select:none;display:flex}.trigger-options>.trigger-option-header:first-child{border-block-start:none}.trigger-option-header-icon{width:var(--luzmo-prompt-box-trigger-option-icon-width,var(--prompt-box-trigger-option-icon-width,20px));color:var(--luzmo-prompt-box-trigger-option-header-icon-color,var(--prompt-box-trigger-option-header-icon-color,var(--luzmo-font-color,#333)));flex-shrink:0;justify-content:center;align-items:center;display:flex}.trigger-option-header-label{font-size:var(--luzmo-prompt-box-trigger-option-header-font-size,var(--prompt-box-trigger-option-header-font-size,var(--luzmo-font-size,14px)));font-weight:var(--luzmo-prompt-box-trigger-option-header-font-weight,var(--prompt-box-trigger-option-header-font-weight,normal));line-height:var(--luzmo-prompt-box-trigger-option-header-line-height,var(--prompt-box-trigger-option-header-line-height,var(--luzmo-line-height,1.4)));color:var(--luzmo-prompt-box-trigger-option-header-color,var(--prompt-box-trigger-option-header-color,var(--luzmo-font-color,#333)));white-space:nowrap;text-overflow:ellipsis;overflow:hidden}luzmo-overlay[part=trigger-menu-overlay] ::slotted(*){min-width:var(--luzmo-prompt-box-trigger-menu-min-width,var(--prompt-box-trigger-menu-min-width,250px));max-height:var(--luzmo-prompt-box-trigger-menu-max-height,var(--prompt-box-trigger-menu-max-height,300px));overflow-y:auto;visibility:visible!important;opacity:1!important;pointer-events:auto!important;position:relative!important}@media (forced-colors:active){:host{--highcontrast-prompt-box-background-color:Canvas;--highcontrast-prompt-box-border-color:CanvasText;--highcontrast-prompt-box-border-color-focus:Highlight;--highcontrast-prompt-box-text-color:CanvasText}}:host{--prompt-box-font-family:var(--luzmo-font-family);--prompt-box-font-size:var(--luzmo-font-size);--prompt-box-line-height:1.5;--prompt-box-text-color:var(--luzmo-font-color);--prompt-box-background-color:var(--luzmo-background-color);--prompt-box-border-radius:var(--luzmo-border-radius-xl);--prompt-box-border-width:var(--luzmo-border-width);--prompt-box-border-color:var(--luzmo-border-color);--prompt-box-border-color-focus:var(--luzmo-primary);--prompt-box-shadow:0 2px 8px rgba(var(--luzmo-border-color-rgb), .08);--prompt-box-shadow-focus:0 2px 12px rgba(var(--luzmo-primary-rgb), .15);--prompt-box-gap:var(--luzmo-spacing-5);--prompt-box-recording-gap:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--prompt-box-vertical-padding:var(--luzmo-spacing-4);--prompt-box-horizontal-padding:var(--luzmo-spacing-5);--prompt-box-actions-gap:var(--luzmo-spacing-3);--prompt-box-top-actions-gap:var(--luzmo-spacing-2);--prompt-box-bottom-actions-gap:var(--luzmo-spacing-2);--prompt-box-button-group-gap:var(--luzmo-spacing-2);--prompt-box-submit-button-margin-inline-start:var(--luzmo-spacing-3);--prompt-box-max-height:200px;--prompt-box-rich-input-padding:4px 0;--prompt-box-placeholder-color:var(--luzmo-font-color-extra-dimmed);--prompt-box-animation-duration:var(--luzmo-animation-duration,.15s);--prompt-box-disabled-opacity:.5;--prompt-box-attachments-gap:var(--luzmo-spacing-1);--prompt-box-image-attachments-gap:var(--luzmo-spacing-2);--prompt-box-file-attachments-gap:var(--luzmo-spacing-2);--prompt-box-image-preview-size:64px;--prompt-box-image-border-radius:var(--luzmo-border-radius);--prompt-box-image-background:#0000000d;--prompt-box-remove-button-size:20px;--prompt-box-remove-button-background:#00000080;--prompt-box-remove-button-background-hover:#000000b3;--prompt-box-remove-button-icon-color:#fff;--prompt-box-badge-gap:6px;--prompt-box-badge-padding:1px 6px;--prompt-box-badge-background:rgba(var(--luzmo-primary-rgb,0, 100, 250), .1);--prompt-box-badge-color:var(--luzmo-primary,#0064fa);--prompt-box-badge-border-radius:4px;--prompt-box-badge-font-size:.9em;--prompt-box-badge-font-weight:500;--prompt-box-badge-max-width:200px;--prompt-box-badge-remove-size:14px;--prompt-box-badge-remove-font-size:12px;--prompt-box-badge-remove-hover-background:#0000001a;--prompt-box-waveform-gap:3px;--prompt-box-waveform-height:24px;--prompt-box-waveform-bar-width:3px;--prompt-box-waveform-bar-color:currentColor;--prompt-box-waveform-bar-radius:2px;--prompt-box-recording-duration-font-family:monospace;--prompt-box-recording-duration-font-size:14px;--prompt-box-recording-duration-font-weight:500;--prompt-box-recording-duration-color:currentColor;--prompt-box-trigger-menu-min-width:250px;--prompt-box-trigger-menu-max-width:300px;--prompt-box-trigger-menu-max-height:300px;--prompt-box-trigger-menu-background:var(--luzmo-background-color,#fff);--prompt-box-trigger-menu-border-color:var(--luzmo-border-color,#0000001a);--prompt-box-trigger-menu-border-radius:var(--luzmo-border-radius-100,8px);--prompt-box-trigger-menu-shadow-color:#0000001f;--prompt-box-trigger-menu-scrollbar-width:var(--luzmo-scrollbar-size);--prompt-box-trigger-menu-scrollbar-track-background:var(--luzmo-scrollbar-track-background);--prompt-box-trigger-menu-scrollbar-track-border-radius:var(--luzmo-scrollbar-track-border-radius);--prompt-box-trigger-menu-scrollbar-thumb-background:var(--luzmo-scrollbar-thumb-background);--prompt-box-trigger-menu-scrollbar-thumb-border-radius:var(--luzmo-scrollbar-thumb-border-radius);--prompt-box-trigger-menu-scrollbar-thumb-hover-background:var(--luzmo-scrollbar-thumb-hover-background);--prompt-box-single-line-gap:var(--luzmo-spacing-3);--prompt-box-single-line-attachments-max-height:32px;--prompt-box-single-line-image-size:28px;--prompt-box-trigger-option-gap:10px;--prompt-box-trigger-option-min-height:var(--luzmo-component-height,32px);--prompt-box-trigger-option-padding-block:4px;--prompt-box-trigger-option-padding-inline:10px;--prompt-box-trigger-option-description-padding-block:4px;--prompt-box-trigger-option-background-hover:var(--luzmo-background-color-highlight,#f5f5f5);--prompt-box-trigger-option-icon-color:var(--luzmo-font-color,inherit);--prompt-box-trigger-option-icon-width:20px;--prompt-box-trigger-option-icon-size:var(--luzmo-font-size,14px);--prompt-box-trigger-option-font-size:var(--luzmo-font-size,14px);--prompt-box-trigger-option-line-height:var(--luzmo-line-height,1.4);--prompt-box-trigger-option-color:var(--luzmo-font-color,#333);--prompt-box-trigger-option-description-font-size:var(--luzmo-font-size-xs,12px);--prompt-box-trigger-option-description-line-height:var(--luzmo-line-height,1.4);--prompt-box-trigger-option-description-color:var(--luzmo-font-color,#6e6e6e);--prompt-box-trigger-option-enter-icon-color:var(--prompt-box-trigger-option-icon-color,var(--luzmo-font-color,inherit));--prompt-box-trigger-option-highlight-background:rgba(var(--luzmo-primary-rgb,0, 100, 250), .12);--prompt-box-trigger-option-header-gap:10px;--prompt-box-trigger-option-header-padding-block:4px;--prompt-box-trigger-option-header-padding-inline:10px;--prompt-box-trigger-option-header-background:var(--luzmo-background-color-highlight,#f5f5f5);--prompt-box-trigger-option-header-border-color:var(--luzmo-border-color,#0000001f);--prompt-box-trigger-option-header-icon-color:var(--luzmo-font-color,#333);--prompt-box-trigger-option-header-font-size:var(--luzmo-font-size,14px);--prompt-box-trigger-option-header-font-weight:normal;--prompt-box-trigger-option-header-line-height:var(--luzmo-line-height,1.4);--prompt-box-trigger-option-header-color:var(--luzmo-font-color,#333)}:host([size=xs]){--prompt-box-font-size:var(--luzmo-font-size-xs);--prompt-box-border-radius:var(--luzmo-border-radius);--prompt-box-vertical-padding:var(--luzmo-spacing-2);--prompt-box-horizontal-padding:var(--luzmo-spacing-3);--prompt-box-gap:var(--luzmo-spacing-3);--prompt-box-attachments-gap:0;--prompt-box-image-attachments-gap:var(--luzmo-spacing-1);--prompt-box-recording-gap:var(--luzmo-spacing-3);--prompt-box-max-height:120px;--prompt-box-image-preview-size:40px;--prompt-box-remove-button-size:16px;--prompt-box-badge-font-size:.8em;--prompt-box-badge-padding:0px 3px;--prompt-box-badge-remove-size:10px;--prompt-box-badge-remove-font-size:9px}:host([size=s]){--prompt-box-font-size:var(--luzmo-font-size-s);--prompt-box-border-radius:var(--luzmo-border-radius-l);--prompt-box-vertical-padding:var(--luzmo-spacing-3);--prompt-box-horizontal-padding:var(--luzmo-spacing-4);--prompt-box-gap:var(--luzmo-spacing-4);--prompt-box-attachments-gap:0;--prompt-box-image-attachments-gap:var(--luzmo-spacing-1);--prompt-box-recording-gap:calc(var(--luzmo-spacing-3) + var(--luzmo-spacing-1));--prompt-box-max-height:150px;--prompt-box-image-preview-size:48px;--prompt-box-remove-button-size:18px;--prompt-box-badge-font-size:.85em;--prompt-box-badge-padding:0px 4px;--prompt-box-badge-remove-size:12px;--prompt-box-badge-remove-font-size:10px}:host([size=l]){--prompt-box-font-size:var(--luzmo-font-size-l);--prompt-box-border-radius:var(--luzmo-border-radius-xl);--prompt-box-vertical-padding:var(--luzmo-spacing-5);--prompt-box-horizontal-padding:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-1));--prompt-box-gap:var(--luzmo-spacing-4);--prompt-box-attachments-gap:var(--luzmo-spacing-1);--prompt-box-image-attachments-gap:calc(var(--luzmo-spacing-2) + var(--luzmo-spacing-1));--prompt-box-recording-gap:calc(var(--luzmo-spacing-4) + var(--luzmo-spacing-1));--prompt-box-max-height:250px;--prompt-box-image-preview-size:72px;--prompt-box-remove-button-size:24px;--prompt-box-badge-font-size:.9em;--prompt-box-badge-padding:2px 8px;--prompt-box-badge-remove-size:16px;--prompt-box-badge-remove-font-size:13px}:host([size=xl]){--prompt-box-font-size:var(--luzmo-font-size-xl);--prompt-box-border-radius:var(--luzmo-border-radius-xl);--prompt-box-vertical-padding:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-1));--prompt-box-horizontal-padding:calc(var(--luzmo-spacing-5) + var(--luzmo-spacing-2));--prompt-box-gap:var(--luzmo-spacing-5);--prompt-box-attachments-gap:var(--luzmo-spacing-2);--prompt-box-image-attachments-gap:var(--luzmo-spacing-3);--prompt-box-max-height:300px;--prompt-box-image-preview-size:96px;--prompt-box-remove-button-size:28px;--prompt-box-badge-font-size:.9em;--prompt-box-badge-padding:2px 10px;--prompt-box-badge-remove-size:18px;--prompt-box-badge-remove-font-size:14px}:host([pending]){--prompt-box-actions-opacity:.75}", $ = class extends n(e, {
|
|
1256
|
+
validSizes: [
|
|
1257
|
+
"xs",
|
|
1258
|
+
"s",
|
|
1259
|
+
"m",
|
|
1260
|
+
"l",
|
|
1261
|
+
"xl"
|
|
1262
|
+
],
|
|
1263
|
+
defaultSize: "m"
|
|
1264
|
+
}) {
|
|
1265
|
+
constructor(...e) {
|
|
1266
|
+
super(...e), this.rows = 1, this.grows = !1, this.maxRows = -1, this.recording = !1, this.hideSubmit = !1, this.disableSubmit = !1, this.singleLine = !1, this.placeholder = "", this.value = "", this.disabled = !1, this.readonly = !1, this.maxlength = -1, this.pending = !1, this.allowImages = !1, this.allowFiles = !1, this.acceptedFileTypes = [], this.allowElements = !1, this.acceptedElementTypes = [], this._hasTopActions = !1, this._hasBottomActions = !1, this._hasRecordButton = !1, this._hasSubmitButton = !1, this._inputFocused = !1, this._attachments = new g(this), this._recording = new ee(this), this._richInput = new O(this), this._triggerMenu = new k(this), this.handleRecordButtonSlotChange = this._slotPresenceHandler((e) => this._hasRecordButton = e), this.handleSubmitButtonSlotChange = this._slotPresenceHandler((e) => this._hasSubmitButton = e), this.handleRecordClick = (e) => {
|
|
1267
|
+
let t = e.currentTarget.matches(":focus-visible");
|
|
1268
|
+
this._recording.start(t);
|
|
1269
|
+
}, this.handleInput = (e) => {
|
|
1270
|
+
let t = e.target;
|
|
1271
|
+
this.value = t.value, this.dispatchEvent(new Event("input", {
|
|
1272
|
+
bubbles: !0,
|
|
1273
|
+
composed: !0
|
|
1274
|
+
}));
|
|
1275
|
+
}, this.handleKeydown = (e) => {
|
|
1276
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1277
|
+
if (e.preventDefault(), this.disableSubmit) return;
|
|
1278
|
+
this._submit();
|
|
1279
|
+
}
|
|
1280
|
+
}, this.handleInputFocusIn = () => {
|
|
1281
|
+
this._inputFocused = !0;
|
|
1282
|
+
}, this.handleInputFocusOut = () => {
|
|
1283
|
+
this._inputFocused = !1;
|
|
1284
|
+
}, this.handleRichInputEvent = (e) => {
|
|
1285
|
+
this._richInput.syncValue(), this._triggerMenu.handleInput(e), this.dispatchEvent(new Event("input", {
|
|
1286
|
+
bubbles: !0,
|
|
1287
|
+
composed: !0
|
|
1288
|
+
}));
|
|
1289
|
+
}, this.handleRichKeydown = (e) => {
|
|
1290
|
+
if (!this._triggerMenu.handleKeydown(e)) {
|
|
1291
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1292
|
+
if (e.preventDefault(), this.disableSubmit) return;
|
|
1293
|
+
this._submit();
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
(e.key === "Backspace" || e.key === "Delete") && this._richInput.handleBadgeDelete(e.key) && e.preventDefault();
|
|
1297
|
+
}
|
|
1298
|
+
}, this._handleComponentFocusIn = () => {
|
|
1299
|
+
R() && this.classList.add("focus-visible");
|
|
1300
|
+
}, this._handleComponentFocusOut = (e) => {
|
|
1301
|
+
let t = e.relatedTarget;
|
|
1302
|
+
t instanceof Node && (this.contains(t) || this.shadowRoot?.contains(t)) || this.classList.remove("focus-visible");
|
|
1303
|
+
}, this._handlePaste = (e) => {
|
|
1304
|
+
this.handlePastedImages(e.clipboardData);
|
|
1305
|
+
}, this._handleTopActionsSlotChange = this._slotPresenceHandler((e) => this._hasTopActions = e), this._handleBottomActionsSlotChange = this._slotPresenceHandler((e) => this._hasBottomActions = e);
|
|
1306
|
+
}
|
|
1307
|
+
static get styles() {
|
|
1308
|
+
return [s(de)];
|
|
1309
|
+
}
|
|
1310
|
+
get triggers() {
|
|
1311
|
+
return this._triggerMenu.triggers;
|
|
1312
|
+
}
|
|
1313
|
+
set triggers(e) {
|
|
1314
|
+
let t = this._triggerMenu.triggers, n = Array.isArray(e) ? e : [];
|
|
1315
|
+
n.length > 0 && !this.allowElements && console.warn("[luzmo-prompt-box] `triggers` only work when `allow-elements` / allowElements is enabled (rich input is required for trigger menus)."), this._triggerMenu.triggers = n, this.requestUpdate("triggers", t);
|
|
1316
|
+
}
|
|
1317
|
+
get attachmentsController() {
|
|
1318
|
+
return this._attachments;
|
|
1319
|
+
}
|
|
1320
|
+
get recordingController() {
|
|
1321
|
+
return this._recording;
|
|
1322
|
+
}
|
|
1323
|
+
get richInputController() {
|
|
1324
|
+
return this._richInput;
|
|
1325
|
+
}
|
|
1326
|
+
get triggerMenuController() {
|
|
1327
|
+
return this._triggerMenu;
|
|
1328
|
+
}
|
|
1329
|
+
get hasRecordButton() {
|
|
1330
|
+
return this._hasRecordButton;
|
|
1331
|
+
}
|
|
1332
|
+
get hasSubmitButton() {
|
|
1333
|
+
return this._hasSubmitButton;
|
|
1334
|
+
}
|
|
1335
|
+
get tagSize() {
|
|
1336
|
+
switch (this.size) {
|
|
1337
|
+
case "s":
|
|
1338
|
+
case "m": return "s";
|
|
1339
|
+
case "l":
|
|
1340
|
+
case "xl": return "m";
|
|
1341
|
+
default: return "s";
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
get segments() {
|
|
1345
|
+
return this._richInput.getSegments();
|
|
1346
|
+
}
|
|
1347
|
+
set segments(e) {
|
|
1348
|
+
this._richInput.setSegments(e);
|
|
1349
|
+
}
|
|
1350
|
+
connectedCallback() {
|
|
1351
|
+
super.connectedCallback(), I(), this.addEventListener("focusin", this._handleComponentFocusIn), this.addEventListener("focusout", this._handleComponentFocusOut), this.addEventListener("paste", this._handlePaste);
|
|
1352
|
+
}
|
|
1353
|
+
disconnectedCallback() {
|
|
1354
|
+
super.disconnectedCallback(), L(), this.removeEventListener("focusin", this._handleComponentFocusIn), this.removeEventListener("focusout", this._handleComponentFocusOut), this.removeEventListener("paste", this._handlePaste);
|
|
1355
|
+
}
|
|
1356
|
+
updated(e) {
|
|
1357
|
+
super.updated(e), this._richInputElement && (this._richInput.richInputElement = this._richInputElement, this._triggerMenu.richInputElement = this._richInputElement), (e.has("pending") || e.has("disabled")) && ue(this.shadowRoot, this.disabled, this.pending), this._recording.shouldFocusFinishButton && this._recording.isRecording && (this._recording.shouldFocusFinishButton = !1, requestAnimationFrame(() => {
|
|
1358
|
+
this._finishRecordingButton?.focus();
|
|
1359
|
+
}));
|
|
1360
|
+
}
|
|
1361
|
+
focus() {
|
|
1362
|
+
this.allowElements && this._richInputElement ? this._richInputElement.focus() : this._inputElement?.focus();
|
|
1363
|
+
}
|
|
1364
|
+
clear() {
|
|
1365
|
+
this._triggerMenu.close(), this.value = "", this._attachments.clearAttachments(), this.allowElements && this._richInput.clearElements();
|
|
1366
|
+
}
|
|
1367
|
+
addFiles(e) {
|
|
1368
|
+
return this._attachments.addFiles(e);
|
|
1369
|
+
}
|
|
1370
|
+
removeAttachment(e) {
|
|
1371
|
+
this._attachments.removeAttachment(e);
|
|
1372
|
+
}
|
|
1373
|
+
clearAttachments() {
|
|
1374
|
+
this._attachments.clearAttachments();
|
|
1375
|
+
}
|
|
1376
|
+
getAttachments() {
|
|
1377
|
+
return this._attachments.getAttachments();
|
|
1378
|
+
}
|
|
1379
|
+
openFilePicker() {
|
|
1380
|
+
this._fileInput?.click();
|
|
1381
|
+
}
|
|
1382
|
+
insertElement(e, t, n, r) {
|
|
1383
|
+
return this._richInput.insertElement(e, t, n, r);
|
|
1384
|
+
}
|
|
1385
|
+
removeElement(e) {
|
|
1386
|
+
this._richInput.removeElement(e);
|
|
1387
|
+
}
|
|
1388
|
+
getElements() {
|
|
1389
|
+
return this._richInput.getElements();
|
|
1390
|
+
}
|
|
1391
|
+
getTopActions() {
|
|
1392
|
+
return (this.shadowRoot?.querySelector("slot[name=\"top-actions\"]"))?.assignedElements() ?? [];
|
|
1393
|
+
}
|
|
1394
|
+
getBottomActions() {
|
|
1395
|
+
return (this.shadowRoot?.querySelector("slot[name=\"bottom-actions\"]"))?.assignedElements() ?? [];
|
|
1396
|
+
}
|
|
1397
|
+
submit() {
|
|
1398
|
+
this._submit();
|
|
1399
|
+
}
|
|
1400
|
+
selectTriggerOption(e) {
|
|
1401
|
+
this._triggerMenu.selectOption(e);
|
|
1402
|
+
}
|
|
1403
|
+
highlightTriggerOption(e) {
|
|
1404
|
+
this._triggerMenu.highlightedIndex = e, this.requestUpdate();
|
|
1405
|
+
}
|
|
1406
|
+
_slotPresenceHandler(e) {
|
|
1407
|
+
return (t) => {
|
|
1408
|
+
let n = t.target;
|
|
1409
|
+
e(n.assignedNodes().length > 0);
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
handlePastedImages(e) {
|
|
1413
|
+
return this._attachments.handlePastedImages(e);
|
|
1414
|
+
}
|
|
1415
|
+
_submit() {
|
|
1416
|
+
if (this.disabled || this.readonly || this.pending || this.disableSubmit) return;
|
|
1417
|
+
let e = this.shadowRoot?.querySelector("slot[name=\"top-actions\"]"), t = this.shadowRoot?.querySelector("slot[name=\"bottom-actions\"]"), n = e?.assignedElements() ?? [], r = t?.assignedElements() ?? [], i = Q([...n, ...r]), a = {
|
|
1418
|
+
value: this.value,
|
|
1419
|
+
segments: this.segments,
|
|
1420
|
+
topActions: [...n],
|
|
1421
|
+
bottomActions: [...r],
|
|
1422
|
+
actionValues: i,
|
|
1423
|
+
attachments: [...this._attachments.getAttachments()]
|
|
1424
|
+
};
|
|
1425
|
+
this.dispatchEvent(new CustomEvent("luzmo-submit", {
|
|
1426
|
+
bubbles: !0,
|
|
1427
|
+
composed: !0,
|
|
1428
|
+
detail: a
|
|
1429
|
+
}));
|
|
1430
|
+
}
|
|
1431
|
+
render() {
|
|
1432
|
+
return a`
|
|
1433
|
+
${le(this)}
|
|
1434
|
+
<div
|
|
1435
|
+
class="container ${this._inputFocused ? "input-focused" : ""} ${this._richInput?.isDragOver ? "drag-over" : ""}"
|
|
1436
|
+
part="container"
|
|
1437
|
+
>
|
|
1438
|
+
${z(this, this._hasTopActions, this._handleTopActionsSlotChange)}
|
|
1439
|
+
${ce(this)}
|
|
1440
|
+
<div class="input-wrapper" part="input-wrapper">
|
|
1441
|
+
${ae(this)}
|
|
1442
|
+
</div>
|
|
1443
|
+
<div class="actions-row" part="actions-row">
|
|
1444
|
+
${B(this, this._hasBottomActions, this._handleBottomActionsSlotChange)}
|
|
1445
|
+
<div class="button-group" part="button-group">
|
|
1446
|
+
${H(this)} ${U(this)}
|
|
1447
|
+
</div>
|
|
1448
|
+
</div>
|
|
1449
|
+
</div>
|
|
1450
|
+
${J(this)}
|
|
1451
|
+
`;
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
//#endregion
|
|
1455
|
+
//#region src/components/prompt-box/index.ts
|
|
1456
|
+
t([c({ type: Number })], $.prototype, "rows", void 0), t([c({
|
|
1457
|
+
type: Boolean,
|
|
1458
|
+
reflect: !0
|
|
1459
|
+
})], $.prototype, "grows", void 0), t([c({
|
|
1460
|
+
type: Number,
|
|
1461
|
+
attribute: "max-rows"
|
|
1462
|
+
})], $.prototype, "maxRows", void 0), t([c({
|
|
1463
|
+
type: Boolean,
|
|
1464
|
+
reflect: !0
|
|
1465
|
+
})], $.prototype, "recording", void 0), t([c({
|
|
1466
|
+
type: Boolean,
|
|
1467
|
+
reflect: !0,
|
|
1468
|
+
attribute: "hide-submit"
|
|
1469
|
+
})], $.prototype, "hideSubmit", void 0), t([c({
|
|
1470
|
+
type: Boolean,
|
|
1471
|
+
reflect: !0,
|
|
1472
|
+
attribute: "disable-submit"
|
|
1473
|
+
})], $.prototype, "disableSubmit", void 0), t([c({
|
|
1474
|
+
type: Boolean,
|
|
1475
|
+
reflect: !0,
|
|
1476
|
+
attribute: "single-line"
|
|
1477
|
+
})], $.prototype, "singleLine", void 0), t([c({ type: String })], $.prototype, "placeholder", void 0), t([c({ type: String })], $.prototype, "value", void 0), t([c({
|
|
1478
|
+
type: Boolean,
|
|
1479
|
+
reflect: !0
|
|
1480
|
+
})], $.prototype, "disabled", void 0), t([c({
|
|
1481
|
+
type: Boolean,
|
|
1482
|
+
reflect: !0
|
|
1483
|
+
})], $.prototype, "readonly", void 0), t([c({ type: Number })], $.prototype, "maxlength", void 0), t([c({
|
|
1484
|
+
type: Boolean,
|
|
1485
|
+
reflect: !0
|
|
1486
|
+
})], $.prototype, "pending", void 0), t([c({
|
|
1487
|
+
type: Boolean,
|
|
1488
|
+
reflect: !0,
|
|
1489
|
+
attribute: "allow-images"
|
|
1490
|
+
})], $.prototype, "allowImages", void 0), t([c({
|
|
1491
|
+
type: Boolean,
|
|
1492
|
+
reflect: !0,
|
|
1493
|
+
attribute: "allow-files"
|
|
1494
|
+
})], $.prototype, "allowFiles", void 0), t([c({
|
|
1495
|
+
type: Array,
|
|
1496
|
+
attribute: "accepted-file-types"
|
|
1497
|
+
})], $.prototype, "acceptedFileTypes", void 0), t([c({
|
|
1498
|
+
type: Boolean,
|
|
1499
|
+
reflect: !0,
|
|
1500
|
+
attribute: "allow-elements"
|
|
1501
|
+
})], $.prototype, "allowElements", void 0), t([c({
|
|
1502
|
+
type: Array,
|
|
1503
|
+
attribute: "accepted-element-types"
|
|
1504
|
+
})], $.prototype, "acceptedElementTypes", void 0), t([c({ type: Array })], $.prototype, "triggers", null), t([u()], $.prototype, "_hasTopActions", void 0), t([u()], $.prototype, "_hasBottomActions", void 0), t([u()], $.prototype, "_hasRecordButton", void 0), t([u()], $.prototype, "_hasSubmitButton", void 0), t([u()], $.prototype, "_inputFocused", void 0), t([l("luzmo-text-field")], $.prototype, "_inputElement", void 0), t([l(".rich-input")], $.prototype, "_richInputElement", void 0), t([l("input[type=\"file\"]")], $.prototype, "_fileInput", void 0), t([l(".finish-recording-button")], $.prototype, "_finishRecordingButton", void 0), customElements.get("luzmo-prompt-box") || customElements.define("luzmo-prompt-box", $);
|
|
1505
|
+
//#endregion
|
|
1506
|
+
export { D as n, $ as t };
|