gooee 0.48.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -2
- package/scripts/add.js +28 -6
- package/src/components/Accordion/Accordion.vue +62 -0
- package/src/components/Accordion/AccordionItem.vue +45 -0
- package/src/components/Accordion/accordionContext.ts +6 -0
- package/src/components/Alert/Alert.tsx +7 -27
- package/src/components/Alert/Alert.vue +59 -0
- package/src/components/AlertDialog/AlertDialog.vue +126 -0
- package/src/components/AnimatedNumber/AnimatedNumber.vue +36 -0
- package/src/components/AspectRatio/AspectRatio.vue +17 -0
- package/src/components/Avatar/Avatar.vue +56 -0
- package/src/components/AvatarGroup/AvatarGroup.vue +42 -0
- package/src/components/Badge/Badge.vue +32 -0
- package/src/components/Breadcrumb/Breadcrumb.vue +58 -0
- package/src/components/Button/Button.vue +130 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +4 -21
- package/src/components/ButtonGroup/ButtonGroup.vue +33 -0
- package/src/components/Card/Card.vue +34 -0
- package/src/components/Center/Center.vue +32 -0
- package/src/components/Checkbox/Checkbox.tsx +8 -25
- package/src/components/Checkbox/Checkbox.vue +108 -0
- package/src/components/CheckboxGroup/CheckboxGroup.vue +76 -0
- package/src/components/Cluster/Cluster.vue +34 -0
- package/src/components/CodeBlock/CodeBlock.vue +45 -0
- package/src/components/Collapsible/Collapsible.vue +59 -0
- package/src/components/Container/Container.vue +22 -0
- package/src/components/CopyButton/CopyButton.tsx +3 -49
- package/src/components/CopyButton/CopyButton.vue +116 -0
- package/src/components/Dial/Dial.tsx +12 -120
- package/src/components/Dial/Dial.vue +228 -0
- package/src/components/Dialog/Dialog.vue +139 -0
- package/src/components/Divider/Divider.vue +27 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +11 -46
- package/src/components/DropdownMenu/DropdownMenu.vue +185 -0
- package/src/components/EmptyState/EmptyState.vue +33 -0
- package/src/components/Fab/Fab.tsx +4 -14
- package/src/components/Fab/Fab.vue +115 -0
- package/src/components/Fieldset/Fieldset.vue +42 -0
- package/src/components/FormField/FormField.tsx +2 -17
- package/src/components/FormField/FormField.vue +64 -0
- package/src/components/Grid/Grid.vue +43 -0
- package/src/components/HoldToConfirm/HoldToConfirm.tsx +13 -142
- package/src/components/HoldToConfirm/HoldToConfirm.vue +281 -0
- package/src/components/IconButton/IconButton.vue +25 -0
- package/src/components/Input/Input.vue +112 -0
- package/src/components/InputGroup/InputGroup.vue +102 -0
- package/src/components/Kbd/Kbd.tsx +2 -12
- package/src/components/Kbd/Kbd.vue +21 -0
- package/src/components/Link/Link.vue +38 -0
- package/src/components/LivePill/LivePill.tsx +12 -40
- package/src/components/LivePill/LivePill.vue +152 -0
- package/src/components/Meter/Meter.vue +88 -0
- package/src/components/MorphButton/MorphButton.tsx +11 -67
- package/src/components/MorphButton/MorphButton.vue +120 -0
- package/src/components/NumberInput/NumberInput.tsx +11 -48
- package/src/components/NumberInput/NumberInput.vue +184 -0
- package/src/components/Pagination/Pagination.tsx +2 -15
- package/src/components/Pagination/Pagination.vue +87 -0
- package/src/components/Pagination/range.ts +15 -0
- package/src/components/PasswordInput/PasswordInput.vue +53 -0
- package/src/components/PickerWheel/DateWheel.vue +48 -0
- package/src/components/PickerWheel/PickerWheel.tsx +15 -129
- package/src/components/PickerWheel/PickerWheel.vue +77 -0
- package/src/components/PickerWheel/TimeWheel.vue +50 -0
- package/src/components/PickerWheel/WheelColumn.vue +70 -0
- package/src/components/Popover/Popover.vue +108 -0
- package/src/components/ProgressBar/ProgressBar.vue +48 -0
- package/src/components/Prose/Prose.vue +18 -0
- package/src/components/Radio/Radio.vue +49 -0
- package/src/components/Radio/RadioGroup.vue +69 -0
- package/src/components/Retime/Retime.tsx +7 -40
- package/src/components/Retime/Retime.vue +64 -0
- package/src/components/RulerScrubber/RulerScrubber.tsx +9 -38
- package/src/components/RulerScrubber/RulerScrubber.vue +166 -0
- package/src/components/ScrollArea/ScrollArea.tsx +17 -129
- package/src/components/ScrollArea/ScrollArea.vue +58 -0
- package/src/components/SearchInput/SearchInput.tsx +2 -15
- package/src/components/SearchInput/SearchInput.vue +70 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +7 -51
- package/src/components/SegmentedControl/SegmentedControl.vue +111 -0
- package/src/components/Select/Select.tsx +16 -47
- package/src/components/Select/Select.vue +236 -0
- package/src/components/Sheet/Sheet.tsx +52 -231
- package/src/components/Sheet/Sheet.vue +249 -0
- package/src/components/Skeleton/Skeleton.vue +38 -0
- package/src/components/Slider/Slider.tsx +25 -84
- package/src/components/Slider/Slider.vue +113 -0
- package/src/components/Spinner/Spinner.vue +30 -0
- package/src/components/Split/Split.vue +34 -0
- package/src/components/SplitFlap/SplitFlap.tsx +11 -175
- package/src/components/SplitFlap/SplitFlap.vue +52 -0
- package/src/components/Stack/Stack.vue +22 -0
- package/src/components/SwipeDeck/SwipeDeck.tsx +30 -194
- package/src/components/SwipeDeck/SwipeDeck.vue +168 -0
- package/src/components/Switch/Switch.tsx +6 -75
- package/src/components/Switch/Switch.vue +66 -0
- package/src/components/Table/Table.module.css +12 -3
- package/src/components/Table/Table.tsx +8 -59
- package/src/components/Table/Table.vue +274 -0
- package/src/components/TableOfContents/TableOfContents.vue +90 -0
- package/src/components/Tabs/Tab.vue +37 -0
- package/src/components/Tabs/TabList.vue +47 -0
- package/src/components/Tabs/TabPanel.vue +26 -0
- package/src/components/Tabs/Tabs.module.css +2 -2
- package/src/components/Tabs/Tabs.tsx +11 -84
- package/src/components/Tabs/Tabs.vue +33 -0
- package/src/components/Tabs/tabsContext.ts +15 -0
- package/src/components/Tag/Tag.tsx +6 -26
- package/src/components/Tag/Tag.vue +63 -0
- package/src/components/Textarea/Textarea.tsx +2 -22
- package/src/components/Textarea/Textarea.vue +120 -0
- package/src/components/ThemeToggle/ThemeToggle.tsx +10 -84
- package/src/components/ThemeToggle/ThemeToggle.vue +90 -0
- package/src/components/Toast/Toast.tsx +34 -264
- package/src/components/Toast/Toast.vue +138 -0
- package/src/components/Toast/ToastItem.vue +108 -0
- package/src/components/Toggle/Toggle.vue +52 -0
- package/src/components/Tooltip/Tooltip.tsx +17 -48
- package/src/components/Tooltip/Tooltip.vue +95 -0
- package/src/components/VisuallyHidden/VisuallyHidden.vue +17 -0
- package/src/internal/FieldMessage.vue +41 -0
- package/src/internal/Roll.vue +20 -0
- package/src/internal/fling.ts +29 -106
- package/src/internal/focus.ts +4 -79
- package/src/internal/icons.module.css +39 -27
- package/src/internal/layers.ts +7 -61
- package/src/internal/liquid.ts +26 -213
- package/src/internal/liquidMatter.ts +9 -181
- package/src/internal/liquidMore.ts +6 -669
- package/src/internal/motion/alert.ts +17 -0
- package/src/internal/motion/buttonGroup.ts +21 -0
- package/src/internal/motion/checkbox.ts +39 -0
- package/src/internal/motion/collapseOut.ts +26 -0
- package/src/internal/motion/copyButton.ts +48 -0
- package/src/internal/motion/dial.ts +137 -0
- package/src/internal/motion/fab.ts +14 -0
- package/src/internal/motion/fling.ts +147 -0
- package/src/internal/motion/floating.ts +58 -0
- package/src/internal/motion/focus.ts +88 -0
- package/src/internal/motion/formField.ts +19 -0
- package/src/internal/motion/holdToConfirm.ts +147 -0
- package/src/internal/motion/index.ts +20 -0
- package/src/internal/motion/keys.ts +42 -0
- package/src/internal/motion/layers.ts +78 -0
- package/src/internal/motion/liquid.ts +241 -0
- package/src/internal/motion/liquidMatter.ts +198 -0
- package/src/internal/motion/liquidMore.ts +676 -0
- package/src/internal/motion/listbox.ts +69 -0
- package/src/internal/motion/livePill.ts +71 -0
- package/src/internal/motion/menuKeys.ts +58 -0
- package/src/internal/motion/morphButton.ts +71 -0
- package/src/internal/motion/numberInput.ts +57 -0
- package/src/internal/motion/pickerWheel.ts +166 -0
- package/src/internal/motion/retime.ts +45 -0
- package/src/internal/motion/ruler.ts +57 -0
- package/src/internal/motion/scrollArea.ts +133 -0
- package/src/internal/motion/scrollFrame.ts +152 -0
- package/src/internal/motion/scrubLook.ts +15 -0
- package/src/internal/motion/scrubber.ts +154 -0
- package/src/internal/motion/segmented.ts +63 -0
- package/src/internal/motion/sheetDetents.ts +271 -0
- package/src/internal/motion/slider.ts +108 -0
- package/src/internal/motion/softPress.ts +334 -0
- package/src/internal/motion/splitFlap.ts +205 -0
- package/src/internal/motion/swipeDeck.ts +236 -0
- package/src/internal/motion/switchThumb.ts +83 -0
- package/src/internal/motion/table.ts +77 -0
- package/src/internal/motion/tabs.ts +105 -0
- package/src/internal/motion/textarea.ts +22 -0
- package/src/internal/motion/themeIcon.ts +91 -0
- package/src/internal/motion/themeReveal.ts +71 -0
- package/src/internal/motion/toast.ts +291 -0
- package/src/internal/motion/tooltip.ts +58 -0
- package/src/internal/scrollFrame.ts +4 -145
- package/src/internal/softPress.ts +27 -289
- package/src/internal/themeReveal.ts +3 -61
- package/src/internal/useFloating.ts +9 -49
- package/src/internal/useScrub.ts +15 -120
- package/src/internal/vue/trigger.ts +18 -0
- package/src/internal/vue/useFloating.ts +38 -0
- package/src/internal/vue/usePresence.ts +21 -0
- package/src/internal/vue/useScrub.ts +40 -0
- package/src/internal/vueIcons.ts +134 -0
- package/src/tokens.css +5 -0
- package/src/internal/relativeTime.ts +0 -26
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { easing, motionMs, prefersReducedMotion } from '../motion'
|
|
2
|
+
|
|
3
|
+
// The new theme grows from the spot you pressed: the page is snapshot as it is, and the new page opens
|
|
4
|
+
// over it in a circle from the button's centre to the farthest corner, at an even pace. The old snapshot
|
|
5
|
+
// stays still under it, and no element plays its own colour change meanwhile, so nothing flips piece by
|
|
6
|
+
// piece. A second press finishes the running one first. Without View Transitions the page fades in once;
|
|
7
|
+
// with reduced motion it changes at once.
|
|
8
|
+
|
|
9
|
+
let running: ViewTransition | null = null
|
|
10
|
+
|
|
11
|
+
// The radius whose circle covers `share` of the screen, by halving, counted on a coarse grid.
|
|
12
|
+
function radiusFor(share: number, x: number, y: number, reach: number) {
|
|
13
|
+
if (share >= 1) return reach
|
|
14
|
+
const cols = 48, rows = 32
|
|
15
|
+
const covered = (r: number) => {
|
|
16
|
+
let n = 0
|
|
17
|
+
for (let j = 0; j < rows; j++) for (let i = 0; i < cols; i++) if (Math.hypot(((i + 0.5) * innerWidth) / cols - x, ((j + 0.5) * innerHeight) / rows - y) <= r) n++
|
|
18
|
+
return n / (cols * rows)
|
|
19
|
+
}
|
|
20
|
+
let lo = 0, hi = reach
|
|
21
|
+
for (let k = 0; k < 18; k++) {
|
|
22
|
+
const m = (lo + hi) / 2
|
|
23
|
+
if (covered(m) < share) lo = m
|
|
24
|
+
else hi = m
|
|
25
|
+
}
|
|
26
|
+
return hi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Plays the theme change from `origin`. `applyNow` must put the new theme in the page before it returns
|
|
31
|
+
* (or before its promise settles), since the view transition photographs the page right after it: React
|
|
32
|
+
* wraps its update in flushSync, Vue awaits nextTick.
|
|
33
|
+
*/
|
|
34
|
+
export function themeReveal(origin: Element | null, applyNow: () => void | Promise<void>) {
|
|
35
|
+
const root = document.documentElement
|
|
36
|
+
const ms = motionMs('reveal')
|
|
37
|
+
if (prefersReducedMotion() || !ms) return void applyNow()
|
|
38
|
+
running?.skipTransition()
|
|
39
|
+
root.dataset.gooeeThemeSwitch = ''
|
|
40
|
+
const done = () => delete root.dataset.gooeeThemeSwitch
|
|
41
|
+
if (typeof document.startViewTransition !== 'function') {
|
|
42
|
+
void applyNow()
|
|
43
|
+
document.body.animate([{ opacity: 0.4 }, { opacity: 1 }], { duration: ms * 0.6, easing: easing('morph') }).finished.then(done, done)
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
const r = origin?.getBoundingClientRect()
|
|
47
|
+
const x = r ? r.left + r.width / 2 : innerWidth / 2
|
|
48
|
+
const y = r ? r.top + r.height / 2 : 0
|
|
49
|
+
const reach = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y))
|
|
50
|
+
const vt = document.startViewTransition(applyNow)
|
|
51
|
+
running = vt
|
|
52
|
+
vt.ready.then(
|
|
53
|
+
// The share of the screen covered grows at an even, calm pace (ease out): a circle's area grows with
|
|
54
|
+
// the radius squared, so each step's radius is solved for its share; linear in between.
|
|
55
|
+
() =>
|
|
56
|
+
root.animate(
|
|
57
|
+
{ clipPath: Array.from({ length: 21 }, (_, i) => `circle(${radiusFor(1 - (1 - i / 20) ** 2, x, y, reach)}px at ${x}px ${y}px)`) },
|
|
58
|
+
{ duration: ms, easing: 'linear', pseudoElement: '::view-transition-new(root)' },
|
|
59
|
+
),
|
|
60
|
+
() => {},
|
|
61
|
+
)
|
|
62
|
+
vt.finished.finally(() => {
|
|
63
|
+
if (running !== vt) return
|
|
64
|
+
running = null
|
|
65
|
+
done()
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Put in <head>, before the page paints, so a saved dark theme never flashes light first. */
|
|
70
|
+
export const themeScript = (storageKey = 'gooee-theme') =>
|
|
71
|
+
`try{var t=localStorage.getItem(${JSON.stringify(storageKey)});if(t!=='light'&&t!=='dark')t=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';document.documentElement.dataset.theme=t}catch(e){}`
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { speedTracker } from '../feel'
|
|
2
|
+
import { BEND, body, budScene, exitToward, loopsPath, pincher, sdBox, trace, type Box, type Pt } from '../liquidPath'
|
|
3
|
+
import { release } from './fling'
|
|
4
|
+
import { castShadow, frames, layer, morphEase, motionFor, shadowOf } from './liquidMatter'
|
|
5
|
+
|
|
6
|
+
// The toast stack, the same in every framework: where each toast sits, how long it stays, the throw
|
|
7
|
+
// that sends it away, and the drop it buds out of.
|
|
8
|
+
|
|
9
|
+
export type ToastVariant = 'default' | 'success' | 'error' | 'info' | 'loading'
|
|
10
|
+
export type ToastOrigin = HTMLElement | { x: number; y: number }
|
|
11
|
+
export type ToastLeaving = false | 'down' | 'left' | 'right'
|
|
12
|
+
|
|
13
|
+
const GAP = 8
|
|
14
|
+
export const TOAST_PEEK = 10
|
|
15
|
+
// px per second: a toast thrown sideways this fast goes, however short the throw.
|
|
16
|
+
const THROW_SPEED = 600
|
|
17
|
+
|
|
18
|
+
let nextId = 1
|
|
19
|
+
export const toastId = () => nextId++
|
|
20
|
+
|
|
21
|
+
/** What a screen reader hears. The same text twice is not read again, so a trailing space makes it change. */
|
|
22
|
+
export function toastSay(prev: string, opts: { title?: string; description?: string }) {
|
|
23
|
+
const text = `${opts.title}${opts.description ? `. ${opts.description}` : ''}`
|
|
24
|
+
return prev === text ? `${text} ` : text
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Where each toast sits, newest first, and how tall the stack is. */
|
|
28
|
+
export function toastLayout<T extends { id: number; leaving: ToastLeaving }>(items: T[], heights: Record<number, number>, expanded: boolean, visible: number) {
|
|
29
|
+
const live = items.filter((t) => !t.leaving)
|
|
30
|
+
const order = [...items].reverse()
|
|
31
|
+
let offset = 0
|
|
32
|
+
const layout = order.map((t) => {
|
|
33
|
+
const liveIndex = live.length - 1 - live.findIndex((x) => x.id === t.id)
|
|
34
|
+
const index = t.leaving ? -1 : liveIndex
|
|
35
|
+
const y = offset
|
|
36
|
+
if (!t.leaving) offset += (heights[t.id] ?? 64) + GAP
|
|
37
|
+
return { t, index, y }
|
|
38
|
+
})
|
|
39
|
+
const frontHeight = live.length ? (heights[live[live.length - 1].id] ?? 64) : 0
|
|
40
|
+
const stackHeight = expanded ? offset : frontHeight + Math.min(live.length - 1, visible - 1) * TOAST_PEEK
|
|
41
|
+
return { layout, live: live.length, frontHeight, height: live.length ? stackHeight : 0 }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A toast's place in the stack: up by its offset when fanned out, else peeking out behind the front one. */
|
|
45
|
+
export const toastStack = (index: number, y: number, expanded: boolean) => ({
|
|
46
|
+
y: expanded ? -y : -Math.min(index, 3) * TOAST_PEEK,
|
|
47
|
+
scale: expanded ? 1 : 1 - Math.min(index, 3) * 0.05,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
/** The toast's natural height, even while clamped behind the front toast. Calls `onHeight` as it changes. Returns a stop. */
|
|
51
|
+
export function watchToastHeight(el: HTMLElement, onHeight: (h: number) => void) {
|
|
52
|
+
const measure = () => onHeight(el.scrollHeight + el.offsetHeight - el.clientHeight)
|
|
53
|
+
const ro = new ResizeObserver(measure)
|
|
54
|
+
ro.observe(el)
|
|
55
|
+
measure()
|
|
56
|
+
return () => ro.disconnect()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Counts down `left.current` ms, then calls `done`. While the tab is hidden it waits. Returns a stop
|
|
61
|
+
* that keeps what is left in `left.current`, so the count goes on where it paused.
|
|
62
|
+
*/
|
|
63
|
+
export function toastTimer(left: { current: number }, done: () => void) {
|
|
64
|
+
let start = performance.now()
|
|
65
|
+
let t = window.setTimeout(done, left.current)
|
|
66
|
+
const onVis = () => {
|
|
67
|
+
if (document.hidden) {
|
|
68
|
+
window.clearTimeout(t)
|
|
69
|
+
left.current -= performance.now() - start
|
|
70
|
+
} else {
|
|
71
|
+
start = performance.now()
|
|
72
|
+
t = window.setTimeout(done, left.current)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
document.addEventListener('visibilitychange', onVis)
|
|
76
|
+
return () => {
|
|
77
|
+
window.clearTimeout(t)
|
|
78
|
+
if (!document.hidden) left.current -= performance.now() - start
|
|
79
|
+
document.removeEventListener('visibilitychange', onVis)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type PointerLike = { clientX: number; pointerId: number; type: string; target: EventTarget | null; currentTarget: EventTarget | null }
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A toast the hand throws sideways. Where it is drawn goes straight on --dx, so a glide does not render
|
|
87
|
+
* every frame. A let-go past 80px, or a throw, sends it off the way it went; any other let-go glides it back.
|
|
88
|
+
*/
|
|
89
|
+
export function createToastSwipe(
|
|
90
|
+
target: () => HTMLElement | null,
|
|
91
|
+
{ leaving, dragging, dismiss }: { leaving: () => boolean; dragging: (on: boolean) => void; dismiss: (way: 'left' | 'right') => void },
|
|
92
|
+
) {
|
|
93
|
+
let at = 0
|
|
94
|
+
let stop = () => {}
|
|
95
|
+
let swipe: { x: number; dx: number; speed: ReturnType<typeof speedTracker> } | null = null
|
|
96
|
+
const paint = (v: number) => {
|
|
97
|
+
at = v
|
|
98
|
+
target()?.style.setProperty('--dx', `${v}px`)
|
|
99
|
+
}
|
|
100
|
+
const fling = (to: number, speed: number) => {
|
|
101
|
+
const el = target()
|
|
102
|
+
stop()
|
|
103
|
+
el?.setAttribute('data-fluid', '')
|
|
104
|
+
stop = release(at, to, speed, paint, () => {
|
|
105
|
+
if (to === 0) el?.removeAttribute('data-fluid')
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
stop: () => stop(),
|
|
110
|
+
down(e: PointerLike) {
|
|
111
|
+
if ((e.target as HTMLElement).closest('button') || leaving()) return
|
|
112
|
+
stop()
|
|
113
|
+
// Caught mid-glide, it carries on from where it is.
|
|
114
|
+
swipe = { x: e.clientX - at, dx: at, speed: speedTracker() }
|
|
115
|
+
swipe.speed.add(at)
|
|
116
|
+
;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
|
|
117
|
+
dragging(true)
|
|
118
|
+
},
|
|
119
|
+
move(e: PointerLike) {
|
|
120
|
+
const s = swipe
|
|
121
|
+
if (!s) return
|
|
122
|
+
s.dx = e.clientX - s.x
|
|
123
|
+
s.speed.add(s.dx)
|
|
124
|
+
paint(s.dx)
|
|
125
|
+
},
|
|
126
|
+
up(e: PointerLike) {
|
|
127
|
+
const s = swipe
|
|
128
|
+
swipe = null
|
|
129
|
+
dragging(false)
|
|
130
|
+
if (!s) return
|
|
131
|
+
const speed = e.type === 'pointercancel' ? 0 : s.speed.speed()
|
|
132
|
+
const thrown = Math.abs(speed) > THROW_SPEED && Math.abs(s.dx) > 20
|
|
133
|
+
if (e.type !== 'pointercancel' && (Math.abs(s.dx) > 80 || thrown)) {
|
|
134
|
+
// It leaves the way it was thrown, or the way it was pulled when let go slowly.
|
|
135
|
+
const way = Math.sign(thrown ? speed : s.dx)
|
|
136
|
+
fling(way * (target()?.offsetWidth ?? 0) * 1.1, speed)
|
|
137
|
+
dismiss(way < 0 ? 'left' : 'right')
|
|
138
|
+
} else fling(0, speed)
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const onScreen = (r: DOMRect) => r.width > 0 && r.bottom > 0 && r.right > 0 && r.top < window.innerHeight && r.left < window.innerWidth
|
|
144
|
+
const gapBetween = (a: DOMRect, b: DOMRect) => Math.hypot(Math.max(0, a.left - b.right, b.left - a.right), Math.max(0, a.top - b.bottom, b.top - a.bottom))
|
|
145
|
+
// An origin further than this from the toast would send the drop across the screen.
|
|
146
|
+
const NEAR = 240
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Bud: a drop buds out of `origin`, hangs on a neck that breaks, and grows into the toast (`way` in),
|
|
150
|
+
* or the toast flows back into it (out). With no origin, or one far away, the drop buds out of the
|
|
151
|
+
* window's edge nearest the stack, under the toast. An SVG over the page, with the class `cls`, draws
|
|
152
|
+
* it; the toast itself shows only at the end. Returns a stop, or null when motion is reduced.
|
|
153
|
+
*/
|
|
154
|
+
export function bud(toast: HTMLElement, origin: ToastOrigin | undefined, way: 'in' | 'out', cls: string) {
|
|
155
|
+
const ms = motionFor(way === 'in' ? 'morph' : 'morph-out')
|
|
156
|
+
if (!ms) return null
|
|
157
|
+
const t = toast.getBoundingClientRect()
|
|
158
|
+
const look = getComputedStyle(toast)
|
|
159
|
+
const line = parseFloat(look.borderTopWidth) || 0
|
|
160
|
+
const T: Box = { cx: t.left + t.width / 2, cy: t.top + t.height / 2, hw: t.width / 2, hh: t.height / 2, r: Math.min(t.height / 2, parseFloat(look.borderTopLeftRadius) || 0) }
|
|
161
|
+
let O: Box | null = null
|
|
162
|
+
let exit: Pt = [0, 0]
|
|
163
|
+
let n: Pt = [0, 1]
|
|
164
|
+
let rd = BEND + 3.5
|
|
165
|
+
let cut = false
|
|
166
|
+
const o = origin instanceof HTMLElement ? (origin.isConnected ? origin.getBoundingClientRect() : null) : origin ? new DOMRect(origin.x, origin.y, 1, 1) : null
|
|
167
|
+
const near = !!o && onScreen(o) && gapBetween(o, t) <= NEAR
|
|
168
|
+
if (near && origin instanceof HTMLElement) {
|
|
169
|
+
const h = Math.min(o.width, o.height) / 2
|
|
170
|
+
O = { cx: o.left + o.width / 2, cy: o.top + o.height / 2, hw: o.width / 2, hh: o.height / 2, r: Math.min(h, parseFloat(getComputedStyle(origin).borderTopLeftRadius) || 0) }
|
|
171
|
+
rd = Math.min(rd, Math.max(BEND + 0.5, h * 0.6))
|
|
172
|
+
;({ at: exit, n } = exitToward(O, T, rd))
|
|
173
|
+
cut = true
|
|
174
|
+
} else if (near && origin && !(origin instanceof HTMLElement)) exit = [origin.x, origin.y]
|
|
175
|
+
// Too close to hang a drop between them, or no origin to use: it buds out of the window's edge. The
|
|
176
|
+
// edge is a body just past the screen, its top a stroke's width out, so only the drop and its neck show.
|
|
177
|
+
if (!near || sdBox(exit[0], exit[1], T) < rd * 4) {
|
|
178
|
+
const down = T.cy > window.innerHeight / 2 ? 1 : -1
|
|
179
|
+
rd = BEND + 3.5
|
|
180
|
+
const y = down > 0 ? window.innerHeight + line : -line
|
|
181
|
+
O = { cx: T.cx, cy: y + down * rd * 2, hw: rd * 6, hh: rd * 2, r: rd * 2 }
|
|
182
|
+
exit = [T.cx, y]
|
|
183
|
+
n = [0, -down]
|
|
184
|
+
cut = false
|
|
185
|
+
}
|
|
186
|
+
const { svg, paths } = layer(document.body, cls, null)
|
|
187
|
+
const path = paths[0]
|
|
188
|
+
// The toast's own fill, edge and shadow. The edge is drawn on the outline, so the outline sits half
|
|
189
|
+
// its width inside the toast's box, and the last frame lands on the box exactly.
|
|
190
|
+
path.style.fill = look.backgroundColor
|
|
191
|
+
path.style.stroke = look.borderTopColor
|
|
192
|
+
path.style.strokeWidth = `${line}px`
|
|
193
|
+
castShadow(svg, shadowOf(toast).shadows)
|
|
194
|
+
const inset = line / 2
|
|
195
|
+
const T2: Box = { cx: T.cx, cy: T.cy, hw: T.hw - inset, hh: T.hh - inset, r: Math.max(0, T.r - inset) }
|
|
196
|
+
// The origin keeps its own look: the drawing is cut out where it is.
|
|
197
|
+
if (O && cut) {
|
|
198
|
+
const ns = 'http://www.w3.org/2000/svg'
|
|
199
|
+
const clip = svg.appendChild(document.createElementNS(ns, 'clipPath'))
|
|
200
|
+
const id = `gooee-bud-${Math.random().toString(36).slice(2)}`
|
|
201
|
+
clip.id = id
|
|
202
|
+
const hole = clip.appendChild(document.createElementNS(ns, 'path'))
|
|
203
|
+
const r = Math.min(O.r + 1, O.hh + 1)
|
|
204
|
+
hole.setAttribute('clip-rule', 'evenodd')
|
|
205
|
+
hole.setAttribute(
|
|
206
|
+
'd',
|
|
207
|
+
`M-1 -1H${window.innerWidth + 1}V${window.innerHeight + 1}H-1Z` +
|
|
208
|
+
`M${O.cx - O.hw - 1 + r} ${O.cy - O.hh - 1}H${O.cx + O.hw + 1 - r}A${r} ${r} 0 0 1 ${O.cx + O.hw + 1} ${O.cy - O.hh - 1 + r}V${O.cy + O.hh + 1 - r}A${r} ${r} 0 0 1 ${O.cx + O.hw + 1 - r} ${O.cy + O.hh + 1}H${O.cx - O.hw - 1 + r}A${r} ${r} 0 0 1 ${O.cx - O.hw - 1} ${O.cy + O.hh + 1 - r}V${O.cy - O.hh - 1 + r}A${r} ${r} 0 0 1 ${O.cx - O.hw - 1 + r} ${O.cy - O.hh - 1}Z`,
|
|
209
|
+
)
|
|
210
|
+
path.setAttribute('clip-path', `url(#${id})`)
|
|
211
|
+
}
|
|
212
|
+
const e = morphEase()
|
|
213
|
+
const recoil = motionFor('fast')
|
|
214
|
+
const pin = pincher(e, recoil)
|
|
215
|
+
const across: [number, number] = [n[1], n[0]]
|
|
216
|
+
const anchor: Pt = O ? (n[0] === 0 ? [exit[0], O.cy] : [O.cx, exit[1]]) : exit
|
|
217
|
+
// Once the drop is free it is never joined again, even where the toast sits close to the edge: going
|
|
218
|
+
// in, after the broken neck has sprung back; going out, until the drop hangs again.
|
|
219
|
+
let broke = 0
|
|
220
|
+
// The toast shows once the drop has its shape: at the end going in, at the start going out.
|
|
221
|
+
const show = toast.animate({ opacity: way === 'in' ? [0, 0, 1] : [1, 0, 0], offset: way === 'in' ? [0, 0.82, 1] : [0, 0.15, 1] }, { duration: ms, fill: 'forwards' })
|
|
222
|
+
const stop = frames(
|
|
223
|
+
ms,
|
|
224
|
+
(k, now) => {
|
|
225
|
+
const u = way === 'in' ? k : 1 - k
|
|
226
|
+
const D = budScene(e, u, O, T2, exit, n, rd)
|
|
227
|
+
let sdf = body(D).sdf
|
|
228
|
+
if (O) {
|
|
229
|
+
const free = way === 'in' ? (broke && now - broke >= recoil) || u >= 0.6 : u >= 0.4
|
|
230
|
+
if (free) {
|
|
231
|
+
const a = body(O).sdf
|
|
232
|
+
const b = sdf
|
|
233
|
+
sdf = (x, y) => Math.min(a(x, y), b(x, y))
|
|
234
|
+
} else {
|
|
235
|
+
const p = pin(body(O, anchor), body(D), now)
|
|
236
|
+
if (p.pieces === 2 && !broke) broke = now
|
|
237
|
+
sdf = p.sdf
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const seeds: Array<[number, number, number, number]> = [[D.cx, D.cy, ...across]]
|
|
241
|
+
if (O) seeds.unshift([anchor[0], anchor[1], ...across])
|
|
242
|
+
path.setAttribute('d', loopsPath(trace(sdf, seeds)))
|
|
243
|
+
// A drop from a point fades in where it starts.
|
|
244
|
+
if (!O) svg.style.opacity = String(Math.min(1, u / 0.1))
|
|
245
|
+
},
|
|
246
|
+
() => {
|
|
247
|
+
svg.remove()
|
|
248
|
+
if (way === 'in') show.cancel()
|
|
249
|
+
},
|
|
250
|
+
)
|
|
251
|
+
return () => {
|
|
252
|
+
stop()
|
|
253
|
+
svg.remove()
|
|
254
|
+
show.cancel()
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* The bud of one toast. It plays once going in and once going out; going out it runs on after the toast
|
|
260
|
+
* is gone, so only an entry is stopped on `destroy`. Only the front toast flows out: one behind it folds
|
|
261
|
+
* away under it, and one thrown sideways keeps its throw. Call `place` on each render while it is not
|
|
262
|
+
* leaving, and `change` when it starts or stops leaving.
|
|
263
|
+
*/
|
|
264
|
+
export function createToastBud(target: () => HTMLElement | null, origin: () => ToastOrigin | undefined, cls: string) {
|
|
265
|
+
let budding: false | 'in' | 'out' = false
|
|
266
|
+
let stopBud: (() => void) | null = null
|
|
267
|
+
let front = false
|
|
268
|
+
return {
|
|
269
|
+
place: (index: number) => (front = index === 0),
|
|
270
|
+
change(leaving: ToastLeaving) {
|
|
271
|
+
const el = target()
|
|
272
|
+
if (!el) return
|
|
273
|
+
const thrown = leaving && leaving !== 'down'
|
|
274
|
+
if (thrown || (leaving && !front)) {
|
|
275
|
+
if (budding === 'in') stopBud?.()
|
|
276
|
+
budding = false
|
|
277
|
+
if (!thrown) delete el.dataset.liquid
|
|
278
|
+
return
|
|
279
|
+
}
|
|
280
|
+
stopBud?.()
|
|
281
|
+
const way = leaving ? 'out' : 'in'
|
|
282
|
+
// The bud stands in for the part's CSS entry and exit; marked first, so the toast is measured in its place.
|
|
283
|
+
el.dataset.liquid = ''
|
|
284
|
+
stopBud = bud(el, origin(), way, cls)
|
|
285
|
+
budding = stopBud ? way : false
|
|
286
|
+
},
|
|
287
|
+
destroy() {
|
|
288
|
+
if (budding === 'in') stopBud?.()
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { motionMs } from '../motion'
|
|
2
|
+
import type { Side } from './floating'
|
|
3
|
+
|
|
4
|
+
// When a tooltip shows and hides, the same in every framework: hover after a delay, keyboard focus at
|
|
5
|
+
// once, a tap for a moment on touch screens.
|
|
6
|
+
|
|
7
|
+
// How long a tip stays after a tap on a touch screen, so it can be read.
|
|
8
|
+
const TOUCH_SHOW_MS = 1500
|
|
9
|
+
|
|
10
|
+
// Shared by every tooltip on the page: right after one closes, the next shows at once.
|
|
11
|
+
let lastClosedAt = 0
|
|
12
|
+
|
|
13
|
+
/** The edge of the target the tip grows out of: a sliver as wide as the target, on the tip's side. */
|
|
14
|
+
export function tipEdge(anchor: HTMLElement | null, side: Side) {
|
|
15
|
+
const r = anchor?.getBoundingClientRect()
|
|
16
|
+
if (!r) return null
|
|
17
|
+
if (side === 'top') return new DOMRect(r.left, r.top, r.width, 2)
|
|
18
|
+
if (side === 'bottom') return new DOMRect(r.left, r.bottom - 2, r.width, 2)
|
|
19
|
+
if (side === 'left') return new DOMRect(r.left, r.top, 2, r.height)
|
|
20
|
+
return new DOMRect(r.right - 2, r.top, 2, r.height)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type PointerLike = { pointerType: string }
|
|
24
|
+
|
|
25
|
+
/** Feed it the trigger's events; it calls `setOpen`. `delay` is the hover delay, or undefined for the token. */
|
|
26
|
+
export function createTipTimer(setOpen: (open: boolean) => void, delay: () => number | undefined) {
|
|
27
|
+
let timer: number | undefined
|
|
28
|
+
const clear = () => window.clearTimeout(timer)
|
|
29
|
+
const show = (wait: number) => {
|
|
30
|
+
clear()
|
|
31
|
+
timer = window.setTimeout(() => setOpen(true), wait)
|
|
32
|
+
}
|
|
33
|
+
const hide = (wait = 80) => {
|
|
34
|
+
clear()
|
|
35
|
+
timer = window.setTimeout(() => {
|
|
36
|
+
setOpen(false)
|
|
37
|
+
lastClosedAt = Date.now()
|
|
38
|
+
}, wait)
|
|
39
|
+
}
|
|
40
|
+
const hoverDelay = () => (Date.now() - lastClosedAt < 400 ? 0 : (delay() ?? motionMs('delay-tooltip')))
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
clear,
|
|
44
|
+
hide,
|
|
45
|
+
enter: (e: PointerLike) => e.pointerType === 'mouse' && show(hoverDelay()),
|
|
46
|
+
leave: (e: PointerLike) => e.pointerType === 'mouse' && hide(),
|
|
47
|
+
// Touch has no hover: a tap shows the tip at once, and it fades a moment after the finger lifts.
|
|
48
|
+
// Opened now, not on a timer: the finger lifts in the same moment, which would cancel it.
|
|
49
|
+
down(e: PointerLike) {
|
|
50
|
+
if (e.pointerType !== 'touch') return
|
|
51
|
+
clear()
|
|
52
|
+
setOpen(true)
|
|
53
|
+
},
|
|
54
|
+
up: (e: PointerLike) => e.pointerType === 'touch' && hide(TOUCH_SHOW_MS),
|
|
55
|
+
focus: (e: { target: EventTarget | null }) => (e.target as Element).matches(':focus-visible') && show(0),
|
|
56
|
+
blur: () => hide(0),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,132 +1,9 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef } from 'react'
|
|
2
|
+
import { onScrollFrame, type ScrollReader } from './motion/scrollFrame'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
// after a moment of stillness; a scroll, a resize or a change in the page's size wakes it again.
|
|
4
|
+
export { bandProgress, easeToward, readScrollTokens, scrollTokens, type ScrollFrame, type ScrollReader, type ScrollTokens } from './motion/scrollFrame'
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
export type ScrollFrame = { y: number; v: number; dt: number }
|
|
8
|
-
|
|
9
|
-
/** Reads layout and returns the writes, so every part reads before any part writes. */
|
|
10
|
-
export type ScrollReader = (frame: ScrollFrame) => void | (() => void)
|
|
11
|
-
|
|
12
|
-
export type ScrollTokens = { ease: number; start: number; end: number; turn: number; turnNarrow: number }
|
|
13
|
-
|
|
14
|
-
const readers = new Set<{ current: ScrollReader }>()
|
|
15
|
-
let frame: ScrollFrame = { y: 0, v: 0, dt: 0 }
|
|
16
|
-
let last = { y: 0, t: -1 }
|
|
17
|
-
let raf = 0
|
|
18
|
-
let still = 0
|
|
19
|
-
let observer: ResizeObserver | null = null
|
|
20
|
-
let reduce: MediaQueryList | null = null
|
|
21
|
-
let tokens: ScrollTokens | null = null
|
|
22
|
-
|
|
23
|
-
export function readScrollTokens(): ScrollTokens {
|
|
24
|
-
const s = getComputedStyle(document.documentElement)
|
|
25
|
-
const n = (name: string) => parseFloat(s.getPropertyValue(name))
|
|
26
|
-
return { ease: n('--gooee-scroll-ease'), start: n('--gooee-draft-start'), end: n('--gooee-draft-end'), turn: n('--gooee-story-turn'), turnNarrow: n('--gooee-story-turn-narrow') }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** The tokens, read once each time the loop starts or the window changes size. */
|
|
30
|
-
export const scrollTokens = () => (tokens ??= readScrollTokens())
|
|
31
|
-
|
|
32
|
-
/** Progress from 0 to 1 as an element's top moves from `start` to `end` (shares of the screen height). */
|
|
33
|
-
export function bandProgress(top: number, start: number, end: number) {
|
|
34
|
-
const p = (start - top / window.innerHeight) / (start - end)
|
|
35
|
-
return Math.max(0, Math.min(1, p))
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Set by a part that is still easing, so the loop keeps going after the page stops.
|
|
39
|
-
let settling = false
|
|
40
|
-
|
|
41
|
-
/** Moves `from` toward `to` by the scroll ease, the same weight at any frame rate. On mount it lands at once. */
|
|
42
|
-
export function easeToward(from: number, to: number, dt: number) {
|
|
43
|
-
if (dt <= 0) return to
|
|
44
|
-
const k = 1 - Math.pow(1 - scrollTokens().ease, Math.min(4, dt / (1000 / 60)))
|
|
45
|
-
const next = from + (to - from) * k
|
|
46
|
-
if (Math.abs(to - next) < 0.0005) return to
|
|
47
|
-
settling = true
|
|
48
|
-
return next
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// One part that throws must not stop the loop for every other part, so each runs on its own and the
|
|
52
|
-
// error is reported after the frame.
|
|
53
|
-
function guard<T>(fn: () => T): T | undefined {
|
|
54
|
-
try {
|
|
55
|
-
return fn()
|
|
56
|
-
} catch (error) {
|
|
57
|
-
queueMicrotask(() => {
|
|
58
|
-
throw error
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function runAll(list: Iterable<{ current: ScrollReader }>, f: ScrollFrame) {
|
|
64
|
-
const writes: Array<() => void> = []
|
|
65
|
-
for (const r of list) {
|
|
66
|
-
const w = guard(() => r.current(f))
|
|
67
|
-
if (w) writes.push(w)
|
|
68
|
-
}
|
|
69
|
-
writes.forEach((w) => guard(w))
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function run(f: ScrollFrame) {
|
|
73
|
-
runAll(readers, f)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function tick(t: number) {
|
|
77
|
-
const y = window.scrollY
|
|
78
|
-
// The first frame after a wake only takes its bearings: its time can be earlier than the wake's.
|
|
79
|
-
let v = frame.v
|
|
80
|
-
if (last.t >= 0) {
|
|
81
|
-
v += (((y - last.y) / Math.max(1, t - last.t)) * 1000 - v) * 0.2
|
|
82
|
-
if (Math.abs(v) < 1) v = 0
|
|
83
|
-
}
|
|
84
|
-
const moved = y !== last.y
|
|
85
|
-
const dt = last.t >= 0 ? t - last.t : 0
|
|
86
|
-
last = { y, t }
|
|
87
|
-
frame = { y, v, dt }
|
|
88
|
-
settling = false
|
|
89
|
-
run(frame)
|
|
90
|
-
still = !moved && v === 0 && !settling ? still + 1 : 0
|
|
91
|
-
raf = still > 30 ? 0 : requestAnimationFrame(tick)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function wake() {
|
|
95
|
-
still = 0
|
|
96
|
-
if (raf) return
|
|
97
|
-
tokens = null
|
|
98
|
-
last = { y: window.scrollY, t: -1 }
|
|
99
|
-
raf = requestAnimationFrame(tick)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function onResize() {
|
|
103
|
-
tokens = null
|
|
104
|
-
wake()
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function start() {
|
|
108
|
-
window.addEventListener('scroll', wake, { passive: true })
|
|
109
|
-
window.addEventListener('resize', onResize)
|
|
110
|
-
// Fonts, pictures or an opened panel can move things without a scroll.
|
|
111
|
-
observer = new ResizeObserver(wake)
|
|
112
|
-
observer.observe(document.body)
|
|
113
|
-
reduce = window.matchMedia('(prefers-reduced-motion: reduce)')
|
|
114
|
-
reduce.addEventListener('change', wake)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function stop() {
|
|
118
|
-
window.removeEventListener('scroll', wake)
|
|
119
|
-
window.removeEventListener('resize', onResize)
|
|
120
|
-
observer?.disconnect()
|
|
121
|
-
observer = null
|
|
122
|
-
reduce?.removeEventListener('change', wake)
|
|
123
|
-
reduce = null
|
|
124
|
-
cancelAnimationFrame(raf)
|
|
125
|
-
raf = 0
|
|
126
|
-
frame = { y: 0, v: 0, dt: 0 }
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** Calls `read` once on mount and then every frame while the page moves. */
|
|
6
|
+
/** React's hold on onScrollFrame (motion/scrollFrame.ts): calls the latest `read` on mount and every frame while the page moves. */
|
|
130
7
|
export function useScrollFrame(read: ScrollReader, active = true) {
|
|
131
8
|
const ref = useRef(read)
|
|
132
9
|
useLayoutEffect(() => {
|
|
@@ -134,24 +11,6 @@ export function useScrollFrame(read: ScrollReader, active = true) {
|
|
|
134
11
|
})
|
|
135
12
|
useLayoutEffect(() => {
|
|
136
13
|
if (!active) return
|
|
137
|
-
|
|
138
|
-
readers.add(ref)
|
|
139
|
-
mounting.add(ref)
|
|
140
|
-
if (mounting.size === 1) queueMicrotask(runMounts)
|
|
141
|
-
wake()
|
|
142
|
-
return () => {
|
|
143
|
-
readers.delete(ref)
|
|
144
|
-
mounting.delete(ref)
|
|
145
|
-
if (!readers.size) stop()
|
|
146
|
-
}
|
|
14
|
+
return onScrollFrame((f) => ref.current(f))
|
|
147
15
|
}, [active])
|
|
148
16
|
}
|
|
149
|
-
|
|
150
|
-
// Parts that mount together read once, together, before the first paint, so the page lays out once.
|
|
151
|
-
const mounting = new Set<{ current: ScrollReader }>()
|
|
152
|
-
|
|
153
|
-
function runMounts() {
|
|
154
|
-
const list = [...mounting]
|
|
155
|
-
mounting.clear()
|
|
156
|
-
runAll(list, { y: window.scrollY, v: frame.v, dt: 0 })
|
|
157
|
-
}
|