@akanjs/client 0.0.39 → 0.0.40

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/src/types.d.ts ADDED
@@ -0,0 +1,134 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ClassValue } from 'clsx';
3
+ import { ReactNode } from 'react';
4
+
5
+ type SortOf<Filter> = keyof GetStateObject<Filter>;
6
+ type FilterType = Record<string, any>;
7
+ type GetStateObject<T> = Omit<{
8
+ [K in keyof T as T[K] extends (...args: any) => any ? never : K]: T[K];
9
+ }, "prototype">;
10
+
11
+ type FieldState<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends Dayjs ? T : T extends any[] ? T : T extends {
12
+ id: string;
13
+ } ? T | null : T;
14
+ type DefaultOf<S> = S extends infer T ? {
15
+ [K in keyof T]: FieldState<T[K]>;
16
+ } : never;
17
+ interface FetchInitForm<Input, Full, Filter extends FilterType> {
18
+ page?: number;
19
+ limit?: number;
20
+ sort?: SortOf<Filter> | symbol;
21
+ default?: Partial<DefaultOf<Input>>;
22
+ invalidate?: boolean;
23
+ insight?: boolean;
24
+ }
25
+
26
+ declare const clsx: (...args: ClassValue[]) => string;
27
+ declare const loadFonts: (fonts: {
28
+ name: string;
29
+ nextFont: any;
30
+ paths: {
31
+ src: string;
32
+ weight: number;
33
+ }[];
34
+ }[]) => ReactFont[];
35
+ interface ModelsProps<M extends {
36
+ id: string;
37
+ }> {
38
+ className?: string;
39
+ sliceName?: string;
40
+ query?: {
41
+ [key: string]: any;
42
+ };
43
+ init?: FetchInitForm<any, M, any>;
44
+ onClickItem?: (model: M) => any;
45
+ }
46
+ type ModelProps<T extends string, L extends {
47
+ id: string;
48
+ }> = {
49
+ [key in T]: L;
50
+ } & {
51
+ className?: string;
52
+ sliceName?: T;
53
+ onClick?: (model: L) => any;
54
+ actions?: DataAction<L>[];
55
+ columns?: DataColumn<L>[];
56
+ href?: string;
57
+ };
58
+ interface ModelDashboardProps<Summary> {
59
+ className?: string;
60
+ summary: Summary;
61
+ queryMap?: {
62
+ [key: string]: any;
63
+ };
64
+ columns?: (keyof Summary)[];
65
+ hidePresents?: boolean;
66
+ sliceName?: string;
67
+ }
68
+ interface ModelInsightProps<Insight> {
69
+ className?: string;
70
+ insight: Insight;
71
+ sliceName?: string;
72
+ }
73
+ interface ModelEditProps {
74
+ sliceName?: string;
75
+ }
76
+ interface ModelViewProps {
77
+ id?: string;
78
+ sliceName?: string;
79
+ }
80
+ type DataAction<L> = "edit" | "view" | "remove" | {
81
+ type: string;
82
+ render: () => ReactNode;
83
+ };
84
+ interface DataTool {
85
+ render: () => ReactNode;
86
+ }
87
+ type DataColumn<L> = string | {
88
+ key: keyof L;
89
+ title?: string;
90
+ value?: (value: any, model: L) => string | number | boolean | undefined | null | object;
91
+ responsive?: boolean;
92
+ render?: (value: any, model: L) => ReactNode;
93
+ only?: "user" | "admin";
94
+ };
95
+ interface DataMenuItem {
96
+ key: string;
97
+ icon: ReactNode;
98
+ label?: string;
99
+ render: () => ReactNode;
100
+ }
101
+ interface DataMenu {
102
+ [key: string]: DataMenuItem;
103
+ }
104
+ interface UserMenuItem {
105
+ title: string | ReactNode;
106
+ icon?: ReactNode;
107
+ path: string;
108
+ query?: any;
109
+ children?: UserMenuItem[];
110
+ onClick?: () => void;
111
+ }
112
+ interface MenuItem {
113
+ icon?: ReactNode;
114
+ title: string | ReactNode;
115
+ href: string;
116
+ hide?: "mobile" | "pc";
117
+ children?: MenuItem[];
118
+ onClick?: () => void;
119
+ }
120
+ interface ReactFont {
121
+ name: string;
122
+ paths: {
123
+ src: string;
124
+ weight: number;
125
+ }[];
126
+ }
127
+ interface RootLayoutProps {
128
+ children: ReactNode;
129
+ params: Promise<{
130
+ lang: "en" | "ko";
131
+ }>;
132
+ }
133
+
134
+ export { type DataAction, type DataColumn, type DataMenu, type DataMenuItem, type DataTool, type MenuItem, type ModelDashboardProps, type ModelEditProps, type ModelInsightProps, type ModelProps, type ModelViewProps, type ModelsProps, type ReactFont, type RootLayoutProps, type UserMenuItem, clsx, loadFonts };
package/src/types.js ADDED
@@ -0,0 +1,37 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var types_exports = {};
20
+ __export(types_exports, {
21
+ clsx: () => clsx,
22
+ loadFonts: () => loadFonts
23
+ });
24
+ module.exports = __toCommonJS(types_exports);
25
+ var import_clsx = require("clsx");
26
+ const clsx = /* @__PURE__ */ __name((...args) => (0, import_clsx.clsx)(...args), "clsx");
27
+ const loadFonts = /* @__PURE__ */ __name((fonts) => {
28
+ return fonts.map(({ name, nextFont, paths }) => nextFont ?? {
29
+ name,
30
+ paths
31
+ });
32
+ }, "loadFonts");
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ clsx,
36
+ loadFonts
37
+ });