@usableapp/cardds 0.7.103 → 0.7.104

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 (60) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/css/actions.css +102 -36
  3. package/css/base.css +139 -15
  4. package/css/card.css +308 -79
  5. package/css/choice.css +25 -33
  6. package/css/finish.css +28 -27
  7. package/css/forms.css +6 -14
  8. package/css/journey.css +4 -4
  9. package/css/layover.css +26 -24
  10. package/css/lists.css +8 -6
  11. package/css/media.css +13 -74
  12. package/css/numbers.css +37 -32
  13. package/css/palette.css +1 -1
  14. package/css/people.css +3 -8
  15. package/css/post.css +23 -19
  16. package/css/sheet.css +84 -56
  17. package/css/stack.css +39 -215
  18. package/css/stamp.css +41 -29
  19. package/css/step.css +1 -107
  20. package/css/sticky.css +43 -41
  21. package/css/theme.template.css +12 -0
  22. package/css/tokens.css +100 -26
  23. package/dist/actions/Chip.d.ts +1 -1
  24. package/dist/actions/Chip.js +3 -2
  25. package/dist/cardds.css +1053 -868
  26. package/dist/cards/Card.d.ts +3 -3
  27. package/dist/cards/Card.js +1 -1
  28. package/dist/cards/CardFeed.js +7 -9
  29. package/dist/catalog.json +1 -1
  30. package/dist/layover/Snackbar.js +2 -2
  31. package/dist/lists/Bubble.d.ts +1 -1
  32. package/dist/lists/Bubble.js +1 -1
  33. package/dist/lists/Row.js +5 -7
  34. package/dist/numbers/Picker.js +11 -18
  35. package/dist/people/Avatar.d.ts +1 -1
  36. package/dist/people/Avatar.js +3 -2
  37. package/dist/post/PostDesk.js +6 -9
  38. package/dist/post/PostLetter.js +4 -4
  39. package/dist/pressable.d.ts +9 -0
  40. package/dist/pressable.js +6 -0
  41. package/dist/room.d.ts +5 -0
  42. package/dist/room.js +9 -0
  43. package/dist/scaffold/Panes.js +8 -14
  44. package/dist/sheets/Sheet.d.ts +1 -1
  45. package/dist/sheets/Sheet.js +2 -3
  46. package/dist/sheets/SheetSteps.js +3 -3
  47. package/dist/sheets/StackSheet.d.ts +1 -1
  48. package/dist/sheets/sheetStepsPile.js +2 -3
  49. package/dist/sheets/stackCard.js +67 -115
  50. package/dist/state.d.ts +21 -0
  51. package/dist/state.js +28 -1
  52. package/dist/sticky/Sticky.js +3 -7
  53. package/dist/templates/Home.d.ts +1 -1
  54. package/dist/templates/Splash.js +2 -2
  55. package/dist/templates/Walkthrough.js +4 -5
  56. package/docs/reference.md +71 -9
  57. package/lib/catalog.mjs +23 -7
  58. package/lint/rules.mjs +7 -5
  59. package/lint/values.mjs +144 -0
  60. package/package.json +6 -4
@@ -9,8 +9,8 @@ export type Tone = 1 | 2 | 3 | 4 | 5;
9
9
  export interface CardProps extends ComponentProps<'article'> {
10
10
  /** the tone slot — see `Tone` */
11
11
  tone?: Tone;
12
- /** `true`: the content is white paper and the head keeps the card's colour (the look of `Sheet paper`). `'bands'`: the opposite, two-tone —
13
- * the head and the foot are white paper bands edge to edge, the middle between them keeps the card's tone, lightened (knob `--card-middle-bg`).
12
+ /** `true`: the content is the theme's paper (`--action-bg`, the ground of its fields) and the head keeps the card's colour (the look of `Sheet paper`). `'bands'`: the opposite, two-tone —
13
+ * the head and the foot are paper bands edge to edge, the middle between them keeps the card's tone, lightened (knob `--card-middle-bg`).
14
14
  * Omit it and the content matches the head */
15
15
  paper?: boolean | 'bands';
16
16
  /** compact: a small card inside a card or a sheet body (a note, a promo) */
@@ -85,7 +85,7 @@ export interface CardProps extends ComponentProps<'article'> {
85
85
  * PRESSED WHOLE: a card whose ONLY control is its foot's button, or a row card's end button, is pressed anywhere — a touch off the
86
86
  * button runs that button's own action once, and the card dims under the finger. The app writes nothing; any other card is only read.
87
87
  * TWO FACES (`back`): the whole card turns over on a tap off a control (the flip mechanic it shares with Postcard); the head and the foot
88
- * read the same on both faces, the middle is one fixed height. `paper="bands"`: white head and foot bands edge to edge, the tint between.
88
+ * read the same on both faces, the middle is one fixed height. `paper="bands"`: paper head and foot bands edge to edge, the tint between.
89
89
  */
90
90
  export declare function Card({ tone, paper, sm, row, cover, fold, centre, band, as, heading, caption, end, level, foot, footLink, stack, leave, onLeft, onRemove, removeLabel, back, face, defaultFace, onFaceChange, toBackLabel, toFrontLabel, className, style, children, onClick, ref, ...rest }: CardProps): import("react").DetailedReactHTMLElement<{
91
91
  onClick: (e: MouseEvent<HTMLElement>) => void;
@@ -17,7 +17,7 @@ import { StackHeadCtx, StackPullCtx, ownHead, stackPaint, useStackCard } from '.
17
17
  * PRESSED WHOLE: a card whose ONLY control is its foot's button, or a row card's end button, is pressed anywhere — a touch off the
18
18
  * button runs that button's own action once, and the card dims under the finger. The app writes nothing; any other card is only read.
19
19
  * TWO FACES (`back`): the whole card turns over on a tap off a control (the flip mechanic it shares with Postcard); the head and the foot
20
- * read the same on both faces, the middle is one fixed height. `paper="bands"`: white head and foot bands edge to edge, the tint between.
20
+ * read the same on both faces, the middle is one fixed height. `paper="bands"`: paper head and foot bands edge to edge, the tint between.
21
21
  */
22
22
  export function Card({ tone, paper, sm, row, cover, fold, centre, band, as = 'article', heading, caption, end, level, foot, footLink, stack, leave, onLeft, onRemove, removeLabel, back, face, defaultFace = 'front', onFaceChange, toBackLabel, toFrontLabel, className, style, children, onClick, ref, ...rest }) {
23
23
  if (onRemove && !row)
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Children, createContext, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef } from 'react';
3
3
  import { cx } from '../cx.js';
4
- import { reducedMotion, setRefs, useControlled, warnOnce } from '../state.js';
4
+ import { glide, reducedMotion, setRefs, sheetMs, stopMoves, useControlled, warnOnce } from '../state.js';
5
5
  import { Card } from './Card.js';
6
6
  import { CardHead } from './CardHead.js';
7
7
  import { CardFoot } from './CardFoot.js';
@@ -45,19 +45,17 @@ export function CardFeed({ big: bigProp, defaultBig, onBigChange, onMore, ahead
45
45
  if (changed) {
46
46
  if (!kept && ids.length)
47
47
  request(ids[0], 'queue');
48
- els.forEach((el) => el.getAnimations().forEach((a) => { if (a.id === 'feed-move')
49
- a.cancel(); })); // read the resting places
48
+ stopMoves(els, 'feed-move'); // read the resting places
50
49
  }
51
50
  const at = new Map(els.map((el) => [el, el.offsetTop]));
52
51
  if (changed && box && !reducedMotion()) {
53
- const ms = (parseFloat(getComputedStyle(box).getPropertyValue('--motion-sheet')) || 0.35) * 1000;
52
+ const cs = getComputedStyle(box), arrive = cs.getPropertyValue('--ease-out').trim() || 'ease-out';
54
53
  for (const el of els) {
55
54
  const from = tops.current.get(el);
56
- const move = from === undefined
57
- ? el.animate([{ opacity: 0 }, { opacity: 1 }], { duration: ms, easing: 'ease-out' }) // it came in: no place to come from
58
- : from !== at.get(el) ? el.animate([{ translate: `0 ${from - (at.get(el) ?? 0)}px` }, { translate: '0 0' }], { duration: ms, easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)' }) : null;
59
- if (move)
60
- move.id = 'feed-move';
55
+ if (from === undefined)
56
+ el.animate([{ opacity: 0 }, { opacity: 1 }], { duration: sheetMs(cs), easing: arrive }).id = 'feed-move'; // it came in: no place to come from
57
+ else if (from !== at.get(el))
58
+ glide(el, from - (at.get(el) ?? 0), cs, 'feed-move');
61
59
  }
62
60
  }
63
61
  tops.current = at;