mac-human-design 0.1.3 → 0.1.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.
@@ -1,570 +1,60 @@
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 =
1
+ export const macosFontFamily =
32
2
  '-apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif';
33
3
 
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
- };
4
+ export const macosColorTokens = {
5
+ accent: "#0a84ff",
6
+ accentActive: "#006edb",
7
+ destructive: "#ff453a",
8
+ success: "#32d74b",
9
+ text: "var(--hd-mac-text)",
10
+ secondaryText: "var(--hd-mac-secondary-text)",
11
+ mutedText: "var(--hd-mac-muted-text)",
12
+ surface: "var(--hd-mac-surface)",
13
+ panel: "var(--hd-mac-panel)",
14
+ raised: "var(--hd-mac-raised)",
15
+ fill: "var(--hd-mac-fill)",
16
+ border: "var(--hd-mac-border)",
17
+ } as const;
18
+
19
+ export const macosRadiusTokens = {
20
+ control: "7px",
21
+ segmentedControl: "8px",
22
+ menu: "10px",
23
+ panel: "12px",
24
+ dialog: "14px",
25
+ window: "18px",
26
+ pill: "999px",
27
+ } as const;
28
+
29
+ export const macosClassNames = {
30
+ root: "hd-mac",
31
+ button: "hd-mac-button",
32
+ primaryButton: "hd-mac-button hd-mac-button-primary",
33
+ destructiveButton: "hd-mac-button hd-mac-button-destructive",
34
+ plainButton: "hd-mac-button hd-mac-button-plain",
35
+ input: "hd-mac-input",
36
+ label: "hd-mac-label",
37
+ popup: "hd-mac hd-mac-popup",
38
+ dialog: "hd-mac hd-mac-dialog",
39
+ toolbar: "hd-mac-toolbar",
40
+ toggleGroup: "hd-mac-toggle-group",
41
+ toggle: "hd-mac-toggle",
42
+ } as const;
43
+
44
+ export const macosLightTheme = {
45
+ name: "macos-light",
46
+ colors: macosColorTokens,
47
+ radii: macosRadiusTokens,
48
+ fontFamily: macosFontFamily,
49
+ } as const;
50
+
51
+ export const macosDarkTheme = {
52
+ name: "macos-dark",
53
+ colors: macosColorTokens,
54
+ radii: macosRadiusTokens,
55
+ fontFamily: macosFontFamily,
56
+ } as const;
57
+
58
+ export const macosWindowClassName = "hd-mac-window";
59
+ export const macosPanelClassName = "hd-mac-panel";
60
+ export const macosFormClassName = "hd-mac-form";
@@ -0,0 +1 @@
1
+ declare module "*.css";
@@ -19,3 +19,4 @@ objc2-app-kit = { version = "0.3", features = [
19
19
  "NSImageRep",
20
20
  ] }
21
21
  objc2-foundation = { version = "0.3", features = ["NSArray", "NSData", "NSDictionary", "NSString"] }
22
+ window-vibrancy = "0.6"
@@ -1,10 +1,48 @@
1
1
  use tauri::plugin::{Builder, TauriPlugin};
2
2
 
3
3
  mod system_symbols;
4
+ pub use system_symbols::system_symbol_png_data_url;
5
+
6
+ #[cfg(target_os = "macos")]
7
+ use tauri::Manager;
8
+ #[cfg(target_os = "macos")]
9
+ use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial};
4
10
 
5
11
  #[cfg_attr(mobile, tauri::mobile_entry_point)]
6
12
  pub fn init<R: tauri::Runtime>() -> TauriPlugin<R> {
7
13
  Builder::new("human-design-system-symbols")
8
- .invoke_handler(tauri::generate_handler![system_symbols::system_symbol_png_data_url])
14
+ .invoke_handler(tauri::generate_handler![system_symbol_png_data_url])
9
15
  .build()
10
16
  }
17
+
18
+ #[cfg(target_os = "macos")]
19
+ pub fn apply_macos_hud_window_vibrancy<R, M>(
20
+ manager: &M,
21
+ window_label: &str,
22
+ ) -> Result<(), std::io::Error>
23
+ where
24
+ R: tauri::Runtime,
25
+ M: Manager<R>,
26
+ {
27
+ let window = manager.get_webview_window(window_label).ok_or_else(|| {
28
+ std::io::Error::new(
29
+ std::io::ErrorKind::NotFound,
30
+ format!("Window '{window_label}' was not found."),
31
+ )
32
+ })?;
33
+
34
+ apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None).map_err(|error| {
35
+ std::io::Error::other(format!("Failed to apply macOS vibrancy: {error}"))
36
+ })
37
+ }
38
+
39
+ #[cfg(not(target_os = "macos"))]
40
+ pub fn apply_macos_hud_window_vibrancy<R, M>(
41
+ _manager: &M,
42
+ _window_label: &str,
43
+ ) -> Result<(), std::io::Error>
44
+ where
45
+ R: tauri::Runtime,
46
+ {
47
+ Ok(())
48
+ }