rimelight-components 2.0.99 → 2.1.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.
Files changed (49) hide show
  1. package/README.md +44 -45
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +8 -7
  4. package/dist/runtime/app.config.d.ts +4 -2
  5. package/dist/runtime/components/app/ScrollToTop.vue +1 -3
  6. package/dist/runtime/components/blocks/Block.vue +1 -3
  7. package/dist/runtime/components/blocks/TextRenderer.vue +3 -5
  8. package/dist/runtime/components/blocks/editor/ImageBlockEditor.vue +2 -6
  9. package/dist/runtime/components/blocks/editor/ParagraphBlockEditor.vue +6 -7
  10. package/dist/runtime/components/blocks/editor/SectionBlockEditor.d.vue.ts +1 -1
  11. package/dist/runtime/components/blocks/editor/SectionBlockEditor.vue +21 -24
  12. package/dist/runtime/components/blocks/editor/SectionBlockEditor.vue.d.ts +1 -1
  13. package/dist/runtime/components/blocks/renderer/SectionBlockRenderer.vue +1 -6
  14. package/dist/runtime/components/blocks/renderer/TestBlockRenderer.vue +1 -1
  15. package/dist/runtime/components/content/Callout.vue +1 -4
  16. package/dist/runtime/components/content/Section.vue +8 -10
  17. package/dist/runtime/components/page/PageEditor.vue +18 -6
  18. package/dist/runtime/components/page/PageMention.d.vue.ts +6 -0
  19. package/dist/runtime/components/page/PageMention.vue +42 -0
  20. package/dist/runtime/components/page/PageMention.vue.d.ts +6 -0
  21. package/dist/runtime/components/page/PagePropertiesEditor.d.vue.ts +1 -1
  22. package/dist/runtime/components/page/PagePropertiesEditor.vue +42 -41
  23. package/dist/runtime/components/page/PagePropertiesEditor.vue.d.ts +1 -1
  24. package/dist/runtime/components/page/PagePropertiesRenderer.vue +157 -23
  25. package/dist/runtime/components/page/PageRenderer.d.vue.ts +9 -5
  26. package/dist/runtime/components/page/PageRenderer.vue +109 -43
  27. package/dist/runtime/components/page/PageRenderer.vue.d.ts +9 -5
  28. package/dist/runtime/components/page/PageSurround.vue +9 -9
  29. package/dist/runtime/components/{blocks/TOC.d.vue.ts → page/PageTOC.d.vue.ts} +5 -8
  30. package/dist/runtime/components/page/PageTOC.vue +107 -0
  31. package/dist/runtime/components/{blocks/TOC.vue.d.ts → page/PageTOC.vue.d.ts} +5 -8
  32. package/dist/runtime/components/swatches/ColorSwatch.vue +1 -4
  33. package/dist/runtime/composables/index.d.ts +1 -0
  34. package/dist/runtime/composables/index.js +1 -0
  35. package/dist/runtime/composables/useBlockEditor.d.ts +173 -517
  36. package/dist/runtime/composables/usePageEditor.js +7 -3
  37. package/dist/runtime/composables/usePageRegistry.d.ts +33 -0
  38. package/dist/runtime/composables/usePageRegistry.js +16 -0
  39. package/dist/runtime/types/blocks.d.ts +1 -3
  40. package/dist/runtime/types/pages.d.ts +16 -8
  41. package/dist/runtime/types/schemas.d.ts +6 -0
  42. package/dist/runtime/types/schemas.js +3 -1
  43. package/dist/runtime/utils/page.d.ts +4 -4
  44. package/dist/runtime/utils/richTextHelpers.js +9 -1
  45. package/package.json +17 -17
  46. package/dist/runtime/components/blocks/TOC.vue +0 -95
  47. package/dist/runtime/components/nodes/MentionNode.d.vue.ts +0 -8
  48. package/dist/runtime/components/nodes/MentionNode.vue +0 -22
  49. package/dist/runtime/components/nodes/MentionNode.vue.d.ts +0 -8
@@ -25,7 +25,7 @@ const {
25
25
  <div>
26
26
  <ULink v-if="previousTitle" :to="previousTo" class="h-full">
27
27
  <UCard
28
- variant="outline"
28
+ variant="soft"
29
29
  class="group block h-full bg-transparent hover:bg-elevated/50 focus-visible:outline-primary"
30
30
  >
31
31
  <div class="flex flex-col gap-md">
@@ -33,18 +33,18 @@ const {
33
33
  <UButton
34
34
  variant="outline"
35
35
  icon="lucide:arrow-left"
36
- class="group-hover w-fit rounded-full text-primary group-hover:text-highlighted"
36
+ class="group-hover w-fit text-md rounded-full text-primary group-hover:text-highlighted"
37
37
  />
38
38
  <span class="text-muted">
39
39
  {{ t("navigation_previous") }}
40
40
  {{ t(pageType) }}
41
41
  </span>
42
42
  </div>
43
- <div class="flex flex-col gap-xs">
44
- <p class="text-primary group-hover:text-highlighted">
43
+ <div class="flex flex-col gap-sm">
44
+ <p class="text-primary text-sm group-hover:text-highlighted">
45
45
  {{ previousTitle }}
46
46
  </p>
47
- <p class="text-toned">
47
+ <p class="text-toned text-xs">
48
48
  {{ previousDescription }}
49
49
  </p>
50
50
  </div>
@@ -55,7 +55,7 @@ const {
55
55
  <div>
56
56
  <ULink v-if="nextTitle" :to="nextTo" class="h-full">
57
57
  <UCard
58
- variant="outline"
58
+ variant="soft"
59
59
  class="group block h-full bg-transparent hover:bg-elevated/50 focus-visible:outline-primary"
60
60
  >
61
61
  <div class="flex flex-col items-end gap-md">
@@ -63,7 +63,7 @@ const {
63
63
  <UButton
64
64
  variant="outline"
65
65
  icon="lucide:arrow-right"
66
- class="w-fit rounded-full text-primary group-hover:text-highlighted"
66
+ class="w-fit rounded-full text-primary text-md group-hover:text-highlighted"
67
67
  />
68
68
  <span class="text-muted">
69
69
  {{ t("navigation_next") }}
@@ -71,10 +71,10 @@ const {
71
71
  >
72
72
  </div>
73
73
  <div class="flex flex-col items-end gap-xs">
74
- <p class="text-right text-primary group-hover:text-highlighted">
74
+ <p class="text-right text-sm text-primary group-hover:text-highlighted">
75
75
  {{ nextTitle }}
76
76
  </p>
77
- <p class="text-right text-toned">
77
+ <p class="text-right text-toned text-xs">
78
78
  {{ nextDescription }}
79
79
  </p>
80
80
  </div>
@@ -1,10 +1,4 @@
1
- import { type Block, type HeadingLevel } from "../../types/index.js";
2
- export interface TOCItem {
3
- id: string;
4
- title: string;
5
- level: HeadingLevel;
6
- children?: TOCItem[];
7
- }
1
+ import type { Block, HeadingLevel } from "../../types/index.js";
8
2
  type __VLS_Props = {
9
3
  pageBlocks: Block[] | null;
10
4
  title?: string;
@@ -14,7 +8,10 @@ declare var __VLS_7: {};
14
8
  type __VLS_Slots = {} & {
15
9
  bottom?: (props: typeof __VLS_7) => any;
16
10
  };
17
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ title: string;
13
+ levels: HeadingLevel[];
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
15
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
16
  declare const _default: typeof __VLS_export;
20
17
  export default _default;
@@ -0,0 +1,107 @@
1
+ <script setup>
2
+ import { computed, ref, onMounted, watch } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { useIntersectionObserver } from "@vueuse/core";
5
+ import { tv } from "tailwind-variants";
6
+ import { slugify } from "../../utils";
7
+ const props = defineProps({
8
+ pageBlocks: { type: [Array, null], required: true },
9
+ title: { type: String, required: false, default: "table_of_contents" },
10
+ levels: { type: Array, required: false, default: () => [2, 3, 4] }
11
+ });
12
+ const { t } = useI18n();
13
+ const activeId = ref(null);
14
+ const tocVariants = tv({
15
+ slots: {
16
+ link: "group relative flex items-center px-3 py-1.5 text-sm transition-all duration-200 border-s-2 -ms-px",
17
+ text: "truncate"
18
+ },
19
+ variants: {
20
+ active: {
21
+ true: {
22
+ link: "border-accented font-semibold text-foreground"
23
+ },
24
+ false: {
25
+ link: "border-dimmed text-dimmed"
26
+ }
27
+ },
28
+ level: {
29
+ 1: { link: "ps-3" },
30
+ 2: { link: "ps-3" },
31
+ 3: { link: "ps-6" },
32
+ 4: { link: "ps-9" },
33
+ 5: { link: "ps-12" },
34
+ 6: { link: "ps-15" }
35
+ }
36
+ }
37
+ });
38
+ const extractHeadings = (blocks) => {
39
+ const headings = [];
40
+ if (!blocks) return headings;
41
+ for (const block of blocks) {
42
+ if (block.type === "SectionBlock") {
43
+ const p = block.props;
44
+ if (p.title && p.level) {
45
+ headings.push({
46
+ id: slugify(p.title),
47
+ title: p.title,
48
+ level: p.level
49
+ });
50
+ }
51
+ if (p.children?.length) {
52
+ headings.push(...extractHeadings(p.children));
53
+ }
54
+ }
55
+ }
56
+ return headings;
57
+ };
58
+ const items = computed(() => {
59
+ const all = extractHeadings(props.pageBlocks ?? []);
60
+ return all.filter((h) => props.levels.includes(h.level));
61
+ });
62
+ onMounted(() => {
63
+ watch(() => items.value, (newItems) => {
64
+ newItems.forEach((item) => {
65
+ const el = document.getElementById(item.id);
66
+ if (!el) return;
67
+ useIntersectionObserver(
68
+ el,
69
+ (entries) => {
70
+ const entry = entries?.[0];
71
+ if (entry?.isIntersecting) {
72
+ activeId.value = item.id;
73
+ }
74
+ },
75
+ {
76
+ // Adjust rootMargin to detect the section when it's in the top third of the screen
77
+ rootMargin: "-80px 0px -80% 0px",
78
+ threshold: 0
79
+ }
80
+ );
81
+ });
82
+ }, { immediate: true });
83
+ });
84
+ </script>
85
+
86
+ <template>
87
+ <nav class="flex flex-col gap-sm self-start w-full" aria-label="Table of Contents">
88
+ <h5 v-if="title">
89
+ {{ t(title) }}
90
+ </h5>
91
+
92
+ <ul v-if="items.length > 0" class="flex flex-col">
93
+ <li v-for="item in items" :key="item.id">
94
+ <NuxtLink
95
+ :to="{ hash: `#${item.id}` }"
96
+ :class="tocVariants({ active: activeId === item.id, level: item.level }).link()"
97
+ >
98
+ <span :class="tocVariants().text()">
99
+ {{ item.title }}
100
+ </span>
101
+ </NuxtLink>
102
+ </li>
103
+ </ul>
104
+
105
+ <slot name="bottom" />
106
+ </nav>
107
+ </template>
@@ -1,10 +1,4 @@
1
- import { type Block, type HeadingLevel } from "../../types/index.js";
2
- export interface TOCItem {
3
- id: string;
4
- title: string;
5
- level: HeadingLevel;
6
- children?: TOCItem[];
7
- }
1
+ import type { Block, HeadingLevel } from "../../types/index.js";
8
2
  type __VLS_Props = {
9
3
  pageBlocks: Block[] | null;
10
4
  title?: string;
@@ -14,7 +8,10 @@ declare var __VLS_7: {};
14
8
  type __VLS_Slots = {} & {
15
9
  bottom?: (props: typeof __VLS_7) => any;
16
10
  };
17
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ title: string;
13
+ levels: HeadingLevel[];
14
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
15
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
16
  declare const _default: typeof __VLS_export;
20
17
  export default _default;
@@ -47,10 +47,7 @@ const color = computed(() => {
47
47
  <h3 class="text-lg font-bold">{{ name }}</h3>
48
48
  </template>
49
49
  <div class="flex flex-col items-center gap-sm xl:flex-row xl:items-start">
50
- <div
51
- class="flex aspect-square size-48 p-sm"
52
- :style="{ backgroundColor: color }"
53
- >
50
+ <div class="flex aspect-square size-48 p-sm" :style="{ backgroundColor: color }">
54
51
  <div class="flex flex-col justify-end gap-xs text-xs">
55
52
  <span v-if="name" class="text-sm">{{ formatColor(name) }}</span>
56
53
  <span v-if="hex">HEX {{ formatColor(hex) }}</span>
@@ -1,3 +1,4 @@
1
1
  export * from "./useDateRange.js";
2
2
  export * from "./usePageEditor.js";
3
3
  export * from "./useBlockEditor.js";
4
+ export * from "./usePageRegistry.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./useDateRange.js";
2
2
  export * from "./usePageEditor.js";
3
3
  export * from "./useBlockEditor.js";
4
+ export * from "./usePageRegistry.js";