@aquera/nile-elements 0.0.31 → 0.0.32

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.
Files changed (73) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +1 -0
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +1 -0
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.d.ts +33 -0
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.js +63 -0
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/extensionSetup.js.map +1 -0
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.d.ts +1 -0
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.js +2 -0
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/index.js.map +1 -0
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.d.ts +12 -0
  11. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js +42 -0
  12. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -0
  13. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.d.ts +43 -0
  14. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js +114 -0
  15. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js.map +1 -0
  16. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +11 -0
  17. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  18. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +11 -5
  19. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +55 -7
  20. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  21. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  22. package/dist/index.cjs.js +1 -1
  23. package/dist/index.esm.js +1 -1
  24. package/dist/index.iife.js +408 -352
  25. package/dist/nile-code-editor/extensionSetup.cjs.js +7 -0
  26. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -0
  27. package/dist/nile-code-editor/extensionSetup.esm.js +1 -0
  28. package/dist/nile-code-editor/index.cjs.js +2 -0
  29. package/dist/nile-code-editor/index.cjs.js.map +1 -0
  30. package/dist/nile-code-editor/index.esm.js +1 -0
  31. package/dist/nile-code-editor/nile-code-editor.cjs.js +3 -0
  32. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -0
  33. package/dist/nile-code-editor/nile-code-editor.css.cjs.js +2 -0
  34. package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -0
  35. package/dist/nile-code-editor/nile-code-editor.css.esm.js +30 -0
  36. package/dist/nile-code-editor/nile-code-editor.esm.js +9 -0
  37. package/dist/nile-switcher/index.cjs.js +1 -1
  38. package/dist/nile-switcher/index.esm.js +1 -1
  39. package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
  40. package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
  41. package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
  42. package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
  43. package/dist/nile-switcher/nile-switcher.css.esm.js +13 -2
  44. package/dist/nile-switcher/nile-switcher.esm.js +38 -30
  45. package/dist/src/index.d.ts +1 -0
  46. package/dist/src/index.js +1 -0
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/nile-code-editor/extensionSetup.d.ts +33 -0
  49. package/dist/src/nile-code-editor/extensionSetup.js +63 -0
  50. package/dist/src/nile-code-editor/extensionSetup.js.map +1 -0
  51. package/dist/src/nile-code-editor/index.d.ts +1 -0
  52. package/dist/src/nile-code-editor/index.js +2 -0
  53. package/dist/src/nile-code-editor/index.js.map +1 -0
  54. package/dist/src/nile-code-editor/nile-code-editor.css.d.ts +12 -0
  55. package/dist/src/nile-code-editor/nile-code-editor.css.js +42 -0
  56. package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -0
  57. package/dist/src/nile-code-editor/nile-code-editor.d.ts +43 -0
  58. package/dist/src/nile-code-editor/nile-code-editor.js +114 -0
  59. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -0
  60. package/dist/src/nile-switcher/nile-switcher.css.js +11 -0
  61. package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  62. package/dist/src/nile-switcher/nile-switcher.d.ts +11 -5
  63. package/dist/src/nile-switcher/nile-switcher.js +55 -7
  64. package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  65. package/dist/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +1 -1
  67. package/src/index.ts +2 -1
  68. package/src/nile-code-editor/extensionSetup.ts +125 -0
  69. package/src/nile-code-editor/index.ts +1 -0
  70. package/src/nile-code-editor/nile-code-editor.css.ts +44 -0
  71. package/src/nile-code-editor/nile-code-editor.ts +127 -0
  72. package/src/nile-switcher/nile-switcher.css.ts +11 -0
  73. package/src/nile-switcher/nile-switcher.ts +70 -10
@@ -39,4 +39,5 @@ export { NileErrorNotification } from './nile-error-notification';
39
39
  export { NileTabGroup } from './nile-tab-group';
40
40
  export { NileTab } from './nile-tab';
41
41
  export { NileTabPanel } from './nile-tab-panel';
42
+ export { NileCodeEditor } from './nile-code-editor';
42
43
  export { NileToast } from './nile-toast';
@@ -39,5 +39,6 @@ export { NileErrorNotification } from './nile-error-notification';
39
39
  export { NileTabGroup } from './nile-tab-group';
40
40
  export { NileTab } from './nile-tab';
41
41
  export { NileTabPanel } from './nile-tab-panel';
42
+ export { NileCodeEditor } from './nile-code-editor';
42
43
  export { NileToast } from './nile-toast';
43
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAA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EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { NileButton } from './nile-button';\nexport { NileHeading } from './nile-heading';\nexport { NileIcon } from './nile-icon';\nexport { NileInput } from './nile-input';\nexport { NileSidebar } from './nile-sidebar';\nexport { NileMenu } from './nile-menu';\nexport { NileBadge } from './nile-badge';\nexport { NileDrawer } from './nile-drawer';\nexport { NileCheckbox } from './nile-checkbox';\nexport { NileRadio } from './nile-radio';\nexport { NileRadioGroup } from './nile-radio-group';\nexport { NilePopup } from './nile-popup';\nexport { NileTooltip } from './nile-tooltip';\nexport { NileSlideToggle } from './nile-slide-toggle';\nexport { NileLoader } from './nile-loader';\nexport { NileProgressBar } from './nile-progress-bar';\nexport { NileSpinner } from './nile-spinner';\nexport { NileSelect } from './nile-select';\nexport { NileOption } from './nile-option';\nexport { NileTag } from './nile-tag';\nexport { NileIconButton } from './nile-icon-button';\nexport { NileMenuItem } from './nile-menu-item';\nexport { NileDropdown } from './nile-dropdown';\nexport { NileAutoComplete } from './nile-auto-complete';\nexport { NileChip } from './nile-chip';\nexport { NileTextarea } from './nile-textarea';\nexport { NileDatePicker } from './nile-date-picker';\nexport { NileErrorMessage } from './nile-error-message';\nexport { NileFormErrorMessage } from './nile-form-error-message';\nexport { NileFormHelpText } from './nile-form-help-text';\nexport { NileCalendar } from './nile-calendar';\nexport { NileLink} from './nile-link';\nexport { NileButtonToggleGroup } from './nile-button-toggle-group';\nexport { NileButtonToggle } from './nile-button-toggle';\nexport { NileSwitcher } from './nile-switcher';\nexport { NileContentEditor } from './nile-content-editor';\nexport { NileDialog } from './nile-dialog';\nexport { NileErrorNotification } from './nile-error-notification';\nexport { NileTabGroup } from './nile-tab-group';\nexport { NileTab } from './nile-tab';\nexport { NileTabPanel } from './nile-tab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AAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { NileButton } from './nile-button';\nexport { NileHeading } from './nile-heading';\nexport { NileIcon } from './nile-icon';\nexport { NileInput } from './nile-input';\nexport { NileSidebar } from './nile-sidebar';\nexport { NileMenu } from './nile-menu';\nexport { NileBadge } from './nile-badge';\nexport { NileDrawer } from './nile-drawer';\nexport { NileCheckbox } from './nile-checkbox';\nexport { NileRadio } from './nile-radio';\nexport { NileRadioGroup } from './nile-radio-group';\nexport { NilePopup } from './nile-popup';\nexport { NileTooltip } from './nile-tooltip';\nexport { NileSlideToggle } from './nile-slide-toggle';\nexport { NileLoader } from './nile-loader';\nexport { NileProgressBar } from './nile-progress-bar';\nexport { NileSpinner } from './nile-spinner';\nexport { NileSelect } from './nile-select';\nexport { NileOption } from './nile-option';\nexport { NileTag } from './nile-tag';\nexport { NileIconButton } from './nile-icon-button';\nexport { NileMenuItem } from './nile-menu-item';\nexport { NileDropdown } from './nile-dropdown';\nexport { NileAutoComplete } from './nile-auto-complete';\nexport { NileChip } from './nile-chip';\nexport { NileTextarea } from './nile-textarea';\nexport { NileDatePicker } from './nile-date-picker';\nexport { NileErrorMessage } from './nile-error-message';\nexport { NileFormErrorMessage } from './nile-form-error-message';\nexport { NileFormHelpText } from './nile-form-help-text';\nexport { NileCalendar } from './nile-calendar';\nexport { NileLink } from './nile-link';\nexport { NileButtonToggleGroup } from './nile-button-toggle-group';\nexport { NileButtonToggle } from './nile-button-toggle';\nexport { NileSwitcher } from './nile-switcher';\nexport { NileContentEditor } from './nile-content-editor';\nexport { NileDialog } from './nile-dialog';\nexport { NileErrorNotification } from './nile-error-notification';\nexport { NileTabGroup } from './nile-tab-group';\nexport { NileTab } from './nile-tab';\nexport { NileTabPanel } from './nile-tab-panel';\nexport { NileCodeEditor } from './nile-code-editor';\nexport { NileToast } from './nile-toast';\n"]}
@@ -0,0 +1,33 @@
1
+ import { Extension } from '@codemirror/state';
2
+ export interface BasicSetupOptions extends MinimalSetupOptions {
3
+ lineNumbers?: boolean;
4
+ highlightActiveLineGutter?: boolean;
5
+ foldGutter?: boolean;
6
+ dropCursor?: boolean;
7
+ allowMultipleSelections?: boolean;
8
+ indentOnInput?: boolean;
9
+ bracketMatching?: boolean;
10
+ closeBrackets?: boolean;
11
+ autocompletion?: boolean;
12
+ rectangularSelection?: boolean;
13
+ crosshairCursor?: boolean;
14
+ highlightActiveLine?: boolean;
15
+ highlightSelectionMatches?: boolean;
16
+ closeBracketsKeymap?: boolean;
17
+ searchKeymap?: boolean;
18
+ foldKeymap?: boolean;
19
+ completionKeymap?: boolean;
20
+ lintKeymap?: boolean;
21
+ tabSize?: number;
22
+ }
23
+ export declare const isValidSetup: (item: any) => any;
24
+ export declare const basicSetup: (options?: BasicSetupOptions) => Extension[];
25
+ export interface MinimalSetupOptions {
26
+ highlightSpecialChars?: boolean;
27
+ history?: boolean;
28
+ drawSelection?: boolean;
29
+ syntaxHighlighting?: boolean;
30
+ defaultKeymap?: boolean;
31
+ historyKeymap?: boolean;
32
+ }
33
+ export declare const minimalSetup: (options?: MinimalSetupOptions) => Extension[];
@@ -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,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACjE,IAAI,OAAO,GAAiB,EAAE,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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,2 @@
1
+ export { NileCodeEditor } from './nile-code-editor';
2
+ //# sourceMappingURL=index.js.map
@@ -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","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gDAAgD;AAEhD;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QAyBL,oBAAe,GAAG,IAAI,WAAW,EAAE,CAAC;QA0DpC,gBAAgB;IAClB,CAAC;IA7EC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC5B,CAAC;IAID,mBAAmB,CAAC,IAAS;QAC3B,gDAAgD;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;IAGD,OAAO;QACL,MAAM,qBAAqB,GAAG,kBAAk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C;IAC7C,CAAC;IAED,kBAAkB;QAChB,OAAO,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAC3C,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,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"]}
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgExB,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 .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"]}
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
  }
@@ -12,6 +12,7 @@ import NileElement from '../internal/nile-element';
12
12
  import { choose } from 'lit/directives/choose.js';
13
13
  import { classMap } from 'lit/directives/class-map.js';
14
14
  import { repeat } from 'lit/directives/repeat.js';
15
+ import { watch } from '../internal/watch';
15
16
  export var POSITIONS;
16
17
  (function (POSITIONS) {
17
18
  POSITIONS["INLINE"] = "inline";
@@ -31,6 +32,7 @@ export var INPUT_TYPE_NAMES;
31
32
  INPUT_TYPE_NAMES["RADIO"] = "radio";
32
33
  INPUT_TYPE_NAMES["CONTENTEDITOR"] = "content-editor";
33
34
  INPUT_TYPE_NAMES["OBJECT_MAPPER"] = "object-mapper";
35
+ INPUT_TYPE_NAMES["CODE_EDITOR"] = "code-editor";
34
36
  })(INPUT_TYPE_NAMES || (INPUT_TYPE_NAMES = {}));
35
37
  export var MODE;
36
38
  (function (MODE) {
@@ -38,11 +40,25 @@ export var MODE;
38
40
  MODE["EDIT"] = "edit";
39
41
  })(MODE || (MODE = {}));
40
42
  let NileSwitcher = class NileSwitcher extends NileElement {
43
+ constructor() {
44
+ super(...arguments);
45
+ this.current = 0;
46
+ }
41
47
  connectedCallback() {
42
- this.currentInput = this.nileSwitchConfig.inputs[0];
43
48
  super.connectedCallback();
49
+ this.setCurrentInput();
44
50
  this.emit('nile-init');
45
51
  }
52
+ handleSwitcherChange() {
53
+ this.setCurrentInput();
54
+ }
55
+ setCurrentInput() {
56
+ if (this.nileSwitchConfig?.inputs) {
57
+ this.currentInput = this.nileSwitchConfig.inputs.filter((input, index) => {
58
+ return index === this.current;
59
+ })[0];
60
+ }
61
+ }
46
62
  disconnectedCallback() {
47
63
  super.disconnectedCallback();
48
64
  this.emit('nile-destroy');
@@ -176,6 +192,25 @@ let NileSwitcher = class NileSwitcher extends NileElement {
176
192
  </nile-icon>
177
193
  </nile-input>`;
178
194
  }
195
+ renderCodeEditor(Input) {
196
+ const { value, multiLine, options, disabled, readonly, errorMessage, error, inputType, noborder, } = Input;
197
+ return html `<nile-code-editor
198
+ class=${classMap({
199
+ 'code-editor': true,
200
+ 'code-editor__no-border': !!noborder,
201
+ })}
202
+ @nile-expand="${(e) => this.handleExpand(e, INPUT_TYPE_NAMES.CODE_EDITOR)}"
203
+ @nile-change="${(e) => this.handleChange(e, INPUT_TYPE_NAMES.CODE_EDITOR)}"
204
+ .multiline="${multiLine}"
205
+ .value="${value}"
206
+ .customOptions="${options}"
207
+ .showLineNumbers="false"
208
+ ></nile-code-editor> `;
209
+ }
210
+ handleExpand(event, inputType) {
211
+ this.currentInput.expand = event.detail.expand;
212
+ this.emit('nile-change', { input: this.currentInput });
213
+ }
179
214
  handleChange(event, inputType) {
180
215
  switch (inputType) {
181
216
  case INPUT_TYPE_NAMES.OBJECT_MAPPER:
@@ -184,6 +219,9 @@ let NileSwitcher = class NileSwitcher extends NileElement {
184
219
  case INPUT_TYPE_NAMES.CHECKBOX:
185
220
  this.currentInput.value = event.detail.checked;
186
221
  break;
222
+ case INPUT_TYPE_NAMES.CODE_EDITOR:
223
+ this.currentInput.value = event.detail.value;
224
+ break;
187
225
  default:
188
226
  this.currentInput.value = event.detail.value;
189
227
  }
@@ -195,7 +233,7 @@ let NileSwitcher = class NileSwitcher extends NileElement {
195
233
  const toolTipPosition = this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
196
234
  return html `
197
235
  <div class="switcher-icons-container">
198
- ${repeat(inputs, input => html ` <nile-tooltip
236
+ ${repeat(inputs, (input, index) => html ` <nile-tooltip
199
237
  class=${classMap({
200
238
  'switcher-tooltip-container': true,
201
239
  })}
@@ -204,7 +242,7 @@ let NileSwitcher = class NileSwitcher extends NileElement {
204
242
  >
205
243
  <div class=${classMap({
206
244
  'switcher-icon-container': true,
207
- current: input.order === this.currentInput.order,
245
+ current: index === this.current,
208
246
  })}>
209
247
  <nile-icon
210
248
  size="16"
@@ -213,7 +251,7 @@ let NileSwitcher = class NileSwitcher extends NileElement {
213
251
  })}
214
252
  .name=${input.icon}
215
253
  color="#000000"
216
- @click=${() => this.toggleField(input)}
254
+ @click=${() => this.toggleField(input, index)}
217
255
  ></nile-icon>
218
256
  <div>
219
257
 
@@ -221,8 +259,8 @@ let NileSwitcher = class NileSwitcher extends NileElement {
221
259
  </div>
222
260
  `;
223
261
  }
224
- toggleField(currentInput) {
225
- this.currentInput = currentInput;
262
+ toggleField(currentInput, index) {
263
+ this.current = index;
226
264
  this.emit('nile-switch', { input: this.currentInput });
227
265
  }
228
266
  singleFieldSwitcher() {
@@ -250,6 +288,10 @@ let NileSwitcher = class NileSwitcher extends NileElement {
250
288
  () => this.renderContentEditor(this.currentInput),
251
289
  ],
252
290
  [INPUT_TYPE_NAMES.OBJECT_MAPPER, () => this.renderObjectMapper()],
291
+ [
292
+ INPUT_TYPE_NAMES.CODE_EDITOR,
293
+ () => this.renderCodeEditor(this.currentInput),
294
+ ],
253
295
  ], () => this.renderNileText(this.currentInput))}
254
296
  `;
255
297
  }
@@ -275,8 +317,14 @@ __decorate([
275
317
  property({ type: Object })
276
318
  ], NileSwitcher.prototype, "nileSwitchConfig", void 0);
277
319
  __decorate([
278
- property()
320
+ property({ type: Number })
321
+ ], NileSwitcher.prototype, "current", void 0);
322
+ __decorate([
323
+ property({ type: Object })
279
324
  ], NileSwitcher.prototype, "currentInput", void 0);
325
+ __decorate([
326
+ watch(['current'], { waitUntilFirstUpdate: true })
327
+ ], NileSwitcher.prototype, "handleSwitcherChange", null);
280
328
  NileSwitcher = __decorate([
281
329
  customElement('nile-switcher')
282
330
  ], NileSwitcher);