@davidsouther/jiffies 1.0.0-beta.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 (221) hide show
  1. package/README.md +60 -0
  2. package/build/assert.d.ts +23 -0
  3. package/build/assert.js +33 -0
  4. package/build/case.d.ts +1 -0
  5. package/build/case.js +5 -0
  6. package/build/components/button_bar.d.ts +8 -0
  7. package/build/components/button_bar.js +16 -0
  8. package/build/components/index.d.ts +1 -0
  9. package/build/components/index.js +1 -0
  10. package/build/components/inline_edit.d.ts +12 -0
  11. package/build/components/inline_edit.js +48 -0
  12. package/build/components/logger.d.ts +7 -0
  13. package/build/components/logger.js +22 -0
  14. package/build/components/select.d.ts +13 -0
  15. package/build/components/select.js +3 -0
  16. package/build/components/test.d.ts +1 -0
  17. package/build/components/test.js +2 -0
  18. package/build/components/virtual_scroll.d.ts +41 -0
  19. package/build/components/virtual_scroll.js +94 -0
  20. package/build/components/virtual_scroll.test.d.ts +1 -0
  21. package/build/components/virtual_scroll.test.js +21 -0
  22. package/build/context.d.ts +15 -0
  23. package/build/context.js +43 -0
  24. package/build/context.test.d.ts +1 -0
  25. package/build/context.test.js +46 -0
  26. package/build/debounce.d.ts +1 -0
  27. package/build/debounce.js +7 -0
  28. package/build/display.d.ts +5 -0
  29. package/build/display.js +3 -0
  30. package/build/dom/css/border.d.ts +11 -0
  31. package/build/dom/css/border.js +27 -0
  32. package/build/dom/css/constants.d.ts +31 -0
  33. package/build/dom/css/constants.js +28 -0
  34. package/build/dom/css/core.d.ts +5 -0
  35. package/build/dom/css/core.js +24 -0
  36. package/build/dom/css/fstyle.d.ts +5 -0
  37. package/build/dom/css/fstyle.js +32 -0
  38. package/build/dom/css/sizing.d.ts +5 -0
  39. package/build/dom/css/sizing.js +10 -0
  40. package/build/dom/dom.d.ts +27 -0
  41. package/build/dom/dom.js +94 -0
  42. package/build/dom/fc.d.ts +14 -0
  43. package/build/dom/fc.js +35 -0
  44. package/build/dom/fc.test.d.ts +1 -0
  45. package/build/dom/fc.test.js +21 -0
  46. package/build/dom/form/form.app.d.ts +1 -0
  47. package/build/dom/form/form.app.js +23 -0
  48. package/build/dom/form/form.d.ts +25 -0
  49. package/build/dom/form/form.js +25 -0
  50. package/build/dom/form/form.test.d.ts +0 -0
  51. package/build/dom/form/form.test.js +1 -0
  52. package/build/dom/html.d.ts +117 -0
  53. package/build/dom/html.js +114 -0
  54. package/build/dom/html.test.d.ts +1 -0
  55. package/build/dom/html.test.js +58 -0
  56. package/build/dom/router/link.d.ts +6 -0
  57. package/build/dom/router/link.js +3 -0
  58. package/build/dom/router/router.d.ts +12 -0
  59. package/build/dom/router/router.js +49 -0
  60. package/build/dom/svg.d.ts +64 -0
  61. package/build/dom/svg.js +65 -0
  62. package/build/dom/test.d.ts +1 -0
  63. package/build/dom/test.js +2 -0
  64. package/build/dom/types/css.d.ts +6612 -0
  65. package/build/dom/types/css.js +23 -0
  66. package/build/dom/types/dom.d.ts +0 -0
  67. package/build/dom/types/dom.js +1 -0
  68. package/build/dom/types/html.d.ts +616 -0
  69. package/build/dom/types/html.js +1 -0
  70. package/build/dom/xml.d.ts +1 -0
  71. package/build/dom/xml.js +5 -0
  72. package/build/equal.d.ts +4 -0
  73. package/build/equal.js +22 -0
  74. package/build/equal.test.d.ts +1 -0
  75. package/build/equal.test.js +20 -0
  76. package/build/flags.d.ts +7 -0
  77. package/build/flags.js +48 -0
  78. package/build/flags.test.d.ts +1 -0
  79. package/build/flags.test.js +35 -0
  80. package/build/generator.d.ts +1 -0
  81. package/build/generator.js +10 -0
  82. package/build/generator.test.d.ts +1 -0
  83. package/build/generator.test.js +24 -0
  84. package/build/index.d.ts +13 -0
  85. package/build/index.js +13 -0
  86. package/build/is_browser.d.ts +1 -0
  87. package/build/is_browser.js +1 -0
  88. package/build/loader.d.mts +22 -0
  89. package/build/loader.mjs +35 -0
  90. package/build/lock.d.ts +1 -0
  91. package/build/lock.js +23 -0
  92. package/build/lock.test.d.ts +1 -0
  93. package/build/lock.test.js +16 -0
  94. package/build/log.d.ts +26 -0
  95. package/build/log.js +34 -0
  96. package/build/parcel_resolver.d.ts +3 -0
  97. package/build/parcel_resolver.js +19 -0
  98. package/build/range.d.ts +1 -0
  99. package/build/range.js +7 -0
  100. package/build/result.d.ts +31 -0
  101. package/build/result.js +65 -0
  102. package/build/result.test.d.ts +1 -0
  103. package/build/result.test.js +71 -0
  104. package/build/safe.d.ts +1 -0
  105. package/build/safe.js +10 -0
  106. package/build/scope/describe.d.ts +14 -0
  107. package/build/scope/describe.js +52 -0
  108. package/build/scope/display/console.d.ts +2 -0
  109. package/build/scope/display/console.js +21 -0
  110. package/build/scope/display/dom.d.ts +3 -0
  111. package/build/scope/display/dom.js +26 -0
  112. package/build/scope/display/junit.d.ts +2 -0
  113. package/build/scope/display/junit.js +17 -0
  114. package/build/scope/execute.d.ts +12 -0
  115. package/build/scope/execute.js +85 -0
  116. package/build/scope/expect.d.ts +23 -0
  117. package/build/scope/expect.js +107 -0
  118. package/build/scope/fix.d.ts +4 -0
  119. package/build/scope/fix.js +22 -0
  120. package/build/scope/index.d.ts +3 -0
  121. package/build/scope/index.js +3 -0
  122. package/build/scope/scope.d.ts +17 -0
  123. package/build/scope/scope.js +1 -0
  124. package/build/server/http/apps.d.ts +5 -0
  125. package/build/server/http/apps.js +23 -0
  126. package/build/server/http/index.d.ts +21 -0
  127. package/build/server/http/index.js +71 -0
  128. package/build/server/http/response.d.ts +4 -0
  129. package/build/server/http/response.js +37 -0
  130. package/build/server/http/sitemap.d.ts +2 -0
  131. package/build/server/http/sitemap.js +42 -0
  132. package/build/server/http/static.d.ts +2 -0
  133. package/build/server/http/static.js +21 -0
  134. package/build/server/http/typescript.d.ts +5 -0
  135. package/build/server/http/typescript.js +40 -0
  136. package/build/server/main.d.ts +2 -0
  137. package/build/server/main.js +9 -0
  138. package/build/test.d.mts +2 -0
  139. package/build/test.mjs +23 -0
  140. package/build/test_all.d.ts +1 -0
  141. package/build/test_all.js +19 -0
  142. package/build/transpile.d.mts +3 -0
  143. package/build/transpile.mjs +18 -0
  144. package/package.json +36 -0
  145. package/src/404.html +14 -0
  146. package/src/assert.ts +50 -0
  147. package/src/case.ts +5 -0
  148. package/src/components/_notes +33 -0
  149. package/src/components/button_bar.ts +38 -0
  150. package/src/components/inline_edit.ts +77 -0
  151. package/src/components/logger.ts +36 -0
  152. package/src/components/select.ts +22 -0
  153. package/src/components/test.js +2 -0
  154. package/src/components/virtual_scroll.test.ts +27 -0
  155. package/src/components/virtual_scroll.ts +194 -0
  156. package/src/context.test.ts +58 -0
  157. package/src/context.ts +62 -0
  158. package/src/debounce.ts +7 -0
  159. package/src/display.ts +12 -0
  160. package/src/dom/README.md +102 -0
  161. package/src/dom/css/border.ts +47 -0
  162. package/src/dom/css/constants.ts +34 -0
  163. package/src/dom/css/core.ts +28 -0
  164. package/src/dom/css/fstyle.ts +42 -0
  165. package/src/dom/css/sizing.ts +11 -0
  166. package/src/dom/dom.ts +153 -0
  167. package/src/dom/fc.test.ts +43 -0
  168. package/src/dom/fc.ts +79 -0
  169. package/src/dom/form/form.app.ts +50 -0
  170. package/src/dom/form/form.test.ts +0 -0
  171. package/src/dom/form/form.ts +53 -0
  172. package/src/dom/form/index.html +14 -0
  173. package/src/dom/html.test.ts +72 -0
  174. package/src/dom/html.ts +129 -0
  175. package/src/dom/router/link.ts +14 -0
  176. package/src/dom/router/router.ts +69 -0
  177. package/src/dom/svg.ts +77 -0
  178. package/src/dom/test.ts +2 -0
  179. package/src/dom/types/css.ts +10106 -0
  180. package/src/dom/types/dom.ts +0 -0
  181. package/src/dom/types/html.ts +631 -0
  182. package/src/dom/xml.ts +12 -0
  183. package/src/equal.test.ts +23 -0
  184. package/src/equal.ts +32 -0
  185. package/src/favicon.ico +0 -0
  186. package/src/flags.test.ts +43 -0
  187. package/src/flags.ts +53 -0
  188. package/src/generator.test.ts +26 -0
  189. package/src/generator.ts +12 -0
  190. package/src/hooks/_notes +3 -0
  191. package/src/index.html +79 -0
  192. package/src/is_browser.js +1 -0
  193. package/src/loader.mjs +45 -0
  194. package/src/lock.test.ts +17 -0
  195. package/src/lock.ts +22 -0
  196. package/src/log.ts +61 -0
  197. package/src/observable/_notes +13 -0
  198. package/src/observable/observable._js +175 -0
  199. package/src/range.ts +7 -0
  200. package/src/result.test.ts +98 -0
  201. package/src/result.ts +107 -0
  202. package/src/safe.ts +12 -0
  203. package/src/scope/describe.ts +70 -0
  204. package/src/scope/display/console.ts +26 -0
  205. package/src/scope/display/dom.ts +36 -0
  206. package/src/scope/display/junit.ts +67 -0
  207. package/src/scope/execute.ts +108 -0
  208. package/src/scope/expect.ts +170 -0
  209. package/src/scope/fix.ts +29 -0
  210. package/src/scope/index.ts +11 -0
  211. package/src/scope/scope.ts +21 -0
  212. package/src/server/http/apps.ts +26 -0
  213. package/src/server/http/index.ts +119 -0
  214. package/src/server/http/response.ts +47 -0
  215. package/src/server/http/sitemap.ts +48 -0
  216. package/src/server/http/static.ts +27 -0
  217. package/src/server/http/typescript.ts +46 -0
  218. package/src/server/main.ts +13 -0
  219. package/src/test.mjs +29 -0
  220. package/src/test_all.ts +22 -0
  221. package/src/transpile.mjs +29 -0
File without changes
@@ -0,0 +1,631 @@
1
+ import { Properties } from "./css.js";
2
+
3
+ export interface AriaAttributes {
4
+ [_: `aria-${string}`]: string;
5
+ }
6
+
7
+ export interface Sized {
8
+ height?: number | string;
9
+ width?: number | string;
10
+ }
11
+
12
+ export type MimeTypeString = `${string}/${string}`;
13
+
14
+ export type ReferrerPolicy =
15
+ | "no-referrer"
16
+ | "no-referrer-when-downgrade"
17
+ | "origin"
18
+ | "origin-when-cross-origin"
19
+ | "same-origin"
20
+ | "strict-origin"
21
+ | "strict-origin-when-cross-origin"
22
+ | "unsafe-url";
23
+
24
+ export interface EventHandler {
25
+ (k: Event): void;
26
+ }
27
+
28
+ export interface GlobalEvents {
29
+ abort: EventHandler;
30
+ autocomplete: EventHandler;
31
+ autocompleteerror: EventHandler;
32
+ blur: EventHandler;
33
+ cancel: EventHandler;
34
+ canplay: EventHandler;
35
+ canplaythrough: EventHandler;
36
+ change: EventHandler;
37
+ click: EventHandler;
38
+ close: EventHandler;
39
+ contextmenu: EventHandler;
40
+ cuechange: EventHandler;
41
+ dblclick: EventHandler;
42
+ drag: EventHandler;
43
+ dragend: EventHandler;
44
+ dragenter: EventHandler;
45
+ dragleave: EventHandler;
46
+ dragover: EventHandler;
47
+ dragstart: EventHandler;
48
+ drop: EventHandler;
49
+ durationchange: EventHandler;
50
+ emptied: EventHandler;
51
+ ended: EventHandler;
52
+ error: EventHandler;
53
+ focus: EventHandler;
54
+ input: EventHandler;
55
+ invalid: EventHandler;
56
+ keydown: EventHandler;
57
+ keypress: EventHandler;
58
+ keyup: EventHandler;
59
+ load: EventHandler;
60
+ loadeddata: EventHandler;
61
+ loadedmetadata: EventHandler;
62
+ loadstart: EventHandler;
63
+ mousedown: EventHandler;
64
+ mouseenter: EventHandler;
65
+ mouseleave: EventHandler;
66
+ mousemove: EventHandler;
67
+ mouseout: EventHandler;
68
+ mouseover: EventHandler;
69
+ mouseup: EventHandler;
70
+ mousewheel: EventHandler;
71
+ pause: EventHandler;
72
+ play: EventHandler;
73
+ playing: EventHandler;
74
+ progress: EventHandler;
75
+ ratechange: EventHandler;
76
+ reset: EventHandler;
77
+ resize: EventHandler;
78
+ scroll: EventHandler;
79
+ seeked: EventHandler;
80
+ seeking: EventHandler;
81
+ select: EventHandler;
82
+ show: EventHandler;
83
+ sort: EventHandler;
84
+ stalled: EventHandler;
85
+ submit: EventHandler;
86
+ suspend: EventHandler;
87
+ timeupdate: EventHandler;
88
+ toggle: EventHandler;
89
+ volumechange: EventHandler;
90
+ waiting: EventHandler;
91
+ }
92
+
93
+ export interface GlobalAttributes extends AriaAttributes {
94
+ accesskey?: string; // Space separated list of characters
95
+ autocapitalize?: "off" | "none" | "on" | "words" | "sentences" | "characters";
96
+ autofocus?: boolean;
97
+ class?: string; // classes applied, separated by spaces
98
+ contenteditable?: boolean;
99
+ contextmenu?: string; // ID
100
+ // [k?: `data-${string}`]: string;
101
+ // readonly dataset?: Record<string, string>;
102
+ dir?: "ltr" | "rtl" | "auto";
103
+ draggable?: boolean;
104
+ enterkeyhint?: string;
105
+ events?: Partial<GlobalEvents>;
106
+ hidden?: boolean;
107
+ id?: string;
108
+ inputmode?: string;
109
+ is?: string;
110
+ itemid?: string;
111
+ itemref?: string;
112
+ itemtype?: string;
113
+ lang?: string; // RFC-5646 / BCP-47
114
+ nonce?: string;
115
+ spellcheck?: boolean;
116
+ // style?: string; // Replaced with fstyle
117
+ style?: Partial<Properties>;
118
+ tabindex?: number;
119
+ title?: string;
120
+ translate?: "" | "yes" | "no";
121
+ }
122
+
123
+ // Content Sectioning
124
+ export interface AddressAttributes extends GlobalAttributes {}
125
+ export interface ArticleAttributes extends GlobalAttributes {}
126
+ export interface AsideAttributes extends GlobalAttributes {}
127
+ export interface FooterAttributes extends GlobalAttributes {}
128
+ export interface HeaderAttributes extends GlobalAttributes {}
129
+ export interface H1Attributes extends GlobalAttributes {}
130
+ export interface H2Attributes extends GlobalAttributes {}
131
+ export interface H3Attributes extends GlobalAttributes {}
132
+ export interface H4Attributes extends GlobalAttributes {}
133
+ export interface H5Attributes extends GlobalAttributes {}
134
+ export interface H6Attributes extends GlobalAttributes {}
135
+ export interface MainAttributes extends GlobalAttributes {}
136
+ export interface NavAttributes extends GlobalAttributes {}
137
+ export interface SectionAttributes extends GlobalAttributes {}
138
+
139
+ // Inlint Text
140
+ export interface BlockquoteAttributes extends GlobalAttributes {
141
+ cite: string;
142
+ }
143
+ export interface DdAttributes extends GlobalAttributes {
144
+ nowrap: "no";
145
+ }
146
+ export interface DivAttributes extends GlobalAttributes {}
147
+ export interface DlAttributes extends GlobalAttributes {}
148
+ export interface DtAttributes extends GlobalAttributes {}
149
+ export interface FigcaptionAttributes extends GlobalAttributes {}
150
+ export interface FigureAttributes extends GlobalAttributes {}
151
+ export interface HrAttributes extends GlobalAttributes {}
152
+ export interface LiAttributes extends GlobalAttributes {
153
+ value: number;
154
+ }
155
+ export interface MenuAttributes extends GlobalAttributes {}
156
+ export interface OlAttributes extends GlobalAttributes {
157
+ reversed: boolean;
158
+ start: number;
159
+ type: "a" | "A" | "i" | "I" | "0";
160
+ }
161
+ export interface PAttributes extends GlobalAttributes {}
162
+ export interface PreAttributes extends GlobalAttributes {}
163
+ export interface UlAttributes extends GlobalAttributes {}
164
+
165
+ // Text Content
166
+ export interface AAttributes extends GlobalAttributes {
167
+ alt?: string;
168
+ download?: string;
169
+ href: string;
170
+ hreflang?: string; // See lang
171
+ ping?: string;
172
+ referrerpolicy?: ReferrerPolicy;
173
+ rel?: string;
174
+ target?: "_self" | "_blank" | "_parent" | "_top";
175
+ type?: MimeTypeString; // mime type
176
+ }
177
+ export interface AbbrAttributes extends GlobalAttributes {}
178
+ export interface BAttributes extends GlobalAttributes {}
179
+ export interface BdiAttributes extends GlobalAttributes {}
180
+ export interface BdoAttributes extends GlobalAttributes {
181
+ dir: "rtl" | "ltr";
182
+ }
183
+ export interface BrAttributes extends GlobalAttributes {}
184
+ export interface CiteAttributes extends GlobalAttributes {}
185
+ export interface CodeAttributes extends GlobalAttributes {}
186
+ export interface DataAttributes extends GlobalAttributes {}
187
+ export interface DfnAttributes extends GlobalAttributes {}
188
+ export interface EmAttributes extends GlobalAttributes {}
189
+ export interface IAttributes extends GlobalAttributes {}
190
+ export interface KbdAttributes extends GlobalAttributes {}
191
+ export interface MarkAttributes extends GlobalAttributes {}
192
+ export interface QAttributes extends GlobalAttributes {
193
+ cite: string;
194
+ }
195
+ export interface RpAttributes extends GlobalAttributes {}
196
+ export interface RtAttributes extends GlobalAttributes {}
197
+ export interface RubyAttributes extends GlobalAttributes {}
198
+ export interface SAttributes extends GlobalAttributes {}
199
+ export interface SampAttributes extends GlobalAttributes {}
200
+ export interface SmallAttributes extends GlobalAttributes {}
201
+ export interface SpanAttributes extends GlobalAttributes {}
202
+ export interface StrongAttributes extends GlobalAttributes {}
203
+ export interface SubAttributes extends GlobalAttributes {}
204
+ export interface SupAttributes extends GlobalAttributes {}
205
+ export interface TimeAttributes extends GlobalAttributes {
206
+ datetime: string; // Limited date formats
207
+ }
208
+ export interface UAttributes extends GlobalAttributes {}
209
+ export interface VarAttributes extends GlobalAttributes {}
210
+ export interface WbrAttributes extends GlobalAttributes {}
211
+
212
+ // Image and Multimedia
213
+ export interface AreaAttributes extends GlobalAttributes, AAttributes {
214
+ coords: string; // Has special format
215
+ shape: "rect" | "circle" | "poly" | "default";
216
+ }
217
+
218
+ export interface AudioAttributes extends GlobalAttributes {
219
+ autoplay?: boolean;
220
+ controls?: boolean;
221
+ crossorigin?: "anonymous" | "use-credentials";
222
+ loop?: boolean;
223
+ muted?: boolean;
224
+ preload?: "none" | "metadata" | "auto";
225
+ src: string;
226
+ events?: Partial<{
227
+ audioprocess: EventHandler;
228
+ canplay: EventHandler;
229
+ canplaythrough: EventHandler;
230
+ complete: EventHandler;
231
+ durationchange: EventHandler;
232
+ emptied: EventHandler;
233
+ ended: EventHandler;
234
+ loadeddata: EventHandler;
235
+ loadedmetadata: EventHandler;
236
+ pause: EventHandler;
237
+ play: EventHandler;
238
+ playing: EventHandler;
239
+ ratechange: EventHandler;
240
+ seeked: EventHandler;
241
+ seeking: EventHandler;
242
+ stalled: EventHandler;
243
+ suspend: EventHandler;
244
+ timeupdate: EventHandler;
245
+ volumechange: EventHandler;
246
+ waiting: EventHandler;
247
+ }>;
248
+ }
249
+ export interface ImgAttributes extends GlobalAttributes, Sized {
250
+ alt?: string;
251
+ crossorigin?: "anonymous" | "use-credentials";
252
+ decoding?: "sync" | "async" | "auto";
253
+ fetchpriority?: "high" | "low" | "auto";
254
+ ismap?: boolean;
255
+ referrerpolicy?: ReferrerPolicy;
256
+ sizes?: string;
257
+ src: string;
258
+ srcset?: string;
259
+ usemap?: string;
260
+ }
261
+ export interface MapAttributes extends GlobalAttributes {
262
+ name: string;
263
+ }
264
+ export interface TrackAttributes extends GlobalAttributes {
265
+ default?: boolean;
266
+ kind: "subtitles" | "captions" | "descriptions" | "chapters" | "metadata";
267
+ label?: string;
268
+ src: string;
269
+ srclang?: string; // BCP-47, required if kind is subtitles
270
+ }
271
+ export interface VideoAttributes extends GlobalAttributes, Sized {
272
+ autoplay?: boolean;
273
+ controls?: string[];
274
+ crossorigin: "anonymous" | "use-credentials";
275
+ loop?: boolean;
276
+ muted?: boolean;
277
+ playsinline?: boolean;
278
+ poster?: string;
279
+ preload?: "none" | "metadata" | "auto";
280
+ src: string;
281
+ events?: Partial<{
282
+ canplay: EventHandler;
283
+ canplaythrough: EventHandler;
284
+ complete: EventHandler;
285
+ durationchange: EventHandler;
286
+ emptied: EventHandler;
287
+ ended: EventHandler;
288
+ loadeddata: EventHandler;
289
+ loadedmetadata: EventHandler;
290
+ pause: EventHandler;
291
+ play: EventHandler;
292
+ playing: EventHandler;
293
+ progress: EventHandler;
294
+ ratechange: EventHandler;
295
+ seeked: EventHandler;
296
+ seeking: EventHandler;
297
+ stalled: EventHandler;
298
+ suspend: EventHandler;
299
+ timeupdate: EventHandler;
300
+ volumechange: EventHandler;
301
+ waiting: EventHandler;
302
+ }>;
303
+ }
304
+
305
+ // Embedded content
306
+ export interface EmbedAttributes extends GlobalAttributes, Sized {}
307
+ export interface IframeAttributes extends GlobalAttributes, Sized {}
308
+ export interface ObjectAttributes extends GlobalAttributes, Sized {}
309
+ export interface ParamAttributes extends GlobalAttributes {
310
+ name: string;
311
+ value: string;
312
+ }
313
+ export interface PictureAttributes extends GlobalAttributes {}
314
+ export interface PortalAttributes extends GlobalAttributes {
315
+ referrerpolicy?: ReferrerPolicy;
316
+ src: string;
317
+ }
318
+ export interface SourceAttributes extends GlobalAttributes, Sized {
319
+ type: MimeTypeString;
320
+ src: string;
321
+ srcset?: string;
322
+ sizes?: string;
323
+ media?: string;
324
+ }
325
+
326
+ // Table
327
+
328
+ // Forms
329
+ interface FormElementAttributes {
330
+ autofocus?: boolean;
331
+ autocomplete?: boolean;
332
+ disabled?: boolean;
333
+ form?: string;
334
+ name?: string;
335
+ placeholder?: string;
336
+ value?: string | number | boolean;
337
+ }
338
+
339
+ interface FormActionAttributes {
340
+ formAction?: string;
341
+ formEnctype?:
342
+ | "application/x-www-form-urlencoded"
343
+ | "multipart/form-data"
344
+ | "text/plain";
345
+ formMethod?: "get" | "post";
346
+ formNoValidate?: boolean;
347
+ formTarget?: boolean;
348
+ }
349
+
350
+ export interface ButtonAttributes
351
+ extends GlobalAttributes,
352
+ FormElementAttributes,
353
+ FormActionAttributes {}
354
+ export interface DatalistAttributes extends GlobalAttributes {}
355
+ export interface FieldsetAttributes
356
+ extends GlobalAttributes,
357
+ FormElementAttributes {}
358
+ export interface FormAttributes extends GlobalAttributes {
359
+ autocomplete?: boolean;
360
+ name?: string;
361
+ rel?: string;
362
+ action?: string;
363
+ enctype?:
364
+ | "application/x-www-form-urlencoded"
365
+ | "multipart/form-data"
366
+ | "text/plain";
367
+ method?: "get" | "post" | "dialog";
368
+ noValidate?: boolean;
369
+ target?: boolean;
370
+ }
371
+ export interface InputAttributes
372
+ extends GlobalAttributes,
373
+ FormElementAttributes,
374
+ FormActionAttributes,
375
+ Sized {
376
+ accept?: boolean;
377
+ alt?: string;
378
+ capture?: boolean;
379
+ list?: string;
380
+ max?: number;
381
+ maxLength?: number;
382
+ min?: number;
383
+ minLength?: number;
384
+ multiple?: boolean;
385
+ pattern?: string;
386
+ readOnly?: boolean;
387
+ required?: boolean;
388
+ role?: "switch" | "switch-disabled";
389
+ size?: string;
390
+ src?: string;
391
+ step?: number;
392
+ type?:
393
+ | "button"
394
+ | "checkbox"
395
+ | "color"
396
+ | "date"
397
+ | "datetime-local"
398
+ | "email"
399
+ | "file"
400
+ | "hidden"
401
+ | "image"
402
+ | "month"
403
+ | "number"
404
+ | "password"
405
+ | "radio"
406
+ | "range"
407
+ | "reset"
408
+ | "search"
409
+ | "submit"
410
+ | "text"
411
+ | "time"
412
+ | "url"
413
+ | "week";
414
+ }
415
+ export interface LabelAttributes extends GlobalAttributes {
416
+ for?: string;
417
+ }
418
+ export interface LegendAttributes extends GlobalAttributes {}
419
+ export interface MeterAttributes extends GlobalAttributes {
420
+ value: number;
421
+ min?: number;
422
+ max?: number;
423
+ low?: number;
424
+ high?: number;
425
+ optimum?: number;
426
+ }
427
+ export interface OptgroupAttributes extends GlobalAttributes {
428
+ disabled?: boolean;
429
+ label: string;
430
+ }
431
+ export interface OptionAttributes extends GlobalAttributes {
432
+ disabled?: boolean;
433
+ label?: string;
434
+ selected?: boolean;
435
+ value?: string;
436
+ }
437
+ export interface OutputAttributes extends GlobalAttributes {
438
+ for: string;
439
+ name: string;
440
+ form?: string;
441
+ }
442
+ export interface ProgressAttributes extends GlobalAttributes {
443
+ max?: number;
444
+ value?: number;
445
+ }
446
+ export interface SelectAttributes
447
+ extends GlobalAttributes,
448
+ FormElementAttributes {
449
+ multiple?: boolean;
450
+ size?: string;
451
+ }
452
+ export interface TextareaAttributes
453
+ extends GlobalAttributes,
454
+ FormElementAttributes {
455
+ maxlength?: number;
456
+ minlength?: number;
457
+ rows?: number;
458
+ cols?: number;
459
+ wrap?: boolean;
460
+ }
461
+
462
+ // Table elements
463
+ export interface CaptionAttributes extends GlobalAttributes {}
464
+ export interface ColAttributes extends GlobalAttributes {
465
+ span?: number;
466
+ }
467
+ export interface ColgroupAttributes extends GlobalAttributes {
468
+ span?: number;
469
+ }
470
+ export interface TableAttributes extends GlobalAttributes {}
471
+ export interface TbodyAttributes extends GlobalAttributes {}
472
+ export interface TdAttributes extends GlobalAttributes {
473
+ colspan?: number;
474
+ headers?: string[];
475
+ rowspan?: number;
476
+ }
477
+ export interface TfootAttributes extends GlobalAttributes {}
478
+ export interface ThAttributes extends GlobalAttributes {
479
+ abbr?: string;
480
+ colspan?: number;
481
+ headers?: string[];
482
+ rowspan?: number;
483
+ scope?: "row" | "col" | "rowgroup" | "colgroup";
484
+ }
485
+ export interface TheadAttributes extends GlobalAttributes {}
486
+ export interface TrAttributes extends GlobalAttributes {}
487
+
488
+ export interface DetailsAttributes extends GlobalAttributes {
489
+ open?: boolean;
490
+ }
491
+ export interface DialogAttributes extends GlobalAttributes {
492
+ open?: boolean;
493
+ }
494
+ export interface SummaryAttributes extends GlobalAttributes {}
495
+
496
+ export interface SlotAttributes extends GlobalAttributes {
497
+ name: string;
498
+ }
499
+ export interface TemplateAttributes extends GlobalAttributes {
500
+ readonly content: unknown;
501
+ }
502
+
503
+ export interface CanvasAttributes extends GlobalAttributes, Sized {}
504
+ export interface ScriptAttributes extends GlobalAttributes {
505
+ async?: boolean;
506
+ crossorigin?: string;
507
+ defer?: string;
508
+ fetchpriority?: "high" | "low" | "auto";
509
+ integrity?: string;
510
+ nomodule?: boolean;
511
+ nonce?: string;
512
+ refererpolicy?: ReferrerPolicy;
513
+ src: string;
514
+ type?: "application/javascript" | "module" | string;
515
+ }
516
+ export interface NoscriptAttributes extends GlobalAttributes {}
517
+
518
+ export interface InsAttributes extends GlobalAttributes {
519
+ cite?: string;
520
+ datetime?: string;
521
+ }
522
+ export interface DelAttributes extends GlobalAttributes {
523
+ cite?: string;
524
+ datetime?: string;
525
+ }
526
+
527
+ export interface HTMLAttributesMap {
528
+ a: AAttributes;
529
+ abbr: AbbrAttributes;
530
+ address: AddressAttributes;
531
+ area: AreaAttributes;
532
+ Col: ColAttributes;
533
+ Th: ThAttributes;
534
+ article: ArticleAttributes;
535
+ aside: AsideAttributes;
536
+ audio: AudioAttributes;
537
+ b: BAttributes;
538
+ bdi: BdiAttributes;
539
+ bdo: BdoAttributes;
540
+ blockquote: BlockquoteAttributes;
541
+ br: BrAttributes;
542
+ button: ButtonAttributes;
543
+ canvas: CanvasAttributes;
544
+ caption: CaptionAttributes;
545
+ cite: CiteAttributes;
546
+ code: CodeAttributes;
547
+ colgroup: ColgroupAttributes;
548
+ datalist: DatalistAttributes;
549
+ dd: DdAttributes;
550
+ del: DelAttributes;
551
+ details: DetailsAttributes;
552
+ dfn: DfnAttributes;
553
+ dialog: DialogAttributes;
554
+ div: DivAttributes;
555
+ dl: DlAttributes;
556
+ dt: DtAttributes;
557
+ em: EmAttributes;
558
+ embed: EmbedAttributes;
559
+ fieldset: FieldsetAttributes;
560
+ figcaption: FigcaptionAttributes;
561
+ figure: FigureAttributes;
562
+ footer: FooterAttributes;
563
+ form: FormAttributes;
564
+ h1: H1Attributes;
565
+ h2: H2Attributes;
566
+ h3: H3Attributes;
567
+ h4: H4Attributes;
568
+ h5: H5Attributes;
569
+ h6: H6Attributes;
570
+ header: HeaderAttributes;
571
+ hr: HrAttributes;
572
+ i: IAttributes;
573
+ iframe: IframeAttributes;
574
+ img: ImgAttributes;
575
+ input: InputAttributes;
576
+ ins: InsAttributes;
577
+ kbd: KbdAttributes;
578
+ label: LabelAttributes;
579
+ legend: LegendAttributes;
580
+ li: LiAttributes;
581
+ main: MainAttributes;
582
+ map: MapAttributes;
583
+ mark: MarkAttributes;
584
+ menu: MenuAttributes;
585
+ meter: MeterAttributes;
586
+ nav: NavAttributes;
587
+ noscript: NoscriptAttributes;
588
+ object: ObjectAttributes;
589
+ ol: OlAttributes;
590
+ optgroup: OptgroupAttributes;
591
+ option: OptionAttributes;
592
+ output: OutputAttributes;
593
+ p: PAttributes;
594
+ param: ParamAttributes;
595
+ picture: PictureAttributes;
596
+ portal: PortalAttributes;
597
+ pre: PreAttributes;
598
+ progress: ProgressAttributes;
599
+ q: QAttributes;
600
+ rp: RpAttributes;
601
+ rt: RtAttributes;
602
+ ruby: RubyAttributes;
603
+ s: SAttributes;
604
+ samp: SampAttributes;
605
+ script: ScriptAttributes;
606
+ section: SectionAttributes;
607
+ select: SelectAttributes;
608
+ slot: SlotAttributes;
609
+ small: SmallAttributes;
610
+ source: SourceAttributes;
611
+ span: SpanAttributes;
612
+ strong: StrongAttributes;
613
+ sub: SubAttributes;
614
+ summary: SummaryAttributes;
615
+ sup: SupAttributes;
616
+ table: TableAttributes;
617
+ tbody: TbodyAttributes;
618
+ td: TdAttributes;
619
+ template: TemplateAttributes;
620
+ textarea: TextareaAttributes;
621
+ tfoot: TfootAttributes;
622
+ thead: TheadAttributes;
623
+ time: TimeAttributes;
624
+ tr: TrAttributes;
625
+ track: TrackAttributes;
626
+ u: UAttributes;
627
+ ul: UlAttributes;
628
+ var: VarAttributes;
629
+ video: VideoAttributes;
630
+ wbr: WbrAttributes;
631
+ }
package/src/dom/xml.ts ADDED
@@ -0,0 +1,12 @@
1
+ export function xml(
2
+ tag: string,
3
+ attributes: Record<string, string | number | boolean>,
4
+ children: string[] = []
5
+ ) {
6
+ const attrs = Object.entries(attributes).reduce(
7
+ (attrs, [attr, val]) => `${attrs} ${attr}="${val}"`,
8
+ ""
9
+ );
10
+ const kids = children.join("");
11
+ return `<${tag} ${attrs}>${kids}</${tag}>`;
12
+ }
@@ -0,0 +1,23 @@
1
+ import { describe, it, expect } from "./scope/index.js";
2
+ import { equalArrays, equals, matchArrays } from "./equal.js";
3
+
4
+ describe("Equality", () => {
5
+ it("compares objects", () => {
6
+ expect(equals({ a: 1, b: 2 }, { b: 2, a: 1 })).toBe(true);
7
+ expect(equals({ a: 1, b: 2 }, { b: 1, a: 2 })).toBe(false);
8
+ });
9
+
10
+ it("compares primitives", () => {
11
+ expect(equals(1, 1)).toBe(true);
12
+ expect(equals(1, -1)).toBe(false);
13
+ expect(equals(0, -0)).toBe(false);
14
+ expect(equals(NaN, NaN)).toBe(true);
15
+ });
16
+
17
+ it("compares arrays", () => {
18
+ expect(equalArrays([1, 2, 3], [1, 2, 3])).toBe(true);
19
+ expect(equalArrays([1], [2, 3])).toBe(false);
20
+ expect(equalArrays([{ a: 1 }], [{ a: 1 }])).toBe(false);
21
+ expect(matchArrays([{ a: 1 }], [{ a: 1 }])).toBe(true);
22
+ });
23
+ });
package/src/equal.ts ADDED
@@ -0,0 +1,32 @@
1
+ export function compareArrays<T>(
2
+ equal: (a: T, b: T) => boolean
3
+ ): (A: T[], B: T[]) => boolean {
4
+ return (a: T[], b: T[]): boolean =>
5
+ a.length === b.length && a.every((e, i) => equal(e, b[i]));
6
+ }
7
+
8
+ export const equalArrays = compareArrays(Object.is);
9
+
10
+ export const matchArrays: <A>(a: A[], b: A[]) => boolean =
11
+ compareArrays(equals);
12
+
13
+ function asArray(a: Record<string, unknown>): [string, unknown][] {
14
+ return Object.entries(a).sort((a, b) => a[0].localeCompare(b[0]));
15
+ }
16
+
17
+ export function equals<A>(a: A | A[], b: A | A[]): boolean {
18
+ // runtime type checking
19
+ switch (typeof a) {
20
+ case "object":
21
+ if (a instanceof Array && b instanceof Array) {
22
+ return matchArrays(a, b);
23
+ } else {
24
+ return matchArrays(
25
+ asArray(a as Record<string, unknown>),
26
+ asArray(b as Record<string, unknown>)
27
+ );
28
+ }
29
+ default:
30
+ return Object.is(a, b);
31
+ }
32
+ }
Binary file