Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@neo4j-cypher/codemirror

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j-cypher/codemirror - npm Package Compare versions

Comparing version 1.0.0-next.8 to 1.0.0-next.9

48

es/codemirror.js

@@ -33,5 +33,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

import { getStatePositionAbsolute, getStateEditorSupport, getStateLineCount, getStateValue, getStateLength, getStatePosition, getStatePositionForAny } from "./cypher-state-selectors";
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getThemeExtensions, getTooltipAbsoluteExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getIndentWithTabExtensions, getLintExtensions } from "./cypher-extensions";
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getThemeExtensions, getTooltipAbsoluteExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getTabKeyExtensions, getLintExtensions } from "./cypher-extensions";
export * from "./cypher-codemirror-base";
export * from "./cypher-extensions";
export const getDefaultOptions = () => _objectSpread({}, defaultOptions);
export const withDefaultOptions = options => {
const combinedOptions = _objectSpread({}, defaultOptions);
for (let key of Object.keys(options)) {
if (options[key] !== undefined) {
combinedOptions[key] = options[key];
}
}
return combinedOptions;
};
export const getExtensions = (options = {}, {

@@ -45,4 +55,4 @@ lintConf = new Compartment(),

historyConf = new Compartment(),
indentWithTabConf = new Compartment(),
placeholderConf = new Compartment(),
tabKeyConf = new Compartment(),
themeConf = new Compartment(),

@@ -55,3 +65,3 @@ tooltipAbsoluteConf = new Compartment(),

} = {}) => {
const combinedOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
const combinedOptions = withDefaultOptions(options);
const {

@@ -61,3 +71,3 @@ autocomplete,

history,
indentWithTab,
tabKey,
lineNumberFormatter,

@@ -92,4 +102,4 @@ lineNumbers,

history
})), indentWithTabConf.of(getIndentWithTabExtensions({
indentWithTab
})), tabKeyConf.of(getTabKeyExtensions({
tabKey
})), readableConf.of(getReadableExtensions({

@@ -113,12 +123,2 @@ readOnly,

});
export const getDefaultOptions = () => _objectSpread({}, defaultOptions);
export const withDefaultOptions = options => {
const combinedOptions = _objectSpread({}, defaultOptions);
for (let key of Object.keys(options)) {
if (options[key] !== undefined) {
combinedOptions[key] = options[key];
}
}
return combinedOptions;
};
export function createCypherEditor(parentDOMElement, options = {}) {

@@ -141,3 +141,2 @@ const combinedOptions = withDefaultOptions(options);

history,
indentWithTab,
lineNumberFormatter,

@@ -150,2 +149,3 @@ lineNumbers,

readOnlyCursor,
tabKey,
tooltipAbsolute

@@ -282,4 +282,4 @@ } = combinedOptions;

const historyConf = new Compartment();
const indentWithTabConf = new Compartment();
const placeholderConf = new Compartment();
const tabKeyConf = new Compartment();
const themeConf = new Compartment();

@@ -293,2 +293,3 @@ const tooltipAbsoluteConf = new Compartment();

autocompleteConf,
tabKeyConf,
readableConf,

@@ -299,3 +300,2 @@ readOnlyConf,

historyConf,
indentWithTabConf,
placeholderConf,

@@ -578,7 +578,7 @@ themeConf,

};
const setIndentWithTab = (newIndentWithTab = defaultOptions.indentWithTab) => {
indentWithTab = newIndentWithTab;
const setTabKey = (newTabKey = defaultOptions.tabKey) => {
tabKey = newTabKey;
editor.dispatch({
effects: indentWithTabConf.reconfigure(getIndentWithTabExtensions({
indentWithTab
effects: tabKeyConf.reconfigure(getTabKeyExtensions({
tabKey
}))

@@ -600,3 +600,2 @@ });

setHistory,
setIndentWithTab,
setLineNumberFormatter,

@@ -611,2 +610,3 @@ setLineNumbers,

setSchema,
setTabKey,
setTheme,

@@ -613,0 +613,0 @@ setTooltipAbsolute,

@@ -45,3 +45,2 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

history: true,
indentWithTab: true,
lineNumberFormatter: defaultLineNumberFormatter,

@@ -57,2 +56,3 @@ lineNumbers: true,

schema: undefined,
tabKey: true,
theme: THEME_LIGHT,

@@ -64,3 +64,3 @@ tooltipAbsolute: false,

// "autofocus",
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", "tooltipAbsolute",
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "tabKey", "theme", "tooltipAbsolute",
// "parseOnSetValue",

@@ -67,0 +67,0 @@ "value"];

@@ -26,4 +26,4 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";

import { autocompletion as autocompletionExtension, completionKeymap } from "@codemirror/autocomplete";
import { history as historyExtension, defaultKeymap, historyKeymap, indentWithTab } from "@codemirror/commands";
import { autocompletion as autocompletionExtension, completionKeymap, completionStatus, acceptCompletion } from "@codemirror/autocomplete";
import { history as historyExtension, defaultKeymap, historyKeymap, indentMore, indentLess } from "@codemirror/commands";
import { StreamLanguage, indentOnInput, foldKeymap, syntaxHighlighting, HighlightStyle } from "@codemirror/language";

@@ -240,3 +240,22 @@ import { linter, lintKeymap } from "@codemirror/lint";

export const historyExtensions = [historyExtension()];
export const indentWithTabExtensions = [keymap.of([indentWithTab])];
const runTab = (view, event) => {
const status = completionStatus(view.state);
if (status === null) {
indentMore(view);
} else if (status === "active") {
acceptCompletion(view);
event && event.preventDefault();
}
};
const shiftTab = (view, event) => {
const status = completionStatus(view.state);
if (status === null) {
indentLess(view);
}
};
export const tabKeyExtensions = [keymap.of([{
key: "Tab",
run: runTab,
shift: shiftTab
}])];
export const readableExtensions = [drawSelectionExtension(), EditorState.allowMultipleSelections.of(true), indentOnInput(), rectangularSelectionExtension(), crosshairCursorExtension(), keymap.of([...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])];

@@ -257,2 +276,28 @@ export const readOnlyExtensions = [EditorState.readOnly.of(true)];

export const getAutocompleteExtensions = ({
readOnly,
autocomplete,
autocompleteCloseOnBlur
}) => readOnly === false && autocomplete ? !autocompleteCloseOnBlur ? useStickyAutocompleteExtensions : useAutocompleteExtensions : [];
export const getHistoryExtensions = ({
history
}) => history ? historyExtensions : [];
export const getLineNumbersExtensions = ({
lineNumbers,
lineNumberFormatter,
onLineNumberClick
}) => lineNumbers ? [cypherLineNumbers({
lineNumberFormatter,
onLineNumberClick
})] : [];
export const getLineWrappingExtensions = ({
lineWrapping
}) => lineWrapping ? lineWrappingExtensions : [];
export const getLintExtensions = ({
readOnly,
lint
}) => readOnly === false && lint ? useLintExtensions : useNoLintExtensions;
export const getPlaceholderExtensions = ({
placeholder
}) => placeholder !== undefined ? [placeholderExtension(placeholder)] : [];
export const getReadableExtensions = ({

@@ -266,5 +311,5 @@ readOnly,

}) => readOnly ? readOnlyCursor ? readOnlyExtensions : readOnlyNoCursorExtensions : [];
export const getPlaceholderExtensions = ({
placeholder
}) => placeholder !== undefined ? [placeholderExtension(placeholder)] : [];
export const getTabKeyExtensions = ({
tabKey
}) => tabKey ? tabKeyExtensions : [];
export const getThemeExtensions = ({

@@ -279,28 +324,2 @@ theme

position: "fixed"
})];
export const getLineNumbersExtensions = ({
lineNumbers,
lineNumberFormatter,
onLineNumberClick
}) => lineNumbers ? [cypherLineNumbers({
lineNumberFormatter,
onLineNumberClick
})] : [];
export const getAutocompleteExtensions = ({
readOnly,
autocomplete,
autocompleteCloseOnBlur
}) => readOnly === false && autocomplete ? !autocompleteCloseOnBlur ? useStickyAutocompleteExtensions : useAutocompleteExtensions : [];
export const getLineWrappingExtensions = ({
lineWrapping
}) => lineWrapping ? lineWrappingExtensions : [];
export const getHistoryExtensions = ({
history
}) => history ? historyExtensions : [];
export const getIndentWithTabExtensions = ({
indentWithTab
}) => indentWithTab ? indentWithTabExtensions : [];
export const getLintExtensions = ({
readOnly,
lint
}) => readOnly === false && lint ? useLintExtensions : useNoLintExtensions;
})];

@@ -8,5 +8,5 @@ "use strict";

var _exportNames = {
getExtensions: true,
getDefaultOptions: true,
withDefaultOptions: true,
getExtensions: true,
createCypherEditor: true

@@ -48,2 +48,14 @@ };

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
const getDefaultOptions = () => _objectSpread({}, defaultOptions);
exports.getDefaultOptions = getDefaultOptions;
const withDefaultOptions = options => {
const combinedOptions = _objectSpread({}, defaultOptions);
for (let key of Object.keys(options)) {
if (options[key] !== undefined) {
combinedOptions[key] = options[key];
}
}
return combinedOptions;
};
exports.withDefaultOptions = withDefaultOptions;
const getExtensions = (options = {}, {

@@ -57,4 +69,4 @@ lintConf = new _state.Compartment(),

historyConf = new _state.Compartment(),
indentWithTabConf = new _state.Compartment(),
placeholderConf = new _state.Compartment(),
tabKeyConf = new _state.Compartment(),
themeConf = new _state.Compartment(),

@@ -67,3 +79,3 @@ tooltipAbsoluteConf = new _state.Compartment(),

} = {}) => {
const combinedOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
const combinedOptions = withDefaultOptions(options);
const {

@@ -73,3 +85,3 @@ autocomplete,

history,
indentWithTab,
tabKey,
lineNumberFormatter,

@@ -104,4 +116,4 @@ lineNumbers,

history
})), indentWithTabConf.of((0, _cypherExtensions.getIndentWithTabExtensions)({
indentWithTab
})), tabKeyConf.of((0, _cypherExtensions.getTabKeyExtensions)({
tabKey
})), readableConf.of((0, _cypherExtensions.getReadableExtensions)({

@@ -126,14 +138,2 @@ readOnly,

});
const getDefaultOptions = () => _objectSpread({}, defaultOptions);
exports.getDefaultOptions = getDefaultOptions;
const withDefaultOptions = options => {
const combinedOptions = _objectSpread({}, defaultOptions);
for (let key of Object.keys(options)) {
if (options[key] !== undefined) {
combinedOptions[key] = options[key];
}
}
return combinedOptions;
};
exports.withDefaultOptions = withDefaultOptions;
function createCypherEditor(parentDOMElement, options = {}) {

@@ -156,3 +156,2 @@ const combinedOptions = withDefaultOptions(options);

history,
indentWithTab,
lineNumberFormatter,

@@ -165,2 +164,3 @@ lineNumbers,

readOnlyCursor,
tabKey,
tooltipAbsolute

@@ -297,4 +297,4 @@ } = combinedOptions;

const historyConf = new _state.Compartment();
const indentWithTabConf = new _state.Compartment();
const placeholderConf = new _state.Compartment();
const tabKeyConf = new _state.Compartment();
const themeConf = new _state.Compartment();

@@ -308,2 +308,3 @@ const tooltipAbsoluteConf = new _state.Compartment();

autocompleteConf,
tabKeyConf,
readableConf,

@@ -314,3 +315,2 @@ readOnlyConf,

historyConf,
indentWithTabConf,
placeholderConf,

@@ -593,7 +593,7 @@ themeConf,

};
const setIndentWithTab = (newIndentWithTab = defaultOptions.indentWithTab) => {
indentWithTab = newIndentWithTab;
const setTabKey = (newTabKey = defaultOptions.tabKey) => {
tabKey = newTabKey;
editor.dispatch({
effects: indentWithTabConf.reconfigure((0, _cypherExtensions.getIndentWithTabExtensions)({
indentWithTab
effects: tabKeyConf.reconfigure((0, _cypherExtensions.getTabKeyExtensions)({
tabKey
}))

@@ -615,3 +615,2 @@ });

setHistory,
setIndentWithTab,
setLineNumberFormatter,

@@ -626,2 +625,3 @@ setLineNumbers,

setSchema,
setTabKey,
setTheme,

@@ -628,0 +628,0 @@ setTooltipAbsolute,

@@ -56,3 +56,2 @@ "use strict";

history: true,
indentWithTab: true,
lineNumberFormatter: defaultLineNumberFormatter,

@@ -68,2 +67,3 @@ lineNumbers: true,

schema: undefined,
tabKey: true,
theme: THEME_LIGHT,

@@ -76,3 +76,3 @@ tooltipAbsolute: false,

// "autofocus",
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", "tooltipAbsolute",
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "tabKey", "theme", "tooltipAbsolute",
// "parseOnSetValue",

@@ -79,0 +79,0 @@ "value"];

@@ -7,3 +7,3 @@ "use strict";

});
exports.useStickyAutocompleteExtensions = exports.useNoLintExtensions = exports.useLintExtensions = exports.useAutocompleteExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.indentWithTabExtensions = exports.historyExtensions = exports.getTooltipAbsoluteExtensions = exports.getThemeExtensions = exports.getReadableExtensions = exports.getReadOnlyExtensions = exports.getPlaceholderExtensions = exports.getLintExtensions = exports.getLineWrappingExtensions = exports.getLineNumbersExtensions = exports.getIndentWithTabExtensions = exports.getHistoryExtensions = exports.getAutocompleteExtensions = exports.fixColors = exports.domListener = exports.cypherLinter = exports.cypherLineNumbers = exports.cypherLanguage = exports.cypherCompletion = void 0;
exports.useStickyAutocompleteExtensions = exports.useNoLintExtensions = exports.useLintExtensions = exports.useAutocompleteExtensions = exports.tabKeyExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.historyExtensions = exports.getTooltipAbsoluteExtensions = exports.getThemeExtensions = exports.getTabKeyExtensions = exports.getReadableExtensions = exports.getReadOnlyExtensions = exports.getPlaceholderExtensions = exports.getLintExtensions = exports.getLineWrappingExtensions = exports.getLineNumbersExtensions = exports.getHistoryExtensions = exports.getAutocompleteExtensions = exports.fixColors = exports.domListener = exports.cypherLinter = exports.cypherLineNumbers = exports.cypherLanguage = exports.cypherCompletion = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

@@ -234,4 +234,23 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

exports.historyExtensions = historyExtensions;
const indentWithTabExtensions = [_view.keymap.of([_commands.indentWithTab])];
exports.indentWithTabExtensions = indentWithTabExtensions;
const runTab = (view, event) => {
const status = (0, _autocomplete.completionStatus)(view.state);
if (status === null) {
(0, _commands.indentMore)(view);
} else if (status === "active") {
(0, _autocomplete.acceptCompletion)(view);
event && event.preventDefault();
}
};
const shiftTab = (view, event) => {
const status = (0, _autocomplete.completionStatus)(view.state);
if (status === null) {
(0, _commands.indentLess)(view);
}
};
const tabKeyExtensions = [_view.keymap.of([{
key: "Tab",
run: runTab,
shift: shiftTab
}])];
exports.tabKeyExtensions = tabKeyExtensions;
const readableExtensions = [(0, _view.drawSelection)(), _state.EditorState.allowMultipleSelections.of(true), (0, _language.indentOnInput)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), _view.keymap.of([..._commands.defaultKeymap, ..._search.searchKeymap, ..._commands.historyKeymap, ..._language.foldKeymap, ..._autocomplete.completionKeymap, ..._lint.lintKeymap])];

@@ -259,2 +278,34 @@ exports.readableExtensions = readableExtensions;

exports.useStickyAutocompleteExtensions = useStickyAutocompleteExtensions;
const getAutocompleteExtensions = ({
readOnly,
autocomplete,
autocompleteCloseOnBlur
}) => readOnly === false && autocomplete ? !autocompleteCloseOnBlur ? useStickyAutocompleteExtensions : useAutocompleteExtensions : [];
exports.getAutocompleteExtensions = getAutocompleteExtensions;
const getHistoryExtensions = ({
history
}) => history ? historyExtensions : [];
exports.getHistoryExtensions = getHistoryExtensions;
const getLineNumbersExtensions = ({
lineNumbers,
lineNumberFormatter,
onLineNumberClick
}) => lineNumbers ? [cypherLineNumbers({
lineNumberFormatter,
onLineNumberClick
})] : [];
exports.getLineNumbersExtensions = getLineNumbersExtensions;
const getLineWrappingExtensions = ({
lineWrapping
}) => lineWrapping ? lineWrappingExtensions : [];
exports.getLineWrappingExtensions = getLineWrappingExtensions;
const getLintExtensions = ({
readOnly,
lint
}) => readOnly === false && lint ? useLintExtensions : useNoLintExtensions;
exports.getLintExtensions = getLintExtensions;
const getPlaceholderExtensions = ({
placeholder
}) => placeholder !== undefined ? [(0, _view.placeholder)(placeholder)] : [];
exports.getPlaceholderExtensions = getPlaceholderExtensions;
const getReadableExtensions = ({

@@ -270,6 +321,6 @@ readOnly,

exports.getReadOnlyExtensions = getReadOnlyExtensions;
const getPlaceholderExtensions = ({
placeholder
}) => placeholder !== undefined ? [(0, _view.placeholder)(placeholder)] : [];
exports.getPlaceholderExtensions = getPlaceholderExtensions;
const getTabKeyExtensions = ({
tabKey
}) => tabKey ? tabKeyExtensions : [];
exports.getTabKeyExtensions = getTabKeyExtensions;
const getThemeExtensions = ({

@@ -286,34 +337,2 @@ theme

})];
exports.getTooltipAbsoluteExtensions = getTooltipAbsoluteExtensions;
const getLineNumbersExtensions = ({
lineNumbers,
lineNumberFormatter,
onLineNumberClick
}) => lineNumbers ? [cypherLineNumbers({
lineNumberFormatter,
onLineNumberClick
})] : [];
exports.getLineNumbersExtensions = getLineNumbersExtensions;
const getAutocompleteExtensions = ({
readOnly,
autocomplete,
autocompleteCloseOnBlur
}) => readOnly === false && autocomplete ? !autocompleteCloseOnBlur ? useStickyAutocompleteExtensions : useAutocompleteExtensions : [];
exports.getAutocompleteExtensions = getAutocompleteExtensions;
const getLineWrappingExtensions = ({
lineWrapping
}) => lineWrapping ? lineWrappingExtensions : [];
exports.getLineWrappingExtensions = getLineWrappingExtensions;
const getHistoryExtensions = ({
history
}) => history ? historyExtensions : [];
exports.getHistoryExtensions = getHistoryExtensions;
const getIndentWithTabExtensions = ({
indentWithTab
}) => indentWithTab ? indentWithTabExtensions : [];
exports.getIndentWithTabExtensions = getIndentWithTabExtensions;
const getLintExtensions = ({
readOnly,
lint
}) => readOnly === false && lint ? useLintExtensions : useNoLintExtensions;
exports.getLintExtensions = getLintExtensions;
exports.getTooltipAbsoluteExtensions = getTooltipAbsoluteExtensions;

@@ -9,3 +9,3 @@ {

],
"version": "1.0.0-next.8",
"version": "1.0.0-next.9",
"author": "Neo4j Inc.",

@@ -12,0 +12,0 @@ "license": "GPL-3.0",

@@ -269,6 +269,2 @@ /**

/**
* Set whether pressing the tab key affects editor indentation
*/
setIndentWithTab(indentWithTab?: boolean): void;
/**
* Set the formatter for the line numbers of the editor

@@ -312,2 +308,6 @@ */

/**
* Set whether the tab key is enabled
*/
setTabKey(tabKey?: boolean): void;
/**
* Set whether to use the light or dark theme for the editor

@@ -460,8 +460,2 @@ */

/**
* Whether pressing the tab key affects editor indentation
*
* @defaultValue true
*/
indentWithTab?: boolean;
/**
* The formatter for the line numbers of the editor

@@ -527,2 +521,8 @@ *

/**
* Whether the tab key is enabled
*
* @defaultValue true
*/
tabKey?: boolean;
/**
* Whether to use the light or dark theme for the editor

@@ -529,0 +529,0 @@ *

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc