@limetech/lime-elements 38.2.3 → 38.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/files-c08d24d4.js +44 -0
- package/dist/cjs/files-c08d24d4.js.map +1 -0
- package/dist/cjs/index.cjs.js +9 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/limel-action-bar_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-chart.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +8 -43
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +404 -19
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js +11 -1
- package/dist/cjs/limel-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/text-editor.types-5e5567e2.js +13 -0
- package/dist/cjs/text-editor.types-5e5567e2.js.map +1 -0
- package/dist/cjs/{translations-0d53f9bc.js → translations-9be59477.js} +42 -3
- package/dist/cjs/translations-9be59477.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js +195 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js +128 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js +139 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/view.js.map +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +187 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +60 -3
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.js +63 -1
- package/dist/collection/components/text-editor/text-editor.js.map +1 -1
- package/dist/collection/components/text-editor/text-editor.types.js +9 -1
- package/dist/collection/components/text-editor/text-editor.types.js.map +1 -1
- package/dist/collection/components/text-editor/utils/html-converter.js +7 -4
- package/dist/collection/components/text-editor/utils/html-converter.js.map +1 -1
- package/dist/collection/components/text-editor/utils/markdown-converter.js +8 -8
- package/dist/collection/components/text-editor/utils/markdown-converter.js.map +1 -1
- package/dist/collection/global/translations.js +9 -2
- package/dist/collection/global/translations.js.map +1 -1
- package/dist/collection/translations/da.js +4 -0
- package/dist/collection/translations/da.js.map +1 -1
- package/dist/collection/translations/de.js +4 -0
- package/dist/collection/translations/de.js.map +1 -1
- package/dist/collection/translations/en.js +4 -0
- package/dist/collection/translations/en.js.map +1 -1
- package/dist/collection/translations/fi.js +4 -0
- package/dist/collection/translations/fi.js.map +1 -1
- package/dist/collection/translations/fr.js +4 -0
- package/dist/collection/translations/fr.js.map +1 -1
- package/dist/collection/translations/nl.js +4 -0
- package/dist/collection/translations/nl.js.map +1 -1
- package/dist/collection/translations/no.js +4 -0
- package/dist/collection/translations/no.js.map +1 -1
- package/dist/collection/translations/sv.js +4 -0
- package/dist/collection/translations/sv.js.map +1 -1
- package/dist/esm/files-2be62a61.js +41 -0
- package/dist/esm/files-2be62a61.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/limel-action-bar_2.entry.js +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-chart.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +1 -1
- package/dist/esm/limel-file-dropzone_2.entry.js +2 -37
- package/dist/esm/limel-file-dropzone_2.entry.js.map +1 -1
- package/dist/esm/limel-file-viewer.entry.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-linear-progress.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +404 -19
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +1 -1
- package/dist/esm/limel-text-editor.entry.js +11 -1
- package/dist/esm/limel-text-editor.entry.js.map +1 -1
- package/dist/esm/text-editor.types-e82469d1.js +13 -0
- package/dist/esm/text-editor.types-e82469d1.js.map +1 -0
- package/dist/esm/{translations-7ad188e0.js → translations-4f7370c2.js} +42 -3
- package/dist/esm/translations-4f7370c2.js.map +1 -0
- package/dist/lime-elements/index.esm.js +1 -1
- package/dist/lime-elements/index.esm.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-ffe954d4.entry.js → p-01ba32ab.entry.js} +2 -2
- package/dist/lime-elements/p-032d839e.js +2 -0
- package/dist/lime-elements/p-032d839e.js.map +1 -0
- package/dist/lime-elements/p-1906d5b7.entry.js +2 -0
- package/dist/lime-elements/p-1906d5b7.entry.js.map +1 -0
- package/dist/lime-elements/{p-8ada443f.entry.js → p-22d0e2ec.entry.js} +2 -2
- package/dist/lime-elements/{p-0468e34c.entry.js → p-23dea768.entry.js} +2 -2
- package/dist/lime-elements/{p-fc7f9e93.entry.js → p-30b0e067.entry.js} +2 -2
- package/dist/lime-elements/{p-180675a5.entry.js → p-475830f8.entry.js} +2 -2
- package/dist/lime-elements/{p-7fdab6b0.entry.js → p-62a21e92.entry.js} +2 -2
- package/dist/lime-elements/p-62a21e92.entry.js.map +1 -0
- package/dist/lime-elements/{p-54b4a06b.entry.js → p-8e8c1557.entry.js} +2 -2
- package/dist/lime-elements/p-9ca516ed.js +2 -0
- package/dist/lime-elements/p-9ca516ed.js.map +1 -0
- package/dist/lime-elements/{p-28c6b698.entry.js → p-a2a2fc57.entry.js} +2 -2
- package/dist/lime-elements/{p-b78a9a5c.entry.js → p-b66ee3a1.entry.js} +2 -2
- package/dist/lime-elements/p-dbcde7db.entry.js +2 -0
- package/dist/lime-elements/p-dbcde7db.entry.js.map +1 -0
- package/dist/lime-elements/p-dc3d2ee1.js +2 -0
- package/dist/lime-elements/p-dc3d2ee1.js.map +1 -0
- package/dist/lime-elements/{p-fefef194.entry.js → p-f50e4b6f.entry.js} +2 -2
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/inserter.d.ts +15 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/node.d.ts +14 -0
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image/view.d.ts +4 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +14 -0
- package/dist/types/components/text-editor/text-editor.d.ts +18 -0
- package/dist/types/components/text-editor/text-editor.types.d.ts +51 -0
- package/dist/types/components/text-editor/utils/markdown-converter.d.ts +2 -1
- package/dist/types/components.d.ts +34 -2
- package/dist/types/global/translations.d.ts +1 -1
- package/dist/types/translations/da.d.ts +4 -0
- package/dist/types/translations/de.d.ts +4 -0
- package/dist/types/translations/en.d.ts +4 -0
- package/dist/types/translations/fi.d.ts +4 -0
- package/dist/types/translations/fr.d.ts +4 -0
- package/dist/types/translations/nl.d.ts +4 -0
- package/dist/types/translations/no.d.ts +4 -0
- package/dist/types/translations/sv.d.ts +4 -0
- package/package.json +1 -1
- package/dist/cjs/translations-0d53f9bc.js.map +0 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.js +0 -78
- package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.js.map +0 -1
- package/dist/esm/translations-7ad188e0.js.map +0 -1
- package/dist/lime-elements/p-7fdab6b0.entry.js.map +0 -1
- package/dist/lime-elements/p-ad9801f8.entry.js +0 -2
- package/dist/lime-elements/p-ad9801f8.entry.js.map +0 -1
- package/dist/lime-elements/p-e5545944.entry.js +0 -2
- package/dist/lime-elements/p-e5545944.entry.js.map +0 -1
- package/dist/lime-elements/p-efd753ba.js +0 -2
- package/dist/lime-elements/p-efd753ba.js.map +0 -1
- package/dist/types/components/text-editor/prosemirror-adapter/plugins/image-remover-plugin.d.ts +0 -4
- /package/dist/lime-elements/{p-ffe954d4.entry.js.map → p-01ba32ab.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-8ada443f.entry.js.map → p-22d0e2ec.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-0468e34c.entry.js.map → p-23dea768.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-fc7f9e93.entry.js.map → p-30b0e067.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-180675a5.entry.js.map → p-475830f8.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-54b4a06b.entry.js.map → p-8e8c1557.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-28c6b698.entry.js.map → p-a2a2fc57.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-b78a9a5c.entry.js.map → p-b66ee3a1.entry.js.map} +0 -0
- /package/dist/lime-elements/{p-fefef194.entry.js.map → p-f50e4b6f.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as t,h as r,H as i}from"./p-443111b3.js";import{c as o}from"./p-96460db3.js";const l='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}.lime-looks-like-input-value{line-height:1.75rem;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:rgba(var(--contrast-1400), 1);font-size:0.875rem;font-weight:400;letter-spacing:0.009375em}.mdc-text-field--disabled .lime-looks-like-input-value{cursor:not-allowed;opacity:0.4}.lime-looks-like-input-value{padding:var(--limel-text-editor-padding)}*{box-sizing:border-box}:host(limel-text-editor){--limel-text-editor-outline-color:rgba(var(--contrast-700), 0.65);--limel-text-editor-background-color:rgba(var(--contrast-200), 0.5);--limel-text-editor-label-color:rgba(var(--contrast-1200), 1);--limel-prosemirror-adapter-toolbar-opacity:0.6;--limel-text-editor-padding:0.25rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:1fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.3s;--limel-prosemirror-adapter-toolbar-transition-timing-function:cubic-bezier(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem));padding:1px}:host(limel-text-editor:focus-within),:host(limel-text-editor:not([ui=minimal]):hover){--limel-prosemirror-adapter-toolbar-opacity:1}:host(limel-text-editor[ui=minimal]:not(:focus-within)){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:0fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.46s;--limel-prosemirror-adapter-action-bar-padding-top-bottom:0;--limel-prosemirror-adapter-toolbar-opacity:0;--limel-text-editor-placeholder-top:0;min-height:2.5rem}:host(limel-text-editor:hover){--limel-text-editor-outline-color:rgba(var(--contrast-700), 1)}:host(limel-text-editor:focus-within){--limel-text-editor-outline-color:var(--mdc-theme-primary)}:host(limel-text-editor:focus-within) .placeholder,:host(limel-text-editor:focus) .placeholder{opacity:0}:host(limel-text-editor[disabled]:not([disabled=false])){cursor:not-allowed;opacity:0.4}:host(limel-text-editor[disabled]:not([disabled=false])) limel-prosemirror-adapter{pointer-events:none}:host(limel-text-editor[invalid]:not([invalid=false])){--limel-text-editor-outline-color:var(--lime-error-text-color)}:host(limel-text-editor[readonly]:not([readonly=false])){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0;--limel-text-editor-outline-color:transparent;--limel-text-editor-background-color:transparent}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown{display:block;padding:var(--limel-text-editor-padding);overflow-y:auto}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before,:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{z-index:1;pointer-events:none;content:"";display:block;position:absolute;width:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{height:1.75rem;top:0;background:linear-gradient(var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))), transparent)}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before{height:2rem;bottom:-0.25rem;background:linear-gradient(transparent, var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))))}.notched-outline{transition:bottom var(--limel-h-l-grid-template-rows-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89);pointer-events:none;position:absolute;inset:0;bottom:var(--limel-text-editor-notched-outline-bottom, 0);display:flex;background-color:var(--limel-text-editor-background-color)}.leading-outline,.notch,.trailing-outline{transition:border-color 0.2s ease;border-width:1px;border-style:solid;border-color:var(--limel-text-editor-outline-color)}.leading-outline{flex-shrink:0;width:0.75rem;border-right-width:0;border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.notch{flex-shrink:0;position:relative;z-index:2;border-top-width:0;border-right-width:0;border-left-width:0;max-width:calc(100% - 1.5rem)}.trailing-outline{flex-grow:1;border-left-width:0;border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}label{transform:translateY(-50%);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;padding:0 0.25rem;color:var(--limel-text-editor-label-color);font-size:0.65rem;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em)}:host(limel-text-editor[required]:not([required=false])) label::after{content:"*"}.placeholder{transition-property:top;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;position:absolute;top:var(--limel-text-editor-placeholder-top, 2.25rem);left:0;right:0;padding:var(--limel-text-editor-padding);font-style:italic;font-size:0.875rem;color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:0;height:100%;overflow:hidden auto}:host(limel-text-editor:focus),:host(limel-text-editor:focus-visible),:host(limel-text-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-text-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-text-editor:focus) limel-helper-line,:host(limel-text-editor:focus-visible) limel-helper-line,:host(limel-text-editor:focus-within) limel-helper-line,:host(limel-text-editor:hover) limel-helper-line{will-change:grid-template-rows}:host(limel-text-editor.has-helper-text:focus-within) .notched-outline,:host(limel-text-editor.has-helper-text[invalid]:not([invalid=false])) .notched-outline{--limel-text-editor-notched-outline-bottom:1rem}:host(limel-text-editor[allow-resize]) limel-prosemirror-adapter{resize:vertical}';const a=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.triggerStart=t(this,"triggerStart",7);this.triggerStop=t(this,"triggerStop",7);this.triggerChange=t(this,"triggerChange",7);this.renderHelperLine=()=>{if(!this.helperText){return}return r("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})};this.isInvalid=()=>{if(this.readonly){return false}if(this.invalid){return true}};this.handleChange=e=>{e.stopPropagation();this.change.emit(e.detail)};this.contentType="markdown";this.language="en";this.disabled=false;this.readonly=false;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=false;this.value=undefined;this.customElements=[];this.triggers=[];this.required=false;this.allowResize=true;this.ui="standard";this.helperTextId=o();this.editorId=o()}render(){return r(i,{class:{"has-helper-text":!!this.helperText}},r("span",{class:"notched-outline"},r("span",{class:"leading-outline"}),this.renderLabel(),r("span",{class:"trailing-outline"})),this.renderEditor())}renderEditor(){if(this.readonly&&!this.value){return[r("span",{class:"lime-looks-like-input-value"},"–"),this.renderHelperLine()]}if(this.readonly){return[r("limel-markdown",{value:this.value,"aria-controls":this.helperTextId,id:this.editorId}),this.renderPlaceholder(),this.renderHelperLine()]}return[r("limel-prosemirror-adapter",{"aria-placeholder":this.placeholder,contentType:this.contentType,onChange:this.handleChange,customElements:this.customElements,value:this.value,"aria-controls":this.helperTextId,id:this.editorId,"aria-disabled":this.disabled,language:this.language,triggerCharacters:this.triggers,disabled:this.disabled}),this.renderPlaceholder(),this.renderHelperLine()]}renderLabel(){if(!this.label){return}return r("span",{class:"notch"},r("label",{htmlFor:this.editorId},this.label))}renderPlaceholder(){if(!this.placeholder||this.value){return}return r("span",{class:"placeholder","aria-hidden":"true"},this.placeholder)}static get delegatesFocus(){return true}};a.style=l;export{a as limel_text_editor};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as t,h as r,H as i}from"./p-443111b3.js";import{c as o}from"./p-96460db3.js";const l='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}.lime-looks-like-input-value{line-height:1.75rem;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:rgba(var(--contrast-1400), 1);font-size:0.875rem;font-weight:400;letter-spacing:0.009375em}.mdc-text-field--disabled .lime-looks-like-input-value{cursor:not-allowed;opacity:0.4}.lime-looks-like-input-value{padding:var(--limel-text-editor-padding)}*{box-sizing:border-box}:host(limel-text-editor){--limel-text-editor-outline-color:rgba(var(--contrast-700), 0.65);--limel-text-editor-background-color:rgba(var(--contrast-200), 0.5);--limel-text-editor-label-color:rgba(var(--contrast-1200), 1);--limel-prosemirror-adapter-toolbar-opacity:0.6;--limel-text-editor-padding:0.25rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:1fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.3s;--limel-prosemirror-adapter-toolbar-transition-timing-function:cubic-bezier(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem));padding:1px}:host(limel-text-editor:focus-within),:host(limel-text-editor:not([ui=minimal]):hover){--limel-prosemirror-adapter-toolbar-opacity:1}:host(limel-text-editor[ui=minimal]:not(:focus-within)){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:0fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.46s;--limel-prosemirror-adapter-action-bar-padding-top-bottom:0;--limel-prosemirror-adapter-toolbar-opacity:0;--limel-text-editor-placeholder-top:0;min-height:2.5rem}:host(limel-text-editor:hover){--limel-text-editor-outline-color:rgba(var(--contrast-700), 1)}:host(limel-text-editor:focus-within){--limel-text-editor-outline-color:var(--mdc-theme-primary)}:host(limel-text-editor:focus-within) .placeholder,:host(limel-text-editor:focus) .placeholder{opacity:0}:host(limel-text-editor[disabled]:not([disabled=false])){cursor:not-allowed;opacity:0.4}:host(limel-text-editor[disabled]:not([disabled=false])) limel-prosemirror-adapter{pointer-events:none}:host(limel-text-editor[invalid]:not([invalid=false])){--limel-text-editor-outline-color:var(--lime-error-text-color)}:host(limel-text-editor[readonly]:not([readonly=false])){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0;--limel-text-editor-outline-color:transparent;--limel-text-editor-background-color:transparent}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown{display:block;padding:var(--limel-text-editor-padding);overflow-y:auto}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before,:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{z-index:1;pointer-events:none;content:"";display:block;position:absolute;width:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{height:1.75rem;top:0;background:linear-gradient(var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))), transparent)}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before{height:2rem;bottom:-0.25rem;background:linear-gradient(transparent, var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))))}.notched-outline{transition:bottom var(--limel-h-l-grid-template-rows-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89);pointer-events:none;position:absolute;inset:0;bottom:var(--limel-text-editor-notched-outline-bottom, 0);display:flex;background-color:var(--limel-text-editor-background-color)}.leading-outline,.notch,.trailing-outline{transition:border-color 0.2s ease;border-width:1px;border-style:solid;border-color:var(--limel-text-editor-outline-color)}.leading-outline{flex-shrink:0;width:0.75rem;border-right-width:0;border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.notch{flex-shrink:0;position:relative;z-index:2;border-top-width:0;border-right-width:0;border-left-width:0;max-width:calc(100% - 1.5rem)}.trailing-outline{flex-grow:1;border-left-width:0;border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}label{transform:translateY(-50%);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:block;padding:0 0.25rem;color:var(--limel-text-editor-label-color);font-size:0.65rem;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em)}:host(limel-text-editor[required]:not([required=false])) label::after{content:"*"}.placeholder{transition-property:top;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;position:absolute;top:var(--limel-text-editor-placeholder-top, 2.25rem);left:0;right:0;padding:var(--limel-text-editor-padding);font-style:italic;font-size:0.875rem;color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:0;height:100%;overflow:hidden auto}:host(limel-text-editor:focus),:host(limel-text-editor:focus-visible),:host(limel-text-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-text-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-text-editor:focus) limel-helper-line,:host(limel-text-editor:focus-visible) limel-helper-line,:host(limel-text-editor:focus-within) limel-helper-line,:host(limel-text-editor:hover) limel-helper-line{will-change:grid-template-rows}:host(limel-text-editor.has-helper-text:focus-within) .notched-outline,:host(limel-text-editor.has-helper-text[invalid]:not([invalid=false])) .notched-outline{--limel-text-editor-notched-outline-bottom:1rem}:host(limel-text-editor[allow-resize]) limel-prosemirror-adapter{resize:vertical}';const a=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.imagePasted=t(this,"imagePasted",7);this.imageRemoved=t(this,"imageRemoved",7);this.triggerStart=t(this,"triggerStart",7);this.triggerStop=t(this,"triggerStop",7);this.triggerChange=t(this,"triggerChange",7);this.renderHelperLine=()=>{if(!this.helperText){return}return r("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})};this.isInvalid=()=>{if(this.readonly){return false}if(this.invalid){return true}};this.handleChange=e=>{e.stopPropagation();this.change.emit(e.detail)};this.handleImagePasted=e=>{e.stopPropagation();this.imagePasted.emit(e.detail)};this.handleImageRemoved=e=>{e.stopPropagation();this.imageRemoved.emit(e.detail)};this.contentType="markdown";this.language="en";this.disabled=false;this.readonly=false;this.helperText=undefined;this.placeholder=undefined;this.label=undefined;this.invalid=false;this.value=undefined;this.customElements=[];this.triggers=[];this.required=false;this.allowResize=true;this.ui="standard";this.helperTextId=o();this.editorId=o()}render(){return r(i,{class:{"has-helper-text":!!this.helperText}},r("span",{class:"notched-outline"},r("span",{class:"leading-outline"}),this.renderLabel(),r("span",{class:"trailing-outline"})),this.renderEditor())}renderEditor(){if(this.readonly&&!this.value){return[r("span",{class:"lime-looks-like-input-value"},"–"),this.renderHelperLine()]}if(this.readonly){return[r("limel-markdown",{value:this.value,"aria-controls":this.helperTextId,id:this.editorId}),this.renderPlaceholder(),this.renderHelperLine()]}return[r("limel-prosemirror-adapter",{"aria-placeholder":this.placeholder,contentType:this.contentType,onChange:this.handleChange,onImagePasted:this.handleImagePasted,onImageRemoved:this.handleImageRemoved,customElements:this.customElements,value:this.value,"aria-controls":this.helperTextId,id:this.editorId,"aria-disabled":this.disabled,language:this.language,triggerCharacters:this.triggers,disabled:this.disabled}),this.renderPlaceholder(),this.renderHelperLine()]}renderLabel(){if(!this.label){return}return r("span",{class:"notch"},r("label",{htmlFor:this.editorId},this.label))}renderPlaceholder(){if(!this.placeholder||this.value){return}return r("span",{class:"placeholder","aria-hidden":"true"},this.placeholder)}static get delegatesFocus(){return true}};a.style=l;export{a as limel_text_editor};
|
|
2
|
+
//# sourceMappingURL=p-62a21e92.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["textEditorCss","TextEditor","constructor","hostRef","this","renderHelperLine","helperText","h","helperTextId","invalid","isInvalid","readonly","handleChange","event","stopPropagation","change","emit","detail","handleImagePasted","imagePasted","handleImageRemoved","imageRemoved","createRandomString","editorId","render","Host","class","renderLabel","renderEditor","value","id","renderPlaceholder","placeholder","contentType","onChange","onImagePasted","onImageRemoved","customElements","disabled","language","triggerCharacters","triggers","label","htmlFor"],"sources":["./src/components/text-editor/text-editor.scss?tag=limel-text-editor&encapsulation=shadow","./src/components/text-editor/text-editor.tsx"],"sourcesContent":["@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins.scss';\n\n/**\n * @prop --text-editor-max-height: the tallest height the text editor can become when auto-resizing itself. Defaults to `calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem)`.\n * @prop --text-editor-fade-out-background-color: the color of the fade-out effect at the top and bottom of the text editor, when the text-editor is in readonly state. Defaults to rgb(var(--contrast-100)).\n */\n\n@include shared_input-select-picker.lime-looks-like-input-value;\n.lime-looks-like-input-value {\n padding: var(--limel-text-editor-padding);\n}\n\n* {\n box-sizing: border-box;\n}\n\n:host(limel-text-editor) {\n --limel-text-editor-outline-color: #{shared_input-select-picker.$lime-text-field-outline-color};\n --limel-text-editor-background-color: #{shared_input-select-picker.$background-color-normal};\n --limel-text-editor-label-color: #{shared_input-select-picker.$label-color};\n --limel-prosemirror-adapter-toolbar-opacity: 0.6;\n --limel-text-editor-padding: 0.25rem 1rem 0.75rem 1rem;\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 1fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.3s;\n --limel-prosemirror-adapter-toolbar-transition-timing-function: cubic-bezier(\n 0.19,\n 0.23,\n 0.26,\n 0.89\n );\n\n position: relative;\n isolation: isolate;\n display: flex;\n flex-direction: column;\n\n width: 100%;\n min-width: 5rem;\n min-height: 5rem;\n height: 100%;\n max-height: var(\n --text-editor-max-height,\n calc(\n 100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) -\n 4rem\n )\n );\n padding: 1px; // prevents visual defects that can appear due to the backdrop-filter and closeness to borders\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:not([ui='minimal']):hover) {\n --limel-prosemirror-adapter-toolbar-opacity: 1;\n}\n\n:host(limel-text-editor[ui='minimal']:not(:focus-within)) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-prosemirror-adapter-toolbar-grid-template-rows: 0fr;\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration: 0.46s;\n --limel-prosemirror-adapter-action-bar-padding-top-bottom: 0;\n --limel-prosemirror-adapter-toolbar-opacity: 0;\n --limel-text-editor-placeholder-top: 0;\n min-height: 2.5rem;\n}\n\n:host(limel-text-editor:hover) {\n --limel-text-editor-outline-color: #{shared_input-select-picker.$lime-text-field-outline-color--hovered};\n}\n\n:host(limel-text-editor:focus-within) {\n --limel-text-editor-outline-color: #{shared_input-select-picker.$lime-text-field-outline-color--focused};\n}\n\n:host(limel-text-editor:focus-within),\n:host(limel-text-editor:focus) {\n .placeholder {\n opacity: 0;\n }\n}\n\n:host(limel-text-editor[disabled]:not([disabled='false'])) {\n @include shared_input-select-picker.looks-disabled;\n\n limel-prosemirror-adapter {\n pointer-events: none;\n }\n}\n\n:host(limel-text-editor[invalid]:not([invalid='false'])) {\n --limel-text-editor-outline-color: var(--lime-error-text-color);\n}\n\n:host(limel-text-editor[readonly]:not([readonly='false'])) {\n --limel-text-editor-padding: 0.75rem 1rem 0.75rem 1rem;\n --limel-text-editor-placeholder-top: 0;\n --limel-text-editor-outline-color: transparent;\n --limel-text-editor-background-color: transparent;\n\n limel-markdown {\n // displayed when `readonly` instead of the adapter\n display: block;\n padding: var(--limel-text-editor-padding);\n overflow-y: auto;\n\n &:before,\n &:after {\n z-index: 1;\n pointer-events: none;\n content: '';\n display: block;\n position: absolute;\n width: 100%;\n }\n &:after {\n height: 1.75rem;\n top: 0;\n background: linear-gradient(\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n ),\n transparent\n );\n }\n\n &:before {\n height: 2rem;\n bottom: -0.25rem;\n background: linear-gradient(\n transparent,\n var(\n --text-editor-fade-out-background-color,\n rgb(var(--contrast-100))\n )\n );\n }\n }\n}\n\n.notched-outline {\n transition: bottom\n var(--limel-h-l-grid-template-rows-transition-speed, 0.46s)\n cubic-bezier(1, 0.09, 0, 0.89);\n pointer-events: none;\n position: absolute;\n inset: 0;\n bottom: var(--limel-text-editor-notched-outline-bottom, 0);\n\n display: flex;\n background-color: var(--limel-text-editor-background-color);\n}\n\n.leading-outline,\n.notch,\n.trailing-outline {\n transition: border-color 0.2s ease;\n border-width: 1px;\n border-style: solid;\n border-color: var(--limel-text-editor-outline-color);\n}\n\n.leading-outline {\n flex-shrink: 0;\n width: 0.75rem;\n border-right-width: 0;\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n.notch {\n flex-shrink: 0;\n\n position: relative;\n z-index: 2;\n\n border-top-width: 0;\n border-right-width: 0;\n border-left-width: 0;\n\n max-width: calc(100% - 1.5rem);\n}\n\n.trailing-outline {\n flex-grow: 1;\n border-left-width: 0;\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\nlabel {\n transform: translateY(-50%);\n\n @include mixins.truncate-text;\n display: block;\n padding: 0 0.25rem;\n\n color: var(--limel-text-editor-label-color);\n font-size: 0.65rem; // `10.4px` similar to MDC's floating label\n letter-spacing: var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);\n\n :host(limel-text-editor[required]:not([required='false'])) & {\n &::after {\n content: '*';\n }\n }\n}\n\n.placeholder {\n transition-property: top;\n transition-duration: var(\n --limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration\n );\n transition-timing-function: var(\n --limel-prosemirror-adapter-toolbar-transition-timing-function\n );\n @include mixins.truncate-text;\n pointer-events: none;\n position: absolute;\n top: var(--limel-text-editor-placeholder-top, 2.25rem);\n left: 0;\n right: 0;\n\n padding: var(--limel-text-editor-padding);\n font-style: italic;\n font-size: 0.875rem;\n color: shared_input-select-picker.$input-placeholder-color;\n}\n\nlimel-prosemirror-adapter {\n flex-grow: 1;\n\n min-width: 0;\n min-height: 0;\n height: 100%;\n overflow: hidden auto;\n}\n\n@include mixins.hide-helper-line-when-not-needed(limel-text-editor);\n:host(limel-text-editor.has-helper-text:focus-within),\n:host(limel-text-editor.has-helper-text[invalid]:not([invalid='false'])) {\n .notched-outline {\n --limel-text-editor-notched-outline-bottom: 1rem;\n }\n}\n\n:host(limel-text-editor[allow-resize]) {\n limel-prosemirror-adapter {\n resize: vertical;\n }\n}\n","import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { FormComponent } from '../form/form.types';\nimport { Languages } from '../date-picker/date.types';\nimport { createRandomString } from '../../util/random-string';\nimport { CustomElementDefinition } from '../../global/shared-types/custom-element.types';\nimport {\n TriggerCharacter,\n TriggerEventDetail,\n ImageInserter,\n ImageInfo,\n} from './text-editor.types';\nimport { EditorUiType } from './types';\n\n/**\n * A rich text editor that offers a rich text editing experience with markdown support,\n * in the sense that you can easily type markdown syntax and see the rendered\n * result as rich text in real-time. For instance, you can type `# Hello, world!`\n * and see it directly turning to a heading 1 (an `<h1>` HTML element).\n *\n * Naturally, you can use standard keyboard hotkeys such as <kbd>Ctrl</kbd> + <kbd>B</kbd>\n * to toggle bold text, <kbd>Ctrl</kbd> + <kbd>I</kbd> to toggle italic text, and so on.\n *\n * @exampleComponent limel-example-text-editor-basic\n * @exampleComponent limel-example-text-editor-as-form-component\n * @exampleComponent limel-example-text-editor-with-markdown\n * @exampleComponent limel-example-text-editor-with-html\n * @exampleComponent limel-example-text-editor-with-tables\n * @exampleComponent limel-example-text-editor-with-inline-images-file-storage\n * @exampleComponent limel-example-text-editor-with-inline-images-base64\n * @exampleComponent limel-example-text-editor-allow-resize\n * @exampleComponent limel-example-text-editor-size\n * @exampleComponent limel-example-text-editor-ui\n * @exampleComponent limel-example-text-editor-custom-element\n * @exampleComponent limel-example-text-editor-triggers\n * @exampleComponent limel-example-text-editor-composite\n * @beta\n */\n@Component({\n tag: 'limel-text-editor',\n shadow: { delegatesFocus: true },\n styleUrl: 'text-editor.scss',\n})\nexport class TextEditor implements FormComponent<string> {\n /** The type of content that the editor should handle and emit, defaults to `markdown`\n *\n * Assumed to be set only once, so not reactive to changes\n */\n @Prop()\n public contentType: 'markdown' | 'html' = 'markdown';\n\n /**\n * Defines the language for translations.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Set to `true` to disable the field.\n * Use `disabled` to indicate that the field can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled?: boolean = false;\n\n /**\n * Set to `true` to make the component read-only.\n * Use `readonly` when the field is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n * :::note\n * Consider that it might be better to use `limel-markdown`\n * instead of `limel-text-editor` when the goal is visualizing data.\n * :::\n */\n @Prop({ reflect: true })\n public readonly?: boolean = false;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * The placeholder text shown inside the input field,\n * when the field is empty.\n */\n @Prop({ reflect: true })\n public placeholder?: string;\n\n /**\n * The label of the editor\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Set to `true` to indicate that the current value of the editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid?: boolean = false;\n\n /**\n * Description of the text inside the editor as markdown\n */\n @Prop({ reflect: true })\n public value: string;\n\n /**\n * A list of custom elements\n *\n * Any `CustomElement` that should be used inside the text editor needs\n * to be defined here.\n *\n * @private\n * @alpha\n */\n @Prop()\n public customElements: CustomElementDefinition[] = [];\n\n /**\n * A set of trigger characters\n *\n * Defining a character here will enable trigger events to be sent if the\n * character is detected in the editor.\n *\n * @private\n * @alpha\n */\n @Prop()\n public triggers: TriggerCharacter[] = [];\n\n /**\n * Set to `true` to indicate that the field is required.\n *\n * :::important\n * An empty but required field is not automatically considered invalid.\n * You must make sure to check the validity of the field on your own,\n * and properly handle the `invalid` state.\n * :::\n */\n @Prop({ reflect: true })\n public required?: boolean = false;\n\n /**\n * Set to `true` to allow the user to vertically resize the editor.\n * Set to `false` to disable the resize functionality.\n */\n @Prop({ reflect: true })\n public allowResize: boolean = true;\n\n /**\n * Specifies the visual appearance of the editor.\n *\n * - `standard`: The default editor appearance with a full toolbar and\n * standard layout.\n * - `minimal`: A compact editor appearance, ideal for limited space\n * scenarios such as mobile devices. In this mode, the toolbar is hidden\n * until the editor is focused.\n */\n @Prop({ reflect: true })\n public ui?: EditorUiType = 'standard';\n\n /**\n * Dispatched when a change is made to the editor\n */\n @Event()\n public change: EventEmitter<string>;\n\n /**\n * Dispatched when a image is pasted into the editor\n *\n * @private\n * @alpha\n */\n @Event()\n private imagePasted: EventEmitter<ImageInserter>;\n\n /**\n * Dispatched when a image is removed from the editor\n *\n * @private\n * @alpha\n */\n @Event()\n private imageRemoved: EventEmitter<ImageInfo>;\n\n /**\n * Dispatched if a trigger character is detected.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStart: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a trigger session is ended. That is if the selection\n * goes outside the trigger input or if something is inserted using the\n * supplied `TextEditor` insert function.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerStop: EventEmitter<TriggerEventDetail>;\n\n /**\n * Dispatched if a input is changed during an active trigger.\n *\n * @private\n * @alpha\n */\n @Event()\n public triggerChange: EventEmitter<TriggerEventDetail>;\n\n private helperTextId: string;\n private editorId: string;\n\n public constructor() {\n this.helperTextId = createRandomString();\n this.editorId = createRandomString();\n }\n\n public render() {\n return (\n <Host\n class={{\n 'has-helper-text': !!this.helperText,\n }}\n >\n <span class=\"notched-outline\">\n <span class=\"leading-outline\" />\n {this.renderLabel()}\n <span class=\"trailing-outline\" />\n </span>\n {this.renderEditor()}\n </Host>\n );\n }\n\n private renderEditor() {\n if (this.readonly && !this.value) {\n return [\n <span class=\"lime-looks-like-input-value\">–</span>,\n this.renderHelperLine(),\n ];\n }\n\n if (this.readonly) {\n return [\n <limel-markdown\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n />,\n this.renderPlaceholder(),\n this.renderHelperLine(),\n ];\n }\n\n return [\n <limel-prosemirror-adapter\n aria-placeholder={this.placeholder}\n contentType={this.contentType}\n onChange={this.handleChange}\n onImagePasted={this.handleImagePasted}\n onImageRemoved={this.handleImageRemoved}\n customElements={this.customElements}\n value={this.value}\n aria-controls={this.helperTextId}\n id={this.editorId}\n aria-disabled={this.disabled}\n language={this.language}\n triggerCharacters={this.triggers}\n disabled={this.disabled}\n />,\n this.renderPlaceholder(),\n this.renderHelperLine(),\n ];\n }\n\n private renderLabel() {\n if (!this.label) {\n return;\n }\n\n return (\n <span class=\"notch\">\n <label htmlFor={this.editorId}>{this.label}</label>\n </span>\n );\n }\n\n private renderPlaceholder() {\n if (!this.placeholder || this.value) {\n return;\n }\n\n return (\n <span class=\"placeholder\" aria-hidden=\"true\">\n {this.placeholder}\n </span>\n );\n }\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.isInvalid()}\n />\n );\n };\n\n private isInvalid = () => {\n if (this.readonly) {\n // A readonly field can never be invalid.\n return false;\n }\n\n if (this.invalid) {\n return true;\n }\n };\n\n private handleChange = (event: CustomEvent<string>) => {\n event.stopPropagation();\n this.change.emit(event.detail);\n };\n\n private handleImagePasted = (event: CustomEvent<ImageInserter>) => {\n event.stopPropagation();\n this.imagePasted.emit(event.detail);\n };\n\n private handleImageRemoved = (event: CustomEvent<ImageInfo>) => {\n event.stopPropagation();\n this.imageRemoved.emit(event.detail);\n };\n}\n"],"mappings":"6FAAA,MAAMA,EAAgB,6mO,MC0CTC,EAAU,MAkLnBC,YAAAC,G,8PAuFQC,KAAAC,iBAAmB,KACvB,IAAKD,KAAKE,WAAY,CAClB,M,CAGJ,OACIC,EAAA,qBACID,WAAYF,KAAKE,WACjBE,aAAcJ,KAAKI,aACnBC,QAASL,KAAKM,aAChB,EAIFN,KAAAM,UAAY,KAChB,GAAIN,KAAKO,SAAU,CAEf,OAAO,K,CAGX,GAAIP,KAAKK,QAAS,CACd,OAAO,I,GAIPL,KAAAQ,aAAgBC,IACpBA,EAAMC,kBACNV,KAAKW,OAAOC,KAAKH,EAAMI,OAAO,EAG1Bb,KAAAc,kBAAqBL,IACzBA,EAAMC,kBACNV,KAAKe,YAAYH,KAAKH,EAAMI,OAAO,EAG/Bb,KAAAgB,mBAAsBP,IAC1BA,EAAMC,kBACNV,KAAKiB,aAAaL,KAAKH,EAAMI,OAAO,E,iBAxSE,W,cAMb,K,cASD,M,cAYA,M,uFA0BD,M,yCAkBwB,G,cAYb,G,cAYV,M,iBAOE,K,QAYH,WA2DvBb,KAAKI,aAAec,IACpBlB,KAAKmB,SAAWD,G,CAGbE,SACH,OACIjB,EAACkB,EAAI,CACDC,MAAO,CACH,oBAAqBtB,KAAKE,aAG9BC,EAAA,QAAMmB,MAAM,mBACRnB,EAAA,QAAMmB,MAAM,oBACXtB,KAAKuB,cACNpB,EAAA,QAAMmB,MAAM,sBAEftB,KAAKwB,e,CAKVA,eACJ,GAAIxB,KAAKO,WAAaP,KAAKyB,MAAO,CAC9B,MAAO,CACHtB,EAAA,QAAMmB,MAAM,+BAA6B,KACzCtB,KAAKC,mB,CAIb,GAAID,KAAKO,SAAU,CACf,MAAO,CACHJ,EAAA,kBACIsB,MAAOzB,KAAKyB,MAAK,gBACFzB,KAAKI,aACpBsB,GAAI1B,KAAKmB,WAEbnB,KAAK2B,oBACL3B,KAAKC,mB,CAIb,MAAO,CACHE,EAAA,gDACsBH,KAAK4B,YACvBC,YAAa7B,KAAK6B,YAClBC,SAAU9B,KAAKQ,aACfuB,cAAe/B,KAAKc,kBACpBkB,eAAgBhC,KAAKgB,mBACrBiB,eAAgBjC,KAAKiC,eACrBR,MAAOzB,KAAKyB,MAAK,gBACFzB,KAAKI,aACpBsB,GAAI1B,KAAKmB,SAAQ,gBACFnB,KAAKkC,SACpBC,SAAUnC,KAAKmC,SACfC,kBAAmBpC,KAAKqC,SACxBH,SAAUlC,KAAKkC,WAEnBlC,KAAK2B,oBACL3B,KAAKC,mB,CAILsB,cACJ,IAAKvB,KAAKsC,MAAO,CACb,M,CAGJ,OACInC,EAAA,QAAMmB,MAAM,SACRnB,EAAA,SAAOoC,QAASvC,KAAKmB,UAAWnB,KAAKsC,O,CAKzCX,oBACJ,IAAK3B,KAAK4B,aAAe5B,KAAKyB,MAAO,CACjC,M,CAGJ,OACItB,EAAA,QAAMmB,MAAM,cAAa,cAAa,QACjCtB,KAAK4B,Y"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as e,h as r}from"./p-443111b3.js";import{t as a}from"./p-efd753ba.js";import{c as i}from"./p-96460db3.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as e,h as r}from"./p-443111b3.js";import{t as a}from"./p-032d839e.js";import{c as i}from"./p-96460db3.js";const o='@charset "UTF-8";:host(limel-chart){--chart-axis-line-color:var(\n --limel-chart-axis-line-color,\n rgb(var(--contrast-900))\n );box-sizing:border-box;isolation:isolate;display:flex;width:100%;height:100%;min-width:0;min-height:0;padding:var(--limel-chart-padding)}table{all:unset;border-collapse:collapse;border-spacing:0;empty-cells:show;position:relative;display:flex;width:100%;height:100%;min-width:0;min-height:0}table colgroup,table thead,table tbody,table tr,table th,table td{all:unset}table caption,table colgroup,table thead,table tfoot,table th,table td{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}*,*:before,*:after{box-sizing:border-box}.chart{position:relative;flex-grow:1;width:100%;height:100%;min-height:0;min-width:0}.chart:has(.item:hover) .item,.chart:has(.item:focus-visible) .item{opacity:0.4}.item{transition:background-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.4s ease;cursor:help}.item:focus{outline:none}.item:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.item:focus-visible,.item:hover{opacity:1 !important}.item[role=button]{cursor:pointer}limel-spinner{margin:auto}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart,:host(limel-chart[type=line]) .chart,:host(limel-chart[type=area]) .chart{display:flex;background-color:var(--chart-background-color, transparent)}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item,:host(limel-chart[type=line]) .item,:host(limel-chart[type=area]) .item{position:relative;mix-blend-mode:hard-light}:host(limel-chart[type=bar][orientation=landscape]),:host(limel-chart[type=dot][orientation=landscape]),:host(limel-chart[type=line][orientation=landscape]),:host(limel-chart[type=area][orientation=landscape]){--limel-chart-padding:0.5rem 0.5rem 0.5rem 2rem}:host(limel-chart[type=bar][orientation=landscape]) .chart,:host(limel-chart[type=dot][orientation=landscape]) .chart,:host(limel-chart[type=line][orientation=landscape]) .chart,:host(limel-chart[type=area][orientation=landscape]) .chart{flex-direction:row;align-items:flex-end;overflow:auto hidden;padding:0 0.125rem}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item,:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{min-width:0.5rem;width:inherit}:host(limel-chart[type=bar][orientation=portrait]),:host(limel-chart[type=dot][orientation=portrait]),:host(limel-chart[type=line][orientation=portrait]),:host(limel-chart[type=area][orientation=portrait]){--limel-chart-padding:0.5rem 0.5rem 1rem 0.5rem}:host(limel-chart[type=bar][orientation=portrait]) .chart,:host(limel-chart[type=dot][orientation=portrait]) .chart,:host(limel-chart[type=line][orientation=portrait]) .chart,:host(limel-chart[type=area][orientation=portrait]) .chart{flex-direction:column;overflow:hidden auto;padding:0.125rem 0}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item,:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{min-height:0.5rem;height:inherit}:host(limel-chart[type=pie]) table,:host(limel-chart[type=doughnut]) table,:host(limel-chart[type=ring]) table{min-height:2rem;min-width:2rem}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .chart,:host(limel-chart[type=ring]) .item{aspect-ratio:1;display:flex;margin:auto}:host(limel-chart[type=pie]) .chart,:host(limel-chart[type=doughnut]) .chart,:host(limel-chart[type=ring]) .chart{justify-content:center;align-items:center}:host(limel-chart[type=pie]) .chart:before,:host(limel-chart[type=doughnut]) .chart:before,:host(limel-chart[type=ring]) .chart:before{aspect-ratio:1;content:"";position:absolute;z-index:0;inset:0;margin:auto;border-radius:50%;max-width:100%;max-height:100%;background-color:var(--chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item,:host(limel-chart[type=ring]) .item{max-width:100%;max-height:100%;border-radius:50%;position:absolute;inset:0}:host(limel-chart[type=bar]) .chart,:host(limel-chart[type=dot]) .chart{gap:0.5rem}:host(limel-chart[type=bar]) .item,:host(limel-chart[type=dot]) .item{display:flex;align-items:center;justify-content:center;border-radius:var(--chart-item-border-radius, 0.125rem)}:host(limel-chart[type=bar]) .item{background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item:before,:host(limel-chart[type=dot]) .item:after{content:"";position:absolute;margin:auto;width:0.5rem;height:0.5rem;border-radius:50%}:host(limel-chart[type=dot]) .item::after{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=dot]) .item.has-start-value:before{background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=bar][orientation=landscape]) .item,:host(limel-chart[type=dot][orientation=landscape]) .item{height:calc(var(--limel-chart-item-size) * 1%);bottom:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=landscape]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=landscape]) .item.has-negative-value-only{height:calc(var(--limel-chart-item-size) * -1%);transform-origin:bottom;transform:rotateX(180deg)}:host(limel-chart[type=dot][orientation=landscape]) .item.has-start-value,:host(limel-chart[type=dot][orientation=landscape]) .item:hover,:host(limel-chart[type=dot][orientation=landscape]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=dot][orientation=landscape]) .item:before{inset:auto 0 0 0;transform:translateY(50%)}:host(limel-chart[type=dot][orientation=landscape]) .item::after{inset:0 0 auto 0;transform:translateY(-50%)}:host(limel-chart[type=bar][orientation=portrait]) .item,:host(limel-chart[type=dot][orientation=portrait]) .item{width:calc(var(--limel-chart-item-size) * 1%);left:calc(var(--limel-chart-item-offset) * 1%)}:host(limel-chart[type=bar][orientation=portrait]) .item.has-negative-value-only,:host(limel-chart[type=dot][orientation=portrait]) .item.has-negative-value-only{width:calc(var(--limel-chart-item-size) * -1%);transform-origin:left;transform:rotateY(180deg)}:host(limel-chart[type=dot][orientation=portrait]) .item.has-start-value,:host(limel-chart[type=dot][orientation=portrait]) .item:hover,:host(limel-chart[type=dot][orientation=portrait]) .item:focus-visible{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/100% 1px no-repeat}:host(limel-chart[type=dot][orientation=portrait]) .item:before{inset:0 auto 0 0;transform:translateX(-50%)}:host(limel-chart[type=dot][orientation=portrait]) .item:after{inset:0 0 0 auto;transform:translateX(50%)}:host(limel-chart[type=area]) .item,:host(limel-chart[type=line]) .item{position:relative}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=line]) .item:after{margin:auto;width:0.5rem;height:0.5rem;border-radius:50%;border:1px solid rgb(var(--contrast-100))}:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:before{inset:0}:host(limel-chart[type=area]) .item:after,:host(limel-chart[type=area]) .item:before,:host(limel-chart[type=line]) .item:after,:host(limel-chart[type=line]) .item:before{transition:border-color 0.2s ease, opacity 0.4s ease;content:"";position:absolute;background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after,:host(limel-chart[type=line]) .item:hover:after,:host(limel-chart[type=line]) .item:focus-visible:after{border-color:transparent}:host(limel-chart[type=line][orientation=landscape]) .item,:host(limel-chart[type=area][orientation=landscape]) .item{height:100%}:host(limel-chart[type=line][orientation=landscape]) .item:after,:host(limel-chart[type=area][orientation=landscape]) .item:after{transform:translateX(-50%) translateY(50%);left:0;bottom:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=line][orientation=portrait]) .item,:host(limel-chart[type=area][orientation=portrait]) .item{width:100%}:host(limel-chart[type=line][orientation=portrait]) .item:after,:host(limel-chart[type=area][orientation=portrait]) .item:after{transform:translateX(-50%) translateY(-50%);left:calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%)}:host(limel-chart[type=area]) .item:after{opacity:0}:host(limel-chart[type=area]) .item:hover:after,:host(limel-chart[type=area]) .item:focus-visible:after{opacity:1}:host(limel-chart[type=area]) .item:hover:before,:host(limel-chart[type=area]) .item:focus-visible:before{opacity:0.7}:host(limel-chart[type=area][orientation=landscape]){}:host(limel-chart[type=area][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - var(--limel-chart-item-offset)) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%), 100% calc((100 - var(--limel-chart-next-item-offset)) * 1%))}:host(limel-chart[type=area][orientation=portrait]){}:host(limel-chart[type=area][orientation=portrait]) .item:before{clip-path:polygon(calc(var(--limel-chart-item-offset) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%, calc(var(--limel-chart-next-item-offset) * 1%) 100%)}:host(limel-chart[type=line]){--limel-chart-line-thickness:0.125rem}:host(limel-chart[type=line]) .item:hover:before{opacity:0.4}:host(limel-chart[type=line][orientation=landscape]){}:host(limel-chart[type=line][orientation=landscape]) .item:hover{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) left/1px 100% no-repeat}:host(limel-chart[type=line][orientation=landscape]) .item:before{clip-path:polygon(0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1%), 0 calc((100 - (var(--limel-chart-item-size) + var(--limel-chart-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1% + var(--limel-chart-line-thickness)), 100% calc((100 - (var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset))) * 1%))}:host(limel-chart[type=line][orientation=portrait]){}:host(limel-chart[type=line][orientation=portrait]) .item:hover{background:linear-gradient(to right, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) top/100% 1px no-repeat}:host(limel-chart[type=line][orientation=portrait]) .item:before{clip-path:polygon(calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1%) 0, calc((var(--limel-chart-item-size) + var(--limel-chart-item-offset)) * 1% + var(--limel-chart-line-thickness)) 0, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1% + var(--limel-chart-line-thickness)) 100%, calc((var(--limel-chart-next-item-size) + var(--limel-chart-next-item-offset)) * 1%) 100%)}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{background:conic-gradient(transparent 0 calc(var(--limel-chart-item-offset) * 1%), var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) calc(var(--limel-chart-item-offset) * 1%) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), transparent calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%))}:host(limel-chart[type=pie]) .item:focus,:host(limel-chart[type=pie]) .item:focus-visible,:host(limel-chart[type=doughnut]) .item:focus,:host(limel-chart[type=doughnut]) .item:focus-visible{outline:none}:host(limel-chart[type=pie]) .item,:host(limel-chart[type=doughnut]) .item{pointer-events:none}:host(limel-chart[type=doughnut]) .chart:after{aspect-ratio:1;content:"";position:absolute;inset:0;margin:auto;max-width:60%;max-height:60%;border-radius:50%;background-color:rgb(var(--contrast-100))}:host(limel-chart[type=ring]) .chart:after{content:"";position:absolute;inset:0;aspect-ratio:1;border-radius:50%;max-height:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));max-width:calc(100% - var(--limel-chart-number-of-items) * 100% / (var(--limel-chart-number-of-items) + 1));background-color:var(--limel-chart-background-color, rgb(var(--contrast-200)))}:host(limel-chart[type=ring]) .chart:has(.item:hover) .item,:host(limel-chart[type=ring]) .chart:has(.item:focus-visible) .item{opacity:1;filter:grayscale(1)}:host(limel-chart[type=ring]) .chart:after,:host(limel-chart[type=ring]) .item{margin:auto;border:1px solid var(--limel-chart-background-color, rgb(var(--contrast-400)))}:host(limel-chart[type=ring]) .item{background:conic-gradient(var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8))) 0 calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%), var(--chart-background-color, rgb(var(--contrast-200))) calc(var(--limel-chart-item-offset) * 1% + var(--limel-chart-item-size) * 1%));max-width:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1));max-height:calc(100% - var(--limel-chart-item-index) * 100% / (var(--limel-chart-number-of-items) + 1))}:host(limel-chart[type=ring]) .item:focus-visible,:host(limel-chart[type=ring]) .item:hover{filter:grayscale(0) !important}:host(limel-chart[type=stacked-bar]) .chart{display:flex;border-radius:0.25rem;overflow:hidden;background-color:var(--chart-background-color, rgb(var(--contrast-800), 0.2))}:host(limel-chart[type=stacked-bar]) .item{display:flex;border-radius:var(--chart-item-border-radius, 0);background:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)))}:host(limel-chart[type=stacked-bar]) .item:last-of-type:not(:focus-visible){box-shadow:none !important}:host(limel-chart[type=stacked-bar][orientation=landscape]) .chart{flex-direction:row}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item{min-height:0.5rem;width:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=landscape]) .item:not(:focus-visible){box-shadow:-1px 0 0 0 var(--chart-item-divider-color, rgb(var(--color-white), 0.6)) inset}:host(limel-chart[type=stacked-bar][orientation=portrait]) .chart{flex-direction:column-reverse}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item{min-width:0.5rem;height:calc(var(--limel-chart-item-size) * 1%)}:host(limel-chart[type=stacked-bar][orientation=portrait]) .item:not(:focus-visible){box-shadow:0 -1px 0 0 rgb(var(--color-white), 0.6) inset}:host(limel-chart[type=nps]){--limel-chart-nps-gauge-angel:220deg}:host(limel-chart[type=nps]) table{min-height:4rem;min-width:4rem}:host(limel-chart[type=nps]) .chart{position:relative;display:flex;justify-content:center;align-items:center;aspect-ratio:1;margin:auto;width:unset;height:unset;max-width:100%;max-height:100%;rotate:calc(var(--limel-chart-nps-gauge-angel) / 2 * -1);transform:translate(-15%, -5%)}:host(limel-chart[type=nps]) .chart:before,:host(limel-chart[type=nps]) .chart:after{content:"";aspect-ratio:1;position:absolute;border-radius:50%;z-index:-1;min-height:0;min-width:0}:host(limel-chart[type=nps]) .chart:before{height:100%;max-height:100%;background:conic-gradient(rgb(var(--color-coral-default)) 0deg calc(var(--limel-chart-nps-gauge-angel) / 2), rgb(var(--color-amber-light)) calc(var(--limel-chart-nps-gauge-angel) / 2) calc(var(--limel-chart-nps-gauge-angel) * 0.65), rgb(var(--color-lime-light)) calc(var(--limel-chart-nps-gauge-angel) * 0.65) calc(var(--limel-chart-nps-gauge-angel) * 0.85), rgb(var(--color-lime-default)) calc(var(--limel-chart-nps-gauge-angel) * 0.85) var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .chart:after{height:calc(100% - min(3rem, 20%) * 2);max-height:calc(100% - min(3rem, 20%) * 2);background:conic-gradient(var(--chart-background-color, rgb(var(--contrast-100))) 0deg var(--limel-chart-nps-gauge-angel), transparent var(--limel-chart-nps-gauge-angel))}:host(limel-chart[type=nps]) .item{display:flex;align-items:flex-start;justify-content:center;border-radius:0.5rem;position:absolute;height:calc(50% - min(3rem, 20%) + 0.5rem);width:0.5rem;transform:translateY(-50%) rotate(calc((var(--limel-chart-item-value) + 100) / 200 * var(--limel-chart-nps-gauge-angel)));transform-origin:bottom}:host(limel-chart[type=nps]) .item:hover,:host(limel-chart[type=nps]) .item:focus-visible{background:linear-gradient(to bottom, rgb(var(--contrast-800), 0.4) 0%, rgb(var(--contrast-800), 0.4) 100%) center/1px 100% no-repeat}:host(limel-chart[type=nps]) .item:before,:host(limel-chart[type=nps]) .item:after{content:"";position:absolute}:host(limel-chart[type=nps]) .item:before{transform:translateY(-60%);width:0.4rem;border-radius:1rem;border-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));border-style:solid;border-bottom-width:1.75rem;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent}:host(limel-chart[type=nps]) .item:after{border-radius:50%;background-color:var(--limel-chart-item-color, var(--chart-item-color, rgb(var(--contrast-1100), 0.8)));aspect-ratio:1;height:clamp(0.75rem, 10%, 1.25rem);border:0.125rem solid rgb(var(--contrast-100), 0.8);box-shadow:var(--shadow-depth-8)}.axises{position:absolute;display:flex;justify-content:space-between;min-height:100%;min-width:100%;height:100%;width:100%}.axis-line{transition:opacity 0.4s ease;position:relative;opacity:0.2;font-size:0.625rem;border-color:var(--limel-chart-axis-line-color)}.axis-line:hover{opacity:0.6;transition-duration:0.2s}.axis-line.zero-line{opacity:0.6;z-index:1}.axis-line limel-badge{--badge-background-color:transparent;--badge-text-color:currentColor;position:absolute;text-align:right;min-width:2rem}:host(limel-chart[orientation=landscape]) .axises{flex-direction:column-reverse}:host(limel-chart[orientation=landscape]) .axis-line{border-bottom:1px solid;transform:translateY(50%)}:host(limel-chart[orientation=landscape]) .axis-line limel-badge{bottom:0;left:-2rem;transform:translateY(50%)}:host(limel-chart[orientation=portrait]) .axises{flex-direction:row}:host(limel-chart[orientation=portrait]) .axis-line{border-left:1px solid;transform:translateX(-50%)}:host(limel-chart[orientation=portrait]) .axis-line limel-badge{bottom:-1rem;right:-1rem}';const l=100;const n=10;const h=class{constructor(r){t(this,r);this.interact=e(this,"interact",7);this.handleClick=t=>{const e=this.getClickableItem(t.currentTarget);if(!e){return}t.stopPropagation();this.interact.emit(e)};this.handleKeyDown=t=>{if(t.key!=="Enter"&&t.key!==" "){return}const e=this.getClickableItem(t.currentTarget);if(!e){return}t.preventDefault();this.interact.emit(e)};this.language="en";this.accessibleLabel=undefined;this.accessibleItemsLabel=undefined;this.items=undefined;this.type="stacked-bar";this.orientation="landscape";this.maxValue=undefined;this.axisIncrement=undefined;this.loading=false}componentWillLoad(){this.recalculateRangeData()}render(){if(this.loading){return r("limel-spinner",{limeBranded:false})}return r("table",{"aria-busy":this.loading?"true":"false","aria-live":"polite",style:{"--limel-chart-number-of-items":this.items.length.toString()}},this.renderCaption(),this.renderTableHeader(),this.renderAxises(),r("tbody",{class:"chart"},this.renderItems()))}renderCaption(){if(!this.accessibleLabel){return}return r("caption",null,this.accessibleLabel)}renderTableHeader(){return r("thead",null,r("tr",null,r("th",{scope:"col"},this.accessibleItemsLabel),r("th",{scope:"col"},a.get("value",this.language))))}renderAxises(){if(!["bar","dot","area","line"].includes(this.type)){return}const{minValue:t,maxValue:e}=this.range;const a=[];const i=Math.floor(t/this.axisIncrement)*this.axisIncrement;const o=Math.ceil(e/this.axisIncrement)*this.axisIncrement;for(let t=i;t<=o;t+=this.axisIncrement){a.push(r("div",{class:{"axis-line":true,"zero-line":t===0},role:"presentation"},r("limel-badge",{label:t})))}return r("div",{class:"axises",role:"presentation"},a)}renderItems(){var t;if(!((t=this.items)===null||t===void 0?void 0:t.length)){return}let e=0;return this.items.map(((t,a)=>{const o=i();const l=this.calculateSizeAndOffset(t);const n=l.size;let h=l.offset;if(this.type==="pie"||this.type==="doughnut"){h=e;e+=n}return r("tr",{style:this.getItemStyle(t,a,n,h),class:this.getItemClass(t),key:o,id:o,"data-index":a,tabIndex:0,role:t.clickable?"button":null,onClick:this.handleClick,onKeyDown:this.handleKeyDown},r("th",null,this.getItemText(t)),r("td",null,this.getFormattedValue(t)),this.renderTooltip(t,o,n))}))}getItemStyle(t,e,r,a){const i={"--limel-chart-item-offset":`${a}`,"--limel-chart-item-size":`${r}`,"--limel-chart-item-index":`${e}`,"--limel-chart-item-value":`${t.value}`};if(t.color){i["--limel-chart-item-color"]=t.color}if(this.type==="line"||this.type==="area"){const t=this.calculateSizeAndOffset(this.items[e+1]);i["--limel-chart-next-item-size"]=`${t.size}`;i["--limel-chart-next-item-offset"]=`${t.offset}`}return i}getItemClass(t){return{item:true,"has-start-value":Array.isArray(t.value),"has-negative-value-only":this.getMaximumValue(t)<0&&!this.isRangeItem(t)}}calculateSizeAndOffset(t){const{minValue:e,totalRange:r}=this.range;if(!t){return{size:0,offset:0}}let a=0;if(this.isRangeItem(t)){a=this.getMinimumValue(t)}const i=(a-e)/r*l;const o=(this.getMaximumValue(t)-e)/r*l;return{size:o-i,offset:i}}getFormattedValue(t){const{value:e,formattedValue:r}=t;if(r){return r}if(Array.isArray(e)){return`${e[0]} — ${e[1]}`}return`${e}`}getItemText(t){return t.text}renderTooltip(t,e,a){const i=this.getItemText(t);const o=2;const l=this.getFormattedValue(t);const n={label:i,helperLabel:l,elementId:e};if(this.type!=="bar"&&this.type!=="dot"&&this.type!=="nps"){n.label=`${i} (${a.toFixed(o)}%)`}return r("limel-tooltip",Object.assign({},n,{openDirection:this.orientation==="portrait"?"right":"top"}))}calculateRange(){var t;if(this.range){return this.range}const e=Math.min(0,...this.items.map(this.getMinimumValue));const r=Math.max(...this.items.map(this.getMaximumValue));const a=this.items.reduce(((t,e)=>t+this.getMaximumValue(e)),0);let i=(t=this.maxValue)!==null&&t!==void 0?t:r;if((this.type==="pie"||this.type==="doughnut")&&!this.maxValue){i=a}if(!this.axisIncrement){this.axisIncrement=this.calculateAxisIncrement(this.items)}const o=Math.ceil(i/this.axisIncrement)*this.axisIncrement;const l=Math.floor(e/this.axisIncrement)*this.axisIncrement;const n=o-l;return{minValue:l,maxValue:o,totalRange:n}}calculateAxisIncrement(t,e=n){const r=Math.max(...t.map((t=>{const e=t.value;if(Array.isArray(e)){return Math.max(...e)}return e})));const a=r/e;const i=10**Math.floor(Math.log10(a));return Math.ceil(a/i)*i}getMinimumValue(t){const e=t.value;return Array.isArray(e)?Math.min(...e):e}getMaximumValue(t){const e=t.value;return Array.isArray(e)?Math.max(...e):e}isRangeItem(t){return Array.isArray(t.value)}handleChange(){this.range=null;this.recalculateRangeData()}recalculateRangeData(){this.range=this.calculateRange()}getClickableItem(t){const e=t.dataset.index;if(e===undefined){return}const r=this.items[Number(e)];if(!r.clickable){return}return r}static get watchers(){return{items:["handleChange"],axisIncrement:["handleChange"],maxValue:["handleChange"]}}};h.style=o;export{h as limel_chart};
|
|
2
|
+
//# sourceMappingURL=p-8e8c1557.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ImageState"],"sources":["./src/components/text-editor/text-editor.types.ts"],"sourcesContent":["import { CustomElement } from '../../global/shared-types/custom-element.types';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\n/**\n * Represents a trigger character and its position in the text.\n *\n * @alpha\n */\nexport type Trigger = {\n character: TriggerCharacter;\n position: number;\n};\n\n/**\n * A character that triggers a specific action in the text editor.\n *\n * @alpha\n */\nexport type TriggerCharacter =\n | '@'\n | '#'\n | '$'\n | '!'\n | '?'\n | '&'\n | '*'\n | '%'\n | '+'\n | '-'\n | '='\n | '/'\n | '\\\\'\n | '^'\n | '~'\n | '`'\n | ':'\n | ';'\n | '|'\n | '.'\n | ','\n | '<'\n | '>'\n | '['\n | ']'\n | '{'\n | '}'\n | '('\n | ')'\n | \"'\";\n\n/**\n * @alpha\n */\nexport type TextEditorNode = {\n /**\n * The top node\n */\n node: CustomElement | string;\n\n /**\n * One more more children under the top node\n */\n children?: Array<TextEditorNode | string>;\n};\n\n/**\n * @alpha\n */\nexport interface ImageInserter {\n fileInfo: FileInfo;\n\n /**\n * Method to insert a thumbnail at the cursor position.\n */\n insertThumbnail: () => void;\n\n /**\n * Method to insert the image at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n *\n * @param src - The src url of the uploaded image.\n * If not provided, the image will be inserted with base64 data.\n *\n */\n insertImage: (src?: string) => void;\n\n /**\n * Method to insert a failed thumbnail at the thumbnail position.\n * Thumbnail must be inserted before calling this method.\n */\n insertFailedThumbnail: () => void;\n}\n\n/**\n * @alpha\n */\nexport enum ImageState {\n LOADING = 'loading',\n FAILED = 'failed',\n SUCCESS = 'success',\n}\n\n/**\n * @alpha\n */\nexport interface ImageInfo {\n /**\n * Unique ID of the image file.\n */\n fileInfoId: string;\n /**\n * The source of the image.\n * Can either be a URL pointing to the image or a base64 encoded string.\n */\n src: string;\n /**\n * The current state of the image.\n */\n state: ImageState;\n}\n\n/**\n * @alpha\n */\nexport interface TextEditor {\n /**\n * Method to insert either text or a node at the cursor position\n */\n insert: (input: TextEditorNode | string) => void;\n\n /**\n * Method to insert an HTML string at the cursor position\n */\n insertHtml: (input: string) => Promise<void>;\n\n stopTrigger: () => void;\n}\n\n/**\n * @alpha\n */\nexport interface TriggerEventDetail {\n /**\n * The trigger that triggered this event\n *\n */\n trigger: TriggerCharacter;\n\n /**\n * The text editor\n */\n textEditor: TextEditor;\n\n /**\n * Current value of the trigger\n */\n value: string;\n}\n"],"mappings":"IAgGYA,GAAZ,SAAYA,GACRA,EAAA,qBACAA,EAAA,mBACAA,EAAA,oBACH,EAJD,CAAYA,MAAU,Y"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as i,c as t,h as e}from"./p-443111b3.js";import{t as s}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as i,c as t,h as e}from"./p-443111b3.js";import{t as s}from"./p-032d839e.js";import{g as r,a as n,b as a,c as h}from"./p-05ab1a40.js";import"./p-bd547592.js";const l='@charset "UTF-8";:host(limel-file){position:relative}.drag-and-drop-tip{pointer-events:none;position:absolute;box-sizing:border-box;margin:0.25rem;inset:0;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;border-radius:0.25rem;border:1px dashed rgb(var(--contrast-700));padding:0 0.5rem}.drag-and-drop-tip .invisible-label-mock{flex-shrink:0;opacity:0;padding-right:1rem;padding-left:1.5rem}.drag-and-drop-tip .tip{font-size:smaller;color:var(--mdc-theme-text-secondary-on-background);height:auto;max-height:3rem;line-height:1;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}';const o={id:null,text:null,removable:true};const d=class{constructor(e){i(this,e);this.change=t(this,"change",7);this.interact=t(this,"interact",7);this.dropZoneTip=()=>this.getTranslation("drag-and-drop-tips");this.handleNewFiles=i=>{this.preventAndStop(i);this.change.emit(i.detail[0])};this.handleChipSetChange=i=>{i.stopPropagation();const t=!i.detail.length?i.detail[0]:null;if(!t){this.change.emit(t)}};this.handleChipInteract=i=>{this.preventAndStop(i);this.interact.emit(i.detail.id)};this.value=undefined;this.label=undefined;this.required=false;this.disabled=false;this.readonly=false;this.invalid=false;this.accept="*";this.language="en"}render(){return[e("limel-file-dropzone",{disabled:this.disabled||this.readonly||!!this.value,accept:this.accept,onFilesSelected:this.handleNewFiles},this.renderChipset()),this.renderDragAndDropTip()]}renderDragAndDropTip(){if(this.value||this.disabled||this.readonly){return}return e("div",{class:"drag-and-drop-tip"},e("span",{class:"invisible-label-mock",role:"presentation"},this.label),e("span",{class:"tip"},this.dropZoneTip()))}getChipArray(){if(!this.value){return[]}return[Object.assign(Object.assign({},o),{text:this.value.filename,id:this.value.id,icon:{name:r(this.value),title:n(this.value),color:a(this.value),backgroundColor:h(this.value)},href:this.value.href})]}renderChipset(){const i=e("limel-chip-set",{disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,label:this.label,leadingIcon:"upload_to_cloud",language:this.language,onChange:this.handleChipSetChange,onInteract:this.handleChipInteract,required:this.required,type:"input",value:this.getChipArray()});if(this.value){return i}return e("limel-file-input",{accept:this.accept,disabled:this.disabled||this.readonly},i)}preventAndStop(i){i.stopPropagation();i.preventDefault()}getTranslation(i){return s.get(`file.${i}`,this.language)}};d.style=l;export{d as limel_file};
|
|
2
|
+
//# sourceMappingURL=p-a2a2fc57.entry.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as e,h as o,g as i}from"./p-443111b3.js";import{t as r}from"./p-efd753ba.js";function s(t,e){const o=t||e;if(!o){return"unknown"}const i=o.split(".").pop().toLowerCase();const r={pdf:"pdf",jpg:"image",jpeg:"image",heic:"image",bmp:"image",png:"image",gif:"image",svg:"image",svgz:"image",ep:"image",eps:"image",avi:"video",flv:"video",h264:"video",mov:"video",mp4:"video",mwv:"video",mkv:"video",mp3:"audio",wav:"audio",wma:"audio",ogg:"audio",txt:"text",json:"text",html:"text",xml:"text",doc:"office",docx:"office",odt:"office",dot:"office",dotx:"office",docm:"office",dotm:"office",pot:"office",ppt:"office",pptx:"office",odp:"office",potx:"office",potm:"office",pps:"office",ppsx:"office",ppsm:"office",pptm:"office",ppam:"office",pages:"office",xls:"office",xlsx:"office",xlsm:"office",xlsb:"office",ods:"office",csv:"office",numbers:"office"};return r[i]||"unknown"}class n{constructor(t){this.requestFullscreen=()=>{if(this.enter){this.enter()}};this.exitFullscreen=()=>{if(this.exit){this.exit.bind(window.document)()}};this.toggle=()=>{const t=window.document;const e=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement;if(e){this.exitFullscreen()}else{this.requestFullscreen()}};this.enter=t.requestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen;this.enter=this.enter.bind(t);const e=window.document;this.exit=e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen}isSupported(){return!!this.requestFullscreen}}const a='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host{isolation:isolate;position:relative;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;height:100%}*{box-sizing:border-box}img,video,audio,object,iframe{max-height:100%;max-width:100%;box-sizing:border-box}iframe{border:none;width:100%;height:100%;min-height:20rem}img{min-width:7rem;object-fit:contain}video{width:100%;height:auto}audio{width:100%}object{width:100%;height:100%}object[type="application/pdf"]{min-height:20rem}object[type="text/plain"]{border-radius:0.25rem;padding-right:2rem;overflow-y:auto}:host(:fullscreen){background-color:rgb(var(--color-gray-darker))}:host(:fullscreen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}:host(:-webkit-full-screen){background-color:rgb(var(--color-gray-darker))}:host(:-webkit-full-screen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}.buttons{position:absolute;z-index:1;top:0.25rem;right:0.25rem;display:flex;flex-direction:column;gap:0.25rem}@media (pointer: coarse){.buttons{gap:0.5rem}}.no-support{display:flex;flex-direction:column;align-items:center;border:1px dashed rgb(var(--contrast-600));border-radius:0.5rem;padding:1.25rem}.no-support .icon--warning{color:rgb(var(--color-orange-default))}[class^=button--]{all:unset;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);display:flex;align-items:center;justify-content:center;border-radius:50%;width:2rem;height:2rem;background-color:rgba(var(--contrast-100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}[class^=button--]:hover,[class^=button--]:focus,[class^=button--]:focus-visible{will-change:color, background-color, box-shadow, transform}[class^=button--]:hover{transform:translate3d(0, -0.04rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}[class^=button--]:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}[class^=button--]:hover,[class^=button--]:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}[class^=button--]:focus{outline:none}[class^=button--]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}[class^=button--] limel-icon{transition:color 0.2s ease;width:1.25rem;color:rgb(var(--contrast-1200))}[class^=button--]:hover limel-icon{color:rgb(var(--contrast-1400))}.action-menu-for-pdf-files,.action-menu-for-office-files{position:absolute;right:0.75rem}.action-menu-for-pdf-files{bottom:0.75rem}.action-menu-for-office-files{top:0.75rem}';const l=class{constructor(i){t(this,i);this.action=e(this,"action",7);this.renderPdf=()=>[o("div",{class:"action-menu-for-pdf-files"},this.renderActionMenu()),o("iframe",{src:this.fileUrl,loading:"lazy"})];this.renderImage=()=>[this.renderButtons(),o("img",{src:this.fileUrl,alt:this.alt,loading:"lazy"})];this.renderVideo=()=>o("video",{controls:true},o("source",{src:this.fileUrl}));this.renderAudio=()=>o("audio",{controls:true},o("source",{src:this.fileUrl}));this.renderText=()=>[this.renderButtons(),o("object",{data:this.fileUrl,type:"text/plain"},`Text content from: ${this.filename||this.url}`,o("a",{href:this.fileUrl,target:"_blank",rel:"noopener noreferrer"},"Open text file in new tab"))];this.renderOffice=()=>[o("div",{class:"action-menu-for-office-files"},this.renderActionMenu()),o("iframe",{src:this.getOfficeViewerUrl()+this.fileUrl+"&embedded=true",loading:"lazy"})];this.isOfficeFileAccessibleViaURL=()=>this.fileType==="office"&&!(this.fileUrl.startsWith("http://")||this.fileUrl.startsWith("https://"));this.getOfficeViewerUrl=()=>{const t={"microsoft-office":"https://view.officeapps.live.com/op/embed.aspx?src=","google-drive":"https://docs.google.com/gview?url="};return t[this.officeViewer]};this.renderNoFileSupportMessage=()=>o("div",{class:"no-support",role:"alert"},o("limel-icon",{class:"icon--warning",name:"brake_warning",size:"large",role:"presentation"}),o("p",null,this.getTranslation("message.unsupported-filetype")),this.renderDownloadButton());this.renderButtons=()=>o("div",{class:"buttons"},this.renderActionMenu(),this.renderToggleFullscreenButton(),this.renderDownloadButton(),this.renderOpenInNewTabButton());this.renderToggleFullscreenButton=()=>{if(!this.allowFullscreen||!this.fullscreen.isSupported()){return}const t=this.isFullscreen?"multiply":"fit_to_width";const e=this.isFullscreen?this.getTranslation("exit-fullscreen"):this.getTranslation("open-in-fullscreen");return[o("button",{class:"button--toggle-fullscreen",id:"tooltip-toggle-fullscreen",role:"button",onClick:this.handleToggleFullscreen},o("limel-icon",{name:t}),o("limel-tooltip",{label:e,elementId:"tooltip-toggle-fullscreen",openDirection:"left"}))]};this.renderDownloadButton=()=>{if(!this.allowDownload||this.isFullscreen){return}return o("a",{class:"button--download",id:"tooltip-download",role:"button",download:this.filename?this.filename:"",href:this.fileUrl,target:"_blank"},o("limel-icon",{name:"download_2"}),o("limel-tooltip",{label:this.getTranslation("download"),elementId:"tooltip-download",openDirection:"left"}))};this.renderOpenInNewTabButton=()=>{if(!this.allowOpenInNewTab||this.isFullscreen){return}return o("a",{class:"button--new-tab",id:"tooltip-new-tab",role:"button",href:this.fileUrl,target:"_blank",rel:"noopener noreferrer"},o("limel-icon",{name:"external_link"}),o("limel-tooltip",{label:this.getTranslation("open-in-new-tab"),elementId:"tooltip-new-tab",openDirection:"left"}))};this.renderActionMenu=()=>{if(!this.actions||this.isFullscreen){return}return o("limel-menu",{class:"action-menu",items:this.actions,onSelect:this.emitOnAction,"open-direction":"left"},o("button",{class:"button--action",id:"tooltip-more",role:"button",slot:"trigger"},o("limel-icon",{name:"menu_2"}),o("limel-tooltip",{label:this.getTranslation("more-actions"),elementId:"tooltip-more",openDirection:"left"})))};this.createURL=async t=>{if(["pdf"].includes(t)){const t=await fetch(this.url);const e=await t.blob();this.fileUrl=URL.createObjectURL(e)}else{this.fileUrl=this.url}this.loading=false};this.handleToggleFullscreen=()=>{if(this.fullscreen.isSupported()){this.fullscreen.toggle();this.isFullscreen=!this.isFullscreen}};this.emitOnAction=t=>{t.stopPropagation();this.action.emit(t.detail)};this.url=undefined;this.filename=undefined;this.alt=undefined;this.allowFullscreen=false;this.allowOpenInNewTab=false;this.allowDownload=false;this.language="en";this.officeViewer="microsoft-office";this.actions=undefined;this.isFullscreen=false;this.fileType=undefined;this.loading=true;this.fileUrl="";this.fullscreen=new n(this.HostElement)}async componentWillLoad(){this.fileType=s(this.filename,this.url);await this.createURL(this.fileType)}render(){if(!this.isOfficeFileAccessibleViaURL){return this.renderNoFileSupportMessage()}if(this.loading){return o("limel-spinner",{size:"x-small",limeBranded:false})}return this.renderFileViewer()}async watchUrl(t,e){if(t===e){return}this.loading=true;this.fileType=s(this.filename,this.fileUrl);await this.createURL(this.fileType)}renderFileViewer(){const t={pdf:this.renderPdf,image:this.renderImage,video:this.renderVideo,audio:this.renderAudio,text:this.renderText,office:this.renderOffice};const e=t[this.fileType]||this.renderNoFileSupportMessage;return e()}getTranslation(t){return r.get(`file-viewer.${t}`,this.language)}get HostElement(){return i(this)}static get watchers(){return{url:["watchUrl"]}}};l.style=a;export{l as limel_file_viewer};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as e,h as o,g as i}from"./p-443111b3.js";import{t as r}from"./p-032d839e.js";function s(t,e){const o=t||e;if(!o){return"unknown"}const i=o.split(".").pop().toLowerCase();const r={pdf:"pdf",jpg:"image",jpeg:"image",heic:"image",bmp:"image",png:"image",gif:"image",svg:"image",svgz:"image",ep:"image",eps:"image",avi:"video",flv:"video",h264:"video",mov:"video",mp4:"video",mwv:"video",mkv:"video",mp3:"audio",wav:"audio",wma:"audio",ogg:"audio",txt:"text",json:"text",html:"text",xml:"text",doc:"office",docx:"office",odt:"office",dot:"office",dotx:"office",docm:"office",dotm:"office",pot:"office",ppt:"office",pptx:"office",odp:"office",potx:"office",potm:"office",pps:"office",ppsx:"office",ppsm:"office",pptm:"office",ppam:"office",pages:"office",xls:"office",xlsx:"office",xlsm:"office",xlsb:"office",ods:"office",csv:"office",numbers:"office"};return r[i]||"unknown"}class n{constructor(t){this.requestFullscreen=()=>{if(this.enter){this.enter()}};this.exitFullscreen=()=>{if(this.exit){this.exit.bind(window.document)()}};this.toggle=()=>{const t=window.document;const e=t.fullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||t.msFullscreenElement;if(e){this.exitFullscreen()}else{this.requestFullscreen()}};this.enter=t.requestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen;this.enter=this.enter.bind(t);const e=window.document;this.exit=e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen}isSupported(){return!!this.requestFullscreen}}const a='@charset "UTF-8";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host{isolation:isolate;position:relative;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:100%;height:100%}*{box-sizing:border-box}img,video,audio,object,iframe{max-height:100%;max-width:100%;box-sizing:border-box}iframe{border:none;width:100%;height:100%;min-height:20rem}img{min-width:7rem;object-fit:contain}video{width:100%;height:auto}audio{width:100%}object{width:100%;height:100%}object[type="application/pdf"]{min-height:20rem}object[type="text/plain"]{border-radius:0.25rem;padding-right:2rem;overflow-y:auto}:host(:fullscreen){background-color:rgb(var(--color-gray-darker))}:host(:fullscreen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}:host(:-webkit-full-screen){background-color:rgb(var(--color-gray-darker))}:host(:-webkit-full-screen) object[type="text/plain"]{max-width:50rem;max-height:calc(100% - 2rem)}.buttons{position:absolute;z-index:1;top:0.25rem;right:0.25rem;display:flex;flex-direction:column;gap:0.25rem}@media (pointer: coarse){.buttons{gap:0.5rem}}.no-support{display:flex;flex-direction:column;align-items:center;border:1px dashed rgb(var(--contrast-600));border-radius:0.5rem;padding:1.25rem}.no-support .icon--warning{color:rgb(var(--color-orange-default))}[class^=button--]{all:unset;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal);display:flex;align-items:center;justify-content:center;border-radius:50%;width:2rem;height:2rem;background-color:rgba(var(--contrast-100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}[class^=button--]:hover,[class^=button--]:focus,[class^=button--]:focus-visible{will-change:color, background-color, box-shadow, transform}[class^=button--]:hover{transform:translate3d(0, -0.04rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}[class^=button--]:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}[class^=button--]:hover,[class^=button--]:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}[class^=button--]:focus{outline:none}[class^=button--]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}[class^=button--] limel-icon{transition:color 0.2s ease;width:1.25rem;color:rgb(var(--contrast-1200))}[class^=button--]:hover limel-icon{color:rgb(var(--contrast-1400))}.action-menu-for-pdf-files,.action-menu-for-office-files{position:absolute;right:0.75rem}.action-menu-for-pdf-files{bottom:0.75rem}.action-menu-for-office-files{top:0.75rem}';const l=class{constructor(i){t(this,i);this.action=e(this,"action",7);this.renderPdf=()=>[o("div",{class:"action-menu-for-pdf-files"},this.renderActionMenu()),o("iframe",{src:this.fileUrl,loading:"lazy"})];this.renderImage=()=>[this.renderButtons(),o("img",{src:this.fileUrl,alt:this.alt,loading:"lazy"})];this.renderVideo=()=>o("video",{controls:true},o("source",{src:this.fileUrl}));this.renderAudio=()=>o("audio",{controls:true},o("source",{src:this.fileUrl}));this.renderText=()=>[this.renderButtons(),o("object",{data:this.fileUrl,type:"text/plain"},`Text content from: ${this.filename||this.url}`,o("a",{href:this.fileUrl,target:"_blank",rel:"noopener noreferrer"},"Open text file in new tab"))];this.renderOffice=()=>[o("div",{class:"action-menu-for-office-files"},this.renderActionMenu()),o("iframe",{src:this.getOfficeViewerUrl()+this.fileUrl+"&embedded=true",loading:"lazy"})];this.isOfficeFileAccessibleViaURL=()=>this.fileType==="office"&&!(this.fileUrl.startsWith("http://")||this.fileUrl.startsWith("https://"));this.getOfficeViewerUrl=()=>{const t={"microsoft-office":"https://view.officeapps.live.com/op/embed.aspx?src=","google-drive":"https://docs.google.com/gview?url="};return t[this.officeViewer]};this.renderNoFileSupportMessage=()=>o("div",{class:"no-support",role:"alert"},o("limel-icon",{class:"icon--warning",name:"brake_warning",size:"large",role:"presentation"}),o("p",null,this.getTranslation("message.unsupported-filetype")),this.renderDownloadButton());this.renderButtons=()=>o("div",{class:"buttons"},this.renderActionMenu(),this.renderToggleFullscreenButton(),this.renderDownloadButton(),this.renderOpenInNewTabButton());this.renderToggleFullscreenButton=()=>{if(!this.allowFullscreen||!this.fullscreen.isSupported()){return}const t=this.isFullscreen?"multiply":"fit_to_width";const e=this.isFullscreen?this.getTranslation("exit-fullscreen"):this.getTranslation("open-in-fullscreen");return[o("button",{class:"button--toggle-fullscreen",id:"tooltip-toggle-fullscreen",role:"button",onClick:this.handleToggleFullscreen},o("limel-icon",{name:t}),o("limel-tooltip",{label:e,elementId:"tooltip-toggle-fullscreen",openDirection:"left"}))]};this.renderDownloadButton=()=>{if(!this.allowDownload||this.isFullscreen){return}return o("a",{class:"button--download",id:"tooltip-download",role:"button",download:this.filename?this.filename:"",href:this.fileUrl,target:"_blank"},o("limel-icon",{name:"download_2"}),o("limel-tooltip",{label:this.getTranslation("download"),elementId:"tooltip-download",openDirection:"left"}))};this.renderOpenInNewTabButton=()=>{if(!this.allowOpenInNewTab||this.isFullscreen){return}return o("a",{class:"button--new-tab",id:"tooltip-new-tab",role:"button",href:this.fileUrl,target:"_blank",rel:"noopener noreferrer"},o("limel-icon",{name:"external_link"}),o("limel-tooltip",{label:this.getTranslation("open-in-new-tab"),elementId:"tooltip-new-tab",openDirection:"left"}))};this.renderActionMenu=()=>{if(!this.actions||this.isFullscreen){return}return o("limel-menu",{class:"action-menu",items:this.actions,onSelect:this.emitOnAction,"open-direction":"left"},o("button",{class:"button--action",id:"tooltip-more",role:"button",slot:"trigger"},o("limel-icon",{name:"menu_2"}),o("limel-tooltip",{label:this.getTranslation("more-actions"),elementId:"tooltip-more",openDirection:"left"})))};this.createURL=async t=>{if(["pdf"].includes(t)){const t=await fetch(this.url);const e=await t.blob();this.fileUrl=URL.createObjectURL(e)}else{this.fileUrl=this.url}this.loading=false};this.handleToggleFullscreen=()=>{if(this.fullscreen.isSupported()){this.fullscreen.toggle();this.isFullscreen=!this.isFullscreen}};this.emitOnAction=t=>{t.stopPropagation();this.action.emit(t.detail)};this.url=undefined;this.filename=undefined;this.alt=undefined;this.allowFullscreen=false;this.allowOpenInNewTab=false;this.allowDownload=false;this.language="en";this.officeViewer="microsoft-office";this.actions=undefined;this.isFullscreen=false;this.fileType=undefined;this.loading=true;this.fileUrl="";this.fullscreen=new n(this.HostElement)}async componentWillLoad(){this.fileType=s(this.filename,this.url);await this.createURL(this.fileType)}render(){if(!this.isOfficeFileAccessibleViaURL){return this.renderNoFileSupportMessage()}if(this.loading){return o("limel-spinner",{size:"x-small",limeBranded:false})}return this.renderFileViewer()}async watchUrl(t,e){if(t===e){return}this.loading=true;this.fileType=s(this.filename,this.fileUrl);await this.createURL(this.fileType)}renderFileViewer(){const t={pdf:this.renderPdf,image:this.renderImage,video:this.renderVideo,audio:this.renderAudio,text:this.renderText,office:this.renderOffice};const e=t[this.fileType]||this.renderNoFileSupportMessage;return e()}getTranslation(t){return r.get(`file-viewer.${t}`,this.language)}get HostElement(){return i(this)}static get watchers(){return{url:["watchUrl"]}}};l.style=a;export{l as limel_file_viewer};
|
|
2
|
+
//# sourceMappingURL=p-b66ee3a1.entry.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as t,c as i,h as e,H as s,g as r}from"./p-443111b3.js";import{c as o,i as n}from"./p-dc3d2ee1.js";import{b as a}from"./p-b14e769e.js";import{i as l}from"./p-33375610.js";import{b as h}from"./p-2e63de04.js";import{i as c}from"./p-0b1af919.js";import{c as p}from"./p-96460db3.js";import"./p-05ab1a40.js";import"./p-bd547592.js";import"./p-ea0310b8.js";import"./p-eda23c05.js";import"./p-c93050d6.js";import"./p-28a23eac.js";import"./p-858c6b82.js";import"./p-4c3358cb.js";import"./p-87a34aa6.js";import"./p-d529bb7d.js";import"./p-669626e5.js";function f(t,i,e,s){var r=-1,o=t==null?0:t.length;while(++r<o){var n=t[r];i(s,n,e(n),t)}return s}function d(t,i){return function(e,s){if(e==null){return e}if(!l(e)){return t(e,s)}var r=e.length,o=i?r:-1,n=Object(e);while(i?o--:++o<r){if(s(n[o],o,n)===false){break}}return e}}var u=d(a);function m(t,i,e,s){u(t,(function(t,r,o){i(s,t,e(t),o)}));return s}function b(t,i){return function(e,s){var r=c(e)?f:m,o=i?i():{};return r(e,t,h(s),o)}}var j=b((function(t,i,e){t[e?0:1].push(i)}),(function(){return[[],[]]}));const g=":host(limel-file-dropzone){display:block;position:relative}.has-file-to-drop{animation:display-drop-zone 0.6s ease forwards;box-sizing:border-box;isolation:isolate;z-index:1;position:absolute;inset:0.25rem;overflow:hidden;display:flex;justify-content:center;align-items:center;gap:0.5rem;color:rgb(var(--contrast-700));border:0.125rem dashed rgb(var(--color-cyan-light));border-radius:0.75rem}.text-helpertext{display:flex;flex-direction:column;justify-content:center;align-items:flex-start}.icon{width:clamp(2rem, 5vh, 7rem)}.text{font-size:clamp(1rem, 2vh, 1.75rem)}.helper-text{font-size:clamp(0.75rem, 1.5vh, 1rem)}@keyframes display-drop-zone{0%{background-color:rgb(var(--contrast-1100), 0);backdrop-filter:blur(0);-webkit-backdrop-filter:blur(0);scale:0.9;opacity:0}50%{scale:1;opacity:1}100%{background-color:rgb(var(--contrast-1100), 0.8);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem)}}";const v=class{constructor(s){t(this,s);this.filesSelected=i(this,"filesSelected",7);this.filesRejected=i(this,"filesRejected",7);this.renderOnDragLayout=()=>{if(this.disabled||!this.hasFileToDrop){return}return e("div",{class:"has-file-to-drop"},e("limel-icon",{class:"icon",name:"upload_2"}),e("div",{class:"text-helpertext"},this.renderText(),this.renderHelperText()))};this.renderText=()=>{if(!this.text){return}return e("span",{class:"text"},this.text)};this.renderHelperText=()=>{if(!this.helperText){return}return e("span",{class:"helper-text"},this.helperText)};this.handleDrop=t=>{t.stopPropagation();t.preventDefault();this.hasFileToDrop=false;if(this.disabled){return}const i=Array.from(t.dataTransfer.files);const e=i.map(o);const[s,r]=j(e,(t=>n(t,this.accept)));if(s.length>0){this.filesSelected.emit(s)}if(r.length>0){this.filesRejected.emit(r)}};this.handleDragOver=t=>{this.hasFileToDrop=true;t.preventDefault()};this.handleDragLeave=t=>{this.hasFileToDrop=false;t.preventDefault()};this.accept="*";this.disabled=false;this.text=undefined;this.helperText="";this.hasFileToDrop=false}render(){return e(s,{onDrop:this.handleDrop,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave},e("slot",null),this.renderOnDragLayout())}};v.style=g;const y=class{constructor(e){t(this,e);this.filesSelected=i(this,"filesSelected",7);this.fileInputId=p();this.handleClick=t=>{if(this.disabled){t.stopPropagation();t.preventDefault();return}this.triggerFileDialog();t.stopPropagation()};this.handleKeyUp=t=>{t.stopPropagation();t.preventDefault();if(t.code==="Enter"){this.triggerFileDialog()}};this.handleFileChange=t=>{const i=Array.from(this.fileInput.files);if(i.length>0){t.stopPropagation();this.filesSelected.emit(i.map(o));this.fileInput.value=""}};this.accept="*";this.disabled=false;this.multiple=false}componentDidLoad(){this.fileInput=this.element.shadowRoot.getElementById(this.fileInputId)}render(){return e(s,{onClick:this.handleClick,onKeyUp:this.handleKeyUp,onKeyDown:this.handleKeyDown},e("input",{hidden:true,id:this.fileInputId,onChange:this.handleFileChange,type:"file",accept:this.accept,disabled:this.disabled,multiple:this.multiple}),e("slot",null))}handleKeyDown(t){if(t.code==="Tab"||t.code==="Backspace"||t.code==="Enter"){return}t.preventDefault();t.stopPropagation()}triggerFileDialog(){this.fileInput.click()}get element(){return r(this)}};export{v as limel_file_dropzone,y as limel_file_input};
|
|
2
|
+
//# sourceMappingURL=p-dbcde7db.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["arrayAggregator","array","setter","iteratee","accumulator","index","length","value","createBaseEach","eachFunc","fromRight","collection","isArrayLike","iterable","Object","baseEach","baseForOwn","baseAggregator","key","createAggregator","initializer","func","isArray","baseIteratee","partition","result","push","fileDropzoneCss","FileDropzone","this","renderOnDragLayout","disabled","hasFileToDrop","h","class","name","renderText","renderHelperText","text","helperText","handleDrop","event","stopPropagation","preventDefault","files","Array","from","dataTransfer","fileInfos","map","createFileInfo","acceptedFileInfos","rejectedFileInfos","file","isTypeAccepted","accept","filesSelected","emit","filesRejected","handleDragOver","handleDragLeave","render","Host","onDrop","onDragOver","onDragLeave","FileInput","fileInputId","createRandomString","handleClick","triggerFileDialog","handleKeyUp","code","handleFileChange","fileInput","componentDidLoad","element","shadowRoot","getElementById","onClick","onKeyUp","onKeyDown","handleKeyDown","hidden","id","onChange","type","multiple","click"],"sources":["./node_modules/lodash-es/_arrayAggregator.js","./node_modules/lodash-es/_createBaseEach.js","./node_modules/lodash-es/_baseEach.js","./node_modules/lodash-es/_baseAggregator.js","./node_modules/lodash-es/_createAggregator.js","./node_modules/lodash-es/partition.js","./src/components/file-dropzone/file-dropzone.scss?tag=limel-file-dropzone&encapsulation=shadow","./src/components/file-dropzone/file-dropzone.tsx","./src/components/file-input/file-input.tsx"],"sourcesContent":["/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nexport default arrayAggregator;\n","import isArrayLike from './isArrayLike.js';\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nexport default createBaseEach;\n","import baseForOwn from './_baseForOwn.js';\nimport createBaseEach from './_createBaseEach.js';\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nexport default baseEach;\n","import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nexport default baseAggregator;\n","import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray(collection) ? arrayAggregator : baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n };\n}\n\nexport default createAggregator;\n","import createAggregator from './_createAggregator.js';\n\n/**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, the second of which\n * contains elements `predicate` returns falsey for. The predicate is\n * invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [predicate=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * _.partition(users, function(o) { return o.active; });\n * // => objects for [['fred'], ['barney', 'pebbles']]\n *\n * // The `_.matches` iteratee shorthand.\n * _.partition(users, { 'age': 1, 'active': false });\n * // => objects for [['pebbles'], ['barney', 'fred']]\n *\n * // The `_.matchesProperty` iteratee shorthand.\n * _.partition(users, ['active', false]);\n * // => objects for [['barney', 'pebbles'], ['fred']]\n *\n * // The `_.property` iteratee shorthand.\n * _.partition(users, 'active');\n * // => objects for [['fred'], ['barney', 'pebbles']]\n */\nvar partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n}, function() { return [[], []]; });\n\nexport default partition;\n",":host(limel-file-dropzone) {\n display: block;\n position: relative;\n}\n\n.has-file-to-drop {\n animation: display-drop-zone 0.6s ease forwards;\n\n box-sizing: border-box;\n isolation: isolate;\n z-index: 1;\n position: absolute;\n inset: 0.25rem;\n\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0.5rem;\n\n color: rgb(var(--contrast-700));\n\n border: 0.125rem dashed rgb(var(--color-cyan-light));\n border-radius: 0.75rem;\n}\n\n.text-helpertext {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n}\n\n.icon {\n width: clamp(2rem, 5vh, 7rem);\n}\n\n.text {\n font-size: clamp(1rem, 2vh, 1.75rem);\n}\n\n.helper-text {\n font-size: clamp(0.75rem, 1.5vh, 1rem);\n}\n\n@keyframes display-drop-zone {\n 0% {\n background-color: rgb(var(--contrast-1100), 0);\n backdrop-filter: blur(0);\n -webkit-backdrop-filter: blur(0);\n scale: 0.9;\n opacity: 0;\n }\n\n 50% {\n scale: 1;\n opacity: 1;\n }\n\n 100% {\n background-color: rgb(var(--contrast-1100), 0.8);\n backdrop-filter: blur(0.25rem);\n -webkit-backdrop-filter: blur(0.25rem);\n }\n}\n","import {\n Component,\n h,\n Event,\n EventEmitter,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo, isTypeAccepted } from '../../util/files';\nimport { partition } from 'lodash-es';\n\n/**\n * This component enables you to seamlessly convert any region of the user interface into\n * a file dropzone area, just by wrapping it inside the `limel-file-dropzone`.\n *\n * The file dropzone can then be used to allow end-users to upload files\n * by dragging and dropping them into the specified area, for example to trigger an upload process.\n *\n * After receiving the files, the component emits a `filesSelected` event. For unsupported\n * files (specified with the `accept` prop) a `filesRejected` event will be emitted.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-dropzone\n * @exampleComponent limel-example-file-dropzone-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-dropzone',\n shadow: true,\n styleUrl: 'file-dropzone.scss',\n})\nexport class FileDropzone {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable the file dropzone.\n */\n @Prop()\n public disabled: boolean = false;\n\n /**\n * Is displayed when the user is dragging a file over the dropzone.\n * A suitable text could for instance be \"Drop your files here\".\n */\n @Prop()\n public text: string;\n\n /**\n * Is displayed to provide supplementary information to the end users,\n * for instance, which filetypes or file sizes are accepted.\n */\n @Prop()\n public helperText?: string = '';\n\n /**\n * Sets to true when there is a file to drop\n */\n @State()\n private hasFileToDrop: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n /**\n * Emitted when files are selected but do not conform with the `accept` property specifications.\n * This can happen when the file types or formats of the selected files are not among the ones allowed by the dropzone,\n * as defined by the `accept` property.\n *\n * @see `accept` for details on how to specify acceptable file types.\n */\n @Event()\n filesRejected: EventEmitter<FileInfo[]>;\n\n public render() {\n return (\n <Host\n onDrop={this.handleDrop}\n onDragOver={this.handleDragOver}\n onDragLeave={this.handleDragLeave}\n >\n <slot />\n {this.renderOnDragLayout()}\n </Host>\n );\n }\n\n private renderOnDragLayout = () => {\n if (this.disabled || !this.hasFileToDrop) {\n return;\n }\n\n return (\n <div class=\"has-file-to-drop\">\n <limel-icon class=\"icon\" name=\"upload_2\" />\n <div class=\"text-helpertext\">\n {this.renderText()}\n {this.renderHelperText()}\n </div>\n </div>\n );\n };\n\n private renderText = () => {\n if (!this.text) {\n return;\n }\n\n return <span class=\"text\">{this.text}</span>;\n };\n\n private renderHelperText = () => {\n if (!this.helperText) {\n return;\n }\n\n return <span class=\"helper-text\">{this.helperText}</span>;\n };\n\n private handleDrop = (event: DragEvent) => {\n event.stopPropagation();\n event.preventDefault();\n this.hasFileToDrop = false;\n\n if (this.disabled) {\n return;\n }\n\n const files: File[] = Array.from(event.dataTransfer.files);\n const fileInfos: FileInfo[] = files.map(createFileInfo);\n\n const [acceptedFileInfos, rejectedFileInfos] = partition(\n fileInfos,\n (file) => isTypeAccepted(file, this.accept),\n );\n\n if (acceptedFileInfos.length > 0) {\n this.filesSelected.emit(acceptedFileInfos);\n }\n\n if (rejectedFileInfos.length > 0) {\n this.filesRejected.emit(rejectedFileInfos);\n }\n };\n\n private handleDragOver = (event: DragEvent) => {\n this.hasFileToDrop = true;\n event.preventDefault();\n };\n\n private handleDragLeave = (event: DragEvent) => {\n this.hasFileToDrop = false;\n event.preventDefault();\n };\n}\n","import {\n h,\n Event,\n EventEmitter,\n Host,\n Component,\n Element,\n Prop,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { FileInfo } from '../../global/shared-types/file.types';\nimport { createFileInfo } from '../../util/files';\n\n/**\n * This component enables you to seamlessly transform any other clickable component that\n * generates a `click` event into a file input selector.\n *\n * To use it, just wrap any clickable component inside the `limel-file-input` component.\n * Upon reception of the `click` event this component will open the native file selection\n * dialog.\n *\n * After receiving the files, the component emits a `filesSelected` event.\n *\n * The event detail would be an array of `FileInfo` objects,\n * each representing a file dropped into the dropzone.\n *\n * @exampleComponent limel-example-file-input\n * @exampleComponent limel-example-file-input-type-filtering\n * @private\n */\n@Component({\n tag: 'limel-file-input',\n shadow: true,\n})\nexport class FileInput {\n /**\n * Specifies the types of files that the dropzone will accept. By default, all file types are accepted.\n *\n * For media files, formats can be specified using: `audio/*`, `video/*`, `image/*`.\n * Unique file type specifiers can also be used, for example: `.jpg`, `.pdf`.\n * A comma-separated list of file extensions or MIME types is also acceptable, e.g., `image/png, image/jpeg` or\n * `.png, .jpg, .jpeg`.\n *\n * @see [HTML attribute: accept](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept) for more\n * details.\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Set to `true` to disable file input selection.\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to enable selection of multiple files\n */\n @Prop({ reflect: true })\n public multiple: boolean = false;\n\n /**\n * Emitted when files are selected\n */\n @Event()\n filesSelected: EventEmitter<FileInfo[]>;\n\n @Element()\n private element: HTMLLimelFileElement;\n\n private fileInput: HTMLInputElement;\n private fileInputId = createRandomString();\n\n public componentDidLoad() {\n this.fileInput = this.element.shadowRoot.getElementById(\n this.fileInputId,\n ) as HTMLInputElement;\n }\n\n public render() {\n return (\n <Host\n onClick={this.handleClick}\n onKeyUp={this.handleKeyUp}\n onKeyDown={this.handleKeyDown}\n >\n <input\n hidden={true}\n id={this.fileInputId}\n onChange={this.handleFileChange}\n type=\"file\"\n accept={this.accept}\n disabled={this.disabled}\n multiple={this.multiple}\n />\n <slot />\n </Host>\n );\n }\n\n private handleClick = (event: Event) => {\n if (this.disabled) {\n event.stopPropagation();\n event.preventDefault();\n\n return;\n }\n\n this.triggerFileDialog();\n\n event.stopPropagation();\n };\n\n private handleKeyUp = (event: KeyboardEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n if (event.code === 'Enter') {\n this.triggerFileDialog();\n }\n };\n\n private handleKeyDown(event: KeyboardEvent) {\n if (\n event.code === 'Tab' ||\n event.code === 'Backspace' ||\n event.code === 'Enter'\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n }\n\n private triggerFileDialog() {\n this.fileInput.click();\n }\n\n private handleFileChange = (event: Event) => {\n const files = Array.from(this.fileInput.files);\n if (files.length > 0) {\n event.stopPropagation();\n this.filesSelected.emit(files.map(createFileInfo));\n this.fileInput.value = '';\n }\n };\n}\n"],"mappings":"uiBAUA,SAASA,EAAgBC,EAAOC,EAAQC,EAAUC,GAChD,IAAIC,GAAS,EACTC,EAASL,GAAS,KAAO,EAAIA,EAAMK,OAEvC,QAASD,EAAQC,EAAQ,CACvB,IAAIC,EAAQN,EAAMI,GAClBH,EAAOE,EAAaG,EAAOJ,EAASI,GAAQN,EAChD,CACE,OAAOG,CACT,CCTA,SAASI,EAAeC,EAAUC,GAChC,OAAO,SAASC,EAAYR,GAC1B,GAAIQ,GAAc,KAAM,CACtB,OAAOA,CACb,CACI,IAAKC,EAAYD,GAAa,CAC5B,OAAOF,EAASE,EAAYR,EAClC,CACI,IAAIG,EAASK,EAAWL,OACpBD,EAAQK,EAAYJ,GAAU,EAC9BO,EAAWC,OAAOH,GAEtB,MAAQD,EAAYL,MAAYA,EAAQC,EAAS,CAC/C,GAAIH,EAASU,EAASR,GAAQA,EAAOQ,KAAc,MAAO,CACxD,KACR,CACA,CACI,OAAOF,CACX,CACA,CClBA,IAAII,EAAWP,EAAeQ,GCE9B,SAASC,EAAeN,EAAYT,EAAQC,EAAUC,GACpDW,EAASJ,GAAY,SAASJ,EAAOW,EAAKP,GACxCT,EAAOE,EAAaG,EAAOJ,EAASI,GAAQI,EAChD,IACE,OAAOP,CACT,CCLA,SAASe,EAAiBjB,EAAQkB,GAChC,OAAO,SAAST,EAAYR,GAC1B,IAAIkB,EAAOC,EAAQX,GAAcX,EAAkBiB,EAC/Cb,EAAcgB,EAAcA,IAAgB,GAEhD,OAAOC,EAAKV,EAAYT,EAAQqB,EAAapB,GAAcC,EAC/D,CACA,CCkBA,IAAIoB,EAAYL,GAAiB,SAASM,EAAQlB,EAAOW,GACvDO,EAAOP,EAAM,EAAI,GAAGQ,KAAKnB,EAC3B,IAAG,WAAa,MAAO,CAAC,GAAI,GAAI,ICxChC,MAAMoB,EAAkB,w5B,MCmCXC,EAAY,M,mHAsEbC,KAAAC,mBAAqB,KACzB,GAAID,KAAKE,WAAaF,KAAKG,cAAe,CACtC,M,CAGJ,OACIC,EAAA,OAAKC,MAAM,oBACPD,EAAA,cAAYC,MAAM,OAAOC,KAAK,aAC9BF,EAAA,OAAKC,MAAM,mBACNL,KAAKO,aACLP,KAAKQ,oBAER,EAINR,KAAAO,WAAa,KACjB,IAAKP,KAAKS,KAAM,CACZ,M,CAGJ,OAAOL,EAAA,QAAMC,MAAM,QAAQL,KAAKS,KAAY,EAGxCT,KAAAQ,iBAAmB,KACvB,IAAKR,KAAKU,WAAY,CAClB,M,CAGJ,OAAON,EAAA,QAAMC,MAAM,eAAeL,KAAKU,WAAkB,EAGrDV,KAAAW,WAAcC,IAClBA,EAAMC,kBACND,EAAME,iBACNd,KAAKG,cAAgB,MAErB,GAAIH,KAAKE,SAAU,CACf,M,CAGJ,MAAMa,EAAgBC,MAAMC,KAAKL,EAAMM,aAAaH,OACpD,MAAMI,EAAwBJ,EAAMK,IAAIC,GAExC,MAAOC,EAAmBC,GAAqB5B,EAC3CwB,GACCK,GAASC,EAAeD,EAAMxB,KAAK0B,UAGxC,GAAIJ,EAAkB7C,OAAS,EAAG,CAC9BuB,KAAK2B,cAAcC,KAAKN,E,CAG5B,GAAIC,EAAkB9C,OAAS,EAAG,CAC9BuB,KAAK6B,cAAcD,KAAKL,E,GAIxBvB,KAAA8B,eAAkBlB,IACtBZ,KAAKG,cAAgB,KACrBS,EAAME,gBAAgB,EAGlBd,KAAA+B,gBAAmBnB,IACvBZ,KAAKG,cAAgB,MACrBS,EAAME,gBAAgB,E,YA1HF,I,cAMG,M,oCAcE,G,mBAMI,K,CAkB1BkB,SACH,OACI5B,EAAC6B,EAAI,CACDC,OAAQlC,KAAKW,WACbwB,WAAYnC,KAAK8B,eACjBM,YAAapC,KAAK+B,iBAElB3B,EAAA,aACCJ,KAAKC,qB,mBClEToC,EAAS,M,sEAqCVrC,KAAAsC,YAAcC,IA6BdvC,KAAAwC,YAAe5B,IACnB,GAAIZ,KAAKE,SAAU,CACfU,EAAMC,kBACND,EAAME,iBAEN,M,CAGJd,KAAKyC,oBAEL7B,EAAMC,iBAAiB,EAGnBb,KAAA0C,YAAe9B,IACnBA,EAAMC,kBACND,EAAME,iBAEN,GAAIF,EAAM+B,OAAS,QAAS,CACxB3C,KAAKyC,mB,GAqBLzC,KAAA4C,iBAAoBhC,IACxB,MAAMG,EAAQC,MAAMC,KAAKjB,KAAK6C,UAAU9B,OACxC,GAAIA,EAAMtC,OAAS,EAAG,CAClBmC,EAAMC,kBACNb,KAAK2B,cAAcC,KAAKb,EAAMK,IAAIC,IAClCrB,KAAK6C,UAAUnE,MAAQ,E,eAjGP,I,cAMG,M,cAMA,K,CAcpBoE,mBACH9C,KAAK6C,UAAY7C,KAAK+C,QAAQC,WAAWC,eACrCjD,KAAKsC,Y,CAINN,SACH,OACI5B,EAAC6B,EAAI,CACDiB,QAASlD,KAAKwC,YACdW,QAASnD,KAAK0C,YACdU,UAAWpD,KAAKqD,eAEhBjD,EAAA,SACIkD,OAAQ,KACRC,GAAIvD,KAAKsC,YACTkB,SAAUxD,KAAK4C,iBACfa,KAAK,OACL/B,OAAQ1B,KAAK0B,OACbxB,SAAUF,KAAKE,SACfwD,SAAU1D,KAAK0D,WAEnBtD,EAAA,a,CA2BJiD,cAAczC,GAClB,GACIA,EAAM+B,OAAS,OACf/B,EAAM+B,OAAS,aACf/B,EAAM+B,OAAS,QACjB,CACE,M,CAGJ/B,EAAME,iBACNF,EAAMC,iB,CAGF4B,oBACJzC,KAAK6C,UAAUc,O"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as n,a as t,b as r,c as e}from"./p-05ab1a40.js";function o(o){const i={id:crypto.randomUUID(),filename:o.name,contentType:o.type,size:o.size,fileContent:o};i.icon={name:n(i),title:t(i),color:r(i),backgroundColor:e(i)};return i}function i(n,t){if(t===undefined||t==="*"){return true}const r=t.split(",").map((n=>n.trim()));return r.some((t=>{if(t===n.contentType){return true}if(t.endsWith("/*")){const r=t.split("/")[0];return n.contentType.startsWith(`${r}/`)}if(t.startsWith(".")){const r=t.split(".")[1];return n.contentType.endsWith(`/${r}`)}}))}export{o as c,i};
|
|
2
|
+
//# sourceMappingURL=p-dc3d2ee1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFileInfo","file","limeFile","id","crypto","randomUUID","filename","name","contentType","type","size","fileContent","icon","getFileIcon","title","getFileExtensionTitle","color","getFileColor","backgroundColor","getFileBackgroundColor","isTypeAccepted","accept","undefined","acceptList","split","map","raw","trim","some","acceptedType","endsWith","baseType","startsWith","fileType"],"sources":["./src/util/files.ts"],"sourcesContent":["import { FileInfo } from '../global/shared-types/file.types';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from './file-metadata';\n\nexport function createFileInfo(file: File): FileInfo {\n const limeFile: FileInfo = {\n id: crypto.randomUUID(),\n filename: file.name,\n contentType: file.type,\n size: file.size,\n fileContent: file,\n };\n limeFile.icon = {\n name: getFileIcon(limeFile),\n title: getFileExtensionTitle(limeFile),\n color: getFileColor(limeFile),\n backgroundColor: getFileBackgroundColor(limeFile),\n };\n\n return limeFile;\n}\n\nexport function isTypeAccepted(file: FileInfo, accept?: string): boolean {\n if (accept === undefined || accept === '*') {\n return true;\n }\n\n const acceptList = accept.split(',').map((raw) => raw.trim());\n\n return acceptList.some((acceptedType: string) => {\n if (acceptedType === file.contentType) {\n return true;\n }\n\n if (acceptedType.endsWith('/*')) {\n const baseType = acceptedType.split('/')[0];\n\n return file.contentType.startsWith(`${baseType}/`);\n }\n\n if (acceptedType.startsWith('.')) {\n const fileType = acceptedType.split('.')[1];\n\n return file.contentType.endsWith(`/${fileType}`);\n }\n });\n}\n"],"mappings":"kEAQgBA,EAAeC,GAC3B,MAAMC,EAAqB,CACvBC,GAAIC,OAAOC,aACXC,SAAUL,EAAKM,KACfC,YAAaP,EAAKQ,KAClBC,KAAMT,EAAKS,KACXC,YAAaV,GAEjBC,EAASU,KAAO,CACZL,KAAMM,EAAYX,GAClBY,MAAOC,EAAsBb,GAC7Bc,MAAOC,EAAaf,GACpBgB,gBAAiBC,EAAuBjB,IAG5C,OAAOA,CACX,C,SAEgBkB,EAAenB,EAAgBoB,GAC3C,GAAIA,IAAWC,WAAaD,IAAW,IAAK,CACxC,OAAO,I,CAGX,MAAME,EAAaF,EAAOG,MAAM,KAAKC,KAAKC,GAAQA,EAAIC,SAEtD,OAAOJ,EAAWK,MAAMC,IACpB,GAAIA,IAAiB5B,EAAKO,YAAa,CACnC,OAAO,I,CAGX,GAAIqB,EAAaC,SAAS,MAAO,CAC7B,MAAMC,EAAWF,EAAaL,MAAM,KAAK,GAEzC,OAAOvB,EAAKO,YAAYwB,WAAW,GAAGD,K,CAG1C,GAAIF,EAAaG,WAAW,KAAM,CAC9B,MAAMC,EAAWJ,EAAaL,MAAM,KAAK,GAEzC,OAAOvB,EAAKO,YAAYsB,SAAS,IAAIG,I,IAGjD,Q"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as o,h as t}from"./p-443111b3.js";import{t as r}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as o,h as t}from"./p-443111b3.js";import{t as r}from"./p-032d839e.js";const l={note:"info",important:"exclamation_mark",tip:"idea",caution:"high_priority",warning:"error"};function n(o,t="note"){var r;if(o){return o}return(r=l[t])!==null&&r!==void 0?r:l.note}function e(o,t="note",l="en"){if(o){return o}const n=`callout.${t}`;try{return r.get(n,l)}catch(o){return r.get(n,"en")}}const i=':host(limel-callout){display:flex;border-radius:0.5rem;overflow:hidden;--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-contrast-100))\n );color:var(--callout-text-color, rgb(var(--contrast-1100)))}:host([type=note]){--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-gray-default))\n )}:host([type=important]){--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-sky-default))\n )}:host([type=tip]){--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-green-default))\n )}:host([type=caution]){--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-orange-light))\n )}:host([type=warning]){--limel-callout-tint-color:var(\n --callout-color,\n rgb(var(--color-red-dark))\n )}.side{padding:0.25rem;position:relative}.side:before{content:"";position:absolute;inset:0;opacity:0.2;background-color:var(--limel-callout-tint-color)}.side limel-icon{width:1.5rem;color:var(--limel-callout-tint-color);margin-top:0.0625rem}.main{display:flex;flex:1;flex-direction:column;gap:0.5rem;padding:0.25rem 0.5rem 0.5rem 0.5rem;background-color:var(--callout-background-color, rgb(var(--contrast-300)))}.heading{margin:0;font-size:1rem;font-weight:600}';const a=class{constructor(t){o(this,t);this.heading=undefined;this.icon=undefined;this.type="note";this.language="en"}render(){return[t("div",{class:"side",role:"presentation"},t("limel-icon",{name:n(this.icon,this.type)})),t("div",{class:"main"},t("h1",{class:"heading"},e(this.heading,this.type,this.language)),t("slot",null))]}};a.style=i;export{a as limel_callout};
|
|
2
|
+
//# sourceMappingURL=p-f50e4b6f.entry.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { FileInfo } from '../../../../../global/shared-types/file.types';
|
|
4
|
+
import { ImageInserter, ImageInfo } from '../../../text-editor.types';
|
|
5
|
+
import { Node } from 'prosemirror-model';
|
|
6
|
+
export declare const pluginKey: PluginKey<any>;
|
|
7
|
+
type ImagePastedCallback = (data: ImageInserter) => CustomEvent<ImageInserter>;
|
|
8
|
+
type ImageRemovedCallback = (data: ImageInfo) => CustomEvent<ImageInfo>;
|
|
9
|
+
type PluginState = {
|
|
10
|
+
insertedImages: Record<string, Node>;
|
|
11
|
+
};
|
|
12
|
+
export declare const createImageInserterPlugin: (imagePastedCallback: ImagePastedCallback, imageRemovedCallback: ImageRemovedCallback) => Plugin<PluginState>;
|
|
13
|
+
export declare const imageInserterFactory: (view: EditorView, base64Data: string, fileInfo: FileInfo) => ImageInserter;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=inserter.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeSpec, Node } from 'prosemirror-model';
|
|
2
|
+
import { MarkdownSerializerState } from 'prosemirror-markdown';
|
|
3
|
+
import { Languages } from '../../../../date-picker/date.types';
|
|
4
|
+
export declare const imageCache: Map<string, HTMLImageElement>;
|
|
5
|
+
type MarkdownSerializerFunction = (state: MarkdownSerializerState, node: Node) => void;
|
|
6
|
+
export declare function getImageNode(language: Languages): Record<string, NodeSpec>;
|
|
7
|
+
export declare function getImageNodeMarkdownSerializer(language: Languages): Record<string, MarkdownSerializerFunction>;
|
|
8
|
+
/**
|
|
9
|
+
* Recursively checks if a ProseMirror node or
|
|
10
|
+
* any of its child nodes is an image node.
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasImageNode(node: Node): boolean;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -69,6 +69,20 @@ export declare class ProsemirrorAdapter {
|
|
|
69
69
|
* Dispatched when a change is made to the editor
|
|
70
70
|
*/
|
|
71
71
|
private change;
|
|
72
|
+
/**
|
|
73
|
+
* Dispatched when a image is pasted into the editor
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
* @alpha
|
|
77
|
+
*/
|
|
78
|
+
private imagePasted;
|
|
79
|
+
/**
|
|
80
|
+
* Dispatched when a image is removed from the editor
|
|
81
|
+
*
|
|
82
|
+
* @private
|
|
83
|
+
* @alpha
|
|
84
|
+
*/
|
|
85
|
+
private imageRemoved;
|
|
72
86
|
constructor();
|
|
73
87
|
protected watchValue(newValue: string): void;
|
|
74
88
|
componentWillLoad(): void;
|
|
@@ -18,6 +18,8 @@ import { EditorUiType } from './types';
|
|
|
18
18
|
* @exampleComponent limel-example-text-editor-with-markdown
|
|
19
19
|
* @exampleComponent limel-example-text-editor-with-html
|
|
20
20
|
* @exampleComponent limel-example-text-editor-with-tables
|
|
21
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-file-storage
|
|
22
|
+
* @exampleComponent limel-example-text-editor-with-inline-images-base64
|
|
21
23
|
* @exampleComponent limel-example-text-editor-allow-resize
|
|
22
24
|
* @exampleComponent limel-example-text-editor-size
|
|
23
25
|
* @exampleComponent limel-example-text-editor-ui
|
|
@@ -124,6 +126,20 @@ export declare class TextEditor implements FormComponent<string> {
|
|
|
124
126
|
* Dispatched when a change is made to the editor
|
|
125
127
|
*/
|
|
126
128
|
change: EventEmitter<string>;
|
|
129
|
+
/**
|
|
130
|
+
* Dispatched when a image is pasted into the editor
|
|
131
|
+
*
|
|
132
|
+
* @private
|
|
133
|
+
* @alpha
|
|
134
|
+
*/
|
|
135
|
+
private imagePasted;
|
|
136
|
+
/**
|
|
137
|
+
* Dispatched when a image is removed from the editor
|
|
138
|
+
*
|
|
139
|
+
* @private
|
|
140
|
+
* @alpha
|
|
141
|
+
*/
|
|
142
|
+
private imageRemoved;
|
|
127
143
|
/**
|
|
128
144
|
* Dispatched if a trigger character is detected.
|
|
129
145
|
*
|
|
@@ -157,5 +173,7 @@ export declare class TextEditor implements FormComponent<string> {
|
|
|
157
173
|
private renderHelperLine;
|
|
158
174
|
private isInvalid;
|
|
159
175
|
private handleChange;
|
|
176
|
+
private handleImagePasted;
|
|
177
|
+
private handleImageRemoved;
|
|
160
178
|
}
|
|
161
179
|
//# sourceMappingURL=text-editor.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CustomElement } from '../../global/shared-types/custom-element.types';
|
|
2
|
+
import { FileInfo } from '../../global/shared-types/file.types';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a trigger character and its position in the text.
|
|
4
5
|
*
|
|
@@ -27,6 +28,56 @@ export type TextEditorNode = {
|
|
|
27
28
|
*/
|
|
28
29
|
children?: Array<TextEditorNode | string>;
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export interface ImageInserter {
|
|
35
|
+
fileInfo: FileInfo;
|
|
36
|
+
/**
|
|
37
|
+
* Method to insert a thumbnail at the cursor position.
|
|
38
|
+
*/
|
|
39
|
+
insertThumbnail: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Method to insert the image at the thumbnail position.
|
|
42
|
+
* Thumbnail must be inserted before calling this method.
|
|
43
|
+
*
|
|
44
|
+
* @param src - The src url of the uploaded image.
|
|
45
|
+
* If not provided, the image will be inserted with base64 data.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
insertImage: (src?: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Method to insert a failed thumbnail at the thumbnail position.
|
|
51
|
+
* Thumbnail must be inserted before calling this method.
|
|
52
|
+
*/
|
|
53
|
+
insertFailedThumbnail: () => void;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @alpha
|
|
57
|
+
*/
|
|
58
|
+
export declare enum ImageState {
|
|
59
|
+
LOADING = "loading",
|
|
60
|
+
FAILED = "failed",
|
|
61
|
+
SUCCESS = "success"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
export interface ImageInfo {
|
|
67
|
+
/**
|
|
68
|
+
* Unique ID of the image file.
|
|
69
|
+
*/
|
|
70
|
+
fileInfoId: string;
|
|
71
|
+
/**
|
|
72
|
+
* The source of the image.
|
|
73
|
+
* Can either be a URL pointing to the image or a base64 encoded string.
|
|
74
|
+
*/
|
|
75
|
+
src: string;
|
|
76
|
+
/**
|
|
77
|
+
* The current state of the image.
|
|
78
|
+
*/
|
|
79
|
+
state: ImageState;
|
|
80
|
+
}
|
|
30
81
|
/**
|
|
31
82
|
* @alpha
|
|
32
83
|
*/
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ContentTypeConverter } from './content-type-converter';
|
|
2
2
|
import { EditorView } from 'prosemirror-view';
|
|
3
3
|
import { CustomElementDefinition } from '../../../global/shared-types/custom-element.types';
|
|
4
|
+
import { Languages } from '../../date-picker/date.types';
|
|
4
5
|
/**
|
|
5
6
|
* @private
|
|
6
7
|
*/
|
|
7
8
|
export declare class MarkdownConverter implements ContentTypeConverter {
|
|
8
9
|
private markdownSerializer;
|
|
9
10
|
private customNodes;
|
|
10
|
-
constructor(plugins: CustomElementDefinition[]);
|
|
11
|
+
constructor(plugins: CustomElementDefinition[], language: Languages);
|
|
11
12
|
parseAsHTML: (text: string) => Promise<string>;
|
|
12
13
|
serialize: (view: EditorView) => string;
|
|
13
14
|
}
|