@f-ewald/components 1.9.0 → 1.11.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.
@@ -0,0 +1,65 @@
1
+ # `<button-group>`
2
+
3
+ Single-select segmented control — a strip of buttons joined into one
4
+ shared-border shape, for a small, persistent set of mutually exclusive
5
+ choices (a view switcher, a theme picker) where the *currently selected*
6
+ option should read as visually "pressed," not just checked. For many
7
+ short, individually pill-shaped choices, use `radio-pills` instead. Wraps
8
+ native radio inputs for keyboard/a11y and fires `change` rather than
9
+ relying on form submission.
10
+
11
+ ## Install
12
+
13
+ ```js
14
+ import "@f-ewald/components/button-group.js";
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```html
20
+ <button-group></button-group>
21
+ <script type="module">
22
+ const el = document.querySelector("button-group");
23
+ el.options = [
24
+ { value: "list", label: "List" },
25
+ { value: "kanban", label: "Kanban" },
26
+ ];
27
+ el.value = "list";
28
+ el.addEventListener("change", (e) => console.log(e.detail.value));
29
+ </script>
30
+ ```
31
+
32
+ ## Attributes / properties
33
+
34
+ | Property | Attribute | Type | Default | Description |
35
+ | --- | --- | --- | --- | --- |
36
+ | `options` | _(JS property only)_ | `ButtonGroupOption[]` | `[]` | Options to render, one segment each. |
37
+ | `value` | `value` | `string` | `""` | Currently selected value. |
38
+ | `disabled` | `disabled` | `boolean` | `false` | Disables every native radio in the group. |
39
+ | `iconOnly` | `icon-only` | `boolean` | `false` | Hides labels visually (icons only) while keeping them as the accessible name. |
40
+
41
+ ## Events
42
+
43
+ | Event | Description |
44
+ | --- | --- |
45
+ | `change` | A segment was selected; detail: { value }. |
46
+
47
+ ## Slots
48
+
49
+ _None._
50
+
51
+ ## CSS custom properties
52
+
53
+ | Custom property |
54
+ | --- |
55
+ | `--ui-border` |
56
+ | `--ui-focus-ring` |
57
+ | `--ui-font` |
58
+ | `--ui-font-size-sm` |
59
+ | `--ui-font-weight-medium` |
60
+ | `--ui-line-height-tight` |
61
+ | `--ui-on-accent` |
62
+ | `--ui-primary` |
63
+ | `--ui-radius-sm` |
64
+ | `--ui-surface-muted` |
65
+ | `--ui-text` |
@@ -0,0 +1,73 @@
1
+ # `<markdown-view>`
2
+
3
+ Renders a markdown string as sanitized, styled HTML — headings, lists,
4
+ code, tables, blockquotes, and links all get token-driven styling, with
5
+ wide content (code blocks, tables) scrolling in its own container instead
6
+ of widening the page.
7
+
8
+ The markdown source is treated as untrusted: it is always parsed with
9
+ `marked` and sanitized with `DOMPurify` before being injected, never
10
+ rendered as-is.
11
+
12
+ ## Install
13
+
14
+ ```js
15
+ import "@f-ewald/components/markdown-view.js";
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```html
21
+ <markdown-view></markdown-view>
22
+ <script type="module">
23
+ const el = document.querySelector("markdown-view");
24
+ el.markdown = `## Release notes
25
+
26
+ - Added **markdown-view**
27
+ - Fixed a table alignment bug
28
+
29
+ \`\`\`ts
30
+ const x = 1;
31
+ \`\`\`
32
+
33
+ | Component | Status |
34
+ | --- | --- |
35
+ | markdown-view | New |
36
+
37
+ See the [changelog](#markdown-view) for details.`;
38
+ </script>
39
+ ```
40
+
41
+ ## Attributes / properties
42
+
43
+ | Property | Attribute | Type | Default | Description |
44
+ | --- | --- | --- | --- | --- |
45
+ | `markdown` | `markdown` | `string` | `""` | Raw markdown source to render. |
46
+
47
+ ## Events
48
+
49
+ _None._
50
+
51
+ ## Slots
52
+
53
+ _None._
54
+
55
+ ## CSS custom properties
56
+
57
+ | Custom property |
58
+ | --- |
59
+ | `--ui-border` |
60
+ | `--ui-font` |
61
+ | `--ui-font-mono` |
62
+ | `--ui-font-size` |
63
+ | `--ui-font-size-lg` |
64
+ | `--ui-font-size-sm` |
65
+ | `--ui-font-weight-semibold` |
66
+ | `--ui-line-height-normal` |
67
+ | `--ui-line-height-tight` |
68
+ | `--ui-primary` |
69
+ | `--ui-primary-hover` |
70
+ | `--ui-radius-sm` |
71
+ | `--ui-surface-muted` |
72
+ | `--ui-text` |
73
+ | `--ui-text-muted` |
package/docs/ui-button.md CHANGED
@@ -35,6 +35,7 @@ import "@f-ewald/components/ui-button.js";
35
35
  | Property | Attribute | Type | Default | Description |
36
36
  | --- | --- | --- | --- | --- |
37
37
  | `variant` | `variant` | `ButtonVariant` | `"primary"` | Visual weight. |
38
+ | `size` | `size` | `"sm" | "md"` | `"md"` | Size — `sm` reduces height/padding/font-size one step below the default. |
38
39
  | `href` | `href` | `string | null` | `null` | Renders an `<a href="...">` instead of a `<button>` when set. |
39
40
  | `type` | `type` | `"button" | "submit" | "reset"` | `"button"` | Native button `type`. Ignored when `href` is set. |
40
41
  | `disabled` | `disabled` | `boolean` | `false` | Disables the control and dims it. |
@@ -61,6 +62,7 @@ _None._
61
62
  | `--ui-focus-ring` |
62
63
  | `--ui-font` |
63
64
  | `--ui-font-size-sm` |
65
+ | `--ui-font-size-xs` |
64
66
  | `--ui-font-weight-medium` |
65
67
  | `--ui-line-height-tight` |
66
68
  | `--ui-on-accent` |
package/llms.txt CHANGED
@@ -212,6 +212,36 @@ Example:
212
212
  </script>
213
213
  ```
214
214
 
215
+ ## <button-group>
216
+
217
+ Single-select segmented control — a strip of buttons joined into one
218
+ shared-border shape, for a small, persistent set of mutually exclusive
219
+ choices (a view switcher, a theme picker) where the *currently selected*
220
+ option should read as visually "pressed," not just checked. For many
221
+ short, individually pill-shaped choices, use `radio-pills` instead. Wraps
222
+ native radio inputs for keyboard/a11y and fires `change` rather than
223
+ relying on form submission.
224
+
225
+ Import: `import "@f-ewald/components/button-group.js";`
226
+
227
+ Properties: `options` (JS property only) : ButtonGroupOption[], default []; `value` (attribute `value`) : string, default ""; `disabled` (attribute `disabled`) : boolean, default false; `iconOnly` (attribute `icon-only`) : boolean, default false
228
+ Events: `change`
229
+ CSS custom properties: `--ui-border`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`
230
+
231
+ Example:
232
+ ```html
233
+ <button-group></button-group>
234
+ <script type="module">
235
+ const el = document.querySelector("button-group");
236
+ el.options = [
237
+ { value: "list", label: "List" },
238
+ { value: "kanban", label: "Kanban" },
239
+ ];
240
+ el.value = "list";
241
+ el.addEventListener("change", (e) => console.log(e.detail.value));
242
+ </script>
243
+ ```
244
+
215
245
  ## <calendar-entry>
216
246
 
217
247
  Declarative metadata for one calendar event, consumed by a parent
@@ -922,6 +952,45 @@ Example:
922
952
  <map-pin color="#22c55e" size="26" highlighted>🏠</map-pin>
923
953
  ```
924
954
 
955
+ ## <markdown-view>
956
+
957
+ Renders a markdown string as sanitized, styled HTML — headings, lists,
958
+ code, tables, blockquotes, and links all get token-driven styling, with
959
+ wide content (code blocks, tables) scrolling in its own container instead
960
+ of widening the page.
961
+
962
+ The markdown source is treated as untrusted: it is always parsed with
963
+ `marked` and sanitized with `DOMPurify` before being injected, never
964
+ rendered as-is.
965
+
966
+ Import: `import "@f-ewald/components/markdown-view.js";`
967
+
968
+ Properties: `markdown` (attribute `markdown`) : string, default ""
969
+ Events: none
970
+ CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-mono`, `--ui-font-size`, `--ui-font-size-lg`, `--ui-font-size-sm`, `--ui-font-weight-semibold`, `--ui-line-height-normal`, `--ui-line-height-tight`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
971
+
972
+ Example:
973
+ ```html
974
+ <markdown-view></markdown-view>
975
+ <script type="module">
976
+ const el = document.querySelector("markdown-view");
977
+ el.markdown = `## Release notes
978
+
979
+ - Added **markdown-view**
980
+ - Fixed a table alignment bug
981
+
982
+ \`\`\`ts
983
+ const x = 1;
984
+ \`\`\`
985
+
986
+ | Component | Status |
987
+ | --- | --- |
988
+ | markdown-view | New |
989
+
990
+ See the [changelog](#markdown-view) for details.`;
991
+ </script>
992
+ ```
993
+
925
994
  ## <multi-select>
926
995
 
927
996
  A form-associated multi-select: a trigger showing a compact summary of the
@@ -1482,9 +1551,9 @@ is instead wired through `ElementInternals.form` — the same mechanism
1482
1551
 
1483
1552
  Import: `import "@f-ewald/components/ui-button.js";`
1484
1553
 
1485
- Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
1554
+ Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
1486
1555
  Events: none
1487
- CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
1556
+ CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
1488
1557
 
1489
1558
  Example:
1490
1559
  ```html
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "1.9.0",
4
+ "version": "1.11.0",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -63,7 +63,9 @@
63
63
  "d3-array": "^3.2.4",
64
64
  "d3-scale": "^4.0.2",
65
65
  "d3-shape": "^3.2.0",
66
+ "dompurify": "^3.4.12",
66
67
  "lit": "^3.3.3",
68
+ "marked": "^18.0.7",
67
69
  "zod": "^4.4.3"
68
70
  },
69
71
  "publishConfig": {