@erudit-js/prose 4.0.1 → 4.1.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/app/composables/context.d.ts +6 -1
- package/dist/app/language/element.d.ts +1 -1
- package/dist/elements/accent/Accent.vue +1 -0
- package/dist/elements/diagram/Diagram.vue +6 -10
- package/dist/elements/link/BlockLink.vue +117 -66
- package/dist/elements/link/Link.vue +38 -11
- package/dist/elements/link/core.js +1 -1
- package/dist/elements/link/dependency/app.d.ts +2 -2
- package/dist/elements/link/dependency/core.d.ts +12 -18
- package/dist/elements/link/dependency/core.js +1 -17
- package/dist/elements/link/reference/languages/en.d.ts +2 -3
- package/dist/elements/link/reference/languages/en.js +5 -1
- package/dist/elements/link/reference/languages/ru.d.ts +2 -3
- package/dist/elements/link/reference/languages/ru.js +5 -1
- package/dist/elements/link/reference/phrases.d.ts +5 -0
- package/dist/elements/link/reference/phrases.js +1 -0
- package/dist/elements/link/step.d.ts +16 -0
- package/dist/elements/link/step.js +36 -0
- package/dist/elements/link/storage.d.ts +9 -5
- package/dist/elements/link/storage.js +4 -4
- package/dist/elements/math/_global.d.ts +7 -0
- package/dist/elements/math/block.d.ts +2 -0
- package/dist/elements/math/block.js +42 -29
- package/dist/elements/math/components/MathGroup.vue +20 -3
- package/dist/elements/problem/_global.d.ts +174 -29
- package/dist/elements/problem/app.d.ts +7 -7
- package/dist/elements/problem/app.js +13 -12
- package/dist/elements/problem/components/ProblemButtonGenerate.vue +96 -0
- package/dist/elements/problem/components/ProblemContent.vue +14 -104
- package/dist/elements/problem/components/expanders/Check.vue +58 -11
- package/dist/elements/problem/components/expanders/Checks.vue +5 -5
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +0 -2
- package/dist/elements/problem/core.d.ts +55 -28
- package/dist/elements/problem/core.js +2 -1
- package/dist/elements/problem/languages/{en.d.ts → problem/en.d.ts} +1 -1
- package/dist/elements/problem/languages/problem/en.js +6 -0
- package/dist/elements/problem/languages/{ru.d.ts → problem/ru.d.ts} +1 -1
- package/dist/elements/problem/languages/problem/ru.js +6 -0
- package/dist/elements/problem/languages/problems/en.d.ts +3 -0
- package/dist/elements/problem/languages/problems/en.js +6 -0
- package/dist/elements/problem/languages/problems/ru.d.ts +3 -0
- package/dist/elements/problem/languages/problems/ru.js +6 -0
- package/dist/elements/problem/languages/shared/en.d.ts +3 -0
- package/dist/elements/problem/languages/{en.js → shared/en.js} +12 -3
- package/dist/elements/problem/languages/shared/ru.d.ts +3 -0
- package/dist/elements/problem/languages/{ru.js → shared/ru.js} +12 -3
- package/dist/elements/problem/phrases.d.ts +4 -0
- package/dist/elements/problem/problemCheck.d.ts +166 -0
- package/dist/elements/problem/problemCheck.js +203 -0
- package/dist/elements/problem/problemContent.d.ts +2 -120
- package/dist/elements/problem/problemContent.js +2 -127
- package/dist/elements/problem/problemScript.d.ts +6 -1
- package/dist/resolve.d.ts +2 -1
- package/dist/resolve.js +8 -5
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Component, type InjectionKey, type Ref } from 'vue';
|
|
1
|
+
import { type Component, type InjectionKey, type Ref, type TemplateRef } from 'vue';
|
|
2
|
+
import type { useFloating, UseFloatingOptions } from '@floating-ui/vue';
|
|
2
3
|
import type { EruditLanguageCode } from '@erudit-js/core/eruditConfig/language';
|
|
3
4
|
import type { EruditMode } from '@erudit-js/core/mode';
|
|
4
5
|
import type { FormatText } from '@erudit-js/core/formatText';
|
|
@@ -17,6 +18,10 @@ export interface ProseContext {
|
|
|
17
18
|
EruditLink: Component;
|
|
18
19
|
setPreview: (previewRequest: any) => void;
|
|
19
20
|
closePreview: () => void;
|
|
21
|
+
usePopup: (containerElement: TemplateRef<HTMLElement>, toggleElement: TemplateRef<HTMLElement>, popupElement: TemplateRef<HTMLElement>, options?: UseFloatingOptions) => {
|
|
22
|
+
popupVisible: Ref<boolean>;
|
|
23
|
+
popupStyles: ReturnType<typeof useFloating>['floatingStyles'];
|
|
24
|
+
};
|
|
20
25
|
loadingSvg: string;
|
|
21
26
|
}
|
|
22
27
|
export declare const proseContextSymbol: InjectionKey<ProseContext>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface ElementDefaultPhrases {
|
|
2
2
|
element_name: string;
|
|
3
3
|
}
|
|
4
|
-
export type ElementPhrases<T extends Record<string,
|
|
4
|
+
export type ElementPhrases<T extends Record<string, any> = {}> = Omit<T, keyof ElementDefaultPhrases> & ElementDefaultPhrases;
|
|
5
5
|
export declare function defineElementLanguage<T extends ElementPhrases<T> = ElementPhrases>(phrases: T): T;
|
|
6
6
|
export type ElementLanguagesRaw<T extends ElementPhrases> = Record<string, () => Promise<{
|
|
7
7
|
default: T;
|
|
@@ -61,6 +61,7 @@ const accentOptions = (appElement as any)['accent'] as AccentAppOptions;
|
|
|
61
61
|
:class="[
|
|
62
62
|
'rounded-xl border border-(--accentBorder) bg-(--accentBackground)',
|
|
63
63
|
]"
|
|
64
|
+
data-prose-accent
|
|
64
65
|
>
|
|
65
66
|
<div
|
|
66
67
|
class="text-main-lg flex items-center gap-(--proseAsideWidth)
|
|
@@ -245,16 +245,12 @@ async function renderDiagram() {
|
|
|
245
245
|
|
|
246
246
|
/* Text color */
|
|
247
247
|
|
|
248
|
-
:global(.edgeLabel) {
|
|
249
|
-
|
|
250
|
-
color: var(--color-text-muted) !important;
|
|
251
|
-
}
|
|
248
|
+
:global(.edgeLabel) * {
|
|
249
|
+
color: var(--color-text-muted) !important;
|
|
252
250
|
}
|
|
253
251
|
|
|
254
|
-
:global(.nodeLabel) {
|
|
255
|
-
|
|
256
|
-
color: var(--color-text) !important;
|
|
257
|
-
}
|
|
252
|
+
:global(.nodeLabel) * {
|
|
253
|
+
color: var(--color-text) !important;
|
|
258
254
|
}
|
|
259
255
|
|
|
260
256
|
/* Arrows */
|
|
@@ -328,7 +324,7 @@ async function renderDiagram() {
|
|
|
328
324
|
/* "fill" node modificator */
|
|
329
325
|
|
|
330
326
|
:global(.fill) {
|
|
331
|
-
|
|
327
|
+
* {
|
|
332
328
|
color: white !important;
|
|
333
329
|
}
|
|
334
330
|
|
|
@@ -350,7 +346,7 @@ async function renderDiagram() {
|
|
|
350
346
|
fill: color-mix(
|
|
351
347
|
in hsl,
|
|
352
348
|
var(--accentText) 70%,
|
|
353
|
-
var(--
|
|
349
|
+
var(--accentBackground)
|
|
354
350
|
) !important;
|
|
355
351
|
stroke: transparent !important;
|
|
356
352
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { onMounted, ref } from 'vue';
|
|
3
|
+
import { type ProseElement } from '@jsprose/core';
|
|
4
4
|
|
|
5
|
+
import Block from '../../app/shared/block/Block.vue';
|
|
5
6
|
import type { dependencySchema } from './dependency/core.js';
|
|
6
|
-
import
|
|
7
|
+
import { referenceSchema } from './reference/core.js';
|
|
7
8
|
import type { LinkStorage } from './storage.js';
|
|
8
9
|
import { useProseContext } from '../../app/composables/context.js';
|
|
9
10
|
import { useElementStorage } from '../../app/composables/storage.js';
|
|
10
11
|
import { useFormatText } from '../../app/composables/formatText.js';
|
|
11
12
|
import { useElementPhrase } from '../../app/composables/language.js';
|
|
12
13
|
import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
13
|
-
import
|
|
14
|
+
import type { ReferencePhrases } from './reference/phrases.js';
|
|
15
|
+
import type { ElementPhrases } from '../../app/language/element.js';
|
|
14
16
|
|
|
15
17
|
const { element } = defineProps<{
|
|
16
18
|
element:
|
|
@@ -19,89 +21,138 @@ const { element } = defineProps<{
|
|
|
19
21
|
}>();
|
|
20
22
|
|
|
21
23
|
const { EruditLink, EruditIcon, eruditIcons } = useProseContext();
|
|
24
|
+
const referencePhrase = (await useElementPhrase(
|
|
25
|
+
referenceSchema.name,
|
|
26
|
+
)) as ReferencePhrases;
|
|
22
27
|
const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
23
28
|
const formatText = useFormatText();
|
|
24
29
|
|
|
30
|
+
const elementPhrase = ref<ElementPhrases>();
|
|
31
|
+
const elementIcon = ref<string>();
|
|
32
|
+
|
|
33
|
+
if (linkStorage.type === 'unique') {
|
|
34
|
+
elementPhrase.value = await useElementPhrase(linkStorage.schemaName);
|
|
35
|
+
elementIcon.value = await useElementIcon(linkStorage.schemaName);
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
interface UIData {
|
|
26
|
-
|
|
27
|
-
text: string;
|
|
28
|
-
secondary?: {
|
|
39
|
+
header: {
|
|
29
40
|
icon: string;
|
|
30
41
|
text: string;
|
|
31
42
|
};
|
|
43
|
+
main: string;
|
|
44
|
+
footer?: {
|
|
45
|
+
icon?: string;
|
|
46
|
+
text: string;
|
|
47
|
+
};
|
|
32
48
|
}
|
|
33
49
|
|
|
34
|
-
const uiData =
|
|
50
|
+
const uiData: UIData = await (async () => {
|
|
51
|
+
switch (linkStorage.type) {
|
|
52
|
+
case 'unique': {
|
|
53
|
+
return {
|
|
54
|
+
header: {
|
|
55
|
+
icon: elementIcon.value!,
|
|
56
|
+
text: linkStorage.elementTitle || elementPhrase.value!.element_name,
|
|
57
|
+
},
|
|
58
|
+
main: element.data.label,
|
|
59
|
+
footer: linkStorage.content
|
|
60
|
+
? {
|
|
61
|
+
icon: eruditIcons[
|
|
62
|
+
linkStorage.content.contentType === 'topic'
|
|
63
|
+
? linkStorage.content.topicPart
|
|
64
|
+
: linkStorage.content.contentType
|
|
65
|
+
],
|
|
66
|
+
text: linkStorage.content.contentTitle,
|
|
67
|
+
}
|
|
68
|
+
: undefined,
|
|
69
|
+
} as UIData;
|
|
70
|
+
}
|
|
71
|
+
case 'contentItem':
|
|
72
|
+
return {
|
|
73
|
+
header: {
|
|
74
|
+
icon: eruditIcons[
|
|
75
|
+
linkStorage.content.contentType === 'topic'
|
|
76
|
+
? linkStorage.content.topicPart
|
|
77
|
+
: linkStorage.content.contentType
|
|
78
|
+
],
|
|
79
|
+
text: linkStorage.content.contentTitle,
|
|
80
|
+
},
|
|
81
|
+
main: element.data.label,
|
|
82
|
+
} as UIData;
|
|
83
|
+
case 'external':
|
|
84
|
+
return {
|
|
85
|
+
header: {
|
|
86
|
+
icon: 'arrow/outward-box',
|
|
87
|
+
text: referencePhrase.external_link,
|
|
88
|
+
},
|
|
89
|
+
main: element.data.label,
|
|
90
|
+
} as UIData;
|
|
91
|
+
case 'error':
|
|
92
|
+
return {
|
|
93
|
+
header: {
|
|
94
|
+
text: referencePhrase.broken_link,
|
|
95
|
+
},
|
|
96
|
+
main: element.data.label,
|
|
97
|
+
} as UIData;
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
35
100
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
icon: await useElementIcon(linkStorage.schemaName),
|
|
41
|
-
text: linkStorage.elementTitle || elementPhrase.element_name,
|
|
42
|
-
secondary: {
|
|
43
|
-
icon: eruditIcons[
|
|
44
|
-
linkStorage.content.contentType === 'topic'
|
|
45
|
-
? linkStorage.content.topicPart
|
|
46
|
-
: linkStorage.content.contentType
|
|
47
|
-
],
|
|
48
|
-
text: linkStorage.content.contentTitle,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
break;
|
|
52
|
-
case 'contentItem':
|
|
53
|
-
uiData.value = {
|
|
54
|
-
icon: eruditIcons[
|
|
55
|
-
linkStorage.content.contentType === 'topic'
|
|
56
|
-
? linkStorage.content.topicPart
|
|
57
|
-
: linkStorage.content.contentType
|
|
58
|
-
],
|
|
59
|
-
text: linkStorage.content.contentTitle,
|
|
60
|
-
};
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
throw new ProseError(
|
|
64
|
-
'BlockLink supports only Unique and Document link types!',
|
|
101
|
+
onMounted(() => {
|
|
102
|
+
if (linkStorage.type === 'error') {
|
|
103
|
+
console.warn(
|
|
104
|
+
`Error in link element with id "${element.id}": ${linkStorage.error}`,
|
|
65
105
|
);
|
|
66
|
-
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
67
108
|
</script>
|
|
68
109
|
|
|
69
110
|
<template>
|
|
70
111
|
<Block :element>
|
|
71
112
|
<EruditLink
|
|
72
113
|
target="_blank"
|
|
73
|
-
:to="linkStorage.resolvedHref"
|
|
74
|
-
class="
|
|
75
|
-
hocus:border-
|
|
76
|
-
|
|
114
|
+
:to="linkStorage.type === 'error' ? undefined : linkStorage.resolvedHref"
|
|
115
|
+
:class="[
|
|
116
|
+
`group hocus:bg-(--linkColor)/10 hocus:border-(--linkColor)/40 relative
|
|
117
|
+
block rounded-xl border-2 border-dashed border-(--linkColor)/20
|
|
118
|
+
bg-(--linkColor)/5 transition-[border,background]`,
|
|
119
|
+
linkStorage.type === 'error'
|
|
120
|
+
? `cursor-not-allowed [--linkColor:var(--color-red-500)]
|
|
121
|
+
dark:[--linkColor:var(--color-red-400)]`
|
|
122
|
+
: '[--linkColor:var(--color-brand)]',
|
|
123
|
+
]"
|
|
77
124
|
>
|
|
78
125
|
<EruditIcon
|
|
79
126
|
name="arrow/outward"
|
|
80
|
-
class="
|
|
81
|
-
|
|
127
|
+
class="group-hocus:text-(--linkColor)/20 p-small right-small float-right
|
|
128
|
+
shrink-0 text-[80px] text-(--linkColor)/15"
|
|
82
129
|
/>
|
|
83
|
-
<div
|
|
84
|
-
|
|
85
|
-
font-medium
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
130
|
+
<div class="p-(--proseAsideWidth)">
|
|
131
|
+
<div
|
|
132
|
+
class="group-hocus:text-(--linkColor) mb-small gap-small font-medium
|
|
133
|
+
text-(--linkColor)/80 transition-[color]"
|
|
134
|
+
>
|
|
135
|
+
<EruditIcon
|
|
136
|
+
v-if="uiData.header.icon"
|
|
137
|
+
:name="uiData.header.icon"
|
|
138
|
+
class="mr-small relative top-0.5 inline align-baseline text-[1.1em]"
|
|
139
|
+
/>
|
|
140
|
+
<span>{{ formatText(uiData.header.text) }}</span>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="text-text-muted">
|
|
143
|
+
{{ formatText(uiData.main) }}
|
|
144
|
+
</div>
|
|
145
|
+
<div
|
|
146
|
+
v-if="uiData.footer"
|
|
147
|
+
class="text-text-dimmed mt-small text-main-xs"
|
|
148
|
+
>
|
|
149
|
+
<EruditIcon
|
|
150
|
+
v-if="uiData.footer.icon"
|
|
151
|
+
:name="uiData.footer.icon"
|
|
152
|
+
class="mr-small relative top-0.5 inline align-baseline"
|
|
153
|
+
/>
|
|
154
|
+
<span>{{ formatText(uiData.footer.text) }}</span>
|
|
155
|
+
</div>
|
|
105
156
|
</div>
|
|
106
157
|
</EruditLink>
|
|
107
158
|
</Block>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { onMounted } from 'vue';
|
|
2
3
|
import type { ProseElement } from '@jsprose/core';
|
|
3
4
|
|
|
4
5
|
import type { depSchema } from './dependency/core.js';
|
|
@@ -27,7 +28,7 @@ const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
|
27
28
|
|
|
28
29
|
const icon = await (async () => {
|
|
29
30
|
switch (linkStorage.type) {
|
|
30
|
-
case '
|
|
31
|
+
case 'external':
|
|
31
32
|
return 'arrow/outward-box';
|
|
32
33
|
case 'contentItem':
|
|
33
34
|
return eruditIcons[
|
|
@@ -37,6 +38,8 @@ const icon = await (async () => {
|
|
|
37
38
|
];
|
|
38
39
|
case 'unique':
|
|
39
40
|
return await useElementIcon(linkStorage.schemaName);
|
|
41
|
+
case 'error':
|
|
42
|
+
return undefined;
|
|
40
43
|
}
|
|
41
44
|
})();
|
|
42
45
|
|
|
@@ -54,36 +57,60 @@ const doubleClick = {
|
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
function linkClick() {
|
|
57
|
-
if (doubleClick.timeout) {
|
|
60
|
+
if (doubleClick.timeout && linkStorage.type !== 'error') {
|
|
58
61
|
doubleClick.reset();
|
|
59
62
|
closePreview();
|
|
60
63
|
const openUrl =
|
|
61
|
-
linkStorage.type === '
|
|
64
|
+
linkStorage.type === 'external'
|
|
62
65
|
? linkStorage.resolvedHref
|
|
63
66
|
: baseUrl + linkStorage.resolvedHref.slice(1);
|
|
64
67
|
window.open(openUrl, '_blank');
|
|
65
68
|
return false;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
if (linkStorage.type === 'error') {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
{
|
|
75
|
+
setPreview(linkStorage.previewRequest);
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
doubleClick.startTimeout();
|
|
70
79
|
return false;
|
|
71
80
|
}
|
|
81
|
+
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
if (linkStorage.type === 'error') {
|
|
84
|
+
console.warn(
|
|
85
|
+
`Error in link element with id "${element.id}": ${linkStorage.error}`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
72
89
|
</script>
|
|
73
90
|
|
|
74
91
|
<template>
|
|
75
92
|
<Inliner :element>
|
|
76
93
|
<EruditLink
|
|
77
94
|
@click.capture.prevent="linkClick"
|
|
78
|
-
:to="linkStorage.resolvedHref"
|
|
95
|
+
:to="linkStorage.type === 'error' ? undefined : linkStorage.resolvedHref"
|
|
79
96
|
:style="{ '--tGap': '1px', '--xGap': '4px', '--bGap': '4px' }"
|
|
80
|
-
class="
|
|
81
|
-
-
|
|
82
|
-
pt-(--tGap) pb-(--bGap)
|
|
83
|
-
decoration-
|
|
84
|
-
|
|
97
|
+
:class="[
|
|
98
|
+
`relative -mx-[calc(var(--xGap)-3px)] -mt-(--tGap) -mb-(--bGap)
|
|
99
|
+
rounded-sm bg-transparent px-(--xGap) pt-(--tGap) pb-(--bGap)
|
|
100
|
+
whitespace-nowrap underline decoration-2 underline-offset-2
|
|
101
|
+
transition-[background]`,
|
|
102
|
+
linkStorage.type === 'error'
|
|
103
|
+
? `hocus:bg-red-400/20 cursor-not-allowed text-red-600
|
|
104
|
+
decoration-red-400/40 dark:text-red-400`
|
|
105
|
+
: `text-brand hocus:bg-brand/15
|
|
106
|
+
decoration-[color-mix(in_srgb,var(--color-brand)30%,transparent)]`,
|
|
107
|
+
]"
|
|
85
108
|
>
|
|
86
|
-
<EruditIcon
|
|
109
|
+
<EruditIcon
|
|
110
|
+
v-if="icon"
|
|
111
|
+
:name="icon"
|
|
112
|
+
class="micro:pr-1.5 inline pr-1 text-[1.3em]"
|
|
113
|
+
/>
|
|
87
114
|
<span class="whitespace-normal">
|
|
88
115
|
{{ formatText(element.data.label) }}
|
|
89
116
|
</span>
|
|
@@ -8,5 +8,5 @@ export function handleLinkTag(element, tagName, props, children) {
|
|
|
8
8
|
throw new ProseError(`<${tagName}> label cannot be empty!`);
|
|
9
9
|
}
|
|
10
10
|
element.data = { label };
|
|
11
|
-
element.storageKey = createLinkStorageKey(props.to
|
|
11
|
+
element.storageKey = createLinkStorageKey(props.to);
|
|
12
12
|
}
|
|
@@ -3,14 +3,14 @@ declare const _default: (import("../../../app/appElement.js").AppElement<{
|
|
|
3
3
|
type: "inliner";
|
|
4
4
|
linkable: true;
|
|
5
5
|
Data: import("../core.js").LinkData;
|
|
6
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
6
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
7
7
|
Children: undefined;
|
|
8
8
|
}> | import("../../../app/appElement.js").AppElement<{
|
|
9
9
|
name: "dependencyBlock";
|
|
10
10
|
type: "block";
|
|
11
11
|
linkable: true;
|
|
12
12
|
Data: import("../core.js").LinkData;
|
|
13
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
13
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
14
14
|
Children: undefined;
|
|
15
15
|
}>)[];
|
|
16
16
|
export default _default;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type TagChildren } from '@jsprose/core';
|
|
2
2
|
import { type LinkData, type LinkToProp } from '../core.js';
|
|
3
3
|
import { type NoSnippet, type NoToc } from '../../../tag.js';
|
|
4
|
-
import type { EruditRawElement } from '../../../rawElement.js';
|
|
5
4
|
export declare const depSchema: {
|
|
6
5
|
name: "dependencyInliner";
|
|
7
6
|
type: "inliner";
|
|
8
7
|
linkable: true;
|
|
9
8
|
Data: LinkData;
|
|
10
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
9
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
11
10
|
Children: undefined;
|
|
12
11
|
};
|
|
13
12
|
export declare const dependencySchema: {
|
|
@@ -15,7 +14,7 @@ export declare const dependencySchema: {
|
|
|
15
14
|
type: "block";
|
|
16
15
|
linkable: true;
|
|
17
16
|
Data: LinkData;
|
|
18
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
17
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
19
18
|
Children: undefined;
|
|
20
19
|
};
|
|
21
20
|
export declare const Dep: import("@jsprose/core").Tag<"Dep", {
|
|
@@ -23,7 +22,7 @@ export declare const Dep: import("@jsprose/core").Tag<"Dep", {
|
|
|
23
22
|
type: "inliner";
|
|
24
23
|
linkable: true;
|
|
25
24
|
Data: LinkData;
|
|
26
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
25
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
27
26
|
Children: undefined;
|
|
28
27
|
}, {
|
|
29
28
|
to: Exclude<LinkToProp, string>;
|
|
@@ -33,7 +32,7 @@ export declare const Dependency: import("@jsprose/core").Tag<"Dependency", {
|
|
|
33
32
|
type: "block";
|
|
34
33
|
linkable: true;
|
|
35
34
|
Data: LinkData;
|
|
36
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
35
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
37
36
|
Children: undefined;
|
|
38
37
|
}, {
|
|
39
38
|
to: Exclude<LinkToProp, string>;
|
|
@@ -43,7 +42,7 @@ export declare const depRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
|
43
42
|
type: "inliner";
|
|
44
43
|
linkable: true;
|
|
45
44
|
Data: LinkData;
|
|
46
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
45
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
47
46
|
Children: undefined;
|
|
48
47
|
}, {
|
|
49
48
|
Dep: import("@jsprose/core").Tag<"Dep", {
|
|
@@ -51,7 +50,7 @@ export declare const depRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
|
51
50
|
type: "inliner";
|
|
52
51
|
linkable: true;
|
|
53
52
|
Data: LinkData;
|
|
54
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
53
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
55
54
|
Children: undefined;
|
|
56
55
|
}, {
|
|
57
56
|
to: Exclude<LinkToProp, string>;
|
|
@@ -62,7 +61,7 @@ export declare const dependencyRegistryItem: import("@jsprose/core").RegistryIte
|
|
|
62
61
|
type: "block";
|
|
63
62
|
linkable: true;
|
|
64
63
|
Data: LinkData;
|
|
65
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
64
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
66
65
|
Children: undefined;
|
|
67
66
|
}, {
|
|
68
67
|
Dependency: import("@jsprose/core").Tag<"Dependency", {
|
|
@@ -70,7 +69,7 @@ export declare const dependencyRegistryItem: import("@jsprose/core").RegistryIte
|
|
|
70
69
|
type: "block";
|
|
71
70
|
linkable: true;
|
|
72
71
|
Data: LinkData;
|
|
73
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
72
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
74
73
|
Children: undefined;
|
|
75
74
|
}, {
|
|
76
75
|
to: Exclude<LinkToProp, string>;
|
|
@@ -82,7 +81,7 @@ declare const _default: [{
|
|
|
82
81
|
type: "inliner";
|
|
83
82
|
linkable: true;
|
|
84
83
|
Data: LinkData;
|
|
85
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
84
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
86
85
|
Children: undefined;
|
|
87
86
|
}, {
|
|
88
87
|
Dep: import("@jsprose/core").Tag<"Dep", {
|
|
@@ -90,7 +89,7 @@ declare const _default: [{
|
|
|
90
89
|
type: "inliner";
|
|
91
90
|
linkable: true;
|
|
92
91
|
Data: LinkData;
|
|
93
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
92
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
94
93
|
Children: undefined;
|
|
95
94
|
}, {
|
|
96
95
|
to: Exclude<LinkToProp, string>;
|
|
@@ -102,7 +101,7 @@ declare const _default: [{
|
|
|
102
101
|
type: "block";
|
|
103
102
|
linkable: true;
|
|
104
103
|
Data: LinkData;
|
|
105
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
104
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
106
105
|
Children: undefined;
|
|
107
106
|
}, {
|
|
108
107
|
Dependency: import("@jsprose/core").Tag<"Dependency", {
|
|
@@ -110,7 +109,7 @@ declare const _default: [{
|
|
|
110
109
|
type: "block";
|
|
111
110
|
linkable: true;
|
|
112
111
|
Data: LinkData;
|
|
113
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage;
|
|
112
|
+
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
114
113
|
Children: undefined;
|
|
115
114
|
}, {
|
|
116
115
|
to: Exclude<LinkToProp, string>;
|
|
@@ -118,8 +117,3 @@ declare const _default: [{
|
|
|
118
117
|
}, undefined>;
|
|
119
118
|
}];
|
|
120
119
|
export default _default;
|
|
121
|
-
export declare const dependencyStep: ({ rawElement, proseElement }: {
|
|
122
|
-
context: import("../../../context.js").EruditProseContext;
|
|
123
|
-
rawElement: EruditRawElement<import("@jsprose/core").AnySchema>;
|
|
124
|
-
proseElement: import("@jsprose/core").ProseElement<import("@jsprose/core").AnySchema>;
|
|
125
|
-
}) => string | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { defineRegistryItem, defineSchema
|
|
1
|
+
import { defineRegistryItem, defineSchema } from "@jsprose/core";
|
|
2
2
|
import { handleLinkTag } from "../core.js";
|
|
3
3
|
import { defineEruditTag } from "../../../tag.js";
|
|
4
|
-
import { defineResolveStep } from "../../../resolveStep.js";
|
|
5
4
|
import { defineEruditProseCoreElements } from "../../../coreElement.js";
|
|
6
5
|
export const depSchema = defineSchema({
|
|
7
6
|
name: "dependencyInliner",
|
|
@@ -34,18 +33,3 @@ export const dependencyRegistryItem = defineRegistryItem({
|
|
|
34
33
|
tags: [Dependency]
|
|
35
34
|
});
|
|
36
35
|
export default defineEruditProseCoreElements({ registryItem: depRegistryItem }, { registryItem: dependencyRegistryItem });
|
|
37
|
-
//
|
|
38
|
-
// Resolve
|
|
39
|
-
//
|
|
40
|
-
export const dependencyStep = defineResolveStep(({ rawElement, proseElement }) => {
|
|
41
|
-
if (!isRawElement(rawElement, depSchema) && !isRawElement(rawElement, dependencySchema)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (!proseElement.id) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (!rawElement.storageKey) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
return rawElement.storageKey;
|
|
51
|
-
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { defineElementLanguage } from "../../../../app/language/element.js";
|
|
2
|
-
export default defineElementLanguage({
|
|
2
|
+
export default defineElementLanguage({
|
|
3
|
+
element_name: "Reference",
|
|
4
|
+
external_link: "External link",
|
|
5
|
+
broken_link: "Broken link"
|
|
6
|
+
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { defineElementLanguage } from "../../../../app/language/element.js";
|
|
2
|
-
export default defineElementLanguage({
|
|
2
|
+
export default defineElementLanguage({
|
|
3
|
+
element_name: "Ссылка",
|
|
4
|
+
external_link: "Внешняя ссылка",
|
|
5
|
+
broken_link: "Неработающая ссылка"
|
|
6
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ContentLinkTag = 'Dep' | 'Dependency' | 'Ref' | 'Reference';
|
|
2
|
+
export interface ContentLinkUsage {
|
|
3
|
+
type: ContentLinkTag;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export type ContentLinks = Map<string, ContentLinkUsage[]>;
|
|
7
|
+
export interface ContentLinkStepReturn {
|
|
8
|
+
storageKey: string;
|
|
9
|
+
label: string;
|
|
10
|
+
type: ContentLinkTag;
|
|
11
|
+
}
|
|
12
|
+
export declare const contentLinkStep: ({ rawElement, proseElement }: {
|
|
13
|
+
context: import("../../context.js").EruditProseContext;
|
|
14
|
+
rawElement: import("../../rawElement.js").EruditRawElement<import("@jsprose/core").AnySchema>;
|
|
15
|
+
proseElement: import("@jsprose/core").ProseElement<import("@jsprose/core").AnySchema>;
|
|
16
|
+
}) => ContentLinkStepReturn | undefined;
|