@kipk/ha-better-history 0.1.0 → 0.1.1
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/README.md +51 -51
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -46,36 +46,36 @@ All properties are camelCase in JS and kebab-case as HTML attributes (for boolea
|
|
|
46
46
|
|
|
47
47
|
### Top-level attributes (HTML)
|
|
48
48
|
|
|
49
|
-
| Attribute | Type | Default
|
|
50
|
-
| -------------------- | --------- |
|
|
51
|
-
| `hours` | `number` | `24`
|
|
52
|
-
| `show-date-picker` | `boolean` | `false`
|
|
53
|
-
| `show-entity-picker` | `boolean` | `false`
|
|
54
|
-
| `show-import-button` | `boolean` | `false`
|
|
55
|
-
| `show-legend` | `boolean` | `true`
|
|
56
|
-
| `show-tooltip` | `boolean` | `true`
|
|
57
|
-
| `width` | `string` | `"100%"`
|
|
58
|
-
| `height` | `string` | —
|
|
59
|
-
| `line-mode` | `string` | `"stair"`
|
|
60
|
-
| `line-width` | `string` | `"2.5"`
|
|
61
|
-
| `background-color` | `string` | transparent | CSS background color for the component wrapper
|
|
62
|
-
| `graph-title` | `string` | —
|
|
63
|
-
| `title-font-family` | `string` | HA theme
|
|
64
|
-
| `title-font-size` | `string` | HA theme
|
|
65
|
-
| `title-color` | `string` | HA theme
|
|
66
|
-
| `language` | `string` | HA locale
|
|
67
|
-
| `tools-open` | `boolean` | `false`
|
|
49
|
+
| Attribute | Type | Default | Description |
|
|
50
|
+
| -------------------- | --------- | ----------- | --------------------------------------------------------------- |
|
|
51
|
+
| `hours` | `number` | `24` | Time range in hours before `endDate` |
|
|
52
|
+
| `show-date-picker` | `boolean` | `false` | Show `ha-date-range-picker` above the chart |
|
|
53
|
+
| `show-entity-picker` | `boolean` | `false` | Show entity picker + attribute browser |
|
|
54
|
+
| `show-import-button` | `boolean` | `false` | Show a JSON import button in the tools panel |
|
|
55
|
+
| `show-legend` | `boolean` | `true` | Legend below the chart |
|
|
56
|
+
| `show-tooltip` | `boolean` | `true` | Multi-series tooltip on hover |
|
|
57
|
+
| `width` | `string` | `"100%"` | CSS width of the component wrapper |
|
|
58
|
+
| `height` | `string` | — | CSS height; if omitted, computed from graph count |
|
|
59
|
+
| `line-mode` | `string` | `"stair"` | Global numeric display mode: `"stair"`, `"line"`, or `"column"` |
|
|
60
|
+
| `line-width` | `string` | `"2.5"` | Global SVG stroke width for numeric lines |
|
|
61
|
+
| `background-color` | `string` | transparent | CSS background color for the component wrapper |
|
|
62
|
+
| `graph-title` | `string` | — | Optional title above the chart |
|
|
63
|
+
| `title-font-family` | `string` | HA theme | Optional title font-family override |
|
|
64
|
+
| `title-font-size` | `string` | HA theme | Optional title font-size override |
|
|
65
|
+
| `title-color` | `string` | HA theme | Optional title color override |
|
|
66
|
+
| `language` | `string` | HA locale | Language code for labels (`"en"`, `"fr"`, …) |
|
|
67
|
+
| `tools-open` | `boolean` | `false` | Open/close the viewer tools panel from outside |
|
|
68
68
|
|
|
69
69
|
### JS-only properties
|
|
70
70
|
|
|
71
|
-
| Property | Type | Default | Description
|
|
72
|
-
| ---------------- | --------------------- | ----------- |
|
|
73
|
-
| `hass` | `HomeAssistant` | — | **Required.** The Home Assistant object
|
|
74
|
-
| `config` | `BetterHistoryConfig` | `undefined` | Full declarative configuration
|
|
75
|
-
| `entities` | `string[]` | `undefined` | Shortcut: entity IDs to plot their `state`
|
|
76
|
-
| `startDate` | `Date` | `undefined` | Lower bound (overrides `hours`)
|
|
77
|
-
| `endDate` | `Date` | `undefined` | Upper bound (default: now)
|
|
78
|
-
| `attributeUnits` | `AttributeUnitMap` | `undefined` | Map from attribute dot-paths to display units
|
|
71
|
+
| Property | Type | Default | Description |
|
|
72
|
+
| ---------------- | --------------------- | ----------- | --------------------------------------------- |
|
|
73
|
+
| `hass` | `HomeAssistant` | — | **Required.** The Home Assistant object |
|
|
74
|
+
| `config` | `BetterHistoryConfig` | `undefined` | Full declarative configuration |
|
|
75
|
+
| `entities` | `string[]` | `undefined` | Shortcut: entity IDs to plot their `state` |
|
|
76
|
+
| `startDate` | `Date` | `undefined` | Lower bound (overrides `hours`) |
|
|
77
|
+
| `endDate` | `Date` | `undefined` | Upper bound (default: now) |
|
|
78
|
+
| `attributeUnits` | `AttributeUnitMap` | `undefined` | Map from attribute dot-paths to display units |
|
|
79
79
|
|
|
80
80
|
If `endDate` is in the future, the component fetches and renders only up to the current time. The visible time axis then advances live until the requested end is reached, using current `hass.states` updates for entity and attribute points instead of refetching Home Assistant history for every update.
|
|
81
81
|
|
|
@@ -208,17 +208,17 @@ chart.config = {
|
|
|
208
208
|
|
|
209
209
|
All events bubble and are composed.
|
|
210
210
|
|
|
211
|
-
| Event
|
|
212
|
-
|
|
|
213
|
-
| `range-changed`
|
|
214
|
-
| `view-range-changed`
|
|
215
|
-
| `series-toggled`
|
|
216
|
-
| `series-added`
|
|
217
|
-
| `series-removed`
|
|
218
|
-
| `series-reordered`
|
|
219
|
-
| `data-imported`
|
|
220
|
-
| `tooltip-changed`
|
|
221
|
-
| `picker-overlay-changed` | `{ open: boolean }`
|
|
211
|
+
| Event | Detail | When |
|
|
212
|
+
| ------------------------ | -------------------------------------------------- | ------------------------------------------------------------- |
|
|
213
|
+
| `range-changed` | `{ startDate: Date, endDate: Date }` | Date picker changes |
|
|
214
|
+
| `view-range-changed` | `{ start: Date, end: Date }` | Tools range zoom changes without refetching history |
|
|
215
|
+
| `series-toggled` | `{ id: string, hidden: boolean }` | Legend item clicked |
|
|
216
|
+
| `series-added` | `{ source: HistorySource }` | User adds a series via entity picker |
|
|
217
|
+
| `series-removed` | `{ sourceId: string }` | User removes a non-default series |
|
|
218
|
+
| `series-reordered` | `{ sourceIds: string[] }` | User drags selected source chips into a new order |
|
|
219
|
+
| `data-imported` | `{ start: Date, end: Date, seriesCount: number }` | A `ha-better-history-series-v1` JSON file is imported |
|
|
220
|
+
| `tooltip-changed` | `{ time: number, values: TooltipValue[] } \| null` | Pointer moves over chart (useful for syncing multiple charts) |
|
|
221
|
+
| `picker-overlay-changed` | `{ open: boolean }` | Entity picker or attribute browser overlay opens/closes |
|
|
222
222
|
|
|
223
223
|
Legend toggles only keep visible series in the automatic numeric Y scale. Hidden numeric series remain available in the legend, but no longer stretch the scale for the displayed curves.
|
|
224
224
|
|
|
@@ -350,18 +350,18 @@ The optional import button accepts the same `ha-better-history-series-v1` JSON.
|
|
|
350
350
|
|
|
351
351
|
Override these on the host element to customize appearance.
|
|
352
352
|
|
|
353
|
-
| Property
|
|
354
|
-
|
|
|
355
|
-
| `--better-history-bg`
|
|
356
|
-
| `--better-history-text-color`
|
|
357
|
-
| `--better-history-muted-color`
|
|
358
|
-
| `--better-history-border-color`
|
|
359
|
-
| `--better-history-accent-color`
|
|
360
|
-
| `--better-history-radius`
|
|
361
|
-
| `--better-history-font-family`
|
|
362
|
-
| `--better-history-title-color`
|
|
363
|
-
| `--better-history-title-font-family` | `inherit`
|
|
364
|
-
| `--better-history-title-font-size`
|
|
353
|
+
| Property | Fallback |
|
|
354
|
+
| ------------------------------------ | ------------------------- |
|
|
355
|
+
| `--better-history-bg` | `--card-background-color` |
|
|
356
|
+
| `--better-history-text-color` | `--primary-text-color` |
|
|
357
|
+
| `--better-history-muted-color` | `--secondary-text-color` |
|
|
358
|
+
| `--better-history-border-color` | `--divider-color` |
|
|
359
|
+
| `--better-history-accent-color` | `--accent-color` |
|
|
360
|
+
| `--better-history-radius` | `8px` |
|
|
361
|
+
| `--better-history-font-family` | `inherit` |
|
|
362
|
+
| `--better-history-title-color` | `--primary-text-color` |
|
|
363
|
+
| `--better-history-title-font-family` | `inherit` |
|
|
364
|
+
| `--better-history-title-font-size` | `--ha-font-size-xl, 20px` |
|
|
365
365
|
|
|
366
366
|
## Loading / setup
|
|
367
367
|
|
|
@@ -397,7 +397,7 @@ Releases are created by pushing a version tag that matches `package.json` exactl
|
|
|
397
397
|
```bash
|
|
398
398
|
npm version 1.0.0 --no-git-tag-version
|
|
399
399
|
git tag 1.0.0
|
|
400
|
-
git push origin
|
|
400
|
+
git push origin maater --tags
|
|
401
401
|
```
|
|
402
402
|
|
|
403
403
|
Accepted tag formats are `1.0.0`, `1.0.0-rc1`, and `1.0.0-beta1`. Stable tags publish to the npm `latest` dist-tag; release candidates publish to `rc`; beta releases publish to `beta`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kipk/ha-better-history",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Standalone web component for Home Assistant history charts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "@KipK",
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
"typescript": "^5.6.3",
|
|
56
56
|
"vite": "^8.0.10"
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|