Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(common): loosen .keyman-touch-layout schema layer id requirements #243

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions schemas/keyman-touch-layout/2.1.1/keyman-touch-layout.clean.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"$schema": "http://json-schema.org/schema#",
"$ref": "#/definitions/touch-layout",
"$comment": "Version: 16.0",
"description": "A Keyman Touch Layout file, per version 16.0, clean spec, no legacy data or types",

"definitions": {
"touch-layout": {
"type": "object",
"properties": {
"tablet": { "$ref": "#/definitions/platform" },
"phone": { "$ref": "#/definitions/platform" },
"desktop": { "$ref": "#/definitions/platform" }
},
"minProperties": 1,
"additionalProperties": false
},

"platform": {
"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
},

"layers": {
"type": "array",
"items": { "$ref": "#/definitions/layer" },
"minItems": 1
},

"layer": {
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/layer-id" },
"row": { "$ref": "#/definitions/rows" }
},
"required": ["id", "row"],
"additionalProperties": false
},

"layer-id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$"
},

"rows": {
"type": "array",
"items": { "$ref": "#/definitions/row" },
"minItems": 1
},

"row": {
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/row-id" },
"key": { "$ref": "#/definitions/keys" }
},
"required": ["id", "key"],
"additionalProperties": false
},

"row-id": {
"type": "integer",
"minimum": 0,
"maximum": 100
},

"keys": {
"type": "array",
"items": { "$ref": "#/definitions/key" },
"minItems": 1
},

"key": {
"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
},

"key-id": {
"type": "string",
"pattern": "^[TKUtku]_[a-zA-Z0-9_]+$"
},

"key-sp": {
"type": "integer",
"enum": [0, 1, 2, 8, 9, 10]
},

"key-pad": {
"type": "number",
"minimum": 0,
"maximum": 100000
},

"key-width": {
"type": "number",
"minimum": 0,
"maximum": 100000
},

"subkeys": {
"type": "array",
"items": { "$ref": "#/definitions/subkey" },
"minItems": 1
},

"subkey": {
"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
},

"flick": {
"type": "object",
"patternProperties": {
"^(n|s|e|w|ne|nw|se|sw)$": { "$ref": "#/definitions/subkey" }
},
"minProperties": 1,
"additionalProperties": false
},

"font-spec": {
"type": "string"
},

"fontsize-spec": {
"type": "string"
}
}
}
157 changes: 157 additions & 0 deletions schemas/keyman-touch-layout/2.1.1/keyman-touch-layout.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"$schema": "http://json-schema.org/schema#",
"$ref": "#/definitions/touch-layout",
"$comment": "Version: 16.0",
"description": "A Keyman Touch Layout file, per version 16.0, loose specification that allows for legacy such as numbers as strings",

"definitions": {
"touch-layout": {
"type": "object",
"properties": {
"tablet": { "$ref": "#/definitions/platform" },
"phone": { "$ref": "#/definitions/platform" },
"desktop": { "$ref": "#/definitions/platform" }
}
},

"platform": {
"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
},

"layers": {
"type": "array",
"items": { "$ref": "#/definitions/layer" }
},

"layer": {
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/layer-id" },
"row": { "$ref": "#/definitions/rows" }
},
"required": ["id", "row"],
"additionalProperties": false
},

"layer-id": {
"type": "string",
"pattern": "^[\\S]+$"
},

"rows": {
"type": "array",
"items": { "$ref": "#/definitions/row" }
},

"row": {
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/row-id" },
"key": { "$ref": "#/definitions/keys" }
},
"required": ["id", "key"],
"additionalProperties": false
},

"row-id": {
"oneOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 100
},
{
"type": "string",
"pattern": "^[0-9]+$"
}
]
},

"keys": {
"type": "array",
"items": { "$ref": "#/definitions/key" }
},

"key": {
"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
},

"numeric": {
"oneOf": [
{ "type": "string", "pattern": "^[0-9]+(\\.?[0-9]*)$|^$" },
{ "type": "number" }
]
},

"key-id": {
"type": "string",
"pattern": "^[TKUtku]_[a-zA-Z0-9_]+$|^$"
},

"subkeys": {
"type": "array",
"items": { "$ref": "#/definitions/subkey" }
},

"subkey": {
"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
},

"flick": {
"type": "object",
"patternProperties": {
"^(n|s|e|w|ne|nw|se|sw)$": { "$ref": "#/definitions/subkey" }
},
"additionalProperties": false
},

"font-spec": {
"type": "string"
},

"fontsize-spec": {
"type": "string"
}
}
}
17 changes: 11 additions & 6 deletions schemas/keyman-touch-layout/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# keyman-touch-layout

Documentation at https://help.keyman.com/developer/...TODO...
Documentation at https://github.com/keymanapp/keyman/tree/master/common/schemas/keyman-touch-layout/README.md

* Primary version:
* https://github.com/keymanapp/keyman/tree/master/common/schemas/keyman-touch-layout
* Deployed to:
* N/A
* https://github.com/keymanapp/api.keyman.com/tree/master/schemas/keyman-touch-layout

# .keyman-touch-layout File Format

Expand Down Expand Up @@ -117,7 +117,8 @@ affect the modifiers in any key events generated by keys on the layer.

* `id`

: the string identifier of the layer. Required. There are a number of reserved
: the string identifier of the layer. Required. This should use alphanumeric,
hyphen, and underscore characters only. There are a number of reserved
identifiers. The following identifiers are recommended for use:

id | Modifier | Notes
Expand Down Expand Up @@ -405,9 +406,9 @@ and `width`.
user longpresses the base key without moving their finger. Only one subkey
should be default; if multiple subkeys have the default field set, then
behaviour is undefined. Given that cancel is not the preferred default
action for a longpress, the user can cancel the longpress default by
sliding outside the 'acceptance' area -- e.g. south of the key cap,
which would then unhighlight the default and indicate visually that
action for a longpress, the user can cancel the longpress default by
sliding outside the 'acceptance' area -- e.g. south of the key cap,
which would then unhighlight the default and indicate visually that
no output would occur when they release their finger.

## `flick` object
Expand Down Expand Up @@ -456,6 +457,10 @@ string") into the appropriate spec format.

# .keyman-touch-layout version history

## 2024-02-23 2.1.1 stable
* Loosen `layer.id` requirements to any non-whitespace characters, recommend
only alphanumeric, -, _. clean spec enforces this recommendation.

## 2023-08-08 2.1 stable
* Add support for default on longpress (sk) keys. Aligns with Keyman 17.0.

Expand Down
Loading