@uibit/text-rotator 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # Text Rotator
2
2
 
3
+ [![NPM Version](https://img.shields.io/npm/v/@uibit/text-rotator.svg?style=flat-square&color=black)](https://www.npmjs.com/package/@uibit/text-rotator)
4
+
5
+
3
6
  [Interactive Demonstration](https://rawlings.github.io/uibit/components/text-rotator)
4
7
 
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @uibit/text-rotator
12
+ ```
13
+
14
+
5
15
  Text Rotator cycles through an array of phrases inside a static sentence. It transitions between list items using vertical slide or 3D perspective flip animations, designed to highlight shifting value propositions within a compact, responsive boundary.
6
16
 
7
17
  ## Value Delivery
@@ -60,7 +60,7 @@
60
60
  "declarations": [
61
61
  {
62
62
  "kind": "class",
63
- "description": "Cycles through an array of phrases inside a static sentence by animating between\nitems with a vertical slide or 3D flip transition. Designed to highlight changing\nvalue propositions without motion outside the component boundary.\n\nPass static prefix or wrapper text inside the default slot, and phrases to cycle through\ninside elements with `slot=\"text\"` (e.g. `<span slot=\"text\">phrase</span>`).",
63
+ "description": "Cycles through an array of phrases inside a static sentence by animating between",
64
64
  "name": "TextRotator",
65
65
  "cssProperties": [
66
66
  {
@@ -218,6 +218,211 @@
218
218
  }
219
219
  }
220
220
  ]
221
+ },
222
+ {
223
+ "kind": "field",
224
+ "name": "locale",
225
+ "type": {
226
+ "text": "string"
227
+ },
228
+ "default": "''",
229
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
230
+ "attribute": "locale",
231
+ "inheritedFrom": {
232
+ "name": "UIBitElement",
233
+ "module": "../../platform/core/src/element.ts"
234
+ }
235
+ },
236
+ {
237
+ "kind": "field",
238
+ "name": "resolvedLocale",
239
+ "type": {
240
+ "text": "string | undefined"
241
+ },
242
+ "description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
243
+ "readonly": true,
244
+ "inheritedFrom": {
245
+ "name": "UIBitElement",
246
+ "module": "../../platform/core/src/element.ts"
247
+ }
248
+ },
249
+ {
250
+ "kind": "field",
251
+ "name": "_disposables",
252
+ "type": {
253
+ "text": "Set<() => void>"
254
+ },
255
+ "privacy": "private",
256
+ "default": "new Set()",
257
+ "inheritedFrom": {
258
+ "name": "UIBitElement",
259
+ "module": "../../platform/core/src/element.ts"
260
+ }
261
+ },
262
+ {
263
+ "kind": "method",
264
+ "name": "createProperty",
265
+ "static": true,
266
+ "parameters": [
267
+ {
268
+ "name": "name",
269
+ "type": {
270
+ "text": "PropertyKey"
271
+ }
272
+ },
273
+ {
274
+ "name": "options",
275
+ "optional": true,
276
+ "type": {
277
+ "text": "PropertyDeclaration"
278
+ }
279
+ }
280
+ ],
281
+ "description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default.",
282
+ "inheritedFrom": {
283
+ "name": "UIBitElement",
284
+ "module": "../../platform/core/src/element.ts"
285
+ }
286
+ },
287
+ {
288
+ "kind": "method",
289
+ "name": "finalizeStyles",
290
+ "static": true,
291
+ "return": {
292
+ "type": {
293
+ "text": "Array<any>"
294
+ }
295
+ },
296
+ "parameters": [
297
+ {
298
+ "name": "styles",
299
+ "optional": true,
300
+ "type": {
301
+ "text": "CSSResultGroup"
302
+ }
303
+ }
304
+ ],
305
+ "description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles.",
306
+ "inheritedFrom": {
307
+ "name": "UIBitElement",
308
+ "module": "../../platform/core/src/element.ts"
309
+ }
310
+ },
311
+ {
312
+ "kind": "method",
313
+ "name": "dispatchCustomEvent",
314
+ "return": {
315
+ "type": {
316
+ "text": "boolean"
317
+ }
318
+ },
319
+ "parameters": [
320
+ {
321
+ "name": "name",
322
+ "type": {
323
+ "text": "string"
324
+ }
325
+ },
326
+ {
327
+ "name": "detail",
328
+ "optional": true,
329
+ "type": {
330
+ "text": "T"
331
+ }
332
+ },
333
+ {
334
+ "name": "options",
335
+ "optional": true,
336
+ "type": {
337
+ "text": "Omit<CustomEventInit<T>, 'detail'>"
338
+ }
339
+ }
340
+ ],
341
+ "description": "Helper to dispatch a custom event with standard bubbles and composed options.",
342
+ "inheritedFrom": {
343
+ "name": "UIBitElement",
344
+ "module": "../../platform/core/src/element.ts"
345
+ }
346
+ },
347
+ {
348
+ "kind": "method",
349
+ "name": "getCssPropertyValue",
350
+ "return": {
351
+ "type": {
352
+ "text": "string"
353
+ }
354
+ },
355
+ "parameters": [
356
+ {
357
+ "name": "propertyName",
358
+ "type": {
359
+ "text": "string"
360
+ }
361
+ }
362
+ ],
363
+ "description": "Helper to retrieve a computed CSS custom property value from the element.",
364
+ "inheritedFrom": {
365
+ "name": "UIBitElement",
366
+ "module": "../../platform/core/src/element.ts"
367
+ }
368
+ },
369
+ {
370
+ "kind": "method",
371
+ "name": "registerDisposable",
372
+ "parameters": [
373
+ {
374
+ "name": "cleanup",
375
+ "type": {
376
+ "text": "() => void"
377
+ }
378
+ }
379
+ ],
380
+ "description": "Register a cleanup function to be executed when the element is disconnected from the DOM.",
381
+ "inheritedFrom": {
382
+ "name": "UIBitElement",
383
+ "module": "../../platform/core/src/element.ts"
384
+ }
385
+ },
386
+ {
387
+ "kind": "method",
388
+ "name": "listen",
389
+ "return": {
390
+ "type": {
391
+ "text": "() => void"
392
+ }
393
+ },
394
+ "parameters": [
395
+ {
396
+ "name": "target",
397
+ "type": {
398
+ "text": "EventTarget"
399
+ }
400
+ },
401
+ {
402
+ "name": "type",
403
+ "type": {
404
+ "text": "K"
405
+ }
406
+ },
407
+ {
408
+ "name": "listener",
409
+ "type": {
410
+ "text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
411
+ }
412
+ },
413
+ {
414
+ "name": "options",
415
+ "optional": true,
416
+ "type": {
417
+ "text": "boolean | AddEventListenerOptions"
418
+ }
419
+ }
420
+ ],
421
+ "description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected.",
422
+ "inheritedFrom": {
423
+ "name": "UIBitElement",
424
+ "module": "../../platform/core/src/element.ts"
425
+ }
221
426
  }
222
427
  ],
223
428
  "events": [
@@ -256,12 +461,32 @@
256
461
  "default": "true",
257
462
  "description": "Loop indefinitely. Set to false to stop after the last word.",
258
463
  "fieldName": "loop"
464
+ },
465
+ {
466
+ "name": "locale",
467
+ "type": {
468
+ "text": "string"
469
+ },
470
+ "default": "''",
471
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
472
+ "fieldName": "locale",
473
+ "inheritedFrom": {
474
+ "name": "UIBitElement",
475
+ "module": "../../platform/core/src/element.ts"
476
+ }
477
+ }
478
+ ],
479
+ "cssStates": [
480
+ {
481
+ "name": "rotating",
482
+ "description": "Active when the text transition is in progress."
259
483
  }
260
484
  ],
261
485
  "superclass": {
262
486
  "name": "UIBitElement",
263
487
  "package": "@uibit/core"
264
488
  },
489
+ "summary": "A rotating text carousel component with smooth CSS animation transitions.\nitems with a vertical slide or 3D flip transition. Designed to highlight changing\nvalue propositions without motion outside the component boundary.\n\nPass static prefix or wrapper text inside the default slot, and phrases to cycle through\ninside elements with `slot=\"text\"` (e.g. `<span slot=\"text\">phrase</span>`).",
265
490
  "tagName": "uibit-text-rotator",
266
491
  "customElement": true
267
492
  }
@@ -298,6 +523,250 @@
298
523
  "path": "src/types.ts",
299
524
  "declarations": [],
300
525
  "exports": []
526
+ },
527
+ {
528
+ "kind": "javascript-module",
529
+ "path": "../../platform/core/src/element.ts",
530
+ "declarations": [
531
+ {
532
+ "kind": "class",
533
+ "description": "A foundational base class for all UIBit web components.\nProvides custom event helpers, default kebab-case attribute mapping,\nautomatic cleanup/disposable tracking, and auto-injected reset styles.",
534
+ "name": "UIBitElement",
535
+ "members": [
536
+ {
537
+ "kind": "field",
538
+ "name": "locale",
539
+ "type": {
540
+ "text": "string"
541
+ },
542
+ "default": "''",
543
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
544
+ "attribute": "locale"
545
+ },
546
+ {
547
+ "kind": "field",
548
+ "name": "resolvedLocale",
549
+ "type": {
550
+ "text": "string | undefined"
551
+ },
552
+ "description": "Resolves the active locale for formatting and localization.\nChecks the `locale` property first, then traverses up the DOM to find\nthe nearest ancestor with a `lang` attribute, and finally falls back\nto undefined (which defaults to browser locale).",
553
+ "readonly": true
554
+ },
555
+ {
556
+ "kind": "field",
557
+ "name": "_disposables",
558
+ "type": {
559
+ "text": "Set<() => void>"
560
+ },
561
+ "privacy": "private",
562
+ "default": "new Set()"
563
+ },
564
+ {
565
+ "kind": "method",
566
+ "name": "createProperty",
567
+ "static": true,
568
+ "parameters": [
569
+ {
570
+ "name": "name",
571
+ "type": {
572
+ "text": "PropertyKey"
573
+ }
574
+ },
575
+ {
576
+ "name": "options",
577
+ "optional": true,
578
+ "type": {
579
+ "text": "PropertyDeclaration"
580
+ }
581
+ }
582
+ ],
583
+ "description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default."
584
+ },
585
+ {
586
+ "kind": "method",
587
+ "name": "finalizeStyles",
588
+ "static": true,
589
+ "return": {
590
+ "type": {
591
+ "text": "Array<any>"
592
+ }
593
+ },
594
+ "parameters": [
595
+ {
596
+ "name": "styles",
597
+ "optional": true,
598
+ "type": {
599
+ "text": "CSSResultGroup"
600
+ }
601
+ }
602
+ ],
603
+ "description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles."
604
+ },
605
+ {
606
+ "kind": "method",
607
+ "name": "dispatchCustomEvent",
608
+ "return": {
609
+ "type": {
610
+ "text": "boolean"
611
+ }
612
+ },
613
+ "parameters": [
614
+ {
615
+ "name": "name",
616
+ "type": {
617
+ "text": "string"
618
+ }
619
+ },
620
+ {
621
+ "name": "detail",
622
+ "optional": true,
623
+ "type": {
624
+ "text": "T"
625
+ }
626
+ },
627
+ {
628
+ "name": "options",
629
+ "optional": true,
630
+ "type": {
631
+ "text": "Omit<CustomEventInit<T>, 'detail'>"
632
+ }
633
+ }
634
+ ],
635
+ "description": "Helper to dispatch a custom event with standard bubbles and composed options."
636
+ },
637
+ {
638
+ "kind": "method",
639
+ "name": "getCssPropertyValue",
640
+ "return": {
641
+ "type": {
642
+ "text": "string"
643
+ }
644
+ },
645
+ "parameters": [
646
+ {
647
+ "name": "propertyName",
648
+ "type": {
649
+ "text": "string"
650
+ }
651
+ }
652
+ ],
653
+ "description": "Helper to retrieve a computed CSS custom property value from the element."
654
+ },
655
+ {
656
+ "kind": "method",
657
+ "name": "registerDisposable",
658
+ "parameters": [
659
+ {
660
+ "name": "cleanup",
661
+ "type": {
662
+ "text": "() => void"
663
+ }
664
+ }
665
+ ],
666
+ "description": "Register a cleanup function to be executed when the element is disconnected from the DOM."
667
+ },
668
+ {
669
+ "kind": "method",
670
+ "name": "listen",
671
+ "return": {
672
+ "type": {
673
+ "text": "() => void"
674
+ }
675
+ },
676
+ "parameters": [
677
+ {
678
+ "name": "target",
679
+ "type": {
680
+ "text": "EventTarget"
681
+ }
682
+ },
683
+ {
684
+ "name": "type",
685
+ "type": {
686
+ "text": "K"
687
+ }
688
+ },
689
+ {
690
+ "name": "listener",
691
+ "type": {
692
+ "text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
693
+ }
694
+ },
695
+ {
696
+ "name": "options",
697
+ "optional": true,
698
+ "type": {
699
+ "text": "boolean | AddEventListenerOptions"
700
+ }
701
+ }
702
+ ],
703
+ "description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected."
704
+ },
705
+ {
706
+ "kind": "method",
707
+ "name": "listen",
708
+ "return": {
709
+ "type": {
710
+ "text": "() => void"
711
+ }
712
+ },
713
+ "parameters": [
714
+ {
715
+ "name": "target",
716
+ "type": {
717
+ "text": "EventTarget"
718
+ }
719
+ },
720
+ {
721
+ "name": "type",
722
+ "type": {
723
+ "text": "string"
724
+ }
725
+ },
726
+ {
727
+ "name": "listener",
728
+ "type": {
729
+ "text": "EventListenerOrEventListenerObject"
730
+ }
731
+ },
732
+ {
733
+ "name": "options",
734
+ "optional": true,
735
+ "type": {
736
+ "text": "boolean | AddEventListenerOptions"
737
+ }
738
+ }
739
+ ]
740
+ }
741
+ ],
742
+ "attributes": [
743
+ {
744
+ "name": "locale",
745
+ "type": {
746
+ "text": "string"
747
+ },
748
+ "default": "''",
749
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
750
+ "fieldName": "locale"
751
+ }
752
+ ],
753
+ "superclass": {
754
+ "name": "LitElement",
755
+ "package": "lit"
756
+ },
757
+ "customElement": true
758
+ }
759
+ ],
760
+ "exports": [
761
+ {
762
+ "kind": "js",
763
+ "name": "UIBitElement",
764
+ "declaration": {
765
+ "name": "UIBitElement",
766
+ "module": "../../platform/core/src/element.ts"
767
+ }
768
+ }
769
+ ]
301
770
  }
302
771
  ]
303
772
  }
@@ -1,38 +1,48 @@
1
1
  import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output, booleanAttribute, numberAttribute } from '@angular/core';
2
2
  import '@uibit/text-rotator';
3
3
  import type { TextRotator as HTMLElementClass } from '@uibit/text-rotator';
4
-
5
4
  @Component({
6
- selector: 'uibit-text-rotator',
7
- template: '<ng-content></ng-content>',
8
- changeDetection: ChangeDetectionStrategy.OnPush,
9
- standalone: true,
10
- host: {
11
- '(word-change)': 'wordChange.emit($event)'
12
- }
5
+ selector: 'uibit-text-rotator',
6
+ template: '<ng-content></ng-content>',
7
+ changeDetection: ChangeDetectionStrategy.OnPush,
8
+ standalone: true,
9
+ host: {
10
+ '(word-change)': 'wordChange.emit($event)'
11
+ }
13
12
  })
14
13
  export class NgxTextRotator {
15
- constructor(private el: ElementRef<HTMLElementClass>) {
16
- effect(() => {
17
- if (this.el.nativeElement) {
18
- this.el.nativeElement.interval = this.interval();
19
- }
14
+ constructor(private el: ElementRef<HTMLElementClass>){
15
+ effect(()=>{
16
+ if (this.el.nativeElement) {
17
+ this.el.nativeElement.interval = this.interval();
18
+ }
19
+ });
20
+ effect(()=>{
21
+ if (this.el.nativeElement) {
22
+ this.el.nativeElement.transition = this.transition();
23
+ }
24
+ });
25
+ effect(()=>{
26
+ if (this.el.nativeElement) {
27
+ this.el.nativeElement.loop = this.loop();
28
+ }
29
+ });
30
+ effect(()=>{
31
+ if (this.el.nativeElement) {
32
+ this.el.nativeElement.locale = this.locale();
33
+ }
34
+ });
35
+ }
36
+ readonly interval = input<number, any>(2500, {
37
+ transform: numberAttribute
20
38
  });
21
- effect(() => {
22
- if (this.el.nativeElement) {
23
- this.el.nativeElement.transition = this.transition();
24
- }
39
+ readonly transition = input<'slide' | 'flip'>('slide');
40
+ readonly loop = input<boolean, any>(true, {
41
+ transform: booleanAttribute
25
42
  });
26
- effect(() => {
27
- if (this.el.nativeElement) {
28
- this.el.nativeElement.loop = this.loop();
29
- }
30
- });
31
- }
32
-
33
- readonly interval = input<number, any>(2500, { transform: numberAttribute });
34
- readonly transition = input<'slide' | 'flip', any>('slide');
35
- readonly loop = input<boolean, any>(true, { transform: booleanAttribute });
36
-
37
- readonly wordChange = output<CustomEvent<{ word: string, index: number }>>();
43
+ readonly locale = input<string>('');
44
+ readonly wordChange = output<CustomEvent<{
45
+ word: string;
46
+ index: number;
47
+ }>>();
38
48
  }
@@ -4,7 +4,13 @@ import '@uibit/text-rotator';
4
4
  declare global {
5
5
  namespace astroHTML.JSX {
6
6
  interface IntrinsicElements {
7
- 'uibit-text-rotator': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
7
+ 'uibit-text-rotator': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes & {
8
+ interval?: number;
9
+ transition?: 'slide' | 'flip';
10
+ loop?: boolean;
11
+ locale?: string;
12
+ "on:word-change"?: (event: CustomEvent<{ word: string, index: number }>) => void;
13
+ };
8
14
  }
9
15
  }
10
16
  }
@@ -9,6 +9,9 @@ declare module 'preact' {
9
9
  interval?: number;
10
10
  transition?: 'slide' | 'flip';
11
11
  loop?: boolean;
12
+ locale?: string;
13
+ onWordChange?: (event: CustomEvent<{ word: string, index: number }>) => void;
14
+ "on:word-change"?: (event: CustomEvent<{ word: string, index: number }>) => void;
12
15
  };
13
16
  }
14
17
  }
@@ -0,0 +1,105 @@
1
+ import React, { useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
2
+ import type { TextRotator as HTMLElementClass } from '@uibit/text-rotator';
3
+ import '@uibit/text-rotator';
4
+ const useTypeOfLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
5
+ export interface TextRotatorProps extends Omit<React.HTMLAttributes<HTMLElementClass>, 'interval' | 'transition' | 'loop' | 'locale' | 'onWordChange'> {
6
+ children?: React.ReactNode;
7
+ interval?: number;
8
+ transition?: 'slide' | 'flip';
9
+ loop?: boolean;
10
+ locale?: string;
11
+ onWordChange?: (event: CustomEvent<{
12
+ word: string;
13
+ index: number;
14
+ }>) => void;
15
+ }
16
+ export const TextRotator = ({ ref, children, ...props }: TextRotatorProps & {
17
+ ref?: React.Ref<HTMLElementClass>;
18
+ })=>{
19
+ const innerRef = useRef<HTMLElementClass>(null);
20
+ const propsRef = useRef(props);
21
+ propsRef.current = props;
22
+ useImperativeHandle(ref, ()=>innerRef.current!);
23
+ useTypeOfLayoutEffect(()=>{
24
+ const element = innerRef.current;
25
+ if (element && props.interval !== undefined) {
26
+ (element as any).interval = props.interval;
27
+ }
28
+ }, [
29
+ props.interval
30
+ ]);
31
+ useTypeOfLayoutEffect(()=>{
32
+ const element = innerRef.current;
33
+ if (element && props.transition !== undefined) {
34
+ (element as any).transition = props.transition;
35
+ }
36
+ }, [
37
+ props.transition
38
+ ]);
39
+ useTypeOfLayoutEffect(()=>{
40
+ const element = innerRef.current;
41
+ if (element && props.loop !== undefined) {
42
+ (element as any).loop = props.loop;
43
+ }
44
+ }, [
45
+ props.loop
46
+ ]);
47
+ useTypeOfLayoutEffect(()=>{
48
+ const element = innerRef.current;
49
+ if (element && props.locale !== undefined) {
50
+ (element as any).locale = props.locale;
51
+ }
52
+ }, [
53
+ props.locale
54
+ ]);
55
+ useTypeOfLayoutEffect(()=>{
56
+ const element = innerRef.current;
57
+ if (!element) return;
58
+ const handleEvent = (event: Event)=>{
59
+ if (propsRef.current.onWordChange) {
60
+ propsRef.current.onWordChange(event as any);
61
+ }
62
+ };
63
+ element.addEventListener('word-change', handleEvent);
64
+ return ()=>{
65
+ element.removeEventListener('word-change', handleEvent);
66
+ };
67
+ }, []);
68
+ const domProps = {
69
+ ...props
70
+ };
71
+ const customPropNames = [
72
+ 'interval',
73
+ 'transition',
74
+ 'loop',
75
+ 'locale',
76
+ 'onWordChange'
77
+ ];
78
+ for (const key of customPropNames){
79
+ delete (domProps as any)[key];
80
+ }
81
+ return React.createElement('uibit-text-rotator', {
82
+ ref: innerRef,
83
+ ...domProps
84
+ }, children);
85
+ };
86
+ declare global {
87
+ namespace React {
88
+ namespace JSX {
89
+ interface IntrinsicElements {
90
+ 'uibit-text-rotator': React.ClassAttributes<HTMLElementClass> & React.HTMLAttributes<HTMLElementClass> & {
91
+ children?: React.ReactNode;
92
+ class?: string;
93
+ interval?: number;
94
+ transition?: 'slide' | 'flip';
95
+ loop?: boolean;
96
+ locale?: string;
97
+ onWordChange?: (event: CustomEvent<{
98
+ word: string;
99
+ index: number;
100
+ }>) => void;
101
+ };
102
+ }
103
+ }
104
+ }
105
+ }
@@ -9,7 +9,8 @@ declare module 'solid-js' {
9
9
  interval?: number;
10
10
  transition?: 'slide' | 'flip';
11
11
  loop?: boolean;
12
- "on:word-change"?: (event: CustomEvent) => void;
12
+ locale?: string;
13
+ "on:word-change"?: (event: CustomEvent<{ word: string, index: number }>) => void;
13
14
  };
14
15
  }
15
16
  }
@@ -8,6 +8,9 @@ declare module '@stencil/core' {
8
8
  interval?: number;
9
9
  transition?: 'slide' | 'flip';
10
10
  loop?: boolean;
11
+ locale?: string;
12
+ onWordChange?: (event: CustomEvent<{ word: string, index: number }>) => void;
13
+ "on:word-change"?: (event: CustomEvent<{ word: string, index: number }>) => void;
11
14
  };
12
15
  }
13
16
  }
@@ -1,37 +1,74 @@
1
1
  <script lang="ts">
2
2
  import '@uibit/text-rotator';
3
3
  import type { TextRotator as HTMLElementClass } from '@uibit/text-rotator';
4
-
5
- let {
6
- interval = undefined,
7
- transition = undefined,
8
- loop = undefined,
9
- children
4
+
5
+ let {
6
+ interval = $bindable(),
7
+ transition = $bindable(),
8
+ loop = $bindable(),
9
+ locale = $bindable(),
10
+ children,
11
+ ...restProps
10
12
  } = $props<{
11
- children?: any;
13
+ children?: import('svelte').Snippet;
12
14
  interval?: number;
13
15
  transition?: 'slide' | 'flip';
14
16
  loop?: boolean;
15
-
17
+ locale?: string;
18
+
19
+ [key: string]: any;
16
20
  }>();
17
-
18
- let elementRef: HTMLElementClass | null = $state(null);
19
-
20
- $effect(() => {
21
- if (elementRef && interval !== undefined) {
21
+
22
+ let elementRef: HTMLElementClass | null = $state(null);
23
+
24
+ $effect(() => {
25
+ if (elementRef && interval !== undefined && elementRef.interval !== interval) {
22
26
  elementRef.interval = interval;
23
27
  }
24
- if (elementRef && transition !== undefined) {
28
+ if (elementRef && transition !== undefined && elementRef.transition !== transition) {
25
29
  elementRef.transition = transition;
26
30
  }
27
- if (elementRef && loop !== undefined) {
31
+ if (elementRef && loop !== undefined && elementRef.loop !== loop) {
28
32
  elementRef.loop = loop;
29
33
  }
34
+ if (elementRef && locale !== undefined && elementRef.locale !== locale) {
35
+ elementRef.locale = locale;
36
+ }
30
37
  });
31
-
38
+
39
+ $effect(() => {
40
+ const element = elementRef;
41
+ if (!element) return;
42
+
43
+ const handleEvent = () => {
44
+ if (interval !== element.interval) {
45
+ interval = element.interval as any;
46
+ }
47
+ if (transition !== element.transition) {
48
+ transition = element.transition as any;
49
+ }
50
+ if (loop !== element.loop) {
51
+ loop = element.loop as any;
52
+ }
53
+ if (locale !== element.locale) {
54
+ locale = element.locale as any;
55
+ }
56
+ };
57
+
58
+ const events = ['change', 'input', 'word-change'];
59
+ for (const event of events) {
60
+ element.addEventListener(event, handleEvent);
61
+ }
62
+ return () => {
63
+ for (const event of events) {
64
+ element.removeEventListener(event, handleEvent);
65
+ }
66
+ };
67
+ });
68
+
32
69
  </script>
33
70
 
34
- <uibit-text-rotator bind:this={elementRef} {...$$restProps}>
71
+ <uibit-text-rotator bind:this={elementRef} {...restProps}>
35
72
 
36
73
  {#if children}
37
74
  {@render children()}
@@ -1,26 +1,97 @@
1
- import { defineComponent, h } from 'vue';
1
+ import { defineComponent, h, ref, watch } from 'vue';
2
2
  import type { TextRotator as HTMLElementClass } from '@uibit/text-rotator';
3
3
  import '@uibit/text-rotator';
4
-
5
4
  export const TextRotator = defineComponent({
6
- name: 'TextRotator',
7
- props: {
8
- interval: { type: [String, Number, Boolean, Array, Object] as any },
9
- transition: { type: [String, Number, Boolean, Array, Object] as any },
10
- loop: { type: [String, Number, Boolean, Array, Object] as any }
11
- },
12
- emits: ['word-change'],
13
- setup(props, { slots, emit }) {
14
- return () => {
15
- const eventListeners: Record<string, any> = {};
16
- eventListeners['onWord-change'] = (event: Event) => {
17
- emit('word-change', event);
18
- };
19
-
20
- return h('uibit-text-rotator', {
21
- ...props,
22
- ...eventListeners
23
- }, slots.default?.());
24
- };
25
- }
5
+ name: 'TextRotator',
6
+ props: {
7
+ interval: {
8
+ type: [
9
+ String,
10
+ Number,
11
+ Boolean,
12
+ Array,
13
+ Object
14
+ ] as any
15
+ },
16
+ transition: {
17
+ type: [
18
+ String,
19
+ Number,
20
+ Boolean,
21
+ Array,
22
+ Object
23
+ ] as any
24
+ },
25
+ loop: {
26
+ type: [
27
+ String,
28
+ Number,
29
+ Boolean,
30
+ Array,
31
+ Object
32
+ ] as any
33
+ },
34
+ locale: {
35
+ type: [
36
+ String,
37
+ Number,
38
+ Boolean,
39
+ Array,
40
+ Object
41
+ ] as any
42
+ }
43
+ },
44
+ emits: [
45
+ 'word-change'
46
+ ],
47
+ setup (props, { slots, emit }) {
48
+ const elementRef = ref<HTMLElementClass | null>(null);
49
+ if (false) {
50
+ watch(()=>props.modelValue, (newVal)=>{
51
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
52
+ elementRef.value.value = newVal;
53
+ }
54
+ });
55
+ watch(()=>props.value, (newVal)=>{
56
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
57
+ elementRef.value.value = newVal;
58
+ }
59
+ });
60
+ }
61
+ watch(()=>props.interval, (newVal)=>{
62
+ if (elementRef.value && newVal !== undefined) {
63
+ (elementRef.value as any).interval = newVal;
64
+ }
65
+ });
66
+ watch(()=>props.transition, (newVal)=>{
67
+ if (elementRef.value && newVal !== undefined) {
68
+ (elementRef.value as any).transition = newVal;
69
+ }
70
+ });
71
+ watch(()=>props.loop, (newVal)=>{
72
+ if (elementRef.value && newVal !== undefined) {
73
+ (elementRef.value as any).loop = newVal;
74
+ }
75
+ });
76
+ watch(()=>props.locale, (newVal)=>{
77
+ if (elementRef.value && newVal !== undefined) {
78
+ (elementRef.value as any).locale = newVal;
79
+ }
80
+ });
81
+ return ()=>{
82
+ const eventListeners: Record<string, any> = {};
83
+ eventListeners['onWord-change'] = (event: Event)=>{
84
+ emit('word-change', event);
85
+ };
86
+ const mergedProps = {
87
+ ...props,
88
+ ...eventListeners,
89
+ ref: elementRef
90
+ };
91
+ if (false && props.modelValue !== undefined) {
92
+ (mergedProps as any).value = props.modelValue;
93
+ }
94
+ return h('uibit-text-rotator', mergedProps, slots.default?.());
95
+ };
96
+ }
26
97
  });
@@ -1,6 +1,8 @@
1
1
  import { UIBitElement } from '@uibit/core';
2
2
  /**
3
3
  * Cycles through an array of phrases inside a static sentence by animating between
4
+
5
+ * @summary A rotating text carousel component with smooth CSS animation transitions.
4
6
  * items with a vertical slide or 3D flip transition. Designed to highlight changing
5
7
  * value propositions without motion outside the component boundary.
6
8
  *
@@ -15,7 +17,8 @@ import { UIBitElement } from '@uibit/core';
15
17
  * @cssprop [--uibit-text-rotator-font-family=inherit] - Font family
16
18
  * @cssprop [--uibit-text-rotator-line-height=inherit] - Line height
17
19
  * @cssprop [--uibit-text-rotator-duration=0.4s] - Transition animation duration
18
- */
20
+
21
+ * @cssstate rotating - Active when the text transition is in progress.*/
19
22
  export declare class TextRotator extends UIBitElement {
20
23
  static styles: import("lit").CSSResult;
21
24
  private words;
@@ -1 +1 @@
1
- {"version":3,"file":"text-rotator.d.ts","sourceRoot":"","sources":["../src/text-rotator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,WAAY,SAAQ,YAAY;IAC3C,MAAM,CAAC,MAAM,0BAAU;IAEd,OAAO,CAAC,KAAK,CAAgB;IAEtC,wCAAwC;IACZ,QAAQ,SAAQ;IAE5C,oFAAoF;IACxD,UAAU,EAAE,OAAO,GAAG,MAAM,CAAW;IAEnE,mEAAmE;IACtC,IAAI,UAAQ;IAEhC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,MAAM,CAAC,CAAiC;IAEhD,iBAAiB,SAGhB;IAED,oBAAoB,SAGnB;IAED,YAAY,SAGX;IAED,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAUpC;IAED,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,QAAQ;IAqBhB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,iBAAiB;IAWzB,MAAM,oCAaL;CACF;eAEc,WAAW"}
1
+ {"version":3,"file":"text-rotator.d.ts","sourceRoot":"","sources":["../src/text-rotator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;yEAmByE;AACzE,qBACa,WAAY,SAAQ,YAAY;IAC3C,MAAM,CAAC,MAAM,0BAAU;IAEd,OAAO,CAAC,KAAK,CAAgB;IAEtC,wCAAwC;IACZ,QAAQ,SAAQ;IAE5C,oFAAoF;IACxD,UAAU,EAAE,OAAO,GAAG,MAAM,CAAW;IAEnE,mEAAmE;IACtC,IAAI,UAAQ;IAEhC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,MAAM,CAAC,CAAiC;IAEhD,iBAAiB,SAGhB;IAED,oBAAoB,SAGnB;IAED,YAAY,SAGX;IAED,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAUpC;IAED,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,QAAQ;IAqBhB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,iBAAiB;IAWzB,MAAM,oCAaL;CACF;eAEc,WAAW"}
@@ -11,6 +11,8 @@ import { property, state } from 'lit/decorators.js';
11
11
  import { styles } from './styles';
12
12
  /**
13
13
  * Cycles through an array of phrases inside a static sentence by animating between
14
+
15
+ * @summary A rotating text carousel component with smooth CSS animation transitions.
14
16
  * items with a vertical slide or 3D flip transition. Designed to highlight changing
15
17
  * value propositions without motion outside the component boundary.
16
18
  *
@@ -25,7 +27,8 @@ import { styles } from './styles';
25
27
  * @cssprop [--uibit-text-rotator-font-family=inherit] - Font family
26
28
  * @cssprop [--uibit-text-rotator-line-height=inherit] - Line height
27
29
  * @cssprop [--uibit-text-rotator-duration=0.4s] - Transition animation duration
28
- */
30
+
31
+ * @cssstate rotating - Active when the text transition is in progress.*/
29
32
  let TextRotator = class TextRotator extends UIBitElement {
30
33
  constructor() {
31
34
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"text-rotator.js","sourceRoot":"","sources":["../src/text-rotator.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AA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sentence block with smooth vertical slide or 3D flip transitions. Designed to pull attention to changing value propositions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "import": "./dist/index.js"
12
12
  },
13
13
  "./custom-elements.json": "./custom-elements.json",
14
- "./react": "./dist/frameworks/react/index.d.ts",
14
+ "./react": "./dist/frameworks/react/index.ts",
15
15
  "./vue": "./dist/frameworks/vue/index.ts",
16
16
  "./svelte": "./dist/frameworks/svelte/index.svelte",
17
17
  "./angular": "./dist/frameworks/angular/index.ts",
@@ -44,13 +44,13 @@
44
44
  "directory": "packages/components/text-rotator"
45
45
  },
46
46
  "dependencies": {
47
- "@uibit/core": "0.1.0"
47
+ "@uibit/core": "0.2.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^20.19.43",
51
51
  "lit": "^3.3.3",
52
52
  "typescript": "7.0.2",
53
- "@uibit/codegen": "0.1.0"
53
+ "@uibit/codegen": "0.2.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "lit": "^3.0.0",
@@ -81,9 +81,9 @@
81
81
  "tagName": "uibit-text-rotator"
82
82
  },
83
83
  "scripts": {
84
- "build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
85
- "dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
86
- "analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
84
+ "build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
85
+ "dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
86
+ "analyze": "cem analyze --config ../custom-elements-manifest.config.js",
87
87
  "typecheck": "tsc --noEmit"
88
88
  }
89
89
  }
@@ -1,20 +0,0 @@
1
- import type { HTMLAttributes, ClassAttributes } from 'react';
2
- import type { TextRotator as HTMLElementClass } from '@uibit/text-rotator';
3
- import '@uibit/text-rotator';
4
-
5
- declare global {
6
- namespace React {
7
- namespace JSX {
8
- interface IntrinsicElements {
9
- 'uibit-text-rotator': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
10
- children?: React.ReactNode;
11
- class?: string;
12
- interval?: number;
13
- transition?: 'slide' | 'flip';
14
- loop?: boolean;
15
- onWordChange?: (event: any) => void;
16
- };
17
- }
18
- }
19
- }
20
- }