@puzzmo/sdk 1.0.56 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/dist/{createSimulator-B6T0o88B.js → createSimulator-5inYnxKU.js} +223 -190
- package/dist/createSimulator-5inYnxKU.js.map +1 -0
- package/dist/{createSimulator-BqKldPIq.cjs → createSimulator-BCzgWYMQ.cjs} +23 -23
- package/dist/createSimulator-BCzgWYMQ.cjs.map +1 -0
- package/dist/fonts.cjs +1 -1
- package/dist/fonts.cjs.map +1 -1
- package/dist/fonts.js +1 -1
- package/dist/fonts.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/keyboard.d.ts +12 -1
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.spec.d.ts +2 -0
- package/dist/keyboard.spec.d.ts.map +1 -0
- package/dist/sdk.d.ts +29 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/simulator/dockedKeyboard.d.ts +2 -0
- package/dist/simulator/dockedKeyboard.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/views/KeyboardView.d.ts.map +1 -1
- package/dist/types.d.ts +58 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/createSimulator-B6T0o88B.js.map +0 -1
- package/dist/createSimulator-BqKldPIq.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -91,6 +91,27 @@ sdk.timer.isPaused() // Check if paused
|
|
|
91
91
|
sdk.timer.isRunning() // Check if running
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
### Haptics
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
sdk.haptics.play("selection") // on placing a letter
|
|
98
|
+
sdk.haptics.play("success", { id: "puzzle-solved" }) // `id` names the cue in host logs
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Names are the iOS feedback generators: `selection`, `light`, `medium`, `heavy`, `soft`, `rigid`, `success`, `warning`, `error`.
|
|
102
|
+
|
|
103
|
+
Fire-and-forget — it never reports back, and it is a no-op wherever the host can't deliver one, so never make gameplay depend on a haptic landing:
|
|
104
|
+
|
|
105
|
+
| Where | What happens |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| Puzzmo's iOS app | Real UIKit haptics via the native bridge |
|
|
108
|
+
| puzzmo.com on Android/desktop | Approximated with `navigator.vibrate` |
|
|
109
|
+
| Partner embeds | No haptic — see below |
|
|
110
|
+
|
|
111
|
+
The call goes to the host rather than vibrating from your game because Chrome has blocked `navigator.vibrate` in cross-origin iframes since Chrome 55, and games run in one. There is no Permissions-Policy opt-in, so calling it yourself is silently ignored. Partner embeds fire no haptic for the same reason: our frame is cross-origin to the partner's page, so the host is blocked too and there is no native bridge to fall back on. The cue is still forwarded to the partner page on the private message stream, so a partner can action it themselves.
|
|
112
|
+
|
|
113
|
+
Haptics are also off entirely when the player has turned them off in their Puzzmo settings, and the OS drops them in silent/DND or on hardware with no motor.
|
|
114
|
+
|
|
94
115
|
## Theme
|
|
95
116
|
|
|
96
117
|
The `theme` object from `gameReady()` contains color tokens for the current Puzzmo theme:
|
|
@@ -154,8 +175,14 @@ sdk.keyboard.hide()
|
|
|
154
175
|
`defaultKeyboardConfig` is a standard QWERTY layout with Enter and Backspace. Customize it by spreading:
|
|
155
176
|
|
|
156
177
|
```ts
|
|
178
|
+
sdk.keyboard.show({ ...defaultKeyboardConfig,
|
|
157
179
|
// Disable letters that are no longer valid given the current game state
|
|
158
|
-
|
|
180
|
+
disabled: usedLetters })
|
|
181
|
+
// Override inidividual keys with their own styles for emphasis
|
|
182
|
+
individualKeyStyles: keyStylesFromRules([
|
|
183
|
+
{ keys: ["?"], background: { backgroundColor: "#ffd54a" } },
|
|
184
|
+
{ keys: usedLetters, text: { opacity: "0.4", transition: "opacity 200ms ease-out" } },
|
|
185
|
+
]),
|
|
159
186
|
```
|
|
160
187
|
|
|
161
188
|
For games with a spatial input model (e.g. selecting a grid cell by dragging across the keyboard),
|