ng-hub-ui-utils 22.13.0 → 22.15.0
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 +30 -7
- package/fesm2022/ng-hub-ui-utils.mjs +370 -107
- package/fesm2022/ng-hub-ui-utils.mjs.map +1 -1
- package/package.json +8 -2
- package/types/ng-hub-ui-utils.d.ts +201 -58
package/README.md
CHANGED
|
@@ -384,13 +384,14 @@ export class ExampleComponent {}
|
|
|
384
384
|
Inputs: `hubTooltip` (text), `hubTooltipPlacement` (`top` | `bottom` | `left` | `right`,
|
|
385
385
|
default `top`), `hubTooltipDelay` (fade ms, default `150`), `hubTooltipOffset` (px, default `8`).
|
|
386
386
|
|
|
387
|
-
> **`TooltipDirective` (`[tooltip]`)
|
|
388
|
-
>
|
|
389
|
-
>
|
|
390
|
-
>
|
|
391
|
-
> `placement` and with the `tooltip` input of `<hub-badge>`. Migration is attribute for
|
|
387
|
+
> **`TooltipDirective` (`[tooltip]`) was removed in 22.14.0**, having been deprecated since
|
|
388
|
+
> 22.9.0. Its bare input names (`tooltip`, `placement`, `delay`, `offset`) belonged to every
|
|
389
|
+
> directive on the element that declared them, which is how it collided with `[hubDropdown]`'s
|
|
390
|
+
> own `placement` and with the `tooltip` input of `<hub-badge>`. Migration is attribute for
|
|
392
391
|
> attribute: `tooltip` → `hubTooltip`, `placement` → `hubTooltipPlacement`,
|
|
393
|
-
> `delay` → `hubTooltipDelay`, `offset` → `hubTooltipOffset`.
|
|
392
|
+
> `delay` → `hubTooltipDelay`, `offset` → `hubTooltipOffset`. A template left writing
|
|
393
|
+
> `tooltip="…"` still compiles and shows nothing at all, so check the markup as well as the
|
|
394
|
+
> imports.
|
|
394
395
|
|
|
395
396
|
Show the label **only while the host is truncated** with `HubOverflowTooltipDirective`
|
|
396
397
|
(`[hubOverflowTooltip]`), which tracks truncation live with a `ResizeObserver` and a
|
|
@@ -703,6 +704,29 @@ These functions back the i18n system and are exported for direct use:
|
|
|
703
704
|
- `isInSrgbGamut(color): boolean` - Whether the colour survives the trip to sRGB
|
|
704
705
|
- `clampToSrgbGamut(color): HubOklch` - Reduces chroma until it fits, preserving lightness and hue
|
|
705
706
|
|
|
707
|
+
### Palette Derivation
|
|
708
|
+
|
|
709
|
+
One brand colour, the whole palette — and the two numbers that keep it honest.
|
|
710
|
+
|
|
711
|
+
- `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
|
|
712
|
+
- `tintNeutrals(primary, options?): HubNeutralRamp | null` - Leans the grey ramp (`100` … `900`) the same way, keeping each step's lightness
|
|
713
|
+
- `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°
|
|
714
|
+
- `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
|
|
715
|
+
- `HUB_SEMANTIC_ANCHORS` / `HUB_NEUTRAL_ANCHORS` - The untinted starting points, so a product that harmonises nothing still gets the palette the stylesheet ships
|
|
716
|
+
- Types: `HubSemanticRole`, `HubSemanticPalette`, `HubNeutralStep`, `HubNeutralRamp`, `HubHarmoniseOptions`, `HubTintNeutralsOptions`
|
|
717
|
+
|
|
718
|
+
```typescript
|
|
719
|
+
import { harmoniseSemantics, tintNeutrals } from 'ng-hub-ui-utils';
|
|
720
|
+
|
|
721
|
+
harmoniseSemantics('#6f42c1');
|
|
722
|
+
// { success: '#00866b', warning: '#ffbd6e', danger: '#d8336b', info: '#44c4ff' }
|
|
723
|
+
|
|
724
|
+
tintNeutrals('#6f42c1'); // greys leaning violet, chroma never above 0.015
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
A brand with no hue of its own — a pure grey — leaves both sets untouched: OKLCh's hue on a grey
|
|
728
|
+
is rounding noise, and harmonising towards it would rotate every role in a direction nobody chose.
|
|
729
|
+
|
|
706
730
|
### Focus Functions
|
|
707
731
|
|
|
708
732
|
- `getFocusableBoundaryElements(element: HTMLElement): HTMLElement[]` - Gets first and last focusable elements
|
|
@@ -727,7 +751,6 @@ library, because their selectors and data models differ.
|
|
|
727
751
|
|
|
728
752
|
- `HubTooltipDirective` (`[hubTooltip]`) - Tooltip on hover/focus. Inputs: `hubTooltip`, `hubTooltipPlacement`, `hubTooltipDelay`, `hubTooltipOffset`
|
|
729
753
|
- `HubOverflowTooltipDirective` (`[hubOverflowTooltip]`) - Tooltip shown only while the label is truncated. Inputs: `hubOverflowTooltip`, `placement`, `hubOverflowTooltipMeasure` (CSS selector, resolved inside the host, naming the box whose truncation decides it; defaults to the host)
|
|
730
|
-
- `TooltipDirective` (`[tooltip]`) - **Deprecated since 22.9.0**, kept working. Inputs: `tooltip`, `placement`, `delay`, `offset`
|
|
731
754
|
- `provideHubTooltip(adapter: HubTooltipAdapter)` and `HUB_TOOLTIP_ADAPTER` - Swap the implementation behind `[hubOverflowTooltip]`, app-wide or per subtree; defaults to `hubTooltipAdapter`
|
|
732
755
|
|
|
733
756
|
### Pipes
|