-
-
Notifications
You must be signed in to change notification settings - Fork 183
refactor: migrate to Svelte 5 #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e009fcb
chore(svelte5): slice 1 — bump to svelte 5 + svelte-check 4, wire com…
chhoumann 5af3320
feat(svelte5): slice 2 — shared mount harness + dnd-reorder utils
chhoumann e10f621
feat(svelte5): slice 3 — convert ObsidianIcon to runes
chhoumann 98d080f
feat(svelte5): slice 4 — macro cluster + CommandSequenceEditor host t…
chhoumann 459b255
feat(svelte5): slice 5 — recursive choiceList cluster to runes
chhoumann 71bde5e
feat(svelte5): slice 6 — remaining components + hosts to runes/mount
chhoumann 35c340b
chore(svelte5): slice 7 — lint .svelte with eslint-plugin-svelte + cl…
chhoumann 7d6fece
fix(svelte5): persist conditional then/else branch edits (+configure-…
chhoumann 3bd4a5a
test(e2e): real-GUI regression test for conditional Then-branch persi…
chhoumann c79fb5b
docs(svelte5): correct stale smoke-test comments after ObsidianIcon r…
chhoumann 08d6304
chore(svelte5): add minimal svelte.config.js for check/test/lint tooling
chhoumann 47c1a0c
refactor(svelte5): replace as-any casts in ChoiceView with an isMulti…
chhoumann dc940f7
refactor(svelte5): compile-time guard for the $state.snapshot persist…
chhoumann 8d61ac8
fix(svelte5): unload markdown-render Component on destroy in choice rows
chhoumann 7773f15
chore: stop tracking Claude Code runtime state (.claude/scheduled_tas…
chhoumann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
| /** | ||
| * Props for FolderList, shared with its imperative host (templateChoiceBuilder). | ||
| * The host owns a $state-backed instance and mutates `folders` to push add/remove | ||
| * updates into the mounted component — replacing FolderList's old exported | ||
| * `updateFolders()` bridge (which reassigned a prop, illegal under runes). | ||
| */ | ||
| export interface FolderListProps { | ||
| folders: string[]; | ||
| deleteFolder: (folder: string) => void; | ||
| } | ||
|
|
||
| export function createFolderListProps(initial: FolderListProps): FolderListProps { | ||
| const props = $state(initial); | ||
| return props; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| import { describe, expect, it, vi } from "vitest"; | ||
| import { fireEvent, render } from "@testing-library/svelte"; | ||
|
|
||
| vi.mock("obsidian-dataview", () => ({ getAPI: vi.fn() })); | ||
|
|
||
| import { App } from "obsidian"; | ||
| import CommandList from "./CommandList.svelte"; | ||
| import { createCommandListProps } from "./commandListProps.svelte"; | ||
| import { ConditionalCommand } from "../../types/macros/Conditional/ConditionalCommand"; | ||
| import { WaitCommand } from "../../types/macros/QuickCommands/WaitCommand"; | ||
|
|
||
| describe("CommandList conditional branch persistence", () => { | ||
| // Regression: the branch modal mutates the command, but the command rendered by | ||
| // CommandList is a $state proxy that does NOT write through to the host's | ||
| // commandsRef. CommandList must persist the mutation via saveCommands(snapshot). | ||
| it("persists then-branch edits through saveCommands as a plain snapshot", async () => { | ||
| const cond = new ConditionalCommand(); | ||
| const saveCommands = vi.fn(); | ||
|
|
||
| const props = createCommandListProps({ | ||
| commands: [cond], | ||
| app: new App() as never, | ||
| plugin: {} as never, | ||
| deleteCommand: vi.fn(), | ||
| saveCommands, | ||
| // Simulate the branch editor mutating the command and reporting "changed". | ||
| onEditThenBranch: (command) => { | ||
| command.thenCommands = [new WaitCommand(100)]; | ||
| return true; | ||
| }, | ||
| }); | ||
|
|
||
| const { getByLabelText } = render(CommandList, { props }); | ||
| await fireEvent.click(getByLabelText("Edit then branch")); | ||
|
|
||
| await vi.waitFor(() => expect(saveCommands).toHaveBeenCalledTimes(1)); | ||
| const saved = saveCommands.mock.calls[0][0] as Array<{ thenCommands?: unknown[] }>; | ||
| expect(saved[0].thenCommands).toHaveLength(1); | ||
| // The persisted payload must be a plain snapshot (no $state Proxy artifacts). | ||
| expect(JSON.parse(JSON.stringify(saved))).toEqual(saved); | ||
| }); | ||
|
|
||
| it("does NOT save when the branch handler reports no change", async () => { | ||
| const cond = new ConditionalCommand(); | ||
| const saveCommands = vi.fn(); | ||
|
|
||
| const props = createCommandListProps({ | ||
| commands: [cond], | ||
| app: new App() as never, | ||
| plugin: {} as never, | ||
| deleteCommand: vi.fn(), | ||
| saveCommands, | ||
| onEditThenBranch: () => false, | ||
| }); | ||
|
|
||
| const { getByLabelText } = render(CommandList, { props }); | ||
| await fireEvent.click(getByLabelText("Edit then branch")); | ||
| await Promise.resolve(); | ||
|
|
||
| expect(saveCommands).not.toHaveBeenCalled(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.