@justanarthur/modo-ui-notch 0.0.0-stage → 0.2.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 (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/blocks/activities/agenda/examples.mdx +58 -0
  4. package/blocks/activities/agenda/index.tsx +332 -0
  5. package/blocks/activities/now-playing/examples.mdx +49 -0
  6. package/blocks/activities/now-playing/index.tsx +218 -0
  7. package/blocks/activities/shelf/examples.mdx +33 -0
  8. package/blocks/activities/shelf/index.tsx +289 -0
  9. package/blocks/activities/timer/examples.mdx +52 -0
  10. package/blocks/activities/timer/index.tsx +292 -0
  11. package/blocks/app/expanded-island/examples.mdx +45 -0
  12. package/blocks/app/expanded-island/index.tsx +127 -0
  13. package/blocks/app/settings-window/examples.mdx +30 -0
  14. package/blocks/app/settings-window/index.tsx +357 -0
  15. package/blocks/system/controls/examples.mdx +34 -0
  16. package/blocks/system/controls/index.tsx +167 -0
  17. package/blocks/system/devices/examples.mdx +25 -0
  18. package/blocks/system/devices/index.tsx +172 -0
  19. package/blocks/system/power-alert/examples.mdx +32 -0
  20. package/blocks/system/power-alert/index.tsx +89 -0
  21. package/blocks/system/system-stats/examples.mdx +23 -0
  22. package/blocks/system/system-stats/index.tsx +178 -0
  23. package/components/indicators/battery-glyph/examples.mdx +22 -0
  24. package/components/indicators/battery-glyph/index.tsx +91 -0
  25. package/components/indicators/countdown/examples.mdx +25 -0
  26. package/components/indicators/countdown/index.tsx +83 -0
  27. package/components/indicators/equalizer/examples.mdx +20 -0
  28. package/components/indicators/equalizer/index.tsx +116 -0
  29. package/components/indicators/media-scrubber/examples.mdx +21 -0
  30. package/components/indicators/media-scrubber/index.tsx +98 -0
  31. package/components/island/island/examples.mdx +57 -0
  32. package/components/island/island/index.tsx +415 -0
  33. package/components/island/island-flash/examples.mdx +55 -0
  34. package/components/island/island-flash/index.tsx +79 -0
  35. package/components/island/island-tabs/examples.mdx +53 -0
  36. package/components/island/island-tabs/index.tsx +285 -0
  37. package/dist/blocks/activities/agenda/index.d.ts +2 -0
  38. package/dist/blocks/activities/agenda/index.js +21 -0
  39. package/dist/blocks/activities/now-playing/index.d.ts +2 -0
  40. package/dist/blocks/activities/now-playing/index.js +22 -0
  41. package/dist/blocks/activities/shelf/index.d.ts +2 -0
  42. package/dist/blocks/activities/shelf/index.js +14 -0
  43. package/dist/blocks/activities/timer/index.d.ts +2 -0
  44. package/dist/blocks/activities/timer/index.js +19 -0
  45. package/dist/blocks/app/expanded-island/index.d.ts +3 -0
  46. package/dist/blocks/app/expanded-island/index.js +10 -0
  47. package/dist/blocks/app/settings-window/index.d.ts +2 -0
  48. package/dist/blocks/app/settings-window/index.js +7 -0
  49. package/dist/blocks/system/controls/index.d.ts +2 -0
  50. package/dist/blocks/system/controls/index.js +10 -0
  51. package/dist/blocks/system/devices/index.d.ts +2 -0
  52. package/dist/blocks/system/devices/index.js +12 -0
  53. package/dist/blocks/system/power-alert/index.d.ts +2 -0
  54. package/dist/blocks/system/power-alert/index.js +9 -0
  55. package/dist/blocks/system/system-stats/index.d.ts +2 -0
  56. package/dist/blocks/system/system-stats/index.js +12 -0
  57. package/dist/components/indicators/battery-glyph/index.d.ts +2 -0
  58. package/dist/components/indicators/battery-glyph/index.js +9 -0
  59. package/dist/components/indicators/countdown/index.d.ts +2 -0
  60. package/dist/components/indicators/countdown/index.js +8 -0
  61. package/dist/components/indicators/equalizer/index.d.ts +2 -0
  62. package/dist/components/indicators/equalizer/index.js +7 -0
  63. package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
  64. package/dist/components/indicators/media-scrubber/index.js +8 -0
  65. package/dist/components/island/island/index.d.ts +3 -0
  66. package/dist/components/island/island/index.js +10 -0
  67. package/dist/components/island/island-flash/index.d.ts +2 -0
  68. package/dist/components/island/island-flash/index.js +7 -0
  69. package/dist/components/island/island-tabs/index.d.ts +2 -0
  70. package/dist/components/island/island-tabs/index.js +9 -0
  71. package/dist/index.d.ts +21 -0
  72. package/dist/index.js +151 -0
  73. package/dist/lib/clock.d.ts +2 -0
  74. package/dist/lib/clock.js +14 -0
  75. package/dist/lib/geometry.d.ts +2 -0
  76. package/dist/lib/geometry.js +24 -0
  77. package/dist/lib/island-context.d.ts +3 -0
  78. package/dist/lib/island-context.js +8 -0
  79. package/dist/lib/motion.d.ts +21 -0
  80. package/dist/lib/motion.js +16 -0
  81. package/dist/shared/chunk-152gpyq3.d.ts +13 -0
  82. package/dist/shared/chunk-2f7zxrbk.js +65 -0
  83. package/dist/shared/chunk-2qpcsv5h.d.ts +45 -0
  84. package/dist/shared/chunk-2s4q6mt0.js +27 -0
  85. package/dist/shared/chunk-45gytfr1.d.ts +84 -0
  86. package/dist/shared/chunk-502rmtap.js +54 -0
  87. package/dist/shared/chunk-50ffk4r7.d.ts +69 -0
  88. package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
  89. package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
  90. package/dist/shared/chunk-5w0yck07.d.ts +32 -0
  91. package/dist/shared/chunk-6c1jbefs.d.ts +36 -0
  92. package/dist/shared/chunk-78w7qwp0.js +58 -0
  93. package/dist/shared/chunk-7hr53mby.js +116 -0
  94. package/dist/shared/chunk-9nhpg9t8.d.ts +47 -0
  95. package/dist/shared/chunk-b8jb1w72.js +145 -0
  96. package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
  97. package/dist/shared/chunk-cpewy6yg.js +178 -0
  98. package/dist/shared/chunk-d5qm9cps.js +10 -0
  99. package/dist/shared/chunk-e3e4s4ds.d.ts +77 -0
  100. package/dist/shared/chunk-enm6td0p.js +280 -0
  101. package/dist/shared/chunk-fvedaas2.d.ts +33 -0
  102. package/dist/shared/chunk-gb56m10p.js +39 -0
  103. package/dist/shared/chunk-gex38j8x.d.ts +82 -0
  104. package/dist/shared/chunk-hpsabfsd.d.ts +75 -0
  105. package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
  106. package/dist/shared/chunk-hwtxpzg0.js +69 -0
  107. package/dist/shared/chunk-mp1nx0ez.js +101 -0
  108. package/dist/shared/chunk-phb53x1f.js +252 -0
  109. package/dist/shared/chunk-r8esmjfs.d.ts +42 -0
  110. package/dist/shared/chunk-rcp1g9ca.js +70 -0
  111. package/dist/shared/chunk-rpfwv3pz.js +209 -0
  112. package/dist/shared/chunk-rr5e0g15.d.ts +35 -0
  113. package/dist/shared/chunk-rx9sphz2.js +266 -0
  114. package/dist/shared/chunk-s33y1pcq.js +305 -0
  115. package/dist/shared/chunk-sbnrhy5m.js +331 -0
  116. package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
  117. package/dist/shared/chunk-wwjxs75m.js +74 -0
  118. package/dist/shared/chunk-xdeek16r.d.ts +58 -0
  119. package/dist/shared/chunk-xkzjk1tq.js +206 -0
  120. package/dist/shared/chunk-yngkkxz2.d.ts +88 -0
  121. package/dist/shared/chunk-zvh0d3qb.js +63 -0
  122. package/dist/styles.css +222 -0
  123. package/index.ts +21 -0
  124. package/lib/clock.ts +53 -0
  125. package/lib/geometry.ts +130 -0
  126. package/lib/island-context.tsx +24 -0
  127. package/lib/motion.ts +42 -0
  128. package/mock/activities.tsx +100 -0
  129. package/mock/artwork.tsx +25 -0
  130. package/mock/data.ts +153 -0
  131. package/mock/desktop.tsx +83 -0
  132. package/mock/fit.ts +26 -0
  133. package/mock/island-content.tsx +217 -0
  134. package/mock/scene.tsx +52 -0
  135. package/mock/settings.tsx +210 -0
  136. package/package.json +117 -4
package/dist/index.js ADDED
@@ -0,0 +1,151 @@
1
+ import {
2
+ formatClock2,
3
+ formatShort2,
4
+ useEdgeClock2
5
+ } from "./shared/chunk-gb56m10p.js";
6
+ import {
7
+ Countdown2
8
+ } from "./shared/chunk-502rmtap.js";
9
+ import {
10
+ IslandFlash2
11
+ } from "./shared/chunk-78w7qwp0.js";
12
+ import {
13
+ AgendaLeading2,
14
+ AgendaTrailing2,
15
+ AgendaMinimal2,
16
+ AgendaUpNext2,
17
+ AgendaStarting2,
18
+ Agenda2
19
+ } from "./shared/chunk-enm6td0p.js";
20
+ import {
21
+ Equalizer2
22
+ } from "./shared/chunk-2f7zxrbk.js";
23
+ import {
24
+ MediaScrubber2
25
+ } from "./shared/chunk-wwjxs75m.js";
26
+ import {
27
+ NowPlayingArtwork2,
28
+ NowPlayingLeading2,
29
+ NowPlayingTrailing2,
30
+ NowPlayingMinimal2,
31
+ NowPlayingFlash2,
32
+ NowPlaying2
33
+ } from "./shared/chunk-xkzjk1tq.js";
34
+ import {
35
+ ShelfLeading2,
36
+ ShelfTrailing2,
37
+ ShelfDrop2,
38
+ Shelf2
39
+ } from "./shared/chunk-phb53x1f.js";
40
+ import {
41
+ TimerLeading2,
42
+ TimerTrailing2,
43
+ TimerMinimal2,
44
+ TimerDone2,
45
+ Timer2
46
+ } from "./shared/chunk-rx9sphz2.js";
47
+ import {
48
+ ISLAND_STATES2,
49
+ DEFAULT_NOTCH2,
50
+ DEFAULT_PANEL2,
51
+ INSET2,
52
+ NOTCH_GAP2,
53
+ slotWidth2,
54
+ shapeFor2,
55
+ bubbleFor2,
56
+ islandPath2,
57
+ stripLayout2
58
+ } from "./shared/chunk-zvh0d3qb.js";
59
+ import {
60
+ IslandContext2,
61
+ useIsland2
62
+ } from "./shared/chunk-d5qm9cps.js";
63
+ import {
64
+ IslandTabs2
65
+ } from "./shared/chunk-rpfwv3pz.js";
66
+ import {
67
+ ExpandedIsland2
68
+ } from "./shared/chunk-mp1nx0ez.js";
69
+ import {
70
+ SettingsWindow2
71
+ } from "./shared/chunk-s33y1pcq.js";
72
+ import {
73
+ ControlsLevel2,
74
+ Controls2
75
+ } from "./shared/chunk-7hr53mby.js";
76
+ import {
77
+ batteryTone2,
78
+ BatteryGlyph2
79
+ } from "./shared/chunk-hwtxpzg0.js";
80
+ import {
81
+ DevicesConnected2,
82
+ Devices2
83
+ } from "./shared/chunk-b8jb1w72.js";
84
+ import {
85
+ PowerAlert2
86
+ } from "./shared/chunk-rcp1g9ca.js";
87
+ import {
88
+ SystemStatsLeading2,
89
+ SystemStatsTrailing2,
90
+ SystemStats2
91
+ } from "./shared/chunk-cpewy6yg.js";
92
+ import"./shared/chunk-2s4q6mt0.js";
93
+ import {
94
+ Island2
95
+ } from "./shared/chunk-sbnrhy5m.js";
96
+ export {
97
+ Agenda2 as Agenda,
98
+ AgendaLeading2 as AgendaLeading,
99
+ AgendaMinimal2 as AgendaMinimal,
100
+ AgendaStarting2 as AgendaStarting,
101
+ AgendaTrailing2 as AgendaTrailing,
102
+ AgendaUpNext2 as AgendaUpNext,
103
+ BatteryGlyph2 as BatteryGlyph,
104
+ Controls2 as Controls,
105
+ ControlsLevel2 as ControlsLevel,
106
+ Countdown2 as Countdown,
107
+ DEFAULT_NOTCH2 as DEFAULT_NOTCH,
108
+ DEFAULT_PANEL2 as DEFAULT_PANEL,
109
+ Devices2 as Devices,
110
+ DevicesConnected2 as DevicesConnected,
111
+ Equalizer2 as Equalizer,
112
+ ExpandedIsland2 as ExpandedIsland,
113
+ INSET2 as INSET,
114
+ ISLAND_STATES2 as ISLAND_STATES,
115
+ Island2 as Island,
116
+ IslandContext2 as IslandContext,
117
+ IslandFlash2 as IslandFlash,
118
+ IslandTabs2 as IslandTabs,
119
+ MediaScrubber2 as MediaScrubber,
120
+ NOTCH_GAP2 as NOTCH_GAP,
121
+ NowPlaying2 as NowPlaying,
122
+ NowPlayingArtwork2 as NowPlayingArtwork,
123
+ NowPlayingFlash2 as NowPlayingFlash,
124
+ NowPlayingLeading2 as NowPlayingLeading,
125
+ NowPlayingMinimal2 as NowPlayingMinimal,
126
+ NowPlayingTrailing2 as NowPlayingTrailing,
127
+ PowerAlert2 as PowerAlert,
128
+ SettingsWindow2 as SettingsWindow,
129
+ Shelf2 as Shelf,
130
+ ShelfDrop2 as ShelfDrop,
131
+ ShelfLeading2 as ShelfLeading,
132
+ ShelfTrailing2 as ShelfTrailing,
133
+ SystemStats2 as SystemStats,
134
+ SystemStatsLeading2 as SystemStatsLeading,
135
+ SystemStatsTrailing2 as SystemStatsTrailing,
136
+ Timer2 as Timer,
137
+ TimerDone2 as TimerDone,
138
+ TimerLeading2 as TimerLeading,
139
+ TimerMinimal2 as TimerMinimal,
140
+ TimerTrailing2 as TimerTrailing,
141
+ batteryTone2 as batteryTone,
142
+ bubbleFor2 as bubbleFor,
143
+ formatClock2 as formatClock,
144
+ formatShort2 as formatShort,
145
+ islandPath2 as islandPath,
146
+ shapeFor2 as shapeFor,
147
+ slotWidth2 as slotWidth,
148
+ stripLayout2 as stripLayout,
149
+ useEdgeClock2 as useEdgeClock,
150
+ useIsland2 as useIsland
151
+ };
@@ -0,0 +1,2 @@
1
+ import { SECOND2, MINUTE2, formatClock2, formatShort2, useEdgeClock2 } from "../shared/chunk-152gpyq3.js";
2
+ export { MINUTE2 as MINUTE, SECOND2 as SECOND, formatClock2 as formatClock, formatShort2 as formatShort, useEdgeClock2 as useEdgeClock };
@@ -0,0 +1,14 @@
1
+ import {
2
+ SECOND2,
3
+ MINUTE2,
4
+ formatClock2,
5
+ formatShort2,
6
+ useEdgeClock2
7
+ } from "../shared/chunk-gb56m10p.js";
8
+ export {
9
+ MINUTE2 as MINUTE,
10
+ SECOND2 as SECOND,
11
+ formatClock2 as formatClock,
12
+ formatShort2 as formatShort,
13
+ useEdgeClock2 as useEdgeClock
14
+ };
@@ -0,0 +1,2 @@
1
+ import { IslandState2, ISLAND_STATES2, Size2, IslandGeometry2, Shape2, DEFAULT_NOTCH2, DEFAULT_PANEL2, INSET2, NOTCH_GAP2, slotWidth2, shapeFor2, bubbleFor2, islandPath2, StripLayout2, stripLayout2 } from "../shared/chunk-cfzmfnyh.js";
2
+ export { DEFAULT_NOTCH2 as DEFAULT_NOTCH, DEFAULT_PANEL2 as DEFAULT_PANEL, INSET2 as INSET, ISLAND_STATES2 as ISLAND_STATES, IslandGeometry2 as IslandGeometry, IslandState2 as IslandState, NOTCH_GAP2 as NOTCH_GAP, Shape2 as Shape, Size2 as Size, StripLayout2 as StripLayout, bubbleFor2 as bubbleFor, islandPath2 as islandPath, shapeFor2 as shapeFor, slotWidth2 as slotWidth, stripLayout2 as stripLayout };
@@ -0,0 +1,24 @@
1
+ import {
2
+ ISLAND_STATES2,
3
+ DEFAULT_NOTCH2,
4
+ DEFAULT_PANEL2,
5
+ INSET2,
6
+ NOTCH_GAP2,
7
+ slotWidth2,
8
+ shapeFor2,
9
+ bubbleFor2,
10
+ islandPath2,
11
+ stripLayout2
12
+ } from "../shared/chunk-zvh0d3qb.js";
13
+ export {
14
+ DEFAULT_NOTCH2 as DEFAULT_NOTCH,
15
+ DEFAULT_PANEL2 as DEFAULT_PANEL,
16
+ INSET2 as INSET,
17
+ ISLAND_STATES2 as ISLAND_STATES,
18
+ NOTCH_GAP2 as NOTCH_GAP,
19
+ bubbleFor2 as bubbleFor,
20
+ islandPath2 as islandPath,
21
+ shapeFor2 as shapeFor,
22
+ slotWidth2 as slotWidth,
23
+ stripLayout2 as stripLayout
24
+ };
@@ -0,0 +1,3 @@
1
+ import { IslandContextValue2, IslandContext2, useIsland2 } from "../shared/chunk-52gb3g6r.js";
2
+ import "../shared/chunk-cfzmfnyh.js";
3
+ export { IslandContext2 as IslandContext, IslandContextValue2 as IslandContextValue, useIsland2 as useIsland };
@@ -0,0 +1,8 @@
1
+ import {
2
+ IslandContext2,
3
+ useIsland2
4
+ } from "../shared/chunk-d5qm9cps.js";
5
+ export {
6
+ IslandContext2 as IslandContext,
7
+ useIsland2 as useIsland
8
+ };
@@ -0,0 +1,21 @@
1
+ import { IslandState2 } from "../shared/chunk-cfzmfnyh.js";
2
+ import { Transition } from "motion/react";
3
+ /** The bigger the move, the slower the tier: grow on the target's spring, shrink on the source's exit tween. */
4
+ declare function shapeTransition(from: IslandState2, to: IslandState2): Transition;
5
+ declare const bubbleTransition: (detaching: boolean) => Transition;
6
+ declare const contentShown: {
7
+ opacity: number;
8
+ scale: number;
9
+ filter: string;
10
+ transitionEnd: {
11
+ filter: string;
12
+ };
13
+ };
14
+ declare const contentHidden: {
15
+ opacity: number;
16
+ scale: number;
17
+ filter: string;
18
+ };
19
+ declare const contentEnter: Transition;
20
+ declare const contentLeave: Transition;
21
+ export { bubbleTransition, contentEnter, contentHidden, contentLeave, contentShown, shapeTransition };
@@ -0,0 +1,16 @@
1
+ import {
2
+ shapeTransition2,
3
+ bubbleTransition2,
4
+ contentShown2,
5
+ contentHidden2,
6
+ contentEnter2,
7
+ contentLeave2
8
+ } from "../shared/chunk-2s4q6mt0.js";
9
+ export {
10
+ bubbleTransition2 as bubbleTransition,
11
+ contentEnter2 as contentEnter,
12
+ contentHidden2 as contentHidden,
13
+ contentLeave2 as contentLeave,
14
+ contentShown2 as contentShown,
15
+ shapeTransition2 as shapeTransition
16
+ };
@@ -0,0 +1,13 @@
1
+ declare const SECOND2 = 1e3;
2
+ declare const MINUTE2: number;
3
+ /** Seconds as `m:ss`, or `h:mm:ss` from an hour. */
4
+ declare function formatClock2(seconds: number): string;
5
+ /** Seconds as the one largest unit, rounded up: `"45s"`, `"4m"`, `"2h"`. */
6
+ declare function formatShort2(seconds: number): string;
7
+ /**
8
+ * The time now, re-read once per `unit` ms on the unit's edge counted from
9
+ * `anchor` (a countdown's end, a track's start), never in between. Stops
10
+ * while `running` is false.
11
+ */
12
+ declare function useEdgeClock2(anchor: number, running: boolean, unit?: number): number;
13
+ export { SECOND2, MINUTE2, formatClock2, formatShort2, useEdgeClock2 };
@@ -0,0 +1,65 @@
1
+ "use client";
2
+
3
+ // components/indicators/equalizer/index.tsx
4
+ import { useReduceMotion } from "@justanarthur/modo-ui/lib/reduced-motion";
5
+ import { spring } from "@justanarthur/modo-ui/lib/springs";
6
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
7
+ import { motion } from "motion/react";
8
+ import { useEffect, useRef } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ /*!
11
+ * Local addition: the now-playing level bars of a notch app's compact wing.
12
+ * Rebuilt from Just Notch's now-playing plugin (`Bars`).
13
+ */
14
+ var LOOPS = [
15
+ { levels: [0.35, 1, 0.5, 0.8, 0.35], beats: 5 },
16
+ { levels: [0.7, 0.4, 0.95, 0.55, 0.7], beats: 4 },
17
+ { levels: [0.5, 0.9, 0.3, 1, 0.5], beats: 6 },
18
+ { levels: [0.4, 0.75, 0.6, 0.3, 0.4], beats: 4.5 },
19
+ { levels: [0.6, 0.3, 0.85, 0.45, 0.6], beats: 5.5 }
20
+ ];
21
+ var REST = 0.2;
22
+ var STILL = [0.5, 0.85, 0.65, 0.4, 0.7];
23
+ function Bar({ loop, live, level, className }) {
24
+ const ref = useRef(null);
25
+ useEffect(() => {
26
+ const bar = ref.current;
27
+ if (!live || !bar)
28
+ return;
29
+ const animation = bar.animate(loop.levels.map((l) => ({ transform: `scaleY(${l})` })), {
30
+ duration: spring.slow.duration * loop.beats * 1000,
31
+ easing: "ease-in-out",
32
+ iterations: Number.POSITIVE_INFINITY
33
+ });
34
+ return () => animation.cancel();
35
+ }, [live, loop]);
36
+ return /* @__PURE__ */ jsx(motion.span, {
37
+ ref,
38
+ className: cn("h-full w-0.75 rounded-full", className),
39
+ initial: false,
40
+ animate: { scaleY: level },
41
+ transition: spring.moderate
42
+ });
43
+ }
44
+ function Equalizer2({
45
+ playing = true,
46
+ bars = 4,
47
+ label,
48
+ barClassName = "bg-foreground",
49
+ className
50
+ }) {
51
+ const reduced = useReduceMotion();
52
+ const live = playing && !reduced;
53
+ const count = Math.min(Math.max(1, Math.round(bars)), LOOPS.length);
54
+ return /* @__PURE__ */ jsx("span", {
55
+ ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
56
+ className: cn("inline-flex h-3.5 shrink-0 items-center gap-0.5", className),
57
+ children: LOOPS.slice(0, count).map((loop, i) => /* @__PURE__ */ jsx(Bar, {
58
+ loop,
59
+ live,
60
+ level: playing ? STILL[i] ?? REST : REST,
61
+ className: barClassName
62
+ }, loop.beats))
63
+ });
64
+ }
65
+ export { Equalizer2 };
@@ -0,0 +1,45 @@
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 };
@@ -0,0 +1,27 @@
1
+ // lib/motion.ts
2
+ import { spring, springEnter } from "@justanarthur/modo-ui/lib/springs";
3
+ var SIZE = { idle: 0, compact: 1, split: 1, flash: 2, expanded: 3 };
4
+ var TIER = {
5
+ idle: spring.moderate,
6
+ compact: spring.moderate,
7
+ split: spring.moderate,
8
+ flash: spring.slow,
9
+ expanded: spring.goo
10
+ };
11
+ function shapeTransition2(from, to) {
12
+ if (SIZE[to] >= SIZE[from])
13
+ return springEnter(TIER[to]);
14
+ return from === "expanded" ? spring.slow.exit : TIER[from].exit;
15
+ }
16
+ var bubbleTransition2 = (detaching) => detaching ? springEnter(spring.goo) : spring.goo.exit;
17
+ var contentShown2 = { opacity: 1, scale: 1, filter: "blur(0px)", transitionEnd: { filter: "none" } };
18
+ var contentHidden2 = { opacity: 0, scale: 0.94, filter: "blur(6px)" };
19
+ var contentEnter2 = {
20
+ type: "tween",
21
+ duration: spring.slow.duration,
22
+ ease: "easeOut",
23
+ delay: spring.fast.duration
24
+ };
25
+ var contentLeave2 = { type: "tween", ...spring.fast.exit, ease: "easeIn" };
26
+
27
+ export { shapeTransition2, bubbleTransition2, contentShown2, contentHidden2, contentEnter2, contentLeave2 };
@@ -0,0 +1,84 @@
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 };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+
3
+ import {
4
+ SECOND2,
5
+ MINUTE2,
6
+ formatClock2,
7
+ formatShort2,
8
+ useEdgeClock2
9
+ } from "./chunk-gb56m10p.js";
10
+
11
+ // components/indicators/countdown/index.tsx
12
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
13
+ import { useEffect, useMemo, useRef, useState } from "react";
14
+ import { jsx } from "react/jsx-runtime";
15
+ /*!
16
+ * Local addition: the time left on a notch app's timer, as text that ticks
17
+ * only on second edges. Rebuilt from Just Notch's timer plugin (`Countdown`,
18
+ * `useRemaining`).
19
+ */
20
+ function Countdown2({
21
+ endsAt,
22
+ duration = 0,
23
+ paused = false,
24
+ remaining,
25
+ format = "clock",
26
+ onEnd,
27
+ className
28
+ }) {
29
+ const [mounted] = useState(Date.now);
30
+ const end = endsAt ?? mounted + duration;
31
+ const [coarse, setCoarse] = useState(format === "short" && end - Date.now() > MINUTE2);
32
+ const now = useEdgeClock2(end, !paused && Date.now() < end + SECOND2, coarse ? MINUTE2 : SECOND2);
33
+ const pausedLeft = useMemo(() => end - Date.now(), [paused, end]);
34
+ const left = Math.max(0, paused ? remaining ?? pausedLeft : end - now);
35
+ useEffect(() => setCoarse(format === "short" && left > MINUTE2), [format, left]);
36
+ const ended = useRef(false);
37
+ useEffect(() => {
38
+ if (left > 0 || paused) {
39
+ ended.current = false;
40
+ return;
41
+ }
42
+ if (ended.current)
43
+ return;
44
+ ended.current = true;
45
+ onEnd?.();
46
+ }, [left, paused, onEnd]);
47
+ const seconds = left / SECOND2;
48
+ return /* @__PURE__ */ jsx("span", {
49
+ role: "timer",
50
+ className: cn("tabular-nums", className),
51
+ children: format === "short" ? formatShort2(seconds) : formatClock2(Math.ceil(seconds))
52
+ });
53
+ }
54
+ export { Countdown2 };
@@ -0,0 +1,69 @@
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 };
@@ -0,0 +1,12 @@
1
+ import { IslandState2, IslandGeometry2, Shape2 } from "./chunk-cfzmfnyh.js";
2
+ import { Context as Context_rri5bl } from "react";
3
+ interface IslandContextValue2 {
4
+ state: IslandState2;
5
+ geometry: IslandGeometry2;
6
+ /** The outline of `state`, fitted to the room the island has. */
7
+ shape: Shape2;
8
+ }
9
+ declare const IslandContext2: Context_rri5bl<IslandContextValue2 | null>;
10
+ /** The enclosing Island's state and geometry, or `null` outside one. */
11
+ declare function useIsland2(): IslandContextValue2 | null;
12
+ export { IslandContextValue2, IslandContext2, useIsland2 };
@@ -0,0 +1,33 @@
1
+ import { JSX as JSX_1kxb } from "react";
2
+ type CountdownFormat2 = "clock" | "short";
3
+ interface CountdownProps2 {
4
+ /** When it ends, in epoch ms. */
5
+ endsAt?: number;
6
+ /** How long it runs from when it mounts, in ms, when there is no `endsAt`. Defaults to `0`. */
7
+ duration?: number;
8
+ /** Stop the clock: it holds the time left when it paused, or `remaining`. Defaults to `false`. */
9
+ paused?: boolean;
10
+ /** The time left to show while paused, in ms. */
11
+ remaining?: number;
12
+ /** `clock` is `4:05`; `short` is the largest unit, rounded up: `4m`, then `45s` in the last minute. Defaults to `'clock'`. */
13
+ format?: CountdownFormat2;
14
+ /** Called once when it reaches zero. */
15
+ onEnd?: () => void;
16
+ /** Classes for the text, such as its role and weight. */
17
+ className?: string;
18
+ }
19
+ type Element_12xgc = JSX_1kxb["Element"];
20
+ /**
21
+ * The time left, as text: `4:05`, or `4m` where room is short (a compact
22
+ * wing).
23
+ *
24
+ * It re-renders once per shown unit, on the unit's edge counted from the end,
25
+ * never in between: a second for the clock, a minute for the short form until
26
+ * its last minute. So a running timer costs one render a second at most, and
27
+ * the digits change exactly when a second has passed. Digits are tabular, so
28
+ * the text holds its width as it ticks. Paused, it holds the time left.
29
+ *
30
+ * @example {@include ./examples.mdx}
31
+ */
32
+ declare function Countdown2({ endsAt, duration, paused, remaining, format, onEnd, className }: CountdownProps2): Element_12xgc;
33
+ export { CountdownFormat2, CountdownProps2, Countdown2 };