@neo4j-cypher/codemirror
Advanced tools
Comparing version 1.0.0-next.7 to 1.0.0-next.8
@@ -33,3 +33,3 @@ 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, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getIndentWithTabExtensions, getLintExtensions } from "./cypher-extensions"; | ||
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getThemeExtensions, getTooltipAbsoluteExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getIndentWithTabExtensions, getLintExtensions } from "./cypher-extensions"; | ||
export * from "./cypher-codemirror-base"; | ||
@@ -48,2 +48,3 @@ export * from "./cypher-extensions"; | ||
themeConf = new Compartment(), | ||
tooltipAbsoluteConf = new Compartment(), | ||
onLineNumberClick = () => {}, | ||
@@ -67,3 +68,4 @@ onFocusChanged = () => {}, | ||
readOnlyCursor, | ||
theme | ||
theme, | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
@@ -98,2 +100,4 @@ return [domListener({ | ||
theme | ||
})), tooltipAbsoluteConf.of(getTooltipAbsoluteExtensions({ | ||
tooltipAbsolute | ||
})), readOnlyConf.of(getReadOnlyExtensions({ | ||
@@ -134,2 +138,4 @@ readOnly, | ||
autocompleteTriggerStrings, | ||
history, | ||
indentWithTab, | ||
lineNumberFormatter, | ||
@@ -142,4 +148,3 @@ lineNumbers, | ||
readOnlyCursor, | ||
history, | ||
indentWithTab | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
@@ -278,2 +283,3 @@ const { | ||
const themeConf = new Compartment(); | ||
const tooltipAbsoluteConf = new Compartment(); | ||
const postConf = new Compartment(); | ||
@@ -293,2 +299,3 @@ const initialState = EditorState.create({ | ||
themeConf, | ||
tooltipAbsoluteConf, | ||
postConf, | ||
@@ -547,2 +554,10 @@ onLineNumberClick: lineNumberClick, | ||
}; | ||
const setTooltipAbsolute = (newTooltipAbsolute = defaultOptions.tooltipAbsolute) => { | ||
tooltipAbsolute = newTooltipAbsolute; | ||
editor.dispatch({ | ||
effects: tooltipAbsoluteConf.reconfigure(getTooltipAbsoluteExtensions({ | ||
tooltipAbsolute | ||
})) | ||
}); | ||
}; | ||
const focus = () => { | ||
@@ -593,2 +608,3 @@ editor && editor.focus(); | ||
setTheme, | ||
setTooltipAbsolute, | ||
setValue, | ||
@@ -595,0 +611,0 @@ onAutocompleteChanged, |
@@ -57,2 +57,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
theme: THEME_LIGHT, | ||
tooltipAbsolute: false, | ||
value: "" | ||
@@ -62,3 +63,3 @@ }; | ||
// "autofocus", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", "tooltipAbsolute", | ||
// "parseOnSetValue", | ||
@@ -65,0 +66,0 @@ "value"]; |
@@ -32,3 +32,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import { EditorState, StateEffect } from "@codemirror/state"; | ||
import { EditorView, lineNumbers as lineNumbersExtension, drawSelection as drawSelectionExtension, rectangularSelection as rectangularSelectionExtension, crosshairCursor as crosshairCursorExtension, keymap, placeholder as placeholderExtension } from "@codemirror/view"; | ||
import { EditorView, lineNumbers as lineNumbersExtension, drawSelection as drawSelectionExtension, rectangularSelection as rectangularSelectionExtension, crosshairCursor as crosshairCursorExtension, keymap, placeholder as placeholderExtension, tooltips } from "@codemirror/view"; | ||
import { tags } from "@lezer/highlight"; | ||
@@ -270,2 +270,9 @@ import { TreeUtils } from "@neo4j-cypher/editor-support"; | ||
}) => theme === THEME_DARK ? darkExtensions : lightExtensions; | ||
export const getTooltipAbsoluteExtensions = ({ | ||
tooltipAbsolute | ||
}) => tooltipAbsolute ? [tooltips({ | ||
position: "absolute" | ||
})] : [tooltips({ | ||
position: "fixed" | ||
})]; | ||
export const getLineNumbersExtensions = ({ | ||
@@ -272,0 +279,0 @@ lineNumbers, |
@@ -58,2 +58,3 @@ "use strict"; | ||
themeConf = new _state.Compartment(), | ||
tooltipAbsoluteConf = new _state.Compartment(), | ||
onLineNumberClick = () => {}, | ||
@@ -77,3 +78,4 @@ onFocusChanged = () => {}, | ||
readOnlyCursor, | ||
theme | ||
theme, | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
@@ -108,2 +110,4 @@ return [(0, _cypherExtensions.domListener)({ | ||
theme | ||
})), tooltipAbsoluteConf.of((0, _cypherExtensions.getTooltipAbsoluteExtensions)({ | ||
tooltipAbsolute | ||
})), readOnlyConf.of((0, _cypherExtensions.getReadOnlyExtensions)({ | ||
@@ -147,2 +151,4 @@ readOnly, | ||
autocompleteTriggerStrings, | ||
history, | ||
indentWithTab, | ||
lineNumberFormatter, | ||
@@ -155,4 +161,3 @@ lineNumbers, | ||
readOnlyCursor, | ||
history, | ||
indentWithTab | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
@@ -291,2 +296,3 @@ const { | ||
const themeConf = new _state.Compartment(); | ||
const tooltipAbsoluteConf = new _state.Compartment(); | ||
const postConf = new _state.Compartment(); | ||
@@ -306,2 +312,3 @@ const initialState = _state.EditorState.create({ | ||
themeConf, | ||
tooltipAbsoluteConf, | ||
postConf, | ||
@@ -560,2 +567,10 @@ onLineNumberClick: lineNumberClick, | ||
}; | ||
const setTooltipAbsolute = (newTooltipAbsolute = defaultOptions.tooltipAbsolute) => { | ||
tooltipAbsolute = newTooltipAbsolute; | ||
editor.dispatch({ | ||
effects: tooltipAbsoluteConf.reconfigure((0, _cypherExtensions.getTooltipAbsoluteExtensions)({ | ||
tooltipAbsolute | ||
})) | ||
}); | ||
}; | ||
const focus = () => { | ||
@@ -606,2 +621,3 @@ editor && editor.focus(); | ||
setTheme, | ||
setTooltipAbsolute, | ||
setValue, | ||
@@ -608,0 +624,0 @@ onAutocompleteChanged, |
@@ -68,2 +68,3 @@ "use strict"; | ||
theme: THEME_LIGHT, | ||
tooltipAbsolute: false, | ||
value: "" | ||
@@ -74,3 +75,3 @@ }; | ||
// "autofocus", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", "tooltipAbsolute", | ||
// "parseOnSetValue", | ||
@@ -77,0 +78,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.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.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; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -276,2 +276,10 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
exports.getThemeExtensions = getThemeExtensions; | ||
const getTooltipAbsoluteExtensions = ({ | ||
tooltipAbsolute | ||
}) => tooltipAbsolute ? [(0, _view.tooltips)({ | ||
position: "absolute" | ||
})] : [(0, _view.tooltips)({ | ||
position: "fixed" | ||
})]; | ||
exports.getTooltipAbsoluteExtensions = getTooltipAbsoluteExtensions; | ||
const getLineNumbersExtensions = ({ | ||
@@ -278,0 +286,0 @@ lineNumbers, |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.0-next.7", | ||
"version": "1.0.0-next.8", | ||
"author": "Neo4j Inc.", | ||
@@ -12,0 +12,0 @@ "license": "GPL-3.0", |
@@ -251,23 +251,23 @@ /** | ||
*/ | ||
setAutocomplete(autocomplete: boolean): void; | ||
setAutocomplete(autocomplete?: boolean): void; | ||
/** | ||
* Set whether or not the autocomplete auto closes whenever the editor loses focus | ||
*/ | ||
setAutocompleteCloseOnBlur(autocompleteCloseOnBlur: boolean): void; | ||
setAutocompleteCloseOnBlur(autocompleteCloseOnBlur?: boolean): void; | ||
/** | ||
* Set whether or not the autocomplete menu is shown to the user | ||
*/ | ||
setAutocompleteOpen(autocompleteOpen: boolean): void; | ||
setAutocompleteOpen(autocompleteOpen?: boolean): void; | ||
/** | ||
* Set the keys that when typed will automatically open the autocomplete menu | ||
*/ | ||
setAutocompleteTriggerStrings(autocompleteTriggerStrings: string[]): void; | ||
setAutocompleteTriggerStrings(autocompleteTriggerStrings?: string[]): void; | ||
/** | ||
* Set whether or not the editor maintains an undo/redo history | ||
*/ | ||
setHistory(history: boolean): void; | ||
setHistory(history?: boolean): void; | ||
/** | ||
* Set whether pressing the tab key affects editor indentation | ||
*/ | ||
setIndentWithTab(indentWithTab: boolean): void; | ||
setIndentWithTab(indentWithTab?: boolean): void; | ||
/** | ||
@@ -277,3 +277,3 @@ * Set the formatter for the line numbers of the editor | ||
setLineNumberFormatter( | ||
lineNumberFormatter: (lineNumber: number, lineCount: number) => string | ||
lineNumberFormatter?: (lineNumber: number, lineCount: number) => string | ||
): void; | ||
@@ -283,36 +283,40 @@ /** | ||
*/ | ||
setLineNumbers(lineNumbers: boolean): void; | ||
setLineNumbers(lineNumbers?: boolean): void; | ||
/** | ||
* Set whether or not the editor wraps lines vs using a horizontal scrollbar | ||
*/ | ||
setLineWrapping(lineWrapping: boolean): void; | ||
setLineWrapping(lineWrapping?: boolean): void; | ||
/** | ||
* Set whether or not the editor should display lint errors to the user | ||
*/ | ||
setLint(lint: boolean): void; | ||
setLint(lint?: boolean): void; | ||
/** | ||
* Set the text to be shown to the user when the editor value is empty | ||
*/ | ||
setPlaceholder(placeholder: string | undefined): void; | ||
setPlaceholder(placeholder?: string | undefined): void; | ||
/** | ||
* Set the current editor cursor position | ||
*/ | ||
setPosition(position: PositionAny): void; | ||
setPosition(position?: PositionAny): void; | ||
/** | ||
* Set whether the editor is read only or the user can edit the editor's value | ||
*/ | ||
setReadOnly(readOnly: boolean): void; | ||
setReadOnly(readOnly?: boolean): void; | ||
/** | ||
* Set whether to show the cursor when the editor readOnly is true | ||
*/ | ||
setReadOnlyCursor(readOnlyCursor: boolean): void; | ||
setReadOnlyCursor(readOnlyCursor?: boolean): void; | ||
/** | ||
* Set the schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database | ||
*/ | ||
setSchema(schema: EditorSupportSchema): void; | ||
setSchema(schema?: EditorSupportSchema): void; | ||
/** | ||
* Set whether to use the light or dark theme for the editor | ||
*/ | ||
setTheme(theme: Theme): void; | ||
setTheme(theme?: Theme): void; | ||
/** | ||
* Set whether or not the tooltips use simple absolute position styling (vs fixed and trying to stay within bounds) | ||
*/ | ||
setTooltipAbsolute(tooltipAbsolute?: boolean): void; | ||
/** | ||
* Set the editor value | ||
@@ -323,3 +327,3 @@ * | ||
*/ | ||
setValue(value: string, parseOnSetValue?: boolean): void; | ||
setValue(value?: string, parseOnSetValue?: boolean): void; | ||
@@ -530,2 +534,8 @@ /** | ||
/** | ||
* Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds) | ||
* | ||
* @defaultValue false | ||
*/ | ||
tooltipAbsolute?: boolean; | ||
/** | ||
* The initial editor value | ||
@@ -532,0 +542,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145176
3562