@erudit-js/prose 4.3.0 → 4.3.1-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.
@@ -2,6 +2,7 @@
2
2
  import { computed } from 'vue';
3
3
  import type { ProseElement } from 'tsprose';
4
4
 
5
+ import { useProseContext } from '../../composables/context.js';
5
6
  import { useElementPhrase } from '../../composables/language.js';
6
7
  import AsideMenuSeparator from './AsideMenuSeparator.vue';
7
8
  import AsideMenuCopyLink from './AsideMenuCopyLink.vue';
@@ -10,8 +11,10 @@ const { element } = defineProps<{
10
11
  element: ProseElement;
11
12
  }>();
12
13
 
14
+ const { setHtmlIds } = useProseContext();
15
+
13
16
  const hasLink = computed(() => {
14
- return Boolean(element.id);
17
+ return setHtmlIds && Boolean(element.id);
15
18
  });
16
19
 
17
20
  const hasButtons = computed(() => {
@@ -21,7 +21,18 @@ const formatText = useFormatText();
21
21
  class="gap-big flex"
22
22
  >
23
23
  <div class="max-micro:hidden shrink-0">
24
+ <video
25
+ v-if="calloutStorage.videoIcon"
26
+ :src="calloutStorage.resolvedIconSrc"
27
+ autoplay
28
+ loop
29
+ muted
30
+ playsinline
31
+ class="outline-border size-[60px] rounded-full border-2
32
+ border-transparent object-cover outline-2"
33
+ />
24
34
  <img
35
+ v-else
25
36
  :src="calloutStorage.resolvedIconSrc"
26
37
  loading="lazy"
27
38
  class="outline-border size-[60px] rounded-full border-2
@@ -39,7 +50,17 @@ const formatText = useFormatText();
39
50
  class="gap-small mb-(--proseAsideWidth) flex items-center
40
51
  px-(--proseAsideWidth) font-semibold"
41
52
  >
53
+ <video
54
+ v-if="calloutStorage.videoIcon"
55
+ :src="calloutStorage.resolvedIconSrc"
56
+ autoplay
57
+ loop
58
+ muted
59
+ playsinline
60
+ class="micro:hidden size-[30px] shrink-0 rounded-full object-cover"
61
+ />
42
62
  <img
63
+ v-else
43
64
  :src="calloutStorage.resolvedIconSrc"
44
65
  class="micro:hidden size-[30px] shrink-0 rounded-full"
45
66
  />
@@ -7,6 +7,7 @@ export interface CalloutData {
7
7
  }
8
8
  export interface CalloutStorage {
9
9
  resolvedIconSrc: string;
10
+ videoIcon: boolean;
10
11
  }
11
12
  export interface CalloutSchema extends Schema {
12
13
  name: 'callout';
@@ -1,5 +1,15 @@
1
1
  import { projectRelFilePath } from "../../shared/filePath.js";
2
+ const videoExtensions = [
3
+ "mp4",
4
+ "webm",
5
+ "ogg"
6
+ ];
2
7
  export function createCalloutStorage(projectAbsPath, projectBaseUrl, calloutAbsoluteIconSrc) {
3
8
  const resolvedIconSrc = projectBaseUrl + "file/" + projectRelFilePath(projectAbsPath, calloutAbsoluteIconSrc);
4
- return { resolvedIconSrc };
9
+ const ext = calloutAbsoluteIconSrc.split(".").pop()?.toLowerCase() ?? "";
10
+ const videoIcon = videoExtensions.includes(ext);
11
+ return {
12
+ resolvedIconSrc,
13
+ videoIcon
14
+ };
5
15
  }
@@ -1,3 +1,3 @@
1
1
  export default (text) => {
2
- return text.replace(/(\p{Lu}{2,})(\p{Ll})/gu, "$1-$2").replace(/(\p{Ll})(\p{Lu})/gu, "$1-$2").replace(/(\p{L})(\d)/gu, "$1-$2").replace(/(\d)(\p{L})/gu, "$1-$2").toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2
+ return text.replace(/(\p{Lu}{2,})(\p{Ll})/gu, "$1-$2").replace(/(\p{Ll})(\p{Lu})/gu, "$1-$2").replace(/(\p{L})(\d)/gu, "$1-$2").replace(/(\d)(\p{L})/gu, "$1-$2").toLowerCase().replace(/[^\p{L}0-9]/gu, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
3
3
  };
@@ -34,5 +34,5 @@ export default (text) => {
34
34
  ю: "yu",
35
35
  я: "ya"
36
36
  };
37
- return text.replace(/(\p{Lu}{2,})(\p{Ll})/gu, "$1-$2").replace(/(\p{Ll})(\p{Lu})/gu, "$1-$2").replace(/(\p{L})(\d)/gu, "$1-$2").replace(/(\d)(\p{L})/gu, "$1-$2").toLowerCase().split("").map((char) => cyrillicToLatin[char] !== undefined ? cyrillicToLatin[char] : /[a-z0-9]/.test(char) ? char : "-").join("").replace(/-+/g, "-").replace(/^-|-$/g, "");
37
+ return text.replace(/(\p{Lu}{2,})(\p{Ll})/gu, "$1-$2").replace(/(\p{Ll})(\p{Lu})/gu, "$1-$2").replace(/(\p{L})(\d)/gu, "$1-$2").replace(/(\d)(\p{L})/gu, "$1-$2").toLowerCase().split("").map((char) => cyrillicToLatin[char] !== undefined ? cyrillicToLatin[char] : /[\p{L}0-9]/u.test(char) ? char : "-").join("").replace(/-+/g, "-").replace(/^-|-$/g, "");
38
38
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@erudit-js/prose",
4
- "version": "4.3.0",
4
+ "version": "4.3.1-dev.1",
5
5
  "description": "📝 JSX prose subsystem for Erudit sites",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -32,18 +32,18 @@
32
32
  "prepack": "bun run build"
33
33
  },
34
34
  "dependencies": {
35
- "@erudit-js/core": "4.3.0",
35
+ "@erudit-js/core": "4.3.1-dev.1",
36
36
  "@floating-ui/vue": "^1.1.11",
37
37
  "image-size": "^2.0.2",
38
- "katex": "^0.16.33",
39
- "mermaid": "^11.12.3",
38
+ "katex": "^0.16.38",
39
+ "mermaid": "^11.13.0",
40
40
  "photoswipe": "^5.4.4",
41
41
  "tsprose": "^1.0.1",
42
42
  "vue": "latest"
43
43
  },
44
44
  "devDependencies": {
45
45
  "glob": "^13.0.6",
46
- "oxc-transform": "0.116.0",
46
+ "oxc-transform": "0.119.0",
47
47
  "ts-xor": "^1.3.0"
48
48
  }
49
49
  }