@phreshos/react-ui 0.1.6 → 0.1.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/README.md CHANGED
@@ -94,13 +94,13 @@ texture:
94
94
  </Surface>
95
95
 
96
96
  <Surface color="strong" grain="large">...</Surface>
97
- <Surface color="#101114" grain={0.2} animation={8} backdrop={4} opacity={0.9}>...</Surface>
97
+ <Surface color="#101114" grain={0.2} grainAnimation={8} backdrop={4} opacity={0.9}>...</Surface>
98
98
  <Surface distortion={70} waves={8} ripples={4} saturation={1.4} brightness={1.04}>...</Surface>
99
99
  ```
100
100
 
101
101
  `color` resolves from `Theme.background`; its semantic levels derive from that
102
102
  same source and a direct color remains an explicit local override. `grain`,
103
- `grainAmount`, `animation`, `backdrop`, `opacity`, `distortion`, `waves`,
103
+ `grainAmount`, `grainAnimation`, `backdrop`, `opacity`, `distortion`, `waves`,
104
104
  `ripples`, `saturation`, and `brightness` resolve from `Theme.surface`, accept
105
105
  their semantic levels or direct values, and remain bounded by Core's Theme
106
106
  limits. Radius and foreground remain ordinary Theme styles. Grain intensity
@@ -1,5 +1,5 @@
1
1
  interface SurfaceMaterialProps {
2
- readonly animation: number;
2
+ readonly grainAnimation: number;
3
3
  readonly color: string;
4
4
  readonly distortion: number;
5
5
  readonly grain: number;
@@ -10,5 +10,5 @@ interface SurfaceMaterialProps {
10
10
  readonly waves: number;
11
11
  }
12
12
  /** The locally owned SVG paint layer inside one Surface. */
13
- export declare function SurfaceMaterial({ animation, color, distortion, grain, grainAmount, identity, opacity, ripples, waves }: SurfaceMaterialProps): import("react").JSX.Element | null;
13
+ export declare function SurfaceMaterial({ color, distortion, grain, grainAmount, grainAnimation, identity, opacity, ripples, waves }: SurfaceMaterialProps): import("react").JSX.Element | null;
14
14
  export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, useEffect, useMemo, useRef } from "react";
3
3
  /** The locally owned SVG paint layer inside one Surface. */
4
- export function SurfaceMaterial({ animation, color, distortion, grain, grainAmount, identity, opacity, ripples, waves }) {
4
+ export function SurfaceMaterial({ color, distortion, grain, grainAmount, grainAnimation, identity, opacity, ripples, waves }) {
5
5
  const seed = useMemo(() => seedFrom(identity), [identity]);
6
6
  const hasPaint = opacity > 0;
7
7
  const hasGrain = hasPaint && grain > 0 && grainAmount > 0;
@@ -11,14 +11,14 @@ export function SurfaceMaterial({ animation, color, distortion, grain, grainAmou
11
11
  const paths = useRef([]);
12
12
  useEffect(() => {
13
13
  paths.current.forEach((path, tone) => path?.setAttribute("d", initial[tone] ?? ""));
14
- if (animation === 0 || !hasGrain || !svg.current)
14
+ if (grainAnimation === 0 || !hasGrain || !svg.current)
15
15
  return;
16
16
  const paint = (frame) => {
17
17
  const values = grainPaths(seed, frame, grainAmount);
18
18
  paths.current.forEach((path, tone) => path?.setAttribute("d", values[tone] ?? ""));
19
19
  };
20
- return animate(svg.current, animation, paint);
21
- }, [animation, grainAmount, hasGrain, initial, seed]);
20
+ return animate(svg.current, grainAnimation, paint);
21
+ }, [grainAnimation, grainAmount, hasGrain, initial, seed]);
22
22
  if (!hasPaint && !hasDistortion)
23
23
  return null;
24
24
  return _jsxs("svg", { ref: svg, "data-surface-material": "", "aria-hidden": "true", focusable: "false", style: {
package/dist/surface.d.ts CHANGED
@@ -11,7 +11,7 @@ export type SurfaceProps = Omit<ComponentPropsWithoutRef<"div">, "color" | "opac
11
11
  /** Theme-derived level or direct retained grain amount from zero to one. */
12
12
  grainAmount?: ScaleLevel | number;
13
13
  /** Theme-derived level or direct grain changes per second from zero to 16. */
14
- animation?: ScaleLevel | number;
14
+ grainAnimation?: ScaleLevel | number;
15
15
  /** Theme-derived level or direct backdrop blur from zero to 24 CSS pixels. */
16
16
  backdrop?: ScaleLevel | number;
17
17
  /** Theme-derived level or direct material opacity from zero to one. */
@@ -36,7 +36,7 @@ export declare const Surface: import("react").ForwardRefExoticComponent<Omit<Omi
36
36
  /** Theme-derived level or direct retained grain amount from zero to one. */
37
37
  grainAmount?: ScaleLevel | number;
38
38
  /** Theme-derived level or direct grain changes per second from zero to 16. */
39
- animation?: ScaleLevel | number;
39
+ grainAnimation?: ScaleLevel | number;
40
40
  /** Theme-derived level or direct backdrop blur from zero to 24 CSS pixels. */
41
41
  backdrop?: ScaleLevel | number;
42
42
  /** Theme-derived level or direct material opacity from zero to one. */
package/dist/surface.js CHANGED
@@ -10,7 +10,7 @@ const layerStyle = {
10
10
  pointerEvents: "none"
11
11
  };
12
12
  /** Contains content above locally owned Surface material layers. */
13
- export const Surface = forwardRef(function Surface({ animation, backdrop, brightness, children, color, distortion, grain, grainAmount, opacity, ripples, saturation, style, waves, ...properties }, forwardedRef) {
13
+ export const Surface = forwardRef(function Surface({ backdrop, brightness, children, color, distortion, grain, grainAmount, grainAnimation, opacity, ripples, saturation, style, waves, ...properties }, forwardedRef) {
14
14
  const theme = useTheme();
15
15
  const identity = `phresh-surface-${useId().replaceAll(":", "")}`;
16
16
  const element = useRef(null);
@@ -21,7 +21,7 @@ export const Surface = forwardRef(function Surface({ animation, backdrop, bright
21
21
  else if (forwardedRef)
22
22
  forwardedRef.current = node;
23
23
  }, [forwardedRef]);
24
- const resolved = resolveSurface({ animation, backdrop, brightness, color, distortion, grain, grainAmount, opacity, ripples, saturation, waves }, theme);
24
+ const resolved = resolveSurface({ backdrop, brightness, color, distortion, grain, grainAmount, grainAnimation, opacity, ripples, saturation, waves }, theme);
25
25
  useLayoutEffect(() => {
26
26
  const surface = element.current;
27
27
  if (surface)
@@ -55,7 +55,7 @@ function BackdropLayer({ filter, name, zIndex }) {
55
55
  }
56
56
  function resolveSurface(values, theme) {
57
57
  const material = {
58
- animation: resolveScale(values.animation, theme.surface.animation, themeLimits.surface.animation),
58
+ grainAnimation: resolveScale(values.grainAnimation, theme.surface.grainAnimation, themeLimits.surface.grainAnimation),
59
59
  color: resolveColor(values.color, theme.background),
60
60
  distortion: resolveScale(values.distortion, theme.surface.distortion, themeLimits.surface.distortion),
61
61
  grain: resolveScale(values.grain, theme.surface.grain, themeLimits.surface.grain),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/react-ui",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "React components for coherent PhreshOS Program interfaces.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -52,7 +52,7 @@
52
52
  "prepack": "node --run test && node --run build"
53
53
  },
54
54
  "peerDependencies": {
55
- "@phreshos/core": "^0.1.13",
55
+ "@phreshos/core": "^0.1.15",
56
56
  "react": "^19.2.0",
57
57
  "react-dom": "^19.2.0"
58
58
  },
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@base-ui/react": "^1.7.0",
64
- "@phreshos/core": "^0.1.13",
64
+ "@phreshos/core": "^0.1.15",
65
65
  "@testing-library/dom": "^10.4.1",
66
66
  "@testing-library/react": "^16.3.0",
67
67
  "@testing-library/user-event": "^14.6.1",