@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.
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/blocks/activities/agenda/examples.mdx +58 -0
- package/blocks/activities/agenda/index.tsx +332 -0
- package/blocks/activities/now-playing/examples.mdx +49 -0
- package/blocks/activities/now-playing/index.tsx +218 -0
- package/blocks/activities/shelf/examples.mdx +33 -0
- package/blocks/activities/shelf/index.tsx +289 -0
- package/blocks/activities/timer/examples.mdx +52 -0
- package/blocks/activities/timer/index.tsx +292 -0
- package/blocks/app/expanded-island/examples.mdx +45 -0
- package/blocks/app/expanded-island/index.tsx +127 -0
- package/blocks/app/settings-window/examples.mdx +30 -0
- package/blocks/app/settings-window/index.tsx +357 -0
- package/blocks/system/controls/examples.mdx +34 -0
- package/blocks/system/controls/index.tsx +167 -0
- package/blocks/system/devices/examples.mdx +25 -0
- package/blocks/system/devices/index.tsx +172 -0
- package/blocks/system/power-alert/examples.mdx +32 -0
- package/blocks/system/power-alert/index.tsx +89 -0
- package/blocks/system/system-stats/examples.mdx +23 -0
- package/blocks/system/system-stats/index.tsx +178 -0
- package/components/indicators/battery-glyph/examples.mdx +22 -0
- package/components/indicators/battery-glyph/index.tsx +91 -0
- package/components/indicators/countdown/examples.mdx +25 -0
- package/components/indicators/countdown/index.tsx +83 -0
- package/components/indicators/equalizer/examples.mdx +20 -0
- package/components/indicators/equalizer/index.tsx +116 -0
- package/components/indicators/media-scrubber/examples.mdx +21 -0
- package/components/indicators/media-scrubber/index.tsx +98 -0
- package/components/island/island/examples.mdx +57 -0
- package/components/island/island/index.tsx +415 -0
- package/components/island/island-flash/examples.mdx +55 -0
- package/components/island/island-flash/index.tsx +79 -0
- package/components/island/island-tabs/examples.mdx +53 -0
- package/components/island/island-tabs/index.tsx +285 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -0
- package/dist/blocks/activities/agenda/index.js +21 -0
- package/dist/blocks/activities/now-playing/index.d.ts +2 -0
- package/dist/blocks/activities/now-playing/index.js +22 -0
- package/dist/blocks/activities/shelf/index.d.ts +2 -0
- package/dist/blocks/activities/shelf/index.js +14 -0
- package/dist/blocks/activities/timer/index.d.ts +2 -0
- package/dist/blocks/activities/timer/index.js +19 -0
- package/dist/blocks/app/expanded-island/index.d.ts +3 -0
- package/dist/blocks/app/expanded-island/index.js +10 -0
- package/dist/blocks/app/settings-window/index.d.ts +2 -0
- package/dist/blocks/app/settings-window/index.js +7 -0
- package/dist/blocks/system/controls/index.d.ts +2 -0
- package/dist/blocks/system/controls/index.js +10 -0
- package/dist/blocks/system/devices/index.d.ts +2 -0
- package/dist/blocks/system/devices/index.js +12 -0
- package/dist/blocks/system/power-alert/index.d.ts +2 -0
- package/dist/blocks/system/power-alert/index.js +9 -0
- package/dist/blocks/system/system-stats/index.d.ts +2 -0
- package/dist/blocks/system/system-stats/index.js +12 -0
- package/dist/components/indicators/battery-glyph/index.d.ts +2 -0
- package/dist/components/indicators/battery-glyph/index.js +9 -0
- package/dist/components/indicators/countdown/index.d.ts +2 -0
- package/dist/components/indicators/countdown/index.js +8 -0
- package/dist/components/indicators/equalizer/index.d.ts +2 -0
- package/dist/components/indicators/equalizer/index.js +7 -0
- package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
- package/dist/components/indicators/media-scrubber/index.js +8 -0
- package/dist/components/island/island/index.d.ts +3 -0
- package/dist/components/island/island/index.js +10 -0
- package/dist/components/island/island-flash/index.d.ts +2 -0
- package/dist/components/island/island-flash/index.js +7 -0
- package/dist/components/island/island-tabs/index.d.ts +2 -0
- package/dist/components/island/island-tabs/index.js +9 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +151 -0
- package/dist/lib/clock.d.ts +2 -0
- package/dist/lib/clock.js +14 -0
- package/dist/lib/geometry.d.ts +2 -0
- package/dist/lib/geometry.js +24 -0
- package/dist/lib/island-context.d.ts +3 -0
- package/dist/lib/island-context.js +8 -0
- package/dist/lib/motion.d.ts +21 -0
- package/dist/lib/motion.js +16 -0
- package/dist/shared/chunk-152gpyq3.d.ts +13 -0
- package/dist/shared/chunk-2f7zxrbk.js +65 -0
- package/dist/shared/chunk-2qpcsv5h.d.ts +45 -0
- package/dist/shared/chunk-2s4q6mt0.js +27 -0
- package/dist/shared/chunk-45gytfr1.d.ts +84 -0
- package/dist/shared/chunk-502rmtap.js +54 -0
- package/dist/shared/chunk-50ffk4r7.d.ts +69 -0
- package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
- package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
- package/dist/shared/chunk-5w0yck07.d.ts +32 -0
- package/dist/shared/chunk-6c1jbefs.d.ts +36 -0
- package/dist/shared/chunk-78w7qwp0.js +58 -0
- package/dist/shared/chunk-7hr53mby.js +116 -0
- package/dist/shared/chunk-9nhpg9t8.d.ts +47 -0
- package/dist/shared/chunk-b8jb1w72.js +145 -0
- package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
- package/dist/shared/chunk-cpewy6yg.js +178 -0
- package/dist/shared/chunk-d5qm9cps.js +10 -0
- package/dist/shared/chunk-e3e4s4ds.d.ts +77 -0
- package/dist/shared/chunk-enm6td0p.js +280 -0
- package/dist/shared/chunk-fvedaas2.d.ts +33 -0
- package/dist/shared/chunk-gb56m10p.js +39 -0
- package/dist/shared/chunk-gex38j8x.d.ts +82 -0
- package/dist/shared/chunk-hpsabfsd.d.ts +75 -0
- package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
- package/dist/shared/chunk-hwtxpzg0.js +69 -0
- package/dist/shared/chunk-mp1nx0ez.js +101 -0
- package/dist/shared/chunk-phb53x1f.js +252 -0
- package/dist/shared/chunk-r8esmjfs.d.ts +42 -0
- package/dist/shared/chunk-rcp1g9ca.js +70 -0
- package/dist/shared/chunk-rpfwv3pz.js +209 -0
- package/dist/shared/chunk-rr5e0g15.d.ts +35 -0
- package/dist/shared/chunk-rx9sphz2.js +266 -0
- package/dist/shared/chunk-s33y1pcq.js +305 -0
- package/dist/shared/chunk-sbnrhy5m.js +331 -0
- package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
- package/dist/shared/chunk-wwjxs75m.js +74 -0
- package/dist/shared/chunk-xdeek16r.d.ts +58 -0
- package/dist/shared/chunk-xkzjk1tq.js +206 -0
- package/dist/shared/chunk-yngkkxz2.d.ts +88 -0
- package/dist/shared/chunk-zvh0d3qb.js +63 -0
- package/dist/styles.css +222 -0
- package/index.ts +21 -0
- package/lib/clock.ts +53 -0
- package/lib/geometry.ts +130 -0
- package/lib/island-context.tsx +24 -0
- package/lib/motion.ts +42 -0
- package/mock/activities.tsx +100 -0
- package/mock/artwork.tsx +25 -0
- package/mock/data.ts +153 -0
- package/mock/desktop.tsx +83 -0
- package/mock/fit.ts +26 -0
- package/mock/island-content.tsx +217 -0
- package/mock/scene.tsx +52 -0
- package/mock/settings.tsx +210 -0
- package/package.json +117 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/indicators/battery-glyph/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 { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
/*!
|
|
10
|
+
* Local addition: a battery that fills to its level, for a notch app's power
|
|
11
|
+
* alerts. Rebuilt from Just Notch's power plugin (`Battery`).
|
|
12
|
+
*/
|
|
13
|
+
var FILL = {
|
|
14
|
+
default: "bg-foreground",
|
|
15
|
+
success: "bg-status-success",
|
|
16
|
+
warning: "bg-status-warning",
|
|
17
|
+
error: "bg-status-error"
|
|
18
|
+
};
|
|
19
|
+
function batteryTone2(level, charging) {
|
|
20
|
+
if (charging)
|
|
21
|
+
return "success";
|
|
22
|
+
if (level <= 10)
|
|
23
|
+
return "error";
|
|
24
|
+
if (level <= 20)
|
|
25
|
+
return "warning";
|
|
26
|
+
return "default";
|
|
27
|
+
}
|
|
28
|
+
function BatteryGlyph2({
|
|
29
|
+
level,
|
|
30
|
+
charging = false,
|
|
31
|
+
tone,
|
|
32
|
+
fillIn = true,
|
|
33
|
+
label,
|
|
34
|
+
className
|
|
35
|
+
}) {
|
|
36
|
+
const reduced = useReduceMotion();
|
|
37
|
+
const share = Math.max(0.06, Math.min(1, level / 100));
|
|
38
|
+
const name = label ?? `${Math.round(level)}%${charging ? ", charging" : ""}`;
|
|
39
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
40
|
+
role: "img",
|
|
41
|
+
"aria-label": name,
|
|
42
|
+
className: cn("inline-flex shrink-0 items-center gap-px", className),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("span", {
|
|
45
|
+
className: "relative h-3.5 w-7 overflow-hidden rounded-box bg-active p-0.5",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
48
|
+
className: cn("block h-full w-full origin-left rounded-glyph", FILL[tone ?? batteryTone2(level, charging)]),
|
|
49
|
+
initial: fillIn && !reduced ? { scaleX: 0 } : false,
|
|
50
|
+
animate: { scaleX: share },
|
|
51
|
+
transition: reduced ? { duration: 0 } : spring.slow
|
|
52
|
+
}),
|
|
53
|
+
charging && /* @__PURE__ */ jsx("svg", {
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
className: "absolute inset-0 m-auto size-3 fill-foreground",
|
|
57
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
58
|
+
d: "M13 2 4.5 13.5H11L10 22l8.5-11.5H12z"
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "h-1.5 w-0.5 rounded-r-full bg-active"
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { batteryTone2, BatteryGlyph2 };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_NOTCH2,
|
|
5
|
+
INSET2
|
|
6
|
+
} from "./chunk-zvh0d3qb.js";
|
|
7
|
+
import {
|
|
8
|
+
useIsland2
|
|
9
|
+
} from "./chunk-d5qm9cps.js";
|
|
10
|
+
import {
|
|
11
|
+
IslandTabs2
|
|
12
|
+
} from "./chunk-rpfwv3pz.js";
|
|
13
|
+
|
|
14
|
+
// blocks/app/expanded-island/index.tsx
|
|
15
|
+
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
16
|
+
import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
|
|
17
|
+
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
18
|
+
import ScrollArea from "@justanarthur/modo-ui/primitives/layout/scroll-area";
|
|
19
|
+
import { SizeProvider } from "@justanarthur/modo-ui/primitives/systems/sizes";
|
|
20
|
+
import { Settings } from "lucide-react";
|
|
21
|
+
import { useState } from "react";
|
|
22
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
/*!
|
|
24
|
+
* Local addition: the open island's layout, tabs in the wings, the tab's
|
|
25
|
+
* title and its view. Rebuilt from Just Notch's runtime
|
|
26
|
+
* (`island/expanded.tsx`) as a presentational block: tabs and their views
|
|
27
|
+
* come in as props.
|
|
28
|
+
*/
|
|
29
|
+
function ExpandedIsland2({
|
|
30
|
+
tabs,
|
|
31
|
+
value: valueProp,
|
|
32
|
+
defaultValue,
|
|
33
|
+
onValueChange,
|
|
34
|
+
onSettings,
|
|
35
|
+
settingsLabel = "Settings",
|
|
36
|
+
empty = "Nothing here yet",
|
|
37
|
+
className
|
|
38
|
+
}) {
|
|
39
|
+
const island = useIsland2();
|
|
40
|
+
const [value, setValue] = useControllableState(valueProp, defaultValue ?? tabs[0]?.value, onValueChange);
|
|
41
|
+
const [hovered, setHovered] = useState(null);
|
|
42
|
+
const tab = tabs.find((t) => t.value === value) ?? tabs[0];
|
|
43
|
+
const title = tabs.find((t) => t.value === hovered)?.label ?? tab?.label;
|
|
44
|
+
const notch = island?.geometry.notch.height ?? DEFAULT_NOTCH2.height;
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: cn("flex size-full flex-col", className),
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(SizeProvider, {
|
|
49
|
+
size: "compact",
|
|
50
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "flex shrink-0 items-center",
|
|
52
|
+
style: { height: notch, paddingInline: INSET2 },
|
|
53
|
+
children: tabs.length > 0 ? /* @__PURE__ */ jsx(IslandTabs2, {
|
|
54
|
+
tabs,
|
|
55
|
+
value: tab?.value,
|
|
56
|
+
onValueChange: setValue,
|
|
57
|
+
onHoverChange: setHovered,
|
|
58
|
+
trailing: onSettings && /* @__PURE__ */ jsx(Button, {
|
|
59
|
+
variant: "ghost",
|
|
60
|
+
size: "icon-compact",
|
|
61
|
+
"aria-label": settingsLabel,
|
|
62
|
+
onClick: onSettings,
|
|
63
|
+
children: /* @__PURE__ */ jsx(Settings, {
|
|
64
|
+
size: 14,
|
|
65
|
+
strokeWidth: 1.5
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "flex-1"
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex min-h-0 flex-1 flex-col pb-3",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: "flex h-6 shrink-0 items-end",
|
|
78
|
+
style: { paddingInline: INSET2 },
|
|
79
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
80
|
+
className: "truncate text-caption weight-medium text-muted-foreground",
|
|
81
|
+
children: title
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ jsx(ScrollArea, {
|
|
85
|
+
className: "min-h-0 flex-1",
|
|
86
|
+
viewportClassName: "scroll-fade [&>div]:flex [&>div]:min-h-full [&>div]:flex-col",
|
|
87
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "flex flex-1 flex-col py-1 [&>*]:flex-1",
|
|
89
|
+
style: { paddingInline: INSET2 },
|
|
90
|
+
children: tab ? tab.content : /* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: "flex items-center justify-center text-caption text-muted-foreground",
|
|
92
|
+
children: empty
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}, tab?.value)
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
export { ExpandedIsland2 };
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// blocks/activities/shelf/index.tsx
|
|
4
|
+
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
5
|
+
import EmptyState from "@justanarthur/modo-ui/components/feedback/empty-state";
|
|
6
|
+
import ContextMenu from "@justanarthur/modo-ui/components/overlays/context-menu";
|
|
7
|
+
import { useReduceMotion } from "@justanarthur/modo-ui/lib/reduced-motion";
|
|
8
|
+
import { spring } from "@justanarthur/modo-ui/lib/springs";
|
|
9
|
+
import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
|
|
10
|
+
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
11
|
+
import FluidHover from "@justanarthur/modo-ui/primitives/systems/fluid-hover";
|
|
12
|
+
import {
|
|
13
|
+
ArrowDownToLine,
|
|
14
|
+
Check,
|
|
15
|
+
File,
|
|
16
|
+
FileArchive,
|
|
17
|
+
FileAudio,
|
|
18
|
+
FileCode,
|
|
19
|
+
FileImage,
|
|
20
|
+
Files,
|
|
21
|
+
FileText,
|
|
22
|
+
FileVideo,
|
|
23
|
+
Send,
|
|
24
|
+
Trash2
|
|
25
|
+
} from "lucide-react";
|
|
26
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
27
|
+
import { useRef } from "react";
|
|
28
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
29
|
+
/*!
|
|
30
|
+
* Local addition: a notch app's file shelf, the files dragged onto the notch
|
|
31
|
+
* to keep for later. Rebuilt from Just Notch's shelf plugin (`Shelf`, `Tile`,
|
|
32
|
+
* `DropFlash`, `Count`) as presentational parts: the files and what to do
|
|
33
|
+
* with them come in as props.
|
|
34
|
+
*/
|
|
35
|
+
var DRAG_SLOP_PX = 4;
|
|
36
|
+
var TYPES = [
|
|
37
|
+
[/\.(png|jpe?g|gif|webp|heic|svg|tiff?)$/i, FileImage],
|
|
38
|
+
[/\.(mov|mp4|m4v|avi|mkv|webm)$/i, FileVideo],
|
|
39
|
+
[/\.(mp3|m4a|wav|aiff?|flac|ogg)$/i, FileAudio],
|
|
40
|
+
[/\.(zip|tar|gz|tgz|rar|7z|dmg)$/i, FileArchive],
|
|
41
|
+
[/\.(m?[jt]sx?|json|css|html|swift|rs|go|py|rb|sh|ya?ml|toml)$/i, FileCode],
|
|
42
|
+
[/\.(pdf|md|txt|rtf|docx?|pages|key|numbers|csv)$/i, FileText]
|
|
43
|
+
];
|
|
44
|
+
var iconFor = (name) => TYPES.find(([pattern]) => pattern.test(name))?.[1] ?? File;
|
|
45
|
+
var count = (n) => `${n} ${n === 1 ? "file" : "files"}`;
|
|
46
|
+
function Thumbnail({ file }) {
|
|
47
|
+
const Icon = iconFor(file.name);
|
|
48
|
+
return /* @__PURE__ */ jsx("span", {
|
|
49
|
+
className: "flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-3 text-muted-foreground",
|
|
50
|
+
children: typeof file.thumbnail === "string" ? /* @__PURE__ */ jsx("img", {
|
|
51
|
+
alt: "",
|
|
52
|
+
src: file.thumbnail,
|
|
53
|
+
draggable: false,
|
|
54
|
+
className: "size-full object-cover"
|
|
55
|
+
}) : file.thumbnail ?? /* @__PURE__ */ jsx(Icon, {
|
|
56
|
+
size: 20,
|
|
57
|
+
strokeWidth: 1.5
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function Tile({ file, index, onOpen, onReveal, onRemove, onDragOut }) {
|
|
62
|
+
const reduced = useReduceMotion();
|
|
63
|
+
const press = useRef(undefined);
|
|
64
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
65
|
+
layout: !reduced,
|
|
66
|
+
initial: { opacity: 0, scale: reduced ? 1 : 0.9 },
|
|
67
|
+
animate: { opacity: 1, scale: 1 },
|
|
68
|
+
exit: { opacity: 0, scale: reduced ? 1 : 0.9, transition: spring.moderate.exit },
|
|
69
|
+
transition: spring.moderate,
|
|
70
|
+
children: /* @__PURE__ */ jsxs(ContextMenu, {
|
|
71
|
+
size: "compact",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(ContextMenu.Trigger, {
|
|
74
|
+
children: /* @__PURE__ */ jsxs(FluidHover.Item, {
|
|
75
|
+
index,
|
|
76
|
+
title: file.name,
|
|
77
|
+
className: "h-auto w-20 flex-col items-center justify-start gap-1.5 p-1.5",
|
|
78
|
+
onPointerDown: (event) => {
|
|
79
|
+
if (event.button === 0)
|
|
80
|
+
press.current = { x: event.clientX, y: event.clientY };
|
|
81
|
+
},
|
|
82
|
+
onPointerMove: (event) => {
|
|
83
|
+
const start = press.current;
|
|
84
|
+
if (!start || Math.hypot(event.clientX - start.x, event.clientY - start.y) < DRAG_SLOP_PX)
|
|
85
|
+
return;
|
|
86
|
+
press.current = undefined;
|
|
87
|
+
onDragOut?.(file);
|
|
88
|
+
},
|
|
89
|
+
onPointerUp: () => {
|
|
90
|
+
press.current = undefined;
|
|
91
|
+
},
|
|
92
|
+
onDoubleClick: () => onOpen?.(file),
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(Thumbnail, {
|
|
95
|
+
file
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "w-full truncate text-center text-micro text-foreground",
|
|
99
|
+
children: file.name
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsxs(ContextMenu.Content, {
|
|
105
|
+
className: "dark text-foreground",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx(ContextMenu.Item, {
|
|
108
|
+
index: 0,
|
|
109
|
+
label: "Open",
|
|
110
|
+
onSelect: () => onOpen?.(file)
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx(ContextMenu.Item, {
|
|
113
|
+
index: 1,
|
|
114
|
+
label: "Show in Finder",
|
|
115
|
+
onSelect: () => onReveal?.(file)
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx(ContextMenu.Separator, {}),
|
|
118
|
+
/* @__PURE__ */ jsx(ContextMenu.Item, {
|
|
119
|
+
index: 2,
|
|
120
|
+
icon: Trash2,
|
|
121
|
+
label: "Remove from shelf",
|
|
122
|
+
onSelect: () => onRemove(file)
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function ShelfLeading2() {
|
|
131
|
+
return /* @__PURE__ */ jsx(Files, {
|
|
132
|
+
size: 16,
|
|
133
|
+
strokeWidth: 1.5,
|
|
134
|
+
className: "text-foreground"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function ShelfTrailing2({ count: n }) {
|
|
138
|
+
return /* @__PURE__ */ jsx("span", {
|
|
139
|
+
className: "text-caption weight-medium tabular-nums text-foreground",
|
|
140
|
+
children: n
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function ShelfDrop2({ phase, count: n, total = n, className }) {
|
|
144
|
+
const reduced = useReduceMotion();
|
|
145
|
+
const added = phase === "added";
|
|
146
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: cn("flex h-10 items-center gap-3 rounded-xl border px-3 transition-[border-color] duration-moderate", added ? "border-transparent" : "border-dashed border-brand", className),
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
150
|
+
initial: false,
|
|
151
|
+
mode: "popLayout",
|
|
152
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
153
|
+
className: cn("flex shrink-0", added ? "text-status-success" : "text-brand"),
|
|
154
|
+
initial: { opacity: 0, scale: reduced ? 1 : 0.6 },
|
|
155
|
+
animate: { opacity: 1, scale: 1 },
|
|
156
|
+
exit: { opacity: 0, scale: reduced ? 1 : 0.6, transition: spring.fast.exit },
|
|
157
|
+
transition: spring.moderate,
|
|
158
|
+
children: added ? /* @__PURE__ */ jsx(Check, {
|
|
159
|
+
size: 16,
|
|
160
|
+
strokeWidth: 2
|
|
161
|
+
}) : /* @__PURE__ */ jsx(ArrowDownToLine, {
|
|
162
|
+
size: 16,
|
|
163
|
+
strokeWidth: 1.5
|
|
164
|
+
})
|
|
165
|
+
}, phase)
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsx("span", {
|
|
168
|
+
className: "min-w-0 flex-1 truncate text-body weight-semibold text-foreground",
|
|
169
|
+
children: added ? "Added to shelf" : "Drop to shelf"
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsx("span", {
|
|
172
|
+
className: "shrink-0 text-caption tabular-nums text-muted-foreground",
|
|
173
|
+
children: added ? `${total} on shelf` : count(n)
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function Shelf2({
|
|
179
|
+
value,
|
|
180
|
+
defaultValue = [],
|
|
181
|
+
onValueChange,
|
|
182
|
+
onOpen,
|
|
183
|
+
onReveal,
|
|
184
|
+
onAirDrop,
|
|
185
|
+
onDragOut,
|
|
186
|
+
className
|
|
187
|
+
}) {
|
|
188
|
+
const [files, setFiles] = useControllableState(value, defaultValue, onValueChange);
|
|
189
|
+
if (files.length === 0)
|
|
190
|
+
return /* @__PURE__ */ jsx("div", {
|
|
191
|
+
className: cn("flex size-full items-center justify-center", className),
|
|
192
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
193
|
+
size: "compact",
|
|
194
|
+
icon: Files,
|
|
195
|
+
title: "Shelf is empty",
|
|
196
|
+
description: "Drag files onto the notch to keep them here."
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
200
|
+
className: cn("flex size-full flex-col gap-2", className),
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "flex shrink-0 items-center justify-between gap-3",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: "text-caption tabular-nums text-muted-foreground",
|
|
207
|
+
children: count(files.length)
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ jsxs("div", {
|
|
210
|
+
className: "-mr-3 flex items-center gap-1",
|
|
211
|
+
children: [
|
|
212
|
+
onAirDrop && /* @__PURE__ */ jsx(Button, {
|
|
213
|
+
variant: "ghost",
|
|
214
|
+
size: "compact",
|
|
215
|
+
leadingIcon: Send,
|
|
216
|
+
onClick: () => onAirDrop(files),
|
|
217
|
+
children: "AirDrop"
|
|
218
|
+
}),
|
|
219
|
+
/* @__PURE__ */ jsx(Button, {
|
|
220
|
+
variant: "ghost",
|
|
221
|
+
size: "compact",
|
|
222
|
+
leadingIcon: Trash2,
|
|
223
|
+
onClick: () => setFiles([]),
|
|
224
|
+
children: "Clear"
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ jsx(FluidHover, {
|
|
231
|
+
axis: "x",
|
|
232
|
+
className: "-mx-3 flex min-h-0 flex-1 items-start overflow-x-auto overflow-y-hidden px-1.5",
|
|
233
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
234
|
+
initial: false,
|
|
235
|
+
children: files.map((file, i) => /* @__PURE__ */ jsx(Tile, {
|
|
236
|
+
file,
|
|
237
|
+
index: i,
|
|
238
|
+
onOpen,
|
|
239
|
+
onReveal,
|
|
240
|
+
onRemove: (removed) => setFiles(files.filter((f) => f.id !== removed.id)),
|
|
241
|
+
onDragOut
|
|
242
|
+
}, file.id))
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
Shelf2.Drop = ShelfDrop2;
|
|
249
|
+
Shelf2.Leading = ShelfLeading2;
|
|
250
|
+
Shelf2.Trailing = ShelfTrailing2;
|
|
251
|
+
var shelf_default = Shelf2;
|
|
252
|
+
export { ShelfLeading2, ShelfTrailing2, ShelfDrop2, Shelf2, shelf_default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { JSX as JSX_1kxb } from "react";
|
|
2
|
+
type DeviceKind2 = "headphones" | "keyboard" | "mouse" | "speaker" | "gamepad" | "phone" | "watch" | "other";
|
|
3
|
+
interface DeviceInfo2 {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** What it is, for its glyph. */
|
|
7
|
+
kind: DeviceKind2;
|
|
8
|
+
connected: boolean;
|
|
9
|
+
/** Its charge in percent, when it reports one. */
|
|
10
|
+
battery?: number;
|
|
11
|
+
charging?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DevicesProps2 {
|
|
14
|
+
/** The paired devices; connected ones list first, then by name. */
|
|
15
|
+
devices: DeviceInfo2[];
|
|
16
|
+
/** Called by the empty state's Open Bluetooth Settings; without it the button hides. */
|
|
17
|
+
onOpenSettings?: () => void;
|
|
18
|
+
/** Classes for the root, which fills its container. */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
22
|
+
/** The island's flash when a device connects: its glyph, name and battery. */
|
|
23
|
+
declare function DevicesConnected2({ device }: {
|
|
24
|
+
device: DeviceInfo2;
|
|
25
|
+
}): Element_12xgc;
|
|
26
|
+
/**
|
|
27
|
+
* A notch app's Bluetooth devices: what's paired, what's connected and how
|
|
28
|
+
* much charge each has left.
|
|
29
|
+
*
|
|
30
|
+
* Devices list in two columns, connected first: a glyph for the kind of
|
|
31
|
+
* device (raised while connected), the name, a StatusDot with Connected or
|
|
32
|
+
* Not connected, and for a connected device that reports one, its charge as
|
|
33
|
+
* a figure and a BatteryGlyph, which turns to the warning and error hues as
|
|
34
|
+
* it runs low. Without devices it says how to pair one, with a button to the
|
|
35
|
+
* system's Bluetooth settings when `onOpenSettings` is given.
|
|
36
|
+
*
|
|
37
|
+
* `Devices.Connected` is the island's flash when a device connects.
|
|
38
|
+
*
|
|
39
|
+
* @example {@include ./examples.mdx}
|
|
40
|
+
*/
|
|
41
|
+
declare function Devices2({ devices, onOpenSettings, className }: DevicesProps2): Element_12xgc;
|
|
42
|
+
export { DeviceKind2, DeviceInfo2, DevicesProps2, DevicesConnected2, Devices2 };
|
|
@@ -0,0 +1,70 @@
|
|
|
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/power-alert/index.tsx
|
|
11
|
+
import { BatteryLow, BatteryWarning, Unplug, Zap } from "lucide-react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
/*!
|
|
14
|
+
* Local addition: a notch app's power alerts. Rebuilt from Just Notch's
|
|
15
|
+
* power plugin (`Charging`, `Unplugged`, `Low`, `Critical`) as one
|
|
16
|
+
* presentational flash: the battery comes in as props.
|
|
17
|
+
*/
|
|
18
|
+
var ALERT = {
|
|
19
|
+
charging: {
|
|
20
|
+
title: "Charging",
|
|
21
|
+
tone: "success",
|
|
22
|
+
icon: /* @__PURE__ */ jsx(Zap, {
|
|
23
|
+
size: 18,
|
|
24
|
+
strokeWidth: 1.5,
|
|
25
|
+
fill: "currentColor"
|
|
26
|
+
}),
|
|
27
|
+
verb: "until full"
|
|
28
|
+
},
|
|
29
|
+
unplugged: { title: "On battery", tone: "default", icon: /* @__PURE__ */ jsx(Unplug, {
|
|
30
|
+
size: 18,
|
|
31
|
+
strokeWidth: 1.5
|
|
32
|
+
}), verb: "remaining" },
|
|
33
|
+
low: {
|
|
34
|
+
title: "Low battery",
|
|
35
|
+
tone: "warning",
|
|
36
|
+
icon: /* @__PURE__ */ jsx(BatteryLow, {
|
|
37
|
+
size: 18,
|
|
38
|
+
strokeWidth: 1.5
|
|
39
|
+
}),
|
|
40
|
+
caption: "Plug in soon"
|
|
41
|
+
},
|
|
42
|
+
critical: {
|
|
43
|
+
title: "Battery critically low",
|
|
44
|
+
tone: "error",
|
|
45
|
+
icon: /* @__PURE__ */ jsx(BatteryWarning, {
|
|
46
|
+
size: 18,
|
|
47
|
+
strokeWidth: 1.5
|
|
48
|
+
}),
|
|
49
|
+
caption: "Plug in now"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var span = (minutes) => minutes >= 60 ? `${Math.floor(minutes / 60)} h ${Math.round(minutes % 60)} min` : `${Math.round(minutes)} min`;
|
|
53
|
+
function PowerAlert2({ kind, level, minutes, caption, className }) {
|
|
54
|
+
const alert = ALERT[kind];
|
|
55
|
+
const detail = minutes !== undefined && alert.verb ? `${span(minutes)} ${alert.verb}` : alert.caption;
|
|
56
|
+
return /* @__PURE__ */ jsx(IslandFlash2, {
|
|
57
|
+
className,
|
|
58
|
+
icon: alert.icon,
|
|
59
|
+
tone: alert.tone,
|
|
60
|
+
title: alert.title,
|
|
61
|
+
caption: caption ?? detail,
|
|
62
|
+
value: `${Math.round(level)}%`,
|
|
63
|
+
trailing: /* @__PURE__ */ jsx(BatteryGlyph2, {
|
|
64
|
+
level,
|
|
65
|
+
charging: kind === "charging",
|
|
66
|
+
tone: alert.tone
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export { PowerAlert2 };
|