@erudit-js/prose 4.1.1 → 4.2.0-dev.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.
- package/dist/app/appElement.d.ts +7 -6
- package/dist/app/appElement.js +1 -1
- package/dist/app/composables/anchor.d.ts +7 -7
- package/dist/app/composables/appElement.d.ts +4 -4
- package/dist/app/composables/appElement.js +3 -3
- package/dist/app/composables/context.d.ts +3 -2
- package/dist/app/composables/elementIcon.d.ts +2 -2
- package/dist/app/composables/elementIcon.js +1 -1
- package/dist/app/composables/language.d.ts +2 -2
- package/dist/app/composables/language.js +1 -1
- package/dist/app/composables/storage.d.ts +4 -4
- package/dist/app/composables/storage.js +0 -4
- package/dist/app/default/Mix.vue +2 -2
- package/dist/app/default/Text.vue +2 -2
- package/dist/app/shared/Prose.vue +3 -3
- package/dist/app/shared/Render.vue +5 -14
- package/dist/app/shared/block/AsideMenu.vue +2 -2
- package/dist/app/shared/block/AsideMenuCopyLink.vue +1 -1
- package/dist/app/shared/block/Block.vue +4 -4
- package/dist/app/shared/inliner/Inliner.vue +2 -2
- package/dist/coreElement.d.ts +25 -7
- package/dist/coreElement.js +2 -2
- package/dist/elements/accent/Accent.vue +4 -4
- package/dist/elements/accent/AccentColumnSection.vue +2 -2
- package/dist/elements/accent/AccentRowSections.vue +2 -2
- package/dist/elements/accent/app.d.ts +3 -3
- package/dist/elements/accent/app.js +2 -2
- package/dist/elements/accent/core.d.ts +61 -300
- package/dist/elements/accent/core.js +83 -68
- package/dist/elements/callout/Callout.vue +4 -4
- package/dist/elements/callout/app.d.ts +1 -8
- package/dist/elements/callout/app.js +2 -2
- package/dist/elements/callout/core.d.ts +21 -59
- package/dist/elements/callout/core.js +18 -17
- package/dist/elements/caption/Caption.vue +3 -3
- package/dist/elements/caption/app.d.ts +1 -8
- package/dist/elements/caption/app.js +2 -2
- package/dist/elements/caption/core.d.ts +21 -99
- package/dist/elements/caption/core.js +18 -22
- package/dist/elements/details/Details.vue +3 -3
- package/dist/elements/details/app.d.ts +1 -8
- package/dist/elements/details/app.js +2 -2
- package/dist/elements/details/core.d.ts +18 -61
- package/dist/elements/details/core.js +16 -11
- package/dist/elements/diagram/Diagram.vue +14 -11
- package/dist/elements/diagram/app.d.ts +1 -29
- package/dist/elements/diagram/app.js +2 -2
- package/dist/elements/diagram/core.d.ts +14 -177
- package/dist/elements/diagram/core.js +5 -8
- package/dist/elements/emphasis/Emphasis.vue +3 -3
- package/dist/elements/emphasis/app.d.ts +1 -8
- package/dist/elements/emphasis/app.js +2 -2
- package/dist/elements/emphasis/core.d.ts +13 -76
- package/dist/elements/emphasis/core.js +8 -9
- package/dist/elements/flex/Flex.vue +3 -3
- package/dist/elements/flex/app.d.ts +1 -8
- package/dist/elements/flex/app.js +2 -2
- package/dist/elements/flex/core.d.ts +16 -58
- package/dist/elements/flex/core.js +6 -7
- package/dist/elements/gallery/Gallery.vue +3 -3
- package/dist/elements/gallery/app.d.ts +1 -22
- package/dist/elements/gallery/app.js +2 -2
- package/dist/elements/gallery/core.d.ts +11 -132
- package/dist/elements/gallery/core.js +4 -5
- package/dist/elements/heading/Heading.vue +3 -3
- package/dist/elements/heading/_global.d.ts +2 -2
- package/dist/elements/heading/app.d.ts +1 -8
- package/dist/elements/heading/app.js +2 -2
- package/dist/elements/heading/core.d.ts +13 -97
- package/dist/elements/heading/core.js +8 -8
- package/dist/elements/horizontalLine/app.d.ts +1 -8
- package/dist/elements/horizontalLine/app.js +2 -2
- package/dist/elements/horizontalLine/core.d.ts +9 -47
- package/dist/elements/horizontalLine/core.js +4 -5
- package/dist/elements/image/Image.vue +3 -3
- package/dist/elements/image/ImageElement.vue +4 -4
- package/dist/elements/image/app.d.ts +1 -15
- package/dist/elements/image/app.js +2 -2
- package/dist/elements/image/core.d.ts +29 -108
- package/dist/elements/image/core.js +12 -19
- package/dist/elements/image/storage.d.ts +1 -1
- package/dist/elements/image/storage.js +6 -6
- package/dist/elements/lineBreak/app.d.ts +1 -8
- package/dist/elements/lineBreak/app.js +2 -2
- package/dist/elements/lineBreak/core.d.ts +9 -47
- package/dist/elements/lineBreak/core.js +4 -5
- package/dist/elements/link/BlockLink.vue +4 -6
- package/dist/elements/link/Link.vue +4 -4
- package/dist/elements/link/core.d.ts +6 -6
- package/dist/elements/link/core.js +4 -3
- package/dist/elements/link/dependency/app.d.ts +1 -15
- package/dist/elements/link/dependency/app.js +3 -3
- package/dist/elements/link/dependency/core.d.ts +27 -105
- package/dist/elements/link/dependency/core.js +6 -8
- package/dist/elements/link/hook.d.ts +12 -0
- package/dist/elements/link/hook.js +45 -0
- package/dist/elements/link/reference/app.d.ts +1 -15
- package/dist/elements/link/reference/app.js +3 -3
- package/dist/elements/link/reference/core.d.ts +24 -103
- package/dist/elements/link/reference/core.js +6 -8
- package/dist/elements/link/storage.js +1 -1
- package/dist/elements/list/List.vue +7 -5
- package/dist/elements/list/_global.d.ts +3 -3
- package/dist/elements/list/app.d.ts +1 -15
- package/dist/elements/list/app.js +2 -2
- package/dist/elements/list/core.d.ts +33 -155
- package/dist/elements/list/core.js +20 -18
- package/dist/elements/math/app.d.ts +1 -15
- package/dist/elements/math/app.js +3 -3
- package/dist/elements/math/block.d.ts +31 -43
- package/dist/elements/math/block.js +10 -9
- package/dist/elements/math/components/BlockMath.vue +4 -4
- package/dist/elements/math/components/InlinerMath.vue +4 -4
- package/dist/elements/math/core.d.ts +25 -53
- package/dist/elements/math/core.js +3 -11
- package/dist/elements/math/inliner.d.ts +24 -36
- package/dist/elements/math/inliner.js +10 -12
- package/dist/elements/paragraph/Paragraph.vue +3 -3
- package/dist/elements/paragraph/app.d.ts +1 -8
- package/dist/elements/paragraph/app.js +2 -2
- package/dist/elements/paragraph/core.d.ts +12 -53
- package/dist/elements/paragraph/core.js +6 -7
- package/dist/elements/problem/app.d.ts +1 -29
- package/dist/elements/problem/app.js +4 -4
- package/dist/elements/problem/components/Problem.vue +3 -3
- package/dist/elements/problem/components/ProblemContent.vue +15 -21
- package/dist/elements/problem/components/ProblemExpanderSection.vue +2 -2
- package/dist/elements/problem/components/Problems.vue +11 -7
- package/dist/elements/problem/components/SubProblem.vue +3 -4
- package/dist/elements/problem/components/expanders/Check.vue +3 -3
- package/dist/elements/problem/components/expanders/Checks.vue +6 -3
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +3 -7
- package/dist/elements/problem/components/expanders/Hint.vue +3 -3
- package/dist/elements/problem/composables/problemScript.d.ts +2 -2
- package/dist/elements/problem/core.d.ts +63 -299
- package/dist/elements/problem/core.js +9 -11
- package/dist/elements/problem/hook.d.ts +1 -0
- package/dist/elements/problem/hook.js +14 -0
- package/dist/elements/problem/problem.d.ts +20 -77
- package/dist/elements/problem/problem.js +6 -6
- package/dist/elements/problem/problemCheck.d.ts +33 -83
- package/dist/elements/problem/problemCheck.js +16 -10
- package/dist/elements/problem/problemContent.d.ts +54 -401
- package/dist/elements/problem/problemContent.js +47 -56
- package/dist/elements/problem/problemScript.d.ts +18 -10
- package/dist/elements/problem/problemScript.js +15 -26
- package/dist/elements/problem/problems.d.ts +29 -188
- package/dist/elements/problem/problems.js +11 -15
- package/dist/elements/problem/storage.d.ts +1 -1
- package/dist/elements/problem/storage.js +2 -3
- package/dist/elements/table/Table.vue +3 -3
- package/dist/elements/table/app.d.ts +1 -29
- package/dist/elements/table/app.js +2 -2
- package/dist/elements/table/core.d.ts +28 -309
- package/dist/elements/table/core.js +17 -29
- package/dist/elements/video/Video.vue +4 -4
- package/dist/elements/video/app.d.ts +1 -15
- package/dist/elements/video/app.js +2 -2
- package/dist/elements/video/core.d.ts +26 -106
- package/dist/elements/video/core.js +11 -16
- package/dist/elements/video/storage.d.ts +1 -1
- package/dist/elements/video/storage.js +2 -3
- package/dist/error.d.ts +3 -0
- package/dist/error.js +6 -0
- package/dist/include.d.ts +4 -4
- package/dist/include.js +6 -12
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -11
- package/dist/rawElement.d.ts +9 -6
- package/dist/rawElement.js +4 -0
- package/dist/rawToProse/countSchemas.d.ts +1 -0
- package/dist/rawToProse/countSchemas.js +11 -0
- package/dist/rawToProse/hook.d.ts +39 -0
- package/dist/rawToProse/hook.js +6 -0
- package/dist/rawToProse/index.d.ts +34 -0
- package/dist/rawToProse/index.js +92 -0
- package/dist/rawToProse/uniqueTitles.d.ts +1 -0
- package/dist/rawToProse/uniqueTitles.js +11 -0
- package/dist/shared/filePath.js +2 -2
- package/dist/shared/paragraphWrap.d.ts +3 -3
- package/dist/shared/paragraphWrap.js +7 -12
- package/dist/slugify/index.d.ts +3 -1
- package/dist/slugify/index.js +5 -6
- package/dist/slugify/languages/en.js +1 -1
- package/dist/slugify/languages/ru.js +1 -1
- package/dist/snippet.d.ts +39 -33
- package/dist/snippet.js +139 -73
- package/dist/tag.d.ts +22 -19
- package/dist/tag.js +19 -15
- package/dist/toc.d.ts +12 -18
- package/dist/toc.js +120 -42
- package/package.json +7 -6
- package/dist/app/default/Inliners.vue +0 -11
- package/dist/context.d.ts +0 -4
- package/dist/context.js +0 -1
- package/dist/elements/link/step.d.ts +0 -16
- package/dist/elements/link/step.js +0 -36
- package/dist/elements/problem/step.d.ts +0 -5
- package/dist/elements/problem/step.js +0 -13
- package/dist/resolve.d.ts +0 -21
- package/dist/resolve.js +0 -102
- package/dist/resolveStep.d.ts +0 -9
- package/dist/resolveStep.js +0 -3
- package/dist/title.d.ts +0 -8
- package/dist/title.js +0 -6
- package/dist/utils/docs.d.ts +0 -1
- package/dist/utils/docs.js +0 -22
- package/types.d.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProseAppElement } from "../../app/appElement.js";
|
|
2
2
|
import { imageSchema } from "./core.js";
|
|
3
|
-
export default
|
|
3
|
+
export default defineProseAppElement({
|
|
4
4
|
schema: imageSchema,
|
|
5
5
|
component: () => import("./Image.vue"),
|
|
6
6
|
languages: {
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { type Schema } from 'tsprose';
|
|
2
|
+
import { captionSchema } from '../caption/core.js';
|
|
1
3
|
import type { Invert } from '../../shared/invert.js';
|
|
4
|
+
export interface ImageSchema extends Schema {
|
|
5
|
+
name: 'image';
|
|
6
|
+
type: 'block';
|
|
7
|
+
linkable: true;
|
|
8
|
+
Data: ImageData;
|
|
9
|
+
Storage: ImageStorage;
|
|
10
|
+
Children: [typeof captionSchema] | undefined;
|
|
11
|
+
}
|
|
2
12
|
export interface ImageData {
|
|
3
13
|
src: string;
|
|
4
14
|
invert?: Invert;
|
|
@@ -9,128 +19,39 @@ export interface ImageStorage {
|
|
|
9
19
|
width: number;
|
|
10
20
|
height: number;
|
|
11
21
|
}
|
|
12
|
-
export declare const imageSchema:
|
|
13
|
-
|
|
14
|
-
type: "block";
|
|
15
|
-
linkable: true;
|
|
16
|
-
Data: ImageData;
|
|
17
|
-
Storage: ImageStorage;
|
|
18
|
-
Children: [{
|
|
19
|
-
name: "caption";
|
|
20
|
-
type: "inliner";
|
|
21
|
-
linkable: false;
|
|
22
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
23
|
-
Storage: undefined;
|
|
24
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
25
|
-
}] | undefined;
|
|
26
|
-
};
|
|
27
|
-
export declare const Image: import("@jsprose/core").Tag<"Image", {
|
|
28
|
-
name: "image";
|
|
29
|
-
type: "block";
|
|
30
|
-
linkable: true;
|
|
31
|
-
Data: ImageData;
|
|
32
|
-
Storage: ImageStorage;
|
|
33
|
-
Children: [{
|
|
34
|
-
name: "caption";
|
|
35
|
-
type: "inliner";
|
|
36
|
-
linkable: false;
|
|
37
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
38
|
-
Storage: undefined;
|
|
39
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
40
|
-
}] | undefined;
|
|
41
|
-
}, {
|
|
22
|
+
export declare const imageSchema: ImageSchema;
|
|
23
|
+
export declare const Image: import("../../tag.js").ToEruditTag<ImageSchema, "Image", {
|
|
42
24
|
src: string;
|
|
43
25
|
invert?: Invert;
|
|
44
26
|
width?: string;
|
|
45
27
|
children?: {};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
linkable: true;
|
|
51
|
-
Data: ImageData;
|
|
52
|
-
Storage: ImageStorage;
|
|
53
|
-
Children: [{
|
|
54
|
-
name: "caption";
|
|
55
|
-
type: "inliner";
|
|
56
|
-
linkable: false;
|
|
57
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
58
|
-
Storage: undefined;
|
|
59
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
60
|
-
}] | undefined;
|
|
61
|
-
}, {
|
|
62
|
-
Image: import("@jsprose/core").Tag<"Image", {
|
|
63
|
-
name: "image";
|
|
64
|
-
type: "block";
|
|
65
|
-
linkable: true;
|
|
66
|
-
Data: ImageData;
|
|
67
|
-
Storage: ImageStorage;
|
|
68
|
-
Children: [{
|
|
69
|
-
name: "caption";
|
|
70
|
-
type: "inliner";
|
|
71
|
-
linkable: false;
|
|
72
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
73
|
-
Storage: undefined;
|
|
74
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
75
|
-
}] | undefined;
|
|
76
|
-
}, {
|
|
28
|
+
}>;
|
|
29
|
+
declare const _default: {
|
|
30
|
+
readonly schema: ImageSchema;
|
|
31
|
+
readonly tags: [import("../../tag.js").ToEruditTag<ImageSchema, "Image", {
|
|
77
32
|
src: string;
|
|
78
33
|
invert?: Invert;
|
|
79
34
|
width?: string;
|
|
80
35
|
children?: {};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
linkable: false;
|
|
94
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
95
|
-
Storage: undefined;
|
|
96
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
97
|
-
}] | undefined;
|
|
98
|
-
}, {
|
|
99
|
-
Image: import("@jsprose/core").Tag<"Image", {
|
|
100
|
-
name: "image";
|
|
101
|
-
type: "block";
|
|
102
|
-
linkable: true;
|
|
103
|
-
Data: ImageData;
|
|
104
|
-
Storage: ImageStorage;
|
|
105
|
-
Children: [{
|
|
106
|
-
name: "caption";
|
|
107
|
-
type: "inliner";
|
|
108
|
-
linkable: false;
|
|
109
|
-
Data: import("../caption/core.js").CaptionData | undefined;
|
|
110
|
-
Storage: undefined;
|
|
111
|
-
Children: import("@jsprose/core").InlinerSchema[];
|
|
112
|
-
}] | undefined;
|
|
113
|
-
}, {
|
|
114
|
-
src: string;
|
|
115
|
-
invert?: Invert;
|
|
116
|
-
width?: string;
|
|
117
|
-
children?: {};
|
|
118
|
-
} & import("../../toc.js").ObjPropToc & import("../../snippet.js").ObjPropSnippet>;
|
|
119
|
-
}, undefined>;
|
|
120
|
-
dependencies: {
|
|
121
|
-
photoswipe: {
|
|
36
|
+
}>];
|
|
37
|
+
readonly rawToProseHook: ({ result }: {
|
|
38
|
+
task: import("../../index.js").EruditRawToProseTask;
|
|
39
|
+
result: import("../../index.js").EruditRawToProseResult;
|
|
40
|
+
}) => {
|
|
41
|
+
matchStep: ({ rawElement }: {
|
|
42
|
+
rawElement: import("../../rawElement.js").ToEruditRawElement<ImageSchema>;
|
|
43
|
+
proseElement: import("tsprose").ProseElement;
|
|
44
|
+
}) => void;
|
|
45
|
+
};
|
|
46
|
+
readonly dependencies: {
|
|
47
|
+
readonly photoswipe: {
|
|
122
48
|
optimize: boolean;
|
|
123
49
|
transpile: boolean;
|
|
124
50
|
};
|
|
125
|
-
'photoswipe/lightbox': {
|
|
51
|
+
readonly 'photoswipe/lightbox': {
|
|
126
52
|
optimize: boolean;
|
|
127
53
|
transpile: boolean;
|
|
128
54
|
};
|
|
129
55
|
};
|
|
130
56
|
};
|
|
131
57
|
export default _default;
|
|
132
|
-
export declare const imageSrcStep: ({ rawElement }: {
|
|
133
|
-
context: import("../../context.js").EruditProseContext;
|
|
134
|
-
rawElement: import("../../rawElement.js").EruditRawElement<import("@jsprose/core").AnySchema>;
|
|
135
|
-
proseElement: import("@jsprose/core").ProseElement<import("@jsprose/core").AnySchema>;
|
|
136
|
-
}) => string | undefined;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineSchema, ensureTagChildren } from "tsprose";
|
|
2
2
|
import { captionSchema } from "../caption/core.js";
|
|
3
3
|
import { defineEruditTag } from "../../tag.js";
|
|
4
|
-
import { defineEruditProseCoreElement } from "../../coreElement.js";
|
|
5
|
-
import { defineResolveStep } from "../../resolveStep.js";
|
|
6
4
|
import { photoswipeDependency } from "../../shared/photoswipe.js";
|
|
5
|
+
import { defineProseCoreElement } from "../../coreElement.js";
|
|
7
6
|
export const imageSchema = defineSchema({
|
|
8
7
|
name: "image",
|
|
9
8
|
type: "block",
|
|
10
9
|
linkable: true
|
|
11
|
-
})
|
|
10
|
+
});
|
|
12
11
|
export const Image = defineEruditTag({
|
|
13
12
|
tagName: "Image",
|
|
14
13
|
schema: imageSchema
|
|
15
14
|
})(({ element, tagName, props, children }) => {
|
|
16
15
|
if (children) {
|
|
17
|
-
|
|
18
|
-
element.children = children;
|
|
16
|
+
ensureTagChildren(tagName, children, captionSchema);
|
|
17
|
+
element.children = [children[0]];
|
|
19
18
|
}
|
|
20
19
|
element.data = { src: props.src };
|
|
21
20
|
element.storageKey = props.src;
|
|
@@ -26,19 +25,13 @@ export const Image = defineEruditTag({
|
|
|
26
25
|
element.data.invert = props.invert;
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
|
-
export
|
|
28
|
+
export default defineProseCoreElement({
|
|
30
29
|
schema: imageSchema,
|
|
31
|
-
tags: [Image]
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
tags: [Image],
|
|
31
|
+
rawToProseHook: ({ result }) => {
|
|
32
|
+
return { matchStep: ({ rawElement }) => {
|
|
33
|
+
result.files.add(rawElement.data.src);
|
|
34
|
+
} };
|
|
35
|
+
},
|
|
35
36
|
dependencies: { ...photoswipeDependency }
|
|
36
37
|
});
|
|
37
|
-
//
|
|
38
|
-
// Resolve
|
|
39
|
-
//
|
|
40
|
-
export const imageSrcStep = defineResolveStep(({ rawElement }) => {
|
|
41
|
-
if (isRawElement(rawElement, imageSchema)) {
|
|
42
|
-
return rawElement.data.src;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -3,4 +3,4 @@ export declare function getImageSize(imageAbsoluteSrc: string): Promise<{
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
}>;
|
|
6
|
-
export declare function createImageStorage(projectAbsPath: string, projectBaseUrl: string,
|
|
6
|
+
export declare function createImageStorage(projectAbsPath: string, projectBaseUrl: string, imageRelSrc: string): Promise<ImageStorage>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { imageSizeFromFile } from "image-size/fromFile";
|
|
2
|
-
import {
|
|
3
|
-
import { projectRelFilePath } from "../../shared/filePath.js";
|
|
2
|
+
import { EruditProseError } from "../../error.js";
|
|
4
3
|
export async function getImageSize(imageAbsoluteSrc) {
|
|
5
4
|
try {
|
|
6
5
|
const size = await imageSizeFromFile(imageAbsoluteSrc);
|
|
@@ -9,12 +8,13 @@ export async function getImageSize(imageAbsoluteSrc) {
|
|
|
9
8
|
height: size.height
|
|
10
9
|
};
|
|
11
10
|
} catch (error) {
|
|
12
|
-
throw new
|
|
11
|
+
throw new EruditProseError(`Failed to get image size for ${imageAbsoluteSrc}: ${error}`);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
export async function createImageStorage(projectAbsPath, projectBaseUrl,
|
|
16
|
-
const
|
|
17
|
-
const
|
|
14
|
+
export async function createImageStorage(projectAbsPath, projectBaseUrl, imageRelSrc) {
|
|
15
|
+
const imageAbsSrc = `${projectAbsPath}/${imageRelSrc}`;
|
|
16
|
+
const size = await getImageSize(imageAbsSrc);
|
|
17
|
+
const resolvedSrc = projectBaseUrl + "file/" + imageRelSrc;
|
|
18
18
|
return {
|
|
19
19
|
resolvedSrc,
|
|
20
20
|
width: size.width,
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
declare const _default: import("../../app/appElement.js").
|
|
2
|
-
name: "br";
|
|
3
|
-
type: "inliner";
|
|
4
|
-
linkable: false;
|
|
5
|
-
Data: undefined;
|
|
6
|
-
Storage: undefined;
|
|
7
|
-
Children: undefined;
|
|
8
|
-
}>;
|
|
1
|
+
declare const _default: import("../../app/appElement.js").ProseAppElement<import("./core.js").BrSchema>;
|
|
9
2
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProseAppElement } from "../../app/appElement.js";
|
|
2
2
|
import { brSchema } from "./core.js";
|
|
3
|
-
export default
|
|
3
|
+
export default defineProseAppElement({
|
|
4
4
|
schema: brSchema,
|
|
5
5
|
component: () => import("./LineBreak.vue")
|
|
6
6
|
});
|
|
@@ -1,54 +1,16 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export
|
|
3
|
-
name:
|
|
4
|
-
type:
|
|
1
|
+
import { type Schema } from 'tsprose';
|
|
2
|
+
export interface BrSchema extends Schema {
|
|
3
|
+
name: 'br';
|
|
4
|
+
type: 'inliner';
|
|
5
5
|
linkable: false;
|
|
6
6
|
Data: undefined;
|
|
7
7
|
Storage: undefined;
|
|
8
8
|
Children: undefined;
|
|
9
|
-
}
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
type: "inliner";
|
|
13
|
-
linkable: false;
|
|
14
|
-
Data: undefined;
|
|
15
|
-
Storage: undefined;
|
|
16
|
-
Children: undefined;
|
|
17
|
-
}, NoTagChildren>;
|
|
18
|
-
export declare const brRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
19
|
-
name: "br";
|
|
20
|
-
type: "inliner";
|
|
21
|
-
linkable: false;
|
|
22
|
-
Data: undefined;
|
|
23
|
-
Storage: undefined;
|
|
24
|
-
Children: undefined;
|
|
25
|
-
}, {
|
|
26
|
-
Br: import("@jsprose/core").Tag<"Br", {
|
|
27
|
-
name: "br";
|
|
28
|
-
type: "inliner";
|
|
29
|
-
linkable: false;
|
|
30
|
-
Data: undefined;
|
|
31
|
-
Storage: undefined;
|
|
32
|
-
Children: undefined;
|
|
33
|
-
}, NoTagChildren>;
|
|
34
|
-
}, undefined>;
|
|
9
|
+
}
|
|
10
|
+
export declare const brSchema: BrSchema;
|
|
11
|
+
export declare const Br: import("../../tag.js").ToEruditTag<BrSchema, "Br", unknown>;
|
|
35
12
|
declare const _default: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type: "inliner";
|
|
39
|
-
linkable: false;
|
|
40
|
-
Data: undefined;
|
|
41
|
-
Storage: undefined;
|
|
42
|
-
Children: undefined;
|
|
43
|
-
}, {
|
|
44
|
-
Br: import("@jsprose/core").Tag<"Br", {
|
|
45
|
-
name: "br";
|
|
46
|
-
type: "inliner";
|
|
47
|
-
linkable: false;
|
|
48
|
-
Data: undefined;
|
|
49
|
-
Storage: undefined;
|
|
50
|
-
Children: undefined;
|
|
51
|
-
}, NoTagChildren>;
|
|
52
|
-
}, undefined>;
|
|
13
|
+
readonly schema: BrSchema;
|
|
14
|
+
readonly tags: [import("../../tag.js").ToEruditTag<BrSchema, "Br", unknown>];
|
|
53
15
|
};
|
|
54
16
|
export default _default;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineEruditProseCoreElement } from "../../coreElement.js";
|
|
1
|
+
import { defineSchema, ensureTagNoChildren } from "tsprose";
|
|
3
2
|
import { defineEruditTag } from "../../tag.js";
|
|
3
|
+
import { defineProseCoreElement } from "../../coreElement.js";
|
|
4
4
|
export const brSchema = defineSchema({
|
|
5
5
|
name: "br",
|
|
6
6
|
type: "inliner",
|
|
7
7
|
linkable: false
|
|
8
|
-
})
|
|
8
|
+
});
|
|
9
9
|
export const Br = defineEruditTag({
|
|
10
10
|
tagName: "Br",
|
|
11
11
|
schema: brSchema
|
|
12
12
|
})(({ tagName, children }) => {
|
|
13
13
|
ensureTagNoChildren(tagName, children);
|
|
14
14
|
});
|
|
15
|
-
export
|
|
15
|
+
export default defineProseCoreElement({
|
|
16
16
|
schema: brSchema,
|
|
17
17
|
tags: [Br]
|
|
18
18
|
});
|
|
19
|
-
export default defineEruditProseCoreElement({ registryItem: brRegistryItem });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { onMounted, ref } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import type { ToProseElement } from 'tsprose';
|
|
4
4
|
|
|
5
5
|
import Block from '../../app/shared/block/Block.vue';
|
|
6
|
-
import type {
|
|
7
|
-
import { referenceSchema } from './reference/core.js';
|
|
6
|
+
import type { DependencySchema } from './dependency/core.js';
|
|
7
|
+
import { referenceSchema, type ReferenceSchema } from './reference/core.js';
|
|
8
8
|
import type { LinkStorage } from './storage.js';
|
|
9
9
|
import { useProseContext } from '../../app/composables/context.js';
|
|
10
10
|
import { useElementStorage } from '../../app/composables/storage.js';
|
|
@@ -15,9 +15,7 @@ import type { ReferencePhrases } from './reference/phrases.js';
|
|
|
15
15
|
import type { ElementPhrases } from '../../app/language/element.js';
|
|
16
16
|
|
|
17
17
|
const { element } = defineProps<{
|
|
18
|
-
element:
|
|
19
|
-
| ProseElement<typeof referenceSchema>
|
|
20
|
-
| ProseElement<typeof dependencySchema>;
|
|
18
|
+
element: ToProseElement<ReferenceSchema> | ToProseElement<DependencySchema>;
|
|
21
19
|
}>();
|
|
22
20
|
|
|
23
21
|
const { EruditLink, EruditIcon, eruditIcons } = useProseContext();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { onMounted } from 'vue';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ToProseElement } from 'tsprose';
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
5
|
+
import type { DepSchema } from './dependency/core.js';
|
|
6
|
+
import type { RefSchema } from './reference/core.js';
|
|
7
7
|
import type { LinkStorage } from './storage.js';
|
|
8
8
|
import { useProseContext } from '../../app/composables/context.js';
|
|
9
9
|
import { useFormatText } from '../../app/composables/formatText.js';
|
|
@@ -12,7 +12,7 @@ import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
|
12
12
|
import Inliner from '../../app/shared/inliner/Inliner.vue';
|
|
13
13
|
|
|
14
14
|
const { element } = defineProps<{
|
|
15
|
-
element:
|
|
15
|
+
element: ToProseElement<RefSchema> | ToProseElement<DepSchema>;
|
|
16
16
|
}>();
|
|
17
17
|
|
|
18
18
|
const {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NormalizedChildren, type Unique } from 'tsprose';
|
|
2
2
|
import type { GlobalContentTypeguard } from '@erudit-js/core/content/global';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
3
|
+
import type { ToEruditRawElement } from '../../rawElement.js';
|
|
4
|
+
import type { DepSchema, DependencySchema } from './dependency/core.js';
|
|
5
|
+
import type { ReferenceSchema, RefSchema } from './reference/core.js';
|
|
6
6
|
export interface LinkData {
|
|
7
7
|
label: string;
|
|
8
8
|
storageKey?: string;
|
|
9
9
|
}
|
|
10
|
-
export type LinkToProp = string | GlobalContentTypeguard |
|
|
11
|
-
export declare function handleLinkTag(element:
|
|
10
|
+
export type LinkToProp = string | GlobalContentTypeguard | Unique;
|
|
11
|
+
export declare function handleLinkTag(element: ToEruditRawElement<DepSchema | DependencySchema | RefSchema | ReferenceSchema>, tagName: string, props: {
|
|
12
12
|
to?: LinkToProp;
|
|
13
13
|
on?: LinkToProp;
|
|
14
14
|
}, children: NormalizedChildren): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureTagChildren, textSchema } from "tsprose";
|
|
2
2
|
import { createLinkStorageKey } from "./storage.js";
|
|
3
|
+
import { EruditProseError } from "../../error.js";
|
|
3
4
|
export function handleLinkTag(element, tagName, props, children) {
|
|
4
|
-
|
|
5
|
+
ensureTagChildren(tagName, children, textSchema);
|
|
5
6
|
const child = children[0];
|
|
6
7
|
const label = child.data.trim();
|
|
7
8
|
if (!label) {
|
|
8
|
-
throw new
|
|
9
|
+
throw new EruditProseError(`<${tagName}> label cannot be empty!`);
|
|
9
10
|
}
|
|
10
11
|
element.data = { label };
|
|
11
12
|
element.storageKey = createLinkStorageKey(props.to ?? props.on);
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
declare const _default: (import("../../../app/appElement.js").
|
|
2
|
-
name: "dependencyInliner";
|
|
3
|
-
type: "inliner";
|
|
4
|
-
linkable: true;
|
|
5
|
-
Data: import("../core.js").LinkData;
|
|
6
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
7
|
-
Children: undefined;
|
|
8
|
-
}> | import("../../../app/appElement.js").AppElement<{
|
|
9
|
-
name: "dependencyBlock";
|
|
10
|
-
type: "block";
|
|
11
|
-
linkable: true;
|
|
12
|
-
Data: import("../core.js").LinkData;
|
|
13
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
14
|
-
Children: undefined;
|
|
15
|
-
}>)[];
|
|
1
|
+
declare const _default: (import("../../../app/appElement.js").ProseAppElement<import("./core.js").DepSchema> | import("../../../app/appElement.js").ProseAppElement<import("./core.js").DependencySchema>)[];
|
|
16
2
|
export default _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProseAppElement } from "../../../app/appElement.js";
|
|
2
2
|
import { dependencySchema, depSchema } from "./core.js";
|
|
3
|
-
export default [
|
|
3
|
+
export default [defineProseAppElement({
|
|
4
4
|
schema: depSchema,
|
|
5
5
|
component: () => import("../Link.vue")
|
|
6
|
-
}),
|
|
6
|
+
}), defineProseAppElement({
|
|
7
7
|
schema: dependencySchema,
|
|
8
8
|
component: () => import("../BlockLink.vue"),
|
|
9
9
|
icon: () => import("../icon.svg?raw"),
|
|
@@ -1,119 +1,41 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RequiredChildren, type Schema } from 'tsprose';
|
|
2
2
|
import { type LinkData, type LinkToProp } from '../core.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type { ExternalLinkStorage, LinkStorage } from '../storage.js';
|
|
4
|
+
import type { NoSnippet } from '../../../snippet.js';
|
|
5
|
+
import type { NoToc } from '../../../toc.js';
|
|
6
|
+
export interface DepSchema extends Schema {
|
|
7
|
+
name: 'dependencyInliner';
|
|
8
|
+
type: 'inliner';
|
|
7
9
|
linkable: true;
|
|
8
10
|
Data: LinkData;
|
|
9
|
-
Storage:
|
|
11
|
+
Storage: Exclude<LinkStorage, ExternalLinkStorage>;
|
|
10
12
|
Children: undefined;
|
|
11
|
-
}
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
}
|
|
14
|
+
export declare const depSchema: DepSchema;
|
|
15
|
+
export interface DependencySchema extends Schema {
|
|
16
|
+
name: 'dependencyBlock';
|
|
17
|
+
type: 'block';
|
|
15
18
|
linkable: true;
|
|
16
19
|
Data: LinkData;
|
|
17
|
-
Storage:
|
|
20
|
+
Storage: Exclude<LinkStorage, ExternalLinkStorage>;
|
|
18
21
|
Children: undefined;
|
|
19
|
-
}
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
22
|
-
type: "inliner";
|
|
23
|
-
linkable: true;
|
|
24
|
-
Data: LinkData;
|
|
25
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
26
|
-
Children: undefined;
|
|
27
|
-
}, {
|
|
22
|
+
}
|
|
23
|
+
export declare const dependencySchema: DependencySchema;
|
|
24
|
+
export declare const Dep: import("../../../tag.js").ToEruditTag<DepSchema, "Dep", {
|
|
28
25
|
on: Exclude<LinkToProp, string>;
|
|
29
|
-
} &
|
|
30
|
-
export declare const Dependency: import("
|
|
31
|
-
name: "dependencyBlock";
|
|
32
|
-
type: "block";
|
|
33
|
-
linkable: true;
|
|
34
|
-
Data: LinkData;
|
|
35
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
36
|
-
Children: undefined;
|
|
37
|
-
}, {
|
|
26
|
+
} & RequiredChildren & NoSnippet & NoToc>;
|
|
27
|
+
export declare const Dependency: import("../../../tag.js").ToEruditTag<DependencySchema, "Dependency", {
|
|
38
28
|
on: Exclude<LinkToProp, string>;
|
|
39
|
-
} &
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
linkable: true;
|
|
44
|
-
Data: LinkData;
|
|
45
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
46
|
-
Children: undefined;
|
|
47
|
-
}, {
|
|
48
|
-
Dep: import("@jsprose/core").Tag<"Dep", {
|
|
49
|
-
name: "dependencyInliner";
|
|
50
|
-
type: "inliner";
|
|
51
|
-
linkable: true;
|
|
52
|
-
Data: LinkData;
|
|
53
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
54
|
-
Children: undefined;
|
|
55
|
-
}, {
|
|
29
|
+
} & RequiredChildren & NoSnippet & NoToc>;
|
|
30
|
+
declare const _default: [{
|
|
31
|
+
readonly schema: DepSchema;
|
|
32
|
+
readonly tags: [import("../../../tag.js").ToEruditTag<DepSchema, "Dep", {
|
|
56
33
|
on: Exclude<LinkToProp, string>;
|
|
57
|
-
} &
|
|
58
|
-
}, undefined>;
|
|
59
|
-
export declare const dependencyRegistryItem: import("@jsprose/core").RegistryItem<{
|
|
60
|
-
name: "dependencyBlock";
|
|
61
|
-
type: "block";
|
|
62
|
-
linkable: true;
|
|
63
|
-
Data: LinkData;
|
|
64
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
65
|
-
Children: undefined;
|
|
34
|
+
} & RequiredChildren & NoSnippet & NoToc>];
|
|
66
35
|
}, {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
type: "block";
|
|
70
|
-
linkable: true;
|
|
71
|
-
Data: LinkData;
|
|
72
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
73
|
-
Children: undefined;
|
|
74
|
-
}, {
|
|
36
|
+
readonly schema: DependencySchema;
|
|
37
|
+
readonly tags: [import("../../../tag.js").ToEruditTag<DependencySchema, "Dependency", {
|
|
75
38
|
on: Exclude<LinkToProp, string>;
|
|
76
|
-
} &
|
|
77
|
-
}, undefined>;
|
|
78
|
-
declare const _default: [{
|
|
79
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
80
|
-
name: "dependencyInliner";
|
|
81
|
-
type: "inliner";
|
|
82
|
-
linkable: true;
|
|
83
|
-
Data: LinkData;
|
|
84
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
85
|
-
Children: undefined;
|
|
86
|
-
}, {
|
|
87
|
-
Dep: import("@jsprose/core").Tag<"Dep", {
|
|
88
|
-
name: "dependencyInliner";
|
|
89
|
-
type: "inliner";
|
|
90
|
-
linkable: true;
|
|
91
|
-
Data: LinkData;
|
|
92
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
93
|
-
Children: undefined;
|
|
94
|
-
}, {
|
|
95
|
-
on: Exclude<LinkToProp, string>;
|
|
96
|
-
} & TagChildren & NoSnippet & NoToc>;
|
|
97
|
-
}, undefined>;
|
|
98
|
-
}, {
|
|
99
|
-
registryItem: import("@jsprose/core").RegistryItem<{
|
|
100
|
-
name: "dependencyBlock";
|
|
101
|
-
type: "block";
|
|
102
|
-
linkable: true;
|
|
103
|
-
Data: LinkData;
|
|
104
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
105
|
-
Children: undefined;
|
|
106
|
-
}, {
|
|
107
|
-
Dependency: import("@jsprose/core").Tag<"Dependency", {
|
|
108
|
-
name: "dependencyBlock";
|
|
109
|
-
type: "block";
|
|
110
|
-
linkable: true;
|
|
111
|
-
Data: LinkData;
|
|
112
|
-
Storage: import("../storage.js").ContentItemLinkStorage | import("../storage.js").UniqueLinkStorage | import("../storage.js").ErrorLinkStorage;
|
|
113
|
-
Children: undefined;
|
|
114
|
-
}, {
|
|
115
|
-
on: Exclude<LinkToProp, string>;
|
|
116
|
-
} & TagChildren & NoSnippet & NoToc>;
|
|
117
|
-
}, undefined>;
|
|
39
|
+
} & RequiredChildren & NoSnippet & NoToc>];
|
|
118
40
|
}];
|
|
119
41
|
export default _default;
|