@zsviczian/excalidraw 0.18.0-67 → 0.18.0-68
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.
|
@@ -19,17 +19,6 @@
|
|
|
19
19
|
return /******/ (() => { // webpackBootstrap
|
|
20
20
|
/******/ var __webpack_modules__ = ({
|
|
21
21
|
|
|
22
|
-
/***/ "../../node_modules/@babel/runtime/helpers/esm/extends.js":
|
|
23
|
-
/*!****************************************************************!*\
|
|
24
|
-
!*** ../../node_modules/@babel/runtime/helpers/esm/extends.js ***!
|
|
25
|
-
\****************************************************************/
|
|
26
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
27
|
-
|
|
28
|
-
"use strict";
|
|
29
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ _extends)\n/* harmony export */ });\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@babel/runtime/helpers/esm/extends.js?");
|
|
30
|
-
|
|
31
|
-
/***/ }),
|
|
32
|
-
|
|
33
22
|
/***/ "../../node_modules/@braintree/sanitize-url/dist/index.js":
|
|
34
23
|
/*!****************************************************************!*\
|
|
35
24
|
!*** ../../node_modules/@braintree/sanitize-url/dist/index.js ***!
|
|
@@ -268,18 +257,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
268
257
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
269
258
|
|
|
270
259
|
"use strict";
|
|
271
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Item: () => (/* binding */ Item),\n/* harmony export */ Root: () => (/* binding */ Root),\n/* harmony export */ RovingFocusGroup: () => (/* binding */ RovingFocusGroup),\n/* harmony export */ RovingFocusGroupItem: () => (/* binding */ RovingFocusGroupItem),\n/* harmony export */ createRovingFocusGroupScope: () => (/* binding */ createRovingFocusGroupScope)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var _radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @radix-ui/primitive */ \"../../node_modules/@radix-ui/primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_collection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @radix-ui/react-collection */ \"../../node_modules/@radix-ui/react-collection/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @radix-ui/react-compose-refs */ \"../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs/dist/index.module.js\");\n/* harmony import */ var _radix_ui_react_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-context */ \"../../node_modules/@radix-ui/react-context/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @radix-ui/react-id */ \"../../node_modules/@radix-ui/react-id/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @radix-ui/react-primitive */ \"../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive/dist/index.module.js\");\n/* harmony import */ var _radix_ui_react_use_callback_ref__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ \"../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js\");\n/* harmony import */ var _radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ \"../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @radix-ui/react-direction */ \"../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-direction/dist/index.mjs\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"react/jsx-runtime\");\n\"use client\";\n\n// packages/react/roving-focus/src/roving-focus-group.tsx\n\n\n\n\n\n\n\n\n\n\n\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = (0,_radix_ui_react_collection__WEBPACK_IMPORTED_MODULE_2__.createCollection)(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = (0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_3__.createContextScope)(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const composedRefs = (0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_4__.useComposedRefs)(forwardedRef, ref);\n const direction = (0,_radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_5__.useDirection)(dir);\n const [currentTabStopId = null, setCurrentTabStopId] = (0,_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_6__.useControllableState)({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId,\n onChange: onCurrentTabStopIdChange\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = react__WEBPACK_IMPORTED_MODULE_0__.useState(false);\n const handleEntryFocus = (0,_radix_ui_react_use_callback_ref__WEBPACK_IMPORTED_MODULE_7__.useCallbackRef)(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = react__WEBPACK_IMPORTED_MODULE_0__.useState(0);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__.Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n ...itemProps\n } = props;\n const autoId = (0,_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_10__.useId)();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove } = context;\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__.Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n })\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\n\n//# sourceMappingURL=index.mjs.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs?");
|
|
272
|
-
|
|
273
|
-
/***/ }),
|
|
274
|
-
|
|
275
|
-
/***/ "../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs/dist/index.module.js":
|
|
276
|
-
/*!**********************************************************************************************************************!*\
|
|
277
|
-
!*** ../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs/dist/index.module.js ***!
|
|
278
|
-
\**********************************************************************************************************************/
|
|
279
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
280
|
-
|
|
281
|
-
"use strict";
|
|
282
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ composeRefs: () => (/* binding */ $6ed0406888f73fc4$export$43e446d32b3d21af),\n/* harmony export */ useComposedRefs: () => (/* binding */ $6ed0406888f73fc4$export$c7b2cbe3552a0d05)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\n\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$var$setRef(ref, value) {\n if (typeof ref === 'function') ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {\n return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)\n )\n ;\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);\n}\n\n\n\n\n\n//# sourceMappingURL=index.module.js.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-compose-refs/dist/index.module.js?");
|
|
260
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Item: () => (/* binding */ Item),\n/* harmony export */ Root: () => (/* binding */ Root),\n/* harmony export */ RovingFocusGroup: () => (/* binding */ RovingFocusGroup),\n/* harmony export */ RovingFocusGroupItem: () => (/* binding */ RovingFocusGroupItem),\n/* harmony export */ createRovingFocusGroupScope: () => (/* binding */ createRovingFocusGroupScope)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var _radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @radix-ui/primitive */ \"../../node_modules/@radix-ui/primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_collection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @radix-ui/react-collection */ \"../../node_modules/@radix-ui/react-collection/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @radix-ui/react-compose-refs */ \"../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-context */ \"../../node_modules/@radix-ui/react-context/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @radix-ui/react-id */ \"../../node_modules/@radix-ui/react-id/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @radix-ui/react-primitive */ \"../../node_modules/@radix-ui/react-primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_use_callback_ref__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ \"../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ \"../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @radix-ui/react-direction */ \"../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-direction/dist/index.mjs\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"react/jsx-runtime\");\n\"use client\";\n\n// packages/react/roving-focus/src/roving-focus-group.tsx\n\n\n\n\n\n\n\n\n\n\n\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = (0,_radix_ui_react_collection__WEBPACK_IMPORTED_MODULE_2__.createCollection)(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = (0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_3__.createContextScope)(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const composedRefs = (0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_4__.useComposedRefs)(forwardedRef, ref);\n const direction = (0,_radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_5__.useDirection)(dir);\n const [currentTabStopId = null, setCurrentTabStopId] = (0,_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_6__.useControllableState)({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId,\n onChange: onCurrentTabStopIdChange\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = react__WEBPACK_IMPORTED_MODULE_0__.useState(false);\n const handleEntryFocus = (0,_radix_ui_react_use_callback_ref__WEBPACK_IMPORTED_MODULE_7__.useCallbackRef)(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = react__WEBPACK_IMPORTED_MODULE_0__.useState(0);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: react__WEBPACK_IMPORTED_MODULE_0__.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__.Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n ...itemProps\n } = props;\n const autoId = (0,_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_10__.useId)();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove } = context;\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_8__.Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_9__.composeEventHandlers)(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n })\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\n\n//# sourceMappingURL=index.mjs.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs?");
|
|
283
261
|
|
|
284
262
|
/***/ }),
|
|
285
263
|
|
|
@@ -294,28 +272,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
294
272
|
|
|
295
273
|
/***/ }),
|
|
296
274
|
|
|
297
|
-
/***/ "../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive/dist/index.module.js":
|
|
298
|
-
/*!*******************************************************************************************************************!*\
|
|
299
|
-
!*** ../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive/dist/index.module.js ***!
|
|
300
|
-
\*******************************************************************************************************************/
|
|
301
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
302
|
-
|
|
303
|
-
"use strict";
|
|
304
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Primitive: () => (/* binding */ $8927f6f2acc4f386$export$250ffa63cdc0d034),\n/* harmony export */ Root: () => (/* binding */ $8927f6f2acc4f386$export$be92b6f5f03c0fe9),\n/* harmony export */ dispatchDiscreteCustomEvent: () => (/* binding */ $8927f6f2acc4f386$export$6d1a0317bde7de7f)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"../../node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-slot */ \"../../node_modules/@radix-ui/react-slot/dist/index.mjs\");\n\n\n\n\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'h2',\n 'h3',\n 'img',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? _radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__.Slot : node;\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(Comp, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\n\n//# sourceMappingURL=index.module.js.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-primitive/dist/index.module.js?");
|
|
305
|
-
|
|
306
|
-
/***/ }),
|
|
307
|
-
|
|
308
|
-
/***/ "../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js":
|
|
309
|
-
/*!**************************************************************************************************************************!*\
|
|
310
|
-
!*** ../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js ***!
|
|
311
|
-
\**************************************************************************************************************************/
|
|
312
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
313
|
-
|
|
314
|
-
"use strict";
|
|
315
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ useCallbackRef: () => (/* binding */ $b1b2314f5f9a1d84$export$25bec8c6f54ee79a)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\n\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {\n const callbackRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(callback);\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{\n callbackRef.current = callback;\n }); // https://github.com/facebook/react/issues/19240\n return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(()=>(...args)=>{\n var _callbackRef$current;\n return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);\n }\n , []);\n}\n\n\n\n\n\n//# sourceMappingURL=index.module.js.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-roving-focus/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js?");
|
|
316
|
-
|
|
317
|
-
/***/ }),
|
|
318
|
-
|
|
319
275
|
/***/ "../../node_modules/@radix-ui/react-slot/dist/index.mjs":
|
|
320
276
|
/*!**************************************************************!*\
|
|
321
277
|
!*** ../../node_modules/@radix-ui/react-slot/dist/index.mjs ***!
|
|
@@ -334,7 +290,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
334
290
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
335
291
|
|
|
336
292
|
"use strict";
|
|
337
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Content: () => (/* binding */ Content),\n/* harmony export */ List: () => (/* binding */ List),\n/* harmony export */ Root: () => (/* binding */ Root2),\n/* harmony export */ Tabs: () => (/* binding */ Tabs),\n/* harmony export */ TabsContent: () => (/* binding */ TabsContent),\n/* harmony export */ TabsList: () => (/* binding */ TabsList),\n/* harmony export */ TabsTrigger: () => (/* binding */ TabsTrigger),\n/* harmony export */ Trigger: () => (/* binding */ Trigger),\n/* harmony export */ createTabsScope: () => (/* binding */ createTabsScope)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var _radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @radix-ui/primitive */ \"../../node_modules/@radix-ui/primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @radix-ui/react-context */ \"../../node_modules/@radix-ui/react-context/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-roving-focus */ \"../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @radix-ui/react-presence */ \"../../node_modules/@radix-ui/react-presence/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @radix-ui/react-primitive */ \"../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive/dist/index.module.js\");\n/* harmony import */ var _radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @radix-ui/react-direction */ \"../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-direction/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ \"../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @radix-ui/react-id */ \"../../node_modules/@radix-ui/react-id/dist/index.mjs\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"react/jsx-runtime\");\n\"use client\";\n\n// packages/react/tabs/src/tabs.tsx\n\n\n\n\n\n\n\n\n\n\n\nvar TABS_NAME = \"Tabs\";\nvar [createTabsContext, createTabsScope] = (0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_2__.createContextScope)(TABS_NAME, [\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.createRovingFocusGroupScope\n]);\nvar useRovingFocusGroupScope = (0,_radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.createRovingFocusGroupScope)();\nvar [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);\nvar Tabs = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeTabs,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = \"horizontal\",\n dir,\n activationMode = \"automatic\",\n ...tabsProps\n } = props;\n const direction = (0,_radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_4__.useDirection)(dir);\n const [value, setValue] = (0,_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_5__.useControllableState)({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue\n });\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n TabsProvider,\n {\n scope: __scopeTabs,\n baseId: (0,_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_6__.useId)(),\n value,\n onValueChange: setValue,\n orientation,\n dir: direction,\n activationMode,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n dir: direction,\n \"data-orientation\": orientation,\n ...tabsProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabs.displayName = TABS_NAME;\nvar TAB_LIST_NAME = \"TabsList\";\nvar TabsList = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, loop = true, ...listProps } = props;\n const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.Root,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n orientation: context.orientation,\n dir: context.dir,\n loop,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n role: \"tablist\",\n \"aria-orientation\": context.orientation,\n ...listProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabsList.displayName = TAB_LIST_NAME;\nvar TRIGGER_NAME = \"TabsTrigger\";\nvar TabsTrigger = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, disabled = false, ...triggerProps } = props;\n const context = useTabsContext(TRIGGER_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.Item,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n focusable: !disabled,\n active: isSelected,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.button,\n {\n type: \"button\",\n role: \"tab\",\n \"aria-selected\": isSelected,\n \"aria-controls\": contentId,\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n id: triggerId,\n ...triggerProps,\n ref: forwardedRef,\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onMouseDown, (event) => {\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onValueChange(value);\n } else {\n event.preventDefault();\n }\n }),\n onKeyDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onKeyDown, (event) => {\n if ([\" \", \"Enter\"].includes(event.key)) context.onValueChange(value);\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onFocus, () => {\n const isAutomaticActivation = context.activationMode !== \"manual\";\n if (!isSelected && !disabled && isAutomaticActivation) {\n context.onValueChange(value);\n }\n })\n }\n )\n }\n );\n }\n);\nTabsTrigger.displayName = TRIGGER_NAME;\nvar CONTENT_NAME = \"TabsContent\";\nvar TabsContent = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n const context = useTabsContext(CONTENT_NAME, __scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n const isMountAnimationPreventedRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(isSelected);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);\n return () => cancelAnimationFrame(rAF);\n }, []);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_9__.Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-orientation\": context.orientation,\n role: \"tabpanel\",\n \"aria-labelledby\": triggerId,\n hidden: !present,\n id: contentId,\n tabIndex: 0,\n ...contentProps,\n ref: forwardedRef,\n style: {\n ...props.style,\n animationDuration: isMountAnimationPreventedRef.current ? \"0s\" : void 0\n },\n children: present && children\n }\n ) });\n }\n);\nTabsContent.displayName = CONTENT_NAME;\nfunction makeTriggerId(baseId, value) {\n return `${baseId}-trigger-${value}`;\n}\nfunction makeContentId(baseId, value) {\n return `${baseId}-content-${value}`;\n}\nvar Root2 = Tabs;\nvar List = TabsList;\nvar Trigger = TabsTrigger;\nvar Content = TabsContent;\n\n//# sourceMappingURL=index.mjs.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-tabs/dist/index.mjs?");
|
|
293
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Content: () => (/* binding */ Content),\n/* harmony export */ List: () => (/* binding */ List),\n/* harmony export */ Root: () => (/* binding */ Root2),\n/* harmony export */ Tabs: () => (/* binding */ Tabs),\n/* harmony export */ TabsContent: () => (/* binding */ TabsContent),\n/* harmony export */ TabsList: () => (/* binding */ TabsList),\n/* harmony export */ TabsTrigger: () => (/* binding */ TabsTrigger),\n/* harmony export */ Trigger: () => (/* binding */ Trigger),\n/* harmony export */ createTabsScope: () => (/* binding */ createTabsScope)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var _radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @radix-ui/primitive */ \"../../node_modules/@radix-ui/primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @radix-ui/react-context */ \"../../node_modules/@radix-ui/react-context/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-roving-focus */ \"../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @radix-ui/react-presence */ \"../../node_modules/@radix-ui/react-presence/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @radix-ui/react-primitive */ \"../../node_modules/@radix-ui/react-primitive/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @radix-ui/react-direction */ \"../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-direction/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ \"../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs\");\n/* harmony import */ var _radix_ui_react_id__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @radix-ui/react-id */ \"../../node_modules/@radix-ui/react-id/dist/index.mjs\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"react/jsx-runtime\");\n\"use client\";\n\n// packages/react/tabs/src/tabs.tsx\n\n\n\n\n\n\n\n\n\n\n\nvar TABS_NAME = \"Tabs\";\nvar [createTabsContext, createTabsScope] = (0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_2__.createContextScope)(TABS_NAME, [\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.createRovingFocusGroupScope\n]);\nvar useRovingFocusGroupScope = (0,_radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.createRovingFocusGroupScope)();\nvar [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);\nvar Tabs = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeTabs,\n value: valueProp,\n onValueChange,\n defaultValue,\n orientation = \"horizontal\",\n dir,\n activationMode = \"automatic\",\n ...tabsProps\n } = props;\n const direction = (0,_radix_ui_react_direction__WEBPACK_IMPORTED_MODULE_4__.useDirection)(dir);\n const [value, setValue] = (0,_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_5__.useControllableState)({\n prop: valueProp,\n onChange: onValueChange,\n defaultProp: defaultValue\n });\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n TabsProvider,\n {\n scope: __scopeTabs,\n baseId: (0,_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_6__.useId)(),\n value,\n onValueChange: setValue,\n orientation,\n dir: direction,\n activationMode,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n dir: direction,\n \"data-orientation\": orientation,\n ...tabsProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabs.displayName = TABS_NAME;\nvar TAB_LIST_NAME = \"TabsList\";\nvar TabsList = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, loop = true, ...listProps } = props;\n const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.Root,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n orientation: context.orientation,\n dir: context.dir,\n loop,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n role: \"tablist\",\n \"aria-orientation\": context.orientation,\n ...listProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nTabsList.displayName = TAB_LIST_NAME;\nvar TRIGGER_NAME = \"TabsTrigger\";\nvar TabsTrigger = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, disabled = false, ...triggerProps } = props;\n const context = useTabsContext(TRIGGER_NAME, __scopeTabs);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_roving_focus__WEBPACK_IMPORTED_MODULE_3__.Item,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n focusable: !disabled,\n active: isSelected,\n children: /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.button,\n {\n type: \"button\",\n role: \"tab\",\n \"aria-selected\": isSelected,\n \"aria-controls\": contentId,\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n id: triggerId,\n ...triggerProps,\n ref: forwardedRef,\n onMouseDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onMouseDown, (event) => {\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onValueChange(value);\n } else {\n event.preventDefault();\n }\n }),\n onKeyDown: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onKeyDown, (event) => {\n if ([\" \", \"Enter\"].includes(event.key)) context.onValueChange(value);\n }),\n onFocus: (0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_8__.composeEventHandlers)(props.onFocus, () => {\n const isAutomaticActivation = context.activationMode !== \"manual\";\n if (!isSelected && !disabled && isAutomaticActivation) {\n context.onValueChange(value);\n }\n })\n }\n )\n }\n );\n }\n);\nTabsTrigger.displayName = TRIGGER_NAME;\nvar CONTENT_NAME = \"TabsContent\";\nvar TabsContent = react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(\n (props, forwardedRef) => {\n const { __scopeTabs, value, forceMount, children, ...contentProps } = props;\n const context = useTabsContext(CONTENT_NAME, __scopeTabs);\n const triggerId = makeTriggerId(context.baseId, value);\n const contentId = makeContentId(context.baseId, value);\n const isSelected = value === context.value;\n const isMountAnimationPreventedRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(isSelected);\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);\n return () => cancelAnimationFrame(rAF);\n }, []);\n return /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(_radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_9__.Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\n _radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_7__.Primitive.div,\n {\n \"data-state\": isSelected ? \"active\" : \"inactive\",\n \"data-orientation\": context.orientation,\n role: \"tabpanel\",\n \"aria-labelledby\": triggerId,\n hidden: !present,\n id: contentId,\n tabIndex: 0,\n ...contentProps,\n ref: forwardedRef,\n style: {\n ...props.style,\n animationDuration: isMountAnimationPreventedRef.current ? \"0s\" : void 0\n },\n children: present && children\n }\n ) });\n }\n);\nTabsContent.displayName = CONTENT_NAME;\nfunction makeTriggerId(baseId, value) {\n return `${baseId}-trigger-${value}`;\n}\nfunction makeContentId(baseId, value) {\n return `${baseId}-content-${value}`;\n}\nvar Root2 = Tabs;\nvar List = TabsList;\nvar Trigger = TabsTrigger;\nvar Content = TabsContent;\n\n//# sourceMappingURL=index.mjs.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-tabs/dist/index.mjs?");
|
|
338
294
|
|
|
339
295
|
/***/ }),
|
|
340
296
|
|
|
@@ -349,17 +305,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
349
305
|
|
|
350
306
|
/***/ }),
|
|
351
307
|
|
|
352
|
-
/***/ "../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive/dist/index.module.js":
|
|
353
|
-
/*!***********************************************************************************************************!*\
|
|
354
|
-
!*** ../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive/dist/index.module.js ***!
|
|
355
|
-
\***********************************************************************************************************/
|
|
356
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
357
|
-
|
|
358
|
-
"use strict";
|
|
359
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Primitive: () => (/* binding */ $8927f6f2acc4f386$export$250ffa63cdc0d034),\n/* harmony export */ Root: () => (/* binding */ $8927f6f2acc4f386$export$be92b6f5f03c0fe9),\n/* harmony export */ dispatchDiscreteCustomEvent: () => (/* binding */ $8927f6f2acc4f386$export$6d1a0317bde7de7f)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"../../node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @radix-ui/react-slot */ \"../../node_modules/@radix-ui/react-slot/dist/index.mjs\");\n\n\n\n\n\n\n\n\n\nconst $8927f6f2acc4f386$var$NODES = [\n 'a',\n 'button',\n 'div',\n 'h2',\n 'h3',\n 'img',\n 'label',\n 'li',\n 'nav',\n 'ol',\n 'p',\n 'span',\n 'svg',\n 'ul'\n]; // Temporary while we await merge of this fix:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396\n// prettier-ignore\n/* -------------------------------------------------------------------------------------------------\n * Primitive\n * -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{\n const Node = /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)((props, forwardedRef)=>{\n const { asChild: asChild , ...primitiveProps } = props;\n const Comp = asChild ? _radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__.Slot : node;\n (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{\n window[Symbol.for('radix-ui')] = true;\n }, []);\n return /*#__PURE__*/ (0,react__WEBPACK_IMPORTED_MODULE_1__.createElement)(Comp, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, primitiveProps, {\n ref: forwardedRef\n }));\n });\n Node.displayName = `Primitive.${node}`;\n return {\n ...primitive,\n [node]: Node\n };\n}, {});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Flush custom event dispatch\n * https://github.com/radix-ui/primitives/pull/1378\n *\n * React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.\n *\n * Internally, React prioritises events in the following order:\n * - discrete\n * - continuous\n * - default\n *\n * https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350\n *\n * `discrete` is an important distinction as updates within these events are applied immediately.\n * React however, is not able to infer the priority of custom event types due to how they are detected internally.\n * Because of this, it's possible for updates from custom events to be unexpectedly batched when\n * dispatched by another `discrete` event.\n *\n * In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.\n * This utility should be used when dispatching a custom event from within another `discrete` event, this utility\n * is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.\n * For example:\n *\n * dispatching a known click 👎\n * target.dispatchEvent(new Event(‘click’))\n *\n * dispatching a custom type within a non-discrete event 👎\n * onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}\n *\n * dispatching a custom type within a `discrete` event 👍\n * onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}\n *\n * Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use\n * this utility with them. This is because it's possible for those handlers to be called implicitly during render\n * e.g. when focus is within a component as it is unmounted, or when managing focus on mount.\n */ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {\n if (target) (0,react_dom__WEBPACK_IMPORTED_MODULE_2__.flushSync)(()=>target.dispatchEvent(event)\n );\n}\n/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = $8927f6f2acc4f386$export$250ffa63cdc0d034;\n\n\n\n\n\n//# sourceMappingURL=index.module.js.map\n\n\n//# sourceURL=webpack://ExcalidrawLib/../../node_modules/@radix-ui/react-tabs/node_modules/@radix-ui/react-primitive/dist/index.module.js?");
|
|
360
|
-
|
|
361
|
-
/***/ }),
|
|
362
|
-
|
|
363
308
|
/***/ "../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs":
|
|
364
309
|
/*!**************************************************************************!*\
|
|
365
310
|
!*** ../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs ***!
|
|
@@ -16732,7 +16677,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extr
|
|
|
16732
16677
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
16733
16678
|
|
|
16734
16679
|
"use strict";
|
|
16735
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hyperlink: () => (/* binding */ Hyperlink),\n/* harmony export */ getContextMenuLabel: () => (/* binding */ getContextMenuLabel),\n/* harmony export */ hideHyperlinkToolip: () => (/* binding */ hideHyperlinkToolip),\n/* harmony export */ showHyperlinkTooltip: () => (/* binding */ showHyperlinkTooltip)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! clsx */ \"../../node_modules/clsx/dist/clsx.m.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _analytics__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../analytics */ \"./analytics.ts\");\n/* harmony import */ var _components_Tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/Tooltip */ \"./components/Tooltip.tsx\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../i18n */ \"./i18n.ts\");\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../App */ \"./components/App.tsx\");\n/* harmony import */ var _ToolButton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ToolButton */ \"./components/ToolButton.tsx\");\n/* harmony import */ var _icons__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../icons */ \"./components/icons.tsx\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../scene */ \"./scene/index.ts\");\n/* harmony import */ var _obsidianUtils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../obsidianUtils */ \"./obsidianUtils.ts\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./helpers */ \"./components/hyperlink/helpers.ts\");\n/* harmony import */ var _Hyperlink_scss__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Hyperlink.scss */ \"./components/hyperlink/Hyperlink.scss\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n //zsviczian\n\n\n\nconst POPUP_WIDTH = 380;\nconst POPUP_HEIGHT = 42;\nconst POPUP_PADDING = 5;\nconst SPACE_BOTTOM = 85;\nconst AUTO_HIDE_TIMEOUT = 500;\nlet IS_HYPERLINK_TOOLTIP_VISIBLE = false;\nconst embeddableLinkCache = new Map();\nconst Hyperlink = ({\n element,\n scene,\n setAppState,\n onLinkOpen,\n setToast,\n updateEmbedValidationStatus\n}) => {\n const elementsMap = scene.getNonDeletedElementsMap();\n const appState = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useExcalidrawAppState)();\n const appProps = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useAppProps)();\n const editorInterface = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useEditorInterface)();\n const linkVal = element.link || \"\";\n const [inputVal, setInputVal] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(linkVal);\n const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n const isEditing = appState.showHyperlinkPopup === \"editor\";\n const handleSubmit = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(() => {\n var _a;\n\n if (!inputRef.current) {\n return;\n }\n\n const link = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(inputRef.current.value) || null;\n\n if (!element.link && link) {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"create\");\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(element)) {\n if (((_a = appState.activeEmbeddable) === null || _a === void 0 ? void 0 : _a.element) === element) {\n setAppState({\n activeEmbeddable: null\n });\n }\n\n if (!link) {\n scene.mutateElement(element, {\n link: null\n });\n updateEmbedValidationStatus(element, false);\n return;\n }\n\n if (!(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.embeddableURLValidator)(link, appProps.validateEmbeddable)) {\n if (link) {\n setToast({\n message: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"toast.unableToEmbed\"),\n closable: true\n });\n }\n\n element.link && embeddableLinkCache.set(element.id, element.link);\n scene.mutateElement(element, {\n link\n });\n updateEmbedValidationStatus(element, false);\n } else {\n const {\n width,\n height\n } = element;\n const embedLink = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getEmbedLink)(link);\n\n if ((embedLink === null || embedLink === void 0 ? void 0 : embedLink.error) instanceof URIError) {\n setToast({\n message: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"toast.unrecognizedLinkFormat\"),\n closable: true\n });\n }\n\n const ar = embedLink ? embedLink.intrinsicSize.w / embedLink.intrinsicSize.h : 1;\n const hasLinkChanged = embeddableLinkCache.get(element.id) !== element.link;\n scene.mutateElement(element, Object.assign(Object.assign({}, hasLinkChanged ? {\n width: (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"video\" ? width > height ? width : height * ar : width,\n height: (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"video\" ? width > height ? width / ar : height : height\n } : {}), {\n link\n }));\n updateEmbedValidationStatus(element, true);\n\n if (embeddableLinkCache.has(element.id)) {\n embeddableLinkCache.delete(element.id);\n }\n }\n } else {\n scene.mutateElement(element, {\n link\n });\n }\n }, [element, scene, setToast, appProps.validateEmbeddable, appState.activeEmbeddable, setAppState, updateEmbedValidationStatus]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useLayoutEffect)(() => {\n return () => {\n handleSubmit();\n };\n }, [handleSubmit]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n if (isEditing && (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && !(editorInterface.formFactor === \"phone\" || editorInterface.isTouchScreen)) {\n inputRef.current.select();\n }\n }, [isEditing, editorInterface.formFactor, editorInterface.isTouchScreen]); //zsviczian - attach link suggester\n\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n if (!isEditing || !inputRef.current) {\n return;\n }\n\n const keyBlocker = (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_12__.attachInlineLinkSuggester)(inputRef.current, undefined, undefined, false);\n return () => keyBlocker === null || keyBlocker === void 0 ? void 0 : keyBlocker.close();\n }, [isEditing]); //zsviczian - end\n\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n let timeoutId = null;\n\n const handlePointerMove = event => {\n if (isEditing) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n const shouldHide = shouldHideLinkPopup(element, elementsMap, appState, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(event.clientX, event.clientY));\n\n if (shouldHide) {\n timeoutId = window.setTimeout(() => {\n setAppState({\n showHyperlinkPopup: false\n });\n }, AUTO_HIDE_TIMEOUT);\n }\n };\n\n window.addEventListener(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.POINTER_MOVE, handlePointerMove, false);\n return () => {\n window.removeEventListener(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.POINTER_MOVE, handlePointerMove, false);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [appState, element, isEditing, setAppState, elementsMap]);\n const handleRemove = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(() => {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"delete\");\n scene.mutateElement(element, {\n link: null\n });\n setAppState({\n showHyperlinkPopup: false\n });\n }, [setAppState, element, scene]);\n\n const onEdit = () => {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"edit\", \"popup-ui\");\n setAppState({\n showHyperlinkPopup: \"editor\"\n });\n };\n\n const {\n x,\n y\n } = getCoordsForPopover(element, appState, elementsMap);\n\n if (appState.contextMenu || appState.selectedElementsAreBeingDragged || appState.resizingElement || appState.isRotating || appState.openMenu || appState.viewModeEnabled) {\n return null;\n }\n\n return React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer\",\n style: {\n top: `${y}px`,\n left: `${x}px`,\n width: POPUP_WIDTH,\n padding: POPUP_PADDING\n }\n }, isEditing ? React.createElement(\"input\", {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(\"excalidraw-hyperlinkContainer-input\"),\n placeholder: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.hint\"),\n ref: inputRef,\n value: inputVal,\n onChange: event => setInputVal(event.target.value),\n autoFocus: true,\n onKeyDown: event => {\n event.stopPropagation(); // prevent cmd/ctrl+k shortcut when editing link\n\n if (event[_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.CTRL_OR_CMD] && event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.K) {\n event.preventDefault();\n }\n\n if (event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.ENTER || event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.ESCAPE) {\n handleSubmit();\n setAppState({\n showHyperlinkPopup: \"info\"\n });\n }\n }\n }) : element.link ? React.createElement(\"a\", {\n href: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(element.link || \"\"),\n className: \"excalidraw-hyperlinkContainer-link\",\n target: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.isLocalLink)(element.link) ? \"_self\" : \"_blank\",\n onClick: event => {\n if (element.link && onLinkOpen) {\n const customEvent = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.wrapEvent)(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.EXCALIDRAW_LINK, event.nativeEvent);\n onLinkOpen(Object.assign(Object.assign({}, element), {\n link: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(element.link)\n }), customEvent);\n\n if (customEvent.defaultPrevented) {\n event.preventDefault();\n }\n }\n },\n rel: \"noopener noreferrer\"\n }, element.link) : React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer-link\"\n }, (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.empty\")), React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer__buttons\"\n }, !isEditing && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n \"aria-label\": (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n label: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n onClick: onEdit,\n className: \"excalidraw-hyperlinkContainer--edit\",\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.FreedrawIcon\n }), //zsviczian - show the Obsidian search button\n Boolean(appProps.insertLinkAction) && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: \"Obsidian Search\",\n \"aria-label\": \"Obsidian Search\",\n label: \"Obsidian Search\",\n onClick: () => {\n if (appProps.insertLinkAction) {\n setAppState({\n showHyperlinkPopup: false\n });\n appProps.insertLinkAction(inputVal);\n }\n },\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.searchIcon\n }), linkVal && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(element) && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n \"aria-label\": (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n label: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n onClick: handleRemove,\n className: \"excalidraw-hyperlinkContainer--remove\",\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.TrashIcon\n })));\n};\n\nconst getCoordsForPopover = (element, appState, elementsMap) => {\n const [x1, y1] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const {\n x: viewportX,\n y: viewportY\n } = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.sceneCoordsToViewportCoords)({\n sceneX: x1 + element.width / 2,\n sceneY: y1\n }, appState);\n const x = viewportX - appState.offsetLeft - POPUP_WIDTH / 2;\n const y = viewportY - appState.offsetTop - SPACE_BOTTOM;\n return {\n x,\n y\n };\n};\n\nconst getContextMenuLabel = (elements, appState) => {\n var _a;\n\n const selectedElements = (0,_scene__WEBPACK_IMPORTED_MODULE_11__.getSelectedElements)(elements, appState);\n const label = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(selectedElements[0]) ? \"labels.link.editEmbed\" : ((_a = selectedElements[0]) === null || _a === void 0 ? void 0 : _a.link) ? \"labels.link.edit\" : \"labels.link.create\";\n return label;\n};\nlet HYPERLINK_TOOLTIP_TIMEOUT_ID = null;\nconst showHyperlinkTooltip = (element, appState, elementsMap) => {\n if (HYPERLINK_TOOLTIP_TIMEOUT_ID) {\n clearTimeout(HYPERLINK_TOOLTIP_TIMEOUT_ID);\n }\n\n HYPERLINK_TOOLTIP_TIMEOUT_ID = window.setTimeout(() => renderTooltip(element, appState, elementsMap), _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.HYPERLINK_TOOLTIP_DELAY);\n};\n\nconst renderTooltip = (element, appState, elementsMap) => {\n if (!element.link) {\n return;\n }\n\n const tooltipDiv = (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.getTooltipDiv)();\n tooltipDiv.classList.add(\"excalidraw-tooltip--visible\");\n tooltipDiv.style.maxWidth = \"20rem\";\n tooltipDiv.textContent = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isElementLink)(element.link) ? (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.goToElement\") : element.link;\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const [linkX, linkY, linkWidth, linkHeight] = (0,_helpers__WEBPACK_IMPORTED_MODULE_13__.getLinkHandleFromCoords)([x1, y1, x2, y2], element.angle, appState);\n const linkViewportCoords = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.sceneCoordsToViewportCoords)({\n sceneX: linkX,\n sceneY: linkY\n }, appState);\n (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.updateTooltipPosition)(tooltipDiv, {\n left: linkViewportCoords.x,\n top: linkViewportCoords.y,\n width: linkWidth,\n height: linkHeight\n }, \"top\");\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"tooltip\", \"link-icon\");\n IS_HYPERLINK_TOOLTIP_VISIBLE = true;\n};\n\nconst hideHyperlinkToolip = () => {\n if (HYPERLINK_TOOLTIP_TIMEOUT_ID) {\n clearTimeout(HYPERLINK_TOOLTIP_TIMEOUT_ID);\n }\n\n if (IS_HYPERLINK_TOOLTIP_VISIBLE) {\n IS_HYPERLINK_TOOLTIP_VISIBLE = false;\n (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.getTooltipDiv)().classList.remove(\"excalidraw-tooltip--visible\");\n }\n};\n\nconst shouldHideLinkPopup = (element, elementsMap, appState, [clientX, clientY]) => {\n const {\n x: sceneX,\n y: sceneY\n } = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.viewportCoordsToSceneCoords)({\n clientX,\n clientY\n }, appState);\n const threshold = 15 / appState.zoom.value; // hitbox to prevent hiding when hovered in element bounding box\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.hitElementBoundingBox)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(sceneX, sceneY), element, elementsMap)) {\n return false;\n }\n\n const [x1, y1, x2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap); // hit box to prevent hiding when hovered in the vertical area between element and popover\n\n if (sceneX >= x1 && sceneX <= x2 && sceneY >= y1 - SPACE_BOTTOM && sceneY <= y1) {\n return false;\n } // hit box to prevent hiding when hovered around popover within threshold\n\n\n const {\n x: popoverX,\n y: popoverY\n } = getCoordsForPopover(element, appState, elementsMap);\n\n if (clientX >= popoverX - threshold && clientX <= popoverX + POPUP_WIDTH + POPUP_PADDING * 2 + threshold && clientY >= popoverY - threshold && clientY <= popoverY + threshold + POPUP_PADDING * 2 + POPUP_HEIGHT) {\n return false;\n }\n\n return true;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./components/hyperlink/Hyperlink.tsx?");
|
|
16680
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Hyperlink: () => (/* binding */ Hyperlink),\n/* harmony export */ getContextMenuLabel: () => (/* binding */ getContextMenuLabel),\n/* harmony export */ hideHyperlinkToolip: () => (/* binding */ hideHyperlinkToolip),\n/* harmony export */ showHyperlinkTooltip: () => (/* binding */ showHyperlinkTooltip)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/math */ \"../math/src/index.ts\");\n/* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! clsx */ \"../../node_modules/clsx/dist/clsx.m.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _excalidraw_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @excalidraw/element */ \"../element/src/index.ts\");\n/* harmony import */ var _analytics__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../analytics */ \"./analytics.ts\");\n/* harmony import */ var _components_Tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../components/Tooltip */ \"./components/Tooltip.tsx\");\n/* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../i18n */ \"./i18n.ts\");\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../App */ \"./components/App.tsx\");\n/* harmony import */ var _ToolButton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ToolButton */ \"./components/ToolButton.tsx\");\n/* harmony import */ var _icons__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../icons */ \"./components/icons.tsx\");\n/* harmony import */ var _scene__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../scene */ \"./scene/index.ts\");\n/* harmony import */ var _obsidianUtils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../obsidianUtils */ \"./obsidianUtils.ts\");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./helpers */ \"./components/hyperlink/helpers.ts\");\n/* harmony import */ var _Hyperlink_scss__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Hyperlink.scss */ \"./components/hyperlink/Hyperlink.scss\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n //zsviczian\n\n\n\nconst POPUP_WIDTH = 380;\nconst POPUP_HEIGHT = 42;\nconst POPUP_PADDING = 5;\nconst SPACE_BOTTOM = 85;\nconst AUTO_HIDE_TIMEOUT = 500;\nlet IS_HYPERLINK_TOOLTIP_VISIBLE = false;\nconst embeddableLinkCache = new Map();\nconst Hyperlink = ({\n element,\n scene,\n setAppState,\n onLinkOpen,\n setToast,\n updateEmbedValidationStatus\n}) => {\n const elementsMap = scene.getNonDeletedElementsMap();\n const appState = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useExcalidrawAppState)();\n const appProps = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useAppProps)();\n const editorInterface = (0,_App__WEBPACK_IMPORTED_MODULE_8__.useEditorInterface)();\n const linkVal = element.link || \"\";\n const [inputVal, setInputVal] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(linkVal);\n const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n const isEditing = appState.showHyperlinkPopup === \"editor\";\n const handleSubmit = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(() => {\n var _a;\n\n if (!inputRef.current) {\n return;\n }\n\n const link = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(inputRef.current.value) || null;\n\n if (!element.link && link) {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"create\");\n }\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(element)) {\n if (((_a = appState.activeEmbeddable) === null || _a === void 0 ? void 0 : _a.element) === element) {\n setAppState({\n activeEmbeddable: null\n });\n }\n\n if (!link) {\n scene.mutateElement(element, {\n link: null\n });\n updateEmbedValidationStatus(element, false);\n return;\n }\n\n if (!(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.embeddableURLValidator)(link, appProps.validateEmbeddable)) {\n if (link) {\n setToast({\n message: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"toast.unableToEmbed\"),\n closable: true\n });\n }\n\n element.link && embeddableLinkCache.set(element.id, element.link);\n scene.mutateElement(element, {\n link\n });\n updateEmbedValidationStatus(element, false);\n } else {\n const {\n width,\n height\n } = element;\n const embedLink = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getEmbedLink)(link);\n\n if ((embedLink === null || embedLink === void 0 ? void 0 : embedLink.error) instanceof URIError) {\n setToast({\n message: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"toast.unrecognizedLinkFormat\"),\n closable: true\n });\n }\n\n const ar = embedLink ? embedLink.intrinsicSize.w / embedLink.intrinsicSize.h : 1;\n const hasLinkChanged = embeddableLinkCache.get(element.id) !== element.link;\n scene.mutateElement(element, Object.assign(Object.assign({}, hasLinkChanged ? {\n width: (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"video\" ? width > height ? width : height * ar : width,\n height: (embedLink === null || embedLink === void 0 ? void 0 : embedLink.type) === \"video\" ? width > height ? width / ar : height : height\n } : {}), {\n link\n }));\n updateEmbedValidationStatus(element, true);\n\n if (embeddableLinkCache.has(element.id)) {\n embeddableLinkCache.delete(element.id);\n }\n }\n } else {\n scene.mutateElement(element, {\n link\n });\n }\n }, [element, scene, setToast, appProps.validateEmbeddable, appState.activeEmbeddable, setAppState, updateEmbedValidationStatus]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useLayoutEffect)(() => {\n return () => {\n handleSubmit();\n };\n }, [handleSubmit]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n if (isEditing && (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && !(editorInterface.formFactor === \"phone\" || editorInterface.isTouchScreen)) {\n inputRef.current.select();\n }\n }, [isEditing, editorInterface.formFactor, editorInterface.isTouchScreen]); // zsviczian - keep input state in sync with native mutations (e.g. Obsidian suggester)\n\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n var _a, _b;\n\n if (isEditing && inputRef.current) {\n const inputEl = inputRef.current;\n setInputVal((_b = (_a = inputEl.value) !== null && _a !== void 0 ? _a : element.link) !== null && _b !== void 0 ? _b : \"\");\n\n const handleInput = event => {\n const target = event.target;\n\n if (!target) {\n return;\n }\n\n setInputVal(target.value);\n };\n\n inputEl.addEventListener(\"input\", handleInput);\n return () => {\n inputEl.removeEventListener(\"input\", handleInput);\n };\n }\n\n setInputVal(element.link || \"\");\n }, [isEditing, element.link]); // zsviczian - end\n //zsviczian - attach link suggester\n\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n if (!isEditing || !inputRef.current) {\n return;\n }\n\n const keyBlocker = (0,_obsidianUtils__WEBPACK_IMPORTED_MODULE_12__.attachInlineLinkSuggester)(inputRef.current, undefined, undefined, false);\n return () => keyBlocker === null || keyBlocker === void 0 ? void 0 : keyBlocker.close();\n }, [isEditing]); //zsviczian - end\n\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(() => {\n let timeoutId = null;\n\n const handlePointerMove = event => {\n if (isEditing) {\n return;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n const shouldHide = shouldHideLinkPopup(element, elementsMap, appState, (0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(event.clientX, event.clientY));\n\n if (shouldHide) {\n timeoutId = window.setTimeout(() => {\n setAppState({\n showHyperlinkPopup: false\n });\n }, AUTO_HIDE_TIMEOUT);\n }\n };\n\n window.addEventListener(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.POINTER_MOVE, handlePointerMove, false);\n return () => {\n window.removeEventListener(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.POINTER_MOVE, handlePointerMove, false);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [appState, element, isEditing, setAppState, elementsMap]);\n const handleRemove = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(() => {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"delete\");\n scene.mutateElement(element, {\n link: null\n });\n setAppState({\n showHyperlinkPopup: false\n });\n }, [setAppState, element, scene]);\n\n const onEdit = () => {\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"edit\", \"popup-ui\");\n setAppState({\n showHyperlinkPopup: \"editor\"\n });\n };\n\n const {\n x,\n y\n } = getCoordsForPopover(element, appState, elementsMap);\n\n if (appState.contextMenu || appState.selectedElementsAreBeingDragged || appState.resizingElement || appState.isRotating || appState.openMenu || appState.viewModeEnabled) {\n return null;\n }\n\n return React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer\",\n style: {\n top: `${y}px`,\n left: `${x}px`,\n width: POPUP_WIDTH,\n padding: POPUP_PADDING\n }\n }, isEditing ? React.createElement(\"input\", {\n className: (0,clsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(\"excalidraw-hyperlinkContainer-input\"),\n placeholder: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.hint\"),\n ref: inputRef,\n value: inputVal,\n onChange: event => setInputVal(event.target.value),\n autoFocus: true,\n onKeyDown: event => {\n event.stopPropagation(); // prevent cmd/ctrl+k shortcut when editing link\n\n if (event[_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.CTRL_OR_CMD] && event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.K) {\n event.preventDefault();\n }\n\n if (event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.ENTER || event.key === _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.KEYS.ESCAPE) {\n handleSubmit();\n setAppState({\n showHyperlinkPopup: \"info\"\n });\n }\n }\n }) : element.link ? React.createElement(\"a\", {\n href: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(element.link || \"\"),\n className: \"excalidraw-hyperlinkContainer-link\",\n target: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.isLocalLink)(element.link) ? \"_self\" : \"_blank\",\n onClick: event => {\n if (element.link && onLinkOpen) {\n const customEvent = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.wrapEvent)(_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.EVENT.EXCALIDRAW_LINK, event.nativeEvent);\n onLinkOpen(Object.assign(Object.assign({}, element), {\n link: (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.normalizeLink)(element.link)\n }), customEvent);\n\n if (customEvent.defaultPrevented) {\n event.preventDefault();\n }\n }\n },\n rel: \"noopener noreferrer\"\n }, element.link) : React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer-link\"\n }, (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.empty\")), React.createElement(\"div\", {\n className: \"excalidraw-hyperlinkContainer__buttons\"\n }, !isEditing && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n \"aria-label\": (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n label: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.edit\"),\n onClick: onEdit,\n className: \"excalidraw-hyperlinkContainer--edit\",\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.FreedrawIcon\n }), //zsviczian - show the Obsidian search button\n Boolean(appProps.insertLinkAction) && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: \"Obsidian Search\",\n \"aria-label\": \"Obsidian Search\",\n label: \"Obsidian Search\",\n onClick: () => {\n if (appProps.insertLinkAction) {\n setAppState({\n showHyperlinkPopup: false\n });\n appProps.insertLinkAction(inputVal);\n }\n },\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.searchIcon\n }), linkVal && !(0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(element) && React.createElement(_ToolButton__WEBPACK_IMPORTED_MODULE_9__.ToolButton, {\n type: \"button\",\n title: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n \"aria-label\": (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n label: (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"buttons.remove\"),\n onClick: handleRemove,\n className: \"excalidraw-hyperlinkContainer--remove\",\n icon: _icons__WEBPACK_IMPORTED_MODULE_10__.TrashIcon\n })));\n};\n\nconst getCoordsForPopover = (element, appState, elementsMap) => {\n const [x1, y1] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const {\n x: viewportX,\n y: viewportY\n } = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.sceneCoordsToViewportCoords)({\n sceneX: x1 + element.width / 2,\n sceneY: y1\n }, appState);\n const x = viewportX - appState.offsetLeft - POPUP_WIDTH / 2;\n const y = viewportY - appState.offsetTop - SPACE_BOTTOM;\n return {\n x,\n y\n };\n};\n\nconst getContextMenuLabel = (elements, appState) => {\n var _a;\n\n const selectedElements = (0,_scene__WEBPACK_IMPORTED_MODULE_11__.getSelectedElements)(elements, appState);\n const label = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isEmbeddableElement)(selectedElements[0]) ? \"labels.link.editEmbed\" : ((_a = selectedElements[0]) === null || _a === void 0 ? void 0 : _a.link) ? \"labels.link.edit\" : \"labels.link.create\";\n return label;\n};\nlet HYPERLINK_TOOLTIP_TIMEOUT_ID = null;\nconst showHyperlinkTooltip = (element, appState, elementsMap) => {\n if (HYPERLINK_TOOLTIP_TIMEOUT_ID) {\n clearTimeout(HYPERLINK_TOOLTIP_TIMEOUT_ID);\n }\n\n HYPERLINK_TOOLTIP_TIMEOUT_ID = window.setTimeout(() => renderTooltip(element, appState, elementsMap), _excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.HYPERLINK_TOOLTIP_DELAY);\n};\n\nconst renderTooltip = (element, appState, elementsMap) => {\n if (!element.link) {\n return;\n }\n\n const tooltipDiv = (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.getTooltipDiv)();\n tooltipDiv.classList.add(\"excalidraw-tooltip--visible\");\n tooltipDiv.style.maxWidth = \"20rem\";\n tooltipDiv.textContent = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.isElementLink)(element.link) ? (0,_i18n__WEBPACK_IMPORTED_MODULE_7__.t)(\"labels.link.goToElement\") : element.link;\n const [x1, y1, x2, y2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap);\n const [linkX, linkY, linkWidth, linkHeight] = (0,_helpers__WEBPACK_IMPORTED_MODULE_13__.getLinkHandleFromCoords)([x1, y1, x2, y2], element.angle, appState);\n const linkViewportCoords = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.sceneCoordsToViewportCoords)({\n sceneX: linkX,\n sceneY: linkY\n }, appState);\n (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.updateTooltipPosition)(tooltipDiv, {\n left: linkViewportCoords.x,\n top: linkViewportCoords.y,\n width: linkWidth,\n height: linkHeight\n }, \"top\");\n (0,_analytics__WEBPACK_IMPORTED_MODULE_5__.trackEvent)(\"hyperlink\", \"tooltip\", \"link-icon\");\n IS_HYPERLINK_TOOLTIP_VISIBLE = true;\n};\n\nconst hideHyperlinkToolip = () => {\n if (HYPERLINK_TOOLTIP_TIMEOUT_ID) {\n clearTimeout(HYPERLINK_TOOLTIP_TIMEOUT_ID);\n }\n\n if (IS_HYPERLINK_TOOLTIP_VISIBLE) {\n IS_HYPERLINK_TOOLTIP_VISIBLE = false;\n (0,_components_Tooltip__WEBPACK_IMPORTED_MODULE_6__.getTooltipDiv)().classList.remove(\"excalidraw-tooltip--visible\");\n }\n};\n\nconst shouldHideLinkPopup = (element, elementsMap, appState, [clientX, clientY]) => {\n const {\n x: sceneX,\n y: sceneY\n } = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_3__.viewportCoordsToSceneCoords)({\n clientX,\n clientY\n }, appState);\n const threshold = 15 / appState.zoom.value; // hitbox to prevent hiding when hovered in element bounding box\n\n if ((0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.hitElementBoundingBox)((0,_excalidraw_math__WEBPACK_IMPORTED_MODULE_0__.pointFrom)(sceneX, sceneY), element, elementsMap)) {\n return false;\n }\n\n const [x1, y1, x2] = (0,_excalidraw_element__WEBPACK_IMPORTED_MODULE_4__.getElementAbsoluteCoords)(element, elementsMap); // hit box to prevent hiding when hovered in the vertical area between element and popover\n\n if (sceneX >= x1 && sceneX <= x2 && sceneY >= y1 - SPACE_BOTTOM && sceneY <= y1) {\n return false;\n } // hit box to prevent hiding when hovered around popover within threshold\n\n\n const {\n x: popoverX,\n y: popoverY\n } = getCoordsForPopover(element, appState, elementsMap);\n\n if (clientX >= popoverX - threshold && clientX <= popoverX + POPUP_WIDTH + POPUP_PADDING * 2 + threshold && clientY >= popoverY - threshold && clientY <= popoverY + threshold + POPUP_PADDING * 2 + POPUP_HEIGHT) {\n return false;\n }\n\n return true;\n};\n\n//# sourceURL=webpack://ExcalidrawLib/./components/hyperlink/Hyperlink.tsx?");
|
|
16736
16681
|
|
|
16737
16682
|
/***/ }),
|
|
16738
16683
|
|
|
@@ -20988,7 +20933,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
20988
20933
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20989
20934
|
|
|
20990
20935
|
"use strict";
|
|
20991
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerUrl: () => (/* binding */ WorkerUrl)\n/* harmony export */ });\n/* harmony import */ var _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subset-shared.chunk */ \"./subset/subset-shared.chunk.ts\");\n/**\n * DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.\n *\n * Including anything from the main chunk would include the whole chunk by default.\n * Even it it would be tree-shaken during build, it won't be tree-shaken in dev.\n *\n * In the future consider separating common utils into a separate shared chunk.\n */\n\n/**\n * Due to this export (and related dynamic import), this worker code will be included in the bundle automatically (as a separate chunk),\n * without the need for esbuild / vite /rollup plugins and special browser / server treatment.\n *\n * `import.meta.url` is undefined in nodejs\n */\n\nconst WorkerUrl = true ? new URL(\"file:///
|
|
20936
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerUrl: () => (/* binding */ WorkerUrl)\n/* harmony export */ });\n/* harmony import */ var _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subset-shared.chunk */ \"./subset/subset-shared.chunk.ts\");\n/**\n * DON'T depend on anything from the outside like `promiseTry`, as this module is part of a separate lazy-loaded chunk.\n *\n * Including anything from the main chunk would include the whole chunk by default.\n * Even it it would be tree-shaken during build, it won't be tree-shaken in dev.\n *\n * In the future consider separating common utils into a separate shared chunk.\n */\n\n/**\n * Due to this export (and related dynamic import), this worker code will be included in the bundle automatically (as a separate chunk),\n * without the need for esbuild / vite /rollup plugins and special browser / server treatment.\n *\n * `import.meta.url` is undefined in nodejs\n */\n\nconst WorkerUrl = true ? new URL(\"file:///Users/zsviczian/GitHub/excalidraw/packages/excalidraw/subset/subset-worker.chunk.ts\") : 0; // run only in the worker context\n\nif (typeof window === \"undefined\" && typeof self !== \"undefined\") {\n self.onmessage = async e => {\n switch (e.data.command) {\n case _subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__.Commands.Subset:\n const buffer = await (0,_subset_shared_chunk__WEBPACK_IMPORTED_MODULE_0__.subsetToBinary)(e.data.arrayBuffer, e.data.codePoints);\n self.postMessage(buffer, {\n transfer: [buffer]\n });\n break;\n }\n };\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./subset/subset-worker.chunk.ts?");
|
|
20992
20937
|
|
|
20993
20938
|
/***/ }),
|
|
20994
20939
|
|
|
@@ -21042,7 +20987,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
21042
20987
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
21043
20988
|
|
|
21044
20989
|
"use strict";
|
|
21045
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerPool: () => (/* binding */ WorkerPool)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ \"./errors.ts\");\n\n\n\nclass IdleWorker {\n constructor(workerUrl) {\n this.instance = new Worker(workerUrl, {\n type: \"module\"\n });\n }\n\n}\n/**\n * Pool of idle short-lived workers.\n *\n * IMPORTANT: for simplicity it does not limit the number of newly created workers, leaving it up to the caller to manage the pool size.\n */\n\n\nclass WorkerPool {\n constructor(workerUrl, options) {\n this.idleWorkers = new Set();\n this.workerUrl = workerUrl; // by default, active & idle workers will be terminated after 1s of inactivity\n\n this.workerTTL = options.ttl || 1000;\n }\n /**\n * Create a new worker pool.\n *\n * @param workerUrl - The URL of the worker file.\n * @param options - The options for the worker pool.\n * @throws If the worker is bundled into the main chunk.\n * @returns A new worker pool instance.\n */\n\n\n static create(workerUrl, options = {}) {\n if (!workerUrl) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerUrlNotDefinedError();\n }\n\n if ( false || workerUrl.toString() === \"file:///
|
|
20990
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WorkerPool: () => (/* binding */ WorkerPool)\n/* harmony export */ });\n/* harmony import */ var _excalidraw_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @excalidraw/common */ \"../common/src/index.ts\");\n/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors */ \"./errors.ts\");\n\n\n\nclass IdleWorker {\n constructor(workerUrl) {\n this.instance = new Worker(workerUrl, {\n type: \"module\"\n });\n }\n\n}\n/**\n * Pool of idle short-lived workers.\n *\n * IMPORTANT: for simplicity it does not limit the number of newly created workers, leaving it up to the caller to manage the pool size.\n */\n\n\nclass WorkerPool {\n constructor(workerUrl, options) {\n this.idleWorkers = new Set();\n this.workerUrl = workerUrl; // by default, active & idle workers will be terminated after 1s of inactivity\n\n this.workerTTL = options.ttl || 1000;\n }\n /**\n * Create a new worker pool.\n *\n * @param workerUrl - The URL of the worker file.\n * @param options - The options for the worker pool.\n * @throws If the worker is bundled into the main chunk.\n * @returns A new worker pool instance.\n */\n\n\n static create(workerUrl, options = {}) {\n if (!workerUrl) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerUrlNotDefinedError();\n }\n\n if ( false || workerUrl.toString() === \"file:///Users/zsviczian/GitHub/excalidraw/packages/excalidraw/workers.ts\") {\n // in case the worker code is bundled into the main chunk\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.WorkerInTheMainChunkError();\n }\n\n return new WorkerPool(workerUrl, options);\n }\n /**\n * Take idle worker from the pool or create a new one and post a message to it.\n */\n\n\n async postMessage(data, options) {\n let worker;\n const idleWorker = Array.from(this.idleWorkers).shift();\n\n if (idleWorker) {\n this.idleWorkers.delete(idleWorker);\n worker = idleWorker;\n } else {\n worker = await this.createWorker();\n }\n\n return new Promise((resolve, reject) => {\n worker.instance.onmessage = this.onMessageHandler(worker, resolve);\n worker.instance.onerror = this.onErrorHandler(worker, reject);\n worker.instance.postMessage(data, options);\n worker.debounceTerminate(() => reject(new Error(`Active worker did not respond for ${this.workerTTL}ms!`)));\n });\n }\n /**\n * Terminate the idle workers in the pool.\n */\n\n\n async clear() {\n for (const worker of this.idleWorkers) {\n worker.debounceTerminate.cancel();\n worker.instance.terminate();\n }\n\n this.idleWorkers.clear();\n }\n /**\n * Used to get a worker from the pool or create a new one if there is no idle available.\n */\n\n\n async createWorker() {\n const worker = new IdleWorker(this.workerUrl);\n worker.debounceTerminate = (0,_excalidraw_common__WEBPACK_IMPORTED_MODULE_0__.debounce)(reject => {\n worker.instance.terminate();\n\n if (this.idleWorkers.has(worker)) {\n this.idleWorkers.delete(worker); // eslint-disable-next-line no-console\n\n console.debug(\"Job finished! Idle worker has been released from the pool.\");\n } else if (reject) {\n reject();\n } else {\n console.error(\"Worker has been terminated!\");\n }\n }, this.workerTTL);\n return worker;\n }\n\n onMessageHandler(worker, resolve) {\n return e => {\n worker.debounceTerminate();\n this.idleWorkers.add(worker);\n resolve(e.data);\n };\n }\n\n onErrorHandler(worker, reject) {\n return e => {\n // terminate the worker immediately before rejection\n worker.debounceTerminate(() => reject(e));\n worker.debounceTerminate.flush(); // clear the worker pool in case there are some idle workers left\n\n this.clear();\n };\n }\n\n}\n\n//# sourceURL=webpack://ExcalidrawLib/./workers.ts?");
|
|
21046
20991
|
|
|
21047
20992
|
/***/ }),
|
|
21048
20993
|
|