@omerdlw/base-framework 1.0.4 → 1.0.6
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/dist/index.js +125 -94
- package/dist/index.js.map +1 -1
- package/dist/modules/ambient/color.d.ts +9 -4
- package/dist/modules/ambient/color.d.ts.map +1 -1
- package/dist/modules/ambient/extractor.d.ts +8 -0
- package/dist/modules/ambient/extractor.d.ts.map +1 -1
- package/dist/modules/ambient/index.js +78 -69
- package/dist/modules/ambient/index.js.map +1 -1
- package/dist/modules/dock/index.js +425 -393
- package/dist/modules/dock/index.js.map +1 -1
- package/dist/modules/dock/surface/context.d.ts.map +1 -1
- package/dist/modules/dock/surface/hooks.d.ts +5 -3
- package/dist/modules/dock/surface/hooks.d.ts.map +1 -1
- package/dist/modules/dock/surface/stack.d.ts.map +1 -1
- package/dist/modules/index.js +125 -94
- package/dist/modules/index.js.map +1 -1
- package/docs/modules/ambient.md +4 -4
- package/package.json +4 -4
package/docs/modules/ambient.md
CHANGED
|
@@ -51,10 +51,10 @@ useAmbientTheme({
|
|
|
51
51
|
|
|
52
52
|
| Variable | Set when | Value |
|
|
53
53
|
| :----------------------------- | :------------------------------------------- | :----------------------------------------------------------- |
|
|
54
|
-
| `--primary` | an `image` is given and extracted | bright OKLCH colour
|
|
54
|
+
| `--primary` | an `image` is given and extracted | bright OKLCH colour; lightness 0.60–0.86 and chroma 0–0.24 follow the image (neutral images give a neutral, chroma 0) |
|
|
55
55
|
| `--color-ambient-glow` | same | same as `--primary` |
|
|
56
56
|
| `--color-primary` | same **and** `tintGlobals` is true (default) | same as `--primary` |
|
|
57
|
-
| `--black` | an `image` is given and extracted | deep
|
|
57
|
+
| `--black` | an `image` is given and extracted | deep OKLCH (lightness ≈ 0.15, chroma ≤ 0.055, tint scales with the image; 0 for neutral images) |
|
|
58
58
|
| any variable named in `colors` | `colors` is set | the literal value |
|
|
59
59
|
|
|
60
60
|
`colors` keys are mapped as: `primary` → `--primary`, `black` → `--black`, `white` → `--white`, `ambientGlow` → `--color-ambient-glow`, `colorPrimary` → `--color-primary`; a key starting with `--` is used verbatim; anything else becomes `--color-<key>`. `colors` always wins over extracted values.
|
|
@@ -109,8 +109,8 @@ On cleanup the previous inline values (and priorities) are restored exactly. If
|
|
|
109
109
|
|
|
110
110
|
- **Source loading.** Remote (`http…`) images are first fetched with `cors=1` and `mode: "cors"`, then through `/api/ambient/proxy?url=…`; the blob is read from an object URL (revoked afterwards). Same-origin or non-http sources are loaded directly (with `crossOrigin="anonymous"` when no object URL was needed).
|
|
111
111
|
- **The proxy** only serves `image/*` (415 otherwise), blocks unsafe/internal URLs with `isSafeUrl` (including on every redirect, up to 5), and caches responses for a day. Do not point it at anything but images.
|
|
112
|
-
- **Sampling.** The image is drawn to a
|
|
113
|
-
- **Derivation.**
|
|
112
|
+
- **Sampling.** The image is drawn to a 64×64 canvas. Pixels with alpha < 128 are skipped; near-black and near-white pixels (unreliable hue) are ignored, and pixels with chroma < 0.03 count as neutral. Remaining pixels vote into 36 hue bins with weight `chroma² × lightness-usability`, so vivid mid-tone pixels beat muddy or very dark/light ones. The best bin plus half-weighted neighbours gives hue, chroma and lightness (weighted). If coloured pixels are under 4% of the colourable ones, or there are none, the result is a **neutral** (`c 0`, lightness = image average); a small accent on a mostly neutral image is kept but subdued.
|
|
113
|
+
- **Derivation.** A source chroma < `0.012` is treated as neutral (no hue is invented). Otherwise chroma is clamped to `≤ 0.28`. `primary` chroma is `0.24 × (1 − e^(−chroma × 9.4))` and lightness is `0.74 + (L − 0.6) × 0.5` clamped to `0.60–0.86`; `black` chroma is `min(0.055, chroma × 0.35)` and lightness is `0.15 + (L − 0.6) × 0.06` clamped to `0.12–0.18`.
|
|
114
114
|
- **Cache.** Up to 100 palettes (`cacheLimit`, oldest evicted) and concurrent requests for the same URL share one promise.
|
|
115
115
|
- **Stability.** `colors`, `options` and `initialPalette` are stabilized with `shallowEqual`, so passing fresh object literals each render does **not** re-apply the theme. (A test forbids `JSON.stringify` for this.)
|
|
116
116
|
- **Failure.** Any failure resolves the fallback palette (`initialPalette` → `fallbackPalette` → defaults). It never throws.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omerdlw/base-framework",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Microkernel engine and first-party declarative UI modules for app-like Next.js products.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
"LICENSE"
|
|
127
127
|
],
|
|
128
128
|
"scripts": {
|
|
129
|
-
"build": "rm -rf dist && tsup && tsc --emitDeclarationOnly --outDir dist",
|
|
129
|
+
"build": "rm -rf dist && ./node_modules/.bin/tsup && ./node_modules/.bin/tsc --emitDeclarationOnly --outDir dist",
|
|
130
130
|
"prepublishOnly": "npm run build",
|
|
131
|
-
"dev": "tsup --watch",
|
|
132
|
-
"type-check": "tsc --noEmit",
|
|
131
|
+
"dev": "./node_modules/.bin/tsup --watch",
|
|
132
|
+
"type-check": "./node_modules/.bin/tsc --noEmit",
|
|
133
133
|
"check:architecture": "node scripts/check-architecture.mjs",
|
|
134
134
|
"test": "node --import ./tests/support/register.mjs --test 'tests/**/*.test.ts'",
|
|
135
135
|
"pack": "npm run build && npm pack",
|