le-kit 0.1.13 → 0.1.15
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/cjs/{index-o1DRKw1g.js → index-C3iQZ-Ja.js} +7 -7
- package/dist/cjs/index-C3iQZ-Ja.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/le-box.cjs.entry.js +2 -2
- package/dist/cjs/le-button.le-checkbox.le-component.le-popover.le-popup.le-slot.le-string-input.entry.cjs.js.map +1 -0
- package/dist/cjs/{le-button_6.cjs.entry.js → le-button_7.cjs.entry.js} +279 -33
- package/dist/cjs/le-card.cjs.entry.js +2 -2
- package/dist/cjs/le-combobox.cjs.entry.js +237 -0
- package/dist/cjs/le-combobox.entry.cjs.js.map +1 -0
- package/dist/cjs/le-dropdown-base.cjs.entry.js +348 -0
- package/dist/cjs/le-dropdown-base.entry.cjs.js.map +1 -0
- package/dist/cjs/le-kit.cjs.js +2 -2
- package/dist/cjs/le-multiselect.cjs.entry.js +306 -0
- package/dist/cjs/le-multiselect.entry.cjs.js.map +1 -0
- package/dist/cjs/le-number-input.cjs.entry.js +3 -3
- package/dist/cjs/le-round-progress.cjs.entry.js +2 -2
- package/dist/cjs/le-segmented-control.cjs.entry.js +245 -0
- package/dist/cjs/le-segmented-control.entry.cjs.js.map +1 -0
- package/dist/cjs/le-select.cjs.entry.js +188 -0
- package/dist/cjs/le-select.entry.cjs.js.map +1 -0
- package/dist/cjs/le-stack.cjs.entry.js +3 -3
- package/dist/cjs/le-tab-bar.cjs.entry.js +242 -0
- package/dist/cjs/le-tab-bar.entry.cjs.js.map +1 -0
- package/dist/cjs/le-tab-panel.cjs.entry.js +100 -0
- package/dist/cjs/le-tab-panel.entry.cjs.js.map +1 -0
- package/dist/cjs/le-tab.cjs.entry.js +133 -0
- package/dist/cjs/le-tab.entry.cjs.js.map +1 -0
- package/dist/cjs/le-tabs.cjs.entry.js +307 -0
- package/dist/cjs/le-tabs.entry.cjs.js.map +1 -0
- package/dist/cjs/le-tag.cjs.entry.js +68 -0
- package/dist/cjs/le-tag.entry.cjs.js.map +1 -0
- package/dist/cjs/le-text.cjs.entry.js +2 -2
- package/dist/cjs/le-turntable.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-DqhadIxH.js → utils-DjPcLPN9.js} +3 -3
- package/dist/cjs/{utils-DqhadIxH.js.map → utils-DjPcLPN9.js.map} +1 -1
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/le-button/{le-button.default.css → le-button.css} +57 -30
- package/dist/collection/components/le-button/le-button.js +105 -15
- package/dist/collection/components/le-button/le-button.js.map +1 -1
- package/dist/collection/components/le-combobox/le-combobox.css +144 -0
- package/dist/collection/components/le-combobox/le-combobox.js +659 -0
- package/dist/collection/components/le-combobox/le-combobox.js.map +1 -0
- package/dist/collection/components/le-component/le-component.js +7 -6
- package/dist/collection/components/le-component/le-component.js.map +1 -1
- package/dist/collection/components/le-dropdown-base/le-dropdown-base.css +163 -0
- package/dist/collection/components/le-dropdown-base/le-dropdown-base.js +761 -0
- package/dist/collection/components/le-dropdown-base/le-dropdown-base.js.map +1 -0
- package/dist/collection/components/le-multiselect/le-multiselect.css +163 -0
- package/dist/collection/components/le-multiselect/le-multiselect.js +734 -0
- package/dist/collection/components/le-multiselect/le-multiselect.js.map +1 -0
- package/dist/collection/components/le-number-input/le-number-input.js +1 -1
- package/dist/collection/components/le-popover/le-popover.css +10 -0
- package/dist/collection/components/le-popover/le-popover.js +61 -10
- package/dist/collection/components/le-popover/le-popover.js.map +1 -1
- package/dist/collection/components/le-popup/le-popup.api.js +2 -1
- package/dist/collection/components/le-popup/le-popup.api.js.map +1 -1
- package/dist/collection/components/le-popup/le-popup.js +42 -12
- package/dist/collection/components/le-popup/le-popup.js.map +1 -1
- package/dist/collection/components/le-round-progress/le-round-progress.js +1 -1
- package/dist/collection/components/le-segmented-control/le-segmented-control.css +78 -0
- package/dist/collection/components/le-segmented-control/le-segmented-control.js +445 -0
- package/dist/collection/components/le-segmented-control/le-segmented-control.js.map +1 -0
- package/dist/collection/components/le-select/le-select.css +121 -0
- package/dist/collection/components/le-select/le-select.js +578 -0
- package/dist/collection/components/le-select/le-select.js.map +1 -0
- package/dist/collection/components/le-slot/le-slot.js +4 -6
- package/dist/collection/components/le-slot/le-slot.js.map +1 -1
- package/dist/collection/components/le-stack/le-stack.js +1 -1
- package/dist/collection/components/le-string-input/le-string-input.js +59 -5
- package/dist/collection/components/le-string-input/le-string-input.js.map +1 -1
- package/dist/collection/components/le-tab/le-tab.css +289 -0
- package/dist/collection/components/le-tab/le-tab.js +565 -0
- package/dist/collection/components/le-tab/le-tab.js.map +1 -0
- package/dist/collection/components/le-tab-bar/le-tab-bar.css +89 -0
- package/dist/collection/components/le-tab-bar/le-tab-bar.js +467 -0
- package/dist/collection/components/le-tab-bar/le-tab-bar.js.map +1 -0
- package/dist/collection/components/le-tab-panel/le-tab-panel.css +30 -0
- package/dist/collection/components/le-tab-panel/le-tab-panel.js +302 -0
- package/dist/collection/components/le-tab-panel/le-tab-panel.js.map +1 -0
- package/dist/collection/components/le-tabs/le-tabs.css +146 -0
- package/dist/collection/components/le-tabs/le-tabs.js +588 -0
- package/dist/collection/components/le-tabs/le-tabs.js.map +1 -0
- package/dist/collection/components/le-tag/le-tag.css +139 -0
- package/dist/collection/components/le-tag/le-tag.js +266 -0
- package/dist/collection/components/le-tag/le-tag.js.map +1 -0
- package/dist/collection/components/le-turntable/le-turntable.js +1 -1
- package/dist/collection/dist/components/assets/.gitkeep +1 -0
- package/{custom-elements.json → dist/collection/dist/components/assets/custom-elements.json} +5274 -1409
- package/dist/{core/collection → collection/dist/components}/themes/base.css +44 -0
- package/dist/{core/collection → collection/dist/components}/themes/dark.css +4 -1
- package/dist/collection/{themes → dist/components/themes}/default.css +4 -1
- package/dist/collection/dist/{collection → components}/themes/gradient.css +4 -1
- package/dist/{core/collection → collection/dist/components}/themes/index.css +2 -0
- package/dist/collection/{themes → dist/components/themes}/minimal.css +4 -1
- package/dist/{core/collection → collection/dist/components}/themes/warm.css +4 -1
- package/dist/collection/global/app.js +4 -4
- package/dist/collection/global/app.js.map +1 -1
- package/dist/collection/types/options.js.map +1 -1
- package/dist/components/assets/.gitkeep +1 -0
- package/dist/{collection → components}/assets/custom-elements.json +5202 -1337
- package/dist/components/index.js +1 -103
- package/dist/components/index.js.map +1 -1
- package/dist/components/le-box.js +11 -6
- package/dist/components/le-box.js.map +1 -1
- package/dist/components/le-button.js +1 -1
- package/dist/components/le-button2.js +378 -45
- package/dist/components/le-button2.js.map +1 -1
- package/dist/components/le-card.js +11 -6
- package/dist/components/le-card.js.map +1 -1
- package/dist/components/le-checkbox.js +1 -1
- package/dist/components/le-combobox.d.ts +11 -0
- package/dist/components/le-combobox.js +321 -0
- package/dist/components/le-combobox.js.map +1 -0
- package/dist/components/le-component.js +1 -1
- package/dist/components/le-dropdown-base.d.ts +11 -0
- package/dist/components/le-dropdown-base.js +9 -0
- package/dist/components/le-dropdown-base.js.map +1 -0
- package/dist/components/le-dropdown-base2.js +393 -0
- package/dist/components/le-dropdown-base2.js.map +1 -0
- package/dist/components/le-multiselect.d.ts +11 -0
- package/dist/components/le-multiselect.js +400 -0
- package/dist/components/le-multiselect.js.map +1 -0
- package/dist/components/le-number-input.js +12 -7
- package/dist/components/le-number-input.js.map +1 -1
- package/dist/components/le-popover2.js +24 -11
- package/dist/components/le-popover2.js.map +1 -1
- package/dist/{core/collection/components/le-popup → components}/le-popup.api.js +9 -4
- package/dist/components/le-popup.api.js.map +1 -0
- package/dist/components/le-popup.js +1 -271
- package/dist/components/le-popup.js.map +1 -1
- package/dist/components/le-round-progress.js +1 -1
- package/dist/components/le-segmented-control.d.ts +11 -0
- package/dist/components/le-segmented-control.js +320 -0
- package/dist/components/le-segmented-control.js.map +1 -0
- package/dist/components/le-select.d.ts +11 -0
- package/dist/components/le-select.js +271 -0
- package/dist/components/le-select.js.map +1 -0
- package/dist/components/le-slot.js +1 -1
- package/dist/components/le-stack.js +12 -7
- package/dist/components/le-stack.js.map +1 -1
- package/dist/components/le-string-input.js +1 -1
- package/dist/components/le-tab-bar.d.ts +11 -0
- package/dist/components/le-tab-bar.js +319 -0
- package/dist/components/le-tab-bar.js.map +1 -0
- package/dist/components/le-tab-panel.d.ts +11 -0
- package/dist/components/le-tab-panel.js +171 -0
- package/dist/components/le-tab-panel.js.map +1 -0
- package/dist/components/le-tab.d.ts +11 -0
- package/dist/components/le-tab.js +9 -0
- package/dist/components/le-tab.js.map +1 -0
- package/dist/components/le-tab2.js +206 -0
- package/dist/components/le-tab2.js.map +1 -0
- package/dist/components/le-tabs.d.ts +11 -0
- package/dist/components/le-tabs.js +386 -0
- package/dist/components/le-tabs.js.map +1 -0
- package/dist/components/le-tag.d.ts +11 -0
- package/dist/components/le-tag.js +9 -0
- package/dist/components/le-tag.js.map +1 -0
- package/dist/components/le-tag2.js +130 -0
- package/dist/components/le-tag2.js.map +1 -0
- package/dist/components/le-text.js +11 -6
- package/dist/components/le-text.js.map +1 -1
- package/dist/components/le-turntable.js +1 -1
- package/dist/{le-kit/dist/collection → components}/themes/base.css +44 -0
- package/dist/{collection → components}/themes/dark.css +4 -1
- package/dist/{core/collection → components}/themes/default.css +4 -1
- package/dist/{core/collection → components}/themes/gradient.css +4 -1
- package/dist/{le-kit/dist/collection → components}/themes/index.css +2 -0
- package/dist/{collection/dist/collection → components}/themes/minimal.css +4 -1
- package/dist/{le-kit/dist/collection → components}/themes/warm.css +4 -1
- package/dist/components/utils.js +4 -4
- package/dist/components/utils.js.map +1 -1
- package/dist/docs.json +6674 -1371
- package/dist/esm/{index-CwNQ1GTa.js → index-DzgCnDLJ.js} +8 -8
- package/dist/esm/index-DzgCnDLJ.js.map +1 -0
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/le-box.entry.js +2 -2
- package/dist/esm/le-button.le-checkbox.le-component.le-popover.le-popup.le-slot.le-string-input.entry.js.map +1 -0
- package/dist/esm/{le-button_6.entry.js → le-button_7.entry.js} +279 -34
- package/dist/esm/le-card.entry.js +2 -2
- package/dist/esm/le-combobox.entry.js +235 -0
- package/dist/esm/le-combobox.entry.js.map +1 -0
- package/dist/esm/le-dropdown-base.entry.js +346 -0
- package/dist/esm/le-dropdown-base.entry.js.map +1 -0
- package/dist/esm/le-kit.js +3 -3
- package/dist/esm/le-multiselect.entry.js +304 -0
- package/dist/esm/le-multiselect.entry.js.map +1 -0
- package/dist/esm/le-number-input.entry.js +3 -3
- package/dist/esm/le-round-progress.entry.js +2 -2
- package/dist/esm/le-segmented-control.entry.js +243 -0
- package/dist/esm/le-segmented-control.entry.js.map +1 -0
- package/dist/esm/le-select.entry.js +186 -0
- package/dist/esm/le-select.entry.js.map +1 -0
- package/dist/esm/le-stack.entry.js +3 -3
- package/dist/esm/le-tab-bar.entry.js +240 -0
- package/dist/esm/le-tab-bar.entry.js.map +1 -0
- package/dist/esm/le-tab-panel.entry.js +98 -0
- package/dist/esm/le-tab-panel.entry.js.map +1 -0
- package/dist/esm/le-tab.entry.js +131 -0
- package/dist/esm/le-tab.entry.js.map +1 -0
- package/dist/esm/le-tabs.entry.js +305 -0
- package/dist/esm/le-tabs.entry.js.map +1 -0
- package/dist/esm/le-tag.entry.js +66 -0
- package/dist/esm/le-tag.entry.js.map +1 -0
- package/dist/esm/le-text.entry.js +2 -2
- package/dist/esm/le-turntable.entry.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-Cf7fMI0j.js → utils-Dp5xFMCl.js} +3 -3
- package/dist/esm/{utils-Cf7fMI0j.js.map → utils-Dp5xFMCl.js.map} +1 -1
- package/dist/le-kit/dist/components/assets/.gitkeep +1 -0
- package/dist/{core/collection → le-kit/dist/components}/assets/custom-elements.json +5202 -1337
- package/dist/{collection/dist/collection → le-kit/dist/components}/themes/base.css +44 -0
- package/dist/{collection/dist/collection → le-kit/dist/components}/themes/dark.css +4 -1
- package/dist/le-kit/dist/{collection → components}/themes/default.css +4 -1
- package/dist/le-kit/dist/{collection → components}/themes/gradient.css +4 -1
- package/dist/{collection/dist/collection → le-kit/dist/components}/themes/index.css +2 -0
- package/dist/{core/collection → le-kit/dist/components}/themes/minimal.css +4 -1
- package/dist/{collection/dist/collection → le-kit/dist/components}/themes/warm.css +4 -1
- package/dist/le-kit/index.esm.js +1 -1
- package/dist/le-kit/index.esm.js.map +1 -1
- package/dist/le-kit/le-button.le-checkbox.le-component.le-popover.le-popup.le-slot.le-string-input.entry.esm.js.map +1 -0
- package/dist/le-kit/le-combobox.entry.esm.js.map +1 -0
- package/dist/le-kit/le-dropdown-base.entry.esm.js.map +1 -0
- package/dist/le-kit/le-kit.css +1 -1
- package/dist/le-kit/le-kit.esm.js +1 -1
- package/dist/le-kit/le-multiselect.entry.esm.js.map +1 -0
- package/dist/le-kit/le-segmented-control.entry.esm.js.map +1 -0
- package/dist/le-kit/le-select.entry.esm.js.map +1 -0
- package/dist/le-kit/le-tab-bar.entry.esm.js.map +1 -0
- package/dist/le-kit/le-tab-panel.entry.esm.js.map +1 -0
- package/dist/le-kit/le-tab.entry.esm.js.map +1 -0
- package/dist/le-kit/le-tabs.entry.esm.js.map +1 -0
- package/dist/le-kit/le-tag.entry.esm.js.map +1 -0
- package/dist/{core/le-kit/p-df552906.entry.js → le-kit/p-0bd7803f.entry.js} +2 -2
- package/dist/le-kit/p-0bd7803f.entry.js.map +1 -0
- package/dist/le-kit/p-1f55a4a2.entry.js +2 -0
- package/dist/le-kit/p-1f55a4a2.entry.js.map +1 -0
- package/dist/le-kit/{p-79ec6f7c.entry.js → p-2c37f174.entry.js} +2 -2
- package/dist/le-kit/p-2c37f174.entry.js.map +1 -0
- package/dist/{core/le-kit/p-5ef81068.entry.js → le-kit/p-33612923.entry.js} +2 -2
- package/dist/le-kit/p-33612923.entry.js.map +1 -0
- package/dist/le-kit/{p-b8122ad6.entry.js → p-3a52c4de.entry.js} +2 -2
- package/dist/le-kit/p-3a52c4de.entry.js.map +1 -0
- package/dist/le-kit/p-4130c60b.entry.js +2 -0
- package/dist/le-kit/p-4130c60b.entry.js.map +1 -0
- package/dist/le-kit/{p-64374730.entry.js → p-432e8231.entry.js} +2 -2
- package/dist/le-kit/p-432e8231.entry.js.map +1 -0
- package/dist/le-kit/p-548d130b.entry.js +2 -0
- package/dist/le-kit/p-548d130b.entry.js.map +1 -0
- package/dist/le-kit/p-6ecdad85.entry.js +2 -0
- package/dist/le-kit/p-6ecdad85.entry.js.map +1 -0
- package/dist/le-kit/p-6ee06c44.entry.js +2 -0
- package/dist/le-kit/p-6ee06c44.entry.js.map +1 -0
- package/dist/le-kit/p-71c78784.entry.js +2 -0
- package/dist/le-kit/p-71c78784.entry.js.map +1 -0
- package/dist/le-kit/p-7b180d58.entry.js +2 -0
- package/dist/le-kit/p-7b180d58.entry.js.map +1 -0
- package/dist/le-kit/p-91993261.entry.js +2 -0
- package/dist/le-kit/p-91993261.entry.js.map +1 -0
- package/dist/le-kit/p-DaA5gINj.js +2 -0
- package/dist/le-kit/{p-y3FECAx9.js.map → p-DaA5gINj.js.map} +1 -1
- package/dist/le-kit/p-DzgCnDLJ.js +3 -0
- package/dist/le-kit/p-DzgCnDLJ.js.map +1 -0
- package/dist/le-kit/p-a5d31d40.entry.js +2 -0
- package/dist/le-kit/p-a5d31d40.entry.js.map +1 -0
- package/dist/le-kit/{p-ad398acd.entry.js → p-b66fd9e1.entry.js} +2 -2
- package/dist/le-kit/p-b66fd9e1.entry.js.map +1 -0
- package/dist/le-kit/{p-f9008505.entry.js → p-beb87e61.entry.js} +2 -2
- package/dist/le-kit/p-beb87e61.entry.js.map +1 -0
- package/dist/le-kit/p-cc0797b0.entry.js +2 -0
- package/dist/le-kit/p-cc0797b0.entry.js.map +1 -0
- package/dist/le-kit/p-d504a369.entry.js +2 -0
- package/dist/le-kit/p-d504a369.entry.js.map +1 -0
- package/dist/themes/base.css +44 -0
- package/dist/themes/dark.css +4 -1
- package/dist/themes/default.css +4 -1
- package/dist/themes/gradient.css +4 -1
- package/dist/themes/index.css +2 -0
- package/dist/themes/minimal.css +4 -1
- package/dist/themes/warm.css +4 -1
- package/dist/types/components/le-button/le-button.d.ts +19 -4
- package/dist/types/components/le-combobox/le-combobox.d.ts +128 -0
- package/dist/types/components/le-dropdown-base/le-dropdown-base.d.ts +118 -0
- package/dist/types/components/le-multiselect/le-multiselect.d.ts +143 -0
- package/dist/types/components/le-popover/le-popover.d.ts +13 -2
- package/dist/types/components/le-popup/le-popup.d.ts +5 -0
- package/dist/types/components/le-segmented-control/le-segmented-control.d.ts +82 -0
- package/dist/types/components/le-select/le-select.d.ts +125 -0
- package/dist/types/components/le-string-input/le-string-input.d.ts +8 -0
- package/dist/types/components/le-tab/le-tab.d.ts +116 -0
- package/dist/types/components/le-tab-bar/le-tab-bar.d.ts +88 -0
- package/dist/types/components/le-tab-panel/le-tab-panel.d.ts +75 -0
- package/dist/types/components/le-tabs/le-tabs.d.ts +108 -0
- package/dist/types/components/le-tag/le-tag.d.ts +78 -0
- package/dist/types/components.d.ts +2310 -40
- package/dist/types/global/app.d.ts +4 -4
- package/dist/types/types/options.d.ts +9 -0
- package/package.json +5 -21
- package/readme.md +2 -2
- package/dist/cjs/index-o1DRKw1g.js.map +0 -1
- package/dist/cjs/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.cjs.js.map +0 -1
- package/dist/cjs/le-popup.cjs.entry.js +0 -212
- package/dist/cjs/le-popup.entry.cjs.js.map +0 -1
- package/dist/collection/dist/collection/themes/default.css +0 -108
- package/dist/collection/themes/base.css +0 -89
- package/dist/collection/themes/gradient.css +0 -100
- package/dist/collection/themes/index.css +0 -413
- package/dist/collection/themes/warm.css +0 -100
- package/dist/core/cjs/index-BsRb_UTe.js +0 -1835
- package/dist/core/cjs/index-BsRb_UTe.js.map +0 -1
- package/dist/core/cjs/index.cjs.js +0 -119
- package/dist/core/cjs/index.cjs.js.map +0 -1
- package/dist/core/cjs/le-box.cjs.entry.js +0 -184
- package/dist/core/cjs/le-box.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-button.cjs.entry.js +0 -92
- package/dist/core/cjs/le-button.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-card.cjs.entry.js +0 -29
- package/dist/core/cjs/le-card.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-checkbox.cjs.entry.js +0 -61
- package/dist/core/cjs/le-checkbox.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-kit.cjs.js +0 -25
- package/dist/core/cjs/le-kit.cjs.js.map +0 -1
- package/dist/core/cjs/le-number-input.cjs.entry.js +0 -202
- package/dist/core/cjs/le-number-input.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-popover.cjs.entry.js +0 -348
- package/dist/core/cjs/le-popover.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-popup.cjs.entry.js +0 -212
- package/dist/core/cjs/le-popup.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-round-progress.cjs.entry.js +0 -106
- package/dist/core/cjs/le-round-progress.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-stack.cjs.entry.js +0 -135
- package/dist/core/cjs/le-stack.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-string-input.cjs.entry.js +0 -95
- package/dist/core/cjs/le-string-input.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-text.cjs.entry.js +0 -335
- package/dist/core/cjs/le-text.entry.cjs.js.map +0 -1
- package/dist/core/cjs/le-turntable.cjs.entry.js +0 -139
- package/dist/core/cjs/le-turntable.entry.cjs.js.map +0 -1
- package/dist/core/cjs/loader.cjs.js +0 -13
- package/dist/core/cjs/loader.cjs.js.map +0 -1
- package/dist/core/cjs/utils-nsP8_w8_.js +0 -152
- package/dist/core/cjs/utils-nsP8_w8_.js.map +0 -1
- package/dist/core/collection/collection-manifest.json +0 -24
- package/dist/core/collection/components/le-box/le-box.default.css +0 -37
- package/dist/core/collection/components/le-box/le-box.js +0 -614
- package/dist/core/collection/components/le-box/le-box.js.map +0 -1
- package/dist/core/collection/components/le-button/le-button.default.css +0 -263
- package/dist/core/collection/components/le-button/le-button.js +0 -368
- package/dist/core/collection/components/le-button/le-button.js.map +0 -1
- package/dist/core/collection/components/le-card/le-card.default.css +0 -74
- package/dist/core/collection/components/le-card/le-card.js +0 -102
- package/dist/core/collection/components/le-card/le-card.js.map +0 -1
- package/dist/core/collection/components/le-checkbox/le-checkbox.css +0 -93
- package/dist/core/collection/components/le-checkbox/le-checkbox.js +0 -192
- package/dist/core/collection/components/le-checkbox/le-checkbox.js.map +0 -1
- package/dist/core/collection/components/le-number-input/le-number-input.css +0 -135
- package/dist/core/collection/components/le-number-input/le-number-input.js +0 -515
- package/dist/core/collection/components/le-number-input/le-number-input.js.map +0 -1
- package/dist/core/collection/components/le-popover/le-popover.css +0 -143
- package/dist/core/collection/components/le-popover/le-popover.js +0 -693
- package/dist/core/collection/components/le-popover/le-popover.js.map +0 -1
- package/dist/core/collection/components/le-popup/le-popup.api.js.map +0 -1
- package/dist/core/collection/components/le-popup/le-popup.css +0 -222
- package/dist/core/collection/components/le-popup/le-popup.js +0 -596
- package/dist/core/collection/components/le-popup/le-popup.js.map +0 -1
- package/dist/core/collection/components/le-round-progress/le-round-progress.css +0 -34
- package/dist/core/collection/components/le-round-progress/le-round-progress.js +0 -184
- package/dist/core/collection/components/le-round-progress/le-round-progress.js.map +0 -1
- package/dist/core/collection/components/le-stack/le-stack.default.css +0 -37
- package/dist/core/collection/components/le-stack/le-stack.js +0 -389
- package/dist/core/collection/components/le-stack/le-stack.js.map +0 -1
- package/dist/core/collection/components/le-string-input/le-string-input.css +0 -83
- package/dist/core/collection/components/le-string-input/le-string-input.js +0 -359
- package/dist/core/collection/components/le-string-input/le-string-input.js.map +0 -1
- package/dist/core/collection/components/le-text/le-text.default.css +0 -169
- package/dist/core/collection/components/le-text/le-text.js +0 -475
- package/dist/core/collection/components/le-text/le-text.js.map +0 -1
- package/dist/core/collection/components/le-turntable/le-turntable.css +0 -10
- package/dist/core/collection/components/le-turntable/le-turntable.js +0 -210
- package/dist/core/collection/components/le-turntable/le-turntable.js.map +0 -1
- package/dist/core/collection/global/app.js +0 -167
- package/dist/core/collection/global/app.js.map +0 -1
- package/dist/core/collection/index.js +0 -15
- package/dist/core/collection/index.js.map +0 -1
- package/dist/core/collection/types/blocks.js +0 -115
- package/dist/core/collection/types/blocks.js.map +0 -1
- package/dist/core/collection/types/options.js +0 -2
- package/dist/core/collection/types/options.js.map +0 -1
- package/dist/core/collection/utils/utils.js +0 -141
- package/dist/core/collection/utils/utils.js.map +0 -1
- package/dist/core/components/index.d.ts +0 -33
- package/dist/core/components/index.js +0 -113
- package/dist/core/components/index.js.map +0 -1
- package/dist/core/components/le-box.d.ts +0 -11
- package/dist/core/components/le-box.js +0 -225
- package/dist/core/components/le-box.js.map +0 -1
- package/dist/core/components/le-button.d.ts +0 -11
- package/dist/core/components/le-button.js +0 -9
- package/dist/core/components/le-button.js.map +0 -1
- package/dist/core/components/le-button2.js +0 -121
- package/dist/core/components/le-button2.js.map +0 -1
- package/dist/core/components/le-card.d.ts +0 -11
- package/dist/core/components/le-card.js +0 -52
- package/dist/core/components/le-card.js.map +0 -1
- package/dist/core/components/le-checkbox.d.ts +0 -11
- package/dist/core/components/le-checkbox.js +0 -87
- package/dist/core/components/le-checkbox.js.map +0 -1
- package/dist/core/components/le-number-input.d.ts +0 -11
- package/dist/core/components/le-number-input.js +0 -246
- package/dist/core/components/le-number-input.js.map +0 -1
- package/dist/core/components/le-popover.d.ts +0 -11
- package/dist/core/components/le-popover.js +0 -385
- package/dist/core/components/le-popover.js.map +0 -1
- package/dist/core/components/le-popup.d.ts +0 -11
- package/dist/core/components/le-popup.js +0 -253
- package/dist/core/components/le-popup.js.map +0 -1
- package/dist/core/components/le-round-progress.d.ts +0 -11
- package/dist/core/components/le-round-progress.js +0 -135
- package/dist/core/components/le-round-progress.js.map +0 -1
- package/dist/core/components/le-stack.d.ts +0 -11
- package/dist/core/components/le-stack.js +0 -167
- package/dist/core/components/le-stack.js.map +0 -1
- package/dist/core/components/le-string-input.d.ts +0 -11
- package/dist/core/components/le-string-input.js +0 -127
- package/dist/core/components/le-string-input.js.map +0 -1
- package/dist/core/components/le-text.d.ts +0 -11
- package/dist/core/components/le-text.js +0 -367
- package/dist/core/components/le-text.js.map +0 -1
- package/dist/core/components/le-turntable.d.ts +0 -11
- package/dist/core/components/le-turntable.js +0 -164
- package/dist/core/components/le-turntable.js.map +0 -1
- package/dist/core/components/utils.js +0 -310
- package/dist/core/components/utils.js.map +0 -1
- package/dist/core/esm/index-CJ-z5Zj1.js +0 -1818
- package/dist/core/esm/index-CJ-z5Zj1.js.map +0 -1
- package/dist/core/esm/index.js +0 -106
- package/dist/core/esm/index.js.map +0 -1
- package/dist/core/esm/le-box.entry.js +0 -182
- package/dist/core/esm/le-box.entry.js.map +0 -1
- package/dist/core/esm/le-button.entry.js +0 -90
- package/dist/core/esm/le-button.entry.js.map +0 -1
- package/dist/core/esm/le-card.entry.js +0 -27
- package/dist/core/esm/le-card.entry.js.map +0 -1
- package/dist/core/esm/le-checkbox.entry.js +0 -59
- package/dist/core/esm/le-checkbox.entry.js.map +0 -1
- package/dist/core/esm/le-kit.js +0 -21
- package/dist/core/esm/le-kit.js.map +0 -1
- package/dist/core/esm/le-number-input.entry.js +0 -200
- package/dist/core/esm/le-number-input.entry.js.map +0 -1
- package/dist/core/esm/le-popover.entry.js +0 -346
- package/dist/core/esm/le-popover.entry.js.map +0 -1
- package/dist/core/esm/le-popup.entry.js +0 -210
- package/dist/core/esm/le-popup.entry.js.map +0 -1
- package/dist/core/esm/le-round-progress.entry.js +0 -104
- package/dist/core/esm/le-round-progress.entry.js.map +0 -1
- package/dist/core/esm/le-stack.entry.js +0 -133
- package/dist/core/esm/le-stack.entry.js.map +0 -1
- package/dist/core/esm/le-string-input.entry.js +0 -93
- package/dist/core/esm/le-string-input.entry.js.map +0 -1
- package/dist/core/esm/le-text.entry.js +0 -333
- package/dist/core/esm/le-text.entry.js.map +0 -1
- package/dist/core/esm/le-turntable.entry.js +0 -137
- package/dist/core/esm/le-turntable.entry.js.map +0 -1
- package/dist/core/esm/loader.js +0 -11
- package/dist/core/esm/loader.js.map +0 -1
- package/dist/core/esm/utils-Bxmld82M.js +0 -146
- package/dist/core/esm/utils-Bxmld82M.js.map +0 -1
- package/dist/core/index.cjs.js +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/le-kit/index.esm.js +0 -2
- package/dist/core/le-kit/index.esm.js.map +0 -1
- package/dist/core/le-kit/le-box.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-button.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-card.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-checkbox.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-kit.css +0 -1
- package/dist/core/le-kit/le-kit.esm.js +0 -2
- package/dist/core/le-kit/le-kit.esm.js.map +0 -1
- package/dist/core/le-kit/le-number-input.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-popover.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-popup.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-round-progress.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-stack.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-string-input.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-text.entry.esm.js.map +0 -1
- package/dist/core/le-kit/le-turntable.entry.esm.js.map +0 -1
- package/dist/core/le-kit/loader.esm.js.map +0 -1
- package/dist/core/le-kit/p-0308bd1f.entry.js +0 -2
- package/dist/core/le-kit/p-0308bd1f.entry.js.map +0 -1
- package/dist/core/le-kit/p-257495cc.entry.js +0 -2
- package/dist/core/le-kit/p-257495cc.entry.js.map +0 -1
- package/dist/core/le-kit/p-2ac4789a.entry.js +0 -2
- package/dist/core/le-kit/p-2ac4789a.entry.js.map +0 -1
- package/dist/core/le-kit/p-45eace7c.entry.js +0 -2
- package/dist/core/le-kit/p-45eace7c.entry.js.map +0 -1
- package/dist/core/le-kit/p-556086ca.entry.js +0 -2
- package/dist/core/le-kit/p-556086ca.entry.js.map +0 -1
- package/dist/core/le-kit/p-5ef81068.entry.js.map +0 -1
- package/dist/core/le-kit/p-66d35f48.entry.js +0 -2
- package/dist/core/le-kit/p-66d35f48.entry.js.map +0 -1
- package/dist/core/le-kit/p-73682c5e.entry.js +0 -2
- package/dist/core/le-kit/p-73682c5e.entry.js.map +0 -1
- package/dist/core/le-kit/p-CJ-z5Zj1.js +0 -3
- package/dist/core/le-kit/p-CJ-z5Zj1.js.map +0 -1
- package/dist/core/le-kit/p-Drz36PDp.js +0 -2
- package/dist/core/le-kit/p-Drz36PDp.js.map +0 -1
- package/dist/core/le-kit/p-aa6e906f.entry.js +0 -2
- package/dist/core/le-kit/p-aa6e906f.entry.js.map +0 -1
- package/dist/core/le-kit/p-d75214f9.entry.js +0 -2
- package/dist/core/le-kit/p-d75214f9.entry.js.map +0 -1
- package/dist/core/le-kit/p-df552906.entry.js.map +0 -1
- package/dist/core/le-kit/p-e0861e82.entry.js +0 -2
- package/dist/core/le-kit/p-e0861e82.entry.js.map +0 -1
- package/dist/core/loader/cdn.js +0 -1
- package/dist/core/loader/index.cjs.js +0 -1
- package/dist/core/loader/index.d.ts +0 -24
- package/dist/core/loader/index.es2017.js +0 -1
- package/dist/core/loader/index.js +0 -2
- package/dist/core/types/components/le-box/le-box.d.ts +0 -111
- package/dist/core/types/components/le-button/le-button.d.ts +0 -78
- package/dist/core/types/components/le-card/le-card.d.ts +0 -37
- package/dist/core/types/components/le-checkbox/le-checkbox.d.ts +0 -46
- package/dist/core/types/components/le-number-input/le-number-input.d.ts +0 -106
- package/dist/core/types/components/le-popover/le-popover.d.ts +0 -109
- package/dist/core/types/components/le-popup/le-popup.api.d.ts +0 -73
- package/dist/core/types/components/le-popup/le-popup.d.ts +0 -122
- package/dist/core/types/components/le-round-progress/le-round-progress.d.ts +0 -37
- package/dist/core/types/components/le-stack/le-stack.d.ts +0 -73
- package/dist/core/types/components/le-string-input/le-string-input.d.ts +0 -83
- package/dist/core/types/components/le-text/le-text.d.ts +0 -141
- package/dist/core/types/components/le-turntable/le-turntable.d.ts +0 -55
- package/dist/core/types/components.d.ts +0 -1752
- package/dist/core/types/global/app.d.ts +0 -73
- package/dist/core/types/index.d.ts +0 -15
- package/dist/core/types/stencil-public-runtime.d.ts +0 -1756
- package/dist/core/types/types/blocks.d.ts +0 -136
- package/dist/core/types/types/options.d.ts +0 -124
- package/dist/core/types/utils/utils.d.ts +0 -54
- package/dist/esm/index-CwNQ1GTa.js.map +0 -1
- package/dist/esm/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.js.map +0 -1
- package/dist/esm/le-popup.entry.js +0 -210
- package/dist/esm/le-popup.entry.js.map +0 -1
- package/dist/le-kit/assets/custom-elements.json +0 -4305
- package/dist/le-kit/dist/collection/themes/dark.css +0 -100
- package/dist/le-kit/dist/collection/themes/minimal.css +0 -100
- package/dist/le-kit/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.esm.js.map +0 -1
- package/dist/le-kit/le-popup.entry.esm.js.map +0 -1
- package/dist/le-kit/p-08dbcc25.entry.js +0 -2
- package/dist/le-kit/p-08dbcc25.entry.js.map +0 -1
- package/dist/le-kit/p-5dc35729.entry.js +0 -2
- package/dist/le-kit/p-5dc35729.entry.js.map +0 -1
- package/dist/le-kit/p-64374730.entry.js.map +0 -1
- package/dist/le-kit/p-79ec6f7c.entry.js.map +0 -1
- package/dist/le-kit/p-8daf3c7f.entry.js +0 -2
- package/dist/le-kit/p-8daf3c7f.entry.js.map +0 -1
- package/dist/le-kit/p-9c69235d.entry.js +0 -2
- package/dist/le-kit/p-9c69235d.entry.js.map +0 -1
- package/dist/le-kit/p-CwNQ1GTa.js +0 -3
- package/dist/le-kit/p-CwNQ1GTa.js.map +0 -1
- package/dist/le-kit/p-ad398acd.entry.js.map +0 -1
- package/dist/le-kit/p-b8122ad6.entry.js.map +0 -1
- package/dist/le-kit/p-f9008505.entry.js.map +0 -1
- package/dist/le-kit/p-y3FECAx9.js +0 -2
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { observeModeChanges } from "../../utils/utils";
|
|
3
|
-
/**
|
|
4
|
-
* A text component with rich text editing capabilities in admin mode.
|
|
5
|
-
*
|
|
6
|
-
* `le-text` renders semantic text elements (headings, paragraphs, code, quotes)
|
|
7
|
-
* and provides a Notion-like rich text editor in admin mode with formatting
|
|
8
|
-
* toolbar for bold, italic, links, and paragraph type selection.
|
|
9
|
-
*
|
|
10
|
-
* @slot - Default slot for text content
|
|
11
|
-
*
|
|
12
|
-
* @cssprop --le-text-color - Text color
|
|
13
|
-
* @cssprop --le-text-font-size - Font size
|
|
14
|
-
* @cssprop --le-text-line-height - Line height
|
|
15
|
-
* @cssprop --le-text-font-weight - Font weight
|
|
16
|
-
*
|
|
17
|
-
* @csspart text - The text container element
|
|
18
|
-
*
|
|
19
|
-
* @cmsEditable true
|
|
20
|
-
* @cmsCategory Content
|
|
21
|
-
*/
|
|
22
|
-
export class LeText {
|
|
23
|
-
el;
|
|
24
|
-
/**
|
|
25
|
-
* The semantic variant/type of text element
|
|
26
|
-
* @allowedValues p | h1 | h2 | h3 | h4 | h5 | h6 | code | quote | label | small
|
|
27
|
-
*/
|
|
28
|
-
variant = 'p';
|
|
29
|
-
/**
|
|
30
|
-
* Text alignment
|
|
31
|
-
* @allowedValues left | center | right | justify
|
|
32
|
-
*/
|
|
33
|
-
align = 'left';
|
|
34
|
-
/**
|
|
35
|
-
* Text color (CSS value or theme token)
|
|
36
|
-
*/
|
|
37
|
-
color;
|
|
38
|
-
/**
|
|
39
|
-
* Whether the text should truncate with ellipsis
|
|
40
|
-
*/
|
|
41
|
-
truncate = false;
|
|
42
|
-
/**
|
|
43
|
-
* Maximum number of lines before truncating (requires truncate=true)
|
|
44
|
-
*/
|
|
45
|
-
maxLines;
|
|
46
|
-
/**
|
|
47
|
-
* Internal state to track admin mode
|
|
48
|
-
*/
|
|
49
|
-
adminMode = false;
|
|
50
|
-
/**
|
|
51
|
-
* The HTML content being edited
|
|
52
|
-
*/
|
|
53
|
-
content = '';
|
|
54
|
-
/**
|
|
55
|
-
* Whether the editor is focused (shows toolbar)
|
|
56
|
-
*/
|
|
57
|
-
isFocused = false;
|
|
58
|
-
/**
|
|
59
|
-
* Current selection state for toolbar button highlighting
|
|
60
|
-
*/
|
|
61
|
-
selectionState = {
|
|
62
|
-
isBold: false,
|
|
63
|
-
isItalic: false,
|
|
64
|
-
isUnderline: false,
|
|
65
|
-
isStrikethrough: false,
|
|
66
|
-
isLink: false,
|
|
67
|
-
blockType: 'p',
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Reference to the contenteditable element
|
|
71
|
-
*/
|
|
72
|
-
editorRef;
|
|
73
|
-
/**
|
|
74
|
-
* Reference to the slot element
|
|
75
|
-
*/
|
|
76
|
-
slotRef;
|
|
77
|
-
disconnectModeObserver;
|
|
78
|
-
connectedCallback() {
|
|
79
|
-
this.disconnectModeObserver = observeModeChanges(this.el, (mode) => {
|
|
80
|
-
const wasAdmin = this.adminMode;
|
|
81
|
-
this.adminMode = mode === 'admin';
|
|
82
|
-
if (this.adminMode && !wasAdmin) {
|
|
83
|
-
// Entering admin mode - read content from slot
|
|
84
|
-
requestAnimationFrame(() => this.readSlottedContent());
|
|
85
|
-
}
|
|
86
|
-
else if (!this.adminMode && wasAdmin) {
|
|
87
|
-
// Leaving admin mode - sync content back to slot
|
|
88
|
-
this.syncContentToSlot();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
disconnectedCallback() {
|
|
93
|
-
this.disconnectModeObserver?.();
|
|
94
|
-
}
|
|
95
|
-
onVariantChange() {
|
|
96
|
-
// When variant changes in admin mode, update the content wrapper
|
|
97
|
-
if (this.adminMode && this.editorRef) {
|
|
98
|
-
this.syncContentToSlot();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Read content from slotted elements
|
|
103
|
-
*/
|
|
104
|
-
readSlottedContent() {
|
|
105
|
-
if (!this.slotRef)
|
|
106
|
-
return;
|
|
107
|
-
const assignedNodes = this.slotRef.assignedNodes({ flatten: true });
|
|
108
|
-
// Collect all content from assigned nodes
|
|
109
|
-
let html = '';
|
|
110
|
-
assignedNodes.forEach(node => {
|
|
111
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
112
|
-
html += node.textContent;
|
|
113
|
-
}
|
|
114
|
-
else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
115
|
-
html += node.innerHTML || node.textContent;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
this.content = html.trim();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Sync edited content back to the slot
|
|
122
|
-
*/
|
|
123
|
-
syncContentToSlot() {
|
|
124
|
-
if (!this.editorRef)
|
|
125
|
-
return;
|
|
126
|
-
const newContent = this.editorRef.innerHTML;
|
|
127
|
-
// Update the light DOM content
|
|
128
|
-
// We need to update the actual slotted content
|
|
129
|
-
const slot = this.slotRef;
|
|
130
|
-
if (slot) {
|
|
131
|
-
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
132
|
-
if (assignedNodes.length > 0) {
|
|
133
|
-
const firstNode = assignedNodes[0];
|
|
134
|
-
if (firstNode.nodeType === Node.ELEMENT_NODE) {
|
|
135
|
-
firstNode.innerHTML = newContent;
|
|
136
|
-
}
|
|
137
|
-
else if (firstNode.nodeType === Node.TEXT_NODE) {
|
|
138
|
-
// Replace text node with the new content
|
|
139
|
-
const parent = firstNode.parentNode;
|
|
140
|
-
if (parent) {
|
|
141
|
-
// Create a temporary element to parse HTML
|
|
142
|
-
const temp = document.createElement('span');
|
|
143
|
-
temp.innerHTML = newContent;
|
|
144
|
-
// Replace the text node
|
|
145
|
-
parent.replaceChild(temp, firstNode);
|
|
146
|
-
// Unwrap the span if it only contains text
|
|
147
|
-
if (temp.childNodes.length === 1 && temp.firstChild?.nodeType === Node.TEXT_NODE) {
|
|
148
|
-
parent.replaceChild(temp.firstChild, temp);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
// No assigned nodes, set innerHTML on the host's light DOM
|
|
155
|
-
this.el.innerHTML = newContent;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Handle input in the contenteditable
|
|
161
|
-
*/
|
|
162
|
-
handleInput = () => {
|
|
163
|
-
if (this.editorRef) {
|
|
164
|
-
this.content = this.editorRef.innerHTML;
|
|
165
|
-
this.updateSelectionState();
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Handle focus on the editor
|
|
170
|
-
*/
|
|
171
|
-
handleFocus = () => {
|
|
172
|
-
this.isFocused = true;
|
|
173
|
-
this.updateSelectionState();
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Handle blur on the editor
|
|
177
|
-
*/
|
|
178
|
-
handleBlur = (e) => {
|
|
179
|
-
// Check if focus moved to toolbar
|
|
180
|
-
const relatedTarget = e.relatedTarget;
|
|
181
|
-
const toolbar = this.el.shadowRoot?.querySelector('.le-text-toolbar');
|
|
182
|
-
if (toolbar?.contains(relatedTarget)) {
|
|
183
|
-
// Focus moved to toolbar, keep it open
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
// Small delay to allow toolbar clicks to register
|
|
187
|
-
setTimeout(() => {
|
|
188
|
-
if (!this.el.shadowRoot?.activeElement) {
|
|
189
|
-
this.isFocused = false;
|
|
190
|
-
this.syncContentToSlot();
|
|
191
|
-
}
|
|
192
|
-
}, 150);
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Handle selection change to update toolbar state
|
|
196
|
-
*/
|
|
197
|
-
handleSelectionChange = () => {
|
|
198
|
-
this.updateSelectionState();
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* Update the selection state for toolbar highlighting
|
|
202
|
-
*/
|
|
203
|
-
updateSelectionState() {
|
|
204
|
-
const selection = window.getSelection();
|
|
205
|
-
if (!selection || selection.rangeCount === 0)
|
|
206
|
-
return;
|
|
207
|
-
this.selectionState = {
|
|
208
|
-
isBold: document.queryCommandState('bold'),
|
|
209
|
-
isItalic: document.queryCommandState('italic'),
|
|
210
|
-
isUnderline: document.queryCommandState('underline'),
|
|
211
|
-
isStrikethrough: document.queryCommandState('strikeThrough'),
|
|
212
|
-
isLink: this.isSelectionInLink(selection),
|
|
213
|
-
blockType: this.variant,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Check if current selection is within a link
|
|
218
|
-
*/
|
|
219
|
-
isSelectionInLink(selection) {
|
|
220
|
-
if (!selection.anchorNode)
|
|
221
|
-
return false;
|
|
222
|
-
let node = selection.anchorNode;
|
|
223
|
-
while (node && node !== this.editorRef) {
|
|
224
|
-
if (node.nodeName === 'A')
|
|
225
|
-
return true;
|
|
226
|
-
node = node.parentNode;
|
|
227
|
-
}
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Execute a formatting command
|
|
232
|
-
*/
|
|
233
|
-
execCommand(command, value) {
|
|
234
|
-
// Focus the editor first
|
|
235
|
-
this.editorRef?.focus();
|
|
236
|
-
// Execute the command
|
|
237
|
-
document.execCommand(command, false, value);
|
|
238
|
-
// Update state
|
|
239
|
-
this.handleInput();
|
|
240
|
-
this.updateSelectionState();
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Toggle bold formatting
|
|
244
|
-
*/
|
|
245
|
-
toggleBold = (e) => {
|
|
246
|
-
e.preventDefault();
|
|
247
|
-
this.execCommand('bold');
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* Toggle italic formatting
|
|
251
|
-
*/
|
|
252
|
-
toggleItalic = (e) => {
|
|
253
|
-
e.preventDefault();
|
|
254
|
-
this.execCommand('italic');
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* Toggle underline formatting
|
|
258
|
-
*/
|
|
259
|
-
toggleUnderline = (e) => {
|
|
260
|
-
e.preventDefault();
|
|
261
|
-
this.execCommand('underline');
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* Toggle strikethrough formatting
|
|
265
|
-
*/
|
|
266
|
-
toggleStrikethrough = (e) => {
|
|
267
|
-
e.preventDefault();
|
|
268
|
-
this.execCommand('strikeThrough');
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Add or edit a link
|
|
272
|
-
*/
|
|
273
|
-
toggleLink = (e) => {
|
|
274
|
-
e.preventDefault();
|
|
275
|
-
if (this.selectionState.isLink) {
|
|
276
|
-
// Remove link
|
|
277
|
-
this.execCommand('unlink');
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
// Add link
|
|
281
|
-
const url = prompt('Enter URL:', 'https://');
|
|
282
|
-
if (url) {
|
|
283
|
-
this.execCommand('createLink', url);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* Change the block type/variant
|
|
289
|
-
*/
|
|
290
|
-
changeVariant = (e) => {
|
|
291
|
-
const select = e.target;
|
|
292
|
-
this.variant = select.value;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Render the formatting toolbar
|
|
296
|
-
*/
|
|
297
|
-
renderToolbar() {
|
|
298
|
-
return (h("div", { class: "le-text-toolbar" }, h("select", { class: "le-text-toolbar-select", onChange: this.changeVariant, onMouseDown: (e) => e.preventDefault() }, h("option", { value: "p", selected: this.variant === 'p' }, "Paragraph"), h("option", { value: "h1", selected: this.variant === 'h1' }, "Heading 1"), h("option", { value: "h2", selected: this.variant === 'h2' }, "Heading 2"), h("option", { value: "h3", selected: this.variant === 'h3' }, "Heading 3"), h("option", { value: "h4", selected: this.variant === 'h4' }, "Heading 4"), h("option", { value: "h5", selected: this.variant === 'h5' }, "Heading 5"), h("option", { value: "h6", selected: this.variant === 'h6' }, "Heading 6"), h("option", { value: "quote", selected: this.variant === 'quote' }, "Quote"), h("option", { value: "code", selected: this.variant === 'code' }, "Code"), h("option", { value: "label", selected: this.variant === 'label' }, "Label"), h("option", { value: "small", selected: this.variant === 'small' }, "Small")), h("div", { class: "le-text-toolbar-divider" }), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isBold }, onMouseDown: this.toggleBold, title: "Bold (Ctrl+B)" }, h("strong", null, "B")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isItalic }, onMouseDown: this.toggleItalic, title: "Italic (Ctrl+I)" }, h("em", null, "I")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isUnderline }, onMouseDown: this.toggleUnderline, title: "Underline (Ctrl+U)" }, h("span", { style: { textDecoration: 'underline' } }, "U")), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isStrikethrough }, onMouseDown: this.toggleStrikethrough, title: "Strikethrough" }, h("span", { style: { textDecoration: 'line-through' } }, "S")), h("div", { class: "le-text-toolbar-divider" }), h("button", { type: "button", class: { 'le-text-toolbar-btn': true, 'active': this.selectionState.isLink }, onMouseDown: this.toggleLink, title: this.selectionState.isLink ? 'Remove link' : 'Add link' }, "\uD83D\uDD17")));
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Get the semantic tag for the current variant
|
|
302
|
-
*/
|
|
303
|
-
getTag() {
|
|
304
|
-
switch (this.variant) {
|
|
305
|
-
case 'quote':
|
|
306
|
-
return 'blockquote';
|
|
307
|
-
case 'code':
|
|
308
|
-
return 'pre';
|
|
309
|
-
case 'label':
|
|
310
|
-
return 'label';
|
|
311
|
-
case 'small':
|
|
312
|
-
return 'small';
|
|
313
|
-
default:
|
|
314
|
-
return this.variant; // h1-h6, p
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
render() {
|
|
318
|
-
const Tag = this.getTag();
|
|
319
|
-
const textStyle = {};
|
|
320
|
-
if (this.color) {
|
|
321
|
-
textStyle.color = this.color;
|
|
322
|
-
}
|
|
323
|
-
if (this.align) {
|
|
324
|
-
textStyle.textAlign = this.align;
|
|
325
|
-
}
|
|
326
|
-
const textClass = {
|
|
327
|
-
'le-text': true,
|
|
328
|
-
[`variant-${this.variant}`]: true,
|
|
329
|
-
'truncate': this.truncate,
|
|
330
|
-
[`max-lines-${this.maxLines}`]: this.truncate && this.maxLines,
|
|
331
|
-
};
|
|
332
|
-
// Admin mode - show rich text editor
|
|
333
|
-
if (this.adminMode) {
|
|
334
|
-
return (h(Host, { class: "admin-mode" }, h("div", { class: "le-text-editor-wrapper" }, this.isFocused && this.renderToolbar(), h(Tag, { class: textClass, part: "text", style: textStyle }, h("div", { ref: (el) => this.editorRef = el, class: "le-text-editor", contentEditable: true, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyUp: this.handleSelectionChange, onMouseUp: this.handleSelectionChange, innerHTML: this.content })), h("div", { class: "hidden-slot" }, h("slot", { ref: (el) => this.slotRef = el, onSlotchange: () => this.readSlottedContent() })))));
|
|
335
|
-
}
|
|
336
|
-
// Default mode - render semantic element with slotted content
|
|
337
|
-
return (h(Host, null, h(Tag, { class: textClass, part: "text", style: textStyle }, h("slot", { ref: (el) => this.slotRef = el }))));
|
|
338
|
-
}
|
|
339
|
-
static get is() { return "le-text"; }
|
|
340
|
-
static get encapsulation() { return "shadow"; }
|
|
341
|
-
static get originalStyleUrls() {
|
|
342
|
-
return {
|
|
343
|
-
"$": ["le-text.default.css"]
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
static get styleUrls() {
|
|
347
|
-
return {
|
|
348
|
-
"$": ["le-text.default.css"]
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
static get properties() {
|
|
352
|
-
return {
|
|
353
|
-
"variant": {
|
|
354
|
-
"type": "string",
|
|
355
|
-
"mutable": true,
|
|
356
|
-
"complexType": {
|
|
357
|
-
"original": "'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'code' | 'quote' | 'label' | 'small'",
|
|
358
|
-
"resolved": "\"code\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"label\" | \"p\" | \"quote\" | \"small\"",
|
|
359
|
-
"references": {}
|
|
360
|
-
},
|
|
361
|
-
"required": false,
|
|
362
|
-
"optional": false,
|
|
363
|
-
"docs": {
|
|
364
|
-
"tags": [{
|
|
365
|
-
"name": "allowedValues",
|
|
366
|
-
"text": "p | h1 | h2 | h3 | h4 | h5 | h6 | code | quote | label | small"
|
|
367
|
-
}],
|
|
368
|
-
"text": "The semantic variant/type of text element"
|
|
369
|
-
},
|
|
370
|
-
"getter": false,
|
|
371
|
-
"setter": false,
|
|
372
|
-
"reflect": true,
|
|
373
|
-
"attribute": "variant",
|
|
374
|
-
"defaultValue": "'p'"
|
|
375
|
-
},
|
|
376
|
-
"align": {
|
|
377
|
-
"type": "string",
|
|
378
|
-
"mutable": false,
|
|
379
|
-
"complexType": {
|
|
380
|
-
"original": "'left' | 'center' | 'right' | 'justify'",
|
|
381
|
-
"resolved": "\"center\" | \"justify\" | \"left\" | \"right\"",
|
|
382
|
-
"references": {}
|
|
383
|
-
},
|
|
384
|
-
"required": false,
|
|
385
|
-
"optional": false,
|
|
386
|
-
"docs": {
|
|
387
|
-
"tags": [{
|
|
388
|
-
"name": "allowedValues",
|
|
389
|
-
"text": "left | center | right | justify"
|
|
390
|
-
}],
|
|
391
|
-
"text": "Text alignment"
|
|
392
|
-
},
|
|
393
|
-
"getter": false,
|
|
394
|
-
"setter": false,
|
|
395
|
-
"reflect": true,
|
|
396
|
-
"attribute": "align",
|
|
397
|
-
"defaultValue": "'left'"
|
|
398
|
-
},
|
|
399
|
-
"color": {
|
|
400
|
-
"type": "string",
|
|
401
|
-
"mutable": false,
|
|
402
|
-
"complexType": {
|
|
403
|
-
"original": "string",
|
|
404
|
-
"resolved": "string",
|
|
405
|
-
"references": {}
|
|
406
|
-
},
|
|
407
|
-
"required": false,
|
|
408
|
-
"optional": true,
|
|
409
|
-
"docs": {
|
|
410
|
-
"tags": [],
|
|
411
|
-
"text": "Text color (CSS value or theme token)"
|
|
412
|
-
},
|
|
413
|
-
"getter": false,
|
|
414
|
-
"setter": false,
|
|
415
|
-
"reflect": false,
|
|
416
|
-
"attribute": "color"
|
|
417
|
-
},
|
|
418
|
-
"truncate": {
|
|
419
|
-
"type": "boolean",
|
|
420
|
-
"mutable": false,
|
|
421
|
-
"complexType": {
|
|
422
|
-
"original": "boolean",
|
|
423
|
-
"resolved": "boolean",
|
|
424
|
-
"references": {}
|
|
425
|
-
},
|
|
426
|
-
"required": false,
|
|
427
|
-
"optional": false,
|
|
428
|
-
"docs": {
|
|
429
|
-
"tags": [],
|
|
430
|
-
"text": "Whether the text should truncate with ellipsis"
|
|
431
|
-
},
|
|
432
|
-
"getter": false,
|
|
433
|
-
"setter": false,
|
|
434
|
-
"reflect": false,
|
|
435
|
-
"attribute": "truncate",
|
|
436
|
-
"defaultValue": "false"
|
|
437
|
-
},
|
|
438
|
-
"maxLines": {
|
|
439
|
-
"type": "number",
|
|
440
|
-
"mutable": false,
|
|
441
|
-
"complexType": {
|
|
442
|
-
"original": "number",
|
|
443
|
-
"resolved": "number",
|
|
444
|
-
"references": {}
|
|
445
|
-
},
|
|
446
|
-
"required": false,
|
|
447
|
-
"optional": true,
|
|
448
|
-
"docs": {
|
|
449
|
-
"tags": [],
|
|
450
|
-
"text": "Maximum number of lines before truncating (requires truncate=true)"
|
|
451
|
-
},
|
|
452
|
-
"getter": false,
|
|
453
|
-
"setter": false,
|
|
454
|
-
"reflect": false,
|
|
455
|
-
"attribute": "max-lines"
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
static get states() {
|
|
460
|
-
return {
|
|
461
|
-
"adminMode": {},
|
|
462
|
-
"content": {},
|
|
463
|
-
"isFocused": {},
|
|
464
|
-
"selectionState": {}
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
static get elementRef() { return "el"; }
|
|
468
|
-
static get watchers() {
|
|
469
|
-
return [{
|
|
470
|
-
"propName": "variant",
|
|
471
|
-
"methodName": "onVariantChange"
|
|
472
|
-
}];
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
//# sourceMappingURL=le-text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"le-text.js","sourceRoot":"","sources":["../../../src-core/components/le-text/le-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AAMH,MAAM,OAAO,MAAM;IACN,EAAE,CAAc;IAE3B;;;OAGG;IACqC,OAAO,GAAyF,GAAG,CAAC;IAE5I;;;OAGG;IACsB,KAAK,GAA4C,MAAM,CAAC;IAEjF;;OAEG;IACK,KAAK,CAAU;IAEvB;;OAEG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,QAAQ,CAAU;IAE1B;;OAEG;IACc,SAAS,GAAY,KAAK,CAAC;IAE5C;;OAEG;IACc,OAAO,GAAW,EAAE,CAAC;IAEtC;;OAEG;IACc,SAAS,GAAY,KAAK,CAAC;IAE5C;;OAEG;IACc,cAAc,GAAmB;QAChD,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,KAAK;QACtB,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,GAAG;KACf,CAAC;IAEF;;OAEG;I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AAK,EAAC,wBAAwB;oBAChC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,aAAa,EAAE;oBACvC,EAAC,GAAG,IACF,KAAK,EAAE,SAAS,EAChB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,SAAS;wBAEhB,WACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,EAChC,KAAK,EAAC,gBAAgB,EACtB,eAAe,EAAE,IAAI,EACrB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,qBAAqB,EACnC,SAAS,EAAE,IAAI,CAAC,qBAAqB,EACrC,SAAS,EAAE,IAAI,CAAC,OAAO,GAClB,CACH;oBAEN,WAAK,KAAK,EAAC,aAAa;wBACtB,YACE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,EAAqB,EACjD,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,GACvC,CACJ,CACF,CAEH,CACR,CAAC;QACJ,CAAC;QAED,8DAA8D;QAC9D,OAAO,CACL,EAAC,IAAI;YACH,EAAC,GAAG,IACF,KAAK,EAAE,SAAS,EAChB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,SAAS;gBAEhB,YAAM,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,GAAG,EAAqB,GAAS,CAC5D,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Host, Element, Watch } from '@stencil/core';\nimport { observeModeChanges } from '../../utils/utils';\n\n/**\n * A text component with rich text editing capabilities in admin mode.\n *\n * `le-text` renders semantic text elements (headings, paragraphs, code, quotes)\n * and provides a Notion-like rich text editor in admin mode with formatting\n * toolbar for bold, italic, links, and paragraph type selection.\n *\n * @slot - Default slot for text content\n *\n * @cssprop --le-text-color - Text color\n * @cssprop --le-text-font-size - Font size\n * @cssprop --le-text-line-height - Line height\n * @cssprop --le-text-font-weight - Font weight\n *\n * @csspart text - The text container element\n *\n * @cmsEditable true\n * @cmsCategory Content\n */\n@Component({\n tag: 'le-text',\n styleUrl: 'le-text.default.css',\n shadow: true,\n})\nexport class LeText {\n @Element() el: HTMLElement;\n\n /**\n * The semantic variant/type of text element\n * @allowedValues p | h1 | h2 | h3 | h4 | h5 | h6 | code | quote | label | small\n */\n @Prop({ mutable: true, reflect: true }) variant: 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'code' | 'quote' | 'label' | 'small' = 'p';\n\n /**\n * Text alignment\n * @allowedValues left | center | right | justify\n */\n @Prop({ reflect: true }) align: 'left' | 'center' | 'right' | 'justify' = 'left';\n\n /**\n * Text color (CSS value or theme token)\n */\n @Prop() color?: string;\n\n /**\n * Whether the text should truncate with ellipsis\n */\n @Prop() truncate: boolean = false;\n\n /**\n * Maximum number of lines before truncating (requires truncate=true)\n */\n @Prop() maxLines?: number;\n\n /**\n * Internal state to track admin mode\n */\n @State() private adminMode: boolean = false;\n\n /**\n * The HTML content being edited\n */\n @State() private content: string = '';\n\n /**\n * Whether the editor is focused (shows toolbar)\n */\n @State() private isFocused: boolean = false;\n\n /**\n * Current selection state for toolbar button highlighting\n */\n @State() private selectionState: SelectionState = {\n isBold: false,\n isItalic: false,\n isUnderline: false,\n isStrikethrough: false,\n isLink: false,\n blockType: 'p',\n };\n\n /**\n * Reference to the contenteditable element\n */\n private editorRef?: HTMLDivElement;\n\n /**\n * Reference to the slot element\n */\n private slotRef?: HTMLSlotElement;\n\n private disconnectModeObserver?: () => void;\n\n connectedCallback() {\n this.disconnectModeObserver = observeModeChanges(this.el, (mode) => {\n const wasAdmin = this.adminMode;\n this.adminMode = mode === 'admin';\n \n if (this.adminMode && !wasAdmin) {\n // Entering admin mode - read content from slot\n requestAnimationFrame(() => this.readSlottedContent());\n } else if (!this.adminMode && wasAdmin) {\n // Leaving admin mode - sync content back to slot\n this.syncContentToSlot();\n }\n });\n }\n\n disconnectedCallback() {\n this.disconnectModeObserver?.();\n }\n\n @Watch('variant')\n onVariantChange() {\n // When variant changes in admin mode, update the content wrapper\n if (this.adminMode && this.editorRef) {\n this.syncContentToSlot();\n }\n }\n\n /**\n * Read content from slotted elements\n */\n private readSlottedContent() {\n if (!this.slotRef) return;\n \n const assignedNodes = this.slotRef.assignedNodes({ flatten: true });\n \n // Collect all content from assigned nodes\n let html = '';\n assignedNodes.forEach(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n html += node.textContent;\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n html += (node as Element).innerHTML || node.textContent;\n }\n });\n \n this.content = html.trim();\n }\n\n /**\n * Sync edited content back to the slot\n */\n private syncContentToSlot() {\n if (!this.editorRef) return;\n \n const newContent = this.editorRef.innerHTML;\n \n // Update the light DOM content\n // We need to update the actual slotted content\n const slot = this.slotRef;\n if (slot) {\n const assignedNodes = slot.assignedNodes({ flatten: true });\n if (assignedNodes.length > 0) {\n const firstNode = assignedNodes[0];\n if (firstNode.nodeType === Node.ELEMENT_NODE) {\n (firstNode as Element).innerHTML = newContent;\n } else if (firstNode.nodeType === Node.TEXT_NODE) {\n // Replace text node with the new content\n const parent = firstNode.parentNode;\n if (parent) {\n // Create a temporary element to parse HTML\n const temp = document.createElement('span');\n temp.innerHTML = newContent;\n // Replace the text node\n parent.replaceChild(temp, firstNode);\n // Unwrap the span if it only contains text\n if (temp.childNodes.length === 1 && temp.firstChild?.nodeType === Node.TEXT_NODE) {\n parent.replaceChild(temp.firstChild, temp);\n }\n }\n }\n } else {\n // No assigned nodes, set innerHTML on the host's light DOM\n this.el.innerHTML = newContent;\n }\n }\n }\n\n /**\n * Handle input in the contenteditable\n */\n private handleInput = () => {\n if (this.editorRef) {\n this.content = this.editorRef.innerHTML;\n this.updateSelectionState();\n }\n };\n\n /**\n * Handle focus on the editor\n */\n private handleFocus = () => {\n this.isFocused = true;\n this.updateSelectionState();\n };\n\n /**\n * Handle blur on the editor\n */\n private handleBlur = (e: FocusEvent) => {\n // Check if focus moved to toolbar\n const relatedTarget = e.relatedTarget as HTMLElement;\n const toolbar = this.el.shadowRoot?.querySelector('.le-text-toolbar');\n \n if (toolbar?.contains(relatedTarget)) {\n // Focus moved to toolbar, keep it open\n return;\n }\n \n // Small delay to allow toolbar clicks to register\n setTimeout(() => {\n if (!this.el.shadowRoot?.activeElement) {\n this.isFocused = false;\n this.syncContentToSlot();\n }\n }, 150);\n };\n\n /**\n * Handle selection change to update toolbar state\n */\n private handleSelectionChange = () => {\n this.updateSelectionState();\n };\n\n /**\n * Update the selection state for toolbar highlighting\n */\n private updateSelectionState() {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n this.selectionState = {\n isBold: document.queryCommandState('bold'),\n isItalic: document.queryCommandState('italic'),\n isUnderline: document.queryCommandState('underline'),\n isStrikethrough: document.queryCommandState('strikeThrough'),\n isLink: this.isSelectionInLink(selection),\n blockType: this.variant,\n };\n }\n\n /**\n * Check if current selection is within a link\n */\n private isSelectionInLink(selection: Selection): boolean {\n if (!selection.anchorNode) return false;\n \n let node: Node | null = selection.anchorNode;\n while (node && node !== this.editorRef) {\n if (node.nodeName === 'A') return true;\n node = node.parentNode;\n }\n return false;\n }\n\n /**\n * Execute a formatting command\n */\n private execCommand(command: string, value?: string) {\n // Focus the editor first\n this.editorRef?.focus();\n \n // Execute the command\n document.execCommand(command, false, value);\n \n // Update state\n this.handleInput();\n this.updateSelectionState();\n }\n\n /**\n * Toggle bold formatting\n */\n private toggleBold = (e: Event) => {\n e.preventDefault();\n this.execCommand('bold');\n };\n\n /**\n * Toggle italic formatting\n */\n private toggleItalic = (e: Event) => {\n e.preventDefault();\n this.execCommand('italic');\n };\n\n /**\n * Toggle underline formatting\n */\n private toggleUnderline = (e: Event) => {\n e.preventDefault();\n this.execCommand('underline');\n };\n\n /**\n * Toggle strikethrough formatting\n */\n private toggleStrikethrough = (e: Event) => {\n e.preventDefault();\n this.execCommand('strikeThrough');\n };\n\n /**\n * Add or edit a link\n */\n private toggleLink = (e: Event) => {\n e.preventDefault();\n \n if (this.selectionState.isLink) {\n // Remove link\n this.execCommand('unlink');\n } else {\n // Add link\n const url = prompt('Enter URL:', 'https://');\n if (url) {\n this.execCommand('createLink', url);\n }\n }\n };\n\n /**\n * Change the block type/variant\n */\n private changeVariant = (e: Event) => {\n const select = e.target as HTMLSelectElement;\n this.variant = select.value as typeof this.variant;\n };\n\n /**\n * Render the formatting toolbar\n */\n private renderToolbar() {\n return (\n <div class=\"le-text-toolbar\">\n <select \n class=\"le-text-toolbar-select\"\n onChange={this.changeVariant}\n onMouseDown={(e) => e.preventDefault()}\n >\n <option value=\"p\" selected={this.variant === 'p'}>Paragraph</option>\n <option value=\"h1\" selected={this.variant === 'h1'}>Heading 1</option>\n <option value=\"h2\" selected={this.variant === 'h2'}>Heading 2</option>\n <option value=\"h3\" selected={this.variant === 'h3'}>Heading 3</option>\n <option value=\"h4\" selected={this.variant === 'h4'}>Heading 4</option>\n <option value=\"h5\" selected={this.variant === 'h5'}>Heading 5</option>\n <option value=\"h6\" selected={this.variant === 'h6'}>Heading 6</option>\n <option value=\"quote\" selected={this.variant === 'quote'}>Quote</option>\n <option value=\"code\" selected={this.variant === 'code'}>Code</option>\n <option value=\"label\" selected={this.variant === 'label'}>Label</option>\n <option value=\"small\" selected={this.variant === 'small'}>Small</option>\n </select>\n \n <div class=\"le-text-toolbar-divider\"></div>\n \n <button\n type=\"button\"\n class={{ 'le-text-toolbar-btn': true, 'active': this.selectionState.isBold }}\n onMouseDown={this.toggleBold}\n title=\"Bold (Ctrl+B)\"\n >\n <strong>B</strong>\n </button>\n \n <button\n type=\"button\"\n class={{ 'le-text-toolbar-btn': true, 'active': this.selectionState.isItalic }}\n onMouseDown={this.toggleItalic}\n title=\"Italic (Ctrl+I)\"\n >\n <em>I</em>\n </button>\n \n <button\n type=\"button\"\n class={{ 'le-text-toolbar-btn': true, 'active': this.selectionState.isUnderline }}\n onMouseDown={this.toggleUnderline}\n title=\"Underline (Ctrl+U)\"\n >\n <span style={{ textDecoration: 'underline' }}>U</span>\n </button>\n \n <button\n type=\"button\"\n class={{ 'le-text-toolbar-btn': true, 'active': this.selectionState.isStrikethrough }}\n onMouseDown={this.toggleStrikethrough}\n title=\"Strikethrough\"\n >\n <span style={{ textDecoration: 'line-through' }}>S</span>\n </button>\n \n <div class=\"le-text-toolbar-divider\"></div>\n \n <button\n type=\"button\"\n class={{ 'le-text-toolbar-btn': true, 'active': this.selectionState.isLink }}\n onMouseDown={this.toggleLink}\n title={this.selectionState.isLink ? 'Remove link' : 'Add link'}\n >\n 🔗\n </button>\n </div>\n );\n }\n\n /**\n * Get the semantic tag for the current variant\n */\n private getTag(): string {\n switch (this.variant) {\n case 'quote':\n return 'blockquote';\n case 'code':\n return 'pre';\n case 'label':\n return 'label';\n case 'small':\n return 'small';\n default:\n return this.variant; // h1-h6, p\n }\n }\n\n render() {\n const Tag = this.getTag();\n \n const textStyle: { [key: string]: string } = {};\n if (this.color) {\n textStyle.color = this.color;\n }\n if (this.align) {\n textStyle.textAlign = this.align;\n }\n\n const textClass = {\n 'le-text': true,\n [`variant-${this.variant}`]: true,\n 'truncate': this.truncate,\n [`max-lines-${this.maxLines}`]: this.truncate && this.maxLines,\n };\n\n // Admin mode - show rich text editor\n if (this.adminMode) {\n return (\n <Host class=\"admin-mode\">\n \n <div class=\"le-text-editor-wrapper\">\n {this.isFocused && this.renderToolbar()}\n <Tag \n class={textClass}\n part=\"text\"\n style={textStyle}\n >\n <div\n ref={(el) => this.editorRef = el}\n class=\"le-text-editor\"\n contentEditable={true}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onKeyUp={this.handleSelectionChange}\n onMouseUp={this.handleSelectionChange}\n innerHTML={this.content}\n ></div>\n </Tag>\n {/* Hidden slot to receive light DOM content */}\n <div class=\"hidden-slot\">\n <slot \n ref={(el) => this.slotRef = el as HTMLSlotElement}\n onSlotchange={() => this.readSlottedContent()}\n ></slot>\n </div>\n </div>\n \n </Host>\n );\n }\n\n // Default mode - render semantic element with slotted content\n return (\n <Host>\n <Tag \n class={textClass}\n part=\"text\"\n style={textStyle}\n >\n <slot ref={(el) => this.slotRef = el as HTMLSlotElement}></slot>\n </Tag>\n </Host>\n );\n }\n}\n\n/**\n * Selection state for toolbar\n */\ninterface SelectionState {\n isBold: boolean;\n isItalic: boolean;\n isUnderline: boolean;\n isStrikethrough: boolean;\n isLink: boolean;\n blockType: string;\n}\n"]}
|