@gecko-ui-kit/react 0.1.0 → 0.3.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/README.md +70 -34
- package/package.json +7 -7
- package/src/actions.d.ts +1 -1
- package/src/actions.js +28 -28
- package/src/basics.d.ts +1 -1
- package/src/basics.js +53 -53
- package/src/controls.d.ts +4 -4
- package/src/controls.js +30 -30
- package/src/core.d.ts +1 -1
- package/src/core.js +3 -3
- package/src/data.js +15 -15
- package/src/effects.d.ts +5 -5
- package/src/effects.js +33 -33
- package/src/forms.js +10 -10
- package/src/motion.d.ts +3 -3
- package/src/motion.js +10 -10
- package/src/overlays.d.ts +6 -2
- package/src/overlays.js +21 -18
- package/src/shell.js +76 -76
- package/src/text.js +10 -10
package/src/shell.js
CHANGED
|
@@ -72,12 +72,12 @@ const NavLink = forwardRef(function NavLink({ href, onNavigate, link, onClick, .
|
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
/* html.is-sideopen: the sidebar shown as a drawer on phones. Every part hears about it through one event. */
|
|
75
|
+
/* html.gk-is-sideopen: the sidebar shown as a drawer on phones. Every part hears about it through one event. */
|
|
76
76
|
const SIDE_EVENT = 'gecko:sideopen';
|
|
77
77
|
const setSideOpen = (open) => {
|
|
78
78
|
const root = document.documentElement;
|
|
79
|
-
if (root.classList.contains('is-sideopen') === !!open) return;
|
|
80
|
-
root.classList.toggle('is-sideopen', !!open);
|
|
79
|
+
if (root.classList.contains('gk-is-sideopen') === !!open) return;
|
|
80
|
+
root.classList.toggle('gk-is-sideopen', !!open);
|
|
81
81
|
window.dispatchEvent(new CustomEvent(SIDE_EVENT, { detail: !!open }));
|
|
82
82
|
};
|
|
83
83
|
|
|
@@ -99,9 +99,9 @@ export const useShell = () => useContext(ShellCtx);
|
|
|
99
99
|
/* Sidebar */
|
|
100
100
|
/* ======================================================================= */
|
|
101
101
|
/* FLIP targets and the parts that fade while the sidebar collapses / expands (same as the vanilla shell) */
|
|
102
|
-
const FLIP = [['.side__head .brand', '.mark'], ['.side__head .collapse', ''], ['.snav__item', '.ico'], ['.side__me', ':scope > .av']];
|
|
103
|
-
const FADE = '.brand__text, .side__group, .snav__label, .snav__chev, .snav__count, .snav__subs, .side__me .cell__text, .side__me > .ico';
|
|
104
|
-
const RISE = ':scope > .card, :scope > .grid > .card, :scope > .kpis > .kpi, :scope > .stack > .card, [data-rise]';
|
|
102
|
+
const FLIP = [['.gk-side__head .gk-brand', '.gk-mark'], ['.gk-side__head .gk-collapse', ''], ['.gk-snav__item', '.gk-ico'], ['.gk-side__me', ':scope > .gk-av']];
|
|
103
|
+
const FADE = '.gk-brand__text, .gk-side__group, .gk-snav__label, .gk-snav__chev, .gk-snav__count, .gk-snav__subs, .gk-side__me .gk-cell__text, .gk-side__me > .gk-ico';
|
|
104
|
+
const RISE = ':scope > .gk-card, :scope > .gk-grid > .gk-card, :scope > .gk-kpis > .gk-kpi, :scope > .gk-stack > .gk-card, [data-rise]';
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* <Sidebar brand={{ name: 'MotoRent', sub: 'Chiang Mai', icon: 'logo' }} nav={nav} end={end} user={me}
|
|
@@ -131,9 +131,9 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
131
131
|
railTl.current?.progress(1);
|
|
132
132
|
if (state.current.rail === r) return;
|
|
133
133
|
closeFly(true);
|
|
134
|
-
const root = document.documentElement, sideEl = side.current, main = document.querySelector('.t-main');
|
|
134
|
+
const root = document.documentElement, sideEl = side.current, main = document.querySelector('.gk-t-main');
|
|
135
135
|
const apply = () => {
|
|
136
|
-
root.classList.toggle('is-rail', r);
|
|
136
|
+
root.classList.toggle('gk-is-rail', r);
|
|
137
137
|
try { if (innerWidth >= state.current.railBreakpoint) localStorage.setItem(`${state.current.storageKey}:pinned`, r ? '0' : '1'); } catch {}
|
|
138
138
|
flushSync(() => setRailState(r));
|
|
139
139
|
};
|
|
@@ -141,7 +141,7 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
141
141
|
const collect = () => FLIP.flatMap(([s, rf]) => $$(s, sideEl).map((el) => ({ el, ref: (rf ? el.querySelector(rf) : el) ?? el, key: s + (el.dataset?.id ?? '') })));
|
|
142
142
|
const els = collect();
|
|
143
143
|
const w0 = sideEl.offsetWidth, m0 = main?.getBoundingClientRect().left ?? 0;
|
|
144
|
-
root.classList.toggle('is-rail', r); const w1 = sideEl.offsetWidth, m1 = main?.getBoundingClientRect().left ?? 0; root.classList.toggle('is-rail', !r);
|
|
144
|
+
root.classList.toggle('gk-is-rail', r); const w1 = sideEl.offsetWidth, m1 = main?.getBoundingClientRect().left ?? 0; root.classList.toggle('gk-is-rail', !r);
|
|
145
145
|
const clip = (x) => `inset(0 ${x}px 0 0 round 22px)`;
|
|
146
146
|
const flipIcons = (dur, ease) => {
|
|
147
147
|
const before = new Map(els.map((x) => [x.key, x.ref.getBoundingClientRect()]));
|
|
@@ -152,13 +152,13 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
152
152
|
const a = x.ref.getBoundingClientRect(), dx = b.left - a.left, dy = b.top - a.top;
|
|
153
153
|
if (Math.abs(dx) + Math.abs(dy) < 0.5) return;
|
|
154
154
|
tl.fromTo(x.el, { x: dx, y: dy }, { x: 0, y: 0, duration: dur, ease }, 0);
|
|
155
|
-
if (x.el.matches('.snav__item[aria-current="page"]')) tl.fromTo(pill.current, { x: dx, y: dy }, { x: 0, y: 0, duration: dur, ease }, 0);
|
|
155
|
+
if (x.el.matches('.gk-snav__item[aria-current="page"]')) tl.fromTo(pill.current, { x: dx, y: dy }, { x: 0, y: 0, duration: dur, ease }, 0);
|
|
156
156
|
});
|
|
157
157
|
return tl;
|
|
158
158
|
};
|
|
159
159
|
const cleanup = () => {
|
|
160
160
|
g.set(sideEl, { clearProps: 'clipPath' }); if (main) g.set(main, { clearProps: 'marginLeft' });
|
|
161
|
-
g.set([...$$(FADE, sideEl), ...$$('.snav__item, .brand, .collapse, .side__me', sideEl)], { clearProps: 'opacity,transform' });
|
|
161
|
+
g.set([...$$(FADE, sideEl), ...$$('.gk-snav__item, .gk-brand, .gk-collapse, .gk-side__me', sideEl)], { clearProps: 'opacity,transform' });
|
|
162
162
|
g.set(pill.current, { clearProps: 'transform' }); railTl.current = null;
|
|
163
163
|
};
|
|
164
164
|
const tl = railTl.current = g.timeline({ onComplete: cleanup });
|
|
@@ -179,16 +179,16 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
179
179
|
// the saved choice (or a narrow window) starts it as a rail; the classes go when the sidebar does
|
|
180
180
|
useIsoLayoutEffect(() => {
|
|
181
181
|
const root = document.documentElement;
|
|
182
|
-
let r = root.classList.contains('is-rail');
|
|
182
|
+
let r = root.classList.contains('gk-is-rail');
|
|
183
183
|
try { const p = localStorage.getItem(KEY('pinned')); if (p === '0' || (p === null && innerWidth < railBreakpoint)) r = true; } catch {}
|
|
184
|
-
root.classList.toggle('is-rail', r); setRailState(r);
|
|
184
|
+
root.classList.toggle('gk-is-rail', r); setRailState(r);
|
|
185
185
|
O.initTips();
|
|
186
186
|
const mq = matchMedia(`(max-width: ${mobile}px)`), onMq = () => setPhone(mq.matches); onMq();
|
|
187
187
|
mq.addEventListener('change', onMq);
|
|
188
|
-
const stopTrack = M.trackIndicator(pill.current, () => side.current?.querySelector('.snav__item[aria-current="page"]'), { radius: 14 });
|
|
188
|
+
const stopTrack = M.trackIndicator(pill.current, () => side.current?.querySelector('.gk-snav__item[aria-current="page"]'), { radius: 14 });
|
|
189
189
|
return () => {
|
|
190
190
|
stopTrack(); mq.removeEventListener('change', onMq); railTl.current?.kill(); railTl.current = null; flyTimer.current?.kill();
|
|
191
|
-
root.classList.remove('is-rail', 'is-sideopen');
|
|
191
|
+
root.classList.remove('gk-is-rail', 'gk-is-sideopen');
|
|
192
192
|
};
|
|
193
193
|
}, []);
|
|
194
194
|
|
|
@@ -199,8 +199,8 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
199
199
|
const el = side.current; if (!el) return;
|
|
200
200
|
const moved = shown.current.page !== m.page && shown.current.rail === rail && shown.current.phone === phone; // a new page, not a boot / rail change
|
|
201
201
|
shown.current = { page: m.page, rail, phone };
|
|
202
|
-
M.indicator(pill.current, el.querySelector('.snav__item[aria-current="page"]'), { animate: moved && !railTl.current, radius: 14 });
|
|
203
|
-
const list = el.querySelector('.snav__subs');
|
|
202
|
+
M.indicator(pill.current, el.querySelector('.gk-snav__item[aria-current="page"]'), { animate: moved && !railTl.current, radius: 14 });
|
|
203
|
+
const list = el.querySelector('.gk-snav__subs');
|
|
204
204
|
if (moved && list && !list.hidden && !RM() && !railTl.current) {
|
|
205
205
|
g.fromTo(list, { height: 0, opacity: 0 }, { height: 'auto', opacity: 1, duration: 0.45, ease: 'power3.out', clearProps: 'height,opacity' });
|
|
206
206
|
g.fromTo(list.children, { opacity: 0, x: -8 }, { opacity: 1, x: 0, duration: 0.35, ease: 'power3.out', stagger: 0.03, delay: 0.06, clearProps: 'transform,opacity' });
|
|
@@ -209,7 +209,7 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
209
209
|
useIsoLayoutEffect(() => {
|
|
210
210
|
const now = {}; m.all.forEach((it) => { if (it.count !== undefined) now[it.id] = countOf(it); });
|
|
211
211
|
if (!first.current) for (const id in now) if (now[id] !== counts.current[id] && now[id] > 0) {
|
|
212
|
-
const c = side.current?.querySelector(`.snav__item[data-id="${CSS.escape(id)}"] .snav__count`); if (c) M.flash(c);
|
|
212
|
+
const c = side.current?.querySelector(`.gk-snav__item[data-id="${CSS.escape(id)}"] .gk-snav__count`); if (c) M.flash(c);
|
|
213
213
|
}
|
|
214
214
|
counts.current = now; first.current = false;
|
|
215
215
|
});
|
|
@@ -217,7 +217,7 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
217
217
|
useEffect(() => { if (!first.current) { setSideOpen(false); closeFly(true); } }, [path]);
|
|
218
218
|
|
|
219
219
|
const toggleSubs = () => {
|
|
220
|
-
const list = side.current?.querySelector('.snav__subs'); if (!list) return;
|
|
220
|
+
const list = side.current?.querySelector('.gk-snav__subs'); if (!list) return;
|
|
221
221
|
const open = subs.shut;
|
|
222
222
|
g.killTweensOf([list, ...list.children]);
|
|
223
223
|
if (open) {
|
|
@@ -268,46 +268,46 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
268
268
|
/* ----- markup ----- */
|
|
269
269
|
const navItem = (n) => {
|
|
270
270
|
const on = n.id === m.page, c = countOf(n), list = m.subsOf(n), open = on && !!list && (!rail || phone);
|
|
271
|
-
return h('div', { className: 'snav__wrap', key: n.id },
|
|
271
|
+
return h('div', { className: 'gk-snav__wrap', key: n.id },
|
|
272
272
|
h(NavLink, {
|
|
273
|
-
...L, className: 'snav__item', 'data-id': n.id, href: m.hrefOf(n), 'aria-current': on ? 'page' : undefined,
|
|
274
|
-
'aria-expanded': open ? !subs.shut : undefined, 'aria-controls': open ? `snav-subs-${n.id}` : undefined, 'aria-label': n.label,
|
|
273
|
+
...L, className: 'gk-snav__item', 'data-id': n.id, href: m.hrefOf(n), 'aria-current': on ? 'page' : undefined,
|
|
274
|
+
'aria-expanded': open ? !subs.shut : undefined, 'aria-controls': open ? `gk-snav-subs-${n.id}` : undefined, 'aria-label': n.label,
|
|
275
275
|
onClick: open ? (e) => { e.preventDefault(); toggleSubs(); } : undefined,
|
|
276
276
|
onPointerEnter: (e) => { if (M.fine.matches) openFly(n, e.currentTarget); }, onPointerLeave: closeFlySoon,
|
|
277
277
|
onFocus: (e) => openFly(n, e.currentTarget), onBlur: closeFlySoon,
|
|
278
|
-
}, iconNode(n.icon), h('span', { className: 'snav__label' }, n.label), c > 0 ? h('span', { className: 'snav__count' }, c) : null,
|
|
279
|
-
list && !c ? h(Icon, { name: 'chevR', className: 'snav__chev' }) : null),
|
|
280
|
-
open ? h('div', { className: 'snav__subs', id: `snav-subs-${n.id}`, hidden: subs.hidden },
|
|
278
|
+
}, iconNode(n.icon), h('span', { className: 'gk-snav__label' }, n.label), c > 0 ? h('span', { className: 'gk-snav__count' }, c) : null,
|
|
279
|
+
list && !c ? h(Icon, { name: 'chevR', className: 'gk-snav__chev' }) : null),
|
|
280
|
+
open ? h('div', { className: 'gk-snav__subs', id: `gk-snav-subs-${n.id}`, hidden: subs.hidden },
|
|
281
281
|
list.map((s) => h(NavLink, { ...L, key: s.id, href: s.href, 'aria-current': s.id === m.sub ? 'page' : undefined }, s.label))) : null);
|
|
282
282
|
};
|
|
283
283
|
const flyItem = fly && m.itemOf(fly.id);
|
|
284
284
|
const flyList = flyItem && m.subsOf(flyItem), flyCount = flyItem ? countOf(flyItem) : 0;
|
|
285
285
|
return h(Fragment, null,
|
|
286
|
-
h('aside', { className: 'side', id: '
|
|
287
|
-
h('div', { className: 'side__head' },
|
|
288
|
-
h(NavLink, { ...L, className: 'brand', href: brand.href ?? (m.itemOf(home) ? m.hrefOf(m.itemOf(home)) : m.all[0] ? m.hrefOf(m.all[0]) : '/'), 'aria-label': brand.name },
|
|
289
|
-
h('span', { className: 'mark' }, iconNode(brand.icon || 'logo')),
|
|
290
|
-
h('span', { className: 'brand__text' }, h('b', null, brand.name), brand.sub ? h('small', null, brand.sub) : null)),
|
|
286
|
+
h('aside', { className: 'gk-side', id: 'gk-side', 'aria-label': W.sidebar, ref: side },
|
|
287
|
+
h('div', { className: 'gk-side__head' },
|
|
288
|
+
h(NavLink, { ...L, className: 'gk-brand', href: brand.href ?? (m.itemOf(home) ? m.hrefOf(m.itemOf(home)) : m.all[0] ? m.hrefOf(m.all[0]) : '/'), 'aria-label': brand.name },
|
|
289
|
+
h('span', { className: 'gk-mark' }, iconNode(brand.icon || 'logo')),
|
|
290
|
+
h('span', { className: 'gk-brand__text' }, h('b', null, brand.name), brand.sub ? h('small', null, brand.sub) : null)),
|
|
291
291
|
h('button', {
|
|
292
|
-
type: 'button', className: 'collapse', 'aria-label': rail ? W.expand : W.collapse, 'data-tip': rail ? W.expandTip : W.collapseTip,
|
|
292
|
+
type: 'button', className: 'gk-collapse', 'aria-label': rail ? W.expand : W.collapse, 'data-tip': rail ? W.expandTip : W.collapseTip,
|
|
293
293
|
'data-tip-side': rail ? 'right' : undefined, onClick: (e) => { M.pop(e.currentTarget); setRail(!state.current.rail); },
|
|
294
294
|
}, h(Icon, { name: 'panel' }))),
|
|
295
|
-
h('nav', { className: 'snav', 'aria-label': W.main },
|
|
296
|
-
h('span', { className: 'snav__pill', ref: pill }),
|
|
297
|
-
(nav || []).map((grp, i) => h('div', { className: 'snav__group', key: i }, grp.label ? h('span', { className: 'side__group' }, grp.label) : null, (grp.items || []).map(navItem))),
|
|
298
|
-
end?.length ? h('div', { className: 'snav__group snav__group--end' }, end.map(navItem)) : null),
|
|
299
|
-
user ? h('div', { className: 'side__foot' },
|
|
300
|
-
h('button', { type: 'button', className: 'side__me', 'aria-label': `${user.name} — ${W.account}`, 'data-tip': rail ? user.name : undefined, 'data-tip-side': rail ? 'right' : undefined, onClick: openMe },
|
|
295
|
+
h('nav', { className: 'gk-snav', 'aria-label': W.main },
|
|
296
|
+
h('span', { className: 'gk-snav__pill', ref: pill }),
|
|
297
|
+
(nav || []).map((grp, i) => h('div', { className: 'gk-snav__group', key: i }, grp.label ? h('span', { className: 'gk-side__group' }, grp.label) : null, (grp.items || []).map(navItem))),
|
|
298
|
+
end?.length ? h('div', { className: 'gk-snav__group gk-snav__group--end' }, end.map(navItem)) : null),
|
|
299
|
+
user ? h('div', { className: 'gk-side__foot' },
|
|
300
|
+
h('button', { type: 'button', className: 'gk-side__me', 'aria-label': `${user.name} — ${W.account}`, 'data-tip': rail ? user.name : undefined, 'data-tip-side': rail ? 'right' : undefined, onClick: openMe },
|
|
301
301
|
h(Avatar, { person: user, online: user.online ?? true }),
|
|
302
|
-
h('span', { className: 'cell__text' }, h('b', null, user.name), user.role ? h('small', null, user.role) : null),
|
|
302
|
+
h('span', { className: 'gk-cell__text' }, h('b', null, user.name), user.role ? h('small', null, user.role) : null),
|
|
303
303
|
h(Icon, { name: 'sort' }))) : null),
|
|
304
|
-
h('div', { className: 'side__scrim', onClick: () => setSideOpen(false) }),
|
|
304
|
+
h('div', { className: 'gk-side__scrim', onClick: () => setSideOpen(false) }),
|
|
305
305
|
fly && flyItem ? createPortal(h('div', {
|
|
306
|
-
ref: flyEl, className: 'flyout', 'data-id': flyItem.id, role: 'menu', style: { left: fly.left, top: fly.y },
|
|
306
|
+
ref: flyEl, className: 'gk-flyout', 'data-id': flyItem.id, role: 'menu', style: { left: fly.left, top: fly.y },
|
|
307
307
|
onPointerEnter: () => flyTimer.current?.kill(), onPointerLeave: closeFlySoon,
|
|
308
308
|
onClick: (e) => { if (e.target.closest('a')) closeFly(); },
|
|
309
309
|
},
|
|
310
|
-
h('div', { className: 'flyout__head' }, h('b', null, flyItem.label, flyCount ? h('span', { className: 'snav__count' }, flyCount) : null), flyItem.blurb ? h('small', null, flyItem.blurb) : null),
|
|
310
|
+
h('div', { className: 'gk-flyout__head' }, h('b', null, flyItem.label, flyCount ? h('span', { className: 'gk-snav__count' }, flyCount) : null), flyItem.blurb ? h('small', null, flyItem.blurb) : null),
|
|
311
311
|
flyList
|
|
312
312
|
? flyList.map((s) => h(NavLink, { ...L, key: s.id, role: 'menuitem', href: s.href, 'aria-current': m.page === flyItem.id && m.sub === s.id ? 'page' : undefined }, h(Icon, { name: 'chevR' }), s.label))
|
|
313
313
|
: h(NavLink, { ...L, role: 'menuitem', href: m.hrefOf(flyItem), 'aria-current': m.page === flyItem.id ? 'page' : undefined }, h(Icon, { name: 'arrowR' }), `${W.open} ${String(flyItem.label).toLowerCase()}`)), document.body) : null);
|
|
@@ -315,7 +315,7 @@ export const Sidebar = forwardRef(function Sidebar({ brand = { name: 'App' }, na
|
|
|
315
315
|
|
|
316
316
|
const initials = (name = '') => String(name).split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0]).join('').toUpperCase();
|
|
317
317
|
/* the same markup as av(person, '', online) */
|
|
318
|
-
const Avatar = ({ person, online }) => h('span', { className: `av av--${person.tone || 'indigo'}`, title: person.name }, person.ini ?? initials(person.name), online ? h('i', { className: 'av__on' }) : null);
|
|
318
|
+
const Avatar = ({ person, online }) => h('span', { className: `gk-av gk-av--${person.tone || 'indigo'}`, title: person.name }, person.ini ?? initials(person.name), online ? h('i', { className: 'gk-av__on' }) : null);
|
|
319
319
|
|
|
320
320
|
/* ======================================================================= */
|
|
321
321
|
/* Topbar */
|
|
@@ -339,7 +339,7 @@ export const Topbar = forwardRef(function Topbar({ nav, end, path, base, home, o
|
|
|
339
339
|
if (theme !== false) M.restoreTheme(`${storageKey}:theme`);
|
|
340
340
|
const onScroll = () => setStuck(scrollY > 4); onScroll();
|
|
341
341
|
addEventListener('scroll', onScroll, { passive: true });
|
|
342
|
-
const b = M.bindBurger(menuBtn.current, { controls: '
|
|
342
|
+
const b = M.bindBurger(menuBtn.current, { controls: 'gk-side', escape: false, onToggle: (open) => setSideOpen(open) });
|
|
343
343
|
const sync = (e) => b?.set(e.detail, { silent: true });
|
|
344
344
|
addEventListener(SIDE_EVENT, sync);
|
|
345
345
|
M.magnetic(top.current);
|
|
@@ -353,29 +353,29 @@ export const Topbar = forwardRef(function Topbar({ nav, end, path, base, home, o
|
|
|
353
353
|
const was = prevCount.current; prevCount.current = count;
|
|
354
354
|
if (first.current || count <= was || RM() || !bellBtn.current) return;
|
|
355
355
|
M.wiggle(bellBtn.current.querySelector('svg'));
|
|
356
|
-
g.fromTo(bellBtn.current.querySelector('.bell__n'), { scale: 0.4 }, { scale: 1, duration: 0.6, ease: 'back.out(3)' });
|
|
356
|
+
g.fromTo(bellBtn.current.querySelector('.gk-bell__n'), { scale: 0.4 }, { scale: 1, duration: 0.6, ease: 'back.out(3)' });
|
|
357
357
|
}, [count]);
|
|
358
358
|
useEffect(() => { first.current = false; }, []);
|
|
359
359
|
|
|
360
360
|
const subLabel = m.sub && m.subsOf(m.item)?.find((s) => s.id === m.sub)?.label;
|
|
361
361
|
const s = search === false ? null : search || {};
|
|
362
|
-
return h('header', { className: cx('top', stuck && 'is-stuck'), ref: top },
|
|
363
|
-
h('div', { className: 'top__in' },
|
|
364
|
-
h('button', { type: 'button', className: 'iconbtn top__menu', 'aria-label': W.menu, ref: menuBtn }, h('span', { className: 'burger', 'aria-hidden': true }, h('i'), h('i'), h('i'))),
|
|
365
|
-
h('nav', { className: 'crumbs', 'aria-label': W.breadcrumb, ref: crumbs },
|
|
362
|
+
return h('header', { className: cx('gk-top', stuck && 'gk-is-stuck'), ref: top },
|
|
363
|
+
h('div', { className: 'gk-top__in' },
|
|
364
|
+
h('button', { type: 'button', className: 'gk-iconbtn gk-top__menu', 'aria-label': W.menu, ref: menuBtn }, h('span', { className: 'gk-burger', 'aria-hidden': true }, h('i'), h('i'), h('i'))),
|
|
365
|
+
h('nav', { className: 'gk-crumbs', 'aria-label': W.breadcrumb, ref: crumbs },
|
|
366
366
|
crumbsRoot ? h(Fragment, null, h('span', null, crumbsRoot), h(Icon, { name: 'chevR' })) : null,
|
|
367
367
|
m.item ? h(NavLink, { ...L, href: m.hrefOf(m.item) }, m.item.label) : null,
|
|
368
368
|
subLabel ? h(Fragment, null, h(Icon, { name: 'chevR' }), h('b', null, subLabel)) : null),
|
|
369
|
-
s ? h('button', { type: 'button', className: 'search', 'aria-label': W.search, onClick: () => (s.onOpen ? s.onOpen() : onSearch?.()) },
|
|
369
|
+
s ? h('button', { type: 'button', className: 'gk-search', 'aria-label': W.search, onClick: () => (s.onOpen ? s.onOpen() : onSearch?.()) },
|
|
370
370
|
h(Icon, { name: 'search' }), h('span', null, s.placeholder || W.searchPlaceholder), h('kbd', null, W.searchKey)) : null,
|
|
371
371
|
children,
|
|
372
372
|
theme !== false ? h('button', {
|
|
373
|
-
type: 'button', className: 'iconbtn top__theme', 'aria-label': W.theme, 'data-tip': W.themeTip,
|
|
373
|
+
type: 'button', className: 'gk-iconbtn gk-top__theme', 'aria-label': W.theme, 'data-tip': W.themeTip,
|
|
374
374
|
onClick: (e) => { M.pop(e.currentTarget); M.toggleTheme(e.currentTarget, { storageKey: `${storageKey}:theme` }); },
|
|
375
|
-
}, h(Icon, { name: 'moon', className: 'i-moon' }), h(Icon, { name: 'sun', className: 'i-sun' })) : null,
|
|
376
|
-
bell ? h('button', { type: 'button', className: 'iconbtn top__bell', 'aria-label': W.bell, 'data-tip': W.bell, ref: bellBtn, onClick: (e) => bell.onClick?.(e.currentTarget) },
|
|
377
|
-
h(Icon, { name: 'bell' }), h('span', { className: 'bell__n', hidden: !count }, count)) : null,
|
|
378
|
-
primary ? h('button', { type: 'button', className: 'btn btn--primary top__new magnetic', 'data-tip': primary.tip || '', onClick: (e) => primary.run?.(e.currentTarget) },
|
|
375
|
+
}, h(Icon, { name: 'moon', className: 'gk-i-moon' }), h(Icon, { name: 'sun', className: 'gk-i-sun' })) : null,
|
|
376
|
+
bell ? h('button', { type: 'button', className: 'gk-iconbtn gk-top__bell', 'aria-label': W.bell, 'data-tip': W.bell, ref: bellBtn, onClick: (e) => bell.onClick?.(e.currentTarget) },
|
|
377
|
+
h(Icon, { name: 'bell' }), h('span', { className: 'gk-bell__n', hidden: !count }, count)) : null,
|
|
378
|
+
primary ? h('button', { type: 'button', className: 'gk-btn gk-btn--primary gk-top__new gk-magnetic', 'data-tip': primary.tip || '', onClick: (e) => primary.run?.(e.currentTarget) },
|
|
379
379
|
iconNode(primary.icon || 'plus'), h('span', null, primary.label || W.primary)) : null));
|
|
380
380
|
});
|
|
381
381
|
|
|
@@ -398,8 +398,8 @@ export const MobileTabbar = forwardRef(function MobileTabbar({ nav, end, path, b
|
|
|
398
398
|
useImperativeHandle(ref, () => el.current, []);
|
|
399
399
|
useIsoLayoutEffect(() => M.trackIndicator(line.current, target, { radius: 14 }), []);
|
|
400
400
|
useIsoLayoutEffect(() => { M.indicator(line.current, target(), { radius: 14 }); }, [m.page]);
|
|
401
|
-
return h('nav', { className: 'tabbar', 'aria-label': W.tabs, ref: el },
|
|
402
|
-
h('span', { className: 'tabbar__line', ref: line }),
|
|
401
|
+
return h('nav', { className: 'gk-tabbar', 'aria-label': W.tabs, ref: el },
|
|
402
|
+
h('span', { className: 'gk-tabbar__line', ref: line }),
|
|
403
403
|
ids.map((id) => { const it = m.itemOf(id); return it ? h(NavLink, { ...L, key: id, href: m.hrefOf(it), 'data-id': id, 'aria-current': m.page === id ? 'page' : undefined }, iconNode(it.icon), h('small', null, it.label)) : null; }),
|
|
404
404
|
rest.length ? h('button', {
|
|
405
405
|
type: 'button', 'data-more': '', onClick: (e) => { O.bindEscape(); O.menu(e.currentTarget, toMenu(rest.map((it) => ({ icon: it.icon, label: it.label, run: () => go(onNavigate, m.hrefOf(it)) }))), { align: 'end' }); },
|
|
@@ -414,7 +414,7 @@ export const MobileTabbar = forwardRef(function MobileTabbar({ nav, end, path, b
|
|
|
414
414
|
const seg = typeof Intl !== 'undefined' && typeof Intl.Segmenter === 'function' ? new Intl.Segmenter(undefined, { granularity: 'grapheme' }) : null;
|
|
415
415
|
const chars = (w) => (seg ? [...seg.segment(w)].map((x) => x.segment) : [...w]);
|
|
416
416
|
const splitTitle = (t) => String(t).trim().split(' ').map((w, i) => h(Fragment, { key: i }, i ? ' ' : null,
|
|
417
|
-
h('span', { className: 'word', 'aria-hidden': true }, chars(w).map((c, j) => h('span', { className: 'ch', key: j }, c)))));
|
|
417
|
+
h('span', { className: 'gk-word', 'aria-hidden': true }, chars(w).map((c, j) => h('span', { className: 'gk-ch', key: j }, c)))));
|
|
418
418
|
const normTab = (t) => (Array.isArray(t) ? { id: String(t[0]), label: t[1] ?? t[0], count: t[2], href: t[3] } : { ...t, id: String(t.id) });
|
|
419
419
|
|
|
420
420
|
/**
|
|
@@ -442,25 +442,25 @@ export const PageHeader = forwardRef(function PageHeader({ title = '', eyebrow,
|
|
|
442
442
|
|
|
443
443
|
useIsoLayoutEffect(() => {
|
|
444
444
|
M.title(h1.current);
|
|
445
|
-
if (first.current) M.slide(el.current.querySelectorAll('.phead__eyebrow, .phead p, .phead__actions > *'), { y: 10, stagger: 0.05, delay: 0.12 });
|
|
445
|
+
if (first.current) M.slide(el.current.querySelectorAll('.gk-phead__eyebrow, .gk-phead p, .gk-phead__actions > *'), { y: 10, stagger: 0.05, delay: 0.12 });
|
|
446
446
|
}, [title]);
|
|
447
|
-
useIsoLayoutEffect(() => { if (!first.current) { const p = el.current.querySelector('.phead p'); if (p) M.slide([p], { y: 6 }); } }, [typeof sub === 'string' ? sub : null]);
|
|
447
|
+
useIsoLayoutEffect(() => { if (!first.current) { const p = el.current.querySelector('.gk-phead p'); if (p) M.slide([p], { y: 6 }); } }, [typeof sub === 'string' ? sub : null]);
|
|
448
448
|
useIsoLayoutEffect(() => { if (line.current) M.indicator(line.current, cur(), { animate: !first.current, radius: 2, line: true }); }, [current, !!list]);
|
|
449
449
|
useIsoLayoutEffect(() => (line.current ? M.trackIndicator(line.current, cur, { radius: 2, line: true }) : undefined), [!!list]);
|
|
450
450
|
useEffect(() => { first.current = false; }, []);
|
|
451
451
|
|
|
452
|
-
const badge = (n) => (n ? h('span', { className: 'badge' }, n) : null);
|
|
452
|
+
const badge = (n) => (n ? h('span', { className: 'gk-badge' }, n) : null);
|
|
453
453
|
return h(Fragment, null,
|
|
454
|
-
h('header', { className: cx('phead', className), ref: el },
|
|
455
|
-
h('div', { className: 'phead__text' },
|
|
456
|
-
eyebrow ? h('span', { className: 'phead__eyebrow' }, eyebrow) : null,
|
|
454
|
+
h('header', { className: cx('gk-phead', className), ref: el },
|
|
455
|
+
h('div', { className: 'gk-phead__text' },
|
|
456
|
+
eyebrow ? h('span', { className: 'gk-phead__eyebrow' }, eyebrow) : null,
|
|
457
457
|
h('h1', { ref: h1, 'data-text': String(title), 'data-split': String(title), 'aria-label': String(title) }, splitTitle(title)),
|
|
458
458
|
sub ? h('p', null, sub) : null),
|
|
459
|
-
actions ? h('div', { className: 'phead__actions' }, actions) : null),
|
|
459
|
+
actions ? h('div', { className: 'gk-phead__actions' }, actions) : null),
|
|
460
460
|
list ? (links
|
|
461
|
-
? h('nav', { className: 'tabs', 'aria-label': W.sections, ref: tabsEl }, h('span', { className: 'tabs__line', ref: line }),
|
|
461
|
+
? h('nav', { className: 'gk-tabs', 'aria-label': W.sections, ref: tabsEl }, h('span', { className: 'gk-tabs__line', ref: line }),
|
|
462
462
|
list.map((t) => h(NavLink, { ...L, key: t.id, href: t.href ?? '#', 'aria-current': t.id === current ? 'page' : undefined }, t.label, badge(t.count))))
|
|
463
|
-
: h('div', { className: 'tabs', role: 'tablist', ref: tabsEl }, h('span', { className: 'tabs__line', ref: line }),
|
|
463
|
+
: h('div', { className: 'gk-tabs', role: 'tablist', ref: tabsEl }, h('span', { className: 'gk-tabs__line', ref: line }),
|
|
464
464
|
list.map((t) => h('button', {
|
|
465
465
|
key: t.id, type: 'button', role: 'tab', 'data-v': t.id, 'aria-selected': t.id === current,
|
|
466
466
|
onClick: () => { if (t.id !== current) onTabChange?.(t.id); },
|
|
@@ -483,7 +483,7 @@ export const shellBootScript = ({ storageKey = 'gecko', railBreakpoint = 1280 }
|
|
|
483
483
|
* top={{ search: { placeholder: 'Search…' }, bell: { count, onClick }, primary: { label: 'New', run } }}>
|
|
484
484
|
* {page content}
|
|
485
485
|
* </AppShell>
|
|
486
|
-
* The whole frame: Sidebar (rail, flyout), Topbar, your page in <main class="view">, the phone tab bar,
|
|
486
|
+
* The whole frame: Sidebar (rail, flyout), Topbar, your page in <main class="gk-view">, the phone tab bar,
|
|
487
487
|
* the ⌘K palette (pages + your search(q) groups), keyboard shortcuts (⌘K / search, [ rail, ? list, Esc close,
|
|
488
488
|
* your keys) and the intro. When the path changes the new page slides in from the direction of travel.
|
|
489
489
|
* Use <PageHeader> at the top of each page. useShell() inside gives { route, navigate, palette, setRail… }.
|
|
@@ -520,24 +520,24 @@ export function AppShell({ brand, nav, end, user, path, base, home, onNavigate,
|
|
|
520
520
|
O.bindEscape();
|
|
521
521
|
O.modal({
|
|
522
522
|
title: esc(w.shortcuts), size: 'sm',
|
|
523
|
-
body: `<dl class="keys">${list.map(([kk, v]) => `<dt>${String(kk).split(' ').map((x) => (x === 'or' || x === 'then' ? `<em>${x}</em>` : `<kbd>${esc(x)}</kbd>`)).join(' ')}</dt><dd>${esc(v)}</dd>`).join('')}</dl>`,
|
|
523
|
+
body: `<dl class="gk-keys">${list.map(([kk, v]) => `<dt>${String(kk).split(' ').map((x) => (x === 'or' || x === 'then' ? `<em>${x}</em>` : `<kbd>${esc(x)}</kbd>`)).join(' ')}</dt><dd>${esc(v)}</dd>`).join('')}</dl>`,
|
|
524
524
|
onMount: (el) => M.slide(el.querySelectorAll('dt, dd'), { y: 6, stagger: 0.015 }),
|
|
525
525
|
});
|
|
526
526
|
};
|
|
527
527
|
const playIntro = () => {
|
|
528
528
|
const el = root.current; if (!el) return null;
|
|
529
529
|
introTl.current?.progress(1);
|
|
530
|
-
const side = el.querySelector('.side'), pill = el.querySelector('.snav__pill'), phone = innerWidth <= mobile;
|
|
530
|
+
const side = el.querySelector('.gk-side'), pill = el.querySelector('.gk-snav__pill'), phone = innerWidth <= mobile;
|
|
531
531
|
M.ready.v = false;
|
|
532
532
|
const tl = g.timeline({ onComplete: () => { M.ready.v = true; } });
|
|
533
533
|
if (!phone && side) {
|
|
534
534
|
tl.fromTo(side, { x: -30, opacity: 0 }, { x: 0, opacity: 1, duration: D(0.7), ease: 'expo.out', clearProps: 'transform,opacity' });
|
|
535
|
-
tl.fromTo($$('.side__head > *, .side__group, .snav__item, .snav__subs > a, .side__foot > *', side), { opacity: 0, x: -10 }, { opacity: 1, x: 0, duration: D(0.5), ease: 'power3.out', stagger: D(0.025), clearProps: 'transform,opacity' }, D(0.1));
|
|
535
|
+
tl.fromTo($$('.gk-side__head > *, .gk-side__group, .gk-snav__item, .gk-snav__subs > a, .gk-side__foot > *', side), { opacity: 0, x: -10 }, { opacity: 1, x: 0, duration: D(0.5), ease: 'power3.out', stagger: D(0.025), clearProps: 'transform,opacity' }, D(0.1));
|
|
536
536
|
tl.fromTo(pill, { scale: 0.4, opacity: 0 }, { scale: 1, opacity: 1, duration: D(0.6), ease: 'back.out(2)', transformOrigin: '50% 50%', clearProps: 'transform' }, D(0.45));
|
|
537
537
|
}
|
|
538
|
-
const bits = el.querySelectorAll('.top__in > *');
|
|
538
|
+
const bits = el.querySelectorAll('.gk-top__in > *');
|
|
539
539
|
if (bits.length) tl.fromTo(bits, { y: -12, opacity: 0 }, { y: 0, opacity: 1, duration: D(0.6), ease: 'expo.out', stagger: D(0.05), clearProps: 'transform,opacity' }, D(0.15));
|
|
540
|
-
const tb = el.querySelector('.tabbar');
|
|
540
|
+
const tb = el.querySelector('.gk-tabbar');
|
|
541
541
|
if (phone && tb) tl.fromTo(tb, { y: 90 }, { y: 0, duration: D(0.7), ease: 'expo.out', clearProps: 'transform' }, D(0.2));
|
|
542
542
|
if (RM()) M.ready.v = true;
|
|
543
543
|
introTl.current = tl;
|
|
@@ -560,7 +560,7 @@ export function AppShell({ brand, nav, end, user, path, base, home, onNavigate,
|
|
|
560
560
|
if (e.key === 'Escape') {
|
|
561
561
|
if (e.defaultPrevented) return;
|
|
562
562
|
if (O.closeTop()) { e.preventDefault(); return; }
|
|
563
|
-
if (document.documentElement.classList.contains('is-sideopen')) { setSideOpen(false); root.current?.querySelector('.top__menu')?.focus(); }
|
|
563
|
+
if (document.documentElement.classList.contains('gk-is-sideopen')) { setSideOpen(false); root.current?.querySelector('.gk-top__menu')?.focus(); }
|
|
564
564
|
return;
|
|
565
565
|
}
|
|
566
566
|
if (!latest.current.shortcuts || e.target.closest?.('input, textarea, select, [contenteditable]') || e.metaKey || e.ctrlKey || e.altKey || O.stack.length) return;
|
|
@@ -593,10 +593,10 @@ export function AppShell({ brand, nav, end, user, path, base, home, onNavigate,
|
|
|
593
593
|
...(intro ? [{ icon: 'refresh', label: W.replay, run: () => playIntro() }] : [])] } : null;
|
|
594
594
|
const bag = { nav, end, path, base, home, onNavigate, link, words };
|
|
595
595
|
return h(ShellCtx.Provider, { value: ctx },
|
|
596
|
-
h('div', { className: cx('t-app', className), ref: root },
|
|
596
|
+
h('div', { className: cx('gk-t-app', className), ref: root },
|
|
597
597
|
h(Sidebar, { ...bag, ref: sideRef, brand, user: me, storageKey, railBreakpoint, mobile }),
|
|
598
|
-
h('div', { className: 't-main' },
|
|
598
|
+
h('div', { className: 'gk-t-main' },
|
|
599
599
|
h(Topbar, { ...bag, crumbsRoot, search: top.search, theme: top.theme, bell: top.bell, primary: top.primary, onSearch: palette, storageKey }, top.extra),
|
|
600
|
-
h('main', { className: 'view', tabIndex: -1, ref: view }, children)),
|
|
600
|
+
h('main', { className: 'gk-view', tabIndex: -1, ref: view }, children)),
|
|
601
601
|
h(MobileTabbar, { ...bag, tabbar })));
|
|
602
602
|
}
|
package/src/text.js
CHANGED
|
@@ -143,10 +143,10 @@ export const Typewriter = owned('Typewriter', {
|
|
|
143
143
|
keys: ['phrases', 'speed', 'jitter', 'eraseSpeed', 'erase', 'hold', 'gap', 'delay', 'loop', 'caret', 'whenVisible', 'locale', 'label', 'onPhrase', 'paused'],
|
|
144
144
|
handle: true,
|
|
145
145
|
children: (o, c) => { if (!o.phrases) { const t = textOf(c); o.phrases = t ? [t] : []; } },
|
|
146
|
-
cls: (o) => cx('tw', 'tw--' + caretOf(o.caret)),
|
|
146
|
+
cls: (o) => cx('gk-tw', 'gk-tw--' + caretOf(o.caret)),
|
|
147
147
|
kids: (o) => [
|
|
148
|
-
h('span', { key: 's', className: 'tw__sr', suppressHydrationWarning: true }, o.label ?? listText(o.phrases, o.locale)),
|
|
149
|
-
h('span', { key: 'v', className: 'tw__vis', 'aria-hidden': true }, h('span', { className: 'tw__text' }), h('i', { className: 'tw__caret' })),
|
|
148
|
+
h('span', { key: 's', className: 'gk-tw__sr', suppressHydrationWarning: true }, o.label ?? listText(o.phrases, o.locale)),
|
|
149
|
+
h('span', { key: 'v', className: 'gk-tw__vis', 'aria-hidden': true }, h('span', { className: 'gk-tw__text' }), h('i', { className: 'gk-tw__caret' })),
|
|
150
150
|
],
|
|
151
151
|
run: (el, { paused, ...o }) => { const t = M.typewriter(el, o); if (paused) t?.pause(); return t; },
|
|
152
152
|
update(t, next, prev) {
|
|
@@ -169,12 +169,12 @@ export const Rotator = owned('Rotator', {
|
|
|
169
169
|
keys: ['words', 'every', 'effect', 'duration', 'ease', 'stagger', 'auto', 'whenVisible', 'locale', 'label', 'onChange', 'index', 'paused', 'pill'],
|
|
170
170
|
defaults: { words: [] },
|
|
171
171
|
handle: true,
|
|
172
|
-
cls: (o) => cx('rot', o.pill && 'rot--pill'),
|
|
172
|
+
cls: (o) => cx('gk-rot', o.pill && 'gk-rot--pill'),
|
|
173
173
|
kids: (o) => {
|
|
174
174
|
const w = o.words[o.index ?? 0] ?? o.words[0] ?? '';
|
|
175
175
|
return [
|
|
176
|
-
h('span', { key: 's', className: 'rot__sr', suppressHydrationWarning: true }, o.label ?? listText(o.words, o.locale)),
|
|
177
|
-
h('span', { key: 'b', className: 'rot__box', 'aria-hidden': true }, h('span', { className: 'rot__sizer' }, w), h('span', { className: 'rot__w' }, w)),
|
|
176
|
+
h('span', { key: 's', className: 'gk-rot__sr', suppressHydrationWarning: true }, o.label ?? listText(o.words, o.locale)),
|
|
177
|
+
h('span', { key: 'b', className: 'gk-rot__box', 'aria-hidden': true }, h('span', { className: 'gk-rot__sizer' }, w), h('span', { className: 'gk-rot__w' }, w)),
|
|
178
178
|
];
|
|
179
179
|
},
|
|
180
180
|
run: (el, { index, paused, pill, ...o }) => {
|
|
@@ -205,7 +205,7 @@ const ShineMotion = enhancer('Shine', (el, o) => M.shine(el, o), {
|
|
|
205
205
|
*/
|
|
206
206
|
export const Shine = forwardRef(function Shine({ className, ...props }, ref) {
|
|
207
207
|
const look = SHINE_LOOKS.includes(props.look) ? props.look : 'gradient';
|
|
208
|
-
return h(ShineMotion, { ...props, ref, className: cx('shine', 'shine--' + look, className) });
|
|
208
|
+
return h(ShineMotion, { ...props, ref, className: cx('gk-shine', 'gk-shine--' + look, className) });
|
|
209
209
|
});
|
|
210
210
|
Shine.displayName = 'Shine';
|
|
211
211
|
|
|
@@ -294,7 +294,7 @@ export const BlurIn = forwardRef(function BlurIn({ as, blur, y, duration, stagge
|
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
296
|
* <ScrollProgress /> or <ScrollProgress root={panelRef} onChange={(p) => setRead(p)} />
|
|
297
|
-
* Same as scrollProgress(bar, { root, onChange }): a thin line on .scroll-progress that fills as the page (or the
|
|
297
|
+
* Same as scrollProgress(bar, { root, onChange }): a thin line on .gk-scroll-progress that fills as the page (or the
|
|
298
298
|
* scrolling box root) is read. onChange(progress 0…1).
|
|
299
299
|
*/
|
|
300
300
|
export const ScrollProgress = forwardRef(function ScrollProgress({ root, onChange, className, ...rest }, ref) {
|
|
@@ -304,7 +304,7 @@ export const ScrollProgress = forwardRef(function ScrollProgress({ root, onChang
|
|
|
304
304
|
const p = M.scrollProgress(el.current, { root: resolve(root), onChange: (v) => cb.current?.(v) });
|
|
305
305
|
return () => p.destroy();
|
|
306
306
|
}, [root]);
|
|
307
|
-
return h('div', { ref: el, 'aria-hidden': true, ...rest, className: cx('scroll-progress', className) });
|
|
307
|
+
return h('div', { ref: el, 'aria-hidden': true, ...rest, className: cx('gk-scroll-progress', className) });
|
|
308
308
|
});
|
|
309
309
|
|
|
310
310
|
/* ---------------- Odometer ---------------- */
|
|
@@ -323,7 +323,7 @@ const ODO_KEYS = ['value', 'format', 'locale', 'duration', 'stagger', 'direction
|
|
|
323
323
|
export const Odometer = owned('Odometer', {
|
|
324
324
|
keys: ODO_KEYS,
|
|
325
325
|
defaults: { value: 0 },
|
|
326
|
-
cls: () => 'odo',
|
|
326
|
+
cls: () => 'gk-odo',
|
|
327
327
|
kids: (o) => odoText(o.from ?? o.value, o),
|
|
328
328
|
run: (el, { value, ...o }) => { M.odometer(el, value, o); return null; },
|
|
329
329
|
end: (_, el) => M.odometer.clear(el),
|