@indiegems/gem-web-sdk 7.7.0 → 7.8.0
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/dist/game.d.ts +2 -0
- package/dist/gem-web-sdk.esm.js +2 -2
- package/dist/gem-web-sdk.function.js +1 -1
- package/dist/gem-web-sdk.game.js +2 -2
- package/dist/gem-web-sdk.min.js +2 -2
- package/dist/gem-web-sdk.sdk.js +2 -2
- package/dist/gem-web-sdk.server.js +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/sdk.d.ts +2 -0
- package/docs/api/api-reference-game.md +38 -1
- package/docs/api/api-reference-server.md +1 -1
- package/docs/api/reference.json +35 -1
- package/docs/dedicated-server-flow.md +23 -14
- package/docs/getting-started.md +1 -1
- package/docs/manifest.json +8 -8
- package/docs/server-bundles.md +2 -2
- package/docs/what-a-game-must-do.md +44 -21
- package/package.json +1 -1
|
@@ -328,11 +328,11 @@ orientations:
|
|
|
328
328
|
landscape: partial
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
-
| Value
|
|
332
|
-
|
|
|
333
|
-
| `full`
|
|
334
|
-
| `partial` | a dismissible hint, once, if the other way is `full`
|
|
335
|
-
| `none`
|
|
331
|
+
| Value | What the player gets |
|
|
332
|
+
| --------- | ---------------------------------------------------------------------- |
|
|
333
|
+
| `full` | nothing — the game plays this way round |
|
|
334
|
+
| `partial` | a dismissible hint, once, if the other way is `full` |
|
|
335
|
+
| `none` | a panel over the paused game asking them to rotate, with "play anyway" |
|
|
336
336
|
|
|
337
337
|
Three consequences worth knowing before you hit them:
|
|
338
338
|
|
|
@@ -508,10 +508,14 @@ them**, so the whole migration for a stylesheet is one declaration per edge:
|
|
|
508
508
|
|
|
509
509
|
```css
|
|
510
510
|
/* before */
|
|
511
|
-
#hud {
|
|
511
|
+
#hud {
|
|
512
|
+
top: env(safe-area-inset-top, 0px);
|
|
513
|
+
}
|
|
512
514
|
|
|
513
515
|
/* after — right in the arcade, and unchanged everywhere else */
|
|
514
|
-
#hud {
|
|
516
|
+
#hud {
|
|
517
|
+
top: var(--gem-safe-top, env(safe-area-inset-top, 0px));
|
|
518
|
+
}
|
|
515
519
|
```
|
|
516
520
|
|
|
517
521
|
The `env()` fallback is not decoration. Under a parent that has not sent the message — an older
|
|
@@ -805,6 +809,25 @@ pauseMenu.onOpen = () => gem.setWalletVisible(true);
|
|
|
805
809
|
- **`false` means nobody is listening** — no connection yet, or an embedder that draws no wallet.
|
|
806
810
|
Do nothing in its place.
|
|
807
811
|
|
|
812
|
+
## No accidental text selection
|
|
813
|
+
|
|
814
|
+
**You write nothing for this.** A long press on a phone, a double-click on a button, a drag across
|
|
815
|
+
your HUD: on an ordinary page each selects text, raises the copy menu or flashes a tap highlight,
|
|
816
|
+
and in a game none of them is something the player meant. So at start-up the SDK turns all three
|
|
817
|
+
off across your document.
|
|
818
|
+
|
|
819
|
+
- **Your CSS always wins.** The SDK's rule has zero specificity, so any rule you write overrides it.
|
|
820
|
+
To make one element copyable — a room code, a share link — give it
|
|
821
|
+
`-webkit-user-select: text; user-select: text;`.
|
|
822
|
+
- **Inputs, text areas and editable content are untouched.** They still take typing, still select
|
|
823
|
+
and still paste.
|
|
824
|
+
- **It is a stylesheet the SDK adopts, not a `<style>` element**, so a strict `style-src` in your
|
|
825
|
+
own CSP does not block it. On iOS before 16.4, which lacks that API, the SDK sets the same
|
|
826
|
+
properties on `<html>` itself instead, all but the copy menu, which has no safe way to be handed
|
|
827
|
+
back to your inputs there.
|
|
828
|
+
- **To keep the browser's default instead** — a game that is mostly text the player should be able
|
|
829
|
+
to copy — pass `createGem({ selectableText: true })`.
|
|
830
|
+
|
|
808
831
|
## The Arcade's FPS overlay
|
|
809
832
|
|
|
810
833
|
The Arcade has a frame-rate toggle beside your game, and **you do not have to write anything for it
|
|
@@ -876,15 +899,15 @@ player (`gem.player`), room members, leaderboard rows, friends, profiles, showca
|
|
|
876
899
|
async opponent you read through the raw client, once you pass the row through `mapIdentity`. One
|
|
877
900
|
renderer serves all of them.
|
|
878
901
|
|
|
879
|
-
| Field
|
|
880
|
-
|
|
|
881
|
-
| `playerId`
|
|
882
|
-
| `displayName`
|
|
883
|
-
| `discriminator` | The digits that tell two same-named players apart — `0001`, no `#`
|
|
884
|
-
| `displayTag`
|
|
885
|
-
| `avatarIconId`
|
|
886
|
-
| `avatarIconUrl` | The portrait's thumbnail
|
|
887
|
-
| `badges`
|
|
902
|
+
| Field | What it is | Type |
|
|
903
|
+
| --------------- | ------------------------------------------------------------------------------------------- | ------------ |
|
|
904
|
+
| `playerId` | The player's id. **Absent on an anonymous row** | `string` |
|
|
905
|
+
| `displayName` | The name the player chose | `PlayerText` |
|
|
906
|
+
| `discriminator` | The digits that tell two same-named players apart — `0001`, no `#` | `string` |
|
|
907
|
+
| `displayTag` | The precomposed `Name#0001` | `PlayerText` |
|
|
908
|
+
| `avatarIconId` | The portrait item's id | `string` |
|
|
909
|
+
| `avatarIconUrl` | The portrait's thumbnail | `string` |
|
|
910
|
+
| `badges` | Equipped badges in display order, each `{ itemId, iconUrl }` — always a list, empty for now | array |
|
|
888
911
|
|
|
889
912
|
**The name and the tag are player-authored, so both are `PlayerText`** on every surface, not only
|
|
890
913
|
some. Convert with `text.toPlain()` where you render, never before.
|
|
@@ -937,11 +960,11 @@ While it lasts the player earns Gems and Tickets faster (never achievement point
|
|
|
937
960
|
platform raises their earning limits to match. The platform does all of that on its own side when
|
|
938
961
|
it pays; your game does nothing to make a boost work.
|
|
939
962
|
|
|
940
|
-
| Field
|
|
941
|
-
|
|
|
942
|
-
| `boost.active`
|
|
943
|
-
| `boost.multipliers`
|
|
944
|
-
| `boost.expiresInDays` | Whole days until the soonest boosted currency drops back, rounded up and **capped at 7** — `7` means "7 or more"; absent when nothing is boosted
|
|
963
|
+
| Field | What it is | Type |
|
|
964
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
|
|
965
|
+
| `boost.active` | Whether any currency earns faster than 1× right now | `boolean` |
|
|
966
|
+
| `boost.multipliers` | One `{ currencyId, currencySlug, multiplier }` per boostable currency — `multiplier` is `2` for 2×, `1` when not boosted; a currency not listed is 1× | array |
|
|
967
|
+
| `boost.expiresInDays` | Whole days until the soonest boosted currency drops back, rounded up and **capped at 7** — `7` means "7 or more"; absent when nothing is boosted | `number` |
|
|
945
968
|
|
|
946
969
|
`boost` is always present on `gem.player`. When the Arcade has not said — an older Arcade, a
|
|
947
970
|
backend without boosts, a read that has not landed yet — it reads as **not boosted**, exactly like a
|