Skip to content

Commit

Permalink
wc: fix expansion; fold main.js into index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Jun 5, 2024
1 parent 6ec6337 commit ddfc2ba
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 123 deletions.
13 changes: 12 additions & 1 deletion frontend/src/calc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
<body>
<div id="app" class="min-h-screen"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";

import App from "./Calc.svelte";
import { mount } from "svelte";

const args = {
target: document.getElementById("app"),
};
const app = mount(App, args);
export default app;

</script>
</body>

Expand Down
10 changes: 0 additions & 10 deletions frontend/src/calc/main.js

This file was deleted.

13 changes: 12 additions & 1 deletion frontend/src/fm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";

import fm from "./fm.svelte";
import { mount } from "svelte";

const args = {
target: document.getElementById("app"),
};
const app = mount(fm, args);
export default app;

</script>
</body>

Expand Down
10 changes: 0 additions & 10 deletions frontend/src/fm/main.js

This file was deleted.

13 changes: 12 additions & 1 deletion frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "./base.css";

import App from "./Main.svelte";
import { mount } from "svelte";

const args = {
target: document.getElementById("app"),
};
const app = mount(App, args);
export default app;

</script>

</body>
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/main.js

This file was deleted.

9 changes: 8 additions & 1 deletion frontend/src/qrscanner/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";
import App from "./qrscanner.svelte";
const args = {
target: document.getElementById("app"),
};
const app = new App(args);
console.log("app:", app);
</script>
</body>

Expand Down
9 changes: 0 additions & 9 deletions frontend/src/qrscanner/main.js

This file was deleted.

12 changes: 11 additions & 1 deletion frontend/src/reader/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";

import Unzip from "./ComicBookReader.svelte";

const args = {
target: document.getElementById("app"),
};
const app = new Unzip(args);
console.log(app);

</script>
</body>

Expand Down
9 changes: 0 additions & 9 deletions frontend/src/reader/main.js

This file was deleted.

13 changes: 12 additions & 1 deletion frontend/src/unzip/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";

import Unzip from "./Unzip.svelte";
import { mount } from "svelte";

const args = {
target: document.getElementById("app"),
};
const app = mount(Unzip, args);
export default app;

</script>
</body>

Expand Down
10 changes: 0 additions & 10 deletions frontend/src/unzip/main.js

This file was deleted.

98 changes: 50 additions & 48 deletions frontend/src/wc/Folder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -262,61 +262,63 @@
}
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
{#each entries as e, idx}
{@const name = fs.entryName(e)}
{@const size = fs.entryMeta(e, "size") || 0}
{@const metaDirs = fs.entryMeta(e, "dirs") || 0}
{@const metaFiles = fs.entryMeta(e, "files") || 0}
{@const metaLineCount = fs.entryMeta(e, "linecount") || 0}
{@const isDir = fs.entryIsDir(e)}
{@const excluded = isExcluded(fs, e)}
{#if isDir}
<tr
on:click={() => toggleExpand(fs, e)}
class="hover:bg-gray-200 hover:cursor-pointer pl-8"
>
<td class="ind-{indent} font-semibold">
{#if isExpanded(fs, e)}
{:else}
{/if}
{name}
</td>
<td class="pl-2 text-right whitespace-nowrap">
{fmtSize(size)}
</td>
<td class="pl-2 text-right">{fmtNum(metaDirs)}</td>
<td class="pl-2 text-right">{fmtNum(metaFiles)}</td>
<td class="pl-2 text-right">{fmtNum(metaLineCount)}</td>
<td class="text-center bg-white"
><button
on:click|stopPropagation={() => deleteDirOrFile(idx)}
class="hover:underline px-4 hover:text-red-600">delete</button
></td
{#key entries}
<!-- svelte-ignore a11y-click-events-have-key-events -->
{#each entries as e, idx}
{@const name = fs.entryName(e)}
{@const size = fs.entryMeta(e, "size") || 0}
{@const metaDirs = fs.entryMeta(e, "dirs") || 0}
{@const metaFiles = fs.entryMeta(e, "files") || 0}
{@const metaLineCount = fs.entryMeta(e, "linecount") || 0}
{@const isDir = fs.entryIsDir(e)}
{@const excluded = isExcluded(fs, e)}
{#if isDir}
<tr
on:click={() => toggleExpand(fs, e)}
class="hover:bg-gray-200 hover:cursor-pointer pl-8"
>
{#if excluded}
<td class="text-center bg-white"
><button
on:click|stopPropagation={() => doExclude(e, false)}
class="hover:underline px-4 text-blue-600">include</button
></td
>
{:else}
<td class="ind-{indent} font-semibold">
{#if isExpanded(fs, e)}
{:else}
{/if}
{name}
</td>
<td class="pl-2 text-right whitespace-nowrap">
{fmtSize(size)}
</td>
<td class="pl-2 text-right">{fmtNum(metaDirs)}</td>
<td class="pl-2 text-right">{fmtNum(metaFiles)}</td>
<td class="pl-2 text-right">{fmtNum(metaLineCount)}</td>
<td class="text-center bg-white"
><button
on:click|stopPropagation={() => doExclude(e, true)}
class="hover:underline px-4">exclude</button
on:click|stopPropagation={() => deleteDirOrFile(idx)}
class="hover:underline px-4 hover:text-red-600">delete</button
></td
>
{#if excluded}
<td class="text-center bg-white"
><button
on:click|stopPropagation={() => doExclude(e, false)}
class="hover:underline px-4 text-blue-600">include</button
></td
>
{:else}
<td class="text-center bg-white"
><button
on:click|stopPropagation={() => doExclude(e, true)}
class="hover:underline px-4">exclude</button
></td
>
{/if}
</tr>
{#if isExpanded(fs, e)}
<svelte:self {fs} {recalc} dirRoot={e} indent={indent + 1} />
{/if}
</tr>
{#if isExpanded(fs, e)}
<svelte:self {fs} {recalc} dirRoot={e} indent={indent + 1} />
{/if}
{/if}
{/each}
{/each}
{/key}

{#each entries as e, idx (idx)}
{@const name = fs.entryName(e)}
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/wc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
<body>
<div id="app"></div>

<script type="module" src="./main.js">
<script type="module">
import "../base.css";

import App from "./wc.svelte";
import { mount } from "svelte";

const args = {
target: document.getElementById("app"),
};
const app = mount(App, args);
export default app;

</script>
</body>

Expand Down
10 changes: 0 additions & 10 deletions frontend/src/wc/main.js

This file was deleted.

0 comments on commit ddfc2ba

Please sign in to comment.