@es-joy/jsoe 0.24.2 → 0.25.0
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.
- package/.claude/settings.local.json +9 -0
- package/.ncurc.cjs +2 -2
- package/CHANGES.md +51 -0
- package/README.md +23 -13
- package/badges/coverage-badge.svg +1 -1
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/formatAndTypeChoices.d.ts +28 -30
- package/dist/formatAndTypeChoices.d.ts.map +1 -1
- package/dist/formats/indexedDBKey.d.ts.map +1 -1
- package/dist/formats/schema.d.ts +46 -3
- package/dist/formats/schema.d.ts.map +1 -1
- package/dist/formats/structuredCloning.d.ts +3 -0
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/formats.d.ts +24 -6
- package/dist/formats.d.ts.map +1 -1
- package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts +7 -0
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/bigintObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/bigintType.d.ts +10 -0
- package/dist/fundamentalTypes/bigintType.d.ts.map +1 -1
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
- package/dist/fundamentalTypes/booleanType.d.ts.map +1 -1
- package/dist/fundamentalTypes/catchType.d.ts +2 -2
- package/dist/fundamentalTypes/catchType.d.ts.map +1 -1
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
- package/dist/fundamentalTypes/enumType.d.ts +2 -2
- package/dist/fundamentalTypes/enumType.d.ts.map +1 -1
- package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts +6 -0
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
- package/dist/fundamentalTypes/functionType.d.ts.map +1 -1
- package/dist/fundamentalTypes/literalType.d.ts +3 -2
- package/dist/fundamentalTypes/literalType.d.ts.map +1 -1
- package/dist/fundamentalTypes/looseRecordType.d.ts +6 -0
- package/dist/fundamentalTypes/looseRecordType.d.ts.map +1 -0
- package/dist/fundamentalTypes/nanType.d.ts.map +1 -1
- package/dist/fundamentalTypes/neverType.d.ts +2 -2
- package/dist/fundamentalTypes/neverType.d.ts.map +1 -1
- package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -1
- package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
- package/dist/fundamentalTypes/numberType.d.ts.map +1 -1
- package/dist/fundamentalTypes/promiseType.d.ts.map +1 -1
- package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
- package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
- package/dist/fundamentalTypes/symbolType.d.ts.map +1 -1
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/voidType.d.ts +2 -2
- package/dist/fundamentalTypes/voidType.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/rollup.config.d.ts +30 -0
- package/dist/rollup.config.d.ts.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/src/formatAndTypeChoices.d.ts +108 -0
- package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
- package/dist/src/formats/arbitraryJS.d.ts +4 -0
- package/dist/src/formats/arbitraryJS.d.ts.map +1 -0
- package/dist/src/formats/indexedDBKey.d.ts +4 -0
- package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
- package/dist/src/formats/json.d.ts +4 -0
- package/dist/src/formats/json.d.ts.map +1 -0
- package/dist/src/formats/schema.d.ts +17 -0
- package/dist/src/formats/schema.d.ts.map +1 -0
- package/dist/src/formats/structuredCloning.d.ts +19 -0
- package/dist/src/formats/structuredCloning.d.ts.map +1 -0
- package/dist/src/formats.d.ts +135 -0
- package/dist/src/formats.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +8 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +8 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts +29 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/bigintObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/bigintObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/blobType.d.ts +11 -0
- package/dist/src/fundamentalTypes/blobType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/booleanType.d.ts +8 -0
- package/dist/src/fundamentalTypes/booleanType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/catchType.d.ts +6 -0
- package/dist/src/fundamentalTypes/catchType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/dateType.d.ts +26 -0
- package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/domexceptionType.d.ts +6 -0
- package/dist/src/fundamentalTypes/domexceptionType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/enumType.d.ts +6 -0
- package/dist/src/fundamentalTypes/enumType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/errorType.d.ts +6 -0
- package/dist/src/fundamentalTypes/errorType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/fileType.d.ts +13 -0
- package/dist/src/fundamentalTypes/fileType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/filelistType.d.ts +6 -0
- package/dist/src/fundamentalTypes/filelistType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/functionType.d.ts +7 -0
- package/dist/src/fundamentalTypes/functionType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/literalType.d.ts +6 -0
- package/dist/src/fundamentalTypes/literalType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/mapType.d.ts +6 -0
- package/dist/src/fundamentalTypes/mapType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/nanType.d.ts +6 -0
- package/dist/src/fundamentalTypes/nanType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/neverType.d.ts +6 -0
- package/dist/src/fundamentalTypes/neverType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/noneditableType.d.ts +6 -0
- package/dist/src/fundamentalTypes/noneditableType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
- package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
- package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts +8 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/promiseType.d.ts +6 -0
- package/dist/src/fundamentalTypes/promiseType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/recordType.d.ts +6 -0
- package/dist/src/fundamentalTypes/recordType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts +8 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/setType.d.ts +6 -0
- package/dist/src/fundamentalTypes/setType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
- package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/symbolType.d.ts +8 -0
- package/dist/src/fundamentalTypes/symbolType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/tupleType.d.ts +6 -0
- package/dist/src/fundamentalTypes/tupleType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/voidType.d.ts +6 -0
- package/dist/src/fundamentalTypes/voidType.d.ts.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/subTypes/blobHTMLType.d.ts +20 -0
- package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
- package/dist/src/subTypes/falseType.d.ts +8 -0
- package/dist/src/subTypes/falseType.d.ts.map +1 -0
- package/dist/src/subTypes/trueType.d.ts +8 -0
- package/dist/src/subTypes/trueType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialNumberType.d.ts +6 -0
- package/dist/src/superTypes/SpecialNumberType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialRealNumberType.d.ts +6 -0
- package/dist/src/superTypes/SpecialRealNumberType.d.ts.map +1 -0
- package/dist/src/superTypes/buffersourceType.d.ts +8 -0
- package/dist/src/superTypes/buffersourceType.d.ts.map +1 -0
- package/dist/src/superTypes/dommatrixType.d.ts +6 -0
- package/dist/src/superTypes/dommatrixType.d.ts.map +1 -0
- package/dist/src/superTypes/dompointType.d.ts +6 -0
- package/dist/src/superTypes/dompointType.d.ts.map +1 -0
- package/dist/src/superTypes/domrectType.d.ts +6 -0
- package/dist/src/superTypes/domrectType.d.ts.map +1 -0
- package/dist/src/superTypes/errorsSpecialType.d.ts +8 -0
- package/dist/src/superTypes/errorsSpecialType.d.ts.map +1 -0
- package/dist/src/typeChoices.d.ts +140 -0
- package/dist/src/typeChoices.d.ts.map +1 -0
- package/dist/src/types.d.ts +758 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/FileList.d.ts +26 -0
- package/dist/src/utils/FileList.d.ts.map +1 -0
- package/dist/src/utils/dialogs.d.ts +111 -0
- package/dist/src/utils/dialogs.d.ts.map +1 -0
- package/dist/src/utils/jsonPointer.d.ts +46 -0
- package/dist/src/utils/jsonPointer.d.ts.map +1 -0
- package/dist/src/utils/media.d.ts +18 -0
- package/dist/src/utils/media.d.ts.map +1 -0
- package/dist/src/utils/objects.d.ts +16 -0
- package/dist/src/utils/objects.d.ts.map +1 -0
- package/dist/src/utils/templateUtils.d.ts +59 -0
- package/dist/src/utils/templateUtils.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +2 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/vendor-imports.d.ts +4 -0
- package/dist/src/vendor-imports.d.ts.map +1 -0
- package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
- package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
- package/dist/superTypes/buffersourceType.d.ts.map +1 -1
- package/dist/superTypes/dommatrixType.d.ts.map +1 -1
- package/dist/superTypes/dompointType.d.ts.map +1 -1
- package/dist/superTypes/domrectType.d.ts.map +1 -1
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
- package/dist/typeChoices.d.ts +21 -87
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +90 -64
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/FileList.d.ts +4 -3
- package/dist/utils/FileList.d.ts.map +1 -1
- package/dist/utils/dialogs.d.ts +4 -4
- package/dist/utils/dialogs.d.ts.map +1 -1
- package/dist/utils/media.d.ts.map +1 -1
- package/dist/utils/schemaMeta.d.ts +92 -0
- package/dist/utils/schemaMeta.d.ts.map +1 -0
- package/dist/utils/templateUtils.d.ts +3 -3
- package/dist/utils/templateUtils.d.ts.map +1 -1
- package/dist/utils/timing.d.ts +2 -0
- package/dist/utils/timing.d.ts.map +1 -0
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/vendor-imports.d.ts +3 -1
- package/docs/proposals/schema-meta.md +233 -0
- package/eslint.config.js +51 -4
- package/licenseInfo.json +1 -1
- package/package.json +52 -42
- package/pnpm-workspace.yaml +57 -0
- package/rollup.config.js +20 -18
- package/server.js +3 -3
- package/src/deepEqual.js +77 -66
- package/src/deepEqual.js.map +1 -1
- package/src/formatAndTypeChoices.js +62 -58
- package/src/formats/indexedDBKey.js +3 -4
- package/src/formats/schema.js +824 -475
- package/src/formats/structuredCloning.js +189 -80
- package/src/formats.js +17 -5
- package/src/fundamentalTypes/BooleanObjectType.js +4 -5
- package/src/fundamentalTypes/NumberObjectType.js +4 -4
- package/src/fundamentalTypes/StringObjectType.js +3 -4
- package/src/fundamentalTypes/arrayReferenceType.js +0 -2
- package/src/fundamentalTypes/arrayType.js +624 -389
- package/src/fundamentalTypes/bigintObjectType.js +3 -2
- package/src/fundamentalTypes/bigintType.js +79 -17
- package/src/fundamentalTypes/blobType.js +35 -35
- package/src/fundamentalTypes/booleanType.js +16 -8
- package/src/fundamentalTypes/dateType.js +6 -8
- package/src/fundamentalTypes/domexceptionType.js +5 -4
- package/src/fundamentalTypes/errorType.js +39 -32
- package/src/fundamentalTypes/fileType.js +238 -52
- package/src/fundamentalTypes/functionType.js +61 -41
- package/src/fundamentalTypes/nanType.js +5 -4
- package/src/fundamentalTypes/noneditableType.js +4 -3
- package/src/fundamentalTypes/nullType.js +3 -2
- package/src/fundamentalTypes/numberType.js +72 -20
- package/src/fundamentalTypes/promiseType.js +16 -40
- package/src/fundamentalTypes/regexpType.js +7 -13
- package/src/fundamentalTypes/stringType.js +176 -110
- package/src/fundamentalTypes/symbolType.js +3 -2
- package/src/fundamentalTypes/undefinedType.js +3 -2
- package/src/index.js +6 -5
- package/src/jsoe.css +107 -8
- package/src/subTypes/blobHTMLType.js +23 -10
- package/src/superTypes/SpecialNumberType.js +6 -6
- package/src/superTypes/SpecialRealNumberType.js +10 -9
- package/src/superTypes/buffersourceType.js +86 -75
- package/src/superTypes/dommatrixType.js +6 -5
- package/src/superTypes/dompointType.js +6 -5
- package/src/superTypes/domrectType.js +6 -5
- package/src/superTypes/errorsSpecialType.js +54 -35
- package/src/typeChoices.js +373 -53
- package/src/types.js +157 -97
- package/src/utils/FileList.js +3 -3
- package/src/utils/dialogs.js +5 -7
- package/src/utils/jsonPointer.js +1 -1
- package/src/utils/media.js +1 -0
- package/src/utils/schemaMeta.js +257 -0
- package/src/utils/templateUtils.js +3 -3
- package/src/utils/timing.js +12 -0
- package/src/utils/types.js +19 -0
- package/src/vendor-imports.js +10 -2
- package/tsconfig.json +2 -0
- package/vendor/acorn/dist/acorn.d.mts +46 -5
- package/vendor/acorn/dist/acorn.d.ts +46 -5
- package/vendor/acorn/dist/acorn.js +394 -117
- package/vendor/acorn/dist/acorn.mjs +394 -117
- package/vendor/acorn/dist/bin.js +1 -1
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +590 -312
- package/vendor/jamilih/package.json +1 -1
- package/vendor/mime/dist/types/other.js +719 -0
- package/vendor/mime/dist/types/standard.js +366 -0
- package/vendor/typeson-registry/dist/index.js +519 -99
- package/vendor/zod/classic/checks.d.ts +1 -0
- package/vendor/zod/classic/checks.js +1 -0
- package/vendor/zod/classic/coerce.d.ts +17 -0
- package/vendor/zod/classic/coerce.js +17 -0
- package/vendor/zod/classic/compat.d.ts +48 -0
- package/vendor/zod/classic/compat.js +31 -0
- package/vendor/zod/classic/deep-partial.d.ts +14 -0
- package/vendor/zod/classic/deep-partial.js +13 -0
- package/vendor/zod/classic/errors.d.ts +29 -0
- package/vendor/zod/classic/errors.js +57 -0
- package/vendor/zod/classic/external.d.ts +19 -0
- package/vendor/zod/classic/external.js +17 -0
- package/vendor/zod/classic/from-json-schema.d.ts +12 -0
- package/vendor/zod/classic/from-json-schema.js +660 -0
- package/vendor/zod/classic/in-out.d.ts +8 -0
- package/vendor/zod/classic/in-out.js +36 -0
- package/vendor/zod/classic/index.d.ts +3 -0
- package/vendor/zod/classic/index.js +4 -0
- package/vendor/zod/classic/iso.d.ts +7 -0
- package/vendor/zod/classic/iso.js +15 -0
- package/vendor/zod/classic/package.json +7 -0
- package/vendor/zod/classic/parse.d.ts +44 -0
- package/vendor/zod/classic/parse.js +16 -0
- package/vendor/zod/classic/schemas.d.ts +802 -0
- package/vendor/zod/classic/schemas.js +1491 -0
- package/vendor/zod/core/api.d.ts +329 -0
- package/vendor/zod/core/api.js +1104 -0
- package/vendor/zod/core/checks.d.ts +278 -0
- package/vendor/zod/core/checks.js +581 -0
- package/vendor/zod/core/compile.d.ts +51 -0
- package/vendor/zod/core/compile.js +1783 -0
- package/vendor/zod/core/core.d.ts +82 -0
- package/vendor/zod/core/core.js +141 -0
- package/vendor/zod/core/doc.d.ts +16 -0
- package/vendor/zod/core/doc.js +33 -0
- package/vendor/zod/core/errors.d.ts +225 -0
- package/vendor/zod/core/errors.js +270 -0
- package/vendor/zod/core/index.d.ts +19 -0
- package/vendor/zod/core/index.js +19 -0
- package/vendor/zod/core/json-schema-generator.d.ts +65 -0
- package/vendor/zod/core/json-schema-generator.js +99 -0
- package/vendor/zod/core/json-schema-processors.d.ts +49 -0
- package/vendor/zod/core/json-schema-processors.js +747 -0
- package/vendor/zod/core/json-schema.d.ts +89 -0
- package/vendor/zod/core/memoizer.d.ts +15 -0
- package/vendor/zod/core/memoizer.js +265 -0
- package/vendor/zod/core/package.json +7 -0
- package/vendor/zod/core/parse.d.ts +52 -0
- package/vendor/zod/core/parse.js +154 -0
- package/vendor/zod/core/regexes.d.ts +87 -0
- package/vendor/zod/core/regexes.js +150 -0
- package/vendor/zod/core/registries.d.ts +35 -0
- package/vendor/zod/core/registries.js +51 -0
- package/vendor/zod/core/schemas.d.ts +1253 -0
- package/vendor/zod/core/schemas.js +2440 -0
- package/vendor/zod/core/standard-schema.d.ts +126 -0
- package/vendor/zod/core/to-json-schema.d.ts +153 -0
- package/vendor/zod/core/to-json-schema.js +650 -0
- package/vendor/zod/core/util.d.ts +257 -0
- package/vendor/zod/core/util.js +846 -0
- package/vendor/zod/core/versions.d.ts +5 -0
- package/vendor/zod/core/versions.js +5 -0
- package/vendor/zod/core/visit.d.ts +30 -0
- package/vendor/zod/core/visit.js +169 -0
- package/vendor/zod/index.d.ts +3 -0
- package/vendor/zod/index.js +4 -0
- package/vendor/zod/locales/ar.d.ts +4 -0
- package/vendor/zod/locales/ar.js +109 -0
- package/vendor/zod/locales/az.d.ts +4 -0
- package/vendor/zod/locales/az.js +108 -0
- package/vendor/zod/locales/be.d.ts +4 -0
- package/vendor/zod/locales/be.js +166 -0
- package/vendor/zod/locales/bg.d.ts +4 -0
- package/vendor/zod/locales/bg.js +123 -0
- package/vendor/zod/locales/bn.d.ts +4 -0
- package/vendor/zod/locales/bn.js +111 -0
- package/vendor/zod/locales/ca.d.ts +4 -0
- package/vendor/zod/locales/ca.js +110 -0
- package/vendor/zod/locales/ckb.d.ts +4 -0
- package/vendor/zod/locales/ckb.js +131 -0
- package/vendor/zod/locales/cs.d.ts +4 -0
- package/vendor/zod/locales/cs.js +114 -0
- package/vendor/zod/locales/da.d.ts +4 -0
- package/vendor/zod/locales/da.js +118 -0
- package/vendor/zod/locales/de.d.ts +4 -0
- package/vendor/zod/locales/de.js +111 -0
- package/vendor/zod/locales/el.d.ts +4 -0
- package/vendor/zod/locales/el.js +110 -0
- package/vendor/zod/locales/en.d.ts +4 -0
- package/vendor/zod/locales/en.js +123 -0
- package/vendor/zod/locales/eo.d.ts +4 -0
- package/vendor/zod/locales/eo.js +112 -0
- package/vendor/zod/locales/es.d.ts +4 -0
- package/vendor/zod/locales/es.js +134 -0
- package/vendor/zod/locales/fa.d.ts +4 -0
- package/vendor/zod/locales/fa.js +117 -0
- package/vendor/zod/locales/fi.d.ts +4 -0
- package/vendor/zod/locales/fi.js +115 -0
- package/vendor/zod/locales/fr-CA.d.ts +4 -0
- package/vendor/zod/locales/fr-CA.js +110 -0
- package/vendor/zod/locales/fr.d.ts +4 -0
- package/vendor/zod/locales/fr.js +127 -0
- package/vendor/zod/locales/gu.d.ts +4 -0
- package/vendor/zod/locales/gu.js +111 -0
- package/vendor/zod/locales/he.d.ts +4 -0
- package/vendor/zod/locales/he.js +219 -0
- package/vendor/zod/locales/hi.d.ts +4 -0
- package/vendor/zod/locales/hi.js +109 -0
- package/vendor/zod/locales/hr.d.ts +4 -0
- package/vendor/zod/locales/hr.js +124 -0
- package/vendor/zod/locales/hu.d.ts +4 -0
- package/vendor/zod/locales/hu.js +111 -0
- package/vendor/zod/locales/hy.d.ts +4 -0
- package/vendor/zod/locales/hy.js +156 -0
- package/vendor/zod/locales/id.d.ts +4 -0
- package/vendor/zod/locales/id.js +109 -0
- package/vendor/zod/locales/index.d.ts +62 -0
- package/vendor/zod/locales/index.js +62 -0
- package/vendor/zod/locales/is.d.ts +4 -0
- package/vendor/zod/locales/is.js +112 -0
- package/vendor/zod/locales/it.d.ts +4 -0
- package/vendor/zod/locales/it.js +111 -0
- package/vendor/zod/locales/ja.d.ts +4 -0
- package/vendor/zod/locales/ja.js +110 -0
- package/vendor/zod/locales/ka.d.ts +4 -0
- package/vendor/zod/locales/ka.js +115 -0
- package/vendor/zod/locales/kh.d.ts +5 -0
- package/vendor/zod/locales/kh.js +5 -0
- package/vendor/zod/locales/km.d.ts +4 -0
- package/vendor/zod/locales/km.js +113 -0
- package/vendor/zod/locales/kn.d.ts +4 -0
- package/vendor/zod/locales/kn.js +114 -0
- package/vendor/zod/locales/ko.d.ts +4 -0
- package/vendor/zod/locales/ko.js +114 -0
- package/vendor/zod/locales/lt.d.ts +4 -0
- package/vendor/zod/locales/lt.js +205 -0
- package/vendor/zod/locales/mk.d.ts +4 -0
- package/vendor/zod/locales/mk.js +112 -0
- package/vendor/zod/locales/ms.d.ts +4 -0
- package/vendor/zod/locales/ms.js +110 -0
- package/vendor/zod/locales/ne.d.ts +4 -0
- package/vendor/zod/locales/ne.js +109 -0
- package/vendor/zod/locales/nl.d.ts +4 -0
- package/vendor/zod/locales/nl.js +113 -0
- package/vendor/zod/locales/nn.d.ts +4 -0
- package/vendor/zod/locales/nn.js +111 -0
- package/vendor/zod/locales/no.d.ts +4 -0
- package/vendor/zod/locales/no.js +111 -0
- package/vendor/zod/locales/ota.d.ts +4 -0
- package/vendor/zod/locales/ota.js +112 -0
- package/vendor/zod/locales/package.json +7 -0
- package/vendor/zod/locales/pl.d.ts +4 -0
- package/vendor/zod/locales/pl.js +112 -0
- package/vendor/zod/locales/ps.d.ts +4 -0
- package/vendor/zod/locales/ps.js +117 -0
- package/vendor/zod/locales/pt-BR.d.ts +4 -0
- package/vendor/zod/locales/pt-BR.js +141 -0
- package/vendor/zod/locales/pt.d.ts +4 -0
- package/vendor/zod/locales/pt.js +140 -0
- package/vendor/zod/locales/ro.d.ts +4 -0
- package/vendor/zod/locales/ro.js +120 -0
- package/vendor/zod/locales/ru.d.ts +4 -0
- package/vendor/zod/locales/ru.js +166 -0
- package/vendor/zod/locales/sk.d.ts +4 -0
- package/vendor/zod/locales/sk.js +114 -0
- package/vendor/zod/locales/sl.d.ts +4 -0
- package/vendor/zod/locales/sl.js +112 -0
- package/vendor/zod/locales/sv.d.ts +4 -0
- package/vendor/zod/locales/sv.js +113 -0
- package/vendor/zod/locales/ta.d.ts +4 -0
- package/vendor/zod/locales/ta.js +113 -0
- package/vendor/zod/locales/th.d.ts +4 -0
- package/vendor/zod/locales/th.js +113 -0
- package/vendor/zod/locales/tk.d.ts +4 -0
- package/vendor/zod/locales/tk.js +105 -0
- package/vendor/zod/locales/tr.d.ts +4 -0
- package/vendor/zod/locales/tr.js +108 -0
- package/vendor/zod/locales/ua.d.ts +5 -0
- package/vendor/zod/locales/ua.js +5 -0
- package/vendor/zod/locales/uk.d.ts +4 -0
- package/vendor/zod/locales/uk.js +111 -0
- package/vendor/zod/locales/ur.d.ts +4 -0
- package/vendor/zod/locales/ur.js +113 -0
- package/vendor/zod/locales/uz.d.ts +4 -0
- package/vendor/zod/locales/uz.js +111 -0
- package/vendor/zod/locales/vi.d.ts +4 -0
- package/vendor/zod/locales/vi.js +111 -0
- package/vendor/zod/locales/yo.d.ts +4 -0
- package/vendor/zod/locales/yo.js +110 -0
- package/vendor/zod/locales/zh-CN.d.ts +4 -0
- package/vendor/zod/locales/zh-CN.js +112 -0
- package/vendor/zod/locales/zh-TW.d.ts +4 -0
- package/vendor/zod/locales/zh-TW.js +110 -0
- package/vendor/zod/mini/checks.d.ts +1 -0
- package/vendor/zod/mini/checks.js +1 -0
- package/vendor/zod/mini/coerce.d.ts +7 -0
- package/vendor/zod/mini/coerce.js +22 -0
- package/vendor/zod/mini/deep-partial.d.ts +14 -0
- package/vendor/zod/mini/deep-partial.js +13 -0
- package/vendor/zod/mini/external.d.ts +16 -0
- package/vendor/zod/mini/external.js +16 -0
- package/vendor/zod/mini/in-out.d.ts +8 -0
- package/vendor/zod/mini/in-out.js +36 -0
- package/vendor/zod/mini/index.d.ts +3 -0
- package/vendor/zod/mini/index.js +3 -0
- package/vendor/zod/mini/iso.d.ts +22 -0
- package/vendor/zod/mini/iso.js +34 -0
- package/vendor/zod/mini/package.json +7 -0
- package/vendor/zod/mini/parse.d.ts +1 -0
- package/vendor/zod/mini/parse.js +1 -0
- package/vendor/zod/mini/schemas.d.ts +475 -0
- package/vendor/zod/mini/schemas.js +987 -0
- package/vendor/zod/package.json +7 -0
- package/vendor/zodexy/dist/esm/index.js +1274 -0
- package/vendor/zodexy/dist/index.js +1088 -0
- package/vendor/zodexy/dist/schema.zodexy.json +1036 -0
- package/dist/fundamentalTypes/nativeEnumType.d.ts +0 -6
- package/dist/fundamentalTypes/nativeEnumType.d.ts.map +0 -1
- package/src/fundamentalTypes/catchType.js +0 -140
- package/src/fundamentalTypes/enumType.js +0 -52
- package/src/fundamentalTypes/literalType.js +0 -81
- package/src/fundamentalTypes/nativeEnumType.js +0 -157
- package/src/fundamentalTypes/neverType.js +0 -49
- package/src/fundamentalTypes/recordType.js +0 -42
- package/src/fundamentalTypes/tupleType.js +0 -39
- package/src/fundamentalTypes/voidType.js +0 -48
- package/vendor/zod/lib/index.mjs +0 -4236
- package/vendor/zodex/dist/esm/dezerialize.d.ts +0 -26
- package/vendor/zodex/dist/esm/dezerialize.js +0 -393
- package/vendor/zodex/dist/esm/index.d.ts +0 -9
- package/vendor/zodex/dist/esm/index.js +0 -4
- package/vendor/zodex/dist/esm/infer.d.ts +0 -29
- package/vendor/zodex/dist/esm/package.json +0 -1
- package/vendor/zodex/dist/esm/types.d.ts +0 -201
- package/vendor/zodex/dist/esm/types.js +0 -13
- package/vendor/zodex/dist/esm/ui.d.ts +0 -23
- package/vendor/zodex/dist/esm/ui.js +0 -10
- package/vendor/zodex/dist/esm/zerialize.d.ts +0 -50
- package/vendor/zodex/dist/esm/zerialize.js +0 -417
- package/vendor/zodex/dist/esm/zod-types.d.ts +0 -11
- /package/vendor/{zodex/dist/esm/infer.js → zod/core/json-schema.js} +0 -0
- /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
|
-
//
|
|
23
|
+
// zodexy->(zod)->zod-to-json-schema instead
|
|
22
24
|
textareaBody.title = `Return type:\n\n${JSON.stringify(
|
|
23
|
-
/** @type {import('
|
|
24
|
-
(specificSchemaObject).
|
|
25
|
+
/** @type {import('zodexy').SzFunction<any, any>} */
|
|
26
|
+
(specificSchemaObject).output,
|
|
25
27
|
null,
|
|
26
28
|
2
|
|
27
29
|
)}`;
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
146
|
+
if (!Object.hasOwn(textareas, idx)) {
|
|
141
147
|
$e(root, '.addArrayElement')?.click();
|
|
142
148
|
}
|
|
143
149
|
});
|
|
144
150
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
await tick();
|
|
152
|
+
textareas = /** @type {HTMLTextAreaElement[]} */ (
|
|
153
|
+
$$e(root, 'textarea[name$="-string"]').slice(0, -1)
|
|
154
|
+
);
|
|
149
155
|
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
157
|
-
|
|
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
|
|
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('
|
|
250
|
+
const argsTuple = /** @type {import('zodexy').SzFunction<any, any>} */ (
|
|
232
251
|
specificSchemaObj
|
|
233
|
-
)?.
|
|
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('
|
|
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:
|
|
13
|
-
getValue: () =>
|
|
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
|
|
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
|
|
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
|
|
48
|
+
title: schemaLabel(specificSchemaObject)
|
|
48
49
|
? `(a non-editable ${stringTag})`
|
|
49
50
|
: undefined
|
|
50
51
|
}, [
|
|
51
|
-
specificSchemaObject
|
|
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
|
|
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
|
|
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
|
|
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 !==
|
|
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} */ (
|
|
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
|
-
|
|
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
|
|
61
|
+
title: schemaLabel(specificSchemaObject) ?? '(a number)'
|
|
55
62
|
}, [
|
|
56
63
|
String(value)
|
|
57
64
|
]];
|
|
58
65
|
},
|
|
59
66
|
editUI ({typeNamespace, specificSchemaObject, value}) {
|
|
60
|
-
const
|
|
61
|
-
|
|
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
|
|
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:
|
|
130
|
+
min: min
|
|
78
131
|
? numberSchemaObject?.minInclusive
|
|
79
|
-
?
|
|
80
|
-
:
|
|
81
|
-
(
|
|
132
|
+
? min
|
|
133
|
+
: min + (
|
|
134
|
+
(isInteger() ? 1 : epsilon)
|
|
135
|
+
)
|
|
82
136
|
: undefined,
|
|
83
|
-
max:
|
|
137
|
+
max: max
|
|
84
138
|
? numberSchemaObject?.maxInclusive
|
|
85
|
-
?
|
|
86
|
-
:
|
|
87
|
-
(
|
|
139
|
+
? max
|
|
140
|
+
: max -
|
|
141
|
+
(isInteger() ? 1 : maxEpsilon)
|
|
88
142
|
: undefined,
|
|
89
143
|
step: numberSchemaObject?.multipleOf ??
|
|
90
|
-
(
|
|
91
|
-
value:
|
|
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,
|
|
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
|
-
|
|
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
|
-
...
|
|
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
|
-
|
|
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
|
|
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
|
|
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('
|
|
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 {
|
|
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
|
|
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
|
|
103
|
+
title: schemaLabel(specificSchemaObject) ?? 'RegExp'
|
|
110
104
|
}, [
|
|
111
105
|
['label', [
|
|
112
106
|
'Source ',
|