diff --git a/.gitignore b/.gitignore
index c91c4f12..bb005191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -180,3 +180,5 @@ app/static
app/static/*
data
data/*
+app/srv/exports.ts
+app/srv/exports.d.ts
\ No newline at end of file
diff --git a/app/srv/exports.d.ts b/app/srv/exports.d.ts
deleted file mode 100644
index 2be2cde1..00000000
--- a/app/srv/exports.d.ts
+++ /dev/null
@@ -1,739 +0,0 @@
-///
-///
-declare module "app/srv/api/npm-size" {
- export const _: {
- url: string;
- api(mode: "site" | "page", id: string): Promise;
- };
-}
-declare module "app/srv/api/auth/session" {
- export const _: {
- url: string;
- api(): Promise;
- };
-}
-declare module "app/srv/api/site-bundle" {
- export const _: {
- url: string;
- api(mode: "md5" | "download"): Promise;
- };
-}
-declare module "app/srv/api/site-dts" {
- export const _: {
- url: string;
- api(site_id: string): Promise;
- };
-}
-declare module "app/web/src/utils/types/meta-fn" {
- import { TypedMap } from "yjs-types";
- import { IItem, MItem } from "app/web/src/utils/types/item";
- import * as Y from "yjs";
- export type FNLayout = {
- dir: "row" | "col" | "row-reverse" | "col-reverse";
- align: FNAlign;
- gap: number | "auto";
- wrap: undefined | "flex-wrap" | "flex-nowrap";
- };
- export type FMLayout = TypedMap;
- export type FNAdv = {
- js?: Y.Text | string;
- jsBuilt?: string;
- css?: Y.Text | string;
- html?: Y.Text | string;
- };
- export type FMAdv = TypedMap;
- export type FNComponent = {
- id: string;
- name: string;
- updated_at?: number;
- props: Record;
- };
- export type FNCompDef = {
- idx: number;
- type: string;
- value: any;
- valueBuilt: any;
- gen?: string;
- genBuilt?: string;
- content?: IItem;
- visible?: string;
- meta?: FNCompMeta;
- };
- type FNCompMeta = {
- type: "text" | "option" | "content-element";
- options?: string;
- optionsBuilt?: string;
- option_mode?: "dropdown" | "button";
- };
- export type FMCompDef = TypedMap & {
- content: MItem;
- meta: TypedMap;
- }>;
- export type FMComponent = TypedMap & {
- props: TypedMap>;
- }>;
- export type FNAlign = "top-left" | "top-center" | "top-right" | "top" | "left" | "center" | "right" | "bottom" | "bottom-left" | "bottom-center" | "bottom-right" | "stretch";
- export type FNPadding = {
- t?: number;
- b?: number;
- l?: number;
- r?: number;
- };
- export type FMPadding = TypedMap;
- export type FNDimension = {
- w?: number | "fit" | "full";
- h?: number | "fit" | "full";
- wUnit?: "px" | "%";
- hUnit?: "px" | "%";
- proportion?: boolean;
- };
- export type FMDimension = TypedMap;
- export type FNBackground = {
- color?: string;
- url?: string;
- size?: "cover" | "contain" | "full" | "auto" | "%" | "px";
- repeat?: "repeat" | "repeat-x" | "repeat-y" | "space" | "round" | "no-repeat";
- pos?: "top" | "left" | "center" | "bottom" | "right";
- };
- export type FMBackground = TypedMap;
- export type FNBorder = {
- style?: "solid" | "dash";
- stroke?: FNBorderCorner;
- rounded?: FNRounded;
- color?: string;
- };
- export type FNBorderCorner = {
- t?: number;
- b?: number;
- l?: number;
- r?: number;
- };
- export type FNRounded = {
- tr?: number;
- tl?: number;
- bl?: number;
- br?: number;
- };
- export type FMBorder = TypedMap;
- export type FNFont = {
- color?: string;
- size?: number;
- family?: string;
- height?: number | "auto";
- align?: "center" | "left" | "right";
- whitespace?: "whitespace-normal" | "whitespace-nowrap" | "whitespace-pre" | "whitespace-pre-line" | "whitespace-pre-wrap" | "whitespace-break-spaces";
- wordBreak?: "break-normal" | "break-words" | "break-all" | "break-keep";
- };
- export type FMFont = TypedMap;
- export type FNLinkTag = {
- tag?: string;
- link?: string;
- class?: string;
- };
- export type FMLinkTag = TypedMap;
-}
-declare module "app/web/src/utils/types/meta" {
- import { FMAdv, FMBackground, FMBorder, FMComponent, FMDimension, FMFont, FMLayout, FMLinkTag, FMPadding, FNBackground, FNBorder, FNDimension, FNFont, FNPadding } from "app/web/src/utils/types/meta-fn";
- export type MetaItem = {
- id: string;
- originalId?: string;
- type: "text" | "section" | "item";
- name: string;
- field?: string;
- html?: string;
- text?: string;
- hidden?: "only-editor" | "all" | false;
- };
- export type BasicItem = {
- padding?: FNPadding;
- bg?: FNBackground;
- font?: FNFont;
- dim?: FNDimension;
- border?: FNBorder;
- };
- export type MBasicItem = {
- padding?: FMPadding;
- bg?: FMBackground;
- font?: FMFont;
- component?: FMComponent;
- dim?: FMDimension;
- layout?: FMLayout;
- linktag?: FMLinkTag;
- adv?: FMAdv;
- border?: FMBorder;
- };
-}
-declare module "app/web/src/utils/types/root" {
- import { TypedArray, TypedMap } from "yjs-types";
- import { ISection } from "app/web/src/utils/types/section";
- export type IRoot = {
- id: "root";
- type: "root";
- id_page: string;
- childs: ISection[];
- };
- export type MRoot = TypedMap<{
- id: "root";
- type: "root";
- childs: TypedArray;
- }>;
-}
-declare module "app/web/src/utils/types/section" {
- import { TypedArray, TypedMap } from "yjs-types";
- import { IItem, MItem } from "app/web/src/utils/types/item";
- import { BasicItem, MBasicItem, MetaItem } from "app/web/src/utils/types/meta";
- import { FNAdv, FNLayout, FNLinkTag } from "app/web/src/utils/types/meta-fn";
- import { MRoot } from "app/web/src/utils/types/root";
- export type ISection = {
- layout?: FNLayout;
- mobile?: ISection;
- linktag?: FNLinkTag;
- adv?: FNAdv;
- type: "section";
- childs: IItem[];
- } & MetaItem & BasicItem;
- export type MSection = TypedMap<{
- mobile?: MSection;
- type: "section";
- childs?: TypedArray;
- } & MBasicItem & MetaItem> & {
- parent: TypedArray & {
- parent: MRoot;
- };
- };
-}
-declare module "app/web/src/utils/types/text" {
- import { TypedArray, TypedMap } from "yjs-types";
- import { BasicItem, MBasicItem, MetaItem } from "app/web/src/utils/types/meta";
- import { FNAdv, FNLayout, FNLinkTag } from "app/web/src/utils/types/meta-fn";
- import { MItem } from "app/web/src/utils/types/item";
- export type IText = {
- mobile?: IText;
- type: "text";
- layout?: FNLayout;
- linktag?: FNLinkTag;
- text: string;
- html: string;
- adv?: FNAdv;
- } & BasicItem & MetaItem;
- export type MText = TypedMap<{
- type: "text";
- mobile?: MText;
- childs?: TypedArray;
- } & MBasicItem & MetaItem> & {
- parent: TypedArray & {
- parent: MItem;
- };
- };
-}
-declare module "app/web/src/utils/types/item" {
- import { TypedArray, TypedMap } from "yjs-types";
- import { BasicItem, MBasicItem, MetaItem } from "app/web/src/utils/types/meta";
- import { FNAdv, FNComponent, FNLayout, FNLinkTag } from "app/web/src/utils/types/meta-fn";
- import { MSection } from "app/web/src/utils/types/section";
- import { IText, MText } from "app/web/src/utils/types/text";
- export type IItem = {
- layout?: FNLayout;
- linktag?: FNLinkTag;
- mobile?: IItem;
- adv?: FNAdv;
- type: "item";
- component?: FNComponent;
- childs: (IItem | IText)[];
- } & MetaItem & BasicItem;
- export type MItem = TypedMap<{
- type: "item";
- mobile?: MItem;
- childs?: TypedArray;
- } & MBasicItem & MetaItem> & {
- parent: TypedArray & {
- parent: MSection | MItem;
- };
- };
-}
-declare module "app/web/src/utils/types/general" {
- import { page as dbpage } from "dbgen";
- import { TypedDoc, TypedMap } from "yjs-types";
- import { IItem, MItem } from "app/web/src/utils/types/item";
- import { IRoot, MRoot } from "app/web/src/utils/types/root";
- import { ISection, MSection } from "app/web/src/utils/types/section";
- import { IText, MText } from "app/web/src/utils/types/text";
- export type PageProps = {
- pathname: string;
- domain: string;
- params: any;
- };
- export type PrasiAPI = {
- apiEntry: any;
- prismaTypes: {
- "prisma.d.ts": string;
- "runtime/library.d.ts": string;
- "runtime/index.d.ts": string;
- };
- apiTypes: string;
- };
- export const w: {
- isEditor: boolean;
- isMobile: boolean;
- isDesktop: boolean;
- prasiApi: Record;
- loadedFonts: string[];
- prasiApiDbPull: boolean;
- params: any;
- editorGlbDefault: string;
- ts: number;
- serverurl: string;
- api: any;
- db: any;
- };
- export type Page = {
- id: string;
- content_tree: IRoot;
- js: string | null;
- js_compiled: string | null;
- };
- export type MPage = TypedDoc<{
- map: TypedMap & {
- content_tree: MRoot;
- updated_at: string;
- }>;
- }>;
- export type IContent = ISection | IItem | IText;
- export type MContent = MSection | MItem | MText;
- export type RenderContentProp = Partial<{
- active: IContent | null;
- hover: IContent | null;
- update: (updateID: string, name: string, newState: IRoot) => void;
- onHover: (e: React.MouseEvent, item: IContent) => Promise;
- onOut: (e: React.MouseEvent, item: IContent) => Promise;
- onClick: (e: React.MouseEvent, item: IContent) => Promise;
- isEditor: boolean;
- setContent: (item: IContent) => Promise;
- _onlyChildren?: true;
- }>;
- export type ERenderProp- = {
- item: ITEM;
- };
-}
-declare module "app/web/src/utils/types/ws" {
- export type WS_MSG = WS_MSG_GET_COMP | WS_MSG_SET_COMP | WS_MSG_GET_PAGE | WS_MSG_SET_PAGE | WS_MSG_SV_LOCAL | WS_MSG_SVDIFF_REMOTE | WS_MSG_DIFF_LOCAL | WS_MSG_UNDO | WS_MSG_REDO | WS_MSG_NEW_COMP | WS_SITE_JS | {
- type: "ping";
- } | {
- type: "pong";
- };
- export type WS_SITE_JS = {
- type: "site-js";
- id_site: string;
- src: string;
- };
- export type WS_MSG_GET_COMP = {
- type: "get_comp";
- comp_id: string;
- };
- export type WS_MSG_SET_COMP = {
- type: "set_comp";
- comp_id: string;
- changes: string;
- };
- export type WS_MSG_GET_PAGE = {
- type: "get_page";
- page_id: string;
- };
- export type WS_MSG_SET_PAGE = {
- type: "set_page";
- changes: string;
- };
- export type WS_MSG_NEW_COMP = {
- type: "new_comp";
- id: string;
- doc: string;
- };
- export type WS_MSG_UNDO = {
- type: "undo";
- mode: "page" | "site" | "comp";
- id: string;
- };
- export type WS_MSG_REDO = {
- type: "redo";
- mode: "page" | "site" | "comp";
- id: string;
- };
- export type WS_MSG_SV_LOCAL = {
- type: "sv_local";
- mode: "page" | "site" | "comp";
- id: string;
- sv_local: string;
- };
- export type WS_MSG_SVDIFF_REMOTE = {
- type: "svd_remote";
- mode: "page" | "site" | "comp";
- id: string;
- sv_remote: string;
- diff_remote: string;
- };
- export type WS_MSG_DIFF_LOCAL = {
- type: "diff_local";
- mode: "page" | "site" | "comp";
- id: string;
- diff_local: string;
- };
-}
-declare module "app/srv/ws/edit/tools/load-page" {
- import { Page } from "app/web/src/utils/types/general";
- export const loadPage: (page_id: string) => Promise;
-}
-declare module "app/srv/ws/edit/action/get-page" {
- import { WSData } from "pkgs/core/server/create";
- import { WS_MSG_GET_PAGE } from "app/web/src/utils/types/ws";
- export const getPage: (ws: ServerWebSocket, msg: WS_MSG_GET_PAGE) => Promise;
-}
-declare module "app/srv/ws/edit/action/get-comp" {
- import { WSData } from "pkgs/core/server/create";
- import { WS_MSG_GET_COMP } from "app/web/src/utils/types/ws";
- export const getComp: (ws: ServerWebSocket, msg: WS_MSG_GET_COMP) => Promise;
-}
-declare module "app/srv/ws/edit/action/sv-local" {
- export const svLocal: (ws: Websocket, msg: WS_MSG_SV_LOCAL) => Promise;
-}
-declare module "app/srv/ws/edit/action/diff-local" {
- export const diffLocal: (ws: Websocket, msg: any) => Promise;
-}
-declare module "app/srv/ws/edit/action/svdiff-remote" {
- export const svdiffRemote: (ws: Websocket, msg: WS_MSG_SVDIFF_REMOTE) => Promise;
-}
-declare module "app/srv/ws/edit/action/undo-redo" {
- export const undo: (ws: Websocket, msg: WS_MSG_UNDO) => void;
- export const redo: (ws: Websocket, msg: WS_MSG_REDO) => void;
-}
-declare module "app/srv/ws/handler" {
- import { WebSocketHandler } from "bun";
- import { WSData } from "pkgs/core/server/create";
- export const wsHandler: Record>;
-}
-declare module "pkgs/core/utils/dir" {
- export const dir: {
- path: (path: string) => string;
- };
-}
-declare module "app/db/db" {
-
-}
-declare module "pkgs/core/utils/global" {
- import { Logger } from "pino";
- import { RadixRouter } from "radix3";
-
- type SingleRoute = {
- url: string;
- args: string[];
- fn: (...arg: any[]) => Promise;
- path: string;
- };
- export const g: {
- status: "init" | "ready";
- datadir: string;
-
- dburl: string;
- mode: "dev" | "prod";
-
- log: Logger;
- api: Record;
- domains: null | Record;
- router: RadixRouter;
- port: number;
- frm: {
- js: string;
- etag: string;
- };
- parcel: Subprocess;
- };
-}
-declare module "pkgs/core/server/api-ctx" {
- export const apiContext: (ctx: any) => {
- mode: any;
- req: Request & {
- params: any;
- query_parameters: any;
- };
- res: Response & {
- send: (body?: string | object) => void;
- setHeader: (key: string, value: string) => void;
- sendStatus: (code: number) => void;
- };
- };
- export const createResponse: (existingRes: any, body: any) => Response;
-}
-declare module "pkgs/core/server/serve-api" {
- export const serveAPI: (url: URL, req: Request) => Promise;
-}
-declare module "pkgs/core/server/create" {
- export type WSData = {
- url: URL;
- };
- export const createServer: () => Promise;
-}
-declare module "app/srv/ws/edit/tools/load-site" {
- export type SiteConfig = {
- api_url?: string;
- prasi?: {
- port: number;
- dburl: string;
- };
- };
- export type Site = Exclude>, null>;
- export const loadSite: (idOrDomain: string) => Promise & {
- config?: SiteConfig;
- page: {
- id: string;
- url: string;
- updated_at: Date | null;
- name: string;
- }[];
- }>;
-}
-declare module "app/srv/ws/edit/edit-global" {
- import { ServerWebSocket } from "bun";
- import { component } from "dbgen";
- import { UndoManager } from "yjs";
- import { TypedArray, TypedDoc, TypedMap } from "yjs-types";
- import type { WSData } from "pkgs/core/server/create";
- import { IItem } from "app/web/src/utils/types/item";
- import { IRoot } from "app/web/src/utils/types/root";
- import { Site } from "app/srv/ws/edit/tools/load-site";
- import { MPage } from "app/web/src/utils/types/general";
- import type { RadixRouter } from "radix3";
- type ArrayElement = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
- export type SingleComp = {
- id: string;
- doc: TypedDoc<{
- map: TypedMap;
- }>;
- }>;
- undoManager: UndoManager;
- saveTimeout?: ReturnType;
- ws: Set>;
- };
- export const eg: {
- cache: Record>;
- router: Record>;
- edit: {
- site: Record>;
- }>;
- }>;
- undoManager: UndoManager;
- saveTimeout?: ReturnType;
- ws: Set>;
- }>;
- comp: Record;
- page: Record;
- ws: Set>;
- }>;
- ws: WeakMap, {
- clientID: string;
- }>;
- };
- };
-}
-declare module "app/srv/api/page-reload" {
- export const _: {
- url: string;
- api(page_id: string): Promise;
- };
-}
-declare module "app/srv/global" {
- import { site, user } from "dbgen";
- import { ExecaChildProcess } from "execa";
- export const glb: {
- lastUpdate: Record;
- prasiSrv: {
- status: Record;
- running: Record;
- };
- npm: {
- page: Record;
- site: Record;
- };
- };
- export type Session = {
- user: user & {
- site: site[];
- };
- };
-}
-declare module "app/srv/api/npm-bundle" {
- export type NPMImportAs = {
- main: {
- mode: "default" | "*";
- name: string;
- };
- names: string[];
- custom?: string;
- };
- export const _: {
- url: string;
- api(mode: "site" | "page", id: string): Promise;
- };
-}
-declare module "app/srv/api/npm" {
- export const _: {
- url: string;
- api(mode: "site" | "page", id: string): Promise;
- };
-}
-declare module "app/srv/api/site-export" {
- export const _: {
- url: string;
- api(site_id: string): Promise;
- };
-}
-declare module "app/srv/api/auth/login" {
- export const _: {
- url: string;
- api(username: string, password: string): Promise<{
- status: string;
- session: any;
- reason?: undefined;
- } | {
- status: string;
- reason: string;
- session?: undefined;
- }>;
- };
-}
-declare module "app/srv/api/local-ip" {
- export const _: {
- url: string;
- api(): Promise;
- };
-}
-declare module "app/srv/exports" {
- export const npm_size: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const session: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
- export const site_bundle: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const site_dts: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const page_reload: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const npm_bundle: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const npm: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const site_export: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const login: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const local_ip: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
- export const _upload: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const _prasi: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
- export const _api_frm: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
- export const _dbs: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const _file: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
-}
diff --git a/app/srv/exports.ts b/app/srv/exports.ts
deleted file mode 100644
index 2985df46..00000000
--- a/app/srv/exports.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-export const npm_size = {
- name: "npm_size",
- url: "/npm-size/:mode/:id",
- path: "app/srv/api/npm-size.ts",
- args: ["mode","id"],
- handler: import("./api/npm-size")
-}
-export const session = {
- name: "session",
- url: "/_session",
- path: "app/srv/api/auth/session.ts",
- args: [],
- handler: import("./api/auth/session")
-}
-export const site_bundle = {
- name: "site_bundle",
- url: "/site-bundle/:mode",
- path: "app/srv/api/site-bundle.ts",
- args: ["mode"],
- handler: import("./api/site-bundle")
-}
-export const site_dts = {
- name: "site_dts",
- url: "/site-dts/:site_id",
- path: "app/srv/api/site-dts.ts",
- args: ["site_id"],
- handler: import("./api/site-dts")
-}
-export const page_reload = {
- name: "page_reload",
- url: "/page-reload/:page_id",
- path: "app/srv/api/page-reload.ts",
- args: ["page_id"],
- handler: import("./api/page-reload")
-}
-export const npm_bundle = {
- name: "npm_bundle",
- url: "/npm-bundle/:mode/:id",
- path: "app/srv/api/npm-bundle.ts",
- args: ["mode","id"],
- handler: import("./api/npm-bundle")
-}
-export const npm = {
- name: "npm",
- url: "/npm/:mode/:id/*",
- path: "app/srv/api/npm.ts",
- args: ["mode","id"],
- handler: import("./api/npm")
-}
-export const site_export = {
- name: "site_export",
- url: "/site-export/:site_id",
- path: "app/srv/api/site-export.ts",
- args: ["site_id"],
- handler: import("./api/site-export")
-}
-export const login = {
- name: "login",
- url: "/_login",
- path: "app/srv/api/auth/login.ts",
- args: ["username","password"],
- handler: import("./api/auth/login")
-}
-export const local_ip = {
- name: "local_ip",
- url: "/local-ip",
- path: "app/srv/api/local-ip.ts",
- args: [],
- handler: import("./api/local-ip")
-}
-export const _upload = {
- name: "_upload",
- url: "/_upload",
- path: "app/srv/api/_upload.ts",
- args: ["body"],
- handler: import("./api/_upload")
-}
-export const _prasi = {
- name: "_prasi",
- url: "/_prasi/*",
- path: "app/srv/api/_prasi.ts",
- args: [],
- handler: import("./api/_prasi")
-}
-export const _api_frm = {
- name: "_api_frm",
- url: "/_api_frm",
- path: "app/srv/api/_api_frm.ts",
- args: [],
- handler: import("./api/_api_frm")
-}
-export const _dbs = {
- name: "_dbs",
- url: "/_dbs/:dbName/:action",
- path: "app/srv/api/_dbs.ts",
- args: ["dbName","action"],
- handler: import("./api/_dbs")
-}
-export const _file = {
- name: "_file",
- url: "/_file/*",
- path: "app/srv/api/_file.ts",
- args: [],
- handler: import("./api/_file")
-}
\ No newline at end of file