@inradius/solid-wc-hass-mixin 0.0.3 → 0.0.4
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 +1 -1
- package/dist/index.d.ts +1 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +12 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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
|
-
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 = { ...
|
|
9
|
-
},
|
|
10
|
-
return
|
|
11
|
-
},
|
|
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
|
-
|
|
17
|
+
d as default
|
|
16
18
|
};
|
package/dist/types.d.ts
ADDED
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inradius/solid-wc-hass-mixin",
|
|
3
3
|
"author": "Travis Stroud <travis.unfasten577@travisstroud.me>",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"description": "A Solid.js Home Assistant web component mixin.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
28
|
+
"@vitest/ui": "^2.1.0",
|
|
29
|
+
"jsdom": "^28.1.0",
|
|
27
30
|
"rimraf": "^6.0.0",
|
|
28
31
|
"vite": "^5.4.0",
|
|
29
|
-
"vite-plugin-dts": "^4.0.0"
|
|
32
|
+
"vite-plugin-dts": "^4.0.0",
|
|
33
|
+
"vitest": "^2.1.0",
|
|
34
|
+
"@inradius/solid-wc-utils-config": "0.0.0"
|
|
30
35
|
},
|
|
31
36
|
"peerDependencies": {
|
|
32
37
|
"component-register": "^0.8.0"
|
|
@@ -35,6 +40,10 @@
|
|
|
35
40
|
"scripts": {
|
|
36
41
|
"build": "vite build",
|
|
37
42
|
"dev": "vite build --watch",
|
|
38
|
-
"clean": "rimraf dist"
|
|
43
|
+
"clean": "rimraf dist",
|
|
44
|
+
"lint": "eslint src",
|
|
45
|
+
"lint:fix": "eslint src --fix",
|
|
46
|
+
"test": "vitest run --coverage",
|
|
47
|
+
"test:watch": "vitest"
|
|
39
48
|
}
|
|
40
49
|
}
|