mtrl 0.4.4 → 0.5.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.
- 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/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/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/placement.d.ts +1 -1
- 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/textinput.d.ts +4 -0
- package/dist/core/compose/features/textlabel.d.ts +2 -2
- package/dist/core/compose/index.d.ts +1 -5
- 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 -22
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +36 -74
- package/dist/index.d.ts +1 -6
- 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 +4 -3
- 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
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Layout configuration utilities
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Helper function to clean up previous layout classes from an element
|
|
7
|
-
*
|
|
8
|
-
* @param element - Element to clean layout classes from
|
|
9
|
-
*/
|
|
10
|
-
export declare function cleanupLayoutClasses(element: HTMLElement): void;
|
|
11
|
-
/**
|
|
12
|
-
* Helper function to get the layout type from element classes
|
|
13
|
-
*
|
|
14
|
-
* @param element - Element to check
|
|
15
|
-
* @returns Layout type if found, empty string otherwise
|
|
16
|
-
*/
|
|
17
|
-
export declare function getLayoutType(element: HTMLElement): string;
|
|
18
|
-
/**
|
|
19
|
-
* Applies layout classes based on the layout configuration
|
|
20
|
-
*
|
|
21
|
-
* @param element - Element to apply layout classes to
|
|
22
|
-
* @param layoutConfig - Layout configuration
|
|
23
|
-
* @param cleanupFirst - Whether to clean up previous layout classes first
|
|
24
|
-
*/
|
|
25
|
-
export declare function applyLayoutClasses(element: HTMLElement, layoutConfig: any, cleanupFirst?: boolean): void;
|
|
26
|
-
/**
|
|
27
|
-
* Applies layout item classes based on the configuration
|
|
28
|
-
*
|
|
29
|
-
* @param element - Element to apply layout item classes to
|
|
30
|
-
* @param itemConfig - Layout item configuration
|
|
31
|
-
*/
|
|
32
|
-
export declare function applyLayoutItemClasses(element: HTMLElement, itemConfig: any): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Main layout creation functionality
|
|
4
|
-
*/
|
|
5
|
-
import { Schema, LayoutResult, LayoutOptions } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a DOM or component layout based on a layout definition
|
|
8
|
-
*
|
|
9
|
-
* @param schema - Layout definition (array-based, object-based, or HTML string)
|
|
10
|
-
* @param parentElement - Optional parent element to attach layout to
|
|
11
|
-
* @param options - Additional options for layout creation
|
|
12
|
-
* @returns Object containing the layout and utility functions
|
|
13
|
-
*/
|
|
14
|
-
export declare function createLayout(schema: Schema | any[] | string | Function, parentElement?: HTMLElement | null, options?: LayoutOptions): LayoutResult;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Layout creation system with simplified API
|
|
4
|
-
*/
|
|
5
|
-
export type { ComponentLike, ElementDefinition, Schema, LayoutResult, LayoutOptions, LayoutConfig, LayoutItemConfig } from './types';
|
|
6
|
-
export { isComponent, processClassNames, flattenLayout } from './utils';
|
|
7
|
-
export { createLayout } from './create';
|
|
8
|
-
export { createLayoutResult } from './result';
|
|
9
|
-
export { processSchema, createComponentInstance, isJsxSchema } from './processor';
|
|
10
|
-
export { applyLayoutClasses, applyLayoutItemClasses, getLayoutType, cleanupLayoutClasses } from './config';
|
|
11
|
-
export { h, Fragment, createJsxLayout } from './jsx';
|
|
12
|
-
import { createLayout } from './create';
|
|
13
|
-
export default createLayout;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout/jsx
|
|
3
|
-
* @description Lightweight JSX implementation for the layout system
|
|
4
|
-
*/
|
|
5
|
-
export declare const Fragment: unique symbol;
|
|
6
|
-
/**
|
|
7
|
-
* Convert JSX to our layout array schema
|
|
8
|
-
*/
|
|
9
|
-
export declare function h(type: string | Function | symbol, props: Record<string, any> | null, ...children: any[]): any;
|
|
10
|
-
/**
|
|
11
|
-
* Create a layout from JSX
|
|
12
|
-
*/
|
|
13
|
-
export declare function createJsxLayout(jsxElement: any, parentElement?: HTMLElement | null): import("./types").LayoutResult;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Processor for object-based layout schemas
|
|
4
|
-
*/
|
|
5
|
-
import { Schema, LayoutResult, LayoutOptions } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Processes an object-based layout definition
|
|
8
|
-
*
|
|
9
|
-
* @param schema - Object-based layout definition
|
|
10
|
-
* @param parentElement - Optional parent element to attach layout to
|
|
11
|
-
* @param options - Layout creation options
|
|
12
|
-
* @returns Layout result object
|
|
13
|
-
*/
|
|
14
|
-
export declare function processObjectSchema(schema: Schema, parentElement?: HTMLElement | SVGElement | DocumentFragment | null, options?: LayoutOptions): LayoutResult;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Processor for layout creation
|
|
4
|
-
*/
|
|
5
|
-
import { LayoutResult, LayoutOptions } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Creates a component from a constructor or factory function
|
|
8
|
-
*
|
|
9
|
-
* @param Component - Component constructor or factory function
|
|
10
|
-
* @param options - Component creation options
|
|
11
|
-
* @param layoutOptions - Global layout options
|
|
12
|
-
* @returns Created component instance
|
|
13
|
-
*/
|
|
14
|
-
export declare function createComponentInstance(Component: any, options?: Record<string, any>): any;
|
|
15
|
-
/**
|
|
16
|
-
* Determines if a schema is in JSX format (transformed by h function)
|
|
17
|
-
*/
|
|
18
|
-
export declare function isJsxSchema(schema: any): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Processes any type of layout definition (array or object)
|
|
21
|
-
*
|
|
22
|
-
* @param schema - Layout schema to process
|
|
23
|
-
* @param parentElement - Parent element to attach to
|
|
24
|
-
* @param level - Current nesting level
|
|
25
|
-
* @param options - Layout creation options
|
|
26
|
-
* @returns Layout result object
|
|
27
|
-
*/
|
|
28
|
-
export declare function processSchema(schema: any, parentElement?: HTMLElement | null, level?: number, options?: LayoutOptions): LayoutResult;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Layout result creation and management
|
|
4
|
-
*/
|
|
5
|
-
import { LayoutResult } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a result object with the layout and utility functions
|
|
8
|
-
*
|
|
9
|
-
* @param layout - The raw layout object
|
|
10
|
-
* @returns Result object with layout and utility functions
|
|
11
|
-
*/
|
|
12
|
-
export declare function createLayoutResult(layout: Record<string, any>): LayoutResult;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout/template
|
|
3
|
-
* @description Template literal-based layout creation without compilation requirements
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Tagged template function for creating layouts
|
|
7
|
-
*/
|
|
8
|
-
export declare function html(strings: TemplateStringsArray, ...values: any[]): any;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a layout from a template literal
|
|
11
|
-
*/
|
|
12
|
-
export declare function createTemplateLayout(templateResult: any[], parentElement?: HTMLElement | null): import("./types").LayoutResult;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Type definitions for layout creation system
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Layout configuration options
|
|
7
|
-
*/
|
|
8
|
-
export interface LayoutConfig {
|
|
9
|
-
/** Base layout type */
|
|
10
|
-
type?: 'stack' | 'row' | 'grid' | string;
|
|
11
|
-
/** Spacing between elements */
|
|
12
|
-
gap?: number | string;
|
|
13
|
-
/** Additional CSS classes */
|
|
14
|
-
class?: string;
|
|
15
|
-
/** Alignment of items along the cross axis */
|
|
16
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
17
|
-
/** Alignment of items along the main axis */
|
|
18
|
-
justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
19
|
-
/** Whether and how items should wrap */
|
|
20
|
-
wrap?: boolean | 'reverse' | 'nowrap';
|
|
21
|
-
/** Whether row items should stack vertically on mobile */
|
|
22
|
-
mobileStack?: boolean;
|
|
23
|
-
/** Whether row items should scroll horizontally on mobile */
|
|
24
|
-
mobileScroll?: boolean;
|
|
25
|
-
/** Number of columns or automatic sizing method */
|
|
26
|
-
columns?: number | 'auto-fit' | 'auto-fill';
|
|
27
|
-
/** Minimum item width for grid layouts */
|
|
28
|
-
minWidth?: string | number;
|
|
29
|
-
/** Whether to use dense packing algorithm for grid */
|
|
30
|
-
dense?: boolean;
|
|
31
|
-
/** Whether grid items should adjust height automatically */
|
|
32
|
-
autoHeight?: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Configuration for individual layout items
|
|
36
|
-
*/
|
|
37
|
-
export interface LayoutItemConfig {
|
|
38
|
-
/** Column width in a 12-column grid */
|
|
39
|
-
width?: number;
|
|
40
|
-
/** Width on small screens */
|
|
41
|
-
sm?: number;
|
|
42
|
-
/** Width on medium screens */
|
|
43
|
-
md?: number;
|
|
44
|
-
/** Width on large screens */
|
|
45
|
-
lg?: number;
|
|
46
|
-
/** Width on extra-large screens */
|
|
47
|
-
xl?: number;
|
|
48
|
-
/** Number of grid columns to span */
|
|
49
|
-
span?: number;
|
|
50
|
-
/** Number of grid rows to span */
|
|
51
|
-
rowSpan?: number;
|
|
52
|
-
/** Display order */
|
|
53
|
-
order?: number | 'first' | 'last';
|
|
54
|
-
/** Self-alignment within container */
|
|
55
|
-
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
56
|
-
/** Whether item should automatically size */
|
|
57
|
-
auto?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Interface for component-like objects
|
|
61
|
-
*/
|
|
62
|
-
export interface ComponentLike {
|
|
63
|
-
/** DOM element reference */
|
|
64
|
-
element: HTMLElement;
|
|
65
|
-
/** Optional method to clean up resources */
|
|
66
|
-
destroy?: () => void;
|
|
67
|
-
/** Allow additional properties */
|
|
68
|
-
[key: string]: any;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Extended options for element creation
|
|
72
|
-
*/
|
|
73
|
-
export interface ElementOptions extends Record<string, any> {
|
|
74
|
-
/** Layout configuration for the element */
|
|
75
|
-
layout?: LayoutConfig;
|
|
76
|
-
/** Layout item configuration */
|
|
77
|
-
layoutItem?: LayoutItemConfig;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Definition for a single element in the layout
|
|
81
|
-
*/
|
|
82
|
-
export interface ElementDefinition {
|
|
83
|
-
/** Optional name to reference the element */
|
|
84
|
-
name?: string;
|
|
85
|
-
/** Creator function that produces an HTMLElement or ComponentLike */
|
|
86
|
-
creator?: (options?: Record<string, any>) => HTMLElement | ComponentLike;
|
|
87
|
-
/** Options to pass to the creator function */
|
|
88
|
-
options?: ElementOptions;
|
|
89
|
-
/** Child elements to create and attach */
|
|
90
|
-
children?: Record<string, ElementDefinition>;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Schema for layout creation
|
|
94
|
-
*/
|
|
95
|
-
export interface Schema {
|
|
96
|
-
/** Root element definition */
|
|
97
|
-
element?: ElementDefinition;
|
|
98
|
-
/** Additional elements */
|
|
99
|
-
[key: string]: ElementDefinition | undefined;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Options for layout creation
|
|
103
|
-
*/
|
|
104
|
-
export interface LayoutOptions {
|
|
105
|
-
/** Default creator function to use if not specified in schema */
|
|
106
|
-
creator?: (options?: Record<string, any>) => HTMLElement | ComponentLike;
|
|
107
|
-
/** Whether to apply CSS class prefix @default true */
|
|
108
|
-
prefix?: boolean;
|
|
109
|
-
/** Additional options */
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Result object returned after creating a layout
|
|
114
|
-
*/
|
|
115
|
-
export interface LayoutResult {
|
|
116
|
-
/** The raw layout object with all components */
|
|
117
|
-
layout: Record<string, any>;
|
|
118
|
-
/** Reference to the root element for convenience */
|
|
119
|
-
element: HTMLElement | ComponentLike;
|
|
120
|
-
/** Flattened component map */
|
|
121
|
-
component: Record<string, any>;
|
|
122
|
-
/**
|
|
123
|
-
* Gets a component by name
|
|
124
|
-
* @param name - Component name
|
|
125
|
-
* @returns Component if found, null otherwise
|
|
126
|
-
*/
|
|
127
|
-
get(name: string): any;
|
|
128
|
-
/**
|
|
129
|
-
* Gets all components in a flattened map
|
|
130
|
-
* @returns Object with all components
|
|
131
|
-
*/
|
|
132
|
-
getAll(): Record<string, any>;
|
|
133
|
-
/**
|
|
134
|
-
* Destroys the layout, cleaning up all components
|
|
135
|
-
*/
|
|
136
|
-
destroy(): void;
|
|
137
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Utility functions for layout creation
|
|
4
|
-
*/
|
|
5
|
-
import { ComponentLike } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Checks if a value is a component object (has an element property)
|
|
8
|
-
*
|
|
9
|
-
* @param value - Value to check
|
|
10
|
-
* @returns True if the value is a component-like object
|
|
11
|
-
*/
|
|
12
|
-
export declare function isComponent(value: any): value is ComponentLike;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a document fragment for faster DOM operations
|
|
15
|
-
*
|
|
16
|
-
* @returns New DocumentFragment
|
|
17
|
-
*/
|
|
18
|
-
export declare function createFragment(): DocumentFragment;
|
|
19
|
-
/**
|
|
20
|
-
* Normalizes class values into an array of strings
|
|
21
|
-
*/
|
|
22
|
-
export declare function normalizeClasses(...classes: (string | string[])[]): string[];
|
|
23
|
-
/**
|
|
24
|
-
* Processes className options to add prefix if needed
|
|
25
|
-
*
|
|
26
|
-
* @param options - Element options
|
|
27
|
-
* @param skipPrefix - Whether to skip adding prefixes
|
|
28
|
-
* @param useBEM - Whether to respect BEM naming conventions
|
|
29
|
-
* @returns Updated options with prefixed classNames
|
|
30
|
-
*/
|
|
31
|
-
export declare function processClassNames(options: Record<string, any>, skipPrefix?: boolean, useBEM?: boolean): Record<string, any>;
|
|
32
|
-
/**
|
|
33
|
-
* Flattens a nested layout into a simple object with element and component references
|
|
34
|
-
*
|
|
35
|
-
* @param layout - Layout object
|
|
36
|
-
* @returns Flattened layout with all elements and components
|
|
37
|
-
*/
|
|
38
|
-
export declare function flattenLayout(layout: Record<string, any>): Record<string, any>;
|