@tectra-ng/blocks 0.0.0-stage → 0.1.6

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.
Files changed (101) hide show
  1. package/README.md +16 -2
  2. package/action-tile/README.md +33 -0
  3. package/actions-menu/README.md +42 -0
  4. package/app-footer/README.md +30 -0
  5. package/app-layout/README.md +51 -0
  6. package/command-palette/README.md +63 -0
  7. package/console-layout/README.md +70 -0
  8. package/cookie-notice/README.md +45 -0
  9. package/empty-state/README.md +35 -0
  10. package/fesm2022/tectra-ng-blocks-action-tile.mjs +294 -0
  11. package/fesm2022/tectra-ng-blocks-action-tile.mjs.map +1 -0
  12. package/fesm2022/tectra-ng-blocks-actions-menu.mjs +380 -0
  13. package/fesm2022/tectra-ng-blocks-actions-menu.mjs.map +1 -0
  14. package/fesm2022/tectra-ng-blocks-app-footer.mjs +276 -0
  15. package/fesm2022/tectra-ng-blocks-app-footer.mjs.map +1 -0
  16. package/fesm2022/tectra-ng-blocks-app-layout.mjs +544 -0
  17. package/fesm2022/tectra-ng-blocks-app-layout.mjs.map +1 -0
  18. package/fesm2022/tectra-ng-blocks-command-palette.mjs +663 -0
  19. package/fesm2022/tectra-ng-blocks-command-palette.mjs.map +1 -0
  20. package/fesm2022/tectra-ng-blocks-console-layout.mjs +1060 -0
  21. package/fesm2022/tectra-ng-blocks-console-layout.mjs.map +1 -0
  22. package/fesm2022/tectra-ng-blocks-cookie-notice.mjs +416 -0
  23. package/fesm2022/tectra-ng-blocks-cookie-notice.mjs.map +1 -0
  24. package/fesm2022/tectra-ng-blocks-empty-state.mjs +278 -0
  25. package/fesm2022/tectra-ng-blocks-empty-state.mjs.map +1 -0
  26. package/fesm2022/tectra-ng-blocks-filters-panel.mjs +959 -0
  27. package/fesm2022/tectra-ng-blocks-filters-panel.mjs.map +1 -0
  28. package/fesm2022/tectra-ng-blocks-kanban.mjs +864 -0
  29. package/fesm2022/tectra-ng-blocks-kanban.mjs.map +1 -0
  30. package/fesm2022/tectra-ng-blocks-network-status.mjs +303 -0
  31. package/fesm2022/tectra-ng-blocks-network-status.mjs.map +1 -0
  32. package/fesm2022/tectra-ng-blocks-page-header.mjs +195 -0
  33. package/fesm2022/tectra-ng-blocks-page-header.mjs.map +1 -0
  34. package/fesm2022/tectra-ng-blocks-pinned-tabs.mjs +692 -0
  35. package/fesm2022/tectra-ng-blocks-pinned-tabs.mjs.map +1 -0
  36. package/fesm2022/tectra-ng-blocks-public-header.mjs +372 -0
  37. package/fesm2022/tectra-ng-blocks-public-header.mjs.map +1 -0
  38. package/fesm2022/tectra-ng-blocks-qr-code.mjs +487 -0
  39. package/fesm2022/tectra-ng-blocks-qr-code.mjs.map +1 -0
  40. package/fesm2022/tectra-ng-blocks-switch-language.mjs +316 -0
  41. package/fesm2022/tectra-ng-blocks-switch-language.mjs.map +1 -0
  42. package/fesm2022/tectra-ng-blocks-switch-theme.mjs +416 -0
  43. package/fesm2022/tectra-ng-blocks-switch-theme.mjs.map +1 -0
  44. package/fesm2022/tectra-ng-blocks-topbar-preferences.mjs +260 -0
  45. package/fesm2022/tectra-ng-blocks-topbar-preferences.mjs.map +1 -0
  46. package/fesm2022/tectra-ng-blocks-wizard.mjs +1284 -0
  47. package/fesm2022/tectra-ng-blocks-wizard.mjs.map +1 -0
  48. package/fesm2022/tectra-ng-blocks.mjs +4 -0
  49. package/fesm2022/tectra-ng-blocks.mjs.map +1 -0
  50. package/filters-panel/README.md +68 -0
  51. package/kanban/README.md +55 -0
  52. package/network-status/README.md +33 -0
  53. package/package.json +137 -3
  54. package/page-header/README.md +32 -0
  55. package/pinned-tabs/README.md +42 -0
  56. package/public-header/README.md +44 -0
  57. package/qr-code/README.md +52 -0
  58. package/switch-language/README.md +33 -0
  59. package/switch-theme/README.md +32 -0
  60. package/topbar-preferences/README.md +35 -0
  61. package/types/tectra-ng-blocks-action-tile.d.ts +114 -0
  62. package/types/tectra-ng-blocks-action-tile.d.ts.map +1 -0
  63. package/types/tectra-ng-blocks-actions-menu.d.ts +112 -0
  64. package/types/tectra-ng-blocks-actions-menu.d.ts.map +1 -0
  65. package/types/tectra-ng-blocks-app-footer.d.ts +111 -0
  66. package/types/tectra-ng-blocks-app-footer.d.ts.map +1 -0
  67. package/types/tectra-ng-blocks-app-layout.d.ts +212 -0
  68. package/types/tectra-ng-blocks-app-layout.d.ts.map +1 -0
  69. package/types/tectra-ng-blocks-command-palette.d.ts +291 -0
  70. package/types/tectra-ng-blocks-command-palette.d.ts.map +1 -0
  71. package/types/tectra-ng-blocks-console-layout.d.ts +454 -0
  72. package/types/tectra-ng-blocks-console-layout.d.ts.map +1 -0
  73. package/types/tectra-ng-blocks-cookie-notice.d.ts +168 -0
  74. package/types/tectra-ng-blocks-cookie-notice.d.ts.map +1 -0
  75. package/types/tectra-ng-blocks-empty-state.d.ts +138 -0
  76. package/types/tectra-ng-blocks-empty-state.d.ts.map +1 -0
  77. package/types/tectra-ng-blocks-filters-panel.d.ts +314 -0
  78. package/types/tectra-ng-blocks-filters-panel.d.ts.map +1 -0
  79. package/types/tectra-ng-blocks-kanban.d.ts +260 -0
  80. package/types/tectra-ng-blocks-kanban.d.ts.map +1 -0
  81. package/types/tectra-ng-blocks-network-status.d.ts +108 -0
  82. package/types/tectra-ng-blocks-network-status.d.ts.map +1 -0
  83. package/types/tectra-ng-blocks-page-header.d.ts +86 -0
  84. package/types/tectra-ng-blocks-page-header.d.ts.map +1 -0
  85. package/types/tectra-ng-blocks-pinned-tabs.d.ts +159 -0
  86. package/types/tectra-ng-blocks-pinned-tabs.d.ts.map +1 -0
  87. package/types/tectra-ng-blocks-public-header.d.ts +142 -0
  88. package/types/tectra-ng-blocks-public-header.d.ts.map +1 -0
  89. package/types/tectra-ng-blocks-qr-code.d.ts +160 -0
  90. package/types/tectra-ng-blocks-qr-code.d.ts.map +1 -0
  91. package/types/tectra-ng-blocks-switch-language.d.ts +106 -0
  92. package/types/tectra-ng-blocks-switch-language.d.ts.map +1 -0
  93. package/types/tectra-ng-blocks-switch-theme.d.ts +108 -0
  94. package/types/tectra-ng-blocks-switch-theme.d.ts.map +1 -0
  95. package/types/tectra-ng-blocks-topbar-preferences.d.ts +103 -0
  96. package/types/tectra-ng-blocks-topbar-preferences.d.ts.map +1 -0
  97. package/types/tectra-ng-blocks-wizard.d.ts +682 -0
  98. package/types/tectra-ng-blocks-wizard.d.ts.map +1 -0
  99. package/types/tectra-ng-blocks.d.ts +2 -0
  100. package/types/tectra-ng-blocks.d.ts.map +1 -0
  101. package/wizard/README.md +77 -0
@@ -0,0 +1,416 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DOCUMENT, Directive, ElementRef, ViewEncapsulation, computed, inject, input, numberAttribute, output } from "@angular/core";
3
+ import { TxStyleLoader } from "@tectra-ng/core/styles";
4
+ import { TxThemeService, injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
5
+ import { injectTranslations } from "@tectra-ng/core/i18n";
6
+ import { optionalBoolean } from "@tectra-ng/core/utils";
7
+ import { TxIcon } from "@tectra-ng/icons";
8
+ import { toStyleObject } from "@tectra-ng/themes";
9
+ var TxThemeRevealStyles = class TxThemeRevealStyles {
10
+ static ɵfac = i0.ɵɵngDeclareFactory({
11
+ minVersion: "12.0.0",
12
+ version: "22.2.3",
13
+ ngImport: i0,
14
+ type: TxThemeRevealStyles,
15
+ deps: [],
16
+ target: i0.ɵɵFactoryTarget.Component
17
+ });
18
+ static ɵcmp = i0.ɵɵngDeclareComponent({
19
+ minVersion: "14.0.0",
20
+ version: "22.2.3",
21
+ type: TxThemeRevealStyles,
22
+ isStandalone: true,
23
+ selector: "tx-theme-reveal-styles",
24
+ ngImport: i0,
25
+ template: "",
26
+ isInline: true,
27
+ styles: ["html.tx-theme-reveal::view-transition-old(root),html.tx-theme-reveal::view-transition-new(root){animation:none;mix-blend-mode:normal}html.tx-theme-reveal *,html.tx-theme-reveal *:before,html.tx-theme-reveal *:after{transition:none!important;view-transition-name:none!important}\n"],
28
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
29
+ encapsulation: i0.ViewEncapsulation.None
30
+ });
31
+ };
32
+ i0.ɵɵngDeclareClassMetadata({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.3",
35
+ ngImport: i0,
36
+ type: TxThemeRevealStyles,
37
+ decorators: [{
38
+ type: Component,
39
+ args: [{
40
+ selector: "tx-theme-reveal-styles",
41
+ template: "",
42
+ encapsulation: ViewEncapsulation.None,
43
+ changeDetection: ChangeDetectionStrategy.OnPush,
44
+ styles: ["html.tx-theme-reveal::view-transition-old(root),html.tx-theme-reveal::view-transition-new(root){animation:none;mix-blend-mode:normal}html.tx-theme-reveal *,html.tx-theme-reveal *:before,html.tx-theme-reveal *:after{transition:none!important;view-transition-name:none!important}\n"]
45
+ }]
46
+ }]
47
+ });
48
+ const REVEAL_CLASS = "tx-theme-reveal";
49
+ const TX_THEME_REVEAL_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
50
+ var TxThemeReveal = class TxThemeReveal {
51
+ document = inject(DOCUMENT);
52
+ host = inject(ElementRef);
53
+ revealDuration = input(550, {
54
+ ...ngDevMode ? { debugName: "revealDuration" } : /* istanbul ignore next */ {},
55
+ transform: numberAttribute
56
+ });
57
+ revealEasing = input(TX_THEME_REVEAL_EASING, ...ngDevMode ? [{ debugName: "revealEasing" }] : /* istanbul ignore next */ []);
58
+ themeChange = output();
59
+ constructor() {
60
+ inject(TxStyleLoader).load(TxThemeRevealStyles);
61
+ }
62
+ reveal(event) {
63
+ const view = this.document.defaultView;
64
+ if (!view || typeof this.document.startViewTransition !== "function" || view.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
65
+ this.themeChange.emit();
66
+ return;
67
+ }
68
+ const origin = this.origin(event);
69
+ const radius = Math.hypot(Math.max(origin.x, view.innerWidth - origin.x), Math.max(origin.y, view.innerHeight - origin.y));
70
+ const root = this.document.documentElement;
71
+ root.classList.add(REVEAL_CLASS);
72
+ const transition = this.document.startViewTransition(() => this.themeChange.emit());
73
+ transition.ready.then(() => root.animate({ clipPath: [`circle(0px at ${origin.x}px ${origin.y}px)`, `circle(${radius}px at ${origin.x}px ${origin.y}px)`] }, {
74
+ duration: this.revealDuration(),
75
+ easing: this.revealEasing(),
76
+ pseudoElement: "::view-transition-new(root)"
77
+ }));
78
+ transition.finished.finally(() => root.classList.remove(REVEAL_CLASS));
79
+ }
80
+ origin(event) {
81
+ if (event.clientX || event.clientY) return {
82
+ x: event.clientX,
83
+ y: event.clientY
84
+ };
85
+ const rect = this.host.nativeElement.getBoundingClientRect();
86
+ return {
87
+ x: rect.left + rect.width / 2,
88
+ y: rect.top + rect.height / 2
89
+ };
90
+ }
91
+ static ɵfac = i0.ɵɵngDeclareFactory({
92
+ minVersion: "12.0.0",
93
+ version: "22.2.3",
94
+ ngImport: i0,
95
+ type: TxThemeReveal,
96
+ deps: [],
97
+ target: i0.ɵɵFactoryTarget.Directive
98
+ });
99
+ static ɵdir = i0.ɵɵngDeclareDirective({
100
+ minVersion: "17.1.0",
101
+ version: "22.2.3",
102
+ type: TxThemeReveal,
103
+ isStandalone: true,
104
+ selector: "[txThemeReveal]",
105
+ inputs: {
106
+ revealDuration: {
107
+ classPropertyName: "revealDuration",
108
+ publicName: "revealDuration",
109
+ isSignal: true,
110
+ isRequired: false,
111
+ transformFunction: null
112
+ },
113
+ revealEasing: {
114
+ classPropertyName: "revealEasing",
115
+ publicName: "revealEasing",
116
+ isSignal: true,
117
+ isRequired: false,
118
+ transformFunction: null
119
+ }
120
+ },
121
+ outputs: { themeChange: "themeChange" },
122
+ host: { listeners: { "click": "reveal($event)" } },
123
+ ngImport: i0
124
+ });
125
+ };
126
+ i0.ɵɵngDeclareClassMetadata({
127
+ minVersion: "12.0.0",
128
+ version: "22.2.3",
129
+ ngImport: i0,
130
+ type: TxThemeReveal,
131
+ decorators: [{
132
+ type: Directive,
133
+ args: [{
134
+ selector: "[txThemeReveal]",
135
+ host: { "(click)": "reveal($event)" }
136
+ }]
137
+ }],
138
+ ctorParameters: () => [],
139
+ propDecorators: {
140
+ revealDuration: [{
141
+ type: i0.Input,
142
+ args: [{
143
+ isSignal: true,
144
+ alias: "revealDuration",
145
+ required: false
146
+ }]
147
+ }],
148
+ revealEasing: [{
149
+ type: i0.Input,
150
+ args: [{
151
+ isSignal: true,
152
+ alias: "revealEasing",
153
+ required: false
154
+ }]
155
+ }],
156
+ themeChange: [{
157
+ type: i0.Output,
158
+ args: ["themeChange"]
159
+ }]
160
+ }
161
+ });
162
+ var TxSwitchTheme = class TxSwitchTheme {
163
+ theme = inject(TxThemeService);
164
+ revealDuration = input(550, {
165
+ ...ngDevMode ? { debugName: "revealDuration" } : /* istanbul ignore next */ {},
166
+ transform: numberAttribute
167
+ });
168
+ revealEasing = input(TX_THEME_REVEAL_EASING, ...ngDevMode ? [{ debugName: "revealEasing" }] : /* istanbul ignore next */ []);
169
+ dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
170
+ pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
171
+ ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
172
+ unstyled = input(void 0, {
173
+ ...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
174
+ transform: optionalBoolean
175
+ });
176
+ modeChange = output();
177
+ isUnstyled = injectUnstyled(this.unstyled);
178
+ passThrough = injectPassThrough("switchTheme", this, this.pt, this.ptOptions);
179
+ translations = injectTranslations();
180
+ hostStyle = computed(() => ({
181
+ ...toStyleObject(this.dt(), "--tx-switch-theme"),
182
+ ...this.passThrough().root?.style
183
+ }), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
184
+ dark = computed(() => this.theme.mode() === "dark", ...ngDevMode ? [{ debugName: "dark" }] : /* istanbul ignore next */ []);
185
+ label = computed(() => this.dark() ? this.translations().switchToLight : this.translations().switchToDark, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
186
+ toggle() {
187
+ this.theme.toggleMode();
188
+ this.modeChange.emit(this.theme.mode());
189
+ }
190
+ static ɵfac = i0.ɵɵngDeclareFactory({
191
+ minVersion: "12.0.0",
192
+ version: "22.2.3",
193
+ ngImport: i0,
194
+ type: TxSwitchTheme,
195
+ deps: [],
196
+ target: i0.ɵɵFactoryTarget.Component
197
+ });
198
+ static ɵcmp = i0.ɵɵngDeclareComponent({
199
+ minVersion: "17.1.0",
200
+ version: "22.2.3",
201
+ type: TxSwitchTheme,
202
+ isStandalone: true,
203
+ selector: "tx-switch-theme",
204
+ inputs: {
205
+ revealDuration: {
206
+ classPropertyName: "revealDuration",
207
+ publicName: "revealDuration",
208
+ isSignal: true,
209
+ isRequired: false,
210
+ transformFunction: null
211
+ },
212
+ revealEasing: {
213
+ classPropertyName: "revealEasing",
214
+ publicName: "revealEasing",
215
+ isSignal: true,
216
+ isRequired: false,
217
+ transformFunction: null
218
+ },
219
+ dt: {
220
+ classPropertyName: "dt",
221
+ publicName: "dt",
222
+ isSignal: true,
223
+ isRequired: false,
224
+ transformFunction: null
225
+ },
226
+ pt: {
227
+ classPropertyName: "pt",
228
+ publicName: "pt",
229
+ isSignal: true,
230
+ isRequired: false,
231
+ transformFunction: null
232
+ },
233
+ ptOptions: {
234
+ classPropertyName: "ptOptions",
235
+ publicName: "ptOptions",
236
+ isSignal: true,
237
+ isRequired: false,
238
+ transformFunction: null
239
+ },
240
+ unstyled: {
241
+ classPropertyName: "unstyled",
242
+ publicName: "unstyled",
243
+ isSignal: true,
244
+ isRequired: false,
245
+ transformFunction: null
246
+ }
247
+ },
248
+ outputs: { modeChange: "modeChange" },
249
+ host: {
250
+ properties: {
251
+ "class": "passThrough().root?.class",
252
+ "style": "hostStyle()",
253
+ "attr.data-styled": "!isUnstyled() || null",
254
+ "attr.data-mode": "theme.mode()"
255
+ },
256
+ classAttribute: "tx-switch-theme"
257
+ },
258
+ ngImport: i0,
259
+ template: `
260
+ <button
261
+ type="button"
262
+ class="tx-switch-theme__button"
263
+ txThemeReveal
264
+ [revealDuration]="revealDuration()"
265
+ [revealEasing]="revealEasing()"
266
+ [attr.aria-label]="label()"
267
+ [title]="label()"
268
+ [class]="passThrough().button?.class"
269
+ [style]="passThrough().button?.style"
270
+ (themeChange)="toggle()"
271
+ >
272
+ <tx-icon
273
+ class="tx-switch-theme__icon tx-switch-theme__icon--sun"
274
+ name="sun"
275
+ aria-hidden="true"
276
+ [class.tx-switch-theme__icon--hidden]="dark()"
277
+ [class]="passThrough().icon?.class"
278
+ [style]="passThrough().icon?.style"
279
+ />
280
+ <tx-icon
281
+ class="tx-switch-theme__icon tx-switch-theme__icon--moon"
282
+ name="moon"
283
+ aria-hidden="true"
284
+ [class.tx-switch-theme__icon--hidden]="!dark()"
285
+ [class]="passThrough().icon?.class"
286
+ [style]="passThrough().icon?.style"
287
+ />
288
+ </button>
289
+ `,
290
+ isInline: true,
291
+ styles: [":host{display:inline-flex}.tx-switch-theme__button{position:relative;display:grid;place-items:center;margin:0;padding:0;border:0;background:transparent;color:inherit;cursor:pointer}.tx-switch-theme__icon{display:flex;grid-area:1/1}:host([data-styled]) .tx-switch-theme__button{width:var(--tx-switch-theme-size);height:var(--tx-switch-theme-size);border-radius:var(--tx-switch-theme-border-radius);background:var(--tx-switch-theme-background);box-shadow:inset 0 0 0 1px var(--tx-switch-theme-ring-color),var(--tx-switch-theme-shadow);color:var(--tx-switch-theme-color);transition:background-color var(--tx-switch-theme-transition-duration),transform var(--tx-switch-theme-transition-duration)}:host([data-styled]) .tx-switch-theme__button:hover{background:var(--tx-switch-theme-hover-background)}:host([data-styled]) .tx-switch-theme__button:active{transform:scale(var(--tx-switch-theme-active-scale))}:host([data-styled]) .tx-switch-theme__button:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--tx-switch-theme-ring-color),var(--tx-switch-theme-focus-ring-shadow)}:host([data-styled]) .tx-switch-theme__icon{font-size:var(--tx-switch-theme-icon-size);transition:opacity var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing),transform var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing)}:host([data-styled]) .tx-switch-theme__icon--hidden{opacity:0;transform:scale(var(--tx-switch-theme-icon-hidden-scale))}:host([data-styled]) .tx-switch-theme__icon--sun.tx-switch-theme__icon--hidden{transform:scale(var(--tx-switch-theme-icon-hidden-scale)) rotate(90deg)}:host([data-styled]) .tx-switch-theme__icon--moon.tx-switch-theme__icon--hidden{transform:scale(var(--tx-switch-theme-icon-hidden-scale)) rotate(-90deg)}:host-context(.tx-theme-reveal) .tx-switch-theme__icon{transition:opacity var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing),transform var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing)!important}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-switch-theme__button,:host([data-styled]) .tx-switch-theme__icon{transition:none}:host([data-styled]) .tx-switch-theme__button:active{transform:none}}\n"],
292
+ dependencies: [{
293
+ kind: "component",
294
+ type: TxIcon,
295
+ selector: "tx-icon",
296
+ inputs: ["name"]
297
+ }, {
298
+ kind: "directive",
299
+ type: TxThemeReveal,
300
+ selector: "[txThemeReveal]",
301
+ inputs: ["revealDuration", "revealEasing"],
302
+ outputs: ["themeChange"]
303
+ }],
304
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
305
+ });
306
+ };
307
+ i0.ɵɵngDeclareClassMetadata({
308
+ minVersion: "12.0.0",
309
+ version: "22.2.3",
310
+ ngImport: i0,
311
+ type: TxSwitchTheme,
312
+ decorators: [{
313
+ type: Component,
314
+ args: [{
315
+ selector: "tx-switch-theme",
316
+ imports: [TxIcon, TxThemeReveal],
317
+ template: `
318
+ <button
319
+ type="button"
320
+ class="tx-switch-theme__button"
321
+ txThemeReveal
322
+ [revealDuration]="revealDuration()"
323
+ [revealEasing]="revealEasing()"
324
+ [attr.aria-label]="label()"
325
+ [title]="label()"
326
+ [class]="passThrough().button?.class"
327
+ [style]="passThrough().button?.style"
328
+ (themeChange)="toggle()"
329
+ >
330
+ <tx-icon
331
+ class="tx-switch-theme__icon tx-switch-theme__icon--sun"
332
+ name="sun"
333
+ aria-hidden="true"
334
+ [class.tx-switch-theme__icon--hidden]="dark()"
335
+ [class]="passThrough().icon?.class"
336
+ [style]="passThrough().icon?.style"
337
+ />
338
+ <tx-icon
339
+ class="tx-switch-theme__icon tx-switch-theme__icon--moon"
340
+ name="moon"
341
+ aria-hidden="true"
342
+ [class.tx-switch-theme__icon--hidden]="!dark()"
343
+ [class]="passThrough().icon?.class"
344
+ [style]="passThrough().icon?.style"
345
+ />
346
+ </button>
347
+ `,
348
+ changeDetection: ChangeDetectionStrategy.OnPush,
349
+ host: {
350
+ class: "tx-switch-theme",
351
+ "[class]": "passThrough().root?.class",
352
+ "[style]": "hostStyle()",
353
+ "[attr.data-styled]": "!isUnstyled() || null",
354
+ "[attr.data-mode]": "theme.mode()"
355
+ },
356
+ styles: [":host{display:inline-flex}.tx-switch-theme__button{position:relative;display:grid;place-items:center;margin:0;padding:0;border:0;background:transparent;color:inherit;cursor:pointer}.tx-switch-theme__icon{display:flex;grid-area:1/1}:host([data-styled]) .tx-switch-theme__button{width:var(--tx-switch-theme-size);height:var(--tx-switch-theme-size);border-radius:var(--tx-switch-theme-border-radius);background:var(--tx-switch-theme-background);box-shadow:inset 0 0 0 1px var(--tx-switch-theme-ring-color),var(--tx-switch-theme-shadow);color:var(--tx-switch-theme-color);transition:background-color var(--tx-switch-theme-transition-duration),transform var(--tx-switch-theme-transition-duration)}:host([data-styled]) .tx-switch-theme__button:hover{background:var(--tx-switch-theme-hover-background)}:host([data-styled]) .tx-switch-theme__button:active{transform:scale(var(--tx-switch-theme-active-scale))}:host([data-styled]) .tx-switch-theme__button:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--tx-switch-theme-ring-color),var(--tx-switch-theme-focus-ring-shadow)}:host([data-styled]) .tx-switch-theme__icon{font-size:var(--tx-switch-theme-icon-size);transition:opacity var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing),transform var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing)}:host([data-styled]) .tx-switch-theme__icon--hidden{opacity:0;transform:scale(var(--tx-switch-theme-icon-hidden-scale))}:host([data-styled]) .tx-switch-theme__icon--sun.tx-switch-theme__icon--hidden{transform:scale(var(--tx-switch-theme-icon-hidden-scale)) rotate(90deg)}:host([data-styled]) .tx-switch-theme__icon--moon.tx-switch-theme__icon--hidden{transform:scale(var(--tx-switch-theme-icon-hidden-scale)) rotate(-90deg)}:host-context(.tx-theme-reveal) .tx-switch-theme__icon{transition:opacity var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing),transform var(--tx-switch-theme-icon-duration) var(--tx-switch-theme-icon-easing)!important}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-switch-theme__button,:host([data-styled]) .tx-switch-theme__icon{transition:none}:host([data-styled]) .tx-switch-theme__button:active{transform:none}}\n"]
357
+ }]
358
+ }],
359
+ propDecorators: {
360
+ revealDuration: [{
361
+ type: i0.Input,
362
+ args: [{
363
+ isSignal: true,
364
+ alias: "revealDuration",
365
+ required: false
366
+ }]
367
+ }],
368
+ revealEasing: [{
369
+ type: i0.Input,
370
+ args: [{
371
+ isSignal: true,
372
+ alias: "revealEasing",
373
+ required: false
374
+ }]
375
+ }],
376
+ dt: [{
377
+ type: i0.Input,
378
+ args: [{
379
+ isSignal: true,
380
+ alias: "dt",
381
+ required: false
382
+ }]
383
+ }],
384
+ pt: [{
385
+ type: i0.Input,
386
+ args: [{
387
+ isSignal: true,
388
+ alias: "pt",
389
+ required: false
390
+ }]
391
+ }],
392
+ ptOptions: [{
393
+ type: i0.Input,
394
+ args: [{
395
+ isSignal: true,
396
+ alias: "ptOptions",
397
+ required: false
398
+ }]
399
+ }],
400
+ unstyled: [{
401
+ type: i0.Input,
402
+ args: [{
403
+ isSignal: true,
404
+ alias: "unstyled",
405
+ required: false
406
+ }]
407
+ }],
408
+ modeChange: [{
409
+ type: i0.Output,
410
+ args: ["modeChange"]
411
+ }]
412
+ }
413
+ });
414
+ export { TX_THEME_REVEAL_EASING, TxSwitchTheme, TxThemeReveal };
415
+
416
+ //# sourceMappingURL=tectra-ng-blocks-switch-theme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tectra-ng-blocks-switch-theme.mjs","names":[],"sources":["../../../../packages/blocks/switch-theme/src/theme-reveal.styles.ts","../../../../packages/blocks/switch-theme/src/theme-reveal.directive.ts","../../../../packages/blocks/switch-theme/src/switch-theme.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\n@Component({\n selector: 'tx-theme-reveal-styles',\n template: '',\n styles: `\n html.tx-theme-reveal::view-transition-old(root),\n html.tx-theme-reveal::view-transition-new(root) {\n animation: none;\n mix-blend-mode: normal;\n }\n\n html.tx-theme-reveal *,\n html.tx-theme-reveal *::before,\n html.tx-theme-reveal *::after {\n transition: none !important;\n view-transition-name: none !important;\n }\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TxThemeRevealStyles {}\n","import { DOCUMENT, Directive, ElementRef, inject, input, numberAttribute, output } from '@angular/core';\nimport { TxStyleLoader } from '@tectra-ng/core/styles';\nimport { TxThemeRevealOrigin } from './switch-theme.types';\nimport { TxThemeRevealStyles } from './theme-reveal.styles';\n\nconst REVEAL_CLASS = 'tx-theme-reveal';\n\nexport const TX_THEME_REVEAL_EASING = 'cubic-bezier(0.4, 0, 0.2, 1)';\n\n@Directive({\n selector: '[txThemeReveal]',\n host: { '(click)': 'reveal($event)' },\n})\nexport class TxThemeReveal {\n private readonly document = inject(DOCUMENT);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly revealDuration = input<number, unknown>(550, { transform: numberAttribute });\n readonly revealEasing = input<string>(TX_THEME_REVEAL_EASING);\n\n readonly themeChange = output<void>();\n\n constructor() {\n inject(TxStyleLoader).load(TxThemeRevealStyles);\n }\n\n reveal(event: MouseEvent): void {\n const view = this.document.defaultView;\n if (!view || typeof this.document.startViewTransition !== 'function' || view.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {\n this.themeChange.emit();\n return;\n }\n const origin = this.origin(event);\n const radius = Math.hypot(Math.max(origin.x, view.innerWidth - origin.x), Math.max(origin.y, view.innerHeight - origin.y));\n const root = this.document.documentElement;\n root.classList.add(REVEAL_CLASS);\n const transition = this.document.startViewTransition(() => this.themeChange.emit());\n void transition.ready.then(() =>\n root.animate(\n { clipPath: [`circle(0px at ${origin.x}px ${origin.y}px)`, `circle(${radius}px at ${origin.x}px ${origin.y}px)`] },\n { duration: this.revealDuration(), easing: this.revealEasing(), pseudoElement: '::view-transition-new(root)' },\n ),\n );\n void transition.finished.finally(() => root.classList.remove(REVEAL_CLASS));\n }\n\n private origin(event: MouseEvent): TxThemeRevealOrigin {\n if (event.clientX || event.clientY) {\n return { x: event.clientX, y: event.clientY };\n }\n const rect = this.host.nativeElement.getBoundingClientRect();\n return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, numberAttribute, output } from '@angular/core';\nimport { TxPassThrough, TxPassThroughOptions, TxThemeMode, TxThemeService, injectPassThrough, injectUnstyled } from '@tectra-ng/core/config';\nimport { injectTranslations } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TxIcon } from '@tectra-ng/icons';\nimport { TectraDeepPartial, TectraSwitchThemeTokens, toStyleObject } from '@tectra-ng/themes';\nimport { TxSwitchThemePart } from './switch-theme.types';\nimport { TX_THEME_REVEAL_EASING, TxThemeReveal } from './theme-reveal.directive';\n\n@Component({\n selector: 'tx-switch-theme',\n imports: [TxIcon, TxThemeReveal],\n template: `\n <button\n type=\"button\"\n class=\"tx-switch-theme__button\"\n txThemeReveal\n [revealDuration]=\"revealDuration()\"\n [revealEasing]=\"revealEasing()\"\n [attr.aria-label]=\"label()\"\n [title]=\"label()\"\n [class]=\"passThrough().button?.class\"\n [style]=\"passThrough().button?.style\"\n (themeChange)=\"toggle()\"\n >\n <tx-icon\n class=\"tx-switch-theme__icon tx-switch-theme__icon--sun\"\n name=\"sun\"\n aria-hidden=\"true\"\n [class.tx-switch-theme__icon--hidden]=\"dark()\"\n [class]=\"passThrough().icon?.class\"\n [style]=\"passThrough().icon?.style\"\n />\n <tx-icon\n class=\"tx-switch-theme__icon tx-switch-theme__icon--moon\"\n name=\"moon\"\n aria-hidden=\"true\"\n [class.tx-switch-theme__icon--hidden]=\"!dark()\"\n [class]=\"passThrough().icon?.class\"\n [style]=\"passThrough().icon?.style\"\n />\n </button>\n `,\n styleUrl: './switch-theme.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-switch-theme',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-mode]': 'theme.mode()',\n },\n})\nexport class TxSwitchTheme {\n protected readonly theme = inject(TxThemeService);\n\n readonly revealDuration = input<number, unknown>(550, { transform: numberAttribute });\n readonly revealEasing = input<string>(TX_THEME_REVEAL_EASING);\n readonly dt = input<TectraDeepPartial<TectraSwitchThemeTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxSwitchThemePart, TxSwitchTheme> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly modeChange = output<TxThemeMode>();\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('switchTheme', this, this.pt, this.ptOptions);\n protected readonly translations = injectTranslations();\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-switch-theme'), ...this.passThrough().root?.style }));\n protected readonly dark = computed(() => this.theme.mode() === 'dark');\n protected readonly label = computed(() => (this.dark() ? this.translations().switchToLight : this.translations().switchToDark));\n\n toggle(): void {\n this.theme.toggleMode();\n this.modeChange.emit(this.theme.mode());\n }\n}\n"],"mappings":";;;;;;;;AAsBA,IAAa,sBAAb,MAAa,oBAAmB;CAAnB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAmB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAnB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAmB,cAAA;EAAA,UAAA;EAAA,UAAA;EAAA,UAlBpB;EAAE,UAAA;EAAA,QAAA,CAAA,yRAAA;EAAA,iBAAA,GAAA,wBAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAkBD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EApB/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAwB,UACxB;GAAE,eAeG,kBAAkB;GAAI,iBACpB,wBAAwB;GAAM,QAAA,CAAA,yRAAA;EAAA,CAAA;;;ACfjD,MAAM,eAAe;AAErB,MAAa,yBAAyB;AAMtC,IAAa,gBAAb,MAAa,cAAa;CACP,WAAW,OAAO,QAAQ;CAC1B,OAAO,OAAgC,UAAU;CAEzD,iBAAiB,MAAuB,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,iBAAA,+BAAA,CAAA;EAAI,WAAW;CAAe,CAAA;CACzE,eAAe,MAAc,wBAAuB,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAEpD,cAAc,OAAM;CAE7B,cAAA;EACE,OAAO,aAAa,CAAC,CAAC,KAAK,mBAAmB;CAChD;CAEA,OAAO,OAAiB;EACtB,MAAM,OAAO,KAAK,SAAS;EAC3B,IAAI,CAAC,QAAQ,OAAO,KAAK,SAAS,wBAAwB,cAAc,K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