@vesperjs/vue 0.1.2 → 0.1.4

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/index.d.mts CHANGED
@@ -6,7 +6,7 @@ import * as _nanostores_router0 from "@nanostores/router";
6
6
  import { Router, RouterConfig } from "@nanostores/router";
7
7
 
8
8
  //#region src/composables/backend/api/use-api-constants.d.ts
9
- declare function useApiConstants(): {
9
+ declare const useApiConstants: () => {
10
10
  baseURL: _vue_reactivity0.WritableComputedRef<string, string>;
11
11
  };
12
12
  //#endregion
@@ -97,11 +97,11 @@ interface Flash {
97
97
  }
98
98
  //#endregion
99
99
  //#region src/composables/backend/error/use-external-errors.d.ts
100
- declare function useExternalErrors<P extends string>({
100
+ declare const useExternalErrors: <P extends string>({
101
101
  flash
102
102
  }: {
103
103
  flash: Ref<Flash>;
104
- }): {
104
+ }) => {
105
105
  externalErrors: _vue_reactivity0.WritableComputedRef<Partial<Record<P, string[]>>, Partial<Record<P, string[]>>>;
106
106
  clearExternalErrors: () => void;
107
107
  isSuccess: () => boolean;
@@ -119,10 +119,10 @@ interface UseAlertCallerType {
119
119
  externalErrors?: Ref<ErrorMessages<string>>;
120
120
  clearAccount?: () => void;
121
121
  }
122
- declare function useAlert<BER extends object = BackendErrorResource>({
122
+ declare const useAlert: <BER extends object = BackendErrorResource>({
123
123
  flash,
124
124
  caller
125
- }: UseAlertOptions): {
125
+ }: UseAlertOptions) => {
126
126
  backendErrorInfo: Ref<BackendErrorInfo<BER>, BER>;
127
127
  setError: (error: FetchError<ErrorsResource<ErrorMessages<string>> | BER>, options?: {
128
128
  off?: boolean;
@@ -132,12 +132,12 @@ declare function useAlert<BER extends object = BackendErrorResource>({
132
132
  type UseAlertType = ReturnType<typeof useAlert>;
133
133
  //#endregion
134
134
  //#region src/composables/util/use-date.d.ts
135
- declare function useDate(): {
135
+ declare const useDate: () => {
136
136
  isValidDate: (str: string) => boolean;
137
137
  };
138
138
  //#endregion
139
139
  //#region src/composables/use-entity.d.ts
140
- declare function useEntity<M extends object, R extends object>(): {
140
+ declare const useEntity: <M extends object, R extends object>() => {
141
141
  create: ({
142
142
  from
143
143
  }: {
@@ -153,7 +153,7 @@ declare function useEntity<M extends object, R extends object>(): {
153
153
  };
154
154
  //#endregion
155
155
  //#region src/composables/use-flash.d.ts
156
- declare function useFlash(): {
156
+ declare const useFlash: () => {
157
157
  flash: _vue_reactivity0.Ref<{
158
158
  notice?: string | undefined;
159
159
  alert?: string | undefined;
@@ -21622,7 +21622,7 @@ declare const useLocale: () => {
21622
21622
  };
21623
21623
  //#endregion
21624
21624
  //#region src/composables/use-nano-route.d.ts
21625
- declare function useNanoRoute<T extends RouterConfig>(router: Router<T>): {
21625
+ declare const useNanoRoute: <T extends RouterConfig>(router: Router<T>) => {
21626
21626
  params: _nanostores_router0.ParamsFromConfig<T>[string] | _nanostores_router0.ParamsFromConfig<T>[number] | _nanostores_router0.ParamsFromConfig<T>[symbol] | undefined;
21627
21627
  query: Record<string, string> | undefined;
21628
21628
  path: string | undefined;
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ const $baseUrl = persistentAtom("baseURL", "");
7
7
  persistentAtom("timeZone", "");
8
8
  //#endregion
9
9
  //#region src/stores/use-base-url-store.ts
10
- function useBaseUrlStore() {
10
+ const useBaseUrlStore = function() {
11
11
  return { baseURL: computed({
12
12
  get() {
13
13
  return $baseUrl.get();
@@ -16,16 +16,16 @@ function useBaseUrlStore() {
16
16
  $baseUrl.set(value);
17
17
  }
18
18
  }) };
19
- }
19
+ };
20
20
  //#endregion
21
21
  //#region src/composables/backend/api/use-api-constants.ts
22
- function useApiConstants() {
22
+ const useApiConstants = function() {
23
23
  const { baseURL } = useBaseUrlStore();
24
24
  return { baseURL };
25
- }
25
+ };
26
26
  //#endregion
27
27
  //#region src/composables/backend/api/use-ofetch.ts
28
- const useOFetch = async (url, options) => {
28
+ const useOFetch = async function(url, options) {
29
29
  const pending = ref(true);
30
30
  const data = ref();
31
31
  const error = ref();
@@ -62,7 +62,7 @@ const i18n = createI18n({
62
62
  });
63
63
  //#endregion
64
64
  //#region src/composables/use-locale.ts
65
- const useLocale = () => {
65
+ const useLocale = function() {
66
66
  const { locale, availableLocales, fallbackLocale } = i18n.global;
67
67
  const autodetect = () => {
68
68
  const viewLocale = globalThis.navigator.languages[0];
@@ -75,7 +75,7 @@ const useLocale = () => {
75
75
  };
76
76
  //#endregion
77
77
  //#region src/composables/backend/api/use-http-headers.ts
78
- const useHttpHeaders = () => {
78
+ const useHttpHeaders = function() {
79
79
  const { locale } = useLocale();
80
80
  return { commonHeaders: computed(() => ({
81
81
  "X-Requested-With": "XMLHttpRequest",
@@ -85,7 +85,7 @@ const useHttpHeaders = () => {
85
85
  };
86
86
  //#endregion
87
87
  //#region src/composables/backend/api/use-query-api.ts
88
- const useQueryApi = async (url, options) => {
88
+ const useQueryApi = async function(url, options) {
89
89
  const { commonHeaders } = useHttpHeaders();
90
90
  const { baseURL } = useApiConstants();
91
91
  const tokenRef = ref();
@@ -116,7 +116,7 @@ const useQueryApi = async (url, options) => {
116
116
  };
117
117
  //#endregion
118
118
  //#region src/composables/backend/api/use-mutation-api.ts
119
- const useMutationApi = async (url, { method, body = {}, token = null, onRequestError, onResponseError }) => {
119
+ const useMutationApi = async function(url, { method, body = {}, token = null, onRequestError, onResponseError }) {
120
120
  const { commonHeaders } = useHttpHeaders();
121
121
  const { baseURL } = useApiConstants();
122
122
  const headers = commonHeaders.value;
@@ -148,7 +148,7 @@ const useMutationApi = async (url, { method, body = {}, token = null, onRequestE
148
148
  };
149
149
  //#endregion
150
150
  //#region src/composables/backend/error/use-external-errors.ts
151
- function useExternalErrors({ flash }) {
151
+ const useExternalErrors = function({ flash }) {
152
152
  const errors = ref({});
153
153
  const externalErrors = computed({
154
154
  get() {
@@ -172,10 +172,10 @@ function useExternalErrors({ flash }) {
172
172
  clearExternalErrors,
173
173
  isSuccess
174
174
  };
175
- }
175
+ };
176
176
  //#endregion
177
177
  //#region src/composables/backend/error/use-backend-error-info.ts
178
- function useBackendErrorInfo() {
178
+ const useBackendErrorInfo = function() {
179
179
  const info = ref({});
180
180
  const backendErrorInfo = computed(() => {
181
181
  return info.value;
@@ -187,10 +187,10 @@ function useBackendErrorInfo() {
187
187
  backendErrorInfo,
188
188
  clearBackendErrorInfo
189
189
  };
190
- }
190
+ };
191
191
  //#endregion
192
192
  //#region src/composables/backend/use-alert.ts
193
- function useAlert({ flash, caller }) {
193
+ const useAlert = function({ flash, caller }) {
194
194
  const { backendErrorInfo, clearBackendErrorInfo } = useBackendErrorInfo();
195
195
  const setError = function(error, options) {
196
196
  const off = options?.off ?? false;
@@ -231,18 +231,18 @@ function useAlert({ flash, caller }) {
231
231
  setError,
232
232
  reload
233
233
  };
234
- }
234
+ };
235
235
  //#endregion
236
236
  //#region src/composables/util/use-date.ts
237
- function useDate() {
237
+ const useDate = function() {
238
238
  const isValidDate = (str) => {
239
239
  return !!str && !!str.match(/\d{4}\/\d{2}\/\d{2}/) && !isNaN(Date.parse(str));
240
240
  };
241
241
  return { isValidDate };
242
- }
242
+ };
243
243
  //#endregion
244
244
  //#region src/composables/use-entity.ts
245
- function useEntity() {
245
+ const useEntity = function() {
246
246
  const create = ({ from }) => {
247
247
  const model = {};
248
248
  Object.assign(model, from);
@@ -255,10 +255,10 @@ function useEntity() {
255
255
  create,
256
256
  copy
257
257
  };
258
- }
258
+ };
259
259
  //#endregion
260
260
  //#region src/composables/use-flash.ts
261
- function useFlash() {
261
+ const useFlash = function() {
262
262
  const flash = ref({});
263
263
  const clearFlash = () => {
264
264
  flash.value = {};
@@ -267,16 +267,16 @@ function useFlash() {
267
267
  flash,
268
268
  clearFlash
269
269
  };
270
- }
270
+ };
271
271
  //#endregion
272
272
  //#region src/composables/use-nano-route.ts
273
- function useNanoRoute(router) {
273
+ const useNanoRoute = function(router) {
274
274
  const page = router.get();
275
275
  return {
276
276
  params: page?.params,
277
277
  query: page?.search,
278
278
  path: page?.path
279
279
  };
280
- }
280
+ };
281
281
  //#endregion
282
282
  export { i18n, useAlert, useApiConstants, useDate, useEntity, useExternalErrors, useFlash, useLocale, useMutationApi, useNanoRoute, useOFetch, useQueryApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesperjs/vue",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "keywords": [
5
5
  "vue.js"
6
6
  ],
@@ -29,6 +29,7 @@
29
29
  "vue-i18n": "11.3.0"
30
30
  },
31
31
  "devDependencies": {
32
+ "@eslint/js": "^9.39.4",
32
33
  "@typescript-eslint/eslint-plugin": "^8.57.0",
33
34
  "@typescript-eslint/parser": "^8.57.0",
34
35
  "@vue/eslint-config-typescript": "^14.7.0",