mtrl 0.4.5 → 0.5.1
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/README.md +61 -60
- package/dist/README.md +61 -60
- package/dist/components/chips/chips.d.ts +2 -2
- package/dist/components/chips/config.d.ts +1 -1
- package/dist/components/chips/features/controller.d.ts +1 -1
- package/dist/components/chips/features/dom.d.ts +15 -0
- package/dist/components/chips/features/index.d.ts +5 -4
- package/dist/components/chips/schema.d.ts +2 -2
- package/dist/components/index.d.ts +65 -65
- package/dist/components/list/api.d.ts +82 -39
- package/dist/components/list/config.d.ts +23 -19
- package/dist/components/list/features/index.d.ts +1 -1
- package/dist/components/list/features/renderer.d.ts +9 -0
- package/dist/components/list/features/selection.d.ts +1 -1
- package/dist/components/list/index.d.ts +3 -3
- package/dist/components/list/list.d.ts +3 -2
- package/dist/components/list/types.d.ts +68 -121
- package/dist/components/progress/constants.d.ts +3 -3
- package/dist/components/slider/features/canvas.d.ts +2 -2
- package/dist/components/slider/features/dom.d.ts +21 -0
- package/dist/components/slider/features/index.d.ts +5 -4
- package/dist/components/slider/slider.d.ts +4 -4
- package/dist/components/textfield/api.d.ts +2 -0
- package/dist/components/textfield/features/error.d.ts +54 -0
- package/dist/components/textfield/features/index.d.ts +1 -0
- package/dist/components/textfield/features/supporting-text.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +7 -0
- package/dist/core/compose/features/icon.d.ts +2 -2
- package/dist/core/compose/features/index.d.ts +0 -2
- package/dist/core/compose/features/textlabel.d.ts +2 -2
- package/dist/core/compose/index.d.ts +9 -13
- package/dist/core/dom/attributes.d.ts +32 -2
- package/dist/core/dom/classes.d.ts +15 -13
- package/dist/core/dom/create.d.ts +35 -87
- package/dist/core/dom/index.d.ts +6 -6
- package/dist/core/dom/utils.d.ts +1 -10
- package/dist/core/index.d.ts +18 -20
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +36 -74
- package/dist/index.d.ts +2 -7
- package/dist/index.js +15 -15
- package/dist/index.js.map +36 -74
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +3 -2
- package/dist/components/list/features/listmanager.d.ts +0 -9
- package/dist/components/slider/schema.d.ts +0 -65
- package/dist/core/collection/adapters/base.d.ts +0 -47
- package/dist/core/collection/adapters/route.d.ts +0 -149
- package/dist/core/collection/collection.d.ts +0 -131
- package/dist/core/collection/index.d.ts +0 -10
- package/dist/core/collection/list-manager/config.d.ts +0 -29
- package/dist/core/collection/list-manager/dom-elements.d.ts +0 -30
- package/dist/core/collection/list-manager/index.d.ts +0 -61
- package/dist/core/collection/list-manager/item-measurement.d.ts +0 -91
- package/dist/core/collection/list-manager/renderer.d.ts +0 -31
- package/dist/core/collection/list-manager/scroll-tracker.d.ts +0 -20
- package/dist/core/collection/list-manager/state.d.ts +0 -60
- package/dist/core/collection/list-manager/types.d.ts +0 -361
- package/dist/core/collection/list-manager/utils/recycling.d.ts +0 -34
- package/dist/core/collection/list-manager/utils/visibility.d.ts +0 -45
- package/dist/core/compose/features/gestures/longpress.d.ts +0 -85
- package/dist/core/compose/features/gestures/pan.d.ts +0 -108
- package/dist/core/compose/features/gestures/pinch.d.ts +0 -111
- package/dist/core/compose/features/gestures/rotate.d.ts +0 -111
- package/dist/core/compose/features/gestures/swipe.d.ts +0 -149
- package/dist/core/compose/features/gestures/tap.d.ts +0 -79
- package/dist/core/compose/features/gestures.d.ts +0 -86
- package/dist/core/composition/features/dom.d.ts +0 -19
- package/dist/core/composition/features/icon.d.ts +0 -45
- package/dist/core/composition/features/index.d.ts +0 -7
- package/dist/core/composition/features/label.d.ts +0 -49
- package/dist/core/composition/features/layout.d.ts +0 -31
- package/dist/core/composition/index.d.ts +0 -16
- package/dist/core/gestures/index.d.ts +0 -12
- package/dist/core/gestures/longpress.d.ts +0 -23
- package/dist/core/gestures/manager.d.ts +0 -14
- package/dist/core/gestures/pan.d.ts +0 -12
- package/dist/core/gestures/pinch.d.ts +0 -14
- package/dist/core/gestures/rotate.d.ts +0 -14
- package/dist/core/gestures/swipe.d.ts +0 -20
- package/dist/core/gestures/tap.d.ts +0 -12
- package/dist/core/gestures/types.d.ts +0 -320
- package/dist/core/gestures/utils.d.ts +0 -57
- package/dist/core/layout/array.d.ts +0 -20
- package/dist/core/layout/config.d.ts +0 -32
- package/dist/core/layout/create.d.ts +0 -14
- package/dist/core/layout/index.d.ts +0 -13
- package/dist/core/layout/jsx.d.ts +0 -13
- package/dist/core/layout/object.d.ts +0 -14
- package/dist/core/layout/processor.d.ts +0 -28
- package/dist/core/layout/result.d.ts +0 -12
- package/dist/core/layout/template.d.ts +0 -12
- package/dist/core/layout/types.d.ts +0 -137
- package/dist/core/layout/utils.d.ts +0 -38
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ mtrl is a lightweight, composable TypeScript/JavaScript component library inspir
|
|
|
6
6
|
|
|
7
7
|
## Understanding mtrl
|
|
8
8
|
|
|
9
|
-
mtrl (pronounced "material") takes its inspiration from Material Design while providing a flexible, framework-agnostic implementation.
|
|
9
|
+
mtrl (pronounced "material") takes its inspiration from Material Design while providing a flexible, framework-agnostic implementation.
|
|
10
10
|
|
|
11
11
|
### Design Philosophy
|
|
12
12
|
|
|
@@ -23,15 +23,15 @@ mtrl is built on several core principles:
|
|
|
23
23
|
mtrl provides a comprehensive set of components, each following Material Design principles:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { createButton, createTextField } from
|
|
26
|
+
import { createButton, createTextField } from "mtrl";
|
|
27
27
|
|
|
28
28
|
// Create a material button with ripple effect
|
|
29
29
|
const button = createButton({
|
|
30
|
-
text:
|
|
31
|
-
variant:
|
|
30
|
+
text: "Submit",
|
|
31
|
+
variant: "filled",
|
|
32
32
|
ripple: true,
|
|
33
|
-
class:
|
|
34
|
-
})
|
|
33
|
+
class: "custom-button",
|
|
34
|
+
});
|
|
35
35
|
|
|
36
36
|
// className will be: mtrl-button mtrl-button--filled custom-button
|
|
37
37
|
```
|
|
@@ -68,12 +68,12 @@ Let's look at how mtrl components are constructed:
|
|
|
68
68
|
```typescript
|
|
69
69
|
// Example of a button component creation
|
|
70
70
|
const button = createButton({
|
|
71
|
-
prefix:
|
|
72
|
-
componentName:
|
|
73
|
-
variant:
|
|
74
|
-
text:
|
|
75
|
-
ripple: true
|
|
76
|
-
})
|
|
71
|
+
prefix: "mtrl", // The library's prefix
|
|
72
|
+
componentName: "button", // Component identifier
|
|
73
|
+
variant: "filled", // Visual variant
|
|
74
|
+
text: "Click me", // Button text
|
|
75
|
+
ripple: true, // Enable ripple effect
|
|
76
|
+
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### The Composition System
|
|
@@ -84,19 +84,20 @@ mtrl uses a pipe-based composition system with full type safety for building com
|
|
|
84
84
|
// Internal component creation
|
|
85
85
|
const createButton = (config: ButtonConfig): ButtonComponent => {
|
|
86
86
|
return pipe(
|
|
87
|
-
createBase,
|
|
88
|
-
withEvents(),
|
|
89
|
-
withElement({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
createBase, // Base component structure
|
|
88
|
+
withEvents(), // Event handling capability
|
|
89
|
+
withElement({
|
|
90
|
+
// DOM element creation
|
|
91
|
+
tag: "button",
|
|
92
|
+
componentName: "button",
|
|
93
|
+
prefix: "mtrl",
|
|
93
94
|
}),
|
|
94
|
-
withVariant(config),
|
|
95
|
-
withText(config),
|
|
96
|
-
withIcon(config),
|
|
97
|
-
withRipple(config)
|
|
98
|
-
)(config)
|
|
99
|
-
}
|
|
95
|
+
withVariant(config), // Visual variant support
|
|
96
|
+
withText(config), // Text content management
|
|
97
|
+
withIcon(config), // Icon support
|
|
98
|
+
withRipple(config) // Ripple animation
|
|
99
|
+
)(config);
|
|
100
|
+
};
|
|
100
101
|
```
|
|
101
102
|
|
|
102
103
|
### TypeScript Integration
|
|
@@ -105,14 +106,13 @@ mtrl provides comprehensive TypeScript definitions:
|
|
|
105
106
|
|
|
106
107
|
```typescript
|
|
107
108
|
// Component interfaces for better developer experience
|
|
108
|
-
export interface ButtonComponent
|
|
109
|
-
BaseComponent,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
export interface ButtonComponent
|
|
110
|
+
extends BaseComponent,
|
|
111
|
+
ElementComponent,
|
|
112
|
+
TextComponent,
|
|
113
|
+
IconComponent,
|
|
114
|
+
DisabledComponent,
|
|
115
|
+
LifecycleComponent {
|
|
116
116
|
// Button-specific properties and methods
|
|
117
117
|
getValue: () => string;
|
|
118
118
|
setValue: (value: string) => ButtonComponent;
|
|
@@ -133,9 +133,10 @@ mtrl follows a consistent class naming convention:
|
|
|
133
133
|
|
|
134
134
|
```css
|
|
135
135
|
.mtrl-component /* Base component class */
|
|
136
|
+
/* Base component class */
|
|
136
137
|
.mtrl-component--variant /* Variant modifier */
|
|
137
138
|
.mtrl-component--state /* State modifier (disabled, focused) */
|
|
138
|
-
.mtrl-component-element
|
|
139
|
+
.mtrl-component-element; /* Child element */
|
|
139
140
|
```
|
|
140
141
|
|
|
141
142
|
## State Management
|
|
@@ -146,14 +147,14 @@ mtrl provides several approaches to state management:
|
|
|
146
147
|
|
|
147
148
|
```typescript
|
|
148
149
|
const textField = createTextField({
|
|
149
|
-
label:
|
|
150
|
-
})
|
|
150
|
+
label: "Username",
|
|
151
|
+
});
|
|
151
152
|
|
|
152
|
-
textField.on(
|
|
153
|
-
console.log(
|
|
154
|
-
})
|
|
153
|
+
textField.on("input", ({ value }) => {
|
|
154
|
+
console.log("Current value:", value);
|
|
155
|
+
});
|
|
155
156
|
|
|
156
|
-
textField.setValue(
|
|
157
|
+
textField.setValue("New value");
|
|
157
158
|
```
|
|
158
159
|
|
|
159
160
|
### Collection Management
|
|
@@ -164,13 +165,13 @@ For managing lists and datasets:
|
|
|
164
165
|
const collection = new Collection<User>({
|
|
165
166
|
transform: (item) => ({
|
|
166
167
|
...item,
|
|
167
|
-
displayName: `${item.firstName} ${item.lastName}
|
|
168
|
-
})
|
|
169
|
-
})
|
|
168
|
+
displayName: `${item.firstName} ${item.lastName}`,
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
170
171
|
|
|
171
172
|
collection.subscribe(({ event, data }) => {
|
|
172
|
-
console.log(`Collection ${event}:`, data)
|
|
173
|
-
})
|
|
173
|
+
console.log(`Collection ${event}:`, data);
|
|
174
|
+
});
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
## Data Integration
|
|
@@ -180,19 +181,19 @@ mtrl provides adapters for different data sources:
|
|
|
180
181
|
```typescript
|
|
181
182
|
// MongoDB adapter
|
|
182
183
|
const mongoAdapter = createMongoAdapter({
|
|
183
|
-
uri:
|
|
184
|
-
dbName:
|
|
185
|
-
collection:
|
|
186
|
-
})
|
|
184
|
+
uri: "mongodb://localhost:27017",
|
|
185
|
+
dbName: "mtrl-app",
|
|
186
|
+
collection: "users",
|
|
187
|
+
});
|
|
187
188
|
|
|
188
189
|
// Route adapter for REST APIs
|
|
189
190
|
const routeAdapter = createRouteAdapter({
|
|
190
|
-
base:
|
|
191
|
+
base: "/api",
|
|
191
192
|
endpoints: {
|
|
192
|
-
list:
|
|
193
|
-
create:
|
|
194
|
-
}
|
|
195
|
-
})
|
|
193
|
+
list: "/users",
|
|
194
|
+
create: "/users",
|
|
195
|
+
},
|
|
196
|
+
});
|
|
196
197
|
```
|
|
197
198
|
|
|
198
199
|
## Customization
|
|
@@ -216,9 +217,9 @@ const createCustomCard = (config: CustomCardConfig): CustomCardComponent => {
|
|
|
216
217
|
createBase,
|
|
217
218
|
withEvents(),
|
|
218
219
|
withElement({
|
|
219
|
-
tag:
|
|
220
|
-
componentName:
|
|
221
|
-
prefix:
|
|
220
|
+
tag: "div",
|
|
221
|
+
componentName: "card",
|
|
222
|
+
prefix: "mtrl",
|
|
222
223
|
}),
|
|
223
224
|
// Add custom features
|
|
224
225
|
(component) => ({
|
|
@@ -226,10 +227,10 @@ const createCustomCard = (config: CustomCardConfig): CustomCardComponent => {
|
|
|
226
227
|
setContent(content: string) {
|
|
227
228
|
component.element.innerHTML = content;
|
|
228
229
|
return this;
|
|
229
|
-
}
|
|
230
|
+
},
|
|
230
231
|
})
|
|
231
232
|
)(config);
|
|
232
|
-
}
|
|
233
|
+
};
|
|
233
234
|
```
|
|
234
235
|
|
|
235
236
|
### Styling
|
|
@@ -241,7 +242,7 @@ mtrl components can be styled through CSS custom properties:
|
|
|
241
242
|
--mtrl-primary: #6200ee;
|
|
242
243
|
--mtrl-surface: #ffffff;
|
|
243
244
|
--mtrl-on-surface: #000000;
|
|
244
|
-
--mtrl-elevation-1: 0 2px 4px rgba(0,0,0,0.2);
|
|
245
|
+
--mtrl-elevation-1: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
245
246
|
}
|
|
246
247
|
```
|
|
247
248
|
|
|
@@ -321,4 +322,4 @@ For detailed API documentation, examples, and guides, visit our [documentation s
|
|
|
321
322
|
|
|
322
323
|
---
|
|
323
324
|
|
|
324
|
-
This library is designed to provide a solid foundation for building modern web interfaces with TypeScript while maintaining flexibility for custom implementations. For questions, issues, or contributions, please visit our GitHub repository.
|
|
325
|
+
This library is designed to provide a solid foundation for building modern web interfaces with TypeScript while maintaining flexibility for custom implementations. For questions, issues, or contributions, please visit our GitHub repository.
|
package/dist/README.md
CHANGED
|
@@ -6,7 +6,7 @@ mtrl is a lightweight, composable TypeScript/JavaScript component library inspir
|
|
|
6
6
|
|
|
7
7
|
## Understanding mtrl
|
|
8
8
|
|
|
9
|
-
mtrl (pronounced "material") takes its inspiration from Material Design while providing a flexible, framework-agnostic implementation.
|
|
9
|
+
mtrl (pronounced "material") takes its inspiration from Material Design while providing a flexible, framework-agnostic implementation.
|
|
10
10
|
|
|
11
11
|
### Design Philosophy
|
|
12
12
|
|
|
@@ -23,15 +23,15 @@ mtrl is built on several core principles:
|
|
|
23
23
|
mtrl provides a comprehensive set of components, each following Material Design principles:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { createButton, createTextField } from
|
|
26
|
+
import { createButton, createTextField } from "mtrl";
|
|
27
27
|
|
|
28
28
|
// Create a material button with ripple effect
|
|
29
29
|
const button = createButton({
|
|
30
|
-
text:
|
|
31
|
-
variant:
|
|
30
|
+
text: "Submit",
|
|
31
|
+
variant: "filled",
|
|
32
32
|
ripple: true,
|
|
33
|
-
class:
|
|
34
|
-
})
|
|
33
|
+
class: "custom-button",
|
|
34
|
+
});
|
|
35
35
|
|
|
36
36
|
// className will be: mtrl-button mtrl-button--filled custom-button
|
|
37
37
|
```
|
|
@@ -68,12 +68,12 @@ Let's look at how mtrl components are constructed:
|
|
|
68
68
|
```typescript
|
|
69
69
|
// Example of a button component creation
|
|
70
70
|
const button = createButton({
|
|
71
|
-
prefix:
|
|
72
|
-
componentName:
|
|
73
|
-
variant:
|
|
74
|
-
text:
|
|
75
|
-
ripple: true
|
|
76
|
-
})
|
|
71
|
+
prefix: "mtrl", // The library's prefix
|
|
72
|
+
componentName: "button", // Component identifier
|
|
73
|
+
variant: "filled", // Visual variant
|
|
74
|
+
text: "Click me", // Button text
|
|
75
|
+
ripple: true, // Enable ripple effect
|
|
76
|
+
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
### The Composition System
|
|
@@ -84,19 +84,20 @@ mtrl uses a pipe-based composition system with full type safety for building com
|
|
|
84
84
|
// Internal component creation
|
|
85
85
|
const createButton = (config: ButtonConfig): ButtonComponent => {
|
|
86
86
|
return pipe(
|
|
87
|
-
createBase,
|
|
88
|
-
withEvents(),
|
|
89
|
-
withElement({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
createBase, // Base component structure
|
|
88
|
+
withEvents(), // Event handling capability
|
|
89
|
+
withElement({
|
|
90
|
+
// DOM element creation
|
|
91
|
+
tag: "button",
|
|
92
|
+
componentName: "button",
|
|
93
|
+
prefix: "mtrl",
|
|
93
94
|
}),
|
|
94
|
-
withVariant(config),
|
|
95
|
-
withText(config),
|
|
96
|
-
withIcon(config),
|
|
97
|
-
withRipple(config)
|
|
98
|
-
)(config)
|
|
99
|
-
}
|
|
95
|
+
withVariant(config), // Visual variant support
|
|
96
|
+
withText(config), // Text content management
|
|
97
|
+
withIcon(config), // Icon support
|
|
98
|
+
withRipple(config) // Ripple animation
|
|
99
|
+
)(config);
|
|
100
|
+
};
|
|
100
101
|
```
|
|
101
102
|
|
|
102
103
|
### TypeScript Integration
|
|
@@ -105,14 +106,13 @@ mtrl provides comprehensive TypeScript definitions:
|
|
|
105
106
|
|
|
106
107
|
```typescript
|
|
107
108
|
// Component interfaces for better developer experience
|
|
108
|
-
export interface ButtonComponent
|
|
109
|
-
BaseComponent,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
export interface ButtonComponent
|
|
110
|
+
extends BaseComponent,
|
|
111
|
+
ElementComponent,
|
|
112
|
+
TextComponent,
|
|
113
|
+
IconComponent,
|
|
114
|
+
DisabledComponent,
|
|
115
|
+
LifecycleComponent {
|
|
116
116
|
// Button-specific properties and methods
|
|
117
117
|
getValue: () => string;
|
|
118
118
|
setValue: (value: string) => ButtonComponent;
|
|
@@ -133,9 +133,10 @@ mtrl follows a consistent class naming convention:
|
|
|
133
133
|
|
|
134
134
|
```css
|
|
135
135
|
.mtrl-component /* Base component class */
|
|
136
|
+
/* Base component class */
|
|
136
137
|
.mtrl-component--variant /* Variant modifier */
|
|
137
138
|
.mtrl-component--state /* State modifier (disabled, focused) */
|
|
138
|
-
.mtrl-component-element
|
|
139
|
+
.mtrl-component-element; /* Child element */
|
|
139
140
|
```
|
|
140
141
|
|
|
141
142
|
## State Management
|
|
@@ -146,14 +147,14 @@ mtrl provides several approaches to state management:
|
|
|
146
147
|
|
|
147
148
|
```typescript
|
|
148
149
|
const textField = createTextField({
|
|
149
|
-
label:
|
|
150
|
-
})
|
|
150
|
+
label: "Username",
|
|
151
|
+
});
|
|
151
152
|
|
|
152
|
-
textField.on(
|
|
153
|
-
console.log(
|
|
154
|
-
})
|
|
153
|
+
textField.on("input", ({ value }) => {
|
|
154
|
+
console.log("Current value:", value);
|
|
155
|
+
});
|
|
155
156
|
|
|
156
|
-
textField.setValue(
|
|
157
|
+
textField.setValue("New value");
|
|
157
158
|
```
|
|
158
159
|
|
|
159
160
|
### Collection Management
|
|
@@ -164,13 +165,13 @@ For managing lists and datasets:
|
|
|
164
165
|
const collection = new Collection<User>({
|
|
165
166
|
transform: (item) => ({
|
|
166
167
|
...item,
|
|
167
|
-
displayName: `${item.firstName} ${item.lastName}
|
|
168
|
-
})
|
|
169
|
-
})
|
|
168
|
+
displayName: `${item.firstName} ${item.lastName}`,
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
170
171
|
|
|
171
172
|
collection.subscribe(({ event, data }) => {
|
|
172
|
-
console.log(`Collection ${event}:`, data)
|
|
173
|
-
})
|
|
173
|
+
console.log(`Collection ${event}:`, data);
|
|
174
|
+
});
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
## Data Integration
|
|
@@ -180,19 +181,19 @@ mtrl provides adapters for different data sources:
|
|
|
180
181
|
```typescript
|
|
181
182
|
// MongoDB adapter
|
|
182
183
|
const mongoAdapter = createMongoAdapter({
|
|
183
|
-
uri:
|
|
184
|
-
dbName:
|
|
185
|
-
collection:
|
|
186
|
-
})
|
|
184
|
+
uri: "mongodb://localhost:27017",
|
|
185
|
+
dbName: "mtrl-app",
|
|
186
|
+
collection: "users",
|
|
187
|
+
});
|
|
187
188
|
|
|
188
189
|
// Route adapter for REST APIs
|
|
189
190
|
const routeAdapter = createRouteAdapter({
|
|
190
|
-
base:
|
|
191
|
+
base: "/api",
|
|
191
192
|
endpoints: {
|
|
192
|
-
list:
|
|
193
|
-
create:
|
|
194
|
-
}
|
|
195
|
-
})
|
|
193
|
+
list: "/users",
|
|
194
|
+
create: "/users",
|
|
195
|
+
},
|
|
196
|
+
});
|
|
196
197
|
```
|
|
197
198
|
|
|
198
199
|
## Customization
|
|
@@ -216,9 +217,9 @@ const createCustomCard = (config: CustomCardConfig): CustomCardComponent => {
|
|
|
216
217
|
createBase,
|
|
217
218
|
withEvents(),
|
|
218
219
|
withElement({
|
|
219
|
-
tag:
|
|
220
|
-
componentName:
|
|
221
|
-
prefix:
|
|
220
|
+
tag: "div",
|
|
221
|
+
componentName: "card",
|
|
222
|
+
prefix: "mtrl",
|
|
222
223
|
}),
|
|
223
224
|
// Add custom features
|
|
224
225
|
(component) => ({
|
|
@@ -226,10 +227,10 @@ const createCustomCard = (config: CustomCardConfig): CustomCardComponent => {
|
|
|
226
227
|
setContent(content: string) {
|
|
227
228
|
component.element.innerHTML = content;
|
|
228
229
|
return this;
|
|
229
|
-
}
|
|
230
|
+
},
|
|
230
231
|
})
|
|
231
232
|
)(config);
|
|
232
|
-
}
|
|
233
|
+
};
|
|
233
234
|
```
|
|
234
235
|
|
|
235
236
|
### Styling
|
|
@@ -241,7 +242,7 @@ mtrl components can be styled through CSS custom properties:
|
|
|
241
242
|
--mtrl-primary: #6200ee;
|
|
242
243
|
--mtrl-surface: #ffffff;
|
|
243
244
|
--mtrl-on-surface: #000000;
|
|
244
|
-
--mtrl-elevation-1: 0 2px 4px rgba(0,0,0,0.2);
|
|
245
|
+
--mtrl-elevation-1: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
245
246
|
}
|
|
246
247
|
```
|
|
247
248
|
|
|
@@ -321,4 +322,4 @@ For detailed API documentation, examples, and guides, visit our [documentation s
|
|
|
321
322
|
|
|
322
323
|
---
|
|
323
324
|
|
|
324
|
-
This library is designed to provide a solid foundation for building modern web interfaces with TypeScript while maintaining flexibility for custom implementations. For questions, issues, or contributions, please visit our GitHub repository.
|
|
325
|
+
This library is designed to provide a solid foundation for building modern web interfaces with TypeScript while maintaining flexibility for custom implementations. For questions, issues, or contributions, please visit our GitHub repository.
|
|
@@ -3,9 +3,9 @@ import { ChipsConfig, ChipsComponent } from "./types";
|
|
|
3
3
|
* Creates a chips container for grouping related chips
|
|
4
4
|
*
|
|
5
5
|
* Chips follows a clear architectural pattern:
|
|
6
|
-
* 1.
|
|
6
|
+
* 1. Base component - Creates the foundation with event system
|
|
7
7
|
* 2. Feature enhancement - Adds specific capabilities (container, items, etc.)
|
|
8
|
-
* 3. DOM creation -
|
|
8
|
+
* 3. DOM creation - Creates DOM elements directly using optimized createElement
|
|
9
9
|
* 4. Controller - Manages behavior, events, and UI rendering
|
|
10
10
|
* 5. Lifecycle - Handles component lifecycle events
|
|
11
11
|
* 6. Public API - Exposes a clean, consistent API
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChipsConfig } from "../types";
|
|
2
|
+
import { ElementComponent } from "../../../core/compose/component";
|
|
3
|
+
/**
|
|
4
|
+
* Creates the inner chips DOM structure using optimized createElement
|
|
5
|
+
* This works alongside withElement to create chips-specific inner elements
|
|
6
|
+
*
|
|
7
|
+
* @param config Chips configuration
|
|
8
|
+
* @returns Component enhancement function
|
|
9
|
+
*/
|
|
10
|
+
export declare const withDom: (config: ChipsConfig) => <T extends ElementComponent>(component: T) => T & {
|
|
11
|
+
chipContainer: HTMLElement;
|
|
12
|
+
label?: HTMLElement;
|
|
13
|
+
getChipContainer: () => HTMLElement;
|
|
14
|
+
getLabel: () => HTMLElement | null;
|
|
15
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { withContainer } from
|
|
2
|
-
export { withChipItems } from
|
|
3
|
-
export { withController } from
|
|
4
|
-
export { withChipsLabel } from
|
|
1
|
+
export { withContainer } from "./container";
|
|
2
|
+
export { withChipItems } from "./chip-items";
|
|
3
|
+
export { withController } from "./controller";
|
|
4
|
+
export { withChipsLabel } from "./label";
|
|
5
|
+
export { withDom } from "./dom";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChipsConfig } from
|
|
1
|
+
import { ChipsConfig } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Creates the base chips structure definition
|
|
4
4
|
*
|
|
@@ -12,7 +12,7 @@ export declare function createChipsSchema(component: any, config: ChipsConfig):
|
|
|
12
12
|
className: any[];
|
|
13
13
|
attributes: {
|
|
14
14
|
role: string;
|
|
15
|
-
|
|
15
|
+
"aria-multiselectable": string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
children: {
|
|
@@ -8,70 +8,70 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
|
-
export { LIST_DEFAULTS, LIST_TYPES, LIST_SELECTION_MODES, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_CLASSES } from
|
|
11
|
+
export { LIST_DEFAULTS, LIST_TYPES, LIST_SELECTION_MODES, LIST_EVENTS, LIST_SCROLL_POSITIONS, LIST_CLASSES, } from "./list/constants";
|
|
12
12
|
export type { ListConfig, ListComponent, SelectEvent as ListSelectEvent, // Rename to avoid collision
|
|
13
|
-
LoadEvent,
|
|
14
|
-
export { SELECT_VARIANTS, SELECT_PLACEMENT, SELECT_INTERACTION, SELECT_EVENTS, SELECT_ICONS, SELECT_DEFAULTS, SELECT_CLASSES } from
|
|
13
|
+
LoadEvent, } from "./list/types";
|
|
14
|
+
export { SELECT_VARIANTS, SELECT_PLACEMENT, SELECT_INTERACTION, SELECT_EVENTS, SELECT_ICONS, SELECT_DEFAULTS, SELECT_CLASSES, } from "./select/constants";
|
|
15
15
|
export type { SelectConfig, SelectComponent, SelectOption, SelectEvent, // Keep the original name since select is more commonly used
|
|
16
|
-
SelectChangeEvent } from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
29
|
-
export * from
|
|
30
|
-
export { PROGRESS_VARIANTS, PROGRESS_SHAPES, PROGRESS_EVENTS, PROGRESS_DEFAULTS, PROGRESS_CLASSES, PROGRESS_MEASUREMENTS, PROGRESS_THICKNESS } from
|
|
31
|
-
export type { ProgressConfig, ProgressComponent, ProgressShape } from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
37
|
-
export * from
|
|
38
|
-
export * from
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
41
|
-
export * from
|
|
42
|
-
export * from
|
|
43
|
-
export * from
|
|
44
|
-
export { createDivider } from
|
|
45
|
-
export type { DividerConfig } from
|
|
46
|
-
export type { DividerComponent } from
|
|
47
|
-
export { createCardContent, createCardHeader, createCardActions, createCardMedia } from
|
|
48
|
-
export { default as createBadge } from
|
|
49
|
-
export { default as createBottomAppBar } from
|
|
50
|
-
export { default as createButton } from
|
|
51
|
-
export { default as createCard } from
|
|
52
|
-
export { default as createCarousel } from
|
|
53
|
-
export { default as createCheckbox } from
|
|
54
|
-
export { default as createDatePicker } from
|
|
55
|
-
export { default as createDialog } from
|
|
56
|
-
export { default as createFab } from
|
|
57
|
-
export { default as createExtendedFab } from
|
|
58
|
-
export { default as createList } from
|
|
59
|
-
export { default as createMenu } from
|
|
60
|
-
export { default as createNavigation } from
|
|
61
|
-
export { default as createNavigationSystem } from
|
|
62
|
-
export { default as createProgress } from
|
|
63
|
-
export { default as createRadios } from
|
|
64
|
-
export { default as createSearch } from
|
|
65
|
-
export { default as createSelect } from
|
|
66
|
-
export { default as createSegmentedButton } from
|
|
67
|
-
export { createSegment } from
|
|
68
|
-
export { default as createSheet } from
|
|
69
|
-
export { default as createSlider } from
|
|
70
|
-
export { default as createSnackbar } from
|
|
71
|
-
export { default as createSwitch } from
|
|
72
|
-
export { default as createTabs } from
|
|
73
|
-
export { createTab } from
|
|
74
|
-
export { default as createTextfield } from
|
|
75
|
-
export { default as createTimePicker } from
|
|
76
|
-
export { default as createTopAppBar } from
|
|
77
|
-
export { default as createTooltip } from
|
|
16
|
+
SelectChangeEvent, } from "./select/types";
|
|
17
|
+
export * from "./badge";
|
|
18
|
+
export * from "./bottom-app-bar";
|
|
19
|
+
export * from "./button";
|
|
20
|
+
export * from "./card";
|
|
21
|
+
export * from "./carousel";
|
|
22
|
+
export * from "./checkbox";
|
|
23
|
+
export * from "./chips";
|
|
24
|
+
export * from "./datepicker";
|
|
25
|
+
export * from "./dialog";
|
|
26
|
+
export * from "./fab";
|
|
27
|
+
export * from "./extended-fab";
|
|
28
|
+
export * from "./menu";
|
|
29
|
+
export * from "./navigation";
|
|
30
|
+
export { PROGRESS_VARIANTS, PROGRESS_SHAPES, PROGRESS_EVENTS, PROGRESS_DEFAULTS, PROGRESS_CLASSES, PROGRESS_MEASUREMENTS, PROGRESS_THICKNESS, } from "./progress/constants";
|
|
31
|
+
export type { ProgressConfig, ProgressComponent, ProgressShape, } from "./progress/types";
|
|
32
|
+
export * from "./radios";
|
|
33
|
+
export * from "./search";
|
|
34
|
+
export * from "./segmented-button";
|
|
35
|
+
export * from "./sheet";
|
|
36
|
+
export * from "./slider";
|
|
37
|
+
export * from "./snackbar";
|
|
38
|
+
export * from "./switch";
|
|
39
|
+
export * from "./tabs";
|
|
40
|
+
export * from "./textfield";
|
|
41
|
+
export * from "./timepicker";
|
|
42
|
+
export * from "./top-app-bar";
|
|
43
|
+
export * from "./tooltip";
|
|
44
|
+
export { createDivider } from "./divider";
|
|
45
|
+
export type { DividerConfig } from "./divider/config";
|
|
46
|
+
export type { DividerComponent } from "./divider/types";
|
|
47
|
+
export { createCardContent, createCardHeader, createCardActions, createCardMedia, } from "./card/content";
|
|
48
|
+
export { default as createBadge } from "./badge";
|
|
49
|
+
export { default as createBottomAppBar } from "./bottom-app-bar";
|
|
50
|
+
export { default as createButton } from "./button";
|
|
51
|
+
export { default as createCard } from "./card";
|
|
52
|
+
export { default as createCarousel } from "./carousel";
|
|
53
|
+
export { default as createCheckbox } from "./checkbox";
|
|
54
|
+
export { default as createDatePicker } from "./datepicker";
|
|
55
|
+
export { default as createDialog } from "./dialog";
|
|
56
|
+
export { default as createFab } from "./fab";
|
|
57
|
+
export { default as createExtendedFab } from "./extended-fab";
|
|
58
|
+
export { default as createList } from "./list";
|
|
59
|
+
export { default as createMenu } from "./menu";
|
|
60
|
+
export { default as createNavigation } from "./navigation";
|
|
61
|
+
export { default as createNavigationSystem } from "./navigation/system";
|
|
62
|
+
export { default as createProgress } from "./progress";
|
|
63
|
+
export { default as createRadios } from "./radios";
|
|
64
|
+
export { default as createSearch } from "./search";
|
|
65
|
+
export { default as createSelect } from "./select";
|
|
66
|
+
export { default as createSegmentedButton } from "./segmented-button";
|
|
67
|
+
export { createSegment } from "./segmented-button/segment";
|
|
68
|
+
export { default as createSheet } from "./sheet";
|
|
69
|
+
export { default as createSlider } from "./slider";
|
|
70
|
+
export { default as createSnackbar } from "./snackbar";
|
|
71
|
+
export { default as createSwitch } from "./switch";
|
|
72
|
+
export { default as createTabs } from "./tabs";
|
|
73
|
+
export { createTab } from "./tabs/tab";
|
|
74
|
+
export { default as createTextfield } from "./textfield";
|
|
75
|
+
export { default as createTimePicker } from "./timepicker";
|
|
76
|
+
export { default as createTopAppBar } from "./top-app-bar";
|
|
77
|
+
export { default as createTooltip } from "./tooltip";
|