@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
package/src/types.js
CHANGED
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
// jamilih
|
|
5
5
|
jml,
|
|
6
6
|
// typeson-registry
|
|
7
|
-
Typeson, getJSONType,
|
|
7
|
+
Typeson, getJSONType, structuredCloningForStorage
|
|
8
8
|
} from './vendor-imports.js';
|
|
9
9
|
|
|
10
10
|
import {$e, $$e} from './utils/templateUtils.js';
|
|
11
|
+
import {resolveSchemaMeta, appendSchemaMeta} from './utils/schemaMeta.js';
|
|
11
12
|
|
|
12
13
|
import nullType from './fundamentalTypes/nullType.js';
|
|
13
14
|
import trueType from './subTypes/trueType.js';
|
|
@@ -22,16 +23,11 @@ import stringType from './fundamentalTypes/stringType.js';
|
|
|
22
23
|
import arrayReferenceType from './fundamentalTypes/arrayReferenceType.js';
|
|
23
24
|
import objectReferenceType from './fundamentalTypes/objectReferenceType.js';
|
|
24
25
|
import arrayType from './fundamentalTypes/arrayType.js';
|
|
25
|
-
import tupleType from './fundamentalTypes/tupleType.js';
|
|
26
26
|
import objectType from './fundamentalTypes/objectType.js';
|
|
27
|
-
import recordType from './fundamentalTypes/recordType.js';
|
|
28
27
|
import dateType from './fundamentalTypes/dateType.js';
|
|
29
|
-
import enumType from './fundamentalTypes/enumType.js';
|
|
30
28
|
import setType from './fundamentalTypes/setType.js';
|
|
31
29
|
import mapType from './fundamentalTypes/mapType.js';
|
|
32
|
-
import literalType from './fundamentalTypes/literalType.js';
|
|
33
30
|
import undefinedType from './fundamentalTypes/undefinedType.js';
|
|
34
|
-
import voidType from './fundamentalTypes/voidType.js';
|
|
35
31
|
import regexpType from './fundamentalTypes/regexpType.js';
|
|
36
32
|
import BooleanObjectType from './fundamentalTypes/BooleanObjectType.js';
|
|
37
33
|
import NumberObjectType from './fundamentalTypes/NumberObjectType.js';
|
|
@@ -51,9 +47,6 @@ import dompointType from './superTypes/dompointType.js';
|
|
|
51
47
|
import dommatrixType from './superTypes/dommatrixType.js';
|
|
52
48
|
import buffersourceType from './superTypes/buffersourceType.js';
|
|
53
49
|
import noneditableType from './fundamentalTypes/noneditableType.js';
|
|
54
|
-
import neverType from './fundamentalTypes/neverType.js';
|
|
55
|
-
import catchType from './fundamentalTypes/catchType.js';
|
|
56
|
-
import nativeEnumType from './fundamentalTypes/nativeEnumType.js';
|
|
57
50
|
|
|
58
51
|
import symbolType from './fundamentalTypes/symbolType.js';
|
|
59
52
|
import promiseType from './fundamentalTypes/promiseType.js';
|
|
@@ -79,8 +72,9 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
79
72
|
'No property with text present on the supplied legend element'
|
|
80
73
|
);
|
|
81
74
|
}
|
|
82
|
-
// 1-based to 0-based
|
|
83
|
-
|
|
75
|
+
// 1-based to 0-based (truncate first, then decrement, as the previous
|
|
76
|
+
// `parseInt` did)
|
|
77
|
+
return String(Math.trunc(Number(propElem.textContent)) - 1);
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
/**
|
|
@@ -155,28 +149,30 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
155
149
|
*/
|
|
156
150
|
|
|
157
151
|
/**
|
|
158
|
-
* @typedef {{
|
|
159
|
-
* typeNamespace?: string,
|
|
160
|
-
*
|
|
161
|
-
* format?: import('./formats.js').AvailableFormat,
|
|
162
|
-
* formats?: import('./formats.js').default,
|
|
163
|
-
* types?: Types,
|
|
164
|
-
* error?: Error,
|
|
165
|
-
* rootUI?:
|
|
166
|
-
* schema?: string,
|
|
167
|
-
* schemaParent?: import('./formats/schema.js').ZodexSchema,
|
|
168
|
-
* schemaContent?: import('./formats/schema.js').ZodexSchema,
|
|
169
|
-
* specificSchema?: import('./formats/schema.js').ZodexSchema,
|
|
170
|
-
* specificSchemas?: import('./formats/schema.js').ZodexSchema[],
|
|
171
|
-
* paths?: {[currentPath: string]: {
|
|
172
|
-
* referentPath: string,
|
|
173
|
-
* expectArrayReferent: boolean
|
|
174
|
-
* }},
|
|
175
|
-
* handlingReference?: boolean
|
|
176
|
-
*
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
152
|
+
* @typedef {{
|
|
153
|
+
* typeNamespace?: string,
|
|
154
|
+
* readonly?: boolean,
|
|
155
|
+
* format?: import('./formats.js').AvailableFormat,
|
|
156
|
+
* formats?: import('./formats.js').default,
|
|
157
|
+
* types?: Types,
|
|
158
|
+
* error?: Error,
|
|
159
|
+
* rootUI?: HTMLElement,
|
|
160
|
+
* schema?: string,
|
|
161
|
+
* schemaParent?: import('./formats/schema.js').ZodexSchema,
|
|
162
|
+
* schemaContent?: import('./formats/schema.js').ZodexSchema,
|
|
163
|
+
* specificSchema?: import('./formats/schema.js').ZodexSchema,
|
|
164
|
+
* specificSchemas?: import('./formats/schema.js').ZodexSchema[],
|
|
165
|
+
* paths?: {[currentPath: string]: {
|
|
166
|
+
* referentPath: string,
|
|
167
|
+
* expectArrayReferent: boolean
|
|
168
|
+
* }},
|
|
169
|
+
* handlingReference?: boolean,
|
|
170
|
+
* pendingBuilds?: Promise<void>[],
|
|
171
|
+
* whenBuilt?: Promise<void>,
|
|
172
|
+
* buildWarnings?: {keypath: string, type: string, reason: string}[]
|
|
173
|
+
* }} StateObject
|
|
174
|
+
*/
|
|
175
|
+
|
|
180
176
|
/**
|
|
181
177
|
* @typedef {(cfg: {
|
|
182
178
|
* readonly?: boolean,
|
|
@@ -195,7 +191,6 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
195
191
|
* schemaFallingBack?: boolean
|
|
196
192
|
* }) => HTMLElement} GetUIForModeAndType
|
|
197
193
|
*/
|
|
198
|
-
/* eslint-enable jsdoc/valid-types -- readonly reserved */
|
|
199
194
|
|
|
200
195
|
/**
|
|
201
196
|
* @typedef {(cfg: {
|
|
@@ -225,7 +220,7 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
225
220
|
* type: AvailableArbitraryType,
|
|
226
221
|
* root: RootElement,
|
|
227
222
|
* value: StructuredCloneValue,
|
|
228
|
-
* }) => void} SetValue
|
|
223
|
+
* }) => void|Promise<void>} SetValue
|
|
229
224
|
*/
|
|
230
225
|
|
|
231
226
|
/**
|
|
@@ -245,12 +240,12 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
245
240
|
* schemaObject?: import('./formatAndTypeChoices.js').ZodexSchema|undefined
|
|
246
241
|
* schemaOriginal?: import('./formatAndTypeChoices.js').ZodexSchema|undefined
|
|
247
242
|
* }) => [
|
|
248
|
-
* value: StructuredCloneValue,
|
|
249
|
-
* remnant: string,
|
|
250
|
-
* beginOnly: boolean,
|
|
251
|
-
* assign: boolean
|
|
252
|
-
* ]} GetValueForString
|
|
253
|
-
*/
|
|
243
|
+
* value: StructuredCloneValue,
|
|
244
|
+
* remnant: string,
|
|
245
|
+
* beginOnly: boolean,
|
|
246
|
+
* assign: boolean
|
|
247
|
+
* ]} GetValueForString
|
|
248
|
+
*/
|
|
254
249
|
|
|
255
250
|
/**
|
|
256
251
|
* @typedef {(
|
|
@@ -291,7 +286,7 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
291
286
|
* root: HTMLDivElement,
|
|
292
287
|
* value: StructuredCloneValue
|
|
293
288
|
* }
|
|
294
|
-
* ) => void} TypeObjectSetValue
|
|
289
|
+
* ) => void|Promise<void>} TypeObjectSetValue
|
|
295
290
|
*/
|
|
296
291
|
|
|
297
292
|
/**
|
|
@@ -304,6 +299,10 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
304
299
|
* }} ToValue
|
|
305
300
|
*/
|
|
306
301
|
|
|
302
|
+
/**
|
|
303
|
+
* @typedef {((nonGrouping?: boolean) => RegExp)} StringMatcher
|
|
304
|
+
*/
|
|
305
|
+
|
|
307
306
|
/**
|
|
308
307
|
* @typedef {object} TypeObject
|
|
309
308
|
* @property {[
|
|
@@ -315,10 +314,6 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
315
314
|
* it is a `Map`. Do not use in other types.
|
|
316
315
|
* @property {boolean} [set] Private context variable. Whether or not
|
|
317
316
|
* it is a `Set`. Do not use in other types.
|
|
318
|
-
* @property {boolean} [record] Private context variable. Whether or not
|
|
319
|
-
* it is a `Record`. Do not use in other types.
|
|
320
|
-
* @property {boolean} [tuple] Private context variable. Whether or not
|
|
321
|
-
* it is a tuple type. Do not use in other types.
|
|
322
317
|
* @property {boolean} [filelist] Private context variable. Whether or not
|
|
323
318
|
* it is a `FileList` type. Do not use in other types.
|
|
324
319
|
* @property {boolean} [sparse] Private context variable. Whether or not
|
|
@@ -326,7 +321,7 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
326
321
|
* @property {boolean} [valid] Private context variable. Whether or not
|
|
327
322
|
* it is a valid date. Do not use in other types.
|
|
328
323
|
* @property {string[]} [regexEndings] Used for string parsing.
|
|
329
|
-
* @property {RegExp|
|
|
324
|
+
* @property {RegExp|StringMatcher} [stringRegex] Used
|
|
330
325
|
* for string parsing. If not present, use `stringRegexBegin` and
|
|
331
326
|
* `stringRegexEnd`.
|
|
332
327
|
* @property {RegExp} [stringRegexBegin] Used for string parsing. If not
|
|
@@ -409,17 +404,16 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
409
404
|
*/
|
|
410
405
|
|
|
411
406
|
/**
|
|
412
|
-
* @typedef {"null"|"true"|"false"|"number"|"bigint"|"bigintObject"
|
|
413
|
-
* "string"|"arrayReference"
|
|
414
|
-
* "objectReference"|"array"|"object"|"date"|"userObject"|"undef"
|
|
415
|
-
* "SpecialRealNumber"|"SpecialNumber"|"regexp"|"BooleanObject"
|
|
416
|
-
* "NumberObject"|"StringObject"|"map"|"set"|"file"|"filelist"|"blobHTML"
|
|
417
|
-
* "buffersource"|"dataview"|"imagedata"|"imagebitmap"
|
|
418
|
-
* "int8array"|"uint8array"|"uint8clampedarray"|"int16array"|"uint16array"
|
|
419
|
-
* "int32array"|"uint32array"|"float32array"|"float64array"|"ValidDate"
|
|
420
|
-
* "arrayNonindexKeys"|"error"|"errors"|"blob"|"domexception"|"domrect"
|
|
421
|
-
* "dompoint"|"dommatrix"|"resurrectable"|"boolean"|"nan"
|
|
422
|
-
* "record"|"void"|"enum"|"literal"|"never"|"catch"|"nativeEnum"
|
|
407
|
+
* @typedef {"null"|"true"|"false"|"number"|"bigint"|"bigintObject"
|
|
408
|
+
* |"string"|"arrayReference"
|
|
409
|
+
* |"objectReference"|"array"|"object"|"date"|"userObject"|"undef"
|
|
410
|
+
* |"SpecialRealNumber"|"SpecialNumber"|"regexp"|"BooleanObject"
|
|
411
|
+
* |"NumberObject"|"StringObject"|"map"|"set"|"file"|"filelist"|"blobHTML"
|
|
412
|
+
* |"buffersource"|"dataview"|"imagedata"|"imagebitmap"
|
|
413
|
+
* |"int8array"|"uint8array"|"uint8clampedarray"|"int16array"|"uint16array"
|
|
414
|
+
* |"int32array"|"uint32array"|"float32array"|"float64array"|"ValidDate"
|
|
415
|
+
* |"arrayNonindexKeys"|"error"|"errors"|"blob"|"domexception"|"domrect"
|
|
416
|
+
* |"dompoint"|"dommatrix"|"resurrectable"|"boolean"|"nan"
|
|
423
417
|
* } AvailableType
|
|
424
418
|
*/
|
|
425
419
|
|
|
@@ -429,20 +423,31 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
429
423
|
|
|
430
424
|
/**
|
|
431
425
|
* @typedef {TypeObject & {
|
|
432
|
-
* childTypes: string[]
|
|
433
|
-
* }} SuperTypeObject
|
|
434
|
-
*/
|
|
426
|
+
* childTypes: string[]
|
|
427
|
+
* }} SuperTypeObject
|
|
428
|
+
*/
|
|
435
429
|
|
|
436
430
|
/**
|
|
437
431
|
*
|
|
438
432
|
*/
|
|
439
433
|
class Types {
|
|
440
434
|
/**
|
|
441
|
-
*
|
|
435
|
+
* @param {{
|
|
436
|
+
* useZodexyErrorMessages?: boolean,
|
|
437
|
+
* useZodexyErrorMessagesInTypes?: boolean
|
|
438
|
+
* }} [cfg]
|
|
442
439
|
*/
|
|
443
|
-
constructor (
|
|
440
|
+
constructor ({
|
|
441
|
+
useZodexyErrorMessages = false,
|
|
442
|
+
useZodexyErrorMessagesInTypes = false
|
|
443
|
+
} = {}) {
|
|
444
444
|
this.formats = new Formats(); // Todo: Make customizable and test
|
|
445
445
|
|
|
446
|
+
this.useZodexyErrorMessages = useZodexyErrorMessages;
|
|
447
|
+
this.useZodexyErrorMessagesInTypes = useZodexyErrorMessagesInTypes;
|
|
448
|
+
/** @type {WeakMap<RootElement, import('./formats/schema.js').ZodexSchema>} */
|
|
449
|
+
this.schemasForRoots = new WeakMap();
|
|
450
|
+
|
|
446
451
|
/** @type {CustomValidateAllReferences|undefined} */
|
|
447
452
|
this.customValidateAllReferences = undefined;
|
|
448
453
|
/**
|
|
@@ -463,22 +468,17 @@ class Types {
|
|
|
463
468
|
arrayReference: arrayReferenceType,
|
|
464
469
|
objectReference: objectReferenceType,
|
|
465
470
|
array: arrayType,
|
|
466
|
-
tuple: tupleType, // Schema type
|
|
467
471
|
// Note: We don't do for BooleanObject/NumberObject/StringObject, date,
|
|
468
472
|
// regexp, as added properties on them are not being cloned (in Chrome
|
|
469
473
|
// at least)
|
|
470
474
|
object: objectType,
|
|
471
|
-
record: recordType, // Schema type
|
|
472
475
|
date: dateType,
|
|
473
|
-
enum: enumType,
|
|
474
|
-
|
|
475
476
|
// This type is only for throwing upon cloning errors:
|
|
476
477
|
// 'checkDataCloneException'
|
|
477
478
|
// This type might be supported by evaluable JS or config
|
|
478
479
|
// passed in:
|
|
479
480
|
userObject: ['User objects'],
|
|
480
481
|
undef: undefinedType,
|
|
481
|
-
void: voidType,
|
|
482
482
|
SpecialRealNumber: SpecialRealNumberSuperType,
|
|
483
483
|
SpecialNumber: SpecialNumberSuperType,
|
|
484
484
|
|
|
@@ -490,8 +490,6 @@ class Types {
|
|
|
490
490
|
NumberObject: NumberObjectType,
|
|
491
491
|
StringObject: StringObjectType,
|
|
492
492
|
|
|
493
|
-
literal: literalType,
|
|
494
|
-
|
|
495
493
|
map: mapType,
|
|
496
494
|
set: setType,
|
|
497
495
|
|
|
@@ -506,15 +504,11 @@ class Types {
|
|
|
506
504
|
dommatrix: dommatrixType,
|
|
507
505
|
|
|
508
506
|
resurrectable: noneditableType,
|
|
509
|
-
never: neverType,
|
|
510
507
|
|
|
511
508
|
symbol: symbolType, // Non-cloning type
|
|
512
509
|
promise: promiseType,
|
|
513
510
|
function: functionType,
|
|
514
511
|
|
|
515
|
-
catch: catchType,
|
|
516
|
-
nativeEnum: nativeEnumType,
|
|
517
|
-
|
|
518
512
|
buffersource: buffersourceType,
|
|
519
513
|
dataview: {
|
|
520
514
|
option: ['DataView']
|
|
@@ -580,11 +574,9 @@ class Types {
|
|
|
580
574
|
const copyTypeObjs = (replacements) => {
|
|
581
575
|
replacements.forEach(([copyFrom, copyTo]) => {
|
|
582
576
|
Object.assign(this.availableTypes[
|
|
583
|
-
|
|
584
|
-
(copyTo)
|
|
577
|
+
copyTo
|
|
585
578
|
], this.availableTypes[
|
|
586
|
-
|
|
587
|
-
(copyFrom)
|
|
579
|
+
copyFrom
|
|
588
580
|
]);
|
|
589
581
|
});
|
|
590
582
|
};
|
|
@@ -616,12 +608,12 @@ class Types {
|
|
|
616
608
|
Object.entries(stateDependent).forEach(([
|
|
617
609
|
format, formatStateDependent
|
|
618
610
|
]) => {
|
|
619
|
-
if (!this.contexts
|
|
611
|
+
if (!Object.hasOwn(this.contexts, format)) {
|
|
620
612
|
this.contexts[format] = {};
|
|
621
613
|
}
|
|
622
614
|
const {contexts, after} = formatStateDependent;
|
|
623
615
|
contexts.forEach((context) => {
|
|
624
|
-
if (!this.contexts[format]
|
|
616
|
+
if (!Object.hasOwn(this.contexts[format], context)) {
|
|
625
617
|
this.contexts[format][context] = [];
|
|
626
618
|
}
|
|
627
619
|
this.contexts[format][context].push({type, after});
|
|
@@ -722,8 +714,12 @@ class Types {
|
|
|
722
714
|
...availableType.option
|
|
723
715
|
];
|
|
724
716
|
|
|
725
|
-
|
|
726
|
-
|
|
717
|
+
// `record`/`tuple` are not shown as their own pull-down entries; they render
|
|
718
|
+
// as `Object`/`Array` (their schema, incl. child descriptions, informs the
|
|
719
|
+
// layout — see `arrayType.js`).
|
|
720
|
+
const schemaContentLabel = resolveSchemaMeta(schemaContent).label;
|
|
721
|
+
if (schemaContentLabel) {
|
|
722
|
+
optInfo[0] = `${optInfo[0]} (${schemaContentLabel})`;
|
|
727
723
|
}
|
|
728
724
|
|
|
729
725
|
optInfo[1] = {
|
|
@@ -786,6 +782,10 @@ class Types {
|
|
|
786
782
|
? typeObj.viewUI(arg)
|
|
787
783
|
: typeObj.editUI(arg))
|
|
788
784
|
));
|
|
785
|
+
if (specificSchemaObject) {
|
|
786
|
+
this.schemasForRoots.set(root, specificSchemaObject);
|
|
787
|
+
}
|
|
788
|
+
appendSchemaMeta(root, specificSchemaObject);
|
|
789
789
|
if (!readonly && typeObj.validate) {
|
|
790
790
|
const formControl = typeObj.getInput({root});
|
|
791
791
|
formControl.addEventListener('input', () => {
|
|
@@ -817,18 +817,77 @@ class Types {
|
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
+
/**
|
|
821
|
+
* @param {{
|
|
822
|
+
* message: string|null|undefined,
|
|
823
|
+
* schema?: import('./formats/schema.js').ZodexSchema,
|
|
824
|
+
* typeSpecific?: boolean
|
|
825
|
+
* }} cfg
|
|
826
|
+
* @returns {string|null|undefined}
|
|
827
|
+
*/
|
|
828
|
+
getValidationMessage ({message, schema, typeSpecific = false}) {
|
|
829
|
+
if (!message) {
|
|
830
|
+
return message;
|
|
831
|
+
}
|
|
832
|
+
const schemaError = schema?.error;
|
|
833
|
+
return typeof schemaError === 'string' && this.useZodexyErrorMessages &&
|
|
834
|
+
(!typeSpecific || this.useZodexyErrorMessagesInTypes)
|
|
835
|
+
? schemaError
|
|
836
|
+
: message;
|
|
837
|
+
}
|
|
838
|
+
|
|
820
839
|
/** @type {Validate} */
|
|
821
840
|
validate ({type, root, topRoot, avoidReport}) {
|
|
841
|
+
if (Types.getTypeForRoot(root) !== type) {
|
|
842
|
+
return true;
|
|
843
|
+
}
|
|
822
844
|
const typeObj = /** @type {TypeObject} */ (this.availableTypes[type]);
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
845
|
+
const typeValidation = typeObj.validate
|
|
846
|
+
? typeObj.validate({root, topRoot})
|
|
847
|
+
: {valid: true, message: undefined};
|
|
848
|
+
const schemaObject = this.schemasForRoots.get(root);
|
|
849
|
+
let value;
|
|
850
|
+
let valueReady = true;
|
|
851
|
+
try {
|
|
852
|
+
value = typeObj.getValue?.({
|
|
853
|
+
root,
|
|
854
|
+
stateObj: {types: this, formats: this.formats}
|
|
855
|
+
});
|
|
856
|
+
} catch (error) {
|
|
857
|
+
const errorMessage = error && typeof error === 'object' &&
|
|
858
|
+
'message' in error
|
|
859
|
+
? error.message
|
|
860
|
+
: undefined;
|
|
861
|
+
if (errorMessage !== 'Not yet instantiated') {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
valueReady = false;
|
|
865
|
+
}
|
|
866
|
+
const schemaFormat = this.formats.getAvailableFormat('schema');
|
|
867
|
+
const schemaValidation = valueReady && schemaObject &&
|
|
868
|
+
(schemaObject.type === 'templateLiteral' ||
|
|
869
|
+
schemaFormat.isValueValidationRequired?.(schemaObject))
|
|
870
|
+
? schemaFormat.validateValue?.(
|
|
871
|
+
this, schemaObject, value
|
|
872
|
+
) ?? {valid: true, message: undefined}
|
|
873
|
+
: {valid: true, message: undefined};
|
|
874
|
+
const valid = typeValidation.valid && schemaValidation.valid;
|
|
875
|
+
const message = typeValidation.valid
|
|
876
|
+
? schemaValidation.message
|
|
877
|
+
: typeValidation.message;
|
|
878
|
+
const formControl = typeObj.getInput?.({root});
|
|
879
|
+
if (formControl) {
|
|
880
|
+
const validationMessage = this.getValidationMessage({
|
|
881
|
+
message: message || 'Invalid',
|
|
882
|
+
schema: schemaValidation.valid
|
|
883
|
+
? schemaObject
|
|
884
|
+
: schemaValidation.schema ?? schemaObject
|
|
885
|
+
});
|
|
827
886
|
formControl.setCustomValidity(
|
|
828
887
|
valid
|
|
829
888
|
? ''
|
|
830
889
|
/* istanbul ignore next -- Should always have a message */
|
|
831
|
-
: (
|
|
890
|
+
: (validationMessage || 'Invalid')
|
|
832
891
|
);
|
|
833
892
|
|
|
834
893
|
// We don't want a focus as `reportValidity` does in at least
|
|
@@ -837,17 +896,22 @@ class Types {
|
|
|
837
896
|
if (!avoidReport) {
|
|
838
897
|
formControl.reportValidity();
|
|
839
898
|
}
|
|
840
|
-
return valid;
|
|
841
899
|
}
|
|
842
|
-
return
|
|
900
|
+
return valid;
|
|
843
901
|
}
|
|
844
902
|
|
|
845
903
|
/** @type {SetValue} */
|
|
846
904
|
setValue ({type, root, value}) {
|
|
905
|
+
if (Types.getTypeForRoot(root) !== type) {
|
|
906
|
+
return undefined;
|
|
907
|
+
}
|
|
847
908
|
const typeObj = /** @type {TypeObject} */ (this.availableTypes[type]);
|
|
848
909
|
if (typeObj.setValue) {
|
|
849
|
-
|
|
910
|
+
// May return a promise for types whose UI building is deferred; callers
|
|
911
|
+
// that need the built DOM (e.g. a subsequent `validate`) can await it.
|
|
912
|
+
return typeObj.setValue({root, value});
|
|
850
913
|
}
|
|
914
|
+
return undefined;
|
|
851
915
|
}
|
|
852
916
|
|
|
853
917
|
// Todo (low): Should really add real parser
|
|
@@ -890,9 +954,6 @@ class Types {
|
|
|
890
954
|
reduced
|
|
891
955
|
).map((str) => escapeRegex(str)).join('|');
|
|
892
956
|
|
|
893
|
-
/**
|
|
894
|
-
* @type {RegExpMatchArray|boolean|null}
|
|
895
|
-
*/
|
|
896
957
|
let match = null;
|
|
897
958
|
let found = allowedTypeObjs.find(([/* _type */, typObj]) => {
|
|
898
959
|
const typeObj = /** @type {TypeObject} */ (typObj);
|
|
@@ -991,7 +1052,7 @@ class Types {
|
|
|
991
1052
|
// allow `arbitraryJS` values; should also be using
|
|
992
1053
|
// `structuredCloningFixed`
|
|
993
1054
|
const typeson = new Typeson().register(
|
|
994
|
-
|
|
1055
|
+
structuredCloningForStorage
|
|
995
1056
|
);
|
|
996
1057
|
try {
|
|
997
1058
|
const topRoot = typeson.revive(value);
|
|
@@ -1003,10 +1064,9 @@ class Types {
|
|
|
1003
1064
|
// @ts-expect-error Reference method exists
|
|
1004
1065
|
const val = typeObject.resolveReference(path, topRoot);
|
|
1005
1066
|
const basicType = getJSONType(val);
|
|
1006
|
-
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
1007
1067
|
/* istanbul ignore else -- Successful reference always an object/array? */
|
|
1008
1068
|
if (
|
|
1009
|
-
['array', 'object'].includes(type)
|
|
1069
|
+
basicType === type && ['array', 'object'].includes(type)
|
|
1010
1070
|
) {
|
|
1011
1071
|
/** @type {{[key: string]: any}} */ (
|
|
1012
1072
|
parent
|
|
@@ -1079,7 +1139,7 @@ Types.validValuesSet = ({form, typeNamespace, keySelectClass}) => {
|
|
|
1079
1139
|
* @returns {string}
|
|
1080
1140
|
*/
|
|
1081
1141
|
export function escapeRegex (str) {
|
|
1082
|
-
return
|
|
1142
|
+
return str.
|
|
1083
1143
|
replaceAll(/[.\\+*?^[\]$(){}=!<>|:-]/gu, String.raw`\$&`);
|
|
1084
1144
|
}
|
|
1085
1145
|
|
package/src/utils/FileList.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
class FileList {
|
|
8
8
|
/**
|
|
9
9
|
* Set private properties and length.
|
|
10
|
+
* @param {File[]} files Files to include.
|
|
10
11
|
*/
|
|
11
|
-
constructor () {
|
|
12
|
-
|
|
13
|
-
this._files = arguments[0];
|
|
12
|
+
constructor (files) {
|
|
13
|
+
this._files = files;
|
|
14
14
|
this.length = this._files.length;
|
|
15
15
|
}
|
|
16
16
|
/**
|
package/src/utils/dialogs.js
CHANGED
|
@@ -81,9 +81,8 @@ const dialogs = {
|
|
|
81
81
|
if (cancel) {
|
|
82
82
|
if (
|
|
83
83
|
cancel.call(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
) === false
|
|
84
|
+
this, {e, dialog}
|
|
85
|
+
)
|
|
87
86
|
) {
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
@@ -111,8 +110,7 @@ const dialogs = {
|
|
|
111
110
|
class: submitClass,
|
|
112
111
|
$on: {
|
|
113
112
|
click (e) {
|
|
114
|
-
|
|
115
|
-
submit.call(this, {e: /** @type {Event} */ (e), dialog});
|
|
113
|
+
submit.call(this, {e, dialog});
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
116
|
}, [submitText ?? this.localeStrings.submit]),
|
|
@@ -128,12 +126,12 @@ const dialogs = {
|
|
|
128
126
|
* @returns {Promise<void>}
|
|
129
127
|
*/
|
|
130
128
|
alert (message) {
|
|
131
|
-
message = typeof message === '
|
|
129
|
+
message = message && typeof message === 'object' ? message : {message};
|
|
132
130
|
const {submitClass = 'submit'} = message;
|
|
133
131
|
const {message: outputMessage} = message;
|
|
134
132
|
return new Promise((resolve /* , _reject */) => {
|
|
135
133
|
const dialog = jml('dialog', [
|
|
136
|
-
|
|
134
|
+
outputMessage,
|
|
137
135
|
['br'], ['br'],
|
|
138
136
|
['div', {class: submitClass}, [
|
|
139
137
|
['button', {$on: {click () {
|
package/src/utils/jsonPointer.js
CHANGED
|
@@ -49,7 +49,7 @@ const getJSONPointerParts = (path) => {
|
|
|
49
49
|
* @returns {ArbitraryObject|string}
|
|
50
50
|
*/
|
|
51
51
|
const reduceJSONPointerParts = (obj, pathPart) => {
|
|
52
|
-
if (!(pathPart
|
|
52
|
+
if (!(Object.hasOwn(obj, pathPart))) {
|
|
53
53
|
throw new TypeError('Path part not found in object');
|
|
54
54
|
}
|
|
55
55
|
obj = obj[pathPart];
|
package/src/utils/media.js
CHANGED
|
@@ -72,6 +72,7 @@ function visualize (stream, canvas) {
|
|
|
72
72
|
* @returns {Promise<MediaStream|null>}
|
|
73
73
|
*/
|
|
74
74
|
async function getUserMedia (constraints) {
|
|
75
|
+
// eslint-disable-next-line no-useless-assignment -- ESLint bug
|
|
75
76
|
let stream = null;
|
|
76
77
|
try {
|
|
77
78
|
stream = await navigator.mediaDevices.getUserMedia(constraints);
|