mtrl 0.10.0 → 0.10.2

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.
Files changed (92) hide show
  1. package/dist/components/bottom-sheet/config.js +1 -1
  2. package/dist/components/chips/api.js +4 -0
  3. package/dist/components/chips/features/controller.js +6 -1
  4. package/dist/components/chips/types.d.ts +10 -0
  5. package/dist/components/dialog/config.js +1 -1
  6. package/dist/components/fab-menu/fab-menu.js +12 -4
  7. package/dist/components/fab-menu/types.d.ts +5 -1
  8. package/dist/components/loading-indicator/constants.js +2 -2
  9. package/dist/components/loading-indicator/features/renderer.js +13 -2
  10. package/dist/components/side-sheet/config.js +1 -1
  11. package/dist/components/tabs/utils.js +3 -2
  12. package/dist/components/timepicker/config.js +1 -1
  13. package/dist/core/shapes/cubic.d.ts +2 -0
  14. package/dist/core/shapes/cubic.js +14 -0
  15. package/dist/core/shapes/index.d.ts +3 -3
  16. package/dist/core/shapes/index.js +3 -3
  17. package/dist/core/shapes/material.d.ts +136 -6
  18. package/dist/core/shapes/material.js +226 -25
  19. package/dist/core/shapes/polygon.d.ts +2 -0
  20. package/dist/core/shapes/polygon.js +27 -10
  21. package/dist/elements/css/fab-menu.js +1 -1
  22. package/dist/elements/fab-menu.js +1 -1
  23. package/dist/elements/preupgrade.css +1 -1
  24. package/dist/index.cjs +0 -0
  25. package/dist/package.json +1 -1
  26. package/dist/styles/badge.css +1 -1
  27. package/dist/styles/base.css +1 -1
  28. package/dist/styles/bottom-app-bar.css +1 -1
  29. package/dist/styles/bottom-sheet.css +1 -1
  30. package/dist/styles/button-group.css +1 -1
  31. package/dist/styles/button.css +1 -1
  32. package/dist/styles/card.css +1 -1
  33. package/dist/styles/carousel.css +1 -1
  34. package/dist/styles/checkbox.css +1 -1
  35. package/dist/styles/chips.css +1 -1
  36. package/dist/styles/datepicker.css +1 -1
  37. package/dist/styles/dialog.css +1 -1
  38. package/dist/styles/divider.css +1 -1
  39. package/dist/styles/drawer.css +1 -1
  40. package/dist/styles/extended-fab.css +1 -1
  41. package/dist/styles/fab-menu.css +2 -2
  42. package/dist/styles/fab.css +1 -1
  43. package/dist/styles/icon-button.css +1 -1
  44. package/dist/styles/list.css +1 -1
  45. package/dist/styles/loading-indicator.css +1 -1
  46. package/dist/styles/menu.css +1 -1
  47. package/dist/styles/navigation-rail.css +1 -1
  48. package/dist/styles/progress.css +1 -1
  49. package/dist/styles/radios.css +1 -1
  50. package/dist/styles/search.css +1 -1
  51. package/dist/styles/segmented-button.css +1 -1
  52. package/dist/styles/select.css +1 -1
  53. package/dist/styles/side-sheet.css +1 -1
  54. package/dist/styles/slider.css +1 -1
  55. package/dist/styles/snackbar.css +1 -1
  56. package/dist/styles/split-button.css +1 -1
  57. package/dist/styles/switch.css +1 -1
  58. package/dist/styles/tabs.css +1 -1
  59. package/dist/styles/textfield.css +1 -1
  60. package/dist/styles/timepicker.css +1 -1
  61. package/dist/styles/toolbar.css +1 -1
  62. package/dist/styles/tooltip.css +1 -1
  63. package/dist/styles/top-app-bar.css +1 -1
  64. package/dist/styles/utilities.css +1 -1
  65. package/dist/styles.css +2 -2
  66. package/dist/themes/autumn.css +1 -1
  67. package/dist/themes/baseline.css +1 -1
  68. package/dist/themes/brownbeige.css +1 -1
  69. package/dist/themes/browngreen.css +1 -1
  70. package/dist/themes/content.css +1 -1
  71. package/dist/themes/desert.css +1 -1
  72. package/dist/themes/expressive.css +1 -1
  73. package/dist/themes/fidelity.css +1 -1
  74. package/dist/themes/forest.css +1 -1
  75. package/dist/themes/fruit-salad.css +1 -1
  76. package/dist/themes/highcontrast.css +1 -1
  77. package/dist/themes/legacy.css +1 -1
  78. package/dist/themes/material.css +1 -1
  79. package/dist/themes/monochrome.css +1 -1
  80. package/dist/themes/neutral.css +1 -1
  81. package/dist/themes/ocean.css +1 -1
  82. package/dist/themes/rainbow.css +1 -1
  83. package/dist/themes/sageivory.css +1 -1
  84. package/dist/themes/spring.css +1 -1
  85. package/dist/themes/summer.css +1 -1
  86. package/dist/themes/sunset.css +1 -1
  87. package/dist/themes/tealcaramel.css +1 -1
  88. package/dist/themes/vibrant.css +1 -1
  89. package/dist/themes/winter.css +1 -1
  90. package/package.json +1 -129
  91. package/src/styles/abstract/_variables.scss +22 -1
  92. package/src/styles/components/_fab-menu.scss +34 -20
@@ -17,7 +17,7 @@ export const createBaseConfig = (config = {}) => {
17
17
  }
18
18
  return merged;
19
19
  };
20
- export const getElementConfig = (config) => createElementConfig(config, {
20
+ export const getElementConfig = (config) => createElementConfig({ ...config, title: undefined }, {
21
21
  tag: config.layer === "top" ? "dialog" : "div",
22
22
  className: [config.class].filter(Boolean),
23
23
  attributes: {
@@ -133,6 +133,10 @@ export const withAPI = (options) => (component) => {
133
133
  }
134
134
  return this;
135
135
  },
136
+ keyboard: {
137
+ enable: () => options.keyboard?.enableKeyboardNavigation?.(),
138
+ disable: () => options.keyboard?.disableKeyboardNavigation?.(),
139
+ },
136
140
  on(event, handler) {
137
141
  if (options.events && typeof options.events.on === "function") {
138
142
  options.events.on(event, handler);
@@ -9,6 +9,7 @@ export const withController = (config) => (component) => {
9
9
  remove: [],
10
10
  };
11
11
  let focusedChipIndex = -1;
12
+ let keyboardEnabled = true;
12
13
  const dispatchEvent = (eventName, ...args) => {
13
14
  if (eventListeners[eventName]) {
14
15
  eventListeners[eventName].forEach((handler) => handler(...args));
@@ -58,11 +59,13 @@ export const withController = (config) => (component) => {
58
59
  current.tabIndex = 0;
59
60
  };
60
61
  const handleKeyboardNavigation = (event) => {
62
+ if (!keyboardEnabled)
63
+ return;
61
64
  const list = targets();
62
65
  if (list.length === 0)
63
66
  return;
64
67
  const isVertical = !!(component.layout && component.layout.isVertical());
65
- const rtl = component.element.closest("[dir]")?.getAttribute("dir")?.toLowerCase() === "rtl";
68
+ const rtl = component.element.matches(":dir(rtl)");
66
69
  const back = isVertical ? "ArrowUp" : rtl ? "ArrowRight" : "ArrowLeft";
67
70
  const forward = isVertical ? "ArrowDown" : rtl ? "ArrowLeft" : "ArrowRight";
68
71
  const from = list.indexOf(event.target);
@@ -236,11 +239,13 @@ export const withController = (config) => (component) => {
236
239
  }
237
240
  };
238
241
  const enableKeyboardNavigation = () => {
242
+ keyboardEnabled = true;
239
243
  component.chipInstances.forEach((chip) => {
240
244
  chip.element.addEventListener("keydown", handleKeyboardNavigation);
241
245
  });
242
246
  };
243
247
  const disableKeyboardNavigation = () => {
248
+ keyboardEnabled = false;
244
249
  component.chipInstances.forEach((chip) => {
245
250
  chip.element.removeEventListener("keydown", handleKeyboardNavigation);
246
251
  });
@@ -345,6 +345,16 @@ export interface ChipsComponent {
345
345
  * @returns The chips instance for chaining
346
346
  */
347
347
  enableKeyboardNavigation: () => ChipsComponent;
348
+ /**
349
+ * Turns keyboard navigation between the chips on and off: while disabled,
350
+ * the arrows, Home and End no longer move focus in the set (FLO-352)
351
+ */
352
+ keyboard: {
353
+ /** Moves focus with the arrows, Home and End again */
354
+ enable: () => void;
355
+ /** Stops moving focus with the arrows, Home and End */
356
+ disable: () => void;
357
+ };
348
358
  /**
349
359
  * Destroys the chips container and all contained chips
350
360
  */
@@ -29,7 +29,7 @@ export const getElementConfig = (config) => {
29
29
  if (config.modal !== false) {
30
30
  attributes['aria-modal'] = 'true';
31
31
  }
32
- return createElementConfig(config, {
32
+ return createElementConfig({ ...config, title: undefined }, {
33
33
  tag: config.layer === 'top' ? 'dialog' : 'div',
34
34
  attributes,
35
35
  className: config.class
@@ -63,17 +63,20 @@ const createFabMenu = (config) => {
63
63
  element.className = `${block}__item`;
64
64
  element.setAttribute("role", "menuitem");
65
65
  element.tabIndex = -1;
66
+ const content = document.createElement("span");
67
+ content.className = `${block}__item-content`;
66
68
  if (item.icon) {
67
69
  const icon = document.createElement("span");
68
70
  icon.className = `${block}__item-icon`;
69
71
  icon.setAttribute("aria-hidden", "true");
70
72
  setHTML(icon, item.icon);
71
- element.appendChild(icon);
73
+ content.appendChild(icon);
72
74
  }
73
75
  const label = document.createElement("span");
74
76
  label.className = `${block}__item-text`;
75
77
  label.textContent = item.text;
76
- element.appendChild(label);
78
+ content.appendChild(label);
79
+ element.appendChild(content);
77
80
  list.appendChild(element);
78
81
  return { item, element };
79
82
  });
@@ -108,7 +111,7 @@ const createFabMenu = (config) => {
108
111
  const wire = (created) => {
109
112
  created.on("select", (event) => {
110
113
  if (event.itemId !== undefined)
111
- component.emit(FAB_MENU_EVENTS.SELECT, { id: event.itemId });
114
+ component.emit(FAB_MENU_EVENTS.SELECT, { id: event.itemId, value: event.itemId });
112
115
  });
113
116
  created.on("close", () => setOpened(false));
114
117
  if (created.element.id)
@@ -159,7 +162,12 @@ const createFabMenu = (config) => {
159
162
  if (!event.composedPath().includes(root))
160
163
  closeList(false);
161
164
  };
165
+ const measure = () => entries.forEach(({ element }) => {
166
+ const content = element.firstElementChild;
167
+ element.style.setProperty(`--${PREFIX}-fab-menu-item-width`, `${content.offsetWidth}px`);
168
+ });
162
169
  const openList = () => {
170
+ measure();
163
171
  stagger(true);
164
172
  const top = root.getBoundingClientRect().top;
165
173
  list.style.maxHeight = top > 0 ? `${Math.max(0, top - FAB_MENU_LIST_GAP - WINDOW_MARGIN)}px` : "";
@@ -248,7 +256,7 @@ const createFabMenu = (config) => {
248
256
  const entry = entries.find(({ element }) => element.contains(event.target));
249
257
  if (!entry)
250
258
  return;
251
- component.emit(FAB_MENU_EVENTS.SELECT, { id: entry.item.id });
259
+ component.emit(FAB_MENU_EVENTS.SELECT, { id: entry.item.id, value: entry.item.id });
252
260
  closeList(true);
253
261
  });
254
262
  if (settings.presentation === "auto") {
@@ -79,9 +79,13 @@ export interface FabMenuEvents {
79
79
  open: () => void;
80
80
  /** The menu closed */
81
81
  close: () => void;
82
- /** An item was chosen; the menu closes */
82
+ /**
83
+ * An item was chosen; the menu closes. `value` is the item's id again, as
84
+ * the `value` of `<m-fab-menu>`'s `select` (the FLO-320 payload rule)
85
+ */
83
86
  select: (event: {
84
87
  id: string;
88
+ value: string;
85
89
  }) => void;
86
90
  }
87
91
  /**
@@ -16,11 +16,11 @@ export const LOADING_INDICATOR_SPRING = {
16
16
  };
17
17
  export const LOADING_INDICATOR_SHAPES = [
18
18
  'softBurst',
19
- 'cookie9',
19
+ 'cookie9Sided',
20
20
  'pentagon',
21
21
  'pill',
22
22
  'sunny',
23
- 'cookie4',
23
+ 'cookie4Sided',
24
24
  'oval'
25
25
  ];
26
26
  export const LOADING_INDICATOR_DETERMINATE_SHAPES = ['circle', 'softBurst'];
@@ -1,12 +1,23 @@
1
1
  import { createCanvasContext, updateCanvasDimensions } from "../../../core/canvas/utils.js";
2
2
  import { onThemeChange } from "../../../core/utils/theme.js";
3
- import { materialShape, radialProfile } from "../../../core/shapes/index.js";
3
+ import { shapeCircle, shapeCookie4Sided, shapeCookie9Sided, shapeOval, shapePentagon, shapePill, shapeSoftBurst, shapeSunny, } from "../../../core/shapes/index.js";
4
+ import { sampleProfile } from "../../../core/shapes/material.js";
5
+ const indicatorShapes = {
6
+ circle: shapeCircle,
7
+ oval: shapeOval,
8
+ pentagon: shapePentagon,
9
+ pill: shapePill,
10
+ softBurst: shapeSoftBurst,
11
+ sunny: shapeSunny,
12
+ cookie4Sided: shapeCookie4Sided,
13
+ cookie9Sided: shapeCookie9Sided,
14
+ };
4
15
  import { LOADING_INDICATOR_CLASSES, LOADING_INDICATOR_DEFAULTS } from "../constants.js";
5
16
  const profileCache = new Map();
6
17
  const profileFor = (name) => {
7
18
  let profile = profileCache.get(name);
8
19
  if (!profile) {
9
- profile = radialProfile(materialShape(name), LOADING_INDICATOR_DEFAULTS.SAMPLES);
20
+ profile = sampleProfile((indicatorShapes[name] ?? shapeCircle)(), LOADING_INDICATOR_DEFAULTS.SAMPLES);
10
21
  profileCache.set(name, profile);
11
22
  }
12
23
  return profile;
@@ -19,7 +19,7 @@ export const createBaseConfig = (config = {}) => {
19
19
  }
20
20
  return merged;
21
21
  };
22
- export const getElementConfig = (config) => createElementConfig(config, {
22
+ export const getElementConfig = (config) => createElementConfig({ ...config, title: undefined }, {
23
23
  tag: config.layer === "top" ? "dialog" : "div",
24
24
  className: [config.class].filter(Boolean),
25
25
  attributes: {
@@ -62,11 +62,12 @@ export function updateTabPanels(component) {
62
62
  }
63
63
  }
64
64
  }
65
+ const isEnabledTab = (tab) => !tab.element.disabled && tab.element.getAttribute("aria-disabled") !== "true";
65
66
  export function syncTabStops(component) {
66
67
  if (typeof component.getTabs !== "function")
67
68
  return;
68
69
  const tabs = component.getTabs();
69
- const enabled = tabs.filter((tab) => !tab.element.disabled);
70
+ const enabled = tabs.filter(isEnabledTab);
70
71
  const active = getActiveTab(component);
71
72
  const stop = active && enabled.includes(active) ? active : enabled[0];
72
73
  tabs.forEach((tab) => tab.element.setAttribute("tabindex", tab === stop ? "0" : "-1"));
@@ -89,7 +90,7 @@ export function setupKeyboardNavigation(component, options = {}) {
89
90
  return;
90
91
  const tabs = component
91
92
  .getTabs()
92
- .filter((tab) => !tab.element.disabled);
93
+ .filter(isEnabledTab);
93
94
  const currentIndex = tabs.findIndex((tab) => tab.element === tabElement);
94
95
  if (currentIndex === -1)
95
96
  return;
@@ -18,7 +18,7 @@ export const defaultConfig = {
18
18
  export const createBaseConfig = (config = {}) => createComponentConfig(defaultConfig, config, "time-picker");
19
19
  const inDialog = (event, prefix) => event.target instanceof Element && event.target.closest(`.${prefix}-time-picker__dialog`) !== null;
20
20
  export const getContainerConfig = (config) => {
21
- return createElementConfig(config, {
21
+ return createElementConfig({ ...config, title: undefined }, {
22
22
  tag: "div",
23
23
  className: [
24
24
  config.class,
@@ -18,6 +18,8 @@ export declare const straightLine: (x0: number, y0: number, x1: number, y1: numb
18
18
  */
19
19
  export declare const circularArc: (centerX: number, centerY: number, x0: number, y0: number, x1: number, y1: number) => Cubic;
20
20
  export declare const pointOnCurve: (c: Cubic, t: number) => Point;
21
+ /** Splits a cubic at `t` into two that together trace it (de Casteljau) */
22
+ export declare const splitCubic: (c: Cubic, t: number) => [Cubic, Cubic];
21
23
  export declare const reverseCubic: (c: Cubic) => Cubic;
22
24
  export declare const zeroLength: (c: Cubic) => boolean;
23
25
  export type PointTransformer = (x: number, y: number) => Point;
@@ -41,6 +41,20 @@ export const pointOnCurve = (c, t) => {
41
41
  c[1] * (u * u * u) + c[3] * (3 * t * u * u) + c[5] * (3 * t * t * u) + c[7] * (t * t * t),
42
42
  ];
43
43
  };
44
+ export const splitCubic = (c, t) => {
45
+ const u = 1 - t;
46
+ const [x0, y0, x1, y1, x2, y2, x3, y3] = c;
47
+ const ax = u * x0 + t * x1, ay = u * y0 + t * y1;
48
+ const bx = u * x1 + t * x2, by = u * y1 + t * y2;
49
+ const cx = u * x2 + t * x3, cy = u * y2 + t * y3;
50
+ const dx = u * ax + t * bx, dy = u * ay + t * by;
51
+ const ex = u * bx + t * cx, ey = u * by + t * cy;
52
+ const mx = u * dx + t * ex, my = u * dy + t * ey;
53
+ return [
54
+ [x0, y0, ax, ay, dx, dy, mx, my],
55
+ [mx, my, ex, ey, cx, cy, x3, y3],
56
+ ];
57
+ };
44
58
  export const reverseCubic = (c) => [c[6], c[7], c[4], c[5], c[2], c[3], c[0], c[1]];
45
59
  export const zeroLength = (c) => Math.abs(c[0] - c[6]) < DISTANCE_EPSILON && Math.abs(c[1] - c[7]) < DISTANCE_EPSILON;
46
60
  export const transformCubic = (c, f) => {
@@ -1,6 +1,6 @@
1
1
  export type { Cubic, Point, PointTransformer } from "./cubic.js";
2
- export { straightLine, circularArc, pointOnCurve, cubicBounds } from "./cubic.js";
2
+ export { straightLine, circularArc, pointOnCurve, cubicBounds, splitCubic } from "./cubic.js";
3
3
  export type { CornerRounding, RoundedPolygon } from "./polygon.js";
4
- export { UNROUNDED, roundedPolygon, regularPolygon, circle, star, transformPolygon, rotatePolygon, scalePolygon, polygonBounds, polygonMaxRadius, normalizePolygon, } from "./polygon.js";
4
+ export { UNROUNDED, roundedPolygon, rectangle, regularPolygon, circle, star, transformPolygon, rotatePolygon, scalePolygon, polygonBounds, polygonMaxRadius, normalizePolygon, } from "./polygon.js";
5
5
  export type { MaterialShapeName, RadialProfile } from "./material.js";
6
- export { materialShape, radialProfile } from "./material.js";
6
+ export { materialShape, materialShapePath, polygonPath, radialProfile, shapeCircle, shapeSquare, shapeSlanted, shapeArch, shapeFan, shapeArrow, shapeSemiCircle, shapeOval, shapePill, shapeTriangle, shapeDiamond, shapeClamShell, shapePentagon, shapeGem, shapeSunny, shapeVerySunny, shapeCookie4Sided, shapeCookie6Sided, shapeCookie7Sided, shapeCookie9Sided, shapeCookie12Sided, shapeGhostish, shapeClover4Leaf, shapeClover8Leaf, shapeBurst, shapeSoftBurst, shapeBoom, shapeSoftBoom, shapeFlower, shapePuffy, shapePuffyDiamond, shapePixelCircle, shapePixelTriangle, shapeBun, shapeHeart, } from "./material.js";
@@ -1,3 +1,3 @@
1
- export { straightLine, circularArc, pointOnCurve, cubicBounds } from "./cubic.js";
2
- export { UNROUNDED, roundedPolygon, regularPolygon, circle, star, transformPolygon, rotatePolygon, scalePolygon, polygonBounds, polygonMaxRadius, normalizePolygon, } from "./polygon.js";
3
- export { materialShape, radialProfile } from "./material.js";
1
+ export { straightLine, circularArc, pointOnCurve, cubicBounds, splitCubic } from "./cubic.js";
2
+ export { UNROUNDED, roundedPolygon, rectangle, regularPolygon, circle, star, transformPolygon, rotatePolygon, scalePolygon, polygonBounds, polygonMaxRadius, normalizePolygon, } from "./polygon.js";
3
+ export { materialShape, materialShapePath, polygonPath, radialProfile, shapeCircle, shapeSquare, shapeSlanted, shapeArch, shapeFan, shapeArrow, shapeSemiCircle, shapeOval, shapePill, shapeTriangle, shapeDiamond, shapeClamShell, shapePentagon, shapeGem, shapeSunny, shapeVerySunny, shapeCookie4Sided, shapeCookie6Sided, shapeCookie7Sided, shapeCookie9Sided, shapeCookie12Sided, shapeGhostish, shapeClover4Leaf, shapeClover8Leaf, shapeBurst, shapeSoftBurst, shapeBoom, shapeSoftBoom, shapeFlower, shapePuffy, shapePuffyDiamond, shapePixelCircle, shapePixelTriangle, shapeBun, shapeHeart, } from "./material.js";
@@ -1,8 +1,129 @@
1
1
  import { RoundedPolygon, polygonMaxRadius } from "./polygon.js";
2
- /** Names of the Material shapes available here */
3
- export type MaterialShapeName = 'circle' | 'oval' | 'pill' | 'pentagon' | 'sunny' | 'cookie4' | 'cookie9' | 'softBurst';
4
- /** A Material shape, normalised into the unit square */
2
+ /** Circle */
3
+ export declare const shapeCircle: () => RoundedPolygon;
4
+ /** A rounded square */
5
+ export declare const shapeSquare: () => RoundedPolygon;
6
+ /** A slanted square */
7
+ export declare const shapeSlanted: () => RoundedPolygon;
8
+ /** An arch */
9
+ export declare const shapeArch: () => RoundedPolygon;
10
+ /** A fan */
11
+ export declare const shapeFan: () => RoundedPolygon;
12
+ /** An arrow */
13
+ export declare const shapeArrow: () => RoundedPolygon;
14
+ /** A semicircle */
15
+ export declare const shapeSemiCircle: () => RoundedPolygon;
16
+ /** An oval */
17
+ export declare const shapeOval: () => RoundedPolygon;
18
+ /** A pill */
19
+ export declare const shapePill: () => RoundedPolygon;
20
+ /** A triangle */
21
+ export declare const shapeTriangle: () => RoundedPolygon;
22
+ /** A diamond */
23
+ export declare const shapeDiamond: () => RoundedPolygon;
24
+ /** A clam shell */
25
+ export declare const shapeClamShell: () => RoundedPolygon;
26
+ /** A pentagon */
27
+ export declare const shapePentagon: () => RoundedPolygon;
28
+ /** A gem */
29
+ export declare const shapeGem: () => RoundedPolygon;
30
+ /** A sunny shape: an 8-point star */
31
+ export declare const shapeSunny: () => RoundedPolygon;
32
+ /** A very sunny shape */
33
+ export declare const shapeVerySunny: () => RoundedPolygon;
34
+ /** A 4-sided cookie */
35
+ export declare const shapeCookie4Sided: () => RoundedPolygon;
36
+ /** A 6-sided cookie */
37
+ export declare const shapeCookie6Sided: () => RoundedPolygon;
38
+ /** A 7-sided cookie */
39
+ export declare const shapeCookie7Sided: () => RoundedPolygon;
40
+ /** A 9-sided cookie */
41
+ export declare const shapeCookie9Sided: () => RoundedPolygon;
42
+ /** A 12-sided cookie */
43
+ export declare const shapeCookie12Sided: () => RoundedPolygon;
44
+ /** A ghost-ish shape */
45
+ export declare const shapeGhostish: () => RoundedPolygon;
46
+ /** A 4-leaf clover */
47
+ export declare const shapeClover4Leaf: () => RoundedPolygon;
48
+ /** An 8-leaf clover */
49
+ export declare const shapeClover8Leaf: () => RoundedPolygon;
50
+ /** A burst */
51
+ export declare const shapeBurst: () => RoundedPolygon;
52
+ /** A soft burst */
53
+ export declare const shapeSoftBurst: () => RoundedPolygon;
54
+ /** A boom */
55
+ export declare const shapeBoom: () => RoundedPolygon;
56
+ /** A soft boom */
57
+ export declare const shapeSoftBoom: () => RoundedPolygon;
58
+ /** A flower */
59
+ export declare const shapeFlower: () => RoundedPolygon;
60
+ /** A puffy shape */
61
+ export declare const shapePuffy: () => RoundedPolygon;
62
+ /** A puffy diamond */
63
+ export declare const shapePuffyDiamond: () => RoundedPolygon;
64
+ /** A pixelated circle */
65
+ export declare const shapePixelCircle: () => RoundedPolygon;
66
+ /** A pixelated triangle */
67
+ export declare const shapePixelTriangle: () => RoundedPolygon;
68
+ /** A bun */
69
+ export declare const shapeBun: () => RoundedPolygon;
70
+ /** A heart */
71
+ export declare const shapeHeart: () => RoundedPolygon;
72
+ declare const byName: {
73
+ circle: () => RoundedPolygon;
74
+ square: () => RoundedPolygon;
75
+ slanted: () => RoundedPolygon;
76
+ arch: () => RoundedPolygon;
77
+ fan: () => RoundedPolygon;
78
+ arrow: () => RoundedPolygon;
79
+ semiCircle: () => RoundedPolygon;
80
+ oval: () => RoundedPolygon;
81
+ pill: () => RoundedPolygon;
82
+ triangle: () => RoundedPolygon;
83
+ diamond: () => RoundedPolygon;
84
+ clamShell: () => RoundedPolygon;
85
+ pentagon: () => RoundedPolygon;
86
+ gem: () => RoundedPolygon;
87
+ sunny: () => RoundedPolygon;
88
+ verySunny: () => RoundedPolygon;
89
+ cookie4Sided: () => RoundedPolygon;
90
+ cookie6Sided: () => RoundedPolygon;
91
+ cookie7Sided: () => RoundedPolygon;
92
+ cookie9Sided: () => RoundedPolygon;
93
+ cookie12Sided: () => RoundedPolygon;
94
+ ghostish: () => RoundedPolygon;
95
+ clover4Leaf: () => RoundedPolygon;
96
+ clover8Leaf: () => RoundedPolygon;
97
+ burst: () => RoundedPolygon;
98
+ softBurst: () => RoundedPolygon;
99
+ boom: () => RoundedPolygon;
100
+ softBoom: () => RoundedPolygon;
101
+ flower: () => RoundedPolygon;
102
+ puffy: () => RoundedPolygon;
103
+ puffyDiamond: () => RoundedPolygon;
104
+ pixelCircle: () => RoundedPolygon;
105
+ pixelTriangle: () => RoundedPolygon;
106
+ bun: () => RoundedPolygon;
107
+ heart: () => RoundedPolygon;
108
+ /** @deprecated Use 'cookie4Sided' */
109
+ cookie4: () => RoundedPolygon;
110
+ /** @deprecated Use 'cookie9Sided' */
111
+ cookie9: () => RoundedPolygon;
112
+ };
113
+ /**
114
+ * Names of the Material shapes: Compose's, camelCased. 'cookie4' and
115
+ * 'cookie9' are deprecated aliases of 'cookie4Sided' and 'cookie9Sided'.
116
+ */
117
+ export type MaterialShapeName = keyof typeof byName;
118
+ /** A Material shape by name, normalised into the unit square. Carries every shape; import `shapeX` to carry one. */
5
119
  export declare const materialShape: (name: MaterialShapeName) => RoundedPolygon;
120
+ /**
121
+ * A polygon's outline as an SVG path ("M … C … Z"), scaled by `size`: a
122
+ * normalised shape fills a `size` × `size` box. Coordinates keep three decimals.
123
+ */
124
+ export declare const polygonPath: (polygon: RoundedPolygon, size?: number) => string;
125
+ /** A Material shape as an SVG path in a `size` × `size` box. Carries every shape, as materialShape does. */
126
+ export declare const materialShapePath: (name: MaterialShapeName, size?: number) => string;
6
127
  /** A shape's outline as radii at evenly spaced angles around its centre */
7
128
  export interface RadialProfile {
8
129
  /** Radius at angle i * 2π / radii.length, clockwise from the positive x axis on a y-down canvas */
@@ -14,11 +135,20 @@ export interface RadialProfile {
14
135
  maxRadius: number;
15
136
  }
16
137
  /**
17
- * Samples the outline at `samples` angles around the shape's area centroid.
138
+ * radialProfile without its star-shape check, for callers whose shapes are
139
+ * known to be star-shaped: the loading indicator's, which the tests check.
18
140
  * The centroid, not the bounds centre, is the pivot: a pentagon's mass sits
19
141
  * below the middle of its box, and turning it about the box would make it
20
- * orbit. The shape must be star-shaped around its centroid, which every
21
- * Material shape is: each ray from the centre crosses the outline once.
142
+ * orbit.
143
+ * @internal
144
+ */
145
+ export declare const sampleProfile: (polygon: RoundedPolygon, samples?: number, stepsPerCubic?: number) => RadialProfile;
146
+ /**
147
+ * Samples the outline at `samples` angles around the shape's area centroid.
148
+ * Throws for a shape that is not star-shaped around it. Of the Material
149
+ * shapes, 33 are; Puffy and PixelTriangle are not (their outlines double back
150
+ * as seen from the centroid, Puffy by about 0.1°): a ray from the centroid
151
+ * would cross the outline more than once, and the profile would be wrong.
22
152
  */
23
153
  export declare const radialProfile: (polygon: RoundedPolygon, samples?: number, stepsPerCubic?: number) => RadialProfile;
24
154
  export { polygonMaxRadius };