-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5669be3
commit 2fdadf3
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte'; | ||
import { type Segment, splitSentenceIntoSegments } from './split-sentence'; | ||
import * as styles from './style.css'; | ||
export let source: string; | ||
let segments: Segment[] = []; | ||
onMount(() => { | ||
segments = splitSentenceIntoSegments(source.trim()); | ||
}); | ||
</script> | ||
|
||
<div lang="zh-CN" class={styles.container}> | ||
<div aria-hidden="true" class={styles.pinyinLine}> | ||
<!-- hidden blocks --> | ||
</div> | ||
<div class={styles.zhCharLine}> | ||
{#each segments as segment} | ||
{#if segment.type === 'zh'} | ||
<!-- zh blocks --> | ||
{segment.zhChars} | ||
{:else} | ||
<span class={styles.visibleNonZhBlock}>{segment.nonZhChars}</span> | ||
{/if} | ||
{/each} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; | ||
|
||
/** @type {import('@sveltejs/vite-plugin-svelte').Options} */ | ||
const config = { | ||
preprocess: vitePreprocess(), | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters