@limetech/lime-elements 39.42.0 → 39.42.1
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 +7 -0
- package/dist/cjs/{image-resize-BWRGvgkM.js → image-resize-CG2fitJT.js} +56 -13
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-profile-picture.cjs.entry.js +11 -4
- package/dist/collection/components/profile-picture/profile-picture.js +11 -4
- package/dist/collection/util/image-resize.js +56 -13
- package/dist/esm/{image-resize-65ma7B85.js → image-resize-BTSG--2-.js} +56 -13
- package/dist/esm/index.js +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-profile-picture.entry.js +11 -4
- package/dist/lime-elements/index.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-8893e1df.entry.js +1 -0
- package/dist/lime-elements/{p-d7f75a6d.entry.js → p-8aeeeb53.entry.js} +1 -1
- package/dist/lime-elements/p-BTSG--2-.js +1 -0
- package/dist/types/components/profile-picture/profile-picture.d.ts +2 -0
- package/dist/types/components.d.ts +2 -2
- package/dist/types/util/image-resize.d.ts +29 -12
- package/package.json +1 -1
- package/dist/lime-elements/p-65ma7B85.js +0 -1
- package/dist/lime-elements/p-89f9bd6c.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [39.42.1](https://github.com/Lundalogik/lime-elements/compare/v39.42.0...v39.42.1) (2026-07-09)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **file:** remove baked-in defaults from the image-resize util ([7a5d29d](https://github.com/Lundalogik/lime-elements/commit/7a5d29d21a9a1ff4cf8e0946993cc7e2a4f22258))
|
|
7
|
+
|
|
1
8
|
## [39.42.0](https://github.com/Lundalogik/lime-elements/compare/v39.41.0...v39.42.0) (2026-07-08)
|
|
2
9
|
|
|
3
10
|
### Features
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Why resize client-side?
|
|
16
16
|
* - Faster perceived uploads and lower bandwidth usage
|
|
17
|
-
* - Consistent
|
|
17
|
+
* - Consistent output sizes and formats (e.g., a 400x400 thumbnail)
|
|
18
18
|
* - No server-side transformation required for common cases
|
|
19
19
|
*
|
|
20
20
|
* Fit strategies
|
|
21
|
-
* - `cover
|
|
22
|
-
*
|
|
21
|
+
* - `cover`: The image is scaled to cover the target rectangle, and the excess
|
|
22
|
+
* parts are center-cropped. Good for avatars.
|
|
23
23
|
* - `contain`: The image is scaled to fit entirely within the target rectangle
|
|
24
24
|
* without cropping, letterboxing if needed. Good when you must preserve the
|
|
25
25
|
* entire image.
|
|
26
|
+
* - omitted: scales the whole image to fit without cropping (no pixels are
|
|
27
|
+
* discarded).
|
|
26
28
|
*
|
|
27
29
|
* Decoding & EXIF orientation
|
|
28
30
|
* EXIF orientation is a piece of metadata stored inside image files
|
|
@@ -48,9 +50,11 @@
|
|
|
48
50
|
* library or WASM module; this utility intentionally avoids extra dependencies.
|
|
49
51
|
*
|
|
50
52
|
* Output type & quality
|
|
51
|
-
* -
|
|
52
|
-
*
|
|
53
|
-
*
|
|
53
|
+
* - When `type` is omitted the source format is kept if the canvas can encode
|
|
54
|
+
* it: a PNG stays a PNG (preserving transparency) and everything else is
|
|
55
|
+
* encoded as `image/jpeg`. Set `type` explicitly to force a format.
|
|
56
|
+
* - JPEG `quality` is optional; when omitted the browser's native encoding
|
|
57
|
+
* quality is used rather than an imposed value.
|
|
54
58
|
* - The output filename extension is adjusted to match the chosen MIME type by
|
|
55
59
|
* default (e.g., `.jpg` or `.png`). You can override naming via the `rename`
|
|
56
60
|
* option.
|
|
@@ -75,9 +79,9 @@
|
|
|
75
79
|
* const processed = await resizeImage(file, {
|
|
76
80
|
* width: 400,
|
|
77
81
|
* height: 400,
|
|
78
|
-
* fit: 'cover', //
|
|
79
|
-
* type: 'image/jpeg', //
|
|
80
|
-
* quality: 0.85, //
|
|
82
|
+
* fit: 'cover', // center-crops; omit to fit without cropping
|
|
83
|
+
* type: 'image/jpeg', // omit to keep the source format
|
|
84
|
+
* quality: 0.85, // omit to use the browser's native quality
|
|
81
85
|
* });
|
|
82
86
|
* // Upload `processed` instead of the original file
|
|
83
87
|
* ```
|
|
@@ -106,6 +110,17 @@
|
|
|
106
110
|
* ```
|
|
107
111
|
*/
|
|
108
112
|
// (Removed exported ResizeFit to avoid forcing a public symbol.)
|
|
113
|
+
/**
|
|
114
|
+
* The image formats the canvas can reliably encode, mapped to their filename
|
|
115
|
+
* extension. Single source of truth for what this util can output: both the
|
|
116
|
+
* output-type resolution and the output filename extension derive from it. The
|
|
117
|
+
* `ResizeOptions.type` union below mirrors these keys — keep the two in sync
|
|
118
|
+
* when adding a format.
|
|
119
|
+
*/
|
|
120
|
+
const ENCODABLE_TYPES = {
|
|
121
|
+
'image/jpeg': 'jpg',
|
|
122
|
+
'image/png': 'png',
|
|
123
|
+
};
|
|
109
124
|
/**
|
|
110
125
|
* Resize an image file on the client using Canvas/OffscreenCanvas.
|
|
111
126
|
* Returns a new File with the requested format and dimensions.
|
|
@@ -120,7 +135,17 @@
|
|
|
120
135
|
* @param options - Configuration for the resize operation.
|
|
121
136
|
*/
|
|
122
137
|
async function resizeImage(file, options) {
|
|
123
|
-
|
|
138
|
+
var _a;
|
|
139
|
+
// This shared utility carries no opinionated defaults: an omitted option
|
|
140
|
+
// preserves the source file's own property rather than imposing a value.
|
|
141
|
+
// Consumers that want a specific default (e.g. limel-profile-picture) apply
|
|
142
|
+
// it themselves. See the `ResizeOptions` doc for the per-option behavior.
|
|
143
|
+
const { fit, quality } = options;
|
|
144
|
+
// When no output type is requested, keep the source file's format if the
|
|
145
|
+
// canvas can encode it (PNG stays PNG, preserving transparency); anything
|
|
146
|
+
// else falls back to JPEG.
|
|
147
|
+
const type = resolveOutputType(file.type, options.type);
|
|
148
|
+
const rename = (_a = options.rename) !== null && _a !== void 0 ? _a : ((name) => renameWithType(name, type));
|
|
124
149
|
const source = await loadSource(file);
|
|
125
150
|
const sourceWidth = source.width;
|
|
126
151
|
const sourceHeight = source.height;
|
|
@@ -209,7 +234,7 @@ function get2dContext(canvas) {
|
|
|
209
234
|
* Convert the canvas content to a Blob, supporting both canvas types.
|
|
210
235
|
* @param canvas - The source canvas
|
|
211
236
|
* @param type - Output MIME type
|
|
212
|
-
* @param quality - JPEG quality (0..1)
|
|
237
|
+
* @param quality - JPEG quality (0..1); omit to use the browser default
|
|
213
238
|
*/
|
|
214
239
|
function canvasToBlob(canvas, type, quality) {
|
|
215
240
|
if ('convertToBlob' in canvas) {
|
|
@@ -295,7 +320,8 @@ async function loadImageElement(file) {
|
|
|
295
320
|
* @param sh - Source height
|
|
296
321
|
* @param tw - Target width
|
|
297
322
|
* @param th - Target height
|
|
298
|
-
* @param fit - Fit mode (
|
|
323
|
+
* @param fit - Fit mode; `cover` center-crops, anything else (including
|
|
324
|
+
* omitted) scales the whole image to fit without cropping
|
|
299
325
|
*/
|
|
300
326
|
function computeRects(sw, sh, tw, th, fit) {
|
|
301
327
|
const sRatio = sw / sh;
|
|
@@ -333,13 +359,30 @@ function computeRects(sw, sh, tw, th, fit) {
|
|
|
333
359
|
const dy = (th - drawH) / 2;
|
|
334
360
|
return { sx: 0, sy: 0, sw, sh, dx, dy, dw: drawW, dh: drawH };
|
|
335
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Resolve the output MIME type. An explicit request wins; otherwise the source
|
|
364
|
+
* file's format is kept when the canvas can encode it (see `ENCODABLE_TYPES`),
|
|
365
|
+
* so a PNG stays a PNG (preserving transparency) while every other input
|
|
366
|
+
* (WebP, HEIC, …) falls back to JPEG.
|
|
367
|
+
*
|
|
368
|
+
* @param sourceType - MIME type of the input file
|
|
369
|
+
* @param requested - Explicitly requested output type, if any
|
|
370
|
+
*/
|
|
371
|
+
function resolveOutputType(sourceType, requested) {
|
|
372
|
+
if (requested) {
|
|
373
|
+
return requested;
|
|
374
|
+
}
|
|
375
|
+
// Keep the source format when the canvas can encode it; otherwise JPEG.
|
|
376
|
+
const canEncodeSource = Object.prototype.hasOwnProperty.call(ENCODABLE_TYPES, sourceType);
|
|
377
|
+
return canEncodeSource ? sourceType : 'image/jpeg';
|
|
378
|
+
}
|
|
336
379
|
/**
|
|
337
380
|
* Update filename extension to match the desired MIME type.
|
|
338
381
|
* @param name - Original filename
|
|
339
382
|
* @param type - Output MIME type
|
|
340
383
|
*/
|
|
341
384
|
function renameWithType(name, type) {
|
|
342
|
-
const ext = type
|
|
385
|
+
const ext = ENCODABLE_TYPES[type];
|
|
343
386
|
const idx = name.lastIndexOf('.');
|
|
344
387
|
const base = idx > 0 ? name.slice(0, idx) : name;
|
|
345
388
|
return `${base}.${ext}`;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var config = require('./config-dit--4m5.js');
|
|
4
4
|
var layout = require('./layout-CL_D-afg.js');
|
|
5
5
|
var types = require('./types-C7gNcwzE.js');
|
|
6
|
-
var imageResize = require('./image-resize-
|
|
6
|
+
var imageResize = require('./image-resize-CG2fitJT.js');
|
|
7
7
|
var dispatchResizeEvent = require('./dispatch-resize-event-DH5CaB3p.js');
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -4,7 +4,7 @@ var index = require('./index-DYg_7kkT.js');
|
|
|
4
4
|
var translations = require('./translations-Bnw00bkf.js');
|
|
5
5
|
var fileMetadata = require('./file-metadata-BrhOssGG.js');
|
|
6
6
|
var formatBytes = require('./format-bytes-CpUKKU86.js');
|
|
7
|
-
var imageResize = require('./image-resize-
|
|
7
|
+
var imageResize = require('./image-resize-CG2fitJT.js');
|
|
8
8
|
require('./icons-isR5V1X0.js');
|
|
9
9
|
require('./get-icon-props-CwpDdQDI.js');
|
|
10
10
|
|
|
@@ -5,13 +5,20 @@ var files = require('./files-Bt11HLi4.js');
|
|
|
5
5
|
var getIconProps = require('./get-icon-props-CwpDdQDI.js');
|
|
6
6
|
var translations = require('./translations-Bnw00bkf.js');
|
|
7
7
|
var randomString = require('./random-string-BTzDB2ee.js');
|
|
8
|
-
var imageResize = require('./image-resize-
|
|
8
|
+
var imageResize = require('./image-resize-CG2fitJT.js');
|
|
9
9
|
var image_template = require('./image.template-DZC6_5a4.js');
|
|
10
10
|
require('./file-metadata-BrhOssGG.js');
|
|
11
11
|
require('./icons-isR5V1X0.js');
|
|
12
12
|
|
|
13
13
|
const profilePictureCss = () => `@charset "UTF-8";:host(limel-profile-picture){position:relative;display:inline-flex;min-width:1.5rem;min-height:1.5rem;border-radius:var(--profile-picture-border-radius, 100vw);background-color:rgb(var(--contrast-400))}*{box-sizing:border-box}limel-file-dropzone,limel-file-input,button.avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%}button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;display:block}button:focus{outline:none}button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.avatar{overflow:hidden;border-radius:var(--profile-picture-border-radius, 100vw)}:host(:not([disabled]):not([disabled=true])) button.avatar{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(--limel-theme-on-surface-color);background-color:transparent}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{will-change:color, background-color, box-shadow, transform}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover{box-shadow:var(--button-shadow-hovered)}:host(:not([disabled]):not([disabled=true])) button.avatar: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)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host([invalid]:not([invalid=false])) button.avatar{box-shadow:var(--shadow-error-state)}button.remove{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(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900))}button.remove:hover,button.remove:focus,button.remove:focus-visible{will-change:color, background-color, box-shadow, transform}button.remove:hover,button.remove:focus-visible{transform:translate3d(0, 0.01rem, 0);color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}button.remove:hover{box-shadow:var(--button-shadow-hovered)}button.remove: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)}button.remove:hover,button.remove:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.remove{cursor:pointer;height:1.25rem;width:1.25rem;border-radius:50%;background-repeat:no-repeat;background-position:center;background-size:0.75rem;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cdefs/%3E%3Cpath%20fill='rgb(255,255,255)'%20d='M7.219%205.781L5.78%207.22%2014.563%2016%205.78%2024.781%207.22%2026.22%2016%2017.437l8.781%208.782%201.438-1.438L17.437%2016l8.782-8.781L24.78%205.78%2016%2014.563z'/%3E%3C/svg%3E");position:absolute;top:0;left:0;opacity:0}:host(:hover) button.remove,:host(:focus) button.remove,:host(:focus-visible) button.remove,:host(:focus-within) button.remove,:host(:active) button.remove{animation:show 0.4s ease-in-out forwards}@keyframes show{0%{transform:scale(0.9);opacity:0}100%{transform:scale(1);opacity:1}}button.avatar,img,limel-icon{border-radius:var(--profile-picture-border-radius, 100vw)}limel-icon{width:calc(100% - 1rem);min-width:1rem;max-width:4rem;color:var(--limel-theme-text-secondary-on-background-color);margin:auto}img{object-fit:var(--limel-profile-picture-object-fit);width:100%;height:100%}:host(.has-image-error) img{border:1px dashed rgb(var(--contrast-600));background:url("data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>");background-size:0.5rem}limel-spinner{position:absolute;inset:0;margin:auto}limel-popover{position:absolute;inset:auto 0 0 auto;display:block;width:2.25rem;height:2.25rem}`;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Avatar output defaults. These live in the component rather than in the shared
|
|
17
|
+
* `resizeImage` util (which is deliberately unopinionated): avatars are stored
|
|
18
|
+
* as a compact JPEG at a fixed quality. Callers can override them via `resize`.
|
|
19
|
+
*/
|
|
20
|
+
const AVATAR_OUTPUT_TYPE = 'image/jpeg';
|
|
21
|
+
const AVATAR_JPEG_QUALITY = 0.85;
|
|
15
22
|
const ProfilePicture = class {
|
|
16
23
|
constructor(hostRef) {
|
|
17
24
|
index.registerInstance(this, hostRef);
|
|
@@ -70,7 +77,7 @@ const ProfilePicture = class {
|
|
|
70
77
|
return (index.h("limel-tooltip", { elementId: this.browseButtonId, label: this.helperText }));
|
|
71
78
|
};
|
|
72
79
|
this.handleNewFiles = async (event) => {
|
|
73
|
-
var _a, _b;
|
|
80
|
+
var _a, _b, _c, _d;
|
|
74
81
|
event.stopPropagation();
|
|
75
82
|
if (this.disabled) {
|
|
76
83
|
return;
|
|
@@ -89,10 +96,10 @@ const ProfilePicture = class {
|
|
|
89
96
|
// Optional client-side resize
|
|
90
97
|
if (this.resize && file.fileContent instanceof File) {
|
|
91
98
|
try {
|
|
92
|
-
const processed = await imageResize.resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit }));
|
|
99
|
+
const processed = await imageResize.resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit, type: (_c = this.resize.type) !== null && _c !== void 0 ? _c : AVATAR_OUTPUT_TYPE, quality: (_d = this.resize.quality) !== null && _d !== void 0 ? _d : AVATAR_JPEG_QUALITY }));
|
|
93
100
|
out = Object.assign(Object.assign({}, file), { filename: processed.name, size: processed.size, contentType: processed.type, fileContent: processed });
|
|
94
101
|
}
|
|
95
|
-
catch (
|
|
102
|
+
catch (_e) {
|
|
96
103
|
// Fall back to original file if resize fails
|
|
97
104
|
out = file;
|
|
98
105
|
}
|
|
@@ -5,6 +5,13 @@ import translate from "../../global/translations";
|
|
|
5
5
|
import { createRandomString } from "../../util/random-string";
|
|
6
6
|
import { resizeImage } from "../../util/image-resize";
|
|
7
7
|
import { ImageTemplate } from "../../util/image.template";
|
|
8
|
+
/**
|
|
9
|
+
* Avatar output defaults. These live in the component rather than in the shared
|
|
10
|
+
* `resizeImage` util (which is deliberately unopinionated): avatars are stored
|
|
11
|
+
* as a compact JPEG at a fixed quality. Callers can override them via `resize`.
|
|
12
|
+
*/
|
|
13
|
+
const AVATAR_OUTPUT_TYPE = 'image/jpeg';
|
|
14
|
+
const AVATAR_JPEG_QUALITY = 0.85;
|
|
8
15
|
/**
|
|
9
16
|
* This component displays a profile picture, while allowing the user
|
|
10
17
|
* to change it via a file input or drag-and-drop.
|
|
@@ -80,7 +87,7 @@ export class ProfilePicture {
|
|
|
80
87
|
return (h("limel-tooltip", { elementId: this.browseButtonId, label: this.helperText }));
|
|
81
88
|
};
|
|
82
89
|
this.handleNewFiles = async (event) => {
|
|
83
|
-
var _a, _b;
|
|
90
|
+
var _a, _b, _c, _d;
|
|
84
91
|
event.stopPropagation();
|
|
85
92
|
if (this.disabled) {
|
|
86
93
|
return;
|
|
@@ -99,10 +106,10 @@ export class ProfilePicture {
|
|
|
99
106
|
// Optional client-side resize
|
|
100
107
|
if (this.resize && file.fileContent instanceof File) {
|
|
101
108
|
try {
|
|
102
|
-
const processed = await resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit }));
|
|
109
|
+
const processed = await resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit, type: (_c = this.resize.type) !== null && _c !== void 0 ? _c : AVATAR_OUTPUT_TYPE, quality: (_d = this.resize.quality) !== null && _d !== void 0 ? _d : AVATAR_JPEG_QUALITY }));
|
|
103
110
|
out = Object.assign(Object.assign({}, file), { filename: processed.name, size: processed.size, contentType: processed.type, fileContent: processed });
|
|
104
111
|
}
|
|
105
|
-
catch (
|
|
112
|
+
catch (_e) {
|
|
106
113
|
// Fall back to original file if resize fails
|
|
107
114
|
out = file;
|
|
108
115
|
}
|
|
@@ -556,7 +563,7 @@ export class ProfilePicture {
|
|
|
556
563
|
"optional": true,
|
|
557
564
|
"docs": {
|
|
558
565
|
"tags": [],
|
|
559
|
-
"text": "Optional client-side resize before emitting the file.\nIf provided, the selected image will be resized on the client device.\n:::note\nHEIC may not decode in all browsers; when decoding fails, the original\nfile will be emitted. See the examples for more info.\n:::"
|
|
566
|
+
"text": "Optional client-side resize before emitting the file.\nIf provided, the selected image will be resized on the client device.\nOmitted options fall back to avatar defaults: `image/jpeg`, `quality`\n`0.85`, and the component's `imageFit`.\n:::note\nHEIC may not decode in all browsers; when decoding fails, the original\nfile will be emitted. See the examples for more info.\n:::"
|
|
560
567
|
},
|
|
561
568
|
"getter": false,
|
|
562
569
|
"setter": false
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Why resize client-side?
|
|
14
14
|
* - Faster perceived uploads and lower bandwidth usage
|
|
15
|
-
* - Consistent
|
|
15
|
+
* - Consistent output sizes and formats (e.g., a 400x400 thumbnail)
|
|
16
16
|
* - No server-side transformation required for common cases
|
|
17
17
|
*
|
|
18
18
|
* Fit strategies
|
|
19
|
-
* - `cover
|
|
20
|
-
*
|
|
19
|
+
* - `cover`: The image is scaled to cover the target rectangle, and the excess
|
|
20
|
+
* parts are center-cropped. Good for avatars.
|
|
21
21
|
* - `contain`: The image is scaled to fit entirely within the target rectangle
|
|
22
22
|
* without cropping, letterboxing if needed. Good when you must preserve the
|
|
23
23
|
* entire image.
|
|
24
|
+
* - omitted: scales the whole image to fit without cropping (no pixels are
|
|
25
|
+
* discarded).
|
|
24
26
|
*
|
|
25
27
|
* Decoding & EXIF orientation
|
|
26
28
|
* EXIF orientation is a piece of metadata stored inside image files
|
|
@@ -46,9 +48,11 @@
|
|
|
46
48
|
* library or WASM module; this utility intentionally avoids extra dependencies.
|
|
47
49
|
*
|
|
48
50
|
* Output type & quality
|
|
49
|
-
* -
|
|
50
|
-
*
|
|
51
|
-
*
|
|
51
|
+
* - When `type` is omitted the source format is kept if the canvas can encode
|
|
52
|
+
* it: a PNG stays a PNG (preserving transparency) and everything else is
|
|
53
|
+
* encoded as `image/jpeg`. Set `type` explicitly to force a format.
|
|
54
|
+
* - JPEG `quality` is optional; when omitted the browser's native encoding
|
|
55
|
+
* quality is used rather than an imposed value.
|
|
52
56
|
* - The output filename extension is adjusted to match the chosen MIME type by
|
|
53
57
|
* default (e.g., `.jpg` or `.png`). You can override naming via the `rename`
|
|
54
58
|
* option.
|
|
@@ -73,9 +77,9 @@
|
|
|
73
77
|
* const processed = await resizeImage(file, {
|
|
74
78
|
* width: 400,
|
|
75
79
|
* height: 400,
|
|
76
|
-
* fit: 'cover', //
|
|
77
|
-
* type: 'image/jpeg', //
|
|
78
|
-
* quality: 0.85, //
|
|
80
|
+
* fit: 'cover', // center-crops; omit to fit without cropping
|
|
81
|
+
* type: 'image/jpeg', // omit to keep the source format
|
|
82
|
+
* quality: 0.85, // omit to use the browser's native quality
|
|
79
83
|
* });
|
|
80
84
|
* // Upload `processed` instead of the original file
|
|
81
85
|
* ```
|
|
@@ -104,6 +108,17 @@
|
|
|
104
108
|
* ```
|
|
105
109
|
*/
|
|
106
110
|
// (Removed exported ResizeFit to avoid forcing a public symbol.)
|
|
111
|
+
/**
|
|
112
|
+
* The image formats the canvas can reliably encode, mapped to their filename
|
|
113
|
+
* extension. Single source of truth for what this util can output: both the
|
|
114
|
+
* output-type resolution and the output filename extension derive from it. The
|
|
115
|
+
* `ResizeOptions.type` union below mirrors these keys — keep the two in sync
|
|
116
|
+
* when adding a format.
|
|
117
|
+
*/
|
|
118
|
+
const ENCODABLE_TYPES = {
|
|
119
|
+
'image/jpeg': 'jpg',
|
|
120
|
+
'image/png': 'png',
|
|
121
|
+
};
|
|
107
122
|
/**
|
|
108
123
|
* Resize an image file on the client using Canvas/OffscreenCanvas.
|
|
109
124
|
* Returns a new File with the requested format and dimensions.
|
|
@@ -118,7 +133,17 @@
|
|
|
118
133
|
* @param options - Configuration for the resize operation.
|
|
119
134
|
*/
|
|
120
135
|
export async function resizeImage(file, options) {
|
|
121
|
-
|
|
136
|
+
var _a;
|
|
137
|
+
// This shared utility carries no opinionated defaults: an omitted option
|
|
138
|
+
// preserves the source file's own property rather than imposing a value.
|
|
139
|
+
// Consumers that want a specific default (e.g. limel-profile-picture) apply
|
|
140
|
+
// it themselves. See the `ResizeOptions` doc for the per-option behavior.
|
|
141
|
+
const { fit, quality } = options;
|
|
142
|
+
// When no output type is requested, keep the source file's format if the
|
|
143
|
+
// canvas can encode it (PNG stays PNG, preserving transparency); anything
|
|
144
|
+
// else falls back to JPEG.
|
|
145
|
+
const type = resolveOutputType(file.type, options.type);
|
|
146
|
+
const rename = (_a = options.rename) !== null && _a !== void 0 ? _a : ((name) => renameWithType(name, type));
|
|
122
147
|
const source = await loadSource(file);
|
|
123
148
|
const sourceWidth = source.width;
|
|
124
149
|
const sourceHeight = source.height;
|
|
@@ -207,7 +232,7 @@ function get2dContext(canvas) {
|
|
|
207
232
|
* Convert the canvas content to a Blob, supporting both canvas types.
|
|
208
233
|
* @param canvas - The source canvas
|
|
209
234
|
* @param type - Output MIME type
|
|
210
|
-
* @param quality - JPEG quality (0..1)
|
|
235
|
+
* @param quality - JPEG quality (0..1); omit to use the browser default
|
|
211
236
|
*/
|
|
212
237
|
function canvasToBlob(canvas, type, quality) {
|
|
213
238
|
if ('convertToBlob' in canvas) {
|
|
@@ -293,7 +318,8 @@ async function loadImageElement(file) {
|
|
|
293
318
|
* @param sh - Source height
|
|
294
319
|
* @param tw - Target width
|
|
295
320
|
* @param th - Target height
|
|
296
|
-
* @param fit - Fit mode (
|
|
321
|
+
* @param fit - Fit mode; `cover` center-crops, anything else (including
|
|
322
|
+
* omitted) scales the whole image to fit without cropping
|
|
297
323
|
*/
|
|
298
324
|
function computeRects(sw, sh, tw, th, fit) {
|
|
299
325
|
const sRatio = sw / sh;
|
|
@@ -331,13 +357,30 @@ function computeRects(sw, sh, tw, th, fit) {
|
|
|
331
357
|
const dy = (th - drawH) / 2;
|
|
332
358
|
return { sx: 0, sy: 0, sw, sh, dx, dy, dw: drawW, dh: drawH };
|
|
333
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Resolve the output MIME type. An explicit request wins; otherwise the source
|
|
362
|
+
* file's format is kept when the canvas can encode it (see `ENCODABLE_TYPES`),
|
|
363
|
+
* so a PNG stays a PNG (preserving transparency) while every other input
|
|
364
|
+
* (WebP, HEIC, …) falls back to JPEG.
|
|
365
|
+
*
|
|
366
|
+
* @param sourceType - MIME type of the input file
|
|
367
|
+
* @param requested - Explicitly requested output type, if any
|
|
368
|
+
*/
|
|
369
|
+
function resolveOutputType(sourceType, requested) {
|
|
370
|
+
if (requested) {
|
|
371
|
+
return requested;
|
|
372
|
+
}
|
|
373
|
+
// Keep the source format when the canvas can encode it; otherwise JPEG.
|
|
374
|
+
const canEncodeSource = Object.prototype.hasOwnProperty.call(ENCODABLE_TYPES, sourceType);
|
|
375
|
+
return canEncodeSource ? sourceType : 'image/jpeg';
|
|
376
|
+
}
|
|
334
377
|
/**
|
|
335
378
|
* Update filename extension to match the desired MIME type.
|
|
336
379
|
* @param name - Original filename
|
|
337
380
|
* @param type - Output MIME type
|
|
338
381
|
*/
|
|
339
382
|
function renameWithType(name, type) {
|
|
340
|
-
const ext = type
|
|
383
|
+
const ext = ENCODABLE_TYPES[type];
|
|
341
384
|
const idx = name.lastIndexOf('.');
|
|
342
385
|
const base = idx > 0 ? name.slice(0, idx) : name;
|
|
343
386
|
return `${base}.${ext}`;
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Why resize client-side?
|
|
14
14
|
* - Faster perceived uploads and lower bandwidth usage
|
|
15
|
-
* - Consistent
|
|
15
|
+
* - Consistent output sizes and formats (e.g., a 400x400 thumbnail)
|
|
16
16
|
* - No server-side transformation required for common cases
|
|
17
17
|
*
|
|
18
18
|
* Fit strategies
|
|
19
|
-
* - `cover
|
|
20
|
-
*
|
|
19
|
+
* - `cover`: The image is scaled to cover the target rectangle, and the excess
|
|
20
|
+
* parts are center-cropped. Good for avatars.
|
|
21
21
|
* - `contain`: The image is scaled to fit entirely within the target rectangle
|
|
22
22
|
* without cropping, letterboxing if needed. Good when you must preserve the
|
|
23
23
|
* entire image.
|
|
24
|
+
* - omitted: scales the whole image to fit without cropping (no pixels are
|
|
25
|
+
* discarded).
|
|
24
26
|
*
|
|
25
27
|
* Decoding & EXIF orientation
|
|
26
28
|
* EXIF orientation is a piece of metadata stored inside image files
|
|
@@ -46,9 +48,11 @@
|
|
|
46
48
|
* library or WASM module; this utility intentionally avoids extra dependencies.
|
|
47
49
|
*
|
|
48
50
|
* Output type & quality
|
|
49
|
-
* -
|
|
50
|
-
*
|
|
51
|
-
*
|
|
51
|
+
* - When `type` is omitted the source format is kept if the canvas can encode
|
|
52
|
+
* it: a PNG stays a PNG (preserving transparency) and everything else is
|
|
53
|
+
* encoded as `image/jpeg`. Set `type` explicitly to force a format.
|
|
54
|
+
* - JPEG `quality` is optional; when omitted the browser's native encoding
|
|
55
|
+
* quality is used rather than an imposed value.
|
|
52
56
|
* - The output filename extension is adjusted to match the chosen MIME type by
|
|
53
57
|
* default (e.g., `.jpg` or `.png`). You can override naming via the `rename`
|
|
54
58
|
* option.
|
|
@@ -73,9 +77,9 @@
|
|
|
73
77
|
* const processed = await resizeImage(file, {
|
|
74
78
|
* width: 400,
|
|
75
79
|
* height: 400,
|
|
76
|
-
* fit: 'cover', //
|
|
77
|
-
* type: 'image/jpeg', //
|
|
78
|
-
* quality: 0.85, //
|
|
80
|
+
* fit: 'cover', // center-crops; omit to fit without cropping
|
|
81
|
+
* type: 'image/jpeg', // omit to keep the source format
|
|
82
|
+
* quality: 0.85, // omit to use the browser's native quality
|
|
79
83
|
* });
|
|
80
84
|
* // Upload `processed` instead of the original file
|
|
81
85
|
* ```
|
|
@@ -104,6 +108,17 @@
|
|
|
104
108
|
* ```
|
|
105
109
|
*/
|
|
106
110
|
// (Removed exported ResizeFit to avoid forcing a public symbol.)
|
|
111
|
+
/**
|
|
112
|
+
* The image formats the canvas can reliably encode, mapped to their filename
|
|
113
|
+
* extension. Single source of truth for what this util can output: both the
|
|
114
|
+
* output-type resolution and the output filename extension derive from it. The
|
|
115
|
+
* `ResizeOptions.type` union below mirrors these keys — keep the two in sync
|
|
116
|
+
* when adding a format.
|
|
117
|
+
*/
|
|
118
|
+
const ENCODABLE_TYPES = {
|
|
119
|
+
'image/jpeg': 'jpg',
|
|
120
|
+
'image/png': 'png',
|
|
121
|
+
};
|
|
107
122
|
/**
|
|
108
123
|
* Resize an image file on the client using Canvas/OffscreenCanvas.
|
|
109
124
|
* Returns a new File with the requested format and dimensions.
|
|
@@ -118,7 +133,17 @@
|
|
|
118
133
|
* @param options - Configuration for the resize operation.
|
|
119
134
|
*/
|
|
120
135
|
async function resizeImage(file, options) {
|
|
121
|
-
|
|
136
|
+
var _a;
|
|
137
|
+
// This shared utility carries no opinionated defaults: an omitted option
|
|
138
|
+
// preserves the source file's own property rather than imposing a value.
|
|
139
|
+
// Consumers that want a specific default (e.g. limel-profile-picture) apply
|
|
140
|
+
// it themselves. See the `ResizeOptions` doc for the per-option behavior.
|
|
141
|
+
const { fit, quality } = options;
|
|
142
|
+
// When no output type is requested, keep the source file's format if the
|
|
143
|
+
// canvas can encode it (PNG stays PNG, preserving transparency); anything
|
|
144
|
+
// else falls back to JPEG.
|
|
145
|
+
const type = resolveOutputType(file.type, options.type);
|
|
146
|
+
const rename = (_a = options.rename) !== null && _a !== void 0 ? _a : ((name) => renameWithType(name, type));
|
|
122
147
|
const source = await loadSource(file);
|
|
123
148
|
const sourceWidth = source.width;
|
|
124
149
|
const sourceHeight = source.height;
|
|
@@ -207,7 +232,7 @@ function get2dContext(canvas) {
|
|
|
207
232
|
* Convert the canvas content to a Blob, supporting both canvas types.
|
|
208
233
|
* @param canvas - The source canvas
|
|
209
234
|
* @param type - Output MIME type
|
|
210
|
-
* @param quality - JPEG quality (0..1)
|
|
235
|
+
* @param quality - JPEG quality (0..1); omit to use the browser default
|
|
211
236
|
*/
|
|
212
237
|
function canvasToBlob(canvas, type, quality) {
|
|
213
238
|
if ('convertToBlob' in canvas) {
|
|
@@ -293,7 +318,8 @@ async function loadImageElement(file) {
|
|
|
293
318
|
* @param sh - Source height
|
|
294
319
|
* @param tw - Target width
|
|
295
320
|
* @param th - Target height
|
|
296
|
-
* @param fit - Fit mode (
|
|
321
|
+
* @param fit - Fit mode; `cover` center-crops, anything else (including
|
|
322
|
+
* omitted) scales the whole image to fit without cropping
|
|
297
323
|
*/
|
|
298
324
|
function computeRects(sw, sh, tw, th, fit) {
|
|
299
325
|
const sRatio = sw / sh;
|
|
@@ -331,13 +357,30 @@ function computeRects(sw, sh, tw, th, fit) {
|
|
|
331
357
|
const dy = (th - drawH) / 2;
|
|
332
358
|
return { sx: 0, sy: 0, sw, sh, dx, dy, dw: drawW, dh: drawH };
|
|
333
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Resolve the output MIME type. An explicit request wins; otherwise the source
|
|
362
|
+
* file's format is kept when the canvas can encode it (see `ENCODABLE_TYPES`),
|
|
363
|
+
* so a PNG stays a PNG (preserving transparency) while every other input
|
|
364
|
+
* (WebP, HEIC, …) falls back to JPEG.
|
|
365
|
+
*
|
|
366
|
+
* @param sourceType - MIME type of the input file
|
|
367
|
+
* @param requested - Explicitly requested output type, if any
|
|
368
|
+
*/
|
|
369
|
+
function resolveOutputType(sourceType, requested) {
|
|
370
|
+
if (requested) {
|
|
371
|
+
return requested;
|
|
372
|
+
}
|
|
373
|
+
// Keep the source format when the canvas can encode it; otherwise JPEG.
|
|
374
|
+
const canEncodeSource = Object.prototype.hasOwnProperty.call(ENCODABLE_TYPES, sourceType);
|
|
375
|
+
return canEncodeSource ? sourceType : 'image/jpeg';
|
|
376
|
+
}
|
|
334
377
|
/**
|
|
335
378
|
* Update filename extension to match the desired MIME type.
|
|
336
379
|
* @param name - Original filename
|
|
337
380
|
* @param type - Output MIME type
|
|
338
381
|
*/
|
|
339
382
|
function renameWithType(name, type) {
|
|
340
|
-
const ext = type
|
|
383
|
+
const ext = ENCODABLE_TYPES[type];
|
|
341
384
|
const idx = name.lastIndexOf('.');
|
|
342
385
|
const base = idx > 0 ? name.slice(0, idx) : name;
|
|
343
386
|
return `${base}.${ext}`;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { g as globalConfig } from './config-Dnt5w_Bp.js';
|
|
2
2
|
export { _ as _mapLayout } from './layout-C4zsCPOF.js';
|
|
3
3
|
export { E as EditorMenuTypes, L as LevelMapping, M as MouseButtons, e as editorMenuTypesArray, i as isInlineImageTag } from './types-C_Yu8dOg.js';
|
|
4
|
-
export { r as resizeImage } from './image-resize-
|
|
4
|
+
export { r as resizeImage } from './image-resize-BTSG--2-.js';
|
|
5
5
|
export { r as redrawComponents } from './dispatch-resize-event-z_E3sq3p.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host } from './index-B
|
|
|
2
2
|
import { t as translate } from './translations-Cb9R_zmF.js';
|
|
3
3
|
import { g as getFileBackgroundColor, a as getFileColor, b as getFileExtensionTitle, c as getFileIcon } from './file-metadata-BHzkIH4g.js';
|
|
4
4
|
import { f as formatBytes } from './format-bytes-u_sd2HMb.js';
|
|
5
|
-
import { r as resizeImage } from './image-resize-
|
|
5
|
+
import { r as resizeImage } from './image-resize-BTSG--2-.js';
|
|
6
6
|
import './icons-Bu_YRgCL.js';
|
|
7
7
|
import './get-icon-props-CgNJbSP4.js';
|
|
8
8
|
|
|
@@ -3,13 +3,20 @@ import { i as isTypeAccepted } from './files-CZAZotms.js';
|
|
|
3
3
|
import { g as getIconName } from './get-icon-props-CgNJbSP4.js';
|
|
4
4
|
import { t as translate } from './translations-Cb9R_zmF.js';
|
|
5
5
|
import { c as createRandomString } from './random-string-JbKhhoXs.js';
|
|
6
|
-
import { r as resizeImage } from './image-resize-
|
|
6
|
+
import { r as resizeImage } from './image-resize-BTSG--2-.js';
|
|
7
7
|
import { I as ImageTemplate } from './image.template-BXDvrqGw.js';
|
|
8
8
|
import './file-metadata-BHzkIH4g.js';
|
|
9
9
|
import './icons-Bu_YRgCL.js';
|
|
10
10
|
|
|
11
11
|
const profilePictureCss = () => `@charset "UTF-8";:host(limel-profile-picture){position:relative;display:inline-flex;min-width:1.5rem;min-height:1.5rem;border-radius:var(--profile-picture-border-radius, 100vw);background-color:rgb(var(--contrast-400))}*{box-sizing:border-box}limel-file-dropzone,limel-file-input,button.avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%}button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;display:block}button:focus{outline:none}button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.avatar{overflow:hidden;border-radius:var(--profile-picture-border-radius, 100vw)}:host(:not([disabled]):not([disabled=true])) button.avatar{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(--limel-theme-on-surface-color);background-color:transparent}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{will-change:color, background-color, box-shadow, transform}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover{box-shadow:var(--button-shadow-hovered)}:host(:not([disabled]):not([disabled=true])) button.avatar: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)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host([invalid]:not([invalid=false])) button.avatar{box-shadow:var(--shadow-error-state)}button.remove{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(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900))}button.remove:hover,button.remove:focus,button.remove:focus-visible{will-change:color, background-color, box-shadow, transform}button.remove:hover,button.remove:focus-visible{transform:translate3d(0, 0.01rem, 0);color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}button.remove:hover{box-shadow:var(--button-shadow-hovered)}button.remove: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)}button.remove:hover,button.remove:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.remove{cursor:pointer;height:1.25rem;width:1.25rem;border-radius:50%;background-repeat:no-repeat;background-position:center;background-size:0.75rem;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cdefs/%3E%3Cpath%20fill='rgb(255,255,255)'%20d='M7.219%205.781L5.78%207.22%2014.563%2016%205.78%2024.781%207.22%2026.22%2016%2017.437l8.781%208.782%201.438-1.438L17.437%2016l8.782-8.781L24.78%205.78%2016%2014.563z'/%3E%3C/svg%3E");position:absolute;top:0;left:0;opacity:0}:host(:hover) button.remove,:host(:focus) button.remove,:host(:focus-visible) button.remove,:host(:focus-within) button.remove,:host(:active) button.remove{animation:show 0.4s ease-in-out forwards}@keyframes show{0%{transform:scale(0.9);opacity:0}100%{transform:scale(1);opacity:1}}button.avatar,img,limel-icon{border-radius:var(--profile-picture-border-radius, 100vw)}limel-icon{width:calc(100% - 1rem);min-width:1rem;max-width:4rem;color:var(--limel-theme-text-secondary-on-background-color);margin:auto}img{object-fit:var(--limel-profile-picture-object-fit);width:100%;height:100%}:host(.has-image-error) img{border:1px dashed rgb(var(--contrast-600));background:url("data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>");background-size:0.5rem}limel-spinner{position:absolute;inset:0;margin:auto}limel-popover{position:absolute;inset:auto 0 0 auto;display:block;width:2.25rem;height:2.25rem}`;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Avatar output defaults. These live in the component rather than in the shared
|
|
15
|
+
* `resizeImage` util (which is deliberately unopinionated): avatars are stored
|
|
16
|
+
* as a compact JPEG at a fixed quality. Callers can override them via `resize`.
|
|
17
|
+
*/
|
|
18
|
+
const AVATAR_OUTPUT_TYPE = 'image/jpeg';
|
|
19
|
+
const AVATAR_JPEG_QUALITY = 0.85;
|
|
13
20
|
const ProfilePicture = class {
|
|
14
21
|
constructor(hostRef) {
|
|
15
22
|
registerInstance(this, hostRef);
|
|
@@ -68,7 +75,7 @@ const ProfilePicture = class {
|
|
|
68
75
|
return (h("limel-tooltip", { elementId: this.browseButtonId, label: this.helperText }));
|
|
69
76
|
};
|
|
70
77
|
this.handleNewFiles = async (event) => {
|
|
71
|
-
var _a, _b;
|
|
78
|
+
var _a, _b, _c, _d;
|
|
72
79
|
event.stopPropagation();
|
|
73
80
|
if (this.disabled) {
|
|
74
81
|
return;
|
|
@@ -87,10 +94,10 @@ const ProfilePicture = class {
|
|
|
87
94
|
// Optional client-side resize
|
|
88
95
|
if (this.resize && file.fileContent instanceof File) {
|
|
89
96
|
try {
|
|
90
|
-
const processed = await resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit }));
|
|
97
|
+
const processed = await resizeImage(file.fileContent, Object.assign(Object.assign({}, this.resize), { fit: (_b = this.resize.fit) !== null && _b !== void 0 ? _b : this.imageFit, type: (_c = this.resize.type) !== null && _c !== void 0 ? _c : AVATAR_OUTPUT_TYPE, quality: (_d = this.resize.quality) !== null && _d !== void 0 ? _d : AVATAR_JPEG_QUALITY }));
|
|
91
98
|
out = Object.assign(Object.assign({}, file), { filename: processed.name, size: processed.size, contentType: processed.type, fileContent: processed });
|
|
92
99
|
}
|
|
93
|
-
catch (
|
|
100
|
+
catch (_e) {
|
|
94
101
|
// Fall back to original file if resize fails
|
|
95
102
|
out = file;
|
|
96
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as globalConfig}from"./p-Dnt5w_Bp.js";export{_ as _mapLayout}from"./p-C4zsCPOF.js";export{E as EditorMenuTypes,L as LevelMapping,M as MouseButtons,e as editorMenuTypesArray,i as isInlineImageTag}from"./p-C_Yu8dOg.js";export{r as resizeImage}from"./p-
|
|
1
|
+
export{g as globalConfig}from"./p-Dnt5w_Bp.js";export{_ as _mapLayout}from"./p-C4zsCPOF.js";export{E as EditorMenuTypes,L as LevelMapping,M as MouseButtons,e as editorMenuTypesArray,i as isInlineImageTag}from"./p-C_Yu8dOg.js";export{r as resizeImage}from"./p-BTSG--2-.js";export{r as redrawComponents}from"./p-z_E3sq3p.js";var o,s;!function(o){o.Default="default",o.Grid="grid",o.Row="row"}(o||(o={})),function(o){o.Average="avg",o.Maximum="max",o.Minimum="min",o.Sum="sum",o.Count="count"}(s||(s={}));export{s as ColumnAggregatorType,o as FormLayoutType}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,g as l,b as a}from"./p-BGxJfR2f.js";export{s as setNonce}from"./p-BGxJfR2f.js";(()=>{const l=import.meta.url,a={};return""!==l&&(a.resourcesUrl=new URL(".",l).href),e(a)})().then((async e=>(await l(),a(JSON.parse('[["p-d19ab443",[[1,"limel-icon",{"size":[513],"name":[513],"badge":[516],"svgClass":[513,"svg-class"]},null,{"name":[{"loadIcon":0}],"svgClass":[{"applySvgClass":0}]}]]],["p-1f35fc44",[[17,"limel-text-editor",{"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"value":[513],"customElements":[16],"inlineImages":[16],"triggers":[16],"required":[516],"allowResize":[516,"allow-resize"],"ui":[513],"flushPendingChanges":[64],"clear":[64]}]]],["p-552d0733",[[1,"limel-file-viewer",{"url":[513],"filename":[513],"alt":[513],"allowFullscreen":[516,"allow-fullscreen"],"allowOpenInNewTab":[516,"allow-open-in-new-tab"],"allowDownload":[516,"allow-download"],"language":[1],"officeViewer":[513,"office-viewer"],"actions":[16],"isFullscreen":[32],"fileType":[32],"loading":[32],"fileUrl":[32],"email":[32]},null,{"url":[{"watchUrl":0}]}]]],["p-7df111bb",[[257,"limel-card",{"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"actions":[16],"clickable":[516],"orientation":[513],"selected":[516],"show3dEffect":[516,"show-3d-effect"],"canScrollUp":[32],"canScrollDown":[32]}]]],["p-d7f75a6d",[[1,"limel-file",{"value":[16],"label":[513],"helperText":[513,"helper-text"],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"loading":[516],"accept":[513],"resizeImage":[16],"language":[1],"resizingFile":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ca0b86ee",[[1,"limel-code-diff",{"oldValue":[1,"old-value"],"newValue":[1,"new-value"],"oldHeading":[513,"old-heading"],"newHeading":[513,"new-heading"],"layout":[513],"contextLines":[514,"context-lines"],"lineWrapping":[516,"line-wrapping"],"language":[513],"reformatJson":[516,"reformat-json"],"translationLanguage":[513,"translation-language"],"diffResult":[32],"liveAnnouncement":[32],"copyState":[32],"searchVisible":[32],"searchTerm":[32],"currentMatchIndex":[32]},null,{"oldValue":[{"watchInputs":0}],"newValue":[{"watchInputs":0}],"contextLines":[{"watchInputs":0}],"reformatJson":[{"watchInputs":0}],"layout":[{"watchInputs":0}]}]]],["p-2f223e46",[[0,"limel-list-item",{"language":[513],"value":[8],"text":[513],"secondaryText":[513,"secondary-text"],"disabled":[516],"icon":[1],"iconSize":[513,"icon-size"],"badgeIcon":[516,"badge-icon"],"selected":[516],"actions":[16],"primaryComponent":[16],"image":[16],"type":[513]}]]],["p-a089b580",[[17,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"language":[1],"required":[4],"invalid":[516],"value":[16],"searcher":[16],"allItems":[16],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]},null,{"disabled":[{"onDisabledChange":0}],"value":[{"onChangeValue":0}]}]]],["p-8175c53a",[[17,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"items":[16]}]]],["p-191efd88",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"placeholder":[513],"manualInput":[516,"manual-input"],"palette":[16],"paletteColumnCount":[514,"palette-column-count"],"isOpen":[32]}]]],["p-89f9bd6c",[[1,"limel-profile-picture",{"language":[513],"label":[513],"icon":[1],"helperText":[1,"helper-text"],"disabled":[516],"readonly":[516],"required":[516],"invalid":[516],"loading":[516],"value":[1],"imageFit":[513,"image-fit"],"accept":[513],"resize":[16],"objectUrl":[32],"imageError":[32],"isErrorMessagePopoverOpen":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ea94f7fa",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["p-e545c9e8",[[1,"limel-snackbar",{"open":[516],"message":[1],"timeout":[514],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[1],"offset":[32],"isOpen":[32],"closing":[32],"show":[64]},[[0,"changeOffset","onChangeIndex"]],{"open":[{"watchOpen":0}]}]]],["p-ed53466d",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[513],"format":[513],"language":[513],"formatter":[16],"internalFormat":[32],"showPortal":[32]}]]],["p-92bbb643",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]},null,{"value":[{"valueChanged":0}]}]]],["p-c8982eef",[[1,"limel-chart",{"language":[513],"accessibleLabel":[513,"accessible-label"],"accessibleItemsLabel":[513,"accessible-items-label"],"accessibleValuesLabel":[513,"accessible-values-label"],"displayAxisLabels":[516,"display-axis-labels"],"displayItemText":[516,"display-item-text"],"displayItemValue":[516,"display-item-value"],"items":[16],"type":[513],"orientation":[513],"maxValue":[514,"max-value"],"axisIncrement":[514,"axis-increment"],"loading":[516]},null,{"items":[{"handleChange":0}],"axisIncrement":[{"handleChange":0}],"maxValue":[{"handleChange":0}]}]]],["p-8f4273e4",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[16],"options":[16],"multiple":[4],"menuOpen":[32]},null,{"value":[{"resetHasChanged":0}],"options":[{"resetHasChanged":0},{"updateHasPrimaryComponent":0}],"menuOpen":[{"watchOpen":0}]}]]],["p-f2c8b10b",[[1,"limel-help",{"value":[1],"trigger":[1],"readMoreLink":[16],"openDirection":[513,"open-direction"],"isOpen":[32]}]]],["p-51cb779f",[[257,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"reducedPresence":[516,"reduced-presence"],"badge":[520],"loading":[516],"link":[16],"progress":[16],"hasPrimarySlot":[32]}]]],["p-c1ceade7",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[513],"layout":[513],"pageSize":[514,"page-size"],"totalRows":[514,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[516,"movable-columns"],"movableRows":[516,"movable-rows"],"sortableColumns":[516,"sortable-columns"],"loading":[516],"page":[514],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[516],"selection":[16],"language":[513],"paginationLocation":[513,"pagination-location"]},null,{"totalRows":[{"totalRowsChanged":0}],"pageSize":[{"pageSizeChanged":0}],"page":[{"pageChanged":0}],"activeRow":[{"activeRowChanged":0}],"data":[{"updateData":0}],"columns":[{"updateColumns":0}],"aggregates":[{"updateAggregates":0}],"selection":[{"updateSelection":0}],"selectable":[{"updateSelectable":0}],"movableRows":[{"updateMovableRows":0}],"sortableColumns":[{"updateSortableColumns":0}],"sorting":[{"updateSorting":0}]}]]],["p-4a09fb2e",[[0,"limel-drag-handle",{"dragDirection":[513,"drag-direction"],"tooltipOpenDirection":[513,"tooltip-open-direction"],"language":[513]}]]],["p-ad4672b2",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[16]}]]],["p-b3274e2e",[[1,"limel-switch",{"label":[513],"disabled":[516],"readonly":[516],"invalid":[516],"value":[516],"helperText":[513,"helper-text"],"readonlyLabels":[16],"fieldId":[32]}]]],["p-946a33ea",[[257,"limel-tab-panel",{"tabs":[1040]},null,{"tabs":[{"tabsChanged":0}]}]]],["p-9ae7d11b",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[516],"disabled":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"lineNumbers":[516,"line-numbers"],"lineWrapping":[516,"line-wrapping"],"fold":[516],"lint":[516],"colorScheme":[513,"color-scheme"],"translationLanguage":[513,"translation-language"],"showCopyButton":[516,"show-copy-button"],"random":[32],"wasCopied":[32]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"readonly":[{"watchReadonly":0}],"invalid":[{"watchInvalid":0}],"required":[{"watchRequired":0}],"helperText":[{"watchHelperText":0}]}]]],["p-c0263530",[[257,"limel-dialog",{"heading":[1],"fullscreen":[516],"open":[1540],"closingActions":[16]},null,{"open":[{"watchHandler":0}],"closingActions":[{"closingActionsChanged":0}]}]]],["p-120182f5",[[1,"limel-menu-item-meta",{"commandText":[513,"command-text"],"hotkey":[513],"disabled":[516],"badge":[8],"showChevron":[4,"show-chevron"]}]]],["p-eecd1132",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["p-ee58f0b4",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"required":[516],"invalid":[516],"displaysPercentageColors":[516,"displays-percentage-colors"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32],"displayValue":[32]},null,{"value":[{"watchValue":0}]}]]],["p-fe531211",[[257,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["p-09fb0765",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16],"revealErrors":[4,"reveal-errors"]}]]],["p-2737cade",[[0,"limel-radio-button-group",{"items":[16],"selectedItem":[16],"disabled":[516],"badgeIcons":[516,"badge-icons"],"maxLinesSecondaryText":[514,"max-lines-secondary-text"]}]]],["p-7f7e2180",[[1,"limel-ai-avatar",{"isThinking":[516,"is-thinking"],"mode":[513],"variant":[513],"language":[513]},null,{"isThinking":[{"onIsThinkingChange":0}]}]]],["p-6acd82ce",[[1,"limel-config",{"config":[16]}]]],["p-bb9b399c",[[257,"limel-flex-container",{"direction":[513],"justify":[513],"align":[513],"reverse":[516]}]]],["p-6665e14b",[[257,"limel-grid"]]],["p-21558be2",[[257,"limel-masonry-layout",{"ordered":[516],"containerHeight":[32]},null,{"ordered":[{"onOrderedChange":0}]}]]],["p-aa080a8f",[[257,"limel-email-viewer",{"email":[16],"fallbackUrl":[513,"fallback-url"],"language":[513],"allowRemoteImages":[4,"allow-remote-images"],"allowRemoteImagesState":[32]},null,{"email":[{"resetAllowRemoteImages":0}]}]]],["p-1cc3b516",[[17,"limel-prosemirror-adapter",{"contentType":[1,"content-type"],"value":[1],"language":[513],"disabled":[516],"customElements":[16],"inlineImages":[16],"triggerCharacters":[16],"ui":[1],"view":[32],"actionBarItems":[32],"link":[32],"isLinkMenuOpen":[32],"flushPendingChanges":[64],"clear":[64]},null,{"value":[{"watchValue":0}]}]]],["p-dd9591a3",[[0,"limel-dock-button",{"item":[16],"expanded":[516],"useMobileLayout":[516,"use-mobile-layout"],"isOpen":[32]},null,{"isOpen":[{"openWatcher":0}]}]]],["p-c8ce60a0",[[17,"limel-color-picker-palette",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"placeholder":[513],"required":[516],"invalid":[516],"manualInput":[516,"manual-input"],"columnCount":[514,"column-count"],"palette":[16]}]]],["p-ffd668d2",[[1,"limel-checkbox",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"helperText":[513,"helper-text"],"checked":[516],"indeterminate":[516],"required":[516],"readonlyLabels":[16],"modified":[32]},null,{"checked":[{"handleCheckedChange":0}],"indeterminate":[{"handleIndeterminateChange":0}],"readonly":[{"handleReadonlyChange":0}]}]]],["p-eeb7fcb3",[[1,"limel-tab-bar",{"tabs":[1040],"canScrollLeft":[32],"canScrollRight":[32]},[[9,"resize","handleWindowResize"]],{"tabs":[{"tabsChanged":0}]}]]],["p-2284caa7",[[257,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[1]}]]],["p-1907a5be",[[257,"limel-header",{"icon":[1],"heading":[1],"subheading":[1],"supportingText":[1,"supporting-text"],"subheadingDivider":[1,"subheading-divider"]}]]],["p-de070191",[[1,"limel-help-content",{"value":[1],"readMoreLink":[16]}]]],["p-e3ba7e15",[[0,"limel-progress-flow-item",{"item":[16],"disabled":[4],"readonly":[4],"currentStep":[4,"current-step"]}]]],["p-70087de6",[[1,"limel-circular-progress",{"value":[2],"maxValue":[2,"max-value"],"prefix":[513],"suffix":[1],"displayPercentageColors":[4,"display-percentage-colors"],"size":[513]}]]],["p-19c81ded",[[1,"limel-flatpickr-adapter",{"value":[16],"type":[1],"format":[1],"isOpen":[4,"is-open"],"inputElement":[16],"language":[1],"formatter":[16]}]]],["p-7fe6a073",[[0,"limel-radio-button",{"checked":[516],"disabled":[516],"id":[1],"label":[1],"onChange":[16]}]]],["p-758939be",[[17,"limel-chip-set",{"value":[16],"type":[513],"label":[513],"helperText":[513,"helper-text"],"disabled":[516],"readonly":[516],"invalid":[516],"inputType":[513,"input-type"],"maxItems":[514,"max-items"],"required":[516],"searchLabel":[513,"search-label"],"emptyInputOnBlur":[516,"empty-input-on-blur"],"emptyInputOnChange":[516,"empty-input-on-change"],"clearAllButton":[4,"clear-all-button"],"leadingIcon":[513,"leading-icon"],"delimiter":[513],"autocomplete":[513],"language":[1],"editMode":[32],"textValue":[32],"blurred":[32],"inputChipIndexSelected":[32],"selectedChipIds":[32],"getEditMode":[64],"setFocus":[64],"emptyInput":[64]},null,{"value":[{"handleChangeChips":0}]}]]],["p-7bfac292",[[17,"limel-button",{"label":[513],"primary":[516],"outlined":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"justLoaded":[32]},null,{"loading":[{"loadingWatcher":0}]}]]],["p-d521d599",[[1,"limel-tooltip",{"elementId":[513,"element-id"],"label":[513],"helperLabel":[513,"helper-label"],"hotkey":[513],"maxlength":[514],"openDirection":[513,"open-direction"],"open":[32]}],[1,"limel-tooltip-content",{"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514],"hotkey":[513]}],[1,"limel-hotkey",{"value":[513],"disabled":[516]}],[257,"limel-portal",{"openDirection":[513,"open-direction"],"position":[513],"containerId":[513,"container-id"],"containerStyle":[16],"inheritParentWidth":[516,"inherit-parent-width"],"visible":[516],"anchor":[16]},null,{"visible":[{"onVisible":0}]}]]],["p-6fbf20c6",[[1,"limel-text-editor-link-menu",{"link":[16],"language":[513],"isOpen":[516,"is-open"]}]]],["p-d7bb4310",[[257,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"icon":[1],"invalid":[516],"actions":[16],"language":[513]}]]],["p-be5cc2ae",[[1,"limel-3d-hover-effect-glow"]]],["p-92ea6adc",[[257,"limel-file-dropzone",{"accept":[513],"disabled":[4],"text":[1],"helperText":[1,"helper-text"],"hasFileToDrop":[32]}],[257,"limel-file-input",{"accept":[513],"disabled":[516],"multiple":[516]}]]],["p-a1c15727",[[1,"limel-dynamic-label",{"value":[8],"defaultLabel":[16],"labels":[16]}]]],["p-86b9f9d0",[[17,"limel-icon-button",{"icon":[1],"elevated":[516],"label":[513],"helperLabel":[513,"helper-label"],"disabled":[516]}]]],["p-224e80b5",[[1,"limel-markdown",{"value":[1],"whitelist":[16],"lazyLoadImages":[516,"lazy-load-images"],"removeEmptyParagraphs":[516,"remove-empty-paragraphs"],"adaptColorContrast":[516,"adapt-color-contrast"]},null,{"value":[{"textChanged":0}],"whitelist":[{"handleWhitelistChange":0}],"removeEmptyParagraphs":[{"handleRemoveEmptyParagraphsChange":0}],"adaptColorContrast":[{"handleAdaptColorContrastChange":0}]}]]],["p-bf3c78a8",[[257,"limel-popover",{"open":[4],"openDirection":[513,"open-direction"]},null,{"open":[{"watchOpen":0}]}],[1,"limel-popover-surface",{"contentCollection":[16]}]]],["p-f09822a6",[[1,"limel-badge",{"label":[520]}]]],["p-0ecf8399",[[1,"limel-helper-line",{"helperText":[513,"helper-text"],"length":[514],"maxLength":[514,"max-length"],"invalid":[516],"helperTextId":[513,"helper-text-id"]}]]],["p-fc43fb46",[[257,"limel-menu",{"items":[16],"disabled":[516],"openDirection":[513,"open-direction"],"surfaceWidth":[513,"surface-width"],"open":[1540],"badgeIcons":[516,"badge-icons"],"gridLayout":[516,"grid-layout"],"loading":[516],"currentSubMenu":[1040],"rootItem":[16],"searcher":[16],"searchPlaceholder":[1,"search-placeholder"],"emptyResultMessage":[1,"empty-result-message"],"keepOpenOnSelect":[516,"keep-open-on-select"],"loadingSubItems":[32],"searchValue":[32],"searchResults":[32]},null,{"items":[{"itemsWatcher":0}],"open":[{"openWatcher":0}]}],[1,"limel-breadcrumbs",{"items":[16],"divider":[1]}],[17,"limel-menu-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"]},null,{"items":[{"itemsChanged":0}]}],[17,"limel-input-field",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"prefix":[513],"suffix":[513],"required":[516],"value":[513],"trailingIcon":[513,"trailing-icon"],"leadingIcon":[513,"leading-icon"],"pattern":[513],"type":[513],"formatNumber":[516,"format-number"],"step":[520],"max":[514],"min":[514],"maxlength":[514],"minlength":[514],"completions":[16],"showLink":[516,"show-link"],"locale":[513],"isFocused":[32],"wasInvalid":[32],"showCompletions":[32],"getSelectionStart":[64],"getSelectionEnd":[64],"getSelectionDirection":[64]},null,{"value":[{"valueWatcher":0}],"completions":[{"completionsWatcher":0}]}],[257,"limel-menu-surface",{"open":[4],"allowClicksElement":[16]}],[1,"limel-spinner",{"size":[513],"limeBranded":[4,"lime-branded"]}],[17,"limel-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]},null,{"type":[{"handleType":0}],"items":[{"itemsChanged":0}]}],[260,"limel-notched-outline",{"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"label":[513],"labelId":[513,"label-id"],"hasValue":[516,"has-value"],"hasLeadingIcon":[516,"has-leading-icon"],"hasFloatingLabel":[516,"has-floating-label"]}]]],["p-1e3cdfa1",[[17,"limel-chip",{"language":[513],"text":[513],"icon":[1],"image":[16],"link":[16],"badge":[520],"disabled":[516],"readonly":[516],"selected":[516],"invalid":[516],"removable":[516],"type":[513],"loading":[516],"progress":[514],"identifier":[520],"size":[513],"menuItems":[16]}],[1,"limel-linear-progress",{"language":[513],"value":[514],"indeterminate":[516],"accessibleLabel":[513,"accessible-label"]},null,{"value":[{"watchValue":0}]}]]],["p-c8116a01",[[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"language":[1],"layout":[513],"collapsible":[516],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}],[0,"limel-action-bar-overflow-menu",{"items":[16],"openDirection":[513,"open-direction"]}],[0,"limel-action-bar-item",{"item":[16],"isVisible":[516,"is-visible"],"selected":[516]}]]]]'),e))));
|
|
1
|
+
import{p as e,g as l,b as a}from"./p-BGxJfR2f.js";export{s as setNonce}from"./p-BGxJfR2f.js";(()=>{const l=import.meta.url,a={};return""!==l&&(a.resourcesUrl=new URL(".",l).href),e(a)})().then((async e=>(await l(),a(JSON.parse('[["p-d19ab443",[[1,"limel-icon",{"size":[513],"name":[513],"badge":[516],"svgClass":[513,"svg-class"]},null,{"name":[{"loadIcon":0}],"svgClass":[{"applySvgClass":0}]}]]],["p-1f35fc44",[[17,"limel-text-editor",{"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"value":[513],"customElements":[16],"inlineImages":[16],"triggers":[16],"required":[516],"allowResize":[516,"allow-resize"],"ui":[513],"flushPendingChanges":[64],"clear":[64]}]]],["p-552d0733",[[1,"limel-file-viewer",{"url":[513],"filename":[513],"alt":[513],"allowFullscreen":[516,"allow-fullscreen"],"allowOpenInNewTab":[516,"allow-open-in-new-tab"],"allowDownload":[516,"allow-download"],"language":[1],"officeViewer":[513,"office-viewer"],"actions":[16],"isFullscreen":[32],"fileType":[32],"loading":[32],"fileUrl":[32],"email":[32]},null,{"url":[{"watchUrl":0}]}]]],["p-7df111bb",[[257,"limel-card",{"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"actions":[16],"clickable":[516],"orientation":[513],"selected":[516],"show3dEffect":[516,"show-3d-effect"],"canScrollUp":[32],"canScrollDown":[32]}]]],["p-8aeeeb53",[[1,"limel-file",{"value":[16],"label":[513],"helperText":[513,"helper-text"],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"loading":[516],"accept":[513],"resizeImage":[16],"language":[1],"resizingFile":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ca0b86ee",[[1,"limel-code-diff",{"oldValue":[1,"old-value"],"newValue":[1,"new-value"],"oldHeading":[513,"old-heading"],"newHeading":[513,"new-heading"],"layout":[513],"contextLines":[514,"context-lines"],"lineWrapping":[516,"line-wrapping"],"language":[513],"reformatJson":[516,"reformat-json"],"translationLanguage":[513,"translation-language"],"diffResult":[32],"liveAnnouncement":[32],"copyState":[32],"searchVisible":[32],"searchTerm":[32],"currentMatchIndex":[32]},null,{"oldValue":[{"watchInputs":0}],"newValue":[{"watchInputs":0}],"contextLines":[{"watchInputs":0}],"reformatJson":[{"watchInputs":0}],"layout":[{"watchInputs":0}]}]]],["p-2f223e46",[[0,"limel-list-item",{"language":[513],"value":[8],"text":[513],"secondaryText":[513,"secondary-text"],"disabled":[516],"icon":[1],"iconSize":[513,"icon-size"],"badgeIcon":[516,"badge-icon"],"selected":[516],"actions":[16],"primaryComponent":[16],"image":[16],"type":[513]}]]],["p-a089b580",[[17,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"language":[1],"required":[4],"invalid":[516],"value":[16],"searcher":[16],"allItems":[16],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]},null,{"disabled":[{"onDisabledChange":0}],"value":[{"onChangeValue":0}]}]]],["p-8175c53a",[[17,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"items":[16]}]]],["p-191efd88",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"placeholder":[513],"manualInput":[516,"manual-input"],"palette":[16],"paletteColumnCount":[514,"palette-column-count"],"isOpen":[32]}]]],["p-8893e1df",[[1,"limel-profile-picture",{"language":[513],"label":[513],"icon":[1],"helperText":[1,"helper-text"],"disabled":[516],"readonly":[516],"required":[516],"invalid":[516],"loading":[516],"value":[1],"imageFit":[513,"image-fit"],"accept":[513],"resize":[16],"objectUrl":[32],"imageError":[32],"isErrorMessagePopoverOpen":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ea94f7fa",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["p-e545c9e8",[[1,"limel-snackbar",{"open":[516],"message":[1],"timeout":[514],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[1],"offset":[32],"isOpen":[32],"closing":[32],"show":[64]},[[0,"changeOffset","onChangeIndex"]],{"open":[{"watchOpen":0}]}]]],["p-ed53466d",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[513],"format":[513],"language":[513],"formatter":[16],"internalFormat":[32],"showPortal":[32]}]]],["p-92bbb643",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]},null,{"value":[{"valueChanged":0}]}]]],["p-c8982eef",[[1,"limel-chart",{"language":[513],"accessibleLabel":[513,"accessible-label"],"accessibleItemsLabel":[513,"accessible-items-label"],"accessibleValuesLabel":[513,"accessible-values-label"],"displayAxisLabels":[516,"display-axis-labels"],"displayItemText":[516,"display-item-text"],"displayItemValue":[516,"display-item-value"],"items":[16],"type":[513],"orientation":[513],"maxValue":[514,"max-value"],"axisIncrement":[514,"axis-increment"],"loading":[516]},null,{"items":[{"handleChange":0}],"axisIncrement":[{"handleChange":0}],"maxValue":[{"handleChange":0}]}]]],["p-8f4273e4",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[16],"options":[16],"multiple":[4],"menuOpen":[32]},null,{"value":[{"resetHasChanged":0}],"options":[{"resetHasChanged":0},{"updateHasPrimaryComponent":0}],"menuOpen":[{"watchOpen":0}]}]]],["p-f2c8b10b",[[1,"limel-help",{"value":[1],"trigger":[1],"readMoreLink":[16],"openDirection":[513,"open-direction"],"isOpen":[32]}]]],["p-51cb779f",[[257,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"reducedPresence":[516,"reduced-presence"],"badge":[520],"loading":[516],"link":[16],"progress":[16],"hasPrimarySlot":[32]}]]],["p-c1ceade7",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[513],"layout":[513],"pageSize":[514,"page-size"],"totalRows":[514,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[516,"movable-columns"],"movableRows":[516,"movable-rows"],"sortableColumns":[516,"sortable-columns"],"loading":[516],"page":[514],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[516],"selection":[16],"language":[513],"paginationLocation":[513,"pagination-location"]},null,{"totalRows":[{"totalRowsChanged":0}],"pageSize":[{"pageSizeChanged":0}],"page":[{"pageChanged":0}],"activeRow":[{"activeRowChanged":0}],"data":[{"updateData":0}],"columns":[{"updateColumns":0}],"aggregates":[{"updateAggregates":0}],"selection":[{"updateSelection":0}],"selectable":[{"updateSelectable":0}],"movableRows":[{"updateMovableRows":0}],"sortableColumns":[{"updateSortableColumns":0}],"sorting":[{"updateSorting":0}]}]]],["p-4a09fb2e",[[0,"limel-drag-handle",{"dragDirection":[513,"drag-direction"],"tooltipOpenDirection":[513,"tooltip-open-direction"],"language":[513]}]]],["p-ad4672b2",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[16]}]]],["p-b3274e2e",[[1,"limel-switch",{"label":[513],"disabled":[516],"readonly":[516],"invalid":[516],"value":[516],"helperText":[513,"helper-text"],"readonlyLabels":[16],"fieldId":[32]}]]],["p-946a33ea",[[257,"limel-tab-panel",{"tabs":[1040]},null,{"tabs":[{"tabsChanged":0}]}]]],["p-9ae7d11b",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[516],"disabled":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"lineNumbers":[516,"line-numbers"],"lineWrapping":[516,"line-wrapping"],"fold":[516],"lint":[516],"colorScheme":[513,"color-scheme"],"translationLanguage":[513,"translation-language"],"showCopyButton":[516,"show-copy-button"],"random":[32],"wasCopied":[32]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"readonly":[{"watchReadonly":0}],"invalid":[{"watchInvalid":0}],"required":[{"watchRequired":0}],"helperText":[{"watchHelperText":0}]}]]],["p-c0263530",[[257,"limel-dialog",{"heading":[1],"fullscreen":[516],"open":[1540],"closingActions":[16]},null,{"open":[{"watchHandler":0}],"closingActions":[{"closingActionsChanged":0}]}]]],["p-120182f5",[[1,"limel-menu-item-meta",{"commandText":[513,"command-text"],"hotkey":[513],"disabled":[516],"badge":[8],"showChevron":[4,"show-chevron"]}]]],["p-eecd1132",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["p-ee58f0b4",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"required":[516],"invalid":[516],"displaysPercentageColors":[516,"displays-percentage-colors"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32],"displayValue":[32]},null,{"value":[{"watchValue":0}]}]]],["p-fe531211",[[257,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["p-09fb0765",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16],"revealErrors":[4,"reveal-errors"]}]]],["p-2737cade",[[0,"limel-radio-button-group",{"items":[16],"selectedItem":[16],"disabled":[516],"badgeIcons":[516,"badge-icons"],"maxLinesSecondaryText":[514,"max-lines-secondary-text"]}]]],["p-7f7e2180",[[1,"limel-ai-avatar",{"isThinking":[516,"is-thinking"],"mode":[513],"variant":[513],"language":[513]},null,{"isThinking":[{"onIsThinkingChange":0}]}]]],["p-6acd82ce",[[1,"limel-config",{"config":[16]}]]],["p-bb9b399c",[[257,"limel-flex-container",{"direction":[513],"justify":[513],"align":[513],"reverse":[516]}]]],["p-6665e14b",[[257,"limel-grid"]]],["p-21558be2",[[257,"limel-masonry-layout",{"ordered":[516],"containerHeight":[32]},null,{"ordered":[{"onOrderedChange":0}]}]]],["p-aa080a8f",[[257,"limel-email-viewer",{"email":[16],"fallbackUrl":[513,"fallback-url"],"language":[513],"allowRemoteImages":[4,"allow-remote-images"],"allowRemoteImagesState":[32]},null,{"email":[{"resetAllowRemoteImages":0}]}]]],["p-1cc3b516",[[17,"limel-prosemirror-adapter",{"contentType":[1,"content-type"],"value":[1],"language":[513],"disabled":[516],"customElements":[16],"inlineImages":[16],"triggerCharacters":[16],"ui":[1],"view":[32],"actionBarItems":[32],"link":[32],"isLinkMenuOpen":[32],"flushPendingChanges":[64],"clear":[64]},null,{"value":[{"watchValue":0}]}]]],["p-dd9591a3",[[0,"limel-dock-button",{"item":[16],"expanded":[516],"useMobileLayout":[516,"use-mobile-layout"],"isOpen":[32]},null,{"isOpen":[{"openWatcher":0}]}]]],["p-c8ce60a0",[[17,"limel-color-picker-palette",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"placeholder":[513],"required":[516],"invalid":[516],"manualInput":[516,"manual-input"],"columnCount":[514,"column-count"],"palette":[16]}]]],["p-ffd668d2",[[1,"limel-checkbox",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"helperText":[513,"helper-text"],"checked":[516],"indeterminate":[516],"required":[516],"readonlyLabels":[16],"modified":[32]},null,{"checked":[{"handleCheckedChange":0}],"indeterminate":[{"handleIndeterminateChange":0}],"readonly":[{"handleReadonlyChange":0}]}]]],["p-eeb7fcb3",[[1,"limel-tab-bar",{"tabs":[1040],"canScrollLeft":[32],"canScrollRight":[32]},[[9,"resize","handleWindowResize"]],{"tabs":[{"tabsChanged":0}]}]]],["p-2284caa7",[[257,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[1]}]]],["p-1907a5be",[[257,"limel-header",{"icon":[1],"heading":[1],"subheading":[1],"supportingText":[1,"supporting-text"],"subheadingDivider":[1,"subheading-divider"]}]]],["p-de070191",[[1,"limel-help-content",{"value":[1],"readMoreLink":[16]}]]],["p-e3ba7e15",[[0,"limel-progress-flow-item",{"item":[16],"disabled":[4],"readonly":[4],"currentStep":[4,"current-step"]}]]],["p-70087de6",[[1,"limel-circular-progress",{"value":[2],"maxValue":[2,"max-value"],"prefix":[513],"suffix":[1],"displayPercentageColors":[4,"display-percentage-colors"],"size":[513]}]]],["p-19c81ded",[[1,"limel-flatpickr-adapter",{"value":[16],"type":[1],"format":[1],"isOpen":[4,"is-open"],"inputElement":[16],"language":[1],"formatter":[16]}]]],["p-7fe6a073",[[0,"limel-radio-button",{"checked":[516],"disabled":[516],"id":[1],"label":[1],"onChange":[16]}]]],["p-758939be",[[17,"limel-chip-set",{"value":[16],"type":[513],"label":[513],"helperText":[513,"helper-text"],"disabled":[516],"readonly":[516],"invalid":[516],"inputType":[513,"input-type"],"maxItems":[514,"max-items"],"required":[516],"searchLabel":[513,"search-label"],"emptyInputOnBlur":[516,"empty-input-on-blur"],"emptyInputOnChange":[516,"empty-input-on-change"],"clearAllButton":[4,"clear-all-button"],"leadingIcon":[513,"leading-icon"],"delimiter":[513],"autocomplete":[513],"language":[1],"editMode":[32],"textValue":[32],"blurred":[32],"inputChipIndexSelected":[32],"selectedChipIds":[32],"getEditMode":[64],"setFocus":[64],"emptyInput":[64]},null,{"value":[{"handleChangeChips":0}]}]]],["p-7bfac292",[[17,"limel-button",{"label":[513],"primary":[516],"outlined":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"justLoaded":[32]},null,{"loading":[{"loadingWatcher":0}]}]]],["p-d521d599",[[1,"limel-tooltip",{"elementId":[513,"element-id"],"label":[513],"helperLabel":[513,"helper-label"],"hotkey":[513],"maxlength":[514],"openDirection":[513,"open-direction"],"open":[32]}],[1,"limel-tooltip-content",{"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514],"hotkey":[513]}],[1,"limel-hotkey",{"value":[513],"disabled":[516]}],[257,"limel-portal",{"openDirection":[513,"open-direction"],"position":[513],"containerId":[513,"container-id"],"containerStyle":[16],"inheritParentWidth":[516,"inherit-parent-width"],"visible":[516],"anchor":[16]},null,{"visible":[{"onVisible":0}]}]]],["p-6fbf20c6",[[1,"limel-text-editor-link-menu",{"link":[16],"language":[513],"isOpen":[516,"is-open"]}]]],["p-d7bb4310",[[257,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"icon":[1],"invalid":[516],"actions":[16],"language":[513]}]]],["p-be5cc2ae",[[1,"limel-3d-hover-effect-glow"]]],["p-92ea6adc",[[257,"limel-file-dropzone",{"accept":[513],"disabled":[4],"text":[1],"helperText":[1,"helper-text"],"hasFileToDrop":[32]}],[257,"limel-file-input",{"accept":[513],"disabled":[516],"multiple":[516]}]]],["p-a1c15727",[[1,"limel-dynamic-label",{"value":[8],"defaultLabel":[16],"labels":[16]}]]],["p-86b9f9d0",[[17,"limel-icon-button",{"icon":[1],"elevated":[516],"label":[513],"helperLabel":[513,"helper-label"],"disabled":[516]}]]],["p-224e80b5",[[1,"limel-markdown",{"value":[1],"whitelist":[16],"lazyLoadImages":[516,"lazy-load-images"],"removeEmptyParagraphs":[516,"remove-empty-paragraphs"],"adaptColorContrast":[516,"adapt-color-contrast"]},null,{"value":[{"textChanged":0}],"whitelist":[{"handleWhitelistChange":0}],"removeEmptyParagraphs":[{"handleRemoveEmptyParagraphsChange":0}],"adaptColorContrast":[{"handleAdaptColorContrastChange":0}]}]]],["p-bf3c78a8",[[257,"limel-popover",{"open":[4],"openDirection":[513,"open-direction"]},null,{"open":[{"watchOpen":0}]}],[1,"limel-popover-surface",{"contentCollection":[16]}]]],["p-f09822a6",[[1,"limel-badge",{"label":[520]}]]],["p-0ecf8399",[[1,"limel-helper-line",{"helperText":[513,"helper-text"],"length":[514],"maxLength":[514,"max-length"],"invalid":[516],"helperTextId":[513,"helper-text-id"]}]]],["p-fc43fb46",[[257,"limel-menu",{"items":[16],"disabled":[516],"openDirection":[513,"open-direction"],"surfaceWidth":[513,"surface-width"],"open":[1540],"badgeIcons":[516,"badge-icons"],"gridLayout":[516,"grid-layout"],"loading":[516],"currentSubMenu":[1040],"rootItem":[16],"searcher":[16],"searchPlaceholder":[1,"search-placeholder"],"emptyResultMessage":[1,"empty-result-message"],"keepOpenOnSelect":[516,"keep-open-on-select"],"loadingSubItems":[32],"searchValue":[32],"searchResults":[32]},null,{"items":[{"itemsWatcher":0}],"open":[{"openWatcher":0}]}],[1,"limel-breadcrumbs",{"items":[16],"divider":[1]}],[17,"limel-menu-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"]},null,{"items":[{"itemsChanged":0}]}],[17,"limel-input-field",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"prefix":[513],"suffix":[513],"required":[516],"value":[513],"trailingIcon":[513,"trailing-icon"],"leadingIcon":[513,"leading-icon"],"pattern":[513],"type":[513],"formatNumber":[516,"format-number"],"step":[520],"max":[514],"min":[514],"maxlength":[514],"minlength":[514],"completions":[16],"showLink":[516,"show-link"],"locale":[513],"isFocused":[32],"wasInvalid":[32],"showCompletions":[32],"getSelectionStart":[64],"getSelectionEnd":[64],"getSelectionDirection":[64]},null,{"value":[{"valueWatcher":0}],"completions":[{"completionsWatcher":0}]}],[257,"limel-menu-surface",{"open":[4],"allowClicksElement":[16]}],[1,"limel-spinner",{"size":[513],"limeBranded":[4,"lime-branded"]}],[17,"limel-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]},null,{"type":[{"handleType":0}],"items":[{"itemsChanged":0}]}],[260,"limel-notched-outline",{"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"label":[513],"labelId":[513,"label-id"],"hasValue":[516,"has-value"],"hasLeadingIcon":[516,"has-leading-icon"],"hasFloatingLabel":[516,"has-floating-label"]}]]],["p-1e3cdfa1",[[17,"limel-chip",{"language":[513],"text":[513],"icon":[1],"image":[16],"link":[16],"badge":[520],"disabled":[516],"readonly":[516],"selected":[516],"invalid":[516],"removable":[516],"type":[513],"loading":[516],"progress":[514],"identifier":[520],"size":[513],"menuItems":[16]}],[1,"limel-linear-progress",{"language":[513],"value":[514],"indeterminate":[516],"accessibleLabel":[513,"accessible-label"]},null,{"value":[{"watchValue":0}]}]]],["p-c8116a01",[[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"language":[1],"layout":[513],"collapsible":[516],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}],[0,"limel-action-bar-overflow-menu",{"items":[16],"openDirection":[513,"open-direction"]}],[0,"limel-action-bar-item",{"item":[16],"isVisible":[516,"is-visible"],"selected":[516]}]]]]'),e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,H as o}from"./p-BGxJfR2f.js";import{i as r}from"./p-C4caLnTg.js";import{g as s}from"./p-CgNJbSP4.js";import{t as a}from"./p-Cb9R_zmF.js";import{c as l}from"./p-JbKhhoXs.js";import{r as n}from"./p-BTSG--2-.js";import{I as h}from"./p-Dpg0OkbJ.js";import"./p-BCq5M9TE.js";import"./p-Bu_YRgCL.js";const c=class{constructor(o){t(this,o),this.change=e(this,"change"),this.filesRejected=e(this,"filesRejected"),this.language="en",this.icon="user",this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1,this.loading=!1,this.imageFit="cover",this.accept="image/jpeg,image/png,image/heic,.jpg,.jpeg,.png,.heic",this.imageError=!1,this.isErrorMessagePopoverOpen=!1,this.removeButtonId=l(),this.browseButtonId=l(),this.renderHelperText=()=>{if(this.helperText)return i("limel-tooltip",{elementId:this.browseButtonId,label:this.helperText})},this.handleNewFiles=async t=>{var e,i,o,s;if(t.stopPropagation(),this.disabled)return;const a=null===(e=t.detail)||void 0===e?void 0:e[0];if(!a)return;if(!r(a,this.accept))return void this.filesRejected.emit([a]);this.revokeObjectUrl(),this.imageError=!1;let l=a;if(this.resize&&a.fileContent instanceof File)try{const t=await n(a.fileContent,Object.assign(Object.assign({},this.resize),{fit:null!==(i=this.resize.fit)&&void 0!==i?i:this.imageFit,type:null!==(o=this.resize.type)&&void 0!==o?o:"image/jpeg",quality:null!==(s=this.resize.quality)&&void 0!==s?s:.85}));l=Object.assign(Object.assign({},a),{filename:t.name,size:t.size,contentType:t.type,fileContent:t})}catch(t){l=a}!l.href&&l.fileContent instanceof File&&(this.objectUrl=URL.createObjectURL(l.fileContent)),this.change.emit(l)},this.handleRejectedFiles=t=>{t.stopPropagation(),this.filesRejected.emit(t.detail)},this.handleClear=t=>{t.stopPropagation(),this.revokeObjectUrl(),this.imageError=!1,this.change.emit(void 0)},this.onImageError=()=>{this.imageError=!0},this.openPopover=t=>{t.stopPropagation(),this.isErrorMessagePopoverOpen=!0},this.onPopoverClose=t=>{t.stopPropagation(),this.isErrorMessagePopoverOpen=!1},this.getTranslation=t=>a.get(t,this.language)}disconnectedCallback(){this.revokeObjectUrl()}handleValueChange(){this.revokeObjectUrl(),this.imageError=!1;const t=this.value;t&&"string"!=typeof t&&!t.href&&t.fileContent instanceof File&&(this.objectUrl=URL.createObjectURL(t.fileContent))}render(){const t={"has-image-error":this.imageError};return this.readonly?i(o,{class:t},this.renderAvatar()):i(o,{class:t},i("limel-file-dropzone",{disabled:this.disabled,accept:this.accept,onFilesSelected:this.handleNewFiles,onFilesRejected:this.handleRejectedFiles},i("limel-file-input",{accept:this.accept,disabled:this.disabled,"aria-required":this.required?"true":void 0,"aria-invalid":this.invalid?"true":void 0},this.renderBrowseButton())),this.renderClearButton(),this.renderSpinner(),this.renderErrorMessage(),this.renderHelperText())}get hasValue(){return"string"==typeof this.value?!!this.value:!(!this.value||!this.value.href&&!this.value.fileContent)||!!this.objectUrl}renderBrowseButton(){return i("button",{id:this.browseButtonId,type:"button",class:"avatar",disabled:this.disabled,"aria-label":this.label,"aria-busy":this.loading?"true":"false","aria-live":"polite"},this.renderAvatar())}renderAvatar(){const t=this.getImageSrc();return t?i(h,{image:{src:t,alt:"",referrerpolicy:"no-referrer"},style:{"--limel-profile-picture-object-fit":this.imageFit},onError:this.onImageError}):this.renderIcon()}renderIcon(){var t,e;const o=s(this.icon);return i("limel-icon",{name:o,style:{color:`${null===(t=this.icon)||void 0===t?void 0:t.color}`,"background-color":`${null===(e=this.icon)||void 0===e?void 0:e.backgroundColor}`}})}renderClearButton(){if(this.hasValue&&!this.disabled)return[i("button",{class:"remove",type:"button",id:this.removeButtonId,onClick:this.handleClear}),i("limel-tooltip",{label:this.getTranslation("profile-picture.remove"),elementId:this.removeButtonId})]}renderSpinner(){if(this.loading)return i("limel-spinner",null)}getUnsupportedPreviewContext(){const t=this.value;return{hasNoSrc:!this.getImageSrc(),hasLocalFile:!(!(t&&"string"!=typeof t&&t.fileContent instanceof File)||t.href),isResizeConfigured:!!this.resize}}shouldShowErrorMessage(){const{hasNoSrc:t,hasLocalFile:e,isResizeConfigured:i}=this.getUnsupportedPreviewContext();return(t||this.imageError)&&e&&i}renderErrorMessage(){if(this.shouldShowErrorMessage())return i("limel-popover",{open:this.isErrorMessagePopoverOpen,onClick:this.openPopover,onClose:this.onPopoverClose},i("limel-icon-button",{slot:"trigger",elevated:!0,icon:{name:"error",color:"rgb(var(--color-orange-dark))"},"aria-live":"polite",label:this.getTranslation("profile-picture.unsupported-preview.title")}),i("limel-callout",{type:"warning",style:{maxWidth:"20rem",borderRadius:"0.75rem"},heading:this.getTranslation("profile-picture.unsupported-preview.title")},this.getTranslation("profile-picture.unsupported-preview.description")))}getImageSrc(){return this.value?"string"==typeof this.value?this.value:this.value.href?this.value.href:this.value.fileContent instanceof File?this.objectUrl:void 0:this.objectUrl}revokeObjectUrl(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=void 0)}static get watchers(){return{value:[{handleValueChange:0}]}}};c.style="@charset \"UTF-8\";:host(limel-profile-picture){position:relative;display:inline-flex;min-width:1.5rem;min-height:1.5rem;border-radius:var(--profile-picture-border-radius, 100vw);background-color:rgb(var(--contrast-400))}*{box-sizing:border-box}limel-file-dropzone,limel-file-input,button.avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%}button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;display:block}button:focus{outline:none}button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.avatar{overflow:hidden;border-radius:var(--profile-picture-border-radius, 100vw)}:host(:not([disabled]):not([disabled=true])) button.avatar{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(--limel-theme-on-surface-color);background-color:transparent}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{will-change:color, background-color, box-shadow, transform}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover{box-shadow:var(--button-shadow-hovered)}:host(:not([disabled]):not([disabled=true])) button.avatar: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)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host([invalid]:not([invalid=false])) button.avatar{box-shadow:var(--shadow-error-state)}button.remove{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(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900))}button.remove:hover,button.remove:focus,button.remove:focus-visible{will-change:color, background-color, box-shadow, transform}button.remove:hover,button.remove:focus-visible{transform:translate3d(0, 0.01rem, 0);color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}button.remove:hover{box-shadow:var(--button-shadow-hovered)}button.remove: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)}button.remove:hover,button.remove:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.remove{cursor:pointer;height:1.25rem;width:1.25rem;border-radius:50%;background-repeat:no-repeat;background-position:center;background-size:0.75rem;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cdefs/%3E%3Cpath%20fill='rgb(255,255,255)'%20d='M7.219%205.781L5.78%207.22%2014.563%2016%205.78%2024.781%207.22%2026.22%2016%2017.437l8.781%208.782%201.438-1.438L17.437%2016l8.782-8.781L24.78%205.78%2016%2014.563z'/%3E%3C/svg%3E\");position:absolute;top:0;left:0;opacity:0}:host(:hover) button.remove,:host(:focus) button.remove,:host(:focus-visible) button.remove,:host(:focus-within) button.remove,:host(:active) button.remove{animation:show 0.4s ease-in-out forwards}@keyframes show{0%{transform:scale(0.9);opacity:0}100%{transform:scale(1);opacity:1}}button.avatar,img,limel-icon{border-radius:var(--profile-picture-border-radius, 100vw)}limel-icon{width:calc(100% - 1rem);min-width:1rem;max-width:4rem;color:var(--limel-theme-text-secondary-on-background-color);margin:auto}img{object-fit:var(--limel-profile-picture-object-fit);width:100%;height:100%}:host(.has-image-error) img{border:1px dashed rgb(var(--contrast-600));background:url(\"data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>\");background-size:0.5rem}limel-spinner{position:absolute;inset:0;margin:auto}limel-popover{position:absolute;inset:auto 0 0 auto;display:block;width:2.25rem;height:2.25rem}";export{c as limel_profile_picture}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,h as e,H as s}from"./p-BGxJfR2f.js";import{t as n}from"./p-Cb9R_zmF.js";import{g as r,a,b as o,c as l}from"./p-BCq5M9TE.js";import{f as h}from"./p-u_sd2HMb.js";import{r as d}from"./p-
|
|
1
|
+
import{r as i,c as t,h as e,H as s}from"./p-BGxJfR2f.js";import{t as n}from"./p-Cb9R_zmF.js";import{g as r,a,b as o,c as l}from"./p-BCq5M9TE.js";import{f as h}from"./p-u_sd2HMb.js";import{r as d}from"./p-BTSG--2-.js";import"./p-Bu_YRgCL.js";import"./p-CgNJbSP4.js";const p={id:null,text:null,removable:!0},c=class{constructor(e){i(this,e),this.change=t(this,"change"),this.interact=t(this,"interact"),this.required=!1,this.disabled=!1,this.readonly=!1,this.invalid=!1,this.loading=!1,this.accept="*",this.language="en",this.dropZoneTip=()=>this.getTranslation("file.drag-and-drop-tips"),this.handleNewFiles=async i=>{this.preventAndStop(i);const t=i.detail[0];let e=t;const s=null==t?void 0:t.fileContent;if(this.resizeImage&&s instanceof Blob&&this.isResizableImage(s)){const i=Object.assign(Object.assign({},t),{loading:!0,statusText:this.getTranslation("file.optimizing")});this.resizingFile=i;try{const i=await d(s,this.resizeImage);e=Object.assign(Object.assign({},t),{filename:i.name,size:i.size,contentType:i.type,fileContent:i})}catch(i){}if(this.resizingFile!==i)return;this.resizingFile=e}this.change.emit(e)},this.handleChipSetChange=i=>{i.stopPropagation();const t=0===i.detail.length?i.detail[0]:null;t||(this.resizingFile=void 0,this.change.emit(t))},this.handleChipInteract=i=>{this.preventAndStop(i),this.interact.emit(i.detail.id)}}get displayedFile(){var i;return null!==(i=this.value)&&void 0!==i?i:this.resizingFile}handleValueChange(){this.resizingFile=void 0}render(){return e(s,{key:"3f314e0a075c61a8b1e2b4a51451193abc53e12f","aria-busy":this.isBusy?"true":"false"},e("limel-file-dropzone",{key:"8374175635679e2082b4f80d431686f8fd76af61",disabled:this.disabled||this.readonly||!!this.displayedFile,accept:this.accept,onFilesSelected:this.handleNewFiles},this.renderChipset()),this.renderDragAndDropTip(),this.renderSpinner())}get statusText(){var i,t,e;return null!==(e=null===(t=null===(i=this.displayedFile)||void 0===i?void 0:i.statusText)||void 0===t?void 0:t.trim())&&void 0!==e?e:""}get isBusy(){var i,t;return this.loading||Boolean(null===(i=this.displayedFile)||void 0===i?void 0:i.loading)||void 0!==(null===(t=this.displayedFile)||void 0===t?void 0:t.progress)}renderSpinner(){if(this.isBusy)return e("limel-spinner",null)}renderDragAndDropTip(){if(!(this.displayedFile||this.disabled||this.readonly||this.isBusy))return e("div",{class:"drag-and-drop-tip"},e("span",{class:"invisible-label-mock",role:"presentation"},this.label),e("span",{class:"tip"},this.dropZoneTip()))}isResizableImage(i){var t;return Boolean(null===(t=i.type)||void 0===t?void 0:t.startsWith("image/"))&&"image/svg+xml"!==i.type}getChipArray(){const i=this.displayedFile;return i?[Object.assign(Object.assign({},p),{text:i.filename,id:i.id,icon:{name:l(i),title:o(i),color:a(i),backgroundColor:r(i)},badge:this.getBadge(),href:i.href,menuItems:i.menuItems,loading:i.loading,progress:i.progress,invalid:i.invalid})]:[]}getBadge(){var i;return this.statusText?this.statusText:"number"==typeof(null===(i=this.displayedFile)||void 0===i?void 0:i.size)?h(this.displayedFile.size):void 0}renderChipset(){const i=e("limel-chip-set",{disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,clearAllButton:!1,label:this.label,helperText:this.helperText,leadingIcon:"upload_to_cloud",language:this.language,onChange:this.handleChipSetChange,onInteract:this.handleChipInteract,required:this.required,type:"input",value:this.getChipArray()});return this.value?i:e("limel-file-input",{accept:this.accept,disabled:this.disabled||this.readonly},i)}preventAndStop(i){i.stopPropagation(),i.preventDefault()}getTranslation(i){return n.get(i,this.language)}static get watchers(){return{value:[{handleValueChange:0}]}}};c.style='@charset "UTF-8";:host(limel-file){--badge-max-width:auto;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(--limel-theme-text-secondary-on-background-color);height:auto;max-height:3rem;line-height:1;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}limel-spinner{pointer-events:none;position:absolute;inset:0 0.375rem 0 auto;margin:auto}';export{c as limel_file}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={"image/jpeg":"jpg","image/png":"png"};async function n(n,e){var o;const{fit:i,quality:r}=e,a=(j=n.type,e.type||(Object.prototype.hasOwnProperty.call(t,j)?j:"image/jpeg")),c=null!==(o=e.rename)&&void 0!==o?o:n=>function(n,e){const o=t[e],i=n.lastIndexOf(".");return`${i>0?n.slice(0,i):n}.${o}`}(n,a),s=await async function(t){var n,e;if("function"==typeof globalThis.createImageBitmap)try{return await globalThis.createImageBitmap(t,{imageOrientation:"from-image"})}catch(t){"production"!==(null===(e=null===(n=globalThis.process)||void 0===n?void 0:n.env)||void 0===e?void 0:e.NODE_ENV)&&"undefined"!=typeof console&&"function"==typeof console.debug&&console.debug("createImageBitmap failed, falling back to HTMLImageElement:",t)}return await async function(t){var n;const e=URL.createObjectURL(t);try{const t=new Image;return t.decoding="sync",t.src=e,await(null===(n=t.decode)||void 0===n?void 0:n.call(t).catch((()=>{}))),t.complete||await new Promise(((n,e)=>{const o=()=>{t.removeEventListener("load",i),t.removeEventListener("error",r)},i=()=>{o(),n()},r=t=>{o(),e(t)};t.addEventListener("load",i),t.addEventListener("error",r)})),t}finally{URL.revokeObjectURL(e)}}(t)}(n),l=s.width,u=s.height,{width:d,height:h}=function(t,n,e,o){const i="number"==typeof e&&e>0,r="number"==typeof o&&o>0;return i&&r?{width:e,height:o}:i?{width:e,height:Math.round(e*(n/t))}:r?{width:Math.round(o*(t/n)),height:o}:{width:t,height:n}}(l,u,e.width,e.height),{sx:f,sy:w,sw:g,sh:y,dx:m,dy:p,dw:v,dh:b}=function(t,n,e,o,i){const r=t/n,a=e/o;if("cover"===i){let i,c;return r>a?(c=n,i=n*a):(i=t,c=t/a),{sx:(t-i)/2,sy:(n-c)/2,sw:i,sh:c,dx:0,dy:0,dw:e,dh:o}}let c,s;r>a?(c=e,s=e/r):(s=o,c=o*r);return{sx:0,sy:0,sw:t,sh:n,dx:(e-c)/2,dy:(o-s)/2,dw:c,dh:s}}(l,u,d,h,i),x=function(t,n){if(function(){try{return"function"==typeof globalThis.OffscreenCanvas}catch(t){return!1}}())return new globalThis.OffscreenCanvas(t,n);const e=document.createElement("canvas");return e.width=t,e.height=n,e}(d,h),T=function(t){const n=t.getContext("2d",{alpha:!0});if(!n)throw new Error("2D canvas context not available");return n}(x);var j;T.clearRect(0,0,d,h),T.drawImage(s,f,w,g,y,m,p,v,b);const E=await function(t,n,e){return"convertToBlob"in t?t.convertToBlob({type:n,quality:e}):new Promise(((o,i)=>{t.toBlob((t=>{t?o(t):i(new Error("Failed to create blob from canvas"))}),n,e)}))}(x,a,r),I=c(n.name);return new File([E],I,{type:a})}export{n as r}
|
|
@@ -81,6 +81,8 @@ export declare class ProfilePicture {
|
|
|
81
81
|
/**
|
|
82
82
|
* Optional client-side resize before emitting the file.
|
|
83
83
|
* If provided, the selected image will be resized on the client device.
|
|
84
|
+
* Omitted options fall back to avatar defaults: `image/jpeg`, `quality`
|
|
85
|
+
* `0.85`, and the component's `imageFit`.
|
|
84
86
|
* :::note
|
|
85
87
|
* HEIC may not decode in all browsers; when decoding fails, the original
|
|
86
88
|
* file will be emitted. See the examples for more info.
|
|
@@ -3113,7 +3113,7 @@ export namespace Components {
|
|
|
3113
3113
|
*/
|
|
3114
3114
|
"required": boolean;
|
|
3115
3115
|
/**
|
|
3116
|
-
* Optional client-side resize before emitting the file. If provided, the selected image will be resized on the client device. :::note HEIC may not decode in all browsers; when decoding fails, the original file will be emitted. See the examples for more info. :::
|
|
3116
|
+
* Optional client-side resize before emitting the file. If provided, the selected image will be resized on the client device. Omitted options fall back to avatar defaults: `image/jpeg`, `quality` `0.85`, and the component's `imageFit`. :::note HEIC may not decode in all browsers; when decoding fails, the original file will be emitted. See the examples for more info. :::
|
|
3117
3117
|
*/
|
|
3118
3118
|
"resize"?: ResizeOptions;
|
|
3119
3119
|
/**
|
|
@@ -9824,7 +9824,7 @@ declare namespace LocalJSX {
|
|
|
9824
9824
|
*/
|
|
9825
9825
|
"required"?: boolean;
|
|
9826
9826
|
/**
|
|
9827
|
-
* Optional client-side resize before emitting the file. If provided, the selected image will be resized on the client device. :::note HEIC may not decode in all browsers; when decoding fails, the original file will be emitted. See the examples for more info. :::
|
|
9827
|
+
* Optional client-side resize before emitting the file. If provided, the selected image will be resized on the client device. Omitted options fall back to avatar defaults: `image/jpeg`, `quality` `0.85`, and the component's `imageFit`. :::note HEIC may not decode in all browsers; when decoding fails, the original file will be emitted. See the examples for more info. :::
|
|
9828
9828
|
*/
|
|
9829
9829
|
"resize"?: ResizeOptions;
|
|
9830
9830
|
/**
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Why resize client-side?
|
|
14
14
|
* - Faster perceived uploads and lower bandwidth usage
|
|
15
|
-
* - Consistent
|
|
15
|
+
* - Consistent output sizes and formats (e.g., a 400x400 thumbnail)
|
|
16
16
|
* - No server-side transformation required for common cases
|
|
17
17
|
*
|
|
18
18
|
* Fit strategies
|
|
19
|
-
* - `cover
|
|
20
|
-
*
|
|
19
|
+
* - `cover`: The image is scaled to cover the target rectangle, and the excess
|
|
20
|
+
* parts are center-cropped. Good for avatars.
|
|
21
21
|
* - `contain`: The image is scaled to fit entirely within the target rectangle
|
|
22
22
|
* without cropping, letterboxing if needed. Good when you must preserve the
|
|
23
23
|
* entire image.
|
|
24
|
+
* - omitted: scales the whole image to fit without cropping (no pixels are
|
|
25
|
+
* discarded).
|
|
24
26
|
*
|
|
25
27
|
* Decoding & EXIF orientation
|
|
26
28
|
* EXIF orientation is a piece of metadata stored inside image files
|
|
@@ -46,9 +48,11 @@
|
|
|
46
48
|
* library or WASM module; this utility intentionally avoids extra dependencies.
|
|
47
49
|
*
|
|
48
50
|
* Output type & quality
|
|
49
|
-
* -
|
|
50
|
-
*
|
|
51
|
-
*
|
|
51
|
+
* - When `type` is omitted the source format is kept if the canvas can encode
|
|
52
|
+
* it: a PNG stays a PNG (preserving transparency) and everything else is
|
|
53
|
+
* encoded as `image/jpeg`. Set `type` explicitly to force a format.
|
|
54
|
+
* - JPEG `quality` is optional; when omitted the browser's native encoding
|
|
55
|
+
* quality is used rather than an imposed value.
|
|
52
56
|
* - The output filename extension is adjusted to match the chosen MIME type by
|
|
53
57
|
* default (e.g., `.jpg` or `.png`). You can override naming via the `rename`
|
|
54
58
|
* option.
|
|
@@ -73,9 +77,9 @@
|
|
|
73
77
|
* const processed = await resizeImage(file, {
|
|
74
78
|
* width: 400,
|
|
75
79
|
* height: 400,
|
|
76
|
-
* fit: 'cover', //
|
|
77
|
-
* type: 'image/jpeg', //
|
|
78
|
-
* quality: 0.85, //
|
|
80
|
+
* fit: 'cover', // center-crops; omit to fit without cropping
|
|
81
|
+
* type: 'image/jpeg', // omit to keep the source format
|
|
82
|
+
* quality: 0.85, // omit to use the browser's native quality
|
|
79
83
|
* });
|
|
80
84
|
* // Upload `processed` instead of the original file
|
|
81
85
|
* ```
|
|
@@ -120,11 +124,24 @@ export type ResizeOptions = {
|
|
|
120
124
|
* keep the source dimensions and only re-encode.
|
|
121
125
|
*/
|
|
122
126
|
height?: number;
|
|
123
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* How the image is fitted into the target box when its aspect ratio
|
|
129
|
+
* differs. `cover` scales to fill and center-crops the overflow; `contain`
|
|
130
|
+
* scales to fit the whole image inside the box. Omit to scale the whole
|
|
131
|
+
* image to fit without cropping (no pixels are discarded). Only relevant
|
|
132
|
+
* when both `width` and `height` are set.
|
|
133
|
+
*/
|
|
124
134
|
fit?: 'cover' | 'contain';
|
|
125
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Output MIME type. Omit to keep the source file's format when the canvas
|
|
137
|
+
* can encode it: a PNG stays a PNG (preserving transparency), otherwise
|
|
138
|
+
* the output is JPEG. Set explicitly to force a format.
|
|
139
|
+
*/
|
|
126
140
|
type?: 'image/jpeg' | 'image/png';
|
|
127
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* JPEG quality (0..1); used only for 'image/jpeg'. Omit to let the browser
|
|
143
|
+
* use its native encoding quality rather than imposing a value.
|
|
144
|
+
*/
|
|
128
145
|
quality?: number;
|
|
129
146
|
/** Optional renaming function. Defaults to changing extension to match MIME. */
|
|
130
147
|
rename?: (originalName: string) => string;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
async function t(t,e){const{fit:o="cover",type:i="image/jpeg",quality:r=.85,rename:a=t=>n(t,i)}=e,c=await async function(t){var n,e;if("function"==typeof globalThis.createImageBitmap)try{return await globalThis.createImageBitmap(t,{imageOrientation:"from-image"})}catch(t){"production"!==(null===(e=null===(n=globalThis.process)||void 0===n?void 0:n.env)||void 0===e?void 0:e.NODE_ENV)&&"undefined"!=typeof console&&"function"==typeof console.debug&&console.debug("createImageBitmap failed, falling back to HTMLImageElement:",t)}return await async function(t){var n;const e=URL.createObjectURL(t);try{const t=new Image;return t.decoding="sync",t.src=e,await(null===(n=t.decode)||void 0===n?void 0:n.call(t).catch((()=>{}))),t.complete||await new Promise(((n,e)=>{const o=()=>{t.removeEventListener("load",i),t.removeEventListener("error",r)},i=()=>{o(),n()},r=t=>{o(),e(t)};t.addEventListener("load",i),t.addEventListener("error",r)})),t}finally{URL.revokeObjectURL(e)}}(t)}(t),s=c.width,l=c.height,{width:u,height:d}=function(t,n,e,o){const i="number"==typeof e&&e>0,r="number"==typeof o&&o>0;return i&&r?{width:e,height:o}:i?{width:e,height:Math.round(e*(n/t))}:r?{width:Math.round(o*(t/n)),height:o}:{width:t,height:n}}(s,l,e.width,e.height),{sx:h,sy:f,sw:w,sh:y,dx:g,dy:m,dw:p,dh:v}=function(t,n,e,o,i){const r=t/n,a=e/o;if("cover"===i){let i,c;return r>a?(c=n,i=n*a):(i=t,c=t/a),{sx:(t-i)/2,sy:(n-c)/2,sw:i,sh:c,dx:0,dy:0,dw:e,dh:o}}let c,s;r>a?(c=e,s=e/r):(s=o,c=o*r);return{sx:0,sy:0,sw:t,sh:n,dx:(e-c)/2,dy:(o-s)/2,dw:c,dh:s}}(s,l,u,d,o),b=function(t,n){if(function(){try{return"function"==typeof globalThis.OffscreenCanvas}catch(t){return!1}}())return new globalThis.OffscreenCanvas(t,n);const e=document.createElement("canvas");return e.width=t,e.height=n,e}(u,d),x=function(t){const n=t.getContext("2d",{alpha:!0});if(!n)throw new Error("2D canvas context not available");return n}(b);x.clearRect(0,0,u,d),x.drawImage(c,h,f,w,y,g,m,p,v);const T=await function(t,n,e){return"convertToBlob"in t?t.convertToBlob({type:n,quality:e}):new Promise(((o,i)=>{t.toBlob((t=>{t?o(t):i(new Error("Failed to create blob from canvas"))}),n,e)}))}(b,i,r),E=a(t.name);return new File([T],E,{type:i})}function n(t,n){const e="image/png"===n?"png":"jpg",o=t.lastIndexOf(".");return`${o>0?t.slice(0,o):t}.${e}`}export{t as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as r}from"./p-BGxJfR2f.js";import{i as o}from"./p-C4caLnTg.js";import{g as s}from"./p-CgNJbSP4.js";import{t as a}from"./p-Cb9R_zmF.js";import{c as n}from"./p-JbKhhoXs.js";import{r as l}from"./p-65ma7B85.js";import{I as h}from"./p-Dpg0OkbJ.js";import"./p-BCq5M9TE.js";import"./p-Bu_YRgCL.js";const c=class{constructor(r){t(this,r),this.change=e(this,"change"),this.filesRejected=e(this,"filesRejected"),this.language="en",this.icon="user",this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1,this.loading=!1,this.imageFit="cover",this.accept="image/jpeg,image/png,image/heic,.jpg,.jpeg,.png,.heic",this.imageError=!1,this.isErrorMessagePopoverOpen=!1,this.removeButtonId=n(),this.browseButtonId=n(),this.renderHelperText=()=>{if(this.helperText)return i("limel-tooltip",{elementId:this.browseButtonId,label:this.helperText})},this.handleNewFiles=async t=>{var e,i;if(t.stopPropagation(),this.disabled)return;const r=null===(e=t.detail)||void 0===e?void 0:e[0];if(!r)return;if(!o(r,this.accept))return void this.filesRejected.emit([r]);this.revokeObjectUrl(),this.imageError=!1;let s=r;if(this.resize&&r.fileContent instanceof File)try{const t=await l(r.fileContent,Object.assign(Object.assign({},this.resize),{fit:null!==(i=this.resize.fit)&&void 0!==i?i:this.imageFit}));s=Object.assign(Object.assign({},r),{filename:t.name,size:t.size,contentType:t.type,fileContent:t})}catch(t){s=r}!s.href&&s.fileContent instanceof File&&(this.objectUrl=URL.createObjectURL(s.fileContent)),this.change.emit(s)},this.handleRejectedFiles=t=>{t.stopPropagation(),this.filesRejected.emit(t.detail)},this.handleClear=t=>{t.stopPropagation(),this.revokeObjectUrl(),this.imageError=!1,this.change.emit(void 0)},this.onImageError=()=>{this.imageError=!0},this.openPopover=t=>{t.stopPropagation(),this.isErrorMessagePopoverOpen=!0},this.onPopoverClose=t=>{t.stopPropagation(),this.isErrorMessagePopoverOpen=!1},this.getTranslation=t=>a.get(t,this.language)}disconnectedCallback(){this.revokeObjectUrl()}handleValueChange(){this.revokeObjectUrl(),this.imageError=!1;const t=this.value;t&&"string"!=typeof t&&!t.href&&t.fileContent instanceof File&&(this.objectUrl=URL.createObjectURL(t.fileContent))}render(){const t={"has-image-error":this.imageError};return this.readonly?i(r,{class:t},this.renderAvatar()):i(r,{class:t},i("limel-file-dropzone",{disabled:this.disabled,accept:this.accept,onFilesSelected:this.handleNewFiles,onFilesRejected:this.handleRejectedFiles},i("limel-file-input",{accept:this.accept,disabled:this.disabled,"aria-required":this.required?"true":void 0,"aria-invalid":this.invalid?"true":void 0},this.renderBrowseButton())),this.renderClearButton(),this.renderSpinner(),this.renderErrorMessage(),this.renderHelperText())}get hasValue(){return"string"==typeof this.value?!!this.value:!(!this.value||!this.value.href&&!this.value.fileContent)||!!this.objectUrl}renderBrowseButton(){return i("button",{id:this.browseButtonId,type:"button",class:"avatar",disabled:this.disabled,"aria-label":this.label,"aria-busy":this.loading?"true":"false","aria-live":"polite"},this.renderAvatar())}renderAvatar(){const t=this.getImageSrc();return t?i(h,{image:{src:t,alt:"",referrerpolicy:"no-referrer"},style:{"--limel-profile-picture-object-fit":this.imageFit},onError:this.onImageError}):this.renderIcon()}renderIcon(){var t,e;const r=s(this.icon);return i("limel-icon",{name:r,style:{color:`${null===(t=this.icon)||void 0===t?void 0:t.color}`,"background-color":`${null===(e=this.icon)||void 0===e?void 0:e.backgroundColor}`}})}renderClearButton(){if(this.hasValue&&!this.disabled)return[i("button",{class:"remove",type:"button",id:this.removeButtonId,onClick:this.handleClear}),i("limel-tooltip",{label:this.getTranslation("profile-picture.remove"),elementId:this.removeButtonId})]}renderSpinner(){if(this.loading)return i("limel-spinner",null)}getUnsupportedPreviewContext(){const t=this.value;return{hasNoSrc:!this.getImageSrc(),hasLocalFile:!(!(t&&"string"!=typeof t&&t.fileContent instanceof File)||t.href),isResizeConfigured:!!this.resize}}shouldShowErrorMessage(){const{hasNoSrc:t,hasLocalFile:e,isResizeConfigured:i}=this.getUnsupportedPreviewContext();return(t||this.imageError)&&e&&i}renderErrorMessage(){if(this.shouldShowErrorMessage())return i("limel-popover",{open:this.isErrorMessagePopoverOpen,onClick:this.openPopover,onClose:this.onPopoverClose},i("limel-icon-button",{slot:"trigger",elevated:!0,icon:{name:"error",color:"rgb(var(--color-orange-dark))"},"aria-live":"polite",label:this.getTranslation("profile-picture.unsupported-preview.title")}),i("limel-callout",{type:"warning",style:{maxWidth:"20rem",borderRadius:"0.75rem"},heading:this.getTranslation("profile-picture.unsupported-preview.title")},this.getTranslation("profile-picture.unsupported-preview.description")))}getImageSrc(){return this.value?"string"==typeof this.value?this.value:this.value.href?this.value.href:this.value.fileContent instanceof File?this.objectUrl:void 0:this.objectUrl}revokeObjectUrl(){this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=void 0)}static get watchers(){return{value:[{handleValueChange:0}]}}};c.style="@charset \"UTF-8\";:host(limel-profile-picture){position:relative;display:inline-flex;min-width:1.5rem;min-height:1.5rem;border-radius:var(--profile-picture-border-radius, 100vw);background-color:rgb(var(--contrast-400))}*{box-sizing:border-box}limel-file-dropzone,limel-file-input,button.avatar{display:flex;align-items:center;justify-content:center;width:100%;height:100%}button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;display:block}button:focus{outline:none}button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.avatar{overflow:hidden;border-radius:var(--profile-picture-border-radius, 100vw)}:host(:not([disabled]):not([disabled=true])) button.avatar{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(--limel-theme-on-surface-color);background-color:transparent}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{will-change:color, background-color, box-shadow, transform}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover{box-shadow:var(--button-shadow-hovered)}:host(:not([disabled]):not([disabled=true])) button.avatar: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)}:host(:not([disabled]):not([disabled=true])) button.avatar:hover,:host(:not([disabled]):not([disabled=true])) button.avatar:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host([invalid]:not([invalid=false])) button.avatar{box-shadow:var(--shadow-error-state)}button.remove{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(--limel-theme-on-surface-color);background-color:rgb(var(--contrast-900))}button.remove:hover,button.remove:focus,button.remove:focus-visible{will-change:color, background-color, box-shadow, transform}button.remove:hover,button.remove:focus-visible{transform:translate3d(0, 0.01rem, 0);color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}button.remove:hover{box-shadow:var(--button-shadow-hovered)}button.remove: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)}button.remove:hover,button.remove:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.remove{cursor:pointer;height:1.25rem;width:1.25rem;border-radius:50%;background-repeat:no-repeat;background-position:center;background-size:0.75rem;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cdefs/%3E%3Cpath%20fill='rgb(255,255,255)'%20d='M7.219%205.781L5.78%207.22%2014.563%2016%205.78%2024.781%207.22%2026.22%2016%2017.437l8.781%208.782%201.438-1.438L17.437%2016l8.782-8.781L24.78%205.78%2016%2014.563z'/%3E%3C/svg%3E\");position:absolute;top:0;left:0;opacity:0}:host(:hover) button.remove,:host(:focus) button.remove,:host(:focus-visible) button.remove,:host(:focus-within) button.remove,:host(:active) button.remove{animation:show 0.4s ease-in-out forwards}@keyframes show{0%{transform:scale(0.9);opacity:0}100%{transform:scale(1);opacity:1}}button.avatar,img,limel-icon{border-radius:var(--profile-picture-border-radius, 100vw)}limel-icon{width:calc(100% - 1rem);min-width:1rem;max-width:4rem;color:var(--limel-theme-text-secondary-on-background-color);margin:auto}img{object-fit:var(--limel-profile-picture-object-fit);width:100%;height:100%}:host(.has-image-error) img{border:1px dashed rgb(var(--contrast-600));background:url(\"data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill='rgba(186,186,192,0.16)' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>\");background-size:0.5rem}limel-spinner{position:absolute;inset:0;margin:auto}limel-popover{position:absolute;inset:auto 0 0 auto;display:block;width:2.25rem;height:2.25rem}";export{c as limel_profile_picture}
|