nuxt-cap 0.1.0 → 0.1.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 +0 -7
- package/dist/module.json +1 -1
- package/dist/module.mjs +9 -1
- package/dist/runtime/components/Cap.d.vue.ts +1 -1
- package/dist/runtime/components/Cap.vue.d.ts +1 -1
- package/dist/runtime/composables/useCap.d.ts +2 -2
- package/dist/runtime/composables/useCap.js +1 -1
- package/dist/runtime/plugins/cap.d.ts +7 -3
- package/dist/runtime/plugins/cap.js +9 -6
- package/dist/runtime/types/Cap.d.ts +22 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,13 +70,6 @@ The component exposes four events:
|
|
|
70
70
|
|
|
71
71
|
```vue
|
|
72
72
|
<script setup lang="ts">
|
|
73
|
-
import type {
|
|
74
|
-
CapErrorEvent,
|
|
75
|
-
CapProgressEvent,
|
|
76
|
-
CapResetEvent,
|
|
77
|
-
CapSolveEvent,
|
|
78
|
-
} from '@cap.js/widget'
|
|
79
|
-
|
|
80
73
|
function onSolve(event: CapSolveEvent): void {
|
|
81
74
|
console.log('Solved:', event)
|
|
82
75
|
}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -10,7 +10,15 @@ const module$1 = defineNuxtModule({
|
|
|
10
10
|
addPlugin({ src: resolver.resolve("./runtime/plugins/cap"), mode: "client" });
|
|
11
11
|
addImports([
|
|
12
12
|
{ name: "useCap", from: resolver.resolve("./runtime/composables/useCap") },
|
|
13
|
-
{ name: "resetCap", from: resolver.resolve("./runtime/utils/resetCap") }
|
|
13
|
+
{ name: "resetCap", from: resolver.resolve("./runtime/utils/resetCap") },
|
|
14
|
+
{ name: "CapConfig", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
15
|
+
{ name: "CapInstance", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
16
|
+
{ name: "CapClass", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
17
|
+
{ name: "CapWidget", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
18
|
+
{ name: "CapErrorEvent", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
19
|
+
{ name: "CapProgressEvent", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
20
|
+
{ name: "CapResetEvent", from: resolver.resolve("./runtime/types/Cap.d"), type: true },
|
|
21
|
+
{ name: "CapSolveEvent", from: resolver.resolve("./runtime/types/Cap.d"), type: true }
|
|
14
22
|
]);
|
|
15
23
|
addComponent({
|
|
16
24
|
name: "Cap",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { CapErrorEvent, CapProgressEvent, CapResetEvent, CapSolveEvent } from '
|
|
2
|
+
import type { CapErrorEvent, CapProgressEvent, CapResetEvent, CapSolveEvent } from '../types/Cap.js';
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
workerCount: {
|
|
5
5
|
type: NumberConstructor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { CapErrorEvent, CapProgressEvent, CapResetEvent, CapSolveEvent } from '
|
|
2
|
+
import type { CapErrorEvent, CapProgressEvent, CapResetEvent, CapSolveEvent } from '../types/Cap.js';
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
workerCount: {
|
|
5
5
|
type: NumberConstructor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useCap(config?: CapConfig, el?: CapWidget):
|
|
1
|
+
import type { CapConfig, CapInstance, CapWidget } from '../types/Cap.js';
|
|
2
|
+
export declare function useCap(config?: CapConfig, el?: CapWidget): CapInstance | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useNuxtApp, useRuntimeConfig } from "#app";
|
|
2
2
|
export function useCap(config, el) {
|
|
3
|
-
if (!import.meta.client) return;
|
|
4
3
|
const { $cap } = useNuxtApp();
|
|
5
4
|
const { cap } = useRuntimeConfig().public;
|
|
5
|
+
if (!import.meta.client || !$cap) return;
|
|
6
6
|
const capInstance = new $cap({ apiEndpoint: cap?.apiEndpoint, ...config }, el);
|
|
7
7
|
return capInstance;
|
|
8
8
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { CapClass } from '../types/Cap.js';
|
|
2
|
+
import '@cap.js/widget';
|
|
3
|
+
declare global {
|
|
4
|
+
var Cap: CapClass;
|
|
5
|
+
}
|
|
2
6
|
declare const _default: import("nuxt/app").Plugin<{
|
|
3
|
-
cap: typeof
|
|
7
|
+
cap: typeof import("#imports").CapInstance;
|
|
4
8
|
}> & import("nuxt/app").ObjectPlugin<{
|
|
5
|
-
cap: typeof
|
|
9
|
+
cap: typeof import("#imports").CapInstance;
|
|
6
10
|
}>;
|
|
7
11
|
export default _default;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#imports";
|
|
2
|
-
import
|
|
3
|
-
export default defineNuxtPlugin(() =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import "@cap.js/widget";
|
|
3
|
+
export default defineNuxtPlugin(() => {
|
|
4
|
+
const { Cap } = globalThis;
|
|
5
|
+
return {
|
|
6
|
+
provide: {
|
|
7
|
+
cap: Cap
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CapConfig,
|
|
3
|
+
CapErrorEvent,
|
|
4
|
+
Cap as CapInstance,
|
|
5
|
+
CapProgressEvent,
|
|
6
|
+
CapResetEvent,
|
|
7
|
+
CapSolveEvent,
|
|
8
|
+
CapWidget,
|
|
9
|
+
} from '@cap.js/widget'
|
|
10
|
+
|
|
11
|
+
type CapClass = typeof CapInstance
|
|
12
|
+
|
|
13
|
+
export type {
|
|
14
|
+
CapConfig,
|
|
15
|
+
CapInstance,
|
|
16
|
+
CapClass,
|
|
17
|
+
CapWidget,
|
|
18
|
+
CapErrorEvent,
|
|
19
|
+
CapProgressEvent,
|
|
20
|
+
CapResetEvent,
|
|
21
|
+
CapSolveEvent,
|
|
22
|
+
}
|