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