@hhkaos/webmentions-widget 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.
Files changed (2) hide show
  1. package/package.json +5 -1
  2. package/src/react.js +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hhkaos/webmentions-widget",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Framework-agnostic, dependency-free widget to fetch and render webmention.io mentions for the current page.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,5 +49,9 @@
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
52
+ },
53
+ "devDependencies": {
54
+ "react": "^18.3.1",
55
+ "react-dom": "^18.3.1"
52
56
  }
53
57
  }
package/src/react.js CHANGED
@@ -197,6 +197,9 @@ export function Webmentions({
197
197
  locale,
198
198
  maxLength,
199
199
  classNames: classNameOverrides = {},
200
+ // Optional wrapper inside the <aside>, for hosts whose layout CSS keys off a
201
+ // width-constraining element (Docusaurus's `.container`, for example).
202
+ innerClassName = null,
200
203
  renderEmpty = null,
201
204
  renderError = null,
202
205
  ...options
@@ -216,14 +219,12 @@ export function Webmentions({
216
219
  return renderEmpty ? renderEmpty() : null;
217
220
  }
218
221
 
219
- return h(
220
- 'aside',
221
- {className: classNames.root, 'aria-labelledby': `${classNames.title}-heading`},
222
- h('h2', {id: `${classNames.title}-heading`, className: classNames.title}, title),
222
+ const children = [
223
+ h('h2', {key: 'title', id: `${classNames.title}-heading`, className: classNames.title}, title),
223
224
  groups.interactions.length
224
225
  ? h(
225
226
  'ol',
226
- {className: classNames.facepile, 'aria-label': 'Reactions'},
227
+ {key: 'facepile', className: classNames.facepile, 'aria-label': 'Reactions'},
227
228
  groups.interactions.map((mention) => h(Face, {
228
229
  key: mention['wm-id'] || mention.url || mention['wm-source'],
229
230
  mention,
@@ -234,7 +235,7 @@ export function Webmentions({
234
235
  groups.threads.length
235
236
  ? h(
236
237
  'ol',
237
- {className: classNames.threadList},
238
+ {key: 'threads', className: classNames.threadList},
238
239
  groups.threads.map((mention) => h(Thread, {
239
240
  key: mention['wm-id'] || mention.url || mention['wm-source'],
240
241
  mention,
@@ -245,6 +246,12 @@ export function Webmentions({
245
246
  })),
246
247
  )
247
248
  : null,
249
+ ];
250
+
251
+ return h(
252
+ 'aside',
253
+ {className: classNames.root, 'aria-labelledby': `${classNames.title}-heading`},
254
+ innerClassName ? h('div', {className: innerClassName}, children) : children,
248
255
  );
249
256
  }
250
257