@erudit-js/prose 4.0.0-dev.5 → 4.0.1

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.
Files changed (86) hide show
  1. package/dist/app/default/Inliners.vue +11 -11
  2. package/dist/app/default/Mix.vue +11 -11
  3. package/dist/app/default/Text.vue +25 -25
  4. package/dist/app/shared/Prose.vue +40 -40
  5. package/dist/app/shared/Render.vue +51 -51
  6. package/dist/app/shared/assets/block.svg +2 -2
  7. package/dist/app/shared/assets/check.svg +2 -2
  8. package/dist/app/shared/assets/inliner.svg +2 -2
  9. package/dist/app/shared/assets/plus.svg +2 -2
  10. package/dist/app/shared/block/AsideMenu.vue +44 -44
  11. package/dist/app/shared/block/AsideMenuButton.vue +51 -51
  12. package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
  13. package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
  14. package/dist/app/shared/block/Block.vue +270 -270
  15. package/dist/app/shared/inliner/Inliner.vue +11 -11
  16. package/dist/app/shared/photoswipe/style.css +22 -22
  17. package/dist/elements/accent/Accent.vue +88 -88
  18. package/dist/elements/accent/AccentColumnSection.vue +61 -61
  19. package/dist/elements/accent/AccentRowSections.vue +64 -64
  20. package/dist/elements/callout/Callout.vue +81 -81
  21. package/dist/elements/callout/_global.d.ts +15 -15
  22. package/dist/elements/caption/Caption.vue +44 -44
  23. package/dist/elements/caption/_global.d.ts +26 -26
  24. package/dist/elements/details/Details.vue +49 -49
  25. package/dist/elements/details/_global.d.ts +27 -27
  26. package/dist/elements/details/icon.svg +2 -2
  27. package/dist/elements/diagram/Diagram.vue +360 -360
  28. package/dist/elements/diagram/_global.d.ts +19 -19
  29. package/dist/elements/emphasis/Emphasis.vue +25 -25
  30. package/dist/elements/emphasis/_global.d.ts +18 -18
  31. package/dist/elements/flex/Flex.vue +36 -36
  32. package/dist/elements/flex/_global.d.ts +23 -23
  33. package/dist/elements/gallery/Gallery.vue +56 -56
  34. package/dist/elements/gallery/_global.d.ts +18 -18
  35. package/dist/elements/heading/Heading.vue +44 -44
  36. package/dist/elements/heading/_global.d.ts +42 -42
  37. package/dist/elements/heading/icon.svg +2 -2
  38. package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
  39. package/dist/elements/horizontalLine/_global.d.ts +17 -17
  40. package/dist/elements/image/Image.vue +15 -15
  41. package/dist/elements/image/ImageElement.vue +80 -80
  42. package/dist/elements/image/_global.d.ts +18 -18
  43. package/dist/elements/lineBreak/LineBreak.vue +3 -3
  44. package/dist/elements/lineBreak/_global.d.ts +18 -18
  45. package/dist/elements/link/BlockLink.vue +108 -108
  46. package/dist/elements/link/Link.vue +92 -92
  47. package/dist/elements/link/dependency/_global.d.ts +47 -47
  48. package/dist/elements/link/reference/_global.d.ts +49 -49
  49. package/dist/elements/list/List.vue +58 -58
  50. package/dist/elements/list/_global.d.ts +50 -50
  51. package/dist/elements/math/_global.d.ts +72 -72
  52. package/dist/elements/math/_global.ts +3 -3
  53. package/dist/elements/math/components/BlockMath.vue +30 -30
  54. package/dist/elements/math/components/InlinerMath.vue +65 -65
  55. package/dist/elements/math/components/Katex.vue +88 -88
  56. package/dist/elements/math/components/MathGroup.vue +41 -41
  57. package/dist/elements/paragraph/Paragraph.vue +25 -25
  58. package/dist/elements/paragraph/_global.d.ts +27 -27
  59. package/dist/elements/paragraph/icon.svg +3 -3
  60. package/dist/elements/problem/_global.d.ts +112 -112
  61. package/dist/elements/problem/assets/actions/answer.svg +2 -2
  62. package/dist/elements/problem/assets/actions/check.svg +2 -2
  63. package/dist/elements/problem/assets/actions/generate.svg +2 -2
  64. package/dist/elements/problem/assets/actions/hint.svg +2 -2
  65. package/dist/elements/problem/assets/actions/note.svg +2 -2
  66. package/dist/elements/problem/assets/actions/solution.svg +2 -2
  67. package/dist/elements/problem/assets/icon.svg +2 -2
  68. package/dist/elements/problem/components/Problem.vue +22 -22
  69. package/dist/elements/problem/components/ProblemButton.vue +20 -20
  70. package/dist/elements/problem/components/ProblemContainer.vue +8 -8
  71. package/dist/elements/problem/components/ProblemContent.vue +356 -356
  72. package/dist/elements/problem/components/ProblemExpander.vue +7 -7
  73. package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
  74. package/dist/elements/problem/components/ProblemHeader.vue +100 -100
  75. package/dist/elements/problem/components/Problems.vue +83 -83
  76. package/dist/elements/problem/components/SubProblem.vue +14 -14
  77. package/dist/elements/problem/components/expanders/Check.vue +153 -153
  78. package/dist/elements/problem/components/expanders/Checks.vue +146 -146
  79. package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -38
  80. package/dist/elements/problem/components/expanders/Hint.vue +26 -26
  81. package/dist/elements/table/Table.vue +100 -100
  82. package/dist/elements/table/_global.d.ts +36 -36
  83. package/dist/elements/video/Video.vue +110 -110
  84. package/dist/elements/video/_global.d.ts +18 -18
  85. package/package.json +4 -4
  86. package/types.d.ts +4 -4
@@ -1,360 +1,360 @@
1
- <script lang="ts" setup>
2
- import {
3
- nextTick,
4
- onMounted,
5
- onUnmounted,
6
- ref,
7
- shallowRef,
8
- useCssModule,
9
- useId,
10
- useTemplateRef,
11
- } from 'vue';
12
- import type { ProseElement } from '@jsprose/core';
13
-
14
- import type { diagramSchema } from './core.js';
15
- import { usePhotoSwipe } from '../../app/shared/photoswipe/composable.js';
16
- import { useProseContext } from '../../app/composables/context.js';
17
- import Caption from '../caption/Caption.vue';
18
- import Block from '../../app/shared/block/Block.vue';
19
-
20
- const { element } = defineProps<{
21
- element: ProseElement<typeof diagramSchema>;
22
- }>();
23
-
24
- let isWebkit = ref<boolean>();
25
-
26
- const style = useCssModule();
27
- const { EruditIcon, loadingSvg } = useProseContext();
28
- const loading = ref(true);
29
- const diagramRendering = ref(false);
30
- const diagramContent = ref(element.children[0].data);
31
- const diagramSvgContent = ref('');
32
- const diagramElement = useTemplateRef('diagram');
33
- const diagramSvgElement = useTemplateRef('diagramSvg');
34
- const diagramUid = useId();
35
- const captionElement = shallowRef<HTMLElement>();
36
- const { lightbox, initLightbox } = usePhotoSwipe();
37
- const latexRegex = {
38
- display: /\$\$(.*?)\$\$/gs,
39
- inline: /\$(?!\$)(.*?)(?<!\$)\$/gs,
40
- };
41
-
42
- let observer: IntersectionObserver;
43
-
44
- onMounted(async () => {
45
- const ua = navigator.userAgent;
46
-
47
- isWebkit.value =
48
- (/AppleWebKit/.test(ua) && !/Chrome/.test(ua)) ||
49
- /\b(iPad|iPhone|iPod)\b/.test(ua);
50
-
51
- if (hasLatex(diagramContent.value)) {
52
- await prepareMathDiagram();
53
- }
54
-
55
- observer = new IntersectionObserver(diagramIntersectHit, {
56
- root: null,
57
- threshold: 0.01,
58
- });
59
- observer.observe(diagramElement.value!);
60
- });
61
-
62
- onUnmounted(() => {
63
- if (observer) {
64
- observer.disconnect();
65
- }
66
- });
67
-
68
- function diagramClick() {
69
- if (!lightbox.value) {
70
- const svgElement = diagramSvgElement.value!.querySelector('svg')!;
71
-
72
- const slideSvg = svgElement.cloneNode(true) as SVGSVGElement;
73
- slideSvg.removeAttribute('width');
74
- slideSvg.removeAttribute('style');
75
- slideSvg.classList.add(style.diagram);
76
-
77
- let slideRoot: HTMLElement | SVGSVGElement = slideSvg;
78
- const accentAncestor = diagramElement.value!.closest('[data-prose-accent]');
79
- if (accentAncestor) {
80
- const wrapper = document.createElement('div');
81
- wrapper.setAttribute('data-prose-accent', '');
82
- const computed = getComputedStyle(accentAncestor as Element);
83
- for (const prop of computed) {
84
- if (prop.startsWith('--accent')) {
85
- const val = computed.getPropertyValue(prop).trim();
86
- if (val) {
87
- wrapper.style.setProperty(prop, val);
88
- }
89
- }
90
- }
91
- wrapper.appendChild(slideSvg);
92
- slideRoot = wrapper;
93
- }
94
-
95
- const width = Math.min(1000, 0.9 * window.innerWidth);
96
- const scaleHeightFactor = svgElement.clientHeight / svgElement.clientWidth;
97
-
98
- const html = `
99
- <div class="pswp__img-overlay-wrapper" style="position: relative">
100
- <div class="pswp__img" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;"></div>
101
- ${slideRoot.outerHTML}
102
- </div>
103
- `;
104
- initLightbox(
105
- {
106
- dataSource: [
107
- {
108
- html,
109
- width: width,
110
- height: width * scaleHeightFactor,
111
- },
112
- ],
113
- },
114
- captionElement.value,
115
- );
116
- }
117
- lightbox.value!.loadAndOpen(0);
118
- }
119
-
120
- //
121
- //
122
- //
123
-
124
- function hasLatex(content: string): boolean {
125
- return latexRegex.display.test(content) || latexRegex.inline.test(content);
126
- }
127
-
128
- async function prepareMathDiagram() {
129
- await import('katex/dist/katex.min.css');
130
- const katex = await import('katex');
131
-
132
- const renderMathWithKatex = (
133
- text: string,
134
- regex: RegExp,
135
- displayMode: boolean,
136
- ): string => {
137
- return text.replace(regex, (_, latexContent) => {
138
- return katex
139
- .renderToString(latexContent, {
140
- displayMode,
141
- output: 'mathml',
142
- })
143
- .replace(/<mtd>/g, '<mtd style="padding: 0.2em 0;">')
144
- .replace(
145
- /<annotation encoding="application\/x-tex">[\s\S]*?<\/annotation>/g,
146
- '',
147
- );
148
- });
149
- };
150
-
151
- diagramContent.value = renderMathWithKatex(
152
- diagramContent.value,
153
- latexRegex.display,
154
- true,
155
- );
156
-
157
- diagramContent.value = renderMathWithKatex(
158
- diagramContent.value,
159
- latexRegex.inline,
160
- false,
161
- );
162
-
163
- await nextTick();
164
- await new Promise(requestAnimationFrame);
165
- }
166
-
167
- async function diagramIntersectHit(entries: IntersectionObserverEntry[]) {
168
- if (!entries.some((e) => e.isIntersecting)) return;
169
- if (!loading.value || diagramRendering.value) return;
170
-
171
- diagramRendering.value = true;
172
- await renderDiagram();
173
- diagramRendering.value = false;
174
- loading.value = false;
175
-
176
- observer.disconnect();
177
-
178
- await nextTick();
179
- const svg = diagramSvgElement.value?.querySelector('svg');
180
- if (svg) {
181
- svg.addEventListener('click', diagramClick);
182
- }
183
- }
184
-
185
- async function renderDiagram() {
186
- const mermaid = //@ts-ignore
187
- (await import('https://cdn.jsdelivr.net/npm/mermaid@11.12.2/+esm')).default;
188
-
189
- mermaid.initialize({
190
- startOnLoad: false,
191
- securityLevel: 'loose',
192
- markdownAutoWrap: false,
193
- flowchart: {
194
- useMaxWidth: true,
195
- padding: 10,
196
- wrappingWidth: 400,
197
- },
198
- theme: 'base',
199
- });
200
-
201
- const { svg } = await mermaid.render(diagramUid, diagramContent.value);
202
-
203
- diagramSvgContent.value = svg;
204
- }
205
- </script>
206
-
207
- <template>
208
- <Block :element>
209
- <div ref="diagram">
210
- <div v-if="loading" class="p-normal text-center">
211
- <EruditIcon
212
- :name="loadingSvg"
213
- class="text-text-dimmed inline text-[60px]"
214
- />
215
- </div>
216
- <div
217
- v-else
218
- ref="diagramSvg"
219
- v-html="diagramSvgContent"
220
- :class="[isWebkit ? '' : $style.notWebkit, $style.diagram]"
221
- ></div>
222
- </div>
223
- <Caption
224
- v-if="element.children[1]"
225
- :caption="element.children[1]"
226
- @captionMounted="(element) => (captionElement = element)"
227
- />
228
- </Block>
229
- </template>
230
-
231
- <style module>
232
- /* Fix for stupid fucking braindead WebKit screwing everything and shifting to (0,0) everything that is realtive positioned or tranfrom translated! */
233
- .notWebkit.diagram {
234
- :global(mover:not(:has(+ msup)) > mo) {
235
- position: relative;
236
- top: -0.2em;
237
- }
238
- }
239
-
240
- .diagram {
241
- > svg {
242
- margin: auto;
243
- cursor: pointer;
244
- }
245
-
246
- /* Text color */
247
-
248
- :global(.edgeLabel) {
249
- *:not(.katex *):not(.katex) {
250
- color: var(--color-text-muted) !important;
251
- }
252
- }
253
-
254
- :global(.nodeLabel) {
255
- *:not(.katex *):not(.katex) {
256
- color: var(--color-text) !important;
257
- }
258
- }
259
-
260
- /* Arrows */
261
-
262
- --arrowColor: var(--color-text-dimmed);
263
-
264
- :global(.flowchart-link) {
265
- stroke: var(--arrowColor) !important;
266
- }
267
-
268
- :global(.edge-thickness-normal) {
269
- stroke-width: 2px !important;
270
- }
271
-
272
- :global(.edge-pattern-dotted) {
273
- stroke-width: 2px !important;
274
- stroke-dasharray: 3 2.2 !important;
275
- }
276
-
277
- :global(.marker) {
278
- fill: var(--arrowColor) !important;
279
- stroke: var(--arrowColor) !important;
280
- }
281
-
282
- :global(.edgeLabel) * {
283
- background: var(--color-bg-main) !important;
284
- }
285
-
286
- [data-prose-accent] & {
287
- --arrowColor: color-mix(
288
- in hsl,
289
- var(--accentText) 45%,
290
- var(--accentBackground)
291
- );
292
-
293
- :global(.edgeLabel) * {
294
- background: var(--accentBackground) !important;
295
- }
296
- }
297
-
298
- /* Nodes */
299
-
300
- :global(.node) rect,
301
- :global(.node) path,
302
- :global(.node) polygon,
303
- :global(.node) circle,
304
- :global(.node) ellipse {
305
- fill: color-mix(in hsl, var(--color-brand) 20%, transparent) !important;
306
- stroke: color-mix(in hsl, var(--color-brand) 35%, transparent) !important;
307
- }
308
-
309
- [data-prose-accent] & {
310
- :global(.node) rect,
311
- :global(.node) path,
312
- :global(.node) polygon,
313
- :global(.node) circle,
314
- :global(.node) ellipse {
315
- fill: color-mix(
316
- in hsl,
317
- var(--accentText) 30%,
318
- var(--accentBackground)
319
- ) !important;
320
- stroke: color-mix(
321
- in hsl,
322
- var(--accentText) 45%,
323
- var(--accentBackground)
324
- ) !important;
325
- }
326
- }
327
-
328
- /* "fill" node modificator */
329
-
330
- :global(.fill) {
331
- *:not(.katex *):not(.katex) {
332
- color: white !important;
333
- }
334
-
335
- rect,
336
- path,
337
- polygon,
338
- circle,
339
- ellipse {
340
- fill: color-mix(in hsl, var(--color-brand) 75%, transparent) !important;
341
- stroke: transparent !important;
342
- }
343
-
344
- [data-prose-accent] & {
345
- rect,
346
- path,
347
- polygon,
348
- circle,
349
- ellipse {
350
- fill: color-mix(
351
- in hsl,
352
- var(--accentText) 70%,
353
- var(--color-border)
354
- ) !important;
355
- stroke: transparent !important;
356
- }
357
- }
358
- }
359
- }
360
- </style>
1
+ <script lang="ts" setup>
2
+ import {
3
+ nextTick,
4
+ onMounted,
5
+ onUnmounted,
6
+ ref,
7
+ shallowRef,
8
+ useCssModule,
9
+ useId,
10
+ useTemplateRef,
11
+ } from 'vue';
12
+ import type { ProseElement } from '@jsprose/core';
13
+
14
+ import type { diagramSchema } from './core.js';
15
+ import { usePhotoSwipe } from '../../app/shared/photoswipe/composable.js';
16
+ import { useProseContext } from '../../app/composables/context.js';
17
+ import Caption from '../caption/Caption.vue';
18
+ import Block from '../../app/shared/block/Block.vue';
19
+
20
+ const { element } = defineProps<{
21
+ element: ProseElement<typeof diagramSchema>;
22
+ }>();
23
+
24
+ let isWebkit = ref<boolean>();
25
+
26
+ const style = useCssModule();
27
+ const { EruditIcon, loadingSvg } = useProseContext();
28
+ const loading = ref(true);
29
+ const diagramRendering = ref(false);
30
+ const diagramContent = ref(element.children[0].data);
31
+ const diagramSvgContent = ref('');
32
+ const diagramElement = useTemplateRef('diagram');
33
+ const diagramSvgElement = useTemplateRef('diagramSvg');
34
+ const diagramUid = useId();
35
+ const captionElement = shallowRef<HTMLElement>();
36
+ const { lightbox, initLightbox } = usePhotoSwipe();
37
+ const latexRegex = {
38
+ display: /\$\$(.*?)\$\$/gs,
39
+ inline: /\$(?!\$)(.*?)(?<!\$)\$/gs,
40
+ };
41
+
42
+ let observer: IntersectionObserver;
43
+
44
+ onMounted(async () => {
45
+ const ua = navigator.userAgent;
46
+
47
+ isWebkit.value =
48
+ (/AppleWebKit/.test(ua) && !/Chrome/.test(ua)) ||
49
+ /\b(iPad|iPhone|iPod)\b/.test(ua);
50
+
51
+ if (hasLatex(diagramContent.value)) {
52
+ await prepareMathDiagram();
53
+ }
54
+
55
+ observer = new IntersectionObserver(diagramIntersectHit, {
56
+ root: null,
57
+ threshold: 0.01,
58
+ });
59
+ observer.observe(diagramElement.value!);
60
+ });
61
+
62
+ onUnmounted(() => {
63
+ if (observer) {
64
+ observer.disconnect();
65
+ }
66
+ });
67
+
68
+ function diagramClick() {
69
+ if (!lightbox.value) {
70
+ const svgElement = diagramSvgElement.value!.querySelector('svg')!;
71
+
72
+ const slideSvg = svgElement.cloneNode(true) as SVGSVGElement;
73
+ slideSvg.removeAttribute('width');
74
+ slideSvg.removeAttribute('style');
75
+ slideSvg.classList.add(style.diagram);
76
+
77
+ let slideRoot: HTMLElement | SVGSVGElement = slideSvg;
78
+ const accentAncestor = diagramElement.value!.closest('[data-prose-accent]');
79
+ if (accentAncestor) {
80
+ const wrapper = document.createElement('div');
81
+ wrapper.setAttribute('data-prose-accent', '');
82
+ const computed = getComputedStyle(accentAncestor as Element);
83
+ for (const prop of computed) {
84
+ if (prop.startsWith('--accent')) {
85
+ const val = computed.getPropertyValue(prop).trim();
86
+ if (val) {
87
+ wrapper.style.setProperty(prop, val);
88
+ }
89
+ }
90
+ }
91
+ wrapper.appendChild(slideSvg);
92
+ slideRoot = wrapper;
93
+ }
94
+
95
+ const width = Math.min(1000, 0.9 * window.innerWidth);
96
+ const scaleHeightFactor = svgElement.clientHeight / svgElement.clientWidth;
97
+
98
+ const html = `
99
+ <div class="pswp__img-overlay-wrapper" style="position: relative">
100
+ <div class="pswp__img" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;"></div>
101
+ ${slideRoot.outerHTML}
102
+ </div>
103
+ `;
104
+ initLightbox(
105
+ {
106
+ dataSource: [
107
+ {
108
+ html,
109
+ width: width,
110
+ height: width * scaleHeightFactor,
111
+ },
112
+ ],
113
+ },
114
+ captionElement.value,
115
+ );
116
+ }
117
+ lightbox.value!.loadAndOpen(0);
118
+ }
119
+
120
+ //
121
+ //
122
+ //
123
+
124
+ function hasLatex(content: string): boolean {
125
+ return latexRegex.display.test(content) || latexRegex.inline.test(content);
126
+ }
127
+
128
+ async function prepareMathDiagram() {
129
+ await import('katex/dist/katex.min.css');
130
+ const katex = await import('katex');
131
+
132
+ const renderMathWithKatex = (
133
+ text: string,
134
+ regex: RegExp,
135
+ displayMode: boolean,
136
+ ): string => {
137
+ return text.replace(regex, (_, latexContent) => {
138
+ return katex
139
+ .renderToString(latexContent, {
140
+ displayMode,
141
+ output: 'mathml',
142
+ })
143
+ .replace(/<mtd>/g, '<mtd style="padding: 0.2em 0;">')
144
+ .replace(
145
+ /<annotation encoding="application\/x-tex">[\s\S]*?<\/annotation>/g,
146
+ '',
147
+ );
148
+ });
149
+ };
150
+
151
+ diagramContent.value = renderMathWithKatex(
152
+ diagramContent.value,
153
+ latexRegex.display,
154
+ true,
155
+ );
156
+
157
+ diagramContent.value = renderMathWithKatex(
158
+ diagramContent.value,
159
+ latexRegex.inline,
160
+ false,
161
+ );
162
+
163
+ await nextTick();
164
+ await new Promise(requestAnimationFrame);
165
+ }
166
+
167
+ async function diagramIntersectHit(entries: IntersectionObserverEntry[]) {
168
+ if (!entries.some((e) => e.isIntersecting)) return;
169
+ if (!loading.value || diagramRendering.value) return;
170
+
171
+ diagramRendering.value = true;
172
+ await renderDiagram();
173
+ diagramRendering.value = false;
174
+ loading.value = false;
175
+
176
+ observer.disconnect();
177
+
178
+ await nextTick();
179
+ const svg = diagramSvgElement.value?.querySelector('svg');
180
+ if (svg) {
181
+ svg.addEventListener('click', diagramClick);
182
+ }
183
+ }
184
+
185
+ async function renderDiagram() {
186
+ const mermaid = //@ts-ignore
187
+ (await import('https://cdn.jsdelivr.net/npm/mermaid@11.12.2/+esm')).default;
188
+
189
+ mermaid.initialize({
190
+ startOnLoad: false,
191
+ securityLevel: 'loose',
192
+ markdownAutoWrap: false,
193
+ flowchart: {
194
+ useMaxWidth: true,
195
+ padding: 10,
196
+ wrappingWidth: 400,
197
+ },
198
+ theme: 'base',
199
+ });
200
+
201
+ const { svg } = await mermaid.render(diagramUid, diagramContent.value);
202
+
203
+ diagramSvgContent.value = svg;
204
+ }
205
+ </script>
206
+
207
+ <template>
208
+ <Block :element>
209
+ <div ref="diagram">
210
+ <div v-if="loading" class="p-normal text-center">
211
+ <EruditIcon
212
+ :name="loadingSvg"
213
+ class="text-text-dimmed inline text-[60px]"
214
+ />
215
+ </div>
216
+ <div
217
+ v-else
218
+ ref="diagramSvg"
219
+ v-html="diagramSvgContent"
220
+ :class="[isWebkit ? '' : $style.notWebkit, $style.diagram]"
221
+ ></div>
222
+ </div>
223
+ <Caption
224
+ v-if="element.children[1]"
225
+ :caption="element.children[1]"
226
+ @captionMounted="(element) => (captionElement = element)"
227
+ />
228
+ </Block>
229
+ </template>
230
+
231
+ <style module>
232
+ /* Fix for stupid fucking braindead WebKit screwing everything and shifting to (0,0) everything that is realtive positioned or tranfrom translated! */
233
+ .notWebkit.diagram {
234
+ :global(mover:not(:has(+ msup)) > mo) {
235
+ position: relative;
236
+ top: -0.2em;
237
+ }
238
+ }
239
+
240
+ .diagram {
241
+ > svg {
242
+ margin: auto;
243
+ cursor: pointer;
244
+ }
245
+
246
+ /* Text color */
247
+
248
+ :global(.edgeLabel) {
249
+ *:not(.katex *):not(.katex) {
250
+ color: var(--color-text-muted) !important;
251
+ }
252
+ }
253
+
254
+ :global(.nodeLabel) {
255
+ *:not(.katex *):not(.katex) {
256
+ color: var(--color-text) !important;
257
+ }
258
+ }
259
+
260
+ /* Arrows */
261
+
262
+ --arrowColor: var(--color-text-dimmed);
263
+
264
+ :global(.flowchart-link) {
265
+ stroke: var(--arrowColor) !important;
266
+ }
267
+
268
+ :global(.edge-thickness-normal) {
269
+ stroke-width: 2px !important;
270
+ }
271
+
272
+ :global(.edge-pattern-dotted) {
273
+ stroke-width: 2px !important;
274
+ stroke-dasharray: 3 2.2 !important;
275
+ }
276
+
277
+ :global(.marker) {
278
+ fill: var(--arrowColor) !important;
279
+ stroke: var(--arrowColor) !important;
280
+ }
281
+
282
+ :global(.edgeLabel) * {
283
+ background: var(--color-bg-main) !important;
284
+ }
285
+
286
+ [data-prose-accent] & {
287
+ --arrowColor: color-mix(
288
+ in hsl,
289
+ var(--accentText) 45%,
290
+ var(--accentBackground)
291
+ );
292
+
293
+ :global(.edgeLabel) * {
294
+ background: var(--accentBackground) !important;
295
+ }
296
+ }
297
+
298
+ /* Nodes */
299
+
300
+ :global(.node) rect,
301
+ :global(.node) path,
302
+ :global(.node) polygon,
303
+ :global(.node) circle,
304
+ :global(.node) ellipse {
305
+ fill: color-mix(in hsl, var(--color-brand) 20%, transparent) !important;
306
+ stroke: color-mix(in hsl, var(--color-brand) 35%, transparent) !important;
307
+ }
308
+
309
+ [data-prose-accent] & {
310
+ :global(.node) rect,
311
+ :global(.node) path,
312
+ :global(.node) polygon,
313
+ :global(.node) circle,
314
+ :global(.node) ellipse {
315
+ fill: color-mix(
316
+ in hsl,
317
+ var(--accentText) 30%,
318
+ var(--accentBackground)
319
+ ) !important;
320
+ stroke: color-mix(
321
+ in hsl,
322
+ var(--accentText) 45%,
323
+ var(--accentBackground)
324
+ ) !important;
325
+ }
326
+ }
327
+
328
+ /* "fill" node modificator */
329
+
330
+ :global(.fill) {
331
+ *:not(.katex *):not(.katex) {
332
+ color: white !important;
333
+ }
334
+
335
+ rect,
336
+ path,
337
+ polygon,
338
+ circle,
339
+ ellipse {
340
+ fill: color-mix(in hsl, var(--color-brand) 75%, transparent) !important;
341
+ stroke: transparent !important;
342
+ }
343
+
344
+ [data-prose-accent] & {
345
+ rect,
346
+ path,
347
+ polygon,
348
+ circle,
349
+ ellipse {
350
+ fill: color-mix(
351
+ in hsl,
352
+ var(--accentText) 70%,
353
+ var(--color-border)
354
+ ) !important;
355
+ stroke: transparent !important;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ </style>