@gostack-framework/react 0.0.0-stage → 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.
Files changed (138) hide show
  1. package/dist/api.d.ts +83 -0
  2. package/dist/api.js +170 -0
  3. package/dist/api.js.map +1 -0
  4. package/dist/auth.d.ts +60 -0
  5. package/dist/auth.js +136 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/data.d.ts +25 -0
  8. package/dist/data.js +73 -0
  9. package/dist/data.js.map +1 -0
  10. package/dist/examples.d.ts +6 -0
  11. package/dist/examples.js +47 -0
  12. package/dist/examples.js.map +1 -0
  13. package/dist/hooks.d.ts +58 -0
  14. package/dist/hooks.js +109 -0
  15. package/dist/hooks.js.map +1 -0
  16. package/dist/index.d.ts +20 -0
  17. package/dist/index.js +21 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/layouts.d.ts +6 -0
  20. package/dist/layouts.js +34 -0
  21. package/dist/layouts.js.map +1 -0
  22. package/dist/line-flow/bus.d.ts +13 -0
  23. package/dist/line-flow/bus.js +52 -0
  24. package/dist/line-flow/bus.js.map +1 -0
  25. package/dist/line-flow/derived-line.d.ts +21 -0
  26. package/dist/line-flow/derived-line.js +122 -0
  27. package/dist/line-flow/derived-line.js.map +1 -0
  28. package/dist/line-flow/errors.d.ts +62 -0
  29. package/dist/line-flow/errors.js +91 -0
  30. package/dist/line-flow/errors.js.map +1 -0
  31. package/dist/line-flow/event-line.d.ts +16 -0
  32. package/dist/line-flow/event-line.js +81 -0
  33. package/dist/line-flow/event-line.js.map +1 -0
  34. package/dist/line-flow/index.d.ts +11 -0
  35. package/dist/line-flow/index.js +11 -0
  36. package/dist/line-flow/index.js.map +1 -0
  37. package/dist/line-flow/interchange.d.ts +17 -0
  38. package/dist/line-flow/interchange.js +86 -0
  39. package/dist/line-flow/interchange.js.map +1 -0
  40. package/dist/line-flow/lineflow.d.ts +12 -0
  41. package/dist/line-flow/lineflow.js +15 -0
  42. package/dist/line-flow/lineflow.js.map +1 -0
  43. package/dist/line-flow/network.d.ts +28 -0
  44. package/dist/line-flow/network.js +165 -0
  45. package/dist/line-flow/network.js.map +1 -0
  46. package/dist/line-flow/react/bridge.d.ts +23 -0
  47. package/dist/line-flow/react/bridge.js +40 -0
  48. package/dist/line-flow/react/bridge.js.map +1 -0
  49. package/dist/line-flow/react/hooks.d.ts +29 -0
  50. package/dist/line-flow/react/hooks.js +117 -0
  51. package/dist/line-flow/react/hooks.js.map +1 -0
  52. package/dist/line-flow/react/index.d.ts +3 -0
  53. package/dist/line-flow/react/index.js +4 -0
  54. package/dist/line-flow/react/index.js.map +1 -0
  55. package/dist/line-flow/react/provider.d.ts +15 -0
  56. package/dist/line-flow/react/provider.js +25 -0
  57. package/dist/line-flow/react/provider.js.map +1 -0
  58. package/dist/line-flow/scope.d.ts +21 -0
  59. package/dist/line-flow/scope.js +157 -0
  60. package/dist/line-flow/scope.js.map +1 -0
  61. package/dist/line-flow/state-line.d.ts +21 -0
  62. package/dist/line-flow/state-line.js +106 -0
  63. package/dist/line-flow/state-line.js.map +1 -0
  64. package/dist/line-flow/taxi.d.ts +15 -0
  65. package/dist/line-flow/taxi.js +81 -0
  66. package/dist/line-flow/taxi.js.map +1 -0
  67. package/dist/line-flow/types.d.ts +222 -0
  68. package/dist/line-flow/types.js +2 -0
  69. package/dist/line-flow/types.js.map +1 -0
  70. package/dist/line-flow/utils.d.ts +24 -0
  71. package/dist/line-flow/utils.js +53 -0
  72. package/dist/line-flow/utils.js.map +1 -0
  73. package/dist/paramsSerializer.d.ts +87 -0
  74. package/dist/paramsSerializer.js +138 -0
  75. package/dist/paramsSerializer.js.map +1 -0
  76. package/dist/registry.d.ts +10 -0
  77. package/dist/registry.js +115 -0
  78. package/dist/registry.js.map +1 -0
  79. package/dist/runtime.d.ts +80 -0
  80. package/dist/runtime.js +442 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/schemas.d.ts +88 -0
  83. package/dist/schemas.js +146 -0
  84. package/dist/schemas.js.map +1 -0
  85. package/dist/services.d.ts +35 -0
  86. package/dist/services.js +65 -0
  87. package/dist/services.js.map +1 -0
  88. package/dist/shared-types/file.types.d.ts +12 -0
  89. package/dist/shared-types/file.types.js +2 -0
  90. package/dist/shared-types/file.types.js.map +1 -0
  91. package/dist/shared-types/gallery.types.d.ts +22 -0
  92. package/dist/shared-types/gallery.types.js +2 -0
  93. package/dist/shared-types/gallery.types.js.map +1 -0
  94. package/dist/shared-types/governorates.types.d.ts +12 -0
  95. package/dist/shared-types/governorates.types.js +2 -0
  96. package/dist/shared-types/governorates.types.js.map +1 -0
  97. package/dist/shared-types/grade.types.d.ts +7 -0
  98. package/dist/shared-types/grade.types.js +2 -0
  99. package/dist/shared-types/grade.types.js.map +1 -0
  100. package/dist/shared-types/index.d.ts +13 -0
  101. package/dist/shared-types/index.js +14 -0
  102. package/dist/shared-types/index.js.map +1 -0
  103. package/dist/shared-types/metadata.types.d.ts +61 -0
  104. package/dist/shared-types/metadata.types.js +3 -0
  105. package/dist/shared-types/metadata.types.js.map +1 -0
  106. package/dist/shared-types/table.types.d.ts +33 -0
  107. package/dist/shared-types/table.types.js +2 -0
  108. package/dist/shared-types/table.types.js.map +1 -0
  109. package/dist/shared-types/viewCard.types.d.ts +78 -0
  110. package/dist/shared-types/viewCard.types.js +3 -0
  111. package/dist/shared-types/viewCard.types.js.map +1 -0
  112. package/dist/styles.css +347 -0
  113. package/dist/types.d.ts +126 -0
  114. package/dist/types.js +19 -0
  115. package/dist/types.js.map +1 -0
  116. package/dist/utils/conditionCompiler.d.ts +11 -0
  117. package/dist/utils/conditionCompiler.js +18 -0
  118. package/dist/utils/conditionCompiler.js.map +1 -0
  119. package/dist/utils/fileUtils.d.ts +50 -0
  120. package/dist/utils/fileUtils.js +266 -0
  121. package/dist/utils/fileUtils.js.map +1 -0
  122. package/dist/utils/metadataUtils.d.ts +35 -0
  123. package/dist/utils/metadataUtils.js +176 -0
  124. package/dist/utils/metadataUtils.js.map +1 -0
  125. package/dist/utils/normalizeTime.d.ts +1 -0
  126. package/dist/utils/normalizeTime.js +25 -0
  127. package/dist/utils/normalizeTime.js.map +1 -0
  128. package/dist/utils/tableUtils.d.ts +9 -0
  129. package/dist/utils/tableUtils.js +92 -0
  130. package/dist/utils/tableUtils.js.map +1 -0
  131. package/dist/utils/toFormData.d.ts +152 -0
  132. package/dist/utils/toFormData.js +250 -0
  133. package/dist/utils/toFormData.js.map +1 -0
  134. package/dist/utils/wizard.utils.d.ts +420 -0
  135. package/dist/utils/wizard.utils.js +596 -0
  136. package/dist/utils/wizard.utils.js.map +1 -0
  137. package/package.json +49 -3
  138. package/README.md +0 -3
@@ -0,0 +1,347 @@
1
+ :root {
2
+ --gs-sidebar-width: 240px;
3
+ --color-dashboard-primary: #036268;
4
+ --color-dashboard-background: #f4f6f6;
5
+ --color-dashboard-card: #fff;
6
+ --color-dashboard-foreground: #183132;
7
+ --color-dashboard-muted-foreground: #647777;
8
+ --color-dashboard-secondary: #e8eeee;
9
+ --color-dashboard-border: #dce5e4;
10
+ --color-dashboard-sidebar: #f0f5f4;
11
+ --color-dashboard-sidebar-foreground: #274b4c;
12
+ font-family: Inter, Arial, sans-serif;
13
+ color: var(--color-dashboard-foreground);
14
+ background: var(--color-dashboard-background);
15
+ }
16
+ .dark {
17
+ --color-dashboard-background: #0f1415;
18
+ --color-dashboard-card: #171d1e;
19
+ --color-dashboard-foreground: #e6eeee;
20
+ --color-dashboard-muted-foreground: #95a6a7;
21
+ --color-dashboard-secondary: #243032;
22
+ --color-dashboard-border: #2a3839;
23
+ --color-dashboard-sidebar: #111c1d;
24
+ --color-dashboard-sidebar-foreground: #c3d2d3;
25
+ }
26
+ * {
27
+ box-sizing: border-box;
28
+ }
29
+ body {
30
+ margin: 0;
31
+ }
32
+ button,
33
+ input,
34
+ select,
35
+ textarea {
36
+ font: inherit;
37
+ }
38
+ button,
39
+ a,
40
+ input,
41
+ textarea,
42
+ select {
43
+ outline-offset: 3px;
44
+ }
45
+ a {
46
+ color: inherit;
47
+ text-decoration: none;
48
+ }
49
+ button {
50
+ cursor: pointer;
51
+ }
52
+ button:disabled {
53
+ cursor: default;
54
+ opacity: 0.55;
55
+ }
56
+ html[dir="rtl"] {
57
+ font-family: Cairo, Tahoma, Arial, sans-serif;
58
+ }
59
+ .gs-shell {
60
+ height: 100dvh;
61
+ display: flex;
62
+ flex-direction: column;
63
+ font-size: 12px;
64
+ }
65
+ .gs-topbar {
66
+ height: 44px;
67
+ flex-shrink: 0;
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 14px;
71
+ padding: 0 16px;
72
+ border-bottom: 1px solid var(--color-dashboard-border);
73
+ background: var(--color-dashboard-card);
74
+ }
75
+ .gs-icon-button {
76
+ border: 0;
77
+ background: transparent;
78
+ color: inherit;
79
+ min-width: 30px;
80
+ min-height: 30px;
81
+ border-radius: 6px;
82
+ }
83
+ .gs-icon-button:hover {
84
+ background: var(--color-dashboard-secondary);
85
+ }
86
+ .gs-brand {
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 8px;
90
+ font-size: 14px;
91
+ font-weight: 700;
92
+ }
93
+ .gs-brand img {
94
+ width: 24px;
95
+ height: 24px;
96
+ object-fit: contain;
97
+ }
98
+ .gs-mark {
99
+ display: grid;
100
+ place-items: center;
101
+ width: 24px;
102
+ height: 24px;
103
+ border-radius: 7px;
104
+ background: var(--color-dashboard-primary);
105
+ color: white;
106
+ }
107
+ .gs-header-slot {
108
+ flex: 1;
109
+ }
110
+ .gs-body {
111
+ display: flex;
112
+ flex: 1;
113
+ min-height: 0;
114
+ }
115
+ .gs-sidebar {
116
+ width: var(--gs-sidebar-width);
117
+ flex-shrink: 0;
118
+ display: flex;
119
+ flex-direction: column;
120
+ padding: 16px 12px;
121
+ background: var(--color-dashboard-sidebar);
122
+ color: var(--color-dashboard-sidebar-foreground);
123
+ border-inline-end: 1px solid var(--color-dashboard-border);
124
+ }
125
+ .gs-sidebar nav {
126
+ overflow: auto;
127
+ }
128
+ .gs-workspace-label {
129
+ display: flex;
130
+ align-items: center;
131
+ gap: 10px;
132
+ padding: 4px 6px 24px;
133
+ }
134
+ .gs-workspace-label small {
135
+ display: block;
136
+ color: var(--color-dashboard-muted-foreground);
137
+ margin-top: 4px;
138
+ }
139
+ .gs-workspace-avatar {
140
+ display: grid;
141
+ place-items: center;
142
+ width: 34px;
143
+ height: 34px;
144
+ background: var(--color-dashboard-primary);
145
+ color: #fff;
146
+ border-radius: 9px;
147
+ font-weight: 600;
148
+ }
149
+ .gs-nav-section {
150
+ margin-top: 20px;
151
+ }
152
+ .gs-nav-section h2 {
153
+ font-size: 10px;
154
+ text-transform: uppercase;
155
+ letter-spacing: 0.08em;
156
+ color: var(--color-dashboard-muted-foreground);
157
+ margin: 0 10px 8px;
158
+ }
159
+ .gs-nav-link {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 10px;
163
+ padding: 9px 10px;
164
+ border-radius: 6px;
165
+ margin: 2px 0;
166
+ }
167
+ .gs-nav-link:hover,
168
+ .gs-nav-link.active {
169
+ background: var(--color-dashboard-secondary);
170
+ }
171
+ .gs-nav-link.active {
172
+ color: var(--color-dashboard-primary);
173
+ font-weight: 600;
174
+ }
175
+ .dark .gs-nav-link.active {
176
+ color: #69cccc;
177
+ }
178
+ .gs-nav-dot {
179
+ width: 6px;
180
+ height: 6px;
181
+ border: 1px solid currentColor;
182
+ border-radius: 2px;
183
+ }
184
+ .gs-nav-children {
185
+ padding-inline-start: 15px;
186
+ }
187
+ .gs-sidebar-footer {
188
+ margin-top: auto;
189
+ padding: 20px 8px 0;
190
+ color: var(--color-dashboard-muted-foreground);
191
+ font-size: 10px;
192
+ }
193
+ .gs-main {
194
+ flex: 1;
195
+ min-width: 0;
196
+ overflow: auto;
197
+ }
198
+ .gs-breadcrumbs {
199
+ padding: 14px 24px;
200
+ border-bottom: 1px solid var(--color-dashboard-border);
201
+ color: var(--color-dashboard-muted-foreground);
202
+ background: var(--color-dashboard-card);
203
+ }
204
+ .gs-content {
205
+ padding: 24px;
206
+ }
207
+ .gs-welcome {
208
+ max-width: 1000px;
209
+ margin: 48px auto;
210
+ }
211
+ .gs-eyebrow {
212
+ font-size: 11px;
213
+ letter-spacing: 0.18em;
214
+ color: var(--color-dashboard-primary);
215
+ font-weight: 700;
216
+ }
217
+ .gs-welcome h1 {
218
+ font-size: 32px;
219
+ letter-spacing: -0.03em;
220
+ margin: 12px 0;
221
+ }
222
+ .gs-welcome p {
223
+ font-size: 14px;
224
+ color: var(--color-dashboard-muted-foreground);
225
+ line-height: 1.8;
226
+ }
227
+ .gs-modules {
228
+ display: grid;
229
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
230
+ gap: 16px;
231
+ margin-top: 32px;
232
+ }
233
+ .gs-module-card {
234
+ display: flex;
235
+ flex-direction: column;
236
+ gap: 12px;
237
+ border: 1px solid var(--color-dashboard-border);
238
+ padding: 24px;
239
+ border-radius: 10px;
240
+ background: var(--color-dashboard-card);
241
+ }
242
+ .gs-module-card:hover {
243
+ border-color: var(--color-dashboard-primary);
244
+ }
245
+ .gs-module-card strong {
246
+ font-size: 16px;
247
+ }
248
+ .gs-module-card span {
249
+ color: var(--color-dashboard-muted-foreground);
250
+ }
251
+ .gs-state {
252
+ padding: 64px 24px;
253
+ text-align: center;
254
+ }
255
+ .gs-site > header {
256
+ padding: 16px 24px;
257
+ display: flex;
258
+ justify-content: space-between;
259
+ border-bottom: 1px solid var(--color-dashboard-border);
260
+ }
261
+ .gs-site > main {
262
+ padding: 24px;
263
+ }
264
+ .gs-auth-layout {
265
+ min-height: 75vh;
266
+ display: grid;
267
+ place-items: center;
268
+ }
269
+ .gs-login {
270
+ width: min(100%, 380px);
271
+ display: grid;
272
+ gap: 20px;
273
+ padding: 32px;
274
+ border: 1px solid var(--color-dashboard-border);
275
+ background: var(--color-dashboard-card);
276
+ border-radius: 12px;
277
+ }
278
+ .gs-login h1 {
279
+ font-size: 24px;
280
+ margin: 0;
281
+ }
282
+ .gs-login label {
283
+ display: grid;
284
+ gap: 8px;
285
+ }
286
+ .gs-login input {
287
+ border: 1px solid var(--color-dashboard-border);
288
+ background: var(--color-dashboard-background);
289
+ color: inherit;
290
+ padding: 10px;
291
+ border-radius: 6px;
292
+ min-width: 0;
293
+ }
294
+ .gs-login button {
295
+ padding: 10px;
296
+ border: 0;
297
+ border-radius: 6px;
298
+ background: var(--color-dashboard-primary);
299
+ color: white;
300
+ }
301
+ .gs-backdrop {
302
+ display: none;
303
+ }
304
+ @media (min-width: 901px) {
305
+ .gs-topbar > .gs-icon-button:first-child {
306
+ display: none;
307
+ }
308
+ }
309
+ @media (max-width: 900px) {
310
+ .gs-sidebar {
311
+ display: none;
312
+ }
313
+ .gs-sidebar.is-open {
314
+ display: flex;
315
+ position: fixed;
316
+ inset-block: 44px 0;
317
+ inset-inline-start: 0;
318
+ z-index: 30;
319
+ }
320
+ .gs-backdrop {
321
+ display: block;
322
+ position: fixed;
323
+ inset: 44px 0 0;
324
+ background: #0006;
325
+ z-index: 20;
326
+ border: 0;
327
+ }
328
+ .gs-content {
329
+ padding: 16px;
330
+ }
331
+ .gs-breadcrumbs {
332
+ padding: 12px 16px;
333
+ }
334
+ .gs-welcome {
335
+ margin: 24px auto;
336
+ }
337
+ .gs-welcome h1 {
338
+ font-size: 27px;
339
+ }
340
+ .gs-topbar {
341
+ gap: 8px;
342
+ padding: 0 10px;
343
+ }
344
+ .gs-modules {
345
+ grid-template-columns: 1fr;
346
+ }
347
+ }
@@ -0,0 +1,126 @@
1
+ import type { ComponentType, ReactNode } from "react";
2
+ import type { i18n } from "i18next";
3
+ import type { QueryClient } from "@tanstack/react-query";
4
+ import type { AuthAdapter, AuthSession } from "./auth";
5
+ import type { HttpClient } from "./api";
6
+ import type { LineFlowNetwork } from "./line-flow/types.js";
7
+ export interface AccessRule {
8
+ requiresAuth?: boolean;
9
+ roles?: string[];
10
+ permissions?: string[];
11
+ requireAllPermissions?: boolean;
12
+ }
13
+ export interface RouteConfig extends AccessRule {
14
+ path?: string;
15
+ index?: boolean;
16
+ lazy?: () => Promise<{
17
+ default: ComponentType;
18
+ }>;
19
+ element?: ReactNode;
20
+ children?: RouteConfig[];
21
+ errorElement?: ReactNode;
22
+ meta?: {
23
+ title?: string;
24
+ titleKey?: string;
25
+ requiresAuth?: boolean;
26
+ };
27
+ handle?: Record<string, unknown>;
28
+ }
29
+ export interface NavItem extends AccessRule {
30
+ key: string;
31
+ label: string;
32
+ labelKey?: string;
33
+ href: string;
34
+ icon?: ComponentType<{
35
+ size?: number;
36
+ className?: string;
37
+ }>;
38
+ order?: number;
39
+ children?: NavItem[];
40
+ }
41
+ export interface ModuleDefinition extends AccessRule {
42
+ kind: "module";
43
+ id: string;
44
+ basePath: string;
45
+ layout: string;
46
+ label: string;
47
+ labelKey?: string;
48
+ order?: number;
49
+ enabled?: boolean;
50
+ layoutComponent?: ComponentType<LayoutProps>;
51
+ }
52
+ export interface FeatureDefinition extends AccessRule {
53
+ kind: "feature";
54
+ id: string;
55
+ basePath: string;
56
+ routes: RouteConfig[];
57
+ nav?: NavItem | NavItem[];
58
+ paths?: Record<string, string | ((...args: never[]) => string)>;
59
+ enabled?: boolean;
60
+ layout?: string;
61
+ }
62
+ export declare const defineModule: (value: Omit<ModuleDefinition, "kind">) => ModuleDefinition;
63
+ export declare const defineFeature: (value: Omit<FeatureDefinition, "kind">) => FeatureDefinition;
64
+ export interface Manifest {
65
+ definitions: {
66
+ file: string;
67
+ definition: ModuleDefinition | FeatureDefinition;
68
+ }[];
69
+ locales: {
70
+ file: string;
71
+ data: Record<string, unknown>;
72
+ }[];
73
+ }
74
+ export interface RegisteredFeature extends FeatureDefinition {
75
+ module: ModuleDefinition;
76
+ ancestors: ModuleDefinition[];
77
+ qualifiedId: string;
78
+ namespace: string;
79
+ source: string;
80
+ }
81
+ export interface Registry {
82
+ modules: ModuleDefinition[];
83
+ features: RegisteredFeature[];
84
+ resources: Record<string, Record<string, Record<string, unknown>>>;
85
+ }
86
+ export interface LayoutProps {
87
+ children?: ReactNode;
88
+ }
89
+ export interface GoStackSlots {
90
+ header?: ReactNode;
91
+ sidebarFooter?: ReactNode;
92
+ login?: ComponentType;
93
+ loading?: ComponentType;
94
+ unauthorized?: ComponentType;
95
+ notFound?: ComponentType;
96
+ error?: ComponentType<{
97
+ error: Error;
98
+ reset: () => void;
99
+ }>;
100
+ }
101
+ export interface AppConfig {
102
+ name: string;
103
+ id?: string;
104
+ logo?: string;
105
+ defaultLanguage?: string;
106
+ languages?: string[];
107
+ defaultTheme?: "light" | "dark" | "system";
108
+ theme?: Record<string, string>;
109
+ layouts: Record<string, ComponentType<LayoutProps>>;
110
+ slots?: GoStackSlots;
111
+ auth?: {
112
+ adapter: AuthAdapter;
113
+ loginPath?: string;
114
+ homePath?: string;
115
+ } | false;
116
+ api?: HttpClient;
117
+ queryClient?: QueryClient;
118
+ i18n?: i18n;
119
+ lineFlow?: LineFlowNetwork;
120
+ providers?: ComponentType<{
121
+ children: ReactNode;
122
+ }>;
123
+ onError?: (error: Error, context: string) => void;
124
+ }
125
+ export declare const defineApp: (config: AppConfig) => AppConfig;
126
+ export declare function canAccess(rule: AccessRule, session: AuthSession | null): boolean;
package/dist/types.js ADDED
@@ -0,0 +1,19 @@
1
+ export const defineModule = (value) => ({ ...value, kind: "module" });
2
+ export const defineFeature = (value) => ({ ...value, kind: "feature" });
3
+ export const defineApp = (config) => config;
4
+ export function canAccess(rule, session) {
5
+ const protectedRule = rule.requiresAuth || !!rule.roles?.length || !!rule.permissions?.length;
6
+ if (protectedRule && !session)
7
+ return false;
8
+ if (rule.roles?.length &&
9
+ !rule.roles.some((role) => session?.roles.includes(role)))
10
+ return false;
11
+ if (rule.permissions?.length) {
12
+ const test = (permission) => !!session?.permissions.includes(permission);
13
+ return rule.requireAllPermissions
14
+ ? rule.permissions.every(test)
15
+ : rule.permissions.some(test);
16
+ }
17
+ return true;
18
+ }
19
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqDA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAqC,EACnB,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAsC,EACnB,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAoDxD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAiB,EAAa,EAAE,CAAC,MAAM,CAAC;AAClE,MAAM,UAAU,SAAS,CACvB,IAAgB,EAChB,OAA2B;IAE3B,MAAM,aAAa,GACjB,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAC1E,IAAI,aAAa,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC5C,IACE,IAAI,CAAC,KAAK,EAAE,MAAM;QAClB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEzD,OAAO,KAAK,CAAC;IACf,IAAI,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,CAAC,UAAkB,EAAE,EAAE,CAClC,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,qBAAqB;YAC/B,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;YAC9B,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Filter Condition Builder Engine
3
+ * Supports Open/Closed Principle: extensible filter operators
4
+ */
5
+ export type FilterOperator = "=" | "!=" | "like" | "in" | "gt" | "lt" | "between";
6
+ export interface FilterCondition {
7
+ field: string;
8
+ operator: FilterOperator;
9
+ value: string | number | boolean | (string | number)[];
10
+ }
11
+ export declare function compileFilterCondition(condition: FilterCondition): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Filter Condition Builder Engine
3
+ * Supports Open/Closed Principle: extensible filter operators
4
+ */
5
+ export function compileFilterCondition(condition) {
6
+ const { field, operator, value } = condition;
7
+ if (value === null || value === undefined || value === "") {
8
+ return "";
9
+ }
10
+ if (operator === "in" && Array.isArray(value)) {
11
+ return `${field}[operator]=in&${field}[value]=${value.map(encodeURIComponent).join(",")}`;
12
+ }
13
+ if (operator === "between" && Array.isArray(value) && value.length === 2) {
14
+ return `${field}[operator]=between&${field}[from]=${encodeURIComponent(value[0])}&${field}[to]=${encodeURIComponent(value[1])}`;
15
+ }
16
+ return `${field}[operator]=${operator}&${field}[value]=${encodeURIComponent(String(value))}`;
17
+ }
18
+ //# sourceMappingURL=conditionCompiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionCompiler.js","sourceRoot":"","sources":["../../src/utils/conditionCompiler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,UAAU,sBAAsB,CAAC,SAA0B;IAC/D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;IAE7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,GAAG,KAAK,iBAAiB,KAAK,WAAW,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5F,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzE,OAAO,GAAG,KAAK,sBAAsB,KAAK,UAAU,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClI,CAAC;IAED,OAAO,GAAG,KAAK,cAAc,QAAQ,IAAI,KAAK,WAAW,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * File utility functions for downloading and handling files
3
+ */
4
+ import { AttachmentFile } from "../shared-types";
5
+ /**
6
+ * Downloads a single file from a URL
7
+ * Uses fetch to get the blob and creates a temporary anchor element
8
+ */
9
+ export declare function downloadFile(file: AttachmentFile): Promise<void>;
10
+ /**
11
+ * Downloads multiple files sequentially with a small delay between each
12
+ * to prevent browser blocking
13
+ */
14
+ export declare function downloadFiles(files: AttachmentFile[], delayMs?: number): Promise<{
15
+ success: number;
16
+ failed: number;
17
+ }>;
18
+ /**
19
+ * Formats file size to human readable format
20
+ */
21
+ export declare function formatFileSize(bytes: number): string;
22
+ /**
23
+ * Gets file extension from filename
24
+ */
25
+ export declare function getFileExtension(fileName: string): string;
26
+ /**
27
+ * Gets icon type based on file type/extension
28
+ */
29
+ export declare function getFileIconType(fileType: string): "pdf" | "image" | "document" | "other";
30
+ /**
31
+ * Export generic array data to a CSV file
32
+ */
33
+ export declare function exportToCSV<T>(data: T[], columns: {
34
+ header: string;
35
+ accessor: keyof T | ((row: T) => any);
36
+ }[], filename?: string): void;
37
+ /**
38
+ * Export generic array data to an Excel (.xlsx) file
39
+ */
40
+ export declare function exportToExcel<T>(data: T[], columns: {
41
+ header: string;
42
+ accessor: keyof T | ((row: T) => any);
43
+ }[], filename?: string): Promise<void>;
44
+ /**
45
+ * Opens a native print dialog with a cleanly formatted HTML table of the data
46
+ */
47
+ export declare function exportToPrint<T>(data: T[], columns: {
48
+ header: string;
49
+ accessor: keyof T | ((row: T) => any);
50
+ }[], title?: string): void;