@pathscale/ui 1.2.10 → 1.2.11
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 +22 -22
- package/README.md +59 -59
- package/dist/components/accordion/Accordion.css +158 -158
- package/dist/components/alert/Alert.css +116 -116
- package/dist/components/avatar/Avatar.css +124 -124
- package/dist/components/badge/Badge.css +164 -164
- package/dist/components/breadcrumbs/Breadcrumbs.css +63 -63
- package/dist/components/button/Button.css +194 -194
- package/dist/components/button-group/ButtonGroup.css +117 -117
- package/dist/components/calendar/Calendar.css +258 -258
- package/dist/components/card/Card.css +110 -110
- package/dist/components/chatbubble/ChatBubble.css +164 -164
- package/dist/components/checkbox/Checkbox.css +183 -183
- package/dist/components/checkbox-group/CheckboxGroup.css +10 -10
- package/dist/components/chip/Chip.css +197 -197
- package/dist/components/close-button/CloseButton.css +81 -81
- package/dist/components/color-area/ColorArea.css +54 -54
- package/dist/components/color-field/ColorField.css +88 -88
- package/dist/components/color-picker/ColorPicker.css +28 -28
- package/dist/components/color-slider/ColorSlider.css +57 -57
- package/dist/components/color-swatch/ColorSwatch.css +84 -84
- package/dist/components/color-swatch-picker/ColorSwatchPicker.css +12 -12
- package/dist/components/color-wheel-flower/ColorWheelFlower.css +147 -147
- package/dist/components/combo-box/ComboBox.css +344 -344
- package/dist/components/date-field/DateField.css +215 -215
- package/dist/components/date-picker/DatePicker.css +143 -143
- package/dist/components/date-range-picker/DateRangePicker.css +149 -149
- package/dist/components/description/Description.css +10 -10
- package/dist/components/disclosure/Disclosure.css +84 -84
- package/dist/components/disclosure-group/DisclosureGroup.css +9 -9
- package/dist/components/drawer/Drawer.css +463 -463
- package/dist/components/dropdown/Dropdown.css +211 -211
- package/dist/components/empty-state/EmptyState.css +39 -39
- package/dist/components/error-message/ErrorMessage.css +20 -20
- package/dist/components/field-error/FieldError.css +27 -27
- package/dist/components/fieldset/Fieldset.css +30 -30
- package/dist/components/flex/Flex.css +5 -5
- package/dist/components/floating-dock/FloatingDock.css +208 -208
- package/dist/components/footer/footer.css +51 -51
- package/dist/components/form/Form.css +5 -5
- package/dist/components/glass-panel/GlassPanel.css +359 -359
- package/dist/components/glow-card/GlowCard.css +100 -100
- package/dist/components/grid/Grid.css +5 -5
- package/dist/components/header/Header.css +13 -13
- package/dist/components/icon/Icon.css +10 -10
- package/dist/components/immersive-landing/ImmersiveLanding.css +565 -565
- package/dist/components/input/Input.css +155 -155
- package/dist/components/input-group/InputGroup.css +172 -172
- package/dist/components/input-otp/InputOTP.css +170 -170
- package/dist/components/kbd/Kbd.css +60 -60
- package/dist/components/label/Label.css +30 -30
- package/dist/components/language-switcher/LanguageSwitcher.css +56 -56
- package/dist/components/link/Link.css +131 -131
- package/dist/components/list-box/ListBox.css +148 -148
- package/dist/components/live-chat/LiveChat.css +324 -324
- package/dist/components/menu/Menu.css +199 -199
- package/dist/components/metal-border/MetalBorder.classes.d.ts +26 -0
- package/dist/components/metal-border/MetalBorder.classes.js +27 -0
- package/dist/components/metal-border/MetalBorder.css +40 -0
- package/dist/components/metal-border/MetalBorder.d.ts +20 -0
- package/dist/components/metal-border/MetalBorder.js +322 -0
- package/dist/components/metal-border/engine/color.d.ts +4 -0
- package/dist/components/metal-border/engine/color.js +69 -0
- package/dist/components/metal-border/engine/glow/geometry.d.ts +35 -0
- package/dist/components/metal-border/engine/glow/geometry.js +176 -0
- package/dist/components/metal-border/engine/glow/glow.d.ts +38 -0
- package/dist/components/metal-border/engine/glow/glow.js +246 -0
- package/dist/components/metal-border/engine/index.d.ts +4 -0
- package/dist/components/metal-border/engine/index.js +2 -0
- package/dist/components/metal-border/engine/perfConfig.d.ts +9 -0
- package/dist/components/metal-border/engine/perfConfig.js +10 -0
- package/dist/components/metal-border/engine/presets.d.ts +57 -0
- package/dist/components/metal-border/engine/presets.js +214 -0
- package/dist/components/metal-border/engine/renderer/core.d.ts +69 -0
- package/dist/components/metal-border/engine/renderer/core.js +156 -0
- package/dist/components/metal-border/engine/renderer/loop.d.ts +30 -0
- package/dist/components/metal-border/engine/renderer/loop.js +248 -0
- package/dist/components/metal-border/engine/renderer/sampling.d.ts +14 -0
- package/dist/components/metal-border/engine/renderer/sampling.js +145 -0
- package/dist/components/metal-border/engine/shaders.d.ts +36 -0
- package/dist/components/metal-border/engine/shaders.js +215 -0
- package/dist/components/metal-border/engine/tween.d.ts +17 -0
- package/dist/components/metal-border/engine/tween.js +28 -0
- package/dist/components/metal-border/index.d.ts +2 -0
- package/dist/components/metal-border/index.js +1 -0
- package/dist/components/meter/Meter.css +89 -89
- package/dist/components/modal/Modal.css +320 -320
- package/dist/components/navbar/Navbar.css +110 -110
- package/dist/components/noise-background/NoiseBackground.css +66 -66
- package/dist/components/number-field/NumberField.css +198 -198
- package/dist/components/pagination/Pagination.css +121 -121
- package/dist/components/popover/Popover.css +117 -117
- package/dist/components/progress-bar/ProgressBar.css +104 -104
- package/dist/components/progress-circle/ProgressCircle.css +82 -82
- package/dist/components/radio/Radio.css +129 -129
- package/dist/components/radio-group/RadioGroup.css +58 -58
- package/dist/components/range-calendar/RangeCalendar.css +51 -51
- package/dist/components/scroll-shadow/ScrollShadow.css +93 -93
- package/dist/components/search-field/SearchField.css +183 -183
- package/dist/components/select/Select.css +284 -284
- package/dist/components/separator/Separator.css +35 -35
- package/dist/components/skeleton/Skeleton.css +95 -95
- package/dist/components/slider/Slider.css +122 -122
- package/dist/components/spinner/Spinner.css +131 -131
- package/dist/components/surface/Surface.css +37 -37
- package/dist/components/table/Table.css +426 -426
- package/dist/components/tabs/Tabs.css +203 -203
- package/dist/components/tag/Tag.css +121 -121
- package/dist/components/tag-group/TagGroup.css +22 -22
- package/dist/components/text/Text.css +66 -66
- package/dist/components/text-area/TextArea.css +95 -95
- package/dist/components/text-field/TextField.css +33 -33
- package/dist/components/time-field/TimeField.css +215 -215
- package/dist/components/toast/Toast.css +344 -344
- package/dist/components/toggle/Toggle.css +237 -237
- package/dist/components/toolbar/Toolbar.css +55 -55
- package/dist/components/tooltip/Tooltip.css +153 -153
- package/dist/index.css +74 -74
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/purge-manifest.json +15100 -14847
- package/dist/styles/base/index.css +43 -43
- package/dist/styles/themes/dark.css +141 -141
- package/dist/styles/themes/light.css +143 -143
- package/package.json +2 -2
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
const VERT_SHADER_SRC = `
|
|
2
|
+
attribute vec2 a_position;
|
|
3
|
+
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
|
|
4
|
+
`;
|
|
5
|
+
const FRAG_SHADER_SRC = `
|
|
6
|
+
precision highp float;
|
|
7
|
+
|
|
8
|
+
uniform vec2 u_resolution;
|
|
9
|
+
uniform float u_time;
|
|
10
|
+
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
|
|
11
|
+
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
|
|
12
|
+
uniform float u_intensity, u_scale, u_direction;
|
|
13
|
+
uniform float u_softness, u_distortion, u_complexity, u_shape;
|
|
14
|
+
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
|
|
15
|
+
|
|
16
|
+
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
17
|
+
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
18
|
+
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
|
|
19
|
+
|
|
20
|
+
float snoise(vec2 v) {
|
|
21
|
+
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
22
|
+
-0.577350269189626, 0.024390243902439);
|
|
23
|
+
vec2 i = floor(v + dot(v, C.yy));
|
|
24
|
+
vec2 x0 = v - i + dot(i, C.xx);
|
|
25
|
+
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
26
|
+
vec4 x12 = x0.xyxy + C.xxzz;
|
|
27
|
+
x12.xy -= i1;
|
|
28
|
+
i = mod289v2(i);
|
|
29
|
+
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
|
|
30
|
+
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
|
|
31
|
+
m = m * m; m = m * m;
|
|
32
|
+
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
|
|
33
|
+
vec3 h = abs(x_) - 0.5;
|
|
34
|
+
vec3 ox = floor(x_ + 0.5);
|
|
35
|
+
vec3 a0 = x_ - ox;
|
|
36
|
+
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
|
|
37
|
+
vec3 g;
|
|
38
|
+
g.x = a0.x * x0.x + h.x * x0.y;
|
|
39
|
+
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
40
|
+
return 130.0 * dot(m, g);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
float fbm(vec2 p, float oct) {
|
|
44
|
+
float val = 0.0, amp = 0.5;
|
|
45
|
+
int n = int(oct);
|
|
46
|
+
for (int i = 0; i < 7; i++) {
|
|
47
|
+
if (i >= n) break;
|
|
48
|
+
val += amp * snoise(p);
|
|
49
|
+
p *= 2.0;
|
|
50
|
+
amp *= 0.5;
|
|
51
|
+
}
|
|
52
|
+
return val;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
|
|
56
|
+
|
|
57
|
+
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
|
|
58
|
+
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
|
|
59
|
+
vec3 palette(float t) {
|
|
60
|
+
t = clamp(t, 0.0, 1.0);
|
|
61
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
62
|
+
float k = 64.0;
|
|
63
|
+
float w1 = u_alpha1 * exp(-k * t * t);
|
|
64
|
+
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
|
|
65
|
+
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
|
|
66
|
+
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
|
|
67
|
+
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
|
|
68
|
+
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
|
|
69
|
+
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
|
|
70
|
+
u_color4 * w4 + u_color5 * w5) / total;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Per-pixel alpha that re-introduces transparency when the user dials any
|
|
74
|
+
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
|
|
75
|
+
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
|
|
76
|
+
* pixel — but mirroring it keeps custom-preset behaviour identical. */
|
|
77
|
+
float paletteAlpha(float t) {
|
|
78
|
+
t = clamp(t, 0.0, 1.0);
|
|
79
|
+
t = t * t * (3.0 - 2.0 * t);
|
|
80
|
+
float k = 64.0;
|
|
81
|
+
float w1 = u_alpha1 * exp(-k * t * t);
|
|
82
|
+
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
|
|
83
|
+
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
|
|
84
|
+
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
|
|
85
|
+
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
|
|
86
|
+
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
|
|
87
|
+
float rawW = exp(-k * t * t)
|
|
88
|
+
+ exp(-k * (t - 0.25) * (t - 0.25))
|
|
89
|
+
+ exp(-k * (t - 0.5) * (t - 0.5))
|
|
90
|
+
+ exp(-k * (t - 0.75) * (t - 0.75))
|
|
91
|
+
+ exp(-k * (t - 1.0) * (t - 1.0))
|
|
92
|
+
+ 0.0001;
|
|
93
|
+
return totalW / rawW;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
vec2 warp(vec2 p, float t) {
|
|
97
|
+
float str = u_distortion * 2.0;
|
|
98
|
+
return vec2(
|
|
99
|
+
nfbm(p + vec2(t * 0.1, 0.0)),
|
|
100
|
+
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
|
|
101
|
+
) * str;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Plasma: four sine bands warped by an FBM field, mapped through the
|
|
105
|
+
* 5-stop palette. Identical to effect 1 in the canonical engine. */
|
|
106
|
+
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
|
|
107
|
+
vec2 p = (uv - 0.5) * u_scale;
|
|
108
|
+
p.x *= aspect;
|
|
109
|
+
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
|
|
110
|
+
|
|
111
|
+
float freq = 3.0 + cpx * 8.0;
|
|
112
|
+
float val = 0.0;
|
|
113
|
+
val += sin(p.x * freq + t);
|
|
114
|
+
val += sin(p.y * freq + t * 1.3);
|
|
115
|
+
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
|
|
116
|
+
val += sin(length(p) * freq * 0.8 - t * 1.5);
|
|
117
|
+
vec2 w = warp(p, t);
|
|
118
|
+
val += (w.x + w.y) * dist;
|
|
119
|
+
val = val * 0.2 * u_intensity + 0.5;
|
|
120
|
+
|
|
121
|
+
return palette(clamp(val, 0.0, 1.0));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void main() {
|
|
125
|
+
vec2 uv = gl_FragCoord.xy / u_resolution;
|
|
126
|
+
float aspect = u_resolution.x / u_resolution.y;
|
|
127
|
+
float t = u_time; // JS already multiplied u_time by preset.speed.
|
|
128
|
+
float dist = u_distortion;
|
|
129
|
+
float cpx = u_complexity;
|
|
130
|
+
|
|
131
|
+
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
|
|
132
|
+
* presets all ship with blur=1 so this path is always active. 5 taps
|
|
133
|
+
* instead of the canonical engine's 9 saves ~44% fragment work; the
|
|
134
|
+
* perceptual difference is nil because the output is already soft from
|
|
135
|
+
* the plasma's low spatial frequency and CSS blur on reflections. */
|
|
136
|
+
vec3 col;
|
|
137
|
+
if (u_blur < 0.01) {
|
|
138
|
+
col = computeEffect(uv, aspect, t, dist, cpx);
|
|
139
|
+
} else {
|
|
140
|
+
float r = u_blur * 0.02;
|
|
141
|
+
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
|
|
142
|
+
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
|
|
143
|
+
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
|
|
144
|
+
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
|
|
145
|
+
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Gamma punch — adds the contrast pop that defines the chromatic
|
|
149
|
+
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
|
|
150
|
+
col = pow(col, vec3(1.3));
|
|
151
|
+
|
|
152
|
+
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
|
|
153
|
+
* scale at the bottom of the formula is hard-coded in the canonical
|
|
154
|
+
* engine; we keep it for visual parity. */
|
|
155
|
+
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
|
|
156
|
+
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
|
|
157
|
+
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
|
|
158
|
+
float vig = edgeDist * edgeDist / (vigRange * vigRange);
|
|
159
|
+
vig = smoothstep(0.0, 1.0, vig);
|
|
160
|
+
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
|
|
161
|
+
|
|
162
|
+
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
|
|
163
|
+
* computation matches the canonical engine so custom presets behave the
|
|
164
|
+
* same. */
|
|
165
|
+
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
|
|
166
|
+
if (colorAlpha < 0.999) {
|
|
167
|
+
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
|
|
168
|
+
c4d = col - u_color4, c5d = col - u_color5;
|
|
169
|
+
float prox1 = exp(-8.0 * dot(c1d, c1d));
|
|
170
|
+
float prox2 = exp(-8.0 * dot(c2d, c2d));
|
|
171
|
+
float prox3 = exp(-8.0 * dot(c3d, c3d));
|
|
172
|
+
float prox4 = exp(-8.0 * dot(c4d, c4d));
|
|
173
|
+
float prox5 = exp(-8.0 * dot(c5d, c5d));
|
|
174
|
+
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
|
|
175
|
+
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
|
|
176
|
+
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
|
|
177
|
+
}
|
|
178
|
+
float alpha = colorAlpha;
|
|
179
|
+
|
|
180
|
+
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
|
|
181
|
+
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
|
|
182
|
+
* live. The contribution is provably zero. */
|
|
183
|
+
alpha += 0.0 * (u_softness + u_shape +
|
|
184
|
+
u_alpha6 + u_alpha7 +
|
|
185
|
+
u_color6.x + u_color7.x);
|
|
186
|
+
|
|
187
|
+
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
|
|
188
|
+
}
|
|
189
|
+
`;
|
|
190
|
+
function compileShader(gl, type, source) {
|
|
191
|
+
const shader = gl.createShader(type);
|
|
192
|
+
if (!shader) throw new Error('metal-fx: gl.createShader returned null');
|
|
193
|
+
gl.shaderSource(shader, source);
|
|
194
|
+
gl.compileShader(shader);
|
|
195
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
196
|
+
const info = gl.getShaderInfoLog(shader);
|
|
197
|
+
gl.deleteShader(shader);
|
|
198
|
+
throw new Error(`metal-fx: shader compile failed: ${info ?? '(no info log)'}`);
|
|
199
|
+
}
|
|
200
|
+
return shader;
|
|
201
|
+
}
|
|
202
|
+
function linkProgram(gl, vert, frag) {
|
|
203
|
+
const program = gl.createProgram();
|
|
204
|
+
if (!program) throw new Error('metal-fx: gl.createProgram returned null');
|
|
205
|
+
gl.attachShader(program, vert);
|
|
206
|
+
gl.attachShader(program, frag);
|
|
207
|
+
gl.linkProgram(program);
|
|
208
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
209
|
+
const info = gl.getProgramInfoLog(program);
|
|
210
|
+
gl.deleteProgram(program);
|
|
211
|
+
throw new Error(`metal-fx: program link failed: ${info ?? '(no info log)'}`);
|
|
212
|
+
}
|
|
213
|
+
return program;
|
|
214
|
+
}
|
|
215
|
+
export { FRAG_SHADER_SRC, VERT_SHADER_SRC, compileShader, linkProgram };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type EaseFn = (t: number) => number;
|
|
2
|
+
export declare const ease: {
|
|
3
|
+
readonly linear: (t: number) => number;
|
|
4
|
+
readonly smoothstep: (t: number) => number;
|
|
5
|
+
};
|
|
6
|
+
export interface Tween {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
dur: number;
|
|
10
|
+
ease: EaseFn;
|
|
11
|
+
startMs: number;
|
|
12
|
+
val: number;
|
|
13
|
+
done: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function tween(from: number, to: number, dur: number, e?: EaseFn): Tween;
|
|
16
|
+
export declare function tweenStart(tw: Tween, nowMs: number): void;
|
|
17
|
+
export declare function tweenTick(tw: Tween, nowMs: number): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const ease = {
|
|
2
|
+
linear: (t)=>t,
|
|
3
|
+
smoothstep: (t)=>t * t * (3 - 2 * t)
|
|
4
|
+
};
|
|
5
|
+
function tween(from, to, dur, e = ease.linear) {
|
|
6
|
+
return {
|
|
7
|
+
from,
|
|
8
|
+
to,
|
|
9
|
+
dur,
|
|
10
|
+
ease: e,
|
|
11
|
+
startMs: -1,
|
|
12
|
+
val: from,
|
|
13
|
+
done: false
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function tweenStart(tw, nowMs) {
|
|
17
|
+
tw.startMs = nowMs;
|
|
18
|
+
tw.val = tw.from;
|
|
19
|
+
tw.done = false;
|
|
20
|
+
}
|
|
21
|
+
function tweenTick(tw, nowMs) {
|
|
22
|
+
if (tw.done || tw.startMs < 0) return tw.val;
|
|
23
|
+
const t = Math.min(1, (nowMs - tw.startMs) / tw.dur);
|
|
24
|
+
tw.val = tw.from + (tw.to - tw.from) * tw.ease(t);
|
|
25
|
+
if (t >= 1) tw.done = true;
|
|
26
|
+
return tw.val;
|
|
27
|
+
}
|
|
28
|
+
export { ease, tween, tweenStart, tweenTick };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MetalBorder } from "./MetalBorder.js";
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
@layer components {
|
|
2
|
-
.meter {
|
|
3
|
-
display: grid;
|
|
4
|
-
width: 100%;
|
|
5
|
-
gap: 0.25rem;
|
|
6
|
-
grid-template-areas:
|
|
7
|
-
"label output"
|
|
8
|
-
"track track";
|
|
9
|
-
grid-template-columns: 1fr auto;
|
|
10
|
-
|
|
11
|
-
--meter-fill: var(--color-accent);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.meter [data-slot="label"] {
|
|
15
|
-
grid-area: label;
|
|
16
|
-
width: fit-content;
|
|
17
|
-
font-size: 0.875rem;
|
|
18
|
-
line-height: 1.25rem;
|
|
19
|
-
font-weight: 500;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.meter__output {
|
|
23
|
-
grid-area: output;
|
|
24
|
-
font-size: 0.875rem;
|
|
25
|
-
line-height: 1.25rem;
|
|
26
|
-
font-weight: 500;
|
|
27
|
-
font-variant-numeric: tabular-nums;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.meter__track {
|
|
31
|
-
grid-area: track;
|
|
32
|
-
position: relative;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
border-radius: 9999px;
|
|
35
|
-
background: var(--color-base-200);
|
|
36
|
-
height: 0.5rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.meter__fill {
|
|
40
|
-
position: absolute;
|
|
41
|
-
top: 0;
|
|
42
|
-
left: 0;
|
|
43
|
-
height: 100%;
|
|
44
|
-
border-radius: 9999px;
|
|
45
|
-
background-color: var(--meter-fill);
|
|
46
|
-
transition: width 300ms var(--ease-out);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.meter--sm .meter__track {
|
|
50
|
-
height: 0.25rem;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.meter--lg .meter__track {
|
|
54
|
-
height: 0.75rem;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.meter--default {
|
|
58
|
-
--meter-fill: var(--color-base-content);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.meter--accent {
|
|
62
|
-
--meter-fill: var(--color-accent);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.meter--success {
|
|
66
|
-
--meter-fill: var(--color-success);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.meter--warning {
|
|
70
|
-
--meter-fill: var(--color-warning);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.meter--danger {
|
|
74
|
-
--meter-fill: var(--color-danger);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.meter--disabled,
|
|
78
|
-
.meter[aria-disabled="true"],
|
|
79
|
-
.meter[data-disabled="true"] {
|
|
80
|
-
opacity: 0.6;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@media (prefers-reduced-motion: reduce) {
|
|
84
|
-
.meter__fill {
|
|
85
|
-
transition: none;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
.meter {
|
|
3
|
+
display: grid;
|
|
4
|
+
width: 100%;
|
|
5
|
+
gap: 0.25rem;
|
|
6
|
+
grid-template-areas:
|
|
7
|
+
"label output"
|
|
8
|
+
"track track";
|
|
9
|
+
grid-template-columns: 1fr auto;
|
|
10
|
+
|
|
11
|
+
--meter-fill: var(--color-accent);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.meter [data-slot="label"] {
|
|
15
|
+
grid-area: label;
|
|
16
|
+
width: fit-content;
|
|
17
|
+
font-size: 0.875rem;
|
|
18
|
+
line-height: 1.25rem;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.meter__output {
|
|
23
|
+
grid-area: output;
|
|
24
|
+
font-size: 0.875rem;
|
|
25
|
+
line-height: 1.25rem;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
font-variant-numeric: tabular-nums;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.meter__track {
|
|
31
|
+
grid-area: track;
|
|
32
|
+
position: relative;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
border-radius: 9999px;
|
|
35
|
+
background: var(--color-base-200);
|
|
36
|
+
height: 0.5rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.meter__fill {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
height: 100%;
|
|
44
|
+
border-radius: 9999px;
|
|
45
|
+
background-color: var(--meter-fill);
|
|
46
|
+
transition: width 300ms var(--ease-out);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.meter--sm .meter__track {
|
|
50
|
+
height: 0.25rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.meter--lg .meter__track {
|
|
54
|
+
height: 0.75rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.meter--default {
|
|
58
|
+
--meter-fill: var(--color-base-content);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.meter--accent {
|
|
62
|
+
--meter-fill: var(--color-accent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.meter--success {
|
|
66
|
+
--meter-fill: var(--color-success);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.meter--warning {
|
|
70
|
+
--meter-fill: var(--color-warning);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.meter--danger {
|
|
74
|
+
--meter-fill: var(--color-danger);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.meter--disabled,
|
|
78
|
+
.meter[aria-disabled="true"],
|
|
79
|
+
.meter[data-disabled="true"] {
|
|
80
|
+
opacity: 0.6;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (prefers-reduced-motion: reduce) {
|
|
84
|
+
.meter__fill {
|
|
85
|
+
transition: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|