ink-framework 0.1.0-alpha.13 → 0.1.0-alpha.14
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/package.json +1 -1
- package/src/controller.ts +9 -2
- package/src/icons.ts +2 -0
- package/src/index.ts +1 -0
- package/src/playing.ts +4 -4
package/package.json
CHANGED
package/src/controller.ts
CHANGED
|
@@ -16,8 +16,12 @@ export function attachNativeController(
|
|
|
16
16
|
if (observers.size >= 256) throw new NativeError("busy", "Too many native controllers");
|
|
17
17
|
const id = __inkNextId();
|
|
18
18
|
let disposed = false;
|
|
19
|
+
let activated = false;
|
|
19
20
|
observers.set(id, observe);
|
|
20
|
-
const ready = callNative(module, "activate", recipe, { controller: id }).
|
|
21
|
+
const ready = callNative(module, "activate", recipe, { controller: id }).then(value => {
|
|
22
|
+
activated = true;
|
|
23
|
+
return value;
|
|
24
|
+
}).catch(error => {
|
|
21
25
|
disposed = true;
|
|
22
26
|
observers.delete(id);
|
|
23
27
|
throw error;
|
|
@@ -36,7 +40,10 @@ export function attachNativeController(
|
|
|
36
40
|
if (disposed) return;
|
|
37
41
|
disposed = true;
|
|
38
42
|
observers.delete(id);
|
|
39
|
-
|
|
43
|
+
// Release an active owner before the next effect attaches its replacement.
|
|
44
|
+
if (!activated) {
|
|
45
|
+
try { await ready; } catch { return; }
|
|
46
|
+
}
|
|
40
47
|
await callNative(module, "deactivate", {}, { controller: id });
|
|
41
48
|
},
|
|
42
49
|
};
|
package/src/icons.ts
CHANGED
|
@@ -3259,6 +3259,7 @@ export const forward = "outlined:forward" as IconAsset;
|
|
|
3259
3259
|
export const forwardFilled = "filled:forward" as IconAsset;
|
|
3260
3260
|
export const forward10 = "outlined:forward_10" as IconAsset;
|
|
3261
3261
|
export const forward10Filled = "filled:forward_10" as IconAsset;
|
|
3262
|
+
export const forward15Filled = "filled:forward_15" as IconAsset;
|
|
3262
3263
|
export const forward30 = "outlined:forward_30" as IconAsset;
|
|
3263
3264
|
export const forward30Filled = "filled:forward_30" as IconAsset;
|
|
3264
3265
|
export const forward5 = "outlined:forward_5" as IconAsset;
|
|
@@ -6151,6 +6152,7 @@ export const replay = "outlined:replay" as IconAsset;
|
|
|
6151
6152
|
export const replayFilled = "filled:replay" as IconAsset;
|
|
6152
6153
|
export const replay10 = "outlined:replay_10" as IconAsset;
|
|
6153
6154
|
export const replay10Filled = "filled:replay_10" as IconAsset;
|
|
6155
|
+
export const replay15Filled = "filled:replay_15" as IconAsset;
|
|
6154
6156
|
export const replay30 = "outlined:replay_30" as IconAsset;
|
|
6155
6157
|
export const replay30Filled = "filled:replay_30" as IconAsset;
|
|
6156
6158
|
export const replay5 = "outlined:replay_5" as IconAsset;
|
package/src/index.ts
CHANGED
|
@@ -78,6 +78,7 @@ export type TextProps<D extends Destination = Destination> = PressProps<D> & {
|
|
|
78
78
|
align?: "start" | "center" | "end" | "justify";
|
|
79
79
|
maxLines?: number;
|
|
80
80
|
tabularNumbers?: boolean;
|
|
81
|
+
strikethrough?: boolean;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
// Keep text as a host element while checking literal route parameters in JSX.
|
package/src/playing.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { createElement, useRef } from "./react";
|
|
|
2
2
|
import { Screen, ErrorState, type IconAsset } from "./index";
|
|
3
3
|
import { useAction } from "./action";
|
|
4
4
|
import { playbackController } from "./playback-binding";
|
|
5
|
-
import { forward10Filled, forward30Filled, forward5Filled, pauseFilled, playArrowFilled, replay10Filled, replay30Filled, replay5Filled, skipNextFilled, skipPreviousFilled } from "./icons";
|
|
5
|
+
import { forward10Filled, forward15Filled, forward30Filled, forward5Filled, pauseFilled, playArrowFilled, replay10Filled, replay15Filled, replay30Filled, replay5Filled, skipNextFilled, skipPreviousFilled } from "./icons";
|
|
6
6
|
|
|
7
7
|
type PlaybackAction = () => void | Promise<void>;
|
|
8
8
|
export interface Playback {
|
|
@@ -17,7 +17,7 @@ export interface Playback {
|
|
|
17
17
|
|
|
18
18
|
export type TransportControl = { onLongPress?: PlaybackAction; disabled?: boolean } & (
|
|
19
19
|
| { kind: "track"; seconds?: never; icon?: never; onPress?: never }
|
|
20
|
-
| { kind: "skip"; seconds: 5 | 10 | 30; icon?: never; onPress?: never }
|
|
20
|
+
| { kind: "skip"; seconds: 5 | 10 | 15 | 30; icon?: never; onPress?: never }
|
|
21
21
|
| { kind: "custom"; icon: IconAsset; onPress: PlaybackAction; seconds?: never }
|
|
22
22
|
);
|
|
23
23
|
export type PlayingScreenProps = {
|
|
@@ -32,8 +32,8 @@ export type PlayingScreenProps = {
|
|
|
32
32
|
actions?: readonly (({ icon: IconAsset; label?: never } | { label: string; icon?: never }) & { selected?: boolean; disabled?: boolean; onPress: PlaybackAction })[];
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const replayIcons = { 5: replay5Filled, 10: replay10Filled, 30: replay30Filled };
|
|
36
|
-
const forwardIcons = { 5: forward5Filled, 10: forward10Filled, 30: forward30Filled };
|
|
35
|
+
const replayIcons = { 5: replay5Filled, 10: replay10Filled, 15: replay15Filled, 30: replay30Filled };
|
|
36
|
+
const forwardIcons = { 5: forward5Filled, 10: forward10Filled, 15: forward15Filled, 30: forward30Filled };
|
|
37
37
|
|
|
38
38
|
export function PlayingScreen({ image, preloadImages = [], title, onTitlePress, artists, playback, previous = { kind: "track" }, next = { kind: "track" }, actions = [] }: PlayingScreenProps) {
|
|
39
39
|
const retry = useRef<PlaybackAction>(() => {});
|