diff --git a/.github/workflows/tidy.yml b/.github/workflows/tidy.yml new file mode 100644 index 0000000..f7d3f28 --- /dev/null +++ b/.github/workflows/tidy.yml @@ -0,0 +1,22 @@ +name: Tidy document +on: + workflow_dispatch: {} + push: + branches: + - gh-pages + paths: + - index.html + +jobs: + tidy: + name: Tidy up + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - run: brew install tidy-html5 + - run: tidy -config tidyconfig.txt -o index.html index.html + - uses: peter-evans/create-pull-request@v6 + with: + title: "Tidied up document using tidy-html5" + commit-message: "chore: tidy up index.html" + branch: html-tidy diff --git a/index.html b/index.html index aedc92f..1a60a77 100644 --- a/index.html +++ b/index.html @@ -1062,14 +1062,14 @@

gamepad.
- `"standard"` + "standard"
The Gamepad's controls have been mapped to the [=Standard Gamepad=] layout.
- `"xr-standard"` + "xr-standard"
The Gamepad's controls have been mapped to the [="xr-standard" @@ -1080,7 +1080,8 @@

-
+

GamepadHapticActuator Interface

@@ -1147,8 +1148,8 @@

- Array of {{Gamepad/GamepadHapticEffectType}} values representing all - the types of haptic effects that the actuator supports. This + Array of {{Gamepad/GamepadHapticEffectType}} values representing + all the types of haptic effects that the actuator supports. This property lists the {{Gamepad/GamepadHapticEffectType}} values that the actuator supports, unless the [=user agent=] does not support playing effects of that type. @@ -1166,8 +1167,8 @@

- The {{GamepadHapticActuator/playEffect()}} method steps, called with - {{GamepadHapticEffectType}} |type:GamepadHapticEffectType| and + The {{GamepadHapticActuator/playEffect()}} method steps, called + with {{GamepadHapticEffectType}} |type:GamepadHapticEffectType| and {{GamepadEffectParameters}} |params:GamepadEffectParameters |, are:

    @@ -1175,7 +1176,7 @@

    effect=] of type |type:GamepadHapticEffectType|, return [=a promise rejected with=] a {{TypeError}}. -
  1. Let |document:Document?| be the [=current settings object=]'s +
  2. Let |document:Document?| be the [=current settings object=]'s [=relevant global object=]'s [=associated `Document`=].
  3. If |document| is `null` or |document| is not [=Document/fully @@ -1199,8 +1200,8 @@

-
  • If |this|'s gamepad's actuator cannot [=play effects with type=] - |type|, return [=a promise rejected with=] reason +
  • If |this|'s gamepad's actuator cannot [=play effects with + type=] |type|, return [=a promise rejected with=] reason {{NotSupportedError}}.
  • Let {{GamepadHapticActuator/[[playingEffectPromise]]}} be [=a @@ -1257,7 +1258,8 @@

    `"hidden"`, return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}.

  • -
  • Let |resetResultPromise:Promise| be [=a new promise=].
  • +
  • Let |resetResultPromise:Promise| be [=a new promise=]. +
  • If [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} is not `null`, do the following steps [=in parallel=]:
      @@ -1269,23 +1271,25 @@

    1. If the effect has been successfully stopped, do:
      1. If |effectPromise| and - [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} - are still the same, set - [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} - to `null`. + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} + are still the same, set + [=this=].{{GamepadHapticActuator/[[playingEffectPromise]]}} + to `null`.
      2. -
      3. [=Queue a global task=] on the [=relevant global object=] - of [=this=] using the [=gamepad task source=] to [=resolve=] - |effectPromise| with {{GamepadHapticsResult/"preempted"}}. +
      4. [=Queue a global task=] on the [=relevant global + object=] of [=this=] using the [=gamepad task source=] to + [=resolve=] |effectPromise| with + {{GamepadHapticsResult/"preempted"}}.
    2. -
    3. [=Resolve=] |resetResultPromise| with - {{GamepadHapticsResult/"complete"}} +
    4. [=Resolve=] |resetResultPromise| with + {{GamepadHapticsResult/"complete"}}
  • -
  • Return |resetResultPromise|.
  • +
  • Return |resetResultPromise|. +
  • @@ -1311,6 +1315,13 @@

    If |params| does not describe a [=valid dual-rumble effect=], return `false`.

    +
    + {{GamepadHapticEffectType/"trigger-rumble"}} +
    +
    + If |params| does not describe a [=valid trigger-rumble effect=], + return `false`. +
  • Return `true` @@ -1322,11 +1333,11 @@

    |type:GamepadHapticEffectType| and try to make it use the provided |params:GamepadEffectParameters|. The [=user agent=] SHOULD use the provided |playEffectTimestamp:DOMHighResTimestamp| for more precise - playback timing when |params|.{{startDelay}} is not `0.0`. The - [=user agent=] MAY modify the effect to increase compatibility. For - example, an effect intended for a rumble motor may be transformed into a - waveform-based effect for a device that supports waveform haptics but - lacks rumble motors. + playback timing when |params|.{{GamepadEffectParameters/startDelay}} is + not `0.0`. The [=user agent=] MAY modify the effect to increase + compatibility. For example, an effect intended for a rumble motor may + be transformed into a waveform-based effect for a device that supports + waveform haptics but lacks rumble motors.

    To stop haptic effects on an actuator, the [=user agent=] @@ -1339,20 +1350,20 @@

    Handling visibility change

    - When the |document|'s [=Document/visibility state=] becomes `"hidden"`, run - these steps for each {{GamepadHapticActuator}} + When the |document|'s [=Document/visibility state=] becomes + `"hidden"`, run these steps for each {{GamepadHapticActuator}} |actuator:GamepadHapticActuator|:

      -
    1. If - |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} is - `null`, abort these steps. +
    2. If |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} + is `null`, abort these steps.
    3. [=Queue a global task=] on the [=relevant global object=] of |actuator| using the [=gamepad task source=] to run the following steps:
        -
      1. If |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} is +
      2. If + |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} is `null`, abort these steps.
      3. [=Resolve=] @@ -1360,8 +1371,8 @@

        with {{GamepadHapticsResult/"preempted"}}.

      4. Set - |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} - to `null`. + |actuator|.{{GamepadHapticActuator/[[playingEffectPromise]]}} to + `null`.
    4. @@ -1376,8 +1387,8 @@

      A new |gamepadHapticActuator:GamepadHapticActuator| representing a - {{Gamepad}}'s primary vibration actuator is constructed by - performing the following steps: + {{Gamepad}}'s primary vibration actuator is constructed by performing + the following steps:

      1. Let |gamepadHapticActuator:GamepadHapticActuator| be a newly @@ -1386,14 +1397,13 @@

      2. Let `supportedEffectsList` be an empty list.
      3. For each enum value |type:GamepadHapticEffectType| of - {{GamepadHapticEffectType}}, if the [=user agent=] can send a - command to initiate effects of that type on that actuator, append - |type| to `supportedEffectsList`. -
      4. -
      5. Set - |gamepadHapticActuator|.{{GamepadHapticActuator/[[effects]]}} to + {{GamepadHapticEffectType}}, if the [=user agent=] can send a command + to initiate effects of that type on that actuator, append |type| to `supportedEffectsList`.
      6. +
      7. Set |gamepadHapticActuator|.{{GamepadHapticActuator/[[effects]]}} + to `supportedEffectsList`. +

  • @@ -1427,7 +1437,7 @@

    -
    +

    GamepadHapticEffectType enum

    @@ -1437,23 +1447,22 @@

             enum GamepadHapticEffectType {
    -          "dual-rumble"
    +          "dual-rumble",
    +          "trigger-rumble"
             };
           
    - "dual-rumble" effect - type + "dual-rumble" effect type

    - {{GamepadHapticEffectType/"dual-rumble"}} describes a haptics - configuration with an eccentric rotating mass (ERM) vibration - motor in each handle of a standard gamepad. In this - configuration, either motor is capable of vibrating the whole - gamepad. The vibration effects created by each motor are unequal - so that the effects of each can be combined to create more - complex haptic effects. + {{GamepadHapticEffectType/"dual-rumble"}} describes a haptic + configuration with an eccentric rotating mass (ERM) vibration motor + in each handle of a standard gamepad. In this configuration, either + motor is capable of vibrating the whole gamepad. The vibration + effects created by each motor are unequal so that the effects of + each can be combined to create more complex haptic effects.

    A {{GamepadHapticEffectType/"dual-rumble"}} effect is a @@ -1467,22 +1476,72 @@

    {{GamepadEffectParameters/strongMagnitude}} and - {{GamepadEffectParameters/weakMagnitude}} set the - intensity levels for the low-frequency and high-frequency - vibrations, normalized to the range `[0,1]`, defaulting to 0. + {{GamepadEffectParameters/weakMagnitude}} set the intensity levels + for the low-frequency and high-frequency vibrations, normalized to + the range `[0,1]`, defaulting to 0.

    Given {{GamepadEffectParameters}} |params:GamepadEffectParameters|, - a valid dual-rumble effect must have a valid - duration, a valid startDelay, and both the + a valid dual-rumble effect must have a [=valid + effect|valid=] {{GamepadEffectParameters/duration}}, a [=valid + effect|valid=] {{GamepadEffectParameters/startDelay}}, and both the {{GamepadEffectParameters/strongMagnitude}} and the {{GamepadEffectParameters/weakMagnitude}} must be in the range `[0,1]`.

    +
    + "trigger-rumble" effect type +
    +
    +

    + {{GamepadHapticEffectType/"trigger-rumble"}} describes a haptics + configuration with a vibration motor in each of the bottom front + buttons of a [=Standard Gamepad=] (buttons with [=canonical + indices=] 6 and 7) in addition to the two handle motors used for + {{GamepadHapticEffectType/"dual-rumble"}}. These buttons most + commonly take the form of spring-loaded triggers. In this + configuration, either motor is capable of providing localized + haptic feedback on the button's surface. +

    +

    + A {{GamepadHapticEffectType/"trigger-rumble"}} effect is a + fixed-duration, constant-intensity vibration effect intended for an + actuator of this type. {{GamepadHapticEffectType/"trigger-rumble"}} + effects are defined by {{GamepadEffectParameters/startDelay}}, + {{GamepadEffectParameters/duration}}, + {{GamepadEffectParameters/strongMagnitude}}, + {{GamepadEffectParameters/weakMagnitude}}, + {{GamepadEffectParameters/leftTrigger}}, and + {{GamepadEffectParameters/rightTrigger}}, none of which are + required because they default to 0. +

    +

    + {{GamepadEffectParameters/startDelay}}, + {{GamepadEffectParameters/duration}}, + {{GamepadEffectParameters/strongMagnitude}}, + {{GamepadEffectParameters/weakMagnitude}} share the same definition + with {{GamepadHapticEffectType/"dual-rumble"}}. + {{GamepadEffectParameters/leftTrigger}} and + {{GamepadEffectParameters/rightTrigger}}, respectively, set the + intensity levels for the left and right bottom front buttons + vibrations, normalized to the range `[0,1]`, defaulting to 0. +

    +

    + Given {{GamepadEffectParameters}} |params:GamepadEffectParameters|, + a valid trigger-rumble effect must have a [=valid + effect|valid=] {{GamepadEffectParameters/duration}}, a [=valid + effect|valid=] {{GamepadEffectParameters/startDelay}}, and the + {{GamepadEffectParameters/strongMagnitude}}, + {{GamepadEffectParameters/weakMagnitude}}, + {{GamepadEffectParameters/leftTrigger}}, and + {{GamepadEffectParameters/rightTrigger}} must be in the range + `[0,1]`. +

    +

    -
    +

    GamepadEffectParameters Dictionary

    @@ -1492,10 +1551,10 @@

    by the haptic effect, and some keys may be unused.

    - To mitigate unwanted long-running effects, the [=user agent=] MAY - limit the total effect duration for a [=valid effect=] to some - maximum duration. It is RECOMMENDED that the [=user agent=] use a - maximum of 5 seconds. + To mitigate unwanted long-running effects, the [=user agent=] MAY limit + the total effect duration for a [=valid effect=] to some maximum + duration. It is RECOMMENDED that the [=user agent=] use a maximum of 5 + seconds.

             dictionary GamepadEffectParameters {
    @@ -1503,6 +1562,8 @@ 

    unsigned long long startDelay = 0; double strongMagnitude = 0.0; double weakMagnitude = 0.0; + double leftTrigger = 0.0; + double rightTrigger = 0.0; };

    @@ -1517,24 +1578,42 @@

    startDelay member
    - {{GamepadEffectParameters/startDelay}} sets the duration of the - delay after {{GamepadHapticActuator/playEffect()}} is called - until vibration is started, in milliseconds. During the delay - interval, the actuator SHOULD NOT vibrate. + {{GamepadEffectParameters/startDelay}} sets the duration of the delay + after {{GamepadHapticActuator/playEffect()}} is called until + vibration is started, in milliseconds. During the delay interval, the + actuator SHOULD NOT vibrate.
    strongMagnitude member
    The vibration magnitude for the low frequency rumble in a - {{GamepadHapticEffectType/"dual-rumble"}} effect. + {{GamepadHapticEffectType/"dual-rumble"}} or + {{GamepadHapticEffectType/"trigger-rumble"}} effect.
    weakMagnitude member
    The vibration magnitude for the high frequency rumble in a - {{GamepadHapticEffectType/"dual-rumble"}} effect. + {{GamepadHapticEffectType/"dual-rumble"}} or + {{GamepadHapticEffectType/"trigger-rumble"}} effect. +
    +
    + leftTrigger member +
    +
    + The vibration magnitude for the bottom left front button ([=canonical + index=] 6) rumble in a {{GamepadHapticEffectType/"trigger-rumble"}} + effect. +
    +
    + rightTrigger member +
    +
    + The vibration magnitude for the bottom right front button + ([=canonical index=] 7) rumble in a + {{GamepadHapticEffectType/"trigger-rumble"}} effect.

    @@ -1772,8 +1851,8 @@

    If an axis or button input represents a [=Standard Gamepad=] axis or - button, then its canonical index is the index of the - corresponding [=Standard Gamepad=] axis or button. + button, then its canonical index + is the index of the corresponding [=Standard Gamepad=] axis or button.

    @@ -2282,7 +2361,8 @@

    This specification defines a policy-controlled feature identified by the string "gamepad". Its - [=policy-controlled feature/default allowlist=] is [=default allowlist/*=]. + [=policy-controlled feature/default allowlist=] is [=default + allowlist/*=].