@elizaos/plugin-simple-views 2.0.3-beta.5
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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +184 -0
- package/dist/plugin.js.map +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +26 -0
- package/dist/register.js.map +1 -0
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +64 -0
- package/dist/routes.js.map +1 -0
- package/dist/simple-views-view-bundle.d.ts +2 -0
- package/dist/simple-views-view-bundle.d.ts.map +1 -0
- package/dist/simple-views-view-bundle.js +6 -0
- package/dist/simple-views-view-bundle.js.map +1 -0
- package/dist/simple-views.interact.d.ts +9 -0
- package/dist/simple-views.interact.d.ts.map +1 -0
- package/dist/simple-views.interact.js +230 -0
- package/dist/simple-views.interact.js.map +1 -0
- package/dist/storage.d.ts +44 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +179 -0
- package/dist/storage.js.map +1 -0
- package/dist/ui.d.ts +3 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +1041 -0
- package/dist/ui.js.map +1 -0
- package/dist/views/bundle.js +1159 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
import { AgentButton as e, useAgentElement as t } from "@elizaos/ui/agent-surface";
|
|
2
|
+
import { CalendarDays as n, ChevronLeft as r, ChevronRight as i, Plus as a, Settings as o, StickyNote as s, Trash2 as c } from "lucide-react";
|
|
3
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
4
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
5
|
+
//#region src/storage.ts
|
|
6
|
+
var g = "eliza:simple-views:update", _ = "eliza.simpleViews.notes.v2", v = "eliza.simpleViews.calendar.events.v2", y = "eliza.simpleViews.calendar.cursor.v2", b = [], x = [], S = /^(\d{4})-(\d{2})-(\d{2})$/, C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
|
|
7
|
+
function T() {
|
|
8
|
+
if (typeof window > "u") return null;
|
|
9
|
+
try {
|
|
10
|
+
return window.localStorage ?? null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function E(e) {
|
|
16
|
+
typeof window > "u" || window.dispatchEvent(new CustomEvent(g, { detail: { key: e } }));
|
|
17
|
+
}
|
|
18
|
+
function D(e, t, n) {
|
|
19
|
+
let r = T();
|
|
20
|
+
if (!r) {
|
|
21
|
+
let r = C.get(e);
|
|
22
|
+
return n(r) ? r : t;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
let i = r.getItem(e);
|
|
26
|
+
if (!i) return t;
|
|
27
|
+
let a = JSON.parse(i);
|
|
28
|
+
return n(a) ? a : t;
|
|
29
|
+
} catch {
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function O(e, t) {
|
|
34
|
+
let n = T();
|
|
35
|
+
if (!n) {
|
|
36
|
+
C.set(e, t);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
n.setItem(e, JSON.stringify(t)), E(e);
|
|
41
|
+
} catch {}
|
|
42
|
+
}
|
|
43
|
+
function k(e, t) {
|
|
44
|
+
let n = T();
|
|
45
|
+
if (!n) return w.get(e) ?? t;
|
|
46
|
+
try {
|
|
47
|
+
return n.getItem(e) ?? t;
|
|
48
|
+
} catch {
|
|
49
|
+
return t;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function ee(e, t) {
|
|
53
|
+
let n = T();
|
|
54
|
+
if (!n) {
|
|
55
|
+
w.set(e, t);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
n.setItem(e, t), E(e);
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
62
|
+
function A(e) {
|
|
63
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
64
|
+
}
|
|
65
|
+
function j(e) {
|
|
66
|
+
return e === "green" || e === "rose" || e === "pink" || e === "slate" ? e === "pink" ? "rose" : e : "yellow";
|
|
67
|
+
}
|
|
68
|
+
function M(e) {
|
|
69
|
+
return A(e) ? typeof e.id == "string" && typeof e.title == "string" && typeof e.body == "string" && typeof e.createdAt == "string" && typeof e.updatedAt == "string" && j(e.color) === e.color : !1;
|
|
70
|
+
}
|
|
71
|
+
function te(e) {
|
|
72
|
+
return A(e) ? typeof e.id == "string" && typeof e.title == "string" && V(e.date) === e.date && typeof e.time == "string" && typeof e.notes == "string" && typeof e.createdAt == "string" && j(e.color) === e.color : !1;
|
|
73
|
+
}
|
|
74
|
+
function N(e) {
|
|
75
|
+
return Array.isArray(e) && e.every(M);
|
|
76
|
+
}
|
|
77
|
+
function P(e) {
|
|
78
|
+
return Array.isArray(e) && e.every(te);
|
|
79
|
+
}
|
|
80
|
+
function F() {
|
|
81
|
+
return D(_, b, N);
|
|
82
|
+
}
|
|
83
|
+
function I(e) {
|
|
84
|
+
O(_, e);
|
|
85
|
+
}
|
|
86
|
+
function L() {
|
|
87
|
+
return D(v, x, P);
|
|
88
|
+
}
|
|
89
|
+
function R(e) {
|
|
90
|
+
O(v, e);
|
|
91
|
+
}
|
|
92
|
+
function z() {
|
|
93
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
94
|
+
}
|
|
95
|
+
function ne(e) {
|
|
96
|
+
let t = globalThis.crypto;
|
|
97
|
+
return typeof t?.randomUUID == "function" ? `${e}-${t.randomUUID()}` : `${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
98
|
+
}
|
|
99
|
+
function B(e = /* @__PURE__ */ new Date()) {
|
|
100
|
+
return e.toISOString().slice(0, 10);
|
|
101
|
+
}
|
|
102
|
+
function V(e) {
|
|
103
|
+
if (typeof e != "string") return null;
|
|
104
|
+
let t = S.exec(e.trim());
|
|
105
|
+
if (!t) return null;
|
|
106
|
+
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]);
|
|
107
|
+
if (n < 1e3 || r < 1 || r > 12 || i < 1 || i > 31) return null;
|
|
108
|
+
let a = new Date(Date.UTC(n, r - 1, i));
|
|
109
|
+
return a.getUTCFullYear() !== n || a.getUTCMonth() !== r - 1 || a.getUTCDate() !== i ? null : a.toISOString().slice(0, 10);
|
|
110
|
+
}
|
|
111
|
+
function H() {
|
|
112
|
+
return V(k("eliza.simpleViews.calendar.cursor.v2", "")) ?? B();
|
|
113
|
+
}
|
|
114
|
+
function U(e) {
|
|
115
|
+
ee(y, e);
|
|
116
|
+
}
|
|
117
|
+
function W() {
|
|
118
|
+
return {
|
|
119
|
+
notes: F(),
|
|
120
|
+
events: L(),
|
|
121
|
+
selectedDate: H()
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function re(e, t = {}) {
|
|
125
|
+
let n = F().length > 0 || L().length > 0;
|
|
126
|
+
t.preserveLocalDataOnEmpty && n && e.notes.length === 0 && e.events.length === 0 || (I(e.notes), R(e.events), U(e.selectedDate));
|
|
127
|
+
}
|
|
128
|
+
function ie(e) {
|
|
129
|
+
return A(e) ? N(e.notes) && P(e.events) && V(e.selectedDate) === e.selectedDate : !1;
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/simple-views.interact.ts
|
|
133
|
+
function G(e, t) {
|
|
134
|
+
let n = e?.[t];
|
|
135
|
+
return typeof n == "string" ? n.trim() : "";
|
|
136
|
+
}
|
|
137
|
+
function K(e) {
|
|
138
|
+
return e.toLowerCase().replace(/\s+/g, " ").trim();
|
|
139
|
+
}
|
|
140
|
+
function ae(e) {
|
|
141
|
+
return e.length === 0 ? "No sticky notes yet." : e.map((e) => `${e.title}: ${e.body}`).join("\n");
|
|
142
|
+
}
|
|
143
|
+
function oe(e, t) {
|
|
144
|
+
let n = t ? e.filter((e) => e.date === t) : e;
|
|
145
|
+
return n.length === 0 ? t ? `No calendar events for ${t}.` : "No calendar events yet." : n.map((e) => `${e.date} ${e.time} - ${e.title}${e.notes ? `: ${e.notes}` : ""}`).join("\n");
|
|
146
|
+
}
|
|
147
|
+
function se(e, t) {
|
|
148
|
+
let n = K(t);
|
|
149
|
+
if (!n) return null;
|
|
150
|
+
let r = e.filter((e) => K(e.id) === n || K(e.title) === n);
|
|
151
|
+
if (r.length === 1) return r[0];
|
|
152
|
+
if (r.length > 1) return { ambiguous: r };
|
|
153
|
+
let i = e.filter((e) => K(e.title).includes(n));
|
|
154
|
+
if (i.length === 1) return i[0];
|
|
155
|
+
if (i.length > 1) return { ambiguous: i };
|
|
156
|
+
let a = e.filter((e) => K(e.body).includes(n));
|
|
157
|
+
return a.length === 1 ? a[0] : a.length > 1 ? { ambiguous: a } : null;
|
|
158
|
+
}
|
|
159
|
+
function q(e) {
|
|
160
|
+
return {
|
|
161
|
+
...e,
|
|
162
|
+
state: W()
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async function ce(e, t) {
|
|
166
|
+
if (e === "get-notes") {
|
|
167
|
+
let e = F();
|
|
168
|
+
return q({
|
|
169
|
+
success: !0,
|
|
170
|
+
text: ae(e),
|
|
171
|
+
notes: e
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (e === "create-note") {
|
|
175
|
+
let e = z(), n = {
|
|
176
|
+
id: ne("note"),
|
|
177
|
+
title: G(t, "title") || "Untitled",
|
|
178
|
+
body: G(t, "body") || G(t, "content") || "New note",
|
|
179
|
+
color: j(t?.color),
|
|
180
|
+
createdAt: e,
|
|
181
|
+
updatedAt: e
|
|
182
|
+
};
|
|
183
|
+
return I([n, ...F()]), q({
|
|
184
|
+
success: !0,
|
|
185
|
+
text: `Created sticky note "${n.title}".`,
|
|
186
|
+
created: !0,
|
|
187
|
+
note: n
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (e === "delete-note") {
|
|
191
|
+
let e = G(t, "id") || G(t, "title") || G(t, "query") || G(t, "name");
|
|
192
|
+
if (!e) return q({
|
|
193
|
+
success: !1,
|
|
194
|
+
text: "Note id, title, or query is required.",
|
|
195
|
+
deleted: !1,
|
|
196
|
+
reason: "target is required"
|
|
197
|
+
});
|
|
198
|
+
let n = F(), r = se(n, e);
|
|
199
|
+
return r ? "ambiguous" in r ? q({
|
|
200
|
+
success: !1,
|
|
201
|
+
text: `"${e}" matches multiple sticky notes: ${r.ambiguous.map((e) => e.title).join(", ")}.`,
|
|
202
|
+
deleted: !1,
|
|
203
|
+
target: e,
|
|
204
|
+
candidates: r.ambiguous
|
|
205
|
+
}) : (I(n.filter((e) => e.id !== r.id)), q({
|
|
206
|
+
success: !0,
|
|
207
|
+
text: `Deleted sticky note "${r.title}".`,
|
|
208
|
+
deleted: !0,
|
|
209
|
+
id: r.id,
|
|
210
|
+
note: r
|
|
211
|
+
})) : q({
|
|
212
|
+
success: !1,
|
|
213
|
+
text: `No sticky note found for "${e}".`,
|
|
214
|
+
deleted: !1,
|
|
215
|
+
target: e
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (e === "clear-notes") return I([]), q({
|
|
219
|
+
success: !0,
|
|
220
|
+
text: "Cleared all sticky notes.",
|
|
221
|
+
cleared: !0
|
|
222
|
+
});
|
|
223
|
+
if (e === "get-calendar-state") {
|
|
224
|
+
let e = G(t, "date"), n = e ? V(e) : H();
|
|
225
|
+
if (!n) return q({
|
|
226
|
+
success: !1,
|
|
227
|
+
text: "Date must be YYYY-MM-DD.",
|
|
228
|
+
reason: "date must be YYYY-MM-DD"
|
|
229
|
+
});
|
|
230
|
+
let r = L();
|
|
231
|
+
return q({
|
|
232
|
+
success: !0,
|
|
233
|
+
text: oe(r, n),
|
|
234
|
+
selectedDate: n,
|
|
235
|
+
events: r
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (e === "select-calendar-date") {
|
|
239
|
+
let e = V(G(t, "date"));
|
|
240
|
+
return e ? (U(e), q({
|
|
241
|
+
success: !0,
|
|
242
|
+
text: `Selected ${e}.`,
|
|
243
|
+
selected: !0,
|
|
244
|
+
date: e
|
|
245
|
+
})) : q({
|
|
246
|
+
success: !1,
|
|
247
|
+
text: "Date must be YYYY-MM-DD.",
|
|
248
|
+
selected: !1,
|
|
249
|
+
reason: "date must be YYYY-MM-DD"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (e === "create-calendar-event") {
|
|
253
|
+
let e = G(t, "date"), n = e ? V(e) : H() || B();
|
|
254
|
+
if (!n) return q({
|
|
255
|
+
success: !1,
|
|
256
|
+
text: "Date must be YYYY-MM-DD.",
|
|
257
|
+
created: !1,
|
|
258
|
+
reason: "date must be YYYY-MM-DD"
|
|
259
|
+
});
|
|
260
|
+
let r = {
|
|
261
|
+
id: ne("event"),
|
|
262
|
+
title: G(t, "title") || "Untitled event",
|
|
263
|
+
date: n,
|
|
264
|
+
time: G(t, "time") || "09:00",
|
|
265
|
+
notes: G(t, "notes"),
|
|
266
|
+
color: j(t?.color),
|
|
267
|
+
createdAt: z()
|
|
268
|
+
};
|
|
269
|
+
return R([...L(), r]), U(n), q({
|
|
270
|
+
success: !0,
|
|
271
|
+
text: `Created calendar event "${r.title}" for ${r.date} at ${r.time}.`,
|
|
272
|
+
created: !0,
|
|
273
|
+
event: r
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (e === "delete-calendar-event") {
|
|
277
|
+
let e = G(t, "id");
|
|
278
|
+
if (!e) return q({
|
|
279
|
+
success: !1,
|
|
280
|
+
text: "Event id is required.",
|
|
281
|
+
deleted: !1,
|
|
282
|
+
reason: "id is required"
|
|
283
|
+
});
|
|
284
|
+
let n = L(), r = n.find((t) => t.id === e);
|
|
285
|
+
return r ? (R(n.filter((t) => t.id !== e)), q({
|
|
286
|
+
success: !0,
|
|
287
|
+
text: `Deleted calendar event "${r.title}".`,
|
|
288
|
+
deleted: !0,
|
|
289
|
+
id: e,
|
|
290
|
+
event: r
|
|
291
|
+
})) : q({
|
|
292
|
+
success: !1,
|
|
293
|
+
text: `No calendar event found for "${e}".`,
|
|
294
|
+
deleted: !1,
|
|
295
|
+
id: e
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
throw Error(`Simple views do not support capability "${e}".`);
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/ui.tsx
|
|
302
|
+
var le = [
|
|
303
|
+
"yellow",
|
|
304
|
+
"green",
|
|
305
|
+
"rose",
|
|
306
|
+
"slate"
|
|
307
|
+
], J = {
|
|
308
|
+
yellow: {
|
|
309
|
+
background: "#fff5bf",
|
|
310
|
+
borderColor: "#d9b84b"
|
|
311
|
+
},
|
|
312
|
+
green: {
|
|
313
|
+
background: "#dff6df",
|
|
314
|
+
borderColor: "#7dbb77"
|
|
315
|
+
},
|
|
316
|
+
rose: {
|
|
317
|
+
background: "#ffe4ec",
|
|
318
|
+
borderColor: "#d991aa"
|
|
319
|
+
},
|
|
320
|
+
slate: {
|
|
321
|
+
background: "#e8edf2",
|
|
322
|
+
borderColor: "#9aa8b5"
|
|
323
|
+
}
|
|
324
|
+
}, ue = {
|
|
325
|
+
yellow: "#b88719",
|
|
326
|
+
green: "#2f7d46",
|
|
327
|
+
rose: "#b84065",
|
|
328
|
+
slate: "#586879"
|
|
329
|
+
}, de = {
|
|
330
|
+
display: "flex",
|
|
331
|
+
flexDirection: "column",
|
|
332
|
+
minHeight: "100%",
|
|
333
|
+
color: "#15171c",
|
|
334
|
+
background: "#f6f7f4",
|
|
335
|
+
fontFamily: "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif"
|
|
336
|
+
}, fe = {
|
|
337
|
+
display: "flex",
|
|
338
|
+
alignItems: "center",
|
|
339
|
+
justifyContent: "space-between",
|
|
340
|
+
gap: 16,
|
|
341
|
+
padding: "18px 20px 14px",
|
|
342
|
+
borderBottom: "1px solid #dde1d8",
|
|
343
|
+
background: "#ffffff"
|
|
344
|
+
}, pe = {
|
|
345
|
+
display: "flex",
|
|
346
|
+
alignItems: "center",
|
|
347
|
+
gap: 10,
|
|
348
|
+
minWidth: 0
|
|
349
|
+
}, me = {
|
|
350
|
+
display: "grid",
|
|
351
|
+
placeItems: "center",
|
|
352
|
+
width: 34,
|
|
353
|
+
height: 34,
|
|
354
|
+
border: "1px solid #d6dbd2",
|
|
355
|
+
borderRadius: 8,
|
|
356
|
+
background: "#f2f4ef",
|
|
357
|
+
color: "#263326"
|
|
358
|
+
}, he = {
|
|
359
|
+
margin: 0,
|
|
360
|
+
fontSize: 20,
|
|
361
|
+
lineHeight: "26px",
|
|
362
|
+
fontWeight: 700,
|
|
363
|
+
letterSpacing: 0
|
|
364
|
+
}, ge = {
|
|
365
|
+
margin: 0,
|
|
366
|
+
color: "#60695d",
|
|
367
|
+
fontSize: 13,
|
|
368
|
+
lineHeight: "18px"
|
|
369
|
+
}, _e = {
|
|
370
|
+
display: "flex",
|
|
371
|
+
alignItems: "center",
|
|
372
|
+
flexWrap: "wrap",
|
|
373
|
+
gap: 8,
|
|
374
|
+
justifyContent: "flex-end"
|
|
375
|
+
}, Y = {
|
|
376
|
+
display: "inline-flex",
|
|
377
|
+
alignItems: "center",
|
|
378
|
+
justifyContent: "center",
|
|
379
|
+
gap: 7,
|
|
380
|
+
minHeight: 34,
|
|
381
|
+
border: "1px solid #c9d0c4",
|
|
382
|
+
borderRadius: 8,
|
|
383
|
+
padding: "0 12px",
|
|
384
|
+
background: "#ffffff",
|
|
385
|
+
color: "#1f271e",
|
|
386
|
+
fontSize: 13,
|
|
387
|
+
fontWeight: 600,
|
|
388
|
+
cursor: "pointer"
|
|
389
|
+
}, X = {
|
|
390
|
+
...Y,
|
|
391
|
+
width: 34,
|
|
392
|
+
padding: 0
|
|
393
|
+
}, ve = {
|
|
394
|
+
...Y,
|
|
395
|
+
borderColor: "#476b3b",
|
|
396
|
+
background: "#476b3b",
|
|
397
|
+
color: "#ffffff"
|
|
398
|
+
}, ye = {
|
|
399
|
+
width: "100%",
|
|
400
|
+
minHeight: 36,
|
|
401
|
+
border: "1px solid #c9d0c4",
|
|
402
|
+
borderRadius: 8,
|
|
403
|
+
padding: "8px 10px",
|
|
404
|
+
background: "#ffffff",
|
|
405
|
+
color: "#15171c",
|
|
406
|
+
font: "inherit",
|
|
407
|
+
fontSize: 14,
|
|
408
|
+
lineHeight: "20px",
|
|
409
|
+
boxSizing: "border-box"
|
|
410
|
+
}, be = {
|
|
411
|
+
border: "1px solid #dde1d8",
|
|
412
|
+
borderRadius: 8,
|
|
413
|
+
background: "#ffffff"
|
|
414
|
+
};
|
|
415
|
+
async function xe() {
|
|
416
|
+
if (typeof fetch != "function") return null;
|
|
417
|
+
try {
|
|
418
|
+
let e = await fetch("/api/simple-views/state", { headers: { Accept: "application/json" } });
|
|
419
|
+
if (!e.ok) return null;
|
|
420
|
+
let t = await e.json();
|
|
421
|
+
return ie(t) ? t : null;
|
|
422
|
+
} catch {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
async function Z(e, t) {
|
|
427
|
+
if (typeof fetch == "function") try {
|
|
428
|
+
let n = await fetch("/api/simple-views/interact", {
|
|
429
|
+
method: "POST",
|
|
430
|
+
headers: {
|
|
431
|
+
"Content-Type": "application/json",
|
|
432
|
+
Accept: "application/json"
|
|
433
|
+
},
|
|
434
|
+
body: JSON.stringify({
|
|
435
|
+
capability: e,
|
|
436
|
+
params: t
|
|
437
|
+
})
|
|
438
|
+
});
|
|
439
|
+
if (n.ok) {
|
|
440
|
+
let e = await n.json();
|
|
441
|
+
if (e && typeof e == "object" && "state" in e && ie(e.state)) {
|
|
442
|
+
re(e.state);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
} catch {}
|
|
447
|
+
await ce(e, t);
|
|
448
|
+
}
|
|
449
|
+
function Se() {
|
|
450
|
+
let [e, t] = p(() => W());
|
|
451
|
+
return u(() => {
|
|
452
|
+
let e = () => t(W()), n = () => e(), r = () => e(), i = (t) => {
|
|
453
|
+
let n = t.detail;
|
|
454
|
+
(n?.type === "simple-views:update" || n?.type === "view:notes:updated" || n?.type === "view:simple-calendar:updated") && e();
|
|
455
|
+
};
|
|
456
|
+
return window.addEventListener(g, r), window.addEventListener("storage", n), window.addEventListener("elizaos-view-event", i), xe().then((t) => {
|
|
457
|
+
t && (re(t, { preserveLocalDataOnEmpty: !0 }), e());
|
|
458
|
+
}), () => {
|
|
459
|
+
window.removeEventListener(g, r), window.removeEventListener("storage", n), window.removeEventListener("elizaos-view-event", i);
|
|
460
|
+
};
|
|
461
|
+
}, []), e;
|
|
462
|
+
}
|
|
463
|
+
function Q({ id: e, label: n, value: r, onFill: i, group: a, placeholder: o, style: s }) {
|
|
464
|
+
let { ref: c, agentProps: l } = t({
|
|
465
|
+
id: e,
|
|
466
|
+
label: n,
|
|
467
|
+
role: "text-input",
|
|
468
|
+
group: a,
|
|
469
|
+
fillable: !0,
|
|
470
|
+
getValue: () => r,
|
|
471
|
+
onFill: i
|
|
472
|
+
});
|
|
473
|
+
return /* @__PURE__ */ m("input", {
|
|
474
|
+
ref: c,
|
|
475
|
+
"aria-label": n,
|
|
476
|
+
...l,
|
|
477
|
+
value: r,
|
|
478
|
+
onChange: (e) => i(e.target.value),
|
|
479
|
+
placeholder: o,
|
|
480
|
+
style: {
|
|
481
|
+
...ye,
|
|
482
|
+
...s
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function Ce({ id: e, label: n, value: r, onFill: i, group: a }) {
|
|
487
|
+
let { ref: o, agentProps: s } = t({
|
|
488
|
+
id: e,
|
|
489
|
+
label: n,
|
|
490
|
+
role: "textarea",
|
|
491
|
+
group: a,
|
|
492
|
+
fillable: !0,
|
|
493
|
+
getValue: () => r,
|
|
494
|
+
onFill: i
|
|
495
|
+
});
|
|
496
|
+
return /* @__PURE__ */ m("textarea", {
|
|
497
|
+
ref: o,
|
|
498
|
+
"aria-label": n,
|
|
499
|
+
...s,
|
|
500
|
+
value: r,
|
|
501
|
+
onChange: (e) => i(e.target.value),
|
|
502
|
+
rows: 5,
|
|
503
|
+
style: {
|
|
504
|
+
...ye,
|
|
505
|
+
minHeight: 112,
|
|
506
|
+
resize: "vertical"
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
function we() {
|
|
511
|
+
typeof window > "u" || (window.history.pushState(null, "", "/settings"), window.dispatchEvent(new PopStateEvent("popstate")));
|
|
512
|
+
}
|
|
513
|
+
function Te({ note: e, onDelete: n }) {
|
|
514
|
+
let r = t({
|
|
515
|
+
id: `note-card-${e.id}`,
|
|
516
|
+
label: `Note: ${e.title}`,
|
|
517
|
+
role: "card",
|
|
518
|
+
group: "notes-list",
|
|
519
|
+
description: e.body,
|
|
520
|
+
status: e.color
|
|
521
|
+
}), i = t({
|
|
522
|
+
id: `delete-note-${e.id}`,
|
|
523
|
+
label: `Delete note ${e.title}`,
|
|
524
|
+
role: "button",
|
|
525
|
+
group: "notes-list",
|
|
526
|
+
onActivate: () => n(e.id)
|
|
527
|
+
});
|
|
528
|
+
return /* @__PURE__ */ h("div", {
|
|
529
|
+
ref: r.ref,
|
|
530
|
+
...r.agentProps,
|
|
531
|
+
style: {
|
|
532
|
+
...J[e.color],
|
|
533
|
+
minHeight: 180,
|
|
534
|
+
border: "1px solid",
|
|
535
|
+
borderRadius: 8,
|
|
536
|
+
padding: 16,
|
|
537
|
+
display: "flex",
|
|
538
|
+
flexDirection: "column",
|
|
539
|
+
gap: 12,
|
|
540
|
+
boxShadow: "0 8px 20px rgba(31, 39, 30, 0.08)"
|
|
541
|
+
},
|
|
542
|
+
children: [/* @__PURE__ */ h("div", {
|
|
543
|
+
style: {
|
|
544
|
+
display: "flex",
|
|
545
|
+
justifyContent: "space-between",
|
|
546
|
+
gap: 10
|
|
547
|
+
},
|
|
548
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
549
|
+
style: {
|
|
550
|
+
margin: 0,
|
|
551
|
+
fontSize: 16,
|
|
552
|
+
lineHeight: "22px",
|
|
553
|
+
fontWeight: 700,
|
|
554
|
+
overflowWrap: "anywhere"
|
|
555
|
+
},
|
|
556
|
+
children: e.title
|
|
557
|
+
}), /* @__PURE__ */ m("button", {
|
|
558
|
+
ref: i.ref,
|
|
559
|
+
type: "button",
|
|
560
|
+
...i.agentProps,
|
|
561
|
+
onClick: () => n(e.id),
|
|
562
|
+
style: {
|
|
563
|
+
...X,
|
|
564
|
+
width: 30,
|
|
565
|
+
height: 30,
|
|
566
|
+
minHeight: 30,
|
|
567
|
+
background: "rgba(255,255,255,0.68)"
|
|
568
|
+
},
|
|
569
|
+
title: "Delete note",
|
|
570
|
+
children: /* @__PURE__ */ m(c, {
|
|
571
|
+
size: 16,
|
|
572
|
+
"aria-hidden": !0
|
|
573
|
+
})
|
|
574
|
+
})]
|
|
575
|
+
}), /* @__PURE__ */ m("p", {
|
|
576
|
+
style: {
|
|
577
|
+
margin: 0,
|
|
578
|
+
color: "#253025",
|
|
579
|
+
fontSize: 14,
|
|
580
|
+
lineHeight: "21px",
|
|
581
|
+
whiteSpace: "pre-wrap",
|
|
582
|
+
overflowWrap: "anywhere"
|
|
583
|
+
},
|
|
584
|
+
children: e.body
|
|
585
|
+
})]
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function Ee() {
|
|
589
|
+
let { notes: t } = Se(), [n, r] = p(""), [i, c] = p(""), [u, d] = p("yellow"), g = f(n), _ = f(i), v = l((e) => {
|
|
590
|
+
g.current = e, r(e);
|
|
591
|
+
}, []), y = l((e) => {
|
|
592
|
+
_.current = e, c(e);
|
|
593
|
+
}, []), b = l(async () => {
|
|
594
|
+
let e = g.current.trim(), t = _.current.trim();
|
|
595
|
+
!e && !t || (await Z("create-note", {
|
|
596
|
+
title: e || "Untitled",
|
|
597
|
+
body: t || "New note",
|
|
598
|
+
color: u
|
|
599
|
+
}), v(""), y(""));
|
|
600
|
+
}, [
|
|
601
|
+
u,
|
|
602
|
+
y,
|
|
603
|
+
v
|
|
604
|
+
]), x = l((e) => {
|
|
605
|
+
Z("delete-note", { id: e });
|
|
606
|
+
}, []), S = l(() => {
|
|
607
|
+
Z("clear-notes");
|
|
608
|
+
}, []);
|
|
609
|
+
return /* @__PURE__ */ h("main", {
|
|
610
|
+
"data-testid": "simple-notes-view",
|
|
611
|
+
style: de,
|
|
612
|
+
children: [/* @__PURE__ */ h("header", {
|
|
613
|
+
style: fe,
|
|
614
|
+
children: [/* @__PURE__ */ h("div", {
|
|
615
|
+
style: pe,
|
|
616
|
+
children: [/* @__PURE__ */ m("div", {
|
|
617
|
+
style: me,
|
|
618
|
+
children: /* @__PURE__ */ m(s, {
|
|
619
|
+
size: 18,
|
|
620
|
+
"aria-hidden": !0
|
|
621
|
+
})
|
|
622
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
623
|
+
style: he,
|
|
624
|
+
children: "Notes"
|
|
625
|
+
}), /* @__PURE__ */ h("p", {
|
|
626
|
+
style: ge,
|
|
627
|
+
children: [t.length, " sticky notes"]
|
|
628
|
+
})] })]
|
|
629
|
+
}), /* @__PURE__ */ h("div", {
|
|
630
|
+
style: _e,
|
|
631
|
+
children: [/* @__PURE__ */ m(e, {
|
|
632
|
+
agentId: "notes-clear",
|
|
633
|
+
agentLabel: "Clear notes",
|
|
634
|
+
onClick: S,
|
|
635
|
+
style: Y,
|
|
636
|
+
children: "Clear"
|
|
637
|
+
}), /* @__PURE__ */ m(e, {
|
|
638
|
+
agentId: "notes-open-settings",
|
|
639
|
+
agentLabel: "Open settings",
|
|
640
|
+
onClick: we,
|
|
641
|
+
style: X,
|
|
642
|
+
title: "Open settings",
|
|
643
|
+
children: /* @__PURE__ */ m(o, {
|
|
644
|
+
size: 16,
|
|
645
|
+
"aria-hidden": !0
|
|
646
|
+
})
|
|
647
|
+
})]
|
|
648
|
+
})]
|
|
649
|
+
}), /* @__PURE__ */ h("div", {
|
|
650
|
+
style: {
|
|
651
|
+
display: "grid",
|
|
652
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 280px), 1fr))",
|
|
653
|
+
gap: 18,
|
|
654
|
+
padding: 20,
|
|
655
|
+
alignItems: "start"
|
|
656
|
+
},
|
|
657
|
+
children: [/* @__PURE__ */ h("form", {
|
|
658
|
+
onSubmit: (e) => {
|
|
659
|
+
e.preventDefault(), b();
|
|
660
|
+
},
|
|
661
|
+
style: {
|
|
662
|
+
...be,
|
|
663
|
+
display: "flex",
|
|
664
|
+
flexDirection: "column",
|
|
665
|
+
gap: 12,
|
|
666
|
+
padding: 16
|
|
667
|
+
},
|
|
668
|
+
children: [
|
|
669
|
+
/* @__PURE__ */ m(Q, {
|
|
670
|
+
id: "note-title",
|
|
671
|
+
label: "Note title",
|
|
672
|
+
value: n,
|
|
673
|
+
onFill: v,
|
|
674
|
+
placeholder: "Title",
|
|
675
|
+
group: "note-compose"
|
|
676
|
+
}),
|
|
677
|
+
/* @__PURE__ */ m(Ce, {
|
|
678
|
+
id: "note-body",
|
|
679
|
+
label: "Note body",
|
|
680
|
+
value: i,
|
|
681
|
+
onFill: y,
|
|
682
|
+
group: "note-compose"
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ m("div", {
|
|
685
|
+
style: {
|
|
686
|
+
display: "flex",
|
|
687
|
+
gap: 8,
|
|
688
|
+
flexWrap: "wrap"
|
|
689
|
+
},
|
|
690
|
+
children: le.map((t) => /* @__PURE__ */ m(e, {
|
|
691
|
+
agentId: `note-color-${t}`,
|
|
692
|
+
agentLabel: `Set note color ${t}`,
|
|
693
|
+
agentRole: "toggle",
|
|
694
|
+
agentStatus: u === t ? "active" : void 0,
|
|
695
|
+
onClick: () => d(t),
|
|
696
|
+
style: {
|
|
697
|
+
...Y,
|
|
698
|
+
background: J[t].background,
|
|
699
|
+
borderColor: u === t ? "#15171c" : J[t].borderColor,
|
|
700
|
+
minWidth: 72,
|
|
701
|
+
textTransform: "capitalize"
|
|
702
|
+
},
|
|
703
|
+
children: t
|
|
704
|
+
}, t))
|
|
705
|
+
}),
|
|
706
|
+
/* @__PURE__ */ h(e, {
|
|
707
|
+
agentId: "add-note",
|
|
708
|
+
agentLabel: "Add note",
|
|
709
|
+
onClick: b,
|
|
710
|
+
style: ve,
|
|
711
|
+
children: [/* @__PURE__ */ m(a, {
|
|
712
|
+
size: 16,
|
|
713
|
+
"aria-hidden": !0
|
|
714
|
+
}), "Add note"]
|
|
715
|
+
})
|
|
716
|
+
]
|
|
717
|
+
}), /* @__PURE__ */ m("section", {
|
|
718
|
+
style: {
|
|
719
|
+
display: "grid",
|
|
720
|
+
gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))",
|
|
721
|
+
gap: 16
|
|
722
|
+
},
|
|
723
|
+
"aria-label": "Sticky note wall",
|
|
724
|
+
children: t.map((e) => /* @__PURE__ */ m(Te, {
|
|
725
|
+
note: e,
|
|
726
|
+
onDelete: x
|
|
727
|
+
}, e.id))
|
|
728
|
+
})]
|
|
729
|
+
})]
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
function $(e) {
|
|
733
|
+
return B(e);
|
|
734
|
+
}
|
|
735
|
+
function De(e) {
|
|
736
|
+
let [t, n, r] = (V(e) ?? B()).split("-").map((e) => Number(e));
|
|
737
|
+
return new Date(Date.UTC(t, n - 1, r));
|
|
738
|
+
}
|
|
739
|
+
function Oe(e) {
|
|
740
|
+
return new Intl.DateTimeFormat("en", {
|
|
741
|
+
month: "long",
|
|
742
|
+
year: "numeric",
|
|
743
|
+
timeZone: "UTC"
|
|
744
|
+
}).format(e);
|
|
745
|
+
}
|
|
746
|
+
function ke(e) {
|
|
747
|
+
return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth(), 1));
|
|
748
|
+
}
|
|
749
|
+
function Ae(e, t) {
|
|
750
|
+
return new Date(Date.UTC(e.getUTCFullYear(), e.getUTCMonth() + t, 1));
|
|
751
|
+
}
|
|
752
|
+
function je(e) {
|
|
753
|
+
let t = ke(e), n = t.getUTCDay(), r = new Date(t);
|
|
754
|
+
return r.setUTCDate(t.getUTCDate() - n), Array.from({ length: 42 }, (e, t) => {
|
|
755
|
+
let n = new Date(r);
|
|
756
|
+
return n.setUTCDate(r.getUTCDate() + t), n;
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
function Me(e, t) {
|
|
760
|
+
return e.filter((e) => e.date === t).sort((e, t) => `${e.time} ${e.title}`.localeCompare(`${t.time} ${t.title}`));
|
|
761
|
+
}
|
|
762
|
+
function Ne({ day: e, selectedDate: n, cursorMonth: r, events: i, onSelect: a }) {
|
|
763
|
+
let o = $(e), s = o === n, c = e.getUTCMonth() === r, l = Me(i, o), u = t({
|
|
764
|
+
id: `calendar-day-${o}`,
|
|
765
|
+
label: `Select ${o}`,
|
|
766
|
+
role: "button",
|
|
767
|
+
group: "simple-calendar-grid",
|
|
768
|
+
description: l.length > 0 ? `${l.length} event${l.length === 1 ? "" : "s"}` : "No events",
|
|
769
|
+
status: s ? "selected" : c ? "current-month" : "outside-month",
|
|
770
|
+
onActivate: () => a(o)
|
|
771
|
+
});
|
|
772
|
+
return /* @__PURE__ */ h("button", {
|
|
773
|
+
ref: u.ref,
|
|
774
|
+
type: "button",
|
|
775
|
+
...u.agentProps,
|
|
776
|
+
onClick: () => a(o),
|
|
777
|
+
style: {
|
|
778
|
+
minWidth: 0,
|
|
779
|
+
minHeight: 78,
|
|
780
|
+
border: s ? "2px solid #476b3b" : "1px solid #dde1d8",
|
|
781
|
+
borderRadius: 8,
|
|
782
|
+
padding: 6,
|
|
783
|
+
background: c ? "#ffffff" : "#eef1eb",
|
|
784
|
+
color: c ? "#15171c" : "#687264",
|
|
785
|
+
textAlign: "left",
|
|
786
|
+
cursor: "pointer",
|
|
787
|
+
display: "flex",
|
|
788
|
+
flexDirection: "column",
|
|
789
|
+
gap: 6
|
|
790
|
+
},
|
|
791
|
+
children: [
|
|
792
|
+
/* @__PURE__ */ m("span", {
|
|
793
|
+
style: {
|
|
794
|
+
fontWeight: 700,
|
|
795
|
+
fontSize: 13
|
|
796
|
+
},
|
|
797
|
+
children: e.getUTCDate()
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ m("span", {
|
|
800
|
+
style: {
|
|
801
|
+
display: "flex",
|
|
802
|
+
gap: 4,
|
|
803
|
+
flexWrap: "wrap"
|
|
804
|
+
},
|
|
805
|
+
children: l.slice(0, 4).map((e) => /* @__PURE__ */ m("span", { style: {
|
|
806
|
+
width: 7,
|
|
807
|
+
height: 7,
|
|
808
|
+
borderRadius: 999,
|
|
809
|
+
background: ue[e.color]
|
|
810
|
+
} }, e.id))
|
|
811
|
+
}),
|
|
812
|
+
l[0] ? /* @__PURE__ */ m("span", {
|
|
813
|
+
style: {
|
|
814
|
+
fontSize: 11,
|
|
815
|
+
lineHeight: "15px",
|
|
816
|
+
color: "#505b4d",
|
|
817
|
+
overflowWrap: "anywhere"
|
|
818
|
+
},
|
|
819
|
+
children: l[0].title
|
|
820
|
+
}) : null
|
|
821
|
+
]
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
function Pe({ event: e, onDelete: n }) {
|
|
825
|
+
let r = t({
|
|
826
|
+
id: `calendar-event-${e.id}`,
|
|
827
|
+
label: `Event: ${e.title}`,
|
|
828
|
+
role: "card",
|
|
829
|
+
group: "simple-calendar-events",
|
|
830
|
+
description: `${e.date} ${e.time}. ${e.notes}`,
|
|
831
|
+
status: e.color
|
|
832
|
+
}), i = t({
|
|
833
|
+
id: `delete-calendar-event-${e.id}`,
|
|
834
|
+
label: `Delete calendar event ${e.title}`,
|
|
835
|
+
role: "button",
|
|
836
|
+
group: "simple-calendar-events",
|
|
837
|
+
onActivate: () => n(e.id)
|
|
838
|
+
});
|
|
839
|
+
return /* @__PURE__ */ h("div", {
|
|
840
|
+
ref: r.ref,
|
|
841
|
+
...r.agentProps,
|
|
842
|
+
style: {
|
|
843
|
+
display: "grid",
|
|
844
|
+
gridTemplateColumns: "10px minmax(0, 1fr) 32px",
|
|
845
|
+
gap: 10,
|
|
846
|
+
alignItems: "center",
|
|
847
|
+
padding: "10px 0",
|
|
848
|
+
borderBottom: "1px solid #ecefe9"
|
|
849
|
+
},
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ m("span", { style: {
|
|
852
|
+
width: 8,
|
|
853
|
+
height: 34,
|
|
854
|
+
borderRadius: 999,
|
|
855
|
+
background: ue[e.color]
|
|
856
|
+
} }),
|
|
857
|
+
/* @__PURE__ */ h("div", {
|
|
858
|
+
style: { minWidth: 0 },
|
|
859
|
+
children: [/* @__PURE__ */ h("div", {
|
|
860
|
+
style: {
|
|
861
|
+
fontWeight: 700,
|
|
862
|
+
fontSize: 14,
|
|
863
|
+
lineHeight: "20px",
|
|
864
|
+
overflowWrap: "anywhere"
|
|
865
|
+
},
|
|
866
|
+
children: [
|
|
867
|
+
e.time,
|
|
868
|
+
" - ",
|
|
869
|
+
e.title
|
|
870
|
+
]
|
|
871
|
+
}), e.notes ? /* @__PURE__ */ m("div", {
|
|
872
|
+
style: {
|
|
873
|
+
color: "#60695d",
|
|
874
|
+
fontSize: 12,
|
|
875
|
+
lineHeight: "17px",
|
|
876
|
+
overflowWrap: "anywhere"
|
|
877
|
+
},
|
|
878
|
+
children: e.notes
|
|
879
|
+
}) : null]
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ m("button", {
|
|
882
|
+
ref: i.ref,
|
|
883
|
+
type: "button",
|
|
884
|
+
...i.agentProps,
|
|
885
|
+
onClick: () => n(e.id),
|
|
886
|
+
style: X,
|
|
887
|
+
title: "Delete event",
|
|
888
|
+
children: /* @__PURE__ */ m(c, {
|
|
889
|
+
size: 16,
|
|
890
|
+
"aria-hidden": !0
|
|
891
|
+
})
|
|
892
|
+
})
|
|
893
|
+
]
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
function Fe() {
|
|
897
|
+
let t = Se(), [s, c] = p(() => H()), [g, _] = p(""), [v, y] = p("09:00"), [b, x] = p(""), [S, C] = p("green"), w = f(s), T = f(g), E = f(v), D = f(b), O = f(S);
|
|
898
|
+
u(() => {
|
|
899
|
+
w.current = t.selectedDate, c(t.selectedDate);
|
|
900
|
+
}, [t.selectedDate]);
|
|
901
|
+
let k = l((e) => {
|
|
902
|
+
T.current = e, _(e);
|
|
903
|
+
}, []), ee = l((e) => {
|
|
904
|
+
E.current = e, y(e);
|
|
905
|
+
}, []), A = l((e) => {
|
|
906
|
+
D.current = e, x(e);
|
|
907
|
+
}, []), j = l((e) => {
|
|
908
|
+
O.current = e, C(e);
|
|
909
|
+
}, []), M = d(() => ke(De(s)), [s]), te = d(() => je(M), [M]), N = d(() => Me(t.events, s), [t.events, s]), P = l((e) => {
|
|
910
|
+
let t = V(e);
|
|
911
|
+
t && (w.current = t, c(t), Z("select-calendar-date", { date: t }));
|
|
912
|
+
}, []), F = l((e) => {
|
|
913
|
+
P($(Ae(M, e)));
|
|
914
|
+
}, [M, P]), I = l(() => {
|
|
915
|
+
P($(/* @__PURE__ */ new Date()));
|
|
916
|
+
}, [P]), L = l(async () => {
|
|
917
|
+
let e = T.current.trim();
|
|
918
|
+
e && (await Z("create-calendar-event", {
|
|
919
|
+
title: e,
|
|
920
|
+
date: w.current,
|
|
921
|
+
time: E.current || "09:00",
|
|
922
|
+
notes: D.current.trim(),
|
|
923
|
+
color: O.current
|
|
924
|
+
}), k(""), A(""));
|
|
925
|
+
}, [A, k]), R = l((e) => {
|
|
926
|
+
Z("delete-calendar-event", { id: e });
|
|
927
|
+
}, []), z = (e) => {
|
|
928
|
+
e.preventDefault(), L();
|
|
929
|
+
};
|
|
930
|
+
return /* @__PURE__ */ h("main", {
|
|
931
|
+
"data-testid": "simple-calendar-view",
|
|
932
|
+
style: de,
|
|
933
|
+
children: [/* @__PURE__ */ h("header", {
|
|
934
|
+
style: fe,
|
|
935
|
+
children: [/* @__PURE__ */ h("div", {
|
|
936
|
+
style: pe,
|
|
937
|
+
children: [/* @__PURE__ */ m("div", {
|
|
938
|
+
style: me,
|
|
939
|
+
children: /* @__PURE__ */ m(n, {
|
|
940
|
+
size: 18,
|
|
941
|
+
"aria-hidden": !0
|
|
942
|
+
})
|
|
943
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
944
|
+
style: he,
|
|
945
|
+
children: "Simple Calendar"
|
|
946
|
+
}), /* @__PURE__ */ h("p", {
|
|
947
|
+
style: ge,
|
|
948
|
+
children: [
|
|
949
|
+
Oe(M),
|
|
950
|
+
" - ",
|
|
951
|
+
t.events.length,
|
|
952
|
+
" events"
|
|
953
|
+
]
|
|
954
|
+
})] })]
|
|
955
|
+
}), /* @__PURE__ */ h("div", {
|
|
956
|
+
style: _e,
|
|
957
|
+
children: [
|
|
958
|
+
/* @__PURE__ */ m(e, {
|
|
959
|
+
agentId: "calendar-prev-month",
|
|
960
|
+
agentLabel: "Previous month",
|
|
961
|
+
onClick: () => F(-1),
|
|
962
|
+
style: X,
|
|
963
|
+
title: "Previous month",
|
|
964
|
+
children: /* @__PURE__ */ m(r, {
|
|
965
|
+
size: 16,
|
|
966
|
+
"aria-hidden": !0
|
|
967
|
+
})
|
|
968
|
+
}),
|
|
969
|
+
/* @__PURE__ */ m(e, {
|
|
970
|
+
agentId: "calendar-today",
|
|
971
|
+
agentLabel: "Go to today",
|
|
972
|
+
onClick: I,
|
|
973
|
+
style: Y,
|
|
974
|
+
children: "Today"
|
|
975
|
+
}),
|
|
976
|
+
/* @__PURE__ */ m(e, {
|
|
977
|
+
agentId: "calendar-next-month",
|
|
978
|
+
agentLabel: "Next month",
|
|
979
|
+
onClick: () => F(1),
|
|
980
|
+
style: X,
|
|
981
|
+
title: "Next month",
|
|
982
|
+
children: /* @__PURE__ */ m(i, {
|
|
983
|
+
size: 16,
|
|
984
|
+
"aria-hidden": !0
|
|
985
|
+
})
|
|
986
|
+
}),
|
|
987
|
+
/* @__PURE__ */ m(e, {
|
|
988
|
+
agentId: "calendar-open-settings",
|
|
989
|
+
agentLabel: "Open settings",
|
|
990
|
+
onClick: we,
|
|
991
|
+
style: X,
|
|
992
|
+
title: "Open settings",
|
|
993
|
+
children: /* @__PURE__ */ m(o, {
|
|
994
|
+
size: 16,
|
|
995
|
+
"aria-hidden": !0
|
|
996
|
+
})
|
|
997
|
+
})
|
|
998
|
+
]
|
|
999
|
+
})]
|
|
1000
|
+
}), /* @__PURE__ */ h("div", {
|
|
1001
|
+
style: {
|
|
1002
|
+
display: "grid",
|
|
1003
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 320px), 1fr))",
|
|
1004
|
+
gap: 18,
|
|
1005
|
+
padding: 20,
|
|
1006
|
+
alignItems: "start"
|
|
1007
|
+
},
|
|
1008
|
+
children: [/* @__PURE__ */ h("section", {
|
|
1009
|
+
style: {
|
|
1010
|
+
...be,
|
|
1011
|
+
padding: 14
|
|
1012
|
+
},
|
|
1013
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1014
|
+
style: {
|
|
1015
|
+
display: "grid",
|
|
1016
|
+
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
1017
|
+
gap: 8,
|
|
1018
|
+
marginBottom: 8,
|
|
1019
|
+
color: "#60695d",
|
|
1020
|
+
fontSize: 12,
|
|
1021
|
+
fontWeight: 700,
|
|
1022
|
+
textAlign: "center"
|
|
1023
|
+
},
|
|
1024
|
+
children: [
|
|
1025
|
+
"Sun",
|
|
1026
|
+
"Mon",
|
|
1027
|
+
"Tue",
|
|
1028
|
+
"Wed",
|
|
1029
|
+
"Thu",
|
|
1030
|
+
"Fri",
|
|
1031
|
+
"Sat"
|
|
1032
|
+
].map((e) => /* @__PURE__ */ m("div", { children: e }, e))
|
|
1033
|
+
}), /* @__PURE__ */ m("div", {
|
|
1034
|
+
style: {
|
|
1035
|
+
display: "grid",
|
|
1036
|
+
gridTemplateColumns: "repeat(7, minmax(0, 1fr))",
|
|
1037
|
+
gap: 8
|
|
1038
|
+
},
|
|
1039
|
+
children: te.map((e) => /* @__PURE__ */ m(Ne, {
|
|
1040
|
+
day: e,
|
|
1041
|
+
selectedDate: s,
|
|
1042
|
+
cursorMonth: M.getUTCMonth(),
|
|
1043
|
+
events: t.events,
|
|
1044
|
+
onSelect: P
|
|
1045
|
+
}, $(e)))
|
|
1046
|
+
})]
|
|
1047
|
+
}), /* @__PURE__ */ h("aside", {
|
|
1048
|
+
style: {
|
|
1049
|
+
...be,
|
|
1050
|
+
display: "flex",
|
|
1051
|
+
flexDirection: "column",
|
|
1052
|
+
gap: 16,
|
|
1053
|
+
padding: 16
|
|
1054
|
+
},
|
|
1055
|
+
children: [
|
|
1056
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h2", {
|
|
1057
|
+
style: {
|
|
1058
|
+
...he,
|
|
1059
|
+
fontSize: 17,
|
|
1060
|
+
lineHeight: "23px"
|
|
1061
|
+
},
|
|
1062
|
+
children: s
|
|
1063
|
+
}), /* @__PURE__ */ h("p", {
|
|
1064
|
+
style: ge,
|
|
1065
|
+
children: [
|
|
1066
|
+
N.length,
|
|
1067
|
+
" event",
|
|
1068
|
+
N.length === 1 ? "" : "s"
|
|
1069
|
+
]
|
|
1070
|
+
})] }),
|
|
1071
|
+
/* @__PURE__ */ h("form", {
|
|
1072
|
+
onSubmit: z,
|
|
1073
|
+
style: {
|
|
1074
|
+
display: "grid",
|
|
1075
|
+
gap: 10
|
|
1076
|
+
},
|
|
1077
|
+
children: [
|
|
1078
|
+
/* @__PURE__ */ m(Q, {
|
|
1079
|
+
id: "calendar-event-title",
|
|
1080
|
+
label: "Calendar event title",
|
|
1081
|
+
value: g,
|
|
1082
|
+
onFill: k,
|
|
1083
|
+
placeholder: "Event title",
|
|
1084
|
+
group: "simple-calendar-compose"
|
|
1085
|
+
}),
|
|
1086
|
+
/* @__PURE__ */ h("div", {
|
|
1087
|
+
style: {
|
|
1088
|
+
display: "grid",
|
|
1089
|
+
gridTemplateColumns: "minmax(0, 1fr) minmax(88px, 112px)",
|
|
1090
|
+
gap: 8
|
|
1091
|
+
},
|
|
1092
|
+
children: [/* @__PURE__ */ m(Q, {
|
|
1093
|
+
id: "calendar-event-date",
|
|
1094
|
+
label: "Calendar event date",
|
|
1095
|
+
value: s,
|
|
1096
|
+
onFill: P,
|
|
1097
|
+
group: "simple-calendar-compose"
|
|
1098
|
+
}), /* @__PURE__ */ m(Q, {
|
|
1099
|
+
id: "calendar-event-time",
|
|
1100
|
+
label: "Calendar event time",
|
|
1101
|
+
value: v,
|
|
1102
|
+
onFill: ee,
|
|
1103
|
+
group: "simple-calendar-compose"
|
|
1104
|
+
})]
|
|
1105
|
+
}),
|
|
1106
|
+
/* @__PURE__ */ m(Ce, {
|
|
1107
|
+
id: "calendar-event-notes",
|
|
1108
|
+
label: "Calendar event notes",
|
|
1109
|
+
value: b,
|
|
1110
|
+
onFill: A,
|
|
1111
|
+
group: "simple-calendar-compose"
|
|
1112
|
+
}),
|
|
1113
|
+
/* @__PURE__ */ m("div", {
|
|
1114
|
+
style: {
|
|
1115
|
+
display: "flex",
|
|
1116
|
+
gap: 8,
|
|
1117
|
+
flexWrap: "wrap"
|
|
1118
|
+
},
|
|
1119
|
+
children: le.map((t) => /* @__PURE__ */ m(e, {
|
|
1120
|
+
agentId: `calendar-event-color-${t}`,
|
|
1121
|
+
agentLabel: `Set calendar event color ${t}`,
|
|
1122
|
+
agentRole: "toggle",
|
|
1123
|
+
agentStatus: S === t ? "active" : void 0,
|
|
1124
|
+
onClick: () => j(t),
|
|
1125
|
+
style: {
|
|
1126
|
+
...Y,
|
|
1127
|
+
background: J[t].background,
|
|
1128
|
+
borderColor: S === t ? "#15171c" : J[t].borderColor,
|
|
1129
|
+
minWidth: 72,
|
|
1130
|
+
textTransform: "capitalize"
|
|
1131
|
+
},
|
|
1132
|
+
children: t
|
|
1133
|
+
}, t))
|
|
1134
|
+
}),
|
|
1135
|
+
/* @__PURE__ */ h(e, {
|
|
1136
|
+
agentId: "add-calendar-event",
|
|
1137
|
+
agentLabel: "Add calendar event",
|
|
1138
|
+
onClick: L,
|
|
1139
|
+
style: ve,
|
|
1140
|
+
children: [/* @__PURE__ */ m(a, {
|
|
1141
|
+
size: 16,
|
|
1142
|
+
"aria-hidden": !0
|
|
1143
|
+
}), "Add event"]
|
|
1144
|
+
})
|
|
1145
|
+
]
|
|
1146
|
+
}),
|
|
1147
|
+
/* @__PURE__ */ m("div", { children: N.map((e) => /* @__PURE__ */ m(Pe, {
|
|
1148
|
+
event: e,
|
|
1149
|
+
onDelete: R
|
|
1150
|
+
}, e.id)) })
|
|
1151
|
+
]
|
|
1152
|
+
})]
|
|
1153
|
+
})]
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
//#endregion
|
|
1157
|
+
export { Ee as NotesView, Fe as SimpleCalendarView };
|
|
1158
|
+
|
|
1159
|
+
//# sourceMappingURL=bundle.js.map
|