boom, back up and running again
This commit is contained in:
parent
b3fbc46cfd
commit
b8e3a76768
1 changed files with 17 additions and 17 deletions
|
@ -61,12 +61,12 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
const tabs = createMemo(() => filesContext.files().map(({ key, handle }) => {
|
const tabs = createMemo(() => filesContext.files().map(({ key, handle }) => {
|
||||||
const [api, setApi] = createSignal<GridApi>();
|
const [api, setApi] = createSignal<GridApi>();
|
||||||
const [entries, setEntries] = createSignal<Entries>(new Map());
|
const [entries, setEntries] = createSignal<Entries>(new Map());
|
||||||
const [files, setFiles] = createSignal<Map<string, { key: string, handle: FileSystemFileHandle }>>(new Map());
|
const [files, setFiles] = createSignal<Map<string, { id: string, handle: FileSystemFileHandle }>>(new Map());
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const files = await Array.fromAsync(
|
const files = await Array.fromAsync(
|
||||||
filter(handle.values(), entry => entry.kind === 'file'),
|
filter(handle.values(), entry => entry.kind === 'file'),
|
||||||
async file => [file.name.split('.').at(0)!, { handle: file, key: await file.getUniqueId() }] as const
|
async file => [file.name.split('.').at(0)!, { handle: file, id: await file.getUniqueId() }] as const
|
||||||
);
|
);
|
||||||
|
|
||||||
setFiles(new Map(files));
|
setFiles(new Map(files));
|
||||||
|
@ -80,6 +80,7 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
|
|
||||||
const tab = createMemo(() => {
|
const tab = createMemo(() => {
|
||||||
const name = active();
|
const name = active();
|
||||||
|
|
||||||
return tabs().find(t => t.handle.name === name);
|
return tabs().find(t => t.handle.name === name);
|
||||||
});
|
});
|
||||||
const api = createMemo(() => tab()?.api());
|
const api = createMemo(() => tab()?.api());
|
||||||
|
@ -145,17 +146,24 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
handle,
|
handle,
|
||||||
existing.entries().reduce((aggregate, [key, value]) => {
|
existing.entries().reduce((aggregate, [key, value]) => {
|
||||||
let obj = aggregate;
|
let obj = aggregate;
|
||||||
const [k, lastPart] = splitAt(key, key.lastIndexOf('.'));
|
const i = key.lastIndexOf('.');
|
||||||
|
|
||||||
for (const part of k.split('.')) {
|
if (i !== -1) {
|
||||||
if (!Object.hasOwn(obj, part)) {
|
const [k, lastPart] = splitAt(key, i);
|
||||||
obj[part] = {};
|
|
||||||
|
for (const part of k.split('.')) {
|
||||||
|
if (!Object.hasOwn(obj, part)) {
|
||||||
|
obj[part] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = obj[part];
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = obj[part];
|
obj[lastPart] = value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
obj[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj[lastPart] = value;
|
|
||||||
|
|
||||||
return aggregate;
|
return aggregate;
|
||||||
}, {} as Record<string, any>)
|
}, {} as Record<string, any>)
|
||||||
|
@ -172,14 +180,6 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => {
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
|
|
||||||
createEffect(() => {
|
|
||||||
console.log(mutatedFiles());
|
|
||||||
});
|
|
||||||
|
|
||||||
createEffect(() => {
|
|
||||||
console.log(mutatedData());
|
|
||||||
});
|
|
||||||
|
|
||||||
const [prompt, setPrompt] = createSignal<PromptApi>();
|
const [prompt, setPrompt] = createSignal<PromptApi>();
|
||||||
|
|
||||||
const commands = {
|
const commands = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue