@dtducas/wh-forge-viewer 3.0.0-beta.2 → 3.0.0-beta.4
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/index.d.ts +1 -2
- package/dist/index.esm.js +118 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +118 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -94820,7 +94820,9 @@ function MinimapPanel(_ref) {
|
|
|
94820
94820
|
totalPages = _ref$totalPages === void 0 ? 1 : _ref$totalPages,
|
|
94821
94821
|
viewableGuid = _ref.viewableGuid,
|
|
94822
94822
|
filePath = _ref.filePath,
|
|
94823
|
-
onClose = _ref.onClose
|
|
94823
|
+
onClose = _ref.onClose,
|
|
94824
|
+
_ref$sidebarOffset = _ref.sidebarOffset,
|
|
94825
|
+
sidebarOffset = _ref$sidebarOffset === void 0 ? 56 : _ref$sidebarOffset;
|
|
94824
94826
|
var _useMinimapThumbnail = useMinimapThumbnail({
|
|
94825
94827
|
filePath: filePath,
|
|
94826
94828
|
viewableGuid: viewableGuid,
|
|
@@ -95041,7 +95043,9 @@ function MinimapPanel(_ref) {
|
|
|
95041
95043
|
var panelStyle = position ? {
|
|
95042
95044
|
left: position.x,
|
|
95043
95045
|
top: position.y
|
|
95044
|
-
} : {
|
|
95046
|
+
} : {
|
|
95047
|
+
left: sidebarOffset
|
|
95048
|
+
};
|
|
95045
95049
|
return jsxRuntime.jsxs("div", {
|
|
95046
95050
|
ref: panelRef,
|
|
95047
95051
|
className: "wh-minimap-panel".concat(shouldShow ? ' wh-minimap-panel--visible' : ''),
|
|
@@ -95698,7 +95702,9 @@ function ViewerSidebar(_ref3) {
|
|
|
95698
95702
|
_ref3$hidePanels = _ref3.hidePanels,
|
|
95699
95703
|
hidePanels = _ref3$hidePanels === void 0 ? [] : _ref3$hidePanels,
|
|
95700
95704
|
_ref3$className = _ref3.className,
|
|
95701
|
-
className = _ref3$className === void 0 ? '' : _ref3$className
|
|
95705
|
+
className = _ref3$className === void 0 ? '' : _ref3$className,
|
|
95706
|
+
isDraftShared = _ref3.isDraftShared,
|
|
95707
|
+
onToggleDraftShared = _ref3.onToggleDraftShared;
|
|
95702
95708
|
var handleClick = function handleClick(panel) {
|
|
95703
95709
|
// Toggle off if already active
|
|
95704
95710
|
onPanelChange === null || onPanelChange === void 0 || onPanelChange(activePanel === panel ? null : panel);
|
|
@@ -95743,6 +95749,62 @@ function ViewerSidebar(_ref3) {
|
|
|
95743
95749
|
children: jsxRuntime.jsx(IconSubmit, {})
|
|
95744
95750
|
}), jsxRuntime.jsx("div", {
|
|
95745
95751
|
className: 'wh-sidebar-spacer'
|
|
95752
|
+
}), onToggleDraftShared !== undefined && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
95753
|
+
children: [jsxRuntime.jsx("hr", {
|
|
95754
|
+
className: 'wh-sidebar-divider'
|
|
95755
|
+
}), jsxRuntime.jsx("button", {
|
|
95756
|
+
type: 'button',
|
|
95757
|
+
className: 'wh-sidebar-btn',
|
|
95758
|
+
"data-tooltip": isDraftShared ? 'Stop sharing draft' : 'Share draft',
|
|
95759
|
+
"aria-pressed": isDraftShared,
|
|
95760
|
+
onClick: function onClick() {
|
|
95761
|
+
return onToggleDraftShared(!isDraftShared);
|
|
95762
|
+
},
|
|
95763
|
+
style: {
|
|
95764
|
+
width: 36,
|
|
95765
|
+
height: 36,
|
|
95766
|
+
borderRadius: 6,
|
|
95767
|
+
border: isDraftShared ? '1.5px solid #6366f1' : '1.5px solid transparent',
|
|
95768
|
+
background: isDraftShared ? '#ede9fe' : undefined,
|
|
95769
|
+
color: isDraftShared ? '#6366f1' : '#6b7280',
|
|
95770
|
+
flexShrink: 0,
|
|
95771
|
+
transition: 'border-color 0.15s, background 0.15s, color 0.15s'
|
|
95772
|
+
},
|
|
95773
|
+
children: jsxRuntime.jsxs("svg", {
|
|
95774
|
+
width: '18',
|
|
95775
|
+
height: '18',
|
|
95776
|
+
viewBox: '0 0 24 24',
|
|
95777
|
+
fill: 'none',
|
|
95778
|
+
stroke: 'currentColor',
|
|
95779
|
+
strokeWidth: '2',
|
|
95780
|
+
strokeLinecap: 'round',
|
|
95781
|
+
strokeLinejoin: 'round',
|
|
95782
|
+
"aria-hidden": 'true',
|
|
95783
|
+
children: [jsxRuntime.jsx("circle", {
|
|
95784
|
+
cx: '18',
|
|
95785
|
+
cy: '5',
|
|
95786
|
+
r: '3'
|
|
95787
|
+
}), jsxRuntime.jsx("circle", {
|
|
95788
|
+
cx: '6',
|
|
95789
|
+
cy: '12',
|
|
95790
|
+
r: '3'
|
|
95791
|
+
}), jsxRuntime.jsx("circle", {
|
|
95792
|
+
cx: '18',
|
|
95793
|
+
cy: '19',
|
|
95794
|
+
r: '3'
|
|
95795
|
+
}), jsxRuntime.jsx("line", {
|
|
95796
|
+
x1: '8.59',
|
|
95797
|
+
y1: '13.51',
|
|
95798
|
+
x2: '15.42',
|
|
95799
|
+
y2: '17.49'
|
|
95800
|
+
}), jsxRuntime.jsx("line", {
|
|
95801
|
+
x1: '15.41',
|
|
95802
|
+
y1: '6.51',
|
|
95803
|
+
x2: '8.59',
|
|
95804
|
+
y2: '10.49'
|
|
95805
|
+
})]
|
|
95806
|
+
})
|
|
95807
|
+
})]
|
|
95746
95808
|
}), jsxRuntime.jsx("hr", {
|
|
95747
95809
|
className: 'wh-sidebar-divider'
|
|
95748
95810
|
}), jsxRuntime.jsx(PresenceIndicator, {
|
|
@@ -95815,6 +95877,9 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
95815
95877
|
checkSubmitHasMarkup = _ref.checkSubmitHasMarkup,
|
|
95816
95878
|
_ref$defaultActiveSid = _ref.defaultActiveSidebarPanel,
|
|
95817
95879
|
defaultActiveSidebarPanel = _ref$defaultActiveSid === void 0 ? null : _ref$defaultActiveSid,
|
|
95880
|
+
onSidebarWidthChange = _ref.onSidebarWidthChange,
|
|
95881
|
+
isDraftShared = _ref.isDraftShared,
|
|
95882
|
+
onToggleDraftShared = _ref.onToggleDraftShared,
|
|
95818
95883
|
collabAdapter = _ref.collabAdapter,
|
|
95819
95884
|
collabActorId = _ref.collabActorId,
|
|
95820
95885
|
collabDrawingId = _ref.collabDrawingId,
|
|
@@ -95929,6 +95994,7 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
95929
95994
|
}, [onPublish]);
|
|
95930
95995
|
var collabSessionRef = React.useRef(null);
|
|
95931
95996
|
var canvasExportServiceRef = React.useRef(null);
|
|
95997
|
+
var cursorCleanupRef = React.useRef(null);
|
|
95932
95998
|
var getExportViewablePagesRef = React.useRef(getExportViewablePages);
|
|
95933
95999
|
React.useEffect(function () {
|
|
95934
96000
|
getExportViewablePagesRef.current = getExportViewablePages;
|
|
@@ -96041,7 +96107,7 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96041
96107
|
onSuccess: function () {
|
|
96042
96108
|
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
96043
96109
|
var _sceneBuilderService$, _sceneBuilderService;
|
|
96044
|
-
var engine, _engine$stamps, _engine$stamps2, _engine$stamps3, capabilities, enhancedViewer, _engine$markup;
|
|
96110
|
+
var engine, _engine$stamps, _engine$stamps2, _engine$stamps3, capabilities, enhancedViewer, _engine$markup, _cursorCallbacks, _cursorContainer, _onPointerMove;
|
|
96045
96111
|
return _regenerator().w(function (_context) {
|
|
96046
96112
|
while (1) switch (_context.n) {
|
|
96047
96113
|
case 0:
|
|
@@ -96113,6 +96179,41 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96113
96179
|
|
|
96114
96180
|
// Viewer presets
|
|
96115
96181
|
enhancedViewer.presetManager = presetManager;
|
|
96182
|
+
|
|
96183
|
+
// ─── World-space cursor tracking ──────────────────────────
|
|
96184
|
+
// Emit pointer-move events in Forge world space so remote cursors
|
|
96185
|
+
// are zoom-invariant and screen-size-invariant on all receivers.
|
|
96186
|
+
_cursorCallbacks = new Set();
|
|
96187
|
+
enhancedViewer.onLocalCursorMove = function (cb) {
|
|
96188
|
+
_cursorCallbacks.add(cb);
|
|
96189
|
+
return function () {
|
|
96190
|
+
return _cursorCallbacks["delete"](cb);
|
|
96191
|
+
};
|
|
96192
|
+
};
|
|
96193
|
+
_cursorContainer = viewer.container;
|
|
96194
|
+
_onPointerMove = function _onPointerMove(e) {
|
|
96195
|
+
if (!_cursorCallbacks.size) return;
|
|
96196
|
+
var rect = _cursorContainer.getBoundingClientRect();
|
|
96197
|
+
var hit = viewer.clientToWorld(e.clientX - rect.left, e.clientY - rect.top, true);
|
|
96198
|
+
if (!(hit !== null && hit !== void 0 && hit.point)) return;
|
|
96199
|
+
var payload = {
|
|
96200
|
+
position: {
|
|
96201
|
+
x: hit.point.x,
|
|
96202
|
+
y: hit.point.y
|
|
96203
|
+
},
|
|
96204
|
+
coordSystem: 'markup'
|
|
96205
|
+
};
|
|
96206
|
+
_cursorCallbacks.forEach(function (cb) {
|
|
96207
|
+
return cb(payload);
|
|
96208
|
+
});
|
|
96209
|
+
};
|
|
96210
|
+
_cursorContainer.addEventListener('pointermove', _onPointerMove, {
|
|
96211
|
+
passive: true
|
|
96212
|
+
});
|
|
96213
|
+
cursorCleanupRef.current = function () {
|
|
96214
|
+
_cursorContainer.removeEventListener('pointermove', _onPointerMove);
|
|
96215
|
+
delete enhancedViewer.onLocalCursorMove;
|
|
96216
|
+
};
|
|
96116
96217
|
setViewer(enhancedViewer);
|
|
96117
96218
|
}
|
|
96118
96219
|
case 4:
|
|
@@ -96153,7 +96254,9 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96153
96254
|
}();
|
|
96154
96255
|
initializeViewer();
|
|
96155
96256
|
return function () {
|
|
96156
|
-
var _canvasExportServiceR, _markupMgrRef$current, _overlayManagerRef$cu, _sceneBuilderRef$curr;
|
|
96257
|
+
var _cursorCleanupRef$cur, _canvasExportServiceR, _markupMgrRef$current, _overlayManagerRef$cu, _sceneBuilderRef$curr;
|
|
96258
|
+
(_cursorCleanupRef$cur = cursorCleanupRef.current) === null || _cursorCleanupRef$cur === void 0 || _cursorCleanupRef$cur.call(cursorCleanupRef);
|
|
96259
|
+
cursorCleanupRef.current = null;
|
|
96157
96260
|
(_canvasExportServiceR = canvasExportServiceRef.current) === null || _canvasExportServiceR === void 0 || _canvasExportServiceR.destroy();
|
|
96158
96261
|
canvasExportServiceRef.current = null;
|
|
96159
96262
|
(_markupMgrRef$current = markupMgrRef.current) === null || _markupMgrRef$current === void 0 || _markupMgrRef$current.destroy();
|
|
@@ -96579,6 +96682,11 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96579
96682
|
viewerInstance === null || viewerInstance === void 0 || (_viewerInstance$resiz = viewerInstance.resize) === null || _viewerInstance$resiz === void 0 || _viewerInstance$resiz.call(viewerInstance);
|
|
96580
96683
|
}, [viewerInstance, activeSidebarPanel, panelWidth, showDrawer, drawerWidth]);
|
|
96581
96684
|
|
|
96685
|
+
// Notify host app of total sidebar width so it can adjust external layout.
|
|
96686
|
+
React.useEffect(function () {
|
|
96687
|
+
onSidebarWidthChange === null || onSidebarWidthChange === void 0 || onSidebarWidthChange(activeSidebarPanel ? 44 + panelWidth : 0);
|
|
96688
|
+
}, [activeSidebarPanel, panelWidth, onSidebarWidthChange]);
|
|
96689
|
+
|
|
96582
96690
|
// ─── Callbacks ────────────────────────────────────────────────────────────
|
|
96583
96691
|
var handleDrawerPropertyChange = React.useCallback(function (key, value) {
|
|
96584
96692
|
var _markupMgrRef$current4;
|
|
@@ -96680,7 +96788,9 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96680
96788
|
onPanelChange: setActiveSidebarPanel,
|
|
96681
96789
|
onlineUsers: onlineUsers,
|
|
96682
96790
|
showSubmitPanel: !!submitConfig,
|
|
96683
|
-
hidePanels: hidePanels
|
|
96791
|
+
hidePanels: hidePanels,
|
|
96792
|
+
isDraftShared: onToggleDraftShared !== undefined ? isDraftShared !== null && isDraftShared !== void 0 ? isDraftShared : false : undefined,
|
|
96793
|
+
onToggleDraftShared: onToggleDraftShared
|
|
96684
96794
|
}), activeSidebarPanel === 'sheets' && /*#__PURE__*/jsxRuntime.jsx(SheetsPanel, {
|
|
96685
96795
|
viewables: viewables,
|
|
96686
96796
|
currentIndex: currentPageIndex,
|
|
@@ -96747,7 +96857,8 @@ var ViewerForgePDF = function ViewerForgePDF(_ref) {
|
|
|
96747
96857
|
filePath: filePath,
|
|
96748
96858
|
onClose: function onClose() {
|
|
96749
96859
|
return setShowMinimap(false);
|
|
96750
|
-
}
|
|
96860
|
+
},
|
|
96861
|
+
sidebarOffset: activeSidebarPanel ? 44 + panelWidth + 8 : 52
|
|
96751
96862
|
}), showMarkupToolbar && markupEngineInstance && /*#__PURE__*/jsxRuntime.jsx(SelectionActionToolbar, {
|
|
96752
96863
|
engine: markupEngineInstance,
|
|
96753
96864
|
viewerContainer: viewerContainerRef.current,
|