@proyecto-viviana/solid-stately 0.1.5 → 0.2.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 (217) hide show
  1. package/dist/index.js +226 -504
  2. package/dist/index.jsx +6407 -0
  3. package/package.json +3 -5
  4. package/dist/index.js.map +0 -1
  5. package/src/autocomplete/createAutocompleteState.d.ts +0 -46
  6. package/src/autocomplete/createAutocompleteState.d.ts.map +0 -1
  7. package/src/autocomplete/createAutocompleteState.ts +0 -90
  8. package/src/autocomplete/index.d.ts +0 -2
  9. package/src/autocomplete/index.d.ts.map +0 -1
  10. package/src/autocomplete/index.ts +0 -5
  11. package/src/calendar/createCalendarState.d.ts +0 -130
  12. package/src/calendar/createCalendarState.d.ts.map +0 -1
  13. package/src/calendar/createCalendarState.ts +0 -461
  14. package/src/calendar/createDateFieldState.d.ts +0 -110
  15. package/src/calendar/createDateFieldState.d.ts.map +0 -1
  16. package/src/calendar/createDateFieldState.ts +0 -562
  17. package/src/calendar/createRangeCalendarState.d.ts +0 -146
  18. package/src/calendar/createRangeCalendarState.d.ts.map +0 -1
  19. package/src/calendar/createRangeCalendarState.ts +0 -535
  20. package/src/calendar/createTimeFieldState.d.ts +0 -95
  21. package/src/calendar/createTimeFieldState.d.ts.map +0 -1
  22. package/src/calendar/createTimeFieldState.ts +0 -483
  23. package/src/calendar/index.d.ts +0 -7
  24. package/src/calendar/index.d.ts.map +0 -1
  25. package/src/calendar/index.ts +0 -81
  26. package/src/checkbox/createCheckboxGroupState.d.ts +0 -71
  27. package/src/checkbox/createCheckboxGroupState.d.ts.map +0 -1
  28. package/src/checkbox/createCheckboxGroupState.ts +0 -193
  29. package/src/checkbox/index.d.ts +0 -2
  30. package/src/checkbox/index.d.ts.map +0 -1
  31. package/src/checkbox/index.ts +0 -5
  32. package/src/collections/ListCollection.d.ts +0 -37
  33. package/src/collections/ListCollection.d.ts.map +0 -1
  34. package/src/collections/ListCollection.ts +0 -146
  35. package/src/collections/createListState.d.ts +0 -79
  36. package/src/collections/createListState.d.ts.map +0 -1
  37. package/src/collections/createListState.ts +0 -264
  38. package/src/collections/createMenuState.d.ts +0 -50
  39. package/src/collections/createMenuState.d.ts.map +0 -1
  40. package/src/collections/createMenuState.ts +0 -106
  41. package/src/collections/createSelectionState.d.ts +0 -76
  42. package/src/collections/createSelectionState.d.ts.map +0 -1
  43. package/src/collections/createSelectionState.ts +0 -336
  44. package/src/collections/index.d.ts +0 -6
  45. package/src/collections/index.d.ts.map +0 -1
  46. package/src/collections/index.ts +0 -46
  47. package/src/collections/types.d.ts +0 -147
  48. package/src/collections/types.d.ts.map +0 -1
  49. package/src/collections/types.ts +0 -169
  50. package/src/color/Color.d.ts +0 -28
  51. package/src/color/Color.d.ts.map +0 -1
  52. package/src/color/Color.ts +0 -951
  53. package/src/color/createColorAreaState.d.ts +0 -76
  54. package/src/color/createColorAreaState.d.ts.map +0 -1
  55. package/src/color/createColorAreaState.ts +0 -293
  56. package/src/color/createColorFieldState.d.ts +0 -55
  57. package/src/color/createColorFieldState.d.ts.map +0 -1
  58. package/src/color/createColorFieldState.ts +0 -292
  59. package/src/color/createColorSliderState.d.ts +0 -67
  60. package/src/color/createColorSliderState.d.ts.map +0 -1
  61. package/src/color/createColorSliderState.ts +0 -241
  62. package/src/color/createColorWheelState.d.ts +0 -51
  63. package/src/color/createColorWheelState.d.ts.map +0 -1
  64. package/src/color/createColorWheelState.ts +0 -211
  65. package/src/color/index.d.ts +0 -10
  66. package/src/color/index.d.ts.map +0 -1
  67. package/src/color/index.ts +0 -47
  68. package/src/color/types.d.ts +0 -106
  69. package/src/color/types.d.ts.map +0 -1
  70. package/src/color/types.ts +0 -127
  71. package/src/combobox/createComboBoxState.d.ts +0 -125
  72. package/src/combobox/createComboBoxState.d.ts.map +0 -1
  73. package/src/combobox/createComboBoxState.ts +0 -703
  74. package/src/combobox/index.d.ts +0 -5
  75. package/src/combobox/index.d.ts.map +0 -1
  76. package/src/combobox/index.ts +0 -13
  77. package/src/disclosure/createDisclosureState.d.ts +0 -64
  78. package/src/disclosure/createDisclosureState.d.ts.map +0 -1
  79. package/src/disclosure/createDisclosureState.ts +0 -193
  80. package/src/disclosure/index.d.ts +0 -2
  81. package/src/disclosure/index.d.ts.map +0 -1
  82. package/src/disclosure/index.ts +0 -9
  83. package/src/dnd/createDragState.d.ts +0 -59
  84. package/src/dnd/createDragState.d.ts.map +0 -1
  85. package/src/dnd/createDragState.ts +0 -153
  86. package/src/dnd/createDraggableCollectionState.d.ts +0 -57
  87. package/src/dnd/createDraggableCollectionState.d.ts.map +0 -1
  88. package/src/dnd/createDraggableCollectionState.ts +0 -165
  89. package/src/dnd/createDropState.d.ts +0 -61
  90. package/src/dnd/createDropState.d.ts.map +0 -1
  91. package/src/dnd/createDropState.ts +0 -212
  92. package/src/dnd/createDroppableCollectionState.d.ts +0 -78
  93. package/src/dnd/createDroppableCollectionState.d.ts.map +0 -1
  94. package/src/dnd/createDroppableCollectionState.ts +0 -357
  95. package/src/dnd/index.d.ts +0 -11
  96. package/src/dnd/index.d.ts.map +0 -1
  97. package/src/dnd/index.ts +0 -76
  98. package/src/dnd/types.d.ts +0 -264
  99. package/src/dnd/types.d.ts.map +0 -1
  100. package/src/dnd/types.ts +0 -317
  101. package/src/form/createFormValidationState.d.ts +0 -100
  102. package/src/form/createFormValidationState.d.ts.map +0 -1
  103. package/src/form/createFormValidationState.ts +0 -389
  104. package/src/form/index.d.ts +0 -2
  105. package/src/form/index.d.ts.map +0 -1
  106. package/src/form/index.ts +0 -15
  107. package/src/grid/createGridState.d.ts +0 -12
  108. package/src/grid/createGridState.d.ts.map +0 -1
  109. package/src/grid/createGridState.ts +0 -327
  110. package/src/grid/index.d.ts +0 -7
  111. package/src/grid/index.d.ts.map +0 -1
  112. package/src/grid/index.ts +0 -13
  113. package/src/grid/types.d.ts +0 -156
  114. package/src/grid/types.d.ts.map +0 -1
  115. package/src/grid/types.ts +0 -179
  116. package/src/index.d.ts +0 -26
  117. package/src/index.d.ts.map +0 -1
  118. package/src/index.ts +0 -383
  119. package/src/numberfield/createNumberFieldState.d.ts +0 -65
  120. package/src/numberfield/createNumberFieldState.d.ts.map +0 -1
  121. package/src/numberfield/createNumberFieldState.ts +0 -383
  122. package/src/numberfield/index.d.ts +0 -2
  123. package/src/numberfield/index.d.ts.map +0 -1
  124. package/src/numberfield/index.ts +0 -5
  125. package/src/overlays/createOverlayTriggerState.d.ts +0 -32
  126. package/src/overlays/createOverlayTriggerState.d.ts.map +0 -1
  127. package/src/overlays/createOverlayTriggerState.ts +0 -67
  128. package/src/overlays/index.d.ts +0 -2
  129. package/src/overlays/index.d.ts.map +0 -1
  130. package/src/overlays/index.ts +0 -5
  131. package/src/radio/createRadioGroupState.d.ts +0 -77
  132. package/src/radio/createRadioGroupState.d.ts.map +0 -1
  133. package/src/radio/createRadioGroupState.ts +0 -201
  134. package/src/radio/index.d.ts +0 -2
  135. package/src/radio/index.d.ts.map +0 -1
  136. package/src/radio/index.ts +0 -6
  137. package/src/searchfield/createSearchFieldState.d.ts +0 -25
  138. package/src/searchfield/createSearchFieldState.d.ts.map +0 -1
  139. package/src/searchfield/createSearchFieldState.ts +0 -62
  140. package/src/searchfield/index.d.ts +0 -3
  141. package/src/searchfield/index.d.ts.map +0 -1
  142. package/src/searchfield/index.ts +0 -5
  143. package/src/select/createSelectState.d.ts +0 -73
  144. package/src/select/createSelectState.d.ts.map +0 -1
  145. package/src/select/createSelectState.ts +0 -181
  146. package/src/select/index.d.ts +0 -2
  147. package/src/select/index.d.ts.map +0 -1
  148. package/src/select/index.ts +0 -5
  149. package/src/slider/createSliderState.d.ts +0 -72
  150. package/src/slider/createSliderState.d.ts.map +0 -1
  151. package/src/slider/createSliderState.ts +0 -211
  152. package/src/slider/index.d.ts +0 -3
  153. package/src/slider/index.d.ts.map +0 -1
  154. package/src/slider/index.ts +0 -6
  155. package/src/ssr/index.d.ts +0 -28
  156. package/src/ssr/index.d.ts.map +0 -1
  157. package/src/ssr/index.ts +0 -41
  158. package/src/table/TableCollection.d.ts +0 -52
  159. package/src/table/TableCollection.d.ts.map +0 -1
  160. package/src/table/TableCollection.ts +0 -388
  161. package/src/table/createTableState.d.ts +0 -12
  162. package/src/table/createTableState.d.ts.map +0 -1
  163. package/src/table/createTableState.ts +0 -127
  164. package/src/table/index.d.ts +0 -8
  165. package/src/table/index.d.ts.map +0 -1
  166. package/src/table/index.ts +0 -18
  167. package/src/table/types.d.ts +0 -139
  168. package/src/table/types.d.ts.map +0 -1
  169. package/src/table/types.ts +0 -150
  170. package/src/tabs/createTabListState.d.ts +0 -68
  171. package/src/tabs/createTabListState.d.ts.map +0 -1
  172. package/src/tabs/createTabListState.ts +0 -240
  173. package/src/tabs/index.d.ts +0 -2
  174. package/src/tabs/index.d.ts.map +0 -1
  175. package/src/tabs/index.ts +0 -7
  176. package/src/textfield/createTextFieldState.d.ts +0 -30
  177. package/src/textfield/createTextFieldState.d.ts.map +0 -1
  178. package/src/textfield/createTextFieldState.ts +0 -75
  179. package/src/textfield/index.d.ts +0 -2
  180. package/src/textfield/index.d.ts.map +0 -1
  181. package/src/textfield/index.ts +0 -5
  182. package/src/toast/createToastState.d.ts +0 -118
  183. package/src/toast/createToastState.d.ts.map +0 -1
  184. package/src/toast/createToastState.ts +0 -316
  185. package/src/toast/index.d.ts +0 -2
  186. package/src/toast/index.d.ts.map +0 -1
  187. package/src/toast/index.ts +0 -11
  188. package/src/toggle/createToggleState.d.ts +0 -34
  189. package/src/toggle/createToggleState.d.ts.map +0 -1
  190. package/src/toggle/createToggleState.ts +0 -94
  191. package/src/toggle/index.d.ts +0 -2
  192. package/src/toggle/index.d.ts.map +0 -1
  193. package/src/toggle/index.ts +0 -5
  194. package/src/tooltip/createTooltipTriggerState.d.ts +0 -39
  195. package/src/tooltip/createTooltipTriggerState.d.ts.map +0 -1
  196. package/src/tooltip/createTooltipTriggerState.ts +0 -183
  197. package/src/tooltip/index.d.ts +0 -2
  198. package/src/tooltip/index.d.ts.map +0 -1
  199. package/src/tooltip/index.ts +0 -6
  200. package/src/tree/TreeCollection.d.ts +0 -40
  201. package/src/tree/TreeCollection.d.ts.map +0 -1
  202. package/src/tree/TreeCollection.ts +0 -175
  203. package/src/tree/createTreeState.d.ts +0 -14
  204. package/src/tree/createTreeState.d.ts.map +0 -1
  205. package/src/tree/createTreeState.ts +0 -392
  206. package/src/tree/index.d.ts +0 -7
  207. package/src/tree/index.d.ts.map +0 -1
  208. package/src/tree/index.ts +0 -13
  209. package/src/tree/types.d.ts +0 -157
  210. package/src/tree/types.d.ts.map +0 -1
  211. package/src/tree/types.ts +0 -174
  212. package/src/utils/index.d.ts +0 -2
  213. package/src/utils/index.d.ts.map +0 -1
  214. package/src/utils/index.ts +0 -1
  215. package/src/utils/reactivity.d.ts +0 -28
  216. package/src/utils/reactivity.d.ts.map +0 -1
  217. package/src/utils/reactivity.ts +0 -36
@@ -1,165 +0,0 @@
1
- /**
2
- * Draggable collection state management for solid-stately.
3
- *
4
- * Provides reactive state for dragging items from a collection.
5
- */
6
-
7
- import { createSignal, createMemo, type Accessor } from 'solid-js';
8
- import type {
9
- DragItem,
10
- DraggableCollectionStartEvent,
11
- DraggableCollectionMoveEvent,
12
- DraggableCollectionEndEvent,
13
- DropOperation,
14
- DragPreviewRenderer,
15
- } from './types';
16
-
17
- export interface DraggableCollectionStateOptions<T = object> {
18
- /** A function that returns the items being dragged. */
19
- getItems: (keys: Set<string | number>) => DragItem[];
20
- /** Function that returns the allowed drop operations. */
21
- getAllowedDropOperations?: () => DropOperation[];
22
- /** Handler that is called when a drag operation is started. */
23
- onDragStart?: (e: DraggableCollectionStartEvent) => void;
24
- /** Handler that is called when the drag is moved. */
25
- onDragMove?: (e: DraggableCollectionMoveEvent) => void;
26
- /** Handler that is called when the drag operation ends. */
27
- onDragEnd?: (e: DraggableCollectionEndEvent) => void;
28
- /** Whether the drag operation is disabled. */
29
- isDisabled?: boolean;
30
- /** Preview renderer function ref. */
31
- preview?: { current: DragPreviewRenderer | null };
32
- }
33
-
34
- export interface DraggableCollectionState {
35
- /** Whether items are currently being dragged. */
36
- readonly isDragging: boolean;
37
- /** The keys of the items being dragged. */
38
- readonly draggingKeys: Set<string | number>;
39
- /** Whether dragging is disabled. */
40
- readonly isDisabled: boolean;
41
- /** Start a drag operation with the given keys. */
42
- startDrag(keys: Set<string | number>, x: number, y: number): void;
43
- /** Update drag position. */
44
- moveDrag(x: number, y: number): void;
45
- /** End a drag operation. */
46
- endDrag(x: number, y: number, dropOperation: DropOperation, isInternal: boolean): void;
47
- /** Cancel a drag operation. */
48
- cancelDrag(): void;
49
- /** Get the items being dragged for the given keys. */
50
- getItems(keys: Set<string | number>): DragItem[];
51
- /** Get allowed drop operations. */
52
- getAllowedDropOperations(): DropOperation[];
53
- /** Preview renderer. */
54
- readonly preview: { current: DragPreviewRenderer | null } | undefined;
55
- }
56
-
57
- /**
58
- * Creates state for dragging items from a collection.
59
- *
60
- * @param props - Accessor returning draggable collection options
61
- * @returns Draggable collection state object
62
- */
63
- export function createDraggableCollectionState<T = object>(
64
- props: Accessor<DraggableCollectionStateOptions<T>>
65
- ): DraggableCollectionState {
66
- const getProps = createMemo(() => props());
67
-
68
- const [isDragging, setIsDragging] = createSignal(false);
69
- const [draggingKeys, setDraggingKeys] = createSignal<Set<string | number>>(
70
- new Set()
71
- );
72
-
73
- const startDrag = (keys: Set<string | number>, x: number, y: number) => {
74
- const p = getProps();
75
- if (p.isDisabled) return;
76
-
77
- setIsDragging(true);
78
- setDraggingKeys(keys);
79
-
80
- if (typeof p.onDragStart === 'function') {
81
- p.onDragStart({
82
- type: 'dragstart',
83
- x,
84
- y,
85
- keys,
86
- });
87
- }
88
- };
89
-
90
- const moveDrag = (x: number, y: number) => {
91
- const p = getProps();
92
- if (!isDragging() || p.isDisabled) return;
93
-
94
- if (typeof p.onDragMove === 'function') {
95
- p.onDragMove({
96
- type: 'dragmove',
97
- x,
98
- y,
99
- keys: draggingKeys(),
100
- });
101
- }
102
- };
103
-
104
- const endDrag = (
105
- x: number,
106
- y: number,
107
- dropOperation: DropOperation,
108
- isInternal: boolean
109
- ) => {
110
- const p = getProps();
111
- const keys = draggingKeys();
112
-
113
- setIsDragging(false);
114
- setDraggingKeys(new Set<string | number>());
115
-
116
- if (typeof p.onDragEnd === 'function') {
117
- p.onDragEnd({
118
- type: 'dragend',
119
- x,
120
- y,
121
- dropOperation,
122
- keys,
123
- isInternal,
124
- });
125
- }
126
- };
127
-
128
- const cancelDrag = () => {
129
- endDrag(0, 0, 'cancel', false);
130
- };
131
-
132
- const getItems = (keys: Set<string | number>) => {
133
- const p = getProps();
134
- return p.getItems(keys);
135
- };
136
-
137
- const getAllowedDropOperations = (): DropOperation[] => {
138
- const p = getProps();
139
- if (typeof p.getAllowedDropOperations === 'function') {
140
- return p.getAllowedDropOperations();
141
- }
142
- return ['move', 'copy', 'link'];
143
- };
144
-
145
- return {
146
- get isDragging() {
147
- return isDragging();
148
- },
149
- get draggingKeys() {
150
- return draggingKeys();
151
- },
152
- get isDisabled() {
153
- return getProps().isDisabled ?? false;
154
- },
155
- get preview() {
156
- return getProps().preview;
157
- },
158
- startDrag,
159
- moveDrag,
160
- endDrag,
161
- cancelDrag,
162
- getItems,
163
- getAllowedDropOperations,
164
- };
165
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * Drop state management for solid-stately.
3
- *
4
- * Provides reactive state for drop target operations.
5
- */
6
- import { type Accessor } from 'solid-js';
7
- import type { DropItem, DropEnterEvent, DropMoveEvent, DropExitEvent, DropActivateEvent, DropEvent, DropOperation, DragTypes } from './types';
8
- export interface DropStateOptions {
9
- /**
10
- * A function returning the drop operation to be performed.
11
- */
12
- getDropOperation?: (types: DragTypes, allowedOperations: DropOperation[]) => DropOperation;
13
- /**
14
- * A function returning the drop operation for a specific point.
15
- */
16
- getDropOperationForPoint?: (types: DragTypes, allowedOperations: DropOperation[], x: number, y: number) => DropOperation;
17
- /** Handler that is called when a valid drag enters the drop target. */
18
- onDropEnter?: (e: DropEnterEvent) => void;
19
- /** Handler that is called when a valid drag is moved within the drop target. */
20
- onDropMove?: (e: DropMoveEvent) => void;
21
- /** Handler that is called after a valid drag is held over the drop target. */
22
- onDropActivate?: (e: DropActivateEvent) => void;
23
- /** Handler that is called when a valid drag exits the drop target. */
24
- onDropExit?: (e: DropExitEvent) => void;
25
- /** Handler that is called when a valid drag is dropped on the drop target. */
26
- onDrop?: (e: DropEvent) => void;
27
- /** Whether there is a separate drop button affordance. */
28
- hasDropButton?: boolean;
29
- /** Whether the drop target is disabled. */
30
- isDisabled?: boolean;
31
- }
32
- export interface DropState {
33
- /** Whether the drop target is currently being hovered or focused. */
34
- readonly isDropTarget: boolean;
35
- /** Whether the drop target is disabled. */
36
- readonly isDisabled: boolean;
37
- /** Whether there is a drop button. */
38
- readonly hasDropButton: boolean;
39
- /** Enter the drop target. */
40
- enterTarget(x: number, y: number): void;
41
- /** Move within the drop target. */
42
- moveInTarget(x: number, y: number): void;
43
- /** Exit the drop target. */
44
- exitTarget(x: number, y: number): void;
45
- /** Activate the drop target (after holding). */
46
- activateTarget(x: number, y: number): void;
47
- /** Perform a drop on the target. */
48
- drop(x: number, y: number, items: DropItem[], dropOperation: DropOperation): void;
49
- /** Get the drop operation for given types. */
50
- getDropOperation(types: DragTypes, allowedOperations: DropOperation[]): DropOperation;
51
- /** Get the drop operation for a specific point. */
52
- getDropOperationForPoint(types: DragTypes, allowedOperations: DropOperation[], x: number, y: number): DropOperation;
53
- }
54
- /**
55
- * Creates drop state for managing drop target operations.
56
- *
57
- * @param props - Accessor returning drop state options
58
- * @returns Drop state object
59
- */
60
- export declare function createDropState(props: Accessor<DropStateOptions>): DropState;
61
- //# sourceMappingURL=createDropState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDropState.d.ts","sourceRoot":"","sources":["createDropState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACnE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AI,CAAC;IACxC,mCAAmC;IACnC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,4BAA4B;IAC5B,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,oCAAoC;IACpC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAClF,8CAA8C;IAC9C,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;IACtF,mDAAmD;IACnD,wBAAwB,CACtB,KAAK,EAAE,SAAS,EAChB,iBAAiB,EAAE,aAAa,EAAE,EAClC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,aAAa,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAChC,SAAS,CA4HX"}
@@ -1,212 +0,0 @@
1
- /**
2
- * Drop state management for solid-stately.
3
- *
4
- * Provides reactive state for drop target operations.
5
- */
6
-
7
- import { createSignal, createMemo, type Accessor } from 'solid-js';
8
- import type {
9
- DropItem,
10
- DropEnterEvent,
11
- DropMoveEvent,
12
- DropExitEvent,
13
- DropActivateEvent,
14
- DropEvent,
15
- DropOperation,
16
- DragTypes,
17
- } from './types';
18
-
19
- export interface DropStateOptions {
20
- /**
21
- * A function returning the drop operation to be performed.
22
- */
23
- getDropOperation?: (
24
- types: DragTypes,
25
- allowedOperations: DropOperation[]
26
- ) => DropOperation;
27
- /**
28
- * A function returning the drop operation for a specific point.
29
- */
30
- getDropOperationForPoint?: (
31
- types: DragTypes,
32
- allowedOperations: DropOperation[],
33
- x: number,
34
- y: number
35
- ) => DropOperation;
36
- /** Handler that is called when a valid drag enters the drop target. */
37
- onDropEnter?: (e: DropEnterEvent) => void;
38
- /** Handler that is called when a valid drag is moved within the drop target. */
39
- onDropMove?: (e: DropMoveEvent) => void;
40
- /** Handler that is called after a valid drag is held over the drop target. */
41
- onDropActivate?: (e: DropActivateEvent) => void;
42
- /** Handler that is called when a valid drag exits the drop target. */
43
- onDropExit?: (e: DropExitEvent) => void;
44
- /** Handler that is called when a valid drag is dropped on the drop target. */
45
- onDrop?: (e: DropEvent) => void;
46
- /** Whether there is a separate drop button affordance. */
47
- hasDropButton?: boolean;
48
- /** Whether the drop target is disabled. */
49
- isDisabled?: boolean;
50
- }
51
-
52
- export interface DropState {
53
- /** Whether the drop target is currently being hovered or focused. */
54
- readonly isDropTarget: boolean;
55
- /** Whether the drop target is disabled. */
56
- readonly isDisabled: boolean;
57
- /** Whether there is a drop button. */
58
- readonly hasDropButton: boolean;
59
- /** Enter the drop target. */
60
- enterTarget(x: number, y: number): void;
61
- /** Move within the drop target. */
62
- moveInTarget(x: number, y: number): void;
63
- /** Exit the drop target. */
64
- exitTarget(x: number, y: number): void;
65
- /** Activate the drop target (after holding). */
66
- activateTarget(x: number, y: number): void;
67
- /** Perform a drop on the target. */
68
- drop(x: number, y: number, items: DropItem[], dropOperation: DropOperation): void;
69
- /** Get the drop operation for given types. */
70
- getDropOperation(types: DragTypes, allowedOperations: DropOperation[]): DropOperation;
71
- /** Get the drop operation for a specific point. */
72
- getDropOperationForPoint(
73
- types: DragTypes,
74
- allowedOperations: DropOperation[],
75
- x: number,
76
- y: number
77
- ): DropOperation;
78
- }
79
-
80
- /**
81
- * Creates drop state for managing drop target operations.
82
- *
83
- * @param props - Accessor returning drop state options
84
- * @returns Drop state object
85
- */
86
- export function createDropState(
87
- props: Accessor<DropStateOptions>
88
- ): DropState {
89
- const getProps = createMemo(() => props());
90
-
91
- const [isDropTarget, setIsDropTarget] = createSignal(false);
92
-
93
- const enterTarget = (x: number, y: number) => {
94
- const p = getProps();
95
- if (p.isDisabled) return;
96
-
97
- setIsDropTarget(true);
98
-
99
- if (typeof p.onDropEnter === 'function') {
100
- p.onDropEnter({
101
- type: 'dropenter',
102
- x,
103
- y,
104
- });
105
- }
106
- };
107
-
108
- const moveInTarget = (x: number, y: number) => {
109
- const p = getProps();
110
- if (!isDropTarget() || p.isDisabled) return;
111
-
112
- if (typeof p.onDropMove === 'function') {
113
- p.onDropMove({
114
- type: 'dropmove',
115
- x,
116
- y,
117
- });
118
- }
119
- };
120
-
121
- const exitTarget = (x: number, y: number) => {
122
- const p = getProps();
123
-
124
- setIsDropTarget(false);
125
-
126
- if (typeof p.onDropExit === 'function') {
127
- p.onDropExit({
128
- type: 'dropexit',
129
- x,
130
- y,
131
- });
132
- }
133
- };
134
-
135
- const activateTarget = (x: number, y: number) => {
136
- const p = getProps();
137
- if (p.isDisabled) return;
138
-
139
- if (typeof p.onDropActivate === 'function') {
140
- p.onDropActivate({
141
- type: 'dropactivate',
142
- x,
143
- y,
144
- });
145
- }
146
- };
147
-
148
- const drop = (
149
- x: number,
150
- y: number,
151
- items: DropItem[],
152
- dropOperation: DropOperation
153
- ) => {
154
- const p = getProps();
155
- if (p.isDisabled) return;
156
-
157
- setIsDropTarget(false);
158
-
159
- if (typeof p.onDrop === 'function') {
160
- p.onDrop({
161
- type: 'drop',
162
- x,
163
- y,
164
- items,
165
- dropOperation,
166
- });
167
- }
168
- };
169
-
170
- const getDropOperation = (
171
- types: DragTypes,
172
- allowedOperations: DropOperation[]
173
- ): DropOperation => {
174
- const p = getProps();
175
- if (typeof p.getDropOperation === 'function') {
176
- return p.getDropOperation(types, allowedOperations);
177
- }
178
- return allowedOperations[0] ?? 'cancel';
179
- };
180
-
181
- const getDropOperationForPoint = (
182
- types: DragTypes,
183
- allowedOperations: DropOperation[],
184
- x: number,
185
- y: number
186
- ): DropOperation => {
187
- const p = getProps();
188
- if (typeof p.getDropOperationForPoint === 'function') {
189
- return p.getDropOperationForPoint(types, allowedOperations, x, y);
190
- }
191
- return getDropOperation(types, allowedOperations);
192
- };
193
-
194
- return {
195
- get isDropTarget() {
196
- return isDropTarget();
197
- },
198
- get isDisabled() {
199
- return getProps().isDisabled ?? false;
200
- },
201
- get hasDropButton() {
202
- return getProps().hasDropButton ?? false;
203
- },
204
- enterTarget,
205
- moveInTarget,
206
- exitTarget,
207
- activateTarget,
208
- drop,
209
- getDropOperation,
210
- getDropOperationForPoint,
211
- };
212
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * Droppable collection state management for solid-stately.
3
- *
4
- * Provides reactive state for accepting drops onto a collection.
5
- */
6
- import { type Accessor } from 'solid-js';
7
- import type { DropItem, DropTarget, DropOperation, DragTypes, DroppableCollectionEnterEvent, DroppableCollectionActivateEvent, DroppableCollectionExitEvent, DroppableCollectionDropEvent, DroppableCollectionInsertDropEvent, DroppableCollectionRootDropEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, ItemDropTarget } from './types';
8
- export interface DroppableCollectionStateOptions {
9
- /**
10
- * The drag types that the droppable collection accepts.
11
- * @default 'all'
12
- */
13
- acceptedDragTypes?: 'all' | Array<string | symbol>;
14
- /**
15
- * A function returning the drop operation to be performed.
16
- */
17
- getDropOperation?: (target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]) => DropOperation;
18
- /** Handler that is called when a valid drag enters a drop target. */
19
- onDropEnter?: (e: DroppableCollectionEnterEvent) => void;
20
- /** Handler that is called after a valid drag is held over a drop target. */
21
- onDropActivate?: (e: DroppableCollectionActivateEvent) => void;
22
- /** Handler that is called when a valid drag exits a drop target. */
23
- onDropExit?: (e: DroppableCollectionExitEvent) => void;
24
- /** Handler that is called when a valid drag is dropped. */
25
- onDrop?: (e: DroppableCollectionDropEvent) => void;
26
- /** Handler that is called when external items are dropped "between" items. */
27
- onInsert?: (e: DroppableCollectionInsertDropEvent) => void;
28
- /** Handler that is called when external items are dropped on the collection's root. */
29
- onRootDrop?: (e: DroppableCollectionRootDropEvent) => void;
30
- /** Handler that is called when items are dropped "on" an item. */
31
- onItemDrop?: (e: DroppableCollectionOnItemDropEvent) => void;
32
- /** Handler that is called when items are reordered within the collection. */
33
- onReorder?: (e: DroppableCollectionReorderEvent) => void;
34
- /** Handler that is called when items are moved within the source collection. */
35
- onMove?: (e: DroppableCollectionReorderEvent) => void;
36
- /** A function returning whether a given target is a valid "on" drop target. */
37
- shouldAcceptItemDrop?: (target: ItemDropTarget, types: DragTypes) => boolean;
38
- /** Whether the droppable collection is disabled. */
39
- isDisabled?: boolean;
40
- }
41
- export interface DroppableCollectionState {
42
- /** Whether a drag is currently over the collection. */
43
- readonly isDropTarget: boolean;
44
- /** The current drop target within the collection. */
45
- readonly target: DropTarget | null;
46
- /** Whether the collection is disabled for drops. */
47
- readonly isDisabled: boolean;
48
- /** Set the current drop target. */
49
- setTarget(target: DropTarget | null): void;
50
- /** Check if a drag type is accepted. */
51
- isAccepted(types: DragTypes): boolean;
52
- /** Enter the collection with a drop target. */
53
- enterTarget(target: DropTarget, x: number, y: number): void;
54
- /** Move to a new target within the collection. */
55
- moveToTarget(target: DropTarget, x: number, y: number): void;
56
- /** Exit the collection. */
57
- exitTarget(x: number, y: number): void;
58
- /** Activate the current target. */
59
- activateTarget(x: number, y: number): void;
60
- /** Perform a drop on the collection. */
61
- drop(items: DropItem[], dropOperation: DropOperation, isInternal: boolean, draggingKeys?: Set<string | number>): void;
62
- /** Get the drop operation for a target. */
63
- getDropOperation(target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]): DropOperation;
64
- /** Check if an item drop should be accepted. */
65
- shouldAcceptItemDrop(target: ItemDropTarget, types: DragTypes): boolean;
66
- }
67
- /**
68
- * Symbol for directory drag type.
69
- */
70
- export declare const DIRECTORY_DRAG_TYPE: symbol;
71
- /**
72
- * Creates state for accepting drops onto a collection.
73
- *
74
- * @param props - Accessor returning droppable collection options
75
- * @returns Droppable collection state object
76
- */
77
- export declare function createDroppableCollectionState(props: Accessor<DroppableCollectionStateOptions>): DroppableCollectionState;
78
- //# sourceMappingURL=createDroppableCollectionState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createDroppableCollectionState.d.ts","sourceRoot":"","sources":["createDroppableCollectionState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,SAAS,EACT,6BAA6B,EAE7B,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,gCAAgC,EAChC,kCAAkC,EAClC,+BAA+B,EAC/B,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACnD;;OAEG;IACH,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,EAChB,iBAAiB,EAAE,aAAa,EAAE,KAC/B,aAAa,CAAC;IACnB,qEAAqE;IACrE,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,6BAA6B,KAAK,IAAI,CAAC;IACzD,4EAA4E;IAC5E,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,gCAAgC,KAAK,IAAI,CAAC;IAC/D,oEAAoE;IACpE,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,4BAA4B,KAAK,IAAI,CAAC;IACvD,2DAA2D;IAC3D,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,4BAA4B,KAAK,IAAI,CAAC;IACnD,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,kCAAkC,KAAK,IAAI,CAAC;IAC3D,uFAAuF;IACvF,UAAU,CAAC,EAAE,CAAC,CAAC,E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