@mythryl/app-sdk 0.1.1 → 0.1.2
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 +15 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,8 +32,21 @@ on the server. Call it from effects and event handlers, which run in the browser
|
|
|
32
32
|
|
|
33
33
|
### Events
|
|
34
34
|
|
|
35
|
-
`minimised` and `maximised` are sent when the person hides the app and brings it back. `
|
|
36
|
-
|
|
35
|
+
`minimised` and `maximised` are sent when the person hides the app and brings it back. `colorSchemeChanged` is sent with
|
|
36
|
+
`"light"` or `"dark"` when the host switches mode. `closing` and `resized` are defined by the protocol; hosts do not send
|
|
37
|
+
them yet. `closing` is best effort and must not be relied on to save state.
|
|
38
|
+
|
|
39
|
+
### Light and dark mode
|
|
40
|
+
|
|
41
|
+
`sdk.getContext()` returns the host's current mode in `client.colorScheme`, and the `colorSchemeChanged` event reports
|
|
42
|
+
each change. What the app does with it is up to the app.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const { client } = await sdk.getContext();
|
|
46
|
+
setMode(client.colorScheme);
|
|
47
|
+
|
|
48
|
+
sdk.on("colorSchemeChanged", setMode);
|
|
49
|
+
```
|
|
37
50
|
|
|
38
51
|
### Signing in to your server
|
|
39
52
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export default sdk;
|
|
|
4
4
|
export { sdk };
|
|
5
5
|
export { createSdk, type Sdk } from "./sdk.js";
|
|
6
6
|
export { isEmbedded, windowTransport, type Transport } from "./transport.js";
|
|
7
|
-
export { EVENT_NAMES, ProtocolError, type AppContext, type Capability, type ErrorCode, type EventName, type Events } from "@mythryl/protocol";
|
|
7
|
+
export { EVENT_NAMES, ProtocolError, type AppContext, type Capability, type ColorScheme, type ErrorCode, type EventName, type Events, } from "@mythryl/protocol";
|
package/dist/index.js
CHANGED
|
@@ -6,4 +6,4 @@ export default sdk;
|
|
|
6
6
|
export { sdk };
|
|
7
7
|
export { createSdk } from "./sdk.js";
|
|
8
8
|
export { isEmbedded, windowTransport } from "./transport.js";
|
|
9
|
-
export { EVENT_NAMES, ProtocolError } from "@mythryl/protocol";
|
|
9
|
+
export { EVENT_NAMES, ProtocolError, } from "@mythryl/protocol";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mythryl/app-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "The browser SDK for Mythryl mini apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mythryl/protocol": "0.1.
|
|
29
|
+
"@mythryl/protocol": "0.1.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "~6.0.3",
|