@bug-on/m3-expressive 1.3.5 → 1.3.7
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/CHANGELOG.md +12 -0
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +110 -91
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +110 -91
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-Cckt8qEm.d.ts → core-DamhB5Yd.d.ts} +1 -1
- package/dist/{core-DDfG4pym.d.mts → core-Wsfqn9_N.d.mts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/{fading-blur-mask--uZbBKLj.d.ts → fading-blur-mask-CX-bwjNU.d.mts} +6 -1
- package/dist/{fading-blur-mask--uZbBKLj.d.mts → fading-blur-mask-D57UMguz.d.ts} +6 -1
- package/dist/feedback.d.mts +17 -5
- package/dist/feedback.d.ts +17 -5
- package/dist/feedback.js +1 -1
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +3 -3
- package/dist/forms.d.ts +3 -3
- package/dist/forms.js +16 -6
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +16 -6
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-CxyJv7UV.d.mts → icon-button-BpX9_fwZ.d.mts} +1 -1
- package/dist/{icon-button-Di8VX6ou.d.ts → icon-button-DFXp9hze.d.ts} +1 -1
- package/dist/index.d.mts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +1790 -1133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1640 -988
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +92 -23
- package/dist/layout.d.ts +92 -23
- package/dist/layout.js +118 -13
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +118 -15
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-expressive-shapes-CPcfl_Hf.d.mts → md3-expressive-shapes-wk_98LJh.d.mts} +20 -1
- package/dist/{md3-expressive-shapes-CPcfl_Hf.d.ts → md3-expressive-shapes-wk_98LJh.d.ts} +20 -1
- package/dist/md3-xBl4wgND.d.mts +44 -0
- package/dist/md3-xBl4wgND.d.ts +44 -0
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.js +74 -21
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +74 -21
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +4 -2
- package/dist/overlays.d.ts +4 -2
- package/dist/overlays.js +85 -44
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +85 -44
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +89 -56
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +89 -56
- package/dist/pickers.mjs.map +1 -1
- package/dist/shapes.d.mts +150 -17
- package/dist/shapes.d.ts +150 -17
- package/dist/shapes.js +618 -126
- package/dist/shapes.js.map +1 -1
- package/dist/shapes.mjs +614 -127
- package/dist/shapes.mjs.map +1 -1
- package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-BfdgYjd3.d.ts} +70 -0
- package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-kLfHINFZ.d.mts} +70 -0
- package/dist/{split-button-trailing-uncheckable-CGzk7KcG.d.ts → split-button-trailing-uncheckable-BpyIlOdn.d.ts} +7 -3
- package/dist/{split-button-trailing-uncheckable-gAz6OAIi.d.mts → split-button-trailing-uncheckable-CpT8iPpr.d.mts} +7 -3
- package/dist/{text-field-DARNdj14.d.ts → text-field-Ct-LT_2T.d.ts} +23 -4
- package/dist/{text-field-4OlT9o8s.d.mts → text-field-D5xiGn-q.d.mts} +23 -4
- package/llms-full.txt +25 -3
- package/llms.txt +4 -1
- package/package.json +1 -1
- package/dist/md3-BQhRygSi.d.mts +0 -31
- package/dist/md3-BQhRygSi.d.ts +0 -31
|
@@ -109,6 +109,11 @@ declare function directionVector(dx: number, dy: number): [number, number];
|
|
|
109
109
|
* @returns true if convex
|
|
110
110
|
*/
|
|
111
111
|
declare function convex(prevX: number, prevY: number, currX: number, currY: number, nextX: number, nextY: number): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Formats a coordinate to at most 4 decimal places with maximum performance.
|
|
114
|
+
* Avoids string parsing and intermediate allocations.
|
|
115
|
+
*/
|
|
116
|
+
declare function formatCoordinate(v: number): string;
|
|
112
117
|
/**
|
|
113
118
|
* Type for a function that transforms a point (x, y) → (x', y').
|
|
114
119
|
*/
|
|
@@ -447,6 +452,20 @@ declare class RoundedPolygon {
|
|
|
447
452
|
* @returns [minX, minY, maxX, maxY] of the max-bounds square
|
|
448
453
|
*/
|
|
449
454
|
calculateMaxBounds(): [number, number, number, number];
|
|
455
|
+
/**
|
|
456
|
+
* Calculates the approximate signed area of the polygon using anchor points.
|
|
457
|
+
* Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
|
|
458
|
+
*/
|
|
459
|
+
calculateSignedArea(): number;
|
|
460
|
+
/**
|
|
461
|
+
* Returns true if the polygon outline runs in Clockwise order (screen coords).
|
|
462
|
+
*/
|
|
463
|
+
isClockwise(): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Returns a reversed copy of the polygon with reversed traversal order.
|
|
466
|
+
* Flips the winding direction (CW ↔ CCW).
|
|
467
|
+
*/
|
|
468
|
+
reversed(): RoundedPolygon;
|
|
450
469
|
}
|
|
451
470
|
|
|
452
471
|
/**
|
|
@@ -495,4 +514,4 @@ declare const MD3Shapes: {
|
|
|
495
514
|
};
|
|
496
515
|
type MD3ShapeName = keyof typeof MD3Shapes;
|
|
497
516
|
|
|
498
|
-
export { ANGLE_EPSILON as A,
|
|
517
|
+
export { ANGLE_EPSILON as A, rotate90 as B, type CornerFeature as C, DISTANCE_EPSILON as D, type EdgeFeature as E, FLOAT_PI as F, scalePoint as G, square as H, subtractPoints as I, transformFeature as J, transformPoint as K, type MD3ShapeName as M, type Point as P, RoundedPolygon as R, UNROUNDED as U, type CornerRounding as a, Cubic as b, type Feature as c, MD3Shapes as d, MutableCubic as e, type PointTransformer as f, addPoints as g, clockwise as h, convex as i, cornerFeature as j, cornerRounding as k, directionVector as l, distance as m, distanceSquared as n, dividePoint as o, dotProduct as p, edgeFeature as q, formatCoordinate as r, getDirection as s, getDistance as t, getDistanceSquared as u, interpolate as v, lerpPoint as w, point as x, positiveModulo as y, radialToCartesian as z };
|
|
@@ -109,6 +109,11 @@ declare function directionVector(dx: number, dy: number): [number, number];
|
|
|
109
109
|
* @returns true if convex
|
|
110
110
|
*/
|
|
111
111
|
declare function convex(prevX: number, prevY: number, currX: number, currY: number, nextX: number, nextY: number): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Formats a coordinate to at most 4 decimal places with maximum performance.
|
|
114
|
+
* Avoids string parsing and intermediate allocations.
|
|
115
|
+
*/
|
|
116
|
+
declare function formatCoordinate(v: number): string;
|
|
112
117
|
/**
|
|
113
118
|
* Type for a function that transforms a point (x, y) → (x', y').
|
|
114
119
|
*/
|
|
@@ -447,6 +452,20 @@ declare class RoundedPolygon {
|
|
|
447
452
|
* @returns [minX, minY, maxX, maxY] of the max-bounds square
|
|
448
453
|
*/
|
|
449
454
|
calculateMaxBounds(): [number, number, number, number];
|
|
455
|
+
/**
|
|
456
|
+
* Calculates the approximate signed area of the polygon using anchor points.
|
|
457
|
+
* Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
|
|
458
|
+
*/
|
|
459
|
+
calculateSignedArea(): number;
|
|
460
|
+
/**
|
|
461
|
+
* Returns true if the polygon outline runs in Clockwise order (screen coords).
|
|
462
|
+
*/
|
|
463
|
+
isClockwise(): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Returns a reversed copy of the polygon with reversed traversal order.
|
|
466
|
+
* Flips the winding direction (CW ↔ CCW).
|
|
467
|
+
*/
|
|
468
|
+
reversed(): RoundedPolygon;
|
|
450
469
|
}
|
|
451
470
|
|
|
452
471
|
/**
|
|
@@ -495,4 +514,4 @@ declare const MD3Shapes: {
|
|
|
495
514
|
};
|
|
496
515
|
type MD3ShapeName = keyof typeof MD3Shapes;
|
|
497
516
|
|
|
498
|
-
export { ANGLE_EPSILON as A,
|
|
517
|
+
export { ANGLE_EPSILON as A, rotate90 as B, type CornerFeature as C, DISTANCE_EPSILON as D, type EdgeFeature as E, FLOAT_PI as F, scalePoint as G, square as H, subtractPoints as I, transformFeature as J, transformPoint as K, type MD3ShapeName as M, type Point as P, RoundedPolygon as R, UNROUNDED as U, type CornerRounding as a, Cubic as b, type Feature as c, MD3Shapes as d, MutableCubic as e, type PointTransformer as f, addPoints as g, clockwise as h, convex as i, cornerFeature as j, cornerRounding as k, directionVector as l, distance as m, distanceSquared as n, dividePoint as o, dotProduct as p, edgeFeature as q, formatCoordinate as r, getDirection as s, getDistance as t, getDistanceSquared as u, interpolate as v, lerpPoint as w, point as x, positiveModulo as y, radialToCartesian as z };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/** MD3 button color variants */
|
|
4
|
+
type MD3ColorStyle = "elevated" | "filled" | "tonal" | "outlined" | "text"
|
|
5
|
+
/** High-chroma tertiary tone — for hero accents, CTAs, expressive moments. */
|
|
6
|
+
| "tertiary"
|
|
7
|
+
/** Brand-stable primary fixed — same hue across light/dark, for badges/pills. */
|
|
8
|
+
| "primary-fixed"
|
|
9
|
+
/** Brand-stable tertiary fixed — same hue across light/dark, for special states. */
|
|
10
|
+
| "tertiary-fixed";
|
|
11
|
+
/** MD3 Expressive button sizes */
|
|
12
|
+
type MD3Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
13
|
+
/** All MD3 system color token names (`--md-sys-color-*`) */
|
|
14
|
+
type MD3ColorTokenName = "primary" | "on-primary" | "primary-container" | "on-primary-container" | "inverse-primary" | "primary-fixed" | "primary-fixed-dim" | "on-primary-fixed" | "on-primary-fixed-variant" | "secondary" | "on-secondary" | "secondary-container" | "on-secondary-container" | "secondary-fixed" | "secondary-fixed-dim" | "on-secondary-fixed" | "on-secondary-fixed-variant" | "tertiary" | "on-tertiary" | "tertiary-container" | "on-tertiary-container" | "tertiary-fixed" | "tertiary-fixed-dim" | "on-tertiary-fixed" | "on-tertiary-fixed-variant" | "error" | "on-error" | "error-container" | "on-error-container" | "surface" | "on-surface" | "surface-variant" | "on-surface-variant" | "surface-dim" | "surface-bright" | "surface-tint" | "surface-container-lowest" | "surface-container-low" | "surface-container" | "surface-container-high" | "surface-container-highest" | "inverse-surface" | "inverse-on-surface" | "background" | "on-background" | "outline" | "outline-variant" | "scrim" | "shadow" | "indicator-active" | "indicator-container" | "indicator-contained-active" | "indicator-contained-container" | "indicator-track" | "indicator-stop";
|
|
15
|
+
/**
|
|
16
|
+
* MD3 system color token or any arbitrary CSS color string.
|
|
17
|
+
* Provides IDE autocompletion for `var(--md-sys-color-*)` design tokens while
|
|
18
|
+
* allowing custom CSS colors, hex, rgb, or class values without breaking changes.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* color="var(--md-sys-color-surface)"
|
|
22
|
+
* color="var(--md-sys-color-primary)"
|
|
23
|
+
* color="#6750a4"
|
|
24
|
+
*/
|
|
25
|
+
type MD3ColorToken = `var(--md-sys-color-${MD3ColorTokenName})` | (string & {});
|
|
26
|
+
/**
|
|
27
|
+
* MD3 Expressive slot width ratio.
|
|
28
|
+
* Used for icon buttons where width is independent from the size scale.
|
|
29
|
+
* - `"narrow"` – compressed width for dense toolbars.
|
|
30
|
+
* - `"default"` – 1:1 square/round aspect ratio.
|
|
31
|
+
* - `"wide"` – extended width.
|
|
32
|
+
*/
|
|
33
|
+
type MD3SlotWidth = "narrow" | "default" | "wide";
|
|
34
|
+
/** MD3 shape families */
|
|
35
|
+
type MD3Shape = "round" | "square";
|
|
36
|
+
/** Helper: PolyMorphic component ref */
|
|
37
|
+
type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>["ref"];
|
|
38
|
+
/** Helper: Props cho polymorphic components */
|
|
39
|
+
type PolymorphicProps<C extends ElementType, Props = object> = Props & Omit<ComponentPropsWithoutRef<C>, keyof Props> & {
|
|
40
|
+
as?: C;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type { MD3ColorStyle as M, PolymorphicProps as P, MD3ColorToken as a, MD3ColorTokenName as b, MD3Shape as c, MD3Size as d, PolymorphicRef as e, MD3SlotWidth as f };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentPropsWithRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/** MD3 button color variants */
|
|
4
|
+
type MD3ColorStyle = "elevated" | "filled" | "tonal" | "outlined" | "text"
|
|
5
|
+
/** High-chroma tertiary tone — for hero accents, CTAs, expressive moments. */
|
|
6
|
+
| "tertiary"
|
|
7
|
+
/** Brand-stable primary fixed — same hue across light/dark, for badges/pills. */
|
|
8
|
+
| "primary-fixed"
|
|
9
|
+
/** Brand-stable tertiary fixed — same hue across light/dark, for special states. */
|
|
10
|
+
| "tertiary-fixed";
|
|
11
|
+
/** MD3 Expressive button sizes */
|
|
12
|
+
type MD3Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
13
|
+
/** All MD3 system color token names (`--md-sys-color-*`) */
|
|
14
|
+
type MD3ColorTokenName = "primary" | "on-primary" | "primary-container" | "on-primary-container" | "inverse-primary" | "primary-fixed" | "primary-fixed-dim" | "on-primary-fixed" | "on-primary-fixed-variant" | "secondary" | "on-secondary" | "secondary-container" | "on-secondary-container" | "secondary-fixed" | "secondary-fixed-dim" | "on-secondary-fixed" | "on-secondary-fixed-variant" | "tertiary" | "on-tertiary" | "tertiary-container" | "on-tertiary-container" | "tertiary-fixed" | "tertiary-fixed-dim" | "on-tertiary-fixed" | "on-tertiary-fixed-variant" | "error" | "on-error" | "error-container" | "on-error-container" | "surface" | "on-surface" | "surface-variant" | "on-surface-variant" | "surface-dim" | "surface-bright" | "surface-tint" | "surface-container-lowest" | "surface-container-low" | "surface-container" | "surface-container-high" | "surface-container-highest" | "inverse-surface" | "inverse-on-surface" | "background" | "on-background" | "outline" | "outline-variant" | "scrim" | "shadow" | "indicator-active" | "indicator-container" | "indicator-contained-active" | "indicator-contained-container" | "indicator-track" | "indicator-stop";
|
|
15
|
+
/**
|
|
16
|
+
* MD3 system color token or any arbitrary CSS color string.
|
|
17
|
+
* Provides IDE autocompletion for `var(--md-sys-color-*)` design tokens while
|
|
18
|
+
* allowing custom CSS colors, hex, rgb, or class values without breaking changes.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* color="var(--md-sys-color-surface)"
|
|
22
|
+
* color="var(--md-sys-color-primary)"
|
|
23
|
+
* color="#6750a4"
|
|
24
|
+
*/
|
|
25
|
+
type MD3ColorToken = `var(--md-sys-color-${MD3ColorTokenName})` | (string & {});
|
|
26
|
+
/**
|
|
27
|
+
* MD3 Expressive slot width ratio.
|
|
28
|
+
* Used for icon buttons where width is independent from the size scale.
|
|
29
|
+
* - `"narrow"` – compressed width for dense toolbars.
|
|
30
|
+
* - `"default"` – 1:1 square/round aspect ratio.
|
|
31
|
+
* - `"wide"` – extended width.
|
|
32
|
+
*/
|
|
33
|
+
type MD3SlotWidth = "narrow" | "default" | "wide";
|
|
34
|
+
/** MD3 shape families */
|
|
35
|
+
type MD3Shape = "round" | "square";
|
|
36
|
+
/** Helper: PolyMorphic component ref */
|
|
37
|
+
type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>["ref"];
|
|
38
|
+
/** Helper: Props cho polymorphic components */
|
|
39
|
+
type PolymorphicProps<C extends ElementType, Props = object> = Props & Omit<ComponentPropsWithoutRef<C>, keyof Props> & {
|
|
40
|
+
as?: C;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type { MD3ColorStyle as M, PolymorphicProps as P, MD3ColorToken as a, MD3ColorTokenName as b, MD3Shape as c, MD3Size as d, PolymorphicRef as e, MD3SlotWidth as f };
|
package/dist/navigation.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as FadingBlurProps } from './fading-blur-mask
|
|
2
|
-
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps } from './fading-blur-mask
|
|
1
|
+
import { c as FadingBlurProps } from './fading-blur-mask-CX-bwjNU.mjs';
|
|
2
|
+
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps } from './fading-blur-mask-CX-bwjNU.mjs';
|
|
3
3
|
import * as motion from 'motion';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import { RefObject } from 'react';
|
|
@@ -9,9 +9,9 @@ import { a as ContextMenuProps, C as ContextMenuContentProps, b as ContextMenuTr
|
|
|
9
9
|
export { e as MenuGroupPosition, g as MenuItemPosition, n as VerticalMenuGroupProps, p as VerticalMenuSeparatorStyle } from './menu-types-rZNQFO7Y.mjs';
|
|
10
10
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
11
11
|
import { Transition, Variants, HTMLMotionProps } from 'motion/react';
|
|
12
|
-
import { M as MD3ShapeName } from './md3-expressive-shapes-
|
|
13
|
-
import {
|
|
14
|
-
import { B as BaseIconButtonProps } from './icon-button-
|
|
12
|
+
import { M as MD3ShapeName } from './md3-expressive-shapes-wk_98LJh.mjs';
|
|
13
|
+
import { f as MD3SlotWidth } from './md3-xBl4wgND.mjs';
|
|
14
|
+
import { B as BaseIconButtonProps } from './icon-button-BpX9_fwZ.mjs';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @file app-bar.tokens.ts
|
package/dist/navigation.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as FadingBlurProps } from './fading-blur-mask
|
|
2
|
-
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps } from './fading-blur-mask
|
|
1
|
+
import { c as FadingBlurProps } from './fading-blur-mask-D57UMguz.js';
|
|
2
|
+
export { F as FadingBlurDirection, a as FadingBlurMask, b as FadingBlurMaskProps } from './fading-blur-mask-D57UMguz.js';
|
|
3
3
|
import * as motion from 'motion';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import { RefObject } from 'react';
|
|
@@ -9,9 +9,9 @@ import { a as ContextMenuProps, C as ContextMenuContentProps, b as ContextMenuTr
|
|
|
9
9
|
export { e as MenuGroupPosition, g as MenuItemPosition, n as VerticalMenuGroupProps, p as VerticalMenuSeparatorStyle } from './menu-types-rZNQFO7Y.js';
|
|
10
10
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
11
11
|
import { Transition, Variants, HTMLMotionProps } from 'motion/react';
|
|
12
|
-
import { M as MD3ShapeName } from './md3-expressive-shapes-
|
|
13
|
-
import {
|
|
14
|
-
import { B as BaseIconButtonProps } from './icon-button-
|
|
12
|
+
import { M as MD3ShapeName } from './md3-expressive-shapes-wk_98LJh.js';
|
|
13
|
+
import { f as MD3SlotWidth } from './md3-xBl4wgND.js';
|
|
14
|
+
import { B as BaseIconButtonProps } from './icon-button-DFXp9hze.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @file app-bar.tokens.ts
|
package/dist/navigation.js
CHANGED
|
@@ -2971,6 +2971,13 @@ function transformFeature(feature, fn) {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
return edgeFeature(cubics);
|
|
2973
2973
|
}
|
|
2974
|
+
function reverseFeature(feature) {
|
|
2975
|
+
const cubics = feature.cubics.slice().reverse().map((c) => c.reverse());
|
|
2976
|
+
if (feature.type === "corner") {
|
|
2977
|
+
return cornerFeature(cubics, feature.convex);
|
|
2978
|
+
}
|
|
2979
|
+
return edgeFeature(cubics);
|
|
2980
|
+
}
|
|
2974
2981
|
|
|
2975
2982
|
// src/shapes/math/corner-rounding.ts
|
|
2976
2983
|
var UNROUNDED = Object.freeze({
|
|
@@ -3003,6 +3010,10 @@ function convex(prevX, prevY, currX, currY, nextX, nextY) {
|
|
|
3003
3010
|
const v2y = nextY - currY;
|
|
3004
3011
|
return v1x * v2y - v1y * v2x > 0;
|
|
3005
3012
|
}
|
|
3013
|
+
function formatCoordinate(v) {
|
|
3014
|
+
const rounded = Math.round(v * 1e4) / 1e4;
|
|
3015
|
+
return (rounded === 0 ? 0 : rounded).toString();
|
|
3016
|
+
}
|
|
3006
3017
|
|
|
3007
3018
|
// src/shapes/math/point.ts
|
|
3008
3019
|
function point(x, y) {
|
|
@@ -3055,9 +3066,16 @@ var Cubic = class _Cubic {
|
|
|
3055
3066
|
*/
|
|
3056
3067
|
pointOnCurve(t) {
|
|
3057
3068
|
const u = 1 - t;
|
|
3069
|
+
const uu = u * u;
|
|
3070
|
+
const tt = t * t;
|
|
3071
|
+
const uuu = uu * u;
|
|
3072
|
+
const ttt = tt * t;
|
|
3073
|
+
const c0 = 3 * t * uu;
|
|
3074
|
+
const c1 = 3 * tt * u;
|
|
3075
|
+
const p = this.points;
|
|
3058
3076
|
return point(
|
|
3059
|
-
|
|
3060
|
-
|
|
3077
|
+
p[0] * uuu + p[2] * c0 + p[4] * c1 + p[6] * ttt,
|
|
3078
|
+
p[1] * uuu + p[3] * c0 + p[5] * c1 + p[7] * ttt
|
|
3061
3079
|
);
|
|
3062
3080
|
}
|
|
3063
3081
|
/**
|
|
@@ -3666,6 +3684,36 @@ var RoundedPolygon = class _RoundedPolygon {
|
|
|
3666
3684
|
this.centerY + d
|
|
3667
3685
|
];
|
|
3668
3686
|
}
|
|
3687
|
+
/**
|
|
3688
|
+
* Calculates the approximate signed area of the polygon using anchor points.
|
|
3689
|
+
* Returns > 0 for Clockwise (in screen coords, y down), < 0 for Counter-Clockwise.
|
|
3690
|
+
*/
|
|
3691
|
+
calculateSignedArea() {
|
|
3692
|
+
let area = 0;
|
|
3693
|
+
const n = this.cubics.length;
|
|
3694
|
+
for (let i = 0; i < n; i++) {
|
|
3695
|
+
const c = this.cubics[i];
|
|
3696
|
+
area += c.anchor0X * c.anchor1Y - c.anchor1X * c.anchor0Y;
|
|
3697
|
+
}
|
|
3698
|
+
return area / 2;
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* Returns true if the polygon outline runs in Clockwise order (screen coords).
|
|
3702
|
+
*/
|
|
3703
|
+
isClockwise() {
|
|
3704
|
+
return this.calculateSignedArea() > 0;
|
|
3705
|
+
}
|
|
3706
|
+
/**
|
|
3707
|
+
* Returns a reversed copy of the polygon with reversed traversal order.
|
|
3708
|
+
* Flips the winding direction (CW ↔ CCW).
|
|
3709
|
+
*/
|
|
3710
|
+
reversed() {
|
|
3711
|
+
const reversedFeatures = this.features.slice().reverse().map((f) => reverseFeature(f));
|
|
3712
|
+
return new _RoundedPolygon(
|
|
3713
|
+
reversedFeatures,
|
|
3714
|
+
point(this.centerX, this.centerY)
|
|
3715
|
+
);
|
|
3716
|
+
}
|
|
3669
3717
|
};
|
|
3670
3718
|
function buildCubicsList(features) {
|
|
3671
3719
|
const result = [];
|
|
@@ -3734,10 +3782,21 @@ function validateContiguity(cubics) {
|
|
|
3734
3782
|
|
|
3735
3783
|
// src/shapes/catalog/md3-expressive-shapes.ts
|
|
3736
3784
|
function createShape(pts) {
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3785
|
+
let rawArea = 0;
|
|
3786
|
+
for (const p of pts) {
|
|
3787
|
+
rawArea += p[0] * p[7] - p[6] * p[1];
|
|
3788
|
+
}
|
|
3789
|
+
const normalizedPts = rawArea < 0 ? pts.slice().reverse().map((p) => [p[6], p[7], p[4], p[5], p[2], p[3], p[0], p[1]]) : pts;
|
|
3790
|
+
const cubics = normalizedPts.map((p) => new Cubic(p));
|
|
3791
|
+
const n = cubics.length;
|
|
3792
|
+
const features = cubics.map((c, i) => {
|
|
3793
|
+
const prev = cubics[(i - 1 + n) % n].pointOnCurve(0.5);
|
|
3794
|
+
const curr = c.pointOnCurve(0.5);
|
|
3795
|
+
const next = cubics[(i + 1) % n].pointOnCurve(0.5);
|
|
3796
|
+
const isConvex = convex(prev.x, prev.y, curr.x, curr.y, next.x, next.y);
|
|
3797
|
+
return cornerFeature([c], isConvex);
|
|
3798
|
+
});
|
|
3799
|
+
return RoundedPolygon.fromFeatures(features);
|
|
3741
3800
|
}
|
|
3742
3801
|
var archShape = createShape([
|
|
3743
3802
|
[1, 0.83461, 1, 0.8547, 1, 0.86477, 0.99898, 0.87322],
|
|
@@ -4831,30 +4890,24 @@ var MD3Shapes = {
|
|
|
4831
4890
|
|
|
4832
4891
|
// src/shapes/render/shape-rendering.ts
|
|
4833
4892
|
function toSvgPath(cubics, width = 1, height = 1) {
|
|
4834
|
-
|
|
4893
|
+
const len = cubics.length;
|
|
4894
|
+
if (len === 0) return "";
|
|
4835
4895
|
const paddingX = width * 0.015;
|
|
4836
4896
|
const paddingY = height * 0.015;
|
|
4837
4897
|
const sx = width - 2 * paddingX;
|
|
4838
4898
|
const sy = height - 2 * paddingY;
|
|
4839
|
-
const
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
parts.push(
|
|
4845
|
-
`C ${fmt(paddingX + c.control0X * sx)} ${fmt(flipY(c.control0Y))},${fmt(paddingX + c.control1X * sx)} ${fmt(flipY(c.control1Y))},${fmt(paddingX + c.anchor1X * sx)} ${fmt(flipY(c.anchor1Y))}`
|
|
4846
|
-
);
|
|
4899
|
+
const c0 = cubics[0];
|
|
4900
|
+
let d = `M ${formatCoordinate(paddingX + c0.anchor0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c0.anchor0Y))}`;
|
|
4901
|
+
for (let i = 0; i < len; i++) {
|
|
4902
|
+
const c = cubics[i];
|
|
4903
|
+
d += ` C ${formatCoordinate(paddingX + c.control0X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control0Y))},${formatCoordinate(paddingX + c.control1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.control1Y))},${formatCoordinate(paddingX + c.anchor1X * sx)} ${formatCoordinate(paddingY + sy * (1 - c.anchor1Y))}`;
|
|
4847
4904
|
}
|
|
4848
|
-
|
|
4849
|
-
return parts.join(" ");
|
|
4905
|
+
return `${d} Z`;
|
|
4850
4906
|
}
|
|
4851
4907
|
function toClipPath(polygon, width, height) {
|
|
4852
4908
|
const pathData = toSvgPath(polygon.cubics, width, height);
|
|
4853
4909
|
return `path('${pathData}')`;
|
|
4854
4910
|
}
|
|
4855
|
-
function fmt(v) {
|
|
4856
|
-
return Number(v.toFixed(4)).toString();
|
|
4857
|
-
}
|
|
4858
4911
|
|
|
4859
4912
|
// src/ui/navigation/navigation-shape-utils.ts
|
|
4860
4913
|
function getNavigationShapeStyle(shape, width = 56, height = 56) {
|
|
@@ -7780,7 +7833,7 @@ var WIDTH_SIZE_STYLES = {
|
|
|
7780
7833
|
},
|
|
7781
7834
|
sm: {
|
|
7782
7835
|
default: "w-10",
|
|
7783
|
-
narrow: "w-
|
|
7836
|
+
narrow: "w-10",
|
|
7784
7837
|
wide: "w-[3.25rem]"
|
|
7785
7838
|
},
|
|
7786
7839
|
md: {
|