@papyrus-sdk/ui-react-native 0.2.16 → 0.2.18-beta.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.
@@ -1,90 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // gesture/selectionInteraction.ts
20
- var selectionInteraction_exports = {};
21
- __export(selectionInteraction_exports, {
22
- getSelectionEdgeAutoscroll: () => getSelectionEdgeAutoscroll,
23
- getToolDockDismissState: () => getToolDockDismissState,
24
- isToolDockToolSelected: () => isToolDockToolSelected,
25
- shouldEnableSelectionDrag: () => shouldEnableSelectionDrag,
26
- shouldEnableViewerScroll: () => shouldEnableViewerScroll
27
- });
28
- module.exports = __toCommonJS(selectionInteraction_exports);
29
- var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
30
- var DRAG_SELECTION_TOOLS = /* @__PURE__ */ new Set([
31
- "highlight",
32
- "underline",
33
- "squiggly",
34
- "strikeout"
35
- ]);
36
- var resolveAxisAutoscroll = (coordinate, size, threshold, maxStep) => {
37
- if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;
38
- const startDistance = clamp(coordinate, 0, size);
39
- if (startDistance < threshold) {
40
- const intensity = 1 - startDistance / threshold;
41
- return -Math.round(maxStep * intensity);
42
- }
43
- const endDistance = clamp(size - coordinate, 0, size);
44
- if (endDistance < threshold) {
45
- const intensity = 1 - endDistance / threshold;
46
- return Math.round(maxStep * intensity);
47
- }
48
- return 0;
49
- };
50
- var shouldEnableViewerScroll = ({
51
- selectionDragActive,
52
- gestureScrollLockActive = false
53
- }) => !selectionDragActive && !gestureScrollLockActive;
54
- var shouldEnableSelectionDrag = ({
55
- activeTool,
56
- interactionMode
57
- }) => DRAG_SELECTION_TOOLS.has(activeTool) || activeTool === "select" && interactionMode === "select";
58
- var isToolDockToolSelected = ({
59
- activeTool,
60
- interactionMode,
61
- toolId
62
- }) => toolId === "select" ? activeTool === "select" && interactionMode === "select" : activeTool === toolId;
63
- var getToolDockDismissState = ({
64
- activeTool: _activeTool,
65
- interactionMode: _interactionMode
66
- }) => ({
67
- toolDockOpen: false,
68
- activeTool: "select",
69
- interactionMode: "pan"
70
- });
71
- var getSelectionEdgeAutoscroll = ({
72
- x,
73
- y,
74
- width,
75
- height,
76
- threshold,
77
- maxStep
78
- }) => ({
79
- dx: resolveAxisAutoscroll(x, width, threshold, maxStep),
80
- dy: resolveAxisAutoscroll(y, height, threshold, maxStep)
81
- });
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
84
- getSelectionEdgeAutoscroll,
85
- getToolDockDismissState,
86
- isToolDockToolSelected,
87
- shouldEnableSelectionDrag,
88
- shouldEnableViewerScroll
89
- });
90
- //# sourceMappingURL=selectionInteraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../gesture/selectionInteraction.ts"],"sourcesContent":["export type ViewerScrollState = {\n selectionDragActive: boolean;\n gestureScrollLockActive?: boolean;\n};\n\nexport type SelectionGestureTool =\n | \"select\"\n | \"highlight\"\n | \"underline\"\n | \"squiggly\"\n | \"strikeout\"\n | \"text\"\n | \"comment\"\n | \"ink\";\n\nexport type SelectionInteractionMode = \"pan\" | \"select\";\n\nexport type SelectionGestureActivationInput = {\n activeTool: SelectionGestureTool;\n interactionMode: SelectionInteractionMode;\n};\n\nexport type ToolDockSelectionState = SelectionGestureActivationInput & {\n toolId: SelectionGestureTool;\n};\n\nexport type ToolDockDismissState = SelectionGestureActivationInput & {\n toolDockOpen: boolean;\n};\n\nexport type SelectionEdgeAutoscrollInput = {\n x: number;\n y: number;\n width: number;\n height: number;\n threshold: number;\n maxStep: number;\n};\n\nexport type SelectionEdgeAutoscroll = {\n dx: number;\n dy: number;\n};\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.min(max, Math.max(min, value));\n\nconst DRAG_SELECTION_TOOLS = new Set<SelectionGestureTool>([\n \"highlight\",\n \"underline\",\n \"squiggly\",\n \"strikeout\",\n]);\n\nconst resolveAxisAutoscroll = (\n coordinate: number,\n size: number,\n threshold: number,\n maxStep: number\n) => {\n if (size <= 0 || threshold <= 0 || maxStep <= 0) return 0;\n\n const startDistance = clamp(coordinate, 0, size);\n if (startDistance < threshold) {\n const intensity = 1 - startDistance / threshold;\n return -Math.round(maxStep * intensity);\n }\n\n const endDistance = clamp(size - coordinate, 0, size);\n if (endDistance < threshold) {\n const intensity = 1 - endDistance / threshold;\n return Math.round(maxStep * intensity);\n }\n\n return 0;\n};\n\nexport const shouldEnableViewerScroll = ({\n selectionDragActive,\n gestureScrollLockActive = false,\n}: ViewerScrollState) => !selectionDragActive && !gestureScrollLockActive;\n\nexport const shouldEnableSelectionDrag = ({\n activeTool,\n interactionMode,\n}: SelectionGestureActivationInput) =>\n DRAG_SELECTION_TOOLS.has(activeTool) ||\n (activeTool === \"select\" && interactionMode === \"select\");\n\nexport const isToolDockToolSelected = ({\n activeTool,\n interactionMode,\n toolId,\n}: ToolDockSelectionState) =>\n toolId === \"select\"\n ? activeTool === \"select\" && interactionMode === \"select\"\n : activeTool === toolId;\n\nexport const getToolDockDismissState = ({\n activeTool: _activeTool,\n interactionMode: _interactionMode,\n}: SelectionGestureActivationInput): ToolDockDismissState => ({\n toolDockOpen: false,\n activeTool: \"select\",\n interactionMode: \"pan\",\n});\n\nexport const getSelectionEdgeAutoscroll = ({\n x,\n y,\n width,\n height,\n threshold,\n maxStep,\n}: SelectionEdgeAutoscrollInput): SelectionEdgeAutoscroll => ({\n dx: resolveAxisAutoscroll(x, width, threshold, maxStep),\n dy: resolveAxisAutoscroll(y, height, threshold, maxStep),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CA,IAAM,QAAQ,CAAC,OAAe,KAAa,QACzC,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAEpC,IAAM,uBAAuB,oBAAI,IAA0B;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,wBAAwB,CAC5B,YACA,MACA,WACA,YACG;AACH,MAAI,QAAQ,KAAK,aAAa,KAAK,WAAW,EAAG,QAAO;AAExD,QAAM,gBAAgB,MAAM,YAAY,GAAG,IAAI;AAC/C,MAAI,gBAAgB,WAAW;AAC7B,UAAM,YAAY,IAAI,gBAAgB;AACtC,WAAO,CAAC,KAAK,MAAM,UAAU,SAAS;AAAA,EACxC;AAEA,QAAM,cAAc,MAAM,OAAO,YAAY,GAAG,IAAI;AACpD,MAAI,cAAc,WAAW;AAC3B,UAAM,YAAY,IAAI,cAAc;AACpC,WAAO,KAAK,MAAM,UAAU,SAAS;AAAA,EACvC;AAEA,SAAO;AACT;AAEO,IAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA,0BAA0B;AAC5B,MAAyB,CAAC,uBAAuB,CAAC;AAE3C,IAAM,4BAA4B,CAAC;AAAA,EACxC;AAAA,EACA;AACF,MACE,qBAAqB,IAAI,UAAU,KAClC,eAAe,YAAY,oBAAoB;AAE3C,IAAM,yBAAyB,CAAC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AACF,MACE,WAAW,WACP,eAAe,YAAY,oBAAoB,WAC/C,eAAe;AAEd,IAAM,0BAA0B,CAAC;AAAA,EACtC,YAAY;AAAA,EACZ,iBAAiB;AACnB,OAA8D;AAAA,EAC5D,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,iBAAiB;AACnB;AAEO,IAAM,6BAA6B,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,OAA8D;AAAA,EAC5D,IAAI,sBAAsB,GAAG,OAAO,WAAW,OAAO;AAAA,EACtD,IAAI,sBAAsB,GAAG,QAAQ,WAAW,OAAO;AACzD;","names":[]}
@@ -1,16 +0,0 @@
1
- import {
2
- getSelectionEdgeAutoscroll,
3
- getToolDockDismissState,
4
- isToolDockToolSelected,
5
- shouldEnableSelectionDrag,
6
- shouldEnableViewerScroll
7
- } from "../chunk-KXNP73MZ.mjs";
8
- import "../chunk-ZD7AOCMD.mjs";
9
- export {
10
- getSelectionEdgeAutoscroll,
11
- getToolDockDismissState,
12
- isToolDockToolSelected,
13
- shouldEnableSelectionDrag,
14
- shouldEnableViewerScroll
15
- };
16
- //# sourceMappingURL=selectionInteraction.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}