@davra/ui-core 1.0.0-alpha.5 → 1.0.2

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,183 +1,30 @@
1
1
 
2
- # Vue Component Library Starter
2
+ # UI Core
3
3
 
4
- > Create your own [Vue 3](https://v3.vuejs.org/) component library with TypeScript, [Vite](https://vitejs.dev) and [VitePress](https://vitepress.vuejs.org/).
5
4
 
6
- Sooner or later, you will find that creating a component library is much better than having all components inside your app project. A component library force to you remove app specific logic from your components, making it easier to test and reuse them in other apps.
7
-
8
- Once the components are in a library, documentation becomes critical. This starter project includes a documentation app powered by VitePress. It not only documents the usage of the component, but also provides a testing bed during the development of components. See the generated documentation app [here](https://sharp-babbage-154f0a.netlify.com/).
9
5
 
10
6
  ## Setup
11
7
 
12
- > When running `docs:dev` for the first time, you may encounter error like `vitepress data not properly injected in app` in your browser. Restart the server and reload the browser. Please refer to [issue #30](https://github.com/wuruoyun/vue-component-lib-starter/issues/30) for more details.
8
+ > To run the library locally and be able to see your changes without having to publish a new version use [npm link](https://medium.com/dailyjs/how-to-use-npm-link-7375b6219557)
13
9
 
14
10
  ```bash
15
11
  # install dependencies
16
12
  npm install
17
13
 
18
- # start the doc app with hot reload, great for testing components
19
- npm run docs:dev
14
+ # link package
15
+ npm link
16
+
17
+ # start the build with hot reload, great for testing components
18
+ npm run build:watch
20
19
 
21
20
  # build the library, available under dist
22
21
  npm run build
23
22
 
24
- # build the doc app, available under docs/.vitepress/dist
25
- npm run docs:build
26
-
27
- # preview the doc app locally from docs/.vitepress/dist
28
- npm run docs:serve
23
+ # run tests
24
+ npm run test
29
25
  ```
30
26
 
31
- You may use [Netlify](https://www.netlify.com/) to auto build and deploy the doc app like this project does.
32
-
33
- ## Develop and test locally
34
-
35
- The best way to develop and test your component is by creating demos in `docs/components/demo` folder, as shown by the example components.
36
-
37
- If you want to test the library in your Vue3 app locally:
38
-
39
- - In the root folder of this library, run `npm link`. This will create a symbolic link to the library.
40
- - In the root folder of your client app, run `npm link my-lib`. This will add the symbolic link to the `node_modules` folder in your client app.
41
- - You can now import `my-lib` in your client app.
42
-
43
- There is no need to add `my-lib` to your client app's dependency in this case.
44
-
45
- If you made changes to the library, you will need to rebuild the library. Your Vue3 app shall hot reload when the building of library is completed.
46
-
47
- ## How it works
48
-
49
- ### Components
50
-
51
- The library is a [Vue plugin](https://v3.vuejs.org/guide/plugins.html). The `install` function in [index.ts](src/index.ts) registers all components under [components](src/components) to Vue globably.
52
-
53
- The components are also exported by [index.ts](src/index.ts) so that the client app can import them individually and register them locally, instead of using the library as a plugin. This may be a better option if the client app only use a small set of components in your library.
54
-
55
- As there are already many UI component libraries for Vue 3, you may just want to build on top of one of them and create components for your specific needs. The Component B in this starter shows the example of using [PrimeVue](https://www.primefaces.org/primevue/) as the fundation library. However, this means the client app shall also use the same fundation component library as your library does.
56
-
57
- The doc app itself is a client app of the libary, therefore PrimeVue is imported in [docs/.vitepress/theme/index.js](docs/.vitepress/theme/index.js). The configuration in [docs/.vitepress/config.js](docs/.vitepress/config.js) below forces VitePress to resolve these modules with no duplication, avoiding error at runtime, as PrimeVue also has Vue in its dependency.
58
27
 
59
- ```js
60
- module.exports = {
61
- vite: {
62
- resolve: {
63
- dedupe: ['vue', /primevue\/.+/],
64
- },
65
- },
66
- }
67
- ```
68
-
69
- > In [vite.config.ts](vite.config.ts), format 'umd' is not present in `build.lib.formats` option. This is because the PrimeVue components used by this library are externalized, and therefore requiring corresponding options in `rollupOptions.output.globals`. To avoid adding global varaibles for PrimeVue components, 'umd' is removed for simplicity.
70
-
71
- ### Utilities and constants
72
-
73
- The library includes example utilities and constants. They are also exported in [index.ts](src/index.ts). The client app may use them as below:
74
-
75
- ```js
76
- <script lang="ts">
77
- import { MyConstants, MyUtil } from 'my-lib'
78
-
79
- export default {
80
- data () {
81
- return {
82
- magicNum: MyConstants.MAGIC_NUM
83
- }
84
- },
85
- methods: {
86
- add (a:number, b:number) {
87
- return MyUtil.add(a, b)
88
- }
89
- }
90
- }
91
- </script>
92
- ```
93
-
94
- ### Styling
95
-
96
- Individual components may have styles defined in its `.vue` file. They will be processed, combined and minified into `dist/style.css`, which is included in the `exports` list in [package.json](package.json).
97
-
98
- If you have library level styles shared by all components in the library, you may add them to [src/assets/main.scss](src/assets/main.scss). This file is imported in [index.ts](src/index.ts), therefore the processed styles are also included into `dist/style.css`. To avoid conflicting with other global styles, consider pre-fixing the class names or wrapping them into a namespace class.
99
-
100
- If you have your own special set of SVG icons, you may create a font file (`.woff` format) using tools like [Icomoon](https://icomoon.io/) or [Fontello](https://fontello.com/). This starter includes an example font file [src/assets/fonts/myfont.woff](src/assets/fonts/myfont.woff) and references it in [src/assets/main.scss](src/assets/main.scss), with utility icon CSS classes. An icon from the font file is used in Component A. Vite will include the font file into the build, see [https://vitejs.dev/guide/assets.html](https://vitejs.dev/guide/assets.html).
101
-
102
- The client app shall import `style.css`, usually in the entry file:
103
-
104
- ```js
105
- import 'my-lib/dist/style.css'
106
- ```
107
28
 
108
- ### Third-party dependencies
109
29
 
110
- Third-party libraries used by you library may bloat up the size of your library, if you simply add them to the `dependencies` in [package.json](package.json).
111
30
 
112
- The following are some strategies to reduce the size of your library:
113
-
114
- #### Externalization
115
-
116
- If you expect the client app of your library may also need the same dependency, you may externalize the dependency. For example, to exclude PrimeVue from your library build artifact, in [vite.config.ts](vite.config.ts), you may have
117
-
118
- ```js
119
- module.exports = defineConfig({
120
- rollupOptions: {
121
- external: ['vue', /primevue\/.+/]
122
- }
123
- }
124
- })
125
- ```
126
-
127
- The dependency to be externalized may be declared as peer dependency in your library.
128
-
129
- #### Cherry picking
130
-
131
- If you don't expect the client app of your library also needing the same dependency, you may embed cherry-picked functions. For example, to embed the `fill` function of popular library [lodash](https://lodash.com), import the `fill` function like the following:
132
-
133
- ```js
134
- import fill from 'lodash/fill'
135
- ```
136
-
137
- Even with tree-shaking, the codes being brought into your library may still be large, as the function may have its own dependencies.
138
-
139
- Note that `import { fill } from 'lodash'` or `import _ from 'lodash'` will not work and will embed the whole `lodash` library.
140
-
141
- Finally, if your client app also use `lodash` and you don't want `lodash` to be in both the client app and your libraries, even after cherry-picking, you may consider cherry-picking in component library and re-export them as utils for client to consume, so that the client does not need to depend on `lodash`, therefore avoiding duplication.
142
-
143
- ### Type generation
144
-
145
- In [tsconfig.json](tsconfig.json), the following options instructs `tsc` to emit declaration (`.d.ts` files) only, as `vite build` handles the `.js` file generation. The generated `.d.ts` files are sent to `dist/types` folder.
146
-
147
- ```json
148
- "compilerOptions": {
149
- "declaration": true,
150
- "emitDeclarationOnly": true,
151
- "declarationDir": "./dist/types"
152
- }
153
- ```
154
-
155
- In [package.json](package.json), the line below locates the generated types for library client.
156
-
157
- ```json
158
- "types": "./dist/types/index.d.ts",
159
- ```
160
-
161
- > In [vite.config.ts](vite.config.ts), `build.emptyOutDir` is set to `false` and `rimraf` is used instead to remove the `dist` folder before the build. This is to avoid the `dist/types` folder generated by `tsc` being deleted when running `vite build`.
162
-
163
- ### Configuration
164
-
165
- #### TypeScript
166
-
167
- In [tsconfig.json](tsconfig.js), set the following as recommended by Vite (since esbuild is used). However, enableing this option leads to https://github.com/vitejs/vite/issues/5814. The workaround is to also enable `compilerOptions.skipLibCheck`.
168
-
169
- ```json
170
- "compilerOptions": {
171
- "isolatedModules": true
172
- }
173
- ```
174
-
175
- In [tsconfig.json](tsconfig.js), set the following to address [Issue #32](https://github.com/wuruoyun/vue-component-lib-starter/issues/32). The solution is from https://github.com/johnsoncodehk/volar/discussions/592.
176
-
177
- ```json
178
- "compilerOptions": {
179
- "types": [
180
- "vite/client"
181
- ]
182
- }
183
- ```
@@ -1094,7 +1094,9 @@ const Bt = {
1094
1094
  { Action: "digitalSignatures.CREATE_DIGITAL_SIGNATURE" },
1095
1095
  { Action: "dashboards.ACCESS" },
1096
1096
  { Action: "dashboards.CREATE_DASHBOARD" },
1097
- { Action: "integrations.ACCESS" }
1097
+ { Action: "integrations.ACCESS" },
1098
+ { Action: "trustedcertificates.ACCESS" },
1099
+ { Action: "trustedcertificates.CREATE" }
1098
1100
  ], yt = async (e = []) => {
1099
1101
  try {
1100
1102
  const { data: t } = await f().post(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@davra/ui-core",
3
3
  "types": "./dist/types/index.d.ts",
4
- "version": "1.0.0-alpha.5",
4
+ "version": "1.0.2",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
7
7
  "build:watch": "rimraf dist && vue-tsc && vite build --watch",
@@ -16,12 +16,12 @@
16
16
  "@vueuse/core": "^9.1.0",
17
17
  "@vueuse/head": "^0.7.9",
18
18
  "axios": "^1.6.0",
19
- "pinia": "2.1.4",
19
+ "pinia": "^2.1.4",
20
20
  "primeflex": "^3.3.1",
21
21
  "primeicons": "^6.0.1",
22
22
  "primevue": "^3.29.2",
23
23
  "vue": "^3.3.4",
24
- "vuetify": "3.3.16"
24
+ "vuetify": "^3.3.16"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@pinia/testing": "^0.0.14",
@@ -51,4 +51,4 @@
51
51
  },
52
52
  "./dist/style.css": "./dist/style.css"
53
53
  }
54
- }
54
+ }