ng-hub-ui-utils 22.14.0 → 22.15.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/README.md +28 -6
- package/fesm2022/ng-hub-ui-utils.mjs +363 -41
- package/fesm2022/ng-hub-ui-utils.mjs.map +1 -1
- package/package.json +12 -3
- package/types/ng-hub-ui-utils.d.ts +194 -12
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/ng-hub-ui-utils)
|
|
4
4
|
[](LICENSE)
|
|
5
|
-
[](https://github.com/carlos-morcillo/ng-hub-ui/actions)
|
|
6
5
|
|
|
7
6
|
> Common utilities library for Angular, fundamental support for the Hub UI ecosystem.
|
|
8
7
|
|
|
@@ -704,6 +703,29 @@ These functions back the i18n system and are exported for direct use:
|
|
|
704
703
|
- `isInSrgbGamut(color): boolean` - Whether the colour survives the trip to sRGB
|
|
705
704
|
- `clampToSrgbGamut(color): HubOklch` - Reduces chroma until it fits, preserving lightness and hue
|
|
706
705
|
|
|
706
|
+
### Palette Derivation
|
|
707
|
+
|
|
708
|
+
One brand colour, the whole palette — and the two numbers that keep it honest.
|
|
709
|
+
|
|
710
|
+
- `harmoniseSemantics(primary, options?): HubSemanticPalette | null` - Rotates `success`, `warning`, `danger` and `info` towards the brand's hue and returns them as hex. Lightness is left exactly where the anchor had it, because it is what carries the contrast each role was chosen for; chroma is reduced only when the new hue cannot hold it inside sRGB
|
|
711
|
+
- `tintNeutrals(primary, options?): HubNeutralRamp | null` - Leans the grey ramp (`100` … `900`) the same way, keeping each step's lightness
|
|
712
|
+
- `HUB_MAX_HUE_SHIFT: number` (15) - How far a role may rotate, in degrees. Not taste: success and danger sit 135.8° apart in OKLCh, and a viewer with deuteranopia separates them by hue alone. A brand hue between the two pulls both inwards, so the gap closes by up to twice the cap; at 22.9° it would reach the 90° floor. 15° leaves the worst case at 105.8°
|
|
713
|
+
- `HUB_MAX_NEUTRAL_CHROMA: number` (0.015) - The most chroma a tinted neutral may carry. Anchored on the ramp the design system already ships — `gray-600` measures 0.0165 and `gray-500` 0.0145 — so a tinted ramp is never more colourful than the grey people already accept as grey
|
|
714
|
+
- `HUB_SEMANTIC_ANCHORS` / `HUB_NEUTRAL_ANCHORS` - The untinted starting points, so a product that harmonises nothing still gets the palette the stylesheet ships
|
|
715
|
+
- Types: `HubSemanticRole`, `HubSemanticPalette`, `HubNeutralStep`, `HubNeutralRamp`, `HubHarmoniseOptions`, `HubTintNeutralsOptions`
|
|
716
|
+
|
|
717
|
+
```typescript
|
|
718
|
+
import { harmoniseSemantics, tintNeutrals } from 'ng-hub-ui-utils';
|
|
719
|
+
|
|
720
|
+
harmoniseSemantics('#6f42c1');
|
|
721
|
+
// { success: '#00866b', warning: '#ffbd6e', danger: '#d8336b', info: '#44c4ff' }
|
|
722
|
+
|
|
723
|
+
tintNeutrals('#6f42c1'); // greys leaning violet, chroma never above 0.015
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
A brand with no hue of its own — a pure grey — leaves both sets untouched: OKLCh's hue on a grey
|
|
727
|
+
is rounding noise, and harmonising towards it would rotate every role in a direction nobody chose.
|
|
728
|
+
|
|
707
729
|
### Focus Functions
|
|
708
730
|
|
|
709
731
|
- `getFocusableBoundaryElements(element: HTMLElement): HTMLElement[]` - Gets first and last focusable elements
|
|
@@ -886,7 +908,7 @@ This library doesn't include visual components, but support utilities used by ot
|
|
|
886
908
|
## 🛠️ Development
|
|
887
909
|
|
|
888
910
|
```bash
|
|
889
|
-
git clone https://github.com/
|
|
911
|
+
git clone https://github.com/hub-env/ng-hub-ui-utils
|
|
890
912
|
cd ng-hub-ui-utils
|
|
891
913
|
npm install
|
|
892
914
|
npm run build
|
|
@@ -955,9 +977,9 @@ Recent highlights:
|
|
|
955
977
|
|
|
956
978
|
## 🐛 Issues and Support
|
|
957
979
|
|
|
958
|
-
- [Report a bug](https://github.com/
|
|
959
|
-
- [Request a feature](https://github.com/
|
|
960
|
-
- [Repository](https://github.com/
|
|
980
|
+
- [Report a bug](https://github.com/hub-env/hub-ui/issues)
|
|
981
|
+
- [Request a feature](https://github.com/hub-env/hub-ui/issues/new?template=feature_request.yml)
|
|
982
|
+
- [Repository](https://github.com/hub-env/ng-hub-ui-utils)
|
|
961
983
|
- **Author**: [Carlos Morcillo](https://www.carlosmorcillo.com)
|
|
962
984
|
|
|
963
985
|
## ☕ Support the Project
|
|
@@ -1018,4 +1040,4 @@ SOFTWARE.
|
|
|
1018
1040
|
|
|
1019
1041
|
⭐ **If you like this project, don't forget to give it a star on GitHub!**
|
|
1020
1042
|
|
|
1021
|
-
[](https://github.com/hub-env/hub-ui)
|