Skip to content

Commit

Permalink
refactor: move katex component out of lib to reduce bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
EricRovell committed Oct 8, 2023
1 parent 552e603 commit 6345196
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/content/blogpost/radix/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as FormNumerals } from "./form-numerals/FormNumerals.svelte";
export { default as Number } from "./number/Number.svelte";
export { default as Numerals } from "./numerals/Numerals.svelte";
export { default as MathExp } from "./math.svelte";
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<script lang="ts">
import { createEventDispatcher, getContext } from "svelte";
import { fade } from "svelte/transition";
import { Button, MathExp } from "@components";
import { Number } from "../../components";
import { Button } from "@components";
import { Number, MathExp } from "../../components";
import Keyboard from "./Keyboard.svelte";
import { randInt } from "@utils/random";
import { radix } from "@ericrovell/radix";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import { getContext } from "svelte";
import { MathExp } from "@components";
import { FormNumerals } from "../../components";
import { FormNumerals, MathExp } from "../../components";
import { getConversionStages, getRanks } from "./decimal-conversion-stages.helpers";
import { buildMathDifferences, buildMathPowerInequalities, buildMathRanks } from "./decimal-conversion-stages.katex";
import styles from "./decimal-conversion-stages.module.css";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import { getContext } from "svelte";
import { radix } from "@ericrovell/radix";
import { MathExp } from "@components";
import { FormNumerals, Number, Numerals } from "../../components";
import { FormNumerals, Number, Numerals, MathExp } from "../../components";
import { decoder } from "../../util";
import styles from "./number-into-decimal.module.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</script>

<script lang="ts">
import { MathExp } from "@components";
import MathExp from "../math.svelte";
export let type: FStop = "f-number";
export let fstop = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script lang="ts">
import katex from "katex";
export let math: string;
export let inline = false;
$: rendered = katex.renderToString(math, {
throwOnError: false,
displayMode: inline
});
</script>

{@html rendered}
1 change: 0 additions & 1 deletion src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export { InputNumber } from "./input-number";
export { InputText } from "./input-text";
export { InputSelect } from "./input-select";
export { Link } from "./link";
export { MathExp } from "./math";
export * as Menu from "./menu";
export { MenuIndicator } from "./menu-indicator";
export { Meta, PageMeta, type MetaProps } from "./meta";
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/math/index.ts

This file was deleted.

0 comments on commit 6345196

Please sign in to comment.