@abraca/nuxt 2.49.0 → 2.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -2
- package/dist/runtime/assets/editor.css +1 -1
- package/dist/runtime/components/ADocRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/ADocRenderer.vue +23 -11
- package/dist/runtime/components/ADocRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/AEditor.d.vue.ts +2 -2
- package/dist/runtime/components/AEditor.vue.d.ts +2 -2
- package/dist/runtime/components/ASubPageList.d.vue.ts +2 -2
- package/dist/runtime/components/ASubPageList.vue.d.ts +2 -2
- package/dist/runtime/components/editor/ANodeInlineLabel.vue +3 -2
- package/dist/runtime/components/renderers/AProseRenderer.d.vue.ts +2 -2
- package/dist/runtime/components/renderers/AProseRenderer.vue.d.ts +2 -2
- package/dist/runtime/composables/useNodeView.d.ts +36 -0
- package/dist/runtime/composables/useNodeView.js +46 -0
- package/dist/runtime/extensions/callout.js +13 -3
- package/dist/runtime/extensions/views/AccordionItemView.vue +64 -13
- package/dist/runtime/extensions/views/BadgeView.vue +125 -4
- package/dist/runtime/extensions/views/ButtonGroupView.vue +2 -2
- package/dist/runtime/extensions/views/ButtonView.vue +27 -0
- package/dist/runtime/extensions/views/CalloutView.vue +68 -11
- package/dist/runtime/extensions/views/CardGroupView.vue +2 -2
- package/dist/runtime/extensions/views/CardView.vue +150 -11
- package/dist/runtime/extensions/views/CodeCollapseView.vue +8 -3
- package/dist/runtime/extensions/views/CodeGroupView.vue +104 -15
- package/dist/runtime/extensions/views/CodePreviewView.vue +1 -1
- package/dist/runtime/extensions/views/CodeTreeView.vue +241 -20
- package/dist/runtime/extensions/views/CollapsibleView.vue +45 -13
- package/dist/runtime/extensions/views/ColorSwatchView.vue +17 -1
- package/dist/runtime/extensions/views/DiffView.vue +8 -1
- package/dist/runtime/extensions/views/DividerView.vue +9 -1
- package/dist/runtime/extensions/views/DocEmbedView.vue +15 -3
- package/dist/runtime/extensions/views/DocumentMetaView.vue +3 -1
- package/dist/runtime/extensions/views/EmbedView.vue +14 -1
- package/dist/runtime/extensions/views/FieldGroupView.vue +2 -2
- package/dist/runtime/extensions/views/FieldView.vue +16 -0
- package/dist/runtime/extensions/views/FigureView.vue +18 -1
- package/dist/runtime/extensions/views/KbdView.vue +72 -2
- package/dist/runtime/extensions/views/MathBlockView.vue +26 -0
- package/dist/runtime/extensions/views/MathInlineView.vue +18 -0
- package/dist/runtime/extensions/views/MetaFieldView.vue +3 -2
- package/dist/runtime/extensions/views/ProgressView.vue +13 -0
- package/dist/runtime/extensions/views/ProseIconView.vue +33 -2
- package/dist/runtime/extensions/views/QuoteView.vue +72 -47
- package/dist/runtime/extensions/views/SpoilerView.vue +17 -5
- package/dist/runtime/extensions/views/StatGroupView.vue +2 -2
- package/dist/runtime/extensions/views/StatView.vue +13 -3
- package/dist/runtime/extensions/views/StepsView.vue +25 -2
- package/dist/runtime/extensions/views/SvgEmbedView.vue +7 -2
- package/dist/runtime/extensions/views/TabsView.vue +142 -19
- package/dist/runtime/extensions/views/TimelineItemView.vue +19 -1
- package/dist/runtime/extensions/views/TimelineView.d.vue.ts +0 -5
- package/dist/runtime/extensions/views/TimelineView.vue.d.ts +0 -5
- package/dist/runtime/extensions/views/VideoView.vue +84 -8
- package/dist/runtime/utils/docTypes.d.ts +16 -0
- package/dist/runtime/utils/docTypes.js +4 -0
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { ref, computed, watch } from "vue";
|
|
3
3
|
import { NodeViewWrapper, NodeViewContent } from "@tiptap/vue-3";
|
|
4
4
|
import ANodeInlineLabel from "../../components/editor/ANodeInlineLabel.vue";
|
|
5
5
|
import AIconPickerPopover from "../../components/editor/AIconPickerPopover.vue";
|
|
6
|
+
import { useNodeViewEditable } from "../../composables/useNodeView";
|
|
6
7
|
const props = defineProps({
|
|
7
8
|
decorations: { type: Array, required: true },
|
|
8
9
|
selected: { type: Boolean, required: true },
|
|
@@ -16,6 +17,7 @@ const props = defineProps({
|
|
|
16
17
|
extension: { type: Object, required: true },
|
|
17
18
|
HTMLAttributes: { type: Object, required: true }
|
|
18
19
|
});
|
|
20
|
+
const editable = useNodeViewEditable(props);
|
|
19
21
|
const date = computed(() => props.node.attrs.date || "");
|
|
20
22
|
const label = computed(() => props.node.attrs.label || "");
|
|
21
23
|
const icon = computed(() => props.node.attrs.icon || "");
|
|
@@ -27,13 +29,16 @@ watch(datePopoverOpen, (open) => {
|
|
|
27
29
|
if (open) dateDraft.value = date.value;
|
|
28
30
|
});
|
|
29
31
|
function setLabel(v) {
|
|
32
|
+
if (!editable.value) return;
|
|
30
33
|
props.updateAttributes({ label: v });
|
|
31
34
|
}
|
|
32
35
|
function setIcon(name) {
|
|
36
|
+
if (!editable.value) return;
|
|
33
37
|
props.updateAttributes({ icon: name ? `i-lucide-${name}` : "" });
|
|
34
38
|
iconPopoverOpen.value = false;
|
|
35
39
|
}
|
|
36
40
|
function commitDate() {
|
|
41
|
+
if (!editable.value) return;
|
|
37
42
|
props.updateAttributes({ date: dateDraft.value.trim() });
|
|
38
43
|
datePopoverOpen.value = false;
|
|
39
44
|
}
|
|
@@ -69,6 +74,7 @@ function onDateKeydown(e) {
|
|
|
69
74
|
contenteditable="false"
|
|
70
75
|
>
|
|
71
76
|
<AIconPickerPopover
|
|
77
|
+
v-if="editable"
|
|
72
78
|
:model-value="iconShort"
|
|
73
79
|
:open="iconPopoverOpen"
|
|
74
80
|
@update:model-value="setIcon"
|
|
@@ -90,9 +96,21 @@ function onDateKeydown(e) {
|
|
|
90
96
|
:model-value="label"
|
|
91
97
|
placeholder="Event"
|
|
92
98
|
variant="title"
|
|
99
|
+
:disabled="!editable"
|
|
93
100
|
@update:model-value="setLabel"
|
|
94
101
|
/>
|
|
102
|
+
<span
|
|
103
|
+
v-if="!editable && date"
|
|
104
|
+
class="text-xs text-(--ui-text-muted) px-1.5 py-0.5 inline-flex items-center gap-1"
|
|
105
|
+
>
|
|
106
|
+
<UIcon
|
|
107
|
+
name="i-lucide-calendar"
|
|
108
|
+
class="size-3"
|
|
109
|
+
/>
|
|
110
|
+
{{ date }}
|
|
111
|
+
</span>
|
|
95
112
|
<UPopover
|
|
113
|
+
v-else-if="editable"
|
|
96
114
|
v-model:open="datePopoverOpen"
|
|
97
115
|
:content="{ align: 'end' }"
|
|
98
116
|
>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeView for the `timeline` block — renders the vertical guide line.
|
|
3
|
-
*
|
|
4
|
-
* Ported 1:1 from cou-sh/app/components/editor/TimelineView.vue.
|
|
5
|
-
*/
|
|
6
1
|
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
7
2
|
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
3
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NodeView for the `timeline` block — renders the vertical guide line.
|
|
3
|
-
*
|
|
4
|
-
* Ported 1:1 from cou-sh/app/components/editor/TimelineView.vue.
|
|
5
|
-
*/
|
|
6
1
|
import type { NodeViewProps } from '@tiptap/vue-3';
|
|
7
2
|
declare const __VLS_export: import("vue").DefineComponent<NodeViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NodeViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
3
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { ref, computed, watch } from "vue";
|
|
3
3
|
import { NodeViewWrapper } from "@tiptap/vue-3";
|
|
4
4
|
import ANodeInlineLabel from "../../components/editor/ANodeInlineLabel.vue";
|
|
5
|
+
import { useNodeViewEditable } from "../../composables/useNodeView";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
decorations: { type: Array, required: true },
|
|
7
8
|
selected: { type: Boolean, required: true },
|
|
@@ -15,41 +16,79 @@ const props = defineProps({
|
|
|
15
16
|
extension: { type: Object, required: true },
|
|
16
17
|
HTMLAttributes: { type: Object, required: true }
|
|
17
18
|
});
|
|
19
|
+
const editable = useNodeViewEditable(props);
|
|
18
20
|
const src = computed(() => props.node.attrs.src || "");
|
|
19
21
|
const aspectRatio = computed(() => props.node.attrs.aspectRatio || "16/9");
|
|
20
22
|
const caption = computed(() => props.node.attrs.caption || "");
|
|
21
23
|
const srcPopoverOpen = ref(false);
|
|
22
24
|
const srcDraft = ref("");
|
|
25
|
+
const activated = ref(false);
|
|
26
|
+
watch(src, () => {
|
|
27
|
+
activated.value = false;
|
|
28
|
+
});
|
|
23
29
|
watch(srcPopoverOpen, (open) => {
|
|
24
30
|
if (open) srcDraft.value = src.value;
|
|
25
31
|
});
|
|
26
32
|
function detectProvider(url) {
|
|
27
33
|
if (!url) return "unknown";
|
|
28
|
-
if (/youtube\.com\/(watch|embed|v)|youtu\.be\//.test(url)) return "youtube";
|
|
34
|
+
if (/youtube\.com\/(?:watch|embed|v)|youtu\.be\//.test(url)) return "youtube";
|
|
29
35
|
if (/vimeo\.com\//.test(url)) return "vimeo";
|
|
30
|
-
if (
|
|
36
|
+
if (/loom\.com\/(?:share|embed)\//.test(url)) return "loom";
|
|
37
|
+
if (/twitch\.tv\//.test(url)) return "twitch";
|
|
38
|
+
if (/\.(?:mp4|webm|ogv|mov)(?:\?|$)/i.test(url)) return "direct";
|
|
31
39
|
return "unknown";
|
|
32
40
|
}
|
|
33
41
|
function youtubeId(url) {
|
|
34
|
-
const m = url.match(/(?:v=|\/embed\/|\/v\/|youtu\.be\/)([
|
|
42
|
+
const m = url.match(/(?:v=|\/embed\/|\/v\/|youtu\.be\/)([\w-]{11})/);
|
|
35
43
|
return m?.[1] ?? "";
|
|
36
44
|
}
|
|
37
45
|
function vimeoId(url) {
|
|
38
46
|
const m = url.match(/vimeo\.com\/(?:video\/)?(\d+)/);
|
|
39
47
|
return m?.[1] ?? "";
|
|
40
48
|
}
|
|
49
|
+
function loomId(url) {
|
|
50
|
+
const m = url.match(/loom\.com\/(?:share|embed)\/([a-zA-Z0-9]+)/);
|
|
51
|
+
return m?.[1] ?? "";
|
|
52
|
+
}
|
|
53
|
+
function twitchEmbed(url) {
|
|
54
|
+
const host = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
55
|
+
const vod = url.match(/twitch\.tv\/videos\/(\d+)/);
|
|
56
|
+
if (vod) return `https://player.twitch.tv/?video=${vod[1]}&parent=${host}&autoplay=true`;
|
|
57
|
+
const clip = url.match(/clips\.twitch\.tv\/([\w-]+)|twitch\.tv\/\S+\/clip\/([\w-]+)/);
|
|
58
|
+
if (clip) return `https://clips.twitch.tv/embed?clip=${clip[1] || clip[2]}&parent=${host}&autoplay=true`;
|
|
59
|
+
const channel = url.match(/twitch\.tv\/(\w+)/);
|
|
60
|
+
if (channel) return `https://player.twitch.tv/?channel=${channel[1]}&parent=${host}&autoplay=true`;
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
41
63
|
const provider = computed(() => detectProvider(src.value));
|
|
42
64
|
const embedUrl = computed(() => {
|
|
43
65
|
if (provider.value === "youtube") {
|
|
44
66
|
const id = youtubeId(src.value);
|
|
45
|
-
return id ? `https://www.youtube-nocookie.com/embed/${id}` : "";
|
|
67
|
+
return id ? `https://www.youtube-nocookie.com/embed/${id}?autoplay=1` : "";
|
|
46
68
|
}
|
|
47
69
|
if (provider.value === "vimeo") {
|
|
48
70
|
const id = vimeoId(src.value);
|
|
49
|
-
return id ? `https://player.vimeo.com/video/${id}` : "";
|
|
71
|
+
return id ? `https://player.vimeo.com/video/${id}?autoplay=1` : "";
|
|
72
|
+
}
|
|
73
|
+
if (provider.value === "loom") {
|
|
74
|
+
const id = loomId(src.value);
|
|
75
|
+
return id ? `https://www.loom.com/embed/${id}?autoplay=1` : "";
|
|
76
|
+
}
|
|
77
|
+
if (provider.value === "twitch") {
|
|
78
|
+
return twitchEmbed(src.value);
|
|
79
|
+
}
|
|
80
|
+
return "";
|
|
81
|
+
});
|
|
82
|
+
const thumbnailUrl = computed(() => {
|
|
83
|
+
if (provider.value === "youtube") {
|
|
84
|
+
const id = youtubeId(src.value);
|
|
85
|
+
return id ? `https://i.ytimg.com/vi/${id}/hqdefault.jpg` : "";
|
|
50
86
|
}
|
|
51
87
|
return "";
|
|
52
88
|
});
|
|
89
|
+
function activate() {
|
|
90
|
+
activated.value = true;
|
|
91
|
+
}
|
|
53
92
|
const ASPECTS = [
|
|
54
93
|
{ key: "16/9", label: "16:9" },
|
|
55
94
|
{ key: "4/3", label: "4:3" },
|
|
@@ -57,13 +96,16 @@ const ASPECTS = [
|
|
|
57
96
|
{ key: "9/16", label: "9:16" }
|
|
58
97
|
];
|
|
59
98
|
function saveSrc() {
|
|
99
|
+
if (!editable.value) return;
|
|
60
100
|
props.updateAttributes({ src: srcDraft.value.trim() });
|
|
61
101
|
srcPopoverOpen.value = false;
|
|
62
102
|
}
|
|
63
103
|
function setAspect(key) {
|
|
104
|
+
if (!editable.value) return;
|
|
64
105
|
props.updateAttributes({ aspectRatio: key });
|
|
65
106
|
}
|
|
66
107
|
function setCaption(v) {
|
|
108
|
+
if (!editable.value) return;
|
|
67
109
|
props.updateAttributes({ caption: v });
|
|
68
110
|
}
|
|
69
111
|
function onSrcKeydown(e) {
|
|
@@ -89,18 +131,48 @@ const aspectStyle = computed(() => ({
|
|
|
89
131
|
:style="aspectStyle"
|
|
90
132
|
>
|
|
91
133
|
<iframe
|
|
92
|
-
v-if="embedUrl"
|
|
134
|
+
v-if="embedUrl && activated"
|
|
93
135
|
:src="embedUrl"
|
|
94
136
|
class="size-full border-0"
|
|
95
137
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
96
138
|
allowfullscreen
|
|
97
139
|
/>
|
|
140
|
+
<!-- Privacy/perf facade: click to load the third-party player -->
|
|
141
|
+
<button
|
|
142
|
+
v-else-if="embedUrl"
|
|
143
|
+
type="button"
|
|
144
|
+
class="group/facade relative size-full flex items-center justify-center bg-(--ui-bg-elevated)"
|
|
145
|
+
@click="activate"
|
|
146
|
+
>
|
|
147
|
+
<img
|
|
148
|
+
v-if="thumbnailUrl"
|
|
149
|
+
:src="thumbnailUrl"
|
|
150
|
+
alt=""
|
|
151
|
+
class="absolute inset-0 size-full object-cover"
|
|
152
|
+
>
|
|
153
|
+
<span class="absolute inset-0 bg-black/20 group-hover/facade:bg-black/30 transition-colors" />
|
|
154
|
+
<UIcon
|
|
155
|
+
name="i-lucide-play"
|
|
156
|
+
class="relative size-14 text-white drop-shadow-lg transition-transform group-hover/facade:scale-110"
|
|
157
|
+
/>
|
|
158
|
+
</button>
|
|
98
159
|
<video
|
|
99
160
|
v-else-if="provider === 'direct'"
|
|
100
161
|
:src="src"
|
|
101
162
|
class="size-full object-contain"
|
|
102
163
|
controls
|
|
164
|
+
playsinline
|
|
165
|
+
preload="metadata"
|
|
103
166
|
/>
|
|
167
|
+
<div
|
|
168
|
+
v-else-if="!editable"
|
|
169
|
+
class="size-full flex flex-col items-center justify-center gap-2 text-(--ui-text-muted)"
|
|
170
|
+
>
|
|
171
|
+
<UIcon
|
|
172
|
+
name="i-lucide-play-circle"
|
|
173
|
+
class="size-10"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
104
176
|
<UPopover
|
|
105
177
|
v-else
|
|
106
178
|
v-model:open="srcPopoverOpen"
|
|
@@ -139,7 +211,7 @@ const aspectStyle = computed(() => ({
|
|
|
139
211
|
</UPopover>
|
|
140
212
|
</div>
|
|
141
213
|
<div
|
|
142
|
-
v-if="src"
|
|
214
|
+
v-if="src && editable"
|
|
143
215
|
class="absolute top-2 right-2 flex items-center gap-1 opacity-0 group-hover/video:opacity-100 transition-opacity"
|
|
144
216
|
>
|
|
145
217
|
<UButton
|
|
@@ -178,11 +250,15 @@ const aspectStyle = computed(() => ({
|
|
|
178
250
|
</UPopover>
|
|
179
251
|
</div>
|
|
180
252
|
</div>
|
|
181
|
-
<div
|
|
253
|
+
<div
|
|
254
|
+
v-if="editable || caption"
|
|
255
|
+
class="text-sm text-(--ui-text-muted) text-center"
|
|
256
|
+
>
|
|
182
257
|
<ANodeInlineLabel
|
|
183
258
|
:model-value="caption"
|
|
184
259
|
placeholder="Add caption"
|
|
185
260
|
variant="label"
|
|
261
|
+
:disabled="!editable"
|
|
186
262
|
@update:model-value="setCaption"
|
|
187
263
|
/>
|
|
188
264
|
</div>
|
|
@@ -138,6 +138,22 @@ export interface DocTypeDefinition {
|
|
|
138
138
|
component: Component;
|
|
139
139
|
/** Whether this page type uses the TipTap editor. Controls toolbar visibility. */
|
|
140
140
|
hasEditor?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Layout contract of the renderer's root element.
|
|
143
|
+
*
|
|
144
|
+
* - `'flow'` — grows with its content and sits in normal document flow
|
|
145
|
+
* (prose/doc/code). Safe to embed anywhere.
|
|
146
|
+
* - `'canvas'` — roots at `flex-1 min-h-0` and expects a height-bounded flex
|
|
147
|
+
* parent (the app shell pane). Graph, Map, Sheets, Kanban,
|
|
148
|
+
* Timeline, Calendar, etc. all do this: dropped into normal
|
|
149
|
+
* flow with no height they collapse to ~0px.
|
|
150
|
+
*
|
|
151
|
+
* When unset, callers derive it from `hasEditor` (`true` → flow, else canvas),
|
|
152
|
+
* so structured renderers get bounded automatically and editor pages don't.
|
|
153
|
+
* `ADocRenderer` reads this to give canvas types a default viewport height
|
|
154
|
+
* when the consumer doesn't pass an explicit `rendererClass`.
|
|
155
|
+
*/
|
|
156
|
+
layout?: 'flow' | 'canvas';
|
|
141
157
|
/** Default depth limit for nested children (-1 = unlimited). */
|
|
142
158
|
defaultDepth?: number;
|
|
143
159
|
/** Whether children can be nested under this type. */
|
|
@@ -88,6 +88,8 @@ export const DOC_TYPES = {
|
|
|
88
88
|
description: "Collaborative plain-text code editor with syntax highlighting",
|
|
89
89
|
available: true,
|
|
90
90
|
hasEditor: false,
|
|
91
|
+
// CodeMirror grows with content — flow, not a bounded canvas pane.
|
|
92
|
+
layout: "flow",
|
|
91
93
|
supportsChildren: false,
|
|
92
94
|
component: defineDocComponent(
|
|
93
95
|
() => import("../components/renderers/ACodeRenderer.vue")
|
|
@@ -330,6 +332,7 @@ export function resolveDocType(typeKey, registry) {
|
|
|
330
332
|
icon: pt.icon,
|
|
331
333
|
component: pt.component,
|
|
332
334
|
hasEditor: pt.hasEditor,
|
|
335
|
+
layout: pt.layout,
|
|
333
336
|
metaSchema: pt.metaSchema,
|
|
334
337
|
available: true
|
|
335
338
|
};
|
|
@@ -347,6 +350,7 @@ export function getAvailableDocTypes(registry) {
|
|
|
347
350
|
icon: pt.icon,
|
|
348
351
|
component: pt.component,
|
|
349
352
|
hasEditor: pt.hasEditor,
|
|
353
|
+
layout: pt.layout,
|
|
350
354
|
available: true
|
|
351
355
|
};
|
|
352
356
|
}
|