@farcaster/snap 2.6.0 → 2.6.1
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/react/components/text.js +1 -7
- package/dist/react-native/components/snap-text.js +1 -7
- package/dist/ui/catalog.js +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/src/react/components/text.tsx +1 -8
- package/src/react-native/components/snap-text.tsx +1 -8
- package/src/ui/catalog.ts +1 -1
|
@@ -4,7 +4,6 @@ import { Text } from "@neynar/ui/typography";
|
|
|
4
4
|
import { cn } from "@neynar/ui/utils";
|
|
5
5
|
import { useSnapColors } from "../hooks/use-snap-colors.js";
|
|
6
6
|
import { useSnapStackDirection } from "../stack-direction-context.js";
|
|
7
|
-
import { useSnapVersion } from "../snap-version-context.js";
|
|
8
7
|
const SIZE_MAP = {
|
|
9
8
|
md: { textSize: "base" },
|
|
10
9
|
sm: { textSize: "sm" },
|
|
@@ -17,13 +16,8 @@ export function SnapText({ element: { props }, }) {
|
|
|
17
16
|
const config = SIZE_MAP[size] ?? SIZE_MAP.md;
|
|
18
17
|
const colors = useSnapColors();
|
|
19
18
|
const stackDir = useSnapStackDirection();
|
|
20
|
-
const snapVersion = useSnapVersion();
|
|
21
19
|
const inHorizontalStack = stackDir === "horizontal";
|
|
22
|
-
const maxLines = typeof props.maxLines === "number"
|
|
23
|
-
? props.maxLines
|
|
24
|
-
: snapVersion === "2.0"
|
|
25
|
-
? 1
|
|
26
|
-
: undefined;
|
|
20
|
+
const maxLines = typeof props.maxLines === "number" ? props.maxLines : undefined;
|
|
27
21
|
return (_jsx(Text, { size: config.textSize, weight: weight, align: align, className: cn(
|
|
28
22
|
/**
|
|
29
23
|
* Row peers hug content like RN `wrapRow` — `min-w-0 shrink` lets text wrap
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { StyleSheet, Text, View } from "react-native";
|
|
3
3
|
import { useSnapStackDirection } from "../stack-direction-context.js";
|
|
4
|
-
import { useSnapVersion } from "../snap-version-context.js";
|
|
5
4
|
import { useSnapTheme } from "../theme.js";
|
|
6
5
|
const SIZE_STYLES = {
|
|
7
6
|
md: { fontSize: 16, lineHeight: 22 },
|
|
@@ -17,16 +16,11 @@ export function SnapText({ element: { props }, }) {
|
|
|
17
16
|
const size = String(props.size ?? "md");
|
|
18
17
|
const weight = props.weight ? String(props.weight) : undefined;
|
|
19
18
|
const align = props.align ?? undefined;
|
|
20
|
-
const snapVersion = useSnapVersion();
|
|
21
19
|
const sizeStyle = SIZE_STYLES[size] ?? SIZE_STYLES.md;
|
|
22
20
|
const resolvedWeight = weight ? WEIGHT_MAP[weight] : sizeStyle?.fontWeight;
|
|
23
21
|
const textAlign = align === "center" ? "center" : align === "right" ? "right" : "left";
|
|
24
22
|
const inHorizontalStack = useSnapStackDirection() === "horizontal";
|
|
25
|
-
const maxLines = typeof props.maxLines === "number"
|
|
26
|
-
? props.maxLines
|
|
27
|
-
: snapVersion === "2.0"
|
|
28
|
-
? 1
|
|
29
|
-
: undefined;
|
|
23
|
+
const maxLines = typeof props.maxLines === "number" ? props.maxLines : undefined;
|
|
30
24
|
return (_jsx(View, { style: inHorizontalStack ? styles.wrapRow : styles.wrapCol, children: _jsx(Text, { style: [
|
|
31
25
|
styles.base,
|
|
32
26
|
{
|
package/dist/ui/catalog.js
CHANGED
|
@@ -87,7 +87,7 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
|
|
|
87
87
|
},
|
|
88
88
|
text: {
|
|
89
89
|
props: textProps,
|
|
90
|
-
description: "Text block — size: md (body, default), sm (caption). Optional weight, align, and maxLines.
|
|
90
|
+
description: "Text block — size: md (body, default), sm (caption). Optional weight, align, and maxLines. Text does not clamp by default; set maxLines to bound rendered lines.",
|
|
91
91
|
},
|
|
92
92
|
bar_chart: {
|
|
93
93
|
props: barChartProps,
|
package/llms.txt
CHANGED
|
@@ -85,7 +85,7 @@ Top-level fields: `version` (required, `"1.0"` or `"2.0"`), `theme` (optional, `
|
|
|
85
85
|
- `size` (optional): `"md"` (body) | `"sm"` (caption). Default: `"md"`
|
|
86
86
|
- `weight` (optional): `"bold"` | `"normal"`. Default: `"normal"`
|
|
87
87
|
- `align` (optional): `"left"` | `"center"` | `"right"`. Default: `"left"`
|
|
88
|
-
- `maxLines` (optional): integer 1–6. Default
|
|
88
|
+
- `maxLines` (optional): integer 1–6. Default: no clamp. Set this when body text should use a bounded number of visible lines.
|
|
89
89
|
|
|
90
90
|
### Data Components
|
|
91
91
|
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import { Text } from "@neynar/ui/typography";
|
|
|
4
4
|
import { cn } from "@neynar/ui/utils";
|
|
5
5
|
import { useSnapColors } from "../hooks/use-snap-colors";
|
|
6
6
|
import { useSnapStackDirection } from "../stack-direction-context";
|
|
7
|
-
import { useSnapVersion } from "../snap-version-context";
|
|
8
7
|
|
|
9
8
|
const SIZE_MAP = {
|
|
10
9
|
md: { textSize: "base" as const },
|
|
@@ -23,14 +22,8 @@ export function SnapText({
|
|
|
23
22
|
const config = SIZE_MAP[size] ?? SIZE_MAP.md;
|
|
24
23
|
const colors = useSnapColors();
|
|
25
24
|
const stackDir = useSnapStackDirection();
|
|
26
|
-
const snapVersion = useSnapVersion();
|
|
27
25
|
const inHorizontalStack = stackDir === "horizontal";
|
|
28
|
-
const maxLines =
|
|
29
|
-
typeof props.maxLines === "number"
|
|
30
|
-
? props.maxLines
|
|
31
|
-
: snapVersion === "2.0"
|
|
32
|
-
? 1
|
|
33
|
-
: undefined;
|
|
26
|
+
const maxLines = typeof props.maxLines === "number" ? props.maxLines : undefined;
|
|
34
27
|
|
|
35
28
|
return (
|
|
36
29
|
<Text
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ComponentRenderProps } from "@json-render/react-native";
|
|
2
2
|
import { StyleSheet, Text, View } from "react-native";
|
|
3
3
|
import { useSnapStackDirection } from "../stack-direction-context";
|
|
4
|
-
import { useSnapVersion } from "../snap-version-context";
|
|
5
4
|
import { useSnapTheme } from "../theme";
|
|
6
5
|
|
|
7
6
|
const SIZE_STYLES: Record<string, { fontSize: number; lineHeight?: number; fontWeight?: "400" | "500" | "600" | "700" }> = {
|
|
@@ -22,18 +21,12 @@ export function SnapText({
|
|
|
22
21
|
const size = String(props.size ?? "md");
|
|
23
22
|
const weight = props.weight ? String(props.weight) : undefined;
|
|
24
23
|
const align = (props.align as "left" | "center" | "right" | undefined) ?? undefined;
|
|
25
|
-
const snapVersion = useSnapVersion();
|
|
26
24
|
|
|
27
25
|
const sizeStyle = SIZE_STYLES[size] ?? SIZE_STYLES.md;
|
|
28
26
|
const resolvedWeight = weight ? WEIGHT_MAP[weight] : sizeStyle?.fontWeight;
|
|
29
27
|
const textAlign = align === "center" ? "center" : align === "right" ? "right" : "left";
|
|
30
28
|
const inHorizontalStack = useSnapStackDirection() === "horizontal";
|
|
31
|
-
const maxLines =
|
|
32
|
-
typeof props.maxLines === "number"
|
|
33
|
-
? props.maxLines
|
|
34
|
-
: snapVersion === "2.0"
|
|
35
|
-
? 1
|
|
36
|
-
: undefined;
|
|
29
|
+
const maxLines = typeof props.maxLines === "number" ? props.maxLines : undefined;
|
|
37
30
|
|
|
38
31
|
return (
|
|
39
32
|
<View style={inHorizontalStack ? styles.wrapRow : styles.wrapCol}>
|
package/src/ui/catalog.ts
CHANGED
|
@@ -104,7 +104,7 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
|
|
|
104
104
|
text: {
|
|
105
105
|
props: textProps,
|
|
106
106
|
description:
|
|
107
|
-
"Text block — size: md (body, default), sm (caption). Optional weight, align, and maxLines.
|
|
107
|
+
"Text block — size: md (body, default), sm (caption). Optional weight, align, and maxLines. Text does not clamp by default; set maxLines to bound rendered lines.",
|
|
108
108
|
},
|
|
109
109
|
bar_chart: {
|
|
110
110
|
props: barChartProps,
|