@erudit-js/prose 4.0.0-dev.4 → 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,11 +1,11 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { inlinersSchema, ProseElement } from '@jsprose/core';
|
|
3
|
-
|
|
4
|
-
import Render from '../shared/Render.vue';
|
|
5
|
-
|
|
6
|
-
defineProps<{ element: ProseElement<typeof inlinersSchema> }>();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
|
|
11
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { inlinersSchema, ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import Render from '../shared/Render.vue';
|
|
5
|
+
|
|
6
|
+
defineProps<{ element: ProseElement<typeof inlinersSchema> }>();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Render v-for="child of element.children" :element="child" />
|
|
11
|
+
</template>
|
package/dist/app/default/Mix.vue
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { type mixSchema, type ProseElement } from '@jsprose/core';
|
|
3
|
-
|
|
4
|
-
import Render from '../shared/Render.vue';
|
|
5
|
-
|
|
6
|
-
const { element } = defineProps<{ element: ProseElement<typeof mixSchema> }>();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
|
|
11
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { type mixSchema, type ProseElement } from '@jsprose/core';
|
|
3
|
+
|
|
4
|
+
import Render from '../shared/Render.vue';
|
|
5
|
+
|
|
6
|
+
const { element } = defineProps<{ element: ProseElement<typeof mixSchema> }>();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Render v-for="child of element.children" :element="child" />
|
|
11
|
+
</template>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { Text, h } from 'vue';
|
|
3
|
-
import type { ProseElement, textSchema } from '@jsprose/core';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../composables/formatText.js';
|
|
9
|
-
|
|
10
|
-
const { element } = defineProps<{ element: ProseElement<typeof textSchema> }>();
|
|
11
|
-
const formatTextState = useFormatTextState();
|
|
12
|
-
const formatText = useFormatText();
|
|
13
|
-
|
|
14
|
-
const originalText = element.data;
|
|
15
|
-
const leadingSpace = originalText.match(/^(\s*)/)?.[1] ? ' ' : '';
|
|
16
|
-
const trailingSpace = originalText.match(/(\s*)$/)?.[1] ? ' ' : '';
|
|
17
|
-
const formattedText = formatText(originalText, formatTextState);
|
|
18
|
-
const textWithSpaces = leadingSpace + formattedText + trailingSpace;
|
|
19
|
-
|
|
20
|
-
const TextComponent = h(Text, textWithSpaces);
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
|
|
25
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { Text, h } from 'vue';
|
|
3
|
+
import type { ProseElement, textSchema } from '@jsprose/core';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
useFormatText,
|
|
7
|
+
useFormatTextState,
|
|
8
|
+
} from '../composables/formatText.js';
|
|
9
|
+
|
|
10
|
+
const { element } = defineProps<{ element: ProseElement<typeof textSchema> }>();
|
|
11
|
+
const formatTextState = useFormatTextState();
|
|
12
|
+
const formatText = useFormatText();
|
|
13
|
+
|
|
14
|
+
const originalText = element.data;
|
|
15
|
+
const leadingSpace = originalText.match(/^(\s*)/)?.[1] ? ' ' : '';
|
|
16
|
+
const trailingSpace = originalText.match(/(\s*)$/)?.[1] ? ' ' : '';
|
|
17
|
+
const formattedText = formatText(originalText, formatTextState);
|
|
18
|
+
const textWithSpaces = leadingSpace + formattedText + trailingSpace;
|
|
19
|
+
|
|
20
|
+
const TextComponent = h(Text, textWithSpaces);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<component :is="TextComponent" />
|
|
25
|
+
</template>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { provide } from 'vue';
|
|
3
|
-
import type { AnySchema, GenericStorage, ProseElement } from '@jsprose/core';
|
|
4
|
-
import { createFormatTextState } from '@erudit-js/core/formatText';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '../composables/context.js';
|
|
10
|
-
import { proseStorageSymbol } from '../composables/storage.js';
|
|
11
|
-
import Render from './Render.vue';
|
|
12
|
-
import { anchorStateSymbol, useAnchorState } from '../composables/anchor.js';
|
|
13
|
-
import { formatTextStateSymbol } from '../composables/formatText.js';
|
|
14
|
-
|
|
15
|
-
const { element, storage, context } = defineProps<{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}>();
|
|
20
|
-
|
|
21
|
-
provide(proseContextSymbol, context);
|
|
22
|
-
provide(proseStorageSymbol, storage);
|
|
23
|
-
|
|
24
|
-
const anchorState = useAnchorState(context.hashUrl, element);
|
|
25
|
-
provide(anchorStateSymbol, anchorState);
|
|
26
|
-
|
|
27
|
-
provide(formatTextStateSymbol, createFormatTextState());
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { provide } from 'vue';
|
|
3
|
+
import type { AnySchema, GenericStorage, ProseElement } from '@jsprose/core';
|
|
4
|
+
import { createFormatTextState } from '@erudit-js/core/formatText';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
proseContextSymbol,
|
|
8
|
+
type ProseContext,
|
|
9
|
+
} from '../composables/context.js';
|
|
10
|
+
import { proseStorageSymbol } from '../composables/storage.js';
|
|
11
|
+
import Render from './Render.vue';
|
|
12
|
+
import { anchorStateSymbol, useAnchorState } from '../composables/anchor.js';
|
|
13
|
+
import { formatTextStateSymbol } from '../composables/formatText.js';
|
|
14
|
+
|
|
15
|
+
const { element, storage, context } = defineProps<{
|
|
16
|
+
element: ProseElement<AnySchema>;
|
|
17
|
+
storage: GenericStorage;
|
|
18
|
+
context: ProseContext;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
provide(proseContextSymbol, context);
|
|
22
|
+
provide(proseStorageSymbol, storage);
|
|
23
|
+
|
|
24
|
+
const anchorState = useAnchorState(context.hashUrl, element);
|
|
25
|
+
provide(anchorStateSymbol, anchorState);
|
|
26
|
+
|
|
27
|
+
provide(formatTextStateSymbol, createFormatTextState());
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<section
|
|
32
|
+
:style="{ '--proseGap': 'none' }"
|
|
33
|
+
:class="[
|
|
34
|
+
/* Variables */
|
|
35
|
+
'micro:[--proseAsideWidth:20px] [--proseAsideWidth:16px]',
|
|
36
|
+
]"
|
|
37
|
+
>
|
|
38
|
+
<Render :element />
|
|
39
|
+
</section>
|
|
40
|
+
</template>
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { h, type Component } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '@jsprose/core';
|
|
10
|
-
|
|
11
|
-
import { useAppElement } from '../composables/appElement.js';
|
|
12
|
-
import Mix from '../default/Mix.vue';
|
|
13
|
-
import Inliners from '../default/Inliners.vue';
|
|
14
|
-
import Text from '../default/Text.vue';
|
|
15
|
-
|
|
16
|
-
const { element } = defineProps<{ element: ProseElement<AnySchema> }>();
|
|
17
|
-
|
|
18
|
-
const ElementComponent: Component = await (async () => {
|
|
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
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<template>
|
|
50
|
-
|
|
51
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { h, type Component } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
inlinersSchema,
|
|
5
|
+
mixSchema,
|
|
6
|
+
textSchema,
|
|
7
|
+
type AnySchema,
|
|
8
|
+
type ProseElement,
|
|
9
|
+
} from '@jsprose/core';
|
|
10
|
+
|
|
11
|
+
import { useAppElement } from '../composables/appElement.js';
|
|
12
|
+
import Mix from '../default/Mix.vue';
|
|
13
|
+
import Inliners from '../default/Inliners.vue';
|
|
14
|
+
import Text from '../default/Text.vue';
|
|
15
|
+
|
|
16
|
+
const { element } = defineProps<{ element: ProseElement<AnySchema> }>();
|
|
17
|
+
|
|
18
|
+
const ElementComponent: Component = await (async () => {
|
|
19
|
+
switch (element.schemaName) {
|
|
20
|
+
case mixSchema.name:
|
|
21
|
+
return Mix;
|
|
22
|
+
case inlinersSchema.name:
|
|
23
|
+
return Inliners;
|
|
24
|
+
case textSchema.name:
|
|
25
|
+
return Text;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const appElement = useAppElement(element);
|
|
30
|
+
return await appElement.component();
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.warn(
|
|
33
|
+
`[Prose] [Render] Missing component for element schema: ${element.schemaName}`,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
render() {
|
|
38
|
+
return h(
|
|
39
|
+
'span',
|
|
40
|
+
{ class: 'text-red-500 font-semibold font-mono' },
|
|
41
|
+
`<${element.schemaName}/>`,
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<ElementComponent :element />
|
|
51
|
+
</template>
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
import type { AnySchema, ProseElement } from '@jsprose/core';
|
|
4
|
-
|
|
5
|
-
import { useElementPhrase } from '../../composables/language.js';
|
|
6
|
-
import AsideMenuSeparator from './AsideMenuSeparator.vue';
|
|
7
|
-
import AsideMenuCopyLink from './AsideMenuCopyLink.vue';
|
|
8
|
-
|
|
9
|
-
const { element } = defineProps<{
|
|
10
|
-
|
|
11
|
-
}>();
|
|
12
|
-
|
|
13
|
-
const hasLink = computed(() => {
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const hasButtons = computed(() => {
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const phrase = await useElementPhrase(element);
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<template>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import type { AnySchema, ProseElement } from '@jsprose/core';
|
|
4
|
+
|
|
5
|
+
import { useElementPhrase } from '../../composables/language.js';
|
|
6
|
+
import AsideMenuSeparator from './AsideMenuSeparator.vue';
|
|
7
|
+
import AsideMenuCopyLink from './AsideMenuCopyLink.vue';
|
|
8
|
+
|
|
9
|
+
const { element } = defineProps<{
|
|
10
|
+
element: ProseElement<AnySchema>;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const hasLink = computed(() => {
|
|
14
|
+
return Boolean(element.id);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const hasButtons = computed(() => {
|
|
18
|
+
return hasLink.value;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const phrase = await useElementPhrase(element);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div
|
|
26
|
+
:style="{
|
|
27
|
+
'--asideMenuGap': '5px',
|
|
28
|
+
'--asideMenuGapBig': 'calc(var(--asideMenuGap) * 2)',
|
|
29
|
+
}"
|
|
30
|
+
class="bg-bg-main border-border flex w-40 flex-col rounded-sm border
|
|
31
|
+
py-(--asideMenuGap) font-sans
|
|
32
|
+
shadow-[0_0_12px_5px_light-dark(rgba(0,0,0,0.12),rgba(255,255,255,0.08))]
|
|
33
|
+
backface-hidden"
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
class="flex items-center gap-(--asideMenuGapBig) px-(--asideMenuGapBig)
|
|
37
|
+
py-(--asideMenuGap) text-xs font-medium"
|
|
38
|
+
>
|
|
39
|
+
<div>{{ phrase.element_name }}</div>
|
|
40
|
+
</div>
|
|
41
|
+
<AsideMenuSeparator v-if="hasButtons" />
|
|
42
|
+
<AsideMenuCopyLink v-if="hasLink" :elementId="element.id!" />
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref, watch } from 'vue';
|
|
3
|
-
|
|
4
|
-
import { useProseContext } from '../../composables/context.js';
|
|
5
|
-
|
|
6
|
-
const { icon, title } = defineProps<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}>();
|
|
11
|
-
|
|
12
|
-
const { EruditIcon, EruditTransition } = useProseContext();
|
|
13
|
-
|
|
14
|
-
const key = ref(0);
|
|
15
|
-
watch(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
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
|
-
</button>
|
|
53
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, watch } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { useProseContext } from '../../composables/context.js';
|
|
5
|
+
|
|
6
|
+
const { icon, title } = defineProps<{
|
|
7
|
+
icon: string;
|
|
8
|
+
title: string;
|
|
9
|
+
brand?: boolean;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
const { EruditIcon, EruditTransition } = useProseContext();
|
|
13
|
+
|
|
14
|
+
const key = ref(0);
|
|
15
|
+
watch(
|
|
16
|
+
() => [icon, title],
|
|
17
|
+
() => {
|
|
18
|
+
key.value++;
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<button
|
|
25
|
+
:class="[
|
|
26
|
+
'relative cursor-pointer text-left text-xs transition-[color,background]',
|
|
27
|
+
brand
|
|
28
|
+
? 'text-brand bg-brand/10'
|
|
29
|
+
: 'hocus:bg-bg-accent text-text-muted hocus:text-text',
|
|
30
|
+
]"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
class="pointer-events-none invisible flex touch-none flex-wrap
|
|
34
|
+
items-center gap-(--asideMenuGapBig) px-(--asideMenuGapBig)
|
|
35
|
+
py-(--asideMenuGap)"
|
|
36
|
+
>
|
|
37
|
+
<EruditIcon :name="icon" class="shrink-0 text-[1.2em]" />
|
|
38
|
+
<div>{{ title }}</div>
|
|
39
|
+
</div>
|
|
40
|
+
<EruditTransition>
|
|
41
|
+
<div
|
|
42
|
+
:key
|
|
43
|
+
class="absolute top-0 left-0 flex flex-wrap items-center
|
|
44
|
+
gap-(--asideMenuGapBig) px-(--asideMenuGapBig) py-(--asideMenuGap)"
|
|
45
|
+
>
|
|
46
|
+
<EruditIcon :name="icon" class="shrink-0 text-[1.2em]" />
|
|
47
|
+
<div>{{ title }}</div>
|
|
48
|
+
</div>
|
|
49
|
+
</EruditTransition>
|
|
50
|
+
</button>
|
|
51
|
+
</template>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref } from 'vue';
|
|
3
|
-
|
|
4
|
-
import { useProseContext } from '../../composables/context.js';
|
|
5
|
-
import { useProseLanguage } from '../../composables/language.js';
|
|
6
|
-
import AsideMenuButton from './AsideMenuButton.vue';
|
|
7
|
-
import shareIcon from '../assets/share.svg?raw';
|
|
8
|
-
import checkIcon from '../assets/check.svg?raw';
|
|
9
|
-
|
|
10
|
-
const { elementId } = defineProps<{
|
|
11
|
-
|
|
12
|
-
}>();
|
|
13
|
-
|
|
14
|
-
const { pathUrl, baseUrl } = useProseContext();
|
|
15
|
-
const prosePhrase = await useProseLanguage();
|
|
16
|
-
|
|
17
|
-
const copied = ref(false);
|
|
18
|
-
let resetTimer: number | undefined;
|
|
19
|
-
|
|
20
|
-
async function copyLink() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { useProseContext } from '../../composables/context.js';
|
|
5
|
+
import { useProseLanguage } from '../../composables/language.js';
|
|
6
|
+
import AsideMenuButton from './AsideMenuButton.vue';
|
|
7
|
+
import shareIcon from '../assets/share.svg?raw';
|
|
8
|
+
import checkIcon from '../assets/check.svg?raw';
|
|
9
|
+
|
|
10
|
+
const { elementId } = defineProps<{
|
|
11
|
+
elementId: string;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const { pathUrl, baseUrl } = useProseContext();
|
|
15
|
+
const prosePhrase = await useProseLanguage();
|
|
16
|
+
|
|
17
|
+
const copied = ref(false);
|
|
18
|
+
let resetTimer: number | undefined;
|
|
19
|
+
|
|
20
|
+
async function copyLink() {
|
|
21
|
+
await navigator.clipboard.writeText(
|
|
22
|
+
location.origin + baseUrl + pathUrl.substring(1) + '#' + elementId,
|
|
23
|
+
);
|
|
24
|
+
copied.value = true;
|
|
25
|
+
if (resetTimer) clearTimeout(resetTimer);
|
|
26
|
+
resetTimer = window.setTimeout(() => {
|
|
27
|
+
copied.value = false;
|
|
28
|
+
resetTimer = undefined;
|
|
29
|
+
}, 2500);
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<AsideMenuButton
|
|
35
|
+
:brand="copied"
|
|
36
|
+
:icon="copied ? checkIcon : shareIcon"
|
|
37
|
+
:title="copied ? prosePhrase.copied : prosePhrase.copy_link"
|
|
38
|
+
@click="copyLink"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<hr class="border-border/80 my-(--asideMenuGap)" />
|
|
3
|
+
</template>
|