@inradius/solid-wc-hass-mixin 0.0.3 → 1.0.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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const a=n=>{const{defaultConfig:i={},customCard:c,cardSize:u=3}=n;return o=>{const r=o.prototype,t=window;return t.customCards=t.customCards||[],r.setConfig=function(s){if(!s)throw new Error("Invalid configuration");this.config={...i,...s}},r.getCardSize=function(){return u},t.customCards.push({...c}),o}};module.exports=a;
1
+ "use strict";const u=new Set(["__proto__","constructor","prototype"]),n=r=>Object.fromEntries(Object.entries(r).filter(([o])=>!u.has(o))),d=r=>{const{cardSize:o=3,customCard:c,defaultConfig:a={}}=r;return e=>{const i=e.prototype,s=window;return s.customCards=s.customCards||[],i.setConfig=function(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid configuration");this.config={...n(a),...n(t)}},i.getCardSize=function(){return o},s.customCards.push(n(c)),e}};module.exports=d;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,5 @@
1
1
  import { ComponentType } from 'component-register';
2
- export interface LovelaceCardConfig {
3
- type: string;
4
- [key: string]: unknown;
5
- }
6
- export interface CustomCardEntry {
7
- type: string;
8
- name: string;
9
- description: string;
10
- preview?: boolean;
11
- }
12
- export interface HomeAssistantOptions {
13
- defaultConfig?: Record<string, unknown>;
14
- customCard: CustomCardEntry;
15
- cardSize?: number;
16
- }
2
+ import { HomeAssistantOptions } from './types';
17
3
  declare const withHomeAssistant: (options: HomeAssistantOptions) => <T>(ElementType: ComponentType<T>) => ComponentType<T>;
18
4
  export default withHomeAssistant;
19
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,UAAU,EAAE,eAAe,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAQD,QAAA,MAAM,iBAAiB,GAAI,SAAS,oBAAoB,MAG9C,CAAC,EAAE,aAAa,aAAa,CAAC,CAAC,CAAC,KAAG,aAAa,CAAC,CAAC,CAqB3D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAEL,oBAAoB,EAErB,MAAM,SAAS,CAAC;AASjB,QAAA,MAAM,iBAAiB,GAAI,SAAS,oBAAoB,MAG9C,CAAC,EAAE,aAAa,aAAa,CAAC,CAAC,CAAC,KAAG,aAAa,CAAC,CAAC,CAqB3D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,16 +1,18 @@
1
- const c = (s) => {
2
- const { defaultConfig: i = {}, customCard: u, cardSize: a = 3 } = s;
3
- return (o) => {
4
- const r = o.prototype, t = window;
5
- return t.customCards = t.customCards || [], r.setConfig = function(n) {
6
- if (!n)
1
+ const u = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]), n = (o) => Object.fromEntries(
2
+ Object.entries(o).filter(([r]) => !u.has(r))
3
+ ), d = (o) => {
4
+ const { cardSize: r = 3, customCard: c, defaultConfig: a = {} } = o;
5
+ return (e) => {
6
+ const i = e.prototype, s = window;
7
+ return s.customCards = s.customCards || [], i.setConfig = function(t) {
8
+ if (!t || typeof t != "object" || Array.isArray(t))
7
9
  throw new Error("Invalid configuration");
8
- this.config = { ...i, ...n };
9
- }, r.getCardSize = function() {
10
- return a;
11
- }, t.customCards.push({ ...u }), o;
10
+ this.config = { ...n(a), ...n(t) };
11
+ }, i.getCardSize = function() {
12
+ return r;
13
+ }, s.customCards.push(n(c)), e;
12
14
  };
13
15
  };
14
16
  export {
15
- c as default
17
+ d as default
16
18
  };
@@ -0,0 +1,22 @@
1
+ export interface CustomCardEntry {
2
+ [key: string]: unknown;
3
+ description: string;
4
+ name: string;
5
+ preview?: boolean;
6
+ type: string;
7
+ }
8
+ export interface HomeAssistantElement extends HTMLElement {
9
+ config?: LovelaceCardConfig;
10
+ getCardSize(): number;
11
+ setConfig(config: LovelaceCardConfig): void;
12
+ }
13
+ export interface HomeAssistantOptions {
14
+ cardSize?: number;
15
+ customCard: CustomCardEntry;
16
+ defaultConfig?: Record<string, unknown>;
17
+ }
18
+ export interface LovelaceCardConfig {
19
+ [key: string]: unknown;
20
+ type: string;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,WAAW,IAAI,MAAM,CAAC;IACtB,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd"}
package/package.json CHANGED
@@ -1,8 +1,18 @@
1
1
  {
2
2
  "name": "@inradius/solid-wc-hass-mixin",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
3
5
  "author": "Travis Stroud <travis.unfasten577@travisstroud.me>",
4
- "version": "0.0.3",
5
6
  "description": "A Solid.js Home Assistant web component mixin.",
7
+ "keywords": [
8
+ "custom-elements",
9
+ "hass",
10
+ "home-assistant",
11
+ "mixin",
12
+ "solid",
13
+ "solidjs",
14
+ "web-components"
15
+ ],
6
16
  "repository": {
7
17
  "type": "git",
8
18
  "url": "git+https://github.com/inradius/solid-wc-utils-monorepo.git",
@@ -24,17 +34,28 @@
24
34
  "dist"
25
35
  ],
26
36
  "devDependencies": {
37
+ "@vitest/coverage-v8": "^2.1.9",
38
+ "@vitest/ui": "^2.1.0",
39
+ "jsdom": "^28.1.0",
27
40
  "rimraf": "^6.0.0",
28
41
  "vite": "^5.4.0",
29
- "vite-plugin-dts": "^4.0.0"
42
+ "vite-plugin-dts": "^4.0.0",
43
+ "vitest": "^2.1.0",
44
+ "@inradius/solid-wc-utils-config": "0.0.0"
30
45
  },
31
46
  "peerDependencies": {
32
47
  "component-register": "^0.8.0"
33
48
  },
34
- "license": "MIT",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
35
52
  "scripts": {
36
53
  "build": "vite build",
37
54
  "dev": "vite build --watch",
38
- "clean": "rimraf dist"
55
+ "clean": "rimraf dist",
56
+ "lint": "eslint src",
57
+ "lint:fix": "eslint src --fix",
58
+ "test": "vitest run --coverage",
59
+ "test:watch": "vitest"
39
60
  }
40
61
  }