rimelight-components 2.1.37 → 2.1.39
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/module.d.mts +9 -0
- package/dist/module.d.ts +9 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +15 -1
- package/dist/runtime/auth/index.d.ts +3 -0
- package/dist/runtime/auth/index.js +3 -0
- package/dist/runtime/auth/index.mjs +3 -0
- package/dist/runtime/auth/permissions.d.ts +201 -0
- package/dist/runtime/auth/permissions.js +32 -0
- package/dist/runtime/auth/permissions.mjs +32 -0
- package/dist/runtime/auth/restricted-usernames.d.ts +25 -0
- package/dist/runtime/auth/restricted-usernames.js +236 -0
- package/dist/runtime/auth/restricted-usernames.mjs +236 -0
- package/dist/runtime/auth/utils.d.ts +10 -0
- package/dist/runtime/auth/utils.js +20 -0
- package/dist/runtime/auth/utils.mjs +20 -0
- package/dist/runtime/components/FloatingToolsOverlay.d.vue.ts +3 -0
- package/dist/runtime/components/FloatingToolsOverlay.vue +74 -0
- package/dist/runtime/components/FloatingToolsOverlay.vue.d.ts +3 -0
- package/dist/runtime/components/app/Footer.vue +1 -1
- package/dist/runtime/components/app/Header.vue +1 -1
- package/dist/runtime/components/app/Image.vue +1 -1
- package/dist/runtime/components/app/Logo.vue +1 -1
- package/dist/runtime/components/app/NewsletterSignup.vue +1 -1
- package/dist/runtime/components/app/ScrollToTop.vue +1 -1
- package/dist/runtime/components/cards/TeamCard.vue +1 -1
- package/dist/runtime/components/content/Callout.vue +1 -1
- package/dist/runtime/components/content/Section.vue +1 -1
- package/dist/runtime/components/dashboard/NotificationsSlideover.d.vue.ts +3 -0
- package/dist/runtime/components/dashboard/NotificationsSlideover.vue +49 -0
- package/dist/runtime/components/dashboard/NotificationsSlideover.vue.d.ts +3 -0
- package/dist/runtime/components/dashboard/QuickActions.d.vue.ts +3 -0
- package/dist/runtime/components/dashboard/QuickActions.vue +36 -0
- package/dist/runtime/components/dashboard/QuickActions.vue.d.ts +3 -0
- package/dist/runtime/components/dashboard/TeamsMenu.d.vue.ts +6 -0
- package/dist/runtime/components/dashboard/TeamsMenu.vue +77 -0
- package/dist/runtime/components/dashboard/TeamsMenu.vue.d.ts +6 -0
- package/dist/runtime/components/dashboard/customers/AddModal.d.vue.ts +3 -0
- package/dist/runtime/components/dashboard/customers/AddModal.vue +45 -0
- package/dist/runtime/components/dashboard/customers/AddModal.vue.d.ts +3 -0
- package/dist/runtime/components/dashboard/customers/DeleteModal.d.vue.ts +16 -0
- package/dist/runtime/components/dashboard/customers/DeleteModal.vue +28 -0
- package/dist/runtime/components/dashboard/customers/DeleteModal.vue.d.ts +16 -0
- package/dist/runtime/components/dashboard/floating-tools/FocusTimerTool.d.vue.ts +3 -0
- package/dist/runtime/components/dashboard/floating-tools/FocusTimerTool.vue +37 -0
- package/dist/runtime/components/dashboard/floating-tools/FocusTimerTool.vue.d.ts +3 -0
- package/dist/runtime/components/headings/H1.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H1.vue +9 -0
- package/dist/runtime/components/headings/H1.vue.d.ts +13 -0
- package/dist/runtime/components/headings/H2.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H2.vue +9 -0
- package/dist/runtime/components/headings/H2.vue.d.ts +13 -0
- package/dist/runtime/components/headings/H3.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H3.vue +9 -0
- package/dist/runtime/components/headings/H3.vue.d.ts +13 -0
- package/dist/runtime/components/headings/H4.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H4.vue +9 -0
- package/dist/runtime/components/headings/H4.vue.d.ts +13 -0
- package/dist/runtime/components/headings/H5.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H5.vue +9 -0
- package/dist/runtime/components/headings/H5.vue.d.ts +13 -0
- package/dist/runtime/components/headings/H6.d.vue.ts +13 -0
- package/dist/runtime/components/headings/H6.vue +9 -0
- package/dist/runtime/components/headings/H6.vue.d.ts +13 -0
- package/dist/runtime/components/modals/ConfirmModal.d.vue.ts +3 -0
- package/dist/runtime/components/modals/ConfirmModal.vue +36 -0
- package/dist/runtime/components/modals/ConfirmModal.vue.d.ts +3 -0
- package/dist/runtime/components/nodes/LinkNode.vue +1 -1
- package/dist/runtime/components/nodes/TextNode.vue +1 -1
- package/dist/runtime/components/notes/NoteCard.d.vue.ts +31 -0
- package/dist/runtime/components/notes/NoteCard.vue +86 -0
- package/dist/runtime/components/notes/NoteCard.vue.d.ts +31 -0
- package/dist/runtime/components/notes/NoteModal.d.vue.ts +35 -0
- package/dist/runtime/components/notes/NoteModal.vue +224 -0
- package/dist/runtime/components/notes/NoteModal.vue.d.ts +35 -0
- package/dist/runtime/components/page/PageMention.vue +1 -1
- package/dist/runtime/components/page/PageSurround.vue +1 -1
- package/dist/runtime/components/page/PageTOC.vue +1 -1
- package/dist/runtime/components/swatches/ColorSwatch.vue +1 -1
- package/dist/runtime/components/swatches/FontSwatch.vue +1 -1
- package/dist/runtime/components/swatches/ImageSwatch.vue +1 -1
- package/dist/runtime/components/utilities/Placeholder.vue +1 -1
- package/dist/runtime/composables/app/index.d.ts +4 -0
- package/dist/runtime/composables/app/index.js +4 -0
- package/dist/runtime/composables/app/index.mjs +4 -0
- package/dist/runtime/composables/app/useApi.d.ts +9 -0
- package/dist/runtime/composables/app/useApi.js +56 -0
- package/dist/runtime/composables/app/useApi.mjs +56 -0
- package/dist/runtime/composables/app/useConfirm.d.ts +18 -0
- package/dist/runtime/composables/app/useConfirm.js +56 -0
- package/dist/runtime/composables/app/useConfirm.mjs +56 -0
- package/dist/runtime/composables/components/index.d.ts +1 -0
- package/dist/runtime/composables/components/index.js +1 -0
- package/dist/runtime/composables/components/index.mjs +1 -0
- package/dist/runtime/composables/dashboard/index.d.ts +5 -0
- package/dist/runtime/composables/dashboard/index.js +5 -0
- package/dist/runtime/composables/dashboard/index.mjs +5 -0
- package/dist/runtime/composables/dashboard/useDashboard.d.ts +3 -0
- package/dist/runtime/composables/dashboard/useDashboard.js +18 -0
- package/dist/runtime/composables/dashboard/useDashboard.mjs +18 -0
- package/dist/runtime/composables/dashboard/useFloatingTools.d.ts +19 -0
- package/dist/runtime/composables/dashboard/useFloatingTools.js +44 -0
- package/dist/runtime/composables/dashboard/useFloatingTools.mjs +44 -0
- package/dist/runtime/composables/dashboard/useFocusTimer.d.ts +44 -0
- package/dist/runtime/composables/dashboard/useFocusTimer.js +141 -0
- package/dist/runtime/composables/dashboard/useFocusTimer.mjs +141 -0
- package/dist/runtime/composables/dashboard/useNotes.d.ts +9 -0
- package/dist/runtime/composables/dashboard/useNotes.js +57 -0
- package/dist/runtime/composables/dashboard/useNotes.mjs +57 -0
- package/dist/runtime/composables/dashboard/useQuickActions.d.ts +15 -0
- package/dist/runtime/composables/dashboard/useQuickActions.js +19 -0
- package/dist/runtime/composables/dashboard/useQuickActions.mjs +19 -0
- package/dist/runtime/composables/index.d.ts +4 -7
- package/dist/runtime/composables/index.js +4 -7
- package/dist/runtime/composables/index.mjs +4 -7
- package/dist/runtime/composables/pages/index.d.ts +4 -0
- package/dist/runtime/composables/pages/index.js +4 -0
- package/dist/runtime/composables/pages/index.mjs +4 -0
- package/dist/runtime/composables/{useBlockEditor.d.ts → pages/useBlockEditor.d.ts} +131 -131
- package/dist/runtime/composables/{useInfobox.d.ts → pages/useInfobox.d.ts} +1 -1
- package/dist/runtime/composables/{usePageEditor.d.ts → pages/usePageEditor.d.ts} +1 -1
- package/dist/runtime/composables/{usePageRegistry.d.ts → pages/usePageRegistry.d.ts} +2 -2
- package/dist/runtime/db/auth.d.ts +2096 -0
- package/dist/runtime/db/auth.js +268 -0
- package/dist/runtime/db/auth.mjs +268 -0
- package/dist/runtime/db/index.d.ts +1 -0
- package/dist/runtime/db/index.js +1 -0
- package/dist/runtime/db/index.mjs +1 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/index.mjs +1 -0
- package/dist/runtime/types/utils.d.ts +51 -0
- package/dist/runtime/types/utils.js +0 -0
- package/dist/runtime/types/utils.mjs +0 -0
- package/package.json +4 -2
- /package/dist/runtime/composables/{useDateRange.d.ts → app/useDateRange.d.ts} +0 -0
- /package/dist/runtime/composables/{useDateRange.js → app/useDateRange.js} +0 -0
- /package/dist/runtime/composables/{useDateRange.mjs → app/useDateRange.mjs} +0 -0
- /package/dist/runtime/composables/{useHeaderStack.d.ts → app/useHeaderStack.d.ts} +0 -0
- /package/dist/runtime/composables/{useHeaderStack.js → app/useHeaderStack.js} +0 -0
- /package/dist/runtime/composables/{useHeaderStack.mjs → app/useHeaderStack.mjs} +0 -0
- /package/dist/runtime/composables/{useRC.d.ts → components/useRC.d.ts} +0 -0
- /package/dist/runtime/composables/{useRC.js → components/useRC.js} +0 -0
- /package/dist/runtime/composables/{useRC.mjs → components/useRC.mjs} +0 -0
- /package/dist/runtime/composables/{useBlockEditor.js → pages/useBlockEditor.js} +0 -0
- /package/dist/runtime/composables/{useBlockEditor.mjs → pages/useBlockEditor.mjs} +0 -0
- /package/dist/runtime/composables/{useInfobox.js → pages/useInfobox.js} +0 -0
- /package/dist/runtime/composables/{useInfobox.mjs → pages/useInfobox.mjs} +0 -0
- /package/dist/runtime/composables/{usePageEditor.js → pages/usePageEditor.js} +0 -0
- /package/dist/runtime/composables/{usePageEditor.mjs → pages/usePageEditor.mjs} +0 -0
- /package/dist/runtime/composables/{usePageRegistry.js → pages/usePageRegistry.js} +0 -0
- /package/dist/runtime/composables/{usePageRegistry.mjs → pages/usePageRegistry.mjs} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Note } from "../../db/auth.js";
|
|
2
|
+
export interface NoteModalProps {
|
|
3
|
+
note?: Note | null;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = NoteModalProps;
|
|
6
|
+
export interface NoteModalEmits {
|
|
7
|
+
(e: "saved", note: Note): void;
|
|
8
|
+
(e: "close"): void;
|
|
9
|
+
}
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
"open"?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare var __VLS_8: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_8) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:open": (value: boolean) => any;
|
|
20
|
+
} & {
|
|
21
|
+
close: () => any;
|
|
22
|
+
saved: (note: Note) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
24
|
+
onClose?: (() => any) | undefined;
|
|
25
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
26
|
+
onSaved?: ((note: Note) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
+
import { computed, reactive, ref, watch } from "vue";
|
|
4
|
+
import { useApi, $api } from "~/src/runtime/composables";
|
|
5
|
+
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
6
|
+
const { note } = defineProps({
|
|
7
|
+
note: { type: [Object, null], required: false }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["saved", "close"]);
|
|
10
|
+
const state = reactive({
|
|
11
|
+
id: note?.id,
|
|
12
|
+
title: note?.title ?? "",
|
|
13
|
+
content: note?.content ?? "",
|
|
14
|
+
isPinned: note?.isPinned || false,
|
|
15
|
+
isArchived: note?.isArchived || false,
|
|
16
|
+
labels: note?.labels?.map((l) => l.label.id) || []
|
|
17
|
+
});
|
|
18
|
+
const { data: fetchedLabels } = useApi("/api/notes/labels", {
|
|
19
|
+
lazy: true,
|
|
20
|
+
default: () => []
|
|
21
|
+
});
|
|
22
|
+
const allLabels = ref([]);
|
|
23
|
+
watch(
|
|
24
|
+
() => fetchedLabels.value,
|
|
25
|
+
(newLabels) => {
|
|
26
|
+
if (newLabels) {
|
|
27
|
+
allLabels.value = [...newLabels];
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{ immediate: true }
|
|
31
|
+
);
|
|
32
|
+
const labelMap = computed(() => {
|
|
33
|
+
const map = /* @__PURE__ */ new Map();
|
|
34
|
+
allLabels.value.forEach((l) => map.set(l.id, l.name));
|
|
35
|
+
return map;
|
|
36
|
+
});
|
|
37
|
+
const labelItems = computed(
|
|
38
|
+
() => allLabels.value.map((l) => ({
|
|
39
|
+
label: l.name,
|
|
40
|
+
id: l.id
|
|
41
|
+
}))
|
|
42
|
+
);
|
|
43
|
+
const syncState = () => {
|
|
44
|
+
if (note) {
|
|
45
|
+
state.id = note.id;
|
|
46
|
+
state.title = note.title ?? "";
|
|
47
|
+
state.content = note.content ?? "";
|
|
48
|
+
state.isPinned = note.isPinned;
|
|
49
|
+
state.isArchived = note.isArchived;
|
|
50
|
+
state.labels = note.labels?.map((l) => l.label.id) || [];
|
|
51
|
+
} else {
|
|
52
|
+
state.id = void 0;
|
|
53
|
+
state.title = "";
|
|
54
|
+
state.content = "";
|
|
55
|
+
state.isPinned = false;
|
|
56
|
+
state.isArchived = false;
|
|
57
|
+
state.labels = [];
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
watch(() => note, syncState);
|
|
61
|
+
const saveNote = async () => {
|
|
62
|
+
if (!state.title.trim() && !state.content.trim()) return;
|
|
63
|
+
try {
|
|
64
|
+
let savedNote;
|
|
65
|
+
const payload = {
|
|
66
|
+
title: state.title.trim() || "",
|
|
67
|
+
content: state.content.trim() || "",
|
|
68
|
+
isPinned: state.isPinned,
|
|
69
|
+
isArchived: state.isArchived,
|
|
70
|
+
labels: state.labels
|
|
71
|
+
};
|
|
72
|
+
if (state.id) {
|
|
73
|
+
savedNote = await $api(`/api/notes/${state.id}`, {
|
|
74
|
+
method: "PUT",
|
|
75
|
+
body: payload
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
const createPayload = {
|
|
79
|
+
title: payload.title,
|
|
80
|
+
content: payload.content,
|
|
81
|
+
isPinned: payload.isPinned,
|
|
82
|
+
isArchived: payload.isArchived
|
|
83
|
+
};
|
|
84
|
+
savedNote = await $api("/api/notes", {
|
|
85
|
+
method: "POST",
|
|
86
|
+
body: createPayload
|
|
87
|
+
});
|
|
88
|
+
state.id = savedNote.id;
|
|
89
|
+
if (state.labels.length > 0) {
|
|
90
|
+
savedNote = await $api(`/api/notes/${state.id}`, {
|
|
91
|
+
method: "PUT",
|
|
92
|
+
body: { labels: state.labels }
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
emit("saved", savedNote);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.error("Failed to save note", e);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const createLabel = async (newLabelName) => {
|
|
102
|
+
try {
|
|
103
|
+
const createdLabel = await $api("/api/notes/labels", {
|
|
104
|
+
method: "POST",
|
|
105
|
+
body: { name: newLabelName }
|
|
106
|
+
});
|
|
107
|
+
allLabels.value.push(createdLabel);
|
|
108
|
+
if (!state.labels.includes(createdLabel.id)) {
|
|
109
|
+
state.labels.push(createdLabel.id);
|
|
110
|
+
}
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.error("Failed to create new label", e);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const debouncedSave = useDebounceFn(saveNote, 1e3);
|
|
116
|
+
watch(
|
|
117
|
+
() => [
|
|
118
|
+
state.title,
|
|
119
|
+
state.content,
|
|
120
|
+
state.isPinned,
|
|
121
|
+
state.isArchived,
|
|
122
|
+
state.labels
|
|
123
|
+
],
|
|
124
|
+
() => {
|
|
125
|
+
debouncedSave();
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
watch(open, (isOpen) => {
|
|
129
|
+
if (isOpen) {
|
|
130
|
+
syncState();
|
|
131
|
+
} else {
|
|
132
|
+
saveNote();
|
|
133
|
+
emit("close");
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<template>
|
|
139
|
+
<UModal v-model:open="open" :ui="{ content: 'p-md flex flex-col' }">
|
|
140
|
+
<slot />
|
|
141
|
+
<template #content>
|
|
142
|
+
<div class="flex flex-row justify-between gap-sm">
|
|
143
|
+
<div class="flex w-full flex-col">
|
|
144
|
+
<UInput
|
|
145
|
+
v-model="state.title"
|
|
146
|
+
class="flex-1 font-bold"
|
|
147
|
+
placeholder="Title"
|
|
148
|
+
size="xl"
|
|
149
|
+
type="text"
|
|
150
|
+
variant="none"
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
<div v-if="state.labels.length > 0" class="flex flex-wrap gap-sm px-sm">
|
|
154
|
+
<UBadge
|
|
155
|
+
v-for="labelId in state.labels"
|
|
156
|
+
:key="labelId"
|
|
157
|
+
color="neutral"
|
|
158
|
+
size="md"
|
|
159
|
+
variant="soft"
|
|
160
|
+
>
|
|
161
|
+
{{ labelMap.get(labelId) || "Unknown" }}
|
|
162
|
+
</UBadge>
|
|
163
|
+
</div>
|
|
164
|
+
<UTextarea
|
|
165
|
+
v-model="state.content"
|
|
166
|
+
:maxrows="16"
|
|
167
|
+
:rows="2"
|
|
168
|
+
autoresize
|
|
169
|
+
class="w-full"
|
|
170
|
+
placeholder="Take a note..."
|
|
171
|
+
size="lg"
|
|
172
|
+
variant="none"
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="flex flex-col gap-xs">
|
|
176
|
+
<UButton
|
|
177
|
+
:icon="state.isPinned ? 'lucide:pin-off' : 'lucide:pin'"
|
|
178
|
+
color="neutral"
|
|
179
|
+
variant="ghost"
|
|
180
|
+
@click="state.isPinned = !state.isPinned"
|
|
181
|
+
/>
|
|
182
|
+
<UButton
|
|
183
|
+
:color="state.isArchived ? 'primary' : 'neutral'"
|
|
184
|
+
:icon="
|
|
185
|
+
state.isArchived ? 'lucide:archive-x' : 'lucide:archive-restore'
|
|
186
|
+
"
|
|
187
|
+
size="sm"
|
|
188
|
+
variant="ghost"
|
|
189
|
+
@click="state.isArchived = !state.isArchived"
|
|
190
|
+
/>
|
|
191
|
+
<UButton color="error" icon="lucide:trash-2" size="sm" variant="ghost" @click="" />
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
<div class="flex items-center justify-between">
|
|
195
|
+
<div class="flex flex-row gap-xs">
|
|
196
|
+
<USelectMenu
|
|
197
|
+
v-model="state.labels"
|
|
198
|
+
:arrow="true"
|
|
199
|
+
:items="labelItems"
|
|
200
|
+
:multiple="true"
|
|
201
|
+
create-item="always"
|
|
202
|
+
icon="lucide-tag"
|
|
203
|
+
label-key="label"
|
|
204
|
+
size="sm"
|
|
205
|
+
trailing-icon=""
|
|
206
|
+
value-key="id"
|
|
207
|
+
variant="ghost"
|
|
208
|
+
@create="createLabel"
|
|
209
|
+
>
|
|
210
|
+
<template #default>
|
|
211
|
+
<span class="text-dimmed">Edit Labels</span>
|
|
212
|
+
</template>
|
|
213
|
+
</USelectMenu>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="flex flex-col gap-xs">
|
|
216
|
+
<span class="text-xs text-dimmed">Last Edited: </span>
|
|
217
|
+
<span class="text-xs text-dimmed">
|
|
218
|
+
{{ state.id ? "Saved" : "Unsaved" }}
|
|
219
|
+
</span>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</template>
|
|
223
|
+
</UModal>
|
|
224
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Note } from "../../db/auth.js";
|
|
2
|
+
export interface NoteModalProps {
|
|
3
|
+
note?: Note | null;
|
|
4
|
+
}
|
|
5
|
+
type __VLS_Props = NoteModalProps;
|
|
6
|
+
export interface NoteModalEmits {
|
|
7
|
+
(e: "saved", note: Note): void;
|
|
8
|
+
(e: "close"): void;
|
|
9
|
+
}
|
|
10
|
+
type __VLS_ModelProps = {
|
|
11
|
+
"open"?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
14
|
+
declare var __VLS_8: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_8) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:open": (value: boolean) => any;
|
|
20
|
+
} & {
|
|
21
|
+
close: () => any;
|
|
22
|
+
saved: (note: Note) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
24
|
+
onClose?: (() => any) | undefined;
|
|
25
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
26
|
+
onSaved?: ((note: Note) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -5,7 +5,7 @@ import { useI18n } from "vue-i18n";
|
|
|
5
5
|
import {} from "../../types";
|
|
6
6
|
import { useAsyncData } from "#imports";
|
|
7
7
|
import { tv } from "../../internal/tv";
|
|
8
|
-
import { useRC } from "
|
|
8
|
+
import { useRC } from "~/src/runtime/composables";
|
|
9
9
|
const { pageId, rc: rcProp } = defineProps({
|
|
10
10
|
pageId: { type: String, required: true },
|
|
11
11
|
rc: { type: Object, required: false }
|
|
@@ -3,7 +3,7 @@ import { computed, ref, onMounted, watch } from "vue";
|
|
|
3
3
|
import { useI18n } from "vue-i18n";
|
|
4
4
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
5
5
|
import { tv } from "../../internal/tv";
|
|
6
|
-
import { useRC } from "
|
|
6
|
+
import { useRC } from "~/src/runtime/composables";
|
|
7
7
|
import { slugify } from "../../utils";
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
pageBlocks: { type: [Array, null], required: true },
|
|
@@ -3,7 +3,7 @@ import { computed } from "vue";
|
|
|
3
3
|
import { useClipboard } from "@vueuse/core";
|
|
4
4
|
import { useToast } from "@nuxt/ui/composables";
|
|
5
5
|
import { tv } from "../../internal/tv";
|
|
6
|
-
import { useRC } from "
|
|
6
|
+
import { useRC } from "~/src/runtime/composables";
|
|
7
7
|
const { name, hex, rgb, hsl, oklch, cmyk, rc: rcProp } = defineProps({
|
|
8
8
|
name: { type: String, required: false },
|
|
9
9
|
hex: { type: String, required: false },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { tv } from "../../internal/tv";
|
|
4
|
-
import { useRC } from "
|
|
4
|
+
import { useRC } from "~/src/runtime/composables";
|
|
5
5
|
const { name, jpg, png, webp, svg, rc: rcProp } = defineProps({
|
|
6
6
|
name: { type: String, required: false },
|
|
7
7
|
jpg: { type: String, required: false },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { tv } from "../../internal/tv";
|
|
4
|
-
import { useRC } from "
|
|
4
|
+
import { useRC } from "~/src/runtime/composables";
|
|
5
5
|
const { name, jpg, png, webp, svg, rc: rcProp } = defineProps({
|
|
6
6
|
name: { type: String, required: false },
|
|
7
7
|
jpg: { type: String, required: false },
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UseFetchOptions, AsyncData } from "#app";
|
|
2
|
+
/**
|
|
3
|
+
* $api: For imperative calls (buttons, save actions, Pinia Colada)
|
|
4
|
+
*/
|
|
5
|
+
export declare const $api: <T>(path: string, opts?: any) => Promise<import("nitropack").TypedInternalResponse<import("nitropack").NitroFetchRequest, T, "get">>;
|
|
6
|
+
/**
|
|
7
|
+
* useApi: For reactive data fetching in setup
|
|
8
|
+
*/
|
|
9
|
+
export declare const useApi: <T>(path: string | (() => string), opts?: UseFetchOptions<T>) => AsyncData<T, Error | null>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useFetch, useRuntimeConfig } from "#imports";
|
|
2
|
+
import { fetch as tauriFetch } from "@tauri-apps/plugin-http";
|
|
3
|
+
import { hash } from "ohash";
|
|
4
|
+
export const $api = async (path, opts = {}) => {
|
|
5
|
+
const config = useRuntimeConfig();
|
|
6
|
+
const apiBase = config.public.apiBase;
|
|
7
|
+
const isTauri = config.public.isTauri;
|
|
8
|
+
let isExternal = isTauri;
|
|
9
|
+
if (!isExternal && !import.meta.dev && import.meta.client) {
|
|
10
|
+
try {
|
|
11
|
+
if (apiBase.startsWith("http")) {
|
|
12
|
+
const apiHost = new URL(apiBase).hostname;
|
|
13
|
+
if (!window.location.hostname.includes(apiHost)) {
|
|
14
|
+
isExternal = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const baseURL = isExternal ? apiBase : "";
|
|
21
|
+
return $fetch(path, {
|
|
22
|
+
baseURL,
|
|
23
|
+
...opts,
|
|
24
|
+
fetch: isTauri ? tauriFetch : void 0,
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
...opts.headers
|
|
28
|
+
},
|
|
29
|
+
credentials: "include"
|
|
30
|
+
// Important for shared cookies if cross-subdomain
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export const useApi = (path, opts = {}) => {
|
|
34
|
+
const config = useRuntimeConfig();
|
|
35
|
+
const apiBase = config.public.apiBase;
|
|
36
|
+
const isTauri = config.public.isTauri;
|
|
37
|
+
let isExternal = isTauri;
|
|
38
|
+
if (!isExternal && !import.meta.dev && import.meta.client) {
|
|
39
|
+
try {
|
|
40
|
+
if (apiBase.startsWith("http")) {
|
|
41
|
+
const apiHost = new URL(apiBase).hostname;
|
|
42
|
+
if (!window.location.hostname.includes(apiHost)) {
|
|
43
|
+
isExternal = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (e) {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return useFetch(path, {
|
|
50
|
+
baseURL: isExternal ? apiBase : "",
|
|
51
|
+
...opts,
|
|
52
|
+
fetch: isTauri ? tauriFetch : void 0,
|
|
53
|
+
// Key ensures unique state tracking in Nuxt
|
|
54
|
+
key: opts.key || hash([path, typeof path === "function" ? path() : path])
|
|
55
|
+
});
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useFetch, useRuntimeConfig } from "#imports";
|
|
2
|
+
import { fetch as tauriFetch } from "@tauri-apps/plugin-http";
|
|
3
|
+
import { hash } from "ohash";
|
|
4
|
+
export const $api = async (path, opts = {}) => {
|
|
5
|
+
const config = useRuntimeConfig();
|
|
6
|
+
const apiBase = config.public.apiBase;
|
|
7
|
+
const isTauri = config.public.isTauri;
|
|
8
|
+
let isExternal = isTauri;
|
|
9
|
+
if (!isExternal && !import.meta.dev && import.meta.client) {
|
|
10
|
+
try {
|
|
11
|
+
if (apiBase.startsWith("http")) {
|
|
12
|
+
const apiHost = new URL(apiBase).hostname;
|
|
13
|
+
if (!window.location.hostname.includes(apiHost)) {
|
|
14
|
+
isExternal = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const baseURL = isExternal ? apiBase : "";
|
|
21
|
+
return $fetch(path, {
|
|
22
|
+
baseURL,
|
|
23
|
+
...opts,
|
|
24
|
+
fetch: isTauri ? tauriFetch : void 0,
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: "application/json",
|
|
27
|
+
...opts.headers
|
|
28
|
+
},
|
|
29
|
+
credentials: "include"
|
|
30
|
+
// Important for shared cookies if cross-subdomain
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export const useApi = (path, opts = {}) => {
|
|
34
|
+
const config = useRuntimeConfig();
|
|
35
|
+
const apiBase = config.public.apiBase;
|
|
36
|
+
const isTauri = config.public.isTauri;
|
|
37
|
+
let isExternal = isTauri;
|
|
38
|
+
if (!isExternal && !import.meta.dev && import.meta.client) {
|
|
39
|
+
try {
|
|
40
|
+
if (apiBase.startsWith("http")) {
|
|
41
|
+
const apiHost = new URL(apiBase).hostname;
|
|
42
|
+
if (!window.location.hostname.includes(apiHost)) {
|
|
43
|
+
isExternal = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (e) {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return useFetch(path, {
|
|
50
|
+
baseURL: isExternal ? apiBase : "",
|
|
51
|
+
...opts,
|
|
52
|
+
fetch: isTauri ? tauriFetch : void 0,
|
|
53
|
+
// Key ensures unique state tracking in Nuxt
|
|
54
|
+
key: opts.key || hash([path, typeof path === "function" ? path() : path])
|
|
55
|
+
});
|
|
56
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ConfirmOptions {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
confirmLabel?: string;
|
|
5
|
+
cancelLabel?: string;
|
|
6
|
+
danger?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface ConfirmState {
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
options: ConfirmOptions;
|
|
11
|
+
}
|
|
12
|
+
export declare const useConfirm: () => {
|
|
13
|
+
state: import("vue").Ref<ConfirmState, ConfirmState>;
|
|
14
|
+
confirm: (opts: Partial<ConfirmOptions>) => Promise<boolean>;
|
|
15
|
+
handleConfirm: () => void;
|
|
16
|
+
handleCancel: () => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useState } from "#imports";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
let resolvePromise = null;
|
|
4
|
+
export const useConfirm = () => {
|
|
5
|
+
const state = useState("use-confirm-global-state", () => ({
|
|
6
|
+
isVisible: false,
|
|
7
|
+
options: {
|
|
8
|
+
title: "Confirm Action",
|
|
9
|
+
description: "",
|
|
10
|
+
confirmLabel: "Confirm",
|
|
11
|
+
cancelLabel: "Cancel",
|
|
12
|
+
danger: false
|
|
13
|
+
}
|
|
14
|
+
}));
|
|
15
|
+
if (import.meta.client) {
|
|
16
|
+
watch(
|
|
17
|
+
() => state.value.isVisible,
|
|
18
|
+
(visible) => {
|
|
19
|
+
if (!visible && resolvePromise) {
|
|
20
|
+
resolvePromise(false);
|
|
21
|
+
resolvePromise = null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const confirm = (opts) => {
|
|
27
|
+
state.value.options = {
|
|
28
|
+
title: "Confirm Action",
|
|
29
|
+
confirmLabel: "Confirm",
|
|
30
|
+
cancelLabel: "Cancel",
|
|
31
|
+
danger: false,
|
|
32
|
+
...opts
|
|
33
|
+
};
|
|
34
|
+
state.value.isVisible = true;
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
if (resolvePromise) resolvePromise(false);
|
|
37
|
+
resolvePromise = resolve;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const handleConfirm = () => {
|
|
41
|
+
if (resolvePromise) {
|
|
42
|
+
resolvePromise(true);
|
|
43
|
+
resolvePromise = null;
|
|
44
|
+
}
|
|
45
|
+
state.value.isVisible = false;
|
|
46
|
+
};
|
|
47
|
+
const handleCancel = () => {
|
|
48
|
+
state.value.isVisible = false;
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
state,
|
|
52
|
+
confirm,
|
|
53
|
+
handleConfirm,
|
|
54
|
+
handleCancel
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useState } from "#imports";
|
|
2
|
+
import { watch } from "vue";
|
|
3
|
+
let resolvePromise = null;
|
|
4
|
+
export const useConfirm = () => {
|
|
5
|
+
const state = useState("use-confirm-global-state", () => ({
|
|
6
|
+
isVisible: false,
|
|
7
|
+
options: {
|
|
8
|
+
title: "Confirm Action",
|
|
9
|
+
description: "",
|
|
10
|
+
confirmLabel: "Confirm",
|
|
11
|
+
cancelLabel: "Cancel",
|
|
12
|
+
danger: false
|
|
13
|
+
}
|
|
14
|
+
}));
|
|
15
|
+
if (import.meta.client) {
|
|
16
|
+
watch(
|
|
17
|
+
() => state.value.isVisible,
|
|
18
|
+
(visible) => {
|
|
19
|
+
if (!visible && resolvePromise) {
|
|
20
|
+
resolvePromise(false);
|
|
21
|
+
resolvePromise = null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const confirm = (opts) => {
|
|
27
|
+
state.value.options = {
|
|
28
|
+
title: "Confirm Action",
|
|
29
|
+
confirmLabel: "Confirm",
|
|
30
|
+
cancelLabel: "Cancel",
|
|
31
|
+
danger: false,
|
|
32
|
+
...opts
|
|
33
|
+
};
|
|
34
|
+
state.value.isVisible = true;
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
if (resolvePromise) resolvePromise(false);
|
|
37
|
+
resolvePromise = resolve;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const handleConfirm = () => {
|
|
41
|
+
if (resolvePromise) {
|
|
42
|
+
resolvePromise(true);
|
|
43
|
+
resolvePromise = null;
|
|
44
|
+
}
|
|
45
|
+
state.value.isVisible = false;
|
|
46
|
+
};
|
|
47
|
+
const handleCancel = () => {
|
|
48
|
+
state.value.isVisible = false;
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
state,
|
|
52
|
+
confirm,
|
|
53
|
+
handleConfirm,
|
|
54
|
+
handleCancel
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useRC.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useRC.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useRC.mjs";
|