@mhmo91/schmancy 0.2.174 → 0.2.175
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/dist/{animated-text-DnpEmzG6.cjs → animated-text-BrDkqFTI.cjs} +2 -2
- package/dist/{animated-text-DnpEmzG6.cjs.map → animated-text-BrDkqFTI.cjs.map} +1 -1
- package/dist/{animated-text-CuzUjLrt.js → animated-text-s9T0FPzu.js} +3 -3
- package/dist/{animated-text-CuzUjLrt.js.map → animated-text-s9T0FPzu.js.map} +1 -1
- package/dist/animated-text.cjs +1 -1
- package/dist/animated-text.js +1 -1
- package/dist/area.cjs +1 -1
- package/dist/{area.component-yPcYESCN.js → area.component-DGr6ZdvQ.js} +3 -3
- package/dist/{area.component-yPcYESCN.js.map → area.component-DGr6ZdvQ.js.map} +1 -1
- package/dist/{area.component-BScAAi9b.cjs → area.component-RZA2bq-D.cjs} +2 -2
- package/dist/{area.component-BScAAi9b.cjs.map → area.component-RZA2bq-D.cjs.map} +1 -1
- package/dist/area.js +1 -1
- package/dist/{autocomplete-DzN6JlKD.js → autocomplete-1gZeSbnf.js} +3 -3
- package/dist/{autocomplete-DzN6JlKD.js.map → autocomplete-1gZeSbnf.js.map} +1 -1
- package/dist/{autocomplete-BAblB5US.cjs → autocomplete-CuuHN9km.cjs} +2 -2
- package/dist/{autocomplete-BAblB5US.cjs.map → autocomplete-CuuHN9km.cjs.map} +1 -1
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/{teleport.component-bQFYfK94.js → avatar-CTucKkA4.js} +235 -204
- package/dist/avatar-CTucKkA4.js.map +1 -0
- package/dist/avatar-hg0j8zki.cjs +212 -0
- package/dist/avatar-hg0j8zki.cjs.map +1 -0
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-CKwb-uFj.js → checkbox-DFYmSAah.js} +2 -2
- package/dist/{checkbox-CKwb-uFj.js.map → checkbox-DFYmSAah.js.map} +1 -1
- package/dist/{checkbox-j-8nzAvA.cjs → checkbox-DQd9Azq2.cjs} +2 -2
- package/dist/{checkbox-j-8nzAvA.cjs.map → checkbox-DQd9Azq2.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-DkIA91MS.js → chips-3gE4mmTU.js} +3 -3
- package/dist/{chips-DkIA91MS.js.map → chips-3gE4mmTU.js.map} +1 -1
- package/dist/{chips-COn9_IpC.cjs → chips-CkZAEsJp.cjs} +2 -2
- package/dist/{chips-COn9_IpC.cjs.map → chips-CkZAEsJp.cjs.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{date-range-c5unYbcG.cjs → date-range-BZlbUc_n.cjs} +2 -2
- package/dist/{date-range-c5unYbcG.cjs.map → date-range-BZlbUc_n.cjs.map} +1 -1
- package/dist/{date-range-BPWhrUmb.js → date-range-CLgoit8H.js} +3 -3
- package/dist/{date-range-BPWhrUmb.js.map → date-range-CLgoit8H.js.map} +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{delay-BoVPkUxV.js → delay-BS7AcXYg.js} +2 -2
- package/dist/{delay-BoVPkUxV.js.map → delay-BS7AcXYg.js.map} +1 -1
- package/dist/{delay-dM9FOKCv.cjs → delay-C0xLB5YE.cjs} +2 -2
- package/dist/{delay-dM9FOKCv.cjs.map → delay-C0xLB5YE.cjs.map} +1 -1
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/{dialog-service--MB2Ciko.js → dialog-service-B7mtryVn.js} +3 -3
- package/dist/{dialog-service--MB2Ciko.js.map → dialog-service-B7mtryVn.js.map} +1 -1
- package/dist/{dialog-service-DdNIazJU.cjs → dialog-service-Bju5U74b.cjs} +2 -2
- package/dist/{dialog-service-DdNIazJU.cjs.map → dialog-service-Bju5U74b.cjs.map} +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{divider-BDG7M6Ye.js → divider-B5CC311v.js} +3 -3
- package/dist/{divider-BDG7M6Ye.js.map → divider-B5CC311v.js.map} +1 -1
- package/dist/{divider-B2lNC0Hi.cjs → divider-xPhgMgau.cjs} +2 -2
- package/dist/{divider-B2lNC0Hi.cjs.map → divider-xPhgMgau.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/{dropdown-content--sqK901p.cjs → dropdown-content-Bwjmh6uS.cjs} +2 -2
- package/dist/{dropdown-content--sqK901p.cjs.map → dropdown-content-Bwjmh6uS.cjs.map} +1 -1
- package/dist/{dropdown-content-Ctq1JVzp.js → dropdown-content-Cnk_HWWq.js} +3 -3
- package/dist/{dropdown-content-Ctq1JVzp.js.map → dropdown-content-Cnk_HWWq.js.map} +1 -1
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/extra.cjs +1 -1
- package/dist/extra.js +1 -1
- package/dist/{flex-c0NHmPAm.js → flex-C9UL4tmR.js} +2 -2
- package/dist/{flex-c0NHmPAm.js.map → flex-C9UL4tmR.js.map} +1 -1
- package/dist/{flex-Bt5rjiJc.cjs → flex-COQaEZmU.cjs} +2 -2
- package/dist/{flex-Bt5rjiJc.cjs.map → flex-COQaEZmU.cjs.map} +1 -1
- package/dist/{form-DBe9nCyD.cjs → form-BG9KH92a.cjs} +2 -2
- package/dist/{form-DBe9nCyD.cjs.map → form-BG9KH92a.cjs.map} +1 -1
- package/dist/{form-UMB7mWaN.js → form-YcKpLew8.js} +2 -2
- package/dist/{form-UMB7mWaN.js.map → form-YcKpLew8.js.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{icon-ClqiTwLk.cjs → icon-CIY_VPoc.cjs} +2 -2
- package/dist/{icon-ClqiTwLk.cjs.map → icon-CIY_VPoc.cjs.map} +1 -1
- package/dist/{icon-BaUginFZ.js → icon-DyZGNskE.js} +3 -3
- package/dist/{icon-BaUginFZ.js.map → icon-DyZGNskE.js.map} +1 -1
- package/dist/{icon-button-D15DCKEh.js → icon-button-BMbFb3-e.js} +3 -3
- package/dist/{icon-button-D15DCKEh.js.map → icon-button-BMbFb3-e.js.map} +1 -1
- package/dist/{icon-button-BuQaHhHo.cjs → icon-button-D1627KoB.cjs} +2 -2
- package/dist/{icon-button-BuQaHhHo.cjs.map → icon-button-D1627KoB.cjs.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +158 -157
- package/dist/{input-C6sT1ZaK.js → input-BQF_Yvo3.js} +2 -2
- package/dist/{input-C6sT1ZaK.js.map → input-BQF_Yvo3.js.map} +1 -1
- package/dist/{input-BUwEVCui.cjs → input-VTxTwAen.cjs} +2 -2
- package/dist/{input-BUwEVCui.cjs.map → input-VTxTwAen.cjs.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/{list-B2aWxkkk.cjs → list-Df47IR-i.cjs} +2 -2
- package/dist/{list-B2aWxkkk.cjs.map → list-Df47IR-i.cjs.map} +1 -1
- package/dist/{list-BL2o6M7R.js → list-m-K1zYJm.js} +2 -2
- package/dist/{list-BL2o6M7R.js.map → list-m-K1zYJm.js.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{litElement.mixin-hg90OkNF.js → litElement.mixin-DJC1EaoO.js} +2 -2
- package/dist/{litElement.mixin-hg90OkNF.js.map → litElement.mixin-DJC1EaoO.js.map} +1 -1
- package/dist/{litElement.mixin-DqMWf6Rp.cjs → litElement.mixin-DcVBwo9t.cjs} +2 -2
- package/dist/{litElement.mixin-DqMWf6Rp.cjs.map → litElement.mixin-DcVBwo9t.cjs.map} +1 -1
- package/dist/{menu-CYU7-A6s.cjs → menu-BmdOK-Gh.cjs} +2 -2
- package/dist/{menu-CYU7-A6s.cjs.map → menu-BmdOK-Gh.cjs.map} +1 -1
- package/dist/{menu-DLdGFJSB.js → menu-CQA4Qp2Y.js} +3 -3
- package/dist/{menu-DLdGFJSB.js.map → menu-CQA4Qp2Y.js.map} +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{notification-service-Y81cuyI1.cjs → notification-service-DOGtyP8q.cjs} +2 -2
- package/dist/{notification-service-Y81cuyI1.cjs.map → notification-service-DOGtyP8q.cjs.map} +1 -1
- package/dist/{notification-service-B--dZyDk.js → notification-service-f8ZFvvbw.js} +3 -3
- package/dist/{notification-service-B--dZyDk.js.map → notification-service-f8ZFvvbw.js.map} +1 -1
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-Y52lFc0k.cjs → option-BR_cajUP.cjs} +2 -2
- package/dist/{option-Y52lFc0k.cjs.map → option-BR_cajUP.cjs.map} +1 -1
- package/dist/{option-Jf25Ua_q.js → option-Cpedd_4h.js} +2 -2
- package/dist/{option-Jf25Ua_q.js.map → option-Cpedd_4h.js.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{payment-card-form-Bzx839eL.js → payment-card-form-68K9Fcg4.js} +3 -3
- package/dist/{payment-card-form-Bzx839eL.js.map → payment-card-form-68K9Fcg4.js.map} +1 -1
- package/dist/{payment-card-form-CeW7v8C6.cjs → payment-card-form-CdrMcc5c.cjs} +2 -2
- package/dist/{payment-card-form-CeW7v8C6.cjs.map → payment-card-form-CdrMcc5c.cjs.map} +1 -1
- package/dist/{radio-group-D0lUCZoy.js → radio-group-Ci86SQ4t.js} +2 -2
- package/dist/{radio-group-D0lUCZoy.js.map → radio-group-Ci86SQ4t.js.map} +1 -1
- package/dist/{radio-group-DaIoovBv.cjs → radio-group-FInGxSDU.cjs} +2 -2
- package/dist/{radio-group-DaIoovBv.cjs.map → radio-group-FInGxSDU.cjs.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{schmancy-steps-container-DN_2r-CO.js → schmancy-steps-container-fi5g1HML.js} +2 -2
- package/dist/{schmancy-steps-container-DN_2r-CO.js.map → schmancy-steps-container-fi5g1HML.js.map} +1 -1
- package/dist/{schmancy-steps-container-CTGyq1in.cjs → schmancy-steps-container-iHTmuKkc.cjs} +2 -2
- package/dist/{schmancy-steps-container-CTGyq1in.cjs.map → schmancy-steps-container-iHTmuKkc.cjs.map} +1 -1
- package/dist/{select-ChfaG1oV.js → select-4Mzh9N-F.js} +3 -3
- package/dist/{select-ChfaG1oV.js.map → select-4Mzh9N-F.js.map} +1 -1
- package/dist/{select-F73s56La.cjs → select-DfzEP7n4.cjs} +2 -2
- package/dist/{select-F73s56La.cjs.map → select-DfzEP7n4.cjs.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/{sheet-BMv294LB.cjs → sheet-DfHOLchM.cjs} +2 -2
- package/dist/{sheet-BMv294LB.cjs.map → sheet-DfHOLchM.cjs.map} +1 -1
- package/dist/{sheet-D_sv4wbj.js → sheet-GOrA8B2u.js} +3 -3
- package/dist/{sheet-D_sv4wbj.js.map → sheet-GOrA8B2u.js.map} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-CJXXfzVG.js → slider--xxBzPJ6.js} +3 -3
- package/dist/{slider-CJXXfzVG.js.map → slider--xxBzPJ6.js.map} +1 -1
- package/dist/{slider-d4pNWdNo.cjs → slider-YyZnXMOX.cjs} +2 -2
- package/dist/{slider-d4pNWdNo.cjs.map → slider-YyZnXMOX.cjs.map} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/{spinner-DFyG-_vp.js → spinner-Bd1aWVNB.js} +3 -3
- package/dist/{spinner-DFyG-_vp.js.map → spinner-Bd1aWVNB.js.map} +1 -1
- package/dist/{spinner-Cyoa6FUg.cjs → spinner-D35seXuq.cjs} +2 -2
- package/dist/{spinner-Cyoa6FUg.cjs.map → spinner-D35seXuq.cjs.map} +1 -1
- package/dist/steps.cjs +1 -1
- package/dist/steps.js +1 -1
- package/dist/{surface-CnL6po0z.js → surface-CkiumzDj.js} +2 -2
- package/dist/{surface-CnL6po0z.js.map → surface-CkiumzDj.js.map} +1 -1
- package/dist/{surface-BiwDfTwH.cjs → surface-u3lOyjll.cjs} +2 -2
- package/dist/{surface-BiwDfTwH.cjs.map → surface-u3lOyjll.cjs.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/{table-DY3znSpx.cjs → table-Cfe1Zloe.cjs} +2 -2
- package/dist/{table-DY3znSpx.cjs.map → table-Cfe1Zloe.cjs.map} +1 -1
- package/dist/{table-DuGCm_ZT.js → table-DPXzmJkJ.js} +2 -2
- package/dist/{table-DuGCm_ZT.js.map → table-DPXzmJkJ.js.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-group-DNIr9bXC.js → tabs-group-CBXEoVBr.js} +2 -2
- package/dist/{tabs-group-DNIr9bXC.js.map → tabs-group-CBXEoVBr.js.map} +1 -1
- package/dist/{tabs-group-CLoDXsPN.cjs → tabs-group-MGpxSLVK.cjs} +2 -2
- package/dist/{tabs-group-CLoDXsPN.cjs.map → tabs-group-MGpxSLVK.cjs.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tailwind.mixin-B9QsShMd.cjs +2 -0
- package/dist/{tailwind.mixin-C-SZB7Or.cjs.map → tailwind.mixin-B9QsShMd.cjs.map} +1 -1
- package/dist/tailwind.mixin-DxW0KQ-d.js +43 -0
- package/dist/{tailwind.mixin-PpOEXUY6.js.map → tailwind.mixin-DxW0KQ-d.js.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-CxKPwLNT.js → textarea-BkXQqdc4.js} +2 -2
- package/dist/{textarea-CxKPwLNT.js.map → textarea-BkXQqdc4.js.map} +1 -1
- package/dist/{textarea-Dbn8e_6U.cjs → textarea-CylQCLpW.cjs} +2 -2
- package/dist/{textarea-Dbn8e_6U.cjs.map → textarea-CylQCLpW.cjs.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-button-BWLSsLkw.js → theme-button-BLSsCZni.js} +2 -2
- package/dist/{theme-button-BWLSsLkw.js.map → theme-button-BLSsCZni.js.map} +1 -1
- package/dist/{theme-button-D9peR8Hg.cjs → theme-button-BSpshrnu.cjs} +2 -2
- package/dist/{theme-button-D9peR8Hg.cjs.map → theme-button-BSpshrnu.cjs.map} +1 -1
- package/dist/theme-button.cjs +1 -1
- package/dist/theme-button.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{theme.component-BZz_gSfx.js → theme.component-B6OPvX11.js} +2 -2
- package/dist/{theme.component-BZz_gSfx.js.map → theme.component-B6OPvX11.js.map} +1 -1
- package/dist/{theme.component-BQhUaquX.cjs → theme.component-Cbjb7vBh.cjs} +2 -2
- package/dist/{theme.component-BQhUaquX.cjs.map → theme.component-Cbjb7vBh.cjs.map} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{timezone-CvRTvxiu.js → timezone-B_UNEVCu.js} +3 -3
- package/dist/{timezone-CvRTvxiu.js.map → timezone-B_UNEVCu.js.map} +1 -1
- package/dist/{timezone-B4sTteJT.cjs → timezone-BydmQhke.cjs} +2 -2
- package/dist/{timezone-B4sTteJT.cjs.map → timezone-BydmQhke.cjs.map} +1 -1
- package/dist/{tooltip-BvlP4LLw.js → tooltip-3phi-zvc.js} +2 -2
- package/dist/{tooltip-BvlP4LLw.js.map → tooltip-3phi-zvc.js.map} +1 -1
- package/dist/{tooltip-CKmoUynJ.cjs → tooltip-Bs1R5e8R.cjs} +2 -2
- package/dist/{tooltip-CKmoUynJ.cjs.map → tooltip-Bs1R5e8R.cjs.map} +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/{tree-Pa4t5MHy.cjs → tree-C68UrNiC.cjs} +2 -2
- package/dist/{tree-Pa4t5MHy.cjs.map → tree-C68UrNiC.cjs.map} +1 -1
- package/dist/{tree-UFPk4UJM.js → tree-DSeadYt9.js} +2 -2
- package/dist/{tree-UFPk4UJM.js.map → tree-DSeadYt9.js.map} +1 -1
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/{typewriter-DXYFRAAl.cjs → typewriter-CFgNAfJm.cjs} +2 -2
- package/dist/{typewriter-DXYFRAAl.cjs.map → typewriter-CFgNAfJm.cjs.map} +1 -1
- package/dist/{typewriter-CEFN5I2Z.js → typewriter-Ckxnim4-.js} +4 -4
- package/dist/{typewriter-CEFN5I2Z.js.map → typewriter-Ckxnim4-.js.map} +1 -1
- package/dist/typewriter.cjs +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/{typography-CF76Gm8m.cjs → typography-B7lbxH4O.cjs} +2 -2
- package/dist/{typography-CF76Gm8m.cjs.map → typography-B7lbxH4O.cjs.map} +1 -1
- package/dist/{typography-DG3juvGV.js → typography-xqI7xXeK.js} +2 -2
- package/dist/{typography-DG3juvGV.js.map → typography-xqI7xXeK.js.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/package.json +1 -1
- package/types/src/avatar.d.ts +46 -0
- package/types/src/content-drawer/drawer.d.ts +1 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/nav-drawer/drawer.d.ts +1 -1
- package/dist/tailwind.mixin-C-SZB7Or.cjs +0 -2
- package/dist/tailwind.mixin-PpOEXUY6.js +0 -43
- package/dist/teleport.component-DX75dmIp.cjs +0 -206
- package/dist/teleport.component-DX75dmIp.cjs.map +0 -1
- package/dist/teleport.component-bQFYfK94.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { computePosition as u, offset as b, flip as g, shift as y, autoUpdate as
|
|
|
2
2
|
import { merge as m, fromEvent as l, takeUntil as d } from "rxjs";
|
|
3
3
|
import "lit/directives/class-map.js";
|
|
4
4
|
import "lit/directives/style-map.js";
|
|
5
|
-
import { T as f } from "./tailwind.mixin-
|
|
5
|
+
import { T as f } from "./tailwind.mixin-DxW0KQ-d.js";
|
|
6
6
|
import { html as v } from "lit";
|
|
7
7
|
import { property as p, query as c, queryAssignedElements as T, customElement as C } from "lit/decorators.js";
|
|
8
8
|
var x = Object.defineProperty, I = Object.getOwnPropertyDescriptor, i = (e, r, h, s) => {
|
|
@@ -71,4 +71,4 @@ i([p({ type: String })], t.prototype, "placement", 2), i([p({ type: Number })],
|
|
|
71
71
|
export {
|
|
72
72
|
t as S
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=tooltip-
|
|
74
|
+
//# sourceMappingURL=tooltip-3phi-zvc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-BvlP4LLw.js","sources":["../src/tooltip/tooltip.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil } from 'rxjs'\n\n/**\n * @element schmancy-tooltip\n * A tooltip component that displays additional information when hovering or focusing an element.\n *\n * @slot - The default slot for the trigger element\n * @slot content - The content to display in the tooltip\n *\n * @csspart tooltip - The tooltip container element\n * @csspart arrow - The tooltip arrow element\n *\n * @example\n * <schmancy-tooltip>\n * <div slot=\"content\">Tooltip content here</div>\n * <schmancy-button>Hover me</schmancy-button>\n * </schmancy-tooltip>\n */\n@customElement('schmancy-tooltip')\nexport class SchmancyTooltip extends TailwindElement() {\n\t/**\n\t * The placement of the tooltip relative to the trigger element\n\t * @attr\n\t */\n\t@property({ type: String })\n\tplacement: 'top' | 'right' | 'bottom' | 'left' = 'top'\n\n\t/**\n\t * The offset distance from the trigger element in pixels\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t/**\n\t * The delay before showing the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tshowDelay = 300\n\n\t/**\n\t * The delay before hiding the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\thideDelay = 100\n\n\t/**\n\t * Whether the tooltip should be shown\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Whether to disable the tooltip\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled = false\n\n\t@query('#tooltip') tooltip!: HTMLElement\n\t@query('#trigger-container') triggerContainer!: HTMLElement\n\t@query('#arrow') arrow!: HTMLElement\n\n\t@queryAssignedElements({ flatten: true })\n\ttriggerElements!: HTMLElement[]\n\n\tprivate cleanupPositioner?: () => void\n\tprivate showTimeoutId?: number\n\tprivate hideTimeoutId?: number\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setAttribute('aria-live', 'polite')\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.cleanupPositioner?.()\n\t\tif (this.showTimeoutId) clearTimeout(this.showTimeoutId)\n\t\tif (this.hideTimeoutId) clearTimeout(this.hideTimeoutId)\n\t}\n\n\tprivate async updatePosition() {\n\t\tif (!this.triggerContainer || !this.tooltip) return\n\n\t\tconst { x, y, placement, middlewareData } = await computePosition(this.triggerContainer, this.tooltip, {\n\t\t\tplacement: this.placement,\n\t\t\tmiddleware: [offset(this.distance), flip(), shift({ padding: 8 })],\n\t\t})\n\n\t\t// Position tooltip\n\t\tObject.assign(this.tooltip.style, {\n\t\t\tleft: `${x}px`,\n\t\t\ttop: `${y}px`,\n\t\t})\n\n\t\t// Position arrow if it exists\n\t\tif (this.arrow) {\n\t\t\tconst staticSide = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tright: 'left',\n\t\t\t\tbottom: 'top',\n\t\t\t\tleft: 'right',\n\t\t\t}[placement.split('-')[0]]\n\n\t\t\tif (staticSide) {\n\t\t\t\tObject.assign(this.arrow.style, {\n\t\t\t\t\tleft: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',\n\t\t\t\t\ttop: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',\n\t\t\t\t\tright: '',\n\t\t\t\t\tbottom: '',\n\t\t\t\t\t[staticSide]: '-4px',\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup the auto-updating position and trigger events\n\t */\n\tfirstUpdated() {\n\t\t// The trigger container holds all the slotted trigger elements\n\t\tif (!this.triggerContainer) return\n\n\t\t// Setup event listeners for the trigger container\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseenter'), fromEvent(this.triggerContainer, 'focus'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleShow()\n\t\t\t})\n\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseleave'), fromEvent(this.triggerContainer, 'blur'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleHide()\n\t\t\t})\n\n\t\t// Add key event listener for escape key\n\t\tfromEvent<KeyboardEvent>(window, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(event => {\n\t\t\t\tif (event.key === 'Escape' && this.open) {\n\t\t\t\t\tthis.hide()\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\t/**\n\t * Schedule showing the tooltip with the configured delay\n\t */\n\tprivate scheduleShow() {\n\t\tif (this.hideTimeoutId) {\n\t\t\tclearTimeout(this.hideTimeoutId)\n\t\t\tthis.hideTimeoutId = undefined\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\tthis.showTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.show()\n\t\t\t}, this.showDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Schedule hiding the tooltip with the configured delay\n\t */\n\tprivate scheduleHide() {\n\t\tif (this.showTimeoutId) {\n\t\t\tclearTimeout(this.showTimeoutId)\n\t\t\tthis.showTimeoutId = undefined\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis.hideTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.hide()\n\t\t\t}, this.hideDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Show the tooltip\n\t */\n\tpublic show() {\n\t\tif (this.disabled || this.open) return\n\n\t\tthis.open = true\n\n\t\t// Position the tooltip\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.tooltip, () => this.updatePosition())\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-show', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Hide the tooltip\n\t */\n\tpublic hide() {\n\t\tif (!this.open) return\n\n\t\tthis.open = false\n\n\t\t// Cleanup the positioner\n\t\tif (this.cleanupPositioner) {\n\t\t\tthis.cleanupPositioner()\n\t\t\tthis.cleanupPositioner = undefined\n\t\t}\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-hide', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst tooltipClasses = {\n\t\t\t'absolute z-50 bg-surface-highest text-surface-on rounded-md shadow-md': true,\n\t\t\t'max-w-xs opacity-0 invisible scale-95 transition-all duration-150': true,\n\t\t\t'opacity-100 visible scale-100': this.open,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div id=\"trigger-container\" class=\"inline-block\" aria-describedby=\"tooltip\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div id=\"tooltip\" part=\"tooltip\" role=\"tooltip\" class=\"${this.classMap(tooltipClasses)}\">\n\t\t\t\t<slot name=\"content\"></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tooltip': SchmancyTooltip\n\t}\n}\n"],"names":["SchmancyTooltip","TailwindElement","super","arguments","this","placement","distance","showDelay","hideDelay","open","disabled","connectedCallback","setAttribute","disconnectedCallback","cleanupPositioner","showTimeoutId","clearTimeout","hideTimeoutId","updatePosition","triggerContainer","tooltip","x","y","middlewareData","computePosition","middleware","offset","flip","shift","padding","Object","assign","style","left","top","arrow","staticSide","right","bottom","split","merge","fromEvent","pipe","takeUntil","disconnecting","subscribe","scheduleShow","scheduleHide","window","event","key","hide","setTimeout","show","autoUpdate","dispatchEvent","CustomEvent","bubbles","composed","render","tooltipClasses","html","classMap","__decorateClass","property","type","String","prototype","Number","Boolean","reflect","query","queryAssignedElements","flatten","customElement"],"mappings":";;;;;;;;;;;AAuBa,IAAAA,IAAN,cAA8BC,EAAAA,EAAAA;AAAAA,EAA9B,cAAAC;AAAAA,UAAAA,GAAAC,YAM2CC,KAAAC,YAAA,OAOtCD,KAAAE,WAAA,GAOCF,KAAAG,YAAA,KAOAH,KAAAI,YAAA,KAOLJ,KAAAK,OAAA,IAOIL,KAAAM,WAAAA;AAAAA,EAAA;AAAA,EAaX,oBACCR;AAAAA,UAAMS,qBACDP,KAAAQ,aAAa,aAAa,QAAQ;AAAA,EAAA;AAAA,EAGxC,uBACCV;;AAAAA,UAAMW,yBACNT,IAAAA,KAAKU,sBAALV,QAAAA,EAAAA,YACIA,KAAKW,iBAA4BC,aAAAZ,KAAKW,aACtCX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|
1
|
+
{"version":3,"file":"tooltip-3phi-zvc.js","sources":["../src/tooltip/tooltip.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil } from 'rxjs'\n\n/**\n * @element schmancy-tooltip\n * A tooltip component that displays additional information when hovering or focusing an element.\n *\n * @slot - The default slot for the trigger element\n * @slot content - The content to display in the tooltip\n *\n * @csspart tooltip - The tooltip container element\n * @csspart arrow - The tooltip arrow element\n *\n * @example\n * <schmancy-tooltip>\n * <div slot=\"content\">Tooltip content here</div>\n * <schmancy-button>Hover me</schmancy-button>\n * </schmancy-tooltip>\n */\n@customElement('schmancy-tooltip')\nexport class SchmancyTooltip extends TailwindElement() {\n\t/**\n\t * The placement of the tooltip relative to the trigger element\n\t * @attr\n\t */\n\t@property({ type: String })\n\tplacement: 'top' | 'right' | 'bottom' | 'left' = 'top'\n\n\t/**\n\t * The offset distance from the trigger element in pixels\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t/**\n\t * The delay before showing the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tshowDelay = 300\n\n\t/**\n\t * The delay before hiding the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\thideDelay = 100\n\n\t/**\n\t * Whether the tooltip should be shown\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Whether to disable the tooltip\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled = false\n\n\t@query('#tooltip') tooltip!: HTMLElement\n\t@query('#trigger-container') triggerContainer!: HTMLElement\n\t@query('#arrow') arrow!: HTMLElement\n\n\t@queryAssignedElements({ flatten: true })\n\ttriggerElements!: HTMLElement[]\n\n\tprivate cleanupPositioner?: () => void\n\tprivate showTimeoutId?: number\n\tprivate hideTimeoutId?: number\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setAttribute('aria-live', 'polite')\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.cleanupPositioner?.()\n\t\tif (this.showTimeoutId) clearTimeout(this.showTimeoutId)\n\t\tif (this.hideTimeoutId) clearTimeout(this.hideTimeoutId)\n\t}\n\n\tprivate async updatePosition() {\n\t\tif (!this.triggerContainer || !this.tooltip) return\n\n\t\tconst { x, y, placement, middlewareData } = await computePosition(this.triggerContainer, this.tooltip, {\n\t\t\tplacement: this.placement,\n\t\t\tmiddleware: [offset(this.distance), flip(), shift({ padding: 8 })],\n\t\t})\n\n\t\t// Position tooltip\n\t\tObject.assign(this.tooltip.style, {\n\t\t\tleft: `${x}px`,\n\t\t\ttop: `${y}px`,\n\t\t})\n\n\t\t// Position arrow if it exists\n\t\tif (this.arrow) {\n\t\t\tconst staticSide = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tright: 'left',\n\t\t\t\tbottom: 'top',\n\t\t\t\tleft: 'right',\n\t\t\t}[placement.split('-')[0]]\n\n\t\t\tif (staticSide) {\n\t\t\t\tObject.assign(this.arrow.style, {\n\t\t\t\t\tleft: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',\n\t\t\t\t\ttop: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',\n\t\t\t\t\tright: '',\n\t\t\t\t\tbottom: '',\n\t\t\t\t\t[staticSide]: '-4px',\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup the auto-updating position and trigger events\n\t */\n\tfirstUpdated() {\n\t\t// The trigger container holds all the slotted trigger elements\n\t\tif (!this.triggerContainer) return\n\n\t\t// Setup event listeners for the trigger container\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseenter'), fromEvent(this.triggerContainer, 'focus'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleShow()\n\t\t\t})\n\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseleave'), fromEvent(this.triggerContainer, 'blur'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleHide()\n\t\t\t})\n\n\t\t// Add key event listener for escape key\n\t\tfromEvent<KeyboardEvent>(window, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(event => {\n\t\t\t\tif (event.key === 'Escape' && this.open) {\n\t\t\t\t\tthis.hide()\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\t/**\n\t * Schedule showing the tooltip with the configured delay\n\t */\n\tprivate scheduleShow() {\n\t\tif (this.hideTimeoutId) {\n\t\t\tclearTimeout(this.hideTimeoutId)\n\t\t\tthis.hideTimeoutId = undefined\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\tthis.showTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.show()\n\t\t\t}, this.showDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Schedule hiding the tooltip with the configured delay\n\t */\n\tprivate scheduleHide() {\n\t\tif (this.showTimeoutId) {\n\t\t\tclearTimeout(this.showTimeoutId)\n\t\t\tthis.showTimeoutId = undefined\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis.hideTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.hide()\n\t\t\t}, this.hideDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Show the tooltip\n\t */\n\tpublic show() {\n\t\tif (this.disabled || this.open) return\n\n\t\tthis.open = true\n\n\t\t// Position the tooltip\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.tooltip, () => this.updatePosition())\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-show', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Hide the tooltip\n\t */\n\tpublic hide() {\n\t\tif (!this.open) return\n\n\t\tthis.open = false\n\n\t\t// Cleanup the positioner\n\t\tif (this.cleanupPositioner) {\n\t\t\tthis.cleanupPositioner()\n\t\t\tthis.cleanupPositioner = undefined\n\t\t}\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-hide', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst tooltipClasses = {\n\t\t\t'absolute z-50 bg-surface-highest text-surface-on rounded-md shadow-md': true,\n\t\t\t'max-w-xs opacity-0 invisible scale-95 transition-all duration-150': true,\n\t\t\t'opacity-100 visible scale-100': this.open,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div id=\"trigger-container\" class=\"inline-block\" aria-describedby=\"tooltip\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div id=\"tooltip\" part=\"tooltip\" role=\"tooltip\" class=\"${this.classMap(tooltipClasses)}\">\n\t\t\t\t<slot name=\"content\"></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tooltip': SchmancyTooltip\n\t}\n}\n"],"names":["SchmancyTooltip","TailwindElement","super","arguments","this","placement","distance","showDelay","hideDelay","open","disabled","connectedCallback","setAttribute","disconnectedCallback","cleanupPositioner","showTimeoutId","clearTimeout","hideTimeoutId","updatePosition","triggerContainer","tooltip","x","y","middlewareData","computePosition","middleware","offset","flip","shift","padding","Object","assign","style","left","top","arrow","staticSide","right","bottom","split","merge","fromEvent","pipe","takeUntil","disconnecting","subscribe","scheduleShow","scheduleHide","window","event","key","hide","setTimeout","show","autoUpdate","dispatchEvent","CustomEvent","bubbles","composed","render","tooltipClasses","html","classMap","__decorateClass","property","type","String","pr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CC,EAAS,EAAEC,MAAMI,SAASC,SAAS,GAAA,CAAA,CAAA,GAxCxBtE,EAyCZmE,WAAA,YAAA,CAAA,GAEmBJ,EAAA,CAAlBQ,EAAM,UA3CKvE,CAAAA,GAAAA,EA2COmE,WAAA,WAAA,IACUJ,EAAA,CAA5BQ,EAAM,oBAAA,CAAA,GA5CKvE,EA4CiBmE,WAAA,oBAAA,CACZJ,GAAAA,EAAA,CAAhBQ,EAAM,QAAA,CAAA,GA7CKvE,EA6CKmE,WAAA,SAAA,CAGjBJ,GAAAA,EAAA,CADCS,EAAsB,EAAEC,SAAS,GAAA,CAAA,CAAA,GA/CtBzE,EAgDZmE,WAAA,mBAAA,CAAA,GAhDYnE,IAAN+D,EAAA,CADNW,EAAc,kBAAA,CAAA,GACF1E;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("@floating-ui/dom"),s=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const l=require("./tailwind.mixin-
|
|
1
|
+
"use strict";const c=require("@floating-ui/dom"),s=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const l=require("./tailwind.mixin-B9QsShMd.cjs"),d=require("lit"),e=require("lit/decorators.js");var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,i=(t,n,a,r)=>{for(var h,o=r>1?void 0:r?m(n,a):n,p=t.length-1;p>=0;p--)(h=t[p])&&(o=(r?h(n,a,o):h(o))||o);return r&&o&&u(n,a,o),o};exports.SchmancyTooltip=class extends l.TailwindElement(){constructor(){super(...arguments),this.placement="top",this.distance=8,this.showDelay=300,this.hideDelay=100,this.open=!1,this.disabled=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-live","polite")}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.cleanupPositioner)==null||t.call(this),this.showTimeoutId&&clearTimeout(this.showTimeoutId),this.hideTimeoutId&&clearTimeout(this.hideTimeoutId)}async updatePosition(){var h,o;if(!this.triggerContainer||!this.tooltip)return;const{x:t,y:n,placement:a,middlewareData:r}=await c.computePosition(this.triggerContainer,this.tooltip,{placement:this.placement,middleware:[c.offset(this.distance),c.flip(),c.shift({padding:8})]});if(Object.assign(this.tooltip.style,{left:`${t}px`,top:`${n}px`}),this.arrow){const p={top:"bottom",right:"left",bottom:"top",left:"right"}[a.split("-")[0]];p&&Object.assign(this.arrow.style,{left:((h=r.arrow)==null?void 0:h.x)!=null?`${r.arrow.x}px`:"",top:((o=r.arrow)==null?void 0:o.y)!=null?`${r.arrow.y}px`:"",right:"",bottom:"",[p]:"-4px"})}}firstUpdated(){this.triggerContainer&&(s.merge(s.fromEvent(this.triggerContainer,"mouseenter"),s.fromEvent(this.triggerContainer,"focus")).pipe(s.takeUntil(this.disconnecting)).subscribe(()=>{this.disabled||this.scheduleShow()}),s.merge(s.fromEvent(this.triggerContainer,"mouseleave"),s.fromEvent(this.triggerContainer,"blur")).pipe(s.takeUntil(this.disconnecting)).subscribe(()=>{this.disabled||this.scheduleHide()}),s.fromEvent(window,"keydown").pipe(s.takeUntil(this.disconnecting)).subscribe(t=>{t.key==="Escape"&&this.open&&this.hide()}))}scheduleShow(){this.hideTimeoutId&&(clearTimeout(this.hideTimeoutId),this.hideTimeoutId=void 0),this.open||(this.showTimeoutId=window.setTimeout(()=>{this.show()},this.showDelay))}scheduleHide(){this.showTimeoutId&&(clearTimeout(this.showTimeoutId),this.showTimeoutId=void 0),this.open&&(this.hideTimeoutId=window.setTimeout(()=>{this.hide()},this.hideDelay))}show(){this.disabled||this.open||(this.open=!0,this.cleanupPositioner=c.autoUpdate(this.triggerContainer,this.tooltip,()=>this.updatePosition()),this.dispatchEvent(new CustomEvent("schmancy-tooltip-show",{bubbles:!0,composed:!0})))}hide(){this.open&&(this.open=!1,this.cleanupPositioner&&(this.cleanupPositioner(),this.cleanupPositioner=void 0),this.dispatchEvent(new CustomEvent("schmancy-tooltip-hide",{bubbles:!0,composed:!0})))}render(){const t={"absolute z-50 bg-surface-highest text-surface-on rounded-md shadow-md":!0,"max-w-xs opacity-0 invisible scale-95 transition-all duration-150":!0,"opacity-100 visible scale-100":this.open};return d.html`
|
|
2
2
|
<div id="trigger-container" class="inline-block" aria-describedby="tooltip">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
<slot name="content"></slot>
|
|
8
8
|
</div>
|
|
9
9
|
`}},i([e.property({type:String})],exports.SchmancyTooltip.prototype,"placement",2),i([e.property({type:Number})],exports.SchmancyTooltip.prototype,"distance",2),i([e.property({type:Number})],exports.SchmancyTooltip.prototype,"showDelay",2),i([e.property({type:Number})],exports.SchmancyTooltip.prototype,"hideDelay",2),i([e.property({type:Boolean,reflect:!0})],exports.SchmancyTooltip.prototype,"open",2),i([e.property({type:Boolean,reflect:!0})],exports.SchmancyTooltip.prototype,"disabled",2),i([e.query("#tooltip")],exports.SchmancyTooltip.prototype,"tooltip",2),i([e.query("#trigger-container")],exports.SchmancyTooltip.prototype,"triggerContainer",2),i([e.query("#arrow")],exports.SchmancyTooltip.prototype,"arrow",2),i([e.queryAssignedElements({flatten:!0})],exports.SchmancyTooltip.prototype,"triggerElements",2),exports.SchmancyTooltip=i([e.customElement("schmancy-tooltip")],exports.SchmancyTooltip);
|
|
10
|
-
//# sourceMappingURL=tooltip-
|
|
10
|
+
//# sourceMappingURL=tooltip-Bs1R5e8R.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-CKmoUynJ.cjs","sources":["../src/tooltip/tooltip.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil } from 'rxjs'\n\n/**\n * @element schmancy-tooltip\n * A tooltip component that displays additional information when hovering or focusing an element.\n *\n * @slot - The default slot for the trigger element\n * @slot content - The content to display in the tooltip\n *\n * @csspart tooltip - The tooltip container element\n * @csspart arrow - The tooltip arrow element\n *\n * @example\n * <schmancy-tooltip>\n * <div slot=\"content\">Tooltip content here</div>\n * <schmancy-button>Hover me</schmancy-button>\n * </schmancy-tooltip>\n */\n@customElement('schmancy-tooltip')\nexport class SchmancyTooltip extends TailwindElement() {\n\t/**\n\t * The placement of the tooltip relative to the trigger element\n\t * @attr\n\t */\n\t@property({ type: String })\n\tplacement: 'top' | 'right' | 'bottom' | 'left' = 'top'\n\n\t/**\n\t * The offset distance from the trigger element in pixels\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t/**\n\t * The delay before showing the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tshowDelay = 300\n\n\t/**\n\t * The delay before hiding the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\thideDelay = 100\n\n\t/**\n\t * Whether the tooltip should be shown\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Whether to disable the tooltip\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled = false\n\n\t@query('#tooltip') tooltip!: HTMLElement\n\t@query('#trigger-container') triggerContainer!: HTMLElement\n\t@query('#arrow') arrow!: HTMLElement\n\n\t@queryAssignedElements({ flatten: true })\n\ttriggerElements!: HTMLElement[]\n\n\tprivate cleanupPositioner?: () => void\n\tprivate showTimeoutId?: number\n\tprivate hideTimeoutId?: number\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setAttribute('aria-live', 'polite')\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.cleanupPositioner?.()\n\t\tif (this.showTimeoutId) clearTimeout(this.showTimeoutId)\n\t\tif (this.hideTimeoutId) clearTimeout(this.hideTimeoutId)\n\t}\n\n\tprivate async updatePosition() {\n\t\tif (!this.triggerContainer || !this.tooltip) return\n\n\t\tconst { x, y, placement, middlewareData } = await computePosition(this.triggerContainer, this.tooltip, {\n\t\t\tplacement: this.placement,\n\t\t\tmiddleware: [offset(this.distance), flip(), shift({ padding: 8 })],\n\t\t})\n\n\t\t// Position tooltip\n\t\tObject.assign(this.tooltip.style, {\n\t\t\tleft: `${x}px`,\n\t\t\ttop: `${y}px`,\n\t\t})\n\n\t\t// Position arrow if it exists\n\t\tif (this.arrow) {\n\t\t\tconst staticSide = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tright: 'left',\n\t\t\t\tbottom: 'top',\n\t\t\t\tleft: 'right',\n\t\t\t}[placement.split('-')[0]]\n\n\t\t\tif (staticSide) {\n\t\t\t\tObject.assign(this.arrow.style, {\n\t\t\t\t\tleft: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',\n\t\t\t\t\ttop: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',\n\t\t\t\t\tright: '',\n\t\t\t\t\tbottom: '',\n\t\t\t\t\t[staticSide]: '-4px',\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup the auto-updating position and trigger events\n\t */\n\tfirstUpdated() {\n\t\t// The trigger container holds all the slotted trigger elements\n\t\tif (!this.triggerContainer) return\n\n\t\t// Setup event listeners for the trigger container\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseenter'), fromEvent(this.triggerContainer, 'focus'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleShow()\n\t\t\t})\n\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseleave'), fromEvent(this.triggerContainer, 'blur'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleHide()\n\t\t\t})\n\n\t\t// Add key event listener for escape key\n\t\tfromEvent<KeyboardEvent>(window, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(event => {\n\t\t\t\tif (event.key === 'Escape' && this.open) {\n\t\t\t\t\tthis.hide()\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\t/**\n\t * Schedule showing the tooltip with the configured delay\n\t */\n\tprivate scheduleShow() {\n\t\tif (this.hideTimeoutId) {\n\t\t\tclearTimeout(this.hideTimeoutId)\n\t\t\tthis.hideTimeoutId = undefined\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\tthis.showTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.show()\n\t\t\t}, this.showDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Schedule hiding the tooltip with the configured delay\n\t */\n\tprivate scheduleHide() {\n\t\tif (this.showTimeoutId) {\n\t\t\tclearTimeout(this.showTimeoutId)\n\t\t\tthis.showTimeoutId = undefined\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis.hideTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.hide()\n\t\t\t}, this.hideDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Show the tooltip\n\t */\n\tpublic show() {\n\t\tif (this.disabled || this.open) return\n\n\t\tthis.open = true\n\n\t\t// Position the tooltip\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.tooltip, () => this.updatePosition())\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-show', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Hide the tooltip\n\t */\n\tpublic hide() {\n\t\tif (!this.open) return\n\n\t\tthis.open = false\n\n\t\t// Cleanup the positioner\n\t\tif (this.cleanupPositioner) {\n\t\t\tthis.cleanupPositioner()\n\t\t\tthis.cleanupPositioner = undefined\n\t\t}\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-hide', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst tooltipClasses = {\n\t\t\t'absolute z-50 bg-surface-highest text-surface-on rounded-md shadow-md': true,\n\t\t\t'max-w-xs opacity-0 invisible scale-95 transition-all duration-150': true,\n\t\t\t'opacity-100 visible scale-100': this.open,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div id=\"trigger-container\" class=\"inline-block\" aria-describedby=\"tooltip\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div id=\"tooltip\" part=\"tooltip\" role=\"tooltip\" class=\"${this.classMap(tooltipClasses)}\">\n\t\t\t\t<slot name=\"content\"></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tooltip': SchmancyTooltip\n\t}\n}\n"],"names":["SchmancyTooltip","TailwindElement","super","arguments","this","placement","distance","showDelay","hideDelay","open","disabled","connectedCallback","setAttribute","disconnectedCallback","cleanupPositioner","showTimeoutId","clearTimeout","hideTimeoutId","updatePosition","triggerContainer","tooltip","x","y","middlewareData","computePosition","middleware","offset","flip","shift","padding","Object","assign","style","left","top","arrow","staticSide","right","bottom","split","firstUpdated","merge","fromEvent","pipe","takeUntil","disconnecting","subscribe","scheduleShow","scheduleHide","window","event","key","hide","setTimeout","show","autoUpdate","dispatchEvent","CustomEvent","bubbles","composed","render","tooltipClasses","html","classMap","__decorateClass","property","type","String","prototype","Number","Boolean","reflect","query","queryAssignedElements","flatten","customElement"],"mappings":"kbAuBaA,QAAAA,gBAAN,cAA8BC,EAAAA,gBAA9B,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAM2CC,KAAAC,UAAA,MAOtCD,KAAAE,SAAA,EAOCF,KAAAG,UAAA,IAOAH,KAAAI,UAAA,IAOLJ,KAAAK,KAAAA,GAOIL,KAAAM,SAAAA,EAAA,CAaX,mBAAAC,CACCT,MAAMS,kBACDP,EAAAA,KAAAQ,aA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AAA,QAAA,CAAA,EAGjBJ,EAAA,CADCS,wBAAsB,CAAEC,QAAAA,EA/Cb1E,CAAAA,CAAAA,EAAAA,wBAgDZoE,UAAA,kBAAA,CAAA,EAhDYpE,QAANA,gBAAAgE,EAAA,CADNW,EAAAA,cAAc,qBACF3E"}
|
|
1
|
+
{"version":3,"file":"tooltip-Bs1R5e8R.cjs","sources":["../src/tooltip/tooltip.ts"],"sourcesContent":["import { autoUpdate, computePosition, flip, offset, shift } from '@floating-ui/dom'\nimport { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil } from 'rxjs'\n\n/**\n * @element schmancy-tooltip\n * A tooltip component that displays additional information when hovering or focusing an element.\n *\n * @slot - The default slot for the trigger element\n * @slot content - The content to display in the tooltip\n *\n * @csspart tooltip - The tooltip container element\n * @csspart arrow - The tooltip arrow element\n *\n * @example\n * <schmancy-tooltip>\n * <div slot=\"content\">Tooltip content here</div>\n * <schmancy-button>Hover me</schmancy-button>\n * </schmancy-tooltip>\n */\n@customElement('schmancy-tooltip')\nexport class SchmancyTooltip extends TailwindElement() {\n\t/**\n\t * The placement of the tooltip relative to the trigger element\n\t * @attr\n\t */\n\t@property({ type: String })\n\tplacement: 'top' | 'right' | 'bottom' | 'left' = 'top'\n\n\t/**\n\t * The offset distance from the trigger element in pixels\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tdistance = 8\n\n\t/**\n\t * The delay before showing the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\tshowDelay = 300\n\n\t/**\n\t * The delay before hiding the tooltip in milliseconds\n\t * @attr\n\t */\n\t@property({ type: Number })\n\thideDelay = 100\n\n\t/**\n\t * Whether the tooltip should be shown\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\topen = false\n\n\t/**\n\t * Whether to disable the tooltip\n\t * @attr\n\t */\n\t@property({ type: Boolean, reflect: true })\n\tdisabled = false\n\n\t@query('#tooltip') tooltip!: HTMLElement\n\t@query('#trigger-container') triggerContainer!: HTMLElement\n\t@query('#arrow') arrow!: HTMLElement\n\n\t@queryAssignedElements({ flatten: true })\n\ttriggerElements!: HTMLElement[]\n\n\tprivate cleanupPositioner?: () => void\n\tprivate showTimeoutId?: number\n\tprivate hideTimeoutId?: number\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setAttribute('aria-live', 'polite')\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.cleanupPositioner?.()\n\t\tif (this.showTimeoutId) clearTimeout(this.showTimeoutId)\n\t\tif (this.hideTimeoutId) clearTimeout(this.hideTimeoutId)\n\t}\n\n\tprivate async updatePosition() {\n\t\tif (!this.triggerContainer || !this.tooltip) return\n\n\t\tconst { x, y, placement, middlewareData } = await computePosition(this.triggerContainer, this.tooltip, {\n\t\t\tplacement: this.placement,\n\t\t\tmiddleware: [offset(this.distance), flip(), shift({ padding: 8 })],\n\t\t})\n\n\t\t// Position tooltip\n\t\tObject.assign(this.tooltip.style, {\n\t\t\tleft: `${x}px`,\n\t\t\ttop: `${y}px`,\n\t\t})\n\n\t\t// Position arrow if it exists\n\t\tif (this.arrow) {\n\t\t\tconst staticSide = {\n\t\t\t\ttop: 'bottom',\n\t\t\t\tright: 'left',\n\t\t\t\tbottom: 'top',\n\t\t\t\tleft: 'right',\n\t\t\t}[placement.split('-')[0]]\n\n\t\t\tif (staticSide) {\n\t\t\t\tObject.assign(this.arrow.style, {\n\t\t\t\t\tleft: middlewareData.arrow?.x != null ? `${middlewareData.arrow.x}px` : '',\n\t\t\t\t\ttop: middlewareData.arrow?.y != null ? `${middlewareData.arrow.y}px` : '',\n\t\t\t\t\tright: '',\n\t\t\t\t\tbottom: '',\n\t\t\t\t\t[staticSide]: '-4px',\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Setup the auto-updating position and trigger events\n\t */\n\tfirstUpdated() {\n\t\t// The trigger container holds all the slotted trigger elements\n\t\tif (!this.triggerContainer) return\n\n\t\t// Setup event listeners for the trigger container\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseenter'), fromEvent(this.triggerContainer, 'focus'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleShow()\n\t\t\t})\n\n\t\tmerge(fromEvent(this.triggerContainer, 'mouseleave'), fromEvent(this.triggerContainer, 'blur'))\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(() => {\n\t\t\t\tif (this.disabled) return\n\t\t\t\tthis.scheduleHide()\n\t\t\t})\n\n\t\t// Add key event listener for escape key\n\t\tfromEvent<KeyboardEvent>(window, 'keydown')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(event => {\n\t\t\t\tif (event.key === 'Escape' && this.open) {\n\t\t\t\t\tthis.hide()\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\t/**\n\t * Schedule showing the tooltip with the configured delay\n\t */\n\tprivate scheduleShow() {\n\t\tif (this.hideTimeoutId) {\n\t\t\tclearTimeout(this.hideTimeoutId)\n\t\t\tthis.hideTimeoutId = undefined\n\t\t}\n\n\t\tif (!this.open) {\n\t\t\tthis.showTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.show()\n\t\t\t}, this.showDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Schedule hiding the tooltip with the configured delay\n\t */\n\tprivate scheduleHide() {\n\t\tif (this.showTimeoutId) {\n\t\t\tclearTimeout(this.showTimeoutId)\n\t\t\tthis.showTimeoutId = undefined\n\t\t}\n\n\t\tif (this.open) {\n\t\t\tthis.hideTimeoutId = window.setTimeout(() => {\n\t\t\t\tthis.hide()\n\t\t\t}, this.hideDelay)\n\t\t}\n\t}\n\n\t/**\n\t * Show the tooltip\n\t */\n\tpublic show() {\n\t\tif (this.disabled || this.open) return\n\n\t\tthis.open = true\n\n\t\t// Position the tooltip\n\t\tthis.cleanupPositioner = autoUpdate(this.triggerContainer, this.tooltip, () => this.updatePosition())\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-show', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t/**\n\t * Hide the tooltip\n\t */\n\tpublic hide() {\n\t\tif (!this.open) return\n\n\t\tthis.open = false\n\n\t\t// Cleanup the positioner\n\t\tif (this.cleanupPositioner) {\n\t\t\tthis.cleanupPositioner()\n\t\t\tthis.cleanupPositioner = undefined\n\t\t}\n\n\t\t// Dispatch custom event\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('schmancy-tooltip-hide', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\trender() {\n\t\tconst tooltipClasses = {\n\t\t\t'absolute z-50 bg-surface-highest text-surface-on rounded-md shadow-md': true,\n\t\t\t'max-w-xs opacity-0 invisible scale-95 transition-all duration-150': true,\n\t\t\t'opacity-100 visible scale-100': this.open,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div id=\"trigger-container\" class=\"inline-block\" aria-describedby=\"tooltip\">\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\n\t\t\t<div id=\"tooltip\" part=\"tooltip\" role=\"tooltip\" class=\"${this.classMap(tooltipClasses)}\">\n\t\t\t\t<slot name=\"content\"></slot>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tooltip': SchmancyTooltip\n\t}\n}\n"],"names":["SchmancyTooltip","TailwindElement","super","arguments","this","placement","distance","showDelay","hideDelay","open","disabled","connectedCallback","setAttribute","disconnectedCallback","cleanupPositioner","showTimeoutId","clearTimeout","hideTimeoutId","updatePosition","triggerContainer","tooltip","x","y","middlewareData","computePosition","middleware","offset","flip","shift","padding","Object","assign","style","left","top","arrow","staticSide","right","bottom","split","firstUpdated","merge","fromEvent","pipe","takeUntil","disconnecting","subscribe","scheduleShow","scheduleHide","window","event","key","hide","setTimeout","show","autoUpdate","dispatchEvent","CustomEvent","bubbles","composed","render","tooltipClasses","html","classMap","__decorateClass","property","type","String","prototype","Number","Boolean","reflect","query","queryAssignedElements","flatten","customElement"],"mappings":"kbAuBaA,QAAAA,gBAAN,cAA8BC,EAAAA,gBAA9B,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAM2CC,KAAAC,UAAA,MAOtCD,KAAAE,SAAA,EAOCF,KAAAG,UAAA,IAOAH,KAAAI,UAAA,IAOLJ,KAAAK,KAAAA,GAOIL,KAAAM,SAAAA,EAAA,CAaX,mBAAAC,CACCT,MAAMS,kBACDP,EAAAA,KAAAQ,aAAa,YAAa,QAAA,CAAQ,CAGxC,sBAAAC,OACCX,MAAMW,qBAAAA,GACNT,EAAAA,KAAKU,oBAALV,MAAAA,EAAAA,WACIA,KAAKW,eAA4BC,aAAAZ,KAAKW,aACtCX,EAAAA,KAAKa,eAA4BD,aAAAZ,KAAKa,aAAa,CAAA,CAGxD,MAAcC,gBAAAA,SACb,IAAKd,KAAKe,kBAAAA,CAAqBf,KAAKgB,QAAS,OAEvC,MAAAC,EAAEA,EAAGC,EAAAA,EAAAjB,UAAGA,EAAWkB,eAAAA,CAAyBC,EAAAA,MAAAA,EAAAA,gBAAgBpB,KAAKe,iBAAkBf,KAAKgB,QAAS,CACtGf,UAAWD,KAAKC,UAChBoB,WAAY,CAACC,EAAAA,OAAOtB,KAAKE,UAAWqB,SAAQC,QAAM,CAAEC,QAAS,CAAA,CAAA,CAAA,CAAA,CAAA,EAU9D,GANOC,OAAAC,OAAO3B,KAAKgB,QAAQY,MAAO,CACjCC,KAAM,GAAGZ,MACTa,IAAK,GAAGZ,CAILlB,IAAAA,CAAAA,EAAAA,KAAK+B,MAAO,CACf,MAAMC,EAAa,CAClBF,IAA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wBA2BZoE,UAAA,YAAA,CAAA,EAOAJ,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAMI,QAASC,QAAAA,EAjCfvE,CAAAA,CAAAA,EAAAA,wBAkCZoE,UAAA,OAAA,CAAA,EAOAJ,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAMI,QAASC,QAAAA,EAxCfvE,CAAAA,CAAAA,EAAAA,wBAyCZoE,UAAA,WAAA,CAAA,EAEmBJ,EAAA,CAAlBQ,EAAAA,MAAM,UA3CKxE,CAAAA,EAAAA,wBA2COoE,UAAA,UAAA,CAAA,EACUJ,EAAA,CAA5BQ,EAAAA,MAAM,oBA5CKxE,CAAAA,EAAAA,wBA4CiBoE,UAAA,mBAAA,CAAA,EACZJ,EAAA,CAAhBQ,EAAAA,MAAM,QA7CKxE,CAAAA,EAAAA,wBA6CKoE,UAAA,QAAA,CAAA,EAGjBJ,EAAA,CADCS,wBAAsB,CAAEC,QAAAA,EA/Cb1E,CAAAA,CAAAA,EAAAA,wBAgDZoE,UAAA,kBAAA,CAAA,EAhDYpE,QAANA,gBAAAgE,EAAA,CADNW,EAAAA,cAAc,qBACF3E"}
|
package/dist/tooltip.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tooltip-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tooltip-Bs1R5e8R.cjs");Object.defineProperty(exports,"SchmancyTooltip",{enumerable:!0,get:()=>e.SchmancyTooltip});
|
|
2
2
|
//# sourceMappingURL=tooltip.cjs.map
|
package/dist/tooltip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const d=require("./tailwind.mixin-
|
|
1
|
+
"use strict";const t=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const d=require("./tailwind.mixin-B9QsShMd.cjs"),p=require("lit"),c=require("lit/decorators.js");var u=Object.defineProperty,g=Object.getOwnPropertyDescriptor,l=(n,r,o,i)=>{for(var s,e=i>1?void 0:i?g(r,o):r,a=n.length-1;a>=0;a--)(s=n[a])&&(e=(i?s(r,o,e):s(e))||e);return i&&e&&u(r,o,e),e};exports.SchmancyTree=class extends d.TailwindElement(p.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
<!-- The default slot: tree children -->
|
|
25
25
|
<slot></slot>
|
|
26
26
|
`}},l([c.property({type:Boolean})],exports.SchmancyTree.prototype,"open",2),l([c.query("#toggler")],exports.SchmancyTree.prototype,"toggler",2),l([c.query('slot:not([name="root"])')],exports.SchmancyTree.prototype,"defaultSlot",2),l([c.query("#chevron")],exports.SchmancyTree.prototype,"chevron",2),exports.SchmancyTree=l([c.customElement("schmancy-tree")],exports.SchmancyTree);
|
|
27
|
-
//# sourceMappingURL=tree-
|
|
27
|
+
//# sourceMappingURL=tree-C68UrNiC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-
|
|
1
|
+
{"version":3,"file":"tree-C68UrNiC.cjs","sources":["../src/tree/tree.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { fromEvent, merge, switchMap, takeUntil, tap, zip } from 'rxjs'\n\n/**\n * @element schmancy-tree\n * @slot root - The root element of the tree\n * @slot - The children of the tree\n */\n@customElement('schmancy-tree')\nexport class SchmancyTree extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\tbackground-color: initial;\n\t}\n\t::slotted([slot='root']) {\n\t\twidth: 100%;\n\t\ttext-align: left;\n\t}\n\t::slotted([slot='root'] + *) {\n\t\tmargin-top: 0.5rem;\n\t}\n`) {\n\t/**\n\t * Whether the tree’s children are visible\n\t */\n\t@property({ type: Boolean }) open = false\n\n\t@query('#toggler') toggler!: HTMLSlotElement\n\t@query('slot:not([name=\"root\"])') defaultSlot!: HTMLSlotElement\n\n\t// Since it's actually a <schmancy-button>, use HTMLElement or a custom type\n\t@query('#chevron') chevron!: HTMLElement\n\n\tfirstUpdated() {\n\t\t// Hide or show the slot initially based on `open`\n\t\tif (!this.open) {\n\t\t\tthis.defaultSlot.hidden = true\n\t\t}\n\n\t\t// Root toggler\n\t\tconst toggleClick$ = fromEvent<MouseEvent>(this.toggler, 'click').pipe(\n\t\t\ttakeUntil(this.disconnecting),\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.dispatchEvent(new CustomEvent('toggle', { bubbles: true, composed: true }))\n\t\t\t}),\n\t\t)\n\n\t\t// Chevron (the schmancy-button) click\n\t\tconst chevronClick$ = fromEvent<MouseEvent>(this.chevron, 'click')\n\n\t\tmerge(toggleClick$, chevronClick$)\n\t\t\t.pipe(\n\t\t\t\tswitchMap(() => {\n\t\t\t\t\t// 1. Animate the chevron rotation\n\t\t\t\t\t// If `open` is true, rotate from 180 -> 0; if false, from 0 -> 180\n\t\t\t\t\tconst fromDeg = this.open ? 180 : 0\n\t\t\t\t\tconst toDeg = this.open ? 0 : 180\n\t\t\t\t\tconst chevronAnimation = this.chevron.animate(\n\t\t\t\t\t\t[{ transform: `rotate(${fromDeg}deg)` }, { transform: `rotate(${toDeg}deg)` }],\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tduration: 150,\n\t\t\t\t\t\t\teasing: 'ease-in',\n\t\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\n\t\t\t\t\t// 2. Animate the slot’s height + opacity\n\t\t\t\t\tif (!this.open) {\n\t\t\t\t\t\t// We are about to open, so remove `hidden` to measure scrollHeight\n\t\t\t\t\t\tthis.defaultSlot.hidden = false\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fromOpacity = this.open ? 1 : 0\n\t\t\t\t\tconst toOpacity = this.open ? 0 : 1\n\n\t\t\t\t\tconst slotAnimation = this.defaultSlot.animate([{ opacity: fromOpacity }, { opacity: toOpacity }], {\n\t\t\t\t\t\tduration: 150,\n\t\t\t\t\t\teasing: 'ease-out',\n\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t})\n\n\t\t\t\t\t// Hide the slot if we just closed it\n\t\t\t\t\tslotAnimation.onfinish = () => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.defaultSlot.hidden = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.defaultSlot.style.height = 'auto'\n\t\t\t\t\t\t\tthis.defaultSlot.style.opacity = '1'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Return an Observable that completes when both animations finish\n\t\t\t\t\treturn zip(fromEvent(chevronAnimation, 'finish'), fromEvent(slotAnimation, 'finish')).pipe(\n\t\t\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t\ttap(() => {\n\t\t\t\t\t// Flip the open state\n\t\t\t\t\tthis.open = !this.open\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"flex content-center items-center justify-between\">\n\t\t\t\t<!-- Root toggler content -->\n\t\t\t\t<slot id=\"toggler\" name=\"root\"></slot>\n\n\t\t\t\t<!-- The chevron or arrow symbol -->\n\t\t\t\t<!-- Stop propagation on the schmancy-button itself just to avoid double triggers -->\n\t\t\t\t<schmancy-button slot=\"trailing\" id=\"chevron\" @click=${(e: Event) => e.stopPropagation()}> ⌅ </schmancy-button>\n\t\t\t</div>\n\n\t\t\t<!-- The default slot: tree children -->\n\t\t\t<slot></slot>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tree': SchmancyTree\n\t}\n}\n"],"names":["SchmancyTree","TailwindElement","css","super","arguments","this","open","firstUpdated","defaultSlot","hidden","toggleClick$","fromEvent","toggler","pipe","takeUntil","disconnecting","tap","e","preventDefault","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","chevronClick$","chevron","merge","switchMap","fromDeg","toDeg","chevronAnimation","animate","transform","duration","easing","fill","fromOpacity","toOpacity","slotAnimation","opacity","onfinish","style","height","zip","subscribe","html","__decorateClass","property","type","Boolean","prototype","query","customElement"],"mappings":"oZAWaA,QAAAA,aAAN,cAA2BC,EAAAA,gBAAgBC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,CAAA,CAAA,cAAAC,MAAAC,GAAAA,SAAAA,EAiB8BC,KAAAC,KAAA,EAAA,CAQpC,cAAAC,CAEMF,KAAKC,OACTD,KAAKG,YAAYC,OAAS,IAI3B,MAAMC,EAAeC,EAAAA,UAAsBN,KAAKO,QAAS,OAASC,EAAAA,KACjEC,EAAAA,UAAUT,KAAKU,eACfC,MAASC,IACRA,EAAEC,eAAAA,EACFD,EAAEE,gBACGd,EAAAA,KAAAe,cAAc,IAAIC,YAAY,SAAU,CAAEC,QAAAA,GAAeC,SAAU,EAAA,CAAA,CAAA,CAAO,CAK3EC,CAAAA,EAAAA,EAAgBb,EAAAA,UAAsBN,KAAKoB,QAAS,OAEpDC,EAAAA,QAAAhB,EAAcc,CAAAA,EAClBX,KACAc,EAAAA,UAAU,KAGH,MAAAC,EAAUvB,KAAKC,KAAO,IAAM,EAC5BuB,EAAQxB,KAAKC,KAAO,EAAI,IACxBwB,EAAmBzB,KAAKoB,QAAQM,QACrC,CAAC,CAAEC,UAAW,UAAUJ,SAAiB,CAAEI,UAAW,UAAUH,CAChE,MAAA,CAAA,EAAA,CACCI,SAAU,IACVC,OAAQ,UACRC,KAAM,UAAA,CAAA,EAKH9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,QAANA,aAAA8C,EAAA,CADNM,EAAAA,cAAc,eAAA,CAAA,EACFpD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fromEvent as p, takeUntil as c, tap as g, merge as m, switchMap as f, zip as u } from "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as y } from "./tailwind.mixin-
|
|
4
|
+
import { T as y } from "./tailwind.mixin-DxW0KQ-d.js";
|
|
5
5
|
import { css as v, html as b } from "lit";
|
|
6
6
|
import { property as S, query as h, customElement as w } from "lit/decorators.js";
|
|
7
7
|
var k = Object.defineProperty, j = Object.getOwnPropertyDescriptor, l = (e, s, o, i) => {
|
|
@@ -61,4 +61,4 @@ l([S({ type: Boolean })], n.prototype, "open", 2), l([h("#toggler")], n.prototyp
|
|
|
61
61
|
export {
|
|
62
62
|
n as S
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=tree-
|
|
64
|
+
//# sourceMappingURL=tree-DSeadYt9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-
|
|
1
|
+
{"version":3,"file":"tree-DSeadYt9.js","sources":["../src/tree/tree.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { fromEvent, merge, switchMap, takeUntil, tap, zip } from 'rxjs'\n\n/**\n * @element schmancy-tree\n * @slot root - The root element of the tree\n * @slot - The children of the tree\n */\n@customElement('schmancy-tree')\nexport class SchmancyTree extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\tbackground-color: initial;\n\t}\n\t::slotted([slot='root']) {\n\t\twidth: 100%;\n\t\ttext-align: left;\n\t}\n\t::slotted([slot='root'] + *) {\n\t\tmargin-top: 0.5rem;\n\t}\n`) {\n\t/**\n\t * Whether the tree’s children are visible\n\t */\n\t@property({ type: Boolean }) open = false\n\n\t@query('#toggler') toggler!: HTMLSlotElement\n\t@query('slot:not([name=\"root\"])') defaultSlot!: HTMLSlotElement\n\n\t// Since it's actually a <schmancy-button>, use HTMLElement or a custom type\n\t@query('#chevron') chevron!: HTMLElement\n\n\tfirstUpdated() {\n\t\t// Hide or show the slot initially based on `open`\n\t\tif (!this.open) {\n\t\t\tthis.defaultSlot.hidden = true\n\t\t}\n\n\t\t// Root toggler\n\t\tconst toggleClick$ = fromEvent<MouseEvent>(this.toggler, 'click').pipe(\n\t\t\ttakeUntil(this.disconnecting),\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.dispatchEvent(new CustomEvent('toggle', { bubbles: true, composed: true }))\n\t\t\t}),\n\t\t)\n\n\t\t// Chevron (the schmancy-button) click\n\t\tconst chevronClick$ = fromEvent<MouseEvent>(this.chevron, 'click')\n\n\t\tmerge(toggleClick$, chevronClick$)\n\t\t\t.pipe(\n\t\t\t\tswitchMap(() => {\n\t\t\t\t\t// 1. Animate the chevron rotation\n\t\t\t\t\t// If `open` is true, rotate from 180 -> 0; if false, from 0 -> 180\n\t\t\t\t\tconst fromDeg = this.open ? 180 : 0\n\t\t\t\t\tconst toDeg = this.open ? 0 : 180\n\t\t\t\t\tconst chevronAnimation = this.chevron.animate(\n\t\t\t\t\t\t[{ transform: `rotate(${fromDeg}deg)` }, { transform: `rotate(${toDeg}deg)` }],\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tduration: 150,\n\t\t\t\t\t\t\teasing: 'ease-in',\n\t\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t\t},\n\t\t\t\t\t)\n\n\t\t\t\t\t// 2. Animate the slot’s height + opacity\n\t\t\t\t\tif (!this.open) {\n\t\t\t\t\t\t// We are about to open, so remove `hidden` to measure scrollHeight\n\t\t\t\t\t\tthis.defaultSlot.hidden = false\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fromOpacity = this.open ? 1 : 0\n\t\t\t\t\tconst toOpacity = this.open ? 0 : 1\n\n\t\t\t\t\tconst slotAnimation = this.defaultSlot.animate([{ opacity: fromOpacity }, { opacity: toOpacity }], {\n\t\t\t\t\t\tduration: 150,\n\t\t\t\t\t\teasing: 'ease-out',\n\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t})\n\n\t\t\t\t\t// Hide the slot if we just closed it\n\t\t\t\t\tslotAnimation.onfinish = () => {\n\t\t\t\t\t\tif (this.open) {\n\t\t\t\t\t\t\tthis.defaultSlot.hidden = true\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.defaultSlot.style.height = 'auto'\n\t\t\t\t\t\t\tthis.defaultSlot.style.opacity = '1'\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Return an Observable that completes when both animations finish\n\t\t\t\t\treturn zip(fromEvent(chevronAnimation, 'finish'), fromEvent(slotAnimation, 'finish')).pipe(\n\t\t\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t\ttap(() => {\n\t\t\t\t\t// Flip the open state\n\t\t\t\t\tthis.open = !this.open\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"flex content-center items-center justify-between\">\n\t\t\t\t<!-- Root toggler content -->\n\t\t\t\t<slot id=\"toggler\" name=\"root\"></slot>\n\n\t\t\t\t<!-- The chevron or arrow symbol -->\n\t\t\t\t<!-- Stop propagation on the schmancy-button itself just to avoid double triggers -->\n\t\t\t\t<schmancy-button slot=\"trailing\" id=\"chevron\" @click=${(e: Event) => e.stopPropagation()}> ⌅ </schmancy-button>\n\t\t\t</div>\n\n\t\t\t<!-- The default slot: tree children -->\n\t\t\t<slot></slot>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-tree': SchmancyTree\n\t}\n}\n"],"names":["SchmancyTree","TailwindElement","css","super","arguments","this","open","defaultSlot","hidden","toggleClick$","fromEvent","toggler","pipe","takeUntil","disconnecting","tap","e","preventDefault","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","chevronClick$","chevron","merge","switchMap","fromDeg","toDeg","chevronAnimation","animate","transform","duration","easing","fill","fromOpacity","toOpacity","slotAnimation","opacity","onfinish","style","height","zip","subscribe","render","html","__decorateClass","property","type","Boolean","prototype","query","customElement"],"mappings":";;;;;;;;;;AAWa,IAAAA,IAAN,cAA2BC,EAAgBC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA3C,EAAA;AAAA,EAAA;AAAAC,UAAAC,GAAAA,SAAAA,GAiB8BC,KAAAC,OAAAA;AAAAA,EAAA;AAAA,EAQpC,eAEMD;AAAAA,SAAKC,SACTD,KAAKE,YAAYC;AAIlB,UAAMC,IAAeC,EAAsBL,KAAKM,SAAS,OAAA,EAASC,KACjEC,EAAUR,KAAKS,aACfC,GAAAA,EAASC,CAAAA;AACRA,MAAAA,EAAEC,eAAAA,GACFD,EAAEE,gBAAAA,GACGb,KAAAc,cAAc,IAAIC,YAAY,UAAU,EAAEC,aAAeC,UAAAA,GAAiB,CAAA,CAAA;AAAA,IAAA,CAAA,CAAA,GAK3EC,IAAgBb,EAAsBL,KAAKmB,SAAS,OAAA;AAEpDC,IAAAA,EAAAhB,GAAcc,CAAAA,EAClBX,KACAc,EAAU;AAGH,YAAAC,IAAUtB,KAAKC,OAAO,MAAM,GAC5BsB,IAAQvB,KAAKC,OAAO,IAAI,KACxBuB,IAAmBxB,KAAKmB,QAAQM,QACrC,CAAC,EAAEC,WAAW,UAAUJ,CAAiB,OAAA,GAAA,EAAEI,WAAW,UAAUH,CAAAA,OAAAA,CAAAA,GAChE,EACCI,UAAU,KACVC,QAAQ,WACRC,MAAM,WAKH7B,CAAAA;AAAAA,WAAKC,SAETD,KAAKE,Y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cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tree-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./tree-C68UrNiC.cjs");Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>e.SchmancyTree});
|
|
2
2
|
//# sourceMappingURL=tree.cjs.map
|
package/dist/tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var qe=Object.defineProperty;var se=s=>{throw TypeError(s)};var Ne=(s,e,t)=>e in s?qe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var m=(s,e,t)=>Ne(s,typeof e!="symbol"?e+"":e,t),ie=(s,e,t)=>e.has(s)||se("Cannot "+t);var d=(s,e,t)=>(ie(s,e,"read from private field"),t?t.call(s):e.get(s)),j=(s,e,t)=>e.has(s)?se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t);var a=(s,e,t)=>(ie(s,e,"access private method"),t);const Le=require("./consume-uKrSupzs.cjs");require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const xe=require("./litElement.mixin-DqMWf6Rp.cjs");require("./tailwind.mixin-C-SZB7Or.cjs");const re=require("./delay-dM9FOKCv.cjs"),De=require("./intersection-CVvaDv96.cjs"),ne=require("lit"),f=require("lit/decorators.js"),ye=s=>Array.isArray(s),oe=s=>ye(s)?s:[s],me="data-typeit-id",E="ti-cursor",Me={started:!1,completed:!1,frozen:!1,destroyed:!1},C={breakLines:!0,cursor:{autoPause:!0,autoPauseDelay:500,animation:{frames:[0,0,1].map(s=>({opacity:s})),options:{iterations:1/0,easing:"steps(2, start)",fill:"forwards"}}},cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}},ke=`[${me}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`,$=s=>document.createElement(s),G=s=>document.createTextNode(s),ae=(s,e="")=>{let t=$("style");t.id=e,t.appendChild(G(s)),document.head.appendChild(t)},le=s=>(ye(s)||(s=[s/2,s/2]),s),ue=(s,e)=>Math.abs(Math.random()*(s+e-(s-e))+(s-e));let he=s=>s/2;const fe=s=>Array.from(s);let Y=s=>([...s.childNodes].forEach(e=>{if(e.nodeValue)return[...e.nodeValue].forEach(t=>{e.parentNode.insertBefore(G(t),e)}),void e.remove();Y(e)}),s);const ge=s=>{let e=document.implementation.createHTMLDocument();return e.body.innerHTML=s,Y(e.body)};function be(s,e=!1,t=!1){let r,n=s.querySelector(`.${E}`),o=document.createTreeWalker(s,NodeFilter.SHOW_ALL,{acceptNode:u=>{var h,p;if(n&&t){if((h=u.classList)!=null&&h.contains(E))return NodeFilter.FILTER_ACCEPT;if(n.contains(u))return NodeFilter.FILTER_REJECT}return(p=u.classList)!=null&&p.contains(E)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),l=[];for(;r=o.nextNode();)r.originalParent||(r.originalParent=r.parentNode),l.push(r);return e?l.reverse():l}function Ae(s,e=!0){return e?be(ge(s)):fe(s).map(G)}const _e=({index:s,newIndex:e,queueItems:t,cleanUp:r})=>{for(let n=s+1;n<e+1;n++)r(t[n][0])},we=s=>Number.isInteger(s),ce=({queueItems:s,selector:e,cursorPosition:t,to:r})=>{if(we(e))return-1*e;let n=new RegExp("END","i").test(r),o=e?[...s].reverse().findIndex(({char:l})=>{let u=l.parentElement,h=u.matches(e);return!(!n||!h)||h&&u.firstChild.isSameNode(l)}):-1;return o<0&&(o=n?0:s.length-1),o-t+(n?0:1)},A=(s,e)=>new Array(e).fill(s);let F=s=>new Promise(e=>{requestAnimationFrame(async()=>{e(await s())})}),pe=s=>s==null?void 0:s.getAnimations().find(e=>e.id===s.dataset.tiAnimationId),Te=({cursor:s,frames:e,options:t})=>{let r=s.animate(e,t);return r.pause(),r.id=s.dataset.tiAnimationId,F(()=>{F(()=>{r.play()})}),r},de=s=>{var e;return(e=s.func)==null?void 0:e.call(null)},$e=async({index:s,queueItems:e,wait:t,cursor:r,cursorOptions:n})=>{let o=e[s][1],l=[],u=s,h=o,p=()=>h&&!h.delay,c=o.shouldPauseCursor()&&n.autoPause;for(;p();)l.push(h),p()&&u++,h=e[u]?e[u][1]:null;if(l.length)return await F(async()=>{for(let P of l)await de(P)}),u-1;let y,b=pe(r);return b&&(y={...b.effect.getComputedTiming(),delay:c?n.autoPauseDelay:0}),await t(async()=>{b&&c&&b.cancel(),await F(()=>{de(o)})},o.delay),await(({cursor:P,options:Z,cursorOptions:ee})=>{if(!P||!ee)return;let B,k=pe(P);k&&(Z.delay=k.effect.getComputedTiming().delay,B=k.currentTime,k.cancel());let te=Te({cursor:P,frames:ee.animation.frames,options:Z});return B&&(te.currentTime=B),te})({cursor:r,options:y,cursorOptions:n}),s};const _=s=>"value"in s;let v=s=>typeof s=="function"?s():s,K=(s,e=document,t=!1)=>e["querySelector"+(t?"All":"")](s);const S=(s,e)=>Object.assign({},s,e);let Oe={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"",transform:"translateX(-.125em)"};var i,Ie,q,Q,Ee,U,V,X,O,w,Ce,N,L,ve,R,Pe,Se,J,H,x,z,I,D,M,W,T;class He{constructor(e,t={}){j(this,i);m(this,"element");m(this,"timeouts");m(this,"cursorPosition");m(this,"predictedCursorPosition");m(this,"statuses",{started:!1,completed:!1,frozen:!1,destroyed:!1,firing:!1});m(this,"opts");m(this,"id");m(this,"queue");m(this,"cursor");m(this,"flushCallback",null);m(this,"unfreeze",()=>{});m(this,"is",function(e){return this.statuses[e]});j(this,R,e=>{this.opts.cursor=(t=>{var r,n;if(typeof t=="object"){let o={},{frames:l,options:u}=C.cursor.animation;return o.animation=t.animation||{},o.animation.frames=((r=t.animation)==null?void 0:r.frames)||l,o.animation.options=S(u,((n=t.animation)==null?void 0:n.options)||{}),o.autoPause=t.autoPause??C.cursor.autoPause,o.autoPauseDelay=t.autoPauseDelay||C.cursor.autoPauseDelay,o}return t===!0?C.cursor:t})(e.cursor??C.cursor),this.opts.strings=a(this,i,Pe).call(this,oe(this.opts.strings)),this.opts=S(this.opts,{html:!d(this,i,M)&&this.opts.html,nextStringDelay:le(this.opts.nextStringDelay),loopDelay:le(this.opts.loopDelay)})});var r;this.opts=S(C,t),this.element=typeof(r=e)=="string"?K(r):r,this.timeouts=[],this.cursorPosition=0,this.unfreeze=()=>{},this.predictedCursorPosition=null,this.statuses=S({},Me),this.id=Math.random().toString().substring(2,9),this.queue=function(n){let o=function(c){return oe(c).forEach(y=>{var b;return p.set(Symbol((b=y.char)==null?void 0:b.innerText),l({...y}))}),this},l=c=>(c.shouldPauseCursor=function(){return!!(this.typeable||this.cursorable||this.deletable)},c),u=()=>p,h=()=>Array.from(p.values()),p=new Map;return o(n),{add:o,set:function(c,y){let b=[...p.keys()];p.set(b[c],l(y))},wipe:function(){p=new Map,o(n)},done:(c,y=!1)=>y?p.delete(c):p.get(c).done=!0,reset:function(){p.forEach(c=>delete c.done)},destroy:c=>p.delete(c),getItems:(c=!1)=>c?h():h().filter(y=>!y.done),getQueue:u,getTypeable:()=>h().filter(c=>c.typeable),getPendingQueueItems:()=>{const c=[];for(let[,y]of u())y.done||c.push(y);return c}}}([{delay:this.opts.startDelay}]),d(this,R).call(this,t),this.cursor=a(this,i,Se).call(this),this.element.dataset.typeitId=this.id,ae(ke),this.opts.strings.length&&a(this,i,ve).call(this)}go(){return this.statuses.started?this:(a(this,i,X).call(this),this.opts.waitUntilVisible?(e=this.element,t=a(this,i,q).bind(this),new IntersectionObserver((r,n)=>{r.forEach(o=>{o.isIntersecting&&(t(),n.unobserve(e))})},{threshold:1}).observe(e),this):(a(this,i,q).call(this),this));var e,t}destroy(e=!0){this.timeouts=(this.timeouts.forEach(clearTimeout),[]),v(e)&&this.cursor&&a(this,i,z).call(this,this.cursor),this.statuses.destroyed=!0}reset(e){!this.is("destroyed")&&this.destroy(),e?(this.queue.wipe(),e(this)):this.queue.reset(),this.cursorPosition=0;for(let t in this.statuses)this.statuses[t]=!1;return this.element[a(this,i,O).call(this)?"value":"innerHTML"]="",this}type(e,t={}){e=v(e);let{instant:r}=t,n=a(this,i,N).call(this,t),o=Ae(e,this.opts.html).map(u=>{return{func:()=>a(this,i,H).call(this,u),char:u,delay:r||(h=u,/<(.+)>(.*?)<\/(.+)>/.test(h.outerHTML))?0:a(this,i,I).call(this),typeable:u.nodeType===Node.TEXT_NODE};var h}),l=[n[0],{func:async()=>await this.opts.beforeString(e,this)},...o,{func:async()=>await this.opts.afterString(e,this)},n[1]];return a(this,i,w).call(this,l,t)}break(e={}){return a(this,i,w).call(this,{func:()=>a(this,i,H).call(this,$("BR")),typeable:!0},e)}move(e,t={}){e=v(e);let r=a(this,i,N).call(this,t),{instant:n,to:o}=t,l=ce({queueItems:this.queue.getTypeable(),selector:e===null?"":e,to:o,cursorPosition:d(this,i,D)}),u=l<0?-1:1;return this.predictedCursorPosition=d(this,i,D)+l,a(this,i,w).call(this,[r[0],...A({func:()=>a(this,i,Q).call(this,u),delay:n?0:a(this,i,I).call(this),cursorable:!0},Math.abs(l)),r[1]],t)}exec(e,t={}){let r=a(this,i,N).call(this,t);return a(this,i,w).call(this,[r[0],{func:()=>e(this)},r[1]],t)}options(e,t={}){return e=v(e),a(this,i,L).call(this,e),a(this,i,w).call(this,{},t)}pause(e,t={}){return a(this,i,w).call(this,{delay:v(e)},t)}delete(e=null,t={}){e=v(e);let r=a(this,i,N).call(this,t),n=e,{instant:o,to:l}=t,u=this.queue.getTypeable(),h=n===null?u.length:we(n)?n:ce({queueItems:u,selector:n,cursorPosition:d(this,i,D),to:l});return a(this,i,w).call(this,[r[0],...A({func:a(this,i,x).bind(this),delay:o?0:a(this,i,I).call(this,1),deletable:!0},h),r[1]],t)}freeze(){this.statuses.frozen=!0}flush(e=null){return this.flushCallback=e||this.flushCallback,this.statuses.firing||(a(this,i,X).call(this),a(this,i,q).call(this,!1).then(()=>{if(this.queue.getPendingQueueItems().length>0)return this.flush();this.flushCallback(),this.flushCallback=null})),this}getQueue(){return this.queue}getOptions(){return this.opts}updateOptions(e){return a(this,i,L).call(this,e)}getElement(){return this.element}empty(e={}){return a(this,i,w).call(this,{func:a(this,i,Ie).bind(this)},e)}}i=new WeakSet,Ie=async function(){a(this,i,O).call(this)?this.element.value="":d(this,i,T).forEach(a(this,i,z).bind(this))},q=async function(e=!0){this.statuses.started=!0,this.statuses.firing=!0;let t=r=>{this.queue.done(r,!e)};try{let r=[...this.queue.getQueue()];for(let o=0;o<r.length;o++){let[l,u]=r[o];if(!u.done){if(!u.deletable||u.deletable&&d(this,i,T).length){let h=await a(this,i,U).call(this,o,r);_e({index:o,newIndex:h,queueItems:r,cleanUp:t}),o=h}t(l)}}if(!e)return this.statuses.firing=!1,this;if(this.statuses.completed=!0,this.statuses.firing=!1,await this.opts.afterComplete(this),!this.opts.loop)throw"";let n=this.opts.loopDelay;a(this,i,V).call(this,async()=>{await a(this,i,Ee).call(this,n[0]),a(this,i,q).call(this)},n[1])}catch{}return this.statuses.firing=!1,this},Q=async function(e){var t,r,n;this.cursorPosition=(t=e,r=this.cursorPosition,n=d(this,i,T),Math.min(Math.max(r+t,0),n.length)),((o,l,u)=>{let h=l[u-1],p=K(`.${E}`,o);(o=(h==null?void 0:h.parentNode)||o).insertBefore(p,h||null)})(this.element,d(this,i,T),this.cursorPosition)},Ee=async function(e){let t=d(this,i,D);t&&await a(this,i,Q).call(this,{value:t});let r=d(this,i,T).map(n=>[Symbol(),{func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1),deletable:!0,shouldPauseCursor:()=>!0}]);for(let n=0;n<r.length;n++)await a(this,i,U).call(this,n,r);this.queue.reset(),this.queue.set(0,{delay:e})},U=function(e,t){return $e({index:e,queueItems:t,wait:a(this,i,V).bind(this),cursor:this.cursor,cursorOptions:this.opts.cursor})},V=async function(e,t,r=!1){this.statuses.frozen&&await new Promise(n=>{this.unfreeze=()=>{this.statuses.frozen=!1,n()}}),r||await this.opts.beforeStep(this),await((n,o,l)=>new Promise(u=>{l.push(setTimeout(async()=>{await n(),u()},o||0))}))(e,t,this.timeouts),r||await this.opts.afterStep(this)},X=async function(){if(!a(this,i,O).call(this)&&this.cursor&&this.element.appendChild(this.cursor),d(this,i,W)){((n,o)=>{let l=`[${me}='${n}'] .${E}`,u=getComputedStyle(o),h=Object.entries(Oe).reduce((p,[c,y])=>`${p} ${c}: var(--ti-cursor-${c}, ${y||u[c]});`,"");ae(`${l} { display: inline-block; width: 0; ${h} }`,n)})(this.id,this.element),this.cursor.dataset.tiAnimationId=this.id;let{animation:e}=this.opts.cursor,{frames:t,options:r}=e;Te({frames:t,cursor:this.cursor,options:{duration:this.opts.cursorSpeed,...r}})}},O=function(){return _(this.element)},w=function(e,t){return this.queue.add(e),a(this,i,Ce).call(this,t),this},Ce=function(e={}){let t=e.delay;t&&this.queue.add({delay:t})},N=function(e={}){return[{func:()=>a(this,i,L).call(this,e)},{func:()=>a(this,i,L).call(this,this.opts)}]},L=async function(e){this.opts=S(this.opts,e)},ve=function(){let e=this.opts.strings.filter(t=>!!t);e.forEach((t,r)=>{if(this.type(t),r+1===e.length)return;let n=this.opts.breakLines?[{func:()=>a(this,i,H).call(this,$("BR")),typeable:!0}]:A({func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1)},this.queue.getTypeable().length);a(this,i,J).call(this,n)})},R=new WeakMap,Pe=function(e){let t=this.element.innerHTML;return t?(this.element.innerHTML="",this.opts.startDelete?(this.element.innerHTML=t,Y(this.element),a(this,i,J).call(this,A({func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1),deletable:!0},d(this,i,T).length)),e):(r=t,r.replace(/<!--(.+?)-->/g,"").trim().split(/<br(?:\s*?)(?:\/)?>/)).concat(e)):e;var r},Se=function(){if(d(this,i,M))return null;let e=$("span");return e.className=E,d(this,i,W)?(e.innerHTML=ge(this.opts.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)},J=function(e){let t=this.opts.nextStringDelay;this.queue.add([{delay:t[0]},...e,{delay:t[1]}])},H=function(e){((t,r)=>{if(_(t))return void(t.value=`${t.value}${r.textContent}`);r.innerHTML="";let n=(o=r.originalParent,/body/i.test(o==null?void 0:o.tagName)?t:r.originalParent||t);var o;let l=K("."+E,n)||null;l&&l.parentElement!==n&&(n=l.parentElement),n.insertBefore(r,l)})(this.element,e)},x=function(){d(this,i,T).length&&(d(this,i,M)?this.element.value=this.element.value.slice(0,-1):a(this,i,z).call(this,d(this,i,T)[this.cursorPosition]))},z=function(e){((t,r)=>{if(!t)return;let n=t.parentNode;(n.childNodes.length>1||n.isSameNode(r)?t:n).remove()})(e,this.element)},I=function(e=0){return function(t){let{speed:r,deleteSpeed:n,lifeLike:o}=t;return n=n!==null?n:r/3,o?[ue(r,he(r)),ue(n,he(n))]:[r,n]}(this.opts)[e]},D=function(){return this.predictedCursorPosition??this.cursorPosition},M=function(){return _(this.element)},W=function(){return!!this.opts.cursor&&!d(this,i,M)},T=function(){return e=this.element,_(e)?fe(e.value):be(e,!0).filter(t=>!(t.childNodes.length>0));var e};var ze=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,g=(s,e,t,r)=>{for(var n,o=r>1?void 0:r?Fe(e,t):e,l=s.length-1;l>=0;l--)(n=s[l])&&(o=(r?n(e,t,o):n(o))||o);return r&&o&&ze(e,t,o),o};exports.TypewriterElement=class extends xe.$LitElement(ne.css`
|
|
1
|
+
"use strict";var qe=Object.defineProperty;var se=s=>{throw TypeError(s)};var Ne=(s,e,t)=>e in s?qe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var m=(s,e,t)=>Ne(s,typeof e!="symbol"?e+"":e,t),ie=(s,e,t)=>e.has(s)||se("Cannot "+t);var d=(s,e,t)=>(ie(s,e,"read from private field"),t?t.call(s):e.get(s)),j=(s,e,t)=>e.has(s)?se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t);var a=(s,e,t)=>(ie(s,e,"access private method"),t);const Le=require("./consume-uKrSupzs.cjs");require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const xe=require("./litElement.mixin-DcVBwo9t.cjs");require("./tailwind.mixin-B9QsShMd.cjs");const re=require("./delay-C0xLB5YE.cjs"),De=require("./intersection-CVvaDv96.cjs"),ne=require("lit"),f=require("lit/decorators.js"),ye=s=>Array.isArray(s),oe=s=>ye(s)?s:[s],me="data-typeit-id",E="ti-cursor",Me={started:!1,completed:!1,frozen:!1,destroyed:!1},C={breakLines:!0,cursor:{autoPause:!0,autoPauseDelay:500,animation:{frames:[0,0,1].map(s=>({opacity:s})),options:{iterations:1/0,easing:"steps(2, start)",fill:"forwards"}}},cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}},ke=`[${me}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`,$=s=>document.createElement(s),G=s=>document.createTextNode(s),ae=(s,e="")=>{let t=$("style");t.id=e,t.appendChild(G(s)),document.head.appendChild(t)},le=s=>(ye(s)||(s=[s/2,s/2]),s),ue=(s,e)=>Math.abs(Math.random()*(s+e-(s-e))+(s-e));let he=s=>s/2;const fe=s=>Array.from(s);let Y=s=>([...s.childNodes].forEach(e=>{if(e.nodeValue)return[...e.nodeValue].forEach(t=>{e.parentNode.insertBefore(G(t),e)}),void e.remove();Y(e)}),s);const ge=s=>{let e=document.implementation.createHTMLDocument();return e.body.innerHTML=s,Y(e.body)};function be(s,e=!1,t=!1){let r,n=s.querySelector(`.${E}`),o=document.createTreeWalker(s,NodeFilter.SHOW_ALL,{acceptNode:u=>{var h,p;if(n&&t){if((h=u.classList)!=null&&h.contains(E))return NodeFilter.FILTER_ACCEPT;if(n.contains(u))return NodeFilter.FILTER_REJECT}return(p=u.classList)!=null&&p.contains(E)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),l=[];for(;r=o.nextNode();)r.originalParent||(r.originalParent=r.parentNode),l.push(r);return e?l.reverse():l}function Ae(s,e=!0){return e?be(ge(s)):fe(s).map(G)}const _e=({index:s,newIndex:e,queueItems:t,cleanUp:r})=>{for(let n=s+1;n<e+1;n++)r(t[n][0])},we=s=>Number.isInteger(s),ce=({queueItems:s,selector:e,cursorPosition:t,to:r})=>{if(we(e))return-1*e;let n=new RegExp("END","i").test(r),o=e?[...s].reverse().findIndex(({char:l})=>{let u=l.parentElement,h=u.matches(e);return!(!n||!h)||h&&u.firstChild.isSameNode(l)}):-1;return o<0&&(o=n?0:s.length-1),o-t+(n?0:1)},A=(s,e)=>new Array(e).fill(s);let F=s=>new Promise(e=>{requestAnimationFrame(async()=>{e(await s())})}),pe=s=>s==null?void 0:s.getAnimations().find(e=>e.id===s.dataset.tiAnimationId),Te=({cursor:s,frames:e,options:t})=>{let r=s.animate(e,t);return r.pause(),r.id=s.dataset.tiAnimationId,F(()=>{F(()=>{r.play()})}),r},de=s=>{var e;return(e=s.func)==null?void 0:e.call(null)},$e=async({index:s,queueItems:e,wait:t,cursor:r,cursorOptions:n})=>{let o=e[s][1],l=[],u=s,h=o,p=()=>h&&!h.delay,c=o.shouldPauseCursor()&&n.autoPause;for(;p();)l.push(h),p()&&u++,h=e[u]?e[u][1]:null;if(l.length)return await F(async()=>{for(let P of l)await de(P)}),u-1;let y,b=pe(r);return b&&(y={...b.effect.getComputedTiming(),delay:c?n.autoPauseDelay:0}),await t(async()=>{b&&c&&b.cancel(),await F(()=>{de(o)})},o.delay),await(({cursor:P,options:Z,cursorOptions:ee})=>{if(!P||!ee)return;let B,k=pe(P);k&&(Z.delay=k.effect.getComputedTiming().delay,B=k.currentTime,k.cancel());let te=Te({cursor:P,frames:ee.animation.frames,options:Z});return B&&(te.currentTime=B),te})({cursor:r,options:y,cursorOptions:n}),s};const _=s=>"value"in s;let v=s=>typeof s=="function"?s():s,K=(s,e=document,t=!1)=>e["querySelector"+(t?"All":"")](s);const S=(s,e)=>Object.assign({},s,e);let Oe={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"",transform:"translateX(-.125em)"};var i,Ie,q,Q,Ee,U,V,X,O,w,Ce,N,L,ve,R,Pe,Se,J,H,x,z,I,D,M,W,T;class He{constructor(e,t={}){j(this,i);m(this,"element");m(this,"timeouts");m(this,"cursorPosition");m(this,"predictedCursorPosition");m(this,"statuses",{started:!1,completed:!1,frozen:!1,destroyed:!1,firing:!1});m(this,"opts");m(this,"id");m(this,"queue");m(this,"cursor");m(this,"flushCallback",null);m(this,"unfreeze",()=>{});m(this,"is",function(e){return this.statuses[e]});j(this,R,e=>{this.opts.cursor=(t=>{var r,n;if(typeof t=="object"){let o={},{frames:l,options:u}=C.cursor.animation;return o.animation=t.animation||{},o.animation.frames=((r=t.animation)==null?void 0:r.frames)||l,o.animation.options=S(u,((n=t.animation)==null?void 0:n.options)||{}),o.autoPause=t.autoPause??C.cursor.autoPause,o.autoPauseDelay=t.autoPauseDelay||C.cursor.autoPauseDelay,o}return t===!0?C.cursor:t})(e.cursor??C.cursor),this.opts.strings=a(this,i,Pe).call(this,oe(this.opts.strings)),this.opts=S(this.opts,{html:!d(this,i,M)&&this.opts.html,nextStringDelay:le(this.opts.nextStringDelay),loopDelay:le(this.opts.loopDelay)})});var r;this.opts=S(C,t),this.element=typeof(r=e)=="string"?K(r):r,this.timeouts=[],this.cursorPosition=0,this.unfreeze=()=>{},this.predictedCursorPosition=null,this.statuses=S({},Me),this.id=Math.random().toString().substring(2,9),this.queue=function(n){let o=function(c){return oe(c).forEach(y=>{var b;return p.set(Symbol((b=y.char)==null?void 0:b.innerText),l({...y}))}),this},l=c=>(c.shouldPauseCursor=function(){return!!(this.typeable||this.cursorable||this.deletable)},c),u=()=>p,h=()=>Array.from(p.values()),p=new Map;return o(n),{add:o,set:function(c,y){let b=[...p.keys()];p.set(b[c],l(y))},wipe:function(){p=new Map,o(n)},done:(c,y=!1)=>y?p.delete(c):p.get(c).done=!0,reset:function(){p.forEach(c=>delete c.done)},destroy:c=>p.delete(c),getItems:(c=!1)=>c?h():h().filter(y=>!y.done),getQueue:u,getTypeable:()=>h().filter(c=>c.typeable),getPendingQueueItems:()=>{const c=[];for(let[,y]of u())y.done||c.push(y);return c}}}([{delay:this.opts.startDelay}]),d(this,R).call(this,t),this.cursor=a(this,i,Se).call(this),this.element.dataset.typeitId=this.id,ae(ke),this.opts.strings.length&&a(this,i,ve).call(this)}go(){return this.statuses.started?this:(a(this,i,X).call(this),this.opts.waitUntilVisible?(e=this.element,t=a(this,i,q).bind(this),new IntersectionObserver((r,n)=>{r.forEach(o=>{o.isIntersecting&&(t(),n.unobserve(e))})},{threshold:1}).observe(e),this):(a(this,i,q).call(this),this));var e,t}destroy(e=!0){this.timeouts=(this.timeouts.forEach(clearTimeout),[]),v(e)&&this.cursor&&a(this,i,z).call(this,this.cursor),this.statuses.destroyed=!0}reset(e){!this.is("destroyed")&&this.destroy(),e?(this.queue.wipe(),e(this)):this.queue.reset(),this.cursorPosition=0;for(let t in this.statuses)this.statuses[t]=!1;return this.element[a(this,i,O).call(this)?"value":"innerHTML"]="",this}type(e,t={}){e=v(e);let{instant:r}=t,n=a(this,i,N).call(this,t),o=Ae(e,this.opts.html).map(u=>{return{func:()=>a(this,i,H).call(this,u),char:u,delay:r||(h=u,/<(.+)>(.*?)<\/(.+)>/.test(h.outerHTML))?0:a(this,i,I).call(this),typeable:u.nodeType===Node.TEXT_NODE};var h}),l=[n[0],{func:async()=>await this.opts.beforeString(e,this)},...o,{func:async()=>await this.opts.afterString(e,this)},n[1]];return a(this,i,w).call(this,l,t)}break(e={}){return a(this,i,w).call(this,{func:()=>a(this,i,H).call(this,$("BR")),typeable:!0},e)}move(e,t={}){e=v(e);let r=a(this,i,N).call(this,t),{instant:n,to:o}=t,l=ce({queueItems:this.queue.getTypeable(),selector:e===null?"":e,to:o,cursorPosition:d(this,i,D)}),u=l<0?-1:1;return this.predictedCursorPosition=d(this,i,D)+l,a(this,i,w).call(this,[r[0],...A({func:()=>a(this,i,Q).call(this,u),delay:n?0:a(this,i,I).call(this),cursorable:!0},Math.abs(l)),r[1]],t)}exec(e,t={}){let r=a(this,i,N).call(this,t);return a(this,i,w).call(this,[r[0],{func:()=>e(this)},r[1]],t)}options(e,t={}){return e=v(e),a(this,i,L).call(this,e),a(this,i,w).call(this,{},t)}pause(e,t={}){return a(this,i,w).call(this,{delay:v(e)},t)}delete(e=null,t={}){e=v(e);let r=a(this,i,N).call(this,t),n=e,{instant:o,to:l}=t,u=this.queue.getTypeable(),h=n===null?u.length:we(n)?n:ce({queueItems:u,selector:n,cursorPosition:d(this,i,D),to:l});return a(this,i,w).call(this,[r[0],...A({func:a(this,i,x).bind(this),delay:o?0:a(this,i,I).call(this,1),deletable:!0},h),r[1]],t)}freeze(){this.statuses.frozen=!0}flush(e=null){return this.flushCallback=e||this.flushCallback,this.statuses.firing||(a(this,i,X).call(this),a(this,i,q).call(this,!1).then(()=>{if(this.queue.getPendingQueueItems().length>0)return this.flush();this.flushCallback(),this.flushCallback=null})),this}getQueue(){return this.queue}getOptions(){return this.opts}updateOptions(e){return a(this,i,L).call(this,e)}getElement(){return this.element}empty(e={}){return a(this,i,w).call(this,{func:a(this,i,Ie).bind(this)},e)}}i=new WeakSet,Ie=async function(){a(this,i,O).call(this)?this.element.value="":d(this,i,T).forEach(a(this,i,z).bind(this))},q=async function(e=!0){this.statuses.started=!0,this.statuses.firing=!0;let t=r=>{this.queue.done(r,!e)};try{let r=[...this.queue.getQueue()];for(let o=0;o<r.length;o++){let[l,u]=r[o];if(!u.done){if(!u.deletable||u.deletable&&d(this,i,T).length){let h=await a(this,i,U).call(this,o,r);_e({index:o,newIndex:h,queueItems:r,cleanUp:t}),o=h}t(l)}}if(!e)return this.statuses.firing=!1,this;if(this.statuses.completed=!0,this.statuses.firing=!1,await this.opts.afterComplete(this),!this.opts.loop)throw"";let n=this.opts.loopDelay;a(this,i,V).call(this,async()=>{await a(this,i,Ee).call(this,n[0]),a(this,i,q).call(this)},n[1])}catch{}return this.statuses.firing=!1,this},Q=async function(e){var t,r,n;this.cursorPosition=(t=e,r=this.cursorPosition,n=d(this,i,T),Math.min(Math.max(r+t,0),n.length)),((o,l,u)=>{let h=l[u-1],p=K(`.${E}`,o);(o=(h==null?void 0:h.parentNode)||o).insertBefore(p,h||null)})(this.element,d(this,i,T),this.cursorPosition)},Ee=async function(e){let t=d(this,i,D);t&&await a(this,i,Q).call(this,{value:t});let r=d(this,i,T).map(n=>[Symbol(),{func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1),deletable:!0,shouldPauseCursor:()=>!0}]);for(let n=0;n<r.length;n++)await a(this,i,U).call(this,n,r);this.queue.reset(),this.queue.set(0,{delay:e})},U=function(e,t){return $e({index:e,queueItems:t,wait:a(this,i,V).bind(this),cursor:this.cursor,cursorOptions:this.opts.cursor})},V=async function(e,t,r=!1){this.statuses.frozen&&await new Promise(n=>{this.unfreeze=()=>{this.statuses.frozen=!1,n()}}),r||await this.opts.beforeStep(this),await((n,o,l)=>new Promise(u=>{l.push(setTimeout(async()=>{await n(),u()},o||0))}))(e,t,this.timeouts),r||await this.opts.afterStep(this)},X=async function(){if(!a(this,i,O).call(this)&&this.cursor&&this.element.appendChild(this.cursor),d(this,i,W)){((n,o)=>{let l=`[${me}='${n}'] .${E}`,u=getComputedStyle(o),h=Object.entries(Oe).reduce((p,[c,y])=>`${p} ${c}: var(--ti-cursor-${c}, ${y||u[c]});`,"");ae(`${l} { display: inline-block; width: 0; ${h} }`,n)})(this.id,this.element),this.cursor.dataset.tiAnimationId=this.id;let{animation:e}=this.opts.cursor,{frames:t,options:r}=e;Te({frames:t,cursor:this.cursor,options:{duration:this.opts.cursorSpeed,...r}})}},O=function(){return _(this.element)},w=function(e,t){return this.queue.add(e),a(this,i,Ce).call(this,t),this},Ce=function(e={}){let t=e.delay;t&&this.queue.add({delay:t})},N=function(e={}){return[{func:()=>a(this,i,L).call(this,e)},{func:()=>a(this,i,L).call(this,this.opts)}]},L=async function(e){this.opts=S(this.opts,e)},ve=function(){let e=this.opts.strings.filter(t=>!!t);e.forEach((t,r)=>{if(this.type(t),r+1===e.length)return;let n=this.opts.breakLines?[{func:()=>a(this,i,H).call(this,$("BR")),typeable:!0}]:A({func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1)},this.queue.getTypeable().length);a(this,i,J).call(this,n)})},R=new WeakMap,Pe=function(e){let t=this.element.innerHTML;return t?(this.element.innerHTML="",this.opts.startDelete?(this.element.innerHTML=t,Y(this.element),a(this,i,J).call(this,A({func:a(this,i,x).bind(this),delay:a(this,i,I).call(this,1),deletable:!0},d(this,i,T).length)),e):(r=t,r.replace(/<!--(.+?)-->/g,"").trim().split(/<br(?:\s*?)(?:\/)?>/)).concat(e)):e;var r},Se=function(){if(d(this,i,M))return null;let e=$("span");return e.className=E,d(this,i,W)?(e.innerHTML=ge(this.opts.cursorChar).innerHTML,e):(e.style.visibility="hidden",e)},J=function(e){let t=this.opts.nextStringDelay;this.queue.add([{delay:t[0]},...e,{delay:t[1]}])},H=function(e){((t,r)=>{if(_(t))return void(t.value=`${t.value}${r.textContent}`);r.innerHTML="";let n=(o=r.originalParent,/body/i.test(o==null?void 0:o.tagName)?t:r.originalParent||t);var o;let l=K("."+E,n)||null;l&&l.parentElement!==n&&(n=l.parentElement),n.insertBefore(r,l)})(this.element,e)},x=function(){d(this,i,T).length&&(d(this,i,M)?this.element.value=this.element.value.slice(0,-1):a(this,i,z).call(this,d(this,i,T)[this.cursorPosition]))},z=function(e){((t,r)=>{if(!t)return;let n=t.parentNode;(n.childNodes.length>1||n.isSameNode(r)?t:n).remove()})(e,this.element)},I=function(e=0){return function(t){let{speed:r,deleteSpeed:n,lifeLike:o}=t;return n=n!==null?n:r/3,o?[ue(r,he(r)),ue(n,he(n))]:[r,n]}(this.opts)[e]},D=function(){return this.predictedCursorPosition??this.cursorPosition},M=function(){return _(this.element)},W=function(){return!!this.opts.cursor&&!d(this,i,M)},T=function(){return e=this.element,_(e)?fe(e.value):be(e,!0).filter(t=>!(t.childNodes.length>0));var e};var ze=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,g=(s,e,t,r)=>{for(var n,o=r>1?void 0:r?Fe(e,t):e,l=s.length-1;l>=0;l--)(n=s[l])&&(o=(r?n(e,t,o):n(o))||o);return r&&o&&ze(e,t,o),o};exports.TypewriterElement=class extends xe.$LitElement(ne.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: inherit;
|
|
4
4
|
}
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
@slotchange=${()=>{this._startTyping()}}
|
|
19
19
|
></slot>
|
|
20
20
|
</div> `}},g([f.property({type:Number})],exports.TypewriterElement.prototype,"speed",2),g([Le.c({context:re.delayContext,subscribe:!0}),f.property({type:Number})],exports.TypewriterElement.prototype,"delay",2),g([f.property({type:Boolean})],exports.TypewriterElement.prototype,"autoStart",2),g([f.property({type:String})],exports.TypewriterElement.prototype,"cursorChar",2),g([f.property({type:Number})],exports.TypewriterElement.prototype,"deleteSpeed",2),g([f.property({type:Boolean})],exports.TypewriterElement.prototype,"once",2),g([f.query("#typewriter")],exports.TypewriterElement.prototype,"typewriterContainer",2),g([f.queryAssignedNodes({flatten:!0})],exports.TypewriterElement.prototype,"_getSlottedNodes",2),g([f.queryAssignedElements({flatten:!0})],exports.TypewriterElement.prototype,"_getSlottedElements",2),exports.TypewriterElement=g([f.customElement("schmancy-typewriter")],exports.TypewriterElement);
|
|
21
|
-
//# sourceMappingURL=typewriter-
|
|
21
|
+
//# sourceMappingURL=typewriter-CFgNAfJm.cjs.map
|