@alulore/kumiko 0.0.0-stage → 0.14.1
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/dist/badge/badge.css +287 -0
- package/dist/badge/badge.d.ts +40 -0
- package/dist/badge/badge.js +51 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +1 -0
- package/dist/board/board-api.d.ts +147 -0
- package/dist/board/board-api.js +139 -0
- package/dist/board/board-card-menu.d.ts +17 -0
- package/dist/board/board-card-menu.js +53 -0
- package/dist/board/board-drag-events.d.ts +12 -0
- package/dist/board/board-drag-events.js +86 -0
- package/dist/board/board-fold.d.ts +10 -0
- package/dist/board/board-fold.js +30 -0
- package/dist/board/board-group.d.ts +10 -0
- package/dist/board/board-group.js +28 -0
- package/dist/board/board-keys.d.ts +16 -0
- package/dist/board/board-keys.js +65 -0
- package/dist/board/board-locked-rows.d.ts +23 -0
- package/dist/board/board-locked-rows.js +77 -0
- package/dist/board/board-motion.d.ts +7 -0
- package/dist/board/board-motion.js +102 -0
- package/dist/board/board-primitive.d.ts +53 -0
- package/dist/board/board-primitive.js +66 -0
- package/dist/board/board-pull.d.ts +6 -0
- package/dist/board/board-pull.js +94 -0
- package/dist/board/board-selection.d.ts +42 -0
- package/dist/board/board-selection.js +130 -0
- package/dist/board/board-slots.d.ts +1003 -0
- package/dist/board/board-slots.js +250 -0
- package/dist/board/board-types.d.ts +99 -0
- package/dist/board/board-types.js +1 -0
- package/dist/board/board.css +343 -0
- package/dist/board/board.d.ts +290 -0
- package/dist/board/board.js +23 -0
- package/dist/board/card-menu.d.ts +21 -0
- package/dist/board/card-menu.js +79 -0
- package/dist/board/cell-key.d.ts +6 -0
- package/dist/board/cell-key.js +16 -0
- package/dist/board/index.d.ts +6 -0
- package/dist/board/index.js +5 -0
- package/dist/board/interactive.d.ts +18 -0
- package/dist/board/interactive.js +51 -0
- package/dist/board/keep-capture.d.ts +16 -0
- package/dist/board/keep-capture.js +57 -0
- package/dist/board/landing.d.ts +5 -0
- package/dist/board/landing.js +10 -0
- package/dist/board/press-to-drop.d.ts +9 -0
- package/dist/board/press-to-drop.js +28 -0
- package/dist/board/refused-home.d.ts +16 -0
- package/dist/board/refused-home.js +50 -0
- package/dist/board/repeat-gate.d.ts +4 -0
- package/dist/board/repeat-gate.js +12 -0
- package/dist/board/scrollbar-gutter.d.ts +1 -0
- package/dist/board/scrollbar-gutter.js +27 -0
- package/dist/board/touch-hold.d.ts +19 -0
- package/dist/board/touch-hold.js +103 -0
- package/dist/button/button.css +576 -0
- package/dist/button/button.d.ts +50 -0
- package/dist/button/button.js +70 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +1 -0
- package/dist/checkbox/checkbox-mark.d.ts +8 -0
- package/dist/checkbox/checkbox-mark.js +17 -0
- package/dist/checkbox/checkbox-marks.d.ts +33 -0
- package/dist/checkbox/checkbox-marks.js +30 -0
- package/dist/checkbox/checkbox.css +201 -0
- package/dist/checkbox/checkbox.d.ts +26 -0
- package/dist/checkbox/checkbox.js +11 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/index.js +3 -0
- package/dist/chip/chip.css +251 -0
- package/dist/chip/chip.d.ts +39 -0
- package/dist/chip/chip.js +25 -0
- package/dist/chip/index.d.ts +1 -0
- package/dist/chip/index.js +1 -0
- package/dist/dialog/dialog.css +247 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/dialog/index.js +3 -0
- package/dist/hover-card/hover-card.css +149 -0
- package/dist/hover-card/hover-card.d.ts +3 -0
- package/dist/hover-card/hover-card.js +8 -0
- package/dist/hover-card/index.d.ts +2 -0
- package/dist/hover-card/index.js +2 -0
- package/dist/input/index.d.ts +5 -0
- package/dist/input/index.js +5 -0
- package/dist/input/input-attributes.d.ts +12 -0
- package/dist/input/input-attributes.js +9 -0
- package/dist/input/input.css +752 -0
- package/dist/input/input.d.ts +28 -0
- package/dist/input/input.js +9 -0
- package/dist/input/search-input.d.ts +41 -0
- package/dist/input/search-input.js +47 -0
- package/dist/kbd/index.d.ts +1 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/kbd.css +77 -0
- package/dist/kbd/kbd.d.ts +21 -0
- package/dist/kbd/kbd.js +37 -0
- package/dist/label/index.d.ts +1 -0
- package/dist/label/index.js +1 -0
- package/dist/label/label.css +37 -0
- package/dist/label/label.d.ts +13 -0
- package/dist/label/label.js +10 -0
- package/dist/menu/index.d.ts +3 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.css +349 -0
- package/dist/menu/menu.d.ts +11 -0
- package/dist/menu/menu.js +86 -0
- package/dist/menu/point-menu.d.ts +26 -0
- package/dist/menu/point-menu.js +51 -0
- package/dist/motion/flip-math.d.ts +19 -0
- package/dist/motion/flip-math.js +33 -0
- package/dist/motion/flip.d.ts +40 -0
- package/dist/motion/flip.js +203 -0
- package/dist/motion/index.d.ts +2 -0
- package/dist/motion/index.js +2 -0
- package/dist/motion/motion.css +169 -0
- package/dist/popover/index.d.ts +1 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/popover.css +208 -0
- package/dist/progress/index.d.ts +2 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/progress.css +390 -0
- package/dist/progress/progress.d.ts +36 -0
- package/dist/progress/progress.js +107 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/select/select-labels.d.ts +6 -0
- package/dist/select/select-labels.js +64 -0
- package/dist/select/select-search.d.ts +18 -0
- package/dist/select/select-search.js +10 -0
- package/dist/select/select.css +470 -0
- package/dist/select/select.d.ts +44 -0
- package/dist/select/select.js +92 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/separator.css +32 -0
- package/dist/separator/separator.d.ts +17 -0
- package/dist/separator/separator.js +10 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/index.js +2 -0
- package/dist/slider/slider-bubble.css +203 -0
- package/dist/slider/slider-feel.d.ts +33 -0
- package/dist/slider/slider-feel.js +153 -0
- package/dist/slider/slider-format.d.ts +13 -0
- package/dist/slider/slider-format.js +15 -0
- package/dist/slider/slider-marks.d.ts +16 -0
- package/dist/slider/slider-marks.js +32 -0
- package/dist/slider/slider.css +335 -0
- package/dist/slider/slider.d.ts +34 -0
- package/dist/slider/slider.js +94 -0
- package/dist/smooth-caret/caret-box.d.ts +7 -0
- package/dist/smooth-caret/caret-box.js +8 -0
- package/dist/smooth-caret/caret-controller.d.ts +7 -0
- package/dist/smooth-caret/caret-controller.js +222 -0
- package/dist/smooth-caret/caret-geometry.d.ts +11 -0
- package/dist/smooth-caret/caret-geometry.js +230 -0
- package/dist/smooth-caret/caret-glide.d.ts +13 -0
- package/dist/smooth-caret/caret-glide.js +76 -0
- package/dist/smooth-caret/caret-host.d.ts +5 -0
- package/dist/smooth-caret/caret-host.js +40 -0
- package/dist/smooth-caret/index.d.ts +7 -0
- package/dist/smooth-caret/index.js +7 -0
- package/dist/smooth-caret/remote-carets.d.ts +40 -0
- package/dist/smooth-caret/remote-carets.js +130 -0
- package/dist/smooth-caret/smooth-caret.css +157 -0
- package/dist/smooth-caret/smooth-caret.d.ts +5 -0
- package/dist/smooth-caret/smooth-caret.js +9 -0
- package/dist/smooth-caret/use-smooth-caret.d.ts +5 -0
- package/dist/smooth-caret/use-smooth-caret.js +9 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +2 -0
- package/dist/switch/switch-drag.d.ts +21 -0
- package/dist/switch/switch-drag.js +23 -0
- package/dist/switch/switch-gesture.d.ts +28 -0
- package/dist/switch/switch-gesture.js +131 -0
- package/dist/switch/switch.css +189 -0
- package/dist/switch/switch.d.ts +15 -0
- package/dist/switch/switch.js +24 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -0
- package/dist/textarea/textarea.css +37 -0
- package/dist/textarea/textarea.d.ts +35 -0
- package/dist/textarea/textarea.js +11 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/toast.css +293 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/tooltip.css +143 -0
- package/dist/tooltip/tooltip.d.ts +14 -0
- package/dist/tooltip/tooltip.js +13 -0
- package/package.json +246 -5
- package/README.md +0 -3
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { firstWins, isStill, offsetBetween, offsetFromRest, parseDuration, withoutParent } from "./flip-math";
|
|
2
|
+
const FLIP_ID = "kumiko-flip";
|
|
3
|
+
const ENTER_ID = "kumiko-enter";
|
|
4
|
+
export function readMotion(el, kind) {
|
|
5
|
+
const style = getComputedStyle(el);
|
|
6
|
+
const easing = style.getPropertyValue(`--kumiko-${kind}-ease`).trim();
|
|
7
|
+
return {
|
|
8
|
+
duration: parseDuration(style.getPropertyValue(`--kumiko-${kind}-duration`)),
|
|
9
|
+
easing: easing === "" ? "ease" : easing
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function keyed(options) {
|
|
13
|
+
const keyOf = options.keyOf ?? ((el) => el.dataset.flipKey);
|
|
14
|
+
const found = new Map();
|
|
15
|
+
for (const el of options.items()) {
|
|
16
|
+
const key = keyOf(el);
|
|
17
|
+
if (key !== undefined) {
|
|
18
|
+
found.set(key, el);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return found;
|
|
22
|
+
}
|
|
23
|
+
function placeOf(el) {
|
|
24
|
+
return { parent: el.offsetParent, left: el.offsetLeft, top: el.offsetTop };
|
|
25
|
+
}
|
|
26
|
+
function placesOf(elements) {
|
|
27
|
+
return new Map([...elements].map(([key, el]) => [key, placeOf(el)]));
|
|
28
|
+
}
|
|
29
|
+
function parentOffset(el, moves) {
|
|
30
|
+
for (let node = el.parentElement; node; node = node.parentElement) {
|
|
31
|
+
const move = moves.get(node);
|
|
32
|
+
if (move) {
|
|
33
|
+
return move.offset;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
function cancelFlip(el) {
|
|
39
|
+
for (const animation of el.getAnimations()) {
|
|
40
|
+
if (animation.id === FLIP_ID) {
|
|
41
|
+
animation.cancel();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function animate(el, offset, kind) {
|
|
46
|
+
const { duration, easing } = readMotion(el, kind);
|
|
47
|
+
if (duration === 0 || isStill(offset)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
cancelFlip(el);
|
|
51
|
+
const keyframes = [{ translate: `${offset.x}px ${offset.y}px` }, { translate: "0 0" }];
|
|
52
|
+
el.animate(keyframes, { duration, easing, id: FLIP_ID });
|
|
53
|
+
}
|
|
54
|
+
function fadeIn(el) {
|
|
55
|
+
const style = getComputedStyle(el);
|
|
56
|
+
const duration = parseDuration(style.getPropertyValue("--kumiko-fade-duration"));
|
|
57
|
+
if (duration === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const easing = style.getPropertyValue("--kumiko-enter-ease").trim() || "ease-out";
|
|
61
|
+
const grows = parseDuration(style.getPropertyValue("--kumiko-move-duration")) > 0;
|
|
62
|
+
const keyframes = grows
|
|
63
|
+
? [
|
|
64
|
+
{ opacity: 0, scale: "0.96" },
|
|
65
|
+
{ opacity: 1, scale: "1" }
|
|
66
|
+
]
|
|
67
|
+
: [{ opacity: 0 }, { opacity: 1 }];
|
|
68
|
+
el.animate(keyframes, { duration, easing, id: ENTER_ID });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A play with nothing added, removed or moved in the page only settles items
|
|
72
|
+
* from where they were released. Its other starts may be stale: a page in the
|
|
73
|
+
* background waits a long time for its frame, and the layout can change before
|
|
74
|
+
* it comes.
|
|
75
|
+
*/
|
|
76
|
+
function settlesIn(from) {
|
|
77
|
+
return from && new Map([...from].filter(([, start]) => start.kind === "settle"));
|
|
78
|
+
}
|
|
79
|
+
const VIEWPORT = { left: 0, top: 0 };
|
|
80
|
+
function within(box, origin) {
|
|
81
|
+
return { left: box.left - origin.left, top: box.top - origin.top };
|
|
82
|
+
}
|
|
83
|
+
function moveOf(key, el, sources) {
|
|
84
|
+
const { from, before, now, origin } = sources;
|
|
85
|
+
const start = from?.get(key);
|
|
86
|
+
if (start) {
|
|
87
|
+
const offset = offsetBetween(start.box, within(el.getBoundingClientRect(), origin));
|
|
88
|
+
if (!isStill(offset)) {
|
|
89
|
+
return { offset, kind: start.kind };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const place = now.get(key);
|
|
93
|
+
const offset = place && before && offsetFromRest(before.get(key), place);
|
|
94
|
+
return offset && !isStill(offset) ? { offset, kind: "move" } : undefined;
|
|
95
|
+
}
|
|
96
|
+
function movesOf(elements, sources, options) {
|
|
97
|
+
const moves = new Map();
|
|
98
|
+
for (const [key, el] of elements) {
|
|
99
|
+
const move = options.skip?.(el) === true ? undefined : moveOf(key, el, sources);
|
|
100
|
+
if (move) {
|
|
101
|
+
moves.set(el, move);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return moves;
|
|
105
|
+
}
|
|
106
|
+
function playMoves(moves) {
|
|
107
|
+
for (const [el, move] of moves) {
|
|
108
|
+
animate(el, withoutParent(move.offset, parentOffset(el, moves)), move.kind);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Adds where items are now to `starts`, keeping each item's first start; a release point always wins. */
|
|
112
|
+
function measured(options, starts) {
|
|
113
|
+
const fresh = new Map();
|
|
114
|
+
const released = new Map();
|
|
115
|
+
const origin = options.origin?.() ?? VIEWPORT;
|
|
116
|
+
for (const [key, el] of keyed(options)) {
|
|
117
|
+
const box = options.from?.(key);
|
|
118
|
+
if (box) {
|
|
119
|
+
released.set(key, { box: within(box, origin), kind: "settle" });
|
|
120
|
+
}
|
|
121
|
+
else if (starts?.has(key) !== true) {
|
|
122
|
+
fresh.set(key, { box: within(el.getBoundingClientRect(), origin), kind: "move" });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return firstWins(released, firstWins(starts, fresh));
|
|
126
|
+
}
|
|
127
|
+
export function createFlip(options) {
|
|
128
|
+
let starts = null;
|
|
129
|
+
let rested = null;
|
|
130
|
+
const measure = () => {
|
|
131
|
+
starts = measured(options, starts);
|
|
132
|
+
};
|
|
133
|
+
const play = (structural = true) => {
|
|
134
|
+
const from = starts;
|
|
135
|
+
const before = rested;
|
|
136
|
+
const elements = keyed(options);
|
|
137
|
+
starts = null;
|
|
138
|
+
rested = placesOf(elements);
|
|
139
|
+
if (!before) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const usable = structural ? from : settlesIn(from);
|
|
143
|
+
for (const key of usable?.keys() ?? []) {
|
|
144
|
+
const el = elements.get(key);
|
|
145
|
+
if (el) {
|
|
146
|
+
cancelFlip(el);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
options.prepare?.();
|
|
150
|
+
const entering = [...elements].filter(([key]) => !before.has(key)).map(([, el]) => el);
|
|
151
|
+
if (entering.length > 0) {
|
|
152
|
+
options.enter?.(entering);
|
|
153
|
+
}
|
|
154
|
+
const fallback = structural ? before : null;
|
|
155
|
+
const origin = options.origin?.() ?? VIEWPORT;
|
|
156
|
+
const sources = { origin, from: usable, before: fallback, now: rested };
|
|
157
|
+
playMoves(movesOf(elements, sources, options));
|
|
158
|
+
for (const el of entering) {
|
|
159
|
+
fadeIn(el);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const rest = () => {
|
|
163
|
+
starts = null;
|
|
164
|
+
rested = placesOf(keyed(options));
|
|
165
|
+
};
|
|
166
|
+
return { measure, play, rest };
|
|
167
|
+
}
|
|
168
|
+
export function bindFlip(root, options) {
|
|
169
|
+
const flip = createFlip({
|
|
170
|
+
origin: () => root.getBoundingClientRect(),
|
|
171
|
+
...options
|
|
172
|
+
});
|
|
173
|
+
flip.play();
|
|
174
|
+
const observer = new MutationObserver(() => {
|
|
175
|
+
flip.play(true);
|
|
176
|
+
});
|
|
177
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
178
|
+
/*
|
|
179
|
+
* Layout can change without anything being added or removed (a theme, a
|
|
180
|
+
* font arriving), which would leave the resting places stale. A press or a
|
|
181
|
+
* key comes before anything the person does moves, so note them afresh then.
|
|
182
|
+
*/
|
|
183
|
+
const triggers = ["pointerdown", "keydown"];
|
|
184
|
+
for (const type of triggers) {
|
|
185
|
+
root.addEventListener(type, flip.rest, true);
|
|
186
|
+
}
|
|
187
|
+
let frame = 0;
|
|
188
|
+
const unsubscribe = options.subscribe(() => {
|
|
189
|
+
flip.measure();
|
|
190
|
+
cancelAnimationFrame(frame);
|
|
191
|
+
frame = requestAnimationFrame(() => {
|
|
192
|
+
flip.play(false);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
return () => {
|
|
196
|
+
cancelAnimationFrame(frame);
|
|
197
|
+
observer.disconnect();
|
|
198
|
+
for (const type of triggers) {
|
|
199
|
+
root.removeEventListener(type, flip.rest, true);
|
|
200
|
+
}
|
|
201
|
+
unsubscribe();
|
|
202
|
+
};
|
|
203
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
@layer kumiko {
|
|
2
|
+
:root,
|
|
3
|
+
[data-kumiko-motion="calm"] {
|
|
4
|
+
--kumiko-fade-duration: 160ms;
|
|
5
|
+
--kumiko-fade-ease: ease-out;
|
|
6
|
+
--kumiko-move-duration: 240ms;
|
|
7
|
+
--kumiko-move-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
|
|
8
|
+
--kumiko-settle-duration: 300ms;
|
|
9
|
+
--kumiko-settle-ease: cubic-bezier(0.2, 0.9, 0.3, 1);
|
|
10
|
+
--kumiko-lift-duration: 160ms;
|
|
11
|
+
--kumiko-lift-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
|
|
12
|
+
--kumiko-lift-scale: 1.02;
|
|
13
|
+
--kumiko-pop-duration: 100ms;
|
|
14
|
+
--kumiko-pop-ease: cubic-bezier(0.2, 0.9, 0.3, 1);
|
|
15
|
+
--kumiko-pop-scale: 0.96;
|
|
16
|
+
--kumiko-pop-distance: 4px;
|
|
17
|
+
--kumiko-spin-duration: 800ms;
|
|
18
|
+
--kumiko-spin-ease: linear;
|
|
19
|
+
--kumiko-enter-ease: ease-out;
|
|
20
|
+
--kumiko-exit-ease: ease-in;
|
|
21
|
+
--kumiko-stagger: 30ms;
|
|
22
|
+
--kumiko-press-duration: 100ms;
|
|
23
|
+
--kumiko-press-ease: ease-out;
|
|
24
|
+
--kumiko-press-scale: 0.97;
|
|
25
|
+
--kumiko-hover-scale: 1.05;
|
|
26
|
+
--kumiko-hover-tilt: 0deg;
|
|
27
|
+
--kumiko-squash-x: 1.04;
|
|
28
|
+
--kumiko-squash-y: 0.96;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-kumiko-motion="lively"] {
|
|
32
|
+
--kumiko-move-duration: 420ms;
|
|
33
|
+
--kumiko-move-ease: linear(
|
|
34
|
+
0,
|
|
35
|
+
0.028 3.8%,
|
|
36
|
+
0.1 7.7%,
|
|
37
|
+
0.199 11.5%,
|
|
38
|
+
0.311 15.4%,
|
|
39
|
+
0.427 19.2%,
|
|
40
|
+
0.538 23.1%,
|
|
41
|
+
0.642 26.9%,
|
|
42
|
+
0.733 30.8%,
|
|
43
|
+
0.812 34.6%,
|
|
44
|
+
0.877 38.5%,
|
|
45
|
+
0.929 42.3%,
|
|
46
|
+
0.97 46.2%,
|
|
47
|
+
1 50%,
|
|
48
|
+
1.021 53.8%,
|
|
49
|
+
1.035 57.7%,
|
|
50
|
+
1.043 61.5%,
|
|
51
|
+
1.046 65.4%,
|
|
52
|
+
1.046 69.2%,
|
|
53
|
+
1.043 73.1%,
|
|
54
|
+
1.039 76.9%,
|
|
55
|
+
1.034 80.8%,
|
|
56
|
+
1.029 84.6%,
|
|
57
|
+
1.023 88.5%,
|
|
58
|
+
1.018 92.3%,
|
|
59
|
+
1.014 96.2%,
|
|
60
|
+
1
|
|
61
|
+
);
|
|
62
|
+
--kumiko-settle-duration: 520ms;
|
|
63
|
+
--kumiko-settle-ease: linear(
|
|
64
|
+
0,
|
|
65
|
+
0.046 3.8%,
|
|
66
|
+
0.16 7.7%,
|
|
67
|
+
0.313 11.5%,
|
|
68
|
+
0.48 15.4%,
|
|
69
|
+
0.642 19.2%,
|
|
70
|
+
0.787 23.1%,
|
|
71
|
+
0.907 26.9%,
|
|
72
|
+
0.999 30.8%,
|
|
73
|
+
1.064 34.6%,
|
|
74
|
+
1.104 38.5%,
|
|
75
|
+
1.123 42.3%,
|
|
76
|
+
1.126 46.2%,
|
|
77
|
+
1.117 50%,
|
|
78
|
+
1.101 53.8%,
|
|
79
|
+
1.08 57.7%,
|
|
80
|
+
1.059 61.5%,
|
|
81
|
+
1.039 65.4%,
|
|
82
|
+
1.022 69.2%,
|
|
83
|
+
1.008 73.1%,
|
|
84
|
+
0.997 76.9%,
|
|
85
|
+
0.99 80.8%,
|
|
86
|
+
0.986 84.6%,
|
|
87
|
+
0.984 88.5%,
|
|
88
|
+
0.984 92.3%,
|
|
89
|
+
0.986 96.2%,
|
|
90
|
+
1
|
|
91
|
+
);
|
|
92
|
+
--kumiko-lift-duration: 220ms;
|
|
93
|
+
--kumiko-lift-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
94
|
+
--kumiko-lift-scale: 1.04;
|
|
95
|
+
--kumiko-pop-duration: 240ms;
|
|
96
|
+
--kumiko-pop-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
97
|
+
--kumiko-pop-scale: 0.9;
|
|
98
|
+
--kumiko-pop-distance: 8px;
|
|
99
|
+
--kumiko-spin-duration: 700ms;
|
|
100
|
+
--kumiko-stagger: 40ms;
|
|
101
|
+
--kumiko-press-duration: 80ms;
|
|
102
|
+
--kumiko-press-scale: 0.84;
|
|
103
|
+
--kumiko-hover-scale: 1.08;
|
|
104
|
+
--kumiko-hover-tilt: 0deg;
|
|
105
|
+
--kumiko-squash-x: 1.25;
|
|
106
|
+
--kumiko-squash-y: 0.85;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-kumiko-motion="crisp"] {
|
|
110
|
+
--kumiko-fade-duration: 120ms;
|
|
111
|
+
--kumiko-move-duration: 160ms;
|
|
112
|
+
--kumiko-move-ease: cubic-bezier(0.2, 0, 0, 1);
|
|
113
|
+
--kumiko-settle-duration: 180ms;
|
|
114
|
+
--kumiko-settle-ease: cubic-bezier(0.2, 0, 0, 1);
|
|
115
|
+
--kumiko-lift-duration: 100ms;
|
|
116
|
+
--kumiko-lift-ease: cubic-bezier(0.2, 0, 0, 1);
|
|
117
|
+
--kumiko-lift-scale: 1.01;
|
|
118
|
+
--kumiko-pop-duration: 80ms;
|
|
119
|
+
--kumiko-pop-scale: 0.98;
|
|
120
|
+
--kumiko-pop-distance: 2px;
|
|
121
|
+
--kumiko-spin-duration: 600ms;
|
|
122
|
+
--kumiko-stagger: 20ms;
|
|
123
|
+
--kumiko-press-duration: 60ms;
|
|
124
|
+
--kumiko-press-scale: 1;
|
|
125
|
+
--kumiko-hover-scale: 1.05;
|
|
126
|
+
--kumiko-hover-tilt: 0deg;
|
|
127
|
+
--kumiko-squash-x: 1;
|
|
128
|
+
--kumiko-squash-y: 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[data-kumiko-motion="still"] {
|
|
132
|
+
--kumiko-move-duration: 0ms;
|
|
133
|
+
--kumiko-settle-duration: 0ms;
|
|
134
|
+
--kumiko-lift-duration: 0ms;
|
|
135
|
+
--kumiko-lift-scale: 1;
|
|
136
|
+
--kumiko-pop-duration: 0ms;
|
|
137
|
+
--kumiko-pop-scale: 1;
|
|
138
|
+
--kumiko-pop-distance: 0px;
|
|
139
|
+
--kumiko-spin-duration: 4s;
|
|
140
|
+
--kumiko-stagger: 0ms;
|
|
141
|
+
--kumiko-press-duration: 0ms;
|
|
142
|
+
--kumiko-press-scale: 1;
|
|
143
|
+
--kumiko-hover-scale: 1;
|
|
144
|
+
--kumiko-hover-tilt: 0deg;
|
|
145
|
+
--kumiko-squash-x: 1;
|
|
146
|
+
--kumiko-squash-y: 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
:root,
|
|
151
|
+
[data-kumiko-motion] {
|
|
152
|
+
--kumiko-move-duration: 0ms;
|
|
153
|
+
--kumiko-settle-duration: 0ms;
|
|
154
|
+
--kumiko-lift-duration: 0ms;
|
|
155
|
+
--kumiko-lift-scale: 1;
|
|
156
|
+
--kumiko-pop-duration: 0ms;
|
|
157
|
+
--kumiko-pop-scale: 1;
|
|
158
|
+
--kumiko-pop-distance: 0px;
|
|
159
|
+
--kumiko-spin-duration: 4s;
|
|
160
|
+
--kumiko-stagger: 0ms;
|
|
161
|
+
--kumiko-press-duration: 0ms;
|
|
162
|
+
--kumiko-press-scale: 1;
|
|
163
|
+
--kumiko-hover-scale: 1;
|
|
164
|
+
--kumiko-hover-tilt: 0deg;
|
|
165
|
+
--kumiko-squash-x: 1;
|
|
166
|
+
--kumiko-squash-y: 1;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createPopoverController, Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverShortcut, PopoverTitle, PopoverTrigger, type PopoverApi, type PopoverContentProps, type PopoverContentState, type PopoverController, type PopoverDismissReason, type PopoverFinalFocus, type PopoverInitialFocus, type PopoverOpenChangeReason, type PopoverOptions, type PopoverPayloadChangeReason, type PopoverProps, type PopoverTriggerProps, type PopoverTriggerState } from "@ui-sdk/react/popover";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createPopoverController, Popover, PopoverArrow, PopoverClose, PopoverContent, PopoverDescription, PopoverShortcut, PopoverTitle, PopoverTrigger } from "@ui-sdk/react/popover";
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
@import "../motion/motion.css";
|
|
2
|
+
|
|
3
|
+
@layer kumiko {
|
|
4
|
+
:where(:root) {
|
|
5
|
+
--kumiko-popover-bg: Canvas;
|
|
6
|
+
--kumiko-popover-fg: CanvasText;
|
|
7
|
+
--kumiko-popover-border-width: 1px;
|
|
8
|
+
--kumiko-popover-radius: 0.75rem;
|
|
9
|
+
--kumiko-popover-shadow: 0 12px 32px -10px color-mix(in oklab, CanvasText 32%, transparent);
|
|
10
|
+
--kumiko-popover-padding: 0.875rem;
|
|
11
|
+
--kumiko-popover-width: auto;
|
|
12
|
+
--kumiko-popover-max-width: 22rem;
|
|
13
|
+
--kumiko-popover-font-size: 0.875rem;
|
|
14
|
+
--kumiko-popover-title-size: 1em;
|
|
15
|
+
--kumiko-popover-title-weight: 600;
|
|
16
|
+
--kumiko-popover-description-size: 0.93em;
|
|
17
|
+
--kumiko-popover-description-weight: 400;
|
|
18
|
+
--kumiko-popover-arrow-size: 0.75rem;
|
|
19
|
+
--kumiko-popover-sheet-max-height: 85dvh;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Derived colours resolve on the popover, so they follow a fg and bg set on any container. */
|
|
23
|
+
:where([data-slot="popover-content"]) {
|
|
24
|
+
--_popover-border: var(
|
|
25
|
+
--kumiko-popover-border,
|
|
26
|
+
color-mix(in oklab, var(--kumiko-popover-fg) 14%, transparent)
|
|
27
|
+
);
|
|
28
|
+
--_popover-muted-fg: var(
|
|
29
|
+
--kumiko-popover-muted-fg,
|
|
30
|
+
color-mix(in oklab, var(--kumiko-popover-fg) 64%, var(--kumiko-popover-bg))
|
|
31
|
+
);
|
|
32
|
+
--_popover-scrollbar-thumb: var(
|
|
33
|
+
--kumiko-popover-scrollbar-thumb,
|
|
34
|
+
color-mix(in oklab, var(--kumiko-popover-fg) 40%, transparent)
|
|
35
|
+
);
|
|
36
|
+
--_popover-scrollbar-track: var(--kumiko-popover-scrollbar-track, transparent);
|
|
37
|
+
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: var(--kumiko-popover-padding);
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
overscroll-behavior: contain;
|
|
43
|
+
scrollbar-width: thin;
|
|
44
|
+
scrollbar-color: var(--_popover-scrollbar-thumb) var(--_popover-scrollbar-track);
|
|
45
|
+
border: var(--kumiko-popover-border-width) solid var(--_popover-border);
|
|
46
|
+
border-radius: var(--kumiko-popover-radius);
|
|
47
|
+
background: var(--kumiko-popover-bg);
|
|
48
|
+
box-shadow: var(--kumiko-popover-shadow);
|
|
49
|
+
color: var(--kumiko-popover-fg);
|
|
50
|
+
font-size: var(--kumiko-popover-font-size);
|
|
51
|
+
line-height: 1.4;
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (prefers-contrast: more) {
|
|
56
|
+
:where([data-slot="popover-content"]) {
|
|
57
|
+
--_popover-scrollbar-thumb: CanvasText;
|
|
58
|
+
--_popover-scrollbar-track: Canvas;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* The arrow sticks out of the panel, so a panel with one can't clip it by scrolling. */
|
|
63
|
+
:where([data-slot="popover-content"]:has(> [data-slot="popover-arrow"])) {
|
|
64
|
+
overflow: visible;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* A sheet's size and slide belong to ui-sdk, so only a floating popover gets a width and grows. */
|
|
68
|
+
:where([data-slot="popover-content"][data-presentation="popover"]) {
|
|
69
|
+
--_popover-from: 0 0;
|
|
70
|
+
/* No scale or translate at rest: any other value than none would clip fixed-position descendants. */
|
|
71
|
+
|
|
72
|
+
inline-size: var(--kumiko-popover-width);
|
|
73
|
+
max-inline-size: min(var(--kumiko-popover-max-width), var(--available-width, 100dvw));
|
|
74
|
+
max-block-size: var(--available-height, 100dvh);
|
|
75
|
+
transform-origin: var(--transform-origin);
|
|
76
|
+
transition-property: opacity, scale, translate;
|
|
77
|
+
/* Opening is quicker than closing, so a popover opened again and again never feels slow. */
|
|
78
|
+
transition-duration:
|
|
79
|
+
calc(var(--kumiko-fade-duration) * 0.6), var(--kumiko-pop-duration),
|
|
80
|
+
var(--kumiko-pop-duration);
|
|
81
|
+
transition-timing-function:
|
|
82
|
+
var(--kumiko-enter-ease), var(--kumiko-pop-ease), var(--kumiko-pop-ease);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:where([data-slot="popover-content"][data-presentation="popover"][data-side="bottom"]) {
|
|
86
|
+
--_popover-from: 0 calc(var(--kumiko-pop-distance) * -1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:where([data-slot="popover-content"][data-presentation="popover"][data-side="top"]) {
|
|
90
|
+
--_popover-from: 0 var(--kumiko-pop-distance);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:where([data-slot="popover-content"][data-presentation="popover"][data-side="right"]) {
|
|
94
|
+
--_popover-from: calc(var(--kumiko-pop-distance) * -1) 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:where([data-slot="popover-content"][data-presentation="popover"][data-side="left"]) {
|
|
98
|
+
--_popover-from: var(--kumiko-pop-distance) 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:where([data-slot="popover-content"][data-presentation="popover"]):where(
|
|
102
|
+
[data-starting-style],
|
|
103
|
+
[data-ending-style]
|
|
104
|
+
) {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
scale: var(--kumiko-pop-scale);
|
|
107
|
+
translate: var(--_popover-from);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:where([data-slot="popover-content"][data-presentation="popover"][data-ending-style]) {
|
|
111
|
+
/* Closing, the shrink and slide last as long as the fade and on its curve, so they never stop mid-fade. */
|
|
112
|
+
transition-duration: var(--kumiko-fade-duration);
|
|
113
|
+
transition-timing-function: var(--kumiko-exit-ease);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* With reduced or still motion the popover only fades, so scale and translate have nothing to animate. */
|
|
117
|
+
@media (prefers-reduced-motion: reduce) {
|
|
118
|
+
:where([data-slot="popover-content"][data-presentation="popover"]) {
|
|
119
|
+
transition-property: opacity;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:where(
|
|
124
|
+
[data-kumiko-motion="still"] [data-slot="popover-content"][data-presentation="popover"]
|
|
125
|
+
) {
|
|
126
|
+
transition-property: opacity;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* A sheet rises from the bottom edge, so only its top corners are round. ui-sdk lets it grow with its content, so it's capped here and scrolls. */
|
|
130
|
+
:where([data-slot="popover-content"][data-presentation="sheet"]) {
|
|
131
|
+
max-block-size: var(--kumiko-popover-sheet-max-height);
|
|
132
|
+
border-end-start-radius: 0;
|
|
133
|
+
border-end-end-radius: 0;
|
|
134
|
+
|
|
135
|
+
/* ui-sdk sets overscroll-behavior: contain inline on a sheet, which keeps a swipe the panel can't scroll from closing it. Only !important beats that. */
|
|
136
|
+
overscroll-behavior: auto !important;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:where([data-slot="popover-title"]) {
|
|
140
|
+
margin: 0;
|
|
141
|
+
color: var(--kumiko-popover-title-fg, inherit);
|
|
142
|
+
font-size: var(--kumiko-popover-title-size);
|
|
143
|
+
font-weight: var(--kumiko-popover-title-weight);
|
|
144
|
+
line-height: 1.3;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:where([data-slot="popover-description"]) {
|
|
148
|
+
margin: 0.25rem 0 0;
|
|
149
|
+
color: var(--kumiko-popover-description-fg, var(--_popover-muted-fg));
|
|
150
|
+
font-size: var(--kumiko-popover-description-size);
|
|
151
|
+
font-weight: var(--kumiko-popover-description-weight);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* A square turned 45 degrees with an edge on the two sides that point out. Its middle sits on
|
|
156
|
+
* the panel's edge, so its tip points at the trigger. ui-sdk sets where it lies along that
|
|
157
|
+
* edge (inline left or top, from --arrow-offset), so only the edge it sits on is set here.
|
|
158
|
+
*/
|
|
159
|
+
:where([data-slot="popover-arrow"]) {
|
|
160
|
+
--_arrow: var(--kumiko-popover-arrow-size);
|
|
161
|
+
--_arrow-edge: calc(var(--_arrow) / -2 - var(--kumiko-popover-border-width));
|
|
162
|
+
|
|
163
|
+
position: absolute;
|
|
164
|
+
box-sizing: border-box;
|
|
165
|
+
inline-size: var(--_arrow);
|
|
166
|
+
block-size: var(--_arrow);
|
|
167
|
+
border: 0 solid var(--_popover-border);
|
|
168
|
+
background: var(--kumiko-popover-bg);
|
|
169
|
+
pointer-events: none;
|
|
170
|
+
rotate: 45deg;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:where([data-slot="popover-arrow"][data-side="bottom"]) {
|
|
174
|
+
inset-block-start: var(--_arrow-edge);
|
|
175
|
+
border-top-width: var(--kumiko-popover-border-width);
|
|
176
|
+
border-left-width: var(--kumiko-popover-border-width);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
:where([data-slot="popover-arrow"][data-side="top"]) {
|
|
180
|
+
inset-block-end: var(--_arrow-edge);
|
|
181
|
+
border-right-width: var(--kumiko-popover-border-width);
|
|
182
|
+
border-bottom-width: var(--kumiko-popover-border-width);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:where([data-slot="popover-arrow"][data-side="right"]) {
|
|
186
|
+
left: var(--_arrow-edge);
|
|
187
|
+
border-bottom-width: var(--kumiko-popover-border-width);
|
|
188
|
+
border-left-width: var(--kumiko-popover-border-width);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
:where([data-slot="popover-arrow"][data-side="left"]) {
|
|
192
|
+
right: var(--_arrow-edge);
|
|
193
|
+
border-top-width: var(--kumiko-popover-border-width);
|
|
194
|
+
border-right-width: var(--kumiko-popover-border-width);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* A sheet rises whole from the bottom, with nothing to point at. */
|
|
198
|
+
:where([data-slot="popover-content"][data-presentation="sheet"] > [data-slot="popover-arrow"]) {
|
|
199
|
+
display: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
:where([data-slot="popover-shortcut"]) {
|
|
203
|
+
margin-inline-start: 0.5rem;
|
|
204
|
+
color: var(--_popover-muted-fg);
|
|
205
|
+
font-size: 0.9em;
|
|
206
|
+
font-variant-numeric: tabular-nums;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Progress, type IndeterminateStyle, type ProgressProps } from "./progress";
|
|
2
|
+
export { ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, type GaugeLabelDetails, type NumberFormat, type ProgressOptions, type ProgressPrimitive, type ProgressState, type ProgressStatus, type ProgressValueState } from "@ui-sdk/react/progress";
|