@llmnative/react 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 (150) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +375 -0
  3. package/bin/cli.js +99 -0
  4. package/dist/index.css +1 -0
  5. package/dist/index.js +838 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +12161 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/types/src/App.d.ts +64 -0
  10. package/dist/types/src/Config.d.ts +65 -0
  11. package/dist/types/src/Global.d.ts +12 -0
  12. package/dist/types/src/Head.d.ts +193 -0
  13. package/dist/types/src/Theme.d.ts +335 -0
  14. package/dist/types/src/auth.d.ts +27 -0
  15. package/dist/types/src/components/Component.d.ts +55 -0
  16. package/dist/types/src/components/FormEnhancer.d.ts +26 -0
  17. package/dist/types/src/components/Template.d.ts +18 -0
  18. package/dist/types/src/components/blocks/Brand.d.ts +14 -0
  19. package/dist/types/src/components/blocks/Breadcrumbs.d.ts +8 -0
  20. package/dist/types/src/components/blocks/Carousel.d.ts +19 -0
  21. package/dist/types/src/components/blocks/Dropdown.d.ts +64 -0
  22. package/dist/types/src/components/blocks/Menu.d.ts +24 -0
  23. package/dist/types/src/components/blocks/Notifications.d.ts +15 -0
  24. package/dist/types/src/components/blocks/Search.d.ts +7 -0
  25. package/dist/types/src/components/index.d.ts +52 -0
  26. package/dist/types/src/components/types.d.ts +11 -0
  27. package/dist/types/src/components/ui/Alert.d.ts +13 -0
  28. package/dist/types/src/components/ui/Badge.d.ts +27 -0
  29. package/dist/types/src/components/ui/Buttons.d.ts +57 -0
  30. package/dist/types/src/components/ui/Card.d.ts +15 -0
  31. package/dist/types/src/components/ui/Code.d.ts +25 -0
  32. package/dist/types/src/components/ui/Gallery.d.ts +55 -0
  33. package/dist/types/src/components/ui/GridSystem.d.ts +21 -0
  34. package/dist/types/src/components/ui/Icon.d.ts +13 -0
  35. package/dist/types/src/components/ui/Image.d.ts +19 -0
  36. package/dist/types/src/components/ui/ImageAvatar.d.ts +16 -0
  37. package/dist/types/src/components/ui/LayoutBuilder.d.ts +19 -0
  38. package/dist/types/src/components/ui/Loader.d.ts +11 -0
  39. package/dist/types/src/components/ui/Modal.d.ts +39 -0
  40. package/dist/types/src/components/ui/Pagination.d.ts +18 -0
  41. package/dist/types/src/components/ui/Percentage.d.ts +19 -0
  42. package/dist/types/src/components/ui/Repeat.d.ts +18 -0
  43. package/dist/types/src/components/ui/Tab.d.ts +20 -0
  44. package/dist/types/src/components/ui/TabDynamic.d.ts +20 -0
  45. package/dist/types/src/components/ui/Table.d.ts +43 -0
  46. package/dist/types/src/components/ui/fields/AssistantAI.d.ts +23 -0
  47. package/dist/types/src/components/ui/fields/Command.d.ts +15 -0
  48. package/dist/types/src/components/ui/fields/Crop.d.ts +27 -0
  49. package/dist/types/src/components/ui/fields/ImageUrl.d.ts +7 -0
  50. package/dist/types/src/components/ui/fields/Input.d.ts +62 -0
  51. package/dist/types/src/components/ui/fields/Prompt.d.ts +31 -0
  52. package/dist/types/src/components/ui/fields/Select.d.ts +38 -0
  53. package/dist/types/src/components/ui/fields/Upload.d.ts +25 -0
  54. package/dist/types/src/components/ui/fields/UploadCSV.d.ts +26 -0
  55. package/dist/types/src/components/ui/useRecordSelection.d.ts +20 -0
  56. package/dist/types/src/components/ui/useStableRecordKey.d.ts +5 -0
  57. package/dist/types/src/components/widgets/Form.d.ts +129 -0
  58. package/dist/types/src/components/widgets/Grid.d.ts +6 -0
  59. package/dist/types/src/components/widgets/ImageEditor.d.ts +14 -0
  60. package/dist/types/src/components/widgets/MarkdownReader.d.ts +14 -0
  61. package/dist/types/src/components/widgets/Prompt.d.ts +31 -0
  62. package/dist/types/src/components/widgets/TabDynamic.d.ts +20 -0
  63. package/dist/types/src/components/widgets/grid-core/GridArray.d.ts +5 -0
  64. package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +5 -0
  65. package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +5 -0
  66. package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +5 -0
  67. package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +5 -0
  68. package/dist/types/src/components/widgets/grid-core/index.d.ts +7 -0
  69. package/dist/types/src/components/widgets/grid-core/resolveGridPathFromUrl.d.ts +1 -0
  70. package/dist/types/src/components/widgets/grid-core/types.d.ts +227 -0
  71. package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +49 -0
  72. package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +10 -0
  73. package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +10 -0
  74. package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +10 -0
  75. package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +13 -0
  76. package/dist/types/src/components/widgets/grid-core/utils.d.ts +14 -0
  77. package/dist/types/src/conf/Prompt.d.ts +84 -0
  78. package/dist/types/src/constant.d.ts +96 -0
  79. package/dist/types/src/index.d.ts +56 -0
  80. package/dist/types/src/libs/cache.d.ts +9 -0
  81. package/dist/types/src/libs/cn.d.ts +2 -0
  82. package/dist/types/src/libs/converter.d.ts +28 -0
  83. package/dist/types/src/libs/database.d.ts +3 -0
  84. package/dist/types/src/libs/email.d.ts +16 -0
  85. package/dist/types/src/libs/fetch.d.ts +9 -0
  86. package/dist/types/src/libs/imageBuilder.d.ts +112 -0
  87. package/dist/types/src/libs/index.d.ts +14 -0
  88. package/dist/types/src/libs/locale.d.ts +24 -0
  89. package/dist/types/src/libs/log.d.ts +2 -0
  90. package/dist/types/src/libs/order.d.ts +14 -0
  91. package/dist/types/src/libs/path.d.ts +26 -0
  92. package/dist/types/src/libs/sanitizer.d.ts +38 -0
  93. package/dist/types/src/libs/seo.d.ts +8 -0
  94. package/dist/types/src/libs/storage.d.ts +2 -0
  95. package/dist/types/src/libs/utils.d.ts +57 -0
  96. package/dist/types/src/motion.d.ts +38 -0
  97. package/dist/types/src/pages/Blog.d.ts +3 -0
  98. package/dist/types/src/pages/BlogPost.d.ts +16 -0
  99. package/dist/types/src/pages/Helper.d.ts +8 -0
  100. package/dist/types/src/pages/NotFound.d.ts +3 -0
  101. package/dist/types/src/pages/Users.d.ts +3 -0
  102. package/dist/types/src/pages/index.d.ts +3 -0
  103. package/dist/types/src/providers/ProviderConfiguration.d.ts +12 -0
  104. package/dist/types/src/providers/ai/index.d.ts +134 -0
  105. package/dist/types/src/providers/auth/AuthProvider.d.ts +22 -0
  106. package/dist/types/src/providers/auth/AuthProviderContext.d.ts +12 -0
  107. package/dist/types/src/providers/auth/dropbox/DropboxAuthProvider.d.ts +16 -0
  108. package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +44 -0
  109. package/dist/types/src/providers/auth/google/GoogleAuthProvider.d.ts +12 -0
  110. package/dist/types/src/providers/auth/google/apis/auth.d.ts +4 -0
  111. package/dist/types/src/providers/auth/google/auth.d.ts +3 -0
  112. package/dist/types/src/providers/data/DataProvider.d.ts +58 -0
  113. package/dist/types/src/providers/data/DataProviderContext.d.ts +12 -0
  114. package/dist/types/src/providers/data/firebase.d.ts +21 -0
  115. package/dist/types/src/providers/data/mock.d.ts +20 -0
  116. package/dist/types/src/providers/data/supabase.d.ts +19 -0
  117. package/dist/types/src/providers/email/EmailProvider.d.ts +10 -0
  118. package/dist/types/src/providers/email/EmailProviderContext.d.ts +12 -0
  119. package/dist/types/src/providers/email/google/GmailEmailProvider.d.ts +7 -0
  120. package/dist/types/src/providers/email/google/apis/email.d.ts +7 -0
  121. package/dist/types/src/providers/email/google/email.d.ts +13 -0
  122. package/dist/types/src/providers/firebase-init.d.ts +10 -0
  123. package/dist/types/src/providers/icon/IconProvider.d.ts +10 -0
  124. package/dist/types/src/providers/icon/IconProviderContext.d.ts +48 -0
  125. package/dist/types/src/providers/icon/LucideIconProvider.d.ts +5 -0
  126. package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +10 -0
  127. package/dist/types/src/providers/icon/index.d.ts +6 -0
  128. package/dist/types/src/providers/manifest.d.ts +42 -0
  129. package/dist/types/src/providers/scrape/index.d.ts +10 -0
  130. package/dist/types/src/providers/seo/google/keyword.d.ts +14 -0
  131. package/dist/types/src/providers/seo/google/trend.d.ts +25 -0
  132. package/dist/types/src/providers/storage/StorageProvider.d.ts +7 -0
  133. package/dist/types/src/providers/storage/StorageProviderContext.d.ts +12 -0
  134. package/dist/types/src/providers/storage/dropbox.d.ts +48 -0
  135. package/dist/types/src/providers/storage/firebase.d.ts +13 -0
  136. package/dist/types/src/providers/storage/supabase.d.ts +19 -0
  137. package/dist/types/src/types/Block.d.ts +4 -0
  138. package/dist/types/src/types/FormFields.d.ts +33 -0
  139. package/dist/types/src/types/Layout.d.ts +9 -0
  140. package/dist/types/src/types/Section.d.ts +4 -0
  141. package/dist/types/themes/cyber.d.ts +7 -0
  142. package/dist/types/themes/default.d.ts +7 -0
  143. package/dist/types/themes/flat.d.ts +7 -0
  144. package/package.json +126 -0
  145. package/scripts/cli/create-section.js +65 -0
  146. package/scripts/cli/setup-devtools.js +85 -0
  147. package/scripts/cli/setup-project.js +484 -0
  148. package/themes/cyber.ts +405 -0
  149. package/themes/default.ts +405 -0
  150. package/themes/flat.ts +405 -0
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { AIFetchConfig } from '../../providers/ai';
3
+ import { PromptVariables } from '../../conf/Prompt';
4
+ import { FormFieldProps } from './Form';
5
+ export declare enum PromptMode {
6
+ EDITOR = "editor",
7
+ LIVE = "live"
8
+ }
9
+ type PromptOptions = AIFetchConfig & {
10
+ value: string;
11
+ };
12
+ type OnRunPrompt = (prompt: string, config: AIFetchConfig, data?: PromptVariables) => Promise<string>;
13
+ export interface PromptProps extends FormFieldProps {
14
+ mode?: PromptMode;
15
+ onRunPrompt?: OnRunPrompt;
16
+ renderPromptDisabled?: (props: Omit<FormFieldProps, "defaultValue">) => React.ReactNode;
17
+ rows?: number;
18
+ defaultValue?: {
19
+ value?: string;
20
+ enabled?: boolean;
21
+ role?: string;
22
+ language?: string;
23
+ voice?: string;
24
+ style?: string;
25
+ model?: string;
26
+ temperature?: number;
27
+ };
28
+ }
29
+ export declare const Prompt: ({ mode, onRunPrompt, renderPromptDisabled, ...props }: PromptProps) => React.JSX.Element;
30
+ export declare const runPrompt: (options: PromptOptions, data?: PromptVariables, onRunPrompt?: OnRunPrompt) => Promise<string>;
31
+ export {};
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { TabPosition } from '../ui/Tab';
3
+ import { FieldOnChange } from './Form';
4
+ interface TabDynamicProps {
5
+ children: React.ReactNode | ((record: any) => React.ReactNode);
6
+ name: string;
7
+ onChange?: FieldOnChange;
8
+ onAdd?: (value: any[]) => void;
9
+ onRemove?: (index: number) => void;
10
+ value?: any[];
11
+ label?: string;
12
+ min?: number;
13
+ max?: number;
14
+ activeIndex?: number;
15
+ title?: string;
16
+ readOnly?: boolean;
17
+ tabPosition?: TabPosition;
18
+ }
19
+ declare const TabDynamic: ({ children, name, onChange, onAdd, onRemove, label, min, max, activeIndex, title, readOnly, tabPosition }: TabDynamicProps) => React.JSX.Element;
20
+ export default TabDynamic;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridArrayProps } from "./types";
4
+ declare function GridArray<TRecord extends RecordProps>(props: GridArrayProps<TRecord>): React.JSX.Element;
5
+ export default GridArray;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridCoreProps } from "./types";
4
+ declare function GridCore<TRecord extends RecordProps>({ records, recordId, sourcePath, columns, actions, form, routeSync, header, footer, layout, sticky, wrapClass, loading, title, sortable, pagination, selection, selectedKeys, defaultSelectedKeys, onSelectionChange, onClickRow, reorderable, onReorder, groupBy, onSave, onDelete, onAfterAction, createRecordKey, audit, transformRecords, }: GridCoreProps<TRecord>): React.JSX.Element;
5
+ export default GridCore;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridDBProps } from "./types";
4
+ declare function GridDB<TRecord extends RecordProps = RecordProps>({ path, where, order, fieldMap, onLoad, recordId, ...rest }: GridDBProps<TRecord>): React.JSX.Element;
5
+ export default GridDB;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridGalleryViewProps } from "./types";
4
+ declare function GridGalleryView<TRecord extends RecordProps>({ records, recordId, sortable, pagination, selection, selectedKeys, onSelectionChange, onClickRow, groupBy, wrapClass, }: GridGalleryViewProps<TRecord>): React.JSX.Element;
5
+ export default GridGalleryView;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridTableViewProps } from "./types";
4
+ declare function GridTableView<TRecord extends RecordProps>({ records, recordId, columns, runAction, sortable, pagination, selection, selectedKeys, onSelectionChange, onClickRow, reorderable, onReorder, activeKey, wrapClass, }: GridTableViewProps<TRecord>): React.JSX.Element;
5
+ export default GridTableView;
@@ -0,0 +1,7 @@
1
+ export { default as GridCore } from "./GridCore";
2
+ export { default as GridArray } from "./GridArray";
3
+ export { default as GridDB } from "./GridDB";
4
+ export { default as GridTableView } from "./GridTableView";
5
+ export { default as GridGalleryView } from "./GridGalleryView";
6
+ export { resolveGridPathFromUrl } from "./resolveGridPathFromUrl";
7
+ export type { GridAction, GridActions, GridAfterActionArgs, GridAfterActionHandler, GridArrayProps, GridBaseProps, GridCellContext, GridColumn, GridCoreProps, GridDBPath, GridDBQuery, GridDBProps, GridFooterContext, GridFormContext, GridGalleryViewProps, GridHeaderContext, GridLayout, GridMutationDeleteArgs, GridMutationDeleteHandler, GridMutationSaveArgs, GridMutationSaveHandler, GridProps, GridReorderHandler, GridReorderMeta, GridRecordKey, GridSelectionChangeHandler, GridSelectionMode, GridSelectionState, GridSticky, GridTableViewProps, } from "./types";
@@ -0,0 +1 @@
1
+ export declare function resolveGridPathFromUrl(pathname: string): string | undefined;
@@ -0,0 +1,227 @@
1
+ import React from "react";
2
+ import { type OrderConfig } from "../../../libs/order";
3
+ import { type PaginationParams } from "../../ui/Pagination";
4
+ import { type DatabaseOptions, type RecordProps } from "../../../providers/data/DataProvider";
5
+ export type GridLayout = "table" | "gallery";
6
+ export type GridSticky = "top" | "bottom";
7
+ export type GridSelectionMode = false | "single" | "multiple";
8
+ export type GridRecordKey<TRecord> = keyof TRecord | ((record: TRecord) => string);
9
+ export type GridFormat = "text" | "email" | "date" | "datetime" | "badge" | "image" | "boolean" | "json";
10
+ export type GridCellContext<TRecord> = {
11
+ record: TRecord;
12
+ value: unknown;
13
+ key: string;
14
+ rowIndex: number;
15
+ runAction: (actionKey: string) => void;
16
+ };
17
+ export type GridColumn<TRecord> = {
18
+ key: keyof TRecord | string;
19
+ label: string;
20
+ sortable?: boolean;
21
+ className?: string;
22
+ render?: GridFormat | ((ctx: GridCellContext<TRecord>) => React.ReactNode);
23
+ };
24
+ export type GridSelectionState<TRecord> = {
25
+ keys: string[];
26
+ records: TRecord[];
27
+ hasSelection: boolean;
28
+ clear: () => void;
29
+ };
30
+ export type GridSelectionChangeHandler<TRecord> = (selection: GridSelectionState<TRecord>) => void;
31
+ export type GridReorderMeta<TRecord> = {
32
+ fromIndex: number;
33
+ toIndex: number;
34
+ record: TRecord;
35
+ };
36
+ export type GridReorderHandler<TRecord> = (records: TRecord[], meta: GridReorderMeta<TRecord>) => void;
37
+ export type GridActionContext<TRecord> = {
38
+ actionKey: string;
39
+ record?: TRecord;
40
+ recordKey?: string;
41
+ rowIndex?: number;
42
+ isNewRecord: boolean;
43
+ runAction: (actionKey: string, record?: TRecord) => void;
44
+ };
45
+ export type GridModalActionContext<TRecord> = {
46
+ actionKey: string;
47
+ record?: TRecord;
48
+ recordKey?: string;
49
+ rowIndex?: number;
50
+ isNewRecord: boolean;
51
+ runAction: (actionKey: string) => void;
52
+ };
53
+ type GridActionPredicate<TRecord> = boolean | ((record?: TRecord) => boolean);
54
+ export type GridModalAction<TRecord> = {
55
+ kind: "modal";
56
+ label?: string;
57
+ icon?: string;
58
+ visible?: GridActionPredicate<TRecord>;
59
+ disabled?: GridActionPredicate<TRecord>;
60
+ title?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
61
+ size?: "sm" | "md" | "lg" | "xl" | "fullscreen";
62
+ position?: "center" | "top" | "left" | "right" | "bottom";
63
+ buttonFullscreen?: boolean;
64
+ header?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
65
+ body?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
66
+ footer?: React.ReactNode | false | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
67
+ };
68
+ export type GridRouteAction<TRecord> = {
69
+ kind: "route";
70
+ label?: string;
71
+ icon?: string;
72
+ visible?: GridActionPredicate<TRecord>;
73
+ disabled?: GridActionPredicate<TRecord>;
74
+ to: string | ((ctx: GridActionContext<TRecord>) => string);
75
+ };
76
+ export type GridExternalAction<TRecord> = {
77
+ kind: "external";
78
+ label?: string;
79
+ icon?: string;
80
+ visible?: GridActionPredicate<TRecord>;
81
+ disabled?: GridActionPredicate<TRecord>;
82
+ href: string | ((ctx: GridActionContext<TRecord>) => string);
83
+ };
84
+ export type GridInlineAction<TRecord> = {
85
+ kind: "inline";
86
+ label?: string;
87
+ icon?: string;
88
+ visible?: GridActionPredicate<TRecord>;
89
+ disabled?: GridActionPredicate<TRecord>;
90
+ run: (ctx: GridActionContext<TRecord>) => void | Promise<void>;
91
+ };
92
+ export type GridDeleteAction<TRecord> = {
93
+ kind: "delete";
94
+ label?: string;
95
+ icon?: string;
96
+ visible?: GridActionPredicate<TRecord>;
97
+ disabled?: GridActionPredicate<TRecord>;
98
+ title?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
99
+ size?: "sm" | "md" | "lg" | "xl" | "fullscreen";
100
+ position?: "center" | "top" | "left" | "right" | "bottom";
101
+ buttonFullscreen?: boolean;
102
+ header?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
103
+ body?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
104
+ footer?: React.ReactNode | false | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
105
+ };
106
+ export type GridAction<TRecord> = GridModalAction<TRecord> | GridRouteAction<TRecord> | GridExternalAction<TRecord> | GridInlineAction<TRecord> | GridDeleteAction<TRecord>;
107
+ export type GridActions<TRecord> = Array<"add" | "edit" | "delete"> | Record<string, GridAction<TRecord> | false>;
108
+ export type GridHeaderContext<TRecord> = {
109
+ title?: React.ReactNode;
110
+ records: TRecord[];
111
+ selection: GridSelectionState<TRecord>;
112
+ runAction: (actionKey: string, record?: TRecord) => void;
113
+ };
114
+ export type GridFooterContext<TRecord> = {
115
+ records: TRecord[];
116
+ selection: GridSelectionState<TRecord>;
117
+ runAction: (actionKey: string, record?: TRecord) => void;
118
+ };
119
+ export type GridFormContext<TRecord> = GridActionContext<TRecord> & {
120
+ record: TRecord | undefined;
121
+ };
122
+ export type GridMutationSaveArgs<TRecord> = {
123
+ record?: TRecord;
124
+ action: "create" | "update";
125
+ storagePath?: string;
126
+ };
127
+ export type GridMutationSaveHandler<TRecord> = (args: GridMutationSaveArgs<TRecord>) => Promise<string | undefined>;
128
+ export type GridMutationDeleteArgs<TRecord> = {
129
+ record?: TRecord;
130
+ };
131
+ export type GridMutationDeleteHandler<TRecord> = (args: GridMutationDeleteArgs<TRecord>) => Promise<string | undefined>;
132
+ export type GridAfterActionArgs<TRecord> = {
133
+ record?: TRecord;
134
+ action: "create" | "update" | "delete";
135
+ };
136
+ export type GridAfterActionHandler<TRecord> = (args: GridAfterActionArgs<TRecord>) => Promise<boolean>;
137
+ export type GridRouteSync = {
138
+ edit?: boolean;
139
+ };
140
+ export type GridPresentation = {
141
+ layout?: GridLayout;
142
+ sticky?: GridSticky;
143
+ wrapClass?: string;
144
+ loading?: boolean;
145
+ title?: React.ReactNode;
146
+ };
147
+ export type GridBehavior<TRecord> = {
148
+ sortable?: boolean | OrderConfig;
149
+ pagination?: PaginationParams;
150
+ selection?: GridSelectionMode;
151
+ selectedKeys?: string[];
152
+ defaultSelectedKeys?: string[];
153
+ onSelectionChange?: GridSelectionChangeHandler<TRecord>;
154
+ onClickRow?: (record: TRecord) => void;
155
+ reorderable?: boolean;
156
+ onReorder?: GridReorderHandler<TRecord>;
157
+ groupBy?: keyof TRecord | string | Array<keyof TRecord | string>;
158
+ };
159
+ export type GridPersistence<TRecord> = {
160
+ onSave?: GridMutationSaveHandler<TRecord>;
161
+ onDelete?: GridMutationDeleteHandler<TRecord>;
162
+ onAfterAction?: GridAfterActionHandler<TRecord>;
163
+ createRecordKey?: (record: TRecord) => string;
164
+ audit?: boolean;
165
+ };
166
+ export type GridTransform<TRecord> = {
167
+ transformRecords?: (records: TRecord[]) => TRecord[] | Promise<TRecord[]>;
168
+ };
169
+ export type GridBaseProps<TRecord> = GridPresentation & GridBehavior<TRecord> & GridPersistence<TRecord> & GridTransform<TRecord> & {
170
+ columns?: GridColumn<TRecord>[];
171
+ actions?: GridActions<TRecord>;
172
+ form?: React.ReactElement | ((ctx: GridFormContext<TRecord>) => React.ReactNode);
173
+ routeSync?: GridRouteSync;
174
+ header?: React.ReactNode | ((ctx: GridHeaderContext<TRecord>) => React.ReactNode);
175
+ footer?: React.ReactNode | ((ctx: GridFooterContext<TRecord>) => React.ReactNode);
176
+ };
177
+ export type GridCoreProps<TRecord extends RecordProps> = GridBaseProps<TRecord> & {
178
+ records: TRecord[];
179
+ recordId: GridRecordKey<TRecord>;
180
+ sourcePath?: string;
181
+ };
182
+ export type GridArrayProps<TRecord extends RecordProps> = GridBaseProps<TRecord> & {
183
+ records: TRecord[];
184
+ recordId: GridRecordKey<TRecord>;
185
+ };
186
+ export type GridDBQuery = Pick<DatabaseOptions, "where" | "order" | "fieldMap" | "onLoad">;
187
+ export type GridDBPath = string | "fromUrl";
188
+ export type GridDBProps<TRecord extends RecordProps = RecordProps> = GridBaseProps<TRecord> & GridDBQuery & {
189
+ path: GridDBPath;
190
+ recordId?: GridRecordKey<TRecord>;
191
+ };
192
+ export type GridGatewayArrayProps<TRecord extends RecordProps> = GridArrayProps<TRecord> & {
193
+ path?: never;
194
+ };
195
+ export type GridGatewayDBProps<TRecord extends RecordProps = RecordProps> = GridDBProps<TRecord> & {
196
+ records?: never;
197
+ };
198
+ export type GridProps<TRecord extends RecordProps = RecordProps> = GridGatewayArrayProps<TRecord> | GridGatewayDBProps<TRecord>;
199
+ export type GridTableViewProps<TRecord extends RecordProps> = {
200
+ records: TRecord[];
201
+ recordId: GridRecordKey<TRecord>;
202
+ columns: GridColumn<TRecord>[];
203
+ runAction: (actionKey: string, record?: TRecord) => void;
204
+ sortable?: boolean | OrderConfig;
205
+ pagination?: PaginationParams;
206
+ selection?: GridSelectionMode;
207
+ selectedKeys?: string[];
208
+ onSelectionChange?: GridSelectionChangeHandler<TRecord>;
209
+ onClickRow?: (record: TRecord) => void;
210
+ reorderable?: boolean;
211
+ onReorder?: GridReorderHandler<TRecord>;
212
+ activeKey?: string | null;
213
+ wrapClass?: string;
214
+ };
215
+ export type GridGalleryViewProps<TRecord extends RecordProps> = {
216
+ records: TRecord[];
217
+ recordId: GridRecordKey<TRecord>;
218
+ sortable?: boolean | OrderConfig;
219
+ pagination?: PaginationParams;
220
+ selection?: GridSelectionMode;
221
+ selectedKeys?: string[];
222
+ onSelectionChange?: GridSelectionChangeHandler<TRecord>;
223
+ onClickRow?: (record: TRecord) => void;
224
+ groupBy?: keyof TRecord | string | Array<keyof TRecord | string>;
225
+ wrapClass?: string;
226
+ };
227
+ export {};
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ import { type FormRef } from "../Form";
3
+ import { type DataProviderAdapter, type RecordProps } from "../../../providers/data/DataProvider";
4
+ import { type GridAction, type GridActionContext, type GridActions, type GridFormContext, type GridModalActionContext, type GridRecordKey } from "./types";
5
+ export type GridActiveAction<TRecord extends RecordProps> = {
6
+ actionKey: string;
7
+ record?: TRecord;
8
+ };
9
+ type UseGridActionsArgs<TRecord extends RecordProps> = {
10
+ actions?: GridActions<TRecord>;
11
+ form?: React.ReactElement | ((ctx: GridFormContext<TRecord>) => React.ReactNode);
12
+ routeSync?: {
13
+ edit?: boolean;
14
+ };
15
+ preparedRecords: TRecord[];
16
+ recordId: GridRecordKey<TRecord>;
17
+ sourcePath?: string;
18
+ db: DataProviderAdapter;
19
+ onSave?: (args: {
20
+ record?: TRecord;
21
+ action: "create" | "update";
22
+ storagePath?: string;
23
+ }) => Promise<string | undefined>;
24
+ onDelete?: (args: {
25
+ record?: TRecord;
26
+ }) => Promise<string | undefined>;
27
+ onAfterAction?: (args: {
28
+ record?: TRecord;
29
+ action: "create" | "update" | "delete";
30
+ }) => Promise<boolean>;
31
+ createRecordKey?: (record: TRecord) => string;
32
+ audit?: boolean;
33
+ };
34
+ declare function useGridActions<TRecord extends RecordProps>({ actions, form, routeSync, preparedRecords, recordId, sourcePath, db, onSave, onDelete, onAfterAction, createRecordKey, audit, }: UseGridActionsArgs<TRecord>): {
35
+ normalizedActions: Record<string, GridAction<TRecord>>;
36
+ activeAction: GridActiveAction<TRecord> | null;
37
+ activeActionConfig: GridAction<TRecord> | undefined;
38
+ activeActionBody: string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
39
+ activeKey: string | null;
40
+ runAction: (actionKey: string, record?: TRecord) => Promise<void>;
41
+ runModalAction: (actionKey: string) => Promise<void>;
42
+ close: () => void;
43
+ getActionContext: (actionKey: string, record?: TRecord) => GridActionContext<TRecord>;
44
+ getModalActionContext: (actionKey: string, record?: TRecord) => GridModalActionContext<TRecord>;
45
+ getRecordKey: (record: TRecord) => string;
46
+ formRef: React.MutableRefObject<FormRef | undefined>;
47
+ gridHashId: string;
48
+ };
49
+ export default useGridActions;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { type RecordProps } from "../../../providers/data/DataProvider";
3
+ import { type GridColumn } from "./types";
4
+ type UseGridColumnsArgs<TRecord extends RecordProps> = {
5
+ columns?: GridColumn<TRecord>[];
6
+ records: TRecord[];
7
+ form?: React.ReactElement | ((ctx: any) => React.ReactNode);
8
+ };
9
+ declare function useGridColumns<TRecord extends RecordProps>({ columns, records, form, }: UseGridColumnsArgs<TRecord>): GridColumn<TRecord>[];
10
+ export default useGridColumns;
@@ -0,0 +1,10 @@
1
+ import { type DatabaseOptions, type RecordProps } from "../../../providers/data/DataProvider";
2
+ type UseGridDBRecordsArgs = {
3
+ path?: string;
4
+ where?: DatabaseOptions["where"];
5
+ order?: DatabaseOptions["order"];
6
+ fieldMap?: DatabaseOptions["fieldMap"];
7
+ onLoad?: DatabaseOptions["onLoad"];
8
+ };
9
+ declare function useGridDBRecords<TRecord extends RecordProps>({ path, where, order, fieldMap, onLoad, }: UseGridDBRecordsArgs): TRecord[];
10
+ export default useGridDBRecords;
@@ -0,0 +1,10 @@
1
+ import { type RecordProps } from "../../../providers/data/DataProvider";
2
+ type UseGridPreparedRecordsArgs<TRecord extends RecordProps> = {
3
+ records: TRecord[];
4
+ transformRecords?: (records: TRecord[]) => TRecord[] | Promise<TRecord[]>;
5
+ };
6
+ declare function useGridPreparedRecords<TRecord extends RecordProps>({ records, transformRecords, }: UseGridPreparedRecordsArgs<TRecord>): {
7
+ preparedRecords: TRecord[];
8
+ loading: boolean;
9
+ };
10
+ export default useGridPreparedRecords;
@@ -0,0 +1,13 @@
1
+ import { type RecordProps } from "../../../providers/data/DataProvider";
2
+ import { type GridSelectionState } from "./types";
3
+ type UseGridSelectionArgs<TRecord extends RecordProps> = {
4
+ selectedKeys?: string[];
5
+ defaultSelectedKeys?: string[];
6
+ onSelectionChange?: (selection: GridSelectionState<TRecord>) => void;
7
+ };
8
+ declare function useGridSelection<TRecord extends RecordProps>({ selectedKeys, defaultSelectedKeys, onSelectionChange, }: UseGridSelectionArgs<TRecord>): {
9
+ activeSelectionKeys: string[];
10
+ selectionState: GridSelectionState<TRecord>;
11
+ handleSelectionChange: (nextSelection: GridSelectionState<TRecord>) => void;
12
+ };
13
+ export default useGridSelection;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { type OrderConfig } from "../../../libs/order";
3
+ import { type RecordProps } from "../../../providers/data/DataProvider";
4
+ import { type GridAction, type GridActions, type GridColumn, type GridRecordKey } from "./types";
5
+ export declare const isExternalUrl: (value: string) => boolean;
6
+ export declare const sanitizeHashPart: (value: string) => string;
7
+ export declare const getRecordKeyResolver: <TRecord extends RecordProps>(recordId: GridRecordKey<TRecord>) => (record: TRecord) => string;
8
+ export declare const buildDisplayRecords: <TRecord extends RecordProps>(records: TRecord[], columns: GridColumn<TRecord>[], runAction: (actionKey: string, record?: TRecord) => void) => TRecord[];
9
+ export declare const inferColumns: <TRecord extends RecordProps>(columns: GridColumn<TRecord>[] | undefined, records: TRecord[], form: React.ReactElement | ((ctx: any) => React.ReactNode) | undefined) => GridColumn<TRecord>[];
10
+ export declare const normalizeActions: <TRecord extends RecordProps>(actions: GridActions<TRecord> | undefined, hasForm: boolean) => Record<string, GridAction<TRecord>>;
11
+ export declare const isActionVisible: <TRecord extends RecordProps>(action: GridAction<TRecord> | undefined, record?: TRecord) => boolean;
12
+ export declare const isActionDisabled: <TRecord extends RecordProps>(action: GridAction<TRecord> | undefined, record?: TRecord) => boolean;
13
+ export declare const getActionLabel: (actionKey: string, action: GridAction<any> | undefined) => string;
14
+ export declare const resolveInitialOrder: (sortable: boolean | OrderConfig | undefined) => OrderConfig | undefined;
@@ -0,0 +1,84 @@
1
+ export declare const PROMPT_CLEANUP = "Please ignore all previous instructions.";
2
+ export declare const PROMPT_NO_REFERENCE = "Do not repeat yourself. Do not self reference. Do not explain what you are doing.";
3
+ export declare const PROMPTS: {
4
+ SEARCH_INTENT_FROM_KEYWORDS: string;
5
+ RELATED_KEYWORD_GENERATOR: string;
6
+ LONG_TAIL_KEYWORD_GENERATOR: string;
7
+ KEYWORD_STRATEGY: string;
8
+ GENERATE_BLOG_POST_TITLES: string;
9
+ GENERATE_BLOG_POST_DESCRIPTIONS: string;
10
+ GENERATE_BLOG_POST_OUTLINE: string;
11
+ GENERATE_COMPLETE_BLOG_POST_FROM_OUTLINE: string;
12
+ GENERATE_COMPLETE_BLOG_POST_FROM_TOPIC: string;
13
+ GENERATE_INTRODUCTION_USING_FRAMEWORK: string;
14
+ GENERATE_PARAGRAPH_OF_TEXT: string;
15
+ GENERATE_DICTIONARY: string;
16
+ GENERATE_FREE: string;
17
+ };
18
+ export declare const PROMPTS_ROLE: {
19
+ SEARCH_INTENT_FROM_KEYWORDS: string[];
20
+ RELATED_KEYWORD_GENERATOR: string[];
21
+ LONG_TAIL_KEYWORD_GENERATOR: string[];
22
+ KEYWORD_STRATEGY: string[];
23
+ GENERATE_BLOG_POST_TITLES: string[];
24
+ GENERATE_BLOG_POST_DESCRIPTIONS: string[];
25
+ GENERATE_BLOG_POST_OUTLINE: string[];
26
+ GENERATE_COMPLETE_BLOG_POST_FROM_OUTLINE: string[];
27
+ GENERATE_COMPLETE_BLOG_POST_FROM_TOPIC: string[];
28
+ GENERATE_INTRODUCTION_USING_FRAMEWORK: string[];
29
+ GENERATE_PARAGRAPH_OF_TEXT: string[];
30
+ GENERATE_DICTIONARY: string[];
31
+ GENERATE_FREE: string[];
32
+ };
33
+ export declare const LABELS: {
34
+ SEARCH_INTENT_FROM_KEYWORDS: string;
35
+ RELATED_KEYWORD_GENERATOR: string;
36
+ LONG_TAIL_KEYWORD_GENERATOR: string;
37
+ KEYWORD_STRATEGY: string;
38
+ GENERATE_BLOG_POST_TITLES: string;
39
+ GENERATE_BLOG_POST_DESCRIPTIONS: string;
40
+ GENERATE_BLOG_POST_OUTLINE: string;
41
+ GENERATE_COMPLETE_BLOG_POST_FROM_OUTLINE: string;
42
+ GENERATE_COMPLETE_BLOG_POST_FROM_TOPIC: string;
43
+ GENERATE_INTRODUCTION_USING_FRAMEWORK: string;
44
+ GENERATE_PARAGRAPH_OF_TEXT: string;
45
+ GENERATE_DICTIONARY: string;
46
+ GENERATE_FREE: string;
47
+ };
48
+ export declare const getPromptVoice: () => string;
49
+ export declare const getPromptStyle: () => string;
50
+ export declare const getPromptCountries: () => string[];
51
+ export declare const getPromptLangs: () => string[];
52
+ export declare const getPromptVoices: () => string[];
53
+ export declare const getPromptStyles: () => string[];
54
+ export declare const getPrompt: (strategy: keyof typeof PROMPTS) => {
55
+ prompt: string;
56
+ label: string;
57
+ };
58
+ export declare const getPromptOutline: () => string;
59
+ export declare const getPromptRole: (strategy: keyof typeof PROMPTS_ROLE) => string[];
60
+ export declare const setPrompt: (prompt: string, configVariables: {
61
+ lang?: string;
62
+ voice?: string;
63
+ style?: string;
64
+ limit?: string;
65
+ }, userInput: string) => string;
66
+ export interface PromptVariables {
67
+ [key: string]: any;
68
+ }
69
+ export declare class Prompt {
70
+ static getRoles(): string[];
71
+ static getLangs(): string[];
72
+ static getCountries(): string[];
73
+ static getVoices(): string[];
74
+ static getStyles(): string[];
75
+ static defaults(): {
76
+ role: string;
77
+ language: string;
78
+ country: string;
79
+ voice: string;
80
+ style: string;
81
+ };
82
+ static parseRole(role?: string, variables?: PromptVariables): string;
83
+ static parsePrompt(prompt: string, variables?: PromptVariables): string;
84
+ }
@@ -0,0 +1,96 @@
1
+ export declare const FIREBASE_BUCKET_ERRORS = "errors";
2
+ export declare const FIREBASE_BUCKET_METAOBJECT = "metaobject";
3
+ export declare const FIREBASE_BUCKET_DICTIONARY = "dictionary";
4
+ export declare const FIREBASE_BUCKET_SITEMAP = "sitemap";
5
+ export declare const FIREBASE_BUCKET_SITETREE = "sitetree";
6
+ export declare const FIREBASE_BUCKET_AICHAT = "aichat";
7
+ export declare const FIREBASE_BUCKET_SCRAPE = "scrape";
8
+ export declare const SEP = "/";
9
+ export declare const DOT = ".";
10
+ export declare const DEFAULT_LANG = "it";
11
+ export declare const consoleLog: (...args: any[]) => void;
12
+ export interface PageRawBase {
13
+ path: string;
14
+ strategy: string;
15
+ caller: string;
16
+ relRule: string;
17
+ relData: string;
18
+ }
19
+ export declare const defaultPageRawBase: {
20
+ path: string;
21
+ strategy: string;
22
+ caller: string;
23
+ relRule: string;
24
+ relData: string;
25
+ };
26
+ interface Image {
27
+ thumbnail: string;
28
+ original: string;
29
+ original_width: number;
30
+ original_height: number;
31
+ alt: string;
32
+ }
33
+ interface Section {
34
+ title: string;
35
+ paragraph: string[];
36
+ image: Image;
37
+ }
38
+ export interface Page {
39
+ meta: {
40
+ category: string;
41
+ title: string;
42
+ description: string;
43
+ keyword: string;
44
+ searchIntent: string;
45
+ };
46
+ header: {
47
+ title: string;
48
+ content: string;
49
+ };
50
+ footer: {
51
+ content: {
52
+ title: string;
53
+ paragraph: string[];
54
+ };
55
+ };
56
+ sections: Section[];
57
+ image: Image;
58
+ gallery: {
59
+ title: string;
60
+ description: string;
61
+ slides: Image[];
62
+ };
63
+ }
64
+ export declare const defaultPage: {
65
+ meta: {
66
+ category: string;
67
+ title: string;
68
+ description: string;
69
+ keyword: string;
70
+ searchIntent: string;
71
+ };
72
+ header: {
73
+ title: string;
74
+ content: string;
75
+ };
76
+ footer: {
77
+ content: {
78
+ title: string;
79
+ paragraph: never[];
80
+ };
81
+ };
82
+ sections: never[];
83
+ image: {
84
+ thumbnail: string;
85
+ original: string;
86
+ original_width: number;
87
+ original_height: number;
88
+ alt: string;
89
+ };
90
+ gallery: {
91
+ title: string;
92
+ description: string;
93
+ slides: never[];
94
+ };
95
+ };
96
+ export {};