Skip to content

Commit

Permalink
Merge branch 'release/3.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonhochkins committed Apr 26, 2024
2 parents e0b6d82 + ad6ac97 commit 7415804
Show file tree
Hide file tree
Showing 102 changed files with 13,695 additions and 28,292 deletions.
17 changes: 12 additions & 5 deletions .d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
declare module '*.svg' {
declare module '*.png' {
const value: any;
export = value;
}

declare module '*.jpg' {
const value: any;
const value: string;
export = value;
}
declare module '*.npg' {
const value: any;
export = value;

declare module "*.svg?react" {
import * as React from "react";

const ReactComponent: React.FunctionComponent<
React.ComponentProps<"svg"> & { title?: string }
>;

export default ReactComponent;
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
3 changes: 0 additions & 3 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export default ({
docs: {
autodocs: 'tag'
},
features: {
storyStoreV7: true
},
typescript: {
check: true,
reactDocgen: 'react-docgen-typescript',
Expand Down
5 changes: 2 additions & 3 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { create } from '@storybook/theming/create';
import { addons } from '@storybook/manager-api';

const theme = create({
base: 'dark',
brandUrl: 'https://www.npmjs.com/package/@hakit/core',
brandImage: process.env.NODE_ENV === 'production' ? '/ha-component-kit/logo.png' : '/logo.png',
brandTarget: '_self',
appBg: '#0e1118'
appBg: '#0e1118',
});

import { addons } from '@storybook/manager-api';

addons.setConfig({
panelPosition: 'right',
showPanel: true,
Expand Down
34 changes: 27 additions & 7 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
import type { Preview } from "@storybook/react";
import { Title, Description, Primary, ArgTypes } from "@storybook/blocks";
import React from "react";
import { withThemeFromJSXProvider } from '@storybook/addon-themes';
import { ThemeProvider } from '@storybook/theming';
import './global.css';

const THEME = {
typography: {
fonts: {
base: 'Arial, sans-serif',
mono: 'Courier, monospace'
}
}
};

export default {
decorators: [
withThemeFromJSXProvider({
themes: {
dark: THEME,
light: THEME,
},
defaultTheme: 'dark',
Provider: ThemeProvider,
}),
(Story, args) => {
const centered = args.parameters.centered ? {
width: '100%',
Expand All @@ -14,18 +33,20 @@ export default {
} : {};
if (window.parent) {
const parentDocument = window.parent.document;
const logo = parentDocument.querySelector('.sidebar-header div img') as HTMLElement;
if (logo) {
logo.style.maxWidth = '100%';
}
const panel = parentDocument.getElementById('storybook-panel-root');
if (args.parameters?.addons?.showPanel === false && panel !== null && panel.parentElement !== null) {
panel.parentElement.style.display = 'none';
if (panel.parentElement.parentElement?.previousElementSibling) {
// @ts-ignore - it's correct.
panel.parentElement.parentElement.previousElementSibling.style.width = '100%';
// @ts-ignore - it's correct.
panel.parentElement.parentElement.previousElementSibling.style.height = '100%';
}
} else if (panel !== null && panel.parentElement !== null) {
panel.parentElement.style.display = 'flex';
}
const previewer = parentDocument.querySelector('#root div div:has(main)') as HTMLElement;
if (previewer !== null) {
previewer.style.height = '100dvh';
}
}
if (args.parameters.standalone) {
return <Story />;
Expand All @@ -45,7 +66,6 @@ export default {
],

parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
layout: 'centered',
controls: {
matchers: {
Expand Down
2 changes: 1 addition & 1 deletion ADDON.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HAKIT Dashboard Addon
# HAKIT Dashboard Addon (WIP)

This addon simply serves your custom dashboard to a new sidebar link in home assistant making it easier to access your custom dashboard.

Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# 3.1.5
## @hakit/components
- Previously all react props passed to the component were rendering as props on output elements, this wasn't visible with vite as it strips these out compile time, webpack however does not and some other bundlers don't either, now the cards will only render valid html props passed to components.
- few issues with nextjs where window was used in the incorrect context, this has been fixed
- Removed lazy import for the PersonControls popup as this is ignored as the popup uses static exports that are not dynamically exported
- ThemeProvider - now accepts children which will allow you to pass props to the emotion CacheProvider if need be, this means you can perform tasks like telling hakit to change the container where styles are created by default if you're serving your dashboard within an iframe.
- Now supports tree shaking - the library setup with the bundler is much more sophisticated now and will now bundle only the components you use in your application, this should reduce the size of the bundle significantly and should allow bundlers to perform caching mechanisms on the components.

## @hakit/core
- HassConnect - complete refactor to the authentication service, adding error logs and better error handling, simplified the token storage to remove the local cache which doesn't make sense why i included it to begin with! Should hopefully resolve issues raised: [issue 123](https://github.com/shannonhochkins/ha-component-kit/issues/123)
- HassConnect now wrapped with memo from react - issues raised after testing with applications that render when HassConnect is NOT the root component, now should only re-render when props passed to HassConnect change.
- Fixed some typescript problems with components returning JSX.Element instead of React.ReactNode
- After the refactor of HassConnect the page no longer flickers with a secondary reload after authentication.
- HassConnect will now allow you to change the hassUrl and ask you to re-login after it's changed, tokens are now stored by the hassUrl, previously if you changed your URL it would just fail to render and not ask you to login. Now when urls are different it'll ask you to login again.
- Now supports tree shaking - the library setup with the bundler is much more sophisticated now and will now bundle only the components you use in your application, this should reduce the size of the bundle significantly and should allow bundlers to perform caching mechanisms on the components.

## create-hakit v1.1.3
- Fixed issue where node > 18 was causing the type sync and deploy script to fail: [issue 120](https://github.com/shannonhochkins/ha-component-kit/issues/120)
- Added .nvmrc with the generated template to help indicate desired node version
- Added default haUrl value
- Better feedback / instructions in the terminal

## Storybook
- Fixed bug on FamilyCard where image wasn't rendering
- Added "person" entity to storybook to test new popup
- Added new demo for FamilyCard to show custom columns
- Documented "EntitiesCardRow" in storybook
- Upgraded storybook from 7 -> 8
- Added new logo to storybook

## General
- New logo! Linked to the repo and storybook
- Updated and tested most of the packages used within the repo that aren't peer dependencies
- Created new Discord server! [Join here](https://discord.gg/agQr9JKk)
- Updated the readme to include the new logo as well as links to the new discord server


# 3.1.4
## @hakit/components
- NEW - FamilyCard - a card that allows multiple person entities to render in a single card, this will also allow the user to long press and show the location of the person. Huge thanks to @jensea for introducing this feature!
- The same "location / map" functionality is also available when long pressing a row in the EntitiesCard if the entity entered is a "person" entity.
- BUGFIX - types for GarbageCollectionCard subtypes were previously not exported, now exported under GarbageCollectionCardTypes
- BUGFIX - automatic titles in modal have been fixed to convert to title case as well as allowing an override in the "modalProps" attribute for all cards.

## @hakit/core
- updating provider to allow global style overrides for new cards (FamilyCard, PersonCard)

# 3.1.4
## @hakit/components
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If you want to contribute, fix bugs, integrate new features you can work with @h
```shell
git clone https://github.com/shannonhochkins/ha-component-kit.git
cd ha-component-kit
npm install
npm install && npm run build
```

#### Local Storybook
Expand Down
2 changes: 1 addition & 1 deletion hakit/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
2 changes: 1 addition & 1 deletion hakit/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Hakit",
"version": "1.0.2",
"version": "1.0.3",
"slug": "hakit",
"init": false,
"ingress": true,
Expand Down
Binary file modified hakit/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified hakit/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7415804

Please sign in to comment.