@uibit/text-typing 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 Typing
2
2
 
3
+ [![NPM Version](https://img.shields.io/npm/v/@uibit/text-typing.svg?style=flat-square&color=black)](https://www.npmjs.com/package/@uibit/text-typing)
4
+
5
+
3
6
  [Interactive Demonstration](https://rawlings.github.io/uibit/components/text-typing)
4
7
 
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @uibit/text-typing
12
+ ```
13
+
14
+
5
15
  Text Typing is an animated display component that cycles through multiple phrases with a typing motion. By simulating speed variations, pauses, and corrections, it creates dynamic visual interest, making it ideal for landing page headlines and key value propositions.
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 by simulating realistic keystroke\ntyping and backspace deletion. Includes subtle speed variance, randomized\nsimulated typos that auto-correct, and a blinking cursor node.\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 by simulating realistic keystroke",
64
64
  "name": "TextTyping",
65
65
  "cssProperties": [
66
66
  {
@@ -281,6 +281,211 @@
281
281
  }
282
282
  }
283
283
  ]
284
+ },
285
+ {
286
+ "kind": "field",
287
+ "name": "locale",
288
+ "type": {
289
+ "text": "string"
290
+ },
291
+ "default": "''",
292
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
293
+ "attribute": "locale",
294
+ "inheritedFrom": {
295
+ "name": "UIBitElement",
296
+ "module": "../../platform/core/src/element.ts"
297
+ }
298
+ },
299
+ {
300
+ "kind": "field",
301
+ "name": "resolvedLocale",
302
+ "type": {
303
+ "text": "string | undefined"
304
+ },
305
+ "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).",
306
+ "readonly": true,
307
+ "inheritedFrom": {
308
+ "name": "UIBitElement",
309
+ "module": "../../platform/core/src/element.ts"
310
+ }
311
+ },
312
+ {
313
+ "kind": "field",
314
+ "name": "_disposables",
315
+ "type": {
316
+ "text": "Set<() => void>"
317
+ },
318
+ "privacy": "private",
319
+ "default": "new Set()",
320
+ "inheritedFrom": {
321
+ "name": "UIBitElement",
322
+ "module": "../../platform/core/src/element.ts"
323
+ }
324
+ },
325
+ {
326
+ "kind": "method",
327
+ "name": "createProperty",
328
+ "static": true,
329
+ "parameters": [
330
+ {
331
+ "name": "name",
332
+ "type": {
333
+ "text": "PropertyKey"
334
+ }
335
+ },
336
+ {
337
+ "name": "options",
338
+ "optional": true,
339
+ "type": {
340
+ "text": "PropertyDeclaration"
341
+ }
342
+ }
343
+ ],
344
+ "description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default.",
345
+ "inheritedFrom": {
346
+ "name": "UIBitElement",
347
+ "module": "../../platform/core/src/element.ts"
348
+ }
349
+ },
350
+ {
351
+ "kind": "method",
352
+ "name": "finalizeStyles",
353
+ "static": true,
354
+ "return": {
355
+ "type": {
356
+ "text": "Array<any>"
357
+ }
358
+ },
359
+ "parameters": [
360
+ {
361
+ "name": "styles",
362
+ "optional": true,
363
+ "type": {
364
+ "text": "CSSResultGroup"
365
+ }
366
+ }
367
+ ],
368
+ "description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles.",
369
+ "inheritedFrom": {
370
+ "name": "UIBitElement",
371
+ "module": "../../platform/core/src/element.ts"
372
+ }
373
+ },
374
+ {
375
+ "kind": "method",
376
+ "name": "dispatchCustomEvent",
377
+ "return": {
378
+ "type": {
379
+ "text": "boolean"
380
+ }
381
+ },
382
+ "parameters": [
383
+ {
384
+ "name": "name",
385
+ "type": {
386
+ "text": "string"
387
+ }
388
+ },
389
+ {
390
+ "name": "detail",
391
+ "optional": true,
392
+ "type": {
393
+ "text": "T"
394
+ }
395
+ },
396
+ {
397
+ "name": "options",
398
+ "optional": true,
399
+ "type": {
400
+ "text": "Omit<CustomEventInit<T>, 'detail'>"
401
+ }
402
+ }
403
+ ],
404
+ "description": "Helper to dispatch a custom event with standard bubbles and composed options.",
405
+ "inheritedFrom": {
406
+ "name": "UIBitElement",
407
+ "module": "../../platform/core/src/element.ts"
408
+ }
409
+ },
410
+ {
411
+ "kind": "method",
412
+ "name": "getCssPropertyValue",
413
+ "return": {
414
+ "type": {
415
+ "text": "string"
416
+ }
417
+ },
418
+ "parameters": [
419
+ {
420
+ "name": "propertyName",
421
+ "type": {
422
+ "text": "string"
423
+ }
424
+ }
425
+ ],
426
+ "description": "Helper to retrieve a computed CSS custom property value from the element.",
427
+ "inheritedFrom": {
428
+ "name": "UIBitElement",
429
+ "module": "../../platform/core/src/element.ts"
430
+ }
431
+ },
432
+ {
433
+ "kind": "method",
434
+ "name": "registerDisposable",
435
+ "parameters": [
436
+ {
437
+ "name": "cleanup",
438
+ "type": {
439
+ "text": "() => void"
440
+ }
441
+ }
442
+ ],
443
+ "description": "Register a cleanup function to be executed when the element is disconnected from the DOM.",
444
+ "inheritedFrom": {
445
+ "name": "UIBitElement",
446
+ "module": "../../platform/core/src/element.ts"
447
+ }
448
+ },
449
+ {
450
+ "kind": "method",
451
+ "name": "listen",
452
+ "return": {
453
+ "type": {
454
+ "text": "() => void"
455
+ }
456
+ },
457
+ "parameters": [
458
+ {
459
+ "name": "target",
460
+ "type": {
461
+ "text": "EventTarget"
462
+ }
463
+ },
464
+ {
465
+ "name": "type",
466
+ "type": {
467
+ "text": "K"
468
+ }
469
+ },
470
+ {
471
+ "name": "listener",
472
+ "type": {
473
+ "text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
474
+ }
475
+ },
476
+ {
477
+ "name": "options",
478
+ "optional": true,
479
+ "type": {
480
+ "text": "boolean | AddEventListenerOptions"
481
+ }
482
+ }
483
+ ],
484
+ "description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected.",
485
+ "inheritedFrom": {
486
+ "name": "UIBitElement",
487
+ "module": "../../platform/core/src/element.ts"
488
+ }
284
489
  }
285
490
  ],
286
491
  "events": [
@@ -355,12 +560,36 @@
355
560
  "default": "true",
356
561
  "description": "Loop indefinitely. Set to false to stop after the last phrase.",
357
562
  "fieldName": "loop"
563
+ },
564
+ {
565
+ "name": "locale",
566
+ "type": {
567
+ "text": "string"
568
+ },
569
+ "default": "''",
570
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
571
+ "fieldName": "locale",
572
+ "inheritedFrom": {
573
+ "name": "UIBitElement",
574
+ "module": "../../platform/core/src/element.ts"
575
+ }
576
+ }
577
+ ],
578
+ "cssStates": [
579
+ {
580
+ "name": "typing",
581
+ "description": "Active when text is actively typing out."
582
+ },
583
+ {
584
+ "name": "deleting",
585
+ "description": "Active when text is actively backspacing."
358
586
  }
359
587
  ],
360
588
  "superclass": {
361
589
  "name": "UIBitElement",
362
590
  "package": "@uibit/core"
363
591
  },
592
+ "summary": "A typewriter effect animation component with looping backspacing features.\ntyping and backspace deletion. Includes subtle speed variance, randomized\nsimulated typos that auto-correct, and a blinking cursor node.\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>`).",
364
593
  "tagName": "uibit-text-typing",
365
594
  "customElement": true
366
595
  }
@@ -397,6 +626,250 @@
397
626
  "path": "src/types.ts",
398
627
  "declarations": [],
399
628
  "exports": []
629
+ },
630
+ {
631
+ "kind": "javascript-module",
632
+ "path": "../../platform/core/src/element.ts",
633
+ "declarations": [
634
+ {
635
+ "kind": "class",
636
+ "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.",
637
+ "name": "UIBitElement",
638
+ "members": [
639
+ {
640
+ "kind": "field",
641
+ "name": "locale",
642
+ "type": {
643
+ "text": "string"
644
+ },
645
+ "default": "''",
646
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
647
+ "attribute": "locale"
648
+ },
649
+ {
650
+ "kind": "field",
651
+ "name": "resolvedLocale",
652
+ "type": {
653
+ "text": "string | undefined"
654
+ },
655
+ "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).",
656
+ "readonly": true
657
+ },
658
+ {
659
+ "kind": "field",
660
+ "name": "_disposables",
661
+ "type": {
662
+ "text": "Set<() => void>"
663
+ },
664
+ "privacy": "private",
665
+ "default": "new Set()"
666
+ },
667
+ {
668
+ "kind": "method",
669
+ "name": "createProperty",
670
+ "static": true,
671
+ "parameters": [
672
+ {
673
+ "name": "name",
674
+ "type": {
675
+ "text": "PropertyKey"
676
+ }
677
+ },
678
+ {
679
+ "name": "options",
680
+ "optional": true,
681
+ "type": {
682
+ "text": "PropertyDeclaration"
683
+ }
684
+ }
685
+ ],
686
+ "description": "Overrides createProperty to automatically map camelCase property names\nto kebab-case attribute names by default."
687
+ },
688
+ {
689
+ "kind": "method",
690
+ "name": "finalizeStyles",
691
+ "static": true,
692
+ "return": {
693
+ "type": {
694
+ "text": "Array<any>"
695
+ }
696
+ },
697
+ "parameters": [
698
+ {
699
+ "name": "styles",
700
+ "optional": true,
701
+ "type": {
702
+ "text": "CSSResultGroup"
703
+ }
704
+ }
705
+ ],
706
+ "description": "Automatically prepends basic layout resets (border-box) to the\ncomponent's final styles."
707
+ },
708
+ {
709
+ "kind": "method",
710
+ "name": "dispatchCustomEvent",
711
+ "return": {
712
+ "type": {
713
+ "text": "boolean"
714
+ }
715
+ },
716
+ "parameters": [
717
+ {
718
+ "name": "name",
719
+ "type": {
720
+ "text": "string"
721
+ }
722
+ },
723
+ {
724
+ "name": "detail",
725
+ "optional": true,
726
+ "type": {
727
+ "text": "T"
728
+ }
729
+ },
730
+ {
731
+ "name": "options",
732
+ "optional": true,
733
+ "type": {
734
+ "text": "Omit<CustomEventInit<T>, 'detail'>"
735
+ }
736
+ }
737
+ ],
738
+ "description": "Helper to dispatch a custom event with standard bubbles and composed options."
739
+ },
740
+ {
741
+ "kind": "method",
742
+ "name": "getCssPropertyValue",
743
+ "return": {
744
+ "type": {
745
+ "text": "string"
746
+ }
747
+ },
748
+ "parameters": [
749
+ {
750
+ "name": "propertyName",
751
+ "type": {
752
+ "text": "string"
753
+ }
754
+ }
755
+ ],
756
+ "description": "Helper to retrieve a computed CSS custom property value from the element."
757
+ },
758
+ {
759
+ "kind": "method",
760
+ "name": "registerDisposable",
761
+ "parameters": [
762
+ {
763
+ "name": "cleanup",
764
+ "type": {
765
+ "text": "() => void"
766
+ }
767
+ }
768
+ ],
769
+ "description": "Register a cleanup function to be executed when the element is disconnected from the DOM."
770
+ },
771
+ {
772
+ "kind": "method",
773
+ "name": "listen",
774
+ "return": {
775
+ "type": {
776
+ "text": "() => void"
777
+ }
778
+ },
779
+ "parameters": [
780
+ {
781
+ "name": "target",
782
+ "type": {
783
+ "text": "EventTarget"
784
+ }
785
+ },
786
+ {
787
+ "name": "type",
788
+ "type": {
789
+ "text": "K"
790
+ }
791
+ },
792
+ {
793
+ "name": "listener",
794
+ "type": {
795
+ "text": "(this: EventTarget, ev: HTMLElementEventMap[K]) => any"
796
+ }
797
+ },
798
+ {
799
+ "name": "options",
800
+ "optional": true,
801
+ "type": {
802
+ "text": "boolean | AddEventListenerOptions"
803
+ }
804
+ }
805
+ ],
806
+ "description": "Utility to add an event listener that is automatically cleaned up when the element is disconnected."
807
+ },
808
+ {
809
+ "kind": "method",
810
+ "name": "listen",
811
+ "return": {
812
+ "type": {
813
+ "text": "() => void"
814
+ }
815
+ },
816
+ "parameters": [
817
+ {
818
+ "name": "target",
819
+ "type": {
820
+ "text": "EventTarget"
821
+ }
822
+ },
823
+ {
824
+ "name": "type",
825
+ "type": {
826
+ "text": "string"
827
+ }
828
+ },
829
+ {
830
+ "name": "listener",
831
+ "type": {
832
+ "text": "EventListenerOrEventListenerObject"
833
+ }
834
+ },
835
+ {
836
+ "name": "options",
837
+ "optional": true,
838
+ "type": {
839
+ "text": "boolean | AddEventListenerOptions"
840
+ }
841
+ }
842
+ ]
843
+ }
844
+ ],
845
+ "attributes": [
846
+ {
847
+ "name": "locale",
848
+ "type": {
849
+ "text": "string"
850
+ },
851
+ "default": "''",
852
+ "description": "BCP 47 locale string for formatting and localization. Defaults to inherited document language.",
853
+ "fieldName": "locale"
854
+ }
855
+ ],
856
+ "superclass": {
857
+ "name": "LitElement",
858
+ "package": "lit"
859
+ },
860
+ "customElement": true
861
+ }
862
+ ],
863
+ "exports": [
864
+ {
865
+ "kind": "js",
866
+ "name": "UIBitElement",
867
+ "declaration": {
868
+ "name": "UIBitElement",
869
+ "module": "../../platform/core/src/element.ts"
870
+ }
871
+ }
872
+ ]
400
873
  }
401
874
  ]
402
875
  }
@@ -1,62 +1,82 @@
1
1
  import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output, booleanAttribute, numberAttribute } from '@angular/core';
2
2
  import '@uibit/text-typing';
3
3
  import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
4
-
5
4
  @Component({
6
- selector: 'uibit-text-typing',
7
- template: '<ng-content></ng-content>',
8
- changeDetection: ChangeDetectionStrategy.OnPush,
9
- standalone: true,
10
- host: {
11
- '(phrase-change)': 'phraseChange.emit($event)'
12
- }
5
+ selector: 'uibit-text-typing',
6
+ template: '<ng-content></ng-content>',
7
+ changeDetection: ChangeDetectionStrategy.OnPush,
8
+ standalone: true,
9
+ host: {
10
+ '(phrase-change)': 'phraseChange.emit($event)'
11
+ }
13
12
  })
14
13
  export class NgxTextTyping {
15
- constructor(private el: ElementRef<HTMLElementClass>) {
16
- effect(() => {
17
- if (this.el.nativeElement) {
18
- this.el.nativeElement.typeSpeed = this.typeSpeed();
19
- }
14
+ constructor(private el: ElementRef<HTMLElementClass>){
15
+ effect(()=>{
16
+ if (this.el.nativeElement) {
17
+ this.el.nativeElement.typeSpeed = this.typeSpeed();
18
+ }
19
+ });
20
+ effect(()=>{
21
+ if (this.el.nativeElement) {
22
+ this.el.nativeElement.deleteSpeed = this.deleteSpeed();
23
+ }
24
+ });
25
+ effect(()=>{
26
+ if (this.el.nativeElement) {
27
+ this.el.nativeElement.pauseAfter = this.pauseAfter();
28
+ }
29
+ });
30
+ effect(()=>{
31
+ if (this.el.nativeElement) {
32
+ this.el.nativeElement.pauseBefore = this.pauseBefore();
33
+ }
34
+ });
35
+ effect(()=>{
36
+ if (this.el.nativeElement) {
37
+ this.el.nativeElement.typoRate = this.typoRate();
38
+ }
39
+ });
40
+ effect(()=>{
41
+ if (this.el.nativeElement) {
42
+ this.el.nativeElement.showCursor = this.showCursor();
43
+ }
44
+ });
45
+ effect(()=>{
46
+ if (this.el.nativeElement) {
47
+ this.el.nativeElement.loop = this.loop();
48
+ }
49
+ });
50
+ effect(()=>{
51
+ if (this.el.nativeElement) {
52
+ this.el.nativeElement.locale = this.locale();
53
+ }
54
+ });
55
+ }
56
+ readonly typeSpeed = input<number, any>(80, {
57
+ transform: numberAttribute
20
58
  });
21
- effect(() => {
22
- if (this.el.nativeElement) {
23
- this.el.nativeElement.deleteSpeed = this.deleteSpeed();
24
- }
59
+ readonly deleteSpeed = input<number, any>(40, {
60
+ transform: numberAttribute
25
61
  });
26
- effect(() => {
27
- if (this.el.nativeElement) {
28
- this.el.nativeElement.pauseAfter = this.pauseAfter();
29
- }
62
+ readonly pauseAfter = input<number, any>(1800, {
63
+ transform: numberAttribute
30
64
  });
31
- effect(() => {
32
- if (this.el.nativeElement) {
33
- this.el.nativeElement.pauseBefore = this.pauseBefore();
34
- }
65
+ readonly pauseBefore = input<number, any>(400, {
66
+ transform: numberAttribute
35
67
  });
36
- effect(() => {
37
- if (this.el.nativeElement) {
38
- this.el.nativeElement.typoRate = this.typoRate();
39
- }
68
+ readonly typoRate = input<number, any>(0.04, {
69
+ transform: numberAttribute
40
70
  });
41
- effect(() => {
42
- if (this.el.nativeElement) {
43
- this.el.nativeElement.showCursor = this.showCursor();
44
- }
71
+ readonly showCursor = input<boolean, any>(true, {
72
+ transform: booleanAttribute
45
73
  });
46
- effect(() => {
47
- if (this.el.nativeElement) {
48
- this.el.nativeElement.loop = this.loop();
49
- }
74
+ readonly loop = input<boolean, any>(true, {
75
+ transform: booleanAttribute
50
76
  });
51
- }
52
-
53
- readonly typeSpeed = input<number, any>(80, { transform: numberAttribute });
54
- readonly deleteSpeed = input<number, any>(40, { transform: numberAttribute });
55
- readonly pauseAfter = input<number, any>(1800, { transform: numberAttribute });
56
- readonly pauseBefore = input<number, any>(400, { transform: numberAttribute });
57
- readonly typoRate = input<number, any>(0.04, { transform: numberAttribute });
58
- readonly showCursor = input<boolean, any>(true, { transform: booleanAttribute });
59
- readonly loop = input<boolean, any>(true, { transform: booleanAttribute });
60
-
61
- readonly phraseChange = output<CustomEvent<{ phrase: string, index: number }>>();
77
+ readonly locale = input<string>('');
78
+ readonly phraseChange = output<CustomEvent<{
79
+ phrase: string;
80
+ index: number;
81
+ }>>();
62
82
  }
@@ -4,7 +4,17 @@ import '@uibit/text-typing';
4
4
  declare global {
5
5
  namespace astroHTML.JSX {
6
6
  interface IntrinsicElements {
7
- 'uibit-text-typing': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
7
+ 'uibit-text-typing': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes & {
8
+ typeSpeed?: number;
9
+ deleteSpeed?: number;
10
+ pauseAfter?: number;
11
+ pauseBefore?: number;
12
+ typoRate?: number;
13
+ showCursor?: boolean;
14
+ loop?: boolean;
15
+ locale?: string;
16
+ "on:phrase-change"?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
17
+ };
8
18
  }
9
19
  }
10
20
  }
@@ -13,6 +13,9 @@ declare module 'preact' {
13
13
  typoRate?: number;
14
14
  showCursor?: boolean;
15
15
  loop?: boolean;
16
+ locale?: string;
17
+ onPhraseChange?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
18
+ "on:phrase-change"?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
16
19
  };
17
20
  }
18
21
  }
@@ -0,0 +1,149 @@
1
+ import React, { useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
2
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
+ import '@uibit/text-typing';
4
+ const useTypeOfLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
5
+ export interface TextTypingProps extends Omit<React.HTMLAttributes<HTMLElementClass>, 'typeSpeed' | 'deleteSpeed' | 'pauseAfter' | 'pauseBefore' | 'typoRate' | 'showCursor' | 'loop' | 'locale' | 'onPhraseChange'> {
6
+ children?: React.ReactNode;
7
+ typeSpeed?: number;
8
+ deleteSpeed?: number;
9
+ pauseAfter?: number;
10
+ pauseBefore?: number;
11
+ typoRate?: number;
12
+ showCursor?: boolean;
13
+ loop?: boolean;
14
+ locale?: string;
15
+ onPhraseChange?: (event: CustomEvent<{
16
+ phrase: string;
17
+ index: number;
18
+ }>) => void;
19
+ }
20
+ export const TextTyping = ({ ref, children, ...props }: TextTypingProps & {
21
+ ref?: React.Ref<HTMLElementClass>;
22
+ })=>{
23
+ const innerRef = useRef<HTMLElementClass>(null);
24
+ const propsRef = useRef(props);
25
+ propsRef.current = props;
26
+ useImperativeHandle(ref, ()=>innerRef.current!);
27
+ useTypeOfLayoutEffect(()=>{
28
+ const element = innerRef.current;
29
+ if (element && props.typeSpeed !== undefined) {
30
+ (element as any).typeSpeed = props.typeSpeed;
31
+ }
32
+ }, [
33
+ props.typeSpeed
34
+ ]);
35
+ useTypeOfLayoutEffect(()=>{
36
+ const element = innerRef.current;
37
+ if (element && props.deleteSpeed !== undefined) {
38
+ (element as any).deleteSpeed = props.deleteSpeed;
39
+ }
40
+ }, [
41
+ props.deleteSpeed
42
+ ]);
43
+ useTypeOfLayoutEffect(()=>{
44
+ const element = innerRef.current;
45
+ if (element && props.pauseAfter !== undefined) {
46
+ (element as any).pauseAfter = props.pauseAfter;
47
+ }
48
+ }, [
49
+ props.pauseAfter
50
+ ]);
51
+ useTypeOfLayoutEffect(()=>{
52
+ const element = innerRef.current;
53
+ if (element && props.pauseBefore !== undefined) {
54
+ (element as any).pauseBefore = props.pauseBefore;
55
+ }
56
+ }, [
57
+ props.pauseBefore
58
+ ]);
59
+ useTypeOfLayoutEffect(()=>{
60
+ const element = innerRef.current;
61
+ if (element && props.typoRate !== undefined) {
62
+ (element as any).typoRate = props.typoRate;
63
+ }
64
+ }, [
65
+ props.typoRate
66
+ ]);
67
+ useTypeOfLayoutEffect(()=>{
68
+ const element = innerRef.current;
69
+ if (element && props.showCursor !== undefined) {
70
+ (element as any).showCursor = props.showCursor;
71
+ }
72
+ }, [
73
+ props.showCursor
74
+ ]);
75
+ useTypeOfLayoutEffect(()=>{
76
+ const element = innerRef.current;
77
+ if (element && props.loop !== undefined) {
78
+ (element as any).loop = props.loop;
79
+ }
80
+ }, [
81
+ props.loop
82
+ ]);
83
+ useTypeOfLayoutEffect(()=>{
84
+ const element = innerRef.current;
85
+ if (element && props.locale !== undefined) {
86
+ (element as any).locale = props.locale;
87
+ }
88
+ }, [
89
+ props.locale
90
+ ]);
91
+ useTypeOfLayoutEffect(()=>{
92
+ const element = innerRef.current;
93
+ if (!element) return;
94
+ const handleEvent = (event: Event)=>{
95
+ if (propsRef.current.onPhraseChange) {
96
+ propsRef.current.onPhraseChange(event as any);
97
+ }
98
+ };
99
+ element.addEventListener('phrase-change', handleEvent);
100
+ return ()=>{
101
+ element.removeEventListener('phrase-change', handleEvent);
102
+ };
103
+ }, []);
104
+ const domProps = {
105
+ ...props
106
+ };
107
+ const customPropNames = [
108
+ 'typeSpeed',
109
+ 'deleteSpeed',
110
+ 'pauseAfter',
111
+ 'pauseBefore',
112
+ 'typoRate',
113
+ 'showCursor',
114
+ 'loop',
115
+ 'locale',
116
+ 'onPhraseChange'
117
+ ];
118
+ for (const key of customPropNames){
119
+ delete (domProps as any)[key];
120
+ }
121
+ return React.createElement('uibit-text-typing', {
122
+ ref: innerRef,
123
+ ...domProps
124
+ }, children);
125
+ };
126
+ declare global {
127
+ namespace React {
128
+ namespace JSX {
129
+ interface IntrinsicElements {
130
+ 'uibit-text-typing': React.ClassAttributes<HTMLElementClass> & React.HTMLAttributes<HTMLElementClass> & {
131
+ children?: React.ReactNode;
132
+ class?: string;
133
+ typeSpeed?: number;
134
+ deleteSpeed?: number;
135
+ pauseAfter?: number;
136
+ pauseBefore?: number;
137
+ typoRate?: number;
138
+ showCursor?: boolean;
139
+ loop?: boolean;
140
+ locale?: string;
141
+ onPhraseChange?: (event: CustomEvent<{
142
+ phrase: string;
143
+ index: number;
144
+ }>) => void;
145
+ };
146
+ }
147
+ }
148
+ }
149
+ }
@@ -13,7 +13,8 @@ declare module 'solid-js' {
13
13
  typoRate?: number;
14
14
  showCursor?: boolean;
15
15
  loop?: boolean;
16
- "on:phrase-change"?: (event: CustomEvent) => void;
16
+ locale?: string;
17
+ "on:phrase-change"?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
17
18
  };
18
19
  }
19
20
  }
@@ -12,6 +12,9 @@ declare module '@stencil/core' {
12
12
  typoRate?: number;
13
13
  showCursor?: boolean;
14
14
  loop?: boolean;
15
+ locale?: string;
16
+ onPhraseChange?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
17
+ "on:phrase-change"?: (event: CustomEvent<{ phrase: string, index: number }>) => void;
15
18
  };
16
19
  }
17
20
  }
@@ -1,18 +1,20 @@
1
1
  <script lang="ts">
2
2
  import '@uibit/text-typing';
3
3
  import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
4
-
5
- let {
6
- typeSpeed = undefined,
7
- deleteSpeed = undefined,
8
- pauseAfter = undefined,
9
- pauseBefore = undefined,
10
- typoRate = undefined,
11
- showCursor = undefined,
12
- loop = undefined,
13
- children
4
+
5
+ let {
6
+ typeSpeed = $bindable(),
7
+ deleteSpeed = $bindable(),
8
+ pauseAfter = $bindable(),
9
+ pauseBefore = $bindable(),
10
+ typoRate = $bindable(),
11
+ showCursor = $bindable(),
12
+ loop = $bindable(),
13
+ locale = $bindable(),
14
+ children,
15
+ ...restProps
14
16
  } = $props<{
15
- children?: any;
17
+ children?: import('svelte').Snippet;
16
18
  typeSpeed?: number;
17
19
  deleteSpeed?: number;
18
20
  pauseAfter?: number;
@@ -20,38 +22,85 @@
20
22
  typoRate?: number;
21
23
  showCursor?: boolean;
22
24
  loop?: boolean;
23
-
25
+ locale?: string;
26
+
27
+ [key: string]: any;
24
28
  }>();
25
-
26
- let elementRef: HTMLElementClass | null = $state(null);
27
-
28
- $effect(() => {
29
- if (elementRef && typeSpeed !== undefined) {
29
+
30
+ let elementRef: HTMLElementClass | null = $state(null);
31
+
32
+ $effect(() => {
33
+ if (elementRef && typeSpeed !== undefined && elementRef.typeSpeed !== typeSpeed) {
30
34
  elementRef.typeSpeed = typeSpeed;
31
35
  }
32
- if (elementRef && deleteSpeed !== undefined) {
36
+ if (elementRef && deleteSpeed !== undefined && elementRef.deleteSpeed !== deleteSpeed) {
33
37
  elementRef.deleteSpeed = deleteSpeed;
34
38
  }
35
- if (elementRef && pauseAfter !== undefined) {
39
+ if (elementRef && pauseAfter !== undefined && elementRef.pauseAfter !== pauseAfter) {
36
40
  elementRef.pauseAfter = pauseAfter;
37
41
  }
38
- if (elementRef && pauseBefore !== undefined) {
42
+ if (elementRef && pauseBefore !== undefined && elementRef.pauseBefore !== pauseBefore) {
39
43
  elementRef.pauseBefore = pauseBefore;
40
44
  }
41
- if (elementRef && typoRate !== undefined) {
45
+ if (elementRef && typoRate !== undefined && elementRef.typoRate !== typoRate) {
42
46
  elementRef.typoRate = typoRate;
43
47
  }
44
- if (elementRef && showCursor !== undefined) {
48
+ if (elementRef && showCursor !== undefined && elementRef.showCursor !== showCursor) {
45
49
  elementRef.showCursor = showCursor;
46
50
  }
47
- if (elementRef && loop !== undefined) {
51
+ if (elementRef && loop !== undefined && elementRef.loop !== loop) {
48
52
  elementRef.loop = loop;
49
53
  }
54
+ if (elementRef && locale !== undefined && elementRef.locale !== locale) {
55
+ elementRef.locale = locale;
56
+ }
50
57
  });
51
-
58
+
59
+ $effect(() => {
60
+ const element = elementRef;
61
+ if (!element) return;
62
+
63
+ const handleEvent = () => {
64
+ if (typeSpeed !== element.typeSpeed) {
65
+ typeSpeed = element.typeSpeed as any;
66
+ }
67
+ if (deleteSpeed !== element.deleteSpeed) {
68
+ deleteSpeed = element.deleteSpeed as any;
69
+ }
70
+ if (pauseAfter !== element.pauseAfter) {
71
+ pauseAfter = element.pauseAfter as any;
72
+ }
73
+ if (pauseBefore !== element.pauseBefore) {
74
+ pauseBefore = element.pauseBefore as any;
75
+ }
76
+ if (typoRate !== element.typoRate) {
77
+ typoRate = element.typoRate as any;
78
+ }
79
+ if (showCursor !== element.showCursor) {
80
+ showCursor = element.showCursor as any;
81
+ }
82
+ if (loop !== element.loop) {
83
+ loop = element.loop as any;
84
+ }
85
+ if (locale !== element.locale) {
86
+ locale = element.locale as any;
87
+ }
88
+ };
89
+
90
+ const events = ['change', 'input', 'phrase-change'];
91
+ for (const event of events) {
92
+ element.addEventListener(event, handleEvent);
93
+ }
94
+ return () => {
95
+ for (const event of events) {
96
+ element.removeEventListener(event, handleEvent);
97
+ }
98
+ };
99
+ });
100
+
52
101
  </script>
53
102
 
54
- <uibit-text-typing bind:this={elementRef} {...$$restProps}>
103
+ <uibit-text-typing bind:this={elementRef} {...restProps}>
55
104
 
56
105
  {#if children}
57
106
  {@render children()}
@@ -1,30 +1,153 @@
1
- import { defineComponent, h } from 'vue';
1
+ import { defineComponent, h, ref, watch } from 'vue';
2
2
  import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
3
  import '@uibit/text-typing';
4
-
5
4
  export const TextTyping = defineComponent({
6
- name: 'TextTyping',
7
- props: {
8
- typeSpeed: { type: [String, Number, Boolean, Array, Object] as any },
9
- deleteSpeed: { type: [String, Number, Boolean, Array, Object] as any },
10
- pauseAfter: { type: [String, Number, Boolean, Array, Object] as any },
11
- pauseBefore: { type: [String, Number, Boolean, Array, Object] as any },
12
- typoRate: { type: [String, Number, Boolean, Array, Object] as any },
13
- showCursor: { type: [String, Number, Boolean, Array, Object] as any },
14
- loop: { type: [String, Number, Boolean, Array, Object] as any }
15
- },
16
- emits: ['phrase-change'],
17
- setup(props, { slots, emit }) {
18
- return () => {
19
- const eventListeners: Record<string, any> = {};
20
- eventListeners['onPhrase-change'] = (event: Event) => {
21
- emit('phrase-change', event);
22
- };
23
-
24
- return h('uibit-text-typing', {
25
- ...props,
26
- ...eventListeners
27
- }, slots.default?.());
28
- };
29
- }
5
+ name: 'TextTyping',
6
+ props: {
7
+ typeSpeed: {
8
+ type: [
9
+ String,
10
+ Number,
11
+ Boolean,
12
+ Array,
13
+ Object
14
+ ] as any
15
+ },
16
+ deleteSpeed: {
17
+ type: [
18
+ String,
19
+ Number,
20
+ Boolean,
21
+ Array,
22
+ Object
23
+ ] as any
24
+ },
25
+ pauseAfter: {
26
+ type: [
27
+ String,
28
+ Number,
29
+ Boolean,
30
+ Array,
31
+ Object
32
+ ] as any
33
+ },
34
+ pauseBefore: {
35
+ type: [
36
+ String,
37
+ Number,
38
+ Boolean,
39
+ Array,
40
+ Object
41
+ ] as any
42
+ },
43
+ typoRate: {
44
+ type: [
45
+ String,
46
+ Number,
47
+ Boolean,
48
+ Array,
49
+ Object
50
+ ] as any
51
+ },
52
+ showCursor: {
53
+ type: [
54
+ String,
55
+ Number,
56
+ Boolean,
57
+ Array,
58
+ Object
59
+ ] as any
60
+ },
61
+ loop: {
62
+ type: [
63
+ String,
64
+ Number,
65
+ Boolean,
66
+ Array,
67
+ Object
68
+ ] as any
69
+ },
70
+ locale: {
71
+ type: [
72
+ String,
73
+ Number,
74
+ Boolean,
75
+ Array,
76
+ Object
77
+ ] as any
78
+ }
79
+ },
80
+ emits: [
81
+ 'phrase-change'
82
+ ],
83
+ setup (props, { slots, emit }) {
84
+ const elementRef = ref<HTMLElementClass | null>(null);
85
+ if (false) {
86
+ watch(()=>props.modelValue, (newVal)=>{
87
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
88
+ elementRef.value.value = newVal;
89
+ }
90
+ });
91
+ watch(()=>props.value, (newVal)=>{
92
+ if (elementRef.value && newVal !== undefined && elementRef.value.value !== newVal) {
93
+ elementRef.value.value = newVal;
94
+ }
95
+ });
96
+ }
97
+ watch(()=>props.typeSpeed, (newVal)=>{
98
+ if (elementRef.value && newVal !== undefined) {
99
+ (elementRef.value as any).typeSpeed = newVal;
100
+ }
101
+ });
102
+ watch(()=>props.deleteSpeed, (newVal)=>{
103
+ if (elementRef.value && newVal !== undefined) {
104
+ (elementRef.value as any).deleteSpeed = newVal;
105
+ }
106
+ });
107
+ watch(()=>props.pauseAfter, (newVal)=>{
108
+ if (elementRef.value && newVal !== undefined) {
109
+ (elementRef.value as any).pauseAfter = newVal;
110
+ }
111
+ });
112
+ watch(()=>props.pauseBefore, (newVal)=>{
113
+ if (elementRef.value && newVal !== undefined) {
114
+ (elementRef.value as any).pauseBefore = newVal;
115
+ }
116
+ });
117
+ watch(()=>props.typoRate, (newVal)=>{
118
+ if (elementRef.value && newVal !== undefined) {
119
+ (elementRef.value as any).typoRate = newVal;
120
+ }
121
+ });
122
+ watch(()=>props.showCursor, (newVal)=>{
123
+ if (elementRef.value && newVal !== undefined) {
124
+ (elementRef.value as any).showCursor = newVal;
125
+ }
126
+ });
127
+ watch(()=>props.loop, (newVal)=>{
128
+ if (elementRef.value && newVal !== undefined) {
129
+ (elementRef.value as any).loop = newVal;
130
+ }
131
+ });
132
+ watch(()=>props.locale, (newVal)=>{
133
+ if (elementRef.value && newVal !== undefined) {
134
+ (elementRef.value as any).locale = newVal;
135
+ }
136
+ });
137
+ return ()=>{
138
+ const eventListeners: Record<string, any> = {};
139
+ eventListeners['onPhrase-change'] = (event: Event)=>{
140
+ emit('phrase-change', event);
141
+ };
142
+ const mergedProps = {
143
+ ...props,
144
+ ...eventListeners,
145
+ ref: elementRef
146
+ };
147
+ if (false && props.modelValue !== undefined) {
148
+ (mergedProps as any).value = props.modelValue;
149
+ }
150
+ return h('uibit-text-typing', mergedProps, slots.default?.());
151
+ };
152
+ }
30
153
  });
@@ -1,6 +1,8 @@
1
1
  import { UIBitElement } from '@uibit/core';
2
2
  /**
3
3
  * Cycles through an array of phrases by simulating realistic keystroke
4
+
5
+ * @summary A typewriter effect animation component with looping backspacing features.
4
6
  * typing and backspace deletion. Includes subtle speed variance, randomized
5
7
  * simulated typos that auto-correct, and a blinking cursor node.
6
8
  *
@@ -18,7 +20,9 @@ import { UIBitElement } from '@uibit/core';
18
20
  * @cssprop [--uibit-text-typing-cursor-width=0.125rem] - Cursor bar width
19
21
  * @cssprop [--uibit-text-typing-cursor-radius=0.0625rem] - Cursor bar border radius
20
22
  * @cssprop [--uibit-text-typing-cursor-blink=0.75s] - Cursor blink interval
21
- */
23
+
24
+ * @cssstate typing - Active when text is actively typing out.
25
+ * @cssstate deleting - Active when text is actively backspacing.*/
22
26
  export declare class TextTyping extends UIBitElement {
23
27
  static styles: import("lit").CSSResult;
24
28
  private phrases;
@@ -1 +1 @@
1
- {"version":3,"file":"text-typing.d.ts","sourceRoot":"","sources":["../src/text-typing.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,UAAW,SAAQ,YAAY;IAC1C,MAAM,CAAC,MAAM,0BAAU;IAEd,OAAO,CAAC,OAAO,CAAgB;IAExC,iFAAiF;IAC5B,SAAS,SAAM;IACpE,6CAA6C;IACU,WAAW,SAAM;IACxE,sEAAsE;IAChB,UAAU,SAAQ;IACxE,sEAAsE;IACf,WAAW,SAAO;IACzE,sFAAsF;IAClC,QAAQ,SAAQ;IACpE,gCAAgC;IACuB,UAAU,UAAQ;IACzE,qEAAqE;IACxC,IAAI,UAAQ;IAE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AC,OAAO;IAIf,OAAO,CAAC,KAAK;IA6Cb,OAAO,CAAC,iBAAiB;IAWzB,MAAM,oCAQL;CACF;eAEc,UAAU"}
@@ -10,6 +10,8 @@ import { property, state } from 'lit/decorators.js';
10
10
  import { styles } from './styles';
11
11
  /**
12
12
  * Cycles through an array of phrases by simulating realistic keystroke
13
+
14
+ * @summary A typewriter effect animation component with looping backspacing features.
13
15
  * typing and backspace deletion. Includes subtle speed variance, randomized
14
16
  * simulated typos that auto-correct, and a blinking cursor node.
15
17
  *
@@ -27,7 +29,9 @@ import { styles } from './styles';
27
29
  * @cssprop [--uibit-text-typing-cursor-width=0.125rem] - Cursor bar width
28
30
  * @cssprop [--uibit-text-typing-cursor-radius=0.0625rem] - Cursor bar border radius
29
31
  * @cssprop [--uibit-text-typing-cursor-blink=0.75s] - Cursor blink interval
30
- */
32
+
33
+ * @cssstate typing - Active when text is actively typing out.
34
+ * @cssstate deleting - Active when text is actively backspacing.*/
31
35
  let TextTyping = class TextTyping extends UIBitElement {
32
36
  constructor() {
33
37
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"text-typing.js","sourceRoot":"","sources":["../src/text-typing.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,YAAY;IAArC;;QAGY,YAAO,GAAa,EAAE,CAAC;QAExC,iFAAiF;QAC5B,cAAS,GAAG,EAAE,CAAC;QACpE,6CAA6C;QACU,gBAAW,GAAG,EAAE,CAAC;QACxE,sEAAsE;QAChB,eAAU,GAAG,IAAI,CAAC;QACxE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AAU;IADtB,aAAa,CAAC,mBAAmB,CAAC;GACtB,UAAU,CAsHtB;;AAED,eAAe,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uibit/text-typing",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Headline text block that cycles through marketing phrases with a realistic typing and deleting animation. Includes speed variance, simulated auto-correcting typos, and a blinking cursor.",
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",
@@ -46,13 +46,13 @@
46
46
  "directory": "packages/components/text-typing"
47
47
  },
48
48
  "dependencies": {
49
- "@uibit/core": "0.1.0"
49
+ "@uibit/core": "0.2.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^20.19.43",
53
53
  "lit": "^3.3.3",
54
54
  "typescript": "7.0.2",
55
- "@uibit/codegen": "0.1.0"
55
+ "@uibit/codegen": "0.2.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "lit": "^3.0.0",
@@ -83,9 +83,9 @@
83
83
  "tagName": "uibit-text-typing"
84
84
  },
85
85
  "scripts": {
86
- "build": "cem analyze --globs 'src/**/*.ts' --litelement && uibit-codegen --package . && tsc",
87
- "dev": "concurrently \"cem analyze --globs 'src/**/*.ts' --litelement --watch\" \"tsc --watch\"",
88
- "analyze": "cem analyze --globs 'src/**/*.ts' --litelement",
86
+ "build": "cem analyze --config ../custom-elements-manifest.config.js && uibit-codegen --package . && tsc",
87
+ "dev": "concurrently \"cem analyze --config ../custom-elements-manifest.config.js --watch\" \"tsc --watch\"",
88
+ "analyze": "cem analyze --config ../custom-elements-manifest.config.js",
89
89
  "typecheck": "tsc --noEmit"
90
90
  }
91
91
  }
@@ -1,24 +0,0 @@
1
- import type { HTMLAttributes, ClassAttributes } from 'react';
2
- import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
- import '@uibit/text-typing';
4
-
5
- declare global {
6
- namespace React {
7
- namespace JSX {
8
- interface IntrinsicElements {
9
- 'uibit-text-typing': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
10
- children?: React.ReactNode;
11
- class?: string;
12
- typeSpeed?: number;
13
- deleteSpeed?: number;
14
- pauseAfter?: number;
15
- pauseBefore?: number;
16
- typoRate?: number;
17
- showCursor?: boolean;
18
- loop?: boolean;
19
- onPhraseChange?: (event: any) => void;
20
- };
21
- }
22
- }
23
- }
24
- }