@covalent/components 8.20.3 → 8.20.4
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/notebook-cell.js +6 -6
- package/notebook-cell.mjs +35 -35
- package/package.json +1 -1
package/notebook-cell.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./query-assigned-elements-f623705d.js"),s=require("./property-57f6f6fe.js"),v=require("./state-0974a8e5.js"),
|
2
|
-
`;var x=Object.defineProperty,m=Object.getOwnPropertyDescriptor,n=(
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./query-assigned-elements-f623705d.js"),s=require("./property-57f6f6fe.js"),v=require("./state-0974a8e5.js"),h=require("./class-map-0a4c6ca9.js"),g=require("./code-editor-b2ecbde1.js");require("./code-snippet.js");require("./icon-button.js");require("./typography.js");require("./directive-1186bc23.js");require("./async-directive-4a34f75e.js");require("./directive-helpers-0ce1f995.js");require("./query-assigned-nodes-99eae71d.js");require("./_commonjsHelpers-2367a3a2.js");require("./tslib.es6-98719205.js");require("./ripple-handlers-9fb4a31a.js");require("./base-element-58a3f9ea.js");require("./utils-a8190a39.js");require("./query-680f1868.js");require("./style-map-a135c6ab.js");require("./aria-property-849c8816.js");require("./event-options-3f5eb195.js");require("./if-defined-f1c45245.js");const b=`:host{--mdc-icon-button-size: 2rem;font-family:var(--mdc-typography-body1-font-family);width:100%}cv-code-snippet{background-color:var(--cv-theme-surface);border-radius:0;box-sizing:border-box}cv-code-snippet::part(code){font-size:var(--mdc-typography-body2-font-size);line-height:var(--mdc-typography-body2-line-height);padding:0;white-space:pre-wrap}cv-code-editor{margin-top:-1px}.selectionIndicator{background-color:var(--cv-theme-primary);border-radius:2px;height:100%;visibility:hidden}.selectionIndicatorWrapper{min-width:8px}.selectionIndicatorWrapper:hover .selectionIndicator{visibility:visible}.status{padding:0 1px;position:relative}.loading{top:2.5px}.timesExecuted{--cv-icon-button-cursor: grab;align-items:center;box-sizing:border-box;color:var(--cv-theme-on-surface-38);display:flex;font-family:var(--cv-typography-subtitle2-font-family);font-size:var(--cv-typography-subtitle2-font-size);height:56px;line-height:var(--cv-typography-headline6-line-height)}.timesExecuted .executionCount{padding-right:1rem;overflow:hidden;text-align:right;text-overflow:ellipsis;-webkit-user-select:none;user-select:none;white-space:nowrap;width:50px}.timesExecuted .dragHandle{color:var(--cv-theme-on-surface-variant);cursor:grab;visibility:hidden;transition:visibility .3s ease}.timesExecuted .dragHandle:active{--cv-icon-button-cursor: grabbing}.timesExecutedWrapper{cursor:grab}.timesExecutedWrapper:active{cursor:grabbing}.timesExecutedWrapper:hover .dragHandle{visibility:visible}.cell{box-sizing:border-box;cursor:pointer;display:flex;justify-content:space-between;position:relative;transition:background-color .2s ease;-webkit-user-select:auto;user-select:auto}.cell.focused .selectionIndicator,.cell.selected .selectionIndicator{visibility:visible}.cell:hover{background-color:var(--cv-theme-secondary-4)}.cell:hover .selectionIndicator{visibility:visible;background-color:var(--cv-theme-on-secondary-container-38)}.cell:active{background-color:var(--cv-theme-secondary-12)}.cell:active .selectionIndicator{visibility:visible;background-color:var(--cv-theme-on-secondary-container-74)}.cellWrapper{display:flex;flex-direction:column;width:100%}.cellOutputWrapper{display:flex;flex-direction:column;max-width:calc(100% - 95px);flex:1}.contextMenu{overflow:auto;position:absolute;visibility:hidden;z-index:1000}.contextMenu.open{visibility:visible}.editorContainer{box-sizing:border-box;background-color:var(--cv-theme-surface);border:1px solid var(--cv-theme-outline-variant);border-radius:var(--cv-editor-border-radius, 4px);min-height:56px;overflow:hidden;padding:1rem}.errors,.output{max-width:100%;width:100%}
|
2
|
+
`;var x=Object.defineProperty,m=Object.getOwnPropertyDescriptor,n=(c,e,t,i)=>{for(var o=i>1?void 0:i?m(e,t):e,l=c.length-1,a;l>=0;l--)(a=c[l])&&(o=(i?a(e,t,o):a(o))||o);return i&&o&&x(e,t,o),o};exports.CovalentNotebookCell=class extends r.s{constructor(){super(),this.code="",this.language="",this.loading=!1,this.selected=!1,this.timesExecuted=0,this.hideEditor=!1,this.hideCount=!1,this.editorTheme="",this._editorFocused=!1,this._isMenuOpen=!1,this._menuMaxHeight="auto",this._menuPosition={top:0,left:0},this.editorOptions={minimap:{enabled:!1},wordWrap:"on",fontSize:"14px",glyphMargin:!1,folding:!1,lineHeight:20,lineNumbers:"off",lineDecorationsWidth:0,lineNumbersMinChars:0,renderIndentGuides:!1,renderLineHighlight:"none",overviewRulerLanes:0,hideCursorInOverviewRuler:!0,scrollbar:{alwaysConsumeMouseWheel:!1,vertical:"hidden"}},this.closeContextMenu=this.closeContextMenu.bind(this),this.showContextMenu=this.showContextMenu.bind(this)}closeContextMenu(){this._isMenuOpen=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeContextMenu)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.closeContextMenu)}handleCodeChange(e){this.code=e.detail.code}setEditorFocus(e,t){e.stopImmediatePropagation(),this._editorFocused=t,this.requestUpdate()}setEditorInstance(e){e.stopImmediatePropagation(),this._editor=e.detail.editor,this._editor.onKeyDown(t=>{t.shiftKey&&t.keyCode===g.KeyCode.Enter&&t.preventDefault()})}showContextMenu(e){var u;e.preventDefault();const t=document.querySelectorAll("cv-notebook-cell");t==null||t.forEach(p=>{p.closeContextMenu()});const i=(u=this.shadowRoot)==null?void 0:u.querySelector(".contextMenu"),o=i==null?void 0:i.offsetHeight,a=window.innerHeight-e.clientY,d=e.clientY;a>=o?(this._menuPosition={top:e.clientY,left:e.clientX},this._menuMaxHeight=`${a}px`):d>=o?(this._menuPosition={top:e.clientY-o,left:e.clientX},this._menuMaxHeight=`${o}px`):(this._menuPosition={top:e.clientY-d,left:e.clientX},this._menuMaxHeight=`${d}px`),this._isMenuOpen=!0}updated(e){var i,o;const t=(i=this.shadowRoot)==null?void 0:i.querySelector("cv-code-editor");if(e.has("code")||e.has("language"))if(t)t.code=this.code,t.language=this.language;else{const l=(o=this.shadowRoot)==null?void 0:o.querySelector("cv-code-snippet");l&&!this.selected&&l.highlight()}super.updated(e)}getEditorBgColor(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".editorContainer");return e?window.getComputedStyle(e).getPropertyValue("background-color"):""}renderEditor(){const e=this.selected?r.x`<cv-code-editor
|
3
3
|
@code-change="${this.handleCodeChange}"
|
4
4
|
@editor-ready="${this.setEditorInstance}"
|
5
5
|
@editor-focus="${t=>this.setEditorFocus(t,!0)}"
|
@@ -14,17 +14,17 @@
|
|
14
14
|
<div class="output">
|
15
15
|
<slot name="output"></slot>
|
16
16
|
<slot name="input"></slot>
|
17
|
-
</div>`;return r.x`${e}`}renderExecutionCount(){if(this.hideCount)return r.x` `;const e={status:!0,loading:this.loading};return r.x`[<span class="${
|
17
|
+
</div>`;return r.x`${e}`}renderExecutionCount(){if(this.hideCount)return r.x` `;const e={status:!0,loading:this.loading};return r.x`[<span class="${h.o(e)}"
|
18
18
|
>${this.loading?"*":this.timesExecuted||" "}</span
|
19
19
|
>] :`}render(){const e={cell:!0,selected:this.selected,focused:this._editorFocused};return r.x`
|
20
|
-
<div class="${
|
20
|
+
<div class="${h.o(e)}" @contextmenu=${this.showContextMenu}>
|
21
21
|
<div class="selectionIndicatorWrapper">
|
22
22
|
<div class="selectionIndicator"></div>
|
23
23
|
</div>
|
24
24
|
|
25
25
|
<div class="timesExecutedWrapper">
|
26
26
|
<div class="timesExecuted">
|
27
|
-
<
|
27
|
+
<slot class="dragHandle" name="drag-handle"></slot>
|
28
28
|
<div class="executionCount">${this.renderExecutionCount()}</div>
|
29
29
|
</div>
|
30
30
|
</div>
|
@@ -40,5 +40,5 @@
|
|
40
40
|
<slot name="context-menu"></slot>
|
41
41
|
</div>
|
42
42
|
`}};exports.CovalentNotebookCell.styles=[r.i`
|
43
|
-
${r.r(
|
43
|
+
${r.r(b)}
|
44
44
|
`];n([s.n({type:Number})],exports.CovalentNotebookCell.prototype,"index",2);n([s.n({type:String})],exports.CovalentNotebookCell.prototype,"code",2);n([s.n({type:String})],exports.CovalentNotebookCell.prototype,"language",2);n([s.n({type:Boolean,reflect:!0})],exports.CovalentNotebookCell.prototype,"loading",2);n([s.n({type:Boolean,reflect:!0})],exports.CovalentNotebookCell.prototype,"selected",2);n([s.n({type:Number})],exports.CovalentNotebookCell.prototype,"timesExecuted",2);n([s.n({type:Boolean,reflect:!0})],exports.CovalentNotebookCell.prototype,"hideEditor",2);n([s.n({type:Boolean,reflect:!0})],exports.CovalentNotebookCell.prototype,"hideCount",2);n([s.n({type:String})],exports.CovalentNotebookCell.prototype,"editorTheme",2);n([v.t()],exports.CovalentNotebookCell.prototype,"_isMenuOpen",2);exports.CovalentNotebookCell=n([r.e("cv-notebook-cell")],exports.CovalentNotebookCell);const y=exports.CovalentNotebookCell;exports.default=y;
|
package/notebook-cell.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { i as v, r as m, s as g, x as c, e as
|
2
|
-
import { n as
|
3
|
-
import { t as
|
1
|
+
import { i as v, r as m, s as g, x as c, e as f } from "./query-assigned-elements-4a39219d.mjs";
|
2
|
+
import { n as l } from "./property-9b6ea53b.mjs";
|
3
|
+
import { t as b } from "./state-b5e865db.mjs";
|
4
4
|
import { o as u } from "./class-map-6e504a9a.mjs";
|
5
5
|
import { K as x } from "./code-editor-74bd33c8.mjs";
|
6
6
|
import "./code-snippet.mjs";
|
@@ -20,12 +20,12 @@ import "./style-map-e7ec6d41.mjs";
|
|
20
20
|
import "./aria-property-fa2717fe.mjs";
|
21
21
|
import "./event-options-78d6cf94.mjs";
|
22
22
|
import "./if-defined-c367f208.mjs";
|
23
|
-
const y = `:host{--mdc-icon-button-size: 2rem;font-family:var(--mdc-typography-body1-font-family);width:100%}cv-code-snippet{background-color:var(--cv-theme-surface);border-radius:0;box-sizing:border-box}cv-code-snippet::part(code){font-size:var(--mdc-typography-body2-font-size);line-height:var(--mdc-typography-body2-line-height);padding:0;white-space:pre-wrap}cv-code-editor{margin-top:-1px}.selectionIndicator{background-color:var(--cv-theme-primary);border-radius:2px;height:100%;visibility:hidden}.selectionIndicatorWrapper{min-width:8px}.selectionIndicatorWrapper:hover .selectionIndicator{visibility:visible}.status{padding:0 1px;position:relative}.loading{top:2.5px}.timesExecuted{--cv-icon-button-cursor: grab;align-items:center;box-sizing:border-box;color:var(--cv-theme-on-surface-38);display:flex;font-family:var(--cv-typography-subtitle2-font-family);font-size:var(--cv-typography-subtitle2-font-size);height:56px;line-height:var(--cv-typography-headline6-line-height)}.timesExecuted .executionCount{padding-right:1rem;overflow:hidden;text-align:right;text-overflow:ellipsis;-webkit-user-select:none;user-select:none;white-space:nowrap;width:50px}.timesExecuted
|
23
|
+
const y = `:host{--mdc-icon-button-size: 2rem;font-family:var(--mdc-typography-body1-font-family);width:100%}cv-code-snippet{background-color:var(--cv-theme-surface);border-radius:0;box-sizing:border-box}cv-code-snippet::part(code){font-size:var(--mdc-typography-body2-font-size);line-height:var(--mdc-typography-body2-line-height);padding:0;white-space:pre-wrap}cv-code-editor{margin-top:-1px}.selectionIndicator{background-color:var(--cv-theme-primary);border-radius:2px;height:100%;visibility:hidden}.selectionIndicatorWrapper{min-width:8px}.selectionIndicatorWrapper:hover .selectionIndicator{visibility:visible}.status{padding:0 1px;position:relative}.loading{top:2.5px}.timesExecuted{--cv-icon-button-cursor: grab;align-items:center;box-sizing:border-box;color:var(--cv-theme-on-surface-38);display:flex;font-family:var(--cv-typography-subtitle2-font-family);font-size:var(--cv-typography-subtitle2-font-size);height:56px;line-height:var(--cv-typography-headline6-line-height)}.timesExecuted .executionCount{padding-right:1rem;overflow:hidden;text-align:right;text-overflow:ellipsis;-webkit-user-select:none;user-select:none;white-space:nowrap;width:50px}.timesExecuted .dragHandle{color:var(--cv-theme-on-surface-variant);cursor:grab;visibility:hidden;transition:visibility .3s ease}.timesExecuted .dragHandle:active{--cv-icon-button-cursor: grabbing}.timesExecutedWrapper{cursor:grab}.timesExecutedWrapper:active{cursor:grabbing}.timesExecutedWrapper:hover .dragHandle{visibility:visible}.cell{box-sizing:border-box;cursor:pointer;display:flex;justify-content:space-between;position:relative;transition:background-color .2s ease;-webkit-user-select:auto;user-select:auto}.cell.focused .selectionIndicator,.cell.selected .selectionIndicator{visibility:visible}.cell:hover{background-color:var(--cv-theme-secondary-4)}.cell:hover .selectionIndicator{visibility:visible;background-color:var(--cv-theme-on-secondary-container-38)}.cell:active{background-color:var(--cv-theme-secondary-12)}.cell:active .selectionIndicator{visibility:visible;background-color:var(--cv-theme-on-secondary-container-74)}.cellWrapper{display:flex;flex-direction:column;width:100%}.cellOutputWrapper{display:flex;flex-direction:column;max-width:calc(100% - 95px);flex:1}.contextMenu{overflow:auto;position:absolute;visibility:hidden;z-index:1000}.contextMenu.open{visibility:visible}.editorContainer{box-sizing:border-box;background-color:var(--cv-theme-surface);border:1px solid var(--cv-theme-outline-variant);border-radius:var(--cv-editor-border-radius, 4px);min-height:56px;overflow:hidden;padding:1rem}.errors,.output{max-width:100%;width:100%}
|
24
24
|
`;
|
25
|
-
var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor,
|
26
|
-
for (var
|
27
|
-
(
|
28
|
-
return r &&
|
25
|
+
var C = Object.defineProperty, w = Object.getOwnPropertyDescriptor, n = (e, t, o, r) => {
|
26
|
+
for (var s = r > 1 ? void 0 : r ? w(t, o) : t, d = e.length - 1, a; d >= 0; d--)
|
27
|
+
(a = e[d]) && (s = (r ? a(t, o, s) : a(s)) || s);
|
28
|
+
return r && s && C(t, o, s), s;
|
29
29
|
};
|
30
30
|
let i = class extends g {
|
31
31
|
constructor() {
|
@@ -80,8 +80,8 @@ let i = class extends g {
|
|
80
80
|
});
|
81
81
|
const o = (p = this.shadowRoot) == null ? void 0 : p.querySelector(
|
82
82
|
".contextMenu"
|
83
|
-
), r = o == null ? void 0 : o.offsetHeight,
|
84
|
-
|
83
|
+
), r = o == null ? void 0 : o.offsetHeight, d = window.innerHeight - e.clientY, a = e.clientY;
|
84
|
+
d >= r ? (this._menuPosition = { top: e.clientY, left: e.clientX }, this._menuMaxHeight = `${d}px`) : a >= r ? (this._menuPosition = { top: e.clientY - r, left: e.clientX }, this._menuMaxHeight = `${r}px`) : (this._menuPosition = { top: e.clientY - a, left: e.clientX }, this._menuMaxHeight = `${a}px`), this._isMenuOpen = !0;
|
85
85
|
}
|
86
86
|
updated(e) {
|
87
87
|
var o, r;
|
@@ -90,8 +90,8 @@ let i = class extends g {
|
|
90
90
|
if (t)
|
91
91
|
t.code = this.code, t.language = this.language;
|
92
92
|
else {
|
93
|
-
const
|
94
|
-
|
93
|
+
const s = (r = this.shadowRoot) == null ? void 0 : r.querySelector("cv-code-snippet");
|
94
|
+
s && !this.selected && s.highlight();
|
95
95
|
}
|
96
96
|
super.updated(e);
|
97
97
|
}
|
@@ -148,7 +148,7 @@ let i = class extends g {
|
|
148
148
|
|
149
149
|
<div class="timesExecutedWrapper">
|
150
150
|
<div class="timesExecuted">
|
151
|
-
<
|
151
|
+
<slot class="dragHandle" name="drag-handle"></slot>
|
152
152
|
<div class="executionCount">${this.renderExecutionCount()}</div>
|
153
153
|
</div>
|
154
154
|
</div>
|
@@ -171,38 +171,38 @@ i.styles = [
|
|
171
171
|
${m(y)}
|
172
172
|
`
|
173
173
|
];
|
174
|
-
|
175
|
-
|
174
|
+
n([
|
175
|
+
l({ type: Number })
|
176
176
|
], i.prototype, "index", 2);
|
177
|
-
|
178
|
-
|
177
|
+
n([
|
178
|
+
l({ type: String })
|
179
179
|
], i.prototype, "code", 2);
|
180
|
-
|
181
|
-
|
180
|
+
n([
|
181
|
+
l({ type: String })
|
182
182
|
], i.prototype, "language", 2);
|
183
|
-
|
184
|
-
|
183
|
+
n([
|
184
|
+
l({ type: Boolean, reflect: !0 })
|
185
185
|
], i.prototype, "loading", 2);
|
186
|
-
|
187
|
-
|
186
|
+
n([
|
187
|
+
l({ type: Boolean, reflect: !0 })
|
188
188
|
], i.prototype, "selected", 2);
|
189
|
-
|
190
|
-
|
189
|
+
n([
|
190
|
+
l({ type: Number })
|
191
191
|
], i.prototype, "timesExecuted", 2);
|
192
|
-
|
193
|
-
|
192
|
+
n([
|
193
|
+
l({ type: Boolean, reflect: !0 })
|
194
194
|
], i.prototype, "hideEditor", 2);
|
195
|
-
|
196
|
-
|
195
|
+
n([
|
196
|
+
l({ type: Boolean, reflect: !0 })
|
197
197
|
], i.prototype, "hideCount", 2);
|
198
|
-
|
199
|
-
|
198
|
+
n([
|
199
|
+
l({ type: String })
|
200
200
|
], i.prototype, "editorTheme", 2);
|
201
|
-
|
202
|
-
|
201
|
+
n([
|
202
|
+
b()
|
203
203
|
], i.prototype, "_isMenuOpen", 2);
|
204
|
-
i =
|
205
|
-
|
204
|
+
i = n([
|
205
|
+
f("cv-notebook-cell")
|
206
206
|
], i);
|
207
207
|
const T = i;
|
208
208
|
export {
|