@mongodb-js/compass-context-menu
Advanced tools
Comparing version
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.appendContextMenuContent = exports.getContextMenuContent = void 0; | ||
exports.getContextMenuContent = getContextMenuContent; | ||
exports.appendContextMenuContent = appendContextMenuContent; | ||
const CONTEXT_MENUS_SYMBOL = Symbol('context_menus'); | ||
@@ -8,3 +9,2 @@ function getContextMenuContent(event) { | ||
} | ||
exports.getContextMenuContent = getContextMenuContent; | ||
function appendContextMenuContent(event, ...groups) { | ||
@@ -17,3 +17,2 @@ // Initialize if not already patched | ||
} | ||
exports.appendContextMenuContent = appendContextMenuContent; | ||
//# sourceMappingURL=context-menu-content.js.map |
import React from 'react'; | ||
import type { ContextMenuContextType, ContextMenuState } from './types'; | ||
export declare const ContextMenuContext: React.Context<ContextMenuContextType | null>; | ||
export declare function ContextMenuProvider({ disabled, children, menuWrapper, }: { | ||
export declare function ContextMenuProvider({ disabled, children, menuWrapper: Wrapper, }: { | ||
disabled?: boolean; | ||
@@ -6,0 +6,0 @@ children: React.ReactNode; |
@@ -18,15 +18,26 @@ "use strict"; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ContextMenuProvider = exports.ContextMenuContext = void 0; | ||
exports.ContextMenuContext = void 0; | ||
exports.ContextMenuProvider = ContextMenuProvider; | ||
const react_1 = __importStar(require("react")); | ||
const context_menu_content_1 = require("./context-menu-content"); | ||
exports.ContextMenuContext = (0, react_1.createContext)(null); | ||
function ContextMenuProvider({ disabled = false, children, menuWrapper, }) { | ||
function ContextMenuProvider({ disabled = false, children, menuWrapper: Wrapper, }) { | ||
// Check if there's already a parent context menu provider | ||
@@ -67,5 +78,9 @@ const parentContext = (0, react_1.useContext)(exports.ContextMenuContext); | ||
window.addEventListener('resize', handleClosingEvent); | ||
window.addEventListener('scroll', handleClosingEvent, { capture: true }); | ||
return () => { | ||
document.removeEventListener('contextmenu', handleContextMenu); | ||
window.removeEventListener('resize', handleClosingEvent); | ||
window.removeEventListener('scroll', handleClosingEvent, { | ||
capture: true, | ||
}); | ||
}; | ||
@@ -80,3 +95,2 @@ }, [disabled, handleClosingEvent, parentContext]); | ||
} | ||
const Wrapper = menuWrapper ?? react_1.default.Fragment; | ||
return (react_1.default.createElement(exports.ContextMenuContext.Provider, { value: value }, | ||
@@ -86,3 +100,2 @@ children, | ||
} | ||
exports.ContextMenuProvider = ContextMenuProvider; | ||
//# sourceMappingURL=context-menu-provider.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
export type ContextMenuItemGroup = ContextMenuItem[]; | ||
@@ -3,0 +2,0 @@ export type ContextMenuState = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useContextMenu = void 0; | ||
exports.useContextMenu = useContextMenu; | ||
const react_1 = require("react"); | ||
@@ -37,3 +37,2 @@ const context_menu_provider_1 = require("./context-menu-provider"); | ||
} | ||
exports.useContextMenu = useContextMenu; | ||
//# sourceMappingURL=use-context-menu.js.map |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/compass", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"repository": { | ||
@@ -57,7 +57,7 @@ "type": "git", | ||
"devDependencies": { | ||
"@mongodb-js/eslint-config-compass": "^1.4.0", | ||
"@mongodb-js/mocha-config-compass": "^1.6.8", | ||
"@mongodb-js/eslint-config-compass": "^1.4.1", | ||
"@mongodb-js/mocha-config-compass": "^1.6.9", | ||
"@mongodb-js/prettier-config-compass": "^1.2.8", | ||
"@mongodb-js/testing-library-compass": "^1.3.3", | ||
"@mongodb-js/tsconfig-compass": "^1.2.8", | ||
"@mongodb-js/testing-library-compass": "^1.3.4", | ||
"@mongodb-js/tsconfig-compass": "^1.2.9", | ||
"@types/chai": "^4.2.21", | ||
@@ -73,5 +73,5 @@ "@types/mocha": "^9.0.0", | ||
"sinon": "^9.2.3", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.8.3" | ||
}, | ||
"gitHead": "b7caa2e7e2c72d359fb70cb50045f64dc3a73ff7" | ||
"gitHead": "120fab36085b56bc36e120ef92a1ce363d5cf037" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
49038
1.12%218
4.81%