@justanarthur/modo-ui-notch 0.2.0 → 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 (148) hide show
  1. package/README.md +11 -11
  2. package/blocks/activities/agenda/examples.mdx +21 -5
  3. package/blocks/activities/agenda/index.tsx +291 -182
  4. package/blocks/activities/clock/examples.mdx +73 -0
  5. package/blocks/activities/clock/index.tsx +619 -0
  6. package/blocks/activities/now-playing/examples.mdx +32 -13
  7. package/blocks/activities/now-playing/index.tsx +319 -126
  8. package/blocks/activities/weather/examples.mdx +115 -0
  9. package/blocks/activities/weather/index.tsx +634 -0
  10. package/blocks/app/expanded-island/examples.mdx +8 -7
  11. package/blocks/app/expanded-island/index.tsx +19 -3
  12. package/blocks/app/settings-window/examples.mdx +6 -2
  13. package/blocks/app/settings-window/index.tsx +25 -7
  14. package/blocks/system/clipboard/examples.mdx +83 -0
  15. package/blocks/system/clipboard/index.tsx +563 -0
  16. package/blocks/system/recent-files/examples.mdx +66 -0
  17. package/blocks/system/recent-files/index.tsx +542 -0
  18. package/blocks/system/system-stats/examples.mdx +38 -9
  19. package/blocks/system/system-stats/index.tsx +241 -107
  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 +431 -0
  29. package/dist/blocks/activities/agenda/index.d.ts +1 -1
  30. package/dist/blocks/activities/agenda/index.js +3 -3
  31. package/dist/blocks/activities/clock/index.d.ts +2 -0
  32. package/dist/blocks/activities/clock/index.js +25 -0
  33. package/dist/blocks/activities/now-playing/index.d.ts +3 -2
  34. package/dist/blocks/activities/now-playing/index.js +5 -3
  35. package/dist/blocks/activities/weather/index.d.ts +2 -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 +2 -0
  42. package/dist/blocks/system/clipboard/index.js +17 -0
  43. package/dist/blocks/system/recent-files/index.d.ts +2 -0
  44. package/dist/blocks/system/recent-files/index.js +19 -0
  45. package/dist/blocks/system/system-stats/index.d.ts +2 -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 +30 -0
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.js +102 -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-2818esrq.d.ts +140 -0
  62. package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-2m5dz8nf.d.ts} +4 -4
  63. package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
  64. package/dist/shared/chunk-416tsgbc.d.ts +175 -0
  65. package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
  66. package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
  67. package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
  68. package/dist/shared/chunk-9c7ewvkk.js +381 -0
  69. package/dist/shared/{chunk-mp1nx0ez.js → chunk-9m0xbg5v.js} +14 -3
  70. package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
  71. package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
  72. package/dist/shared/{chunk-s33y1pcq.js → chunk-cc9nwbtf.js} +20 -10
  73. package/dist/shared/chunk-da177e8r.d.ts +114 -0
  74. package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
  75. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  76. package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
  77. package/dist/shared/chunk-j77cx8dp.js +498 -0
  78. package/dist/shared/chunk-mt0k6v8x.js +474 -0
  79. package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
  80. package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-pfhy5e4q.d.ts} +7 -1
  81. package/dist/shared/chunk-qdzemt2v.js +477 -0
  82. package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
  83. package/dist/shared/chunk-s2jeqqan.js +243 -0
  84. package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
  85. package/dist/shared/chunk-w5h6ay93.js +72 -0
  86. package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
  87. package/dist/shared/chunk-x7f3g82r.js +285 -0
  88. package/dist/shared/chunk-xq5hc5gv.js +333 -0
  89. package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
  90. package/dist/shared/chunk-ym0xbses.js +518 -0
  91. package/dist/styles.css +97 -55
  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 +79 -0
  98. package/mock/clock.tsx +77 -0
  99. package/mock/data.ts +30 -44
  100. package/mock/files.tsx +70 -0
  101. package/mock/island-content.tsx +43 -118
  102. package/mock/screen.tsx +76 -0
  103. package/mock/settings.tsx +370 -91
  104. package/mock/system.ts +46 -0
  105. package/mock/weather.tsx +105 -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,10 +0,0 @@
1
- import {
2
- ControlsLevel2,
3
- Controls2,
4
- controls_default
5
- } from "../../../shared/chunk-7hr53mby.js";
6
- export {
7
- Controls2 as Controls,
8
- ControlsLevel2 as ControlsLevel,
9
- controls_default as default
10
- };
@@ -1,2 +0,0 @@
1
- import { DeviceKind2, DeviceInfo2, DevicesProps2, DevicesConnected2, Devices2 } from "../../../shared/chunk-r8esmjfs.js";
2
- export { DeviceInfo2 as DeviceInfo, DeviceKind2 as DeviceKind, Devices2 as Devices, DevicesConnected2 as DevicesConnected, DevicesProps2 as DevicesProps, Devices2 as default };
@@ -1,12 +0,0 @@
1
- import {
2
- DevicesConnected2,
3
- Devices2,
4
- devices_default
5
- } from "../../../shared/chunk-b8jb1w72.js";
6
- import"../../../shared/chunk-hwtxpzg0.js";
7
- import"../../../shared/chunk-78w7qwp0.js";
8
- export {
9
- Devices2 as Devices,
10
- DevicesConnected2 as DevicesConnected,
11
- devices_default as default
12
- };
@@ -1,2 +0,0 @@
1
- import { PowerAlertKind2, PowerAlertProps2, PowerAlert2 } from "../../../shared/chunk-5w0yck07.js";
2
- export { PowerAlert2 as PowerAlert, PowerAlertKind2 as PowerAlertKind, PowerAlertProps2 as PowerAlertProps, PowerAlert2 as default };
@@ -1,9 +0,0 @@
1
- import {
2
- PowerAlert2
3
- } from "../../../shared/chunk-rcp1g9ca.js";
4
- import"../../../shared/chunk-hwtxpzg0.js";
5
- import"../../../shared/chunk-78w7qwp0.js";
6
- export {
7
- PowerAlert2 as PowerAlert,
8
- PowerAlert2 as default
9
- };
@@ -1,2 +0,0 @@
1
- import { BatteryTone2, BatteryGlyphProps2, batteryTone2, BatteryGlyph2 } from "../../../shared/chunk-fvedaas2.js";
2
- export { BatteryGlyph2 as BatteryGlyph, BatteryGlyphProps2 as BatteryGlyphProps, BatteryTone2 as BatteryTone, batteryTone2 as batteryTone, BatteryGlyph2 as default };
@@ -1,9 +0,0 @@
1
- import {
2
- batteryTone2,
3
- BatteryGlyph2
4
- } from "../../../shared/chunk-hwtxpzg0.js";
5
- export {
6
- BatteryGlyph2 as BatteryGlyph,
7
- batteryTone2 as batteryTone,
8
- BatteryGlyph2 as default
9
- };
@@ -1,45 +0,0 @@
1
- import { JSX as JSX_1kxb } from "react";
2
- /** One reading of the system. */
3
- interface StatsSample2 {
4
- /** CPU load, from 0 to 1. */
5
- cpu: number;
6
- /** Memory in use, in bytes. */
7
- memoryUsed: number;
8
- /** All the memory, in bytes. */
9
- memoryTotal: number;
10
- /** Network in, in bytes per second. */
11
- netIn: number;
12
- /** Network out, in bytes per second. */
13
- netOut: number;
14
- }
15
- interface SystemStatsProps2 {
16
- /** The readings so far, oldest first; the latest is the figure, all of them the trend. Without any, it is still measuring. */
17
- samples: StatsSample2[];
18
- /** Classes for the root, which fills its container. */
19
- className?: string;
20
- }
21
- type Element_12xgc = JSX_1kxb["Element"];
22
- /** The compact island's left wing: the CPU glyph. */
23
- declare function SystemStatsLeading2(): Element_12xgc;
24
- /** The compact island's right wing: the CPU load, a dash until the first reading. */
25
- declare function SystemStatsTrailing2({ sample }: {
26
- sample?: StatsSample2;
27
- }): Element_12xgc;
28
- /**
29
- * A notch app's system load: CPU, memory and network, each a tile with its
30
- * figure and its trend.
31
- *
32
- * The latest reading is the figure: the CPU load, the memory in use of all
33
- * of it, and the network's in and out rates. Every reading so far is the
34
- * trend, a modo-ui Sparkline that spans the tile however many readings there
35
- * are, since the island stays open for seconds, too short to fill a fixed
36
- * window; network out runs muted under network in, on one scale. Before the
37
- * first reading the tiles show a dash over the Sparkline's baseline.
38
- *
39
- * `SystemStats.Leading` and `SystemStats.Trailing` show the CPU load in the
40
- * compact island's wings.
41
- *
42
- * @example {@include ./examples.mdx}
43
- */
44
- declare function SystemStats2({ samples, className }: SystemStatsProps2): Element_12xgc;
45
- export { StatsSample2, SystemStatsProps2, SystemStatsLeading2, SystemStatsTrailing2, SystemStats2 };
@@ -1,84 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { JSX as JSX_1kxb } from "react";
3
- interface NowPlayingTrack2 {
4
- title: string;
5
- artist?: string;
6
- album?: string;
7
- /** The artwork: an image URL, or any element (an `<img>`, a generated tile). */
8
- artwork?: string | ReactNode;
9
- /** The app it plays in, shown under the controls. */
10
- source?: string;
11
- /** The track's length, in seconds; `0` for a stream, which hides the scrubber. */
12
- duration: number;
13
- /** Where playback is, in seconds. */
14
- position: number;
15
- }
16
- interface NowPlayingProps2 {
17
- /** What plays; without one the player says nothing is playing. */
18
- track?: NowPlayingTrack2 | null;
19
- /** It plays (controlled). */
20
- playing?: boolean;
21
- /** It plays at first (uncontrolled). Defaults to `true`. */
22
- defaultPlaying?: boolean;
23
- /** Called with the new state when play / pause is pressed. */
24
- onPlayingChange?: (playing: boolean) => void;
25
- /** Called when the previous button is pressed. */
26
- onPrevious?: () => void;
27
- /** Called when the next button is pressed. */
28
- onNext?: () => void;
29
- /** Called with the position to seek to, once, when a drag on the scrubber ends. */
30
- onSeek?: (seconds: number) => void;
31
- /** The empty state's line. Defaults to `'Play something in Music, Spotify or a browser.'`. */
32
- emptyDescription?: ReactNode;
33
- /** Classes for the root, which fills its container. */
34
- className?: string;
35
- }
36
- interface ArtworkProps {
37
- /** The track's artwork; without one, a note on a tile one surface up. */
38
- artwork?: string | ReactNode;
39
- /** The note's size in px when there is no artwork. Defaults to `14`. */
40
- glyph?: number;
41
- /** Classes for the tile: its size and radius. */
42
- className?: string;
43
- }
44
- type Element_12xgc = JSX_1kxb["Element"];
45
- /** A track's artwork in a tile, or a note on a raised tile when it has none. */
46
- declare function NowPlayingArtwork2({ artwork, glyph, className }: ArtworkProps): Element_12xgc;
47
- /** The compact island's left wing: the artwork, small. */
48
- declare function NowPlayingLeading2({ track }: {
49
- track?: Pick<NowPlayingTrack2, "artwork"> | null;
50
- }): Element_12xgc;
51
- /** The compact island's right wing: the level bars, low while paused. */
52
- declare function NowPlayingTrailing2({ playing }: {
53
- playing?: boolean;
54
- }): Element_12xgc;
55
- /** The split island's bubble: the artwork as a disc. */
56
- declare function NowPlayingMinimal2({ track }: {
57
- track?: Pick<NowPlayingTrack2, "artwork"> | null;
58
- }): Element_12xgc;
59
- /** The island's flash when the track changes: its artwork, title and artist, and the bars. */
60
- declare function NowPlayingFlash2({ track, playing }: {
61
- track: NowPlayingTrack2;
62
- playing?: boolean;
63
- }): Element_12xgc;
64
- /**
65
- * What's playing, as a notch app's open island shows it: the artwork, the
66
- * title and artist, where the track is, and the transport.
67
- *
68
- * The scrubber is the kit's MediaScrubber: it runs on by itself while
69
- * playing and seeks once when a drag ends (`onSeek`). Play / pause is
70
- * controlled through `playing` / `onPlayingChange`, or kept here from
71
- * `defaultPlaying`; previous and next report their press. Without artwork a
72
- * big square would be an empty box, so a small note tile leads the title row
73
- * instead. Without a track it says nothing is playing.
74
- *
75
- * The other forms are parts: `NowPlaying.Leading` and `NowPlaying.Trailing`
76
- * for the compact island's wings (the artwork, and an Equalizer that settles
77
- * when paused), `NowPlaying.Minimal` for the split island's bubble (the
78
- * artwork as a disc), `NowPlaying.Flash` for the flash on a track change and
79
- * `NowPlaying.Artwork` for the tile on its own.
80
- *
81
- * @example {@include ./examples.mdx}
82
- */
83
- declare function NowPlaying2({ track, playing: playingProp, defaultPlaying, onPlayingChange, onPrevious, onNext, onSeek, emptyDescription, className }: NowPlayingProps2): Element_12xgc;
84
- export { NowPlayingTrack2, NowPlayingProps2, NowPlayingArtwork2, NowPlayingLeading2, NowPlayingTrailing2, NowPlayingMinimal2, NowPlayingFlash2, NowPlaying2 };
@@ -1,69 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { JSX as JSX_1kxb } from "react";
3
- interface ShelfFile2 {
4
- /** What tells it apart: its path. */
5
- id: string;
6
- /** Its name, shown under the tile. */
7
- name: string;
8
- /** A preview: an image URL, or any element. Without one, an icon for the file's type. */
9
- thumbnail?: string | ReactNode;
10
- }
11
- interface ShelfProps2 {
12
- /** The files on the shelf, in order (controlled). */
13
- value?: ShelfFile2[];
14
- /** The files at first (uncontrolled). Defaults to `[]`. */
15
- defaultValue?: ShelfFile2[];
16
- /** Called with the files left after Remove or Clear. */
17
- onValueChange?: (files: ShelfFile2[]) => void;
18
- /** Called on a double-click or the menu's Open. */
19
- onOpen?: (file: ShelfFile2) => void;
20
- /** Called on the menu's Show in Finder. */
21
- onReveal?: (file: ShelfFile2) => void;
22
- /** Called with every file on AirDrop; without it the button hides. */
23
- onAirDrop?: (files: ShelfFile2[]) => void;
24
- /** Called when a tile starts to be dragged out, for the host to start a native drag. */
25
- onDragOut?: (file: ShelfFile2) => void;
26
- /** Classes for the root, which fills its container. */
27
- className?: string;
28
- }
29
- type Element_12xgc = JSX_1kxb["Element"];
30
- /** The compact island's left wing: the shelf's glyph. */
31
- declare function ShelfLeading2(): Element_12xgc;
32
- /** The compact island's right wing: how many files are on the shelf. */
33
- declare function ShelfTrailing2({ count: n }: {
34
- count: number;
35
- }): Element_12xgc;
36
- interface ShelfDropProps2 {
37
- /** `dragging` while files hover over the notch, `added` once they dropped. */
38
- phase: "dragging" | "added";
39
- /** How many files are being dragged, or were added. */
40
- count: number;
41
- /** How many files the shelf holds once they dropped. Defaults to `count`. */
42
- total?: number;
43
- /** Classes for the target. */
44
- className?: string;
45
- }
46
- /** The island's flash while files are dragged over the notch: a dashed drop target, then a check once they land. */
47
- declare function ShelfDrop2({ phase, count: n, total, className }: ShelfDropProps2): Element_12xgc;
48
- /**
49
- * A notch app's shelf: files dragged onto the notch, kept in a strip to drag
50
- * out again, open, AirDrop or clear.
51
- *
52
- * Each file is a tile with its thumbnail, or an icon for its type, and its
53
- * name. A double-click opens it; a right-click (a long press on touch) opens
54
- * a ContextMenu with Open, Show in Finder and Remove from shelf, grown from
55
- * the press point; one fluid hover highlight runs along the strip, which
56
- * scrolls sideways when it holds more than fits. Moving a pressed tile calls
57
- * `onDragOut`, for the host to start a native drag. A header counts the
58
- * files and holds AirDrop and Clear. Removing and clearing change the files
59
- * through `value` / `onValueChange`, or here from `defaultValue`; tiles fade
60
- * in and out as the strip closes up. An empty shelf says how to fill it.
61
- *
62
- * The other forms are parts: `Shelf.Drop`, the flash while files hover over
63
- * the notch (a dashed drop target in the brand hue) and once they land;
64
- * `Shelf.Leading` and `Shelf.Trailing` for the compact island's wings.
65
- *
66
- * @example {@include ./examples.mdx}
67
- */
68
- declare function Shelf2({ value, defaultValue, onValueChange, onOpen, onReveal, onAirDrop, onDragOut, className }: ShelfProps2): Element_12xgc;
69
- export { ShelfFile2, ShelfProps2, ShelfLeading2, ShelfTrailing2, ShelfDropProps2, ShelfDrop2, Shelf2 };
@@ -1,32 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { JSX as JSX_1kxb } from "react";
3
- type PowerAlertKind2 = "charging" | "unplugged" | "low" | "critical";
4
- interface PowerAlertProps2 {
5
- /** What happened: a charger plugged in or out, or the battery crossing 20% or 10%. */
6
- kind: PowerAlertKind2;
7
- /** The charge, in percent (0 to 100). */
8
- level: number;
9
- /** Minutes until full while charging, or of battery left on battery: the caption says it. */
10
- minutes?: number;
11
- /** Replaces the caption the kind and `minutes` give. */
12
- caption?: ReactNode;
13
- /** Classes for the row. */
14
- className?: string;
15
- }
16
- type Element_12xgc = JSX_1kxb["Element"];
17
- /**
18
- * A notch app's power alert: a charger plugged in or out, or the battery
19
- * running low, as the island's flash.
20
- *
21
- * Each kind brings its icon, title and status hue: charging in success,
22
- * unplugged in the text color, low in warning (at 20%), critical in error
23
- * (at 10%). The level shows as a figure in that hue and as a BatteryGlyph
24
- * that fills up from empty as the flash opens. With `minutes`, the caption
25
- * says how long until full or how much is left; low and critical say to plug
26
- * in. Pass it as the Island's `flash`, keyed by kind, so one alert replacing
27
- * another swaps instead of updating in place.
28
- *
29
- * @example {@include ./examples.mdx}
30
- */
31
- declare function PowerAlert2({ kind, level, minutes, caption, className }: PowerAlertProps2): Element_12xgc;
32
- export { PowerAlertKind2, PowerAlertProps2, PowerAlert2 };
@@ -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 };