vireuikit 0.5.0 → 0.7.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.
@@ -0,0 +1,557 @@
1
+ import { activeMaterial, applyAccessibility, resolveOptics, halfMinDp, VIREGLASS_SHEET_MATERIAL, concentricRadius } from 'vireglass';
2
+
3
+ // src/kit/a11y.ts
4
+ var A11Y_NONE = {
5
+ reduceTransparency: false,
6
+ increaseContrast: false,
7
+ reduceMotion: false
8
+ };
9
+ function resolveA11y(system, override = {}) {
10
+ return {
11
+ reduceTransparency: override.reduceTransparency ?? system.reduceTransparency,
12
+ increaseContrast: override.increaseContrast ?? system.increaseContrast,
13
+ reduceMotion: override.reduceMotion ?? system.reduceMotion
14
+ };
15
+ }
16
+ function presentationFor(mode, wantsGlass) {
17
+ return {
18
+ glass: wantsGlass,
19
+ frost: wantsGlass && mode.reduceTransparency,
20
+ surface: wantsGlass ? "glass" : "plain",
21
+ contrastBorder: mode.increaseContrast,
22
+ instantSprings: mode.reduceMotion
23
+ };
24
+ }
25
+ function sameA11y(a, b) {
26
+ return a.reduceTransparency === b.reduceTransparency && a.increaseContrast === b.increaseContrast && a.reduceMotion === b.reduceMotion;
27
+ }
28
+ var ATOM_AT_REST = {
29
+ pressed: 0,
30
+ hovered: 0,
31
+ selected: 0,
32
+ disabled: false
33
+ };
34
+ function atomLift(kind) {
35
+ switch (kind) {
36
+ case "iconButton":
37
+ case "switch":
38
+ case "slider":
39
+ return 1;
40
+ default:
41
+ return 0;
42
+ }
43
+ }
44
+ var DISABLED_PRESENCE = 0.25;
45
+ var HOVER_GAIN = 0.35;
46
+ function activation(state) {
47
+ if (state.disabled) return 0;
48
+ const clamp2 = (v) => v < 0 ? 0 : v > 1 ? 1 : v;
49
+ return Math.max(clamp2(state.selected), clamp2(state.pressed), clamp2(state.hovered) * HOVER_GAIN);
50
+ }
51
+ function atomMaterial(base, kind, state = ATOM_AT_REST) {
52
+ const out = activeMaterial(base, activation(state));
53
+ if (!state.disabled) return out;
54
+ return { ...out, presence: out.presence * DISABLED_PRESENCE };
55
+ }
56
+ function atomAtRest(state) {
57
+ return state.pressed === 0 && state.hovered === 0 && state.selected === 0 && state.disabled === false;
58
+ }
59
+ var REST_BODY = { alpha: 0.25, white: 0.15, lift: 0.1 };
60
+ var PRESSED_BODY = { alpha: 0.34, white: 0.35, lift: 0 };
61
+ var FROST_LIFT = 0.26;
62
+ function atomBody(base, state = ATOM_AT_REST, frost = false) {
63
+ const on = activation(state);
64
+ const mix2 = (key) => REST_BODY[key] + (PRESSED_BODY[key] - REST_BODY[key]) * on;
65
+ let alpha = mix2("alpha");
66
+ let white = mix2("white");
67
+ let lift = mix2("lift");
68
+ if (state.disabled) alpha *= DISABLED_PRESENCE;
69
+ if (frost) {
70
+ const density = applyAccessibility(resolveOptics(base), {
71
+ reduceTransparency: true,
72
+ increaseContrast: false,
73
+ reduceMotion: false
74
+ }).bodyDensity;
75
+ alpha = Math.max(alpha, density);
76
+ white = 0;
77
+ lift = FROST_LIFT;
78
+ }
79
+ return { alpha, white, lift };
80
+ }
81
+
82
+ // src/kit/behavior/focus.ts
83
+ function stepFocus(event) {
84
+ return event.type === "focus" && event.visible;
85
+ }
86
+
87
+ // src/kit/behavior/hover.ts
88
+ function stepHover(event, canHover) {
89
+ return canHover && event.type === "enter";
90
+ }
91
+
92
+ // src/kit/behavior/press.ts
93
+ var PRESS_IDLE = { by: null };
94
+ function stepPress(state, event, enabled2) {
95
+ switch (event.type) {
96
+ case "down":
97
+ if (!enabled2 || state.by !== null) return { state, activated: false };
98
+ return { state: { by: event.source }, activated: false };
99
+ case "up":
100
+ if (state.by !== event.source) return { state, activated: false };
101
+ return { state: PRESS_IDLE, activated: enabled2 };
102
+ case "cancel":
103
+ return { state: PRESS_IDLE, activated: false };
104
+ case "leave":
105
+ return state.by === "pointer" ? { state: PRESS_IDLE, activated: false } : { state, activated: false };
106
+ }
107
+ }
108
+
109
+ // src/kit/behavior/control.ts
110
+ var TOUCH_INPUT = { hover: false };
111
+ var POINTER_INPUT = { hover: true };
112
+ var CONTROL_IDLE = {
113
+ press: PRESS_IDLE,
114
+ hovered: false,
115
+ focused: false,
116
+ disabled: false
117
+ };
118
+ function stepControl(state, event, caps) {
119
+ switch (event.type) {
120
+ case "down":
121
+ case "up":
122
+ case "cancel": {
123
+ const next = stepPress(state.press, event, !state.disabled);
124
+ return { state: { ...state, press: next.state }, activated: next.activated };
125
+ }
126
+ case "leave": {
127
+ const next = stepPress(state.press, event, !state.disabled);
128
+ return { state: { ...state, press: next.state, hovered: false }, activated: false };
129
+ }
130
+ case "enter":
131
+ return {
132
+ state: { ...state, hovered: !state.disabled && stepHover(event, caps.hover) },
133
+ activated: false
134
+ };
135
+ case "focus":
136
+ case "blur": {
137
+ const press = event.type === "blur" && state.press.by === "keyboard" ? PRESS_IDLE : state.press;
138
+ return {
139
+ state: { ...state, press, focused: !state.disabled && stepFocus(event) },
140
+ activated: false
141
+ };
142
+ }
143
+ case "disable":
144
+ return {
145
+ state: event.disabled ? { press: PRESS_IDLE, hovered: false, focused: false, disabled: true } : { ...state, disabled: false },
146
+ activated: false
147
+ };
148
+ }
149
+ }
150
+ function controlTargets(state) {
151
+ return {
152
+ pressed: state.press.by !== null ? 1 : 0,
153
+ hovered: state.hovered ? 1 : 0,
154
+ focus: state.focused ? 1 : 0,
155
+ disabled: state.disabled
156
+ };
157
+ }
158
+ function stepSpring(s, dt, response, damping, instant = false) {
159
+ if (instant) {
160
+ const moved = s.x !== s.target || s.v !== 0;
161
+ s.x = s.target;
162
+ s.v = 0;
163
+ return moved;
164
+ }
165
+ const stiffness = (2 * Math.PI / response) ** 2;
166
+ const friction = 4 * Math.PI * damping / response;
167
+ const h = 1 / 240;
168
+ for (let left = Math.min(dt, 0.05); left > 0; left -= h) {
169
+ const step = Math.min(left, h);
170
+ s.v += (stiffness * (s.target - s.x) - friction * s.v) * step;
171
+ s.x += s.v * step;
172
+ }
173
+ if (Math.abs(s.target - s.x) < 1e-3 && Math.abs(s.v) < 0.01) {
174
+ s.x = s.target;
175
+ s.v = 0;
176
+ return false;
177
+ }
178
+ return true;
179
+ }
180
+ var smoothstep = (e0, e1, x) => {
181
+ const t = Math.min(Math.max((x - e0) / (e1 - e0), 0), 1);
182
+ return t * t * (3 - 2 * t);
183
+ };
184
+ var mix = (a, b, t) => a + (b - a) * t;
185
+ var DROP_DIAMETER = 1.1;
186
+ var DROP_LIFT = 0.5;
187
+ var NECK_GAIN = 0.3;
188
+ var NECK_RAMP = 4;
189
+ var CORNER_EASE_START = 0.55;
190
+ var INK_OUT_END = 0.4;
191
+ var INK_IN_START = 0.9;
192
+ var INK_IN_END = 1;
193
+ function growthInk(phase) {
194
+ const a = Math.min(Math.max(phase.shrink, 0), 1);
195
+ const b = Math.max(phase.grow, 0);
196
+ return {
197
+ outgoing: 1 - smoothstep(0, INK_OUT_END, a),
198
+ incoming: smoothstep(INK_IN_START, INK_IN_END, b)
199
+ };
200
+ }
201
+ function largerOf(a, b) {
202
+ return halfMinDp(a.geometry) >= halfMinDp(b.geometry) ? { main: a, other: b } : { main: b, other: a };
203
+ }
204
+ function growthFrame(source, target, anchor, phase) {
205
+ const dx = target.center.x - source.center.x;
206
+ const dy = target.center.y - source.center.y;
207
+ const len = Math.hypot(dx, dy) || 1;
208
+ const sourceSize = halfMinDp(source.geometry) * 2;
209
+ const lift = DROP_LIFT * sourceSize;
210
+ const drop = {
211
+ x: source.center.x + dx / len * lift,
212
+ y: source.center.y + dy / len * lift
213
+ };
214
+ const a = Math.min(Math.max(phase.shrink, 0), 1);
215
+ const b = Math.max(phase.grow, 0);
216
+ const keep = Math.max(1 - b, 0);
217
+ const d = DROP_DIAMETER * sourceSize;
218
+ const shrunkGeometry = {
219
+ width: mix(source.geometry.width, 0.6 * d, a) * keep,
220
+ height: mix(source.geometry.height, 0.6 * d, a) * keep,
221
+ cornerRadius: 0
222
+ };
223
+ shrunkGeometry.cornerRadius = Math.min(
224
+ mix(source.geometry.cornerRadius, halfMinDp(shrunkGeometry), a),
225
+ halfMinDp(shrunkGeometry)
226
+ );
227
+ const shrunk = {
228
+ geometry: shrunkGeometry,
229
+ center: { x: mix(source.center.x, drop.x, a), y: mix(source.center.y, drop.y, a) }
230
+ };
231
+ const seed = d * Math.sqrt(a);
232
+ const cornerX = Math.sign(anchor.x - source.center.x);
233
+ const cornerY = Math.sign(anchor.y - source.center.y);
234
+ const edgeX = mix(drop.x + cornerX * (seed / 2), anchor.x, Math.min(b, 1));
235
+ const edgeY = mix(drop.y + cornerY * (seed / 2), anchor.y, Math.min(b, 1));
236
+ const width = mix(seed, target.geometry.width, b);
237
+ const height = mix(seed, target.geometry.height, b);
238
+ const grownGeometry = { width, height, cornerRadius: 0 };
239
+ grownGeometry.cornerRadius = Math.min(
240
+ mix(halfMinDp(grownGeometry), target.geometry.cornerRadius, smoothstep(CORNER_EASE_START, 1, b)),
241
+ halfMinDp(grownGeometry)
242
+ );
243
+ const grown = {
244
+ geometry: grownGeometry,
245
+ center: { x: edgeX - cornerX * (width / 2), y: edgeY - cornerY * (height / 2) }
246
+ };
247
+ const { main, other } = largerOf(grown, shrunk);
248
+ const neck = NECK_GAIN * sourceSize * Math.min(a * NECK_RAMP, 1) * keep;
249
+ const united = neck > 0.01 && other.geometry.width > 0.5 && other.geometry.height > 0.5;
250
+ return {
251
+ body: main,
252
+ grown,
253
+ merge: united ? {
254
+ offsetX: other.center.x - main.center.x,
255
+ offsetY: other.center.y - main.center.y,
256
+ width: other.geometry.width,
257
+ height: other.geometry.height,
258
+ cornerRadius: other.geometry.cornerRadius,
259
+ smoothing: neck
260
+ } : void 0,
261
+ ink: growthInk(phase)
262
+ };
263
+ }
264
+ var createGrowthState = () => ({
265
+ shrink: { x: 0, v: 0, target: 0 },
266
+ grow: { x: 0, v: 0, target: 0 }
267
+ });
268
+ var growthPhase = (state) => ({
269
+ shrink: state.shrink.x,
270
+ grow: state.grow.x
271
+ });
272
+ var DEFAULT_GROWTH_TIMING = {
273
+ shrinkOpen: 0.21,
274
+ shrinkClose: 0.14,
275
+ growOpen: 0.38,
276
+ growClose: 0.4,
277
+ growDampingOpen: 0.72
278
+ };
279
+ var GROW_DAMPING_CLOSE = 1;
280
+ var SHRINK_DAMPING = 1;
281
+ var GROW_STARTS_AT = 0.8;
282
+ var SHRINK_RETURNS_AT = 0.12;
283
+ function stepGrowth(state, dt, open, reduceMotion = false, timing = DEFAULT_GROWTH_TIMING) {
284
+ const { shrink, grow } = state;
285
+ if (reduceMotion) {
286
+ shrink.target = open ? 1 : 0;
287
+ grow.target = open ? 1 : 0;
288
+ } else if (open) {
289
+ shrink.target = 1;
290
+ if (shrink.x > GROW_STARTS_AT) grow.target = 1;
291
+ } else {
292
+ grow.target = 0;
293
+ if (grow.x < SHRINK_RETURNS_AT) shrink.target = 0;
294
+ }
295
+ const movedShrink = stepSpring(
296
+ shrink,
297
+ dt,
298
+ open ? timing.shrinkOpen : timing.shrinkClose,
299
+ SHRINK_DAMPING,
300
+ reduceMotion
301
+ );
302
+ const movedGrow = stepSpring(
303
+ grow,
304
+ dt,
305
+ open ? timing.growOpen : timing.growClose,
306
+ open ? timing.growDampingOpen : GROW_DAMPING_CLOSE,
307
+ reduceMotion
308
+ );
309
+ return movedShrink || movedGrow;
310
+ }
311
+
312
+ // src/kit/behavior/visual.ts
313
+ var createControlVisual = () => ({
314
+ pressed: { x: 0, v: 0, target: 0 },
315
+ hovered: { x: 0, v: 0, target: 0 },
316
+ focus: { x: 0, v: 0, target: 0 }
317
+ });
318
+ var PRESS = { response: 0.18, damping: 0.78 };
319
+ var HOVER = { response: 0.22, damping: 1 };
320
+ var FOCUS = { response: 0.16, damping: 1 };
321
+ function stepControlVisual(visual, dt, state, instant = false) {
322
+ const t = controlTargets(state);
323
+ visual.pressed.target = t.pressed;
324
+ visual.hovered.target = t.hovered;
325
+ visual.focus.target = t.focus;
326
+ const a = stepSpring(visual.pressed, dt, PRESS.response, PRESS.damping, instant);
327
+ const b = stepSpring(visual.hovered, dt, HOVER.response, HOVER.damping, instant);
328
+ const c = stepSpring(visual.focus, dt, FOCUS.response, FOCUS.damping, instant);
329
+ return a || b || c;
330
+ }
331
+ function visualAtomState(visual, state) {
332
+ return {
333
+ pressed: visual.pressed.x,
334
+ hovered: visual.hovered.x,
335
+ selected: 0,
336
+ disabled: state.disabled
337
+ };
338
+ }
339
+ function settleControlVisual(visual, state) {
340
+ stepControlVisual(visual, 0, state, true);
341
+ }
342
+ var MENU_CLOSED = { open: false, active: -1, typed: "", typedAt: Number.NEGATIVE_INFINITY };
343
+ var TYPEAHEAD_SECONDS = 0.5;
344
+ var exists = (items, i) => i >= 0 && i < items.length;
345
+ var enabled = (items, i) => exists(items, i) && !items[i].disabled;
346
+ var reachable = (items, i) => exists(items, i) && (items[i].focusable ?? !items[i].disabled);
347
+ function seek(items, from, step) {
348
+ const n = items.length;
349
+ for (let k = 1; k <= n; k += 1) {
350
+ const i = ((from + step * k) % n + n) % n;
351
+ if (reachable(items, i)) return i;
352
+ }
353
+ return -1;
354
+ }
355
+ var first = (items) => seek(items, -1, 1);
356
+ var last = (items) => seek(items, items.length, -1);
357
+ var toItem = (index) => index < 0 ? { to: "menu" } : { to: "item", index };
358
+ function typeahead(state, items, key, at) {
359
+ const fresh = at - state.typedAt > TYPEAHEAD_SECONDS;
360
+ const typed = (fresh ? "" : state.typed) + key.toLowerCase();
361
+ const repeated = typed.length > 1 && [...typed].every((c) => c === typed[0]);
362
+ const needle = repeated ? typed[0] : typed;
363
+ const start = needle.length > 1 ? state.active - 1 : state.active;
364
+ const n = items.length;
365
+ for (let k = 1; k <= n; k += 1) {
366
+ const i = ((start + k) % n + n) % n;
367
+ if (reachable(items, i) && items[i].label.trim().toLowerCase().startsWith(needle)) {
368
+ return { state: { ...state, active: i, typed, typedAt: at }, focus: { to: "item", index: i }, chosen: null };
369
+ }
370
+ }
371
+ return { state: { ...state, typed, typedAt: at }, focus: { to: "stay" }, chosen: null };
372
+ }
373
+ function stepMenu(state, event, items) {
374
+ const stay = { state, focus: { to: "stay" }, chosen: null };
375
+ if (event.type === "open") {
376
+ const active = event.focus === "first" ? first(items) : event.focus === "last" ? last(items) : -1;
377
+ return { state: { ...MENU_CLOSED, open: true, active }, focus: toItem(active), chosen: null };
378
+ }
379
+ if (!state.open) return stay;
380
+ switch (event.type) {
381
+ case "move": {
382
+ const active = event.to === "first" ? first(items) : event.to === "last" ? last(items) : seek(items, state.active < 0 && event.to === "previous" ? items.length : state.active, event.to === "next" ? 1 : -1);
383
+ if (active < 0) return stay;
384
+ return { state: { ...state, active, typed: "" }, focus: { to: "item", index: active }, chosen: null };
385
+ }
386
+ case "point":
387
+ if (!reachable(items, event.index) || event.index === state.active) return stay;
388
+ return { state: { ...state, active: event.index, typed: "" }, focus: { to: "item", index: event.index }, chosen: null };
389
+ case "type":
390
+ return typeahead(state, items, event.key, event.at);
391
+ case "choose":
392
+ if (!enabled(items, event.index)) return stay;
393
+ return { state: MENU_CLOSED, focus: { to: "trigger" }, chosen: event.index };
394
+ case "dismiss":
395
+ return { state: MENU_CLOSED, focus: event.reason === "outside" ? { to: "none" } : { to: "trigger" }, chosen: null };
396
+ }
397
+ }
398
+ var MENU_CORNERS = {
399
+ "top-left": { x: -1, y: -1 },
400
+ "top-right": { x: 1, y: -1 },
401
+ "bottom-left": { x: -1, y: 1 },
402
+ "bottom-right": { x: 1, y: 1 }
403
+ };
404
+ function menuCorner(trigger, viewport) {
405
+ return {
406
+ x: trigger.x + trigger.width / 2 <= viewport.width / 2 ? -1 : 1,
407
+ y: trigger.y + trigger.height / 2 <= viewport.height / 2 ? -1 : 1
408
+ };
409
+ }
410
+ function along(start, length, size, side) {
411
+ return side < 0 ? start : start + length - size;
412
+ }
413
+ function fits(at, size, limit, margin) {
414
+ return at >= margin && at + size <= limit - margin;
415
+ }
416
+ var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), Math.max(lo, hi));
417
+ function menuPlacement(trigger, menu, viewport, options = {}) {
418
+ const margin = options.margin ?? 8;
419
+ const width = Math.min(menu.width, viewport.width - 2 * margin);
420
+ const height = Math.min(menu.height, viewport.height - 2 * margin);
421
+ const corner = { ...options.corner ?? menuCorner(trigger, viewport) };
422
+ let x = along(trigger.x, trigger.width, width, corner.x);
423
+ let y = along(trigger.y, trigger.height, height, corner.y);
424
+ if (!options.corner) {
425
+ const fx = along(trigger.x, trigger.width, width, corner.x === -1 ? 1 : -1);
426
+ if (!fits(x, width, viewport.width, margin) && fits(fx, width, viewport.width, margin)) {
427
+ corner.x = corner.x === -1 ? 1 : -1;
428
+ x = fx;
429
+ }
430
+ const fy = along(trigger.y, trigger.height, height, corner.y === -1 ? 1 : -1);
431
+ if (!fits(y, height, viewport.height, margin) && fits(fy, height, viewport.height, margin)) {
432
+ corner.y = corner.y === -1 ? 1 : -1;
433
+ y = fy;
434
+ }
435
+ }
436
+ x = clamp(x, margin, viewport.width - margin - width);
437
+ y = clamp(y, margin, viewport.height - margin - height);
438
+ const rect = { x, y, width, height };
439
+ return {
440
+ rect,
441
+ corner,
442
+ anchor: { x: corner.x < 0 ? x : x + width, y: corner.y < 0 ? y : y + height }
443
+ };
444
+ }
445
+ var center = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
446
+ function menuActivity(phase) {
447
+ const shrink = Math.min(Math.max(phase.shrink, 0), 1);
448
+ const grow = Math.min(Math.max(phase.grow, 0), 1);
449
+ return shrink * (1 - grow);
450
+ }
451
+ function menuSurfaceFrame(trigger, menu, anchor, phase) {
452
+ const frame = growthFrame(
453
+ { geometry: { width: trigger.width, height: trigger.height, cornerRadius: trigger.radius }, center: center(trigger) },
454
+ { geometry: { width: menu.width, height: menu.height, cornerRadius: menu.radius }, center: center(menu) },
455
+ anchor,
456
+ phase
457
+ );
458
+ const { geometry, center: c } = frame.body;
459
+ const box = {
460
+ x: c.x - geometry.width / 2,
461
+ y: c.y - geometry.height / 2,
462
+ width: geometry.width,
463
+ height: geometry.height,
464
+ radius: geometry.cornerRadius
465
+ };
466
+ return {
467
+ box,
468
+ morph: frame.merge,
469
+ content: { x: menu.x - box.x, y: menu.y - box.y },
470
+ ink: frame.ink,
471
+ activity: menuActivity(phase)
472
+ };
473
+ }
474
+ function menuGlass(base) {
475
+ return { ...base, roughness: Math.max(base.roughness, VIREGLASS_SHEET_MATERIAL.roughness) };
476
+ }
477
+ function menuMaterial(base, activity) {
478
+ return atomMaterial(menuGlass(base), "menu", { ...ATOM_AT_REST, pressed: activity });
479
+ }
480
+ var MENU_DROP_BODY = { alpha: 0.9, white: 0.1, lift: 0.2 };
481
+ function menuBody(base, activity, frost = false) {
482
+ const rest = atomBody(base, ATOM_AT_REST, frost);
483
+ if (frost) return rest;
484
+ const k = Math.min(Math.max(activity, 0), 1);
485
+ const mix2 = (key) => rest[key] + (MENU_DROP_BODY[key] - rest[key]) * k;
486
+ return { alpha: mix2("alpha"), white: mix2("white"), lift: mix2("lift") };
487
+ }
488
+ var MENU_ITEM_FILL = { active: 0.1, pressed: 0.18 };
489
+ function menuItemFill(state) {
490
+ if (state.disabled) return 0;
491
+ if (state.pressed) return MENU_ITEM_FILL.pressed;
492
+ return state.active ? MENU_ITEM_FILL.active : 0;
493
+ }
494
+
495
+ // src/kit/response.ts
496
+ var LIFTING = { grow: 0.18, defocus: 1.6 };
497
+ var SINKING = { grow: 0.06, defocus: 1 };
498
+ function pressResponse(kind) {
499
+ return atomLift(kind) === 1 ? LIFTING : SINKING;
500
+ }
501
+ var CONTROL_SIZES = ["touch", "small", "medium", "large", "xlarge"];
502
+ var MIN_TOUCH_TARGET_DP = 44;
503
+ var MIN_POINTER_TARGET_DP = 24;
504
+ var capsule = (height, paddingX) => ({
505
+ height,
506
+ paddingX,
507
+ icon: Math.round(height / 2),
508
+ radius: height / 2,
509
+ shape: "capsule"
510
+ });
511
+ var rounded = (height, paddingX) => ({
512
+ height,
513
+ paddingX,
514
+ icon: Math.round(height / 2),
515
+ radius: height / 4,
516
+ shape: "rounded"
517
+ });
518
+ var BUTTON_SIZES = {
519
+ touch: capsule(44, 20),
520
+ small: rounded(24, 10),
521
+ medium: rounded(32, 14),
522
+ large: capsule(40, 18),
523
+ xlarge: capsule(48, 22)
524
+ };
525
+ function iconButtonSize(size) {
526
+ const spec = BUTTON_SIZES[size];
527
+ return { ...spec, width: spec.height, paddingX: 0 };
528
+ }
529
+ var MENU_PADDING = 0.3;
530
+ function menuSize(size) {
531
+ const spec = BUTTON_SIZES[size];
532
+ const padding = Math.round(spec.height * MENU_PADDING);
533
+ return {
534
+ row: spec.height,
535
+ padding,
536
+ itemRadius: spec.radius,
537
+ radius: spec.radius + padding,
538
+ icon: spec.icon,
539
+ labelPad: spec.paddingX
540
+ };
541
+ }
542
+ function nestedRadius(outerRadius, inset, minimum = 0) {
543
+ return concentricRadius(outerRadius, inset, minimum);
544
+ }
545
+ function defaultSize(input) {
546
+ return input.touch ? "touch" : "medium";
547
+ }
548
+ function hitSlop(bodyDp, minTargetDp) {
549
+ return bodyDp >= minTargetDp ? 0 : (minTargetDp - bodyDp) / 2;
550
+ }
551
+ function minTarget(input) {
552
+ return input.touch ? MIN_TOUCH_TARGET_DP : MIN_POINTER_TARGET_DP;
553
+ }
554
+
555
+ export { A11Y_NONE, ATOM_AT_REST, BUTTON_SIZES, CONTROL_IDLE, CONTROL_SIZES, DEFAULT_GROWTH_TIMING, MENU_CLOSED, MENU_CORNERS, MENU_DROP_BODY, MENU_ITEM_FILL, MIN_POINTER_TARGET_DP, MIN_TOUCH_TARGET_DP, POINTER_INPUT, PRESS_IDLE, TOUCH_INPUT, TYPEAHEAD_SECONDS, atomAtRest, atomBody, atomLift, atomMaterial, controlTargets, createControlVisual, createGrowthState, defaultSize, growthFrame, growthInk, growthPhase, hitSlop, iconButtonSize, menuActivity, menuBody, menuCorner, menuGlass, menuItemFill, menuMaterial, menuPlacement, menuSize, menuSurfaceFrame, minTarget, nestedRadius, presentationFor, pressResponse, resolveA11y, sameA11y, settleControlVisual, smoothstep, stepControl, stepControlVisual, stepFocus, stepGrowth, stepHover, stepMenu, stepPress, stepSpring, visualAtomState };
556
+ //# sourceMappingURL=chunk-AR2AM3BR.js.map
557
+ //# sourceMappingURL=chunk-AR2AM3BR.js.map