@francofantomius/material-components 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +2 -1
- package/custom-elements.json +1049 -300
- package/dist/chunks/{account-menu-Dau0UHTl.js → account-menu-Bo7NghIm.js} +181 -223
- package/dist/chunks/{account-menu-Dau0UHTl.js.map → account-menu-Bo7NghIm.js.map} +1 -1
- package/dist/chunks/app-drawer-DjKSuatE.js +855 -0
- package/dist/chunks/{app-drawer-Du1ePzxZ.js.map → app-drawer-DjKSuatE.js.map} +1 -1
- package/dist/chunks/{badge-G4EjcMoy.js → badge-sZzNelZz.js} +30 -34
- package/dist/chunks/{badge-G4EjcMoy.js.map → badge-sZzNelZz.js.map} +1 -1
- package/dist/chunks/{bottom-sheet-q79BBYAj.js → bottom-sheet-BGgbUmKd.js} +98 -109
- package/dist/chunks/{bottom-sheet-q79BBYAj.js.map → bottom-sheet-BGgbUmKd.js.map} +1 -1
- package/dist/chunks/{button-D2vn7kJ8.js → button-DeQQlYds.js} +62 -72
- package/dist/chunks/{button-D2vn7kJ8.js.map → button-DeQQlYds.js.map} +1 -1
- package/dist/chunks/button-group-R2jN8FXK.js +136 -0
- package/dist/chunks/{button-group-CNqvJx1n.js.map → button-group-R2jN8FXK.js.map} +1 -1
- package/dist/chunks/{card-DVffdPpv.js → card-CVhWizDF.js} +45 -50
- package/dist/chunks/{card-DVffdPpv.js.map → card-CVhWizDF.js.map} +1 -1
- package/dist/chunks/{carousel-item-BG6kjjjk.js → carousel-item-DNp2zhP9.js} +62 -73
- package/dist/chunks/{carousel-item-BG6kjjjk.js.map → carousel-item-DNp2zhP9.js.map} +1 -1
- package/dist/chunks/{checkbox-BqlboAHd.js → checkbox-CsqUHVOF.js} +59 -64
- package/dist/chunks/{checkbox-BqlboAHd.js.map → checkbox-CsqUHVOF.js.map} +1 -1
- package/dist/chunks/{chip-CI1ZINnr.js → chip-B5c-I8bj.js} +56 -63
- package/dist/chunks/{chip-CI1ZINnr.js.map → chip-B5c-I8bj.js.map} +1 -1
- package/dist/chunks/code-CM6hIZNx.js +1531 -0
- package/dist/chunks/{code-C5UFBkCh.js.map → code-CM6hIZNx.js.map} +1 -1
- package/dist/chunks/date-picker-B15_rR0f.js +774 -0
- package/dist/chunks/date-picker-B15_rR0f.js.map +1 -0
- package/dist/chunks/decorate-DknOJ8FJ.js +40 -0
- package/dist/chunks/{decorate-DXuynaiA.js.map → decorate-DknOJ8FJ.js.map} +1 -1
- package/dist/chunks/{dialog-DGVEE5m_.js → dialog-Czknf8dl.js} +47 -52
- package/dist/chunks/{dialog-DGVEE5m_.js.map → dialog-Czknf8dl.js.map} +1 -1
- package/dist/chunks/divider-DIyCOosa.js +78 -0
- package/dist/chunks/{divider-DNepwoZv.js.map → divider-DIyCOosa.js.map} +1 -1
- package/dist/chunks/{fab-C9j3WBHE.js → fab-aZC0-lHo.js} +38 -44
- package/dist/chunks/{fab-C9j3WBHE.js.map → fab-aZC0-lHo.js.map} +1 -1
- package/dist/chunks/{fab-menu.css-3pu930sZ.js → fab-menu.css-BdVg1k4c.js} +5 -6
- package/dist/chunks/{fab-menu.css-3pu930sZ.js.map → fab-menu.css-BdVg1k4c.js.map} +1 -1
- package/dist/chunks/focus-ring-K6SY_mIm.js +69 -0
- package/dist/chunks/{focus-ring-CuiJuM-y.js.map → focus-ring-K6SY_mIm.js.map} +1 -1
- package/dist/chunks/form-associated-Do5uXckv.js +69 -0
- package/dist/chunks/{form-associated-Cty_ZaS9.js.map → form-associated-Do5uXckv.js.map} +1 -1
- package/dist/chunks/icon-FvKeXi61.js +59 -0
- package/dist/chunks/{icon-DrNqcNEL.js.map → icon-FvKeXi61.js.map} +1 -1
- package/dist/chunks/{icon-button-BQz73GLa.js → icon-button-CulnCZpZ.js} +58 -67
- package/dist/chunks/{icon-button-BQz73GLa.js.map → icon-button-CulnCZpZ.js.map} +1 -1
- package/dist/chunks/{list-D8olR7oZ.js → list-D7yrbJRL.js} +64 -72
- package/dist/chunks/{list-D8olR7oZ.js.map → list-D7yrbJRL.js.map} +1 -1
- package/dist/chunks/{loading-indicator-CvWnZr9o.js → loading-indicator-D9AyxNQh.js} +41 -46
- package/dist/chunks/{loading-indicator-CvWnZr9o.js.map → loading-indicator-D9AyxNQh.js.map} +1 -1
- package/dist/chunks/{menu-item-BBSp5Cqc.js → menu-item-C3entPo7.js} +77 -91
- package/dist/chunks/{menu-item-BBSp5Cqc.js.map → menu-item-C3entPo7.js.map} +1 -1
- package/dist/chunks/{navigation-bar-item-C9DfOEzg.js → navigation-bar-item-CWHCQeNw.js} +98 -115
- package/dist/chunks/{navigation-bar-item-C9DfOEzg.js.map → navigation-bar-item-CWHCQeNw.js.map} +1 -1
- package/dist/chunks/{navigation-drawer-CKl44Ef5.js → navigation-drawer-pGer0t4z.js} +116 -138
- package/dist/chunks/{navigation-drawer-CKl44Ef5.js.map → navigation-drawer-pGer0t4z.js.map} +1 -1
- package/dist/chunks/{navigation-rail-item-6pdhNHJK.js → navigation-rail-item-CWvGjLjC.js} +70 -86
- package/dist/chunks/{navigation-rail-item-6pdhNHJK.js.map → navigation-rail-item-CWvGjLjC.js.map} +1 -1
- package/dist/chunks/{player-C4ydiIpr.js → player-dT08kxeG.js} +423 -466
- package/dist/chunks/{player-C4ydiIpr.js.map → player-dT08kxeG.js.map} +1 -1
- package/dist/chunks/{progress-LQmLMDjX.js → progress-etZuX_VD.js} +46 -53
- package/dist/chunks/{progress-LQmLMDjX.js.map → progress-etZuX_VD.js.map} +1 -1
- package/dist/chunks/radio-jPCwykIa.js +197 -0
- package/dist/chunks/{radio-Bily78NT.js.map → radio-jPCwykIa.js.map} +1 -1
- package/dist/chunks/ripple-CBOKeVfm.js +132 -0
- package/dist/chunks/{ripple-squbKHhj.js.map → ripple-CBOKeVfm.js.map} +1 -1
- package/dist/chunks/{search-bar-fUD0qU2P.js → search-bar-B6xxVT7u.js} +244 -203
- package/dist/chunks/search-bar-B6xxVT7u.js.map +1 -0
- package/dist/chunks/segmented-button-Fon9kOHV.js +253 -0
- package/dist/chunks/{segmented-button-B0BvGSQ7.js.map → segmented-button-Fon9kOHV.js.map} +1 -1
- package/dist/chunks/{side-sheet-S2w081AK.js → side-sheet-sQ8qGKVm.js} +73 -81
- package/dist/chunks/{side-sheet-S2w081AK.js.map → side-sheet-sQ8qGKVm.js.map} +1 -1
- package/dist/chunks/slider-OIyEcUU9.js +448 -0
- package/dist/chunks/slider-OIyEcUU9.js.map +1 -0
- package/dist/chunks/{snackbar-Wsz3BzEY.js → snackbar-Yi6fF9vM.js} +57 -62
- package/dist/chunks/{snackbar-Wsz3BzEY.js.map → snackbar-Yi6fF9vM.js.map} +1 -1
- package/dist/chunks/{split-button-DUfjukQY.js → split-button-CLjVJe3I.js} +155 -172
- package/dist/chunks/{split-button-DUfjukQY.js.map → split-button-CLjVJe3I.js.map} +1 -1
- package/dist/chunks/{switch-DdukrvXb.js → switch-mtu6AVEh.js} +54 -57
- package/dist/chunks/{switch-DdukrvXb.js.map → switch-mtu6AVEh.js.map} +1 -1
- package/dist/chunks/table-C5rCvdFc.js +724 -0
- package/dist/chunks/{table-CqHnneAj.js.map → table-C5rCvdFc.js.map} +1 -1
- package/dist/chunks/tabs-C0mtURlT.js +182 -0
- package/dist/chunks/{tabs-BfOtoeir.js.map → tabs-C0mtURlT.js.map} +1 -1
- package/dist/chunks/{text-field-hN6-2HQy.js → text-field-MifFD7uk.js} +92 -110
- package/dist/chunks/{text-field-hN6-2HQy.js.map → text-field-MifFD7uk.js.map} +1 -1
- package/dist/chunks/time-picker-JTcLcJuz.js +810 -0
- package/dist/chunks/time-picker-JTcLcJuz.js.map +1 -0
- package/dist/chunks/{toolbar-DXVQbQKJ.js → toolbar-CsxKc2Yd.js} +48 -55
- package/dist/chunks/{toolbar-DXVQbQKJ.js.map → toolbar-CsxKc2Yd.js.map} +1 -1
- package/dist/chunks/tooltip-Ds3lNowS.js +380 -0
- package/dist/chunks/{tooltip-CE7JMHMu.js.map → tooltip-Ds3lNowS.js.map} +1 -1
- package/dist/chunks/{top-app-bar-Dgbp6CFv.js → top-app-bar-TrnjKzOX.js} +52 -53
- package/dist/chunks/top-app-bar-TrnjKzOX.js.map +1 -0
- package/dist/components/account-menu/account-menu.js +2 -8
- package/dist/components/app-drawer/app-drawer.js +2 -9
- package/dist/components/badge/badge.js +2 -4
- package/dist/components/bottom-sheet/bottom-sheet.js +2 -4
- package/dist/components/button/button.js +2 -4
- package/dist/components/button-group/button-group.js +2 -4
- package/dist/components/card/card.js +2 -4
- package/dist/components/carousel/carousel-item.js +2 -4
- package/dist/components/carousel/carousel.js +214 -232
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -4
- package/dist/components/chip/chip.js +2 -5
- package/dist/components/code/code.js +2 -5
- package/dist/components/date-picker/date-picker.js +2 -4
- package/dist/components/dialog/dialog.js +2 -4
- package/dist/components/divider/divider.js +2 -4
- package/dist/components/fab/fab.js +2 -4
- package/dist/components/fab-menu/fab-menu-item.js +53 -61
- package/dist/components/fab-menu/fab-menu-item.js.map +1 -1
- package/dist/components/fab-menu/fab-menu.js +98 -111
- package/dist/components/fab-menu/fab-menu.js.map +1 -1
- package/dist/components/icon/icon.js +2 -4
- package/dist/components/icon-button/icon-button.js +2 -4
- package/dist/components/list/list.js +2 -5
- package/dist/components/loading-indicator/loading-indicator.js +2 -4
- package/dist/components/menu/menu-item.js +2 -4
- package/dist/components/menu/menu.js +165 -183
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/navigation-bar/navigation-bar-item.js +2 -5
- package/dist/components/navigation-bar/navigation-bar.js +131 -143
- package/dist/components/navigation-bar/navigation-bar.js.map +1 -1
- package/dist/components/navigation-drawer/navigation-drawer.js +2 -8
- package/dist/components/navigation-rail/navigation-rail-item.js +2 -5
- package/dist/components/navigation-rail/navigation-rail.js +92 -102
- package/dist/components/navigation-rail/navigation-rail.js.map +1 -1
- package/dist/components/player/player.js +2 -7
- package/dist/components/progress/progress.js +2 -5
- package/dist/components/radio/radio.js +2 -5
- package/dist/components/search-bar/search-bar.js +2 -5
- package/dist/components/segmented-button/segmented-button.js +2 -5
- package/dist/components/side-sheet/side-sheet.js +2 -4
- package/dist/components/slider/slider.js +2 -4
- package/dist/components/snackbar/snackbar.js +2 -4
- package/dist/components/split-button/split-button.js +2 -4
- package/dist/components/switch/switch.js +2 -4
- package/dist/components/table/table.js +2 -13
- package/dist/components/tabs/tabs.js +2 -5
- package/dist/components/text-field/text-field.js +2 -4
- package/dist/components/time-picker/time-picker.js +2 -4
- package/dist/components/toolbar/toolbar.js +2 -4
- package/dist/components/tooltip/tooltip.js +2 -4
- package/dist/components/top-app-bar/top-app-bar.js +2 -5
- package/dist/index.js +52 -150
- package/dist/internal/focus-ring/focus-ring.js +2 -4
- package/dist/internal/ripple/ripple.js +2 -4
- package/dist/tokens/index.js +468 -314
- package/dist/tokens/index.js.map +1 -1
- package/llms.txt +74 -8
- package/package.json +2 -14
- package/dist/chunks/app-drawer-Du1ePzxZ.js +0 -903
- package/dist/chunks/button-group-CNqvJx1n.js +0 -143
- package/dist/chunks/code-C5UFBkCh.js +0 -1830
- package/dist/chunks/date-picker-DJeHi4w-.js +0 -777
- package/dist/chunks/date-picker-DJeHi4w-.js.map +0 -1
- package/dist/chunks/decorate-DXuynaiA.js +0 -39
- package/dist/chunks/divider-DNepwoZv.js +0 -82
- package/dist/chunks/focus-ring-CuiJuM-y.js +0 -71
- package/dist/chunks/form-associated-Cty_ZaS9.js +0 -73
- package/dist/chunks/icon-DrNqcNEL.js +0 -62
- package/dist/chunks/radio-Bily78NT.js +0 -205
- package/dist/chunks/ripple-squbKHhj.js +0 -135
- package/dist/chunks/search-bar-fUD0qU2P.js.map +0 -1
- package/dist/chunks/segmented-button-B0BvGSQ7.js +0 -265
- package/dist/chunks/slider-D-mnO8yQ.js +0 -450
- package/dist/chunks/slider-D-mnO8yQ.js.map +0 -1
- package/dist/chunks/table-CqHnneAj.js +0 -773
- package/dist/chunks/tabs-BfOtoeir.js +0 -191
- package/dist/chunks/time-picker-CZnb2sWz.js +0 -785
- package/dist/chunks/time-picker-CZnb2sWz.js.map +0 -1
- package/dist/chunks/tooltip-CE7JMHMu.js +0 -398
- package/dist/chunks/top-app-bar-Dgbp6CFv.js.map +0 -1
- package/dist/components/account-menu/account-menu.css.d.ts +0 -3
- package/dist/components/account-menu/account-menu.css.d.ts.map +0 -1
- package/dist/components/account-menu/account-menu.d.ts +0 -111
- package/dist/components/account-menu/account-menu.d.ts.map +0 -1
- package/dist/components/app-drawer/app-drawer.css.d.ts +0 -3
- package/dist/components/app-drawer/app-drawer.css.d.ts.map +0 -1
- package/dist/components/app-drawer/app-drawer.d.ts +0 -173
- package/dist/components/app-drawer/app-drawer.d.ts.map +0 -1
- package/dist/components/badge/badge.css.d.ts +0 -2
- package/dist/components/badge/badge.css.d.ts.map +0 -1
- package/dist/components/badge/badge.d.ts +0 -16
- package/dist/components/badge/badge.d.ts.map +0 -1
- package/dist/components/bottom-sheet/bottom-sheet.css.d.ts +0 -2
- package/dist/components/bottom-sheet/bottom-sheet.css.d.ts.map +0 -1
- package/dist/components/bottom-sheet/bottom-sheet.d.ts +0 -69
- package/dist/components/bottom-sheet/bottom-sheet.d.ts.map +0 -1
- package/dist/components/button/button.css.d.ts +0 -2
- package/dist/components/button/button.css.d.ts.map +0 -1
- package/dist/components/button/button.d.ts +0 -25
- package/dist/components/button/button.d.ts.map +0 -1
- package/dist/components/button-group/button-group.css.d.ts +0 -2
- package/dist/components/button-group/button-group.css.d.ts.map +0 -1
- package/dist/components/button-group/button-group.d.ts +0 -28
- package/dist/components/button-group/button-group.d.ts.map +0 -1
- package/dist/components/card/card.css.d.ts +0 -2
- package/dist/components/card/card.css.d.ts.map +0 -1
- package/dist/components/card/card.d.ts +0 -18
- package/dist/components/card/card.d.ts.map +0 -1
- package/dist/components/carousel/carousel-item.d.ts +0 -33
- package/dist/components/carousel/carousel-item.d.ts.map +0 -1
- package/dist/components/carousel/carousel.css.d.ts +0 -3
- package/dist/components/carousel/carousel.css.d.ts.map +0 -1
- package/dist/components/carousel/carousel.d.ts +0 -81
- package/dist/components/carousel/carousel.d.ts.map +0 -1
- package/dist/components/checkbox/checkbox.css.d.ts +0 -2
- package/dist/components/checkbox/checkbox.css.d.ts.map +0 -1
- package/dist/components/checkbox/checkbox.d.ts +0 -24
- package/dist/components/checkbox/checkbox.d.ts.map +0 -1
- package/dist/components/chip/chip.css.d.ts +0 -3
- package/dist/components/chip/chip.css.d.ts.map +0 -1
- package/dist/components/chip/chip.d.ts +0 -27
- package/dist/components/chip/chip.d.ts.map +0 -1
- package/dist/components/code/code.css.d.ts +0 -2
- package/dist/components/code/code.css.d.ts.map +0 -1
- package/dist/components/code/code.d.ts +0 -106
- package/dist/components/code/code.d.ts.map +0 -1
- package/dist/components/code/highlighter.d.ts +0 -8
- package/dist/components/code/highlighter.d.ts.map +0 -1
- package/dist/components/code/linter.d.ts +0 -44
- package/dist/components/code/linter.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker.css.d.ts +0 -2
- package/dist/components/date-picker/date-picker.css.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker.d.ts +0 -59
- package/dist/components/date-picker/date-picker.d.ts.map +0 -1
- package/dist/components/dialog/dialog.css.d.ts +0 -2
- package/dist/components/dialog/dialog.css.d.ts.map +0 -1
- package/dist/components/dialog/dialog.d.ts +0 -22
- package/dist/components/dialog/dialog.d.ts.map +0 -1
- package/dist/components/divider/divider.css.d.ts +0 -2
- package/dist/components/divider/divider.css.d.ts.map +0 -1
- package/dist/components/divider/divider.d.ts +0 -16
- package/dist/components/divider/divider.d.ts.map +0 -1
- package/dist/components/fab/fab.css.d.ts +0 -2
- package/dist/components/fab/fab.css.d.ts.map +0 -1
- package/dist/components/fab/fab.d.ts +0 -19
- package/dist/components/fab/fab.d.ts.map +0 -1
- package/dist/components/fab-menu/fab-menu-item.d.ts +0 -35
- package/dist/components/fab-menu/fab-menu-item.d.ts.map +0 -1
- package/dist/components/fab-menu/fab-menu.css.d.ts +0 -3
- package/dist/components/fab-menu/fab-menu.css.d.ts.map +0 -1
- package/dist/components/fab-menu/fab-menu.d.ts +0 -72
- package/dist/components/fab-menu/fab-menu.d.ts.map +0 -1
- package/dist/components/icon/icon.css.d.ts +0 -2
- package/dist/components/icon/icon.css.d.ts.map +0 -1
- package/dist/components/icon/icon.d.ts +0 -15
- package/dist/components/icon/icon.d.ts.map +0 -1
- package/dist/components/icon-button/icon-button.css.d.ts +0 -2
- package/dist/components/icon-button/icon-button.css.d.ts.map +0 -1
- package/dist/components/icon-button/icon-button.d.ts +0 -22
- package/dist/components/icon-button/icon-button.d.ts.map +0 -1
- package/dist/components/list/list.css.d.ts +0 -3
- package/dist/components/list/list.css.d.ts.map +0 -1
- package/dist/components/list/list.d.ts +0 -25
- package/dist/components/list/list.d.ts.map +0 -1
- package/dist/components/loading-indicator/loading-indicator.css.d.ts +0 -2
- package/dist/components/loading-indicator/loading-indicator.css.d.ts.map +0 -1
- package/dist/components/loading-indicator/loading-indicator.d.ts +0 -48
- package/dist/components/loading-indicator/loading-indicator.d.ts.map +0 -1
- package/dist/components/menu/menu-item.d.ts +0 -41
- package/dist/components/menu/menu-item.d.ts.map +0 -1
- package/dist/components/menu/menu.css.d.ts +0 -3
- package/dist/components/menu/menu.css.d.ts.map +0 -1
- package/dist/components/menu/menu.d.ts +0 -91
- package/dist/components/menu/menu.d.ts.map +0 -1
- package/dist/components/navigation-bar/navigation-bar-item.d.ts +0 -49
- package/dist/components/navigation-bar/navigation-bar-item.d.ts.map +0 -1
- package/dist/components/navigation-bar/navigation-bar.css.d.ts +0 -3
- package/dist/components/navigation-bar/navigation-bar.css.d.ts.map +0 -1
- package/dist/components/navigation-bar/navigation-bar.d.ts +0 -50
- package/dist/components/navigation-bar/navigation-bar.d.ts.map +0 -1
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts +0 -3
- package/dist/components/navigation-drawer/navigation-drawer.css.d.ts.map +0 -1
- package/dist/components/navigation-drawer/navigation-drawer.d.ts +0 -76
- package/dist/components/navigation-drawer/navigation-drawer.d.ts.map +0 -1
- package/dist/components/navigation-rail/navigation-rail-item.d.ts +0 -36
- package/dist/components/navigation-rail/navigation-rail-item.d.ts.map +0 -1
- package/dist/components/navigation-rail/navigation-rail.css.d.ts +0 -3
- package/dist/components/navigation-rail/navigation-rail.css.d.ts.map +0 -1
- package/dist/components/navigation-rail/navigation-rail.d.ts +0 -43
- package/dist/components/navigation-rail/navigation-rail.d.ts.map +0 -1
- package/dist/components/player/player.css.d.ts +0 -2
- package/dist/components/player/player.css.d.ts.map +0 -1
- package/dist/components/player/player.d.ts +0 -99
- package/dist/components/player/player.d.ts.map +0 -1
- package/dist/components/progress/progress.css.d.ts +0 -2
- package/dist/components/progress/progress.css.d.ts.map +0 -1
- package/dist/components/progress/progress.d.ts +0 -21
- package/dist/components/progress/progress.d.ts.map +0 -1
- package/dist/components/radio/radio.css.d.ts +0 -3
- package/dist/components/radio/radio.css.d.ts.map +0 -1
- package/dist/components/radio/radio.d.ts +0 -38
- package/dist/components/radio/radio.d.ts.map +0 -1
- package/dist/components/search-bar/search-bar.css.d.ts +0 -2
- package/dist/components/search-bar/search-bar.css.d.ts.map +0 -1
- package/dist/components/search-bar/search-bar.d.ts +0 -81
- package/dist/components/search-bar/search-bar.d.ts.map +0 -1
- package/dist/components/segmented-button/segmented-button.css.d.ts +0 -3
- package/dist/components/segmented-button/segmented-button.css.d.ts.map +0 -1
- package/dist/components/segmented-button/segmented-button.d.ts +0 -40
- package/dist/components/segmented-button/segmented-button.d.ts.map +0 -1
- package/dist/components/side-sheet/side-sheet.css.d.ts +0 -2
- package/dist/components/side-sheet/side-sheet.css.d.ts.map +0 -1
- package/dist/components/side-sheet/side-sheet.d.ts +0 -57
- package/dist/components/side-sheet/side-sheet.d.ts.map +0 -1
- package/dist/components/slider/slider.css.d.ts +0 -2
- package/dist/components/slider/slider.css.d.ts.map +0 -1
- package/dist/components/slider/slider.d.ts +0 -51
- package/dist/components/slider/slider.d.ts.map +0 -1
- package/dist/components/snackbar/snackbar.css.d.ts +0 -2
- package/dist/components/snackbar/snackbar.css.d.ts.map +0 -1
- package/dist/components/snackbar/snackbar.d.ts +0 -24
- package/dist/components/snackbar/snackbar.d.ts.map +0 -1
- package/dist/components/split-button/split-button.css.d.ts +0 -2
- package/dist/components/split-button/split-button.css.d.ts.map +0 -1
- package/dist/components/split-button/split-button.d.ts +0 -89
- package/dist/components/split-button/split-button.d.ts.map +0 -1
- package/dist/components/switch/switch.css.d.ts +0 -2
- package/dist/components/switch/switch.css.d.ts.map +0 -1
- package/dist/components/switch/switch.d.ts +0 -22
- package/dist/components/switch/switch.d.ts.map +0 -1
- package/dist/components/table/table.css.d.ts +0 -8
- package/dist/components/table/table.css.d.ts.map +0 -1
- package/dist/components/table/table.d.ts +0 -158
- package/dist/components/table/table.d.ts.map +0 -1
- package/dist/components/tabs/tabs.css.d.ts +0 -3
- package/dist/components/tabs/tabs.css.d.ts.map +0 -1
- package/dist/components/tabs/tabs.d.ts +0 -33
- package/dist/components/tabs/tabs.d.ts.map +0 -1
- package/dist/components/text-field/text-field.css.d.ts +0 -2
- package/dist/components/text-field/text-field.css.d.ts.map +0 -1
- package/dist/components/text-field/text-field.d.ts +0 -40
- package/dist/components/text-field/text-field.d.ts.map +0 -1
- package/dist/components/time-picker/time-picker.css.d.ts +0 -2
- package/dist/components/time-picker/time-picker.css.d.ts.map +0 -1
- package/dist/components/time-picker/time-picker.d.ts +0 -87
- package/dist/components/time-picker/time-picker.d.ts.map +0 -1
- package/dist/components/toolbar/toolbar.css.d.ts +0 -2
- package/dist/components/toolbar/toolbar.css.d.ts.map +0 -1
- package/dist/components/toolbar/toolbar.d.ts +0 -53
- package/dist/components/toolbar/toolbar.d.ts.map +0 -1
- package/dist/components/tooltip/tooltip.css.d.ts +0 -2
- package/dist/components/tooltip/tooltip.css.d.ts.map +0 -1
- package/dist/components/tooltip/tooltip.d.ts +0 -89
- package/dist/components/tooltip/tooltip.d.ts.map +0 -1
- package/dist/components/top-app-bar/top-app-bar.css.d.ts +0 -2
- package/dist/components/top-app-bar/top-app-bar.css.d.ts.map +0 -1
- package/dist/components/top-app-bar/top-app-bar.d.ts +0 -29
- package/dist/components/top-app-bar/top-app-bar.d.ts.map +0 -1
- package/dist/index.d.ts +0 -52
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/base-component.d.ts +0 -13
- package/dist/internal/base-component.d.ts.map +0 -1
- package/dist/internal/focus-ring/focus-ring.css.d.ts +0 -2
- package/dist/internal/focus-ring/focus-ring.css.d.ts.map +0 -1
- package/dist/internal/focus-ring/focus-ring.d.ts +0 -18
- package/dist/internal/focus-ring/focus-ring.d.ts.map +0 -1
- package/dist/internal/form-associated.d.ts +0 -26
- package/dist/internal/form-associated.d.ts.map +0 -1
- package/dist/internal/ripple/ripple.css.d.ts +0 -2
- package/dist/internal/ripple/ripple.css.d.ts.map +0 -1
- package/dist/internal/ripple/ripple.d.ts +0 -23
- package/dist/internal/ripple/ripple.d.ts.map +0 -1
- package/dist/tokens/colors.d.ts +0 -42
- package/dist/tokens/colors.d.ts.map +0 -1
- package/dist/tokens/elevation.d.ts +0 -9
- package/dist/tokens/elevation.d.ts.map +0 -1
- package/dist/tokens/index.d.ts +0 -7
- package/dist/tokens/index.d.ts.map +0 -1
- package/dist/tokens/motion.d.ts +0 -21
- package/dist/tokens/motion.d.ts.map +0 -1
- package/dist/tokens/shape.d.ts +0 -10
- package/dist/tokens/shape.d.ts.map +0 -1
- package/dist/tokens/theme.css.d.ts +0 -4
- package/dist/tokens/theme.css.d.ts.map +0 -1
- package/dist/tokens/typography.d.ts +0 -101
- package/dist/tokens/typography.d.ts.map +0 -1
|
@@ -0,0 +1,1531 @@
|
|
|
1
|
+
import { n as e, t } from "./decorate-DknOJ8FJ.js";
|
|
2
|
+
import "./icon-FvKeXi61.js";
|
|
3
|
+
import { css as n, html as r, nothing as i } from "lit";
|
|
4
|
+
import { customElement as a, property as o, state as s } from "lit/decorators.js";
|
|
5
|
+
import { unsafeHTML as c } from "lit/directives/unsafe-html.js";
|
|
6
|
+
//#region src/components/code/code.css.ts
|
|
7
|
+
var l = n`
|
|
8
|
+
:host {
|
|
9
|
+
display: block;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
font-family: 'Fira Code', 'Roboto Mono', Consolas, Monaco, 'Courier New', monospace;
|
|
12
|
+
--md-code-bg: var(--md-sys-color-surface-container, #f3edf7);
|
|
13
|
+
--md-code-header-bg: var(--md-sys-color-surface-container-high, #ece6f0);
|
|
14
|
+
--md-code-border: var(--md-sys-color-outline-variant, #cac4d0);
|
|
15
|
+
--md-code-color: var(--md-sys-color-on-surface, #1d1b20);
|
|
16
|
+
--md-code-gutter-color: var(--md-sys-color-outline, #79747e);
|
|
17
|
+
--md-code-gutter-bg: transparent;
|
|
18
|
+
--md-code-radius: var(--md-sys-shape-corner-medium, 12px);
|
|
19
|
+
--md-code-font-size: 13.5px;
|
|
20
|
+
--md-code-line-height: 1.6;
|
|
21
|
+
margin: 1rem 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.code-container {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
background-color: var(--md-code-bg);
|
|
29
|
+
border: 1px solid var(--md-code-border);
|
|
30
|
+
border-radius: var(--md-code-radius);
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
color: var(--md-code-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Header Bar */
|
|
36
|
+
.code-header {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
padding: 6px 12px;
|
|
41
|
+
background-color: var(--md-code-header-bg);
|
|
42
|
+
border-bottom: 1px solid var(--md-code-border);
|
|
43
|
+
min-height: 40px;
|
|
44
|
+
font-size: 12.5px;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
user-select: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.code-header-left {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.lang-badge {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
padding: 2px 8px;
|
|
62
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
63
|
+
color: var(--md-sys-color-on-secondary-container, #1d192b);
|
|
64
|
+
border-radius: var(--md-sys-shape-corner-full, 9999px);
|
|
65
|
+
font-size: 11px;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
letter-spacing: 0.5px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.code-filename {
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.code-header-actions {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 4px;
|
|
82
|
+
margin-left: auto;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Floating Copy Button (when header is hidden) */
|
|
86
|
+
.floating-copy-btn {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 8px;
|
|
89
|
+
right: 8px;
|
|
90
|
+
z-index: 5;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Copy Button inside header or floating */
|
|
94
|
+
.action-btn {
|
|
95
|
+
display: inline-flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
gap: 6px;
|
|
99
|
+
height: 28px;
|
|
100
|
+
padding: 0 10px;
|
|
101
|
+
border: none;
|
|
102
|
+
border-radius: var(--md-sys-shape-corner-small, 8px);
|
|
103
|
+
background-color: transparent;
|
|
104
|
+
color: var(--md-sys-color-on-surface-variant, #49454f);
|
|
105
|
+
font-family: var(--md-sys-typescale-font-family, 'Roboto', sans-serif);
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
font-weight: 500;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
transition: background-color 150ms ease, color 150ms ease;
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.action-btn:hover {
|
|
114
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
115
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.action-btn:active {
|
|
119
|
+
background-color: var(--md-sys-color-secondary-container, #e8def8);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.action-btn.copied {
|
|
123
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
124
|
+
background-color: var(--md-sys-color-primary-container, #eaddff);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.action-btn md-icon {
|
|
128
|
+
--md-icon-size: 16px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Code Viewport & Scroll Area */
|
|
132
|
+
.code-body {
|
|
133
|
+
position: relative;
|
|
134
|
+
display: flex;
|
|
135
|
+
overflow-x: auto;
|
|
136
|
+
overflow-y: auto;
|
|
137
|
+
font-size: var(--md-code-font-size);
|
|
138
|
+
line-height: var(--md-code-line-height);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pre {
|
|
142
|
+
margin: 0;
|
|
143
|
+
padding: 12px 16px;
|
|
144
|
+
font-family: inherit;
|
|
145
|
+
font-size: inherit;
|
|
146
|
+
line-height: inherit;
|
|
147
|
+
tab-size: 2;
|
|
148
|
+
flex-grow: 1;
|
|
149
|
+
overflow: visible;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
code {
|
|
153
|
+
font-family: inherit;
|
|
154
|
+
font-size: inherit;
|
|
155
|
+
line-height: inherit;
|
|
156
|
+
display: block;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host([wrap-lines]) pre {
|
|
160
|
+
white-space: pre-wrap;
|
|
161
|
+
word-break: break-word;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host(:not([wrap-lines])) pre {
|
|
165
|
+
white-space: pre;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Line Structure */
|
|
169
|
+
.code-line {
|
|
170
|
+
display: block;
|
|
171
|
+
padding: 0 4px;
|
|
172
|
+
border-radius: 2px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.code-line.highlighted {
|
|
176
|
+
background-color: rgba(103, 80, 164, 0.12);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.code-line.has-error {
|
|
180
|
+
background-color: rgba(179, 38, 30, 0.14);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.code-line.has-warning {
|
|
184
|
+
background-color: rgba(230, 81, 0, 0.12);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Gutter & Line Numbers */
|
|
188
|
+
.code-gutter {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
padding: 12px 0 12px 10px;
|
|
192
|
+
user-select: none;
|
|
193
|
+
background-color: var(--md-code-gutter-bg);
|
|
194
|
+
border-right: 1px solid var(--md-code-border);
|
|
195
|
+
flex-shrink: 0;
|
|
196
|
+
min-width: 44px;
|
|
197
|
+
box-sizing: border-box;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.gutter-line {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: flex-end;
|
|
204
|
+
gap: 4px;
|
|
205
|
+
height: calc(var(--md-code-font-size) * var(--md-code-line-height));
|
|
206
|
+
padding-right: 8px;
|
|
207
|
+
color: var(--md-code-gutter-color);
|
|
208
|
+
font-size: 11.5px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.gutter-marker {
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
width: 14px;
|
|
216
|
+
height: 14px;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.gutter-marker.error {
|
|
221
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.gutter-marker.warning {
|
|
225
|
+
color: #e65100;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.gutter-marker.info {
|
|
229
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.gutter-marker md-icon {
|
|
233
|
+
--md-icon-size: 14px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* Lint Status Footer Bar */
|
|
237
|
+
.lint-footer {
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-direction: column;
|
|
240
|
+
background-color: var(--md-code-header-bg);
|
|
241
|
+
border-top: 1px solid var(--md-code-border);
|
|
242
|
+
font-size: 12px;
|
|
243
|
+
font-family: var(--md-sys-typescale-font-family, 'Roboto', sans-serif);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.lint-footer-summary {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: space-between;
|
|
250
|
+
padding: 6px 12px;
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
user-select: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.lint-footer-summary:hover {
|
|
256
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.lint-counts {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
gap: 12px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.lint-count-item {
|
|
266
|
+
display: inline-flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
gap: 4px;
|
|
269
|
+
font-weight: 500;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.lint-count-item.errors {
|
|
273
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.lint-count-item.warnings {
|
|
277
|
+
color: #e65100;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.lint-count-item.valid {
|
|
281
|
+
color: #2e7d32;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.lint-count-item md-icon {
|
|
285
|
+
--md-icon-size: 15px;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.lint-issues-list {
|
|
289
|
+
display: flex;
|
|
290
|
+
flex-direction: column;
|
|
291
|
+
max-height: 160px;
|
|
292
|
+
overflow-y: auto;
|
|
293
|
+
border-top: 1px solid var(--md-code-border);
|
|
294
|
+
background-color: var(--md-code-bg);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.lint-issue-item {
|
|
298
|
+
display: flex;
|
|
299
|
+
align-items: flex-start;
|
|
300
|
+
gap: 8px;
|
|
301
|
+
padding: 6px 12px;
|
|
302
|
+
border-bottom: 1px solid var(--md-code-border);
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
transition: background-color 100ms ease;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.lint-issue-item:last-child {
|
|
308
|
+
border-bottom: none;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.lint-issue-item:hover {
|
|
312
|
+
background-color: var(--md-sys-color-surface-container-highest, #e6e0e9);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.lint-issue-item.error md-icon {
|
|
316
|
+
color: var(--md-sys-color-error, #b3261e);
|
|
317
|
+
--md-icon-size: 16px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.lint-issue-item.warning md-icon {
|
|
321
|
+
color: #e65100;
|
|
322
|
+
--md-icon-size: 16px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.lint-issue-item.info md-icon {
|
|
326
|
+
color: var(--md-sys-color-primary, #6750a4);
|
|
327
|
+
--md-icon-size: 16px;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.lint-issue-content {
|
|
331
|
+
display: flex;
|
|
332
|
+
flex-direction: column;
|
|
333
|
+
gap: 2px;
|
|
334
|
+
flex-grow: 1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.lint-issue-loc {
|
|
338
|
+
font-weight: 600;
|
|
339
|
+
font-size: 11px;
|
|
340
|
+
color: var(--md-sys-color-outline, #79747e);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.lint-issue-msg {
|
|
344
|
+
font-size: 12px;
|
|
345
|
+
color: var(--md-sys-color-on-surface, #1d1b20);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* --- Syntax Highlighting Colors (MD3 Color Scheme Aware) --- */
|
|
349
|
+
.token-keyword {
|
|
350
|
+
color: var(--md-code-token-keyword, var(--md-sys-color-primary, #6750a4));
|
|
351
|
+
font-weight: 600;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.token-string {
|
|
355
|
+
color: var(--md-code-token-string, #198754);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.token-comment {
|
|
359
|
+
color: var(--md-code-token-comment, var(--md-sys-color-outline, #79747e));
|
|
360
|
+
font-style: italic;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.token-function {
|
|
364
|
+
color: var(--md-code-token-function, var(--md-sys-color-tertiary, #7d5260));
|
|
365
|
+
font-weight: 500;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.token-number {
|
|
369
|
+
color: var(--md-code-token-number, #b35900);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.token-boolean {
|
|
373
|
+
color: var(--md-code-token-boolean, #d9381e);
|
|
374
|
+
font-weight: 600;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.token-constant {
|
|
378
|
+
color: var(--md-code-token-constant, #b3261e);
|
|
379
|
+
font-weight: 600;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.token-tag {
|
|
383
|
+
color: var(--md-code-token-tag, var(--md-sys-color-primary, #6750a4));
|
|
384
|
+
font-weight: 600;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.token-attr-name {
|
|
388
|
+
color: var(--md-code-token-attr-name, var(--md-sys-color-secondary, #625b71));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.token-property {
|
|
392
|
+
color: var(--md-code-token-property, var(--md-sys-color-primary, #6750a4));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.token-type {
|
|
396
|
+
color: var(--md-code-token-type, #00838f);
|
|
397
|
+
font-weight: 500;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.token-variable {
|
|
401
|
+
color: var(--md-code-token-variable, #e65100);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.token-operator {
|
|
405
|
+
color: var(--md-code-token-operator, var(--md-sys-color-on-surface-variant, #49454f));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.token-punctuation {
|
|
409
|
+
color: var(--md-code-token-punctuation, var(--md-sys-color-outline, #79747e));
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/* Dark Theme Adjustments */
|
|
413
|
+
:host-context([data-theme='dark']) .token-string,
|
|
414
|
+
:host([data-theme='dark']) .token-string {
|
|
415
|
+
color: #4ade80;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
:host-context([data-theme='dark']) .token-number,
|
|
419
|
+
:host([data-theme='dark']) .token-number {
|
|
420
|
+
color: #fb923c;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
:host-context([data-theme='dark']) .token-type,
|
|
424
|
+
:host([data-theme='dark']) .token-type {
|
|
425
|
+
color: #38bdf8;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
:host-context([data-theme='dark']) .token-boolean,
|
|
429
|
+
:host([data-theme='dark']) .token-boolean {
|
|
430
|
+
color: #f87171;
|
|
431
|
+
}
|
|
432
|
+
`;
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/components/code/highlighter.ts
|
|
435
|
+
function u(e) {
|
|
436
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
437
|
+
}
|
|
438
|
+
function d(e, t) {
|
|
439
|
+
return `<span class="token-${e}">${t}</span>`;
|
|
440
|
+
}
|
|
441
|
+
function f(e) {
|
|
442
|
+
let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "abstract.any.as.async.await.boolean.break.case.catch.class.const.constructor.continue.debugger.declare.default.delete.do.else.enum.export.extends.false.finally.for.from.function.get.if.implements.import.in.infer.instanceof.interface.is.keyof.let.module.namespace.never.new.null.number.of.override.package.private.protected.public.readonly.require.return.set.static.string.super.switch.symbol.this.throw.true.try.type.typeof.undefined.unique.unknown.var.void.while.with.yield".split(".")), n = "", r = 0, i = e.length;
|
|
443
|
+
for (; r < i;) {
|
|
444
|
+
if (e[r] === "/" && e[r + 1] === "/") {
|
|
445
|
+
let t = e.indexOf("\n", r);
|
|
446
|
+
t === -1 && (t = i), n += d("comment", u(e.slice(r, t))), r = t;
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
if (e[r] === "/" && e[r + 1] === "*") {
|
|
450
|
+
let t = e.indexOf("*/", r + 2);
|
|
451
|
+
t === -1 ? t = i : t += 2, n += d("comment", u(e.slice(r, t))), r = t;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (e[r] === "`") {
|
|
455
|
+
let t = r + 1;
|
|
456
|
+
for (; t < i && e[t] !== "`";) e[t] === "\\" && t++, t++;
|
|
457
|
+
t < i && t++, n += d("string", u(e.slice(r, t))), r = t;
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
if (e[r] === "\"" || e[r] === "'") {
|
|
461
|
+
let t = e[r], a = r + 1;
|
|
462
|
+
for (; a < i && e[a] !== t && e[a] !== "\n";) e[a] === "\\" && a++, a++;
|
|
463
|
+
a < i && e[a] === t && a++, n += d("string", u(e.slice(r, a))), r = a;
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (/[0-9]/.test(e[r]) || e[r] === "." && /[0-9]/.test(e[r + 1] || "")) {
|
|
467
|
+
let t = r;
|
|
468
|
+
for (; t < i && /[0-9a-fA-FxXbBoOeE_.]/.test(e[t]);) t++;
|
|
469
|
+
n += d("number", u(e.slice(r, t))), r = t;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (/[a-zA-Z_$]/.test(e[r])) {
|
|
473
|
+
let a = r;
|
|
474
|
+
for (; a < i && /[a-zA-Z0-9_$]/.test(e[a]);) a++;
|
|
475
|
+
let o = e.slice(r, a), s = a;
|
|
476
|
+
for (; s < i && /\s/.test(e[s]);) s++;
|
|
477
|
+
let c = e[s] === "(";
|
|
478
|
+
o === "true" || o === "false" ? n += d("boolean", u(o)) : o === "null" || o === "undefined" ? n += d("constant", u(o)) : t.has(o) ? n += d("keyword", u(o)) : /^[A-Z][a-zA-Z0-9_$]*$/.test(o) && !c ? n += d("type", u(o)) : n += c ? d("function", u(o)) : u(o), r = a;
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
if (/[+\-*/%=&|<>!^~?:.]/.test(e[r])) {
|
|
482
|
+
let t = r;
|
|
483
|
+
for (; t < i && /[+\-*/%=&|<>!^~?:.]/.test(e[t]);) t++;
|
|
484
|
+
n += d("operator", u(e.slice(r, t))), r = t;
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
if (/[{}()[\];,]/.test(e[r])) {
|
|
488
|
+
n += d("punctuation", u(e[r])), r++;
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
n += u(e[r]), r++;
|
|
492
|
+
}
|
|
493
|
+
return n;
|
|
494
|
+
}
|
|
495
|
+
function p(e) {
|
|
496
|
+
let t = "", n = 0, r = e.length;
|
|
497
|
+
for (; n < r;) {
|
|
498
|
+
if (e.slice(n, n + 4) === "<!--") {
|
|
499
|
+
let i = e.indexOf("-->", n + 4);
|
|
500
|
+
i === -1 ? i = r : i += 3, t += d("comment", u(e.slice(n, i))), n = i;
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
if (e[n] === "<") {
|
|
504
|
+
let i = e.indexOf(">", n);
|
|
505
|
+
i === -1 ? i = r : i += 1;
|
|
506
|
+
let a = e.slice(n, i), o = a.match(/^<\/?([a-zA-Z0-9\-:]+)/);
|
|
507
|
+
if (o && o[1]) {
|
|
508
|
+
let e = d("punctuation", u(a.startsWith("</") ? "</" : "<"));
|
|
509
|
+
e += d("tag", u(o[1]));
|
|
510
|
+
let n = a.slice(o[0].length), r = /([a-zA-Z0-9\-:@?]+)(\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/g, i = 0, s;
|
|
511
|
+
for (; (s = r.exec(n)) !== null;) {
|
|
512
|
+
s[0];
|
|
513
|
+
let t = s[1], a = s[2];
|
|
514
|
+
if (e += u(n.slice(i, s.index)), e += d("attr-name", u(t)), a) {
|
|
515
|
+
let t = a.indexOf("=");
|
|
516
|
+
e += d("operator", "=");
|
|
517
|
+
let n = a.slice(t + 1).trim();
|
|
518
|
+
e += d("string", u(n));
|
|
519
|
+
}
|
|
520
|
+
i = r.lastIndex;
|
|
521
|
+
}
|
|
522
|
+
let c = n.slice(i);
|
|
523
|
+
c.endsWith("/>") ? e += u(c.slice(0, -2)) + d("punctuation", "/>") : c.endsWith(">") ? e += u(c.slice(0, -1)) + d("punctuation", ">") : e += u(c), t += e;
|
|
524
|
+
} else t += u(a);
|
|
525
|
+
n = i;
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
t += u(e[n]), n++;
|
|
529
|
+
}
|
|
530
|
+
return t;
|
|
531
|
+
}
|
|
532
|
+
function m(e) {
|
|
533
|
+
let t = "", n = 0, r = e.length, i = !1;
|
|
534
|
+
for (; n < r;) {
|
|
535
|
+
if (e[n] === "/" && e[n + 1] === "*") {
|
|
536
|
+
let i = e.indexOf("*/", n + 2);
|
|
537
|
+
i === -1 ? i = r : i += 2, t += d("comment", u(e.slice(n, i))), n = i;
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
if (e[n] === "\"" || e[n] === "'") {
|
|
541
|
+
let i = e[n], a = n + 1;
|
|
542
|
+
for (; a < r && e[a] !== i && e[a] !== "\n";) a++;
|
|
543
|
+
a < r && e[a] === i && a++, t += d("string", u(e.slice(n, a))), n = a;
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
if (e[n] === "{") {
|
|
547
|
+
i = !0, t += d("punctuation", "{"), n++;
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
if (e[n] === "}") {
|
|
551
|
+
i = !1, t += d("punctuation", "}"), n++;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (i && /[a-zA-Z-]/.test(e[n])) {
|
|
555
|
+
let i = n;
|
|
556
|
+
for (; i < r && /[a-zA-Z0-9_-]/.test(e[i]);) i++;
|
|
557
|
+
let a = e.slice(n, i), o = i;
|
|
558
|
+
for (; o < r && /\s/.test(e[o]);) o++;
|
|
559
|
+
if (e[o] === ":") {
|
|
560
|
+
t += d("property", u(a)), t += u(e.slice(i, o)), t += d("punctuation", ":"), n = o + 1;
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (/[0-9]/.test(e[n])) {
|
|
565
|
+
let i = n;
|
|
566
|
+
for (; i < r && /[0-9a-zA-Z%.]/.test(e[i]);) i++;
|
|
567
|
+
t += d("number", u(e.slice(n, i))), n = i;
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
if (e[n] === "#" && /[0-9a-fA-F]/.test(e[n + 1] || "")) {
|
|
571
|
+
let i = n + 1;
|
|
572
|
+
for (; i < r && /[0-9a-fA-F]/.test(e[i]);) i++;
|
|
573
|
+
t += d("number", u(e.slice(n, i))), n = i;
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
if (/[;:(),]/.test(e[n])) {
|
|
577
|
+
t += d("punctuation", u(e[n])), n++;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
t += u(e[n]), n++;
|
|
581
|
+
}
|
|
582
|
+
return t;
|
|
583
|
+
}
|
|
584
|
+
function h(e) {
|
|
585
|
+
let t = "", n = 0, r = e.length;
|
|
586
|
+
for (; n < r;) {
|
|
587
|
+
if (e[n] === "\"") {
|
|
588
|
+
let i = n + 1;
|
|
589
|
+
for (; i < r && e[i] !== "\"";) e[i] === "\\" && i++, i++;
|
|
590
|
+
i < r && i++;
|
|
591
|
+
let a = e.slice(n, i), o = i;
|
|
592
|
+
for (; o < r && /\s/.test(e[o]);) o++;
|
|
593
|
+
e[o] === ":" ? t += d("property", u(a)) : t += d("string", u(a)), n = i;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (/[0-9-]/.test(e[n])) {
|
|
597
|
+
let i = n;
|
|
598
|
+
for (; i < r && /[0-9.eE+-]/.test(e[i]);) i++;
|
|
599
|
+
t += d("number", u(e.slice(n, i))), n = i;
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
if (/[a-zA-Z]/.test(e[n])) {
|
|
603
|
+
let i = n;
|
|
604
|
+
for (; i < r && /[a-zA-Z]/.test(e[i]);) i++;
|
|
605
|
+
let a = e.slice(n, i);
|
|
606
|
+
t += a === "true" || a === "false" ? d("boolean", u(a)) : a === "null" ? d("constant", u(a)) : u(a), n = i;
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
if (/[{}[\]:,]/.test(e[n])) {
|
|
610
|
+
t += d("punctuation", u(e[n])), n++;
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
t += u(e[n]), n++;
|
|
614
|
+
}
|
|
615
|
+
return t;
|
|
616
|
+
}
|
|
617
|
+
function g(e) {
|
|
618
|
+
let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "and.as.assert.async.await.break.class.continue.def.del.elif.else.except.False.finally.for.from.global.if.import.in.is.lambda.None.nonlocal.not.or.pass.raise.return.True.try.while.with.yield.self".split(".")), n = "", r = 0, i = e.length;
|
|
619
|
+
for (; r < i;) {
|
|
620
|
+
if (e[r] === "#") {
|
|
621
|
+
let t = e.indexOf("\n", r);
|
|
622
|
+
t === -1 && (t = i), n += d("comment", u(e.slice(r, t))), r = t;
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (e.slice(r, r + 3) === "\"\"\"" || e.slice(r, r + 3) === "'''") {
|
|
626
|
+
let t = e.slice(r, r + 3), a = e.indexOf(t, r + 3);
|
|
627
|
+
a === -1 ? a = i : a += 3, n += d("string", u(e.slice(r, a))), r = a;
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
if (e[r] === "\"" || e[r] === "'") {
|
|
631
|
+
let t = e[r], a = r + 1;
|
|
632
|
+
for (; a < i && e[a] !== t && e[a] !== "\n";) e[a] === "\\" && a++, a++;
|
|
633
|
+
a < i && e[a] === t && a++, n += d("string", u(e.slice(r, a))), r = a;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
if (/[0-9]/.test(e[r])) {
|
|
637
|
+
let t = r;
|
|
638
|
+
for (; t < i && /[0-9a-fA-FxXbBoOeE_.]/.test(e[t]);) t++;
|
|
639
|
+
n += d("number", u(e.slice(r, t))), r = t;
|
|
640
|
+
continue;
|
|
641
|
+
}
|
|
642
|
+
if (/[a-zA-Z_]/.test(e[r])) {
|
|
643
|
+
let a = r;
|
|
644
|
+
for (; a < i && /[a-zA-Z0-9_]/.test(e[a]);) a++;
|
|
645
|
+
let o = e.slice(r, a), s = a;
|
|
646
|
+
for (; s < i && /\s/.test(e[s]);) s++;
|
|
647
|
+
let c = e[s] === "(";
|
|
648
|
+
o === "True" || o === "False" ? n += d("boolean", u(o)) : o === "None" ? n += d("constant", u(o)) : t.has(o) ? n += d("keyword", u(o)) : c ? n += d("function", u(o)) : /^[A-Z][a-zA-Z0-9_]*$/.test(o) ? n += d("type", u(o)) : n += u(o), r = a;
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
if (/[+\-*/%=&|<>!^~@:]/.test(e[r])) {
|
|
652
|
+
n += d("operator", u(e[r])), r++;
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
if (/[{}()[\];,.]/.test(e[r])) {
|
|
656
|
+
n += d("punctuation", u(e[r])), r++;
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
n += u(e[r]), r++;
|
|
660
|
+
}
|
|
661
|
+
return n;
|
|
662
|
+
}
|
|
663
|
+
function _(e) {
|
|
664
|
+
let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "case.do.done.elif.else.esac.export.fi.for.function.if.in.return.select.then.time.until.while.sudo.echo.cd.mkdir.rm.cp.mv.npm.npx.node.git.yarn.pnpm".split(".")), n = "", r = 0, i = e.length;
|
|
665
|
+
for (; r < i;) {
|
|
666
|
+
if (e[r] === "#") {
|
|
667
|
+
let t = e.indexOf("\n", r);
|
|
668
|
+
t === -1 && (t = i), n += d("comment", u(e.slice(r, t))), r = t;
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (e[r] === "\"" || e[r] === "'") {
|
|
672
|
+
let t = e[r], a = r + 1;
|
|
673
|
+
for (; a < i && e[a] !== t && e[a] !== "\n";) e[a] === "\\" && a++, a++;
|
|
674
|
+
a < i && e[a] === t && a++, n += d("string", u(e.slice(r, a))), r = a;
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
if (e[r] === "$") {
|
|
678
|
+
let t = r + 1;
|
|
679
|
+
if (e[t] === "{") t = e.indexOf("}", t), t === -1 ? t = i : t += 1;
|
|
680
|
+
else if (e[t] === "(") t = e.indexOf(")", t), t === -1 ? t = i : t += 1;
|
|
681
|
+
else for (; t < i && /[a-zA-Z0-9_]/.test(e[t]);) t++;
|
|
682
|
+
n += d("variable", u(e.slice(r, t))), r = t;
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (e[r] === "-" && /[a-zA-Z-]/.test(e[r + 1] || "")) {
|
|
686
|
+
let t = r + 1;
|
|
687
|
+
for (; t < i && /[a-zA-Z0-9_-]/.test(e[t]);) t++;
|
|
688
|
+
n += d("attr-name", u(e.slice(r, t))), r = t;
|
|
689
|
+
continue;
|
|
690
|
+
}
|
|
691
|
+
if (/[a-zA-Z0-9_]/.test(e[r])) {
|
|
692
|
+
let a = r;
|
|
693
|
+
for (; a < i && /[a-zA-Z0-9_\-./]/.test(e[a]);) a++;
|
|
694
|
+
let o = e.slice(r, a);
|
|
695
|
+
t.has(o) ? n += d("keyword", u(o)) : n += u(o), r = a;
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
if (/[|&><=;]/.test(e[r])) {
|
|
699
|
+
n += d("operator", u(e[r])), r++;
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
702
|
+
n += u(e[r]), r++;
|
|
703
|
+
}
|
|
704
|
+
return n;
|
|
705
|
+
}
|
|
706
|
+
function v(e) {
|
|
707
|
+
let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "SELECT.FROM.WHERE.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.DROP.ALTER.JOIN.LEFT.RIGHT.INNER.OUTER.FULL.ON.GROUP.BY.ORDER.HAVING.LIMIT.OFFSET.UNION.ALL.AS.DISTINCT.COUNT.SUM.AVG.MIN.MAX.AND.OR.NOT.IN.IS.NULL.LIKE.BETWEEN.EXISTS.CASE.WHEN.THEN.ELSE.END.PRIMARY.KEY.FOREIGN.REFERENCES.INDEX.DEFAULT.CHECK.CONSTRAINT".split(".")), n = "", r = 0, i = e.length;
|
|
708
|
+
for (; r < i;) {
|
|
709
|
+
if (e[r] === "-" && e[r + 1] === "-") {
|
|
710
|
+
let t = e.indexOf("\n", r);
|
|
711
|
+
t === -1 && (t = i), n += d("comment", u(e.slice(r, t))), r = t;
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
if (e[r] === "'" || e[r] === "\"") {
|
|
715
|
+
let t = e[r], a = r + 1;
|
|
716
|
+
for (; a < i && e[a] !== t && e[a] !== "\n";) a++;
|
|
717
|
+
a < i && e[a] === t && a++, n += d("string", u(e.slice(r, a))), r = a;
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
if (/[a-zA-Z_]/.test(e[r])) {
|
|
721
|
+
let a = r;
|
|
722
|
+
for (; a < i && /[a-zA-Z0-9_]/.test(e[a]);) a++;
|
|
723
|
+
let o = e.slice(r, a);
|
|
724
|
+
t.has(o.toUpperCase()) ? n += d("keyword", u(o)) : n += u(o), r = a;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
if (/[0-9]/.test(e[r])) {
|
|
728
|
+
let t = r;
|
|
729
|
+
for (; t < i && /[0-9.]/.test(e[t]);) t++;
|
|
730
|
+
n += d("number", u(e.slice(r, t))), r = t;
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
if (/[=<>!+*/-]/.test(e[r])) {
|
|
734
|
+
n += d("operator", u(e[r])), r++;
|
|
735
|
+
continue;
|
|
736
|
+
}
|
|
737
|
+
if (/[(),;]/.test(e[r])) {
|
|
738
|
+
n += d("punctuation", u(e[r])), r++;
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
n += u(e[r]), r++;
|
|
742
|
+
}
|
|
743
|
+
return n;
|
|
744
|
+
}
|
|
745
|
+
function y(e, t) {
|
|
746
|
+
if (!e) return "";
|
|
747
|
+
switch ((t || "").toLowerCase().trim()) {
|
|
748
|
+
case "javascript":
|
|
749
|
+
case "js":
|
|
750
|
+
case "typescript":
|
|
751
|
+
case "ts":
|
|
752
|
+
case "jsx":
|
|
753
|
+
case "tsx": return f(e);
|
|
754
|
+
case "html":
|
|
755
|
+
case "xml":
|
|
756
|
+
case "svg": return p(e);
|
|
757
|
+
case "css":
|
|
758
|
+
case "scss":
|
|
759
|
+
case "less": return m(e);
|
|
760
|
+
case "json": return h(e);
|
|
761
|
+
case "python":
|
|
762
|
+
case "py": return g(e);
|
|
763
|
+
case "bash":
|
|
764
|
+
case "sh":
|
|
765
|
+
case "shell":
|
|
766
|
+
case "zsh": return _(e);
|
|
767
|
+
case "sql": return v(e);
|
|
768
|
+
default: return u(e);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
//#endregion
|
|
772
|
+
//#region src/components/code/linter.ts
|
|
773
|
+
function b(e) {
|
|
774
|
+
let t = [];
|
|
775
|
+
if (!e.trim()) return t;
|
|
776
|
+
try {
|
|
777
|
+
return JSON.parse(e), t;
|
|
778
|
+
} catch (n) {
|
|
779
|
+
let r = n instanceof Error ? n.message : String(n), i = 1, a = 1, o = r.match(/at position (\d+)/i), s = r.match(/line (\d+) column (\d+)/i);
|
|
780
|
+
if (s && s[1] && s[2]) i = parseInt(s[1], 10), a = parseInt(s[2], 10);
|
|
781
|
+
else if (o && o[1]) {
|
|
782
|
+
let t = parseInt(o[1], 10), n = e.slice(0, t).split("\n");
|
|
783
|
+
i = n.length, a = (n[n.length - 1]?.length || 0) + 1;
|
|
784
|
+
} else {
|
|
785
|
+
let n = e.split("\n"), r = !1;
|
|
786
|
+
for (let e = 0; e < n.length; e++) {
|
|
787
|
+
let i = n[e];
|
|
788
|
+
if (/'[^']*'/.test(i)) {
|
|
789
|
+
t.push({
|
|
790
|
+
line: e + 1,
|
|
791
|
+
column: i.indexOf("'") + 1,
|
|
792
|
+
message: "JSON strings must use double quotes, not single quotes",
|
|
793
|
+
severity: "error",
|
|
794
|
+
rule: "json-no-single-quotes"
|
|
795
|
+
}), r = !0;
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
if (/,\s*([}\]])/.test(i)) {
|
|
799
|
+
t.push({
|
|
800
|
+
line: e + 1,
|
|
801
|
+
column: i.search(/,\s*([}\]])/) + 1,
|
|
802
|
+
message: "Trailing comma is not allowed in standard JSON",
|
|
803
|
+
severity: "error",
|
|
804
|
+
rule: "json-no-trailing-comma"
|
|
805
|
+
}), r = !0;
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
if (/\/\//.test(i) || /\/\*/.test(i)) {
|
|
809
|
+
t.push({
|
|
810
|
+
line: e + 1,
|
|
811
|
+
column: i.search(/\/\/|\/\*/) + 1,
|
|
812
|
+
message: "Comments are not permitted in standard JSON",
|
|
813
|
+
severity: "warning",
|
|
814
|
+
rule: "json-no-comments"
|
|
815
|
+
}), r = !0;
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
let a = i.match(/([{,]\s*)([a-zA-Z0-9_$]+)\s*:/);
|
|
819
|
+
if (a && a[1] && a[2]) {
|
|
820
|
+
t.push({
|
|
821
|
+
line: e + 1,
|
|
822
|
+
column: i.indexOf(a[2]) + 1,
|
|
823
|
+
message: `Key "${a[2]}" must be enclosed in double quotes`,
|
|
824
|
+
severity: "error",
|
|
825
|
+
rule: "json-unquoted-key"
|
|
826
|
+
}), r = !0;
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
if (r) return t;
|
|
831
|
+
}
|
|
832
|
+
let c = r.replace(/^JSON\.parse:\s*/i, "").replace(/in JSON at position \d+/i, "").trim();
|
|
833
|
+
c ||= "Invalid JSON syntax", t.push({
|
|
834
|
+
line: i,
|
|
835
|
+
column: a,
|
|
836
|
+
message: c,
|
|
837
|
+
severity: "error",
|
|
838
|
+
rule: "json-syntax-error"
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
return t;
|
|
842
|
+
}
|
|
843
|
+
function x(e) {
|
|
844
|
+
let t = [], n = e.split("\n"), r = [], i = {
|
|
845
|
+
"}": "{",
|
|
846
|
+
")": "(",
|
|
847
|
+
"]": "["
|
|
848
|
+
}, a = !1, o = !1;
|
|
849
|
+
for (let e = 0; e < n.length; e++) {
|
|
850
|
+
let s = e + 1, c = n[e], l = null, u = !1;
|
|
851
|
+
for (let e = 0; e < c.length; e++) {
|
|
852
|
+
let n = c[e], d = c[e + 1] || "";
|
|
853
|
+
if (a) {
|
|
854
|
+
n === "*" && d === "/" && (a = !1, e++);
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
if (o) {
|
|
858
|
+
if (n === "\\") {
|
|
859
|
+
e++;
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
n === "`" && (o = !1);
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
if (l) {
|
|
866
|
+
u ? u = !1 : n === "\\" ? u = !0 : n === l && (l = null);
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if (n === "/" && d === "/") break;
|
|
870
|
+
if (n === "/" && d === "*") {
|
|
871
|
+
a = !0, e++;
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
if (n === "`") {
|
|
875
|
+
o = !0;
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
if (n === "\"" || n === "'") {
|
|
879
|
+
l = n;
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
if (n === "{" || n === "(" || n === "[") r.push({
|
|
883
|
+
char: n,
|
|
884
|
+
line: s,
|
|
885
|
+
col: e + 1
|
|
886
|
+
});
|
|
887
|
+
else if (n === "}" || n === ")" || n === "]") {
|
|
888
|
+
let a = i[n];
|
|
889
|
+
if (r.length === 0) t.push({
|
|
890
|
+
line: s,
|
|
891
|
+
column: e + 1,
|
|
892
|
+
message: `Unexpected closing '${n}' with no matching opening bracket`,
|
|
893
|
+
severity: "error",
|
|
894
|
+
rule: "js-unmatched-bracket"
|
|
895
|
+
});
|
|
896
|
+
else {
|
|
897
|
+
let i = r.pop();
|
|
898
|
+
i.char !== a && t.push({
|
|
899
|
+
line: s,
|
|
900
|
+
column: e + 1,
|
|
901
|
+
message: `Mismatched closing '${n}', expected matching '${i.char === "{" ? "}" : i.char === "(" ? ")" : "]"}' for '${i.char}' from line ${i.line}`,
|
|
902
|
+
severity: "error",
|
|
903
|
+
rule: "js-mismatched-bracket"
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
l && t.push({
|
|
909
|
+
line: s,
|
|
910
|
+
column: c.lastIndexOf(l) + 1,
|
|
911
|
+
message: `Unclosed string literal starting with ${l}`,
|
|
912
|
+
severity: "error",
|
|
913
|
+
rule: "js-unclosed-string"
|
|
914
|
+
}), /====+/.test(c) && t.push({
|
|
915
|
+
line: s,
|
|
916
|
+
column: c.indexOf("====") + 1,
|
|
917
|
+
message: "Invalid equality operator: \"====\"",
|
|
918
|
+
severity: "error",
|
|
919
|
+
rule: "js-invalid-operator"
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
for (a && t.push({
|
|
923
|
+
line: n.length,
|
|
924
|
+
column: 1,
|
|
925
|
+
message: "Unclosed multi-line comment \"/*\"",
|
|
926
|
+
severity: "error",
|
|
927
|
+
rule: "js-unclosed-comment"
|
|
928
|
+
}), o && t.push({
|
|
929
|
+
line: n.length,
|
|
930
|
+
column: 1,
|
|
931
|
+
message: "Unclosed template literal (`...`)",
|
|
932
|
+
severity: "error",
|
|
933
|
+
rule: "js-unclosed-template"
|
|
934
|
+
}); r.length > 0;) {
|
|
935
|
+
let e = r.pop();
|
|
936
|
+
t.push({
|
|
937
|
+
line: e.line,
|
|
938
|
+
column: e.col,
|
|
939
|
+
message: `Unclosed opening bracket '${e.char}'`,
|
|
940
|
+
severity: "error",
|
|
941
|
+
rule: "js-unclosed-bracket"
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
return t;
|
|
945
|
+
}
|
|
946
|
+
function S(e) {
|
|
947
|
+
let t = [], n = e.split("\n"), r = /* @__PURE__ */ new Set([
|
|
948
|
+
"area",
|
|
949
|
+
"base",
|
|
950
|
+
"br",
|
|
951
|
+
"col",
|
|
952
|
+
"embed",
|
|
953
|
+
"hr",
|
|
954
|
+
"img",
|
|
955
|
+
"input",
|
|
956
|
+
"link",
|
|
957
|
+
"meta",
|
|
958
|
+
"param",
|
|
959
|
+
"source",
|
|
960
|
+
"track",
|
|
961
|
+
"wbr",
|
|
962
|
+
"!doctype"
|
|
963
|
+
]), i = [], a = /<\/?([a-zA-Z0-9\-:]+)(\s+[^>]*?)?(\/?)>/g;
|
|
964
|
+
for (let e = 0; e < n.length; e++) {
|
|
965
|
+
let o = e + 1, s = n[e], c;
|
|
966
|
+
for (a.lastIndex = 0; (c = a.exec(s)) !== null;) {
|
|
967
|
+
let e = c[0], n = (c[1] || "").toLowerCase(), a = e.startsWith("</"), s = e.endsWith("/>") || r.has(n), l = c.index + 1;
|
|
968
|
+
if (!(n.startsWith("!--") || n.startsWith("!doctype"))) {
|
|
969
|
+
if (a) {
|
|
970
|
+
if (i.length === 0) t.push({
|
|
971
|
+
line: o,
|
|
972
|
+
column: l,
|
|
973
|
+
message: `Unexpected closing tag </${n}> without matching opening tag`,
|
|
974
|
+
severity: "error",
|
|
975
|
+
rule: "html-unmatched-closing-tag"
|
|
976
|
+
});
|
|
977
|
+
else {
|
|
978
|
+
let e = i.pop();
|
|
979
|
+
e.name !== n && t.push({
|
|
980
|
+
line: o,
|
|
981
|
+
column: l,
|
|
982
|
+
message: `Mismatched closing tag </${n}>, expected </${e.name}> (opened on line ${e.line})`,
|
|
983
|
+
severity: "error",
|
|
984
|
+
rule: "html-mismatched-tag"
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
} else s || i.push({
|
|
988
|
+
name: n,
|
|
989
|
+
line: o,
|
|
990
|
+
col: l
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
for (; i.length > 0;) {
|
|
996
|
+
let e = i.pop();
|
|
997
|
+
t.push({
|
|
998
|
+
line: e.line,
|
|
999
|
+
column: e.col,
|
|
1000
|
+
message: `Unclosed tag <${e.name}>`,
|
|
1001
|
+
severity: "error",
|
|
1002
|
+
rule: "html-unclosed-tag"
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
return t;
|
|
1006
|
+
}
|
|
1007
|
+
function C(e) {
|
|
1008
|
+
let t = [], n = e.split("\n"), r = 0, i = [];
|
|
1009
|
+
for (let e = 0; e < n.length; e++) {
|
|
1010
|
+
let a = e + 1, o = n[e], s = o.trim();
|
|
1011
|
+
if (!(!s || s.startsWith("/*") || s.startsWith("//"))) {
|
|
1012
|
+
for (let e = 0; e < o.length; e++) o[e] === "{" ? (r++, i.push({
|
|
1013
|
+
line: a,
|
|
1014
|
+
col: e + 1
|
|
1015
|
+
})) : o[e] === "}" && (r === 0 ? t.push({
|
|
1016
|
+
line: a,
|
|
1017
|
+
column: e + 1,
|
|
1018
|
+
message: "Unexpected closing brace \"}\" without opening \"{\"",
|
|
1019
|
+
severity: "error",
|
|
1020
|
+
rule: "css-unmatched-brace"
|
|
1021
|
+
}) : (r--, i.pop()));
|
|
1022
|
+
if (r > 0 && s !== "{" && s !== "}" && !s.endsWith("{") && !s.endsWith("}") && (!s.includes(":") && !s.startsWith("@") && !s.endsWith(",") && t.push({
|
|
1023
|
+
line: a,
|
|
1024
|
+
column: 1,
|
|
1025
|
+
message: `Declaration "${s}" is missing a colon ":" between property and value`,
|
|
1026
|
+
severity: "warning",
|
|
1027
|
+
rule: "css-missing-colon"
|
|
1028
|
+
}), s.includes(":") && !s.endsWith(";") && !s.endsWith("{") && !s.endsWith("}"))) {
|
|
1029
|
+
let r = n[e + 1]?.trim() || "";
|
|
1030
|
+
r && !r.startsWith("}") && t.push({
|
|
1031
|
+
line: a,
|
|
1032
|
+
column: o.length,
|
|
1033
|
+
message: "Missing semicolon \";\" at the end of CSS declaration",
|
|
1034
|
+
severity: "warning",
|
|
1035
|
+
rule: "css-missing-semicolon"
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
for (; i.length > 0;) {
|
|
1041
|
+
let e = i.pop();
|
|
1042
|
+
t.push({
|
|
1043
|
+
line: e.line,
|
|
1044
|
+
column: e.col,
|
|
1045
|
+
message: "Unclosed CSS block \"{\"",
|
|
1046
|
+
severity: "error",
|
|
1047
|
+
rule: "css-unclosed-brace"
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
return t;
|
|
1051
|
+
}
|
|
1052
|
+
function w(e) {
|
|
1053
|
+
let t = [], n = e.split("\n"), r = !1, i = !1, a = [], o = {
|
|
1054
|
+
")": "(",
|
|
1055
|
+
"]": "[",
|
|
1056
|
+
"}": "{"
|
|
1057
|
+
}, s = /^\s*(def\s+.*|class\s+.*|if\s+.*|elif\s+.*|else|for\s+.*|while\s+.*|try|except(\s+.*)?|finally|with\s+.*)$/;
|
|
1058
|
+
for (let e = 0; e < n.length; e++) {
|
|
1059
|
+
let c = e + 1, l = n[e], u = l.trim();
|
|
1060
|
+
if (!u || u.startsWith("#")) continue;
|
|
1061
|
+
let d = l.match(/^([ \t]+)/);
|
|
1062
|
+
if (d && d[1]) {
|
|
1063
|
+
let e = d[1];
|
|
1064
|
+
e.includes(" ") && (r = !0), e.includes(" ") && (i = !0), r && i && t.push({
|
|
1065
|
+
line: c,
|
|
1066
|
+
column: 1,
|
|
1067
|
+
message: "Inconsistent indentation: mixed tabs and spaces",
|
|
1068
|
+
severity: "warning",
|
|
1069
|
+
rule: "python-mixed-indentation"
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
s.test(u) && !u.endsWith(":") && !u.includes("#") && t.push({
|
|
1073
|
+
line: c,
|
|
1074
|
+
column: l.length,
|
|
1075
|
+
message: "Expected \":\" at the end of statement header",
|
|
1076
|
+
severity: "error",
|
|
1077
|
+
rule: "python-missing-colon"
|
|
1078
|
+
});
|
|
1079
|
+
let f = null;
|
|
1080
|
+
for (let e = 0; e < l.length; e++) {
|
|
1081
|
+
let n = l[e];
|
|
1082
|
+
if (n === "#") break;
|
|
1083
|
+
if (f) {
|
|
1084
|
+
n === f && l[e - 1] !== "\\" && (f = null);
|
|
1085
|
+
continue;
|
|
1086
|
+
}
|
|
1087
|
+
if (n === "\"" || n === "'") {
|
|
1088
|
+
f = n;
|
|
1089
|
+
continue;
|
|
1090
|
+
}
|
|
1091
|
+
if (n === "(" || n === "[" || n === "{") a.push({
|
|
1092
|
+
char: n,
|
|
1093
|
+
line: c,
|
|
1094
|
+
col: e + 1
|
|
1095
|
+
});
|
|
1096
|
+
else if (n === ")" || n === "]" || n === "}") {
|
|
1097
|
+
let r = o[n];
|
|
1098
|
+
if (a.length === 0) t.push({
|
|
1099
|
+
line: c,
|
|
1100
|
+
column: e + 1,
|
|
1101
|
+
message: `Unmatched closing '${n}'`,
|
|
1102
|
+
severity: "error",
|
|
1103
|
+
rule: "python-unmatched-bracket"
|
|
1104
|
+
});
|
|
1105
|
+
else {
|
|
1106
|
+
let i = a.pop();
|
|
1107
|
+
i.char !== r && t.push({
|
|
1108
|
+
line: c,
|
|
1109
|
+
column: e + 1,
|
|
1110
|
+
message: `Mismatched bracket '${n}', expected closing for '${i.char}' from line ${i.line}`,
|
|
1111
|
+
severity: "error",
|
|
1112
|
+
rule: "python-mismatched-bracket"
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
for (; a.length > 0;) {
|
|
1119
|
+
let e = a.pop();
|
|
1120
|
+
t.push({
|
|
1121
|
+
line: e.line,
|
|
1122
|
+
column: e.col,
|
|
1123
|
+
message: `Unclosed '${e.char}'`,
|
|
1124
|
+
severity: "error",
|
|
1125
|
+
rule: "python-unclosed-bracket"
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
return t;
|
|
1129
|
+
}
|
|
1130
|
+
function T(e) {
|
|
1131
|
+
let t = [], n = e.split("\n"), r = [];
|
|
1132
|
+
for (let e = 0; e < n.length; e++) {
|
|
1133
|
+
let i = e + 1, a = n[e], o = a.trim();
|
|
1134
|
+
if (!o || o.startsWith("#")) continue;
|
|
1135
|
+
let s = o.split(/\s+/);
|
|
1136
|
+
for (let e of s) if (e === "if") r.push({
|
|
1137
|
+
keyword: "if",
|
|
1138
|
+
line: i
|
|
1139
|
+
});
|
|
1140
|
+
else if (e === "fi") {
|
|
1141
|
+
let e = r.pop();
|
|
1142
|
+
(!e || e.keyword !== "if") && t.push({
|
|
1143
|
+
line: i,
|
|
1144
|
+
column: a.indexOf("fi") + 1,
|
|
1145
|
+
message: "Unexpected \"fi\" with no preceding \"if\"",
|
|
1146
|
+
severity: "error",
|
|
1147
|
+
rule: "bash-unmatched-fi"
|
|
1148
|
+
});
|
|
1149
|
+
} else if (e === "case") r.push({
|
|
1150
|
+
keyword: "case",
|
|
1151
|
+
line: i
|
|
1152
|
+
});
|
|
1153
|
+
else if (e === "esac") {
|
|
1154
|
+
let e = r.pop();
|
|
1155
|
+
(!e || e.keyword !== "case") && t.push({
|
|
1156
|
+
line: i,
|
|
1157
|
+
column: a.indexOf("esac") + 1,
|
|
1158
|
+
message: "Unexpected \"esac\" with no preceding \"case\"",
|
|
1159
|
+
severity: "error",
|
|
1160
|
+
rule: "bash-unmatched-esac"
|
|
1161
|
+
});
|
|
1162
|
+
} else if (e === "do") r.push({
|
|
1163
|
+
keyword: "do",
|
|
1164
|
+
line: i
|
|
1165
|
+
});
|
|
1166
|
+
else if (e === "done") {
|
|
1167
|
+
let e = r.pop();
|
|
1168
|
+
(!e || e.keyword !== "do") && t.push({
|
|
1169
|
+
line: i,
|
|
1170
|
+
column: a.indexOf("done") + 1,
|
|
1171
|
+
message: "Unexpected \"done\" with no preceding \"do\" / loop",
|
|
1172
|
+
severity: "error",
|
|
1173
|
+
rule: "bash-unmatched-done"
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
for (; r.length > 0;) {
|
|
1178
|
+
let e = r.pop(), n = e.keyword === "if" ? "fi" : e.keyword === "case" ? "esac" : "done";
|
|
1179
|
+
t.push({
|
|
1180
|
+
line: e.line,
|
|
1181
|
+
column: 1,
|
|
1182
|
+
message: `Unclosed "${e.keyword}" block, missing "${n}"`,
|
|
1183
|
+
severity: "error",
|
|
1184
|
+
rule: "bash-unclosed-block"
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
return t;
|
|
1188
|
+
}
|
|
1189
|
+
function E(e) {
|
|
1190
|
+
let t = [], n = e.split("\n");
|
|
1191
|
+
for (let e = 0; e < n.length; e++) {
|
|
1192
|
+
let r = e + 1, i = n[e];
|
|
1193
|
+
(/^\t+/.test(i) || /^ +\t+/.test(i)) && t.push({
|
|
1194
|
+
line: r,
|
|
1195
|
+
column: 1,
|
|
1196
|
+
message: "YAML forbids tab characters for indentation; use spaces instead",
|
|
1197
|
+
severity: "error",
|
|
1198
|
+
rule: "yaml-no-tabs"
|
|
1199
|
+
});
|
|
1200
|
+
let a = i.trim();
|
|
1201
|
+
/^[a-zA-Z0-9_-]+:[^ \t\n\r/#]/.test(a) && !a.startsWith("http:") && !a.startsWith("https:") && t.push({
|
|
1202
|
+
line: r,
|
|
1203
|
+
column: i.indexOf(":") + 1,
|
|
1204
|
+
message: "YAML mappings require a space after the colon \":\" (e.g. \"key: value\")",
|
|
1205
|
+
severity: "warning",
|
|
1206
|
+
rule: "yaml-missing-space"
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
return t;
|
|
1210
|
+
}
|
|
1211
|
+
function D(e) {
|
|
1212
|
+
let t = [], n = e.split("\n"), r = 0, i = 1;
|
|
1213
|
+
for (let e = 0; e < n.length; e++) {
|
|
1214
|
+
let t = e + 1;
|
|
1215
|
+
n[e].trim().startsWith("```") && (r === 0 ? (r++, i = t) : r--);
|
|
1216
|
+
}
|
|
1217
|
+
return r > 0 && t.push({
|
|
1218
|
+
line: i,
|
|
1219
|
+
column: 1,
|
|
1220
|
+
message: "Unclosed Markdown code fence (```)",
|
|
1221
|
+
severity: "error",
|
|
1222
|
+
rule: "md-unclosed-fence"
|
|
1223
|
+
}), t;
|
|
1224
|
+
}
|
|
1225
|
+
function O(e, t) {
|
|
1226
|
+
if (!e || !e.trim()) return [];
|
|
1227
|
+
switch ((t || "").toLowerCase().trim()) {
|
|
1228
|
+
case "json": return b(e);
|
|
1229
|
+
case "javascript":
|
|
1230
|
+
case "js":
|
|
1231
|
+
case "typescript":
|
|
1232
|
+
case "ts":
|
|
1233
|
+
case "jsx":
|
|
1234
|
+
case "tsx": return x(e);
|
|
1235
|
+
case "html":
|
|
1236
|
+
case "xml":
|
|
1237
|
+
case "svg": return S(e);
|
|
1238
|
+
case "css":
|
|
1239
|
+
case "scss":
|
|
1240
|
+
case "less": return C(e);
|
|
1241
|
+
case "python":
|
|
1242
|
+
case "py": return w(e);
|
|
1243
|
+
case "bash":
|
|
1244
|
+
case "sh":
|
|
1245
|
+
case "shell":
|
|
1246
|
+
case "zsh": return T(e);
|
|
1247
|
+
case "yaml":
|
|
1248
|
+
case "yml": return E(e);
|
|
1249
|
+
case "markdown":
|
|
1250
|
+
case "md": return D(e);
|
|
1251
|
+
default: return [];
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/components/code/code.ts
|
|
1256
|
+
var k = class extends e {
|
|
1257
|
+
constructor(...e) {
|
|
1258
|
+
super(...e), this.code = "", this.language = "plaintext", this.lang = "", this.label = "", this.filename = "", this.lint = !1, this.diagnostics = [], this.showLintSummary = !0, this.lineNumbers = !1, this.highlightLines = "", this.copyable = !0, this.hideCopyButton = !1, this.wrapLines = !1, this.maxHeight = "", this.isCopied = !1, this.isIssuesExpanded = !1, this.internalCode = "", this.activeDiagnostics = [], this.copyTimeout = null, this.handleSlotChange = () => {
|
|
1259
|
+
this.code || (this.extractCodeContent(), this.requestUpdate());
|
|
1260
|
+
}, this.toggleIssuesList = () => {
|
|
1261
|
+
this.isIssuesExpanded = !this.isIssuesExpanded;
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
static {
|
|
1265
|
+
this.styles = [e.styles, l];
|
|
1266
|
+
}
|
|
1267
|
+
connectedCallback() {
|
|
1268
|
+
super.connectedCallback(), this.extractCodeContent();
|
|
1269
|
+
}
|
|
1270
|
+
disconnectedCallback() {
|
|
1271
|
+
super.disconnectedCallback(), this.copyTimeout &&= (clearTimeout(this.copyTimeout), null);
|
|
1272
|
+
}
|
|
1273
|
+
willUpdate(e) {
|
|
1274
|
+
e.has("code") && this.code ? this.internalCode = this.code : !this.internalCode && this.textContent && this.textContent.trim() && (this.internalCode = this.normalizeIndentation(this.textContent)), this.runLint();
|
|
1275
|
+
}
|
|
1276
|
+
extractCodeContent() {
|
|
1277
|
+
!this.code && this.textContent && this.textContent.trim() && (this.internalCode = this.normalizeIndentation(this.textContent), this.runLint());
|
|
1278
|
+
}
|
|
1279
|
+
normalizeIndentation(e) {
|
|
1280
|
+
let t = e.replace(/^\r?\n/, "").replace(/\r?\n\s*$/, "").split("\n");
|
|
1281
|
+
if (t.length === 0) return e;
|
|
1282
|
+
let n = Infinity;
|
|
1283
|
+
for (let e of t) {
|
|
1284
|
+
if (e.trim().length === 0) continue;
|
|
1285
|
+
let t = e.match(/^[ \t]*/)?.[0]?.length || 0;
|
|
1286
|
+
t < n && (n = t);
|
|
1287
|
+
}
|
|
1288
|
+
return n === Infinity || n === 0 ? t.join("\n") : t.map((e) => e.slice(n)).join("\n");
|
|
1289
|
+
}
|
|
1290
|
+
runLint() {
|
|
1291
|
+
let e = this.effectiveLanguage, t = [], n = !!(this.lint || this.hasAttribute("lint")), r = this.internalCode || this.code || "";
|
|
1292
|
+
return n && r && (t = O(r, e)), this.diagnostics && this.diagnostics.length > 0 && (t = [...t, ...this.diagnostics]), this.activeDiagnostics = t, this.emitEvent("lint-complete", {
|
|
1293
|
+
diagnostics: t,
|
|
1294
|
+
isValid: t.length === 0
|
|
1295
|
+
}), t;
|
|
1296
|
+
}
|
|
1297
|
+
get effectiveLanguage() {
|
|
1298
|
+
return this.lang || this.language || "plaintext";
|
|
1299
|
+
}
|
|
1300
|
+
get effectiveLabel() {
|
|
1301
|
+
return this.filename || this.label;
|
|
1302
|
+
}
|
|
1303
|
+
async copy() {
|
|
1304
|
+
let e = this.internalCode || this.code || this.textContent || "";
|
|
1305
|
+
if (!e) return !1;
|
|
1306
|
+
try {
|
|
1307
|
+
if (navigator.clipboard && navigator.clipboard.writeText) await navigator.clipboard.writeText(e);
|
|
1308
|
+
else {
|
|
1309
|
+
let t = document.createElement("textarea");
|
|
1310
|
+
t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
1311
|
+
}
|
|
1312
|
+
return this.isCopied = !0, this.emitEvent("copy", { code: e }), this.copyTimeout && clearTimeout(this.copyTimeout), this.copyTimeout = setTimeout(() => {
|
|
1313
|
+
this.isCopied = !1;
|
|
1314
|
+
}, 2e3), !0;
|
|
1315
|
+
} catch {
|
|
1316
|
+
return !1;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
parseHighlightedLines() {
|
|
1320
|
+
let e = /* @__PURE__ */ new Set();
|
|
1321
|
+
if (!this.highlightLines) return e;
|
|
1322
|
+
let t = this.highlightLines.split(",");
|
|
1323
|
+
for (let n of t) {
|
|
1324
|
+
let t = n.trim();
|
|
1325
|
+
if (t.includes("-")) {
|
|
1326
|
+
let [n, r] = t.split("-"), i = parseInt(n || "", 10), a = parseInt(r || "", 10);
|
|
1327
|
+
if (!isNaN(i) && !isNaN(a)) for (let t = i; t <= a; t++) e.add(t);
|
|
1328
|
+
} else {
|
|
1329
|
+
let n = parseInt(t, 10);
|
|
1330
|
+
isNaN(n) || e.add(n);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
return e;
|
|
1334
|
+
}
|
|
1335
|
+
scrollToLine(e) {
|
|
1336
|
+
let t = this.shadowRoot?.querySelector(`[data-line="${e}"]`);
|
|
1337
|
+
t && t.scrollIntoView({
|
|
1338
|
+
behavior: "smooth",
|
|
1339
|
+
block: "center"
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
render() {
|
|
1343
|
+
let e = this.internalCode || this.code || "", t = this.effectiveLanguage, n = this.effectiveLabel, a = !!(n || t !== "plaintext" || this.copyable), o = this.parseHighlightedLines(), s = /* @__PURE__ */ new Map();
|
|
1344
|
+
for (let e of this.activeDiagnostics) {
|
|
1345
|
+
let t = s.get(e.line) || [];
|
|
1346
|
+
t.push(e), s.set(e.line, t);
|
|
1347
|
+
}
|
|
1348
|
+
let l = e.split("\n").length, u = y(e, t).split("\n"), d = this.activeDiagnostics.filter((e) => e.severity === "error" || !e.severity).length, f = this.activeDiagnostics.filter((e) => e.severity === "warning").length, p = this.activeDiagnostics.length > 0;
|
|
1349
|
+
return r`
|
|
1350
|
+
<div class="code-container" style=${this.maxHeight ? `--md-code-max-height: ${this.maxHeight};` : ""}>
|
|
1351
|
+
<!-- Hidden Slot for code content fallback -->
|
|
1352
|
+
<div style="display: none;">
|
|
1353
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
1354
|
+
</div>
|
|
1355
|
+
|
|
1356
|
+
<!-- Header -->
|
|
1357
|
+
${a ? r`
|
|
1358
|
+
<header class="code-header">
|
|
1359
|
+
<div class="code-header-left">
|
|
1360
|
+
${t && t !== "plaintext" ? r`
|
|
1361
|
+
<span class="lang-badge">${t}</span>
|
|
1362
|
+
` : i}
|
|
1363
|
+
${n ? r`<span class="code-filename">${n}</span>` : i}
|
|
1364
|
+
</div>
|
|
1365
|
+
|
|
1366
|
+
<div class="code-header-actions">
|
|
1367
|
+
<slot name="actions"></slot>
|
|
1368
|
+
${this.copyable && !this.hideCopyButton ? r`
|
|
1369
|
+
<button
|
|
1370
|
+
type="button"
|
|
1371
|
+
class="action-btn ${this.isCopied ? "copied" : ""}"
|
|
1372
|
+
@click=${this.copy}
|
|
1373
|
+
aria-label=${this.isCopied ? "Copied to clipboard" : "Copy code to clipboard"}
|
|
1374
|
+
title=${this.isCopied ? "Copied!" : "Copy code"}
|
|
1375
|
+
>
|
|
1376
|
+
<md-icon name=${this.isCopied ? "check" : "content_copy"}></md-icon>
|
|
1377
|
+
<span>${this.isCopied ? "Copied!" : "Copy"}</span>
|
|
1378
|
+
</button>
|
|
1379
|
+
` : i}
|
|
1380
|
+
</div>
|
|
1381
|
+
</header>
|
|
1382
|
+
` : this.copyable && !this.hideCopyButton ? r`
|
|
1383
|
+
<div class="floating-copy-btn">
|
|
1384
|
+
<button
|
|
1385
|
+
type="button"
|
|
1386
|
+
class="action-btn ${this.isCopied ? "copied" : ""}"
|
|
1387
|
+
@click=${this.copy}
|
|
1388
|
+
aria-label=${this.isCopied ? "Copied to clipboard" : "Copy code"}
|
|
1389
|
+
title=${this.isCopied ? "Copied!" : "Copy code"}
|
|
1390
|
+
>
|
|
1391
|
+
<md-icon name=${this.isCopied ? "check" : "content_copy"}></md-icon>
|
|
1392
|
+
<span>${this.isCopied ? "Copied!" : "Copy"}</span>
|
|
1393
|
+
</button>
|
|
1394
|
+
</div>
|
|
1395
|
+
` : i}
|
|
1396
|
+
|
|
1397
|
+
<!-- Body with Gutter and Code Lines -->
|
|
1398
|
+
<div class="code-body" style=${this.maxHeight ? `max-height: ${this.maxHeight};` : ""}>
|
|
1399
|
+
${this.lineNumbers || this.hasAttribute("line-numbers") || this.lint || this.hasAttribute("lint") || this.activeDiagnostics.length > 0 ? r`
|
|
1400
|
+
<div class="code-gutter" aria-hidden="true">
|
|
1401
|
+
${Array.from({ length: l }, (e, t) => {
|
|
1402
|
+
let n = t + 1, a = s.get(n), o = a?.find((e) => e.severity === "error" || !e.severity) || a?.[0];
|
|
1403
|
+
return r`
|
|
1404
|
+
<div class="gutter-line" @click=${() => this.scrollToLine(n)}>
|
|
1405
|
+
${o ? r`
|
|
1406
|
+
<span
|
|
1407
|
+
class="gutter-marker ${o.severity || "error"}"
|
|
1408
|
+
title="Line ${n}: ${o.message}"
|
|
1409
|
+
>
|
|
1410
|
+
<md-icon name=${o.severity === "warning" ? "warning" : "error"}></md-icon>
|
|
1411
|
+
</span>
|
|
1412
|
+
` : i}
|
|
1413
|
+
${this.lineNumbers || this.hasAttribute("line-numbers") ? r`<span>${n}</span>` : i}
|
|
1414
|
+
</div>
|
|
1415
|
+
`;
|
|
1416
|
+
})}
|
|
1417
|
+
</div>
|
|
1418
|
+
` : i}
|
|
1419
|
+
|
|
1420
|
+
<pre><code>${u.map((e, t) => {
|
|
1421
|
+
let n = t + 1, i = o.has(n), a = s.get(n), l = a?.some((e) => e.severity === "error" || !e.severity), u = a?.some((e) => e.severity === "warning"), d = [
|
|
1422
|
+
"code-line",
|
|
1423
|
+
i ? "highlighted" : "",
|
|
1424
|
+
l ? "has-error" : "",
|
|
1425
|
+
u && !l ? "has-warning" : ""
|
|
1426
|
+
].filter(Boolean).join(" ");
|
|
1427
|
+
return r`<div class=${d} data-line=${n}>${c(e || " ")}</div>`;
|
|
1428
|
+
})}</code></pre>
|
|
1429
|
+
</div>
|
|
1430
|
+
|
|
1431
|
+
<!-- Lint Summary Footer -->
|
|
1432
|
+
${(this.lint || this.hasAttribute("lint") || this.diagnostics.length > 0 || this.activeDiagnostics.length > 0) && this.showLintSummary !== !1 ? r`
|
|
1433
|
+
<footer class="lint-footer">
|
|
1434
|
+
<div class="lint-footer-summary" @click=${this.toggleIssuesList} role="button" tabindex="0">
|
|
1435
|
+
<div class="lint-counts">
|
|
1436
|
+
${p && d > 0 ? r`
|
|
1437
|
+
<span class="lint-count-item errors">
|
|
1438
|
+
<md-icon name="error"></md-icon>
|
|
1439
|
+
<span>${d} ${d === 1 ? "error" : "errors"}</span>
|
|
1440
|
+
</span>
|
|
1441
|
+
` : i}
|
|
1442
|
+
${p && f > 0 ? r`
|
|
1443
|
+
<span class="lint-count-item warnings">
|
|
1444
|
+
<md-icon name="warning"></md-icon>
|
|
1445
|
+
<span>${f} ${f === 1 ? "warning" : "warnings"}</span>
|
|
1446
|
+
</span>
|
|
1447
|
+
` : i}
|
|
1448
|
+
${p ? i : r`
|
|
1449
|
+
<span class="lint-count-item valid">
|
|
1450
|
+
<md-icon name="check_circle"></md-icon>
|
|
1451
|
+
<span>No syntax issues detected</span>
|
|
1452
|
+
</span>
|
|
1453
|
+
`}
|
|
1454
|
+
</div>
|
|
1455
|
+
|
|
1456
|
+
${p ? r`
|
|
1457
|
+
<button type="button" class="action-btn" aria-label="Toggle issues panel">
|
|
1458
|
+
<md-icon name=${this.isIssuesExpanded ? "expand_less" : "expand_more"}></md-icon>
|
|
1459
|
+
<span>${this.isIssuesExpanded ? "Hide issues" : "View issues"}</span>
|
|
1460
|
+
</button>
|
|
1461
|
+
` : i}
|
|
1462
|
+
</div>
|
|
1463
|
+
|
|
1464
|
+
${p && this.isIssuesExpanded ? r`
|
|
1465
|
+
<div class="lint-issues-list" role="region" aria-label="Lint diagnostics">
|
|
1466
|
+
${this.activeDiagnostics.map((e) => r`
|
|
1467
|
+
<div
|
|
1468
|
+
class="lint-issue-item ${e.severity || "error"}"
|
|
1469
|
+
@click=${() => this.scrollToLine(e.line)}
|
|
1470
|
+
role="button"
|
|
1471
|
+
tabindex="0"
|
|
1472
|
+
>
|
|
1473
|
+
<md-icon name=${e.severity === "warning" ? "warning" : "error"}></md-icon>
|
|
1474
|
+
<div class="lint-issue-content">
|
|
1475
|
+
<span class="lint-issue-loc">Line ${e.line}${e.column ? `:${e.column}` : ""}${e.rule ? ` • ${e.rule}` : ""}</span>
|
|
1476
|
+
<span class="lint-issue-msg">${e.message}</span>
|
|
1477
|
+
</div>
|
|
1478
|
+
</div>
|
|
1479
|
+
`)}
|
|
1480
|
+
</div>
|
|
1481
|
+
` : i}
|
|
1482
|
+
</footer>
|
|
1483
|
+
` : i}
|
|
1484
|
+
</div>
|
|
1485
|
+
`;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
t([o({ type: String })], k.prototype, "code", void 0), t([o({
|
|
1489
|
+
type: String,
|
|
1490
|
+
reflect: !0
|
|
1491
|
+
})], k.prototype, "language", void 0), t([o({ type: String })], k.prototype, "lang", void 0), t([o({ type: String })], k.prototype, "label", void 0), t([o({ type: String })], k.prototype, "filename", void 0), t([o({
|
|
1492
|
+
type: Boolean,
|
|
1493
|
+
reflect: !0
|
|
1494
|
+
})], k.prototype, "lint", void 0), t([o({ type: Array })], k.prototype, "diagnostics", void 0), t([o({
|
|
1495
|
+
type: Boolean,
|
|
1496
|
+
attribute: "show-lint-summary",
|
|
1497
|
+
converter: {
|
|
1498
|
+
fromAttribute: (e) => e === null || e !== "false",
|
|
1499
|
+
toAttribute: (e) => e ? "" : null
|
|
1500
|
+
}
|
|
1501
|
+
})], k.prototype, "showLintSummary", void 0), t([o({
|
|
1502
|
+
type: Boolean,
|
|
1503
|
+
attribute: "line-numbers",
|
|
1504
|
+
reflect: !0
|
|
1505
|
+
})], k.prototype, "lineNumbers", void 0), t([o({
|
|
1506
|
+
type: String,
|
|
1507
|
+
attribute: "highlight-lines"
|
|
1508
|
+
})], k.prototype, "highlightLines", void 0), t([o({
|
|
1509
|
+
type: Boolean,
|
|
1510
|
+
reflect: !0,
|
|
1511
|
+
converter: {
|
|
1512
|
+
fromAttribute: (e) => e === null || e !== "false",
|
|
1513
|
+
toAttribute: (e) => e ? "" : null
|
|
1514
|
+
}
|
|
1515
|
+
})], k.prototype, "copyable", void 0), t([o({
|
|
1516
|
+
type: Boolean,
|
|
1517
|
+
attribute: "hide-copy-button"
|
|
1518
|
+
})], k.prototype, "hideCopyButton", void 0), t([o({
|
|
1519
|
+
type: Boolean,
|
|
1520
|
+
attribute: "wrap-lines",
|
|
1521
|
+
reflect: !0
|
|
1522
|
+
})], k.prototype, "wrapLines", void 0), t([o({
|
|
1523
|
+
type: String,
|
|
1524
|
+
attribute: "max-height"
|
|
1525
|
+
})], k.prototype, "maxHeight", void 0), t([s()], k.prototype, "isCopied", void 0), t([s()], k.prototype, "isIssuesExpanded", void 0), t([s()], k.prototype, "internalCode", void 0), t([s()], k.prototype, "activeDiagnostics", void 0), k = t([a("md-code")], k);
|
|
1526
|
+
var A = class extends k {};
|
|
1527
|
+
A = t([a("md-code-block")], A);
|
|
1528
|
+
//#endregion
|
|
1529
|
+
export { A as n, k as t };
|
|
1530
|
+
|
|
1531
|
+
//# sourceMappingURL=code-CM6hIZNx.js.map
|