@activecollab/components 2.0.371 → 2.0.373

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 (68) hide show
  1. package/dist/cjs/components/Icons/collection/ConnectionIcon.js +9 -17
  2. package/dist/cjs/components/Icons/collection/ConnectionIcon.js.map +1 -1
  3. package/dist/cjs/components/Icons/collection/ShapesIcon.js +61 -0
  4. package/dist/cjs/components/Icons/collection/ShapesIcon.js.map +1 -0
  5. package/dist/cjs/components/Icons/collection/index.js +7 -0
  6. package/dist/cjs/components/Icons/collection/index.js.map +1 -1
  7. package/dist/cjs/components/StackedCard/StackedCard.js +103 -19
  8. package/dist/cjs/components/StackedCard/StackedCard.js.map +1 -1
  9. package/dist/cjs/components/StackedCard/Styles.js +23 -18
  10. package/dist/cjs/components/StackedCard/Styles.js.map +1 -1
  11. package/dist/cjs/components/StackedCard/index.js +22 -0
  12. package/dist/cjs/components/StackedCard/index.js.map +1 -1
  13. package/dist/cjs/components/StackedCard/resizePolicy.js +238 -0
  14. package/dist/cjs/components/StackedCard/resizePolicy.js.map +1 -0
  15. package/dist/cjs/components/StackedCard/resizePolicy.test.js +474 -0
  16. package/dist/cjs/components/StackedCard/resizePolicy.test.js.map +1 -0
  17. package/dist/cjs/components/StackedCard/useStackedCardResize.js +145 -0
  18. package/dist/cjs/components/StackedCard/useStackedCardResize.js.map +1 -0
  19. package/dist/cjs/presentation/stackedCard/content/LinkCard.js +35 -22
  20. package/dist/cjs/presentation/stackedCard/content/LinkCard.js.map +1 -1
  21. package/dist/esm/components/Icons/collection/ConnectionIcon.d.ts.map +1 -1
  22. package/dist/esm/components/Icons/collection/ConnectionIcon.js +9 -17
  23. package/dist/esm/components/Icons/collection/ConnectionIcon.js.map +1 -1
  24. package/dist/esm/components/Icons/collection/ShapesIcon.d.ts +32 -0
  25. package/dist/esm/components/Icons/collection/ShapesIcon.d.ts.map +1 -0
  26. package/dist/esm/components/Icons/collection/ShapesIcon.js +54 -0
  27. package/dist/esm/components/Icons/collection/ShapesIcon.js.map +1 -0
  28. package/dist/esm/components/Icons/collection/index.d.ts +1 -0
  29. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  30. package/dist/esm/components/Icons/collection/index.js +1 -0
  31. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  32. package/dist/esm/components/StackedCard/StackedCard.d.ts +44 -3
  33. package/dist/esm/components/StackedCard/StackedCard.d.ts.map +1 -1
  34. package/dist/esm/components/StackedCard/StackedCard.js +102 -19
  35. package/dist/esm/components/StackedCard/StackedCard.js.map +1 -1
  36. package/dist/esm/components/StackedCard/Styles.d.ts +4 -1
  37. package/dist/esm/components/StackedCard/Styles.d.ts.map +1 -1
  38. package/dist/esm/components/StackedCard/Styles.js +23 -18
  39. package/dist/esm/components/StackedCard/Styles.js.map +1 -1
  40. package/dist/esm/components/StackedCard/index.d.ts +2 -0
  41. package/dist/esm/components/StackedCard/index.d.ts.map +1 -1
  42. package/dist/esm/components/StackedCard/index.js +2 -0
  43. package/dist/esm/components/StackedCard/index.js.map +1 -1
  44. package/dist/esm/components/StackedCard/resizePolicy.d.ts +111 -0
  45. package/dist/esm/components/StackedCard/resizePolicy.d.ts.map +1 -0
  46. package/dist/esm/{presentation/stackedCard → components/StackedCard}/resizePolicy.js +93 -48
  47. package/dist/esm/components/StackedCard/resizePolicy.js.map +1 -0
  48. package/dist/esm/components/StackedCard/resizePolicy.test.d.ts +2 -0
  49. package/dist/esm/components/StackedCard/resizePolicy.test.d.ts.map +1 -0
  50. package/dist/esm/components/StackedCard/resizePolicy.test.js +470 -0
  51. package/dist/esm/components/StackedCard/resizePolicy.test.js.map +1 -0
  52. package/dist/esm/components/StackedCard/useStackedCardResize.d.ts +62 -0
  53. package/dist/esm/components/StackedCard/useStackedCardResize.d.ts.map +1 -0
  54. package/dist/esm/components/StackedCard/useStackedCardResize.js +137 -0
  55. package/dist/esm/components/StackedCard/useStackedCardResize.js.map +1 -0
  56. package/dist/esm/presentation/stackedCard/content/LinkCard.d.ts.map +1 -1
  57. package/dist/esm/presentation/stackedCard/content/LinkCard.js +35 -20
  58. package/dist/esm/presentation/stackedCard/content/LinkCard.js.map +1 -1
  59. package/dist/index.js +989 -482
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.min.js +1 -1
  62. package/dist/index.min.js.map +1 -1
  63. package/package.json +1 -1
  64. package/dist/cjs/presentation/stackedCard/resizePolicy.js +0 -183
  65. package/dist/cjs/presentation/stackedCard/resizePolicy.js.map +0 -1
  66. package/dist/esm/presentation/stackedCard/resizePolicy.d.ts +0 -97
  67. package/dist/esm/presentation/stackedCard/resizePolicy.d.ts.map +0 -1
  68. package/dist/esm/presentation/stackedCard/resizePolicy.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activecollab/components",
3
- "version": "2.0.371",
3
+ "version": "2.0.373",
4
4
  "description": "ActiveCollab Components",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,183 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.snap = exports.measurePercent = exports.makeStart = exports.keyboardResize = exports.isResizeKey = exports.effectiveBounds = exports.clamp = exports.applyResize = exports.SHIFT_STEP_MULTIPLIER = exports.RESIZE_KEYS = exports.DEFAULT_KEYBOARD_STEP = void 0;
7
- /**
8
- * StackedCard resize policy — pure math (story-local, presentation-only).
9
- *
10
- * The card only reports deltas; the HOST applies a resize policy (note 52097
11
- * §7). This module is that policy, packaged as pure functions so the SAME code
12
- * path serves both the pointer drag and the keyboard resize (task 5/8). Nothing
13
- * here touches the DOM, React, or the content — it takes a start size, a delta,
14
- * and a policy, and returns a clamped size. The story wires events to it; the
15
- * card's intrinsic content minimum is measured story-side and passed in as
16
- * `contentMin`, so this module knows nothing about heroes or footers.
17
- *
18
- * The policy has four parts, all preserved from the concept:
19
- * - bounds — optional min/max per axis; unset means unbounded.
20
- * - proportional — lock the aspect ratio captured at the start of the gesture;
21
- * the scale is clamped by the BINDING axis so the ratio never
22
- * distorts at a bound.
23
- * - step — optional grid snap; proportion wins over the grid.
24
- * - content min — the effective min is max(policyMin, contentMin) per axis,
25
- * so the card can never be crushed below what its content needs.
26
- */
27
-
28
- /** The card's intrinsic minimum, measured from its real content. */
29
-
30
- /** The size captured at the start of a gesture (pointer down or a key press). */
31
-
32
- /** Keyboard resize nudges by the policy step, or this when no step is set. */
33
- var DEFAULT_KEYBOARD_STEP = exports.DEFAULT_KEYBOARD_STEP = 8;
34
-
35
- /** Shift + arrow resizes by a larger increment (the familiar coarse nudge). */
36
- var SHIFT_STEP_MULTIPLIER = exports.SHIFT_STEP_MULTIPLIER = 4;
37
-
38
- /** Keys the separator handles; everything else falls through to the browser. */
39
- var RESIZE_KEYS = exports.RESIZE_KEYS = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"];
40
- var isResizeKey = exports.isResizeKey = function isResizeKey(key) {
41
- return RESIZE_KEYS.includes(key);
42
- };
43
- var clamp = exports.clamp = function clamp(v, lo, hi) {
44
- return Math.min(hi !== null && hi !== void 0 ? hi : Number.POSITIVE_INFINITY, Math.max(lo, v));
45
- };
46
- var snap = exports.snap = function snap(v, step) {
47
- return step && step > 0 ? Math.round(v / step) * step : v;
48
- };
49
- var makeStart = exports.makeStart = function makeStart(size, contentMin) {
50
- return {
51
- w: size.w,
52
- h: size.h,
53
- contentMin
54
- };
55
- };
56
-
57
- /**
58
- * The effective bounds a size is clamped to: the policy min floored by the
59
- * content min, and the policy max (unbounded when unset). Independent of any
60
- * live gesture, so the story can also use it for the aria value and Home/End.
61
- */
62
- var effectiveBounds = exports.effectiveBounds = function effectiveBounds(policy, contentMin) {
63
- var _policy$minW, _policy$minH, _policy$maxW, _policy$maxH;
64
- return {
65
- wMin: Math.max((_policy$minW = policy.minW) !== null && _policy$minW !== void 0 ? _policy$minW : 0, contentMin.w),
66
- hMin: Math.max((_policy$minH = policy.minH) !== null && _policy$minH !== void 0 ? _policy$minH : 0, contentMin.h),
67
- wMax: (_policy$maxW = policy.maxW) !== null && _policy$maxW !== void 0 ? _policy$maxW : Number.POSITIVE_INFINITY,
68
- hMax: (_policy$maxH = policy.maxH) !== null && _policy$maxH !== void 0 ? _policy$maxH : Number.POSITIVE_INFINITY
69
- };
70
- };
71
-
72
- /**
73
- * Apply a delta to the start size under the policy — the single path for both
74
- * inputs. `constrain` is the transient Shift-to-constrain lock: a free-form
75
- * policy behaves proportionally for that one gesture; a proportional policy is
76
- * already locked and ignores it.
77
- */
78
- var applyResize = exports.applyResize = function applyResize(start, delta, policy) {
79
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
80
- var _effectiveBounds = effectiveBounds(policy, start.contentMin),
81
- wMin = _effectiveBounds.wMin,
82
- hMin = _effectiveBounds.hMin,
83
- wMax = _effectiveBounds.wMax,
84
- hMax = _effectiveBounds.hMax;
85
- var proportional = policy.proportional || opts.constrain === true;
86
- var w;
87
- var h;
88
- if (proportional) {
89
- // one scale drives both axes; the corner's dominant direction wins, so a
90
- // vertical drag is as effective as a horizontal one
91
- var sW = (start.w + delta.dx) / start.w;
92
- var sH = (start.h + delta.dy) / start.h;
93
- var scale = Math.abs(sW - 1) >= Math.abs(sH - 1) ? sW : sH;
94
-
95
- // clamp the SCALE so both axes stay in bounds (binding constraint): the
96
- // ratio can never break at a bound — whichever edge is limiting stops both
97
- var scaleMin = Math.max(wMin / start.w, hMin / start.h);
98
- var scaleMax = Math.min(wMax / start.w, hMax / start.h);
99
- scale = clamp(scale, scaleMin, Math.max(scaleMin, scaleMax));
100
-
101
- // step: proportion wins. Snap via the scale (driven off the width edge) and
102
- // re-clamp, so ratio and bounds always hold; the grid yields when honoring
103
- // it would cost the ratio
104
- if (policy.step) {
105
- var snappedScale = snap(start.w * scale, policy.step) / start.w;
106
- scale = clamp(snappedScale, scaleMin, Math.max(scaleMin, scaleMax));
107
- }
108
- w = start.w * scale;
109
- h = start.h * scale;
110
- } else {
111
- w = clamp(snap(start.w + delta.dx, policy.step), wMin, wMax);
112
- h = clamp(snap(start.h + delta.dy, policy.step), hMin, hMax);
113
- }
114
- return {
115
- w: Math.round(w),
116
- h: Math.round(h)
117
- };
118
- };
119
-
120
- /**
121
- * Translate a resize key into the next size, reusing `applyResize` so the
122
- * keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);
123
- * Home/End jump to the min/max of the allowed range. Returns null for any key
124
- * the handle does not own.
125
- */
126
- var keyboardResize = exports.keyboardResize = function keyboardResize(key, size, policy, contentMin) {
127
- var opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
128
- var base = policy.step && policy.step > 0 ? policy.step : DEFAULT_KEYBOARD_STEP;
129
- var step = base * (opts.shiftKey ? SHIFT_STEP_MULTIPLIER : 1);
130
- var start = makeStart(size, contentMin);
131
- var b = effectiveBounds(policy, contentMin);
132
- switch (key) {
133
- case "ArrowRight":
134
- return applyResize(start, {
135
- dx: step,
136
- dy: 0
137
- }, policy);
138
- case "ArrowLeft":
139
- return applyResize(start, {
140
- dx: -step,
141
- dy: 0
142
- }, policy);
143
- case "ArrowDown":
144
- return applyResize(start, {
145
- dx: 0,
146
- dy: step
147
- }, policy);
148
- case "ArrowUp":
149
- return applyResize(start, {
150
- dx: 0,
151
- dy: -step
152
- }, policy);
153
- case "Home":
154
- // jump to the min corner (a huge negative delta clamps to the floor)
155
- return applyResize(start, {
156
- dx: b.wMin - size.w,
157
- dy: b.hMin - size.h
158
- }, policy);
159
- case "End":
160
- // jump to the max corner; an unbounded axis simply doesn't move
161
- return applyResize(start, {
162
- dx: Number.isFinite(b.wMax) ? b.wMax - size.w : 0,
163
- dy: Number.isFinite(b.hMax) ? b.hMax - size.h : 0
164
- }, policy);
165
- default:
166
- return null;
167
- }
168
- };
169
-
170
- /**
171
- * The handle's `aria-valuenow`: the current size as a percent (0–100) of its
172
- * allowed range. The corner resizes both axes, but the value must be a single
173
- * number, so it reports the WIDTH axis — the one axis both the fixed-box and the
174
- * width-only cards share. Returns 0 when the range isn't finite (no max bound).
175
- */
176
- var measurePercent = exports.measurePercent = function measurePercent(size, policy, contentMin) {
177
- var _effectiveBounds2 = effectiveBounds(policy, contentMin),
178
- wMin = _effectiveBounds2.wMin,
179
- wMax = _effectiveBounds2.wMax;
180
- if (!Number.isFinite(wMax) || wMax <= wMin) return 0;
181
- return Math.round(clamp((size.w - wMin) / (wMax - wMin) * 100, 0, 100));
182
- };
183
- //# sourceMappingURL=resizePolicy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resizePolicy.js","names":["DEFAULT_KEYBOARD_STEP","exports","SHIFT_STEP_MULTIPLIER","RESIZE_KEYS","isResizeKey","key","includes","clamp","v","lo","hi","Math","min","Number","POSITIVE_INFINITY","max","snap","step","round","makeStart","size","contentMin","w","h","effectiveBounds","policy","_policy$minW","_policy$minH","_policy$maxW","_policy$maxH","wMin","minW","hMin","minH","wMax","maxW","hMax","maxH","applyResize","start","delta","opts","arguments","length","undefined","_effectiveBounds","proportional","constrain","sW","dx","sH","dy","scale","abs","scaleMin","scaleMax","snappedScale","keyboardResize","base","shiftKey","b","isFinite","measurePercent","_effectiveBounds2"],"sources":["../../../../src/presentation/stackedCard/resizePolicy.ts"],"sourcesContent":["/**\n * StackedCard resize policy — pure math (story-local, presentation-only).\n *\n * The card only reports deltas; the HOST applies a resize policy (note 52097\n * §7). This module is that policy, packaged as pure functions so the SAME code\n * path serves both the pointer drag and the keyboard resize (task 5/8). Nothing\n * here touches the DOM, React, or the content — it takes a start size, a delta,\n * and a policy, and returns a clamped size. The story wires events to it; the\n * card's intrinsic content minimum is measured story-side and passed in as\n * `contentMin`, so this module knows nothing about heroes or footers.\n *\n * The policy has four parts, all preserved from the concept:\n * - bounds — optional min/max per axis; unset means unbounded.\n * - proportional — lock the aspect ratio captured at the start of the gesture;\n * the scale is clamped by the BINDING axis so the ratio never\n * distorts at a bound.\n * - step — optional grid snap; proportion wins over the grid.\n * - content min — the effective min is max(policyMin, contentMin) per axis,\n * so the card can never be crushed below what its content needs.\n */\n\nexport interface Size {\n w: number;\n h: number;\n}\n\n/** The card's intrinsic minimum, measured from its real content. */\nexport interface ContentMin {\n w: number;\n h: number;\n}\n\nexport interface Policy {\n minW?: number;\n maxW?: number;\n minH?: number;\n maxH?: number;\n /** Lock the aspect ratio for the whole gesture. */\n proportional: boolean;\n /** Grid snap increment in px; omitted / 0 means continuous. */\n step?: number;\n}\n\n/** The size captured at the start of a gesture (pointer down or a key press). */\nexport interface ResizeStart {\n w: number;\n h: number;\n contentMin: ContentMin;\n}\n\nexport interface ResizeDelta {\n dx: number;\n dy: number;\n}\n\nexport interface EffectiveBounds {\n wMin: number;\n wMax: number;\n hMin: number;\n hMax: number;\n}\n\n/** Keyboard resize nudges by the policy step, or this when no step is set. */\nexport const DEFAULT_KEYBOARD_STEP = 8;\n\n/** Shift + arrow resizes by a larger increment (the familiar coarse nudge). */\nexport const SHIFT_STEP_MULTIPLIER = 4;\n\n/** Keys the separator handles; everything else falls through to the browser. */\nexport const RESIZE_KEYS: ReadonlyArray<string> = [\n \"ArrowLeft\",\n \"ArrowRight\",\n \"ArrowUp\",\n \"ArrowDown\",\n \"Home\",\n \"End\",\n];\n\nexport const isResizeKey = (key: string): boolean => RESIZE_KEYS.includes(key);\n\nexport const clamp = (v: number, lo: number, hi?: number): number =>\n Math.min(hi ?? Number.POSITIVE_INFINITY, Math.max(lo, v));\n\nexport const snap = (v: number, step?: number): number =>\n step && step > 0 ? Math.round(v / step) * step : v;\n\nexport const makeStart = (size: Size, contentMin: ContentMin): ResizeStart => ({\n w: size.w,\n h: size.h,\n contentMin,\n});\n\n/**\n * The effective bounds a size is clamped to: the policy min floored by the\n * content min, and the policy max (unbounded when unset). Independent of any\n * live gesture, so the story can also use it for the aria value and Home/End.\n */\nexport const effectiveBounds = (\n policy: Policy,\n contentMin: ContentMin\n): EffectiveBounds => ({\n wMin: Math.max(policy.minW ?? 0, contentMin.w),\n hMin: Math.max(policy.minH ?? 0, contentMin.h),\n wMax: policy.maxW ?? Number.POSITIVE_INFINITY,\n hMax: policy.maxH ?? Number.POSITIVE_INFINITY,\n});\n\n/**\n * Apply a delta to the start size under the policy — the single path for both\n * inputs. `constrain` is the transient Shift-to-constrain lock: a free-form\n * policy behaves proportionally for that one gesture; a proportional policy is\n * already locked and ignores it.\n */\nexport const applyResize = (\n start: ResizeStart,\n delta: ResizeDelta,\n policy: Policy,\n opts: { constrain?: boolean } = {}\n): Size => {\n const { wMin, hMin, wMax, hMax } = effectiveBounds(policy, start.contentMin);\n const proportional = policy.proportional || opts.constrain === true;\n\n let w: number;\n let h: number;\n\n if (proportional) {\n // one scale drives both axes; the corner's dominant direction wins, so a\n // vertical drag is as effective as a horizontal one\n const sW = (start.w + delta.dx) / start.w;\n const sH = (start.h + delta.dy) / start.h;\n let scale = Math.abs(sW - 1) >= Math.abs(sH - 1) ? sW : sH;\n\n // clamp the SCALE so both axes stay in bounds (binding constraint): the\n // ratio can never break at a bound — whichever edge is limiting stops both\n const scaleMin = Math.max(wMin / start.w, hMin / start.h);\n const scaleMax = Math.min(wMax / start.w, hMax / start.h);\n scale = clamp(scale, scaleMin, Math.max(scaleMin, scaleMax));\n\n // step: proportion wins. Snap via the scale (driven off the width edge) and\n // re-clamp, so ratio and bounds always hold; the grid yields when honoring\n // it would cost the ratio\n if (policy.step) {\n const snappedScale = snap(start.w * scale, policy.step) / start.w;\n scale = clamp(snappedScale, scaleMin, Math.max(scaleMin, scaleMax));\n }\n\n w = start.w * scale;\n h = start.h * scale;\n } else {\n w = clamp(snap(start.w + delta.dx, policy.step), wMin, wMax);\n h = clamp(snap(start.h + delta.dy, policy.step), hMin, hMax);\n }\n\n return { w: Math.round(w), h: Math.round(h) };\n};\n\n/**\n * Translate a resize key into the next size, reusing `applyResize` so the\n * keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);\n * Home/End jump to the min/max of the allowed range. Returns null for any key\n * the handle does not own.\n */\nexport const keyboardResize = (\n key: string,\n size: Size,\n policy: Policy,\n contentMin: ContentMin,\n opts: { shiftKey?: boolean } = {}\n): Size | null => {\n const base =\n policy.step && policy.step > 0 ? policy.step : DEFAULT_KEYBOARD_STEP;\n const step = base * (opts.shiftKey ? SHIFT_STEP_MULTIPLIER : 1);\n const start = makeStart(size, contentMin);\n const b = effectiveBounds(policy, contentMin);\n\n switch (key) {\n case \"ArrowRight\":\n return applyResize(start, { dx: step, dy: 0 }, policy);\n case \"ArrowLeft\":\n return applyResize(start, { dx: -step, dy: 0 }, policy);\n case \"ArrowDown\":\n return applyResize(start, { dx: 0, dy: step }, policy);\n case \"ArrowUp\":\n return applyResize(start, { dx: 0, dy: -step }, policy);\n case \"Home\":\n // jump to the min corner (a huge negative delta clamps to the floor)\n return applyResize(\n start,\n { dx: b.wMin - size.w, dy: b.hMin - size.h },\n policy\n );\n case \"End\":\n // jump to the max corner; an unbounded axis simply doesn't move\n return applyResize(\n start,\n {\n dx: Number.isFinite(b.wMax) ? b.wMax - size.w : 0,\n dy: Number.isFinite(b.hMax) ? b.hMax - size.h : 0,\n },\n policy\n );\n default:\n return null;\n }\n};\n\n/**\n * The handle's `aria-valuenow`: the current size as a percent (0–100) of its\n * allowed range. The corner resizes both axes, but the value must be a single\n * number, so it reports the WIDTH axis — the one axis both the fixed-box and the\n * width-only cards share. Returns 0 when the range isn't finite (no max bound).\n */\nexport const measurePercent = (\n size: Size,\n policy: Policy,\n contentMin: ContentMin\n): number => {\n const { wMin, wMax } = effectiveBounds(policy, contentMin);\n if (!Number.isFinite(wMax) || wMax <= wMin) return 0;\n return Math.round(clamp(((size.w - wMin) / (wMax - wMin)) * 100, 0, 100));\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAiBA;;AAmBA;AACO,IAAMA,qBAAqB,GAAAC,OAAA,CAA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U,CAAC;IAAlDS,IAAI,GAAAiC,iBAAA,CAAJjC,IAAI;IAAEI,IAAI,GAAA6B,iBAAA,CAAJ7B,IAAI;EAClB,IAAI,CAACrB,MAAM,CAACgD,QAAQ,CAAC3B,IAAI,CAAC,IAAIA,IAAI,IAAIJ,IAAI,EAAE,OAAO,CAAC;EACpD,OAAOnB,IAAI,CAACO,KAAK,CAACX,KAAK,CAAE,CAACa,IAAI,CAACE,CAAC,GAAGQ,IAAI,KAAKI,IAAI,GAAGJ,IAAI,CAAC,GAAI,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3E,CAAC","ignoreList":[]}
@@ -1,97 +0,0 @@
1
- /**
2
- * StackedCard resize policy — pure math (story-local, presentation-only).
3
- *
4
- * The card only reports deltas; the HOST applies a resize policy (note 52097
5
- * §7). This module is that policy, packaged as pure functions so the SAME code
6
- * path serves both the pointer drag and the keyboard resize (task 5/8). Nothing
7
- * here touches the DOM, React, or the content — it takes a start size, a delta,
8
- * and a policy, and returns a clamped size. The story wires events to it; the
9
- * card's intrinsic content minimum is measured story-side and passed in as
10
- * `contentMin`, so this module knows nothing about heroes or footers.
11
- *
12
- * The policy has four parts, all preserved from the concept:
13
- * - bounds — optional min/max per axis; unset means unbounded.
14
- * - proportional — lock the aspect ratio captured at the start of the gesture;
15
- * the scale is clamped by the BINDING axis so the ratio never
16
- * distorts at a bound.
17
- * - step — optional grid snap; proportion wins over the grid.
18
- * - content min — the effective min is max(policyMin, contentMin) per axis,
19
- * so the card can never be crushed below what its content needs.
20
- */
21
- export interface Size {
22
- w: number;
23
- h: number;
24
- }
25
- /** The card's intrinsic minimum, measured from its real content. */
26
- export interface ContentMin {
27
- w: number;
28
- h: number;
29
- }
30
- export interface Policy {
31
- minW?: number;
32
- maxW?: number;
33
- minH?: number;
34
- maxH?: number;
35
- /** Lock the aspect ratio for the whole gesture. */
36
- proportional: boolean;
37
- /** Grid snap increment in px; omitted / 0 means continuous. */
38
- step?: number;
39
- }
40
- /** The size captured at the start of a gesture (pointer down or a key press). */
41
- export interface ResizeStart {
42
- w: number;
43
- h: number;
44
- contentMin: ContentMin;
45
- }
46
- export interface ResizeDelta {
47
- dx: number;
48
- dy: number;
49
- }
50
- export interface EffectiveBounds {
51
- wMin: number;
52
- wMax: number;
53
- hMin: number;
54
- hMax: number;
55
- }
56
- /** Keyboard resize nudges by the policy step, or this when no step is set. */
57
- export declare const DEFAULT_KEYBOARD_STEP = 8;
58
- /** Shift + arrow resizes by a larger increment (the familiar coarse nudge). */
59
- export declare const SHIFT_STEP_MULTIPLIER = 4;
60
- /** Keys the separator handles; everything else falls through to the browser. */
61
- export declare const RESIZE_KEYS: ReadonlyArray<string>;
62
- export declare const isResizeKey: (key: string) => boolean;
63
- export declare const clamp: (v: number, lo: number, hi?: number) => number;
64
- export declare const snap: (v: number, step?: number) => number;
65
- export declare const makeStart: (size: Size, contentMin: ContentMin) => ResizeStart;
66
- /**
67
- * The effective bounds a size is clamped to: the policy min floored by the
68
- * content min, and the policy max (unbounded when unset). Independent of any
69
- * live gesture, so the story can also use it for the aria value and Home/End.
70
- */
71
- export declare const effectiveBounds: (policy: Policy, contentMin: ContentMin) => EffectiveBounds;
72
- /**
73
- * Apply a delta to the start size under the policy — the single path for both
74
- * inputs. `constrain` is the transient Shift-to-constrain lock: a free-form
75
- * policy behaves proportionally for that one gesture; a proportional policy is
76
- * already locked and ignores it.
77
- */
78
- export declare const applyResize: (start: ResizeStart, delta: ResizeDelta, policy: Policy, opts?: {
79
- constrain?: boolean;
80
- }) => Size;
81
- /**
82
- * Translate a resize key into the next size, reusing `applyResize` so the
83
- * keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);
84
- * Home/End jump to the min/max of the allowed range. Returns null for any key
85
- * the handle does not own.
86
- */
87
- export declare const keyboardResize: (key: string, size: Size, policy: Policy, contentMin: ContentMin, opts?: {
88
- shiftKey?: boolean;
89
- }) => Size | null;
90
- /**
91
- * The handle's `aria-valuenow`: the current size as a percent (0–100) of its
92
- * allowed range. The corner resizes both axes, but the value must be a single
93
- * number, so it reports the WIDTH axis — the one axis both the fixed-box and the
94
- * width-only cards share. Returns 0 when the range isn't finite (no max bound).
95
- */
96
- export declare const measurePercent: (size: Size, policy: Policy, contentMin: ContentMin) => number;
97
- //# sourceMappingURL=resizePolicy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resizePolicy.d.ts","sourceRoot":"","sources":["../../../../src/presentation/stackedCard/resizePolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,IAAI;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oEAAoE;AACpE,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,gFAAgF;AAChF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,MAAM,CAO7C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,OAAoC,CAAC;AAE/E,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE,IAAI,MAAM,EAAE,KAAK,MAAM,KAAG,MACA,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,EAAE,OAAO,MAAM,KAAG,MACI,CAAC;AAErD,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,EAAE,YAAY,UAAU,KAAG,WAI7D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,YAAY,UAAU,KACrB,eAKD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,WAAW,EAClB,OAAO,WAAW,EAClB,QAAQ,MAAM,EACd,OAAM;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,KACjC,IAoCF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,MAAM,EACX,MAAM,IAAI,EACV,QAAQ,MAAM,EACd,YAAY,UAAU,EACtB,OAAM;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KAChC,IAAI,GAAG,IAoCT,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,IAAI,EACV,QAAQ,MAAM,EACd,YAAY,UAAU,KACrB,MAIF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resizePolicy.js","names":["DEFAULT_KEYBOARD_STEP","SHIFT_STEP_MULTIPLIER","RESIZE_KEYS","isResizeKey","key","includes","clamp","v","lo","hi","Math","min","Number","POSITIVE_INFINITY","max","snap","step","round","makeStart","size","contentMin","w","h","effectiveBounds","policy","_policy$minW","_policy$minH","_policy$maxW","_policy$maxH","wMin","minW","hMin","minH","wMax","maxW","hMax","maxH","applyResize","start","delta","opts","_effectiveBounds","proportional","constrain","sW","dx","sH","dy","scale","abs","scaleMin","scaleMax","snappedScale","keyboardResize","base","shiftKey","b","isFinite","measurePercent","_effectiveBounds2"],"sources":["../../../../src/presentation/stackedCard/resizePolicy.ts"],"sourcesContent":["/**\n * StackedCard resize policy — pure math (story-local, presentation-only).\n *\n * The card only reports deltas; the HOST applies a resize policy (note 52097\n * §7). This module is that policy, packaged as pure functions so the SAME code\n * path serves both the pointer drag and the keyboard resize (task 5/8). Nothing\n * here touches the DOM, React, or the content — it takes a start size, a delta,\n * and a policy, and returns a clamped size. The story wires events to it; the\n * card's intrinsic content minimum is measured story-side and passed in as\n * `contentMin`, so this module knows nothing about heroes or footers.\n *\n * The policy has four parts, all preserved from the concept:\n * - bounds — optional min/max per axis; unset means unbounded.\n * - proportional — lock the aspect ratio captured at the start of the gesture;\n * the scale is clamped by the BINDING axis so the ratio never\n * distorts at a bound.\n * - step — optional grid snap; proportion wins over the grid.\n * - content min — the effective min is max(policyMin, contentMin) per axis,\n * so the card can never be crushed below what its content needs.\n */\n\nexport interface Size {\n w: number;\n h: number;\n}\n\n/** The card's intrinsic minimum, measured from its real content. */\nexport interface ContentMin {\n w: number;\n h: number;\n}\n\nexport interface Policy {\n minW?: number;\n maxW?: number;\n minH?: number;\n maxH?: number;\n /** Lock the aspect ratio for the whole gesture. */\n proportional: boolean;\n /** Grid snap increment in px; omitted / 0 means continuous. */\n step?: number;\n}\n\n/** The size captured at the start of a gesture (pointer down or a key press). */\nexport interface ResizeStart {\n w: number;\n h: number;\n contentMin: ContentMin;\n}\n\nexport interface ResizeDelta {\n dx: number;\n dy: number;\n}\n\nexport interface EffectiveBounds {\n wMin: number;\n wMax: number;\n hMin: number;\n hMax: number;\n}\n\n/** Keyboard resize nudges by the policy step, or this when no step is set. */\nexport const DEFAULT_KEYBOARD_STEP = 8;\n\n/** Shift + arrow resizes by a larger increment (the familiar coarse nudge). */\nexport const SHIFT_STEP_MULTIPLIER = 4;\n\n/** Keys the separator handles; everything else falls through to the browser. */\nexport const RESIZE_KEYS: ReadonlyArray<string> = [\n \"ArrowLeft\",\n \"ArrowRight\",\n \"ArrowUp\",\n \"ArrowDown\",\n \"Home\",\n \"End\",\n];\n\nexport const isResizeKey = (key: string): boolean => RESIZE_KEYS.includes(key);\n\nexport const clamp = (v: number, lo: number, hi?: number): number =>\n Math.min(hi ?? Number.POSITIVE_INFINITY, Math.max(lo, v));\n\nexport const snap = (v: number, step?: number): number =>\n step && step > 0 ? Math.round(v / step) * step : v;\n\nexport const makeStart = (size: Size, contentMin: ContentMin): ResizeStart => ({\n w: size.w,\n h: size.h,\n contentMin,\n});\n\n/**\n * The effective bounds a size is clamped to: the policy min floored by the\n * content min, and the policy max (unbounded when unset). Independent of any\n * live gesture, so the story can also use it for the aria value and Home/End.\n */\nexport const effectiveBounds = (\n policy: Policy,\n contentMin: ContentMin\n): EffectiveBounds => ({\n wMin: Math.max(policy.minW ?? 0, contentMin.w),\n hMin: Math.max(policy.minH ?? 0, contentMin.h),\n wMax: policy.maxW ?? Number.POSITIVE_INFINITY,\n hMax: policy.maxH ?? Number.POSITIVE_INFINITY,\n});\n\n/**\n * Apply a delta to the start size under the policy — the single path for both\n * inputs. `constrain` is the transient Shift-to-constrain lock: a free-form\n * policy behaves proportionally for that one gesture; a proportional policy is\n * already locked and ignores it.\n */\nexport const applyResize = (\n start: ResizeStart,\n delta: ResizeDelta,\n policy: Policy,\n opts: { constrain?: boolean } = {}\n): Size => {\n const { wMin, hMin, wMax, hMax } = effectiveBounds(policy, start.contentMin);\n const proportional = policy.proportional || opts.constrain === true;\n\n let w: number;\n let h: number;\n\n if (proportional) {\n // one scale drives both axes; the corner's dominant direction wins, so a\n // vertical drag is as effective as a horizontal one\n const sW = (start.w + delta.dx) / start.w;\n const sH = (start.h + delta.dy) / start.h;\n let scale = Math.abs(sW - 1) >= Math.abs(sH - 1) ? sW : sH;\n\n // clamp the SCALE so both axes stay in bounds (binding constraint): the\n // ratio can never break at a bound — whichever edge is limiting stops both\n const scaleMin = Math.max(wMin / start.w, hMin / start.h);\n const scaleMax = Math.min(wMax / start.w, hMax / start.h);\n scale = clamp(scale, scaleMin, Math.max(scaleMin, scaleMax));\n\n // step: proportion wins. Snap via the scale (driven off the width edge) and\n // re-clamp, so ratio and bounds always hold; the grid yields when honoring\n // it would cost the ratio\n if (policy.step) {\n const snappedScale = snap(start.w * scale, policy.step) / start.w;\n scale = clamp(snappedScale, scaleMin, Math.max(scaleMin, scaleMax));\n }\n\n w = start.w * scale;\n h = start.h * scale;\n } else {\n w = clamp(snap(start.w + delta.dx, policy.step), wMin, wMax);\n h = clamp(snap(start.h + delta.dy, policy.step), hMin, hMax);\n }\n\n return { w: Math.round(w), h: Math.round(h) };\n};\n\n/**\n * Translate a resize key into the next size, reusing `applyResize` so the\n * keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);\n * Home/End jump to the min/max of the allowed range. Returns null for any key\n * the handle does not own.\n */\nexport const keyboardResize = (\n key: string,\n size: Size,\n policy: Policy,\n contentMin: ContentMin,\n opts: { shiftKey?: boolean } = {}\n): Size | null => {\n const base =\n policy.step && policy.step > 0 ? policy.step : DEFAULT_KEYBOARD_STEP;\n const step = base * (opts.shiftKey ? SHIFT_STEP_MULTIPLIER : 1);\n const start = makeStart(size, contentMin);\n const b = effectiveBounds(policy, contentMin);\n\n switch (key) {\n case \"ArrowRight\":\n return applyResize(start, { dx: step, dy: 0 }, policy);\n case \"ArrowLeft\":\n return applyResize(start, { dx: -step, dy: 0 }, policy);\n case \"ArrowDown\":\n return applyResize(start, { dx: 0, dy: step }, policy);\n case \"ArrowUp\":\n return applyResize(start, { dx: 0, dy: -step }, policy);\n case \"Home\":\n // jump to the min corner (a huge negative delta clamps to the floor)\n return applyResize(\n start,\n { dx: b.wMin - size.w, dy: b.hMin - size.h },\n policy\n );\n case \"End\":\n // jump to the max corner; an unbounded axis simply doesn't move\n return applyResize(\n start,\n {\n dx: Number.isFinite(b.wMax) ? b.wMax - size.w : 0,\n dy: Number.isFinite(b.hMax) ? b.hMax - size.h : 0,\n },\n policy\n );\n default:\n return null;\n }\n};\n\n/**\n * The handle's `aria-valuenow`: the current size as a percent (0–100) of its\n * allowed range. The corner resizes both axes, but the value must be a single\n * number, so it reports the WIDTH axis — the one axis both the fixed-box and the\n * width-only cards share. Returns 0 when the range isn't finite (no max bound).\n */\nexport const measurePercent = (\n size: Size,\n policy: Policy,\n contentMin: ContentMin\n): number => {\n const { wMin, wMax } = effectiveBounds(policy, contentMin);\n if (!Number.isFinite(wMax) || wMax <= wMin) return 0;\n return Math.round(clamp(((size.w - wMin) / (wMax - wMin)) * 100, 0, 100));\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;;AAiBA;;AAmBA;AACA,OAAO,MAAMA,qBAAqB,GAAG,CAAC;;AAEtC;AACA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;;AAEtC;AACA,OAAO,MAAMC,WAAkC,GAAG,CAChD,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,MAAM,EACN,KAAK,CACN;AAED,OAAO,MAAMC,WAAW,GAAIC,GAAW,IAAcF,WAAW,CAACG,QAAQ,CAACD,GAAG,CAAC;AAE9E,OAAO,MAAME,KAAK,GAAGA,CAACC,CAAS,EAAEC,EAAU,EAAEC,EAAW,KACtDC,IAAI,CAACC,GAAG,CAACF,EAAE,WAAFA,EAAE,GAAIG,MAAM,CAACC,iBAAiB,EAAEH,IAAI,CAACI,GAAG,CAACN,EAAE,EAAED,CAAC,CAAC,CAAC;AAE3D,OAAO,MAAMQ,IAAI,GAAGA,CAACR,CAAS,EAAES,IAAa,KAC3CA,IAAI,IAAIA,IAAI,GAAG,CAAC,GAAGN,IAAI,CAACO,KAAK,CAACV,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