@floegence/floe-webapp-core 0.35.42 → 0.35.44
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/dist/components/notes/NotesBoard.d.ts +36 -0
- package/dist/components/notes/NotesBoard.js +141 -0
- package/dist/components/notes/NotesBoardNote.d.ts +17 -0
- package/dist/components/notes/NotesBoardNote.js +114 -0
- package/dist/components/notes/NotesContextMenu.js +7 -7
- package/dist/components/notes/NotesEditorFlyout.d.ts +19 -0
- package/dist/components/notes/NotesEditorFlyout.js +92 -0
- package/dist/components/notes/NotesOverlay.d.ts +9 -1
- package/dist/components/notes/NotesOverlay.js +445 -0
- package/dist/components/notes/NotesOverlayLegacy.d.ts +1 -8
- package/dist/components/notes/NotesOverviewPanel.d.ts +22 -0
- package/dist/components/notes/NotesOverviewPanel.js +52 -0
- package/dist/components/notes/NotesTopicRail.d.ts +18 -0
- package/dist/components/notes/NotesTopicRail.js +94 -0
- package/dist/components/notes/NotesTrashFlyout.d.ts +13 -0
- package/dist/components/notes/NotesTrashFlyout.js +90 -0
- package/dist/components/notes/index.d.ts +1 -1
- package/dist/components/notes/notesOverlayHelpers.d.ts +93 -0
- package/dist/components/notes/notesOverlayHelpers.js +159 -0
- package/dist/components/notes/useNotesOverlayModel.d.ts +196 -0
- package/dist/components/notes/useNotesOverlayModel.js +559 -0
- package/dist/floe.css +3 -1
- package/dist/full.js +1 -1
- package/dist/hooks/useOverlayMask.d.ts +3 -2
- package/dist/hooks/useOverlayMask.js +37 -27
- package/dist/notes-legacy.css +46 -12
- package/dist/notes.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/notes/NotesOverlayLegacy.js +0 -1551
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type InfiniteCanvasContextMenuEvent } from '../../ui';
|
|
2
|
+
import type { NotesItem, NotesTopic, NotesViewport } from './types';
|
|
3
|
+
export interface NotesBoardProps {
|
|
4
|
+
activeTopic: NotesTopic | undefined;
|
|
5
|
+
activeTopicLabel: string;
|
|
6
|
+
activeItems: readonly NotesItem[];
|
|
7
|
+
activeTopicID: string;
|
|
8
|
+
topics: readonly NotesTopic[];
|
|
9
|
+
topZIndex: number;
|
|
10
|
+
viewport: NotesViewport;
|
|
11
|
+
boardScaleLabel: string;
|
|
12
|
+
isMobile: boolean;
|
|
13
|
+
overviewOpen: boolean;
|
|
14
|
+
optimisticFrontNoteID: string | null;
|
|
15
|
+
copiedNoteID: string | null;
|
|
16
|
+
setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
|
|
17
|
+
onViewportCommit: (viewport: NotesViewport) => void;
|
|
18
|
+
onCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
19
|
+
onZoomOut: () => void;
|
|
20
|
+
onZoomIn: () => void;
|
|
21
|
+
onOpenOverview: () => void;
|
|
22
|
+
onSelectTopic: (topicID: string) => void;
|
|
23
|
+
onMobileCreateNote: () => void;
|
|
24
|
+
onMobilePaste: () => void;
|
|
25
|
+
onCopyNote: (item: NotesItem) => void;
|
|
26
|
+
onOpenNoteContextMenu: (event: MouseEvent, item: NotesItem) => void;
|
|
27
|
+
onOpenEditor: (noteID: string) => void;
|
|
28
|
+
onMoveToTrash: (noteID: string) => void;
|
|
29
|
+
onStartOptimisticFront: (noteID: string) => void;
|
|
30
|
+
onCommitFront: (noteID: string) => void;
|
|
31
|
+
onCommitMove: (noteID: string, position: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}) => Promise<void> | void;
|
|
35
|
+
}
|
|
36
|
+
export declare function NotesBoard(props: NotesBoardProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { insert as t, createComponent as o, className as x, effect as M, use as O, memo as S, template as r, delegateEvents as p } from "solid-js/web";
|
|
2
|
+
import { Show as u, For as y } from "solid-js";
|
|
3
|
+
import { Minus as I, Plus as w, Layers as k, Paste as N } from "../icons/index.js";
|
|
4
|
+
import { NotesAnimalIcon as F } from "./notesAppearance.js";
|
|
5
|
+
import { NotesBoardNote as T } from "./NotesBoardNote.js";
|
|
6
|
+
import { topicAccentClass as Z } from "./notesOverlayHelpers.js";
|
|
7
|
+
import { InfiniteCanvas as L } from "../ui/InfiniteCanvas.js";
|
|
8
|
+
var P = /* @__PURE__ */ r('<button type=button class=notes-overlay__hud-button aria-label="Open overview map">'), A = /* @__PURE__ */ r("<div class=notes-page__mobile-toolbar><div class=notes-page__mobile-topics>"), D = /* @__PURE__ */ r("<div class=notes-canvas__field>"), E = /* @__PURE__ */ r('<div class=notes-mobile-dock data-floe-canvas-interactive=true><button type=button class=notes-mobile-dock__action aria-label="Create note at canvas center"><span>New</span></button><button type=button class=notes-mobile-dock__action aria-label="Paste note at canvas center"><span>Paste</span></button><button type=button class="notes-mobile-dock__action is-emphasis"aria-label="Open overview map"><span>Map'), B = /* @__PURE__ */ r('<section class="notes-page notes-overlay__board"><div class=notes-overlay__board-head data-floe-canvas-interactive=true><div class=notes-overlay__board-topic></div><div class=notes-overlay__board-actions><button type=button class=notes-overlay__hud-button aria-label="Zoom out"></button><div class=notes-overlay__hud-scale></div><button type=button class=notes-overlay__hud-button aria-label="Zoom in"></button></div></div><div class=notes-page__canvas>'), R = /* @__PURE__ */ r("<div>"), V = /* @__PURE__ */ r("<div class=notes-overlay__board-topic-copy><div class=notes-page__eyebrow>Active Topic</div><div class=notes-overlay__board-title></div><div class=notes-overlay__board-meta> live note"), K = /* @__PURE__ */ r("<button type=button class=notes-page__mobile-topic>");
|
|
9
|
+
function U(e) {
|
|
10
|
+
return (() => {
|
|
11
|
+
var c = B(), b = c.firstChild, $ = b.firstChild, g = $.nextSibling, d = g.firstChild, h = d.nextSibling, C = h.nextSibling, v = b.nextSibling;
|
|
12
|
+
t($, o(u, {
|
|
13
|
+
get when() {
|
|
14
|
+
return e.activeTopic;
|
|
15
|
+
},
|
|
16
|
+
children: (n) => {
|
|
17
|
+
const a = Z(n().icon_accent);
|
|
18
|
+
return [(() => {
|
|
19
|
+
var i = R();
|
|
20
|
+
return x(i, `notes-topic-mark notes-topic-mark--board ${a}`), t(i, o(F, {
|
|
21
|
+
get iconKey() {
|
|
22
|
+
return n().icon_key;
|
|
23
|
+
},
|
|
24
|
+
class: "notes-topic-mark__icon"
|
|
25
|
+
})), i;
|
|
26
|
+
})(), (() => {
|
|
27
|
+
var i = V(), l = i.firstChild, _ = l.nextSibling, s = _.nextSibling, m = s.firstChild;
|
|
28
|
+
return t(_, () => n().name), t(s, () => e.activeItems.length, m), t(s, () => e.activeItems.length === 1 ? "" : "s", null), i;
|
|
29
|
+
})()];
|
|
30
|
+
}
|
|
31
|
+
})), d.$$click = () => e.onZoomOut(), t(d, o(I, {
|
|
32
|
+
class: "w-3.5 h-3.5"
|
|
33
|
+
})), t(h, () => e.boardScaleLabel), C.$$click = () => e.onZoomIn(), t(C, o(w, {
|
|
34
|
+
class: "w-3.5 h-3.5"
|
|
35
|
+
})), t(g, o(u, {
|
|
36
|
+
get when() {
|
|
37
|
+
return e.isMobile;
|
|
38
|
+
},
|
|
39
|
+
get children() {
|
|
40
|
+
var n = P();
|
|
41
|
+
return n.$$click = () => e.onOpenOverview(), t(n, o(k, {
|
|
42
|
+
class: "w-3.5 h-3.5"
|
|
43
|
+
})), n;
|
|
44
|
+
}
|
|
45
|
+
}), null), t(c, o(u, {
|
|
46
|
+
get when() {
|
|
47
|
+
return e.isMobile;
|
|
48
|
+
},
|
|
49
|
+
get children() {
|
|
50
|
+
var n = A(), a = n.firstChild;
|
|
51
|
+
return t(a, o(y, {
|
|
52
|
+
get each() {
|
|
53
|
+
return e.topics;
|
|
54
|
+
},
|
|
55
|
+
children: (i) => (() => {
|
|
56
|
+
var l = K();
|
|
57
|
+
return l.$$click = () => e.onSelectTopic(i.topic_id), t(l, () => i.name), M(() => l.classList.toggle("is-active", i.topic_id === e.activeTopicID)), l;
|
|
58
|
+
})()
|
|
59
|
+
})), n;
|
|
60
|
+
}
|
|
61
|
+
}), v);
|
|
62
|
+
var f = e.setCanvasFrameRef;
|
|
63
|
+
return typeof f == "function" ? O(f, v) : e.setCanvasFrameRef = v, t(v, o(L, {
|
|
64
|
+
get ariaLabel() {
|
|
65
|
+
return `Canvas for ${e.activeTopicLabel}`;
|
|
66
|
+
},
|
|
67
|
+
class: "notes-canvas",
|
|
68
|
+
get viewport() {
|
|
69
|
+
return e.viewport;
|
|
70
|
+
},
|
|
71
|
+
get onViewportChange() {
|
|
72
|
+
return e.onViewportCommit;
|
|
73
|
+
},
|
|
74
|
+
get onCanvasContextMenu() {
|
|
75
|
+
return e.onCanvasContextMenu;
|
|
76
|
+
},
|
|
77
|
+
get children() {
|
|
78
|
+
var n = D();
|
|
79
|
+
return t(n, o(y, {
|
|
80
|
+
get each() {
|
|
81
|
+
return e.activeItems;
|
|
82
|
+
},
|
|
83
|
+
children: (a) => o(T, {
|
|
84
|
+
item: a,
|
|
85
|
+
get copied() {
|
|
86
|
+
return e.copiedNoteID === a.note_id;
|
|
87
|
+
},
|
|
88
|
+
get optimisticFront() {
|
|
89
|
+
return e.optimisticFrontNoteID === a.note_id;
|
|
90
|
+
},
|
|
91
|
+
get topZIndex() {
|
|
92
|
+
return e.topZIndex;
|
|
93
|
+
},
|
|
94
|
+
get viewportScale() {
|
|
95
|
+
return e.viewport.scale;
|
|
96
|
+
},
|
|
97
|
+
get onCopy() {
|
|
98
|
+
return e.onCopyNote;
|
|
99
|
+
},
|
|
100
|
+
get onOpenContextMenu() {
|
|
101
|
+
return e.onOpenNoteContextMenu;
|
|
102
|
+
},
|
|
103
|
+
get onOpenEditor() {
|
|
104
|
+
return e.onOpenEditor;
|
|
105
|
+
},
|
|
106
|
+
get onMoveToTrash() {
|
|
107
|
+
return e.onMoveToTrash;
|
|
108
|
+
},
|
|
109
|
+
get onStartOptimisticFront() {
|
|
110
|
+
return e.onStartOptimisticFront;
|
|
111
|
+
},
|
|
112
|
+
get onCommitFront() {
|
|
113
|
+
return e.onCommitFront;
|
|
114
|
+
},
|
|
115
|
+
get onCommitMove() {
|
|
116
|
+
return e.onCommitMove;
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
})), n;
|
|
120
|
+
}
|
|
121
|
+
})), t(c, o(u, {
|
|
122
|
+
get when() {
|
|
123
|
+
return S(() => !!e.isMobile)() && !e.overviewOpen;
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
var n = E(), a = n.firstChild, i = a.firstChild, l = a.nextSibling, _ = l.firstChild, s = l.nextSibling, m = s.firstChild;
|
|
127
|
+
return a.$$click = () => e.onMobileCreateNote(), t(a, o(w, {
|
|
128
|
+
class: "w-4 h-4"
|
|
129
|
+
}), i), l.$$click = () => e.onMobilePaste(), t(l, o(N, {
|
|
130
|
+
class: "w-4 h-4"
|
|
131
|
+
}), _), s.$$click = () => e.onOpenOverview(), t(s, o(k, {
|
|
132
|
+
class: "w-4 h-4"
|
|
133
|
+
}), m), n;
|
|
134
|
+
}
|
|
135
|
+
}), null), c;
|
|
136
|
+
})();
|
|
137
|
+
}
|
|
138
|
+
p(["click"]);
|
|
139
|
+
export {
|
|
140
|
+
U as NotesBoard
|
|
141
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
import type { NotesItem, NotesPoint } from './types';
|
|
3
|
+
export interface NotesBoardNoteProps {
|
|
4
|
+
item: NotesItem;
|
|
5
|
+
copied: boolean;
|
|
6
|
+
optimisticFront: boolean;
|
|
7
|
+
topZIndex: number;
|
|
8
|
+
viewportScale: number;
|
|
9
|
+
onCopy: (item: NotesItem) => void;
|
|
10
|
+
onOpenContextMenu: (event: MouseEvent, item: NotesItem) => void;
|
|
11
|
+
onOpenEditor: (noteID: string) => void;
|
|
12
|
+
onMoveToTrash: (noteID: string) => void;
|
|
13
|
+
onStartOptimisticFront: (noteID: string) => void;
|
|
14
|
+
onCommitFront: (noteID: string) => void;
|
|
15
|
+
onCommitMove: (noteID: string, position: NotesPoint) => Promise<void> | void;
|
|
16
|
+
}
|
|
17
|
+
export declare function NotesBoardNote(props: NotesBoardNoteProps): JSX.Element;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { insert as m, createComponent as _, memo as T, effect as z, className as F, setStyleProperty as b, template as W, delegateEvents as N } from "solid-js/web";
|
|
2
|
+
import { createSignal as O, onCleanup as A, untrack as P, createMemo as h } from "solid-js";
|
|
3
|
+
import { startHotInteraction as B } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { GripVertical as G, Pencil as H, Trash as V, Check as Z } from "../icons/index.js";
|
|
5
|
+
import { notePreviewMetrics as j, getNotePreviewText as q, noteColorClass as J, samePoint as K } from "./notesOverlayHelpers.js";
|
|
6
|
+
var Q = /* @__PURE__ */ W('<article data-floe-geometry-surface=notes-note><div class=notes-note__surface><header class=notes-note__header><button type=button class=notes-note__drag aria-label="Drag note"data-floe-canvas-interactive=true></button><div class=notes-note__actions><button type=button class=notes-note__icon-button data-floe-canvas-interactive=true aria-label="Edit note"></button><button type=button class="notes-note__icon-button is-danger"data-floe-canvas-interactive=true aria-label="Move note to trash"></button></div></header><button type=button class=notes-note__body data-floe-canvas-interactive=true data-floe-canvas-pan-surface=true><span>'), R = /* @__PURE__ */ W("<div class=notes-note__copied-state aria-hidden=true><div class=notes-note__copied-pill><span class=notes-note__copied-icon></span><span class=notes-note__copied-copy>Copied");
|
|
7
|
+
function nt(t) {
|
|
8
|
+
const [v, w] = O(null);
|
|
9
|
+
let c;
|
|
10
|
+
A(() => {
|
|
11
|
+
c?.abort(), c = void 0, P(v)?.stopInteraction();
|
|
12
|
+
});
|
|
13
|
+
const $ = h(() => j(t.item)), D = h(() => q(t.item.body, $().preview_limit)), L = h(() => !t.item.body.trim()), C = () => v() !== null, y = h(() => {
|
|
14
|
+
const e = v();
|
|
15
|
+
return e ? {
|
|
16
|
+
x: e.worldX,
|
|
17
|
+
y: e.worldY
|
|
18
|
+
} : {
|
|
19
|
+
x: t.item.x,
|
|
20
|
+
y: t.item.y
|
|
21
|
+
};
|
|
22
|
+
}), I = (e) => {
|
|
23
|
+
const i = P(v);
|
|
24
|
+
if (!i || (i.stopInteraction(), w(null), c?.abort(), c = void 0, t.onCommitFront(t.item.note_id), !e)) return;
|
|
25
|
+
const r = {
|
|
26
|
+
x: i.worldX,
|
|
27
|
+
y: i.worldY
|
|
28
|
+
}, s = {
|
|
29
|
+
x: i.startWorldX,
|
|
30
|
+
y: i.startWorldY
|
|
31
|
+
};
|
|
32
|
+
K(r, s) || t.onCommitMove(t.item.note_id, r);
|
|
33
|
+
}, E = (e) => {
|
|
34
|
+
if (e.button !== 0) return;
|
|
35
|
+
e.preventDefault(), e.stopPropagation(), c?.abort(), t.onStartOptimisticFront(t.item.note_id);
|
|
36
|
+
const i = B({
|
|
37
|
+
kind: "drag",
|
|
38
|
+
cursor: "grabbing"
|
|
39
|
+
}), r = Math.max(t.viewportScale, 1e-3);
|
|
40
|
+
w({
|
|
41
|
+
pointerId: e.pointerId,
|
|
42
|
+
startClientX: e.clientX,
|
|
43
|
+
startClientY: e.clientY,
|
|
44
|
+
startWorldX: t.item.x,
|
|
45
|
+
startWorldY: t.item.y,
|
|
46
|
+
worldX: t.item.x,
|
|
47
|
+
worldY: t.item.y,
|
|
48
|
+
moved: !1,
|
|
49
|
+
scale: r,
|
|
50
|
+
stopInteraction: i
|
|
51
|
+
});
|
|
52
|
+
const s = (a) => {
|
|
53
|
+
w((n) => {
|
|
54
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
55
|
+
const o = n.startWorldX + (a.clientX - n.startClientX) / n.scale, l = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
|
|
56
|
+
return {
|
|
57
|
+
...n,
|
|
58
|
+
worldX: o,
|
|
59
|
+
worldY: l,
|
|
60
|
+
moved: n.moved || Math.abs(o - n.startWorldX) > 2 || Math.abs(l - n.startWorldY) > 2
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}, x = (a) => {
|
|
64
|
+
a.pointerId === e.pointerId && I(!0);
|
|
65
|
+
}, u = (a) => {
|
|
66
|
+
a.pointerId === e.pointerId && I(!1);
|
|
67
|
+
}, d = new AbortController();
|
|
68
|
+
c = d, window.addEventListener("pointermove", s, {
|
|
69
|
+
signal: d.signal
|
|
70
|
+
}), window.addEventListener("pointerup", x, {
|
|
71
|
+
once: !0,
|
|
72
|
+
signal: d.signal
|
|
73
|
+
}), window.addEventListener("pointercancel", u, {
|
|
74
|
+
once: !0,
|
|
75
|
+
signal: d.signal
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return (() => {
|
|
79
|
+
var e = Q(), i = e.firstChild, r = i.firstChild, s = r.firstChild, x = s.nextSibling, u = x.firstChild, d = u.nextSibling, a = r.nextSibling, n = a.firstChild;
|
|
80
|
+
return e.$$click = () => t.onCommitFront(t.item.note_id), e.$$contextmenu = (o) => {
|
|
81
|
+
o.preventDefault(), o.stopPropagation(), t.onOpenContextMenu(o, t.item);
|
|
82
|
+
}, s.$$pointerdown = E, m(s, _(G, {
|
|
83
|
+
class: "w-3.5 h-3.5"
|
|
84
|
+
})), u.$$click = () => t.onOpenEditor(t.item.note_id), m(u, _(H, {
|
|
85
|
+
class: "w-3.5 h-3.5"
|
|
86
|
+
})), d.$$click = () => t.onMoveToTrash(t.item.note_id), m(d, _(V, {
|
|
87
|
+
class: "w-3.5 h-3.5"
|
|
88
|
+
})), a.$$click = () => t.onCopy(t.item), m(n, D), m(i, (() => {
|
|
89
|
+
var o = T(() => !!t.copied);
|
|
90
|
+
return () => o() ? (() => {
|
|
91
|
+
var l = R(), g = l.firstChild, f = g.firstChild;
|
|
92
|
+
return m(f, _(Z, {
|
|
93
|
+
class: "w-3.5 h-3.5"
|
|
94
|
+
})), l;
|
|
95
|
+
})() : null;
|
|
96
|
+
})(), null), z((o) => {
|
|
97
|
+
var l = `${J(t.item.color_token)} notes-note notes-note--size-${t.item.size_bucket - 1}`, g = !!t.copied, f = !!C(), X = `translate(${y().x}px, ${y().y}px)`, Y = `${$().width}px`, k = `${$().height}px`, M = C() || t.optimisticFront ? `${t.topZIndex + 1}` : `${t.item.z_index}`, S = !!L();
|
|
98
|
+
return l !== o.e && F(e, o.e = l), g !== o.t && e.classList.toggle("is-copied", o.t = g), f !== o.a && e.classList.toggle("is-dragging", o.a = f), X !== o.o && b(e, "transform", o.o = X), Y !== o.i && b(e, "--note-width", o.i = Y), k !== o.n && b(e, "--note-height", o.n = k), M !== o.s && b(e, "z-index", o.s = M), S !== o.h && a.classList.toggle("is-empty", o.h = S), o;
|
|
99
|
+
}, {
|
|
100
|
+
e: void 0,
|
|
101
|
+
t: void 0,
|
|
102
|
+
a: void 0,
|
|
103
|
+
o: void 0,
|
|
104
|
+
i: void 0,
|
|
105
|
+
n: void 0,
|
|
106
|
+
s: void 0,
|
|
107
|
+
h: void 0
|
|
108
|
+
}), e;
|
|
109
|
+
})();
|
|
110
|
+
}
|
|
111
|
+
N(["contextmenu", "click", "pointerdown"]);
|
|
112
|
+
export {
|
|
113
|
+
nt as NotesBoardNote
|
|
114
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { use as E, insert as
|
|
1
|
+
import { use as E, insert as i, createComponent as m, addEventListener as T, effect as v, className as f, setStyleProperty as d, template as s, delegateEvents as N } from "solid-js/web";
|
|
2
2
|
import { For as x } from "solid-js";
|
|
3
3
|
import { cn as C } from "../../utils/cn.js";
|
|
4
|
-
var O = /* @__PURE__ */
|
|
4
|
+
var O = /* @__PURE__ */ s('<div role=menu class="notes-context-menu notes-menu">'), h = /* @__PURE__ */ s("<div role=separator aria-orientation=horizontal class=notes-context-menu__separator>"), I = /* @__PURE__ */ s("<button type=button role=menuitem><span class=notes-context-menu__label>");
|
|
5
5
|
const H = 188, M = 16, X = 32, P = 9;
|
|
6
6
|
function S(t) {
|
|
7
7
|
return t.kind === "action";
|
|
@@ -13,8 +13,8 @@ function R(t) {
|
|
|
13
13
|
return (() => {
|
|
14
14
|
var n = O();
|
|
15
15
|
n.$$contextmenu = (e) => e.preventDefault();
|
|
16
|
-
var
|
|
17
|
-
return typeof
|
|
16
|
+
var c = t.menuRef;
|
|
17
|
+
return typeof c == "function" ? E(c, n) : t.menuRef = n, i(n, m(x, {
|
|
18
18
|
get each() {
|
|
19
19
|
return t.items;
|
|
20
20
|
},
|
|
@@ -24,10 +24,10 @@ function R(t) {
|
|
|
24
24
|
const a = e.icon;
|
|
25
25
|
return (() => {
|
|
26
26
|
var o = I(), u = o.firstChild;
|
|
27
|
-
return T(o, "click", e.onSelect, !0),
|
|
27
|
+
return T(o, "click", e.onSelect, !0), i(o, m(a, {
|
|
28
28
|
class: "h-3.5 w-3.5"
|
|
29
|
-
}), u),
|
|
30
|
-
var l = C("notes-context-menu__item", e.destructive && "is-destructive"), _ = e.disabled;
|
|
29
|
+
}), u), i(u, () => e.label), v((r) => {
|
|
30
|
+
var l = C("notes-context-menu__item notes-menu__item", e.destructive && "is-destructive is-danger"), _ = e.disabled;
|
|
31
31
|
return l !== r.e && f(o, r.e = l), _ !== r.t && (o.disabled = r.t = _), r;
|
|
32
32
|
}, {
|
|
33
33
|
e: void 0,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type NoteColorToken, type NotesItem } from './types';
|
|
2
|
+
export interface NotesEditorFlyoutProps {
|
|
3
|
+
note: NotesItem | undefined;
|
|
4
|
+
draftBody: string;
|
|
5
|
+
draftColor: NoteColorToken;
|
|
6
|
+
onDraftBodyChange: (value: string) => void;
|
|
7
|
+
onDraftColorChange: (value: NoteColorToken) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
onSave: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function NotesEditorFlyout(props: NotesEditorFlyoutProps): import("solid-js").JSX.Element;
|
|
12
|
+
export interface NotesManualPasteFlyoutProps {
|
|
13
|
+
open: boolean;
|
|
14
|
+
text: string;
|
|
15
|
+
onTextChange: (value: string) => void;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
onConfirm: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function NotesManualPasteFlyout(props: NotesManualPasteFlyoutProps): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { insert as e, createComponent as l, effect as w, className as T, template as f, delegateEvents as E } from "solid-js/web";
|
|
2
|
+
import { For as O, Show as k } from "solid-js";
|
|
3
|
+
import { X as m } from "../icons/index.js";
|
|
4
|
+
import { NOTE_COLOR_LABELS as N } from "./notesAppearance.js";
|
|
5
|
+
import { noteColorClass as L } from "./notesOverlayHelpers.js";
|
|
6
|
+
import { NOTE_COLOR_TOKENS as B } from "./types.js";
|
|
7
|
+
import { Textarea as y } from "../ui/Input.js";
|
|
8
|
+
import { Button as v } from "../ui/Button.js";
|
|
9
|
+
var P = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--editor"><div class=notes-flyout__header><div><div class=notes-editor__label>Edit note</div><div class=notes-flyout__title></div></div><button type=button class=notes-flyout__close aria-label="Close editor"></button></div><div class=notes-editor><div class=notes-editor__palette><div class=notes-editor__label>Color</div><div class=notes-editor__swatches></div></div><div class=notes-editor__field><div class=notes-editor__label>Text</div></div></div><div class=notes-flyout__footer>'), F = /* @__PURE__ */ f("<button type=button><span>"), R = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--paste"><div class=notes-flyout__header><div><div class=notes-editor__label>Manual paste</div><div class=notes-flyout__title>Clipboard access was unavailable</div></div><button type=button class=notes-flyout__close aria-label="Close paste panel"></button></div><div class=notes-flyout__body></div><div class=notes-flyout__footer>');
|
|
10
|
+
function z(t) {
|
|
11
|
+
return (() => {
|
|
12
|
+
var i = P(), r = i.firstChild, c = r.firstChild, u = c.firstChild, _ = u.nextSibling, a = c.nextSibling, n = r.nextSibling, C = n.firstChild, x = C.firstChild, S = x.nextSibling, h = C.nextSibling;
|
|
13
|
+
h.firstChild;
|
|
14
|
+
var g = n.nextSibling;
|
|
15
|
+
return i.$$pointerdown = (o) => o.stopPropagation(), e(_, () => t.note?.body.trim() ? "Refine note" : "Compose note"), a.$$click = () => t.onClose(), e(a, l(m, {
|
|
16
|
+
class: "w-4 h-4"
|
|
17
|
+
})), e(S, l(O, {
|
|
18
|
+
each: B,
|
|
19
|
+
children: (o) => (() => {
|
|
20
|
+
var s = F(), p = s.firstChild;
|
|
21
|
+
return s.$$click = () => t.onDraftColorChange(o), e(p, () => N[o]), w((d) => {
|
|
22
|
+
var $ = `notes-editor__swatch ${L(o)}`, b = t.draftColor === o;
|
|
23
|
+
return $ !== d.e && T(s, d.e = $), b !== d.t && s.classList.toggle("is-active", d.t = b), d;
|
|
24
|
+
}, {
|
|
25
|
+
e: void 0,
|
|
26
|
+
t: void 0
|
|
27
|
+
}), s;
|
|
28
|
+
})()
|
|
29
|
+
})), e(h, l(y, {
|
|
30
|
+
"data-floe-autofocus": !0,
|
|
31
|
+
rows: 10,
|
|
32
|
+
get value() {
|
|
33
|
+
return t.draftBody;
|
|
34
|
+
},
|
|
35
|
+
onInput: (o) => t.onDraftBodyChange(o.currentTarget.value),
|
|
36
|
+
placeholder: "Type or paste anything worth keeping..."
|
|
37
|
+
}), null), e(g, l(v, {
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
get onClick() {
|
|
40
|
+
return t.onClose;
|
|
41
|
+
},
|
|
42
|
+
children: "Cancel"
|
|
43
|
+
}), null), e(g, l(v, {
|
|
44
|
+
variant: "primary",
|
|
45
|
+
get onClick() {
|
|
46
|
+
return t.onSave;
|
|
47
|
+
},
|
|
48
|
+
children: "Save"
|
|
49
|
+
}), null), i;
|
|
50
|
+
})();
|
|
51
|
+
}
|
|
52
|
+
function G(t) {
|
|
53
|
+
return l(k, {
|
|
54
|
+
get when() {
|
|
55
|
+
return t.open;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
var i = R(), r = i.firstChild, c = r.firstChild, u = c.nextSibling, _ = r.nextSibling, a = _.nextSibling;
|
|
59
|
+
return i.$$pointerdown = (n) => n.stopPropagation(), u.$$click = () => t.onClose(), e(u, l(m, {
|
|
60
|
+
class: "w-4 h-4"
|
|
61
|
+
})), e(_, l(y, {
|
|
62
|
+
"data-floe-autofocus": !0,
|
|
63
|
+
rows: 12,
|
|
64
|
+
get value() {
|
|
65
|
+
return t.text;
|
|
66
|
+
},
|
|
67
|
+
onInput: (n) => t.onTextChange(n.currentTarget.value),
|
|
68
|
+
placeholder: "Paste clipboard text here..."
|
|
69
|
+
})), e(a, l(v, {
|
|
70
|
+
variant: "ghost",
|
|
71
|
+
get onClick() {
|
|
72
|
+
return t.onClose;
|
|
73
|
+
},
|
|
74
|
+
children: "Cancel"
|
|
75
|
+
}), null), e(a, l(v, {
|
|
76
|
+
variant: "primary",
|
|
77
|
+
get disabled() {
|
|
78
|
+
return !t.text.trim();
|
|
79
|
+
},
|
|
80
|
+
get onClick() {
|
|
81
|
+
return t.onConfirm;
|
|
82
|
+
},
|
|
83
|
+
children: "Create note"
|
|
84
|
+
}), null), i;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
E(["pointerdown", "click"]);
|
|
89
|
+
export {
|
|
90
|
+
z as NotesEditorFlyout,
|
|
91
|
+
G as NotesManualPasteFlyout
|
|
92
|
+
};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { NotesController } from './types';
|
|
2
|
+
export type NotesOverlayInteractionMode = 'modal' | 'floating';
|
|
3
|
+
export interface NotesOverlayProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
controller: NotesController;
|
|
7
|
+
interactionMode?: NotesOverlayInteractionMode;
|
|
8
|
+
}
|
|
9
|
+
export declare function NotesOverlay(props: NotesOverlayProps): import("solid-js").JSX.Element;
|