@opencode/ui 0.0.0-dev-21920 → 0.0.0-dev-44
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode/ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,233 +35,234 @@
|
|
|
35
35
|
"exports": {
|
|
36
36
|
"./package.json": "./package.json",
|
|
37
37
|
"./accordion": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"import": "./src/data-display/accordion/accordion.tsx",
|
|
39
|
+
"types": "./dist/data-display/accordion/accordion.d.ts"
|
|
40
40
|
},
|
|
41
41
|
"./activity-ring": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
42
|
+
"import": "./src/feedback/activity-ring/activity-ring.tsx",
|
|
43
|
+
"types": "./dist/feedback/activity-ring/activity-ring.d.ts"
|
|
44
44
|
},
|
|
45
45
|
"./avatar": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"import": "./src/data-display/avatar/avatar.tsx",
|
|
47
|
+
"types": "./dist/data-display/avatar/avatar.d.ts"
|
|
48
48
|
},
|
|
49
49
|
"./badge": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"import": "./src/data-display/badge/badge.tsx",
|
|
51
|
+
"types": "./dist/data-display/badge/badge.d.ts"
|
|
52
52
|
},
|
|
53
53
|
"./button": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
54
|
+
"import": "./src/actions/button/button.tsx",
|
|
55
|
+
"types": "./dist/actions/button/button.d.ts"
|
|
56
56
|
},
|
|
57
57
|
"./button.css": "./src/actions/button/button.css",
|
|
58
58
|
"./checkbox": {
|
|
59
|
-
"
|
|
60
|
-
"
|
|
59
|
+
"import": "./src/forms/checkbox/checkbox.tsx",
|
|
60
|
+
"types": "./dist/forms/checkbox/checkbox.d.ts"
|
|
61
61
|
},
|
|
62
62
|
"./dialog": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"import": "./src/overlays/dialog/dialog.tsx",
|
|
64
|
+
"types": "./dist/overlays/dialog/dialog.d.ts"
|
|
65
65
|
},
|
|
66
66
|
"./diff-changes": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
67
|
+
"import": "./src/data-display/diff-changes/diff-changes.tsx",
|
|
68
|
+
"types": "./dist/data-display/diff-changes/diff-changes.d.ts"
|
|
69
69
|
},
|
|
70
70
|
"./divider": {
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"import": "./src/layout/divider/divider.tsx",
|
|
72
|
+
"types": "./dist/layout/divider/divider.d.ts"
|
|
73
73
|
},
|
|
74
74
|
"./field": {
|
|
75
|
-
"
|
|
76
|
-
"
|
|
75
|
+
"import": "./src/forms/field/field.tsx",
|
|
76
|
+
"types": "./dist/forms/field/field.d.ts"
|
|
77
77
|
},
|
|
78
78
|
"./file-tree.css": "./src/styles/file-tree.css",
|
|
79
79
|
"./icon": {
|
|
80
|
-
"
|
|
81
|
-
"
|
|
80
|
+
"import": "./src/icons/icon/icon.tsx",
|
|
81
|
+
"types": "./dist/icons/icon/icon.d.ts"
|
|
82
82
|
},
|
|
83
83
|
"./icons/catalog": {
|
|
84
|
-
"
|
|
85
|
-
"
|
|
84
|
+
"import": "./src/icons/catalog.ts",
|
|
85
|
+
"types": "./dist/icons/catalog.d.ts"
|
|
86
86
|
},
|
|
87
87
|
"./icon-button": {
|
|
88
|
-
"
|
|
89
|
-
"
|
|
88
|
+
"import": "./src/actions/icon-button/icon-button.tsx",
|
|
89
|
+
"types": "./dist/actions/icon-button/icon-button.d.ts"
|
|
90
90
|
},
|
|
91
91
|
"./inline-input": {
|
|
92
|
-
"
|
|
93
|
-
"
|
|
92
|
+
"import": "./src/forms/inline-input/inline-input.tsx",
|
|
93
|
+
"types": "./dist/forms/inline-input/inline-input.d.ts"
|
|
94
94
|
},
|
|
95
95
|
"./keybind": {
|
|
96
|
-
"
|
|
97
|
-
"
|
|
96
|
+
"import": "./src/data-display/keybind/keybind.tsx",
|
|
97
|
+
"types": "./dist/data-display/keybind/keybind.d.ts"
|
|
98
98
|
},
|
|
99
99
|
"./line-comment": {
|
|
100
|
-
"
|
|
101
|
-
"
|
|
100
|
+
"import": "./src/data-display/line-comment/line-comment.tsx",
|
|
101
|
+
"types": "./dist/data-display/line-comment/line-comment.d.ts"
|
|
102
102
|
},
|
|
103
103
|
"./loader": {
|
|
104
|
-
"
|
|
105
|
-
"
|
|
104
|
+
"import": "./src/feedback/loader/loader.tsx",
|
|
105
|
+
"types": "./dist/feedback/loader/loader.d.ts"
|
|
106
106
|
},
|
|
107
107
|
"./menu": {
|
|
108
|
-
"
|
|
109
|
-
"
|
|
108
|
+
"import": "./src/navigation/menu/menu.tsx",
|
|
109
|
+
"types": "./dist/navigation/menu/menu.d.ts"
|
|
110
110
|
},
|
|
111
111
|
"./motion": {
|
|
112
|
-
"
|
|
113
|
-
"
|
|
112
|
+
"import": "./src/motion/index.ts",
|
|
113
|
+
"types": "./dist/motion/index.d.ts"
|
|
114
114
|
},
|
|
115
115
|
"./motion/solid": {
|
|
116
|
-
"
|
|
117
|
-
"
|
|
116
|
+
"import": "./src/motion/solid.ts",
|
|
117
|
+
"types": "./dist/motion/solid.d.ts"
|
|
118
118
|
},
|
|
119
119
|
"./motion-tuning": {
|
|
120
|
-
"
|
|
121
|
-
"
|
|
120
|
+
"import": "./src/motion-tuning.ts",
|
|
121
|
+
"types": "./dist/motion-tuning.d.ts"
|
|
122
122
|
},
|
|
123
123
|
"./motion-tuning-features": {
|
|
124
|
-
"
|
|
125
|
-
"
|
|
124
|
+
"import": "./src/motion-tuning-features.ts",
|
|
125
|
+
"types": "./dist/motion-tuning-features.d.ts"
|
|
126
126
|
},
|
|
127
127
|
"./motion-tuning-fields": {
|
|
128
|
-
"
|
|
129
|
-
"
|
|
128
|
+
"import": "./src/motion-tuning-fields.ts",
|
|
129
|
+
"types": "./dist/motion-tuning-fields.d.ts"
|
|
130
130
|
},
|
|
131
131
|
"./progress-circle": {
|
|
132
|
-
"
|
|
133
|
-
"
|
|
132
|
+
"import": "./src/feedback/progress-circle/progress-circle.tsx",
|
|
133
|
+
"types": "./dist/feedback/progress-circle/progress-circle.d.ts"
|
|
134
134
|
},
|
|
135
135
|
"./project-avatar": {
|
|
136
|
-
"
|
|
137
|
-
"
|
|
136
|
+
"import": "./src/data-display/project-avatar/project-avatar.tsx",
|
|
137
|
+
"types": "./dist/data-display/project-avatar/project-avatar.d.ts"
|
|
138
138
|
},
|
|
139
139
|
"./radio": {
|
|
140
|
-
"
|
|
141
|
-
"
|
|
140
|
+
"import": "./src/forms/radio/radio.tsx",
|
|
141
|
+
"types": "./dist/forms/radio/radio.d.ts"
|
|
142
142
|
},
|
|
143
143
|
"./search-list": {
|
|
144
|
-
"
|
|
145
|
-
"
|
|
144
|
+
"import": "./src/forms/search-list/search-list.tsx",
|
|
145
|
+
"types": "./dist/forms/search-list/search-list.d.ts"
|
|
146
146
|
},
|
|
147
147
|
"./segmented-control": {
|
|
148
|
-
"
|
|
149
|
-
"
|
|
148
|
+
"import": "./src/navigation/segmented-control/segmented-control.tsx",
|
|
149
|
+
"types": "./dist/navigation/segmented-control/segmented-control.d.ts"
|
|
150
150
|
},
|
|
151
151
|
"./select": {
|
|
152
|
-
"
|
|
153
|
-
"
|
|
152
|
+
"import": "./src/forms/select/select.tsx",
|
|
153
|
+
"types": "./dist/forms/select/select.d.ts"
|
|
154
154
|
},
|
|
155
155
|
"./split-button": {
|
|
156
|
-
"
|
|
157
|
-
"
|
|
156
|
+
"import": "./src/actions/split-button/split-button.tsx",
|
|
157
|
+
"types": "./dist/actions/split-button/split-button.d.ts"
|
|
158
158
|
},
|
|
159
159
|
"./switch": {
|
|
160
|
-
"
|
|
161
|
-
"
|
|
160
|
+
"import": "./src/forms/switch/switch.tsx",
|
|
161
|
+
"types": "./dist/forms/switch/switch.d.ts"
|
|
162
162
|
},
|
|
163
163
|
"./tab-state-indicator": {
|
|
164
|
-
"
|
|
165
|
-
"
|
|
164
|
+
"import": "./src/navigation/tab-state-indicator.tsx",
|
|
165
|
+
"types": "./dist/navigation/tab-state-indicator.d.ts"
|
|
166
166
|
},
|
|
167
167
|
"./tabs": {
|
|
168
|
-
"
|
|
169
|
-
"
|
|
168
|
+
"import": "./src/navigation/tabs/tabs.tsx",
|
|
169
|
+
"types": "./dist/navigation/tabs/tabs.d.ts"
|
|
170
170
|
},
|
|
171
171
|
"./text-input": {
|
|
172
|
-
"
|
|
173
|
-
"
|
|
172
|
+
"import": "./src/forms/text-input/text-input.tsx",
|
|
173
|
+
"types": "./dist/forms/text-input/text-input.d.ts"
|
|
174
174
|
},
|
|
175
175
|
"./text-input.css": "./src/forms/text-input/text-input.css",
|
|
176
176
|
"./textarea": {
|
|
177
|
-
"
|
|
178
|
-
"
|
|
177
|
+
"import": "./src/forms/textarea/textarea.tsx",
|
|
178
|
+
"types": "./dist/forms/textarea/textarea.d.ts"
|
|
179
179
|
},
|
|
180
180
|
"./typeahead": {
|
|
181
|
-
"
|
|
182
|
-
"
|
|
181
|
+
"import": "./src/forms/typeahead/typeahead.tsx",
|
|
182
|
+
"types": "./dist/forms/typeahead/typeahead.d.ts"
|
|
183
183
|
},
|
|
184
184
|
"./slash": {
|
|
185
|
-
"
|
|
186
|
-
"
|
|
185
|
+
"import": "./src/typography/slash/slash.tsx",
|
|
186
|
+
"types": "./dist/typography/slash/slash.d.ts"
|
|
187
187
|
},
|
|
188
188
|
"./text-shimmer": {
|
|
189
|
-
"
|
|
190
|
-
"
|
|
189
|
+
"import": "./src/typography/text-shimmer/text-shimmer.tsx",
|
|
190
|
+
"types": "./dist/typography/text-shimmer/text-shimmer.d.ts"
|
|
191
191
|
},
|
|
192
192
|
"./toast": {
|
|
193
|
-
"
|
|
194
|
-
"
|
|
193
|
+
"import": "./src/feedback/toast/toast.tsx",
|
|
194
|
+
"types": "./dist/feedback/toast/toast.d.ts"
|
|
195
195
|
},
|
|
196
196
|
"./tooltip": {
|
|
197
|
-
"
|
|
198
|
-
"
|
|
197
|
+
"import": "./src/overlays/tooltip/tooltip.tsx",
|
|
198
|
+
"types": "./dist/overlays/tooltip/tooltip.d.ts"
|
|
199
199
|
},
|
|
200
200
|
"./wordmark": {
|
|
201
|
-
"
|
|
202
|
-
"
|
|
201
|
+
"import": "./src/typography/wordmark/wordmark.tsx",
|
|
202
|
+
"types": "./dist/typography/wordmark/wordmark.d.ts"
|
|
203
203
|
},
|
|
204
204
|
"./*": {
|
|
205
|
-
"
|
|
206
|
-
"
|
|
205
|
+
"import": "./src/components/*.tsx",
|
|
206
|
+
"types": "./dist/components/*.d.ts"
|
|
207
207
|
},
|
|
208
208
|
"./i18n/*": {
|
|
209
|
-
"
|
|
210
|
-
"
|
|
209
|
+
"import": "./src/i18n/*.ts",
|
|
210
|
+
"types": "./dist/i18n/*.d.ts"
|
|
211
211
|
},
|
|
212
212
|
"./hooks": {
|
|
213
|
-
"
|
|
214
|
-
"
|
|
213
|
+
"import": "./src/hooks/index.ts",
|
|
214
|
+
"types": "./dist/hooks/index.d.ts"
|
|
215
215
|
},
|
|
216
216
|
"./context": {
|
|
217
|
-
"
|
|
218
|
-
"
|
|
217
|
+
"import": "./src/context/index.ts",
|
|
218
|
+
"types": "./dist/context/index.d.ts"
|
|
219
219
|
},
|
|
220
220
|
"./context/*": {
|
|
221
|
-
"
|
|
222
|
-
"
|
|
221
|
+
"import": "./src/context/*.tsx",
|
|
222
|
+
"types": "./dist/context/*.d.ts"
|
|
223
223
|
},
|
|
224
224
|
"./storybook/scaffold": {
|
|
225
|
-
"
|
|
226
|
-
"
|
|
225
|
+
"import": "./src/storybook/scaffold.tsx",
|
|
226
|
+
"types": "./dist/storybook/scaffold.d.ts"
|
|
227
227
|
},
|
|
228
228
|
"./storybook/fixtures": {
|
|
229
|
-
"
|
|
230
|
-
"
|
|
229
|
+
"import": "./src/storybook/fixtures.ts",
|
|
230
|
+
"types": "./dist/storybook/fixtures.d.ts"
|
|
231
231
|
},
|
|
232
232
|
"./styles": "./src/styles/index.css",
|
|
233
233
|
"./styles/tokens": "./src/styles/tokens/index.css",
|
|
234
234
|
"./styles/tokens/*": "./src/styles/tokens/*",
|
|
235
235
|
"./styles/tailwind": "./src/styles/tailwind/index.css",
|
|
236
236
|
"./theme": {
|
|
237
|
-
"
|
|
238
|
-
"
|
|
237
|
+
"import": "./src/theme/index.ts",
|
|
238
|
+
"types": "./dist/theme/index.d.ts"
|
|
239
239
|
},
|
|
240
240
|
"./theme/*": {
|
|
241
|
-
"
|
|
242
|
-
"
|
|
241
|
+
"import": "./src/theme/*.ts",
|
|
242
|
+
"types": "./dist/theme/*.d.ts"
|
|
243
243
|
},
|
|
244
244
|
"./theme/context": {
|
|
245
|
-
"
|
|
246
|
-
"
|
|
245
|
+
"import": "./src/theme/context.tsx",
|
|
246
|
+
"types": "./dist/theme/context.d.ts"
|
|
247
247
|
},
|
|
248
248
|
"./icons/provider": {
|
|
249
|
-
"
|
|
250
|
-
"
|
|
249
|
+
"import": "./src/components/provider-icons/types.ts",
|
|
250
|
+
"types": "./dist/components/provider-icons/types.d.ts"
|
|
251
251
|
},
|
|
252
252
|
"./icons/file-type": {
|
|
253
|
-
"
|
|
254
|
-
"
|
|
253
|
+
"import": "./src/components/file-icons/types.ts",
|
|
254
|
+
"types": "./dist/components/file-icons/types.d.ts"
|
|
255
255
|
},
|
|
256
256
|
"./icons/app": {
|
|
257
|
-
"
|
|
258
|
-
"
|
|
257
|
+
"import": "./src/components/app-icons/types.ts",
|
|
258
|
+
"types": "./dist/components/app-icons/types.d.ts"
|
|
259
259
|
},
|
|
260
260
|
"./fonts/*": "./src/assets/fonts/*",
|
|
261
261
|
"./audio/*": "./src/assets/audio/*"
|
|
262
262
|
},
|
|
263
263
|
"scripts": {
|
|
264
264
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
265
|
+
"pack": "bun run script/pack.ts",
|
|
265
266
|
"typecheck": "bun check --no-script",
|
|
266
267
|
"typecheck:tsc": "tsc --noEmit",
|
|
267
268
|
"test": "bun test src --only-failures",
|
|
@@ -285,7 +286,7 @@
|
|
|
285
286
|
"dependencies": {
|
|
286
287
|
"@kitlangton/solid-motion": "0.2.2",
|
|
287
288
|
"@kobalte/core": "0.13.13",
|
|
288
|
-
"@opencode/util": "0.0.0-dev-
|
|
289
|
+
"@opencode/util": "0.0.0-dev-44",
|
|
289
290
|
"@pierre/diffs": "1.6.1",
|
|
290
291
|
"@pierre/highlights": "0.2.0",
|
|
291
292
|
"@solid-primitives/event-listener": "2.4.6",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[data-component="rolling-number"] {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
/* Digits keep numeric order in RTL documents. */
|
|
4
|
+
direction: ltr;
|
|
5
|
+
unicode-bidi: isolate;
|
|
6
|
+
font-variant-numeric: tabular-nums;
|
|
7
|
+
|
|
8
|
+
[data-slot="rolling-number-digit"] {
|
|
9
|
+
display: inline-grid;
|
|
10
|
+
overflow-y: clip;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[data-slot="rolling-number-glyph"] {
|
|
14
|
+
grid-area: 1 / 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-slot="rolling-number-glyph"][data-leaving] {
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { For, createEffect, createMemo, on, onCleanup } from "solid-js"
|
|
2
|
+
import { frameLoop, prefersReducedMotion, Spring, type DurationOptions } from "../motion"
|
|
3
|
+
|
|
4
|
+
const settle: DurationOptions = { duration: 0.375, bounce: 0 }
|
|
5
|
+
|
|
6
|
+
// A whole number whose changed digits roll: up when it grows, down when it shrinks. Each digit rolls inside its own
|
|
7
|
+
// box on a bounce-free spring, by transform and opacity only, and swaps at once under reduced motion. Digits are
|
|
8
|
+
// tabular, so the width holds while they roll.
|
|
9
|
+
export function RollingNumber(props: { value: number; spring?: DurationOptions; class?: string }) {
|
|
10
|
+
const shown = createMemo<{ text: string; dir: number }>(
|
|
11
|
+
(last) => {
|
|
12
|
+
const value = Number.isFinite(props.value) ? Math.max(0, Math.round(props.value)) : 0
|
|
13
|
+
|
|
14
|
+
return { text: String(value), dir: value < Number(last.text) ? -1 : 1 }
|
|
15
|
+
},
|
|
16
|
+
{ text: "", dir: 1 },
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
// Place values, most significant first, so each place keeps its digit box as digits appear and leave.
|
|
20
|
+
const places = createMemo(() =>
|
|
21
|
+
Array.from({ length: shown().text.length }, (_, index) => shown().text.length - 1 - index),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<span data-component="rolling-number" class={props.class}>
|
|
26
|
+
<For each={places()}>
|
|
27
|
+
{(place) => (
|
|
28
|
+
<Digit
|
|
29
|
+
digit={shown().text[shown().text.length - 1 - place] ?? ""}
|
|
30
|
+
dir={shown().dir}
|
|
31
|
+
spring={props.spring ?? settle}
|
|
32
|
+
/>
|
|
33
|
+
)}
|
|
34
|
+
</For>
|
|
35
|
+
</span>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function Digit(props: { digit: string; dir: number; spring: DurationOptions }) {
|
|
40
|
+
let incoming: HTMLSpanElement | undefined
|
|
41
|
+
let outgoing: HTMLSpanElement | undefined
|
|
42
|
+
let spring: Spring | undefined
|
|
43
|
+
let stop: VoidFunction | undefined
|
|
44
|
+
// Offsets in digit heights, down positive: the new digit enters from `enter`, the old one leaves from `from` to `to`.
|
|
45
|
+
let enter = 0
|
|
46
|
+
let from = 0
|
|
47
|
+
let to = 0
|
|
48
|
+
|
|
49
|
+
const paint = () => {
|
|
50
|
+
const p = spring ? Math.max(0, Math.min(1, spring.value)) : 1
|
|
51
|
+
roll(incoming, enter * (1 - p))
|
|
52
|
+
roll(outgoing, from + (to - from) * p)
|
|
53
|
+
|
|
54
|
+
if (!spring && outgoing) outgoing.textContent = ""
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const tick = (dt: number) => {
|
|
58
|
+
spring?.step(dt)
|
|
59
|
+
|
|
60
|
+
if (spring?.resting) spring = undefined
|
|
61
|
+
paint()
|
|
62
|
+
|
|
63
|
+
if (spring) return true
|
|
64
|
+
stop = undefined
|
|
65
|
+
|
|
66
|
+
return false
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let last = props.digit
|
|
70
|
+
|
|
71
|
+
createEffect(
|
|
72
|
+
on(
|
|
73
|
+
() => props.digit,
|
|
74
|
+
(next) => {
|
|
75
|
+
const prev = last
|
|
76
|
+
last = next
|
|
77
|
+
|
|
78
|
+
if (!incoming || !outgoing || next === prev) return
|
|
79
|
+
incoming.textContent = next
|
|
80
|
+
|
|
81
|
+
if (prefersReducedMotion() || !incoming.isConnected) {
|
|
82
|
+
spring = undefined
|
|
83
|
+
paint()
|
|
84
|
+
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// A change mid-roll sends the digit on screen out from where it is.
|
|
89
|
+
from = enter * (1 - (spring ? Math.max(0, Math.min(1, spring.value)) : 1))
|
|
90
|
+
to = -props.dir
|
|
91
|
+
enter = props.dir
|
|
92
|
+
outgoing.textContent = prev
|
|
93
|
+
spring = Spring.fromDuration(0, props.spring).set(1)
|
|
94
|
+
paint()
|
|
95
|
+
stop ??= frameLoop.add(tick)
|
|
96
|
+
},
|
|
97
|
+
{ defer: true },
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
onCleanup(() => stop?.())
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<span data-slot="rolling-number-digit">
|
|
105
|
+
<span
|
|
106
|
+
data-slot="rolling-number-glyph"
|
|
107
|
+
ref={(el) => {
|
|
108
|
+
incoming = el
|
|
109
|
+
el.textContent = props.digit
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
<span data-slot="rolling-number-glyph" data-leaving="" aria-hidden="true" ref={(el) => (outgoing = el)} />
|
|
113
|
+
</span>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function roll(el: HTMLElement | undefined, offset: number) {
|
|
118
|
+
if (!el) return
|
|
119
|
+
const still = Math.abs(offset) < 0.001
|
|
120
|
+
el.style.transform = still ? "" : `translate3d(0,${(offset * 100).toFixed(2)}%,0)`
|
|
121
|
+
el.style.opacity = still ? "" : (1 - Math.min(1, Math.abs(offset))).toFixed(4)
|
|
122
|
+
}
|
package/src/styles/index.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
@import "../data-display/accordion/accordion.css" layer(components);
|
|
11
11
|
@import "../components/animated-number.css" layer(components);
|
|
12
|
+
@import "../components/rolling-number.css" layer(components);
|
|
12
13
|
@import "../components/app-icon.css" layer(components);
|
|
13
14
|
@import "../components/card.css" layer(components);
|
|
14
15
|
@import "../forms/checkbox/checkbox.css" layer(components);
|