wip checkpoint view
This commit is contained in:
parent
e444740196
commit
619b244046
|
|
@ -3,7 +3,7 @@ import {
|
|||
EComp,
|
||||
EPage,
|
||||
ESite,
|
||||
} from "../../../web/src/render/ed/logic/ed-global";
|
||||
} from "../../../web/src/nova/ed/logic/ed-global";
|
||||
import { IItem } from "../../../web/src/utils/types/item";
|
||||
import { site_group } from "./actions/site_group";
|
||||
import { activity } from "./entity/activity";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { validate } from "uuid";
|
||||
import { ESite } from "../../../../web/src/render/ed/logic/ed-global";
|
||||
import { ESite } from "../../../../web/src/nova/ed/logic/ed-global";
|
||||
import { SAction } from "../actions";
|
||||
import { SyncConnection } from "../type";
|
||||
import { activity } from "../entity/activity";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useEffect } from "react";
|
||||
import { page, useGlobal } from "web-utils";
|
||||
import { EDGlobal } from "../../render/ed/logic/ed-global";
|
||||
import { edInitSync } from "../../render/ed/logic/ed-sync";
|
||||
import { EDGlobal } from "../../nova/ed/logic/ed-global";
|
||||
import { edInitSync } from "../../nova/ed/logic/ed-sync";
|
||||
import { Loading } from "../../utils/ui/loading";
|
||||
import { isLocalhost } from "../../utils/ui/is-localhost";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { page, useGlobal } from "web-utils";
|
||||
import { EdBase } from "../../render/ed/ed-base";
|
||||
import { EDGlobal } from "../../render/ed/logic/ed-global";
|
||||
import { EdBase } from "../../nova/ed/ed-base";
|
||||
import { EDGlobal } from "../../nova/ed/logic/ed-global";
|
||||
import { Loading } from "../../utils/ui/loading";
|
||||
import { initSync } from "wasm-gzip";
|
||||
import { edInitSync } from "../../render/ed/logic/ed-sync";
|
||||
import { edInitSync } from "../../nova/ed/logic/ed-sync";
|
||||
|
||||
export default page({
|
||||
url: "/ed/:site_id/:page_id",
|
||||
|
|
|
|||
|
|
@ -76,11 +76,12 @@ export const EDGlobal = {
|
|||
page: {
|
||||
cur: EmptyPage,
|
||||
doc: null as null | DPage,
|
||||
root: null as null | IRoot,
|
||||
list: {} as Record<string, { page: EPage; doc: DPage }>,
|
||||
|
||||
building: false,
|
||||
meta: {} as Record<string, EdMeta>,
|
||||
entry: [] as string[],
|
||||
tree: [] as NodeModel<EdMeta>[],
|
||||
meta: {} as Record<string, EdMeta>,
|
||||
list: {} as Record<string, { page: EPage; doc: DPage }>,
|
||||
},
|
||||
comp: {
|
||||
cur: EmptyComp,
|
||||
|
|
@ -112,7 +113,7 @@ export const EDGlobal = {
|
|||
popup: {
|
||||
code: {
|
||||
init: false,
|
||||
open: false,
|
||||
open: false,
|
||||
id: "",
|
||||
name: "site",
|
||||
log: "",
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
import { compress, decompress } from "wasm-gzip";
|
||||
import { PG } from "./ed-global";
|
||||
import { treeRebuild } from "./tree/build";
|
||||
import { w } from "../../../utils/types/general";
|
||||
|
||||
export const edRoute = async (p: PG) => {
|
||||
if (p.status === "ready") {
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { createId } from "@paralleldrive/cuid2";
|
||||
import { decompress } from "wasm-gzip";
|
||||
import { syncronize } from "y-pojo";
|
||||
import { TypedMap } from "yjs-types";
|
||||
import { MContent } from "../../../../utils/types/general";
|
||||
|
|
@ -9,10 +10,9 @@ import {
|
|||
FNCompDef,
|
||||
FNComponent,
|
||||
} from "../../../../utils/types/meta-fn";
|
||||
import { DComp } from "../../../../utils/types/root";
|
||||
import { DComp, IRoot } from "../../../../utils/types/root";
|
||||
import { MSection } from "../../../../utils/types/section";
|
||||
import { EdMeta, PG } from "../ed-global";
|
||||
import { decompress } from "wasm-gzip";
|
||||
|
||||
export const treeRebuild = async (p: PG, arg?: { note?: string }) => {
|
||||
const doc = p.page.doc;
|
||||
|
|
@ -20,6 +20,9 @@ export const treeRebuild = async (p: PG, arg?: { note?: string }) => {
|
|||
|
||||
const root = doc.getMap("map").get("root");
|
||||
if (root) {
|
||||
p.page.building = true;
|
||||
p.render();
|
||||
|
||||
const sections = root.get("childs");
|
||||
if (sections) {
|
||||
const loaded = new Set<string>();
|
||||
|
|
@ -60,6 +63,8 @@ export const treeRebuild = async (p: PG, arg?: { note?: string }) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
p.page.building = false;
|
||||
p.render();
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import { useGlobal } from "web-utils";
|
||||
import { Loading } from "../../../../utils/ui/loading";
|
||||
import { View } from "../../../view/view";
|
||||
import { EDGlobal } from "../../logic/ed-global";
|
||||
|
||||
export const EdMain = () => {
|
||||
const p = useGlobal(EDGlobal, "EDITOR");
|
||||
return (
|
||||
<div className="flex flex-1 relative">
|
||||
{!!p.page.building && <Loading backdrop={false} />}
|
||||
{!p.page.building && (
|
||||
<View
|
||||
load={{
|
||||
mode: "tree_meta",
|
||||
meta: p.page.meta,
|
||||
entry: p.page.entry,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { syncronize } from "y-pojo";
|
||||
import { IContent, MContent } from "../../../../../../../utils/types/general";
|
||||
import { IItem } from "../../../../../../../utils/types/item";
|
||||
import { fillID } from "../../../../../../editor/tools/fill-id";
|
||||
import { fillID } from "../../../../../../../render/editor/tools/fill-id";
|
||||
import { PG } from "../../../../../logic/ed-global";
|
||||
import { treeRebuild } from "../../../../../logic/tree/build";
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ import { syncronize } from "y-pojo";
|
|||
import { IItem } from "../../../../../../../utils/types/item";
|
||||
import { PG } from "../../../../../logic/ed-global";
|
||||
import { treeRebuild } from "../../../../../logic/tree/build";
|
||||
import { fillID } from "../../../../../../editor/tools/fill-id";
|
||||
import { fillID } from "../../../../../../../render/editor/tools/fill-id";
|
||||
|
||||
export const edActionDetach = (p: PG, item: IItem) => {
|
||||
const mitem = p.page.meta[item.id].mitem;
|
||||
|
|
@ -3,7 +3,7 @@ import { IContent } from "../../../../../../../utils/types/general";
|
|||
import { MItem } from "../../../../../../../utils/types/item";
|
||||
import { PG, active } from "../../../../../logic/ed-global";
|
||||
import { treeRebuild } from "../../../../../logic/tree/build";
|
||||
import { fillID } from "../../../../../../editor/tools/fill-id";
|
||||
import { fillID } from "../../../../../../../render/editor/tools/fill-id";
|
||||
|
||||
export const edActionPaste = async (p: PG, item: IContent) => {
|
||||
const mitem = p.page.meta[item.id].mitem;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import { EdMeta } from "../../ed/logic/ed-global";
|
||||
|
||||
export const ViewGlobal = {
|
||||
mode: "init" as "init" | "ready",
|
||||
meta: {} as Record<string, EdMeta>,
|
||||
entry: [] as string[],
|
||||
};
|
||||
|
||||
export type VG = typeof ViewGlobal & { render: () => void };
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { useGlobal } from "web-utils";
|
||||
import { VG, ViewGlobal } from "./global";
|
||||
import { VLoad } from "./types";
|
||||
|
||||
export const VInit = (v: VG, load: VLoad) => {
|
||||
v.mode = "ready";
|
||||
|
||||
if (load.mode === "tree_meta") {
|
||||
v.meta = load.meta;
|
||||
v.entry = load.entry;
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { EdMeta } from "../../ed/logic/ed-global";
|
||||
|
||||
export type VLoad =
|
||||
| { mode: "page"; page_id: string }
|
||||
| { mode: "pathname"; pathname: string }
|
||||
| {
|
||||
mode: "tree_meta";
|
||||
entry: string[];
|
||||
meta: Record<string, EdMeta>;
|
||||
};
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { FC, ReactNode } from "react";
|
||||
import { ISection } from "../../../utils/types/section";
|
||||
|
||||
export const VSection: FC<{ item: ISection; children: ReactNode }> = ({
|
||||
item,
|
||||
children,
|
||||
}) => {
|
||||
console.log(item);
|
||||
return <div></div>;
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import { FC } from "react";
|
||||
import { useGlobal } from "web-utils";
|
||||
import { Loading } from "../../utils/ui/loading";
|
||||
import { ViewGlobal } from "./logic/global";
|
||||
import { VInit } from "./logic/init";
|
||||
import { VLoad } from "./logic/types";
|
||||
import { VSection } from "./render/section";
|
||||
import { ISection } from "../../utils/types/section";
|
||||
|
||||
export const View: FC<{
|
||||
load: VLoad;
|
||||
}> = ({ load }) => {
|
||||
const v = useGlobal(ViewGlobal, "VIEW");
|
||||
|
||||
if (v.mode === "init") {
|
||||
VInit(v, load);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-1 flex-col relative">
|
||||
{v.mode !== "ready" ? (
|
||||
<Loading backdrop={false} />
|
||||
) : (
|
||||
v.entry.map((section_id) => {
|
||||
const meta = v.meta[section_id];
|
||||
const section = meta.item as ISection;
|
||||
|
||||
return (
|
||||
<VSection item={section} key={section_id}>
|
||||
Hello
|
||||
</VSection>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export const EdMain = () => {
|
||||
return <div className="flex flex-1"></div>;
|
||||
};
|
||||
|
|
@ -5,7 +5,7 @@ import { mobileCSS } from "../elements/e-page";
|
|||
import { editorStyle } from "../elements/style";
|
||||
import { EditorGlobal } from "../logic/global";
|
||||
import { Toolbar } from "./toolbar/Toolbar";
|
||||
import { EdScriptInit } from "../../ed/panel/script/monaco/init";
|
||||
import { EdScriptInit } from "../../../nova/ed/panel/script/monaco/init";
|
||||
|
||||
const ETree = lazy(async () => ({
|
||||
default: (await import("./tree/tree")).ETree,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from "../../../../srv/ws/sync/actions-def";
|
||||
import { UserConf } from "../../../../srv/ws/sync/entity/user";
|
||||
import { SyncType } from "../../../../srv/ws/sync/type";
|
||||
import { ESite } from "../../render/ed/logic/ed-global";
|
||||
import { ESite } from "../../nova/ed/logic/ed-global";
|
||||
import { w } from "../types/general";
|
||||
import { initIDB } from "./idb";
|
||||
const packr = new Packr({ structuredClone: true });
|
||||
|
|
|
|||
Loading…
Reference in New Issue