ngx-semantic 2.0.7-beta.1 → 2.0.9

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 +18 -18
  2. package/fesm2022/ngx-semantic-collections-breadcrumb.mjs +13 -13
  3. package/fesm2022/ngx-semantic-collections-breadcrumb.mjs.map +1 -1
  4. package/fesm2022/ngx-semantic-collections-form.mjs +18 -17
  5. package/fesm2022/ngx-semantic-collections-form.mjs.map +1 -1
  6. package/fesm2022/ngx-semantic-collections-grid.mjs +13 -13
  7. package/fesm2022/ngx-semantic-collections-grid.mjs.map +1 -1
  8. package/fesm2022/ngx-semantic-collections-menu.mjs +28 -19
  9. package/fesm2022/ngx-semantic-collections-menu.mjs.map +1 -1
  10. package/fesm2022/ngx-semantic-collections-message.mjs +16 -16
  11. package/fesm2022/ngx-semantic-collections-message.mjs.map +1 -1
  12. package/fesm2022/ngx-semantic-collections-table.mjs +16 -16
  13. package/fesm2022/ngx-semantic-collections-table.mjs.map +1 -1
  14. package/fesm2022/ngx-semantic-core-base.mjs +3 -3
  15. package/fesm2022/ngx-semantic-core-base.mjs.map +1 -1
  16. package/fesm2022/ngx-semantic-elements-button.mjs +10 -10
  17. package/fesm2022/ngx-semantic-elements-button.mjs.map +1 -1
  18. package/fesm2022/ngx-semantic-elements-container.mjs +7 -7
  19. package/fesm2022/ngx-semantic-elements-container.mjs.map +1 -1
  20. package/fesm2022/ngx-semantic-elements-divider.mjs +7 -7
  21. package/fesm2022/ngx-semantic-elements-divider.mjs.map +1 -1
  22. package/fesm2022/ngx-semantic-elements-flag.mjs +7 -7
  23. package/fesm2022/ngx-semantic-elements-flag.mjs.map +1 -1
  24. package/fesm2022/ngx-semantic-elements-header.mjs +10 -10
  25. package/fesm2022/ngx-semantic-elements-header.mjs.map +1 -1
  26. package/fesm2022/ngx-semantic-elements-icon.mjs +10 -10
  27. package/fesm2022/ngx-semantic-elements-icon.mjs.map +1 -1
  28. package/fesm2022/ngx-semantic-elements-image.mjs +10 -10
  29. package/fesm2022/ngx-semantic-elements-image.mjs.map +1 -1
  30. package/fesm2022/ngx-semantic-elements-input.mjs +7 -7
  31. package/fesm2022/ngx-semantic-elements-input.mjs.map +1 -1
  32. package/fesm2022/ngx-semantic-elements-label.mjs +10 -10
  33. package/fesm2022/ngx-semantic-elements-label.mjs.map +1 -1
  34. package/fesm2022/ngx-semantic-elements-list.mjs +10 -10
  35. package/fesm2022/ngx-semantic-elements-list.mjs.map +1 -1
  36. package/fesm2022/ngx-semantic-elements-loader.mjs +7 -7
  37. package/fesm2022/ngx-semantic-elements-loader.mjs.map +1 -1
  38. package/fesm2022/ngx-semantic-elements-placeholder.mjs +19 -19
  39. package/fesm2022/ngx-semantic-elements-placeholder.mjs.map +1 -1
  40. package/fesm2022/ngx-semantic-elements-rail.mjs +7 -7
  41. package/fesm2022/ngx-semantic-elements-rail.mjs.map +1 -1
  42. package/fesm2022/ngx-semantic-elements-reveal.mjs +10 -10
  43. package/fesm2022/ngx-semantic-elements-reveal.mjs.map +1 -1
  44. package/fesm2022/ngx-semantic-elements-segment.mjs +13 -13
  45. package/fesm2022/ngx-semantic-elements-segment.mjs.map +1 -1
  46. package/fesm2022/ngx-semantic-elements-steps.mjs +19 -19
  47. package/fesm2022/ngx-semantic-elements-steps.mjs.map +1 -1
  48. package/fesm2022/ngx-semantic-modules-accordion.mjs +10 -10
  49. package/fesm2022/ngx-semantic-modules-accordion.mjs.map +1 -1
  50. package/fesm2022/ngx-semantic-modules-checkbox.mjs +7 -7
  51. package/fesm2022/ngx-semantic-modules-checkbox.mjs.map +1 -1
  52. package/fesm2022/ngx-semantic-modules-dimmer.mjs +26 -17
  53. package/fesm2022/ngx-semantic-modules-dimmer.mjs.map +1 -1
  54. package/fesm2022/ngx-semantic-modules-dropdown.mjs +19 -19
  55. package/fesm2022/ngx-semantic-modules-dropdown.mjs.map +1 -1
  56. package/fesm2022/ngx-semantic-modules-embed.mjs +10 -10
  57. package/fesm2022/ngx-semantic-modules-embed.mjs.map +1 -1
  58. package/fesm2022/ngx-semantic-modules-modal.mjs +16 -16
  59. package/fesm2022/ngx-semantic-modules-modal.mjs.map +1 -1
  60. package/fesm2022/ngx-semantic-modules-popup.mjs +10 -10
  61. package/fesm2022/ngx-semantic-modules-popup.mjs.map +1 -1
  62. package/fesm2022/ngx-semantic-modules-progress.mjs +7 -7
  63. package/fesm2022/ngx-semantic-modules-progress.mjs.map +1 -1
  64. package/fesm2022/ngx-semantic-modules-rating.mjs +7 -7
  65. package/fesm2022/ngx-semantic-modules-rating.mjs.map +1 -1
  66. package/fesm2022/ngx-semantic-modules-search.mjs +7 -7
  67. package/fesm2022/ngx-semantic-modules-search.mjs.map +1 -1
  68. package/fesm2022/ngx-semantic-modules-select.mjs +13 -13
  69. package/fesm2022/ngx-semantic-modules-select.mjs.map +1 -1
  70. package/fesm2022/ngx-semantic-modules-shape.mjs +10 -10
  71. package/fesm2022/ngx-semantic-modules-shape.mjs.map +1 -1
  72. package/fesm2022/ngx-semantic-modules-sidebar.mjs +16 -16
  73. package/fesm2022/ngx-semantic-modules-sidebar.mjs.map +1 -1
  74. package/fesm2022/ngx-semantic-modules-sticky.mjs +7 -7
  75. package/fesm2022/ngx-semantic-modules-sticky.mjs.map +1 -1
  76. package/fesm2022/ngx-semantic-modules-tabs.mjs +10 -10
  77. package/fesm2022/ngx-semantic-modules-tabs.mjs.map +1 -1
  78. package/fesm2022/ngx-semantic-modules-transition.mjs +721 -0
  79. package/fesm2022/ngx-semantic-modules-transition.mjs.map +1 -0
  80. package/fesm2022/ngx-semantic-modules-visibility.mjs +525 -0
  81. package/fesm2022/ngx-semantic-modules-visibility.mjs.map +1 -0
  82. package/fesm2022/ngx-semantic-views-advertisement.mjs +7 -7
  83. package/fesm2022/ngx-semantic-views-advertisement.mjs.map +1 -1
  84. package/fesm2022/ngx-semantic-views-card.mjs +28 -28
  85. package/fesm2022/ngx-semantic-views-card.mjs.map +1 -1
  86. package/fesm2022/ngx-semantic-views-comment.mjs +31 -31
  87. package/fesm2022/ngx-semantic-views-comment.mjs.map +1 -1
  88. package/fesm2022/ngx-semantic-views-feed.mjs +28 -28
  89. package/fesm2022/ngx-semantic-views-feed.mjs.map +1 -1
  90. package/fesm2022/ngx-semantic-views-items.mjs +28 -28
  91. package/fesm2022/ngx-semantic-views-items.mjs.map +1 -1
  92. package/fesm2022/ngx-semantic-views-statistics.mjs +16 -16
  93. package/fesm2022/ngx-semantic-views-statistics.mjs.map +1 -1
  94. package/fesm2022/ngx-semantic.mjs +21 -9
  95. package/fesm2022/ngx-semantic.mjs.map +1 -1
  96. package/modules/transition/package.json +4 -0
  97. package/modules/visibility/package.json +4 -0
  98. package/package.json +9 -1
  99. package/types/ngx-semantic-modules-transition.d.ts +107 -0
  100. package/types/ngx-semantic-modules-visibility.d.ts +124 -0
  101. package/types/ngx-semantic.d.ts +3 -1
@@ -0,0 +1,721 @@
1
+ import { style, animate, keyframes, AnimationBuilder } from '@angular/animations';
2
+ import { __decorate } from 'tslib';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, ElementRef, Renderer2, NgZone, ChangeDetectorRef, EventEmitter, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
5
+ import { ClassUtils, InputBoolean } from 'ngx-semantic/core/util';
6
+
7
+ /**
8
+ * Helpers for Semantic UI–style transition names and durations.
9
+ * @see https://semantic-ui.com/modules/transition.html
10
+ */
11
+ function durationToCss(d) {
12
+ if (typeof d === 'number') {
13
+ return Number.isFinite(d) ? `${d}ms` : '500ms';
14
+ }
15
+ const s = String(d).trim();
16
+ if (!s) {
17
+ return '500ms';
18
+ }
19
+ if (/^\d+(\.\d+)?(ms|s)$/i.test(s)) {
20
+ return s;
21
+ }
22
+ if (/^\d+(\.\d+)?$/.test(s)) {
23
+ return `${s}ms`;
24
+ }
25
+ return s;
26
+ }
27
+ function parseTransitionName(raw) {
28
+ const s = raw.trim().toLowerCase().replace(/\s+/g, ' ');
29
+ let explicitDirection = null;
30
+ let base = s;
31
+ if (base.endsWith(' in')) {
32
+ explicitDirection = 'in';
33
+ base = base.slice(0, -3).trim();
34
+ }
35
+ else if (base.endsWith(' out')) {
36
+ explicitDirection = 'out';
37
+ base = base.slice(0, -4).trim();
38
+ }
39
+ return { baseName: base, explicitDirection };
40
+ }
41
+ /**
42
+ * Resolves whether the next run should play an inward or outward transition.
43
+ */
44
+ function resolveTransitionDirection(explicitFromName, mode, targetVisible) {
45
+ if (explicitFromName === 'in' || explicitFromName === 'out') {
46
+ return explicitFromName;
47
+ }
48
+ if (mode === 'in') {
49
+ return 'in';
50
+ }
51
+ if (mode === 'out') {
52
+ return 'out';
53
+ }
54
+ return targetVisible ? 'in' : 'out';
55
+ }
56
+ const STATIC_NAMES = new Set([
57
+ 'jiggle',
58
+ 'flash',
59
+ 'shake',
60
+ 'pulse',
61
+ 'tada',
62
+ 'bounce',
63
+ 'glow'
64
+ ]);
65
+ function isStaticTransitionName(baseName) {
66
+ return STATIC_NAMES.has(baseName);
67
+ }
68
+
69
+ /**
70
+ * Angular animation metadata approximating Semantic UI transition behaviors.
71
+ * @see https://semantic-ui.com/modules/transition.html
72
+ */
73
+ const EASE = 'cubic-bezier(0.4, 0, 0.2, 1)';
74
+ const MOTIONS = {
75
+ scale: {
76
+ enter: d => [
77
+ style({ opacity: 0, transform: 'scale(0)', offset: 0 }),
78
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'scale(1)' }))
79
+ ],
80
+ leave: d => [
81
+ style({ opacity: 1, transform: 'scale(1)', offset: 0 }),
82
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'scale(0)' }))
83
+ ]
84
+ },
85
+ zoom: {
86
+ enter: d => [
87
+ style({ opacity: 0, transform: 'scale(0.35)', offset: 0 }),
88
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'scale(1)' }))
89
+ ],
90
+ leave: d => [
91
+ style({ opacity: 1, transform: 'scale(1)', offset: 0 }),
92
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'scale(0.35)' }))
93
+ ]
94
+ },
95
+ fade: {
96
+ enter: d => [
97
+ style({ opacity: 0, offset: 0 }),
98
+ animate(`${d} ${EASE}`, style({ opacity: 1 }))
99
+ ],
100
+ leave: d => [
101
+ style({ opacity: 1, offset: 0 }),
102
+ animate(`${d} ${EASE}`, style({ opacity: 0 }))
103
+ ]
104
+ },
105
+ 'fade up': {
106
+ enter: d => [
107
+ style({ opacity: 0, transform: 'translateY(0.75rem)', offset: 0 }),
108
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
109
+ ],
110
+ leave: d => [
111
+ style({ opacity: 1, transform: 'none', offset: 0 }),
112
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(0.75rem)' }))
113
+ ]
114
+ },
115
+ 'fade down': {
116
+ enter: d => [
117
+ style({ opacity: 0, transform: 'translateY(-0.75rem)', offset: 0 }),
118
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
119
+ ],
120
+ leave: d => [
121
+ style({ opacity: 1, transform: 'none', offset: 0 }),
122
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(-0.75rem)' }))
123
+ ]
124
+ },
125
+ 'fade left': {
126
+ enter: d => [
127
+ style({ opacity: 0, transform: 'translateX(0.75rem)', offset: 0 }),
128
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
129
+ ],
130
+ leave: d => [
131
+ style({ opacity: 1, transform: 'none', offset: 0 }),
132
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(0.75rem)' }))
133
+ ]
134
+ },
135
+ 'fade right': {
136
+ enter: d => [
137
+ style({ opacity: 0, transform: 'translateX(-0.75rem)', offset: 0 }),
138
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
139
+ ],
140
+ leave: d => [
141
+ style({ opacity: 1, transform: 'none', offset: 0 }),
142
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(-0.75rem)' }))
143
+ ]
144
+ },
145
+ 'horizontal flip': {
146
+ enter: d => [
147
+ style({
148
+ opacity: 0,
149
+ transform: 'perspective(600px) rotateY(-90deg)',
150
+ offset: 0
151
+ }),
152
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'perspective(600px) rotateY(0deg)' }))
153
+ ],
154
+ leave: d => [
155
+ style({
156
+ opacity: 1,
157
+ transform: 'perspective(600px) rotateY(0deg)',
158
+ offset: 0
159
+ }),
160
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'perspective(600px) rotateY(90deg)' }))
161
+ ]
162
+ },
163
+ 'vertical flip': {
164
+ enter: d => [
165
+ style({
166
+ opacity: 0,
167
+ transform: 'perspective(600px) rotateX(-90deg)',
168
+ offset: 0
169
+ }),
170
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'perspective(600px) rotateX(0deg)' }))
171
+ ],
172
+ leave: d => [
173
+ style({
174
+ opacity: 1,
175
+ transform: 'perspective(600px) rotateX(0deg)',
176
+ offset: 0
177
+ }),
178
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'perspective(600px) rotateX(90deg)' }))
179
+ ]
180
+ },
181
+ drop: {
182
+ enter: d => [
183
+ style({ opacity: 0, transform: 'translateY(-120%)', offset: 0 }),
184
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
185
+ ],
186
+ leave: d => [
187
+ style({ opacity: 1, transform: 'none', offset: 0 }),
188
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(-120%)' }))
189
+ ]
190
+ },
191
+ 'fly left': {
192
+ enter: d => [
193
+ style({ opacity: 0, transform: 'translateX(120%)', offset: 0 }),
194
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
195
+ ],
196
+ leave: d => [
197
+ style({ opacity: 1, transform: 'none', offset: 0 }),
198
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(-120%)' }))
199
+ ]
200
+ },
201
+ 'fly right': {
202
+ enter: d => [
203
+ style({ opacity: 0, transform: 'translateX(-120%)', offset: 0 }),
204
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
205
+ ],
206
+ leave: d => [
207
+ style({ opacity: 1, transform: 'none', offset: 0 }),
208
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(120%)' }))
209
+ ]
210
+ },
211
+ 'fly up': {
212
+ enter: d => [
213
+ style({ opacity: 0, transform: 'translateY(120%)', offset: 0 }),
214
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
215
+ ],
216
+ leave: d => [
217
+ style({ opacity: 1, transform: 'none', offset: 0 }),
218
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(-120%)' }))
219
+ ]
220
+ },
221
+ 'fly down': {
222
+ enter: d => [
223
+ style({ opacity: 0, transform: 'translateY(-120%)', offset: 0 }),
224
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
225
+ ],
226
+ leave: d => [
227
+ style({ opacity: 1, transform: 'none', offset: 0 }),
228
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(120%)' }))
229
+ ]
230
+ },
231
+ 'swing left': {
232
+ enter: d => [
233
+ style({ opacity: 0, transform: 'rotate(-12deg)', transformOrigin: 'top center', offset: 0 }),
234
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
235
+ ],
236
+ leave: d => [
237
+ style({ opacity: 1, transform: 'none', offset: 0 }),
238
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'rotate(12deg)', transformOrigin: 'top center' }))
239
+ ]
240
+ },
241
+ 'swing right': {
242
+ enter: d => [
243
+ style({ opacity: 0, transform: 'rotate(12deg)', transformOrigin: 'top center', offset: 0 }),
244
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
245
+ ],
246
+ leave: d => [
247
+ style({ opacity: 1, transform: 'none', offset: 0 }),
248
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'rotate(-12deg)', transformOrigin: 'top center' }))
249
+ ]
250
+ },
251
+ 'swing up': {
252
+ enter: d => [
253
+ style({ opacity: 0, transform: 'rotate(-10deg)', transformOrigin: 'bottom center', offset: 0 }),
254
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
255
+ ],
256
+ leave: d => [
257
+ style({ opacity: 1, transform: 'none', offset: 0 }),
258
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'rotate(10deg)', transformOrigin: 'bottom center' }))
259
+ ]
260
+ },
261
+ 'swing down': {
262
+ enter: d => [
263
+ style({ opacity: 0, transform: 'rotate(10deg)', transformOrigin: 'top center', offset: 0 }),
264
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
265
+ ],
266
+ leave: d => [
267
+ style({ opacity: 1, transform: 'none', offset: 0 }),
268
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'rotate(-10deg)', transformOrigin: 'top center' }))
269
+ ]
270
+ },
271
+ browse: {
272
+ enter: d => [
273
+ style({ opacity: 0, transform: 'translateX(-1rem) skewX(-6deg)', offset: 0 }),
274
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
275
+ ],
276
+ leave: d => [
277
+ style({ opacity: 1, transform: 'none', offset: 0 }),
278
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(1rem) skewX(6deg)' }))
279
+ ]
280
+ },
281
+ 'browse right': {
282
+ enter: d => [
283
+ style({ opacity: 0, transform: 'translateX(1rem) skewX(6deg)', offset: 0 }),
284
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
285
+ ],
286
+ leave: d => [
287
+ style({ opacity: 1, transform: 'none', offset: 0 }),
288
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(-1rem) skewX(-6deg)' }))
289
+ ]
290
+ },
291
+ 'slide down': {
292
+ enter: d => [
293
+ style({ opacity: 0, transform: 'translateY(-100%)', offset: 0 }),
294
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
295
+ ],
296
+ leave: d => [
297
+ style({ opacity: 1, transform: 'none', offset: 0 }),
298
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(-100%)' }))
299
+ ]
300
+ },
301
+ 'slide up': {
302
+ enter: d => [
303
+ style({ opacity: 0, transform: 'translateY(100%)', offset: 0 }),
304
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
305
+ ],
306
+ leave: d => [
307
+ style({ opacity: 1, transform: 'none', offset: 0 }),
308
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateY(100%)' }))
309
+ ]
310
+ },
311
+ 'slide left': {
312
+ enter: d => [
313
+ style({ opacity: 0, transform: 'translateX(100%)', offset: 0 }),
314
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
315
+ ],
316
+ leave: d => [
317
+ style({ opacity: 1, transform: 'none', offset: 0 }),
318
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(-100%)' }))
319
+ ]
320
+ },
321
+ 'slide right': {
322
+ enter: d => [
323
+ style({ opacity: 0, transform: 'translateX(-100%)', offset: 0 }),
324
+ animate(`${d} ${EASE}`, style({ opacity: 1, transform: 'none' }))
325
+ ],
326
+ leave: d => [
327
+ style({ opacity: 1, transform: 'none', offset: 0 }),
328
+ animate(`${d} ${EASE}`, style({ opacity: 0, transform: 'translateX(100%)' }))
329
+ ]
330
+ }
331
+ };
332
+ const DEFAULT_MOTION = MOTIONS.fade;
333
+ function getMotionForVisibility(baseName) {
334
+ if (isStaticTransitionName(baseName)) {
335
+ return DEFAULT_MOTION;
336
+ }
337
+ return MOTIONS[baseName] ?? DEFAULT_MOTION;
338
+ }
339
+ function buildEnterSteps(baseName, durationCss) {
340
+ return getMotionForVisibility(baseName).enter(durationCss);
341
+ }
342
+ function buildLeaveSteps(baseName, durationCss) {
343
+ return getMotionForVisibility(baseName).leave(durationCss);
344
+ }
345
+ function buildStaticSteps(baseName, durationCss) {
346
+ if (!isStaticTransitionName(baseName)) {
347
+ return null;
348
+ }
349
+ switch (baseName) {
350
+ case 'pulse':
351
+ return [
352
+ style({ transform: 'scale(1)', offset: 0 }),
353
+ animate(`${durationCss} ${EASE}`, keyframes([
354
+ style({ transform: 'scale(1)', offset: 0 }),
355
+ style({ transform: 'scale(1.06)', offset: 0.5 }),
356
+ style({ transform: 'scale(1)', offset: 1 })
357
+ ]))
358
+ ];
359
+ case 'shake':
360
+ return [
361
+ animate(`${durationCss} ${EASE}`, keyframes([
362
+ style({ transform: 'translateX(0)', offset: 0 }),
363
+ style({ transform: 'translateX(-0.5rem)', offset: 0.2 }),
364
+ style({ transform: 'translateX(0.5rem)', offset: 0.4 }),
365
+ style({ transform: 'translateX(-0.35rem)', offset: 0.6 }),
366
+ style({ transform: 'translateX(0.35rem)', offset: 0.8 }),
367
+ style({ transform: 'translateX(0)', offset: 1 })
368
+ ]))
369
+ ];
370
+ case 'jiggle':
371
+ return [
372
+ animate(`${durationCss} ${EASE}`, keyframes([
373
+ style({ transform: 'rotate(0deg)', offset: 0 }),
374
+ style({ transform: 'rotate(-2.5deg)', offset: 0.25 }),
375
+ style({ transform: 'rotate(2.5deg)', offset: 0.5 }),
376
+ style({ transform: 'rotate(-1.5deg)', offset: 0.75 }),
377
+ style({ transform: 'rotate(0deg)', offset: 1 })
378
+ ]))
379
+ ];
380
+ case 'flash':
381
+ return [
382
+ animate(`${durationCss} linear`, keyframes([
383
+ style({ opacity: 1, offset: 0 }),
384
+ style({ opacity: 0.2, offset: 0.5 }),
385
+ style({ opacity: 1, offset: 1 })
386
+ ]))
387
+ ];
388
+ case 'tada':
389
+ return [
390
+ animate(`${durationCss} ${EASE}`, keyframes([
391
+ style({ transform: 'scale(1) rotate(0deg)', offset: 0 }),
392
+ style({ transform: 'scale(0.92) rotate(-2deg)', offset: 0.1 }),
393
+ style({ transform: 'scale(1.08) rotate(2deg)', offset: 0.3 }),
394
+ style({ transform: 'scale(1.02) rotate(-1deg)', offset: 0.5 }),
395
+ style({ transform: 'scale(1) rotate(0deg)', offset: 1 })
396
+ ]))
397
+ ];
398
+ case 'bounce':
399
+ return [
400
+ animate(`${durationCss} ${EASE}`, keyframes([
401
+ style({ transform: 'translateY(0)', offset: 0 }),
402
+ style({ transform: 'translateY(-0.6rem)', offset: 0.35 }),
403
+ style({ transform: 'translateY(0)', offset: 0.55 }),
404
+ style({ transform: 'translateY(-0.25rem)', offset: 0.7 }),
405
+ style({ transform: 'translateY(0)', offset: 0.85 }),
406
+ style({ transform: 'translateY(0)', offset: 1 })
407
+ ]))
408
+ ];
409
+ case 'glow':
410
+ return [
411
+ animate(`${durationCss} ${EASE}`, keyframes([
412
+ style({ boxShadow: '0 0 0 0 rgba(100, 180, 255, 0)', offset: 0 }),
413
+ style({ boxShadow: '0 0 1.25rem 0.25rem rgba(100, 180, 255, 0.45)', offset: 0.5 }),
414
+ style({ boxShadow: '0 0 0 0 rgba(100, 180, 255, 0)', offset: 1 })
415
+ ]))
416
+ ];
417
+ default:
418
+ return null;
419
+ }
420
+ }
421
+ function listRegisteredMotionKeys() {
422
+ return Object.keys(MOTIONS);
423
+ }
424
+
425
+ class SuiTransitionComponent {
426
+ constructor() {
427
+ this.builder = inject(AnimationBuilder);
428
+ this.el = inject((ElementRef));
429
+ this.renderer = inject(Renderer2);
430
+ this.zone = inject(NgZone);
431
+ this.cdr = inject(ChangeDetectorRef);
432
+ /** Semantic animation name, e.g. `fade up`, `horizontal flip`, `pulse`. Optional ` in` / ` out` suffix. */
433
+ this.suiAnimation = 'fade';
434
+ /** Duration in ms or CSS time string (e.g. `500`, `500ms`, `0.5s`). */
435
+ this.suiDuration = 500;
436
+ /** When not forced by the animation string, controls automatic in vs out (default mirrors Semantic `auto`). */
437
+ this.suiDirection = 'auto';
438
+ /** Whether the host is shown (after transitions complete). Two-way bindable. */
439
+ this.suiVisible = true;
440
+ /** Increment to replay the current **static** animation (`pulse`, `shake`, …). */
441
+ this.suiPlay = 0;
442
+ /** Disables animations; visibility updates apply immediately. */
443
+ this.suiDisabled = false;
444
+ this.suiVisibleChange = new EventEmitter();
445
+ /** Fires when a transition begins (visibility or static). */
446
+ this.suiAnimationStart = new EventEmitter();
447
+ /** Fires when a transition finishes. */
448
+ this.suiAnimationComplete = new EventEmitter();
449
+ /** After an inward transition that ends visible. */
450
+ this.suiOnShow = new EventEmitter();
451
+ /** After an outward transition that ends hidden. */
452
+ this.suiOnHide = new EventEmitter();
453
+ /** Mirrors Semantic UI state classes. */
454
+ this.animating = false;
455
+ /** Final hidden state (opacity/visibility), not necessarily DOM removal. */
456
+ this.hidden = false;
457
+ this.hostClassList = '';
458
+ this.player = null;
459
+ this.initialized = false;
460
+ this.lastVisible = true;
461
+ this.lastPlay = 0;
462
+ }
463
+ ngOnChanges(changes) {
464
+ if (changes['suiPlay']) {
465
+ if (changes['suiPlay'].firstChange) {
466
+ this.lastPlay = this.suiPlay;
467
+ }
468
+ else if (this.suiPlay !== this.lastPlay) {
469
+ this.lastPlay = this.suiPlay;
470
+ this.runStaticAnimation();
471
+ }
472
+ }
473
+ if (changes['suiVisible']) {
474
+ const cur = this.suiVisible;
475
+ if (!this.initialized) {
476
+ this.initialized = true;
477
+ this.lastVisible = cur;
478
+ this.applyImmediateVisibility(cur);
479
+ this.syncHostClasses();
480
+ return;
481
+ }
482
+ if (cur !== this.lastVisible) {
483
+ this.lastVisible = cur;
484
+ this.runVisibilityTransition(cur);
485
+ }
486
+ }
487
+ if (changes['suiAnimation'] ||
488
+ changes['suiDuration'] ||
489
+ changes['suiDirection'] ||
490
+ changes['suiDisabled']) {
491
+ this.syncHostClasses();
492
+ }
493
+ }
494
+ ngOnDestroy() {
495
+ this.destroyPlayer();
496
+ }
497
+ /** Show with the current animation settings. */
498
+ show() {
499
+ this.setVisible(true);
500
+ }
501
+ /** Hide with the current animation settings. */
502
+ hide() {
503
+ this.setVisible(false);
504
+ }
505
+ /** Toggle visibility. */
506
+ toggle() {
507
+ this.setVisible(!this.suiVisible);
508
+ }
509
+ /** Stop the active animation (Semantic `stop` / `stop all` style: clears current player). */
510
+ stop() {
511
+ this.destroyPlayer();
512
+ this.animating = false;
513
+ this.syncHostClasses();
514
+ this.cdr.markForCheck();
515
+ }
516
+ /** Run a static attention animation if `suiAnimation` is static; no-op otherwise. */
517
+ playStatic() {
518
+ this.runStaticAnimation();
519
+ }
520
+ setVisible(value) {
521
+ if (this.suiVisible === value) {
522
+ return;
523
+ }
524
+ this.suiVisible = value;
525
+ this.suiVisibleChange.emit(value);
526
+ if (!this.initialized) {
527
+ this.initialized = true;
528
+ this.lastVisible = value;
529
+ this.applyImmediateVisibility(value);
530
+ this.syncHostClasses();
531
+ this.cdr.markForCheck();
532
+ return;
533
+ }
534
+ this.lastVisible = value;
535
+ this.runVisibilityTransition(value);
536
+ this.cdr.markForCheck();
537
+ }
538
+ runVisibilityTransition(targetVisible) {
539
+ if (this.suiDisabled) {
540
+ this.suiAnimationStart.emit();
541
+ this.applyImmediateVisibility(targetVisible);
542
+ this.emitVisibilityCallbacks(targetVisible);
543
+ this.cdr.markForCheck();
544
+ return;
545
+ }
546
+ const { baseName, explicitDirection } = parseTransitionName(this.suiAnimation);
547
+ const direction = resolveTransitionDirection(explicitDirection, this.suiDirection, targetVisible);
548
+ const motionBase = isStaticTransitionName(baseName) ? 'fade' : baseName;
549
+ const durationCss = durationToCss(this.suiDuration);
550
+ const steps = direction === 'in'
551
+ ? buildEnterSteps(motionBase, durationCss)
552
+ : buildLeaveSteps(motionBase, durationCss);
553
+ this.playSteps(steps, targetVisible);
554
+ }
555
+ runStaticAnimation() {
556
+ const { baseName } = parseTransitionName(this.suiAnimation);
557
+ if (!isStaticTransitionName(baseName) || this.suiDisabled) {
558
+ return;
559
+ }
560
+ const steps = buildStaticSteps(baseName, durationToCss(this.suiDuration));
561
+ if (!steps) {
562
+ return;
563
+ }
564
+ this.playSteps(steps, true, true);
565
+ }
566
+ playSteps(steps, endingVisible, isStatic = false) {
567
+ this.destroyPlayer();
568
+ this.animating = true;
569
+ this.suiAnimationStart.emit();
570
+ this.syncHostClasses();
571
+ this.cdr.markForCheck();
572
+ const factory = this.builder.build(steps);
573
+ const player = factory.create(this.el.nativeElement);
574
+ this.player = player;
575
+ player.onDone(() => {
576
+ this.zone.run(() => {
577
+ this.player = null;
578
+ this.animating = false;
579
+ if (endingVisible) {
580
+ this.applyVisibleEndState();
581
+ this.hidden = false;
582
+ }
583
+ else {
584
+ this.applyHiddenEndState();
585
+ this.hidden = true;
586
+ }
587
+ this.suiAnimationComplete.emit();
588
+ if (!isStatic) {
589
+ if (endingVisible) {
590
+ this.suiOnShow.emit();
591
+ }
592
+ else {
593
+ this.suiOnHide.emit();
594
+ }
595
+ }
596
+ this.syncHostClasses();
597
+ this.cdr.markForCheck();
598
+ });
599
+ });
600
+ player.play();
601
+ }
602
+ emitVisibilityCallbacks(targetVisible) {
603
+ this.suiAnimationComplete.emit();
604
+ if (targetVisible) {
605
+ this.suiOnShow.emit();
606
+ }
607
+ else {
608
+ this.suiOnHide.emit();
609
+ }
610
+ }
611
+ applyImmediateVisibility(visible) {
612
+ this.destroyPlayer();
613
+ this.animating = false;
614
+ if (visible) {
615
+ this.applyVisibleEndState();
616
+ this.hidden = false;
617
+ }
618
+ else {
619
+ this.applyHiddenEndState();
620
+ this.hidden = true;
621
+ }
622
+ this.syncHostClasses();
623
+ }
624
+ applyVisibleEndState() {
625
+ const el = this.el.nativeElement;
626
+ this.renderer.setStyle(el, 'opacity', '1');
627
+ this.renderer.setStyle(el, 'visibility', 'visible');
628
+ this.renderer.removeStyle(el, 'transform');
629
+ this.renderer.removeStyle(el, 'transform-origin');
630
+ this.renderer.removeStyle(el, 'box-shadow');
631
+ }
632
+ applyHiddenEndState() {
633
+ const el = this.el.nativeElement;
634
+ this.renderer.setStyle(el, 'opacity', '0');
635
+ this.renderer.setStyle(el, 'visibility', 'hidden');
636
+ this.renderer.removeStyle(el, 'transform');
637
+ this.renderer.removeStyle(el, 'transform-origin');
638
+ }
639
+ destroyPlayer() {
640
+ if (this.player) {
641
+ this.player.destroy();
642
+ this.player = null;
643
+ }
644
+ }
645
+ syncHostClasses() {
646
+ const { baseName } = parseTransitionName(this.suiAnimation);
647
+ const tokens = ClassUtils.combineToClass([
648
+ 'transition',
649
+ ...baseName.split(' '),
650
+ ClassUtils.getPropClass(this.animating, 'animating'),
651
+ ClassUtils.getPropClass(this.suiDisabled, 'disabled'),
652
+ ClassUtils.getPropClass(!this.hidden, 'visible'),
653
+ ClassUtils.getPropClass(this.hidden, 'hidden')
654
+ ]);
655
+ this.hostClassList = ClassUtils.removeExcessWhitespace(tokens);
656
+ }
657
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
658
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.23", type: SuiTransitionComponent, isStandalone: true, selector: "sui-transition", inputs: { suiAnimation: "suiAnimation", suiDuration: "suiDuration", suiDirection: "suiDirection", suiVisible: "suiVisible", suiPlay: "suiPlay", suiDisabled: "suiDisabled" }, outputs: { suiVisibleChange: "suiVisibleChange", suiAnimationStart: "suiAnimationStart", suiAnimationComplete: "suiAnimationComplete", suiOnShow: "suiOnShow", suiOnHide: "suiOnHide" }, host: { properties: { "class": "hostClassList" } }, exportAs: ["suiTransition"], usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
659
+ }
660
+ __decorate([
661
+ InputBoolean()
662
+ ], SuiTransitionComponent.prototype, "suiVisible", void 0);
663
+ __decorate([
664
+ InputBoolean()
665
+ ], SuiTransitionComponent.prototype, "suiDisabled", void 0);
666
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionComponent, decorators: [{
667
+ type: Component,
668
+ args: [{
669
+ standalone: true,
670
+ selector: 'sui-transition',
671
+ exportAs: 'suiTransition',
672
+ encapsulation: ViewEncapsulation.None,
673
+ changeDetection: ChangeDetectionStrategy.OnPush,
674
+ template: '<ng-content></ng-content>',
675
+ host: {
676
+ '[class]': 'hostClassList'
677
+ }
678
+ }]
679
+ }], propDecorators: { suiAnimation: [{
680
+ type: Input
681
+ }], suiDuration: [{
682
+ type: Input
683
+ }], suiDirection: [{
684
+ type: Input
685
+ }], suiVisible: [{
686
+ type: Input
687
+ }], suiPlay: [{
688
+ type: Input
689
+ }], suiDisabled: [{
690
+ type: Input
691
+ }], suiVisibleChange: [{
692
+ type: Output
693
+ }], suiAnimationStart: [{
694
+ type: Output
695
+ }], suiAnimationComplete: [{
696
+ type: Output
697
+ }], suiOnShow: [{
698
+ type: Output
699
+ }], suiOnHide: [{
700
+ type: Output
701
+ }] } });
702
+
703
+ class SuiTransitionModule {
704
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
705
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionModule, imports: [SuiTransitionComponent], exports: [SuiTransitionComponent] }); }
706
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionModule }); }
707
+ }
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SuiTransitionModule, decorators: [{
709
+ type: NgModule,
710
+ args: [{
711
+ imports: [SuiTransitionComponent],
712
+ exports: [SuiTransitionComponent]
713
+ }]
714
+ }] });
715
+
716
+ /**
717
+ * Generated bundle index. Do not edit.
718
+ */
719
+
720
+ export { SuiTransitionComponent, SuiTransitionModule, buildEnterSteps, buildLeaveSteps, buildStaticSteps, durationToCss, getMotionForVisibility, isStaticTransitionName, listRegisteredMotionKeys, parseTransitionName, resolveTransitionDirection };
721
+ //# sourceMappingURL=ngx-semantic-modules-transition.mjs.map