@expressivecss/expressive 0.3.0 → 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/CHANGELOG.md +96 -0
- package/README.md +4 -9
- package/dist/css/expressive.css +3183 -2150
- package/dist/css/expressive.css.map +1 -1
- package/dist/css/expressive.min.css +1 -1
- package/dist/css/expressive.min.css.map +1 -1
- package/dist/js/expressive.cjs +1254 -1567
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +1254 -1567
- package/dist/js/expressive.js.map +4 -4
- package/dist/js/expressive.min.js +12 -22
- package/dist/js/expressive.min.js.map +4 -4
- package/dist/js/expressive.mjs +1254 -1568
- package/dist/js/expressive.mjs.map +4 -4
- package/dist/types/behaviors/bottomSheets.d.ts +18 -0
- package/dist/types/behaviors/sideSheets.d.ts +18 -0
- package/dist/types/components/autocomplete.d.ts +13 -20
- package/dist/types/components/buttons.d.ts +2 -2
- package/dist/types/components/cards.d.ts +3 -6
- package/dist/types/components/carousel.d.ts +3 -3
- package/dist/types/components/characterCounter.d.ts +3 -5
- package/dist/types/components/chips.d.ts +2 -2
- package/dist/types/components/datepicker.d.ts +2 -8
- package/dist/types/components/index.d.ts +3 -6
- package/dist/types/components/lightbox.d.ts +2 -2
- package/dist/types/components/{dropdown.d.ts → menu.d.ts} +48 -38
- package/dist/types/components/navigationRail.d.ts +53 -0
- package/dist/types/components/parallax.d.ts +2 -8
- package/dist/types/components/range.d.ts +5 -2
- package/dist/types/components/registry.d.ts +7 -19
- package/dist/types/components/scrollspy.d.ts +26 -50
- package/dist/types/components/select.d.ts +28 -14
- package/dist/types/components/sidenav.d.ts +40 -55
- package/dist/types/components/slider.d.ts +2 -2
- package/dist/types/components/{toasts.d.ts → snackbar.d.ts} +28 -25
- package/dist/types/components/tabs.d.ts +2 -2
- package/dist/types/components/timepicker.d.ts +2 -4
- package/dist/types/components/tooltip.d.ts +2 -2
- package/dist/types/core/component.d.ts +4 -4
- package/dist/types/index.d.ts +3 -1
- package/package.json +4 -3
- package/src/sass/README.md +13 -15
- package/src/sass/abstracts/_breakpoints.scss +14 -19
- package/src/sass/abstracts/_mixins.scss +3 -3
- package/src/sass/abstracts/_variables.scss +27 -23
- package/src/sass/base/_global.scss +1 -1
- package/src/sass/base/_grid.scss +64 -133
- package/src/sass/base/_index.scss +1 -1
- package/src/sass/components/_badges.scss +76 -61
- package/src/sass/components/_bottom-sheet.scss +137 -0
- package/src/sass/components/_buttons.scss +22 -54
- package/src/sass/components/_cards.scss +54 -127
- package/src/sass/components/_carousel.scss +4 -6
- package/src/sass/components/_chips.scss +6 -5
- package/src/sass/components/_datepicker.scss +1 -15
- package/src/sass/components/_dialog.scss +268 -0
- package/src/sass/components/_index.scss +9 -7
- package/src/sass/components/_list.scss +253 -0
- package/src/sass/components/_menu.scss +341 -0
- package/src/sass/components/_navbar.scss +68 -117
- package/src/sass/components/_navigation-bar.scss +165 -0
- package/src/sass/components/_navigation-rail.scss +308 -0
- package/src/sass/components/_page-footer.scss +138 -15
- package/src/sass/components/_parallax.scss +7 -28
- package/src/sass/components/_preloader.scss +145 -300
- package/src/sass/components/_scrollspy.scss +18 -0
- package/src/sass/components/_side-sheet.scss +193 -0
- package/src/sass/components/_sidenav.scss +281 -146
- package/src/sass/components/{_toast.scss → _snackbar.scss} +43 -43
- package/src/sass/components/_table_of_contents.scss +30 -14
- package/src/sass/components/_tabs.scss +43 -50
- package/src/sass/components/_toolbar.scss +93 -27
- package/src/sass/components/_tooltip.scss +5 -10
- package/src/sass/components/_transitions.scss +0 -5
- package/src/sass/components/forms/_fieldset.scss +1 -1
- package/src/sass/components/forms/_index.scss +0 -5
- package/src/sass/components/forms/_input-fields.scss +52 -55
- package/src/sass/components/forms/_range.scss +423 -98
- package/src/sass/components/forms/_select.scss +177 -60
- package/src/sass/components/forms/_switches.scss +21 -8
- package/src/sass/tokens/_reference.scss +37 -13
- package/src/sass/tokens/_theme.scss +5 -13
- package/src/sass/utilities/_colors.scss +16 -74
- package/src/sass/utilities/_helpers.scss +1 -3
- package/src/sass/utilities/_typescale.scss +0 -5
- package/src/sass/utilities/_visibility.scss +10 -2
- package/dist/types/components/collapsible.d.ts +0 -96
- package/dist/types/components/modal.d.ts +0 -45
- package/dist/types/components/pushpin.d.ts +0 -51
- package/dist/types/components/tapTarget.d.ts +0 -57
- package/src/sass/components/_collapsible.scss +0 -181
- package/src/sass/components/_collection.scss +0 -198
- package/src/sass/components/_dropdown.scss +0 -129
- package/src/sass/components/_modal.scss +0 -208
- package/src/sass/components/_pushpin.scss +0 -11
- package/src/sass/components/_tapTarget.scss +0 -191
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
|
|
2
2
|
export interface ScrollSpyOptions extends BaseOptions {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
throttle: number;
|
|
8
|
-
/**
|
|
9
|
-
* Offset for centering element when scrolled to.
|
|
4
|
+
* Offset used as IntersectionObserver rootMargin and as
|
|
5
|
+
* `--md-comp-scrollspy-offset` (scroll-margin on the section).
|
|
10
6
|
* @default 200
|
|
11
7
|
*/
|
|
12
8
|
scrollOffset: number;
|
|
@@ -16,62 +12,42 @@ export interface ScrollSpyOptions extends BaseOptions {
|
|
|
16
12
|
*/
|
|
17
13
|
activeClass: string;
|
|
18
14
|
/**
|
|
19
|
-
*
|
|
15
|
+
* Returns a CSS selector for the TOC link. The default is unused: links
|
|
16
|
+
* are found by comparing `a[href^="#"]` to `#id`. A custom function
|
|
17
|
+
* still runs through `querySelector` (escape any author id yourself).
|
|
20
18
|
* @default id => 'a[href="#' + id + '"]'
|
|
21
19
|
*/
|
|
22
20
|
getActiveElement: (id: string) => string;
|
|
23
21
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* If there is no last top element,
|
|
28
|
-
* then the active one will be the first element.
|
|
29
|
-
*
|
|
22
|
+
* If true, keep the last section above the viewport active when nothing
|
|
23
|
+
* intersects. If there is no such section, the first one stays active.
|
|
30
24
|
* @default false
|
|
31
25
|
*/
|
|
32
26
|
keepTopElementActive: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Used to set scroll animation duration in milliseconds.
|
|
35
|
-
* @default null (browser's native animation implementation/duration)
|
|
36
|
-
*/
|
|
37
|
-
animationDuration: number | null;
|
|
38
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* ScrollSpy. IntersectionObserver decides which section is current.
|
|
30
|
+
* Hash links are left to the browser (`scroll-margin` + `scroll-behavior`).
|
|
31
|
+
*/
|
|
39
32
|
export declare class ScrollSpy extends Component<ScrollSpyOptions> {
|
|
40
33
|
static _elements: ScrollSpy[];
|
|
41
|
-
static
|
|
42
|
-
static
|
|
43
|
-
static
|
|
44
|
-
static _visibleElements: HTMLElement[];
|
|
45
|
-
static _ticks: number;
|
|
46
|
-
static _keptTopActiveElement: HTMLElement | null;
|
|
47
|
-
private static _throttledScroll;
|
|
48
|
-
private static _throttledResize;
|
|
49
|
-
private tickId;
|
|
50
|
-
private id;
|
|
34
|
+
private static _observer;
|
|
35
|
+
private static _ratios;
|
|
36
|
+
private static _active;
|
|
51
37
|
constructor(el: HTMLElement, options: Partial<ScrollSpyOptions>);
|
|
52
38
|
static get defaults(): ScrollSpyOptions;
|
|
53
|
-
/**
|
|
54
|
-
* Initializes instance of ScrollSpy.
|
|
55
|
-
* @param el HTML element.
|
|
56
|
-
* @param options Component options.
|
|
57
|
-
*/
|
|
58
39
|
static init(el: HTMLElement, options?: Partial<ScrollSpyOptions>): ScrollSpy;
|
|
59
|
-
|
|
60
|
-
* Initializes instances of ScrollSpy.
|
|
61
|
-
* @param els HTML elements.
|
|
62
|
-
* @param options Component options.
|
|
63
|
-
*/
|
|
64
|
-
static init(els: InitElements<MElement>, options?: Partial<ScrollSpyOptions>): ScrollSpy[];
|
|
40
|
+
static init(els: InitElements<InitElement>, options?: Partial<ScrollSpyOptions>): ScrollSpy[];
|
|
65
41
|
static getInstance(el: HTMLElement): ScrollSpy;
|
|
66
42
|
destroy(): void;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
static
|
|
70
|
-
static
|
|
71
|
-
static
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
43
|
+
private static _ensureObserver;
|
|
44
|
+
private static _onIntersect;
|
|
45
|
+
private static _syncActive;
|
|
46
|
+
private static _nearestAbove;
|
|
47
|
+
private static _clearActive;
|
|
48
|
+
/**
|
|
49
|
+
* Default lookup compares href attributes (no interpolated selector).
|
|
50
|
+
* A custom getActiveElement still returns a selector.
|
|
51
|
+
*/
|
|
52
|
+
static _linkFor(id: string, options: ScrollSpyOptions): Element | null;
|
|
77
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Menu, MenuOptions } from './menu';
|
|
2
|
+
import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
|
|
3
3
|
export interface FormSelectOptions extends BaseOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Classes to be added to the select wrapper element.
|
|
@@ -7,10 +7,10 @@ export interface FormSelectOptions extends BaseOptions {
|
|
|
7
7
|
*/
|
|
8
8
|
classes: string;
|
|
9
9
|
/**
|
|
10
|
-
* Pass options object to select
|
|
10
|
+
* Pass options object to select menu initialization.
|
|
11
11
|
* @default {}
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
menuOptions: Partial<MenuOptions>;
|
|
14
14
|
}
|
|
15
15
|
type ValueStruct = {
|
|
16
16
|
el: HTMLOptionElement;
|
|
@@ -25,16 +25,18 @@ export declare class FormSelect extends Component<FormSelectOptions> {
|
|
|
25
25
|
* Is "null", if not detected.
|
|
26
26
|
*/
|
|
27
27
|
labelEl: HTMLLabelElement;
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/** The generated menu element. */
|
|
29
|
+
menuEl: HTMLElement;
|
|
30
30
|
/** Text input that shows current selected option. */
|
|
31
31
|
input: HTMLInputElement;
|
|
32
|
-
/** Instance of the
|
|
33
|
-
|
|
34
|
-
/** The
|
|
32
|
+
/** Instance of the menu plugin for this select. */
|
|
33
|
+
menu: Menu;
|
|
34
|
+
/** The field wrapper around the native select. */
|
|
35
35
|
wrapper: HTMLDivElement;
|
|
36
36
|
selectOptions: (HTMLOptionElement | HTMLOptGroupElement)[];
|
|
37
37
|
private _values;
|
|
38
|
+
private _createdWrapper;
|
|
39
|
+
private _originalLabelFor;
|
|
38
40
|
nativeTabIndex: number;
|
|
39
41
|
constructor(el: HTMLSelectElement, options: FormSelectOptions);
|
|
40
42
|
static get defaults(): FormSelectOptions;
|
|
@@ -49,28 +51,40 @@ export declare class FormSelect extends Component<FormSelectOptions> {
|
|
|
49
51
|
* @param els HTML elements.
|
|
50
52
|
* @param options Component options.
|
|
51
53
|
*/
|
|
52
|
-
static init(els: InitElements<HTMLSelectElement |
|
|
54
|
+
static init(els: InitElements<HTMLSelectElement | InitElement>, options?: Partial<FormSelectOptions>): FormSelect[];
|
|
53
55
|
static getInstance(el: HTMLElement): FormSelect;
|
|
54
56
|
destroy(): void;
|
|
55
57
|
/**
|
|
56
|
-
* Re-read the native `<select>` and update the generated
|
|
58
|
+
* Re-read the native `<select>` and update the generated menu to match.
|
|
57
59
|
*
|
|
58
60
|
* Assigning `select.value` from script fires no `change` event, so nothing
|
|
59
61
|
* else syncs the visible input text or the `.selected` state on the virtual
|
|
60
|
-
* options.
|
|
62
|
+
* options. Adding or removing `<option>`s also requires this — the menu is
|
|
63
|
+
* rebuilt from the native list, the field and Menu instance stay put.
|
|
61
64
|
*/
|
|
62
65
|
refresh(): void;
|
|
63
66
|
_setupEventHandlers(): void;
|
|
64
67
|
_removeEventHandlers(): void;
|
|
68
|
+
private _setupOptionHandlers;
|
|
69
|
+
private _removeOptionHandlers;
|
|
65
70
|
_handleSelectChange: () => void;
|
|
66
71
|
_handleOptionKeydown: (e: KeyboardEvent) => void;
|
|
67
72
|
_handleOptionClick: (e: MouseEvent | KeyboardEvent) => void;
|
|
73
|
+
private _handleOptionFocus;
|
|
68
74
|
_arraysEqual<T, E>(a: T[], b: (E | T)[]): boolean;
|
|
69
75
|
_selectOptionElement(virtualOption: HTMLElement): void;
|
|
70
76
|
_handleInputClick: () => void;
|
|
71
|
-
|
|
77
|
+
_setupMenu(): void;
|
|
78
|
+
private _setupWrapper;
|
|
79
|
+
private _hideNativeSelect;
|
|
80
|
+
private _buildInput;
|
|
81
|
+
private _buildCaret;
|
|
82
|
+
private _initMenu;
|
|
83
|
+
private _nativeOptions;
|
|
84
|
+
private _buildOptions;
|
|
85
|
+
private _rebuildOptions;
|
|
72
86
|
_addOptionToValues(realOption: HTMLOptionElement, virtualOption: HTMLElement): void;
|
|
73
|
-
|
|
87
|
+
_removeMenu(): void;
|
|
74
88
|
_createAndAppendOptionWithIcon(realOption: HTMLOptionElement | HTMLOptGroupElement, type: string): HTMLLIElement;
|
|
75
89
|
_selectValue(value: ValueStruct): void;
|
|
76
90
|
_deselectValue(value: ValueStruct): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Component, BaseOptions, InitElements, InitElement, Openable } from '../core/component';
|
|
2
2
|
export interface SidenavOptions extends BaseOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Side of screen on which Sidenav appears.
|
|
@@ -15,21 +15,6 @@ export interface SidenavOptions extends BaseOptions {
|
|
|
15
15
|
* @default '10px'
|
|
16
16
|
*/
|
|
17
17
|
dragTargetWidth: string;
|
|
18
|
-
/**
|
|
19
|
-
* Length in ms of enter transition.
|
|
20
|
-
* @default 250
|
|
21
|
-
*/
|
|
22
|
-
inDuration: number;
|
|
23
|
-
/**
|
|
24
|
-
* Length in ms of exit transition.
|
|
25
|
-
* @default 200
|
|
26
|
-
*/
|
|
27
|
-
outDuration: number;
|
|
28
|
-
/**
|
|
29
|
-
* Prevent page from scrolling while sidenav is open.
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
preventScrolling: boolean;
|
|
33
18
|
/**
|
|
34
19
|
* Function called when sidenav starts entering.
|
|
35
20
|
*/
|
|
@@ -47,27 +32,30 @@ export interface SidenavOptions extends BaseOptions {
|
|
|
47
32
|
*/
|
|
48
33
|
onCloseEnd: (elem: HTMLElement) => void;
|
|
49
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Navigation drawer. Overlay is a modal <dialog>; fixed is a breakpoint.
|
|
37
|
+
* JS opens/closes, handles the trigger, and writes --md-comp-nav-drawer-shift
|
|
38
|
+
* while dragging. CSS owns the slide, the scrim, and the large-screen dock.
|
|
39
|
+
*/
|
|
50
40
|
export declare class Sidenav extends Component<SidenavOptions> implements Openable {
|
|
51
41
|
id: string;
|
|
52
|
-
/** Describes open/close state of
|
|
42
|
+
/** Describes open/close state of the overlay drawer. */
|
|
53
43
|
isOpen: boolean;
|
|
54
|
-
/** Describes if sidenav
|
|
44
|
+
/** Describes if sidenav has sidenav-fixed. */
|
|
55
45
|
isFixed: boolean;
|
|
56
46
|
/** Describes if Sidenav is being dragged. */
|
|
57
47
|
isDragged: boolean;
|
|
58
|
-
lastWindowWidth: number;
|
|
59
|
-
lastWindowHeight: number;
|
|
60
48
|
static _sidenavs: Sidenav[];
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
dragTarget: HTMLElement | null;
|
|
50
|
+
private _dialog;
|
|
51
|
+
private _createdDialog;
|
|
52
|
+
private _closing;
|
|
53
|
+
private _mql;
|
|
63
54
|
private _startingXpos;
|
|
64
55
|
private _xPos;
|
|
65
|
-
private _time;
|
|
66
56
|
private _width;
|
|
67
57
|
private _initialScrollTop;
|
|
68
58
|
private _verticallyScrolling;
|
|
69
|
-
private deltaX;
|
|
70
|
-
private velocityX;
|
|
71
59
|
private percentOpen;
|
|
72
60
|
constructor(el: HTMLElement, options: Partial<SidenavOptions>);
|
|
73
61
|
static get defaults(): SidenavOptions;
|
|
@@ -82,44 +70,41 @@ export declare class Sidenav extends Component<SidenavOptions> implements Openab
|
|
|
82
70
|
* @param els HTML elements.
|
|
83
71
|
* @param options Component options.
|
|
84
72
|
*/
|
|
85
|
-
static init(els: InitElements<
|
|
73
|
+
static init(els: InitElements<InitElement>, options?: Partial<SidenavOptions>): Sidenav[];
|
|
86
74
|
static getInstance(el: HTMLElement): Sidenav;
|
|
87
75
|
destroy(): void;
|
|
88
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Opens the overlay drawer. No-op while the sidenav is docked
|
|
78
|
+
* (sidenav-fixed at the large breakpoint).
|
|
79
|
+
*/
|
|
80
|
+
open: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Closes the overlay drawer. No-op while the sidenav is docked.
|
|
83
|
+
*/
|
|
84
|
+
close: () => void;
|
|
85
|
+
private _beginClose;
|
|
86
|
+
private _finishClose;
|
|
87
|
+
private _onDialogClose;
|
|
88
|
+
private _onBreakpointChange;
|
|
89
|
+
private _setupDialog;
|
|
90
|
+
private _unwrapDialog;
|
|
91
|
+
private _createDragTarget;
|
|
92
|
+
private _removeDragTarget;
|
|
93
|
+
private _setupClasses;
|
|
89
94
|
private _setupEventHandlers;
|
|
90
95
|
private _removeEventHandlers;
|
|
91
|
-
private _handleTriggerClick;
|
|
96
|
+
private static _handleTriggerClick;
|
|
97
|
+
private _handleCloseTriggerClick;
|
|
98
|
+
private _isDraggable;
|
|
99
|
+
private _isCurrentlyFixed;
|
|
92
100
|
private _startDrag;
|
|
93
101
|
private _dragMoveUpdate;
|
|
102
|
+
private _rawDelta;
|
|
103
|
+
private _applyShift;
|
|
104
|
+
private _clearShift;
|
|
94
105
|
private _handleDragTargetDrag;
|
|
95
106
|
private _handleDragTargetRelease;
|
|
96
107
|
private _handleCloseDrag;
|
|
97
|
-
private _calculateDelta;
|
|
98
108
|
private _handleCloseRelease;
|
|
99
|
-
private
|
|
100
|
-
private _handleWindowResize;
|
|
101
|
-
private _setupClasses;
|
|
102
|
-
private _removeClasses;
|
|
103
|
-
private _setupFixed;
|
|
104
|
-
private _isDraggable;
|
|
105
|
-
private _isCurrentlyFixed;
|
|
106
|
-
private _createDragTarget;
|
|
107
|
-
private _preventBodyScrolling;
|
|
108
|
-
private _enableBodyScrolling;
|
|
109
|
-
/**
|
|
110
|
-
* Opens Sidenav.
|
|
111
|
-
*/
|
|
112
|
-
open: () => void;
|
|
113
|
-
/**
|
|
114
|
-
* Closes Sidenav.
|
|
115
|
-
*/
|
|
116
|
-
close: () => void;
|
|
117
|
-
private _animateIn;
|
|
118
|
-
private _animateOut;
|
|
119
|
-
private _animateSidenavIn;
|
|
120
|
-
private _animateSidenavOut;
|
|
121
|
-
private _animateOverlayIn;
|
|
122
|
-
private _animateOverlayOut;
|
|
123
|
-
private _setAriaHidden;
|
|
124
|
-
private _setTabIndex;
|
|
109
|
+
private _syncTriggers;
|
|
125
110
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
|
|
2
2
|
export interface SliderOptions extends BaseOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Set to false to hide slide indicators.
|
|
@@ -65,7 +65,7 @@ export declare class Slider extends Component<SliderOptions> {
|
|
|
65
65
|
* @param els HTML elements.
|
|
66
66
|
* @param options Component options.
|
|
67
67
|
*/
|
|
68
|
-
static init(els: InitElements<
|
|
68
|
+
static init(els: InitElements<InitElement>, options?: Partial<SliderOptions>): Slider[];
|
|
69
69
|
static getInstance(el: HTMLElement): Slider;
|
|
70
70
|
destroy(): void;
|
|
71
71
|
private _setupEventHandlers;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseOptions } from '../core/component';
|
|
2
|
-
export interface
|
|
2
|
+
export interface SnackbarOptions extends BaseOptions {
|
|
3
3
|
/**
|
|
4
|
-
* The content of the
|
|
4
|
+
* The content of the Snackbar.
|
|
5
5
|
* @default ""
|
|
6
6
|
*/
|
|
7
7
|
text: string;
|
|
@@ -11,7 +11,7 @@ export interface ToastOptions extends BaseOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
action: string;
|
|
13
13
|
/**
|
|
14
|
-
* Called when the action button is pressed. The
|
|
14
|
+
* Called when the action button is pressed. The snackbar still dismisses.
|
|
15
15
|
* @default null
|
|
16
16
|
*/
|
|
17
17
|
onAction: () => void;
|
|
@@ -21,12 +21,14 @@ export interface ToastOptions extends BaseOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
dismissible: boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Element
|
|
24
|
+
* Element id of a `<template>` (or another element) used as the snackbar body.
|
|
25
25
|
* @default ""
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
snackbarId?: string;
|
|
28
28
|
/**
|
|
29
|
-
* Length in ms the
|
|
29
|
+
* Length in ms the Snackbar stays before dismissal.
|
|
30
|
+
* `Infinity` keeps it on screen until the user acts.
|
|
31
|
+
* When `action` is set and this is omitted, the default is 10000.
|
|
30
32
|
* @default 4000
|
|
31
33
|
*/
|
|
32
34
|
displayLength: number;
|
|
@@ -41,38 +43,38 @@ export interface ToastOptions extends BaseOptions {
|
|
|
41
43
|
*/
|
|
42
44
|
outDuration: number;
|
|
43
45
|
/**
|
|
44
|
-
* Classes to be added to the
|
|
46
|
+
* Classes to be added to the snackbar element.
|
|
45
47
|
* @default ""
|
|
46
48
|
*/
|
|
47
49
|
classes: string;
|
|
48
50
|
/**
|
|
49
|
-
* Callback function called when
|
|
51
|
+
* Callback function called when the snackbar is dismissed.
|
|
50
52
|
* @default null
|
|
51
53
|
*/
|
|
52
54
|
completeCallback: () => void;
|
|
53
55
|
/**
|
|
54
|
-
* The percentage of the
|
|
55
|
-
* to dismiss a
|
|
56
|
+
* The percentage of the snackbar's width it takes for a drag
|
|
57
|
+
* to dismiss a Snackbar.
|
|
56
58
|
* @default 0.8
|
|
57
59
|
*/
|
|
58
60
|
activationPercent: number;
|
|
59
61
|
}
|
|
60
|
-
export declare class
|
|
61
|
-
/** The
|
|
62
|
+
export declare class Snackbar {
|
|
63
|
+
/** The snackbar element. */
|
|
62
64
|
el: HTMLElement;
|
|
63
65
|
/**
|
|
64
|
-
* The remaining amount of time in ms that the
|
|
66
|
+
* The remaining amount of time in ms that the snackbar
|
|
65
67
|
* will stay before dismissal.
|
|
66
68
|
*/
|
|
67
69
|
timeRemaining: number;
|
|
68
70
|
/**
|
|
69
|
-
* Describes the current pan state of the
|
|
71
|
+
* Describes the current pan state of the Snackbar.
|
|
70
72
|
*/
|
|
71
73
|
panning: boolean;
|
|
72
|
-
options:
|
|
74
|
+
options: SnackbarOptions;
|
|
73
75
|
message: string;
|
|
74
76
|
counterTimeout: ReturnType<typeof setTimeout>;
|
|
75
|
-
/** Wall-clock time the
|
|
77
|
+
/** Wall-clock time the snackbar is due to dismiss, for pause/resume. */
|
|
76
78
|
private _deadline;
|
|
77
79
|
wasSwiped: boolean;
|
|
78
80
|
startingXPos: number;
|
|
@@ -80,12 +82,13 @@ export declare class Toast {
|
|
|
80
82
|
time: number;
|
|
81
83
|
deltaX: number;
|
|
82
84
|
velocityX: number;
|
|
83
|
-
|
|
85
|
+
private _dismissed;
|
|
86
|
+
static _snackbars: Snackbar[];
|
|
84
87
|
static _container: HTMLElement;
|
|
85
|
-
static
|
|
86
|
-
constructor(options
|
|
87
|
-
static get defaults():
|
|
88
|
-
static getInstance(el: HTMLElement):
|
|
88
|
+
static _draggedSnackbar: Snackbar;
|
|
89
|
+
constructor(options?: Partial<SnackbarOptions>);
|
|
90
|
+
static get defaults(): SnackbarOptions;
|
|
91
|
+
static getInstance(el: HTMLElement): Snackbar;
|
|
89
92
|
static _createContainer(): void;
|
|
90
93
|
static _removeContainer(): void;
|
|
91
94
|
static _onDragStart(e: TouchEvent | MouseEvent): void;
|
|
@@ -93,16 +96,16 @@ export declare class Toast {
|
|
|
93
96
|
static _onDragEnd(): void;
|
|
94
97
|
static _xPos(e: TouchEvent | MouseEvent): number;
|
|
95
98
|
/**
|
|
96
|
-
* dismiss all
|
|
99
|
+
* dismiss all snackbars.
|
|
97
100
|
*/
|
|
98
101
|
static dismissAll(): void;
|
|
99
|
-
|
|
102
|
+
_createSnackbar(): HTMLElement;
|
|
100
103
|
_animateIn(): void;
|
|
101
104
|
/**
|
|
102
105
|
* Arm the dismissal timer.
|
|
103
106
|
*
|
|
104
107
|
* One timeout, not a 20ms interval ticking a counter down: the old form woke
|
|
105
|
-
* the page up 50 times a second per
|
|
108
|
+
* the page up 50 times a second per snackbar purely to subtract 20 from a
|
|
106
109
|
* number. Dragging pauses the countdown via _pauseTimer/_resumeTimer instead.
|
|
107
110
|
*/
|
|
108
111
|
_setTimer(): void;
|
|
@@ -111,7 +114,7 @@ export declare class Toast {
|
|
|
111
114
|
/** Restart a countdown stopped by {@link _pauseTimer}. */
|
|
112
115
|
_resumeTimer(): void;
|
|
113
116
|
/**
|
|
114
|
-
* Dismiss
|
|
117
|
+
* Dismiss snackbar with animation.
|
|
115
118
|
*/
|
|
116
119
|
dismiss(): void;
|
|
117
120
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Carousel } from './carousel';
|
|
2
|
-
import { Component, BaseOptions, InitElements,
|
|
2
|
+
import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
|
|
3
3
|
export interface TabsOptions extends BaseOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Transition duration in milliseconds.
|
|
@@ -46,7 +46,7 @@ export declare class Tabs extends Component<TabsOptions> {
|
|
|
46
46
|
* @param els HTML elements.
|
|
47
47
|
* @param options Component options.
|
|
48
48
|
*/
|
|
49
|
-
static init(els: InitElements<
|
|
49
|
+
static init(els: InitElements<InitElement>, options?: Partial<TabsOptions>): Tabs[];
|
|
50
50
|
static getInstance(el: HTMLElement): Tabs;
|
|
51
51
|
destroy(): void;
|
|
52
52
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Component, BaseOptions, InitElements, InitElement, I18nOptions } from '../core/component';
|
|
2
2
|
export type Views = 'hours' | 'minutes';
|
|
3
3
|
export interface TimepickerOptions extends BaseOptions {
|
|
4
4
|
/**
|
|
@@ -158,7 +158,7 @@ export declare class Timepicker extends Component<TimepickerOptions> {
|
|
|
158
158
|
* @param els HTML elements.
|
|
159
159
|
* @param options Component options.
|
|
160
160
|
*/
|
|
161
|
-
static init(els: InitElements<HTMLInputElement |
|
|
161
|
+
static init(els: InitElements<HTMLInputElement | InitElement>, options?: Partial<TimepickerOptions>): Timepicker[];
|
|
162
162
|
static _addLeadingZero(num: number): string;
|
|
163
163
|
static _createSVGEl(name: string): SVGElement;
|
|
164
164
|
static _Pos(e: TouchEvent | MouseEvent): Point;
|
|
@@ -209,7 +209,5 @@ export declare class Timepicker extends Component<TimepickerOptions> {
|
|
|
209
209
|
confirm: () => void;
|
|
210
210
|
cancel: () => void;
|
|
211
211
|
clear: () => void;
|
|
212
|
-
open(): this;
|
|
213
|
-
close(): this;
|
|
214
212
|
}
|
|
215
213
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, BaseOptions, InitElements,
|
|
1
|
+
import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
|
|
2
2
|
export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
3
3
|
export interface TooltipOptions extends BaseOptions {
|
|
4
4
|
/**
|
|
@@ -84,7 +84,7 @@ export declare class Tooltip extends Component<TooltipOptions> {
|
|
|
84
84
|
* @param els HTML elements.
|
|
85
85
|
* @param options Component options.
|
|
86
86
|
*/
|
|
87
|
-
static init(els: InitElements<
|
|
87
|
+
static init(els: InitElements<InitElement>, options?: Partial<TooltipOptions>): Tooltip[];
|
|
88
88
|
static getInstance(el: HTMLElement): Tooltip;
|
|
89
89
|
destroy(): void;
|
|
90
90
|
_appendTooltipEl(): void;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface BaseOptions {
|
|
5
5
|
}
|
|
6
|
-
export type
|
|
7
|
-
export type InitElements<T extends
|
|
6
|
+
export type InitElement = HTMLElement | Element;
|
|
7
|
+
export type InitElements<T extends InitElement> = NodeListOf<T> | HTMLCollectionOf<T>;
|
|
8
8
|
type ComponentConstructor<T extends Component<O>, O extends BaseOptions> = {
|
|
9
9
|
new (el: HTMLElement, options: Partial<O>): T;
|
|
10
10
|
};
|
|
@@ -48,14 +48,14 @@ export declare class Component<O extends BaseOptions> {
|
|
|
48
48
|
* @param options Component options.
|
|
49
49
|
* @param classDef Class definition.
|
|
50
50
|
*/
|
|
51
|
-
protected static init<I extends
|
|
51
|
+
protected static init<I extends InitElement, O extends BaseOptions, C extends Component<O>>(els: InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C[];
|
|
52
52
|
/**
|
|
53
53
|
* Initializes component instances.
|
|
54
54
|
* @param els HTML elements.
|
|
55
55
|
* @param options Component options.
|
|
56
56
|
* @param classDef Class definition.
|
|
57
57
|
*/
|
|
58
|
-
protected static init<I extends
|
|
58
|
+
protected static init<I extends InitElement, O extends BaseOptions, C extends Component<O>>(els: I | InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C | C[];
|
|
59
59
|
/**
|
|
60
60
|
* @returns default options for component instance.
|
|
61
61
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './components';
|
|
2
2
|
export { Dialogs } from './behaviors/dialogs';
|
|
3
|
+
export { BottomSheets } from './behaviors/bottomSheets';
|
|
4
|
+
export { SideSheets } from './behaviors/sideSheets';
|
|
3
5
|
export { Forms } from './behaviors/forms';
|
|
4
6
|
export { Waves } from './behaviors/waves';
|
|
5
7
|
export { AutoInit } from './components/registry';
|
|
6
8
|
export type { AutoInitOptions } from './components/registry';
|
|
7
|
-
export declare const version = "0.
|
|
9
|
+
export declare const version = "0.5.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressivecss/expressive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "ExpressiveCSS - a Material Design 3 front-end framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "BaezFJ <baezdevs@gmail.com>",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"dist",
|
|
53
|
-
"src/sass"
|
|
53
|
+
"src/sass",
|
|
54
|
+
"CHANGELOG.md"
|
|
54
55
|
],
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"build:js:iife-min": "esbuild src/ts/index.ts --bundle --format=iife --global-name=Expressive --target=es2020 --outfile=dist/js/expressive.min.js --minify --sourcemap",
|
|
70
71
|
"build:types": "tsc -p tsconfig.build.json",
|
|
71
72
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
72
|
-
"test": "run-s build:js test:run",
|
|
73
|
+
"test": "run-s build:js build:css test:run",
|
|
73
74
|
"test:run": "node --test",
|
|
74
75
|
"test:watch": "node --test --watch",
|
|
75
76
|
"watch": "run-p watch:css watch:js",
|
package/src/sass/README.md
CHANGED
|
@@ -65,7 +65,7 @@ fine — it crosses no boundary.
|
|
|
65
65
|
|
|
66
66
|
## Breakpoints
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Four of them, in `abstracts/_breakpoints.scss`, reached through mixins:
|
|
69
69
|
|
|
70
70
|
```scss
|
|
71
71
|
@include bp-up("small") { } // @media (width >= 601px)
|
|
@@ -73,14 +73,13 @@ Three of them, in `abstracts/_breakpoints.scss`, reached through mixins:
|
|
|
73
73
|
@include bp-between("small", "large") { }
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Names are `small` (601px), `large` (993px), `xlarge` (1201px)
|
|
77
|
-
query sits on, not the size of the screen it
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
produces the same range queries, but it is deprecated and unused in here.
|
|
76
|
+
Names are `small` (601px), `large` (993px), `xlarge` (1201px), `xxlarge`
|
|
77
|
+
(1601px) — the boundary a query sits on, not the size of the screen it
|
|
78
|
+
targets. `xxlarge` is M3 extra-large (desktop / widescreen); the 12-column
|
|
79
|
+
grid grows a `.xxl` prefix there, and `.container` lifts its 1280px cap to
|
|
80
|
+
1920px. Range syntax has an exclusive comparator, so the old `600.99px` /
|
|
81
|
+
`992.99px` values used to stop `max-width` and `min-width` both matching on
|
|
82
|
+
the boundary pixel are gone, and each boundary is written once.
|
|
84
83
|
|
|
85
84
|
## Theming
|
|
86
85
|
|
|
@@ -162,7 +161,7 @@ A rule is a **utility** when it is one job, one class, and independent of any
|
|
|
162
161
|
component (`.hide`, `.m-3`, `.truncate`). It belongs in **base** when it styles
|
|
163
162
|
bare elements (`a`, `table`, `blockquote`), and in **components** when it only
|
|
164
163
|
exists to serve one widget — including widgets whose CSS is driven by
|
|
165
|
-
JavaScript rather than by a user-applied class (`.
|
|
164
|
+
JavaScript rather than by a user-applied class (`.display-docked`,
|
|
166
165
|
`ul.staggered-list li`). If a selector in `base/` names a component, it is in
|
|
167
166
|
the wrong file.
|
|
168
167
|
| A colour/type token | `tokens/_reference.scss` | wire it up in `tokens/_theme.scss` |
|
|
@@ -180,7 +179,7 @@ from every other index file.
|
|
|
180
179
|
Three consequences worth knowing:
|
|
181
180
|
|
|
182
181
|
**Utilities beat components, without specificity.** Layer order outranks
|
|
183
|
-
specificity entirely, so `.hide` wins over `.
|
|
182
|
+
specificity entirely, so `.hide` wins over `.list > li` even
|
|
184
183
|
though it is less specific. Utilities used to be emitted *before* components and
|
|
185
184
|
had to out-shout them; they are now last.
|
|
186
185
|
|
|
@@ -195,7 +194,6 @@ unlayered declaration. Drop the flag from `.hide` and it stops beating a
|
|
|
195
194
|
consumer's own `display` — silently, and in the common case. Classes whose whole
|
|
196
195
|
job is to be unconditional (`.hide`, `.m-3`, the palette classes) keep it.
|
|
197
196
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
longer needs the flag.
|
|
197
|
+
A few rules in `components/` still use `!important` for UA resets
|
|
198
|
+
(modal float, staggered-list transitions, textarea padding), not for
|
|
199
|
+
JS-driven geometry. Tap target and the preloader no longer need the flag.
|