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,147 @@
1
+ /**
2
+ * Domma Icons Module - TypeScript Declarations
3
+ * SVG icon library with categories and rendering
4
+ */
5
+
6
+ export type IconCategory =
7
+ | 'ui'
8
+ | 'navigation'
9
+ | 'media'
10
+ | 'communication'
11
+ | 'files'
12
+ | 'social'
13
+ | 'status'
14
+ | 'commerce';
15
+
16
+ export interface IconDefinition {
17
+ /** SVG path or full SVG content */
18
+ svg: string;
19
+ /** Icon category */
20
+ category?: IconCategory;
21
+ /** Icon tags for search */
22
+ tags?: string[];
23
+ /** ViewBox dimensions */
24
+ viewBox?: string;
25
+ }
26
+
27
+ export interface RenderOptions {
28
+ /** Icon size in pixels or CSS value */
29
+ size?: number | string;
30
+ /** Icon colour */
31
+ color?: string;
32
+ /** Additional CSS class */
33
+ className?: string;
34
+ /** Additional inline styles */
35
+ style?: Record<string, string>;
36
+ /** Accessible label */
37
+ ariaLabel?: string;
38
+ /** Custom attributes */
39
+ attrs?: Record<string, string>;
40
+ }
41
+
42
+ export interface Icons {
43
+ /**
44
+ * Render an icon as an SVG element
45
+ * @param name - Icon name
46
+ * @param options - Render options
47
+ * @returns SVG element or null if not found
48
+ */
49
+ render(name: string, options?: RenderOptions): SVGElement | null;
50
+
51
+ /**
52
+ * Get icon as HTML string
53
+ * @param name - Icon name
54
+ * @param options - Render options
55
+ * @returns SVG HTML string or empty string if not found
56
+ */
57
+ html(name: string, options?: RenderOptions): string;
58
+
59
+ /**
60
+ * Inject icon into a DOM element
61
+ * @param selector - Target element selector or element
62
+ * @param name - Icon name
63
+ * @param options - Render options
64
+ * @returns The target element or null
65
+ */
66
+ inject(selector: string | HTMLElement, name: string, options?: RenderOptions): HTMLElement | null;
67
+
68
+ /**
69
+ * Scan DOM for icon placeholders and inject icons
70
+ * @param container - Container to scan (default: document)
71
+ * @param attribute - Data attribute to look for (default: 'data-icon')
72
+ * @returns Number of icons injected
73
+ */
74
+ scan(container?: HTMLElement | Document, attribute?: string): number;
75
+
76
+ /**
77
+ * Register a custom icon
78
+ * @param name - Icon name
79
+ * @param definition - Icon definition (SVG string or full definition)
80
+ */
81
+ register(name: string, definition: string | IconDefinition): void;
82
+
83
+ /**
84
+ * Unregister an icon
85
+ * @param name - Icon name
86
+ * @returns true if icon was removed
87
+ */
88
+ unregister(name: string): boolean;
89
+
90
+ /**
91
+ * Check if an icon exists
92
+ * @param name - Icon name
93
+ * @returns true if icon exists
94
+ */
95
+ has(name: string): boolean;
96
+
97
+ /**
98
+ * Get icon definition
99
+ * @param name - Icon name
100
+ * @returns Icon definition or undefined
101
+ */
102
+ get(name: string): IconDefinition | undefined;
103
+
104
+ /**
105
+ * List all icon names
106
+ * @param category - Optional category filter
107
+ * @returns Array of icon names
108
+ */
109
+ list(category?: IconCategory): string[];
110
+
111
+ /**
112
+ * List all categories
113
+ * @returns Array of category names
114
+ */
115
+ listCategories(): IconCategory[];
116
+
117
+ /**
118
+ * Get total icon count
119
+ * @param category - Optional category filter
120
+ * @returns Number of icons
121
+ */
122
+ count(category?: IconCategory): number;
123
+
124
+ /**
125
+ * Search icons by name or tags
126
+ * @param query - Search query
127
+ * @returns Array of matching icon names
128
+ */
129
+ search(query: string): string[];
130
+
131
+ /**
132
+ * Create an SVG sprite sheet
133
+ * @param icons - Array of icon names (default: all icons)
134
+ * @returns SVG sprite element
135
+ */
136
+ createSprite(icons?: string[]): SVGElement;
137
+
138
+ /**
139
+ * Use an icon from a sprite sheet
140
+ * @param name - Icon name
141
+ * @param options - Render options
142
+ * @returns SVG use element HTML string
143
+ */
144
+ use(name: string, options?: RenderOptions): string;
145
+ }
146
+
147
+ export declare const icons: Icons;
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Domma - Dynamic Object Manipulation & Modeling API
3
+ * TypeScript Declaration File
4
+ *
5
+ * A lightweight, zero-dependency JavaScript framework combining
6
+ * jQuery-style DOM manipulation, Lodash utilities, and modern UI components.
7
+ */
8
+
9
+ // Re-export all module types
10
+ export * from './dom';
11
+ export * from './utils';
12
+ export * from './dates';
13
+ export * from './models';
14
+ export * from './config';
15
+ export * from './elements';
16
+ export * from './tables';
17
+ export * from './storage';
18
+ export * from './http';
19
+ export * from './theme';
20
+ export * from './icons';
21
+
22
+ // Import types for the main Domma object
23
+ import {dom, DommaCollection} from './dom';
24
+ import {Utils, utils} from './utils';
25
+ import {Dates, dates, DommaDate} from './dates';
26
+ import {Model, models, Models} from './models';
27
+ import {configEngine, SelectorConfig, SetupConfig} from './config';
28
+ import {Elements, elements} from './elements';
29
+ import {Tables, tables} from './tables';
30
+ import {Storage, storage} from './storage';
31
+ import {Http, http} from './http';
32
+ import {Theme, theme} from './theme';
33
+ import {Icons, icons} from './icons';
34
+
35
+ // ============================================
36
+ // Main Domma Interface
37
+ // ============================================
38
+
39
+ export interface DommaStatic {
40
+ /**
41
+ * Create a DommaCollection from a selector, element, or collection
42
+ * @param selector - CSS selector, element, NodeList, or array of elements
43
+ * @param context - Optional context element or document
44
+ * @returns DommaCollection instance
45
+ */
46
+ (selector: string | HTMLElement | NodeList | HTMLCollection | HTMLElement[] | DommaCollection, context?: Document | HTMLElement): DommaCollection;
47
+
48
+ /**
49
+ * Execute callback when DOM is ready
50
+ * @param callback - Function to execute when DOM is ready
51
+ */
52
+ (callback: () => void): void;
53
+
54
+ /** DOM manipulation module */
55
+ dom: typeof dom;
56
+
57
+ /** Utility functions (Lodash-compatible) */
58
+ utils: Utils;
59
+
60
+ /** Date manipulation (Moment.js-style) */
61
+ dates: Dates;
62
+
63
+ /** Reactive models & pub/sub */
64
+ models: Models;
65
+
66
+ /** UI components */
67
+ elements: Elements;
68
+
69
+ /** DataTable functionality */
70
+ tables: Tables;
71
+
72
+ /** localStorage wrapper */
73
+ storage: Storage;
74
+
75
+ /** HTTP client */
76
+ http: Http;
77
+
78
+ /** Theme system */
79
+ theme: Theme;
80
+
81
+ /** Icon library */
82
+ icons: Icons;
83
+
84
+ // ============================================
85
+ // ConfigEngine Methods ($.setup, $.config, etc.)
86
+ // ============================================
87
+
88
+ /**
89
+ * Process configuration for selectors
90
+ * @param config - Configuration object keyed by selector
91
+ */
92
+ setup(config: SetupConfig): void;
93
+
94
+ /**
95
+ * Update configuration for a selector
96
+ * @param selector - CSS selector
97
+ * @param changes - Changes to merge into existing config
98
+ * @returns The merged configuration
99
+ */
100
+ update(selector: string, changes: Partial<SelectorConfig>): SelectorConfig;
101
+
102
+ /**
103
+ * Retrieve configuration for a selector or all selectors
104
+ * @param selector - Optional selector to get config for
105
+ * @returns Configuration object or null if not found
106
+ */
107
+ config(): Record<string, SelectorConfig>;
108
+
109
+ config(selector: string): SelectorConfig | null;
110
+
111
+ /**
112
+ * Reset/destroy configuration for a selector or all selectors
113
+ * @param selector - Optional selector to reset
114
+ */
115
+ reset(selector?: string): void;
116
+
117
+ // ============================================
118
+ // Static Utilities
119
+ // ============================================
120
+
121
+ /** Check if value is a DommaCollection */
122
+ isDomma(value: any): value is DommaCollection;
123
+
124
+ /** Domma version string */
125
+ version: string;
126
+
127
+ /** No-conflict mode - restore previous $ */
128
+ noConflict(): DommaStatic;
129
+ }
130
+
131
+ // ============================================
132
+ // Global Declarations
133
+ // ============================================
134
+
135
+ declare global {
136
+ /**
137
+ * Domma - Main entry point
138
+ * jQuery-compatible DOM selection and manipulation
139
+ */
140
+ const Domma: DommaStatic;
141
+
142
+ /**
143
+ * $ - Alias for Domma
144
+ * jQuery-compatible selector function
145
+ */
146
+ const $: DommaStatic;
147
+
148
+ /**
149
+ * _ - Alias for Domma.utils
150
+ * Lodash-compatible utility functions
151
+ */
152
+ const _: Utils;
153
+
154
+ /**
155
+ * M - Alias for Domma.models
156
+ * Reactive models and pub/sub events
157
+ */
158
+ const M: Models;
159
+
160
+ /**
161
+ * D - Alias for Domma.dates
162
+ * Moment.js-style date manipulation
163
+ */
164
+ const D: Dates;
165
+
166
+ /**
167
+ * S - Alias for Domma.storage
168
+ * localStorage wrapper
169
+ */
170
+ const S: Storage;
171
+ }
172
+
173
+ // ============================================
174
+ // Default Export
175
+ // ============================================
176
+
177
+ declare const Domma: DommaStatic;
178
+ export default Domma;
179
+
180
+ // Named exports for ES modules
181
+ export {
182
+ Domma,
183
+ dom,
184
+ utils,
185
+ dates,
186
+ models,
187
+ elements,
188
+ tables,
189
+ storage,
190
+ http,
191
+ theme,
192
+ icons,
193
+ configEngine,
194
+ DommaCollection,
195
+ DommaDate,
196
+ Model
197
+ };
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Domma Models Module - TypeScript Declarations
3
+ * Pub/Sub events and reactive data binding
4
+ */
5
+
6
+ export type TypeValidator = (value: any) => boolean;
7
+
8
+ export interface FieldDefinition {
9
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'date' | 'any';
10
+ default?: any;
11
+ required?: boolean;
12
+ min?: number;
13
+ max?: number;
14
+ minLength?: number;
15
+ maxLength?: number;
16
+ pattern?: RegExp;
17
+ validate?: (value: any) => boolean | string;
18
+ }
19
+
20
+ export interface Schema {
21
+ [field: string]: FieldDefinition;
22
+ }
23
+
24
+ export interface ValidationResult {
25
+ valid: boolean;
26
+ errors: Array<{ field: string; error: string }>;
27
+ }
28
+
29
+ export interface ModelOptions {
30
+ persist?: string;
31
+ autoSave?: boolean;
32
+ }
33
+
34
+ export interface ChangeEvent {
35
+ field: string;
36
+ newValue: any;
37
+ oldValue: any;
38
+ model: Model;
39
+ }
40
+
41
+ export type ChangeCallback = (event: ChangeEvent) => void;
42
+ export type FieldChangeCallback = (newValue: any, oldValue: any, model: Model) => void;
43
+ export type UnsubscribeFn = () => void;
44
+
45
+ export interface BindingOptions {
46
+ format?: (value: any) => any;
47
+ parse?: (value: any) => any;
48
+ twoWay?: boolean;
49
+ }
50
+
51
+ /**
52
+ * Reactive Model class
53
+ */
54
+ export declare class Model {
55
+ constructor(schema: Schema, data?: Record<string, any>, options?: ModelOptions);
56
+
57
+ /** Get field value or all data */
58
+ get(): Record<string, any>;
59
+ get(field: string): any;
60
+
61
+ /** Set field value(s) */
62
+ set(field: string, value: any): Model;
63
+ set(data: Record<string, any>): Model;
64
+
65
+ /** Validate all fields */
66
+ validate(): ValidationResult;
67
+
68
+ /** Get model data as JSON */
69
+ toJSON(): Record<string, any>;
70
+
71
+ /** Subscribe to any change */
72
+ onChange(callback: ChangeCallback): UnsubscribeFn;
73
+
74
+ /** Subscribe to specific field change */
75
+ onFieldChange(field: string, callback: FieldChangeCallback): UnsubscribeFn;
76
+
77
+ /** Reset model to initial data */
78
+ reset(clearStorage?: boolean): Model;
79
+
80
+ /** Destroy model and cleanup */
81
+ destroy(clearStorage?: boolean): void;
82
+
83
+ // Persistence Methods
84
+
85
+ /** Manually save model to localStorage */
86
+ save(): boolean;
87
+
88
+ /** Manually load model from localStorage */
89
+ load(): boolean;
90
+
91
+ /** Clear persisted data from localStorage */
92
+ clearStorage(): boolean;
93
+
94
+ /** Get the persistence key */
95
+ getPersistKey(): string | null;
96
+
97
+ /** Check if model is persisted */
98
+ isPersisted(): boolean;
99
+ }
100
+
101
+ export interface Store {
102
+ /** Get current state */
103
+ getState(): Record<string, any>;
104
+
105
+ /** Update state with partial updates */
106
+ setState(updates: Record<string, any>): void;
107
+
108
+ /** Subscribe to state changes */
109
+ subscribe(listener: (state: Record<string, any>, oldState: Record<string, any>) => void): UnsubscribeFn;
110
+
111
+ /** Reset state to initial or new state */
112
+ reset(newState?: Record<string, any>): void;
113
+ }
114
+
115
+ export interface TypeValidators {
116
+ string: TypeValidator;
117
+ number: TypeValidator;
118
+ boolean: TypeValidator;
119
+ array: TypeValidator;
120
+ object: TypeValidator;
121
+ date: TypeValidator;
122
+ any: TypeValidator;
123
+ }
124
+
125
+ export interface Models {
126
+ // ============================================
127
+ // Pub/Sub Event System
128
+ // ============================================
129
+
130
+ /** Subscribe to an event */
131
+ subscribe(event: string, callback: (data: any) => void): UnsubscribeFn;
132
+
133
+ /** Alias for subscribe */
134
+ on(event: string, callback: (data: any) => void): UnsubscribeFn;
135
+
136
+ /** Unsubscribe from an event */
137
+ unsubscribe(event: string, callback: (data: any) => void): void;
138
+
139
+ /** Alias for unsubscribe */
140
+ off(event: string, callback: (data: any) => void): void;
141
+
142
+ /** Publish an event */
143
+ publish(event: string, data?: any): void;
144
+
145
+ /** Alias for publish */
146
+ emit(event: string, data?: any): void;
147
+
148
+ /** Subscribe to an event once */
149
+ once(event: string, callback: (data: any) => void): UnsubscribeFn;
150
+
151
+ /** Clear event listeners */
152
+ clear(event?: string): void;
153
+
154
+ // ============================================
155
+ // Model Creation
156
+ // ============================================
157
+
158
+ /** Create a new reactive model */
159
+ create(schema: Schema, initialData?: Record<string, any>, options?: ModelOptions): Model;
160
+
161
+ // ============================================
162
+ // Type Validators
163
+ // ============================================
164
+
165
+ types: TypeValidators;
166
+
167
+ // ============================================
168
+ // DOM Binding
169
+ // ============================================
170
+
171
+ /** Bind a model field to DOM element(s) */
172
+ bind(model: Model, field: string, selector: string | HTMLElement, options?: BindingOptions): UnsubscribeFn;
173
+
174
+ // ============================================
175
+ // Store (Simple State Management)
176
+ // ============================================
177
+
178
+ /** Get or create a named store */
179
+ store(name: string, initialState?: Record<string, any>): Store;
180
+
181
+ /** Get an existing store */
182
+ getStore(name: string): Store | undefined;
183
+
184
+ /** Remove a store */
185
+ removeStore(name: string): void;
186
+ }
187
+
188
+ export declare const models: Models;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Domma Storage Module - TypeScript Declarations
3
+ * localStorage wrapper with auto-serialisation and key prefixing
4
+ */
5
+
6
+ export interface Storage {
7
+ /**
8
+ * Get a value from storage
9
+ * @param key - The storage key
10
+ * @param defaultValue - Default value if key doesn't exist
11
+ * @returns The stored value or default
12
+ */
13
+ get<T = any>(key: string, defaultValue?: T): T;
14
+
15
+ /**
16
+ * Set a value in storage
17
+ * @param key - The storage key
18
+ * @param value - The value to store (auto-serialised)
19
+ * @returns true if successful
20
+ */
21
+ set(key: string, value: any): boolean;
22
+
23
+ /**
24
+ * Remove a key from storage
25
+ * @param key - The storage key
26
+ * @returns true if successful
27
+ */
28
+ remove(key: string): boolean;
29
+
30
+ /**
31
+ * Check if a key exists in storage
32
+ * @param key - The storage key
33
+ * @returns true if key exists
34
+ */
35
+ has(key: string): boolean;
36
+
37
+ /**
38
+ * Clear all storage (within prefix)
39
+ * @returns true if successful
40
+ */
41
+ clear(): boolean;
42
+
43
+ /**
44
+ * Get all storage keys (within prefix)
45
+ * @returns Array of keys
46
+ */
47
+ keys(): string[];
48
+
49
+ /**
50
+ * Get the number of stored items (within prefix)
51
+ * @returns Number of items
52
+ */
53
+ size(): number;
54
+
55
+ /**
56
+ * Get total storage size in bytes
57
+ * @returns Size in bytes
58
+ */
59
+ totalSize(): number;
60
+
61
+ /**
62
+ * Get all stored data as an object
63
+ * @returns Object with all key-value pairs
64
+ */
65
+ getAll(): Record<string, any>;
66
+
67
+ /**
68
+ * Set multiple values at once
69
+ * @param data - Object with key-value pairs
70
+ * @returns true if all successful
71
+ */
72
+ setAll(data: Record<string, any>): boolean;
73
+
74
+ /**
75
+ * Check if localStorage is available
76
+ * @returns true if available
77
+ */
78
+ isAvailable(): boolean;
79
+
80
+ /**
81
+ * Set the key prefix
82
+ * @param prefix - Prefix string for all keys
83
+ */
84
+ setPrefix(prefix: string): void;
85
+
86
+ /**
87
+ * Get the current key prefix
88
+ * @returns Current prefix
89
+ */
90
+ getPrefix(): string;
91
+ }
92
+
93
+ export declare const storage: Storage;