@vinaverse/react-native 0.0.0-stage → 0.1.0-alpha.10
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/LICENSE +202 -0
- package/README.md +302 -2
- package/dist/ask.cjs +62 -0
- package/dist/ask.cjs.map +1 -0
- package/dist/ask.d.cts +38 -0
- package/dist/ask.d.ts +38 -0
- package/dist/ask.js +5 -0
- package/dist/ask.js.map +1 -0
- package/dist/chat.cjs +273 -0
- package/dist/chat.cjs.map +1 -0
- package/dist/chat.d.cts +490 -0
- package/dist/chat.d.ts +490 -0
- package/dist/chat.js +4 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunk-43I4ZAEK.js +2607 -0
- package/dist/chunk-43I4ZAEK.js.map +1 -0
- package/dist/chunk-6QYDPGRS.cjs +97 -0
- package/dist/chunk-6QYDPGRS.cjs.map +1 -0
- package/dist/chunk-7KPCO443.js +74 -0
- package/dist/chunk-7KPCO443.js.map +1 -0
- package/dist/chunk-EFEXTVIT.js +88 -0
- package/dist/chunk-EFEXTVIT.js.map +1 -0
- package/dist/chunk-MG32E4JI.cjs +268 -0
- package/dist/chunk-MG32E4JI.cjs.map +1 -0
- package/dist/chunk-NMKJ7LIJ.cjs +76 -0
- package/dist/chunk-NMKJ7LIJ.cjs.map +1 -0
- package/dist/chunk-NRYNK7E4.cjs +2699 -0
- package/dist/chunk-NRYNK7E4.cjs.map +1 -0
- package/dist/chunk-POJP52GE.js +261 -0
- package/dist/chunk-POJP52GE.js.map +1 -0
- package/dist/index.cjs +303 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/launcher.cjs +86 -0
- package/dist/launcher.cjs.map +1 -0
- package/dist/launcher.d.cts +122 -0
- package/dist/launcher.d.ts +122 -0
- package/dist/launcher.js +5 -0
- package/dist/launcher.js.map +1 -0
- package/dist/theme-BhiEGv64.d.cts +35 -0
- package/dist/theme-BhiEGv64.d.ts +35 -0
- package/package.json +242 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk6QYDPGRS_cjs = require('./chunk-6QYDPGRS.cjs');
|
|
4
|
+
var react = require('@vinaverse/react');
|
|
5
|
+
var agent = require('@vinaverse/react/agent');
|
|
6
|
+
var react$1 = require('react');
|
|
7
|
+
var reactNative = require('react-native');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function AskAboutRow(props) {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunk6QYDPGRS_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(Row, { ...props }) }) });
|
|
12
|
+
}
|
|
13
|
+
function Row(props) {
|
|
14
|
+
const { t } = react.useCopy();
|
|
15
|
+
const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
|
|
16
|
+
const name = agent.useAgentName(t("agentFallbackName"));
|
|
17
|
+
const runtime = agent.useAgentRuntime();
|
|
18
|
+
agent.useAgentStatus();
|
|
19
|
+
chunk6QYDPGRS_cjs.useAgentSweep(runtime);
|
|
20
|
+
const [shows] = react$1.useState(() => !!runtime.getStatus()?.available);
|
|
21
|
+
if (!shows) return null;
|
|
22
|
+
const { Mark, appearance: look } = props;
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
reactNative.Pressable,
|
|
25
|
+
{
|
|
26
|
+
accessibilityRole: "button",
|
|
27
|
+
accessibilityLabel: props.body ? `${props.title}. ${props.body}` : props.title,
|
|
28
|
+
onPress: () => props.onPress({ entryPoint: "ask" }),
|
|
29
|
+
style: ({ pressed }) => ({
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: space.md,
|
|
33
|
+
padding: space.md,
|
|
34
|
+
borderRadius: radius.lg,
|
|
35
|
+
backgroundColor: look?.background ?? colors.surface,
|
|
36
|
+
opacity: pressed ? 0.85 : 1
|
|
37
|
+
}),
|
|
38
|
+
testID: props.testID ?? "vinaverse-ask-about",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
reactNative.View,
|
|
42
|
+
{
|
|
43
|
+
style: {
|
|
44
|
+
width: 36,
|
|
45
|
+
height: 36,
|
|
46
|
+
borderRadius: 18,
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
backgroundColor: colors.primary
|
|
50
|
+
},
|
|
51
|
+
children: Mark ? /* @__PURE__ */ jsxRuntime.jsx(Mark, { size: 22, color: colors.onPrimary }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.onPrimary, fontWeight: "600" }, children: (name.trim()[0] ?? "?").toUpperCase() })
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { flex: 1, gap: space.xxs }, children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
reactNative.Text,
|
|
57
|
+
{
|
|
58
|
+
style: {
|
|
59
|
+
color: colors.text,
|
|
60
|
+
fontSize: font.size.md,
|
|
61
|
+
fontWeight: "600"
|
|
62
|
+
},
|
|
63
|
+
children: props.title
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
props.body ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.textMuted, fontSize: font.size.sm }, children: props.body }) : null
|
|
67
|
+
] }),
|
|
68
|
+
look?.chevron === false ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.textMuted, fontSize: font.size.lg }, children: "\u203A" })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.AskAboutRow = AskAboutRow;
|
|
75
|
+
//# sourceMappingURL=chunk-NMKJ7LIJ.cjs.map
|
|
76
|
+
//# sourceMappingURL=chunk-NMKJ7LIJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AskAboutRow.tsx"],"names":["jsx","CopyProvider","ThemeProvider","useCopy","useTheme","useAgentName","useAgentRuntime","useAgentStatus","useAgentSweep","useState","jsxs","Pressable","View","Text"],"mappings":";;;;;;;;;AA+CO,SAAS,YAAY,KAAA,EAAoC;AAC9D,EAAA,uBACEA,cAAA,CAACC,sBAAa,MAAA,EAAQ,KAAA,CAAM,QAAQ,IAAA,EAAM,KAAA,CAAM,MAC9C,QAAA,kBAAAD,cAAA,CAACE,+BAAA,EAAA,EAAc,OAAO,KAAA,CAAM,KAAA,EAAO,aAAa,KAAA,CAAM,WAAA,EACpD,yCAAC,GAAA,EAAA,EAAK,GAAG,KAAA,EAAO,CAAA,EAClB,CAAA,EACF,CAAA;AAEJ;AAEA,SAAS,IAAI,KAAA,EAAoC;AAC/C,EAAA,MAAM,EAAE,CAAA,EAAE,GAAIC,aAAA,EAAQ;AACtB,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAA,EAAQ,KAAA,EAAO,IAAA,KAASC,0BAAA,EAAS;AACjD,EAAA,MAAM,IAAA,GAAOC,kBAAA,CAAa,CAAA,CAAE,mBAAmB,CAAC,CAAA;AAChD,EAAA,MAAM,UAAUC,qBAAA,EAAgB;AAChC,EAAAC,oBAAA,EAAe;AACf,EAAAC,+BAAA,CAAc,OAAO,CAAA;AAGrB,EAAA,MAAM,CAAC,KAAK,CAAA,GAAIC,gBAAA,CAAS,MAAM,CAAC,CAAC,OAAA,CAAQ,SAAA,EAAU,EAAG,SAAS,CAAA;AAC/D,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AACnB,EAAA,MAAM,EAAE,IAAA,EA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EAAE,OAAO,MAAA,CAAO,SAAA,EAAW,UAAA,EAAY,KAAA,EAAM,EACtD,QAAA,EAAA,CAAA,IAAA,CAAK,IAAA,EAAK,CAAE,CAAC,CAAA,IAAK,GAAA,EAAK,WAAA,EAAY,EACvC;AAAA;AAAA,SAEJ;AAAA,wBACAH,eAAA,CAACE,oBAAK,KAAA,EAAO,EAAE,MAAM,CAAA,EAAG,GAAA,EAAK,KAAA,CAAM,GAAA,EAAI,EACrC,QAAA,EAAA;AAAA,0BAAAZ,cAAA;AAAA,YAACa,gBAAA;AAAA,YAAA;AAAA,cACC,KAAA,EAAO;AAAA,gBACL,OAAO,MAAA,CAAO,IAAA;AAAA,gBACd,QAAA,EAAU,KAAK,IAAA,CAAK,EAAA;AAAA,gBACpB,UAAA,EAAY;AAAA,eACd;AAAA,cAEC,QAAA,EAAA,KAAA,CAAM;AAAA;AAAA,WACT;AAAA,UACC,MAAM,IAAA,mBACLb,cAAA,CAACa,gBAAA,EAAA,EAAK,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,CAAO,SAAA,EAAW,QAAA,EAAU,KAAK,IAAA,CAAK,EAAA,EAAG,EAC5D,QAAA,EAAA,KAAA,CAAM,MACT,CAAA,GACE;AAAA,SAAA,EACN,CAAA;AAAA,QACC,MAAM,OAAA,KAAY,KAAA,GAAQ,IAAA,mBACzBb,cAAA,CAACa,oBAAK,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,CAAO,WAAW,QAAA,EAAU,IAAA,CAAK,IAAA,CAAK,EAAA,IAAM,QAAA,EAAA,QAAA,EAElE;AAAA;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-NMKJ7LIJ.cjs","sourcesContent":["// \"Ask the agent about this\" on one of the app's own pages (a professional's, a space's, a booking's): a row that opens\n// the agent told the place. It shows only when the agent is available, decided once as the page draws, from the status\n// already read, so it never appears or disappears under content the person is reading.\nimport { type CopyOverrides, CopyProvider, useCopy } from '@vinaverse/react';\nimport {\n useAgentName,\n useAgentRuntime,\n useAgentStatus,\n} from '@vinaverse/react/agent';\nimport { type ComponentType, type ReactNode, useState } from 'react';\nimport { Pressable, Text, View } from 'react-native';\nimport { useAgentSweep } from '../platform.js';\nimport {\n type ColorSchemeSetting,\n type ThemeOverrides,\n ThemeProvider,\n useTheme,\n} from '../theme.js';\n\n/** The row's look beyond the theme. */\nexport interface AskAboutRowAppearance {\n /** A tint behind the row; default the theme's `surface`. */\n readonly background?: string;\n /** The chevron at the row's end. Default true. */\n readonly chevron?: boolean;\n}\n\nexport interface AskAboutRowProps {\n /** \"Ask Example Agent about Riley Sample\". */\n readonly title: string;\n readonly body?: string;\n /** The person asks: open the chat with `entryPoint` (`ask`), so the session says where it was opened from. */\n readonly onPress: (from: { readonly entryPoint: 'ask' }) => void;\n /** The app's brand mark at the row's start; default the agent name's first letter. */\n readonly Mark?: ComponentType<{\n readonly size: number;\n readonly color: string;\n }>;\n readonly appearance?: AskAboutRowAppearance;\n readonly locale?: string;\n readonly copy?: CopyOverrides;\n readonly theme?: ThemeOverrides;\n readonly colorScheme?: ColorSchemeSetting;\n /** The row's test id. Default `vinaverse-ask-about`. */\n readonly testID?: string;\n}\n\nexport function AskAboutRow(props: AskAboutRowProps): ReactNode {\n return (\n <CopyProvider locale={props.locale} copy={props.copy}>\n <ThemeProvider theme={props.theme} colorScheme={props.colorScheme}>\n <Row {...props} />\n </ThemeProvider>\n </CopyProvider>\n );\n}\n\nfunction Row(props: AskAboutRowProps): ReactNode {\n const { t } = useCopy();\n const { colors, radius, space, font } = useTheme();\n const name = useAgentName(t('agentFallbackName'));\n const runtime = useAgentRuntime();\n useAgentStatus(); // reads the status when none is held, for the pages after this one\n useAgentSweep(runtime);\n // Decided once, as the page draws, from the status already read: an agent unknown or unavailable then stays away for\n // the visit, and the row is never added under content the person is reading.\n const [shows] = useState(() => !!runtime.getStatus()?.available);\n if (!shows) return null;\n const { Mark, appearance: look } = props;\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={\n props.body ? `${props.title}. ${props.body}` : props.title\n }\n onPress={() => props.onPress({ entryPoint: 'ask' })}\n style={({ pressed }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: space.md,\n padding: space.md,\n borderRadius: radius.lg,\n backgroundColor: look?.background ?? colors.surface,\n opacity: pressed ? 0.85 : 1,\n })}\n testID={props.testID ?? 'vinaverse-ask-about'}\n >\n <View\n style={{\n width: 36,\n height: 36,\n borderRadius: 18,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: colors.primary,\n }}\n >\n {Mark ? (\n <Mark size={22} color={colors.onPrimary} />\n ) : (\n <Text style={{ color: colors.onPrimary, fontWeight: '600' }}>\n {(name.trim()[0] ?? '?').toUpperCase()}\n </Text>\n )}\n </View>\n <View style={{ flex: 1, gap: space.xxs }}>\n <Text\n style={{\n color: colors.text,\n fontSize: font.size.md,\n fontWeight: '600',\n }}\n >\n {props.title}\n </Text>\n {props.body ? (\n <Text style={{ color: colors.textMuted, fontSize: font.size.sm }}>\n {props.body}\n </Text>\n ) : null}\n </View>\n {look?.chevron === false ? null : (\n <Text style={{ color: colors.textMuted, fontSize: font.size.lg }}>\n ›\n </Text>\n )}\n </Pressable>\n );\n}\n"]}
|