@yewdiel21/motion-kit 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/bin/motion-kit.mjs +0 -0
- package/dist/auto/index.js +2 -2
- package/dist/{chunk-PEDYJ2TV.js → chunk-LIXSOGS2.js} +2 -2
- package/dist/chunk-LIXSOGS2.js.map +1 -0
- package/dist/{chunk-Y4GIBTRG.js → chunk-NCGNIPJE.js} +9 -2
- package/dist/{chunk-Y4GIBTRG.js.map → chunk-NCGNIPJE.js.map} +1 -1
- package/dist/{chunk-KDIJX6G4.js → chunk-PVN7YVKV.js} +2 -2
- package/dist/css/components/pill-button.css +7 -5
- package/dist/css/components/scroll-island.css +6 -0
- package/dist/elements/index.js +2 -2
- package/dist/index.css +13 -5
- package/dist/index.js +3 -3
- package/dist/react/index.js +3 -3
- package/package.json +16 -9
- package/src/components/pill-button/engine.ts +1 -1
- package/src/components/pill-button/pill-button.css +7 -5
- package/src/components/scroll-island/engine.ts +10 -1
- package/src/components/scroll-island/scroll-island.css +6 -0
- package/dist/chunk-PEDYJ2TV.js.map +0 -1
- /package/dist/{chunk-KDIJX6G4.js.map → chunk-PVN7YVKV.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
slideIndicator,
|
|
19
19
|
splitGraphemes,
|
|
20
20
|
takeMovement
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NCGNIPJE.js";
|
|
22
22
|
import {
|
|
23
23
|
clamp,
|
|
24
24
|
damp,
|
|
@@ -4491,4 +4491,4 @@ export {
|
|
|
4491
4491
|
createScrollDock,
|
|
4492
4492
|
createLocalClock
|
|
4493
4493
|
};
|
|
4494
|
-
//# sourceMappingURL=chunk-
|
|
4494
|
+
//# sourceMappingURL=chunk-PVN7YVKV.js.map
|
|
@@ -52,19 +52,24 @@ mk-pill-button {
|
|
|
52
52
|
|
|
53
53
|
[data-mk-pill-icon] {
|
|
54
54
|
display: inline-grid;
|
|
55
|
+
flex: none;
|
|
55
56
|
place-items: center;
|
|
56
57
|
width: 1.125rem;
|
|
57
58
|
height: 1.125rem;
|
|
59
|
+
font-size: 1.125rem;
|
|
58
60
|
color: var(--mk-pill-on-ink);
|
|
59
|
-
transition: transform 0.45s var(--mk-ease-swatch);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
[data-mk-pill-icon] svg {
|
|
63
|
+
[data-mk-pill-icon] :is(svg, .mk-icon) {
|
|
63
64
|
display: block;
|
|
64
65
|
width: 100%;
|
|
65
66
|
height: 100%;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
[data-mk-pill-icon] .mk-icon {
|
|
70
|
+
font-size: inherit;
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
/* Gathered: on hover, keyboard focus or a tap. */
|
|
69
74
|
@media (hover: hover) {
|
|
70
75
|
:is([data-mk-pill=''], .mk-pill-button:is(button, a):not([data-mk-pill])):hover [data-mk-pill-fill] {
|
|
@@ -74,9 +79,6 @@ mk-pill-button {
|
|
|
74
79
|
color: var(--mk-pill-ink);
|
|
75
80
|
transform: translateX(-0.5rem);
|
|
76
81
|
}
|
|
77
|
-
:is([data-mk-pill], .mk-pill-button:is(button, a)):hover [data-mk-pill-icon] {
|
|
78
|
-
transform: translateX(2px);
|
|
79
|
-
}
|
|
80
82
|
}
|
|
81
83
|
[data-mk-pill='']:is(:focus-visible, [data-mk-active]) [data-mk-pill-fill] {
|
|
82
84
|
clip-path: var(--mk-pill-gathered);
|
|
@@ -74,6 +74,8 @@ mk-scroll-island {
|
|
|
74
74
|
[data-mk-island-content] {
|
|
75
75
|
display: inline-flex;
|
|
76
76
|
flex: none;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
width: max-content;
|
|
77
79
|
max-width: 100%;
|
|
78
80
|
min-width: 0;
|
|
79
81
|
align-items: center;
|
|
@@ -88,6 +90,10 @@ mk-scroll-island {
|
|
|
88
90
|
transition: opacity 0.18s ease;
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
[data-mk-island-percent] {
|
|
94
|
+
flex: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
[data-mk-scroll-island][data-mk-state='island'] [data-mk-island-content] {
|
|
92
98
|
opacity: 1;
|
|
93
99
|
transition-delay: 0.1s;
|
package/dist/elements/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
createToolbar,
|
|
17
17
|
createVoiceDots,
|
|
18
18
|
toast
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-LIXSOGS2.js";
|
|
20
20
|
import {
|
|
21
21
|
createActivityFeed,
|
|
22
22
|
createAddToCart,
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
createWaveformPlayer,
|
|
105
105
|
createWheelPicker,
|
|
106
106
|
iconSvg
|
|
107
|
-
} from "../chunk-
|
|
107
|
+
} from "../chunk-NCGNIPJE.js";
|
|
108
108
|
import "../chunk-RVSKEBIC.js";
|
|
109
109
|
import "../chunk-OLT3CWDJ.js";
|
|
110
110
|
import "../chunk-TGV27ZWM.js";
|
package/dist/index.css
CHANGED
|
@@ -16118,6 +16118,8 @@ mk-scroll-island {
|
|
|
16118
16118
|
[data-mk-island-content] {
|
|
16119
16119
|
display: inline-flex;
|
|
16120
16120
|
flex: none;
|
|
16121
|
+
box-sizing: border-box;
|
|
16122
|
+
width: max-content;
|
|
16121
16123
|
max-width: 100%;
|
|
16122
16124
|
min-width: 0;
|
|
16123
16125
|
align-items: center;
|
|
@@ -16132,6 +16134,10 @@ mk-scroll-island {
|
|
|
16132
16134
|
transition: opacity 0.18s ease;
|
|
16133
16135
|
}
|
|
16134
16136
|
|
|
16137
|
+
[data-mk-island-percent] {
|
|
16138
|
+
flex: none;
|
|
16139
|
+
}
|
|
16140
|
+
|
|
16135
16141
|
[data-mk-scroll-island][data-mk-state='island'] [data-mk-island-content] {
|
|
16136
16142
|
opacity: 1;
|
|
16137
16143
|
transition-delay: 0.1s;
|
|
@@ -16211,19 +16217,24 @@ mk-pill-button {
|
|
|
16211
16217
|
|
|
16212
16218
|
[data-mk-pill-icon] {
|
|
16213
16219
|
display: inline-grid;
|
|
16220
|
+
flex: none;
|
|
16214
16221
|
place-items: center;
|
|
16215
16222
|
width: 1.125rem;
|
|
16216
16223
|
height: 1.125rem;
|
|
16224
|
+
font-size: 1.125rem;
|
|
16217
16225
|
color: var(--mk-pill-on-ink);
|
|
16218
|
-
transition: transform 0.45s var(--mk-ease-swatch);
|
|
16219
16226
|
}
|
|
16220
16227
|
|
|
16221
|
-
[data-mk-pill-icon] svg {
|
|
16228
|
+
[data-mk-pill-icon] :is(svg, .mk-icon) {
|
|
16222
16229
|
display: block;
|
|
16223
16230
|
width: 100%;
|
|
16224
16231
|
height: 100%;
|
|
16225
16232
|
}
|
|
16226
16233
|
|
|
16234
|
+
[data-mk-pill-icon] .mk-icon {
|
|
16235
|
+
font-size: inherit;
|
|
16236
|
+
}
|
|
16237
|
+
|
|
16227
16238
|
/* Gathered: on hover, keyboard focus or a tap. */
|
|
16228
16239
|
@media (hover: hover) {
|
|
16229
16240
|
:is([data-mk-pill=''], .mk-pill-button:is(button, a):not([data-mk-pill])):hover [data-mk-pill-fill] {
|
|
@@ -16233,9 +16244,6 @@ mk-pill-button {
|
|
|
16233
16244
|
color: var(--mk-pill-ink);
|
|
16234
16245
|
transform: translateX(-0.5rem);
|
|
16235
16246
|
}
|
|
16236
|
-
:is([data-mk-pill], .mk-pill-button:is(button, a)):hover [data-mk-pill-icon] {
|
|
16237
|
-
transform: translateX(2px);
|
|
16238
|
-
}
|
|
16239
16247
|
}
|
|
16240
16248
|
[data-mk-pill='']:is(:focus-visible, [data-mk-active]) [data-mk-pill-fill] {
|
|
16241
16249
|
clip-path: var(--mk-pill-gathered);
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
reflowLayout,
|
|
59
59
|
toggleDetails,
|
|
60
60
|
trackScroll
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-PVN7YVKV.js";
|
|
62
62
|
import {
|
|
63
63
|
NAV_STYLES,
|
|
64
64
|
NAV_STYLE_ALIASES,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
toNavStyle,
|
|
96
96
|
toast,
|
|
97
97
|
toastTimers
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-LIXSOGS2.js";
|
|
99
99
|
import {
|
|
100
100
|
BRAND_LABELS,
|
|
101
101
|
CHANNEL_LABELS,
|
|
@@ -331,7 +331,7 @@ import {
|
|
|
331
331
|
tokenize,
|
|
332
332
|
transparentColor,
|
|
333
333
|
tweenNumber
|
|
334
|
-
} from "./chunk-
|
|
334
|
+
} from "./chunk-NCGNIPJE.js";
|
|
335
335
|
import "./chunk-RVSKEBIC.js";
|
|
336
336
|
import {
|
|
337
337
|
clamp,
|
package/dist/react/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
pileLayers,
|
|
56
56
|
pileStyle,
|
|
57
57
|
reflowLayout
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-PVN7YVKV.js";
|
|
59
59
|
import {
|
|
60
60
|
NAV_STYLES,
|
|
61
61
|
NAV_STYLE_ALIASES,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
revealShell,
|
|
84
84
|
toNavStyle,
|
|
85
85
|
toast
|
|
86
|
-
} from "../chunk-
|
|
86
|
+
} from "../chunk-LIXSOGS2.js";
|
|
87
87
|
import {
|
|
88
88
|
ICON_PATHS,
|
|
89
89
|
confetti,
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
tokenLines,
|
|
187
187
|
tokenize,
|
|
188
188
|
tweenNumber
|
|
189
|
-
} from "../chunk-
|
|
189
|
+
} from "../chunk-NCGNIPJE.js";
|
|
190
190
|
import {
|
|
191
191
|
DEFAULT_THEME,
|
|
192
192
|
MK_THEME_HEAD_SCRIPT,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yewdiel21/motion-kit",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Motion toolkit for vanilla, Astro and React: GSAP recipes, accessible components, 19 themes, CSS controls and optional WebGL effects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -8,7 +8,15 @@
|
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/YewdielMartinez/motion-kit/issues"
|
|
10
10
|
},
|
|
11
|
-
"keywords": [
|
|
11
|
+
"keywords": [
|
|
12
|
+
"animation",
|
|
13
|
+
"gsap",
|
|
14
|
+
"react",
|
|
15
|
+
"astro",
|
|
16
|
+
"webgl",
|
|
17
|
+
"motion",
|
|
18
|
+
"ui"
|
|
19
|
+
],
|
|
12
20
|
"repository": {
|
|
13
21
|
"type": "git",
|
|
14
22
|
"url": "git+https://github.com/YewdielMartinez/motion-kit.git",
|
|
@@ -69,12 +77,6 @@
|
|
|
69
77
|
"NOTICE",
|
|
70
78
|
"css.d.ts"
|
|
71
79
|
],
|
|
72
|
-
"scripts": {
|
|
73
|
-
"build": "tsup && node scripts/build-css.mjs",
|
|
74
|
-
"prepack": "pnpm run build",
|
|
75
|
-
"test": "vitest run",
|
|
76
|
-
"typecheck": "tsc --noEmit"
|
|
77
|
-
},
|
|
78
80
|
"peerDependencies": {
|
|
79
81
|
"gsap": ">=3.13.0",
|
|
80
82
|
"react": ">=18",
|
|
@@ -106,5 +108,10 @@
|
|
|
106
108
|
"tsup": "^8.5.1",
|
|
107
109
|
"typescript": "5.9.3",
|
|
108
110
|
"vitest": "4.1.11"
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"build": "tsup && node scripts/build-css.mjs",
|
|
114
|
+
"test": "vitest run",
|
|
115
|
+
"typecheck": "tsc --noEmit"
|
|
109
116
|
}
|
|
110
|
-
}
|
|
117
|
+
}
|
|
@@ -7,7 +7,7 @@ import { press } from '../../motion/micro';
|
|
|
7
7
|
* Pill button: a dark pill with a label and an arrow. When the pointer comes in
|
|
8
8
|
* (or the keyboard focuses it) the dark fill gathers into a circle around the
|
|
9
9
|
* icon on the swatch curve (.38,.49,0,1.5, a small overshoot), the label slides
|
|
10
|
-
* left and turns to the text colour, and the arrow
|
|
10
|
+
* left and turns to the text colour, and the arrow stays centred; leaving, the
|
|
11
11
|
* fill spreads back into the pill. `expand` turns it around: a circle by the
|
|
12
12
|
* label that spreads into the pill. The motion is CSS (pill-button.css); the
|
|
13
13
|
* engine builds the label, icon and fill when the markup lacks them, presses on
|
|
@@ -51,19 +51,24 @@ mk-pill-button {
|
|
|
51
51
|
|
|
52
52
|
[data-mk-pill-icon] {
|
|
53
53
|
display: inline-grid;
|
|
54
|
+
flex: none;
|
|
54
55
|
place-items: center;
|
|
55
56
|
width: 1.125rem;
|
|
56
57
|
height: 1.125rem;
|
|
58
|
+
font-size: 1.125rem;
|
|
57
59
|
color: var(--mk-pill-on-ink);
|
|
58
|
-
transition: transform 0.45s var(--mk-ease-swatch);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
[data-mk-pill-icon] svg {
|
|
62
|
+
[data-mk-pill-icon] :is(svg, .mk-icon) {
|
|
62
63
|
display: block;
|
|
63
64
|
width: 100%;
|
|
64
65
|
height: 100%;
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
[data-mk-pill-icon] .mk-icon {
|
|
69
|
+
font-size: inherit;
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
/* Gathered: on hover, keyboard focus or a tap. */
|
|
68
73
|
@media (hover: hover) {
|
|
69
74
|
:is([data-mk-pill=''], .mk-pill-button:is(button, a):not([data-mk-pill])):hover [data-mk-pill-fill] {
|
|
@@ -73,9 +78,6 @@ mk-pill-button {
|
|
|
73
78
|
color: var(--mk-pill-ink);
|
|
74
79
|
transform: translateX(-0.5rem);
|
|
75
80
|
}
|
|
76
|
-
:is([data-mk-pill], .mk-pill-button:is(button, a)):hover [data-mk-pill-icon] {
|
|
77
|
-
transform: translateX(2px);
|
|
78
|
-
}
|
|
79
81
|
}
|
|
80
82
|
[data-mk-pill='']:is(:focus-visible, [data-mk-active]) [data-mk-pill-fill] {
|
|
81
83
|
clip-path: var(--mk-pill-gathered);
|
|
@@ -129,7 +129,12 @@ export function createScrollIsland(root: HTMLElement | null, options: ScrollIsla
|
|
|
129
129
|
const size = as === 'island' ? ISLAND_HEIGHT : Math.max(MIN_BAR, Math.min(height, height * (scroller.clientHeight / Math.max(1, scroller.scrollHeight))));
|
|
130
130
|
const top = (height - size) * progress();
|
|
131
131
|
if (as !== 'island') return { top, height: size, width: BAR_WIDTH, borderRadius: BAR_WIDTH / 2 };
|
|
132
|
-
|
|
132
|
+
// Measure at the content's natural width, independent of the collapsed bar
|
|
133
|
+
// or an interrupted expansion. Padding is already included in offsetWidth.
|
|
134
|
+
content.style.maxWidth = 'none';
|
|
135
|
+
const width = content.offsetWidth;
|
|
136
|
+
content.style.removeProperty('max-width');
|
|
137
|
+
return { top, height: size, width: Math.min(Math.max(ISLAND_HEIGHT, track().right - track().left - INSET * 2), Math.max(ISLAND_HEIGHT, width)), borderRadius: size / 2 };
|
|
133
138
|
};
|
|
134
139
|
|
|
135
140
|
const place = () => {
|
|
@@ -189,6 +194,10 @@ export function createScrollIsland(root: HTMLElement | null, options: ScrollIsla
|
|
|
189
194
|
scope.on(window, 'resize', () => go(state, true));
|
|
190
195
|
|
|
191
196
|
const near = (x: number, y: number) => {
|
|
197
|
+
if (state === 'island') {
|
|
198
|
+
const capsule = thumb.getBoundingClientRect();
|
|
199
|
+
if (x >= capsule.left && x <= capsule.right && y >= capsule.top && y <= capsule.bottom) return true;
|
|
200
|
+
}
|
|
192
201
|
const box = track();
|
|
193
202
|
return y >= box.top - INSET && y <= box.top + box.height + INSET && x <= box.right && box.right - x <= reach;
|
|
194
203
|
};
|
|
@@ -73,6 +73,8 @@ mk-scroll-island {
|
|
|
73
73
|
[data-mk-island-content] {
|
|
74
74
|
display: inline-flex;
|
|
75
75
|
flex: none;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
width: max-content;
|
|
76
78
|
max-width: 100%;
|
|
77
79
|
min-width: 0;
|
|
78
80
|
align-items: center;
|
|
@@ -87,6 +89,10 @@ mk-scroll-island {
|
|
|
87
89
|
transition: opacity 0.18s ease;
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
[data-mk-island-percent] {
|
|
93
|
+
flex: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
[data-mk-scroll-island][data-mk-state='island'] [data-mk-island-content] {
|
|
91
97
|
opacity: 1;
|
|
92
98
|
transition-delay: 0.1s;
|