@trypattern/sdk 0.1.36 → 0.1.37

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/cli/app.js CHANGED
@@ -1598,6 +1598,9 @@ function installShim() {
1598
1598
  path: SHIM_PATH
1599
1599
  };
1600
1600
  }
1601
+ const NO_MATCHING = 'ERR_PNPM_NO_MATCHING_VERSION';
1602
+ const NPM_SETTLE_TRIES = 8;
1603
+ const NPM_SETTLE_MS = 15_000;
1601
1604
  async function update() {
1602
1605
  const current = sdkVersion();
1603
1606
  const latest = await latestPattern(true);
@@ -1616,7 +1619,12 @@ async function update() {
1616
1619
  };
1617
1620
  }
1618
1621
  say(`Updating Pattern ${current} → ${latest}`);
1619
- const installed = await capture('pnpm', ['add', `@trypattern/sdk@${latest}`]);
1622
+ let installed = await capture('pnpm', ['add', `@trypattern/sdk@${latest}`]);
1623
+ for (let attempt = 1; attempt <= NPM_SETTLE_TRIES && installed.output.includes(NO_MATCHING); attempt += 1) {
1624
+ say(` npm is still sharing Pattern ${latest}, trying again in a moment`);
1625
+ await sleep(NPM_SETTLE_MS);
1626
+ installed = await capture('pnpm', ['add', `@trypattern/sdk@${latest}`]);
1627
+ }
1620
1628
  if (installed.code !== 0) {
1621
1629
  return {
1622
1630
  code: 1,
@@ -1,8 +1,10 @@
1
1
  import type { Placement } from './Placement.ts';
2
+ type SkeletonText = 'heading' | 'subheading' | 'title' | 'lead' | 'label' | 'body' | 'caption';
2
3
  type SkeletonProps = {
3
4
  variant?: 'text' | 'heading' | 'icon' | 'card';
4
- width?: 'sm' | 'md' | 'lg' | 'full';
5
+ text?: SkeletonText;
6
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'full';
5
7
  style?: Placement;
6
8
  };
7
- export declare function Skeleton({ variant, width, style }: SkeletonProps): import("react").JSX.Element;
9
+ export declare function Skeleton({ variant, text, width, style }: SkeletonProps): import("react").JSX.Element;
8
10
  export {};
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as stylex from '@stylexjs/stylex';
3
- import { breakpoints, colors, iconSizes, lineHeights, motion, radii, space } from "../theme/tokens.stylex.js";
4
- export function Skeleton({ variant = 'text', width = 'full', style }) {
3
+ import { breakpoints, colors, fontSizes, iconSizes, lineHeights, motion, radii, space } from "../theme/tokens.stylex.js";
4
+ export function Skeleton({ variant = 'text', text, width = 'full', style }) {
5
+ if (text !== undefined) {
6
+ return (_jsx("span", { ...stylex.props(styles.line, lines[text], widthsOf[width], style), children: _jsx("span", { ...stylex.props(styles.skeleton, styles.bar, bars[text]) }) }));
7
+ }
5
8
  return (_jsx("span", { ...stylex.props(styles.skeleton, variant !== 'icon' && widthsOf[width], variants[variant], style) }));
6
9
  }
7
10
  const pulse = stylex.keyframes({
@@ -19,8 +22,56 @@ const styles = stylex.create({
19
22
  animationDuration: motion.pulse,
20
23
  animationTimingFunction: motion.easeInOut,
21
24
  animationIterationCount: 'infinite'
25
+ },
26
+ line: {
27
+ display: 'flex',
28
+ flexShrink: 0,
29
+ alignItems: 'center',
30
+ maxWidth: '100%'
31
+ },
32
+ bar: {
33
+ width: '100%',
34
+ borderRadius: radii.sm
22
35
  }
23
36
  });
37
+ const lines = stylex.create({
38
+ heading: { height: lineHeights.heading5 },
39
+ subheading: { height: lineHeights.heading6 },
40
+ title: { height: lineHeights.body },
41
+ lead: { height: lineHeights.body },
42
+ label: {
43
+ height: {
44
+ default: lineHeights.bodySm,
45
+ [breakpoints.compact]: lineHeights.bodyCompact
46
+ }
47
+ },
48
+ body: {
49
+ height: {
50
+ default: lineHeights.bodySm,
51
+ [breakpoints.compact]: lineHeights.bodyCompact
52
+ }
53
+ },
54
+ caption: { height: lineHeights.caption }
55
+ });
56
+ const bars = stylex.create({
57
+ heading: { height: fontSizes.heading5 },
58
+ subheading: { height: fontSizes.heading6 },
59
+ title: { height: fontSizes.bodyBase },
60
+ lead: { height: fontSizes.bodyBase },
61
+ label: {
62
+ height: {
63
+ default: fontSizes.bodySm,
64
+ [breakpoints.compact]: fontSizes.bodyCompact
65
+ }
66
+ },
67
+ body: {
68
+ height: {
69
+ default: fontSizes.bodySm,
70
+ [breakpoints.compact]: fontSizes.bodyCompact
71
+ }
72
+ },
73
+ caption: { height: fontSizes.captionLg }
74
+ });
24
75
  const variants = stylex.create({
25
76
  text: {
26
77
  height: lineHeights.caption,
@@ -41,6 +92,7 @@ const variants = stylex.create({
41
92
  }
42
93
  });
43
94
  const widthsOf = stylex.create({
95
+ xs: { width: `calc(${space.xxxl} + ${space.lg})` },
44
96
  sm: { width: '25%' },
45
97
  md: { width: '40%' },
46
98
  lg: { width: '60%' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trypattern/sdk",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",