@justanarthur/modo-ui-notch 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/blocks/activities/agenda/examples.mdx +29 -5
- package/blocks/activities/agenda/index.tsx +438 -181
- package/blocks/activities/clock/examples.mdx +89 -0
- package/blocks/activities/clock/index.tsx +917 -0
- package/blocks/activities/now-playing/examples.mdx +40 -13
- package/blocks/activities/now-playing/index.tsx +399 -120
- package/blocks/activities/weather/examples.mdx +123 -0
- package/blocks/activities/weather/index.tsx +863 -0
- package/blocks/app/expanded-island/examples.mdx +8 -7
- package/blocks/app/expanded-island/index.tsx +22 -4
- package/blocks/app/settings-window/examples.mdx +14 -2
- package/blocks/app/settings-window/index.tsx +33 -10
- package/blocks/system/clipboard/examples.mdx +91 -0
- package/blocks/system/clipboard/index.tsx +773 -0
- package/blocks/system/recent-files/examples.mdx +80 -0
- package/blocks/system/recent-files/index.tsx +627 -0
- package/blocks/system/system-stats/examples.mdx +46 -9
- package/blocks/system/system-stats/index.tsx +445 -104
- package/components/indicators/media-scrubber/examples.mdx +8 -0
- package/components/indicators/media-scrubber/index.tsx +37 -13
- package/components/island/island/examples.mdx +4 -4
- package/components/island/island/index.tsx +2 -2
- package/components/island/island-flash/examples.mdx +15 -18
- package/components/island/island-flash/index.tsx +4 -4
- package/components/island/island-tabs/examples.mdx +5 -5
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +465 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -1
- package/dist/blocks/activities/agenda/index.js +3 -3
- package/dist/blocks/activities/clock/index.d.ts +3 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +4 -2
- package/dist/blocks/activities/now-playing/index.js +5 -3
- package/dist/blocks/activities/weather/index.d.ts +3 -0
- package/dist/blocks/activities/weather/index.js +21 -0
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +4 -3
- package/dist/blocks/app/settings-window/index.d.ts +1 -1
- package/dist/blocks/app/settings-window/index.js +1 -1
- package/dist/blocks/system/clipboard/index.d.ts +3 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +3 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +3 -2
- package/dist/blocks/system/system-stats/index.js +4 -1
- package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
- package/dist/components/indicators/media-scrubber/index.js +1 -1
- package/dist/components/island/island/index.d.ts +1 -1
- package/dist/components/island/island/index.js +2 -2
- package/dist/components/island/island-flash/index.d.ts +1 -1
- package/dist/components/island/island-flash/index.js +1 -1
- package/dist/components/island/island-tabs/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +32 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +104 -58
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/geometry.js +1 -1
- package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
- package/dist/shared/chunk-2b6gpn8k.js +444 -0
- package/dist/shared/chunk-3hcnf4yx.js +481 -0
- package/dist/shared/chunk-42wab62s.d.ts +197 -0
- package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
- package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
- package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
- package/dist/shared/chunk-93dtpjz7.js +789 -0
- package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
- package/dist/shared/chunk-a6njb8db.d.ts +129 -0
- package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
- package/dist/shared/chunk-evqpf92s.d.ts +168 -0
- package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
- package/dist/shared/chunk-gcyspvgr.js +582 -0
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
- package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
- package/dist/shared/chunk-n739am8j.d.ts +112 -0
- package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
- package/dist/shared/chunk-nwzpekvy.js +774 -0
- package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
- package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
- package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
- package/dist/shared/chunk-t9wqhgzt.js +765 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
- package/dist/shared/chunk-wf0jtzhs.js +295 -0
- package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
- package/dist/shared/chunk-yq5svpk7.js +524 -0
- package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
- package/dist/styles.css +151 -49
- package/index.ts +7 -6
- package/lib/artwork.ts +112 -0
- package/lib/geometry.ts +1 -1
- package/mock/activities.tsx +9 -32
- package/mock/artwork.tsx +13 -1
- package/mock/clipboard.tsx +113 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +78 -44
- package/mock/files.tsx +83 -0
- package/mock/island-content.tsx +79 -122
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +370 -91
- package/mock/system.ts +49 -0
- package/mock/weather.tsx +135 -0
- package/package.json +7 -2
- package/blocks/activities/shelf/examples.mdx +0 -33
- package/blocks/activities/shelf/index.tsx +0 -289
- package/blocks/activities/timer/examples.mdx +0 -52
- package/blocks/activities/timer/index.tsx +0 -292
- package/blocks/system/controls/examples.mdx +0 -34
- package/blocks/system/controls/index.tsx +0 -167
- package/blocks/system/devices/examples.mdx +0 -25
- package/blocks/system/devices/index.tsx +0 -172
- package/blocks/system/power-alert/examples.mdx +0 -32
- package/blocks/system/power-alert/index.tsx +0 -89
- package/components/indicators/battery-glyph/examples.mdx +0 -22
- package/components/indicators/battery-glyph/index.tsx +0 -91
- package/dist/blocks/activities/shelf/index.d.ts +0 -2
- package/dist/blocks/activities/shelf/index.js +0 -14
- package/dist/blocks/activities/timer/index.d.ts +0 -2
- package/dist/blocks/activities/timer/index.js +0 -19
- package/dist/blocks/system/controls/index.d.ts +0 -2
- package/dist/blocks/system/controls/index.js +0 -10
- package/dist/blocks/system/devices/index.d.ts +0 -2
- package/dist/blocks/system/devices/index.js +0 -12
- package/dist/blocks/system/power-alert/index.d.ts +0 -2
- package/dist/blocks/system/power-alert/index.js +0 -9
- package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
- package/dist/components/indicators/battery-glyph/index.js +0 -9
- package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
- package/dist/shared/chunk-45gytfr1.d.ts +0 -84
- package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
- package/dist/shared/chunk-5w0yck07.d.ts +0 -32
- package/dist/shared/chunk-7hr53mby.js +0 -116
- package/dist/shared/chunk-b8jb1w72.js +0 -145
- package/dist/shared/chunk-cpewy6yg.js +0 -178
- package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
- package/dist/shared/chunk-enm6td0p.js +0 -280
- package/dist/shared/chunk-fvedaas2.d.ts +0 -33
- package/dist/shared/chunk-gex38j8x.d.ts +0 -82
- package/dist/shared/chunk-hwtxpzg0.js +0 -69
- package/dist/shared/chunk-phb53x1f.js +0 -252
- package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
- package/dist/shared/chunk-rcp1g9ca.js +0 -70
- package/dist/shared/chunk-rx9sphz2.js +0 -266
- package/dist/shared/chunk-xdeek16r.d.ts +0 -58
- package/dist/shared/chunk-xkzjk1tq.js +0 -206
|
@@ -24,6 +24,7 @@ function MediaScrubber2({
|
|
|
24
24
|
size = "compact",
|
|
25
25
|
label = "Position",
|
|
26
26
|
disabled = false,
|
|
27
|
+
quiet = false,
|
|
27
28
|
className
|
|
28
29
|
}) {
|
|
29
30
|
const [base, setBase] = useState(() => ({ seconds: position, since: Date.now() }));
|
|
@@ -48,18 +49,31 @@ function MediaScrubber2({
|
|
|
48
49
|
className: "w-9 shrink-0 text-micro tabular-nums text-muted-foreground",
|
|
49
50
|
children: formatClock2(value)
|
|
50
51
|
}),
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
className: "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
/* @__PURE__ */ jsxs("span", {
|
|
53
|
+
className: "group/scrub relative flex min-w-0 flex-1 items-center",
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Slider, {
|
|
56
|
+
className: cn("mb-0 min-w-0 flex-1", quiet && "opacity-0 transition-[opacity] duration-fast group-hover/scrub:opacity-100 group-focus-within/scrub:opacity-100 pointer-coarse:opacity-100"),
|
|
57
|
+
size,
|
|
58
|
+
label,
|
|
59
|
+
showValue: false,
|
|
60
|
+
formatValue: formatClock2,
|
|
61
|
+
min: 0,
|
|
62
|
+
max: Math.max(1, duration),
|
|
63
|
+
step: 1,
|
|
64
|
+
value,
|
|
65
|
+
disabled,
|
|
66
|
+
onValueChange: (v) => setDragged(v)
|
|
67
|
+
}),
|
|
68
|
+
quiet && /* @__PURE__ */ jsx("span", {
|
|
69
|
+
"aria-hidden": true,
|
|
70
|
+
className: "pointer-events-none absolute inset-x-0 h-1 overflow-hidden rounded-full bg-active transition-[opacity] duration-fast group-hover/scrub:opacity-0 group-focus-within/scrub:opacity-0 pointer-coarse:opacity-0",
|
|
71
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
72
|
+
className: "block size-full rounded-full bg-foreground",
|
|
73
|
+
style: { transform: `translateX(${(value / Math.max(1, duration) - 1) * 100}%)` }
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
]
|
|
63
77
|
}),
|
|
64
78
|
/* @__PURE__ */ jsxs("span", {
|
|
65
79
|
className: "w-9 shrink-0 text-right text-micro tabular-nums text-muted-foreground",
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { WidgetLayout2 } from "./chunk-42wab62s.js";
|
|
2
|
+
import { SizeVariant } from "@justanarthur/modo-ui/lib/size-context";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { JSX as JSX_1kxb } from "react";
|
|
5
|
+
type ClipboardClipKind2 = "text" | "link" | "image" | "color" | "file";
|
|
6
|
+
interface ClipboardClip2 {
|
|
7
|
+
/** What tells it apart. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** What was copied: it picks the glyph and how the clip previews. */
|
|
10
|
+
kind: ClipboardClipKind2;
|
|
11
|
+
/** The clip as text: the text, the URL, the color as copied (`#5B8DEF`), the file's or image's name. */
|
|
12
|
+
content: string;
|
|
13
|
+
/** One line more: a link's page title, an image's size, a color in another notation, a file's size. */
|
|
14
|
+
detail?: string;
|
|
15
|
+
/** A picture: an image's thumbnail or a link's favicon, as a URL or any element. */
|
|
16
|
+
preview?: string | ReactNode;
|
|
17
|
+
/** A color clip's paint, any CSS color; defaults to `content`. */
|
|
18
|
+
color?: string;
|
|
19
|
+
/** The app it was copied from. */
|
|
20
|
+
app?: string;
|
|
21
|
+
/** When it was copied, in epoch ms. */
|
|
22
|
+
copiedAt: number;
|
|
23
|
+
}
|
|
24
|
+
interface ClipboardHistoryProps2 {
|
|
25
|
+
/** The clips, in any order: pinned ones list first, the rest newest first. */
|
|
26
|
+
clips: ClipboardClip2[];
|
|
27
|
+
/** The selected clip's id, shown as the hero (controlled). */
|
|
28
|
+
value?: string;
|
|
29
|
+
/** The selected clip at first (uncontrolled). Defaults to the first in the list. */
|
|
30
|
+
defaultValue?: string;
|
|
31
|
+
/** Called with a clip's id when it is picked, by a press or the arrow keys. */
|
|
32
|
+
onValueChange?: (id: string) => void;
|
|
33
|
+
/** The pinned clips' ids (controlled). */
|
|
34
|
+
pinned?: string[];
|
|
35
|
+
/** The pinned clips at first (uncontrolled). Defaults to `[]`. */
|
|
36
|
+
defaultPinned?: string[];
|
|
37
|
+
/** Called with the new ids when a clip is pinned or unpinned. */
|
|
38
|
+
onPinnedChange?: (pinned: string[]) => void;
|
|
39
|
+
/** The search (controlled): clips whose text, detail or app hold it stay. */
|
|
40
|
+
query?: string;
|
|
41
|
+
/** The search at first (uncontrolled). Defaults to `''`. */
|
|
42
|
+
defaultQuery?: string;
|
|
43
|
+
/** Called with the search as it is typed. */
|
|
44
|
+
onQueryChange?: (query: string) => void;
|
|
45
|
+
/** Copying is not recorded (controlled). */
|
|
46
|
+
paused?: boolean;
|
|
47
|
+
/** Copying is not recorded at first (uncontrolled). Defaults to `false`. */
|
|
48
|
+
defaultPaused?: boolean;
|
|
49
|
+
/** Called with the new state when pause or resume is pressed. */
|
|
50
|
+
onPausedChange?: (paused: boolean) => void;
|
|
51
|
+
/** The frontmost app, when it is one whose copies are never kept (a password manager): a chip says so. */
|
|
52
|
+
ignoredApp?: string;
|
|
53
|
+
/** Called by Copy, a row's double-click or Enter, with the clip to put back on the clipboard. */
|
|
54
|
+
onCopy?: (clip: ClipboardClip2) => void;
|
|
55
|
+
/** Called by Delete with the clip to drop from the history. */
|
|
56
|
+
onDelete?: (clip: ClipboardClip2) => void;
|
|
57
|
+
/** The moment the times are read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
58
|
+
now?: number;
|
|
59
|
+
/** `tall` is the open island's tall snap: the search across the top, every clip as a two-line row with its picture, and the selected clip in full beside them with its actions. Defaults to `'fit'`. */
|
|
60
|
+
layout?: WidgetLayout2;
|
|
61
|
+
/** Step on the size ladder. Omitted, it follows the surrounding SizeProvider. */
|
|
62
|
+
size?: SizeVariant;
|
|
63
|
+
/** Classes for the root, which fills its container. */
|
|
64
|
+
className?: string;
|
|
65
|
+
}
|
|
66
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
67
|
+
/** The compact island's left wing: the clipboard glyph. */
|
|
68
|
+
declare function ClipboardHistoryLeading2(): Element_12xgc;
|
|
69
|
+
/** The compact island's right wing: how many clips came in since the island was last open. */
|
|
70
|
+
declare function ClipboardHistoryTrailing2({ count }: {
|
|
71
|
+
count: number;
|
|
72
|
+
}): Element_12xgc;
|
|
73
|
+
interface CopiedProps {
|
|
74
|
+
/** The clip that was copied. */
|
|
75
|
+
clip: ClipboardClip2;
|
|
76
|
+
/** Called by Pin; without it the button hides. */
|
|
77
|
+
onPin?: (clip: ClipboardClip2) => void;
|
|
78
|
+
}
|
|
79
|
+
/** The island's flash when something is copied: the clip's picture or glyph, `Copied`, its preview and Pin. */
|
|
80
|
+
declare function ClipboardHistoryCopied2({ clip, onPin }: CopiedProps): Element_12xgc;
|
|
81
|
+
/**
|
|
82
|
+
* A notch app's clipboard history: the latest clip as the hero, the ones
|
|
83
|
+
* before it beside it, pinned ones on top.
|
|
84
|
+
*
|
|
85
|
+
* The hero is the selected clip, the newest until another is picked, shown
|
|
86
|
+
* as what it is: text over two lines, a link as its domain with the page's
|
|
87
|
+
* title, an image as its thumbnail, a color as a swatch with its value, a
|
|
88
|
+
* file as a tile with its name and size. The context line says where it was
|
|
89
|
+
* copied and how long ago; under the hero, its length or a link's path,
|
|
90
|
+
* Pin, Delete and Copy.
|
|
91
|
+
*
|
|
92
|
+
* Beside it, past a hairline, a search over the history and the clips
|
|
93
|
+
* themselves: pinned ones first, then the rest newest first, each a row of
|
|
94
|
+
* its swatch, thumbnail or glyph, its text and how long ago. Three show at
|
|
95
|
+
* a time, around the selected one, with a count of the rest. The arrow keys
|
|
96
|
+
* move the selection from anywhere in the widget (the search included),
|
|
97
|
+
* Enter copies it, and a double-click copies a row. The selection, the pins
|
|
98
|
+
* and the search each work both ways (`value`, `pinned`, `query`, with
|
|
99
|
+
* their `default…` and `on…Change`).
|
|
100
|
+
*
|
|
101
|
+
* Recording pauses from the context line (`paused`), and an app whose
|
|
102
|
+
* copies are never kept, such as a password manager, shows as a chip
|
|
103
|
+
* (`ignoredApp`). With no clips it says what will show up here, or that
|
|
104
|
+
* the history is paused.
|
|
105
|
+
*
|
|
106
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
|
|
107
|
+
* search across the top with the pause and the chips beside it, then a
|
|
108
|
+
* master and detail split. On the left every clip, not three, as a row of
|
|
109
|
+
* two lines: its swatch, thumbnail or glyph on a tile, its text (a link's
|
|
110
|
+
* page title), and where and when it was copied, pinned ones first. On the
|
|
111
|
+
* right, past a hairline and held in view as the list scrolls, the
|
|
112
|
+
* selected clip in full: the whole text over up to eight lines, a link's
|
|
113
|
+
* title with its whole address, an image or a color large, a file on a
|
|
114
|
+
* tile; under it its kind, its length in words and characters, the time
|
|
115
|
+
* it was copied, and Pin, Delete and Copy. The keys work as in the fit
|
|
116
|
+
* layout.
|
|
117
|
+
*
|
|
118
|
+
* `ClipboardHistory.Leading` and `ClipboardHistory.Trailing` show the
|
|
119
|
+
* glyph and the count of new clips in the compact island's wings, and
|
|
120
|
+
* `ClipboardHistory.Copied` is the flash when something is copied.
|
|
121
|
+
*
|
|
122
|
+
* @example {@include ./examples.mdx}
|
|
123
|
+
*/
|
|
124
|
+
declare const ClipboardHistory2: (({ clips, value: valueProp, defaultValue, onValueChange, pinned: pinnedProp, defaultPinned, onPinnedChange, query: queryProp, defaultQuery, onQueryChange, paused: pausedProp, defaultPaused, onPausedChange, ignoredApp, onCopy, onDelete, now: nowProp, layout, size, className }: ClipboardHistoryProps2) => Element_12xgc) & {
|
|
125
|
+
Leading: typeof ClipboardHistoryLeading2;
|
|
126
|
+
Trailing: typeof ClipboardHistoryTrailing2;
|
|
127
|
+
Copied: typeof ClipboardHistoryCopied2;
|
|
128
|
+
};
|
|
129
|
+
export { ClipboardClipKind2, ClipboardClip2, ClipboardHistoryProps2, ClipboardHistoryLeading2, ClipboardHistoryTrailing2, ClipboardHistoryCopied2, ClipboardHistory2 };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { WidgetLayout2 } from "./chunk-42wab62s.js";
|
|
2
|
+
import { Artwork2 } from "./chunk-gejenfap.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { JSX as JSX_1kxb } from "react";
|
|
5
|
+
type NowPlayingOutput2 = "built-in" | "headphones" | "speaker" | "airplay";
|
|
6
|
+
type NowPlayingRepeat2 = "off" | "all" | "one";
|
|
7
|
+
interface NowPlayingTrack2 {
|
|
8
|
+
/** What tells two tracks apart; defaults to the title, artist and album. */
|
|
9
|
+
id?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
artist?: string;
|
|
12
|
+
album?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The artwork: an image URL, or any element. `null` when the track has
|
|
15
|
+
* none (the placeholder shows); left out while it isn't known yet, which
|
|
16
|
+
* keeps the last picture up.
|
|
17
|
+
*/
|
|
18
|
+
artwork?: Artwork2 | null;
|
|
19
|
+
/** The color the artwork leans to, any CSS color: it tints the glow, the bars and the toggles. Read from an image URL when left out. */
|
|
20
|
+
tint?: string;
|
|
21
|
+
/** The app it plays in. */
|
|
22
|
+
source?: string;
|
|
23
|
+
/** Where it plays: a device's name. */
|
|
24
|
+
output?: string;
|
|
25
|
+
/** What kind of device `output` is, for its glyph. Defaults to `'built-in'`. */
|
|
26
|
+
outputKind?: NowPlayingOutput2;
|
|
27
|
+
/** The track's length, in seconds; `0` for a stream, which hides the scrubber. */
|
|
28
|
+
duration: number;
|
|
29
|
+
/** Where playback is, in seconds. */
|
|
30
|
+
position: number;
|
|
31
|
+
}
|
|
32
|
+
interface NowPlayingProps2 {
|
|
33
|
+
/** What plays; without one the player says nothing is playing. */
|
|
34
|
+
track?: NowPlayingTrack2 | null;
|
|
35
|
+
/** It plays (controlled). */
|
|
36
|
+
playing?: boolean;
|
|
37
|
+
/** It plays at first (uncontrolled). Defaults to `true`. */
|
|
38
|
+
defaultPlaying?: boolean;
|
|
39
|
+
/** Called with the new state when play / pause is pressed. */
|
|
40
|
+
onPlayingChange?: (playing: boolean) => void;
|
|
41
|
+
/** Called when the previous button is pressed. */
|
|
42
|
+
onPrevious?: () => void;
|
|
43
|
+
/** Called when the next button is pressed. */
|
|
44
|
+
onNext?: () => void;
|
|
45
|
+
/** Called with the position to seek to, once, when a drag on the scrubber ends. */
|
|
46
|
+
onSeek?: (seconds: number) => void;
|
|
47
|
+
/** Shuffle is on (controlled). The toggle shows when this, `defaultShuffle` or `onShuffleChange` is given. */
|
|
48
|
+
shuffle?: boolean;
|
|
49
|
+
/** Shuffle is on at first (uncontrolled). */
|
|
50
|
+
defaultShuffle?: boolean;
|
|
51
|
+
/** Called with the new state when shuffle is pressed. */
|
|
52
|
+
onShuffleChange?: (shuffle: boolean) => void;
|
|
53
|
+
/** The repeat mode (controlled): a press steps off → all → one. Shows like `shuffle`. */
|
|
54
|
+
repeat?: NowPlayingRepeat2;
|
|
55
|
+
/** The repeat mode at first (uncontrolled). */
|
|
56
|
+
defaultRepeat?: NowPlayingRepeat2;
|
|
57
|
+
/** Called with the next mode when repeat is pressed. */
|
|
58
|
+
onRepeatChange?: (repeat: NowPlayingRepeat2) => void;
|
|
59
|
+
/** The track is in the library (controlled). Shows like `shuffle`. */
|
|
60
|
+
liked?: boolean;
|
|
61
|
+
/** The track is in the library at first (uncontrolled). */
|
|
62
|
+
defaultLiked?: boolean;
|
|
63
|
+
/** Called with the new state when the heart is pressed. */
|
|
64
|
+
onLikedChange?: (liked: boolean) => void;
|
|
65
|
+
/** The empty state's line. Defaults to `'Play something in Music, Spotify or a browser and it shows up here.'`. */
|
|
66
|
+
emptyDescription?: ReactNode;
|
|
67
|
+
/** The empty state's way forward, such as a Button that opens a player. */
|
|
68
|
+
emptyActions?: ReactNode;
|
|
69
|
+
/** `tall` is the open island's tall snap: the artwork large, the title on the display role, a full-width scrubber and the transport under it, and where it plays from and to as rows. Defaults to `'fit'`. */
|
|
70
|
+
layout?: WidgetLayout2;
|
|
71
|
+
/** Classes for the root, which fills its container. */
|
|
72
|
+
className?: string;
|
|
73
|
+
}
|
|
74
|
+
type TrackIdentity = Pick<NowPlayingTrack2, "id" | "title" | "artist" | "album" | "artwork" | "tint">;
|
|
75
|
+
interface ArtworkProps {
|
|
76
|
+
/** The track whose artwork it shows; without one, the placeholder. */
|
|
77
|
+
track?: TrackIdentity | null;
|
|
78
|
+
/** The placeholder note's size in px. Defaults to `14`. */
|
|
79
|
+
glyph?: number;
|
|
80
|
+
/** Classes for the tile: its size and radius. */
|
|
81
|
+
className?: string;
|
|
82
|
+
}
|
|
83
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
84
|
+
/**
|
|
85
|
+
* A track's artwork in a tile that never blinks: the last good picture stays
|
|
86
|
+
* while the next one loads or an update comes without one, the next
|
|
87
|
+
* crossfades in over it, and only a track without artwork shows the note.
|
|
88
|
+
*/
|
|
89
|
+
declare function NowPlayingArtwork2({ track, glyph, className }: ArtworkProps): Element_12xgc;
|
|
90
|
+
interface PartProps {
|
|
91
|
+
/** What plays. */
|
|
92
|
+
track?: TrackIdentity | null;
|
|
93
|
+
/** It plays: the bars dance. Defaults to `true`. */
|
|
94
|
+
playing?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/** The compact island's left wing: the artwork, small. */
|
|
97
|
+
declare function NowPlayingLeading2({ track }: Pick<PartProps, "track">): Element_12xgc;
|
|
98
|
+
/** The compact island's right wing: the level bars in the artwork's tint, low while paused. */
|
|
99
|
+
declare function NowPlayingTrailing2(props: PartProps): Element_12xgc;
|
|
100
|
+
/** The split island's bubble: the artwork as a disc. */
|
|
101
|
+
declare function NowPlayingMinimal2({ track }: Pick<PartProps, "track">): Element_12xgc;
|
|
102
|
+
/** The island's flash when the track changes: its artwork, title and artist, and the tinted bars. */
|
|
103
|
+
declare function NowPlayingFlash2({ track, playing }: {
|
|
104
|
+
track: NowPlayingTrack2;
|
|
105
|
+
playing?: boolean;
|
|
106
|
+
}): Element_12xgc;
|
|
107
|
+
/**
|
|
108
|
+
* What's playing, as a notch app's open island shows it: the artwork, the
|
|
109
|
+
* title and artist, where the track is, the transport, and where it plays.
|
|
110
|
+
*
|
|
111
|
+
* The artwork is the hero's picture, as tall as the widget, with a soft glow
|
|
112
|
+
* of its tint behind it (`track.tint`, else read from an image URL); the
|
|
113
|
+
* equalizer and any toggle that is on take the same tint, so the color
|
|
114
|
+
* comes from the music. The artwork never blinks: the last good picture
|
|
115
|
+
* stays up while a new one loads or an update arrives without one, the next
|
|
116
|
+
* crossfades in over it, and only a track whose `artwork` is `null` shows
|
|
117
|
+
* the placeholder note.
|
|
118
|
+
*
|
|
119
|
+
* Under the title and artist (with the album) runs the kit's MediaScrubber,
|
|
120
|
+
* which ticks on by itself while playing and seeks once when a drag ends
|
|
121
|
+
* (`onSeek`). The transport sits in the middle of the last row, the source
|
|
122
|
+
* app and the output device on its left, and shuffle, repeat and the heart
|
|
123
|
+
* on its right, each shown when its value or handler is given. Play / pause
|
|
124
|
+
* runs through `playing` / `onPlayingChange`, or is kept here from
|
|
125
|
+
* `defaultPlaying`; the toggles are the same. Without a track it says
|
|
126
|
+
* nothing is playing and how to change that.
|
|
127
|
+
*
|
|
128
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
|
|
129
|
+
* artwork large beside the source, the title on the display role, the
|
|
130
|
+
* artist and the album on lines of their own; then the scrubber across the
|
|
131
|
+
* whole width with the transport and the toggles in one row under it; then
|
|
132
|
+
* where it plays from and to, the app and the output device, as rows.
|
|
133
|
+
*
|
|
134
|
+
* The other forms are parts: `NowPlaying.Leading` and `NowPlaying.Trailing`
|
|
135
|
+
* for the compact island's wings (the artwork, and the tinted Equalizer that
|
|
136
|
+
* settles when paused), `NowPlaying.Minimal` for the split island's bubble
|
|
137
|
+
* (the artwork as a disc), `NowPlaying.Flash` for the flash on a track
|
|
138
|
+
* change and `NowPlaying.Artwork` for the tile on its own.
|
|
139
|
+
*
|
|
140
|
+
* @example {@include ./examples.mdx}
|
|
141
|
+
*/
|
|
142
|
+
declare const NowPlaying2: (({ track, playing: playingProp, defaultPlaying, onPlayingChange, onPrevious, onNext, onSeek, shuffle: shuffleProp, defaultShuffle, onShuffleChange, repeat: repeatProp, defaultRepeat, onRepeatChange, liked: likedProp, defaultLiked, onLikedChange, emptyDescription, emptyActions, layout, className }: NowPlayingProps2) => Element_12xgc) & {
|
|
143
|
+
Artwork2: typeof NowPlayingArtwork2;
|
|
144
|
+
Leading: typeof NowPlayingLeading2;
|
|
145
|
+
Trailing: typeof NowPlayingTrailing2;
|
|
146
|
+
Minimal: typeof NowPlayingMinimal2;
|
|
147
|
+
Flash: typeof NowPlayingFlash2;
|
|
148
|
+
};
|
|
149
|
+
export { NowPlayingOutput2, NowPlayingRepeat2, NowPlayingTrack2, NowPlayingProps2, NowPlayingArtwork2, NowPlayingLeading2, NowPlayingTrailing2, NowPlayingMinimal2, NowPlayingFlash2, NowPlaying2 };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { WidgetLayout2 } from "./chunk-42wab62s.js";
|
|
2
|
+
import { JSX as JSX_1kxb } from "react";
|
|
3
|
+
type WeatherCondition2 = "clear" | "partly-cloudy" | "cloudy" | "fog" | "drizzle" | "rain" | "heavy-rain" | "sleet" | "snow" | "thunderstorm";
|
|
4
|
+
type WeatherUnit2 = "celsius" | "fahrenheit";
|
|
5
|
+
type WeatherAccess2 = "granted" | "undetermined" | "denied";
|
|
6
|
+
type WeatherStatus2 = "ready" | "loading" | "error" | "offline";
|
|
7
|
+
/** The weather now: Open-Meteo's `current` block. Temperatures in °C, wind in km/h. */
|
|
8
|
+
interface WeatherNow2 {
|
|
9
|
+
/** When it was read, in epoch ms: the "updated" line counts from it. */
|
|
10
|
+
time: number;
|
|
11
|
+
temperature: number;
|
|
12
|
+
/** How warm it feels, in °C: `apparent_temperature`. */
|
|
13
|
+
apparent?: number;
|
|
14
|
+
condition: WeatherCondition2;
|
|
15
|
+
/** Daylight, for the sun or the moon in the glyph: `is_day`. Defaults to `true`. */
|
|
16
|
+
isDay?: boolean;
|
|
17
|
+
/** Wind speed in km/h. */
|
|
18
|
+
wind?: number;
|
|
19
|
+
/** Relative humidity, 0–100. */
|
|
20
|
+
humidity?: number;
|
|
21
|
+
/** The UV index. */
|
|
22
|
+
uv?: number;
|
|
23
|
+
}
|
|
24
|
+
/** One hour of the forecast: Open-Meteo's `hourly` arrays, zipped. */
|
|
25
|
+
interface WeatherHour2 {
|
|
26
|
+
/** The hour's start, in epoch ms. */
|
|
27
|
+
time: number;
|
|
28
|
+
temperature: number;
|
|
29
|
+
condition: WeatherCondition2;
|
|
30
|
+
/** Defaults to `true`. */
|
|
31
|
+
isDay?: boolean;
|
|
32
|
+
/** The chance of rain or snow, 0–100: `precipitation_probability`. */
|
|
33
|
+
precipitation?: number;
|
|
34
|
+
}
|
|
35
|
+
/** One day of the forecast: Open-Meteo's `daily` arrays, zipped. */
|
|
36
|
+
interface WeatherDay2 {
|
|
37
|
+
/** The day's start, in epoch ms. */
|
|
38
|
+
date: number;
|
|
39
|
+
condition: WeatherCondition2;
|
|
40
|
+
high: number;
|
|
41
|
+
low: number;
|
|
42
|
+
/** The day's highest chance of rain or snow, 0–100: `precipitation_probability_max`. */
|
|
43
|
+
precipitation?: number;
|
|
44
|
+
/** When the sun rises, in epoch ms: `sunrise`. The tall layout lists today's. */
|
|
45
|
+
sunrise?: number;
|
|
46
|
+
/** When the sun sets, in epoch ms: `sunset`. The tall layout lists today's. */
|
|
47
|
+
sunset?: number;
|
|
48
|
+
}
|
|
49
|
+
interface WeatherProps2 {
|
|
50
|
+
/** Where the forecast is for: a city's name. */
|
|
51
|
+
location?: string;
|
|
52
|
+
/** The weather now; without it the widget shows its state (`status`, `access`) or loads. */
|
|
53
|
+
current?: WeatherNow2 | null;
|
|
54
|
+
/** The hourly forecast, in any order: the hours from now on fill the strip. */
|
|
55
|
+
hours?: WeatherHour2[];
|
|
56
|
+
/** The daily forecast, today first: today gives the high and low, the next day the Tomorrow row. */
|
|
57
|
+
days?: WeatherDay2[];
|
|
58
|
+
/** Shows temperatures in this unit (and wind in mph for `'fahrenheit'`); the data stays in °C and km/h. Defaults to `'celsius'`. */
|
|
59
|
+
unit?: WeatherUnit2;
|
|
60
|
+
/** Whether the location may be read: undetermined asks, denied points to the system's settings. Defaults to `'granted'`. */
|
|
61
|
+
access?: WeatherAccess2;
|
|
62
|
+
/** How the last fetch went. `loading` shows placeholders until there is a `current`; `error` and `offline` keep the last forecast up and say so, or explain without one. Defaults to `'ready'`. */
|
|
63
|
+
status?: WeatherStatus2;
|
|
64
|
+
/** The moment the forecast is read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
65
|
+
now?: number;
|
|
66
|
+
/** Formats the hours. Defaults to the browser's locale. */
|
|
67
|
+
locale?: Intl.LocalesArgument;
|
|
68
|
+
/** Called by the refresh button, and by Try again after an error; without it neither shows. */
|
|
69
|
+
onRefresh?: () => void;
|
|
70
|
+
/** Called by Allow location while access is undetermined. */
|
|
71
|
+
onRequestAccess?: () => void;
|
|
72
|
+
/** Called by Open System Settings while access is denied. */
|
|
73
|
+
onOpenSettings?: () => void;
|
|
74
|
+
/** `tall` is the open island's tall snap: the hero larger, the next 24 hours as a scrolling strip with a temperature curve and the chance of rain, the week as rows with a range bar, and the wind, humidity, UV and the sun's times as details. Defaults to `'fit'`. */
|
|
75
|
+
layout?: WidgetLayout2;
|
|
76
|
+
/** Classes for the root, which fills its container. */
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Open-Meteo's `weather_code` (WMO 4677) as a condition.
|
|
81
|
+
*
|
|
82
|
+
* @example conditionFromCode(61) // 'rain'
|
|
83
|
+
*/
|
|
84
|
+
declare function conditionFromCode2(code: number): WeatherCondition2;
|
|
85
|
+
interface PartProps {
|
|
86
|
+
/** The weather now. */
|
|
87
|
+
current: WeatherNow2;
|
|
88
|
+
}
|
|
89
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
90
|
+
/** The compact island's left wing: the condition's glyph in its hue. */
|
|
91
|
+
declare function WeatherLeading2({ current }: PartProps): Element_12xgc;
|
|
92
|
+
/** The compact island's right wing: the temperature. */
|
|
93
|
+
declare function WeatherTrailing2({ current, unit }: PartProps & {
|
|
94
|
+
unit?: WeatherUnit2;
|
|
95
|
+
}): Element_12xgc;
|
|
96
|
+
/** The split island's bubble: the condition's glyph on a disc. */
|
|
97
|
+
declare function WeatherMinimal2({ current }: PartProps): Element_12xgc;
|
|
98
|
+
type WeatherAlertSeverity2 = "notice" | "warning" | "severe";
|
|
99
|
+
interface WeatherAlertProps2 {
|
|
100
|
+
/** What is coming: its glyph, and the title's noun. */
|
|
101
|
+
condition: WeatherCondition2;
|
|
102
|
+
/** When it starts, in epoch ms: the title counts down to it, `Rain in 15 min`, on each minute. */
|
|
103
|
+
startsAt?: number;
|
|
104
|
+
/** The title in place of the countdown, for a warning: `Thunderstorm warning`. */
|
|
105
|
+
title?: string;
|
|
106
|
+
/** One line more: how long, how much. */
|
|
107
|
+
caption?: string;
|
|
108
|
+
/** How serious: the tile's hue, info, warning or error. Defaults to `'notice'`. */
|
|
109
|
+
severity?: WeatherAlertSeverity2;
|
|
110
|
+
/** The button's label. Defaults to `'Details'`. */
|
|
111
|
+
actionLabel?: string;
|
|
112
|
+
/** Called by the button; without it the button hides. */
|
|
113
|
+
onAction?: () => void;
|
|
114
|
+
}
|
|
115
|
+
/** The island's flash before the weather turns: `Rain in 15 min`, or a warning, with one action. */
|
|
116
|
+
declare function WeatherAlert2({ condition, startsAt, title, caption, severity, actionLabel, onAction }: WeatherAlertProps2): Element_12xgc;
|
|
117
|
+
/**
|
|
118
|
+
* A notch app's weather: the temperature now as the hero, the next hours
|
|
119
|
+
* and tomorrow beside it.
|
|
120
|
+
*
|
|
121
|
+
* The hero is the temperature in display type after the condition's glyph,
|
|
122
|
+
* in its hue (the sun's amber, rain's blue, the rest plain); under it the
|
|
123
|
+
* condition, how warm it feels and, when the next hours turn wet, around
|
|
124
|
+
* when. The meta line carries today's high and low, the chance of rain,
|
|
125
|
+
* the wind, and the humidity and UV index when given, the last giving way
|
|
126
|
+
* first. The header names the place and how long ago the forecast was
|
|
127
|
+
* read, with a refresh button when `onRefresh` is given. Beside it, past a
|
|
128
|
+
* hairline, the next six hours as a strip of hour, glyph and temperature,
|
|
129
|
+
* with the chance of rain under each once any hour is wet, then tomorrow as
|
|
130
|
+
* a row.
|
|
131
|
+
*
|
|
132
|
+
* The data is Open-Meteo's shape, zipped into objects: `current`, `hours`
|
|
133
|
+
* and `days` (today first), in °C and km/h; `unit="fahrenheit"` converts
|
|
134
|
+
* what it shows, wind in mph. `conditionFromCode` turns a WMO weather code
|
|
135
|
+
* into a condition.
|
|
136
|
+
*
|
|
137
|
+
* Before the location may be read it asks for it (`access="undetermined"`),
|
|
138
|
+
* and when access is off it says where to turn it on (`"denied"`). The
|
|
139
|
+
* first fetch shows placeholders (`status="loading"`); a failed one says so
|
|
140
|
+
* with Try again (`"error"`), and offline it says it will update when back
|
|
141
|
+
* (`"offline"`). Once there is a forecast, those keep it up and say so in
|
|
142
|
+
* the header instead.
|
|
143
|
+
*
|
|
144
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
|
|
145
|
+
* hero larger, the condition, how warm it feels and today's high and low
|
|
146
|
+
* beside it; then the next 24 hours as a strip that scrolls sideways, each
|
|
147
|
+
* hour's glyph and temperature with the temperature's curve running through
|
|
148
|
+
* them and the chance of rain under each once any hour is wet; then, split
|
|
149
|
+
* by a hairline, the week as rows of day, glyph, chance of rain and the low
|
|
150
|
+
* and high on a bar spanning the week's range, and beside it the details:
|
|
151
|
+
* how warm it feels, the wind, the humidity, the UV index in words and
|
|
152
|
+
* today's sunrise and sunset (`sunrise` / `sunset` on the day).
|
|
153
|
+
*
|
|
154
|
+
* The other forms are parts: `Weather.Leading` and `Weather.Trailing` for
|
|
155
|
+
* the compact island's wings (the glyph and the temperature),
|
|
156
|
+
* `Weather.Minimal`, the glyph on a disc, for the split island's bubble,
|
|
157
|
+
* and `Weather.Alert`, the flash before rain or a warning. Nothing ticks but
|
|
158
|
+
* the minute of the "updated" line.
|
|
159
|
+
*
|
|
160
|
+
* @example {@include ./examples.mdx}
|
|
161
|
+
*/
|
|
162
|
+
declare const Weather2: (({ location, current, hours, days, unit, access, status, now: nowProp, locale, onRefresh, onRequestAccess, onOpenSettings, layout, className }: WeatherProps2) => Element_12xgc) & {
|
|
163
|
+
Leading: typeof WeatherLeading2;
|
|
164
|
+
Trailing: typeof WeatherTrailing2;
|
|
165
|
+
Minimal: typeof WeatherMinimal2;
|
|
166
|
+
Alert: typeof WeatherAlert2;
|
|
167
|
+
};
|
|
168
|
+
export { WeatherCondition2, WeatherUnit2, WeatherAccess2, WeatherStatus2, WeatherNow2, WeatherHour2, WeatherDay2, WeatherProps2, conditionFromCode2, WeatherLeading2, WeatherTrailing2, WeatherMinimal2, WeatherAlertSeverity2, WeatherAlertProps2, WeatherAlert2, Weather2 };
|
|
@@ -10,9 +10,9 @@ interface IslandFlashProps2 {
|
|
|
10
10
|
icon?: ReactNode;
|
|
11
11
|
/** The hue of the icon and the `value`. Defaults to `'default'`. */
|
|
12
12
|
tone?: IslandFlashTone2;
|
|
13
|
-
/** A figure at the end, in the tone's hue: `
|
|
13
|
+
/** A figure at the end, in the tone's hue: `15 min`, a level. */
|
|
14
14
|
value?: ReactNode;
|
|
15
|
-
/** Content after it, such as
|
|
15
|
+
/** Content after it, such as an Equalizer. */
|
|
16
16
|
trailing?: ReactNode;
|
|
17
17
|
/** One control at the far end, such as a ghost Button. */
|
|
18
18
|
action?: ReactNode;
|
|
@@ -27,7 +27,7 @@ type Element_12xgc = JSX_1kxb["Element"];
|
|
|
27
27
|
* It lays out one row the height of the island's flash: the icon in a fixed
|
|
28
28
|
* square, the title and caption truncating beside it, then the `value`, any
|
|
29
29
|
* `trailing` glyph and an `action`. The icon and the value take the tone's
|
|
30
|
-
* status hue (a
|
|
30
|
+
* status hue (a focus round done in success, rain coming in warning); everything else
|
|
31
31
|
* keeps the two text colors. Pass it as the Island's `flash`.
|
|
32
32
|
*
|
|
33
33
|
* @example {@include ./examples.mdx}
|