@reykjavik/webtools 0.3.10 → 0.3.11

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/CHANGELOG.md CHANGED
@@ -4,19 +4,19 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
- ## 0.3.10
7
+ ## 0.3.11
8
8
 
9
9
  _2026-03-16_
10
10
 
11
11
  - `@reykjavik/webtools/alertsStore/react`:
12
- - fix: Add missing `onClick` prop to `LinkRendererProps`
12
+ - feat: Support rendering `br` and `em` elements in alert messages
13
13
 
14
- ## 0.3.7 – 0.3.9
14
+ ## 0.3.7 – 0.3.10
15
15
 
16
16
  _2026-03-16_
17
17
 
18
18
  - feat: Add `@reykjavik/webtools/alertsStore` for toasts and other global UI
19
- feedback messages along with helpers
19
+ feedback messages along with `@reykjavik/webtools/alertsStore/react` helpers
20
20
 
21
21
  ## 0.3.6
22
22
 
package/README.md CHANGED
@@ -1167,8 +1167,8 @@ import { Toast } from '../components/Toast';
1167
1167
  `renderAlertMessage(message: AlertInfo['message'], onLinkClick?: (e: MouseEvent) => void, linkComponent?: renderAlertMessage.LinkRenderer): ReactNode`
1168
1168
 
1169
1169
  Helper to render an alerter alert message, which can be a simple string or a
1170
- more complex array of strings and objects representing links and rich (bold)
1171
- text formatting.
1170
+ more complex array of strings and objects representing links, `br` elements
1171
+ and rich (`strong`/`em`) text formatting.
1172
1172
 
1173
1173
  You can optionally pass an additional `onLinkClick` handler as a second
1174
1174
  parameter. (For example the alert's `dismiss` dispatcher.)
@@ -7,7 +7,9 @@ declare const messageSchema: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySc
7
7
  readonly hrefLang: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
8
8
  readonly lang: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
9
9
  }, undefined>, v.ObjectSchema<{
10
- readonly tag: v.LiteralSchema<"strong", undefined>;
10
+ readonly tag: v.LiteralSchema<"br", undefined>;
11
+ }, undefined>, v.ObjectSchema<{
12
+ readonly tag: v.PicklistSchema<["strong", "em"], undefined>;
11
13
  readonly text: v.StringSchema<undefined>;
12
14
  }, undefined>], undefined>, undefined>], undefined>;
13
15
  export type AlertMessage = v.InferOutput<typeof messageSchema>;
@@ -50,9 +50,13 @@ const messageSchema = v.union([
50
50
  hrefLang: v.optional(v.string()),
51
51
  lang: v.optional(v.string()),
52
52
  }),
53
+ // line break elements
54
+ v.object({
55
+ tag: v.literal('br'),
56
+ }),
53
57
  // strong/bold elements
54
58
  v.object({
55
- tag: v.literal('strong'),
59
+ tag: v.picklist(['strong', 'em']),
56
60
  text: v.string(),
57
61
  }),
58
62
  ])),
@@ -81,6 +81,9 @@ const renderAlertMessage = (message, onLinkClick, linkComponent) => {
81
81
  react_1.default.createElement(Link, { key: i, ...linkProps, onClick: onLinkClick && ((e) => onLinkClick(e)) }, text),
82
82
  ];
83
83
  }
84
+ if (part.tag === 'br') {
85
+ return react_1.default.createElement("br", { key: i });
86
+ }
84
87
  return [' ', react_1.default.createElement(part.tag, { key: i }, part.text)];
85
88
  });
86
89
  };
@@ -7,7 +7,9 @@ declare const messageSchema: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySc
7
7
  readonly hrefLang: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
8
8
  readonly lang: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
9
9
  }, undefined>, v.ObjectSchema<{
10
- readonly tag: v.LiteralSchema<"strong", undefined>;
10
+ readonly tag: v.LiteralSchema<"br", undefined>;
11
+ }, undefined>, v.ObjectSchema<{
12
+ readonly tag: v.PicklistSchema<["strong", "em"], undefined>;
11
13
  readonly text: v.StringSchema<undefined>;
12
14
  }, undefined>], undefined>, undefined>], undefined>;
13
15
  export type AlertMessage = v.InferOutput<typeof messageSchema>;
@@ -14,9 +14,13 @@ const messageSchema = v.union([
14
14
  hrefLang: v.optional(v.string()),
15
15
  lang: v.optional(v.string()),
16
16
  }),
17
+ // line break elements
18
+ v.object({
19
+ tag: v.literal('br'),
20
+ }),
17
21
  // strong/bold elements
18
22
  v.object({
19
- tag: v.literal('strong'),
23
+ tag: v.picklist(['strong', 'em']),
20
24
  text: v.string(),
21
25
  }),
22
26
  ])),
@@ -44,6 +44,9 @@ export const renderAlertMessage = (message, onLinkClick, linkComponent) => {
44
44
  React.createElement(Link, { key: i, ...linkProps, onClick: onLinkClick && ((e) => onLinkClick(e)) }, text),
45
45
  ];
46
46
  }
47
+ if (part.tag === 'br') {
48
+ return React.createElement("br", { key: i });
49
+ }
47
50
  return [' ', React.createElement(part.tag, { key: i }, part.text)];
48
51
  });
49
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/webtools",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Misc. JS/TS helpers used by Reykjavík City's web dev teams.",
5
5
  "main": "index.js",
6
6
  "repository": "ssh://git@github.com:reykjavikcity/webtools.git",