@redvars/peacock 4.6.0 → 4.6.1
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/dist/code-editor.js +56 -5
- package/dist/code-editor.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +3 -3
- package/dist/custom-elements.json +3 -3
- package/dist/src/code-editor/code-editor.d.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/code-editor/code-editor.scss +70 -1
- package/src/code-editor/code-editor.ts +12 -4
package/package.json
CHANGED
|
@@ -18,10 +18,23 @@
|
|
|
18
18
|
|
|
19
19
|
.field-label {
|
|
20
20
|
margin-block-end: var(--spacing-100);
|
|
21
|
-
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
color: var(--field-label-text-color, var(--color-primary));
|
|
23
|
+
text-overflow: ellipsis;
|
|
24
|
+
white-space: nowrap;
|
|
22
25
|
|
|
23
26
|
@include mixin.get-typography(body-small);
|
|
24
27
|
|
|
28
|
+
&.has-error {
|
|
29
|
+
color: var(--color-error);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Disabled, as on wc-field: on-surface at 38%.
|
|
33
|
+
&.disabled {
|
|
34
|
+
color: var(--color-on-surface);
|
|
35
|
+
opacity: var(--state-disabled-content-opacity, 0.38);
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
.required {
|
|
26
39
|
padding-inline-start: var(--spacing-025);
|
|
27
40
|
color: var(--color-error);
|
|
@@ -53,6 +66,17 @@
|
|
|
53
66
|
.code-block {
|
|
54
67
|
// Where the code starts below the header or frame edge; Monaco reads it from the probe.
|
|
55
68
|
--_pad-top: var(--_pad-block);
|
|
69
|
+
// Filled like the other input fields (wc-field): surface-container-lowest by default, and
|
|
70
|
+
// `--field-container-color` themes it alongside them.
|
|
71
|
+
--_background: var(
|
|
72
|
+
--code-editor-background,
|
|
73
|
+
var(--field-container-color, var(--color-surface-container-lowest))
|
|
74
|
+
);
|
|
75
|
+
// Outlined like wc-field too: `--field-outline-color`, then `--color-outline`.
|
|
76
|
+
--_border-color: var(
|
|
77
|
+
--code-editor-border-color,
|
|
78
|
+
var(--field-outline-color, var(--color-outline))
|
|
79
|
+
);
|
|
56
80
|
|
|
57
81
|
height: auto;
|
|
58
82
|
|
|
@@ -67,7 +91,30 @@
|
|
|
67
91
|
outline-offset: -2px;
|
|
68
92
|
}
|
|
69
93
|
|
|
94
|
+
// Read-only, as on wc-field: a faint on-surface box, with the text at full contrast.
|
|
95
|
+
&.readonly:not(.disabled) {
|
|
96
|
+
--_background: var(
|
|
97
|
+
--code-editor-background,
|
|
98
|
+
color-mix(in srgb, var(--color-on-surface) 4%, transparent)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// A lighter outline at rest, full again on focus.
|
|
102
|
+
&:not(.focused) {
|
|
103
|
+
--_border-color: color-mix(
|
|
104
|
+
in srgb,
|
|
105
|
+
var(--code-editor-border-color, var(--field-outline-color, var(--color-outline))) 38%,
|
|
106
|
+
transparent
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
70
111
|
&.disabled {
|
|
112
|
+
// Disabled, as on wc-field: the container in on-surface at 4%.
|
|
113
|
+
--_background: var(
|
|
114
|
+
--code-editor-background,
|
|
115
|
+
color-mix(in srgb, var(--color-on-surface) 4%, transparent)
|
|
116
|
+
);
|
|
117
|
+
|
|
71
118
|
border-color: color-mix(
|
|
72
119
|
in srgb,
|
|
73
120
|
var(--color-on-surface) calc(var(--state-disabled-container-opacity) * 100%),
|
|
@@ -81,6 +128,28 @@
|
|
|
81
128
|
}
|
|
82
129
|
}
|
|
83
130
|
|
|
131
|
+
// The corners of wc-field, which follow its `--field-container-shape-*` properties, at every
|
|
132
|
+
// size (the shared chrome rounds the small size differently).
|
|
133
|
+
.code-block,
|
|
134
|
+
:host([size='sm']) .code-block {
|
|
135
|
+
border-start-start-radius: var(
|
|
136
|
+
--code-editor-shape,
|
|
137
|
+
var(--field-container-shape-start-start, var(--shape-corner-extra-small))
|
|
138
|
+
);
|
|
139
|
+
border-start-end-radius: var(
|
|
140
|
+
--code-editor-shape,
|
|
141
|
+
var(--field-container-shape-start-end, var(--shape-corner-extra-small))
|
|
142
|
+
);
|
|
143
|
+
border-end-start-radius: var(
|
|
144
|
+
--code-editor-shape,
|
|
145
|
+
var(--field-container-shape-end-start, var(--shape-corner-extra-small))
|
|
146
|
+
);
|
|
147
|
+
border-end-end-radius: var(
|
|
148
|
+
--code-editor-shape,
|
|
149
|
+
var(--field-container-shape-end-end, var(--shape-corner-extra-small))
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
84
153
|
// The floating toolbar stays visible while it shows the read-only badge.
|
|
85
154
|
.actions.floating {
|
|
86
155
|
inset-inline-end: var(--spacing-300);
|
|
@@ -156,9 +156,9 @@ function loadMonaco(): Promise<Monaco> {
|
|
|
156
156
|
* @csspart editor - The area Monaco renders into.
|
|
157
157
|
*
|
|
158
158
|
* @cssprop --code-editor-height - Height of the editing area. Defaults to 300px. Ignored with `fill`.
|
|
159
|
-
* @cssprop --code-editor-background - Frame background. Defaults to `--color-surface-container-
|
|
160
|
-
* @cssprop --code-editor-border-color - Frame border color. Defaults to `--color-outline
|
|
161
|
-
* @cssprop --code-editor-shape - Frame corner radius. Defaults to `--shape-corner-
|
|
159
|
+
* @cssprop --code-editor-background - Frame background. Defaults to `--field-container-color`, then `--color-surface-container-lowest`, like the other input fields.
|
|
160
|
+
* @cssprop --code-editor-border-color - Frame border color. Defaults to `--field-outline-color`, then `--color-outline`, like the other input fields.
|
|
161
|
+
* @cssprop --code-editor-shape - Frame corner radius. Defaults to the `--field-container-shape-*` corners, then `--shape-corner-extra-small`, like the other input fields.
|
|
162
162
|
* @cssprop --code-highlighter-token-keyword - Keyword color, shared with `wc-code-highlighter`, like the other `--code-highlighter-token-*` colors.
|
|
163
163
|
*
|
|
164
164
|
* @fires {CustomEvent<{value: string}>} input - Dispatched on each edit.
|
|
@@ -871,7 +871,14 @@ export class CodeEditor extends BaseInput {
|
|
|
871
871
|
|
|
872
872
|
private renderFieldLabel() {
|
|
873
873
|
if (!this.label) return nothing;
|
|
874
|
-
return html`<div
|
|
874
|
+
return html`<div
|
|
875
|
+
class=${classMap({
|
|
876
|
+
'field-label': true,
|
|
877
|
+
disabled: this.disabled,
|
|
878
|
+
'has-error': this.error || !!this.validationText,
|
|
879
|
+
})}
|
|
880
|
+
part="label"
|
|
881
|
+
>
|
|
875
882
|
${this.label}${this.required
|
|
876
883
|
? html`<span class="required" aria-hidden="true">*</span>`
|
|
877
884
|
: nothing}
|
|
@@ -907,6 +914,7 @@ export class CodeEditor extends BaseInput {
|
|
|
907
914
|
'has-header': hasHeader,
|
|
908
915
|
focused: this.hasFocus,
|
|
909
916
|
disabled: this.disabled,
|
|
917
|
+
readonly: this.readonly,
|
|
910
918
|
'has-error': invalid,
|
|
911
919
|
numbered: this.lineNumbers,
|
|
912
920
|
'breakpoint-gutter': this.breakpointGutter,
|