@sonicjs-cms/core 1.0.0-alpha.2 → 1.0.0-alpha.3
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/dist/chunk-BOLQHE4J.cjs +11 -0
- package/dist/chunk-BOLQHE4J.cjs.map +1 -0
- package/dist/chunk-BRC3F4CG.cjs +792 -0
- package/dist/chunk-BRC3F4CG.cjs.map +1 -0
- package/dist/chunk-HD7R6T6I.js +9 -0
- package/dist/chunk-HD7R6T6I.js.map +1 -0
- package/dist/chunk-KRJMGD4E.js +783 -0
- package/dist/chunk-KRJMGD4E.js.map +1 -0
- package/dist/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/routes.cjs +6 -3
- package/dist/routes.cjs.map +1 -1
- package/dist/routes.d.cts +12 -3
- package/dist/routes.d.ts +12 -3
- package/dist/routes.js +1 -5
- package/dist/routes.js.map +1 -1
- package/dist/templates.cjs +34 -3
- package/dist/templates.cjs.map +1 -1
- package/dist/templates.d.cts +137 -5
- package/dist/templates.d.ts +137 -5
- package/dist/templates.js +1 -5
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
package/dist/templates.d.cts
CHANGED
|
@@ -1,8 +1,140 @@
|
|
|
1
|
+
interface FormField {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type: 'text' | 'email' | 'textarea' | 'select' | 'checkbox' | 'rich_text' | 'number' | 'date' | 'multi_select' | 'file';
|
|
5
|
+
value?: any;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
helpText?: string;
|
|
10
|
+
options?: Array<{
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
rows?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
validation?: {
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
pattern?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
interface FormData {
|
|
24
|
+
id?: string;
|
|
25
|
+
action?: string;
|
|
26
|
+
method?: string;
|
|
27
|
+
hxPost?: string;
|
|
28
|
+
hxPut?: string;
|
|
29
|
+
hxTarget?: string;
|
|
30
|
+
fields: FormField[];
|
|
31
|
+
submitButtons: Array<{
|
|
32
|
+
label: string;
|
|
33
|
+
type?: 'submit' | 'button';
|
|
34
|
+
value?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
onclick?: string;
|
|
38
|
+
}>;
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
declare function renderForm(data: FormData): string;
|
|
44
|
+
declare function renderFormField(field: FormField): string;
|
|
45
|
+
|
|
46
|
+
interface TableColumn {
|
|
47
|
+
key: string;
|
|
48
|
+
label: string;
|
|
49
|
+
sortable?: boolean;
|
|
50
|
+
className?: string;
|
|
51
|
+
sortType?: 'string' | 'number' | 'date' | 'boolean';
|
|
52
|
+
render?: (value: any, row: any) => string;
|
|
53
|
+
}
|
|
54
|
+
interface TableData<T = any> {
|
|
55
|
+
columns: TableColumn[];
|
|
56
|
+
rows: T[];
|
|
57
|
+
selectable?: boolean;
|
|
58
|
+
className?: string;
|
|
59
|
+
emptyMessage?: string;
|
|
60
|
+
tableId?: string;
|
|
61
|
+
title?: string;
|
|
62
|
+
rowClickable?: boolean;
|
|
63
|
+
rowClickUrl?: (row: T) => string;
|
|
64
|
+
}
|
|
65
|
+
declare function renderTable<T = any>(data: TableData<T>): string;
|
|
66
|
+
|
|
67
|
+
interface PaginationData {
|
|
68
|
+
currentPage: number;
|
|
69
|
+
totalPages: number;
|
|
70
|
+
totalItems: number;
|
|
71
|
+
itemsPerPage: number;
|
|
72
|
+
startItem: number;
|
|
73
|
+
endItem: number;
|
|
74
|
+
baseUrl: string;
|
|
75
|
+
queryParams?: Record<string, string>;
|
|
76
|
+
showPageNumbers?: boolean;
|
|
77
|
+
maxPageNumbers?: number;
|
|
78
|
+
showPageSizeSelector?: boolean;
|
|
79
|
+
pageSizeOptions?: number[];
|
|
80
|
+
}
|
|
81
|
+
declare function renderPagination(data: PaginationData): string;
|
|
82
|
+
|
|
83
|
+
type AlertType = 'success' | 'error' | 'warning' | 'info';
|
|
84
|
+
interface AlertData {
|
|
85
|
+
type: AlertType;
|
|
86
|
+
title?: string;
|
|
87
|
+
message: string;
|
|
88
|
+
dismissible?: boolean;
|
|
89
|
+
className?: string;
|
|
90
|
+
icon?: boolean;
|
|
91
|
+
}
|
|
92
|
+
declare function renderAlert(data: AlertData): string;
|
|
93
|
+
|
|
94
|
+
interface ConfirmationDialogOptions {
|
|
95
|
+
id: string;
|
|
96
|
+
title: string;
|
|
97
|
+
message: string;
|
|
98
|
+
confirmText?: string;
|
|
99
|
+
cancelText?: string;
|
|
100
|
+
confirmClass?: string;
|
|
101
|
+
iconColor?: 'red' | 'yellow' | 'blue';
|
|
102
|
+
onConfirm?: string;
|
|
103
|
+
}
|
|
104
|
+
declare function renderConfirmationDialog(options: ConfirmationDialogOptions): string;
|
|
1
105
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* UI templates for admin interface
|
|
106
|
+
* Helper function to show a confirmation dialog programmatically
|
|
107
|
+
* Usage in templates: Add this script and call showConfirmDialog()
|
|
5
108
|
*/
|
|
6
|
-
declare
|
|
109
|
+
declare function getConfirmationDialogScript(): string;
|
|
110
|
+
|
|
111
|
+
interface FilterOption {
|
|
112
|
+
value: string;
|
|
113
|
+
label: string;
|
|
114
|
+
selected?: boolean;
|
|
115
|
+
color?: string;
|
|
116
|
+
}
|
|
117
|
+
interface Filter {
|
|
118
|
+
name: string;
|
|
119
|
+
label: string;
|
|
120
|
+
options: FilterOption[];
|
|
121
|
+
}
|
|
122
|
+
interface FilterBarData {
|
|
123
|
+
filters: Filter[];
|
|
124
|
+
actions?: Array<{
|
|
125
|
+
label: string;
|
|
126
|
+
className?: string;
|
|
127
|
+
onclick?: string;
|
|
128
|
+
hxGet?: string;
|
|
129
|
+
hxTarget?: string;
|
|
130
|
+
}>;
|
|
131
|
+
bulkActions?: Array<{
|
|
132
|
+
label: string;
|
|
133
|
+
value: string;
|
|
134
|
+
icon?: string;
|
|
135
|
+
className?: string;
|
|
136
|
+
}>;
|
|
137
|
+
}
|
|
138
|
+
declare function renderFilterBar(data: FilterBarData): string;
|
|
7
139
|
|
|
8
|
-
export {
|
|
140
|
+
export { type AlertData, type ConfirmationDialogOptions, type Filter, type FilterBarData, type FilterOption, type FormData, type FormField, type PaginationData, type TableColumn, type TableData, getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderFilterBar, renderForm, renderFormField, renderPagination, renderTable };
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,8 +1,140 @@
|
|
|
1
|
+
interface FormField {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type: 'text' | 'email' | 'textarea' | 'select' | 'checkbox' | 'rich_text' | 'number' | 'date' | 'multi_select' | 'file';
|
|
5
|
+
value?: any;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
helpText?: string;
|
|
10
|
+
options?: Array<{
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
rows?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
validation?: {
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
pattern?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
interface FormData {
|
|
24
|
+
id?: string;
|
|
25
|
+
action?: string;
|
|
26
|
+
method?: string;
|
|
27
|
+
hxPost?: string;
|
|
28
|
+
hxPut?: string;
|
|
29
|
+
hxTarget?: string;
|
|
30
|
+
fields: FormField[];
|
|
31
|
+
submitButtons: Array<{
|
|
32
|
+
label: string;
|
|
33
|
+
type?: 'submit' | 'button';
|
|
34
|
+
value?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
onclick?: string;
|
|
38
|
+
}>;
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
declare function renderForm(data: FormData): string;
|
|
44
|
+
declare function renderFormField(field: FormField): string;
|
|
45
|
+
|
|
46
|
+
interface TableColumn {
|
|
47
|
+
key: string;
|
|
48
|
+
label: string;
|
|
49
|
+
sortable?: boolean;
|
|
50
|
+
className?: string;
|
|
51
|
+
sortType?: 'string' | 'number' | 'date' | 'boolean';
|
|
52
|
+
render?: (value: any, row: any) => string;
|
|
53
|
+
}
|
|
54
|
+
interface TableData<T = any> {
|
|
55
|
+
columns: TableColumn[];
|
|
56
|
+
rows: T[];
|
|
57
|
+
selectable?: boolean;
|
|
58
|
+
className?: string;
|
|
59
|
+
emptyMessage?: string;
|
|
60
|
+
tableId?: string;
|
|
61
|
+
title?: string;
|
|
62
|
+
rowClickable?: boolean;
|
|
63
|
+
rowClickUrl?: (row: T) => string;
|
|
64
|
+
}
|
|
65
|
+
declare function renderTable<T = any>(data: TableData<T>): string;
|
|
66
|
+
|
|
67
|
+
interface PaginationData {
|
|
68
|
+
currentPage: number;
|
|
69
|
+
totalPages: number;
|
|
70
|
+
totalItems: number;
|
|
71
|
+
itemsPerPage: number;
|
|
72
|
+
startItem: number;
|
|
73
|
+
endItem: number;
|
|
74
|
+
baseUrl: string;
|
|
75
|
+
queryParams?: Record<string, string>;
|
|
76
|
+
showPageNumbers?: boolean;
|
|
77
|
+
maxPageNumbers?: number;
|
|
78
|
+
showPageSizeSelector?: boolean;
|
|
79
|
+
pageSizeOptions?: number[];
|
|
80
|
+
}
|
|
81
|
+
declare function renderPagination(data: PaginationData): string;
|
|
82
|
+
|
|
83
|
+
type AlertType = 'success' | 'error' | 'warning' | 'info';
|
|
84
|
+
interface AlertData {
|
|
85
|
+
type: AlertType;
|
|
86
|
+
title?: string;
|
|
87
|
+
message: string;
|
|
88
|
+
dismissible?: boolean;
|
|
89
|
+
className?: string;
|
|
90
|
+
icon?: boolean;
|
|
91
|
+
}
|
|
92
|
+
declare function renderAlert(data: AlertData): string;
|
|
93
|
+
|
|
94
|
+
interface ConfirmationDialogOptions {
|
|
95
|
+
id: string;
|
|
96
|
+
title: string;
|
|
97
|
+
message: string;
|
|
98
|
+
confirmText?: string;
|
|
99
|
+
cancelText?: string;
|
|
100
|
+
confirmClass?: string;
|
|
101
|
+
iconColor?: 'red' | 'yellow' | 'blue';
|
|
102
|
+
onConfirm?: string;
|
|
103
|
+
}
|
|
104
|
+
declare function renderConfirmationDialog(options: ConfirmationDialogOptions): string;
|
|
1
105
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* UI templates for admin interface
|
|
106
|
+
* Helper function to show a confirmation dialog programmatically
|
|
107
|
+
* Usage in templates: Add this script and call showConfirmDialog()
|
|
5
108
|
*/
|
|
6
|
-
declare
|
|
109
|
+
declare function getConfirmationDialogScript(): string;
|
|
110
|
+
|
|
111
|
+
interface FilterOption {
|
|
112
|
+
value: string;
|
|
113
|
+
label: string;
|
|
114
|
+
selected?: boolean;
|
|
115
|
+
color?: string;
|
|
116
|
+
}
|
|
117
|
+
interface Filter {
|
|
118
|
+
name: string;
|
|
119
|
+
label: string;
|
|
120
|
+
options: FilterOption[];
|
|
121
|
+
}
|
|
122
|
+
interface FilterBarData {
|
|
123
|
+
filters: Filter[];
|
|
124
|
+
actions?: Array<{
|
|
125
|
+
label: string;
|
|
126
|
+
className?: string;
|
|
127
|
+
onclick?: string;
|
|
128
|
+
hxGet?: string;
|
|
129
|
+
hxTarget?: string;
|
|
130
|
+
}>;
|
|
131
|
+
bulkActions?: Array<{
|
|
132
|
+
label: string;
|
|
133
|
+
value: string;
|
|
134
|
+
icon?: string;
|
|
135
|
+
className?: string;
|
|
136
|
+
}>;
|
|
137
|
+
}
|
|
138
|
+
declare function renderFilterBar(data: FilterBarData): string;
|
|
7
139
|
|
|
8
|
-
export {
|
|
140
|
+
export { type AlertData, type ConfirmationDialogOptions, type Filter, type FilterBarData, type FilterOption, type FormData, type FormField, type PaginationData, type TableColumn, type TableData, getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderFilterBar, renderForm, renderFormField, renderPagination, renderTable };
|
package/dist/templates.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
+
export { getConfirmationDialogScript, renderAlert, renderConfirmationDialog, renderFilterBar, renderForm, renderFormField, renderPagination, renderTable } from './chunk-KRJMGD4E.js';
|
|
1
2
|
import './chunk-G3PMV62Z.js';
|
|
2
|
-
|
|
3
|
-
// src/templates/index.ts
|
|
4
|
-
var placeholder = "templates";
|
|
5
|
-
|
|
6
|
-
export { placeholder };
|
|
7
3
|
//# sourceMappingURL=templates.js.map
|
|
8
4
|
//# sourceMappingURL=templates.js.map
|
package/dist/templates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"templates.js"}
|
package/package.json
CHANGED