@format.dev/react-mathml-types 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +10 -25
  2. package/index.d.ts +463 -1
  3. package/index.js +1 -3
  4. package/package.json +37 -31
package/README.md CHANGED
@@ -1,32 +1,17 @@
1
1
  # @format.dev/react-mathml-types
2
2
 
3
- **This is a bootstrap placeholder. It reserves the package name and does nothing else.**
3
+ React JSX TypeScript declarations for MathML elements.
4
4
 
5
- Format is not released yet. Version `0.0.0` is not a usable version of this
6
- package: it contains no implementation, and installing it gets you an empty
7
- module.
5
+ This package augments React's JSX types so MathML elements such as `<math>`, `<mrow>`, `<mi>`, `<mo>`, `<semantics>`, `<annotation>`, and `<annotation-xml>` can be used in `.tsx` files without TypeScript errors.
8
6
 
9
- ## Why it exists
7
+ ## Installation
10
8
 
11
- npm binds a package’s trusted publisher, and its staged-publishing flow, to a
12
- package that already exists. Creating these names ahead of the first release is
13
- what lets every real release go out through a reviewed, credential-free
14
- workflow rather than through a token somebody holds.
9
+ ```sh
10
+ npm install "@format.dev/react-mathml-types"
11
+ ```
15
12
 
16
- This version is published deliberately and deprecated immediately.
13
+ Then import the module anywhere in your app code:
17
14
 
18
- ## Why a bare install resolves it
19
-
20
- npm creates a `latest` tag on a package’s first publish and will not remove it,
21
- so `latest` points at this placeholder until Format reaches general
22
- availability. That is why the deprecation warning is there.
23
-
24
- - Beta releases go out under the `beta` tag.
25
- - General availability is when `latest` moves to a real release.
26
-
27
- ## Format
28
-
29
- - https://format.dev
30
- - https://github.com/format-hq/format-js
31
-
32
- Licensed under MIT. The full text ships beside this file.
15
+ ```js
16
+ import '@format.dev/react-mathml-types'
17
+ ```
package/index.d.ts CHANGED
@@ -1,2 +1,464 @@
1
- // This is a bootstrap placeholder. Format is not released yet.
1
+ import type * as React from 'react'
2
+
2
3
  export {}
4
+
5
+ type LooseAutocomplete<T extends string> = T | (string & {})
6
+
7
+ type MathMLBooleanish = boolean | 'true' | 'false'
8
+ type MathMLLength = number | string
9
+ type MathMLUnsignedInteger = number | `${number}` | (string & {})
10
+ type MathMLScriptLevel = number | `${number}` | `+${number}` | `-${number}` | (string & {})
11
+
12
+ type MathMLNamespaceURI = 'http://www.w3.org/1998/Math/MathML'
13
+
14
+ type MathMLOperatorForm = 'prefix' | 'infix' | 'postfix'
15
+
16
+ type MathMLFractionAlign = 'left' | 'center' | 'right'
17
+
18
+ type MathMLTableAlign = LooseAutocomplete<'axis' | 'baseline' | 'bottom' | 'center' | 'top'>
19
+
20
+ type MathMLTableColumnAlign = LooseAutocomplete<'left' | 'center' | 'right'>
21
+
22
+ type MathMLTableRowAlign = LooseAutocomplete<'axis' | 'baseline' | 'bottom' | 'center' | 'top'>
23
+
24
+ type MathMLTableLine = LooseAutocomplete<'none' | 'solid' | 'dashed'>
25
+
26
+ type MathMLMathVariant = LooseAutocomplete<
27
+ | 'normal'
28
+ | 'bold'
29
+ | 'italic'
30
+ | 'bold-italic'
31
+ | 'double-struck'
32
+ | 'bold-fraktur'
33
+ | 'script'
34
+ | 'bold-script'
35
+ | 'fraktur'
36
+ | 'sans-serif'
37
+ | 'bold-sans-serif'
38
+ | 'sans-serif-italic'
39
+ | 'sans-serif-bold-italic'
40
+ | 'monospace'
41
+ | 'initial'
42
+ | 'tailed'
43
+ | 'looped'
44
+ | 'stretched'
45
+ >
46
+
47
+ type MathMLMencloseNotation = LooseAutocomplete<
48
+ | 'longdiv'
49
+ | 'actuarial'
50
+ | 'box'
51
+ | 'roundedbox'
52
+ | 'circle'
53
+ | 'left'
54
+ | 'right'
55
+ | 'top'
56
+ | 'bottom'
57
+ | 'updiagonalstrike'
58
+ | 'downdiagonalstrike'
59
+ | 'verticalstrike'
60
+ | 'horizontalstrike'
61
+ | 'madruwb'
62
+ | 'updiagonalarrow'
63
+ | 'phasorangle'
64
+ >
65
+
66
+ type MathMLGlobalAttributes = {
67
+ /**
68
+ * MathML/HTML global attribute.
69
+ * Prefer React's `autoFocus` prop in ordinary React code.
70
+ */
71
+ autofocus?: boolean | ''
72
+
73
+ /**
74
+ * MathML/HTML global attribute.
75
+ * Prefer React's `className` prop in ordinary React code.
76
+ */
77
+ class?: string
78
+
79
+ dir?: 'ltr' | 'rtl'
80
+ displaystyle?: MathMLBooleanish
81
+
82
+ /**
83
+ * Non-standard MathML hyperlink attribute documented by MDN.
84
+ */
85
+ href?: string
86
+
87
+ id?: string
88
+
89
+ /**
90
+ * @deprecated Legacy MathML style attribute. Prefer CSS `background-color`.
91
+ */
92
+ mathbackground?: string
93
+
94
+ /**
95
+ * @deprecated Legacy MathML style attribute. Prefer CSS `color`.
96
+ */
97
+ mathcolor?: string
98
+
99
+ /**
100
+ * @deprecated Legacy MathML style attribute. Prefer CSS `font-size`.
101
+ */
102
+ mathsize?: MathMLLength
103
+
104
+ nonce?: string
105
+ scriptlevel?: MathMLScriptLevel
106
+ tabindex?: number | string
107
+
108
+ /**
109
+ * Reserved by MathML Core / MathML 4.
110
+ */
111
+ intent?: string
112
+
113
+ /**
114
+ * Reserved by MathML Core / MathML 4.
115
+ */
116
+ arg?: string
117
+
118
+ [dataAttribute: `data-${string}`]: string | number | boolean | undefined
119
+ }
120
+
121
+ type MathMLProps<AdditionalProps = {}> = React.DetailedHTMLProps<
122
+ React.HTMLAttributes<MathMLElement> & MathMLGlobalAttributes & AdditionalProps,
123
+ MathMLElement
124
+ >
125
+
126
+ type MathAttributes = {
127
+ display?: 'block' | 'inline'
128
+ alttext?: string
129
+ xmlns?: MathMLNamespaceURI | (string & {})
130
+ }
131
+
132
+ type AnnotationAttributes = {
133
+ encoding?: string
134
+
135
+ /**
136
+ * @deprecated External annotation sources are deprecated.
137
+ */
138
+ src?: string
139
+ }
140
+
141
+ type AnnotationXmlAttributes = AnnotationAttributes
142
+
143
+ type MactionAttributes = {
144
+ /**
145
+ * @deprecated Deprecated MathML element/attribute.
146
+ */
147
+ actiontype?: string
148
+
149
+ /**
150
+ * @deprecated Deprecated MathML element/attribute.
151
+ */
152
+ selection?: MathMLUnsignedInteger
153
+ }
154
+
155
+ type MencloseAttributes = {
156
+ /**
157
+ * Non-standard. Check browser support before using.
158
+ */
159
+ notation?: MathMLMencloseNotation
160
+ }
161
+
162
+ type MfencedAttributes = {
163
+ /**
164
+ * @deprecated Use explicit `<mrow>` and `<mo>` fences instead.
165
+ */
166
+ close?: string
167
+
168
+ /**
169
+ * @deprecated Use explicit `<mrow>` and `<mo>` fences instead.
170
+ */
171
+ open?: string
172
+
173
+ /**
174
+ * @deprecated Use explicit `<mrow>` and `<mo>` separators instead.
175
+ */
176
+ separators?: string
177
+ }
178
+
179
+ type MfracAttributes = {
180
+ linethickness?: MathMLLength
181
+
182
+ /**
183
+ * @deprecated Legacy MathML alignment attribute.
184
+ */
185
+ denomalign?: MathMLFractionAlign
186
+
187
+ /**
188
+ * @deprecated Legacy MathML alignment attribute.
189
+ */
190
+ numalign?: MathMLFractionAlign
191
+ }
192
+
193
+ type MiAttributes = {
194
+ /**
195
+ * MathML Core gives observable browser behavior mainly to `mathvariant="normal"`,
196
+ * but the broader MathML value set is accepted here for compatibility.
197
+ */
198
+ mathvariant?: MathMLMathVariant
199
+ }
200
+
201
+ type MoAttributes = {
202
+ /**
203
+ * Non-standard on `<mo>`; supported by some browsers.
204
+ */
205
+ accent?: MathMLBooleanish
206
+
207
+ fence?: MathMLBooleanish
208
+ form?: MathMLOperatorForm
209
+ largeop?: MathMLBooleanish
210
+ lspace?: MathMLLength
211
+ maxsize?: MathMLLength
212
+ minsize?: MathMLLength
213
+ movablelimits?: MathMLBooleanish
214
+ rspace?: MathMLLength
215
+ separator?: MathMLBooleanish
216
+ stretchy?: MathMLBooleanish
217
+ symmetric?: MathMLBooleanish
218
+ }
219
+
220
+ type MoverAttributes = {
221
+ accent?: MathMLBooleanish
222
+ }
223
+
224
+ type MunderAttributes = {
225
+ accentunder?: MathMLBooleanish
226
+ }
227
+
228
+ type MunderoverAttributes = MoverAttributes & MunderAttributes
229
+
230
+ type MpaddedAttributes = {
231
+ depth?: MathMLLength
232
+ height?: MathMLLength
233
+ lspace?: MathMLLength
234
+ voffset?: MathMLLength
235
+ width?: MathMLLength
236
+ }
237
+
238
+ type MspaceAttributes = {
239
+ depth?: MathMLLength
240
+ height?: MathMLLength
241
+ width?: MathMLLength
242
+ }
243
+
244
+ type MsAttributes = {
245
+ /**
246
+ * @deprecated Include quote characters in the text content instead.
247
+ */
248
+ lquote?: string
249
+
250
+ /**
251
+ * @deprecated Include quote characters in the text content instead.
252
+ */
253
+ rquote?: string
254
+ }
255
+
256
+ type MstyleAttributes = {
257
+ /**
258
+ * @deprecated Prefer CSS `background-color`.
259
+ */
260
+ background?: string
261
+
262
+ /**
263
+ * @deprecated Prefer CSS `color`.
264
+ */
265
+ color?: string
266
+
267
+ /**
268
+ * @deprecated Prefer CSS `font-family`.
269
+ */
270
+ fontfamily?: string
271
+
272
+ /**
273
+ * @deprecated Prefer CSS `font-size`.
274
+ */
275
+ fontsize?: MathMLLength
276
+
277
+ /**
278
+ * @deprecated Prefer CSS `font-style`.
279
+ */
280
+ fontstyle?: string
281
+
282
+ /**
283
+ * @deprecated Prefer CSS `font-weight`.
284
+ */
285
+ fontweight?: string
286
+
287
+ /**
288
+ * @deprecated Legacy MathML script sizing attribute.
289
+ */
290
+ scriptminsize?: MathMLLength
291
+
292
+ /**
293
+ * @deprecated Legacy MathML script sizing attribute.
294
+ */
295
+ scriptsizemultiplier?: number | string
296
+ }
297
+
298
+ type MsubAttributes = {
299
+ /**
300
+ * @deprecated Non-standard legacy MathML script shift attribute.
301
+ */
302
+ subscriptshift?: MathMLLength
303
+ }
304
+
305
+ type MsupAttributes = {
306
+ /**
307
+ * @deprecated Non-standard legacy MathML script shift attribute.
308
+ */
309
+ superscriptshift?: MathMLLength
310
+ }
311
+
312
+ type MsubsupAttributes = MsubAttributes & MsupAttributes
313
+
314
+ type MmultiscriptsAttributes = MsubsupAttributes
315
+
316
+ type MtableAttributes = {
317
+ /**
318
+ * Non-standard. Some browsers support values like `"axis 3"`.
319
+ */
320
+ align?: MathMLTableAlign
321
+
322
+ /**
323
+ * Non-standard. Can be a space-separated list.
324
+ */
325
+ columnalign?: MathMLTableColumnAlign
326
+
327
+ /**
328
+ * Non-standard. Can be a space-separated list.
329
+ */
330
+ columnlines?: MathMLTableLine
331
+
332
+ /**
333
+ * Non-standard. Can be a space-separated list.
334
+ */
335
+ columnspacing?: MathMLLength
336
+
337
+ /**
338
+ * Non-standard.
339
+ */
340
+ frame?: MathMLTableLine
341
+
342
+ /**
343
+ * Non-standard. Usually two lengths.
344
+ */
345
+ framespacing?: string
346
+
347
+ /**
348
+ * Non-standard. Can be a space-separated list.
349
+ */
350
+ rowalign?: MathMLTableRowAlign
351
+
352
+ /**
353
+ * Non-standard. Can be a space-separated list.
354
+ */
355
+ rowlines?: MathMLTableLine
356
+
357
+ /**
358
+ * Non-standard. Can be a space-separated list.
359
+ */
360
+ rowspacing?: MathMLLength
361
+
362
+ /**
363
+ * Non-standard.
364
+ */
365
+ width?: MathMLLength
366
+ }
367
+
368
+ type MtrAttributes = {
369
+ /**
370
+ * Non-standard. Can be a space-separated list.
371
+ */
372
+ columnalign?: MathMLTableColumnAlign
373
+
374
+ /**
375
+ * Non-standard. Can be a space-separated list.
376
+ */
377
+ rowalign?: MathMLTableRowAlign
378
+ }
379
+
380
+ type MtdAttributes = MtrAttributes & {
381
+ columnspan?: MathMLUnsignedInteger
382
+ rowspan?: MathMLUnsignedInteger
383
+ }
384
+
385
+ declare namespace MathMLJSX {
386
+ interface IntrinsicElements {
387
+ annotation: MathMLProps<AnnotationAttributes>
388
+ 'annotation-xml': MathMLProps<AnnotationXmlAttributes>
389
+
390
+ /**
391
+ * @deprecated Deprecated MathML element. Avoid for new content.
392
+ */
393
+ maction: MathMLProps<MactionAttributes>
394
+
395
+ math: MathMLProps<MathAttributes>
396
+
397
+ /**
398
+ * Non-standard. Check browser support before using.
399
+ */
400
+ menclose: MathMLProps<MencloseAttributes>
401
+
402
+ merror: MathMLProps
403
+
404
+ /**
405
+ * @deprecated Non-standard/deprecated. Use explicit `<mrow>` and `<mo>`.
406
+ */
407
+ mfenced: MathMLProps<MfencedAttributes>
408
+
409
+ mfrac: MathMLProps<MfracAttributes>
410
+ mi: MathMLProps<MiAttributes>
411
+ mmultiscripts: MathMLProps<MmultiscriptsAttributes>
412
+ mn: MathMLProps
413
+ mo: MathMLProps<MoAttributes>
414
+ mover: MathMLProps<MoverAttributes>
415
+ mpadded: MathMLProps<MpaddedAttributes>
416
+ mphantom: MathMLProps
417
+ mprescripts: MathMLProps
418
+ mroot: MathMLProps
419
+ mrow: MathMLProps
420
+ ms: MathMLProps<MsAttributes>
421
+ mspace: MathMLProps<MspaceAttributes>
422
+ msqrt: MathMLProps
423
+ mstyle: MathMLProps<MstyleAttributes>
424
+ msub: MathMLProps<MsubAttributes>
425
+ msubsup: MathMLProps<MsubsupAttributes>
426
+ msup: MathMLProps<MsupAttributes>
427
+ mtable: MathMLProps<MtableAttributes>
428
+ mtd: MathMLProps<MtdAttributes>
429
+ mtext: MathMLProps
430
+ mtr: MathMLProps<MtrAttributes>
431
+ munder: MathMLProps<MunderAttributes>
432
+ munderover: MathMLProps<MunderoverAttributes>
433
+
434
+ semantics: MathMLProps
435
+ }
436
+ }
437
+
438
+ declare module 'react' {
439
+ namespace JSX {
440
+ interface IntrinsicElements extends MathMLJSX.IntrinsicElements {}
441
+ }
442
+ }
443
+
444
+ declare module 'react/jsx-runtime' {
445
+ namespace JSX {
446
+ interface IntrinsicElements extends MathMLJSX.IntrinsicElements {}
447
+ }
448
+ }
449
+
450
+ declare module 'react/jsx-dev-runtime' {
451
+ namespace JSX {
452
+ interface IntrinsicElements extends MathMLJSX.IntrinsicElements {}
453
+ }
454
+ }
455
+
456
+ /**
457
+ * Compatibility for older React/TypeScript JSX configurations that still
458
+ * consult the global JSX namespace.
459
+ */
460
+ declare global {
461
+ namespace JSX {
462
+ interface IntrinsicElements extends MathMLJSX.IntrinsicElements {}
463
+ }
464
+ }
package/index.js CHANGED
@@ -1,3 +1 @@
1
- // This is a bootstrap placeholder. Format is not released yet, and this version
2
- // carries no implementation. See README.md.
3
- export {}
1
+ // This package only provides TypeScript declarations.
package/package.json CHANGED
@@ -1,32 +1,38 @@
1
1
  {
2
- "name": "@format.dev/react-mathml-types",
3
- "version": "0.0.0",
4
- "description": "A bootstrap placeholder reserving this package name. Format is not released yet.",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/format-hq/format-js.git",
9
- "directory": "packages/react-mathml-types"
10
- },
11
- "homepage": "https://format.dev",
12
- "files": [
13
- "LICENSE",
14
- "README.md",
15
- "index.d.ts",
16
- "index.js"
17
- ],
18
- "type": "module",
19
- "main": "./index.js",
20
- "types": "./index.d.ts",
21
- "exports": {
22
- ".": {
23
- "types": "./index.d.ts",
24
- "default": "./index.js"
25
- }
26
- },
27
- "publishConfig": {
28
- "access": "public",
29
- "tag": "bootstrap",
30
- "registry": "https://registry.npmjs.org/"
31
- }
32
- }
2
+ "name": "@format.dev/react-mathml-types",
3
+ "version": "0.1.1",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/format-hq/format-js.git",
8
+ "directory": "packages/react-mathml-types"
9
+ },
10
+ "description": "React JSX IntrinsicElements types for MathML.",
11
+ "sideEffects": false,
12
+ "main": "./index.js",
13
+ "types": "./index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./index.d.ts",
17
+ "default": "./index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "index.d.ts",
22
+ "index.js",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "devDependencies": {
30
+ "@types/react": "^19.2.7",
31
+ "@types/react-18": "npm:@types/react@^18.2.0",
32
+ "typescript": "^5.9.3"
33
+ },
34
+ "peerDependencies": {
35
+ "@types/react": ">=18",
36
+ "react": ">=18"
37
+ }
38
+ }