Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
le0pard committed Apr 25, 2023
1 parent e310fbd commit c0c88bb
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"singleQuote": true,
"bracketSpacing": false,
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 100,
"trailingComma": "none",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ bundle exec rake wasm:inliner # build wasm inliner module
### Format svelte components

```bash
yarn prettier --write --plugin-search-dir=. ./assets/components/*
yarn prettier --write --plugin-search-dir=. ./src/components/*
```

### Benchmark parser
Expand Down
5 changes: 2 additions & 3 deletions src/components/DomInit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
activateTheme($theme)
})
const themeUnsubscribe = theme.subscribe(v => activateTheme(v))
const themeUnsubscribe = theme.subscribe((v) => activateTheme(v))
onDestroy(themeUnsubscribe)
onDestroy(themeUnsubscribe)
</script>

5 changes: 1 addition & 4 deletions src/components/EditorView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@
const getEditorState = (doc = '') => {
const [eTheme, eThemeHighLight] = (() => {
if ($isDarkThemeON) {
return [
oneDarkTheme,
syntaxHighlighting(oneDarkHighlightStyle, { fallback: true })
]
return [oneDarkTheme, syntaxHighlighting(oneDarkHighlightStyle, { fallback: true })]
}
return [
Expand Down
16 changes: 10 additions & 6 deletions src/components/Hotwire.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
const eventAbortController = new AbortController()
const { signal } = eventAbortController
// Before every page navigation, remove any previously added component hydration scripts
document.addEventListener('turbo:before-render', () => {
const scripts = document.querySelectorAll('script[data-astro-component-hydration]')
for (const script of scripts) {
script.remove()
}
}, { signal })
document.addEventListener(
'turbo:before-render',
() => {
const scripts = document.querySelectorAll('script[data-astro-component-hydration]')
for (const script of scripts) {
script.remove()
}
},
{ signal }
)
// After every page navigation, move the bundled styles into the body
// document.addEventListener('turbo:render', () => {
// const styles = document.querySelectorAll('link[href^="/assets/asset"][href$=".css"]')
Expand Down
26 changes: 18 additions & 8 deletions src/components/Parser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,38 @@
const eventAbortController = new AbortController()
const { signal } = eventAbortController
document.addEventListener('turbo:before-cache', () => {
isPageRendered = false
eventAbortController?.abort()
}, { signal, once: true })
document.addEventListener(
'turbo:before-cache',
() => {
isPageRendered = false
eventAbortController?.abort()
},
{ signal, once: true }
)
return () => eventAbortController?.abort()
})
</script>
{#if !window.WebAssembly}
<ErrorComponent title="Your browser do not support WebAssembly" message="Your browser do not support WebAssembly" />
<ErrorComponent
title="Your browser do not support WebAssembly"
message="Your browser do not support WebAssembly"
/>
{:else if !window.Worker}
<ErrorComponent title="Your browser do not support Web Workers" message="Your browser do not support Web Workers" />
<ErrorComponent
title="Your browser do not support Web Workers"
message="Your browser do not support Web Workers"
/>
{:else}
{#await getWebWorker()}
<div>loading...</div>
{:then webWorkerObject}
{#if isPageRendered}
<AppComponent webWorkerObject={webWorkerObject}>
<AppComponent webWorkerObject="{webWorkerObject}">
<slot slot="githubIcon" name="githubIcon" />
</AppComponent>
{/if}
{:catch error}
<ErrorComponent title="Error to load web worker" message={error.toString()} />
<ErrorComponent title="Error to load web worker" message="{error.toString()}" />
{/await}
{/if}
21 changes: 14 additions & 7 deletions src/components/ServiceWorker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
.sw-notification__icon--success {
color: hsl(137deg 55% 51%);
}
.sw-notification__icon--success:after, .sw-notification__icon--success:before {
content: "";
.sw-notification__icon--success:after,
.sw-notification__icon--success:before {
content: '';
background: currentColor;
display: block;
position: absolute;
Expand Down Expand Up @@ -192,8 +193,9 @@
height: 100%;
width: 100%;
}
.sw-notification__dismiss-btn:after, .sw-notification__dismiss-btn:before {
content: "";
.sw-notification__dismiss-btn:after,
.sw-notification__dismiss-btn:before {
content: '';
background: #fff;
height: 12px;
width: 2px;
Expand Down Expand Up @@ -261,16 +263,21 @@

{#if $needRefresh}
<div class="sw-notification" style="justify-content: flex-start; align-items: flex-end;">
<div class="sw-notification__toast sw-notification__toast--dismissible sw-notification__toast--upper sw-notification__toast--success">
<div
class="sw-notification__toast sw-notification__toast--dismissible sw-notification__toast--upper sw-notification__toast--success"
>
<div class="sw-notification__wrapper">
<div class="sw-notification__icon">
<i class="sw-notification__icon--success"></i>
</div>
<button on:click={update} class="sw-notification__message">
<button on:click="{update}" class="sw-notification__message">
New version available. Click to update
</button>
<div class="sw-notification__dismiss">
<button on:click={close} class="sw-notification__dismiss-btn" aria-label="Close update notification"></button>
<button
on:click="{close}"
class="sw-notification__dismiss-btn"
aria-label="Close update notification"></button>
</div>
</div>
<div class="sw-notification__ripple"></div>
Expand Down
10 changes: 2 additions & 8 deletions src/components/SplitView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
}
const handleHideLeftKey = (e) => {
if (e.key === ' ' ||
e.code === 'Space' ||
e.keyCode === 32
) {
if (e.key === ' ' || e.code === 'Space' || e.keyCode === 32) {
splitState.hideLeft()
}
}
Expand All @@ -24,10 +21,7 @@
}
const handleHideRightKey = (e) => {
if (e.key === ' ' ||
e.code === 'Space' ||
e.keyCode === 32
) {
if (e.key === ' ' || e.code === 'Space' || e.keyCode === 32) {
splitState.hideRight()
}
}
Expand Down

0 comments on commit c0c88bb

Please sign in to comment.