le-kit 0.1.13 → 0.1.14
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/core/cjs/{index-BsRb_UTe.js → index-B0mg71He.js} +6 -6
- package/dist/core/cjs/index-B0mg71He.js.map +1 -0
- package/dist/core/cjs/index.cjs.js +2 -2
- package/dist/core/cjs/le-box.cjs.entry.js +2 -2
- package/dist/core/cjs/le-button.cjs.entry.js +2 -2
- package/dist/core/cjs/le-card.cjs.entry.js +2 -2
- package/dist/core/cjs/le-checkbox.cjs.entry.js +2 -2
- package/dist/core/cjs/le-kit.cjs.js +1 -1
- package/dist/core/cjs/le-number-input.cjs.entry.js +2 -2
- package/dist/core/cjs/le-popover.cjs.entry.js +1 -1
- package/dist/core/cjs/le-popup.cjs.entry.js +1 -1
- package/dist/core/cjs/le-round-progress.cjs.entry.js +1 -1
- package/dist/core/cjs/le-stack.cjs.entry.js +2 -2
- package/dist/core/cjs/le-string-input.cjs.entry.js +2 -2
- package/dist/core/cjs/le-text.cjs.entry.js +2 -2
- package/dist/core/cjs/le-turntable.cjs.entry.js +1 -1
- package/dist/core/cjs/loader.cjs.js +1 -1
- package/dist/{cjs/utils-DqhadIxH.js → core/cjs/utils-jdqP71LP.js} +3 -3
- package/dist/core/cjs/{utils-nsP8_w8_.js.map → utils-jdqP71LP.js.map} +1 -1
- package/dist/core/collection/global/app.js +4 -4
- package/dist/core/collection/global/app.js.map +1 -1
- package/dist/core/components/index.js.map +1 -1
- package/dist/core/components/le-box.js +34 -2
- package/dist/core/components/le-box.js.map +1 -1
- package/dist/core/components/le-button.js +1 -1
- package/dist/core/components/le-button2.js +1031 -6
- package/dist/core/components/le-button2.js.map +1 -1
- package/dist/core/components/le-card.js +36 -4
- package/dist/core/components/le-card.js.map +1 -1
- package/dist/core/components/le-checkbox.js +1 -79
- package/dist/core/components/le-checkbox.js.map +1 -1
- package/dist/core/components/le-component.d.ts +11 -0
- package/dist/core/components/le-number-input.js +30 -4
- package/dist/core/components/le-number-input.js.map +1 -1
- package/dist/core/components/le-popover.js +1 -377
- package/dist/core/components/le-popover.js.map +1 -1
- package/dist/core/components/le-popup.js +30 -4
- package/dist/core/components/le-popup.js.map +1 -1
- package/dist/core/components/le-round-progress.js +1 -1
- package/dist/core/components/le-round-progress.js.map +1 -1
- package/dist/core/components/le-slot.d.ts +11 -0
- package/dist/core/components/le-stack.js +36 -4
- package/dist/core/components/le-stack.js.map +1 -1
- package/dist/core/components/le-string-input.js +1 -119
- package/dist/core/components/le-string-input.js.map +1 -1
- package/dist/core/components/le-text.js +34 -2
- package/dist/core/components/le-text.js.map +1 -1
- package/dist/core/components/le-turntable.js +1 -1
- package/dist/core/components/le-turntable.js.map +1 -1
- package/dist/core/components/utils.js +4 -4
- package/dist/core/components/utils.js.map +1 -1
- package/dist/core/esm/{index-CJ-z5Zj1.js → index-SKsXnjWI.js} +6 -6
- package/dist/core/{le-kit/p-CJ-z5Zj1.js.map → esm/index-SKsXnjWI.js.map} +1 -1
- package/dist/core/esm/index.js +2 -2
- package/dist/core/esm/le-box.entry.js +2 -2
- package/dist/core/esm/le-button.entry.js +2 -2
- package/dist/core/esm/le-card.entry.js +2 -2
- package/dist/core/esm/le-checkbox.entry.js +2 -2
- package/dist/core/esm/le-kit.js +2 -2
- package/dist/core/esm/le-number-input.entry.js +2 -2
- package/dist/core/esm/le-popover.entry.js +1 -1
- package/dist/core/esm/le-popup.entry.js +1 -1
- package/dist/core/esm/le-round-progress.entry.js +1 -1
- package/dist/core/esm/le-stack.entry.js +2 -2
- package/dist/core/esm/le-string-input.entry.js +2 -2
- package/dist/core/esm/le-text.entry.js +2 -2
- package/dist/core/esm/le-turntable.entry.js +1 -1
- package/dist/core/esm/loader.js +2 -2
- package/dist/{esm/utils-Cf7fMI0j.js → core/esm/utils-DZdP1JiG.js} +3 -3
- package/dist/core/esm/{utils-Bxmld82M.js.map → utils-DZdP1JiG.js.map} +1 -1
- package/dist/core/le-kit/index.esm.js +1 -1
- package/dist/core/le-kit/le-kit.esm.js +1 -1
- package/dist/core/le-kit/p--VxUdzYV.js +2 -0
- package/dist/core/le-kit/{p-Drz36PDp.js.map → p--VxUdzYV.js.map} +1 -1
- package/dist/core/le-kit/{p-2ac4789a.entry.js → p-189cb775.entry.js} +2 -2
- package/dist/core/le-kit/{p-556086ca.entry.js → p-35c1d413.entry.js} +2 -2
- package/dist/core/le-kit/{p-aa6e906f.entry.js → p-4f133e72.entry.js} +2 -2
- package/dist/core/le-kit/{p-df552906.entry.js → p-55f70091.entry.js} +2 -2
- package/dist/core/le-kit/{p-e0861e82.entry.js → p-5fd7b23a.entry.js} +2 -2
- package/dist/core/le-kit/{p-5ef81068.entry.js → p-6e414a5c.entry.js} +2 -2
- package/dist/core/le-kit/{p-d75214f9.entry.js → p-7b121ca7.entry.js} +2 -2
- package/dist/core/le-kit/{p-45eace7c.entry.js → p-8c81fa95.entry.js} +2 -2
- package/dist/core/le-kit/{p-257495cc.entry.js → p-9aa81442.entry.js} +2 -2
- package/dist/core/le-kit/p-SKsXnjWI.js +3 -0
- package/dist/core/le-kit/p-SKsXnjWI.js.map +1 -0
- package/dist/core/le-kit/{p-66d35f48.entry.js → p-a9d05ef6.entry.js} +2 -2
- package/dist/core/le-kit/{p-73682c5e.entry.js → p-b2bd2a80.entry.js} +2 -2
- package/dist/core/le-kit/{p-0308bd1f.entry.js → p-ccac9611.entry.js} +2 -2
- package/dist/core/types/global/app.d.ts +4 -4
- package/dist/le-kit/assets/custom-elements.json +1007 -1007
- package/dist/le-kit/index-CAY3Hk_i.js +4559 -0
- package/dist/le-kit/index-CAY3Hk_i.js.map +1 -0
- package/dist/le-kit/index.esm.js +116 -2
- package/dist/le-kit/index.esm.js.map +1 -1
- package/dist/{esm → le-kit}/le-box.entry.js +3 -3
- package/dist/le-kit/le-button.entry.esm.js.map +1 -0
- package/dist/le-kit/le-button.entry.js +90 -0
- package/dist/{esm → le-kit}/le-card.entry.js +3 -3
- package/dist/le-kit/le-checkbox.entry.esm.js.map +1 -0
- package/dist/le-kit/le-checkbox.entry.js +59 -0
- package/dist/le-kit/le-component.entry.esm.js.map +1 -0
- package/dist/{collection/components/le-component/le-component.js → le-kit/le-component.entry.js} +19 -138
- package/dist/le-kit/le-kit.css +1010 -1
- package/dist/le-kit/le-kit.esm.js +48 -2
- package/dist/le-kit/le-kit.esm.js.map +1 -1
- package/dist/{esm → le-kit}/le-number-input.entry.js +5 -5
- package/dist/le-kit/le-popover.entry.esm.js.map +1 -0
- package/dist/{collection/components/le-popover/le-popover.js → le-kit/le-popover.entry.js} +16 -363
- package/dist/{esm → le-kit}/le-popup.entry.js +6 -6
- package/dist/{esm → le-kit}/le-round-progress.entry.js +2 -2
- package/dist/le-kit/le-slot.entry.esm.js.map +1 -0
- package/dist/{collection/components/le-slot/le-slot.js → le-kit/le-slot.entry.js} +20 -273
- package/dist/{esm → le-kit}/le-stack.entry.js +3 -3
- package/dist/le-kit/le-string-input.entry.esm.js.map +1 -0
- package/dist/le-kit/le-string-input.entry.js +93 -0
- package/dist/{esm → le-kit}/le-text.entry.js +3 -3
- package/dist/{esm → le-kit}/le-turntable.entry.js +2 -2
- package/dist/{core/esm/utils-Bxmld82M.js → le-kit/utils-cwSNy7ZS.js} +3 -3
- package/dist/{esm/utils-Cf7fMI0j.js.map → le-kit/utils-cwSNy7ZS.js.map} +1 -1
- package/dist/types/global/app.d.ts +4 -4
- package/package.json +3 -4
- package/readme.md +2 -2
- package/custom-elements.json +0 -4305
- package/dist/cjs/index-o1DRKw1g.js +0 -1842
- package/dist/cjs/index-o1DRKw1g.js.map +0 -1
- package/dist/cjs/index.cjs.js +0 -119
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/le-box.cjs.entry.js +0 -184
- package/dist/cjs/le-box.entry.cjs.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-button_6.cjs.entry.js +0 -1206
- package/dist/cjs/le-card.cjs.entry.js +0 -29
- package/dist/cjs/le-card.entry.cjs.js.map +0 -1
- package/dist/cjs/le-kit.cjs.js +0 -25
- package/dist/cjs/le-kit.cjs.js.map +0 -1
- package/dist/cjs/le-number-input.cjs.entry.js +0 -202
- package/dist/cjs/le-number-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/cjs/le-round-progress.cjs.entry.js +0 -106
- package/dist/cjs/le-round-progress.entry.cjs.js.map +0 -1
- package/dist/cjs/le-stack.cjs.entry.js +0 -135
- package/dist/cjs/le-stack.entry.cjs.js.map +0 -1
- package/dist/cjs/le-text.cjs.entry.js +0 -335
- package/dist/cjs/le-text.entry.cjs.js.map +0 -1
- package/dist/cjs/le-turntable.cjs.entry.js +0 -139
- package/dist/cjs/le-turntable.entry.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js +0 -13
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/utils-DqhadIxH.js.map +0 -1
- package/dist/collection/assets/custom-elements.json +0 -4305
- package/dist/collection/collection-manifest.json +0 -26
- package/dist/collection/components/le-box/le-box.default.css +0 -37
- package/dist/collection/components/le-box/le-box.js +0 -614
- package/dist/collection/components/le-box/le-box.js.map +0 -1
- package/dist/collection/components/le-button/le-button.default.css +0 -263
- package/dist/collection/components/le-button/le-button.js +0 -368
- package/dist/collection/components/le-button/le-button.js.map +0 -1
- package/dist/collection/components/le-card/le-card.default.css +0 -74
- package/dist/collection/components/le-card/le-card.js +0 -102
- package/dist/collection/components/le-card/le-card.js.map +0 -1
- package/dist/collection/components/le-checkbox/le-checkbox.css +0 -93
- package/dist/collection/components/le-checkbox/le-checkbox.js +0 -192
- package/dist/collection/components/le-checkbox/le-checkbox.js.map +0 -1
- package/dist/collection/components/le-component/le-component.css +0 -189
- package/dist/collection/components/le-component/le-component.js.map +0 -1
- package/dist/collection/components/le-number-input/le-number-input.css +0 -135
- package/dist/collection/components/le-number-input/le-number-input.js +0 -515
- package/dist/collection/components/le-number-input/le-number-input.js.map +0 -1
- package/dist/collection/components/le-popover/le-popover.css +0 -143
- package/dist/collection/components/le-popover/le-popover.js.map +0 -1
- package/dist/collection/components/le-popup/le-popup.api.js +0 -101
- package/dist/collection/components/le-popup/le-popup.api.js.map +0 -1
- package/dist/collection/components/le-popup/le-popup.css +0 -222
- package/dist/collection/components/le-popup/le-popup.js +0 -596
- package/dist/collection/components/le-popup/le-popup.js.map +0 -1
- package/dist/collection/components/le-round-progress/le-round-progress.css +0 -34
- package/dist/collection/components/le-round-progress/le-round-progress.js +0 -184
- package/dist/collection/components/le-round-progress/le-round-progress.js.map +0 -1
- package/dist/collection/components/le-slot/le-slot.default.css +0 -222
- package/dist/collection/components/le-slot/le-slot.js.map +0 -1
- package/dist/collection/components/le-stack/le-stack.default.css +0 -37
- package/dist/collection/components/le-stack/le-stack.js +0 -389
- package/dist/collection/components/le-stack/le-stack.js.map +0 -1
- package/dist/collection/components/le-string-input/le-string-input.css +0 -83
- package/dist/collection/components/le-string-input/le-string-input.js +0 -359
- package/dist/collection/components/le-string-input/le-string-input.js.map +0 -1
- package/dist/collection/components/le-text/le-text.default.css +0 -169
- package/dist/collection/components/le-text/le-text.js +0 -475
- package/dist/collection/components/le-text/le-text.js.map +0 -1
- package/dist/collection/components/le-turntable/le-turntable.css +0 -10
- package/dist/collection/components/le-turntable/le-turntable.js +0 -210
- package/dist/collection/components/le-turntable/le-turntable.js.map +0 -1
- package/dist/collection/global/app.js +0 -167
- package/dist/collection/global/app.js.map +0 -1
- package/dist/collection/index.js +0 -15
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/types/blocks.js +0 -115
- package/dist/collection/types/blocks.js.map +0 -1
- package/dist/collection/types/options.js +0 -2
- package/dist/collection/types/options.js.map +0 -1
- package/dist/collection/utils/utils.js +0 -141
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/index.js +0 -113
- package/dist/components/index.js.map +0 -1
- package/dist/components/le-box.js +0 -257
- package/dist/components/le-box.js.map +0 -1
- package/dist/components/le-button.js +0 -9
- package/dist/components/le-button.js.map +0 -1
- package/dist/components/le-button2.js +0 -1149
- package/dist/components/le-button2.js.map +0 -1
- package/dist/components/le-card.js +0 -84
- package/dist/components/le-card.js.map +0 -1
- package/dist/components/le-checkbox.js +0 -9
- package/dist/components/le-checkbox.js.map +0 -1
- package/dist/components/le-number-input.js +0 -272
- package/dist/components/le-number-input.js.map +0 -1
- package/dist/components/le-popover.js +0 -9
- package/dist/components/le-popover.js.map +0 -1
- package/dist/components/le-popup.js +0 -279
- package/dist/components/le-popup.js.map +0 -1
- package/dist/components/le-round-progress.js +0 -135
- package/dist/components/le-round-progress.js.map +0 -1
- package/dist/components/le-stack.js +0 -199
- package/dist/components/le-stack.js.map +0 -1
- package/dist/components/le-string-input.js +0 -9
- package/dist/components/le-string-input.js.map +0 -1
- package/dist/components/le-text.js +0 -399
- package/dist/components/le-text.js.map +0 -1
- package/dist/components/le-turntable.js +0 -164
- package/dist/components/le-turntable.js.map +0 -1
- package/dist/components/utils.js +0 -310
- package/dist/components/utils.js.map +0 -1
- package/dist/core/cjs/index-BsRb_UTe.js.map +0 -1
- package/dist/core/cjs/utils-nsP8_w8_.js +0 -152
- package/dist/core/collection/assets/custom-elements.json +0 -4305
- package/dist/core/collection/themes/base.css +0 -89
- package/dist/core/collection/themes/dark.css +0 -100
- package/dist/core/collection/themes/default.css +0 -108
- package/dist/core/collection/themes/gradient.css +0 -100
- package/dist/core/collection/themes/index.css +0 -413
- package/dist/core/collection/themes/minimal.css +0 -100
- package/dist/core/collection/themes/warm.css +0 -100
- package/dist/core/esm/index-CJ-z5Zj1.js.map +0 -1
- package/dist/core/le-kit/p-CJ-z5Zj1.js +0 -3
- package/dist/core/le-kit/p-Drz36PDp.js +0 -2
- package/dist/docs.d.ts +0 -443
- package/dist/docs.json +0 -5185
- package/dist/esm/index-CwNQ1GTa.js +0 -1824
- package/dist/esm/index-CwNQ1GTa.js.map +0 -1
- package/dist/esm/index.js +0 -106
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/le-box.entry.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-button_6.entry.js +0 -1199
- package/dist/esm/le-card.entry.js.map +0 -1
- package/dist/esm/le-kit.js +0 -21
- package/dist/esm/le-kit.js.map +0 -1
- package/dist/esm/le-number-input.entry.js.map +0 -1
- package/dist/esm/le-popup.entry.js.map +0 -1
- package/dist/esm/le-round-progress.entry.js.map +0 -1
- package/dist/esm/le-stack.entry.js.map +0 -1
- package/dist/esm/le-text.entry.js.map +0 -1
- package/dist/esm/le-turntable.entry.js.map +0 -1
- package/dist/esm/loader.js +0 -11
- package/dist/esm/loader.js.map +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/le-kit/dist/collection/themes/base.css +0 -89
- package/dist/le-kit/dist/collection/themes/dark.css +0 -100
- package/dist/le-kit/dist/collection/themes/default.css +0 -108
- package/dist/le-kit/dist/collection/themes/gradient.css +0 -100
- package/dist/le-kit/dist/collection/themes/index.css +0 -413
- package/dist/le-kit/dist/collection/themes/minimal.css +0 -100
- package/dist/le-kit/dist/collection/themes/warm.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/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 +0 -2
- package/dist/le-kit/p-64374730.entry.js.map +0 -1
- package/dist/le-kit/p-79ec6f7c.entry.js +0 -2
- 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 +0 -2
- package/dist/le-kit/p-ad398acd.entry.js.map +0 -1
- package/dist/le-kit/p-b8122ad6.entry.js +0 -2
- package/dist/le-kit/p-b8122ad6.entry.js.map +0 -1
- package/dist/le-kit/p-f9008505.entry.js +0 -2
- package/dist/le-kit/p-f9008505.entry.js.map +0 -1
- package/dist/le-kit/p-y3FECAx9.js +0 -2
- package/dist/le-kit/p-y3FECAx9.js.map +0 -1
- package/dist/themes/base.css +0 -89
- package/dist/themes/dark.css +0 -100
- package/dist/themes/default.css +0 -108
- package/dist/themes/gradient.css +0 -100
- package/dist/themes/index.css +0 -413
- package/dist/themes/minimal.css +0 -100
- package/dist/themes/warm.css +0 -100
- /package/dist/{collection/dist/collection → components}/themes/base.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/dark.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/default.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/gradient.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/index.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/minimal.css +0 -0
- /package/dist/{collection/dist/collection → components}/themes/warm.css +0 -0
- /package/dist/{components → core/components}/le-component.js +0 -0
- /package/dist/{components → core/components}/le-component.js.map +0 -0
- /package/dist/{components → core/components}/le-popover2.js +0 -0
- /package/dist/{components → core/components}/le-popover2.js.map +0 -0
- /package/dist/{components → core/components}/le-slot.js +0 -0
- /package/dist/{components → core/components}/le-slot.js.map +0 -0
- /package/dist/core/le-kit/{p-2ac4789a.entry.js.map → p-189cb775.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-556086ca.entry.js.map → p-35c1d413.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-aa6e906f.entry.js.map → p-4f133e72.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-df552906.entry.js.map → p-55f70091.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-e0861e82.entry.js.map → p-5fd7b23a.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-5ef81068.entry.js.map → p-6e414a5c.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-d75214f9.entry.js.map → p-7b121ca7.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-45eace7c.entry.js.map → p-8c81fa95.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-257495cc.entry.js.map → p-9aa81442.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-66d35f48.entry.js.map → p-a9d05ef6.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-73682c5e.entry.js.map → p-b2bd2a80.entry.js.map} +0 -0
- /package/dist/core/le-kit/{p-0308bd1f.entry.js.map → p-ccac9611.entry.js.map} +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/base.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/dark.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/default.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/gradient.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/index.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/minimal.css +0 -0
- /package/dist/{collection → le-kit/dist/components}/themes/warm.css +0 -0
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
export class LeTurntable {
|
|
3
|
-
// host element
|
|
4
|
-
el;
|
|
5
|
-
// transform origin
|
|
6
|
-
// gets the same values as transform-origin css property
|
|
7
|
-
center = 'center';
|
|
8
|
-
// transform rotate
|
|
9
|
-
value = 0;
|
|
10
|
-
updateValue(newValue) {
|
|
11
|
-
if (!this.rotating) {
|
|
12
|
-
this.currentAngle = parseFloat(newValue);
|
|
13
|
-
this.setAngle(this.currentAngle);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Internal state
|
|
18
|
-
*
|
|
19
|
-
* using properties instead of @State decoratorm
|
|
20
|
-
* because we are only changing styles of the element and don't
|
|
21
|
-
* need the element to be rerendered
|
|
22
|
-
*/
|
|
23
|
-
// indicates is the element being manually rotated right now
|
|
24
|
-
rotating = false;
|
|
25
|
-
// coordinates of the transform origin in pixels
|
|
26
|
-
centerX;
|
|
27
|
-
centerY;
|
|
28
|
-
// element page (body?) offset in pixels
|
|
29
|
-
pageX;
|
|
30
|
-
pageY;
|
|
31
|
-
currentAngle = 0;
|
|
32
|
-
// angle at the start of the drag
|
|
33
|
-
startAngle;
|
|
34
|
-
/**
|
|
35
|
-
* Event listeners
|
|
36
|
-
*/
|
|
37
|
-
handleMouseDown(evt) {
|
|
38
|
-
// set rotating mode on
|
|
39
|
-
this.rotating = true;
|
|
40
|
-
// get start angle
|
|
41
|
-
// getting pageX/Y, because when the element is transformed
|
|
42
|
-
// relative values are useless
|
|
43
|
-
this.startAngle = this.getAngle(evt.pageX, evt.pageY);
|
|
44
|
-
// cancel the event to prevent text selection
|
|
45
|
-
evt.preventDefault();
|
|
46
|
-
evt.stopPropagation();
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Fires when the mouse moves
|
|
51
|
-
* checks is the element rotating right now and if it is
|
|
52
|
-
* then calc the current angle and rotate the element
|
|
53
|
-
*
|
|
54
|
-
* TODO: attach events only after the dragStart?
|
|
55
|
-
*/
|
|
56
|
-
handleMouseMove(evt) {
|
|
57
|
-
if (this.rotating) {
|
|
58
|
-
// calc angle update and rotate element
|
|
59
|
-
this.setAngle(this.currentAngle + (this.getAngle(evt.pageX, evt.pageY) - this.startAngle));
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
handleMouseUp(evt) {
|
|
64
|
-
if (this.rotating) {
|
|
65
|
-
const angle = this.currentAngle + (this.getAngle(evt.pageX, evt.pageY) - this.startAngle);
|
|
66
|
-
this.setAngle(angle);
|
|
67
|
-
this.currentAngle = angle;
|
|
68
|
-
this.rotating = false;
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// on window resize the center should be recalculated
|
|
73
|
-
handleWindowResize() {
|
|
74
|
-
this.getTransformOrigin();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Component lifecycles
|
|
78
|
-
*/
|
|
79
|
-
componentDidLoad() {
|
|
80
|
-
this.el.style.transformOrigin = this.center;
|
|
81
|
-
this.currentAngle = this.value;
|
|
82
|
-
this.getTransformOrigin();
|
|
83
|
-
this.setAngle(this.currentAngle);
|
|
84
|
-
}
|
|
85
|
-
componentDidUpdate() {
|
|
86
|
-
this.getTransformOrigin();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Calculates the transform origin of the component
|
|
90
|
-
* and the page offset in pixels
|
|
91
|
-
*
|
|
92
|
-
* We'll need these values to calculate the angle of pointer event
|
|
93
|
-
*/
|
|
94
|
-
getTransformOrigin() {
|
|
95
|
-
// transform origin
|
|
96
|
-
[this.centerX, this.centerY] = window
|
|
97
|
-
.getComputedStyle(this.el, null)
|
|
98
|
-
.transformOrigin.split(' ')
|
|
99
|
-
.map(val => Math.round(parseFloat(val)));
|
|
100
|
-
// page offset
|
|
101
|
-
let t = null;
|
|
102
|
-
const scrollContainer = ((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.scrollLeft === 'number' ? t : document.body;
|
|
103
|
-
const clientRects = this.el.getBoundingClientRect();
|
|
104
|
-
this.pageX = Math.round(clientRects.left + scrollContainer.scrollLeft);
|
|
105
|
-
this.pageY = Math.round(clientRects.top + scrollContainer.scrollTop);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Calculates current angle
|
|
109
|
-
*
|
|
110
|
-
* @param {number} posX horizontal mouse position
|
|
111
|
-
* @param {number} posY vertical mouse position
|
|
112
|
-
*/
|
|
113
|
-
getAngle(posX, posY) {
|
|
114
|
-
const x = posX - this.pageX - this.centerX;
|
|
115
|
-
const y = posY - this.pageY - this.centerY;
|
|
116
|
-
const angle = Math.round(((Math.atan2(y, x) * 180) / Math.PI) * 100) / 100;
|
|
117
|
-
return angle;
|
|
118
|
-
}
|
|
119
|
-
setAngle(angle) {
|
|
120
|
-
this.el.style.transform = `rotate(${angle}deg)`;
|
|
121
|
-
}
|
|
122
|
-
render() {
|
|
123
|
-
return (h("div", { key: 'ec9a506a360881ab3c3df97027c8a25d663f6819', class: "turntable", onMouseDown: this.handleMouseDown.bind(this) }, h("slot", { key: '926a84fa75952bdc3e44f1b2146848401e8ab10f' })));
|
|
124
|
-
}
|
|
125
|
-
static get is() { return "le-turntable"; }
|
|
126
|
-
static get encapsulation() { return "shadow"; }
|
|
127
|
-
static get originalStyleUrls() {
|
|
128
|
-
return {
|
|
129
|
-
"$": ["le-turntable.css"]
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
static get styleUrls() {
|
|
133
|
-
return {
|
|
134
|
-
"$": ["le-turntable.css"]
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
static get properties() {
|
|
138
|
-
return {
|
|
139
|
-
"center": {
|
|
140
|
-
"type": "string",
|
|
141
|
-
"mutable": false,
|
|
142
|
-
"complexType": {
|
|
143
|
-
"original": "string",
|
|
144
|
-
"resolved": "string",
|
|
145
|
-
"references": {}
|
|
146
|
-
},
|
|
147
|
-
"required": false,
|
|
148
|
-
"optional": false,
|
|
149
|
-
"docs": {
|
|
150
|
-
"tags": [],
|
|
151
|
-
"text": ""
|
|
152
|
-
},
|
|
153
|
-
"getter": false,
|
|
154
|
-
"setter": false,
|
|
155
|
-
"reflect": false,
|
|
156
|
-
"attribute": "center",
|
|
157
|
-
"defaultValue": "'center'"
|
|
158
|
-
},
|
|
159
|
-
"value": {
|
|
160
|
-
"type": "number",
|
|
161
|
-
"mutable": false,
|
|
162
|
-
"complexType": {
|
|
163
|
-
"original": "number",
|
|
164
|
-
"resolved": "number",
|
|
165
|
-
"references": {}
|
|
166
|
-
},
|
|
167
|
-
"required": false,
|
|
168
|
-
"optional": false,
|
|
169
|
-
"docs": {
|
|
170
|
-
"tags": [],
|
|
171
|
-
"text": ""
|
|
172
|
-
},
|
|
173
|
-
"getter": false,
|
|
174
|
-
"setter": false,
|
|
175
|
-
"reflect": false,
|
|
176
|
-
"attribute": "value",
|
|
177
|
-
"defaultValue": "0"
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
static get elementRef() { return "el"; }
|
|
182
|
-
static get watchers() {
|
|
183
|
-
return [{
|
|
184
|
-
"propName": "value",
|
|
185
|
-
"methodName": "updateValue"
|
|
186
|
-
}];
|
|
187
|
-
}
|
|
188
|
-
static get listeners() {
|
|
189
|
-
return [{
|
|
190
|
-
"name": "mousemove",
|
|
191
|
-
"method": "handleMouseMove",
|
|
192
|
-
"target": "window",
|
|
193
|
-
"capture": false,
|
|
194
|
-
"passive": true
|
|
195
|
-
}, {
|
|
196
|
-
"name": "mouseup",
|
|
197
|
-
"method": "handleMouseUp",
|
|
198
|
-
"target": "window",
|
|
199
|
-
"capture": false,
|
|
200
|
-
"passive": true
|
|
201
|
-
}, {
|
|
202
|
-
"name": "resize",
|
|
203
|
-
"method": "handleWindowResize",
|
|
204
|
-
"target": "window",
|
|
205
|
-
"capture": false,
|
|
206
|
-
"passive": true
|
|
207
|
-
}];
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
//# sourceMappingURL=le-turntable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"le-turntable.js","sourceRoot":"","sources":["../../../src/components/le-turntable/le-turntable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAO3E,MAAM,OAAO,W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AAC,IAAI,CAAC,IAAI,CAAC;YACjE,8DAAQ,CACJ,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, Listen, h, Watch } from '@stencil/core';\n\n@Component({\n tag: 'le-turntable',\n styleUrl: 'le-turntable.css',\n shadow: true,\n})\nexport class LeTurntable {\n // host element\n @Element() el: HTMLElement;\n\n // transform origin\n // gets the same values as transform-origin css property\n @Prop() center: string = 'center';\n\n // transform rotate\n @Prop() value: number = 0;\n\n @Watch('value')\n updateValue(newValue) {\n if (!this.rotating) {\n this.currentAngle = parseFloat(newValue);\n this.setAngle(this.currentAngle);\n }\n }\n\n /**\n * Internal state\n *\n * using properties instead of @State decoratorm\n * because we are only changing styles of the element and don't\n * need the element to be rerendered\n */\n\n // indicates is the element being manually rotated right now\n rotating = false;\n\n // coordinates of the transform origin in pixels\n centerX: number;\n centerY: number;\n\n // element page (body?) offset in pixels\n pageX: number;\n pageY: number;\n\n currentAngle: number = 0;\n // angle at the start of the drag\n startAngle: number;\n\n /**\n * Event listeners\n */\n handleMouseDown(evt: MouseEvent) {\n // set rotating mode on\n this.rotating = true;\n\n // get start angle\n // getting pageX/Y, because when the element is transformed\n // relative values are useless\n this.startAngle = this.getAngle(evt.pageX, evt.pageY);\n\n // cancel the event to prevent text selection\n evt.preventDefault();\n evt.stopPropagation();\n return false;\n }\n\n /**\n * Fires when the mouse moves\n * checks is the element rotating right now and if it is\n * then calc the current angle and rotate the element\n *\n * TODO: attach events only after the dragStart?\n */\n @Listen('mousemove', { target: 'window' })\n handleMouseMove(evt: MouseEvent) {\n if (this.rotating) {\n // calc angle update and rotate element\n this.setAngle(this.currentAngle + (this.getAngle(evt.pageX, evt.pageY) - this.startAngle));\n return false;\n }\n }\n\n @Listen('mouseup', { target: 'window' })\n handleMouseUp(evt: MouseEvent) {\n if (this.rotating) {\n const angle = this.currentAngle + (this.getAngle(evt.pageX, evt.pageY) - this.startAngle);\n this.setAngle(angle);\n this.currentAngle = angle;\n this.rotating = false;\n return false;\n }\n }\n\n // on window resize the center should be recalculated\n @Listen('resize', { target: 'window' })\n handleWindowResize() {\n this.getTransformOrigin();\n }\n\n /**\n * Component lifecycles\n */\n componentDidLoad() {\n this.el.style.transformOrigin = this.center;\n this.currentAngle = this.value;\n\n this.getTransformOrigin();\n this.setAngle(this.currentAngle);\n }\n\n componentDidUpdate() {\n this.getTransformOrigin();\n }\n\n /**\n * Calculates the transform origin of the component\n * and the page offset in pixels\n *\n * We'll need these values to calculate the angle of pointer event\n */\n getTransformOrigin() {\n // transform origin\n [this.centerX, this.centerY] = window\n .getComputedStyle(this.el, null)\n .transformOrigin.split(' ')\n .map(val => Math.round(parseFloat(val)));\n // page offset\n let t = null;\n const scrollContainer = ((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.scrollLeft === 'number' ? t : document.body;\n const clientRects = this.el.getBoundingClientRect();\n this.pageX = Math.round(clientRects.left + scrollContainer.scrollLeft);\n this.pageY = Math.round(clientRects.top + scrollContainer.scrollTop);\n }\n\n /**\n * Calculates current angle\n *\n * @param {number} posX horizontal mouse position\n * @param {number} posY vertical mouse position\n */\n getAngle(posX: number, posY: number) {\n const x = posX - this.pageX - this.centerX;\n const y = posY - this.pageY - this.centerY;\n const angle = Math.round(((Math.atan2(y, x) * 180) / Math.PI) * 100) / 100;\n return angle;\n }\n\n setAngle(angle) {\n this.el.style.transform = `rotate(${angle}deg)`;\n }\n\n render() {\n return (\n <div class=\"turntable\" onMouseDown={this.handleMouseDown.bind(this)}>\n <slot />\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { setMode } from "@stencil/core";
|
|
2
|
-
/**
|
|
3
|
-
* Global mode initialization for le-kit components.
|
|
4
|
-
*
|
|
5
|
-
* Mode inheritance works as follows:
|
|
6
|
-
* 1. Check the element's own `mode` attribute
|
|
7
|
-
* 2. Traverse up the DOM to find a parent with `mode` attribute
|
|
8
|
-
* 3. Check the document root element (html) for `mode` attribute
|
|
9
|
-
* 4. Fall back to 'default'
|
|
10
|
-
*
|
|
11
|
-
* This allows setting mode at any level:
|
|
12
|
-
* - `<html mode="admin">` - all components in admin mode
|
|
13
|
-
* - `<le-card mode="admin">` - this card and its children in admin mode
|
|
14
|
-
*/
|
|
15
|
-
function initializeMode() {
|
|
16
|
-
setMode((el) => {
|
|
17
|
-
// 1. Check element's own mode attribute
|
|
18
|
-
const ownMode = el.getAttribute('mode');
|
|
19
|
-
if (ownMode) {
|
|
20
|
-
return ownMode;
|
|
21
|
-
}
|
|
22
|
-
// 2. Traverse up the DOM tree to find inherited mode
|
|
23
|
-
let parent = el.parentElement;
|
|
24
|
-
while (parent) {
|
|
25
|
-
const parentMode = parent.getAttribute('mode');
|
|
26
|
-
if (parentMode) {
|
|
27
|
-
return parentMode;
|
|
28
|
-
}
|
|
29
|
-
parent = parent.parentElement;
|
|
30
|
-
}
|
|
31
|
-
// 3. Check document root element
|
|
32
|
-
const rootMode = document.documentElement.getAttribute('mode');
|
|
33
|
-
if (rootMode) {
|
|
34
|
-
return rootMode;
|
|
35
|
-
}
|
|
36
|
-
// 4. Default mode
|
|
37
|
-
return 'default';
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
// Default export for Stencil global script
|
|
41
|
-
export default initializeMode;
|
|
42
|
-
/**
|
|
43
|
-
* Helper function to get the current mode for an element.
|
|
44
|
-
* Can be used programmatically in components.
|
|
45
|
-
*
|
|
46
|
-
* This function traverses both regular DOM and shadow DOM boundaries
|
|
47
|
-
* to find the nearest mode attribute.
|
|
48
|
-
*/
|
|
49
|
-
export function getMode(el) {
|
|
50
|
-
// Check element's own mode
|
|
51
|
-
const ownMode = el.getAttribute('mode');
|
|
52
|
-
if (ownMode) {
|
|
53
|
-
return ownMode;
|
|
54
|
-
}
|
|
55
|
-
// Traverse up DOM, crossing shadow boundaries
|
|
56
|
-
let current = el;
|
|
57
|
-
while (current) {
|
|
58
|
-
// Try parent element first
|
|
59
|
-
if (current instanceof Element && current.parentElement) {
|
|
60
|
-
current = current.parentElement;
|
|
61
|
-
const mode = current.getAttribute?.('mode');
|
|
62
|
-
if (mode) {
|
|
63
|
-
return mode;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// No parent element - check if we're in a shadow root
|
|
68
|
-
const root = current.getRootNode();
|
|
69
|
-
if (root instanceof ShadowRoot) {
|
|
70
|
-
// Cross the shadow boundary to the host element
|
|
71
|
-
current = root.host;
|
|
72
|
-
const mode = current.getAttribute?.('mode');
|
|
73
|
-
if (mode) {
|
|
74
|
-
return mode;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// We've reached the document root
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// Check document root
|
|
84
|
-
const rootMode = document.documentElement.getAttribute('mode');
|
|
85
|
-
if (rootMode) {
|
|
86
|
-
return rootMode;
|
|
87
|
-
}
|
|
88
|
-
return 'default';
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper function to get the current theme for an element.
|
|
92
|
-
* Theme inheritance works the same as mode - cascades through DOM.
|
|
93
|
-
*/
|
|
94
|
-
export function getTheme(el) {
|
|
95
|
-
// Check element's own theme
|
|
96
|
-
const ownTheme = el.getAttribute('theme');
|
|
97
|
-
if (ownTheme) {
|
|
98
|
-
return ownTheme;
|
|
99
|
-
}
|
|
100
|
-
// Traverse up DOM
|
|
101
|
-
let parent = el.parentElement;
|
|
102
|
-
while (parent) {
|
|
103
|
-
const parentTheme = parent.getAttribute('theme');
|
|
104
|
-
if (parentTheme) {
|
|
105
|
-
return parentTheme;
|
|
106
|
-
}
|
|
107
|
-
parent = parent.parentElement;
|
|
108
|
-
}
|
|
109
|
-
// Check root
|
|
110
|
-
const rootTheme = document.documentElement.getAttribute('theme');
|
|
111
|
-
if (rootTheme) {
|
|
112
|
-
return rootTheme;
|
|
113
|
-
}
|
|
114
|
-
return 'default';
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Helper function to set mode on the document root.
|
|
118
|
-
* Useful for switching all components to admin mode.
|
|
119
|
-
*/
|
|
120
|
-
export function setGlobalMode(mode) {
|
|
121
|
-
document.documentElement.setAttribute('mode', mode);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Helper function to set theme on the document root.
|
|
125
|
-
* Useful for switching all components to a different theme.
|
|
126
|
-
*/
|
|
127
|
-
export function setGlobalTheme(theme) {
|
|
128
|
-
document.documentElement.setAttribute('theme', theme);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Global configuration for le-kit
|
|
132
|
-
*/
|
|
133
|
-
let leKitConfig = {
|
|
134
|
-
/**
|
|
135
|
-
* URL to the custom-elements.json manifest.
|
|
136
|
-
* Used by admin components (le-component, le-slot) to load component metadata.
|
|
137
|
-
*
|
|
138
|
-
* Default: '/custom-elements.json' (served from app root)
|
|
139
|
-
*
|
|
140
|
-
* For apps using le-kit, you may need to:
|
|
141
|
-
* 1. Copy the manifest from node_modules/le-kit/custom-elements.json to your public folder
|
|
142
|
-
* 2. Or set this to point to where the manifest is served
|
|
143
|
-
*/
|
|
144
|
-
manifestUrl: '/custom-elements.json',
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Configure le-kit global settings.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* import { configureLeki } from 'le-kit';
|
|
152
|
-
*
|
|
153
|
-
* configureLeki({
|
|
154
|
-
* manifestUrl: '/assets/custom-elements.json'
|
|
155
|
-
* });
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
export function configureLeKit(config) {
|
|
159
|
-
leKitConfig = { ...leKitConfig, ...config };
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Get the current le-kit configuration.
|
|
163
|
-
*/
|
|
164
|
-
export function getLeKitConfig() {
|
|
165
|
-
return leKitConfig;
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/global/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC;;;;;;;;;;;;GAYG;AACH,SAAS,cAAc;IACrB,OAAO,CAAC,CAAC,EAAe,EAAa,EAAE;QACrC,wCAAwC;QACxC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAoB,CAAC;QAC9B,CAAC;QAED,qDAAqD;QACrD,IAAI,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC;QAC9B,OAAO,MAAM,EAAE,CAAC;YACd,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,UAAuB,CAAC;YACjC,CAAC;YACD,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QAChC,CAAC;QAED,iCAAiC;QACjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAqB,CAAC;QAC/B,CAAC;QAED,kBAAkB;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,eAAe,cAAc,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,EAAe;IACrC,2BAA2B;IAC3B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,OAAO,EAAE,CAAC;QACZ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AAM,GAAG,EAAE,CAAC,aAAa,CAAC;IAC9B,OAAO,MAAM,EAAE,CAAC;QACd,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,WAAyB,CAAC;QACnC,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;IAChC,CAAC;IAED,aAAa;IACb,MAAM,SAAS,GAAG,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAuB,CAAC;IACjC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,IAAI,WAAW,GAAG;IAChB;;;;;;;;;OASG;IACH,WAAW,EAAE,uBAAuB;CACrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmC;IAChE,WAAW,GAAG,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { setMode } from '@stencil/core';\n\nexport type LeKitMode = 'default' | 'admin' | string;\nexport type LeKitTheme = 'default' | 'dark' | string;\n\n/**\n * Global mode initialization for le-kit components.\n *\n * Mode inheritance works as follows:\n * 1. Check the element's own `mode` attribute\n * 2. Traverse up the DOM to find a parent with `mode` attribute\n * 3. Check the document root element (html) for `mode` attribute\n * 4. Fall back to 'default'\n *\n * This allows setting mode at any level:\n * - `<html mode=\"admin\">` - all components in admin mode\n * - `<le-card mode=\"admin\">` - this card and its children in admin mode\n */\nfunction initializeMode() {\n setMode((el: HTMLElement): LeKitMode => {\n // 1. Check element's own mode attribute\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // 2. Traverse up the DOM tree to find inherited mode\n let parent = el.parentElement;\n while (parent) {\n const parentMode = parent.getAttribute('mode');\n if (parentMode) {\n return parentMode as LeKitMode;\n }\n parent = parent.parentElement;\n }\n\n // 3. Check document root element\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n // 4. Default mode\n return 'default';\n });\n}\n\n// Default export for Stencil global script\nexport default initializeMode;\n\n/**\n * Helper function to get the current mode for an element.\n * Can be used programmatically in components.\n * \n * This function traverses both regular DOM and shadow DOM boundaries\n * to find the nearest mode attribute.\n */\nexport function getMode(el: HTMLElement): LeKitMode {\n // Check element's own mode\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // Traverse up DOM, crossing shadow boundaries\n let current: Node | null = el;\n while (current) {\n // Try parent element first\n if (current instanceof Element && current.parentElement) {\n current = current.parentElement;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // No parent element - check if we're in a shadow root\n const root = current.getRootNode();\n if (root instanceof ShadowRoot) {\n // Cross the shadow boundary to the host element\n current = root.host;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // We've reached the document root\n break;\n }\n }\n }\n\n // Check document root\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to get the current theme for an element.\n * Theme inheritance works the same as mode - cascades through DOM.\n */\nexport function getTheme(el: HTMLElement): LeKitTheme {\n // Check element's own theme\n const ownTheme = el.getAttribute('theme');\n if (ownTheme) {\n return ownTheme as LeKitTheme;\n }\n\n // Traverse up DOM\n let parent = el.parentElement;\n while (parent) {\n const parentTheme = parent.getAttribute('theme');\n if (parentTheme) {\n return parentTheme as LeKitTheme;\n }\n parent = parent.parentElement;\n }\n\n // Check root\n const rootTheme = document.documentElement.getAttribute('theme');\n if (rootTheme) {\n return rootTheme as LeKitTheme;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to set mode on the document root.\n * Useful for switching all components to admin mode.\n */\nexport function setGlobalMode(mode: LeKitMode): void {\n document.documentElement.setAttribute('mode', mode);\n}\n\n/**\n * Helper function to set theme on the document root.\n * Useful for switching all components to a different theme.\n */\nexport function setGlobalTheme(theme: LeKitTheme): void {\n document.documentElement.setAttribute('theme', theme);\n}\n\n/**\n * Global configuration for le-kit\n */\nlet leKitConfig = {\n /**\n * URL to the custom-elements.json manifest.\n * Used by admin components (le-component, le-slot) to load component metadata.\n * \n * Default: '/custom-elements.json' (served from app root)\n * \n * For apps using le-kit, you may need to:\n * 1. Copy the manifest from node_modules/le-kit/custom-elements.json to your public folder\n * 2. Or set this to point to where the manifest is served\n */\n manifestUrl: '/custom-elements.json',\n};\n\n/**\n * Configure le-kit global settings.\n * \n * @example\n * ```ts\n * import { configureLeki } from 'le-kit';\n * \n * configureLeki({\n * manifestUrl: '/assets/custom-elements.json'\n * });\n * ```\n */\nexport function configureLeKit(config: Partial<typeof leKitConfig>): void {\n leKitConfig = { ...leKitConfig, ...config };\n}\n\n/**\n * Get the current le-kit configuration.\n */\nexport function getLeKitConfig(): typeof leKitConfig {\n return leKitConfig;\n}\n"]}
|
package/dist/collection/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Entry point for le-kit component library
|
|
3
|
-
*
|
|
4
|
-
* This file exports utilities, types, and helper functions.
|
|
5
|
-
* Components are auto-registered and available as custom elements.
|
|
6
|
-
*
|
|
7
|
-
* @see README.md for usage instructions
|
|
8
|
-
*/
|
|
9
|
-
// Utility exports
|
|
10
|
-
export { generateId, parseCommaSeparated, slotHasContent } from './utils/utils';
|
|
11
|
-
// Global mode and theme helpers
|
|
12
|
-
export { getMode, setGlobalMode, getTheme, setGlobalTheme, configureLeKit, getLeKitConfig } from './global/app';
|
|
13
|
-
// Popup/dialog programmatic API
|
|
14
|
-
export { leAlert, leConfirm, lePrompt } from './components/le-popup/le-popup.api';
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhF,gCAAgC;AAChC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGhH,gCAAgC;AAChC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["/**\n * @fileoverview Entry point for le-kit component library\n *\n * This file exports utilities, types, and helper functions.\n * Components are auto-registered and available as custom elements.\n *\n * @see README.md for usage instructions\n */\n\n// Utility exports\nexport { generateId, parseCommaSeparated, slotHasContent } from './utils/utils';\n\n// Global mode and theme helpers\nexport { getMode, setGlobalMode, getTheme, setGlobalTheme, configureLeKit, getLeKitConfig } from './global/app';\nexport type { LeKitMode, LeKitTheme } from './global/app';\n\n// Popup/dialog programmatic API\nexport { leAlert, leConfirm, lePrompt } from './components/le-popup/le-popup.api';\nexport type { PopupOptions } from './components/le-popup/le-popup.api';\nexport type { PopupResult, PopupType, PopupPosition } from './components/le-popup/le-popup';\n\n// Type exports\nexport type * from './components.d.ts';\n"]}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Block types for the rich text editor.
|
|
3
|
-
*
|
|
4
|
-
* Used by: le-rich-text-editor, le-editor-block, le-block-menu
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Default block type configurations.
|
|
8
|
-
*/
|
|
9
|
-
export const DEFAULT_BLOCK_CONFIGS = [
|
|
10
|
-
{
|
|
11
|
-
type: 'paragraph',
|
|
12
|
-
label: 'Text',
|
|
13
|
-
icon: '📝',
|
|
14
|
-
tag: 'p',
|
|
15
|
-
placeholder: 'Type something...',
|
|
16
|
-
editable: true,
|
|
17
|
-
description: 'Plain text paragraph',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'heading1',
|
|
21
|
-
label: 'Heading 1',
|
|
22
|
-
icon: 'H1',
|
|
23
|
-
tag: 'h1',
|
|
24
|
-
placeholder: 'Heading 1',
|
|
25
|
-
editable: true,
|
|
26
|
-
description: 'Large section heading',
|
|
27
|
-
shortcut: '# ',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'heading2',
|
|
31
|
-
label: 'Heading 2',
|
|
32
|
-
icon: 'H2',
|
|
33
|
-
tag: 'h2',
|
|
34
|
-
placeholder: 'Heading 2',
|
|
35
|
-
editable: true,
|
|
36
|
-
description: 'Medium section heading',
|
|
37
|
-
shortcut: '## ',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'heading3',
|
|
41
|
-
label: 'Heading 3',
|
|
42
|
-
icon: 'H3',
|
|
43
|
-
tag: 'h3',
|
|
44
|
-
placeholder: 'Heading 3',
|
|
45
|
-
editable: true,
|
|
46
|
-
description: 'Small section heading',
|
|
47
|
-
shortcut: '### ',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: 'bullet-list',
|
|
51
|
-
label: 'Bulleted List',
|
|
52
|
-
icon: '•',
|
|
53
|
-
tag: 'li',
|
|
54
|
-
placeholder: 'List item',
|
|
55
|
-
editable: true,
|
|
56
|
-
description: 'Unordered list',
|
|
57
|
-
shortcut: '- ',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: 'numbered-list',
|
|
61
|
-
label: 'Numbered List',
|
|
62
|
-
icon: '1.',
|
|
63
|
-
tag: 'li',
|
|
64
|
-
placeholder: 'List item',
|
|
65
|
-
editable: true,
|
|
66
|
-
description: 'Ordered list',
|
|
67
|
-
shortcut: '1. ',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: 'quote',
|
|
71
|
-
label: 'Quote',
|
|
72
|
-
icon: '❝',
|
|
73
|
-
tag: 'blockquote',
|
|
74
|
-
placeholder: 'Quote',
|
|
75
|
-
editable: true,
|
|
76
|
-
description: 'Block quote',
|
|
77
|
-
shortcut: '> ',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'code',
|
|
81
|
-
label: 'Code',
|
|
82
|
-
icon: '</>',
|
|
83
|
-
tag: 'code',
|
|
84
|
-
placeholder: 'Code',
|
|
85
|
-
editable: true,
|
|
86
|
-
description: 'Code block',
|
|
87
|
-
shortcut: '``` ',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: 'divider',
|
|
91
|
-
label: 'Divider',
|
|
92
|
-
icon: '—',
|
|
93
|
-
tag: 'hr',
|
|
94
|
-
editable: false,
|
|
95
|
-
description: 'Horizontal line',
|
|
96
|
-
shortcut: '---',
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
/**
|
|
100
|
-
* Generate a unique block ID
|
|
101
|
-
*/
|
|
102
|
-
export function generateBlockId() {
|
|
103
|
-
return `block-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Create a new block with default values
|
|
107
|
-
*/
|
|
108
|
-
export function createBlock(type, content = '') {
|
|
109
|
-
return {
|
|
110
|
-
id: generateBlockId(),
|
|
111
|
-
type,
|
|
112
|
-
content,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=blocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/types/blocks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmIH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,GAAG;QACR,WAAW,EAAE,mBAAmB;QAChC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,sBAAsB;KACpC;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;QACT,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;KACf;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;QACT,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,wBAAwB;QACrC,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;QACT,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,MAAM;KACjB;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,IAAI;QACT,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,gBAAgB;QAC7B,QAAQ,EAAE,IAAI;KACf;IACD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE,IAAI;QACV,GAAG,EAAE,IAAI;QACT,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,cAAc;QAC3B,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,YAAY;QACjB,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,aAAa;QAC1B,QAAQ,EAAE,IAAI;KACf;IACD;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,MAAM;QACX,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,MAAM;KACjB;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAWF;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAe,EAAE,UAAkB,EAAE;IAC/D,OAAO;QACL,EAAE,EAAE,eAAe,EAAE;QACrB,IAAI;QACJ,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Block types for the rich text editor.\n *\n * Used by: le-rich-text-editor, le-editor-block, le-block-menu\n */\n\n/**\n * Available block types for the editor.\n * Start with essential types, expand in future versions.\n */\nexport type BlockType = 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'bullet-list' | 'numbered-list' | 'quote' | 'code' | 'divider';\n\n/**\n * A single block in the editor.\n *\n * @example Paragraph block\n * ```typescript\n * const block: LeBlock = {\n * id: 'block-1',\n * type: 'paragraph',\n * content: 'Hello <strong>world</strong>!'\n * };\n * ```\n *\n * @example Code block with language\n * ```typescript\n * const block: LeBlock = {\n * id: 'block-2',\n * type: 'code',\n * content: 'const x = 1;',\n * attributes: { language: 'typescript' }\n * };\n * ```\n */\nexport interface LeBlock {\n /**\n * Unique identifier for the block.\n */\n id: string;\n\n /**\n * The type of block (paragraph, heading, list, etc.)\n */\n type: BlockType;\n\n /**\n * HTML content of the block.\n * For most blocks, this is the inner HTML.\n * For divider, this is empty.\n */\n content: string;\n\n /**\n * Block-specific attributes.\n */\n attributes?: LeBlockAttributes;\n}\n\n/**\n * Block-specific attributes\n */\nexport interface LeBlockAttributes {\n /**\n * Programming language for code blocks.\n */\n language?: string;\n\n /**\n * Placeholder text shown when block is empty.\n */\n placeholder?: string;\n\n /**\n * Custom CSS class for the block.\n */\n className?: string;\n\n /**\n * Additional custom attributes.\n */\n [key: string]: unknown;\n}\n\n/**\n * Configuration for a block type.\n * Used by the block registry to render and manage blocks.\n */\nexport interface BlockTypeConfig {\n /**\n * Block type identifier.\n */\n type: BlockType;\n\n /**\n * Display label for the block type (shown in block menu).\n */\n label: string;\n\n /**\n * Icon for the block type (emoji or icon name).\n */\n icon?: string;\n\n /**\n * HTML tag to render for this block type.\n */\n tag: string;\n\n /**\n * CSS class applied to the block element.\n */\n className?: string;\n\n /**\n * Placeholder text shown when block is empty.\n */\n placeholder?: string;\n\n /**\n * Whether the block content is editable.\n * Set to false for blocks like divider.\n */\n editable?: boolean;\n\n /**\n * Description shown in block menu.\n */\n description?: string;\n\n /**\n * Keyboard shortcut hint (e.g., \"# \" for heading).\n */\n shortcut?: string;\n}\n\n/**\n * Default block type configurations.\n */\nexport const DEFAULT_BLOCK_CONFIGS: BlockTypeConfig[] = [\n {\n type: 'paragraph',\n label: 'Text',\n icon: '📝',\n tag: 'p',\n placeholder: 'Type something...',\n editable: true,\n description: 'Plain text paragraph',\n },\n {\n type: 'heading1',\n label: 'Heading 1',\n icon: 'H1',\n tag: 'h1',\n placeholder: 'Heading 1',\n editable: true,\n description: 'Large section heading',\n shortcut: '# ',\n },\n {\n type: 'heading2',\n label: 'Heading 2',\n icon: 'H2',\n tag: 'h2',\n placeholder: 'Heading 2',\n editable: true,\n description: 'Medium section heading',\n shortcut: '## ',\n },\n {\n type: 'heading3',\n label: 'Heading 3',\n icon: 'H3',\n tag: 'h3',\n placeholder: 'Heading 3',\n editable: true,\n description: 'Small section heading',\n shortcut: '### ',\n },\n {\n type: 'bullet-list',\n label: 'Bulleted List',\n icon: '•',\n tag: 'li',\n placeholder: 'List item',\n editable: true,\n description: 'Unordered list',\n shortcut: '- ',\n },\n {\n type: 'numbered-list',\n label: 'Numbered List',\n icon: '1.',\n tag: 'li',\n placeholder: 'List item',\n editable: true,\n description: 'Ordered list',\n shortcut: '1. ',\n },\n {\n type: 'quote',\n label: 'Quote',\n icon: '❝',\n tag: 'blockquote',\n placeholder: 'Quote',\n editable: true,\n description: 'Block quote',\n shortcut: '> ',\n },\n {\n type: 'code',\n label: 'Code',\n icon: '</>',\n tag: 'code',\n placeholder: 'Code',\n editable: true,\n description: 'Code block',\n shortcut: '``` ',\n },\n {\n type: 'divider',\n label: 'Divider',\n icon: '—',\n tag: 'hr',\n editable: false,\n description: 'Horizontal line',\n shortcut: '---',\n },\n];\n\n/**\n * Event detail for block changes\n */\nexport interface LeBlockChangeDetail {\n blocks: LeBlock[];\n changedBlock?: LeBlock;\n action: 'add' | 'remove' | 'update' | 'move';\n}\n\n/**\n * Generate a unique block ID\n */\nexport function generateBlockId(): string {\n return `block-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n}\n\n/**\n * Create a new block with default values\n */\nexport function createBlock(type: BlockType, content: string = ''): LeBlock {\n return {\n id: generateBlockId(),\n type,\n content,\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Universal option interface used across Le-Kit components.\n *\n * Used by: le-select, le-combobox, le-multiselect, le-tabs,\n * le-block-menu, le-emoji-picker, and any menu/list components.\n *\n * @example Basic option\n * ```typescript\n * const option: LeOption = {\n * label: 'Option 1',\n * value: 'opt1'\n * };\n * ```\n *\n * @example With icons and description\n * ```typescript\n * const option: LeOption = {\n * label: 'Settings',\n * value: 'settings',\n * iconStart: '⚙️',\n * description: 'Configure application settings'\n * };\n * ```\n *\n * @example Grouped options\n * ```typescript\n * const options: LeOption[] = [\n * { label: 'Apple', value: 'apple', group: 'Fruits' },\n * { label: 'Banana', value: 'banana', group: 'Fruits' },\n * { label: 'Carrot', value: 'carrot', group: 'Vegetables' },\n * ];\n * ```\n *\n * @example Nested options (for submenus)\n * ```typescript\n * const option: LeOption = {\n * label: 'More actions',\n * iconEnd: '▶',\n * children: [\n * { label: 'Duplicate', value: 'duplicate' },\n * { label: 'Archive', value: 'archive' },\n * ]\n * };\n * ```\n */\nexport interface LeOption {\n /**\n * Unique identifier for the option.\n * Auto-generated if not provided.\n */\n id?: string;\n\n /**\n * Display text for the option (required).\n */\n label: string;\n\n /**\n * Selection value. Defaults to label if not provided.\n */\n value?: string | number;\n\n /**\n * Whether the option is disabled and cannot be selected.\n */\n disabled?: boolean;\n\n /**\n * Whether the option is currently selected.\n * Used for multiselect and menu components.\n */\n selected?: boolean;\n\n /**\n * Whether the option is checked.\n * Used for checkbox/radio menu items.\n */\n checked?: boolean;\n\n /**\n * Icon displayed at the start (left) of the option.\n * Can be a URL, icon name, or emoji character.\n */\n iconStart?: string;\n\n /**\n * Icon displayed at the end (right) of the option.\n * Can be a URL, icon name, or emoji character.\n */\n iconEnd?: string;\n\n /**\n * Secondary description text displayed below the label.\n */\n description?: string;\n\n /**\n * Nested child options for hierarchical menus or submenus.\n */\n children?: LeOption[];\n\n /**\n * Group label for categorizing options in flat lists.\n * Options with the same group value are visually grouped together.\n */\n group?: string;\n\n /**\n * Add a visual separator line before or after this option.\n */\n separator?: 'before' | 'after';\n\n /**\n * Custom data passthrough for application-specific needs.\n * This data is included in selection events.\n */\n data?: Record<string, unknown>;\n}\n\n/**\n * Helper type for option value\n */\nexport type LeOptionValue = string | number;\n\n/**\n * Event detail for option selection events\n */\nexport interface LeOptionSelectDetail {\n value: LeOptionValue;\n option: LeOption;\n}\n\n/**\n * Event detail for multi-option selection events\n */\nexport interface LeMultiOptionSelectDetail {\n values: LeOptionValue[];\n options: LeOption[];\n}\n"]}
|