@hyalo/angular 0.0.0-stage → 0.3.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 +95 -0
- package/LICENSE +21 -0
- package/README.md +45 -2
- package/fesm2022/hyalo-angular-accordion.mjs +230 -0
- package/fesm2022/hyalo-angular-accordion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-alert.mjs +171 -0
- package/fesm2022/hyalo-angular-alert.mjs.map +1 -0
- package/fesm2022/hyalo-angular-aspect-ratio.mjs +64 -0
- package/fesm2022/hyalo-angular-aspect-ratio.mjs.map +1 -0
- package/fesm2022/hyalo-angular-avatar.mjs +169 -0
- package/fesm2022/hyalo-angular-avatar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-badge.mjs +268 -0
- package/fesm2022/hyalo-angular-badge.mjs.map +1 -0
- package/fesm2022/hyalo-angular-bento.mjs +132 -0
- package/fesm2022/hyalo-angular-bento.mjs.map +1 -0
- package/fesm2022/hyalo-angular-blocks.mjs +985 -0
- package/fesm2022/hyalo-angular-blocks.mjs.map +1 -0
- package/fesm2022/hyalo-angular-border-beam.mjs +73 -0
- package/fesm2022/hyalo-angular-border-beam.mjs.map +1 -0
- package/fesm2022/hyalo-angular-breadcrumb.mjs +77 -0
- package/fesm2022/hyalo-angular-breadcrumb.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button-group.mjs +90 -0
- package/fesm2022/hyalo-angular-button-group.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button.mjs +204 -0
- package/fesm2022/hyalo-angular-button.mjs.map +1 -0
- package/fesm2022/hyalo-angular-card.mjs +221 -0
- package/fesm2022/hyalo-angular-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-carousel.mjs +709 -0
- package/fesm2022/hyalo-angular-carousel.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chapter-nav.mjs +336 -0
- package/fesm2022/hyalo-angular-chapter-nav.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs +5 -0
- package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs.map +1 -0
- package/fesm2022/hyalo-angular-chart.mjs +391 -0
- package/fesm2022/hyalo-angular-chart.mjs.map +1 -0
- package/fesm2022/hyalo-angular-choice.mjs +789 -0
- package/fesm2022/hyalo-angular-choice.mjs.map +1 -0
- package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs +40 -0
- package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs.map +1 -0
- package/fesm2022/hyalo-angular-code-block.mjs +161 -0
- package/fesm2022/hyalo-angular-code-block.mjs.map +1 -0
- package/fesm2022/hyalo-angular-command.mjs +193 -0
- package/fesm2022/hyalo-angular-command.mjs.map +1 -0
- package/fesm2022/hyalo-angular-copy.mjs +138 -0
- package/fesm2022/hyalo-angular-copy.mjs.map +1 -0
- package/fesm2022/hyalo-angular-core.mjs +424 -0
- package/fesm2022/hyalo-angular-core.mjs.map +1 -0
- package/fesm2022/hyalo-angular-description-list.mjs +57 -0
- package/fesm2022/hyalo-angular-description-list.mjs.map +1 -0
- package/fesm2022/hyalo-angular-dialog.mjs +600 -0
- package/fesm2022/hyalo-angular-dialog.mjs.map +1 -0
- package/fesm2022/hyalo-angular-divider.mjs +66 -0
- package/fesm2022/hyalo-angular-divider.mjs.map +1 -0
- package/fesm2022/hyalo-angular-empty-state.mjs +123 -0
- package/fesm2022/hyalo-angular-empty-state.mjs.map +1 -0
- package/fesm2022/hyalo-angular-field.mjs +344 -0
- package/fesm2022/hyalo-angular-field.mjs.map +1 -0
- package/fesm2022/hyalo-angular-filter.mjs +309 -0
- package/fesm2022/hyalo-angular-filter.mjs.map +1 -0
- package/fesm2022/hyalo-angular-hotspot.mjs +225 -0
- package/fesm2022/hyalo-angular-hotspot.mjs.map +1 -0
- package/fesm2022/hyalo-angular-hover-card.mjs +233 -0
- package/fesm2022/hyalo-angular-hover-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-icon.mjs +385 -0
- package/fesm2022/hyalo-angular-icon.mjs.map +1 -0
- package/fesm2022/hyalo-angular-image-compare.mjs +168 -0
- package/fesm2022/hyalo-angular-image-compare.mjs.map +1 -0
- package/fesm2022/hyalo-angular-interaction.mjs +446 -0
- package/fesm2022/hyalo-angular-interaction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-kbd.mjs +41 -0
- package/fesm2022/hyalo-angular-kbd.mjs.map +1 -0
- package/fesm2022/hyalo-angular-lightbox.mjs +228 -0
- package/fesm2022/hyalo-angular-lightbox.mjs.map +1 -0
- package/fesm2022/hyalo-angular-link.mjs +42 -0
- package/fesm2022/hyalo-angular-link.mjs.map +1 -0
- package/fesm2022/hyalo-angular-list.mjs +131 -0
- package/fesm2022/hyalo-angular-list.mjs.map +1 -0
- package/fesm2022/hyalo-angular-marquee.mjs +197 -0
- package/fesm2022/hyalo-angular-marquee.mjs.map +1 -0
- package/fesm2022/hyalo-angular-menu.mjs +423 -0
- package/fesm2022/hyalo-angular-menu.mjs.map +1 -0
- package/fesm2022/hyalo-angular-mesh.mjs +126 -0
- package/fesm2022/hyalo-angular-mesh.mjs.map +1 -0
- package/fesm2022/hyalo-angular-motion.mjs +620 -0
- package/fesm2022/hyalo-angular-motion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navbar.mjs +343 -0
- package/fesm2022/hyalo-angular-navbar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navigation-menu.mjs +222 -0
- package/fesm2022/hyalo-angular-navigation-menu.mjs.map +1 -0
- package/fesm2022/hyalo-angular-number-ticker.mjs +174 -0
- package/fesm2022/hyalo-angular-number-ticker.mjs.map +1 -0
- package/fesm2022/hyalo-angular-overlay.mjs +163 -0
- package/fesm2022/hyalo-angular-overlay.mjs.map +1 -0
- package/fesm2022/hyalo-angular-pagination.mjs +187 -0
- package/fesm2022/hyalo-angular-pagination.mjs.map +1 -0
- package/fesm2022/hyalo-angular-popover-overlay-kit-6wPwnxln.mjs +3 -0
- package/fesm2022/hyalo-angular-popover.mjs +516 -0
- package/fesm2022/hyalo-angular-popover.mjs.map +1 -0
- package/fesm2022/hyalo-angular-progress.mjs +209 -0
- package/fesm2022/hyalo-angular-progress.mjs.map +1 -0
- package/fesm2022/hyalo-angular-progressive-blur.mjs +73 -0
- package/fesm2022/hyalo-angular-progressive-blur.mjs.map +1 -0
- package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs +186 -0
- package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs.map +1 -0
- package/fesm2022/hyalo-angular-refraction.mjs +178 -0
- package/fesm2022/hyalo-angular-refraction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-scroll-area.mjs +93 -0
- package/fesm2022/hyalo-angular-scroll-area.mjs.map +1 -0
- package/fesm2022/hyalo-angular-scroll-to-top.mjs +127 -0
- package/fesm2022/hyalo-angular-scroll-to-top.mjs.map +1 -0
- package/fesm2022/hyalo-angular-segmented.mjs +223 -0
- package/fesm2022/hyalo-angular-segmented.mjs.map +1 -0
- package/fesm2022/hyalo-angular-select.mjs +561 -0
- package/fesm2022/hyalo-angular-select.mjs.map +1 -0
- package/fesm2022/hyalo-angular-sidebar.mjs +241 -0
- package/fesm2022/hyalo-angular-sidebar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-skeleton.mjs +131 -0
- package/fesm2022/hyalo-angular-skeleton.mjs.map +1 -0
- package/fesm2022/hyalo-angular-sparkline.mjs +110 -0
- package/fesm2022/hyalo-angular-sparkline.mjs.map +1 -0
- package/fesm2022/hyalo-angular-split-text.mjs +126 -0
- package/fesm2022/hyalo-angular-split-text.mjs.map +1 -0
- package/fesm2022/hyalo-angular-stat.mjs +193 -0
- package/fesm2022/hyalo-angular-stat.mjs.map +1 -0
- package/fesm2022/hyalo-angular-stepper.mjs +254 -0
- package/fesm2022/hyalo-angular-stepper.mjs.map +1 -0
- package/fesm2022/hyalo-angular-table.mjs +335 -0
- package/fesm2022/hyalo-angular-table.mjs.map +1 -0
- package/fesm2022/hyalo-angular-tabs.mjs +324 -0
- package/fesm2022/hyalo-angular-tabs.mjs.map +1 -0
- package/fesm2022/hyalo-angular-theme.mjs +94 -0
- package/fesm2022/hyalo-angular-theme.mjs.map +1 -0
- package/fesm2022/hyalo-angular-timeline.mjs +157 -0
- package/fesm2022/hyalo-angular-timeline.mjs.map +1 -0
- package/fesm2022/hyalo-angular-toast.mjs +323 -0
- package/fesm2022/hyalo-angular-toast.mjs.map +1 -0
- package/fesm2022/hyalo-angular.mjs +2 -0
- package/package.json +329 -3
- package/styles/hyalo-core.css +25 -0
- package/styles/hyalo.css +17 -0
- package/styles/overlays/dialog.css +9 -0
- package/styles/overlays/popover.css +9 -0
- package/styles/overlays/select.css +9 -0
- package/styles/overlays/toast.css +8 -0
- package/styles/palettes/aurora.css +47 -0
- package/styles/palettes/ember.css +47 -0
- package/styles/palettes/graphite.css +47 -0
- package/styles/palettes/ocean.css +47 -0
- package/styles/palettes/orchid.css +47 -0
- package/styles/palettes/rose.css +47 -0
- package/styles/parts/card.css +49 -0
- package/styles/parts/dialog.css +116 -0
- package/styles/parts/drawer.css +124 -0
- package/styles/parts/field.css +44 -0
- package/styles/parts/glass.css +139 -0
- package/styles/parts/motion.css +101 -0
- package/styles/parts/navbar.css +55 -0
- package/styles/parts/popover.css +27 -0
- package/styles/parts/presence.css +55 -0
- package/styles/parts/reset.css +42 -0
- package/styles/parts/select.css +46 -0
- package/styles/parts/themes.css +105 -0
- package/styles/parts/toast.css +128 -0
- package/styles/parts/tokens.css +151 -0
- package/styles/parts/typography.css +81 -0
- package/types/hyalo-angular-accordion.d.ts +74 -0
- package/types/hyalo-angular-alert.d.ts +47 -0
- package/types/hyalo-angular-aspect-ratio.d.ts +13 -0
- package/types/hyalo-angular-avatar.d.ts +39 -0
- package/types/hyalo-angular-badge.d.ts +82 -0
- package/types/hyalo-angular-bento.d.ts +25 -0
- package/types/hyalo-angular-blocks.d.ts +272 -0
- package/types/hyalo-angular-border-beam.d.ts +15 -0
- package/types/hyalo-angular-breadcrumb.d.ts +22 -0
- package/types/hyalo-angular-button-group.d.ts +19 -0
- package/types/hyalo-angular-button.d.ts +89 -0
- package/types/hyalo-angular-card.d.ts +61 -0
- package/types/hyalo-angular-carousel.d.ts +147 -0
- package/types/hyalo-angular-chapter-nav.d.ts +79 -0
- package/types/hyalo-angular-chart.d.ts +90 -0
- package/types/hyalo-angular-choice.d.ts +259 -0
- package/types/hyalo-angular-code-block.d.ts +46 -0
- package/types/hyalo-angular-command.d.ts +41 -0
- package/types/hyalo-angular-copy.d.ts +39 -0
- package/types/hyalo-angular-core.d.ts +210 -0
- package/types/hyalo-angular-description-list.d.ts +16 -0
- package/types/hyalo-angular-dialog.d.ts +171 -0
- package/types/hyalo-angular-divider.d.ts +12 -0
- package/types/hyalo-angular-empty-state.d.ts +30 -0
- package/types/hyalo-angular-field.d.ts +141 -0
- package/types/hyalo-angular-filter.d.ts +122 -0
- package/types/hyalo-angular-hotspot.d.ts +70 -0
- package/types/hyalo-angular-hover-card.d.ts +47 -0
- package/types/hyalo-angular-icon.d.ts +122 -0
- package/types/hyalo-angular-image-compare.d.ts +55 -0
- package/types/hyalo-angular-interaction.d.ts +131 -0
- package/types/hyalo-angular-kbd.d.ts +5 -0
- package/types/hyalo-angular-lightbox.d.ts +67 -0
- package/types/hyalo-angular-link.d.ts +5 -0
- package/types/hyalo-angular-list.d.ts +30 -0
- package/types/hyalo-angular-marquee.d.ts +48 -0
- package/types/hyalo-angular-menu.d.ts +105 -0
- package/types/hyalo-angular-mesh.d.ts +36 -0
- package/types/hyalo-angular-motion.d.ts +218 -0
- package/types/hyalo-angular-navbar.d.ts +110 -0
- package/types/hyalo-angular-navigation-menu.d.ts +47 -0
- package/types/hyalo-angular-number-ticker.d.ts +52 -0
- package/types/hyalo-angular-overlay.d.ts +40 -0
- package/types/hyalo-angular-pagination.d.ts +59 -0
- package/types/hyalo-angular-popover.d.ts +152 -0
- package/types/hyalo-angular-progress.d.ts +46 -0
- package/types/hyalo-angular-progressive-blur.d.ts +14 -0
- package/types/hyalo-angular-refraction.d.ts +46 -0
- package/types/hyalo-angular-scroll-area.d.ts +18 -0
- package/types/hyalo-angular-scroll-to-top.d.ts +31 -0
- package/types/hyalo-angular-segmented.d.ts +79 -0
- package/types/hyalo-angular-select.d.ts +176 -0
- package/types/hyalo-angular-sidebar.d.ts +57 -0
- package/types/hyalo-angular-skeleton.d.ts +34 -0
- package/types/hyalo-angular-sparkline.d.ts +19 -0
- package/types/hyalo-angular-split-text.d.ts +24 -0
- package/types/hyalo-angular-stat.d.ts +56 -0
- package/types/hyalo-angular-stepper.d.ts +63 -0
- package/types/hyalo-angular-table.d.ts +125 -0
- package/types/hyalo-angular-tabs.d.ts +102 -0
- package/types/hyalo-angular-theme.d.ts +46 -0
- package/types/hyalo-angular-timeline.d.ts +36 -0
- package/types/hyalo-angular-toast.d.ts +79 -0
- package/types/hyalo-angular.d.ts +2 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Injectable, afterNextRender, effect, inject, input, signal, viewChild } from "@angular/core";
|
|
3
|
+
import * as i1 from "@hyalo/angular/core";
|
|
4
|
+
import { HyFidelity, HyMaterialDirective } from "@hyalo/angular/core";
|
|
5
|
+
var HyRefractionRenderer = class HyRefractionRenderer {
|
|
6
|
+
document = inject(DOCUMENT);
|
|
7
|
+
renderer;
|
|
8
|
+
constructor() {
|
|
9
|
+
inject(DestroyRef).onDestroy(() => {
|
|
10
|
+
this.renderer?.then((renderer) => renderer?.destroy());
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async register(target) {
|
|
14
|
+
this.renderer ??= import("./hyalo-angular-refraction-renderer-5ZA-kfsA.mjs").then(({ RefractionRenderer }) => {
|
|
15
|
+
try {
|
|
16
|
+
return new RefractionRenderer(this.document);
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}).catch(() => null);
|
|
21
|
+
const renderer = await this.renderer;
|
|
22
|
+
if (!renderer) return () => {};
|
|
23
|
+
const remove = renderer.register(target);
|
|
24
|
+
const resize = typeof ResizeObserver === "function" ? new ResizeObserver(() => renderer.draw()) : null;
|
|
25
|
+
resize?.observe(target.canvas);
|
|
26
|
+
return () => {
|
|
27
|
+
resize?.disconnect();
|
|
28
|
+
remove();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
32
|
+
minVersion: "12.0.0",
|
|
33
|
+
version: "22.2.3",
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
type: HyRefractionRenderer,
|
|
36
|
+
deps: [],
|
|
37
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
38
|
+
});
|
|
39
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
40
|
+
minVersion: "12.0.0",
|
|
41
|
+
version: "22.2.3",
|
|
42
|
+
ngImport: i0,
|
|
43
|
+
type: HyRefractionRenderer,
|
|
44
|
+
providedIn: "root"
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
48
|
+
minVersion: "12.0.0",
|
|
49
|
+
version: "22.2.3",
|
|
50
|
+
ngImport: i0,
|
|
51
|
+
type: HyRefractionRenderer,
|
|
52
|
+
decorators: [{
|
|
53
|
+
type: Injectable,
|
|
54
|
+
args: [{ providedIn: "root" }]
|
|
55
|
+
}],
|
|
56
|
+
ctorParameters: () => []
|
|
57
|
+
});
|
|
58
|
+
var HyRefraction = class HyRefraction {
|
|
59
|
+
fidelity = inject(HyFidelity);
|
|
60
|
+
renderer = inject(HyRefractionRenderer);
|
|
61
|
+
ready = signal(false, ...ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []);
|
|
62
|
+
canvas = viewChild.required("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
|
|
63
|
+
src = input("", ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
|
|
64
|
+
strength = input(.12, ...ngDevMode ? [{ debugName: "strength" }] : /* istanbul ignore next */ []);
|
|
65
|
+
constructor() {
|
|
66
|
+
afterNextRender(() => this.ready.set(true));
|
|
67
|
+
effect((onCleanup) => {
|
|
68
|
+
const src = this.src();
|
|
69
|
+
this.strength();
|
|
70
|
+
if (!this.ready() || this.fidelity.tier() !== "high" || !src) return;
|
|
71
|
+
let cancelled = false;
|
|
72
|
+
let unregister;
|
|
73
|
+
this.renderer.register({
|
|
74
|
+
canvas: this.canvas().nativeElement,
|
|
75
|
+
src,
|
|
76
|
+
strength: () => this.strength()
|
|
77
|
+
}).then((remove) => {
|
|
78
|
+
if (cancelled) remove();
|
|
79
|
+
else unregister = remove;
|
|
80
|
+
});
|
|
81
|
+
onCleanup(() => {
|
|
82
|
+
cancelled = true;
|
|
83
|
+
unregister?.();
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
88
|
+
minVersion: "12.0.0",
|
|
89
|
+
version: "22.2.3",
|
|
90
|
+
ngImport: i0,
|
|
91
|
+
type: HyRefraction,
|
|
92
|
+
deps: [],
|
|
93
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
94
|
+
});
|
|
95
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
96
|
+
minVersion: "17.0.0",
|
|
97
|
+
version: "22.2.3",
|
|
98
|
+
type: HyRefraction,
|
|
99
|
+
isStandalone: true,
|
|
100
|
+
selector: "hy-refraction",
|
|
101
|
+
inputs: {
|
|
102
|
+
src: {
|
|
103
|
+
classPropertyName: "src",
|
|
104
|
+
publicName: "src",
|
|
105
|
+
isSignal: true,
|
|
106
|
+
isRequired: false,
|
|
107
|
+
transformFunction: null
|
|
108
|
+
},
|
|
109
|
+
strength: {
|
|
110
|
+
classPropertyName: "strength",
|
|
111
|
+
publicName: "strength",
|
|
112
|
+
isSignal: true,
|
|
113
|
+
isRequired: false,
|
|
114
|
+
transformFunction: null
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
viewQueries: [{
|
|
118
|
+
propertyName: "canvas",
|
|
119
|
+
first: true,
|
|
120
|
+
predicate: ["canvas"],
|
|
121
|
+
descendants: true,
|
|
122
|
+
isSignal: true
|
|
123
|
+
}],
|
|
124
|
+
hostDirectives: [{
|
|
125
|
+
directive: i1.HyMaterialDirective,
|
|
126
|
+
inputs: ["hyMaterial", "material"]
|
|
127
|
+
}],
|
|
128
|
+
ngImport: i0,
|
|
129
|
+
template: "@if (src()) {\r\n <img class=\"fallback\" [src]=\"src()\" alt=\"\" aria-hidden=\"true\" />\r\n}\r\n<canvas #canvas aria-hidden=\"true\"></canvas>\r\n<div class=\"content\"><ng-content /></div>\r\n",
|
|
130
|
+
styles: [":host{display:block;position:relative;isolation:isolate;overflow:clip;border-radius:var(--hy-radius-l)}canvas,.fallback{position:absolute;inset:0;inline-size:100%;block-size:100%;pointer-events:none;z-index:-1}.fallback{object-fit:cover;opacity:var(--hy-refraction-opacity, .16)}canvas{opacity:var(--hy-refraction-opacity, .16)}:host(:has(canvas[data-rendered])) .fallback{opacity:0}.content{padding:var(--hy-refraction-padding, var(--hy-space-9))}@media(prefers-reduced-transparency:reduce),(forced-colors:active){canvas,.fallback{display:none}}\n"],
|
|
131
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
135
|
+
minVersion: "12.0.0",
|
|
136
|
+
version: "22.2.3",
|
|
137
|
+
ngImport: i0,
|
|
138
|
+
type: HyRefraction,
|
|
139
|
+
decorators: [{
|
|
140
|
+
type: Component,
|
|
141
|
+
args: [{
|
|
142
|
+
selector: "hy-refraction",
|
|
143
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
144
|
+
hostDirectives: [{
|
|
145
|
+
directive: HyMaterialDirective,
|
|
146
|
+
inputs: ["hyMaterial: material"]
|
|
147
|
+
}],
|
|
148
|
+
template: "@if (src()) {\r\n <img class=\"fallback\" [src]=\"src()\" alt=\"\" aria-hidden=\"true\" />\r\n}\r\n<canvas #canvas aria-hidden=\"true\"></canvas>\r\n<div class=\"content\"><ng-content /></div>\r\n",
|
|
149
|
+
styles: [":host{display:block;position:relative;isolation:isolate;overflow:clip;border-radius:var(--hy-radius-l)}canvas,.fallback{position:absolute;inset:0;inline-size:100%;block-size:100%;pointer-events:none;z-index:-1}.fallback{object-fit:cover;opacity:var(--hy-refraction-opacity, .16)}canvas{opacity:var(--hy-refraction-opacity, .16)}:host(:has(canvas[data-rendered])) .fallback{opacity:0}.content{padding:var(--hy-refraction-padding, var(--hy-space-9))}@media(prefers-reduced-transparency:reduce),(forced-colors:active){canvas,.fallback{display:none}}\n"]
|
|
150
|
+
}]
|
|
151
|
+
}],
|
|
152
|
+
ctorParameters: () => [],
|
|
153
|
+
propDecorators: {
|
|
154
|
+
canvas: [{
|
|
155
|
+
type: i0.ViewChild,
|
|
156
|
+
args: ["canvas", { isSignal: true }]
|
|
157
|
+
}],
|
|
158
|
+
src: [{
|
|
159
|
+
type: i0.Input,
|
|
160
|
+
args: [{
|
|
161
|
+
isSignal: true,
|
|
162
|
+
alias: "src",
|
|
163
|
+
required: false
|
|
164
|
+
}]
|
|
165
|
+
}],
|
|
166
|
+
strength: [{
|
|
167
|
+
type: i0.Input,
|
|
168
|
+
args: [{
|
|
169
|
+
isSignal: true,
|
|
170
|
+
alias: "strength",
|
|
171
|
+
required: false
|
|
172
|
+
}]
|
|
173
|
+
}]
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
export { HyRefraction, HyRefractionRenderer };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=hyalo-angular-refraction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-refraction.mjs","names":[],"sources":["../../../projects/hyalo/refraction/refraction.ts","../../../projects/hyalo/refraction/refraction.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DOCUMENT,\r\n DestroyRef,\r\n ElementRef,\r\n Injectable,\r\n afterNextRender,\r\n effect,\r\n inject,\r\n input,\r\n signal,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { HyFidelity, HyMaterialDirective } from '@hyalo/angular/core';\r\nimport type { RefractionRenderer, RefractionTarget } from './renderer';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class HyRefractionRenderer {\r\n private readonly document = inject(DOCUMENT);\r\n private renderer: Promise<RefractionRenderer | null> | undefined;\r\n constructor() {\r\n inject(DestroyRef).onDestroy(() => {\r\n void this.renderer?.then((renderer) => renderer?.destroy());\r\n });\r\n }\r\n async register(target: RefractionTarget): Promise<() => void> {\r\n this.renderer ??= import('./renderer')\r\n .then(({ RefractionRenderer }) => {\r\n try {\r\n return new RefractionRenderer(this.document);\r\n } catch {\r\n return null;\r\n }\r\n })\r\n .catch(() => null);\r\n const renderer = await this.renderer;\r\n if (!renderer)\r\n return () => {\r\n /* CSS fallback remains visible. */\r\n };\r\n const remove = renderer.register(target);\r\n const resize =\r\n typeof ResizeObserver === 'function' ? new ResizeObserver(() => renderer.draw()) : null;\r\n resize?.observe(target.canvas);\r\n return () => {\r\n resize?.disconnect();\r\n remove();\r\n };\r\n }\r\n}\r\n/** Supply the scene image explicitly. WebGL cannot sample arbitrary DOM backdrops. */\r\n@Component({\r\n selector: 'hy-refraction',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n hostDirectives: [{ directive: HyMaterialDirective, inputs: ['hyMaterial: material'] }],\r\n templateUrl: './refraction.html',\r\n styleUrl: './refraction.css',\r\n})\r\nexport class HyRefraction {\r\n private readonly fidelity = inject(HyFidelity);\r\n private readonly renderer = inject(HyRefractionRenderer);\r\n private readonly ready = signal(false);\r\n private readonly canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\r\n readonly src = input('');\r\n readonly strength = input(0.12);\r\n constructor() {\r\n afterNextRender(() => this.ready.set(true));\r\n effect((onCleanup) => {\r\n const src = this.src();\r\n this.strength();\r\n if (!this.ready() || this.fidelity.tier() !== 'high' || !src) return;\r\n let cancelled = false;\r\n let unregister: (() => void) | undefined;\r\n void this.renderer\r\n .register({ canvas: this.canvas().nativeElement, src, strength: () => this.strength() })\r\n .then((remove) => {\r\n if (cancelled) remove();\r\n else unregister = remove;\r\n });\r\n onCleanup(() => {\r\n cancelled = true;\r\n unregister?.();\r\n });\r\n });\r\n }\r\n}\r\n","@if (src()) {\r\n <img class=\"fallback\" [src]=\"src()\" alt=\"\" aria-hidden=\"true\" />\r\n}\r\n<canvas #canvas aria-hidden=\"true\"></canvas>\r\n<div class=\"content\"><ng-content /></div>\r\n"],"mappings":";;;;AAkBA,IAAa,uBAAb,MAAa,qBAAoB;CACd,WAAW,OAAO,QAAQ;CACnC;CACR,cAAA;EACE,OAAO,UAAU,CAAC,CAAC,gBAAe;GAChC,AAAK,KAAK,UAAU,MAAM,aAAa,UAAU,QAAO,CAAE;EAC5D,CAAC;CACH;CACA,MAAM,SAAS,QAAwB;EACrC,KAAK,aAAa,OAAO,mDAAa,CACnC,MAAM,EAAE,yBAAwB;GAC/B,IAAI;IACF,OAAO,IAAI,mBAAmB,KAAK,QAAQ;GAC7C,QAAQ;IACN,OAAO;GACT;EACF,CAAC,CAAC,CACD,YAAY,IAAI;EACnB,MAAM,WAAW,MAAM,KAAK;EAC5B,IAAI,CAAC,UACH,aAAY,CAEZ;EACF,MAAM,SAAS,SAAS,SAAS,MAAM;EACvC,MAAM,SACJ,OAAO,mBAAmB,aAAa,IAAI,qBAAqB,SAAS,KAAI,CAAE,IAAI;EACrF,QAAQ,QAAQ,OAAO,MAAM;EAC7B,aAAY;GACV,QAAQ,WAAU;GAClB,OAAM;EACR;CACF;CA/BW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAA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,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
|
|
3
|
+
var HyScrollArea = class HyScrollArea {
|
|
4
|
+
label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
5
|
+
maxHeight = input("20rem", ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
|
|
6
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
7
|
+
minVersion: "12.0.0",
|
|
8
|
+
version: "22.2.3",
|
|
9
|
+
ngImport: i0,
|
|
10
|
+
type: HyScrollArea,
|
|
11
|
+
deps: [],
|
|
12
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
13
|
+
});
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
15
|
+
minVersion: "17.1.0",
|
|
16
|
+
version: "22.2.3",
|
|
17
|
+
type: HyScrollArea,
|
|
18
|
+
isStandalone: true,
|
|
19
|
+
selector: "hy-scroll-area",
|
|
20
|
+
inputs: {
|
|
21
|
+
label: {
|
|
22
|
+
classPropertyName: "label",
|
|
23
|
+
publicName: "label",
|
|
24
|
+
isSignal: true,
|
|
25
|
+
isRequired: true,
|
|
26
|
+
transformFunction: null
|
|
27
|
+
},
|
|
28
|
+
maxHeight: {
|
|
29
|
+
classPropertyName: "maxHeight",
|
|
30
|
+
publicName: "maxHeight",
|
|
31
|
+
isSignal: true,
|
|
32
|
+
isRequired: false,
|
|
33
|
+
transformFunction: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
host: {
|
|
37
|
+
attributes: {
|
|
38
|
+
"role": "region",
|
|
39
|
+
"tabindex": "0"
|
|
40
|
+
},
|
|
41
|
+
properties: {
|
|
42
|
+
"attr.aria-label": "label()",
|
|
43
|
+
"style.max-block-size": "maxHeight()"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
ngImport: i0,
|
|
47
|
+
template: "<ng-content />\r\n",
|
|
48
|
+
styles: [":host{display:block;min-inline-size:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--hy-line-strong) transparent;scrollbar-gutter:stable}:host(:focus-visible){outline:2px solid var(--hy-primary);outline-offset:3px}\n"],
|
|
49
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
53
|
+
minVersion: "12.0.0",
|
|
54
|
+
version: "22.2.3",
|
|
55
|
+
ngImport: i0,
|
|
56
|
+
type: HyScrollArea,
|
|
57
|
+
decorators: [{
|
|
58
|
+
type: Component,
|
|
59
|
+
args: [{
|
|
60
|
+
selector: "hy-scroll-area",
|
|
61
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
62
|
+
host: {
|
|
63
|
+
role: "region",
|
|
64
|
+
tabindex: "0",
|
|
65
|
+
"[attr.aria-label]": "label()",
|
|
66
|
+
"[style.max-block-size]": "maxHeight()"
|
|
67
|
+
},
|
|
68
|
+
template: "<ng-content />\r\n",
|
|
69
|
+
styles: [":host{display:block;min-inline-size:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--hy-line-strong) transparent;scrollbar-gutter:stable}:host(:focus-visible){outline:2px solid var(--hy-primary);outline-offset:3px}\n"]
|
|
70
|
+
}]
|
|
71
|
+
}],
|
|
72
|
+
propDecorators: {
|
|
73
|
+
label: [{
|
|
74
|
+
type: i0.Input,
|
|
75
|
+
args: [{
|
|
76
|
+
isSignal: true,
|
|
77
|
+
alias: "label",
|
|
78
|
+
required: true
|
|
79
|
+
}]
|
|
80
|
+
}],
|
|
81
|
+
maxHeight: [{
|
|
82
|
+
type: i0.Input,
|
|
83
|
+
args: [{
|
|
84
|
+
isSignal: true,
|
|
85
|
+
alias: "maxHeight",
|
|
86
|
+
required: false
|
|
87
|
+
}]
|
|
88
|
+
}]
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
export { HyScrollArea };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=hyalo-angular-scroll-area.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-scroll-area.mjs","names":[],"sources":["../../../projects/hyalo/scroll-area/scroll-area.ts","../../../projects/hyalo/scroll-area/scroll-area.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\n@Component({\r\n selector: 'hy-scroll-area',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './scroll-area.html',\r\n styleUrl: './scroll-area.css',\r\n host: {\r\n role: 'region',\r\n tabindex: '0',\r\n '[attr.aria-label]': 'label()',\r\n '[style.max-block-size]': 'maxHeight()',\r\n },\r\n})\r\nexport class HyScrollArea {\r\n readonly label = input.required<string>();\r\n readonly maxHeight = input('20rem');\r\n}\r\n","<ng-content />\r\n"],"mappings":";;AAaA,IAAa,eAAb,MAAa,aAAY;CACd,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,YAAY,MAAM,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAFxB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAY,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAZ,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAY,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,QAAA;IAAA,YAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,wBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UCbzB;EACA,QAAA,CAAA,gQAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADYa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAZxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,iBACT,wBAAwB;GAAM,MAGzC;IACJ,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,0BAA0B;GAC3B;GAAA,UAAA;GAAA,QAAA,CAAA,gQAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, afterNextRender, inject, input, signal } from "@angular/core";
|
|
3
|
+
import { ɵinjectIsBrowser } from "@hyalo/angular/core";
|
|
4
|
+
import { HyMotion } from "@hyalo/angular/motion";
|
|
5
|
+
var HyScrollToTop = class HyScrollToTop {
|
|
6
|
+
document = inject(DOCUMENT);
|
|
7
|
+
motion = inject(HyMotion);
|
|
8
|
+
browser = ɵinjectIsBrowser();
|
|
9
|
+
label = input("Back to top", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
10
|
+
threshold = input(400, ...ngDevMode ? [{ debugName: "threshold" }] : /* istanbul ignore next */ []);
|
|
11
|
+
targetId = input(null, ...ngDevMode ? [{ debugName: "targetId" }] : /* istanbul ignore next */ []);
|
|
12
|
+
visible = signal(false, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
13
|
+
constructor() {
|
|
14
|
+
const destroy = inject(DestroyRef);
|
|
15
|
+
afterNextRender(() => {
|
|
16
|
+
const window = this.document.defaultView;
|
|
17
|
+
const update = () => this.visible.set((window?.scrollY ?? 0) > this.threshold());
|
|
18
|
+
window?.addEventListener("scroll", update, { passive: true });
|
|
19
|
+
update();
|
|
20
|
+
destroy.onDestroy(() => window?.removeEventListener("scroll", update));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
scroll() {
|
|
24
|
+
if (!this.browser) return;
|
|
25
|
+
const target = this.document.getElementById(this.targetId() ?? "") ?? this.document.querySelector("h1, main");
|
|
26
|
+
if (target) {
|
|
27
|
+
const previous = target.getAttribute("tabindex");
|
|
28
|
+
target.setAttribute("tabindex", "-1");
|
|
29
|
+
target.focus({ preventScroll: true });
|
|
30
|
+
target.addEventListener("blur", () => {
|
|
31
|
+
if (previous === null) target.removeAttribute("tabindex");
|
|
32
|
+
else target.setAttribute("tabindex", previous);
|
|
33
|
+
}, { once: true });
|
|
34
|
+
}
|
|
35
|
+
this.document.defaultView?.scrollTo({
|
|
36
|
+
top: 0,
|
|
37
|
+
behavior: this.motion.reduced() ? "instant" : "smooth"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
41
|
+
minVersion: "12.0.0",
|
|
42
|
+
version: "22.2.3",
|
|
43
|
+
ngImport: i0,
|
|
44
|
+
type: HyScrollToTop,
|
|
45
|
+
deps: [],
|
|
46
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
47
|
+
});
|
|
48
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
49
|
+
minVersion: "17.0.0",
|
|
50
|
+
version: "22.2.3",
|
|
51
|
+
type: HyScrollToTop,
|
|
52
|
+
isStandalone: true,
|
|
53
|
+
selector: "hy-scroll-to-top",
|
|
54
|
+
inputs: {
|
|
55
|
+
label: {
|
|
56
|
+
classPropertyName: "label",
|
|
57
|
+
publicName: "label",
|
|
58
|
+
isSignal: true,
|
|
59
|
+
isRequired: false,
|
|
60
|
+
transformFunction: null
|
|
61
|
+
},
|
|
62
|
+
threshold: {
|
|
63
|
+
classPropertyName: "threshold",
|
|
64
|
+
publicName: "threshold",
|
|
65
|
+
isSignal: true,
|
|
66
|
+
isRequired: false,
|
|
67
|
+
transformFunction: null
|
|
68
|
+
},
|
|
69
|
+
targetId: {
|
|
70
|
+
classPropertyName: "targetId",
|
|
71
|
+
publicName: "targetId",
|
|
72
|
+
isSignal: true,
|
|
73
|
+
isRequired: false,
|
|
74
|
+
transformFunction: null
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
ngImport: i0,
|
|
78
|
+
template: "@if (visible()) {\r\n <button type=\"button\" (click)=\"scroll()\">↑ {{ label() }}</button>\r\n}\r\n",
|
|
79
|
+
styles: [":host{position:fixed;inset-inline-end:var(--hy-space-6);inset-block-end:var(--hy-space-6);z-index:var(--hy-z-sticky)}button{min-block-size:2.75rem;padding-inline:var(--hy-space-4);color:var(--hy-ink);background:var(--hy-surface-1);border:1px solid var(--hy-line-strong);border-radius:var(--hy-radius-pill);box-shadow:var(--hy-glass-shadow);font:inherit;cursor:pointer}button:focus-visible{outline:2px solid var(--hy-primary);outline-offset:4px}\n"],
|
|
80
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
84
|
+
minVersion: "12.0.0",
|
|
85
|
+
version: "22.2.3",
|
|
86
|
+
ngImport: i0,
|
|
87
|
+
type: HyScrollToTop,
|
|
88
|
+
decorators: [{
|
|
89
|
+
type: Component,
|
|
90
|
+
args: [{
|
|
91
|
+
selector: "hy-scroll-to-top",
|
|
92
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
93
|
+
template: "@if (visible()) {\r\n <button type=\"button\" (click)=\"scroll()\">↑ {{ label() }}</button>\r\n}\r\n",
|
|
94
|
+
styles: [":host{position:fixed;inset-inline-end:var(--hy-space-6);inset-block-end:var(--hy-space-6);z-index:var(--hy-z-sticky)}button{min-block-size:2.75rem;padding-inline:var(--hy-space-4);color:var(--hy-ink);background:var(--hy-surface-1);border:1px solid var(--hy-line-strong);border-radius:var(--hy-radius-pill);box-shadow:var(--hy-glass-shadow);font:inherit;cursor:pointer}button:focus-visible{outline:2px solid var(--hy-primary);outline-offset:4px}\n"]
|
|
95
|
+
}]
|
|
96
|
+
}],
|
|
97
|
+
ctorParameters: () => [],
|
|
98
|
+
propDecorators: {
|
|
99
|
+
label: [{
|
|
100
|
+
type: i0.Input,
|
|
101
|
+
args: [{
|
|
102
|
+
isSignal: true,
|
|
103
|
+
alias: "label",
|
|
104
|
+
required: false
|
|
105
|
+
}]
|
|
106
|
+
}],
|
|
107
|
+
threshold: [{
|
|
108
|
+
type: i0.Input,
|
|
109
|
+
args: [{
|
|
110
|
+
isSignal: true,
|
|
111
|
+
alias: "threshold",
|
|
112
|
+
required: false
|
|
113
|
+
}]
|
|
114
|
+
}],
|
|
115
|
+
targetId: [{
|
|
116
|
+
type: i0.Input,
|
|
117
|
+
args: [{
|
|
118
|
+
isSignal: true,
|
|
119
|
+
alias: "targetId",
|
|
120
|
+
required: false
|
|
121
|
+
}]
|
|
122
|
+
}]
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
export { HyScrollToTop };
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=hyalo-angular-scroll-to-top.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-scroll-to-top.mjs","names":[],"sources":["../../../projects/hyalo/scroll-to-top/scroll-to-top.ts","../../../projects/hyalo/scroll-to-top/scroll-to-top.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DOCUMENT,\r\n DestroyRef,\r\n afterNextRender,\r\n inject,\r\n input,\r\n signal,\r\n} from '@angular/core';\r\nimport { ɵinjectIsBrowser } from '@hyalo/angular/core';\r\nimport { HyMotion } from '@hyalo/angular/motion';\r\n@Component({\r\n selector: 'hy-scroll-to-top',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './scroll-to-top.html',\r\n styleUrl: './scroll-to-top.css',\r\n})\r\nexport class HyScrollToTop {\r\n private readonly document = inject(DOCUMENT);\r\n private readonly motion = inject(HyMotion);\r\n private readonly browser = ɵinjectIsBrowser();\r\n readonly label = input('Back to top');\r\n readonly threshold = input(400);\r\n /** Focus this heading or landmark after scrolling, so keyboard users return too. */\r\n readonly targetId = input<string | null>(null);\r\n protected readonly visible = signal(false);\r\n constructor() {\r\n const destroy = inject(DestroyRef);\r\n afterNextRender(() => {\r\n const window = this.document.defaultView;\r\n const update = (): void => this.visible.set((window?.scrollY ?? 0) > this.threshold());\r\n window?.addEventListener('scroll', update, { passive: true });\r\n update();\r\n destroy.onDestroy(() => window?.removeEventListener('scroll', update));\r\n });\r\n }\r\n scroll(): void {\r\n if (!this.browser) return;\r\n const target =\r\n this.document.getElementById(this.targetId() ?? '') ??\r\n this.document.querySelector<HTMLElement>('h1, main');\r\n if (target) {\r\n const previous = target.getAttribute('tabindex');\r\n target.setAttribute('tabindex', '-1');\r\n target.focus({ preventScroll: true });\r\n target.addEventListener(\r\n 'blur',\r\n () => {\r\n if (previous === null) target.removeAttribute('tabindex');\r\n else target.setAttribute('tabindex', previous);\r\n },\r\n { once: true },\r\n );\r\n }\r\n this.document.defaultView?.scrollTo({\r\n top: 0,\r\n behavior: this.motion.reduced() ? 'instant' : 'smooth',\r\n });\r\n }\r\n}\r\n","@if (visible()) {\r\n <button type=\"button\" (click)=\"scroll()\">↑ {{ label() }}</button>\r\n}\r\n"],"mappings":";;;;AAkBA,IAAa,gBAAb,MAAa,cAAa;CACP,WAAW,OAAO,QAAQ;CAC1B,SAAS,OAAO,QAAQ;CACxB,UAAU,iBAAgB;CAClC,QAAQ,MAAM,eAAc,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC5B,YAAY,MAAM,KAAI,GAAA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AA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UClB1B;EAGA,QAAA,CAAA,gcAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADea,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EANzB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAkB,iBACX,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,gcAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, booleanAttribute, input, model, output, viewChild, viewChildren } from "@angular/core";
|
|
3
|
+
import { injectId, ɵtrackIndicator } from "@hyalo/angular/core";
|
|
4
|
+
import { HyIcon } from "@hyalo/angular/icon";
|
|
5
|
+
var HySegmented = class HySegmented {
|
|
6
|
+
groupName = injectId("segmented");
|
|
7
|
+
row = viewChild("row", ...ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []);
|
|
8
|
+
items = viewChildren("item", {
|
|
9
|
+
...ngDevMode ? { debugName: "items" } : /* istanbul ignore next */ {},
|
|
10
|
+
read: ElementRef
|
|
11
|
+
});
|
|
12
|
+
options = input.required(...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
13
|
+
value = model(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
14
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
15
|
+
name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
16
|
+
disabled = input(false, {
|
|
17
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
18
|
+
transform: booleanAttribute
|
|
19
|
+
});
|
|
20
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
21
|
+
touch = output();
|
|
22
|
+
ready = ɵtrackIndicator(this.row, () => {
|
|
23
|
+
const index = this.options().findIndex((o) => o.value === this.value());
|
|
24
|
+
return this.items()[index]?.nativeElement ?? null;
|
|
25
|
+
});
|
|
26
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
27
|
+
minVersion: "12.0.0",
|
|
28
|
+
version: "22.2.3",
|
|
29
|
+
ngImport: i0,
|
|
30
|
+
type: HySegmented,
|
|
31
|
+
deps: [],
|
|
32
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
33
|
+
});
|
|
34
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
35
|
+
minVersion: "17.0.0",
|
|
36
|
+
version: "22.2.3",
|
|
37
|
+
type: HySegmented,
|
|
38
|
+
isStandalone: true,
|
|
39
|
+
selector: "hy-segmented",
|
|
40
|
+
inputs: {
|
|
41
|
+
options: {
|
|
42
|
+
classPropertyName: "options",
|
|
43
|
+
publicName: "options",
|
|
44
|
+
isSignal: true,
|
|
45
|
+
isRequired: true,
|
|
46
|
+
transformFunction: null
|
|
47
|
+
},
|
|
48
|
+
value: {
|
|
49
|
+
classPropertyName: "value",
|
|
50
|
+
publicName: "value",
|
|
51
|
+
isSignal: true,
|
|
52
|
+
isRequired: false,
|
|
53
|
+
transformFunction: null
|
|
54
|
+
},
|
|
55
|
+
label: {
|
|
56
|
+
classPropertyName: "label",
|
|
57
|
+
publicName: "label",
|
|
58
|
+
isSignal: true,
|
|
59
|
+
isRequired: false,
|
|
60
|
+
transformFunction: null
|
|
61
|
+
},
|
|
62
|
+
name: {
|
|
63
|
+
classPropertyName: "name",
|
|
64
|
+
publicName: "name",
|
|
65
|
+
isSignal: true,
|
|
66
|
+
isRequired: false,
|
|
67
|
+
transformFunction: null
|
|
68
|
+
},
|
|
69
|
+
disabled: {
|
|
70
|
+
classPropertyName: "disabled",
|
|
71
|
+
publicName: "disabled",
|
|
72
|
+
isSignal: true,
|
|
73
|
+
isRequired: false,
|
|
74
|
+
transformFunction: null
|
|
75
|
+
},
|
|
76
|
+
size: {
|
|
77
|
+
classPropertyName: "size",
|
|
78
|
+
publicName: "size",
|
|
79
|
+
isSignal: true,
|
|
80
|
+
isRequired: false,
|
|
81
|
+
transformFunction: null
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
outputs: {
|
|
85
|
+
value: "valueChange",
|
|
86
|
+
touch: "touch"
|
|
87
|
+
},
|
|
88
|
+
host: {
|
|
89
|
+
attributes: { "role": "radiogroup" },
|
|
90
|
+
properties: {
|
|
91
|
+
"attr.aria-label": "label() || null",
|
|
92
|
+
"attr.aria-disabled": "disabled() || null",
|
|
93
|
+
"attr.data-size": "size()",
|
|
94
|
+
"attr.data-ready": "ready() || null"
|
|
95
|
+
},
|
|
96
|
+
classAttribute: "hy-segmented"
|
|
97
|
+
},
|
|
98
|
+
viewQueries: [{
|
|
99
|
+
propertyName: "row",
|
|
100
|
+
first: true,
|
|
101
|
+
predicate: ["row"],
|
|
102
|
+
descendants: true,
|
|
103
|
+
isSignal: true
|
|
104
|
+
}, {
|
|
105
|
+
propertyName: "items",
|
|
106
|
+
predicate: ["item"],
|
|
107
|
+
descendants: true,
|
|
108
|
+
read: ElementRef,
|
|
109
|
+
isSignal: true
|
|
110
|
+
}],
|
|
111
|
+
ngImport: i0,
|
|
112
|
+
template: "<div #row class=\"hy-segmented__row\">\r\n <span class=\"hy-segmented__indicator\" aria-hidden=\"true\"></span>\r\n @for (option of options(); track option.value) {\r\n <label\r\n #item\r\n class=\"hy-segmented__item\"\r\n [attr.data-checked]=\"option.value === value() || null\"\r\n >\r\n <input\r\n type=\"radio\"\r\n class=\"hy-segmented__input\"\r\n [name]=\"name() || groupName\"\r\n [checked]=\"option.value === value()\"\r\n [disabled]=\"disabled() || !!option.disabled\"\r\n (change)=\"value.set(option.value)\"\r\n (blur)=\"touch.emit()\"\r\n />\r\n @if (option.icon; as icon) {\r\n <hy-icon [name]=\"icon\" />\r\n }\r\n <span>{{ option.label }}</span>\r\n </label>\r\n }\r\n</div>\r\n",
|
|
113
|
+
styles: [":host{display:inline-block;max-inline-size:100%}.hy-segmented__row{position:relative;display:flex;gap:var(--hy-space-1);padding:var(--hy-space-1);border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));background:var(--hy-segmented-track, color-mix(in srgb, var(--hy-ink) 6%, transparent));isolation:isolate;overflow-x:auto;scrollbar-width:none}.hy-segmented__indicator{position:absolute;inset-block:var(--hy-space-1);left:0;inline-size:var(--hy-ind-size, 0px);translate:var(--hy-ind-x, 0px) 0;border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));background:var(--hy-glass-reflection),var(--hy-segmented-indicator, var(--hy-surface-1));box-shadow:var(--hy-glass-edge),0 2px 8px -2px #0f1a242e;z-index:-1}:host([data-ready]) .hy-segmented__indicator{transition:translate var(--hy-dur-settle) var(--hy-ease-out),inline-size var(--hy-dur-settle) var(--hy-ease-out)}.hy-segmented__item{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:var(--hy-space-2);flex:1;min-block-size:2.25rem;padding-inline:var(--hy-space-4);border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));color:var(--hy-ink-2);font-weight:540;white-space:nowrap;cursor:pointer;transition:color var(--hy-dur-quick) var(--hy-ease-out)}:host([data-size=\"sm\"]) .hy-segmented__item{min-block-size:1.75rem;padding-inline:var(--hy-space-3);font-size:var(--hy-step--1);letter-spacing:var(--hy-tracking-small)}:host([data-size=\"lg\"]) .hy-segmented__item{min-block-size:2.75rem;padding-inline:var(--hy-space-5)}.hy-segmented__item:hover,.hy-segmented__item[data-checked]{color:var(--hy-ink)}.hy-segmented__item:has(:disabled){opacity:.45;cursor:not-allowed}.hy-segmented__item:has(:focus-visible){box-shadow:var(--hy-focus-ring)}.hy-segmented__input{position:absolute;inset:0;margin:0;opacity:0;cursor:inherit}@media(forced-colors:active){.hy-segmented__item[data-checked]{outline:2px solid Highlight}}\n"],
|
|
114
|
+
dependencies: [{
|
|
115
|
+
kind: "component",
|
|
116
|
+
type: HyIcon,
|
|
117
|
+
selector: "hy-icon",
|
|
118
|
+
inputs: [
|
|
119
|
+
"name",
|
|
120
|
+
"icon",
|
|
121
|
+
"label",
|
|
122
|
+
"size",
|
|
123
|
+
"strokeWidth"
|
|
124
|
+
]
|
|
125
|
+
}],
|
|
126
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
130
|
+
minVersion: "12.0.0",
|
|
131
|
+
version: "22.2.3",
|
|
132
|
+
ngImport: i0,
|
|
133
|
+
type: HySegmented,
|
|
134
|
+
decorators: [{
|
|
135
|
+
type: Component,
|
|
136
|
+
args: [{
|
|
137
|
+
selector: "hy-segmented",
|
|
138
|
+
imports: [HyIcon],
|
|
139
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
140
|
+
host: {
|
|
141
|
+
class: "hy-segmented",
|
|
142
|
+
role: "radiogroup",
|
|
143
|
+
"[attr.aria-label]": "label() || null",
|
|
144
|
+
"[attr.aria-disabled]": "disabled() || null",
|
|
145
|
+
"[attr.data-size]": "size()",
|
|
146
|
+
"[attr.data-ready]": "ready() || null"
|
|
147
|
+
},
|
|
148
|
+
template: "<div #row class=\"hy-segmented__row\">\r\n <span class=\"hy-segmented__indicator\" aria-hidden=\"true\"></span>\r\n @for (option of options(); track option.value) {\r\n <label\r\n #item\r\n class=\"hy-segmented__item\"\r\n [attr.data-checked]=\"option.value === value() || null\"\r\n >\r\n <input\r\n type=\"radio\"\r\n class=\"hy-segmented__input\"\r\n [name]=\"name() || groupName\"\r\n [checked]=\"option.value === value()\"\r\n [disabled]=\"disabled() || !!option.disabled\"\r\n (change)=\"value.set(option.value)\"\r\n (blur)=\"touch.emit()\"\r\n />\r\n @if (option.icon; as icon) {\r\n <hy-icon [name]=\"icon\" />\r\n }\r\n <span>{{ option.label }}</span>\r\n </label>\r\n }\r\n</div>\r\n",
|
|
149
|
+
styles: [":host{display:inline-block;max-inline-size:100%}.hy-segmented__row{position:relative;display:flex;gap:var(--hy-space-1);padding:var(--hy-space-1);border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));background:var(--hy-segmented-track, color-mix(in srgb, var(--hy-ink) 6%, transparent));isolation:isolate;overflow-x:auto;scrollbar-width:none}.hy-segmented__indicator{position:absolute;inset-block:var(--hy-space-1);left:0;inline-size:var(--hy-ind-size, 0px);translate:var(--hy-ind-x, 0px) 0;border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));background:var(--hy-glass-reflection),var(--hy-segmented-indicator, var(--hy-surface-1));box-shadow:var(--hy-glass-edge),0 2px 8px -2px #0f1a242e;z-index:-1}:host([data-ready]) .hy-segmented__indicator{transition:translate var(--hy-dur-settle) var(--hy-ease-out),inline-size var(--hy-dur-settle) var(--hy-ease-out)}.hy-segmented__item{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:var(--hy-space-2);flex:1;min-block-size:2.25rem;padding-inline:var(--hy-space-4);border-radius:var(--hy-segmented-radius, var(--hy-radius-pill));color:var(--hy-ink-2);font-weight:540;white-space:nowrap;cursor:pointer;transition:color var(--hy-dur-quick) var(--hy-ease-out)}:host([data-size=\"sm\"]) .hy-segmented__item{min-block-size:1.75rem;padding-inline:var(--hy-space-3);font-size:var(--hy-step--1);letter-spacing:var(--hy-tracking-small)}:host([data-size=\"lg\"]) .hy-segmented__item{min-block-size:2.75rem;padding-inline:var(--hy-space-5)}.hy-segmented__item:hover,.hy-segmented__item[data-checked]{color:var(--hy-ink)}.hy-segmented__item:has(:disabled){opacity:.45;cursor:not-allowed}.hy-segmented__item:has(:focus-visible){box-shadow:var(--hy-focus-ring)}.hy-segmented__input{position:absolute;inset:0;margin:0;opacity:0;cursor:inherit}@media(forced-colors:active){.hy-segmented__item[data-checked]{outline:2px solid Highlight}}\n"]
|
|
150
|
+
}]
|
|
151
|
+
}],
|
|
152
|
+
propDecorators: {
|
|
153
|
+
row: [{
|
|
154
|
+
type: i0.ViewChild,
|
|
155
|
+
args: ["row", { isSignal: true }]
|
|
156
|
+
}],
|
|
157
|
+
items: [{
|
|
158
|
+
type: i0.ViewChildren,
|
|
159
|
+
args: ["item", {
|
|
160
|
+
read: ElementRef,
|
|
161
|
+
isSignal: true
|
|
162
|
+
}]
|
|
163
|
+
}],
|
|
164
|
+
options: [{
|
|
165
|
+
type: i0.Input,
|
|
166
|
+
args: [{
|
|
167
|
+
isSignal: true,
|
|
168
|
+
alias: "options",
|
|
169
|
+
required: true
|
|
170
|
+
}]
|
|
171
|
+
}],
|
|
172
|
+
value: [{
|
|
173
|
+
type: i0.Input,
|
|
174
|
+
args: [{
|
|
175
|
+
isSignal: true,
|
|
176
|
+
alias: "value",
|
|
177
|
+
required: false
|
|
178
|
+
}]
|
|
179
|
+
}, {
|
|
180
|
+
type: i0.Output,
|
|
181
|
+
args: ["valueChange"]
|
|
182
|
+
}],
|
|
183
|
+
label: [{
|
|
184
|
+
type: i0.Input,
|
|
185
|
+
args: [{
|
|
186
|
+
isSignal: true,
|
|
187
|
+
alias: "label",
|
|
188
|
+
required: false
|
|
189
|
+
}]
|
|
190
|
+
}],
|
|
191
|
+
name: [{
|
|
192
|
+
type: i0.Input,
|
|
193
|
+
args: [{
|
|
194
|
+
isSignal: true,
|
|
195
|
+
alias: "name",
|
|
196
|
+
required: false
|
|
197
|
+
}]
|
|
198
|
+
}],
|
|
199
|
+
disabled: [{
|
|
200
|
+
type: i0.Input,
|
|
201
|
+
args: [{
|
|
202
|
+
isSignal: true,
|
|
203
|
+
alias: "disabled",
|
|
204
|
+
required: false
|
|
205
|
+
}]
|
|
206
|
+
}],
|
|
207
|
+
size: [{
|
|
208
|
+
type: i0.Input,
|
|
209
|
+
args: [{
|
|
210
|
+
isSignal: true,
|
|
211
|
+
alias: "size",
|
|
212
|
+
required: false
|
|
213
|
+
}]
|
|
214
|
+
}],
|
|
215
|
+
touch: [{
|
|
216
|
+
type: i0.Output,
|
|
217
|
+
args: ["touch"]
|
|
218
|
+
}]
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
export { HySegmented };
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=hyalo-angular-segmented.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyalo-angular-segmented.mjs","names":["trackIndicator"],"sources":["../../../projects/hyalo/segmented/segmented.ts","../../../projects/hyalo/segmented/segmented.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n booleanAttribute,\r\n input,\r\n model,\r\n output,\r\n viewChild,\r\n viewChildren,\r\n} from '@angular/core';\r\nimport type { FormValueControl } from '@angular/forms/signals';\r\nimport { type HySize, injectId, ɵtrackIndicator as trackIndicator } from '@hyalo/angular/core';\r\n\r\nimport { HyIcon } from '@hyalo/angular/icon';\r\n\r\n/** One choice in a segmented control. */\r\nexport interface HySegmentedOption<T> {\r\n readonly value: T;\r\n readonly label: string;\r\n readonly icon?: string;\r\n readonly disabled?: boolean;\r\n}\r\n\r\n/**\r\n * A segmented control: a small set of mutually exclusive choices with the\r\n * same sliding indicator as tabs. Use it to pick a value (billing period, a\r\n * view mode). Use tabs when each choice shows a different panel.\r\n *\r\n * It is a group of native radio buttons, so arrow keys, form submission and\r\n * screen readers behave as users expect. Works with Signal Forms through\r\n * `[formField]`, or with `[(value)]`.\r\n *\r\n * ```html\r\n * <hy-segmented label=\"Billing\" [options]=\"periods\" [(value)]=\"period\" />\r\n * ```\r\n */\r\n@Component({\r\n selector: 'hy-segmented',\r\n imports: [HyIcon],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'hy-segmented',\r\n role: 'radiogroup',\r\n '[attr.aria-label]': 'label() || null',\r\n '[attr.aria-disabled]': 'disabled() || null',\r\n '[attr.data-size]': 'size()',\r\n '[attr.data-ready]': 'ready() || null',\r\n },\r\n templateUrl: './segmented.html',\r\n styleUrl: './segmented.css',\r\n})\r\nexport class HySegmented<T> implements FormValueControl<T | undefined> {\r\n protected readonly groupName = injectId('segmented');\r\n private readonly row = viewChild<ElementRef<HTMLElement>>('row');\r\n private readonly items = viewChildren('item', { read: ElementRef<HTMLElement> });\r\n\r\n /** The choices. */\r\n readonly options = input.required<readonly HySegmentedOption<T>[]>();\r\n /** Selected value. Two-way bindable. */\r\n readonly value = model<T | undefined>(undefined);\r\n /** Accessible name of the group. */\r\n readonly label = input<string>();\r\n /** Name shared by the radio inputs. Generated when not set. */\r\n readonly name = input<string>('');\r\n /** Disables every option. */\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n /** Control size. */\r\n readonly size = input<HySize>('md');\r\n /** Emits when focus leaves an option, so forms can mark the field touched. */\r\n readonly touch = output<void>();\r\n\r\n protected readonly ready = trackIndicator(this.row, () => {\r\n const index = this.options().findIndex((o) => o.value === this.value());\r\n return this.items()[index]?.nativeElement ?? null;\r\n });\r\n}\r\n","<div #row class=\"hy-segmented__row\">\r\n <span class=\"hy-segmented__indicator\" aria-hidden=\"true\"></span>\r\n @for (option of options(); track option.value) {\r\n <label\r\n #item\r\n class=\"hy-segmented__item\"\r\n [attr.data-checked]=\"option.value === value() || null\"\r\n >\r\n <input\r\n type=\"radio\"\r\n class=\"hy-segmented__input\"\r\n [name]=\"name() || groupName\"\r\n [checked]=\"option.value === value()\"\r\n [disabled]=\"disabled() || !!option.disabled\"\r\n (change)=\"value.set(option.value)\"\r\n (blur)=\"touch.emit()\"\r\n />\r\n @if (option.icon; as icon) {\r\n <hy-icon [name]=\"icon\" />\r\n }\r\n <span>{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