@userfrosting/sprinkle-core 6.0.0-beta.7 → 6.0.0-rc.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.
Files changed (67) hide show
  1. package/README.md +27 -46
  2. package/dist/Page401Unauthorized-D_EoXicK.js +11 -0
  3. package/dist/Page403Forbidden-C96BgRtx.js +11 -0
  4. package/dist/Page404NotFound-CIs-2Fy2.js +11 -0
  5. package/dist/PageError-Sk-QAv9A.js +11 -0
  6. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  7. package/dist/composables/index.d.ts +4 -0
  8. package/dist/composables/useAxiosInterceptor.d.ts +10 -0
  9. package/dist/composables/useCsrf.d.ts +18 -0
  10. package/dist/composables/useRuleSchemaAdapter.d.ts +7 -0
  11. package/dist/composables/useSprunjer.d.ts +2 -0
  12. package/dist/composables.js +151 -0
  13. package/dist/index.d.ts +18 -0
  14. package/dist/index.js +15 -0
  15. package/{app/assets/interfaces/ApiResponse.ts → dist/interfaces/ApiResponse.d.ts} +5 -6
  16. package/{app/assets/interfaces/DictionaryApi.ts → dist/interfaces/DictionaryApi.d.ts} +9 -11
  17. package/dist/interfaces/alerts.d.ts +8 -0
  18. package/{app/assets/interfaces/common.ts → dist/interfaces/common.d.ts} +1 -1
  19. package/dist/interfaces/index.d.ts +13 -0
  20. package/{app/assets/interfaces/severity.ts → dist/interfaces/severity.d.ts} +9 -9
  21. package/dist/interfaces/sprunjer.d.ts +51 -0
  22. package/{app/assets/interfaces/sprunjerApi.ts → dist/interfaces/sprunjerApi.d.ts} +12 -15
  23. package/dist/interfaces.js +5 -0
  24. package/dist/routes/index.d.ts +16 -0
  25. package/dist/routes.js +41 -0
  26. package/dist/severity-DwLpzIij.js +4 -0
  27. package/{app/assets/stores/Helpers/PluralRules.ts → dist/stores/Helpers/PluralRules.d.ts} +17 -114
  28. package/dist/stores/index.d.ts +4 -0
  29. package/dist/stores/useAlertsStore.d.ts +29 -0
  30. package/dist/stores/useConfigStore.d.ts +11 -0
  31. package/dist/stores/usePageMeta.d.ts +51 -0
  32. package/dist/stores/useTranslator.d.ts +66 -0
  33. package/dist/stores.js +7 -0
  34. package/dist/useAlertsStore-Ca6nXz8C.js +179 -0
  35. package/dist/useAxiosInterceptor-DcOpTLHG.js +68 -0
  36. package/dist/views/Page401Unauthorized.vue.d.ts +2 -0
  37. package/dist/views/Page403Forbidden.vue.d.ts +2 -0
  38. package/dist/views/Page404NotFound.vue.d.ts +2 -0
  39. package/dist/views/PageError.vue.d.ts +2 -0
  40. package/package.json +37 -9
  41. package/app/assets/composables/index.ts +0 -4
  42. package/app/assets/composables/useAxiosInterceptor.ts +0 -30
  43. package/app/assets/composables/useCsrf.ts +0 -129
  44. package/app/assets/composables/useRuleSchemaAdapter.ts +0 -205
  45. package/app/assets/composables/useSprunjer.ts +0 -188
  46. package/app/assets/index.d.ts +0 -8
  47. package/app/assets/index.ts +0 -40
  48. package/app/assets/interfaces/alerts.ts +0 -16
  49. package/app/assets/interfaces/index.ts +0 -30
  50. package/app/assets/interfaces/sprunjer.ts +0 -60
  51. package/app/assets/routes/index.ts +0 -44
  52. package/app/assets/stores/index.ts +0 -4
  53. package/app/assets/stores/useAlertsStore.ts +0 -30
  54. package/app/assets/stores/useConfigStore.ts +0 -30
  55. package/app/assets/stores/usePageMeta.ts +0 -114
  56. package/app/assets/stores/useTranslator.ts +0 -293
  57. package/app/assets/tests/composables/useCsrf.test.ts +0 -212
  58. package/app/assets/tests/composables/useRuleSchemaAdapter.test.ts +0 -657
  59. package/app/assets/tests/interfaces/alerts.test.ts +0 -43
  60. package/app/assets/tests/plugin.test.ts +0 -29
  61. package/app/assets/tests/stores/Helpers/PluralRules.test.ts +0 -440
  62. package/app/assets/tests/stores/config.test.ts +0 -42
  63. package/app/assets/tests/stores/useTranslator.test.ts +0 -373
  64. package/app/assets/views/Page401Unauthorized.vue +0 -3
  65. package/app/assets/views/Page403Forbidden.vue +0 -3
  66. package/app/assets/views/Page404NotFound.vue +0 -3
  67. package/app/assets/views/PageError.vue +0 -3
package/README.md CHANGED
@@ -1,21 +1,34 @@
1
- # UserFrosting 5.2 Core Sprinkle
2
-
3
- [![Version](https://img.shields.io/github/v/release/userfrosting/sprinkle-core?include_prereleases)](https://github.com/userfrosting/sprinkle-core/releases)
4
- ![PHP Version](https://img.shields.io/badge/php-%5E8.1-brightgreen)
5
- [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
6
- [![Build](https://img.shields.io/github/actions/workflow/status/userfrosting/sprinkle-core/Build.yml?branch=5.2&logo=github)](https://github.com/userfrosting/sprinkle-core/actions)
7
- [![Codecov](https://codecov.io/gh/userfrosting/sprinkle-core/branch/5.2/graph/badge.svg)](https://app.codecov.io/gh/userfrosting/sprinkle-core/branch/5.2)
8
- [![StyleCI](https://github.styleci.io/repos/372359383/shield?branch=5.2&style=flat)](https://github.styleci.io/repos/372359383)
9
- [![PHPStan](https://img.shields.io/github/actions/workflow/status/userfrosting/sprinkle-core/PHPStan.yml?branch=5.2&label=PHPStan)](https://github.com/userfrosting/sprinkle-core/actions/workflows/PHPStan.yml)
10
- [![Join the chat](https://img.shields.io/badge/Chat-UserFrosting-brightgreen?logo=Rocket.Chat)](https://chat.userfrosting.com)
11
- [![Donate](https://img.shields.io/badge/Open_Collective-Donate-blue?logo=Open%20Collective)](https://opencollective.com/userfrosting#backer)
12
- [![Donate](https://img.shields.io/badge/Ko--fi-Donate-blue?logo=ko-fi&logoColor=white)](https://ko-fi.com/lcharette)
1
+ # UserFrosting 6.0 - Core Sprinkle
2
+
3
+ [![][UF6-CO-VER-I]][UF6-CO-VER-L]
4
+ [![][UF6-CO-NPM-I]][UF6-CO-NPM-L]
5
+ [![][UF6-LIS-I]][UF6-LIS-L]
6
+ [![][UF6-CHA-I]][UF6-CHA-L]
7
+ [![][UF6-COL-I]][UF6-COL-L]
8
+ [![][UF6-KOF-I]][UF6-KOF-L]
9
+
10
+ <!-- Links -->
11
+ [UF6-CO-VER-I]: https://img.shields.io/github/v/release/userfrosting/sprinkle-core?include_prereleases
12
+ [UF6-CO-VER-L]: https://github.com/userfrosting/sprinkle-core/releases
13
+ [UF6-CO-NPM-I]: https://img.shields.io/npm/v/%40userfrosting%2Fsprinkle-core
14
+ [UF6-CO-NPM-L]: https://www.npmjs.com/package/@userfrosting/sprinkle-core
15
+ [UF6-LIS-I]: https://img.shields.io/badge/license-MIT-brightgreen.svg
16
+ [UF6-LIS-L]: LICENSE
17
+ [UF6-CHA-I]: https://img.shields.io/badge/Chat-UserFrosting-brightgreen?logo=Rocket.Chat
18
+ [UF6-CHA-L]: https://chat.userfrosting.com
19
+ [UF6-COL-I]: https://img.shields.io/badge/Open_Collective-Donate-blue?logo=Open%20Collective
20
+ [UF6-COL-L]: https://opencollective.com/userfrosting#backer
21
+ [UF6-KOF-I]: https://img.shields.io/badge/Ko--fi-Donate-blue?logo=ko-fi&logoColor=white
22
+ [UF6-KOF-L]: https://ko-fi.com/lcharette
23
+
24
+ > [!WARNING]
25
+ > Since 6.0, this is a read-only subtree split of the [UserFrosting Monorepo](https://github.com/userfrosting/monorepo). To contribute, all Pull Requests should be sent against the monorepo. Please see the [contributing guidelines](https://github.com/userfrosting/.github/blob/main/.github/CONTRIBUTING.md) for more information.
13
26
 
14
27
  ## By [Alex Weissman](https://alexanderweissman.com) and [Louis Charette](https://bbqsoftwares.com)
15
28
 
16
- Copyright (c) 2013-2024, free to use in personal and commercial software as per the [license](LICENSE.md).
29
+ Copyright (c) 2013-2026, free to use in personal and commercial software as per the [MIT license](LICENSE.md).
17
30
 
18
- UserFrosting is a secure, modern user management system written in PHP and built on top of the [Slim Microframework](http://www.slimframework.com/), [Twig](http://twig.sensiolabs.org/) templating engine, and [Eloquent](https://laravel.com/docs/10.x/eloquent#introduction) ORM.
31
+ UserFrosting is a secure, modern user management system written in PHP and built on top of the [Slim Microframework](http://www.slimframework.com/), [Twig](http://twig.sensiolabs.org/) templating engine, [Eloquent](https://laravel.com/docs/10.x/eloquent#introduction) ORM, [Vite](https://vitejs.dev/), [Vue](https://vuejs.org/), and [UiKit](https://getuikit.com/).
19
32
 
20
33
  This **Core Sprinkle** provides most of the "heavy lifting" PHP code. It provides all the necessary services for database, templating, error handling, mail support, request throttling, and more.
21
34
 
@@ -42,38 +55,6 @@ To use this sprinkle in your UserFrosting project, follow theses instructions (*
42
55
  php bakery bake
43
56
  ```
44
57
 
45
- ## Install locally and run tests
46
- You can also install this sprinkle locally. This can be useful to debug or contribute to this sprinkle.
47
-
48
- 1. Clone repo :
49
- ```
50
- git clone https://github.com/userfrosting/sprinkle-core.git
51
- ```
52
- 2. Change directory
53
- ```
54
- cd sprinkle-core
55
- ```
56
- 3. Install dependencies :
57
- ```
58
- composer install
59
- ```
60
- 4. Run bake command :
61
- ```
62
- php bakery bake
63
- ```
64
-
65
- From this point, you can use the same command as with any other sprinkle.
66
-
67
- Tests can be run using the bundled PHPUnit :
68
- ```
69
- vendor/bin/phpunit
70
- ```
71
-
72
- Same for PHPStan, for code quality :
73
- ```
74
- vendor/bin/phpstan analyse app/src/
75
- ```
76
-
77
58
  ## Documentation
78
59
  See main [UserFrosting Documentation](https://learn.userfrosting.com) for more information.
79
60
 
@@ -0,0 +1,11 @@
1
+ import { resolveComponent as o, openBlock as e, createBlock as n } from "vue";
2
+ import { _ as t } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ const c = {};
4
+ function _(a, s) {
5
+ const r = o("UFErrorPage");
6
+ return e(), n(r, { errorCode: "401" });
7
+ }
8
+ const p = /* @__PURE__ */ t(c, [["render", _]]);
9
+ export {
10
+ p as default
11
+ };
@@ -0,0 +1,11 @@
1
+ import { resolveComponent as o, openBlock as e, createBlock as n } from "vue";
2
+ import { _ as c } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ const t = {};
4
+ function _(a, s) {
5
+ const r = o("UFErrorPage");
6
+ return e(), n(r, { errorCode: "403" });
7
+ }
8
+ const p = /* @__PURE__ */ c(t, [["render", _]]);
9
+ export {
10
+ p as default
11
+ };
@@ -0,0 +1,11 @@
1
+ import { resolveComponent as r, openBlock as e, createBlock as n } from "vue";
2
+ import { _ as t } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ const c = {};
4
+ function _(a, s) {
5
+ const o = r("UFErrorPage");
6
+ return e(), n(o, { errorCode: "404" });
7
+ }
8
+ const p = /* @__PURE__ */ t(c, [["render", _]]);
9
+ export {
10
+ p as default
11
+ };
@@ -0,0 +1,11 @@
1
+ import { resolveComponent as o, openBlock as e, createBlock as c } from "vue";
2
+ import { _ as n } from "./_plugin-vue_export-helper-CHgC5LLL.js";
3
+ const t = {};
4
+ function _(a, s) {
5
+ const r = o("UFErrorPage");
6
+ return e(), c(r);
7
+ }
8
+ const p = /* @__PURE__ */ n(t, [["render", _]]);
9
+ export {
10
+ p as default
11
+ };
@@ -0,0 +1,9 @@
1
+ const s = (t, r) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [c, e] of r)
4
+ o[c] = e;
5
+ return o;
6
+ };
7
+ export {
8
+ s as _
9
+ };
@@ -0,0 +1,4 @@
1
+ export { useSprunjer } from './useSprunjer';
2
+ export { useCsrf } from './useCsrf';
3
+ export { useAxiosInterceptor } from './useAxiosInterceptor';
4
+ export { useRuleSchemaAdapter } from './useRuleSchemaAdapter';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Axios Error Handler
3
+ *
4
+ * This composable sets up an Axios interceptor to handle errors globally using
5
+ * the Alerts store. It sends the error to the Alerts store, unless it's a 401
6
+ * error.
7
+ *
8
+ * @see https://axios-http.com/docs/interceptors
9
+ */
10
+ export declare const useAxiosInterceptor: () => void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * CSRF Protection Composable
3
+ *
4
+ * Automatically sets the CSRF token in the axios headers for all requests.
5
+ * The CSRF token is read from the meta tags in the HTML document.
6
+ * The CSRF token can updated when the server responds with a new token in the headers.
7
+ *
8
+ * @see https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#axios
9
+ */
10
+ export declare const useCsrf: () => {
11
+ key_name: import('vue').Ref<string, string>;
12
+ key_value: import('vue').Ref<string, string>;
13
+ name: import('vue').Ref<string, string>;
14
+ token: import('vue').Ref<string, string>;
15
+ isEnabled: () => boolean;
16
+ updateFromHeaders: (headers: any) => void;
17
+ fetchCsrfToken: () => Promise<void>;
18
+ };
@@ -0,0 +1,7 @@
1
+ export declare function useRuleSchemaAdapter(): {
2
+ adapt: (sourceSchema: Record<string, any>) => Record<string, any>;
3
+ translateMessage: (fieldRulesMeta: {
4
+ message?: string;
5
+ [key: string]: any;
6
+ }) => string;
7
+ };
@@ -0,0 +1,2 @@
1
+ import { AssociativeArray, Sprunjer } from '../interfaces';
2
+ export declare const useSprunjer: (dataUrl: string | (() => string), defaultSorts?: AssociativeArray, defaultFilters?: AssociativeArray, defaultSize?: number, defaultPage?: number) => Sprunjer;
@@ -0,0 +1,151 @@
1
+ import { ref as _, computed as c, watchEffect as T, toValue as B } from "vue";
2
+ import D from "axios";
3
+ import { u as y, a as h } from "./useAxiosInterceptor-DcOpTLHG.js";
4
+ import { required as q, withMessage as i, email as G, minLength as S, maxLength as V, integer as $, oneOf as p, regex as m, not as M, numeric as O, between as z, url as L } from "@regle/rules";
5
+ import { c as H } from "./useAlertsStore-Ca6nXz8C.js";
6
+ const X = (s, a = {}, w = {}, o = 10, t = 0) => {
7
+ const e = _(o), n = _(t), g = _(a), u = _(w), r = _({
8
+ count: 0,
9
+ count_filtered: 0,
10
+ rows: [],
11
+ listable: {},
12
+ sortable: [],
13
+ filterable: []
14
+ }), b = _(!1), x = _(null);
15
+ async function l() {
16
+ b.value = !0, D.get(B(s), {
17
+ params: {
18
+ size: e.value,
19
+ page: n.value,
20
+ sorts: g.value,
21
+ filters: u.value
22
+ }
23
+ }).then((f) => {
24
+ r.value.count = f.data.count, r.value.count_filtered = f.data.count_filtered, r.value.rows = f.data.rows, r.value.listable = f.data.listable ?? {}, r.value.sortable = f.data.sortable ?? [], r.value.filterable = f.data.filterable ?? [];
25
+ }).catch((f) => {
26
+ x.value = f.response.data;
27
+ }).finally(() => {
28
+ b.value = !1;
29
+ });
30
+ }
31
+ const j = c(() => Math.max(Math.ceil((r.value.count_filtered ?? 0) / e.value) - 1, 0)), C = c(() => r.value.count ?? 0), E = c(() => Math.min(n.value * e.value + 1, r.value.count ?? 0)), d = c(() => Math.min((n.value + 1) * e.value, r.value.count_filtered ?? 0)), A = c(() => r.value.count_filtered ?? 0), P = c(() => r.value.rows ?? []);
32
+ function I() {
33
+ console.log("Not yet implemented");
34
+ }
35
+ function N(f) {
36
+ let v;
37
+ g.value[f] === "asc" ? v = "desc" : g.value[f] === "desc" ? v = null : v = "asc", g.value[f] = v;
38
+ }
39
+ return T(() => {
40
+ l();
41
+ }), {
42
+ dataUrl: s,
43
+ size: e,
44
+ page: n,
45
+ sorts: g,
46
+ filters: u,
47
+ data: r,
48
+ fetch: l,
49
+ loading: b,
50
+ error: x,
51
+ downloadCsv: I,
52
+ totalPages: j,
53
+ countFiltered: A,
54
+ count: C,
55
+ rows: P,
56
+ first: E,
57
+ last: d,
58
+ toggleSort: N
59
+ };
60
+ };
61
+ function Y() {
62
+ function s(o) {
63
+ var e;
64
+ const t = {};
65
+ for (const n in o)
66
+ if (Object.prototype.hasOwnProperty.call(o, n)) {
67
+ const g = ((e = o[n]) == null ? void 0 : e.validators) || {}, u = {};
68
+ for (const r of Object.keys(g))
69
+ w(r, g, u);
70
+ t[n] = u;
71
+ }
72
+ return t;
73
+ }
74
+ function a(o) {
75
+ const { translate: t } = H();
76
+ if (!o.message)
77
+ return "";
78
+ const e = { ...o };
79
+ return delete e.message, t(o.message, e);
80
+ }
81
+ function w(o, t, e) {
82
+ if (o === "required" && t.required) {
83
+ const n = a(t.required);
84
+ e.required = n === "" ? q : i(q, n);
85
+ }
86
+ if (o === "email" && t.email) {
87
+ const n = a(t.email);
88
+ e.email = i(G, n);
89
+ }
90
+ if (o === "length" && t.length) {
91
+ if (t.length.min !== void 0) {
92
+ const n = a(t.length);
93
+ e.minLength = n === "" ? S(t.length.min) : i(S(t.length.min), n);
94
+ }
95
+ if (t.length.max !== void 0) {
96
+ const n = a(t.length);
97
+ e.maxLength = n === "" ? V(t.length.max) : i(V(t.length.max), n);
98
+ }
99
+ }
100
+ if (o === "matches" && t.matches && console.warn('Validation rule "matches" not implemented yet'), o === "equals" && t.equals && console.warn('Validation rule "equals" not implemented yet'), o === "integer" && t.integer) {
101
+ const n = a(t.integer);
102
+ e.integer = n === "" ? $ : i($, n);
103
+ }
104
+ if (o === "member_of" && t.member_of) {
105
+ const n = a(t.member_of);
106
+ e.member_of = n === "" ? p(t.member_of.values) : i(p(t.member_of.values), n);
107
+ }
108
+ if (o === "no_leading_whitespace" && t.no_leading_whitespace) {
109
+ const n = a(t.no_leading_whitespace);
110
+ e.no_leading_whitespace = n === "" ? m(/^\S.*$/) : i(m(/^\S.*$/), n);
111
+ }
112
+ if (o === "no_trailing_whitespace" && t.no_trailing_whitespace) {
113
+ const n = a(t.no_trailing_whitespace);
114
+ e.no_trailing_whitespace = n === "" ? m(/^.*\S$/) : i(m(/^.*\S$/), n);
115
+ }
116
+ if (o === "not_equals" && t.not_equals && console.warn('Validation rule "not_equals" not implemented yet'), o === "not_matches" && t.not_matches && console.warn('Validation rule "not_matches" not implemented yet'), o === "not_member_of" && t.not_member_of) {
117
+ const n = a(t.not_member_of);
118
+ e.not_member_of = n === "" ? M(p(t.not_member_of.values)) : i(M(p(t.not_member_of.values)), n);
119
+ }
120
+ if (o === "numeric" && t.numeric) {
121
+ const n = a(t.numeric);
122
+ e.numeric = n === "" ? O : i(O, n);
123
+ }
124
+ if (o === "range" && t.range) {
125
+ const n = a(t.range);
126
+ e.range = n === "" ? z(t.range.min, t.range.max) : i(
127
+ z(t.range.min, t.range.max),
128
+ n
129
+ );
130
+ }
131
+ if (o === "regex" && t.regex) {
132
+ const n = a(t.regex);
133
+ e.regex = n === "" ? m(new RegExp(t.regex.regex)) : i(m(new RegExp(t.regex.regex)), n);
134
+ }
135
+ if (o === "telephone" && t.telephone && console.warn('Validation rule "telephone" not implemented yet'), o === "uri" && t.uri) {
136
+ const n = a(t.uri);
137
+ e.uri = n === "" ? L : i(L, n);
138
+ }
139
+ if (o === "username" && t.username) {
140
+ const n = a(t.username);
141
+ e.username = n === "" ? m(/^([a-z0-9.\-_])+$/i) : i(m(/^([a-z0-9.\-_])+$/i), n);
142
+ }
143
+ }
144
+ return { adapt: s, translateMessage: a };
145
+ }
146
+ export {
147
+ y as useAxiosInterceptor,
148
+ h as useCsrf,
149
+ Y as useRuleSchemaAdapter,
150
+ X as useSprunjer
151
+ };
@@ -0,0 +1,18 @@
1
+ import { App } from 'vue';
2
+ /**
3
+ * Core Sprinkle initialization recipe.
4
+ *
5
+ * This recipe is responsible for loading the configuration from the api,
6
+ * loading the translations, register the translator as $t and $tdate global
7
+ * properties and setting up the axios CSRF headers.
8
+ */
9
+ declare const _default: {
10
+ install: (app: App) => void;
11
+ };
12
+ export default _default;
13
+ declare module 'vue' {
14
+ interface ComponentCustomProperties {
15
+ $t: (key: string, placeholders?: string | number | object) => string;
16
+ $tdate: (date: string, format?: string | object) => string;
17
+ }
18
+ }
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { a, c as r } from "./useAlertsStore-Ca6nXz8C.js";
2
+ import { u as s, a as e } from "./useAxiosInterceptor-DcOpTLHG.js";
3
+ import "vue";
4
+ import "axios";
5
+ import "@regle/rules";
6
+ const p = {
7
+ install: (o) => {
8
+ s(), a().load();
9
+ const t = r();
10
+ t.load(), o.config.globalProperties.$t = t.translate, o.config.globalProperties.$tdate = t.translateDate, e();
11
+ }
12
+ };
13
+ export {
14
+ p as default
15
+ };
@@ -4,12 +4,11 @@
4
4
  * Generic API Response interface.
5
5
  */
6
6
  export interface ApiResponse {
7
- title: string
8
- description?: string
7
+ title: string;
8
+ description?: string;
9
9
  }
10
-
11
10
  export interface ApiErrorResponse {
12
- title: string
13
- description: string
14
- status: number
11
+ title: string;
12
+ description: string;
13
+ status: number;
15
14
  }
@@ -7,19 +7,17 @@
7
7
  * This api doesn't have a corresponding Request data interface.
8
8
  */
9
9
  export interface DictionaryResponse {
10
- identifier: string
11
- config: DictionaryConfig
12
- dictionary: DictionaryEntries
10
+ identifier: string;
11
+ config: DictionaryConfig;
12
+ dictionary: DictionaryEntries;
13
13
  }
14
-
15
14
  export interface DictionaryEntries {
16
- [key: string]: string
15
+ [key: string]: string;
17
16
  }
18
-
19
17
  export interface DictionaryConfig {
20
- name: string
21
- regional: string
22
- authors: string[]
23
- plural_rule: number
24
- dates: string
18
+ name: string;
19
+ regional: string;
20
+ authors: string[];
21
+ plural_rule: number;
22
+ dates: string;
25
23
  }
@@ -0,0 +1,8 @@
1
+ import { Severity } from './severity';
2
+ export interface AlertInterface {
3
+ title?: string;
4
+ description?: string;
5
+ style?: Severity | keyof typeof Severity;
6
+ closeBtn?: boolean;
7
+ hideIcon?: boolean;
8
+ }
@@ -4,5 +4,5 @@
4
4
  * Returns miscellaneous interfaces that are used throughout the application.
5
5
  */
6
6
  export interface AssociativeArray {
7
- [key: string]: string | null
7
+ [key: string]: string | null;
8
8
  }
@@ -0,0 +1,13 @@
1
+ declare module 'vue-router' {
2
+ interface RouteMeta {
3
+ title?: string;
4
+ description?: string;
5
+ }
6
+ }
7
+ export type { AlertInterface } from './alerts';
8
+ export type { AssociativeArray } from './common';
9
+ export { Severity } from './severity';
10
+ export type { Sprunjer, SprunjerData, SprunjerListable, SprunjerListableOption } from './sprunjer';
11
+ export type { SprunjerRequest, SprunjerResponse } from './sprunjerApi';
12
+ export type { DictionaryResponse, DictionaryEntries, DictionaryConfig } from './DictionaryApi';
13
+ export type { ApiResponse, ApiErrorResponse } from './ApiResponse';
@@ -12,13 +12,13 @@
12
12
  * the theme's button component must accept 'Info' as a valid input, but it can
13
13
  * map it to the 'Primary' style.
14
14
  */
15
- export enum Severity {
16
- Primary = 'Primary',
17
- Secondary = 'Secondary',
18
- Success = 'Success',
19
- Warning = 'Warning',
20
- Danger = 'Danger',
21
- Info = 'Info',
22
- Muted = 'Muted', // Aka, Disabled
23
- Default = 'Default' // No-style or default style
15
+ export declare enum Severity {
16
+ Primary = "Primary",
17
+ Secondary = "Secondary",
18
+ Success = "Success",
19
+ Warning = "Warning",
20
+ Danger = "Danger",
21
+ Info = "Info",
22
+ Muted = "Muted",// Aka, Disabled
23
+ Default = "Default"
24
24
  }
@@ -0,0 +1,51 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ import { ApiErrorResponse, AssociativeArray } from '.';
3
+ export interface Sprunjer {
4
+ dataUrl: string | (() => string);
5
+ size: Ref<number>;
6
+ page: Ref<number>;
7
+ sorts: Ref<AssociativeArray>;
8
+ filters: Ref<AssociativeArray>;
9
+ data: Ref<SprunjerData>;
10
+ fetch: () => void;
11
+ loading: Ref<boolean>;
12
+ error: Ref<ApiErrorResponse | null>;
13
+ totalPages: ComputedRef<number>;
14
+ downloadCsv: () => void;
15
+ countFiltered: ComputedRef<number>;
16
+ count: ComputedRef<number>;
17
+ rows: ComputedRef<any[]>;
18
+ first: ComputedRef<number>;
19
+ last: ComputedRef<number>;
20
+ toggleSort: (column: string) => void;
21
+ }
22
+ /**
23
+ * Sprunjer Data. Represents the data that is returned from any Sprunjer
24
+ * Composable. It is different than SprunjerResponse, as the response if what
25
+ * the API return, Data is what Vue provides. Both are similar, but Data doesn't
26
+ * have optional values.
27
+ *
28
+ * N.B.: "rows" uses a generic array. It can contain any object, and should
29
+ * actually be can be extended for each Sprunjer
30
+ */
31
+ export interface SprunjerData {
32
+ count: number;
33
+ count_filtered: number;
34
+ rows: any[];
35
+ listable: SprunjerListable;
36
+ sortable: string[];
37
+ filterable: string[];
38
+ }
39
+ /**
40
+ * Sprunjer Listable. Represents a listable for a Sprunjer.
41
+ */
42
+ export interface SprunjerListable {
43
+ [key: string]: SprunjerListableOption[];
44
+ }
45
+ /**
46
+ * Sprunjer Listable Option. Represents a listable option for a Sprunjer.
47
+ */
48
+ export interface SprunjerListableOption {
49
+ value: string;
50
+ text: string;
51
+ }
@@ -1,9 +1,7 @@
1
- import type { AssociativeArray, SprunjerListable } from '.'
2
-
1
+ import { AssociativeArray, SprunjerListable } from '.';
3
2
  /**
4
3
  * Sprunje API Interfaces - What the API expects and what it returns.
5
4
  */
6
-
7
5
  /**
8
6
  * Sprunjer Response. All the data that is returned from any Sprunjer API.
9
7
  * Note listable, sortable and filterable are optional when dealing with the API.
@@ -12,22 +10,21 @@ import type { AssociativeArray, SprunjerListable } from '.'
12
10
  * actually be can be extended for each Sprunjer
13
11
  */
14
12
  export interface SprunjerResponse {
15
- count: number
16
- count_filtered: number
17
- rows: any[]
18
- listable?: SprunjerListable
19
- sortable?: string[]
20
- filterable?: string[]
13
+ count: number;
14
+ count_filtered: number;
15
+ rows: any[];
16
+ listable?: SprunjerListable;
17
+ sortable?: string[];
18
+ filterable?: string[];
21
19
  }
22
-
23
20
  /**
24
21
  * Sprunjer Request. All the parameters that can be passed to a Sprunjer.
25
22
  * All parameters are optional.
26
23
  */
27
24
  export interface SprunjerRequest {
28
- size?: number
29
- page?: number
30
- sorts?: AssociativeArray
31
- filters?: AssociativeArray
32
- format?: string
25
+ size?: number;
26
+ page?: number;
27
+ sorts?: AssociativeArray;
28
+ filters?: AssociativeArray;
29
+ format?: string;
33
30
  }
@@ -0,0 +1,5 @@
1
+ import "vue-router";
2
+ import { S as t } from "./severity-DwLpzIij.js";
3
+ export {
4
+ t as Severity
5
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Default error routes.
3
+ *
4
+ * N.B.: The first of these routes serve as a catch-all, so 404 not found must
5
+ * be first.
6
+ */
7
+ declare const _default: {
8
+ path: string;
9
+ name: string;
10
+ meta: {
11
+ title: string;
12
+ description: string;
13
+ };
14
+ component: () => Promise<typeof import("../views/Page404NotFound.vue")>;
15
+ }[];
16
+ export default _default;
package/dist/routes.js ADDED
@@ -0,0 +1,41 @@
1
+ const t = [
2
+ {
3
+ path: "/:pathMatch(.*)*",
4
+ name: "NotFound",
5
+ meta: {
6
+ title: "ERROR.404.TITLE",
7
+ description: "ERROR.404.DESCRIPTION"
8
+ },
9
+ component: () => import("./Page404NotFound-CIs-2Fy2.js")
10
+ },
11
+ {
12
+ path: "/:pathMatch(.*)*",
13
+ name: "Unauthorized",
14
+ meta: {
15
+ title: "ERROR.401.TITLE",
16
+ description: "ERROR.401.DESCRIPTION"
17
+ },
18
+ component: () => import("./Page401Unauthorized-D_EoXicK.js")
19
+ },
20
+ {
21
+ path: "/:pathMatch(.*)*",
22
+ name: "Forbidden",
23
+ meta: {
24
+ title: "ERROR.403.TITLE",
25
+ description: "ERROR.403.DESCRIPTION"
26
+ },
27
+ component: () => import("./Page403Forbidden-C96BgRtx.js")
28
+ },
29
+ {
30
+ path: "/:pathMatch(.*)*",
31
+ name: "Error",
32
+ meta: {
33
+ title: "ERROR.TITLE",
34
+ description: "ERROR.DESCRIPTION"
35
+ },
36
+ component: () => import("./PageError-Sk-QAv9A.js")
37
+ }
38
+ ];
39
+ export {
40
+ t as default
41
+ };
@@ -0,0 +1,4 @@
1
+ var n = /* @__PURE__ */ ((a) => (a.Primary = "Primary", a.Secondary = "Secondary", a.Success = "Success", a.Warning = "Warning", a.Danger = "Danger", a.Info = "Info", a.Muted = "Muted", a.Default = "Default", a))(n || {});
2
+ export {
3
+ n as S
4
+ };