@trypattern/sdk 0.1.26 → 0.1.27
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/components/Text.d.ts +2 -1
- package/dist/components/Text.js +23 -11
- package/dist/start.d.ts +2 -2
- package/dist/start.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +5 -0
- package/dist/theme/tokens.stylex.js +6 -1
- package/package.json +1 -1
|
@@ -5,13 +5,14 @@ type TextProps = {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
variant?: 'hero' | 'display' | 'section' | 'heading' | 'subheading' | 'title' | 'lead' | 'intro' | 'label' | 'body' | 'caption' | 'code';
|
|
7
7
|
tone?: Tone;
|
|
8
|
+
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'heavy';
|
|
8
9
|
align?: 'start' | 'center' | 'end';
|
|
9
10
|
as?: 'span' | 'p' | 'h1' | 'h2' | 'h3';
|
|
10
11
|
isTruncated?: boolean;
|
|
11
12
|
isSelectable?: boolean;
|
|
12
13
|
style?: Placement;
|
|
13
14
|
};
|
|
14
|
-
export declare function Text({ children, variant, tone, align, as, isTruncated, isSelectable, style }: TextProps): import("react").DetailedReactHTMLElement<Readonly<{
|
|
15
|
+
export declare function Text({ children, variant, tone, weight, align, as, isTruncated, isSelectable, style }: TextProps): import("react").DetailedReactHTMLElement<Readonly<{
|
|
15
16
|
className?: string;
|
|
16
17
|
'data-style-src'?: string;
|
|
17
18
|
style?: Readonly<{
|
package/dist/components/Text.js
CHANGED
|
@@ -2,8 +2,8 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { breakpoints, fontSizes, fontWeights, fonts, lineHeights, trackings } from "../theme/tokens.stylex.js";
|
|
4
4
|
import { tones } from "./tones.js";
|
|
5
|
-
export function Text({ children, variant = 'body', tone = 'inherit', align, as = 'span', isTruncated = false, isSelectable = false, style }) {
|
|
6
|
-
return createElement(as, stylex.props(as !== 'span' && styles.block, variants[variant], tones[tone], align !== undefined && alignments[align], isTruncated && styles.truncated, isSelectable && styles.selectable, style), children);
|
|
5
|
+
export function Text({ children, variant = 'body', tone = 'inherit', weight, align, as = 'span', isTruncated = false, isSelectable = false, style }) {
|
|
6
|
+
return createElement(as, stylex.props(as !== 'span' && styles.block, variants[variant], tones[tone], weight !== undefined && weights[weight], align !== undefined && alignments[align], isTruncated && styles.truncated, isSelectable && styles.selectable, style), children);
|
|
7
7
|
}
|
|
8
8
|
const styles = stylex.create({
|
|
9
9
|
block: {
|
|
@@ -22,11 +22,12 @@ const styles = stylex.create({
|
|
|
22
22
|
});
|
|
23
23
|
const variants = stylex.create({
|
|
24
24
|
hero: {
|
|
25
|
+
fontFamily: fonts.heading,
|
|
25
26
|
fontSize: {
|
|
26
27
|
default: fontSizes.heading1,
|
|
27
28
|
[breakpoints.compact]: fontSizes.heading2
|
|
28
29
|
},
|
|
29
|
-
fontWeight: fontWeights.
|
|
30
|
+
fontWeight: fontWeights.heading,
|
|
30
31
|
lineHeight: {
|
|
31
32
|
default: lineHeights.heading1,
|
|
32
33
|
[breakpoints.compact]: lineHeights.heading2
|
|
@@ -34,11 +35,12 @@ const variants = stylex.create({
|
|
|
34
35
|
letterSpacing: trackings.hero
|
|
35
36
|
},
|
|
36
37
|
display: {
|
|
38
|
+
fontFamily: fonts.heading,
|
|
37
39
|
fontSize: {
|
|
38
40
|
default: fontSizes.heading2,
|
|
39
41
|
[breakpoints.compact]: fontSizes.heading3
|
|
40
42
|
},
|
|
41
|
-
fontWeight: fontWeights.
|
|
43
|
+
fontWeight: fontWeights.heading,
|
|
42
44
|
lineHeight: {
|
|
43
45
|
default: lineHeights.heading2,
|
|
44
46
|
[breakpoints.compact]: lineHeights.heading3
|
|
@@ -46,11 +48,12 @@ const variants = stylex.create({
|
|
|
46
48
|
letterSpacing: trackings.display
|
|
47
49
|
},
|
|
48
50
|
section: {
|
|
51
|
+
fontFamily: fonts.heading,
|
|
49
52
|
fontSize: {
|
|
50
53
|
default: fontSizes.heading3,
|
|
51
54
|
[breakpoints.compact]: fontSizes.heading5
|
|
52
55
|
},
|
|
53
|
-
fontWeight: fontWeights.
|
|
56
|
+
fontWeight: fontWeights.heading,
|
|
54
57
|
lineHeight: {
|
|
55
58
|
default: lineHeights.heading3,
|
|
56
59
|
[breakpoints.compact]: lineHeights.heading5
|
|
@@ -58,14 +61,16 @@ const variants = stylex.create({
|
|
|
58
61
|
letterSpacing: trackings.section
|
|
59
62
|
},
|
|
60
63
|
heading: {
|
|
64
|
+
fontFamily: fonts.heading,
|
|
61
65
|
fontSize: fontSizes.heading5,
|
|
62
|
-
fontWeight: fontWeights.
|
|
66
|
+
fontWeight: fontWeights.heading,
|
|
63
67
|
lineHeight: lineHeights.heading5,
|
|
64
68
|
letterSpacing: trackings.heading
|
|
65
69
|
},
|
|
66
70
|
subheading: {
|
|
71
|
+
fontFamily: fonts.heading,
|
|
67
72
|
fontSize: fontSizes.heading6,
|
|
68
|
-
fontWeight: fontWeights.
|
|
73
|
+
fontWeight: fontWeights.heading,
|
|
69
74
|
lineHeight: lineHeights.heading6
|
|
70
75
|
},
|
|
71
76
|
title: {
|
|
@@ -86,23 +91,23 @@ const variants = stylex.create({
|
|
|
86
91
|
label: {
|
|
87
92
|
fontSize: {
|
|
88
93
|
default: fontSizes.bodySm,
|
|
89
|
-
[breakpoints.compact]: fontSizes.
|
|
94
|
+
[breakpoints.compact]: fontSizes.bodyCompact
|
|
90
95
|
},
|
|
91
96
|
fontWeight: fontWeights.medium,
|
|
92
97
|
lineHeight: {
|
|
93
98
|
default: lineHeights.bodySm,
|
|
94
|
-
[breakpoints.compact]: lineHeights.
|
|
99
|
+
[breakpoints.compact]: lineHeights.bodyCompact
|
|
95
100
|
}
|
|
96
101
|
},
|
|
97
102
|
body: {
|
|
98
103
|
fontSize: {
|
|
99
104
|
default: fontSizes.bodySm,
|
|
100
|
-
[breakpoints.compact]: fontSizes.
|
|
105
|
+
[breakpoints.compact]: fontSizes.bodyCompact
|
|
101
106
|
},
|
|
102
107
|
fontWeight: fontWeights.normal,
|
|
103
108
|
lineHeight: {
|
|
104
109
|
default: lineHeights.bodySm,
|
|
105
|
-
[breakpoints.compact]: lineHeights.
|
|
110
|
+
[breakpoints.compact]: lineHeights.bodyCompact
|
|
106
111
|
}
|
|
107
112
|
},
|
|
108
113
|
caption: {
|
|
@@ -117,6 +122,13 @@ const variants = stylex.create({
|
|
|
117
122
|
lineHeight: lineHeights.bodySm
|
|
118
123
|
}
|
|
119
124
|
});
|
|
125
|
+
const weights = stylex.create({
|
|
126
|
+
normal: { fontWeight: fontWeights.normal },
|
|
127
|
+
medium: { fontWeight: fontWeights.medium },
|
|
128
|
+
semibold: { fontWeight: fontWeights.semibold },
|
|
129
|
+
bold: { fontWeight: fontWeights.bold },
|
|
130
|
+
heavy: { fontWeight: fontWeights.heavy }
|
|
131
|
+
});
|
|
120
132
|
const alignments = stylex.create({
|
|
121
133
|
start: { textAlign: 'start' },
|
|
122
134
|
center: { textAlign: 'center' },
|
package/dist/start.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { IconDrawing } from './components/icons.ts';
|
|
|
5
5
|
import type { Interaction } from './components/interaction.ts';
|
|
6
6
|
import type { ReactApp } from './hooks/appContext.ts';
|
|
7
7
|
import type { Tables } from './table.ts';
|
|
8
|
-
import { borders, colors, controls, fontSizes, fonts, iconSizes, lineHeights, radii, shadows, space, widths } from './theme/tokens.stylex.ts';
|
|
9
|
-
type Themeable = typeof colors | typeof radii | typeof fonts | typeof shadows | typeof space | typeof fontSizes | typeof lineHeights | typeof controls | typeof iconSizes | typeof borders | typeof widths;
|
|
8
|
+
import { borders, colors, controls, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, trackings, widths } from './theme/tokens.stylex.ts';
|
|
9
|
+
type Themeable = typeof colors | typeof radii | typeof fonts | typeof shadows | typeof space | typeof fontSizes | typeof fontWeights | typeof lineHeights | typeof trackings | typeof controls | typeof iconSizes | typeof borders | typeof widths;
|
|
10
10
|
export type StartOptions = {
|
|
11
11
|
theme?: readonly Theme<Themeable>[];
|
|
12
12
|
icons?: Readonly<Record<string, IconDrawing>>;
|
package/dist/start.js
CHANGED
|
@@ -12,7 +12,7 @@ import { manualClock, realClock } from "./clock.js";
|
|
|
12
12
|
import { Gate } from "./gate.js";
|
|
13
13
|
import { AppProvider } from "./hooks/appContext.js";
|
|
14
14
|
import { routeObjects } from "./routes.js";
|
|
15
|
-
import { borders, breakpoints, colors, controls, fontFeatures, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, widths } from "./theme/tokens.stylex.js";
|
|
15
|
+
import { borders, breakpoints, colors, controls, fontFeatures, fontSizes, fontWeights, fonts, iconSizes, lineHeights, radii, shadows, space, trackings, widths } from "./theme/tokens.stylex.js";
|
|
16
16
|
const TEST_SEED = 'patternSeed';
|
|
17
17
|
const INLINE_DATA_ID = 'pattern-data';
|
|
18
18
|
const TEST_ADMINS = 'patternAdmins';
|
|
@@ -174,6 +174,7 @@ export declare const fontSizes: stylex.VarGroup<Readonly<{
|
|
|
174
174
|
bodyMd: string;
|
|
175
175
|
bodyBase: string;
|
|
176
176
|
bodyLg: string;
|
|
177
|
+
bodyCompact: string;
|
|
177
178
|
heading6: string;
|
|
178
179
|
heading5: string;
|
|
179
180
|
heading4: string;
|
|
@@ -194,6 +195,7 @@ export declare const lineHeights: stylex.VarGroup<Readonly<{
|
|
|
194
195
|
bodySm: string;
|
|
195
196
|
body: string;
|
|
196
197
|
bodyLg: string;
|
|
198
|
+
bodyCompact: string;
|
|
197
199
|
heading6: string;
|
|
198
200
|
heading5: string;
|
|
199
201
|
heading4: string;
|
|
@@ -203,6 +205,7 @@ export declare const lineHeights: stylex.VarGroup<Readonly<{
|
|
|
203
205
|
}>, symbol>;
|
|
204
206
|
export declare const fonts: stylex.VarGroup<Readonly<{
|
|
205
207
|
sans: string;
|
|
208
|
+
heading: string;
|
|
206
209
|
mono: string;
|
|
207
210
|
}>, symbol>;
|
|
208
211
|
export declare const fontFeatures: stylex.VarGroup<Readonly<{
|
|
@@ -215,6 +218,8 @@ export declare const fontWeights: stylex.VarGroup<Readonly<{
|
|
|
215
218
|
medium: string;
|
|
216
219
|
semibold: string;
|
|
217
220
|
bold: string;
|
|
221
|
+
heavy: string;
|
|
222
|
+
heading: string;
|
|
218
223
|
}>, symbol>;
|
|
219
224
|
export declare const shadows: stylex.VarGroup<Readonly<{
|
|
220
225
|
border: string;
|
|
@@ -174,6 +174,7 @@ export const fontSizes = stylex.defineVars({
|
|
|
174
174
|
bodyMd: '14px',
|
|
175
175
|
bodyBase: '15px',
|
|
176
176
|
bodyLg: '18px',
|
|
177
|
+
bodyCompact: '15px',
|
|
177
178
|
heading6: '20px',
|
|
178
179
|
heading5: '24px',
|
|
179
180
|
heading4: '28px',
|
|
@@ -194,6 +195,7 @@ export const lineHeights = stylex.defineVars({
|
|
|
194
195
|
bodySm: '20px',
|
|
195
196
|
body: '24px',
|
|
196
197
|
bodyLg: '28px',
|
|
198
|
+
bodyCompact: '24px',
|
|
197
199
|
heading6: '24px',
|
|
198
200
|
heading5: '32px',
|
|
199
201
|
heading4: '36px',
|
|
@@ -203,6 +205,7 @@ export const lineHeights = stylex.defineVars({
|
|
|
203
205
|
});
|
|
204
206
|
export const fonts = stylex.defineVars({
|
|
205
207
|
sans: '"Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
|
|
208
|
+
heading: '"Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
|
|
206
209
|
mono: 'ui-monospace, SFMono-Regular, Menlo, monospace'
|
|
207
210
|
});
|
|
208
211
|
export const fontFeatures = stylex.defineVars({
|
|
@@ -214,7 +217,9 @@ export const fontWeights = stylex.defineVars({
|
|
|
214
217
|
semimedium: '450',
|
|
215
218
|
medium: '500',
|
|
216
219
|
semibold: '600',
|
|
217
|
-
bold: '700'
|
|
220
|
+
bold: '700',
|
|
221
|
+
heavy: '800',
|
|
222
|
+
heading: '500'
|
|
218
223
|
});
|
|
219
224
|
export const shadows = stylex.defineVars({
|
|
220
225
|
border: '0 0 0 1px light-dark(#00000012, #ffffff12)',
|