@phreshos/react-ui 0.1.27 → 0.1.28
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 +10 -12
- package/dist/appearance-context.d.ts +5 -16
- package/dist/appearance-context.js +2 -2
- package/dist/appearance.d.ts +6 -0
- package/dist/appearance.js +11 -0
- package/dist/color.d.ts +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.js +1 -1
- package/dist/material-options.js +1 -1
- package/dist/motion-style.js +1 -1
- package/dist/preferences.d.ts +4 -0
- package/dist/preferences.js +0 -0
- package/dist/radius.d.ts +1 -1
- package/dist/shadow-options.js +1 -1
- package/dist/spacing.d.ts +1 -1
- package/dist/surface.js +4 -1
- package/dist/ui-provider.d.ts +2 -1
- package/dist/ui-provider.js +0 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@ Environment-neutral React components and the visual language of PhreshOS.
|
|
|
8
8
|
|
|
9
9
|
## Role
|
|
10
10
|
|
|
11
|
-
React UI
|
|
12
|
-
|
|
11
|
+
React UI owns reusable visual contracts that accept the corresponding PhreshOS
|
|
12
|
+
System values directly. The Desktop and Programs compose those primitives instead of
|
|
13
13
|
reimplementing material, spacing, color, radius, or interaction behavior.
|
|
14
14
|
|
|
15
15
|
The package does not depend on a Client or Server runtime and does not own
|
|
@@ -25,9 +25,8 @@ applications own composition.
|
|
|
25
25
|
| Bun | `bun add @phreshos/react-ui` |
|
|
26
26
|
| Yarn | `yarn add @phreshos/react-ui` |
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
runtime.
|
|
28
|
+
React and React DOM are peer dependencies because the application and React UI
|
|
29
|
+
must share one React runtime.
|
|
31
30
|
|
|
32
31
|
```tsx
|
|
33
32
|
import { Button, Surface } from "@phreshos/react-ui"
|
|
@@ -37,16 +36,16 @@ import { Button, Surface } from "@phreshos/react-ui"
|
|
|
37
36
|
</Surface>
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
Without a provider, components use
|
|
39
|
+
Without a provider, components use React UI's `defaultAppearance` and reactively
|
|
41
40
|
follow the browser's complete visual preferences. `UIProvider` supplies the
|
|
42
41
|
Appearance, Preferences, and direction explicitly established for a React UI
|
|
43
42
|
subtree. Each omitted property inherits independently from the nearest provider
|
|
44
43
|
or follows its own default resolution. A provider with no properties introduces
|
|
45
44
|
no boundary or behavior.
|
|
46
|
-
React UI also exports
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
React UI also exports `defaultAppearance` for callers that need the value
|
|
46
|
+
explicitly. A complete System Appearance can be passed directly; React UI uses
|
|
47
|
+
the visual fields it owns and ignores additional System fields such as
|
|
48
|
+
wallpapers.
|
|
50
49
|
|
|
51
50
|
React UI is neutral between left-to-right and right-to-left interfaces.
|
|
52
51
|
An explicit `UIProvider` direction creates a boundary that participates in
|
|
@@ -279,8 +278,7 @@ the committed dependency graph without local package substitutions.
|
|
|
279
278
|
|
|
280
279
|
## Related repositories
|
|
281
280
|
|
|
282
|
-
- [`@phreshos/core`](https://github.com/PhreshOS/core) owns
|
|
283
|
-
and the shared values interpreted here.
|
|
281
|
+
- [`@phreshos/core`](https://github.com/PhreshOS/core) owns the System contracts.
|
|
284
282
|
- [`@phreshos/react`](https://github.com/PhreshOS/react) owns runtime-neutral
|
|
285
283
|
React state adaptation.
|
|
286
284
|
- [PhreshOS System](https://github.com/PhreshOS/system) composes the visual
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import { type Appearance, type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
shadow: ThemedValue<import("@phreshos/core").AppearanceShadow>;
|
|
7
|
-
material: ThemedValue<import("@phreshos/core").AppearanceMaterial>;
|
|
8
|
-
transaction: import("@phreshos/core").AppearanceTransaction;
|
|
9
|
-
signInWallpaper: ThemedValue<string | null>;
|
|
10
|
-
desktopWallpaper: ThemedValue<string | null>;
|
|
11
|
-
}>>;
|
|
12
|
-
export declare const PreferencesContext: import("react").Context<Readonly<{
|
|
13
|
-
theme: import("@phreshos/core").Theme;
|
|
14
|
-
animations: boolean;
|
|
15
|
-
}> | null>;
|
|
16
|
-
/** Returns the nearest unresolved Appearance, or Core's complete default. */
|
|
1
|
+
import { type Appearance, type ThemedValue } from "./appearance.js";
|
|
2
|
+
import type { Preferences } from "./preferences.js";
|
|
3
|
+
export declare const AppearanceContext: import("react").Context<Appearance>;
|
|
4
|
+
export declare const PreferencesContext: import("react").Context<Preferences | null>;
|
|
5
|
+
/** Returns the nearest unresolved appearance, or React UI's default. */
|
|
17
6
|
export declare function useAppearance(): Appearance;
|
|
18
7
|
/** Returns the nearest complete Preferences, or reactively follows the browser. */
|
|
19
8
|
export declare function usePreferences(): Preferences;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext, useMemo, useSyncExternalStore } from "react";
|
|
2
|
-
import { defaultAppearance } from "
|
|
2
|
+
import { defaultAppearance } from "./appearance.js";
|
|
3
3
|
export const AppearanceContext = createContext(defaultAppearance);
|
|
4
4
|
export const PreferencesContext = createContext(null);
|
|
5
|
-
/** Returns the nearest unresolved
|
|
5
|
+
/** Returns the nearest unresolved appearance, or React UI's default. */
|
|
6
6
|
export function useAppearance() {
|
|
7
7
|
return useContext(AppearanceContext);
|
|
8
8
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { appearanceLimits, type Appearance as SystemAppearance, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceRange, type AppearanceShadow, type AppearanceTransaction, type Easing, type ThemedValue } from "@phreshos/core";
|
|
2
|
+
/** Complete visual input consumed by React UI. */
|
|
3
|
+
export type Appearance = Pick<SystemAppearance, "colors" | "spacing" | "radius" | "shadow" | "material" | "transaction">;
|
|
4
|
+
export { appearanceLimits, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceRange, type AppearanceShadow, type AppearanceTransaction, type Easing, type ThemedValue };
|
|
5
|
+
/** React UI's default visual input, derived from the System default. */
|
|
6
|
+
export declare const defaultAppearance: Appearance;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { appearanceLimits, defaultAppearance as systemDefaultAppearance } from "@phreshos/core";
|
|
2
|
+
export { appearanceLimits };
|
|
3
|
+
/** React UI's default visual input, derived from the System default. */
|
|
4
|
+
export const defaultAppearance = Object.freeze({
|
|
5
|
+
colors: systemDefaultAppearance.colors,
|
|
6
|
+
spacing: systemDefaultAppearance.spacing,
|
|
7
|
+
radius: systemDefaultAppearance.radius,
|
|
8
|
+
shadow: systemDefaultAppearance.shadow,
|
|
9
|
+
material: systemDefaultAppearance.material,
|
|
10
|
+
transaction: systemDefaultAppearance.transaction
|
|
11
|
+
});
|
package/dist/color.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppearanceColor } from "
|
|
1
|
+
import type { AppearanceColor } from "./appearance.js";
|
|
2
2
|
/** A visual treatment derived from one concrete CSS color. */
|
|
3
3
|
export type ColorLevel = "subtle" | "soft" | "base" | "strong" | "intense";
|
|
4
4
|
/** Every visual treatment derived from one concrete CSS color. */
|
package/dist/layout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
-
import type { Appearance } from "
|
|
2
|
+
import type { Appearance } from "./appearance.js";
|
|
3
3
|
import { type Spacing } from "./spacing.js";
|
|
4
4
|
/** Cross-axis alignment shared by layout containers. */
|
|
5
5
|
export type LayoutAlignment = "start" | "center" | "end" | "stretch" | "baseline";
|
package/dist/main.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Components enter this surface only after their implementation-independent
|
|
5
5
|
* behavior contract has been established by the package's tests.
|
|
6
6
|
*/
|
|
7
|
-
export { defaultAppearance } from "
|
|
7
|
+
export { defaultAppearance, type Appearance, type AppearanceColor, type AppearanceColors, type AppearanceMaterial, type AppearanceShadow, type AppearanceTransaction, type Easing, type ThemedValue } from "./appearance.js";
|
|
8
8
|
export { UIProvider, useAppearance, useBrowserPreferences, useDirection, useDocumentDirection, usePreferences, useThemedValue, type UIProviderProps } from "./ui-provider.js";
|
|
9
|
-
export type {
|
|
9
|
+
export type { Preferences, Theme } from "./preferences.js";
|
|
10
10
|
export type { Direction } from "./direction.js";
|
|
11
11
|
export { Flex, type FlexProps } from "./flex.js";
|
|
12
12
|
export { Grid, type GridProps } from "./grid.js";
|
package/dist/main.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Components enter this surface only after their implementation-independent
|
|
5
5
|
* behavior contract has been established by the package's tests.
|
|
6
6
|
*/
|
|
7
|
-
export { defaultAppearance } from "
|
|
7
|
+
export { defaultAppearance } from "./appearance.js";
|
|
8
8
|
export { UIProvider, useAppearance, useBrowserPreferences, useDirection, useDocumentDirection, usePreferences, useThemedValue } from "./ui-provider.js";
|
|
9
9
|
export { Flex } from "./flex.js";
|
|
10
10
|
export { Grid } from "./grid.js";
|
package/dist/material-options.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { appearanceLimits } from "
|
|
1
|
+
import { appearanceLimits } from "./appearance.js";
|
|
2
2
|
import { useAppearance, useThemedValue } from "./ui-provider.js";
|
|
3
3
|
import { isScaleLevel, scale, scaleMultiplier } from "./scale.js";
|
|
4
4
|
/** Resolves material values from the current Appearance without knowing any host geometry. */
|
package/dist/motion-style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { defaultAppearance } from "
|
|
2
|
+
import { defaultAppearance } from "./appearance.js";
|
|
3
3
|
import { useAppearance, usePreferences } from "./appearance-context.js";
|
|
4
4
|
const visualProperties = "background-color, color, border-color, border-radius, box-shadow";
|
|
5
5
|
const paintProperties = "fill, stroke, opacity";
|
|
File without changes
|
package/dist/radius.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
-
import type { Appearance } from "
|
|
2
|
+
import type { Appearance } from "./appearance.js";
|
|
3
3
|
import { type ScaleLevel } from "./scale.js";
|
|
4
4
|
/** An Appearance-derived level, fully rounded shape, pixel value, or explicit CSS corner radius. */
|
|
5
5
|
export type Radius = ScaleLevel | "full" | number | (string & {});
|
package/dist/shadow-options.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { appearanceLimits } from "
|
|
1
|
+
import { appearanceLimits } from "./appearance.js";
|
|
2
2
|
import { useAppearance, useThemedValue } from "./ui-provider.js";
|
|
3
3
|
import { isScaleLevel, scale } from "./scale.js";
|
|
4
4
|
/** Resolves shadow values from the active Appearance branch. */
|
package/dist/spacing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
-
import type { Appearance } from "
|
|
2
|
+
import type { Appearance } from "./appearance.js";
|
|
3
3
|
import { type ScaleLevel } from "./scale.js";
|
|
4
4
|
/** An Appearance-derived level, pixel value, or explicit CSS spacing value. */
|
|
5
5
|
export type Spacing = ScaleLevel | number | (string & {});
|
package/dist/surface.js
CHANGED
|
@@ -49,7 +49,10 @@ const layerStyle = {
|
|
|
49
49
|
pointerEvents: "none"
|
|
50
50
|
};
|
|
51
51
|
function SurfaceLayers({ material }) {
|
|
52
|
-
const
|
|
52
|
+
const filtersVisible = material.opacity < 1;
|
|
53
|
+
const backdrop = filtersVisible ? material.backdrop : 0;
|
|
54
|
+
const saturation = filtersVisible ? material.saturation : 1;
|
|
55
|
+
const distortion = filtersVisible ? material.distortion : 0;
|
|
53
56
|
const frost = [
|
|
54
57
|
backdrop === 0 ? "" : `blur(${backdrop}px)`,
|
|
55
58
|
saturation === 1 ? "" : `saturate(${saturation})`
|
package/dist/ui-provider.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { Appearance } from "./appearance.js";
|
|
3
3
|
import { type Direction } from "./direction.js";
|
|
4
|
+
import type { Preferences } from "./preferences.js";
|
|
4
5
|
export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./appearance-context.js";
|
|
5
6
|
export { useDirection, useDocumentDirection } from "./direction.js";
|
|
6
7
|
/** Establishes only the explicitly supplied UI values for a React subtree. */
|
package/dist/ui-provider.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {} from "@phreshos/core";
|
|
3
2
|
import { AppearanceContext, PreferencesContext } from "./appearance-context.js";
|
|
4
3
|
import { DirectionContext } from "./direction.js";
|
|
5
4
|
export { useAppearance, useBrowserPreferences, usePreferences, useThemedValue } from "./appearance-context.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "React components for coherent PhreshOS Program interfaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@base-ui/react": "^1.7.0",
|
|
59
|
-
"@phreshos/core": "^0.1.
|
|
59
|
+
"@phreshos/core": "^0.1.53",
|
|
60
60
|
"colorjs.io": "^0.7.1",
|
|
61
61
|
"motion": "^13.2.0",
|
|
62
62
|
"react-aria-components": "^1.20.0"
|