@htmlbricks/hb-gauge 0.71.35 → 0.71.37

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 CHANGED
@@ -1,34 +1,53 @@
1
- ## `hb-gauge` — gauge
1
+ # hb-gauge
2
2
 
3
- **Category:** data
4
- **Tags:** data, chart
3
+ **Category:** data · **Tags:** data, chart
5
4
 
6
- ### What it does
5
+ ## Summary
7
6
 
8
- SVG gauge wrapper around JustGage: pass JustGage-compatible options as JSON (`value`, min/max, labels, colors, etc.). The gauge is created on the shadow host after mount, destroyed on teardown, and recreated when `options` changes or the window resizes (debounced) so it stays sized correctly.
7
+ **JustGage** SVG gauge inside the shadow root: pass **`options`** as JSON (or object from JS). Created on mount, destroyed on teardown, recreated on window **resize** (200 ms debounce) and when **`options`** is reparsed from a string.
9
8
 
10
- ### Custom element
9
+ ## Custom element
11
10
 
12
11
  `hb-gauge`
13
12
 
14
- ### Attributes (snake_case; use string values in HTML)
13
+ ## Attributes
15
14
 
16
- - `id` optional string
17
- - `style` optional string
18
- - `options` required string (JSON object; at minimum `value`, `min`, `max`; additional keys follow JustGage)
15
+ | Attribute | Type (logical) | HTML / notes |
16
+ | --- | --- | --- |
17
+ | `options` | `string` \| `GaugeOptions` | **Required** for a useful chart. Merged with `{ element: #gauge }` before JustGage. Minimum: **`value`**, **`min`**, **`max`**; extra keys follow JustGage. |
18
+ | `id` | `string` (optional) | |
19
+ | `style` | `string` (optional) | Typings only; host `style` still applies to `<hb-gauge>`. |
19
20
 
20
- ### Events
21
+ ## Custom events
21
22
 
22
- None declared on the component type.
23
+ **None** `Events` is `{}`.
23
24
 
24
- ### Usage notes
25
+ ## Styling
25
26
 
26
- CSS part: `gauge`. `options` may be passed as a JSON string; the component parses it when needed.
27
+ ### CSS custom properties (`extra/docs.ts`)
27
28
 
28
- ### Minimal HTML example
29
+ | Variable | Role |
30
+ | --- | --- |
31
+ | `--hb-gauge-min-height` | Reserved vertical space on `:host` before paint. |
32
+
33
+ ### CSS parts (`extra/docs.ts`)
34
+
35
+ | Part | Role |
36
+ | --- | --- |
37
+ | `gauge` | Mount node `#gauge` (`width: 100%`). |
38
+
39
+ ### Slots
40
+
41
+ **None.**
42
+
43
+ Bulma is bundled for consistency; the visible dial is SVG from JustGage.
44
+
45
+ ## TypeScript
46
+
47
+ `types/webcomponent.type.d.ts` — `Component`, `IGauge`, `GaugeOptions`, `Events`.
48
+
49
+ ## Minimal HTML example
29
50
 
30
51
  ```html
31
- <hb-gauge
32
- options="{&quot;value&quot;:50,&quot;min&quot;:0,&quot;max&quot;:100}"
33
- ></hb-gauge>
52
+ <hb-gauge options='{"value":50,"min":0,"max":100}'></hb-gauge>
34
53
  ```
package/manifest.json CHANGED
@@ -21,7 +21,15 @@
21
21
  "type": "string"
22
22
  },
23
23
  "options": {
24
- "$ref": "#/definitions/IGauge"
24
+ "anyOf": [
25
+ {
26
+ "type": "string"
27
+ },
28
+ {
29
+ "$ref": "#/definitions/GaugeOptions"
30
+ }
31
+ ],
32
+ "description": "JSON string from HTML, or an object when set from JavaScript."
25
33
  },
26
34
  "style": {
27
35
  "type": "string"
@@ -32,8 +40,8 @@
32
40
  ],
33
41
  "type": "object"
34
42
  },
35
- "IGauge": {
36
- "additionalProperties": false,
43
+ "GaugeOptions": {
44
+ "description": "JustGage constructor options merged with `{ element }` in the component.",
37
45
  "properties": {
38
46
  "max": {
39
47
  "type": "number"
@@ -46,9 +54,9 @@
46
54
  }
47
55
  },
48
56
  "required": [
49
- "value",
57
+ "max",
50
58
  "min",
51
- "max"
59
+ "value"
52
60
  ],
53
61
  "type": "object"
54
62
  }
@@ -64,11 +72,18 @@
64
72
  }
65
73
  },
66
74
  "styleSetup": {
67
- "vars": [],
75
+ "vars": [
76
+ {
77
+ "name": "--hb-gauge-min-height",
78
+ "valueType": "number",
79
+ "defaultValue": "0",
80
+ "description": "Minimum height of the host element before JustGage draws."
81
+ }
82
+ ],
68
83
  "parts": [
69
84
  {
70
85
  "name": "gauge",
71
- "description": ""
86
+ "description": "JustGage mount node (`#gauge`); style width/height or overflow for the SVG gauge."
72
87
  }
73
88
  ]
74
89
  },
@@ -141,5 +156,5 @@
141
156
  "size": {},
142
157
  "iifePath": "main.iife.js",
143
158
  "repoName": "@htmlbricks/hb-gauge",
144
- "version": "0.71.35"
159
+ "version": "0.71.37"
145
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlbricks/hb-gauge",
3
- "version": "0.71.35",
3
+ "version": "0.71.37",
4
4
  "contributors": [],
5
5
  "description": "SVG gauge wrapper around JustGage: pass JustGage-compatible options as JSON (`value`, min/max, labels, colors, etc.). The gauge is created on the shadow host after mount, destroyed on teardown, and recreated when `options` changes or the window resizes (debounced) so it stays sized correctly.",
6
6
  "licenses": [
@@ -9,7 +9,15 @@
9
9
  "type": "string"
10
10
  },
11
11
  "options": {
12
- "$ref": "#/definitions/IGauge"
12
+ "anyOf": [
13
+ {
14
+ "type": "string"
15
+ },
16
+ {
17
+ "$ref": "#/definitions/GaugeOptions"
18
+ }
19
+ ],
20
+ "description": "JSON string from HTML, or an object when set from JavaScript."
13
21
  },
14
22
  "style": {
15
23
  "type": "string"
@@ -20,8 +28,8 @@
20
28
  ],
21
29
  "type": "object"
22
30
  },
23
- "IGauge": {
24
- "additionalProperties": false,
31
+ "GaugeOptions": {
32
+ "description": "JustGage constructor options merged with `{ element }` in the component.",
25
33
  "properties": {
26
34
  "max": {
27
35
  "type": "number"
@@ -34,9 +42,9 @@
34
42
  }
35
43
  },
36
44
  "required": [
37
- "value",
45
+ "max",
38
46
  "min",
39
- "max"
47
+ "value"
40
48
  ],
41
49
  "type": "object"
42
50
  }
@@ -4,10 +4,14 @@ export type IGauge = {
4
4
  max: number;
5
5
  };
6
6
 
7
+ /** JustGage constructor options merged with `{ element }` in the component. */
8
+ export type GaugeOptions = IGauge & Record<string, unknown>;
9
+
7
10
  export type Component = {
8
11
  id?: string;
9
12
  style?: string;
10
- options: IGauge;
13
+ /** JSON string from HTML, or an object when set from JavaScript. */
14
+ options: string | GaugeOptions;
11
15
  };
12
16
 
13
17
  export type Events = {};