@justanarthur/modo-ui-notch 0.2.0 → 0.4.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 (148) hide show
  1. package/README.md +11 -11
  2. package/blocks/activities/agenda/examples.mdx +29 -5
  3. package/blocks/activities/agenda/index.tsx +438 -181
  4. package/blocks/activities/clock/examples.mdx +89 -0
  5. package/blocks/activities/clock/index.tsx +917 -0
  6. package/blocks/activities/now-playing/examples.mdx +40 -13
  7. package/blocks/activities/now-playing/index.tsx +399 -120
  8. package/blocks/activities/weather/examples.mdx +123 -0
  9. package/blocks/activities/weather/index.tsx +863 -0
  10. package/blocks/app/expanded-island/examples.mdx +8 -7
  11. package/blocks/app/expanded-island/index.tsx +22 -4
  12. package/blocks/app/settings-window/examples.mdx +14 -2
  13. package/blocks/app/settings-window/index.tsx +33 -10
  14. package/blocks/system/clipboard/examples.mdx +91 -0
  15. package/blocks/system/clipboard/index.tsx +773 -0
  16. package/blocks/system/recent-files/examples.mdx +80 -0
  17. package/blocks/system/recent-files/index.tsx +627 -0
  18. package/blocks/system/system-stats/examples.mdx +46 -9
  19. package/blocks/system/system-stats/index.tsx +445 -104
  20. package/components/indicators/media-scrubber/examples.mdx +8 -0
  21. package/components/indicators/media-scrubber/index.tsx +37 -13
  22. package/components/island/island/examples.mdx +4 -4
  23. package/components/island/island/index.tsx +2 -2
  24. package/components/island/island-flash/examples.mdx +15 -18
  25. package/components/island/island-flash/index.tsx +4 -4
  26. package/components/island/island-tabs/examples.mdx +5 -5
  27. package/components/island/widget/examples.mdx +76 -0
  28. package/components/island/widget/index.tsx +465 -0
  29. package/dist/blocks/activities/agenda/index.d.ts +2 -1
  30. package/dist/blocks/activities/agenda/index.js +3 -3
  31. package/dist/blocks/activities/clock/index.d.ts +3 -0
  32. package/dist/blocks/activities/clock/index.js +25 -0
  33. package/dist/blocks/activities/now-playing/index.d.ts +4 -2
  34. package/dist/blocks/activities/now-playing/index.js +5 -3
  35. package/dist/blocks/activities/weather/index.d.ts +3 -0
  36. package/dist/blocks/activities/weather/index.js +21 -0
  37. package/dist/blocks/app/expanded-island/index.d.ts +1 -1
  38. package/dist/blocks/app/expanded-island/index.js +4 -3
  39. package/dist/blocks/app/settings-window/index.d.ts +1 -1
  40. package/dist/blocks/app/settings-window/index.js +1 -1
  41. package/dist/blocks/system/clipboard/index.d.ts +3 -0
  42. package/dist/blocks/system/clipboard/index.js +17 -0
  43. package/dist/blocks/system/recent-files/index.d.ts +3 -0
  44. package/dist/blocks/system/recent-files/index.js +19 -0
  45. package/dist/blocks/system/system-stats/index.d.ts +3 -2
  46. package/dist/blocks/system/system-stats/index.js +4 -1
  47. package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
  48. package/dist/components/indicators/media-scrubber/index.js +1 -1
  49. package/dist/components/island/island/index.d.ts +1 -1
  50. package/dist/components/island/island/index.js +2 -2
  51. package/dist/components/island/island-flash/index.d.ts +1 -1
  52. package/dist/components/island/island-flash/index.js +1 -1
  53. package/dist/components/island/island-tabs/index.js +2 -2
  54. package/dist/components/island/widget/index.d.ts +2 -0
  55. package/dist/components/island/widget/index.js +32 -0
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.js +104 -58
  58. package/dist/lib/artwork.d.ts +2 -0
  59. package/dist/lib/artwork.js +8 -0
  60. package/dist/lib/geometry.js +1 -1
  61. package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
  62. package/dist/shared/chunk-2b6gpn8k.js +444 -0
  63. package/dist/shared/chunk-3hcnf4yx.js +481 -0
  64. package/dist/shared/chunk-42wab62s.d.ts +197 -0
  65. package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
  66. package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
  67. package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
  68. package/dist/shared/chunk-93dtpjz7.js +789 -0
  69. package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
  70. package/dist/shared/chunk-a6njb8db.d.ts +129 -0
  71. package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
  72. package/dist/shared/chunk-evqpf92s.d.ts +168 -0
  73. package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
  74. package/dist/shared/chunk-gcyspvgr.js +582 -0
  75. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  76. package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
  77. package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
  78. package/dist/shared/chunk-n739am8j.d.ts +112 -0
  79. package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
  80. package/dist/shared/chunk-nwzpekvy.js +774 -0
  81. package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
  82. package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
  83. package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
  84. package/dist/shared/chunk-t9wqhgzt.js +765 -0
  85. package/dist/shared/chunk-w5h6ay93.js +72 -0
  86. package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
  87. package/dist/shared/chunk-wf0jtzhs.js +295 -0
  88. package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
  89. package/dist/shared/chunk-yq5svpk7.js +524 -0
  90. package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
  91. package/dist/styles.css +151 -49
  92. package/index.ts +7 -6
  93. package/lib/artwork.ts +112 -0
  94. package/lib/geometry.ts +1 -1
  95. package/mock/activities.tsx +9 -32
  96. package/mock/artwork.tsx +13 -1
  97. package/mock/clipboard.tsx +113 -0
  98. package/mock/clock.tsx +77 -0
  99. package/mock/data.ts +78 -44
  100. package/mock/files.tsx +83 -0
  101. package/mock/island-content.tsx +79 -122
  102. package/mock/screen.tsx +76 -0
  103. package/mock/settings.tsx +370 -91
  104. package/mock/system.ts +49 -0
  105. package/mock/weather.tsx +135 -0
  106. package/package.json +7 -2
  107. package/blocks/activities/shelf/examples.mdx +0 -33
  108. package/blocks/activities/shelf/index.tsx +0 -289
  109. package/blocks/activities/timer/examples.mdx +0 -52
  110. package/blocks/activities/timer/index.tsx +0 -292
  111. package/blocks/system/controls/examples.mdx +0 -34
  112. package/blocks/system/controls/index.tsx +0 -167
  113. package/blocks/system/devices/examples.mdx +0 -25
  114. package/blocks/system/devices/index.tsx +0 -172
  115. package/blocks/system/power-alert/examples.mdx +0 -32
  116. package/blocks/system/power-alert/index.tsx +0 -89
  117. package/components/indicators/battery-glyph/examples.mdx +0 -22
  118. package/components/indicators/battery-glyph/index.tsx +0 -91
  119. package/dist/blocks/activities/shelf/index.d.ts +0 -2
  120. package/dist/blocks/activities/shelf/index.js +0 -14
  121. package/dist/blocks/activities/timer/index.d.ts +0 -2
  122. package/dist/blocks/activities/timer/index.js +0 -19
  123. package/dist/blocks/system/controls/index.d.ts +0 -2
  124. package/dist/blocks/system/controls/index.js +0 -10
  125. package/dist/blocks/system/devices/index.d.ts +0 -2
  126. package/dist/blocks/system/devices/index.js +0 -12
  127. package/dist/blocks/system/power-alert/index.d.ts +0 -2
  128. package/dist/blocks/system/power-alert/index.js +0 -9
  129. package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
  130. package/dist/components/indicators/battery-glyph/index.js +0 -9
  131. package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
  132. package/dist/shared/chunk-45gytfr1.d.ts +0 -84
  133. package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
  134. package/dist/shared/chunk-5w0yck07.d.ts +0 -32
  135. package/dist/shared/chunk-7hr53mby.js +0 -116
  136. package/dist/shared/chunk-b8jb1w72.js +0 -145
  137. package/dist/shared/chunk-cpewy6yg.js +0 -178
  138. package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
  139. package/dist/shared/chunk-enm6td0p.js +0 -280
  140. package/dist/shared/chunk-fvedaas2.d.ts +0 -33
  141. package/dist/shared/chunk-gex38j8x.d.ts +0 -82
  142. package/dist/shared/chunk-hwtxpzg0.js +0 -69
  143. package/dist/shared/chunk-phb53x1f.js +0 -252
  144. package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
  145. package/dist/shared/chunk-rcp1g9ca.js +0 -70
  146. package/dist/shared/chunk-rx9sphz2.js +0 -266
  147. package/dist/shared/chunk-xdeek16r.d.ts +0 -58
  148. package/dist/shared/chunk-xkzjk1tq.js +0 -206
@@ -1,116 +0,0 @@
1
- "use client";
2
-
3
- // blocks/system/controls/index.tsx
4
- import Slider from "@justanarthur/modo-ui/components/inputs/slider";
5
- import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
6
- import { cn } from "@justanarthur/modo-ui/lib/utils";
7
- import {
8
- Keyboard,
9
- KeyboardOff,
10
- Speaker,
11
- Sun,
12
- SunDim,
13
- SunMedium,
14
- Volume,
15
- Volume1,
16
- Volume2,
17
- VolumeX
18
- } from "lucide-react";
19
- import { jsx, jsxs } from "react/jsx-runtime";
20
- /*!
21
- * Local addition: a notch app's system controls and their HUD, the level the
22
- * island shows in place of the system's volume and brightness overlay.
23
- * Rebuilt from Just Notch's HUD plugin (`Level`, `Controls`, `Flash`) as
24
- * presentational parts: the levels come in as values.
25
- */
26
- var LABEL = {
27
- volume: "Volume",
28
- brightness: "Brightness",
29
- keyboard: "Keyboard brightness"
30
- };
31
- function glyph(kind, value, muted) {
32
- if (kind === "volume") {
33
- if (muted || value === 0)
34
- return VolumeX;
35
- return value < 0.34 ? Volume : value < 0.67 ? Volume1 : Volume2;
36
- }
37
- if (kind === "brightness")
38
- return value < 0.34 ? SunDim : value < 0.67 ? SunMedium : Sun;
39
- return value === 0 ? KeyboardOff : Keyboard;
40
- }
41
- function ControlsLevel2({
42
- kind,
43
- value: valueProp,
44
- defaultValue = 0,
45
- onValueChange,
46
- muted,
47
- className
48
- }) {
49
- const [value, setValue] = useControllableState(valueProp, defaultValue, onValueChange);
50
- const shown = muted ? 0 : value;
51
- const Icon = glyph(kind, shown, muted);
52
- const percent = Math.round(shown * 100);
53
- return /* @__PURE__ */ jsxs("div", {
54
- className: cn("flex h-7 items-center gap-3", className),
55
- children: [
56
- /* @__PURE__ */ jsx(Icon, {
57
- size: 16,
58
- strokeWidth: 1.5,
59
- className: "shrink-0 text-foreground"
60
- }),
61
- /* @__PURE__ */ jsx(Slider, {
62
- className: "mb-0 min-w-0 flex-1",
63
- size: "compact",
64
- label: LABEL[kind],
65
- showValue: false,
66
- value: percent,
67
- onValueChange: (v) => setValue(v / 100)
68
- }),
69
- /* @__PURE__ */ jsx("span", {
70
- className: "w-7 shrink-0 text-right text-caption tabular-nums text-muted-foreground",
71
- children: percent
72
- })
73
- ]
74
- });
75
- }
76
- function Controls2({ value, defaultValue = { volume: 0.5 }, onValueChange, output, className }) {
77
- const [levels, setLevels] = useControllableState(value, defaultValue, onValueChange);
78
- return /* @__PURE__ */ jsxs("div", {
79
- className: cn("flex size-full flex-col justify-center gap-1", className),
80
- children: [
81
- /* @__PURE__ */ jsx(ControlsLevel2, {
82
- kind: "volume",
83
- value: levels.volume,
84
- muted: levels.muted,
85
- onValueChange: (volume) => setLevels({ ...levels, volume, muted: false })
86
- }),
87
- levels.brightness !== undefined && /* @__PURE__ */ jsx(ControlsLevel2, {
88
- kind: "brightness",
89
- value: levels.brightness,
90
- onValueChange: (brightness) => setLevels({ ...levels, brightness })
91
- }),
92
- levels.keyboard !== undefined && /* @__PURE__ */ jsx(ControlsLevel2, {
93
- kind: "keyboard",
94
- value: levels.keyboard,
95
- onValueChange: (keyboard) => setLevels({ ...levels, keyboard })
96
- }),
97
- output && /* @__PURE__ */ jsxs("div", {
98
- className: "flex h-7 items-center gap-3",
99
- children: [
100
- /* @__PURE__ */ jsx(Speaker, {
101
- size: 16,
102
- strokeWidth: 1.5,
103
- className: "shrink-0 text-muted-foreground"
104
- }),
105
- /* @__PURE__ */ jsx("span", {
106
- className: "min-w-0 truncate text-caption text-muted-foreground",
107
- children: output
108
- })
109
- ]
110
- })
111
- ]
112
- });
113
- }
114
- Controls2.Level = ControlsLevel2;
115
- var controls_default = Controls2;
116
- export { ControlsLevel2, Controls2, controls_default };
@@ -1,145 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- BatteryGlyph2
5
- } from "./chunk-hwtxpzg0.js";
6
- import {
7
- IslandFlash2
8
- } from "./chunk-78w7qwp0.js";
9
-
10
- // blocks/system/devices/index.tsx
11
- import Button from "@justanarthur/modo-ui/components/actions/button";
12
- import EmptyState from "@justanarthur/modo-ui/components/feedback/empty-state";
13
- import StatusDot from "@justanarthur/modo-ui/components/feedback/status-dot";
14
- import { cn } from "@justanarthur/modo-ui/lib/utils";
15
- import {
16
- Bluetooth,
17
- Gamepad2,
18
- Headphones,
19
- Keyboard,
20
- Mouse,
21
- Smartphone,
22
- Speaker,
23
- Watch
24
- } from "lucide-react";
25
- import { jsx, jsxs } from "react/jsx-runtime";
26
- /*!
27
- * Local addition: a notch app's Bluetooth devices and their batteries.
28
- * Rebuilt from Just Notch's devices plugin (`Devices`, `Device`, `Connected`)
29
- * as presentational parts: the devices come in as props.
30
- */
31
- var KIND = {
32
- headphones: Headphones,
33
- keyboard: Keyboard,
34
- mouse: Mouse,
35
- speaker: Speaker,
36
- gamepad: Gamepad2,
37
- phone: Smartphone,
38
- watch: Watch,
39
- other: Bluetooth
40
- };
41
- function Charge({ device }) {
42
- if (device.battery === undefined)
43
- return null;
44
- return /* @__PURE__ */ jsxs("span", {
45
- className: "flex shrink-0 items-center gap-2 text-caption tabular-nums text-muted-foreground",
46
- children: [
47
- device.battery,
48
- "%",
49
- /* @__PURE__ */ jsx(BatteryGlyph2, {
50
- level: device.battery,
51
- charging: device.charging,
52
- fillIn: false
53
- })
54
- ]
55
- });
56
- }
57
- function Glyph({ device }) {
58
- const Icon = KIND[device.kind];
59
- return /* @__PURE__ */ jsx("span", {
60
- className: cn("flex size-8 shrink-0 items-center justify-center rounded-full", device.connected ? "bg-surface-3 text-foreground" : "bg-surface-2 text-muted-foreground"),
61
- children: /* @__PURE__ */ jsx(Icon, {
62
- size: 16,
63
- strokeWidth: 1.5
64
- })
65
- });
66
- }
67
- function Device({ device }) {
68
- return /* @__PURE__ */ jsxs("li", {
69
- className: "flex h-11 min-w-0 items-center gap-3",
70
- children: [
71
- /* @__PURE__ */ jsx(Glyph, {
72
- device
73
- }),
74
- /* @__PURE__ */ jsxs("div", {
75
- className: "flex min-w-0 flex-1 flex-col",
76
- children: [
77
- /* @__PURE__ */ jsx("span", {
78
- className: cn("truncate text-body", device.connected ? "text-foreground" : "text-muted-foreground"),
79
- children: device.name
80
- }),
81
- /* @__PURE__ */ jsxs("span", {
82
- className: "flex items-center gap-1.5 text-caption text-muted-foreground",
83
- children: [
84
- /* @__PURE__ */ jsx(StatusDot, {
85
- status: device.connected ? "success" : "idle",
86
- size: "compact"
87
- }),
88
- device.connected ? "Connected" : "Not connected"
89
- ]
90
- })
91
- ]
92
- }),
93
- device.connected && /* @__PURE__ */ jsx(Charge, {
94
- device
95
- })
96
- ]
97
- });
98
- }
99
- function DevicesConnected2({ device }) {
100
- const Icon = KIND[device.kind];
101
- return /* @__PURE__ */ jsx(IslandFlash2, {
102
- icon: /* @__PURE__ */ jsx("span", {
103
- className: "flex size-8 items-center justify-center rounded-full bg-surface-3 text-foreground",
104
- children: /* @__PURE__ */ jsx(Icon, {
105
- size: 16,
106
- strokeWidth: 1.5
107
- })
108
- }),
109
- title: device.name,
110
- caption: "Connected",
111
- value: device.battery === undefined ? undefined : `${device.battery}%`,
112
- trailing: device.battery === undefined ? undefined : /* @__PURE__ */ jsx(BatteryGlyph2, {
113
- level: device.battery,
114
- charging: device.charging
115
- })
116
- });
117
- }
118
- function Devices2({ devices, onOpenSettings, className }) {
119
- if (devices.length === 0)
120
- return /* @__PURE__ */ jsx("div", {
121
- className: cn("flex size-full items-center justify-center", className),
122
- children: /* @__PURE__ */ jsx(EmptyState, {
123
- size: "compact",
124
- icon: Bluetooth,
125
- title: "No Bluetooth devices",
126
- description: "Pair headphones, a keyboard or a mouse to see them here.",
127
- actions: onOpenSettings && /* @__PURE__ */ jsx(Button, {
128
- variant: "secondary",
129
- size: "compact",
130
- onClick: onOpenSettings,
131
- children: "Open Bluetooth Settings"
132
- })
133
- })
134
- });
135
- const sorted = [...devices].sort((a, b) => Number(b.connected) - Number(a.connected) || a.name.localeCompare(b.name));
136
- return /* @__PURE__ */ jsx("ul", {
137
- className: cn("m-0 grid list-none grid-cols-2 content-start gap-x-8 p-0", className),
138
- children: sorted.map((device) => /* @__PURE__ */ jsx(Device, {
139
- device
140
- }, device.id))
141
- });
142
- }
143
- Devices2.Connected = DevicesConnected2;
144
- var devices_default = Devices2;
145
- export { DevicesConnected2, Devices2, devices_default };
@@ -1,178 +0,0 @@
1
- "use client";
2
-
3
- // blocks/system/system-stats/index.tsx
4
- import Sparkline from "@justanarthur/modo-ui/components/data-display/sparkline";
5
- import { cn } from "@justanarthur/modo-ui/lib/utils";
6
- import { ArrowDown, ArrowUp, Cpu, MemoryStick, Network } from "lucide-react";
7
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
- /*!
9
- * Local addition: a notch app's system load, CPU, memory and network as
10
- * tiles with their trends. Rebuilt from Just Notch's stats plugin (`System`,
11
- * `Tile`, `Measuring`, `CpuLoad`) on modo-ui's Sparkline: the samples come
12
- * in as props.
13
- */
14
- var percent = (v) => `${Math.round(v * 100)}%`;
15
- var gigabytes = (bytes) => `${(bytes / 1e9).toFixed(1)} GB`;
16
- function rate(bps) {
17
- if (bps >= 1e6)
18
- return `${(bps / 1e6).toFixed(1)} MB/s`;
19
- if (bps >= 1000)
20
- return `${Math.round(bps / 1000)} KB/s`;
21
- return `${Math.round(bps)} B/s`;
22
- }
23
- function Tile({ icon: Icon, label, value, children }) {
24
- return /* @__PURE__ */ jsxs("div", {
25
- className: "flex min-w-0 flex-col gap-2 rounded-xl bg-surface-2 p-3",
26
- children: [
27
- /* @__PURE__ */ jsxs("span", {
28
- className: "flex items-center gap-1.5 text-caption text-muted-foreground",
29
- children: [
30
- /* @__PURE__ */ jsx(Icon, {
31
- size: 14,
32
- strokeWidth: 1.5
33
- }),
34
- label
35
- ]
36
- }),
37
- /* @__PURE__ */ jsx("div", {
38
- className: "flex min-w-0 items-baseline gap-2 text-subtitle weight-semibold tabular-nums text-foreground",
39
- children: value
40
- }),
41
- /* @__PURE__ */ jsx("div", {
42
- className: "mt-auto",
43
- children
44
- })
45
- ]
46
- });
47
- }
48
- function Measuring({ className }) {
49
- const tiles = [
50
- { icon: Cpu, label: "CPU" },
51
- { icon: MemoryStick, label: "Memory" },
52
- { icon: Network, label: "Network" }
53
- ];
54
- return /* @__PURE__ */ jsx("div", {
55
- className: cn("grid size-full grid-cols-3 content-center gap-3", className),
56
- "aria-busy": true,
57
- children: tiles.map(({ icon, label }) => /* @__PURE__ */ jsx(Tile, {
58
- icon,
59
- label,
60
- value: /* @__PURE__ */ jsx("span", {
61
- className: "text-muted-foreground",
62
- children: "–"
63
- }),
64
- children: /* @__PURE__ */ jsx(Sparkline, {
65
- values: [],
66
- label: `${label}, measuring`,
67
- className: "h-10"
68
- })
69
- }, label))
70
- });
71
- }
72
- function SystemStatsLeading2() {
73
- return /* @__PURE__ */ jsx(Cpu, {
74
- size: 16,
75
- strokeWidth: 1.5,
76
- className: "text-muted-foreground"
77
- });
78
- }
79
- function SystemStatsTrailing2({ sample }) {
80
- if (!sample)
81
- return /* @__PURE__ */ jsx("span", {
82
- className: "text-caption weight-semibold text-muted-foreground",
83
- children: "–"
84
- });
85
- return /* @__PURE__ */ jsx("span", {
86
- className: "text-caption weight-semibold tabular-nums text-foreground",
87
- children: percent(sample.cpu)
88
- });
89
- }
90
- function SystemStats2({ samples, className }) {
91
- const last = samples.at(-1);
92
- if (!last)
93
- return /* @__PURE__ */ jsx(Measuring, {
94
- className
95
- });
96
- const cpu = samples.map((s) => s.cpu);
97
- const memory = samples.map((s) => s.memoryUsed);
98
- const netIn = samples.map((s) => s.netIn);
99
- const netOut = samples.map((s) => s.netOut);
100
- return /* @__PURE__ */ jsxs("div", {
101
- className: cn("grid size-full grid-cols-3 content-center gap-3", className),
102
- children: [
103
- /* @__PURE__ */ jsx(Tile, {
104
- icon: Cpu,
105
- label: "CPU",
106
- value: percent(last.cpu),
107
- children: /* @__PURE__ */ jsx(Sparkline, {
108
- values: cpu,
109
- max: 1,
110
- label: `CPU, ${percent(last.cpu)}`,
111
- className: "h-10"
112
- })
113
- }),
114
- /* @__PURE__ */ jsx(Tile, {
115
- icon: MemoryStick,
116
- label: "Memory",
117
- value: /* @__PURE__ */ jsxs(Fragment, {
118
- children: [
119
- gigabytes(last.memoryUsed),
120
- /* @__PURE__ */ jsxs("span", {
121
- className: "truncate text-caption weight-normal text-muted-foreground",
122
- children: [
123
- "of ",
124
- gigabytes(last.memoryTotal)
125
- ]
126
- })
127
- ]
128
- }),
129
- children: /* @__PURE__ */ jsx(Sparkline, {
130
- values: memory,
131
- max: last.memoryTotal,
132
- label: `Memory, ${gigabytes(last.memoryUsed)}`,
133
- className: "h-10"
134
- })
135
- }),
136
- /* @__PURE__ */ jsx(Tile, {
137
- icon: Network,
138
- label: "Network",
139
- value: /* @__PURE__ */ jsxs(Fragment, {
140
- children: [
141
- /* @__PURE__ */ jsxs("span", {
142
- className: "flex items-center gap-0.5",
143
- children: [
144
- /* @__PURE__ */ jsx(ArrowDown, {
145
- size: 12,
146
- strokeWidth: 2,
147
- "aria-label": "In"
148
- }),
149
- rate(last.netIn)
150
- ]
151
- }),
152
- /* @__PURE__ */ jsxs("span", {
153
- className: "flex min-w-0 items-center gap-0.5 truncate text-caption weight-normal text-muted-foreground",
154
- children: [
155
- /* @__PURE__ */ jsx(ArrowUp, {
156
- size: 12,
157
- strokeWidth: 2,
158
- "aria-label": "Out"
159
- }),
160
- rate(last.netOut)
161
- ]
162
- })
163
- ]
164
- }),
165
- children: /* @__PURE__ */ jsx(Sparkline, {
166
- values: netIn,
167
- secondary: netOut,
168
- label: `Network, ${rate(last.netIn)} in, ${rate(last.netOut)} out`,
169
- className: "h-10"
170
- })
171
- })
172
- ]
173
- });
174
- }
175
- SystemStats2.Leading = SystemStatsLeading2;
176
- SystemStats2.Trailing = SystemStatsTrailing2;
177
- var system_stats_default = SystemStats2;
178
- export { SystemStatsLeading2, SystemStatsTrailing2, SystemStats2, system_stats_default };
@@ -1,77 +0,0 @@
1
- import { JSX as JSX_1kxb } from "react";
2
- type TimerKind2 = "focus" | "break" | "custom";
3
- /** A run: running while it has `endsAt`, paused while it has `remaining`. */
4
- interface TimerRun2 {
5
- kind: TimerKind2;
6
- /** Its whole length, in ms. */
7
- total: number;
8
- /** When it ends, in epoch ms, while it runs. */
9
- endsAt?: number;
10
- /** The time left, in ms, while it is paused. */
11
- remaining?: number;
12
- }
13
- interface TimerProps2 {
14
- /** The run (controlled); `null` shows the picker. */
15
- value?: TimerRun2 | null;
16
- /** The run at first (uncontrolled). Defaults to `null`. */
17
- defaultValue?: TimerRun2 | null;
18
- /** Called with the run a start, pause, resume, +1 min or cancel leaves, and `null` when it ends. */
19
- onValueChange?: (run: TimerRun2 | null) => void;
20
- /** Called when a run reaches zero, with the kind that starts next in a Pomodoro cycle. */
21
- onEnd?: (run: TimerRun2, next?: TimerKind2) => void;
22
- /** The picker's quick lengths, in minutes, before the Pomodoro preset. Defaults to `[1, 5, 10]`. */
23
- presets?: number[];
24
- /** Pomodoro cycles: when a focus run ends a break starts on its own, then focus again. Defaults to `false`. */
25
- pomodoro?: boolean;
26
- /** A focus run's length, in minutes. Defaults to `25`. */
27
- focusMinutes?: number;
28
- /** A break's length, in minutes. Defaults to `5`. */
29
- breakMinutes?: number;
30
- /** Classes for the root, which fills its container. */
31
- className?: string;
32
- }
33
- type Element_12xgc = JSX_1kxb["Element"];
34
- /** The compact island's left wing: the timer's glyph. */
35
- declare function TimerLeading2(): Element_12xgc;
36
- /** The compact island's right wing: the time left, muted while paused. */
37
- declare function TimerTrailing2({ run }: {
38
- run: TimerRun2;
39
- }): Element_12xgc;
40
- /** The split island's bubble: a ring of the time left. */
41
- declare function TimerMinimal2({ run }: {
42
- run: TimerRun2;
43
- }): Element_12xgc;
44
- interface TimerDoneProps2 {
45
- /** The run that ended. Defaults to `'custom'`. */
46
- kind?: TimerKind2;
47
- /** The kind a Pomodoro cycle starts next. */
48
- next?: TimerKind2;
49
- /** The next run's length, in minutes. */
50
- minutes?: number;
51
- }
52
- /** The island's flash when a run reaches zero: "Time's up", and what starts next in a Pomodoro cycle. */
53
- declare function TimerDone2({ kind, next, minutes }: TimerDoneProps2): Element_12xgc;
54
- /**
55
- * A notch app's timer: pick a length, watch it run down, hear when it's up.
56
- *
57
- * Without a run it shows the picker: quick lengths (`presets`), a Pomodoro
58
- * focus run and a custom length in minutes on a NumberInput. A run shows a
59
- * Meter ring of the time left beside the time itself in display type, with
60
- * +1 min, pause / resume and cancel. The run is a value (`value` /
61
- * `onValueChange`, or kept here from `defaultValue`): a running one carries
62
- * when it ends, a paused one the time it had left, so a host can persist it
63
- * and resume after a reload. The time re-renders once a second, on the
64
- * second's edge, and nothing runs while it is paused.
65
- *
66
- * At zero it calls `onEnd` and clears the run, unless `pomodoro` cycles:
67
- * then a focus run hands over to a break and a break back to focus.
68
- *
69
- * The other forms are parts: `Timer.Leading` and `Timer.Trailing` for the
70
- * compact island's wings (the glyph and the time left), `Timer.Minimal` for
71
- * the split island's bubble (the ring) and `Timer.Done`, the "Time's up"
72
- * flash.
73
- *
74
- * @example {@include ./examples.mdx}
75
- */
76
- declare function Timer2({ value, defaultValue, onValueChange, onEnd, presets, pomodoro, focusMinutes, breakMinutes, className }: TimerProps2): Element_12xgc;
77
- export { TimerKind2, TimerRun2, TimerProps2, TimerLeading2, TimerTrailing2, TimerMinimal2, TimerDoneProps2, TimerDone2, Timer2 };