@indiegems/gem-web-sdk 7.7.0 → 7.8.1
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/CHANGELOG.md +1 -1
- 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/changelog.md +1 -1
- package/docs/dedicated-server-flow.md +23 -14
- package/docs/getting-started.md +1 -1
- package/docs/manifest.json +10 -10
- package/docs/server-bundles.md +2 -2
- package/docs/what-a-game-must-do.md +45 -24
- 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
|
|
@@ -541,9 +545,7 @@ the `var()` above, or read `gem.viewport`. The release checklist looks for the b
|
|
|
541
545
|
On a phone your game is full-bleed, and the arcade keeps one row of its own across the top of it,
|
|
542
546
|
with the middle left open for a centred camera:
|
|
543
547
|
|
|
544
|
-
- **Top-left: the Back tab** — the Gem Arcade wordmark, always there.
|
|
545
|
-
your own top-left**: it would sit under the arcade's tab, which leaves the game, while yours would
|
|
546
|
-
mean something else.
|
|
548
|
+
- **Top-left: the Back tab** — the Gem Arcade wordmark, always there.
|
|
547
549
|
- **Top-right: the player's wallets** (Gems, Tickets, their achievement score) while your screen
|
|
548
550
|
[shows them](#the-arcades-wallet-show-it-never-draw-it). Put your own settings, pause or menu
|
|
549
551
|
button top-right **below** them, at `top: var(--gem-reserved-tr-height, …)` — and when gameplay
|
|
@@ -805,6 +807,25 @@ pauseMenu.onOpen = () => gem.setWalletVisible(true);
|
|
|
805
807
|
- **`false` means nobody is listening** — no connection yet, or an embedder that draws no wallet.
|
|
806
808
|
Do nothing in its place.
|
|
807
809
|
|
|
810
|
+
## No accidental text selection
|
|
811
|
+
|
|
812
|
+
**You write nothing for this.** A long press on a phone, a double-click on a button, a drag across
|
|
813
|
+
your HUD: on an ordinary page each selects text, raises the copy menu or flashes a tap highlight,
|
|
814
|
+
and in a game none of them is something the player meant. So at start-up the SDK turns all three
|
|
815
|
+
off across your document.
|
|
816
|
+
|
|
817
|
+
- **Your CSS always wins.** The SDK's rule has zero specificity, so any rule you write overrides it.
|
|
818
|
+
To make one element copyable — a room code, a share link — give it
|
|
819
|
+
`-webkit-user-select: text; user-select: text;`.
|
|
820
|
+
- **Inputs, text areas and editable content are untouched.** They still take typing, still select
|
|
821
|
+
and still paste.
|
|
822
|
+
- **It is a stylesheet the SDK adopts, not a `<style>` element**, so a strict `style-src` in your
|
|
823
|
+
own CSP does not block it. On iOS before 16.4, which lacks that API, the SDK sets the same
|
|
824
|
+
properties on `<html>` itself instead, all but the copy menu, which has no safe way to be handed
|
|
825
|
+
back to your inputs there.
|
|
826
|
+
- **To keep the browser's default instead** — a game that is mostly text the player should be able
|
|
827
|
+
to copy — pass `createGem({ selectableText: true })`.
|
|
828
|
+
|
|
808
829
|
## The Arcade's FPS overlay
|
|
809
830
|
|
|
810
831
|
The Arcade has a frame-rate toggle beside your game, and **you do not have to write anything for it
|
|
@@ -876,15 +897,15 @@ player (`gem.player`), room members, leaderboard rows, friends, profiles, showca
|
|
|
876
897
|
async opponent you read through the raw client, once you pass the row through `mapIdentity`. One
|
|
877
898
|
renderer serves all of them.
|
|
878
899
|
|
|
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`
|
|
900
|
+
| Field | What it is | Type |
|
|
901
|
+
| --------------- | ------------------------------------------------------------------------------------------- | ------------ |
|
|
902
|
+
| `playerId` | The player's id. **Absent on an anonymous row** | `string` |
|
|
903
|
+
| `displayName` | The name the player chose | `PlayerText` |
|
|
904
|
+
| `discriminator` | The digits that tell two same-named players apart — `0001`, no `#` | `string` |
|
|
905
|
+
| `displayTag` | The precomposed `Name#0001` | `PlayerText` |
|
|
906
|
+
| `avatarIconId` | The portrait item's id | `string` |
|
|
907
|
+
| `avatarIconUrl` | The portrait's thumbnail | `string` |
|
|
908
|
+
| `badges` | Equipped badges in display order, each `{ itemId, iconUrl }` — always a list, empty for now | array |
|
|
888
909
|
|
|
889
910
|
**The name and the tag are player-authored, so both are `PlayerText`** on every surface, not only
|
|
890
911
|
some. Convert with `text.toPlain()` where you render, never before.
|
|
@@ -937,11 +958,11 @@ While it lasts the player earns Gems and Tickets faster (never achievement point
|
|
|
937
958
|
platform raises their earning limits to match. The platform does all of that on its own side when
|
|
938
959
|
it pays; your game does nothing to make a boost work.
|
|
939
960
|
|
|
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
|
|
961
|
+
| Field | What it is | Type |
|
|
962
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
|
|
963
|
+
| `boost.active` | Whether any currency earns faster than 1× right now | `boolean` |
|
|
964
|
+
| `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 |
|
|
965
|
+
| `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
966
|
|
|
946
967
|
`boost` is always present on `gem.player`. When the Arcade has not said — an older Arcade, a
|
|
947
968
|
backend without boosts, a read that has not landed yet — it reads as **not boosted**, exactly like a
|