@deck9/ui 0.17.0-next.1 → 0.17.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 CHANGED
@@ -1,24 +1,120 @@
1
- # ui
1
+ # @deck9/ui
2
2
 
3
- ## Project setup
3
+ Vue 3 components for Deck9 apps such as [Input](https://github.com/deck9/input), styled with Tailwind CSS 3. Storybook is the component reference: run `npm run storybook` in this repo.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @deck9/ui
9
+ pnpm add @deck9/ui
10
+ yarn add @deck9/ui
11
+ bun add @deck9/ui
4
12
  ```
5
- yarn install
13
+
14
+ Vue 3.3 or newer is a peer dependency. Pre-releases are on the `next` tag: `npm install @deck9/ui@next`.
15
+
16
+ The steps below use npm. With another package manager, swap `npm install` for `pnpm add`, `yarn add` or `bun add`.
17
+
18
+ ## Use it in an app
19
+
20
+ ### Tailwind
21
+
22
+ The package ships no CSS: its components use Tailwind 3 classes, and the app's Tailwind build creates them. In a new app, set up Tailwind 3:
23
+
24
+ ```sh
25
+ npm install -D tailwindcss@3 postcss autoprefixer @tailwindcss/forms
26
+ npx tailwindcss init -p
6
27
  ```
7
28
 
8
- ### Compiles and hot-reloads for development
29
+ In `tailwind.config.js`, add the package's bundle to `content`, plus the `grey` color and the forms plugin the components use. `darkMode: "class"` keeps the components light until the app sets a `dark` class. Without it, they turn dark whenever the computer is in dark mode.
30
+
31
+ ```js
32
+ import colors from "tailwindcss/colors";
33
+ import forms from "@tailwindcss/forms";
34
+
35
+ export default {
36
+ darkMode: "class",
37
+ content: [
38
+ "./index.html",
39
+ "./src/**/*.{vue,js,ts}",
40
+ "./node_modules/@deck9/ui/dist/src/ui.mjs",
41
+ ],
42
+ theme: {
43
+ extend: {
44
+ colors: { grey: colors.slate },
45
+ },
46
+ },
47
+ plugins: [forms],
48
+ };
9
49
  ```
10
- yarn serve
50
+
51
+ Put Tailwind's layers in the app's main CSS file (in a Vite app: `src/style.css`):
52
+
53
+ ```css
54
+ @tailwind base;
55
+ @tailwind components;
56
+ @tailwind utilities;
11
57
  ```
12
58
 
13
- ### Compiles and minifies for production
59
+ ### Icons
60
+
61
+ The components draw icons with Font Awesome 6 and register only the few they use themselves. The app registers every other icon. Install Font Awesome 6, so the app and the components share one copy:
62
+
63
+ ```sh
64
+ npm install @fortawesome/fontawesome-svg-core@6 @fortawesome/free-solid-svg-icons@6
14
65
  ```
15
- yarn build
66
+
67
+ Register the icons once before the app mounts, for example in `src/main.js`:
68
+
69
+ ```js
70
+ import { library } from "@fortawesome/fontawesome-svg-core";
71
+ import { faRocket } from "@fortawesome/free-solid-svg-icons";
72
+
73
+ library.add(faRocket);
74
+ ```
75
+
76
+ Brand icons work the same way with `@fortawesome/free-brands-svg-icons@6`.
77
+
78
+ ### A first component
79
+
80
+ ```vue
81
+ <script setup>
82
+ import { D9Button, D9Icon } from "@deck9/ui";
83
+ </script>
84
+
85
+ <template>
86
+ <D9Button label="Launch" icon="rocket" />
87
+ <D9Icon name="rocket" size="2x" />
88
+ </template>
16
89
  ```
17
90
 
18
- ### Lints and fixes files
91
+ Icon names are Font Awesome's names in kebab-case, without `fa`: `faChevronDown` is `chevron-down`.
92
+
93
+ ## Develop
94
+
95
+ The repo uses npm (`package-lock.json`) and the Node version in `.nvmrc`.
96
+
97
+ ```sh
98
+ npm ci
99
+ npm run storybook # Storybook on http://localhost:6006
100
+ npm test # Vitest
101
+ npm run lint # ESLint
102
+ npm run check # type check
103
+ npm run build # builds dist/, the files npm publishes
19
104
  ```
20
- yarn lint
105
+
106
+ ## Release
107
+
108
+ Run `release.sh` on main. It takes the same arguments as `npm version`:
109
+
110
+ ```sh
111
+ ./release.sh preminor --preid next # 0.17.0 → 0.18.0-next.0
112
+ ./release.sh prerelease # 0.18.0-next.0 → 0.18.0-next.1
113
+ ./release.sh minor # 0.18.0-next.1 → 0.18.0
114
+ ./release.sh patch # 0.18.0 → 0.18.1
115
+ ./release.sh major # 0.18.1 → 1.0.0
21
116
  ```
22
117
 
23
- ### Customize configuration
24
- See [Configuration Reference](https://cli.vuejs.org/config/).
118
+ It pulls main, builds, bumps the version, pushes the commit and tag, and creates a GitHub release. You need push rights on main and a logged-in `gh`. The GitHub release starts the publish workflow, which publishes to npm through trusted publishing, without an npm token.
119
+
120
+ A version with a dash, like `0.18.0-next.1`, is a pre-release: it goes to the `next` tag. Every other version goes to `latest`, which is what `npm install @deck9/ui` installs.
@@ -14,13 +14,17 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
14
14
  iconPosition: string;
15
15
  isLoading: boolean;
16
16
  isDisabled: boolean;
17
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ButtonProps>, {
17
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ click: (...args: any[]) => void;
19
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ButtonProps>, {
18
20
  size: string;
19
21
  color: string;
20
22
  iconPosition: string;
21
23
  isLoading: boolean;
22
24
  isDisabled: boolean;
23
- }>>>, {
25
+ }>>> & {
26
+ onClick?: ((...args: any[]) => any) | undefined;
27
+ }, {
24
28
  size: Size;
25
29
  color: ColorScheme;
26
30
  isLoading: boolean;
@@ -1,16 +1,21 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
2
  position: "right" | "left";
3
3
  usePortal: string | boolean;
4
+ label?: string | undefined;
4
5
  }>, {
5
6
  position: string;
6
7
  usePortal: boolean;
8
+ label: string;
7
9
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
10
  position: "right" | "left";
9
11
  usePortal: string | boolean;
12
+ label?: string | undefined;
10
13
  }>, {
11
14
  position: string;
12
15
  usePortal: boolean;
16
+ label: string;
13
17
  }>>>, {
18
+ label: string;
14
19
  position: "right" | "left";
15
20
  usePortal: string | boolean;
16
21
  }, {}>, {
@@ -1,20 +1,21 @@
1
1
  import { Size } from "../types/types";
2
2
  interface SelectOption {
3
3
  [key: string]: unknown;
4
- id: string | number;
4
+ id?: string | number;
5
5
  label: string | number;
6
6
  icon?: string;
7
7
  disabled?: boolean;
8
8
  }
9
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
9
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
10
10
  id?: string | undefined;
11
11
  modelValue?: SelectOption | null | undefined;
12
12
  size?: Size | undefined;
13
13
  icon?: string | undefined;
14
14
  placeholder?: string | undefined;
15
15
  isDisabled?: boolean | undefined;
16
- options: Array<SelectOption>;
16
+ options: SelectOption[];
17
17
  disabledBadge?: string | undefined;
18
+ by?: string | ((a: SelectOption | null, b: SelectOption) => boolean) | undefined;
18
19
  }>, {
19
20
  size: string;
20
21
  isDisabled: boolean;
@@ -27,8 +28,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
27
28
  icon?: string | undefined;
28
29
  placeholder?: string | undefined;
29
30
  isDisabled?: boolean | undefined;
30
- options: Array<SelectOption>;
31
+ options: SelectOption[];
31
32
  disabledBadge?: string | undefined;
33
+ by?: string | ((a: SelectOption | null, b: SelectOption) => boolean) | undefined;
32
34
  }>, {
33
35
  size: string;
34
36
  isDisabled: boolean;
@@ -37,7 +39,13 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
37
39
  }, {
38
40
  size: Size;
39
41
  isDisabled: boolean;
40
- }, {}>;
42
+ }, {}>, {
43
+ option?(_: {
44
+ option: SelectOption;
45
+ active: any;
46
+ selected: any;
47
+ }): any;
48
+ }>;
41
49
  export default _default;
42
50
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
43
51
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -56,3 +64,8 @@ type __VLS_WithDefaults<P, D> = {
56
64
  type __VLS_Prettify<T> = {
57
65
  [K in keyof T]: T[K];
58
66
  } & {};
67
+ type __VLS_WithTemplateSlots<T, S> = T & {
68
+ new (): {
69
+ $slots: S;
70
+ };
71
+ };
@@ -1,2 +1,29 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
1
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ label?: string | undefined;
3
+ }>, {
4
+ label: string;
5
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
+ label?: string | undefined;
7
+ }>, {
8
+ label: string;
9
+ }>>>, {
10
+ label: string;
11
+ }, {}>;
2
12
  export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToRuntimeProps<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };
22
+ type __VLS_WithDefaults<P, D> = {
23
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
24
+ default: D[K];
25
+ }> : P[K];
26
+ };
27
+ type __VLS_Prettify<T> = {
28
+ [K in keyof T]: T[K];
29
+ } & {};