hudini 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +1 -27
  2. package/dist/components/badge/badge.d.ts +94 -0
  3. package/dist/components/badge/badge.d.ts.map +1 -0
  4. package/dist/components/badge/badge.js +180 -0
  5. package/dist/components/badge/badge.js.map +1 -0
  6. package/dist/components/badge/badge.spec.d.ts +2 -0
  7. package/dist/components/badge/badge.spec.d.ts.map +1 -0
  8. package/dist/components/badge/badge.spec.js +195 -0
  9. package/dist/components/badge/badge.spec.js.map +1 -0
  10. package/dist/components/badge/index.d.ts +2 -0
  11. package/dist/components/badge/index.d.ts.map +1 -0
  12. package/dist/components/badge/index.js +2 -0
  13. package/dist/components/badge/index.js.map +1 -0
  14. package/dist/components/icon-button/icon-button.d.ts +2 -8
  15. package/dist/components/icon-button/icon-button.d.ts.map +1 -1
  16. package/dist/components/icon-button/icon-button.js +10 -86
  17. package/dist/components/icon-button/icon-button.js.map +1 -1
  18. package/dist/components/index.d.ts +1 -4
  19. package/dist/components/index.d.ts.map +1 -1
  20. package/dist/components/index.js +1 -4
  21. package/dist/components/index.js.map +1 -1
  22. package/dist/components/panel/panel.d.ts +8 -8
  23. package/dist/components/panel/panel.d.ts.map +1 -1
  24. package/dist/components/panel/panel.js +29 -30
  25. package/dist/components/panel/panel.js.map +1 -1
  26. package/dist/components/text/text.d.ts +21 -4
  27. package/dist/components/text/text.d.ts.map +1 -1
  28. package/dist/components/text/text.js +14 -14
  29. package/dist/components/text/text.js.map +1 -1
  30. package/dist/components/text-button/text-button.d.ts +9 -18
  31. package/dist/components/text-button/text-button.d.ts.map +1 -1
  32. package/dist/components/text-button/text-button.js +38 -81
  33. package/dist/components/text-button/text-button.js.map +1 -1
  34. package/dist/components/text-button/text-button.spec.js +55 -9
  35. package/dist/components/text-button/text-button.spec.js.map +1 -1
  36. package/dist/hudini.js +2842 -4529
  37. package/dist/hudini.min.js +1 -1
  38. package/dist/loaders/load-fonts.d.ts +29 -0
  39. package/dist/loaders/load-fonts.d.ts.map +1 -1
  40. package/dist/loaders/load-fonts.js +20 -1
  41. package/dist/loaders/load-fonts.js.map +1 -1
  42. package/dist/utils/button-style.d.ts +16 -0
  43. package/dist/utils/button-style.d.ts.map +1 -0
  44. package/dist/utils/button-style.js +35 -0
  45. package/dist/utils/button-style.js.map +1 -0
  46. package/dist/utils/index.d.ts +2 -0
  47. package/dist/utils/index.d.ts.map +1 -1
  48. package/dist/utils/index.js +2 -0
  49. package/dist/utils/index.js.map +1 -1
  50. package/dist/utils/number-to-rgb.d.ts +16 -0
  51. package/dist/utils/number-to-rgb.d.ts.map +1 -0
  52. package/dist/utils/number-to-rgb.js +20 -0
  53. package/dist/utils/number-to-rgb.js.map +1 -0
  54. package/package.json +2 -2
  55. package/dist/components/flat-icon-button/flat-icon-button.d.ts +0 -60
  56. package/dist/components/flat-icon-button/flat-icon-button.d.ts.map +0 -1
  57. package/dist/components/flat-icon-button/flat-icon-button.js +0 -279
  58. package/dist/components/flat-icon-button/flat-icon-button.js.map +0 -1
  59. package/dist/components/flat-icon-button/index.d.ts +0 -2
  60. package/dist/components/flat-icon-button/index.d.ts.map +0 -1
  61. package/dist/components/flat-icon-button/index.js +0 -2
  62. package/dist/components/flat-icon-button/index.js.map +0 -1
  63. package/dist/components/flat-section-header/flat-section-header.d.ts +0 -143
  64. package/dist/components/flat-section-header/flat-section-header.d.ts.map +0 -1
  65. package/dist/components/flat-section-header/flat-section-header.js +0 -275
  66. package/dist/components/flat-section-header/flat-section-header.js.map +0 -1
  67. package/dist/components/flat-section-header/flat-section-header.spec.d.ts +0 -2
  68. package/dist/components/flat-section-header/flat-section-header.spec.d.ts.map +0 -1
  69. package/dist/components/flat-section-header/flat-section-header.spec.js +0 -255
  70. package/dist/components/flat-section-header/flat-section-header.spec.js.map +0 -1
  71. package/dist/components/flat-section-header/index.d.ts +0 -2
  72. package/dist/components/flat-section-header/index.d.ts.map +0 -1
  73. package/dist/components/flat-section-header/index.js +0 -2
  74. package/dist/components/flat-section-header/index.js.map +0 -1
  75. package/dist/components/flat-text-button/flat-text-button.d.ts +0 -165
  76. package/dist/components/flat-text-button/flat-text-button.d.ts.map +0 -1
  77. package/dist/components/flat-text-button/flat-text-button.js +0 -325
  78. package/dist/components/flat-text-button/flat-text-button.js.map +0 -1
  79. package/dist/components/flat-text-button/flat-text-button.spec.d.ts +0 -2
  80. package/dist/components/flat-text-button/flat-text-button.spec.d.ts.map +0 -1
  81. package/dist/components/flat-text-button/flat-text-button.spec.js +0 -243
  82. package/dist/components/flat-text-button/flat-text-button.spec.js.map +0 -1
  83. package/dist/components/flat-text-button/index.d.ts +0 -2
  84. package/dist/components/flat-text-button/index.d.ts.map +0 -1
  85. package/dist/components/flat-text-button/index.js +0 -2
  86. package/dist/components/flat-text-button/index.js.map +0 -1
  87. package/dist/components/section-header/index.d.ts +0 -2
  88. package/dist/components/section-header/index.d.ts.map +0 -1
  89. package/dist/components/section-header/index.js +0 -2
  90. package/dist/components/section-header/index.js.map +0 -1
  91. package/dist/components/section-header/section-header.d.ts +0 -149
  92. package/dist/components/section-header/section-header.d.ts.map +0 -1
  93. package/dist/components/section-header/section-header.js +0 -292
  94. package/dist/components/section-header/section-header.js.map +0 -1
  95. package/dist/components/section-header/section-header.spec.d.ts +0 -2
  96. package/dist/components/section-header/section-header.spec.d.ts.map +0 -1
  97. package/dist/components/section-header/section-header.spec.js +0 -264
  98. package/dist/components/section-header/section-header.spec.js.map +0 -1
@@ -1,143 +0,0 @@
1
- import { GameObjects, Scene } from 'phaser';
2
- import { type ColorKey, type FontKey, type FontSizeKey, type RadiusKey, type SpacingKey } from 'phaser-wind';
3
- export type FlatSectionHeaderParams = {
4
- /** The Phaser scene to add the header to */
5
- scene: Scene;
6
- /** X position of the header */
7
- x: number;
8
- /** Y position of the header */
9
- y: number;
10
- /** Text content of the header */
11
- text: string;
12
- /** Font size in px (number) or a Phaser Wind font size token (string). Defaults to 'lg'. */
13
- fontSize?: FontSizeKey | number;
14
- /** Font family. Defaults to 'display'. */
15
- font?: FontKey | string;
16
- /** Background color. Defaults to 'blue-600'. */
17
- backgroundColor?: ColorKey | string;
18
- /** Text color. Defaults to 'white'. */
19
- textColor?: ColorKey | string;
20
- /** Border radius in px (number) or a Phaser Wind radius token (string). Defaults to 'md'. */
21
- borderRadius?: RadiusKey | number;
22
- /** Margin/padding in px (number) or a Phaser Wind spacing token (string). Defaults to '4'. */
23
- margin?: SpacingKey | number;
24
- };
25
- /**
26
- * A flat section header component without gradient overlays, with text stroke and auto-sizing
27
- */
28
- export declare class FlatSectionHeader extends GameObjects.Container {
29
- /** The white border sprite of the header */
30
- whiteBorderSprite: GameObjects.Sprite;
31
- /** The background sprite of the header */
32
- backgroundSprite: GameObjects.Sprite;
33
- /** The text object of the header */
34
- headerText: GameObjects.Text;
35
- /** Reference to the PhaserWind plugin */
36
- private pw;
37
- /** Font size in pixels */
38
- private fontSizePx;
39
- /** Margin size in pixels */
40
- private marginPx;
41
- /** Border radius in pixels */
42
- private borderRadiusPx;
43
- /** Background color value */
44
- private colorButton;
45
- /** Text color value */
46
- private textColorValue;
47
- /** Font family value */
48
- private fontFamily;
49
- /** Text content value */
50
- private textValue;
51
- /**
52
- * Creates a new FlatSectionHeader
53
- * @param params Configuration parameters for the header
54
- */
55
- constructor({ scene, x, y, text, fontSize, font, backgroundColor, textColor, borderRadius, margin, }: FlatSectionHeaderParams);
56
- /**
57
- * Sets the text content of the header
58
- * @param text New text content
59
- * @returns this for chaining
60
- */
61
- setText(text: string): this;
62
- /**
63
- * Sets the font size of the header text
64
- * @param fontSize New font size (number in px or FontSizeKey)
65
- * @returns this for chaining
66
- */
67
- setFontSize(fontSize: FontSizeKey | number): this;
68
- /**
69
- * Sets the font family of the header text
70
- * @param font New font family (FontKey or string)
71
- * @returns this for chaining
72
- */
73
- setFont(font: FontKey | string): this;
74
- /**
75
- * Sets the background color of the header
76
- * @param color New background color (ColorKey or string)
77
- * @returns this for chaining
78
- */
79
- setBackgroundColor(color: ColorKey | string): this;
80
- /**
81
- * Sets the text color of the header
82
- * @param color New text color (ColorKey or string)
83
- * @returns this for chaining
84
- */
85
- setTextColor(color: ColorKey | string): this;
86
- /**
87
- * Sets the border radius of the header
88
- * @param borderRadius New border radius (number in px or RadiusKey)
89
- * @returns this for chaining
90
- */
91
- setBorderRadius(borderRadius: RadiusKey | number): this;
92
- /**
93
- * Sets the margin/padding of the header
94
- * @param margin New margin size (number in px or SpacingKey)
95
- * @returns this for chaining
96
- */
97
- setMargin(margin: SpacingKey | number): this;
98
- /**
99
- * Creates the header text game object
100
- * @param scene The scene to add the text to
101
- */
102
- private createHeaderText;
103
- /**
104
- * Creates the white border sprite for the header
105
- * @param scene The scene to add the sprite to
106
- */
107
- private createWhiteBorderSprite;
108
- /**
109
- * Creates the background sprite for the header
110
- * @param scene The scene to add the sprite to
111
- */
112
- private createBackgroundSprite;
113
- /**
114
- * Regenerates all graphics after a property change
115
- */
116
- private regenerateGraphics;
117
- /**
118
- * Creates a texture for the header's white border.
119
- * @param scene Phaser scene.
120
- * @returns The texture key.
121
- */
122
- private createWhiteBorderTexture;
123
- /**
124
- * Creates a texture for the header's background.
125
- * @param scene Phaser scene.
126
- * @returns The texture key.
127
- */
128
- private createBackgroundTexture;
129
- /**
130
- * Gets the dimensions of the header based on text content
131
- * @returns Object containing width and height
132
- */
133
- private getHeaderDimensions;
134
- /**
135
- * Sets up the container with all sprites in the correct order
136
- */
137
- private setupContainer;
138
- /**
139
- * Sets up interactivity for the header
140
- */
141
- private setupInteractivity;
142
- }
143
- //# sourceMappingURL=flat-section-header.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flat-section-header.d.ts","sourceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAGL,KAAK,QA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
4
- import { getPWFromScene } from '../../utils/get-pw-from-scene';
5
- import { Text } from '../text';
6
- // Border constants
7
- const BLACK_BORDER_THICKNESS = 2;
8
- const WHITE_BORDER_EXTRA_PIXELS_PER_SIDE = 2;
9
- const WHITE_BORDER_TOTAL_EXTRA_PIXELS = WHITE_BORDER_EXTRA_PIXELS_PER_SIDE * 3; // 6 pixels total
10
- const WHITE_BORDER_RADIUS_EXTRA = 2;
11
- /**
12
- * A flat section header component without gradient overlays, with text stroke and auto-sizing
13
- */
14
- export class FlatSectionHeader extends GameObjects.Container {
15
- /** The white border sprite of the header */
16
- whiteBorderSprite;
17
- /** The background sprite of the header */
18
- backgroundSprite;
19
- /** The text object of the header */
20
- headerText;
21
- /** Reference to the PhaserWind plugin */
22
- pw;
23
- /** Font size in pixels */
24
- fontSizePx;
25
- /** Margin size in pixels */
26
- marginPx;
27
- /** Border radius in pixels */
28
- borderRadiusPx;
29
- /** Background color value */
30
- colorButton;
31
- /** Text color value */
32
- textColorValue;
33
- /** Font family value */
34
- fontFamily;
35
- /** Text content value */
36
- textValue;
37
- /**
38
- * Creates a new FlatSectionHeader
39
- * @param params Configuration parameters for the header
40
- */
41
- constructor({ scene, x, y, text, fontSize, font, backgroundColor = 'blue-600', textColor = 'white', borderRadius = 'md', margin = '4', }) {
42
- super(scene, x, y);
43
- this.pw = getPWFromScene(scene);
44
- // Store values
45
- this.textValue = text;
46
- this.fontSizePx =
47
- typeof fontSize === 'number'
48
- ? fontSize
49
- : this.pw.fontSize.px(fontSize ?? 'lg');
50
- this.marginPx =
51
- typeof margin === 'number'
52
- ? margin
53
- : this.pw.spacing.px(margin ?? '4');
54
- this.borderRadiusPx =
55
- typeof borderRadius === 'number'
56
- ? borderRadius
57
- : this.pw.radius.px(borderRadius ?? 'md');
58
- this.colorButton = Color.rgb(backgroundColor);
59
- this.textColorValue = Color.rgb(textColor);
60
- this.fontFamily = font ? (typeof font === 'string' ? font : this.pw.font.family(font)) : 'Bebas Neue';
61
- this.createHeaderText(scene);
62
- this.createWhiteBorderSprite(scene);
63
- this.createBackgroundSprite(scene);
64
- this.setupContainer();
65
- this.setupInteractivity();
66
- }
67
- /**
68
- * Sets the text content of the header
69
- * @param text New text content
70
- * @returns this for chaining
71
- */
72
- setText(text) {
73
- this.textValue = text;
74
- this.headerText.setText(text);
75
- this.regenerateGraphics();
76
- return this;
77
- }
78
- /**
79
- * Sets the font size of the header text
80
- * @param fontSize New font size (number in px or FontSizeKey)
81
- * @returns this for chaining
82
- */
83
- setFontSize(fontSize) {
84
- this.fontSizePx =
85
- typeof fontSize === 'number'
86
- ? fontSize
87
- : this.pw.fontSize.px(fontSize ?? 'lg');
88
- this.headerText.setFontSize(this.fontSizePx);
89
- this.regenerateGraphics();
90
- return this;
91
- }
92
- /**
93
- * Sets the font family of the header text
94
- * @param font New font family (FontKey or string)
95
- * @returns this for chaining
96
- */
97
- setFont(font) {
98
- this.fontFamily = font ? (typeof font === 'string' ? font : this.pw.font.family(font)) : 'Bebas Neue';
99
- this.headerText.setFontFamily(this.fontFamily);
100
- this.regenerateGraphics();
101
- return this;
102
- }
103
- /**
104
- * Sets the background color of the header
105
- * @param color New background color (ColorKey or string)
106
- * @returns this for chaining
107
- */
108
- setBackgroundColor(color) {
109
- this.colorButton = Color.rgb(color);
110
- this.regenerateGraphics();
111
- return this;
112
- }
113
- /**
114
- * Sets the text color of the header
115
- * @param color New text color (ColorKey or string)
116
- * @returns this for chaining
117
- */
118
- setTextColor(color) {
119
- this.textColorValue = Color.rgb(color);
120
- this.headerText.setColor(this.textColorValue);
121
- return this;
122
- }
123
- /**
124
- * Sets the border radius of the header
125
- * @param borderRadius New border radius (number in px or RadiusKey)
126
- * @returns this for chaining
127
- */
128
- setBorderRadius(borderRadius) {
129
- this.borderRadiusPx =
130
- typeof borderRadius === 'number'
131
- ? borderRadius
132
- : this.pw.radius.px(borderRadius ?? 'md');
133
- this.regenerateGraphics();
134
- return this;
135
- }
136
- /**
137
- * Sets the margin/padding of the header
138
- * @param margin New margin size (number in px or SpacingKey)
139
- * @returns this for chaining
140
- */
141
- setMargin(margin) {
142
- this.marginPx =
143
- typeof margin === 'number'
144
- ? margin
145
- : this.pw.spacing.px(margin ?? '4');
146
- this.regenerateGraphics();
147
- return this;
148
- }
149
- /**
150
- * Creates the header text game object
151
- * @param scene The scene to add the text to
152
- */
153
- createHeaderText(scene) {
154
- this.headerText = new Text({
155
- scene,
156
- x: 0,
157
- y: 0,
158
- text: this.textValue,
159
- size: this.fontSizePx,
160
- fontFamily: this.fontFamily,
161
- });
162
- this.headerText.setOrigin(0.5, 0.5);
163
- }
164
- /**
165
- * Creates the white border sprite for the header
166
- * @param scene The scene to add the sprite to
167
- */
168
- createWhiteBorderSprite(scene) {
169
- const whiteBorderTexture = this.createWhiteBorderTexture(scene);
170
- this.whiteBorderSprite = scene.add.sprite(0, 0, whiteBorderTexture);
171
- this.whiteBorderSprite.setOrigin(0.5, 0.5);
172
- }
173
- /**
174
- * Creates the background sprite for the header
175
- * @param scene The scene to add the sprite to
176
- */
177
- createBackgroundSprite(scene) {
178
- const backgroundTexture = this.createBackgroundTexture(scene);
179
- this.backgroundSprite = scene.add.sprite(0, 0, backgroundTexture);
180
- this.backgroundSprite.setOrigin(0.5, 0.5);
181
- }
182
- /**
183
- * Regenerates all graphics after a property change
184
- */
185
- regenerateGraphics() {
186
- // Update text bounds after text/font changes
187
- this.headerText.setText(this.textValue);
188
- // Regenerate textures
189
- const whiteBorderTexture = this.createWhiteBorderTexture(this.scene);
190
- const backgroundTexture = this.createBackgroundTexture(this.scene);
191
- this.whiteBorderSprite.setTexture(whiteBorderTexture);
192
- this.backgroundSprite.setTexture(backgroundTexture);
193
- }
194
- /**
195
- * Creates a texture for the header's white border.
196
- * @param scene Phaser scene.
197
- * @returns The texture key.
198
- */
199
- createWhiteBorderTexture(scene) {
200
- const { width, height } = this.getHeaderDimensions();
201
- const textureKey = `flatSectionHeader_whiteBorder_${this.borderRadiusPx}_${width}_${height}`;
202
- // White border is larger on each side
203
- const borderWidth = width + WHITE_BORDER_TOTAL_EXTRA_PIXELS;
204
- const borderHeight = height + WHITE_BORDER_TOTAL_EXTRA_PIXELS;
205
- // Add some padding for texture
206
- const padding = 8;
207
- const textureWidth = borderWidth + padding * 2;
208
- const textureHeight = borderHeight + padding * 2;
209
- const graphics = scene.add.graphics();
210
- const maxRadius = Math.floor(Math.min(borderWidth / 2, borderHeight / 2));
211
- const effectiveRadius = Math.min(this.borderRadiusPx + WHITE_BORDER_RADIUS_EXTRA, maxRadius);
212
- const finalRadius = Math.max(0, effectiveRadius);
213
- // White border (outer)
214
- graphics.fillStyle(Color.hex('white'), 1);
215
- graphics.fillRoundedRect(padding, padding, borderWidth, borderHeight, finalRadius);
216
- graphics.generateTexture(textureKey, textureWidth, textureHeight);
217
- graphics.destroy();
218
- return textureKey;
219
- }
220
- /**
221
- * Creates a texture for the header's background.
222
- * @param scene Phaser scene.
223
- * @returns The texture key.
224
- */
225
- createBackgroundTexture(scene) {
226
- const { width, height } = this.getHeaderDimensions();
227
- const textureKey = `flatSectionHeader_bg_${this.colorButton}_${this.borderRadiusPx}_${width}_${height}`;
228
- // Add some padding for texture
229
- const padding = 8;
230
- const textureWidth = width + padding * 2;
231
- const textureHeight = height + padding * 2;
232
- const graphics = scene.add.graphics();
233
- const maxRadius = Math.floor(Math.min(width / 2, height / 2));
234
- const effectiveRadius = Math.min(this.borderRadiusPx, maxRadius);
235
- const finalRadius = Math.max(0, effectiveRadius);
236
- // Main background (flat, no gradient)
237
- graphics.fillStyle(Color.hex(this.colorButton), 1);
238
- graphics.fillRoundedRect(padding, padding, width, height, finalRadius);
239
- // Black stroke border
240
- graphics.lineStyle(BLACK_BORDER_THICKNESS, Color.hex('black'), 1);
241
- graphics.strokeRoundedRect(padding, padding, width, height, finalRadius);
242
- graphics.generateTexture(textureKey, textureWidth, textureHeight);
243
- graphics.destroy();
244
- return textureKey;
245
- }
246
- /**
247
- * Gets the dimensions of the header based on text content
248
- * @returns Object containing width and height
249
- */
250
- getHeaderDimensions() {
251
- const textBounds = this.headerText.getBounds();
252
- const width = textBounds.width + this.marginPx * 2;
253
- const height = textBounds.height + this.marginPx * 2;
254
- return { width, height };
255
- }
256
- /**
257
- * Sets up the container with all sprites in the correct order
258
- */
259
- setupContainer() {
260
- this.add([this.whiteBorderSprite, this.backgroundSprite, this.headerText]);
261
- }
262
- /**
263
- * Sets up interactivity for the header
264
- */
265
- setupInteractivity() {
266
- this.setInteractive();
267
- this.on('pointerdown', () => {
268
- this.setScale(0.95);
269
- this.on('pointerup', () => {
270
- this.setScale(1);
271
- });
272
- });
273
- }
274
- }
275
- //# sourceMappingURL=flat-section-header.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flat-section-header.js","sourceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAAS,MAAM,QAAQ,CAAC;AAC5C,OAAO,EACL,KAAK,GAON,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAyB/B,mBAAmB;AACnB,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAC7C,MAAM,+BAA+B,GAAG,kCAAkC,GAAG,CAAC,CAAC,CAAC,iBAAiB;AACjG,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW,CAAC,SAAS;IAC1D,4CAA4C;IACrC,iBAAiB,CAAsB;IAC9C,0CAA0C;IACnC,gBAAgB,CAAsB;IAC7C,oCAAoC;IAC7B,UAAU,CAAoB;IAErC,yCAAyC;IACjC,EAAE,CAAuB;IACjC,0BAA0B;IAClB,UAAU,CAAU;IAC5B,4BAA4B;IACpB,QAAQ,CAAU;IAC1B,8BAA8B;IACtB,cA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ceRoot":"","sources":["../../../src/components/flat-section-header/flat-section-header.spec.ts"],"names":[],"mappings":""}