@uibit/text-typing 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 UIBit Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Text Typing
2
+
3
+ [Interactive Demonstration](https://rawlings.github.io/uibit/components/text-typing)
4
+
5
+ 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
+
7
+ ## Value Delivery
8
+
9
+ - **Dynamic Value Messaging** – Cycles through multiple key phrases in the same space, allowing you to highlight various product benefits without cluttering the layout.
10
+ - **Natural Motion Simulation** – Introduces speed variations and minor corrections during typing loops to create a organic, engaging aesthetic.
11
+ - **Stable Layout Rendering** – Designed to operate inline without causing visual layout shifts on page content.
12
+ - **Visual Callouts** – Includes a configurable blinking cursor to direct reader focus to active statements.
13
+
14
+ ## Ideal Applications
15
+
16
+ - **Hero Headers** – Presenting primary features or slogans on homepage landing folds.
17
+ - **Taglines** – Cycling through customer benefit statements on landing pages.
18
+ - **Introductory Portals** – Greeting visitors with animated welcome text.
19
+
20
+ ## Further Information
21
+
22
+ Detailed design guidelines, customizable attributes, and integration examples are available on our documentation site.
23
+
24
+
25
+ ## Changelog
26
+
27
+ Please see the [Changelog](CHANGELOG.md) for version history.
@@ -0,0 +1,402 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "default",
13
+ "declaration": {
14
+ "name": "default",
15
+ "module": "./text-typing"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "TextTyping",
21
+ "declaration": {
22
+ "name": "TextTyping",
23
+ "module": "./text-typing"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "*",
29
+ "declaration": {
30
+ "name": "*",
31
+ "module": "src/types"
32
+ }
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "kind": "javascript-module",
38
+ "path": "src/styles.ts",
39
+ "declarations": [
40
+ {
41
+ "kind": "variable",
42
+ "name": "styles",
43
+ "default": "css` :host { display: inline; font-size: var(--uibit-text-typing-font-size, inherit); font-weight: var(--uibit-text-typing-font-weight, inherit); color: var(--uibit-text-typing-color, inherit); font-family: var(--uibit-text-typing-font-family, inherit); line-height: var(--uibit-text-typing-line-height, inherit); } .text { display: inline; } .cursor { display: inline-block; width: var(--uibit-text-typing-cursor-width, 0.125rem); height: 1.1em; background: var(--uibit-text-typing-cursor-color, currentColor); margin-left: 0.05em; vertical-align: text-bottom; border-radius: var(--uibit-text-typing-cursor-radius, 0.0625rem); animation: blink var(--uibit-text-typing-cursor-blink, 0.75s) step-end infinite; } :host([paused]) .cursor { animation: none; opacity: 1; } @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } } `"
44
+ }
45
+ ],
46
+ "exports": [
47
+ {
48
+ "kind": "js",
49
+ "name": "styles",
50
+ "declaration": {
51
+ "name": "styles",
52
+ "module": "src/styles.ts"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "kind": "javascript-module",
59
+ "path": "src/text-typing.ts",
60
+ "declarations": [
61
+ {
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>`).",
64
+ "name": "TextTyping",
65
+ "cssProperties": [
66
+ {
67
+ "description": "Font size",
68
+ "name": "--uibit-text-typing-font-size",
69
+ "default": "inherit"
70
+ },
71
+ {
72
+ "description": "Font weight",
73
+ "name": "--uibit-text-typing-font-weight",
74
+ "default": "inherit"
75
+ },
76
+ {
77
+ "description": "Text color",
78
+ "name": "--uibit-text-typing-color",
79
+ "default": "inherit"
80
+ },
81
+ {
82
+ "description": "Font family",
83
+ "name": "--uibit-text-typing-font-family",
84
+ "default": "inherit"
85
+ },
86
+ {
87
+ "description": "Line height",
88
+ "name": "--uibit-text-typing-line-height",
89
+ "default": "inherit"
90
+ },
91
+ {
92
+ "description": "Cursor bar color",
93
+ "name": "--uibit-text-typing-cursor-color",
94
+ "default": "currentColor"
95
+ },
96
+ {
97
+ "description": "Cursor bar width",
98
+ "name": "--uibit-text-typing-cursor-width",
99
+ "default": "0.125rem"
100
+ },
101
+ {
102
+ "description": "Cursor bar border radius",
103
+ "name": "--uibit-text-typing-cursor-radius",
104
+ "default": "0.0625rem"
105
+ },
106
+ {
107
+ "description": "Cursor blink interval",
108
+ "name": "--uibit-text-typing-cursor-blink",
109
+ "default": "0.75s"
110
+ }
111
+ ],
112
+ "members": [
113
+ {
114
+ "kind": "field",
115
+ "name": "phrases",
116
+ "type": {
117
+ "text": "string[]"
118
+ },
119
+ "privacy": "private",
120
+ "default": "[]"
121
+ },
122
+ {
123
+ "kind": "field",
124
+ "name": "typeSpeed",
125
+ "type": {
126
+ "text": "number"
127
+ },
128
+ "default": "80",
129
+ "description": "Base typing speed in ms per character. A small random variance is applied.",
130
+ "attribute": "type-speed"
131
+ },
132
+ {
133
+ "kind": "field",
134
+ "name": "deleteSpeed",
135
+ "type": {
136
+ "text": "number"
137
+ },
138
+ "default": "40",
139
+ "description": "Base delete speed in ms per character.",
140
+ "attribute": "delete-speed"
141
+ },
142
+ {
143
+ "kind": "field",
144
+ "name": "pauseAfter",
145
+ "type": {
146
+ "text": "number"
147
+ },
148
+ "default": "1800",
149
+ "description": "Pause in ms after finishing a phrase before starting to delete.",
150
+ "attribute": "pause-after"
151
+ },
152
+ {
153
+ "kind": "field",
154
+ "name": "pauseBefore",
155
+ "type": {
156
+ "text": "number"
157
+ },
158
+ "default": "400",
159
+ "description": "Pause in ms after fully deleting before typing the next phrase.",
160
+ "attribute": "pause-before"
161
+ },
162
+ {
163
+ "kind": "field",
164
+ "name": "typoRate",
165
+ "type": {
166
+ "text": "number"
167
+ },
168
+ "default": "0.04",
169
+ "description": "Probability (0–1) that a character will be mis-typed and immediately corrected.",
170
+ "attribute": "typo-rate"
171
+ },
172
+ {
173
+ "kind": "field",
174
+ "name": "showCursor",
175
+ "type": {
176
+ "text": "boolean"
177
+ },
178
+ "default": "true",
179
+ "description": "Show the blinking cursor.",
180
+ "attribute": "show-cursor"
181
+ },
182
+ {
183
+ "kind": "field",
184
+ "name": "loop",
185
+ "type": {
186
+ "text": "boolean"
187
+ },
188
+ "default": "true",
189
+ "description": "Loop indefinitely. Set to false to stop after the last phrase.",
190
+ "attribute": "loop"
191
+ },
192
+ {
193
+ "kind": "field",
194
+ "name": "_visible",
195
+ "type": {
196
+ "text": "string"
197
+ },
198
+ "privacy": "private",
199
+ "default": "''"
200
+ },
201
+ {
202
+ "kind": "field",
203
+ "name": "_timer",
204
+ "type": {
205
+ "text": "ReturnType<typeof setTimeout> | undefined"
206
+ },
207
+ "privacy": "private"
208
+ },
209
+ {
210
+ "kind": "field",
211
+ "name": "_phraseIndex",
212
+ "type": {
213
+ "text": "number"
214
+ },
215
+ "privacy": "private",
216
+ "default": "0"
217
+ },
218
+ {
219
+ "kind": "field",
220
+ "name": "_charIndex",
221
+ "type": {
222
+ "text": "number"
223
+ },
224
+ "privacy": "private",
225
+ "default": "0"
226
+ },
227
+ {
228
+ "kind": "field",
229
+ "name": "_deleting",
230
+ "type": {
231
+ "text": "boolean"
232
+ },
233
+ "privacy": "private",
234
+ "default": "false"
235
+ },
236
+ {
237
+ "kind": "field",
238
+ "name": "_typoChar",
239
+ "type": {
240
+ "text": "string"
241
+ },
242
+ "privacy": "private",
243
+ "default": "''"
244
+ },
245
+ {
246
+ "kind": "method",
247
+ "name": "_jitter",
248
+ "privacy": "private",
249
+ "return": {
250
+ "type": {
251
+ "text": "number"
252
+ }
253
+ },
254
+ "parameters": [
255
+ {
256
+ "name": "base",
257
+ "type": {
258
+ "text": "number"
259
+ }
260
+ },
261
+ {
262
+ "name": "factor",
263
+ "default": "0.4"
264
+ }
265
+ ]
266
+ },
267
+ {
268
+ "kind": "method",
269
+ "name": "_tick",
270
+ "privacy": "private"
271
+ },
272
+ {
273
+ "kind": "method",
274
+ "name": "_handleSlotChange",
275
+ "privacy": "private",
276
+ "parameters": [
277
+ {
278
+ "name": "e",
279
+ "type": {
280
+ "text": "Event"
281
+ }
282
+ }
283
+ ]
284
+ }
285
+ ],
286
+ "events": [
287
+ {
288
+ "type": {
289
+ "text": "{ phrase: string, index: number }"
290
+ },
291
+ "description": "Fired when a new phrase begins typing",
292
+ "name": "phrase-change"
293
+ }
294
+ ],
295
+ "attributes": [
296
+ {
297
+ "name": "type-speed",
298
+ "type": {
299
+ "text": "number"
300
+ },
301
+ "default": "80",
302
+ "description": "Base typing speed in ms per character. A small random variance is applied.",
303
+ "fieldName": "typeSpeed"
304
+ },
305
+ {
306
+ "name": "delete-speed",
307
+ "type": {
308
+ "text": "number"
309
+ },
310
+ "default": "40",
311
+ "description": "Base delete speed in ms per character.",
312
+ "fieldName": "deleteSpeed"
313
+ },
314
+ {
315
+ "name": "pause-after",
316
+ "type": {
317
+ "text": "number"
318
+ },
319
+ "default": "1800",
320
+ "description": "Pause in ms after finishing a phrase before starting to delete.",
321
+ "fieldName": "pauseAfter"
322
+ },
323
+ {
324
+ "name": "pause-before",
325
+ "type": {
326
+ "text": "number"
327
+ },
328
+ "default": "400",
329
+ "description": "Pause in ms after fully deleting before typing the next phrase.",
330
+ "fieldName": "pauseBefore"
331
+ },
332
+ {
333
+ "name": "typo-rate",
334
+ "type": {
335
+ "text": "number"
336
+ },
337
+ "default": "0.04",
338
+ "description": "Probability (0–1) that a character will be mis-typed and immediately corrected.",
339
+ "fieldName": "typoRate"
340
+ },
341
+ {
342
+ "name": "show-cursor",
343
+ "type": {
344
+ "text": "boolean"
345
+ },
346
+ "default": "true",
347
+ "description": "Show the blinking cursor.",
348
+ "fieldName": "showCursor"
349
+ },
350
+ {
351
+ "name": "loop",
352
+ "type": {
353
+ "text": "boolean"
354
+ },
355
+ "default": "true",
356
+ "description": "Loop indefinitely. Set to false to stop after the last phrase.",
357
+ "fieldName": "loop"
358
+ }
359
+ ],
360
+ "superclass": {
361
+ "name": "UIBitElement",
362
+ "package": "@uibit/core"
363
+ },
364
+ "tagName": "uibit-text-typing",
365
+ "customElement": true
366
+ }
367
+ ],
368
+ "exports": [
369
+ {
370
+ "kind": "js",
371
+ "name": "TextTyping",
372
+ "declaration": {
373
+ "name": "TextTyping",
374
+ "module": "src/text-typing.ts"
375
+ }
376
+ },
377
+ {
378
+ "kind": "custom-element-definition",
379
+ "name": "uibit-text-typing",
380
+ "declaration": {
381
+ "name": "TextTyping",
382
+ "module": "src/text-typing.ts"
383
+ }
384
+ },
385
+ {
386
+ "kind": "js",
387
+ "name": "default",
388
+ "declaration": {
389
+ "name": "TextTyping",
390
+ "module": "src/text-typing.ts"
391
+ }
392
+ }
393
+ ]
394
+ },
395
+ {
396
+ "kind": "javascript-module",
397
+ "path": "src/types.ts",
398
+ "declarations": [],
399
+ "exports": []
400
+ }
401
+ ]
402
+ }
@@ -0,0 +1,62 @@
1
+ import { Component, ChangeDetectionStrategy, ElementRef, input, effect, output, booleanAttribute, numberAttribute } from '@angular/core';
2
+ import '@uibit/text-typing';
3
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
4
+
5
+ @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
+ }
13
+ })
14
+ export class NgxTextTyping {
15
+ constructor(private el: ElementRef<HTMLElementClass>) {
16
+ effect(() => {
17
+ if (this.el.nativeElement) {
18
+ this.el.nativeElement.typeSpeed = this.typeSpeed();
19
+ }
20
+ });
21
+ effect(() => {
22
+ if (this.el.nativeElement) {
23
+ this.el.nativeElement.deleteSpeed = this.deleteSpeed();
24
+ }
25
+ });
26
+ effect(() => {
27
+ if (this.el.nativeElement) {
28
+ this.el.nativeElement.pauseAfter = this.pauseAfter();
29
+ }
30
+ });
31
+ effect(() => {
32
+ if (this.el.nativeElement) {
33
+ this.el.nativeElement.pauseBefore = this.pauseBefore();
34
+ }
35
+ });
36
+ effect(() => {
37
+ if (this.el.nativeElement) {
38
+ this.el.nativeElement.typoRate = this.typoRate();
39
+ }
40
+ });
41
+ effect(() => {
42
+ if (this.el.nativeElement) {
43
+ this.el.nativeElement.showCursor = this.showCursor();
44
+ }
45
+ });
46
+ effect(() => {
47
+ if (this.el.nativeElement) {
48
+ this.el.nativeElement.loop = this.loop();
49
+ }
50
+ });
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 }>>();
62
+ }
@@ -0,0 +1,10 @@
1
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
2
+ import '@uibit/text-typing';
3
+
4
+ declare global {
5
+ namespace astroHTML.JSX {
6
+ interface IntrinsicElements {
7
+ 'uibit-text-typing': Partial<HTMLElementClass> & astroHTML.JSX.HTMLAttributes;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,7 @@
1
+ import { defineNuxtPlugin } from '#app';
2
+
3
+ export default defineNuxtPlugin(() => {
4
+ if (process.client) {
5
+ import('@uibit/text-typing');
6
+ }
7
+ });
@@ -0,0 +1,19 @@
1
+ import type { JSX } from 'preact';
2
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
+ import '@uibit/text-typing';
4
+
5
+ declare module 'preact' {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'uibit-text-typing': JSX.HTMLAttributes<HTMLElementClass> & {
9
+ typeSpeed?: number;
10
+ deleteSpeed?: number;
11
+ pauseAfter?: number;
12
+ pauseBefore?: number;
13
+ typoRate?: number;
14
+ showCursor?: boolean;
15
+ loop?: boolean;
16
+ };
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,10 @@
1
+ import { component$, Slot } from '@builder.io/qwik';
2
+ import '@uibit/text-typing';
3
+
4
+ export const TextTyping = component$<any>((props) => {
5
+ return (
6
+ <uibit-text-typing {...props}>
7
+ <Slot />
8
+ </uibit-text-typing>
9
+ );
10
+ });
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,20 @@
1
+ import type { JSX } from 'solid-js';
2
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
+ import '@uibit/text-typing';
4
+
5
+ declare module 'solid-js' {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'uibit-text-typing': Partial<HTMLElementClass> & JSX.HTMLAttributes<HTMLElementClass> & {
9
+ typeSpeed?: number;
10
+ deleteSpeed?: number;
11
+ pauseAfter?: number;
12
+ pauseBefore?: number;
13
+ typoRate?: number;
14
+ showCursor?: boolean;
15
+ loop?: boolean;
16
+ "on:phrase-change"?: (event: CustomEvent) => void;
17
+ };
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
2
+ import '@uibit/text-typing';
3
+
4
+ declare module '@stencil/core' {
5
+ export namespace JSX {
6
+ interface IntrinsicElements {
7
+ 'uibit-text-typing': HTMLElementClass & {
8
+ typeSpeed?: number;
9
+ deleteSpeed?: number;
10
+ pauseAfter?: number;
11
+ pauseBefore?: number;
12
+ typoRate?: number;
13
+ showCursor?: boolean;
14
+ loop?: boolean;
15
+ };
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,61 @@
1
+ <script lang="ts">
2
+ import '@uibit/text-typing';
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
14
+ } = $props<{
15
+ children?: any;
16
+ typeSpeed?: number;
17
+ deleteSpeed?: number;
18
+ pauseAfter?: number;
19
+ pauseBefore?: number;
20
+ typoRate?: number;
21
+ showCursor?: boolean;
22
+ loop?: boolean;
23
+
24
+ }>();
25
+
26
+ let elementRef: HTMLElementClass | null = $state(null);
27
+
28
+ $effect(() => {
29
+ if (elementRef && typeSpeed !== undefined) {
30
+ elementRef.typeSpeed = typeSpeed;
31
+ }
32
+ if (elementRef && deleteSpeed !== undefined) {
33
+ elementRef.deleteSpeed = deleteSpeed;
34
+ }
35
+ if (elementRef && pauseAfter !== undefined) {
36
+ elementRef.pauseAfter = pauseAfter;
37
+ }
38
+ if (elementRef && pauseBefore !== undefined) {
39
+ elementRef.pauseBefore = pauseBefore;
40
+ }
41
+ if (elementRef && typoRate !== undefined) {
42
+ elementRef.typoRate = typoRate;
43
+ }
44
+ if (elementRef && showCursor !== undefined) {
45
+ elementRef.showCursor = showCursor;
46
+ }
47
+ if (elementRef && loop !== undefined) {
48
+ elementRef.loop = loop;
49
+ }
50
+ });
51
+
52
+ </script>
53
+
54
+ <uibit-text-typing bind:this={elementRef} {...$$restProps}>
55
+
56
+ {#if children}
57
+ {@render children()}
58
+ {:else}
59
+ <slot />
60
+ {/if}
61
+ </uibit-text-typing>
@@ -0,0 +1,30 @@
1
+ import { defineComponent, h } from 'vue';
2
+ import type { TextTyping as HTMLElementClass } from '@uibit/text-typing';
3
+ import '@uibit/text-typing';
4
+
5
+ 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
+ }
30
+ });
@@ -0,0 +1,3 @@
1
+ export { default, TextTyping } from './text-typing';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpD,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default, TextTyping } from './text-typing';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpD,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import("lit").CSSResult;
2
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAkClB,CAAC"}
package/dist/styles.js ADDED
@@ -0,0 +1,37 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ display: inline;
5
+ font-size: var(--uibit-text-typing-font-size, inherit);
6
+ font-weight: var(--uibit-text-typing-font-weight, inherit);
7
+ color: var(--uibit-text-typing-color, inherit);
8
+ font-family: var(--uibit-text-typing-font-family, inherit);
9
+ line-height: var(--uibit-text-typing-line-height, inherit);
10
+ }
11
+
12
+ .text {
13
+ display: inline;
14
+ }
15
+
16
+ .cursor {
17
+ display: inline-block;
18
+ width: var(--uibit-text-typing-cursor-width, 0.125rem);
19
+ height: 1.1em;
20
+ background: var(--uibit-text-typing-cursor-color, currentColor);
21
+ margin-left: 0.05em;
22
+ vertical-align: text-bottom;
23
+ border-radius: var(--uibit-text-typing-cursor-radius, 0.0625rem);
24
+ animation: blink var(--uibit-text-typing-cursor-blink, 0.75s) step-end infinite;
25
+ }
26
+
27
+ :host([paused]) .cursor {
28
+ animation: none;
29
+ opacity: 1;
30
+ }
31
+
32
+ @keyframes blink {
33
+ 0%, 100% { opacity: 1; }
34
+ 50% { opacity: 0; }
35
+ }
36
+ `;
37
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCxB,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { UIBitElement } from '@uibit/core';
2
+ /**
3
+ * Cycles through an array of phrases by simulating realistic keystroke
4
+ * typing and backspace deletion. Includes subtle speed variance, randomized
5
+ * simulated typos that auto-correct, and a blinking cursor node.
6
+ *
7
+ * Pass static prefix or wrapper text inside the default slot, and phrases to cycle through
8
+ * inside elements with `slot="text"` (e.g. `<span slot="text">phrase</span>`).
9
+ *
10
+ * @fires {{ phrase: string, index: number }} phrase-change - Fired when a new phrase begins typing
11
+ *
12
+ * @cssprop [--uibit-text-typing-font-size=inherit] - Font size
13
+ * @cssprop [--uibit-text-typing-font-weight=inherit] - Font weight
14
+ * @cssprop [--uibit-text-typing-color=inherit] - Text color
15
+ * @cssprop [--uibit-text-typing-font-family=inherit] - Font family
16
+ * @cssprop [--uibit-text-typing-line-height=inherit] - Line height
17
+ * @cssprop [--uibit-text-typing-cursor-color=currentColor] - Cursor bar color
18
+ * @cssprop [--uibit-text-typing-cursor-width=0.125rem] - Cursor bar width
19
+ * @cssprop [--uibit-text-typing-cursor-radius=0.0625rem] - Cursor bar border radius
20
+ * @cssprop [--uibit-text-typing-cursor-blink=0.75s] - Cursor blink interval
21
+ */
22
+ export declare class TextTyping extends UIBitElement {
23
+ static styles: import("lit").CSSResult;
24
+ private phrases;
25
+ /** Base typing speed in ms per character. A small random variance is applied. */
26
+ typeSpeed: number;
27
+ /** Base delete speed in ms per character. */
28
+ deleteSpeed: number;
29
+ /** Pause in ms after finishing a phrase before starting to delete. */
30
+ pauseAfter: number;
31
+ /** Pause in ms after fully deleting before typing the next phrase. */
32
+ pauseBefore: number;
33
+ /** Probability (0–1) that a character will be mis-typed and immediately corrected. */
34
+ typoRate: number;
35
+ /** Show the blinking cursor. */
36
+ showCursor: boolean;
37
+ /** Loop indefinitely. Set to false to stop after the last phrase. */
38
+ loop: boolean;
39
+ private _visible;
40
+ private _timer?;
41
+ private _phraseIndex;
42
+ private _charIndex;
43
+ private _deleting;
44
+ private _typoChar;
45
+ connectedCallback(): void;
46
+ disconnectedCallback(): void;
47
+ updated(changed: Map<string, unknown>): void;
48
+ private _jitter;
49
+ private _tick;
50
+ private _handleSlotChange;
51
+ render(): import("lit").TemplateResult<1>;
52
+ }
53
+ export default TextTyping;
54
+ //# sourceMappingURL=text-typing.d.ts.map
@@ -0,0 +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;IAEhC,OAAO,CAAC,QAAQ,CAAM;IAE/B,OAAO,CAAC,MAAM,CAAC,CAAgC;IAC/C,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAM;IAEvB,iBAAiB,SAGhB;IAED,oBAAoB,SAGnB;IAED,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QASpC;IAED,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,KAAK;IA6Cb,OAAO,CAAC,iBAAiB;IAWzB,MAAM,oCAQL;CACF;eAEc,UAAU"}
@@ -0,0 +1,176 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html } from 'lit';
8
+ import { customElement, UIBitElement } from '@uibit/core';
9
+ import { property, state } from 'lit/decorators.js';
10
+ import { styles } from './styles';
11
+ /**
12
+ * Cycles through an array of phrases by simulating realistic keystroke
13
+ * typing and backspace deletion. Includes subtle speed variance, randomized
14
+ * simulated typos that auto-correct, and a blinking cursor node.
15
+ *
16
+ * Pass static prefix or wrapper text inside the default slot, and phrases to cycle through
17
+ * inside elements with `slot="text"` (e.g. `<span slot="text">phrase</span>`).
18
+ *
19
+ * @fires {{ phrase: string, index: number }} phrase-change - Fired when a new phrase begins typing
20
+ *
21
+ * @cssprop [--uibit-text-typing-font-size=inherit] - Font size
22
+ * @cssprop [--uibit-text-typing-font-weight=inherit] - Font weight
23
+ * @cssprop [--uibit-text-typing-color=inherit] - Text color
24
+ * @cssprop [--uibit-text-typing-font-family=inherit] - Font family
25
+ * @cssprop [--uibit-text-typing-line-height=inherit] - Line height
26
+ * @cssprop [--uibit-text-typing-cursor-color=currentColor] - Cursor bar color
27
+ * @cssprop [--uibit-text-typing-cursor-width=0.125rem] - Cursor bar width
28
+ * @cssprop [--uibit-text-typing-cursor-radius=0.0625rem] - Cursor bar border radius
29
+ * @cssprop [--uibit-text-typing-cursor-blink=0.75s] - Cursor blink interval
30
+ */
31
+ let TextTyping = class TextTyping extends UIBitElement {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.phrases = [];
35
+ /** Base typing speed in ms per character. A small random variance is applied. */
36
+ this.typeSpeed = 80;
37
+ /** Base delete speed in ms per character. */
38
+ this.deleteSpeed = 40;
39
+ /** Pause in ms after finishing a phrase before starting to delete. */
40
+ this.pauseAfter = 1800;
41
+ /** Pause in ms after fully deleting before typing the next phrase. */
42
+ this.pauseBefore = 400;
43
+ /** Probability (0–1) that a character will be mis-typed and immediately corrected. */
44
+ this.typoRate = 0.04;
45
+ /** Show the blinking cursor. */
46
+ this.showCursor = true;
47
+ /** Loop indefinitely. Set to false to stop after the last phrase. */
48
+ this.loop = true;
49
+ this._visible = '';
50
+ this._phraseIndex = 0;
51
+ this._charIndex = 0;
52
+ this._deleting = false;
53
+ this._typoChar = '';
54
+ }
55
+ static { this.styles = styles; }
56
+ connectedCallback() {
57
+ super.connectedCallback();
58
+ if (this.phrases.length)
59
+ this._tick();
60
+ }
61
+ disconnectedCallback() {
62
+ super.disconnectedCallback();
63
+ clearTimeout(this._timer);
64
+ }
65
+ updated(changed) {
66
+ if (changed.has('phrases') && this.phrases.length) {
67
+ clearTimeout(this._timer);
68
+ this._phraseIndex = 0;
69
+ this._charIndex = 0;
70
+ this._deleting = false;
71
+ this._visible = '';
72
+ this._tick();
73
+ }
74
+ }
75
+ _jitter(base, factor = 0.4) {
76
+ return base + (Math.random() * 2 - 1) * base * factor;
77
+ }
78
+ _tick() {
79
+ const phrase = this.phrases[this._phraseIndex] ?? '';
80
+ if (!this._deleting) {
81
+ if (this._charIndex < phrase.length) {
82
+ if (!this._typoChar && Math.random() < this.typoRate) {
83
+ const wrongChar = String.fromCharCode(phrase.charCodeAt(this._charIndex) + (Math.random() > 0.5 ? 1 : -1));
84
+ this._visible += wrongChar;
85
+ this._typoChar = wrongChar;
86
+ this._timer = setTimeout(() => {
87
+ this._visible = this._visible.slice(0, -1);
88
+ this._typoChar = '';
89
+ this._tick();
90
+ }, this._jitter(120));
91
+ return;
92
+ }
93
+ this._visible += phrase[this._charIndex];
94
+ this._charIndex++;
95
+ this._timer = setTimeout(() => this._tick(), this._jitter(this.typeSpeed));
96
+ }
97
+ else {
98
+ this.setAttribute('paused', '');
99
+ this._timer = setTimeout(() => {
100
+ this.removeAttribute('paused');
101
+ this._deleting = true;
102
+ this._tick();
103
+ }, this.pauseAfter);
104
+ }
105
+ }
106
+ else {
107
+ if (this._charIndex > 0) {
108
+ this._charIndex--;
109
+ this._visible = phrase.slice(0, this._charIndex);
110
+ this._timer = setTimeout(() => this._tick(), this._jitter(this.deleteSpeed));
111
+ }
112
+ else {
113
+ this._deleting = false;
114
+ const next = (this._phraseIndex + 1) % this.phrases.length;
115
+ if (!this.loop && next === 0)
116
+ return;
117
+ this._phraseIndex = next;
118
+ this._charIndex = 0;
119
+ this.dispatchCustomEvent('phrase-change', { phrase: this.phrases[this._phraseIndex], index: this._phraseIndex });
120
+ this._timer = setTimeout(() => this._tick(), this.pauseBefore);
121
+ }
122
+ }
123
+ }
124
+ _handleSlotChange(e) {
125
+ const slot = e.target;
126
+ const nodes = slot.assignedNodes({ flatten: true });
127
+ const phrases = nodes
128
+ .map(node => node.textContent?.trim() ?? '')
129
+ .filter(text => text !== '');
130
+ if (phrases.length > 0) {
131
+ this.phrases = phrases;
132
+ }
133
+ }
134
+ render() {
135
+ return html `
136
+ <slot></slot>
137
+ <slot name="text" @slotchange=${this._handleSlotChange} style="display: none;"></slot>
138
+ <span class="text" part="text" aria-live="polite" aria-atomic="true">${this._visible}</span>${this.showCursor
139
+ ? html `<span class="cursor" part="cursor" aria-hidden="true"></span>`
140
+ : ''}
141
+ `;
142
+ }
143
+ };
144
+ __decorate([
145
+ state()
146
+ ], TextTyping.prototype, "phrases", void 0);
147
+ __decorate([
148
+ property({ type: Number, attribute: 'type-speed' })
149
+ ], TextTyping.prototype, "typeSpeed", void 0);
150
+ __decorate([
151
+ property({ type: Number, attribute: 'delete-speed' })
152
+ ], TextTyping.prototype, "deleteSpeed", void 0);
153
+ __decorate([
154
+ property({ type: Number, attribute: 'pause-after' })
155
+ ], TextTyping.prototype, "pauseAfter", void 0);
156
+ __decorate([
157
+ property({ type: Number, attribute: 'pause-before' })
158
+ ], TextTyping.prototype, "pauseBefore", void 0);
159
+ __decorate([
160
+ property({ type: Number, attribute: 'typo-rate' })
161
+ ], TextTyping.prototype, "typoRate", void 0);
162
+ __decorate([
163
+ property({ type: Boolean, attribute: 'show-cursor' })
164
+ ], TextTyping.prototype, "showCursor", void 0);
165
+ __decorate([
166
+ property({ type: Boolean })
167
+ ], TextTyping.prototype, "loop", void 0);
168
+ __decorate([
169
+ state()
170
+ ], TextTyping.prototype, "_visible", void 0);
171
+ TextTyping = __decorate([
172
+ customElement('uibit-text-typing')
173
+ ], TextTyping);
174
+ export { TextTyping };
175
+ export default TextTyping;
176
+ //# sourceMappingURL=text-typing.js.map
@@ -0,0 +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,sEAAsE;QACf,gBAAW,GAAG,GAAG,CAAC;QACzE,sFAAsF;QAClC,aAAQ,GAAG,IAAI,CAAC;QACpE,gCAAgC;QACuB,eAAU,GAAG,IAAI,CAAC;QACzE,qEAAqE;QACxC,SAAI,GAAG,IAAI,CAAC;QAExB,aAAQ,GAAG,EAAE,CAAC;QAGvB,iBAAY,GAAG,CAAC,CAAC;QACjB,eAAU,GAAG,CAAC,CAAC;QACf,cAAS,GAAG,KAAK,CAAC;QAClB,cAAS,GAAG,EAAE,CAAC;IA4FzB,CAAC;aArHQ,WAAM,GAAG,MAAM,AAAT,CAAU;IA2BvB,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,YAAY,CAAC,IAAI,CA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J,OAAO,IAAI,CAAA;;sCAEuB,IAAI,CAAC,iBAAiB;6EACiB,IAAI,CAAC,QAAQ,UAAU,IAAI,CAAC,UAAU;YAC3G,CAAC,CAAC,IAAI,CAAA,+DAA+D;YACrE,CAAC,CAAC,EAAE;KACP,CAAC;IACJ,CAAC;CACF,CAAA;AAnHkB;IAAhB,KAAK,EAAE;2CAAgC;AAGa;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CAAgB;AAEb;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CAAkB;AAElB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;8CAAmB;AAEjB;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CAAmB;AAErB;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;4CAAiB;AAEb;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;8CAAmB;AAE5C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAa;AAExB;IAAhB,KAAK,EAAE;4CAAuB;AApBpB,UAAU;IADtB,aAAa,CAAC,mBAAmB,CAAC;GACtB,UAAU,CAsHtB;;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type TextTyping from './text-typing';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'uibit-text-typing': TextTyping;
5
+ }
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,qBAAqB;QAC3B,mBAAmB,EAAE,UAAU,CAAC;KACnC;CACA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@uibit/text-typing",
3
+ "version": "0.1.0",
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
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./custom-elements.json": "./custom-elements.json",
14
+ "./react": "./dist/frameworks/react/index.d.ts",
15
+ "./vue": "./dist/frameworks/vue/index.ts",
16
+ "./svelte": "./dist/frameworks/svelte/index.svelte",
17
+ "./angular": "./dist/frameworks/angular/index.ts",
18
+ "./solid": "./dist/frameworks/solid/index.d.ts",
19
+ "./astro": "./dist/frameworks/astro/index.astro",
20
+ "./qwik": "./dist/frameworks/qwik/index.tsx",
21
+ "./nuxt": "./dist/frameworks/nuxt/index.ts",
22
+ "./preact": "./dist/frameworks/preact/index.d.ts",
23
+ "./stencil": "./dist/frameworks/stencil/index.d.ts"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "package.json",
28
+ "README.md",
29
+ "LICENSE",
30
+ "custom-elements.json"
31
+ ],
32
+ "keywords": [
33
+ "typewriter",
34
+ "typing",
35
+ "animation",
36
+ "headline",
37
+ "marketing",
38
+ "web-component",
39
+ "lit"
40
+ ],
41
+ "author": "Jonathan Rawlings",
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/Rawlings/uibit",
46
+ "directory": "packages/components/text-typing"
47
+ },
48
+ "dependencies": {
49
+ "@uibit/core": "0.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.19.43",
53
+ "lit": "^3.3.3",
54
+ "typescript": "7.0.2",
55
+ "@uibit/codegen": "0.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "lit": "^3.0.0",
59
+ "react": ">=18",
60
+ "vue": ">=3",
61
+ "svelte": ">=4 || ^5",
62
+ "@angular/core": ">=14"
63
+ },
64
+ "customElements": "custom-elements.json",
65
+ "peerDependenciesMeta": {
66
+ "react": {
67
+ "optional": true
68
+ },
69
+ "vue": {
70
+ "optional": true
71
+ },
72
+ "svelte": {
73
+ "optional": true
74
+ },
75
+ "@angular/core": {
76
+ "optional": true
77
+ }
78
+ },
79
+ "uibit": {
80
+ "id": "text-typing",
81
+ "title": "Text Typing",
82
+ "category": "Text",
83
+ "tagName": "uibit-text-typing"
84
+ },
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",
89
+ "typecheck": "tsc --noEmit"
90
+ }
91
+ }