@unsource/ui 1.0.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/README.md ADDED
@@ -0,0 +1,84 @@
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: My Module
6
+ - Package name: my-module
7
+ - Description: My new Nuxt module
8
+ -->
9
+
10
+ # My Module
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ My new Nuxt module for doing amazing things.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
+ <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your module provide here -->
26
+ - ⛰ &nbsp;Foo
27
+ - 🚠 &nbsp;Bar
28
+ - 🌲 &nbsp;Baz
29
+
30
+ ## Quick Setup
31
+
32
+ Install the module to your Nuxt application with one command:
33
+
34
+ ```bash
35
+ npx nuxi module add my-module
36
+ ```
37
+
38
+ That's it! You can now use My Module in your Nuxt app ✨
39
+
40
+
41
+ ## Contribution
42
+
43
+ <details>
44
+ <summary>Local development</summary>
45
+
46
+ ```bash
47
+ # Install dependencies
48
+ npm install
49
+
50
+ # Generate type stubs
51
+ npm run dev:prepare
52
+
53
+ # Develop with the playground
54
+ npm run dev
55
+
56
+ # Build the playground
57
+ npm run dev:build
58
+
59
+ # Run ESLint
60
+ npm run lint
61
+
62
+ # Run Vitest
63
+ npm run test
64
+ npm run test:watch
65
+
66
+ # Release new version
67
+ npm run release
68
+ ```
69
+
70
+ </details>
71
+
72
+
73
+ <!-- Badges -->
74
+ [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
75
+ [npm-version-href]: https://npmjs.com/package/my-module
76
+
77
+ [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
78
+ [npm-downloads-href]: https://npm.chart.dev/my-module
79
+
80
+ [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
81
+ [license-href]: https://npmjs.com/package/my-module
82
+
83
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
84
+ [nuxt-href]: https://nuxt.com
@@ -0,0 +1,5 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ declare const _default: _nuxt_schema.NuxtModule<Record<string, string>, Record<string, string>, false>;
4
+
5
+ export { _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "unsource-ui",
3
+ "configKey": "unsourceUi",
4
+ "version": "1.0.0",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
+ }
9
+ }
@@ -0,0 +1,41 @@
1
+ import { defineNuxtModule, createResolver, addComponentsDir, installModule } from '@nuxt/kit';
2
+
3
+ const module = defineNuxtModule({
4
+ meta: {
5
+ name: "unsource-ui",
6
+ configKey: "unsourceUi"
7
+ },
8
+ // Default configuration options of the Nuxt module
9
+ defaults: {},
10
+ async setup(_options, _nuxt) {
11
+ const resolver = createResolver(import.meta.url);
12
+ addComponentsDir({
13
+ path: resolver.resolve("./runtime/components"),
14
+ // path of components
15
+ pathPrefix: false,
16
+ // Prefix component name by its path.
17
+ prefix: "",
18
+ // Prefix all matched components.
19
+ global: true
20
+ // Registers components to be globally available.
21
+ });
22
+ await installModule("@unocss/nuxt", {
23
+ configFile: "./runtime/uno.config.{mjs,js,ts}"
24
+ });
25
+ await installModule("@nuxt/icon");
26
+ _nuxt.options.modules.push(
27
+ "@unocss/nuxt",
28
+ "@nuxt/icon"
29
+ );
30
+ _nuxt.options.icon = {
31
+ customCollections: [
32
+ {
33
+ prefix: "my-icon",
34
+ dir: "./assets/icons"
35
+ }
36
+ ]
37
+ };
38
+ }
39
+ });
40
+
41
+ export { module as default };
@@ -0,0 +1,21 @@
1
+ type __VLS_Props = {
2
+ direction?: 'column' | 'row' | 'row-reverse' | 'column-reverse';
3
+ customClass?: Record<'main' | 'body' | 'title' | 'tags' | 'tag' | 'description' | 'footer' | 'image' | 'avatar', string>;
4
+ };
5
+ declare var __VLS_22: {}, __VLS_24: {}, __VLS_26: {};
6
+ type __VLS_Slots = {} & {
7
+ header?: (props: typeof __VLS_22) => any;
8
+ } & {
9
+ footerStart?: (props: typeof __VLS_24) => any;
10
+ } & {
11
+ footerEnd?: (props: typeof __VLS_26) => any;
12
+ };
13
+ 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>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <NuxtLink
3
+ class="flex items-stretch bg-white rounded-2xl overflow-hidden"
4
+ :class="headerClass[direction]"
5
+ to="#"
6
+ >
7
+ <UnNuxtIcon
8
+ class="grow-1 basis-1"
9
+ :class="customClass.image"
10
+ name="https://picsum.photos/400/200"
11
+ icon-type="img"
12
+ />
13
+ <div
14
+ :class="customClass.main"
15
+ class="flex flex-col items-stretch grow-2.5 basis-2.5"
16
+ >
17
+ <div
18
+ :class="customClass.body"
19
+ class="flex gap-2 items-stretch p-3"
20
+ >
21
+ <UnNuxtIcon
22
+ :class="customClass.avatar"
23
+ :name="`https://s3.parand.app/files/parand/images/shop-logo.png`"
24
+ icon-type="img"
25
+ class="!object-cover shrink-0 w-14 h-14 aspect-square rounded-full border-(2 solid primary-500)"
26
+ />
27
+ <div class="flex justify-start flex-col gap-1 grow-1">
28
+ <h3
29
+ :class="customClass.title"
30
+ class="text-(lg gray-600) font-medium"
31
+ >{{ item.title }}</h3>
32
+ <small
33
+ :class="customClass.description"
34
+ class="text-(base gray-500)"
35
+ >{{ item.description }}</small>
36
+ <div
37
+ :class="customClass.tags"
38
+ class="flex items-center justify-start gap-2"
39
+ >
40
+ <UnChips
41
+ v-for="(tag, index) in item.tags"
42
+ :key="index"
43
+ :class="customClass.tag"
44
+ :label="tag.value"
45
+ :icon="tag.icon"
46
+ :variant="tag.variant || 'secondary'"
47
+ :mini="true"
48
+ class="!px-1"
49
+ />
50
+ </div>
51
+ </div>
52
+ <slot name="header" />
53
+ </div>
54
+ <div
55
+ v-if="$slots.footerStart || $slots.footerEnd"
56
+ :class="customClass.footer"
57
+ class="flex justify-between items-stretch border-t-(2 dashed border) p-3"
58
+ >
59
+ <slot name="footerStart" />
60
+ <slot name="footerEnd" />
61
+ </div>
62
+ </div>
63
+ </NuxtLink>
64
+ </template>
65
+
66
+ <script setup>
67
+ const { direction = "row-reverse", customClass = {} } = defineProps({
68
+ direction: { type: String, required: false },
69
+ customClass: { type: Object, required: false }
70
+ });
71
+ const headerClass = {
72
+ "column": "flex-col",
73
+ "row": "flex-row",
74
+ "row-reverse": "flex-row-reverse",
75
+ "column-reverse": "flex-col-reverse"
76
+ };
77
+ const item = {
78
+ title: "\u062A\u0633\u062A",
79
+ description: "\u0644\u0648\u0631\u0645 \u0627\u06CC\u067E\u0633\u0648\u0645 \u0645\u062A\u0646 \u0633\u0627\u062E\u062A\u06AF\u06CC \u0628\u0627 \u062A\u0648\u0644\u06CC\u062F \u0633\u0627\u062F\u06AF\u06CC \u0646\u0627\u0645\u0641\u0647\u0648\u0645 \u0627\u0632 \u0635\u0646\u0639\u062A \u0686\u0627\u067E \u0648 \u0628\u0627 \u0627\u0633\u062A\u0641\u0627\u062F\u0647 \u0627\u0632 \u0637\u0631\u0627\u062D\u0627\u0646 \u06AF\u0631\u0627\u0641\u06CC\u06A9 \u0627\u0633\u062A ",
80
+ tags: [
81
+ {
82
+ value: "\u062A\u0633\u062A"
83
+ },
84
+ {
85
+ value: "\u062A\u0633\u062A"
86
+ }
87
+ ]
88
+ };
89
+ </script>
@@ -0,0 +1,21 @@
1
+ type __VLS_Props = {
2
+ direction?: 'column' | 'row' | 'row-reverse' | 'column-reverse';
3
+ customClass?: Record<'main' | 'body' | 'title' | 'tags' | 'tag' | 'description' | 'footer' | 'image' | 'avatar', string>;
4
+ };
5
+ declare var __VLS_22: {}, __VLS_24: {}, __VLS_26: {};
6
+ type __VLS_Slots = {} & {
7
+ header?: (props: typeof __VLS_22) => any;
8
+ } & {
9
+ footerStart?: (props: typeof __VLS_24) => any;
10
+ } & {
11
+ footerEnd?: (props: typeof __VLS_26) => any;
12
+ };
13
+ 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>;
14
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
+ declare const _default: typeof __VLS_export;
16
+ export default _default;
17
+ type __VLS_WithSlots<T, S> = T & {
18
+ new (): {
19
+ $slots: S;
20
+ };
21
+ };
@@ -0,0 +1,14 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ icon?: string;
4
+ prependClass?: string;
5
+ prepend?: string;
6
+ variant?: string;
7
+ mini?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
10
+ variant: string;
11
+ mini: boolean;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div
3
+ class="flex items-center px-2 py-1 gap-1 rounded-full cursor-pointer shrink-0"
4
+ :class="classVariant"
5
+ >
6
+ <div
7
+ class="flex items-center justify-center"
8
+ :class="[prepend ? mini ? 'w-4' : 'w-8' : 'w-0', mini ? 'h-4' : 'h-8']"
9
+ >
10
+ <UnNuxtIcon
11
+ v-if="prepend"
12
+ :name="prepend"
13
+ class="text-base"
14
+ :class="prependClass"
15
+ @click="$emit('prependClick')"
16
+ />
17
+ </div>
18
+ <p class="text-xs">
19
+ {{ label }}
20
+ </p>
21
+ <UnNuxtIcon
22
+ v-if="icon"
23
+ :name="icon"
24
+ class="text-base"
25
+ @click="$emit('iconClick')"
26
+ />
27
+ </div>
28
+ </template>
29
+
30
+ <script setup>
31
+ const props = defineProps({
32
+ label: { type: String, required: false },
33
+ icon: { type: String, required: false },
34
+ prependClass: { type: String, required: false },
35
+ prepend: { type: String, required: false },
36
+ variant: { type: String, required: false, default: "danger" },
37
+ mini: { type: Boolean, required: false, default: false }
38
+ });
39
+ defineEmits(["prependClick", "iconClick"]);
40
+ const variants = {
41
+ "success": "bg-success/10 text-success",
42
+ "success-fill": "bg-success text-white",
43
+ "danger": "bg-danger/10 text-danger",
44
+ "danger-fill": "bg-danger text-white",
45
+ "warning": "bg-warning/10 text-warning",
46
+ "warning-fill": "bg-warning text-white",
47
+ "primary": "bg-primary-500/10 text-primary-500",
48
+ "primary-fill": "bg-primary-500 text-white",
49
+ "primary-border": "bg-primary-500/10 text-primary-500 border-(1 solid primary-500)",
50
+ "secondary": "bg-gray-600/10 text-gray-600",
51
+ "secondary-fill": "bg-gray-600 text-white"
52
+ };
53
+ const classVariant = computed(() => variants?.[props.variant]);
54
+ </script>
@@ -0,0 +1,14 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ icon?: string;
4
+ prependClass?: string;
5
+ prepend?: string;
6
+ variant?: string;
7
+ mini?: boolean;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
10
+ variant: string;
11
+ mini: boolean;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ name?: string | null;
3
+ iconType?: string;
4
+ filled?: boolean;
5
+ alt?: string;
6
+ };
7
+ 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>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <div
3
+ v-if="iconType === 'img' || name?.split('.')[1]"
4
+ class="relative overflow-hidden"
5
+ >
6
+ <div
7
+ v-if="!loaded"
8
+ class="absolute inset-0 bg-gray-200 animate-pulse z-0"
9
+ />
10
+ <img
11
+ :src="name?.includes('http') ? name : '/images/' + (name || 'noimage.jpg')"
12
+ :alt="alt || 'NoImg'"
13
+ loading="lazy"
14
+ class="block w-full h-full object-cover transition-opacity duration-300 z-10"
15
+ :class="loaded ? 'opacity-100' : 'opacity-0'"
16
+ @load="loaded = true"
17
+ >
18
+ </div>
19
+ <Icon
20
+ v-else-if="name"
21
+ class="text-2xl overflow-hidden"
22
+ :name="name"
23
+ />
24
+ </template>
25
+
26
+ <script setup>
27
+ const props = defineProps({
28
+ name: { type: [String, null], required: false },
29
+ iconType: { type: String, required: false },
30
+ filled: { type: Boolean, required: false },
31
+ alt: { type: String, required: false }
32
+ });
33
+ const iconType = props.iconType || "icon";
34
+ const loaded = ref(false);
35
+ </script>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ name?: string | null;
3
+ iconType?: string;
4
+ filled?: boolean;
5
+ alt?: string;
6
+ };
7
+ 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>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ export default defineNuxtPlugin((_nuxtApp) => {
3
+ console.log("Plugin injected by my-module!");
4
+ });
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json",
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("unocss").UserConfig<object>;
2
+ export default _default;
@@ -0,0 +1,60 @@
1
+ import {
2
+ defineConfig,
3
+ presetAttributify,
4
+ presetWind4,
5
+ transformerDirectives,
6
+ transformerVariantGroup
7
+ } from "unocss";
8
+ import { presetScrollbar } from "unocss-preset-scrollbar";
9
+ export default defineConfig({
10
+ theme: {
11
+ colors: {
12
+ border: "#cccdd5",
13
+ danger: "#e60c21",
14
+ warning: "#ffc600",
15
+ success: "#35d123",
16
+ secondary: {
17
+ 500: "#fdf037"
18
+ },
19
+ primary: "#1270da",
20
+ text: {
21
+ head: "#4D4444"
22
+ },
23
+ gray: {
24
+ 200: "#949494",
25
+ 500: "#696969",
26
+ 600: "#1e1e1e"
27
+ }
28
+ },
29
+ boxShadow: {
30
+ navbar: "0 1px 10px 0px #f79520",
31
+ header: "0 1px 10px 0px #cccdd5"
32
+ },
33
+ gridTemplateColumn: {
34
+ "fill-45": "repeat(auto-fill, minmax(4rem, 1fr))",
35
+ "fill-60": "repeat(auto-fill, minmax(6rem, 1fr))",
36
+ "fill-90": "repeat(auto-fill, minmax(22.5rem, 1fr))",
37
+ "fill-120": "repeat(auto-fill, minmax(30rem, 1fr))"
38
+ },
39
+ fontSize: {
40
+ "2xs": "10px"
41
+ }
42
+ },
43
+ shortcuts: {},
44
+ transformers: [
45
+ transformerVariantGroup(),
46
+ transformerDirectives({
47
+ // the defaults
48
+ applyVariable: ["--at-apply", "--uno-apply", "--uno"]
49
+ // or disable with:
50
+ // applyVariable: false
51
+ })
52
+ ],
53
+ presets: [
54
+ presetWind4(),
55
+ presetAttributify(),
56
+ presetScrollbar({
57
+ noCompatible: false
58
+ })
59
+ ]
60
+ });
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.mjs'
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@unsource/ui",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "My new Nuxt module",
6
+ "repository": "your-org/my-module",
7
+ "license": "MIT",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types.d.mts",
12
+ "import": "./dist/module.mjs"
13
+ }
14
+ },
15
+ "main": "./dist/module.mjs",
16
+ "typesVersions": {
17
+ "*": {
18
+ ".": [
19
+ "./dist/types.d.mts"
20
+ ]
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "prepack": "nuxt-module-build build",
28
+ "dev": "npm run dev:prepare && nuxi dev playground",
29
+ "dev:build": "nuxi build playground",
30
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
31
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
32
+ "lint": "eslint .",
33
+ "test": "vitest run",
34
+ "test:watch": "vitest watch",
35
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
36
+ },
37
+ "dependencies": {
38
+ "@nuxt/kit": "^4.1.3",
39
+ "unocss-preset-scrollbar": "^3.2.0"
40
+ },
41
+ "devDependencies": {
42
+ "@nuxt/devtools": "^2.6.5",
43
+ "@nuxt/eslint-config": "^1.9.0",
44
+ "@nuxt/icon": "1.15.0",
45
+ "@nuxt/module-builder": "^1.0.2",
46
+ "@nuxt/schema": "^4.1.3",
47
+ "@nuxt/test-utils": "^3.19.2",
48
+ "@types/node": "latest",
49
+ "@unhead/vue": "^1.11.20",
50
+ "@unocss/nuxt": "^66.5.3",
51
+ "changelogen": "^0.6.2",
52
+ "eslint": "^9.37.0",
53
+ "nuxt": "^3.19.3",
54
+ "typescript": "~5.9.3",
55
+ "unocss": "^66.5.3",
56
+ "vitest": "^3.2.4",
57
+ "vue-tsc": "^3.1.0"
58
+ }
59
+ }