@justanarthur/modo-ui-notch 0.0.0-stage → 0.3.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.
Files changed (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/blocks/activities/agenda/examples.mdx +74 -0
  4. package/blocks/activities/agenda/index.tsx +441 -0
  5. package/blocks/activities/clock/examples.mdx +73 -0
  6. package/blocks/activities/clock/index.tsx +619 -0
  7. package/blocks/activities/now-playing/examples.mdx +68 -0
  8. package/blocks/activities/now-playing/index.tsx +411 -0
  9. package/blocks/activities/weather/examples.mdx +115 -0
  10. package/blocks/activities/weather/index.tsx +634 -0
  11. package/blocks/app/expanded-island/examples.mdx +46 -0
  12. package/blocks/app/expanded-island/index.tsx +143 -0
  13. package/blocks/app/settings-window/examples.mdx +34 -0
  14. package/blocks/app/settings-window/index.tsx +375 -0
  15. package/blocks/system/clipboard/examples.mdx +83 -0
  16. package/blocks/system/clipboard/index.tsx +563 -0
  17. package/blocks/system/recent-files/examples.mdx +66 -0
  18. package/blocks/system/recent-files/index.tsx +542 -0
  19. package/blocks/system/system-stats/examples.mdx +52 -0
  20. package/blocks/system/system-stats/index.tsx +312 -0
  21. package/components/indicators/countdown/examples.mdx +25 -0
  22. package/components/indicators/countdown/index.tsx +83 -0
  23. package/components/indicators/equalizer/examples.mdx +20 -0
  24. package/components/indicators/equalizer/index.tsx +116 -0
  25. package/components/indicators/media-scrubber/examples.mdx +29 -0
  26. package/components/indicators/media-scrubber/index.tsx +122 -0
  27. package/components/island/island/examples.mdx +57 -0
  28. package/components/island/island/index.tsx +415 -0
  29. package/components/island/island-flash/examples.mdx +52 -0
  30. package/components/island/island-flash/index.tsx +79 -0
  31. package/components/island/island-tabs/examples.mdx +53 -0
  32. package/components/island/island-tabs/index.tsx +285 -0
  33. package/components/island/widget/examples.mdx +76 -0
  34. package/components/island/widget/index.tsx +431 -0
  35. package/dist/blocks/activities/agenda/index.d.ts +2 -0
  36. package/dist/blocks/activities/agenda/index.js +21 -0
  37. package/dist/blocks/activities/clock/index.d.ts +2 -0
  38. package/dist/blocks/activities/clock/index.js +25 -0
  39. package/dist/blocks/activities/now-playing/index.d.ts +3 -0
  40. package/dist/blocks/activities/now-playing/index.js +24 -0
  41. package/dist/blocks/activities/weather/index.d.ts +2 -0
  42. package/dist/blocks/activities/weather/index.js +21 -0
  43. package/dist/blocks/app/expanded-island/index.d.ts +3 -0
  44. package/dist/blocks/app/expanded-island/index.js +11 -0
  45. package/dist/blocks/app/settings-window/index.d.ts +2 -0
  46. package/dist/blocks/app/settings-window/index.js +7 -0
  47. package/dist/blocks/system/clipboard/index.d.ts +2 -0
  48. package/dist/blocks/system/clipboard/index.js +17 -0
  49. package/dist/blocks/system/recent-files/index.d.ts +2 -0
  50. package/dist/blocks/system/recent-files/index.js +19 -0
  51. package/dist/blocks/system/system-stats/index.d.ts +2 -0
  52. package/dist/blocks/system/system-stats/index.js +15 -0
  53. package/dist/components/indicators/countdown/index.d.ts +2 -0
  54. package/dist/components/indicators/countdown/index.js +8 -0
  55. package/dist/components/indicators/equalizer/index.d.ts +2 -0
  56. package/dist/components/indicators/equalizer/index.js +7 -0
  57. package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
  58. package/dist/components/indicators/media-scrubber/index.js +8 -0
  59. package/dist/components/island/island/index.d.ts +3 -0
  60. package/dist/components/island/island/index.js +10 -0
  61. package/dist/components/island/island-flash/index.d.ts +2 -0
  62. package/dist/components/island/island-flash/index.js +7 -0
  63. package/dist/components/island/island-tabs/index.d.ts +2 -0
  64. package/dist/components/island/island-tabs/index.js +9 -0
  65. package/dist/components/island/widget/index.d.ts +2 -0
  66. package/dist/components/island/widget/index.js +30 -0
  67. package/dist/index.d.ts +21 -0
  68. package/dist/index.js +195 -0
  69. package/dist/lib/artwork.d.ts +2 -0
  70. package/dist/lib/artwork.js +8 -0
  71. package/dist/lib/clock.d.ts +2 -0
  72. package/dist/lib/clock.js +14 -0
  73. package/dist/lib/geometry.d.ts +2 -0
  74. package/dist/lib/geometry.js +24 -0
  75. package/dist/lib/island-context.d.ts +3 -0
  76. package/dist/lib/island-context.js +8 -0
  77. package/dist/lib/motion.d.ts +21 -0
  78. package/dist/lib/motion.js +16 -0
  79. package/dist/shared/chunk-152gpyq3.d.ts +13 -0
  80. package/dist/shared/chunk-2818esrq.d.ts +140 -0
  81. package/dist/shared/chunk-2f7zxrbk.js +65 -0
  82. package/dist/shared/chunk-2m5dz8nf.d.ts +88 -0
  83. package/dist/shared/chunk-2s4q6mt0.js +27 -0
  84. package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
  85. package/dist/shared/chunk-416tsgbc.d.ts +175 -0
  86. package/dist/shared/chunk-502rmtap.js +54 -0
  87. package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
  88. package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
  89. package/dist/shared/chunk-61t2dfte.js +63 -0
  90. package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
  91. package/dist/shared/chunk-81fpptwp.d.ts +75 -0
  92. package/dist/shared/chunk-9c7ewvkk.js +381 -0
  93. package/dist/shared/chunk-9m0xbg5v.js +112 -0
  94. package/dist/shared/chunk-9xtcv3sy.js +88 -0
  95. package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
  96. package/dist/shared/chunk-cc9nwbtf.js +315 -0
  97. package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
  98. package/dist/shared/chunk-d5qm9cps.js +10 -0
  99. package/dist/shared/chunk-da177e8r.d.ts +114 -0
  100. package/dist/shared/chunk-fexwzycv.d.ts +36 -0
  101. package/dist/shared/chunk-gb56m10p.js +39 -0
  102. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  103. package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
  104. package/dist/shared/chunk-j755a1a5.d.ts +41 -0
  105. package/dist/shared/chunk-j77cx8dp.js +498 -0
  106. package/dist/shared/chunk-mt0k6v8x.js +474 -0
  107. package/dist/shared/chunk-ndf79pv5.js +58 -0
  108. package/dist/shared/chunk-pfhy5e4q.d.ts +53 -0
  109. package/dist/shared/chunk-qdzemt2v.js +477 -0
  110. package/dist/shared/chunk-r471sknr.js +209 -0
  111. package/dist/shared/chunk-s2jeqqan.js +243 -0
  112. package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
  113. package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
  114. package/dist/shared/chunk-w5h6ay93.js +72 -0
  115. package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
  116. package/dist/shared/chunk-x7f3g82r.js +285 -0
  117. package/dist/shared/chunk-xq5hc5gv.js +333 -0
  118. package/dist/shared/chunk-y0188bbn.js +331 -0
  119. package/dist/shared/chunk-ym0xbses.js +518 -0
  120. package/dist/styles.css +264 -0
  121. package/index.ts +22 -0
  122. package/lib/artwork.ts +112 -0
  123. package/lib/clock.ts +53 -0
  124. package/lib/geometry.ts +130 -0
  125. package/lib/island-context.tsx +24 -0
  126. package/lib/motion.ts +42 -0
  127. package/mock/activities.tsx +77 -0
  128. package/mock/artwork.tsx +37 -0
  129. package/mock/clipboard.tsx +79 -0
  130. package/mock/clock.tsx +77 -0
  131. package/mock/data.ts +139 -0
  132. package/mock/desktop.tsx +83 -0
  133. package/mock/files.tsx +70 -0
  134. package/mock/fit.ts +26 -0
  135. package/mock/island-content.tsx +142 -0
  136. package/mock/scene.tsx +52 -0
  137. package/mock/screen.tsx +76 -0
  138. package/mock/settings.tsx +489 -0
  139. package/mock/system.ts +46 -0
  140. package/mock/weather.tsx +105 -0
  141. package/package.json +122 -4
@@ -0,0 +1,88 @@
1
+ "use client";
2
+
3
+ import {
4
+ SECOND2,
5
+ formatClock2,
6
+ useEdgeClock2
7
+ } from "./chunk-gb56m10p.js";
8
+
9
+ // components/indicators/media-scrubber/index.tsx
10
+ import Slider from "@justanarthur/modo-ui/components/inputs/slider";
11
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
12
+ import { useEffect, useState } from "react";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ /*!
15
+ * Local addition: the playback position of a notch app's now-playing view,
16
+ * on modo-ui's Slider. Rebuilt from Just Notch's now-playing plugin
17
+ * (`Scrubber`).
18
+ */
19
+ function MediaScrubber2({
20
+ position,
21
+ duration,
22
+ playing = false,
23
+ onSeek,
24
+ size = "compact",
25
+ label = "Position",
26
+ disabled = false,
27
+ quiet = false,
28
+ className
29
+ }) {
30
+ const [base, setBase] = useState(() => ({ seconds: position, since: Date.now() }));
31
+ const [dragged, setDragged] = useState();
32
+ useEffect(() => setBase({ seconds: position, since: Date.now() }), [position]);
33
+ const now = useEdgeClock2(base.since, playing && dragged === undefined);
34
+ const live = Math.min(duration, base.seconds + (playing ? Math.max(0, now - base.since) / SECOND2 : 0));
35
+ const value = dragged ?? live;
36
+ const commit = () => {
37
+ if (dragged === undefined)
38
+ return;
39
+ setBase({ seconds: dragged, since: Date.now() });
40
+ setDragged(undefined);
41
+ onSeek?.(dragged);
42
+ };
43
+ return /* @__PURE__ */ jsxs("div", {
44
+ className: cn("flex items-center gap-3", className),
45
+ onPointerUp: commit,
46
+ onKeyUp: commit,
47
+ children: [
48
+ /* @__PURE__ */ jsx("span", {
49
+ className: "w-9 shrink-0 text-micro tabular-nums text-muted-foreground",
50
+ children: formatClock2(value)
51
+ }),
52
+ /* @__PURE__ */ jsxs("span", {
53
+ className: "group/scrub relative flex min-w-0 flex-1 items-center",
54
+ children: [
55
+ /* @__PURE__ */ jsx(Slider, {
56
+ className: cn("mb-0 min-w-0 flex-1", quiet && "opacity-0 transition-[opacity] duration-fast group-hover/scrub:opacity-100 group-focus-within/scrub:opacity-100 pointer-coarse:opacity-100"),
57
+ size,
58
+ label,
59
+ showValue: false,
60
+ formatValue: formatClock2,
61
+ min: 0,
62
+ max: Math.max(1, duration),
63
+ step: 1,
64
+ value,
65
+ disabled,
66
+ onValueChange: (v) => setDragged(v)
67
+ }),
68
+ quiet && /* @__PURE__ */ jsx("span", {
69
+ "aria-hidden": true,
70
+ className: "pointer-events-none absolute inset-x-0 h-1 overflow-hidden rounded-full bg-active transition-[opacity] duration-fast group-hover/scrub:opacity-0 group-focus-within/scrub:opacity-0 pointer-coarse:opacity-0",
71
+ children: /* @__PURE__ */ jsx("span", {
72
+ className: "block size-full rounded-full bg-foreground",
73
+ style: { transform: `translateX(${(value / Math.max(1, duration) - 1) * 100}%)` }
74
+ })
75
+ })
76
+ ]
77
+ }),
78
+ /* @__PURE__ */ jsxs("span", {
79
+ className: "w-9 shrink-0 text-right text-micro tabular-nums text-muted-foreground",
80
+ children: [
81
+ "-",
82
+ formatClock2(Math.max(0, duration - value))
83
+ ]
84
+ })
85
+ ]
86
+ });
87
+ }
88
+ export { MediaScrubber2 };
@@ -0,0 +1,123 @@
1
+ import { JSX as JSX_1kxb } from "react";
2
+ type PomodoroPhase2 = "focus" | "short-break" | "long-break";
3
+ /** A Pomodoro cycle's lengths, in minutes, and how many focus rounds come before the long break. */
4
+ interface PomodoroSettings2 {
5
+ focus: number;
6
+ shortBreak: number;
7
+ longBreak: number;
8
+ rounds: number;
9
+ }
10
+ /** A Pomodoro phase: running while it has `endsAt`, paused while it has `remaining`. */
11
+ interface PomodoroRun2 {
12
+ phase: PomodoroPhase2;
13
+ /** The focus round it belongs to, from 1: a break follows its round. */
14
+ round: number;
15
+ /** The phase's whole length, in ms. */
16
+ total: number;
17
+ /** When it ends, in epoch ms, while it runs. */
18
+ endsAt?: number;
19
+ /** The time left, in ms, while it is paused. */
20
+ remaining?: number;
21
+ }
22
+ /** A world clock: a city and its IANA time zone. */
23
+ interface ClockZone2 {
24
+ city: string;
25
+ /** An IANA time zone: `America/Chicago`. */
26
+ timeZone: string;
27
+ }
28
+ interface ClockProps2 {
29
+ /** The world clocks beside the time, two or three. */
30
+ zones?: ClockZone2[];
31
+ /** Shows the seconds, re-rendering on each second's edge instead of each minute's. Defaults to `false`. */
32
+ seconds?: boolean;
33
+ /** A 12-hour clock (`true`) or a 24-hour one (`false`). Defaults to the locale's. */
34
+ hour12?: boolean;
35
+ /** The time zone of the main clock. Defaults to the system's. */
36
+ timeZone?: string;
37
+ /** Formats the time and the date. Defaults to the browser's locale. */
38
+ locale?: Intl.LocalesArgument;
39
+ /** The moment the clock shows, in epoch ms. Defaults to now, re-read on each minute (or second). */
40
+ now?: number;
41
+ /** The Pomodoro cycle's lengths, merged over 25 / 5 / 15 minutes and 4 rounds; `false` leaves the Pomodoro out. */
42
+ pomodoro?: Partial<PomodoroSettings2> | false;
43
+ /** The Pomodoro run (controlled); `null` shows the clock. */
44
+ value?: PomodoroRun2 | null;
45
+ /** The run at first (uncontrolled). Defaults to `null`. */
46
+ defaultValue?: PomodoroRun2 | null;
47
+ /** Called with the run a start, pause, resume, skip, +1 min or reset leaves (`null` after a reset). */
48
+ onValueChange?: (run: PomodoroRun2 | null) => void;
49
+ /** Called when a phase reaches zero, with the next one, which waits paused to be started: show `Clock.PhaseDone`. */
50
+ onPhaseEnd?: (ended: PomodoroRun2, next: PomodoroRun2) => void;
51
+ /** Classes for the root, which fills its container. */
52
+ className?: string;
53
+ }
54
+ /** The first focus round, running from now. */
55
+ declare function startPomodoro2(pomodoro?: Partial<PomodoroSettings2>): PomodoroRun2;
56
+ /** The phase after `run`, paused at its whole length until it is started: what a phase reaching zero leaves. */
57
+ declare function advancePomodoro2(run: PomodoroRun2, pomodoro?: Partial<PomodoroSettings2>): PomodoroRun2;
58
+ /** `run` running from now, from the time it had left. */
59
+ declare function resumePomodoro2(run: PomodoroRun2): PomodoroRun2;
60
+ interface PartProps {
61
+ /** The Pomodoro run; without one the part shows nothing. */
62
+ run?: PomodoroRun2 | null;
63
+ }
64
+ type Element_12xgc = JSX_1kxb["Element"];
65
+ /** The compact island's left wing: the ring of the phase's time left. */
66
+ declare function ClockLeading2({ run }: PartProps): Element_12xgc | null;
67
+ /** The compact island's right wing: the phase's time left as `mm:ss`, muted while paused. */
68
+ declare function ClockTrailing2({ run }: PartProps): Element_12xgc | null;
69
+ /** The split island's bubble: the ring of the phase's time left. */
70
+ declare function ClockMinimal2({ run }: PartProps): Element_12xgc | null;
71
+ interface ClockPhaseDoneProps2 {
72
+ /** The phase that reached zero. */
73
+ ended: Pick<PomodoroRun2, "phase" | "round">;
74
+ /** The cycle's lengths, as given to the Clock. */
75
+ pomodoro?: Partial<PomodoroSettings2>;
76
+ /** Called by the button that starts the next phase; without it the button hides. */
77
+ onStart?: () => void;
78
+ }
79
+ /** The island's flash when a phase reaches zero: "Focus done — break time" or "Break over", and a button to start the next. */
80
+ declare function ClockPhaseDone2({ ended, pomodoro, onStart }: ClockPhaseDoneProps2): Element_12xgc;
81
+ /**
82
+ * A notch app's clock: the time as the hero, the date above it, the world
83
+ * clocks beside it, and a Pomodoro cycle that takes over while it runs.
84
+ *
85
+ * The time is set large in hours and minutes (`seconds` adds them, muted,
86
+ * and a tick on each second), on the locale's clock or the one `hour12`
87
+ * picks, with the time zone's name under it and the date on the line above.
88
+ * Beside it, past a hairline, the world clocks (`zones`): each city's time,
89
+ * how far it is from here (`−6h`), whether it's day or night there, and
90
+ * `Tomorrow` or `Yesterday` when its date differs. Nothing ticks between
91
+ * minutes; `now` pins the moment.
92
+ *
93
+ * Under the time the Pomodoro waits with its lengths (`pomodoro`: focus,
94
+ * short and long break in minutes, and the rounds before the long one) and
95
+ * a Start focus button. A run takes the widget over: the phase's ring in
96
+ * its hue (focus warm, a break green) as the picture, the time left as the
97
+ * hero, its round (`Focus 2 of 4`), when it ends and what comes next, and
98
+ * the next phases with their start times beside it. Pause / resume is the
99
+ * main action, with +1 min and skip beside it and reset at the top.
100
+ *
101
+ * The run is a value (`value` / `onValueChange`, or kept here from
102
+ * `defaultValue`): a running phase carries when it ends, a paused one the
103
+ * time it had left, so a host can persist it and pick it up after a
104
+ * reload. When a phase reaches zero the next one waits paused at its whole
105
+ * length and `onPhaseEnd` is called; the helpers `startPomodoro`,
106
+ * `advancePomodoro` and `resumePomodoro` build the same runs for a host
107
+ * that keeps time itself.
108
+ *
109
+ * The other forms are parts: `Clock.Leading` and `Clock.Trailing` for the
110
+ * compact island's wings (the ring and `mm:ss`, nothing without a run),
111
+ * `Clock.Minimal`, the ring, for the split island's bubble, and
112
+ * `Clock.PhaseDone`, the flash at a phase's end with a button to start the
113
+ * next.
114
+ *
115
+ * @example {@include ./examples.mdx}
116
+ */
117
+ declare const Clock2: (({ zones, seconds, hour12, timeZone, locale, now: nowProp, pomodoro, value, defaultValue, onValueChange, onPhaseEnd, className }: ClockProps2) => Element_12xgc) & {
118
+ Leading: typeof ClockLeading2;
119
+ Trailing: typeof ClockTrailing2;
120
+ Minimal: typeof ClockMinimal2;
121
+ PhaseDone: typeof ClockPhaseDone2;
122
+ };
123
+ export { PomodoroPhase2, PomodoroSettings2, PomodoroRun2, ClockZone2, ClockProps2, startPomodoro2, advancePomodoro2, resumePomodoro2, ClockLeading2, ClockTrailing2, ClockMinimal2, ClockPhaseDoneProps2, ClockPhaseDone2, Clock2 };
@@ -0,0 +1,315 @@
1
+ "use client";
2
+
3
+ // blocks/app/settings-window/index.tsx
4
+ import Button from "@justanarthur/modo-ui/components/actions/button";
5
+ import List, { LIST_SWITCH } from "@justanarthur/modo-ui/components/data-display/list";
6
+ import StatusDot from "@justanarthur/modo-ui/components/feedback/status-dot";
7
+ import ChoiceList from "@justanarthur/modo-ui/components/inputs/choice-list";
8
+ import Switch from "@justanarthur/modo-ui/components/inputs/switch";
9
+ import Sidebar from "@justanarthur/modo-ui/components/navigation/sidebar";
10
+ import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
11
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
12
+ import ScrollArea from "@justanarthur/modo-ui/primitives/layout/scroll-area";
13
+ import { ChevronRight, Info, Puzzle, Settings2, ShieldCheck } from "lucide-react";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ /*!
16
+ * Local addition: a notch app's settings window. Rebuilt from Just Notch's
17
+ * runtime (`settings/settings.tsx`) as a presentational block: preferences,
18
+ * plugins, permissions and the about rows come in as props.
19
+ */
20
+ var SCREENS = [
21
+ { value: "notched", label: "Notched screen only", note: "The built-in display" },
22
+ { value: "all", label: "All screens", note: "A virtual notch on the others" }
23
+ ];
24
+ function Page({ title, lead, children }) {
25
+ return /* @__PURE__ */ jsxs("section", {
26
+ className: "flex flex-col gap-4",
27
+ children: [
28
+ /* @__PURE__ */ jsxs("div", {
29
+ className: "flex flex-col gap-1",
30
+ children: [
31
+ /* @__PURE__ */ jsx("h2", {
32
+ className: "m-0 text-title weight-semibold text-foreground",
33
+ children: title
34
+ }),
35
+ lead && /* @__PURE__ */ jsx("p", {
36
+ className: "m-0 text-body text-muted-foreground",
37
+ children: lead
38
+ })
39
+ ]
40
+ }),
41
+ children
42
+ ]
43
+ });
44
+ }
45
+ function General({ preferences, onChange }) {
46
+ return /* @__PURE__ */ jsxs(Page, {
47
+ title: "General",
48
+ children: [
49
+ /* @__PURE__ */ jsx(List, {
50
+ children: /* @__PURE__ */ jsx(List.Section, {
51
+ title: "Startup",
52
+ children: /* @__PURE__ */ jsx(List.Row, {
53
+ label: "Launch at login",
54
+ description: "Starts the app when you log in to your Mac.",
55
+ children: /* @__PURE__ */ jsx(Switch, {
56
+ "aria-label": "Launch at login",
57
+ className: LIST_SWITCH,
58
+ checked: preferences.launchAtLogin,
59
+ onCheckedChange: (launchAtLogin) => onChange({ ...preferences, launchAtLogin })
60
+ })
61
+ })
62
+ })
63
+ }),
64
+ /* @__PURE__ */ jsxs("div", {
65
+ className: "flex flex-col gap-2",
66
+ children: [
67
+ /* @__PURE__ */ jsx("span", {
68
+ className: "text-caption text-muted-foreground",
69
+ children: "Show the island on"
70
+ }),
71
+ /* @__PURE__ */ jsx(ChoiceList, {
72
+ label: "Show the island on",
73
+ value: preferences.screens,
74
+ onValueChange: (screens) => onChange({ ...preferences, screens }),
75
+ options: SCREENS.map((screen) => ({
76
+ value: screen.value,
77
+ label: screen.label,
78
+ content: /* @__PURE__ */ jsxs("span", {
79
+ className: "flex min-w-0 flex-1 items-baseline justify-between gap-3",
80
+ children: [
81
+ /* @__PURE__ */ jsx("span", {
82
+ className: "truncate",
83
+ children: screen.label
84
+ }),
85
+ /* @__PURE__ */ jsx("span", {
86
+ className: "truncate text-caption text-muted-foreground",
87
+ children: screen.note
88
+ })
89
+ ]
90
+ })
91
+ }))
92
+ })
93
+ ]
94
+ })
95
+ ]
96
+ });
97
+ }
98
+ function Plugins({ plugins, enabled, onChange, onOpen }) {
99
+ return /* @__PURE__ */ jsx(Page, {
100
+ title: "Plugins",
101
+ lead: "Each plugin adds activities and widgets to the island.",
102
+ children: plugins.length === 0 ? /* @__PURE__ */ jsx("p", {
103
+ className: "m-0 text-body text-muted-foreground",
104
+ children: "No plugins installed."
105
+ }) : /* @__PURE__ */ jsx(List, {
106
+ children: /* @__PURE__ */ jsx(List.Section, {
107
+ title: "Installed",
108
+ aside: `${plugins.filter((p) => enabled[p.id] ?? true).length} on`,
109
+ children: plugins.map((plugin) => {
110
+ const Icon = plugin.icon ?? Puzzle;
111
+ return /* @__PURE__ */ jsxs(List.Row, {
112
+ label: /* @__PURE__ */ jsxs("span", {
113
+ className: "flex min-w-0 items-center gap-2",
114
+ children: [
115
+ /* @__PURE__ */ jsx(Icon, {
116
+ size: 16,
117
+ strokeWidth: 1.5,
118
+ className: "shrink-0 text-muted-foreground"
119
+ }),
120
+ /* @__PURE__ */ jsx("span", {
121
+ className: "truncate",
122
+ children: plugin.name
123
+ })
124
+ ]
125
+ }),
126
+ description: plugin.description,
127
+ children: [
128
+ plugin.settings !== undefined && /* @__PURE__ */ jsx(Button, {
129
+ variant: "ghost",
130
+ size: "icon",
131
+ "aria-label": `${plugin.name} settings`,
132
+ onClick: () => onOpen(plugin.id),
133
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
134
+ }),
135
+ /* @__PURE__ */ jsx(Switch, {
136
+ "aria-label": plugin.name,
137
+ className: LIST_SWITCH,
138
+ checked: enabled[plugin.id] ?? true,
139
+ onCheckedChange: (on) => onChange({ ...enabled, [plugin.id]: on })
140
+ })
141
+ ]
142
+ }, plugin.id);
143
+ })
144
+ })
145
+ })
146
+ });
147
+ }
148
+ function Permissions({ permissions, onOpen }) {
149
+ return /* @__PURE__ */ jsx(Page, {
150
+ title: "Permissions",
151
+ lead: "What macOS lets the app read and control.",
152
+ children: /* @__PURE__ */ jsx(List, {
153
+ children: /* @__PURE__ */ jsx(List.Section, {
154
+ title: "Privacy & Security",
155
+ children: permissions.map((permission) => /* @__PURE__ */ jsx(List.Row, {
156
+ label: /* @__PURE__ */ jsxs("span", {
157
+ className: "flex min-w-0 items-center gap-2",
158
+ children: [
159
+ /* @__PURE__ */ jsx(StatusDot, {
160
+ status: permission.granted === undefined ? "running" : permission.granted ? "success" : "waiting",
161
+ label: permission.granted === undefined ? "Checking" : permission.granted ? "Granted" : "Not granted"
162
+ }),
163
+ /* @__PURE__ */ jsx("span", {
164
+ className: "truncate",
165
+ children: permission.label
166
+ })
167
+ ]
168
+ }),
169
+ description: permission.description,
170
+ children: permission.granted === false ? /* @__PURE__ */ jsx(Button, {
171
+ variant: "ghost",
172
+ size: "compact",
173
+ onClick: () => onOpen?.(permission.id),
174
+ children: "Open Settings"
175
+ }) : /* @__PURE__ */ jsx("span", {
176
+ className: "pr-3 text-caption text-muted-foreground",
177
+ children: permission.granted ? "Granted" : "Checking…"
178
+ })
179
+ }, permission.id))
180
+ })
181
+ })
182
+ });
183
+ }
184
+ function About({ rows }) {
185
+ return /* @__PURE__ */ jsx(Page, {
186
+ title: "About",
187
+ children: /* @__PURE__ */ jsx(List, {
188
+ children: rows.map((row) => /* @__PURE__ */ jsx(List.Row, {
189
+ label: /* @__PURE__ */ jsx("span", {
190
+ className: "text-muted-foreground",
191
+ children: row.label
192
+ }),
193
+ children: /* @__PURE__ */ jsx("span", {
194
+ className: "min-w-0 truncate pr-3 text-body text-foreground",
195
+ children: row.value
196
+ })
197
+ }, row.label))
198
+ })
199
+ });
200
+ }
201
+ var PAGES = [
202
+ { value: "general", label: "General", icon: Settings2 },
203
+ { value: "plugins", label: "Plugins", icon: Puzzle },
204
+ { value: "permissions", label: "Permissions", icon: ShieldCheck },
205
+ { value: "about", label: "About", icon: Info }
206
+ ];
207
+ function SettingsWindow2({
208
+ name = "Notch",
209
+ value,
210
+ defaultValue = "general",
211
+ onValueChange,
212
+ preferences: preferencesProp,
213
+ defaultPreferences = { launchAtLogin: true, screens: "notched" },
214
+ onPreferencesChange,
215
+ plugins = [],
216
+ enabled: enabledProp,
217
+ defaultEnabled = {},
218
+ onEnabledChange,
219
+ permissions = [],
220
+ onOpenPermission,
221
+ about = [],
222
+ className
223
+ }) {
224
+ const [page, setPage] = useControllableState(value, defaultValue, onValueChange);
225
+ const [preferences, setPreferences] = useControllableState(preferencesProp, defaultPreferences, onPreferencesChange);
226
+ const [enabled, setEnabled] = useControllableState(enabledProp, defaultEnabled, onEnabledChange);
227
+ const withSettings = plugins.filter((plugin) => plugin.settings !== undefined);
228
+ const plugin = withSettings.find((p) => `plugin:${p.id}` === page);
229
+ return /* @__PURE__ */ jsxs(Sidebar.Provider, {
230
+ className: cn("h-full min-h-0", className),
231
+ persist: false,
232
+ shortcut: null,
233
+ mobileBreakpoint: 0,
234
+ width: "13rem",
235
+ children: [
236
+ /* @__PURE__ */ jsx(Sidebar, {
237
+ className: "h-full",
238
+ collapsible: "none",
239
+ value: page,
240
+ onValueChange: setPage,
241
+ children: /* @__PURE__ */ jsxs(Sidebar.Content, {
242
+ children: [
243
+ /* @__PURE__ */ jsxs(Sidebar.Group, {
244
+ children: [
245
+ /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
246
+ children: name
247
+ }),
248
+ /* @__PURE__ */ jsx(Sidebar.Menu, {
249
+ children: PAGES.map((item) => /* @__PURE__ */ jsx(Sidebar.MenuItem, {
250
+ children: /* @__PURE__ */ jsx(Sidebar.MenuButton, {
251
+ icon: item.icon,
252
+ value: item.value,
253
+ children: item.label
254
+ })
255
+ }, item.value))
256
+ })
257
+ ]
258
+ }),
259
+ withSettings.length > 0 && /* @__PURE__ */ jsxs(Sidebar.Group, {
260
+ children: [
261
+ /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
262
+ children: "Plugin settings"
263
+ }),
264
+ /* @__PURE__ */ jsx(Sidebar.Menu, {
265
+ children: withSettings.map((p) => /* @__PURE__ */ jsx(Sidebar.MenuItem, {
266
+ children: /* @__PURE__ */ jsx(Sidebar.MenuButton, {
267
+ icon: p.icon,
268
+ value: `plugin:${p.id}`,
269
+ children: p.name
270
+ })
271
+ }, p.id))
272
+ })
273
+ ]
274
+ })
275
+ ]
276
+ })
277
+ }),
278
+ /* @__PURE__ */ jsx(Sidebar.Inset, {
279
+ className: "min-h-0 min-w-0",
280
+ children: /* @__PURE__ */ jsx(ScrollArea, {
281
+ className: "h-full",
282
+ viewportClassName: "scroll-fade",
283
+ children: /* @__PURE__ */ jsxs("div", {
284
+ className: "mx-auto flex w-full max-w-160 flex-col gap-8 p-8",
285
+ children: [
286
+ page === "general" && /* @__PURE__ */ jsx(General, {
287
+ preferences,
288
+ onChange: setPreferences
289
+ }),
290
+ page === "plugins" && /* @__PURE__ */ jsx(Plugins, {
291
+ plugins,
292
+ enabled,
293
+ onChange: setEnabled,
294
+ onOpen: (id) => setPage(`plugin:${id}`)
295
+ }),
296
+ page === "permissions" && /* @__PURE__ */ jsx(Permissions, {
297
+ permissions,
298
+ onOpen: onOpenPermission
299
+ }),
300
+ page === "about" && /* @__PURE__ */ jsx(About, {
301
+ rows: about
302
+ }),
303
+ plugin && /* @__PURE__ */ jsx(Page, {
304
+ title: plugin.name,
305
+ lead: plugin.description,
306
+ children: plugin.settings
307
+ })
308
+ ]
309
+ })
310
+ }, page)
311
+ })
312
+ ]
313
+ });
314
+ }
315
+ export { SettingsWindow2 };
@@ -0,0 +1,63 @@
1
+ /** What the island shows: the bare notch, an activity in the wings, two activities, the open panel, or an alert. */
2
+ type IslandState2 = "idle" | "compact" | "split" | "expanded" | "flash";
3
+ declare const ISLAND_STATES2: IslandState2[];
4
+ /** A width and a height in px. */
5
+ interface Size2 {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ /** The sizes the island grows between: the hardware notch and the open panel. */
10
+ interface IslandGeometry2 {
11
+ notch: Size2;
12
+ panel: Size2;
13
+ }
14
+ /** The island's outline: a body of `w` × `h` hanging from the top edge, `radius` below, concave `shoulder`s into the edge. */
15
+ interface Shape2 {
16
+ w: number;
17
+ h: number;
18
+ radius: number;
19
+ shoulder: number;
20
+ }
21
+ declare const DEFAULT_NOTCH2: Size2;
22
+ declare const DEFAULT_PANEL2: Size2;
23
+ /** The open island's one content inset: header, title and content all start here, clear of the bottom corners. */
24
+ declare const INSET2 = 20;
25
+ /** Kept free on each side of the notch. */
26
+ declare const NOTCH_GAP2 = 8;
27
+ /** Room for one compact slot beside the notch: about as wide as the notch is tall. */
28
+ declare const slotWidth2: (notch: Size2) => number;
29
+ /**
30
+ * The outline for `state`. `room` is the width the island may take (its
31
+ * container's); the open panel and the flash shrink to fit it, shoulders included.
32
+ */
33
+ declare function shapeFor2(state: IslandState2, { notch, panel }: IslandGeometry2, room?: number): Shape2;
34
+ /** The detached bubble of `split`: a circle as tall as the compact island, its center `x` from the island's center. */
35
+ declare function bubbleFor2(shape: Shape2, notch: Size2, detached: boolean): {
36
+ x: number;
37
+ r: number;
38
+ };
39
+ /**
40
+ * The outline as one SVG path, centered on `cx`. It starts a point above the
41
+ * top edge so no hairline shows where it meets the screen.
42
+ */
43
+ declare function islandPath2(cx: number, { w, h, radius, shoulder }: Shape2): string;
44
+ interface StripLayout2 {
45
+ /** Tabs in the left wing; the rest follow in the right one. */
46
+ before: number;
47
+ /** More tabs than both wings hold: the strip scrolls, behind the notch. */
48
+ overflow: boolean;
49
+ /** The notch and its gaps in the strip's coordinates. */
50
+ hole: {
51
+ start: number;
52
+ end: number;
53
+ };
54
+ /** Least width of the gap between the wings, so the right wing starts past the notch. */
55
+ spacer: number;
56
+ }
57
+ /**
58
+ * Tabs of `tab` px across a strip of `width` centered under a notch of
59
+ * `notchWidth`, flowing from the left wing into the right one, balanced.
60
+ * `reserve` is kept free at the right wing's far end (a settings button).
61
+ */
62
+ declare function stripLayout2(count: number, width: number, notchWidth: number, tab: number, reserve?: number): StripLayout2;
63
+ export { IslandState2, ISLAND_STATES2, Size2, IslandGeometry2, Shape2, DEFAULT_NOTCH2, DEFAULT_PANEL2, INSET2, NOTCH_GAP2, slotWidth2, shapeFor2, bubbleFor2, islandPath2, StripLayout2, stripLayout2 };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+
3
+ // lib/island-context.tsx
4
+ import { createContext, useContext } from "react";
5
+ var IslandContext2 = createContext(null);
6
+ function useIsland2() {
7
+ return useContext(IslandContext2);
8
+ }
9
+
10
+ export { IslandContext2, useIsland2 };