@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
package/dist/styles.css
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* @justanarthur/modo-ui-notch: load after @justanarthur/modo-ui/styles.css. */
|
|
2
|
+
@layer properties, default;
|
|
3
|
+
/* layer: properties */
|
|
4
|
+
@layer properties{
|
|
5
|
+
@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
6
|
+
@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid;}
|
|
7
|
+
@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
8
|
+
@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
9
|
+
@property --un-inset-ring-color{syntax:"*";inherits:false;}
|
|
10
|
+
@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
|
|
11
|
+
@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
|
|
12
|
+
@property --un-inset-shadow-color{syntax:"*";inherits:false;}
|
|
13
|
+
@property --un-ring-color{syntax:"*";inherits:false;}
|
|
14
|
+
@property --un-ring-inset{syntax:"*";inherits:false;}
|
|
15
|
+
@property --un-ring-offset-color{syntax:"*";inherits:false;}
|
|
16
|
+
@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
|
|
17
|
+
@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0px;}
|
|
18
|
+
@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
|
|
19
|
+
@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000;}
|
|
20
|
+
@property --un-shadow-color{syntax:"*";inherits:false;}
|
|
21
|
+
@property --un-ring-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
22
|
+
@property --un-ease{syntax:"*";inherits:false;}
|
|
23
|
+
@property --un-fill-opacity{syntax:"<percentage>";inherits:false;initial-value:100%;}
|
|
24
|
+
@property --un-blur{syntax:"*";inherits:false;}
|
|
25
|
+
@property --un-brightness{syntax:"*";inherits:false;}
|
|
26
|
+
@property --un-contrast{syntax:"*";inherits:false;}
|
|
27
|
+
@property --un-drop-shadow{syntax:"*";inherits:false;}
|
|
28
|
+
@property --un-grayscale{syntax:"*";inherits:false;}
|
|
29
|
+
@property --un-hue-rotate{syntax:"*";inherits:false;}
|
|
30
|
+
@property --un-invert{syntax:"*";inherits:false;}
|
|
31
|
+
@property --un-saturate{syntax:"*";inherits:false;}
|
|
32
|
+
@property --un-sepia{syntax:"*";inherits:false;}
|
|
33
|
+
@property --un-numeric-figure{syntax:"*";inherits:false;}
|
|
34
|
+
@property --un-numeric-fraction{syntax:"*";inherits:false;}
|
|
35
|
+
@property --un-numeric-spacing{syntax:"*";inherits:false;}
|
|
36
|
+
@property --un-ordinal{syntax:"*";inherits:false;}
|
|
37
|
+
@property --un-slashed-zero{syntax:"*";inherits:false;}
|
|
38
|
+
}
|
|
39
|
+
/* layer: default */
|
|
40
|
+
@layer default{
|
|
41
|
+
.text-brand{color:color-mix(in srgb, var(--brand) var(--un-text-opacity), transparent);}
|
|
42
|
+
.text-foreground{color:color-mix(in srgb, var(--foreground) var(--un-text-opacity), transparent);}
|
|
43
|
+
.text-muted-foreground{color:color-mix(in srgb, var(--muted-foreground) var(--un-text-opacity), transparent);}
|
|
44
|
+
.text-status-error{color:color-mix(in srgb, var(--status-error) var(--un-text-opacity), transparent);}
|
|
45
|
+
.text-status-info{color:color-mix(in srgb, var(--status-info) var(--un-text-opacity), transparent);}
|
|
46
|
+
.text-status-success{color:color-mix(in srgb, var(--status-success) var(--un-text-opacity), transparent);}
|
|
47
|
+
.text-status-warning{color:color-mix(in srgb, var(--status-warning) var(--un-text-opacity), transparent);}
|
|
48
|
+
.tab{-moz-tab-size:4;-o-tab-size:4;tab-size:4;}
|
|
49
|
+
.m-0{margin:calc(var(--spacing) * 0);}
|
|
50
|
+
.m-auto{margin:auto;}
|
|
51
|
+
.-mx-3{margin-inline:calc(var(--spacing) * -3);}
|
|
52
|
+
.mx-auto{margin-inline:auto;}
|
|
53
|
+
.-mr-3{margin-right:calc(var(--spacing) * -3);}
|
|
54
|
+
.mb-0{margin-bottom:calc(var(--spacing) * 0);}
|
|
55
|
+
.mt-auto{margin-top:auto;}
|
|
56
|
+
.p-0{padding:calc(var(--spacing) * 0);}
|
|
57
|
+
.p-0\.5{padding:calc(var(--spacing) * 0.5);}
|
|
58
|
+
.p-1\.5{padding:calc(var(--spacing) * 1.5);}
|
|
59
|
+
.p-3{padding:calc(var(--spacing) * 3);}
|
|
60
|
+
.p-8{padding:calc(var(--spacing) * 8);}
|
|
61
|
+
.px{padding-inline:calc(var(--spacing) * 4);}
|
|
62
|
+
.px-1\.5{padding-inline:calc(var(--spacing) * 1.5);}
|
|
63
|
+
.px-3{padding-inline:calc(var(--spacing) * 3);}
|
|
64
|
+
.px-5{padding-inline:calc(var(--spacing) * 5);}
|
|
65
|
+
.py-1{padding-block:calc(var(--spacing) * 1);}
|
|
66
|
+
.pb-1{padding-bottom:calc(var(--spacing) * 1);}
|
|
67
|
+
.pb-3{padding-bottom:calc(var(--spacing) * 3);}
|
|
68
|
+
.pr-3{padding-right:calc(var(--spacing) * 3);}
|
|
69
|
+
.text-center{text-align:center;}
|
|
70
|
+
.text-right{text-align:right;}
|
|
71
|
+
.outline{outline-style:var(--un-outline-style);outline-width:1px;}
|
|
72
|
+
.outline-none{--un-outline-style:none;outline-style:none;}
|
|
73
|
+
.list-none{list-style-type:none;}
|
|
74
|
+
.border{border-width:1px;}
|
|
75
|
+
.border-brand{border-color:color-mix(in srgb, var(--brand) var(--un-border-opacity), transparent);}
|
|
76
|
+
.border-transparent{border-color:transparent;}
|
|
77
|
+
.rounded-2xl{border-radius:var(--radius-2xl);}
|
|
78
|
+
.rounded-full{border-radius:calc(infinity * 1px);}
|
|
79
|
+
.rounded-lg{border-radius:var(--radius-lg);}
|
|
80
|
+
.rounded-md{border-radius:var(--radius-md);}
|
|
81
|
+
.rounded-xl{border-radius:var(--radius-xl);}
|
|
82
|
+
.rounded-r-full{border-top-right-radius:calc(infinity * 1px);border-bottom-right-radius:calc(infinity * 1px);}
|
|
83
|
+
.border-dashed{--un-border-style:dashed;border-style:dashed;}
|
|
84
|
+
.bg-active{background-color:color-mix(in srgb, var(--active) var(--un-bg-opacity), transparent);}
|
|
85
|
+
.bg-foreground{background-color:color-mix(in srgb, var(--foreground) var(--un-bg-opacity), transparent);}
|
|
86
|
+
.bg-ink{background-color:color-mix(in srgb, var(--ink) var(--un-bg-opacity), transparent);}
|
|
87
|
+
.bg-status-error{background-color:color-mix(in srgb, var(--status-error) var(--un-bg-opacity), transparent);}
|
|
88
|
+
.bg-status-success{background-color:color-mix(in srgb, var(--status-success) var(--un-bg-opacity), transparent);}
|
|
89
|
+
.bg-status-warning{background-color:color-mix(in srgb, var(--status-warning) var(--un-bg-opacity), transparent);}
|
|
90
|
+
.bg-surface-2{background-color:color-mix(in srgb, var(--surface-2) var(--un-bg-opacity), transparent);}
|
|
91
|
+
.bg-surface-3{background-color:color-mix(in srgb, var(--surface-3) var(--un-bg-opacity), transparent);}
|
|
92
|
+
.bg-transparent{background-color:transparent;}
|
|
93
|
+
.\[\&\>div\]\:flex>div,
|
|
94
|
+
.flex{display:flex;}
|
|
95
|
+
.inline-flex{display:inline-flex;}
|
|
96
|
+
.\[\&\>\*\]\:flex-1>*,
|
|
97
|
+
.flex-1{flex:1 1 0%;}
|
|
98
|
+
.shrink-\[100\]{flex-shrink:100;}
|
|
99
|
+
.shrink-0{flex-shrink:0;}
|
|
100
|
+
.grow{flex-grow:1;}
|
|
101
|
+
.\[\&\>div\]\:flex-col>div,
|
|
102
|
+
.flex-col{flex-direction:column;}
|
|
103
|
+
.gap-0\.5{gap:calc(var(--spacing) * 0.5);}
|
|
104
|
+
.gap-1{gap:calc(var(--spacing) * 1);}
|
|
105
|
+
.gap-1\.5{gap:calc(var(--spacing) * 1.5);}
|
|
106
|
+
.gap-2{gap:calc(var(--spacing) * 2);}
|
|
107
|
+
.gap-3{gap:calc(var(--spacing) * 3);}
|
|
108
|
+
.gap-4{gap:calc(var(--spacing) * 4);}
|
|
109
|
+
.gap-5{gap:calc(var(--spacing) * 5);}
|
|
110
|
+
.gap-8{gap:calc(var(--spacing) * 8);}
|
|
111
|
+
.gap-px{gap:1px;}
|
|
112
|
+
.gap-x-8{column-gap:calc(var(--spacing) * 8);}
|
|
113
|
+
.grid{display:grid;}
|
|
114
|
+
.grid-cols-\[1fr_auto_1fr\]{grid-template-columns:1fr auto 1fr;}
|
|
115
|
+
.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr));}
|
|
116
|
+
.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr));}
|
|
117
|
+
.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr));}
|
|
118
|
+
.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10);}
|
|
119
|
+
.size-14{width:calc(var(--spacing) * 14);height:calc(var(--spacing) * 14);}
|
|
120
|
+
.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16);}
|
|
121
|
+
.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2);}
|
|
122
|
+
.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5);}
|
|
123
|
+
.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3);}
|
|
124
|
+
.size-30{width:calc(var(--spacing) * 30);height:calc(var(--spacing) * 30);}
|
|
125
|
+
.size-5\.5{width:calc(var(--spacing) * 5.5);height:calc(var(--spacing) * 5.5);}
|
|
126
|
+
.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6);}
|
|
127
|
+
.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8);}
|
|
128
|
+
.size-full{width:100%;height:100%;}
|
|
129
|
+
.\[\&\>div\]\:min-h-full>div,
|
|
130
|
+
.min-h-full{min-height:100%;}
|
|
131
|
+
.h-1\.5{height:calc(var(--spacing) * 1.5);}
|
|
132
|
+
.h-10{height:calc(var(--spacing) * 10);}
|
|
133
|
+
.h-11{height:calc(var(--spacing) * 11);}
|
|
134
|
+
.h-14{height:calc(var(--spacing) * 14);}
|
|
135
|
+
.h-3\.5{height:calc(var(--spacing) * 3.5);}
|
|
136
|
+
.h-5{height:calc(var(--spacing) * 5);}
|
|
137
|
+
.h-6{height:calc(var(--spacing) * 6);}
|
|
138
|
+
.h-7{height:calc(var(--spacing) * 7);}
|
|
139
|
+
.h-9{height:calc(var(--spacing) * 9);}
|
|
140
|
+
.h-auto{height:auto;}
|
|
141
|
+
.h-full{height:100%;}
|
|
142
|
+
.h2{height:calc(var(--spacing) * 2);}
|
|
143
|
+
.h3{height:calc(var(--spacing) * 3);}
|
|
144
|
+
.max-w-160{max-width:calc(var(--spacing) * 160);}
|
|
145
|
+
.min-h-0{min-height:calc(var(--spacing) * 0);}
|
|
146
|
+
.min-w-0{min-width:calc(var(--spacing) * 0);}
|
|
147
|
+
.min-w-full{min-width:100%;}
|
|
148
|
+
.w-0\.5{width:calc(var(--spacing) * 0.5);}
|
|
149
|
+
.w-0\.75{width:calc(var(--spacing) * 0.75);}
|
|
150
|
+
.w-1{width:calc(var(--spacing) * 1);}
|
|
151
|
+
.w-10{width:calc(var(--spacing) * 10);}
|
|
152
|
+
.w-16{width:calc(var(--spacing) * 16);}
|
|
153
|
+
.w-20{width:calc(var(--spacing) * 20);}
|
|
154
|
+
.w-7{width:calc(var(--spacing) * 7);}
|
|
155
|
+
.w-7\.5{width:calc(var(--spacing) * 7.5);}
|
|
156
|
+
.w-9{width:calc(var(--spacing) * 9);}
|
|
157
|
+
.w-full{width:100%;}
|
|
158
|
+
.w-max{width:max-content;}
|
|
159
|
+
.block{display:block;}
|
|
160
|
+
.hidden{display:none;}
|
|
161
|
+
.collapse{visibility:collapse;}
|
|
162
|
+
.cursor-pointer{cursor:pointer;}
|
|
163
|
+
.pointer-events-auto{pointer-events:auto;}
|
|
164
|
+
.pointer-events-none{pointer-events:none;}
|
|
165
|
+
.whitespace-nowrap{white-space:nowrap;}
|
|
166
|
+
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
|
167
|
+
.ring{--un-ring-shadow:var(--un-ring-inset,) 0 0 0 calc(1px + var(--un-ring-offset-width)) var(--un-ring-color, currentColor);box-shadow:var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);}
|
|
168
|
+
.focus-visible\:ring-1:focus-visible{--un-ring-shadow:var(--un-ring-inset,) 0 0 0 calc(1px + var(--un-ring-offset-width)) var(--un-ring-color, currentColor);box-shadow:var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);}
|
|
169
|
+
.focus-visible\:ring-focus-ring:focus-visible{--un-ring-color:color-mix(in srgb, var(--focus-ring) var(--un-ring-opacity), transparent);}
|
|
170
|
+
.origin-left{transform-origin:left;}
|
|
171
|
+
.transform{transform:var(--un-rotate-x) var(--un-rotate-y) var(--un-rotate-z) var(--un-skew-x) var(--un-skew-y);}
|
|
172
|
+
.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--un-gradient-from,--un-gradient-via,--un-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--un-ease, var(--default-transition-timingFunction));transition-duration:var(--un-duration, var(--default-transition-duration));}
|
|
173
|
+
.transition-\[border-color\]{transition-property:border-color;transition-timing-function:var(--un-ease, var(--default-transition-timingFunction));transition-duration:var(--un-duration, var(--default-transition-duration));}
|
|
174
|
+
.transition-\[color\]{transition-property:color;transition-timing-function:var(--un-ease, var(--default-transition-timingFunction));transition-duration:var(--un-duration, var(--default-transition-duration));}
|
|
175
|
+
.transition-\[stroke-width\]{transition-property:stroke-width;transition-timing-function:var(--un-ease, var(--default-transition-timingFunction));transition-duration:var(--un-duration, var(--default-transition-duration));}
|
|
176
|
+
.ease{--un-ease:var(--ease-DEFAULT);transition-timing-function:var(--ease-DEFAULT);}
|
|
177
|
+
.ease-in-out{--un-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out);}
|
|
178
|
+
.\[--scroll-fade-size\:16px\]{--scroll-fade-size:16px;}
|
|
179
|
+
.content-center{align-content:center;}
|
|
180
|
+
.content-start{align-content:flex-start;}
|
|
181
|
+
.items-start{align-items:flex-start;}
|
|
182
|
+
.items-end{align-items:flex-end;}
|
|
183
|
+
.items-center{align-items:center;}
|
|
184
|
+
.items-baseline{align-items:baseline;}
|
|
185
|
+
.inset-0{inset:calc(var(--spacing) * 0);}
|
|
186
|
+
.inset-x-0{inset-inline:calc(var(--spacing) * 0);}
|
|
187
|
+
.inset-y-0{inset-block:calc(var(--spacing) * 0);}
|
|
188
|
+
.bottom-0{bottom:calc(var(--spacing) * 0);}
|
|
189
|
+
.left-0{left:calc(var(--spacing) * 0);}
|
|
190
|
+
.left-1\/2{left:50%;}
|
|
191
|
+
.right-0{right:calc(var(--spacing) * 0);}
|
|
192
|
+
.top-0{top:calc(var(--spacing) * 0);}
|
|
193
|
+
.justify-start{justify-content:flex-start;}
|
|
194
|
+
.justify-center{justify-content:center;}
|
|
195
|
+
.justify-between{justify-content:space-between;}
|
|
196
|
+
.absolute{position:absolute;}
|
|
197
|
+
.relative{position:relative;}
|
|
198
|
+
.z-10{z-index:10;}
|
|
199
|
+
.overflow-hidden{overflow:hidden;}
|
|
200
|
+
.overflow-visible{overflow:visible;}
|
|
201
|
+
.overflow-x-auto{overflow-x:auto;}
|
|
202
|
+
.overflow-y-hidden{overflow-y:hidden;}
|
|
203
|
+
.fill-foreground{fill:color-mix(in srgb, var(--foreground) var(--un-fill-opacity), transparent);}
|
|
204
|
+
.fill-ink{fill:color-mix(in srgb, var(--ink) var(--un-fill-opacity), transparent);}
|
|
205
|
+
.object-cover{object-fit:cover;}
|
|
206
|
+
.blur{--un-blur:blur(8px);filter:var(--un-blur,) var(--un-brightness,) var(--un-contrast,) var(--un-grayscale,) var(--un-hue-rotate,) var(--un-invert,) var(--un-saturate,) var(--un-sepia,) var(--un-drop-shadow,);}
|
|
207
|
+
.filter{filter:var(--un-blur,) var(--un-brightness,) var(--un-contrast,) var(--un-grayscale,) var(--un-hue-rotate,) var(--un-invert,) var(--un-saturate,) var(--un-sepia,) var(--un-drop-shadow,);}
|
|
208
|
+
.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal,) var(--un-slashed-zero,) var(--un-numeric-figure,) var(--un-numeric-spacing,) var(--un-numeric-fraction,);}
|
|
209
|
+
.text-display{font-size:var(--text-display);line-height:var(--leading-display);}
|
|
210
|
+
.text-title{font-size:var(--text-title);line-height:var(--leading-title);}
|
|
211
|
+
.text-subtitle{font-size:var(--text-subtitle);line-height:var(--leading-subtitle);}
|
|
212
|
+
.text-body{font-size:var(--text-body);line-height:var(--leading-body);}
|
|
213
|
+
.text-caption{font-size:var(--text-caption);line-height:var(--leading-caption);}
|
|
214
|
+
.text-micro{font-size:var(--text-micro);line-height:var(--leading-micro);}
|
|
215
|
+
.weight-normal{font-variation-settings:var(--weight-normal);}
|
|
216
|
+
.weight-medium{font-variation-settings:var(--weight-medium);}
|
|
217
|
+
.weight-semibold{font-variation-settings:var(--weight-semibold);}
|
|
218
|
+
.duration-fast{--un-duration:var(--duration-fast);transition-duration:var(--duration-fast);}
|
|
219
|
+
.duration-moderate{--un-duration:var(--duration-moderate);transition-duration:var(--duration-moderate);}
|
|
220
|
+
.rounded-box{border-radius:var(--radius-box);}
|
|
221
|
+
.rounded-glyph{border-radius:var(--radius-glyph);}
|
|
222
|
+
}
|
package/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './blocks/activities/agenda'
|
|
2
|
+
export * from './blocks/activities/now-playing'
|
|
3
|
+
export * from './blocks/activities/shelf'
|
|
4
|
+
export * from './blocks/activities/timer'
|
|
5
|
+
export * from './blocks/app/expanded-island'
|
|
6
|
+
export * from './blocks/app/settings-window'
|
|
7
|
+
export * from './blocks/system/controls'
|
|
8
|
+
export * from './blocks/system/devices'
|
|
9
|
+
export * from './blocks/system/power-alert'
|
|
10
|
+
export * from './blocks/system/system-stats'
|
|
11
|
+
export * from './components/indicators/battery-glyph'
|
|
12
|
+
export * from './components/indicators/countdown'
|
|
13
|
+
export * from './components/indicators/equalizer'
|
|
14
|
+
export * from './components/indicators/media-scrubber'
|
|
15
|
+
export * from './components/island/island'
|
|
16
|
+
export * from './components/island/island-flash'
|
|
17
|
+
export * from './components/island/island-tabs'
|
|
18
|
+
export { formatClock, formatShort, useEdgeClock } from './lib/clock'
|
|
19
|
+
export * from './lib/geometry'
|
|
20
|
+
export type { IslandContextValue } from './lib/island-context'
|
|
21
|
+
export { IslandContext, useIsland } from './lib/island-context'
|
package/lib/clock.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Time as a notch app shows it: a clock ("4:05"), a short span ("4m") and a
|
|
3
|
+
* re-render that lands only on the edges of what is shown.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import { useEffect, useState } from 'react'
|
|
9
|
+
|
|
10
|
+
const SECOND = 1000
|
|
11
|
+
const MINUTE = 60 * SECOND
|
|
12
|
+
|
|
13
|
+
/** Seconds as `m:ss`, or `h:mm:ss` from an hour. */
|
|
14
|
+
export function formatClock(seconds: number) {
|
|
15
|
+
const s = Math.max(0, Math.floor(seconds))
|
|
16
|
+
const ss = String(s % 60).padStart(2, '0')
|
|
17
|
+
if (s < 3600) return `${Math.floor(s / 60)}:${ss}`
|
|
18
|
+
return `${Math.floor(s / 3600)}:${String(Math.floor(s / 60) % 60).padStart(2, '0')}:${ss}`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Seconds as the one largest unit, rounded up: `"45s"`, `"4m"`, `"2h"`. */
|
|
22
|
+
export function formatShort(seconds: number) {
|
|
23
|
+
const s = Math.max(0, Math.ceil(seconds))
|
|
24
|
+
if (s < 60) return `${s}s`
|
|
25
|
+
if (s < 3600) return `${Math.ceil(s / 60)}m`
|
|
26
|
+
return `${Math.ceil(s / 3600)}h`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The time now, re-read once per `unit` ms on the unit's edge counted from
|
|
31
|
+
* `anchor` (a countdown's end, a track's start), never in between. Stops
|
|
32
|
+
* while `running` is false.
|
|
33
|
+
*/
|
|
34
|
+
export function useEdgeClock(anchor: number, running: boolean, unit: number = SECOND) {
|
|
35
|
+
const [now, setNow] = useState(Date.now)
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!running) return
|
|
39
|
+
let timer: ReturnType<typeof setTimeout>
|
|
40
|
+
const tick = () => {
|
|
41
|
+
const t = Date.now()
|
|
42
|
+
setNow(t)
|
|
43
|
+
const offset = (((anchor - t) % unit) + unit) % unit
|
|
44
|
+
timer = setTimeout(tick, offset || unit)
|
|
45
|
+
}
|
|
46
|
+
tick()
|
|
47
|
+
return () => clearTimeout(timer)
|
|
48
|
+
}, [anchor, running, unit])
|
|
49
|
+
|
|
50
|
+
return running ? now : Date.now()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { MINUTE, SECOND }
|
package/lib/geometry.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The island's geometry, pure: its outline per state, the detached bubble of
|
|
3
|
+
* `split`, the path that draws it and how icon tabs share the wings around
|
|
4
|
+
* the notch. Ported from Just Notch's runtime (`island/geometry.ts`), with the
|
|
5
|
+
* screen geometry replaced by sizes a component takes as props.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** What the island shows: the bare notch, an activity in the wings, two activities, the open panel, or an alert. */
|
|
9
|
+
export type IslandState = 'idle' | 'compact' | 'split' | 'expanded' | 'flash'
|
|
10
|
+
|
|
11
|
+
export const ISLAND_STATES: IslandState[] = ['idle', 'compact', 'split', 'expanded', 'flash']
|
|
12
|
+
|
|
13
|
+
/** A width and a height in px. */
|
|
14
|
+
export interface Size {
|
|
15
|
+
width: number
|
|
16
|
+
height: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The sizes the island grows between: the hardware notch and the open panel. */
|
|
20
|
+
export interface IslandGeometry {
|
|
21
|
+
notch: Size
|
|
22
|
+
panel: Size
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The island's outline: a body of `w` × `h` hanging from the top edge, `radius` below, concave `shoulder`s into the edge. */
|
|
26
|
+
export interface Shape {
|
|
27
|
+
w: number
|
|
28
|
+
h: number
|
|
29
|
+
radius: number
|
|
30
|
+
shoulder: number
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const DEFAULT_NOTCH: Size = { width: 185, height: 32 }
|
|
34
|
+
export const DEFAULT_PANEL: Size = { width: 720, height: 320 }
|
|
35
|
+
|
|
36
|
+
/** The open island's one content inset: header, title and content all start here, clear of the bottom corners. */
|
|
37
|
+
export const INSET = 20
|
|
38
|
+
/** Kept free on each side of the notch. */
|
|
39
|
+
export const NOTCH_GAP = 8
|
|
40
|
+
/** How far a flash reaches past the compact wings, on each side. */
|
|
41
|
+
const FLASH_REACH = 64
|
|
42
|
+
/** How far a flash drops below the notch. */
|
|
43
|
+
const FLASH_DROP = 48
|
|
44
|
+
|
|
45
|
+
/** Room for one compact slot beside the notch: about as wide as the notch is tall. */
|
|
46
|
+
export const slotWidth = (notch: Size) => notch.height + 8
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The outline for `state`. `room` is the width the island may take (its
|
|
50
|
+
* container's); the open panel and the flash shrink to fit it, shoulders included.
|
|
51
|
+
*/
|
|
52
|
+
export function shapeFor(state: IslandState, { notch, panel }: IslandGeometry, room = Number.POSITIVE_INFINITY): Shape {
|
|
53
|
+
const slot = slotWidth(notch)
|
|
54
|
+
if (state === 'idle') return { w: notch.width, h: notch.height, radius: 10, shoulder: 6 }
|
|
55
|
+
if (state === 'compact' || state === 'split')
|
|
56
|
+
return { w: notch.width + 2 * slot, h: notch.height, radius: 13, shoulder: 8 }
|
|
57
|
+
if (state === 'flash')
|
|
58
|
+
return {
|
|
59
|
+
w: Math.min(notch.width + 2 * (slot + FLASH_REACH), room - 20),
|
|
60
|
+
h: notch.height + FLASH_DROP,
|
|
61
|
+
radius: 24,
|
|
62
|
+
shoulder: 10,
|
|
63
|
+
}
|
|
64
|
+
return { w: Math.max(notch.width, Math.min(panel.width, room - 28)), h: panel.height, radius: 32, shoulder: 14 }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The detached bubble of `split`: a circle as tall as the compact island, its center `x` from the island's center. */
|
|
68
|
+
export function bubbleFor(shape: Shape, notch: Size, detached: boolean) {
|
|
69
|
+
const r = notch.height / 2 - 1
|
|
70
|
+
return detached ? { x: shape.w / 2 + shape.shoulder + 14 + r, r } : { x: shape.w / 2 - r, r: r * 0.5 }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// A circle's quarter as a cubic has handles at 0.5523 of the radius. Stretching
|
|
74
|
+
// the corner over 1.28 r with longer handles spreads the curvature like Apple's
|
|
75
|
+
// continuous corners, so the bottom never reads as a plain rounded rectangle.
|
|
76
|
+
const CIRCLE = 0.5523
|
|
77
|
+
const SMOOTH_SPAN = 1.28
|
|
78
|
+
const SMOOTH_HANDLE = 0.64
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The outline as one SVG path, centered on `cx`. It starts a point above the
|
|
82
|
+
* top edge so no hairline shows where it meets the screen.
|
|
83
|
+
*/
|
|
84
|
+
export function islandPath(cx: number, { w, h, radius, shoulder }: Shape): string {
|
|
85
|
+
const s = Math.max(0, Math.min(shoulder, h / 2))
|
|
86
|
+
const span = Math.max(0, Math.min(radius * SMOOTH_SPAN, h - s, w / 2))
|
|
87
|
+
const k = span * (1 - SMOOTH_HANDLE)
|
|
88
|
+
const q = s * (1 - CIRCLE)
|
|
89
|
+
const l = cx - w / 2
|
|
90
|
+
const r = cx + w / 2
|
|
91
|
+
return [
|
|
92
|
+
`M${l - s} -1`,
|
|
93
|
+
`L${l - s} 0`,
|
|
94
|
+
`C${l - q} 0 ${l} ${q} ${l} ${s}`,
|
|
95
|
+
`L${l} ${h - span}`,
|
|
96
|
+
`C${l} ${h - k} ${l + k} ${h} ${l + span} ${h}`,
|
|
97
|
+
`L${r - span} ${h}`,
|
|
98
|
+
`C${r - k} ${h} ${r} ${h - k} ${r} ${h - span}`,
|
|
99
|
+
`L${r} ${s}`,
|
|
100
|
+
`C${r} ${q} ${r + q} 0 ${r + s} 0`,
|
|
101
|
+
`L${r + s} -1`,
|
|
102
|
+
'Z',
|
|
103
|
+
].join('')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface StripLayout {
|
|
107
|
+
/** Tabs in the left wing; the rest follow in the right one. */
|
|
108
|
+
before: number
|
|
109
|
+
/** More tabs than both wings hold: the strip scrolls, behind the notch. */
|
|
110
|
+
overflow: boolean
|
|
111
|
+
/** The notch and its gaps in the strip's coordinates. */
|
|
112
|
+
hole: { start: number; end: number }
|
|
113
|
+
/** Least width of the gap between the wings, so the right wing starts past the notch. */
|
|
114
|
+
spacer: number
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Tabs of `tab` px across a strip of `width` centered under a notch of
|
|
119
|
+
* `notchWidth`, flowing from the left wing into the right one, balanced.
|
|
120
|
+
* `reserve` is kept free at the right wing's far end (a settings button).
|
|
121
|
+
*/
|
|
122
|
+
export function stripLayout(count: number, width: number, notchWidth: number, tab: number, reserve = 0): StripLayout {
|
|
123
|
+
const left = Math.max(0, (width - notchWidth) / 2 - NOTCH_GAP)
|
|
124
|
+
const leftCap = Math.floor(left / tab)
|
|
125
|
+
const rightCap = Math.max(0, Math.floor((left - reserve) / tab))
|
|
126
|
+
const overflow = count > leftCap + rightCap
|
|
127
|
+
const before = overflow ? leftCap : Math.min(leftCap, Math.max(Math.ceil(count / 2), count - rightCap))
|
|
128
|
+
const hole = { start: left, end: width - left }
|
|
129
|
+
return { before, overflow, hole, spacer: hole.end - before * tab }
|
|
130
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* What an Island tells the content inside it: its state, the notch and panel
|
|
3
|
+
* it grows between, and its current outline, so a tab strip can leave the
|
|
4
|
+
* notch free and a layout can start below it.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { createContext, useContext } from 'react'
|
|
10
|
+
import type { IslandGeometry, IslandState, Shape } from './geometry'
|
|
11
|
+
|
|
12
|
+
export interface IslandContextValue {
|
|
13
|
+
state: IslandState
|
|
14
|
+
geometry: IslandGeometry
|
|
15
|
+
/** The outline of `state`, fitted to the room the island has. */
|
|
16
|
+
shape: Shape
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const IslandContext = createContext<IslandContextValue | null>(null)
|
|
20
|
+
|
|
21
|
+
/** The enclosing Island's state and geometry, or `null` outside one. */
|
|
22
|
+
export function useIsland() {
|
|
23
|
+
return useContext(IslandContext)
|
|
24
|
+
}
|
package/lib/motion.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The island's motion, on modo-ui's spring tiers: which tier moves the shape
|
|
3
|
+
* between two states, the bubble's goo, and Apple's content swap (arriving
|
|
4
|
+
* content sharpens and grows into place, leaving content blurs out).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { spring, springEnter } from '@justanarthur/modo-ui/lib/springs'
|
|
8
|
+
import type { Transition } from 'motion/react'
|
|
9
|
+
import type { IslandState } from './geometry'
|
|
10
|
+
|
|
11
|
+
type Tier = (typeof spring)[keyof typeof spring]
|
|
12
|
+
|
|
13
|
+
const SIZE: Record<IslandState, number> = { idle: 0, compact: 1, split: 1, flash: 2, expanded: 3 }
|
|
14
|
+
const TIER: Record<IslandState, Tier> = {
|
|
15
|
+
idle: spring.moderate,
|
|
16
|
+
compact: spring.moderate,
|
|
17
|
+
split: spring.moderate,
|
|
18
|
+
flash: spring.slow,
|
|
19
|
+
expanded: spring.goo,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The bigger the move, the slower the tier: grow on the target's spring, shrink on the source's exit tween. */
|
|
23
|
+
export function shapeTransition(from: IslandState, to: IslandState): Transition {
|
|
24
|
+
if (SIZE[to] >= SIZE[from]) return springEnter(TIER[to])
|
|
25
|
+
return from === 'expanded' ? spring.slow.exit : TIER[from].exit
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const bubbleTransition = (detaching: boolean): Transition =>
|
|
29
|
+
detaching ? springEnter(spring.goo) : spring.goo.exit
|
|
30
|
+
|
|
31
|
+
// Blur is a filter string a spring can't drive, so the swap tweens on a tier's
|
|
32
|
+
// duration, as modo-ui's icon swaps. At rest the filter is dropped (`none`, not
|
|
33
|
+
// `blur(0px)`): any filter keeps an offscreen buffer alive.
|
|
34
|
+
export const contentShown = { opacity: 1, scale: 1, filter: 'blur(0px)', transitionEnd: { filter: 'none' } }
|
|
35
|
+
export const contentHidden = { opacity: 0, scale: 0.94, filter: 'blur(6px)' }
|
|
36
|
+
export const contentEnter: Transition = {
|
|
37
|
+
type: 'tween',
|
|
38
|
+
duration: spring.slow.duration,
|
|
39
|
+
ease: 'easeOut',
|
|
40
|
+
delay: spring.fast.duration,
|
|
41
|
+
}
|
|
42
|
+
export const contentLeave: Transition = { type: 'tween', ...spring.fast.exit, ease: 'easeIn' }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mock: activities that count down for real in the docs, a running timer and
|
|
3
|
+
* an event a few minutes out, made once on mount so a re-render never resets
|
|
4
|
+
* them. Nothing here ships in the barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { CalendarDays } from 'lucide-react'
|
|
10
|
+
import { useState } from 'react'
|
|
11
|
+
import Agenda from '../blocks/activities/agenda'
|
|
12
|
+
import NowPlaying from '../blocks/activities/now-playing'
|
|
13
|
+
import Timer from '../blocks/activities/timer'
|
|
14
|
+
import ExpandedIsland from '../blocks/app/expanded-island'
|
|
15
|
+
import Island from '../components/island/island'
|
|
16
|
+
import { soonEvent } from './data'
|
|
17
|
+
import { FlashIsland, PLAYING, ScreenEdge, useRun, WingsIsland } from './island-content'
|
|
18
|
+
|
|
19
|
+
/** The timer, running from a focus run with 62% to go. */
|
|
20
|
+
export function RunningTimer() {
|
|
21
|
+
return <Timer defaultValue={useRun()} pomodoro />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The timer in the compact island's wings. */
|
|
25
|
+
export function TimerWings() {
|
|
26
|
+
const run = useRun()
|
|
27
|
+
return <WingsIsland leading={<Timer.Leading />} trailing={<Timer.Trailing run={run} />} />
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Music in the wings, the timer's ring in the bubble. */
|
|
31
|
+
export function TimerSplit() {
|
|
32
|
+
const run = useRun()
|
|
33
|
+
return (
|
|
34
|
+
<WingsIsland
|
|
35
|
+
leading={<NowPlaying.Leading track={PLAYING} />}
|
|
36
|
+
trailing={<NowPlaying.Trailing />}
|
|
37
|
+
minimal={<Timer.Minimal run={run} />}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** An event `minutes` out, made once. */
|
|
43
|
+
export function useSoon(minutes = 4) {
|
|
44
|
+
return useState(() => soonEvent(minutes))[0]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The next event counting down in the compact island's wings. */
|
|
48
|
+
export function AgendaWings() {
|
|
49
|
+
const event = useSoon()
|
|
50
|
+
return <WingsIsland leading={<Agenda.Leading event={event} />} trailing={<Agenda.Trailing event={event} />} />
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The timer in the wings, the next event's ring in the bubble. */
|
|
54
|
+
export function AgendaSplit() {
|
|
55
|
+
const run = useRun()
|
|
56
|
+
const event = useSoon()
|
|
57
|
+
return (
|
|
58
|
+
<WingsIsland
|
|
59
|
+
leading={<Timer.Leading />}
|
|
60
|
+
trailing={<Timer.Trailing run={run} />}
|
|
61
|
+
minimal={<Agenda.Minimal event={event} />}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The open island on the "Up next" view. */
|
|
67
|
+
export function UpNextIsland() {
|
|
68
|
+
const event = useSoon()
|
|
69
|
+
return (
|
|
70
|
+
<ScreenEdge height={260}>
|
|
71
|
+
<Island
|
|
72
|
+
defaultState="expanded"
|
|
73
|
+
collapsedState="idle"
|
|
74
|
+
panelHeight={200}
|
|
75
|
+
expanded={
|
|
76
|
+
<ExpandedIsland
|
|
77
|
+
tabs={[
|
|
78
|
+
{
|
|
79
|
+
value: 'up-next',
|
|
80
|
+
label: 'Up next',
|
|
81
|
+
icon: CalendarDays,
|
|
82
|
+
content: <Agenda.UpNext event={event} />,
|
|
83
|
+
},
|
|
84
|
+
]}
|
|
85
|
+
/>
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
</ScreenEdge>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** The flash a minute before an event. */
|
|
93
|
+
export function AgendaFlash() {
|
|
94
|
+
const event = useSoon(0.9)
|
|
95
|
+
return (
|
|
96
|
+
<FlashIsland>
|
|
97
|
+
<Agenda.Starting event={event} />
|
|
98
|
+
</FlashIsland>
|
|
99
|
+
)
|
|
100
|
+
}
|
package/mock/artwork.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Mock: album art and file previews for the docs, made only of tokens (a
|
|
3
|
+
* gradient across the theme's hues), so nothing loads and both schemes hold.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
7
|
+
|
|
8
|
+
type ArtworkVariant = 'aurora' | 'dusk' | 'night'
|
|
9
|
+
|
|
10
|
+
// Literal table: UnoCSS only generates the classes it can read whole.
|
|
11
|
+
const FILL: Record<ArtworkVariant, string> = {
|
|
12
|
+
aurora: 'bg-linear-to-br from-status-info via-brand to-status-success',
|
|
13
|
+
dusk: 'bg-linear-to-br from-status-warning via-status-error to-brand',
|
|
14
|
+
night: 'bg-linear-to-tr from-ink via-brand to-status-info',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** A square of generated art that fills its tile. */
|
|
18
|
+
export function MockArtwork({ variant = 'aurora', className }: { variant?: ArtworkVariant; className?: string }) {
|
|
19
|
+
return (
|
|
20
|
+
<span aria-hidden className={cn('relative block size-full overflow-hidden', FILL[variant], className)}>
|
|
21
|
+
<span className="absolute -right-1/4 -bottom-1/4 size-3/4 rounded-full bg-ink/25" />
|
|
22
|
+
<span className="absolute top-1/5 left-1/5 size-1/4 rounded-full bg-thumb/40" />
|
|
23
|
+
</span>
|
|
24
|
+
)
|
|
25
|
+
}
|