rimelight-components 1.5.1 → 1.6.0

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/module.d.mts CHANGED
@@ -3,7 +3,7 @@ import * as _nuxt_schema from '@nuxt/schema';
3
3
  interface CalloutOptions {
4
4
  icon: string;
5
5
  title: string;
6
- tooltip: string;
6
+ description: string;
7
7
  }
8
8
  interface ModuleOptions {
9
9
  callouts: {
package/dist/module.mjs CHANGED
@@ -4,38 +4,38 @@ const defaultOptions = {
4
4
  callouts: {
5
5
  info: {
6
6
  icon: "lucide:shield-alert",
7
- title: "Note",
8
- tooltip: "This callout is used for general notes."
7
+ title: "",
8
+ description: ""
9
9
  },
10
10
  success: {
11
11
  icon: "lucide:circle-alert",
12
- title: "Tip",
13
- tooltip: "This callout is used for tips and useful information."
12
+ title: "",
13
+ description: ""
14
14
  },
15
15
  warning: {
16
16
  icon: "lucide:triangle-alert",
17
- title: "Warning",
18
- tooltip: "This callout is used for important information."
17
+ title: "",
18
+ description: ""
19
19
  },
20
20
  error: {
21
21
  icon: "lucide:octagon-alert",
22
- title: "Danger",
23
- tooltip: "This callout is used for critical information and prohibitions."
22
+ title: "",
23
+ description: ""
24
24
  },
25
25
  commentary: {
26
26
  icon: "lucide:message-circle-warning",
27
- title: "Commentary",
28
- tooltip: "This callout is used for developer commentary."
27
+ title: "",
28
+ description: ""
29
29
  },
30
30
  ideation: {
31
31
  icon: "lucide:badge-alert",
32
- title: "Ideation",
33
- tooltip: "This alert is used for ideas and brainstorming."
32
+ title: "",
33
+ description: ""
34
34
  },
35
35
  source: {
36
36
  icon: "lucide:book-alert",
37
- title: "Creator's Remarks",
38
- tooltip: "This alert is used for direct commentary of the author."
37
+ title: "",
38
+ description: ""
39
39
  }
40
40
  }
41
41
  };
@@ -57,6 +57,12 @@ const module = defineNuxtModule({
57
57
  overrides: {},
58
58
  defaults: {}
59
59
  },
60
+ "@nuxtjs/i18n": {
61
+ version: ">=10.1.1",
62
+ optional: false,
63
+ overrides: {},
64
+ defaults: {}
65
+ },
60
66
  "@nuxt/ui": {
61
67
  version: ">=4.0.0",
62
68
  optional: false,
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { useAppConfig } from "nuxt/app";
2
+ import { useAppConfig } from "#imports";
3
3
  import { computed } from "#imports";
4
4
  const appConfig = useAppConfig();
5
5
  const { variant } = defineProps({
@@ -8,18 +8,18 @@ const { variant } = defineProps({
8
8
  const config = computed(() => {
9
9
  return appConfig.rimelightComponents?.callouts?.[variant] ?? {
10
10
  icon: "lucide:alert-circle",
11
- title: "Unknown",
12
- tooltip: "Callout"
11
+ title: "Callout",
12
+ description: "Callout"
13
13
  };
14
14
  });
15
15
  const icon = computed(() => config.value.icon);
16
16
  const title = computed(() => config.value.title);
17
- const tooltip = computed(() => config.value.tooltip);
17
+ const description = computed(() => config.value.description);
18
18
  </script>
19
19
 
20
20
  <template>
21
21
  <UAlert
22
- :title="title"
22
+ :title="$t(title)"
23
23
  :color="variant"
24
24
  variant="subtle"
25
25
  :close="{
@@ -33,8 +33,8 @@ const tooltip = computed(() => config.value.tooltip);
33
33
  <slot />
34
34
  </template>
35
35
  <template #close>
36
- <UTooltip :text="tooltip">
37
- <UIcon name="lucide:circle-question-mark" class="size-4" />
36
+ <UTooltip v-if="description" :text="$t(description)">
37
+ <UIcon name="lucide:circle-question-mark" class="size-5" />
38
38
  </UTooltip>
39
39
  </template>
40
40
  </UAlert>
@@ -4,9 +4,9 @@ type __VLS_Props = {
4
4
  title: string;
5
5
  description?: string;
6
6
  };
7
- declare var __VLS_11: {};
7
+ declare var __VLS_24: {};
8
8
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_11) => any;
9
+ default?: (props: typeof __VLS_24) => any;
10
10
  };
11
11
  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>;
12
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,8 +1,30 @@
1
1
  <script setup>
2
+ import { useClipboard, useToast, useRoute, computed } from "#imports";
2
3
  import { tv } from "tailwind-variants";
4
+ import { slugify } from "../../utils";
5
+ const { copy } = useClipboard();
6
+ const toast = useToast();
7
+ const route = useRoute();
8
+ const copyToClipboard = async (text) => {
9
+ try {
10
+ await copy(`${text}`);
11
+ toast.add({
12
+ title: "Heading copied to clipboard!",
13
+ description: text,
14
+ color: "success"
15
+ });
16
+ } catch {
17
+ toast.add({
18
+ title: "Failed to copy heading to clipboard.",
19
+ description: "An unexpected error occurred. Please try again.",
20
+ color: "error"
21
+ });
22
+ }
23
+ };
3
24
  const sectionVariants = tv({
4
25
  slots: {
5
- sectionSlot: "flex flex-col py-4",
26
+ sectionSlot: "flex flex-col py-4 scroll-mt-24",
27
+ linkSlot: "",
6
28
  headingSlot: "font-bold",
7
29
  descriptionSlot: "text-muted",
8
30
  separatorSlot: "py-2",
@@ -12,55 +34,104 @@ const sectionVariants = tv({
12
34
  level: {
13
35
  1: {
14
36
  sectionSlot: "gap-2",
37
+ linkSlot: "",
15
38
  headingSlot: "text-4xl",
16
- descriptionSlot: "text-2xl"
39
+ descriptionSlot: "text-2xl",
40
+ separatorSlot: "",
41
+ contentSlot: ""
17
42
  },
18
43
  2: {
19
44
  sectionSlot: "gap-1.5",
45
+ linkSlot: "",
20
46
  headingSlot: "text-3xl",
21
- descriptionSlot: "text-xl"
47
+ descriptionSlot: "text-xl",
48
+ separatorSlot: "",
49
+ contentSlot: ""
22
50
  },
23
51
  3: {
24
52
  sectionSlot: "gap-1",
53
+ linkSlot: "",
25
54
  headingSlot: "text-2xl",
26
- descriptionSlot: "text-lg"
55
+ descriptionSlot: "text-lg",
56
+ separatorSlot: "",
57
+ contentSlot: ""
27
58
  },
28
59
  4: {
29
60
  sectionSlot: "gap-0.5",
61
+ linkSlot: "",
30
62
  headingSlot: "text-xl",
31
- descriptionSlot: "text-md"
63
+ descriptionSlot: "text-md",
64
+ separatorSlot: "",
65
+ contentSlot: ""
32
66
  },
33
67
  5: {
34
68
  sectionSlot: "gap-0.25",
69
+ linkSlot: "",
35
70
  headingSlot: "text-lg",
36
- descriptionSlot: "text-sm"
71
+ descriptionSlot: "text-sm",
72
+ separatorSlot: "",
73
+ contentSlot: ""
37
74
  },
38
75
  6: {
39
76
  sectionSlot: "gap-0.125",
77
+ linkSlot: "",
40
78
  headingSlot: "text-base",
41
- descriptionSlot: "text-xs"
79
+ descriptionSlot: "text-xs",
80
+ separatorSlot: "",
81
+ contentSlot: ""
42
82
  }
43
83
  }
44
84
  }
45
85
  });
46
- const { level = 1 } = defineProps({
86
+ const {
87
+ level = 1,
88
+ title,
89
+ description
90
+ } = defineProps({
47
91
  level: { type: Number, required: false },
48
92
  title: { type: String, required: true },
49
93
  description: { type: String, required: false }
50
94
  });
51
95
  const {
52
96
  sectionSlot,
97
+ linkSlot,
53
98
  headingSlot,
54
99
  descriptionSlot,
55
100
  separatorSlot,
56
101
  contentSlot
57
102
  } = sectionVariants({ level });
103
+ const sectionId = computed(() => slugify(title));
104
+ const sectionHash = computed(() => `#${sectionId.value}`);
105
+ const fullSectionUrl = computed(() => {
106
+ if (typeof window === "undefined") return sectionHash.value;
107
+ return `${window.location.origin}${route.path}${sectionHash.value}`;
108
+ });
58
109
  </script>
59
110
 
60
111
  <template>
61
- <section :class="sectionSlot()" v-bind="$attrs">
62
- <component :is="`h${level}`" :class="headingSlot()">
63
- {{ title }}
112
+ <section :id="sectionId" :class="sectionSlot()" v-bind="$attrs">
113
+ <component
114
+ :id="sectionId"
115
+ :is="`h${level}`"
116
+ :class="headingSlot()"
117
+ class="relative"
118
+ >
119
+ <NuxtLink
120
+ :href="`#${sectionId}`"
121
+ :class="linkSlot()"
122
+ :id="sectionId"
123
+ class="group lg:-ms-2 lg:ps-2"
124
+ >
125
+ <UButton
126
+ variant="soft"
127
+ color="primary"
128
+ leading-icon="lucide:link"
129
+ :to="`#${sectionId}`"
130
+ class="absolute top-1 -ms-8 hidden rounded-md p-1 opacity-0 transition group-hover:opacity-100 group-focus:opacity-100 lg:flex"
131
+ @click="copyToClipboard(fullSectionUrl)"
132
+ />
133
+ {{ title }}
134
+ </NuxtLink>
64
135
  </component>
65
136
  <p v-if="description" :class="descriptionSlot()">{{ description }}</p>
66
137
  <USeparator :class="separatorSlot()" />
@@ -4,9 +4,9 @@ type __VLS_Props = {
4
4
  title: string;
5
5
  description?: string;
6
6
  };
7
- declare var __VLS_11: {};
7
+ declare var __VLS_24: {};
8
8
  type __VLS_Slots = {} & {
9
- default?: (props: typeof __VLS_11) => any;
9
+ default?: (props: typeof __VLS_24) => any;
10
10
  };
11
11
  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>;
12
12
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,7 +1,5 @@
1
1
  <script setup>
2
- import { useClipboard } from "#imports";
3
- import { useToast } from "#imports";
4
- import { computed } from "#imports";
2
+ import { useClipboard, useToast, computed } from "#imports";
5
3
  const { copy } = useClipboard();
6
4
  const toast = useToast();
7
5
  const { name, hex, rgb, hsl, oklch, cmyk } = defineProps({
@@ -16,18 +14,21 @@ const copyToClipboard = async (text) => {
16
14
  try {
17
15
  await copy(`${text}`);
18
16
  toast.add({
19
- title: `Color copied to clipboard!`,
17
+ title: "Color copied to clipboard!",
20
18
  description: text,
21
- color: `success`
19
+ color: "success"
22
20
  });
23
21
  } catch {
24
22
  toast.add({
25
- title: `Failed to copy color to clipboard.`,
26
- description: `An unexpected error occurred. Please try again.`,
27
- color: `error`
23
+ title: "Failed to copy color to clipboard.",
24
+ description: "An unexpected error occurred. Please try again.",
25
+ color: "error"
28
26
  });
29
27
  }
30
28
  };
29
+ function formatColor(color2) {
30
+ return color2.toUpperCase().replace(/[)]/g, "").replace(/[(]/g, " ").replace(/%/g, "");
31
+ }
31
32
  const color = computed(() => {
32
33
  if (hex) return hex;
33
34
  if (rgb) return rgb;
@@ -44,7 +45,19 @@ const color = computed(() => {
44
45
  <h3 class="text-lg font-bold">{{ name }}</h3>
45
46
  </template>
46
47
  <div class="gap-sm flex flex-col items-center xl:flex-row xl:items-start">
47
- <div class="aspect-square size-48" :style="{ backgroundColor: color }" />
48
+ <div
49
+ class="p-sm flex aspect-square size-48"
50
+ :style="{ backgroundColor: color }"
51
+ >
52
+ <div class="gap-xs flex flex-col justify-end text-xs">
53
+ <span v-if="name" class="text-sm">{{ formatColor(name) }}</span>
54
+ <span v-if="hex">HEX {{ formatColor(hex) }}</span>
55
+ <span v-if="rgb">{{ formatColor(rgb) }}</span>
56
+ <span v-if="hsl">{{ formatColor(hsl) }}</span>
57
+ <span v-if="oklch">{{ formatColor(oklch) }}</span>
58
+ <span v-if="cmyk">{{ formatColor(cmyk) }}</span>
59
+ </div>
60
+ </div>
48
61
  <div class="gap-sm flex w-full flex-col justify-center">
49
62
  <UButton
50
63
  v-if="hex"
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ name?: string;
3
+ jpg?: string;
4
+ png?: string;
5
+ webp?: string;
6
+ svg?: string;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,79 @@
1
+ <script setup>
2
+ import { computed } from "#imports";
3
+ const { name, jpg, png, webp, svg } = defineProps({
4
+ name: { type: String, required: false },
5
+ jpg: { type: String, required: false },
6
+ png: { type: String, required: false },
7
+ webp: { type: String, required: false },
8
+ svg: { type: String, required: false }
9
+ });
10
+ const image = computed(() => {
11
+ if (webp) return webp;
12
+ if (png) return png;
13
+ if (jpg) return jpg;
14
+ if (svg) return svg;
15
+ return void 0;
16
+ });
17
+ </script>
18
+
19
+ <template>
20
+ <UCard variant="subtle" class="w-full rounded-none xl:w-fit">
21
+ <template #header v-if="name">
22
+ <h3 class="text-lg font-bold">{{ name }}</h3>
23
+ <span></span>
24
+ </template>
25
+ <div class="gap-sm flex flex-col">
26
+ <h1>H1</h1>
27
+ <p>{{}}</p>
28
+ </div>
29
+ <h2>H2</h2>
30
+ <h3>H3</h3>
31
+ <p>a b c d e f g h i j k l m n o p q r s t u v w x y z</p>
32
+ <p>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</p>
33
+ <p></p>
34
+ <div class="gap-sm flex flex-col items-center xl:flex-row xl:items-start">
35
+ <div class="gap-sm flex w-full flex-col justify-center">
36
+ <UButton
37
+ v-if="jpg"
38
+ variant="outline"
39
+ size="sm"
40
+ icon="lucide:download"
41
+ label="Download JPG"
42
+ class="w-full xl:w-36"
43
+ :to="jpg"
44
+ target="_blank"
45
+ />
46
+ <UButton
47
+ v-if="png"
48
+ variant="outline"
49
+ size="sm"
50
+ icon="lucide:download"
51
+ label="Download PNG"
52
+ class="w-full xl:w-36"
53
+ :to="png"
54
+ target="_blank"
55
+ />
56
+ <UButton
57
+ v-if="webp"
58
+ variant="outline"
59
+ size="sm"
60
+ icon="lucide:download"
61
+ label="Download WEBP"
62
+ class="w-full xl:w-36"
63
+ :to="webp"
64
+ target="_blank"
65
+ />
66
+ <UButton
67
+ v-if="svg"
68
+ variant="outline"
69
+ size="sm"
70
+ icon="lucide:download"
71
+ label="Download SVG"
72
+ class="w-full xl:w-36"
73
+ :to="svg"
74
+ target="_blank"
75
+ />
76
+ </div>
77
+ </div>
78
+ </UCard>
79
+ </template>
@@ -0,0 +1,10 @@
1
+ type __VLS_Props = {
2
+ name?: string;
3
+ jpg?: string;
4
+ png?: string;
5
+ webp?: string;
6
+ svg?: string;
7
+ };
8
+ declare const __VLS_export: 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>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
File without changes
@@ -1,3 +1,14 @@
1
1
  import { type ClassValue } from "clsx";
2
2
  export declare function cn(...inputs: ClassValue[]): string;
3
3
  export type ObjectValues<T> = T[keyof T];
4
+ /**
5
+ * Converts a string into a URL-friendly slug.
6
+ * - Converts to lowercase.
7
+ * - Replaces non-alphanumeric characters (except hyphens and spaces) with nothing.
8
+ * - Replaces spaces and multiple hyphens with a single hyphen.
9
+ * - Trims leading/trailing hyphens.
10
+ *
11
+ * @param text The string to convert (e.g., "My Awesome Section Title!").
12
+ * @returns The resulting slug (e.g., "my-awesome-section-title").
13
+ */
14
+ export declare function slugify(text: string): string;
@@ -3,3 +3,9 @@ import { twMerge } from "tailwind-merge";
3
3
  export function cn(...inputs) {
4
4
  return twMerge(clsx(inputs));
5
5
  }
6
+ export function slugify(text) {
7
+ if (!text) {
8
+ return "";
9
+ }
10
+ return text.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
11
+ }
package/package.json CHANGED
@@ -1,20 +1,35 @@
1
1
  {
2
2
  "name": "rimelight-components",
3
- "version": "1.5.1",
4
3
  "description": "My new Nuxt module",
5
- "repository": "Rimelight Entertainment/rimelight-components",
6
- "license": "MIT",
4
+ "version": "1.6.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Rimelight-Entertainment/rimelight-components.git"
8
+ },
9
+ "homepage": "https://rimelight.com/tools/rimelight-components",
7
10
  "type": "module",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "rimelight",
14
+ "typescript",
15
+ "vue",
16
+ "nuxt"
17
+ ],
18
+ "imports": {
19
+ "#build/rimelight-components/*": "./.nuxt/rimelight-components/*.ts",
20
+ "#build/rimelight-components.css": "./.nuxt/rimelight-components.css"
21
+ },
8
22
  "exports": {
9
23
  ".": {
10
- "types": "./dist/types.d.mts",
24
+ "types": "./dist/module.d.mts",
25
+ "style": "./dist/runtime/index.css",
11
26
  "import": "./dist/module.mjs"
12
27
  },
13
28
  "./runtime/*": "./dist/runtime/*",
14
29
  "./components/*": "./dist/runtime/components/*",
15
30
  "./composables/*": "./dist/runtime/composables/*",
16
31
  "./utils/*": {
17
- "types": "./dist/runtime/utils/*.d.ts",
32
+ "types": "./dist/runtime/utils/*.d.mts",
18
33
  "import": "./dist/runtime/utils/*.js"
19
34
  }
20
35
  },
@@ -48,6 +63,7 @@
48
63
  "@nuxt/image": "^1.11.0",
49
64
  "@nuxt/kit": "^4.1.3",
50
65
  "@nuxt/ui": "^4.0.1",
66
+ "@nuxtjs/i18n": "^10.1.1",
51
67
  "@vueuse/core": "^13.9.0",
52
68
  "@vueuse/nuxt": "^13.9.0",
53
69
  "date-fns": "^4.1.0",