-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize editor modes relative entities ids
- Loading branch information
1 parent
07244f4
commit a93eac2
Showing
15 changed files
with
91 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from "./ArchiveDriver"; | ||
export * from "./ImageDriver"; | ||
export * from "./ToolbarMode"; | ||
export * from "./ImageDriver"; |
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
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
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,46 @@ | ||
import {Id} from "@type"; | ||
import {ValidComponent, Signal, Accessor, Setter, createSignal} from "solid-js"; | ||
|
||
type Toolbar = { | ||
name: string; | ||
component: ValidComponent; | ||
id: Signal<Id | null>; | ||
getId: Accessor<Id | null>; | ||
setId: Setter<Id | null>; | ||
}; | ||
|
||
export class ToolbarMode { | ||
private forms: {[key: Id]: Toolbar} = {}; | ||
|
||
getCurrent: Accessor<Toolbar | null>; | ||
|
||
setCurrent: Setter<Toolbar | null>; | ||
|
||
constructor(toolbar: {id: Id; name: string; component: ValidComponent}[]) { | ||
const [getCurrent, setCurrent] = createSignal<Toolbar | null>(null); | ||
this.getCurrent = getCurrent; | ||
this.setCurrent = setCurrent; | ||
|
||
toolbar.forEach((toolbar) => { | ||
const {id, name, component} = toolbar; | ||
const [getId, setId] = createSignal<Id | null>(null); | ||
|
||
this.forms[id] = { | ||
name, | ||
component, | ||
id: [getId, setId], | ||
getId, | ||
setId, | ||
}; | ||
}); | ||
} | ||
|
||
set(entityTypeId: Id, id?: Id): void { | ||
this.setCurrent(this.forms[entityTypeId]); | ||
this.getCurrent()?.setId(id ?? null); | ||
} | ||
|
||
get(): Toolbar | null { | ||
return this.getCurrent(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./FormMode"; | ||
export * from "./FocusMode"; | ||
export * from "./Input"; | ||
export * from "./InputMode"; | ||
export * from "./InputMode"; | ||
export * from "./ToolbarMode"; |
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
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
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