@kubex/zinc 1.1.111 → 1.1.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +74 -74
- package/dist/vscode.html-custom-data.json +11 -11
- package/dist/web-types.json +23 -23
- package/dist/zn.d.ts +28 -28
- package/dist/zn.min.js +8 -8
- package/package.json +1 -1
- package/src/components/inline-edit/inline-edit.component.ts +1 -1
- package/src/components/input/input.component.ts +34 -27
- package/src/components/textarea/textarea.component.ts +2 -3
- package/src/components/translations/translations.component.ts +1 -1
- package/src/events/zn-slash-insert.ts +1 -1
- package/src/events/zn-slash-select.ts +1 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { defaultValue } from "../../internal/default-value";
|
|
|
5
5
|
import { FormControlController } from "../../internal/form";
|
|
6
6
|
import { HasSlotController } from "../../internal/slot";
|
|
7
7
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
8
|
-
import { parseSlashItems, type SlashMenuItem } from "../slash-menu
|
|
8
|
+
import { parseSlashItems, type SlashMenuItem } from "../slash-menu";
|
|
9
9
|
import { property, query, state } from 'lit/decorators.js';
|
|
10
10
|
import { watch } from "../../internal/watch";
|
|
11
11
|
import ZincElement from '../../internal/zinc-element';
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {classMap} from "lit/directives/class-map.js";
|
|
2
2
|
import {defaultValue} from "../../internal/default-value";
|
|
3
3
|
import {FormControlController} from "../../internal/form";
|
|
4
|
-
import {getSlashMenuPreset, parseSlashItems, type SlashMenuItem} from "../slash-menu
|
|
4
|
+
import {getSlashMenuPreset, parseSlashItems, type SlashMenuItem} from "../slash-menu";
|
|
5
5
|
import {HasSlotController} from "../../internal/slot";
|
|
6
6
|
import {html, unsafeCSS} from 'lit';
|
|
7
7
|
import {ifDefined} from "lit/directives/if-defined.js";
|
|
8
8
|
import {live} from "lit/directives/live.js";
|
|
9
9
|
import {LocalizeController} from "../../utilities/localize";
|
|
10
10
|
import {property, query, state} from 'lit/decorators.js';
|
|
11
|
-
import {SlashMenuController} from "../slash-menu/slash-menu-controller";
|
|
12
11
|
import {watch} from "../../internal/watch";
|
|
13
12
|
import ZincElement from '../../internal/zinc-element';
|
|
14
13
|
import ZnIcon from "../icon";
|
|
15
14
|
import ZnSlashItem from "../slash-item";
|
|
16
|
-
import ZnSlashMenu from "../slash-menu";
|
|
15
|
+
import ZnSlashMenu, {SlashMenuController} from "../slash-menu";
|
|
17
16
|
import ZnTooltip from "../tooltip";
|
|
18
17
|
import type {ZincFormControl} from '../../internal/zinc-element';
|
|
19
18
|
|
|
@@ -398,9 +397,9 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
398
397
|
const yn = y / 1.00000;
|
|
399
398
|
const zn = z / 1.08883;
|
|
400
399
|
|
|
401
|
-
const fx = xn > 0.008856 ? Math.pow(xn, 1/3) : (7.787 * xn + 16/116);
|
|
402
|
-
const fy = yn > 0.008856 ? Math.pow(yn, 1/3) : (7.787 * yn + 16/116);
|
|
403
|
-
const fz = zn > 0.008856 ? Math.pow(zn, 1/3) : (7.787 * zn + 16/116);
|
|
400
|
+
const fx = xn > 0.008856 ? Math.pow(xn, 1 / 3) : (7.787 * xn + 16 / 116);
|
|
401
|
+
const fy = yn > 0.008856 ? Math.pow(yn, 1 / 3) : (7.787 * yn + 16 / 116);
|
|
402
|
+
const fz = zn > 0.008856 ? Math.pow(zn, 1 / 3) : (7.787 * zn + 16 / 116);
|
|
404
403
|
|
|
405
404
|
const L = 116 * fy - 16;
|
|
406
405
|
const a = 500 * (fx - fy);
|
|
@@ -436,23 +435,23 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
436
435
|
const fx = a / 500 + fy;
|
|
437
436
|
const fz = fy - b_lab / 200;
|
|
438
437
|
|
|
439
|
-
const xn = fx > 0.206897 ? Math.pow(fx, 3) : (fx - 16/116) / 7.787;
|
|
440
|
-
const yn = fy > 0.206897 ? Math.pow(fy, 3) : (fy - 16/116) / 7.787;
|
|
441
|
-
const zn = fz > 0.206897 ? Math.pow(fz, 3) : (fz - 16/116) / 7.787;
|
|
438
|
+
const xn = fx > 0.206897 ? Math.pow(fx, 3) : (fx - 16 / 116) / 7.787;
|
|
439
|
+
const yn = fy > 0.206897 ? Math.pow(fy, 3) : (fy - 16 / 116) / 7.787;
|
|
440
|
+
const zn = fz > 0.206897 ? Math.pow(fz, 3) : (fz - 16 / 116) / 7.787;
|
|
442
441
|
|
|
443
442
|
const x = xn * 0.95047;
|
|
444
443
|
const y = yn * 1.00000;
|
|
445
444
|
const z = zn * 1.08883;
|
|
446
445
|
|
|
447
446
|
// Convert XYZ to RGB
|
|
448
|
-
let r = x *
|
|
449
|
-
let g = x * -0.9692660 + y *
|
|
450
|
-
let b = x *
|
|
447
|
+
let r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
|
|
448
|
+
let g = x * -0.9692660 + y * 1.8760108 + z * 0.0415560;
|
|
449
|
+
let b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
|
|
451
450
|
|
|
452
451
|
// Apply gamma correction
|
|
453
|
-
r = r > 0.0031308 ? 1.055 * Math.pow(r, 1/2.4) - 0.055 : 12.92 * r;
|
|
454
|
-
g = g > 0.0031308 ? 1.055 * Math.pow(g, 1/2.4) - 0.055 : 12.92 * g;
|
|
455
|
-
b = b > 0.0031308 ? 1.055 * Math.pow(b, 1/2.4) - 0.055 : 12.92 * b;
|
|
452
|
+
r = r > 0.0031308 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : 12.92 * r;
|
|
453
|
+
g = g > 0.0031308 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : 12.92 * g;
|
|
454
|
+
b = b > 0.0031308 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : 12.92 * b;
|
|
456
455
|
|
|
457
456
|
// Clamp and convert to hex
|
|
458
457
|
r = Math.max(0, Math.min(1, r));
|
|
@@ -469,9 +468,9 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
469
468
|
private hexToHsl(hex: string): string {
|
|
470
469
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
471
470
|
if (!result) return '';
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
471
|
+
const r = parseInt(result[1], 16) / 255;
|
|
472
|
+
const g = parseInt(result[2], 16) / 255;
|
|
473
|
+
const b = parseInt(result[3], 16) / 255;
|
|
475
474
|
|
|
476
475
|
const max = Math.max(r, g, b);
|
|
477
476
|
const min = Math.min(r, g, b);
|
|
@@ -483,9 +482,15 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
483
482
|
const d = max - min;
|
|
484
483
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
485
484
|
switch (max) {
|
|
486
|
-
case r:
|
|
487
|
-
|
|
488
|
-
|
|
485
|
+
case r:
|
|
486
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
487
|
+
break;
|
|
488
|
+
case g:
|
|
489
|
+
h = ((b - r) / d + 2) / 6;
|
|
490
|
+
break;
|
|
491
|
+
case b:
|
|
492
|
+
h = ((r - g) / d + 4) / 6;
|
|
493
|
+
break;
|
|
489
494
|
}
|
|
490
495
|
}
|
|
491
496
|
|
|
@@ -499,23 +504,25 @@ export default class ZnInput extends ZincElement implements ZincFormControl {
|
|
|
499
504
|
const s = parseInt(match[2]) / 100;
|
|
500
505
|
const l = parseInt(match[3]) / 100;
|
|
501
506
|
|
|
502
|
-
let r: number
|
|
507
|
+
let r: number;
|
|
508
|
+
let g: number;
|
|
509
|
+
let b: number;
|
|
503
510
|
if (s === 0) {
|
|
504
511
|
r = g = b = l;
|
|
505
512
|
} else {
|
|
506
513
|
const hue2rgb = (p: number, q: number, t: number) => {
|
|
507
514
|
if (t < 0) t += 1;
|
|
508
515
|
if (t > 1) t -= 1;
|
|
509
|
-
if (t < 1/6) return p + (q - p) * 6 * t;
|
|
510
|
-
if (t < 1/2) return q;
|
|
511
|
-
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
516
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
517
|
+
if (t < 1 / 2) return q;
|
|
518
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
512
519
|
return p;
|
|
513
520
|
};
|
|
514
521
|
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
515
522
|
const p = 2 * l - q;
|
|
516
|
-
r = hue2rgb(p, q, h + 1/3);
|
|
523
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
517
524
|
g = hue2rgb(p, q, h);
|
|
518
|
-
b = hue2rgb(p, q, h - 1/3);
|
|
525
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
519
526
|
}
|
|
520
527
|
|
|
521
528
|
const rHex = Math.round(r * 255).toString(16).padStart(2, '0');
|
|
@@ -2,17 +2,16 @@ import {classMap} from "lit/directives/class-map.js";
|
|
|
2
2
|
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
3
3
|
import {defaultValue} from "../../internal/default-value";
|
|
4
4
|
import {FormControlController} from "../../internal/form";
|
|
5
|
-
import {getSlashMenuPreset, parseSlashItems, type SlashMenuItem} from "../slash-menu
|
|
5
|
+
import {getSlashMenuPreset, parseSlashItems, type SlashMenuItem} from "../slash-menu";
|
|
6
6
|
import {HasSlotController} from "../../internal/slot";
|
|
7
7
|
import {ifDefined} from "lit/directives/if-defined.js";
|
|
8
8
|
import {live} from "lit/directives/live.js";
|
|
9
9
|
import {property, query, state} from 'lit/decorators.js';
|
|
10
10
|
import {ResizeController} from '@lit-labs/observers/resize-controller.js';
|
|
11
|
-
import {SlashMenuController} from "../slash-menu/slash-menu-controller";
|
|
12
11
|
import {watch} from '../../internal/watch';
|
|
13
12
|
import ZincElement, {type ZincFormControl} from '../../internal/zinc-element';
|
|
14
13
|
import ZnSlashItem from "../slash-item";
|
|
15
|
-
import ZnSlashMenu from "../slash-menu";
|
|
14
|
+
import ZnSlashMenu, {SlashMenuController} from "../slash-menu";
|
|
16
15
|
|
|
17
16
|
import formControlStyles from '../../form-control.scss';
|
|
18
17
|
import styles from './textarea.scss';
|
|
@@ -5,7 +5,7 @@ import {html, nothing, unsafeCSS} from 'lit';
|
|
|
5
5
|
import {ifDefined} from 'lit/directives/if-defined.js';
|
|
6
6
|
import {keyed} from 'lit/directives/keyed.js';
|
|
7
7
|
import {live} from 'lit/directives/live.js';
|
|
8
|
-
import {parseSlashItems, type SlashMenuItem} from '../slash-menu
|
|
8
|
+
import {parseSlashItems, type SlashMenuItem} from '../slash-menu';
|
|
9
9
|
import {property, state} from 'lit/decorators.js';
|
|
10
10
|
import {ResizeController} from '@lit-labs/observers/resize-controller.js';
|
|
11
11
|
import ZincElement from '../../internal/zinc-element';
|