@gecko-ui-kit/vue 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 +69 -33
- 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 +55 -55
- package/src/controls.d.ts +3 -3
- package/src/controls.js +31 -31
- 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 +34 -34
- package/src/forms.js +10 -10
- package/src/motion.d.ts +4 -4
- package/src/motion.js +10 -10
- package/src/overlays.d.ts +6 -2
- package/src/overlays.js +20 -17
- package/src/shell.js +77 -77
- package/src/text.js +10 -10
package/src/data.js
CHANGED
|
@@ -98,9 +98,9 @@ const AccordionInner = mounted('Accordion', (el, o) => {
|
|
|
98
98
|
},
|
|
99
99
|
});
|
|
100
100
|
note(acc);
|
|
101
|
-
o.report?.(slotMap(acc?.root ? [...acc.root.querySelectorAll(':scope > .acc__item')].flatMap((it) => [
|
|
102
|
-
[`b:${it.dataset.id}`, it.querySelector('.acc__body')],
|
|
103
|
-
...(o.nodeTitles?.includes(it.dataset.id) ? [[`t:${it.dataset.id}`, it.querySelector('.acc__title')]] : []),
|
|
101
|
+
o.report?.(slotMap(acc?.root ? [...acc.root.querySelectorAll(':scope > .gk-acc__item')].flatMap((it) => [
|
|
102
|
+
[`b:${it.dataset.id}`, it.querySelector('.gk-acc__body')],
|
|
103
|
+
...(o.nodeTitles?.includes(it.dataset.id) ? [[`t:${it.dataset.id}`, it.querySelector('.gk-acc__title')]] : []),
|
|
104
104
|
]) : []));
|
|
105
105
|
const destroy = acc.destroy;
|
|
106
106
|
return Object.assign(acc, { destroy() { note(acc).dead = true; destroy(); } });
|
|
@@ -159,7 +159,7 @@ const CarouselInner = mounted('Carousel', (el, o) => {
|
|
|
159
159
|
onChange: (i, h2) => { if (!isQuiet(h2)) o.onChange?.(i, h2); },
|
|
160
160
|
});
|
|
161
161
|
note(c);
|
|
162
|
-
o.report?.(slotMap(c ? [...c.root.querySelectorAll('.cr__slide')].map((s, i) => [String(i), s]) : []));
|
|
162
|
+
o.report?.(slotMap(c ? [...c.root.querySelectorAll('.gk-cr__slide')].map((s, i) => [String(i), s]) : []));
|
|
163
163
|
return c;
|
|
164
164
|
}, {
|
|
165
165
|
props: { ...CR_PROPS, count: ANY, report: Function },
|
|
@@ -188,7 +188,7 @@ export const Carousel = slotted('Carousel', CarouselInner, { ...CR_PROPS, ...mod
|
|
|
188
188
|
const BA_PROPS = { ...anyProps('ratio', 'step', 'words', 'start'), hover: B, hint: B, labels: B };
|
|
189
189
|
const BeforeAfterInner = mounted('BeforeAfter', (el, o) => {
|
|
190
190
|
const ba = C.beforeAfter(el, { ...without(o, ['report', 'value', 'defaultValue']), before: '', after: '', start: o.value ?? o.defaultValue ?? o.start ?? 50 });
|
|
191
|
-
o.report?.(slotMap(ba ? [['before', ba.root.querySelector('.ba__before')], ['after', ba.root.querySelector('.ba__after')]] : []));
|
|
191
|
+
o.report?.(slotMap(ba ? [['before', ba.root.querySelector('.gk-ba__before')], ['after', ba.root.querySelector('.gk-ba__after')]] : []));
|
|
192
192
|
return ba;
|
|
193
193
|
}, {
|
|
194
194
|
props: { ...BA_PROPS, report: Function },
|
|
@@ -304,7 +304,7 @@ const VirtualListInner = mounted('VirtualList', (el, o) => {
|
|
|
304
304
|
opts.render = (item, index) => {
|
|
305
305
|
const k = vlKey(o, item, index);
|
|
306
306
|
let b = boxes.get(k);
|
|
307
|
-
if (!b) { const d = document.createElement('div'); d.className = 'vl__r'; d.style.display = 'contents'; b = { el: d }; }
|
|
307
|
+
if (!b) { const d = document.createElement('div'); d.className = 'gk-vl__r'; d.style.display = 'contents'; b = { el: d }; }
|
|
308
308
|
boxes.set(k, { el: b.el, item, index });
|
|
309
309
|
if (!queued) { queued = true; queueMicrotask(flush); }
|
|
310
310
|
return b.el;
|
|
@@ -415,9 +415,9 @@ export const Calendar = mounted('Calendar', (el, o) => C.calendar(el, {
|
|
|
415
415
|
|
|
416
416
|
const SWIPE_TONES = new Set(['good', 'bad', 'warn', 'accent', 'neutral']);
|
|
417
417
|
const swipeAct = (a) => h('button', {
|
|
418
|
-
key: a.id, type: 'button', class: `swp__act swp__act--${SWIPE_TONES.has(a.tone) ? a.tone : 'neutral'}`,
|
|
418
|
+
key: a.id, type: 'button', class: `gk-swp__act gk-swp__act--${SWIPE_TONES.has(a.tone) ? a.tone : 'neutral'}`,
|
|
419
419
|
'data-act': a.id, 'data-remove': a.remove ? '' : undefined, tabindex: -1,
|
|
420
|
-
}, [h('span', { class: 'swp__in' }, [iconNode(a.icon), h('span', { class: 'swp__lb' }, a.label ?? a.id)])]);
|
|
420
|
+
}, [h('span', { class: 'gk-swp__in' }, [iconNode(a.icon), h('span', { class: 'gk-swp__lb' }, a.label ?? a.id)])]);
|
|
421
421
|
|
|
422
422
|
/**
|
|
423
423
|
* <SwipeItem :id="b.id" :end="[{ id: 'cancel', label: 'Cancel', icon: 'trash', tone: 'bad', remove: true }]">…your row…</SwipeItem>
|
|
@@ -430,11 +430,11 @@ export const SwipeItem = defineComponent({
|
|
|
430
430
|
setup(props, { slots }) {
|
|
431
431
|
return () => h('div', {
|
|
432
432
|
'data-id': props.id != null && props.id !== '' ? String(props.id) : undefined,
|
|
433
|
-
class: ['swp', (props.look === 'icons' || props.look === 'labels') && 'swp--' + props.look],
|
|
433
|
+
class: ['gk-swp', (props.look === 'icons' || props.look === 'labels') && 'gk-swp--' + props.look],
|
|
434
434
|
}, [
|
|
435
|
-
h('div', { class: 'swp__main', tabindex: 0, 'aria-label': props.label || undefined, 'aria-keyshortcuts': 'ArrowLeft ArrowRight' }, slots.default?.()),
|
|
436
|
-
h('div', { class: 'swp__acts swp__acts--start' }, (props.start || []).map(swipeAct)),
|
|
437
|
-
h('div', { class: 'swp__acts swp__acts--end' }, [...(props.end || [])].reverse().map(swipeAct)),
|
|
435
|
+
h('div', { class: 'gk-swp__main', tabindex: 0, 'aria-label': props.label || undefined, 'aria-keyshortcuts': 'ArrowLeft ArrowRight' }, slots.default?.()),
|
|
436
|
+
h('div', { class: 'gk-swp__acts gk-swp__acts--start' }, (props.start || []).map(swipeAct)),
|
|
437
|
+
h('div', { class: 'gk-swp__acts gk-swp__acts--end' }, [...(props.end || [])].reverse().map(swipeAct)),
|
|
438
438
|
]);
|
|
439
439
|
},
|
|
440
440
|
});
|
|
@@ -442,7 +442,7 @@ export const SwipeItem = defineComponent({
|
|
|
442
442
|
const SWIPE_OPTS = ['full', 'fullAt', 'single', 'haptic', 'keepRows'];
|
|
443
443
|
const SWIPE_FNS = ['onAction', 'onOpen', 'onClose'];
|
|
444
444
|
/**
|
|
445
|
-
* <SwipeActions class="card card--flush" @action="(action, ctx) => …">
|
|
445
|
+
* <SwipeActions class="gk-card gk-card--flush" @action="(action, ctx) => …">
|
|
446
446
|
* <SwipeItem v-for="r in rows" :key="r.id" :id="r.id" :end="…">…</SwipeItem>
|
|
447
447
|
* </SwipeActions>
|
|
448
448
|
* Same as swipeActions(list, options) on the element it renders (`as` changes it, default div). A row whose action
|
|
@@ -480,7 +480,7 @@ export const SwipeActions = defineComponent({
|
|
|
480
480
|
const KB_PROPS = { ...anyProps('columns', 'cards', 'render', 'canDrop', 'words'), strictLimit: B, onMove: Function, onOpen: Function, onAdd: Function };
|
|
481
481
|
const KanbanInner = mounted('Kanban', (el, o) => {
|
|
482
482
|
const opts = without(o, ['report', 'teleport']);
|
|
483
|
-
if (o.teleport) opts.render = (c) => `<div class="kb__r" data-kb-r="${C.esc(String(c.id))}" style="display:contents"></div>`;
|
|
483
|
+
if (o.teleport) opts.render = (c) => `<div class="gk-kb__r" data-kb-r="${C.esc(String(c.id))}" style="display:contents"></div>`;
|
|
484
484
|
const kb = C.kanban(el, opts);
|
|
485
485
|
note(kb).scan = () => o.report?.(slotMap([...kb.el.querySelectorAll('[data-kb-r]')].map((x) => [x.dataset.kbR, x])));
|
|
486
486
|
if (o.teleport) note(kb).scan();
|
|
@@ -673,7 +673,7 @@ export const Skeleton = slotted('Skeleton', SkeletonInner, { ...SK_PROPS, loadin
|
|
|
673
673
|
const AL_PROPS = { ...anyProps('tone', 'title', 'icon', 'look', 'actions', 'words'), dismissible: B, open: B, onClose: Function, 'onUpdate:open': Function };
|
|
674
674
|
const AlertInner = mounted('Alert', (el, o) => {
|
|
675
675
|
const box = document.createElement('div');
|
|
676
|
-
box.className = 'al__node'; box.style.display = 'contents';
|
|
676
|
+
box.className = 'gk-al__node'; box.style.display = 'contents';
|
|
677
677
|
let a = null;
|
|
678
678
|
a = C.alert(el, {
|
|
679
679
|
...without(o, ['report', 'hasBody', 'onUpdate:open']), body: o.hasBody ? box : '',
|
package/src/effects.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { Ref, ShallowRef, MaybeRefOrGetter, VNodeChild, StyleValue, Compone
|
|
|
2
2
|
import type { GeckoComponent, ModelProps, IconLike, DefaultSlot, HostAttrs } from './core.js';
|
|
3
3
|
import type { ButtonProps } from './basics.js';
|
|
4
4
|
|
|
5
|
-
/** The look of a .btn (same as <Button>): variant, size, block, type, disabled. */
|
|
5
|
+
/** The look of a .gk-btn (same as <Button>): variant, size, block, type, disabled. */
|
|
6
6
|
type BtnLook = Pick<ButtonProps, 'variant' | 'size' | 'block' | 'type' | 'disabled'>;
|
|
7
7
|
type ClassValue = string | Record<string, unknown> | unknown[];
|
|
8
8
|
|
|
9
9
|
/* ------------------------------------------------------------------ indicator */
|
|
10
10
|
|
|
11
11
|
export interface IndicatorOptions {
|
|
12
|
-
/** Which element in the pill's parent is the active one. Default: [aria-current], [aria-selected="true"], [aria-pressed="true"], .is-active. */
|
|
12
|
+
/** Which element in the pill's parent is the active one. Default: [aria-current], [aria-selected="true"], [aria-pressed="true"], .gk-is-active. */
|
|
13
13
|
selector?: string;
|
|
14
14
|
/** Corner radius of the pill in px (13; 99 = round ends). */
|
|
15
15
|
radius?: number;
|
|
@@ -57,9 +57,9 @@ export interface PageSwapProps {
|
|
|
57
57
|
swapKey: string | number | symbol;
|
|
58
58
|
/** 1 = forward (new page from the right), -1 = back (from the left). */
|
|
59
59
|
dir?: number;
|
|
60
|
-
/** Blocks that fade and drop on the way out (.card, .kpi, .lane, [data-swap]). */
|
|
60
|
+
/** Blocks that fade and drop on the way out (.gk-card, .gk-kpi, .lane, [data-swap]). */
|
|
61
61
|
leave?: string;
|
|
62
|
-
/** Header parts that lift away (.phead, .tabs, .toolbar, .chips). */
|
|
62
|
+
/** Header parts that lift away (.gk-phead, .gk-tabs, .gk-toolbar, .gk-chips). */
|
|
63
63
|
head?: string;
|
|
64
64
|
/** Timing for this swap only (default: the shared swapTiming). */
|
|
65
65
|
timing?: SwapTiming;
|
|
@@ -396,7 +396,7 @@ export interface BurgerProps {
|
|
|
396
396
|
escape?: boolean;
|
|
397
397
|
/** sm (iconbtn--sm). */
|
|
398
398
|
size?: string;
|
|
399
|
-
/** Class of the three lines (size them with --burger-w, --burger-h, --burger-t). */
|
|
399
|
+
/** Class of the three lines (size them with --gk-burger-w, --gk-burger-h, --gk-burger-t). */
|
|
400
400
|
iconClass?: ClassValue;
|
|
401
401
|
/** Runs first; call event.preventDefault() to keep it as it is. */
|
|
402
402
|
onClick?: (event: MouseEvent) => void;
|
package/src/effects.js
CHANGED
|
@@ -38,19 +38,19 @@ const svgOf = (html, cls) => {
|
|
|
38
38
|
const inner = html.slice(html.indexOf('>') + 1, html.lastIndexOf('</svg>'));
|
|
39
39
|
return () => h('svg', { class: cls, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true', innerHTML: inner });
|
|
40
40
|
};
|
|
41
|
-
const binSvg = svgOf(M.binIcon, 'bin');
|
|
42
|
-
const downloadSvg = svgOf(M.downloadIcon, 'dl');
|
|
41
|
+
const binSvg = svgOf(M.binIcon, 'gk-bin');
|
|
42
|
+
const downloadSvg = svgOf(M.downloadIcon, 'gk-dl');
|
|
43
43
|
const btnSig = (a, slots) => [at(a, 'variant'), at(a, 'size'), at(a, 'block'), normalizeClass(a.class), at(a, 'type'), textOf(slots.default?.()), typeof a.icon === 'string' ? a.icon : ''].join('|');
|
|
44
44
|
|
|
45
45
|
/* ------------------------------------------------------------------ indicator */
|
|
46
46
|
|
|
47
|
-
const ACTIVE = '[aria-current]:not([aria-current="false"]), [aria-selected="true"], [aria-pressed="true"], .is-active';
|
|
47
|
+
const ACTIVE = '[aria-current]:not([aria-current="false"]), [aria-selected="true"], [aria-pressed="true"], .gk-is-active';
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* const pill = useIndicator(() => page.value, { radius: 99, line: false, lead, trail, cross, selector })
|
|
51
|
-
* <nav class="menu"><span ref="pill" class="menu__pill" />…items with aria-current…</nav>
|
|
51
|
+
* <nav class="gk-menu"><span ref="pill" class="gk-menu__pill" />…items with aria-current…</nav>
|
|
52
52
|
* Same as indicator(pill, active) + trackIndicator(): when `active` (a ref or getter) changes, the pill stretches
|
|
53
|
-
* to the element in its parent that matches `selector` (default: aria-current / aria-selected / aria-pressed / .is-active).
|
|
53
|
+
* to the element in its parent that matches `selector` (default: aria-current / aria-selected / aria-pressed / .gk-is-active).
|
|
54
54
|
* options: an object, a ref or a getter. Returns the template ref to put on the pill.
|
|
55
55
|
*/
|
|
56
56
|
export function useIndicator(active, options) {
|
|
@@ -80,7 +80,7 @@ export function useIndicator(active, options) {
|
|
|
80
80
|
const PILL = { position: 'absolute', inset: 0, pointerEvents: 'none', opacity: 0, zIndex: -1 };
|
|
81
81
|
const BOX = { position: 'relative', isolation: 'isolate' };
|
|
82
82
|
/**
|
|
83
|
-
* <Indicator as="nav" :active="page" class="menu" pill-class="menu__pill" :radius="99">…buttons with aria-current…</Indicator>
|
|
83
|
+
* <Indicator as="nav" :active="page" class="gk-menu" pill-class="gk-menu__pill" :radius="99">…buttons with aria-current…</Indicator>
|
|
84
84
|
* A box with a stretchy pill (or underline with line) that follows the active child.
|
|
85
85
|
*/
|
|
86
86
|
export const Indicator = defineComponent({
|
|
@@ -92,10 +92,10 @@ export const Indicator = defineComponent({
|
|
|
92
92
|
setup(props, { slots }) {
|
|
93
93
|
const pill = useIndicator(() => props.active, () => ({ selector: props.selector, radius: props.radius, line: props.line, lead: props.lead, trail: props.trail, cross: props.cross }));
|
|
94
94
|
// the same style object on every render, so Vue does not write opacity: 0 back over the visible pill
|
|
95
|
-
const pillStyle = computed(() => normalizeStyle([props.pillClass ? PILL : { ...PILL, background: 'var(--accent)' }, props.pillStyle]));
|
|
95
|
+
const pillStyle = computed(() => normalizeStyle([props.pillClass ? PILL : { ...PILL, background: 'var(--gk-accent)' }, props.pillStyle]));
|
|
96
96
|
// isolation + z-index -1: the pill sits on the box's background but under the items, with no CSS needed
|
|
97
97
|
return () => h(props.as, { style: BOX }, [
|
|
98
|
-
h('span', { ref: pill, class: ['indicator__pill', props.pillClass], 'aria-hidden': 'true', style: pillStyle.value }),
|
|
98
|
+
h('span', { ref: pill, class: ['gk-indicator__pill', props.pillClass], 'aria-hidden': 'true', style: pillStyle.value }),
|
|
99
99
|
slots.default?.(),
|
|
100
100
|
]);
|
|
101
101
|
},
|
|
@@ -148,7 +148,7 @@ export function useFeedback() {
|
|
|
148
148
|
const el = shallowRef(null), used = new Set();
|
|
149
149
|
const on = (fn) => (x, ...a) => { const n = elOf(x, nodeOf(el)); if (!n) return undefined; used.add(n); return fn(n, ...a); };
|
|
150
150
|
onBeforeUnmount(() => {
|
|
151
|
-
for (const n of used) { M.g.killTweensOf([n, n.querySelector?.('svg')].filter(Boolean)); n.classList?.remove('is-flash'); }
|
|
151
|
+
for (const n of used) { M.g.killTweensOf([n, n.querySelector?.('svg')].filter(Boolean)); n.classList?.remove('gk-is-flash'); }
|
|
152
152
|
used.clear();
|
|
153
153
|
});
|
|
154
154
|
return {
|
|
@@ -165,7 +165,7 @@ export function useFeedback() {
|
|
|
165
165
|
export function useFlash(value) {
|
|
166
166
|
const el = shallowRef(null);
|
|
167
167
|
watch(() => toValue(value), () => { const n = nodeOf(el); if (n) M.flash(n); }, { flush: 'post' });
|
|
168
|
-
onBeforeUnmount(() => { const n = nodeOf(el); if (n) { M.g.killTweensOf(n); n.classList.remove('is-flash'); } });
|
|
168
|
+
onBeforeUnmount(() => { const n = nodeOf(el); if (n) { M.g.killTweensOf(n); n.classList.remove('gk-is-flash'); } });
|
|
169
169
|
return el;
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -359,10 +359,10 @@ export function useTheme(options) {
|
|
|
359
359
|
const root = document.documentElement, key = o().storageKey;
|
|
360
360
|
if (!root.dataset.theme && key) M.restoreTheme(key);
|
|
361
361
|
sync();
|
|
362
|
-
addEventListener('themechange', sync);
|
|
362
|
+
addEventListener('gk:themechange', sync);
|
|
363
363
|
mo = new MutationObserver(sync); mo.observe(root, { attributes: true, attributeFilter: ['data-theme'] });
|
|
364
364
|
});
|
|
365
|
-
onBeforeUnmount(() => { removeEventListener('themechange', sync); mo?.disconnect(); mo = null; });
|
|
365
|
+
onBeforeUnmount(() => { removeEventListener('gk:themechange', sync); mo?.disconnect(); mo = null; });
|
|
366
366
|
const set = (next, from) => {
|
|
367
367
|
const v = typeof next === 'function' ? next(M.getTheme()) : next;
|
|
368
368
|
const { storageKey, duration, easing } = o();
|
|
@@ -383,13 +383,13 @@ export const ThemeToggle = defineComponent({
|
|
|
383
383
|
return () => {
|
|
384
384
|
const dark = theme.value === 'dark';
|
|
385
385
|
return h('button', {
|
|
386
|
-
type: 'button', 'aria-label': props.label, class: ['iconbtn', props.size && 'iconbtn--' + props.size],
|
|
386
|
+
type: 'button', 'aria-label': props.label, class: ['gk-iconbtn', props.size && 'gk-iconbtn--' + props.size],
|
|
387
387
|
onClick: (e) => {
|
|
388
388
|
props.onClick?.(e); if (e.defaultPrevented) return;
|
|
389
389
|
const next = dark ? 'light' : 'dark', b = e.currentTarget;
|
|
390
390
|
M.pop(b); setTheme(next, b); props.onChange?.(next);
|
|
391
391
|
},
|
|
392
|
-
}, [h(Icon, { name: dark ? 'sun' : 'moon', class: dark ? 'i-sun' : 'i-moon' })]);
|
|
392
|
+
}, [h(Icon, { name: dark ? 'sun' : 'moon', class: dark ? 'gk-i-sun' : 'gk-i-moon' })]);
|
|
393
393
|
};
|
|
394
394
|
},
|
|
395
395
|
});
|
|
@@ -530,7 +530,7 @@ const HoldInner = defineComponent({
|
|
|
530
530
|
return () => {
|
|
531
531
|
const text = textOf(slots.default?.());
|
|
532
532
|
if (props.look === 'ring') {
|
|
533
|
-
return h('button', { ref: el, type: 'button', 'aria-label': text, class: ['iconbtn', props.size && 'iconbtn--' + props.size] }, [iconNode(props.icon)]);
|
|
533
|
+
return h('button', { ref: el, type: 'button', 'aria-label': text, class: ['gk-iconbtn', props.size && 'gk-iconbtn--' + props.size] }, [iconNode(props.icon)]);
|
|
534
534
|
}
|
|
535
535
|
return h(Button, { ref: el, variant: props.variant, size: props.size, block: props.block, icon: props.icon }, { default: () => text });
|
|
536
536
|
};
|
|
@@ -545,8 +545,8 @@ export const HoldButton = keyed('HoldButton', HoldInner, (a, s) => [btnSig(a, s)
|
|
|
545
545
|
|
|
546
546
|
/* ------------------------------------------------------------------ expanding search */
|
|
547
547
|
|
|
548
|
-
const GLASS_IN = '<g class="xs__glass"><circle cx="10.5" cy="10.5" r="6"/><path d="M15 15l4.5 4.5"/></g>';
|
|
549
|
-
const CROSS_IN = '<path class="xs__x" d="M7 7l10 10" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/><path class="xs__x" d="M17 7 7 17" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/>';
|
|
548
|
+
const GLASS_IN = '<g class="gk-xs__glass"><circle cx="10.5" cy="10.5" r="6"/><path d="M15 15l4.5 4.5"/></g>';
|
|
549
|
+
const CROSS_IN = '<path class="gk-xs__x" d="M7 7l10 10" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/><path class="gk-xs__x" d="M17 7 7 17" pathLength="1" stroke-dasharray="1" stroke-dashoffset="1"/>';
|
|
550
550
|
const svg2 = (cls, html) => h('svg', { class: cls, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'aria-hidden': 'true', innerHTML: html });
|
|
551
551
|
|
|
552
552
|
const SearchInner = defineComponent({
|
|
@@ -581,18 +581,18 @@ const SearchInner = defineComponent({
|
|
|
581
581
|
const a = api; api = null; if (!a) return;
|
|
582
582
|
killAll(a.el); a.destroy();
|
|
583
583
|
// leave the markup closed, as Vue drew it
|
|
584
|
-
a.el.classList.remove('is-open', 'is-closing'); M.g.set([a.el, a.input], { clearProps: 'width,transform,opacity' });
|
|
585
|
-
a.el.querySelector('.xs__btn')?.setAttribute('aria-expanded', 'false');
|
|
586
|
-
a.input.tabIndex = -1; a.input.placeholder = ''; const c = a.el.querySelector('.xs__close'); if (c) c.tabIndex = -1;
|
|
587
|
-
a.el.querySelectorAll('.xs__x').forEach((x) => x.setAttribute('stroke-dashoffset', '1'));
|
|
584
|
+
a.el.classList.remove('gk-is-open', 'gk-is-closing'); M.g.set([a.el, a.input], { clearProps: 'width,transform,opacity' });
|
|
585
|
+
a.el.querySelector('.gk-xs__btn')?.setAttribute('aria-expanded', 'false');
|
|
586
|
+
a.input.tabIndex = -1; a.input.placeholder = ''; const c = a.el.querySelector('.gk-xs__close'); if (c) c.tabIndex = -1;
|
|
587
|
+
a.el.querySelectorAll('.gk-xs__x').forEach((x) => x.setAttribute('stroke-dashoffset', '1'));
|
|
588
588
|
});
|
|
589
589
|
return () => h('form', {
|
|
590
590
|
ref: box, role: 'search', 'data-placeholder': props.placeholder,
|
|
591
|
-
class: ['xs', props.look === 'quiet' && 'xs--quiet', props.size === 'sm' && 'xs--sm'],
|
|
591
|
+
class: ['gk-xs', props.look === 'quiet' && 'gk-xs--quiet', props.size === 'sm' && 'gk-xs--sm'],
|
|
592
592
|
}, [
|
|
593
|
-
h('button', { type: 'button', class: 'xs__btn', 'aria-label': props.label, 'aria-expanded': 'false', 'aria-controls': id }, [svg2('xs__ic', GLASS_IN)]),
|
|
594
|
-
h('input', { class: 'xs__input', id, type: 'search', name: props.name, 'aria-label': props.label, autocomplete: 'off', spellcheck: 'false', enterkeyhint: 'search', tabindex: '-1', value: start }),
|
|
595
|
-
h('button', { type: 'button', class: 'xs__close', 'aria-label': props.closeLabel, tabindex: '-1' }, [svg2(undefined, CROSS_IN)]),
|
|
593
|
+
h('button', { type: 'button', class: 'gk-xs__btn', 'aria-label': props.label, 'aria-expanded': 'false', 'aria-controls': id }, [svg2('gk-xs__ic', GLASS_IN)]),
|
|
594
|
+
h('input', { class: 'gk-xs__input', id, type: 'search', name: props.name, 'aria-label': props.label, autocomplete: 'off', spellcheck: 'false', enterkeyhint: 'search', tabindex: '-1', value: start }),
|
|
595
|
+
h('button', { type: 'button', class: 'gk-xs__close', 'aria-label': props.closeLabel, tabindex: '-1' }, [svg2(undefined, CROSS_IN)]),
|
|
596
596
|
]);
|
|
597
597
|
},
|
|
598
598
|
});
|
|
@@ -627,20 +627,20 @@ const LiquidInner = defineComponent({
|
|
|
627
627
|
onBeforeUnmount(() => { const a = api; api = null; if (a) { killAll(a.el); a.destroy(); } });
|
|
628
628
|
return () => h('nav', {
|
|
629
629
|
ref: nav, 'aria-label': props.label,
|
|
630
|
-
class: ['lq', !props.labels && 'lq--icons', !props.goo && 'lq--plain'], style: { '--lq-goo': `url(#${fid})` },
|
|
630
|
+
class: ['gk-lq', !props.labels && 'gk-lq--icons', !props.goo && 'gk-lq--plain'], style: { '--gk-lq-goo': `url(#${fid})` },
|
|
631
631
|
}, [
|
|
632
|
-
h('svg', { class: 'lq__defs', width: 0, height: 0, 'aria-hidden': 'true', focusable: 'false' }, [
|
|
632
|
+
h('svg', { class: 'gk-lq__defs', width: 0, height: 0, 'aria-hidden': 'true', focusable: 'false' }, [
|
|
633
633
|
h('filter', { id: fid, x: '-10%', y: '-90%', width: '120%', height: '280%', 'color-interpolation-filters': 'sRGB' }, [
|
|
634
634
|
h('feGaussianBlur', { in: 'SourceGraphic', stdDeviation: 7 }),
|
|
635
635
|
h('feColorMatrix', { values: '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 24 -11' }),
|
|
636
636
|
]),
|
|
637
637
|
]),
|
|
638
|
-
h('span', { class: 'lq__goo', 'aria-hidden': 'true' }, [h('span', { class: 'lq__body' }), h('span', { class: 'lq__drop' }), h('span', { class: 'lq__drop' }), h('span', { class: 'lq__bub' })]),
|
|
639
|
-
h('span', { class: 'lq__dot', 'aria-hidden': 'true' }),
|
|
638
|
+
h('span', { class: 'gk-lq__goo', 'aria-hidden': 'true' }, [h('span', { class: 'gk-lq__body' }), h('span', { class: 'gk-lq__drop' }), h('span', { class: 'gk-lq__drop' }), h('span', { class: 'gk-lq__bub' })]),
|
|
639
|
+
h('span', { class: 'gk-lq__dot', 'aria-hidden': 'true' }),
|
|
640
640
|
...props.items.map((it, i) => h(it.href ? (props.linkAs || 'a') : 'button', {
|
|
641
|
-
key: i, class: ['lq__tab', i === first && 'is-on'],
|
|
641
|
+
key: i, class: ['gk-lq__tab', i === first && 'gk-is-on'],
|
|
642
642
|
...(it.href ? (props.linkAs ? { to: it.href } : { href: it.href }) : { type: 'button' }), 'aria-current': i === first ? 'page' : undefined,
|
|
643
|
-
}, [h('span', { class: 'lq__ic', 'aria-hidden': 'true' }, [iconNode(it.icon)]), h('span', { class: 'lq__lb' }, slots.label ? slots.label({ item: it, index: i }) : it.label)])),
|
|
643
|
+
}, [h('span', { class: 'gk-lq__ic', 'aria-hidden': 'true' }, [iconNode(it.icon)]), h('span', { class: 'gk-lq__lb' }, slots.label ? slots.label({ item: it, index: i }) : it.label)])),
|
|
644
644
|
]);
|
|
645
645
|
},
|
|
646
646
|
});
|
|
@@ -685,15 +685,15 @@ export const Burger = defineComponent({
|
|
|
685
685
|
});
|
|
686
686
|
onBeforeUnmount(() => {
|
|
687
687
|
const b = el.value; if (!b) return;
|
|
688
|
-
b.__burger?.tl?.kill(); M.g.set(b.querySelectorAll('.burger > i'), { clearProps: 'all' }); delete b.__burger;
|
|
688
|
+
b.__burger?.tl?.kill(); M.g.set(b.querySelectorAll('.gk-burger > i'), { clearProps: 'all' }); delete b.__burger;
|
|
689
689
|
});
|
|
690
690
|
return () => {
|
|
691
691
|
const w = { ...BURGER_WORDS, ...props.words }, o = !!on.value;
|
|
692
692
|
return h('button', {
|
|
693
693
|
ref: el, type: 'button', 'aria-expanded': String(o), 'aria-label': o ? w.close : w.open, 'aria-controls': props.controls || undefined,
|
|
694
|
-
class: ['iconbtn', props.size && 'iconbtn--' + props.size, o && 'is-open'],
|
|
694
|
+
class: ['gk-iconbtn', props.size && 'gk-iconbtn--' + props.size, o && 'gk-is-open'],
|
|
695
695
|
onClick: (e) => { props.onClick?.(e); if (!e.defaultPrevented) set(!o, e.currentTarget); },
|
|
696
|
-
}, [h('span', { class: ['burger', props.iconClass], 'aria-hidden': 'true' }, [h('i'), h('i'), h('i')])]);
|
|
696
|
+
}, [h('span', { class: ['gk-burger', props.iconClass], 'aria-hidden': 'true' }, [h('i'), h('i'), h('i')])]);
|
|
697
697
|
};
|
|
698
698
|
},
|
|
699
699
|
});
|
package/src/forms.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Most are mounted pieces: the vanilla code builds them inside one element; these components pass props in
|
|
4
4
|
as options, keep the v-model value in step through the piece's own set(), and clean up on unmount.
|
|
5
5
|
PasswordToggle and PasswordMeter's field are drawn by Vue; Wizard teleports your step slots into its panels;
|
|
6
|
-
useValidation is a small composable for the red-field pattern (.field.is-bad + hint + shake). */
|
|
6
|
+
useValidation is a small composable for the red-field pattern (.gk-field.gk-is-bad + hint + shake). */
|
|
7
7
|
import { defineComponent, ref, shallowRef, reactive, watch, onMounted, onBeforeUnmount, useId, mergeProps, getCurrentInstance, Teleport } from 'vue';
|
|
8
8
|
import * as C from '@gecko-ui-kit/components';
|
|
9
9
|
import * as M from '@gecko-ui-kit/motion';
|
|
@@ -232,7 +232,7 @@ const EYE_WORDS = { show: 'Show password', hide: 'Hide password' };
|
|
|
232
232
|
/** The eye with the slash (the same drawing as passwordToggle()). */
|
|
233
233
|
const eye = () => h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true' }, [
|
|
234
234
|
h('path', { d: 'M2.5 12C4.7 8.1 8 6.2 12 6.2s7.3 1.9 9.5 5.8c-2.2 3.9-5.5 5.8-9.5 5.8S4.7 15.9 2.5 12z' }), h('circle', { cx: 12, cy: 12, r: 2.9 }),
|
|
235
|
-
h('path', { class: 'pwm__cut', pathLength: 1, d: 'M4.6 4.2l15.2 15.6' }), h('path', { class: 'pwm__slash', pathLength: 1, d: 'M4.6 4.2l15.2 15.6' }),
|
|
235
|
+
h('path', { class: 'gk-pwm__cut', pathLength: 1, d: 'M4.6 4.2l15.2 15.6' }), h('path', { class: 'gk-pwm__slash', pathLength: 1, d: 'M4.6 4.2l15.2 15.6' }),
|
|
236
236
|
]);
|
|
237
237
|
|
|
238
238
|
/**
|
|
@@ -251,7 +251,7 @@ export const PasswordToggle = defineComponent({
|
|
|
251
251
|
const autoId = useId();
|
|
252
252
|
const input = ref(null), btn = ref(null);
|
|
253
253
|
expose({ input, focus: () => input.value?.focus() });
|
|
254
|
-
const lines = () => btn.value?.querySelectorAll('.pwm__cut, .pwm__slash') ?? [];
|
|
254
|
+
const lines = () => btn.value?.querySelectorAll('.gk-pwm__cut, .gk-pwm__slash') ?? [];
|
|
255
255
|
onMounted(() => {
|
|
256
256
|
let first = true;
|
|
257
257
|
watch(() => !!on.value, (v) => {
|
|
@@ -266,13 +266,13 @@ export const PasswordToggle = defineComponent({
|
|
|
266
266
|
return () => {
|
|
267
267
|
const W = { ...EYE_WORDS, ...props.words };
|
|
268
268
|
const inputId = props.id ?? autoId;
|
|
269
|
-
return h('span', { class: 'pwm__wrap' }, [
|
|
270
|
-
h('input', mergeProps({ class: 'input' }, attrs, {
|
|
269
|
+
return h('span', { class: 'gk-pwm__wrap' }, [
|
|
270
|
+
h('input', mergeProps({ class: 'gk-input' }, attrs, {
|
|
271
271
|
ref: input, id: inputId, type: on.value ? 'text' : 'password', value: text.value,
|
|
272
272
|
onInput: (e) => setText(e.target.value, e),
|
|
273
273
|
})),
|
|
274
274
|
h('button', {
|
|
275
|
-
ref: btn, type: 'button', class: ['pwm__eye', on.value && 'is-on'], 'aria-controls': inputId, 'aria-label': on.value ? W.hide : W.show,
|
|
275
|
+
ref: btn, type: 'button', class: ['gk-pwm__eye', on.value && 'gk-is-on'], 'aria-controls': inputId, 'aria-label': on.value ? W.hide : W.show,
|
|
276
276
|
onMousedown: (e) => e.preventDefault(), // a mouse click keeps the caret in the field
|
|
277
277
|
onClick: () => { M.pop(btn.value); setOn(!on.value); },
|
|
278
278
|
}, [eye()]),
|
|
@@ -316,7 +316,7 @@ export const PasswordMeter = defineComponent({
|
|
|
316
316
|
});
|
|
317
317
|
onBeforeUnmount(destroy);
|
|
318
318
|
return () => h('span', { style: { display: 'contents' }, 'data-gecko': 'PasswordMeter' }, [
|
|
319
|
-
h('input', mergeProps({ type: 'password', autocomplete: 'new-password', class: 'input' }, attrs, {
|
|
319
|
+
h('input', mergeProps({ type: 'password', autocomplete: 'new-password', class: 'gk-input' }, attrs, {
|
|
320
320
|
ref: input, value: text.value, onInput: (e) => setText(e.target.value, e),
|
|
321
321
|
})),
|
|
322
322
|
h('span', { ref: panel, style: { display: 'contents' } }),
|
|
@@ -390,7 +390,7 @@ export const FileDrop = mounted('FileDrop', C.fileDrop, {
|
|
|
390
390
|
const WizardBase = mounted('Wizard', (el, o) => {
|
|
391
391
|
const { onPanels, index, ...opts } = o;
|
|
392
392
|
const wz = C.wizard(el, { ...opts, start: index ?? opts.start });
|
|
393
|
-
onPanels?.(wz ? [...el.querySelectorAll('.wz__panel:not(.wz__fin) > .wz__body')] : []);
|
|
393
|
+
onPanels?.(wz ? [...el.querySelectorAll('.gk-wz__panel:not(.gk-wz__fin) > .gk-wz__body')] : []);
|
|
394
394
|
return wz;
|
|
395
395
|
}, {
|
|
396
396
|
props: { ...anyProps('steps', 'index', 'start', 'header', 'level', 'label', 'words'), linear: B, onStep: Function, onFinish: Function, onPanels: Function },
|
|
@@ -443,8 +443,8 @@ const okMsg = (m) => (m == null || m === true || m === false || m === '' ? '' :
|
|
|
443
443
|
/**
|
|
444
444
|
* const v = useValidation({ email: (value) => (/^\S+@\S+\.\S+$/.test(value) ? '' : 'That email looks incomplete.') })
|
|
445
445
|
* <label :class="['field', { 'is-bad': v.errors.email }]"><span>Email</span>
|
|
446
|
-
* <input class="input" v-bind="v.field('email')" />
|
|
447
|
-
* <small class="field__hint">{{ v.errors.email || 'We send one email a month.' }}</small></label>
|
|
446
|
+
* <input class="gk-input" v-bind="v.field('email')" />
|
|
447
|
+
* <small class="gk-field__hint">{{ v.errors.email || 'We send one email a month.' }}</small></label>
|
|
448
448
|
* <Button @click="v.validate() && send(v.values())">Join</Button>
|
|
449
449
|
* A rule gets (value, values) and returns '' (fine) or the message. validate() marks every bad field, shakes it and
|
|
450
450
|
* returns true when all are fine; with live (default) a red field is checked again on every key.
|
package/src/motion.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface RiseProps {
|
|
|
25
25
|
/** Children added later arrive the same way (true). */
|
|
26
26
|
animateNew?: boolean;
|
|
27
27
|
}
|
|
28
|
-
/** <Rise class="grid">…cards…</Rise> — the children arrive one after another (rise / slide / deal / reveal). */
|
|
28
|
+
/** <Rise class="gk-grid">…cards…</Rise> — the children arrive one after another (rise / slide / deal / reveal). */
|
|
29
29
|
export const Rise: GeckoComponent<RiseProps, DefaultSlot>;
|
|
30
30
|
|
|
31
31
|
/* ---------------- Magnetic & Lift ---------------- */
|
|
@@ -57,7 +57,7 @@ export interface TiltOptions {
|
|
|
57
57
|
scale?: number;
|
|
58
58
|
/** px of 3D depth; smaller = stronger (900). */
|
|
59
59
|
perspective?: number;
|
|
60
|
-
/** A soft light that follows the pointer (true). Colour: --tilt-glare. */
|
|
60
|
+
/** A soft light that follows the pointer (true). Colour: --gk-tilt-glare. */
|
|
61
61
|
glare?: boolean;
|
|
62
62
|
/** How far data-depth layers drift, as a share of their depth (0.25). */
|
|
63
63
|
parallax?: number;
|
|
@@ -66,7 +66,7 @@ export interface TiltOptions {
|
|
|
66
66
|
/** Seconds it takes to settle back (1). */
|
|
67
67
|
spring?: number;
|
|
68
68
|
}
|
|
69
|
-
/** <Tilt :max="12" glare class="card">…children with data-depth…</Tilt> */
|
|
69
|
+
/** <Tilt :max="12" glare class="gk-card">…children with data-depth…</Tilt> */
|
|
70
70
|
export const Tilt: GeckoComponent<EnhancerProps<TiltOptions>, DefaultSlot>;
|
|
71
71
|
|
|
72
72
|
/* ---------------- Spotlight ---------------- */
|
|
@@ -101,7 +101,7 @@ export interface MarqueeProps {
|
|
|
101
101
|
direction?: 'left' | 'right';
|
|
102
102
|
/** Hover or keyboard focus slows it to a stop (true). */
|
|
103
103
|
pauseOnHover?: boolean;
|
|
104
|
-
/** Space between items: px, or any CSS length (default --marquee-gap, 40px). */
|
|
104
|
+
/** Space between items: px, or any CSS length (default --gk-marquee-gap, 40px). */
|
|
105
105
|
gap?: number | string;
|
|
106
106
|
/** Soften the left and right edges (true). */
|
|
107
107
|
fade?: boolean;
|
package/src/motion.js
CHANGED
|
@@ -9,7 +9,7 @@ import { h, B, ANY, anyProps, enhancer, same, changedOnly, vnodeKey } from './co
|
|
|
9
9
|
|
|
10
10
|
const KINDS = ['rise', 'slide', 'deal', 'reveal'];
|
|
11
11
|
/**
|
|
12
|
-
* <Rise class="grid"><BikeCard v-for="b in bikes" :key="b.id" :bike="b" /></Rise>
|
|
12
|
+
* <Rise class="gk-grid"><BikeCard v-for="b in bikes" :key="b.id" :bike="b" /></Rise>
|
|
13
13
|
* <Rise kind="slide" :x="-24" :stagger="0.04">…rows…</Rise> <Rise kind="deal" :tilt="4">…cards…</Rise>
|
|
14
14
|
* Same as rise / slide / deal(els, options): the children arrive one after another when it mounts, and children
|
|
15
15
|
* added later arrive the same way (animate-new, on by default). kind="reveal" is the small fade-down of
|
|
@@ -64,7 +64,7 @@ export const Rise = defineComponent({
|
|
|
64
64
|
|
|
65
65
|
/* ---------------- Magnetic & Lift ---------------- */
|
|
66
66
|
|
|
67
|
-
const MagneticMotion = enhancer('MagneticMotion', (el, o) => M.magnetic(el, o), { tag: 'span', props: anyProps('strength', 'strengthY'), class: 'magnetic' });
|
|
67
|
+
const MagneticMotion = enhancer('MagneticMotion', (el, o) => M.magnetic(el, o), { tag: 'span', props: anyProps('strength', 'strengthY'), class: 'gk-magnetic' });
|
|
68
68
|
/**
|
|
69
69
|
* <Magnetic><Button variant="primary" icon-right="arrowR">Book a bike</Button></Magnetic>
|
|
70
70
|
* Same as magnetic(el, { strength, strengthY }): the element leans toward the pointer and springs back
|
|
@@ -83,7 +83,7 @@ export const Magnetic = defineComponent({
|
|
|
83
83
|
|
|
84
84
|
const LiftMotion = enhancer('LiftMotion', (el, o) => M.lift(el, o.y), { props: anyProps('y') });
|
|
85
85
|
/**
|
|
86
|
-
* <Lift as="article" :y="-6" class="card">…</Lift>
|
|
86
|
+
* <Lift as="article" :y="-6" class="gk-card">…</Lift>
|
|
87
87
|
* Same as lift(el, y): the element rises a few pixels while the pointer is over it (mouse / trackpad only).
|
|
88
88
|
*/
|
|
89
89
|
export const Lift = defineComponent({
|
|
@@ -96,12 +96,12 @@ export const Lift = defineComponent({
|
|
|
96
96
|
|
|
97
97
|
/* ---------------- Tilt ---------------- */
|
|
98
98
|
/**
|
|
99
|
-
* <Tilt :max="12" glare class="card"><img data-depth="40" src="lamp.png" alt="" /><h3 data-depth="20">Lamp</h3></Tilt>
|
|
99
|
+
* <Tilt :max="12" glare class="gk-card"><img data-depth="40" src="lamp.png" alt="" /><h3 data-depth="20">Lamp</h3></Tilt>
|
|
100
100
|
* Same as tilt(el, options). Children with data-depth float above the card. as="article" changes the element.
|
|
101
101
|
*/
|
|
102
102
|
export const Tilt = enhancer('Tilt', (el, o) => M.tilt(el, o), {
|
|
103
103
|
props: { ...anyProps('max', 'scale', 'perspective', 'parallax', 'follow', 'spring'), glare: B },
|
|
104
|
-
class: 'tilt', rerunOnChildren: true,
|
|
104
|
+
class: 'gk-tilt', rerunOnChildren: true,
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
/* ---------------- Spotlight ---------------- */
|
|
@@ -110,7 +110,7 @@ const SpotlightMotion = enhancer('SpotlightMotion', (el, o) => M.spotlight(el, o
|
|
|
110
110
|
props: { ...anyProps('items', 'size', 'follow'), border: B, fill: B, focus: B }, rerunOnChildren: true,
|
|
111
111
|
});
|
|
112
112
|
/**
|
|
113
|
-
* <Spotlight class="plans" :size="300"><div v-for="p in plans" :key="p.id" class="card">…</div></Spotlight>
|
|
113
|
+
* <Spotlight class="plans" :size="300"><div v-for="p in plans" :key="p.id" class="gk-card">…</div></Spotlight>
|
|
114
114
|
* Same as spotlight(group, options): a soft light follows the pointer across the cards (its children, or `items`)
|
|
115
115
|
* and lights up their edges; a card with keyboard focus pulls the light onto itself.
|
|
116
116
|
*/
|
|
@@ -120,7 +120,7 @@ export const Spotlight = defineComponent({
|
|
|
120
120
|
setup(props, { slots }) {
|
|
121
121
|
return () => h(SpotlightMotion, {
|
|
122
122
|
items: props.items, size: props.size, follow: props.follow, border: props.border, fill: props.fill, focus: props.focus, as: props.as,
|
|
123
|
-
class: ['spotlight', props.border === false && 'spotlight--no-ring', props.fill === false && 'spotlight--no-fill'],
|
|
123
|
+
class: ['gk-spotlight', props.border === false && 'gk-spotlight--no-ring', props.fill === false && 'gk-spotlight--no-fill'],
|
|
124
124
|
}, slots);
|
|
125
125
|
},
|
|
126
126
|
});
|
|
@@ -205,12 +205,12 @@ export const Marquee = defineComponent({
|
|
|
205
205
|
return () => {
|
|
206
206
|
const list = flat(slots.default?.());
|
|
207
207
|
items = keyOf(list);
|
|
208
|
-
const own = ['marquee', props.fade !== false && 'marquee--fade'];
|
|
208
|
+
const own = ['gk-marquee', props.fade !== false && 'gk-marquee--fade'];
|
|
209
209
|
lastClass = String(normalizeClass([own, attrs.class]) || '');
|
|
210
|
-
const gap = props.gap != null ? { '--marquee-gap': typeof props.gap === 'number' ? `${props.gap}px` : props.gap } : null;
|
|
210
|
+
const gap = props.gap != null ? { '--gk-marquee-gap': typeof props.gap === 'number' ? `${props.gap}px` : props.gap } : null;
|
|
211
211
|
const item = props.listAs === 'ul' || props.listAs === 'ol' ? 'li' : 'div';
|
|
212
212
|
return h(props.as || 'div', { ref: el, class: own, style: gap },
|
|
213
|
-
[h(props.listAs || 'ul', { class: 'marquee__list' }, list.map((c, i) => h(item, { key: isVNode(c) && c.key != null ? c.key : '_' + i }, [c])))]);
|
|
213
|
+
[h(props.listAs || 'ul', { class: 'gk-marquee__list' }, list.map((c, i) => h(item, { key: isVNode(c) && c.key != null ? c.key : '_' + i }, [c])))]);
|
|
214
214
|
};
|
|
215
215
|
},
|
|
216
216
|
});
|
package/src/overlays.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export type AnchorLike = Element | Ref<Element | null | undefined> | { $el: Elem
|
|
|
6
6
|
|
|
7
7
|
/* ---------------- Modal ---------------- */
|
|
8
8
|
export interface ModalProps {
|
|
9
|
+
/** Labels: { close } is the ✕ button's accessible name (default 'Close'). */
|
|
10
|
+
words?: { close?: string };
|
|
9
11
|
/** Open (true) or closed (false); use v-model:open. It opens and closes with its animation. */
|
|
10
12
|
open?: boolean;
|
|
11
13
|
'onUpdate:open'?: (open: boolean) => void;
|
|
@@ -25,6 +27,8 @@ export const Modal: GeckoComponent<ModalProps, { default?: () => VNodeChild; tit
|
|
|
25
27
|
|
|
26
28
|
/* ---------------- Drawer ---------------- */
|
|
27
29
|
export interface DrawerProps {
|
|
30
|
+
/** Labels: { close } is the ✕ button's accessible name (default 'Close'). */
|
|
31
|
+
words?: { close?: string };
|
|
28
32
|
/** Open (true) or closed (false); use v-model:open. */
|
|
29
33
|
open?: boolean;
|
|
30
34
|
'onUpdate:open'?: (open: boolean) => void;
|
|
@@ -68,7 +72,7 @@ export interface PopoverHandle {
|
|
|
68
72
|
close(): void;
|
|
69
73
|
/** True while it is open. */
|
|
70
74
|
readonly isOpen: boolean;
|
|
71
|
-
/** The open panel (.pop), or null. */
|
|
75
|
+
/** The open panel (.gk-pop), or null. */
|
|
72
76
|
readonly el: HTMLElement | null;
|
|
73
77
|
}
|
|
74
78
|
export interface PopoverProps {
|
|
@@ -277,7 +281,7 @@ export interface LoadingBarOptions {
|
|
|
277
281
|
mount?: AnchorLike | string;
|
|
278
282
|
/** Height in px (or any CSS length). Default 3. */
|
|
279
283
|
height?: number | string;
|
|
280
|
-
/** Any CSS colour. Default var(--accent). */
|
|
284
|
+
/** Any CSS colour. Default var(--gk-accent). */
|
|
281
285
|
color?: string;
|
|
282
286
|
/** Creep forward on its own: true, a speed (0.5 slower, 2 faster) or false. */
|
|
283
287
|
trickle?: boolean | number;
|