Skip to content

Commit cd17d57

Browse files
Prep for release 5.1.0 (#274)
* Update camera logic for hass 2025.6 (#273) * Development (#267) * Feature/throttle updates and responsive bug (#241) * Fixing throttle updates and resposnive issue * Updating package and changelog with locales * Small refactor * Updating changelog * 248 reported delays with card updates (#249) * Updates with timecard issues * Fixed bug where ticking function wouldn't update the clock if no entity or other props are provided * Optimsations with tooltip * updating log * Updating changelog * Reverting time card story changes * Typo * Locales, prettier & bumping version * Optional breakpoints (#263) * WIP on 253-add-useruser-hook * Cleanup * Adding case where the window context from match media is null * Add useUser hook (#260) * Adding useUser hook and documentation * adding temp alias * Upgrading storybook * Removing framer motion (#265) * Removing framer motion * Moving AutoHeight to shared directory * Removing redundant state variable * Small performance optimisation * Updating locales * Ready for release * bumping versions * Doc updates * Update camera logic for hass 2025.6 * Camera linting --------- Co-authored-by: Shannon Hochkins <mail@shannonhochkins.com> * 269 useusers a new hook to retrieve a list of users (#270) * Development (#267) * Feature/throttle updates and responsive bug (#241) * Fixing throttle updates and resposnive issue * Updating package and changelog with locales * Small refactor * Updating changelog * 248 reported delays with card updates (#249) * Updates with timecard issues * Fixed bug where ticking function wouldn't update the clock if no entity or other props are provided * Optimsations with tooltip * updating log * Updating changelog * Reverting time card story changes * Typo * Locales, prettier & bumping version * Optional breakpoints (#263) * WIP on 253-add-useruser-hook * Cleanup * Adding case where the window context from match media is null * Add useUser hook (#260) * Adding useUser hook and documentation * adding temp alias * Upgrading storybook * Removing framer motion (#265) * Removing framer motion * Moving AutoHeight to shared directory * Removing redundant state variable * Small performance optimisation * Updating locales * Ready for release * bumping versions * Doc updates * New hook, zustand upgrade * Pushing up, check master props * Merging master * Fixed typescript and storyboook * Adding docs * Lots of changes mainly related to useStore * Lots more updates! * Prep for release * Re-running build * bumping package versions --------- Co-authored-by: kdkavanagh <kdkavanagh@gmail.com>
1 parent 4209d3e commit cd17d57

File tree

221 files changed

+110778
-95742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+110778
-95742
lines changed

.storybook/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ mark {
3131
.sbdocs-content {
3232
max-width: 100% !important;
3333
}
34+
35+
.docblock-argstable-body tr table tbody tr td:has(strong) {
36+
background: rgb(255, 208, 208) !important;
37+
border: none !important;
38+
padding: 4px !important;
39+
40+
}

.storybook/manager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ addons.setConfig({
2121
if (item.type === 'root' && item.name === 'components') {
2222
return '@hakit/components';
2323
}
24+
if (item.type === 'root' && item.name === 'editor') {
25+
return '@hakit/editor';
26+
}
2427
return item.name;
2528
}
2629
}

.storybook/preview.tsx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,32 @@ export default {
7575
},
7676
options: {
7777
storySort: (a, b) => {
78-
const splitAndTakeFirst = (str, delimiter) => str.split(delimiter)[0];
79-
const getOrderIndex = (order, item) => order.indexOf(item);
80-
const getNumericPrefix = (str) => parseInt(str.match(/\d+/)?.[0] || "-1", 10);
81-
82-
const aTitle = splitAndTakeFirst(a.title, '/');
83-
const bTitle = splitAndTakeFirst(b.title, '/');
84-
85-
const order = ['INTRODUCTION', 'COMPONENTS', 'HOOKS', 'ADVANCED'];
86-
87-
const aOrderIndex = getOrderIndex(order, aTitle);
88-
const bOrderIndex = getOrderIndex(order, bTitle);
89-
90-
if (aOrderIndex !== -1 && bOrderIndex !== -1) {
91-
if (aOrderIndex === bOrderIndex) {
92-
// Both have the same top-level title. Sort based on the numeric prefix in importPath.
93-
const aNumericPrefix = getNumericPrefix(a.importPath);
94-
const bNumericPrefix = getNumericPrefix(b.importPath);
95-
return aNumericPrefix - bNumericPrefix;
96-
}
97-
return aOrderIndex - bOrderIndex;
78+
// return aTitle.localeCompare(bTitle);
79+
const splitAndTakeFirst = (str) => str.split('/')[0];
80+
const stripGroup = (full, group) => full.replace(`${group}/`, '');
81+
82+
const groupOrder = ['INTRODUCTION', 'EDITOR', 'COMPONENTS', 'HOOKS'];
83+
84+
const aGroup = splitAndTakeFirst(a.title).toUpperCase();
85+
const bGroup = splitAndTakeFirst(b.title).toUpperCase();
86+
87+
const aIdx = groupOrder.indexOf(aGroup);
88+
const bIdx = groupOrder.indexOf(bGroup);
89+
90+
// if they’re in different top-level groups, respect custom order
91+
if (aIdx !== bIdx) {
92+
// put unknown groups at the end
93+
const ai = aIdx === -1 ? Infinity : aIdx;
94+
const bi = bIdx === -1 ? Infinity : bIdx;
95+
return ai - bi;
9896
}
99-
100-
if (aOrderIndex !== -1) return -1;
101-
if (bOrderIndex !== -1) return 1;
102-
103-
return aTitle.localeCompare(bTitle);
97+
98+
// same group: strip off the "HOOKS/" (or "COMPONENTS/", etc.) prefix
99+
const aName = stripGroup(a.title, aGroup);
100+
const bName = stripGroup(b.title, bGroup);
101+
102+
// then just do a normal string compare
103+
return aName.localeCompare(bName);
104104
},
105105
},
106106
docs: {

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
# 5.1.1
2+
3+
### @hakit/components
4+
- IMPROVEMENT - Various updates to performance in a few components by updating the zustand store to v5 from v4
5+
- BUGFIX - TimeCard - was logging missing keys for the formatter tokens, this is now resolved
6+
- BUGFIX / IMPROVEMENT - All Cards - The scale effect will now only be applied when the card itself is being clicked, if there's buttons with click actions within the card the scale effect will no longer scale whilst these are being tapped, whilst being tapped a class will be added to the base-card of `card-base-active`
7+
- BUGFIX - MediaPlayerCard - You could open infinite modals by launching another modal by long pressing the media player card in the initial popup, this has been fixed too. The background image of the artwork that is playing is now a separate element instead of a background image on the main card.
8+
- NEW - disableModal - A flag you can provide to call cards that support entity popups to disable the long press modal functionality and control your own functionality via the `longPressCallback` prop.
9+
- BUGFIX - CalendarCard - Fixed a bug that was causing the calendar card to re-render too many times.
10+
- NEW - refCallback - A new method to get the ref element of the base card
11+
- BUGFIX - TimeCard - was previously not setting keys on the fragment elements that make up the "time" value.
12+
13+
14+
15+
### @hakit/core
16+
- NEW - useUsers - a new hook to retrieve all users from the home assistant instance, this will return an array of users with their details, this is useful if you want to display a list of users in your dashboard or use it for other purposes.
17+
- NEW - useEntities - a new hook to subscribe to multiple entities at once, this will return an array of entities that match the provided entity ids, this is useful if you want to subscribe to multiple entities at once and get their updates in real-time.
18+
- IMPROVEMENT - useCamera - updated to support [changes](https://github.com/shannonhochkins/ha-component-kit/pull/273) home assistant made back in November last year, thanks to @kdkavanagh for this one!
19+
- IMPROVEMENT - zustand has been updated to v5, this should improve performance and reduce the amount of re-renders in the application
20+
- IMPROVEMENT - the connection methods and re-authentication methods have received some love, the web sockets will now be automatically suspended when on an inactive tab ([home assistant does this too](https://github.com/home-assistant/frontend/blob/8eb7fe8b0aa5ce2651e4ee8aa10ecbf3ec899847/src/layouts/home-assistant.ts#L283)), as well as "frozen" tabs/browsers, and will resume when the tab is active again, this should improve performance on slower devices, messages will be queued whilst inactive and will be sent when the tab is active again.
21+
- NEW - To add to the above, from the store you can now access `connectionStatus` to determine the current state of the connection via `useStore(state => state.connectionStatus)`, this will return a string with the current status of the connection, this is useful if you want to display a message to the user when the connection is lost or re-established, if you want to configure the suspend/resume options you can pass through `handleResumeOptions` via the `options` prop on `HassConnect`
22+
- IMPROVEMENT - Removed some packages that are no longer needed, this should reduce the bundle size of the core package and improve performance.
23+
- DEPRECATED - useStore().lastUpdated and useStore().setLastUpdated - these were remnants of the old store implementation, there was nothing using, or even setting this value so i've decided to remove it.
24+
- IMPROVEMENT - Many optimisations to `useEntity`, much faster updates without throttling/debouncing, however there's been some side effects to this
25+
- DEPRECATED - throttle - no longer needed as we update as often as we can
26+
- BREAKING - home assistant has removed the "kelvin" value you can pass to set the temperature of a light entity and is replaced with `color_temp_kelvin`.
27+
- BREAKING - getAllEntities - There was an unfortunate side effect of the previous store implementation where getAllEntities would automatically re-trigger a re-render of the component that was using it, the intention of this method is to grab a fresh copy of the entities at the time of the call, not trigger a re-render causing it to get new entities on every entity change, if you are using this method, you can swap it for the following:
28+
```ts
29+
// OLD
30+
const { getAllEntities } = useHass();
31+
const entities = getAllEntities();
32+
// NEW
33+
const { useStore } = useHass();
34+
const entities = useStore((state) => state.entities);
35+
```
36+
- NEW - renderError - a new prop you can provide to the HassConnect component to render the error message anywhere of your choice, useful to show via portals, or even just to match your applications styles.
37+
38+
### Storybook
39+
- Updated storybook to latest version
40+
- Bugfix for the MediaPlayerCard, previously the "progress" bar was not displaying correctly (storybook only issue)
41+
42+
### Dependencies
43+
44+
- zustand - now required v5 or higher
45+
46+
147
# 5.1.0
248

349
### @hakit/components

DEPLOY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,26 @@ npm run release:components
6666
```
6767

6868

69+
### Canary Releases
70+
71+
1. Bump the package versions in core/components, and suffix with `-canary.0` for example in the package.json files.
72+
2. Run the canary release command, this will run build first, then publish the canary versions to npm:
73+
```bash
74+
npm run release:core:canary
75+
npm run release:components:canary
76+
```
77+
3. Verify it's not public or the latest version in npm, you can do this by running:
78+
```bash
79+
npm dist-tag ls @hakit/core
80+
npm dist-tag ls @hakit/components
81+
```
82+
4. Ask users to install or test the canary version by running:
83+
```bash
84+
npm install @hakit/core@canary
85+
npm install @hakit/components@canary
86+
```
87+
or the specific version:
88+
```bash
89+
npm install @hakit/core@1.0.0-canary.0
90+
npm install @hakit/components@1.0.0-canary.0
91+
```

0 commit comments

Comments
 (0)