From 0a5e02a87fdabff5ff8399829ff857cae90fc1e2 Mon Sep 17 00:00:00 2001
From: mehekj <mehek.jethani@gmail.com>
Date: Sun, 20 Mar 2022 10:29:42 -0400
Subject: Revert "Merge remote-tracking branch 'origin/speedups2' into
 temporalmedia-mehek"

This reverts commit 1f7cf7babc76ecff5aef5fe663c48e067e85dd26, reversing
changes made to 1e3ad4de06f83eab54628de660529fefb9a0dc63.
---
 src/client/views/nodes/ScriptingBox.tsx | 34 ++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

(limited to 'src/client/views/nodes/ScriptingBox.tsx')

diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx
index 366c3fc2f..183140cd7 100644
--- a/src/client/views/nodes/ScriptingBox.tsx
+++ b/src/client/views/nodes/ScriptingBox.tsx
@@ -1,19 +1,18 @@
 import ReactTextareaAutocomplete from "@webscopeio/react-textarea-autocomplete";
 import "@webscopeio/react-textarea-autocomplete/style.css";
-import { action, computed, observable } from "mobx";
+import { action, computed, observable, runInAction, trace } from "mobx";
 import { observer } from "mobx-react";
 import * as React from "react";
 import { Doc } from "../../../fields/Doc";
+import { documentSchema } from "../../../fields/documentSchemas";
 import { List } from "../../../fields/List";
-import { listSpec } from "../../../fields/Schema";
+import { createSchema, listSpec, makeInterface } from "../../../fields/Schema";
 import { ScriptField } from "../../../fields/ScriptField";
-import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from "../../../fields/Types";
-import { TraceMobx } from "../../../fields/util";
+import { Cast, NumCast, ScriptCast, StrCast, BoolCast } from "../../../fields/Types";
 import { returnEmptyString } from "../../../Utils";
 import { DragManager } from "../../util/DragManager";
 import { InteractionUtils } from "../../util/InteractionUtils";
-import { CompileScript, ScriptParam } from "../../util/Scripting";
-import { ScriptingGlobals } from "../../util/ScriptingGlobals";
+import { CompileScript, Scripting, ScriptParam } from "../../util/Scripting";
 import { ScriptManager } from "../../util/ScriptManager";
 import { ContextMenu } from "../ContextMenu";
 import { ViewBoxAnnotatableComponent, ViewBoxAnnotatableProps } from "../DocComponent";
@@ -22,10 +21,15 @@ import { FieldView, FieldViewProps } from "../nodes/FieldView";
 import { OverlayView } from "../OverlayView";
 import { DocumentIconContainer } from "./DocumentIcon";
 import "./ScriptingBox.scss";
+import { TraceMobx } from "../../../fields/util";
 const _global = (window /* browser */ || global /* node */) as any;
 
+const ScriptingSchema = createSchema({});
+type ScriptingDocument = makeInterface<[typeof ScriptingSchema, typeof documentSchema]>;
+const ScriptingDocument = makeInterface(ScriptingSchema, documentSchema);
+
 @observer
-export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps & FieldViewProps>() {
+export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps & FieldViewProps, ScriptingDocument>(ScriptingDocument) {
 
     private dropDisposer?: DragManager.DragDropDisposer;
     protected _multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer | undefined;
@@ -38,9 +42,9 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatable
     @observable private _function: boolean = false;
     @observable private _spaced: boolean = false;
 
-    @observable private _scriptKeys: any = ScriptingGlobals.getGlobals();
-    @observable private _scriptingDescriptions: any = ScriptingGlobals.getDescriptions();
-    @observable private _scriptingParams: any = ScriptingGlobals.getParameters();
+    @observable private _scriptKeys: any = Scripting.getGlobals();
+    @observable private _scriptingDescriptions: any = Scripting.getDescriptions();
+    @observable private _scriptingParams: any = Scripting.getParameters();
 
     @observable private _currWord: string = "";
     @observable private _suggestions: string[] = [];
@@ -220,9 +224,9 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatable
 
         ScriptManager.Instance.addScript(this.dataDoc);
 
-        this._scriptKeys = ScriptingGlobals.getGlobals();
-        this._scriptingDescriptions = ScriptingGlobals.getDescriptions();
-        this._scriptingParams = ScriptingGlobals.getParameters();
+        this._scriptKeys = Scripting.getGlobals();
+        this._scriptingDescriptions = Scripting.getDescriptions();
+        this._scriptingParams = Scripting.getParameters();
     }
 
     // overlays document numbers (ex. d32) over all documents when clicked on
@@ -573,8 +577,8 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatable
         </div>;
     }
 
-    renderFuncListElement(value: string | object) {
-        return (typeof value !== "string") ? (null) : <div>
+    renderFuncListElement(value: string) {
+        return <div>
             <div style={{ fontSize: "14px" }}>
                 {value}
             </div>
-- 
cgit v1.2.3-70-g09d2

