mtrl 0.2.4 → 0.2.5

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.
@@ -1,9 +1,19 @@
1
1
  // src/components/slider/index.ts
2
+
3
+ // Export main component creator
2
4
  export { default } from './slider';
5
+
6
+ // Export constants
3
7
  export {
4
8
  SLIDER_COLORS,
5
9
  SLIDER_SIZES,
6
10
  SLIDER_ORIENTATIONS,
7
11
  SLIDER_EVENTS
8
12
  } from './constants';
9
- export { SliderConfig, SliderComponent, SliderEvent } from './types';
13
+
14
+ // Export types for TypeScript users
15
+ export type {
16
+ SliderConfig,
17
+ SliderComponent,
18
+ SliderEvent
19
+ } from './types';
@@ -1,5 +1,5 @@
1
1
  // src/components/slider/slider.ts
2
- import { pipe } from '../../core/compose';
2
+ import { pipe } from '../../core/compose/pipe';
3
3
  import { createBase, withElement } from '../../core/compose/component';
4
4
  import { withEvents, withLifecycle } from '../../core/compose/features';
5
5
  import {
@@ -1,5 +1,5 @@
1
1
  // src/components/slider/types.ts
2
- import { SLIDER_COLORS, SLIDER_SIZES, SLIDER_ORIENTATIONS, SLIDER_EVENTS } from './constants';
2
+ import { SLIDER_COLORS, SLIDER_SIZES, SLIDER_EVENTS } from './constants';
3
3
 
4
4
  /**
5
5
  * Configuration interface for the Slider component
@@ -24,26 +24,20 @@ export interface SliderConfig {
24
24
  disabled?: boolean;
25
25
 
26
26
  /** Color variant of the slider */
27
- color?: keyof typeof SLIDER_COLORS | SLIDER_COLORS;
27
+ color?: keyof typeof SLIDER_COLORS | typeof SLIDER_COLORS[keyof typeof SLIDER_COLORS];
28
28
 
29
29
  /** Size variant of the slider */
30
- size?: keyof typeof SLIDER_SIZES | SLIDER_SIZES;
31
-
32
- /** Orientation of the slider */
33
- orientation?: keyof typeof SLIDER_ORIENTATIONS | SLIDER_ORIENTATIONS;
30
+ size?: keyof typeof SLIDER_SIZES | typeof SLIDER_SIZES[keyof typeof SLIDER_SIZES];
34
31
 
35
32
  /** Whether to show tick marks */
36
33
  ticks?: boolean;
37
34
 
38
- /** Whether to show tick labels */
39
- tickLabels?: boolean | string[];
35
+ /** Format function for displayed values */
36
+ valueFormatter?: (value: number) => string;
40
37
 
41
38
  /** Whether to show the current value while dragging */
42
39
  showValue?: boolean;
43
40
 
44
- /** Format function for displayed values */
45
- valueFormatter?: (value: number) => string;
46
-
47
41
  /** Whether to snap to steps while dragging (discrete slider) */
48
42
  snapToSteps?: boolean;
49
43
 
@@ -55,7 +49,7 @@ export interface SliderConfig {
55
49
 
56
50
  /** Event handlers for slider events */
57
51
  on?: {
58
- [key in keyof typeof SLIDER_EVENTS]?: (event: SliderEvent) => void;
52
+ [key in keyof typeof SLIDER_EVENTS | typeof SLIDER_EVENTS[keyof typeof SLIDER_EVENTS]]?: (event: SliderEvent) => void;
59
53
  };
60
54
  }
61
55
 
@@ -129,37 +123,28 @@ export interface SliderComponent {
129
123
  isDisabled: () => boolean;
130
124
 
131
125
  /** Sets slider color */
132
- setColor: (color: keyof typeof SLIDER_COLORS | SLIDER_COLORS) => SliderComponent;
126
+ setColor: (color: keyof typeof SLIDER_COLORS | typeof SLIDER_COLORS[keyof typeof SLIDER_COLORS]) => SliderComponent;
133
127
 
134
128
  /** Gets slider color */
135
129
  getColor: () => string;
136
130
 
137
131
  /** Sets slider size */
138
- setSize: (size: keyof typeof SLIDER_SIZES | SLIDER_SIZES) => SliderComponent;
132
+ setSize: (size: keyof typeof SLIDER_SIZES | typeof SLIDER_SIZES[keyof typeof SLIDER_SIZES]) => SliderComponent;
139
133
 
140
134
  /** Gets slider size */
141
135
  getSize: () => string;
142
136
 
143
- /** Sets slider orientation */
144
- setOrientation: (orientation: keyof typeof SLIDER_ORIENTATIONS | SLIDER_ORIENTATIONS) => SliderComponent;
145
-
146
- /** Gets slider orientation */
147
- getOrientation: () => string;
148
-
149
137
  /** Shows or hides tick marks */
150
138
  showTicks: (show: boolean) => SliderComponent;
151
139
 
152
- /** Shows or hides tick labels */
153
- showTickLabels: (show: boolean | string[]) => SliderComponent;
154
-
155
140
  /** Shows or hides current value while dragging */
156
141
  showCurrentValue: (show: boolean) => SliderComponent;
157
142
 
158
143
  /** Adds event listener */
159
- on: (event: keyof typeof SLIDER_EVENTS | SLIDER_EVENTS, handler: (event: SliderEvent) => void) => SliderComponent;
144
+ on: (event: keyof typeof SLIDER_EVENTS | typeof SLIDER_EVENTS[keyof typeof SLIDER_EVENTS], handler: (event: SliderEvent) => void) => SliderComponent;
160
145
 
161
146
  /** Removes event listener */
162
- off: (event: keyof typeof SLIDER_EVENTS | SLIDER_EVENTS, handler: (event: SliderEvent) => void) => SliderComponent;
147
+ off: (event: keyof typeof SLIDER_EVENTS | typeof SLIDER_EVENTS[keyof typeof SLIDER_EVENTS], handler: (event: SliderEvent) => void) => SliderComponent;
163
148
 
164
149
  /** Destroys the slider component and cleans up resources */
165
150
  destroy: () => void;