@es-joy/jsoe 0.24.3 → 0.25.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 (524) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.ncurc.cjs +2 -2
  3. package/CHANGES.md +51 -0
  4. package/README.md +23 -13
  5. package/badges/coverage-badge.svg +1 -1
  6. package/dist/eslint.config.d.ts +3 -0
  7. package/dist/eslint.config.d.ts.map +1 -0
  8. package/dist/formatAndTypeChoices.d.ts +28 -30
  9. package/dist/formatAndTypeChoices.d.ts.map +1 -1
  10. package/dist/formats/indexedDBKey.d.ts.map +1 -1
  11. package/dist/formats/schema.d.ts +46 -3
  12. package/dist/formats/schema.d.ts.map +1 -1
  13. package/dist/formats/structuredCloning.d.ts +3 -0
  14. package/dist/formats/structuredCloning.d.ts.map +1 -1
  15. package/dist/formats.d.ts +24 -6
  16. package/dist/formats.d.ts.map +1 -1
  17. package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
  18. package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
  19. package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
  20. package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -1
  21. package/dist/fundamentalTypes/arrayType.d.ts +7 -0
  22. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
  23. package/dist/fundamentalTypes/bigintObjectType.d.ts.map +1 -1
  24. package/dist/fundamentalTypes/bigintType.d.ts +10 -0
  25. package/dist/fundamentalTypes/bigintType.d.ts.map +1 -1
  26. package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
  27. package/dist/fundamentalTypes/booleanType.d.ts.map +1 -1
  28. package/dist/fundamentalTypes/catchType.d.ts +2 -2
  29. package/dist/fundamentalTypes/catchType.d.ts.map +1 -1
  30. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  31. package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
  32. package/dist/fundamentalTypes/enumType.d.ts +2 -2
  33. package/dist/fundamentalTypes/enumType.d.ts.map +1 -1
  34. package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
  35. package/dist/fundamentalTypes/fileType.d.ts +6 -0
  36. package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
  37. package/dist/fundamentalTypes/functionType.d.ts.map +1 -1
  38. package/dist/fundamentalTypes/literalType.d.ts +3 -2
  39. package/dist/fundamentalTypes/literalType.d.ts.map +1 -1
  40. package/dist/fundamentalTypes/looseRecordType.d.ts +6 -0
  41. package/dist/fundamentalTypes/looseRecordType.d.ts.map +1 -0
  42. package/dist/fundamentalTypes/nanType.d.ts.map +1 -1
  43. package/dist/fundamentalTypes/neverType.d.ts +2 -2
  44. package/dist/fundamentalTypes/neverType.d.ts.map +1 -1
  45. package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -1
  46. package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
  47. package/dist/fundamentalTypes/numberType.d.ts.map +1 -1
  48. package/dist/fundamentalTypes/promiseType.d.ts.map +1 -1
  49. package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
  50. package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
  51. package/dist/fundamentalTypes/symbolType.d.ts.map +1 -1
  52. package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
  53. package/dist/fundamentalTypes/voidType.d.ts +2 -2
  54. package/dist/fundamentalTypes/voidType.d.ts.map +1 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +6 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/rollup.config.d.ts +30 -0
  59. package/dist/rollup.config.d.ts.map +1 -0
  60. package/dist/server.d.ts +2 -0
  61. package/dist/server.d.ts.map +1 -0
  62. package/dist/src/formatAndTypeChoices.d.ts +108 -0
  63. package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
  64. package/dist/src/formats/arbitraryJS.d.ts +4 -0
  65. package/dist/src/formats/arbitraryJS.d.ts.map +1 -0
  66. package/dist/src/formats/indexedDBKey.d.ts +4 -0
  67. package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
  68. package/dist/src/formats/json.d.ts +4 -0
  69. package/dist/src/formats/json.d.ts.map +1 -0
  70. package/dist/src/formats/schema.d.ts +17 -0
  71. package/dist/src/formats/schema.d.ts.map +1 -0
  72. package/dist/src/formats/structuredCloning.d.ts +19 -0
  73. package/dist/src/formats/structuredCloning.d.ts.map +1 -0
  74. package/dist/src/formats.d.ts +135 -0
  75. package/dist/src/formats.d.ts.map +1 -0
  76. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +8 -0
  77. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
  78. package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
  79. package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
  80. package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
  81. package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
  82. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +8 -0
  83. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
  84. package/dist/src/fundamentalTypes/arrayType.d.ts +29 -0
  85. package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
  86. package/dist/src/fundamentalTypes/bigintObjectType.d.ts +6 -0
  87. package/dist/src/fundamentalTypes/bigintObjectType.d.ts.map +1 -0
  88. package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
  89. package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
  90. package/dist/src/fundamentalTypes/blobType.d.ts +11 -0
  91. package/dist/src/fundamentalTypes/blobType.d.ts.map +1 -0
  92. package/dist/src/fundamentalTypes/booleanType.d.ts +8 -0
  93. package/dist/src/fundamentalTypes/booleanType.d.ts.map +1 -0
  94. package/dist/src/fundamentalTypes/catchType.d.ts +6 -0
  95. package/dist/src/fundamentalTypes/catchType.d.ts.map +1 -0
  96. package/dist/src/fundamentalTypes/dateType.d.ts +26 -0
  97. package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
  98. package/dist/src/fundamentalTypes/domexceptionType.d.ts +6 -0
  99. package/dist/src/fundamentalTypes/domexceptionType.d.ts.map +1 -0
  100. package/dist/src/fundamentalTypes/enumType.d.ts +6 -0
  101. package/dist/src/fundamentalTypes/enumType.d.ts.map +1 -0
  102. package/dist/src/fundamentalTypes/errorType.d.ts +6 -0
  103. package/dist/src/fundamentalTypes/errorType.d.ts.map +1 -0
  104. package/dist/src/fundamentalTypes/fileType.d.ts +13 -0
  105. package/dist/src/fundamentalTypes/fileType.d.ts.map +1 -0
  106. package/dist/src/fundamentalTypes/filelistType.d.ts +6 -0
  107. package/dist/src/fundamentalTypes/filelistType.d.ts.map +1 -0
  108. package/dist/src/fundamentalTypes/functionType.d.ts +7 -0
  109. package/dist/src/fundamentalTypes/functionType.d.ts.map +1 -0
  110. package/dist/src/fundamentalTypes/literalType.d.ts +6 -0
  111. package/dist/src/fundamentalTypes/literalType.d.ts.map +1 -0
  112. package/dist/src/fundamentalTypes/mapType.d.ts +6 -0
  113. package/dist/src/fundamentalTypes/mapType.d.ts.map +1 -0
  114. package/dist/src/fundamentalTypes/nanType.d.ts +6 -0
  115. package/dist/src/fundamentalTypes/nanType.d.ts.map +1 -0
  116. package/dist/src/fundamentalTypes/neverType.d.ts +6 -0
  117. package/dist/src/fundamentalTypes/neverType.d.ts.map +1 -0
  118. package/dist/src/fundamentalTypes/noneditableType.d.ts +6 -0
  119. package/dist/src/fundamentalTypes/noneditableType.d.ts.map +1 -0
  120. package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
  121. package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
  122. package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
  123. package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
  124. package/dist/src/fundamentalTypes/objectReferenceType.d.ts +8 -0
  125. package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
  126. package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
  127. package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
  128. package/dist/src/fundamentalTypes/promiseType.d.ts +6 -0
  129. package/dist/src/fundamentalTypes/promiseType.d.ts.map +1 -0
  130. package/dist/src/fundamentalTypes/recordType.d.ts +6 -0
  131. package/dist/src/fundamentalTypes/recordType.d.ts.map +1 -0
  132. package/dist/src/fundamentalTypes/regexpType.d.ts +8 -0
  133. package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
  134. package/dist/src/fundamentalTypes/setType.d.ts +6 -0
  135. package/dist/src/fundamentalTypes/setType.d.ts.map +1 -0
  136. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
  137. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
  138. package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
  139. package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
  140. package/dist/src/fundamentalTypes/symbolType.d.ts +8 -0
  141. package/dist/src/fundamentalTypes/symbolType.d.ts.map +1 -0
  142. package/dist/src/fundamentalTypes/tupleType.d.ts +6 -0
  143. package/dist/src/fundamentalTypes/tupleType.d.ts.map +1 -0
  144. package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
  145. package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
  146. package/dist/src/fundamentalTypes/voidType.d.ts +6 -0
  147. package/dist/src/fundamentalTypes/voidType.d.ts.map +1 -0
  148. package/dist/src/index.d.ts +12 -0
  149. package/dist/src/index.d.ts.map +1 -0
  150. package/dist/src/subTypes/blobHTMLType.d.ts +20 -0
  151. package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
  152. package/dist/src/subTypes/falseType.d.ts +8 -0
  153. package/dist/src/subTypes/falseType.d.ts.map +1 -0
  154. package/dist/src/subTypes/trueType.d.ts +8 -0
  155. package/dist/src/subTypes/trueType.d.ts.map +1 -0
  156. package/dist/src/superTypes/SpecialNumberType.d.ts +6 -0
  157. package/dist/src/superTypes/SpecialNumberType.d.ts.map +1 -0
  158. package/dist/src/superTypes/SpecialRealNumberType.d.ts +6 -0
  159. package/dist/src/superTypes/SpecialRealNumberType.d.ts.map +1 -0
  160. package/dist/src/superTypes/buffersourceType.d.ts +8 -0
  161. package/dist/src/superTypes/buffersourceType.d.ts.map +1 -0
  162. package/dist/src/superTypes/dommatrixType.d.ts +6 -0
  163. package/dist/src/superTypes/dommatrixType.d.ts.map +1 -0
  164. package/dist/src/superTypes/dompointType.d.ts +6 -0
  165. package/dist/src/superTypes/dompointType.d.ts.map +1 -0
  166. package/dist/src/superTypes/domrectType.d.ts +6 -0
  167. package/dist/src/superTypes/domrectType.d.ts.map +1 -0
  168. package/dist/src/superTypes/errorsSpecialType.d.ts +8 -0
  169. package/dist/src/superTypes/errorsSpecialType.d.ts.map +1 -0
  170. package/dist/src/typeChoices.d.ts +140 -0
  171. package/dist/src/typeChoices.d.ts.map +1 -0
  172. package/dist/src/types.d.ts +758 -0
  173. package/dist/src/types.d.ts.map +1 -0
  174. package/dist/src/utils/FileList.d.ts +26 -0
  175. package/dist/src/utils/FileList.d.ts.map +1 -0
  176. package/dist/src/utils/dialogs.d.ts +111 -0
  177. package/dist/src/utils/dialogs.d.ts.map +1 -0
  178. package/dist/src/utils/jsonPointer.d.ts +46 -0
  179. package/dist/src/utils/jsonPointer.d.ts.map +1 -0
  180. package/dist/src/utils/media.d.ts +18 -0
  181. package/dist/src/utils/media.d.ts.map +1 -0
  182. package/dist/src/utils/objects.d.ts +16 -0
  183. package/dist/src/utils/objects.d.ts.map +1 -0
  184. package/dist/src/utils/templateUtils.d.ts +59 -0
  185. package/dist/src/utils/templateUtils.d.ts.map +1 -0
  186. package/dist/src/utils/types.d.ts +2 -0
  187. package/dist/src/utils/types.d.ts.map +1 -0
  188. package/dist/src/vendor-imports.d.ts +4 -0
  189. package/dist/src/vendor-imports.d.ts.map +1 -0
  190. package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
  191. package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
  192. package/dist/superTypes/buffersourceType.d.ts.map +1 -1
  193. package/dist/superTypes/dommatrixType.d.ts.map +1 -1
  194. package/dist/superTypes/dompointType.d.ts.map +1 -1
  195. package/dist/superTypes/domrectType.d.ts.map +1 -1
  196. package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
  197. package/dist/typeChoices.d.ts +21 -87
  198. package/dist/typeChoices.d.ts.map +1 -1
  199. package/dist/types.d.ts +90 -64
  200. package/dist/types.d.ts.map +1 -1
  201. package/dist/utils/FileList.d.ts +4 -3
  202. package/dist/utils/FileList.d.ts.map +1 -1
  203. package/dist/utils/dialogs.d.ts +4 -4
  204. package/dist/utils/dialogs.d.ts.map +1 -1
  205. package/dist/utils/media.d.ts.map +1 -1
  206. package/dist/utils/schemaMeta.d.ts +92 -0
  207. package/dist/utils/schemaMeta.d.ts.map +1 -0
  208. package/dist/utils/templateUtils.d.ts +3 -3
  209. package/dist/utils/templateUtils.d.ts.map +1 -1
  210. package/dist/utils/timing.d.ts +2 -0
  211. package/dist/utils/timing.d.ts.map +1 -0
  212. package/dist/utils/types.d.ts +1 -0
  213. package/dist/utils/types.d.ts.map +1 -1
  214. package/dist/vendor-imports.d.ts +3 -1
  215. package/docs/proposals/schema-meta.md +233 -0
  216. package/eslint.config.js +51 -4
  217. package/licenseInfo.json +1 -1
  218. package/package.json +52 -42
  219. package/pnpm-workspace.yaml +57 -0
  220. package/rollup.config.js +20 -18
  221. package/server.js +3 -3
  222. package/src/deepEqual.js.map +1 -1
  223. package/src/formatAndTypeChoices.js +62 -58
  224. package/src/formats/indexedDBKey.js +3 -4
  225. package/src/formats/schema.js +824 -475
  226. package/src/formats/structuredCloning.js +189 -79
  227. package/src/formats.js +17 -5
  228. package/src/fundamentalTypes/BooleanObjectType.js +4 -5
  229. package/src/fundamentalTypes/NumberObjectType.js +4 -4
  230. package/src/fundamentalTypes/StringObjectType.js +3 -4
  231. package/src/fundamentalTypes/arrayReferenceType.js +0 -2
  232. package/src/fundamentalTypes/arrayType.js +624 -389
  233. package/src/fundamentalTypes/bigintObjectType.js +3 -2
  234. package/src/fundamentalTypes/bigintType.js +79 -17
  235. package/src/fundamentalTypes/blobType.js +35 -35
  236. package/src/fundamentalTypes/booleanType.js +16 -8
  237. package/src/fundamentalTypes/dateType.js +6 -8
  238. package/src/fundamentalTypes/domexceptionType.js +5 -4
  239. package/src/fundamentalTypes/errorType.js +39 -32
  240. package/src/fundamentalTypes/fileType.js +238 -52
  241. package/src/fundamentalTypes/functionType.js +61 -41
  242. package/src/fundamentalTypes/nanType.js +5 -4
  243. package/src/fundamentalTypes/noneditableType.js +4 -3
  244. package/src/fundamentalTypes/nullType.js +3 -2
  245. package/src/fundamentalTypes/numberType.js +72 -20
  246. package/src/fundamentalTypes/promiseType.js +16 -40
  247. package/src/fundamentalTypes/regexpType.js +7 -13
  248. package/src/fundamentalTypes/stringType.js +176 -110
  249. package/src/fundamentalTypes/symbolType.js +3 -2
  250. package/src/fundamentalTypes/undefinedType.js +3 -2
  251. package/src/index.js +6 -5
  252. package/src/jsoe.css +107 -8
  253. package/src/subTypes/blobHTMLType.js +23 -10
  254. package/src/superTypes/SpecialNumberType.js +6 -6
  255. package/src/superTypes/SpecialRealNumberType.js +10 -9
  256. package/src/superTypes/buffersourceType.js +86 -75
  257. package/src/superTypes/dommatrixType.js +6 -5
  258. package/src/superTypes/dompointType.js +6 -5
  259. package/src/superTypes/domrectType.js +6 -5
  260. package/src/superTypes/errorsSpecialType.js +54 -35
  261. package/src/typeChoices.js +399 -54
  262. package/src/types.js +157 -97
  263. package/src/utils/FileList.js +3 -3
  264. package/src/utils/dialogs.js +5 -7
  265. package/src/utils/jsonPointer.js +1 -1
  266. package/src/utils/media.js +1 -0
  267. package/src/utils/schemaMeta.js +257 -0
  268. package/src/utils/templateUtils.js +3 -3
  269. package/src/utils/timing.js +12 -0
  270. package/src/utils/types.js +19 -0
  271. package/src/vendor-imports.js +10 -2
  272. package/tsconfig.json +2 -0
  273. package/vendor/acorn/dist/acorn.d.mts +46 -5
  274. package/vendor/acorn/dist/acorn.d.ts +46 -5
  275. package/vendor/acorn/dist/acorn.js +394 -117
  276. package/vendor/acorn/dist/acorn.mjs +394 -117
  277. package/vendor/acorn/dist/bin.js +1 -1
  278. package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +590 -312
  279. package/vendor/jamilih/package.json +1 -1
  280. package/vendor/mime/dist/types/other.js +719 -0
  281. package/vendor/mime/dist/types/standard.js +366 -0
  282. package/vendor/typeson-registry/dist/index.js +519 -99
  283. package/vendor/zod/classic/checks.d.ts +1 -0
  284. package/vendor/zod/classic/checks.js +1 -0
  285. package/vendor/zod/classic/coerce.d.ts +17 -0
  286. package/vendor/zod/classic/coerce.js +17 -0
  287. package/vendor/zod/classic/compat.d.ts +48 -0
  288. package/vendor/zod/classic/compat.js +31 -0
  289. package/vendor/zod/classic/deep-partial.d.ts +14 -0
  290. package/vendor/zod/classic/deep-partial.js +13 -0
  291. package/vendor/zod/classic/errors.d.ts +29 -0
  292. package/vendor/zod/classic/errors.js +57 -0
  293. package/vendor/zod/classic/external.d.ts +19 -0
  294. package/vendor/zod/classic/external.js +17 -0
  295. package/vendor/zod/classic/from-json-schema.d.ts +12 -0
  296. package/vendor/zod/classic/from-json-schema.js +660 -0
  297. package/vendor/zod/classic/in-out.d.ts +8 -0
  298. package/vendor/zod/classic/in-out.js +36 -0
  299. package/vendor/zod/classic/index.d.ts +3 -0
  300. package/vendor/zod/classic/index.js +4 -0
  301. package/vendor/zod/classic/iso.d.ts +7 -0
  302. package/vendor/zod/classic/iso.js +15 -0
  303. package/vendor/zod/classic/package.json +7 -0
  304. package/vendor/zod/classic/parse.d.ts +44 -0
  305. package/vendor/zod/classic/parse.js +16 -0
  306. package/vendor/zod/classic/schemas.d.ts +802 -0
  307. package/vendor/zod/classic/schemas.js +1491 -0
  308. package/vendor/zod/core/api.d.ts +329 -0
  309. package/vendor/zod/core/api.js +1104 -0
  310. package/vendor/zod/core/checks.d.ts +278 -0
  311. package/vendor/zod/core/checks.js +581 -0
  312. package/vendor/zod/core/compile.d.ts +51 -0
  313. package/vendor/zod/core/compile.js +1783 -0
  314. package/vendor/zod/core/core.d.ts +82 -0
  315. package/vendor/zod/core/core.js +141 -0
  316. package/vendor/zod/core/doc.d.ts +16 -0
  317. package/vendor/zod/core/doc.js +33 -0
  318. package/vendor/zod/core/errors.d.ts +225 -0
  319. package/vendor/zod/core/errors.js +270 -0
  320. package/vendor/zod/core/index.d.ts +19 -0
  321. package/vendor/zod/core/index.js +19 -0
  322. package/vendor/zod/core/json-schema-generator.d.ts +65 -0
  323. package/vendor/zod/core/json-schema-generator.js +99 -0
  324. package/vendor/zod/core/json-schema-processors.d.ts +49 -0
  325. package/vendor/zod/core/json-schema-processors.js +747 -0
  326. package/vendor/zod/core/json-schema.d.ts +89 -0
  327. package/vendor/zod/core/memoizer.d.ts +15 -0
  328. package/vendor/zod/core/memoizer.js +265 -0
  329. package/vendor/zod/core/package.json +7 -0
  330. package/vendor/zod/core/parse.d.ts +52 -0
  331. package/vendor/zod/core/parse.js +154 -0
  332. package/vendor/zod/core/regexes.d.ts +87 -0
  333. package/vendor/zod/core/regexes.js +150 -0
  334. package/vendor/zod/core/registries.d.ts +35 -0
  335. package/vendor/zod/core/registries.js +51 -0
  336. package/vendor/zod/core/schemas.d.ts +1253 -0
  337. package/vendor/zod/core/schemas.js +2440 -0
  338. package/vendor/zod/core/standard-schema.d.ts +126 -0
  339. package/vendor/zod/core/to-json-schema.d.ts +153 -0
  340. package/vendor/zod/core/to-json-schema.js +650 -0
  341. package/vendor/zod/core/util.d.ts +257 -0
  342. package/vendor/zod/core/util.js +846 -0
  343. package/vendor/zod/core/versions.d.ts +5 -0
  344. package/vendor/zod/core/versions.js +5 -0
  345. package/vendor/zod/core/visit.d.ts +30 -0
  346. package/vendor/zod/core/visit.js +169 -0
  347. package/vendor/zod/index.d.ts +3 -0
  348. package/vendor/zod/index.js +4 -0
  349. package/vendor/zod/locales/ar.d.ts +4 -0
  350. package/vendor/zod/locales/ar.js +109 -0
  351. package/vendor/zod/locales/az.d.ts +4 -0
  352. package/vendor/zod/locales/az.js +108 -0
  353. package/vendor/zod/locales/be.d.ts +4 -0
  354. package/vendor/zod/locales/be.js +166 -0
  355. package/vendor/zod/locales/bg.d.ts +4 -0
  356. package/vendor/zod/locales/bg.js +123 -0
  357. package/vendor/zod/locales/bn.d.ts +4 -0
  358. package/vendor/zod/locales/bn.js +111 -0
  359. package/vendor/zod/locales/ca.d.ts +4 -0
  360. package/vendor/zod/locales/ca.js +110 -0
  361. package/vendor/zod/locales/ckb.d.ts +4 -0
  362. package/vendor/zod/locales/ckb.js +131 -0
  363. package/vendor/zod/locales/cs.d.ts +4 -0
  364. package/vendor/zod/locales/cs.js +114 -0
  365. package/vendor/zod/locales/da.d.ts +4 -0
  366. package/vendor/zod/locales/da.js +118 -0
  367. package/vendor/zod/locales/de.d.ts +4 -0
  368. package/vendor/zod/locales/de.js +111 -0
  369. package/vendor/zod/locales/el.d.ts +4 -0
  370. package/vendor/zod/locales/el.js +110 -0
  371. package/vendor/zod/locales/en.d.ts +4 -0
  372. package/vendor/zod/locales/en.js +123 -0
  373. package/vendor/zod/locales/eo.d.ts +4 -0
  374. package/vendor/zod/locales/eo.js +112 -0
  375. package/vendor/zod/locales/es.d.ts +4 -0
  376. package/vendor/zod/locales/es.js +134 -0
  377. package/vendor/zod/locales/fa.d.ts +4 -0
  378. package/vendor/zod/locales/fa.js +117 -0
  379. package/vendor/zod/locales/fi.d.ts +4 -0
  380. package/vendor/zod/locales/fi.js +115 -0
  381. package/vendor/zod/locales/fr-CA.d.ts +4 -0
  382. package/vendor/zod/locales/fr-CA.js +110 -0
  383. package/vendor/zod/locales/fr.d.ts +4 -0
  384. package/vendor/zod/locales/fr.js +127 -0
  385. package/vendor/zod/locales/gu.d.ts +4 -0
  386. package/vendor/zod/locales/gu.js +111 -0
  387. package/vendor/zod/locales/he.d.ts +4 -0
  388. package/vendor/zod/locales/he.js +219 -0
  389. package/vendor/zod/locales/hi.d.ts +4 -0
  390. package/vendor/zod/locales/hi.js +109 -0
  391. package/vendor/zod/locales/hr.d.ts +4 -0
  392. package/vendor/zod/locales/hr.js +124 -0
  393. package/vendor/zod/locales/hu.d.ts +4 -0
  394. package/vendor/zod/locales/hu.js +111 -0
  395. package/vendor/zod/locales/hy.d.ts +4 -0
  396. package/vendor/zod/locales/hy.js +156 -0
  397. package/vendor/zod/locales/id.d.ts +4 -0
  398. package/vendor/zod/locales/id.js +109 -0
  399. package/vendor/zod/locales/index.d.ts +62 -0
  400. package/vendor/zod/locales/index.js +62 -0
  401. package/vendor/zod/locales/is.d.ts +4 -0
  402. package/vendor/zod/locales/is.js +112 -0
  403. package/vendor/zod/locales/it.d.ts +4 -0
  404. package/vendor/zod/locales/it.js +111 -0
  405. package/vendor/zod/locales/ja.d.ts +4 -0
  406. package/vendor/zod/locales/ja.js +110 -0
  407. package/vendor/zod/locales/ka.d.ts +4 -0
  408. package/vendor/zod/locales/ka.js +115 -0
  409. package/vendor/zod/locales/kh.d.ts +5 -0
  410. package/vendor/zod/locales/kh.js +5 -0
  411. package/vendor/zod/locales/km.d.ts +4 -0
  412. package/vendor/zod/locales/km.js +113 -0
  413. package/vendor/zod/locales/kn.d.ts +4 -0
  414. package/vendor/zod/locales/kn.js +114 -0
  415. package/vendor/zod/locales/ko.d.ts +4 -0
  416. package/vendor/zod/locales/ko.js +114 -0
  417. package/vendor/zod/locales/lt.d.ts +4 -0
  418. package/vendor/zod/locales/lt.js +205 -0
  419. package/vendor/zod/locales/mk.d.ts +4 -0
  420. package/vendor/zod/locales/mk.js +112 -0
  421. package/vendor/zod/locales/ms.d.ts +4 -0
  422. package/vendor/zod/locales/ms.js +110 -0
  423. package/vendor/zod/locales/ne.d.ts +4 -0
  424. package/vendor/zod/locales/ne.js +109 -0
  425. package/vendor/zod/locales/nl.d.ts +4 -0
  426. package/vendor/zod/locales/nl.js +113 -0
  427. package/vendor/zod/locales/nn.d.ts +4 -0
  428. package/vendor/zod/locales/nn.js +111 -0
  429. package/vendor/zod/locales/no.d.ts +4 -0
  430. package/vendor/zod/locales/no.js +111 -0
  431. package/vendor/zod/locales/ota.d.ts +4 -0
  432. package/vendor/zod/locales/ota.js +112 -0
  433. package/vendor/zod/locales/package.json +7 -0
  434. package/vendor/zod/locales/pl.d.ts +4 -0
  435. package/vendor/zod/locales/pl.js +112 -0
  436. package/vendor/zod/locales/ps.d.ts +4 -0
  437. package/vendor/zod/locales/ps.js +117 -0
  438. package/vendor/zod/locales/pt-BR.d.ts +4 -0
  439. package/vendor/zod/locales/pt-BR.js +141 -0
  440. package/vendor/zod/locales/pt.d.ts +4 -0
  441. package/vendor/zod/locales/pt.js +140 -0
  442. package/vendor/zod/locales/ro.d.ts +4 -0
  443. package/vendor/zod/locales/ro.js +120 -0
  444. package/vendor/zod/locales/ru.d.ts +4 -0
  445. package/vendor/zod/locales/ru.js +166 -0
  446. package/vendor/zod/locales/sk.d.ts +4 -0
  447. package/vendor/zod/locales/sk.js +114 -0
  448. package/vendor/zod/locales/sl.d.ts +4 -0
  449. package/vendor/zod/locales/sl.js +112 -0
  450. package/vendor/zod/locales/sv.d.ts +4 -0
  451. package/vendor/zod/locales/sv.js +113 -0
  452. package/vendor/zod/locales/ta.d.ts +4 -0
  453. package/vendor/zod/locales/ta.js +113 -0
  454. package/vendor/zod/locales/th.d.ts +4 -0
  455. package/vendor/zod/locales/th.js +113 -0
  456. package/vendor/zod/locales/tk.d.ts +4 -0
  457. package/vendor/zod/locales/tk.js +105 -0
  458. package/vendor/zod/locales/tr.d.ts +4 -0
  459. package/vendor/zod/locales/tr.js +108 -0
  460. package/vendor/zod/locales/ua.d.ts +5 -0
  461. package/vendor/zod/locales/ua.js +5 -0
  462. package/vendor/zod/locales/uk.d.ts +4 -0
  463. package/vendor/zod/locales/uk.js +111 -0
  464. package/vendor/zod/locales/ur.d.ts +4 -0
  465. package/vendor/zod/locales/ur.js +113 -0
  466. package/vendor/zod/locales/uz.d.ts +4 -0
  467. package/vendor/zod/locales/uz.js +111 -0
  468. package/vendor/zod/locales/vi.d.ts +4 -0
  469. package/vendor/zod/locales/vi.js +111 -0
  470. package/vendor/zod/locales/yo.d.ts +4 -0
  471. package/vendor/zod/locales/yo.js +110 -0
  472. package/vendor/zod/locales/zh-CN.d.ts +4 -0
  473. package/vendor/zod/locales/zh-CN.js +112 -0
  474. package/vendor/zod/locales/zh-TW.d.ts +4 -0
  475. package/vendor/zod/locales/zh-TW.js +110 -0
  476. package/vendor/zod/mini/checks.d.ts +1 -0
  477. package/vendor/zod/mini/checks.js +1 -0
  478. package/vendor/zod/mini/coerce.d.ts +7 -0
  479. package/vendor/zod/mini/coerce.js +22 -0
  480. package/vendor/zod/mini/deep-partial.d.ts +14 -0
  481. package/vendor/zod/mini/deep-partial.js +13 -0
  482. package/vendor/zod/mini/external.d.ts +16 -0
  483. package/vendor/zod/mini/external.js +16 -0
  484. package/vendor/zod/mini/in-out.d.ts +8 -0
  485. package/vendor/zod/mini/in-out.js +36 -0
  486. package/vendor/zod/mini/index.d.ts +3 -0
  487. package/vendor/zod/mini/index.js +3 -0
  488. package/vendor/zod/mini/iso.d.ts +22 -0
  489. package/vendor/zod/mini/iso.js +34 -0
  490. package/vendor/zod/mini/package.json +7 -0
  491. package/vendor/zod/mini/parse.d.ts +1 -0
  492. package/vendor/zod/mini/parse.js +1 -0
  493. package/vendor/zod/mini/schemas.d.ts +475 -0
  494. package/vendor/zod/mini/schemas.js +987 -0
  495. package/vendor/zod/package.json +7 -0
  496. package/vendor/zodexy/dist/esm/index.js +1274 -0
  497. package/vendor/zodexy/dist/index.js +1088 -0
  498. package/vendor/zodexy/dist/schema.zodexy.json +1036 -0
  499. package/dist/fundamentalTypes/nativeEnumType.d.ts +0 -6
  500. package/dist/fundamentalTypes/nativeEnumType.d.ts.map +0 -1
  501. package/src/fundamentalTypes/catchType.js +0 -140
  502. package/src/fundamentalTypes/enumType.js +0 -52
  503. package/src/fundamentalTypes/literalType.js +0 -81
  504. package/src/fundamentalTypes/nativeEnumType.js +0 -157
  505. package/src/fundamentalTypes/neverType.js +0 -49
  506. package/src/fundamentalTypes/recordType.js +0 -42
  507. package/src/fundamentalTypes/tupleType.js +0 -39
  508. package/src/fundamentalTypes/voidType.js +0 -48
  509. package/vendor/zod/lib/index.mjs +0 -4236
  510. package/vendor/zodex/dist/esm/dezerialize.d.ts +0 -26
  511. package/vendor/zodex/dist/esm/dezerialize.js +0 -393
  512. package/vendor/zodex/dist/esm/index.d.ts +0 -9
  513. package/vendor/zodex/dist/esm/index.js +0 -4
  514. package/vendor/zodex/dist/esm/infer.d.ts +0 -29
  515. package/vendor/zodex/dist/esm/package.json +0 -1
  516. package/vendor/zodex/dist/esm/types.d.ts +0 -201
  517. package/vendor/zodex/dist/esm/types.js +0 -13
  518. package/vendor/zodex/dist/esm/ui.d.ts +0 -23
  519. package/vendor/zodex/dist/esm/ui.js +0 -10
  520. package/vendor/zodex/dist/esm/zerialize.d.ts +0 -50
  521. package/vendor/zodex/dist/esm/zerialize.js +0 -417
  522. package/vendor/zodex/dist/esm/zod-types.d.ts +0 -11
  523. /package/vendor/{zodex/dist/esm/infer.js → zod/core/json-schema.js} +0 -0
  524. /package/vendor/{zodex/dist/esm/zod-types.js → zod/core/standard-schema.js} +0 -0
@@ -1,6 +1,8 @@
1
1
  import {$e, $$e} from '../utils/templateUtils.js';
2
+ import {schemaLabel} from '../utils/schemaMeta.js';
2
3
  import {jml, parseAcorn} from '../vendor-imports.js';
3
4
  import {copyObject} from '../utils/objects.js';
5
+ import {tick} from '../utils/timing.js';
4
6
 
5
7
  const observerMap = new WeakMap();
6
8
 
@@ -18,16 +20,15 @@ const idRegex =
18
20
  */
19
21
  const setTooltips = ({root, specificSchemaObject, textareas, textareaBody}) => {
20
22
  // Todo: For these `JSON.stringify` calls, might instead use
21
- // zodex->(zod)->zod-to-json-schema instead
23
+ // zodexy->(zod)->zod-to-json-schema instead
22
24
  textareaBody.title = `Return type:\n\n${JSON.stringify(
23
- /** @type {import('zodex').SzFunction<any, any>} */
24
- (specificSchemaObject).returns,
25
+ /** @type {import('zodexy').SzFunction<any, any>} */
26
+ (specificSchemaObject).output,
25
27
  null,
26
28
  2
27
29
  )}`;
28
- // eslint-disable-next-line prefer-destructuring -- TS
29
- const args = /** @type {import('zodex').SzFunction<any, any>} */
30
- (specificSchemaObject).args;
30
+ const args = /** @type {import('zodexy').SzFunction<any, any>} */
31
+ (specificSchemaObject).input;
31
32
  textareas.forEach((textarea, idx) => {
32
33
  textarea.title = JSON.stringify(
33
34
  args.items[idx] ?? args.rest,
@@ -68,13 +69,15 @@ const setTooltips = ({root, specificSchemaObject, textareas, textareaBody}) => {
68
69
 
69
70
  const observer = new MutationObserver((mutationList) => {
70
71
  for (const mutation of mutationList) {
71
- if (mutation.type === 'childList') {
72
- for (const node of mutation.removedNodes) {
73
- addTitles(node);
74
- }
75
- for (const node of mutation.addedNodes) {
76
- addTitles(node);
77
- }
72
+ if (mutation.type !== 'childList') {
73
+ continue;
74
+ }
75
+
76
+ for (const node of mutation.removedNodes) {
77
+ addTitles(node);
78
+ }
79
+ for (const node of mutation.addedNodes) {
80
+ addTitles(node);
78
81
  }
79
82
  }
80
83
  });
@@ -93,11 +96,11 @@ const setTooltips = ({root, specificSchemaObject, textareas, textareaBody}) => {
93
96
  */
94
97
  const getArgsAndBodyOfFunction = (func) => {
95
98
  const funcStr = String(func);
96
- const funcStrFull = String(`(${
99
+ const funcStrFull = `(${
97
100
  funcStr.trimStart().startsWith('function')
98
101
  ? funcStr
99
102
  : `function ${funcStr}`
100
- })`);
103
+ })`;
101
104
  const body = funcStrFull.slice(
102
105
  funcStrFull.indexOf('{') + 1, funcStrFull.lastIndexOf('}')
103
106
  ).trim();
@@ -128,8 +131,11 @@ const getArgsAndBodyOfFunction = (func) => {
128
131
  const setValueAndTooltips = ({root, value, specificSchemaObject}) => {
129
132
  const {args, body} = getArgsAndBodyOfFunction(value);
130
133
 
131
- // Wait for textareas to be available
132
- setTimeout(() => {
134
+ // Wait for textareas to be available; return a promise that settles once the
135
+ // argument textareas have been added and populated, so callers can await a
136
+ // fully-built function editor.
137
+ return (async () => {
138
+ await tick();
133
139
  let textareas = /** @type {HTMLTextAreaElement[]} */ (
134
140
  $$e(root, 'textarea[name$="-string"]')
135
141
  );
@@ -137,27 +143,33 @@ const setValueAndTooltips = ({root, value, specificSchemaObject}) => {
137
143
  const textareaBody = /** @type {HTMLTextAreaElement} */ (textareas.pop());
138
144
 
139
145
  args.forEach((_arg, idx) => {
140
- if (!textareas[idx]) {
146
+ if (!Object.hasOwn(textareas, idx)) {
141
147
  $e(root, '.addArrayElement')?.click();
142
148
  }
143
149
  });
144
150
 
145
- setTimeout(() => {
146
- textareas = /** @type {HTMLTextAreaElement[]} */ (
147
- $$e(root, 'textarea[name$="-string"]').slice(0, -1)
148
- );
151
+ await tick();
152
+ textareas = /** @type {HTMLTextAreaElement[]} */ (
153
+ $$e(root, 'textarea[name$="-string"]').slice(0, -1)
154
+ );
149
155
 
150
- if (value) {
151
- args.forEach((arg, idx) => {
156
+ if (value) {
157
+ args.forEach((arg, idx) => {
158
+ // A slow environment may not have added every arg textarea within the
159
+ // tick; skip rather than throw (the guard in `getValue` covers a
160
+ // read that arrives before this settles).
161
+ if (Object.hasOwn(textareas, idx)) {
152
162
  textareas[idx].value = arg;
153
- });
163
+ }
164
+ });
165
+ if (textareaBody) {
154
166
  textareaBody.value = body;
155
167
  }
156
- if (specificSchemaObject) {
157
- setTooltips({root, specificSchemaObject, textareas, textareaBody});
158
- }
159
- });
160
- });
168
+ }
169
+ if (specificSchemaObject) {
170
+ setTooltips({root, specificSchemaObject, textareas, textareaBody});
171
+ }
172
+ })();
161
173
  };
162
174
 
163
175
  /**
@@ -191,13 +203,20 @@ const functionType = {
191
203
  return /** @type {HTMLTextAreaElement} */ ($e(root, 'textarea'));
192
204
  },
193
205
  setValue ({root, value}) {
194
- setValueAndTooltips({root, value});
206
+ return setValueAndTooltips({root, value});
195
207
  },
196
208
  getValue ({root}) {
197
209
  const textareas = /** @type {HTMLTextAreaElement[]} */ (
198
210
  $$e(root, 'textarea')
199
211
  );
200
212
  const textareaBody = /** @type {HTMLTextAreaElement} */ (textareas.pop());
213
+ /* istanbul ignore if -- Async guard */
214
+ if (!textareaBody) {
215
+ // `editUI` builds its textareas asynchronously, so if `getValue` is
216
+ // reached first (e.g. a synchronous `validate` while a value is
217
+ // being auto-populated), the value is not ready yet.
218
+ throw new Error('Not yet instantiated');
219
+ }
201
220
  // eslint-disable-next-line no-new-func -- Needed
202
221
  return new Function(
203
222
  ...textareas.map(({value}) => value.trim()),
@@ -208,7 +227,7 @@ const functionType = {
208
227
  const {args, body} = getArgsAndBodyOfFunction(value);
209
228
  return ['span', {
210
229
  dataset: {type: 'function'},
211
- title: specificSchemaObject?.description ?? '(a function)'
230
+ title: schemaLabel(specificSchemaObject) ?? '(a function)'
212
231
  }, [
213
232
  ['b', ['Args']],
214
233
  ' ',
@@ -228,9 +247,9 @@ const functionType = {
228
247
  const specificSchemaObj = specificSchemaObject
229
248
  ? copyObject(specificSchemaObject)
230
249
  : undefined;
231
- const argsTuple = /** @type {import('zodex').SzFunction<any, any>} */ (
250
+ const argsTuple = /** @type {import('zodexy').SzFunction<any, any>} */ (
232
251
  specificSchemaObj
233
- )?.args ?? {type: 'tuple', items: [], rest: {type: 'any'}};
252
+ )?.input ?? {type: 'tuple', items: [], rest: {type: 'any'}};
234
253
  argsTuple.description = '';
235
254
  // This `description` not in use, but could support
236
255
  if (argsTuple.rest) {
@@ -238,7 +257,7 @@ const functionType = {
238
257
  }
239
258
 
240
259
  const size = argsTuple.items.length;
241
- const args = /** @type {import('zodex').SzType} */ (
260
+ const args = /** @type {import('zodexy').SzType} */ (
242
261
  {
243
262
  type: 'set',
244
263
  minSize: size,
@@ -259,7 +278,6 @@ const functionType = {
259
278
  buildTypeChoices
260
279
  )({
261
280
  // resultType,
262
- // eslint-disable-next-line object-shorthand -- TS
263
281
  topRoot: /** @type {HTMLDivElement} */ (topRoot),
264
282
  format: 'schema', // We're always supplying a schema
265
283
  // schemaOriginal: schemaContent,
@@ -275,7 +293,6 @@ const functionType = {
275
293
  buildTypeChoices
276
294
  )({
277
295
  // resultType,
278
- // eslint-disable-next-line object-shorthand -- TS
279
296
  topRoot: /** @type {HTMLDivElement} */ (topRoot),
280
297
  format: 'schema', // We're always supplying a schema
281
298
  // schemaOriginal: schemaContent,
@@ -288,12 +305,15 @@ const functionType = {
288
305
 
289
306
  if (value) {
290
307
  setTimeout(() => {
308
+ // Fire-and-forget population; swallow rejections from a still-settling
309
+ // editor so they cannot surface as an unhandled rejection.
291
310
  setValueAndTooltips({
292
311
  root: div,
293
312
  value,
294
313
  specificSchemaObject
295
- });
296
- });
314
+ // eslint-disable-next-line promise/prefer-await-to-then -- Convenient
315
+ }).catch(() => { /* best-effort */ });
316
+ }, 0);
297
317
  } else if (specificSchemaObject) {
298
318
  setTimeout(() => {
299
319
  setTimeout(() => {
@@ -307,8 +327,8 @@ const functionType = {
307
327
  setTooltips({
308
328
  root: div, specificSchemaObject, textareas, textareaBody
309
329
  });
310
- });
311
- });
330
+ }, 0);
331
+ }, 0);
312
332
  }
313
333
 
314
334
  return [div];
@@ -1,4 +1,5 @@
1
1
  import {$e} from '../utils/templateUtils.js';
2
+ import {schemaLabel} from '../utils/schemaMeta.js';
2
3
 
3
4
  /**
4
5
  * @type {import('../types.js').TypeObject}
@@ -9,8 +10,8 @@ const nanType = {
9
10
  valueMatch (x) {
10
11
  return Number.isNaN(x);
11
12
  },
12
- toValue: () => ({value: Number.NaN}),
13
- getValue: () => Number.NaN,
13
+ toValue: () => ({value: NaN}),
14
+ getValue: () => NaN,
14
15
  /* istanbul ignore next -- No dupe keys, array refs, or validation */
15
16
  getInput ({root}) {
16
17
  return /** @type {HTMLInputElement} */ ($e(root, 'input'));
@@ -18,13 +19,13 @@ const nanType = {
18
19
  viewUI ({specificSchemaObject}) {
19
20
  return ['i', {
20
21
  dataset: {type: 'nan'},
21
- title: specificSchemaObject?.description ?? '(a `NaN`)'
22
+ title: schemaLabel(specificSchemaObject) ?? '(a `NaN`)'
22
23
  }, ['NaN']];
23
24
  },
24
25
  editUI ({typeNamespace, specificSchemaObject}) {
25
26
  return ['div', {
26
27
  dataset: {type: 'nan'},
27
- title: specificSchemaObject?.description ?? 'NaN'
28
+ title: schemaLabel(specificSchemaObject) ?? 'NaN'
28
29
  }, [
29
30
  ['label', [
30
31
  'NaN',
@@ -1,5 +1,6 @@
1
1
  import {toStringTag} from '../vendor-imports.js';
2
2
  import {$e} from '../utils/templateUtils.js';
3
+ import {schemaLabel} from '../utils/schemaMeta.js';
3
4
 
4
5
  /**
5
6
  * @type {import('../types.js').TypeObject}
@@ -44,11 +45,11 @@ const noneditableType = {
44
45
  return ['div', {dataset: {type: 'resurrectable'}}, [
45
46
  ['b', {
46
47
  class: 'emphasis',
47
- title: specificSchemaObject?.description
48
+ title: schemaLabel(specificSchemaObject)
48
49
  ? `(a non-editable ${stringTag})`
49
50
  : undefined
50
51
  }, [
51
- specificSchemaObject?.description ?? 'Non-editable'
52
+ schemaLabel(specificSchemaObject) ?? 'Non-editable'
52
53
  ]],
53
54
  ['span', {
54
55
  title: 'There is no current support for editing this element\'s ' +
@@ -61,7 +62,7 @@ const noneditableType = {
61
62
  editUI ({typeNamespace, specificSchemaObject, value}) {
62
63
  return ['div', {
63
64
  dataset: {type: 'resurrectable'},
64
- title: specificSchemaObject?.description ?? 'Non-editable'
65
+ title: schemaLabel(specificSchemaObject) ?? 'Non-editable'
65
66
  }, [
66
67
  ['a', {
67
68
  // eslint-disable-next-line no-script-url -- Safe
@@ -1,4 +1,5 @@
1
1
  import {$e} from '../utils/templateUtils.js';
2
+ import {schemaLabel} from '../utils/schemaMeta.js';
2
3
 
3
4
  /**
4
5
  * @type {import('../types.js').TypeObject}
@@ -18,13 +19,13 @@ const nullType = {
18
19
  viewUI ({specificSchemaObject}) {
19
20
  return ['i', {
20
21
  dataset: {type: 'null'},
21
- title: specificSchemaObject?.description ?? '(a `null`)'
22
+ title: schemaLabel(specificSchemaObject) ?? '(a `null`)'
22
23
  }, ['null']];
23
24
  },
24
25
  editUI ({typeNamespace, specificSchemaObject}) {
25
26
  return ['div', {
26
27
  dataset: {type: 'null'},
27
- title: specificSchemaObject?.description ?? 'Null'
28
+ title: schemaLabel(specificSchemaObject) ?? 'Null'
28
29
  }, [
29
30
  ['label', [
30
31
  'Null',
@@ -1,4 +1,5 @@
1
1
  import {$e} from '../utils/templateUtils.js';
2
+ import {schemaLabel} from '../utils/schemaMeta.js';
2
3
 
3
4
  /**
4
5
  * @type {import('../types.js').TypeObject}
@@ -21,14 +22,16 @@ const numberType = {
21
22
  return typeof x === 'number' &&
22
23
  // Avoid special numbers:
23
24
  !Number.isNaN(x) &&
24
- x !== Number.POSITIVE_INFINITY && x !== Number.NEGATIVE_INFINITY &&
25
+ x !== Infinity && x !== -Infinity &&
25
26
  !Object.is(x, -0);
26
27
  },
27
28
  toValue (s) {
28
29
  return {value: Number(s)};
29
30
  },
30
31
  getInput ({root}) {
31
- return /** @type {HTMLInputElement} */ ($e(root, 'input'));
32
+ return /** @type {HTMLInputElement|HTMLSelectElement} */ (
33
+ $e(root, 'input,select')
34
+ );
32
35
  },
33
36
  setValue ({root, value}) {
34
37
  this.getInput({root}).value = String(value);
@@ -41,7 +44,11 @@ const numberType = {
41
44
  };
42
45
  },
43
46
  getValue ({root}) {
44
- return Number.parseFloat(this.getInput({root}).value);
47
+ const {value} = this.getInput({root});
48
+ // Preserve the pre-existing `parseFloat` semantics: an empty field reads
49
+ // as `NaN` (which `validate` also rejects), not `0` as `Number('')` and
50
+ // `Math.trunc(Number(''))` would give.
51
+ return value.trim() === '' ? NaN : Number(value);
45
52
  },
46
53
  /* schema
47
54
  viewSchemaUI () {
@@ -51,14 +58,32 @@ const numberType = {
51
58
  viewUI ({value, specificSchemaObject}) {
52
59
  return ['i', {
53
60
  dataset: {type: 'number'},
54
- title: specificSchemaObject?.description ?? '(a number)'
61
+ title: schemaLabel(specificSchemaObject) ?? '(a number)'
55
62
  }, [
56
63
  String(value)
57
64
  ]];
58
65
  },
59
66
  editUI ({typeNamespace, specificSchemaObject, value}) {
60
- const isLiteral = specificSchemaObject?.type === 'literal';
61
- const numberSchemaObject = /** @type {import('zodex').SzNumber} */ (
67
+ const isConstrained = specificSchemaObject?.type === 'literal' ||
68
+ specificSchemaObject?.type === 'enum';
69
+ if (isConstrained) {
70
+ const selectedValue = value ?? specificSchemaObject.defaultValue;
71
+ return ['div', {
72
+ dataset: {type: 'number'},
73
+ title: schemaLabel(specificSchemaObject) ?? 'Number'
74
+ }, [
75
+ ['select', {
76
+ name: `${typeNamespace}-number`
77
+ }, Object.values(specificSchemaObject.values).filter((val) => {
78
+ return typeof val === 'number';
79
+ }).map((val) => {
80
+ return ['option', {
81
+ selected: val === selectedValue
82
+ }, [String(val)]];
83
+ })]
84
+ ]];
85
+ }
86
+ const numberSchemaObject = /** @type {import('zodexy').SzNumber} */ (
62
87
  specificSchemaObject
63
88
  );
64
89
  // Seems to need a multiplier of around these sizes to have a noticeable
@@ -66,31 +91,58 @@ const numberType = {
66
91
  const epsilon = 150 * Number.EPSILON;
67
92
  const maxEpsilon = 300 * Number.EPSILON;
68
93
 
94
+ const isInteger = () => {
95
+ return numberSchemaObject && 'format' in numberSchemaObject && numberSchemaObject.format && [
96
+ 'int32', 'uint32', 'safeint'
97
+ ].includes(numberSchemaObject.format);
98
+ };
99
+
100
+ const min = numberSchemaObject?.min ??
101
+ (numberSchemaObject && 'format' in numberSchemaObject && numberSchemaObject.format
102
+ ? {
103
+ int32: -2147483648,
104
+ uint32: 0,
105
+ safeint: Number.MIN_SAFE_INTEGER,
106
+ float32: 1.1754943508222875e-38,
107
+ float64: Number.MIN_VALUE
108
+ }[numberSchemaObject.format]
109
+ : undefined);
110
+
111
+ const max = numberSchemaObject?.max ??
112
+ (numberSchemaObject && 'format' in numberSchemaObject && numberSchemaObject.format
113
+ ? {
114
+ int32: 2147483647,
115
+ uint32: 4294967295,
116
+ safeint: Number.MAX_SAFE_INTEGER,
117
+ float32: 3.4028234663852886e+38,
118
+ float64: Number.MAX_VALUE
119
+ }[numberSchemaObject.format]
120
+ : undefined);
121
+
69
122
  return ['div', {
70
123
  dataset: {type: 'number'},
71
- title: specificSchemaObject?.description ?? 'Number'
124
+ title: schemaLabel(specificSchemaObject) ?? 'Number'
72
125
  }, [
73
126
  ['input', {
74
- disabled: isLiteral,
75
127
  name: `${typeNamespace}-number`,
128
+ // Numeric type can't impose `pattern`
76
129
  type: 'number',
77
- min: numberSchemaObject?.min
130
+ min: min
78
131
  ? numberSchemaObject?.minInclusive
79
- ? numberSchemaObject?.min
80
- : numberSchemaObject?.min +
81
- (numberSchemaObject?.int ? 1 : epsilon)
132
+ ? min
133
+ : min + (
134
+ (isInteger() ? 1 : epsilon)
135
+ )
82
136
  : undefined,
83
- max: numberSchemaObject?.max
137
+ max: max
84
138
  ? numberSchemaObject?.maxInclusive
85
- ? numberSchemaObject?.max
86
- : numberSchemaObject?.max -
87
- (numberSchemaObject?.int ? 1 : maxEpsilon)
139
+ ? max
140
+ : max -
141
+ (isInteger() ? 1 : maxEpsilon)
88
142
  : undefined,
89
143
  step: numberSchemaObject?.multipleOf ??
90
- (numberSchemaObject?.int ? '1' : 'any'),
91
- value: isLiteral
92
- ? specificSchemaObject?.value
93
- : (value ?? specificSchemaObject?.defaultValue ?? '')
144
+ (isInteger() ? '1' : 'any'),
145
+ value: (value ?? specificSchemaObject?.defaultValue ?? '')
94
146
  }]
95
147
  ]];
96
148
  }
@@ -1,29 +1,19 @@
1
1
  import {
2
2
  jml, toStringTag,
3
- Typeson, structuredCloningThrowing,
3
+ Typeson,
4
4
  resurrectable as noneditable, symbol, promise
5
5
  } from '../vendor-imports.js';
6
6
  import {$e} from '../utils/templateUtils.js';
7
+ import {schemaLabel} from '../utils/schemaMeta.js';
8
+ import {tick} from '../utils/timing.js';
7
9
  import arrayType from './arrayType.js';
10
+ import {structuredCloningJsoe, functionSpec} from '../formats/structuredCloning.js';
8
11
 
9
12
  /**
10
13
  *
11
14
  */
12
15
  const getTypeson = () => {
13
- const structuredCloningFixed = structuredCloningThrowing.filter(
14
- (typeSpecSet) => {
15
- return ![
16
- // Not yet supported within JSOE
17
- 'imagedata',
18
- 'imagebitmap',
19
- 'cryptokey',
20
- 'domquad'
21
- ].some((prop) => {
22
- return Object.hasOwn(typeSpecSet, prop);
23
- });
24
- }
25
- );
26
- structuredCloningFixed.splice(
16
+ structuredCloningJsoe.splice(
27
17
  // Add after userObjects
28
18
  1,
29
19
  0,
@@ -31,23 +21,10 @@ const getTypeson = () => {
31
21
  );
32
22
  return new Typeson().register(
33
23
  [
34
- ...structuredCloningFixed,
24
+ ...structuredCloningJsoe,
35
25
  symbol,
36
26
  promise,
37
- {
38
- function: {
39
- test (x) {
40
- return typeof x === 'function';
41
- },
42
- replace (funcType) {
43
- return '(' + funcType.toString() + ')';
44
- },
45
- revive (o) {
46
- // eslint-disable-next-line no-eval -- User opted in
47
- return eval(o);
48
- }
49
- }
50
- }
27
+ functionSpec
51
28
  ]
52
29
  );
53
30
  };
@@ -79,14 +56,15 @@ const promiseType = {
79
56
  const childRoot = /** @type {HTMLDivElement} */ (
80
57
  $e(root, 'div[data-type]')
81
58
  );
82
- // eslint-disable-next-line @stylistic/max-len -- Long
83
59
  return /** @type {HTMLInputElement|HTMLTextAreaElement|HTMLSelectElement|HTMLButtonElement} */ (
84
60
  this.types?.getFormControlForRoot(childRoot)
85
61
  );
86
62
  },
87
63
  setValue ({root, value}) {
88
- // Need to wait a tick
89
- setTimeout(async () => {
64
+ // Need to wait a tick; return a promise that settles once the resolved
65
+ // value's child editor is built and populated.
66
+ return (async () => {
67
+ await tick();
90
68
  const val = await value;
91
69
  const typeson = getTypeson();
92
70
  const type = /** @type {import('../types.js').AvailableArbitraryType} */ (
@@ -101,7 +79,7 @@ const promiseType = {
101
79
  $e(root, 'div[data-type]')
102
80
  );
103
81
 
104
- this.types?.setValue({
82
+ await this.types?.setValue({
105
83
  type,
106
84
  root: childRoot,
107
85
  value: val
@@ -110,7 +88,7 @@ const promiseType = {
110
88
  // Avoid invalid number, etc.
111
89
  input?.dispatchEvent(new Event('input'));
112
90
  input?.blur();
113
- });
91
+ })();
114
92
  },
115
93
  getValue ({root}) {
116
94
  const childRoot = /** @type {HTMLDivElement} */ (
@@ -142,7 +120,7 @@ const promiseType = {
142
120
 
143
121
  return ['span', {
144
122
  dataset: {type: 'promise'},
145
- title: specificSchemaObject?.description
123
+ title: schemaLabel(specificSchemaObject)
146
124
  }, [
147
125
  'A Promise ',
148
126
  span,
@@ -157,19 +135,17 @@ const promiseType = {
157
135
 
158
136
  const div = jml('div', {
159
137
  dataset: {type: 'promise'},
160
- title: specificSchemaObject?.description ?? '(a Promise)'
138
+ title: schemaLabel(specificSchemaObject) ?? '(a Promise)'
161
139
  }, [
162
140
  'Promise ',
163
141
  ...(/** @type {import('../typeChoices.js').BuildTypeChoices} */ (
164
142
  buildTypeChoices
165
143
  )({
166
144
  // resultType,
167
- // eslint-disable-next-line object-shorthand -- TS
168
145
  topRoot: /** @type {HTMLDivElement} */ (topRoot),
169
- // eslint-disable-next-line object-shorthand -- TS
170
146
  format: /** @type {import('../formats.js').AvailableFormat} */ (format),
171
147
  schemaOriginal: schemaContent,
172
- schemaContent: /** @type {import('zodex').SzPromise} */ (
148
+ schemaContent: /** @type {import('zodexy').SzPromise} */ (
173
149
  specificSchemaObject
174
150
  )?.value ?? {type: 'any'},
175
151
  state: type,
@@ -1,5 +1,6 @@
1
1
  import {jml, toStringTag} from '../vendor-imports.js';
2
2
  import {$e} from '../utils/templateUtils.js';
3
+ import {schemaLabel} from '../utils/schemaMeta.js';
3
4
 
4
5
  /**
5
6
  * @type {import('../types.js').TypeObject & {allowedFlags: string[]}}
@@ -23,9 +24,10 @@ const regexpType = {
23
24
  throw new TypeError('Guard for TS');
24
25
  }
25
26
  const [, str, flags] = /** @type {RegExpMatchArray} */ (s.match(
26
- /** @type {Required<import('../types.js').TypeObject>} */ (
27
+ /** @type {import('../types.js').StringMatcher} */
28
+ (/** @type {Required<import('../types.js').TypeObject>} */ (
27
29
  this
28
- ).stringRegex()
30
+ ).stringRegex)()
29
31
  ));
30
32
  return {value: new RegExp(str, flags)};
31
33
  },
@@ -67,7 +69,7 @@ const regexpType = {
67
69
  viewUI ({value, specificSchemaObject}) {
68
70
  return ['i', {
69
71
  dataset: {type: 'regexp'},
70
- title: specificSchemaObject?.description ?? '(a `RegExp`)'
72
+ title: schemaLabel(specificSchemaObject) ?? '(a `RegExp`)'
71
73
  }, [
72
74
  String(value)
73
75
  ]];
@@ -86,15 +88,7 @@ const regexpType = {
86
88
 
87
89
  /** @type {$Set} */
88
90
  $set (valArr) { // A useful reusable method for multiple selects
89
- [...(
90
- /**
91
- * @type {HTMLSelectElement & {
92
- * $set: $Set
93
- * }}
94
- */ (
95
- this
96
- )
97
- ).options].forEach((opt) => {
91
+ [...this.options].forEach((opt) => {
98
92
  opt.selected = valArr.includes(opt.value);
99
93
  });
100
94
  }
@@ -106,7 +100,7 @@ const regexpType = {
106
100
  }));
107
101
  const root = jml('div', {
108
102
  dataset: {type: 'regexp'},
109
- title: specificSchemaObject?.description ?? 'RegExp'
103
+ title: schemaLabel(specificSchemaObject) ?? 'RegExp'
110
104
  }, [
111
105
  ['label', [
112
106
  'Source ',