@aquera/nile-elements 0.0.33 → 0.0.35
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.js +2 -2
- 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-switcher/nile-switcher.css.js +30 -13
- 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 +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +28 -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/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +58 -29
- 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/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.esm.js +2 -2
- 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 +32 -15
- package/dist/nile-switcher/nile-switcher.esm.js +33 -21
- package/dist/src/nile-code-editor/nile-code-editor.js +2 -2
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +30 -13
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +2 -0
- package/dist/src/nile-switcher/nile-switcher.js +28 -7
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/nile-code-editor/nile-code-editor.ts +8 -3
- package/src/nile-switcher/nile-switcher.css.ts +30 -13
- package/src/nile-switcher/nile-switcher.ts +30 -7
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.0.
|
6
|
+
"version": "0.0.35",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -34,7 +34,9 @@
|
|
34
34
|
"element-internals-polyfill": "^1.1.20",
|
35
35
|
"lit": "^2.0.2",
|
36
36
|
"@floating-ui/dom": "^1.2.1",
|
37
|
-
"composed-offset-position": "^0.0.4"
|
37
|
+
"composed-offset-position": "^0.0.4",
|
38
|
+
"@codemirror/lang-javascript": "6.2.1",
|
39
|
+
"codemirror": "6.0.1"
|
38
40
|
},
|
39
41
|
"devDependencies": {
|
40
42
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
@@ -17,9 +17,14 @@ import { styles } from './nile-code-editor.css';
|
|
17
17
|
import { EditorView } from 'codemirror';
|
18
18
|
import { ViewUpdate } from '@codemirror/view';
|
19
19
|
import { EditorState, Compartment } from '@codemirror/state';
|
20
|
-
import {
|
20
|
+
import {
|
21
|
+
javascript,
|
22
|
+
javascriptLanguage,
|
23
|
+
scopeCompletionSource,
|
24
|
+
completionPath,
|
25
|
+
} from '@codemirror/lang-javascript';
|
21
26
|
import { autocompletion } from '@codemirror/autocomplete';
|
22
|
-
import { CompletionContext } from '@codemirror/autocomplete';
|
27
|
+
import { CompletionContext, Completion } from '@codemirror/autocomplete';
|
23
28
|
import NileElement from '../internal/nile-element';
|
24
29
|
import { basicSetup } from './extensionSetup';
|
25
30
|
|
@@ -61,7 +66,7 @@ export class NileCodeEditor extends NileElement {
|
|
61
66
|
|
62
67
|
updated() {
|
63
68
|
const customAutoCompletions = javascriptLanguage.data.of({
|
64
|
-
autocomplete: this.customOptions,
|
69
|
+
autocomplete: scopeCompletionSource(this.customOptions),
|
65
70
|
});
|
66
71
|
let startState = EditorState.create({
|
67
72
|
doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,
|
@@ -16,22 +16,24 @@ export const styles = css`
|
|
16
16
|
box-sizing: border-box;
|
17
17
|
}
|
18
18
|
|
19
|
-
.
|
20
|
-
cursor: pointer;
|
21
|
-
justify-content: center;
|
19
|
+
.switcher__label {
|
22
20
|
display: flex;
|
23
21
|
align-items: center;
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
color: inherit;
|
23
|
+
color: var(--nile-colors-dark-900);
|
24
|
+
font-family: Colfax-regular;
|
25
|
+
font-size: 14px;
|
26
|
+
font-style: normal;
|
27
|
+
font-weight: 400;
|
28
|
+
line-height: 14px;
|
29
|
+
letter-spacing: 0.2px;
|
28
30
|
}
|
29
31
|
|
30
32
|
.switcher-icon-container.current {
|
31
33
|
background: var(--nile-colors-blue-400);
|
32
34
|
}
|
33
35
|
|
34
|
-
.switcher-
|
36
|
+
.switcher-container {
|
35
37
|
display: flex;
|
36
38
|
}
|
37
39
|
|
@@ -43,21 +45,36 @@ export const styles = css`
|
|
43
45
|
flex-direction: column;
|
44
46
|
}
|
45
47
|
|
46
|
-
.switcher-block > :first-child {
|
47
|
-
align-self: end;
|
48
|
-
}
|
49
|
-
|
50
48
|
.switcher-inline > :nth-child(2) {
|
51
49
|
flex: 1;
|
52
50
|
}
|
53
51
|
|
54
|
-
.switcher-
|
52
|
+
.switcher-icons-container {
|
55
53
|
display: flex;
|
54
|
+
margin-left: auto;
|
56
55
|
gap: 0.5rem;
|
57
56
|
max-height: 38px;
|
58
57
|
align-items: center;
|
59
58
|
}
|
60
59
|
|
60
|
+
.switcher-block > .switcher-icons-container {
|
61
|
+
margin-left: auto;
|
62
|
+
}
|
63
|
+
|
64
|
+
.label-container {
|
65
|
+
display: flex;
|
66
|
+
}
|
67
|
+
|
68
|
+
.switcher-icon-container {
|
69
|
+
cursor: pointer;
|
70
|
+
justify-content: center;
|
71
|
+
display: flex;
|
72
|
+
align-items: center;
|
73
|
+
margin-bottom: 6px;
|
74
|
+
height: 28px;
|
75
|
+
width: 28px;
|
76
|
+
border-radius: 4px;
|
77
|
+
}
|
61
78
|
nile-radio {
|
62
79
|
display: inline-block;
|
63
80
|
padding-right: 10px;
|
@@ -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
|
@@ -59,6 +60,7 @@ export interface switchInputType {
|
|
59
60
|
error?: boolean;
|
60
61
|
errorMessage?: string;
|
61
62
|
options?: Array<any>;
|
63
|
+
customAutoCompletions?: any;
|
62
64
|
helperText?: string;
|
63
65
|
multiple?: boolean;
|
64
66
|
noborder?: boolean;
|
@@ -100,6 +102,8 @@ export class NileSwitcher extends NileElement {
|
|
100
102
|
*/
|
101
103
|
static styles: CSSResultGroup = styles;
|
102
104
|
|
105
|
+
private readonly hasSlotController = new HasSlotController(this, 'label');
|
106
|
+
|
103
107
|
@property({ type: Object }) nileSwitchConfig: switchconfig;
|
104
108
|
|
105
109
|
@property({ type: Number }) current: Number = 0;
|
@@ -108,7 +112,6 @@ export class NileSwitcher extends NileElement {
|
|
108
112
|
|
109
113
|
connectedCallback() {
|
110
114
|
super.connectedCallback();
|
111
|
-
this.setCurrentInput();
|
112
115
|
this.emit('nile-init');
|
113
116
|
}
|
114
117
|
|
@@ -300,7 +303,7 @@ export class NileSwitcher extends NileElement {
|
|
300
303
|
const {
|
301
304
|
value,
|
302
305
|
multiLine,
|
303
|
-
|
306
|
+
customAutoCompletions,
|
304
307
|
disabled,
|
305
308
|
readonly,
|
306
309
|
errorMessage,
|
@@ -319,7 +322,7 @@ export class NileSwitcher extends NileElement {
|
|
319
322
|
this.handleChange(e, INPUT_TYPE_NAMES.CODE_EDITOR)}"
|
320
323
|
.multiline="${multiLine}"
|
321
324
|
.value="${value}"
|
322
|
-
.customOptions="${
|
325
|
+
.customOptions="${customAutoCompletions}"
|
323
326
|
.showLineNumbers="false"
|
324
327
|
></nile-code-editor> `;
|
325
328
|
}
|
@@ -353,7 +356,7 @@ export class NileSwitcher extends NileElement {
|
|
353
356
|
this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
|
354
357
|
|
355
358
|
return html`
|
356
|
-
<div class="switcher-icons-container">
|
359
|
+
<div part="icons-container" class="switcher-icons-container">
|
357
360
|
${repeat(
|
358
361
|
inputs,
|
359
362
|
(input: any, index: number) => html` <nile-tooltip
|
@@ -385,11 +388,16 @@ export class NileSwitcher extends NileElement {
|
|
385
388
|
}
|
386
389
|
|
387
390
|
toggleField(currentInput: switchInputType, index: Number) {
|
388
|
-
this.
|
391
|
+
if (this.nileSwitchConfig.confirmation) {
|
392
|
+
this.current = index;
|
393
|
+
}
|
389
394
|
this.emit('nile-switch', { input: this.currentInput });
|
390
395
|
}
|
391
396
|
|
392
397
|
singleFieldSwitcher() {
|
398
|
+
if (!this.currentInput) {
|
399
|
+
this.setCurrentInput();
|
400
|
+
}
|
393
401
|
return html`
|
394
402
|
${choose(
|
395
403
|
this.currentInput.inputType,
|
@@ -427,15 +435,30 @@ export class NileSwitcher extends NileElement {
|
|
427
435
|
}
|
428
436
|
|
429
437
|
public render(): TemplateResult {
|
438
|
+
const hasLabelSlot = this.hasSlotController.test('label');
|
430
439
|
const align = this.nileSwitchConfig.align;
|
431
440
|
return html`<div
|
432
441
|
class=${classMap({
|
433
442
|
'switcher-block': align === POSITIONS.BLOCK,
|
434
443
|
'switcher-inline': align === POSITIONS.INLINE,
|
435
|
-
'switcher-
|
444
|
+
'switcher-container': true,
|
436
445
|
})}
|
437
446
|
>
|
438
|
-
|
447
|
+
<div class="label-container">
|
448
|
+
${hasLabelSlot
|
449
|
+
? html`
|
450
|
+
<label
|
451
|
+
part="switcher-label"
|
452
|
+
class="switcher__label"
|
453
|
+
for="input"
|
454
|
+
>
|
455
|
+
<slot name="label"></slot>
|
456
|
+
</label>
|
457
|
+
</div> `
|
458
|
+
: ''}
|
459
|
+
${this.renderIcon()}
|
460
|
+
</div>
|
461
|
+
${this.singleFieldSwitcher()}
|
439
462
|
</div>`;
|
440
463
|
}
|
441
464
|
}
|