@dloizides/marketing-astro-kit 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +3 -2
  2. package/package.json +1 -1
  3. package/src/ContactCard.astro +124 -107
  4. package/src/contactCard/CardBack.astro +31 -0
  5. package/src/contactCard/CardForm.ts +5 -0
  6. package/src/contactCard/CardFront.astro +27 -0
  7. package/src/contactCard/CardIconName.ts +1 -0
  8. package/src/contactCard/CardSave.astro +3 -1
  9. package/src/contactCard/CardShare.astro +32 -0
  10. package/src/contactCard/CardTurn.astro +15 -0
  11. package/src/contactCard/CardTwoSided.astro +48 -0
  12. package/src/contactCard/cardIcons.ts +1 -0
  13. package/src/contactCard/cssRaw.d.ts +4 -0
  14. package/src/contactCard/index.ts +20 -16
  15. package/src/contactCard/motion/FlipMotion.ts +5 -0
  16. package/src/contactCard/motion/OpenLanding.ts +6 -0
  17. package/src/contactCard/motion/OpenMotion.ts +5 -1
  18. package/src/contactCard/motion/ShareMode.ts +7 -0
  19. package/src/contactCard/motion/TiltMotion.ts +4 -1
  20. package/src/contactCard/motion/beats.ts +3 -3
  21. package/src/contactCard/motion/cardMotion.ts +25 -4
  22. package/src/contactCard/motion/holdDuringOpen.ts +4 -4
  23. package/src/contactCard/motion/mountFlip.ts +64 -0
  24. package/src/contactCard/motion/mountMotion.ts +33 -26
  25. package/src/contactCard/motion/mountOpenMark.ts +23 -20
  26. package/src/contactCard/motion/mountShare.ts +57 -0
  27. package/src/contactCard/motion/mountTilt.ts +84 -92
  28. package/src/contactCard/motion/openCss.ts +3 -3
  29. package/src/contactCard/motion/orientationAccess.ts +36 -0
  30. package/src/contactCard/motion/tiltLights.ts +14 -0
  31. package/src/contactCard/motion/tiltPose.ts +59 -38
  32. package/src/contactCard/motion/twoSidedBeats.ts +37 -0
  33. package/src/contactCard/motion.css +5 -0
  34. package/src/contactCard/share.css +16 -0
  35. package/src/contactCard/twoSided.css +43 -0
  36. package/src/contactCard/types.ts +52 -47
package/README.md CHANGED
@@ -333,7 +333,7 @@ const qr = buildQrSvg({ url: 'https://example.test/card/sam/', title: 'QR code o
333
333
  labels={labels}
334
334
  saveHref="/card/sam.vcf"
335
335
  cardUrl="https://example.test/card/sam/"
336
- motion={{ openMotion: 'mark-lands', tiltMotion: 'card-leans', qrMotion: 'list-turns', saveMotion: 'tick' }}
336
+ motion={{ openMotion: 'tile-grows', openLands: 'turn-to-front', flipMotion: 'turn-over', tiltMotion: 'light-sweeps', qrMotion: 'list-turns', saveMotion: 'tick', shareMode: 'face-above' }}
337
337
  brandMarkup={{ intro, still, wordmark }}
338
338
  />
339
339
  ```
@@ -346,7 +346,8 @@ const qr = buildQrSvg({ url: 'https://example.test/card/sam/', title: 'QR code o
346
346
  - Colours: `--tmk-card-bg`, `-raised`, `-fill`, `-text`, `-heading`, `-text-soft`, `-line`, `-edge`, `-accent`, `-on-accent`. Also `--tmk-card-font`, `--tmk-card-radius`, `--tmk-card-qr-dark` and `--tmk-card-qr-light`. Set them on `:root`.
347
347
  - Portrait crop: `--tmk-card-portrait-scale`, `-origin` and `-mask`.
348
348
  - Line heights: `--tmk-card-name-line-height` (default `1.2`) and `--tmk-card-role-line-height` (default `1.3`), in every layout and while motion runs. Raise them for fonts with tall ascenders or descenders.
349
- - `motion` has four settings; each left out takes the recommended one shown above, and an unknown value throws at build time. `openMotion`: `none`, `mark-first`, `mark-lands`, `written-in`. `tiltMotion`: `none`, `card-leans`, `portrait-leans`, `layers-drift`. `qrMotion`: `none`, `turn-over`, `cube-turn`, `list-turns`. `saveMotion`: `none`, `tick`, `light-crosses`, `cube-closes`. Under `prefers-reduced-motion` each shows its still end state. Show my QR and Add to home screen cannot be tapped until the opening has shown them. A sideways drag tilts the card and never follows a link it started on.
349
+ - `cardForm`: `two-sided` (default) draws a business-card shaped card, front = name, role, portrait and contacts, back = the `brandMarkup` logo only (no link), with Save contact and the actions beside it, never on the card; a tap outside its links, the turn button, Enter or Space turns it. `page` is the full page card that follows `layout`. Two-sided needs `labels.turnToBack`, `turnToFront`, `cardFront`, `cardBack`; size comes from `--tmk-card-aspect` (portrait) and `--tmk-card-aspect-wide` (1024 px and up).
350
+ - `motion` has seven settings; each left out takes the recommended one shown above, and an unknown value throws at build time. `openMotion`: `none`, `mark-first`, `mark-lands`, `written-in`, and for the two-sided card `tile-grows`, `moon-opens`, `turns-face-up`, `pass-rises`. `openLands` (tile-grows only): `turn-to-front`, `front`, `back`. `flipMotion`: `none`, `turn-over` (560 ms, a tap mid-turn reverses it). `tiltMotion`: `none`, `card-leans`, `portrait-leans`, `layers-drift`, `light-sweeps`, `gold-gloss`, `deep-layers` (the motion sensor drives it; iOS asks for it on the first tap on the card outside its buttons and links; a drag always works). `qrMotion`: `none`, `turn-over`, `cube-turn`, `list-turns`. `saveMotion`: `none`, `tick`, `light-crosses`, `cube-closes`. `shareMode`: `none`, `white-sheet`, `night-frame`, `face-above`; any value but `none` makes Show my QR open a still, full-screen code view that keeps the screen awake where the browser allows (Screen Wake Lock), and `qrMotion` then has nothing to turn. Under `prefers-reduced-motion` each shows its still end state. Show my QR and Add to home screen cannot be tapped until the opening has shown them. A sideways drag tilts the card and never follows a link it started on.
350
351
  - `brandMarkup` is a mark from `@dloizides/logo-kit` (`intro` and `still` markup, optional `wordmark` `{ html, css }`); the opening draws it in. Without it the `brand` image is used.
351
352
  - Data attributes: the card carries `data-layout`, `data-open-motion`, `data-tilt-motion`, `data-qr-motion` and `data-save-motion`; `data-tilting` is set while it leans. `data-part` names each part the motion moves.
352
353
  - `mountContactCards(root, signal)` wires the buttons and the motion; aborting the signal removes every listener, frame loop and timer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dloizides/marketing-astro-kit",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Reusable, themeable Astro marketing sections for product sites — a Free-vs-Pro pricing comparison table, a trust / credibility section (security cards, customer-logo + testimonial placeholders, discreet built-by), a client-side \"try it\" demo shell, a meeting request form posting to a contact endpoint, and an SEO guides/content-hub card + frontmatter schema. Data-driven via a shared TypeScript schema; themed entirely through the host site's CSS custom properties.",
5
5
  "keywords": [
6
6
  "astro",
@@ -1,107 +1,124 @@
1
- ---
2
- import './contactCard/contactCard.css';
3
- import './contactCard/layouts.css';
4
- import './contactCard/motion.css';
5
- import CardActions from './contactCard/CardActions.astro';
6
- import CardBrand from './contactCard/CardBrand.astro';
7
- import CardContacts from './contactCard/CardContacts.astro';
8
- import { CardContactsVariant } from './contactCard/CardContactsVariant';
9
- import CardDialog from './contactCard/CardDialog.astro';
10
- import CardIdentity from './contactCard/CardIdentity.astro';
11
- import { buildCardLinks, requireCardLayout, requireSaveHref } from './contactCard/cardLinks';
12
- import CardPortrait from './contactCard/CardPortrait.astro';
13
- import CardQr from './contactCard/CardQr.astro';
14
- import CardSave from './contactCard/CardSave.astro';
15
- import CardValues from './contactCard/CardValues.astro';
16
- import { requireHttpsUrl } from './contactCard/checks';
17
- import { ContactCardLayout } from './contactCard/ContactCardLayout';
18
- import { InstallRoute } from './contactCard/InstallRoute';
19
- import { motionAttributes, resolveCardMotion, type ContactCardMotionInput } from './contactCard/motion/cardMotion';
20
- import { buildOpenCss } from './contactCard/motion/openCss';
21
- import { OpenMotion } from './contactCard/motion/OpenMotion';
22
- import { TiltMotion } from './contactCard/motion/TiltMotion';
23
- import { buildQrSvg } from './contactCard/qrSvg';
24
- import type { ContactCardBrand, ContactCardBrandMarkup, ContactCardLabels, ContactCardPerson, ContactCardPortrait } from './contactCard/types';
25
-
26
- interface Props {
27
- layout?: `${ContactCardLayout}`;
28
- person: ContactCardPerson;
29
- brand: ContactCardBrand;
30
- portrait: ContactCardPortrait;
31
- labels: ContactCardLabels;
32
- /** Address of the person's `.vcf` file. */
33
- saveHref: string;
34
- /** Full https address of this card, carried by the QR. */
35
- cardUrl: string;
36
- /** The four motion settings; each left out takes its recommended option. */
37
- motion?: ContactCardMotionInput;
38
- /** The mark from @dloizides/logo-kit, drawn in on open; the brand image is used without it. */
39
- brandMarkup?: ContactCardBrandMarkup;
40
- }
41
-
42
- const { person, brand, portrait, labels } = Astro.props;
43
- const layout = requireCardLayout(Astro.props.layout ?? ContactCardLayout.Name);
44
- const saveHref = requireSaveHref(Astro.props.saveHref);
45
- const cardUrl = requireHttpsUrl(Astro.props.cardUrl, 'cardUrl');
46
- const links = buildCardLinks(person, labels);
47
- const qrSvg = buildQrSvg({ url: cardUrl, title: labels.qrTitle });
48
- const motion = resolveCardMotion(Astro.props.motion);
49
- const openCss = buildOpenCss(motion.openMotion);
50
- const brandProps = { brand, markup: Astro.props.brandMarkup, animated: motion.openMotion !== OpenMotion.None };
51
- const portraitProps = { portrait, light: motion.tiltMotion === TiltMotion.PortraitLeans || motion.tiltMotion === TiltMotion.LayersDrift };
52
- const saveProps = { href: saveHref, label: labels.save, readyLabel: labels.ready, saveMotion: motion.saveMotion };
53
- ---
54
- <div class="tmk-card" data-contact-card data-layout={layout} {...motionAttributes(motion)} data-testid="card">
55
- {openCss !== '' && <style is:inline set:html={openCss} />}
56
- {layout === ContactCardLayout.Portrait && (
57
- <CardBrand {...brandProps} />
58
- <div class="tmk-card-disc"><CardPortrait {...portraitProps} /></div>
59
- <div class="tmk-card-main">
60
- <CardIdentity person={person} />
61
- <CardSave {...saveProps} />
62
- <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Tiles} />
63
- <CardValues links={links} />
64
- <CardActions labels={labels} />
65
- </div>
66
- )}
67
- {layout === ContactCardLayout.Name && (
68
- <CardBrand {...brandProps} />
69
- <CardIdentity person={person}><CardPortrait {...portraitProps} /></CardIdentity>
70
- <CardSave {...saveProps} />
71
- <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Rows} />
72
- <CardActions labels={labels} />
73
- )}
74
- {layout === ContactCardLayout.Framed && (
75
- <div class="tmk-card-frame" data-part="frame">
76
- <CardBrand {...brandProps} />
77
- <CardIdentity person={person}><CardPortrait {...portraitProps} /></CardIdentity>
78
- <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Rows} />
79
- </div>
80
- <CardActions labels={labels}><CardSave {...saveProps} /></CardActions>
81
- )}
82
- {layout === ContactCardLayout.Honeycomb && (
83
- <CardBrand {...brandProps} />
84
- <CardIdentity person={person} />
85
- <div class="tmk-card-comb" data-part="comb">
86
- <CardPortrait {...portraitProps} />
87
- <CardSave {...saveProps} />
88
- <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Tiles} />
89
- </div>
90
- <CardValues links={links} />
91
- <CardActions labels={labels} />
92
- )}
93
- <CardQr qrSvg={qrSvg} cardUrl={cardUrl} title={labels.qrTitle} hideLabel={labels.hideQr} qrMotion={motion.qrMotion} />
94
- {motion.tiltMotion === TiltMotion.CardLeans && <span class="tmk-card-edge" aria-hidden="true" data-part="edge"><span data-part="edge-light"></span></span>}
95
- <CardDialog name="install" title={labels.installTitle} closeLabel={labels.close}>
96
- <ol data-install-route={InstallRoute.AppleSteps} data-testid="card-install-steps" hidden>
97
- {labels.appleSteps.map((step) => <li>{step}</li>)}
98
- </ol>
99
- <p data-install-route={InstallRoute.MenuHint} data-testid="card-install-hint" hidden>{labels.menuHint}</p>
100
- </CardDialog>
101
- </div>
102
-
103
- <script>
104
- import { mountContactCards } from './contactCard/mount';
105
-
106
- mountContactCards();
107
- </script>
1
+ ---
2
+ import './contactCard/contactCard.css';
3
+ import './contactCard/layouts.css';
4
+ import './contactCard/motion.css';
5
+ import './contactCard/share.css';
6
+ import './contactCard/twoSided.css';
7
+ import CardActions from './contactCard/CardActions.astro';
8
+ import CardBrand from './contactCard/CardBrand.astro';
9
+ import CardContacts from './contactCard/CardContacts.astro';
10
+ import { CardContactsVariant } from './contactCard/CardContactsVariant';
11
+ import CardDialog from './contactCard/CardDialog.astro';
12
+ import CardIdentity from './contactCard/CardIdentity.astro';
13
+ import { buildCardLinks, requireCardLayout, requireSaveHref } from './contactCard/cardLinks';
14
+ import CardPortrait from './contactCard/CardPortrait.astro';
15
+ import CardQr from './contactCard/CardQr.astro';
16
+ import CardSave from './contactCard/CardSave.astro';
17
+ import CardShare from './contactCard/CardShare.astro';
18
+ import CardTwoSided from './contactCard/CardTwoSided.astro';
19
+ import { CardForm } from './contactCard/CardForm';
20
+ import CardValues from './contactCard/CardValues.astro';
21
+ import { optionError, requireHttpsUrl } from './contactCard/checks';
22
+ import { ContactCardLayout } from './contactCard/ContactCardLayout';
23
+ import { InstallRoute } from './contactCard/InstallRoute';
24
+ import { motionAttributes, resolveCardMotion, type ContactCardMotionInput } from './contactCard/motion/cardMotion';
25
+ import { buildOpenCss } from './contactCard/motion/openCss';
26
+ import { OpenMotion } from './contactCard/motion/OpenMotion';
27
+ import { ShareMode } from './contactCard/motion/ShareMode';
28
+ import { tiltLights } from './contactCard/motion/tiltLights';
29
+ import { buildQrSvg } from './contactCard/qrSvg';
30
+ import type { ContactCardBrand, ContactCardBrandMarkup, ContactCardLabels, ContactCardPerson, ContactCardPortrait } from './contactCard/types';
31
+
32
+ interface Props {
33
+ /** `two-sided` (default) or `page`, the full page card that follows `layout`. */
34
+ cardForm?: `${CardForm}`;
35
+ layout?: `${ContactCardLayout}`;
36
+ person: ContactCardPerson;
37
+ brand: ContactCardBrand;
38
+ portrait: ContactCardPortrait;
39
+ labels: ContactCardLabels;
40
+ /** Address of the person's `.vcf` file. */
41
+ saveHref: string;
42
+ /** Full https address of this card, carried by the QR. */
43
+ cardUrl: string;
44
+ /** The motion and share settings; each left out takes its recommended option. */
45
+ motion?: ContactCardMotionInput;
46
+ /** The mark from @dloizides/logo-kit, drawn in on open; the brand image is used without it. */
47
+ brandMarkup?: ContactCardBrandMarkup;
48
+ }
49
+
50
+ const { person, brand, portrait, labels } = Astro.props;
51
+ const layout = requireCardLayout(Astro.props.layout ?? ContactCardLayout.Name);
52
+ const saveHref = requireSaveHref(Astro.props.saveHref);
53
+ const cardUrl = requireHttpsUrl(Astro.props.cardUrl, 'cardUrl');
54
+ const links = buildCardLinks(person, labels);
55
+ const qrSvg = buildQrSvg({ url: cardUrl, title: labels.qrTitle });
56
+ const motion = resolveCardMotion(Astro.props.motion);
57
+ const cardForm = Astro.props.cardForm ?? CardForm.TwoSided;
58
+ if (cardForm !== CardForm.TwoSided && cardForm !== CardForm.Page) throw optionError('cardForm', 'must be two-sided or page');
59
+ const twoSided = cardForm === CardForm.TwoSided;
60
+ const openCss = buildOpenCss(motion.openMotion, motion.openLands);
61
+ const brandProps = { brand, markup: Astro.props.brandMarkup, animated: motion.openMotion !== OpenMotion.None };
62
+ const lights = tiltLights(motion.tiltMotion);
63
+ const portraitProps = { portrait, light: lights.hex };
64
+ const saveProps = { href: saveHref, label: labels.save, readyLabel: labels.ready, saveMotion: motion.saveMotion, gloss: lights.gloss };
65
+ const shareProps = { shareMode: motion.shareMode, qrSvg, cardUrl, title: labels.qrTitle, closeLabel: labels.hideQr, person, portrait, brand };
66
+ ---
67
+ <div class="tmk-card" data-contact-card data-card-form={cardForm} data-layout={twoSided ? undefined : layout} {...motionAttributes(motion)} data-testid="card">
68
+ {openCss !== '' && <style is:inline set:html={openCss} />}
69
+ {twoSided && <CardTwoSided {...{ person, portrait, brand, markup: Astro.props.brandMarkup, labels, links, saveProps, motion }} />}
70
+ {!twoSided && layout === ContactCardLayout.Portrait && (
71
+ <CardBrand {...brandProps} />
72
+ <div class="tmk-card-disc"><CardPortrait {...portraitProps} /></div>
73
+ <div class="tmk-card-main">
74
+ <CardIdentity person={person} />
75
+ <CardSave {...saveProps} />
76
+ <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Tiles} />
77
+ <CardValues links={links} />
78
+ <CardActions labels={labels} />
79
+ </div>
80
+ )}
81
+ {!twoSided && layout === ContactCardLayout.Name && (
82
+ <CardBrand {...brandProps} />
83
+ <CardIdentity person={person}><CardPortrait {...portraitProps} /></CardIdentity>
84
+ <CardSave {...saveProps} />
85
+ <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Rows} />
86
+ <CardActions labels={labels} />
87
+ )}
88
+ {!twoSided && layout === ContactCardLayout.Framed && (
89
+ <div class="tmk-card-frame" data-part="frame">
90
+ <CardBrand {...brandProps} />
91
+ <CardIdentity person={person}><CardPortrait {...portraitProps} /></CardIdentity>
92
+ <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Rows} />
93
+ </div>
94
+ <CardActions labels={labels}><CardSave {...saveProps} /></CardActions>
95
+ )}
96
+ {!twoSided && layout === ContactCardLayout.Honeycomb && (
97
+ <CardBrand {...brandProps} />
98
+ <CardIdentity person={person} />
99
+ <div class="tmk-card-comb" data-part="comb">
100
+ <CardPortrait {...portraitProps} />
101
+ <CardSave {...saveProps} />
102
+ <CardContacts links={links} label={labels.contacts} variant={CardContactsVariant.Tiles} />
103
+ </div>
104
+ <CardValues links={links} />
105
+ <CardActions labels={labels} />
106
+ )}
107
+ {motion.shareMode === ShareMode.None
108
+ ? <CardQr qrSvg={qrSvg} cardUrl={cardUrl} title={labels.qrTitle} hideLabel={labels.hideQr} qrMotion={motion.qrMotion} />
109
+ : <CardShare {...shareProps} />}
110
+ {!twoSided && lights.edge && <span class="tmk-card-edge" aria-hidden="true" data-part="edge"><span data-part="edge-light"></span></span>}
111
+ {!twoSided && lights.sweep && <span class="tmk-card-sweep" aria-hidden="true" data-part="sweep"><span data-part="sweep-band"></span></span>}
112
+ <CardDialog name="install" title={labels.installTitle} closeLabel={labels.close}>
113
+ <ol data-install-route={InstallRoute.AppleSteps} data-testid="card-install-steps" hidden>
114
+ {labels.appleSteps.map((step) => <li>{step}</li>)}
115
+ </ol>
116
+ <p data-install-route={InstallRoute.MenuHint} data-testid="card-install-hint" hidden>{labels.menuHint}</p>
117
+ </CardDialog>
118
+ </div>
119
+
120
+ <script>
121
+ import { mountContactCards } from './contactCard/mount';
122
+
123
+ mountContactCards();
124
+ </script>
@@ -0,0 +1,31 @@
1
+ ---
2
+ import type { ContactCardBrand, ContactCardBrandMarkup } from './types';
3
+
4
+ interface Props {
5
+ brand: ContactCardBrand;
6
+ markup?: ContactCardBrandMarkup | undefined;
7
+ animated: boolean;
8
+ faceLabel: string;
9
+ sweep: boolean;
10
+ hidden: boolean;
11
+ }
12
+
13
+ const { brand, markup, animated, faceLabel, sweep, hidden } = Astro.props;
14
+ const wordmark = markup?.wordmark ?? null;
15
+ const wordmarkCss = animated && wordmark !== null ? `@media (prefers-reduced-motion:no-preference){${wordmark.css}}` : '';
16
+ ---
17
+ <div class="tmk-card-face tmk-card-back" role="group" aria-label={faceLabel} data-part="back" data-testid="card-back" inert={hidden}>
18
+ <div class="tmk-card-lockup">
19
+ {markup === undefined ? (
20
+ <img class="tmk-card-back-logo" src={brand.src} width={brand.width} height={brand.height} alt="" data-part="mark" />
21
+ ) : (
22
+ <>
23
+ <span class="tmk-card-mark" aria-hidden="true" data-part="mark" data-logo-intro={animated ? '' : undefined} set:html={animated ? markup.intro : markup.still} />
24
+ {animated && <template data-mark-still set:html={markup.still} />}
25
+ {wordmark !== null && <span class="tmk-card-wordmark" aria-hidden="true" data-part="wordmark" set:html={wordmark.html} />}
26
+ {wordmarkCss !== '' && <style is:inline set:html={wordmarkCss} />}
27
+ </>
28
+ )}
29
+ </div>
30
+ {sweep && <span class="tmk-card-sweep" aria-hidden="true" data-part="back-sweep"><span data-part="back-band"></span></span>}
31
+ </div>
@@ -0,0 +1,5 @@
1
+ /** The card's shape: a two-sided card with Save contact beside it, or the full page card that follows `layout`. */
2
+ export const enum CardForm {
3
+ TwoSided = 'two-sided',
4
+ Page = 'page',
5
+ }
@@ -0,0 +1,27 @@
1
+ ---
2
+ import CardContacts from './CardContacts.astro';
3
+ import { CardContactsVariant } from './CardContactsVariant';
4
+ import CardIdentity from './CardIdentity.astro';
5
+ import type { CardLink } from './cardLinks';
6
+ import CardPortrait from './CardPortrait.astro';
7
+ import type { ContactCardPerson, ContactCardPortrait } from './types';
8
+
9
+ interface Props {
10
+ person: ContactCardPerson;
11
+ portrait: ContactCardPortrait;
12
+ links: CardLink[];
13
+ contactsLabel: string;
14
+ faceLabel: string;
15
+ hexLight: boolean;
16
+ sweep: boolean;
17
+ hidden: boolean;
18
+ }
19
+
20
+ const { person, portrait, links, contactsLabel, faceLabel, hexLight, sweep, hidden } = Astro.props;
21
+ ---
22
+ <div class="tmk-card-face tmk-card-front" role="group" aria-label={faceLabel} data-part="front" data-testid="card-front" inert={hidden}>
23
+ <CardIdentity person={person} />
24
+ <CardPortrait portrait={portrait} light={hexLight} />
25
+ <CardContacts links={links} label={contactsLabel} variant={CardContactsVariant.Rows} />
26
+ {sweep && <span class="tmk-card-sweep" aria-hidden="true" data-part="sweep"><span data-part="sweep-band"></span></span>}
27
+ </div>
@@ -3,4 +3,5 @@ export const enum CardIconName {
3
3
  Save = 'save',
4
4
  Install = 'install',
5
5
  Qr = 'qr',
6
+ Turn = 'turn',
6
7
  }
@@ -8,9 +8,10 @@ interface Props {
8
8
  label: string;
9
9
  readyLabel: string;
10
10
  saveMotion: SaveMotion;
11
+ gloss: boolean;
11
12
  }
12
13
 
13
- const { href, label, readyLabel, saveMotion } = Astro.props;
14
+ const { href, label, readyLabel, saveMotion, gloss } = Astro.props;
14
15
  const TICK = 'M5 12.5l4.5 4.5L19 7.5';
15
16
  ---
16
17
  <a class="tmk-card-save" href={href} data-part="save" data-testid="card-save">
@@ -39,5 +40,6 @@ const TICK = 'M5 12.5l4.5 4.5L19 7.5';
39
40
  </span>
40
41
  </span>
41
42
  )}
43
+ {gloss && <span class="tmk-card-gloss" aria-hidden="true" data-part="save-gloss"></span>}
42
44
  </a>
43
45
  <span class="tmk-card-live" aria-live="polite" data-part="save-live"></span>
@@ -0,0 +1,32 @@
1
+ ---
2
+ import { ShareMode } from './motion/ShareMode';
3
+ import type { ContactCardBrand, ContactCardPerson, ContactCardPortrait } from './types';
4
+
5
+ interface Props {
6
+ shareMode: ShareMode;
7
+ qrSvg: string;
8
+ cardUrl: string;
9
+ title: string;
10
+ closeLabel: string;
11
+ person: ContactCardPerson;
12
+ portrait: ContactCardPortrait;
13
+ brand: ContactCardBrand;
14
+ }
15
+
16
+ const { shareMode, qrSvg, cardUrl, title, closeLabel, person, portrait, brand } = Astro.props;
17
+ const fullName = `${person.givenName} ${person.familyName}`;
18
+ ---
19
+ <dialog class="tmk-card-share" aria-label={title} data-card-share data-share={shareMode} data-part="share" data-testid="card-share">
20
+ <div class="tmk-card-share-in">
21
+ {shareMode === ShareMode.FaceAbove && (
22
+ <div class="tmk-card-share-face" data-part="share-face"><img src={portrait.src} width={portrait.width} height={portrait.height} alt="" /></div>
23
+ )}
24
+ {shareMode === ShareMode.NightFrame && (
25
+ <img class="tmk-card-share-brand" src={brand.src} width={brand.width} height={brand.height} alt="" data-part="share-brand" />
26
+ )}
27
+ {shareMode !== ShareMode.WhiteSheet && <p class="tmk-card-share-name" data-part="share-name">{fullName}</p>}
28
+ {shareMode === ShareMode.FaceAbove && <p class="tmk-card-share-role" data-part="share-role">{person.role}</p>}
29
+ <div class="tmk-card-share-qr" data-qr-value={cardUrl} data-part="share-qr" data-testid="card-qr" set:html={qrSvg} />
30
+ <button class="tmk-card-button" type="button" autofocus data-card-share-close data-part="share-close" data-testid="card-share-close">{closeLabel}</button>
31
+ </div>
32
+ </dialog>
@@ -0,0 +1,15 @@
1
+ ---
2
+ import CardIcon from './CardIcon.astro';
3
+ import { CardIconName } from './CardIconName';
4
+
5
+ interface Props {
6
+ toBack: string;
7
+ toFront: string;
8
+ onBack: boolean;
9
+ }
10
+
11
+ const { toBack, toFront, onBack } = Astro.props;
12
+ ---
13
+ <button class="tmk-card-turn" type="button" aria-label={onBack ? toFront : toBack} data-label-back={toBack} data-label-front={toFront} data-card-turn data-part="turn" data-testid="card-turn">
14
+ <CardIcon name={CardIconName.Turn} />
15
+ </button>
@@ -0,0 +1,48 @@
1
+ ---
2
+ import CardActions from './CardActions.astro';
3
+ import CardBack from './CardBack.astro';
4
+ import CardFront from './CardFront.astro';
5
+ import type { CardLink } from './cardLinks';
6
+ import CardSave from './CardSave.astro';
7
+ import CardTurn from './CardTurn.astro';
8
+ import { requireText } from './checks';
9
+ import type { ContactCardMotion } from './motion/cardMotion';
10
+ import { OpenLanding } from './motion/OpenLanding';
11
+ import { OpenMotion } from './motion/OpenMotion';
12
+ import { tiltLights } from './motion/tiltLights';
13
+ import type { ContactCardBrand, ContactCardBrandMarkup, ContactCardLabels, ContactCardPerson, ContactCardPortrait } from './types';
14
+
15
+ interface Props {
16
+ person: ContactCardPerson;
17
+ portrait: ContactCardPortrait;
18
+ brand: ContactCardBrand;
19
+ markup?: ContactCardBrandMarkup | undefined;
20
+ labels: ContactCardLabels;
21
+ links: CardLink[];
22
+ saveProps: Parameters<typeof CardSave>[0];
23
+ motion: ContactCardMotion;
24
+ }
25
+
26
+ const { person, portrait, brand, markup, labels, links, saveProps, motion } = Astro.props;
27
+ const toBack = requireText(labels.turnToBack ?? '', 'labels.turnToBack');
28
+ const toFront = requireText(labels.turnToFront ?? '', 'labels.turnToFront');
29
+ const frontLabel = requireText(labels.cardFront ?? '', 'labels.cardFront');
30
+ const backLabel = requireText(labels.cardBack ?? '', 'labels.cardBack');
31
+ const lights = tiltLights(motion.tiltMotion);
32
+ const onBack = motion.openMotion === OpenMotion.TileGrows && motion.openLands === OpenLanding.Back;
33
+ ---
34
+ <section class="tmk-card-stage" aria-roledescription="card" aria-label={`${person.givenName} ${person.familyName}`} data-part="stage" data-testid="card-stage">
35
+ <div class="tmk-card-tilt" data-part="tilt">
36
+ <div class="tmk-card-flip" data-part="flip" data-face={onBack ? 'back' : 'front'}>
37
+ <CardFront person={person} portrait={portrait} links={links} contactsLabel={labels.contacts} faceLabel={frontLabel} hexLight={lights.hex} sweep={lights.sweep} hidden={onBack} />
38
+ <CardBack brand={brand} markup={markup} animated={motion.openMotion !== OpenMotion.None} faceLabel={backLabel} sweep={lights.sweep} hidden={!onBack} />
39
+ </div>
40
+ {lights.edge && <span class="tmk-card-edge" aria-hidden="true" data-part="edge"><span data-part="edge-light"></span></span>}
41
+ <CardTurn toBack={toBack} toFront={toFront} onBack={onBack} />
42
+ </div>
43
+ </section>
44
+ <div class="tmk-card-side" data-part="side">
45
+ <CardSave {...saveProps} />
46
+ <CardActions labels={labels} />
47
+ </div>
48
+ <span class="tmk-card-live" aria-live="polite" data-part="turn-live"></span>
@@ -7,5 +7,6 @@ export const CARD_ICONS: Readonly<Record<CardIconName | CardLinkKind, string>> =
7
7
  [CardLinkKind.Email]: '<rect x="3" y="5" width="18" height="14" rx="1.5"/><path d="m3.5 6.5 8.5 6.5 8.5-6.5"/>',
8
8
  [CardLinkKind.Website]: '<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.6 2.6 3.8 5.6 3.8 9S14.6 18.4 12 21c-2.6-2.6-3.8-5.6-3.8-9S9.4 5.6 12 3Z"/>',
9
9
  [CardIconName.Install]: '<rect x="6" y="2.5" width="12" height="19" rx="2"/><path d="M12 8v7M8.8 11.8 12 15l3.2-3.2"/>',
10
+ [CardIconName.Turn]: '<path d="M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3"/><path d="M18.5 3v4h-4M5.5 21v-4h4"/>',
10
11
  [CardIconName.Qr]: '<rect x="3.5" y="3.5" width="6.5" height="6.5"/><rect x="14" y="3.5" width="6.5" height="6.5"/><rect x="3.5" y="14" width="6.5" height="6.5"/><path d="M14 14h2.5v2.5M20.5 14v2.5M14 20.5h2.5M20.5 20.5h-1.5"/>',
11
12
  };
@@ -0,0 +1,4 @@
1
+ declare module '*.css?raw' {
2
+ const css: string;
3
+ export default css;
4
+ }
@@ -1,16 +1,20 @@
1
- export { ContactCardLayout } from './ContactCardLayout';
2
- export { ContactPhotoType } from './ContactPhotoType';
3
- export { buildContactCardManifest } from './manifest';
4
- export type { ContactCardManifestOptions } from './manifest';
5
- export { toDialNumber } from './phone';
6
- export { buildQrSvg } from './qrSvg';
7
- export type { QrSvgOptions } from './qrSvg';
8
- export type { ContactCardBrand, ContactCardBrandMarkup, ContactCardLabels, ContactCardPerson, ContactCardPortrait } from './types';
9
- export { DEFAULT_CARD_MOTION, resolveCardMotion } from './motion/cardMotion';
10
- export type { ContactCardMotion, ContactCardMotionInput } from './motion/cardMotion';
11
- export { OpenMotion } from './motion/OpenMotion';
12
- export { QrMotion } from './motion/QrMotion';
13
- export { SaveMotion } from './motion/SaveMotion';
14
- export { TiltMotion } from './motion/TiltMotion';
15
- export { buildVCard } from './vCard';
16
- export type { ContactPhoto, VCardOptions } from './vCard';
1
+ export { CardForm } from './CardForm';
2
+ export { ContactCardLayout } from './ContactCardLayout';
3
+ export { ContactPhotoType } from './ContactPhotoType';
4
+ export { buildContactCardManifest } from './manifest';
5
+ export type { ContactCardManifestOptions } from './manifest';
6
+ export { toDialNumber } from './phone';
7
+ export { buildQrSvg } from './qrSvg';
8
+ export type { QrSvgOptions } from './qrSvg';
9
+ export type { ContactCardBrand, ContactCardBrandMarkup, ContactCardLabels, ContactCardPerson, ContactCardPortrait } from './types';
10
+ export { DEFAULT_CARD_MOTION, resolveCardMotion } from './motion/cardMotion';
11
+ export type { ContactCardMotion, ContactCardMotionInput } from './motion/cardMotion';
12
+ export { FlipMotion } from './motion/FlipMotion';
13
+ export { OpenLanding } from './motion/OpenLanding';
14
+ export { OpenMotion } from './motion/OpenMotion';
15
+ export { QrMotion } from './motion/QrMotion';
16
+ export { SaveMotion } from './motion/SaveMotion';
17
+ export { ShareMode } from './motion/ShareMode';
18
+ export { TiltMotion } from './motion/TiltMotion';
19
+ export { buildVCard } from './vCard';
20
+ export type { ContactPhoto, VCardOptions } from './vCard';
@@ -0,0 +1,5 @@
1
+ /** How the two-sided card turns between its faces. */
2
+ export const enum FlipMotion {
3
+ None = 'none',
4
+ TurnOver = 'turn-over',
5
+ }
@@ -0,0 +1,6 @@
1
+ /** Which face the tile-grows opening ends on. */
2
+ export const enum OpenLanding {
3
+ TurnToFront = 'turn-to-front',
4
+ Front = 'front',
5
+ Back = 'back',
6
+ }
@@ -1,7 +1,11 @@
1
- /** How the card opens after a scan. */
1
+ /** How the card opens after a scan; the last four grow, open, turn or rise into the two-sided card. */
2
2
  export const enum OpenMotion {
3
3
  None = 'none',
4
4
  MarkFirst = 'mark-first',
5
5
  MarkLands = 'mark-lands',
6
6
  WrittenIn = 'written-in',
7
+ TileGrows = 'tile-grows',
8
+ MoonOpens = 'moon-opens',
9
+ TurnsFaceUp = 'turns-face-up',
10
+ PassRises = 'pass-rises',
7
11
  }
@@ -0,0 +1,7 @@
1
+ /** The full-screen code shown when the owner holds the phone up to be scanned. */
2
+ export const enum ShareMode {
3
+ None = 'none',
4
+ WhiteSheet = 'white-sheet',
5
+ NightFrame = 'night-frame',
6
+ FaceAbove = 'face-above',
7
+ }
@@ -1,7 +1,10 @@
1
- /** What leans when the phone tilts or a finger drags the card. */
1
+ /** What leans or shines when the phone tilts or a finger drags the card. */
2
2
  export const enum TiltMotion {
3
3
  None = 'none',
4
4
  CardLeans = 'card-leans',
5
5
  PortraitLeans = 'portrait-leans',
6
6
  LayersDrift = 'layers-drift',
7
+ LightSweeps = 'light-sweeps',
8
+ GoldGloss = 'gold-gloss',
9
+ DeepLayers = 'deep-layers',
7
10
  }
@@ -24,9 +24,9 @@ function parseBeat(line: string): Beat {
24
24
  return { part, property, from, to, atMs: Number(atMs), lengthMs: Number(lengthMs), easing: EASINGS[easing] ?? easing };
25
25
  }
26
26
 
27
- /** The beats of one option, or none for `none` and unknown keys. */
28
- export function beatsFor(key: string): Beat[] {
29
- return (BEAT_TABLE[key] ?? []).map(parseBeat);
27
+ /** The beats of one option (or of the given lines), or none for `none` and unknown keys. */
28
+ export function beatsFor(key: string, lines: readonly string[] = BEAT_TABLE[key] ?? []): Beat[] {
29
+ return lines.map(parseBeat);
30
30
  }
31
31
 
32
32
  /** The reduced-motion still: every change at once, the return at its time. */