Skip to content

Commit

Permalink
refactor: rename stores.ts to stores.svelte.ts
Browse files Browse the repository at this point in the history
This will facilitate moving from stores to runes for app state
  • Loading branch information
mgreminger committed Dec 28, 2024
1 parent 4ebcec3 commit 9ab3da1
Show file tree
Hide file tree
Showing 32 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
history, insertedSheets, activeCell, getSheetJson, getSheetObject, resetSheet, sheetId,
mathCellChanged, nonMathCellChanged, addCell, prefersReducedMotion, modifierKey,
inCellInsertMode, config, unsavedChange, incrementActiveCell,
decrementActiveCell, deleteCell, activeMathField, autosaveNeeded, mathJaxLoaded } from "./stores";
decrementActiveCell, deleteCell, activeMathField, autosaveNeeded, mathJaxLoaded } from "./stores.svelte";
import { isDefaultConfig, type Config, normalizeConfig, type MathCellConfig, type Sheet, getDefaultConfig} from "./sheet/Sheet";
import type { Statement, SubQueryStatement } from "./parser/types";
import type { SystemDefinition } from "./cells/SystemCell.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/BaseUnitsConfigDialog.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { ComboBox, ButtonSet, Button } from "carbon-components-svelte";
import CheckmarkOutline from "carbon-icons-svelte/lib/CheckmarkOutline.svelte";
import { mathCellChanged } from "./stores";
import { mathCellChanged } from "./stores.svelte";
import { type CustomBaseUnits, baseUnitSystems, baseUnitChoices,
getDefaultBaseUnits, isDefaultBaseUnits } from "./sheet/Sheet";
Expand Down
2 changes: 1 addition & 1 deletion src/ButtonBar.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { addCell, onMobile, inCellInsertMode } from "./stores";
import { addCell, onMobile, inCellInsertMode } from "./stores.svelte";
import AddAlt from "carbon-icons-svelte/lib/AddAlt.svelte";
import AddComment from "carbon-icons-svelte/lib/AddComment.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/Cell.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import { cells, results, system_results, activeCell,
mathCellChanged, handleClickInCell, deleteCell } from "./stores";
mathCellChanged, handleClickInCell, deleteCell } from "./stores.svelte";
import type { ModalInfo } from "./types";
import type { MathCellConfig } from "./sheet/Sheet";
import MathCellElement from "./MathCell.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/CellList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { ModalInfo } from "./types";
import MathCell from "./cells/MathCell.svelte";
import type { MathCellConfig } from "./sheet/Sheet";
import { cells, results, system_results, activeCell, mathCellChanged } from "./stores";
import { cells, results, system_results, activeCell, mathCellChanged } from "./stores.svelte";
import Cell from "./Cell.svelte";
import ButtonBar from "./ButtonBar.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/DataTableCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
nonMathCellChanged,
results,
title
} from "./stores";
} from "./stores.svelte";
import { isFiniteImagResult, type Result,
type MatrixResult, isDataTableResult} from "./resultTypes";
Expand Down
2 changes: 1 addition & 1 deletion src/DataTableInput.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { FormEventHandler } from "svelte/elements";
import { modifierKey} from "./stores";
import { modifierKey} from "./stores.svelte";
interface Props {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/DeletedCell.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, onDestroy } from 'svelte';
import type DeletedCell from "./cells/DeletedCell";
import { cells, activeCell, results, system_results, mathCellChanged } from "./stores";
import { cells, activeCell, results, system_results, mathCellChanged } from "./stores.svelte";
export let index: number;
export let deletedCell: DeletedCell;
Expand Down
6 changes: 3 additions & 3 deletions src/DocumentTitle.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { activeCell, nonMathCellChanged } from "./stores.ts";
<script lang="ts">
import { activeCell, nonMathCellChanged } from "./stores.svelte";
let {title = $bindable()} = $props();
let {title = $bindable()}: {title: string} = $props();
let spellcheck = $state(false);
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentationCell.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { activeCell, nonMathCellChanged } from "./stores";
import { activeCell, nonMathCellChanged } from "./stores.svelte";
import type DocumentationCell from "./cells/DocumentationCell.svelte";
import DocumentationField from "./DocumentationField.svelte";
import { deltaToMarkdown } from "quill-delta-to-markdown";
Expand Down
2 changes: 1 addition & 1 deletion src/DocumentationField.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import Quill from "quill";
import { onMount } from "svelte";
import { modifierKey } from "./stores";
import { modifierKey } from "./stores.svelte";
interface Props {
hideToolbar: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/FluidCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
activeCell,
mathCellChanged,
config
} from "./stores";
} from "./stores.svelte";
import { onMount } from "svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/GenerateCodeDialog.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { unit } from 'mathjs';
import { results, cells, mathCellChanged } from './stores';
import { results, cells, mathCellChanged } from './stores.svelte';
import type { CodeFunctionQueryStatement } from './parser/types';
import type { Cell } from './cells/Cells';
import MathCell from './cells/MathCell.svelte';
Expand Down
2 changes: 1 addition & 1 deletion src/IconButton.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import { modifierKey } from './stores';
import { modifierKey } from './stores.svelte';
interface Props {
title?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/InsertCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
import type InsertCell from "./cells/InsertCell";
import { cells, activeCell, results, system_results, mathCellChanged,
inCellInsertMode, addCell, onMobile, modifierKey } from "./stores";
inCellInsertMode, addCell, onMobile, modifierKey } from "./stores.svelte";
import type { CellTypes } from "./cells/BaseCell";
import AddAlt from "carbon-icons-svelte/lib/AddAlt.svelte";
Expand Down
4 changes: 2 additions & 2 deletions src/KeyboardButton.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import { onMount } from "svelte";
import { onMobile, activeMathField } from "./stores";
import { onMobile, activeMathField } from "./stores.svelte";
import { renderMathInElement } from "mathlive";
import type { Button } from "./keyboard/Keyboard";
import type { MathField } from "./cells/MathField";
import type { MathField } from "./cells/MathField.svelte";
interface Props {
button: Button;
Expand Down
2 changes: 1 addition & 1 deletion src/KeyboardShortcuts.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { modifierKey } from "./stores";
import { modifierKey } from "./stores.svelte";
const modifier = $modifierKey === "ctrlKey" ? "Ctrl" : "Cmd"
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/MathCell.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, untrack } from "svelte";
import { bignumber, format, unaryMinus, type BigNumber, type FormatOptions } from "mathjs";
import { cells, results, sub_results, resultsInvalid, activeCell, mathCellChanged, config } from "./stores";
import { cells, results, sub_results, resultsInvalid, activeCell, mathCellChanged, config } from "./stores.svelte";
import { isFiniteImagResult, type Result, type FiniteImagResult,
type PlotResult, type MatrixResult, isMatrixResult,
type DataTableResult,
Expand Down
2 changes: 1 addition & 1 deletion src/MathCellConfigDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RadioButtonGroup, RadioButton } from "carbon-components-svelte";
import { defaultConfig, copyMathConfig, isDefaultMathConfig,
type MathCellConfig, getSafeMathConfig, mathConfigLimits } from "./sheet/Sheet";
import { unsavedChange, autosaveNeeded, mathCellChanged } from "./stores";
import { unsavedChange, autosaveNeeded, mathCellChanged } from "./stores.svelte";
export let mathCellConfig: MathCellConfig | null;
export let cellLevelConfig = false;
Expand Down
2 changes: 1 addition & 1 deletion src/MathField.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
import { modifierKey, activeMathField, resultsInvalid } from "./stores";
import { modifierKey, activeMathField, resultsInvalid } from "./stores.svelte";
import type { MathField } from "./cells/MathField.svelte";
import type { MathfieldElement } from "mathlive";
Expand Down
2 changes: 1 addition & 1 deletion src/PiecewiseCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cells,
activeCell,
mathCellChanged
} from "./stores";
} from "./stores.svelte";
import { onMount, tick } from "svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/Plot.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { untrack } from 'svelte';
import { onMobile, mathJaxLoaded } from './stores';
import { onMobile, mathJaxLoaded } from './stores.svelte';
import { debounce } from './utility';
import { pngIcon, svgIcon } from './customPlotButtonIcons';
Expand Down
2 changes: 1 addition & 1 deletion src/PlotCell.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount } from "svelte";
import { cells, results, activeCell, mathCellChanged,
nonMathCellChanged, resultsInvalid} from "./stores";
nonMathCellChanged, resultsInvalid} from "./stores.svelte";
import { type Result, type FiniteImagResult, type MatrixResult, type DataTableResult, isPlotResult } from "./resultTypes";
import PlotCell from "./cells/PlotCell.svelte";
import type { MathField as MathFieldClass } from "./cells/MathField.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/SetDefaultConfigDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Checkmark from "carbon-icons-svelte/lib/Checkmark.svelte";
import Information from "carbon-icons-svelte/lib/Information.svelte";
import { type Config, configsEqual, getDefaultConfig, normalizeConfig, isDefaultConfig } from "./sheet/Sheet";
import { config } from "./stores";
import { config } from "./stores.svelte";
import RequestPersistentStorage from "./RequestPersistentStorage.svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/SystemCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
system_results,
activeCell,
mathCellChanged
} from "./stores";
} from "./stores.svelte";
import { onMount, tick } from "svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/TableCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
activeCell,
mathCellChanged,
nonMathCellChanged,
} from "./stores";
} from "./stores.svelte";
import { onMount, tick } from "svelte";
Expand Down
2 changes: 1 addition & 1 deletion src/TextBox.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { FormEventHandler } from "svelte/elements";
import { modifierKey} from "./stores";
import { modifierKey} from "./stores.svelte";
interface Props {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/TextCheckbox.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { modifierKey } from "./stores";
import { modifierKey } from "./stores.svelte";
interface Props {
checked: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/Updates.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { SettingsAdjust, Download, RowCollapse } from "carbon-icons-svelte";
import { modifierKey } from "./stores";
import { modifierKey } from "./stores.svelte";
const modifier = $modifierKey === "ctrlKey" ? "Ctrl" : "Cmd"
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/VirtualKeyboard.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import { onMobile } from "./stores";
import { onMobile } from "./stores.svelte";
import { type Keyboards, type Buttons, Button } from "./keyboard/Keyboard";
import KeyboardButton from './KeyboardButton.svelte';
import Self from './VirtualKeyboard.svelte';
import type { MathField } from "./cells/MathField";
import type { MathField } from "./cells/MathField.svelte";
interface Props {
keyboards: Keyboards;
Expand Down
3 changes: 2 additions & 1 deletion src/keyboard/Keyboard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {MathField} from '../cells/MathField.svelte';
import { get } from 'svelte/store';
import { onMobile } from '../stores';
import { onMobile } from '../stores.svelte';


export type Keyboards = {
Expand Down Expand Up @@ -71,6 +71,7 @@ export class Button {
} else if (this.command === "customMatrix") {
return("customMatrix");
} else if (this.command === "showMenu") {
//@ts-ignore: 2554
mathLiveField.showMenu();
} else {
mathLiveField.executeCommand([this.command]);
Expand Down
File renamed without changes.

0 comments on commit 9ab3da1

Please sign in to comment.