@limetech/lime-elements 39.0.4 → 39.1.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 +12 -0
- package/dist/cjs/index-nxo2UO7I.js +20355 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-action-bar_2.cjs.entry.js +4 -4
- package/dist/cjs/limel-ai-avatar.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js +6 -6
- 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-code-editor.cjs.entry.js +1 -1
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
- package/dist/cjs/limel-drag-handle.cjs.entry.js +1 -1
- package/dist/cjs/limel-email-viewer.cjs.entry.js +351 -0
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +2 -2
- package/dist/cjs/limel-file-viewer.cjs.entry.js +4967 -26
- package/dist/cjs/limel-file.cjs.entry.js +2 -2
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-flex-container.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-grid.cjs.entry.js +1 -1
- package/dist/cjs/limel-header.cjs.entry.js +1 -1
- package/dist/cjs/limel-help-content.cjs.entry.js +1 -1
- package/dist/cjs/limel-help.cjs.entry.js +2 -2
- package/dist/cjs/limel-helper-line_2.cjs.entry.js +3 -3
- package/dist/cjs/limel-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-icon.cjs.entry.js +1 -1
- package/dist/cjs/limel-info-tile.cjs.entry.js +2 -2
- package/dist/cjs/limel-linear-progress.cjs.entry.js +1 -1
- package/dist/cjs/limel-list-item.cjs.entry.js +3 -3
- package/dist/cjs/limel-markdown.cjs.entry.js +3 -2
- package/dist/cjs/limel-menu-item-meta.cjs.entry.js +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-popover_2.cjs.entry.js +2 -2
- package/dist/cjs/limel-portal_3.cjs.entry.js +4 -4
- package/dist/cjs/limel-profile-picture.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +15 -14
- package/dist/cjs/limel-radio-button-group.cjs.entry.js +1 -1
- package/dist/cjs/limel-radio-button.cjs.entry.js +2 -2
- package/dist/cjs/limel-select.cjs.entry.js +1 -1
- package/dist/cjs/limel-shortcut.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +3 -3
- package/dist/cjs/limel-split-button.cjs.entry.js +2 -2
- package/dist/cjs/limel-tab-bar.cjs.entry.js +2 -2
- package/dist/cjs/limel-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +4 -4
- package/dist/cjs/limel-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{markdown-parser-_1bsy-5h.js → markdown-parser-B66l_Zvo.js} +20342 -40680
- package/dist/cjs/{translations-BIHr3B9O.js → translations-B0hzD08N.js} +112 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/email-viewer/email-loader.js +206 -0
- package/dist/collection/components/email-viewer/email-viewer.css +293 -0
- package/dist/collection/components/email-viewer/email-viewer.js +294 -0
- package/dist/collection/components/email-viewer/email-viewer.types.js +1 -0
- package/dist/collection/components/email-viewer/remote-images.js +50 -0
- package/dist/collection/components/email-viewer/sanitize-email-html.js +245 -0
- package/dist/collection/components/email-viewer/split-email-address-list.js +106 -0
- package/dist/collection/components/file/file.js +1 -1
- package/dist/collection/components/file-dropzone/file-dropzone.js +1 -1
- package/dist/collection/components/file-input/file-input.js +1 -1
- package/dist/collection/components/file-viewer/extension-mapping.js +1 -0
- package/dist/collection/components/file-viewer/file-viewer.js +54 -7
- package/dist/collection/components/flex-container/flex-container.js +1 -1
- package/dist/collection/components/form/form.js +1 -1
- package/dist/collection/components/grid/grid.js +1 -1
- package/dist/collection/components/header/header.js +1 -1
- package/dist/collection/components/help/help-content.js +1 -1
- package/dist/collection/components/help/help.js +2 -2
- package/dist/collection/components/helper-line/helper-line.js +2 -2
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon-button/icon-button.js +1 -1
- package/dist/collection/components/info-tile/info-tile.js +2 -2
- package/dist/collection/components/input-field/input-field.js +1 -1
- package/dist/collection/components/list/list.js +1 -1
- package/dist/collection/components/list-item/list-item.js +2 -2
- package/dist/collection/components/list-item/menu-item-meta/menu-item-meta.js +1 -1
- package/dist/collection/components/markdown/markdown.js +1 -1
- package/dist/collection/components/menu/menu.js +1 -1
- package/dist/collection/components/menu-list/menu-list.js +1 -1
- package/dist/collection/components/menu-surface/menu-surface.js +1 -1
- package/dist/collection/components/notched-outline/notched-outline.js +1 -1
- package/dist/collection/components/picker/picker.js +1 -1
- package/dist/collection/components/popover/popover.js +1 -1
- package/dist/collection/components/popover-surface/popover-surface.js +1 -1
- package/dist/collection/components/portal/portal.js +1 -1
- package/dist/collection/components/radio-button-group/radio-button-group.js +1 -1
- package/dist/collection/components/radio-button-group/radio-button.js +2 -2
- package/dist/collection/components/select/select.js +1 -1
- package/dist/collection/components/shortcut/shortcut.js +1 -1
- package/dist/collection/components/slider/slider.js +1 -1
- package/dist/collection/components/snackbar/snackbar.js +2 -2
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/split-button/split-button.js +2 -2
- package/dist/collection/components/tab-bar/tab-bar.js +2 -2
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/table/table.js +3 -3
- package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +3 -3
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +1 -1
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/tooltip/tooltip-content.js +1 -1
- package/dist/collection/components/tooltip/tooltip.js +2 -2
- package/dist/collection/interface.js +1 -0
- package/dist/collection/translations/da.js +14 -0
- package/dist/collection/translations/de.js +14 -0
- package/dist/collection/translations/en.js +14 -0
- package/dist/collection/translations/fi.js +14 -0
- package/dist/collection/translations/fr.js +14 -0
- package/dist/collection/translations/nl.js +14 -0
- package/dist/collection/translations/no.js +14 -0
- package/dist/collection/translations/sv.js +14 -0
- package/dist/collection/util/format-bytes.js +38 -0
- package/dist/esm/{file-metadata-D5joHaqk.js → file-metadata-BwF9vTXN.js} +1 -1
- package/dist/esm/{files-CkgibGPZ.js → files-P324wLau.js} +1 -1
- package/dist/esm/{get-icon-props-COzG_Mhw.js → get-icon-props-CgNJbSP4.js} +1 -1
- package/dist/esm/index-CJ0GYrWG.js +20341 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-action-bar-item_2.entry.js +1 -1
- package/dist/esm/limel-action-bar_2.entry.js +4 -4
- package/dist/esm/limel-ai-avatar.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_7.entry.js +7 -7
- package/dist/esm/limel-button.entry.js +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-card.entry.js +1 -1
- package/dist/esm/limel-chart.entry.js +1 -1
- package/dist/esm/limel-chip_2.entry.js +2 -2
- package/dist/esm/limel-code-editor.entry.js +1 -1
- package/dist/esm/limel-collapsible-section.entry.js +2 -2
- package/dist/esm/limel-drag-handle.entry.js +1 -1
- package/dist/esm/limel-dynamic-label.entry.js +1 -1
- package/dist/esm/limel-email-viewer.entry.js +349 -0
- package/dist/esm/limel-file-dropzone_2.entry.js +5 -5
- package/dist/esm/limel-file-viewer.entry.js +4948 -7
- package/dist/esm/limel-file.entry.js +4 -4
- package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
- package/dist/esm/limel-flex-container.entry.js +1 -1
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-grid.entry.js +1 -1
- package/dist/esm/limel-header.entry.js +2 -2
- package/dist/esm/limel-help-content.entry.js +1 -1
- package/dist/esm/limel-help.entry.js +2 -2
- package/dist/esm/limel-helper-line_2.entry.js +3 -3
- package/dist/esm/limel-icon-button.entry.js +2 -2
- package/dist/esm/limel-icon.entry.js +1 -1
- package/dist/esm/limel-info-tile.entry.js +2 -2
- package/dist/esm/limel-linear-progress.entry.js +1 -1
- package/dist/esm/limel-list-item.entry.js +4 -4
- package/dist/esm/limel-markdown.entry.js +3 -2
- package/dist/esm/limel-menu-item-meta.entry.js +1 -1
- package/dist/esm/limel-picker.entry.js +2 -2
- package/dist/esm/limel-popover_2.entry.js +2 -2
- package/dist/esm/limel-portal_3.entry.js +4 -4
- package/dist/esm/limel-profile-picture.entry.js +4 -4
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-progress-flow.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +7 -6
- package/dist/esm/limel-radio-button-group.entry.js +1 -1
- package/dist/esm/limel-radio-button.entry.js +2 -2
- package/dist/esm/limel-select.entry.js +2 -2
- package/dist/esm/limel-shortcut.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +1 -1
- package/dist/esm/limel-snackbar.entry.js +3 -3
- package/dist/esm/limel-split-button.entry.js +2 -2
- package/dist/esm/limel-tab-bar.entry.js +3 -3
- package/dist/esm/limel-tab-panel.entry.js +1 -1
- package/dist/esm/limel-table.entry.js +4 -4
- package/dist/esm/limel-text-editor.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{markdown-parser-DkmQCwAi.js → markdown-parser-DJi1w622.js} +20287 -40624
- package/dist/esm/{translations-6rJPElLH.js → translations-Cdx3I2X8.js} +112 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-927622ec.entry.js → p-00fdb26c.entry.js} +1 -1
- package/dist/lime-elements/{p-880b9683.entry.js → p-1244d687.entry.js} +2 -2
- package/dist/lime-elements/p-1d71e9c8.entry.js +1 -0
- package/dist/lime-elements/p-21aef7f4.entry.js +1 -0
- package/dist/lime-elements/{p-68f49d6f.entry.js → p-278356b3.entry.js} +1 -1
- package/dist/lime-elements/{p-a6fae24d.entry.js → p-28dae22e.entry.js} +1 -1
- package/dist/lime-elements/{p-6951136b.entry.js → p-2d31cf0d.entry.js} +1 -1
- package/dist/lime-elements/{p-6e3666e5.entry.js → p-2ef38dac.entry.js} +1 -1
- package/dist/lime-elements/{p-dd36d57b.entry.js → p-2f788e92.entry.js} +7 -7
- package/dist/lime-elements/p-2kcqdtMr.js +1 -0
- package/dist/lime-elements/{p-11f716f5.entry.js → p-3000785f.entry.js} +1 -1
- package/dist/lime-elements/{p-2a5b259e.entry.js → p-3130d348.entry.js} +1 -1
- package/dist/lime-elements/{p-feeae1e4.entry.js → p-38097fa1.entry.js} +1 -1
- package/dist/lime-elements/p-3b299849.entry.js +1 -0
- package/dist/lime-elements/{p-00859fac.entry.js → p-3e6ce4e1.entry.js} +2 -2
- package/dist/lime-elements/{p-23f7956e.entry.js → p-3ec31835.entry.js} +1 -1
- package/dist/lime-elements/{p-52edfe86.entry.js → p-44396c0d.entry.js} +1 -1
- package/dist/lime-elements/{p-ec42a4aa.entry.js → p-494f880b.entry.js} +1 -1
- package/dist/lime-elements/{p-d1fa6da3.entry.js → p-4f6e3057.entry.js} +3 -3
- package/dist/lime-elements/{p-e6d74062.entry.js → p-504ae59f.entry.js} +1 -1
- package/dist/lime-elements/{p-7d5bd4a2.entry.js → p-51565372.entry.js} +1 -1
- package/dist/lime-elements/{p-5ddeb498.entry.js → p-52098c47.entry.js} +1 -1
- package/dist/lime-elements/{p-d2123236.entry.js → p-521a0204.entry.js} +1 -1
- package/dist/lime-elements/{p-38fb97fe.entry.js → p-54d85ae4.entry.js} +1 -1
- package/dist/lime-elements/{p-88f503eb.entry.js → p-59a522ee.entry.js} +1 -1
- package/dist/lime-elements/{p-2c1538f0.entry.js → p-5af72e1b.entry.js} +1 -1
- package/dist/lime-elements/p-64cc5094.entry.js +1 -0
- package/dist/lime-elements/{p-045c6027.entry.js → p-67a2c7f5.entry.js} +1 -1
- package/dist/lime-elements/{p-8db6b7d9.entry.js → p-68b1605f.entry.js} +1 -1
- package/dist/lime-elements/{p-7457bc07.entry.js → p-770981e6.entry.js} +1 -1
- package/dist/lime-elements/{p-9ea564fe.entry.js → p-7ed97446.entry.js} +1 -1
- package/dist/lime-elements/{p-cbb7d624.entry.js → p-8053727c.entry.js} +1 -1
- package/dist/lime-elements/{p-fc3209db.entry.js → p-80f9f2d3.entry.js} +1 -1
- package/dist/lime-elements/{p-34ef71f2.entry.js → p-95fb9ef8.entry.js} +1 -1
- package/dist/lime-elements/{p-6275668f.entry.js → p-961dff13.entry.js} +1 -1
- package/dist/lime-elements/{p-abef62d7.entry.js → p-97952658.entry.js} +1 -1
- package/dist/lime-elements/{p-d6270e4a.entry.js → p-982b9f50.entry.js} +1 -1
- package/dist/lime-elements/p-9c4156c6.entry.js +1 -0
- package/dist/lime-elements/p-BRCcjfVu.js +7 -0
- package/dist/lime-elements/{p-DSjFzQmB.js → p-CWuGCKo1.js} +1 -1
- package/dist/lime-elements/p-Cdx3I2X8.js +1 -0
- package/dist/lime-elements/{p-COzG_Mhw.js → p-CgNJbSP4.js} +1 -1
- package/dist/lime-elements/{p-BQY2kAWs.js → p-DlJXKdhK.js} +1 -1
- package/dist/lime-elements/{p-bbaf35ce.entry.js → p-a9f3f90c.entry.js} +1 -1
- package/dist/lime-elements/{p-c9e934af.entry.js → p-af5f2052.entry.js} +1 -1
- package/dist/lime-elements/{p-f9480c52.entry.js → p-c2478225.entry.js} +1 -1
- package/dist/lime-elements/{p-6aebcf60.entry.js → p-c7f2e189.entry.js} +1 -1
- package/dist/lime-elements/{p-d424688d.entry.js → p-cb2cc243.entry.js} +1 -1
- package/dist/lime-elements/{p-c118eac0.entry.js → p-cce53162.entry.js} +1 -1
- package/dist/lime-elements/{p-6896d5c8.entry.js → p-d4fea438.entry.js} +1 -1
- package/dist/lime-elements/{p-534fdf9b.entry.js → p-df1fa930.entry.js} +1 -1
- package/dist/lime-elements/{p-52bb74b9.entry.js → p-e05ad4f8.entry.js} +1 -1
- package/dist/lime-elements/{p-303d01e5.entry.js → p-e6b0e0a2.entry.js} +1 -1
- package/dist/lime-elements/{p-80d35f8f.entry.js → p-e975cc29.entry.js} +1 -1
- package/dist/lime-elements/{p-9ed578ec.entry.js → p-f532b60f.entry.js} +1 -1
- package/dist/lime-elements/{p-4be18a57.entry.js → p-ff845f5c.entry.js} +1 -1
- package/dist/types/components/email-viewer/email-loader.d.ts +19 -0
- package/dist/types/components/email-viewer/email-viewer.d.ts +69 -0
- package/dist/types/components/email-viewer/email-viewer.types.d.ts +70 -0
- package/dist/types/components/email-viewer/remote-images.d.ts +22 -0
- package/dist/types/components/email-viewer/sanitize-email-html.d.ts +14 -0
- package/dist/types/components/email-viewer/split-email-address-list.d.ts +25 -0
- package/dist/types/components/file-viewer/file-viewer.d.ts +9 -0
- package/dist/types/components/file-viewer/file-viewer.types.d.ts +1 -1
- package/dist/types/components.d.ts +116 -0
- package/dist/types/interface.d.ts +1 -0
- package/dist/types/translations/da.d.ts +10 -0
- package/dist/types/translations/de.d.ts +10 -0
- package/dist/types/translations/en.d.ts +10 -0
- package/dist/types/translations/fi.d.ts +10 -0
- package/dist/types/translations/fr.d.ts +10 -0
- package/dist/types/translations/nl.d.ts +10 -0
- package/dist/types/translations/no.d.ts +10 -0
- package/dist/types/translations/sv.d.ts +10 -0
- package/dist/types/util/format-bytes.d.ts +21 -0
- package/package.json +4 -5
- package/dist/lime-elements/p-017dd326.entry.js +0 -1
- package/dist/lime-elements/p-4beeec39.entry.js +0 -1
- package/dist/lime-elements/p-55596d9a.entry.js +0 -1
- package/dist/lime-elements/p-6rJPElLH.js +0 -1
- package/dist/lime-elements/p-Df0HAtSs.js +0 -7
- package/dist/lime-elements/p-f395fbe3.entry.js +0 -1
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Ddjrlc-6.js');
|
|
4
|
+
var translations = require('./translations-B0hzD08N.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checks whether the given HTML contains any images with a `data-remote-src`
|
|
8
|
+
* attribute, indicating they reference external (remote) resources.
|
|
9
|
+
*
|
|
10
|
+
* @param html - The HTML string to inspect.
|
|
11
|
+
*/
|
|
12
|
+
function containsRemoteImages(html) {
|
|
13
|
+
const parser = new DOMParser();
|
|
14
|
+
const document = parser.parseFromString(html, 'text/html');
|
|
15
|
+
return document.querySelector('img[data-remote-src]') !== null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* If `allowRemoteImages` is `true`, replaces the `src` attribute of every
|
|
19
|
+
* `<img data-remote-src="...">` element with the value of `data-remote-src`
|
|
20
|
+
* (provided it points to an http(s) URL) and removes the data attribute.
|
|
21
|
+
*
|
|
22
|
+
* When `allowRemoteImages` is `false` the HTML is returned unchanged.
|
|
23
|
+
*
|
|
24
|
+
* Returns an HTML fragment that is safe to assign to `innerHTML` on a regular
|
|
25
|
+
* container element (not a full `<html>/<head>/<body>` document string).
|
|
26
|
+
*
|
|
27
|
+
* @param html - The HTML string to process.
|
|
28
|
+
* @param allowRemoteImages - Whether to restore remote image sources.
|
|
29
|
+
*/
|
|
30
|
+
function applyRemoteImagesPolicy(html, allowRemoteImages) {
|
|
31
|
+
if (!allowRemoteImages) {
|
|
32
|
+
return html;
|
|
33
|
+
}
|
|
34
|
+
const parser = new DOMParser();
|
|
35
|
+
const document = parser.parseFromString(html, 'text/html');
|
|
36
|
+
const images = document.querySelectorAll('img[data-remote-src]');
|
|
37
|
+
for (const image of images) {
|
|
38
|
+
const remoteSrc = image.dataset.remoteSrc;
|
|
39
|
+
if (!remoteSrc || !isAllowedRemoteImageUrl(remoteSrc)) {
|
|
40
|
+
delete image.dataset.remoteSrc;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
image.setAttribute('src', remoteSrc);
|
|
44
|
+
delete image.dataset.remoteSrc;
|
|
45
|
+
}
|
|
46
|
+
const headStyles = [...document.head.querySelectorAll('style')]
|
|
47
|
+
.map((style) => style.outerHTML)
|
|
48
|
+
.join('');
|
|
49
|
+
return `${headStyles}${document.body.innerHTML}`;
|
|
50
|
+
}
|
|
51
|
+
function isAllowedRemoteImageUrl(url) {
|
|
52
|
+
const trimmed = url.trim();
|
|
53
|
+
const lower = trimmed.toLowerCase();
|
|
54
|
+
return lower.startsWith('https://') || lower.startsWith('http://');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Splits a comma-separated email address list (e.g. `To:` / `Cc:`) into individual
|
|
59
|
+
* recipient strings.
|
|
60
|
+
*
|
|
61
|
+
* In RFC 5322, address lists are comma-separated. However, commas can also appear
|
|
62
|
+
* inside quoted display names (quoted-string) and must then be ignored as separators.
|
|
63
|
+
* This splitter only treats a comma as a separator when it is outside quoted strings
|
|
64
|
+
* and outside angle-bracketed address parts (`<...>`).
|
|
65
|
+
*
|
|
66
|
+
* Notes:
|
|
67
|
+
* - If a display name contains a comma, it should be quoted or encoded to be
|
|
68
|
+
* unambiguous, e.g. `"Doe, Jane" <jane.doe@example.com>` or
|
|
69
|
+
* `=?UTF-8?Q?Doe,_Jane?= <jane.doe@example.com>`.
|
|
70
|
+
* - Real-world `.eml` files are usually RFC-ish but not always perfectly compliant.
|
|
71
|
+
* Malformed input with unquoted commas in display names may be split incorrectly.
|
|
72
|
+
*
|
|
73
|
+
* @param value - A comma-separated list of recipients.
|
|
74
|
+
* @returns An array of trimmed recipient strings.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* splitEmailAddressList('"Doe, Jane" <jane@example.com>, Team <team@example.com>');
|
|
78
|
+
* // => ['"Doe, Jane" <jane@example.com>', 'Team <team@example.com>']
|
|
79
|
+
*/
|
|
80
|
+
function splitEmailAddressList(value) {
|
|
81
|
+
const parts = [];
|
|
82
|
+
let current = '';
|
|
83
|
+
const state = {
|
|
84
|
+
inQuotes: false,
|
|
85
|
+
escapeNext: false,
|
|
86
|
+
angleDepth: 0,
|
|
87
|
+
};
|
|
88
|
+
const append = (character) => {
|
|
89
|
+
current += character;
|
|
90
|
+
};
|
|
91
|
+
const flush = () => {
|
|
92
|
+
const trimmed = current.trim();
|
|
93
|
+
if (trimmed) {
|
|
94
|
+
parts.push(trimmed);
|
|
95
|
+
}
|
|
96
|
+
current = '';
|
|
97
|
+
};
|
|
98
|
+
for (const character of value) {
|
|
99
|
+
if (consumeEscaped(character, state, append)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (beginEscape(character, state, append)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (toggleQuote(character, state, append)) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (adjustAngleDepth(character, state, append)) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (isAddressSeparator(character, state)) {
|
|
112
|
+
flush();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
append(character);
|
|
116
|
+
}
|
|
117
|
+
flush();
|
|
118
|
+
return parts;
|
|
119
|
+
}
|
|
120
|
+
function consumeEscaped(character, state, append) {
|
|
121
|
+
if (!state.escapeNext) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
append(character);
|
|
125
|
+
state.escapeNext = false;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
function beginEscape(character, state, append) {
|
|
129
|
+
if (!state.inQuotes || character !== '\\') {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
append(character);
|
|
133
|
+
state.escapeNext = true;
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
function toggleQuote(character, state, append) {
|
|
137
|
+
if (character !== '"' || state.angleDepth !== 0) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
append(character);
|
|
141
|
+
state.inQuotes = !state.inQuotes;
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
function adjustAngleDepth(character, state, append) {
|
|
145
|
+
if (state.inQuotes) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
if (character === '<') {
|
|
149
|
+
append(character);
|
|
150
|
+
state.angleDepth += 1;
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
if (character !== '>' || state.angleDepth === 0) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
append(character);
|
|
157
|
+
state.angleDepth -= 1;
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
function isAddressSeparator(character, state) {
|
|
161
|
+
return character === ',' && !state.inQuotes && state.angleDepth === 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Format a file size in bytes into a human readable string.
|
|
166
|
+
*
|
|
167
|
+
* Uses base 1024 units (binary prefixes without the "i" designation)
|
|
168
|
+
* and applies adaptive precision: one decimal for values < 10 of the
|
|
169
|
+
* chosen unit, otherwise no decimals.
|
|
170
|
+
*
|
|
171
|
+
* Examples:
|
|
172
|
+
* - 0 => "0 B"
|
|
173
|
+
* - 512 => "512 B"
|
|
174
|
+
* - 1536 => "1.5 KB"
|
|
175
|
+
* - 1048576 => "1 MB"
|
|
176
|
+
* - 5368709120 => "5 GB"
|
|
177
|
+
* - formatBytes(5347737600, 2) => "4.98 GB" (value < 10 so two decimals)
|
|
178
|
+
*
|
|
179
|
+
* @param bytes - the size in bytes
|
|
180
|
+
* @param decimals - max number of decimals for small unit values (default: 1)
|
|
181
|
+
* @returns formatted size string
|
|
182
|
+
*/
|
|
183
|
+
function formatBytes(bytes, decimals = 1) {
|
|
184
|
+
if (bytes == null || Number.isNaN(bytes)) {
|
|
185
|
+
return '';
|
|
186
|
+
}
|
|
187
|
+
if (bytes < 0) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
if (bytes === 0) {
|
|
191
|
+
return '0 B';
|
|
192
|
+
}
|
|
193
|
+
const k = 1024;
|
|
194
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
195
|
+
const i = Math.max(0, Math.min(sizes.length - 1, Math.floor(Math.log(bytes) / Math.log(k))));
|
|
196
|
+
const value = bytes / Math.pow(k, i);
|
|
197
|
+
const safeDecimals = Number.isFinite(decimals) ? Math.trunc(decimals) : 0;
|
|
198
|
+
const precision = value < 10 ? Math.min(100, Math.max(0, safeDecimals)) : 0; // only keep decimals for small values
|
|
199
|
+
const rounded = Number.parseFloat(value.toFixed(precision));
|
|
200
|
+
return `${rounded} ${sizes[i]}`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const emailViewerCss = () => `@charset "UTF-8";:host(limel-email-viewer){display:block;width:100%;height:100%;box-sizing:border-box}*,*::before,*::after{box-sizing:border-box;min-width:0;min-height:0}.email{display:flex;flex-direction:column;width:100%;height:100%;padding-bottom:0.5rem;box-shadow:var(--shadow-depth-8)}.email-headers{position:relative;flex-shrink:0;display:flex;flex-direction:column}.email-headers dl,.email-headers dt,.email-headers dd{margin:0}.email-headers dl{display:flex;flex-wrap:wrap;gap:0 0.5rem;padding:0.5rem 0.75rem;font-size:0.75rem}.email-headers dl:nth-child(even){background-color:rgb(var(--contrast-800), 0.1)}.email-headers dl dt{opacity:0.6;min-width:3rem}.email-headers dl dt::after{content:":"}.email-headers dl dd:not(:last-child)::after{content:",";opacity:0.6}.email-headers dl.subject dd{font-weight:bold}.email-headers dl.date{position:absolute;right:0.25rem;transform:translateY(-50%);font-size:0.625rem;border-radius:9rem;padding:0.25rem 0.5rem;background-color:rgb(var(--contrast-100), 0.3)}.email-headers dl.date dt{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}.attachments{flex-shrink:0;padding:0.5rem;border-bottom:1px dashed rgba(var(--contrast-700))}.attachments span{padding-left:0.25rem;font-size:0.75rem;opacity:0.6}.attachments span:first-child::after{content:":"}.attachments ul{all:unset;display:grid;grid-template-columns:repeat(auto-fill, minmax(8rem, 1fr));gap:0.5rem;padding:0.5rem 0}.attachments li{all:unset;position:relative;display:flex;flex-direction:column;gap:0.25rem;font-size:0.6875rem;line-height:normal;padding:0.5rem 0.5rem 1rem 0.5rem;border-radius:0.5rem;border:1px solid rgba(var(--contrast-600));background-color:rgba(var(--contrast-400))}.attachments .attachment-filename{font-weight:500}.attachments .attachment-mime-type{opacity:0.7}.attachments limel-badge{--badge-max-width:auto;--badge-background-color:rgb(var(--contrast-1000), 0.7);--badge-text-color:rgb(var(--color-white));position:absolute;bottom:0.125rem;right:0.125rem;box-shadow:var(--shadow-brighten-edges-outside)}section{flex-grow:1;display:flex;flex-direction:column;border-top:1px dashed rgba(var(--contrast-700));min-height:2rem;overflow-y:auto}limel-collapsible-section{--closed-header-background-color:var( --lime-elevated-surface-background-color );flex-grow:1;flex-shrink:0;margin:0.5rem;border-radius:0.75rem;box-shadow:var(--shadow-depth-8)}limel-collapsible-section button{all:unset;flex-shrink:0;border-radius:0.375rem;padding:0.25rem 0.5rem;font-size:var(--limel-theme-small-font-size);margin:0 0.5rem}limel-collapsible-section button.load-images{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(--lime-primary-color, var(--limel-theme-primary-color));background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal)}limel-collapsible-section button.load-images:hover,limel-collapsible-section button.load-images:focus,limel-collapsible-section button.load-images:focus-visible{will-change:color, background-color, box-shadow, transform}limel-collapsible-section button.load-images:hover,limel-collapsible-section button.load-images:focus-visible{transform:translate3d(0, -0.04rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}limel-collapsible-section button.load-images:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}limel-collapsible-section button.load-images:hover,limel-collapsible-section button.load-images:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}limel-collapsible-section limel-markdown{padding:0.5rem}.body{flex-grow:1;max-width:100%;padding:0.75rem}.body.plain-text{white-space:pre-wrap;overflow-wrap:anywhere;margin:0;font-family:inherit}.body img{max-width:100% !important}`;
|
|
204
|
+
|
|
205
|
+
const EmailViewer = class {
|
|
206
|
+
constructor(hostRef) {
|
|
207
|
+
index.registerInstance(this, hostRef);
|
|
208
|
+
this.allowRemoteImagesChange = index.createEvent(this, "allowRemoteImagesChange");
|
|
209
|
+
/**
|
|
210
|
+
* Defines the localization for translations.
|
|
211
|
+
*/
|
|
212
|
+
this.language = 'en';
|
|
213
|
+
this.allowRemoteImagesState = false;
|
|
214
|
+
this.renderAttachment = (attachment, index$1) => {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
const filename = ((_a = attachment.filename) === null || _a === void 0 ? void 0 : _a.trim()) ||
|
|
217
|
+
this.getTranslation('file-viewer.email.attachment.unnamed');
|
|
218
|
+
const mimeType = ((_b = attachment.mimeType) === null || _b === void 0 ? void 0 : _b.trim()) || '';
|
|
219
|
+
return (index.h("li", { key: `attachment-${index$1}` }, index.h("span", { class: "attachment-filename" }, filename), index.h("span", { class: "attachment-mime-type" }, " ", mimeType), this.renderSizeBadge(attachment.size)));
|
|
220
|
+
};
|
|
221
|
+
this.renderSizeBadge = (size) => {
|
|
222
|
+
if (typeof size !== 'number') {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
return (index.h("limel-badge", { class: "attachment-size", label: formatBytes(size) }));
|
|
226
|
+
};
|
|
227
|
+
this.onEnableRemoteImagesClick = (event) => {
|
|
228
|
+
var _a;
|
|
229
|
+
(_a = event === null || event === void 0 ? void 0 : event.stopPropagation) === null || _a === void 0 ? void 0 : _a.call(event);
|
|
230
|
+
this.enableRemoteImages();
|
|
231
|
+
};
|
|
232
|
+
this.enableRemoteImages = () => {
|
|
233
|
+
if (this.allowRemoteImages !== undefined) {
|
|
234
|
+
this.allowRemoteImagesChange.emit(true);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
this.allowRemoteImagesState = true;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
resetAllowRemoteImages(newEmail, oldEmail) {
|
|
241
|
+
if (!newEmail) {
|
|
242
|
+
this.allowRemoteImagesState = false;
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (newEmail.from !== (oldEmail === null || oldEmail === void 0 ? void 0 : oldEmail.from)) {
|
|
246
|
+
this.allowRemoteImagesState = false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
render() {
|
|
250
|
+
return (index.h(index.Host, { key: 'a004af12989a477f4a9404ee86e0429bc5c2d427' }, index.h("div", { key: 'fc3bdeb81d823ff1cd39b4f6d52b4a88d9326392', class: "email", part: "email" }, this.renderHeaders(), this.renderRemoteImageBanner(), index.h("section", { key: '6fdd1cfe50cc4b41f7e70413541dc5950d7c44fa' }, this.renderAttachments(), this.renderBody()))));
|
|
251
|
+
}
|
|
252
|
+
renderHeaders() {
|
|
253
|
+
const headerFields = [
|
|
254
|
+
'subject',
|
|
255
|
+
'from',
|
|
256
|
+
'to',
|
|
257
|
+
'cc',
|
|
258
|
+
'date',
|
|
259
|
+
];
|
|
260
|
+
return (index.h("div", { class: "email-headers", part: "email-headers" }, headerFields.map((type) => {
|
|
261
|
+
var _a;
|
|
262
|
+
return this.renderEmailHeader(type, this.getTranslation(`file-viewer.email.${type}`), (_a = this.email) === null || _a === void 0 ? void 0 : _a[type]);
|
|
263
|
+
})));
|
|
264
|
+
}
|
|
265
|
+
renderBody() {
|
|
266
|
+
return (this.renderBodyHtml() ||
|
|
267
|
+
this.renderBodyText() ||
|
|
268
|
+
this.renderFallbackUrl() || index.h("slot", { name: "fallback" }));
|
|
269
|
+
}
|
|
270
|
+
renderBodyHtml() {
|
|
271
|
+
var _a;
|
|
272
|
+
const bodyHtml = (_a = this.email) === null || _a === void 0 ? void 0 : _a.bodyHtml;
|
|
273
|
+
if (!bodyHtml) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const innerHtml = applyRemoteImagesPolicy(bodyHtml, this.getAllowRemoteImages());
|
|
277
|
+
return index.h("div", { class: "body", innerHTML: innerHtml, part: "email-body" });
|
|
278
|
+
}
|
|
279
|
+
renderBodyText() {
|
|
280
|
+
var _a;
|
|
281
|
+
const bodyText = (_a = this.email) === null || _a === void 0 ? void 0 : _a.bodyText;
|
|
282
|
+
if (!bodyText) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
return (index.h("pre", { class: "body plain-text", part: "email-body" }, bodyText));
|
|
286
|
+
}
|
|
287
|
+
renderFallbackUrl() {
|
|
288
|
+
if (!this.fallbackUrl) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
return (index.h("object", { data: this.fallbackUrl, type: "text/plain" }, index.h("slot", { name: "fallback" })));
|
|
292
|
+
}
|
|
293
|
+
renderEmailHeader(type, label, value) {
|
|
294
|
+
if (!value) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const values = this.getHeaderValues(type, value);
|
|
298
|
+
return (index.h("dl", { class: `headers ${type}` }, index.h("dt", null, label), values.map((headerValue, index$1) => (index.h("dd", { key: `${type}-${index$1}` }, headerValue)))));
|
|
299
|
+
}
|
|
300
|
+
getHeaderValues(type, value) {
|
|
301
|
+
if (type === 'to' || type === 'cc') {
|
|
302
|
+
return splitEmailAddressList(value);
|
|
303
|
+
}
|
|
304
|
+
return [value];
|
|
305
|
+
}
|
|
306
|
+
renderAttachments() {
|
|
307
|
+
var _a;
|
|
308
|
+
const attachments = (_a = this.email) === null || _a === void 0 ? void 0 : _a.attachments;
|
|
309
|
+
if (!(attachments === null || attachments === void 0 ? void 0 : attachments.length)) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const label = this.getTranslation('file-viewer.email.attachments');
|
|
313
|
+
return (index.h("div", { class: "attachments" }, index.h("span", null, label), index.h("ul", null, attachments.map((attachment, index) => this.renderAttachment(attachment, index)))));
|
|
314
|
+
}
|
|
315
|
+
getTranslation(key) {
|
|
316
|
+
return translations.translate.get(key, this.language);
|
|
317
|
+
}
|
|
318
|
+
shouldShowRemoteImagesBanner() {
|
|
319
|
+
var _a;
|
|
320
|
+
const bodyHtml = (_a = this.email) === null || _a === void 0 ? void 0 : _a.bodyHtml;
|
|
321
|
+
if (!bodyHtml || this.getAllowRemoteImages()) {
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
return containsRemoteImages(bodyHtml);
|
|
325
|
+
}
|
|
326
|
+
renderRemoteImageBanner() {
|
|
327
|
+
if (!this.shouldShowRemoteImagesBanner()) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const icon = {
|
|
331
|
+
name: 'warning_shield',
|
|
332
|
+
color: 'rgb(var(--color-orange-default))',
|
|
333
|
+
};
|
|
334
|
+
const heading = this.getTranslation('file-viewer.email.remote-images.warning');
|
|
335
|
+
const description = this.getTranslation('file-viewer.email.remote-images.warning.description');
|
|
336
|
+
const buttonLabel = this.getTranslation('file-viewer.email.remote-images.load');
|
|
337
|
+
return (index.h("limel-collapsible-section", { header: heading, icon: icon, language: this.language }, index.h("button", { type: "button", class: "load-images", slot: "header", onClick: this.onEnableRemoteImagesClick }, buttonLabel), index.h("limel-markdown", { value: description })));
|
|
338
|
+
}
|
|
339
|
+
getAllowRemoteImages() {
|
|
340
|
+
var _a;
|
|
341
|
+
return (_a = this.allowRemoteImages) !== null && _a !== void 0 ? _a : this.allowRemoteImagesState;
|
|
342
|
+
}
|
|
343
|
+
static get watchers() { return {
|
|
344
|
+
"email": [{
|
|
345
|
+
"resetAllowRemoteImages": 0
|
|
346
|
+
}]
|
|
347
|
+
}; }
|
|
348
|
+
};
|
|
349
|
+
EmailViewer.style = emailViewerCss();
|
|
350
|
+
|
|
351
|
+
exports.limel_email_viewer = EmailViewer;
|
|
@@ -229,7 +229,7 @@ const FileDropzone = class {
|
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
render() {
|
|
232
|
-
return (index.h(index.Host, { key: '
|
|
232
|
+
return (index.h(index.Host, { key: '4a002d8108fcb9d87b3f063171e0a531de31c1b1', onDrop: this.handleDrop, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave }, index.h("slot", { key: 'ed0aa907729aab6bee39bad7c6f9f74fc718e286' }), this.renderOnDragLayout()));
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
FileDropzone.style = fileDropzoneCss();
|
|
@@ -289,7 +289,7 @@ const FileInput = class {
|
|
|
289
289
|
this.fileInput = this.element.shadowRoot.getElementById(this.fileInputId);
|
|
290
290
|
}
|
|
291
291
|
render() {
|
|
292
|
-
return (index.h(index.Host, { key: '
|
|
292
|
+
return (index.h(index.Host, { key: '64b0de513357ed03fa7ae508ec6382acd600f392', onClick: this.handleClick, onKeyUp: this.handleKeyUp, onKeyDown: this.handleKeyDown }, index.h("input", { key: '0685cf5051c06e7e246631a38b349c2492dbb5b8', hidden: true, id: this.fileInputId, onChange: this.handleFileChange, type: "file", accept: this.accept, disabled: this.disabled, multiple: this.multiple }), index.h("slot", { key: 'da931d302eef5ed81663cce0b2d191166539a51d' })));
|
|
293
293
|
}
|
|
294
294
|
handleKeyDown(event) {
|
|
295
295
|
if (event.code === 'Tab' ||
|