@bimdata/bcf-components 4.1.3 → 5.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 +2 -53
- package/package.json +6 -14
- package/vue3-plugin.js +6 -22
- package/dist/vue2/bcf-components.mjs +0 -9115
- package/dist/vue2/style.css +0 -1
- package/vue2-plugin.js +0 -76
- /package/dist/{vue3/bcf-components.mjs → bcf-components.mjs} +0 -0
- /package/dist/{vue3/style.css → style.css} +0 -0
package/README.md
CHANGED
|
@@ -12,37 +12,10 @@ Install:
|
|
|
12
12
|
npm install @bimdata/bcf-components
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Then refer to the next sub-sections on how to use the library depending
|
|
16
|
-
on which version of Vue you're using.
|
|
17
|
-
|
|
18
|
-
### Vue 2.7 application
|
|
19
|
-
|
|
20
|
-
**Note:** the library won't work as expected for versions of Vue below **2.7**.
|
|
21
|
-
|
|
22
|
-
In your Vue 2.7 application bootstrap script, add the following:
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
import Vue from "vue";
|
|
26
|
-
import VueI18n from "vue-i18n"; // v8.x
|
|
27
|
-
import { makeBIMDataApiClient } from "@bimdata/typescript-fetch-api-client"; // v8.2+
|
|
28
|
-
// Import Vue 2 plugin factory
|
|
29
|
-
import BIMDataBcfComponents from "@bimdata/bcf-components/vue2-plugin.js";
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
// Instanciate i18n plugin
|
|
33
|
-
const i18nPlugin = new VueI18n({ ... });
|
|
34
|
-
// Instanciate BIMData API client
|
|
35
|
-
const apiClient = makeBIMDataApiClient({ ... });
|
|
36
|
-
|
|
37
|
-
Vue.use(i18nPlugin);
|
|
38
|
-
// Provide both i18n plugin and API client as plugin config
|
|
39
|
-
Vue.use(BIMDataBcfComponents({ i18nPlugin, apiClient }));
|
|
40
|
-
...
|
|
41
|
-
```
|
|
42
|
-
|
|
43
15
|
### Vue 3.x application
|
|
44
16
|
|
|
45
|
-
**
|
|
17
|
+
> **Note:** The library is built for Vue 3.x applications, it is no longer intended
|
|
18
|
+
> to work with older version of Vue.
|
|
46
19
|
|
|
47
20
|
The package provide a Vue plugin that can be used to setup the library for your app
|
|
48
21
|
and make all components available globally.
|
|
@@ -70,30 +43,6 @@ It is also possible to provide your own translations for i18n by removing
|
|
|
70
43
|
`i18nPlugin` from plugin config and adding translation keys from
|
|
71
44
|
[`src/i18n/lang/fr.js`](./src/i18n/lang/fr.json) to the translation files of your app.
|
|
72
45
|
|
|
73
|
-
**Using "manual" setup**
|
|
74
|
-
|
|
75
|
-
To setup the library without the use of the plugin you have to provide your own translations
|
|
76
|
-
(as described above in the *Using Vue plugin* section) and inject an API client like so:
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
import { makeBIMDataApiClient } from "@bimdata/typescript-fetch-api-client"; // v8.2+
|
|
80
|
-
// Import `createService` and `setService` utils
|
|
81
|
-
import { createService, setService } from "@bimdata/bcf-components";
|
|
82
|
-
|
|
83
|
-
// Instanciate BIMData API client
|
|
84
|
-
const apiClient = makeBIMDataApiClient({ ... });
|
|
85
|
-
|
|
86
|
-
// Initialize library service
|
|
87
|
-
const service = createService(apiClient);
|
|
88
|
-
setService(service);
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Then you can directly use components in your app that way:
|
|
92
|
-
|
|
93
|
-
```js
|
|
94
|
-
import { BcfTopicCard } from "@bimdata/bcf-components";
|
|
95
|
-
```
|
|
96
|
-
|
|
97
46
|
## Build
|
|
98
47
|
|
|
99
48
|
```bash
|
package/package.json
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bimdata/bcf-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
|
-
"vue2-plugin.js",
|
|
7
6
|
"vue3-plugin.js"
|
|
8
7
|
],
|
|
9
|
-
"main": "./dist/
|
|
10
|
-
"module": "./dist/
|
|
8
|
+
"main": "./dist/bcf-components.mjs",
|
|
9
|
+
"module": "./dist/bcf-components.mjs",
|
|
11
10
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"build:vue2": "vite build --config vue2-build.config.js",
|
|
14
|
-
"build:vue3": "vite build --config vue3-build.config.js",
|
|
15
|
-
"build": "npm run build:vue2 && npm run build:vue3",
|
|
11
|
+
"build": "vite build --config build.config.js",
|
|
16
12
|
"prepublishOnly": "npm run build",
|
|
17
13
|
"release": "semantic-release"
|
|
18
14
|
},
|
|
19
15
|
"peerDependencies": {
|
|
20
|
-
"vue": "^
|
|
16
|
+
"vue": "^3.0"
|
|
21
17
|
},
|
|
22
18
|
"devDependencies": {
|
|
23
19
|
"@bimdata/design-system": "2.0.0-rc.11",
|
|
24
20
|
"@bimdata/vite-plugin-libcss": "0.0.1",
|
|
25
|
-
"@rollup/plugin-replace": "^5.0.2",
|
|
26
21
|
"@semantic-release/changelog": "^6.0.3",
|
|
27
22
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
28
23
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -32,12 +27,9 @@
|
|
|
32
27
|
"@vitejs/plugin-vue": "^4.2.1",
|
|
33
28
|
"async": "^3.2.4",
|
|
34
29
|
"conventional-changelog-eslint": "^3.0.9",
|
|
35
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
36
30
|
"sass": "^1.62.1",
|
|
37
31
|
"semantic-release": "^21.0.2",
|
|
38
32
|
"vite": "^4.3.5",
|
|
39
|
-
"vite-plugin-
|
|
40
|
-
"vue-template-compiler": "^2.7.14",
|
|
41
|
-
"vue2": "npm:vue@^2.7.14"
|
|
33
|
+
"vite-plugin-static-copy": "^0.16.0"
|
|
42
34
|
}
|
|
43
35
|
}
|
package/vue3-plugin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
components,
|
|
2
3
|
createService,
|
|
3
4
|
setService,
|
|
4
|
-
|
|
5
|
-
} from "./dist/vue3/bcf-components.mjs";
|
|
5
|
+
} from "./dist/bcf-components.mjs";
|
|
6
6
|
import messages from "./dist/i18n/index.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -16,9 +16,7 @@ import messages from "./dist/i18n/index.js";
|
|
|
16
16
|
* {
|
|
17
17
|
* apiClient: Object,
|
|
18
18
|
* fetchUsers?: Promise,
|
|
19
|
-
* i18nPlugin
|
|
20
|
-
* includedComponents?: string[],
|
|
21
|
-
* excludedComponents?: string[],
|
|
19
|
+
* i18nPlugin?: Object,
|
|
22
20
|
* }
|
|
23
21
|
* }
|
|
24
22
|
*/
|
|
@@ -26,8 +24,6 @@ const pluginFactory = ({
|
|
|
26
24
|
apiClient,
|
|
27
25
|
fetchUsers,
|
|
28
26
|
i18nPlugin,
|
|
29
|
-
includedComponents = [],
|
|
30
|
-
excludedComponents = [],
|
|
31
27
|
} = {}) => {
|
|
32
28
|
return {
|
|
33
29
|
install(app) {
|
|
@@ -54,21 +50,9 @@ const pluginFactory = ({
|
|
|
54
50
|
);
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
Object.entries(components)
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
if (excludedComponents.includes(name)) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// Only register included components if any.
|
|
64
|
-
// Otherwise register all (non excluded) components.
|
|
65
|
-
if (
|
|
66
|
-
includedComponents.length === 0 ||
|
|
67
|
-
includedComponents.includes(name)
|
|
68
|
-
) {
|
|
69
|
-
app.component(name, component);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
53
|
+
Object.entries(components).forEach(([name, component]) => {
|
|
54
|
+
app.component(name, component);
|
|
55
|
+
});
|
|
72
56
|
},
|
|
73
57
|
};
|
|
74
58
|
};
|