UNPKG

@keymanapp/common-types

Version:

Keyman Developer keyboard file types

662 lines (661 loc) 104 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]="ec131f0a-58a1-5690-bac7-3b601effa26e")}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.spec.validator.cjs var require_keyman_touch_layout_spec_validator = __commonJS({ "obj/schemas/keyman-touch-layout.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("^[\\S]+$", "u"); var pattern1 = new RegExp("^[0-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" }, "fontsize": { "$ref": "#/definitions/fontsize-spec" }, "font": { "$ref": "#/definitions/font-spec" }, "dk": { "type": "string" }, "sp": { "$ref": "#/definitions/numeric" }, "pad": { "$ref": "#/definitions/numeric" }, "width": { "$ref": "#/definitions/numeric" }, "sk": { "$ref": "#/definitions/subkeys" }, "flick": { "$ref": "#/definitions/flick" }, "multitap": { "$ref": "#/definitions/subkeys" }, "hint": { "type": "string" } }, "additionalProperties": false }; var func4 = Object.prototype.hasOwnProperty; var pattern2 = new RegExp("^[TKUtku]_[a-zA-Z0-9_]+$|^$", "u"); var pattern5 = new RegExp("^[0-9]+(\\.?[0-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" }, "sp": { "$ref": "#/definitions/numeric" }, "pad": { "$ref": "#/definitions/numeric" }, "width": { "$ref": "#/definitions/numeric" }, "fontsize": { "$ref": "#/definitions/fontsize-spec" }, "font": { "$ref": "#/definitions/font-spec" }, "dk": { "type": "string" }, "default": { "type": "boolean" } }, "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 (!pattern2.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: "^[\\S]+$" }, message: 'must match pattern "^[\\S]+$"' }]; 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: "^[\\S]+$" }, message: 'must match pattern "^[\\S]+$"' }]; 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.sp !== void 0) { let data4 = data.sp; const _errs13 = errors; const _errs15 = errors; let valid5 = false; let passing0 = null; const _errs16 = errors; if (errors === _errs16) { if (typeof data4 === "string") { if (!pattern5.test(data4)) { const err0 = { instancePath: instancePath + "/sp", schemaPath: "#/definitions/numeric/oneOf/0/pattern", keyword: "pattern", params: { pattern: "^[0-9]+(\\.?[0-9]*)$|^$" }, message: 'must match pattern "^[0-9]+(\\.?[0-9]*)$|^$"' }; if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } errors++; } } else { const err1 = { instancePath: instancePath + "/sp", schemaPath: "#/definitions/numeric/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" }; if (vErrors === null) { vErrors = [err1]; } else { vErrors.push(err1); } errors++; } } var _valid0 = _errs16 === errors; if (_valid0) { valid5 = true; passing0 = 0; } const _errs18 = errors; if (!(typeof data4 == "number" && isFinite(data4))) { const err2 = { instancePath: instancePath + "/sp", schemaPath: "#/definitions/numeric/oneOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" }; if (vErrors === null) { vErrors = [err2]; } else { vErrors.push(err2); } errors++; } var _valid0 = _errs18 === errors; if (_valid0 && valid5) { valid5 = false; passing0 = [passing0, 1]; } else { if (_valid0) { valid5 = true; passing0 = 1; } } if (!valid5) { const err3 = { instancePath: instancePath + "/sp", schemaPath: "#/definitions/numeric/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" }; if (vErrors === null) { vErrors = [err3]; } else { vErrors.push(err3); } errors++; validate30.errors = vErrors; return false; } else { errors = _errs15; if (vErrors !== null) { if (_errs15) { vErrors.length = _errs15; } else { vErrors = null; } } } var valid0 = _errs13 === errors; } else { var valid0 = true; } if (valid0) { if (data.pad !== void 0) { let data5 = data.pad; const _errs20 = errors; const _errs22 = errors; let valid7 = false; let passing1 = null; const _errs23 = errors; if (errors === _errs23) { if (typeof data5 === "string") { if (!pattern5.test(data5)) { const err4 = { instancePath: instancePath + "/pad", schemaPath: "#/definitions/numeric/oneOf/0/pattern", keyword: "pattern", params: { pattern: "^[0-9]+(\\.?[0-9]*)$|^$" }, message: 'must match pattern "^[0-9]+(\\.?[0-9]*)$|^$"' }; if (vErrors === null) { vErrors = [err4]; } else { vErrors.push(err4); } errors++; } } else { const err5 = { instancePath: instancePath + "/pad", schemaPath: "#/definitions/numeric/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" }; if (vErrors === null) { vErrors = [err5]; } else { vErrors.push(err5); } errors++; } } var _valid1 = _errs23 === errors; if (_valid1) { valid7 = true; passing1 = 0; } const _errs25 = errors; if (!(typeof data5 == "number" && isFinite(data5))) { const err6 = { instancePath: instancePath + "/pad", schemaPath: "#/definitions/numeric/oneOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" }; if (vErrors === null) { vErrors = [err6]; } else { vErrors.push(err6); } errors++; } var _valid1 = _errs25 === errors; if (_valid1 && valid7) { valid7 = false; passing1 = [passing1, 1]; } else { if (_valid1) { valid7 = true; passing1 = 1; } } if (!valid7) { const err7 = { instancePath: instancePath + "/pad", schemaPath: "#/definitions/numeric/oneOf", keyword: "oneOf", params: { passingSchemas: passing1 }, message: "must match exactly one schema in oneOf" }; if (vErrors === null) { vErrors = [err7]; } else { vErrors.push(err7); } errors++; validate30.errors = vErrors; return false; } else { errors = _errs22; if (vErrors !== null) { if (_errs22) { vErrors.length = _errs22; } else { vErrors = null; } } } var valid0 = _errs20 === errors; } else { var valid0 = true; } if (valid0) { if (data.width !== void 0) { let data6 = data.width; const _errs27 = errors; const _errs29 = errors; let valid9 = false; let passing2 = null; const _errs30 = errors; if (errors === _errs30) { if (typeof data6 === "string") { if (!pattern5.test(data6)) { const err8 = { instancePath: instancePath + "/width", schemaPath: "#/definitions/numeric/oneOf/0/pattern", keyword: "pattern", params: { pattern: "^[0-9]+(\\.?[0-9]*)$|^$" }, message: 'must match pattern "^[0-9]+(\\.?[0-9]*)$|^$"' }; if (vErrors === null) { vErrors = [err8]; } else { vErrors.push(err8); } errors++; } } else { const err9 = { instancePath: instancePath + "/width", schemaPath: "#/definitions/numeric/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" }; if (vErrors === null) { vErrors = [err9]; } else { vErrors.push(err9); } errors++; } } var _valid2 = _errs30 === errors; if (_valid2) { valid9 = true; passing2 = 0; } const _errs32 = errors; if (!(typeof data6 == "number" && isFinite(data6))) { const err10 = { instancePath: instancePath + "/width", schemaPath: "#/definitions/numeric/oneOf/1/type", keyword: "type", params: { type: "number" }, message: "must be number" }; if (vErrors === null) { vErrors = [err10]; } else { vErrors.push(err10); } errors++; } var _valid2 = _errs32 === errors; if (_valid2 && valid9) { valid9 = false; passing2 = [passing2, 1]; } else { if (_valid2) { valid9 = true; passing2 = 1; } } if (!valid9) { const err11 = { instancePath: instancePath + "/width", schemaPath: "#/definitions/numeric/oneOf", keyword: "oneOf", params: { passingSchemas: passing2 }, message: "must match exactly one schema in oneOf" }; if (vErrors === null) { vErrors = [err11]; } else { vErrors.push(err11); } errors++; validate30.errors = vErrors; return false; } else { errors = _errs29; if (vErrors !== null) { if (_errs29) { vErrors.length = _errs29; } else { vErrors = null; } } } var valid0 = _errs27 === errors; } else { var valid0 = true; } if (valid0) { if (data.fontsize !== void 0) { const _errs34 = 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 = _errs34 === errors; } else { var valid0 = true; } if (valid0) { if (data.font !== void 0) { const _errs37 = 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 = _errs37 === errors; } else { var valid0 = true; } if (valid0) { if (data.dk !== void 0) { const _errs40 = errors; if (typeof data.dk !== "string") { validate30.errors = [{ instancePath: instancePath + "/dk", schemaPath: "#/properties/dk/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs40 === errors; } else { var valid0 = true; } if (valid0) { if (data.default !== void 0) { const _errs42 = errors; if (typeof data.default !== "boolean") { validate30.errors = [{ instancePath: instancePath + "/default", schemaPath: "#/properties/default/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }]; return false; } var valid0 = _errs42 === 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)) { 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 pattern14 = 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)) { const _errs1 = errors; for (const key0 in data) { if (!pattern14.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 (pattern14.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; if (errors === 0) { if (data && typeof data == "object" && !Array.isArray(data)) { const _errs1 = 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 (_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 (!pattern2.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 valid0 = _errs2 === errors; } else { var valid0 = true; } if (valid0) { if (data.text !== void 0) { const _errs5 = 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 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)) { validate28.errors = [{ instancePath: instancePath + "/layer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[\\S]+$" }, message: 'must match pattern "^[\\S]+$"' }]; 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 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)) { validate28.errors = [{ instancePath: instancePath + "/nextlayer", schemaPath: "#/definitions/layer-id/pattern", keyword: "pattern", params: { pattern: "^[\\S]+$" }, message: 'must match pattern "^[\\S]+$"' }]; 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 valid0 = _errs10 === errors; } else { var valid0 = true; } if (valid0) { if (data.fontsize !== void 0) { const _errs13 = 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 valid0 = _errs13 === errors; } else { var valid0 = true; } if (valid0) { if (data.font !== void 0) { const _errs16 = 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 valid0 = _errs16 === errors; } else { var valid0 = true; } if (valid0) { if (data.dk !== void 0) { const _errs19 = errors; if (typeof data.dk !== "string") { validate28.errors = [{ instancePath: instancePath + "/dk", schemaPath: "#/properties/dk/type", keyword: "type", params: { type: "string" }, message: "must be string" }]; return false; } var valid0 = _errs19 === errors; } else { var valid0 = true; } if (valid0) { if (data.sp !== void 0) { let data7 = data.sp; const _errs21 = errors; const _errs23 = errors; let valid7 = false; let passing0 = null; const _errs24 = errors; if (errors === _errs24) { if (typeof data7 === "string") { if (!pattern5.test(data7)) { const err0 = { instancePath: instancePath + "/sp", schemaPath: "#/definitions/numeric/oneOf/0/pattern", keyword: "pattern", params: { pattern: "^[0-9]+(\\.?[0-9]*)$|^$" }, message: 'must match pattern "^[0-9]+(\\.?[0-9]*)$|^$"' }; if (vErrors === null) { vErrors = [err0]; } else { vErrors.push(err0); } errors++; } } else { const err1 = { instancePath: instancePath + "/sp", schemaPath: