@merkaly/nuxt 0.4.0 → 0.4.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -4
- package/dist/runtime/components/format/FormatMoney.d.vue.ts +2 -2
- package/dist/runtime/components/format/FormatMoney.vue +12 -12
- package/dist/runtime/components/format/FormatMoney.vue.d.ts +2 -2
- package/dist/runtime/components/input/InputMoney.d.vue.ts +1 -1
- package/dist/runtime/components/input/InputMoney.vue.d.ts +1 -1
- package/dist/runtime/composables/useMoney.d.ts +7 -0
- package/dist/runtime/composables/useMoney.js +10 -0
- package/dist/runtime/utils/formatMoney.d.ts +7 -0
- package/dist/runtime/utils/formatMoney.js +6 -0
- package/package.json +6 -6
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -51,10 +51,7 @@ const module = defineNuxtModule({
|
|
|
51
51
|
const bootstrapConfigPath = rootResolver.resolve("bootstrap.config.ts");
|
|
52
52
|
logger.info(`Loading bootstrap.config.ts from: ${bootstrapConfigPath} (exists: ${existsSync(bootstrapConfigPath)})`);
|
|
53
53
|
const jiti = createJiti(import.meta.url);
|
|
54
|
-
const BootstrapConfig = await jiti.import(bootstrapConfigPath).then((m) => m.default || {}).catch((
|
|
55
|
-
logger.error(`Failed to load bootstrap.config.ts:`, err.message);
|
|
56
|
-
return {};
|
|
57
|
-
});
|
|
54
|
+
const BootstrapConfig = await jiti.import(bootstrapConfigPath).then((m) => m.default || {}).catch(() => ({}));
|
|
58
55
|
logger.info(`Bootstrap config keys: ${Object.keys(BootstrapConfig).join(", ") || "(empty)"}`);
|
|
59
56
|
nuxt.options["bootstrapVueNext"] = defu(nuxt.options["bootstrapVueNext"] || {}, { plugin: { components: BootstrapConfig } });
|
|
60
57
|
addPlugin({ src: moduleResolver.resolve("./runtime/plugins/api.global") });
|
|
@@ -61,10 +61,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
61
61
|
mode: keyof Intl.NumberFormatOptionsStyleRegistry;
|
|
62
62
|
base: number;
|
|
63
63
|
tag: string;
|
|
64
|
+
value: number;
|
|
64
65
|
currency: string;
|
|
65
|
-
hideDecimal: boolean;
|
|
66
66
|
locale: string;
|
|
67
|
-
|
|
67
|
+
hideDecimal: boolean;
|
|
68
68
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
69
69
|
declare const _default: typeof __VLS_export;
|
|
70
70
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
+
import { useMoney } from "../../composables/useMoney";
|
|
3
4
|
const props = defineProps({
|
|
4
5
|
base: { type: Number, default: 100 },
|
|
5
6
|
currency: { type: String, default: () => "USD" },
|
|
@@ -9,24 +10,23 @@ const props = defineProps({
|
|
|
9
10
|
tag: { type: String, default: "span" },
|
|
10
11
|
value: { type: Number, default: 0 }
|
|
11
12
|
});
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
return {
|
|
19
|
-
currency: money[0],
|
|
20
|
-
value: money.slice(1, -3),
|
|
21
|
-
digits: money.slice(-3)
|
|
22
|
-
};
|
|
13
|
+
const money = useMoney(() => props.value, {
|
|
14
|
+
base: () => props.base,
|
|
15
|
+
currency: () => props.currency,
|
|
16
|
+
locale: () => props.locale,
|
|
17
|
+
mode: () => props.mode
|
|
23
18
|
});
|
|
19
|
+
const price = computed(() => ({
|
|
20
|
+
currency: money.value[0],
|
|
21
|
+
amount: money.value.slice(1, -3),
|
|
22
|
+
digits: money.value.slice(-3)
|
|
23
|
+
}));
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<template>
|
|
27
27
|
<component :is="tag" class="format-money">
|
|
28
28
|
<span class="currency" v-text="price.currency" />
|
|
29
|
-
<span class="value" v-text="price.
|
|
29
|
+
<span class="value" v-text="price.amount" />
|
|
30
30
|
<sup v-if="!props.hideDecimal" class="digits" v-text="price.digits" />
|
|
31
31
|
</component>
|
|
32
32
|
</template>
|
|
@@ -61,10 +61,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
61
61
|
mode: keyof Intl.NumberFormatOptionsStyleRegistry;
|
|
62
62
|
base: number;
|
|
63
63
|
tag: string;
|
|
64
|
+
value: number;
|
|
64
65
|
currency: string;
|
|
65
|
-
hideDecimal: boolean;
|
|
66
66
|
locale: string;
|
|
67
|
-
|
|
67
|
+
hideDecimal: boolean;
|
|
68
68
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
69
69
|
declare const _default: typeof __VLS_export;
|
|
70
70
|
export default _default;
|
|
@@ -77,8 +77,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
min: number;
|
|
78
78
|
max: number;
|
|
79
79
|
prefix: string;
|
|
80
|
-
decimal: string;
|
|
81
80
|
placeholder: string;
|
|
81
|
+
decimal: string;
|
|
82
82
|
precision: number;
|
|
83
83
|
suffix: string;
|
|
84
84
|
thousands: string;
|
|
@@ -77,8 +77,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
min: number;
|
|
78
78
|
max: number;
|
|
79
79
|
prefix: string;
|
|
80
|
-
decimal: string;
|
|
81
80
|
placeholder: string;
|
|
81
|
+
decimal: string;
|
|
82
82
|
precision: number;
|
|
83
83
|
suffix: string;
|
|
84
84
|
thousands: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { FormatMoneyOptions } from '../utils/formatMoney.js';
|
|
3
|
+
type UseMoneyOptions = {
|
|
4
|
+
[K in keyof FormatMoneyOptions]: MaybeRefOrGetter<FormatMoneyOptions[K]>;
|
|
5
|
+
};
|
|
6
|
+
export declare function useMoney(value: MaybeRefOrGetter<number>, options?: Partial<UseMoneyOptions>): import("vue").ComputedRef<string>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { computed, toValue } from "vue";
|
|
2
|
+
import { formatMoney } from "../utils/formatMoney.js";
|
|
3
|
+
export function useMoney(value, options = {}) {
|
|
4
|
+
return computed(() => formatMoney(toValue(value), {
|
|
5
|
+
base: toValue(options.base),
|
|
6
|
+
currency: toValue(options.currency),
|
|
7
|
+
locale: toValue(options.locale),
|
|
8
|
+
mode: toValue(options.mode)
|
|
9
|
+
}));
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/merkaly-io/nuxt.git"
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@auth0/auth0-spa-js": "^2.15.0",
|
|
46
46
|
"@bootstrap-vue-next/nuxt": "^0.43.0",
|
|
47
47
|
"@nuxt/devtools": "^3.2.1",
|
|
48
|
-
"@nuxt/eslint": "1.
|
|
49
|
-
"@nuxt/eslint-config": "^1.
|
|
50
|
-
"@nuxt/fonts": "0.
|
|
48
|
+
"@nuxt/eslint": "1.15.1",
|
|
49
|
+
"@nuxt/eslint-config": "^1.15.1",
|
|
50
|
+
"@nuxt/fonts": "0.14.0",
|
|
51
51
|
"@nuxt/image": "^2.0.0",
|
|
52
52
|
"@nuxt/kit": "^4.3.0",
|
|
53
|
-
"@nuxtjs/plausible": "^
|
|
53
|
+
"@nuxtjs/plausible": "^3.0.1",
|
|
54
54
|
"@types/node": "latest",
|
|
55
55
|
"@types/vue-select": "^3.16.8",
|
|
56
56
|
"@vueuse/components": "^14.2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@nuxt/module-builder": "^1.0.2",
|
|
79
79
|
"@nuxt/schema": "^4.3.0",
|
|
80
|
-
"@nuxt/test-utils": "^
|
|
80
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
81
81
|
"changelogen": "^0.6.2",
|
|
82
82
|
"eslint-plugin-storybook": "^10.1.11",
|
|
83
83
|
"vitest": "^4.0.6",
|