oc-template-vue-compiler 0.0.1
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/lib/compile.d.ts +1 -0
- package/dist/lib/compile.js +15 -0
- package/dist/lib/solidOCProviderTemplate.d.ts +3 -0
- package/dist/lib/solidOCProviderTemplate.js +57 -0
- package/dist/lib/vueOCProviderTemplate.d.ts +3 -0
- package/dist/lib/vueOCProviderTemplate.js +53 -0
- package/dist/utils/useData.d.ts +7 -0
- package/dist/utils/useData.jsx +24 -0
- package/package.json +44 -0
- package/scaffold/src/package.json +43 -0
- package/scaffold/src/public/logo.png +0 -0
- package/scaffold/src/src/App.vue +62 -0
- package/scaffold/src/src/HelloWorld.vue +38 -0
- package/scaffold/src/src/oc-app.d.ts +1 -0
- package/scaffold/src/src/server.ts +36 -0
- package/scaffold/src/src/setupTests.js +1 -0
- package/scaffold/src/src/styles.css +30 -0
- package/scaffold/src/src/types.ts +15 -0
- package/scaffold/src/tsconfig.json +26 -0
- package/scaffold/src/vite.config.ts +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 OpenComponents community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./lib/compile"), exports);
|
|
18
|
+
__exportStar(require("oc-template-vue"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const compile: (options: import("oc-generic-template-compiler").CompilerOptions, callback: (err: Error | null, data: unknown) => void) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.compile = void 0;
|
|
7
|
+
const oc_template_vue_1 = require("oc-template-vue");
|
|
8
|
+
const plugin_vue_1 = __importDefault(require("@vitejs/plugin-vue"));
|
|
9
|
+
const oc_vite_compiler_1 = require("oc-vite-compiler");
|
|
10
|
+
const vueOCProviderTemplate_1 = __importDefault(require("./vueOCProviderTemplate"));
|
|
11
|
+
exports.compile = (0, oc_vite_compiler_1.createCompile)({
|
|
12
|
+
plugins: [(0, plugin_vue_1.default)()],
|
|
13
|
+
viewWrapper: vueOCProviderTemplate_1.default,
|
|
14
|
+
getInfo: oc_template_vue_1.getInfo
|
|
15
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const removeExtension = (path) => path.replace(/\.(t|j)sx?$/, '');
|
|
4
|
+
function solidOCProviderTemplate({ viewPath }) {
|
|
5
|
+
return `
|
|
6
|
+
import { render } from 'solid-js/web';
|
|
7
|
+
import View from '${removeExtension(viewPath)}';
|
|
8
|
+
import { DataProvider } from 'oc-template-solid-compiler/dist/utils/useData'
|
|
9
|
+
|
|
10
|
+
function OCProvider(props: any): any {
|
|
11
|
+
const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = props;
|
|
12
|
+
|
|
13
|
+
(window as any).oc.events.fire('oc:componentDidMount', rest);
|
|
14
|
+
|
|
15
|
+
function getData(providerProps: any, parameters: any, cb: (error: any, parameters?: any, props?: any) => void) {
|
|
16
|
+
return (window as any).oc.getData({
|
|
17
|
+
name: providerProps._componentName,
|
|
18
|
+
version: providerProps._componentVersion,
|
|
19
|
+
baseUrl: providerProps._baseUrl,
|
|
20
|
+
parameters
|
|
21
|
+
}, (err: any, data: any) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
return cb(err);
|
|
24
|
+
}
|
|
25
|
+
const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = (data.component.props as any);
|
|
26
|
+
cb(null, rest, data.component.props);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getSetting(providerProps: any, setting: string) {
|
|
31
|
+
const settingHash = {
|
|
32
|
+
name: providerProps._componentName,
|
|
33
|
+
version: providerProps._componentVersion,
|
|
34
|
+
baseUrl: providerProps._baseUrl,
|
|
35
|
+
staticPath: providerProps._staticPath
|
|
36
|
+
};
|
|
37
|
+
return (settingHash as any)[setting];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(rest as any).getData = (parameters: any, cb: (error: any, parameters?: any, props?: any) => void) => getData(props, parameters, cb);
|
|
41
|
+
(rest as any).getSetting = (setting: string) => getSetting(props, setting);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<DataProvider value={{...rest}}>
|
|
45
|
+
<View { ...rest } />
|
|
46
|
+
</DataProvider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function renderer(props, element) {
|
|
51
|
+
render(() => <OCProvider {...props} />, element);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default renderer;
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
exports.default = solidOCProviderTemplate;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function vueOCProviderTemplate({ viewPath }) {
|
|
4
|
+
return `
|
|
5
|
+
import { createApp } from 'vue'
|
|
6
|
+
import View from '${viewPath}';
|
|
7
|
+
|
|
8
|
+
function getDataCb(providerProps, parameters, cb) {
|
|
9
|
+
return window.oc.getData({
|
|
10
|
+
name: providerProps._componentName,
|
|
11
|
+
version: providerProps._componentVersion,
|
|
12
|
+
baseUrl: providerProps._baseUrl,
|
|
13
|
+
parameters
|
|
14
|
+
}, (err, data) => {
|
|
15
|
+
if (err) {
|
|
16
|
+
return cb(err);
|
|
17
|
+
}
|
|
18
|
+
const { _staticPath, _baseUrl, _componentName, _componentVersion, ...rest } = data.component.props;
|
|
19
|
+
cb(null, rest, data.component.props);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getSetting(providerProps, setting) {
|
|
24
|
+
const settingHash = {
|
|
25
|
+
name: providerProps._componentName,
|
|
26
|
+
version: providerProps._componentVersion,
|
|
27
|
+
baseUrl: providerProps._baseUrl,
|
|
28
|
+
staticPath: providerProps._staticPath
|
|
29
|
+
};
|
|
30
|
+
return settingHash[setting];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function renderer(props, element, ssr) {
|
|
35
|
+
function getData(params) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
getDataCb(props, params, (err, data) => {
|
|
38
|
+
if (err) {
|
|
39
|
+
return reject(err);
|
|
40
|
+
}
|
|
41
|
+
resolve(data);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
props.getData = getData;
|
|
46
|
+
props.getSetting = (setting) => getSetting(props, setting);
|
|
47
|
+
createApp(View, props).mount(element, ssr);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default renderer;
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
exports.default = vueOCProviderTemplate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type PromiseData<T = any> = T & {
|
|
2
|
+
getData<O = any>(parameters?: Partial<T>): Promise<O>;
|
|
3
|
+
getSetting(setting: 'name' | 'version' | 'baseUrl' | 'staticPath'): string;
|
|
4
|
+
};
|
|
5
|
+
export declare const DataProvider: (props: any) => import("solid-js").JSX.Element;
|
|
6
|
+
export declare function useData<T = any>(): PromiseData<T>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createContext, useContext } from 'solid-js';
|
|
2
|
+
const DataContext = createContext({});
|
|
3
|
+
export const DataProvider = (props) => {
|
|
4
|
+
// @ts-ignore children props
|
|
5
|
+
return <DataContext.Provider value={props.value}>{props.children}</DataContext.Provider>;
|
|
6
|
+
};
|
|
7
|
+
export function useData() {
|
|
8
|
+
const { getData, ...rest } = useContext(DataContext);
|
|
9
|
+
function asyncGetData(data) {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
getData({ ...rest, ...data }, (err, newData) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
reject(err);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolve(newData);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
return { getData: asyncGetData, ...rest };
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "oc-template-vue-compiler",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Compiler for the vueJS OC template",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepare": "npm run build",
|
|
10
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/opencomponents/vite-templates.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/opencomponents/vite-templates/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/opencomponents/vite-templates#readme",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"oc",
|
|
22
|
+
"opencomponents",
|
|
23
|
+
"vuejs",
|
|
24
|
+
"oc-template"
|
|
25
|
+
],
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Ricardo Devis Agullo",
|
|
28
|
+
"email": "mkredz@gmail.com"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
33
|
+
"oc-template-vue": "^0.0.1",
|
|
34
|
+
"oc-vite-compiler": "^3.2.0"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/**",
|
|
38
|
+
"scaffold"
|
|
39
|
+
],
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"prettier": "^2.3.2",
|
|
42
|
+
"prettier-config-guestline": "2.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "base-component-solid",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lint": "eslint --max-warnings 0 --ext .js,.jsx,.ts,.tsx src",
|
|
7
|
+
"build": "tsc --noEmit && oc package .",
|
|
8
|
+
"test": "vitest"
|
|
9
|
+
},
|
|
10
|
+
"oc": {
|
|
11
|
+
"files": {
|
|
12
|
+
"data": "src/server.ts",
|
|
13
|
+
"template": {
|
|
14
|
+
"src": "src/App.vue",
|
|
15
|
+
"type": "oc-template-vue"
|
|
16
|
+
},
|
|
17
|
+
"static": [
|
|
18
|
+
"public"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"parameters": {
|
|
22
|
+
"userId": {
|
|
23
|
+
"default": 1,
|
|
24
|
+
"description": "The user id from the user database",
|
|
25
|
+
"example": 1,
|
|
26
|
+
"mandatory": true,
|
|
27
|
+
"type": "number"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
33
|
+
"@types/testing-library__jest-dom": "^5.14.5",
|
|
34
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
35
|
+
"jsdom": "^21.1.1",
|
|
36
|
+
"oc-server": "*",
|
|
37
|
+
"oc-template-vue-compiler": "*",
|
|
38
|
+
"typescript": "5.0.2",
|
|
39
|
+
"vitest": "^0.29.7",
|
|
40
|
+
"vue": "^3.3.11",
|
|
41
|
+
"vue-tsc": "^1.8.25"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import logo from '../public/logo.png';
|
|
4
|
+
import { serverClient, ActionOutput } from 'oc-server'
|
|
5
|
+
const props = defineProps<{ userId: number, firstName: string, lastName: string }>()
|
|
6
|
+
|
|
7
|
+
const additionalData = ref<ActionOutput<'getMoreData'> | null>(null);
|
|
8
|
+
async function getAdditionalData() {
|
|
9
|
+
additionalData.value = await serverClient.getMoreData({ userId: props.userId });
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div className="container">
|
|
15
|
+
<img width="50" height="50" v-bind:src="logo" alt="Logo" />
|
|
16
|
+
|
|
17
|
+
<h1>
|
|
18
|
+
Hello, <span>{{ firstName }}</span> {{ lastName }}
|
|
19
|
+
</h1>
|
|
20
|
+
<div className={styles.info} v-if="additionalData">
|
|
21
|
+
<div className={styles.block}>Age: {{ additionalData.age }}</div>
|
|
22
|
+
<div className={styles.block}>
|
|
23
|
+
Hobbies:
|
|
24
|
+
<span v-for="hobby in additionalData.hobbies" :key="hobby">
|
|
25
|
+
{{ hobby.toLowerCase() }}
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<button className="button" @click="getAdditionalData">
|
|
30
|
+
Get extra information
|
|
31
|
+
</button>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
.container {
|
|
37
|
+
background-color: #3b246c;
|
|
38
|
+
color: #fff;
|
|
39
|
+
font-family: sans-serif;
|
|
40
|
+
padding: 40px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.button {
|
|
44
|
+
background-color: #a97613;
|
|
45
|
+
border: none;
|
|
46
|
+
padding: 15px 32px;
|
|
47
|
+
text-align: center;
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
display: inline-block;
|
|
51
|
+
color: inherit;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
h1 {
|
|
56
|
+
margin: 0 0 20px 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
span {
|
|
60
|
+
text-decoration: underline;
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{ msg: string }>()
|
|
5
|
+
|
|
6
|
+
const count = ref(0)
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<h1>{{ msg }}</h1>
|
|
11
|
+
|
|
12
|
+
<div class="card">
|
|
13
|
+
<button type="button" @click="count++">count is {{ count }}</button>
|
|
14
|
+
<p>
|
|
15
|
+
Edit
|
|
16
|
+
<code>components/HelloWorld.vue</code> to test HMR
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<p>
|
|
21
|
+
Check out
|
|
22
|
+
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
|
23
|
+
>create-vue</a
|
|
24
|
+
>, the official Vue + Vite starter
|
|
25
|
+
</p>
|
|
26
|
+
<p>
|
|
27
|
+
Install
|
|
28
|
+
<a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
|
|
29
|
+
in your IDE for a better DX
|
|
30
|
+
</p>
|
|
31
|
+
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
.read-the-docs {
|
|
36
|
+
color: #888;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="oc-vite/client" />
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Server } from 'oc-server';
|
|
2
|
+
import { ClientProps, OcParameters } from './types';
|
|
3
|
+
|
|
4
|
+
const database = [
|
|
5
|
+
{ name: 'John Doe', age: 34, hobbies: ['Swimming', 'Basketball'] },
|
|
6
|
+
{ name: 'Jane Doe', age: 35, hobbies: ['Running', 'Rugby'] }
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
async function getUser(userId: number) {
|
|
10
|
+
return database[userId];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const server = new Server(async (params: OcParameters): Promise<ClientProps> => {
|
|
14
|
+
const { userId } = params;
|
|
15
|
+
const user = await getUser(userId);
|
|
16
|
+
|
|
17
|
+
const [firstName, lastName] = user.name.split(/\s+/);
|
|
18
|
+
return {
|
|
19
|
+
userId,
|
|
20
|
+
firstName,
|
|
21
|
+
lastName
|
|
22
|
+
};
|
|
23
|
+
}).action('getMoreData', async (params: OcParameters) => {
|
|
24
|
+
const { userId } = params;
|
|
25
|
+
const user = await getUser(userId);
|
|
26
|
+
return {
|
|
27
|
+
age: user.age,
|
|
28
|
+
hobbies: user.hobbies
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
declare module 'oc-server' {
|
|
33
|
+
interface Register {
|
|
34
|
+
server: typeof server;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
background-color: #3b246c;
|
|
3
|
+
color: #fff;
|
|
4
|
+
font-family: sans-serif;
|
|
5
|
+
padding: 40px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.button {
|
|
9
|
+
background-color: #a97613;
|
|
10
|
+
border: none;
|
|
11
|
+
padding: 15px 32px;
|
|
12
|
+
text-align: center;
|
|
13
|
+
font-size: 16px;
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
color: inherit;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.info {
|
|
21
|
+
margin-bottom: 20px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.block {
|
|
25
|
+
margin: 6px 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.button:hover {
|
|
29
|
+
background-color: #c79535;
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface OcParameters {
|
|
2
|
+
userId: number;
|
|
3
|
+
getMoreData?: boolean;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface AdditionalData {
|
|
7
|
+
hobbies: string[];
|
|
8
|
+
age: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ClientProps extends Partial<AdditionalData> {
|
|
12
|
+
userId: number;
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// These are suggested values and will be set when not present in the
|
|
4
|
+
// tsconfig.json
|
|
5
|
+
// 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()
|
|
6
|
+
"target": "es5",
|
|
7
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"noFallthroughCasesInSwitch": true,
|
|
15
|
+
|
|
16
|
+
// These values are required and cannot be changed by the user
|
|
17
|
+
// Keep this in sync with the rollup config
|
|
18
|
+
"module": "esnext",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"isolatedModules": true,
|
|
22
|
+
"jsx": "preserve"
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
25
|
+
"exclude": ["src/_package"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
// https://vitejs.dev/config/
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
// Add your own plugins here for thinkgs like eslint or typecheckers
|
|
6
|
+
plugins: [],
|
|
7
|
+
// @ts-ignore Missing test property
|
|
8
|
+
test: {
|
|
9
|
+
environment: 'jsdom'
|
|
10
|
+
}
|
|
11
|
+
});
|