@expressivecss/expressive 0.2.0 → 0.4.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.
Files changed (80) hide show
  1. package/README.md +8 -8
  2. package/dist/css/expressive.css +1915 -1566
  3. package/dist/css/expressive.css.map +1 -1
  4. package/dist/css/expressive.min.css +1 -1
  5. package/dist/css/expressive.min.css.map +1 -1
  6. package/dist/js/expressive.cjs +1338 -1528
  7. package/dist/js/expressive.cjs.map +4 -4
  8. package/dist/js/expressive.js +1338 -1528
  9. package/dist/js/expressive.js.map +4 -4
  10. package/dist/js/expressive.min.js +10 -20
  11. package/dist/js/expressive.min.js.map +4 -4
  12. package/dist/js/expressive.mjs +1338 -1529
  13. package/dist/js/expressive.mjs.map +4 -4
  14. package/dist/types/components/autocomplete.d.ts +2 -9
  15. package/dist/types/components/buttons.d.ts +19 -43
  16. package/dist/types/components/cards.d.ts +3 -6
  17. package/dist/types/components/carousel.d.ts +42 -48
  18. package/dist/types/components/characterCounter.d.ts +3 -5
  19. package/dist/types/components/chips.d.ts +4 -4
  20. package/dist/types/components/collapsible.d.ts +28 -23
  21. package/dist/types/components/datepicker.d.ts +2 -8
  22. package/dist/types/components/dropdown.d.ts +11 -2
  23. package/dist/types/components/index.d.ts +0 -1
  24. package/dist/types/components/lightbox.d.ts +2 -2
  25. package/dist/types/components/parallax.d.ts +7 -37
  26. package/dist/types/components/pushpin.d.ts +2 -2
  27. package/dist/types/components/range.d.ts +2 -2
  28. package/dist/types/components/registry.d.ts +0 -4
  29. package/dist/types/components/scrollspy.d.ts +26 -50
  30. package/dist/types/components/select.d.ts +20 -6
  31. package/dist/types/components/sidenav.d.ts +40 -55
  32. package/dist/types/components/slider.d.ts +2 -2
  33. package/dist/types/components/tabs.d.ts +2 -2
  34. package/dist/types/components/tapTarget.d.ts +25 -26
  35. package/dist/types/components/timepicker.d.ts +2 -4
  36. package/dist/types/components/tooltip.d.ts +2 -2
  37. package/dist/types/core/component.d.ts +4 -4
  38. package/dist/types/index.d.ts +1 -1
  39. package/package.json +2 -2
  40. package/src/sass/README.md +3 -6
  41. package/src/sass/abstracts/_breakpoints.scss +0 -16
  42. package/src/sass/abstracts/_variables.scss +0 -21
  43. package/src/sass/base/_grid.scss +0 -19
  44. package/src/sass/components/_badges.scss +6 -5
  45. package/src/sass/components/_breadcrumb.scss +93 -16
  46. package/src/sass/components/_buttons.scss +212 -145
  47. package/src/sass/components/_cards.scss +50 -123
  48. package/src/sass/components/_carousel.scss +128 -63
  49. package/src/sass/components/_chips.scss +1 -1
  50. package/src/sass/components/_collapsible.scss +158 -60
  51. package/src/sass/components/_collection.scss +146 -80
  52. package/src/sass/components/_datepicker.scss +1 -15
  53. package/src/sass/components/_dropdown.scss +110 -14
  54. package/src/sass/components/_icons-material-design.scss +77 -4
  55. package/src/sass/components/_index.scss +1 -0
  56. package/src/sass/components/_lightbox.scss +4 -0
  57. package/src/sass/components/_modal.scss +13 -31
  58. package/src/sass/components/_navbar.scss +24 -6
  59. package/src/sass/components/_page-footer.scss +134 -15
  60. package/src/sass/components/_pagination.scss +131 -25
  61. package/src/sass/components/_parallax.scss +96 -21
  62. package/src/sass/components/_preloader.scss +145 -300
  63. package/src/sass/components/_scrollspy.scss +18 -0
  64. package/src/sass/components/_sidenav.scss +230 -119
  65. package/src/sass/components/_slider.scss +8 -0
  66. package/src/sass/components/_table_of_contents.scss +30 -14
  67. package/src/sass/components/_tabs.scss +54 -35
  68. package/src/sass/components/_tapTarget.scss +128 -45
  69. package/src/sass/components/_toast.scss +10 -11
  70. package/src/sass/components/_toolbar.scss +2 -2
  71. package/src/sass/components/_tooltip.scss +4 -9
  72. package/src/sass/components/_transitions.scss +0 -5
  73. package/src/sass/components/forms/_index.scss +0 -5
  74. package/src/sass/components/forms/_input-fields.scss +49 -52
  75. package/src/sass/components/forms/_select.scss +175 -60
  76. package/src/sass/components/forms/_switches.scss +21 -8
  77. package/src/sass/utilities/_helpers.scss +1 -3
  78. package/src/sass/utilities/_typescale.scss +0 -5
  79. package/src/sass/utilities/_visibility.scss +2 -2
  80. package/dist/types/components/modal.d.ts +0 -45
@@ -1,12 +1,8 @@
1
- import { Component, BaseOptions, InitElements, MElement } from '../core/component';
1
+ import { Component, BaseOptions, InitElements, InitElement } from '../core/component';
2
2
  export interface ScrollSpyOptions extends BaseOptions {
3
3
  /**
4
- * Throttle of scroll handler.
5
- * @default 100
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
- * Used to find active element.
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
- * Used to keep last top element active even if
25
- * scrollbar goes outside of scrollspy elements.
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 _count: number;
42
- static _increment: number;
43
- static _elementsInView: ScrollSpy[];
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
- _setupEventHandlers(): void;
68
- _removeEventHandlers(): void;
69
- static _handleTriggerClick: (e: MouseEvent) => void;
70
- static _handleWindowScroll: () => void;
71
- static _findElements(top: number, right: number, bottom: number, left: number): ScrollSpy[];
72
- _enter(): void;
73
- _exit(): void;
74
- private static _resetKeptTopActiveElement;
75
- private static _getDistanceToViewport;
76
- private static _smoothScrollIntoView;
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
1
  import { Dropdown, DropdownOptions } from './dropdown';
2
- import { Component, BaseOptions, InitElements, MElement } from '../core/component';
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.
@@ -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
- /** Dropdown UL element. */
29
- dropdownOptions: HTMLUListElement;
28
+ /** Dropdown menu element. */
29
+ dropdownOptions: HTMLElement;
30
30
  /** Text input that shows current selected option. */
31
31
  input: HTMLInputElement;
32
32
  /** Instance of the dropdown plugin for this select. */
33
33
  dropdown: Dropdown;
34
- /** The select wrapper element. */
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,7 +51,7 @@ 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 | MElement>, options?: Partial<FormSelectOptions>): FormSelect[];
54
+ static init(els: InitElements<HTMLSelectElement | InitElement>, options?: Partial<FormSelectOptions>): FormSelect[];
53
55
  static getInstance(el: HTMLElement): FormSelect;
54
56
  destroy(): void;
55
57
  /**
@@ -57,18 +59,30 @@ export declare class FormSelect extends Component<FormSelectOptions> {
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. Call this after mutating the underlying select programmatically.
62
+ * options. Adding or removing `<option>`s also requires this — the menu is
63
+ * rebuilt from the native list, the field and Dropdown 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
  _setupDropdown(): void;
78
+ private _setupWrapper;
79
+ private _hideNativeSelect;
80
+ private _buildInput;
81
+ private _buildCaret;
82
+ private _initDropdown;
83
+ private _nativeOptions;
84
+ private _buildOptions;
85
+ private _rebuildOptions;
72
86
  _addOptionToValues(realOption: HTMLOptionElement, virtualOption: HTMLElement): void;
73
87
  _removeDropdown(): void;
74
88
  _createAndAppendOptionWithIcon(realOption: HTMLOptionElement | HTMLOptGroupElement, type: string): HTMLLIElement;
@@ -1,4 +1,4 @@
1
- import { Component, BaseOptions, InitElements, MElement, Openable } from '../core/component';
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 Sidenav. */
42
+ /** Describes open/close state of the overlay drawer. */
53
43
  isOpen: boolean;
54
- /** Describes if sidenav is fixed. */
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
- private _overlay;
62
- dragTarget: Element;
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<MElement>, options?: Partial<SidenavOptions>): Sidenav[];
73
+ static init(els: InitElements<InitElement>, options?: Partial<SidenavOptions>): Sidenav[];
86
74
  static getInstance(el: HTMLElement): Sidenav;
87
75
  destroy(): void;
88
- private _createOverlay;
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 _handleCloseTriggerClick;
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, MElement } from '../core/component';
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<MElement>, options?: Partial<SliderOptions>): Slider[];
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,5 +1,5 @@
1
1
  import { Carousel } from './carousel';
2
- import { Component, BaseOptions, InitElements, MElement } from '../core/component';
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<MElement>, options?: Partial<TabsOptions>): Tabs[];
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, MElement, Openable } from '../core/component';
1
+ import { Component, BaseOptions, InitElements, InitElement, Openable } from '../core/component';
2
2
  export interface TapTargetOptions extends BaseOptions {
3
3
  /**
4
4
  * Callback function called when Tap Target is opened.
@@ -11,42 +11,29 @@ export interface TapTargetOptions extends BaseOptions {
11
11
  */
12
12
  onClose: (origin: HTMLElement) => void;
13
13
  }
14
+ /**
15
+ * Tap target (Feature Discovery). Placement is CSS custom properties;
16
+ * the wrapper is a popover when the platform has one. This class is
17
+ * open/close, origin lookup, and the two geometry variables.
18
+ */
14
19
  export declare class TapTarget extends Component<TapTargetOptions> implements Openable {
15
- /**
16
- * If the tap target is open.
17
- */
18
20
  isOpen: boolean;
21
+ originEl: HTMLElement | null;
19
22
  static _taptargets: TapTarget[];
20
23
  private wrapper;
21
- private originEl;
22
24
  private waveEl;
23
25
  private contentEl;
26
+ private _createdWrapper;
27
+ private _createdWave;
28
+ private _usePopover;
29
+ private _liftedStatic;
30
+ private _opening;
24
31
  constructor(el: HTMLElement, options: Partial<TapTargetOptions>);
25
32
  static get defaults(): TapTargetOptions;
26
- /**
27
- * Initializes instance of TapTarget.
28
- * @param el HTML element.
29
- * @param options Component options.
30
- */
31
33
  static init(el: HTMLElement, options?: Partial<TapTargetOptions>): TapTarget;
32
- /**
33
- * Initializes instances of TapTarget.
34
- * @param els HTML elements.
35
- * @param options Component options.
36
- */
37
- static init(els: InitElements<MElement>, options?: Partial<TapTargetOptions>): TapTarget[];
34
+ static init(els: InitElements<InitElement>, options?: Partial<TapTargetOptions>): TapTarget[];
38
35
  static getInstance(el: HTMLElement): TapTarget;
39
36
  destroy(): void;
40
- _setupEventHandlers(): void;
41
- _removeEventHandlers(): void;
42
- _handleThrottledResize: (...args: unknown[]) => any;
43
- _handleKeyboardInteraction: (e: KeyboardEvent) => void;
44
- _handleTargetToggle: () => void;
45
- _handleResize: () => void;
46
- _handleDocumentClick: (e: MouseEvent | TouchEvent | KeyboardEvent) => void;
47
- _setup(): void;
48
- private _offset;
49
- _calculatePositioning(): void;
50
37
  /**
51
38
  * Open Tap Target.
52
39
  */
@@ -55,4 +42,16 @@ export declare class TapTarget extends Component<TapTargetOptions> implements Op
55
42
  * Close Tap Target.
56
43
  */
57
44
  close: () => void;
45
+ private _setup;
46
+ private _ensureId;
47
+ private _labelFromHeading;
48
+ private _teardownDom;
49
+ private _setupEventHandlers;
50
+ private _removeEventHandlers;
51
+ private _handleThrottledResize;
52
+ private _handleOriginKeydown;
53
+ private _handleTargetToggle;
54
+ private _handleResize;
55
+ private _handlePopoverToggle;
56
+ private _calculatePositioning;
58
57
  }
@@ -1,4 +1,4 @@
1
- import { Component, BaseOptions, InitElements, MElement, I18nOptions } from '../core/component';
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 | MElement>, options?: Partial<TimepickerOptions>): Timepicker[];
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, MElement } from '../core/component';
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<MElement>, options?: Partial<TooltipOptions>): Tooltip[];
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 MElement = HTMLElement | Element;
7
- export type InitElements<T extends MElement> = NodeListOf<T> | HTMLCollectionOf<T>;
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 MElement, O extends BaseOptions, C extends Component<O>>(els: InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C[];
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 MElement, O extends BaseOptions, C extends Component<O>>(els: I | InitElements<I>, options: Partial<O>, classDef: ComponentType<C, O>): C | C[];
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
  */
@@ -4,4 +4,4 @@ export { Forms } from './behaviors/forms';
4
4
  export { Waves } from './behaviors/waves';
5
5
  export { AutoInit } from './components/registry';
6
6
  export type { AutoInitOptions } from './components/registry';
7
- export declare const version = "0.2.0";
7
+ export declare const version = "0.4.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressivecss/expressive",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "ExpressiveCSS - a Material Design 3 front-end framework.",
5
5
  "license": "MIT",
6
6
  "author": "BaezFJ <baezdevs@gmail.com>",
@@ -69,7 +69,7 @@
69
69
  "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
70
  "build:types": "tsc -p tsconfig.build.json",
71
71
  "typecheck": "tsc -p tsconfig.json --noEmit",
72
- "test": "run-s build:js test:run",
72
+ "test": "run-s build:js build:css test:run",
73
73
  "test:run": "node --test",
74
74
  "test:watch": "node --test --watch",
75
75
  "watch": "run-p watch:css watch:js",
@@ -79,9 +79,6 @@ exclusive comparator, so the old `600.99px` / `992.99px` values used to stop
79
79
  `max-width` and `min-width` both matching on the boundary pixel are gone, and
80
80
  each boundary is written once.
81
81
 
82
- The interpolated-string form (`@media #{$medium-and-up}`) still compiles and now
83
- produces the same range queries, but it is deprecated and unused in here.
84
-
85
82
  ## Theming
86
83
 
87
84
  `tokens/_reference.scss` **generates** five of the six M3 tonal ramps from
@@ -195,6 +192,6 @@ unlayered declaration. Drop the flag from `.hide` and it stops beating a
195
192
  consumer's own `display` — silently, and in the common case. Classes whose whole
196
193
  job is to be unconditional (`.hide`, `.m-3`, the palette classes) keep it.
197
194
 
198
- The `!important` in `components/` is a different thing again: `.pushpin`,
199
- `.tap-target` and the preloader set JS-driven geometry that must not be
200
- overridable. Those stay too.
195
+ The `!important` in `components/` is a different thing again: `.pushpin`
196
+ sets JS-driven geometry that must not be overridable. That stays.
197
+ Tap target and the preloader no longer need the flag.
@@ -51,19 +51,3 @@ $breakpoints: (
51
51
  @content;
52
52
  }
53
53
  }
54
-
55
- // Deprecated: the interpolated-string breakpoints.
56
- //
57
- // Kept so a downstream `@media #{$medium-and-up}` keeps compiling - the
58
- // framework itself no longer uses them. Values are now range syntax, so the
59
- // queries they produce match the mixins above exactly. Prefer the mixins.
60
- $small-screen-up: breakpoint("small") !default;
61
- $medium-screen-up: breakpoint("large") !default;
62
- $large-screen-up: breakpoint("xlarge") !default;
63
-
64
- $medium-and-up: "(width >= #{breakpoint('small')})" !default;
65
- $large-and-up: "(width >= #{breakpoint('large')})" !default;
66
- $extra-large-and-up: "(width >= #{breakpoint('xlarge')})" !default;
67
- $small-and-down: "(width < #{breakpoint('small')})" !default;
68
- $medium-and-down: "(width < #{breakpoint('large')})" !default;
69
- $medium-only: "(#{breakpoint('small')} <= width < #{breakpoint('large')})" !default;
@@ -1,6 +1,3 @@
1
- // TypeScale
2
- $md_sys_typescale_body-large_size: 16px;
3
-
4
1
  @use "sass:math";
5
2
 
6
3
  // Colors
@@ -11,14 +8,6 @@ $md_sys_typescale_body-large_size: 16px;
11
8
  // value from it: this link color. Everything now comes from --md-sys-color-*.
12
9
  $link-color: var(--md-sys-color-primary) !default;
13
10
 
14
- // Floating buttons
15
- $button-floating-background: var(--md-sys-color-secondary) !default;
16
- $button-floating-background-hover: var(--md-ref-palette-secondary70) !default;
17
- $button-floating-background-focus: var(--md-ref-palette-secondary80) !default;
18
- $button-floating-color: var(--md-sys-color-on-secondary) !default;
19
- $button-floating-size: 40px !default;
20
- $button-floating-radius: 16px !default;
21
-
22
11
  // Dropdown
23
12
  $dropdown-item-height: 50px !default;
24
13
 
@@ -27,7 +16,6 @@ $dropdown-item-height: 50px !default;
27
16
  // the 600.99px / 992.99px / 1200.99px values are gone.
28
17
 
29
18
  // Grid
30
- $num-cols: 12 !default;
31
19
  $gutter-width: 1.5rem !default;
32
20
  $element-top-margin: math.div($gutter-width, 3) !default;
33
21
  $element-bottom-margin: math.div($gutter-width * 2, 3) !default;
@@ -40,15 +28,6 @@ $text-color: var(--md-sys-color-on-background) !default;
40
28
  // derived from it, so the two cannot drift.
41
29
  $root-font-size: 14px !default;
42
30
 
43
- // Legacy rem heading ladder. Headings now consume --md-sys-typescale-*
44
- // (see base/_typography.scss). Kept so existing Sass overrides still compile.
45
- $h1-fontsize: 4.2rem !default;
46
- $h2-fontsize: 3.56rem !default;
47
- $h3-fontsize: 2.92rem !default;
48
- $h4-fontsize: 2.28rem !default;
49
- $h5-fontsize: 1.64rem !default;
50
- $h6-fontsize: 1.15rem !default;
51
-
52
31
  // Flow text: font-size interpolates between these two across the viewport
53
32
  // range below. This used to be a @while loop emitting 21 media queries.
54
33
  $flow-text-min: 1.2rem !default;
@@ -23,25 +23,6 @@
23
23
  padding: 1rem 0;
24
24
  }
25
25
 
26
- // Mixins to eliminate code repetition
27
- @mixin reset-offset {
28
- margin-left: auto;
29
- left: auto;
30
- right: auto;
31
- }
32
-
33
- @mixin grid-classes($size, $i, $perc) {
34
- &.offset-#{$size}#{$i} {
35
- margin-left: $perc;
36
- }
37
- &.pull-#{$size}#{$i} {
38
- right: $perc;
39
- }
40
- &.push-#{$size}#{$i} {
41
- left: $perc;
42
- }
43
- }
44
-
45
26
  body {
46
27
  --gap-size: 1.5rem; // default
47
28
  }
@@ -48,9 +48,10 @@ header:has(> nav) nav a span.badge {
48
48
  -webkit-font-smoothing: auto;
49
49
  }
50
50
 
51
- // Line height centering
52
- .collection-item span.badge {
53
- margin-top: calc(calc(1.5rem * 0.5) - calc(var(--bagde-height) * 0.5));
51
+ .collection span.badge {
52
+ float: none;
53
+ margin-block: 0;
54
+ margin-inline-start: auto;
54
55
  }
55
56
 
56
57
  .collapsible span.badge {
@@ -62,12 +63,12 @@ header:has(> nav) nav a span.badge {
62
63
  }
63
64
  }
64
65
 
65
- .collapsible .active span.badge:not(.new) {
66
+ .collapsible :is(.active, [open]) span.badge:not(.new) {
66
67
  color: var(--md-sys-color-on-surface-variant);
67
68
  }
68
69
 
69
70
  .sidenav span.badge {
70
- margin-top: calc(calc(var(--sidenav-line-height) * 0.5) - calc(22px * 0.5));
71
+ margin-top: calc(calc(var(--md-comp-nav-drawer-line-height) * 0.5) - calc(22px * 0.5));
71
72
  }
72
73
 
73
74
  table span.badge {