material-plus-ui 1.0.0 → 1.1.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/dist/components/animate-appear/MPAnimateAppear.d.ts +56 -0
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -0
- package/dist/components/animate-appear/index.d.ts +2 -0
- package/dist/components/animate-appear/index.js +1 -0
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +41 -0
- package/dist/components/animate-blink/MPAnimateBlink.js +1 -0
- package/dist/components/animate-blink/index.d.ts +2 -0
- package/dist/components/animate-blink/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +38 -0
- package/dist/components/animate-fade/MPAnimateFade.js +1 -0
- package/dist/components/animate-fade/index.d.ts +2 -0
- package/dist/components/animate-fade/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +52 -0
- package/dist/components/animate-grow/MPAnimateGrow.js +1 -0
- package/dist/components/animate-grow/index.d.ts +2 -0
- package/dist/components/animate-grow/index.js +1 -0
- package/dist/components/animate-headline/MPAnimateHeadline.d.ts +63 -0
- package/dist/components/animate-headline/MPAnimateHeadline.js +1 -0
- package/dist/components/animate-headline/index.d.ts +2 -0
- package/dist/components/animate-headline/index.js +1 -0
- package/dist/components/animate-lighting/MPAnimateLighting.d.ts +68 -0
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-lighting/index.d.ts +2 -0
- package/dist/components/animate-lighting/index.js +1 -0
- package/dist/components/animate-marquee/MPAnimateMarquee.d.ts +66 -0
- package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -0
- package/dist/components/animate-marquee/index.d.ts +2 -0
- package/dist/components/animate-marquee/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +56 -0
- package/dist/components/animate-rotate/MPAnimateRotate.js +1 -0
- package/dist/components/animate-rotate/index.d.ts +2 -0
- package/dist/components/animate-rotate/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +53 -0
- package/dist/components/animate-slide/MPAnimateSlide.js +1 -0
- package/dist/components/animate-slide/index.d.ts +2 -0
- package/dist/components/animate-slide/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.d.ts +59 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -0
- package/dist/components/animate-typing/index.d.ts +2 -0
- package/dist/components/animate-typing/index.js +1 -0
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +44 -0
- package/dist/components/animate-zoom/MPAnimateZoom.js +1 -0
- package/dist/components/animate-zoom/index.d.ts +2 -0
- package/dist/components/animate-zoom/index.js +1 -0
- package/dist/components/avatar/MPAvatar.d.ts +9 -2
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +144 -0
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -0
- package/dist/components/bottom-navigation/index.d.ts +2 -0
- package/dist/components/bottom-navigation/index.js +1 -0
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +22 -0
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.d.ts +7 -2
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.d.ts +2 -2
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +13 -3
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/color-picker/MPColorPicker.d.ts +21 -3
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +38 -10
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/container/MPContainer.d.ts +75 -0
- package/dist/components/container/MPContainer.js +1 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.d.ts +3 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +8 -3
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +8 -3
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +12 -2
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/file-picker/MPFilePicker.d.ts +11 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.d.ts +126 -0
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +155 -0
- package/dist/components/grid/MPGrid.js +1 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/highlight/MPHighlight.js +1 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +10 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.d.ts +21 -3
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pagination/MPPagination.d.ts +106 -0
- package/dist/components/pagination/MPPagination.js +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/panes/MPPanes.js +1 -1
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popover/MPPopover.d.ts +8 -3
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/rating/MPRating.d.ts +135 -0
- package/dist/components/rating/MPRating.js +1 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/rating/index.js +1 -0
- package/dist/components/select/MPSelect.d.ts +23 -6
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/skeleton/MPSkeleton.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +8 -3
- package/dist/components/snackbar/MPSnackbar.js +1 -1
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/switch/MPSwitch.d.ts +2 -2
- package/dist/components/switch/MPSwitch.js +1 -1
- package/dist/components/table/MPTable.d.ts +14 -1
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +145 -0
- package/dist/components/tabs/MPTabs.js +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/text-field/MPTextField.d.ts +37 -7
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/text-link/MPTextLink.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/constants/icons.d.ts +13 -0
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/FieldOutline.d.ts +75 -4
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.d.ts +52 -9
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/animate.d.ts +179 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/date.d.ts +2 -2
- package/dist/internal/date.js +1 -1
- package/dist/internal/i18n.d.ts +110 -0
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/inert.d.ts +11 -0
- package/dist/internal/inert.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +590 -4
- package/dist/types.d.ts +155 -0
- package/package.json +1 -1
package/dist/tailwind.css
CHANGED
|
@@ -955,14 +955,48 @@
|
|
|
955
955
|
--mp-sys-elevation-level2: 0 1px 2px 0 rgb(0 0 0 / 0.3), 0 2px 6px 2px rgb(0 0 0 / 0.15);
|
|
956
956
|
--mp-sys-elevation-level3: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 4px 8px 3px rgb(0 0 0 / 0.15);
|
|
957
957
|
|
|
958
|
-
/*
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
958
|
+
/*
|
|
959
|
+
* Motion.
|
|
960
|
+
*
|
|
961
|
+
* Six of MD3's sixteen duration tokens and six of its seven easing curves —
|
|
962
|
+
* the ones something in the library actually reads, on the rule every other
|
|
963
|
+
* token here follows. `short4` is what a text field's label and outline
|
|
964
|
+
* transition on; the rest arrived with the `MPAnimate*` components, which
|
|
965
|
+
* take these as their defaults rather than numbers of their own.
|
|
966
|
+
*
|
|
967
|
+
* Worth knowing if these controls sit beside another library's: 250ms is a
|
|
968
|
+
* common default elsewhere, and a field from here will settle slightly
|
|
969
|
+
* sooner unless `short4` is set to match.
|
|
970
|
+
*/
|
|
962
971
|
--mp-sys-motion-duration-short4: 200ms;
|
|
972
|
+
--mp-sys-motion-duration-medium2: 300ms;
|
|
973
|
+
--mp-sys-motion-duration-medium4: 400ms;
|
|
974
|
+
--mp-sys-motion-duration-long2: 500ms;
|
|
975
|
+
--mp-sys-motion-duration-extra-long4: 1000ms;
|
|
976
|
+
|
|
963
977
|
/* The spec's `standard` curve: quick to leave, slow to arrive. Read by the
|
|
964
978
|
one thing in the library that actually travels, a switch's thumb. */
|
|
965
979
|
--mp-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
|
|
980
|
+
--mp-sys-motion-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1);
|
|
981
|
+
--mp-sys-motion-easing-standard-accelerate: cubic-bezier(0.3, 0, 1, 1);
|
|
982
|
+
/*
|
|
983
|
+
* The emphasized set, which is what MD3 asks a *transition* to use — a
|
|
984
|
+
* standard curve is for a control changing state, an emphasized one for
|
|
985
|
+
* something arriving on or leaving the screen.
|
|
986
|
+
*
|
|
987
|
+
* `emphasized` itself is two curves joined in the middle in the
|
|
988
|
+
* specification, and CSS has no single value that is both. This is the
|
|
989
|
+
* one-curve stand-in MD3's own web implementation publishes. Where the
|
|
990
|
+
* halves genuinely matter — a line rising as another leaves — the two below
|
|
991
|
+
* are the halves, and they are what the components reach for.
|
|
992
|
+
*/
|
|
993
|
+
--mp-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
|
|
994
|
+
--mp-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
995
|
+
--mp-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
996
|
+
/* CSS's own `linear` is a keyword rather than a curve, and a token that
|
|
997
|
+
cannot be interpolated with the other six is a token that breaks the one
|
|
998
|
+
place they are swapped. The identity bezier is the same line. */
|
|
999
|
+
--mp-sys-motion-easing-linear: cubic-bezier(0, 0, 1, 1);
|
|
966
1000
|
}
|
|
967
1001
|
|
|
968
1002
|
/*
|
|
@@ -1139,6 +1173,165 @@
|
|
|
1139
1173
|
--ease-mp-standard: var(--mp-sys-motion-easing-standard);
|
|
1140
1174
|
}
|
|
1141
1175
|
|
|
1176
|
+
/* ---------------------------------------------------------------------------
|
|
1177
|
+
* The layout grid
|
|
1178
|
+
*
|
|
1179
|
+
* A column is `(100% + gutter) * span / columns - gutter`, and the arithmetic
|
|
1180
|
+
* lives here for the reason the keyframes below do: Tailwind finds classes by
|
|
1181
|
+
* scanning source text, and `columns` is a number the caller picks at runtime.
|
|
1182
|
+
* A class name assembled in JavaScript is a class name Tailwind never sees, so
|
|
1183
|
+
* the per-instance numbers arrive as inline `--_mp-*` slots — exactly as a
|
|
1184
|
+
* `color` reaches a background — and the rules that read them are written once,
|
|
1185
|
+
* here.
|
|
1186
|
+
*
|
|
1187
|
+
* `min(span, columns)` is the clamp: `span={99}` fills its row instead of
|
|
1188
|
+
* running off the page, which is what the caller meant.
|
|
1189
|
+
*
|
|
1190
|
+
* Every slot cascades upward — each window size class falls back through the
|
|
1191
|
+
* ones below it — so `span={{ expanded: 6 }}` sets one custom property and not
|
|
1192
|
+
* five. The chains get long at `extra-large`; that is the cost of keeping the
|
|
1193
|
+
* DOM lean, and it is paid once here rather than on every grid item in a
|
|
1194
|
+
* consumer's application.
|
|
1195
|
+
*
|
|
1196
|
+
* The widths are **MD3's window size classes** — 600, 840, 1200 and 1600dp —
|
|
1197
|
+
* and not Tailwind's breakpoints. See `MPWindowClass` in `src/types.ts`.
|
|
1198
|
+
*
|
|
1199
|
+
* Unlayered, like the two animation classes below and for the same reason: a
|
|
1200
|
+
* layered rule loses to every unlayered one, and a consumer's own page styling
|
|
1201
|
+
* is unlayered. A grid whose widths could be cancelled by a stray `div { }` in
|
|
1202
|
+
* an application's stylesheet is not a grid.
|
|
1203
|
+
* ------------------------------------------------------------------------- */
|
|
1204
|
+
|
|
1205
|
+
.mp-grid {
|
|
1206
|
+
--_mp-cols: var(--_mp-cols-compact, 12);
|
|
1207
|
+
--_mp-gap-x: var(--_mp-gap-x-compact, 0px);
|
|
1208
|
+
--_mp-gap-y: var(--_mp-gap-y-compact, 0px);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.mp-grid-item {
|
|
1212
|
+
--_mp-span: var(--_mp-span-compact, var(--_mp-cols, 12));
|
|
1213
|
+
--_mp-offset: var(--_mp-offset-compact, 0);
|
|
1214
|
+
|
|
1215
|
+
/* One column plus one gutter. `--_mp-cols` and `--_mp-gap-x` are inherited
|
|
1216
|
+
from the grid, so this re-resolves on its own at every window class. */
|
|
1217
|
+
--_mp-track: calc((100% + var(--_mp-gap-x, 0px)) / var(--_mp-cols, 12));
|
|
1218
|
+
|
|
1219
|
+
/* Inseparable from the width under them: `flex` stops the row resizing the
|
|
1220
|
+
item, `min-width` stops a long unbroken word doing the same, and
|
|
1221
|
+
`box-sizing` is what makes the percentage mean the whole item. */
|
|
1222
|
+
box-sizing: border-box;
|
|
1223
|
+
flex: 0 0 auto;
|
|
1224
|
+
min-width: 0;
|
|
1225
|
+
width: calc(var(--_mp-track) * min(var(--_mp-span), var(--_mp-cols, 12)) - var(--_mp-gap-x, 0px));
|
|
1226
|
+
margin-inline-start: calc(var(--_mp-track) * min(var(--_mp-offset), var(--_mp-cols, 12)));
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
@media (width >= 600px) {
|
|
1230
|
+
.mp-grid {
|
|
1231
|
+
--_mp-cols: var(--_mp-cols-medium, var(--_mp-cols-compact, 12));
|
|
1232
|
+
--_mp-gap-x: var(--_mp-gap-x-medium, var(--_mp-gap-x-compact, 0px));
|
|
1233
|
+
--_mp-gap-y: var(--_mp-gap-y-medium, var(--_mp-gap-y-compact, 0px));
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
.mp-grid-item {
|
|
1237
|
+
--_mp-span: var(--_mp-span-medium, var(--_mp-span-compact, var(--_mp-cols, 12)));
|
|
1238
|
+
--_mp-offset: var(--_mp-offset-medium, var(--_mp-offset-compact, 0));
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
@media (width >= 840px) {
|
|
1243
|
+
.mp-grid {
|
|
1244
|
+
--_mp-cols: var(--_mp-cols-expanded, var(--_mp-cols-medium, var(--_mp-cols-compact, 12)));
|
|
1245
|
+
--_mp-gap-x: var(--_mp-gap-x-expanded, var(--_mp-gap-x-medium, var(--_mp-gap-x-compact, 0px)));
|
|
1246
|
+
--_mp-gap-y: var(--_mp-gap-y-expanded, var(--_mp-gap-y-medium, var(--_mp-gap-y-compact, 0px)));
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.mp-grid-item {
|
|
1250
|
+
--_mp-span: var(
|
|
1251
|
+
--_mp-span-expanded,
|
|
1252
|
+
var(--_mp-span-medium, var(--_mp-span-compact, var(--_mp-cols, 12)))
|
|
1253
|
+
);
|
|
1254
|
+
--_mp-offset: var(
|
|
1255
|
+
--_mp-offset-expanded,
|
|
1256
|
+
var(--_mp-offset-medium, var(--_mp-offset-compact, 0))
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
@media (width >= 1200px) {
|
|
1262
|
+
.mp-grid {
|
|
1263
|
+
--_mp-cols: var(
|
|
1264
|
+
--_mp-cols-large,
|
|
1265
|
+
var(--_mp-cols-expanded, var(--_mp-cols-medium, var(--_mp-cols-compact, 12)))
|
|
1266
|
+
);
|
|
1267
|
+
--_mp-gap-x: var(
|
|
1268
|
+
--_mp-gap-x-large,
|
|
1269
|
+
var(--_mp-gap-x-expanded, var(--_mp-gap-x-medium, var(--_mp-gap-x-compact, 0px)))
|
|
1270
|
+
);
|
|
1271
|
+
--_mp-gap-y: var(
|
|
1272
|
+
--_mp-gap-y-large,
|
|
1273
|
+
var(--_mp-gap-y-expanded, var(--_mp-gap-y-medium, var(--_mp-gap-y-compact, 0px)))
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.mp-grid-item {
|
|
1278
|
+
--_mp-span: var(
|
|
1279
|
+
--_mp-span-large,
|
|
1280
|
+
var(--_mp-span-expanded, var(--_mp-span-medium, var(--_mp-span-compact, var(--_mp-cols, 12))))
|
|
1281
|
+
);
|
|
1282
|
+
--_mp-offset: var(
|
|
1283
|
+
--_mp-offset-large,
|
|
1284
|
+
var(--_mp-offset-expanded, var(--_mp-offset-medium, var(--_mp-offset-compact, 0)))
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
@media (width >= 1600px) {
|
|
1290
|
+
.mp-grid {
|
|
1291
|
+
--_mp-cols: var(
|
|
1292
|
+
--_mp-cols-extra-large,
|
|
1293
|
+
var(
|
|
1294
|
+
--_mp-cols-large,
|
|
1295
|
+
var(--_mp-cols-expanded, var(--_mp-cols-medium, var(--_mp-cols-compact, 12)))
|
|
1296
|
+
)
|
|
1297
|
+
);
|
|
1298
|
+
--_mp-gap-x: var(
|
|
1299
|
+
--_mp-gap-x-extra-large,
|
|
1300
|
+
var(
|
|
1301
|
+
--_mp-gap-x-large,
|
|
1302
|
+
var(--_mp-gap-x-expanded, var(--_mp-gap-x-medium, var(--_mp-gap-x-compact, 0px)))
|
|
1303
|
+
)
|
|
1304
|
+
);
|
|
1305
|
+
--_mp-gap-y: var(
|
|
1306
|
+
--_mp-gap-y-extra-large,
|
|
1307
|
+
var(
|
|
1308
|
+
--_mp-gap-y-large,
|
|
1309
|
+
var(--_mp-gap-y-expanded, var(--_mp-gap-y-medium, var(--_mp-gap-y-compact, 0px)))
|
|
1310
|
+
)
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
.mp-grid-item {
|
|
1315
|
+
--_mp-span: var(
|
|
1316
|
+
--_mp-span-extra-large,
|
|
1317
|
+
var(
|
|
1318
|
+
--_mp-span-large,
|
|
1319
|
+
var(
|
|
1320
|
+
--_mp-span-expanded,
|
|
1321
|
+
var(--_mp-span-medium, var(--_mp-span-compact, var(--_mp-cols, 12)))
|
|
1322
|
+
)
|
|
1323
|
+
)
|
|
1324
|
+
);
|
|
1325
|
+
--_mp-offset: var(
|
|
1326
|
+
--_mp-offset-extra-large,
|
|
1327
|
+
var(
|
|
1328
|
+
--_mp-offset-large,
|
|
1329
|
+
var(--_mp-offset-expanded, var(--_mp-offset-medium, var(--_mp-offset-compact, 0)))
|
|
1330
|
+
)
|
|
1331
|
+
);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1142
1335
|
/* ---------------------------------------------------------------------------
|
|
1143
1336
|
* Keyframes
|
|
1144
1337
|
*
|
|
@@ -1326,3 +1519,396 @@
|
|
|
1326
1519
|
opacity: 0.6;
|
|
1327
1520
|
}
|
|
1328
1521
|
}
|
|
1522
|
+
|
|
1523
|
+
/* ---------------------------------------------------------------------------
|
|
1524
|
+
* Animation
|
|
1525
|
+
*
|
|
1526
|
+
* The `MPAnimate*` components. Real CSS for the reason the loading indicators
|
|
1527
|
+
* above are: a keyframe is not a Tailwind variant, so there is nothing to
|
|
1528
|
+
* express one with.
|
|
1529
|
+
*
|
|
1530
|
+
* The whole set is built on one idea. An effect is a single `@keyframes` that
|
|
1531
|
+
* runs from a state written entirely in `--_mp-anim-*` custom properties to the
|
|
1532
|
+
* element's natural one — so `src/internal/animate.ts` never generates CSS, it
|
|
1533
|
+
* only fills slots, and running an effect backwards is `animation-direction:
|
|
1534
|
+
* reverse` rather than a second keyframe. That is what makes `mode="out"` cost
|
|
1535
|
+
* nothing, and it is also what makes it *correct*: CSS mirrors the timing
|
|
1536
|
+
* function along with the keyframes, so an entrance eased on
|
|
1537
|
+
* `emphasized-decelerate` comes back accelerating. MD3 asks for exactly that
|
|
1538
|
+
* pair; the browser supplies the second half of it.
|
|
1539
|
+
*
|
|
1540
|
+
* `fill-mode` is `both` throughout, which is what lets an animation that has
|
|
1541
|
+
* not been triggered yet sit paused on its own first frame. Without it, an
|
|
1542
|
+
* element waiting to be scrolled into view would be fully drawn and then blink
|
|
1543
|
+
* out the moment it arrived.
|
|
1544
|
+
*
|
|
1545
|
+
* This is also where the library's rule against transforms is at its narrowest.
|
|
1546
|
+
* A *control* never moves — that rule is about a button resampling its own
|
|
1547
|
+
* label under the pointer, and it holds without exception. An `MPAnimate*`
|
|
1548
|
+
* moves content the caller asked to have moved, and it moves it with the
|
|
1549
|
+
* independent `translate`, `scale` and `rotate` properties rather than the
|
|
1550
|
+
* `transform` shorthand, so a caller's own transform on the same element
|
|
1551
|
+
* survives.
|
|
1552
|
+
*
|
|
1553
|
+
* Unlayered, like the keyframes above: `@keyframes` takes no part in the
|
|
1554
|
+
* cascade, but the classes do, and a layered class would lose to any unlayered
|
|
1555
|
+
* rule a consumer's own stylesheet happens to have.
|
|
1556
|
+
* ------------------------------------------------------------------------- */
|
|
1557
|
+
|
|
1558
|
+
.mp-anim {
|
|
1559
|
+
animation-duration: var(--_mp-anim-duration, var(--mp-sys-motion-duration-medium4));
|
|
1560
|
+
animation-delay: var(--_mp-anim-delay, 0ms);
|
|
1561
|
+
animation-timing-function: var(
|
|
1562
|
+
--_mp-anim-ease,
|
|
1563
|
+
var(--mp-sys-motion-easing-emphasized-decelerate)
|
|
1564
|
+
);
|
|
1565
|
+
animation-iteration-count: var(--_mp-anim-repeat, 1);
|
|
1566
|
+
animation-direction: var(--_mp-anim-direction, normal);
|
|
1567
|
+
animation-fill-mode: both;
|
|
1568
|
+
animation-play-state: var(--_mp-anim-state, running);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
@keyframes mp-anim-fade {
|
|
1572
|
+
from {
|
|
1573
|
+
opacity: var(--_mp-anim-opacity, 0);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
to {
|
|
1577
|
+
opacity: 1;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
.mp-anim-fade {
|
|
1582
|
+
animation-name: mp-anim-fade;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/* Grow and Zoom share this one: they are the same arithmetic at two strengths,
|
|
1586
|
+
separated by their defaults and by their origin rather than by their maths. */
|
|
1587
|
+
@keyframes mp-anim-scale {
|
|
1588
|
+
from {
|
|
1589
|
+
opacity: var(--_mp-anim-opacity, 0);
|
|
1590
|
+
scale: var(--_mp-anim-scale, 0.8);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
to {
|
|
1594
|
+
opacity: 1;
|
|
1595
|
+
scale: 1;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
.mp-anim-scale {
|
|
1600
|
+
animation-name: mp-anim-scale;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
@keyframes mp-anim-slide {
|
|
1604
|
+
from {
|
|
1605
|
+
opacity: var(--_mp-anim-opacity, 0);
|
|
1606
|
+
translate: var(--_mp-anim-x, 0px) var(--_mp-anim-y, 0px);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
to {
|
|
1610
|
+
opacity: 1;
|
|
1611
|
+
translate: 0 0;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.mp-anim-slide {
|
|
1616
|
+
animation-name: mp-anim-slide;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
/* Two angles rather than one, so the same keyframe covers both the quarter turn
|
|
1620
|
+
something arrives on and the endless one a decorative mark spins through. */
|
|
1621
|
+
@keyframes mp-anim-rotate {
|
|
1622
|
+
from {
|
|
1623
|
+
opacity: var(--_mp-anim-opacity, 0);
|
|
1624
|
+
rotate: var(--_mp-anim-angle, -180deg);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
to {
|
|
1628
|
+
opacity: 1;
|
|
1629
|
+
rotate: var(--_mp-anim-angle-to, 0deg);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
.mp-anim-rotate {
|
|
1634
|
+
animation-name: mp-anim-rotate;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/* Symmetric on purpose: a blink that ended anywhere but where it started would
|
|
1638
|
+
leave the element half drawn whenever the count ran out. */
|
|
1639
|
+
@keyframes mp-anim-blink {
|
|
1640
|
+
0%,
|
|
1641
|
+
100% {
|
|
1642
|
+
opacity: 1;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
50% {
|
|
1646
|
+
opacity: var(--_mp-anim-opacity, 0);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
.mp-anim-blink {
|
|
1651
|
+
animation-name: mp-anim-blink;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1655
|
+
/*
|
|
1656
|
+
* The Animate components go the other way from the indicators above, and the
|
|
1657
|
+
* difference is what each of them is saying. A spinner that stops is lying
|
|
1658
|
+
* about whether anything is happening; an entrance that does not play has
|
|
1659
|
+
* still delivered its content, which is the only thing it was ever carrying.
|
|
1660
|
+
*
|
|
1661
|
+
* `animation: none` rather than a zero duration, because the shorthand also
|
|
1662
|
+
* clears `fill-mode` — and it is the fill that was holding an untriggered
|
|
1663
|
+
* element on its own first frame at `opacity: 0`. Left in place, respecting a
|
|
1664
|
+
* reader's preference would blank the page.
|
|
1665
|
+
*/
|
|
1666
|
+
.mp-anim {
|
|
1667
|
+
animation: none;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
/*
|
|
1672
|
+
* Lighting: a light travelling around the outside of something.
|
|
1673
|
+
*
|
|
1674
|
+
* The arc is a conic gradient and what moves is its `from` angle, which is only
|
|
1675
|
+
* animatable because the angle is a registered custom property with a type. The
|
|
1676
|
+
* alternative — rotating the pseudo-element itself — swings its corners out
|
|
1677
|
+
* past the element on every quarter turn.
|
|
1678
|
+
*
|
|
1679
|
+
* `z-index: -1` inside an isolated stacking context puts the glow behind the
|
|
1680
|
+
* content but still inside the component, so it reads as light escaping from
|
|
1681
|
+
* under a sheet rather than as a border drawn around one. Nothing inside is
|
|
1682
|
+
* overlaid and nothing is tinted, which is what lets it go around a card or a
|
|
1683
|
+
* button without touching how either is drawn.
|
|
1684
|
+
*/
|
|
1685
|
+
@property --mp-glow-angle {
|
|
1686
|
+
syntax: '<angle>';
|
|
1687
|
+
initial-value: 0deg;
|
|
1688
|
+
inherits: false;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
@keyframes mp-anim-lighting {
|
|
1692
|
+
to {
|
|
1693
|
+
--mp-glow-angle: 360deg;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
.mp-anim-lighting {
|
|
1698
|
+
position: relative;
|
|
1699
|
+
isolation: isolate;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
.mp-anim-lighting::before {
|
|
1703
|
+
content: '';
|
|
1704
|
+
position: absolute;
|
|
1705
|
+
z-index: -1;
|
|
1706
|
+
inset: calc(-1 * var(--_mp-anim-glow-width, 3px));
|
|
1707
|
+
border-radius: inherit;
|
|
1708
|
+
background: conic-gradient(
|
|
1709
|
+
from var(--mp-glow-angle),
|
|
1710
|
+
transparent 0deg,
|
|
1711
|
+
var(--_mp-anim-glow, var(--_mp-accent)) var(--_mp-anim-glow-arc, 50deg),
|
|
1712
|
+
transparent calc(var(--_mp-anim-glow-arc, 50deg) * 2),
|
|
1713
|
+
transparent 360deg
|
|
1714
|
+
);
|
|
1715
|
+
filter: blur(var(--_mp-anim-glow-blur, 4px));
|
|
1716
|
+
animation-name: mp-anim-lighting;
|
|
1717
|
+
animation-duration: var(--_mp-anim-duration, 3s);
|
|
1718
|
+
animation-delay: var(--_mp-anim-delay, 0ms);
|
|
1719
|
+
/* Linear, and not a token: a loop with no beginning has nothing to
|
|
1720
|
+
decelerate into, and an eased revolution reads as the light hesitating at
|
|
1721
|
+
an arbitrary point on a circle that has no arbitrary points. */
|
|
1722
|
+
animation-timing-function: linear;
|
|
1723
|
+
animation-iteration-count: var(--_mp-anim-repeat, infinite);
|
|
1724
|
+
animation-direction: var(--_mp-anim-direction, normal);
|
|
1725
|
+
animation-fill-mode: both;
|
|
1726
|
+
animation-play-state: var(--_mp-anim-state, running);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1730
|
+
/* The arc stops travelling and becomes an even glow. The same trade the
|
|
1731
|
+
skeleton makes: the decoration survives, the motion does not — a light
|
|
1732
|
+
that marked the live row still marks it while holding still. */
|
|
1733
|
+
.mp-anim-lighting::before {
|
|
1734
|
+
background: var(--_mp-anim-glow, var(--_mp-accent));
|
|
1735
|
+
animation: none;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/*
|
|
1740
|
+
* Marquee: two identical copies, both moving by exactly one copy plus the gap.
|
|
1741
|
+
*
|
|
1742
|
+
* Which is the whole trick — when the first copy has travelled its own width,
|
|
1743
|
+
* the second is standing precisely where the first began, so there is no seam
|
|
1744
|
+
* and no frame where the strip is empty. A percentage `translate` resolves
|
|
1745
|
+
* against the element's own box, so neither copy has to be measured for this to
|
|
1746
|
+
* hold; measuring only ever decides how *fast* it goes.
|
|
1747
|
+
*/
|
|
1748
|
+
@keyframes mp-anim-marquee-x {
|
|
1749
|
+
from {
|
|
1750
|
+
translate: 0 0;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
to {
|
|
1754
|
+
translate: calc(-100% - var(--_mp-anim-gap, 0px)) 0;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
@keyframes mp-anim-marquee-y {
|
|
1759
|
+
from {
|
|
1760
|
+
translate: 0 0;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
to {
|
|
1764
|
+
translate: 0 calc(-100% - var(--_mp-anim-gap, 0px));
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
.mp-marquee {
|
|
1769
|
+
display: flex;
|
|
1770
|
+
overflow: hidden;
|
|
1771
|
+
gap: var(--_mp-anim-gap, 0px);
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
.mp-marquee-vertical {
|
|
1775
|
+
flex-direction: column;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
.mp-marquee-track {
|
|
1779
|
+
display: flex;
|
|
1780
|
+
flex: 0 0 auto;
|
|
1781
|
+
align-items: center;
|
|
1782
|
+
gap: var(--_mp-anim-gap, 0px);
|
|
1783
|
+
animation-name: mp-anim-marquee-x;
|
|
1784
|
+
animation-duration: var(--_mp-anim-duration, 12s);
|
|
1785
|
+
animation-delay: var(--_mp-anim-delay, 0ms);
|
|
1786
|
+
/* Linear unless a caller insists otherwise. An eased marquee slows at both
|
|
1787
|
+
ends of a loop that has no ends, which reads as the page stuttering. */
|
|
1788
|
+
animation-timing-function: var(--_mp-anim-ease, linear);
|
|
1789
|
+
animation-iteration-count: var(--_mp-anim-repeat, infinite);
|
|
1790
|
+
animation-direction: var(--_mp-anim-direction, normal);
|
|
1791
|
+
animation-fill-mode: both;
|
|
1792
|
+
animation-play-state: var(--_mp-anim-state, running);
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
.mp-marquee-vertical .mp-marquee-track {
|
|
1796
|
+
flex-direction: column;
|
|
1797
|
+
animation-name: mp-anim-marquee-y;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
.mp-marquee[data-mp-pause-on-hover]:hover .mp-marquee-track {
|
|
1801
|
+
animation-play-state: paused;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1805
|
+
/* Stopped, not slowed. A strip of logos that has stopped scrolling is a strip
|
|
1806
|
+
of logos, and the first copy is fully in frame — which is more than the
|
|
1807
|
+
moving version guarantees at any given moment. */
|
|
1808
|
+
.mp-marquee-track {
|
|
1809
|
+
animation: none;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/*
|
|
1814
|
+
* Headline: one line replacing another from below.
|
|
1815
|
+
*
|
|
1816
|
+
* Every item is in the same grid cell, so the box is as tall as the tallest of
|
|
1817
|
+
* them from the first frame and never resizes as the reel turns. The ones not
|
|
1818
|
+
* on screen keep their space with `visibility` rather than `display`, which is
|
|
1819
|
+
* what makes that true.
|
|
1820
|
+
*
|
|
1821
|
+
* The two halves take the two halves of MD3's emphasized curve — the line
|
|
1822
|
+
* arriving decelerates into place, the line leaving accelerates away — which is
|
|
1823
|
+
* the one place in the library where both are written out rather than one being
|
|
1824
|
+
* a reversed run of the other. Here they genuinely are two animations on two
|
|
1825
|
+
* elements at the same moment.
|
|
1826
|
+
*/
|
|
1827
|
+
@keyframes mp-anim-headline-in {
|
|
1828
|
+
from {
|
|
1829
|
+
translate: 0 var(--_mp-anim-rise, 100%);
|
|
1830
|
+
opacity: 0;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
to {
|
|
1834
|
+
translate: 0 0;
|
|
1835
|
+
opacity: 1;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
@keyframes mp-anim-headline-out {
|
|
1840
|
+
from {
|
|
1841
|
+
translate: 0 0;
|
|
1842
|
+
opacity: 1;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
to {
|
|
1846
|
+
translate: 0 calc(-1 * var(--_mp-anim-rise, 100%));
|
|
1847
|
+
opacity: 0;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
.mp-headline {
|
|
1852
|
+
display: grid;
|
|
1853
|
+
overflow: hidden;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
.mp-headline-item {
|
|
1857
|
+
grid-area: 1 / 1;
|
|
1858
|
+
visibility: hidden;
|
|
1859
|
+
animation-duration: var(--_mp-anim-duration, var(--mp-sys-motion-duration-long2));
|
|
1860
|
+
animation-fill-mode: both;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
.mp-headline-item[data-mp-state='active'] {
|
|
1864
|
+
visibility: visible;
|
|
1865
|
+
animation-name: mp-anim-headline-in;
|
|
1866
|
+
animation-timing-function: var(
|
|
1867
|
+
--_mp-anim-ease,
|
|
1868
|
+
var(--mp-sys-motion-easing-emphasized-decelerate)
|
|
1869
|
+
);
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
.mp-headline-item[data-mp-state='leaving'] {
|
|
1873
|
+
visibility: visible;
|
|
1874
|
+
animation-name: mp-anim-headline-out;
|
|
1875
|
+
animation-timing-function: var(
|
|
1876
|
+
--_mp-anim-ease,
|
|
1877
|
+
var(--mp-sys-motion-easing-emphasized-accelerate)
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1882
|
+
/* The reel still turns — it is a set of phrases and stopping on the first
|
|
1883
|
+
would be a different message — but the lines swap rather than travel. */
|
|
1884
|
+
.mp-headline-item {
|
|
1885
|
+
animation: none;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/* The block after a typewriter. `step-end` rather than a fade, because a caret
|
|
1890
|
+
that eases is a caret that looks like it is being rendered slowly. */
|
|
1891
|
+
@keyframes mp-anim-caret {
|
|
1892
|
+
0%,
|
|
1893
|
+
45% {
|
|
1894
|
+
opacity: 1;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
55%,
|
|
1898
|
+
100% {
|
|
1899
|
+
opacity: 0;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
.mp-typing-caret {
|
|
1904
|
+
display: inline-block;
|
|
1905
|
+
animation: mp-anim-caret 1s step-end infinite;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1909
|
+
/* The whole string is already there under this preference — the caret would
|
|
1910
|
+
be a cursor blinking after text nobody is typing. */
|
|
1911
|
+
.mp-typing-caret {
|
|
1912
|
+
animation: none;
|
|
1913
|
+
}
|
|
1914
|
+
}
|