etudes 10.2.1 → 11.0.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.
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  type Orientation = 'horizontal' | 'vertical';
3
- export type StepwiseSliderProps = Omit<HTMLAttributes<HTMLDivElement>, 'aria-valuenow' | 'role'> & {
3
+ export type StepSliderProps = Omit<HTMLAttributes<HTMLDivElement>, 'aria-valuenow' | 'role'> & {
4
4
  /**
5
5
  * By default the position is a value from 0 - 1, 0 being the start of the
6
6
  * slider and 1 being the end. Switching on this flag inverts this behavior,
@@ -87,7 +87,7 @@ export type StepwiseSliderProps = Omit<HTMLAttributes<HTMLDivElement>, 'aria-val
87
87
  onDragStart?: () => void;
88
88
  };
89
89
  /**
90
- * A "stepwise" slider component supporting both horizontal and vertical
90
+ * A "step" slider component supporting both horizontal and vertical
91
91
  * orientations that automatically snaps to a set of predefined points on the
92
92
  * slider when dragged. These points are referred to as "steps", indexed by an
93
93
  * integer referred to as "index". This index can be two-way bound. The
@@ -99,13 +99,13 @@ export type StepwiseSliderProps = Omit<HTMLAttributes<HTMLDivElement>, 'aria-val
99
99
  * the slider. While dragging, the slider still emits a position change event,
100
100
  * where the position is a decimal ranging between 0.0 and 1.0, inclusive.
101
101
  *
102
- * @exports StepwiseSliderKnob The component for the knob.
103
- * @exports StepwiseSliderLabel The component for the label on the knob.
104
- * @exports StepwiseSliderTrack The component for the slide track on either side
102
+ * @exports StepSliderKnob The component for the knob.
103
+ * @exports StepSliderLabel The component for the label on the knob.
104
+ * @exports StepSliderTrack The component for the slide track on either side
105
105
  * of the knob.
106
106
  */
107
- export declare const StepwiseSlider: import('react').ForwardRefExoticComponent<Readonly<StepwiseSliderProps> & import('react').RefAttributes<HTMLDivElement>>;
108
- export declare const StepwiseSliderTrack: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
109
- export declare const StepwiseSliderKnob: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
110
- export declare const StepwiseSliderLabel: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
107
+ export declare const StepSlider: import('react').ForwardRefExoticComponent<Readonly<StepSliderProps> & import('react').RefAttributes<HTMLDivElement>>;
108
+ export declare const StepSliderTrack: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
109
+ export declare const StepSliderKnob: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
110
+ export declare const StepSliderLabel: ({ ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
111
111
  export {};
@@ -18,7 +18,7 @@ export * from './PanoramaSlider.js';
18
18
  export * from './RangeSlider.js';
19
19
  export * from './SelectableButton.js';
20
20
  export * from './Slider.js';
21
- export * from './StepwiseSlider.js';
21
+ export * from './StepSlider.js';
22
22
  export * from './SwipeRegion.js';
23
23
  export * from './TextField.js';
24
24
  export * from './Video.js';
package/build/etudes.js CHANGED
@@ -4083,33 +4083,6 @@ function ac(r, n, { shouldInvokeInitially: s = !1 } = {}, c = []) {
4083
4083
  return () => clearInterval(u);
4084
4084
  }, [n, ...c]);
4085
4085
  }
4086
- function as({ src: r }, { onLoadStart: n, onLoadComplete: s, onLoadError: c } = {}, l = []) {
4087
- const u = (m) => {
4088
- const x = m.currentTarget;
4089
- s?.(x);
4090
- }, p = (m) => {
4091
- const x = m.currentTarget;
4092
- c?.(x);
4093
- }, g = Te(void 0);
4094
- he(() => (g.current = document.createElement("video"), r && (g.current.src = r), g.current.addEventListener("loadedmetadata", u), g.current.addEventListener("error", p), n?.(g.current), () => {
4095
- g.current?.removeEventListener("loadedmetadata", u), g.current?.removeEventListener("error", p), g.current = void 0;
4096
- }), [r, ...l]);
4097
- }
4098
- function si(r, { sanitizeDependency: n = (s) => s } = {}) {
4099
- const s = Te(void 0);
4100
- return he(() => {
4101
- s.current = r;
4102
- }, [n(r)]), s.current;
4103
- }
4104
- function st(r) {
4105
- const [n, s] = ke(se.make()), c = (l) => {
4106
- const u = se.from(l);
4107
- u && s(u);
4108
- };
4109
- return Mn(r, {
4110
- onResize: (l) => c(l)
4111
- }), n;
4112
- }
4113
4086
  function cc({ onChange: r }, n = []) {
4114
4087
  const s = () => {
4115
4088
  const u = c();
@@ -4129,6 +4102,21 @@ function cc({ onChange: r }, n = []) {
4129
4102
  window.removeEventListener("scroll", s), window.removeEventListener("resize", s), window.removeEventListener("orientationchange", s);
4130
4103
  }), [...n]);
4131
4104
  }
4105
+ function si(r, { sanitizeDependency: n = (s) => s } = {}) {
4106
+ const s = Te(void 0);
4107
+ return he(() => {
4108
+ s.current = r;
4109
+ }, [n(r)]), s.current;
4110
+ }
4111
+ function st(r) {
4112
+ const [n, s] = ke(se.make()), c = (l) => {
4113
+ const u = se.from(l);
4114
+ u && s(u);
4115
+ };
4116
+ return Mn(r, {
4117
+ onResize: (l) => c(l)
4118
+ }), n;
4119
+ }
4132
4120
  function lc(r, n, {
4133
4121
  mapSearchParamToState: s,
4134
4122
  mapStateToSearchParam: c,
@@ -4140,7 +4128,7 @@ function lc(r, n, {
4140
4128
  M !== O && (M ? g.set(r, M) : g.delete(r), m(g));
4141
4129
  }, [w]), [w, N];
4142
4130
  }
4143
- function cs(r = 0, { autoStart: n = !0, onTimeout: s } = {}, c = []) {
4131
+ function as(r = 0, { autoStart: n = !0, onTimeout: s } = {}, c = []) {
4144
4132
  const l = Te(void 0), u = Te(void 0), p = wr(() => {
4145
4133
  g(), !(r < 0) && (l.current = setTimeout(() => {
4146
4134
  g(), u.current?.();
@@ -4155,6 +4143,18 @@ function cs(r = 0, { autoStart: n = !0, onTimeout: s } = {}, c = []) {
4155
4143
  return n && p(), () => g();
4156
4144
  }, [r, ...c]), { start: p, stop: g, ref: l };
4157
4145
  }
4146
+ function cs({ src: r }, { onLoadStart: n, onLoadComplete: s, onLoadError: c } = {}, l = []) {
4147
+ const u = (m) => {
4148
+ const x = m.currentTarget;
4149
+ s?.(x);
4150
+ }, p = (m) => {
4151
+ const x = m.currentTarget;
4152
+ c?.(x);
4153
+ }, g = Te(void 0);
4154
+ he(() => (g.current = document.createElement("video"), r && (g.current.src = r), g.current.addEventListener("loadedmetadata", u), g.current.addEventListener("error", p), n?.(g.current), () => {
4155
+ g.current?.removeEventListener("loadedmetadata", u), g.current?.removeEventListener("error", p), g.current = void 0;
4156
+ }), [r, ...l]);
4157
+ }
4158
4158
  function ls({ src: r }, { preservesSizeBetweenLoads: n = !0, onLoadStart: s, onLoadComplete: c, onLoadError: l } = {}) {
4159
4159
  const u = (w) => {
4160
4160
  n || x(void 0), s?.(w);
@@ -4163,7 +4163,7 @@ function ls({ src: r }, { preservesSizeBetweenLoads: n = !0, onLoadStart: s, onL
4163
4163
  }, g = (w) => {
4164
4164
  n || x(void 0), l?.(w);
4165
4165
  }, [m, x] = ke(void 0);
4166
- return as({ src: r }, {
4166
+ return cs({ src: r }, {
4167
4167
  onLoadStart: (w) => u(w),
4168
4168
  onLoadComplete: (w) => p(w),
4169
4169
  onLoadError: (w) => g(w)
@@ -4241,7 +4241,7 @@ const fc = /* @__PURE__ */ Se(({
4241
4241
  throw Error(`Unsupported orientation '${l}'`);
4242
4242
  }
4243
4243
  }
4244
- }, [s, c.length, l]), cs(ie || !q ? -1 : r, {
4244
+ }, [s, c.length, l]), as(ie || !q ? -1 : r, {
4245
4245
  onTimeout: () => {
4246
4246
  const L = (n + c.length + 1) % c.length;
4247
4247
  O(L);
@@ -7470,10 +7470,10 @@ export {
7470
7470
  Jr as SliderKnob,
7471
7471
  Zr as SliderLabel,
7472
7472
  En as SliderTrack,
7473
- Sc as StepwiseSlider,
7474
- Qr as StepwiseSliderKnob,
7475
- ei as StepwiseSliderLabel,
7476
- Tn as StepwiseSliderTrack,
7473
+ Sc as StepSlider,
7474
+ Qr as StepSliderKnob,
7475
+ ei as StepSliderLabel,
7476
+ Tn as StepSliderTrack,
7477
7477
  Nc as SwipeRegion,
7478
7478
  ps as TextField,
7479
7479
  ys as Video,
@@ -7485,22 +7485,22 @@ export {
7485
7485
  Ut as createKey,
7486
7486
  Pr as createKeyDeep,
7487
7487
  le as styles,
7488
- sc as useClickOutsideEffect,
7489
- ts as useDragEffect,
7490
- Nt as useDragValueEffect,
7488
+ sc as useClickOutside,
7489
+ ts as useDrag,
7490
+ Nt as useDragValue,
7491
+ os as useImageLoader,
7491
7492
  oi as useImageSize,
7492
7493
  ac as useInterval,
7493
- os as useLoadImageEffect,
7494
- as as useLoadVideoMetadataEffect,
7495
7494
  Bo as useMounted,
7495
+ cc as usePosition,
7496
7496
  si as usePrevious,
7497
7497
  st as useRect,
7498
- Mn as useResizeEffect,
7499
7498
  Oc as useScrollPosition,
7500
- cc as useScrollPositionEffect,
7501
7499
  lc as useSearchParamState,
7502
7500
  Ho as useSize,
7503
- cs as useTimeout,
7501
+ Mn as useSizeObserver,
7502
+ as as useTimeout,
7503
+ cs as useVideoMetadataLoader,
7504
7504
  ls as useVideoSize,
7505
7505
  uc as useViewportSize
7506
7506
  };