domma-js 0.3.1-alpha → 0.7.0-alpha

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 (39) hide show
  1. package/README.md +33 -30
  2. package/assets/types/config.d.ts +127 -0
  3. package/assets/types/dates.d.ts +209 -0
  4. package/assets/types/dom.d.ts +448 -0
  5. package/assets/types/elements.d.ts +606 -0
  6. package/assets/types/http.d.ts +97 -0
  7. package/assets/types/icons.d.ts +147 -0
  8. package/assets/types/index.d.ts +197 -0
  9. package/assets/types/models.d.ts +188 -0
  10. package/assets/types/storage.d.ts +93 -0
  11. package/assets/types/tables.d.ts +327 -0
  12. package/assets/types/theme.d.ts +136 -0
  13. package/assets/types/utils.d.ts +675 -0
  14. package/bin/domma-cli.js +144 -0
  15. package/package.json +12 -5
  16. package/public/dist/bundles/domma-complete.css +2316 -170
  17. package/public/dist/bundles/domma-data-focused.css +2686 -321
  18. package/public/dist/bundles/domma-essentials.css +2686 -321
  19. package/public/dist/bundles/domma-full.css +2686 -321
  20. package/public/dist/bundles/domma-grayve.css +13839 -0
  21. package/public/dist/bundles/domma-minimal.css +1591 -9
  22. package/public/dist/domma-syntax.min.js +8 -0
  23. package/public/dist/domma.css +1586 -4
  24. package/public/dist/domma.esm.js +4 -4
  25. package/public/dist/domma.min.js +4 -4
  26. package/public/dist/elements.css +368 -17
  27. package/public/dist/grid.css +3 -3
  28. package/public/dist/syntax.css +3 -3
  29. package/public/dist/themes/domma-themes.css +216 -3
  30. package/public/dist/themes/grayve.css +213 -0
  31. package/templates/kickstart/about/index.html +241 -0
  32. package/templates/kickstart/assets/logo/placeholder.svg +6 -0
  33. package/templates/kickstart/blog/index.html +227 -0
  34. package/templates/kickstart/contact/index.html +218 -0
  35. package/templates/kickstart/css/custom.css +121 -0
  36. package/templates/kickstart/docs/index.html +310 -0
  37. package/templates/kickstart/domma.config.json +47 -0
  38. package/templates/kickstart/index.html +170 -0
  39. package/templates/kickstart/js/app.js +161 -0
@@ -0,0 +1,327 @@
1
+ /**
2
+ * Domma Tables Module - TypeScript Declarations
3
+ * DataTable-like functionality with sorting, filtering, pagination, and export
4
+ */
5
+
6
+ // ============================================
7
+ // Types
8
+ // ============================================
9
+
10
+ export type SortDirection = 'asc' | 'desc' | null;
11
+ export type SelectionMode = 'single' | 'multiple';
12
+ export type ExportFormat = 'csv' | 'json' | 'excel';
13
+ export type TableEventType = 'sort' | 'filter' | 'page' | 'select' | 'edit' | 'render';
14
+
15
+ export interface ColumnDefinition {
16
+ /** Column key in data object */
17
+ key: string;
18
+ /** Display header text */
19
+ title?: string;
20
+ /** Enable sorting for this column */
21
+ sortable?: boolean;
22
+ /** Enable filtering for this column */
23
+ filterable?: boolean;
24
+ /** Column width */
25
+ width?: string | number;
26
+ /** Text alignment */
27
+ align?: 'left' | 'center' | 'right';
28
+ /** Custom render function */
29
+ render?: (value: any, row: Record<string, any>, index: number) => string;
30
+ /** Custom sort comparator */
31
+ comparator?: (a: any, b: any) => number;
32
+ /** Make column editable */
33
+ editable?: boolean;
34
+ /** Input type for editable cells */
35
+ editType?: 'text' | 'number' | 'select' | 'checkbox';
36
+ /** Options for select edit type */
37
+ editOptions?: string[] | { value: any; label: string }[];
38
+ /** Column visibility */
39
+ visible?: boolean;
40
+ /** CSS class for column */
41
+ className?: string;
42
+ }
43
+
44
+ export interface SortState {
45
+ column: string;
46
+ direction: SortDirection;
47
+ }
48
+
49
+ export interface FilterState {
50
+ column: string;
51
+ value: any;
52
+ operator?: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'startsWith' | 'endsWith';
53
+ }
54
+
55
+ export interface PageInfo {
56
+ currentPage: number;
57
+ pageSize: number;
58
+ totalPages: number;
59
+ totalRows: number;
60
+ startRow: number;
61
+ endRow: number;
62
+ }
63
+
64
+ export interface TableEventData {
65
+ type: TableEventType;
66
+ data?: any;
67
+ }
68
+
69
+ export type TableEventCallback = (event: TableEventData) => void;
70
+
71
+ // ============================================
72
+ // Table Options
73
+ // ============================================
74
+
75
+ export interface TableOptions {
76
+ /** Initial data array */
77
+ data?: Record<string, any>[];
78
+ /** Column definitions */
79
+ columns?: ColumnDefinition[];
80
+ /** Enable sorting */
81
+ sortable?: boolean;
82
+ /** Enable filtering */
83
+ filterable?: boolean;
84
+ /** Enable global search */
85
+ searchable?: boolean;
86
+ /** Enable pagination */
87
+ pagination?: boolean;
88
+ /** Rows per page */
89
+ pageSize?: number;
90
+ /** Page size options */
91
+ pageSizeOptions?: number[];
92
+ /** Enable row selection */
93
+ selectable?: boolean;
94
+ /** Selection mode: 'single' or 'multiple' */
95
+ selectionMode?: SelectionMode;
96
+ /** Enable cell editing */
97
+ editable?: boolean;
98
+ /** Enable column resizing */
99
+ resizable?: boolean;
100
+ /** Show export panel */
101
+ exportPanel?: boolean;
102
+ /** Show row numbers */
103
+ showRowNumbers?: boolean;
104
+ /** Empty state message */
105
+ emptyMessage?: string;
106
+ /** Loading state message */
107
+ loadingMessage?: string;
108
+ /** CSS class for table */
109
+ className?: string;
110
+ /** Striped rows */
111
+ striped?: boolean;
112
+ /** Hoverable rows */
113
+ hover?: boolean;
114
+ /** Bordered table */
115
+ bordered?: boolean;
116
+ /** Compact/dense layout */
117
+ compact?: boolean;
118
+ /** Responsive wrapper */
119
+ responsive?: boolean;
120
+ }
121
+
122
+ // ============================================
123
+ // Table Instance
124
+ // ============================================
125
+
126
+ export interface TableInstance {
127
+ /** The table element */
128
+ element: HTMLElement;
129
+ /** Current options */
130
+ options: TableOptions;
131
+
132
+ // Data Methods
133
+ /** Set table data */
134
+ setData(data: Record<string, any>[]): this;
135
+
136
+ /** Get current data (filtered and sorted) */
137
+ getData(): Record<string, any>[];
138
+
139
+ /** Get original unfiltered data */
140
+ getOriginalData(): Record<string, any>[];
141
+
142
+ /** Add a single row */
143
+ addRow(row: Record<string, any>): this;
144
+
145
+ /** Add multiple rows */
146
+ addRows(rows: Record<string, any>[]): this;
147
+
148
+ /** Update a row by index */
149
+ updateRow(index: number, data: Partial<Record<string, any>>): this;
150
+
151
+ /** Remove a row by index */
152
+ removeRow(index: number): this;
153
+
154
+ /** Remove multiple rows by indices */
155
+ removeRows(indices: number[]): this;
156
+
157
+ /** Clear all data */
158
+ clear(): this;
159
+
160
+ /** Refresh the table display */
161
+ refresh(): this;
162
+
163
+ // Sort Methods
164
+ /** Sort by column */
165
+ sort(column: string, direction?: SortDirection): this;
166
+
167
+ /** Sort by multiple columns */
168
+ sortMultiple(sorts: SortState[]): this;
169
+
170
+ /** Clear all sorting */
171
+ clearSort(): this;
172
+
173
+ /** Get current sort state */
174
+ getSortState(): SortState[];
175
+
176
+ // Filter Methods
177
+ /** Global search across all columns */
178
+ search(query: string): this;
179
+
180
+ /** Filter with a custom function */
181
+ filter(fn: (row: Record<string, any>, index: number) => boolean): this;
182
+
183
+ /** Filter by column value */
184
+ filterBy(column: string, value: any, operator?: FilterState['operator']): this;
185
+
186
+ /** Clear all filters */
187
+ clearFilters(): this;
188
+
189
+ /** Get current filter state */
190
+ getFilters(): FilterState[];
191
+
192
+ // Pagination Methods
193
+ /** Go to a specific page (1-indexed) */
194
+ page(pageNumber: number): this;
195
+
196
+ /** Set page size */
197
+ pageSize(size: number): this;
198
+
199
+ /** Go to next page */
200
+ nextPage(): this;
201
+
202
+ /** Go to previous page */
203
+ prevPage(): this;
204
+
205
+ /** Go to first page */
206
+ firstPage(): this;
207
+
208
+ /** Go to last page */
209
+ lastPage(): this;
210
+
211
+ /** Get pagination info */
212
+ pageInfo(): PageInfo;
213
+
214
+ // Selection Methods
215
+ /** Select row(s) by index */
216
+ select(index: number | number[]): this;
217
+
218
+ /** Deselect row(s) by index */
219
+ deselect(index: number | number[]): this;
220
+
221
+ /** Select all rows */
222
+ selectAll(): this;
223
+
224
+ /** Deselect all rows */
225
+ deselectAll(): this;
226
+
227
+ /** Toggle row selection */
228
+ toggleSelect(index: number): this;
229
+
230
+ /** Get selected row data */
231
+ getSelected(): Record<string, any>[];
232
+
233
+ /** Get selected row indices */
234
+ getSelectedIndices(): number[];
235
+
236
+ // Column Methods
237
+ /** Show a column */
238
+ showColumn(key: string): this;
239
+
240
+ /** Hide a column */
241
+ hideColumn(key: string): this;
242
+
243
+ /** Toggle column visibility */
244
+ toggleColumn(key: string): this;
245
+
246
+ /** Get column visibility state */
247
+ getColumnVisibility(): Record<string, boolean>;
248
+
249
+ /** Reorder columns */
250
+ reorderColumns(keys: string[]): this;
251
+
252
+ // Editing Methods
253
+ /** Edit a cell value */
254
+ editCell(rowIndex: number, column: string, value: any): this;
255
+
256
+ /** Get edited cells */
257
+ getEditedCells(): Array<{ row: number; column: string; value: any; originalValue: any }>;
258
+
259
+ /** Clear edit history */
260
+ clearEdits(): this;
261
+
262
+ // Export Methods
263
+ /** Export to CSV string */
264
+ toCSV(options?: { delimiter?: string; includeHeaders?: boolean }): string;
265
+
266
+ /** Export to JSON string */
267
+ toJSON(options?: { pretty?: boolean }): string;
268
+
269
+ /** Export to Excel-compatible format */
270
+ toExcel(): Blob;
271
+
272
+ /** Download export file */
273
+ download(format: ExportFormat, filename?: string): this;
274
+
275
+ /** Copy to clipboard */
276
+ copyToClipboard(format?: 'csv' | 'json'): Promise<boolean>;
277
+
278
+ // Event Methods
279
+ /** Subscribe to table events */
280
+ on(event: TableEventType, callback: TableEventCallback): this;
281
+
282
+ /** Unsubscribe from table events */
283
+ off(event: TableEventType, callback?: TableEventCallback): this;
284
+
285
+ /** Subscribe to event once */
286
+ once(event: TableEventType, callback: TableEventCallback): this;
287
+
288
+ // Rendering Methods
289
+ /** Force re-render */
290
+ render(): this;
291
+
292
+ /** Destroy the table instance */
293
+ destroy(): void;
294
+
295
+ // State Methods
296
+ /** Get current table state */
297
+ getState(): {
298
+ data: Record<string, any>[];
299
+ sort: SortState[];
300
+ filters: FilterState[];
301
+ page: PageInfo;
302
+ selected: number[];
303
+ };
304
+
305
+ /** Restore table state */
306
+ setState(state: Partial<ReturnType<TableInstance['getState']>>): this;
307
+ }
308
+
309
+ // ============================================
310
+ // Tables Module
311
+ // ============================================
312
+
313
+ export interface Tables {
314
+ /** Create a new table instance */
315
+ create(selector: string | HTMLElement, options?: TableOptions): TableInstance;
316
+
317
+ /** Get an existing table instance */
318
+ get(selector: string | HTMLElement): TableInstance | undefined;
319
+
320
+ /** Destroy a table instance */
321
+ destroy(selector: string | HTMLElement): void;
322
+
323
+ /** Destroy all table instances */
324
+ destroyAll(): void;
325
+ }
326
+
327
+ export declare const tables: Tables;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Domma Theme Module - TypeScript Declarations
3
+ * Theme system with light/dark modes and colour variants
4
+ */
5
+
6
+ export type ThemeMode = 'light' | 'dark';
7
+ export type ThemeVariant = 'ocean' | 'forest' | 'sunset' | 'royal' | 'lemon' | 'silver' | 'charcoal' | 'default';
8
+
9
+ export interface ThemeConfig {
10
+ /** Current theme mode */
11
+ mode: ThemeMode;
12
+ /** Current colour variant */
13
+ variant: ThemeVariant;
14
+ /** Auto-detect system preference */
15
+ auto?: boolean;
16
+ }
17
+
18
+ export interface ThemeChangeEvent {
19
+ mode: ThemeMode;
20
+ variant: ThemeVariant;
21
+ previousMode: ThemeMode;
22
+ previousVariant: ThemeVariant;
23
+ }
24
+
25
+ export type ThemeChangeCallback = (event: ThemeChangeEvent) => void;
26
+ export type UnsubscribeFn = () => void;
27
+
28
+ export interface ThemeOptions {
29
+ /** Initial theme mode */
30
+ mode?: ThemeMode;
31
+ /** Initial colour variant */
32
+ variant?: ThemeVariant;
33
+ /** Auto-detect system preference */
34
+ auto?: boolean;
35
+ /** Persist preference to localStorage */
36
+ persist?: boolean;
37
+ /** localStorage key for persistence */
38
+ persistKey?: string;
39
+ /** CSS selector for theme container (default: document.documentElement) */
40
+ container?: string | HTMLElement;
41
+ /** Transition duration in ms when changing themes */
42
+ transitionDuration?: number;
43
+ }
44
+
45
+ export interface Theme {
46
+ /**
47
+ * Initialise the theme system
48
+ * @param options - Theme options
49
+ * @returns The theme instance
50
+ */
51
+ init(options?: ThemeOptions): Theme;
52
+
53
+ /**
54
+ * Get the current theme mode
55
+ * @returns Current theme mode
56
+ */
57
+ get(): ThemeMode;
58
+
59
+ /**
60
+ * Get the current variant
61
+ * @returns Current variant name
62
+ */
63
+ getVariant(): ThemeVariant;
64
+
65
+ /**
66
+ * Check if current mode is dark
67
+ * @returns true if dark mode
68
+ */
69
+ isDark(): boolean;
70
+
71
+ /**
72
+ * Check if current mode is light
73
+ * @returns true if light mode
74
+ */
75
+ isLight(): boolean;
76
+
77
+ /**
78
+ * Set the theme mode
79
+ * @param mode - Theme mode to set
80
+ * @returns The theme instance
81
+ */
82
+ set(mode: ThemeMode): Theme;
83
+
84
+ /**
85
+ * Set the colour variant
86
+ * @param variant - Variant to set
87
+ * @returns The theme instance
88
+ */
89
+ setVariant(variant: ThemeVariant): Theme;
90
+
91
+ /**
92
+ * Toggle between light and dark modes
93
+ * @returns The theme instance
94
+ */
95
+ toggle(): Theme;
96
+
97
+ /**
98
+ * Subscribe to theme changes
99
+ * @param callback - Callback function
100
+ * @returns Unsubscribe function
101
+ */
102
+ onChange(callback: ThemeChangeCallback): UnsubscribeFn;
103
+
104
+ /**
105
+ * Preview a theme without persisting
106
+ * @param mode - Theme mode to preview
107
+ * @param variant - Optional variant to preview
108
+ * @returns The theme instance
109
+ */
110
+ preview(mode: ThemeMode, variant?: ThemeVariant): Theme;
111
+
112
+ /**
113
+ * List available theme modes
114
+ * @returns Array of theme modes
115
+ */
116
+ listThemes(): ThemeMode[];
117
+
118
+ /**
119
+ * List available variants
120
+ * @returns Array of variant names
121
+ */
122
+ listVariants(): ThemeVariant[];
123
+
124
+ /**
125
+ * Get current theme configuration
126
+ * @returns Theme configuration object
127
+ */
128
+ getConfig(): ThemeConfig;
129
+
130
+ /**
131
+ * Destroy the theme instance and cleanup
132
+ */
133
+ destroy(): void;
134
+ }
135
+
136
+ export declare const theme: Theme;