@erudit-js/prose 4.0.0-dev.3 → 4.0.0-dev.5
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/default/Inliners.vue +11 -11
- package/dist/app/default/Mix.vue +11 -11
- package/dist/app/default/Text.vue +25 -25
- package/dist/app/shared/Prose.vue +40 -40
- package/dist/app/shared/Render.vue +51 -51
- package/dist/app/shared/block/AsideMenu.vue +44 -44
- package/dist/app/shared/block/AsideMenuButton.vue +51 -53
- package/dist/app/shared/block/AsideMenuCopyLink.vue +40 -40
- package/dist/app/shared/block/AsideMenuSeparator.vue +3 -3
- package/dist/app/shared/block/Block.vue +270 -275
- package/dist/app/shared/inliner/Inliner.vue +11 -11
- package/dist/app/shared/photoswipe/style.css +22 -26
- package/dist/elements/accent/Accent.vue +88 -92
- package/dist/elements/accent/AccentColumnSection.vue +61 -61
- package/dist/elements/accent/AccentRowSections.vue +64 -65
- package/dist/elements/callout/Callout.vue +81 -85
- package/dist/elements/callout/_global.d.ts +15 -15
- package/dist/elements/caption/Caption.vue +44 -47
- package/dist/elements/caption/_global.d.ts +26 -26
- package/dist/elements/details/Details.vue +49 -50
- package/dist/elements/details/_global.d.ts +27 -27
- package/dist/elements/diagram/Diagram.vue +360 -374
- package/dist/elements/diagram/_global.d.ts +19 -19
- package/dist/elements/diagram/core.d.ts +0 -4
- package/dist/elements/diagram/core.js +1 -7
- package/dist/elements/emphasis/Emphasis.vue +25 -25
- package/dist/elements/emphasis/_global.d.ts +18 -18
- package/dist/elements/flex/Flex.vue +36 -38
- package/dist/elements/flex/_global.d.ts +23 -23
- package/dist/elements/gallery/Gallery.vue +56 -56
- package/dist/elements/gallery/_global.d.ts +18 -18
- package/dist/elements/heading/Heading.vue +44 -44
- package/dist/elements/heading/_global.d.ts +42 -45
- package/dist/elements/heading/core.js +7 -14
- package/dist/elements/horizontalLine/HorizontalLine.vue +6 -6
- package/dist/elements/horizontalLine/_global.d.ts +17 -17
- package/dist/elements/image/Image.vue +15 -15
- package/dist/elements/image/ImageElement.vue +80 -80
- package/dist/elements/image/_global.d.ts +18 -18
- package/dist/elements/lineBreak/LineBreak.vue +3 -3
- package/dist/elements/lineBreak/_global.d.ts +18 -18
- package/dist/elements/link/BlockLink.vue +108 -110
- package/dist/elements/link/Link.vue +92 -96
- package/dist/elements/link/dependency/_global.d.ts +47 -47
- package/dist/elements/link/reference/_global.d.ts +49 -49
- package/dist/elements/list/List.vue +58 -65
- package/dist/elements/list/_global.d.ts +50 -50
- package/dist/elements/math/_global.d.ts +72 -72
- package/dist/elements/math/_global.ts +3 -3
- package/dist/elements/math/components/BlockMath.vue +30 -30
- package/dist/elements/math/components/InlinerMath.vue +65 -65
- package/dist/elements/math/components/Katex.vue +88 -89
- package/dist/elements/math/components/MathGroup.vue +41 -41
- package/dist/elements/math/katex.js +17 -6
- package/dist/elements/paragraph/Paragraph.vue +25 -27
- package/dist/elements/paragraph/_global.d.ts +27 -27
- package/dist/elements/problem/_global.d.ts +112 -112
- package/dist/elements/problem/components/Problem.vue +22 -22
- package/dist/elements/problem/components/ProblemButton.vue +20 -21
- package/dist/elements/problem/components/ProblemContainer.vue +8 -8
- package/dist/elements/problem/components/ProblemContent.vue +356 -371
- package/dist/elements/problem/components/ProblemExpander.vue +7 -7
- package/dist/elements/problem/components/ProblemExpanderSection.vue +57 -57
- package/dist/elements/problem/components/ProblemHeader.vue +100 -102
- package/dist/elements/problem/components/Problems.vue +83 -87
- package/dist/elements/problem/components/SubProblem.vue +14 -14
- package/dist/elements/problem/components/expanders/Check.vue +153 -150
- package/dist/elements/problem/components/expanders/Checks.vue +146 -83
- package/dist/elements/problem/components/expanders/DefaultPlusSections.vue +38 -38
- package/dist/elements/problem/components/expanders/Hint.vue +26 -26
- package/dist/elements/problem/core.d.ts +23 -23
- package/dist/elements/problem/problemContent.d.ts +134 -30
- package/dist/elements/problem/problemContent.js +157 -197
- package/dist/elements/problem/problemScript.d.ts +2 -2
- package/dist/elements/problem/problemScript.js +2 -2
- package/dist/elements/problem/rng.d.ts +1 -1
- package/dist/elements/problem/rng.js +1 -1
- package/dist/elements/table/Table.vue +100 -102
- package/dist/elements/table/_global.d.ts +36 -36
- package/dist/elements/video/Video.vue +110 -109
- package/dist/elements/video/_global.d.ts +18 -18
- package/package.json +42 -43
- package/types.d.ts +4 -4
|
@@ -1,96 +1,92 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { ProseElement } from '@jsprose/core';
|
|
3
|
-
|
|
4
|
-
import type { depSchema } from './dependency/core.js';
|
|
5
|
-
import type { refSchema } from './reference/core.js';
|
|
6
|
-
import type { LinkStorage } from './storage.js';
|
|
7
|
-
import { useProseContext } from '../../app/composables/context.js';
|
|
8
|
-
import { useFormatText } from '../../app/composables/formatText.js';
|
|
9
|
-
import { useElementStorage } from '../../app/composables/storage.js';
|
|
10
|
-
import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
11
|
-
import Inliner from '../../app/shared/inliner/Inliner.vue';
|
|
12
|
-
|
|
13
|
-
const { element } = defineProps<{
|
|
14
|
-
|
|
15
|
-
}>();
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = useProseContext();
|
|
25
|
-
const formatText = useFormatText();
|
|
26
|
-
const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
27
|
-
|
|
28
|
-
const icon = await (async () => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})();
|
|
42
|
-
|
|
43
|
-
const doubleClick = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
function linkClick() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</span>
|
|
94
|
-
</EruditLink>
|
|
95
|
-
</Inliner>
|
|
96
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import type { depSchema } from './dependency/core.js';
|
|
5
|
+
import type { refSchema } from './reference/core.js';
|
|
6
|
+
import type { LinkStorage } from './storage.js';
|
|
7
|
+
import { useProseContext } from '../../app/composables/context.js';
|
|
8
|
+
import { useFormatText } from '../../app/composables/formatText.js';
|
|
9
|
+
import { useElementStorage } from '../../app/composables/storage.js';
|
|
10
|
+
import { useElementIcon } from '../../app/composables/elementIcon.js';
|
|
11
|
+
import Inliner from '../../app/shared/inliner/Inliner.vue';
|
|
12
|
+
|
|
13
|
+
const { element } = defineProps<{
|
|
14
|
+
element: ProseElement<typeof refSchema> | ProseElement<typeof depSchema>;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
EruditIcon,
|
|
19
|
+
EruditLink,
|
|
20
|
+
eruditIcons,
|
|
21
|
+
setPreview,
|
|
22
|
+
closePreview,
|
|
23
|
+
baseUrl,
|
|
24
|
+
} = useProseContext();
|
|
25
|
+
const formatText = useFormatText();
|
|
26
|
+
const linkStorage = (await useElementStorage(element as any)) as LinkStorage;
|
|
27
|
+
|
|
28
|
+
const icon = await (async () => {
|
|
29
|
+
switch (linkStorage.type) {
|
|
30
|
+
case 'direct':
|
|
31
|
+
return 'arrow/outward-box';
|
|
32
|
+
case 'contentItem':
|
|
33
|
+
return eruditIcons[
|
|
34
|
+
linkStorage.content.contentType === 'topic'
|
|
35
|
+
? linkStorage.content.topicPart
|
|
36
|
+
: linkStorage.content.contentType
|
|
37
|
+
];
|
|
38
|
+
case 'unique':
|
|
39
|
+
return await useElementIcon(linkStorage.schemaName);
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
const doubleClick = {
|
|
44
|
+
timeout: undefined as ReturnType<typeof setTimeout> | undefined,
|
|
45
|
+
startTimeout() {
|
|
46
|
+
this.timeout = setTimeout(() => {
|
|
47
|
+
this.reset();
|
|
48
|
+
}, 400);
|
|
49
|
+
},
|
|
50
|
+
reset() {
|
|
51
|
+
clearTimeout(this.timeout);
|
|
52
|
+
this.timeout = undefined;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function linkClick() {
|
|
57
|
+
if (doubleClick.timeout) {
|
|
58
|
+
doubleClick.reset();
|
|
59
|
+
closePreview();
|
|
60
|
+
const openUrl =
|
|
61
|
+
linkStorage.type === 'direct'
|
|
62
|
+
? linkStorage.resolvedHref
|
|
63
|
+
: baseUrl + linkStorage.resolvedHref.slice(1);
|
|
64
|
+
window.open(openUrl, '_blank');
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setPreview(linkStorage.previewRequest);
|
|
69
|
+
doubleClick.startTimeout();
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<Inliner :element>
|
|
76
|
+
<EruditLink
|
|
77
|
+
@click.capture.prevent="linkClick"
|
|
78
|
+
:to="linkStorage.resolvedHref"
|
|
79
|
+
:style="{ '--tGap': '1px', '--xGap': '4px', '--bGap': '4px' }"
|
|
80
|
+
class="text-brand hocus:bg-brand/15 relative -mx-[calc(var(--xGap)-3px)]
|
|
81
|
+
-mt-(--tGap) -mb-(--bGap) rounded-sm bg-transparent px-(--xGap)
|
|
82
|
+
pt-(--tGap) pb-(--bGap) whitespace-nowrap underline
|
|
83
|
+
decoration-[color-mix(in_srgb,var(--color-brand)30%,transparent)]
|
|
84
|
+
decoration-2 underline-offset-2 transition-[background]"
|
|
85
|
+
>
|
|
86
|
+
<EruditIcon :name="icon" class="micro:pr-1.5 inline pr-1 text-[1.3em]" />
|
|
87
|
+
<span class="whitespace-normal">
|
|
88
|
+
{{ formatText(element.data.label) }}
|
|
89
|
+
</span>
|
|
90
|
+
</EruditLink>
|
|
91
|
+
</Inliner>
|
|
92
|
+
</template>
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dependencies are used to reference content the reader **must know and understand** in order to proceed further.
|
|
3
|
-
*
|
|
4
|
-
* Never use dependencies to simply mention other content; for that, use `<Ref>` and `<Reference>` tags.
|
|
5
|
-
*
|
|
6
|
-
* Dependency types:
|
|
7
|
-
* * Global Content — points to content items and uniques via `$CONTENT` global object.
|
|
8
|
-
* * Unique — points to a unique element directly.
|
|
9
|
-
*
|
|
10
|
-
* @title Inliner Dependency
|
|
11
|
-
* @layout inliner
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* // Global content dependency
|
|
15
|
-
* <P>
|
|
16
|
-
* We need to use <Dep to={$CONTENT.combinatorics.sumRule}>Rule of Sum</Dep> to calculate the answer.
|
|
17
|
-
* </P>
|
|
18
|
-
*
|
|
19
|
-
* // Link to uniques directly
|
|
20
|
-
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
21
|
-
* <P>
|
|
22
|
-
* We need to use <Dep to={uniques.intro}>introduction</Dep> to understand this transform.
|
|
23
|
-
* </P>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export const Dep = '_tag_';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Same as `<Dep>`, but as a block element which draws more attention.
|
|
30
|
-
*
|
|
31
|
-
* @title Block Dependency
|
|
32
|
-
* @layout block
|
|
33
|
-
* @example
|
|
34
|
-
* ```tsx
|
|
35
|
-
* // Global content dependency
|
|
36
|
-
* <Dependency to={$CONTENT.combinatorics.sumRule}>
|
|
37
|
-
* To proceed, you must understand the Rule of Sum in combinatorics.
|
|
38
|
-
* </Dependency>
|
|
39
|
-
*
|
|
40
|
-
* // Link to uniques directly
|
|
41
|
-
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
42
|
-
* <Dependency to={uniques.intro}>
|
|
43
|
-
* To proceed, you must read the introduction.
|
|
44
|
-
* </Dependency>
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export const Dependency = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* Dependencies are used to reference content the reader **must know and understand** in order to proceed further.
|
|
3
|
+
*
|
|
4
|
+
* Never use dependencies to simply mention other content; for that, use `<Ref>` and `<Reference>` tags.
|
|
5
|
+
*
|
|
6
|
+
* Dependency types:
|
|
7
|
+
* * Global Content — points to content items and uniques via `$CONTENT` global object.
|
|
8
|
+
* * Unique — points to a unique element directly.
|
|
9
|
+
*
|
|
10
|
+
* @title Inliner Dependency
|
|
11
|
+
* @layout inliner
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Global content dependency
|
|
15
|
+
* <P>
|
|
16
|
+
* We need to use <Dep to={$CONTENT.combinatorics.sumRule}>Rule of Sum</Dep> to calculate the answer.
|
|
17
|
+
* </P>
|
|
18
|
+
*
|
|
19
|
+
* // Link to uniques directly
|
|
20
|
+
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
21
|
+
* <P>
|
|
22
|
+
* We need to use <Dep to={uniques.intro}>introduction</Dep> to understand this transform.
|
|
23
|
+
* </P>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const Dep = '_tag_';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Same as `<Dep>`, but as a block element which draws more attention.
|
|
30
|
+
*
|
|
31
|
+
* @title Block Dependency
|
|
32
|
+
* @layout block
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Global content dependency
|
|
36
|
+
* <Dependency to={$CONTENT.combinatorics.sumRule}>
|
|
37
|
+
* To proceed, you must understand the Rule of Sum in combinatorics.
|
|
38
|
+
* </Dependency>
|
|
39
|
+
*
|
|
40
|
+
* // Link to uniques directly
|
|
41
|
+
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
42
|
+
* <Dependency to={uniques.intro}>
|
|
43
|
+
* To proceed, you must read the introduction.
|
|
44
|
+
* </Dependency>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export const Dependency = '_tag_';
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* References are used to simply mention, **not requiring knowledge of** other content inside or outside site.
|
|
3
|
-
*
|
|
4
|
-
* Reference types:
|
|
5
|
-
* * Global Content — points to content items and uniques via `$CONTENT` global object.
|
|
6
|
-
* * Unique — points to a unique element directly.
|
|
7
|
-
* * Direct — points to an external URL (when possible, avoid using of these).
|
|
8
|
-
*
|
|
9
|
-
* @title Inliner Reference
|
|
10
|
-
* @layout inliner
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* // Global content reference
|
|
14
|
-
* <P>
|
|
15
|
-
* The method we used here is somewhat similar to <Ref to={$CONTENT.combinatorics.sumRule}>Rule of Sum</Ref> in combinatorics.
|
|
16
|
-
* </P>
|
|
17
|
-
*
|
|
18
|
-
* // Link to uniques directly
|
|
19
|
-
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
20
|
-
* <P>
|
|
21
|
-
* If you remember, we also did this transform back in the <Ref to={uniques.intro}>introduction</Ref>.
|
|
22
|
-
* </P>
|
|
23
|
-
*
|
|
24
|
-
* // Direct reference
|
|
25
|
-
* <Ref to="https://google.com">Just Google It!</Ref>
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export const Ref = '_tag_';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Same as `<Ref>`, but as a block element which draws more attention.
|
|
32
|
-
*
|
|
33
|
-
* @title Block Reference
|
|
34
|
-
* @layout block
|
|
35
|
-
* @example
|
|
36
|
-
* ```tsx
|
|
37
|
-
* // Global content reference
|
|
38
|
-
* <Reference to={$CONTENT.combinatorics.sumRule}>
|
|
39
|
-
* There is a similar method called Rule of Sum in combinatorics which you might want to review.
|
|
40
|
-
* </Reference>
|
|
41
|
-
*
|
|
42
|
-
* // Link to uniques directly
|
|
43
|
-
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
44
|
-
* <Reference to={uniques.intro}>
|
|
45
|
-
* If you remember, we also did this transform back in the introduction.
|
|
46
|
-
* </Reference>
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export const Reference = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* References are used to simply mention, **not requiring knowledge of** other content inside or outside site.
|
|
3
|
+
*
|
|
4
|
+
* Reference types:
|
|
5
|
+
* * Global Content — points to content items and uniques via `$CONTENT` global object.
|
|
6
|
+
* * Unique — points to a unique element directly.
|
|
7
|
+
* * Direct — points to an external URL (when possible, avoid using of these).
|
|
8
|
+
*
|
|
9
|
+
* @title Inliner Reference
|
|
10
|
+
* @layout inliner
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Global content reference
|
|
14
|
+
* <P>
|
|
15
|
+
* The method we used here is somewhat similar to <Ref to={$CONTENT.combinatorics.sumRule}>Rule of Sum</Ref> in combinatorics.
|
|
16
|
+
* </P>
|
|
17
|
+
*
|
|
18
|
+
* // Link to uniques directly
|
|
19
|
+
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
20
|
+
* <P>
|
|
21
|
+
* If you remember, we also did this transform back in the <Ref to={uniques.intro}>introduction</Ref>.
|
|
22
|
+
* </P>
|
|
23
|
+
*
|
|
24
|
+
* // Direct reference
|
|
25
|
+
* <Ref to="https://google.com">Just Google It!</Ref>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const Ref = '_tag_';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Same as `<Ref>`, but as a block element which draws more attention.
|
|
32
|
+
*
|
|
33
|
+
* @title Block Reference
|
|
34
|
+
* @layout block
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Global content reference
|
|
38
|
+
* <Reference to={$CONTENT.combinatorics.sumRule}>
|
|
39
|
+
* There is a similar method called Rule of Sum in combinatorics which you might want to review.
|
|
40
|
+
* </Reference>
|
|
41
|
+
*
|
|
42
|
+
* // Link to uniques directly
|
|
43
|
+
* <P $={uniques.intro}>Intro Paragraph</P>
|
|
44
|
+
* <Reference to={uniques.intro}>
|
|
45
|
+
* If you remember, we also did this transform back in the introduction.
|
|
46
|
+
* </Reference>
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const Reference = '_tag_';
|
|
@@ -1,65 +1,58 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { ProseElement } from '@jsprose/core';
|
|
3
|
-
|
|
4
|
-
import { listSchema } from './core.js';
|
|
5
|
-
import Render from '../../app/shared/Render.vue';
|
|
6
|
-
import Block from '../../app/shared/block/Block.vue';
|
|
7
|
-
|
|
8
|
-
defineProps<{ element: ProseElement<typeof listSchema> }>();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
:element="liItem"
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
</li>
|
|
63
|
-
</component>
|
|
64
|
-
</Block>
|
|
65
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import { listSchema } from './core.js';
|
|
5
|
+
import Render from '../../app/shared/Render.vue';
|
|
6
|
+
import Block from '../../app/shared/block/Block.vue';
|
|
7
|
+
|
|
8
|
+
defineProps<{ element: ProseElement<typeof listSchema> }>();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<Block :element>
|
|
13
|
+
<component
|
|
14
|
+
:is="element.data.type"
|
|
15
|
+
class="micro:[--proseGap:18px]"
|
|
16
|
+
:style="{
|
|
17
|
+
'--liBorder':
|
|
18
|
+
'color-mix(in hsl, var(--accentText, var(--color-text-muted)) 50%, var(--color-bg-main))',
|
|
19
|
+
'--liBackground':
|
|
20
|
+
'color-mix(in hsl, var(--accentBackground, var(--color-text-disabled)) 40%, var(--color-bg-main))',
|
|
21
|
+
'--liText': 'var(--accentText, var(--color-text-muted))',
|
|
22
|
+
}"
|
|
23
|
+
v-bind="
|
|
24
|
+
element.data.type === 'ol' ? { start: element.data.start ?? 1 } : {}
|
|
25
|
+
"
|
|
26
|
+
>
|
|
27
|
+
<li
|
|
28
|
+
v-for="(listItem, i) of element.children"
|
|
29
|
+
class="relative flex not-last-of-type:mb-(--proseGap)"
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
class="micro:left-[11px] micro:w-[2px] absolute top-[3px] bottom-[5px]
|
|
33
|
+
left-[9px] w-[1px] bg-(--liBorder)"
|
|
34
|
+
></div>
|
|
35
|
+
<div class="relative shrink-0">
|
|
36
|
+
<div
|
|
37
|
+
class="micro:top-[1.5px] micro:size-[23px] relative top-[3px] flex
|
|
38
|
+
size-[20px] items-center justify-center rounded-full border
|
|
39
|
+
border-(--liBorder) bg-(--liBackground) font-semibold
|
|
40
|
+
text-(--liText)"
|
|
41
|
+
>
|
|
42
|
+
<template v-if="element.data.type === 'ol'">
|
|
43
|
+
<div class="micro:text-[13px] text-[10px]">
|
|
44
|
+
{{ i + (element.data.start ?? 0) }}
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
<template v-else>
|
|
48
|
+
<div class="size-1.5 rounded-full bg-(--liText)"></div>
|
|
49
|
+
</template>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="flex-1">
|
|
53
|
+
<Render v-for="liItem of listItem.children" :element="liItem" />
|
|
54
|
+
</div>
|
|
55
|
+
</li>
|
|
56
|
+
</component>
|
|
57
|
+
</Block>
|
|
58
|
+
</template>
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lists can be either ordered (numbered) or unordered (bulleted).
|
|
3
|
-
* Ordered lists support a `start` attribute to specify the starting number.
|
|
4
|
-
*
|
|
5
|
-
* Each list must contain only `<Li>` (list item) elements as children.
|
|
6
|
-
* List items can contain inliners or blocks.
|
|
7
|
-
*
|
|
8
|
-
* @title List
|
|
9
|
-
* @layout block
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* <List type="ul">
|
|
13
|
-
* <Li>First unordered item</Li>
|
|
14
|
-
* <Li>
|
|
15
|
-
* <P>Second unordered item with paragraph inside</P>
|
|
16
|
-
* <P>Another paragraph in the same item</P>
|
|
17
|
-
* </Li>
|
|
18
|
-
* </List>
|
|
19
|
-
*
|
|
20
|
-
* <List type="ol">
|
|
21
|
-
* <Li>First ordered item (numbered 1)</Li>
|
|
22
|
-
* </List>
|
|
23
|
-
*
|
|
24
|
-
* <List type="ol" start={3}>
|
|
25
|
-
* <Li>Third ordered item (numbered 3)</Li>
|
|
26
|
-
* <Li>Fourth ordered item (numbered 4)</Li>
|
|
27
|
-
* </List>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export const List = '_tag_';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* List item element.
|
|
34
|
-
* Must be used only inside `<List>` elements.
|
|
35
|
-
*
|
|
36
|
-
* Can contain inliners or blocks as children.
|
|
37
|
-
*
|
|
38
|
-
* @title List Item
|
|
39
|
-
* @layout block
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* <Li>Simple list item with inliners</Li>
|
|
43
|
-
*
|
|
44
|
-
* <Li>
|
|
45
|
-
* <P>List item with a paragraph inside</P>
|
|
46
|
-
* <P>Another paragraph in the same item</P>
|
|
47
|
-
* </Li>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export const Li = '_tag_';
|
|
1
|
+
/**
|
|
2
|
+
* Lists can be either ordered (numbered) or unordered (bulleted).
|
|
3
|
+
* Ordered lists support a `start` attribute to specify the starting number.
|
|
4
|
+
*
|
|
5
|
+
* Each list must contain only `<Li>` (list item) elements as children.
|
|
6
|
+
* List items can contain inliners or blocks.
|
|
7
|
+
*
|
|
8
|
+
* @title List
|
|
9
|
+
* @layout block
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <List type="ul">
|
|
13
|
+
* <Li>First unordered item</Li>
|
|
14
|
+
* <Li>
|
|
15
|
+
* <P>Second unordered item with paragraph inside</P>
|
|
16
|
+
* <P>Another paragraph in the same item</P>
|
|
17
|
+
* </Li>
|
|
18
|
+
* </List>
|
|
19
|
+
*
|
|
20
|
+
* <List type="ol">
|
|
21
|
+
* <Li>First ordered item (numbered 1)</Li>
|
|
22
|
+
* </List>
|
|
23
|
+
*
|
|
24
|
+
* <List type="ol" start={3}>
|
|
25
|
+
* <Li>Third ordered item (numbered 3)</Li>
|
|
26
|
+
* <Li>Fourth ordered item (numbered 4)</Li>
|
|
27
|
+
* </List>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const List = '_tag_';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* List item element.
|
|
34
|
+
* Must be used only inside `<List>` elements.
|
|
35
|
+
*
|
|
36
|
+
* Can contain inliners or blocks as children.
|
|
37
|
+
*
|
|
38
|
+
* @title List Item
|
|
39
|
+
* @layout block
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Li>Simple list item with inliners</Li>
|
|
43
|
+
*
|
|
44
|
+
* <Li>
|
|
45
|
+
* <P>List item with a paragraph inside</P>
|
|
46
|
+
* <P>Another paragraph in the same item</P>
|
|
47
|
+
* </Li>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const Li = '_tag_';
|