Skip to content

Commit

Permalink
CLDR-17113 kbd shuffle element deck chairs
Browse files Browse the repository at this point in the history
- longPress, multiTap now use a new keyList id
- keyList is a list of keys, has a default key
- flickSegment now uses a keyId instead of output

This means that each part of longPress, flick, and multiTap can:
- have a <display> customization
- perform a layer switch if desired

Also, document.
  • Loading branch information
srl295 committed Oct 9, 2023
1 parent 053d458 commit 24f19c8
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 58 deletions.
2 changes: 0 additions & 2 deletions common/supplemental/attributeValueValidity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,6 @@
<attributeValues dtds='ldml' elements='relativeTimePattern' attributes='count' type='localeSpecific'>pluralOrdinal</attributeValues>
<attributeValues dtds='ldml' elements='unitPattern' attributes='count' type='localeSpecific'>pluralOrdinal</attributeValues>
<attributeValues dtds='keyboard3' elements='keyboard3' attributes='locale' type='TODO'></attributeValues>
<!-- <attributeValues dtds='keyboard3' elements='map' attributes='longPress' type='TODO'></attributeValues>
<attributeValues dtds='keyboard3' elements='map' attributes='to' type='TODO'></attributeValues> -->
<attributeValues dtds='keyboard3' elements='info' attributes='name' type='TODO'></attributeValues>
<attributeValues dtds='keyboard3' elements='transform' attributes='from' type='TODO'></attributeValues>
<attributeValues dtds='keyboard3' elements='transform' attributes='to' type='TODO'></attributeValues>
Expand Down
147 changes: 116 additions & 31 deletions docs/ldml/tr35-keyboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ Currently, the following attribute values allow _UnicodeSet_ notation:

The `\u{...}` notation, a subset of hex notation, is described in [UTS #18 section 1.1](https://www.unicode.org/reports/tr18/#Hex_notation). It can refer to one or multiple individual codepoints. Currently, the following attribute values allow the `\u{...}` notation:

* `output`, `longPress`, `multiTap`, and `longPressDefault` on the `<key>` element
* `output` on the `<flickSegment>` element
* `output` on the `<key>` element
* `from` or `to` on the `<transform>` element
* `value` on the `<variable>` element
* `output` and `display` on the `<display>` element
Expand Down Expand Up @@ -333,7 +332,7 @@ This is the top level element. All other elements defined below are under this e
>
> Parents: _none_
>
> Children: [displays](#Element_displays), [import](#Element_import), [info](#Element_info), [keys](#Element_keys), [flicks](#Element_flicks), [layers](#Element_layers), [locales](#Element_locales), [settings](#Element_settings), [_special_](tr35.md#special), [transforms](#Element_transforms), [variables](#Element_variables), [version](#Element_version)
> Children: [displays](#Element_displays), [import](#Element_import), [info](#Element_info), [keys](#Element_keys), [keyLists](#Element_keyLists), [flicks](#Element_flicks), [layers](#Element_layers), [locales](#Element_locales), [settings](#Element_settings), [_special_](tr35.md#special), [transforms](#Element_transforms), [variables](#Element_variables), [version](#Element_version)
>
> Occurrence: required, single
>
Expand Down Expand Up @@ -619,9 +618,8 @@ This element defines a mapping between an abstract key and its output. This elem
id="{key id}"
flickId="{flick identifier}"
gap="true"
longPress="{long press keys}"
longPressDefault="{default longpress target}"
multiTap="{the output on subsequent taps}"
longPressKeyListId="{long press list id}"
multiTapKeyListId="{multi tap list id}"
stretch="true"
layerId="{switch layer id}"
output="{the output}"
Expand Down Expand Up @@ -661,29 +659,57 @@ _Attribute:_ `gap="true"` (optional)
<key id="mediumgap" gap="true" width="1.5"/>
```

_Attribute:_ `longPress="a b c"` (optional)
_Attribute:_ `longPressKeyListId="a b c"` (optional)

> The `longPress` attribute contains any characters that can be emitted by "long-pressing" a key, this feature is prominent in mobile devices. The possible sequences of characters that can be emitted are whitespace delimited. Control characters, combining marks and whitespace (which is intended to be a long-press option) in this attribute are escaped using the `\u{...}` notation.
> The id of a specific [keyList](#element-keylist) element, whose keys which can be emitted by "long-pressing" this key. This feature is prominent in mobile devices.
>
_Attribute:_ `longPressDefault` (optional)

> Indicates which of the `longPress` target characters is the default long-press target, which could be different than the first element. Ignored if not in the `longPress` list. Characters in this attribute can be escaped using the `\u{...}` notation.
> For example, if the `longPressDefault` is a key whose [display](#Element_displays) value is `{`, an implementation might render the key as follows:
> The list’s `defaultKeyId` attribute specifies which of the keys in the list is the default long-press target, which could be different than the first element.
>
> For example, if the `defaultKeyId` is a key whose [display](#Element_displays) value is `{`, an implementation might render the key as follows:
>
> ![keycap hint](images/keycapHint.png)
>
> _Example:_
> - pressing the `o` key will produce `o`
> - holding down the key will produce a list `ó`, `{` (where `{` is the default and produces a marker)
>
> ```xml
> <displays>
> <displays output="\m{marker}" display="{" />
> </displays>
>
> <keys>
> <key id="o" output="o" longPressKeyListId="o-list">
> <key id="o-acute" output="ó"/>
> <key id="marker" display="{"/>
> </key>
>
>
> <keyLists>
> <keyList id="o-list" defaultKeyId="open" keyIds="o-acute marker"/>
> </keyLists>
> ```
_Attribute:_ `multiTap` (optional)
> A space-delimited list of strings, where each successive element of the list is produced by the corresponding number of quick taps. In the following example, three taps on the key will produce a “c” (first tap produces “a”, two taps produce “bb” etc.).
>>
_Attribute:_ `multiTapKeyListId` (optional)
> The id of a specific [keyList](#element-keylist) element, where each successive key in the list is produced by the corresponding number of quick taps.
>
> _Example:_
> - first tap on the key will produce “a”
> - two taps will produce “bb”
> - three taps on the key will produce “c”
> - four taps on the key will produce “d”
>
> ```xml
> <key id="a" output="a" multiTap="bb c d">
> ```
> <keys>
> <key id="a" output="a" multiTapKeyListId="a-taps">
> </key>
>
> Control characters, combining marks and whitespace (which is intended to be a multiTap option) in this attribute are escaped using the `\u{...}` notation.
> <keyLists>
> <keyList id="a-list" keyIds="bb c d"/>
> </keyLists>
> ```
**Note**: Behavior past the end of the multiTap list is implementation specific.
Expand Down Expand Up @@ -820,6 +846,58 @@ Thus, the implied keys behave as if the following import were present.

* * *

### <a name="Element_keyLists" href="#Element_keyLists">Element: keyLists</a>

This element contains `keyList` elements, indicating an ordered list of keys.

> <small>
>
> Parents: [keyboard3](#Element_keyboard3)
>
> Children: [import](#Element_import), [keyList](#Element_keyList), [_special_](tr35.md#special)
>
> Occurrence: optional, single
> </small>
* * *

### <a name="Element_keyList" href="#Element_keyList">Element: keyList</a>

> <small>
>
> Parents: [keyLists](#Element_keyLists)
>
> Children: _none_
>
> Occurrence: optional, multiple
> </small>
_Attribute:_ `id` (required)

> The `id` attribute identifies the list. It can be any NMTOKEN.
>
> The `keyList` elements have their own id namespace.
>
> In the future, this attribute’s definition is expected to be updated to align with [UAX#31](https://www.unicode.org/reports/tr31/). Please see [CLDR-17043](https://unicode-org.atlassian.net/browse/CLDR-17043) for more details.
_Attribute:_ `keyIds` (required)

> This attribute specifies an ordered, space-separated list of `key` elements, by id.
_Attribute:_ `defaultKeyId`

> This attribute specifies a 'default' key for the list. The key id must be one of those present in the `keyIds` list. For long press gesture, this is used to specify the default key when performing a long press. This attribute is ignored for multi tap gestures.
**Syntax**

```xml
<keyLists>
<keyList id="lower-a" defaultKeyId="a-grave" keyIds="a-grave a-caret a-acute" />
</keyLists>
```

* * *

#### <a name="Element_flicks" href="#Element_flicks">Elements: flicks</a>

The `flicks` element is a collection of `flick` elements.
Expand Down Expand Up @@ -879,7 +957,7 @@ _Attribute:_ `id` (required)
**Syntax**

```xml
<flickSegment directions="{list of directions}" "{the output}" />
<flickSegment directions="{list of directions}" keyId="{the output key id}" />
```

> <small>
Expand All @@ -896,17 +974,24 @@ _Attribute:_ `directions` (required)

> The `directions` attribute value is a space-delimited list of keywords, that describe a path, currently restricted to the cardinal and intercardinal directions `{n e s w ne nw se sw}`.
_Attribute:_ `output` (required)
_Attribute:_ `keyId` (required)

> The `output` attribute value is the result of (one or more) flicks.
> The `keyId` attribute value is the result of (one or more) flicks.
**Example**
where a flick to the Northeast then South produces two code points.
where a flick to the Northeast then South produces `Å`.

```xml
<flick id="a">
<flickSegment directions="ne s" output="\u{ABCD}\u{DCBA}" />
</flick>
<keys>
<key id="something" flickId="a" output="Something" />
<key id="A-ring" output="A-ring" />
</keys>

<flicks>
<flick id="a">
<flickSegment directions="ne s" keyId="A-ring" />
</flick>
</flicks>
```

* * *
Expand Down Expand Up @@ -1093,14 +1178,14 @@ This attribute may be escaped with `\u` notation, see [Escaping](#Escaping).
```xml
<keyboard3>
<keys>
<key id="a" output="a" longpress="\u{0301} \u{0300}" />
<key id="shift" layerId="shift" />
<key id="grave" output="\u{0300}" /> <!-- combining grave -->
<key id="marker" output="\m{acute}" /> <!-- generates a marker-->
<key id="numeric" layerId="numeric" /> <!-- changes layers-->
</keys>
<displays>
<display output="\u{0300}" display="ˋ" /> <!-- \u{02CB} -->
<display output="\u{0301}" display="ˊ" /> <!-- \u{02CA} -->
<display keyId="shift" display="" /> <!-- U+21EA -->
<display output="\m{grave}" display="`" /> <!-- Display \m{grave} as ` -->
<display keyId="numeric" display="#" /> <!-- display the layer shift key as # -->
<display output="\m{acute}" display="´" /> <!-- Display \m{acute} as ´ -->
</displays>
</keyboard3>
```
Expand Down
44 changes: 34 additions & 10 deletions keyboards/3.0/fr-t-k0-azerty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,54 @@
<key id="e-grave" output="é" /> <!-- 2 -->
<key id="e-acute" output="è" /> <!-- 7 -->
<key id="c-cedilla" output="ç" /> <!-- 9 -->
<key id="a-acute" output="à" /> <!-- 0 -->
<key id="a-grave" output="à" /> <!-- 0 -->
<key id="a-acute" output="á" />
<key id="a-caret" output="â" />
<key id="a-umlaut" output="ä" />
<key id="a-tilde" output="ã" />
<key id="a-ring" output="å" />
<key id="a-caron" output="ā" />

<key id="A-grave" output="À" /> <!-- 0 -->
<key id="A-acute" output="Á" />
<key id="A-caret" output="Â" />
<key id="A-umlaut" output="Ä" />
<key id="A-tilde" output="Ã" />
<key id="A-ring" output="Å" />
<key id="A-caron" output="Ā" />


<!-- extra symbols -->
<key id="bullet" output="" />
<key id="umlaut" output="¨" />
<key id="super-2" output="²" longPress="" />
<key id="super-2" output="²" longPressKeyListId="sub-2" multiTapKeyListId="list-2" />
<key id="sub-2" output="" />

<!-- test key -->
<key id="a" flickId="a" output="a" longPress="à â á ä ã å ā" />
<key id="a" flickId="a" output="a" longPressKeyListId="lower-a" />
<!-- test key -->
<key id="A" flickId="b" output="A" longPress="À Á Ä Ã Å Ā" />
<key id="A" flickId="b" output="A" longPressKeyListId="upper-a" />
<!-- TODO: all additional maps, hardware and touch -->
</keys>

<keyLists>
<keyList id="sub-2" keyIds="sub-2" />
<keyList id="list-2" keyIds="2 super-2 sub-2" />
<keyList id="lower-a" defaultKeyId="a-grave" keyIds="a-grave a-caret a-acute a-umlaut a-tilde a-ring a-caron" />
<keyList id="upper-a" defaultKeyId="A-grave" keyIds="A-grave A-caret A-acute A-umlaut A-tilde A-ring A-caron" />
</keyLists>

<flicks>
<flick id="b">
<flickSegment directions="nw" output="\u{4567}" />
<flickSegment directions="nw se" output="\u{FFFF}" />
<flickSegment directions="e" output="\u{FFF0}" />
<flickSegment directions="nw" keyId="A-grave" />
<flickSegment directions="nw se" keyId="A-acute" />
<flickSegment directions="e" keyId="A-caron" />
<flickSegment directions="s" keyId="numeric" /> <!-- layer shifting flick-->
</flick>
<flick id="a">
<flickSegment directions="nw" output="\u{1234}" />
<flickSegment directions="nw se" output="\u{FFFF}" />
<flickSegment directions="e" output="\u{FFF0}" />
<flickSegment directions="nw" keyId="a-grave" />
<flickSegment directions="nw se" keyId="a-acute" />
<flickSegment directions="e" keyId="a-caron" />
</flick>
</flicks>

Expand Down
28 changes: 18 additions & 10 deletions keyboards/dtd/ldmlKeyboard3.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The CLDR Keyboard Subcommittee is currently developing major changes to the CLDR
Please view the subcommittee page for the most recent information.
<https://cldr.unicode.org/index/keyboard-workgroup> -->

<!ELEMENT keyboard3 ( import*, locales?, version?, info, settings?, displays?, keys?, flicks?, forms?, layers*, variables?, transforms*, special* ) >
<!ELEMENT keyboard3 ( import*, locales?, version?, info, settings?, displays?, keys?, keyLists?, flicks?, forms?, layers*, variables?, transforms*, special* ) >
<!--@TECHPREVIEW-->
<!ATTLIST keyboard3 locale CDATA #REQUIRED >
<!--@MATCH:validity/bcp47-wellformed-->
Expand Down Expand Up @@ -104,17 +104,12 @@ Please view the subcommittee page for the most recent information.
<!--@MATCH:any-->
<!--@VALUE-->
<!--@ALLOWS_UESC-->
<!ATTLIST key longPress CDATA #IMPLIED >
<!ATTLIST key longPressKeyListId NMTOKEN #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->
<!--@ALLOWS_UESC-->
<!ATTLIST key longPressDefault CDATA #IMPLIED >
<!ATTLIST key multiTapKeyListId NMTOKEN #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->
<!--@ALLOWS_UESC-->
<!ATTLIST key multiTap CDATA #IMPLIED >
<!--@VALUE-->
<!--@ALLOWS_UESC-->
<!ATTLIST key stretch (true) #IMPLIED >
<!--@VALUE-->
<!ATTLIST key layerId NMTOKEN #IMPLIED >
Expand All @@ -126,6 +121,20 @@ Please view the subcommittee page for the most recent information.
<!--@MATCH:range/0.01~100.0-->
<!--@VALUE-->

<!ELEMENT keyLists ( import*, keyList*, special* ) >
<!--@TECHPREVIEW-->

<!ELEMENT keyList EMPTY >
<!--@TECHPREVIEW-->
<!ATTLIST keyList id NMTOKEN #REQUIRED >
<!--@MATCH:any-->
<!ATTLIST keyList keyIds NMTOKENS #REQUIRED >
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST keyList defaultKeyId NMTOKEN #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->

<!ELEMENT flicks ( import*, flick*, special* ) >

<!ELEMENT flick ( flickSegment+, special* ) >
Expand All @@ -137,10 +146,9 @@ Please view the subcommittee page for the most recent information.
<!--@TECHPREVIEW-->
<!ATTLIST flickSegment directions NMTOKENS #REQUIRED >
<!--@MATCH:regex/(n|e|s|w|ne|nw|se|sw)([ ]+(n|e|s|w|ne|nw|se|sw))*-->
<!ATTLIST flickSegment output CDATA #REQUIRED >
<!ATTLIST flickSegment keyId NMTOKEN #REQUIRED >
<!--@MATCH:any-->
<!--@VALUE-->
<!--@ALLOWS_UESC-->

<!ELEMENT forms ( import*, form*, special* ) >
<!--@TECHPREVIEW-->
Expand Down
Loading

0 comments on commit 24f19c8

Please sign in to comment.