@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.
- package/dist/cjs/components/Icons/collection/ConnectionIcon.js +9 -17
- package/dist/cjs/components/Icons/collection/ConnectionIcon.js.map +1 -1
- package/dist/cjs/components/Icons/collection/ShapesIcon.js +61 -0
- package/dist/cjs/components/Icons/collection/ShapesIcon.js.map +1 -0
- package/dist/cjs/components/Icons/collection/index.js +7 -0
- package/dist/cjs/components/Icons/collection/index.js.map +1 -1
- package/dist/cjs/components/StackedCard/StackedCard.js +103 -19
- package/dist/cjs/components/StackedCard/StackedCard.js.map +1 -1
- package/dist/cjs/components/StackedCard/Styles.js +23 -18
- package/dist/cjs/components/StackedCard/Styles.js.map +1 -1
- package/dist/cjs/components/StackedCard/index.js +22 -0
- package/dist/cjs/components/StackedCard/index.js.map +1 -1
- package/dist/cjs/components/StackedCard/resizePolicy.js +238 -0
- package/dist/cjs/components/StackedCard/resizePolicy.js.map +1 -0
- package/dist/cjs/components/StackedCard/resizePolicy.test.js +474 -0
- package/dist/cjs/components/StackedCard/resizePolicy.test.js.map +1 -0
- package/dist/cjs/components/StackedCard/useStackedCardResize.js +145 -0
- package/dist/cjs/components/StackedCard/useStackedCardResize.js.map +1 -0
- package/dist/cjs/presentation/stackedCard/content/LinkCard.js +35 -22
- package/dist/cjs/presentation/stackedCard/content/LinkCard.js.map +1 -1
- package/dist/esm/components/Icons/collection/ConnectionIcon.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/ConnectionIcon.js +9 -17
- package/dist/esm/components/Icons/collection/ConnectionIcon.js.map +1 -1
- package/dist/esm/components/Icons/collection/ShapesIcon.d.ts +32 -0
- package/dist/esm/components/Icons/collection/ShapesIcon.d.ts.map +1 -0
- package/dist/esm/components/Icons/collection/ShapesIcon.js +54 -0
- package/dist/esm/components/Icons/collection/ShapesIcon.js.map +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts +1 -0
- package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
- package/dist/esm/components/Icons/collection/index.js +1 -0
- package/dist/esm/components/Icons/collection/index.js.map +1 -1
- package/dist/esm/components/StackedCard/StackedCard.d.ts +44 -3
- package/dist/esm/components/StackedCard/StackedCard.d.ts.map +1 -1
- package/dist/esm/components/StackedCard/StackedCard.js +102 -19
- package/dist/esm/components/StackedCard/StackedCard.js.map +1 -1
- package/dist/esm/components/StackedCard/Styles.d.ts +4 -1
- package/dist/esm/components/StackedCard/Styles.d.ts.map +1 -1
- package/dist/esm/components/StackedCard/Styles.js +23 -18
- package/dist/esm/components/StackedCard/Styles.js.map +1 -1
- package/dist/esm/components/StackedCard/index.d.ts +2 -0
- package/dist/esm/components/StackedCard/index.d.ts.map +1 -1
- package/dist/esm/components/StackedCard/index.js +2 -0
- package/dist/esm/components/StackedCard/index.js.map +1 -1
- package/dist/esm/components/StackedCard/resizePolicy.d.ts +111 -0
- package/dist/esm/components/StackedCard/resizePolicy.d.ts.map +1 -0
- package/dist/esm/{presentation/stackedCard → components/StackedCard}/resizePolicy.js +93 -48
- package/dist/esm/components/StackedCard/resizePolicy.js.map +1 -0
- package/dist/esm/components/StackedCard/resizePolicy.test.d.ts +2 -0
- package/dist/esm/components/StackedCard/resizePolicy.test.d.ts.map +1 -0
- package/dist/esm/components/StackedCard/resizePolicy.test.js +470 -0
- package/dist/esm/components/StackedCard/resizePolicy.test.js.map +1 -0
- package/dist/esm/components/StackedCard/useStackedCardResize.d.ts +62 -0
- package/dist/esm/components/StackedCard/useStackedCardResize.d.ts.map +1 -0
- package/dist/esm/components/StackedCard/useStackedCardResize.js +137 -0
- package/dist/esm/components/StackedCard/useStackedCardResize.js.map +1 -0
- package/dist/esm/presentation/stackedCard/content/LinkCard.d.ts.map +1 -1
- package/dist/esm/presentation/stackedCard/content/LinkCard.js +35 -20
- package/dist/esm/presentation/stackedCard/content/LinkCard.js.map +1 -1
- package/dist/index.js +989 -482
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/presentation/stackedCard/resizePolicy.js +0 -183
- package/dist/cjs/presentation/stackedCard/resizePolicy.js.map +0 -1
- package/dist/esm/presentation/stackedCard/resizePolicy.d.ts +0 -97
- package/dist/esm/presentation/stackedCard/resizePolicy.d.ts.map +0 -1
- package/dist/esm/presentation/stackedCard/resizePolicy.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","STACKED_CARD_CONTROL_CLASS","STACKED_CARD_FIXED_ATTR","STACKED_CARD_RADIUS","STACKED_CARD_ROLE_PADDING","STACKED_CARD_WIDTH","BoxSizingStyle","SELECTION_RING","SCRIM","SCRIM_STRONG","SCRIM_FG","CONTROL","revealControls","StyledStackedCardStack","div","withConfig","displayName","componentId","StyledStackedCardRow","_ref","$direction","_ref2","_ref3","_ref4","$role","$bleed","_ref5","$background","_ref6","StyledStackedCardCoverMedia","_ref7","$aspectRatio","StyledStackedCardCoverFill","StyledStackedCardCoverCenter","StyledStackedCardCoverTopRight","StyledStackedCardCollapsedStrip","button","StyledStackedCardStripExpand","span","StyledStackedCardPlayBadge","StyledStackedCardCoverButton","StyledStackedCardResizeHandle","hoverStyle","StyledStackedCard","_ref8","$forceHover","_ref9","$priorityColor","_ref0","$selected","_ref1","$disabled","_ref10","$pending","_ref11","$isDragSource","_ref12","$isDragPreview","_ref13","$entered"],"sources":["../../../../src/components/StackedCard/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport {\n STACKED_CARD_CONTROL_CLASS,\n STACKED_CARD_FIXED_ATTR,\n STACKED_CARD_RADIUS,\n STACKED_CARD_ROLE_PADDING,\n STACKED_CARD_WIDTH,\n StackedCardRowDirection,\n StackedCardRowRole,\n} from \"./constants\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\n\n/**\n * Theming hooks.\n *\n * Every colour a StackedCard part needs is read through a `--sc-*` custom\n * property with a built-in fallback, so the component looks right standing on\n * its own and a host surface can still retint it by declaring the variable on\n * any ancestor. No rgba/hex is baked into a rule; data colours (a swatch value,\n * a priority colour) are always passed in by the caller.\n */\nconst SELECTION_RING = \"var(--sc-selection-ring, var(--color-primary-500))\";\nconst SCRIM = \"var(--sc-scrim, rgba(0, 0, 0, 0.55))\";\nconst SCRIM_STRONG = \"var(--sc-scrim-strong, rgba(0, 0, 0, 0.72))\";\nconst SCRIM_FG = \"var(--sc-scrim-fg, #ffffff)\";\n\n/** Selector for anything carrying the control class. */\nconst CONTROL = `.${STACKED_CARD_CONTROL_CLASS}`;\n\n/**\n * The one reveal rule the whole subsystem shares: controls are hidden until the\n * card (or the cover) is hovered OR holds focus. The focus path is what keeps\n * them reachable by keyboard instead of mouse-only.\n */\nconst revealControls = css`\n ${CONTROL} {\n opacity: 0;\n transition: opacity 120ms ease;\n }\n\n &:hover ${CONTROL}, &:focus-within ${CONTROL} {\n opacity: 1;\n }\n`;\n\n/* ------------------------------------------------------------------ */\n/* Stack — the vertical column. A card is a Stack of rows. */\n/* ------------------------------------------------------------------ */\n\nexport const StyledStackedCardStack = styled.div`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: column;\n`;\nStyledStackedCardStack.displayName = \"StyledStackedCardStack\";\n\n/* ------------------------------------------------------------------ */\n/* Row — the only layout primitive, differentiated by `role`. */\n/* ------------------------------------------------------------------ */\n\ninterface IStyledRowProps {\n $role: StackedCardRowRole;\n $bleed?: boolean;\n $direction: StackedCardRowDirection;\n $background?: string;\n}\n\nexport const StyledStackedCardRow = styled.div<IStyledRowProps>`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n align-items: ${({ $direction }) =>\n $direction === \"column\" ? \"stretch\" : \"center\"};\n gap: ${({ $direction }) => ($direction === \"column\" ? \"4px\" : \"8px\")};\n\n /* bleed overrides any role and runs the row edge to edge. */\n padding: ${({ $role, $bleed }) =>\n $bleed ? \"0\" : STACKED_CARD_ROLE_PADDING[$role]};\n\n ${({ $background }) =>\n $background &&\n css`\n background: ${$background};\n `}\n\n /* Distribution (row direction only): fixed-width children keep their width,\n the rest share what remains evenly; drop an empty spacer to push items. */\n ${({ $direction }) =>\n $direction === \"row\" &&\n css`\n > * {\n flex: 1 1 0;\n min-width: 0;\n }\n\n > [${STACKED_CARD_FIXED_ATTR}] {\n flex: 0 0 auto;\n }\n `}\n`;\nStyledStackedCardRow.displayName = \"StyledStackedCardRow\";\n\n/* ------------------------------------------------------------------ */\n/* Cover — a bleed row that holds media. */\n/* ------------------------------------------------------------------ */\n\n/**\n * The media box reserves its height with `aspect-ratio` so the image (or the\n * skeleton standing in for it) never reflows the card when it arrives.\n */\nexport const StyledStackedCardCoverMedia = styled.div<{ $aspectRatio: string }>`\n position: relative;\n width: 100%;\n aspect-ratio: ${({ $aspectRatio }) => $aspectRatio};\n overflow: hidden;\n\n ${revealControls}\n`;\nStyledStackedCardCoverMedia.displayName = \"StyledStackedCardCoverMedia\";\n\n/* The fill (an <img>, an inline <svg> wrapper, or a solid-colour box) is laid\n over the reserved box and made to cover it. */\nexport const StyledStackedCardCoverFill = styled.div`\n position: absolute;\n inset: 0;\n\n > * {\n width: 100%;\n height: 100%;\n }\n\n > img {\n display: block;\n object-fit: cover;\n }\n`;\nStyledStackedCardCoverFill.displayName = \"StyledStackedCardCoverFill\";\n\nexport const StyledStackedCardCoverCenter = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nStyledStackedCardCoverCenter.displayName = \"StyledStackedCardCoverCenter\";\n\nexport const StyledStackedCardCoverTopRight = styled.div`\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n gap: 6px;\n`;\nStyledStackedCardCoverTopRight.displayName = \"StyledStackedCardCoverTopRight\";\n\n/**\n * Collapsed cover — the media box gives way to a thin strip. The strip IS the\n * expand affordance: the whole bar is a button and a chevron hint is revealed\n * on hover or focus. It reserves no height of its own; the caller's\n * `collapsedStrip` (an ~8px colour bar, a favicon + domain row) sets how tall\n * it reads.\n */\nexport const StyledStackedCardCollapsedStrip = styled.button`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: 16px;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n text-align: left;\n\n ${CONTROL} {\n opacity: 0;\n transition: opacity 120ms ease;\n }\n\n &:hover ${CONTROL}, &:focus-visible ${CONTROL} {\n opacity: 1;\n }\n\n &:focus-visible {\n outline: 2px solid ${SELECTION_RING};\n outline-offset: -2px;\n }\n`;\nStyledStackedCardCollapsedStrip.displayName = \"StyledStackedCardCollapsedStrip\";\n\n/* The expand chevron sits at the right, vertically centred, so it reads the\n same whether the strip is a hairline colour bar or a taller favicon row. */\nexport const StyledStackedCardStripExpand = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n display: inline-flex;\n width: 16px;\n height: 16px;\n color: var(--color-theme-600);\n\n svg {\n width: 14px;\n height: 14px;\n }\n`;\nStyledStackedCardStripExpand.displayName = \"StyledStackedCardStripExpand\";\n\n/* ------------------------------------------------------------------ */\n/* Cover chrome — scrim-backed controls that sit over media */\n/* ------------------------------------------------------------------ */\n\n/** Centered media control (a play button). The caller drops the glyph inside. */\nexport const StyledStackedCardPlayBadge = styled.span`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 12px;\n background: ${SCRIM};\n color: ${SCRIM_FG};\n\n svg {\n fill: currentColor;\n width: 20px;\n height: 20px;\n margin-left: 2px;\n }\n`;\nStyledStackedCardPlayBadge.displayName = \"StyledStackedCardPlayBadge\";\n\n/** Top-right cover-management button (collapse, remove …). */\nexport const StyledStackedCardCoverButton = styled.button`\n ${BoxSizingStyle}\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n cursor: pointer;\n color: ${SCRIM_FG};\n background: ${SCRIM};\n\n svg {\n width: 16px;\n height: 16px;\n display: block;\n }\n\n &:hover {\n background: ${SCRIM_STRONG};\n }\n`;\nStyledStackedCardCoverButton.displayName = \"StyledStackedCardCoverButton\";\n\n/* ------------------------------------------------------------------ */\n/* Resize (opt-in): handle on hover, the card only reports deltas */\n/* ------------------------------------------------------------------ */\n\nexport const StyledStackedCardResizeHandle = styled.span`\n position: absolute;\n right: 2px;\n bottom: 2px;\n width: 14px;\n height: 14px;\n cursor: nwse-resize;\n color: var(--color-theme-600);\n z-index: 2;\n\n svg {\n display: block;\n }\n`;\nStyledStackedCardResizeHandle.displayName = \"StyledStackedCardResizeHandle\";\n\n/* ------------------------------------------------------------------ */\n/* The shell */\n/* ------------------------------------------------------------------ */\n\nexport interface IStyledStackedCardProps {\n $selected?: boolean;\n $disabled?: boolean;\n $pending?: boolean;\n $isDragSource?: boolean;\n $isDragPreview?: boolean;\n $entered?: boolean;\n $forceHover?: boolean;\n $priorityColor?: string;\n}\n\nconst hoverStyle = css`\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n border-color: var(--color-theme-500);\n`;\n\nexport const StyledStackedCard = styled.div<IStyledStackedCardProps>`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: column;\n width: ${STACKED_CARD_WIDTH}px;\n border-radius: ${STACKED_CARD_RADIUS}px;\n background-color: var(--page-paper-main);\n border: 1px solid var(--border-primary);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n overflow: hidden;\n transition: box-shadow 150ms ease, border-color 150ms ease;\n\n ${revealControls}\n\n &:hover {\n ${hoverStyle}\n }\n\n &:focus-visible {\n outline: none;\n ${hoverStyle}\n box-shadow: 0 0 0 2px ${SELECTION_RING};\n }\n\n /* Forced hover — for docs, snapshots and \"this is what hover looks like\"\n demos. The doubled ampersand gives it the specificity to beat the cover's\n own reveal rule. */\n ${({ $forceHover }) =>\n $forceHover &&\n css`\n ${hoverStyle}\n && ${CONTROL} {\n opacity: 1;\n }\n `}\n\n ${({ $priorityColor }) =>\n $priorityColor &&\n css`\n &::before {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 4px;\n background: ${$priorityColor};\n z-index: 2;\n }\n `}\n\n ${({ $selected }) =>\n $selected &&\n css`\n border-color: ${SELECTION_RING};\n box-shadow: 0 0 0 2px ${SELECTION_RING};\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n\n /* Pending / optimistic — created or moved, not yet confirmed by the server.\n Dimmed, non-interactive and NOT draggable, but distinct from disabled: a\n transient in-flight state, not a policy. */\n ${({ $pending }) =>\n $pending &&\n css`\n opacity: 0.6;\n pointer-events: none;\n cursor: progress;\n `}\n\n /* Drag SOURCE — full-size outline placeholder. Content is hidden but keeps\n its box (visibility, not display) so the card holds identical dimensions\n and the surrounding cards never move. */\n ${({ $isDragSource }) =>\n $isDragSource &&\n css`\n background: transparent;\n border: 1px dashed var(--color-theme-500);\n box-shadow: none;\n\n &:hover {\n box-shadow: none;\n border-color: var(--color-theme-500);\n }\n\n > * {\n visibility: hidden;\n }\n `}\n\n /* Drag PREVIEW — the 1:1 copy the host floats in its drag layer. Elevated\n shadow ONLY: no rotate, no scale, no translate. */\n ${({ $isDragPreview }) =>\n $isDragPreview &&\n css`\n box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);\n cursor: grabbing;\n `}\n\n /* Entered (focus model) — focus has moved inside, onto an inner control. */\n ${({ $entered }) =>\n $entered &&\n css`\n && {\n border-color: ${SELECTION_RING};\n box-shadow: inset 0 0 0 2px ${SELECTION_RING},\n 0 0 0 2px ${SELECTION_RING};\n }\n `}\n`;\nStyledStackedCard.displayName = \"StyledStackedCard\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SACEC,0BAA0B,EAC1BC,uBAAuB,EACvBC,mBAAmB,EACnBC,yBAAyB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A;EAAA,IAAGC,cAAc,GAAAD,KAAA,CAAdC,cAAc;EAAA,OACjBA,cAAc,IACd/C,GAAG,2GAQe+C,cAAc,CAG/B;AAAA,GAEDC,KAAA;EAAA,IAAGC,SAAS,GAAAD,KAAA,CAATC,SAAS;EAAA,OACZA,SAAS,IACTjD,GAAG,mDACeO,cAAc,EACNA,cAAc,CACvC;AAAA,GAED2C,KAAA;EAAA,IAAGC,SAAS,GAAAD,KAAA,CAATC,SAAS;EAAA,OACZA,SAAS,IACTnD,GAAG,sCAGF;AAAA,GAKDoD,MAAA;EAAA,IAAGC,QAAQ,GAAAD,MAAA,CAARC,QAAQ;EAAA,OACXA,QAAQ,IACRrD,GAAG,sDAIF;AAAA,GAKDsD,MAAA;EAAA,IAAGC,aAAa,GAAAD,MAAA,CAAbC,aAAa;EAAA,OAChBA,aAAa,IACbvD,GAAG,0KAaF;AAAA,GAIDwD,MAAA;EAAA,IAAGC,cAAc,GAAAD,MAAA,CAAdC,cAAc;EAAA,OACjBA,cAAc,IACdzD,GAAG,8DAGF;AAAA,GAGD0D,MAAA;EAAA,IAAGC,QAAQ,GAAAD,MAAA,CAARC,QAAQ;EAAA,OACXA,QAAQ,IACR3D,GAAG,4EAEiBO,cAAc,EACAA,cAAc,EAC9BA,cAAc,CAE/B;AAAA,EACJ;AACDoC,iBAAiB,CAAC3B,WAAW,GAAG,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","STACKED_CARD_CONTROL_CLASS","STACKED_CARD_FIXED_ATTR","STACKED_CARD_RADIUS","STACKED_CARD_ROLE_PADDING","STACKED_CARD_WIDTH","BoxSizingStyle","SELECTION_RING","SCRIM","SCRIM_STRONG","SCRIM_FG","CONTROL","revealControls","StyledStackedCardStack","div","withConfig","displayName","componentId","StyledStackedCardRow","_ref","$direction","_ref2","_ref3","_ref4","$role","$bleed","_ref5","$background","_ref6","StyledStackedCardCoverMedia","_ref7","$aspectRatio","StyledStackedCardCoverFill","StyledStackedCardCoverCenter","StyledStackedCardCoverTopRight","StyledStackedCardCollapsedStrip","button","StyledStackedCardStripExpand","span","StyledStackedCardPlayBadge","StyledStackedCardCoverButton","StyledStackedCardResizeHandle","_ref8","$axis","hoverStyle","StyledStackedCard","_ref9","$forceHover","_ref0","$priorityColor","_ref1","$selected","_ref10","$disabled","_ref11","$pending","_ref12","$isDragSource","_ref13","$isDragPreview","_ref14","$entered"],"sources":["../../../../src/components/StackedCard/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport {\n STACKED_CARD_CONTROL_CLASS,\n STACKED_CARD_FIXED_ATTR,\n STACKED_CARD_RADIUS,\n STACKED_CARD_ROLE_PADDING,\n STACKED_CARD_WIDTH,\n StackedCardRowDirection,\n StackedCardRowRole,\n} from \"./constants\";\nimport { StackedCardResizeAxis } from \"./resizePolicy\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\n\n/**\n * Theming hooks.\n *\n * Every colour a StackedCard part needs is read through a `--sc-*` custom\n * property with a built-in fallback, so the component looks right standing on\n * its own and a host surface can still retint it by declaring the variable on\n * any ancestor. No rgba/hex is baked into a rule; data colours (a swatch value,\n * a priority colour) are always passed in by the caller.\n */\nconst SELECTION_RING = \"var(--sc-selection-ring, var(--color-primary-500))\";\nconst SCRIM = \"var(--sc-scrim, rgba(0, 0, 0, 0.55))\";\nconst SCRIM_STRONG = \"var(--sc-scrim-strong, rgba(0, 0, 0, 0.72))\";\nconst SCRIM_FG = \"var(--sc-scrim-fg, #ffffff)\";\n\n/** Selector for anything carrying the control class. */\nconst CONTROL = `.${STACKED_CARD_CONTROL_CLASS}`;\n\n/**\n * The one reveal rule the whole subsystem shares: controls are hidden until the\n * card (or the cover) is hovered OR holds focus. The focus path is what keeps\n * them reachable by keyboard instead of mouse-only.\n */\nconst revealControls = css`\n ${CONTROL} {\n opacity: 0;\n transition: opacity 120ms ease;\n }\n\n &:hover ${CONTROL}, &:focus-within ${CONTROL} {\n opacity: 1;\n }\n`;\n\n/* ------------------------------------------------------------------ */\n/* Stack — the vertical column. A card is a Stack of rows. */\n/* ------------------------------------------------------------------ */\n\nexport const StyledStackedCardStack = styled.div`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: column;\n`;\nStyledStackedCardStack.displayName = \"StyledStackedCardStack\";\n\n/* ------------------------------------------------------------------ */\n/* Row — the only layout primitive, differentiated by `role`. */\n/* ------------------------------------------------------------------ */\n\ninterface IStyledRowProps {\n $role: StackedCardRowRole;\n $bleed?: boolean;\n $direction: StackedCardRowDirection;\n $background?: string;\n}\n\nexport const StyledStackedCardRow = styled.div<IStyledRowProps>`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n align-items: ${({ $direction }) =>\n $direction === \"column\" ? \"stretch\" : \"center\"};\n gap: ${({ $direction }) => ($direction === \"column\" ? \"4px\" : \"8px\")};\n\n /* bleed overrides any role and runs the row edge to edge. */\n padding: ${({ $role, $bleed }) =>\n $bleed ? \"0\" : STACKED_CARD_ROLE_PADDING[$role]};\n\n ${({ $background }) =>\n $background &&\n css`\n background: ${$background};\n `}\n\n /* Distribution (row direction only): fixed-width children keep their width,\n the rest share what remains evenly; drop an empty spacer to push items. */\n ${({ $direction }) =>\n $direction === \"row\" &&\n css`\n > * {\n flex: 1 1 0;\n min-width: 0;\n }\n\n > [${STACKED_CARD_FIXED_ATTR}] {\n flex: 0 0 auto;\n }\n `}\n`;\nStyledStackedCardRow.displayName = \"StyledStackedCardRow\";\n\n/* ------------------------------------------------------------------ */\n/* Cover — a bleed row that holds media. */\n/* ------------------------------------------------------------------ */\n\n/**\n * The media box reserves its height with `aspect-ratio` so the image (or the\n * skeleton standing in for it) never reflows the card when it arrives.\n */\nexport const StyledStackedCardCoverMedia = styled.div<{ $aspectRatio: string }>`\n position: relative;\n width: 100%;\n aspect-ratio: ${({ $aspectRatio }) => $aspectRatio};\n overflow: hidden;\n\n ${revealControls}\n`;\nStyledStackedCardCoverMedia.displayName = \"StyledStackedCardCoverMedia\";\n\n/* The fill (an <img>, an inline <svg> wrapper, or a solid-colour box) is laid\n over the reserved box and made to cover it. */\nexport const StyledStackedCardCoverFill = styled.div`\n position: absolute;\n inset: 0;\n\n > * {\n width: 100%;\n height: 100%;\n }\n\n > img {\n display: block;\n object-fit: cover;\n }\n\n /* Media must never be natively draggable. An <img> is a browser drag source\n by default, so grabbing the cover would start an image drag and swallow the\n mousemove/mouseup the HOST's drag depends on — the card would stay put and\n then jump on the next pointer move. The host owns dragging; the cover must\n not compete with it. */\n > img,\n > svg {\n -webkit-user-drag: none;\n user-select: none;\n pointer-events: none;\n }\n`;\nStyledStackedCardCoverFill.displayName = \"StyledStackedCardCoverFill\";\n\nexport const StyledStackedCardCoverCenter = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\nStyledStackedCardCoverCenter.displayName = \"StyledStackedCardCoverCenter\";\n\nexport const StyledStackedCardCoverTopRight = styled.div`\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n gap: 6px;\n`;\nStyledStackedCardCoverTopRight.displayName = \"StyledStackedCardCoverTopRight\";\n\n/**\n * Collapsed cover — the media box gives way to a thin strip. The strip IS the\n * expand affordance: the whole bar is a button and a chevron hint is revealed\n * on hover or focus. It reserves no height of its own; the caller's\n * `collapsedStrip` (an ~8px colour bar, a favicon + domain row) sets how tall\n * it reads.\n */\nexport const StyledStackedCardCollapsedStrip = styled.button`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: 16px;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n text-align: left;\n\n ${CONTROL} {\n opacity: 0;\n transition: opacity 120ms ease;\n }\n\n &:hover ${CONTROL}, &:focus-visible ${CONTROL} {\n opacity: 1;\n }\n\n &:focus-visible {\n outline: 2px solid ${SELECTION_RING};\n outline-offset: -2px;\n }\n`;\nStyledStackedCardCollapsedStrip.displayName = \"StyledStackedCardCollapsedStrip\";\n\n/* The expand chevron sits at the right, vertically centred, so it reads the\n same whether the strip is a hairline colour bar or a taller favicon row. */\nexport const StyledStackedCardStripExpand = styled.span`\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n display: inline-flex;\n width: 16px;\n height: 16px;\n color: var(--color-theme-600);\n\n svg {\n width: 14px;\n height: 14px;\n }\n`;\nStyledStackedCardStripExpand.displayName = \"StyledStackedCardStripExpand\";\n\n/* ------------------------------------------------------------------ */\n/* Cover chrome — scrim-backed controls that sit over media */\n/* ------------------------------------------------------------------ */\n\n/** Centered media control (a play button). The caller drops the glyph inside. */\nexport const StyledStackedCardPlayBadge = styled.span`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n border-radius: 12px;\n background: ${SCRIM};\n color: ${SCRIM_FG};\n\n svg {\n fill: currentColor;\n width: 20px;\n height: 20px;\n margin-left: 2px;\n }\n`;\nStyledStackedCardPlayBadge.displayName = \"StyledStackedCardPlayBadge\";\n\n/** Top-right cover-management button (collapse, remove …). */\nexport const StyledStackedCardCoverButton = styled.button`\n ${BoxSizingStyle}\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: 0;\n border-radius: 8px;\n cursor: pointer;\n color: ${SCRIM_FG};\n background: ${SCRIM};\n\n svg {\n width: 16px;\n height: 16px;\n display: block;\n }\n\n &:hover {\n background: ${SCRIM_STRONG};\n }\n`;\nStyledStackedCardCoverButton.displayName = \"StyledStackedCardCoverButton\";\n\n/* ------------------------------------------------------------------ */\n/* Resize (opt-in): handle on hover, the card only reports deltas */\n/* ------------------------------------------------------------------ */\n\n/* The grip is a focusable separator, so it needs a focus ring of its own — a\n keyboard user has no pointer to tell them where they are. */\nexport const StyledStackedCardResizeHandle = styled.span<{\n $axis: StackedCardResizeAxis;\n}>`\n position: absolute;\n right: 2px;\n bottom: 2px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n border-radius: 4px;\n cursor: ${({ $axis }) => ($axis === \"width\" ? \"ew-resize\" : \"nwse-resize\")};\n color: var(--color-theme-600);\n z-index: 2;\n\n &:hover {\n color: var(--color-theme-900);\n }\n\n &:focus-visible {\n outline: 2px solid ${SELECTION_RING};\n outline-offset: 1px;\n color: var(--color-theme-900);\n }\n\n svg {\n display: block;\n }\n`;\nStyledStackedCardResizeHandle.displayName = \"StyledStackedCardResizeHandle\";\n\n/* ------------------------------------------------------------------ */\n/* The shell */\n/* ------------------------------------------------------------------ */\n\nexport interface IStyledStackedCardProps {\n $selected?: boolean;\n $disabled?: boolean;\n $pending?: boolean;\n $isDragSource?: boolean;\n $isDragPreview?: boolean;\n $entered?: boolean;\n $forceHover?: boolean;\n $priorityColor?: string;\n}\n\nconst hoverStyle = css`\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);\n border-color: var(--color-theme-500);\n`;\n\nexport const StyledStackedCard = styled.div<IStyledStackedCardProps>`\n ${BoxSizingStyle}\n\n position: relative;\n display: flex;\n flex-direction: column;\n width: ${STACKED_CARD_WIDTH}px;\n border-radius: ${STACKED_CARD_RADIUS}px;\n background-color: var(--page-paper-main);\n border: 1px solid var(--border-primary);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n overflow: hidden;\n transition: box-shadow 150ms ease, border-color 150ms ease;\n\n ${revealControls}\n\n &:hover {\n ${hoverStyle}\n }\n\n &:focus-visible {\n outline: none;\n ${hoverStyle}\n box-shadow: 0 0 0 2px ${SELECTION_RING};\n }\n\n /* Forced hover — for docs, snapshots and \"this is what hover looks like\"\n demos. The doubled ampersand gives it the specificity to beat the cover's\n own reveal rule. */\n ${({ $forceHover }) =>\n $forceHover &&\n css`\n ${hoverStyle}\n && ${CONTROL} {\n opacity: 1;\n }\n `}\n\n ${({ $priorityColor }) =>\n $priorityColor &&\n css`\n &::before {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 4px;\n background: ${$priorityColor};\n z-index: 2;\n }\n `}\n\n /* Selection outranks hover: a selected card must keep its ring while the\n pointer is over it — which, right after the click that selected it, is\n always. The doubled ampersand buys the specificity to beat the hover rule\n above (same reason the entered state below does it). */\n ${({ $selected }) =>\n $selected &&\n css`\n && {\n border-color: ${SELECTION_RING};\n box-shadow: 0 0 0 2px ${SELECTION_RING};\n }\n `}\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n\n /* Pending / optimistic — created or moved, not yet confirmed by the server.\n Dimmed, non-interactive and NOT draggable, but distinct from disabled: a\n transient in-flight state, not a policy. */\n ${({ $pending }) =>\n $pending &&\n css`\n opacity: 0.6;\n pointer-events: none;\n cursor: progress;\n `}\n\n /* Drag SOURCE — full-size outline placeholder. Content is hidden but keeps\n its box (visibility, not display) so the card holds identical dimensions\n and the surrounding cards never move. */\n ${({ $isDragSource }) =>\n $isDragSource &&\n css`\n background: transparent;\n border: 1px dashed var(--color-theme-500);\n box-shadow: none;\n\n &:hover {\n box-shadow: none;\n border-color: var(--color-theme-500);\n }\n\n > * {\n visibility: hidden;\n }\n `}\n\n /* Drag PREVIEW — the 1:1 copy the host floats in its drag layer. Elevated\n shadow ONLY: no rotate, no scale, no translate. */\n ${({ $isDragPreview }) =>\n $isDragPreview &&\n css`\n box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);\n cursor: grabbing;\n `}\n\n /* Entered (focus model) — focus has moved inside, onto an inner control. */\n ${({ $entered }) =>\n $entered &&\n css`\n && {\n border-color: ${SELECTION_RING};\n box-shadow: inset 0 0 0 2px ${SELECTION_RING},\n 0 0 0 2px ${SELECTION_RING};\n }\n `}\n`;\nStyledStackedCard.displayName = \"StyledStackedCard\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SACEC,0BAA0B,EAC1BC,uBAAuB,EACvBC,mBAAmB,EACnBC,yBAAyB,EACzBC,kBAAkB,QAGb,aAA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EAAA,IAAGC,WAAW,GAAAD,KAAA,CAAXC,WAAW;EAAA,OACdA,WAAW,IACX/C,GAAG,+BACC4C,UAAU,EACPjC,OAAO,CAGb;AAAA,GAEDqC,KAAA;EAAA,IAAGC,cAAc,GAAAD,KAAA,CAAdC,cAAc;EAAA,OACjBA,cAAc,IACdjD,GAAG,2GAQeiD,cAAc,CAG/B;AAAA,GAMDC,KAAA;EAAA,IAAGC,SAAS,GAAAD,KAAA,CAATC,SAAS;EAAA,OACZA,SAAS,IACTnD,GAAG,uDAEiBO,cAAc,EACNA,cAAc,CAEzC;AAAA,GAED6C,MAAA;EAAA,IAAGC,SAAS,GAAAD,MAAA,CAATC,SAAS;EAAA,OACZA,SAAS,IACTrD,GAAG,sCAGF;AAAA,GAKDsD,MAAA;EAAA,IAAGC,QAAQ,GAAAD,MAAA,CAARC,QAAQ;EAAA,OACXA,QAAQ,IACRvD,GAAG,sDAIF;AAAA,GAKDwD,MAAA;EAAA,IAAGC,aAAa,GAAAD,MAAA,CAAbC,aAAa;EAAA,OAChBA,aAAa,IACbzD,GAAG,0KAaF;AAAA,GAID0D,MAAA;EAAA,IAAGC,cAAc,GAAAD,MAAA,CAAdC,cAAc;EAAA,OACjBA,cAAc,IACd3D,GAAG,8DAGF;AAAA,GAGD4D,MAAA;EAAA,IAAGC,QAAQ,GAAAD,MAAA,CAARC,QAAQ;EAAA,OACXA,QAAQ,IACR7D,GAAG,4EAEiBO,cAAc,EACAA,cAAc,EAC9BA,cAAc,CAE/B;AAAA,EACJ;AACDsC,iBAAiB,CAAC7B,WAAW,GAAG,mBAAmB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/StackedCard/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/StackedCard/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/StackedCard/index.ts"],"sourcesContent":["export * from \"./StackedCard\";\nexport * from \"./Primitives\";\nexport * from \"./Glyphs\";\nexport * from \"./constants\";\n"],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/StackedCard/index.ts"],"sourcesContent":["export * from \"./StackedCard\";\nexport * from \"./Primitives\";\nexport * from \"./Glyphs\";\nexport * from \"./constants\";\nexport * from \"./resizePolicy\";\nexport * from \"./useStackedCardResize\";\n"],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StackedCard resize policy — pure math.
|
|
3
|
+
*
|
|
4
|
+
* The card reports intent; the HOST applies a resize policy (spec §7). This
|
|
5
|
+
* module is that policy, packaged as pure functions so the SAME code path
|
|
6
|
+
* serves the pointer drag and the keyboard resize. Nothing here touches the
|
|
7
|
+
* DOM, React or the card's content: it takes a start size, a delta and a
|
|
8
|
+
* policy, and returns a clamped size. `useStackedCardResize` wires events to
|
|
9
|
+
* it; the card's intrinsic content minimum is measured by the host and passed
|
|
10
|
+
* in as `contentMin`, so this module knows nothing about heroes or footers.
|
|
11
|
+
*
|
|
12
|
+
* The policy has four parts:
|
|
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 a card can never be crushed below what its content needs.
|
|
20
|
+
*/
|
|
21
|
+
export interface StackedCardSize {
|
|
22
|
+
w: number;
|
|
23
|
+
h: number;
|
|
24
|
+
}
|
|
25
|
+
/** The card's intrinsic minimum, measured from its real content. */
|
|
26
|
+
export interface StackedCardContentMin {
|
|
27
|
+
w: number;
|
|
28
|
+
h: number;
|
|
29
|
+
}
|
|
30
|
+
export interface StackedCardResizePolicy {
|
|
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 StackedCardResizeStart {
|
|
42
|
+
w: number;
|
|
43
|
+
h: number;
|
|
44
|
+
contentMin: StackedCardContentMin;
|
|
45
|
+
}
|
|
46
|
+
export interface StackedCardResizeDelta {
|
|
47
|
+
dx: number;
|
|
48
|
+
dy: number;
|
|
49
|
+
}
|
|
50
|
+
export interface StackedCardResizeBounds {
|
|
51
|
+
wMin: number;
|
|
52
|
+
wMax: number;
|
|
53
|
+
hMin: number;
|
|
54
|
+
hMax: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `width` locks the vertical axis: an auto-height card takes a width and lets
|
|
58
|
+
* its rows set the height, so the gesture's vertical component is ignored.
|
|
59
|
+
*/
|
|
60
|
+
export type StackedCardResizeAxis = "both" | "width";
|
|
61
|
+
/** Which input drove a resize event. Hosts log undo entries per source. */
|
|
62
|
+
export type StackedCardResizeSource = "pointer" | "keyboard";
|
|
63
|
+
/** Keyboard resize nudges by the policy step, or this when no step is set. */
|
|
64
|
+
export declare const DEFAULT_KEYBOARD_STEP = 8;
|
|
65
|
+
/** Shift + arrow resizes by a larger increment (the familiar coarse nudge). */
|
|
66
|
+
export declare const SHIFT_STEP_MULTIPLIER = 4;
|
|
67
|
+
/** Keys the separator handles; everything else falls through to the browser. */
|
|
68
|
+
export declare const RESIZE_KEYS: ReadonlyArray<string>;
|
|
69
|
+
export declare const isResizeKey: (key: string) => boolean;
|
|
70
|
+
export declare const clamp: (v: number, lo: number, hi?: number) => number;
|
|
71
|
+
export declare const snap: (v: number, step?: number) => number;
|
|
72
|
+
export declare const makeStart: (size: StackedCardSize, contentMin: StackedCardContentMin) => StackedCardResizeStart;
|
|
73
|
+
/**
|
|
74
|
+
* The effective bounds a size is clamped to: the policy min floored by the
|
|
75
|
+
* content min, and the policy max (unbounded when unset). Independent of any
|
|
76
|
+
* live gesture, so a host can also use it for the aria value and Home/End.
|
|
77
|
+
*/
|
|
78
|
+
export declare const effectiveBounds: (policy: StackedCardResizePolicy, contentMin: StackedCardContentMin) => StackedCardResizeBounds;
|
|
79
|
+
/**
|
|
80
|
+
* Apply a delta to the start size under the policy — the single path for both
|
|
81
|
+
* inputs.
|
|
82
|
+
*
|
|
83
|
+
* `constrain` is the transient Shift-to-constrain lock: a free-form policy
|
|
84
|
+
* behaves proportionally for that one gesture; a proportional policy is already
|
|
85
|
+
* locked and ignores it. `axis: "width"` drops the gesture's vertical component;
|
|
86
|
+
* the height then holds still in free-form mode, and still follows the ratio in
|
|
87
|
+
* proportional mode (that is what proportional means).
|
|
88
|
+
*/
|
|
89
|
+
export declare const applyResize: (start: StackedCardResizeStart, delta: StackedCardResizeDelta, policy: StackedCardResizePolicy, opts?: {
|
|
90
|
+
constrain?: boolean;
|
|
91
|
+
axis?: StackedCardResizeAxis;
|
|
92
|
+
}) => StackedCardSize;
|
|
93
|
+
/**
|
|
94
|
+
* Translate a resize key into the next size, reusing `applyResize` so the
|
|
95
|
+
* keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);
|
|
96
|
+
* Home/End jump to the min/max of the allowed range, leaving any axis without
|
|
97
|
+
* that bound where it is. Returns null for a key the handle does not own, and
|
|
98
|
+
* for a vertical key on a width-only card.
|
|
99
|
+
*/
|
|
100
|
+
export declare const keyboardResize: (key: string, size: StackedCardSize, policy: StackedCardResizePolicy, contentMin: StackedCardContentMin, opts?: {
|
|
101
|
+
shiftKey?: boolean;
|
|
102
|
+
axis?: StackedCardResizeAxis;
|
|
103
|
+
}) => StackedCardSize | null;
|
|
104
|
+
/**
|
|
105
|
+
* The handle's `aria-valuenow`: the current size as a percent (0–100) of its
|
|
106
|
+
* allowed range. The corner resizes both axes, but the value must be a single
|
|
107
|
+
* number, so it reports the WIDTH axis — the one axis the fixed-box and the
|
|
108
|
+
* width-only cards share. Returns 0 when the range isn't finite (no max bound).
|
|
109
|
+
*/
|
|
110
|
+
export declare const measurePercent: (size: StackedCardSize, policy: StackedCardResizePolicy, contentMin: StackedCardContentMin) => number;
|
|
111
|
+
//# sourceMappingURL=resizePolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizePolicy.d.ts","sourceRoot":"","sources":["../../../../src/components/StackedCard/resizePolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oEAAoE;AACpE,MAAM,WAAW,qBAAqB;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAA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H,eAAO,MAAM,eAAe,GAC1B,QAAQ,uBAAuB,EAC/B,YAAY,qBAAqB,KAChC,uBAKD,CAAC;AAUH;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,sBAAsB,EAC7B,OAAO,sBAAsB,EAC7B,QAAQ,uBAAuB,EAC/B,OAAM;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,qBAAqB,CAAA;CAAO,KAC/D,eAiDF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,MAAM,EACX,MAAM,eAAe,EACrB,QAAQ,uBAAuB,EAC/B,YAAY,qBAAqB,EACjC,OAAM;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,qBAAqB,CAAA;CAAO,KAC9D,eAAe,GAAG,IAgDpB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,eAAe,EACrB,QAAQ,uBAAuB,EAC/B,YAAY,qBAAqB,KAChC,MAIF,CAAC"}
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
/**
|
|
2
|
-
* StackedCard resize policy — pure math
|
|
3
|
+
* StackedCard resize policy — pure math.
|
|
3
4
|
*
|
|
4
|
-
* The card
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* card's intrinsic content minimum is measured
|
|
10
|
-
* `contentMin`, so this module knows nothing about heroes or footers.
|
|
5
|
+
* The card reports intent; the HOST applies a resize policy (spec §7). This
|
|
6
|
+
* module is that policy, packaged as pure functions so the SAME code path
|
|
7
|
+
* serves the pointer drag and the keyboard resize. Nothing here touches the
|
|
8
|
+
* DOM, React or the card's content: it takes a start size, a delta and a
|
|
9
|
+
* policy, and returns a clamped size. `useStackedCardResize` wires events to
|
|
10
|
+
* it; the card's intrinsic content minimum is measured by the host and passed
|
|
11
|
+
* in as `contentMin`, so this module knows nothing about heroes or footers.
|
|
11
12
|
*
|
|
12
|
-
* The policy has four parts
|
|
13
|
+
* The policy has four parts:
|
|
13
14
|
* - bounds — optional min/max per axis; unset means unbounded.
|
|
14
15
|
* - proportional — lock the aspect ratio captured at the start of the gesture;
|
|
15
16
|
* the scale is clamped by the BINDING axis so the ratio never
|
|
16
17
|
* distorts at a bound.
|
|
17
18
|
* - step — optional grid snap; proportion wins over the grid.
|
|
18
19
|
* - content min — the effective min is max(policyMin, contentMin) per axis,
|
|
19
|
-
* so
|
|
20
|
+
* so a card can never be crushed below what its content needs.
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/** The card's intrinsic minimum, measured from its real content. */
|
|
23
24
|
|
|
24
25
|
/** The size captured at the start of a gesture (pointer down or a key press). */
|
|
25
26
|
|
|
27
|
+
/**
|
|
28
|
+
* `width` locks the vertical axis: an auto-height card takes a width and lets
|
|
29
|
+
* its rows set the height, so the gesture's vertical component is ignored.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/** Which input drove a resize event. Hosts log undo entries per source. */
|
|
33
|
+
|
|
26
34
|
/** Keyboard resize nudges by the policy step, or this when no step is set. */
|
|
27
35
|
export const DEFAULT_KEYBOARD_STEP = 8;
|
|
28
36
|
|
|
@@ -43,7 +51,7 @@ export const makeStart = (size, contentMin) => ({
|
|
|
43
51
|
/**
|
|
44
52
|
* The effective bounds a size is clamped to: the policy min floored by the
|
|
45
53
|
* content min, and the policy max (unbounded when unset). Independent of any
|
|
46
|
-
* live gesture, so
|
|
54
|
+
* live gesture, so a host can also use it for the aria value and Home/End.
|
|
47
55
|
*/
|
|
48
56
|
export const effectiveBounds = (policy, contentMin) => {
|
|
49
57
|
var _policy$minW, _policy$minH, _policy$maxW, _policy$maxH;
|
|
@@ -55,11 +63,22 @@ export const effectiveBounds = (policy, contentMin) => {
|
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Whether an axis has a floor anyone asked for. `effectiveBounds` reports 0 for
|
|
68
|
+
* an unset minimum — correct as a clamp, but not something Home should jump to:
|
|
69
|
+
* an axis nobody gave a minimum must not collapse to nothing.
|
|
70
|
+
*/
|
|
71
|
+
const hasFloor = (policyMin, contentMin) => policyMin !== undefined || contentMin > 0;
|
|
72
|
+
|
|
58
73
|
/**
|
|
59
74
|
* Apply a delta to the start size under the policy — the single path for both
|
|
60
|
-
* inputs.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
75
|
+
* inputs.
|
|
76
|
+
*
|
|
77
|
+
* `constrain` is the transient Shift-to-constrain lock: a free-form policy
|
|
78
|
+
* behaves proportionally for that one gesture; a proportional policy is already
|
|
79
|
+
* locked and ignores it. `axis: "width"` drops the gesture's vertical component;
|
|
80
|
+
* the height then holds still in free-form mode, and still follows the ratio in
|
|
81
|
+
* proportional mode (that is what proportional means).
|
|
63
82
|
*/
|
|
64
83
|
export const applyResize = function (start, delta, policy, opts) {
|
|
65
84
|
if (opts === void 0) {
|
|
@@ -70,34 +89,42 @@ export const applyResize = function (start, delta, policy, opts) {
|
|
|
70
89
|
hMin = _effectiveBounds.hMin,
|
|
71
90
|
wMax = _effectiveBounds.wMax,
|
|
72
91
|
hMax = _effectiveBounds.hMax;
|
|
73
|
-
const
|
|
92
|
+
const widthOnly = opts.axis === "width";
|
|
93
|
+
const dx = delta.dx;
|
|
94
|
+
const dy = widthOnly ? 0 : delta.dy;
|
|
95
|
+
|
|
96
|
+
// A ratio needs two non-zero sides to be a ratio at all; a width-only card
|
|
97
|
+
// parks a placeholder height, so fall back to free-form rather than dividing
|
|
98
|
+
// by zero.
|
|
99
|
+
const proportional = (policy.proportional || opts.constrain === true) && start.w > 0 && start.h > 0;
|
|
74
100
|
let w;
|
|
75
101
|
let h;
|
|
76
102
|
if (proportional) {
|
|
77
103
|
// one scale drives both axes; the corner's dominant direction wins, so a
|
|
78
104
|
// vertical drag is as effective as a horizontal one
|
|
79
|
-
const sW = (start.w +
|
|
80
|
-
const sH = (start.h +
|
|
105
|
+
const sW = (start.w + dx) / start.w;
|
|
106
|
+
const sH = (start.h + dy) / start.h;
|
|
81
107
|
let scale = Math.abs(sW - 1) >= Math.abs(sH - 1) ? sW : sH;
|
|
82
108
|
|
|
83
|
-
//
|
|
84
|
-
//
|
|
109
|
+
// step: proportion wins over the grid. Snap through the SCALE (driven off
|
|
110
|
+
// the width edge) so both axes move together and the ratio survives; the
|
|
111
|
+
// grid yields whenever honouring it would cost the ratio.
|
|
112
|
+
if (policy.step) {
|
|
113
|
+
scale = snap(start.w * scale, policy.step) / start.w;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Then clamp the scale so both axes stay in bounds (the binding constraint):
|
|
117
|
+
// the ratio can never break at a bound — whichever edge is limiting stops
|
|
118
|
+
// both. The clamp comes last on purpose: a bound is a hard stop, so the card
|
|
119
|
+
// sits exactly on it rather than at the nearest grid line inside it.
|
|
85
120
|
const scaleMin = Math.max(wMin / start.w, hMin / start.h);
|
|
86
121
|
const scaleMax = Math.min(wMax / start.w, hMax / start.h);
|
|
87
122
|
scale = clamp(scale, scaleMin, Math.max(scaleMin, scaleMax));
|
|
88
|
-
|
|
89
|
-
// step: proportion wins. Snap via the scale (driven off the width edge) and
|
|
90
|
-
// re-clamp, so ratio and bounds always hold; the grid yields when honoring
|
|
91
|
-
// it would cost the ratio
|
|
92
|
-
if (policy.step) {
|
|
93
|
-
const snappedScale = snap(start.w * scale, policy.step) / start.w;
|
|
94
|
-
scale = clamp(snappedScale, scaleMin, Math.max(scaleMin, scaleMax));
|
|
95
|
-
}
|
|
96
123
|
w = start.w * scale;
|
|
97
124
|
h = start.h * scale;
|
|
98
125
|
} else {
|
|
99
|
-
w = clamp(snap(start.w +
|
|
100
|
-
h = clamp(snap(start.h +
|
|
126
|
+
w = clamp(snap(start.w + dx, policy.step), wMin, wMax);
|
|
127
|
+
h = widthOnly ? start.h : clamp(snap(start.h + dy, policy.step), hMin, hMax);
|
|
101
128
|
}
|
|
102
129
|
return {
|
|
103
130
|
w: Math.round(w),
|
|
@@ -108,50 +135,68 @@ export const applyResize = function (start, delta, policy, opts) {
|
|
|
108
135
|
/**
|
|
109
136
|
* Translate a resize key into the next size, reusing `applyResize` so the
|
|
110
137
|
* keyboard clamps exactly like the pointer. Arrows nudge by the step (Shift ×4);
|
|
111
|
-
* Home/End jump to the min/max of the allowed range
|
|
112
|
-
* the handle does not own
|
|
138
|
+
* Home/End jump to the min/max of the allowed range, leaving any axis without
|
|
139
|
+
* that bound where it is. Returns null for a key the handle does not own, and
|
|
140
|
+
* for a vertical key on a width-only card.
|
|
113
141
|
*/
|
|
114
142
|
export const keyboardResize = function (key, size, policy, contentMin, opts) {
|
|
115
143
|
if (opts === void 0) {
|
|
116
144
|
opts = {};
|
|
117
145
|
}
|
|
146
|
+
const widthOnly = opts.axis === "width";
|
|
147
|
+
if (widthOnly && (key === "ArrowUp" || key === "ArrowDown")) return null;
|
|
118
148
|
const base = policy.step && policy.step > 0 ? policy.step : DEFAULT_KEYBOARD_STEP;
|
|
119
149
|
const step = base * (opts.shiftKey ? SHIFT_STEP_MULTIPLIER : 1);
|
|
120
150
|
const start = makeStart(size, contentMin);
|
|
121
151
|
const b = effectiveBounds(policy, contentMin);
|
|
152
|
+
const apply = delta => applyResize(start, delta, policy, {
|
|
153
|
+
axis: opts.axis
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Home and End are absolute jumps to a bound, not nudges, so they ignore the
|
|
158
|
+
* grid: landing 4px off the minimum because that is where the nearest grid
|
|
159
|
+
* line fell would mean the keyboard could never reach the bound the pointer
|
|
160
|
+
* stops at.
|
|
161
|
+
*/
|
|
162
|
+
const jump = delta => applyResize(start, delta, _extends({}, policy, {
|
|
163
|
+
step: 0
|
|
164
|
+
}), {
|
|
165
|
+
axis: opts.axis
|
|
166
|
+
});
|
|
122
167
|
switch (key) {
|
|
123
168
|
case "ArrowRight":
|
|
124
|
-
return
|
|
169
|
+
return apply({
|
|
125
170
|
dx: step,
|
|
126
171
|
dy: 0
|
|
127
|
-
}
|
|
172
|
+
});
|
|
128
173
|
case "ArrowLeft":
|
|
129
|
-
return
|
|
174
|
+
return apply({
|
|
130
175
|
dx: -step,
|
|
131
176
|
dy: 0
|
|
132
|
-
}
|
|
177
|
+
});
|
|
133
178
|
case "ArrowDown":
|
|
134
|
-
return
|
|
179
|
+
return apply({
|
|
135
180
|
dx: 0,
|
|
136
181
|
dy: step
|
|
137
|
-
}
|
|
182
|
+
});
|
|
138
183
|
case "ArrowUp":
|
|
139
|
-
return
|
|
184
|
+
return apply({
|
|
140
185
|
dx: 0,
|
|
141
186
|
dy: -step
|
|
142
|
-
}
|
|
187
|
+
});
|
|
143
188
|
case "Home":
|
|
144
|
-
// jump to the min corner
|
|
145
|
-
return
|
|
146
|
-
dx: b.wMin - size.w,
|
|
147
|
-
dy: b.hMin - size.h
|
|
148
|
-
}
|
|
189
|
+
// jump to the min corner; an axis with no floor of its own stays put
|
|
190
|
+
return jump({
|
|
191
|
+
dx: hasFloor(policy.minW, contentMin.w) ? b.wMin - size.w : 0,
|
|
192
|
+
dy: !widthOnly && hasFloor(policy.minH, contentMin.h) ? b.hMin - size.h : 0
|
|
193
|
+
});
|
|
149
194
|
case "End":
|
|
150
195
|
// jump to the max corner; an unbounded axis simply doesn't move
|
|
151
|
-
return
|
|
196
|
+
return jump({
|
|
152
197
|
dx: Number.isFinite(b.wMax) ? b.wMax - size.w : 0,
|
|
153
|
-
dy: Number.isFinite(b.hMax) ? b.hMax - size.h : 0
|
|
154
|
-
}
|
|
198
|
+
dy: !widthOnly && Number.isFinite(b.hMax) ? b.hMax - size.h : 0
|
|
199
|
+
});
|
|
155
200
|
default:
|
|
156
201
|
return null;
|
|
157
202
|
}
|
|
@@ -160,7 +205,7 @@ export const keyboardResize = function (key, size, policy, contentMin, opts) {
|
|
|
160
205
|
/**
|
|
161
206
|
* The handle's `aria-valuenow`: the current size as a percent (0–100) of its
|
|
162
207
|
* allowed range. The corner resizes both axes, but the value must be a single
|
|
163
|
-
* number, so it reports the WIDTH axis — the one axis
|
|
208
|
+
* number, so it reports the WIDTH axis — the one axis the fixed-box and the
|
|
164
209
|
* width-only cards share. Returns 0 when the range isn't finite (no max bound).
|
|
165
210
|
*/
|
|
166
211
|
export const measurePercent = (size, policy, contentMin) => {
|
|
@@ -0,0 +1 @@
|
|
|
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","hasFloor","policyMin","undefined","applyResize","start","delta","opts","_effectiveBounds","widthOnly","axis","dx","dy","proportional","constrain","sW","sH","scale","abs","scaleMin","scaleMax","keyboardResize","base","shiftKey","b","apply","jump","_extends","isFinite","measurePercent","_effectiveBounds2"],"sources":["../../../../src/components/StackedCard/resizePolicy.ts"],"sourcesContent":["/**\n * StackedCard resize policy — pure math.\n *\n * The card reports intent; the HOST applies a resize policy (spec §7). This\n * module is that policy, packaged as pure functions so the SAME code path\n * serves the pointer drag and the keyboard resize. Nothing here touches the\n * DOM, React or the card's content: it takes a start size, a delta and a\n * policy, and returns a clamped size. `useStackedCardResize` wires events to\n * it; the card's intrinsic content minimum is measured by the host and passed\n * in as `contentMin`, so this module knows nothing about heroes or footers.\n *\n * The policy has four parts:\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 a card can never be crushed below what its content needs.\n */\n\nexport interface StackedCardSize {\n w: number;\n h: number;\n}\n\n/** The card's intrinsic minimum, measured from its real content. */\nexport interface StackedCardContentMin {\n w: number;\n h: number;\n}\n\nexport interface StackedCardResizePolicy {\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 StackedCardResizeStart {\n w: number;\n h: number;\n contentMin: StackedCardContentMin;\n}\n\nexport interface StackedCardResizeDelta {\n dx: number;\n dy: number;\n}\n\nexport interface StackedCardResizeBounds {\n wMin: number;\n wMax: number;\n hMin: number;\n hMax: number;\n}\n\n/**\n * `width` locks the vertical axis: an auto-height card takes a width and lets\n * its rows set the height, so the gesture's vertical component is ignored.\n */\nexport type StackedCardResizeAxis = \"both\" | \"width\";\n\n/** Which input drove a resize event. Hosts log undo entries per source. */\nexport type StackedCardResizeSource = \"pointer\" | \"keyboard\";\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 = (\n size: StackedCardSize,\n contentMin: StackedCardContentMin\n): StackedCardResizeStart => ({\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 a host can also use it for the aria value and Home/End.\n */\nexport const effectiveBounds = (\n policy: StackedCardResizePolicy,\n contentMin: StackedCardContentMin\n): StackedCardResizeBounds => ({\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 * Whether an axis has a floor anyone asked for. `effectiveBounds` reports 0 for\n * an unset minimum — correct as a clamp, but not something Home should jump to:\n * an axis nobody gave a minimum must not collapse to nothing.\n */\nconst hasFloor = (policyMin: number | undefined, contentMin: number): boolean =>\n policyMin !== undefined || contentMin > 0;\n\n/**\n * Apply a delta to the start size under the policy — the single path for both\n * inputs.\n *\n * `constrain` is the transient Shift-to-constrain lock: a free-form policy\n * behaves proportionally for that one gesture; a proportional policy is already\n * locked and ignores it. `axis: \"width\"` drops the gesture's vertical component;\n * the height then holds still in free-form mode, and still follows the ratio in\n * proportional mode (that is what proportional means).\n */\nexport const applyResize = (\n start: StackedCardResizeStart,\n delta: StackedCardResizeDelta,\n policy: StackedCardResizePolicy,\n opts: { constrain?: boolean; axis?: StackedCardResizeAxis } = {}\n): StackedCardSize => {\n const { wMin, hMin, wMax, hMax } = effectiveBounds(policy, start.contentMin);\n const widthOnly = opts.axis === \"width\";\n const dx = delta.dx;\n const dy = widthOnly ? 0 : delta.dy;\n\n // A ratio needs two non-zero sides to be a ratio at all; a width-only card\n // parks a placeholder height, so fall back to free-form rather than dividing\n // by zero.\n const proportional =\n (policy.proportional || opts.constrain === true) &&\n start.w > 0 &&\n start.h > 0;\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 + dx) / start.w;\n const sH = (start.h + dy) / start.h;\n let scale = Math.abs(sW - 1) >= Math.abs(sH - 1) ? sW : sH;\n\n // step: proportion wins over the grid. Snap through the SCALE (driven off\n // the width edge) so both axes move together and the ratio survives; the\n // grid yields whenever honouring it would cost the ratio.\n if (policy.step) {\n scale = snap(start.w * scale, policy.step) / start.w;\n }\n\n // Then clamp the scale so both axes stay in bounds (the binding constraint):\n // the ratio can never break at a bound — whichever edge is limiting stops\n // both. The clamp comes last on purpose: a bound is a hard stop, so the card\n // sits exactly on it rather than at the nearest grid line inside it.\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 w = start.w * scale;\n h = start.h * scale;\n } else {\n w = clamp(snap(start.w + dx, policy.step), wMin, wMax);\n h = widthOnly\n ? start.h\n : clamp(snap(start.h + 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, leaving any axis without\n * that bound where it is. Returns null for a key the handle does not own, and\n * for a vertical key on a width-only card.\n */\nexport const keyboardResize = (\n key: string,\n size: StackedCardSize,\n policy: StackedCardResizePolicy,\n contentMin: StackedCardContentMin,\n opts: { shiftKey?: boolean; axis?: StackedCardResizeAxis } = {}\n): StackedCardSize | null => {\n const widthOnly = opts.axis === \"width\";\n if (widthOnly && (key === \"ArrowUp\" || key === \"ArrowDown\")) return null;\n\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 const apply = (delta: StackedCardResizeDelta): StackedCardSize =>\n applyResize(start, delta, policy, { axis: opts.axis });\n\n /**\n * Home and End are absolute jumps to a bound, not nudges, so they ignore the\n * grid: landing 4px off the minimum because that is where the nearest grid\n * line fell would mean the keyboard could never reach the bound the pointer\n * stops at.\n */\n const jump = (delta: StackedCardResizeDelta): StackedCardSize =>\n applyResize(start, delta, { ...policy, step: 0 }, { axis: opts.axis });\n\n switch (key) {\n case \"ArrowRight\":\n return apply({ dx: step, dy: 0 });\n case \"ArrowLeft\":\n return apply({ dx: -step, dy: 0 });\n case \"ArrowDown\":\n return apply({ dx: 0, dy: step });\n case \"ArrowUp\":\n return apply({ dx: 0, dy: -step });\n case \"Home\":\n // jump to the min corner; an axis with no floor of its own stays put\n return jump({\n dx: hasFloor(policy.minW, contentMin.w) ? b.wMin - size.w : 0,\n dy:\n !widthOnly && hasFloor(policy.minH, contentMin.h)\n ? b.hMin - size.h\n : 0,\n });\n case \"End\":\n // jump to the max corner; an unbounded axis simply doesn't move\n return jump({\n dx: Number.isFinite(b.wMax) ? b.wMax - size.w : 0,\n dy: !widthOnly && Number.isFinite(b.hMax) ? b.hMax - size.h : 0,\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 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: StackedCardSize,\n policy: StackedCardResizePolicy,\n contentMin: StackedCardContentMin\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;AACA;AACA;;AAGA;;AAGA;AACA,OAAO,MAAMA,qBAAqB,GAAG,CAAC;;AAEtC;AACA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;;AAEtC;AACA,OAAO,MAAMC,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AACzB,IAAI,CAAC,GAAGyB,CAAC,CAACzB,IAAI,GAAGhB,IAAI,CAACG,CAAC,GAAG;MAChE,CAAC,CAAC;IACJ;MACE,OAAO,IAAI;EACf;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM2C,cAAc,GAAGA,CAC5B9C,IAAqB,EACrBK,MAA+B,EAC/BJ,UAAiC,KACtB;EACX,MAAA8C,iBAAA,GAAuB3C,eAAe,CAACC,MAAM,EAAEJ,UAAU,CAAC;IAAlDS,IAAI,GAAAqC,iBAAA,CAAJrC,IAAI;IAAEI,IAAI,GAAAiC,iBAAA,CAAJjC,IAAI;EAClB,IAAI,CAACrB,MAAM,CAACoD,QAAQ,CAAC/B,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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizePolicy.test.d.ts","sourceRoot":"","sources":["../../../../src/components/StackedCard/resizePolicy.test.ts"],"names":[],"mappings":""}
|