@semi-kit/component 1.1.16
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 +29 -0
- package/lib/app-provider/index.d.ts +2 -0
- package/lib/app-provider/index.js +3 -0
- package/lib/app-provider-BqL9mg5B.js +20 -0
- package/lib/index-tMRpQGHd.d.ts +12 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +19 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# vue-components-starter
|
|
2
|
+
|
|
3
|
+
A starter for creating a Vue component library.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
- Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Run the playground:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run playground
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Run the unit tests:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run test
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Build the library:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run build
|
|
29
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineComponent, provide, toRef } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/app-provider/props.ts
|
|
4
|
+
const appProviderProps = { locale: String };
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/app-provider/index.tsx
|
|
8
|
+
var app_provider_default = /* @__PURE__ */ defineComponent({
|
|
9
|
+
name: "AppProvider",
|
|
10
|
+
props: appProviderProps,
|
|
11
|
+
setup(props, { slots }) {
|
|
12
|
+
provide("app-provider", { locale: toRef(props, "locale") });
|
|
13
|
+
return () => {
|
|
14
|
+
return slots.default?.();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { app_provider_default as t };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/app-provider/index.d.ts
|
|
4
|
+
declare const _default: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
5
|
+
readonly locale: StringConstructor;
|
|
6
|
+
}>, () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}>[] | undefined, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
9
|
+
readonly locale: StringConstructor;
|
|
10
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _default as t };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as _default } from "./index-tMRpQGHd.js";
|
|
2
|
+
import { Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/app-provider/type.d.ts
|
|
5
|
+
interface AppProviderContext {
|
|
6
|
+
locale: Ref<string | undefined>;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/_utils/get-provider.d.ts
|
|
10
|
+
declare function getAppProvider(): AppProviderContext;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _default as AppProvider, type AppProviderContext, getAppProvider };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as app_provider_default } from "./app-provider-BqL9mg5B.js";
|
|
2
|
+
import { getCurrentInstance, inject } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/_utils/get-provider.ts
|
|
5
|
+
let cachedProvider = null;
|
|
6
|
+
function getAppProvider() {
|
|
7
|
+
if (cachedProvider) return cachedProvider;
|
|
8
|
+
if (getCurrentInstance()) {
|
|
9
|
+
const provider = inject("app-provider");
|
|
10
|
+
if (provider) {
|
|
11
|
+
cachedProvider = provider;
|
|
12
|
+
return provider;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
throw new Error("No outer <AppProvider /> founded.");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { app_provider_default as AppProvider, getAppProvider };
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@semi-kit/component",
|
|
3
|
+
"version": "1.1.16",
|
|
4
|
+
"description": "Semi-Kit Component Library",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/author/library#readme",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/author/library/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/author/library.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "Author Name <author.name@mail.com>",
|
|
16
|
+
"files": [
|
|
17
|
+
"lib"
|
|
18
|
+
],
|
|
19
|
+
"main": "./lib/index.js",
|
|
20
|
+
"module": "./lib/index.js",
|
|
21
|
+
"types": "./lib/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./lib/index.js",
|
|
24
|
+
"./app-provider": "./lib/app-provider/index.js",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsdown",
|
|
32
|
+
"dev": "tsdown --watch",
|
|
33
|
+
"play": "vite",
|
|
34
|
+
"test": "vitest",
|
|
35
|
+
"typecheck": "vue-tsc --noEmit",
|
|
36
|
+
"release": "pnpm publish",
|
|
37
|
+
"prepublishOnly": "pnpm run build"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"vue": "^3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@css-render/plugin-bem": "catalog:",
|
|
44
|
+
"css-render": "catalog:"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@semi-kit/vars": "workspace:*",
|
|
48
|
+
"@types/node": "catalog:",
|
|
49
|
+
"@vitejs/plugin-vue": "catalog:",
|
|
50
|
+
"@vitejs/plugin-vue-jsx": "catalog:",
|
|
51
|
+
"bumpp": "catalog:",
|
|
52
|
+
"happy-dom": "catalog:",
|
|
53
|
+
"tsdown": "catalog:",
|
|
54
|
+
"typescript": "catalog:",
|
|
55
|
+
"vite": "catalog:",
|
|
56
|
+
"vue": "catalog:",
|
|
57
|
+
"vue-tsc": "catalog:"
|
|
58
|
+
}
|
|
59
|
+
}
|