@guideai/react-native 0.6.0 → 0.8.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.
- package/README.md +1 -1
- package/dist/GuideAIChat-Ba6n1ePs.js +2795 -0
- package/dist/GuideAIChat-Ba6n1ePs.js.map +1 -0
- package/dist/{GuideAIChat-DQEa_Ff0.cjs → GuideAIChat-CxyWFl_o.cjs} +67 -12
- package/dist/GuideAIChat-CxyWFl_o.cjs.map +1 -0
- package/dist/{GuideAIChat-DLtQYk2N.js → GuideAIChat-DOC4zx-a.js} +68 -13
- package/dist/GuideAIChat-DOC4zx-a.js.map +1 -0
- package/dist/GuideAIChat-W8KQ4Y6i.cjs +2794 -0
- package/dist/GuideAIChat-W8KQ4Y6i.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +44 -0
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +2 -2
- package/dist/ui.mjs +3 -3
- package/dist/{useConversations-B4WYG2Qz.js → useConversations-B_7km_uH.js} +31 -6
- package/dist/{useConversations-B4WYG2Qz.js.map → useConversations-B_7km_uH.js.map} +1 -1
- package/dist/useConversations-CJEaVqch.cjs +4290 -0
- package/dist/useConversations-CJEaVqch.cjs.map +1 -0
- package/dist/{useConversations-C9ivx2l-.cjs → useConversations-CTbQBTz-.cjs} +31 -6
- package/dist/{useConversations-C9ivx2l-.cjs.map → useConversations-CTbQBTz-.cjs.map} +1 -1
- package/dist/useConversations-SbhtYN_R.js +4291 -0
- package/dist/useConversations-SbhtYN_R.js.map +1 -0
- package/dist/voice.cjs +2 -2
- package/dist/voice.mjs +3 -3
- package/package.json +1 -1
- package/dist/GuideAIChat-DLtQYk2N.js.map +0 -1
- package/dist/GuideAIChat-DQEa_Ff0.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useReducer, useState, useRef, useMemo, useEffect } from "react";
|
|
3
3
|
import { View, StyleSheet, Text, ScrollView, Linking, AccessibilityInfo, Modal, ActivityIndicator, Pressable, Platform, Animated, Easing, KeyboardAvoidingView, Alert, FlatList, TextInput, StatusBar } from "react-native";
|
|
4
|
-
import { B as BOARD_W, e as useWhiteboard, G as GuideAI, r as requireConfigured, f as BOARD_H, c as useGuideAI, d as useOnboarding, E as EP, b as useConversations } from "./useConversations-
|
|
5
|
-
import { Svg, G, Path } from "react-native-svg";
|
|
4
|
+
import { B as BOARD_W, e as useWhiteboard, G as GuideAI, r as requireConfigured, f as BOARD_H, c as useGuideAI, d as useOnboarding, E as EP, b as useConversations } from "./useConversations-B_7km_uH.js";
|
|
5
|
+
import { Svg, G, Path, Defs, ClipPath, Rect, Image } from "react-native-svg";
|
|
6
6
|
function parseInline(text) {
|
|
7
7
|
const spans = [];
|
|
8
8
|
const pattern = /(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\n]+\*)|(_[^_\n]+_)|(\[[^\]]+\]\([^)]+\))/g;
|
|
@@ -1048,6 +1048,8 @@ class BoardModel {
|
|
|
1048
1048
|
constructor(options) {
|
|
1049
1049
|
this.options = options;
|
|
1050
1050
|
this.inks = [];
|
|
1051
|
+
this.pictures = [];
|
|
1052
|
+
this.credit = null;
|
|
1051
1053
|
this.words = [];
|
|
1052
1054
|
this.pen = null;
|
|
1053
1055
|
this.caption = "";
|
|
@@ -1060,6 +1062,8 @@ class BoardModel {
|
|
|
1060
1062
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1061
1063
|
return {
|
|
1062
1064
|
inks: this.inks,
|
|
1065
|
+
pictures: this.pictures,
|
|
1066
|
+
credit: this.credit,
|
|
1063
1067
|
words: this.words,
|
|
1064
1068
|
pen: this.pen,
|
|
1065
1069
|
caption: this.caption,
|
|
@@ -1131,6 +1135,8 @@ class BoardModel {
|
|
|
1131
1135
|
}
|
|
1132
1136
|
wipe() {
|
|
1133
1137
|
this.inks = [];
|
|
1138
|
+
this.pictures = [];
|
|
1139
|
+
this.credit = null;
|
|
1134
1140
|
this.words = [];
|
|
1135
1141
|
this.pen = null;
|
|
1136
1142
|
this.changed();
|
|
@@ -1146,7 +1152,7 @@ class BoardModel {
|
|
|
1146
1152
|
};
|
|
1147
1153
|
}
|
|
1148
1154
|
opFor(item, seed) {
|
|
1149
|
-
var _a;
|
|
1155
|
+
var _a, _b, _c, _d;
|
|
1150
1156
|
switch (item.kind) {
|
|
1151
1157
|
case "ink":
|
|
1152
1158
|
return this.inkOp(item.id, inkStrokes(item.ink, item, seed), INK[item.tone], item.ink === "dot" ? 9 : 7, item.ink === "dot" ? 250 : 350, 2600, 1.1);
|
|
@@ -1158,6 +1164,14 @@ class BoardModel {
|
|
|
1158
1164
|
}
|
|
1159
1165
|
return this.inkOp(item.id, artStrokes(ink, item.at, seed), INK[item.tone], "icon" in ink ? 7 : 4, 1100, 4500, 2.6);
|
|
1160
1166
|
}
|
|
1167
|
+
case "photo": {
|
|
1168
|
+
const pic = (_c = (_b = this.scene) == null ? void 0 : _b.photos) == null ? void 0 : _c[item.photo];
|
|
1169
|
+
if (!pic) {
|
|
1170
|
+
const [x, y, w, h] = item.at;
|
|
1171
|
+
return this.textOp({ kind: "text", id: item.id, text: item.photo, at: [x + 1, y + h / 2], size: w < 15 ? "s" : "m", tone: "ink" });
|
|
1172
|
+
}
|
|
1173
|
+
return this.photoOp(item, pic.url, (_d = pic.credit) != null ? _d : null);
|
|
1174
|
+
}
|
|
1161
1175
|
case "text":
|
|
1162
1176
|
return this.textOp(item);
|
|
1163
1177
|
case "table":
|
|
@@ -1191,6 +1205,25 @@ class BoardModel {
|
|
|
1191
1205
|
}
|
|
1192
1206
|
};
|
|
1193
1207
|
}
|
|
1208
|
+
photoOp(item, url, credit) {
|
|
1209
|
+
const duration = 1400 + TRAVEL_MS;
|
|
1210
|
+
const [x, y, w, h] = item.at;
|
|
1211
|
+
let pic = null;
|
|
1212
|
+
return {
|
|
1213
|
+
duration,
|
|
1214
|
+
run: (progress) => {
|
|
1215
|
+
if (!pic) {
|
|
1216
|
+
pic = { key: this.nextKey++, id: item.id, url, alt: item.photo, at: item.at, shown: 0, marked: false };
|
|
1217
|
+
this.pictures = [...this.pictures, pic];
|
|
1218
|
+
if (credit) this.credit = credit;
|
|
1219
|
+
}
|
|
1220
|
+
const shown = progress >= 1 ? 1 : Math.max(0, (progress * duration - TRAVEL_MS) / (duration - TRAVEL_MS));
|
|
1221
|
+
pic.shown = shown;
|
|
1222
|
+
this.pen = shown < 1 ? { x: sx(x + w * shown), y: sy(y + h * (0.5 + 0.35 * Math.sin(shown * 9))) } : this.pen;
|
|
1223
|
+
this.changed();
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1194
1227
|
textOp(item) {
|
|
1195
1228
|
const duration = Math.min(2e3, Math.max(350, item.text.length * 60)) + TRAVEL_MS;
|
|
1196
1229
|
let word = null;
|
|
@@ -1228,25 +1261,27 @@ class BoardModel {
|
|
|
1228
1261
|
return {
|
|
1229
1262
|
duration: 650,
|
|
1230
1263
|
run: () => {
|
|
1264
|
+
var _a;
|
|
1231
1265
|
if (done) return;
|
|
1232
1266
|
done = true;
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1267
|
+
const thing = (_a = this.words.find((w) => w.id === id)) != null ? _a : this.pictures.find((p) => p.id === id);
|
|
1268
|
+
if (thing) {
|
|
1269
|
+
thing.marked = true;
|
|
1236
1270
|
this.changed();
|
|
1237
1271
|
return;
|
|
1238
1272
|
}
|
|
1239
1273
|
const ink = this.inks.find((obj) => obj.id === id && !obj.marker);
|
|
1240
1274
|
const box = ink ? bounds(ink.strokes) : null;
|
|
1241
|
-
if (!box) return;
|
|
1275
|
+
if (!ink || !box) return;
|
|
1276
|
+
const tall = box.y1 - box.y0;
|
|
1242
1277
|
const mid = (box.y0 + box.y1) / 2;
|
|
1243
|
-
const
|
|
1278
|
+
const strokes = tall <= 120 ? [[{ x: box.x0 - 14, y: mid }, { x: box.x1 + 14, y: mid }]] : ink.strokes;
|
|
1244
1279
|
this.inks = [{
|
|
1245
1280
|
key: this.nextKey++,
|
|
1246
|
-
strokes
|
|
1247
|
-
length: totalLength(
|
|
1281
|
+
strokes,
|
|
1282
|
+
length: totalLength(strokes),
|
|
1248
1283
|
color: MARKER,
|
|
1249
|
-
width: Math.max(24,
|
|
1284
|
+
width: tall <= 120 ? Math.max(24, tall * 0.6) : 26,
|
|
1250
1285
|
marker: true,
|
|
1251
1286
|
drawn: 1
|
|
1252
1287
|
}, ...this.inks];
|
|
@@ -1260,6 +1295,7 @@ class BoardModel {
|
|
|
1260
1295
|
run: (progress) => {
|
|
1261
1296
|
if (progress < 1) return;
|
|
1262
1297
|
this.words = this.words.filter((w) => w.id !== id);
|
|
1298
|
+
this.pictures = this.pictures.filter((p) => p.id !== id);
|
|
1263
1299
|
this.inks = this.inks.filter((obj) => obj.id !== id);
|
|
1264
1300
|
this.changed();
|
|
1265
1301
|
}
|
|
@@ -1387,11 +1423,16 @@ function GuideAIWhiteboard({ theme: overrides }) {
|
|
|
1387
1423
|
/* @__PURE__ */ jsxs(View, { style: styles$3.sheet, onLayout: (e) => setWidth(e.nativeEvent.layout.width), children: [
|
|
1388
1424
|
width > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1389
1425
|
/* @__PURE__ */ jsxs(Svg, { width, height, viewBox: `0 0 ${SHEET_W} ${SHEET_H}`, children: [
|
|
1426
|
+
board.pictures.map((pic) => /* @__PURE__ */ jsx(Picture, { pic }, pic.key)),
|
|
1390
1427
|
board.inks.filter((obj) => obj.marker).map((obj) => /* @__PURE__ */ jsx(Ink, { obj }, obj.key)),
|
|
1391
1428
|
board.inks.filter((obj) => !obj.marker).map((obj) => /* @__PURE__ */ jsx(Ink, { obj }, obj.key)),
|
|
1392
1429
|
board.pen && playing && !motion.current.reduced ? /* @__PURE__ */ jsx(G, { transform: `translate(${board.pen.x.toFixed(1)} ${board.pen.y.toFixed(1)})`, children: /* @__PURE__ */ jsx(Path, { d: PEN, fill: "#fde68a", stroke: "#1f2937", strokeWidth: 3, strokeLinejoin: "round" }) }) : null
|
|
1393
1430
|
] }),
|
|
1394
|
-
board.words.map((word) => /* @__PURE__ */ jsx(Word, { word, width, height, unit: unit2 }, word.key))
|
|
1431
|
+
board.words.map((word) => /* @__PURE__ */ jsx(Word, { word, width, height, unit: unit2 }, word.key)),
|
|
1432
|
+
board.credit ? /* @__PURE__ */ jsxs(Text, { style: styles$3.credit, numberOfLines: 1, children: [
|
|
1433
|
+
"Picture: ",
|
|
1434
|
+
board.credit
|
|
1435
|
+
] }) : null
|
|
1395
1436
|
] }) : null,
|
|
1396
1437
|
state.status === "loading" ? /* @__PURE__ */ jsxs(View, { style: styles$3.status, accessibilityLiveRegion: "polite", children: [
|
|
1397
1438
|
/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent }),
|
|
@@ -1465,6 +1506,19 @@ function Ink({ obj }) {
|
|
|
1465
1506
|
}
|
|
1466
1507
|
);
|
|
1467
1508
|
}
|
|
1509
|
+
function Picture({ pic }) {
|
|
1510
|
+
if (pic.shown <= 0) return null;
|
|
1511
|
+
const x = pic.at[0] / BOARD_W * SHEET_W;
|
|
1512
|
+
const y = pic.at[1] / BOARD_H * SHEET_H;
|
|
1513
|
+
const w = pic.at[2] / BOARD_W * SHEET_W;
|
|
1514
|
+
const h = pic.at[3] / BOARD_H * SHEET_H;
|
|
1515
|
+
const clip = `wb-pic-${pic.key}`;
|
|
1516
|
+
return /* @__PURE__ */ jsxs(G, { children: [
|
|
1517
|
+
/* @__PURE__ */ jsx(Defs, { children: /* @__PURE__ */ jsx(ClipPath, { id: clip, children: /* @__PURE__ */ jsx(Rect, { x, y, width: w * pic.shown, height: h }) }) }),
|
|
1518
|
+
pic.marked ? /* @__PURE__ */ jsx(Rect, { x: x - 12, y: y - 12, width: w + 24, height: h + 24, rx: 14, fill: MARKER }) : null,
|
|
1519
|
+
/* @__PURE__ */ jsx(Image, { href: { uri: pic.url }, x, y, width: w, height: h, preserveAspectRatio: "xMidYMid meet", clipPath: `url(#${clip})` })
|
|
1520
|
+
] });
|
|
1521
|
+
}
|
|
1468
1522
|
function Word({ word, width, height, unit: unit2 }) {
|
|
1469
1523
|
const left = word.at[0] / BOARD_W * width;
|
|
1470
1524
|
const top = word.at[1] / BOARD_H * height;
|
|
@@ -1531,6 +1585,7 @@ const styles$3 = StyleSheet.create({
|
|
|
1531
1585
|
speed: { borderWidth: 1, borderRadius: 8, paddingHorizontal: 8, paddingVertical: 4 },
|
|
1532
1586
|
icon: { width: 34, height: 34, alignItems: "center", justifyContent: "center" },
|
|
1533
1587
|
word: { position: "absolute", fontWeight: "600" },
|
|
1588
|
+
credit: { position: "absolute", right: 6, bottom: 3, fontSize: 9, color: "#94a3b8", maxWidth: "60%" },
|
|
1534
1589
|
table: { position: "absolute", borderWidth: 1.5 },
|
|
1535
1590
|
row: { flexDirection: "row" },
|
|
1536
1591
|
cell: { flex: 1, borderWidth: 0.75, paddingHorizontal: 6, paddingVertical: 3 }
|
|
@@ -2436,4 +2491,4 @@ export {
|
|
|
2436
2491
|
lightTheme as l,
|
|
2437
2492
|
resolveTheme as r
|
|
2438
2493
|
};
|
|
2439
|
-
//# sourceMappingURL=GuideAIChat-
|
|
2494
|
+
//# sourceMappingURL=GuideAIChat-DOC4zx-a.js.map
|