UNPKG

@keymanapp/common-types

Version:

Keyman Developer keyboard file types

676 lines (674 loc) 75.2 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3b0b36e6-39c2-543d-9b0e-24fd344b9af5")}catch(e){}}(); var __getOwnPropNames = Object.getOwnPropertyNames; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; // obj/schemas/keyman-touch-layout.clean.spec.validator.cjs var require_keyman_touch_layout_clean_spec_validator = __commonJS({ "obj/schemas/keyman-touch-layout.clean.spec.validator.cjs"(exports, module) { module.exports = validate20; module.exports.default = validate20; var schema24 = { "type": "object", "properties": { "font": { "$ref": "#/definitions/font-spec" }, "fontsize": { "$ref": "#/definitions/fontsize-spec" }, "layer": { "$ref": "#/definitions/layers" }, "displayUnderlying": { "type": "boolean" }, "defaultHint": { "type": "string", "enum": ["none", "dot", "longpress", "multitap", "flick", "flick-n", "flick-ne", "flick-e", "flick-se", "flick-s", "flick-sw", "flick-w", "flick-nw"] } }, "required": ["layer"], "additionalProperties": false }; var pattern0 = new RegExp("^[a-zA-Z0-9_-]+$", "u"); var schema34 = { "type": "object", "properties": { "id": { "$ref": "#/definitions/key-id" }, "text": { "type": "string" }, "layer": { "$ref": "#/definitions/layer-id" }, "nextlayer": { "$ref": "#/definitions/layer-id" }, "font": { "$ref": "#/definitions/font-spec" }, "fontsize": { "$ref": "#/definitions/fontsize-spec" }, "sp": { "$ref": "#/definitions/key-sp" }, "pad": { "$ref": "#/definitions/key-pad" }, "width": { "$ref": "#/definitions/key-width" }, "sk": { "$ref": "#/definitions/subkeys" }, "flick": { "$ref": "#/definitions/flick" }, "multitap": { "$ref": "#/definitions/subkeys" }, "hint": { "type": "string" } }, "anyOf": [{ "required": ["id"] }, { "required": ["sp"] }, { "required": ["sk"] }, { "required": ["flick"] }, { "required": ["multitap"] }], "additionalProperties": false }; var schema40 = { "type": "integer", "enum": [0, 1, 2, 8, 9, 10] }; var func4 = Object.prototype.hasOwnProperty; var pattern1 = new RegExp("^[TKUtku]_[a-zA-Z0-9_]+$", "u"); var schema44 = { "type": "object", "properties": { "id": { "$ref": "#/definitions/key-id" }, "text": { "type": "string" }, "layer": { "$ref": "#/definitions/layer-id" }, "nextlayer": { "$ref": "#/definitions/layer-id" }, "font": { "$ref": "#/definitions/font-spec" }, "fontsize": { "$ref": "#/definitions/fontsize-spec" }, "sp": { "$ref": "#/definitions/key-sp" }, "pad": { "$ref": "#/definitions/key-pad" }, "width": { "$ref": "#/definitions/key-width" } }, "required": ["id"], "additionalProperties": false }; function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { let missing0; if (data.id === void 0 && (missing0 = "id")) { validate30.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }]; return false; } else { const _errs1 = errors; for (const key0 in data) { if (!func4.call(schema44.properties, key0)) { validate30.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { if (data.id !== void 0) { let data0 = data.id; const _errs2 = errors; const _errs3 = errors; if (errors === _errs3) { if (typeof data0 === "string") { if (!pattern1.test(data0)) { validate30.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/definitions/key-id/pattern", keyword: "pattern", params: { pattern: "^[TKUtku]_[a-zA-Z0-9_]+$" }, message: 'must match pattern "^[TKUtku]_[a-zA-Z0-9_]+$"' }]; return false; } } else { validate30.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/definitions/key-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.text !== void 0) { const _errs5 = errors; if (typeof data.text !== "string") { validate30.errors = [{ instancePath: instancePath + "/text", schemaPath: "#/properties/text/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs5 === errors; } else { var valid0 = true; } if (valid0) { if (data.layer !== void 0) { let data2 = data.layer; const _errs7 = errors; const _errs8 = errors; if (errors === _errs8) { if (typeof data2 === "string") { if (!pattern0.test(data2)) { validate30.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[a-zA-Z0-9_-]+$" }, message: 'must match pattern "^[a-zA-Z0-9_-]+$"' }]; return false; } } else { validate30.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/definitions/layer-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid0 = _errs7 === errors; } else { var valid0 = true; } if (valid0) { if (data.nextlayer !== void 0) { let data3 = data.nextlayer; const _errs10 = errors; const _errs11 = errors; if (errors === _errs11) { if (typeof data3 === "string") { if (!pattern0.test(data3)) { validate30.errors = [{ instancePath: instancePath + "/nextlayer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[a-zA-Z0-9_-]+$" }, message: 'must match pattern "^[a-zA-Z0-9_-]+$"' }]; return false; } } else { validate30.errors = [{ instancePath: instancePath + "/nextlayer", schemaPath: "#/definitions/layer-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid0 = _errs10 === errors; } else { var valid0 = true; } if (valid0) { if (data.font !== void 0) { const _errs13 = errors; if (typeof data.font !== "string") { validate30.errors = [{ instancePath: instancePath + "/font", schemaPath: "#/definitions/font-spec/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs13 === errors; } else { var valid0 = true; } if (valid0) { if (data.fontsize !== void 0) { const _errs16 = errors; if (typeof data.fontsize !== "string") { validate30.errors = [{ instancePath: instancePath + "/fontsize", schemaPath: "#/definitions/fontsize-spec/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs16 === errors; } else { var valid0 = true; } if (valid0) { if (data.sp !== void 0) { let data6 = data.sp; const _errs19 = errors; if (!(typeof data6 == "number" && (!(data6 % 1) && !isNaN(data6)) && isFinite(data6))) { validate30.errors = [{ instancePath: instancePath + "/sp", schemaPath: "#/definitions/key-sp/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }]; return false; } if (!(data6 === 0 || data6 === 1 || data6 === 2 || data6 === 8 || data6 === 9 || data6 === 10)) { validate30.errors = [{ instancePath: instancePath + "/sp", schemaPath: "#/definitions/key-sp/enum", keyword: "enum", params: { allowedValues: schema40.enum }, message: "must be equal to one of the allowed values" }]; return false; } var valid0 = _errs19 === errors; } else { var valid0 = true; } if (valid0) { if (data.pad !== void 0) { let data7 = data.pad; const _errs22 = errors; const _errs23 = errors; if (errors === _errs23) { if (typeof data7 == "number" && isFinite(data7)) { if (data7 > 1e5 || isNaN(data7)) { validate30.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/maximum", keyword: "maximum", params: { comparison: "<=", limit: 1e5 }, message: "must be <= 100000" }]; return false; } else { if (data7 < 0 || isNaN(data7)) { validate30.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }]; return false; } } } else { validate30.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } } var valid0 = _errs22 === errors; } else { var valid0 = true; } if (valid0) { if (data.width !== void 0) { let data8 = data.width; const _errs25 = errors; const _errs26 = errors; if (errors === _errs26) { if (typeof data8 == "number" && isFinite(data8)) { if (data8 > 1e5 || isNaN(data8)) { validate30.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/maximum", keyword: "maximum", params: { comparison: "<=", limit: 1e5 }, message: "must be <= 100000" }]; return false; } else { if (data8 < 0 || isNaN(data8)) { validate30.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }]; return false; } } } else { validate30.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } } var valid0 = _errs25 === errors; } else { var valid0 = true; } } } } } } } } } } } } else { validate30.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate30.errors = vErrors; return errors === 0; } function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (Array.isArray(data)) { if (data.length < 1) { validate29.errors = [{ instancePath, schemaPath: "#/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }]; return false; } else { var valid0 = true; const len0 = data.length; for (let i0 = 0; i0 < len0; i0++) { const _errs1 = errors; if (!validate30(data[i0], { instancePath: instancePath + "/" + i0, parentData: data, parentDataProperty: i0, rootData })) { vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors); errors = vErrors.length; } var valid0 = _errs1 === errors; if (!valid0) { break; } } } } else { validate29.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "array" }, message: "must be array" }]; return false; } } validate29.errors = vErrors; return errors === 0; } var pattern7 = new RegExp("^(n|s|e|w|ne|nw|se|sw)$", "u"); function validate33(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { if (Object.keys(data).length < 1) { validate33.errors = [{ instancePath, schemaPath: "#/minProperties", keyword: "minProperties", params: { limit: 1 }, message: "must NOT have fewer than 1 properties" }]; return false; } else { const _errs1 = errors; for (const key0 in data) { if (!pattern7.test(key0)) { validate33.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs1 === errors) { var valid0 = true; for (const key1 in data) { if (pattern7.test(key1)) { const _errs2 = errors; if (!validate30(data[key1], { instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: data, parentDataProperty: key1, rootData })) { vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors); errors = vErrors.length; } var valid0 = _errs2 === errors; if (!valid0) { break; } } } } } } else { validate33.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false; } } validate33.errors = vErrors; return errors === 0; } function validate28(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs1 = errors; let valid0 = false; const _errs2 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { let missing0; if (data.id === void 0 && (missing0 = "id")) { const err0 = { instancePath, schemaPath: "#/anyOf/0/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }; if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } errors++; } } var _valid0 = _errs2 === errors; valid0 = valid0 || _valid0; if (!valid0) { const _errs3 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { let missing1; if (data.sp === void 0 && (missing1 = "sp")) { const err1 = { instancePath, schemaPath: "#/anyOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }; if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } errors++; } } var _valid0 = _errs3 === errors; valid0 = valid0 || _valid0; if (!valid0) { const _errs4 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { let missing2; if (data.sk === void 0 && (missing2 = "sk")) { const err2 = { instancePath, schemaPath: "#/anyOf/2/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }; if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } errors++; } } var _valid0 = _errs4 === errors; valid0 = valid0 || _valid0; if (!valid0) { const _errs5 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { let missing3; if (data.flick === void 0 && (missing3 = "flick")) { const err3 = { instancePath, schemaPath: "#/anyOf/3/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }; if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } errors++; } } var _valid0 = _errs5 === errors; valid0 = valid0 || _valid0; if (!valid0) { const _errs6 = errors; if (data && typeof data == "object" && !Array.isArray(data)) { let missing4; if (data.multitap === void 0 && (missing4 = "multitap")) { const err4 = { instancePath, schemaPath: "#/anyOf/4/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }; if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } errors++; } } var _valid0 = _errs6 === errors; valid0 = valid0 || _valid0; } } } } if (!valid0) { const err5 = { instancePath, schemaPath: "#/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" }; if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } errors++; validate28.errors = vErrors; return false; } else { errors = _errs1; if (vErrors !== null) { if (_errs1) { vErrors.length = _errs1; } else { vErrors = null; } } } if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { const _errs7 = errors; for (const key0 in data) { if (!func4.call(schema34.properties, key0)) { validate28.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }]; return false; break; } } if (_errs7 === errors) { if (data.id !== void 0) { let data0 = data.id; const _errs8 = errors; const _errs9 = errors; if (errors === _errs9) { if (typeof data0 === "string") { if (!pattern1.test(data0)) { validate28.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/definitions/key-id/pattern", keyword: "pattern", params: { pattern: "^[TKUtku]_[a-zA-Z0-9_]+$" }, message: 'must match pattern "^[TKUtku]_[a-zA-Z0-9_]+$"' }]; return false; } } else { validate28.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/definitions/key-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid1 = _errs8 === errors; } else { var valid1 = true; } if (valid1) { if (data.text !== void 0) { const _errs11 = errors; if (typeof data.text !== "string") { validate28.errors = [{ instancePath: instancePath + "/text", schemaPath: "#/properties/text/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs11 === errors; } else { var valid1 = true; } if (valid1) { if (data.layer !== void 0) { let data2 = data.layer; const _errs13 = errors; const _errs14 = errors; if (errors === _errs14) { if (typeof data2 === "string") { if (!pattern0.test(data2)) { validate28.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[a-zA-Z0-9_-]+$" }, message: 'must match pattern "^[a-zA-Z0-9_-]+$"' }]; return false; } } else { validate28.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/definitions/layer-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid1 = _errs13 === errors; } else { var valid1 = true; } if (valid1) { if (data.nextlayer !== void 0) { let data3 = data.nextlayer; const _errs16 = errors; const _errs17 = errors; if (errors === _errs17) { if (typeof data3 === "string") { if (!pattern0.test(data3)) { validate28.errors = [{ instancePath: instancePath + "/nextlayer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[a-zA-Z0-9_-]+$" }, message: 'must match pattern "^[a-zA-Z0-9_-]+$"' }]; return false; } } else { validate28.errors = [{ instancePath: instancePath + "/nextlayer", schemaPath: "#/definitions/layer-id/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } } var valid1 = _errs16 === errors; } else { var valid1 = true; } if (valid1) { if (data.font !== void 0) { const _errs19 = errors; if (typeof data.font !== "string") { validate28.errors = [{ instancePath: instancePath + "/font", schemaPath: "#/definitions/font-spec/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs19 === errors; } else { var valid1 = true; } if (valid1) { if (data.fontsize !== void 0) { const _errs22 = errors; if (typeof data.fontsize !== "string") { validate28.errors = [{ instancePath: instancePath + "/fontsize", schemaPath: "#/definitions/fontsize-spec/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs22 === errors; } else { var valid1 = true; } if (valid1) { if (data.sp !== void 0) { let data6 = data.sp; const _errs25 = errors; if (!(typeof data6 == "number" && (!(data6 % 1) && !isNaN(data6)) && isFinite(data6))) { validate28.errors = [{ instancePath: instancePath + "/sp", schemaPath: "#/definitions/key-sp/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }]; return false; } if (!(data6 === 0 || data6 === 1 || data6 === 2 || data6 === 8 || data6 === 9 || data6 === 10)) { validate28.errors = [{ instancePath: instancePath + "/sp", schemaPath: "#/definitions/key-sp/enum", keyword: "enum", params: { allowedValues: schema40.enum }, message: "must be equal to one of the allowed values" }]; return false; } var valid1 = _errs25 === errors; } else { var valid1 = true; } if (valid1) { if (data.pad !== void 0) { let data7 = data.pad; const _errs28 = errors; const _errs29 = errors; if (errors === _errs29) { if (typeof data7 == "number" && isFinite(data7)) { if (data7 > 1e5 || isNaN(data7)) { validate28.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/maximum", keyword: "maximum", params: { comparison: "<=", limit: 1e5 }, message: "must be <= 100000" }]; return false; } else { if (data7 < 0 || isNaN(data7)) { validate28.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }]; return false; } } } else { validate28.errors = [{ instancePath: instancePath + "/pad", schemaPath: "#/definitions/key-pad/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } } var valid1 = _errs28 === errors; } else { var valid1 = true; } if (valid1) { if (data.width !== void 0) { let data8 = data.width; const _errs31 = errors; const _errs32 = errors; if (errors === _errs32) { if (typeof data8 == "number" && isFinite(data8)) { if (data8 > 1e5 || isNaN(data8)) { validate28.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/maximum", keyword: "maximum", params: { comparison: "<=", limit: 1e5 }, message: "must be <= 100000" }]; return false; } else { if (data8 < 0 || isNaN(data8)) { validate28.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }]; return false; } } } else { validate28.errors = [{ instancePath: instancePath + "/width", schemaPath: "#/definitions/key-width/type", keyword: "type", params: { type: "number" }, message: "must be number" }]; return false; } } var valid1 = _errs31 === errors; } else { var valid1 = true; } if (valid1) { if (data.sk !== void 0) { const _errs34 = errors; if (!validate29(data.sk, { instancePath: instancePath + "/sk", parentData: data, parentDataProperty: "sk", rootData })) { vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors); errors = vErrors.length; } var valid1 = _errs34 === errors; } else { var valid1 = true; } if (valid1) { if (data.flick !== void 0) { const _errs35 = errors; if (!validate33(data.flick, { instancePath: instancePath + "/flick", parentData: data, parentDataProperty: "flick", rootData })) { vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors); errors = vErrors.length; } var valid1 = _errs35 === errors; } else { var valid1 = true; } if (valid1) { if (data.multitap !== void 0) { const _errs36 = errors; if (!validate29(data.multitap, { instancePath: instancePath + "/multitap", parentData: data, parentDataProperty: "multitap", rootData })) { vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors); errors = vErrors.length; } var valid1 = _errs36 === errors; } else { var valid1 = true; } if (valid1) { if (data.hint !== void 0) { const _errs37 = errors; if (typeof data.hint !== "string") { validate28.errors = [{ instancePath: instancePath + "/hint", schemaPath: "#/properties/hint/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid1 = _errs37 === errors; } else { var valid1 = true; } } } } } } } } } } } } } } } else { validate28.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }]; return false;