@glass-sdk/liquid-glass 0.0.2 → 0.0.3-beta.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.
Files changed (146) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +66 -149
  3. package/dist/core/concentric.js +20 -3
  4. package/dist/core/corner-options.js +12 -0
  5. package/dist/core/corner-path.js +118 -0
  6. package/dist/core/materials.js +264 -32
  7. package/dist/core/optics.js +1 -2
  8. package/dist/core/progressive.js +1 -2
  9. package/dist/core/shape.js +18 -28
  10. package/dist/core/spring.js +5 -10
  11. package/dist/core.js +5 -6
  12. package/dist/dom/backdrop-glass.js +46 -0
  13. package/dist/dom/compose-layers.js +42 -31
  14. package/dist/dom/composited.js +136 -0
  15. package/dist/dom/control-motion.js +58 -47
  16. package/dist/dom/engine.js +1 -2
  17. package/dist/dom/escaped-layers.js +179 -0
  18. package/dist/dom/filter-bounds.js +42 -13
  19. package/dist/dom/filter-budget.js +1 -2
  20. package/dist/dom/filter-chain.js +40 -0
  21. package/dist/dom/filter-groups.js +33 -14
  22. package/dist/dom/filter-paint-root.js +8 -6
  23. package/dist/dom/filter-patch.js +94 -55
  24. package/dist/dom/filter-reach.js +32 -19
  25. package/dist/dom/filter-stages.js +1 -2
  26. package/dist/dom/fixed-shape.js +23 -16
  27. package/dist/dom/foreground.js +16 -17
  28. package/dist/dom/interaction.js +65 -92
  29. package/dist/dom/layout-rect.js +42 -0
  30. package/dist/dom/layout-size.js +28 -0
  31. package/dist/dom/lens-layers.js +250 -136
  32. package/dist/dom/map-encoder.js +16 -13
  33. package/dist/dom/map-encoder.worker.js +2 -3
  34. package/dist/dom/map-encoding.js +49 -12
  35. package/dist/dom/map-image.js +29 -7
  36. package/dist/dom/map-store.js +1 -2
  37. package/dist/dom/maps.js +133 -83
  38. package/dist/dom/material-graph.js +108 -29
  39. package/dist/dom/media-mirror.js +244 -0
  40. package/dist/dom/page-zoom.js +19 -18
  41. package/dist/dom/png.js +1 -2
  42. package/dist/dom/progressive.js +152 -147
  43. package/dist/dom/renderer.js +1 -2
  44. package/dist/dom/sampling-bounds.js +1 -2
  45. package/dist/dom/selection.js +133 -79
  46. package/dist/dom/shape-attributes.js +9 -0
  47. package/dist/dom/shape-effects.js +14 -0
  48. package/dist/dom/shape-geometry.js +3 -0
  49. package/dist/dom/shape-layout.js +115 -116
  50. package/dist/dom/shared-backdrop.js +33 -25
  51. package/dist/dom/specular.js +116 -0
  52. package/dist/dom/ticker.js +28 -19
  53. package/dist/dom/tint-color.js +24 -0
  54. package/dist/dom/warm.js +63 -59
  55. package/dist/dom.js +591 -505
  56. package/dist/gpu/geometry.js +2 -3
  57. package/dist/gpu/maps.js +1109 -7
  58. package/dist/gpu/planes.js +2 -3
  59. package/dist/gpu.js +66 -64
  60. package/dist/index.js +12 -10
  61. package/dist/react/button.js +12 -11
  62. package/dist/react/color-picker.js +199 -0
  63. package/dist/react/control-thumb.js +4 -5
  64. package/dist/react/menu.js +82 -111
  65. package/dist/react/merged-ref.js +1 -2
  66. package/dist/react/progressive.js +1 -2
  67. package/dist/react/scene.js +71 -55
  68. package/dist/react/shape.js +67 -47
  69. package/dist/react/slider.js +81 -0
  70. package/dist/react/surface.js +90 -56
  71. package/dist/react/switch.js +101 -0
  72. package/dist/react/tabs.js +85 -63
  73. package/dist/react/toolbar.js +38 -123
  74. package/dist/react/value-control-motion.js +1 -2
  75. package/dist/styles.css +517 -111
  76. package/dist/types/core/concentric.d.ts +8 -0
  77. package/dist/types/core/corner-options.d.ts +4 -0
  78. package/dist/types/core/corner-path.d.ts +8 -0
  79. package/dist/types/core/index.d.ts +3 -5
  80. package/dist/types/core/materials.d.ts +100 -28
  81. package/dist/types/core/shape.d.ts +4 -6
  82. package/dist/types/core/spring.d.ts +8 -12
  83. package/dist/types/dom/backdrop-glass.d.ts +38 -0
  84. package/dist/types/dom/compose-layers.d.ts +4 -0
  85. package/dist/types/dom/composited.d.ts +61 -0
  86. package/dist/types/dom/escaped-layers.d.ts +32 -0
  87. package/dist/types/dom/filter-bounds.d.ts +4 -0
  88. package/dist/types/dom/filter-chain.d.ts +6 -0
  89. package/dist/types/dom/filter-groups.d.ts +1 -1
  90. package/dist/types/dom/filter-paint-root.d.ts +3 -0
  91. package/dist/types/dom/filter-patch.d.ts +5 -0
  92. package/dist/types/dom/filter-reach.d.ts +9 -9
  93. package/dist/types/dom/foreground.d.ts +2 -1
  94. package/dist/types/dom/index.d.ts +8 -19
  95. package/dist/types/dom/interaction.d.ts +8 -8
  96. package/dist/types/dom/layout-rect.d.ts +17 -0
  97. package/dist/types/dom/layout-size.d.ts +11 -0
  98. package/dist/types/dom/lens-layers.d.ts +18 -10
  99. package/dist/types/dom/map-encoder.d.ts +5 -2
  100. package/dist/types/dom/map-encoding.d.ts +12 -3
  101. package/dist/types/dom/map-image.d.ts +7 -1
  102. package/dist/types/dom/maps.d.ts +25 -7
  103. package/dist/types/dom/material-graph.d.ts +73 -10
  104. package/dist/types/dom/media-mirror.d.ts +49 -0
  105. package/dist/types/dom/progressive.d.ts +2 -5
  106. package/dist/types/dom/sampling-bounds.d.ts +1 -3
  107. package/dist/types/dom/selection.d.ts +29 -4
  108. package/dist/types/dom/shape-attributes.d.ts +6 -0
  109. package/dist/types/dom/shape-effects.d.ts +10 -0
  110. package/dist/types/dom/shape-geometry.d.ts +6 -0
  111. package/dist/types/dom/shape-layout.d.ts +2 -4
  112. package/dist/types/dom/shared-backdrop.d.ts +7 -3
  113. package/dist/types/dom/specular.d.ts +50 -0
  114. package/dist/types/dom/ticker.d.ts +4 -1
  115. package/dist/types/dom/tint-color.d.ts +11 -0
  116. package/dist/types/dom/warm.d.ts +8 -2
  117. package/dist/types/gpu/geometry.d.ts +2 -0
  118. package/dist/types/gpu/planes.d.ts +3 -2
  119. package/dist/types/index.d.ts +1 -1
  120. package/dist/types/react/button.d.ts +1 -1
  121. package/dist/types/react/color-picker.d.ts +26 -0
  122. package/dist/types/react/index.d.ts +14 -10
  123. package/dist/types/react/menu.d.ts +4 -5
  124. package/dist/types/react/progressive.d.ts +1 -1
  125. package/dist/types/react/scene.d.ts +4 -2
  126. package/dist/types/react/shape.d.ts +11 -1
  127. package/dist/types/react/slider.d.ts +14 -0
  128. package/dist/types/react/surface.d.ts +11 -22
  129. package/dist/types/react/switch.d.ts +9 -0
  130. package/dist/types/react/tabs.d.ts +3 -3
  131. package/dist/types/react/toolbar.d.ts +1 -1
  132. package/package.json +46 -40
  133. package/dist/core/morph-path.js +0 -206
  134. package/dist/core/union.js +0 -117
  135. package/dist/dom/compound-field.js +0 -23
  136. package/dist/dom/exit-handoff.js +0 -14
  137. package/dist/dom/map-blend.js +0 -8
  138. package/dist/dom/morph.js +0 -296
  139. package/dist/react/value-controls.js +0 -176
  140. package/dist/types/core/morph-path.d.ts +0 -110
  141. package/dist/types/core/union.d.ts +0 -20
  142. package/dist/types/dom/compound-field.d.ts +0 -35
  143. package/dist/types/dom/exit-handoff.d.ts +0 -7
  144. package/dist/types/dom/map-blend.d.ts +0 -22
  145. package/dist/types/dom/morph.d.ts +0 -78
  146. package/dist/types/react/value-controls.d.ts +0 -20
@@ -1,20 +1,24 @@
1
- export { GlassShape, GlassShapeContainer, GlassCorner } from "./shape.js";
2
- export type { GlassShapeProps, GlassCornerProps } from "./shape.js";
3
- export type { GlassMotion, GlassMorph } from "../dom/index.js";
1
+ export { GlassShape, GlassShapeContainer, GlassCorner, GlassRow } from "./shape.js";
2
+ export type { GlassShapeProps, GlassCornerProps, GlassRowProps } from "./shape.js";
3
+ export type { GlassMotion } from "../dom/index.js";
4
4
  export type { GlassBlurEdge, ProgressiveBlurOptions } from "../core/progressive.js";
5
- export { GlassScene, GlassContent, GlassForeground, useGlassForeground, useGlassMotion } from "./scene.js";
5
+ export { GlassScene, GlassContent, GlassForeground, useGlassForeground, useGlassMotion, } from "./scene.js";
6
6
  export type { GlassSceneProps, GlassContentProps, GlassForegroundProps } from "./scene.js";
7
- export { GlassSurface } from "./surface.js";
7
+ export { GlassSurface, GlassPopupSurface } from "./surface.js";
8
8
  export type { GlassSurfaceProps, GlassMotionProps } from "./surface.js";
9
9
  export { GlassButton } from "./button.js";
10
10
  export type { GlassButtonProps, GlassButtonSize } from "./button.js";
11
- export { GlassToolbar, GlassToolbarButton, GlassToolbarLink, GlassToolbarGroup, GlassToolbarSpacer } from "./toolbar.js";
12
- export type { GlassToolbarProps, GlassToolbarButtonProps, GlassToolbarSpacerProps } from "./toolbar.js";
13
- export { GlassTabs, GlassTabsRoot, GlassTabsList, GlassTabsIndicator, GlassTabsTrigger, GlassTabsContent } from "./tabs.js";
11
+ export { GlassToolbar, GlassToolbarButton, GlassToolbarLink, GlassToolbarGroup, GlassToolbarSpacer, } from "./toolbar.js";
12
+ export type { GlassToolbarProps, GlassToolbarButtonProps, GlassToolbarSpacerProps, } from "./toolbar.js";
13
+ export { GlassTabs, GlassTabsRoot, GlassTabsList, GlassTabsIndicator, GlassTabsTrigger, GlassTabsContent, } from "./tabs.js";
14
14
  export type { GlassTabsProps, GlassTabsListProps } from "./tabs.js";
15
15
  export { GlassMenu, GlassMenuTrigger, GlassMenuContent, GlassMenuItem, GlassMenuGroup, GlassMenuGroupLabel, GlassMenuSeparator, GlassMenuCheckboxItem, GlassMenuRadioGroup, GlassMenuRadioItem, GlassMenuSubmenu, GlassMenuSubmenuTrigger, GlassMenuSubmenuContent, } from "./menu.js";
16
16
  export type { GlassMenuContentProps } from "./menu.js";
17
17
  export { GlassProgressiveBlur, GlassScrollEdges } from "./progressive.js";
18
18
  export type { GlassProgressiveBlurProps, GlassScrollEdgesProps } from "./progressive.js";
19
- export { GlassSlider, GlassSwitch } from "./value-controls.js";
20
- export type { GlassSliderProps, GlassSwitchProps } from "./value-controls.js";
19
+ export { GlassSlider } from "./slider.js";
20
+ export { GlassSwitch } from "./switch.js";
21
+ export { GlassColorPicker } from "./color-picker.js";
22
+ export type { GlassColorPickerProps } from "./color-picker.js";
23
+ export type { GlassSliderProps } from "./slider.js";
24
+ export type { GlassSwitchProps } from "./switch.js";
@@ -7,7 +7,7 @@ export declare function GlassMenuTrigger<Payload>({ ref, ...props }: Menu.Trigge
7
7
  ref?: Ref<HTMLElement>;
8
8
  }): import("react").JSX.Element;
9
9
  export declare function GlassMenuSubmenu(props: Menu.SubmenuRoot.Props): import("react").JSX.Element;
10
- export declare function GlassMenuSubmenuTrigger({ ref, delay, onPointerEnter, onPointerLeave, onFocus, onBlur, ...props }: ComponentPropsWithRef<typeof Menu.SubmenuTrigger>): import("react").JSX.Element;
10
+ export declare function GlassMenuSubmenuTrigger({ ref, delay, ...props }: ComponentPropsWithRef<typeof Menu.SubmenuTrigger>): import("react").JSX.Element;
11
11
  export declare const GlassMenuGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
12
12
  export declare function GlassMenuGroupLabel(props: ComponentPropsWithRef<typeof Menu.GroupLabel>): import("react").JSX.Element;
13
13
  export declare const GlassMenuSeparator: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/separator").SeparatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -15,15 +15,14 @@ export declare function GlassMenuCheckboxItem(props: ComponentPropsWithRef<typeo
15
15
  export declare const GlassMenuRadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react/menu").MenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
16
16
  export declare function GlassMenuRadioItem(props: ComponentPropsWithRef<typeof Menu.RadioItem>): import("react").JSX.Element;
17
17
  type GlassMenuPositioningProps = Pick<ComponentPropsWithRef<typeof Menu.Positioner>, "side" | "align" | "sideOffset" | "alignOffset" | "collisionAvoidance">;
18
- export interface GlassMenuContentProps extends GlassMenuPositioningProps, Omit<ComponentPropsWithRef<typeof Menu.Popup>, "className" | "style">, MaterialOptions, Pick<GlassMotionProps, "interactive" | "motion" | "morph" | "neck"> {
18
+ export interface GlassMenuContentProps extends GlassMenuPositioningProps, Omit<ComponentPropsWithRef<typeof Menu.Popup>, "className" | "style">, MaterialOptions, Pick<GlassMotionProps, "interactive" | "motion"> {
19
19
  className?: string;
20
20
  style?: CSSProperties;
21
21
  positionerProps?: Omit<ComponentPropsWithRef<typeof Menu.Positioner>, "children">;
22
22
  portalProps?: Omit<ComponentPropsWithRef<typeof Menu.Portal>, "children" | "container">;
23
23
  }
24
- export declare function GlassMenuContent({ children, className, style, material, appearance, radius, refraction, tint, interactive, motion, morph, neck, side, align, sideOffset, alignOffset, collisionAvoidance, positionerProps, portalProps, ...props }: GlassMenuContentProps): import("react").JSX.Element;
24
+ export declare function GlassMenuContent({ children, className, style, material, appearance, radius, refraction, tint, specular, frost, interactive, motion, side, align, sideOffset, alignOffset, collisionAvoidance, positionerProps, portalProps, ...props }: GlassMenuContentProps): import("react").JSX.Element;
25
25
  export declare function GlassMenuItem(props: ComponentPropsWithRef<typeof Menu.Item>): import("react").JSX.Element;
26
- /** Submenus fade beside their parent. Moving between siblings morphs the
27
- * existing panel into the next panel's position and size. */
26
+ /** Submenus open beside their parent item. */
28
27
  export declare function GlassMenuSubmenuContent(props: GlassMenuContentProps): import("react").JSX.Element;
29
28
  export {};
@@ -12,4 +12,4 @@ export interface GlassScrollEdgesProps extends Omit<ProgressiveBlurOptions, "edg
12
12
  }
13
13
  /** Filters only the target scrollport. Place floating controls outside that
14
14
  * element to keep them sharp; no extra viewport wrapper is required. */
15
- export declare function GlassScrollEdges({ target, edges, size, blur, refraction, disabled }: GlassScrollEdgesProps): null;
15
+ export declare function GlassScrollEdges({ target, edges, size, blur, refraction, disabled, }: GlassScrollEdgesProps): null;
@@ -8,6 +8,8 @@ interface SceneContextValue {
8
8
  maxSurfaces: number;
9
9
  material: MaterialOptions["material"];
10
10
  appearance: MaterialOptions["appearance"];
11
+ specular: boolean;
12
+ frost: number;
11
13
  motion: GlassMotion;
12
14
  }
13
15
  /** The motion level a glass component inherits from its scene. */
@@ -21,12 +23,12 @@ export interface GlassForegroundProps extends HTMLAttributes<HTMLElement> {
21
23
  }
22
24
  /** Content above the backdrop that refracts through higher glass surfaces. */
23
25
  export declare function GlassForeground({ render, ref, ...props }: GlassForegroundProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
24
- export interface GlassSceneProps extends ComponentPropsWithRef<"div">, GlassSceneOptions, Pick<MaterialOptions, "material" | "appearance"> {
26
+ export interface GlassSceneProps extends ComponentPropsWithRef<"div">, GlassSceneOptions, Pick<MaterialOptions, "material" | "appearance" | "specular" | "frost"> {
25
27
  /** Motion for every glass component in the scene. `full` still follows the
26
28
  * system reduced-motion setting, which removes elasticity and travel. */
27
29
  motion?: GlassMotion;
28
30
  }
29
- export declare function GlassScene({ children, className, onDiagnostic, maxSurfaces, ref, material, appearance, motion, ...props }: GlassSceneProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
31
+ export declare function GlassScene({ children, className, onDiagnostic, maxSurfaces, ref, material, appearance, specular, frost, motion, ...props }: GlassSceneProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
30
32
  export interface GlassContentProps extends ComponentPropsWithRef<"div"> {
31
33
  /** Flow determines scene height; scroll is a native scrollport filling the scene. */
32
34
  layout?: "overlay" | "flow" | "scroll";
@@ -1,6 +1,6 @@
1
1
  import type { HTMLAttributes, Ref, RefObject } from "react";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
- import type { GlassRadius } from "../core/shape.js";
3
+ import type { GlassRadius } from "../core/corner-options.js";
4
4
  import type { ConcentricOptions, CornerOptions } from "../dom/shape-layout.js";
5
5
  export interface GlassShapeProps extends HTMLAttributes<HTMLElement> {
6
6
  radius?: GlassRadius;
@@ -10,6 +10,16 @@ export interface GlassShapeProps extends HTMLAttributes<HTMLElement> {
10
10
  concentric?: boolean | ConcentricOptions;
11
11
  container?: RefObject<HTMLElement | null>;
12
12
  }
13
+ export interface GlassRowProps extends Omit<GlassShapeProps, "concentric" | "container" | "radius"> {
14
+ /** Room between the row's content and the curve of the corner it nears. Default: 8. */
15
+ contentPadding?: number;
16
+ }
17
+ /**
18
+ * A row in a glass panel, such as a menu's item, a select's option or a palette's result: where
19
+ * it nears the panel's corners it follows their curve moved inward (concentric), and its side
20
+ * padding keeps its content clear of that curve. Render any element as the row with `render`.
21
+ */
22
+ export declare function GlassRow({ contentPadding, ...props }: GlassRowProps): import("react").JSX.Element;
13
23
  export declare function GlassShape({ concentric, container, ...props }: GlassShapeProps): import("react").JSX.Element;
14
24
  /** Declare an unclipped layout boundary for sibling content and overlays. */
15
25
  export declare function GlassShapeContainer({ radius, render, ref, ...props }: Omit<GlassShapeProps, "concentric" | "container">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,14 @@
1
+ import type { ComponentPropsWithRef, CSSProperties } from "react";
2
+ import { Slider } from "@base-ui/react/slider";
3
+ import type { ControlMotionOptions } from "../dom/control-motion.js";
4
+ import type { MaterialOptions } from "../core/materials.js";
5
+ export interface GlassSliderProps extends Omit<Slider.Root.Props<number>, "className" | "style" | "children">, MaterialOptions, ControlMotionOptions {
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ /** Visible marks at each step. Limited to 101 marks. */
9
+ ticks?: boolean;
10
+ /** Props and accessible name forwarded to the slider input. */
11
+ thumbProps?: Omit<ComponentPropsWithRef<typeof Slider.Thumb>, "render" | "children" | "disabled">;
12
+ }
13
+ /** Single-value slider; use a small numeric step for continuous pointer travel. */
14
+ export declare function GlassSlider({ material, appearance, tint, refraction, specular, radius, motion, interactive, className, style, ticks, min, max, step, thumbProps, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }: GlassSliderProps): import("react").JSX.Element;
@@ -1,29 +1,12 @@
1
- import type { HTMLAttributes, Ref, RefObject } from "react";
1
+ import type { HTMLAttributes, Ref } from "react";
2
2
  import { useRender } from "@base-ui/react/use-render";
3
- import type { GlassMotion, GlassMorph } from "../dom/index.js";
3
+ import type { GlassMotion } from "../dom/index.js";
4
4
  import type { MaterialOptions } from "../core/materials.js";
5
5
  /** How a glass surface moves. Every option is available to any surface. */
6
6
  export interface GlassMotionProps {
7
- /** Respond to touch and pointer input: grow under a press, stretch toward a
8
- * drag, settle with overshoot on release, and light up beneath the pointer. */
7
+ /** Respond to touch and pointer input as macOS glass does: grow 2.5 points
8
+ * under a press, light up beneath the pointer, and settle back on release. */
9
9
  interactive?: boolean;
10
- /** Grow out of this element when mounted, and shrink back into it when a
11
- * Base UI popup closes. */
12
- morphFrom?: RefObject<Element | null> | (() => Element | null | undefined);
13
- /** How the surface relates to the glass it grows from. `become`: the
14
- * source's glass is this surface; its content withdraws while the surface
15
- * is present. `detach`: the surface leaves the source's glass as a drop,
16
- * joined by a liquid neck until they part. Default: a glass source is
17
- * become; a source inside glass, such as a toolbar button, is detached from. */
18
- morph?: GlassMorph;
19
- /** How far a detaching surface stays joined to its glass by a liquid neck,
20
- * in pixels. `0` grows a plain shape with no union. Default: 18. */
21
- neck?: number;
22
- /** Grow out of `morphFrom` when mounted. `false` keeps only the exit, for
23
- * an element that is already in place. Default: true. */
24
- morphEnter?: boolean;
25
- /** Spring the glass outline when the surface's layout box changes. */
26
- fluid?: boolean;
27
10
  /** Override the scene's motion level for this surface. */
28
11
  motion?: GlassMotion;
29
12
  }
@@ -32,4 +15,10 @@ export interface GlassSurfaceProps extends HTMLAttributes<HTMLElement>, Material
32
15
  ref?: Ref<HTMLElement>;
33
16
  }
34
17
  /** Pass a shadcn component with render={<Button/>}; geometry follows its real DOM. */
35
- export declare function GlassSurface({ material, appearance, radius, concentric, refraction, tint, interactive, morphFrom, morph, neck, morphEnter, fluid, motion, render, ref, children, className, style, ...props }: GlassSurfaceProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
18
+ export declare function GlassSurface(props: GlassSurfaceProps): import("react").JSX.Element;
19
+ /**
20
+ * Glass that opens over the page: a menu, a dialog, a popover. Its contents stay hidden until its
21
+ * glass is drawn, so it never shows as text without glass, and its scene rises above sibling
22
+ * scenes while it is open.
23
+ */
24
+ export declare function GlassPopupSurface(props: GlassSurfaceProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { ComponentPropsWithRef, CSSProperties } from "react";
2
+ import { Switch } from "@base-ui/react/switch";
3
+ import type { ControlMotionOptions } from "../dom/control-motion.js";
4
+ import type { MaterialOptions } from "../core/materials.js";
5
+ export interface GlassSwitchProps extends Omit<ComponentPropsWithRef<typeof Switch.Root>, "className" | "style" | "children" | "render" | "nativeButton">, MaterialOptions, ControlMotionOptions {
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ }
9
+ export declare function GlassSwitch({ material, appearance, tint, refraction, specular, radius, motion, interactive, className, style, ...props }: GlassSwitchProps): import("react").JSX.Element;
@@ -9,8 +9,8 @@ export interface GlassTabsListProps extends Omit<ComponentPropsWithRef<typeof Ta
9
9
  style?: CSSProperties;
10
10
  size?: "default" | "sm" | "lg";
11
11
  }
12
- export declare function GlassTabsList({ material, appearance, radius, refraction, tint, interactive, motion, size, className, style, children, ...props }: GlassTabsListProps): import("react").JSX.Element;
13
- export declare function GlassTabsIndicator({ material, appearance, radius, refraction, tint, motion, className, style, ref, ...props }: Omit<ComponentPropsWithRef<typeof Tabs.Indicator>, "className" | "style"> & MaterialOptions & Pick<GlassMotionProps, "motion"> & {
12
+ export declare function GlassTabsList({ material, appearance, radius, refraction, tint, specular, frost, interactive, motion, size, className, style, children, ...props }: GlassTabsListProps): import("react").JSX.Element;
13
+ export declare function GlassTabsIndicator({ material, appearance, radius, refraction, tint, specular, frost, motion, className, style, ref, ...props }: Omit<ComponentPropsWithRef<typeof Tabs.Indicator>, "className" | "style"> & MaterialOptions & Pick<GlassMotionProps, "motion"> & {
14
14
  className?: string;
15
15
  style?: CSSProperties;
16
16
  }): import("react").JSX.Element;
@@ -26,4 +26,4 @@ export interface GlassTabsProps extends Omit<ComponentPropsWithRef<typeof Tabs.R
26
26
  style?: CSSProperties;
27
27
  size?: "default" | "sm" | "lg";
28
28
  }
29
- export declare function GlassTabs({ items, defaultValue, material, appearance, radius, refraction, tint, interactive, motion, size, className, "aria-label": label, ...props }: GlassTabsProps): import("react").JSX.Element;
29
+ export declare function GlassTabs({ items, defaultValue, material, appearance, radius, refraction, tint, specular, frost, interactive, motion, size, className, "aria-label": label, ...props }: GlassTabsProps): import("react").JSX.Element;
@@ -6,7 +6,7 @@ export interface GlassToolbarProps extends Omit<ComponentPropsWithRef<typeof Too
6
6
  className?: string;
7
7
  style?: CSSProperties;
8
8
  }
9
- export declare function GlassToolbar({ material, appearance, radius, refraction, tint, interactive, motion, className, style, children, ...props }: GlassToolbarProps): import("react").JSX.Element;
9
+ export declare function GlassToolbar({ material, appearance, radius, refraction, tint, specular, frost, interactive, motion, className, style, children, ...props }: GlassToolbarProps): import("react").JSX.Element;
10
10
  export interface GlassToolbarButtonProps extends ComponentPropsWithRef<typeof Toolbar.Button> {
11
11
  /** Icon controls remain square; default controls fit their text. */
12
12
  size?: "icon" | "default";
package/package.json CHANGED
@@ -1,12 +1,34 @@
1
1
  {
2
2
  "name": "@glass-sdk/liquid-glass",
3
- "version": "0.0.2",
4
- "type": "module",
3
+ "version": "0.0.3-beta.1",
4
+ "description": "Liquid Glass materials and accessible React components for the web and Electron, built with vgpu and WGSL.",
5
+ "keywords": [
6
+ "electron",
7
+ "liquid-glass",
8
+ "react",
9
+ "refraction",
10
+ "vgpu",
11
+ "webgpu"
12
+ ],
13
+ "homepage": "https://liquid-glass.glassapp.dev",
14
+ "bugs": {
15
+ "url": "https://github.com/Glass-HQ/liquid-glass/issues"
16
+ },
5
17
  "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Glass-HQ/liquid-glass.git",
21
+ "directory": "packages/liquid-glass"
22
+ },
6
23
  "files": [
7
24
  "dist",
8
25
  "README.md",
9
- "LICENSE"
26
+ "LICENSE",
27
+ "CHANGELOG.md"
28
+ ],
29
+ "type": "module",
30
+ "sideEffects": [
31
+ "**/*.css"
10
32
  ],
11
33
  "exports": {
12
34
  ".": {
@@ -30,53 +52,37 @@
30
52
  "default": "./dist/styles.css"
31
53
  }
32
54
  },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
33
58
  "scripts": {
34
- "build": "vite build && tsc -p tsconfig.json && cp src/styles.css dist/styles.css && cp src/styles.d.css.ts dist/styles.d.css.ts",
35
- "typecheck": "tsc -p tsconfig.json --noEmit --emitDeclarationOnly false",
36
- "dev": "vite build --watch --emptyOutDir false",
37
- "prepack": "bun run build",
38
- "prepublishOnly": "node scripts/check-version.mjs"
59
+ "build": "vp build && tsc -p tsconfig.build.json && cp src/styles.css dist/styles.css && cp src/styles.d.css.ts dist/styles.d.css.ts",
60
+ "dev": "vp build --watch --emptyOutDir false",
61
+ "test": "bun test",
62
+ "check:size": "node scripts/check-size.mjs"
39
63
  },
40
64
  "dependencies": {
41
- "@base-ui/react": "^1.8.0",
42
- "@lisse/core": "^0.7.2",
43
- "vgpu": "^0.5.0"
65
+ "@lisse/core": "^0.7.3",
66
+ "vgpu": "^0.6.0"
44
67
  },
45
68
  "devDependencies": {
69
+ "@base-ui/react": "^1.9.0",
70
+ "@types/bun": "^1.4.4",
71
+ "@types/pngjs": "^6.0.5",
46
72
  "@types/react": "^19.3.0",
47
73
  "@types/react-dom": "^19.3.0",
48
- "@vgpu/wgsl": "^0.5.0",
74
+ "@vgpu/wgsl": "^0.6.0",
75
+ "esbuild": "^0.28.2",
76
+ "pngjs": "^7.0.0",
77
+ "react": "^19.3.1",
78
+ "react-dom": "^19.3.1",
49
79
  "typescript": "^7.0.2",
50
- "vite": "^8.3.2",
51
- "react": "^19.3.0",
52
- "react-dom": "^19.3.0"
80
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
81
+ "vite-plus": "1.7.0"
53
82
  },
54
83
  "peerDependencies": {
84
+ "@base-ui/react": "^1.9.0",
55
85
  "react": ">=19.0.0",
56
86
  "react-dom": ">=19.0.0"
57
- },
58
- "description": "Liquid Glass materials and accessible React components for the web and Electron, built with vgpu and WGSL.",
59
- "homepage": "https://liquid-glass.glassapp.dev",
60
- "repository": {
61
- "type": "git",
62
- "url": "git+https://github.com/Glass-HQ/liquid-glass.git",
63
- "directory": "packages/liquid-glass"
64
- },
65
- "bugs": {
66
- "url": "https://github.com/Glass-HQ/liquid-glass/issues"
67
- },
68
- "publishConfig": {
69
- "access": "public"
70
- },
71
- "sideEffects": [
72
- "**/*.css"
73
- ],
74
- "keywords": [
75
- "liquid-glass",
76
- "vgpu",
77
- "webgpu",
78
- "react",
79
- "electron",
80
- "refraction"
81
- ]
87
+ }
82
88
  }
@@ -1,206 +0,0 @@
1
- import { smoothUnion as e } from "./union.js";
2
- //#region src/core/morph-path.ts
3
- var t = (e, t, n) => e + (t - e) * n;
4
- function n(e, t, n) {
5
- let r = Math.min(1, Math.max(0, (n - e) / (t - e)));
6
- return r * r * (3 - 2 * r);
7
- }
8
- function r(e, t, n) {
9
- let r = Math.min(t, n) / 2;
10
- if (e === "capsule" || e === "circle") return r;
11
- let i = Number(e);
12
- return Math.max(0, Math.min(Number.isFinite(i) ? i : 8, r));
13
- }
14
- function i(e, t) {
15
- let n = r(e.radius, e.width, e.height), i = r(t.radius, t.width, t.height);
16
- return Math.abs(Math.log(e.width / t.width)) + Math.abs(Math.log(e.height / t.height)) + Math.abs(n - i) / Math.max(4, Math.min(t.width, t.height) / 2);
17
- }
18
- var a = (e, t) => Math.hypot(Math.max(0, e.left - (t.left + t.width), t.left - (e.left + e.width)), Math.max(0, e.top - (t.top + t.height), t.top - (e.top + e.height))), o = (e, t, n = .5) => t.left >= e.left - n && t.top >= e.top - n && t.left + t.width <= e.left + e.width + n && t.top + t.height <= e.top + e.height + n;
19
- function s(e, t) {
20
- let n = t.top >= e.top + e.height - .5 || t.top + t.height <= e.top + .5;
21
- return n === (t.left >= e.left + e.width - .5 || t.left + t.width <= e.left + .5) ? Math.abs(t.left + t.width / 2 - e.left - e.width / 2) / Math.max(1, t.width) > Math.abs(t.top + t.height / 2 - e.top - e.height / 2) / Math.max(1, t.height) ? "x" : "y" : n ? "y" : "x";
22
- }
23
- function c(e, t, n) {
24
- if (!n || e >= 1) return e;
25
- let r = Math.max(0, e);
26
- return t ? 1 - (1 - r) ** 1.6 : r ** 1.4;
27
- }
28
- function l(e, i) {
29
- let a = e.along !== void 0, o = c(i, e.along === "x", a), s = c(i, e.along === "y", a), l = Math.max(1, t(e.from.width, e.to.width, o)), u = Math.max(1, t(e.from.height, e.to.height, s)), d = t(e.from.left + e.from.width / 2, e.to.left + e.to.width / 2, o), f = t(e.from.top + e.from.height / 2, e.to.top + e.to.height / 2, s), p = Math.min(l, u) / 2, m = Math.min(1, Math.max(0, i)), h = r(e.fromRadius, e.from.width, e.from.height), g = t(h, r(e.toRadius, l, u), m), _ = Math.min(p, Math.max(g, .34 * Math.min(l, u))), v = .12 * (1 - h / Math.max(1, Math.min(e.from.width, e.from.height) / 2)), y = a ? (v > 0 ? n(0, v, m) : 1) * (1 - n(.35, .8, m)) : 0, b = Math.min(p, t(g, _, y));
30
- return {
31
- left: d - l / 2,
32
- top: f - u / 2,
33
- width: l,
34
- height: u,
35
- radius: b
36
- };
37
- }
38
- var u = (e) => n(.4, .9, e), d = (e) => n(.02, .3, e), f = (e, t) => t * (1 - n(.3, .95, e)), p = (e, t) => Math.round(e / t) * t, m = /* @__PURE__ */ new Map();
39
- function h(e, t, n = {}) {
40
- if (!t) return g(e, t, n);
41
- let r = (e) => ({
42
- ...e,
43
- left: Number((e.left - t.left).toFixed(8)),
44
- top: Number((e.top - t.top).toFixed(8))
45
- }), i = {
46
- ...e,
47
- from: r(e.from),
48
- to: r(e.to)
49
- }, a = {
50
- ...t,
51
- left: 0,
52
- top: 0
53
- }, o = JSON.stringify([
54
- i,
55
- a,
56
- n
57
- ]), s = m.get(o);
58
- return s ? m.delete(o) : s = g(i, a, n), m.set(o, s), m.size > 16 && m.delete(m.keys().next().value), s.map((e) => ({
59
- ...e,
60
- shape: { ...e.shape },
61
- ...e.box ? { box: {
62
- ...e.box,
63
- left: e.box.left + t.left,
64
- top: e.box.top + t.top
65
- } } : {}
66
- }));
67
- }
68
- function g(n, s, c) {
69
- let { stops: u = 14, unions: d = 16, neck: m = 18, dpr: h = 1, restDpr: g = h } = c, _ = Array.from({ length: 241 }, (e, t) => l(n, t / 240)), v = (e, t, n) => {
70
- let r = n ? t.width : Math.max(1, Math.round(t.width)), i = n ? t.height : Math.max(1, Math.round(t.height)), a = p(Math.min(t.radius, r / 2, i / 2), .5);
71
- return {
72
- p: e,
73
- shape: {
74
- width: r,
75
- height: i,
76
- radius: a >= Math.min(r, i) / 2 - .25 ? "capsule" : a,
77
- dpr: h
78
- },
79
- absorbs: !1
80
- };
81
- }, y = [], b = [0];
82
- for (let e = 1; e <= 240; e++) b.push(b[e - 1] + i(_[e], _[e - 1]));
83
- let x = b[240], S = 1;
84
- for (let e = 1; e < 240 && x > 0; e++) b[e] >= x * S / (u - 1) && S < u - 1 && (y.push(v(e / 240, _[e], !1)), S++);
85
- let C = {
86
- p: 0,
87
- shape: {
88
- width: n.from.width,
89
- height: n.from.height,
90
- radius: n.fromRadius,
91
- dpr: g,
92
- resting: !0
93
- },
94
- absorbs: !1
95
- }, w = {
96
- p: 1,
97
- shape: {
98
- width: n.to.width,
99
- height: n.to.height,
100
- radius: n.toRadius,
101
- dpr: g,
102
- resting: !0
103
- },
104
- absorbs: !1
105
- };
106
- if (!s) return [
107
- C,
108
- ...y,
109
- w
110
- ];
111
- let T = {
112
- x: s.left,
113
- y: s.top,
114
- width: s.width,
115
- height: s.height,
116
- radius: r(s.radius, s.width, s.height)
117
- }, E = (e) => {
118
- let t = _[e], n = f(e / 240, m);
119
- return !o(s, t) && n >= 1 && a(s, t) <= n;
120
- }, D = -1, O = -1;
121
- for (let e = 0; e <= 240; e++) {
122
- if (!E(e)) {
123
- if (D >= 0) break;
124
- continue;
125
- }
126
- D < 0 && (D = e), O = e;
127
- }
128
- if (D < 0) return [
129
- C,
130
- ...y,
131
- w
132
- ];
133
- let k = {
134
- p: Math.max(0, D - 1) / 240,
135
- shape: {
136
- width: s.layoutWidth,
137
- height: s.layoutHeight,
138
- radius: s.radius,
139
- dpr: g,
140
- resting: !0
141
- },
142
- box: { ...s },
143
- absorbs: !0
144
- }, A = Math.max(2, Math.min(d, Math.ceil((O - D) / 240 / .025) + 1)), j = [];
145
- for (let n = 0; n < A; n++) {
146
- let r = Math.round(t(D, O, n / (A - 1))), i = _[r], a = r / 240, o = e([T, {
147
- x: i.left,
148
- y: i.top,
149
- width: i.width,
150
- height: i.height,
151
- radius: i.radius
152
- }], f(a, m), 1.5, 700);
153
- if (o.length !== 1) continue;
154
- let s = o[0], c = Math.floor(Math.min(...s.map(([e]) => e))), l = Math.floor(Math.min(...s.map(([, e]) => e))), u = Math.ceil(Math.max(...s.map(([e]) => e))), d = Math.ceil(Math.max(...s.map(([, e]) => e)));
155
- j.push({
156
- p: a,
157
- shape: {
158
- width: u - c,
159
- height: d - l,
160
- radius: 0,
161
- outline: s.map(([e, t]) => [e - c, t - l]),
162
- dpr: h
163
- },
164
- box: {
165
- left: c,
166
- top: l,
167
- width: u - c,
168
- height: d - l
169
- },
170
- absorbs: !0
171
- });
172
- }
173
- if (!j.length) return [
174
- C,
175
- ...y,
176
- w
177
- ];
178
- let M = v(Math.min(1, (O + 1) / 240), _[Math.min(240, O + 1)], !1), N = y.filter((e) => e.p > M.p);
179
- return [
180
- k,
181
- ...j,
182
- M,
183
- ...N,
184
- w
185
- ];
186
- }
187
- function _(e, t) {
188
- if (!e.length || t < e[0].p - 1e-9) return;
189
- let n = 0;
190
- for (; n + 1 < e.length && e[n + 1].p <= t;) n++;
191
- let r = e[n], i = e[n + 1];
192
- if (!i || i.p <= r.p) return {
193
- a: r,
194
- mix: 0,
195
- absorb: +!!r.absorbs
196
- };
197
- let a = Math.min(1, Math.max(0, (t - r.p) / (i.p - r.p)));
198
- return {
199
- a: r,
200
- b: i,
201
- mix: a,
202
- absorb: (r.absorbs ? 1 - a : 0) + (i.absorbs ? a : 0)
203
- };
204
- }
205
- //#endregion
206
- export { a as boxGap, u as contentReveal, t as mix, _ as morphDraw, l as morphShape, f as neckWidth, s as openingAxis, h as planMorph, r as radiusPixels, i as shapeDistance, n as smoothstep, d as sourceConceal };