@aquera/nile-elements 0.0.34 → 0.0.36
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/nile-code-editor/nile-code-editor.css.js +5 -5
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.d.ts +4 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js +64 -30
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/theme.d.ts +9 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/theme.js +10 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/theme.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +42 -12
- 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 +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +27 -6
- 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/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +261 -214
- package/dist/nile-code-editor/extensionSetup.cjs.js +1 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +5 -5
- package/dist/nile-code-editor/nile-code-editor.esm.js +6 -3
- package/dist/nile-code-editor/theme.cjs.js +2 -0
- package/dist/nile-code-editor/theme.cjs.js.map +1 -0
- package/dist/nile-code-editor/theme.esm.js +1 -0
- 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 +44 -14
- package/dist/nile-switcher/nile-switcher.esm.js +50 -36
- package/dist/src/nile-code-editor/nile-code-editor.css.js +5 -5
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +4 -2
- package/dist/src/nile-code-editor/nile-code-editor.js +64 -30
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +9 -0
- package/dist/src/nile-code-editor/theme.js +10 -0
- package/dist/src/nile-code-editor/theme.js.map +1 -0
- package/dist/src/nile-switcher/nile-switcher.css.js +42 -12
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +1 -0
- package/dist/src/nile-switcher/nile-switcher.js +27 -6
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/nile-code-editor.css.ts +5 -5
- package/src/nile-code-editor/nile-code-editor.ts +68 -30
- package/src/nile-code-editor/theme.ts +9 -0
- package/src/nile-switcher/nile-switcher.css.ts +42 -12
- package/src/nile-switcher/nile-switcher.ts +29 -6
package/package.json
CHANGED
@@ -19,7 +19,6 @@ export const styles = css`
|
|
19
19
|
display: flex;
|
20
20
|
justify-content: flex-end;
|
21
21
|
flex-direction: row-reverse;
|
22
|
-
gap: 0.6rem;
|
23
22
|
}
|
24
23
|
|
25
24
|
.cm-editor {
|
@@ -33,11 +32,12 @@ export const styles = css`
|
|
33
32
|
}
|
34
33
|
|
35
34
|
.code-editor__icon__container {
|
36
|
-
|
35
|
+
display: none;
|
37
36
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
.code-mirror:hover > .code-editor__icon__container {
|
38
|
+
cursor: pointer;
|
39
|
+
display: flex;
|
40
|
+
padding-right: 10px;
|
41
41
|
}
|
42
42
|
`;
|
43
43
|
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
property,
|
12
12
|
CSSResultArray,
|
13
13
|
TemplateResult,
|
14
|
+
PropertyValueMap,
|
14
15
|
} from 'lit-element';
|
15
16
|
import { customElement, query } from 'lit/decorators.js';
|
16
17
|
import { styles } from './nile-code-editor.css';
|
@@ -27,6 +28,10 @@ import { autocompletion } from '@codemirror/autocomplete';
|
|
27
28
|
import { CompletionContext, Completion } from '@codemirror/autocomplete';
|
28
29
|
import NileElement from '../internal/nile-element';
|
29
30
|
import { basicSetup } from './extensionSetup';
|
31
|
+
import { watch } from '../internal/watch';
|
32
|
+
import { PropertyValues } from 'lit';
|
33
|
+
import { classMap } from 'lit/directives/class-map.js';
|
34
|
+
import { Theme } from './theme';
|
30
35
|
|
31
36
|
// Choose the appropriate mode for your use case
|
32
37
|
|
@@ -42,7 +47,6 @@ export class NileCodeEditor extends NileElement {
|
|
42
47
|
@property({ type: Boolean }) multiline: true;
|
43
48
|
@property({ type: String }) value: true;
|
44
49
|
@property({ type: String }) customOptions: any;
|
45
|
-
@property({ type: String }) showLineNumbers: any;
|
46
50
|
|
47
51
|
/**
|
48
52
|
* The styles for CodeEditor
|
@@ -64,33 +68,61 @@ export class NileCodeEditor extends NileElement {
|
|
64
68
|
}
|
65
69
|
lineNumbersComp = new Compartment();
|
66
70
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
71
|
+
@watch(['value'], { waitUntilFirstUpdate: true })
|
72
|
+
handleValueChange() {}
|
73
|
+
|
74
|
+
updated(changedProperties: PropertyValues) {
|
75
|
+
super.updated(changedProperties);
|
76
|
+
|
77
|
+
if (changedProperties.has('value')) {
|
78
|
+
const customAutoCompletions = javascriptLanguage.data.of({
|
79
|
+
autocomplete: scopeCompletionSource(this.customOptions),
|
80
|
+
});
|
81
|
+
if (!this.view) {
|
82
|
+
let startState = EditorState.create({
|
83
|
+
doc: !this.multiline
|
84
|
+
? this.convertToSingleLine(this.value)
|
85
|
+
: this.value,
|
86
|
+
extensions: [
|
87
|
+
basicSetup({
|
88
|
+
lineNumbers: !!this.multiline,
|
89
|
+
highlightActiveLine: false,
|
90
|
+
foldGutter: !!this.multiline,
|
91
|
+
}),
|
92
|
+
customAutoCompletions,
|
93
|
+
autocompletion(),
|
94
|
+
javascript(),
|
95
|
+
//this.setTheme(),
|
96
|
+
!this.multiline ? this.restrictSingleLine() : [],
|
97
|
+
EditorView.updateListener.of((v: ViewUpdate) => {
|
98
|
+
if (v.docChanged) {
|
99
|
+
this.emitValues(this.view.state.doc.toString());
|
100
|
+
}
|
101
|
+
}),
|
102
|
+
],
|
103
|
+
});
|
104
|
+
|
105
|
+
this.view = new EditorView({
|
106
|
+
state: startState,
|
107
|
+
parent: this.codeEditor,
|
108
|
+
});
|
109
|
+
} else {
|
110
|
+
// Editor has already been initialized, update its state
|
111
|
+
this.view.dispatch({
|
112
|
+
changes: {
|
113
|
+
from: 0,
|
114
|
+
to: this.view.state.doc.length,
|
115
|
+
insert: !this.multiline
|
116
|
+
? this.convertToSingleLine(this.value)
|
117
|
+
: this.value,
|
118
|
+
},
|
119
|
+
});
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
setTheme() {
|
125
|
+
return EditorView.theme(Theme);
|
94
126
|
}
|
95
127
|
|
96
128
|
emitValues(value: string) {
|
@@ -107,9 +139,15 @@ export class NileCodeEditor extends NileElement {
|
|
107
139
|
);
|
108
140
|
}
|
109
141
|
public render(): TemplateResult {
|
110
|
-
return html`<div
|
142
|
+
return html`<div
|
143
|
+
part="base"
|
144
|
+
class=${classMap({
|
145
|
+
'code-mirror': true,
|
146
|
+
'code-mirror__singleline': !this.multiline,
|
147
|
+
})}
|
148
|
+
>
|
111
149
|
${!this.multiline
|
112
|
-
? html
|
150
|
+
? html` <nile-icon
|
113
151
|
name="fullscreenshrink"
|
114
152
|
class="code-editor__icon__container"
|
115
153
|
size="16"
|
@@ -16,22 +16,31 @@ export const styles = css`
|
|
16
16
|
box-sizing: border-box;
|
17
17
|
}
|
18
18
|
|
19
|
-
.
|
19
|
+
.pointer-cursor {
|
20
20
|
cursor: pointer;
|
21
|
-
|
21
|
+
}
|
22
|
+
|
23
|
+
.switcher__label {
|
22
24
|
display: flex;
|
23
25
|
align-items: center;
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
color: inherit;
|
27
|
+
color: var(--nile-colors-dark-900);
|
28
|
+
font-family: Colfax-regular;
|
29
|
+
font-size: 14px;
|
30
|
+
font-style: normal;
|
31
|
+
font-weight: 400;
|
32
|
+
line-height: 14px;
|
33
|
+
letter-spacing: 0.2px;
|
28
34
|
}
|
29
35
|
|
36
|
+
switcher-object-mapper:hover {
|
37
|
+
display: flex;
|
38
|
+
}
|
30
39
|
.switcher-icon-container.current {
|
31
40
|
background: var(--nile-colors-blue-400);
|
32
41
|
}
|
33
42
|
|
34
|
-
.switcher-
|
43
|
+
.switcher-container {
|
35
44
|
display: flex;
|
36
45
|
}
|
37
46
|
|
@@ -43,21 +52,36 @@ export const styles = css`
|
|
43
52
|
flex-direction: column;
|
44
53
|
}
|
45
54
|
|
46
|
-
.switcher-block > :first-child {
|
47
|
-
align-self: end;
|
48
|
-
}
|
49
|
-
|
50
55
|
.switcher-inline > :nth-child(2) {
|
51
56
|
flex: 1;
|
52
57
|
}
|
53
58
|
|
54
|
-
.switcher-
|
59
|
+
.switcher-icons-container {
|
55
60
|
display: flex;
|
61
|
+
margin-left: auto;
|
56
62
|
gap: 0.5rem;
|
57
63
|
max-height: 38px;
|
58
64
|
align-items: center;
|
59
65
|
}
|
60
66
|
|
67
|
+
.switcher-block > .switcher-icons-container {
|
68
|
+
margin-left: auto;
|
69
|
+
}
|
70
|
+
|
71
|
+
.label-container {
|
72
|
+
display: flex;
|
73
|
+
}
|
74
|
+
|
75
|
+
.switcher-icon-container {
|
76
|
+
cursor: pointer;
|
77
|
+
justify-content: center;
|
78
|
+
display: flex;
|
79
|
+
align-items: center;
|
80
|
+
margin-bottom: 6px;
|
81
|
+
height: 28px;
|
82
|
+
width: 28px;
|
83
|
+
border-radius: 4px;
|
84
|
+
}
|
61
85
|
nile-radio {
|
62
86
|
display: inline-block;
|
63
87
|
padding-right: 10px;
|
@@ -74,6 +98,12 @@ export const styles = css`
|
|
74
98
|
border: none;
|
75
99
|
}
|
76
100
|
|
101
|
+
.switcher-object-mapper-icon {
|
102
|
+
display: none;
|
103
|
+
}
|
104
|
+
.switcher-object-mapper:hover > .switcher-object-mapper-icon {
|
105
|
+
display: block;
|
106
|
+
}
|
77
107
|
.switcher-object-mapper::part(input) {
|
78
108
|
color: var(--nile-colors-primary-600);
|
79
109
|
cursor: pointer;
|
@@ -14,6 +14,7 @@ import { choose } from 'lit/directives/choose.js';
|
|
14
14
|
import { classMap } from 'lit/directives/class-map.js';
|
15
15
|
import { repeat } from 'lit/directives/repeat.js';
|
16
16
|
import { watch } from '../internal/watch';
|
17
|
+
import { HasSlotController } from '../internal/slot';
|
17
18
|
|
18
19
|
/**
|
19
20
|
* @summary Allows you to switch between nile elements
|
@@ -101,7 +102,10 @@ export class NileSwitcher extends NileElement {
|
|
101
102
|
*/
|
102
103
|
static styles: CSSResultGroup = styles;
|
103
104
|
|
105
|
+
private readonly hasSlotController = new HasSlotController(this, 'label');
|
106
|
+
|
104
107
|
@property({ type: Object }) nileSwitchConfig: switchconfig;
|
108
|
+
|
105
109
|
@property({ type: Number }) current: Number = 0;
|
106
110
|
|
107
111
|
@property({ type: Object }) currentInput: switchInputType;
|
@@ -173,6 +177,7 @@ export class NileSwitcher extends NileElement {
|
|
173
177
|
} = Input;
|
174
178
|
|
175
179
|
return html`<nile-select
|
180
|
+
part="dropdown"
|
176
181
|
class="switcher-dropdown"
|
177
182
|
.placeholder=${placeholder}
|
178
183
|
.disabled="${disabled}"
|
@@ -272,7 +277,7 @@ export class NileSwitcher extends NileElement {
|
|
272
277
|
const value =
|
273
278
|
this.currentInput.mode === MODE.CREATE
|
274
279
|
? 'Click to Create - Not Mapped'
|
275
|
-
: '';
|
280
|
+
: 'Click to Edit';
|
276
281
|
|
277
282
|
return html`<nile-input
|
278
283
|
class=${classMap({
|
@@ -308,6 +313,7 @@ export class NileSwitcher extends NileElement {
|
|
308
313
|
noborder,
|
309
314
|
} = Input;
|
310
315
|
return html`<nile-code-editor
|
316
|
+
part="code-editor"
|
311
317
|
class=${classMap({
|
312
318
|
'code-editor': true,
|
313
319
|
'code-editor__no-border': !!noborder,
|
@@ -319,7 +325,6 @@ export class NileSwitcher extends NileElement {
|
|
319
325
|
.multiline="${multiLine}"
|
320
326
|
.value="${value}"
|
321
327
|
.customOptions="${customAutoCompletions}"
|
322
|
-
.showLineNumbers="false"
|
323
328
|
></nile-code-editor> `;
|
324
329
|
}
|
325
330
|
|
@@ -352,7 +357,7 @@ export class NileSwitcher extends NileElement {
|
|
352
357
|
this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
|
353
358
|
|
354
359
|
return html`
|
355
|
-
<div class="switcher-icons-container">
|
360
|
+
<div part="icons-container" class="switcher-icons-container">
|
356
361
|
${repeat(
|
357
362
|
inputs,
|
358
363
|
(input: any, index: number) => html` <nile-tooltip
|
@@ -384,7 +389,9 @@ export class NileSwitcher extends NileElement {
|
|
384
389
|
}
|
385
390
|
|
386
391
|
toggleField(currentInput: switchInputType, index: Number) {
|
387
|
-
this.
|
392
|
+
if (this.nileSwitchConfig.confirmation) {
|
393
|
+
this.current = index;
|
394
|
+
}
|
388
395
|
this.emit('nile-switch', { input: this.currentInput });
|
389
396
|
}
|
390
397
|
|
@@ -429,15 +436,31 @@ export class NileSwitcher extends NileElement {
|
|
429
436
|
}
|
430
437
|
|
431
438
|
public render(): TemplateResult {
|
439
|
+
const hasLabelSlot = this.hasSlotController.test('label');
|
432
440
|
const align = this.nileSwitchConfig.align;
|
433
441
|
return html`<div
|
442
|
+
part="base"
|
434
443
|
class=${classMap({
|
435
444
|
'switcher-block': align === POSITIONS.BLOCK,
|
436
445
|
'switcher-inline': align === POSITIONS.INLINE,
|
437
|
-
'switcher-
|
446
|
+
'switcher-container': true,
|
438
447
|
})}
|
439
448
|
>
|
440
|
-
|
449
|
+
<div class="label-container">
|
450
|
+
${hasLabelSlot
|
451
|
+
? html`
|
452
|
+
<label
|
453
|
+
part="switcher-label"
|
454
|
+
class="switcher__label"
|
455
|
+
for="input"
|
456
|
+
>
|
457
|
+
<slot name="label"></slot>
|
458
|
+
</label>
|
459
|
+
</div> `
|
460
|
+
: ''}
|
461
|
+
${this.renderIcon()}
|
462
|
+
</div>
|
463
|
+
${this.singleFieldSwitcher()}
|
441
464
|
</div>`;
|
442
465
|
}
|
443
466
|
}
|