@design-factory/core 22.0.0-next.0 → 22.0.0-next.1

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.
@@ -16,8 +16,8 @@ function adjustItemsCloseOthers(items, openItems, oldOpen) {
16
16
  }
17
17
  if (keepOpen) {
18
18
  items.forEach((item) => {
19
- if (item.stores.id$() !== keepOpen && item.stores.visible$()) {
20
- item.patch({ visible: false });
19
+ if (item.stores.id$() !== keepOpen && item.stores.expanded$()) {
20
+ item.patch({ expanded: false });
21
21
  }
22
22
  });
23
23
  }
@@ -58,12 +58,12 @@ const defaultItemConfig = {
58
58
  id: "",
59
59
  destroyOnHide: defaultAccordionConfig.itemDestroyOnHide,
60
60
  disabled: false,
61
- visible: false,
61
+ expanded: false,
62
62
  animated: defaultAccordionConfig.animated,
63
63
  transition: defaultAccordionConfig.itemTransition,
64
64
  onShown: noop,
65
65
  onHidden: noop,
66
- onVisibleChange: noop,
66
+ onExpandedChange: noop,
67
67
  className: defaultAccordionConfig.itemClassName,
68
68
  headerClassName: defaultAccordionConfig.itemHeaderClassName,
69
69
  buttonClassName: defaultAccordionConfig.itemButtonClassName,
@@ -102,12 +102,12 @@ const configItemValidator = {
102
102
  id: typeString,
103
103
  destroyOnHide: typeBoolean,
104
104
  disabled: typeBoolean,
105
- visible: typeBoolean,
105
+ expanded: typeBoolean,
106
106
  animated: typeBoolean,
107
107
  transition: typeFunction,
108
108
  onShown: typeFunction,
109
109
  onHidden: typeFunction,
110
- onVisibleChange: typeFunction,
110
+ onExpandedChange: typeFunction,
111
111
  className: typeString,
112
112
  headerClassName: typeString,
113
113
  buttonClassName: typeString,
@@ -127,8 +127,8 @@ function createAccordionItem(config) {
127
127
  destroyOnHide$,
128
128
  onShown$,
129
129
  onHidden$,
130
- onVisibleChange$,
131
- visible$,
130
+ onExpandedChange$,
131
+ expanded$: requestedExpanded$,
132
132
  id$: _dirtyId$,
133
133
  disabled$,
134
134
  ...stateProps
@@ -140,8 +140,8 @@ function createAccordionItem(config) {
140
140
  const transition = createTransition({
141
141
  props: {
142
142
  transition: transition$,
143
- visible: visible$,
144
- onVisibleChange: onVisibleChange$,
143
+ visible: requestedExpanded$,
144
+ onVisibleChange: onExpandedChange$,
145
145
  animated: animated$,
146
146
  animatedOnInit: false,
147
147
  initDone: initDone$,
@@ -153,16 +153,17 @@ function createAccordionItem(config) {
153
153
  }
154
154
  }
155
155
  });
156
+ const expanded$ = transition.stores.visible$;
156
157
  const shouldBeInDOM$ = computed(() => !destroyOnHide$() || !transition.stores.hidden$());
157
158
  const toggleDirective = createAttributesDirective(() => ({
158
159
  attributes: {
159
160
  id: computed(() => `${id$()}-toggle`),
160
- "aria-expanded": computed(() => `${visible$()}`),
161
+ "aria-expanded": computed(() => `${expanded$()}`),
161
162
  "aria-disabled": computed(() => `${disabled$()}`),
162
163
  "aria-controls": computed(() => `${id$()}-body-container`),
163
164
  disabled: disabled$
164
165
  },
165
- classNames: { "df-collapsed": computed(() => !visible$()) },
166
+ classNames: { "df-collapsed": computed(() => !expanded$()) },
166
167
  events: {
167
168
  click: () => {
168
169
  if (!disabled$()) {
@@ -182,7 +183,7 @@ function createAccordionItem(config) {
182
183
  }));
183
184
  return {
184
185
  ...stateStores({
185
- visible$,
186
+ expanded$,
186
187
  id$,
187
188
  shouldBeInDOM$,
188
189
  disabled$,
@@ -252,7 +253,7 @@ function factoryCreateAccordion(itemFactory = createAccordionItem, accordionItem
252
253
  const openItems$ = computed(() => {
253
254
  const openItems = [];
254
255
  itemWidgets$().forEach((item) => {
255
- if (item.stores.visible$()) {
256
+ if (item.stores.expanded$()) {
256
257
  openItems.push(item.stores.id$());
257
258
  }
258
259
  });
@@ -42,7 +42,7 @@ interface AccordionCommonPropsAndState extends WidgetsCommonPropsAndState {
42
42
  */
43
43
  addon: 'none' | 'icon' | 'number';
44
44
  /**
45
- * When an item is visible (expanded), a separator line is shown below the item header.
45
+ * When an item is expanded, a separator line is shown below the item header.
46
46
  *
47
47
  * @defaultValue `false`
48
48
  */
@@ -183,7 +183,7 @@ export interface AccordionApi {
183
183
  * @returns A promise that resolves when the toggle operation is completed.
184
184
  * If the itemId is not valid, nothing will happen.
185
185
  */
186
- toggle(itemId: string): Promise<void>;
186
+ toggle(itemId: string, animated?: boolean): Promise<void>;
187
187
  /**
188
188
  * It will expand all the items in the accordion.
189
189
  *
@@ -282,9 +282,9 @@ export interface AccordionItemDirectives {
282
282
  */
283
283
  interface AccordionItemCommonPropsAndState extends WidgetsCommonPropsAndState {
284
284
  /**
285
- * If `true`, the accordion-item will be visible (expanded). Otherwise, it will be hidden (collapsed).
285
+ * If `true`, the accordion-item will be expanded. Otherwise, it will be collapsed.
286
286
  */
287
- visible: boolean;
287
+ expanded: boolean;
288
288
  /**
289
289
  * If `true`, the accordion-item will be disabled.
290
290
  * It will not react to user's clicks, but still will be possible to toggle programmatically.
@@ -341,11 +341,11 @@ export interface AccordionItemProps extends AccordionItemCommonPropsAndState {
341
341
  */
342
342
  onHidden: () => void;
343
343
  /**
344
- * An event fired when the `visible` value changes.
344
+ * An event fired when the `expanded` value changes.
345
345
  *
346
- * Event payload is the new value of visible.
346
+ * Event payload is the new value of expanded.
347
347
  */
348
- onVisibleChange: (visible: boolean) => void;
348
+ onExpandedChange: (expanded: boolean) => void;
349
349
  }
350
350
  /**
351
351
  * Represents the state of an accordion item.
@@ -353,7 +353,7 @@ export interface AccordionItemProps extends AccordionItemCommonPropsAndState {
353
353
  export interface AccordionItemState extends AccordionItemCommonPropsAndState {
354
354
  /**
355
355
  * If `true` the content of the accordion-item collapse should be in DOM. Its value depends on the
356
- * value of the `visible` and `destroyOnHide`.
356
+ * value of the `expanded` and `destroyOnHide`.
357
357
  */
358
358
  shouldBeInDOM: boolean;
359
359
  }
@@ -1,4 +1,4 @@
1
- import { c, a, f, g } from "../../accordion-B5RqDwi3.js";
1
+ import { c, a, f, g } from "../../accordion-DUFLBQkV.js";
2
2
  export {
3
3
  c as createAccordion,
4
4
  a as createAccordionItem,
@@ -107,6 +107,13 @@ export interface DrawerProps extends DrawerCommonPropsAndState {
107
107
  * @defaultValue `true`
108
108
  */
109
109
  animated: boolean;
110
+ /**
111
+ * If `true` the backdrop fade in / out will be animated.
112
+ * Will use the `animated` property if set to `null`.
113
+ *
114
+ * @defaultValue `null`
115
+ */
116
+ backdropAnimated: boolean | null;
110
117
  /**
111
118
  * aria-labelledby attribute to use for the drawer element.
112
119
  *
@@ -1,4 +1,4 @@
1
- import { c, g } from "../../drawer-CpGnS2ln.js";
1
+ import { c, g } from "../../drawer-D4xSbhcT.js";
2
2
  export {
3
3
  c as createDrawer,
4
4
  g as getDrawerDefaultConfig
@@ -1,4 +1,4 @@
1
- import { c, g } from "../../slider-b9cVFNAL.js";
1
+ import { c, g } from "../../slider-tH5g55yQ.js";
2
2
  export {
3
3
  c as createSlider,
4
4
  g as getSliderDefaultConfig
@@ -96,7 +96,7 @@ const createTooltip = createWidgetFactory(
96
96
  "keydown",
97
97
  (event) => {
98
98
  if (visible$() && event.key === "Escape") {
99
- visible$.set(false);
99
+ void transition.api.toggle(false);
100
100
  event.preventDefault();
101
101
  event.stopPropagation();
102
102
  }
@@ -135,7 +135,7 @@ const createTooltip = createWidgetFactory(
135
135
  if (event.pointerType === "touch" && !disabled$()) {
136
136
  event.preventDefault();
137
137
  if (hasVisibleFocus$()) {
138
- visible$.set(true);
138
+ void transition.api.toggle(true);
139
139
  } else {
140
140
  forceVisibleOnFocus$.set(true);
141
141
  event.currentTarget?.focus?.();
@@ -9,7 +9,7 @@ import { noop } from "./utils/func.js";
9
9
  import { a as revertScrollbars, r as removeScrollbars } from "./scrollbars-ChGk75QR.js";
10
10
  import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
11
11
  import { createWidgetFactory } from "./utils/widget.js";
12
- import { d as typeBoolean, j as typeNumberOrNull, f as typeFunction, g as typeHTMLElementOrNull, k as typeString, c as createTypeEnum } from "./writables-_7BriMb2.js";
12
+ import { d as typeBoolean, j as typeNumberOrNull, f as typeFunction, g as typeHTMLElementOrNull, k as typeString, e as typeBooleanOrNull, c as createTypeEnum } from "./writables-_7BriMb2.js";
13
13
  import { g as getTextDirection } from "./textDirection-cNgt24LJ.js";
14
14
  function getDrawerDefaultConfig() {
15
15
  return {
@@ -18,6 +18,7 @@ function getDrawerDefaultConfig() {
18
18
  }
19
19
  const defaultDrawerConfig = {
20
20
  animated: true,
21
+ backdropAnimated: null,
21
22
  ariaDescribedBy: "",
22
23
  ariaLabelledBy: "",
23
24
  backdropClass: "",
@@ -45,6 +46,7 @@ const defaultDrawerConfig = {
45
46
  };
46
47
  const configValidator = {
47
48
  animated: typeBoolean,
49
+ backdropAnimated: typeBooleanOrNull,
48
50
  ariaDescribedBy: typeString,
49
51
  ariaLabelledBy: typeString,
50
52
  backdropClass: typeString,
@@ -75,6 +77,7 @@ const createDrawer = createWidgetFactory(
75
77
  (config) => {
76
78
  const [
77
79
  {
80
+ backdropAnimated$: _backdropAnimated$,
78
81
  backdrop$: _backdrop$,
79
82
  backdropTransition$,
80
83
  backdropClass$,
@@ -159,9 +162,13 @@ const createDrawer = createWidgetFactory(
159
162
  }
160
163
  }))
161
164
  );
165
+ const backdropAnimated$ = asWritable(
166
+ computed(() => _backdropAnimated$() ?? animated$()),
167
+ (val) => _backdropAnimated$.set(val)
168
+ );
162
169
  const backdropTransition = createTransition({
163
170
  props: {
164
- animated: animated$,
171
+ animated: backdropAnimated$,
165
172
  transition: backdropTransition$
166
173
  }
167
174
  });
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FACTORY_WIDGET_NAME, INVALID_VALUE } from "./types.js";
2
- import { c, a, f, g } from "./accordion-B5RqDwi3.js";
2
+ import { c, a, f, g } from "./accordion-DUFLBQkV.js";
3
3
  import { c as c2 } from "./alert-Db6cG6JE.js";
4
4
  import { c as c3, g as g2 } from "./collapse-D8Jo56k9.js";
5
5
  import { c as c4, g as g3 } from "./dropdown-Bjj2ql6d.js";
@@ -7,10 +7,10 @@ import { c as c5, g as g4, m, a as a2, b } from "./modal-CQWh2Sm5.js";
7
7
  import { c as c6, g as g5 } from "./pagination-DIRcpdRE.js";
8
8
  import { c as c7, g as g6 } from "./progressbar-Bth8r3Qu.js";
9
9
  import { c as c8, g as g7 } from "./rating-DLsgFSyB.js";
10
- import { c as c9, g as g8 } from "./slider-b9cVFNAL.js";
10
+ import { c as c9, g as g8 } from "./slider-tH5g55yQ.js";
11
11
  import { T, c as c10, d, g as g9 } from "./toaster-BS9qeRLF.js";
12
12
  import { c as c11, g as g10 } from "./tree-DW6iLxdw.js";
13
- import { c as c12, g as g11 } from "./drawer-CpGnS2ln.js";
13
+ import { c as c12, g as g11 } from "./drawer-D4xSbhcT.js";
14
14
  import { createWidgetsConfig, mergeInto } from "./config.js";
15
15
  import { extendWidgetProps } from "./services/extendWidget.js";
16
16
  import { activeElement$, createHasFocus } from "./services/focustrack.js";
@@ -27,7 +27,7 @@ import { createTransition, noAnimation } from "./services/transitions/baseTransi
27
27
  import { createCSSTransition, getTransitionDurationMs, hasTransition } from "./services/transitions/cssTransitions.js";
28
28
  import { createSimpleClassTransition } from "./services/transitions/simpleClassTransition.js";
29
29
  import { a as a3, b as b2, c as c13, d as d2, e, f as f2, g as g12, h, i, j, k, l, m as m2, n, o, p, q, r, s, t, u, v } from "./directive-CMT2vEDg.js";
30
- import { bindableDerived, bindableProp, createPatch, false$, findChangedProperties, idWithDefault, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, true$, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
30
+ import { bindableProp, createPatch, false$, findChangedProperties, idWithDefault, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, true$, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
31
31
  import { c as c14, a as a4, t as t2, b as b3, d as d3, e as e2, f as f3, g as g13, h as h2, i as i2, j as j2, k as k2, l as l2 } from "./writables-_7BriMb2.js";
32
32
  export {
33
33
  FACTORY_WIDGET_NAME,
@@ -37,7 +37,6 @@ export {
37
37
  a3 as attributesData,
38
38
  b2 as bindDirective,
39
39
  c13 as bindDirectiveNoArg,
40
- bindableDerived,
41
40
  bindableProp,
42
41
  d2 as browserDirective,
43
42
  e as classDirective,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@design-factory/core",
3
3
  "description": "Internal package used by the Design Factory.",
4
- "version": "22.0.0-next.0",
4
+ "version": "22.0.0-next.1",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -2,7 +2,7 @@ import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
2
2
  import { e as typeBooleanOrNull, f as typeFunction, d as typeBoolean } from "../../writables-_7BriMb2.js";
3
3
  import { b as promiseWithResolve } from "../../promise-CkIc0KKt.js";
4
4
  import { noop } from "../../utils/func.js";
5
- import { writablesForProps, bindableDerived, stateStores } from "../../utils/stores.js";
5
+ import { writablesForProps, bindableProp, stateStores } from "../../utils/stores.js";
6
6
  import { m as createStoreDirective, s as mergeDirectives, o as directiveSubscribe } from "../../directive-CMT2vEDg.js";
7
7
  const neverEndingPromise = new Promise(noop);
8
8
  const noAnimation = (element, direction) => {
@@ -44,7 +44,7 @@ const createTransition = (config) => {
44
44
  ] = writablesForProps(defaultValues, config, configValidator);
45
45
  const { element$, directive: storeDirective } = createStoreDirective();
46
46
  const elementPresent$ = computed(() => !!element$());
47
- const visible$ = bindableDerived(onVisibleChange$, [requestedVisible$], ([visible]) => visible);
47
+ const visible$ = bindableProp(requestedVisible$, onVisibleChange$);
48
48
  const currentTransition$ = writable(
49
49
  null
50
50
  );
@@ -91,7 +91,7 @@ const createTransition = (config) => {
91
91
  const effectiveAnimation$ = computed(() => initDone$() ? animated$() : animatedOnInit$());
92
92
  const animationFromToggle$ = writable(null);
93
93
  let previousElement;
94
- let previousVisible = requestedVisible$();
94
+ let previousVisible = visible$();
95
95
  let pendingTransition = null;
96
96
  const visibleAction$ = derived(
97
97
  [visible$, element$, effectiveAnimation$, animationFromToggle$, transition$, currentTransition$],
@@ -132,14 +132,14 @@ const createTransition = (config) => {
132
132
  }
133
133
  );
134
134
  let lastToggle = {};
135
- const toggle = async (visible = !requestedVisible$(), animated = effectiveAnimation$()) => {
135
+ const toggle = async (visible = !visible$(), animated = effectiveAnimation$()) => {
136
136
  const currentToggle = {};
137
137
  lastToggle = currentToggle;
138
138
  try {
139
139
  await batch(() => {
140
140
  try {
141
141
  animationFromToggle$.set(animated);
142
- requestedVisible$.set(visible);
142
+ visible$.set(visible);
143
143
  return visibleAction$();
144
144
  } finally {
145
145
  animationFromToggle$.set(null);
@@ -3,6 +3,10 @@ import type { TransitionFn } from './baseTransitions';
3
3
  * Represents the context for a collapsible element.
4
4
  */
5
5
  export interface CollapseContext {
6
+ /**
7
+ * Whether the previous transition using this context was interrupted.
8
+ */
9
+ interrupted?: boolean;
6
10
  /**
7
11
  * the maximum size of the collapseable content.
8
12
  */
@@ -7,22 +7,29 @@ const createCollapseTransition = ({
7
7
  animationPendingClasses
8
8
  } = {}) => createCSSTransition((element, direction, animated, context) => {
9
9
  if (animated && isBrowserHTMLElement(element)) {
10
- removeClasses(element, animationPendingClasses);
11
- removeClasses(element, hideClasses);
12
- addClasses(element, showClasses);
13
- context.maxSize = element.getBoundingClientRect()[dimension] + "px";
14
- removeClasses(element, animationPendingClasses);
15
- removeClasses(element, showClasses);
16
- addClasses(element, hideClasses);
17
- context.minSize = element.getBoundingClientRect()[dimension] + "px";
18
- removeClasses(element, showClasses);
19
- removeClasses(element, hideClasses);
10
+ const interrupted = context.interrupted;
11
+ if (!context.maxSize || !context.minSize) {
12
+ element.style[dimension] = "";
13
+ removeClasses(element, animationPendingClasses);
14
+ removeClasses(element, hideClasses);
15
+ addClasses(element, showClasses);
16
+ context.maxSize = element.getBoundingClientRect()[dimension] + "px";
17
+ removeClasses(element, animationPendingClasses);
18
+ removeClasses(element, showClasses);
19
+ addClasses(element, hideClasses);
20
+ context.minSize = element.getBoundingClientRect()[dimension] + "px";
21
+ removeClasses(element, showClasses);
22
+ removeClasses(element, hideClasses);
23
+ }
20
24
  const values = direction === "show" ? [context.minSize, context.maxSize] : [context.maxSize, context.minSize];
21
- element.style[dimension] = values[0];
22
- reflow(element);
23
- addClasses(element, animationPendingClasses);
24
- reflow(element);
25
+ if (!interrupted) {
26
+ element.style[dimension] = values[0];
27
+ reflow(element);
28
+ addClasses(element, animationPendingClasses);
29
+ reflow(element);
30
+ }
25
31
  element.style[dimension] = values[1];
32
+ context.interrupted = true;
26
33
  } else {
27
34
  removeClasses(element, direction === "show" ? hideClasses : showClasses);
28
35
  }
@@ -131,13 +131,6 @@ const computeCleanValue = (value, min, max, intStepSize, decimalPrecision) => {
131
131
  const indexMin = Math.floor((value - min) * magnitude / intStepSize);
132
132
  return +(((value - min) * magnitude % intStepSize < intStepSize / 2 ? indexMin : indexMin + 1) * intStepSize / magnitude + min).toFixed(decimalPrecision);
133
133
  };
134
- const updateValue = (handleIndex, values$, stepSize, updateDirection) => {
135
- values$.update((value) => {
136
- value = [...value];
137
- value[handleIndex] = value[handleIndex] + stepSize * updateDirection;
138
- return value;
139
- });
140
- };
141
134
  const getUpdateDirection = (vertical, rtl, keysVertical) => {
142
135
  if (vertical && rtl) {
143
136
  return keysVertical ? 1 : -1;
@@ -215,7 +208,6 @@ const createSlider = createWidgetFactory(
215
208
  () => Math.max(getDecimalPrecision(stepSize$()), getDecimalPrecision(min$()), getDecimalPrecision(max$()))
216
209
  );
217
210
  const _intStepSize$ = computed(() => stepSize$() * Math.pow(10, _decimalPrecision$()));
218
- let previousValues = _dirtyValues$();
219
211
  const values$ = bindableProp(
220
212
  _dirtyValues$,
221
213
  onValuesChange$,
@@ -224,23 +216,28 @@ const createSlider = createWidgetFactory(
224
216
  const max = max$();
225
217
  const intStepSize = _intStepSize$();
226
218
  const decimalPrecision = _decimalPrecision$();
227
- const newValues = dirtyValues.map((dv) => computeCleanValue(dv, min, max, intStepSize, decimalPrecision));
228
- if (dirtyValues.length > 1) {
219
+ return dirtyValues.map((dv) => computeCleanValue(dv, min, max, intStepSize, decimalPrecision));
220
+ },
221
+ typeArray.equal
222
+ );
223
+ const updateValueAtIndex = (index, newValue) => {
224
+ values$.update((vals) => {
225
+ const min = min$();
226
+ const max = max$();
227
+ const intStepSize = _intStepSize$();
228
+ const decimalPrecision = _decimalPrecision$();
229
+ const newVals = [...vals];
230
+ newVals[index] = computeCleanValue(newValue, min, max, intStepSize, decimalPrecision);
231
+ if (newVals.length > 1) {
229
232
  const minRange = minRange$();
230
233
  const maxRange = maxRange$();
231
234
  if (minRange || maxRange) {
232
- const pushRange = pushRange$();
233
- const changedIndex = newValues.findIndex((dv, index) => dv !== previousValues[index]);
234
- if (changedIndex !== -1) {
235
- manageMinMaxRange(newValues, changedIndex, minRange, maxRange, min, max, pushRange);
236
- }
235
+ manageMinMaxRange(newVals, index, minRange, maxRange, min, max, pushRange$());
237
236
  }
238
237
  }
239
- previousValues = newValues;
240
- return newValues;
241
- },
242
- typeArray.equal
243
- );
238
+ return newVals;
239
+ });
240
+ };
244
241
  const { directive: sliderDirective, element$: sliderDom$ } = createBrowserStoreDirective();
245
242
  const { directive: minLabelDomDirective, element$: minLabelDom$ } = createBrowserStoreDirective();
246
243
  const { directive: maxLabelDomDirective, element$: maxLabelDom$ } = createBrowserStoreDirective();
@@ -516,11 +513,7 @@ const createSlider = createWidgetFactory(
516
513
  const clickedPercent = getClickedPercent(clickedCoordinate);
517
514
  const derivedHandleIndex = handleNumber ?? getClosestSliderHandle(clickedPercent);
518
515
  const newValue = clickedPercent * (max$() - min$()) + min$();
519
- values$.update((dh) => {
520
- dh = [...dh];
521
- dh[derivedHandleIndex] = newValue;
522
- return dh;
523
- });
516
+ updateValueAtIndex(derivedHandleIndex, newValue);
524
517
  }
525
518
  };
526
519
  const horizontal$ = computed(() => !vertical$());
@@ -621,30 +614,34 @@ const createSlider = createWidgetFactory(
621
614
  if (interactive$()) {
622
615
  switch (key) {
623
616
  case "ArrowDown":
624
- updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, true));
617
+ updateValueAtIndex(
618
+ handleIndex,
619
+ values$()[handleIndex] + stepSize * getUpdateDirection(vertical, rtl, true)
620
+ );
625
621
  break;
626
622
  case "ArrowLeft":
627
- updateValue(handleIndex, values$, stepSize, getUpdateDirection(vertical, rtl, false));
623
+ updateValueAtIndex(
624
+ handleIndex,
625
+ values$()[handleIndex] + stepSize * getUpdateDirection(vertical, rtl, false)
626
+ );
628
627
  break;
629
628
  case "ArrowUp":
630
- updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, true));
629
+ updateValueAtIndex(
630
+ handleIndex,
631
+ values$()[handleIndex] + stepSize * -1 * getUpdateDirection(vertical, rtl, true)
632
+ );
631
633
  break;
632
634
  case "ArrowRight":
633
- updateValue(handleIndex, values$, stepSize, -1 * getUpdateDirection(vertical, rtl, false));
635
+ updateValueAtIndex(
636
+ handleIndex,
637
+ values$()[handleIndex] + stepSize * -1 * getUpdateDirection(vertical, rtl, false)
638
+ );
634
639
  break;
635
640
  case "Home":
636
- values$.update((value) => {
637
- value = [...value];
638
- value[handleIndex] = min;
639
- return value;
640
- });
641
+ updateValueAtIndex(handleIndex, min);
641
642
  break;
642
643
  case "End":
643
- values$.update((value) => {
644
- value = [...value];
645
- value[handleIndex] = max;
646
- return value;
647
- });
644
+ updateValueAtIndex(handleIndex, max);
648
645
  break;
649
646
  case "PageUp":
650
647
  break;
package/utils/stores.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ReadableSignal, StoreInput, StoresInputValues, WritableSignal } from '@amadeus-it-group/tansu';
1
+ import type { ReadableSignal, WritableSignal } from '@amadeus-it-group/tansu';
2
2
  import type { ConfigValidator, PropsConfig, ValuesOrReadableSignals, WritableWithDefaultOptions } from '../types';
3
3
  /**
4
4
  * Transforms the properties of a given type `P` into writable signals.
@@ -188,20 +188,6 @@ export declare const stateStores: <A extends object>(inputStores: { [K in keyof
188
188
  state$: ReadableSignal<A>;
189
189
  stores: { [K in keyof A as `${K & string}$`]: ReadableSignal<A[K]>; };
190
190
  };
191
- /**
192
- * Creates a writable signal that derives its value from multiple stores and allows for custom adjustment and equality checks.
193
- *
194
- * @template T - The type of the derived value.
195
- * @template U - A tuple type where the first element is a writable signal of type T and the rest are store inputs.
196
- *
197
- * @param onChange$ - A readable signal that emits a function to be called when the derived value changes.
198
- * @param stores - A tuple of stores where the first element is a writable signal of type T and the rest are store inputs.
199
- * @param adjustValue - A function to adjust the derived value based on the input values from the stores.
200
- * @param equal - A function to compare the current and new values for equality.
201
- *
202
- * @returns A writable signal that derives its value from the provided stores and allows for custom adjustment and equality checks.
203
- */
204
- export declare const bindableDerived: <T, U extends [WritableSignal<T>, ...StoreInput<any>[]]>(onChange$: ReadableSignal<(value: T) => void>, stores: U, adjustValue?: (arg: StoresInputValues<U>) => T, equal?: (currentValue: T, newValue: T) => boolean) => WritableSignal<T>;
205
191
  /**
206
192
  * Creates a bindable property that synchronizes a writable signal with an optional adjustment function and equality check.
207
193
  *
package/utils/stores.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readable, equal, asWritable, derived, computed, batch, asReadable, get, writable } from "@amadeus-it-group/tansu";
1
+ import { readable, equal, asWritable, computed, batch, asReadable, get, writable } from "@amadeus-it-group/tansu";
2
2
  import { INVALID_VALUE } from "../types.js";
3
3
  import { identity } from "./func.js";
4
4
  import { generateId } from "./id.js";
@@ -118,27 +118,6 @@ const stateStores = (inputStores) => {
118
118
  })
119
119
  };
120
120
  };
121
- const bindableDerived = (onChange$, stores, adjustValue = (arg) => arg[0], equal2 = (currentValue, newValue) => newValue === currentValue) => {
122
- let currentValue = stores[0]();
123
- return asWritable(
124
- derived(stores, {
125
- derive(values) {
126
- const newValue = adjustValue(values);
127
- const rectifiedValue = !equal2(values[0], newValue);
128
- if (rectifiedValue) {
129
- stores[0].set(newValue);
130
- }
131
- if (rectifiedValue || !equal2(currentValue, newValue)) {
132
- currentValue = newValue;
133
- onChange$()(newValue);
134
- }
135
- return newValue;
136
- },
137
- equal: equal2
138
- }),
139
- stores[0].set.bind(stores[0])
140
- );
141
- };
142
121
  const bindableProp = (store$, onChange$, adjustValue = identity, equal$1 = equal) => asWritable(
143
122
  computed(() => adjustValue(store$()), { equal: equal$1 }),
144
123
  (newValue) => {
@@ -156,7 +135,6 @@ function idWithDefault(id$) {
156
135
  const true$ = readable(true);
157
136
  const false$ = readable(false);
158
137
  export {
159
- bindableDerived,
160
138
  bindableProp,
161
139
  createPatch,
162
140
  false$,