mirror of
https://github.com/pyscript/pyscript.git
synced 2022-05-01 19:47:48 +03:00
more cleaning
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
scriptsQueue,
|
scriptsQueue,
|
||||||
} from './stores';
|
} from './stores';
|
||||||
|
|
||||||
let iconSize = 2;
|
|
||||||
let pyodideReadyPromise;
|
let pyodideReadyPromise;
|
||||||
|
|
||||||
const initializePyodide = async () => {
|
const initializePyodide = async () => {
|
||||||
@@ -26,11 +25,6 @@
|
|||||||
value[newEnv['id']] = newEnv;
|
value[newEnv['id']] = newEnv;
|
||||||
});
|
});
|
||||||
|
|
||||||
let showNavBar = false;
|
|
||||||
navBarOpen.subscribe(value => {
|
|
||||||
showNavBar = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
// now we call all initializers before we actually executed all page scripts
|
// now we call all initializers before we actually executed all page scripts
|
||||||
for (let initializer of $initializers) {
|
for (let initializer of $initializers) {
|
||||||
await initializer();
|
await initializer();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { componentDetailsNavOpen, loadedEnvironments, mode, pyodideLoaded } from '../stores';
|
import { loadedEnvironments, mode, pyodideLoaded } from '../stores';
|
||||||
import { guidGenerator, addClasses } from '../utils';
|
import { guidGenerator, addClasses } from '../utils';
|
||||||
// Premise used to connect to the first available pyodide interpreter
|
// Premise used to connect to the first available pyodide interpreter
|
||||||
let pyodideReadyPromise;
|
let pyodideReadyPromise;
|
||||||
@@ -13,10 +13,6 @@ loadedEnvironments.subscribe(value => {
|
|||||||
environments = value;
|
environments = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
let propertiesNavOpen;
|
|
||||||
componentDetailsNavOpen.subscribe(value => {
|
|
||||||
propertiesNavOpen = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
mode.subscribe(value => {
|
mode.subscribe(value => {
|
||||||
currentMode = value;
|
currentMode = value;
|
||||||
@@ -52,7 +48,11 @@ export class BaseEvalElement extends HTMLElement {
|
|||||||
this.outputElement.hidden = false;
|
this.outputElement.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
postEvaluate() {}
|
// subclasses should overwrite this method to define custom logic
|
||||||
|
// after code has been evaluated
|
||||||
|
postEvaluate() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
checkId() {
|
checkId() {
|
||||||
if (!this.id) this.id = this.constructor.name + '-' + guidGenerator();
|
if (!this.id) this.id = this.constructor.name + '-' + guidGenerator();
|
||||||
|
|||||||
@@ -49,14 +49,11 @@ export class PyBox extends HTMLElement {
|
|||||||
this.widths.push(`w-${w}`);
|
this.widths.push(`w-${w}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const el of mainDiv.childNodes) {
|
this.widths = [...this.widths, ...[`w-1/${mainDiv.childNodes.length}`]];
|
||||||
this.widths.push(`w-1/${mainDiv.childNodes.length}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.widths.forEach((width, index)=>{
|
this.widths.forEach((width, index)=>{
|
||||||
const node: ChildNode = mainDiv.childNodes[index];
|
const node: ChildNode = mainDiv.childNodes[index];
|
||||||
// @ts-ignore
|
|
||||||
addClasses(node, [width, 'mx-4'])
|
addClasses(node, [width, 'mx-4'])
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { BaseEvalElement } from './base';
|
import { BaseEvalElement } from './base';
|
||||||
import { addClasses, ltrim, htmlDecode } from '../utils';
|
import { addClasses, htmlDecode } from '../utils';
|
||||||
|
|
||||||
export class PyButton extends BaseEvalElement {
|
export class PyButton extends BaseEvalElement {
|
||||||
shadow: ShadowRoot;
|
shadow: ShadowRoot;
|
||||||
|
|||||||
@@ -5,20 +5,6 @@ import { loadPackage, loadFromFile } from '../interpreter';
|
|||||||
|
|
||||||
// Premise used to connect to the first available pyodide interpreter
|
// Premise used to connect to the first available pyodide interpreter
|
||||||
let pyodideReadyPromise;
|
let pyodideReadyPromise;
|
||||||
let environments;
|
|
||||||
let currentMode;
|
|
||||||
|
|
||||||
pyodideLoaded.subscribe(value => {
|
|
||||||
pyodideReadyPromise = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
loadedEnvironments.subscribe(value => {
|
|
||||||
environments = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
mode.subscribe(value => {
|
|
||||||
currentMode = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
export class PyEnv extends HTMLElement {
|
export class PyEnv extends HTMLElement {
|
||||||
shadow: ShadowRoot;
|
shadow: ShadowRoot;
|
||||||
|
|||||||
Reference in New Issue
Block a user