@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,58 +0,0 @@
1
- import { JSX as JSX_1kxb } from "react";
2
- type ControlKind2 = "volume" | "brightness" | "keyboard";
3
- /** The levels, from 0 to 1. A missing brightness or keyboard level hides its row (no built-in display, no backlight). */
4
- interface ControlLevels2 {
5
- volume: number;
6
- muted?: boolean;
7
- brightness?: number;
8
- keyboard?: number;
9
- }
10
- interface ControlsProps2 {
11
- /** The levels (controlled). */
12
- value?: ControlLevels2;
13
- /** The levels at first (uncontrolled). Defaults to the volume at half. */
14
- defaultValue?: ControlLevels2;
15
- /** Called with every level when a slider moves one; moving volume unmutes it. */
16
- onValueChange?: (levels: ControlLevels2) => void;
17
- /** The audio output's name, on a muted row under the sliders. */
18
- output?: string;
19
- /** Classes for the root, which fills its container. */
20
- className?: string;
21
- }
22
- interface ControlsLevelProps2 {
23
- /** What it sets. */
24
- kind: ControlKind2;
25
- /** The level, from 0 to 1 (controlled). */
26
- value?: number;
27
- /** The level at first (uncontrolled). Defaults to `0`. */
28
- defaultValue?: number;
29
- /** Called with the level, from 0 to 1, as the slider moves. */
30
- onValueChange?: (value: number) => void;
31
- /** Volume only: it is muted, so it reads 0 and shows the crossed speaker until moved. */
32
- muted?: boolean;
33
- /** Classes for the row. */
34
- className?: string;
35
- }
36
- type Element_12xgc = JSX_1kxb["Element"];
37
- /** One level as a row: a glyph that follows it, a compact slider and the percent. Pass it as the HUD's flash, keyed by kind. */
38
- declare function ControlsLevel2({ kind, value: valueProp, defaultValue, onValueChange, muted, className }: ControlsLevelProps2): Element_12xgc;
39
- /**
40
- * A notch app's system controls: volume, display brightness and keyboard
41
- * backlight as sliders, and the audio output.
42
- *
43
- * Each row is a glyph that follows its level (the speaker's waves, a muted
44
- * cross, the sun's rays, the backlight off), modo-ui's compact Slider and the
45
- * level in percent. A display without a brightness reading, or a keyboard
46
- * without a backlight, leaves its level out and so its row. The levels are
47
- * one value from 0 to 1 each (`value` / `onValueChange`, or kept here from
48
- * `defaultValue`); moving the volume unmutes it.
49
- *
50
- * `Controls.Level` is one row on its own: the HUD flash that replaces the
51
- * system's overlay when a volume or brightness key is pressed. Key it by
52
- * kind, so pressing a brightness key while the volume shows swaps the flash
53
- * instead of repainting it.
54
- *
55
- * @example {@include ./examples.mdx}
56
- */
57
- declare function Controls2({ value, defaultValue, onValueChange, output, className }: ControlsProps2): Element_12xgc;
58
- export { ControlKind2, ControlLevels2, ControlsProps2, ControlsLevelProps2, ControlsLevel2, Controls2 };
@@ -1,206 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- Equalizer2
5
- } from "./chunk-2f7zxrbk.js";
6
- import {
7
- MediaScrubber2
8
- } from "./chunk-wwjxs75m.js";
9
- import {
10
- IslandFlash2
11
- } from "./chunk-78w7qwp0.js";
12
-
13
- // blocks/activities/now-playing/index.tsx
14
- import Button from "@justanarthur/modo-ui/components/actions/button";
15
- import EmptyState from "@justanarthur/modo-ui/components/feedback/empty-state";
16
- import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
17
- import { cn } from "@justanarthur/modo-ui/lib/utils";
18
- import { Music, Pause, Play, SkipBack, SkipForward } from "lucide-react";
19
- import { jsx, jsxs } from "react/jsx-runtime";
20
- /*!
21
- * Local addition: what's playing, in every form a notch app shows it.
22
- * Rebuilt from Just Notch's now-playing plugin (`Player`, `Artwork`,
23
- * `TrackFlash`) as presentational parts: the track and the commands come in
24
- * as props.
25
- */
26
- var GLYPH = { strokeWidth: 1.5, fill: "currentColor", strokeLinejoin: "round" };
27
- function NowPlayingArtwork2({ artwork, glyph = 14, className }) {
28
- return /* @__PURE__ */ jsx("span", {
29
- className: cn("flex shrink-0 items-center justify-center overflow-hidden bg-surface-3 text-muted-foreground", className),
30
- children: typeof artwork === "string" ? /* @__PURE__ */ jsx("img", {
31
- alt: "",
32
- src: artwork,
33
- draggable: false,
34
- className: "size-full object-cover"
35
- }) : artwork ?? /* @__PURE__ */ jsx(Music, {
36
- size: glyph,
37
- strokeWidth: 1.5
38
- })
39
- });
40
- }
41
- function NowPlayingLeading2({ track }) {
42
- return /* @__PURE__ */ jsx(NowPlayingArtwork2, {
43
- artwork: track?.artwork,
44
- glyph: 12,
45
- className: "size-5.5 rounded-md"
46
- });
47
- }
48
- function NowPlayingTrailing2({ playing = true }) {
49
- return /* @__PURE__ */ jsx(Equalizer2, {
50
- playing,
51
- label: playing ? "Playing" : "Paused"
52
- });
53
- }
54
- function NowPlayingMinimal2({ track }) {
55
- return /* @__PURE__ */ jsx(NowPlayingArtwork2, {
56
- artwork: track?.artwork,
57
- glyph: 12,
58
- className: "size-6 rounded-full"
59
- });
60
- }
61
- function NowPlayingFlash2({ track, playing = true }) {
62
- return /* @__PURE__ */ jsx(IslandFlash2, {
63
- icon: /* @__PURE__ */ jsx(NowPlayingArtwork2, {
64
- artwork: track.artwork,
65
- className: "size-8 rounded-lg"
66
- }),
67
- title: track.title || "Unknown title",
68
- caption: track.artist || track.album || track.source,
69
- trailing: /* @__PURE__ */ jsx(Equalizer2, {
70
- playing
71
- })
72
- });
73
- }
74
- function Controls({ playing, onToggle, onPrevious, onNext }) {
75
- return /* @__PURE__ */ jsxs("div", {
76
- className: "flex items-center gap-2",
77
- children: [
78
- /* @__PURE__ */ jsx(Button, {
79
- variant: "ghost",
80
- size: "icon",
81
- "aria-label": "Previous",
82
- onClick: onPrevious,
83
- children: /* @__PURE__ */ jsx(SkipBack, {
84
- ...GLYPH,
85
- size: 16
86
- })
87
- }),
88
- /* @__PURE__ */ jsx(Button, {
89
- variant: "ghost",
90
- size: "icon",
91
- className: "text-foreground",
92
- "aria-label": playing ? "Pause" : "Play",
93
- onClick: onToggle,
94
- children: playing ? /* @__PURE__ */ jsx(Pause, {
95
- ...GLYPH,
96
- size: 18
97
- }) : /* @__PURE__ */ jsx(Play, {
98
- ...GLYPH,
99
- size: 18
100
- })
101
- }),
102
- /* @__PURE__ */ jsx(Button, {
103
- variant: "ghost",
104
- size: "icon",
105
- "aria-label": "Next",
106
- onClick: onNext,
107
- children: /* @__PURE__ */ jsx(SkipForward, {
108
- ...GLYPH,
109
- size: 16
110
- })
111
- })
112
- ]
113
- });
114
- }
115
- function NowPlaying2({
116
- track,
117
- playing: playingProp,
118
- defaultPlaying = true,
119
- onPlayingChange,
120
- onPrevious,
121
- onNext,
122
- onSeek,
123
- emptyDescription = "Play something in Music, Spotify or a browser.",
124
- className
125
- }) {
126
- const [playing, setPlaying] = useControllableState(playingProp, defaultPlaying, onPlayingChange);
127
- if (!track)
128
- return /* @__PURE__ */ jsx("div", {
129
- className: cn("flex size-full items-center justify-center", className),
130
- children: /* @__PURE__ */ jsx(EmptyState, {
131
- size: "compact",
132
- icon: Music,
133
- title: "Nothing playing",
134
- description: emptyDescription
135
- })
136
- });
137
- const art = track.artwork !== undefined;
138
- return /* @__PURE__ */ jsxs("div", {
139
- className: cn("flex size-full items-center gap-5", className),
140
- children: [
141
- art && /* @__PURE__ */ jsx(NowPlayingArtwork2, {
142
- artwork: track.artwork,
143
- className: "size-30 rounded-2xl"
144
- }),
145
- /* @__PURE__ */ jsxs("div", {
146
- className: "flex min-w-0 flex-1 flex-col gap-2",
147
- children: [
148
- /* @__PURE__ */ jsxs("div", {
149
- className: "flex items-center gap-3",
150
- children: [
151
- !art && /* @__PURE__ */ jsx(NowPlayingArtwork2, {
152
- glyph: 18,
153
- className: "size-10 rounded-xl"
154
- }),
155
- /* @__PURE__ */ jsxs("div", {
156
- className: "flex min-w-0 flex-1 flex-col",
157
- children: [
158
- /* @__PURE__ */ jsx("span", {
159
- className: "truncate text-subtitle weight-semibold text-foreground",
160
- children: track.title || "Unknown title"
161
- }),
162
- (track.artist || track.album) && /* @__PURE__ */ jsx("span", {
163
- className: "truncate text-caption text-muted-foreground",
164
- children: track.artist || track.album
165
- })
166
- ]
167
- }),
168
- /* @__PURE__ */ jsx(Equalizer2, {
169
- playing
170
- })
171
- ]
172
- }),
173
- track.duration > 0 && /* @__PURE__ */ jsx(MediaScrubber2, {
174
- position: track.position,
175
- duration: track.duration,
176
- playing,
177
- onSeek
178
- }),
179
- /* @__PURE__ */ jsxs("div", {
180
- className: "grid grid-cols-[1fr_auto_1fr] items-center gap-3",
181
- children: [
182
- /* @__PURE__ */ jsx("span", {
183
- className: "truncate text-caption text-muted-foreground",
184
- children: track.source
185
- }),
186
- /* @__PURE__ */ jsx(Controls, {
187
- playing,
188
- onToggle: () => setPlaying(!playing),
189
- onPrevious,
190
- onNext
191
- }),
192
- /* @__PURE__ */ jsx("span", {})
193
- ]
194
- })
195
- ]
196
- })
197
- ]
198
- });
199
- }
200
- NowPlaying2.Artwork = NowPlayingArtwork2;
201
- NowPlaying2.Leading = NowPlayingLeading2;
202
- NowPlaying2.Trailing = NowPlayingTrailing2;
203
- NowPlaying2.Minimal = NowPlayingMinimal2;
204
- NowPlaying2.Flash = NowPlayingFlash2;
205
- var now_playing_default = NowPlaying2;
206
- export { NowPlayingArtwork2, NowPlayingLeading2, NowPlayingTrailing2, NowPlayingMinimal2, NowPlayingFlash2, NowPlaying2, now_playing_default };