@usecsv/vuejs 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/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@usecsv/vuejs",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/usecsv.ssr.js",
6
+ "browser": "dist/usecsv.esm.js",
7
+ "module": "dist/usecsv.esm.js",
8
+ "unpkg": "dist/usecsv.min.js",
9
+ "types": "dist/types/src/entry.esm.d.ts",
10
+ "files": [
11
+ "dist/*",
12
+ "src/**/*.vue"
13
+ ],
14
+ "sideEffects": false,
15
+ "scripts": {
16
+ "serve": "vue-cli-service help",
17
+ "lint": "eslint src --ext .ts,.vue",
18
+ "prebuild": "rimraf ./dist",
19
+ "build": "cross-env NODE_ENV=production rollup --config build/rollup.config.js",
20
+ "build:ssr": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format cjs",
21
+ "build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
22
+ "build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife",
23
+ "postbuild": "rimraf ./dist/types/dev ./dist/types/src/entry.d.ts",
24
+ "prepublishOnly": "yarn build"
25
+ },
26
+ "dependencies": {
27
+ "@semantic-release/changelog": "^6.0.1",
28
+ "@semantic-release/commit-analyzer": "^9.0.2",
29
+ "@semantic-release/git": "^10.0.1",
30
+ "@semantic-release/github": "^8.0.2",
31
+ "@semantic-release/release-notes-generator": "^10.0.3",
32
+ "@usecsv/js": "^0.1.0",
33
+ "semantic-release": "^19.0.2"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/core": "^7.14.6",
37
+ "@babel/preset-env": "^7.14.7",
38
+ "@babel/preset-typescript": "^7.14.5",
39
+ "@rollup/plugin-alias": "^3.1.2",
40
+ "@rollup/plugin-babel": "^5.3.0",
41
+ "@rollup/plugin-commonjs": "^14.0.0",
42
+ "@rollup/plugin-node-resolve": "^9.0.0",
43
+ "@rollup/plugin-replace": "^2.4.2",
44
+ "@rushstack/eslint-patch": "^1.1.0",
45
+ "@vue/cli-plugin-babel": "^4.5.15",
46
+ "@vue/cli-plugin-typescript": "^4.5.15",
47
+ "@vue/cli-service": "^4.5.15",
48
+ "@vue/eslint-config-typescript": "^10.0.0",
49
+ "@zerollup/ts-transform-paths": "^1.7.18",
50
+ "cross-env": "^7.0.3",
51
+ "eslint": "^8.9.0",
52
+ "eslint-plugin-vue": "^8.4.1",
53
+ "minimist": "^1.2.5",
54
+ "rimraf": "^3.0.2",
55
+ "rollup": "^2.52.8",
56
+ "rollup-plugin-terser": "^7.0.2",
57
+ "rollup-plugin-typescript2": "^0.30.0",
58
+ "rollup-plugin-vue": "^5.1.9",
59
+ "ttypescript": "^1.5.12",
60
+ "typescript": "^4.0.3",
61
+ "vue": "^2.6.14",
62
+ "vue-template-compiler": "^2.6.14"
63
+ },
64
+ "peerDependencies": {
65
+ "vue": "^2.6.14"
66
+ },
67
+ "engines": {
68
+ "node": ">=12"
69
+ }
70
+ }
package/src/usecsv.vue ADDED
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import Vue from "vue";
3
+ import useCsvPlugin from "@usecsv/js";
4
+
5
+ type UserObject = {
6
+ readonly userId: string;
7
+ };
8
+ interface IUsecsv {
9
+ importerKey: string;
10
+ user?: UserObject;
11
+ metadata: Record<string, string | number> | undefined;
12
+ }
13
+
14
+ export default /*#__PURE__*/ Vue.extend<{hasSlot:boolean},{onclick:()=>void,hasScopedSlot:()=>boolean},any,IUsecsv>({
15
+ name: "use-csv", // vue component name
16
+ data() {
17
+ return {
18
+ hasSlot: !!this.$slots.default,
19
+ };
20
+ },
21
+ methods: {
22
+ onclick(): void {
23
+ useCsvPlugin({
24
+ importerKey: this.importerKey,
25
+ user: this.importerKey,
26
+ metadata: this.metadata,
27
+ });
28
+ },
29
+ hasScopedSlot(): boolean {
30
+ console.log(this.$scopedSlots.default && this.$scopedSlots.default.name);
31
+ return (
32
+ (this.$scopedSlots.default && this.$scopedSlots.default.name) ===
33
+ "normalized"
34
+ );
35
+ },
36
+ },
37
+ });
38
+ </script>
39
+
40
+ <template>
41
+ <div class="usecsv">
42
+ <div v-if="hasScopedSlot()">
43
+ <slot :onclick="onclick"> open usecsv </slot>
44
+ </div>
45
+ <div v-else>
46
+ <button type="button" id="usecsv-button" @click="onclick">
47
+ <slot> open usecsv </slot>
48
+ </button>
49
+ </div>
50
+ </div>
51
+ </template>
52
+
53
+ <style scoped>
54
+ #usecsv-button {
55
+ background-color: #fff;
56
+ color: #000;
57
+ border: 2px solid #000;
58
+ border-radius: 6px;
59
+ padding: 10px 15px;
60
+ text-align: center;
61
+ font-size: 16px;
62
+ cursor: pointer;
63
+ }
64
+ </style>