@gecko-ui-kit/vue 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +2052 -2
- package/index.d.ts +13 -0
- package/index.js +16 -0
- package/package.json +48 -4
- package/src/actions.d.ts +186 -0
- package/src/actions.js +329 -0
- package/src/basics.d.ts +315 -0
- package/src/basics.js +475 -0
- package/src/charts.d.ts +219 -0
- package/src/charts.js +93 -0
- package/src/controls.d.ts +149 -0
- package/src/controls.js +354 -0
- package/src/core.d.ts +109 -0
- package/src/core.js +414 -0
- package/src/data.d.ts +754 -0
- package/src/data.js +718 -0
- package/src/effects.d.ts +407 -0
- package/src/effects.js +699 -0
- package/src/forms.d.ts +757 -0
- package/src/forms.js +481 -0
- package/src/motion.d.ts +127 -0
- package/src/motion.js +216 -0
- package/src/overlays.d.ts +467 -0
- package/src/overlays.js +710 -0
- package/src/plugin.d.ts +6 -0
- package/src/plugin.js +27 -0
- package/src/shell.d.ts +210 -0
- package/src/shell.js +716 -0
- package/src/text.d.ts +309 -0
- package/src/text.js +383 -0
package/src/text.d.ts
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { GeckoComponent, EnhancerProps, DefaultSlot } from './core.js';
|
|
3
|
+
|
|
4
|
+
/** The element a text piece renders: `as` (default 'span'; 'h1', 'p'…). Any other attribute goes on it. */
|
|
5
|
+
interface AsProp {
|
|
6
|
+
/** Element to render (default 'span'; 'h1', 'p'…). */
|
|
7
|
+
as?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* ---------------- TextReveal ---------------- */
|
|
11
|
+
|
|
12
|
+
export interface TextRevealProps extends AsProp {
|
|
13
|
+
/** The text, instead of the slot. A new text plays again in place (retitle). */
|
|
14
|
+
text?: string;
|
|
15
|
+
/** Seconds before the first letter (0). */
|
|
16
|
+
delay?: number;
|
|
17
|
+
/** Seconds between letters (0.022). */
|
|
18
|
+
stagger?: number;
|
|
19
|
+
/** Degrees each letter starts tilted (6). */
|
|
20
|
+
tilt?: number;
|
|
21
|
+
/** Seconds one letter takes (0.85). */
|
|
22
|
+
duration?: number;
|
|
23
|
+
}
|
|
24
|
+
/** <TextReveal as="h1">Bikes for every trip</TextReveal> — the letters roll up out of a mask (title()). The slot is the text. */
|
|
25
|
+
export const TextReveal: GeckoComponent<TextRevealProps, DefaultSlot>;
|
|
26
|
+
|
|
27
|
+
/* ---------------- Typewriter ---------------- */
|
|
28
|
+
|
|
29
|
+
export interface TypewriterOptions {
|
|
30
|
+
/** The phrases, typed in turn (default: the slot's text as one phrase). A new list is typed in place. */
|
|
31
|
+
phrases?: string[];
|
|
32
|
+
/** Seconds per letter while typing (0.06). */
|
|
33
|
+
speed?: number;
|
|
34
|
+
/** 0 = even rhythm, 1 = very uneven (0.6). */
|
|
35
|
+
jitter?: number;
|
|
36
|
+
/** Seconds per letter while deleting (0.03). */
|
|
37
|
+
eraseSpeed?: number;
|
|
38
|
+
/** Delete letter by letter, or select the phrase and clear it at once. */
|
|
39
|
+
erase?: 'backspace' | 'select';
|
|
40
|
+
/** Seconds a finished phrase stays before it is deleted (1.6). */
|
|
41
|
+
hold?: number;
|
|
42
|
+
/** Seconds of empty caret before the next phrase (0.35). */
|
|
43
|
+
gap?: number;
|
|
44
|
+
/** Seconds before the first letter (0.3). */
|
|
45
|
+
delay?: number;
|
|
46
|
+
/** false: stop on the last phrase (true). */
|
|
47
|
+
loop?: boolean;
|
|
48
|
+
/** The caret's look, or false for none ('bar'). */
|
|
49
|
+
caret?: 'bar' | 'block' | 'underscore' | false;
|
|
50
|
+
/** Pause while the element is off screen (true). */
|
|
51
|
+
whenVisible?: boolean;
|
|
52
|
+
/** Language for letter splitting and the screen-reader list (default: the page's lang). */
|
|
53
|
+
locale?: string;
|
|
54
|
+
/** What screen readers hear instead of the phrase list. */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** A phrase has been typed out in full. */
|
|
57
|
+
onPhrase?: (index: number, text: string) => void;
|
|
58
|
+
/** Stop typing (true) and go on (false). */
|
|
59
|
+
paused?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface TypewriterHandle {
|
|
62
|
+
/** Index of the phrase being typed. */
|
|
63
|
+
readonly phrase: number;
|
|
64
|
+
play(): TypewriterHandle;
|
|
65
|
+
pause(): TypewriterHandle;
|
|
66
|
+
/** Start again from the first phrase. */
|
|
67
|
+
restart(): TypewriterHandle;
|
|
68
|
+
/** Delete the current phrase and type these. */
|
|
69
|
+
set(phrases: string[]): TypewriterHandle;
|
|
70
|
+
readonly el: HTMLElement;
|
|
71
|
+
}
|
|
72
|
+
export interface TypewriterProps extends AsProp, TypewriterOptions {}
|
|
73
|
+
/** <Typewriter :phrases="['scooters', 'e-bikes']" /> — text typed letter by letter behind a caret. Template ref → TypewriterHandle. */
|
|
74
|
+
export const Typewriter: GeckoComponent<TypewriterProps, DefaultSlot>;
|
|
75
|
+
|
|
76
|
+
/* ---------------- Rotator ---------------- */
|
|
77
|
+
|
|
78
|
+
export interface RotatorOptions {
|
|
79
|
+
/** The words, in turn. A new list starts again from the first word. */
|
|
80
|
+
words: string[];
|
|
81
|
+
/** Seconds each word stays (2.2). */
|
|
82
|
+
every?: number;
|
|
83
|
+
/** How the word changes ('roll'). */
|
|
84
|
+
effect?: 'roll' | 'drop' | 'slide' | 'blur' | 'letters';
|
|
85
|
+
/** Seconds the change takes (0.6). */
|
|
86
|
+
duration?: number;
|
|
87
|
+
/** GSAP ease of the landing ('back.out(1.6)'). */
|
|
88
|
+
ease?: string;
|
|
89
|
+
/** 'letters' only: seconds between letters (0.03). */
|
|
90
|
+
stagger?: number;
|
|
91
|
+
/** Change by itself (true); false: only through `index` or the handle. */
|
|
92
|
+
auto?: boolean;
|
|
93
|
+
/** Pause while off screen (true). */
|
|
94
|
+
whenVisible?: boolean;
|
|
95
|
+
/** Language of the screen-reader list. */
|
|
96
|
+
locale?: string;
|
|
97
|
+
/** What screen readers hear instead of the word list. */
|
|
98
|
+
label?: string;
|
|
99
|
+
/** The word changed. */
|
|
100
|
+
onChange?: (index: number, word: string) => void;
|
|
101
|
+
/** Show this word (changes to it, animated). */
|
|
102
|
+
index?: number;
|
|
103
|
+
/** Stop changing (true) and go on (false). */
|
|
104
|
+
paused?: boolean;
|
|
105
|
+
/** A soft highlight box behind the word (class rot--pill). */
|
|
106
|
+
pill?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface RotatorHandle {
|
|
109
|
+
readonly index: number;
|
|
110
|
+
next(): RotatorHandle;
|
|
111
|
+
go(index: number): RotatorHandle;
|
|
112
|
+
play(): RotatorHandle;
|
|
113
|
+
pause(): RotatorHandle;
|
|
114
|
+
set(words: string[]): RotatorHandle;
|
|
115
|
+
readonly el: HTMLElement;
|
|
116
|
+
}
|
|
117
|
+
export interface RotatorProps extends AsProp, RotatorOptions {}
|
|
118
|
+
/** <Rotator :words="['scooter', 'e-bike']" pill /> — one word in a sentence keeps changing. Template ref → RotatorHandle. */
|
|
119
|
+
export const Rotator: GeckoComponent<RotatorProps>;
|
|
120
|
+
|
|
121
|
+
/* ---------------- Shine ---------------- */
|
|
122
|
+
|
|
123
|
+
export interface ShineOptions {
|
|
124
|
+
/** 'gradient' (brand gradient letters, white glint), 'ink' (grey letters, ink band) or 'color' (own colour). */
|
|
125
|
+
look?: 'gradient' | 'ink' | 'color';
|
|
126
|
+
/** 'loop' forever (paused off screen), 'view' once each time it scrolls into view, 'hover' on pointer / focus. */
|
|
127
|
+
trigger?: 'loop' | 'view' | 'hover';
|
|
128
|
+
/** Seconds one sweep takes (1.4). */
|
|
129
|
+
duration?: number;
|
|
130
|
+
/** 'loop': seconds of rest between sweeps (1.8). */
|
|
131
|
+
repeatDelay?: number;
|
|
132
|
+
/** Seconds before the first sweep (0). */
|
|
133
|
+
delay?: number;
|
|
134
|
+
/** GSAP ease ('power2.inOut'). */
|
|
135
|
+
ease?: string;
|
|
136
|
+
/** Slant of the band in degrees (110). */
|
|
137
|
+
angle?: number;
|
|
138
|
+
/** Band width, percent of the sweep layer (12). */
|
|
139
|
+
width?: number;
|
|
140
|
+
/** Colour of the band (default: from the look). */
|
|
141
|
+
color?: string;
|
|
142
|
+
}
|
|
143
|
+
/** <Shine as="h2">Fresh roast</Shine> — a band of light sweeps across the letters. */
|
|
144
|
+
export const Shine: GeckoComponent<EnhancerProps<ShineOptions>, DefaultSlot>;
|
|
145
|
+
|
|
146
|
+
/* ---------------- Highlighter ---------------- */
|
|
147
|
+
|
|
148
|
+
export interface HighlighterOptions {
|
|
149
|
+
/** Which words inside get the stroke ('mark'). */
|
|
150
|
+
selector?: string;
|
|
151
|
+
/** Behind the words, or a thick stroke under them ('marker'). */
|
|
152
|
+
look?: 'marker' | 'underline';
|
|
153
|
+
/** Theme colour ('accent'). */
|
|
154
|
+
tone?: 'accent' | 'amber' | 'green' | 'rose' | 'sky' | 'violet';
|
|
155
|
+
/** Any see-through CSS colour instead of a tone. */
|
|
156
|
+
color?: string;
|
|
157
|
+
/** When it scrolls into view, straight away, or only through `active` ('view'). */
|
|
158
|
+
trigger?: 'view' | 'now' | 'manual';
|
|
159
|
+
/** 'view': how much of the element must be on screen, 0–1 (0.6). */
|
|
160
|
+
threshold?: number;
|
|
161
|
+
/** 'view': false draws again every time it comes back (true). */
|
|
162
|
+
once?: boolean;
|
|
163
|
+
/** Seconds one stroke takes (0.8). */
|
|
164
|
+
duration?: number;
|
|
165
|
+
/** Seconds between strokes (0.35). */
|
|
166
|
+
stagger?: number;
|
|
167
|
+
/** Seconds before the first stroke (0). */
|
|
168
|
+
delay?: number;
|
|
169
|
+
/** GSAP ease ('power2.inOut'). */
|
|
170
|
+
ease?: string;
|
|
171
|
+
/** Draw the strokes now (true) or clear them (false); with trigger 'manual'. */
|
|
172
|
+
active?: boolean;
|
|
173
|
+
}
|
|
174
|
+
/** <Highlighter>Helmets are <mark>free</mark></Highlighter> — marker strokes behind the <mark> words (default element p). */
|
|
175
|
+
export const Highlighter: GeckoComponent<EnhancerProps<HighlighterOptions>, DefaultSlot>;
|
|
176
|
+
|
|
177
|
+
/* ---------------- ScrollReveal ---------------- */
|
|
178
|
+
|
|
179
|
+
/** An element, a template ref to one, a component (its element is used) or a selector. */
|
|
180
|
+
export type ElementLike = Element | string | Ref<Element | null | undefined> | { $el: Element } | null | undefined;
|
|
181
|
+
|
|
182
|
+
export interface ScrollRevealOptions {
|
|
183
|
+
/** How it arrives ('rise'). */
|
|
184
|
+
effect?: 'fade' | 'rise' | 'slide' | 'zoom' | 'blur';
|
|
185
|
+
/** Split each target into words that arrive one after another. */
|
|
186
|
+
words?: boolean;
|
|
187
|
+
/** px to rise from (28). */
|
|
188
|
+
y?: number;
|
|
189
|
+
/** px to slide from; below 0 = from the left (-32). */
|
|
190
|
+
x?: number;
|
|
191
|
+
/** 'zoom' start size (0.94). */
|
|
192
|
+
scale?: number;
|
|
193
|
+
/** 'blur' start blur in px (10). */
|
|
194
|
+
blur?: number;
|
|
195
|
+
/** Seconds per block (0.8) or per word (0.7). */
|
|
196
|
+
duration?: number;
|
|
197
|
+
/** Seconds between blocks that enter together (0.08). */
|
|
198
|
+
stagger?: number;
|
|
199
|
+
/** Seconds between words (0.04). */
|
|
200
|
+
wordStagger?: number;
|
|
201
|
+
/** Seconds before it starts (0). */
|
|
202
|
+
delay?: number;
|
|
203
|
+
/** GSAP ease ('expo.out' for blocks, 'power3.out' for words). */
|
|
204
|
+
ease?: string;
|
|
205
|
+
/** false: hide again on leaving, play every time (true). */
|
|
206
|
+
once?: boolean;
|
|
207
|
+
/** How much of a block must be visible before it plays, 0–1 (0.2). */
|
|
208
|
+
threshold?: number;
|
|
209
|
+
/** IntersectionObserver rootMargin ('0px 0px -6% 0px'). */
|
|
210
|
+
rootMargin?: string;
|
|
211
|
+
/** The scrolling box (default the page). */
|
|
212
|
+
root?: ElementLike;
|
|
213
|
+
/** A block was revealed. */
|
|
214
|
+
onEnter?: (el: Element) => void;
|
|
215
|
+
/** A block was hidden again (once: false). */
|
|
216
|
+
onLeave?: (el: Element) => void;
|
|
217
|
+
}
|
|
218
|
+
export interface ScrollRevealProps extends ScrollRevealOptions {
|
|
219
|
+
/** Element to render ('div'). */
|
|
220
|
+
as?: string;
|
|
221
|
+
/** A selector inside: reveal each match instead of the element itself (':scope > article'). */
|
|
222
|
+
items?: string;
|
|
223
|
+
}
|
|
224
|
+
/** <ScrollReveal effect="rise">…</ScrollReveal> — arrives when it scrolls into view. */
|
|
225
|
+
export const ScrollReveal: GeckoComponent<ScrollRevealProps, DefaultSlot>;
|
|
226
|
+
|
|
227
|
+
/* ---------------- BlurIn ---------------- */
|
|
228
|
+
|
|
229
|
+
export interface BlurInProps {
|
|
230
|
+
/** Element to render ('p'). */
|
|
231
|
+
as?: string;
|
|
232
|
+
/** Start blur in px (10). */
|
|
233
|
+
blur?: number;
|
|
234
|
+
/** Start offset of each word, percent of a line (25). */
|
|
235
|
+
y?: number;
|
|
236
|
+
/** Seconds per word (0.7). */
|
|
237
|
+
duration?: number;
|
|
238
|
+
/** Seconds between words (0.04). */
|
|
239
|
+
stagger?: number;
|
|
240
|
+
/** Seconds before the first word (0). */
|
|
241
|
+
delay?: number;
|
|
242
|
+
/** GSAP ease ('power3.out'). */
|
|
243
|
+
ease?: string;
|
|
244
|
+
}
|
|
245
|
+
/** <BlurIn>Slow mornings…</BlurIn> — the words come into focus one after another, right away. */
|
|
246
|
+
export const BlurIn: GeckoComponent<BlurInProps, DefaultSlot>;
|
|
247
|
+
|
|
248
|
+
/* ---------------- ScrollProgress ---------------- */
|
|
249
|
+
|
|
250
|
+
export interface ScrollProgressProps {
|
|
251
|
+
/** The scrolling box (default the page). */
|
|
252
|
+
root?: ElementLike;
|
|
253
|
+
/** How far it has been read, 0…1. */
|
|
254
|
+
onChange?: (progress: number) => void;
|
|
255
|
+
}
|
|
256
|
+
/** <ScrollProgress /> — a thin line that fills as the page (or root) is read. */
|
|
257
|
+
export const ScrollProgress: GeckoComponent<ScrollProgressProps>;
|
|
258
|
+
|
|
259
|
+
/* ---------------- Odometer ---------------- */
|
|
260
|
+
|
|
261
|
+
export interface OdometerProps extends AsProp {
|
|
262
|
+
/** The number (or a ready-made string). A new value rolls in place. */
|
|
263
|
+
value: number | string;
|
|
264
|
+
/** Intl.NumberFormat options, or a function that returns the text (default: grouped digits). */
|
|
265
|
+
format?: Intl.NumberFormatOptions | ((value: number) => string);
|
|
266
|
+
/** Locale for Intl (default: the browser's). */
|
|
267
|
+
locale?: string;
|
|
268
|
+
/** Seconds one column takes to roll (0.9). */
|
|
269
|
+
duration?: number;
|
|
270
|
+
/** Seconds between columns, from the right (0.06). */
|
|
271
|
+
stagger?: number;
|
|
272
|
+
/** 'auto': up when the number grows, down when it shrinks. */
|
|
273
|
+
direction?: 'auto' | 'up' | 'down';
|
|
274
|
+
/** GSAP ease ('back.out(1.15)'). */
|
|
275
|
+
ease?: string;
|
|
276
|
+
/** On mount, roll in from this value instead of just showing. */
|
|
277
|
+
from?: number | string;
|
|
278
|
+
}
|
|
279
|
+
/** <Odometer :value="1990" :format="{ style: 'currency', currency: 'THB' }" /> — digits roll like a meter. */
|
|
280
|
+
export const Odometer: GeckoComponent<OdometerProps>;
|
|
281
|
+
|
|
282
|
+
/* ---------------- CountUp ---------------- */
|
|
283
|
+
|
|
284
|
+
export interface CountUpProps extends AsProp {
|
|
285
|
+
/** The number. A new value counts from the number on screen. */
|
|
286
|
+
value: number;
|
|
287
|
+
/** Count from this on mount (0). */
|
|
288
|
+
from?: number;
|
|
289
|
+
/** Seconds the count takes (1.2). */
|
|
290
|
+
duration?: number;
|
|
291
|
+
/** Seconds before it starts on mount (0). */
|
|
292
|
+
delay?: number;
|
|
293
|
+
/** Text before the number ('฿'). */
|
|
294
|
+
prefix?: string;
|
|
295
|
+
/** Text after the number (' / 5'). */
|
|
296
|
+
suffix?: string;
|
|
297
|
+
/** Digits after the point (0). */
|
|
298
|
+
decimals?: number;
|
|
299
|
+
/** Locale for the grouping ('en-US'). */
|
|
300
|
+
locale?: string;
|
|
301
|
+
/** Your own text for a value (instead of prefix / suffix / decimals). */
|
|
302
|
+
format?: (value: number) => string;
|
|
303
|
+
/** Tint green going up, red going down, when the value changes. */
|
|
304
|
+
tick?: boolean;
|
|
305
|
+
}
|
|
306
|
+
/** <CountUp :value="48250" prefix="฿" /> — the number counts up (num() + count()). */
|
|
307
|
+
export const CountUp: GeckoComponent<CountUpProps>;
|
|
308
|
+
|
|
309
|
+
export {};
|