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