@interopio/groups-ui-react 2.7.1 → 3.0.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/dist/cjs/index.js CHANGED
@@ -68,6 +68,11 @@
68
68
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
69
69
  };
70
70
 
71
+ var StandardButtonTarget;
72
+ (function (StandardButtonTarget) {
73
+ StandardButtonTarget["Default"] = "default";
74
+ StandardButtonTarget["Frame"] = "frame";
75
+ })(StandardButtonTarget || (StandardButtonTarget = {}));
71
76
  var TargetType;
72
77
  (function (TargetType) {
73
78
  TargetType["Group"] = "group";
@@ -306,6 +311,20 @@
306
311
  }
307
312
  window.webGroupsManager.externalLibraryFactory.onCaptionTextBoundsChanged(targetType, targetId, bounds);
308
313
  };
314
+ WebGroupsManagerDecorator.prototype.startDragMove = function () {
315
+ if (typeof window.webGroupsManager.externalLibraryFactory.startDragMove !== "function") {
316
+ // Handling the case when a new library is used with an older version of io.Connect Desktop
317
+ return;
318
+ }
319
+ window.webGroupsManager.externalLibraryFactory.startDragMove();
320
+ };
321
+ WebGroupsManagerDecorator.prototype.showCaptionEditor = function (targetType, targetId, text) {
322
+ if (typeof window.webGroupsManager.externalLibraryFactory.showCaptionEditor !== "function") {
323
+ // Handling the case when a new library is used with an older version of io.Connect Desktop
324
+ return;
325
+ }
326
+ window.webGroupsManager.externalLibraryFactory.showCaptionEditor(targetType, targetId, text);
327
+ };
309
328
  WebGroupsManagerDecorator.prototype.onCaptionEditorVisibleChanged = function (targetType, targetId, visible) {
310
329
  if (typeof window.webGroupsManager.externalLibraryFactory.onCaptionEditorVisibleChanged !== "function") {
311
330
  // Handling the case when a new library is used with an older version of io.Connect Desktop
@@ -376,9 +395,31 @@
376
395
  React__default["default"].createElement("div", __assign({}, innerElement)));
377
396
  };
378
397
 
379
- var CloseButton = function (_a) {
380
- var onClick = _a.onClick, tooltip = _a.tooltip;
381
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-close" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-close", title: tooltip, onClick: onClick } });
398
+ function getStandardButtonInnerClassName(buttonId, target) {
399
+ var classNames = "t42-standard-button t42-standard-button-" + buttonId;
400
+ if (target && target !== StandardButtonTarget.Default) {
401
+ classNames = classNames.concat(" t42-standard-button-" + target + "-" + buttonId);
402
+ }
403
+ return classNames;
404
+ }
405
+ function getStandardButtonOuterClassName(buttonId, target, isPressed) {
406
+ var classNames = "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-" + buttonId;
407
+ if (isPressed === true) {
408
+ classNames = classNames.concat(" active");
409
+ }
410
+ if (target && target !== StandardButtonTarget.Default) {
411
+ classNames = classNames.concat(" t42-caption-bar-button-" + target + "-" + buttonId);
412
+ }
413
+ return classNames;
414
+ }
415
+
416
+ var StandardButton = function (_a) {
417
+ var buttonId = _a.buttonId, target = _a.target, isPressed = _a.isPressed, tooltip = _a.tooltip, onClick = _a.onClick;
418
+ return React__default["default"].createElement(BaseButton, { innerElement: { className: getStandardButtonInnerClassName(buttonId, target) }, outerElement: { className: getStandardButtonOuterClassName(buttonId, target, isPressed), title: tooltip, onClick: onClick } });
419
+ };
420
+
421
+ var CloseButton = function (props) {
422
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Close }, props));
382
423
  };
383
424
 
384
425
  /**
@@ -412,7 +453,7 @@
412
453
  const reducedHexMatch = reducedHexRegex.exec(normalizedColor);
413
454
  if (reducedHexMatch) {
414
455
  const arr = Array.from(reducedHexMatch).slice(1);
415
- return [...arr.slice(0, 3).map(x => parseInt(r$1(x, 2), 16)), parseInt(r$1(arr[3] || 'f', 2), 16) / 255];
456
+ return [...arr.slice(0, 3).map(x => parseInt(r(x, 2), 16)), parseInt(r(arr[3] || 'f', 2), 16) / 255];
416
457
  }
417
458
  const hexMatch = hexRegex.exec(normalizedColor);
418
459
  if (hexMatch) {
@@ -469,10 +510,10 @@
469
510
  if (!result) throw new ColorError$1(color);
470
511
  return `#${result}`;
471
512
  }
472
- const r$1 = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
473
- const reducedHexRegex = new RegExp(`^#${r$1('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');
474
- const hexRegex = new RegExp(`^#${r$1('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');
475
- const rgbaRegex = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r$1(',\\s*(\\d+)\\s*', 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, 'i');
513
+ const r = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
514
+ const reducedHexRegex = new RegExp(`^#${r('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');
515
+ const hexRegex = new RegExp(`^#${r('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');
516
+ const rgbaRegex = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r(',\\s*(\\d+)\\s*', 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, 'i');
476
517
  const hslaRegex = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;
477
518
  const namedColorRegex = /^[a-z]+$/i;
478
519
  const roundColor = color => {
@@ -549,11 +590,8 @@
549
590
  var r = rgba[0];
550
591
  var g = rgba[1];
551
592
  var b = rgba[2];
552
- var displayGamma = 2.2;
553
- var backgroundWeight = 0.2126 * Math.pow(r / 255.0, displayGamma) +
554
- 0.7152 * Math.pow(g / 255.0, displayGamma) +
555
- 0.0722 * Math.pow(b / 255.0, displayGamma);
556
- return backgroundWeight > Math.pow(0.5, displayGamma);
593
+ var backgroundWeight = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
594
+ return backgroundWeight > 0.5;
557
595
  }
558
596
  catch (_a) {
559
597
  // Fallback to other implementation
@@ -631,50 +669,40 @@
631
669
  return React__default["default"].createElement(BaseChannelSelector, { outsideClass: channelLabel ? "t42-frame-caption-bar-element t42-frame-channel-selector t42-channel-selector-direction" : "t42-frame-caption-bar-element t42-frame-channel-selector", contentClass: !channelLabel ? "t42-frame-channel-selector-content" : "", showSelector: showSelector, selectedChannel: selectedChannel, selectedChannelColor: selectedChannelColor, direction: getChannelDirection(channelRestrictions), channelLabel: channelLabel });
632
670
  };
633
671
 
634
- var ExtractButton = function (_a) {
635
- var onClick = _a.onClick, tooltip = _a.tooltip;
636
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-extract" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-extract", title: tooltip, onClick: onClick } });
672
+ var ExtractButton = function (props) {
673
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Extract }, props));
637
674
  };
638
675
 
639
- var FeedbackButton = function (_a) {
640
- var onClick = _a.onClick, tooltip = _a.tooltip;
641
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-feedback" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-feedback", title: tooltip, onClick: onClick } });
676
+ var FeedbackButton = function (props) {
677
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Feedback }, props));
642
678
  };
643
679
 
644
- var CloneButton = function (_a) {
645
- var onClick = _a.onClick, tooltip = _a.tooltip;
646
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-clone" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-clone", title: tooltip, onClick: onClick } });
680
+ var CloneButton = function (props) {
681
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Clone }, props));
647
682
  };
648
683
 
649
- var StickyButton = function (_a) {
650
- var onClick = _a.onClick, tooltip = _a.tooltip, isPressed = _a.isPressed;
651
- var outerElementClassName = "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-sticky";
652
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-sticky" }, outerElement: { className: isPressed ? outerElementClassName + " active" : outerElementClassName, title: tooltip, onClick: onClick } });
684
+ var StickyButton = function (props) {
685
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Sticky }, props));
653
686
  };
654
687
 
655
- var LockButton = function (_a) {
656
- var tooltip = _a.tooltip, onClick = _a.onClick;
657
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-lock" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-lock", title: tooltip, onClick: onClick } });
688
+ var LockButton = function (props) {
689
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Lock }, props));
658
690
  };
659
691
 
660
- var MaximizeButton = function (_a) {
661
- var tooltip = _a.tooltip, onClick = _a.onClick;
662
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-maximize" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-maximize", title: tooltip, onClick: onClick } });
692
+ var MaximizeButton = function (props) {
693
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Maximize }, props));
663
694
  };
664
695
 
665
- var MinimizeButton = function (_a) {
666
- var onClick = _a.onClick, tooltip = _a.tooltip;
667
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-minimize" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-minimize", title: tooltip, onClick: onClick } });
696
+ var MinimizeButton = function (props) {
697
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Minimize }, props));
668
698
  };
669
699
 
670
- var RestoreButton = function (_a) {
671
- var tooltip = _a.tooltip, onClick = _a.onClick;
672
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-restore" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-restore", title: tooltip, onClick: onClick } });
700
+ var RestoreButton = function (props) {
701
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Restore }, props));
673
702
  };
674
703
 
675
- var UnlockButton = function (_a) {
676
- var tooltip = _a.tooltip, onClick = _a.onClick;
677
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-unlock" }, outerElement: { className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-unlock", title: tooltip, onClick: onClick } });
704
+ var UnlockButton = function (props) {
705
+ return React__default["default"].createElement(StandardButton, __assign({ buttonId: StandardButtons.Unlock }, props));
678
706
  };
679
707
 
680
708
  var CustomButton = function (_a) {
@@ -1673,11 +1701,76 @@
1673
1701
  }, [ref]);
1674
1702
  }
1675
1703
 
1704
+ function useDragMove(option) {
1705
+ var _a = (option || {}).threshold, threshold = _a === void 0 ? 3 : _a;
1706
+ var initialPos = React.useRef(null);
1707
+ var onMoveRef = React.useRef();
1708
+ var onUpRef = React.useRef();
1709
+ var cleanup = function () {
1710
+ document.removeEventListener("mousemove", onMoveRef.current, true);
1711
+ document.removeEventListener("mouseup", onUpRef.current, true);
1712
+ initialPos.current = null;
1713
+ document.body.style.pointerEvents = "auto";
1714
+ };
1715
+ if (!onMoveRef.current) {
1716
+ onMoveRef.current = function (ev) {
1717
+ if (!initialPos.current)
1718
+ return;
1719
+ var dx = ev.pageX - initialPos.current.x;
1720
+ var dy = ev.pageY - initialPos.current.y;
1721
+ if (Math.abs(dx) >= threshold || Math.abs(dy) >= threshold) {
1722
+ document.body.style.pointerEvents = "none";
1723
+ cleanup();
1724
+ webGroupsManager.startDragMove();
1725
+ }
1726
+ ev.stopPropagation();
1727
+ ev.preventDefault();
1728
+ };
1729
+ }
1730
+ if (!onUpRef.current) {
1731
+ onUpRef.current = function (ev) {
1732
+ cleanup();
1733
+ ev.stopPropagation();
1734
+ ev.preventDefault();
1735
+ };
1736
+ }
1737
+ var startDrag = function (ev) {
1738
+ if (ev.button !== 0)
1739
+ return;
1740
+ initialPos.current = { x: ev.pageX, y: ev.pageY };
1741
+ document.addEventListener("mousemove", onMoveRef.current, true);
1742
+ document.addEventListener("mouseup", onUpRef.current, true);
1743
+ ev.stopPropagation();
1744
+ ev.preventDefault();
1745
+ };
1746
+ React.useEffect(function () {
1747
+ return function () {
1748
+ if (onMoveRef.current)
1749
+ document.removeEventListener("mousemove", onMoveRef.current, true);
1750
+ if (onUpRef.current)
1751
+ document.removeEventListener("mouseup", onUpRef.current, true);
1752
+ document.body.style.pointerEvents = "auto";
1753
+ initialPos.current = null;
1754
+ };
1755
+ }, []);
1756
+ return { startDrag: startDrag };
1757
+ }
1758
+
1676
1759
  var FlatCaption = function (_a) {
1677
- var caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
1760
+ var showCaptionEditor = _a.showCaptionEditor, caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
1678
1761
  var ref = React.useRef(null);
1679
1762
  useEditableCaption(ref, { notifyBoundsChanged: notifyBoundsChanged });
1680
- return React__default["default"].createElement("div", { ref: ref, className: "t42-caption t42-title t42-frame-caption-bar-element" }, caption);
1763
+ var startDrag = useDragMove().startDrag;
1764
+ var handleMouseDown = function (e) {
1765
+ if (e.button !== 0)
1766
+ return;
1767
+ startDrag(e);
1768
+ };
1769
+ var handleDoubleClick = function (e) {
1770
+ showCaptionEditor(caption);
1771
+ e.stopPropagation();
1772
+ };
1773
+ return (React__default["default"].createElement("div", { ref: ref, className: "t42-caption t42-title t42-frame-caption-bar-element", onMouseDown: handleMouseDown, onDoubleClick: handleDoubleClick }, caption));
1681
1774
  };
1682
1775
 
1683
1776
  function useCaptionEditor(ref, options) {
@@ -1837,11 +1930,11 @@
1837
1930
  };
1838
1931
 
1839
1932
  var FlatCaptionBar = function (_a) {
1840
- var moveAreaId = _a.moveAreaId, caption = _a.caption, channels = _a.channels, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "caption", "channels", "captionEditor", "notifyCaptionBoundsChanged"]);
1933
+ var moveAreaId = _a.moveAreaId, caption = _a.caption, showCaptionEditor = _a.showCaptionEditor, channels = _a.channels, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "caption", "showCaptionEditor", "channels", "captionEditor", "notifyCaptionBoundsChanged"]);
1841
1934
  return (React__default["default"].createElement("div", { className: "t42-react-caption-bar" },
1842
1935
  (channels === null || channels === void 0 ? void 0 : channels.visible) && channels.channelsMode !== "multi" && React__default["default"].createElement(FlatChannelSelector, { showSelector: channels === null || channels === void 0 ? void 0 : channels.showSelector, selectedChannel: channels === null || channels === void 0 ? void 0 : channels.selectedChannel, selectedChannelColor: channels === null || channels === void 0 ? void 0 : channels.selectedChannelColor, channelRestrictions: channels === null || channels === void 0 ? void 0 : channels.channelRestrictions, channelLabel: channels === null || channels === void 0 ? void 0 : channels.channelLabel }),
1843
1936
  (channels === null || channels === void 0 ? void 0 : channels.visible) && channels.channelsMode === "multi" && React__default["default"].createElement(FlatMultiChannelSelector, { showSelector: channels === null || channels === void 0 ? void 0 : channels.showSelector, selectedChannels: channels === null || channels === void 0 ? void 0 : channels.selectedChannels, channelRestrictions: channels === null || channels === void 0 ? void 0 : channels.channelRestrictions, channelLabel: channels === null || channels === void 0 ? void 0 : channels.channelLabel }),
1844
- React__default["default"].createElement(FlatMoveArea, { moveAreaId: moveAreaId }, captionEditor.show ? React__default["default"].createElement(FlatCaptionEditor, __assign({}, captionEditor, { caption: captionEditor.text, frameId: rest.frameId })) : React__default["default"].createElement(FlatCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
1937
+ React__default["default"].createElement(FlatMoveArea, { moveAreaId: moveAreaId }, captionEditor.show ? React__default["default"].createElement(FlatCaptionEditor, __assign({}, captionEditor, { caption: captionEditor.text, frameId: rest.frameId })) : React__default["default"].createElement(FlatCaption, { showCaptionEditor: showCaptionEditor, notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
1845
1938
  React__default["default"].createElement(FlatButtons, __assign({}, rest))));
1846
1939
  };
1847
1940
 
@@ -1861,10 +1954,20 @@
1861
1954
  };
1862
1955
 
1863
1956
  var GroupCaption = function (_a) {
1864
- var caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
1957
+ var showCaptionEditor = _a.showCaptionEditor, caption = _a.caption, notifyBoundsChanged = _a.notifyBoundsChanged;
1865
1958
  var ref = React.useRef(null);
1866
1959
  useEditableCaption(ref, { notifyBoundsChanged: notifyBoundsChanged });
1867
- return React__default["default"].createElement("div", { ref: ref, className: "t42-caption t42-title t42-group-caption-bar-element" }, caption);
1960
+ var startDrag = useDragMove().startDrag;
1961
+ var handleMouseDown = function (e) {
1962
+ if (e.button !== 0)
1963
+ return;
1964
+ startDrag(e);
1965
+ };
1966
+ var handleDoubleClick = function (e) {
1967
+ showCaptionEditor(caption);
1968
+ e.stopPropagation();
1969
+ };
1970
+ return (React__default["default"].createElement("div", { ref: ref, onMouseDown: handleMouseDown, onDoubleClick: handleDoubleClick, className: "t42-caption t42-title t42-group-caption-bar-element" }, caption));
1868
1971
  };
1869
1972
 
1870
1973
  var GroupCaptionEditor = function (props) {
@@ -1872,11 +1975,11 @@
1872
1975
  };
1873
1976
 
1874
1977
  var GroupCaptionBar = function (_a) {
1875
- var moveAreaId = _a.moveAreaId; _a.targetType; var targetId = _a.targetId, caption = _a.caption, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "targetType", "targetId", "caption", "captionEditor", "notifyCaptionBoundsChanged"]);
1978
+ var moveAreaId = _a.moveAreaId, showCaptionEditor = _a.showCaptionEditor; _a.targetType; var targetId = _a.targetId, caption = _a.caption, captionEditor = _a.captionEditor, notifyCaptionBoundsChanged = _a.notifyCaptionBoundsChanged, rest = __rest(_a, ["moveAreaId", "showCaptionEditor", "targetType", "targetId", "caption", "captionEditor", "notifyCaptionBoundsChanged"]);
1876
1979
  return React__default["default"].createElement("div", { className: "t42-react-caption-bar" },
1877
1980
  React__default["default"].createElement(GroupMoveArea, { moveAreaId: moveAreaId }, (captionEditor === null || captionEditor === void 0 ? void 0 : captionEditor.show) ?
1878
1981
  React__default["default"].createElement(GroupCaptionEditor, __assign({}, captionEditor, { groupId: targetId, caption: captionEditor.text })) :
1879
- React__default["default"].createElement(GroupCaption, { notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
1982
+ React__default["default"].createElement(GroupCaption, { showCaptionEditor: showCaptionEditor, notifyBoundsChanged: notifyCaptionBoundsChanged, caption: caption })),
1880
1983
  React__default["default"].createElement(GroupButtons, __assign({}, rest)));
1881
1984
  };
1882
1985
 
@@ -1935,10 +2038,10 @@
1935
2038
 
1936
2039
  var OverflowButton = function (_a) {
1937
2040
  var onClick = _a.onClick, tooltip = _a.tooltip;
1938
- return React__default["default"].createElement(BaseButton, { innerElement: { className: "t42-standard-button t42-standard-button-overflow" }, outerElement: {
2041
+ return React__default["default"].createElement(BaseButton, { innerElement: { className: getStandardButtonInnerClassName(StandardButtons.Overflow) }, outerElement: {
1939
2042
  onMouseDown: function (e) { return e.stopPropagation(); },
1940
2043
  onPointerDown: function (e) { return e.stopPropagation(); },
1941
- className: "t42-button t42-caption-bar-button t42-tab-bar-button t42-caption-bar-button-overflow", title: tooltip,
2044
+ className: getStandardButtonOuterClassName(StandardButtons.Overflow), title: tooltip,
1942
2045
  onClick: onClick
1943
2046
  } });
1944
2047
  };
@@ -1977,246 +2080,156 @@
1977
2080
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
1978
2081
  }
1979
2082
 
1980
- function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=React__default["default"].useState,m=React__default["default"].useEffect,n=React__default["default"].useLayoutEffect,p=React__default["default"].useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
1981
- function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;var useSyncExternalStore=void 0!==React__default["default"].useSyncExternalStore?React__default["default"].useSyncExternalStore:u;
1982
-
1983
- var useSyncExternalStoreShim_production_min = {
1984
- useSyncExternalStore: useSyncExternalStore
1985
- };
1986
-
1987
- var useSyncExternalStoreShim_development = createCommonjsModule(function (module, exports) {
1988
-
1989
- if (process.env.NODE_ENV !== "production") {
1990
- (function() {
1991
-
1992
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
1993
- if (
1994
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
1995
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
1996
- 'function'
1997
- ) {
1998
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
1999
- }
2000
- var React = React__default["default"];
2001
-
2002
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2003
-
2004
- function error(format) {
2005
- {
2006
- {
2007
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2008
- args[_key2 - 1] = arguments[_key2];
2009
- }
2010
-
2011
- printWarning('error', format, args);
2012
- }
2013
- }
2014
- }
2015
-
2016
- function printWarning(level, format, args) {
2017
- // When changing this logic, you might want to also
2018
- // update consoleWithStackDev.www.js as well.
2019
- {
2020
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2021
- var stack = ReactDebugCurrentFrame.getStackAddendum();
2022
-
2023
- if (stack !== '') {
2024
- format += '%s';
2025
- args = args.concat([stack]);
2026
- } // eslint-disable-next-line react-internal/safe-string-coercion
2027
-
2028
-
2029
- var argsWithFormat = args.map(function (item) {
2030
- return String(item);
2031
- }); // Careful: RN currently depends on this prefix
2032
-
2033
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
2034
- // breaks IE9: https://github.com/facebook/react/issues/13610
2035
- // eslint-disable-next-line react-internal/no-production-logging
2036
-
2037
- Function.prototype.apply.call(console[level], console, argsWithFormat);
2038
- }
2039
- }
2040
-
2041
- /**
2042
- * inlined Object.is polyfill to avoid requiring consumers ship their own
2043
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2044
- */
2045
2083
  function is(x, y) {
2046
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
2047
- ;
2084
+ return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
2048
2085
  }
2049
-
2050
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
2051
-
2052
- // dispatch for CommonJS interop named imports.
2053
-
2054
- var useState = React.useState,
2055
- useEffect = React.useEffect,
2056
- useLayoutEffect = React.useLayoutEffect,
2057
- useDebugValue = React.useDebugValue;
2058
- var didWarnOld18Alpha = false;
2059
- var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
2060
- // because of a very particular set of implementation details and assumptions
2061
- // -- change any one of them and it will break. The most important assumption
2062
- // is that updates are always synchronous, because concurrent rendering is
2063
- // only available in versions of React that also have a built-in
2064
- // useSyncExternalStore API. And we only use this shim when the built-in API
2065
- // does not exist.
2066
- //
2067
- // Do not assume that the clever hacks used by this hook also work in general.
2068
- // The point of this shim is to replace the need for hacks by other libraries.
2069
-
2070
- function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
2071
- // React do not expose a way to check if we're hydrating. So users of the shim
2072
- // will need to track that themselves and return the correct value
2073
- // from `getSnapshot`.
2074
- getServerSnapshot) {
2075
- {
2076
- if (!didWarnOld18Alpha) {
2077
- if (React.startTransition !== undefined) {
2078
- didWarnOld18Alpha = true;
2079
-
2080
- error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
2081
- }
2082
- }
2083
- } // Read the current snapshot from the store on every render. Again, this
2084
- // breaks the rules of React, and only works here because of specific
2085
- // implementation details, most importantly that updates are
2086
- // always synchronous.
2087
-
2088
-
2089
- var value = getSnapshot();
2090
-
2091
- {
2092
- if (!didWarnUncachedGetSnapshot) {
2093
- var cachedValue = getSnapshot();
2094
-
2095
- if (!objectIs(value, cachedValue)) {
2096
- error('The result of getSnapshot should be cached to avoid an infinite loop');
2097
-
2098
- didWarnUncachedGetSnapshot = true;
2099
- }
2100
- }
2101
- } // Because updates are synchronous, we don't queue them. Instead we force a
2102
- // re-render whenever the subscribed state changes by updating an some
2103
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
2104
- // the current value.
2105
- //
2106
- // Because we don't actually use the state returned by the useState hook, we
2107
- // can save a bit of memory by storing other stuff in that slot.
2108
- //
2109
- // To implement the early bailout, we need to track some things on a mutable
2110
- // object. Usually, we would put that in a useRef hook, but we can stash it in
2111
- // our useState hook instead.
2112
- //
2113
- // To force a re-render, we call forceUpdate({inst}). That works because the
2114
- // new object always fails an equality check.
2115
-
2116
-
2117
- var _useState = useState({
2118
- inst: {
2119
- value: value,
2120
- getSnapshot: getSnapshot
2121
- }
2122
- }),
2123
- inst = _useState[0].inst,
2124
- forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
2125
- // in the layout phase so we can access it during the tearing check that
2126
- // happens on subscribe.
2127
-
2128
-
2129
- useLayoutEffect(function () {
2130
- inst.value = value;
2131
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
2132
- // commit phase if there was an interleaved mutation. In concurrent mode
2133
- // this can happen all the time, but even in synchronous mode, an earlier
2134
- // effect may have mutated the store.
2135
-
2136
- if (checkIfSnapshotChanged(inst)) {
2137
- // Force a re-render.
2138
- forceUpdate({
2139
- inst: inst
2140
- });
2141
- }
2142
- }, [subscribe, value, getSnapshot]);
2143
- useEffect(function () {
2144
- // Check for changes right before subscribing. Subsequent changes will be
2145
- // detected in the subscription handler.
2146
- if (checkIfSnapshotChanged(inst)) {
2147
- // Force a re-render.
2148
- forceUpdate({
2149
- inst: inst
2086
+ var objectIs = "function" === typeof Object.is ? Object.is : is,
2087
+ useState = React__default["default"].useState,
2088
+ useEffect = React__default["default"].useEffect,
2089
+ useLayoutEffect = React__default["default"].useLayoutEffect,
2090
+ useDebugValue = React__default["default"].useDebugValue;
2091
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
2092
+ var value = getSnapshot(),
2093
+ _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
2094
+ inst = _useState[0].inst,
2095
+ forceUpdate = _useState[1];
2096
+ useLayoutEffect(
2097
+ function () {
2098
+ inst.value = value;
2099
+ inst.getSnapshot = getSnapshot;
2100
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2101
+ },
2102
+ [subscribe, value, getSnapshot]
2103
+ );
2104
+ useEffect(
2105
+ function () {
2106
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2107
+ return subscribe(function () {
2108
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2150
2109
  });
2151
- }
2152
-
2153
- var handleStoreChange = function () {
2154
- // TODO: Because there is no cross-renderer API for batching updates, it's
2155
- // up to the consumer of this library to wrap their subscription event
2156
- // with unstable_batchedUpdates. Should we try to detect when this isn't
2157
- // the case and print a warning in development?
2158
- // The store changed. Check if the snapshot changed since the last time we
2159
- // read from the store.
2160
- if (checkIfSnapshotChanged(inst)) {
2161
- // Force a re-render.
2162
- forceUpdate({
2163
- inst: inst
2164
- });
2165
- }
2166
- }; // Subscribe to the store and return a clean-up function.
2167
-
2168
-
2169
- return subscribe(handleStoreChange);
2170
- }, [subscribe]);
2110
+ },
2111
+ [subscribe]
2112
+ );
2171
2113
  useDebugValue(value);
2172
2114
  return value;
2173
2115
  }
2174
-
2175
2116
  function checkIfSnapshotChanged(inst) {
2176
2117
  var latestGetSnapshot = inst.getSnapshot;
2177
- var prevValue = inst.value;
2178
-
2118
+ inst = inst.value;
2179
2119
  try {
2180
2120
  var nextValue = latestGetSnapshot();
2181
- return !objectIs(prevValue, nextValue);
2121
+ return !objectIs(inst, nextValue);
2182
2122
  } catch (error) {
2183
- return true;
2123
+ return !0;
2184
2124
  }
2185
2125
  }
2186
-
2187
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
2188
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
2189
- // React do not expose a way to check if we're hydrating. So users of the shim
2190
- // will need to track that themselves and return the correct value
2191
- // from `getSnapshot`.
2126
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
2192
2127
  return getSnapshot();
2193
2128
  }
2129
+ var shim$1 =
2130
+ "undefined" === typeof window ||
2131
+ "undefined" === typeof window.document ||
2132
+ "undefined" === typeof window.document.createElement
2133
+ ? useSyncExternalStore$1
2134
+ : useSyncExternalStore$2;
2135
+ var useSyncExternalStore =
2136
+ void 0 !== React__default["default"].useSyncExternalStore ? React__default["default"].useSyncExternalStore : shim$1;
2137
+
2138
+ var useSyncExternalStoreShim_production = {
2139
+ useSyncExternalStore: useSyncExternalStore
2140
+ };
2194
2141
 
2195
- var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
2196
-
2197
- var isServerEnvironment = !canUseDOM;
2198
-
2199
- var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
2200
- var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
2201
-
2202
- exports.useSyncExternalStore = useSyncExternalStore$2;
2203
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2204
- if (
2205
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
2206
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
2207
- 'function'
2208
- ) {
2209
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2210
- }
2211
-
2142
+ var useSyncExternalStoreShim_development = createCommonjsModule(function (module, exports) {
2143
+ "production" !== process.env.NODE_ENV &&
2144
+ (function () {
2145
+ function is(x, y) {
2146
+ return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
2147
+ }
2148
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
2149
+ didWarnOld18Alpha ||
2150
+ void 0 === React.startTransition ||
2151
+ ((didWarnOld18Alpha = !0),
2152
+ console.error(
2153
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
2154
+ ));
2155
+ var value = getSnapshot();
2156
+ if (!didWarnUncachedGetSnapshot) {
2157
+ var cachedValue = getSnapshot();
2158
+ objectIs(value, cachedValue) ||
2159
+ (console.error(
2160
+ "The result of getSnapshot should be cached to avoid an infinite loop"
2161
+ ),
2162
+ (didWarnUncachedGetSnapshot = !0));
2163
+ }
2164
+ cachedValue = useState({
2165
+ inst: { value: value, getSnapshot: getSnapshot }
2166
+ });
2167
+ var inst = cachedValue[0].inst,
2168
+ forceUpdate = cachedValue[1];
2169
+ useLayoutEffect(
2170
+ function () {
2171
+ inst.value = value;
2172
+ inst.getSnapshot = getSnapshot;
2173
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2174
+ },
2175
+ [subscribe, value, getSnapshot]
2176
+ );
2177
+ useEffect(
2178
+ function () {
2179
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2180
+ return subscribe(function () {
2181
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
2182
+ });
2183
+ },
2184
+ [subscribe]
2185
+ );
2186
+ useDebugValue(value);
2187
+ return value;
2188
+ }
2189
+ function checkIfSnapshotChanged(inst) {
2190
+ var latestGetSnapshot = inst.getSnapshot;
2191
+ inst = inst.value;
2192
+ try {
2193
+ var nextValue = latestGetSnapshot();
2194
+ return !objectIs(inst, nextValue);
2195
+ } catch (error) {
2196
+ return !0;
2197
+ }
2198
+ }
2199
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
2200
+ return getSnapshot();
2201
+ }
2202
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2203
+ "function" ===
2204
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
2205
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2206
+ var React = React__default["default"],
2207
+ objectIs = "function" === typeof Object.is ? Object.is : is,
2208
+ useState = React.useState,
2209
+ useEffect = React.useEffect,
2210
+ useLayoutEffect = React.useLayoutEffect,
2211
+ useDebugValue = React.useDebugValue,
2212
+ didWarnOld18Alpha = !1,
2213
+ didWarnUncachedGetSnapshot = !1,
2214
+ shim =
2215
+ "undefined" === typeof window ||
2216
+ "undefined" === typeof window.document ||
2217
+ "undefined" === typeof window.document.createElement
2218
+ ? useSyncExternalStore$1
2219
+ : useSyncExternalStore$2;
2220
+ exports.useSyncExternalStore =
2221
+ void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
2222
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2223
+ "function" ===
2224
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
2225
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2212
2226
  })();
2213
- }
2214
2227
  });
2215
2228
 
2216
2229
  var shim = createCommonjsModule(function (module) {
2217
2230
 
2218
2231
  if (process.env.NODE_ENV === 'production') {
2219
- module.exports = useSyncExternalStoreShim_production_min;
2232
+ module.exports = useSyncExternalStoreShim_production;
2220
2233
  } else {
2221
2234
  module.exports = useSyncExternalStoreShim_development;
2222
2235
  }
@@ -3020,6 +3033,9 @@
3020
3033
  return;
3021
3034
  }
3022
3035
  var _b = state.groupCaptionBar, parentElement = _b.parentElement, options = __rest(_b, ["parentElement"]);
3036
+ var showCaptionEditor = function (text) {
3037
+ webGroupsManager.showCaptionEditor(TargetType.Group, options.targetId, text);
3038
+ };
3023
3039
  var minimize = __assign({ onClick: function () {
3024
3040
  webGroupsManager.onMinimizeButtonClick(TargetType.Group, options.targetId);
3025
3041
  } }, options.minimize);
@@ -3043,7 +3059,7 @@
3043
3059
  } });
3044
3060
  var notifyCaptionBoundsChanged = function (bounds) { return webGroupsManager.onCaptionTextBoundsChanged(TargetType.Group, options.targetId, bounds); };
3045
3061
  return (React__default["default"].createElement(Portal, { parentElement: parentElement },
3046
- React__default["default"].createElement(GroupCaptionBarCustomElement, __assign({}, options, { minimize: minimize, maximize: maximize, restore: restore, close: close, captionEditor: captionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged }))));
3062
+ React__default["default"].createElement(GroupCaptionBarCustomElement, __assign({}, options, { minimize: minimize, maximize: maximize, restore: restore, close: close, captionEditor: captionEditor, showCaptionEditor: showCaptionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged }))));
3047
3063
  };
3048
3064
  var renderGroupOverlay = function () {
3049
3065
  var _a;
@@ -3064,6 +3080,9 @@
3064
3080
  return;
3065
3081
  }
3066
3082
  var parentElement = fcb.parentElement, options = __rest(fcb, ["parentElement"]);
3083
+ var showCaptionEditor = function (text) {
3084
+ webGroupsManager.showCaptionEditor(TargetType.Frame, options.targetId, text);
3085
+ };
3067
3086
  var feedback = __assign({ onClick: function () {
3068
3087
  webGroupsManager.onFeedbackButtonClick(TargetType.Frame, options.targetId);
3069
3088
  } }, options.feedback);
@@ -3132,7 +3151,7 @@
3132
3151
  } });
3133
3152
  var notifyCaptionBoundsChanged = function (bounds) { return webGroupsManager.onCaptionTextBoundsChanged(TargetType.Frame, options.targetId, bounds); };
3134
3153
  return React__default["default"].createElement(Portal, { key: options.targetId, parentElement: parentElement },
3135
- React__default["default"].createElement(FrameCaptionBarCustomElement, __assign({}, options, { feedback: feedback, clone: clone, sticky: sticky, extract: extract, lock: lock, unlock: unlock, minimize: minimize, maximize: maximize, restore: restore, close: close, channels: channels, customButtons: customButtonsProps, frameId: options.targetId, captionEditor: captionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged })));
3154
+ React__default["default"].createElement(FrameCaptionBarCustomElement, __assign({}, options, { feedback: feedback, clone: clone, sticky: sticky, extract: extract, lock: lock, unlock: unlock, minimize: minimize, maximize: maximize, restore: restore, close: close, channels: channels, customButtons: customButtonsProps, frameId: options.targetId, captionEditor: captionEditor, showCaptionEditor: showCaptionEditor, notifyCaptionBoundsChanged: notifyCaptionBoundsChanged })));
3136
3155
  });
3137
3156
  };
3138
3157
  var renderFrameWindowOverlay = function () {
@@ -3585,6 +3604,7 @@
3585
3604
  exports.useCommitFlatCaptionEditingRequested = useCommitFlatCaptionEditingRequested;
3586
3605
  exports.useCommitGroupCaptionEditingRequested = useCommitGroupCaptionEditingRequested;
3587
3606
  exports.useCommitTabCaptionEditingRequested = useCommitTabCaptionEditingRequested;
3607
+ exports.useDragMove = useDragMove;
3588
3608
  exports.useEditableCaption = useEditableCaption;
3589
3609
  exports.useGroupComponentVisibility = useGroupComponentVisibility;
3590
3610
  exports.useIOConnectWindow = useIOConnectWindow;