Skip to content

Commit a36859c

Browse files
Feature/3.1.5 (shannonhochkins#127)
* refactoring * Update README.md * adding code of conduct * Update README.md * Update README.md * Will cleanup after npm upgrade has worked * Dumb storybook fixed * removing dead code * Refactoring core and components for tree shaking * updating after revision
1 parent 5708c5f commit a36859c

File tree

103 files changed

+12737
-27226
lines changed

Some content is hidden

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

103 files changed

+12737
-27226
lines changed

.d.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
declare module '*.svg' {
1+
declare module '*.png' {
22
const value: any;
33
export = value;
44
}
5+
56
declare module '*.jpg' {
6-
const value: any;
7+
const value: string;
78
export = value;
89
}
9-
declare module '*.npg' {
10-
const value: any;
11-
export = value;
10+
11+
declare module "*.svg?react" {
12+
import * as React from "react";
13+
14+
const ReactComponent: React.FunctionComponent<
15+
React.ComponentProps<"svg"> & { title?: string }
16+
>;
17+
18+
export default ReactComponent;
1219
}

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

.storybook/main.ts

-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export default ({
3030
docs: {
3131
autodocs: 'tag'
3232
},
33-
features: {
34-
storyStoreV7: true
35-
},
3633
typescript: {
3734
check: true,
3835
reactDocgen: 'react-docgen-typescript',

.storybook/manager.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { create } from '@storybook/theming/create';
2+
import { addons } from '@storybook/manager-api';
23

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

11-
import { addons } from '@storybook/manager-api';
12-
1312
addons.setConfig({
1413
panelPosition: 'right',
1514
showPanel: true,

.storybook/preview.tsx

+27-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
import type { Preview } from "@storybook/react";
22
import { Title, Description, Primary, ArgTypes } from "@storybook/blocks";
33
import React from "react";
4+
import { withThemeFromJSXProvider } from '@storybook/addon-themes';
5+
import { ThemeProvider } from '@storybook/theming';
46
import './global.css';
57

8+
const THEME = {
9+
typography: {
10+
fonts: {
11+
base: 'Arial, sans-serif',
12+
mono: 'Courier, monospace'
13+
}
14+
}
15+
};
16+
617
export default {
718
decorators: [
19+
withThemeFromJSXProvider({
20+
themes: {
21+
dark: THEME,
22+
light: THEME,
23+
},
24+
defaultTheme: 'dark',
25+
Provider: ThemeProvider,
26+
}),
827
(Story, args) => {
928
const centered = args.parameters.centered ? {
1029
width: '100%',
@@ -14,18 +33,20 @@ export default {
1433
} : {};
1534
if (window.parent) {
1635
const parentDocument = window.parent.document;
36+
const logo = parentDocument.querySelector('.sidebar-header div img') as HTMLElement;
37+
if (logo) {
38+
logo.style.maxWidth = '100%';
39+
}
1740
const panel = parentDocument.getElementById('storybook-panel-root');
1841
if (args.parameters?.addons?.showPanel === false && panel !== null && panel.parentElement !== null) {
1942
panel.parentElement.style.display = 'none';
20-
if (panel.parentElement.parentElement?.previousElementSibling) {
21-
// @ts-ignore - it's correct.
22-
panel.parentElement.parentElement.previousElementSibling.style.width = '100%';
23-
// @ts-ignore - it's correct.
24-
panel.parentElement.parentElement.previousElementSibling.style.height = '100%';
25-
}
2643
} else if (panel !== null && panel.parentElement !== null) {
2744
panel.parentElement.style.display = 'flex';
2845
}
46+
const previewer = parentDocument.querySelector('#root div div:has(main)') as HTMLElement;
47+
if (previewer !== null) {
48+
previewer.style.height = '100dvh';
49+
}
2950
}
3051
if (args.parameters.standalone) {
3152
return <Story />;
@@ -45,7 +66,6 @@ export default {
4566
],
4667

4768
parameters: {
48-
actions: { argTypesRegex: "^on[A-Z].*" },
4969
layout: 'centered',
5070
controls: {
5171
matchers: {

ADDON.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# HAKIT Dashboard Addon
1+
# HAKIT Dashboard Addon (WIP)
22

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

CHANGELOG.md

+46
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
# 3.1.5
2+
## @hakit/components
3+
- 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.
4+
- few issues with nextjs where window was used in the incorrect context, this has been fixed
5+
- Removed lazy import for the PersonControls popup as this is ignored as the popup uses static exports that are not dynamically exported
6+
- 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.
7+
- 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.
8+
9+
## @hakit/core
10+
- 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)
11+
- 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.
12+
- Fixed some typescript problems with components returning JSX.Element instead of React.ReactNode
13+
- After the refactor of HassConnect the page no longer flickers with a secondary reload after authentication.
14+
- 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.
15+
- 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.
16+
17+
## create-hakit v1.1.3
18+
- 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)
19+
- Added .nvmrc with the generated template to help indicate desired node version
20+
- Added default haUrl value
21+
- Better feedback / instructions in the terminal
22+
23+
## Storybook
24+
- Fixed bug on FamilyCard where image wasn't rendering
25+
- Added "person" entity to storybook to test new popup
26+
- Added new demo for FamilyCard to show custom columns
27+
- Documented "EntitiesCardRow" in storybook
28+
- Upgraded storybook from 7 -> 8
29+
- Added new logo to storybook
30+
31+
## General
32+
- New logo! Linked to the repo and storybook
33+
- Updated and tested most of the packages used within the repo that aren't peer dependencies
34+
- Created new Discord server! [Join here](https://discord.gg/agQr9JKk)
35+
- Updated the readme to include the new logo as well as links to the new discord server
36+
37+
38+
# 3.1.4
39+
## @hakit/components
40+
- 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!
41+
- The same "location / map" functionality is also available when long pressing a row in the EntitiesCard if the entity entered is a "person" entity.
42+
- BUGFIX - types for GarbageCollectionCard subtypes were previously not exported, now exported under GarbageCollectionCardTypes
43+
- 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.
44+
45+
## @hakit/core
46+
- updating provider to allow global style overrides for new cards (FamilyCard, PersonCard)
147

248
# 3.1.4
349
## @hakit/components

CODE_OF_CONDUCT.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement via Discord.
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
117+
version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
118+
119+
Community Impact Guidelines were inspired by
120+
[Mozilla's code of conduct enforcement ladder](https://opensource.creativecommons.org/community/code-of-conduct/enforcement/).
121+
122+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at
123+
[https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ If you want to contribute, fix bugs, integrate new features you can work with @h
55
```shell
66
git clone https://github.com/shannonhochkins/ha-component-kit.git
77
cd ha-component-kit
8-
npm install
8+
npm install && npm run build
99
```
1010

1111
#### Local Storybook

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<table>
22
<tr>
3-
<td><img src="https://cdn.discordapp.com/icons/1231534799248691252/4b6124f952f099f855b5186d8a68f33e.webp?size=100" alt="LOGO"></td>
3+
<td width="127"><img src="https://cdn.discordapp.com/icons/1231534799248691252/4b6124f952f099f855b5186d8a68f33e.webp?size=100" alt="LOGO" ></td>
44
<td><h1>HA COMPONENT KIT</h1></td>
55
</tr>
66
</table>
77
<p align="left">
88
<a aria-label="@HAKIT/CORE" href="https://www.npmjs.com/package/@hakit/core">
9-
<img alt="" src="https://img.shields.io/npm/v/@hakit/core.svg?style=for-the-badge&labelColor=000000">
9+
<img alt="" src="https://img.shields.io/npm/v/@hakit/core.svg?style=for-the-badge&labelColor=000000&label=@hakit/CORE">
1010
</a>
1111
<a aria-label="@HAKIT/COMPONENTS" href="https://www.npmjs.com/package/@hakit/components">
12-
<img alt="" src="https://img.shields.io/npm/v/@hakit/components.svg?style=for-the-badge&labelColor=000000">
12+
<img alt="" src="https://img.shields.io/npm/v/@hakit/components.svg?style=for-the-badge&labelColor=000000&label=@HAKIT/COMPONENTS">
1313
</a>
1414
<a aria-label="Join the community on Discord" href="https://discord.gg/agQr9JKk">
1515
<img alt="" src="https://img.shields.io/badge/Join%20the%20Discord-blueviolet.svg?style=for-the-badge&logo=Discord&labelColor=000000&logoWidth=20">

hakit/.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
20

hakit/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Hakit",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"slug": "hakit",
55
"init": false,
66
"ingress": true,

hakit/icon.png

20.5 KB
Loading

hakit/logo.png

20.5 KB
Loading

0 commit comments

Comments
 (0)