Skip to content

Commit c8adbfb

Browse files
authored
Merge branch 'main' into main
2 parents 26dde83 + e9fcb88 commit c8adbfb

10 files changed

+167
-8
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"private": true,
6161
"dependencies": {
6262
"@babel/core": "^7.17.0",
63+
"@codemirror/tooltip": "^0.19.16",
6364
"@electron/remote": "^2.0.4",
6465
"@rollup/plugin-commonjs": "^21.0.1",
6566
"codemirror": "^5.65.1",

public/global.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ textarea {
4848
box-sizing: border-box;
4949
border: 1px solid #ccc;
5050
border-radius: 2px;
51-
color: white;
51+
color: rgb(0, 0, 0);
5252
}
5353

5454
input:disabled {

public/svelte.css

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.svelte

+83-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
33
import XTerm from "./XTerm.svelte";
44
import Editor from "./CodeEditor/Editor.svelte";
55
import StateManager from "./StateManager/StateManager.svelte";
6+
const { remote, ipcRenderer, BrowserWindow } = require("electron");
7+
8+
import searchDoc from "./SearchProgram.js";
9+
// import docsBool from "./application-menu.js";
10+
11+
// export let docsBool = false;
12+
let docsBool = false;
13+
// const handleDocuments = () => {
14+
// // submit = false;
15+
// console.log("handledocs fired");
16+
// docsBool = !docsBool;
17+
// // return false;
18+
// };
19+
20+
let documentation;
21+
let url;
22+
$: documentation = `https://svelte.dev/docs#${url}`;
23+
let textVal;
24+
function searchDocumentation(value) {
25+
let result;
26+
for (let item in searchDoc) {
27+
if (searchDoc[item][0].includes(value)) {
28+
console.log("congrats!");
29+
result = item;
30+
return result;
31+
}
32+
}
33+
}
634
import { onMount } from "svelte";
735
import searchDoc from "./SearchProgram.js";
836
@@ -120,6 +148,7 @@
120148
x_pos = e.x;
121149
y_pos = e.y;
122150
151+
123152
if (panel === "horizontal-divider") {
124153
if (resizeObj[panel].isResizing === true) {
125154
resize(e, "horizontal-divider");
@@ -164,6 +193,7 @@
164193
dragStart(e, "editor-divider")
165194
);
166195
196+
167197
filedirDivider.addEventListener("mouseover", (e) =>
168198
chgCursor(e, "filedir-divider")
169199
);
@@ -178,6 +208,7 @@
178208
dragStart(e, "statemgr-divider")
179209
);
180210
211+
181212
//==========END - WORKING CODE FOR RESIZING DOM ELEMENTS USING DIVIDERS===========//
182213
183214
//ST-2022-RJ Setting xterm layers to have 100% width so risizing able to be dynamic - overwriting default styles onMount and
@@ -187,7 +218,7 @@
187218
let currentStyle = item.getAttribute("style").split(";"); //Array of each style attribute string
188219
for (let i = 0; i < currentStyle.length; i++) {
189220
const style = currentStyle[i];
190-
// console.log(style.indexOf('width'));
221+
191222
if (style.indexOf("width") !== -1) currentStyle[i] = "width: 100%";
192223
}
193224
item.setAttribute("style", currentStyle.join(";"));
@@ -211,6 +242,12 @@
211242
submit = false;
212243
return false;
213244
};
245+
export const handleDocuments = () => {
246+
// submit = false;
247+
console.log("the handleDocs is firing");
248+
docsBool = !docsBool;
249+
// return false;
250+
};
214251
215252
const handleKeyup = (event) => {
216253
submit = false;
@@ -227,10 +264,12 @@
227264
submit = false;
228265
console.log("handlekeyup 2", textVal);
229266
267+
230268
// event.preventDefault();
231269
232270
url = searchDocumentation(textVal);
233271
272+
234273
console.log("this is the url", searchDocumentation(textVal));
235274
documentation = `https://svelte.dev/docs#"${url}/`;
236275
documentation = documentation;
@@ -242,6 +281,7 @@
242281
docsBool = !docsBool;
243282
// return false;
244283
};
284+
245285
</script>
246286

247287
<body class:orientation>
@@ -276,6 +316,7 @@
276316
>
277317
</div>
278318
<iframe class="docs" title="test" src={documentation} />
319+
279320
{/if}
280321
{#if docsBool === false}
281322
<div class="parent grid-parent">
@@ -285,6 +326,7 @@
285326
type="text"
286327
on:submit|preventDefault={handleKeyup}
287328
/>
329+
288330
<button
289331
type="button"
290332
class="childButton"
@@ -307,8 +349,10 @@
307349
frameBorder="0"
308350
/>
309351
{/if}
352+
310353
</form>
311354
</div>
355+
<div />
312356
</div>
313357
<div id="horizontal-divider" />
314358
<div class="box wrapper-bottom">
@@ -328,6 +372,23 @@
328372
height: 100%;
329373
width: 100%;
330374
}
375+
.grid-parent {
376+
/* display: grid;
377+
grid-template-columns: 1fr 1fr; */
378+
float: left;
379+
}
380+
/* .inline-flex-parent {
381+
display: inline-flex;
382+
justify-content: flex-start;
383+
}
384+
.search1 {
385+
justify-content: center;
386+
/* padding-left: 200px; */
387+
/* } */
388+
/* .search2 {
389+
padding-right: 150px;
390+
} */
391+
331392
/*2022-ST-RJ Restructured CSS to use flex rather than grid so dynamic window resizing works appropriately /*
332393
/* Wrapper Window - SvelteTeam */
333394
.wrapper {
@@ -411,20 +472,34 @@
411472
font-size: small;
412473
border-style: inset;
413474
border-color: grey;
475+
414476
}
415477
#filedir-divider {
416478
height: 100%;
417479
width: 1px;
480+
418481
}
419482
420483
#editor-divider {
421484
height: 100%;
422485
width: 1px;
486+
423487
}
424488
425489
#statemgr-divider {
426490
height: 100%;
427491
width: 1px;
492+
493+
}
494+
button {
495+
background-color: transparent;
496+
background-repeat: no-repeat;
497+
border: none;
498+
cursor: pointer;
499+
overflow: hidden;
500+
outline: none;
501+
font-size: small;
502+
color: white;
428503
}
429504
430505
.box {
@@ -509,6 +584,13 @@
509584
background-color: #0d1117;
510585
/* pointer-events: none; */
511586
}
587+
.docs {
588+
overflow: auto;
589+
/* resize: vertical; */
590+
height: 100%;
591+
width: 98%;
592+
color: "grey";
593+
}
512594
513595
.b :global(.childClass) {
514596
overflow: scroll;

src/CodeEditor/CodeMirror.svelte

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040
let src;
4141
let showToolTip;
4242
let containerElt;
43+
4344
let showToolTripTransition = false;
4445
let noUpdate = false;
4546
47+
4648
function searchDocumentation(value) {
4749
if (!value || value === " ") {
4850
tipContent = " ";
@@ -64,14 +66,14 @@
6466
return false;
6567
}
6668
67-
// let toolTipDiv;
6869
src = `https://svelte.dev/docs#`;
6970
function onHover() {
7071
let word;
7172
if (stillMouse && searchDocumentation(lastWord) !== false) {
7273
let searchObj = searchDocumentation(lastWord);
7374
src = `https://svelte.dev/docs#${searchObj.url}`;
7475
showToolTip = true;
76+
7577
tipContent = `${searchObj.tip}`;
7678
// console.log("this is tipcont", tipContent);
7779
noUpdate = true;
@@ -105,6 +107,7 @@
105107
return;
106108
}
107109
110+
108111
setInterval(() => {
109112
hoverTest();
110113
onHover();
@@ -168,6 +171,7 @@
168171
console.log("ipcRenderer complete");
169172
});
170173
174+
171175
function handleMousMove(e) {
172176
// console.log("here is the event listener in handleMouseMove", e);
173177
if (hoverCounter - lastHoverCounter > 12) {
@@ -187,7 +191,7 @@
187191
);
188192
}
189193
function onType() {
190-
// console.log("this is the key down event");
194+
191195
hoverCounter += 13;
192196
}
193197
</script>
@@ -214,7 +218,6 @@
214218
}
215219
216220
#textarea {
217-
/* width: 100%; */
218221
position: relative;
219222
z-index: 1;
220223
}

src/CodeEditor/Editor.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174

175175
{#if $openTabs.length > 0}
176176
<div class="editor-body">
177+
177178
<CodeMirror
178179
class="childClass current"
179180
bind:value={$openTabs[activeEditor].editorValue}
@@ -230,7 +231,6 @@
230231
cursor: pointer;
231232
font-size: 12px;
232233
}
233-
234234
.tab-span:hover {
235235
border-color: #e9ecef #e9ecef #dee2e6;
236236
}

src/SearchProgram.js

+8
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,14 @@ const searchDoc = {
247247
"<svelte:head>",
248248
"svelte:head",
249249
], ["This makes it possible to insert elements into document.head. As with <svelte:window> and <svelte:body>, it may only appear at the top level of your component. 'Svelte head' syntax: <svelte:head>...</svelte:head>"]],
250+
250251
"template-syntax-svelte-options": [[
251252
"<svelte options>",
252253
"svelte options",
253254
"<svelte:options>",
254255
"svelte:options",
255256
], ["This provides a place to specify per-component compiler options, which are detailed in the compiler section. 'Svelte options' syntax: <svelte:options option={value}/>"]],
257+
256258
"template-syntax-svelte-fragment": [[
257259
"<svelte fragment>",
258260
"svelte fragment",
@@ -267,6 +269,7 @@ const searchDoc = {
267269
"before update",
268270
"beforeUpdate",
269271
], ["beforeUpdate schedules a callback to run immediately before the component is updated after any state change. 'beforeUpdate' syntax: beforeUpdate(callback: () => void)"]],
272+
270273
"run-time-svelte-afterupdate": [[
271274
"afterupdate",
272275
"after update",
@@ -283,6 +286,7 @@ const searchDoc = {
283286
"getallcontext",
284287
"getallcontexts",
285288
], ["Retrieves the whole context map that belongs to the closest parent component. Must be called during component initialisation.'getAllContexts' syntax: contexts: Map<any, any> = getAllContexts()"]],
289+
286290
"run-time-svelte-createeventdispatcher": [[
287291
"create event dispatcher",
288292
"event dispatcher",
@@ -323,6 +327,7 @@ const searchDoc = {
323327
"transition",
324328
"svelte transition",
325329
], ["The svelte/transition module exports seven functions: fade, blur, fly, slide, scale, draw and crossfade. They are for use with Svelte transitions."]],
330+
326331
"run-time-svelte-transition-fade": [[
327332
"fade transition",
328333
"transition fade",
@@ -371,18 +376,21 @@ const searchDoc = {
371376
"svelte animate",
372377
"run time svelte animate",
373378
], ["The svelte/animate module exports one function for use with Svelte animations. 'Animate' syntax: animate:flip={params}"]],
379+
374380
"run-time-svelte-animate-flip": [[
375381
"animate flip",
376382
"run time animate flip",
377383
"svelte animate flip",
378384
"run time svelte animate flip",
379385
"flip",
380386
], []],
387+
381388
"run-time-svelte-easing": [["easing", "run time easing", "svelte easing"], ["Easing functions specify the rate of change over time and are useful when working with Svelte's built-in transitions and animations as well as the tweened and spring utilities."]],
382389
"run-time-svelte-register": [["register", "run time register", "svelte register"], ["To render Svelte components in Node.js without bundling, use require('svelte/register'). After that, you can use require to include any .svelte file."]],
383390
"run-time-client-side-component-api": [["component api", "api", "client side api", "client side", "client side component", "client side component api"], ["A client-side component — that is, a component compiled with generate: 'dom' (or the generate option left unspecified) is a JavaScript class."]],
384391
"run-time-client-side-component-api-creating-a-component": [["create api component", "api component", "creating api component", "creating an api component"], []],
385392
"run-time-client-side-component-api-$set": [["$set", "api $set"], ["Programmatically sets props on an instance. component.$set({ x: 1 }) is equivalent to x = 1 inside the component's <script> block. '$set' syntax: component.$set(props)"]],
393+
386394
"run-time-client-side-component-api-$on": [["$on", "api $on"], []],
387395
"run-time-client-side-component-api-$destroy": [["$destroy", "api $destroy"], []],
388396
"run-time-client-side-component-api-component-props": [["api component props", "api props"], []],

src/application-menu.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
const { app, BrowserWindow, dialog, Menu } = require('electron');
2+
const main = require('electron-reload');
23
const mainProcess = require('./index.js');
3-
4+
// const handleDocuments = require('./App.svelte');
5+
// export let docsBool = false;
6+
// export const handleDocuments = () => {
7+
// // submit = false;
8+
// console.log('handledocs fired')
9+
// docsBool = !docsBool;
10+
// // return false;
11+
// };
412
const createApplicationMenu = () => {
513
const hasOneOrMoreWindows = !!BrowserWindow.getAllWindows().length;
614
const focusedWindow = BrowserWindow.getFocusedWindow();
@@ -193,6 +201,21 @@ const createApplicationMenu = () => {
193201
if(focusedWindow) require('electron').shell.openExternal('https://svelte-storm.com/')
194202
}
195203
},
204+
{
205+
label: 'Svelte Docs',
206+
click(focusedWindow) {
207+
// console.log('this is in the application menu')
208+
209+
if (focusedWindow) {
210+
mainProcess.testFunc()
211+
// handleDocuments()
212+
// require('electron').shell.openExternal('https://svelte.dev/docs')
213+
214+
console.log('this is in the application menu')
215+
}
216+
// require('electron').shell.openExternal('https://svelte.dev/docs')
217+
}
218+
},
196219
{
197220
label: 'Toggle Developer Tools',
198221
accelerator: 'CommandOrControl+D',

0 commit comments

Comments
 (0)