canvu-react 0.4.36 → 0.4.38
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/native.cjs +273 -83
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +23 -9
- package/dist/native.d.ts +23 -9
- package/dist/native.js +289 -99
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import getStroke from 'perfect-freehand';
|
|
2
|
-
import { Group, Canvas, Rect, Circle, Path, RoundedRect, Oval, DashPathEffect, Line, vec, matchFont, Text, Image } from '@shopify/react-native-skia';
|
|
2
|
+
import { Group, Canvas, Rect, Circle, Path, RoundedRect, Oval, DashPathEffect, Line, vec, matchFont, Text as Text$1, Image } from '@shopify/react-native-skia';
|
|
3
3
|
import { memo, forwardRef, useState, useRef, useCallback, useEffect, useMemo, useImperativeHandle } from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import { StyleSheet, PanResponder, View,
|
|
5
|
+
import { StyleSheet, PanResponder, View, Modal, Text, TextInput, Pressable, ScrollView } from 'react-native';
|
|
6
6
|
|
|
7
7
|
// src/math/rect.ts
|
|
8
8
|
function rectsIntersect(a, b) {
|
|
@@ -1463,6 +1463,12 @@ function linkInitial(value) {
|
|
|
1463
1463
|
const first = value.trim().charAt(0).toUpperCase();
|
|
1464
1464
|
return first || "L";
|
|
1465
1465
|
}
|
|
1466
|
+
function normalizeNativeLinkHref(value) {
|
|
1467
|
+
const trimmed = value.trim();
|
|
1468
|
+
if (!trimmed) return null;
|
|
1469
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) return trimmed;
|
|
1470
|
+
return `https://${trimmed}`;
|
|
1471
|
+
}
|
|
1466
1472
|
function buildNativeLinkCardDisplay(link) {
|
|
1467
1473
|
const hostname = linkHostname(link.href);
|
|
1468
1474
|
const title = link.title?.trim() || hostname || "Link";
|
|
@@ -1707,6 +1713,11 @@ function rgbaFromHexAndOpacity(hex, opacity) {
|
|
|
1707
1713
|
function toNum(v) {
|
|
1708
1714
|
return typeof v === "number" ? v : Number(v) || 0;
|
|
1709
1715
|
}
|
|
1716
|
+
function dashIntervalsFromStrokeDasharray(strokeDasharray) {
|
|
1717
|
+
if (!strokeDasharray) return null;
|
|
1718
|
+
const intervals = strokeDasharray.split(/[\s,]+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
|
|
1719
|
+
return intervals.length > 0 ? intervals : null;
|
|
1720
|
+
}
|
|
1710
1721
|
function SvgNodeRenderer({ nodes }) {
|
|
1711
1722
|
return /* @__PURE__ */ jsx(Fragment, { children: nodes.map((node, i) => /* @__PURE__ */ jsx(SvgNodeItem, { node }, i)) });
|
|
1712
1723
|
}
|
|
@@ -1821,6 +1832,7 @@ function SvgNodeItem({ node }) {
|
|
|
1821
1832
|
const stroke = rgbaFromHexAndOpacity(node.stroke, node.strokeOpacity);
|
|
1822
1833
|
const fill = isFill ? rgbaFromHexAndOpacity(node.fill, node.fillOpacity) ?? node.fill : void 0;
|
|
1823
1834
|
const style = fill && fill !== "none" ? "fill" : "stroke";
|
|
1835
|
+
const intervals = style === "stroke" ? dashIntervalsFromStrokeDasharray(node.strokeDasharray) : null;
|
|
1824
1836
|
return /* @__PURE__ */ jsx(
|
|
1825
1837
|
Path,
|
|
1826
1838
|
{
|
|
@@ -1831,7 +1843,8 @@ function SvgNodeItem({ node }) {
|
|
|
1831
1843
|
strokeCap: node.strokeLinecap === "round" ? "round" : "butt",
|
|
1832
1844
|
strokeJoin: node.strokeLinejoin === "round" ? "round" : "miter",
|
|
1833
1845
|
fillType: node.fillRule === "evenodd" ? "evenOdd" : "winding",
|
|
1834
|
-
antiAlias: true
|
|
1846
|
+
antiAlias: true,
|
|
1847
|
+
children: intervals ? /* @__PURE__ */ jsx(DashPathEffect, { intervals }) : null
|
|
1835
1848
|
}
|
|
1836
1849
|
);
|
|
1837
1850
|
}
|
|
@@ -1840,7 +1853,7 @@ function SvgNodeItem({ node }) {
|
|
|
1840
1853
|
const fs = node.fontSize != null ? toNum(node.fontSize) : 16;
|
|
1841
1854
|
const font = matchFont({ fontSize: fs });
|
|
1842
1855
|
return /* @__PURE__ */ jsx(Fragment, { children: node.children.map((tspan, i) => /* @__PURE__ */ jsx(
|
|
1843
|
-
Text,
|
|
1856
|
+
Text$1,
|
|
1844
1857
|
{
|
|
1845
1858
|
x: tspan.x != null ? toNum(tspan.x) : node.x != null ? toNum(node.x) : 0,
|
|
1846
1859
|
y: tspan.dy != null ? (node.y != null ? toNum(node.y) : fs) + toNum(tspan.dy) : (node.y != null ? toNum(node.y) : fs) + i * fs * 1.2,
|
|
@@ -2014,6 +2027,7 @@ function parsePathNode(attrs) {
|
|
|
2014
2027
|
strokeOpacity: parseNumOpt(attrs["stroke-opacity"]),
|
|
2015
2028
|
strokeLinecap: attrs["stroke-linecap"],
|
|
2016
2029
|
strokeLinejoin: attrs["stroke-linejoin"],
|
|
2030
|
+
strokeDasharray: attrs["stroke-dasharray"],
|
|
2017
2031
|
shapeRendering: attrs["shape-rendering"],
|
|
2018
2032
|
vectorEffect: attrs["vector-effect"]
|
|
2019
2033
|
};
|
|
@@ -2231,7 +2245,7 @@ function NativeLinkCardRenderer({
|
|
|
2231
2245
|
}
|
|
2232
2246
|
),
|
|
2233
2247
|
/* @__PURE__ */ jsx(
|
|
2234
|
-
Text,
|
|
2248
|
+
Text$1,
|
|
2235
2249
|
{
|
|
2236
2250
|
x: 29.5,
|
|
2237
2251
|
y: 41,
|
|
@@ -2240,7 +2254,7 @@ function NativeLinkCardRenderer({
|
|
|
2240
2254
|
font: initialFont
|
|
2241
2255
|
}
|
|
2242
2256
|
),
|
|
2243
|
-
/* @__PURE__ */ jsx(Group, { clip: { x: 69, y: 13, width: 215, height: 24 }, children: /* @__PURE__ */ jsx(Text, { x: 69, y: 32, text: title, color: "#1f2937", font: titleFont }) }),
|
|
2257
|
+
/* @__PURE__ */ jsx(Group, { clip: { x: 69, y: 13, width: 215, height: 24 }, children: /* @__PURE__ */ jsx(Text$1, { x: 69, y: 32, text: title, color: "#1f2937", font: titleFont }) }),
|
|
2244
2258
|
display.secure ? /* @__PURE__ */ jsxs(Group, { transform: [{ translateX: 69 }, { translateY: 41 }], children: [
|
|
2245
2259
|
/* @__PURE__ */ jsx(
|
|
2246
2260
|
Rect,
|
|
@@ -2267,7 +2281,7 @@ function NativeLinkCardRenderer({
|
|
|
2267
2281
|
)
|
|
2268
2282
|
] }) : null,
|
|
2269
2283
|
/* @__PURE__ */ jsx(Group, { clip: { x: subtitleX, y: 34, width: subtitleWidth, height: 22 }, children: /* @__PURE__ */ jsx(
|
|
2270
|
-
Text,
|
|
2284
|
+
Text$1,
|
|
2271
2285
|
{
|
|
2272
2286
|
x: subtitleX,
|
|
2273
2287
|
y: 51,
|
|
@@ -2415,7 +2429,7 @@ function NativeShapeRenderer({ item }) {
|
|
|
2415
2429
|
const lines = item.text.split("\n");
|
|
2416
2430
|
const font = matchFont({ fontSize: fs });
|
|
2417
2431
|
return /* @__PURE__ */ jsx(Fragment, { children: lines.map((line, i) => /* @__PURE__ */ jsx(
|
|
2418
|
-
Text,
|
|
2432
|
+
Text$1,
|
|
2419
2433
|
{
|
|
2420
2434
|
x: 0,
|
|
2421
2435
|
y: fs + i * fs * 1.2,
|
|
@@ -2638,7 +2652,7 @@ function pointsToSmoothPathD(points) {
|
|
|
2638
2652
|
const d = smoothFreehandPointsToPathD(points);
|
|
2639
2653
|
return d || null;
|
|
2640
2654
|
}
|
|
2641
|
-
function
|
|
2655
|
+
function dashIntervalsFromStrokeDasharray2(strokeDasharray) {
|
|
2642
2656
|
if (!strokeDasharray) return null;
|
|
2643
2657
|
const intervals = strokeDasharray.split(/\s+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
|
|
2644
2658
|
return intervals.length > 0 ? intervals : null;
|
|
@@ -2928,7 +2942,7 @@ function NativeInteractionOverlay({
|
|
|
2928
2942
|
);
|
|
2929
2943
|
}
|
|
2930
2944
|
if (payload.kind === "strokePath") {
|
|
2931
|
-
const intervals =
|
|
2945
|
+
const intervals = dashIntervalsFromStrokeDasharray2(payload.strokeDasharray);
|
|
2932
2946
|
return /* @__PURE__ */ jsx(
|
|
2933
2947
|
Path,
|
|
2934
2948
|
{
|
|
@@ -3161,7 +3175,7 @@ function NativeInteractionOverlay({
|
|
|
3161
3175
|
}
|
|
3162
3176
|
),
|
|
3163
3177
|
peer.displayName ? /* @__PURE__ */ jsx(
|
|
3164
|
-
Text,
|
|
3178
|
+
Text$1,
|
|
3165
3179
|
{
|
|
3166
3180
|
x: cursor.x + labelOffsetX,
|
|
3167
3181
|
y: cursor.y + labelOffsetY,
|
|
@@ -3435,7 +3449,7 @@ function RangeControl({
|
|
|
3435
3449
|
]
|
|
3436
3450
|
}
|
|
3437
3451
|
),
|
|
3438
|
-
valueLabel ? /* @__PURE__ */ jsx(Text
|
|
3452
|
+
valueLabel ? /* @__PURE__ */ jsx(Text, { style: styles.rangeValue, children: valueLabel }) : null
|
|
3439
3453
|
] });
|
|
3440
3454
|
}
|
|
3441
3455
|
function InspectorSection({
|
|
@@ -3443,7 +3457,7 @@ function InspectorSection({
|
|
|
3443
3457
|
children
|
|
3444
3458
|
}) {
|
|
3445
3459
|
return /* @__PURE__ */ jsxs(View, { style: styles.section, children: [
|
|
3446
|
-
/* @__PURE__ */ jsx(Text
|
|
3460
|
+
/* @__PURE__ */ jsx(Text, { style: styles.sectionLabel, children: label }),
|
|
3447
3461
|
children
|
|
3448
3462
|
] });
|
|
3449
3463
|
}
|
|
@@ -3465,7 +3479,7 @@ function SegmentControl({
|
|
|
3465
3479
|
children: [
|
|
3466
3480
|
segment.preview,
|
|
3467
3481
|
/* @__PURE__ */ jsx(
|
|
3468
|
-
Text
|
|
3482
|
+
Text,
|
|
3469
3483
|
{
|
|
3470
3484
|
style: [
|
|
3471
3485
|
styles.segmentLabel,
|
|
@@ -3911,7 +3925,7 @@ function NativeVectorToolbar({
|
|
|
3911
3925
|
disabled: toolLockDisabled,
|
|
3912
3926
|
foregroundColor: "#18181b",
|
|
3913
3927
|
onToggle: toggleToolLock
|
|
3914
|
-
}) ?? /* @__PURE__ */ jsx(Text
|
|
3928
|
+
}) ?? /* @__PURE__ */ jsx(Text, { style: styles2.lockGlyph, children: toolLocked ? "L" : "U" })
|
|
3915
3929
|
}
|
|
3916
3930
|
),
|
|
3917
3931
|
/* @__PURE__ */ jsx(View, { style: styles2.toolLockDivider })
|
|
@@ -3958,8 +3972,8 @@ function NativeVectorToolbar({
|
|
|
3958
3972
|
disabled,
|
|
3959
3973
|
foregroundColor: "#18181b",
|
|
3960
3974
|
onSelect: () => onChange(activeOverflowTool.id)
|
|
3961
|
-
}) ?? renderNativeToolFallback(activeOverflowTool, "#18181b") : renderOverflowIcon?.(overflowRenderInput) ?? /* @__PURE__ */ jsx(Text
|
|
3962
|
-
renderOverflowChevronIcon?.(overflowRenderInput) ?? /* @__PURE__ */ jsx(Text
|
|
3975
|
+
}) ?? renderNativeToolFallback(activeOverflowTool, "#18181b") : renderOverflowIcon?.(overflowRenderInput) ?? /* @__PURE__ */ jsx(Text, { style: styles2.shapesGlyph, children: "S" }) }),
|
|
3976
|
+
renderOverflowChevronIcon?.(overflowRenderInput) ?? /* @__PURE__ */ jsx(Text, { style: styles2.chevronGlyph, children: overflowOpen ? "^" : "v" })
|
|
3963
3977
|
]
|
|
3964
3978
|
}
|
|
3965
3979
|
) : null
|
|
@@ -4029,7 +4043,7 @@ function renderNativeToolButton(input) {
|
|
|
4029
4043
|
children: [
|
|
4030
4044
|
/* @__PURE__ */ jsx(View, { style: styles2.iconSlot, children: icon }),
|
|
4031
4045
|
input.density === "comfortable" ? /* @__PURE__ */ jsx(
|
|
4032
|
-
Text
|
|
4046
|
+
Text,
|
|
4033
4047
|
{
|
|
4034
4048
|
numberOfLines: 1,
|
|
4035
4049
|
style: [
|
|
@@ -4053,7 +4067,7 @@ function renderNativeToolFallback(tool, foregroundColor, toolLabelStyle) {
|
|
|
4053
4067
|
if (tool.id === "link") {
|
|
4054
4068
|
return /* @__PURE__ */ jsx(NativeLinkToolIcon, { color: foregroundColor });
|
|
4055
4069
|
}
|
|
4056
|
-
return /* @__PURE__ */ jsx(Text
|
|
4070
|
+
return /* @__PURE__ */ jsx(Text, { style: [styles2.shortLabel, { color: foregroundColor }, toolLabelStyle], children: tool.shortLabel ?? tool.label.slice(0, 1).toUpperCase() });
|
|
4057
4071
|
}
|
|
4058
4072
|
var styles2 = StyleSheet.create({
|
|
4059
4073
|
shell: {
|
|
@@ -4651,6 +4665,13 @@ function resizeItemByHandle(item, start, handle, currentWorld) {
|
|
|
4651
4665
|
}
|
|
4652
4666
|
return { ...item, x: nb.x, y: nb.y, bounds: nb };
|
|
4653
4667
|
}
|
|
4668
|
+
var DEFAULT_NATIVE_LINK_TOOL_DIALOG_LABELS = {
|
|
4669
|
+
title: "Add link",
|
|
4670
|
+
description: "Paste the link you want to add to the board.",
|
|
4671
|
+
inputPlaceholder: "https://example.com",
|
|
4672
|
+
cancelLabel: "Cancel",
|
|
4673
|
+
addLabel: "Add"
|
|
4674
|
+
};
|
|
4654
4675
|
var MIN_PLACE_SIZE = 8;
|
|
4655
4676
|
var MIN_ARROW_DRAG_PX = 8;
|
|
4656
4677
|
var TAP_PX = 20;
|
|
@@ -4734,6 +4755,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4734
4755
|
onItemsChange,
|
|
4735
4756
|
onToolChangeRequest,
|
|
4736
4757
|
onLinkToolRequest,
|
|
4758
|
+
linkToolDialogLabels,
|
|
4737
4759
|
onWorldPointerDown,
|
|
4738
4760
|
onWorldPointerMove,
|
|
4739
4761
|
onWorldPointerLeave,
|
|
@@ -4788,6 +4810,8 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4788
4810
|
);
|
|
4789
4811
|
const [eraserTrail, setEraserTrail] = useState([]);
|
|
4790
4812
|
const [laserTrail, setLaserTrail] = useState([]);
|
|
4813
|
+
const [pendingNativeLinkRequest, setPendingNativeLinkRequest] = useState(null);
|
|
4814
|
+
const [nativeLinkInputValue, setNativeLinkInputValue] = useState("");
|
|
4791
4815
|
const laserClearTimerRef = useRef(null);
|
|
4792
4816
|
const strokeStyleRef = useRef({ ...DEFAULT_STROKE_STYLE });
|
|
4793
4817
|
const markerStrokeStyleRef = useRef({ ...MARKER_TOOL_STYLE });
|
|
@@ -4865,6 +4889,21 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4865
4889
|
onToolChangeRequestRef.current?.("select");
|
|
4866
4890
|
}
|
|
4867
4891
|
}, []);
|
|
4892
|
+
const requestSelectToolAfterNativeLinkUse = useCallback(() => {
|
|
4893
|
+
onToolChangeRequestRef.current?.("select");
|
|
4894
|
+
}, []);
|
|
4895
|
+
const closeNativeLinkDialog = useCallback(() => {
|
|
4896
|
+
setPendingNativeLinkRequest(null);
|
|
4897
|
+
setNativeLinkInputValue("");
|
|
4898
|
+
}, []);
|
|
4899
|
+
const submitNativeLinkDialog = useCallback(() => {
|
|
4900
|
+
const href = normalizeNativeLinkHref(nativeLinkInputValue);
|
|
4901
|
+
if (!href || !pendingNativeLinkRequest) return;
|
|
4902
|
+
const inserted = pendingNativeLinkRequest.insertLink({ href });
|
|
4903
|
+
if (inserted) {
|
|
4904
|
+
closeNativeLinkDialog();
|
|
4905
|
+
}
|
|
4906
|
+
}, [closeNativeLinkDialog, nativeLinkInputValue, pendingNativeLinkRequest]);
|
|
4868
4907
|
if (!cameraRef.current) {
|
|
4869
4908
|
cameraRef.current = new Camera2D({ minZoom: 0.05, maxZoom: 32 });
|
|
4870
4909
|
}
|
|
@@ -5442,7 +5481,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5442
5481
|
const item = createLinkItem(id, options.bounds ?? suggestedBounds, link);
|
|
5443
5482
|
currentChange([...itemsRef.current, item]);
|
|
5444
5483
|
onSelectionChangeRef.current?.([id]);
|
|
5445
|
-
|
|
5484
|
+
requestSelectToolAfterNativeLinkUse();
|
|
5446
5485
|
return item;
|
|
5447
5486
|
};
|
|
5448
5487
|
const requestLink = onLinkToolRequestRef.current;
|
|
@@ -5458,17 +5497,16 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5458
5497
|
});
|
|
5459
5498
|
return;
|
|
5460
5499
|
}
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
}
|
|
5500
|
+
setNativeLinkInputValue("");
|
|
5501
|
+
setPendingNativeLinkRequest({
|
|
5502
|
+
toolId: "link",
|
|
5503
|
+
worldX: st.startWorld.x,
|
|
5504
|
+
worldY: st.startWorld.y,
|
|
5505
|
+
screenX: st.startScreen.x,
|
|
5506
|
+
screenY: st.startScreen.y,
|
|
5507
|
+
suggestedBounds,
|
|
5508
|
+
insertLink
|
|
5509
|
+
});
|
|
5472
5510
|
return;
|
|
5473
5511
|
}
|
|
5474
5512
|
if (!change) return;
|
|
@@ -5518,6 +5556,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5518
5556
|
dragStateRef.current = { kind: "idle" };
|
|
5519
5557
|
},
|
|
5520
5558
|
[
|
|
5559
|
+
requestSelectToolAfterNativeLinkUse,
|
|
5521
5560
|
requestSelectToolAfterUse,
|
|
5522
5561
|
screenToWorld,
|
|
5523
5562
|
setRealtimePlacementPreview,
|
|
@@ -5649,7 +5688,13 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5649
5688
|
[requestRender, size]
|
|
5650
5689
|
);
|
|
5651
5690
|
const activeStyleToolId = toolId === "draw" || toolId === "marker" ? toolId : null;
|
|
5652
|
-
|
|
5691
|
+
const nativeLinkDialogLabels = {
|
|
5692
|
+
...DEFAULT_NATIVE_LINK_TOOL_DIALOG_LABELS,
|
|
5693
|
+
...linkToolDialogLabels ?? {}
|
|
5694
|
+
};
|
|
5695
|
+
const normalizedNativeLinkHref = normalizeNativeLinkHref(nativeLinkInputValue);
|
|
5696
|
+
const nativeLinkCanSubmit = pendingNativeLinkRequest !== null && normalizedNativeLinkHref !== null && onItemsChange != null;
|
|
5697
|
+
return /* @__PURE__ */ jsxs(
|
|
5653
5698
|
View,
|
|
5654
5699
|
{
|
|
5655
5700
|
style: { flex: 1, overflow: "hidden" },
|
|
@@ -5663,80 +5708,225 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5663
5708
|
notifyWorldPointerLeave();
|
|
5664
5709
|
},
|
|
5665
5710
|
...panResponder.panHandlers,
|
|
5666
|
-
children:
|
|
5711
|
+
children: [
|
|
5712
|
+
size.width > 0 && size.height > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5713
|
+
/* @__PURE__ */ jsx(
|
|
5714
|
+
NativeSceneRenderer,
|
|
5715
|
+
{
|
|
5716
|
+
items: sceneItems,
|
|
5717
|
+
camera,
|
|
5718
|
+
width: size.width,
|
|
5719
|
+
height: size.height
|
|
5720
|
+
}
|
|
5721
|
+
),
|
|
5722
|
+
interactive && /* @__PURE__ */ jsx(
|
|
5723
|
+
NativeInteractionOverlay,
|
|
5724
|
+
{
|
|
5725
|
+
camera,
|
|
5726
|
+
width: size.width,
|
|
5727
|
+
height: size.height,
|
|
5728
|
+
selectedItems,
|
|
5729
|
+
showResizeHandles,
|
|
5730
|
+
placementPreview,
|
|
5731
|
+
laserTrail,
|
|
5732
|
+
eraserTrail,
|
|
5733
|
+
eraserPreviewItems: items.filter(
|
|
5734
|
+
(it) => eraserPreviewIds.includes(it.id)
|
|
5735
|
+
),
|
|
5736
|
+
previewStrokeStyle: strokeStyleState,
|
|
5737
|
+
remotePresence
|
|
5738
|
+
}
|
|
5739
|
+
),
|
|
5740
|
+
interactive && showStyleInspector && activeStyleToolId ? /* @__PURE__ */ jsx(
|
|
5741
|
+
View,
|
|
5742
|
+
{
|
|
5743
|
+
pointerEvents: "box-none",
|
|
5744
|
+
style: styleInspectorPlacement === "top-left" ? {
|
|
5745
|
+
position: "absolute",
|
|
5746
|
+
left: 16,
|
|
5747
|
+
top: 104,
|
|
5748
|
+
alignItems: "flex-start"
|
|
5749
|
+
} : {
|
|
5750
|
+
position: "absolute",
|
|
5751
|
+
left: 16,
|
|
5752
|
+
right: 16,
|
|
5753
|
+
bottom: 84,
|
|
5754
|
+
alignItems: "center"
|
|
5755
|
+
},
|
|
5756
|
+
children: /* @__PURE__ */ jsx(
|
|
5757
|
+
NativeVectorStyleInspector,
|
|
5758
|
+
{
|
|
5759
|
+
toolId: activeStyleToolId,
|
|
5760
|
+
value: strokeStyleState,
|
|
5761
|
+
onChange: patchCurrentStrokeStyle
|
|
5762
|
+
}
|
|
5763
|
+
)
|
|
5764
|
+
}
|
|
5765
|
+
) : null,
|
|
5766
|
+
toolbar && /* @__PURE__ */ jsx(
|
|
5767
|
+
View,
|
|
5768
|
+
{
|
|
5769
|
+
style: {
|
|
5770
|
+
position: "absolute",
|
|
5771
|
+
bottom: 16,
|
|
5772
|
+
left: 16,
|
|
5773
|
+
right: 16,
|
|
5774
|
+
flexDirection: "row",
|
|
5775
|
+
justifyContent: "center",
|
|
5776
|
+
alignItems: "center"
|
|
5777
|
+
},
|
|
5778
|
+
pointerEvents: "box-none",
|
|
5779
|
+
children: toolbar
|
|
5780
|
+
}
|
|
5781
|
+
)
|
|
5782
|
+
] }),
|
|
5667
5783
|
/* @__PURE__ */ jsx(
|
|
5668
|
-
|
|
5669
|
-
{
|
|
5670
|
-
items: sceneItems,
|
|
5671
|
-
camera,
|
|
5672
|
-
width: size.width,
|
|
5673
|
-
height: size.height
|
|
5674
|
-
}
|
|
5675
|
-
),
|
|
5676
|
-
interactive && /* @__PURE__ */ jsx(
|
|
5677
|
-
NativeInteractionOverlay,
|
|
5678
|
-
{
|
|
5679
|
-
camera,
|
|
5680
|
-
width: size.width,
|
|
5681
|
-
height: size.height,
|
|
5682
|
-
selectedItems,
|
|
5683
|
-
showResizeHandles,
|
|
5684
|
-
placementPreview,
|
|
5685
|
-
laserTrail,
|
|
5686
|
-
eraserTrail,
|
|
5687
|
-
eraserPreviewItems: items.filter(
|
|
5688
|
-
(it) => eraserPreviewIds.includes(it.id)
|
|
5689
|
-
),
|
|
5690
|
-
previewStrokeStyle: strokeStyleState,
|
|
5691
|
-
remotePresence
|
|
5692
|
-
}
|
|
5693
|
-
),
|
|
5694
|
-
interactive && showStyleInspector && activeStyleToolId ? /* @__PURE__ */ jsx(
|
|
5695
|
-
View,
|
|
5696
|
-
{
|
|
5697
|
-
pointerEvents: "box-none",
|
|
5698
|
-
style: styleInspectorPlacement === "top-left" ? {
|
|
5699
|
-
position: "absolute",
|
|
5700
|
-
left: 16,
|
|
5701
|
-
top: 104,
|
|
5702
|
-
alignItems: "flex-start"
|
|
5703
|
-
} : {
|
|
5704
|
-
position: "absolute",
|
|
5705
|
-
left: 16,
|
|
5706
|
-
right: 16,
|
|
5707
|
-
bottom: 84,
|
|
5708
|
-
alignItems: "center"
|
|
5709
|
-
},
|
|
5710
|
-
children: /* @__PURE__ */ jsx(
|
|
5711
|
-
NativeVectorStyleInspector,
|
|
5712
|
-
{
|
|
5713
|
-
toolId: activeStyleToolId,
|
|
5714
|
-
value: strokeStyleState,
|
|
5715
|
-
onChange: patchCurrentStrokeStyle
|
|
5716
|
-
}
|
|
5717
|
-
)
|
|
5718
|
-
}
|
|
5719
|
-
) : null,
|
|
5720
|
-
toolbar && /* @__PURE__ */ jsx(
|
|
5721
|
-
View,
|
|
5784
|
+
Modal,
|
|
5722
5785
|
{
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5786
|
+
animationType: "fade",
|
|
5787
|
+
transparent: true,
|
|
5788
|
+
visible: pendingNativeLinkRequest !== null,
|
|
5789
|
+
onRequestClose: closeNativeLinkDialog,
|
|
5790
|
+
children: /* @__PURE__ */ jsx(View, { style: styles3.nativeLinkDialogBackdrop, children: /* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogCard, children: [
|
|
5791
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogTitle, children: nativeLinkDialogLabels.title }),
|
|
5792
|
+
/* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogDescription, children: nativeLinkDialogLabels.description }),
|
|
5793
|
+
/* @__PURE__ */ jsx(
|
|
5794
|
+
TextInput,
|
|
5795
|
+
{
|
|
5796
|
+
accessibilityLabel: nativeLinkDialogLabels.title,
|
|
5797
|
+
autoCapitalize: "none",
|
|
5798
|
+
autoCorrect: false,
|
|
5799
|
+
keyboardType: "url",
|
|
5800
|
+
onChangeText: setNativeLinkInputValue,
|
|
5801
|
+
onSubmitEditing: submitNativeLinkDialog,
|
|
5802
|
+
placeholder: nativeLinkDialogLabels.inputPlaceholder,
|
|
5803
|
+
returnKeyType: "done",
|
|
5804
|
+
style: styles3.nativeLinkDialogInput,
|
|
5805
|
+
value: nativeLinkInputValue
|
|
5806
|
+
}
|
|
5807
|
+
),
|
|
5808
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.nativeLinkDialogActions, children: [
|
|
5809
|
+
/* @__PURE__ */ jsx(
|
|
5810
|
+
Pressable,
|
|
5811
|
+
{
|
|
5812
|
+
accessibilityRole: "button",
|
|
5813
|
+
onPress: closeNativeLinkDialog,
|
|
5814
|
+
style: ({ pressed }) => [
|
|
5815
|
+
styles3.nativeLinkDialogButton,
|
|
5816
|
+
pressed ? styles3.nativeLinkDialogButtonPressed : void 0
|
|
5817
|
+
],
|
|
5818
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogButtonText, children: nativeLinkDialogLabels.cancelLabel })
|
|
5819
|
+
}
|
|
5820
|
+
),
|
|
5821
|
+
/* @__PURE__ */ jsx(
|
|
5822
|
+
Pressable,
|
|
5823
|
+
{
|
|
5824
|
+
accessibilityRole: "button",
|
|
5825
|
+
accessibilityState: { disabled: !nativeLinkCanSubmit },
|
|
5826
|
+
disabled: !nativeLinkCanSubmit,
|
|
5827
|
+
onPress: submitNativeLinkDialog,
|
|
5828
|
+
style: ({ pressed }) => [
|
|
5829
|
+
styles3.nativeLinkDialogButton,
|
|
5830
|
+
styles3.nativeLinkDialogPrimaryButton,
|
|
5831
|
+
pressed && nativeLinkCanSubmit ? styles3.nativeLinkDialogPrimaryButtonPressed : void 0,
|
|
5832
|
+
!nativeLinkCanSubmit ? styles3.nativeLinkDialogDisabledButton : void 0
|
|
5833
|
+
],
|
|
5834
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles3.nativeLinkDialogPrimaryButtonText, children: nativeLinkDialogLabels.addLabel })
|
|
5835
|
+
}
|
|
5836
|
+
)
|
|
5837
|
+
] })
|
|
5838
|
+
] }) })
|
|
5734
5839
|
}
|
|
5735
5840
|
)
|
|
5736
|
-
]
|
|
5841
|
+
]
|
|
5737
5842
|
}
|
|
5738
5843
|
);
|
|
5739
5844
|
});
|
|
5845
|
+
var styles3 = StyleSheet.create({
|
|
5846
|
+
nativeLinkDialogBackdrop: {
|
|
5847
|
+
flex: 1,
|
|
5848
|
+
alignItems: "center",
|
|
5849
|
+
justifyContent: "center",
|
|
5850
|
+
paddingHorizontal: 24,
|
|
5851
|
+
backgroundColor: "rgba(0, 0, 0, 0.45)"
|
|
5852
|
+
},
|
|
5853
|
+
nativeLinkDialogCard: {
|
|
5854
|
+
width: "100%",
|
|
5855
|
+
maxWidth: 480,
|
|
5856
|
+
padding: 24,
|
|
5857
|
+
borderRadius: 16,
|
|
5858
|
+
backgroundColor: "#ffffff",
|
|
5859
|
+
shadowColor: "#000000",
|
|
5860
|
+
shadowOpacity: 0.18,
|
|
5861
|
+
shadowRadius: 24,
|
|
5862
|
+
shadowOffset: { width: 0, height: 8 },
|
|
5863
|
+
elevation: 12
|
|
5864
|
+
},
|
|
5865
|
+
nativeLinkDialogTitle: {
|
|
5866
|
+
color: "#111827",
|
|
5867
|
+
fontSize: 24,
|
|
5868
|
+
fontWeight: "700",
|
|
5869
|
+
lineHeight: 30
|
|
5870
|
+
},
|
|
5871
|
+
nativeLinkDialogDescription: {
|
|
5872
|
+
marginTop: 12,
|
|
5873
|
+
color: "#6b7280",
|
|
5874
|
+
fontSize: 16,
|
|
5875
|
+
lineHeight: 22
|
|
5876
|
+
},
|
|
5877
|
+
nativeLinkDialogInput: {
|
|
5878
|
+
marginTop: 24,
|
|
5879
|
+
height: 52,
|
|
5880
|
+
paddingHorizontal: 14,
|
|
5881
|
+
borderRadius: 10,
|
|
5882
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
5883
|
+
borderColor: "#d1d5db",
|
|
5884
|
+
color: "#111827",
|
|
5885
|
+
fontSize: 18,
|
|
5886
|
+
backgroundColor: "#ffffff"
|
|
5887
|
+
},
|
|
5888
|
+
nativeLinkDialogActions: {
|
|
5889
|
+
marginTop: 24,
|
|
5890
|
+
flexDirection: "row",
|
|
5891
|
+
justifyContent: "flex-end",
|
|
5892
|
+
gap: 12
|
|
5893
|
+
},
|
|
5894
|
+
nativeLinkDialogButton: {
|
|
5895
|
+
minWidth: 92,
|
|
5896
|
+
height: 48,
|
|
5897
|
+
alignItems: "center",
|
|
5898
|
+
justifyContent: "center",
|
|
5899
|
+
borderRadius: 10,
|
|
5900
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
5901
|
+
borderColor: "#d1d5db",
|
|
5902
|
+
backgroundColor: "#ffffff",
|
|
5903
|
+
paddingHorizontal: 18
|
|
5904
|
+
},
|
|
5905
|
+
nativeLinkDialogButtonPressed: {
|
|
5906
|
+
backgroundColor: "#f3f4f6"
|
|
5907
|
+
},
|
|
5908
|
+
nativeLinkDialogButtonText: {
|
|
5909
|
+
color: "#111827",
|
|
5910
|
+
fontSize: 17,
|
|
5911
|
+
fontWeight: "600"
|
|
5912
|
+
},
|
|
5913
|
+
nativeLinkDialogPrimaryButton: {
|
|
5914
|
+
borderColor: "#18181b",
|
|
5915
|
+
backgroundColor: "#18181b"
|
|
5916
|
+
},
|
|
5917
|
+
nativeLinkDialogPrimaryButtonPressed: {
|
|
5918
|
+
backgroundColor: "#27272a"
|
|
5919
|
+
},
|
|
5920
|
+
nativeLinkDialogDisabledButton: {
|
|
5921
|
+
borderColor: "#9ca3af",
|
|
5922
|
+
backgroundColor: "#9ca3af"
|
|
5923
|
+
},
|
|
5924
|
+
nativeLinkDialogPrimaryButtonText: {
|
|
5925
|
+
color: "#ffffff",
|
|
5926
|
+
fontSize: 17,
|
|
5927
|
+
fontWeight: "700"
|
|
5928
|
+
}
|
|
5929
|
+
});
|
|
5740
5930
|
|
|
5741
5931
|
export { DEFAULT_LINK_CARD_SIZE, DEFAULT_NATIVE_OVERFLOW_TOOL_IDS, DEFAULT_NATIVE_VECTOR_TOOLS, NATIVE_STYLE_PALETTE, NativeInteractionOverlay, NativeSceneRenderer, NativeShapeRenderer, NativeVectorStyleInspector, NativeVectorToolbar, NativeVectorViewport, createFreehandStrokeItem, createImageItem, createLinkItem, createShapeId, getLinkData, isLinkItem, nativeStyleColorWithOpacity, normalizeNativeStyleHex, parseSvgFragment };
|
|
5742
5932
|
//# sourceMappingURL=native.js.map
|