@thalassic/ui 22.6.0 → 22.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thalassic-ui.mjs +565 -3
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +132 -4
|
@@ -739,6 +739,7 @@ class Badge {
|
|
|
739
739
|
dot = input(false, { ...(ngDevMode ? { debugName: "dot" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
740
740
|
showZero = input(false, { ...(ngDevMode ? { debugName: "showZero" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
741
741
|
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
742
|
+
inset = input(false, { ...(ngDevMode ? { debugName: "inset" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
742
743
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
743
744
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
744
745
|
// Computed
|
|
@@ -781,18 +782,20 @@ class Badge {
|
|
|
781
782
|
array.push(`${className}--${this.size()}`);
|
|
782
783
|
if (this.dot())
|
|
783
784
|
array.push(`${className}--dot`);
|
|
785
|
+
if (this.inset())
|
|
786
|
+
array.push(`${className}--inset`);
|
|
784
787
|
return array;
|
|
785
788
|
}, /* @ts-ignore */
|
|
786
789
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
787
790
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
788
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
791
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
789
792
|
}
|
|
790
793
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, decorators: [{
|
|
791
794
|
type: Component,
|
|
792
795
|
args: [{ selector: 'tls-badge', imports: [], host: {
|
|
793
796
|
'[class]': 'hostClasses()',
|
|
794
797
|
}, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" }]
|
|
795
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
798
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
796
799
|
|
|
797
800
|
const DEFAULT_BUTTON_CONFIG = {
|
|
798
801
|
color: 'primary',
|
|
@@ -4614,6 +4617,173 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4614
4617
|
args: [{ selector: 'tls-textarea', imports: [CdkTextareaAutosize, Loader], host: { class: 'tls-textarea' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"effectiveResize()\"\n [value]=\"value()\"\n [cdkTextareaAutosize]=\"autosize()\"\n [cdkAutosizeMinRows]=\"rows()\"\n [cdkAutosizeMaxRows]=\"maxRows()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-textarea-width: 200px;position:relative;display:inline-block;width:var(--tls-textarea-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block-start:var(--spacing-2);inset-inline-end:var(--spacing-3);pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-textarea-width: 100%}\n"] }]
|
|
4615
4618
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }], autosize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autosize", required: false }] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", required: false }] }] } });
|
|
4616
4619
|
|
|
4620
|
+
const DEFAULT_IMAGE_COMPARE_CONFIG = {
|
|
4621
|
+
orientation: 'horizontal',
|
|
4622
|
+
position: 50,
|
|
4623
|
+
keyboardStep: 5,
|
|
4624
|
+
};
|
|
4625
|
+
|
|
4626
|
+
const IMAGE_COMPARE_CONFIG = new InjectionToken('IMAGE_COMPARE_CONFIG', {
|
|
4627
|
+
factory: () => DEFAULT_IMAGE_COMPARE_CONFIG,
|
|
4628
|
+
});
|
|
4629
|
+
|
|
4630
|
+
class ImageCompare {
|
|
4631
|
+
// Injections
|
|
4632
|
+
_config = inject(IMAGE_COMPARE_CONFIG);
|
|
4633
|
+
_elementRef = inject(ElementRef);
|
|
4634
|
+
_directionality = inject(Directionality);
|
|
4635
|
+
// Inputs
|
|
4636
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
4637
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
4638
|
+
keyboardStep = input(this._config.keyboardStep, /* @ts-ignore */
|
|
4639
|
+
...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
|
|
4640
|
+
/**
|
|
4641
|
+
* Divider position as a percentage (0–100) from the layout-start edge. Two-way
|
|
4642
|
+
* bound so consumers can drive or persist it while interaction updates it.
|
|
4643
|
+
*/
|
|
4644
|
+
position = model(this._config.position, /* @ts-ignore */
|
|
4645
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
4646
|
+
/** Accessible name for the divider slider. */
|
|
4647
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
4648
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
4649
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
4650
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
4651
|
+
// State
|
|
4652
|
+
_handle = viewChild.required('handle');
|
|
4653
|
+
_dragging = signal(false, /* @ts-ignore */
|
|
4654
|
+
...(ngDevMode ? [{ debugName: "_dragging" }] : /* istanbul ignore next */ []));
|
|
4655
|
+
// Computed
|
|
4656
|
+
isHorizontal = computed(() => this.orientation() === 'horizontal', /* @ts-ignore */
|
|
4657
|
+
...(ngDevMode ? [{ debugName: "isHorizontal" }] : /* istanbul ignore next */ []));
|
|
4658
|
+
clampedPosition = computed(() => Math.min(100, Math.max(0, this.position())), /* @ts-ignore */
|
|
4659
|
+
...(ngDevMode ? [{ debugName: "clampedPosition" }] : /* istanbul ignore next */ []));
|
|
4660
|
+
valueNow = computed(() => Math.round(this.clampedPosition()), /* @ts-ignore */
|
|
4661
|
+
...(ngDevMode ? [{ debugName: "valueNow" }] : /* istanbul ignore next */ []));
|
|
4662
|
+
hostClasses = computed(() => {
|
|
4663
|
+
const className = 'tls-image-compare';
|
|
4664
|
+
const array = [className];
|
|
4665
|
+
array.push(`${className}--${this.orientation()}`);
|
|
4666
|
+
if (this._dragging())
|
|
4667
|
+
array.push(`${className}--dragging`);
|
|
4668
|
+
return array;
|
|
4669
|
+
}, /* @ts-ignore */
|
|
4670
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
4671
|
+
// Clip the leading (before) layer to a band running from the layout-start edge
|
|
4672
|
+
// to the divider. `clip-path` is physical, so resolve the inset per axis — and
|
|
4673
|
+
// for RTL — explicitly, since logical properties cannot express it.
|
|
4674
|
+
clipPath = computed(() => {
|
|
4675
|
+
const remainder = 100 - this.clampedPosition();
|
|
4676
|
+
if (!this.isHorizontal())
|
|
4677
|
+
return `inset(0 0 ${remainder}% 0)`;
|
|
4678
|
+
return this._isRtl() ? `inset(0 0 0 ${remainder}%)` : `inset(0 ${remainder}% 0 0)`;
|
|
4679
|
+
}, /* @ts-ignore */
|
|
4680
|
+
...(ngDevMode ? [{ debugName: "clipPath" }] : /* istanbul ignore next */ []));
|
|
4681
|
+
// Protected methods
|
|
4682
|
+
onPointerDown(event) {
|
|
4683
|
+
// Ignore non-primary mouse buttons; touch/pen report button 0.
|
|
4684
|
+
if (event.pointerType === 'mouse' && event.button !== 0)
|
|
4685
|
+
return;
|
|
4686
|
+
event.preventDefault();
|
|
4687
|
+
// `preventDefault` suppresses the default focus, so focus the slider handle
|
|
4688
|
+
// explicitly — otherwise the arrow keys wouldn't work after a pointer drag.
|
|
4689
|
+
this._handle().nativeElement.focus();
|
|
4690
|
+
this._dragging.set(true);
|
|
4691
|
+
this._elementRef.nativeElement.setPointerCapture(event.pointerId);
|
|
4692
|
+
this._updateFromPointer(event);
|
|
4693
|
+
}
|
|
4694
|
+
onPointerMove(event) {
|
|
4695
|
+
if (!this._dragging())
|
|
4696
|
+
return;
|
|
4697
|
+
this._updateFromPointer(event);
|
|
4698
|
+
}
|
|
4699
|
+
onPointerUp(event) {
|
|
4700
|
+
if (!this._dragging())
|
|
4701
|
+
return;
|
|
4702
|
+
this._elementRef.nativeElement.releasePointerCapture(event.pointerId);
|
|
4703
|
+
this._dragging.set(false);
|
|
4704
|
+
}
|
|
4705
|
+
// Pointer capture is already released once the browser cancels the pointer, so
|
|
4706
|
+
// this only resets drag state (calling `releasePointerCapture` here can throw).
|
|
4707
|
+
onPointerCancel() {
|
|
4708
|
+
this._dragging.set(false);
|
|
4709
|
+
}
|
|
4710
|
+
onHandleKeydown(event) {
|
|
4711
|
+
const step = this.keyboardStep();
|
|
4712
|
+
const horizontal = this.isHorizontal();
|
|
4713
|
+
const rtl = this._isRtl();
|
|
4714
|
+
const current = this.clampedPosition();
|
|
4715
|
+
let desired;
|
|
4716
|
+
switch (event.key) {
|
|
4717
|
+
case 'ArrowLeft':
|
|
4718
|
+
if (!horizontal)
|
|
4719
|
+
return;
|
|
4720
|
+
desired = current + (rtl ? step : -step);
|
|
4721
|
+
break;
|
|
4722
|
+
case 'ArrowRight':
|
|
4723
|
+
if (!horizontal)
|
|
4724
|
+
return;
|
|
4725
|
+
desired = current + (rtl ? -step : step);
|
|
4726
|
+
break;
|
|
4727
|
+
case 'ArrowUp':
|
|
4728
|
+
if (horizontal)
|
|
4729
|
+
return;
|
|
4730
|
+
desired = current - step;
|
|
4731
|
+
break;
|
|
4732
|
+
case 'ArrowDown':
|
|
4733
|
+
if (horizontal)
|
|
4734
|
+
return;
|
|
4735
|
+
desired = current + step;
|
|
4736
|
+
break;
|
|
4737
|
+
case 'Home':
|
|
4738
|
+
desired = 0;
|
|
4739
|
+
break;
|
|
4740
|
+
case 'End':
|
|
4741
|
+
desired = 100;
|
|
4742
|
+
break;
|
|
4743
|
+
default:
|
|
4744
|
+
return;
|
|
4745
|
+
}
|
|
4746
|
+
event.preventDefault();
|
|
4747
|
+
this._setPosition(desired);
|
|
4748
|
+
}
|
|
4749
|
+
// Private methods
|
|
4750
|
+
_isRtl() {
|
|
4751
|
+
return this._directionality.value === 'rtl';
|
|
4752
|
+
}
|
|
4753
|
+
_updateFromPointer(event) {
|
|
4754
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
4755
|
+
let ratio;
|
|
4756
|
+
if (this.isHorizontal()) {
|
|
4757
|
+
if (rect.width <= 0)
|
|
4758
|
+
return;
|
|
4759
|
+
ratio = (event.clientX - rect.left) / rect.width;
|
|
4760
|
+
if (this._isRtl())
|
|
4761
|
+
ratio = 1 - ratio;
|
|
4762
|
+
}
|
|
4763
|
+
else {
|
|
4764
|
+
if (rect.height <= 0)
|
|
4765
|
+
return;
|
|
4766
|
+
ratio = (event.clientY - rect.top) / rect.height;
|
|
4767
|
+
}
|
|
4768
|
+
this._setPosition(ratio * 100);
|
|
4769
|
+
}
|
|
4770
|
+
_setPosition(value) {
|
|
4771
|
+
this.position.set(Math.min(100, Math.max(0, value)));
|
|
4772
|
+
}
|
|
4773
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ImageCompare, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4774
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: ImageCompare, isStandalone: true, selector: "tls-image-compare", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, keyboardStep: { classPropertyName: "keyboardStep", publicName: "keyboardStep", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { position: "positionChange" }, host: { listeners: { "pointerdown": "onPointerDown($event)", "pointermove": "onPointerMove($event)", "pointerup": "onPointerUp($event)", "pointercancel": "onPointerCancel()" }, properties: { "class": "hostClasses()" } }, viewQueries: [{ propertyName: "_handle", first: true, predicate: ["handle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"tls-image-compare__layer tls-image-compare__after\">\n <ng-content select=\"[after]\"></ng-content>\n</div>\n\n<div class=\"tls-image-compare__layer tls-image-compare__before\" [style.clip-path]=\"clipPath()\">\n <ng-content select=\"[before]\"></ng-content>\n</div>\n\n<div\n #handle\n class=\"tls-image-compare__handle\"\n role=\"slider\"\n tabindex=\"0\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-valuenow]=\"valueNow()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [style.inset-inline-start.%]=\"isHorizontal() ? clampedPosition() : null\"\n [style.inset-block-start.%]=\"isHorizontal() ? null : clampedPosition()\"\n (keydown)=\"onHandleKeydown($event)\"\n>\n <span class=\"tls-image-compare__grip\" aria-hidden=\"true\"></span>\n</div>\n" });
|
|
4775
|
+
}
|
|
4776
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ImageCompare, decorators: [{
|
|
4777
|
+
type: Component,
|
|
4778
|
+
args: [{ selector: 'tls-image-compare', imports: [], host: {
|
|
4779
|
+
'[class]': 'hostClasses()',
|
|
4780
|
+
'(pointerdown)': 'onPointerDown($event)',
|
|
4781
|
+
'(pointermove)': 'onPointerMove($event)',
|
|
4782
|
+
'(pointerup)': 'onPointerUp($event)',
|
|
4783
|
+
'(pointercancel)': 'onPointerCancel()',
|
|
4784
|
+
}, template: "<div class=\"tls-image-compare__layer tls-image-compare__after\">\n <ng-content select=\"[after]\"></ng-content>\n</div>\n\n<div class=\"tls-image-compare__layer tls-image-compare__before\" [style.clip-path]=\"clipPath()\">\n <ng-content select=\"[before]\"></ng-content>\n</div>\n\n<div\n #handle\n class=\"tls-image-compare__handle\"\n role=\"slider\"\n tabindex=\"0\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-valuenow]=\"valueNow()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [style.inset-inline-start.%]=\"isHorizontal() ? clampedPosition() : null\"\n [style.inset-block-start.%]=\"isHorizontal() ? null : clampedPosition()\"\n (keydown)=\"onHandleKeydown($event)\"\n>\n <span class=\"tls-image-compare__grip\" aria-hidden=\"true\"></span>\n</div>\n" }]
|
|
4785
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }, { type: i0.Output, args: ["positionChange"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], _handle: [{ type: i0.ViewChild, args: ['handle', { isSignal: true }] }] } });
|
|
4786
|
+
|
|
4617
4787
|
class MenuItemComponent {
|
|
4618
4788
|
key = input.required(/* @ts-ignore */
|
|
4619
4789
|
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
@@ -5226,6 +5396,390 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
5226
5396
|
}]
|
|
5227
5397
|
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }] } });
|
|
5228
5398
|
|
|
5399
|
+
/** Overshoot past a collapsible panel's `min` (in %) that snaps it shut mid-resize. */
|
|
5400
|
+
const COLLAPSE_SNAP_OVERSHOOT = 5;
|
|
5401
|
+
|
|
5402
|
+
const DEFAULT_SPLITTER_CONFIG = {
|
|
5403
|
+
orientation: 'horizontal',
|
|
5404
|
+
keyboardStep: 5,
|
|
5405
|
+
};
|
|
5406
|
+
|
|
5407
|
+
const SPLITTER_CONFIG = new InjectionToken('SPLITTER_CONFIG', {
|
|
5408
|
+
factory: () => DEFAULT_SPLITTER_CONFIG,
|
|
5409
|
+
});
|
|
5410
|
+
|
|
5411
|
+
let nextPanelId = 0;
|
|
5412
|
+
class SplitterPanel {
|
|
5413
|
+
// Injections
|
|
5414
|
+
_elementRef = inject(ElementRef);
|
|
5415
|
+
// State
|
|
5416
|
+
id = `tls-splitter-panel-${nextPanelId++}`;
|
|
5417
|
+
// Inputs
|
|
5418
|
+
/**
|
|
5419
|
+
* Current size of the panel as a percentage of the splitter. Two-way bound so
|
|
5420
|
+
* the owning splitter can update it during a resize and consumers can persist
|
|
5421
|
+
* the resulting layout. `null` requests an auto share of the remaining space.
|
|
5422
|
+
*/
|
|
5423
|
+
size = model(null, /* @ts-ignore */
|
|
5424
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
5425
|
+
min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
5426
|
+
max = input(100, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
5427
|
+
collapsible = input(false, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5428
|
+
collapsed = model(false, /* @ts-ignore */
|
|
5429
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
5430
|
+
// Computed
|
|
5431
|
+
resolvedSize = computed(() => this.size() ?? 0, /* @ts-ignore */
|
|
5432
|
+
...(ngDevMode ? [{ debugName: "resolvedSize" }] : /* istanbul ignore next */ []));
|
|
5433
|
+
hostClasses = computed(() => {
|
|
5434
|
+
const className = 'tls-splitter-panel';
|
|
5435
|
+
const array = [className];
|
|
5436
|
+
if (this.collapsed())
|
|
5437
|
+
array.push(`${className}--collapsed`);
|
|
5438
|
+
return array;
|
|
5439
|
+
}, /* @ts-ignore */
|
|
5440
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5441
|
+
// Accessors
|
|
5442
|
+
get element() {
|
|
5443
|
+
return this._elementRef.nativeElement;
|
|
5444
|
+
}
|
|
5445
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SplitterPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5446
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: SplitterPanel, isStandalone: true, selector: "tls-splitter-panel", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { size: "sizeChange", collapsed: "collapsedChange" }, host: { properties: { "class": "hostClasses()", "id": "id", "style.flex-grow": "resolvedSize()", "style.flex-basis.%": "0", "style.flex-shrink": "1" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
|
|
5447
|
+
}
|
|
5448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: SplitterPanel, decorators: [{
|
|
5449
|
+
type: Component,
|
|
5450
|
+
args: [{
|
|
5451
|
+
selector: 'tls-splitter-panel',
|
|
5452
|
+
imports: [],
|
|
5453
|
+
template: '<ng-content></ng-content>',
|
|
5454
|
+
host: {
|
|
5455
|
+
'[class]': 'hostClasses()',
|
|
5456
|
+
'[id]': 'id',
|
|
5457
|
+
// Panels are weighted flex items: `size` acts as the grow weight while
|
|
5458
|
+
// `flex-basis: 0` lets the weights fully partition the container.
|
|
5459
|
+
'[style.flex-grow]': 'resolvedSize()',
|
|
5460
|
+
'[style.flex-basis.%]': '0',
|
|
5461
|
+
'[style.flex-shrink]': '1',
|
|
5462
|
+
},
|
|
5463
|
+
}]
|
|
5464
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }] } });
|
|
5465
|
+
|
|
5466
|
+
class Splitter {
|
|
5467
|
+
// Injections
|
|
5468
|
+
_config = inject(SPLITTER_CONFIG);
|
|
5469
|
+
_elementRef = inject(ElementRef);
|
|
5470
|
+
_directionality = inject(Directionality);
|
|
5471
|
+
// Inputs
|
|
5472
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
5473
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
5474
|
+
keyboardStep = input(this._config.keyboardStep, /* @ts-ignore */
|
|
5475
|
+
...(ngDevMode ? [{ debugName: "keyboardStep" }] : /* istanbul ignore next */ []));
|
|
5476
|
+
/** Accessible name for the group of panels and their separators. */
|
|
5477
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
5478
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
5479
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
5480
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
5481
|
+
// State
|
|
5482
|
+
// `descendants: false` scopes the query to this splitter's own panels; without
|
|
5483
|
+
// it a nested `tls-splitter`'s panels would be counted here too.
|
|
5484
|
+
panels = contentChildren(SplitterPanel, { ...(ngDevMode ? { debugName: "panels" } : /* istanbul ignore next */ {}), descendants: false });
|
|
5485
|
+
_activeSeam = signal(null, /* @ts-ignore */
|
|
5486
|
+
...(ngDevMode ? [{ debugName: "_activeSeam" }] : /* istanbul ignore next */ []));
|
|
5487
|
+
// Transient drag bookkeeping, captured on pointer down.
|
|
5488
|
+
_dragContainerSize = 0;
|
|
5489
|
+
_dragStartCoordinate = 0;
|
|
5490
|
+
_dragStartSize = 0;
|
|
5491
|
+
// Restore sizes for collapsed panels, keyed by the panel that owns them.
|
|
5492
|
+
_collapsedSizes = new WeakMap();
|
|
5493
|
+
_collapsedFlags = new WeakMap();
|
|
5494
|
+
// Computed
|
|
5495
|
+
isHorizontal = computed(() => this.orientation() === 'horizontal', /* @ts-ignore */
|
|
5496
|
+
...(ngDevMode ? [{ debugName: "isHorizontal" }] : /* istanbul ignore next */ []));
|
|
5497
|
+
ariaOrientation = computed(() => this.isHorizontal() ? 'vertical' : 'horizontal', /* @ts-ignore */
|
|
5498
|
+
...(ngDevMode ? [{ debugName: "ariaOrientation" }] : /* istanbul ignore next */ []));
|
|
5499
|
+
hostClasses = computed(() => {
|
|
5500
|
+
const className = 'tls-splitter';
|
|
5501
|
+
const array = [className];
|
|
5502
|
+
array.push(`${className}--${this.orientation()}`);
|
|
5503
|
+
if (this._activeSeam() !== null)
|
|
5504
|
+
array.push(`${className}--resizing`);
|
|
5505
|
+
return array;
|
|
5506
|
+
}, /* @ts-ignore */
|
|
5507
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5508
|
+
seams = computed(() => {
|
|
5509
|
+
const panels = this.panels();
|
|
5510
|
+
if (panels.length < 2)
|
|
5511
|
+
return [];
|
|
5512
|
+
const sizes = panels.map(panel => panel.size() ?? 0);
|
|
5513
|
+
const total = sizes.reduce((sum, size) => sum + size, 0);
|
|
5514
|
+
if (total <= 0)
|
|
5515
|
+
return [];
|
|
5516
|
+
const seams = [];
|
|
5517
|
+
let cumulative = 0;
|
|
5518
|
+
for (let index = 0; index < panels.length - 1; index++) {
|
|
5519
|
+
const leading = panels[index];
|
|
5520
|
+
const trailing = panels[index + 1];
|
|
5521
|
+
const pairSum = sizes[index] + sizes[index + 1];
|
|
5522
|
+
// Bound the reported range by the whole pair, not just the leading
|
|
5523
|
+
// panel's own min/max, so it matches what a resize can actually reach.
|
|
5524
|
+
const valueMin = Math.round((this._lowerBound(leading, trailing, pairSum) / total) * 100);
|
|
5525
|
+
const valueMax = Math.round((this._upperBound(leading, trailing, pairSum) / total) * 100);
|
|
5526
|
+
const valueNow = Math.min(Math.max(Math.round((sizes[index] / total) * 100), valueMin), valueMax);
|
|
5527
|
+
cumulative += sizes[index];
|
|
5528
|
+
seams.push({
|
|
5529
|
+
index,
|
|
5530
|
+
position: (cumulative / total) * 100,
|
|
5531
|
+
valueNow,
|
|
5532
|
+
valueMin,
|
|
5533
|
+
valueMax,
|
|
5534
|
+
controls: `${leading.id} ${trailing.id}`,
|
|
5535
|
+
});
|
|
5536
|
+
}
|
|
5537
|
+
return seams;
|
|
5538
|
+
}, /* @ts-ignore */
|
|
5539
|
+
...(ngDevMode ? [{ debugName: "seams" }] : /* istanbul ignore next */ []));
|
|
5540
|
+
constructor() {
|
|
5541
|
+
// Resolve `null` panel sizes into an equal share of the remaining space,
|
|
5542
|
+
// then normalize the whole set to sum to 100%.
|
|
5543
|
+
effect(() => this._initializeSizes());
|
|
5544
|
+
// Reflect each panel's `collapsed` model into a size of 0, restoring the
|
|
5545
|
+
// previous size (from its neighbour) when it expands again.
|
|
5546
|
+
effect(() => this._syncCollapsedPanels());
|
|
5547
|
+
}
|
|
5548
|
+
// Protected methods
|
|
5549
|
+
onGutterPointerDown(seamIndex, event) {
|
|
5550
|
+
const panels = this.panels();
|
|
5551
|
+
const leading = panels[seamIndex];
|
|
5552
|
+
const trailing = panels[seamIndex + 1];
|
|
5553
|
+
if (!leading || !trailing)
|
|
5554
|
+
return;
|
|
5555
|
+
event.preventDefault();
|
|
5556
|
+
// `preventDefault` suppresses the default focus, so focus the gutter
|
|
5557
|
+
// explicitly — otherwise the arrow keys wouldn't work after a pointer drag.
|
|
5558
|
+
const gutter = event.target;
|
|
5559
|
+
gutter.focus();
|
|
5560
|
+
const rect = this._elementRef.nativeElement.getBoundingClientRect();
|
|
5561
|
+
this._dragContainerSize = this.isHorizontal() ? rect.width : rect.height;
|
|
5562
|
+
this._dragStartCoordinate = this.isHorizontal() ? event.clientX : event.clientY;
|
|
5563
|
+
this._dragStartSize = leading.size() ?? 0;
|
|
5564
|
+
this._activeSeam.set(seamIndex);
|
|
5565
|
+
gutter.setPointerCapture(event.pointerId);
|
|
5566
|
+
}
|
|
5567
|
+
onGutterPointerMove(seamIndex, event) {
|
|
5568
|
+
if (this._activeSeam() !== seamIndex)
|
|
5569
|
+
return;
|
|
5570
|
+
if (this._dragContainerSize <= 0)
|
|
5571
|
+
return;
|
|
5572
|
+
const coordinate = this.isHorizontal() ? event.clientX : event.clientY;
|
|
5573
|
+
let deltaPixels = coordinate - this._dragStartCoordinate;
|
|
5574
|
+
if (this.isHorizontal() && this._isRtl())
|
|
5575
|
+
deltaPixels = -deltaPixels;
|
|
5576
|
+
const deltaPercent = (deltaPixels / this._dragContainerSize) * 100;
|
|
5577
|
+
this._applySeamSize(seamIndex, this._dragStartSize + deltaPercent);
|
|
5578
|
+
}
|
|
5579
|
+
onGutterPointerUp(seamIndex, event) {
|
|
5580
|
+
if (this._activeSeam() !== seamIndex)
|
|
5581
|
+
return;
|
|
5582
|
+
event.target.releasePointerCapture(event.pointerId);
|
|
5583
|
+
this._activeSeam.set(null);
|
|
5584
|
+
}
|
|
5585
|
+
// Pointer capture is already released once the browser cancels the pointer, so
|
|
5586
|
+
// this only resets drag state (calling `releasePointerCapture` here can throw).
|
|
5587
|
+
onGutterPointerCancel(seamIndex) {
|
|
5588
|
+
if (this._activeSeam() !== seamIndex)
|
|
5589
|
+
return;
|
|
5590
|
+
this._activeSeam.set(null);
|
|
5591
|
+
}
|
|
5592
|
+
onGutterKeydown(seamIndex, event) {
|
|
5593
|
+
const panels = this.panels();
|
|
5594
|
+
const leading = panels[seamIndex];
|
|
5595
|
+
const trailing = panels[seamIndex + 1];
|
|
5596
|
+
if (!leading || !trailing)
|
|
5597
|
+
return;
|
|
5598
|
+
const step = this.keyboardStep();
|
|
5599
|
+
const horizontal = this.isHorizontal();
|
|
5600
|
+
const rtl = this._isRtl();
|
|
5601
|
+
const pairSum = (leading.size() ?? 0) + (trailing.size() ?? 0);
|
|
5602
|
+
const current = leading.size() ?? 0;
|
|
5603
|
+
let desired;
|
|
5604
|
+
switch (event.key) {
|
|
5605
|
+
case 'ArrowLeft':
|
|
5606
|
+
if (!horizontal)
|
|
5607
|
+
return;
|
|
5608
|
+
desired = current + (rtl ? step : -step);
|
|
5609
|
+
break;
|
|
5610
|
+
case 'ArrowRight':
|
|
5611
|
+
if (!horizontal)
|
|
5612
|
+
return;
|
|
5613
|
+
desired = current + (rtl ? -step : step);
|
|
5614
|
+
break;
|
|
5615
|
+
case 'ArrowUp':
|
|
5616
|
+
if (horizontal)
|
|
5617
|
+
return;
|
|
5618
|
+
desired = current - step;
|
|
5619
|
+
break;
|
|
5620
|
+
case 'ArrowDown':
|
|
5621
|
+
if (horizontal)
|
|
5622
|
+
return;
|
|
5623
|
+
desired = current + step;
|
|
5624
|
+
break;
|
|
5625
|
+
case 'Home':
|
|
5626
|
+
desired = this._lowerBound(leading, trailing, pairSum);
|
|
5627
|
+
break;
|
|
5628
|
+
case 'End':
|
|
5629
|
+
desired = this._upperBound(leading, trailing, pairSum);
|
|
5630
|
+
break;
|
|
5631
|
+
default:
|
|
5632
|
+
return;
|
|
5633
|
+
}
|
|
5634
|
+
event.preventDefault();
|
|
5635
|
+
// Keyboard steps are discrete, so collapse/expand can't rely on the pointer
|
|
5636
|
+
// path's overshoot. Resolve it explicitly from the key's direction instead.
|
|
5637
|
+
const shrinkLeading = desired < current;
|
|
5638
|
+
const growLeading = desired > current;
|
|
5639
|
+
if (leading.collapsed() && growLeading)
|
|
5640
|
+
return this._expand(leading, trailing);
|
|
5641
|
+
if (trailing.collapsed() && shrinkLeading)
|
|
5642
|
+
return this._expand(trailing, leading);
|
|
5643
|
+
// Pushing a panel that already sits at its min further shut collapses it.
|
|
5644
|
+
if (leading.collapsible() && shrinkLeading && (leading.size() ?? 0) <= leading.min()) {
|
|
5645
|
+
return this._collapse(leading, trailing, pairSum);
|
|
5646
|
+
}
|
|
5647
|
+
if (trailing.collapsible() && growLeading && (trailing.size() ?? 0) <= trailing.min()) {
|
|
5648
|
+
return this._collapse(trailing, leading, pairSum);
|
|
5649
|
+
}
|
|
5650
|
+
this._applySeamSize(seamIndex, desired);
|
|
5651
|
+
}
|
|
5652
|
+
// Private methods
|
|
5653
|
+
_isRtl() {
|
|
5654
|
+
return this._directionality.value === 'rtl';
|
|
5655
|
+
}
|
|
5656
|
+
_lowerBound(leading, trailing, pairSum) {
|
|
5657
|
+
return Math.max(leading.min(), pairSum - trailing.max());
|
|
5658
|
+
}
|
|
5659
|
+
_upperBound(leading, trailing, pairSum) {
|
|
5660
|
+
return Math.min(leading.max(), pairSum - trailing.min());
|
|
5661
|
+
}
|
|
5662
|
+
// Sets the leading panel to `desiredSize`, clamped so both panels honour their
|
|
5663
|
+
// min/max, and gives the remainder of the pair to the trailing panel. A
|
|
5664
|
+
// `collapsible` panel dragged past its `min` snaps shut instead of clamping.
|
|
5665
|
+
_applySeamSize(seamIndex, desiredSize) {
|
|
5666
|
+
const panels = this.panels();
|
|
5667
|
+
const leading = panels[seamIndex];
|
|
5668
|
+
const trailing = panels[seamIndex + 1];
|
|
5669
|
+
if (!leading || !trailing)
|
|
5670
|
+
return;
|
|
5671
|
+
const pairSum = (leading.size() ?? 0) + (trailing.size() ?? 0);
|
|
5672
|
+
if (leading.collapsible() && desiredSize < leading.min() - COLLAPSE_SNAP_OVERSHOOT) {
|
|
5673
|
+
this._collapse(leading, trailing, pairSum);
|
|
5674
|
+
return;
|
|
5675
|
+
}
|
|
5676
|
+
if (trailing.collapsible() && pairSum - desiredSize < trailing.min() - COLLAPSE_SNAP_OVERSHOOT) {
|
|
5677
|
+
this._collapse(trailing, leading, pairSum);
|
|
5678
|
+
return;
|
|
5679
|
+
}
|
|
5680
|
+
const lower = this._lowerBound(leading, trailing, pairSum);
|
|
5681
|
+
const upper = this._upperBound(leading, trailing, pairSum);
|
|
5682
|
+
if (lower > upper)
|
|
5683
|
+
return;
|
|
5684
|
+
const leadingSize = Math.min(Math.max(desiredSize, lower), upper);
|
|
5685
|
+
// A valid resize sits both panels at or above their min, so neither stays
|
|
5686
|
+
// collapsed — clear any collapsed state the pair still carries.
|
|
5687
|
+
this._setCollapsedState(leading, false);
|
|
5688
|
+
this._setCollapsedState(trailing, false);
|
|
5689
|
+
leading.size.set(leadingSize);
|
|
5690
|
+
trailing.size.set(pairSum - leadingSize);
|
|
5691
|
+
}
|
|
5692
|
+
// Collapses `panel` to zero, handing its space to `neighbour`. Expanding again
|
|
5693
|
+
// restores the panel to its `min`.
|
|
5694
|
+
_collapse(panel, neighbour, pairSum) {
|
|
5695
|
+
this._collapsedSizes.set(panel, panel.min());
|
|
5696
|
+
this._setCollapsedState(panel, true);
|
|
5697
|
+
this._setCollapsedState(neighbour, false);
|
|
5698
|
+
panel.size.set(0);
|
|
5699
|
+
neighbour.size.set(pairSum);
|
|
5700
|
+
}
|
|
5701
|
+
// Expands a collapsed `panel` back to its restore size, taking the space from
|
|
5702
|
+
// `neighbour`. Bounded by whatever the neighbour can actually give up.
|
|
5703
|
+
_expand(panel, neighbour) {
|
|
5704
|
+
const pairSum = (panel.size() ?? 0) + (neighbour.size() ?? 0);
|
|
5705
|
+
const restore = Math.min(this._collapsedSizes.get(panel) ?? panel.min(), pairSum);
|
|
5706
|
+
this._setCollapsedState(panel, false);
|
|
5707
|
+
panel.size.set(restore);
|
|
5708
|
+
neighbour.size.set(pairSum - restore);
|
|
5709
|
+
}
|
|
5710
|
+
// Updates a panel's `collapsed` model from an interactive resize. Pre-syncing
|
|
5711
|
+
// the flag keeps `_syncCollapsedPanels` from re-running its own size handling.
|
|
5712
|
+
_setCollapsedState(panel, collapsed) {
|
|
5713
|
+
if (panel.collapsed() === collapsed)
|
|
5714
|
+
return;
|
|
5715
|
+
this._collapsedFlags.set(panel, collapsed);
|
|
5716
|
+
panel.collapsed.set(collapsed);
|
|
5717
|
+
}
|
|
5718
|
+
_initializeSizes() {
|
|
5719
|
+
const panels = this.panels();
|
|
5720
|
+
if (panels.length === 0)
|
|
5721
|
+
return;
|
|
5722
|
+
const sizes = panels.map(panel => panel.size());
|
|
5723
|
+
const providedTotal = sizes.reduce((sum, size) => sum + (size ?? 0), 0);
|
|
5724
|
+
const autoCount = sizes.filter(size => size === null).length;
|
|
5725
|
+
// Fully specified and already summing to 100% — nothing to resolve.
|
|
5726
|
+
if (autoCount === 0 && Math.round(providedTotal) === 100)
|
|
5727
|
+
return;
|
|
5728
|
+
untracked(() => {
|
|
5729
|
+
const remaining = Math.max(0, 100 - providedTotal);
|
|
5730
|
+
const autoShare = autoCount > 0 ? remaining / autoCount : 0;
|
|
5731
|
+
let resolved = sizes.map(size => (size === null ? autoShare : size));
|
|
5732
|
+
// Providing sizes that already exceed 100% scales the whole set down.
|
|
5733
|
+
const total = resolved.reduce((sum, size) => sum + size, 0);
|
|
5734
|
+
if (total > 0 && total !== 100)
|
|
5735
|
+
resolved = resolved.map(size => (size / total) * 100);
|
|
5736
|
+
panels.forEach((panel, index) => panel.size.set(resolved[index]));
|
|
5737
|
+
});
|
|
5738
|
+
}
|
|
5739
|
+
_syncCollapsedPanels() {
|
|
5740
|
+
const panels = this.panels();
|
|
5741
|
+
for (const panel of panels) {
|
|
5742
|
+
const collapsed = panel.collapsed();
|
|
5743
|
+
const previous = this._collapsedFlags.get(panel) ?? false;
|
|
5744
|
+
if (collapsed === previous)
|
|
5745
|
+
continue;
|
|
5746
|
+
this._collapsedFlags.set(panel, collapsed);
|
|
5747
|
+
untracked(() => this._toggleCollapse(panel, collapsed));
|
|
5748
|
+
}
|
|
5749
|
+
}
|
|
5750
|
+
_toggleCollapse(panel, collapsed) {
|
|
5751
|
+
const panels = this.panels();
|
|
5752
|
+
const index = panels.indexOf(panel);
|
|
5753
|
+
const neighbour = panels[index + 1] ?? panels[index - 1];
|
|
5754
|
+
if (!neighbour)
|
|
5755
|
+
return;
|
|
5756
|
+
if (collapsed) {
|
|
5757
|
+
const size = panel.size() ?? 0;
|
|
5758
|
+
this._collapsedSizes.set(panel, size);
|
|
5759
|
+
panel.size.set(0);
|
|
5760
|
+
neighbour.size.set((neighbour.size() ?? 0) + size);
|
|
5761
|
+
return;
|
|
5762
|
+
}
|
|
5763
|
+
const restore = this._collapsedSizes.get(panel) ?? 0;
|
|
5764
|
+
const available = Math.min(restore, neighbour.size() ?? 0);
|
|
5765
|
+
panel.size.set(available);
|
|
5766
|
+
neighbour.size.set((neighbour.size() ?? 0) - available);
|
|
5767
|
+
}
|
|
5768
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Splitter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5769
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Splitter, isStandalone: true, selector: "tls-splitter", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, keyboardStep: { classPropertyName: "keyboardStep", publicName: "keyboardStep", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "hostClasses()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "ariaLabelledby() ?? null" } }, queries: [{ propertyName: "panels", predicate: SplitterPanel, isSignal: true }], ngImport: i0, template: "<ng-content></ng-content>\n\n@for (seam of seams(); track seam.index) {\n <div\n class=\"tls-splitter-gutter\"\n role=\"separator\"\n tabindex=\"0\"\n [attr.aria-orientation]=\"ariaOrientation()\"\n [attr.aria-valuenow]=\"seam.valueNow\"\n [attr.aria-valuemin]=\"seam.valueMin\"\n [attr.aria-valuemax]=\"seam.valueMax\"\n [attr.aria-controls]=\"seam.controls\"\n [style.inset-inline-start.%]=\"isHorizontal() ? seam.position : null\"\n [style.inset-block-start.%]=\"isHorizontal() ? null : seam.position\"\n (pointerdown)=\"onGutterPointerDown(seam.index, $event)\"\n (pointermove)=\"onGutterPointerMove(seam.index, $event)\"\n (pointerup)=\"onGutterPointerUp(seam.index, $event)\"\n (pointercancel)=\"onGutterPointerCancel(seam.index)\"\n (keydown)=\"onGutterKeydown(seam.index, $event)\"\n >\n <span class=\"tls-splitter-gutter__handle\" aria-hidden=\"true\"></span>\n </div>\n}\n" });
|
|
5770
|
+
}
|
|
5771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Splitter, decorators: [{
|
|
5772
|
+
type: Component,
|
|
5773
|
+
args: [{ selector: 'tls-splitter', imports: [], host: {
|
|
5774
|
+
'[class]': 'hostClasses()',
|
|
5775
|
+
role: 'group',
|
|
5776
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
5777
|
+
'[attr.aria-labelledby]': 'ariaLabelledby() ?? null',
|
|
5778
|
+
}, template: "<ng-content></ng-content>\n\n@for (seam of seams(); track seam.index) {\n <div\n class=\"tls-splitter-gutter\"\n role=\"separator\"\n tabindex=\"0\"\n [attr.aria-orientation]=\"ariaOrientation()\"\n [attr.aria-valuenow]=\"seam.valueNow\"\n [attr.aria-valuemin]=\"seam.valueMin\"\n [attr.aria-valuemax]=\"seam.valueMax\"\n [attr.aria-controls]=\"seam.controls\"\n [style.inset-inline-start.%]=\"isHorizontal() ? seam.position : null\"\n [style.inset-block-start.%]=\"isHorizontal() ? null : seam.position\"\n (pointerdown)=\"onGutterPointerDown(seam.index, $event)\"\n (pointermove)=\"onGutterPointerMove(seam.index, $event)\"\n (pointerup)=\"onGutterPointerUp(seam.index, $event)\"\n (pointercancel)=\"onGutterPointerCancel(seam.index)\"\n (keydown)=\"onGutterKeydown(seam.index, $event)\"\n >\n <span class=\"tls-splitter-gutter__handle\" aria-hidden=\"true\"></span>\n </div>\n}\n" }]
|
|
5779
|
+
}], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], panels: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SplitterPanel), { ...{
|
|
5780
|
+
descendants: false,
|
|
5781
|
+
}, isSignal: true }] }] } });
|
|
5782
|
+
|
|
5229
5783
|
const DEFAULT_STEP_CONFIG = {
|
|
5230
5784
|
color: 'primary',
|
|
5231
5785
|
};
|
|
@@ -6320,6 +6874,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6320
6874
|
useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
|
|
6321
6875
|
},
|
|
6322
6876
|
{ provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
|
|
6877
|
+
{
|
|
6878
|
+
provide: IMAGE_COMPARE_CONFIG,
|
|
6879
|
+
useValue: deepMerge(DEFAULT_IMAGE_COMPARE_CONFIG, config.components.imageCompare),
|
|
6880
|
+
},
|
|
6323
6881
|
{ provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
6324
6882
|
{
|
|
6325
6883
|
provide: LOADER_CONFIG,
|
|
@@ -6362,6 +6920,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6362
6920
|
provide: SKELETON_CONFIG,
|
|
6363
6921
|
useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
|
|
6364
6922
|
},
|
|
6923
|
+
{
|
|
6924
|
+
provide: SPLITTER_CONFIG,
|
|
6925
|
+
useValue: deepMerge(DEFAULT_SPLITTER_CONFIG, config.components.splitter),
|
|
6926
|
+
},
|
|
6365
6927
|
{
|
|
6366
6928
|
provide: STEPPER_CONFIG,
|
|
6367
6929
|
useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
|
|
@@ -6401,5 +6963,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6401
6963
|
* Generated bundle index. Do not edit.
|
|
6402
6964
|
*/
|
|
6403
6965
|
|
|
6404
|
-
export { ALERT_CONFIG, Alert, BADGE_CONFIG, BUTTON_CONFIG, Badge, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, ICON_REGISTRY, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, Input, InputDirective, InputNumber, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicIcons, provideThalassicUIConfig };
|
|
6966
|
+
export { ALERT_CONFIG, Alert, BADGE_CONFIG, BUTTON_CONFIG, Badge, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicIcons, provideThalassicUIConfig };
|
|
6405
6967
|
//# sourceMappingURL=thalassic-ui.mjs.map
|