kosmio 0.1.0
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 +37 -0
- package/dist/KosmioThemeProvider-DzH5uTqT.js +145 -0
- package/dist/LanguageContext-DlN7MgUs.js +161 -0
- package/dist/MobileRouteTransition-C16D4K5c.js +124 -0
- package/dist/NativeBackButtonHandler-CcLHewdm.js +105 -0
- package/dist/OfflineSyncContext-CRwPM5kh.js +34 -0
- package/dist/ViewportContext-z-ZwlTIZ.js +214 -0
- package/dist/app.js +123 -0
- package/dist/classNames-CcykAxZN.js +6 -0
- package/dist/context.js +16 -0
- package/dist/core.js +55 -0
- package/dist/formRegistry-Lvs6aL14.js +3468 -0
- package/dist/i18n.js +9 -0
- package/dist/index.js +185 -0
- package/dist/localizedRouter-BjT5yIzl.js +721 -0
- package/dist/offlineWriteQueue-C31IjyB_.js +275 -0
- package/dist/permissions.js +181 -0
- package/dist/platform.js +11 -0
- package/dist/queryClient-ZtNrT-lA.js +27 -0
- package/dist/shortcuts-n31uRPcv.js +147 -0
- package/dist/styles.css +1 -0
- package/dist/styles.js +1 -0
- package/dist/systemBars-C3QiEL7z.js +136 -0
- package/dist/theme.js +8 -0
- package/dist/ui.js +88 -0
- package/package.json +84 -0
- package/types/app.d.ts +98 -0
- package/types/context.d.ts +110 -0
- package/types/core.d.ts +210 -0
- package/types/global.d.ts +1 -0
- package/types/i18n.d.ts +79 -0
- package/types/index.d.ts +8 -0
- package/types/permissions.d.ts +61 -0
- package/types/platform.d.ts +71 -0
- package/types/theme.d.ts +67 -0
- package/types/ui.d.ts +875 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useCallback as u, useMemo as h, useContext as b, createContext as C, useEffect as j } from "react";
|
|
3
|
+
const V = C(null);
|
|
4
|
+
function B({ children: t }) {
|
|
5
|
+
const [o, e] = d("none"), [n, s] = d("none"), [r, c] = d(null), [m, a] = d(!1), [f, w] = d(!1), v = u(() => {
|
|
6
|
+
a(!1), w(!1);
|
|
7
|
+
}, []), F = u(() => {
|
|
8
|
+
e("none"), s("none"), c(null), v();
|
|
9
|
+
}, [v]), i = u((l, p = "default") => {
|
|
10
|
+
e(l), s(l === "none" ? "none" : p), c(null), v();
|
|
11
|
+
}, [v]), R = u((l = !1, p = !1) => {
|
|
12
|
+
a(l), w(p);
|
|
13
|
+
}, []), S = u((l, p = "default", P = null) => {
|
|
14
|
+
e(l), s(l === "none" ? "none" : p), c(P), v();
|
|
15
|
+
}, [v]), E = u((l, p = "default", P) => {
|
|
16
|
+
if (P === void 0) {
|
|
17
|
+
i(l, p);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
S(l, p, P);
|
|
21
|
+
}, [S, i]), g = h(
|
|
22
|
+
() => ({
|
|
23
|
+
form: o,
|
|
24
|
+
formAction: n,
|
|
25
|
+
formObject: r,
|
|
26
|
+
formSuccess: m,
|
|
27
|
+
formFailure: f,
|
|
28
|
+
setFormResult: R,
|
|
29
|
+
closeForm: F,
|
|
30
|
+
openForm: E,
|
|
31
|
+
setForm: i,
|
|
32
|
+
setFormObject: c,
|
|
33
|
+
setAdvancedForm: S
|
|
34
|
+
}),
|
|
35
|
+
[
|
|
36
|
+
F,
|
|
37
|
+
o,
|
|
38
|
+
n,
|
|
39
|
+
f,
|
|
40
|
+
r,
|
|
41
|
+
m,
|
|
42
|
+
E,
|
|
43
|
+
S,
|
|
44
|
+
i,
|
|
45
|
+
R
|
|
46
|
+
]
|
|
47
|
+
);
|
|
48
|
+
return /* @__PURE__ */ A(V.Provider, { value: g, children: t });
|
|
49
|
+
}
|
|
50
|
+
function y() {
|
|
51
|
+
const t = b(V);
|
|
52
|
+
if (!t)
|
|
53
|
+
throw new Error("useFormState must be used within a <FormStateProvider>");
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
const N = C(null);
|
|
57
|
+
function I({
|
|
58
|
+
group: t,
|
|
59
|
+
action: o = "add",
|
|
60
|
+
payload: e,
|
|
61
|
+
iconName: n = "actionAddFill",
|
|
62
|
+
labelKey: s = "common.actions.add",
|
|
63
|
+
variant: r = "form"
|
|
64
|
+
}) {
|
|
65
|
+
return !t || !o ? null : {
|
|
66
|
+
type: r,
|
|
67
|
+
group: t,
|
|
68
|
+
action: o,
|
|
69
|
+
payload: e,
|
|
70
|
+
iconName: n,
|
|
71
|
+
labelKey: s
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function T({ children: t }) {
|
|
75
|
+
const { setAdvancedForm: o, setForm: e } = y(), [n, s] = d(null), [r, c] = d(!1), m = u((F) => {
|
|
76
|
+
s(F ?? null);
|
|
77
|
+
}, []), a = u(() => {
|
|
78
|
+
s(null);
|
|
79
|
+
}, []), f = u((F) => {
|
|
80
|
+
c(!!F);
|
|
81
|
+
}, []), w = u((F = null) => {
|
|
82
|
+
const i = F ?? n;
|
|
83
|
+
if (!(!i?.group || !i?.action)) {
|
|
84
|
+
if (i.payload === void 0) {
|
|
85
|
+
e(i.group, i.action);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
o(i.group, i.action, i.payload);
|
|
89
|
+
}
|
|
90
|
+
}, [n, o, e]), v = h(
|
|
91
|
+
() => ({
|
|
92
|
+
formLauncher: n,
|
|
93
|
+
setFormLauncher: m,
|
|
94
|
+
clearFormLauncher: a,
|
|
95
|
+
showOperationsShortcut: r,
|
|
96
|
+
setShowOperationsShortcut: f,
|
|
97
|
+
openFormLauncher: w
|
|
98
|
+
}),
|
|
99
|
+
[
|
|
100
|
+
a,
|
|
101
|
+
n,
|
|
102
|
+
w,
|
|
103
|
+
m,
|
|
104
|
+
f,
|
|
105
|
+
r
|
|
106
|
+
]
|
|
107
|
+
);
|
|
108
|
+
return /* @__PURE__ */ A(N.Provider, { value: v, children: t });
|
|
109
|
+
}
|
|
110
|
+
function _() {
|
|
111
|
+
const t = b(N);
|
|
112
|
+
if (!t)
|
|
113
|
+
throw new Error("useFloatingActions must be used within a <FloatingActionsProvider>");
|
|
114
|
+
return t;
|
|
115
|
+
}
|
|
116
|
+
const O = C(null);
|
|
117
|
+
function k({ children: t, beforeOpenConfirm: o }) {
|
|
118
|
+
const [e, n] = d(null), s = u((a) => {
|
|
119
|
+
o?.(a), n(a ?? null);
|
|
120
|
+
}, [o]), r = u(() => {
|
|
121
|
+
n(null);
|
|
122
|
+
}, []), c = u(() => {
|
|
123
|
+
const a = e?.onConfirm;
|
|
124
|
+
r(), a?.();
|
|
125
|
+
}, [r, e]), m = h(
|
|
126
|
+
() => ({
|
|
127
|
+
confirmState: e,
|
|
128
|
+
openConfirm: s,
|
|
129
|
+
closeConfirm: r,
|
|
130
|
+
confirmAndRun: c
|
|
131
|
+
}),
|
|
132
|
+
[r, c, e, s]
|
|
133
|
+
);
|
|
134
|
+
return /* @__PURE__ */ A(O.Provider, { value: m, children: t });
|
|
135
|
+
}
|
|
136
|
+
function D() {
|
|
137
|
+
const t = b(O);
|
|
138
|
+
if (!t)
|
|
139
|
+
throw new Error("usePopup must be used within a <PopupProvider>");
|
|
140
|
+
return t;
|
|
141
|
+
}
|
|
142
|
+
const x = {
|
|
143
|
+
shortScreenBreakpoint: 1024,
|
|
144
|
+
mobileBreakpoint: 768,
|
|
145
|
+
mobileNativeBreakpoint: 768,
|
|
146
|
+
detectNativeRuntime: () => !1
|
|
147
|
+
};
|
|
148
|
+
function L(t) {
|
|
149
|
+
if (typeof window > "u")
|
|
150
|
+
return {
|
|
151
|
+
isShortScreen: !1,
|
|
152
|
+
isMobile: !1,
|
|
153
|
+
isMobileNative: !1,
|
|
154
|
+
isNativeRuntime: !1
|
|
155
|
+
};
|
|
156
|
+
const o = !!t.detectNativeRuntime?.(), e = window.innerWidth;
|
|
157
|
+
return {
|
|
158
|
+
isShortScreen: e <= t.shortScreenBreakpoint,
|
|
159
|
+
isMobile: e <= t.mobileBreakpoint,
|
|
160
|
+
isMobileNative: o && e <= t.mobileNativeBreakpoint,
|
|
161
|
+
isNativeRuntime: o
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const M = C(null);
|
|
165
|
+
function G({
|
|
166
|
+
children: t,
|
|
167
|
+
shortScreenBreakpoint: o = x.shortScreenBreakpoint,
|
|
168
|
+
mobileBreakpoint: e = x.mobileBreakpoint,
|
|
169
|
+
mobileNativeBreakpoint: n = x.mobileNativeBreakpoint,
|
|
170
|
+
detectNativeRuntime: s = x.detectNativeRuntime
|
|
171
|
+
}) {
|
|
172
|
+
const r = h(
|
|
173
|
+
() => ({
|
|
174
|
+
shortScreenBreakpoint: o,
|
|
175
|
+
mobileBreakpoint: e,
|
|
176
|
+
mobileNativeBreakpoint: n,
|
|
177
|
+
detectNativeRuntime: s
|
|
178
|
+
}),
|
|
179
|
+
[s, e, n, o]
|
|
180
|
+
), [c, m] = d(() => L(r));
|
|
181
|
+
j(() => {
|
|
182
|
+
const f = () => {
|
|
183
|
+
m(L(r));
|
|
184
|
+
};
|
|
185
|
+
return f(), window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
|
|
186
|
+
}, [r]);
|
|
187
|
+
const a = h(
|
|
188
|
+
() => ({
|
|
189
|
+
...c,
|
|
190
|
+
shortScreenBreakpoint: o,
|
|
191
|
+
mobileBreakpoint: e,
|
|
192
|
+
mobileNativeBreakpoint: n
|
|
193
|
+
}),
|
|
194
|
+
[e, n, o, c]
|
|
195
|
+
);
|
|
196
|
+
return /* @__PURE__ */ A(M.Provider, { value: a, children: t });
|
|
197
|
+
}
|
|
198
|
+
function U() {
|
|
199
|
+
const t = b(M);
|
|
200
|
+
if (!t)
|
|
201
|
+
throw new Error("useViewport must be used within a <ViewportProvider>");
|
|
202
|
+
return t;
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
T as F,
|
|
206
|
+
k as P,
|
|
207
|
+
G as V,
|
|
208
|
+
B as a,
|
|
209
|
+
y as b,
|
|
210
|
+
I as c,
|
|
211
|
+
D as d,
|
|
212
|
+
U as e,
|
|
213
|
+
_ as u
|
|
214
|
+
};
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as b, b as K, A as k, m as f } from "./systemBars-C3QiEL7z.js";
|
|
3
|
+
import { M as N } from "./MobileRouteTransition-C16D4K5c.js";
|
|
4
|
+
import { N as C } from "./NativeBackButtonHandler-CcLHewdm.js";
|
|
5
|
+
import { q as m } from "./queryClient-ZtNrT-lA.js";
|
|
6
|
+
import { j as P, c as U, g } from "./offlineWriteQueue-C31IjyB_.js";
|
|
7
|
+
const H = "/auth/callback";
|
|
8
|
+
function L(e = {}) {
|
|
9
|
+
const a = e.colors ?? {}, r = e.statusBarColors ?? (a.light?.statusBar || a.dark?.statusBar ? {
|
|
10
|
+
light: a.light?.statusBar,
|
|
11
|
+
dark: a.dark?.statusBar
|
|
12
|
+
} : void 0), o = e.navigationBarColors ?? (a.light?.navigationBar || a.dark?.navigationBar ? {
|
|
13
|
+
light: a.light?.navigationBar,
|
|
14
|
+
dark: a.dark?.navigationBar
|
|
15
|
+
} : void 0);
|
|
16
|
+
return {
|
|
17
|
+
statusBarColors: r,
|
|
18
|
+
navigationBarColors: o
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function O(e = {}) {
|
|
22
|
+
const a = e.disabledRouteKeys ?? [], r = e.rules ?? [];
|
|
23
|
+
return [...a.map((s) => ({
|
|
24
|
+
id: `${s}-no-transition`,
|
|
25
|
+
routeKey: s,
|
|
26
|
+
enabled: !1
|
|
27
|
+
})), ...r];
|
|
28
|
+
}
|
|
29
|
+
function M(e = {}) {
|
|
30
|
+
return typeof e.resolveScopeKey == "function" ? e.resolveScopeKey : async () => {
|
|
31
|
+
const a = typeof e.resolveUser == "function" ? await e.resolveUser() : e.userId, r = typeof e.resolveTenant == "function" ? await e.resolveTenant() : e.tenantId;
|
|
32
|
+
return g({
|
|
33
|
+
userId: a,
|
|
34
|
+
tenantId: r
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function D(e = {}) {
|
|
39
|
+
const a = e.capacitor?.runtime ?? e.capacitor, r = e.capacitor?.app, o = e.capacitor?.registerPlugin, s = e.app?.id ?? "kosmio", p = b({
|
|
40
|
+
capacitor: a,
|
|
41
|
+
androidAppScheme: e.app?.androidScheme ?? e.app?.androidAppScheme ?? "app",
|
|
42
|
+
authCallbackPath: e.auth?.callbackPath ?? H,
|
|
43
|
+
nativeAuthHost: e.auth?.nativeHost,
|
|
44
|
+
nativeAuthPath: e.auth?.nativePath
|
|
45
|
+
}), i = p.isNativeApp(), n = e.mobileTransitions ?? {}, u = n.stateKey ?? `${s}MobileTransitionDirection`, d = O(n), y = e.router?.matchLocalizedRoute ?? e.matchRoute, { statusBarColors: v, navigationBarColors: S } = L(e.systemBars), l = K({
|
|
46
|
+
registerPlugin: o,
|
|
47
|
+
isNative: i,
|
|
48
|
+
pluginName: e.systemBars?.pluginName,
|
|
49
|
+
pluginKey: e.systemBars?.pluginKey ?? `__${s}SystemBarsPlugin`,
|
|
50
|
+
statusBarColors: v,
|
|
51
|
+
navigationBarColors: S
|
|
52
|
+
});
|
|
53
|
+
function B() {
|
|
54
|
+
return e.offlineQueue && U({
|
|
55
|
+
storagePrefix: e.offlineQueue.storagePrefix,
|
|
56
|
+
resolveScopeKey: M(e.offlineQueue),
|
|
57
|
+
invalidateQueries: e.offlineQueue.invalidateQueries ?? (() => m.invalidateQueries()),
|
|
58
|
+
appStateAdapter: e.offlineQueue.appStateAdapter ?? (i ? r : null)
|
|
59
|
+
}), m;
|
|
60
|
+
}
|
|
61
|
+
function h() {
|
|
62
|
+
return P();
|
|
63
|
+
}
|
|
64
|
+
function R(t) {
|
|
65
|
+
return /* @__PURE__ */ c(
|
|
66
|
+
k,
|
|
67
|
+
{
|
|
68
|
+
app: t?.app ?? r,
|
|
69
|
+
isNative: t?.isNative ?? i,
|
|
70
|
+
mapUrlToRoute: t?.mapUrlToRoute ?? e.mapAppUrlToRoute ?? f
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
function A(t) {
|
|
75
|
+
return /* @__PURE__ */ c(
|
|
76
|
+
C,
|
|
77
|
+
{
|
|
78
|
+
app: t?.app ?? r,
|
|
79
|
+
isNative: t?.isNative ?? i,
|
|
80
|
+
router: t?.router ?? e.router,
|
|
81
|
+
mainRouteKeys: t?.mainRouteKeys ?? n.mainRouteKeys,
|
|
82
|
+
transitionStateKey: t?.transitionStateKey ?? u,
|
|
83
|
+
closeableSelectSelectors: t?.closeableSelectSelectors,
|
|
84
|
+
selectSheetBackdropSelector: t?.selectSheetBackdropSelector,
|
|
85
|
+
selectDropdownSelector: t?.selectDropdownSelector,
|
|
86
|
+
closeableOverlaySelectors: t?.closeableOverlaySelectors
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
function T(t) {
|
|
91
|
+
return /* @__PURE__ */ c(
|
|
92
|
+
N,
|
|
93
|
+
{
|
|
94
|
+
...t,
|
|
95
|
+
router: t?.router ?? e.router,
|
|
96
|
+
matchRoute: t?.matchRoute ?? y,
|
|
97
|
+
rules: t?.rules ?? d,
|
|
98
|
+
stateKey: t?.stateKey ?? u,
|
|
99
|
+
defaultTransition: t?.defaultTransition ?? n.defaultTransition
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
...p,
|
|
105
|
+
AppUrlListener: R,
|
|
106
|
+
MobileRouteTransition: T,
|
|
107
|
+
NativeBackButtonHandler: A,
|
|
108
|
+
configure: B,
|
|
109
|
+
queryClient: m,
|
|
110
|
+
startOfflineSync: h,
|
|
111
|
+
systemBars: l,
|
|
112
|
+
getSystemBarsPlugin: l.getSystemBarsPlugin,
|
|
113
|
+
markNativeAppReady: l.markNativeAppReady,
|
|
114
|
+
syncSystemBarsTheme: l.syncSystemBarsTheme,
|
|
115
|
+
mobileTransitions: {
|
|
116
|
+
rules: d,
|
|
117
|
+
stateKey: u
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
D as createKosmioApp
|
|
123
|
+
};
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { F as o, a, P as s, V as i, c as t, u, b as n, d as F, e as p } from "./ViewportContext-z-ZwlTIZ.js";
|
|
2
|
+
import { D as c, O as d, u as f } from "./OfflineSyncContext-CRwPM5kh.js";
|
|
3
|
+
export {
|
|
4
|
+
c as DEFAULT_OFFLINE_SYNC_STATE,
|
|
5
|
+
o as FloatingActionsProvider,
|
|
6
|
+
a as FormStateProvider,
|
|
7
|
+
d as OfflineSyncProvider,
|
|
8
|
+
s as PopupProvider,
|
|
9
|
+
i as ViewportProvider,
|
|
10
|
+
t as createFormLauncher,
|
|
11
|
+
u as useFloatingActions,
|
|
12
|
+
n as useFormState,
|
|
13
|
+
f as useOfflineSync,
|
|
14
|
+
F as usePopup,
|
|
15
|
+
p as useViewport
|
|
16
|
+
};
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { c as s } from "./classNames-CcykAxZN.js";
|
|
2
|
+
import { A as r, E as i, a as u, F as o, b as l, c as n, d as f, e as c, f as y, g as m, i as p, k as d, h as Q, m as g, j as k, l as O, r as S, t as h, n as W, o as C } from "./localizedRouter-BjT5yIzl.js";
|
|
3
|
+
import { c as b, a as E, b as R, g as x, i as q, d as M, m as v, n as F, p as H, r as K, s as A, v as j } from "./shortcuts-n31uRPcv.js";
|
|
4
|
+
import { c as D, e as P, g as w, a as L, i as B, b as G, d as I, f as J, r as N, h as U, s as V, j as X, k as Y } from "./offlineWriteQueue-C31IjyB_.js";
|
|
5
|
+
import { c as _, q as $ } from "./queryClient-ZtNrT-lA.js";
|
|
6
|
+
export {
|
|
7
|
+
r as ApiClient,
|
|
8
|
+
i as Entity,
|
|
9
|
+
u as EntityModelFactory,
|
|
10
|
+
o as Field,
|
|
11
|
+
l as FieldTypes,
|
|
12
|
+
n as buildRoutePath,
|
|
13
|
+
b as clamp,
|
|
14
|
+
D as configureOfflineWriteQueue,
|
|
15
|
+
f as createEntityModels,
|
|
16
|
+
c as createEntityResource,
|
|
17
|
+
y as createEnumType,
|
|
18
|
+
_ as createKosmioQueryClient,
|
|
19
|
+
m as createLocalizedRouter,
|
|
20
|
+
E as createShortcutMatcher,
|
|
21
|
+
R as createStaggerDelay,
|
|
22
|
+
s as cx,
|
|
23
|
+
P as enqueueOfflineWrite,
|
|
24
|
+
w as getOfflineWriteQueueScopeKey,
|
|
25
|
+
L as getOfflineWriteQueueState,
|
|
26
|
+
x as getRevealStyle,
|
|
27
|
+
q as isEditableTarget,
|
|
28
|
+
p as isEnumType,
|
|
29
|
+
B as isOfflineQueueCanceledResult,
|
|
30
|
+
G as isOfflineQueueHandledResult,
|
|
31
|
+
I as isOfflineQueueQueuedResult,
|
|
32
|
+
J as isQueueableWriteRequest,
|
|
33
|
+
M as isTypingTarget,
|
|
34
|
+
d as keysToCamel,
|
|
35
|
+
Q as keysToSnake,
|
|
36
|
+
g as makeCrudHooks,
|
|
37
|
+
k as makeMutationHook,
|
|
38
|
+
O as makeQueryHook,
|
|
39
|
+
v as motion,
|
|
40
|
+
F as normalizeShortcutKey,
|
|
41
|
+
H as parseShortcutKeys,
|
|
42
|
+
$ as queryClient,
|
|
43
|
+
N as registerOfflineWriteClient,
|
|
44
|
+
U as requestOfflineWriteQueueSync,
|
|
45
|
+
S as resolveTypeDescriptor,
|
|
46
|
+
K as rowAppearStyle,
|
|
47
|
+
A as shortcutMatches,
|
|
48
|
+
V as shouldQueueOfflineWrite,
|
|
49
|
+
X as startOfflineWriteQueueSync,
|
|
50
|
+
Y as subscribeOfflineWriteQueue,
|
|
51
|
+
h as toCamel,
|
|
52
|
+
W as toPascalCase,
|
|
53
|
+
C as toSnake,
|
|
54
|
+
j as variants
|
|
55
|
+
};
|