@jobber/components 6.123.0 → 6.123.2

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 (231) hide show
  1. package/dist/AtlantisThemeContext-cjs.js +1 -1
  2. package/dist/AtlantisThemeContext-es.js +9 -9
  3. package/dist/Autocomplete/Autocomplete.types.d.ts +33 -0
  4. package/dist/Autocomplete/index.cjs +5 -5
  5. package/dist/Autocomplete/index.mjs +8 -8
  6. package/dist/Autocomplete/useAutocomplete.d.ts +2 -57
  7. package/dist/Body-cjs.js +1 -1
  8. package/dist/Body-es.js +2 -2
  9. package/dist/BottomSheet-cjs.js +42 -12
  10. package/dist/BottomSheet-es.js +43 -13
  11. package/dist/Box-cjs.js +2 -2
  12. package/dist/Box-es.js +2 -2
  13. package/dist/Button/index.mjs +1 -1
  14. package/dist/Button-es.js +1 -1
  15. package/dist/Card-cjs.js +1 -1
  16. package/dist/Card-es.js +1 -1
  17. package/dist/Checkbox/index.cjs +1 -1
  18. package/dist/Checkbox/index.mjs +1 -1
  19. package/dist/Chip/index.mjs +1 -1
  20. package/dist/Chip-cjs.js +2 -2
  21. package/dist/Chip-es.js +2 -2
  22. package/dist/ChipDismissible-es.js +1 -1
  23. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -1
  24. package/dist/Combobox-cjs.js +1 -1
  25. package/dist/Combobox-es.js +1 -1
  26. package/dist/ComboboxAction-cjs.js +1 -1
  27. package/dist/ComboboxAction-es.js +1 -1
  28. package/dist/ComboboxContent-cjs.js +1 -1
  29. package/dist/ComboboxContent-es.js +2 -2
  30. package/dist/ComboboxContentHeader-cjs.js +1 -1
  31. package/dist/ComboboxContentHeader-es.js +1 -1
  32. package/dist/ComboboxContentList-es.js +1 -1
  33. package/dist/ComboboxContentSearch-cjs.js +1 -1
  34. package/dist/ComboboxContentSearch-es.js +1 -1
  35. package/dist/ComboboxLoadMore-cjs.js +1 -1
  36. package/dist/ComboboxLoadMore-es.js +1 -1
  37. package/dist/ComboboxOption-cjs.js +1 -1
  38. package/dist/ComboboxOption-es.js +1 -1
  39. package/dist/Container-cjs.js +1 -1
  40. package/dist/Container-es.js +1 -1
  41. package/dist/Content-cjs.js +1 -1
  42. package/dist/Content-es.js +1 -1
  43. package/dist/ContentBlock-cjs.js +1 -1
  44. package/dist/ContentBlock-es.js +1 -1
  45. package/dist/Countdown-cjs.js +7 -3
  46. package/dist/Countdown-es.js +8 -4
  47. package/dist/Cover-cjs.js +1 -1
  48. package/dist/Cover-es.js +1 -1
  49. package/dist/DataList-es.js +3 -3
  50. package/dist/DataList.const-cjs.js +0 -1
  51. package/dist/DataList.const-es.js +1 -2
  52. package/dist/DataList.module-cjs.js +1 -1
  53. package/dist/DataList.module-es.js +1 -1
  54. package/dist/DataList.utils-es.js +6 -6
  55. package/dist/DataListAction-cjs.js +1 -1
  56. package/dist/DataListAction-es.js +1 -1
  57. package/dist/DataListActionsMenu-cjs.js +1 -1
  58. package/dist/DataListActionsMenu-es.js +2 -2
  59. package/dist/DataListBulkActions-cjs.js +1 -1
  60. package/dist/DataListBulkActions-es.js +1 -1
  61. package/dist/DataListContext-cjs.js +6 -5
  62. package/dist/DataListContext-es.js +6 -5
  63. package/dist/DataListEmptyState-cjs.js +1 -1
  64. package/dist/DataListEmptyState-es.js +1 -1
  65. package/dist/DataListHeaderTile-cjs.js +2 -2
  66. package/dist/DataListHeaderTile-es.js +2 -2
  67. package/dist/DataListItemActions-cjs.js +1 -1
  68. package/dist/DataListItemActions-es.js +2 -2
  69. package/dist/DataListLayoutActions-cjs.js +1 -1
  70. package/dist/DataListLayoutActions-es.js +2 -2
  71. package/dist/DataListLoadMore-cjs.js +1 -1
  72. package/dist/DataListLoadMore-es.js +1 -1
  73. package/dist/DataListLoadingState-cjs.js +1 -1
  74. package/dist/DataListLoadingState-es.js +2 -2
  75. package/dist/DataListOverflowFade-cjs.js +1 -1
  76. package/dist/DataListOverflowFade-es.js +1 -1
  77. package/dist/DataListSearch-cjs.js +1 -1
  78. package/dist/DataListSearch-es.js +1 -1
  79. package/dist/DataListSortingOptions-cjs.js +1 -1
  80. package/dist/DataListSortingOptions-es.js +1 -1
  81. package/dist/DataListStickyHeader-cjs.js +1 -1
  82. package/dist/DataListStickyHeader-es.js +1 -1
  83. package/dist/DataListTags-cjs.js +1 -1
  84. package/dist/DataListTags-es.js +1 -1
  85. package/dist/DataListTotalCount-cjs.js +1 -1
  86. package/dist/DataListTotalCount-es.js +2 -2
  87. package/dist/DataTable/index.mjs +1 -1
  88. package/dist/DataTable-cjs.js +3 -3
  89. package/dist/DataTable-es.js +5 -5
  90. package/dist/DataTableTable-cjs.js +2 -2
  91. package/dist/DataTableTable-es.js +3 -3
  92. package/dist/DatePicker-cjs.js +266 -81
  93. package/dist/DatePicker-es.js +268 -83
  94. package/dist/DayOfMonthSelect-cjs.js +5 -5
  95. package/dist/DayOfMonthSelect-es.js +6 -6
  96. package/dist/DescriptionList-cjs.js +1 -1
  97. package/dist/DescriptionList-es.js +1 -1
  98. package/dist/Disclosure-cjs.js +1 -1
  99. package/dist/Disclosure-es.js +1 -1
  100. package/dist/Divider-cjs.js +1 -1
  101. package/dist/Divider-es.js +1 -1
  102. package/dist/DrawerGrid-cjs.js +2 -2
  103. package/dist/DrawerGrid-es.js +2 -2
  104. package/dist/DrawerRoot-cjs.js +10 -48
  105. package/dist/DrawerRoot-es.js +12 -50
  106. package/dist/FeatureSwitch-cjs.js +1 -1
  107. package/dist/FeatureSwitch-es.js +1 -1
  108. package/dist/FormField/index.mjs +1 -1
  109. package/dist/FormField-cjs.js +1 -1
  110. package/dist/FormField-es.js +2 -2
  111. package/dist/FormatEmail-cjs.js +1 -1
  112. package/dist/FormatEmail-es.js +1 -1
  113. package/dist/FormatFile-cjs.js +1 -6
  114. package/dist/FormatFile-es.js +1 -6
  115. package/dist/Frame-cjs.js +1 -1
  116. package/dist/Frame-es.js +1 -1
  117. package/dist/Glimmer/index.mjs +1 -1
  118. package/dist/Glimmer-cjs.js +1 -1
  119. package/dist/Glimmer-es.js +2 -2
  120. package/dist/Grid-cjs.js +1 -1
  121. package/dist/Grid-es.js +1 -1
  122. package/dist/GridCell-cjs.js +1 -1
  123. package/dist/GridCell-es.js +1 -1
  124. package/dist/InputAvatar-cjs.js +1 -1
  125. package/dist/InputAvatar-es.js +1 -1
  126. package/dist/InputDate/index.mjs +1 -1
  127. package/dist/InputEmail/index.mjs +1 -1
  128. package/dist/InputFile-cjs.js +8 -3
  129. package/dist/InputFile-es.js +8 -3
  130. package/dist/InputNumber/index.cjs +181 -69
  131. package/dist/InputNumber/index.mjs +184 -72
  132. package/dist/InputPassword-es.js +1 -1
  133. package/dist/InputPhoneNumber/index.cjs +1 -1
  134. package/dist/InputPhoneNumber/index.mjs +2 -2
  135. package/dist/InputText/InputText.d.ts +2 -70
  136. package/dist/InputText/index.mjs +1 -1
  137. package/dist/InputTime/index.cjs +0 -1
  138. package/dist/InputTime/index.mjs +1 -2
  139. package/dist/InputValidation-cjs.js +1 -1
  140. package/dist/InputValidation-es.js +1 -1
  141. package/dist/InternalChipDismissible-cjs.js +1 -1
  142. package/dist/InternalChipDismissible-es.js +2 -2
  143. package/dist/LightBox-cjs.js +1 -1
  144. package/dist/LightBox-es.js +1 -1
  145. package/dist/Link-cjs.js +1 -1
  146. package/dist/Link-es.js +1 -1
  147. package/dist/List-cjs.js +3 -3
  148. package/dist/List-es.js +7 -7
  149. package/dist/Markdown-cjs.js +604 -961
  150. package/dist/Markdown-es.js +610 -967
  151. package/dist/Menu/Menu.d.ts +1 -1
  152. package/dist/Menu-cjs.js +859 -629
  153. package/dist/Menu-es.js +855 -625
  154. package/dist/Modal/index.cjs +2 -2
  155. package/dist/Modal/index.mjs +2 -2
  156. package/dist/Modal/useModal.d.ts +9 -29
  157. package/dist/MultiSelect-cjs.js +2 -2
  158. package/dist/MultiSelect-es.js +2 -2
  159. package/dist/OverlaySeparator-cjs.js +1 -1
  160. package/dist/OverlaySeparator-es.js +1 -1
  161. package/dist/Popover-cjs.js +1 -1
  162. package/dist/Popover-es.js +2 -2
  163. package/dist/ProgressBar-cjs.js +1 -1
  164. package/dist/ProgressBar-es.js +1 -1
  165. package/dist/RadioGroup-cjs.js +1 -1
  166. package/dist/RadioGroup-es.js +1 -1
  167. package/dist/RecurringSelect/components/index.mjs +1 -1
  168. package/dist/RecurringSelect/index.cjs +1 -0
  169. package/dist/RecurringSelect/index.mjs +1 -0
  170. package/dist/RecurringSelect-cjs.js +1 -1
  171. package/dist/RecurringSelect-es.js +2 -2
  172. package/dist/SegmentedControl-cjs.js +1 -1
  173. package/dist/SegmentedControl-es.js +2 -2
  174. package/dist/Select/index.cjs +1 -1
  175. package/dist/Select/index.mjs +2 -2
  176. package/dist/SideDrawer-cjs.js +1 -1
  177. package/dist/SideDrawer-es.js +1 -1
  178. package/dist/Spinner-cjs.js +1 -1
  179. package/dist/Spinner-es.js +1 -1
  180. package/dist/StatusIndicator-cjs.js +1 -1
  181. package/dist/StatusIndicator-es.js +1 -1
  182. package/dist/Switch-cjs.js +1 -1
  183. package/dist/Switch-es.js +1 -1
  184. package/dist/Table/index.mjs +1 -1
  185. package/dist/Tabs/index.mjs +1 -1
  186. package/dist/Tabs-cjs.js +1 -1
  187. package/dist/Tabs-es.js +6 -6
  188. package/dist/Text-cjs2.js +365 -175
  189. package/dist/Text-es2.js +361 -175
  190. package/dist/Thumbnail-cjs.js +1 -1
  191. package/dist/Thumbnail-es.js +2 -2
  192. package/dist/Tiles-cjs.js +1 -1
  193. package/dist/Tiles-es.js +1 -1
  194. package/dist/Tooltip-cjs.js +1 -1
  195. package/dist/Tooltip-es.js +2 -2
  196. package/dist/Typography-cjs.js +3 -3
  197. package/dist/Typography-es.js +3 -3
  198. package/dist/_baseEach-cjs.js +1 -1
  199. package/dist/_baseEach-es.js +7 -7
  200. package/dist/_baseFlatten-es.js +1 -1
  201. package/dist/_getAllKeys-cjs.js +2 -8
  202. package/dist/_getAllKeys-es.js +4 -10
  203. package/dist/_getTag-es.js +1 -1
  204. package/dist/_isIterateeCall-es.js +3 -3
  205. package/dist/_setToString-es.js +2 -2
  206. package/dist/debounce-es.js +4 -4
  207. package/dist/floating-ui.react-cjs.js +35 -16
  208. package/dist/floating-ui.react-dom-es.js +2 -2
  209. package/dist/floating-ui.react-es.js +37 -18
  210. package/dist/identity-es.js +5 -5
  211. package/dist/index-cjs.js +6 -6
  212. package/dist/index-es.js +6 -6
  213. package/dist/index.esm-es.js +1 -1
  214. package/dist/index.mjs +6 -6
  215. package/dist/isSymbol-es.js +1 -1
  216. package/dist/isTypedArray-cjs.js +4 -4
  217. package/dist/isTypedArray-es.js +6 -6
  218. package/dist/keysIn-cjs.js +2 -2
  219. package/dist/keysIn-es.js +5 -5
  220. package/dist/noop-es.js +4 -4
  221. package/dist/omit-cjs.js +37 -5
  222. package/dist/omit-es.js +46 -14
  223. package/dist/primitives/BottomSheet/BottomSheet.d.ts +13 -8
  224. package/dist/showToast-cjs.js +1 -1
  225. package/dist/showToast-es.js +1 -1
  226. package/dist/styles.css +56 -124
  227. package/dist/unstyledPrimitives/index.mjs +3 -3
  228. package/dist/useScrollToActive-cjs.js +1 -1
  229. package/dist/useScrollToActive-es.js +8 -8
  230. package/package.json +32 -15
  231. package/rollup.config.mjs +4 -1
@@ -112,93 +112,107 @@ function empty$1(value) {
112
112
  }
113
113
 
114
114
  /**
115
- * @typedef {import('./info.js').Info} Info
116
- * @typedef {Record<string, Info>} Properties
117
- * @typedef {Record<string, string>} Normal
115
+ * @import {Schema as SchemaType, Space} from 'property-information'
118
116
  */
119
117
 
118
+ /** @type {SchemaType} */
120
119
  class Schema {
121
120
  /**
122
- * @constructor
123
- * @param {Properties} property
124
- * @param {Normal} normal
125
- * @param {string} [space]
121
+ * @param {SchemaType['property']} property
122
+ * Property.
123
+ * @param {SchemaType['normal']} normal
124
+ * Normal.
125
+ * @param {Space | undefined} [space]
126
+ * Space.
127
+ * @returns
128
+ * Schema.
126
129
  */
127
130
  constructor(property, normal, space) {
128
- this.property = property;
129
131
  this.normal = normal;
132
+ this.property = property;
133
+
130
134
  if (space) {
131
135
  this.space = space;
132
136
  }
133
137
  }
134
138
  }
135
139
 
136
- /** @type {Properties} */
137
- Schema.prototype.property = {};
138
- /** @type {Normal} */
139
140
  Schema.prototype.normal = {};
140
- /** @type {string|null} */
141
- Schema.prototype.space = null;
141
+ Schema.prototype.property = {};
142
+ Schema.prototype.space = undefined;
142
143
 
143
144
  /**
144
- * @typedef {import('./schema.js').Properties} Properties
145
- * @typedef {import('./schema.js').Normal} Normal
145
+ * @import {Info, Space} from 'property-information'
146
146
  */
147
147
 
148
148
 
149
149
  /**
150
- * @param {Schema[]} definitions
151
- * @param {string} [space]
150
+ * @param {ReadonlyArray<Schema>} definitions
151
+ * Definitions.
152
+ * @param {Space | undefined} [space]
153
+ * Space.
152
154
  * @returns {Schema}
155
+ * Schema.
153
156
  */
154
157
  function merge(definitions, space) {
155
- /** @type {Properties} */
158
+ /** @type {Record<string, Info>} */
156
159
  const property = {};
157
- /** @type {Normal} */
160
+ /** @type {Record<string, string>} */
158
161
  const normal = {};
159
- let index = -1;
160
162
 
161
- while (++index < definitions.length) {
162
- Object.assign(property, definitions[index].property);
163
- Object.assign(normal, definitions[index].normal);
163
+ for (const definition of definitions) {
164
+ Object.assign(property, definition.property);
165
+ Object.assign(normal, definition.normal);
164
166
  }
165
167
 
166
168
  return new Schema(property, normal, space)
167
169
  }
168
170
 
169
171
  /**
172
+ * Get the cleaned case insensitive form of an attribute or property.
173
+ *
170
174
  * @param {string} value
175
+ * An attribute-like or property-like name.
171
176
  * @returns {string}
177
+ * Value that can be used to look up the properly cased property on a
178
+ * `Schema`.
172
179
  */
173
180
  function normalize$1(value) {
174
181
  return value.toLowerCase()
175
182
  }
176
183
 
184
+ /**
185
+ * @import {Info as InfoType} from 'property-information'
186
+ */
187
+
188
+ /** @type {InfoType} */
177
189
  class Info {
178
190
  /**
179
- * @constructor
180
191
  * @param {string} property
192
+ * Property.
181
193
  * @param {string} attribute
194
+ * Attribute.
195
+ * @returns
196
+ * Info.
182
197
  */
183
198
  constructor(property, attribute) {
184
- /** @type {string} */
185
- this.property = property;
186
- /** @type {string} */
187
199
  this.attribute = attribute;
200
+ this.property = property;
188
201
  }
189
202
  }
190
203
 
191
- /** @type {string|null} */
192
- Info.prototype.space = null;
193
- Info.prototype.boolean = false;
204
+ Info.prototype.attribute = '';
194
205
  Info.prototype.booleanish = false;
195
- Info.prototype.overloadedBoolean = false;
196
- Info.prototype.number = false;
197
- Info.prototype.commaSeparated = false;
198
- Info.prototype.spaceSeparated = false;
206
+ Info.prototype.boolean = false;
199
207
  Info.prototype.commaOrSpaceSeparated = false;
200
- Info.prototype.mustUseProperty = false;
208
+ Info.prototype.commaSeparated = false;
201
209
  Info.prototype.defined = false;
210
+ Info.prototype.mustUseProperty = false;
211
+ Info.prototype.number = false;
212
+ Info.prototype.overloadedBoolean = false;
213
+ Info.prototype.property = '';
214
+ Info.prototype.spaceSeparated = false;
215
+ Info.prototype.space = undefined;
202
216
 
203
217
  let powers = 0;
204
218
 
@@ -225,17 +239,28 @@ var types = /*#__PURE__*/Object.freeze({
225
239
  spaceSeparated: spaceSeparated
226
240
  });
227
241
 
228
- /** @type {Array<keyof types>} */
229
- // @ts-expect-error: hush.
230
- const checks = Object.keys(types);
242
+ /**
243
+ * @import {Space} from 'property-information'
244
+ */
245
+
246
+
247
+ const checks = /** @type {ReadonlyArray<keyof typeof types>} */ (
248
+ Object.keys(types)
249
+ );
231
250
 
232
251
  class DefinedInfo extends Info {
233
252
  /**
234
253
  * @constructor
235
254
  * @param {string} property
255
+ * Property.
236
256
  * @param {string} attribute
237
- * @param {number|null} [mask]
238
- * @param {string} [space]
257
+ * Attribute.
258
+ * @param {number | null | undefined} [mask]
259
+ * Mask.
260
+ * @param {Space | undefined} [space]
261
+ * Space.
262
+ * @returns
263
+ * Info.
239
264
  */
240
265
  constructor(property, attribute, mask, space) {
241
266
  let index = -1;
@@ -256,126 +281,65 @@ class DefinedInfo extends Info {
256
281
  DefinedInfo.prototype.defined = true;
257
282
 
258
283
  /**
284
+ * @template {keyof DefinedInfo} Key
285
+ * Key type.
259
286
  * @param {DefinedInfo} values
260
- * @param {string} key
261
- * @param {unknown} value
287
+ * Info.
288
+ * @param {Key} key
289
+ * Key.
290
+ * @param {DefinedInfo[Key]} value
291
+ * Value.
292
+ * @returns {undefined}
293
+ * Nothing.
262
294
  */
263
295
  function mark(values, key, value) {
264
296
  if (value) {
265
- // @ts-expect-error: assume `value` matches the expected value of `key`.
266
297
  values[key] = value;
267
298
  }
268
299
  }
269
300
 
270
301
  /**
271
- * @typedef {import('./schema.js').Properties} Properties
272
- * @typedef {import('./schema.js').Normal} Normal
273
- *
274
- * @typedef {Record<string, string>} Attributes
275
- *
276
- * @typedef {Object} Definition
277
- * @property {Record<string, number|null>} properties
278
- * @property {(attributes: Attributes, property: string) => string} transform
279
- * @property {string} [space]
280
- * @property {Attributes} [attributes]
281
- * @property {Array<string>} [mustUseProperty]
302
+ * @import {Info, Space} from 'property-information'
282
303
  */
283
304
 
284
305
 
285
- const own$5 = {}.hasOwnProperty;
286
-
287
306
  /**
288
307
  * @param {Definition} definition
308
+ * Definition.
289
309
  * @returns {Schema}
310
+ * Schema.
290
311
  */
291
312
  function create(definition) {
292
- /** @type {Properties} */
293
- const property = {};
294
- /** @type {Normal} */
295
- const normal = {};
296
- /** @type {string} */
297
- let prop;
298
-
299
- for (prop in definition.properties) {
300
- if (own$5.call(definition.properties, prop)) {
301
- const value = definition.properties[prop];
302
- const info = new DefinedInfo(
303
- prop,
304
- definition.transform(definition.attributes || {}, prop),
305
- value,
306
- definition.space
307
- );
308
-
309
- if (
310
- definition.mustUseProperty &&
311
- definition.mustUseProperty.includes(prop)
312
- ) {
313
- info.mustUseProperty = true;
314
- }
315
-
316
- property[prop] = info;
313
+ /** @type {Record<string, Info>} */
314
+ const properties = {};
315
+ /** @type {Record<string, string>} */
316
+ const normals = {};
317
+
318
+ for (const [property, value] of Object.entries(definition.properties)) {
319
+ const info = new DefinedInfo(
320
+ property,
321
+ definition.transform(definition.attributes || {}, property),
322
+ value,
323
+ definition.space
324
+ );
317
325
 
318
- normal[normalize$1(prop)] = prop;
319
- normal[normalize$1(info.attribute)] = prop;
326
+ if (
327
+ definition.mustUseProperty &&
328
+ definition.mustUseProperty.includes(property)
329
+ ) {
330
+ info.mustUseProperty = true;
320
331
  }
321
- }
322
332
 
323
- return new Schema(property, normal, definition.space)
324
- }
333
+ properties[property] = info;
325
334
 
326
- const xlink = create({
327
- space: 'xlink',
328
- transform(_, prop) {
329
- return 'xlink:' + prop.slice(5).toLowerCase()
330
- },
331
- properties: {
332
- xLinkActuate: null,
333
- xLinkArcRole: null,
334
- xLinkHref: null,
335
- xLinkRole: null,
336
- xLinkShow: null,
337
- xLinkTitle: null,
338
- xLinkType: null
335
+ normals[normalize$1(property)] = property;
336
+ normals[normalize$1(info.attribute)] = property;
339
337
  }
340
- });
341
-
342
- const xml = create({
343
- space: 'xml',
344
- transform(_, prop) {
345
- return 'xml:' + prop.slice(3).toLowerCase()
346
- },
347
- properties: {xmlLang: null, xmlBase: null, xmlSpace: null}
348
- });
349
-
350
- /**
351
- * @param {Record<string, string>} attributes
352
- * @param {string} attribute
353
- * @returns {string}
354
- */
355
- function caseSensitiveTransform(attributes, attribute) {
356
- return attribute in attributes ? attributes[attribute] : attribute
357
- }
358
338
 
359
- /**
360
- * @param {Record<string, string>} attributes
361
- * @param {string} property
362
- * @returns {string}
363
- */
364
- function caseInsensitiveTransform(attributes, property) {
365
- return caseSensitiveTransform(attributes, property.toLowerCase())
339
+ return new Schema(properties, normals, definition.space)
366
340
  }
367
341
 
368
- const xmlns = create({
369
- space: 'xmlns',
370
- attributes: {xmlnsxlink: 'xmlns:xlink'},
371
- transform: caseInsensitiveTransform,
372
- properties: {xmlns: null, xmlnsXLink: null}
373
- });
374
-
375
342
  const aria = create({
376
- transform(_, prop) {
377
- return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()
378
- },
379
343
  properties: {
380
344
  ariaActiveDescendant: null,
381
345
  ariaAtomic: booleanish,
@@ -426,18 +390,45 @@ const aria = create({
426
390
  ariaValueNow: number,
427
391
  ariaValueText: null,
428
392
  role: null
393
+ },
394
+ transform(_, property) {
395
+ return property === 'role'
396
+ ? property
397
+ : 'aria-' + property.slice(4).toLowerCase()
429
398
  }
430
399
  });
431
400
 
401
+ /**
402
+ * @param {Record<string, string>} attributes
403
+ * Attributes.
404
+ * @param {string} attribute
405
+ * Attribute.
406
+ * @returns {string}
407
+ * Transformed attribute.
408
+ */
409
+ function caseSensitiveTransform(attributes, attribute) {
410
+ return attribute in attributes ? attributes[attribute] : attribute
411
+ }
412
+
413
+ /**
414
+ * @param {Record<string, string>} attributes
415
+ * Attributes.
416
+ * @param {string} property
417
+ * Property.
418
+ * @returns {string}
419
+ * Transformed property.
420
+ */
421
+ function caseInsensitiveTransform(attributes, property) {
422
+ return caseSensitiveTransform(attributes, property.toLowerCase())
423
+ }
424
+
432
425
  const html$2 = create({
433
- space: 'html',
434
426
  attributes: {
435
427
  acceptcharset: 'accept-charset',
436
428
  classname: 'class',
437
429
  htmlfor: 'for',
438
430
  httpequiv: 'http-equiv'
439
431
  },
440
- transform: caseInsensitiveTransform,
441
432
  mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
442
433
  properties: {
443
434
  // Standard Properties.
@@ -492,7 +483,7 @@ const html$2 = create({
492
483
  formTarget: null,
493
484
  headers: spaceSeparated,
494
485
  height: number,
495
- hidden: boolean,
486
+ hidden: overloadedBoolean,
496
487
  high: number,
497
488
  href: null,
498
489
  hrefLang: null,
@@ -738,11 +729,12 @@ const html$2 = create({
738
729
  results: number,
739
730
  security: null,
740
731
  unselectable: null
741
- }
732
+ },
733
+ space: 'html',
734
+ transform: caseInsensitiveTransform
742
735
  });
743
736
 
744
737
  const svg$1 = create({
745
- space: 'svg',
746
738
  attributes: {
747
739
  accentHeight: 'accent-height',
748
740
  alignmentBaseline: 'alignment-baseline',
@@ -918,7 +910,6 @@ const svg$1 = create({
918
910
  playbackOrder: 'playbackorder',
919
911
  timelineBegin: 'timelinebegin'
920
912
  },
921
- transform: caseSensitiveTransform,
922
913
  properties: {
923
914
  about: commaOrSpaceSeparated,
924
915
  accentHeight: number,
@@ -1296,26 +1287,115 @@ const svg$1 = create({
1296
1287
  yChannelSelector: null,
1297
1288
  z: null,
1298
1289
  zoomAndPan: null
1290
+ },
1291
+ space: 'svg',
1292
+ transform: caseSensitiveTransform
1293
+ });
1294
+
1295
+ const xlink = create({
1296
+ properties: {
1297
+ xLinkActuate: null,
1298
+ xLinkArcRole: null,
1299
+ xLinkHref: null,
1300
+ xLinkRole: null,
1301
+ xLinkShow: null,
1302
+ xLinkTitle: null,
1303
+ xLinkType: null
1304
+ },
1305
+ space: 'xlink',
1306
+ transform(_, property) {
1307
+ return 'xlink:' + property.slice(5).toLowerCase()
1308
+ }
1309
+ });
1310
+
1311
+ const xmlns = create({
1312
+ attributes: {xmlnsxlink: 'xmlns:xlink'},
1313
+ properties: {xmlnsXLink: null, xmlns: null},
1314
+ space: 'xmlns',
1315
+ transform: caseInsensitiveTransform
1316
+ });
1317
+
1318
+ const xml = create({
1319
+ properties: {xmlBase: null, xmlLang: null, xmlSpace: null},
1320
+ space: 'xml',
1321
+ transform(_, property) {
1322
+ return 'xml:' + property.slice(3).toLowerCase()
1299
1323
  }
1300
1324
  });
1301
1325
 
1302
1326
  /**
1303
- * @typedef {import('./util/schema.js').Schema} Schema
1327
+ * Special cases for React (`Record<string, string>`).
1328
+ *
1329
+ * `hast` is close to `React` but differs in a couple of cases.
1330
+ * To get a React property from a hast property,
1331
+ * check if it is in `hastToReact`.
1332
+ * If it is, use the corresponding value;
1333
+ * otherwise, use the hast property.
1334
+ *
1335
+ * @type {Record<string, string>}
1336
+ */
1337
+ const hastToReact = {
1338
+ classId: 'classID',
1339
+ dataType: 'datatype',
1340
+ itemId: 'itemID',
1341
+ strokeDashArray: 'strokeDasharray',
1342
+ strokeDashOffset: 'strokeDashoffset',
1343
+ strokeLineCap: 'strokeLinecap',
1344
+ strokeLineJoin: 'strokeLinejoin',
1345
+ strokeMiterLimit: 'strokeMiterlimit',
1346
+ typeOf: 'typeof',
1347
+ xLinkActuate: 'xlinkActuate',
1348
+ xLinkArcRole: 'xlinkArcrole',
1349
+ xLinkHref: 'xlinkHref',
1350
+ xLinkRole: 'xlinkRole',
1351
+ xLinkShow: 'xlinkShow',
1352
+ xLinkTitle: 'xlinkTitle',
1353
+ xLinkType: 'xlinkType',
1354
+ xmlnsXLink: 'xmlnsXlink'
1355
+ };
1356
+
1357
+ /**
1358
+ * @import {Schema} from 'property-information'
1304
1359
  */
1305
1360
 
1306
1361
 
1307
- const valid = /^data[-\w.:]+$/i;
1308
- const dash = /-[a-z]/g;
1309
1362
  const cap$1 = /[A-Z]/g;
1363
+ const dash = /-[a-z]/g;
1364
+ const valid = /^data[-\w.:]+$/i;
1310
1365
 
1311
1366
  /**
1367
+ * Look up info on a property.
1368
+ *
1369
+ * In most cases the given `schema` contains info on the property.
1370
+ * All standard,
1371
+ * most legacy,
1372
+ * and some non-standard properties are supported.
1373
+ * For these cases,
1374
+ * the returned `Info` has hints about the value of the property.
1375
+ *
1376
+ * `name` can also be a valid data attribute or property,
1377
+ * in which case an `Info` object with the correctly cased `attribute` and
1378
+ * `property` is returned.
1379
+ *
1380
+ * `name` can be an unknown attribute,
1381
+ * in which case an `Info` object with `attribute` and `property` set to the
1382
+ * given name is returned.
1383
+ * It is not recommended to provide unsupported legacy or recently specced
1384
+ * properties.
1385
+ *
1386
+ *
1312
1387
  * @param {Schema} schema
1388
+ * Schema;
1389
+ * either the `html` or `svg` export.
1313
1390
  * @param {string} value
1391
+ * An attribute-like or property-like name;
1392
+ * it will be passed through `normalize` to hopefully find the correct info.
1314
1393
  * @returns {Info}
1394
+ * Info.
1315
1395
  */
1316
1396
  function find(schema, value) {
1317
1397
  const normal = normalize$1(value);
1318
- let prop = value;
1398
+ let property = value;
1319
1399
  let Type = Info;
1320
1400
 
1321
1401
  if (normal in schema.normal) {
@@ -1327,7 +1407,7 @@ function find(schema, value) {
1327
1407
  if (value.charAt(4) === '-') {
1328
1408
  // Turn it into a property.
1329
1409
  const rest = value.slice(5).replace(dash, camelcase);
1330
- prop = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1);
1410
+ property = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1);
1331
1411
  } else {
1332
1412
  // Turn it into an attribute.
1333
1413
  const rest = value.slice(4);
@@ -1346,12 +1426,14 @@ function find(schema, value) {
1346
1426
  Type = DefinedInfo;
1347
1427
  }
1348
1428
 
1349
- return new Type(prop, value)
1429
+ return new Type(property, value)
1350
1430
  }
1351
1431
 
1352
1432
  /**
1353
1433
  * @param {string} $0
1434
+ * Value.
1354
1435
  * @returns {string}
1436
+ * Kebab.
1355
1437
  */
1356
1438
  function kebab($0) {
1357
1439
  return '-' + $0.toLowerCase()
@@ -1359,48 +1441,19 @@ function kebab($0) {
1359
1441
 
1360
1442
  /**
1361
1443
  * @param {string} $0
1444
+ * Value.
1362
1445
  * @returns {string}
1446
+ * Camel.
1363
1447
  */
1364
1448
  function camelcase($0) {
1365
1449
  return $0.charAt(1).toUpperCase()
1366
1450
  }
1367
1451
 
1368
- /**
1369
- * `hast` is close to `React`, but differs in a couple of cases.
1370
- *
1371
- * To get a React property from a hast property, check if it is in
1372
- * `hastToReact`, if it is, then use the corresponding value,
1373
- * otherwise, use the hast property.
1374
- *
1375
- * @type {Record<string, string>}
1376
- */
1377
- const hastToReact = {
1378
- classId: 'classID',
1379
- dataType: 'datatype',
1380
- itemId: 'itemID',
1381
- strokeDashArray: 'strokeDasharray',
1382
- strokeDashOffset: 'strokeDashoffset',
1383
- strokeLineCap: 'strokeLinecap',
1384
- strokeLineJoin: 'strokeLinejoin',
1385
- strokeMiterLimit: 'strokeMiterlimit',
1386
- typeOf: 'typeof',
1387
- xLinkActuate: 'xlinkActuate',
1388
- xLinkArcRole: 'xlinkArcrole',
1389
- xLinkHref: 'xlinkHref',
1390
- xLinkRole: 'xlinkRole',
1391
- xLinkShow: 'xlinkShow',
1392
- xLinkTitle: 'xlinkTitle',
1393
- xLinkType: 'xlinkType',
1394
- xmlnsXLink: 'xmlnsXlink'
1395
- };
1452
+ // Note: types exposed from `index.d.ts`.
1396
1453
 
1397
- /**
1398
- * @typedef {import('./lib/util/info.js').Info} Info
1399
- * @typedef {import('./lib/util/schema.js').Schema} Schema
1400
- */
1454
+ const html$1 = merge([aria, html$2, xlink, xmlns, xml], 'html');
1401
1455
 
1402
- const html$1 = merge([xml, xlink, xmlns, aria, html$2], 'html');
1403
- const svg = merge([xml, xlink, xmlns, aria, svg$1], 'svg');
1456
+ const svg = merge([aria, svg$1, xlink, xmlns, xml], 'svg');
1404
1457
 
1405
1458
  /**
1406
1459
  * Parse space-separated tokens to an array of strings.
@@ -1423,7 +1476,7 @@ function stringify(values) {
1423
1476
  return values.join(' ').trim()
1424
1477
  }
1425
1478
 
1426
- var cjs = {};
1479
+ var cjs$2 = {};
1427
1480
 
1428
1481
  // http://www.w3.org/TR/CSS21/grammar.html
1429
1482
  // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
@@ -1458,7 +1511,7 @@ var TYPE_DECLARATION = 'declaration';
1458
1511
  * @throws {TypeError}
1459
1512
  * @throws {Error}
1460
1513
  */
1461
- var inlineStyleParser = function (style, options) {
1514
+ function index$1 (style, options) {
1462
1515
  if (typeof style !== 'string') {
1463
1516
  throw new TypeError('First argument must be a string');
1464
1517
  }
@@ -1671,7 +1724,7 @@ var inlineStyleParser = function (style, options) {
1671
1724
 
1672
1725
  whitespace();
1673
1726
  return declarations();
1674
- };
1727
+ }
1675
1728
 
1676
1729
  /**
1677
1730
  * Trim `str`.
@@ -1683,12 +1736,14 @@ function trim(str) {
1683
1736
  return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
1684
1737
  }
1685
1738
 
1686
- var __importDefault = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importDefault) || function (mod) {
1739
+ var cjs$1 = index$1;
1740
+
1741
+ var __importDefault$1 = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importDefault) || function (mod) {
1687
1742
  return (mod && mod.__esModule) ? mod : { "default": mod };
1688
1743
  };
1689
- Object.defineProperty(cjs, "__esModule", { value: true });
1690
- var _default = cjs.default = StyleToObject;
1691
- var inline_style_parser_1 = __importDefault(inlineStyleParser);
1744
+ Object.defineProperty(cjs$2, "__esModule", { value: true });
1745
+ cjs$2.default = StyleToObject;
1746
+ const inline_style_parser_1 = __importDefault$1(cjs$1);
1692
1747
  /**
1693
1748
  * Parses inline style to object.
1694
1749
  *
@@ -1704,17 +1759,17 @@ var inline_style_parser_1 = __importDefault(inlineStyleParser);
1704
1759
  * ```
1705
1760
  */
1706
1761
  function StyleToObject(style, iterator) {
1707
- var styleObject = null;
1762
+ let styleObject = null;
1708
1763
  if (!style || typeof style !== 'string') {
1709
1764
  return styleObject;
1710
1765
  }
1711
- var declarations = (0, inline_style_parser_1.default)(style);
1712
- var hasIterator = typeof iterator === 'function';
1713
- declarations.forEach(function (declaration) {
1766
+ const declarations = (0, inline_style_parser_1.default)(style);
1767
+ const hasIterator = typeof iterator === 'function';
1768
+ declarations.forEach((declaration) => {
1714
1769
  if (declaration.type !== 'declaration') {
1715
1770
  return;
1716
1771
  }
1717
- var property = declaration.property, value = declaration.value;
1772
+ const { property, value } = declaration;
1718
1773
  if (hasIterator) {
1719
1774
  iterator(property, value, declaration);
1720
1775
  }
@@ -1726,8 +1781,80 @@ function StyleToObject(style, iterator) {
1726
1781
  return styleObject;
1727
1782
  }
1728
1783
 
1729
- // ensure compatibility with rollup umd build
1730
- var styleToObject = _default.default || _default;
1784
+ var utilities = {};
1785
+
1786
+ Object.defineProperty(utilities, "__esModule", { value: true });
1787
+ utilities.camelCase = void 0;
1788
+ var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
1789
+ var HYPHEN_REGEX = /-([a-z])/g;
1790
+ var NO_HYPHEN_REGEX = /^[^-]+$/;
1791
+ var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
1792
+ var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
1793
+ /**
1794
+ * Checks whether to skip camelCase.
1795
+ */
1796
+ var skipCamelCase = function (property) {
1797
+ return !property ||
1798
+ NO_HYPHEN_REGEX.test(property) ||
1799
+ CUSTOM_PROPERTY_REGEX.test(property);
1800
+ };
1801
+ /**
1802
+ * Replacer that capitalizes first character.
1803
+ */
1804
+ var capitalize = function (match, character) {
1805
+ return character.toUpperCase();
1806
+ };
1807
+ /**
1808
+ * Replacer that removes beginning hyphen of vendor prefix property.
1809
+ */
1810
+ var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
1811
+ /**
1812
+ * CamelCases a CSS property.
1813
+ */
1814
+ var camelCase = function (property, options) {
1815
+ if (options === void 0) { options = {}; }
1816
+ if (skipCamelCase(property)) {
1817
+ return property;
1818
+ }
1819
+ property = property.toLowerCase();
1820
+ if (options.reactCompat) {
1821
+ // `-ms` vendor prefix should not be capitalized
1822
+ property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
1823
+ }
1824
+ else {
1825
+ // for non-React, remove first hyphen so vendor prefix is not capitalized
1826
+ property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
1827
+ }
1828
+ return property.replace(HYPHEN_REGEX, capitalize);
1829
+ };
1830
+ utilities.camelCase = camelCase;
1831
+
1832
+ var __importDefault = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__importDefault) || function (mod) {
1833
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1834
+ };
1835
+ var style_to_object_1 = __importDefault(cjs$2);
1836
+ var utilities_1 = utilities;
1837
+ /**
1838
+ * Parses CSS inline style to JavaScript object (camelCased).
1839
+ */
1840
+ function StyleToJS(style, options) {
1841
+ var output = {};
1842
+ if (!style || typeof style !== 'string') {
1843
+ return output;
1844
+ }
1845
+ (0, style_to_object_1.default)(style, function (property, value) {
1846
+ // skip CSS comment
1847
+ if (property && value) {
1848
+ output[(0, utilities_1.camelCase)(property, options)] = value;
1849
+ }
1850
+ });
1851
+ return output;
1852
+ }
1853
+ StyleToJS.default = StyleToJS;
1854
+ var cjs = StyleToJS;
1855
+
1856
+
1857
+ var styleToJs = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(cjs);
1731
1858
 
1732
1859
  /**
1733
1860
  * @typedef {import('unist').Node} Node
@@ -1758,7 +1885,7 @@ var styleToObject = _default.default || _default;
1758
1885
  * @returns
1759
1886
  * Point.
1760
1887
  */
1761
- const pointEnd = point$3('end');
1888
+ const pointEnd = point$2('end');
1762
1889
 
1763
1890
  /**
1764
1891
  * Get the starting point of `node`.
@@ -1768,7 +1895,7 @@ const pointEnd = point$3('end');
1768
1895
  * @returns
1769
1896
  * Point.
1770
1897
  */
1771
- const pointStart = point$3('start');
1898
+ const pointStart = point$2('start');
1772
1899
 
1773
1900
  /**
1774
1901
  * Get the positional info of `node`.
@@ -1778,7 +1905,7 @@ const pointStart = point$3('start');
1778
1905
  * @returns
1779
1906
  * Getter.
1780
1907
  */
1781
- function point$3(type) {
1908
+ function point$2(type) {
1782
1909
  return point
1783
1910
 
1784
1911
  /**
@@ -1816,7 +1943,7 @@ function point$3(type) {
1816
1943
  * @returns {Position | undefined}
1817
1944
  * Position.
1818
1945
  */
1819
- function position$2(node) {
1946
+ function position$1(node) {
1820
1947
  const start = pointStart(node);
1821
1948
  const end = pointEnd(node);
1822
1949
 
@@ -1861,7 +1988,7 @@ function position$2(node) {
1861
1988
  * An empty string (`''`) is returned if the given value is neither `node`,
1862
1989
  * `position`, nor `point`.
1863
1990
  */
1864
- function stringifyPosition$1(value) {
1991
+ function stringifyPosition(value) {
1865
1992
  // Nothing.
1866
1993
  if (!value || typeof value !== 'object') {
1867
1994
  return ''
@@ -1869,17 +1996,17 @@ function stringifyPosition$1(value) {
1869
1996
 
1870
1997
  // Node.
1871
1998
  if ('position' in value || 'type' in value) {
1872
- return position$1(value.position)
1999
+ return position(value.position)
1873
2000
  }
1874
2001
 
1875
2002
  // Position.
1876
2003
  if ('start' in value || 'end' in value) {
1877
- return position$1(value)
2004
+ return position(value)
1878
2005
  }
1879
2006
 
1880
2007
  // Point.
1881
2008
  if ('line' in value || 'column' in value) {
1882
- return point$2(value)
2009
+ return point$1(value)
1883
2010
  }
1884
2011
 
1885
2012
  // ?
@@ -1890,37 +2017,35 @@ function stringifyPosition$1(value) {
1890
2017
  * @param {Point | PointLike | null | undefined} point
1891
2018
  * @returns {string}
1892
2019
  */
1893
- function point$2(point) {
1894
- return index$1(point && point.line) + ':' + index$1(point && point.column)
2020
+ function point$1(point) {
2021
+ return index(point && point.line) + ':' + index(point && point.column)
1895
2022
  }
1896
2023
 
1897
2024
  /**
1898
2025
  * @param {Position | PositionLike | null | undefined} pos
1899
2026
  * @returns {string}
1900
2027
  */
1901
- function position$1(pos) {
1902
- return point$2(pos && pos.start) + '-' + point$2(pos && pos.end)
2028
+ function position(pos) {
2029
+ return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
1903
2030
  }
1904
2031
 
1905
2032
  /**
1906
2033
  * @param {number | null | undefined} value
1907
2034
  * @returns {number}
1908
2035
  */
1909
- function index$1(value) {
2036
+ function index(value) {
1910
2037
  return value && typeof value === 'number' ? value : 1
1911
2038
  }
1912
2039
 
1913
2040
  /**
1914
- * @typedef {import('unist').Node} Node
1915
- * @typedef {import('unist').Point} Point
1916
- * @typedef {import('unist').Position} Position
2041
+ * @import {Node, Point, Position} from 'unist'
1917
2042
  */
1918
2043
 
1919
2044
 
1920
2045
  /**
1921
2046
  * Message.
1922
2047
  */
1923
- let VFileMessage$1 = class VFileMessage extends Error {
2048
+ class VFileMessage extends Error {
1924
2049
  /**
1925
2050
  * Create a message for `reason`.
1926
2051
  *
@@ -2052,7 +2177,6 @@ let VFileMessage$1 = class VFileMessage extends Error {
2052
2177
  ? options.place.start
2053
2178
  : options.place;
2054
2179
 
2055
- /* eslint-disable no-unused-expressions */
2056
2180
  /**
2057
2181
  * Stack of ancestor nodes surrounding the message.
2058
2182
  *
@@ -2090,7 +2214,7 @@ let VFileMessage$1 = class VFileMessage extends Error {
2090
2214
  *
2091
2215
  * @type {string | undefined}
2092
2216
  */
2093
- this.file;
2217
+ this.file = '';
2094
2218
 
2095
2219
  // Field from `Error`.
2096
2220
  /**
@@ -2114,7 +2238,7 @@ let VFileMessage$1 = class VFileMessage extends Error {
2114
2238
  * On normal errors, this would be something like `ParseError`, buit in
2115
2239
  * `VFile` messages we use this space to show where an error happened.
2116
2240
  */
2117
- this.name = stringifyPosition$1(options.place) || '1:1';
2241
+ this.name = stringifyPosition(options.place) || '1:1';
2118
2242
 
2119
2243
  /**
2120
2244
  * Place of message.
@@ -2168,21 +2292,21 @@ let VFileMessage$1 = class VFileMessage extends Error {
2168
2292
  *
2169
2293
  * @type {string | undefined}
2170
2294
  */
2171
- this.actual;
2295
+ this.actual = undefined;
2172
2296
 
2173
2297
  /**
2174
2298
  * Suggest acceptable values that can be used instead of `actual`.
2175
2299
  *
2176
2300
  * @type {Array<string> | undefined}
2177
2301
  */
2178
- this.expected;
2302
+ this.expected = undefined;
2179
2303
 
2180
2304
  /**
2181
2305
  * Long form description of the message (you should use markdown).
2182
2306
  *
2183
2307
  * @type {string | undefined}
2184
2308
  */
2185
- this.note;
2309
+ this.note = undefined;
2186
2310
 
2187
2311
  /**
2188
2312
  * Link to docs for the message.
@@ -2192,24 +2316,23 @@ let VFileMessage$1 = class VFileMessage extends Error {
2192
2316
  *
2193
2317
  * @type {string | undefined}
2194
2318
  */
2195
- this.url;
2196
- /* eslint-enable no-unused-expressions */
2319
+ this.url = undefined;
2197
2320
  }
2198
- };
2321
+ }
2199
2322
 
2200
- VFileMessage$1.prototype.file = '';
2201
- VFileMessage$1.prototype.name = '';
2202
- VFileMessage$1.prototype.reason = '';
2203
- VFileMessage$1.prototype.message = '';
2204
- VFileMessage$1.prototype.stack = '';
2205
- VFileMessage$1.prototype.column = undefined;
2206
- VFileMessage$1.prototype.line = undefined;
2207
- VFileMessage$1.prototype.ancestors = undefined;
2208
- VFileMessage$1.prototype.cause = undefined;
2209
- VFileMessage$1.prototype.fatal = undefined;
2210
- VFileMessage$1.prototype.place = undefined;
2211
- VFileMessage$1.prototype.ruleId = undefined;
2212
- VFileMessage$1.prototype.source = undefined;
2323
+ VFileMessage.prototype.file = '';
2324
+ VFileMessage.prototype.name = '';
2325
+ VFileMessage.prototype.reason = '';
2326
+ VFileMessage.prototype.message = '';
2327
+ VFileMessage.prototype.stack = '';
2328
+ VFileMessage.prototype.column = undefined;
2329
+ VFileMessage.prototype.line = undefined;
2330
+ VFileMessage.prototype.ancestors = undefined;
2331
+ VFileMessage.prototype.cause = undefined;
2332
+ VFileMessage.prototype.fatal = undefined;
2333
+ VFileMessage.prototype.place = undefined;
2334
+ VFileMessage.prototype.ruleId = undefined;
2335
+ VFileMessage.prototype.source = undefined;
2213
2336
 
2214
2337
  /**
2215
2338
  * @import {Identifier, Literal, MemberExpression} from 'estree'
@@ -2219,7 +2342,7 @@ VFileMessage$1.prototype.source = undefined;
2219
2342
  * @import {MdxJsxFlowElementHast, MdxJsxTextElementHast} from 'mdast-util-mdx-jsx'
2220
2343
  * @import {MdxjsEsmHast} from 'mdast-util-mdxjs-esm'
2221
2344
  * @import {Position} from 'unist'
2222
- * @import {Child, Create, Field, State, Style} from './types.js'
2345
+ * @import {Child, Create, Field, JsxElement, State, Style} from './types.js'
2223
2346
  */
2224
2347
 
2225
2348
 
@@ -2230,7 +2353,6 @@ const own$4 = {}.hasOwnProperty;
2230
2353
  const emptyMap = new Map();
2231
2354
 
2232
2355
  const cap = /[A-Z]/g;
2233
- const dashSomething = /-([a-z])/g;
2234
2356
 
2235
2357
  // `react-dom` triggers a warning for *any* white space in tables.
2236
2358
  // To follow GFM, `mdast-util-to-hast` injects line endings between elements.
@@ -2257,7 +2379,7 @@ const docs = 'https://github.com/syntax-tree/hast-util-to-jsx-runtime';
2257
2379
  * Tree to transform.
2258
2380
  * @param {Options} options
2259
2381
  * Configuration (required).
2260
- * @returns {JSX.Element}
2382
+ * @returns {JsxElement}
2261
2383
  * JSX element.
2262
2384
  */
2263
2385
 
@@ -2839,49 +2961,24 @@ function createProperty(state, prop, value) {
2839
2961
  * Throws `VFileMessage` when CSS cannot be parsed.
2840
2962
  */
2841
2963
  function parseStyle(state, value) {
2842
- /** @type {Style} */
2843
- const result = {};
2844
-
2845
2964
  try {
2846
- styleToObject(value, replacer);
2965
+ return styleToJs(value, {reactCompat: true})
2847
2966
  } catch (error) {
2848
- if (!state.ignoreInvalidStyle) {
2849
- const cause = /** @type {Error} */ (error);
2850
- const message = new VFileMessage$1('Cannot parse `style` attribute', {
2851
- ancestors: state.ancestors,
2852
- cause,
2853
- ruleId: 'style',
2854
- source: 'hast-util-to-jsx-runtime'
2855
- });
2856
- message.file = state.filePath || undefined;
2857
- message.url = docs + '#cannot-parse-style-attribute';
2858
-
2859
- throw message
2967
+ if (state.ignoreInvalidStyle) {
2968
+ return {}
2860
2969
  }
2861
- }
2862
-
2863
- return result
2864
-
2865
- /**
2866
- * Add a CSS property (normal, so with dashes) to `result` as a DOM CSS
2867
- * property.
2868
- *
2869
- * @param {string} name
2870
- * Key.
2871
- * @param {string} value
2872
- * Value
2873
- * @returns {undefined}
2874
- * Nothing.
2875
- */
2876
- function replacer(name, value) {
2877
- let key = name;
2878
2970
 
2879
- if (key.slice(0, 2) !== '--') {
2880
- if (key.slice(0, 4) === '-ms-') key = 'ms-' + key.slice(4);
2881
- key = key.replace(dashSomething, toCamel);
2882
- }
2971
+ const cause = /** @type {Error} */ (error);
2972
+ const message = new VFileMessage('Cannot parse `style` attribute', {
2973
+ ancestors: state.ancestors,
2974
+ cause,
2975
+ ruleId: 'style',
2976
+ source: 'hast-util-to-jsx-runtime'
2977
+ });
2978
+ message.file = state.filePath || undefined;
2979
+ message.url = docs + '#cannot-parse-style-attribute';
2883
2980
 
2884
- result[key] = value;
2981
+ throw message
2885
2982
  }
2886
2983
  }
2887
2984
 
@@ -2935,8 +3032,7 @@ function findComponentFromName(state, name$1, allowExpression) {
2935
3032
  // Only literals can be passed in `components` currently.
2936
3033
  // No identifiers / member expressions.
2937
3034
  if (result.type === 'Literal') {
2938
- const name = /** @type {keyof JSX.IntrinsicElements} */ (result.value);
2939
-
3035
+ const name = /** @type {string | number} */ (result.value);
2940
3036
  return own$4.call(state.components, name) ? state.components[name] : name
2941
3037
  }
2942
3038
 
@@ -2954,7 +3050,7 @@ function findComponentFromName(state, name$1, allowExpression) {
2954
3050
  * @returns {never}
2955
3051
  */
2956
3052
  function crashEstree(state, place) {
2957
- const message = new VFileMessage$1(
3053
+ const message = new VFileMessage(
2958
3054
  'Cannot handle MDX estrees without `createEvaluater`',
2959
3055
  {
2960
3056
  ancestors: state.ancestors,
@@ -3003,20 +3099,6 @@ function transformStyleToCssCasing(from) {
3003
3099
  return to
3004
3100
  }
3005
3101
 
3006
- /**
3007
- * Make `$1` capitalized.
3008
- *
3009
- * @param {string} _
3010
- * Whatever.
3011
- * @param {string} $1
3012
- * Single ASCII alphabetical.
3013
- * @returns {string}
3014
- * Capitalized `$1`.
3015
- */
3016
- function toCamel(_, $1) {
3017
- return $1.toUpperCase()
3018
- }
3019
-
3020
3102
  /**
3021
3103
  * Make `$0` dash cased.
3022
3104
  *
@@ -5303,6 +5385,7 @@ const characterEntities = {
5303
5385
  zwnj: '‌'
5304
5386
  };
5305
5387
 
5388
+ // To do: next major: use `Object.hasOwn`.
5306
5389
  const own$3 = {}.hasOwnProperty;
5307
5390
 
5308
5391
  /**
@@ -5582,7 +5665,7 @@ function normalizeIdentifier(value) {
5582
5665
  * @returns {boolean}
5583
5666
  * Whether it matches.
5584
5667
  */
5585
- const asciiAlpha = regexCheck$1(/[A-Za-z]/);
5668
+ const asciiAlpha = regexCheck(/[A-Za-z]/);
5586
5669
 
5587
5670
  /**
5588
5671
  * Check whether the character code represents an ASCII alphanumeric (`a`
@@ -5596,7 +5679,7 @@ const asciiAlpha = regexCheck$1(/[A-Za-z]/);
5596
5679
  * @returns {boolean}
5597
5680
  * Whether it matches.
5598
5681
  */
5599
- const asciiAlphanumeric$1 = regexCheck$1(/[\dA-Za-z]/);
5682
+ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
5600
5683
 
5601
5684
  /**
5602
5685
  * Check whether the character code represents an ASCII atext.
@@ -5619,7 +5702,7 @@ const asciiAlphanumeric$1 = regexCheck$1(/[\dA-Za-z]/);
5619
5702
  * @returns {boolean}
5620
5703
  * Whether it matches.
5621
5704
  */
5622
- const asciiAtext = regexCheck$1(/[#-'*+\--9=?A-Z^-~]/);
5705
+ const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
5623
5706
 
5624
5707
  /**
5625
5708
  * Check whether a character code is an ASCII control character.
@@ -5651,7 +5734,7 @@ function asciiControl(code) {
5651
5734
  * @returns {boolean}
5652
5735
  * Whether it matches.
5653
5736
  */
5654
- const asciiDigit = regexCheck$1(/\d/);
5737
+ const asciiDigit = regexCheck(/\d/);
5655
5738
 
5656
5739
  /**
5657
5740
  * Check whether the character code represents an ASCII hex digit (`a` through
@@ -5671,7 +5754,7 @@ const asciiDigit = regexCheck$1(/\d/);
5671
5754
  * @returns {boolean}
5672
5755
  * Whether it matches.
5673
5756
  */
5674
- const asciiHexDigit = regexCheck$1(/[\dA-Fa-f]/);
5757
+ const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
5675
5758
 
5676
5759
  /**
5677
5760
  * Check whether the character code represents ASCII punctuation.
@@ -5686,7 +5769,7 @@ const asciiHexDigit = regexCheck$1(/[\dA-Fa-f]/);
5686
5769
  * @returns {boolean}
5687
5770
  * Whether it matches.
5688
5771
  */
5689
- const asciiPunctuation = regexCheck$1(/[!-/:-@[-`{-~]/);
5772
+ const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
5690
5773
 
5691
5774
  /**
5692
5775
  * Check whether a character code is a markdown line ending.
@@ -5760,7 +5843,7 @@ function markdownSpace(code) {
5760
5843
  * @returns
5761
5844
  * Whether it matches.
5762
5845
  */
5763
- const unicodePunctuation = regexCheck$1(/\p{P}|\p{S}/u);
5846
+ const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
5764
5847
 
5765
5848
  /**
5766
5849
  * Check whether the character code represents Unicode whitespace.
@@ -5782,7 +5865,7 @@ const unicodePunctuation = regexCheck$1(/\p{P}|\p{S}/u);
5782
5865
  * @returns
5783
5866
  * Whether it matches.
5784
5867
  */
5785
- const unicodeWhitespace = regexCheck$1(/\s/);
5868
+ const unicodeWhitespace = regexCheck(/\s/);
5786
5869
 
5787
5870
  /**
5788
5871
  * Create a code check from a regex.
@@ -5792,7 +5875,7 @@ const unicodeWhitespace = regexCheck$1(/\s/);
5792
5875
  * @returns {(code: Code) => boolean}
5793
5876
  * Check.
5794
5877
  */
5795
- function regexCheck$1(regex) {
5878
+ function regexCheck(regex) {
5796
5879
  return check;
5797
5880
 
5798
5881
  /**
@@ -5808,6 +5891,69 @@ function regexCheck$1(regex) {
5808
5891
  }
5809
5892
  }
5810
5893
 
5894
+ /**
5895
+ * Normalize a URL.
5896
+ *
5897
+ * Encode unsafe characters with percent-encoding, skipping already encoded
5898
+ * sequences.
5899
+ *
5900
+ * @param {string} value
5901
+ * URI to normalize.
5902
+ * @returns {string}
5903
+ * Normalized URI.
5904
+ */
5905
+ function normalizeUri(value) {
5906
+ /** @type {Array<string>} */
5907
+ const result = [];
5908
+ let index = -1;
5909
+ let start = 0;
5910
+ let skip = 0;
5911
+ while (++index < value.length) {
5912
+ const code = value.charCodeAt(index);
5913
+ /** @type {string} */
5914
+ let replace = '';
5915
+
5916
+ // A correct percent encoded value.
5917
+ if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) {
5918
+ skip = 2;
5919
+ }
5920
+ // ASCII.
5921
+ else if (code < 128) {
5922
+ if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
5923
+ replace = String.fromCharCode(code);
5924
+ }
5925
+ }
5926
+ // Astral.
5927
+ else if (code > 55_295 && code < 57_344) {
5928
+ const next = value.charCodeAt(index + 1);
5929
+
5930
+ // A correct surrogate pair.
5931
+ if (code < 56_320 && next > 56_319 && next < 57_344) {
5932
+ replace = String.fromCharCode(code, next);
5933
+ skip = 1;
5934
+ }
5935
+ // Lone surrogate.
5936
+ else {
5937
+ replace = "\uFFFD";
5938
+ }
5939
+ }
5940
+ // Unicode.
5941
+ else {
5942
+ replace = String.fromCharCode(code);
5943
+ }
5944
+ if (replace) {
5945
+ result.push(value.slice(start, index), encodeURIComponent(replace));
5946
+ start = index + skip + 1;
5947
+ replace = '';
5948
+ }
5949
+ if (skip) {
5950
+ index += skip;
5951
+ skip = 0;
5952
+ }
5953
+ }
5954
+ return result.join('') + value.slice(start);
5955
+ }
5956
+
5811
5957
  /**
5812
5958
  * @import {Effects, State, TokenType} from 'micromark-util-types'
5813
5959
  */
@@ -6686,7 +6832,7 @@ function tokenizeAutolink(effects, ok, nok) {
6686
6832
  */
6687
6833
  function schemeOrEmailAtext(code) {
6688
6834
  // ASCII alphanumeric and `+`, `-`, and `.`.
6689
- if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric$1(code)) {
6835
+ if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
6690
6836
  // Count the previous alphabetical from `open` too.
6691
6837
  size = 1;
6692
6838
  return schemeInsideOrEmailAtext(code);
@@ -6714,7 +6860,7 @@ function tokenizeAutolink(effects, ok, nok) {
6714
6860
  }
6715
6861
 
6716
6862
  // ASCII alphanumeric and `+`, `-`, and `.`.
6717
- if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric$1(code)) && size++ < 32) {
6863
+ if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {
6718
6864
  effects.consume(code);
6719
6865
  return schemeInsideOrEmailAtext;
6720
6866
  }
@@ -6783,7 +6929,7 @@ function tokenizeAutolink(effects, ok, nok) {
6783
6929
  * @type {State}
6784
6930
  */
6785
6931
  function emailAtSignOrDot(code) {
6786
- return asciiAlphanumeric$1(code) ? emailLabel(code) : nok(code);
6932
+ return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);
6787
6933
  }
6788
6934
 
6789
6935
  /**
@@ -6828,7 +6974,7 @@ function tokenizeAutolink(effects, ok, nok) {
6828
6974
  */
6829
6975
  function emailValue(code) {
6830
6976
  // ASCII alphanumeric or `-`.
6831
- if ((code === 45 || asciiAlphanumeric$1(code)) && size++ < 63) {
6977
+ if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
6832
6978
  const next = code === 45 ? emailValue : emailLabel;
6833
6979
  effects.consume(code);
6834
6980
  return next;
@@ -7179,7 +7325,7 @@ function tokenizeCharacterReference(effects, ok, nok) {
7179
7325
  }
7180
7326
  effects.enter("characterReferenceValue");
7181
7327
  max = 31;
7182
- test = asciiAlphanumeric$1;
7328
+ test = asciiAlphanumeric;
7183
7329
  return value(code);
7184
7330
  }
7185
7331
 
@@ -7231,7 +7377,7 @@ function tokenizeCharacterReference(effects, ok, nok) {
7231
7377
  function value(code) {
7232
7378
  if (code === 59 && size) {
7233
7379
  const token = effects.exit("characterReferenceValue");
7234
- if (test === asciiAlphanumeric$1 && !decodeNamedCharacterReference(self.sliceSerialize(token))) {
7380
+ if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) {
7235
7381
  return nok(code);
7236
7382
  }
7237
7383
 
@@ -10180,7 +10326,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
10180
10326
  }
10181
10327
 
10182
10328
  // ASCII alphanumerical and `-`.
10183
- if (code === 45 || asciiAlphanumeric$1(code)) {
10329
+ if (code === 45 || asciiAlphanumeric(code)) {
10184
10330
  effects.consume(code);
10185
10331
  buffer += String.fromCharCode(code);
10186
10332
  return tagName;
@@ -10283,7 +10429,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
10283
10429
  */
10284
10430
  function completeAttributeName(code) {
10285
10431
  // ASCII alphanumerical and `-`, `.`, `:`, and `_`.
10286
- if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric$1(code)) {
10432
+ if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
10287
10433
  effects.consume(code);
10288
10434
  return completeAttributeName;
10289
10435
  }
@@ -11136,7 +11282,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11136
11282
  */
11137
11283
  function tagClose(code) {
11138
11284
  // ASCII alphanumerical and `-`.
11139
- if (code === 45 || asciiAlphanumeric$1(code)) {
11285
+ if (code === 45 || asciiAlphanumeric(code)) {
11140
11286
  effects.consume(code);
11141
11287
  return tagClose;
11142
11288
  }
@@ -11177,7 +11323,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11177
11323
  */
11178
11324
  function tagOpen(code) {
11179
11325
  // ASCII alphanumerical and `-`.
11180
- if (code === 45 || asciiAlphanumeric$1(code)) {
11326
+ if (code === 45 || asciiAlphanumeric(code)) {
11181
11327
  effects.consume(code);
11182
11328
  return tagOpen;
11183
11329
  }
@@ -11231,7 +11377,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11231
11377
  */
11232
11378
  function tagOpenAttributeName(code) {
11233
11379
  // ASCII alphabetical and `-`, `.`, `:`, and `_`.
11234
- if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric$1(code)) {
11380
+ if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
11235
11381
  effects.consume(code);
11236
11382
  return tagOpenAttributeName;
11237
11383
  }
@@ -13844,91 +13990,6 @@ function decode($0, $1, $2) {
13844
13990
  return decodeNamedCharacterReference($2) || $0;
13845
13991
  }
13846
13992
 
13847
- /**
13848
- * @typedef {import('unist').Node} Node
13849
- * @typedef {import('unist').Point} Point
13850
- * @typedef {import('unist').Position} Position
13851
- */
13852
-
13853
- /**
13854
- * @typedef NodeLike
13855
- * @property {string} type
13856
- * @property {PositionLike | null | undefined} [position]
13857
- *
13858
- * @typedef PointLike
13859
- * @property {number | null | undefined} [line]
13860
- * @property {number | null | undefined} [column]
13861
- * @property {number | null | undefined} [offset]
13862
- *
13863
- * @typedef PositionLike
13864
- * @property {PointLike | null | undefined} [start]
13865
- * @property {PointLike | null | undefined} [end]
13866
- */
13867
-
13868
- /**
13869
- * Serialize the positional info of a point, position (start and end points),
13870
- * or node.
13871
- *
13872
- * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]
13873
- * Node, position, or point.
13874
- * @returns {string}
13875
- * Pretty printed positional info of a node (`string`).
13876
- *
13877
- * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
13878
- * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
13879
- * column, `s` for `start`, and `e` for end.
13880
- * An empty string (`''`) is returned if the given value is neither `node`,
13881
- * `position`, nor `point`.
13882
- */
13883
- function stringifyPosition(value) {
13884
- // Nothing.
13885
- if (!value || typeof value !== 'object') {
13886
- return ''
13887
- }
13888
-
13889
- // Node.
13890
- if ('position' in value || 'type' in value) {
13891
- return position(value.position)
13892
- }
13893
-
13894
- // Position.
13895
- if ('start' in value || 'end' in value) {
13896
- return position(value)
13897
- }
13898
-
13899
- // Point.
13900
- if ('line' in value || 'column' in value) {
13901
- return point$1(value)
13902
- }
13903
-
13904
- // ?
13905
- return ''
13906
- }
13907
-
13908
- /**
13909
- * @param {Point | PointLike | null | undefined} point
13910
- * @returns {string}
13911
- */
13912
- function point$1(point) {
13913
- return index(point && point.line) + ':' + index(point && point.column)
13914
- }
13915
-
13916
- /**
13917
- * @param {Position | PositionLike | null | undefined} pos
13918
- * @returns {string}
13919
- */
13920
- function position(pos) {
13921
- return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
13922
- }
13923
-
13924
- /**
13925
- * @param {number | null | undefined} value
13926
- * @returns {number}
13927
- */
13928
- function index(value) {
13929
- return value && typeof value === 'number' ? value : 1
13930
- }
13931
-
13932
13993
  /**
13933
13994
  * @import {
13934
13995
  * Break,
@@ -13996,7 +14057,7 @@ const own$2 = {}.hasOwnProperty;
13996
14057
  * mdast tree.
13997
14058
  */
13998
14059
  function fromMarkdown(value, encoding, options) {
13999
- if (typeof encoding !== 'string') {
14060
+ if (encoding && typeof encoding === 'object') {
14000
14061
  options = encoding;
14001
14062
  encoding = undefined;
14002
14063
  }
@@ -15138,12 +15199,11 @@ function remarkParse(options) {
15138
15199
  }
15139
15200
 
15140
15201
  /**
15141
- * @typedef {import('hast').Element} Element
15142
- * @typedef {import('mdast').Blockquote} Blockquote
15143
- * @typedef {import('../state.js').State} State
15202
+ * @import {Element} from 'hast'
15203
+ * @import {Blockquote} from 'mdast'
15204
+ * @import {State} from '../state.js'
15144
15205
  */
15145
15206
 
15146
-
15147
15207
  /**
15148
15208
  * Turn an mdast `blockquote` node into hast.
15149
15209
  *
@@ -15167,13 +15227,11 @@ function blockquote(state, node) {
15167
15227
  }
15168
15228
 
15169
15229
  /**
15170
- * @typedef {import('hast').Element} Element
15171
- * @typedef {import('hast').Text} Text
15172
- * @typedef {import('mdast').Break} Break
15173
- * @typedef {import('../state.js').State} State
15230
+ * @import {Element, Text} from 'hast'
15231
+ * @import {Break} from 'mdast'
15232
+ * @import {State} from '../state.js'
15174
15233
  */
15175
15234
 
15176
-
15177
15235
  /**
15178
15236
  * Turn an mdast `break` node into hast.
15179
15237
  *
@@ -15192,13 +15250,11 @@ function hardBreak(state, node) {
15192
15250
  }
15193
15251
 
15194
15252
  /**
15195
- * @typedef {import('hast').Element} Element
15196
- * @typedef {import('hast').Properties} Properties
15197
- * @typedef {import('mdast').Code} Code
15198
- * @typedef {import('../state.js').State} State
15253
+ * @import {Element, Properties} from 'hast'
15254
+ * @import {Code} from 'mdast'
15255
+ * @import {State} from '../state.js'
15199
15256
  */
15200
15257
 
15201
-
15202
15258
  /**
15203
15259
  * Turn an mdast `code` node into hast.
15204
15260
  *
@@ -15213,9 +15269,12 @@ function code(state, node) {
15213
15269
  const value = node.value ? node.value + '\n' : '';
15214
15270
  /** @type {Properties} */
15215
15271
  const properties = {};
15272
+ // Someone can write `js&#x20;python&#x9;ruby`.
15273
+ const language = node.lang ? node.lang.split(/\s+/) : [];
15216
15274
 
15217
- if (node.lang) {
15218
- properties.className = ['language-' + node.lang];
15275
+ // GH/CM still drop the non-first languages.
15276
+ if (language.length > 0) {
15277
+ properties.className = ['language-' + language[0]];
15219
15278
  }
15220
15279
 
15221
15280
  // Create `<code>`.
@@ -15241,12 +15300,11 @@ function code(state, node) {
15241
15300
  }
15242
15301
 
15243
15302
  /**
15244
- * @typedef {import('hast').Element} Element
15245
- * @typedef {import('mdast').Delete} Delete
15246
- * @typedef {import('../state.js').State} State
15303
+ * @import {Element} from 'hast'
15304
+ * @import {Delete} from 'mdast'
15305
+ * @import {State} from '../state.js'
15247
15306
  */
15248
15307
 
15249
-
15250
15308
  /**
15251
15309
  * Turn an mdast `delete` node into hast.
15252
15310
  *
@@ -15270,12 +15328,11 @@ function strikethrough(state, node) {
15270
15328
  }
15271
15329
 
15272
15330
  /**
15273
- * @typedef {import('hast').Element} Element
15274
- * @typedef {import('mdast').Emphasis} Emphasis
15275
- * @typedef {import('../state.js').State} State
15331
+ * @import {Element} from 'hast'
15332
+ * @import {Emphasis} from 'mdast'
15333
+ * @import {State} from '../state.js'
15276
15334
  */
15277
15335
 
15278
-
15279
15336
  /**
15280
15337
  * Turn an mdast `emphasis` node into hast.
15281
15338
  *
@@ -15299,142 +15356,34 @@ function emphasis(state, node) {
15299
15356
  }
15300
15357
 
15301
15358
  /**
15302
- * @typedef {import('micromark-util-types').Code} Code
15359
+ * @import {Element} from 'hast'
15360
+ * @import {FootnoteReference} from 'mdast'
15361
+ * @import {State} from '../state.js'
15303
15362
  */
15304
15363
 
15305
15364
 
15306
15365
  /**
15307
- * Check whether the character code represents an ASCII alphanumeric (`a`
15308
- * through `z`, case insensitive, or `0` through `9`).
15309
- *
15310
- * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
15311
- * (see `asciiAlpha`).
15366
+ * Turn an mdast `footnoteReference` node into hast.
15312
15367
  *
15313
- * @param code
15314
- * Code.
15315
- * @returns {boolean}
15316
- * Whether it matches.
15368
+ * @param {State} state
15369
+ * Info passed around.
15370
+ * @param {FootnoteReference} node
15371
+ * mdast node.
15372
+ * @returns {Element}
15373
+ * hast node.
15317
15374
  */
15318
- const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
15375
+ function footnoteReference(state, node) {
15376
+ const clobberPrefix =
15377
+ typeof state.options.clobberPrefix === 'string'
15378
+ ? state.options.clobberPrefix
15379
+ : 'user-content-';
15380
+ const id = String(node.identifier).toUpperCase();
15381
+ const safeId = normalizeUri(id.toLowerCase());
15382
+ const index = state.footnoteOrder.indexOf(id);
15383
+ /** @type {number} */
15384
+ let counter;
15319
15385
 
15320
- /**
15321
- * Create a code check from a regex.
15322
- *
15323
- * @param {RegExp} regex
15324
- * @returns {(code: Code) => boolean}
15325
- */
15326
- function regexCheck(regex) {
15327
- return check;
15328
-
15329
- /**
15330
- * Check whether a code matches the bound regex.
15331
- *
15332
- * @param {Code} code
15333
- * Character code.
15334
- * @returns {boolean}
15335
- * Whether the character code matches the bound regex.
15336
- */
15337
- function check(code) {
15338
- return code !== null && code > -1 && regex.test(String.fromCharCode(code));
15339
- }
15340
- }
15341
-
15342
- /**
15343
- * Normalize a URL.
15344
- *
15345
- * Encode unsafe characters with percent-encoding, skipping already encoded
15346
- * sequences.
15347
- *
15348
- * @param {string} value
15349
- * URI to normalize.
15350
- * @returns {string}
15351
- * Normalized URI.
15352
- */
15353
- function normalizeUri(value) {
15354
- /** @type {Array<string>} */
15355
- const result = [];
15356
- let index = -1;
15357
- let start = 0;
15358
- let skip = 0;
15359
- while (++index < value.length) {
15360
- const code = value.charCodeAt(index);
15361
- /** @type {string} */
15362
- let replace = '';
15363
-
15364
- // A correct percent encoded value.
15365
- if (
15366
- code === 37 &&
15367
- asciiAlphanumeric(value.charCodeAt(index + 1)) &&
15368
- asciiAlphanumeric(value.charCodeAt(index + 2))
15369
- ) {
15370
- skip = 2;
15371
- }
15372
- // ASCII.
15373
- else if (code < 128) {
15374
- if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
15375
- replace = String.fromCharCode(code);
15376
- }
15377
- }
15378
- // Astral.
15379
- else if (code > 55_295 && code < 57_344) {
15380
- const next = value.charCodeAt(index + 1);
15381
-
15382
- // A correct surrogate pair.
15383
- if (code < 56_320 && next > 56_319 && next < 57_344) {
15384
- replace = String.fromCharCode(code, next);
15385
- skip = 1;
15386
- }
15387
- // Lone surrogate.
15388
- else {
15389
- replace = '\uFFFD';
15390
- }
15391
- }
15392
- // Unicode.
15393
- else {
15394
- replace = String.fromCharCode(code);
15395
- }
15396
- if (replace) {
15397
- result.push(value.slice(start, index), encodeURIComponent(replace));
15398
- start = index + skip + 1;
15399
- replace = '';
15400
- }
15401
- if (skip) {
15402
- index += skip;
15403
- skip = 0;
15404
- }
15405
- }
15406
- return result.join('') + value.slice(start)
15407
- }
15408
-
15409
- /**
15410
- * @typedef {import('hast').Element} Element
15411
- * @typedef {import('mdast').FootnoteReference} FootnoteReference
15412
- * @typedef {import('../state.js').State} State
15413
- */
15414
-
15415
-
15416
- /**
15417
- * Turn an mdast `footnoteReference` node into hast.
15418
- *
15419
- * @param {State} state
15420
- * Info passed around.
15421
- * @param {FootnoteReference} node
15422
- * mdast node.
15423
- * @returns {Element}
15424
- * hast node.
15425
- */
15426
- function footnoteReference(state, node) {
15427
- const clobberPrefix =
15428
- typeof state.options.clobberPrefix === 'string'
15429
- ? state.options.clobberPrefix
15430
- : 'user-content-';
15431
- const id = String(node.identifier).toUpperCase();
15432
- const safeId = normalizeUri(id.toLowerCase());
15433
- const index = state.footnoteOrder.indexOf(id);
15434
- /** @type {number} */
15435
- let counter;
15436
-
15437
- let reuseCounter = state.footnoteCounts.get(id);
15386
+ let reuseCounter = state.footnoteCounts.get(id);
15438
15387
 
15439
15388
  if (reuseCounter === undefined) {
15440
15389
  reuseCounter = 0;
@@ -15477,12 +15426,11 @@ function footnoteReference(state, node) {
15477
15426
  }
15478
15427
 
15479
15428
  /**
15480
- * @typedef {import('hast').Element} Element
15481
- * @typedef {import('mdast').Heading} Heading
15482
- * @typedef {import('../state.js').State} State
15429
+ * @import {Element} from 'hast'
15430
+ * @import {Heading} from 'mdast'
15431
+ * @import {State} from '../state.js'
15483
15432
  */
15484
15433
 
15485
-
15486
15434
  /**
15487
15435
  * Turn an mdast `heading` node into hast.
15488
15436
  *
@@ -15506,13 +15454,12 @@ function heading(state, node) {
15506
15454
  }
15507
15455
 
15508
15456
  /**
15509
- * @typedef {import('hast').Element} Element
15510
- * @typedef {import('mdast').Html} Html
15511
- * @typedef {import('../state.js').State} State
15512
- * @typedef {import('../../index.js').Raw} Raw
15457
+ * @import {Element} from 'hast'
15458
+ * @import {Html} from 'mdast'
15459
+ * @import {State} from '../state.js'
15460
+ * @import {Raw} from '../../index.js'
15513
15461
  */
15514
15462
 
15515
-
15516
15463
  /**
15517
15464
  * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
15518
15465
  * nothing).
@@ -15536,15 +15483,11 @@ function html(state, node) {
15536
15483
  }
15537
15484
 
15538
15485
  /**
15539
- * @typedef {import('hast').ElementContent} ElementContent
15540
- *
15541
- * @typedef {import('mdast').Nodes} Nodes
15542
- * @typedef {import('mdast').Reference} Reference
15543
- *
15544
- * @typedef {import('./state.js').State} State
15486
+ * @import {ElementContent} from 'hast'
15487
+ * @import {Reference, Nodes} from 'mdast'
15488
+ * @import {State} from './state.js'
15545
15489
  */
15546
15490
 
15547
-
15548
15491
  /**
15549
15492
  * Return the content of a reference without definition as plain text.
15550
15493
  *
@@ -15590,11 +15533,9 @@ function revert(state, node) {
15590
15533
  }
15591
15534
 
15592
15535
  /**
15593
- * @typedef {import('hast').Element} Element
15594
- * @typedef {import('hast').ElementContent} ElementContent
15595
- * @typedef {import('hast').Properties} Properties
15596
- * @typedef {import('mdast').ImageReference} ImageReference
15597
- * @typedef {import('../state.js').State} State
15536
+ * @import {ElementContent, Element, Properties} from 'hast'
15537
+ * @import {ImageReference} from 'mdast'
15538
+ * @import {State} from '../state.js'
15598
15539
  */
15599
15540
 
15600
15541
 
@@ -15630,10 +15571,9 @@ function imageReference(state, node) {
15630
15571
  }
15631
15572
 
15632
15573
  /**
15633
- * @typedef {import('hast').Element} Element
15634
- * @typedef {import('hast').Properties} Properties
15635
- * @typedef {import('mdast').Image} Image
15636
- * @typedef {import('../state.js').State} State
15574
+ * @import {Element, Properties} from 'hast'
15575
+ * @import {Image} from 'mdast'
15576
+ * @import {State} from '../state.js'
15637
15577
  */
15638
15578
 
15639
15579
 
@@ -15666,13 +15606,11 @@ function image(state, node) {
15666
15606
  }
15667
15607
 
15668
15608
  /**
15669
- * @typedef {import('hast').Element} Element
15670
- * @typedef {import('hast').Text} Text
15671
- * @typedef {import('mdast').InlineCode} InlineCode
15672
- * @typedef {import('../state.js').State} State
15609
+ * @import {Element, Text} from 'hast'
15610
+ * @import {InlineCode} from 'mdast'
15611
+ * @import {State} from '../state.js'
15673
15612
  */
15674
15613
 
15675
-
15676
15614
  /**
15677
15615
  * Turn an mdast `inlineCode` node into hast.
15678
15616
  *
@@ -15700,11 +15638,9 @@ function inlineCode(state, node) {
15700
15638
  }
15701
15639
 
15702
15640
  /**
15703
- * @typedef {import('hast').Element} Element
15704
- * @typedef {import('hast').ElementContent} ElementContent
15705
- * @typedef {import('hast').Properties} Properties
15706
- * @typedef {import('mdast').LinkReference} LinkReference
15707
- * @typedef {import('../state.js').State} State
15641
+ * @import {ElementContent, Element, Properties} from 'hast'
15642
+ * @import {LinkReference} from 'mdast'
15643
+ * @import {State} from '../state.js'
15708
15644
  */
15709
15645
 
15710
15646
 
@@ -15745,10 +15681,9 @@ function linkReference(state, node) {
15745
15681
  }
15746
15682
 
15747
15683
  /**
15748
- * @typedef {import('hast').Element} Element
15749
- * @typedef {import('hast').Properties} Properties
15750
- * @typedef {import('mdast').Link} Link
15751
- * @typedef {import('../state.js').State} State
15684
+ * @import {Element, Properties} from 'hast'
15685
+ * @import {Link} from 'mdast'
15686
+ * @import {State} from '../state.js'
15752
15687
  */
15753
15688
 
15754
15689
 
@@ -15782,15 +15717,11 @@ function link(state, node) {
15782
15717
  }
15783
15718
 
15784
15719
  /**
15785
- * @typedef {import('hast').Element} Element
15786
- * @typedef {import('hast').ElementContent} ElementContent
15787
- * @typedef {import('hast').Properties} Properties
15788
- * @typedef {import('mdast').ListItem} ListItem
15789
- * @typedef {import('mdast').Parents} Parents
15790
- * @typedef {import('../state.js').State} State
15720
+ * @import {ElementContent, Element, Properties} from 'hast'
15721
+ * @import {ListItem, Parents} from 'mdast'
15722
+ * @import {State} from '../state.js'
15791
15723
  */
15792
15724
 
15793
-
15794
15725
  /**
15795
15726
  * Turn an mdast `listItem` node into hast.
15796
15727
  *
@@ -15906,13 +15837,11 @@ function listItemLoose(node) {
15906
15837
  }
15907
15838
 
15908
15839
  /**
15909
- * @typedef {import('hast').Element} Element
15910
- * @typedef {import('hast').Properties} Properties
15911
- * @typedef {import('mdast').List} List
15912
- * @typedef {import('../state.js').State} State
15840
+ * @import {Element, Properties} from 'hast'
15841
+ * @import {List} from 'mdast'
15842
+ * @import {State} from '../state.js'
15913
15843
  */
15914
15844
 
15915
-
15916
15845
  /**
15917
15846
  * Turn an mdast `list` node into hast.
15918
15847
  *
@@ -15961,12 +15890,11 @@ function list(state, node) {
15961
15890
  }
15962
15891
 
15963
15892
  /**
15964
- * @typedef {import('hast').Element} Element
15965
- * @typedef {import('mdast').Paragraph} Paragraph
15966
- * @typedef {import('../state.js').State} State
15893
+ * @import {Element} from 'hast'
15894
+ * @import {Paragraph} from 'mdast'
15895
+ * @import {State} from '../state.js'
15967
15896
  */
15968
15897
 
15969
-
15970
15898
  /**
15971
15899
  * Turn an mdast `paragraph` node into hast.
15972
15900
  *
@@ -15990,13 +15918,11 @@ function paragraph(state, node) {
15990
15918
  }
15991
15919
 
15992
15920
  /**
15993
- * @typedef {import('hast').Parents} HastParents
15994
- * @typedef {import('hast').Root} HastRoot
15995
- * @typedef {import('mdast').Root} MdastRoot
15996
- * @typedef {import('../state.js').State} State
15921
+ * @import {Parents as HastParents, Root as HastRoot} from 'hast'
15922
+ * @import {Root as MdastRoot} from 'mdast'
15923
+ * @import {State} from '../state.js'
15997
15924
  */
15998
15925
 
15999
-
16000
15926
  /**
16001
15927
  * Turn an mdast `root` node into hast.
16002
15928
  *
@@ -16015,12 +15941,11 @@ function root(state, node) {
16015
15941
  }
16016
15942
 
16017
15943
  /**
16018
- * @typedef {import('hast').Element} Element
16019
- * @typedef {import('mdast').Strong} Strong
16020
- * @typedef {import('../state.js').State} State
15944
+ * @import {Element} from 'hast'
15945
+ * @import {Strong} from 'mdast'
15946
+ * @import {State} from '../state.js'
16021
15947
  */
16022
15948
 
16023
-
16024
15949
  /**
16025
15950
  * Turn an mdast `strong` node into hast.
16026
15951
  *
@@ -16044,9 +15969,9 @@ function strong(state, node) {
16044
15969
  }
16045
15970
 
16046
15971
  /**
16047
- * @typedef {import('hast').Element} Element
16048
- * @typedef {import('mdast').Table} Table
16049
- * @typedef {import('../state.js').State} State
15972
+ * @import {Table} from 'mdast'
15973
+ * @import {Element} from 'hast'
15974
+ * @import {State} from '../state.js'
16050
15975
  */
16051
15976
 
16052
15977
 
@@ -16105,15 +16030,11 @@ function table(state, node) {
16105
16030
  }
16106
16031
 
16107
16032
  /**
16108
- * @typedef {import('hast').Element} Element
16109
- * @typedef {import('hast').ElementContent} ElementContent
16110
- * @typedef {import('hast').Properties} Properties
16111
- * @typedef {import('mdast').Parents} Parents
16112
- * @typedef {import('mdast').TableRow} TableRow
16113
- * @typedef {import('../state.js').State} State
16033
+ * @import {Element, ElementContent, Properties} from 'hast'
16034
+ * @import {Parents, TableRow} from 'mdast'
16035
+ * @import {State} from '../state.js'
16114
16036
  */
16115
16037
 
16116
-
16117
16038
  /**
16118
16039
  * Turn an mdast `tableRow` node into hast.
16119
16040
  *
@@ -16173,12 +16094,11 @@ function tableRow(state, node, parent) {
16173
16094
  }
16174
16095
 
16175
16096
  /**
16176
- * @typedef {import('hast').Element} Element
16177
- * @typedef {import('mdast').TableCell} TableCell
16178
- * @typedef {import('../state.js').State} State
16097
+ * @import {Element} from 'hast'
16098
+ * @import {TableCell} from 'mdast'
16099
+ * @import {State} from '../state.js'
16179
16100
  */
16180
16101
 
16181
-
16182
16102
  /**
16183
16103
  * Turn an mdast `tableCell` node into hast.
16184
16104
  *
@@ -16274,10 +16194,9 @@ function trimLine(value, start, end) {
16274
16194
  }
16275
16195
 
16276
16196
  /**
16277
- * @typedef {import('hast').Element} HastElement
16278
- * @typedef {import('hast').Text} HastText
16279
- * @typedef {import('mdast').Text} MdastText
16280
- * @typedef {import('../state.js').State} State
16197
+ * @import {Element as HastElement, Text as HastText} from 'hast'
16198
+ * @import {Text as MdastText} from 'mdast'
16199
+ * @import {State} from '../state.js'
16281
16200
  */
16282
16201
 
16283
16202
 
@@ -16299,12 +16218,11 @@ function text(state, node) {
16299
16218
  }
16300
16219
 
16301
16220
  /**
16302
- * @typedef {import('hast').Element} Element
16303
- * @typedef {import('mdast').ThematicBreak} ThematicBreak
16304
- * @typedef {import('../state.js').State} State
16221
+ * @import {Element} from 'hast'
16222
+ * @import {ThematicBreak} from 'mdast'
16223
+ * @import {State} from '../state.js'
16305
16224
  */
16306
16225
 
16307
-
16308
16226
  /**
16309
16227
  * Turn an mdast `thematicBreak` node into hast.
16310
16228
  *
@@ -16327,10 +16245,15 @@ function thematicBreak(state, node) {
16327
16245
  return state.applyData(node, result)
16328
16246
  }
16329
16247
 
16248
+ /**
16249
+ * @import {Handlers} from '../state.js'
16250
+ */
16251
+
16252
+
16330
16253
  /**
16331
16254
  * Default handlers for nodes.
16332
16255
  *
16333
- * @satisfies {import('../state.js').Handlers}
16256
+ * @satisfies {Handlers}
16334
16257
  */
16335
16258
  const handlers = {
16336
16259
  blockquote,
@@ -16435,6 +16358,12 @@ const deserializer = ($, _) => {
16435
16358
  return as(BigInt(value), index);
16436
16359
  case 'BigInt':
16437
16360
  return as(Object(BigInt(value)), index);
16361
+ case 'ArrayBuffer':
16362
+ return as(new Uint8Array(value).buffer, value);
16363
+ case 'DataView': {
16364
+ const { buffer } = new Uint8Array(value);
16365
+ return as(new DataView(buffer), value);
16366
+ }
16438
16367
  }
16439
16368
  return as(new env[type](value), index);
16440
16369
  };
@@ -16477,6 +16406,8 @@ const typeOf = value => {
16477
16406
  return [MAP, EMPTY];
16478
16407
  case 'Set':
16479
16408
  return [SET, EMPTY];
16409
+ case 'DataView':
16410
+ return [ARRAY, asString];
16480
16411
  }
16481
16412
 
16482
16413
  if (asString.includes('Array'))
@@ -16526,9 +16457,17 @@ const serializer = (strict, json, $, _) => {
16526
16457
  return as([TYPE, entry], value);
16527
16458
  }
16528
16459
  case ARRAY: {
16529
- if (type)
16530
- return as([type, [...value]], value);
16531
-
16460
+ if (type) {
16461
+ let spread = value;
16462
+ if (type === 'DataView') {
16463
+ spread = new Uint8Array(value.buffer);
16464
+ }
16465
+ else if (type === 'ArrayBuffer') {
16466
+ spread = new Uint8Array(value);
16467
+ }
16468
+ return as([type, [...spread]], value);
16469
+ }
16470
+
16532
16471
  const arr = [];
16533
16472
  const index = as([TYPE, arr], value);
16534
16473
  for (const entry of value)
@@ -16629,10 +16568,8 @@ var structuredClone$1 = typeof structuredClone === "function" ?
16629
16568
  (any, options) => deserialize(serialize(any, options));
16630
16569
 
16631
16570
  /**
16632
- * @typedef {import('hast').Element} Element
16633
- * @typedef {import('hast').ElementContent} ElementContent
16634
- *
16635
- * @typedef {import('./state.js').State} State
16571
+ * @import {ElementContent, Element} from 'hast'
16572
+ * @import {State} from './state.js'
16636
16573
  */
16637
16574
 
16638
16575
 
@@ -17280,22 +17217,25 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
17280
17217
  }
17281
17218
 
17282
17219
  /**
17283
- * @typedef {import('hast').Element} HastElement
17284
- * @typedef {import('hast').ElementContent} HastElementContent
17285
- * @typedef {import('hast').Nodes} HastNodes
17286
- * @typedef {import('hast').Properties} HastProperties
17287
- * @typedef {import('hast').RootContent} HastRootContent
17288
- * @typedef {import('hast').Text} HastText
17289
- *
17290
- * @typedef {import('mdast').Definition} MdastDefinition
17291
- * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition
17292
- * @typedef {import('mdast').Nodes} MdastNodes
17293
- * @typedef {import('mdast').Parents} MdastParents
17294
- *
17295
- * @typedef {import('vfile').VFile} VFile
17296
- *
17297
- * @typedef {import('./footer.js').FootnoteBackContentTemplate} FootnoteBackContentTemplate
17298
- * @typedef {import('./footer.js').FootnoteBackLabelTemplate} FootnoteBackLabelTemplate
17220
+ * @import {
17221
+ * ElementContent as HastElementContent,
17222
+ * Element as HastElement,
17223
+ * Nodes as HastNodes,
17224
+ * Properties as HastProperties,
17225
+ * RootContent as HastRootContent,
17226
+ * Text as HastText
17227
+ * } from 'hast'
17228
+ * @import {
17229
+ * Definition as MdastDefinition,
17230
+ * FootnoteDefinition as MdastFootnoteDefinition,
17231
+ * Nodes as MdastNodes,
17232
+ * Parents as MdastParents
17233
+ * } from 'mdast'
17234
+ * @import {VFile} from 'vfile'
17235
+ * @import {
17236
+ * FootnoteBackContentTemplate,
17237
+ * FootnoteBackLabelTemplate
17238
+ * } from './footer.js'
17299
17239
  */
17300
17240
 
17301
17241
 
@@ -17453,7 +17393,7 @@ function createState(tree, options) {
17453
17393
  * Nothing.
17454
17394
  */
17455
17395
  function patch(from, to) {
17456
- if (from.position) to.position = position$2(from);
17396
+ if (from.position) to.position = position$1(from);
17457
17397
  }
17458
17398
 
17459
17399
  /**
@@ -17595,9 +17535,9 @@ function trimMarkdownSpaceStart(value) {
17595
17535
  }
17596
17536
 
17597
17537
  /**
17598
- * @typedef {import('hast').Nodes} HastNodes
17599
- * @typedef {import('mdast').Nodes} MdastNodes
17600
- * @typedef {import('./state.js').Options} Options
17538
+ * @import {Nodes as HastNodes} from 'hast'
17539
+ * @import {Nodes as MdastNodes} from 'mdast'
17540
+ * @import {Options} from './state.js'
17601
17541
  */
17602
17542
 
17603
17543
 
@@ -18189,303 +18129,6 @@ function wrap(middleware, callback) {
18189
18129
  }
18190
18130
  }
18191
18131
 
18192
- /**
18193
- * @import {Node, Point, Position} from 'unist'
18194
- */
18195
-
18196
-
18197
- /**
18198
- * Message.
18199
- */
18200
- class VFileMessage extends Error {
18201
- /**
18202
- * Create a message for `reason`.
18203
- *
18204
- * > 🪦 **Note**: also has obsolete signatures.
18205
- *
18206
- * @overload
18207
- * @param {string} reason
18208
- * @param {Options | null | undefined} [options]
18209
- * @returns
18210
- *
18211
- * @overload
18212
- * @param {string} reason
18213
- * @param {Node | NodeLike | null | undefined} parent
18214
- * @param {string | null | undefined} [origin]
18215
- * @returns
18216
- *
18217
- * @overload
18218
- * @param {string} reason
18219
- * @param {Point | Position | null | undefined} place
18220
- * @param {string | null | undefined} [origin]
18221
- * @returns
18222
- *
18223
- * @overload
18224
- * @param {string} reason
18225
- * @param {string | null | undefined} [origin]
18226
- * @returns
18227
- *
18228
- * @overload
18229
- * @param {Error | VFileMessage} cause
18230
- * @param {Node | NodeLike | null | undefined} parent
18231
- * @param {string | null | undefined} [origin]
18232
- * @returns
18233
- *
18234
- * @overload
18235
- * @param {Error | VFileMessage} cause
18236
- * @param {Point | Position | null | undefined} place
18237
- * @param {string | null | undefined} [origin]
18238
- * @returns
18239
- *
18240
- * @overload
18241
- * @param {Error | VFileMessage} cause
18242
- * @param {string | null | undefined} [origin]
18243
- * @returns
18244
- *
18245
- * @param {Error | VFileMessage | string} causeOrReason
18246
- * Reason for message, should use markdown.
18247
- * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
18248
- * Configuration (optional).
18249
- * @param {string | null | undefined} [origin]
18250
- * Place in code where the message originates (example:
18251
- * `'my-package:my-rule'` or `'my-rule'`).
18252
- * @returns
18253
- * Instance of `VFileMessage`.
18254
- */
18255
- // eslint-disable-next-line complexity
18256
- constructor(causeOrReason, optionsOrParentOrPlace, origin) {
18257
- super();
18258
-
18259
- if (typeof optionsOrParentOrPlace === 'string') {
18260
- origin = optionsOrParentOrPlace;
18261
- optionsOrParentOrPlace = undefined;
18262
- }
18263
-
18264
- /** @type {string} */
18265
- let reason = '';
18266
- /** @type {Options} */
18267
- let options = {};
18268
- let legacyCause = false;
18269
-
18270
- if (optionsOrParentOrPlace) {
18271
- // Point.
18272
- if (
18273
- 'line' in optionsOrParentOrPlace &&
18274
- 'column' in optionsOrParentOrPlace
18275
- ) {
18276
- options = {place: optionsOrParentOrPlace};
18277
- }
18278
- // Position.
18279
- else if (
18280
- 'start' in optionsOrParentOrPlace &&
18281
- 'end' in optionsOrParentOrPlace
18282
- ) {
18283
- options = {place: optionsOrParentOrPlace};
18284
- }
18285
- // Node.
18286
- else if ('type' in optionsOrParentOrPlace) {
18287
- options = {
18288
- ancestors: [optionsOrParentOrPlace],
18289
- place: optionsOrParentOrPlace.position
18290
- };
18291
- }
18292
- // Options.
18293
- else {
18294
- options = {...optionsOrParentOrPlace};
18295
- }
18296
- }
18297
-
18298
- if (typeof causeOrReason === 'string') {
18299
- reason = causeOrReason;
18300
- }
18301
- // Error.
18302
- else if (!options.cause && causeOrReason) {
18303
- legacyCause = true;
18304
- reason = causeOrReason.message;
18305
- options.cause = causeOrReason;
18306
- }
18307
-
18308
- if (!options.ruleId && !options.source && typeof origin === 'string') {
18309
- const index = origin.indexOf(':');
18310
-
18311
- if (index === -1) {
18312
- options.ruleId = origin;
18313
- } else {
18314
- options.source = origin.slice(0, index);
18315
- options.ruleId = origin.slice(index + 1);
18316
- }
18317
- }
18318
-
18319
- if (!options.place && options.ancestors && options.ancestors) {
18320
- const parent = options.ancestors[options.ancestors.length - 1];
18321
-
18322
- if (parent) {
18323
- options.place = parent.position;
18324
- }
18325
- }
18326
-
18327
- const start =
18328
- options.place && 'start' in options.place
18329
- ? options.place.start
18330
- : options.place;
18331
-
18332
- /**
18333
- * Stack of ancestor nodes surrounding the message.
18334
- *
18335
- * @type {Array<Node> | undefined}
18336
- */
18337
- this.ancestors = options.ancestors || undefined;
18338
-
18339
- /**
18340
- * Original error cause of the message.
18341
- *
18342
- * @type {Error | undefined}
18343
- */
18344
- this.cause = options.cause || undefined;
18345
-
18346
- /**
18347
- * Starting column of message.
18348
- *
18349
- * @type {number | undefined}
18350
- */
18351
- this.column = start ? start.column : undefined;
18352
-
18353
- /**
18354
- * State of problem.
18355
- *
18356
- * * `true` — error, file not usable
18357
- * * `false` — warning, change may be needed
18358
- * * `undefined` — change likely not needed
18359
- *
18360
- * @type {boolean | null | undefined}
18361
- */
18362
- this.fatal = undefined;
18363
-
18364
- /**
18365
- * Path of a file (used throughout the `VFile` ecosystem).
18366
- *
18367
- * @type {string | undefined}
18368
- */
18369
- this.file = '';
18370
-
18371
- // Field from `Error`.
18372
- /**
18373
- * Reason for message.
18374
- *
18375
- * @type {string}
18376
- */
18377
- this.message = reason;
18378
-
18379
- /**
18380
- * Starting line of error.
18381
- *
18382
- * @type {number | undefined}
18383
- */
18384
- this.line = start ? start.line : undefined;
18385
-
18386
- // Field from `Error`.
18387
- /**
18388
- * Serialized positional info of message.
18389
- *
18390
- * On normal errors, this would be something like `ParseError`, buit in
18391
- * `VFile` messages we use this space to show where an error happened.
18392
- */
18393
- this.name = stringifyPosition(options.place) || '1:1';
18394
-
18395
- /**
18396
- * Place of message.
18397
- *
18398
- * @type {Point | Position | undefined}
18399
- */
18400
- this.place = options.place || undefined;
18401
-
18402
- /**
18403
- * Reason for message, should use markdown.
18404
- *
18405
- * @type {string}
18406
- */
18407
- this.reason = this.message;
18408
-
18409
- /**
18410
- * Category of message (example: `'my-rule'`).
18411
- *
18412
- * @type {string | undefined}
18413
- */
18414
- this.ruleId = options.ruleId || undefined;
18415
-
18416
- /**
18417
- * Namespace of message (example: `'my-package'`).
18418
- *
18419
- * @type {string | undefined}
18420
- */
18421
- this.source = options.source || undefined;
18422
-
18423
- // Field from `Error`.
18424
- /**
18425
- * Stack of message.
18426
- *
18427
- * This is used by normal errors to show where something happened in
18428
- * programming code, irrelevant for `VFile` messages,
18429
- *
18430
- * @type {string}
18431
- */
18432
- this.stack =
18433
- legacyCause && options.cause && typeof options.cause.stack === 'string'
18434
- ? options.cause.stack
18435
- : '';
18436
-
18437
- // The following fields are “well known”.
18438
- // Not standard.
18439
- // Feel free to add other non-standard fields to your messages.
18440
-
18441
- /**
18442
- * Specify the source value that’s being reported, which is deemed
18443
- * incorrect.
18444
- *
18445
- * @type {string | undefined}
18446
- */
18447
- this.actual = undefined;
18448
-
18449
- /**
18450
- * Suggest acceptable values that can be used instead of `actual`.
18451
- *
18452
- * @type {Array<string> | undefined}
18453
- */
18454
- this.expected = undefined;
18455
-
18456
- /**
18457
- * Long form description of the message (you should use markdown).
18458
- *
18459
- * @type {string | undefined}
18460
- */
18461
- this.note = undefined;
18462
-
18463
- /**
18464
- * Link to docs for the message.
18465
- *
18466
- * > 👉 **Note**: this must be an absolute URL that can be passed as `x`
18467
- * > to `new URL(x)`.
18468
- *
18469
- * @type {string | undefined}
18470
- */
18471
- this.url = undefined;
18472
- }
18473
- }
18474
-
18475
- VFileMessage.prototype.file = '';
18476
- VFileMessage.prototype.name = '';
18477
- VFileMessage.prototype.reason = '';
18478
- VFileMessage.prototype.message = '';
18479
- VFileMessage.prototype.stack = '';
18480
- VFileMessage.prototype.column = undefined;
18481
- VFileMessage.prototype.line = undefined;
18482
- VFileMessage.prototype.ancestors = undefined;
18483
- VFileMessage.prototype.cause = undefined;
18484
- VFileMessage.prototype.fatal = undefined;
18485
- VFileMessage.prototype.place = undefined;
18486
- VFileMessage.prototype.ruleId = undefined;
18487
- VFileMessage.prototype.source = undefined;
18488
-
18489
18132
  // A derivative work based on:
18490
18133
  // <https://github.com/browserify/path-browserify>.
18491
18134
  // Which is licensed: