@activecollab/components 2.0.372 → 2.0.374

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 (46) hide show
  1. package/dist/cjs/components/StackedCard/StackedCard.js +103 -19
  2. package/dist/cjs/components/StackedCard/StackedCard.js.map +1 -1
  3. package/dist/cjs/components/StackedCard/Styles.js +22 -17
  4. package/dist/cjs/components/StackedCard/Styles.js.map +1 -1
  5. package/dist/cjs/components/StackedCard/index.js +22 -0
  6. package/dist/cjs/components/StackedCard/index.js.map +1 -1
  7. package/dist/cjs/components/StackedCard/resizePolicy.js +238 -0
  8. package/dist/cjs/components/StackedCard/resizePolicy.js.map +1 -0
  9. package/dist/cjs/components/StackedCard/resizePolicy.test.js +474 -0
  10. package/dist/cjs/components/StackedCard/resizePolicy.test.js.map +1 -0
  11. package/dist/cjs/components/StackedCard/useStackedCardResize.js +145 -0
  12. package/dist/cjs/components/StackedCard/useStackedCardResize.js.map +1 -0
  13. package/dist/esm/components/StackedCard/StackedCard.d.ts +44 -3
  14. package/dist/esm/components/StackedCard/StackedCard.d.ts.map +1 -1
  15. package/dist/esm/components/StackedCard/StackedCard.js +102 -19
  16. package/dist/esm/components/StackedCard/StackedCard.js.map +1 -1
  17. package/dist/esm/components/StackedCard/Styles.d.ts +4 -1
  18. package/dist/esm/components/StackedCard/Styles.d.ts.map +1 -1
  19. package/dist/esm/components/StackedCard/Styles.js +22 -17
  20. package/dist/esm/components/StackedCard/Styles.js.map +1 -1
  21. package/dist/esm/components/StackedCard/index.d.ts +2 -0
  22. package/dist/esm/components/StackedCard/index.d.ts.map +1 -1
  23. package/dist/esm/components/StackedCard/index.js +2 -0
  24. package/dist/esm/components/StackedCard/index.js.map +1 -1
  25. package/dist/esm/components/StackedCard/resizePolicy.d.ts +111 -0
  26. package/dist/esm/components/StackedCard/resizePolicy.d.ts.map +1 -0
  27. package/dist/esm/{presentation/stackedCard → components/StackedCard}/resizePolicy.js +93 -48
  28. package/dist/esm/components/StackedCard/resizePolicy.js.map +1 -0
  29. package/dist/esm/components/StackedCard/resizePolicy.test.d.ts +2 -0
  30. package/dist/esm/components/StackedCard/resizePolicy.test.d.ts.map +1 -0
  31. package/dist/esm/components/StackedCard/resizePolicy.test.js +470 -0
  32. package/dist/esm/components/StackedCard/resizePolicy.test.js.map +1 -0
  33. package/dist/esm/components/StackedCard/useStackedCardResize.d.ts +62 -0
  34. package/dist/esm/components/StackedCard/useStackedCardResize.d.ts.map +1 -0
  35. package/dist/esm/components/StackedCard/useStackedCardResize.js +137 -0
  36. package/dist/esm/components/StackedCard/useStackedCardResize.js.map +1 -0
  37. package/dist/index.js +500 -36
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.min.js +1 -1
  40. package/dist/index.min.js.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/cjs/presentation/stackedCard/resizePolicy.js +0 -183
  43. package/dist/cjs/presentation/stackedCard/resizePolicy.js.map +0 -1
  44. package/dist/esm/presentation/stackedCard/resizePolicy.d.ts +0 -97
  45. package/dist/esm/presentation/stackedCard/resizePolicy.d.ts.map +0 -1
  46. package/dist/esm/presentation/stackedCard/resizePolicy.js.map +0 -1
@@ -0,0 +1,474 @@
1
+ "use strict";
2
+
3
+ var _resizePolicy = require("./resizePolicy");
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ var FREE = {
10
+ proportional: false
11
+ };
12
+ var start = function start(w, h) {
13
+ var minW = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
14
+ var minH = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
15
+ return (0, _resizePolicy.makeStart)({
16
+ w,
17
+ h
18
+ }, {
19
+ w: minW,
20
+ h: minH
21
+ });
22
+ };
23
+ describe("clamp / snap", function () {
24
+ it("clamps to the floor and, when given, the ceiling", function () {
25
+ expect((0, _resizePolicy.clamp)(5, 10)).toBe(10);
26
+ expect((0, _resizePolicy.clamp)(50, 10, 20)).toBe(20);
27
+ expect((0, _resizePolicy.clamp)(15, 10, 20)).toBe(15);
28
+ });
29
+ it("treats a missing ceiling as unbounded", function () {
30
+ expect((0, _resizePolicy.clamp)(1e9, 10)).toBe(1e9);
31
+ });
32
+ it("snaps to the nearest multiple, and passes through without a step", function () {
33
+ expect((0, _resizePolicy.snap)(217, 8)).toBe(216);
34
+ expect((0, _resizePolicy.snap)(220, 8)).toBe(224);
35
+ expect((0, _resizePolicy.snap)(217)).toBe(217);
36
+ expect((0, _resizePolicy.snap)(217, 0)).toBe(217);
37
+ });
38
+ });
39
+ describe("effectiveBounds", function () {
40
+ it("floors the policy minimum with the content minimum", function () {
41
+ var bounds = (0, _resizePolicy.effectiveBounds)({
42
+ minW: 96,
43
+ minH: 40,
44
+ proportional: false
45
+ }, {
46
+ w: 160,
47
+ h: 72
48
+ });
49
+
50
+ // The content wins on both axes here: a card may not be crushed below it.
51
+ expect(bounds.wMin).toBe(160);
52
+ expect(bounds.hMin).toBe(72);
53
+ });
54
+ it("keeps the policy minimum when it is the higher of the two", function () {
55
+ var bounds = (0, _resizePolicy.effectiveBounds)({
56
+ minW: 200,
57
+ proportional: false
58
+ }, {
59
+ w: 160,
60
+ h: 0
61
+ });
62
+ expect(bounds.wMin).toBe(200);
63
+ });
64
+ it("reports an unset maximum as unbounded", function () {
65
+ var bounds = (0, _resizePolicy.effectiveBounds)(FREE, {
66
+ w: 0,
67
+ h: 0
68
+ });
69
+ expect(bounds.wMax).toBe(Number.POSITIVE_INFINITY);
70
+ expect(bounds.hMax).toBe(Number.POSITIVE_INFINITY);
71
+ });
72
+ });
73
+ describe("applyResize — bounds", function () {
74
+ it("stops at minW", function () {
75
+ var policy = {
76
+ minW: 180,
77
+ proportional: false
78
+ };
79
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
80
+ dx: -500,
81
+ dy: 0
82
+ }, policy).w).toBe(180);
83
+ });
84
+ it("stops at maxW", function () {
85
+ var policy = {
86
+ maxW: 420,
87
+ proportional: false
88
+ };
89
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
90
+ dx: +500,
91
+ dy: 0
92
+ }, policy).w).toBe(420);
93
+ });
94
+ it("stops at minH", function () {
95
+ var policy = {
96
+ minH: 120,
97
+ proportional: false
98
+ };
99
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
100
+ dx: 0,
101
+ dy: -500
102
+ }, policy).h).toBe(120);
103
+ });
104
+ it("stops at maxH", function () {
105
+ var policy = {
106
+ maxH: 540,
107
+ proportional: false
108
+ };
109
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
110
+ dx: 0,
111
+ dy: +500
112
+ }, policy).h).toBe(540);
113
+ });
114
+ it("leaves an unset bound unbounded", function () {
115
+ // No maxW at all: a huge delta is applied in full.
116
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
117
+ dx: +5000,
118
+ dy: 0
119
+ }, FREE).w).toBe(5300);
120
+ // No minW either, so the floor is 0 rather than some implied width.
121
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
122
+ dx: -5000,
123
+ dy: 0
124
+ }, FREE).w).toBe(0);
125
+ });
126
+ it("lets the content minimum override a lower policy minimum", function () {
127
+ var policy = {
128
+ minW: 96,
129
+ proportional: false
130
+ };
131
+ var measured = (0, _resizePolicy.makeStart)({
132
+ w: 300,
133
+ h: 200
134
+ }, {
135
+ w: 160,
136
+ h: 0
137
+ });
138
+
139
+ // 96 is the policy floor, but the content needs 160 — the higher wins.
140
+ expect((0, _resizePolicy.applyResize)(measured, {
141
+ dx: -500,
142
+ dy: 0
143
+ }, policy).w).toBe(160);
144
+ });
145
+ });
146
+ describe("applyResize — proportional", function () {
147
+ /* The worked example from the spec: a proportional policy meeting a bound
148
+ must not distort the ratio — the binding axis stops both. */
149
+ var policy = {
150
+ minW: 96,
151
+ maxW: 620,
152
+ minH: 72,
153
+ maxH: 540,
154
+ proportional: true,
155
+ step: 8
156
+ };
157
+ var proportionalStart = (0, _resizePolicy.makeStart)({
158
+ w: 300,
159
+ h: 200
160
+ }, {
161
+ w: 96,
162
+ h: 72
163
+ });
164
+ it("holds the ratio when the WIDTH axis binds at the maximum", function () {
165
+ // scaleMax = min(620/300, 540/200) = 2.066 → width binds
166
+ expect((0, _resizePolicy.applyResize)(proportionalStart, {
167
+ dx: +400,
168
+ dy: 0
169
+ }, policy)).toEqual({
170
+ w: 620,
171
+ h: 413
172
+ });
173
+ });
174
+ it("holds the ratio when the HEIGHT axis binds at the minimum", function () {
175
+ // scaleMin = max(96/300, 72/200) = 0.36 → height binds
176
+ expect((0, _resizePolicy.applyResize)(proportionalStart, {
177
+ dx: -400,
178
+ dy: 0
179
+ }, policy)).toEqual({
180
+ w: 108,
181
+ h: 72
182
+ });
183
+ });
184
+ it("drives the scale from whichever axis the corner moved further", function () {
185
+ var free = {
186
+ proportional: true
187
+ };
188
+
189
+ // A purely vertical drag scales the width too, so the corner is not
190
+ // width-biased: +100 on a 200-tall card is a 1.5× scale.
191
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
192
+ dx: 0,
193
+ dy: +100
194
+ }, free)).toEqual({
195
+ w: 450,
196
+ h: 300
197
+ });
198
+ });
199
+ it("lets the grid yield rather than break the ratio at a bound", function () {
200
+ // Snapping 108 to the 8px grid would give 112 — above the binding minimum.
201
+ // The bound is a hard stop, so the card sits exactly on it instead.
202
+ var result = (0, _resizePolicy.applyResize)(proportionalStart, {
203
+ dx: -400,
204
+ dy: 0
205
+ }, policy);
206
+ expect(result.w % 8).not.toBe(0);
207
+ expect(result.w).toBe(108);
208
+ });
209
+ it("still snaps to the grid away from any bound", function () {
210
+ var result = (0, _resizePolicy.applyResize)(proportionalStart, {
211
+ dx: +37,
212
+ dy: 0
213
+ }, policy);
214
+
215
+ // 337 snaps to 336, and the height follows the same scale.
216
+ expect(result).toEqual({
217
+ w: 336,
218
+ h: 224
219
+ });
220
+ });
221
+ it("falls back to free-form when a side has no length to form a ratio", function () {
222
+ // Width-only cards park a placeholder height; the ratio math must not
223
+ // divide by zero.
224
+ var result = (0, _resizePolicy.applyResize)((0, _resizePolicy.makeStart)({
225
+ w: 300,
226
+ h: 0
227
+ }, {
228
+ w: 0,
229
+ h: 0
230
+ }), {
231
+ dx: +40,
232
+ dy: +40
233
+ }, {
234
+ proportional: true
235
+ });
236
+ expect(result.w).toBe(340);
237
+ expect(Number.isNaN(result.h)).toBe(false);
238
+ });
239
+ });
240
+ describe("applyResize — shift to constrain", function () {
241
+ it("locks the ratio for one gesture on a free-form policy", function () {
242
+ var result = (0, _resizePolicy.applyResize)(start(300, 200), {
243
+ dx: +150,
244
+ dy: 0
245
+ }, FREE, {
246
+ constrain: true
247
+ });
248
+
249
+ // 1.5× on both axes, from a purely horizontal drag.
250
+ expect(result).toEqual({
251
+ w: 450,
252
+ h: 300
253
+ });
254
+ });
255
+ it("leaves the axes independent without it", function () {
256
+ expect((0, _resizePolicy.applyResize)(start(300, 200), {
257
+ dx: +150,
258
+ dy: 0
259
+ }, FREE)).toEqual({
260
+ w: 450,
261
+ h: 200
262
+ });
263
+ });
264
+ it("changes nothing on a policy that is already proportional", function () {
265
+ var policy = {
266
+ proportional: true
267
+ };
268
+ var delta = {
269
+ dx: +150,
270
+ dy: 0
271
+ };
272
+ expect((0, _resizePolicy.applyResize)(start(300, 200), delta, policy, {
273
+ constrain: true
274
+ })).toEqual((0, _resizePolicy.applyResize)(start(300, 200), delta, policy));
275
+ });
276
+ });
277
+ describe("applyResize — width-only axis", function () {
278
+ /* The worked example from the spec: an auto-height card ignores the vertical
279
+ component entirely. */
280
+ it("ignores the vertical component and holds the height", function () {
281
+ var policy = {
282
+ minW: 180,
283
+ maxW: 420,
284
+ proportional: false,
285
+ step: 8
286
+ };
287
+ var result = (0, _resizePolicy.applyResize)((0, _resizePolicy.makeStart)({
288
+ w: 180,
289
+ h: 240
290
+ }, {
291
+ w: 180,
292
+ h: 0
293
+ }), {
294
+ dx: +37,
295
+ dy: +200
296
+ }, policy, {
297
+ axis: "width"
298
+ });
299
+ expect(result).toEqual({
300
+ w: 216,
301
+ h: 240
302
+ });
303
+ });
304
+ it("still lets the height follow the ratio in proportional mode", function () {
305
+ // `axis: "width"` drops the pointer's vertical INPUT; it does not turn a
306
+ // proportional card into a free-form one.
307
+ var result = (0, _resizePolicy.applyResize)(start(300, 200), {
308
+ dx: +150,
309
+ dy: +999
310
+ }, {
311
+ proportional: true
312
+ }, {
313
+ axis: "width"
314
+ });
315
+ expect(result).toEqual({
316
+ w: 450,
317
+ h: 300
318
+ });
319
+ });
320
+ });
321
+ describe("keyboardResize", function () {
322
+ var policy = {
323
+ minW: 180,
324
+ maxW: 420,
325
+ minH: 120,
326
+ maxH: 400,
327
+ proportional: false
328
+ };
329
+ var contentMin = {
330
+ w: 180,
331
+ h: 120
332
+ };
333
+ var size = {
334
+ w: 300,
335
+ h: 200
336
+ };
337
+ it("nudges by the default step when the policy has none", function () {
338
+ var _keyboardResize, _keyboardResize2, _keyboardResize3, _keyboardResize4;
339
+ expect((_keyboardResize = (0, _resizePolicy.keyboardResize)("ArrowRight", size, policy, contentMin)) === null || _keyboardResize === void 0 ? void 0 : _keyboardResize.w).toBe(300 + _resizePolicy.DEFAULT_KEYBOARD_STEP);
340
+ expect((_keyboardResize2 = (0, _resizePolicy.keyboardResize)("ArrowLeft", size, policy, contentMin)) === null || _keyboardResize2 === void 0 ? void 0 : _keyboardResize2.w).toBe(300 - _resizePolicy.DEFAULT_KEYBOARD_STEP);
341
+ expect((_keyboardResize3 = (0, _resizePolicy.keyboardResize)("ArrowDown", size, policy, contentMin)) === null || _keyboardResize3 === void 0 ? void 0 : _keyboardResize3.h).toBe(200 + _resizePolicy.DEFAULT_KEYBOARD_STEP);
342
+ expect((_keyboardResize4 = (0, _resizePolicy.keyboardResize)("ArrowUp", size, policy, contentMin)) === null || _keyboardResize4 === void 0 ? void 0 : _keyboardResize4.h).toBe(200 - _resizePolicy.DEFAULT_KEYBOARD_STEP);
343
+ });
344
+ it("nudges by the policy step when there is one", function () {
345
+ var _keyboardResize5;
346
+ expect((_keyboardResize5 = (0, _resizePolicy.keyboardResize)("ArrowRight", size, _objectSpread(_objectSpread({}, policy), {}, {
347
+ step: 20
348
+ }), contentMin)) === null || _keyboardResize5 === void 0 ? void 0 : _keyboardResize5.w).toBe(320);
349
+ });
350
+ it("makes Shift a coarse nudge", function () {
351
+ var _keyboardResize6;
352
+ expect((_keyboardResize6 = (0, _resizePolicy.keyboardResize)("ArrowRight", size, policy, contentMin, {
353
+ shiftKey: true
354
+ })) === null || _keyboardResize6 === void 0 ? void 0 : _keyboardResize6.w).toBe(300 + _resizePolicy.DEFAULT_KEYBOARD_STEP * _resizePolicy.SHIFT_STEP_MULTIPLIER);
355
+ });
356
+ it("clamps a nudge exactly like the pointer does", function () {
357
+ var _keyboardResize7;
358
+ expect((_keyboardResize7 = (0, _resizePolicy.keyboardResize)("ArrowLeft", {
359
+ w: 184,
360
+ h: 200
361
+ }, policy, contentMin, {
362
+ shiftKey: true
363
+ })) === null || _keyboardResize7 === void 0 ? void 0 : _keyboardResize7.w).toBe(180);
364
+ });
365
+ it("jumps to the minimum on Home and the maximum on End", function () {
366
+ expect((0, _resizePolicy.keyboardResize)("Home", size, policy, contentMin)).toEqual({
367
+ w: 180,
368
+ h: 120
369
+ });
370
+ expect((0, _resizePolicy.keyboardResize)("End", size, policy, contentMin)).toEqual({
371
+ w: 420,
372
+ h: 400
373
+ });
374
+ });
375
+ it("leaves an axis with no maximum where it is on End", function () {
376
+ var unbounded = {
377
+ minW: 180,
378
+ maxW: 420,
379
+ proportional: false
380
+ };
381
+ expect((0, _resizePolicy.keyboardResize)("End", size, unbounded, {
382
+ w: 180,
383
+ h: 0
384
+ })).toEqual({
385
+ w: 420,
386
+ h: 200
387
+ });
388
+ });
389
+ it("leaves an axis with no minimum where it is on Home", function () {
390
+ // Nobody asked for a floor on either axis, so Home has nothing to jump to —
391
+ // it must not collapse the card to zero.
392
+ expect((0, _resizePolicy.keyboardResize)("Home", size, FREE, {
393
+ w: 0,
394
+ h: 0
395
+ })).toEqual(size);
396
+ });
397
+ it("ignores the vertical keys on a width-only card", function () {
398
+ expect((0, _resizePolicy.keyboardResize)("ArrowUp", size, policy, contentMin, {
399
+ axis: "width"
400
+ })).toBeNull();
401
+ expect((0, _resizePolicy.keyboardResize)("ArrowDown", size, policy, contentMin, {
402
+ axis: "width"
403
+ })).toBeNull();
404
+ });
405
+ it("holds the height on a width-only Home and End", function () {
406
+ expect((0, _resizePolicy.keyboardResize)("Home", size, policy, contentMin, {
407
+ axis: "width"
408
+ })).toEqual({
409
+ w: 180,
410
+ h: 200
411
+ });
412
+ expect((0, _resizePolicy.keyboardResize)("End", size, policy, contentMin, {
413
+ axis: "width"
414
+ })).toEqual({
415
+ w: 420,
416
+ h: 200
417
+ });
418
+ });
419
+ it("returns null for a key it does not own", function () {
420
+ expect((0, _resizePolicy.keyboardResize)("Enter", size, policy, contentMin)).toBeNull();
421
+ expect((0, _resizePolicy.keyboardResize)("a", size, policy, contentMin)).toBeNull();
422
+ });
423
+ });
424
+ describe("isResizeKey", function () {
425
+ it("owns the arrows plus Home and End, and nothing else", function () {
426
+ _resizePolicy.RESIZE_KEYS.forEach(function (key) {
427
+ return expect((0, _resizePolicy.isResizeKey)(key)).toBe(true);
428
+ });
429
+ expect((0, _resizePolicy.isResizeKey)("Enter")).toBe(false);
430
+ expect((0, _resizePolicy.isResizeKey)("Tab")).toBe(false);
431
+ });
432
+ });
433
+ describe("measurePercent", function () {
434
+ var policy = {
435
+ minW: 200,
436
+ maxW: 400,
437
+ proportional: false
438
+ };
439
+ var contentMin = {
440
+ w: 0,
441
+ h: 0
442
+ };
443
+ it("reports the width axis as a percent of its allowed range", function () {
444
+ expect((0, _resizePolicy.measurePercent)({
445
+ w: 200,
446
+ h: 0
447
+ }, policy, contentMin)).toBe(0);
448
+ expect((0, _resizePolicy.measurePercent)({
449
+ w: 300,
450
+ h: 0
451
+ }, policy, contentMin)).toBe(50);
452
+ expect((0, _resizePolicy.measurePercent)({
453
+ w: 400,
454
+ h: 0
455
+ }, policy, contentMin)).toBe(100);
456
+ });
457
+ it("stays inside 0–100 for a size outside the bounds", function () {
458
+ expect((0, _resizePolicy.measurePercent)({
459
+ w: 40,
460
+ h: 0
461
+ }, policy, contentMin)).toBe(0);
462
+ expect((0, _resizePolicy.measurePercent)({
463
+ w: 900,
464
+ h: 0
465
+ }, policy, contentMin)).toBe(100);
466
+ });
467
+ it("reports 0 when the range is not finite", function () {
468
+ expect((0, _resizePolicy.measurePercent)({
469
+ w: 300,
470
+ h: 0
471
+ }, FREE, contentMin)).toBe(0);
472
+ });
473
+ });
474
+ //# sourceMappingURL=resizePolicy.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizePolicy.test.js","names":["_resizePolicy","require","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","FREE","proportional","start","w","h","minW","undefined","minH","makeStart","describe","it","expect","clamp","toBe","snap","bounds","effectiveBounds","wMin","hMin","wMax","POSITIVE_INFINITY","hMax","policy","applyResize","dx","dy","maxW","maxH","measured","step","proportionalStart","toEqual","free","result","not","isNaN","constrain","delta","axis","contentMin","size","_keyboardResize","_keyboardResize2","_keyboardResize3","_keyboardResize4","keyboardResize","DEFAULT_KEYBOARD_STEP","_keyboardResize5","_keyboardResize6","shiftKey","SHIFT_STEP_MULTIPLIER","_keyboardResize7","unbounded","toBeNull","RESIZE_KEYS","key","isResizeKey","measurePercent"],"sources":["../../../../src/components/StackedCard/resizePolicy.test.ts"],"sourcesContent":["import {\n DEFAULT_KEYBOARD_STEP,\n RESIZE_KEYS,\n SHIFT_STEP_MULTIPLIER,\n StackedCardResizePolicy,\n applyResize,\n clamp,\n effectiveBounds,\n isResizeKey,\n keyboardResize,\n makeStart,\n measurePercent,\n snap,\n} from \"./resizePolicy\";\n\nconst FREE: StackedCardResizePolicy = { proportional: false };\n\nconst start = (w: number, h: number, minW = 0, minH = 0) =>\n makeStart({ w, h }, { w: minW, h: minH });\n\ndescribe(\"clamp / snap\", () => {\n it(\"clamps to the floor and, when given, the ceiling\", () => {\n expect(clamp(5, 10)).toBe(10);\n expect(clamp(50, 10, 20)).toBe(20);\n expect(clamp(15, 10, 20)).toBe(15);\n });\n\n it(\"treats a missing ceiling as unbounded\", () => {\n expect(clamp(1e9, 10)).toBe(1e9);\n });\n\n it(\"snaps to the nearest multiple, and passes through without a step\", () => {\n expect(snap(217, 8)).toBe(216);\n expect(snap(220, 8)).toBe(224);\n expect(snap(217)).toBe(217);\n expect(snap(217, 0)).toBe(217);\n });\n});\n\ndescribe(\"effectiveBounds\", () => {\n it(\"floors the policy minimum with the content minimum\", () => {\n const bounds = effectiveBounds(\n { minW: 96, minH: 40, proportional: false },\n { w: 160, h: 72 }\n );\n\n // The content wins on both axes here: a card may not be crushed below it.\n expect(bounds.wMin).toBe(160);\n expect(bounds.hMin).toBe(72);\n });\n\n it(\"keeps the policy minimum when it is the higher of the two\", () => {\n const bounds = effectiveBounds(\n { minW: 200, proportional: false },\n { w: 160, h: 0 }\n );\n\n expect(bounds.wMin).toBe(200);\n });\n\n it(\"reports an unset maximum as unbounded\", () => {\n const bounds = effectiveBounds(FREE, { w: 0, h: 0 });\n\n expect(bounds.wMax).toBe(Number.POSITIVE_INFINITY);\n expect(bounds.hMax).toBe(Number.POSITIVE_INFINITY);\n });\n});\n\ndescribe(\"applyResize — bounds\", () => {\n it(\"stops at minW\", () => {\n const policy: StackedCardResizePolicy = { minW: 180, proportional: false };\n\n expect(applyResize(start(300, 200), { dx: -500, dy: 0 }, policy).w).toBe(\n 180\n );\n });\n\n it(\"stops at maxW\", () => {\n const policy: StackedCardResizePolicy = { maxW: 420, proportional: false };\n\n expect(applyResize(start(300, 200), { dx: +500, dy: 0 }, policy).w).toBe(\n 420\n );\n });\n\n it(\"stops at minH\", () => {\n const policy: StackedCardResizePolicy = { minH: 120, proportional: false };\n\n expect(applyResize(start(300, 200), { dx: 0, dy: -500 }, policy).h).toBe(\n 120\n );\n });\n\n it(\"stops at maxH\", () => {\n const policy: StackedCardResizePolicy = { maxH: 540, proportional: false };\n\n expect(applyResize(start(300, 200), { dx: 0, dy: +500 }, policy).h).toBe(\n 540\n );\n });\n\n it(\"leaves an unset bound unbounded\", () => {\n // No maxW at all: a huge delta is applied in full.\n expect(applyResize(start(300, 200), { dx: +5000, dy: 0 }, FREE).w).toBe(\n 5300\n );\n // No minW either, so the floor is 0 rather than some implied width.\n expect(applyResize(start(300, 200), { dx: -5000, dy: 0 }, FREE).w).toBe(0);\n });\n\n it(\"lets the content minimum override a lower policy minimum\", () => {\n const policy: StackedCardResizePolicy = { minW: 96, proportional: false };\n const measured = makeStart({ w: 300, h: 200 }, { w: 160, h: 0 });\n\n // 96 is the policy floor, but the content needs 160 — the higher wins.\n expect(applyResize(measured, { dx: -500, dy: 0 }, policy).w).toBe(160);\n });\n});\n\ndescribe(\"applyResize — proportional\", () => {\n /* The worked example from the spec: a proportional policy meeting a bound\n must not distort the ratio — the binding axis stops both. */\n const policy: StackedCardResizePolicy = {\n minW: 96,\n maxW: 620,\n minH: 72,\n maxH: 540,\n proportional: true,\n step: 8,\n };\n const proportionalStart = makeStart({ w: 300, h: 200 }, { w: 96, h: 72 });\n\n it(\"holds the ratio when the WIDTH axis binds at the maximum\", () => {\n // scaleMax = min(620/300, 540/200) = 2.066 → width binds\n expect(applyResize(proportionalStart, { dx: +400, dy: 0 }, policy)).toEqual(\n {\n w: 620,\n h: 413,\n }\n );\n });\n\n it(\"holds the ratio when the HEIGHT axis binds at the minimum\", () => {\n // scaleMin = max(96/300, 72/200) = 0.36 → height binds\n expect(applyResize(proportionalStart, { dx: -400, dy: 0 }, policy)).toEqual(\n {\n w: 108,\n h: 72,\n }\n );\n });\n\n it(\"drives the scale from whichever axis the corner moved further\", () => {\n const free: StackedCardResizePolicy = { proportional: true };\n\n // A purely vertical drag scales the width too, so the corner is not\n // width-biased: +100 on a 200-tall card is a 1.5× scale.\n expect(applyResize(start(300, 200), { dx: 0, dy: +100 }, free)).toEqual({\n w: 450,\n h: 300,\n });\n });\n\n it(\"lets the grid yield rather than break the ratio at a bound\", () => {\n // Snapping 108 to the 8px grid would give 112 — above the binding minimum.\n // The bound is a hard stop, so the card sits exactly on it instead.\n const result = applyResize(proportionalStart, { dx: -400, dy: 0 }, policy);\n\n expect(result.w % 8).not.toBe(0);\n expect(result.w).toBe(108);\n });\n\n it(\"still snaps to the grid away from any bound\", () => {\n const result = applyResize(proportionalStart, { dx: +37, dy: 0 }, policy);\n\n // 337 snaps to 336, and the height follows the same scale.\n expect(result).toEqual({ w: 336, h: 224 });\n });\n\n it(\"falls back to free-form when a side has no length to form a ratio\", () => {\n // Width-only cards park a placeholder height; the ratio math must not\n // divide by zero.\n const result = applyResize(\n makeStart({ w: 300, h: 0 }, { w: 0, h: 0 }),\n { dx: +40, dy: +40 },\n { proportional: true }\n );\n\n expect(result.w).toBe(340);\n expect(Number.isNaN(result.h)).toBe(false);\n });\n});\n\ndescribe(\"applyResize — shift to constrain\", () => {\n it(\"locks the ratio for one gesture on a free-form policy\", () => {\n const result = applyResize(start(300, 200), { dx: +150, dy: 0 }, FREE, {\n constrain: true,\n });\n\n // 1.5× on both axes, from a purely horizontal drag.\n expect(result).toEqual({ w: 450, h: 300 });\n });\n\n it(\"leaves the axes independent without it\", () => {\n expect(applyResize(start(300, 200), { dx: +150, dy: 0 }, FREE)).toEqual({\n w: 450,\n h: 200,\n });\n });\n\n it(\"changes nothing on a policy that is already proportional\", () => {\n const policy: StackedCardResizePolicy = { proportional: true };\n const delta = { dx: +150, dy: 0 };\n\n expect(\n applyResize(start(300, 200), delta, policy, { constrain: true })\n ).toEqual(applyResize(start(300, 200), delta, policy));\n });\n});\n\ndescribe(\"applyResize — width-only axis\", () => {\n /* The worked example from the spec: an auto-height card ignores the vertical\n component entirely. */\n it(\"ignores the vertical component and holds the height\", () => {\n const policy: StackedCardResizePolicy = {\n minW: 180,\n maxW: 420,\n proportional: false,\n step: 8,\n };\n\n const result = applyResize(\n makeStart({ w: 180, h: 240 }, { w: 180, h: 0 }),\n { dx: +37, dy: +200 },\n policy,\n { axis: \"width\" }\n );\n\n expect(result).toEqual({ w: 216, h: 240 });\n });\n\n it(\"still lets the height follow the ratio in proportional mode\", () => {\n // `axis: \"width\"` drops the pointer's vertical INPUT; it does not turn a\n // proportional card into a free-form one.\n const result = applyResize(\n start(300, 200),\n { dx: +150, dy: +999 },\n { proportional: true },\n { axis: \"width\" }\n );\n\n expect(result).toEqual({ w: 450, h: 300 });\n });\n});\n\ndescribe(\"keyboardResize\", () => {\n const policy: StackedCardResizePolicy = {\n minW: 180,\n maxW: 420,\n minH: 120,\n maxH: 400,\n proportional: false,\n };\n const contentMin = { w: 180, h: 120 };\n const size = { w: 300, h: 200 };\n\n it(\"nudges by the default step when the policy has none\", () => {\n expect(keyboardResize(\"ArrowRight\", size, policy, contentMin)?.w).toBe(\n 300 + DEFAULT_KEYBOARD_STEP\n );\n expect(keyboardResize(\"ArrowLeft\", size, policy, contentMin)?.w).toBe(\n 300 - DEFAULT_KEYBOARD_STEP\n );\n expect(keyboardResize(\"ArrowDown\", size, policy, contentMin)?.h).toBe(\n 200 + DEFAULT_KEYBOARD_STEP\n );\n expect(keyboardResize(\"ArrowUp\", size, policy, contentMin)?.h).toBe(\n 200 - DEFAULT_KEYBOARD_STEP\n );\n });\n\n it(\"nudges by the policy step when there is one\", () => {\n expect(\n keyboardResize(\"ArrowRight\", size, { ...policy, step: 20 }, contentMin)?.w\n ).toBe(320);\n });\n\n it(\"makes Shift a coarse nudge\", () => {\n expect(\n keyboardResize(\"ArrowRight\", size, policy, contentMin, {\n shiftKey: true,\n })?.w\n ).toBe(300 + DEFAULT_KEYBOARD_STEP * SHIFT_STEP_MULTIPLIER);\n });\n\n it(\"clamps a nudge exactly like the pointer does\", () => {\n expect(\n keyboardResize(\"ArrowLeft\", { w: 184, h: 200 }, policy, contentMin, {\n shiftKey: true,\n })?.w\n ).toBe(180);\n });\n\n it(\"jumps to the minimum on Home and the maximum on End\", () => {\n expect(keyboardResize(\"Home\", size, policy, contentMin)).toEqual({\n w: 180,\n h: 120,\n });\n expect(keyboardResize(\"End\", size, policy, contentMin)).toEqual({\n w: 420,\n h: 400,\n });\n });\n\n it(\"leaves an axis with no maximum where it is on End\", () => {\n const unbounded: StackedCardResizePolicy = {\n minW: 180,\n maxW: 420,\n proportional: false,\n };\n\n expect(keyboardResize(\"End\", size, unbounded, { w: 180, h: 0 })).toEqual({\n w: 420,\n h: 200,\n });\n });\n\n it(\"leaves an axis with no minimum where it is on Home\", () => {\n // Nobody asked for a floor on either axis, so Home has nothing to jump to —\n // it must not collapse the card to zero.\n expect(keyboardResize(\"Home\", size, FREE, { w: 0, h: 0 })).toEqual(size);\n });\n\n it(\"ignores the vertical keys on a width-only card\", () => {\n expect(\n keyboardResize(\"ArrowUp\", size, policy, contentMin, { axis: \"width\" })\n ).toBeNull();\n expect(\n keyboardResize(\"ArrowDown\", size, policy, contentMin, { axis: \"width\" })\n ).toBeNull();\n });\n\n it(\"holds the height on a width-only Home and End\", () => {\n expect(\n keyboardResize(\"Home\", size, policy, contentMin, { axis: \"width\" })\n ).toEqual({ w: 180, h: 200 });\n expect(\n keyboardResize(\"End\", size, policy, contentMin, { axis: \"width\" })\n ).toEqual({ w: 420, h: 200 });\n });\n\n it(\"returns null for a key it does not own\", () => {\n expect(keyboardResize(\"Enter\", size, policy, contentMin)).toBeNull();\n expect(keyboardResize(\"a\", size, policy, contentMin)).toBeNull();\n });\n});\n\ndescribe(\"isResizeKey\", () => {\n it(\"owns the arrows plus Home and End, and nothing else\", () => {\n RESIZE_KEYS.forEach((key) => expect(isResizeKey(key)).toBe(true));\n expect(isResizeKey(\"Enter\")).toBe(false);\n expect(isResizeKey(\"Tab\")).toBe(false);\n });\n});\n\ndescribe(\"measurePercent\", () => {\n const policy: StackedCardResizePolicy = {\n minW: 200,\n maxW: 400,\n proportional: false,\n };\n const contentMin = { w: 0, h: 0 };\n\n it(\"reports the width axis as a percent of its allowed range\", () => {\n expect(measurePercent({ w: 200, h: 0 }, policy, contentMin)).toBe(0);\n expect(measurePercent({ w: 300, h: 0 }, policy, contentMin)).toBe(50);\n expect(measurePercent({ w: 400, h: 0 }, policy, contentMin)).toBe(100);\n });\n\n it(\"stays inside 0–100 for a size outside the bounds\", () => {\n expect(measurePercent({ w: 40, h: 0 }, policy, contentMin)).toBe(0);\n expect(measurePercent({ w: 900, h: 0 }, policy, contentMin)).toBe(100);\n });\n\n it(\"reports 0 when the range is not finite\", () => {\n expect(measurePercent({ w: 300, h: 0 }, FREE, contentMin)).toBe(0);\n });\n});\n"],"mappings":";;AAAA,IAAAA,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
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useStackedCardResize = void 0;
7
+ var _react = require("react");
8
+ var _resizePolicy = require("./resizePolicy");
9
+ /**
10
+ * The one place pointer and keyboard input meet the resize policy.
11
+ *
12
+ * `StackedCard`'s built-in grip reports raw deltas and knows no policy — enough
13
+ * for a host that just tracks a width. This hook is the full contract: it
14
+ * captures the gesture start, funnels both inputs through the pure policy in
15
+ * `resizePolicy.ts`, streams preview events and fires exactly ONE commit per
16
+ * gesture. It returns the props to spread on the grip, including the live
17
+ * separator ARIA.
18
+ *
19
+ * Preview versus commit (spec §7e): the continuous stream is live feedback
20
+ * only. A host creates an undo entry on the COMMIT, never on a preview — and a
21
+ * gesture that never changed the size commits nothing at all, so a bare click
22
+ * on the grip is not a change.
23
+ *
24
+ * The hook never touches the card's content: the intrinsic minimum is read
25
+ * through `contentMin`, which may be a getter so a card that measures its own
26
+ * footer can answer at the moment it is asked.
27
+ */
28
+
29
+ /** The props to spread on the grip — `StackedCard`'s `resizeHandleProps`. */
30
+
31
+ var sameSize = function sameSize(a, b) {
32
+ return a.w === b.w && a.h === b.h;
33
+ };
34
+ var useStackedCardResize = exports.useStackedCardResize = function useStackedCardResize(_ref) {
35
+ var size = _ref.size,
36
+ policy = _ref.policy,
37
+ cardId = _ref.cardId,
38
+ contentMin = _ref.contentMin,
39
+ _ref$axis = _ref.axis,
40
+ axis = _ref$axis === void 0 ? "both" : _ref$axis,
41
+ _ref$scale = _ref.scale,
42
+ scale = _ref$scale === void 0 ? 1 : _ref$scale,
43
+ _ref$label = _ref.label,
44
+ label = _ref$label === void 0 ? "Resize card" : _ref$label,
45
+ onResize = _ref.onResize,
46
+ onResizeCommit = _ref.onResizeCommit;
47
+ // The pointer gesture's anchor: the size + content-min captured on pointer
48
+ // down, plus the pointer origin the delta is measured from.
49
+ var pointerStart = (0, _react.useRef)(null);
50
+ // Mirrors the latest emitted size so pointer-up / key-up can commit exactly
51
+ // what preview last showed, without a stale closure.
52
+ var latest = (0, _react.useRef)(size);
53
+ latest.current = size;
54
+ // Whether this gesture actually moved the card. A bare click, or a Home on an
55
+ // axis with no floor, leaves it false and commits nothing.
56
+ var dirty = (0, _react.useRef)(false);
57
+
58
+ // Read through refs so the handlers below can stay stable across renders
59
+ // while still seeing the current policy, axis and zoom.
60
+ var policyRef = (0, _react.useRef)(policy);
61
+ policyRef.current = policy;
62
+ var axisRef = (0, _react.useRef)(axis);
63
+ axisRef.current = axis;
64
+ var scaleRef = (0, _react.useRef)(scale);
65
+ scaleRef.current = scale;
66
+ var contentMinRef = (0, _react.useRef)(contentMin);
67
+ contentMinRef.current = contentMin;
68
+ var readContentMin = (0, _react.useCallback)(function () {
69
+ var source = contentMinRef.current;
70
+ return typeof source === "function" ? source() : source;
71
+ }, []);
72
+ var emitPreview = (0, _react.useCallback)(function (next, source) {
73
+ // Nothing changed — not a preview, and not something to commit later.
74
+ if (sameSize(next, latest.current)) return;
75
+ latest.current = next;
76
+ dirty.current = true;
77
+ onResize(next, source);
78
+ }, [onResize]);
79
+ var handlePointerDown = (0, _react.useCallback)(function (e) {
80
+ var _setPointerCapture, _ref2;
81
+ pointerStart.current = {
82
+ start: (0, _resizePolicy.makeStart)(latest.current, readContentMin()),
83
+ x: e.clientX,
84
+ y: e.clientY
85
+ };
86
+ dirty.current = false;
87
+ (_setPointerCapture = (_ref2 = e.target).setPointerCapture) === null || _setPointerCapture === void 0 || _setPointerCapture.call(_ref2, e.pointerId);
88
+ e.preventDefault();
89
+ }, [readContentMin]);
90
+ var handlePointerMove = (0, _react.useCallback)(function (e) {
91
+ var ps = pointerStart.current;
92
+ if (!ps) return;
93
+ var z = scaleRef.current || 1;
94
+ var next = (0, _resizePolicy.applyResize)(ps.start, {
95
+ dx: (e.clientX - ps.x) / z,
96
+ dy: (e.clientY - ps.y) / z
97
+ }, policyRef.current,
98
+ // Shift held during a free-form drag = temporary proportional lock.
99
+ {
100
+ constrain: e.shiftKey,
101
+ axis: axisRef.current
102
+ });
103
+ emitPreview(next, "pointer");
104
+ }, [emitPreview]);
105
+ var endPointer = (0, _react.useCallback)(function () {
106
+ if (!pointerStart.current) return;
107
+ pointerStart.current = null;
108
+ if (dirty.current) onResizeCommit(latest.current, "pointer");
109
+ dirty.current = false;
110
+ }, [onResizeCommit]);
111
+ var handleKeyDown = (0, _react.useCallback)(function (e) {
112
+ var next = (0, _resizePolicy.keyboardResize)(e.key, latest.current, policyRef.current, readContentMin(), {
113
+ shiftKey: e.shiftKey,
114
+ axis: axisRef.current
115
+ });
116
+ if (!next) return;
117
+ // The key is ours even when it resolves to no movement (already pinned at
118
+ // a bound), so the browser must not also scroll the surface.
119
+ e.preventDefault();
120
+ emitPreview(next, "keyboard");
121
+ }, [emitPreview, readContentMin]);
122
+ var handleKeyUp = (0, _react.useCallback)(function (e) {
123
+ if (!(0, _resizePolicy.isResizeKey)(e.key)) return;
124
+ // The gesture end for the keyboard is the key release: one commit per
125
+ // hold, mirroring pointer-up after a stream of moves.
126
+ if (dirty.current) onResizeCommit(latest.current, "keyboard");
127
+ dirty.current = false;
128
+ }, [onResizeCommit]);
129
+ return {
130
+ role: "separator",
131
+ tabIndex: 0,
132
+ "aria-label": label,
133
+ "aria-controls": cardId,
134
+ "aria-valuemin": 0,
135
+ "aria-valuemax": 100,
136
+ "aria-valuenow": (0, _resizePolicy.measurePercent)(size, policy, readContentMin()),
137
+ onPointerDown: handlePointerDown,
138
+ onPointerMove: handlePointerMove,
139
+ onPointerUp: endPointer,
140
+ onLostPointerCapture: endPointer,
141
+ onKeyDown: handleKeyDown,
142
+ onKeyUp: handleKeyUp
143
+ };
144
+ };
145
+ //# sourceMappingURL=useStackedCardResize.js.map