@sylwellsoftware/fray 1.1.0 → 1.1.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.
package/colors/README.md CHANGED
@@ -1,27 +1,38 @@
1
1
  # Fray color palettes
2
2
 
3
- Each `<name>/colors.css` file is a replaceable variable-only palette. It does
4
- not decide what a panel, button, input, selection, or application surface looks
5
- like, and it never imports another stylesheet.
3
+ Each `<name>/colors.css` file is a replaceable, variable-only palette. It owns
4
+ color anchors and endpoints, not the appearance of a panel, button, input,
5
+ selection, or application surface. Palette files contain no component
6
+ selectors and never import another stylesheet.
6
7
 
7
- A palette normally supplies:
8
+ Published palettes are `gray`, `green`, `iceblue`, `ocean`, `orange`, `purple`,
9
+ `red`, and `yellow`.
10
+
11
+ ## Palette contract
12
+
13
+ A palette supplies:
8
14
 
9
15
  - `--palette-light` and `--palette-dark` endpoints;
10
- - light/dark contrast colors and named red/green primitives;
16
+ - `--palette-contrast-light` and `--palette-contrast-dark` foregrounds;
17
+ - `--palette-red` and `--palette-green` status primitives;
11
18
  - `--palette-primary-500`, `--palette-secondary-500`, and
12
19
  `--palette-neutral-500` anchors.
13
20
 
14
- `themes/base.css` derives the remaining numeric ramp stops and the ordinary
15
- `primary`, `light`, and `dark` aliases with `color-mix`. It also derives clear
16
- and faint translucent variants of the light endpoint for palette-aware chrome.
17
- A palette may override `--palette-<family>-light-mix` or
18
- `--palette-<family>-dark-mix` when a ramp intentionally changes hue.
21
+ `themes/base.css` derives the remaining numeric ramp stops, ordinary
22
+ `primary`/`light`/`dark` aliases, and transparent light variants with
23
+ `color-mix()`. A palette may override a
24
+ `--palette-<family>-light-mix` or `--palette-<family>-dark-mix` endpoint when a
25
+ ramp intentionally changes hue.
19
26
 
20
27
  ```css
21
28
  @layer palette {
22
29
  :root {
23
30
  --palette-light: #fff;
24
31
  --palette-dark: #111827;
32
+ --palette-contrast-light: #fff;
33
+ --palette-contrast-dark: #111827;
34
+ --palette-red: #c62828;
35
+ --palette-green: #2e7d32;
25
36
  --palette-primary-500: #2989d8;
26
37
  --palette-secondary-500: #7137a8;
27
38
  --palette-neutral-500: #7892aa;
@@ -29,6 +40,24 @@ A palette may override `--palette-<family>-light-mix` or
29
40
  }
30
41
  ```
31
42
 
32
- Color files contain no semantic `--button-*`, `--input-*`, or `--panel-*`
33
- variables and no descendant selectors. Themes map the derived palette to those
34
- semantic roles.
43
+ Color files must not declare semantic roles such as `--button-*`,
44
+ `--input-*`, or `--panel-*`. The base and active theme map derived palette
45
+ values to those roles.
46
+
47
+ ## Loading and replacement
48
+
49
+ Load one palette after Fray's base and structural CSS and before the active
50
+ theme:
51
+
52
+ ```ts
53
+ import '@sylwellsoftware/fray/colors/iceblue/colors.css'
54
+ ```
55
+
56
+ `frayColorOptions` lists the built-in files. `ColorPicker` and
57
+ `replaceFrayStylesheet('colors', option)` replace the link marked
58
+ `data-fray-stylesheet="colors"`; applications own selection and persistence
59
+ policy.
60
+
61
+ When adding a palette, test its derived ramps and contrast in every supported
62
+ theme, forced-colors mode, and application states that introduce semantic
63
+ status colors.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@sylwellsoftware/fray",
4
4
  "private": false,
5
- "version": "1.1.0",
5
+ "version": "1.1.1",
6
6
  "description": "Browser-only TypeScript component runtime, JSX controls, and semantic themes.",
7
7
  "license": "Apache-2.0",
8
8
  "author": {
@@ -63,11 +63,11 @@
63
63
  "./themes/**/*.css"
64
64
  ],
65
65
  "peerDependencies": {
66
- "@sylwellsoftware/glue": "^0.8.0"
66
+ "@sylwellsoftware/glue": "^0.8.1"
67
67
  },
68
68
  "devDependencies": {
69
69
  "vite": "^6.3.5",
70
- "@sylwellsoftware/glue": "^0.8.0"
70
+ "@sylwellsoftware/glue": "^0.8.1"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22",
package/themes/README.md CHANGED
@@ -1,33 +1,41 @@
1
- # Fray base and theme CSS
1
+ # Fray base and themes
2
2
 
3
- Fray presentation is loaded in this order:
3
+ Fray presentation is assembled from independently owned files in this order:
4
4
 
5
- 1. `themes/base.css`: custom-property defaults and palette derivation only.
6
- 2. Runtime-collected structural CSS for the application's declared components.
7
- 3. One `colors/<name>/colors.css`: palette anchors and endpoints only.
8
- 4. One `themes/<name>/theme.css`: intentional custom-property overrides only.
5
+ 1. `themes/base.css` defaults and palette derivation.
6
+ 2. Collected component CSS or `styles/structural.css` selectors and layout.
7
+ 3. One `colors/<name>/colors.css` palette anchors and endpoints.
8
+ 4. One `themes/<name>/theme.css` intentional semantic-role overrides.
9
9
 
10
- Application-owned layout CSS is separate from these Fray inputs.
10
+ Application layout CSS is separate from these inputs.
11
11
 
12
12
  ## Base file
13
13
 
14
- `base.css` provides usable default palette anchors, derives the primary,
15
- secondary, and neutral ramps, and declares semantic defaults. It contains no
16
- component selectors and no declarations that consume those variables.
14
+ `base.css` provides usable default palette anchors, derives primary, secondary,
15
+ and neutral ramps, and declares the semantic variable fallback hierarchy. It
16
+ contains no component selectors and no declarations that consume those
17
+ variables.
17
18
 
18
- The application imports it explicitly. Named themes and colors never import it,
19
- which keeps ownership and load order visible.
19
+ Applications import the base explicitly. Named themes and palettes never
20
+ import it, so the cascade and ownership order remain visible.
20
21
 
21
22
  ## Theme files
22
23
 
23
- A theme changes only variables. The sole ordinary-property exception is
24
- `color-scheme`, because it informs browser-native rendering. A theme must not
25
- contain component, trait, part, ARIA-state, or pseudo-element selectors. Those
26
- selectors belong to component `static css` even when their values are driven by
27
- theme variables.
24
+ Published themes are:
28
25
 
29
- Start with no overrides. Add a variable only when it produces a deliberate
30
- visual difference from `base.css`; do not repeat defaults for completeness.
26
+ | Theme | Appearance capability | Intent |
27
+ | --- | --- | --- |
28
+ | `minimal` | Adaptive (`light`, `dark`, or system) | Restrained platform-oriented treatment |
29
+ | `java` | Light | Desktop control treatment inspired by classic Java interfaces |
30
+ | `shiny` | Light | Gloss, depth, and chromed graphical surfaces |
31
+
32
+ A theme changes custom properties. The sole ordinary-property exception is
33
+ `color-scheme`, which informs browser-native rendering. Themes must not contain
34
+ component, trait, part, ARIA-state, or pseudo-element selectors; those belong
35
+ to the component's `static css`.
36
+
37
+ Start a new theme with no overrides and add a variable only when it creates an
38
+ intentional difference from `base.css`:
31
39
 
32
40
  ```css
33
41
  @layer theme {
@@ -39,6 +47,22 @@ visual difference from `base.css`; do not repeat defaults for completeness.
39
47
  }
40
48
  ```
41
49
 
42
- `frayThemeVariableCatalog` publishes the supported palette and semantic
43
- variable contract. Component-specific variables should fall back through a
44
- shared family so a theme can remain small.
50
+ `frayThemeVariableCatalog` is the machine-readable public contract. Its
51
+ fallback chain runs from palette roles through global UI roles and shared
52
+ families, then to optional component-specific roles. A small theme can
53
+ therefore override a family without naming every component.
54
+
55
+ ## Runtime selection and appearance
56
+
57
+ `frayThemeOptions` lists built-in theme links and their light/dark capability.
58
+ `ThemePicker` or `replaceFrayStylesheet('theme', option)` replaces the marked
59
+ theme link. `setFrayAppearance('light' | 'dark' | 'system')` controls adaptive
60
+ themes; `system` removes the explicit root attribute so browser preference
61
+ applies.
62
+
63
+ Theme availability, default selection, persistence, and whether users can
64
+ switch at runtime are application policy.
65
+
66
+ When changing a theme, verify all supported palettes, native control states,
67
+ keyboard focus, disabled/error/selection contrast, forced colors, reduced
68
+ motion, and 200% text.