mac-human-design 0.1.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/LICENSE +21 -0
- package/README.md +92 -0
- package/package.json +59 -0
- package/src/components/AppWindowShell.tsx +25 -0
- package/src/components/MacSegmentedControl.tsx +54 -0
- package/src/components/StatusMessage.tsx +52 -0
- package/src/components/SymbolIconButton.tsx +138 -0
- package/src/components/ViewDragRegion.tsx +18 -0
- package/src/components/index.ts +5 -0
- package/src/index.ts +18 -0
- package/src/symbols/SystemSymbolImage.tsx +72 -0
- package/src/symbols/index.ts +9 -0
- package/src/symbols/systemSymbolService.ts +68 -0
- package/src/symbols/useSystemSymbol.ts +75 -0
- package/src/tauri/index.ts +4 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/macosTheme.ts +570 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/isDraggableAreaTarget.ts +22 -0
- package/src-tauri/Cargo.toml +21 -0
- package/src-tauri/src/lib.rs +10 -0
- package/src-tauri/src/system_symbols.rs +66 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
buildSystemSymbolCacheKey,
|
|
4
|
+
calculateSystemSymbolPointSize,
|
|
5
|
+
getSystemSymbolDataUrl,
|
|
6
|
+
type SystemSymbolFetchOptions,
|
|
7
|
+
} from "./systemSymbolService";
|
|
8
|
+
|
|
9
|
+
type UseSystemSymbolInput = {
|
|
10
|
+
symbolName: string;
|
|
11
|
+
cssPixelSize: number;
|
|
12
|
+
options?: Omit<SystemSymbolFetchOptions, "pointSize">;
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function useSystemSymbol({
|
|
17
|
+
symbolName,
|
|
18
|
+
cssPixelSize,
|
|
19
|
+
options,
|
|
20
|
+
enabled = true,
|
|
21
|
+
}: UseSystemSymbolInput) {
|
|
22
|
+
const pointSize = calculateSystemSymbolPointSize(
|
|
23
|
+
cssPixelSize,
|
|
24
|
+
options && { fallbackPointSize: options.fallbackPointSize },
|
|
25
|
+
);
|
|
26
|
+
const cacheKey = buildSystemSymbolCacheKey(symbolName, pointSize);
|
|
27
|
+
|
|
28
|
+
const [value, setValue] = useState<string | null>(null);
|
|
29
|
+
const [error, setError] = useState<string | null>(null);
|
|
30
|
+
const [loading, setLoading] = useState(false);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let active = true;
|
|
34
|
+
|
|
35
|
+
if (!enabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setLoading(true);
|
|
40
|
+
getSystemSymbolDataUrl(symbolName, { pointSize })
|
|
41
|
+
.then((dataUrl) => {
|
|
42
|
+
if (!active) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
setValue(dataUrl);
|
|
46
|
+
})
|
|
47
|
+
.catch((invocationError) => {
|
|
48
|
+
if (!active) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (invocationError instanceof Error) {
|
|
52
|
+
setError(invocationError.message);
|
|
53
|
+
} else {
|
|
54
|
+
setError(String(invocationError));
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.finally(() => {
|
|
58
|
+
if (active) {
|
|
59
|
+
setLoading(false);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return () => {
|
|
64
|
+
active = false;
|
|
65
|
+
};
|
|
66
|
+
}, [symbolName, pointSize, cacheKey, enabled]);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
dataUrl: value,
|
|
70
|
+
loading,
|
|
71
|
+
error,
|
|
72
|
+
pointSize,
|
|
73
|
+
cacheKey,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./macosTheme";
|
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
import { createDarkTheme, createLightTheme, type Theme } from "baseui";
|
|
2
|
+
import type { StyleObject } from "styletron-standard";
|
|
3
|
+
|
|
4
|
+
type ThemedStyle<Props = {}> = (args: { $theme: Theme } & Props) => StyleObject;
|
|
5
|
+
type InputRootStyleProps = {
|
|
6
|
+
$isFocused?: boolean;
|
|
7
|
+
$disabled?: boolean;
|
|
8
|
+
$error?: boolean;
|
|
9
|
+
$positive?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type ButtonStyleProps = {
|
|
12
|
+
$kind?: string;
|
|
13
|
+
$isHovered?: boolean;
|
|
14
|
+
$isPressed?: boolean;
|
|
15
|
+
$disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type ToggleStyleProps = {
|
|
18
|
+
$checked?: boolean;
|
|
19
|
+
$disabled?: boolean;
|
|
20
|
+
$isFocusVisible?: boolean;
|
|
21
|
+
};
|
|
22
|
+
type ToggleTrackStyleProps = {
|
|
23
|
+
$checked?: boolean;
|
|
24
|
+
$disabled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type SegmentedStyleProps = {
|
|
27
|
+
$isActive?: boolean;
|
|
28
|
+
$focusVisible?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const MACOS_FONT_FAMILY =
|
|
32
|
+
'-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
33
|
+
|
|
34
|
+
function isDarkTheme(theme: Theme): boolean {
|
|
35
|
+
return theme.name.toLowerCase().includes("dark");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const sharedThemeOverrides = {
|
|
39
|
+
borders: {
|
|
40
|
+
radius100: "8px",
|
|
41
|
+
radius200: "10px",
|
|
42
|
+
radius300: "12px",
|
|
43
|
+
radius400: "14px",
|
|
44
|
+
buttonBorderRadius: "10px",
|
|
45
|
+
inputBorderRadius: "10px",
|
|
46
|
+
popoverBorderRadius: "12px",
|
|
47
|
+
surfaceBorderRadius: "14px",
|
|
48
|
+
checkboxBorderRadius: "6px",
|
|
49
|
+
tagBorderRadius: "999px",
|
|
50
|
+
},
|
|
51
|
+
typography: {
|
|
52
|
+
font100: {
|
|
53
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
54
|
+
fontSize: "11px",
|
|
55
|
+
lineHeight: "16px",
|
|
56
|
+
fontWeight: 500,
|
|
57
|
+
},
|
|
58
|
+
font200: {
|
|
59
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
60
|
+
fontSize: "12px",
|
|
61
|
+
lineHeight: "18px",
|
|
62
|
+
fontWeight: 500,
|
|
63
|
+
},
|
|
64
|
+
font250: {
|
|
65
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
66
|
+
fontSize: "13px",
|
|
67
|
+
lineHeight: "18px",
|
|
68
|
+
fontWeight: 590,
|
|
69
|
+
},
|
|
70
|
+
font300: {
|
|
71
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
72
|
+
fontSize: "14px",
|
|
73
|
+
lineHeight: "20px",
|
|
74
|
+
fontWeight: 400,
|
|
75
|
+
},
|
|
76
|
+
font350: {
|
|
77
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
78
|
+
fontSize: "15px",
|
|
79
|
+
lineHeight: "21px",
|
|
80
|
+
fontWeight: 590,
|
|
81
|
+
},
|
|
82
|
+
font400: {
|
|
83
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
84
|
+
fontSize: "17px",
|
|
85
|
+
lineHeight: "22px",
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
},
|
|
88
|
+
LabelSmall: {
|
|
89
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
90
|
+
fontSize: "12px",
|
|
91
|
+
lineHeight: "18px",
|
|
92
|
+
fontWeight: 590,
|
|
93
|
+
},
|
|
94
|
+
LabelMedium: {
|
|
95
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
96
|
+
fontSize: "13px",
|
|
97
|
+
lineHeight: "20px",
|
|
98
|
+
fontWeight: 590,
|
|
99
|
+
},
|
|
100
|
+
HeadingSmall: {
|
|
101
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
102
|
+
fontSize: "18px",
|
|
103
|
+
lineHeight: "24px",
|
|
104
|
+
fontWeight: 700,
|
|
105
|
+
},
|
|
106
|
+
HeadingMedium: {
|
|
107
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
108
|
+
fontSize: "24px",
|
|
109
|
+
lineHeight: "30px",
|
|
110
|
+
fontWeight: 700,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const macosLightTheme = createLightTheme({
|
|
116
|
+
...sharedThemeOverrides,
|
|
117
|
+
colors: {
|
|
118
|
+
primary: "#0a84ff",
|
|
119
|
+
primaryA: "#0a84ff",
|
|
120
|
+
primaryB: "#0066cc",
|
|
121
|
+
accent: "#0a84ff",
|
|
122
|
+
backgroundPrimary: "rgba(232, 236, 245, 0.58)",
|
|
123
|
+
backgroundSecondary: "rgba(255, 255, 255, 0.44)",
|
|
124
|
+
backgroundTertiary: "rgba(244, 245, 249, 0.48)",
|
|
125
|
+
contentPrimary: "#1d1d1f",
|
|
126
|
+
contentSecondary: "#3a3a3c",
|
|
127
|
+
contentTertiary: "#6e6e73",
|
|
128
|
+
borderOpaque: "#bec3cf",
|
|
129
|
+
borderTransparent: "#d3d6df",
|
|
130
|
+
borderSelected: "#0a84ff",
|
|
131
|
+
buttonPrimaryFill: "#0a84ff",
|
|
132
|
+
buttonPrimaryText: "#ffffff",
|
|
133
|
+
buttonPrimaryHover: "#158aff",
|
|
134
|
+
buttonPrimaryActive: "#0066cc",
|
|
135
|
+
buttonSecondaryFill: "#f5f6fa",
|
|
136
|
+
buttonSecondaryText: "#1d1d1f",
|
|
137
|
+
buttonSecondaryHover: "#eceef5",
|
|
138
|
+
buttonSecondaryActive: "#dfe3ed",
|
|
139
|
+
inputBorder: "#c8ccd8",
|
|
140
|
+
inputFill: "#ffffff",
|
|
141
|
+
inputFillDisabled: "#f1f2f6",
|
|
142
|
+
inputFillActive: "#ffffff",
|
|
143
|
+
inputTextDisabled: "#7f7f86",
|
|
144
|
+
inputPlaceholder: "#8a8a92",
|
|
145
|
+
inputPlaceholderDisabled: "#b0b2b9",
|
|
146
|
+
inputEnhancerFill: "#f5f6fa",
|
|
147
|
+
toggleTrackFill: "#d7d9e0",
|
|
148
|
+
toggleTrackFillDisabled: "#e5e7ed",
|
|
149
|
+
toggleFill: "#ffffff",
|
|
150
|
+
toggleFillChecked: "#ffffff",
|
|
151
|
+
toggleFillDisabled: "#f8f9fc",
|
|
152
|
+
notificationPositiveBackground: "#e8fff3",
|
|
153
|
+
notificationPositiveText: "#046c4e",
|
|
154
|
+
notificationNegativeBackground: "#fff1f0",
|
|
155
|
+
notificationNegativeText: "#b42318",
|
|
156
|
+
notificationInfoBackground: "#edf4ff",
|
|
157
|
+
notificationInfoText: "#1d4ed8",
|
|
158
|
+
},
|
|
159
|
+
lighting: {
|
|
160
|
+
shadow400: "0 12px 30px rgba(15, 23, 42, 0.12)",
|
|
161
|
+
shadow500: "0 18px 40px rgba(15, 23, 42, 0.16)",
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export const macosDarkTheme = createDarkTheme({
|
|
166
|
+
...sharedThemeOverrides,
|
|
167
|
+
colors: {
|
|
168
|
+
primary: "#0a84ff",
|
|
169
|
+
primaryA: "#0a84ff",
|
|
170
|
+
primaryB: "#409cff",
|
|
171
|
+
accent: "#0a84ff",
|
|
172
|
+
backgroundPrimary: "rgba(26, 27, 34, 0.62)",
|
|
173
|
+
backgroundSecondary: "rgba(42, 43, 51, 0.52)",
|
|
174
|
+
backgroundTertiary: "rgba(53, 55, 66, 0.56)",
|
|
175
|
+
contentPrimary: "#f5f7fb",
|
|
176
|
+
contentSecondary: "#d8d9df",
|
|
177
|
+
contentTertiary: "#aeb0ba",
|
|
178
|
+
borderOpaque: "#51545f",
|
|
179
|
+
borderTransparent: "#646874",
|
|
180
|
+
borderSelected: "#0a84ff",
|
|
181
|
+
buttonPrimaryFill: "#0a84ff",
|
|
182
|
+
buttonPrimaryText: "#ffffff",
|
|
183
|
+
buttonPrimaryHover: "#3395ff",
|
|
184
|
+
buttonPrimaryActive: "#006edb",
|
|
185
|
+
buttonSecondaryFill: "#373944",
|
|
186
|
+
buttonSecondaryText: "#f5f7fb",
|
|
187
|
+
buttonSecondaryHover: "#41444f",
|
|
188
|
+
buttonSecondaryActive: "#4b4f5b",
|
|
189
|
+
inputBorder: "#666a76",
|
|
190
|
+
inputFill: "#2d2f39",
|
|
191
|
+
inputFillDisabled: "#262831",
|
|
192
|
+
inputFillActive: "#2d2f39",
|
|
193
|
+
inputTextDisabled: "#8e8e93",
|
|
194
|
+
inputPlaceholder: "#8f919d",
|
|
195
|
+
inputPlaceholderDisabled: "#6e6e73",
|
|
196
|
+
inputEnhancerFill: "#363844",
|
|
197
|
+
toggleTrackFill: "#494d5a",
|
|
198
|
+
toggleTrackFillDisabled: "#3f424d",
|
|
199
|
+
toggleFill: "#ffffff",
|
|
200
|
+
toggleFillChecked: "#ffffff",
|
|
201
|
+
toggleFillDisabled: "#d1d4de",
|
|
202
|
+
notificationPositiveBackground: "#073d2c",
|
|
203
|
+
notificationPositiveText: "#77f2c0",
|
|
204
|
+
notificationNegativeBackground: "#4a1415",
|
|
205
|
+
notificationNegativeText: "#fda29b",
|
|
206
|
+
notificationInfoBackground: "#1b3168",
|
|
207
|
+
notificationInfoText: "#c6dbff",
|
|
208
|
+
},
|
|
209
|
+
lighting: {
|
|
210
|
+
shadow400: "0 14px 34px rgba(0, 0, 0, 0.5)",
|
|
211
|
+
shadow500: "0 20px 50px rgba(0, 0, 0, 0.62)",
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export const macosWindowOverrides = {
|
|
216
|
+
Block: {
|
|
217
|
+
style: (({ $theme }: { $theme: Theme }) => {
|
|
218
|
+
const dark = isDarkTheme($theme);
|
|
219
|
+
return {
|
|
220
|
+
borderRadius: "18px",
|
|
221
|
+
overflow: "hidden",
|
|
222
|
+
border: `1px solid ${$theme.colors.borderTransparent}`,
|
|
223
|
+
background: dark
|
|
224
|
+
? "linear-gradient(180deg, rgba(43,45,55,0.92) 0%, rgba(34,35,43,0.92) 100%)"
|
|
225
|
+
: "linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(248,249,253,0.94) 100%)",
|
|
226
|
+
backdropFilter: "saturate(180%) blur(30px)",
|
|
227
|
+
boxShadow: dark
|
|
228
|
+
? "0 24px 64px rgba(0, 0, 0, 0.55)"
|
|
229
|
+
: "0 24px 64px rgba(15, 23, 42, 0.18)",
|
|
230
|
+
};
|
|
231
|
+
}) as ThemedStyle,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const macosPanelOverrides = {
|
|
236
|
+
Block: {
|
|
237
|
+
style: (({ $theme }: { $theme: Theme }) => {
|
|
238
|
+
const dark = isDarkTheme($theme);
|
|
239
|
+
return {
|
|
240
|
+
backgroundColor: "transparent",
|
|
241
|
+
border: `1px solid ${$theme.colors.borderTransparent}`,
|
|
242
|
+
borderRadius: dark ? "10px" : "10px",
|
|
243
|
+
boxShadow: "none",
|
|
244
|
+
};
|
|
245
|
+
}) as ThemedStyle,
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export const macosFormControlOverrides = {
|
|
250
|
+
ControlContainer: {
|
|
251
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
252
|
+
marginBottom: $theme.sizing.scale500,
|
|
253
|
+
}),
|
|
254
|
+
},
|
|
255
|
+
LabelContainer: {
|
|
256
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
257
|
+
marginTop: $theme.sizing.scale0,
|
|
258
|
+
marginBottom: $theme.sizing.scale200,
|
|
259
|
+
}),
|
|
260
|
+
},
|
|
261
|
+
Label: {
|
|
262
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
263
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
264
|
+
fontSize: "13px",
|
|
265
|
+
lineHeight: "18px",
|
|
266
|
+
fontWeight: 590,
|
|
267
|
+
letterSpacing: "-0.01em",
|
|
268
|
+
color: $theme.colors.contentPrimary,
|
|
269
|
+
}),
|
|
270
|
+
},
|
|
271
|
+
Caption: {
|
|
272
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
273
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
274
|
+
fontSize: "12px",
|
|
275
|
+
lineHeight: "16px",
|
|
276
|
+
marginTop: $theme.sizing.scale200,
|
|
277
|
+
marginBottom: $theme.sizing.scale100,
|
|
278
|
+
}),
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export const macosCheckboxOverrides = {
|
|
283
|
+
Root: {
|
|
284
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
marginBottom: $theme.sizing.scale300,
|
|
287
|
+
}),
|
|
288
|
+
},
|
|
289
|
+
Label: {
|
|
290
|
+
style: ({ $theme }: { $theme: Theme }) => ({
|
|
291
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
292
|
+
fontSize: "13px",
|
|
293
|
+
lineHeight: "20px",
|
|
294
|
+
color: $theme.colors.contentPrimary,
|
|
295
|
+
}),
|
|
296
|
+
},
|
|
297
|
+
ToggleTrack: {
|
|
298
|
+
style: (({ $theme, $checked, $disabled }: { $theme: Theme } & ToggleTrackStyleProps) => ({
|
|
299
|
+
width: "38px",
|
|
300
|
+
height: "22px",
|
|
301
|
+
borderRadius: "999px",
|
|
302
|
+
margin: 0,
|
|
303
|
+
padding: "2px",
|
|
304
|
+
border: `1px solid ${$theme.colors.borderTransparent}`,
|
|
305
|
+
backgroundColor: $disabled
|
|
306
|
+
? $theme.colors.toggleTrackFillDisabled
|
|
307
|
+
: $checked
|
|
308
|
+
? $theme.colors.primary
|
|
309
|
+
: $theme.colors.toggleTrackFill,
|
|
310
|
+
})) as ThemedStyle<ToggleTrackStyleProps>,
|
|
311
|
+
},
|
|
312
|
+
Toggle: {
|
|
313
|
+
style: (({ $theme, $checked, $isFocusVisible }: { $theme: Theme } & ToggleStyleProps) => ({
|
|
314
|
+
width: "18px",
|
|
315
|
+
height: "18px",
|
|
316
|
+
borderRadius: "999px",
|
|
317
|
+
boxShadow: $isFocusVisible
|
|
318
|
+
? `0 0 0 3px ${$theme.colors.primary}44`
|
|
319
|
+
: "0 1px 2px rgba(0, 0, 0, 0.26)",
|
|
320
|
+
transform: $checked
|
|
321
|
+
? `translateX(${ $theme.direction === "rtl" ? "-16px" : "16px" })`
|
|
322
|
+
: "translateX(0)",
|
|
323
|
+
transition: "transform 160ms cubic-bezier(0.22, 1, 0.36, 1)",
|
|
324
|
+
})) as ThemedStyle<ToggleStyleProps>,
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const macosButtonOverrides = {
|
|
329
|
+
BaseButton: {
|
|
330
|
+
style: (({
|
|
331
|
+
$theme,
|
|
332
|
+
$kind,
|
|
333
|
+
$isHovered,
|
|
334
|
+
$isPressed,
|
|
335
|
+
$disabled,
|
|
336
|
+
}: { $theme: Theme } & ButtonStyleProps) => {
|
|
337
|
+
const dark = isDarkTheme($theme);
|
|
338
|
+
const isPrimary = $kind === "primary";
|
|
339
|
+
const isSecondary = $kind === "secondary";
|
|
340
|
+
|
|
341
|
+
const primaryBackground = dark
|
|
342
|
+
? "linear-gradient(180deg, #2994ff 0%, #0a84ff 100%)"
|
|
343
|
+
: "linear-gradient(180deg, #2e95ff 0%, #0a84ff 100%)";
|
|
344
|
+
|
|
345
|
+
const secondaryBackground = dark
|
|
346
|
+
? "linear-gradient(180deg, #474b58 0%, #3b3e4a 100%)"
|
|
347
|
+
: "linear-gradient(180deg, #ffffff 0%, #f0f2f7 100%)";
|
|
348
|
+
|
|
349
|
+
return {
|
|
350
|
+
borderRadius: $theme.borders.buttonBorderRadius,
|
|
351
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
352
|
+
fontWeight: 590,
|
|
353
|
+
fontSize: "13px",
|
|
354
|
+
letterSpacing: "-0.01em",
|
|
355
|
+
minHeight: "32px",
|
|
356
|
+
borderWidth: "1px",
|
|
357
|
+
borderStyle: "solid",
|
|
358
|
+
borderColor: isPrimary
|
|
359
|
+
? "transparent"
|
|
360
|
+
: isSecondary
|
|
361
|
+
? $theme.colors.borderTransparent
|
|
362
|
+
: "transparent",
|
|
363
|
+
backgroundImage: isPrimary
|
|
364
|
+
? primaryBackground
|
|
365
|
+
: isSecondary
|
|
366
|
+
? secondaryBackground
|
|
367
|
+
: "none",
|
|
368
|
+
boxShadow: isPrimary
|
|
369
|
+
? dark
|
|
370
|
+
? "0 1px 0 rgba(255,255,255,0.12) inset"
|
|
371
|
+
: "0 1px 0 rgba(255,255,255,0.6) inset"
|
|
372
|
+
: isSecondary
|
|
373
|
+
? dark
|
|
374
|
+
? "0 1px 0 rgba(255,255,255,0.08) inset"
|
|
375
|
+
: "0 1px 0 rgba(255,255,255,0.9) inset"
|
|
376
|
+
: "none",
|
|
377
|
+
transform: $isPressed ? "translateY(1px)" : "translateY(0)",
|
|
378
|
+
opacity: $disabled ? 0.55 : 1,
|
|
379
|
+
filter: $isHovered && !$disabled ? "brightness(1.03)" : "none",
|
|
380
|
+
transition:
|
|
381
|
+
"background-color 120ms ease, transform 120ms ease, filter 120ms ease",
|
|
382
|
+
};
|
|
383
|
+
}) as ThemedStyle<ButtonStyleProps>,
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export const macosListRowButtonOverrides = {
|
|
388
|
+
BaseButton: {
|
|
389
|
+
style: (({ $theme }: { $theme: Theme }) => ({
|
|
390
|
+
justifyContent: "flex-start",
|
|
391
|
+
borderRadius: "0",
|
|
392
|
+
borderWidth: "0",
|
|
393
|
+
borderStyle: "solid",
|
|
394
|
+
borderColor: "transparent",
|
|
395
|
+
borderBottomWidth: "1px",
|
|
396
|
+
borderBottomColor: $theme.colors.borderTransparent,
|
|
397
|
+
backgroundColor: "transparent",
|
|
398
|
+
boxShadow: "none",
|
|
399
|
+
paddingTop: $theme.sizing.scale300,
|
|
400
|
+
paddingBottom: $theme.sizing.scale300,
|
|
401
|
+
paddingLeft: $theme.sizing.scale200,
|
|
402
|
+
paddingRight: $theme.sizing.scale200,
|
|
403
|
+
textAlign: "left",
|
|
404
|
+
minHeight: "auto",
|
|
405
|
+
":hover": {
|
|
406
|
+
backgroundColor: isDarkTheme($theme)
|
|
407
|
+
? "rgba(255,255,255,0.04)"
|
|
408
|
+
: "rgba(10,132,255,0.06)",
|
|
409
|
+
},
|
|
410
|
+
":active": {
|
|
411
|
+
backgroundColor: isDarkTheme($theme)
|
|
412
|
+
? "rgba(255,255,255,0.07)"
|
|
413
|
+
: "rgba(10,132,255,0.1)",
|
|
414
|
+
},
|
|
415
|
+
})) as ThemedStyle,
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
export const macosProfileCardButtonOverrides = macosListRowButtonOverrides;
|
|
420
|
+
|
|
421
|
+
export const macosTextButtonOverrides = {
|
|
422
|
+
BaseButton: {
|
|
423
|
+
style: (({ $theme }: { $theme: Theme }) => ({
|
|
424
|
+
paddingTop: 0,
|
|
425
|
+
paddingBottom: 0,
|
|
426
|
+
paddingLeft: 0,
|
|
427
|
+
paddingRight: 0,
|
|
428
|
+
minHeight: "auto",
|
|
429
|
+
borderWidth: 0,
|
|
430
|
+
borderRadius: 0,
|
|
431
|
+
color: $theme.colors.primary,
|
|
432
|
+
})) as ThemedStyle,
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
export const macosSegmentedControlOverrides = {
|
|
437
|
+
Root: {
|
|
438
|
+
style: (({ $theme }: { $theme: Theme }) => {
|
|
439
|
+
const dark = isDarkTheme($theme);
|
|
440
|
+
return {
|
|
441
|
+
backgroundColor: dark ? "rgba(255,255,255,0.06)" : "rgba(118,118,128,0.12)",
|
|
442
|
+
borderRadius: "8px",
|
|
443
|
+
border: `1px solid ${dark ? "rgba(255,255,255,0.14)" : "rgba(60,60,67,0.22)"}`,
|
|
444
|
+
padding: "2px",
|
|
445
|
+
boxShadow: dark
|
|
446
|
+
? "inset 0 1px 1px rgba(0,0,0,0.35)"
|
|
447
|
+
: "inset 0 1px 1px rgba(255,255,255,0.85)",
|
|
448
|
+
height: "30px",
|
|
449
|
+
};
|
|
450
|
+
}) as ThemedStyle,
|
|
451
|
+
},
|
|
452
|
+
SegmentList: {
|
|
453
|
+
style: (() => ({
|
|
454
|
+
backgroundColor: "transparent",
|
|
455
|
+
minHeight: "24px",
|
|
456
|
+
})) as ThemedStyle,
|
|
457
|
+
},
|
|
458
|
+
Active: {
|
|
459
|
+
style: (({ $theme }: { $theme: Theme }) => {
|
|
460
|
+
const dark = isDarkTheme($theme);
|
|
461
|
+
return {
|
|
462
|
+
borderRadius: "6px",
|
|
463
|
+
border: `1px solid ${dark ? "rgba(255,255,255,0.16)" : "rgba(60,60,67,0.26)"}`,
|
|
464
|
+
backgroundColor: dark ? "rgba(255,255,255,0.18)" : "rgba(255,255,255,0.96)",
|
|
465
|
+
boxShadow: dark
|
|
466
|
+
? "0 1px 0 rgba(255,255,255,0.12) inset, 0 1px 2px rgba(0,0,0,0.5)"
|
|
467
|
+
: "0 1px 0 rgba(255,255,255,0.9) inset, 0 1px 2px rgba(0,0,0,0.2)",
|
|
468
|
+
};
|
|
469
|
+
}) as ThemedStyle,
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
export const macosSegmentOverrides = {
|
|
474
|
+
Segment: {
|
|
475
|
+
style: (({ $theme, $isActive, $focusVisible }: { $theme: Theme } & SegmentedStyleProps) => ({
|
|
476
|
+
borderRadius: "6px",
|
|
477
|
+
minHeight: "24px",
|
|
478
|
+
paddingTop: "0",
|
|
479
|
+
paddingBottom: "0",
|
|
480
|
+
paddingLeft: $theme.sizing.scale400,
|
|
481
|
+
paddingRight: $theme.sizing.scale400,
|
|
482
|
+
color: $isActive ? $theme.colors.contentPrimary : $theme.colors.contentSecondary,
|
|
483
|
+
boxShadow: "none",
|
|
484
|
+
outline: $focusVisible ? `2px solid ${$theme.colors.primary}` : "none",
|
|
485
|
+
outlineOffset: "-2px",
|
|
486
|
+
transition: "color 120ms ease",
|
|
487
|
+
":hover": {
|
|
488
|
+
boxShadow: "none",
|
|
489
|
+
color: $isActive ? $theme.colors.contentPrimary : $theme.colors.contentPrimary,
|
|
490
|
+
},
|
|
491
|
+
})) as ThemedStyle<SegmentedStyleProps>,
|
|
492
|
+
},
|
|
493
|
+
LabelBlock: {
|
|
494
|
+
style: (() => ({
|
|
495
|
+
gap: "0",
|
|
496
|
+
})) as ThemedStyle,
|
|
497
|
+
},
|
|
498
|
+
Label: {
|
|
499
|
+
style: (() => ({
|
|
500
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
501
|
+
fontSize: "12px",
|
|
502
|
+
lineHeight: "16px",
|
|
503
|
+
fontWeight: 590,
|
|
504
|
+
letterSpacing: "-0.01em",
|
|
505
|
+
})) as ThemedStyle,
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
export const macosInputOverrides = {
|
|
510
|
+
Root: {
|
|
511
|
+
style: (({
|
|
512
|
+
$theme,
|
|
513
|
+
$isFocused,
|
|
514
|
+
$disabled,
|
|
515
|
+
$error,
|
|
516
|
+
$positive,
|
|
517
|
+
}: { $theme: Theme } & InputRootStyleProps) => {
|
|
518
|
+
const dark = isDarkTheme($theme);
|
|
519
|
+
|
|
520
|
+
let borderColor = $theme.colors.inputBorder;
|
|
521
|
+
if ($error) {
|
|
522
|
+
borderColor = $theme.colors.inputBorderError;
|
|
523
|
+
} else if ($positive) {
|
|
524
|
+
borderColor = $theme.colors.inputBorderPositive;
|
|
525
|
+
} else if ($isFocused) {
|
|
526
|
+
borderColor = $theme.colors.primary;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return {
|
|
530
|
+
borderRadius: $theme.borders.inputBorderRadius,
|
|
531
|
+
borderWidth: "1px",
|
|
532
|
+
borderLeftWidth: "1px",
|
|
533
|
+
borderRightWidth: "1px",
|
|
534
|
+
borderTopWidth: "1px",
|
|
535
|
+
borderBottomWidth: "1px",
|
|
536
|
+
borderLeftColor: borderColor,
|
|
537
|
+
borderRightColor: borderColor,
|
|
538
|
+
borderTopColor: borderColor,
|
|
539
|
+
borderBottomColor: borderColor,
|
|
540
|
+
backgroundColor: $disabled ? $theme.colors.inputFillDisabled : $theme.colors.inputFill,
|
|
541
|
+
boxShadow: $isFocused
|
|
542
|
+
? `0 0 0 3px ${$theme.colors.primary}44`
|
|
543
|
+
: dark
|
|
544
|
+
? "inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.38)"
|
|
545
|
+
: "inset 0 1px 0 rgba(255,255,255,0.96), inset 0 -1px 0 rgba(15,23,42,0.08)",
|
|
546
|
+
transition:
|
|
547
|
+
"border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease",
|
|
548
|
+
};
|
|
549
|
+
}) as ThemedStyle<InputRootStyleProps>,
|
|
550
|
+
},
|
|
551
|
+
Input: {
|
|
552
|
+
style: (({ $theme }: { $theme: Theme }) => ({
|
|
553
|
+
fontFamily: MACOS_FONT_FAMILY,
|
|
554
|
+
fontWeight: 400,
|
|
555
|
+
fontSize: "14px",
|
|
556
|
+
lineHeight: "20px",
|
|
557
|
+
letterSpacing: "-0.01em",
|
|
558
|
+
color: $theme.colors.contentPrimary,
|
|
559
|
+
})) as ThemedStyle,
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export const macosNotificationOverrides = {
|
|
564
|
+
Body: {
|
|
565
|
+
style: (({ $theme }: { $theme: Theme }) => ({
|
|
566
|
+
borderRadius: $theme.borders.radius200,
|
|
567
|
+
border: `1px solid ${$theme.colors.borderTransparent}`,
|
|
568
|
+
})) as ThemedStyle,
|
|
569
|
+
},
|
|
570
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isDraggableAreaTarget } from "./isDraggableAreaTarget";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function isDraggableAreaTarget(target: EventTarget | null, event: { nativeEvent: Event }) {
|
|
2
|
+
const path =
|
|
3
|
+
typeof event.nativeEvent.composedPath === "function"
|
|
4
|
+
? event.nativeEvent.composedPath()
|
|
5
|
+
: [target];
|
|
6
|
+
|
|
7
|
+
for (const pathNode of path) {
|
|
8
|
+
if (!(pathNode instanceof Element)) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (
|
|
13
|
+
pathNode.closest(
|
|
14
|
+
"[data-tauri-no-drag-region], button, input, select, textarea, option, [role='button'], [contenteditable='true'], a",
|
|
15
|
+
) !== null
|
|
16
|
+
) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "human-design-tauri-system-symbols"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
description = "Tauri plugin crate providing native SF Symbols data URLs for macOS."
|
|
6
|
+
authors = ["human-design contributors"]
|
|
7
|
+
license = "MIT"
|
|
8
|
+
|
|
9
|
+
[dependencies]
|
|
10
|
+
tauri = { version = "2", features = ["macos-private-api"] }
|
|
11
|
+
|
|
12
|
+
[target.'cfg(target_os = "macos")'.dependencies]
|
|
13
|
+
base64 = "0.22"
|
|
14
|
+
objc2 = "0.6"
|
|
15
|
+
objc2-app-kit = { version = "0.3", features = [
|
|
16
|
+
"NSBitmapImageRep",
|
|
17
|
+
"NSFontDescriptor",
|
|
18
|
+
"NSImage",
|
|
19
|
+
"NSImageRep",
|
|
20
|
+
] }
|
|
21
|
+
objc2-foundation = { version = "0.3", features = ["NSArray", "NSData", "NSDictionary", "NSString"] }
|