@aquera/nile-elements 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.css.js +18 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.d.ts +35 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.js +61 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb/nile-breadcrumb.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.js +47 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.d.ts +34 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.js +74 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.css.js +71 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.d.ts +26 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.js +46 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-card/nile-card.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.d.ts +33 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.js +63 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.d.ts +12 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js +42 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.d.ts +43 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js +114 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/arrowright.d.ts +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/arrowright.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/arrowright.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon-button/nile-icon-button.d.ts +2 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon-button/nile-icon-button.js +9 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon-button/nile-icon-button.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +11 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +11 -5
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +55 -7
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tag/nile-tag.css.js +7 -15
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tag/nile-tag.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tag/nile-tag.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tag/nile-tag.js +21 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tag/nile-tag.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-toast/nile-toast.css.js +4 -4
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-toast/nile-toast.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tooltip/nile-tooltip.css.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tooltip/nile-tooltip.js +2 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tooltip/nile-tooltip.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +545 -374
- package/dist/nile-breadcrumb/index.cjs.js +2 -0
- package/dist/nile-breadcrumb/index.cjs.js.map +1 -0
- package/dist/nile-breadcrumb/index.esm.js +1 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.cjs.js +2 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.cjs.js.map +1 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.css.cjs.js +2 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.css.cjs.js.map +1 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.css.esm.js +6 -0
- package/dist/nile-breadcrumb/nile-breadcrumb.esm.js +6 -0
- package/dist/nile-breadcrumb-item/index.cjs.js +2 -0
- package/dist/nile-breadcrumb-item/index.cjs.js.map +1 -0
- package/dist/nile-breadcrumb-item/index.esm.js +1 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.cjs.js +2 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.cjs.js.map +1 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.css.cjs.js +2 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.css.cjs.js.map +1 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.css.esm.js +35 -0
- package/dist/nile-breadcrumb-item/nile-breadcrumb-item.esm.js +13 -0
- package/dist/nile-card/index.cjs.js +2 -0
- package/dist/nile-card/index.cjs.js.map +1 -0
- package/dist/nile-card/index.esm.js +1 -0
- package/dist/nile-card/nile-card.cjs.js +2 -0
- package/dist/nile-card/nile-card.cjs.js.map +1 -0
- package/dist/nile-card/nile-card.css.cjs.js +2 -0
- package/dist/nile-card/nile-card.css.cjs.js.map +1 -0
- package/dist/nile-card/nile-card.css.esm.js +59 -0
- package/dist/nile-card/nile-card.esm.js +9 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js +7 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -0
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -0
- package/dist/nile-code-editor/index.cjs.js +2 -0
- package/dist/nile-code-editor/index.cjs.js.map +1 -0
- package/dist/nile-code-editor/index.esm.js +1 -0
- package/dist/nile-code-editor/nile-code-editor.cjs.js +3 -0
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -0
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +2 -0
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -0
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +30 -0
- package/dist/nile-code-editor/nile-code-editor.esm.js +9 -0
- package/dist/nile-icon/icons/svg/arrowright.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/arrowright.cjs.js.map +1 -1
- package/dist/nile-icon/icons/svg/arrowright.esm.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
- package/dist/nile-icon-button/nile-icon-button.esm.js +4 -3
- package/dist/nile-switcher/index.cjs.js +1 -1
- package/dist/nile-switcher/index.esm.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.esm.js +13 -2
- package/dist/nile-switcher/nile-switcher.esm.js +38 -30
- package/dist/nile-tag/nile-tag.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.css.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.css.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.css.esm.js +9 -17
- package/dist/nile-tag/nile-tag.esm.js +3 -3
- package/dist/nile-toast/nile-toast.css.cjs.js +1 -1
- package/dist/nile-toast/nile-toast.css.cjs.js.map +1 -1
- package/dist/nile-toast/nile-toast.css.esm.js +4 -4
- package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.cjs.js.map +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
- package/dist/nile-tooltip/nile-tooltip.css.esm.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.esm.js +2 -2
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-breadcrumb/index.d.ts +1 -0
- package/dist/src/nile-breadcrumb/index.js +2 -0
- package/dist/src/nile-breadcrumb/index.js.map +1 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.css.d.ts +12 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.css.js +18 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.css.js.map +1 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.d.ts +35 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.js +61 -0
- package/dist/src/nile-breadcrumb/nile-breadcrumb.js.map +1 -0
- package/dist/src/nile-breadcrumb-item/index.d.ts +1 -0
- package/dist/src/nile-breadcrumb-item/index.js +2 -0
- package/dist/src/nile-breadcrumb-item/index.js.map +1 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.d.ts +12 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.js +47 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.css.js.map +1 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.d.ts +34 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.js +74 -0
- package/dist/src/nile-breadcrumb-item/nile-breadcrumb-item.js.map +1 -0
- package/dist/src/nile-card/index.d.ts +1 -0
- package/dist/src/nile-card/index.js +2 -0
- package/dist/src/nile-card/index.js.map +1 -0
- package/dist/src/nile-card/nile-card.css.d.ts +12 -0
- package/dist/src/nile-card/nile-card.css.js +71 -0
- package/dist/src/nile-card/nile-card.css.js.map +1 -0
- package/dist/src/nile-card/nile-card.d.ts +26 -0
- package/dist/src/nile-card/nile-card.js +46 -0
- package/dist/src/nile-card/nile-card.js.map +1 -0
- package/dist/src/nile-code-editor/extensionSetup.d.ts +33 -0
- package/dist/src/nile-code-editor/extensionSetup.js +63 -0
- package/dist/src/nile-code-editor/extensionSetup.js.map +1 -0
- package/dist/src/nile-code-editor/index.d.ts +1 -0
- package/dist/src/nile-code-editor/index.js +2 -0
- package/dist/src/nile-code-editor/index.js.map +1 -0
- package/dist/src/nile-code-editor/nile-code-editor.css.d.ts +12 -0
- package/dist/src/nile-code-editor/nile-code-editor.css.js +42 -0
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -0
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +43 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +114 -0
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/arrowright.d.ts +1 -1
- package/dist/src/nile-icon/icons/svg/arrowright.js +1 -1
- package/dist/src/nile-icon/icons/svg/arrowright.js.map +1 -1
- package/dist/src/nile-icon-button/nile-icon-button.d.ts +2 -1
- package/dist/src/nile-icon-button/nile-icon-button.js +9 -6
- package/dist/src/nile-icon-button/nile-icon-button.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +11 -0
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +11 -5
- package/dist/src/nile-switcher/nile-switcher.js +55 -7
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/src/nile-tag/nile-tag.css.js +7 -15
- package/dist/src/nile-tag/nile-tag.css.js.map +1 -1
- package/dist/src/nile-tag/nile-tag.d.ts +1 -0
- package/dist/src/nile-tag/nile-tag.js +21 -2
- package/dist/src/nile-tag/nile-tag.js.map +1 -1
- package/dist/src/nile-toast/nile-toast.css.js +4 -4
- package/dist/src/nile-toast/nile-toast.css.js.map +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
- package/dist/src/nile-tooltip/nile-tooltip.js +2 -2
- package/dist/src/nile-tooltip/nile-tooltip.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/nile-breadcrumb/index.ts +1 -0
- package/src/nile-breadcrumb/nile-breadcrumb.css.ts +20 -0
- package/src/nile-breadcrumb/nile-breadcrumb.ts +78 -0
- package/src/nile-breadcrumb-item/index.ts +1 -0
- package/src/nile-breadcrumb-item/nile-breadcrumb-item.css.ts +49 -0
- package/src/nile-breadcrumb-item/nile-breadcrumb-item.ts +83 -0
- package/src/nile-card/index.ts +1 -0
- package/src/nile-card/nile-card.css.ts +73 -0
- package/src/nile-card/nile-card.ts +53 -0
- package/src/nile-code-editor/extensionSetup.ts +125 -0
- package/src/nile-code-editor/index.ts +1 -0
- package/src/nile-code-editor/nile-code-editor.css.ts +44 -0
- package/src/nile-code-editor/nile-code-editor.ts +127 -0
- package/src/nile-icon/icons/svg/arrowright.ts +1 -1
- package/src/nile-icon-button/nile-icon-button.ts +9 -6
- package/src/nile-switcher/nile-switcher.css.ts +11 -0
- package/src/nile-switcher/nile-switcher.ts +70 -10
- package/src/nile-tag/nile-tag.css.ts +7 -15
- package/src/nile-tag/nile-tag.ts +24 -2
- package/src/nile-toast/nile-toast.css.ts +4 -4
- package/src/nile-tooltip/nile-tooltip.css.ts +1 -1
- package/src/nile-tooltip/nile-tooltip.ts +2 -2
@@ -0,0 +1,63 @@
|
|
1
|
+
import { lineNumbers, highlightActiveLineGutter, highlightSpecialChars, drawSelection, dropCursor, rectangularSelection, crosshairCursor, highlightActiveLine, keymap, } from '@codemirror/view';
|
2
|
+
import { EditorState } from '@codemirror/state';
|
3
|
+
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
4
|
+
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
|
5
|
+
import { closeBrackets, autocompletion, closeBracketsKeymap, } from '@codemirror/autocomplete';
|
6
|
+
import { foldGutter, indentOnInput, syntaxHighlighting, defaultHighlightStyle, bracketMatching, indentUnit, foldKeymap, } from '@codemirror/language';
|
7
|
+
import { lintKeymap } from '@codemirror/lint';
|
8
|
+
export const isValidSetup = (item) => {
|
9
|
+
return typeof item === 'undefined' || item;
|
10
|
+
};
|
11
|
+
export const basicSetup = (options = {}) => {
|
12
|
+
const { crosshairCursor: initCrosshairCursor = false } = options;
|
13
|
+
let keymaps = [];
|
14
|
+
isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);
|
15
|
+
isValidSetup(options.closeBracketsKeymap) &&
|
16
|
+
keymaps.push(...closeBracketsKeymap);
|
17
|
+
isValidSetup(options.searchKeymap) && keymaps.push(...searchKeymap);
|
18
|
+
isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);
|
19
|
+
isValidSetup(options.foldKeymap) && keymaps.push(...foldKeymap);
|
20
|
+
isValidSetup(options.lintKeymap) && keymaps.push(...lintKeymap);
|
21
|
+
const extensions = [];
|
22
|
+
isValidSetup(options.lineNumbers) && extensions.push(lineNumbers());
|
23
|
+
isValidSetup(options.highlightActiveLineGutter) &&
|
24
|
+
extensions.push(highlightActiveLineGutter());
|
25
|
+
isValidSetup(options.highlightSpecialChars) &&
|
26
|
+
extensions.push(highlightSpecialChars());
|
27
|
+
isValidSetup(options.history) && extensions.push(history());
|
28
|
+
isValidSetup(options.foldGutter) && extensions.push(foldGutter());
|
29
|
+
isValidSetup(options.drawSelection) && extensions.push(drawSelection());
|
30
|
+
isValidSetup(options.dropCursor) && extensions.push(dropCursor());
|
31
|
+
isValidSetup(options.allowMultipleSelections) &&
|
32
|
+
extensions.push(EditorState.allowMultipleSelections.of(true));
|
33
|
+
isValidSetup(options.indentOnInput) && extensions.push(indentOnInput());
|
34
|
+
isValidSetup(options.syntaxHighlighting) &&
|
35
|
+
extensions.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true }));
|
36
|
+
isValidSetup(options.bracketMatching) && extensions.push(bracketMatching());
|
37
|
+
isValidSetup(options.closeBrackets) && extensions.push(closeBrackets());
|
38
|
+
isValidSetup(options.autocompletion) && extensions.push(autocompletion());
|
39
|
+
isValidSetup(options.rectangularSelection) &&
|
40
|
+
extensions.push(rectangularSelection());
|
41
|
+
isValidSetup(options.crosshairCursor) && extensions.push(crosshairCursor());
|
42
|
+
isValidSetup(options.highlightActiveLine) &&
|
43
|
+
extensions.push(highlightActiveLine());
|
44
|
+
isValidSetup(options.highlightSelectionMatches) &&
|
45
|
+
extensions.push(highlightSelectionMatches());
|
46
|
+
if (options.tabSize && typeof options.tabSize === 'number')
|
47
|
+
extensions.push(indentUnit.of(' '.repeat(options.tabSize)));
|
48
|
+
return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);
|
49
|
+
};
|
50
|
+
export const minimalSetup = (options = {}) => {
|
51
|
+
let keymaps = [];
|
52
|
+
isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);
|
53
|
+
isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);
|
54
|
+
const extensions = [];
|
55
|
+
isValidSetup(options.highlightSpecialChars) &&
|
56
|
+
extensions.push(highlightSpecialChars());
|
57
|
+
isValidSetup(options.history) && extensions.push(history());
|
58
|
+
isValidSetup(options.drawSelection) && extensions.push(drawSelection());
|
59
|
+
isValidSetup(options.syntaxHighlighting) &&
|
60
|
+
extensions.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true }));
|
61
|
+
return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);
|
62
|
+
};
|
63
|
+
//# sourceMappingURL=extensionSetup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extensionSetup.js","sourceRoot":"","sources":["../../../src/nile-code-editor/extensionSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,cAAc,EACd,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwB9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAS,EAAE,EAAE;IACxC,OAAO,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAA6B,EAAE,EAAe,EAAE;IACzE,MAAM,EAAE,eAAe,EAAE,mBAAmB,G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CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC,CAAC","sourcesContent":["import {\n KeyBinding,\n lineNumbers,\n highlightActiveLineGutter,\n highlightSpecialChars,\n drawSelection,\n dropCursor,\n rectangularSelection,\n crosshairCursor,\n highlightActiveLine,\n keymap,\n} from '@codemirror/view';\nimport { EditorState, Extension } from '@codemirror/state';\nimport { history, defaultKeymap, historyKeymap } from '@codemirror/commands';\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search';\nimport {\n closeBrackets,\n autocompletion,\n closeBracketsKeymap,\n completionKeymap,\n} from '@codemirror/autocomplete';\nimport {\n foldGutter,\n indentOnInput,\n syntaxHighlighting,\n defaultHighlightStyle,\n bracketMatching,\n indentUnit,\n foldKeymap,\n} from '@codemirror/language';\n\nimport { lintKeymap } from '@codemirror/lint';\n\nexport interface BasicSetupOptions extends MinimalSetupOptions {\n lineNumbers?: boolean;\n highlightActiveLineGutter?: boolean;\n foldGutter?: boolean;\n dropCursor?: boolean;\n allowMultipleSelections?: boolean;\n indentOnInput?: boolean;\n bracketMatching?: boolean;\n closeBrackets?: boolean;\n autocompletion?: boolean;\n rectangularSelection?: boolean;\n crosshairCursor?: boolean;\n highlightActiveLine?: boolean;\n highlightSelectionMatches?: boolean;\n closeBracketsKeymap?: boolean;\n searchKeymap?: boolean;\n foldKeymap?: boolean;\n completionKeymap?: boolean;\n lintKeymap?: boolean;\n tabSize?: number;\n}\n\nexport const isValidSetup = (item: any) => {\n return typeof item === 'undefined' || item;\n};\n\nexport const basicSetup = (options: BasicSetupOptions = {}): Extension[] => {\n const { crosshairCursor: initCrosshairCursor = false } = options;\n let keymaps: KeyBinding[] = [];\n isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);\n isValidSetup(options.closeBracketsKeymap) &&\n keymaps.push(...closeBracketsKeymap);\n isValidSetup(options.searchKeymap) && keymaps.push(...searchKeymap);\n isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);\n isValidSetup(options.foldKeymap) && keymaps.push(...foldKeymap);\n isValidSetup(options.lintKeymap) && keymaps.push(...lintKeymap);\n const extensions: Extension[] = [];\n isValidSetup(options.lineNumbers) && extensions.push(lineNumbers());\n isValidSetup(options.highlightActiveLineGutter) &&\n extensions.push(highlightActiveLineGutter());\n isValidSetup(options.highlightSpecialChars) &&\n extensions.push(highlightSpecialChars());\n isValidSetup(options.history) && extensions.push(history());\n isValidSetup(options.foldGutter) && extensions.push(foldGutter());\n isValidSetup(options.drawSelection) && extensions.push(drawSelection());\n isValidSetup(options.dropCursor) && extensions.push(dropCursor());\n isValidSetup(options.allowMultipleSelections) &&\n extensions.push(EditorState.allowMultipleSelections.of(true));\n isValidSetup(options.indentOnInput) && extensions.push(indentOnInput());\n isValidSetup(options.syntaxHighlighting) &&\n extensions.push(\n syntaxHighlighting(defaultHighlightStyle, { fallback: true })\n );\n isValidSetup(options.bracketMatching) && extensions.push(bracketMatching());\n isValidSetup(options.closeBrackets) && extensions.push(closeBrackets());\n isValidSetup(options.autocompletion) && extensions.push(autocompletion());\n isValidSetup(options.rectangularSelection) &&\n extensions.push(rectangularSelection());\n isValidSetup(options.crosshairCursor) && extensions.push(crosshairCursor());\n isValidSetup(options.highlightActiveLine) &&\n extensions.push(highlightActiveLine());\n isValidSetup(options.highlightSelectionMatches) &&\n extensions.push(highlightSelectionMatches());\n if (options.tabSize && typeof options.tabSize === 'number')\n extensions.push(indentUnit.of(' '.repeat(options.tabSize)));\n return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);\n};\n\nexport interface MinimalSetupOptions {\n highlightSpecialChars?: boolean;\n history?: boolean;\n drawSelection?: boolean;\n syntaxHighlighting?: boolean;\n defaultKeymap?: boolean;\n historyKeymap?: boolean;\n}\n\nexport const minimalSetup = (options: MinimalSetupOptions = {}) => {\n let keymaps: KeyBinding[] = [];\n isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);\n isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);\n const extensions: Extension[] = [];\n isValidSetup(options.highlightSpecialChars) &&\n extensions.push(highlightSpecialChars());\n isValidSetup(options.history) && extensions.push(history());\n isValidSetup(options.drawSelection) && extensions.push(drawSelection());\n isValidSetup(options.syntaxHighlighting) &&\n extensions.push(\n syntaxHighlighting(defaultHighlightStyle, { fallback: true })\n );\n return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileCodeEditor } from './nile-code-editor';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-code-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { NileCodeEditor } from './nile-code-editor';\n"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* CodeEditor CSS
|
9
|
+
*/
|
10
|
+
export declare const styles: import("lit-element").CSSResult;
|
11
|
+
declare const _default: import("lit-element").CSSResult[];
|
12
|
+
export default _default;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { css } from 'lit-element';
|
8
|
+
/**
|
9
|
+
* CodeEditor CSS
|
10
|
+
*/
|
11
|
+
export const styles = css `
|
12
|
+
:host {
|
13
|
+
display: block;
|
14
|
+
}
|
15
|
+
|
16
|
+
.code-mirror {
|
17
|
+
display: flex;
|
18
|
+
justify-content: flex-end;
|
19
|
+
flex-direction: row-reverse;
|
20
|
+
gap: 0.6rem;
|
21
|
+
}
|
22
|
+
|
23
|
+
.cm-editor {
|
24
|
+
overflow: hidden;
|
25
|
+
width: 100%;
|
26
|
+
height: 100%;
|
27
|
+
}
|
28
|
+
|
29
|
+
.ͼ1.cm-focused {
|
30
|
+
outline: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
.code-editor__icon__container {
|
34
|
+
cursor: pointer;
|
35
|
+
}
|
36
|
+
|
37
|
+
.code-editor__icon__container {
|
38
|
+
padding-right: 5px;
|
39
|
+
}
|
40
|
+
`;
|
41
|
+
export default [styles];
|
42
|
+
//# sourceMappingURL=nile-code-editor.css.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-code-editor.css.js","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * CodeEditor CSS\n */\nexport const styles = css`\n :host {\n display: block;\n }\n\n .code-mirror {\n display: flex;\n justify-content: flex-end;\n flex-direction: row-reverse;\n gap: 0.6rem;\n }\n\n .cm-editor {\n overflow: hidden;\n width: 100%;\n height: 100%;\n }\n\n .ͼ1.cm-focused {\n outline: none;\n }\n\n .code-editor__icon__container {\n cursor: pointer;\n }\n\n .code-editor__icon__container {\n padding-right: 5px;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { CSSResultArray, TemplateResult } from 'lit-element';
|
8
|
+
import { EditorView } from 'codemirror';
|
9
|
+
import { Compartment } from '@codemirror/state';
|
10
|
+
import NileElement from '../internal/nile-element';
|
11
|
+
/**
|
12
|
+
* Nile icon component.
|
13
|
+
*
|
14
|
+
* @tag nile-code-editor
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
export declare class NileCodeEditor extends NileElement {
|
18
|
+
codeEditor: HTMLInputElement;
|
19
|
+
multiline: true;
|
20
|
+
value: true;
|
21
|
+
customOptions: any;
|
22
|
+
showLineNumbers: any;
|
23
|
+
/**
|
24
|
+
* The styles for CodeEditor
|
25
|
+
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
26
|
+
*/
|
27
|
+
static get styles(): CSSResultArray;
|
28
|
+
connectedCallback(): void;
|
29
|
+
view: EditorView;
|
30
|
+
convertToSingleLine(code: any): any;
|
31
|
+
lineNumbersComp: Compartment;
|
32
|
+
updated(): void;
|
33
|
+
emitValues(value: string): void;
|
34
|
+
expandCodeEditor(): void;
|
35
|
+
restrictSingleLine(): import("@codemirror/state").Extension;
|
36
|
+
render(): TemplateResult;
|
37
|
+
}
|
38
|
+
export default NileCodeEditor;
|
39
|
+
declare global {
|
40
|
+
interface HTMLElementTagNameMap {
|
41
|
+
'nile-code-editor': NileCodeEditor;
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { __decorate } from "tslib";
|
8
|
+
import { html, property, } from 'lit-element';
|
9
|
+
import { customElement, query } from 'lit/decorators.js';
|
10
|
+
import { styles } from './nile-code-editor.css';
|
11
|
+
import { EditorView } from 'codemirror';
|
12
|
+
import { EditorState, Compartment } from '@codemirror/state';
|
13
|
+
import { javascript, javascriptLanguage } from '@codemirror/lang-javascript';
|
14
|
+
import { autocompletion } from '@codemirror/autocomplete';
|
15
|
+
import NileElement from '../internal/nile-element';
|
16
|
+
import { basicSetup } from './extensionSetup';
|
17
|
+
// Choose the appropriate mode for your use case
|
18
|
+
/**
|
19
|
+
* Nile icon component.
|
20
|
+
*
|
21
|
+
* @tag nile-code-editor
|
22
|
+
*
|
23
|
+
*/
|
24
|
+
let NileCodeEditor = class NileCodeEditor extends NileElement {
|
25
|
+
constructor() {
|
26
|
+
super(...arguments);
|
27
|
+
this.lineNumbersComp = new Compartment();
|
28
|
+
/* #endregion */
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* The styles for CodeEditor
|
32
|
+
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
33
|
+
*/
|
34
|
+
static get styles() {
|
35
|
+
return [styles];
|
36
|
+
}
|
37
|
+
connectedCallback() {
|
38
|
+
super.connectedCallback();
|
39
|
+
}
|
40
|
+
convertToSingleLine(code) {
|
41
|
+
// Remove line breaks and unnecessary whitespace
|
42
|
+
return code.replace(/\s+/g, ' ').trim();
|
43
|
+
}
|
44
|
+
updated() {
|
45
|
+
const customAutoCompletions = javascriptLanguage.data.of({
|
46
|
+
autocomplete: this.customOptions,
|
47
|
+
});
|
48
|
+
let startState = EditorState.create({
|
49
|
+
doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,
|
50
|
+
extensions: [
|
51
|
+
basicSetup({
|
52
|
+
lineNumbers: !!this.showLineNumbers,
|
53
|
+
foldGutter: !this.multiline ? false : true,
|
54
|
+
}),
|
55
|
+
customAutoCompletions,
|
56
|
+
autocompletion(),
|
57
|
+
javascript(),
|
58
|
+
!this.multiline ? this.restrictSingleLine() : [],
|
59
|
+
EditorView.updateListener.of((v) => {
|
60
|
+
if (v.docChanged) {
|
61
|
+
this.emitValues(this.view.state.doc.toString());
|
62
|
+
}
|
63
|
+
}),
|
64
|
+
],
|
65
|
+
});
|
66
|
+
this.view = new EditorView({
|
67
|
+
state: startState,
|
68
|
+
parent: this.codeEditor,
|
69
|
+
});
|
70
|
+
}
|
71
|
+
emitValues(value) {
|
72
|
+
this.emit('nile-change', { value: value });
|
73
|
+
}
|
74
|
+
expandCodeEditor() {
|
75
|
+
this.emit('nile-expand', { expand: true });
|
76
|
+
}
|
77
|
+
restrictSingleLine() {
|
78
|
+
return EditorState.transactionFilter.of(tr => tr.newDoc.lines > 1 ? [] : tr);
|
79
|
+
}
|
80
|
+
render() {
|
81
|
+
return html `<div class="code-mirror">
|
82
|
+
${!this.multiline
|
83
|
+
? html `<nile-icon
|
84
|
+
name="fullscreenshrink"
|
85
|
+
class="code-editor__icon__container"
|
86
|
+
size="16"
|
87
|
+
color="black"
|
88
|
+
@click="${(e) => this.expandCodeEditor()}"
|
89
|
+
></nile-icon>`
|
90
|
+
: ''}
|
91
|
+
</div>`;
|
92
|
+
}
|
93
|
+
};
|
94
|
+
__decorate([
|
95
|
+
query('.code-mirror')
|
96
|
+
], NileCodeEditor.prototype, "codeEditor", void 0);
|
97
|
+
__decorate([
|
98
|
+
property({ type: Boolean })
|
99
|
+
], NileCodeEditor.prototype, "multiline", void 0);
|
100
|
+
__decorate([
|
101
|
+
property({ type: String })
|
102
|
+
], NileCodeEditor.prototype, "value", void 0);
|
103
|
+
__decorate([
|
104
|
+
property({ type: String })
|
105
|
+
], NileCodeEditor.prototype, "customOptions", void 0);
|
106
|
+
__decorate([
|
107
|
+
property({ type: String })
|
108
|
+
], NileCodeEditor.prototype, "showLineNumbers", void 0);
|
109
|
+
NileCodeEditor = __decorate([
|
110
|
+
customElement('nile-code-editor')
|
111
|
+
], NileCodeEditor);
|
112
|
+
export { NileCodeEditor };
|
113
|
+
export default NileCodeEditor;
|
114
|
+
//# sourceMappingURL=nile-code-editor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-code-editor.js","sourceR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,CAAC,CAAC,CAAC,EAAE,CAC9B,CAAC;IACJ,CAAC;IACM,MAAM;QACX,OAAO,IAAI,CAAA;QACP,CAAC,IAAI,CAAC,SAAS;YACf,CAAC,CAAC,IAAI,CAAA;;;;;sBAKQ,CAAC,CAAc,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE;wBACzC;YAChB,CAAC,CAAC,EAAE;WACD,CAAC;IACV,CAAC;CAGF,CAAA;AAnFwB;IAAtB,KAAK,CAAC,cAAc,CAAC;kDAA8B;AACvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAiB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAa;AACZ;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAsB;AALtC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAoF1B;SApFY,cAAc;AAsF3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement, query } from 'lit/decorators.js';\nimport { styles } from './nile-code-editor.css';\nimport { EditorView } from 'codemirror';\nimport { ViewUpdate } from '@codemirror/view';\nimport { EditorState, Compartment } from '@codemirror/state';\nimport { javascript, javascriptLanguage } from '@codemirror/lang-javascript';\nimport { autocompletion } from '@codemirror/autocomplete';\nimport { CompletionContext } from '@codemirror/autocomplete';\nimport NileElement from '../internal/nile-element';\nimport { basicSetup } from './extensionSetup';\n\n// Choose the appropriate mode for your use case\n\n/**\n * Nile icon component.\n *\n * @tag nile-code-editor\n *\n */\n@customElement('nile-code-editor')\nexport class NileCodeEditor extends NileElement {\n @query('.code-mirror') codeEditor: HTMLInputElement;\n @property({ type: Boolean }) multiline: true;\n @property({ type: String }) value: true;\n @property({ type: String }) customOptions: any;\n @property({ type: String }) showLineNumbers: any;\n\n /**\n * The styles for CodeEditor\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n }\n\n view: EditorView;\n\n convertToSingleLine(code: any) {\n // Remove line breaks and unnecessary whitespace\n return code.replace(/\\s+/g, ' ').trim();\n }\n lineNumbersComp = new Compartment();\n\n updated() {\n const customAutoCompletions = javascriptLanguage.data.of({\n autocomplete: this.customOptions,\n });\n let startState = EditorState.create({\n doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,\n extensions: [\n basicSetup({\n lineNumbers: !!this.showLineNumbers,\n foldGutter: !this.multiline ? false : true,\n }),\n customAutoCompletions,\n autocompletion(),\n javascript(),\n !this.multiline ? this.restrictSingleLine() : [],\n EditorView.updateListener.of((v: ViewUpdate) => {\n if (v.docChanged) {\n this.emitValues(this.view.state.doc.toString());\n }\n }),\n ],\n });\n\n this.view = new EditorView({\n state: startState,\n parent: this.codeEditor,\n });\n }\n\n emitValues(value: string) {\n this.emit('nile-change', { value: value });\n }\n\n expandCodeEditor() {\n this.emit('nile-expand', { expand: true });\n }\n\n restrictSingleLine() {\n return EditorState.transactionFilter.of(tr =>\n tr.newDoc.lines > 1 ? [] : tr\n );\n }\n public render(): TemplateResult {\n return html`<div class=\"code-mirror\">\n ${!this.multiline\n ? html`<nile-icon\n name=\"fullscreenshrink\"\n class=\"code-editor__icon__container\"\n size=\"16\"\n color=\"black\"\n @click=\"${(e: CustomEvent) => this.expandCodeEditor()}\"\n ></nile-icon>`\n : ''}\n </div>`;\n }\n\n /* #endregion */\n}\n\nexport default NileCodeEditor;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-code-editor': NileCodeEditor;\n }\n}\n"]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
2
|
* Do not edit directly
|
3
3
|
*/
|
4
|
-
declare const _default: "
|
4
|
+
declare const _default: "PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIHZpZXdCb3g9IjAgMCAxNiAxNyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQuOTk5OTggMTUuMjFMNC4yODk5OCAxNC41TDEwLjI5IDguNDk5OThMNC4yODk5OCAyLjQ5OTk4TDQuOTk5OTggMS43ODk5OEwxMS43MSA4LjQ5OTk4TDQuOTk5OTggMTUuMjFaIiBmaWxsPSIjN0Y3RjdGIi8+PC9zdmc+";
|
5
5
|
export default _default;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
2
|
* Do not edit directly
|
3
3
|
*/
|
4
|
-
export default "
|
4
|
+
export default "PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIHZpZXdCb3g9IjAgMCAxNiAxNyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQuOTk5OTggMTUuMjFMNC4yODk5OCAxNC41TDEwLjI5IDguNDk5OThMNC4yODk5OCAyLjQ5OTk4TDQuOTk5OTggMS43ODk5OEwxMS43MSA4LjQ5OTk4TDQuOTk5OTggMTUuMjFaIiBmaWxsPSIjN0Y3RjdGIi8+PC9zdmc+";
|
5
5
|
//# sourceMappingURL=arrowright.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"arrowright.js","sourceRoot":"","sources":["../../../../../src/nile-icon/icons/svg/arrowright.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAe,
|
1
|
+
{"version":3,"file":"arrowright.js","sourceRoot":"","sources":["../../../../../src/nile-icon/icons/svg/arrowright.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAe,0WAA0W,CAAC","sourcesContent":["/**\n * Do not edit directly\n */\n\nexport default \"PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTciIHZpZXdCb3g9IjAgMCAxNiAxNyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTQuOTk5OTggMTUuMjFMNC4yODk5OCAxNC41TDEwLjI5IDguNDk5OThMNC4yODk5OCAyLjQ5OTk4TDQuOTk5OTggMS43ODk5OEwxMS43MSA4LjQ5OTk4TDQuOTk5OTggMTUuMjFaIiBmaWxsPSIjN0Y3RjdGIi8+PC9zdmc+\";"]}
|
@@ -53,7 +53,8 @@ export declare class NileIconButton extends NileElement {
|
|
53
53
|
/** Disables the button. */
|
54
54
|
disabled: boolean;
|
55
55
|
/**Default color to icon */
|
56
|
-
color
|
56
|
+
color?: string;
|
57
|
+
ishovered: boolean;
|
57
58
|
private handleBlur;
|
58
59
|
private handleFocus;
|
59
60
|
private handleClick;
|
@@ -43,8 +43,7 @@ let NileIconButton = class NileIconButton extends NileElement {
|
|
43
43
|
this.label = '';
|
44
44
|
/** Disables the button. */
|
45
45
|
this.disabled = false;
|
46
|
-
|
47
|
-
this.color = '#7F7F7F';
|
46
|
+
this.ishovered = false;
|
48
47
|
}
|
49
48
|
handleBlur() {
|
50
49
|
this.hasFocus = false;
|
@@ -73,10 +72,10 @@ let NileIconButton = class NileIconButton extends NileElement {
|
|
73
72
|
this.button.blur();
|
74
73
|
}
|
75
74
|
handleMouseOver(e) {
|
76
|
-
this.
|
75
|
+
this.ishovered = true;
|
77
76
|
}
|
78
|
-
handleMouseLeave() {
|
79
|
-
this.
|
77
|
+
handleMouseLeave(e) {
|
78
|
+
this.ishovered = false;
|
80
79
|
}
|
81
80
|
render() {
|
82
81
|
const isLink = this.href ? true : false;
|
@@ -106,12 +105,13 @@ let NileIconButton = class NileIconButton extends NileElement {
|
|
106
105
|
@mouseover=${this.handleMouseOver}
|
107
106
|
@mouseleave=${this.handleMouseLeave}
|
108
107
|
>
|
108
|
+
|
109
109
|
<nile-icon
|
110
110
|
class="icon-button__icon"
|
111
111
|
name=${ifDefined(this.name)}
|
112
112
|
library=${ifDefined(this.library)}
|
113
113
|
src=${ifDefined(this.src)}
|
114
|
-
color=${ifDefined(this.color)}
|
114
|
+
color=${this.ishovered ? 'black' : ifDefined(this.color)}
|
115
115
|
aria-hidden="true"
|
116
116
|
size="14"
|
117
117
|
></nile-icon>
|
@@ -153,6 +153,9 @@ __decorate([
|
|
153
153
|
__decorate([
|
154
154
|
property({ type: String, reflect: true })
|
155
155
|
], NileIconButton.prototype, "color", void 0);
|
156
|
+
__decorate([
|
157
|
+
property({ type: Boolean, reflect: true })
|
158
|
+
], NileIconButton.prototype, "ishovered", void 0);
|
156
159
|
NileIconButton = __decorate([
|
157
160
|
customElement('nile-icon-button')
|
158
161
|
], NileIconButton);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-icon-button.js","sourceRoot":"","sources":["../../../src/nile-icon-button/nile-icon-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,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K,CAAC,cAAc,CAAC;8CAA6C;AAE1D;IAAR,KAAK,EAAE;gDAA0B;AAGtB;IAAX,QAAQ,EAAE;4CAAe;AAGd;IAAX,QAAQ,EAAE;+CAAkB;AAMjB;IAAX,QAAQ,EAAE;2CAAc;AAGb;IAAX,QAAQ,EAAE;4CAAe;AAGd;IAAX,QAAQ,EAAE;8CAAkD;AAGjD;IAAX,QAAQ,EAAE;gDAAmB;AAMlB;IAAX,QAAQ,EAAE;6CAAY;AAGqB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAkB;AAGlB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAgB;AAEd;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAA4B;AAxC5D,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA6H1B;SA7HY,cAAc;AA+H3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-icon-button.css';\n\nimport '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query, state } from 'lit/decorators.js';\nimport { literal, html } from 'lit/static-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type { CSSResultGroup } from 'lit';\nimport NileElement from '../internal/nile-element';\n\n/**\n * @summary Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n * @status stable\n * @since 2.0\n *\n * @dependency nile-icon\n *\n * @event nile-blur - Emitted when the icon button loses focus.\n * @event nile-focus - Emitted when the icon button gains focus.\n *\n * @csspart base - The component's base wrapper.\n */\n/**\n * Nile icon component.\n *\n * @tag nile-icon-button\n *\n */\n@customElement('nile-icon-button')\nexport class NileIconButton extends NileElement {\n static styles: CSSResultGroup = styles;\n\n @query('.icon-button') button: HTMLButtonElement | HTMLLinkElement;\n\n @state() private hasFocus = false;\n\n /** The name of the icon to draw. Available names depend on the icon library being used. */\n @property() name?: string;\n\n /** The name of a registered custom icon library. */\n @property() library?: string;\n\n /**\n * An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and\n * can result in XSS attacks.\n */\n @property() src?: string;\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */\n @property() href?: string;\n\n /** Tells the browser where to open the link. Only used when `href` is set. */\n @property() target?: '_blank' | '_parent' | '_self' | '_top';\n\n /** Tells the browser to download the linked file as this filename. Only used when `href` is set. */\n @property() download?: string;\n\n /**\n * A description that gets read by assistive devices. For optimal accessibility, you should always include a label\n * that describes what the icon button does.\n */\n @property() label = '';\n\n /** Disables the button. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**Default color to icon */\n @property({ type: String, reflect: true }) color?: string;\n\n @property({ type: Boolean, reflect: true }) ishovered: boolean = false;\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur');\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus');\n }\n\n private handleClick(event: MouseEvent) {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /** Simulates a click on the icon button. */\n click() {\n this.button.click();\n }\n\n /** Sets focus on the icon button. */\n focus(options?: FocusOptions) {\n this.button.focus(options);\n }\n\n /** Removes focus from the icon button. */\n blur() {\n this.button.blur();\n }\n\n private handleMouseOver(e: any) {\n this.ishovered = true;\n }\n private handleMouseLeave(e: any) {\n this.ishovered = false;\n }\n\n\n render(): TemplateResult {\n const isLink = this.href ? true : false;\n const tag = isLink ? literal`a` : literal`button`;\n /* eslint-disable lit/binding-positions, lit/no-invalid-html */\n return html`\n <${tag}\n part=\"base\"\n class=${classMap({\n 'icon-button': true,\n 'icon-button--disabled': !isLink && this.disabled,\n 'icon-button--focused': this.hasFocus,\n })}\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : 'button')}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(\n isLink && this.target ? 'noreferrer noopener' : undefined\n )}\n role=${ifDefined(isLink ? undefined : 'button')}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n aria-label=\"${this.label}\"\n tabindex=${this.disabled ? '-1' : '0'}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n @mouseover=${this.handleMouseOver}\n @mouseleave=${this.handleMouseLeave}\n >\n \n <nile-icon\n class=\"icon-button__icon\"\n name=${ifDefined(this.name)}\n library=${ifDefined(this.library)}\n src=${ifDefined(this.src)}\n color=${this.ishovered? 'black': ifDefined(this.color) }\n aria-hidden=\"true\"\n size=\"14\"\n ></nile-icon>\n </${tag}>\n `;\n }\n}\n\nexport default NileIconButton;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-icon-button': NileIconButton;\n }\n}\n"]}
|
@@ -61,6 +61,17 @@ export const styles = css `
|
|
61
61
|
padding-right: 10px;
|
62
62
|
}
|
63
63
|
|
64
|
+
nile-code-editor {
|
65
|
+
overflow: hidden;
|
66
|
+
padding-top: 2px;
|
67
|
+
border-radius: 5px;
|
68
|
+
border: 1px solid rgb(204, 204, 204);
|
69
|
+
}
|
70
|
+
|
71
|
+
.code-editor__no-border {
|
72
|
+
border: none;
|
73
|
+
}
|
74
|
+
|
64
75
|
.switcher-object-mapper::part(input) {
|
65
76
|
color: var(--nile-colors-primary-600);
|
66
77
|
cursor: pointer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-switcher.css.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-switcher.css.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ExB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * FieldGenerator CSS\n */\nexport const styles = css`\n :host {\n width: 100%;\n box-sizing: border-box;\n }\n\n .switcher-icon-container {\n cursor: pointer;\n justify-content: center;\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n height: 28px;\n width: 28px;\n border-radius: 4px;\n }\n\n .switcher-icon-container.current {\n background: var(--nile-colors-blue-400);\n }\n\n .switcher-input-container {\n display: flex;\n }\n\n .switcher-inline {\n gap: 0.5rem;\n }\n\n .switcher-block {\n flex-direction: column;\n }\n\n .switcher-block > :first-child {\n align-self: end;\n }\n\n .switcher-inline > :nth-child(2) {\n flex: 1;\n }\n\n .switcher-input-container > :first-child {\n display: flex;\n gap: 0.5rem;\n max-height: 38px;\n align-items: center;\n }\n\n nile-radio {\n display: inline-block;\n padding-right: 10px;\n }\n\n nile-code-editor {\n overflow: hidden;\n padding-top: 2px;\n border-radius: 5px;\n border: 1px solid rgb(204, 204, 204);\n }\n\n .code-editor__no-border {\n border: none;\n }\n\n .switcher-object-mapper::part(input) {\n color: var(--nile-colors-primary-600);\n cursor: pointer;\n }\n\n .switcher-input--noborder::part(base) {\n border: none;\n }\n .switcher-object-mapper--noborder::part(base) {\n border: none;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -24,16 +24,14 @@ export interface switchconfig {
|
|
24
24
|
toggleSwitch: boolean;
|
25
25
|
disable?: boolean;
|
26
26
|
confirmation?: boolean;
|
27
|
-
current: number;
|
28
27
|
align: 'block' | 'inline';
|
29
28
|
inputs: switchInputType[];
|
30
29
|
}
|
31
30
|
export interface switchInputType {
|
32
|
-
inputType: INPUT_TYPE_NAMES.DROPDOWN | INPUT_TYPE_NAMES.TEXT | INPUT_TYPE_NAMES.CHECKBOX | INPUT_TYPE_NAMES.TEXTAREA | INPUT_TYPE_NAMES.RADIO | INPUT_TYPE_NAMES.CONTENTEDITOR | INPUT_TYPE_NAMES.OBJECT_MAPPER;
|
31
|
+
inputType: INPUT_TYPE_NAMES.DROPDOWN | INPUT_TYPE_NAMES.TEXT | INPUT_TYPE_NAMES.CHECKBOX | INPUT_TYPE_NAMES.TEXTAREA | INPUT_TYPE_NAMES.RADIO | INPUT_TYPE_NAMES.CONTENTEDITOR | INPUT_TYPE_NAMES.OBJECT_MAPPER | INPUT_TYPE_NAMES.CODE_EDITOR;
|
33
32
|
value?: String | boolean;
|
34
33
|
label?: String;
|
35
34
|
readonly?: boolean;
|
36
|
-
order: number;
|
37
35
|
type?: string;
|
38
36
|
icon: string;
|
39
37
|
mode?: string;
|
@@ -46,6 +44,8 @@ export interface switchInputType {
|
|
46
44
|
helperText?: string;
|
47
45
|
multiple?: boolean;
|
48
46
|
noborder?: boolean;
|
47
|
+
multiLine?: boolean;
|
48
|
+
expand?: boolean;
|
49
49
|
}
|
50
50
|
export declare enum POSITIONS {
|
51
51
|
INLINE = "inline",
|
@@ -62,7 +62,8 @@ export declare enum INPUT_TYPE_NAMES {
|
|
62
62
|
TEXTAREA = "text-area",
|
63
63
|
RADIO = "radio",
|
64
64
|
CONTENTEDITOR = "content-editor",
|
65
|
-
OBJECT_MAPPER = "object-mapper"
|
65
|
+
OBJECT_MAPPER = "object-mapper",
|
66
|
+
CODE_EDITOR = "code-editor"
|
66
67
|
}
|
67
68
|
export declare enum MODE {
|
68
69
|
CREATE = "create",
|
@@ -75,8 +76,11 @@ export declare class NileSwitcher extends NileElement {
|
|
75
76
|
*/
|
76
77
|
static styles: CSSResultGroup;
|
77
78
|
nileSwitchConfig: switchconfig;
|
79
|
+
current: Number;
|
78
80
|
currentInput: switchInputType;
|
79
81
|
connectedCallback(): void;
|
82
|
+
handleSwitcherChange(): void;
|
83
|
+
setCurrentInput(): void;
|
80
84
|
disconnectedCallback(): void;
|
81
85
|
renderNileText(Input: switchInputType): TemplateResult<1>;
|
82
86
|
renderDropdown(Input: switchInputType): TemplateResult<1>;
|
@@ -86,9 +90,11 @@ export declare class NileSwitcher extends NileElement {
|
|
86
90
|
renderErrorMessage(errorMessage: string): TemplateResult<1>;
|
87
91
|
renderContentEditor(Input: switchInputType): TemplateResult<1>;
|
88
92
|
renderObjectMapper(): TemplateResult<1>;
|
93
|
+
renderCodeEditor(Input: switchInputType): TemplateResult<1>;
|
94
|
+
handleExpand(event: CustomEvent, inputType: string): void;
|
89
95
|
handleChange(event: CustomEvent, inputType: string): void;
|
90
96
|
renderIcon(): TemplateResult<1>;
|
91
|
-
toggleField(currentInput: switchInputType): void;
|
97
|
+
toggleField(currentInput: switchInputType, index: Number): void;
|
92
98
|
singleFieldSwitcher(): TemplateResult<1>;
|
93
99
|
render(): TemplateResult;
|
94
100
|
}
|