@revojs/ui 0.1.58 → 0.2.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.
@@ -31,5 +31,5 @@ export interface UiConfig {
31
31
  light: UiTheme;
32
32
  dark: UiTheme;
33
33
  }
34
- declare const _default: import("revojs/module").Module<"ui", UiConfig, []>;
34
+ declare const _default: import("revojs/module").Module<"ui", UiConfig, readonly [import("revojs/module").Module<"client", import("@revojs/client/module").ClientConfig, []>]>;
35
35
  export default _default;
@@ -1,17 +1,32 @@
1
- import { readFileSync, readdirSync } from "fs";
2
- import { addTypes, addVirtual, defineModule, useModule } from "revojs/module";
1
+ import client from "@revojs/client/module";
2
+ import tailwindcss from "@tailwindcss/vite";
3
+ import { readFileSync } from "fs";
4
+ import { addTypes, addVirtual, defineModule } from "revojs/module";
5
+ import colors from "tailwindcss/colors";
3
6
  //#region src/module/index.ts
4
- function resolveUiClasses(source, ui) {
5
- const classes = new Array();
6
- for (const [, inner] of source.matchAll(/`([^`]*config\.[^`]*)`/g)) for (const token of inner.replace(/\$\{config\.([^}]+)\}/g, (_match, path) => String(path.split(".").reduce((value, key) => value[key], ui))).split(/\s+/)) if (token) classes.push(token);
7
- for (const [, path] of source.replace(/`[^`]*`/g, "").matchAll(/config\.([A-Za-z0-9_.]+)/g)) {
8
- const value = path.split(".").reduce((current, key) => current[key], ui);
9
- if (typeof value === "string" && value) classes.push(value);
10
- }
11
- return classes;
7
+ function themeVariables(theme) {
8
+ return Object.entries(theme).map(([key, value]) => {
9
+ const [palette, opacity] = value.split("/");
10
+ const [name, shade] = palette.split("-");
11
+ const color = shade ? colors[name][shade] : colors[name];
12
+ return `--ui-${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}: ${opacity ? `color-mix(in oklab, ${color} ${opacity}%, transparent)` : color};`;
13
+ }).join("\n");
12
14
  }
15
+ var radii = {
16
+ "rounded-none": "0",
17
+ "rounded-xs": "0.125rem",
18
+ "rounded-sm": "0.25rem",
19
+ "rounded-md": "0.375rem",
20
+ "rounded-lg": "0.5rem",
21
+ "rounded-xl": "0.75rem",
22
+ "rounded-2xl": "1rem",
23
+ "rounded-3xl": "1.5rem",
24
+ "rounded-4xl": "2rem",
25
+ "rounded-full": "9999px"
26
+ };
13
27
  var module_default = defineModule({
14
28
  name: "ui",
29
+ modules: [client],
15
30
  config: () => ({
16
31
  radius: "rounded-md",
17
32
  light: {
@@ -58,65 +73,28 @@ var module_default = defineModule({
58
73
  }
59
74
  }),
60
75
  setup(config) {
61
- const { fromModule } = useModule(import.meta.url);
62
- const ui = config.ui;
63
- const classes = /* @__PURE__ */ new Set();
64
76
  const manifest = JSON.parse(readFileSync("package.json", "utf8"));
65
77
  const iconPackages = [...new Set(Object.keys({
66
78
  ...manifest.dependencies,
67
79
  ...manifest.devDependencies,
68
80
  ...manifest.optionalDependencies
69
81
  }).filter((name) => name.startsWith("@iconify-json/")))].sort();
70
- let componentsDir = "";
71
82
  addVirtual(config, "ui/icons", () => {
72
83
  return `export default {${iconPackages.map((name) => `${JSON.stringify(name.slice(14))}: () => import(${JSON.stringify(`${name}/icons.json`)}).then((module) => module.default)`).join(",")}};`;
73
84
  });
74
85
  addTypes(config, "ui-icons", () => "declare module \"#ui/icons\" { import type { IconifyJSON } from \"@iconify/types\"; const icons: Record<string, () => Promise<IconifyJSON>>; export default icons; }");
75
- for (const directory of [fromModule("../vue/components"), fromModule("../../src/vue/components")]) {
76
- let entries;
77
- try {
78
- entries = readdirSync(directory).filter((entry) => entry.endsWith(".vue"));
79
- } catch {
80
- continue;
81
- }
82
- componentsDir = directory;
83
- for (const entry of entries) for (const token of resolveUiClasses(readFileSync(`${directory}/${entry}`, "utf8"), ui)) classes.add(token);
84
- break;
85
- }
86
- if (!componentsDir) return;
87
- const dynamics = [...classes].join(" ");
88
- return { vite: { plugins: [{
89
- name: "@revojs/ui",
90
- enforce: "pre",
91
- transform(code, key) {
92
- if (!key.split("?", 1)[0].endsWith(".css")) return;
93
- if (!code.includes("@import \"tailwindcss\"") && !code.includes("@import 'tailwindcss'")) return;
94
- const sourceDirective = `@source "${componentsDir}";`;
95
- const inlineDirective = `@source inline("${dynamics}");`;
96
- const baseDirective = `@layer base {
97
- * {
98
- @apply border-${ui.light.border} outline-${ui.light.ring};
99
-
100
- @variant dark {
101
- @apply border-${ui.dark.border} outline-${ui.dark.ring};
102
- }
103
- }
104
-
105
- body {
106
- @apply bg-${ui.light.background} text-${ui.light.foreground};
107
-
108
- @variant dark {
109
- @apply bg-${ui.dark.background} text-${ui.dark.foreground};
110
- }
111
- }
112
- }`;
113
- let result = code;
114
- if (!result.includes(sourceDirective)) result += `\n${sourceDirective}`;
115
- if (dynamics && !result.includes(inlineDirective)) result += `\n${inlineDirective}`;
116
- if (!result.includes(baseDirective)) result += `\n${baseDirective}`;
117
- if (result !== code) return result;
118
- }
119
- }] } };
86
+ return {
87
+ client: { html: { head: { children: [{
88
+ tagName: "script",
89
+ attributes: { type: "module" },
90
+ children: ["import \"@revojs/ui/style.css\";"]
91
+ }, {
92
+ tagName: "style",
93
+ attributes: {},
94
+ children: [`:root { --ui-radius: ${radii[config.ui.radius]}; ${themeVariables(config.ui.light)} } @media (prefers-color-scheme: dark) { :root { ${themeVariables(config.ui.dark)} } }`]
95
+ }] } } },
96
+ vite: { plugins: [tailwindcss()] }
97
+ };
120
98
  }
121
99
  });
122
100
  //#endregion
package/dist/style.css ADDED
@@ -0,0 +1,36 @@
1
+ @import "tailwindcss";
2
+
3
+ @source "./vue/components";
4
+
5
+ @theme inline {
6
+ --color-background: var(--ui-background);
7
+ --color-foreground: var(--ui-foreground);
8
+ --color-card: var(--ui-card);
9
+ --color-card-foreground: var(--ui-card-foreground);
10
+ --color-popover: var(--ui-popover);
11
+ --color-popover-foreground: var(--ui-popover-foreground);
12
+ --color-primary: var(--ui-primary);
13
+ --color-primary-foreground: var(--ui-primary-foreground);
14
+ --color-secondary: var(--ui-secondary);
15
+ --color-secondary-foreground: var(--ui-secondary-foreground);
16
+ --color-muted: var(--ui-muted);
17
+ --color-muted-foreground: var(--ui-muted-foreground);
18
+ --color-accent: var(--ui-accent);
19
+ --color-accent-foreground: var(--ui-accent-foreground);
20
+ --color-destructive: var(--ui-destructive);
21
+ --color-destructive-foreground: var(--ui-destructive-foreground);
22
+ --color-border: var(--ui-border);
23
+ --color-input: var(--ui-input);
24
+ --color-ring: var(--ui-ring);
25
+ --radius-ui: var(--ui-radius);
26
+ }
27
+
28
+ @layer base {
29
+ * {
30
+ @apply border-border outline-ring;
31
+ }
32
+
33
+ body {
34
+ @apply bg-background text-foreground;
35
+ }
36
+ }
@@ -1,17 +1,8 @@
1
1
  <template>
2
2
  <component
3
3
  :is="is"
4
- class="inline-flex cursor-pointer items-center justify-center gap-2 border border-transparent font-[inherit] font-medium leading-none no-underline transition-[background-color,border-color,color,opacity] duration-150 hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:opacity-50"
5
- :class="[
6
- config.radius,
7
- `outline-${config.light.ring}`,
8
- `dark:outline-${config.dark.ring}`,
9
- fonts[font],
10
- layouts[layout],
11
- sizes[size],
12
- texts[text],
13
- variants[variant],
14
- ]"
4
+ class="inline-flex cursor-pointer items-center justify-center gap-2 rounded-ui border border-transparent font-[inherit] font-medium leading-none no-underline outline-ring transition-[background-color,border-color,color,opacity] duration-150 hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:opacity-50"
5
+ :class="[fonts[font], layouts[layout], sizes[size], texts[text], variants[variant]]"
15
6
  :type="attributes.type ?? 'button'"
16
7
  :disabled="disabled"
17
8
  >
@@ -26,7 +17,6 @@
26
17
  </template>
27
18
 
28
19
  <script setup lang="ts">
29
- import config from "#config/ui";
30
20
  import { useAttrs, type Component } from "vue";
31
21
  import type { ButtonFont, ButtonLayout, ButtonSize, ButtonText, ButtonVariant } from "../../components/button.ts";
32
22
  import Icon from "./icon.vue";
@@ -85,40 +75,13 @@ const texts: Record<ButtonText, string> = {
85
75
  md: "text-base",
86
76
  };
87
77
 
88
- const variants: Record<ButtonVariant, Array<string>> = {
89
- primary: [
90
- `bg-${config.light.primary}`,
91
- `text-${config.light.primaryForeground}`,
92
- `dark:bg-${config.dark.primary}`,
93
- `dark:text-${config.dark.primaryForeground}`,
94
- ],
95
- secondary: [
96
- `bg-${config.light.secondary}`,
97
- `text-${config.light.secondaryForeground}`,
98
- `dark:bg-${config.dark.secondary}`,
99
- `dark:text-${config.dark.secondaryForeground}`,
100
- ],
101
- outline: [
102
- `border-${config.light.border}`,
103
- `bg-${config.light.background}`,
104
- `text-${config.light.foreground}`,
105
- `dark:border-${config.dark.border}`,
106
- `dark:bg-${config.dark.background}`,
107
- `dark:text-${config.dark.foreground}`,
108
- ],
109
- ghost: [`text-${config.light.foreground}`, `dark:text-${config.dark.foreground}`],
110
- destructive: [
111
- `bg-${config.light.destructive}`,
112
- `text-${config.light.destructiveForeground}`,
113
- `dark:bg-${config.dark.destructive}`,
114
- `dark:text-${config.dark.destructiveForeground}`,
115
- ],
116
- danger: [
117
- `bg-${config.light.destructive}`,
118
- `text-${config.light.destructiveForeground}`,
119
- `dark:bg-${config.dark.destructive}`,
120
- `dark:text-${config.dark.destructiveForeground}`,
121
- ],
122
- text: [`text-${config.light.foreground}`, `dark:text-${config.dark.foreground}`],
78
+ const variants: Record<ButtonVariant, string> = {
79
+ primary: "bg-primary text-primary-foreground",
80
+ secondary: "bg-secondary text-secondary-foreground",
81
+ outline: "border-border bg-background text-foreground",
82
+ ghost: "text-foreground",
83
+ destructive: "bg-destructive text-destructive-foreground",
84
+ danger: "bg-destructive text-destructive-foreground",
85
+ text: "text-foreground",
123
86
  };
124
87
  </script>
@@ -1,20 +1,10 @@
1
1
  <template>
2
2
  <section
3
- class="flex flex-col overflow-hidden border shadow-sm"
4
- :class="[
5
- config.radius,
6
- `border-${config.light.border}`,
7
- `bg-${config.light.card}`,
8
- `text-${config.light.cardForeground}`,
9
- `dark:border-${config.dark.border}`,
10
- `dark:bg-${config.dark.card}`,
11
- `dark:text-${config.dark.cardForeground}`,
12
- ]"
3
+ class="flex flex-col overflow-hidden rounded-ui border border-border bg-card text-card-foreground shadow-sm"
13
4
  >
14
5
  <header
15
6
  v-if="label || title || description || $slots.header || $slots.actions"
16
- class="flex items-start justify-between gap-4 border-b p-5"
17
- :class="[`border-${config.light.border}`, `dark:border-${config.dark.border}`]"
7
+ class="flex items-start justify-between gap-4 border-b border-border p-5"
18
8
  >
19
9
  <slot name="header">
20
10
  <div class="flex flex-col gap-1.5">
@@ -39,8 +29,6 @@
39
29
  </template>
40
30
 
41
31
  <script setup lang="ts">
42
- import config from "#config/ui";
43
-
44
32
  const {
45
33
  label = undefined,
46
34
  title = undefined,
@@ -1,8 +1,7 @@
1
1
  <template>
2
2
  <label class="inline-flex items-start gap-3" :class="interactionVariants[interaction]">
3
3
  <input
4
- class="mt-0.5 size-5 shrink-0 cursor-inherit accent-current"
5
- :class="[`text-${config.light.primary}`, `dark:text-${config.dark.primary}`]"
4
+ class="mt-0.5 size-5 shrink-0 cursor-inherit accent-current text-primary"
6
5
  type="checkbox"
7
6
  :checked="modelValue"
8
7
  :name="name"
@@ -21,7 +20,6 @@
21
20
  </template>
22
21
 
23
22
  <script setup lang="ts">
24
- import config from "#config/ui";
25
23
  import { computed } from "vue";
26
24
  import type { ControlInteraction } from "../../components/control.ts";
27
25
 
@@ -1,16 +1,7 @@
1
1
  <template>
2
2
  <div
3
3
  v-if="items"
4
- class="flex w-full flex-col divide-y overflow-hidden border"
5
- :class="[
6
- config.radius,
7
- `divide-${config.light.border}`,
8
- `border-${config.light.border}`,
9
- `bg-${config.light.card}`,
10
- `dark:divide-${config.dark.border}`,
11
- `dark:border-${config.dark.border}`,
12
- `dark:bg-${config.dark.card}`,
13
- ]"
4
+ class="flex w-full flex-col divide-y divide-border overflow-hidden rounded-ui border border-border bg-card"
14
5
  >
15
6
  <template v-if="items.length">
16
7
  <div v-for="(item, index) in items" :key="index">
@@ -25,7 +16,6 @@
25
16
  </template>
26
17
 
27
18
  <script setup generic="T" lang="ts">
28
- import config from "#config/ui";
29
19
  import type { CollectionColumns } from "../../components/collection.ts";
30
20
 
31
21
  const {
@@ -3,8 +3,7 @@
3
3
  <span v-if="label" class="text-sm font-medium">{{ label }}</span>
4
4
 
5
5
  <div
6
- class="grid h-10 grid-cols-[2.5rem_minmax(0,1fr)_2.5rem] items-center overflow-hidden border"
7
- :class="[config.radius, `border-${config.light.input}`, `dark:border-${config.dark.input}`]"
6
+ class="grid h-10 grid-cols-[2.5rem_minmax(0,1fr)_2.5rem] items-center overflow-hidden rounded-ui border border-input"
8
7
  >
9
8
  <Button
10
9
  class="text-lg"
@@ -32,7 +31,6 @@
32
31
  </template>
33
32
 
34
33
  <script setup lang="ts">
35
- import config from "#config/ui";
36
34
  import Button from "./button.vue";
37
35
 
38
36
  const {
@@ -6,11 +6,7 @@
6
6
 
7
7
  <slot />
8
8
 
9
- <p
10
- v-if="error"
11
- class="text-sm"
12
- :class="[`text-${config.light.destructive}`, `dark:text-${config.dark.destructive}`]"
13
- >
9
+ <p v-if="error" class="text-sm text-destructive">
14
10
  {{ error }}
15
11
  </p>
16
12
  <p v-else-if="description" class="text-sm opacity-60">
@@ -20,8 +16,6 @@
20
16
  </template>
21
17
 
22
18
  <script setup lang="ts">
23
- import config from "#config/ui";
24
-
25
19
  const {
26
20
  label = undefined,
27
21
  description = undefined,
@@ -1,14 +1,7 @@
1
1
  <template>
2
2
  <span
3
- class="flex min-h-10 w-full cursor-text items-center gap-2 border px-3 text-sm focus-within:ring-2"
4
- :class="[
5
- config.radius,
6
- `border-${config.light.input}`,
7
- `ring-${config.light.ring}`,
8
- `dark:border-${config.dark.input}`,
9
- `dark:ring-${config.dark.ring}`,
10
- interactionVariants[interaction],
11
- ]"
3
+ class="flex min-h-10 w-full cursor-text items-center gap-2 rounded-ui border border-input px-3 text-sm ring-ring focus-within:ring-2"
4
+ :class="interactionVariants[interaction]"
12
5
  >
13
6
  <slot name="leading" />
14
7
 
@@ -34,7 +27,6 @@
34
27
  </template>
35
28
 
36
29
  <script setup lang="ts">
37
- import config from "#config/ui";
38
30
  import { computed } from "vue";
39
31
  import type { ControlInteraction } from "../../components/control.ts";
40
32
  import Icon from "./icon.vue";
@@ -10,7 +10,6 @@
10
10
  </template>
11
11
 
12
12
  <script setup lang="ts">
13
- import config from "#config/ui";
14
13
  import type { Component } from "vue";
15
14
  import type { LinkVariant } from "../../components/link.ts";
16
15
 
@@ -26,8 +25,8 @@ const {
26
25
  variant?: LinkVariant;
27
26
  }>();
28
27
 
29
- const variants: Record<LinkVariant, Array<string>> = {
30
- primary: [`text-${config.light.foreground}`, `dark:text-${config.dark.foreground}`],
31
- muted: [`text-${config.light.mutedForeground}`, `dark:text-${config.dark.mutedForeground}`],
28
+ const variants: Record<LinkVariant, string> = {
29
+ primary: "text-foreground",
30
+ muted: "text-muted-foreground",
32
31
  };
33
32
  </script>
@@ -14,17 +14,8 @@
14
14
  :id="id"
15
15
  ref="popover"
16
16
  popover
17
- class="m-0 mt-2 max-w-sm border shadow-xl"
18
- :class="[
19
- config.radius,
20
- `border-${config.light.border}`,
21
- `bg-${config.light.popover}`,
22
- `text-${config.light.popoverForeground}`,
23
- `dark:border-${config.dark.border}`,
24
- `dark:bg-${config.dark.popover}`,
25
- `dark:text-${config.dark.popoverForeground}`,
26
- contentClass,
27
- ]"
17
+ class="m-0 mt-2 max-w-sm rounded-ui border border-border bg-popover text-popover-foreground shadow-xl"
18
+ :class="contentClass"
28
19
  :style="position"
29
20
  @toggle="handleToggle"
30
21
  >
@@ -34,7 +25,6 @@
34
25
  </template>
35
26
 
36
27
  <script setup lang="ts">
37
- import config from "#config/ui";
38
28
  import { ref, useId, useTemplateRef, watchEffect } from "vue";
39
29
  import type { ButtonLayout } from "../../components/button.ts";
40
30
  import Button from "./button.vue";
@@ -9,25 +9,19 @@
9
9
  <progress class="sr-only" :value="value" :max="max">{{ percent }}%</progress>
10
10
 
11
11
  <div
12
- class="h-2 w-full overflow-hidden rounded-full"
13
- :class="[`bg-${config.light.secondary}`, `dark:bg-${config.dark.secondary}`]"
12
+ class="h-2 w-full overflow-hidden rounded-full bg-secondary"
14
13
  role="progressbar"
15
14
  :aria-label="label"
16
15
  :aria-valuenow="value"
17
16
  aria-valuemin="0"
18
17
  :aria-valuemax="max"
19
18
  >
20
- <div
21
- class="h-full rounded-full transition-[width]"
22
- :class="[`bg-${config.light.primary}`, `dark:bg-${config.dark.primary}`]"
23
- :style="{ width: `${percent}%` }"
24
- />
19
+ <div class="h-full rounded-full bg-primary transition-[width]" :style="{ width: `${percent}%` }" />
25
20
  </div>
26
21
  </div>
27
22
  </template>
28
23
 
29
24
  <script setup lang="ts">
30
- import config from "#config/ui";
31
25
  import { computed } from "vue";
32
26
 
33
27
  const {
@@ -1,8 +1,7 @@
1
1
  <template>
2
2
  <label class="inline-flex items-start gap-3" :class="interactionVariants[interaction]">
3
3
  <input
4
- class="mt-0.5 size-5 shrink-0 cursor-inherit accent-current"
5
- :class="[`text-${config.light.primary}`, `dark:text-${config.dark.primary}`]"
4
+ class="mt-0.5 size-5 shrink-0 cursor-inherit accent-current text-primary"
6
5
  type="radio"
7
6
  :checked="modelValue === value"
8
7
  :value="value"
@@ -23,7 +22,6 @@
23
22
  </template>
24
23
 
25
24
  <script setup lang="ts">
26
- import config from "#config/ui";
27
25
  import { computed } from "vue";
28
26
  import type { ControlInteraction } from "../../components/control.ts";
29
27
  import type { RadioValue } from "../../components/radio.ts";
@@ -9,8 +9,7 @@
9
9
  </span>
10
10
 
11
11
  <input
12
- class="h-2 w-full cursor-pointer accent-current disabled:cursor-not-allowed"
13
- :class="[`text-${config.light.primary}`, `dark:text-${config.dark.primary}`]"
12
+ class="h-2 w-full cursor-pointer accent-current text-primary disabled:cursor-not-allowed"
14
13
  type="range"
15
14
  :value="modelValue"
16
15
  :min="min"
@@ -23,7 +22,6 @@
23
22
  </template>
24
23
 
25
24
  <script setup lang="ts">
26
- import config from "#config/ui";
27
25
  import { computed } from "vue";
28
26
  import type { ControlInteraction } from "../../components/control.ts";
29
27
 
@@ -1,14 +1,13 @@
1
1
  <template>
2
2
  <div
3
- class="shrink-0"
4
- :class="[`bg-${config.light.border}`, `dark:bg-${config.dark.border}`, variants[selected]]"
3
+ class="shrink-0 bg-border"
4
+ :class="variants[selected]"
5
5
  :role="decorative ? 'none' : 'separator'"
6
6
  :aria-orientation="decorative ? undefined : selected"
7
7
  />
8
8
  </template>
9
9
 
10
10
  <script setup lang="ts">
11
- import config from "#config/ui";
12
11
  import { computed } from "vue";
13
12
  import type { DividerVariant, SeparatorOrientation } from "../../components/separator.ts";
14
13
 
@@ -3,8 +3,8 @@
3
3
  <input v-if="name" type="hidden" :name="name" :value="modelValue ? 'on' : 'off'" />
4
4
 
5
5
  <button
6
- class="relative mt-0.5 h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed"
7
- :class="[variants[state], `outline-${config.light.ring}`, `dark:outline-${config.dark.ring}`]"
6
+ class="relative mt-0.5 h-6 w-11 shrink-0 rounded-full outline-ring transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed"
7
+ :class="variants[state]"
8
8
  type="button"
9
9
  role="switch"
10
10
  :aria-checked="modelValue"
@@ -28,7 +28,6 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import config from "#config/ui";
32
31
  import { computed } from "vue";
33
32
  import type { ControlInteraction } from "../../components/control.ts";
34
33
  import type { SwitchState } from "../../components/switch.ts";
@@ -65,8 +64,8 @@ const thumbVariants: Record<SwitchState, string> = {
65
64
  unchecked: "",
66
65
  };
67
66
 
68
- const variants: Record<SwitchState, Array<string>> = {
69
- checked: [`bg-${config.light.primary}`, `dark:bg-${config.dark.primary}`],
70
- unchecked: [`bg-${config.light.input}`, `dark:bg-${config.dark.input}`],
67
+ const variants: Record<SwitchState, string> = {
68
+ checked: "bg-primary",
69
+ unchecked: "bg-input",
71
70
  };
72
71
  </script>
@@ -5,14 +5,8 @@
5
5
  </span>
6
6
 
7
7
  <div
8
- class="relative flex min-h-32 flex-col items-center justify-center gap-3 border border-dashed p-5 text-center transition-colors"
9
- :class="[
10
- config.radius,
11
- `border-${config.light.input}`,
12
- variants[state],
13
- `dark:border-${config.dark.input}`,
14
- interactionVariants[interaction],
15
- ]"
8
+ class="relative flex min-h-32 flex-col items-center justify-center gap-3 rounded-ui border border-input border-dashed p-5 text-center transition-colors"
9
+ :class="[variants[state], interactionVariants[interaction]]"
16
10
  @dragenter.prevent="isOver = true"
17
11
  @dragover.prevent="isOver = true"
18
12
  @dragleave="leave"
@@ -48,7 +42,6 @@
48
42
  </template>
49
43
 
50
44
  <script setup lang="ts">
51
- import config from "#config/ui";
52
45
  import { computed, ref, useTemplateRef } from "vue";
53
46
  import type { ControlInteraction } from "../../components/control.ts";
54
47
  import type { UploadState } from "../../components/upload.ts";
@@ -89,9 +82,9 @@ const interactionVariants: Record<ControlInteraction, string> = {
89
82
  enabled: "",
90
83
  };
91
84
 
92
- const variants: Record<UploadState, Array<string>> = {
93
- idle: [`bg-${config.light.muted}`, `dark:bg-${config.dark.muted}`],
94
- over: [`bg-${config.light.accent}`, `dark:bg-${config.dark.accent}`],
85
+ const variants: Record<UploadState, string> = {
86
+ idle: "bg-muted",
87
+ over: "bg-accent",
95
88
  };
96
89
 
97
90
  function change() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revojs/ui",
3
- "version": "0.1.58",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,8 @@
25
25
  "./vue": {
26
26
  "types": "./dist/vue/index.d.ts",
27
27
  "import": "./dist/vue/index.js"
28
- }
28
+ },
29
+ "./style.css": "./dist/style.css"
29
30
  },
30
31
  "scripts": {
31
32
  "build": "vite build",
@@ -34,7 +35,10 @@
34
35
  "dependencies": {
35
36
  "@iconify/types": "^2.0.0",
36
37
  "@iconify/utils": "^3.1.7",
37
- "revojs": "*"
38
+ "@revojs/client": "*",
39
+ "@tailwindcss/vite": "^4.3.3",
40
+ "revojs": "*",
41
+ "tailwindcss": "^4.3.3"
38
42
  },
39
43
  "devDependencies": {
40
44
  "@revojs/tsconfig": "*",