@legendapp/spark 0.0.5 → 0.0.6
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 +3 -3
- package/skills/spark/UPGRADING.md +47 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/expo-desktop-template-bare-minimum-55.83.10.tgz +0 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +5 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +9 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +11 -11
- package/vendor/node_modules/@legendapp/spark-cli/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-codex/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +15 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-processes/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/heading.tsx +14 -0
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +34 -22
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +12 -10
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +27 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +6 -5
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-file-dialog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "src/index",
|
|
5
5
|
"react-native": "src/index",
|
|
6
6
|
"codegenConfig": {
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"private": true,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
41
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-file-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
38
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
39
39
|
},
|
|
40
40
|
"private": true
|
|
41
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-global-shortcuts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
37
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
38
38
|
},
|
|
39
39
|
"private": true
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-native-enriched-html": "1.1.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legendapp/spark-rich-text": "0.0.
|
|
17
|
+
"@legendapp/spark-rich-text": "0.0.6"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"react-native-enriched-html": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-markdown",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react-native-enriched-markdown": "1.1.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legendapp/spark-rich-text": "0.0.
|
|
17
|
+
"@legendapp/spark-rich-text": "0.0.6"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"react-native-enriched-markdown": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-message-dialog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
36
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
37
37
|
},
|
|
38
38
|
"private": true
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-native-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "src/index",
|
|
5
5
|
"react-native": "src/index",
|
|
6
6
|
"codegenConfig": {
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"private": true,
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
38
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-notifications",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
36
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
37
37
|
},
|
|
38
38
|
"private": true
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-processes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
37
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
38
38
|
},
|
|
39
39
|
"private": true
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-rich-text",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"react-native": "0.83.10"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@legendapp/spark-desktop-shortcuts": "0.0.
|
|
16
|
+
"@legendapp/spark-desktop-shortcuts": "0.0.6"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-secure-storage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
37
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"expo-secure-store": {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-settings",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"src"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@legendapp/spark-file-system": "0.0.
|
|
10
|
+
"@legendapp/spark-file-system": "0.0.6",
|
|
11
11
|
"@legendapp/state": "^3.0.0-beta.42",
|
|
12
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
12
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
13
13
|
},
|
|
14
14
|
"private": true,
|
|
15
15
|
"spark": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-settings-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.tsx",
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-ui": "0.0.
|
|
12
|
-
"@legendapp/spark-desktop-windows": "0.0.
|
|
13
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
11
|
+
"@legendapp/spark-ui": "0.0.6",
|
|
12
|
+
"@legendapp/spark-desktop-windows": "0.0.6",
|
|
13
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^19.2.0",
|
|
17
17
|
"react-native": "0.83.10",
|
|
18
|
-
"@legendapp/list": ">=3.3.
|
|
18
|
+
"@legendapp/list": ">=3.3.4"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlatformColor, StyleSheet, Text } from "react-native";
|
|
2
|
+
|
|
3
|
+
export const settingsRowInset = 12;
|
|
4
|
+
export const settingsHeadingGap = 10;
|
|
5
|
+
|
|
6
|
+
export function SettingsHeading({ title, variant }: { title: string; variant: "page" | "section" }) {
|
|
7
|
+
return <Text accessibilityRole="header" style={[styles.inset, styles[variant], { color: PlatformColor("labelColor") }]}>{title}</Text>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
inset: { marginHorizontal: settingsRowInset },
|
|
12
|
+
page: { fontSize: 17, lineHeight: 22, fontWeight: "400" },
|
|
13
|
+
section: { fontSize: 13, lineHeight: 16, fontWeight: "600" },
|
|
14
|
+
});
|
|
@@ -6,6 +6,7 @@ import { identifier } from "@legendapp/spark-ui/src/specialized";
|
|
|
6
6
|
import { SparkError, nativeError } from "@legendapp/spark-desktop-app/src/contracts";
|
|
7
7
|
import { Children, Fragment, isValidElement, type ReactNode, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { Platform, PlatformColor, StyleSheet, Text, View } from "react-native";
|
|
9
|
+
import { SettingsHeading, settingsHeadingGap } from "./heading";
|
|
9
10
|
|
|
10
11
|
export * from "./options";
|
|
11
12
|
export * from "./rows";
|
|
@@ -19,6 +20,7 @@ export interface SettingsPageProps<PageId extends string = string> {
|
|
|
19
20
|
id: PageId;
|
|
20
21
|
title: string;
|
|
21
22
|
icon: string;
|
|
23
|
+
heading?: string | false;
|
|
22
24
|
children: ReactNode;
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -67,6 +69,7 @@ function useSettingsSelection<PageId extends string>(props: SettingsWindowProps<
|
|
|
67
69
|
identifier(page.id, "settings page ID");
|
|
68
70
|
identifier(page.title, "settings page title");
|
|
69
71
|
identifier(page.icon, "settings page icon");
|
|
72
|
+
if (page.heading !== undefined && page.heading !== false) identifier(page.heading, "settings page heading");
|
|
70
73
|
if (ids.has(page.id)) throw new SparkError("E_INVALID_ARGUMENT", "Settings page IDs must be unique");
|
|
71
74
|
ids.add(page.id);
|
|
72
75
|
}
|
|
@@ -79,12 +82,11 @@ function useSettingsSelection<PageId extends string>(props: SettingsWindowProps<
|
|
|
79
82
|
useEffect(() => { if (!controlled && local !== selected) setLocal(selected); }, [controlled, local, selected]);
|
|
80
83
|
const [revision, setRevision] = useState(0);
|
|
81
84
|
const requestSelection = useCallback((id: PageId) => {
|
|
82
|
-
if (selected === id) return;
|
|
83
85
|
// A controlled parent may keep its value, so request a scroll even if it stays the same.
|
|
84
86
|
if (controlled) setRevision(value => value + 1);
|
|
85
87
|
else setLocal(id);
|
|
86
88
|
onSelectionChange?.(id);
|
|
87
|
-
}, [controlled, onSelectionChange
|
|
89
|
+
}, [controlled, onSelectionChange]);
|
|
88
90
|
return { selected, requestSelection, revision };
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -132,19 +134,19 @@ export function VirtualizedSettingsWindow<PageId extends string = string>(props:
|
|
|
132
134
|
const { selected, requestSelection, revision } = useSettingsSelection(props, pages);
|
|
133
135
|
const listRef = useRef<LegendListRef | null>(null);
|
|
134
136
|
const pageIndex = pages.findIndex(page => page.id === selected);
|
|
137
|
+
const lastPageIndex = pages.length - 1;
|
|
138
|
+
const anchoredEndSpace = useMemo(() => ({ anchorIndex: lastPageIndex, anchorOffset: TITLEBAR_HEIGHT }), [lastPageIndex]);
|
|
135
139
|
const { onResize, markContentReady, report } = useSettingsWindow(windowId, pages[pageIndex].title, appearance, onError);
|
|
136
|
-
const [
|
|
137
|
-
const hasLayout = viewportHeight > 0;
|
|
140
|
+
const [hasLayout, setHasLayout] = useState(false);
|
|
138
141
|
const scrollingToPage = useRef(false);
|
|
139
142
|
const visiblePage = useRef<PageId | undefined>(undefined);
|
|
140
143
|
const initialized = useRef(false);
|
|
141
144
|
|
|
142
145
|
useEffect(() => {
|
|
143
|
-
if (!hasLayout) return;
|
|
146
|
+
if (!hasLayout || (initialized.current && visiblePage.current === selected)) return;
|
|
144
147
|
let current = true;
|
|
145
148
|
scrollingToPage.current = true;
|
|
146
149
|
const frame = requestAnimationFrame(() => {
|
|
147
|
-
if (visiblePage.current === selected && initialized.current) { scrollingToPage.current = false; return; }
|
|
148
150
|
const list = listRef.current;
|
|
149
151
|
if (!list) { report(new SparkError("E_UNAVAILABLE", "Settings list is not mounted")); return; }
|
|
150
152
|
visiblePage.current = undefined;
|
|
@@ -158,15 +160,22 @@ export function VirtualizedSettingsWindow<PageId extends string = string>(props:
|
|
|
158
160
|
markContentReady();
|
|
159
161
|
});
|
|
160
162
|
});
|
|
161
|
-
return () => {
|
|
163
|
+
return () => {
|
|
164
|
+
current = false;
|
|
165
|
+
scrollingToPage.current = false;
|
|
166
|
+
cancelAnimationFrame(frame);
|
|
167
|
+
};
|
|
162
168
|
}, [hasLayout, markContentReady, pageIndex, report, revision, selected]);
|
|
163
169
|
|
|
164
170
|
const onScroll = useCallback(() => {
|
|
165
171
|
if (!initialized.current || scrollingToPage.current) return;
|
|
166
172
|
const state = listRef.current?.getState();
|
|
167
|
-
if (!state || state.start < 0) return;
|
|
173
|
+
if (!state || state.start == null || state.start < 0) return;
|
|
174
|
+
// LegendList item positions exclude the top padding that matches the overlay title bar.
|
|
175
|
+
const paneTop = state.scroll + 0.5;
|
|
168
176
|
let index = state.start;
|
|
169
|
-
while (index
|
|
177
|
+
while (index > 0 && state.positionAtIndex(index) > paneTop) index--;
|
|
178
|
+
while (index < pages.length - 1 && state.positionAtIndex(index + 1) <= paneTop) index++;
|
|
170
179
|
const page = pages[index];
|
|
171
180
|
if (page && visiblePage.current !== page.id) {
|
|
172
181
|
visiblePage.current = page.id;
|
|
@@ -174,20 +183,12 @@ export function VirtualizedSettingsWindow<PageId extends string = string>(props:
|
|
|
174
183
|
}
|
|
175
184
|
}, [pages, requestSelection]);
|
|
176
185
|
|
|
177
|
-
// Keep short pages tall enough to align at the top and avoid opening on two pages at once.
|
|
178
|
-
const pageHeight = Math.max(0, viewportHeight - TITLEBAR_HEIGHT);
|
|
179
|
-
const renderItem = useCallback(({ item }: LegendListRenderItemProps<SettingsPageProps<PageId>>) => (
|
|
180
|
-
<View style={[styles.page, { minHeight: pageHeight }]}>
|
|
181
|
-
{item.children}
|
|
182
|
-
</View>
|
|
183
|
-
), [pageHeight]);
|
|
184
|
-
|
|
185
186
|
return (
|
|
186
187
|
<SidebarSplitView appearance={appearance} contentMinWidth={340} sidebarMinWidth={180} sidebarWidth={200} titleBar={titleBar} style={styles.fill}
|
|
187
|
-
onResize={event => { if (event.contentWidth > 0)
|
|
188
|
+
onResize={event => { if (event.contentWidth > 0) setHasLayout(event.contentHeight > 0); onResize(event); }} onError={report}
|
|
188
189
|
sidebar={
|
|
189
190
|
<Sidebar defaultRowHeight={30} contentInsetTop={66} selectedId={selected} style={styles.fill} onError={report}
|
|
190
|
-
onSelectionChange={({ id }) => { if (id !== null) requestSelection(id as PageId); }}>
|
|
191
|
+
onSelectionChange={({ id }) => { if (id !== null && id !== selected) requestSelection(id as PageId); }}>
|
|
191
192
|
{pages.map(({ id, title, icon }) => {
|
|
192
193
|
const active = id === selected;
|
|
193
194
|
const foreground = active ? PlatformColor("alternateSelectedControlTextColor") : PlatformColor("labelColor");
|
|
@@ -205,7 +206,7 @@ export function VirtualizedSettingsWindow<PageId extends string = string>(props:
|
|
|
205
206
|
</Sidebar>
|
|
206
207
|
}
|
|
207
208
|
content={hasLayout ? (
|
|
208
|
-
<LegendList ref={listRef} data={pages} keyExtractor={pageKey} renderItem={
|
|
209
|
+
<LegendList ref={listRef} data={pages} keyExtractor={pageKey} renderItem={renderPage} anchoredEndSpace={anchoredEndSpace}
|
|
209
210
|
contentContainerStyle={styles.listContent} contentInsetAdjustmentBehavior="never"
|
|
210
211
|
onFirstVisibleItemChanged={onScroll} onScroll={onScroll} scrollEventThrottle={16} style={styles.fill} />
|
|
211
212
|
) : null}
|
|
@@ -217,10 +218,21 @@ export { VirtualizedSettingsWindow as SettingsWindow };
|
|
|
217
218
|
|
|
218
219
|
const pageKey = (page: SettingsPageProps) => page.id;
|
|
219
220
|
|
|
221
|
+
function renderPage({ item }: LegendListRenderItemProps<SettingsPageProps>) {
|
|
222
|
+
const { heading = item.title, children } = item;
|
|
223
|
+
return (
|
|
224
|
+
<View style={styles.page}>
|
|
225
|
+
{heading !== false && <SettingsHeading title={heading} variant="page" />}
|
|
226
|
+
<View style={styles.pageBody}>{children}</View>
|
|
227
|
+
</View>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
220
231
|
const styles = StyleSheet.create({
|
|
221
232
|
fill: { flex: 1, minWidth: 0 },
|
|
222
|
-
listContent: { paddingTop: TITLEBAR_HEIGHT },
|
|
223
|
-
page: { alignSelf: "center", width: "100%", maxWidth: 760,
|
|
233
|
+
listContent: { paddingTop: TITLEBAR_HEIGHT, paddingBottom: 20 },
|
|
234
|
+
page: { alignSelf: "center", width: "100%", maxWidth: 760, paddingHorizontal: 20, paddingTop: 20, gap: settingsHeadingGap },
|
|
235
|
+
pageBody: { gap: 20 },
|
|
224
236
|
sidebarRow: { flexDirection: "row", alignItems: "center", height: 30, gap: 10, paddingHorizontal: 10 },
|
|
225
237
|
sidebarIcon: { width: 20, height: 20, alignItems: "center", justifyContent: "center" },
|
|
226
238
|
sidebarLabel: { fontSize: 13, flexShrink: 1 },
|
|
@@ -5,6 +5,7 @@ import { SparkError } from "@legendapp/spark-desktop-app/src/contracts";
|
|
|
5
5
|
import { Children, Fragment, useState, type ReactNode } from "react";
|
|
6
6
|
import * as RN from "react-native";
|
|
7
7
|
import type { ColorValue, ImageSourcePropType, NativeSyntheticEvent } from "react-native";
|
|
8
|
+
import { SettingsHeading, settingsHeadingGap, settingsRowInset } from "./heading";
|
|
8
9
|
|
|
9
10
|
const { Image, Platform, PlatformColor, Pressable, StyleSheet, Text, View } = RN;
|
|
10
11
|
|
|
@@ -59,7 +60,7 @@ export function SettingsSection({ title, children }: SettingsSectionProps) {
|
|
|
59
60
|
if (Platform.OS !== "macos") throw new SparkError("E_UNSUPPORTED_PLATFORM", "Settings sections require macOS");
|
|
60
61
|
return (
|
|
61
62
|
<View style={styles.section}>
|
|
62
|
-
{title ? <
|
|
63
|
+
{title ? <SettingsHeading title={title} variant="section" /> : null}
|
|
63
64
|
<View style={styles.card}>
|
|
64
65
|
{Children.toArray(children).map((child, index) => (
|
|
65
66
|
<Fragment key={typeof child === "object" && "key" in child ? child.key : index}>
|
|
@@ -75,7 +76,7 @@ export function SettingsSection({ title, children }: SettingsSectionProps) {
|
|
|
75
76
|
function Row({ label, description, info, children, disabled, imageChoice }: SettingsRowProps & { disabled?: boolean; imageChoice?: boolean }) {
|
|
76
77
|
if (Platform.OS !== "macos") throw new SparkError("E_UNSUPPORTED_PLATFORM", "Settings rows require macOS");
|
|
77
78
|
return (
|
|
78
|
-
<View style={[styles.row, imageChoice && styles.imageRow]}>
|
|
79
|
+
<View style={[styles.row, description && styles.rowWithDescription, imageChoice && styles.imageRow]}>
|
|
79
80
|
<View style={[styles.rowText, imageChoice && styles.imageRowText]}>
|
|
80
81
|
<View style={styles.labelLine}>
|
|
81
82
|
<Text style={[styles.label, { color: PlatformColor(disabled ? "tertiaryLabelColor" : "labelColor") }]}>{label}</Text>
|
|
@@ -100,7 +101,7 @@ function accessibility({ label, description, info }: RowText) {
|
|
|
100
101
|
|
|
101
102
|
export function SettingsSwitchRow({ value, onValueChange, disabled, ...text }: SettingsSwitchRowProps) {
|
|
102
103
|
return <Row {...text} disabled={disabled}>
|
|
103
|
-
<Switch value={value} onValueChange={onValueChange} disabled={disabled} {...accessibility(text)}
|
|
104
|
+
<View style={styles.switchControl}><Switch value={value} onValueChange={onValueChange} disabled={disabled} {...accessibility(text)} /></View>
|
|
104
105
|
</Row>;
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -112,7 +113,7 @@ export function SettingsSelectRow({ value, options, onValueChange, disabled, ...
|
|
|
112
113
|
|
|
113
114
|
export function SettingsSegmentedRow({ value, options, onValueChange, disabled, ...text }: SettingsSegmentedRowProps) {
|
|
114
115
|
return <Row {...text} disabled={disabled}>
|
|
115
|
-
<SegmentedControl options={options} value={value} onValueChange={onValueChange} disabled={disabled}
|
|
116
|
+
<SegmentedControl options={options} value={value} onValueChange={onValueChange} disabled={disabled} {...accessibility(text)} />
|
|
116
117
|
</Row>;
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -160,20 +161,21 @@ export function SettingsImageChoiceRow({ options, value, onValueChange, disabled
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
const styles = StyleSheet.create({
|
|
163
|
-
section: { gap:
|
|
164
|
-
heading: { fontSize: 13, lineHeight: 16, fontWeight: "600", marginHorizontal: 10 },
|
|
164
|
+
section: { gap: settingsHeadingGap },
|
|
165
165
|
card: { backgroundColor: cardColor, borderRadius: 10, overflow: "hidden" },
|
|
166
|
-
divider: { height: StyleSheet.hairlineWidth, marginHorizontal:
|
|
167
|
-
row: { flexDirection: "row", alignItems: "center", minHeight: 42,
|
|
168
|
-
rowText: { flex: 1, minWidth: 0, gap:
|
|
166
|
+
divider: { height: StyleSheet.hairlineWidth, marginHorizontal: settingsRowInset },
|
|
167
|
+
row: { flexDirection: "row", alignItems: "center", minHeight: 42, paddingHorizontal: settingsRowInset, paddingVertical: 10, gap: 12 },
|
|
168
|
+
rowText: { flex: 1, minWidth: 0, gap: 3 },
|
|
169
|
+
rowWithDescription: { paddingVertical: 11 },
|
|
169
170
|
labelLine: { flexDirection: "row", alignItems: "flex-start", gap: 6 },
|
|
170
171
|
label: { fontSize: 13, lineHeight: 16, flexShrink: 1 },
|
|
171
172
|
description: { fontSize: 11, lineHeight: 14 },
|
|
172
173
|
info: { marginTop: 1.5 },
|
|
173
174
|
control: { flexShrink: 1, alignItems: "flex-end" },
|
|
175
|
+
switchControl: { height: 22, justifyContent: "center" },
|
|
174
176
|
selection: { height: 22, width: 190 },
|
|
175
177
|
imageControl: { maxWidth: "70%" },
|
|
176
|
-
imageRow: { alignItems: "flex-start"
|
|
178
|
+
imageRow: { alignItems: "flex-start" },
|
|
177
179
|
imageRowText: { paddingTop: 5 },
|
|
178
180
|
choices: { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", gap: 20 },
|
|
179
181
|
choice: { width: 76, alignItems: "center", gap: 6 },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-sqlite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
12
|
-
"@legendapp/spark-file-system": "0.0.
|
|
11
|
+
"@legendapp/spark-desktop-app": "0.0.6",
|
|
12
|
+
"@legendapp/spark-file-system": "0.0.6"
|
|
13
13
|
},
|
|
14
14
|
"private": true,
|
|
15
15
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
36
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
37
37
|
},
|
|
38
38
|
"private": true
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-tray",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
36
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
37
37
|
},
|
|
38
38
|
"private": true
|
|
39
39
|
}
|
package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm
CHANGED
|
@@ -19,6 +19,7 @@ using namespace facebook::react;
|
|
|
19
19
|
NSString *_value;
|
|
20
20
|
NSArray<NSString *> *_labels;
|
|
21
21
|
BOOL _isUpdatingSelection;
|
|
22
|
+
NSSize _reportedSize;
|
|
22
23
|
#else
|
|
23
24
|
UIView *_segmentedControl;
|
|
24
25
|
#endif
|
|
@@ -107,6 +108,20 @@ using namespace facebook::react;
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
- (void)reportIntrinsicSize
|
|
112
|
+
{
|
|
113
|
+
if (_labels.count == 0 || _segmentedControl.segmentDistribution != NSSegmentDistributionFit) return;
|
|
114
|
+
auto emitter = std::static_pointer_cast<const NativeSegmentedControlEventEmitter>(_eventEmitter);
|
|
115
|
+
NSSize size = _segmentedControl.intrinsicContentSize;
|
|
116
|
+
size = NSMakeSize(ceil(size.width), ceil(size.height));
|
|
117
|
+
if (!emitter || NSEqualSizes(size, _reportedSize)) return;
|
|
118
|
+
_reportedSize = size;
|
|
119
|
+
NativeSegmentedControlEventEmitter::OnIntrinsicSize event;
|
|
120
|
+
event.width = size.width;
|
|
121
|
+
event.height = size.height;
|
|
122
|
+
emitter->onIntrinsicSize(event);
|
|
123
|
+
}
|
|
124
|
+
|
|
110
125
|
- (void)selectValue:(NSString *)value
|
|
111
126
|
{
|
|
112
127
|
_isUpdatingSelection = YES;
|
|
@@ -171,6 +186,17 @@ using namespace facebook::react;
|
|
|
171
186
|
_segmentedControl.accessibilityIdentifier = [NSString stringWithUTF8String:newProps.testId.c_str()];
|
|
172
187
|
#endif
|
|
173
188
|
[super updateProps:props oldProps:oldProps];
|
|
189
|
+
#if TARGET_OS_OSX
|
|
190
|
+
[self reportIntrinsicSize];
|
|
191
|
+
#endif
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
- (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
|
|
195
|
+
{
|
|
196
|
+
[super updateEventEmitter:eventEmitter];
|
|
197
|
+
#if TARGET_OS_OSX
|
|
198
|
+
[self reportIntrinsicSize];
|
|
199
|
+
#endif
|
|
174
200
|
}
|
|
175
201
|
|
|
176
202
|
- (void)prepareForRecycle
|
|
@@ -182,6 +208,7 @@ using namespace facebook::react;
|
|
|
182
208
|
_segmentsJson = @"";
|
|
183
209
|
_value = @"";
|
|
184
210
|
_isUpdatingSelection = NO;
|
|
211
|
+
_reportedSize = NSZeroSize;
|
|
185
212
|
_segmentedControl.segmentCount = 0;
|
|
186
213
|
_segmentedControl.enabled = YES;
|
|
187
214
|
_segmentedControl.accessibilityHelp = nil;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"react-native": "src/index",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"clsx": "^2.1.1",
|
|
72
72
|
"tailwind-merge": "^3.4.0",
|
|
73
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
73
|
+
"@legendapp/spark-desktop-app": "0.0.6"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -16,8 +16,7 @@ export { Switch } from "./switch";
|
|
|
16
16
|
export type { SwitchProps, ButtonProps, CheckboxProps, RadioGroupProps, TextInputProps, ControlledTextInputProps, UncontrolledTextInputProps, SelectProps, SelectOption, SegmentedControlProps, ControlProps, ControlRef, ControlKind } from "./types";
|
|
17
17
|
export { getControlAvailability } from "./availability";
|
|
18
18
|
|
|
19
|
-
// AppKit
|
|
20
|
-
// WinUI buttons do not, so they keep a fixed default frame.
|
|
19
|
+
// AppKit controls can report their intrinsic size. Explicit styles take precedence.
|
|
21
20
|
function useIntrinsicSize(control: ReturnType<typeof useControl>) {
|
|
22
21
|
const [size, setSize] = useState<{ width: number; height: number }>();
|
|
23
22
|
function measured(event: NativeSyntheticEvent<{ width: number; height: number }>) {
|
|
@@ -68,11 +67,13 @@ export function TextInput(props: TextInputProps) {
|
|
|
68
67
|
if (control.failed) return <View ref={control.ref} style={[size, style]} testID={testID} accessible accessibilityLabel={accessibilityLabel} accessibilityState={{ disabled: true }}><Text>{value.controlled ? value.text : value.defaultText}</Text></View>;
|
|
69
68
|
return <NativeTextInput ref={control.ref} text={value.text} defaultText={value.defaultText} controlled={value.controlled} eventCount={value.eventCount} disabled={control.disabled} placeholder={placeholder} multiline={multiline} onTextChange={changed} onUnavailable={control.unavailable} accessibilityLabel={accessibilityLabel} testID={testID} style={[size, style]} />;
|
|
70
69
|
}
|
|
71
|
-
function Selection({ segmented, ...props }: SelectProps & { segmented: boolean }) {
|
|
70
|
+
function Selection({ segmented, size = "regular", distribution = "fit", ...props }: SelectProps & Pick<SegmentedControlProps, "size" | "distribution"> & { segmented: boolean }) {
|
|
72
71
|
selectionIndex(props.options, props.value);
|
|
73
72
|
if (typeof props.onValueChange !== "function") throw new SparkError("E_INVALID_ARGUMENT", "Expected onValueChange");
|
|
74
73
|
const { variant = "default" } = props;
|
|
75
74
|
const control = useControl(props, variant === "borderless" && Platform.OS !== "macos" ? unsupportedPlatform : getControlAvailability(segmented ? "segmented-control" : "select"));
|
|
75
|
+
const intrinsic = useIntrinsicSize(control);
|
|
76
|
+
const fit = segmented && Platform.OS === "macos" && distribution === "fit";
|
|
76
77
|
const [selectionRevision, revise] = useState(0);
|
|
77
78
|
const { options, value, onValueChange, accessibilityLabel, accessibilityHint, style, testID } = props;
|
|
78
79
|
function changed(event: NativeSyntheticEvent<{ value: string }>) {
|
|
@@ -81,9 +82,9 @@ function Selection({ segmented, ...props }: SelectProps & { segmented: boolean }
|
|
|
81
82
|
if (!options.some(option => option.value === next)) { control.error(new SparkError("E_INVALID_DATA", "Native selection is not an option")); return; }
|
|
82
83
|
revise(revision => revision + 1); onValueChange(next);
|
|
83
84
|
}
|
|
84
|
-
const common = { ref: control.ref, value, accessibilityLabel, accessibilityHint, testID, style: [{ width: 240, height: 36 }, style], selectionRevision };
|
|
85
|
+
const common = { ref: control.ref, value, accessibilityLabel, accessibilityHint, testID, style: [fit && intrinsic.frame ? intrinsic.frame : { width: 240, height: 36 }, style], selectionRevision };
|
|
85
86
|
if (control.failed) return <View ref={control.ref} style={common.style} testID={testID} accessible accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} accessibilityState={{ disabled: true }}><Text>{options.find(option => option.value === value)!.label}</Text></View>;
|
|
86
|
-
if (segmented) return <NativeSegmentedControl {...common} segmentsJson={JSON.stringify(options)} enabled={!control.disabled} controlSize={
|
|
87
|
+
if (segmented) return <NativeSegmentedControl {...common} segmentsJson={JSON.stringify(options)} enabled={!control.disabled} controlSize={size} distribution={distribution} onIntrinsicSize={fit ? intrinsic.measured : undefined} onValueChange={changed} />;
|
|
87
88
|
if (Platform.OS === "windows") return <WindowsSelect {...common} itemsJson={JSON.stringify(options)} disabled={control.disabled} onSelectionChange={changed} onUnavailable={control.unavailable} />;
|
|
88
89
|
return <NativeSelect {...common} borderless={variant === "borderless"} itemsJson={JSON.stringify(options)} enabled={!control.disabled} onValueChange={changed} />;
|
|
89
90
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HostComponent, ViewProps } from "react-native";
|
|
2
2
|
import { codegenNativeComponent } from "react-native";
|
|
3
|
-
import type { DirectEventHandler, Int32, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
|
+
import type { DirectEventHandler, Double, Int32, WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
4
4
|
|
|
5
5
|
export type NativeSegmentedControlChangeEvent = {
|
|
6
6
|
value: string;
|
|
@@ -12,6 +12,7 @@ export interface NativeProps extends ViewProps {
|
|
|
12
12
|
distribution?: WithDefault<"fit" | "fill", "fit">;
|
|
13
13
|
selectionRevision?: Int32;
|
|
14
14
|
segmentsJson: string;
|
|
15
|
+
onIntrinsicSize?: DirectEventHandler<Readonly<{ width: Double; height: Double }>>;
|
|
15
16
|
onValueChange?: DirectEventHandler<NativeSegmentedControlChangeEvent>;
|
|
16
17
|
value: string;
|
|
17
18
|
}
|