diff --git a/app/srv/exports.d.ts b/app/srv/exports.d.ts
index f2d169c4..2be2cde1 100644
--- a/app/srv/exports.d.ts
+++ b/app/srv/exports.d.ts
@@ -1,136 +1,27 @@
-///
///
+///
declare module "app/srv/api/npm-size" {
export const _: {
url: string;
api(mode: "site" | "page", 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/session" {
+declare module "app/srv/api/auth/session" {
export const _: {
url: string;
api(): 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" {
- export const _: {
- url: string;
- api(mode: "site" | "page", id: string): Promise;
- };
-}
-declare module "app/srv/api/local-ip" {
- 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/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/api/site-dts" {
+ export const _: {
+ url: string;
+ api(site_id: string): Promise;
};
}
declare module "app/web/src/utils/types/meta-fn" {
@@ -424,6 +315,69 @@ declare module "app/web/src/utils/types/general" {
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;
@@ -598,6 +552,38 @@ declare module "app/srv/ws/edit/edit-global" {
};
};
}
+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: {
@@ -612,10 +598,10 @@ declare module "app/srv/api/npm-bundle" {
api(mode: "site" | "page", id: string): Promise;
};
}
-declare module "app/srv/api/site-dts" {
+declare module "app/srv/api/npm" {
export const _: {
url: string;
- api(site_id: string): Promise;
+ api(mode: "site" | "page", id: string): Promise;
};
}
declare module "app/srv/api/site-export" {
@@ -624,10 +610,24 @@ declare module "app/srv/api/site-export" {
api(site_id: string): Promise;
};
}
-declare module "app/srv/api/page-reload" {
+declare module "app/srv/api/auth/login" {
export const _: {
url: string;
- api(page_id: string): Promise;
+ 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" {
@@ -638,33 +638,12 @@ declare module "app/srv/exports" {
args: string[];
handler: Promise;
};
- export const login: {
- 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 npm: {
- name: string;
- url: string;
- path: string;
- args: string[];
- handler: Promise;
- };
- export const local_ip: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
+ handler: Promise;
};
export const site_bundle: {
name: string;
@@ -673,6 +652,20 @@ declare module "app/srv/exports" {
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;
@@ -680,12 +673,12 @@ declare module "app/srv/exports" {
args: string[];
handler: Promise;
};
- export const site_dts: {
+ export const npm: {
name: string;
url: string;
path: string;
args: string[];
- handler: Promise;
+ handler: Promise;
};
export const site_export: {
name: string;
@@ -694,12 +687,19 @@ declare module "app/srv/exports" {
args: string[];
handler: Promise;
};
- export const page_reload: {
+ export const login: {
name: string;
url: string;
path: string;
args: string[];
- handler: Promise;
+ handler: Promise;
+ };
+ export const local_ip: {
+ name: string;
+ url: string;
+ path: string;
+ args: any[];
+ handler: Promise;
};
export const _upload: {
name: string;
@@ -715,13 +715,6 @@ declare module "app/srv/exports" {
args: any[];
handler: Promise;
};
- export const _file: {
- name: string;
- url: string;
- path: string;
- args: any[];
- handler: Promise;
- };
export const _api_frm: {
name: string;
url: string;
@@ -736,4 +729,11 @@ declare module "app/srv/exports" {
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
index f4517db6..2985df46 100644
--- a/app/srv/exports.ts
+++ b/app/srv/exports.ts
@@ -5,33 +5,12 @@ export const npm_size = {
args: ["mode","id"],
handler: import("./api/npm-size")
}
-export const login = {
- name: "login",
- url: "/_login",
- path: "app/srv/api/auth/login.ts",
- args: ["username","password"],
- handler: import("./api/auth/login")
-}
export const session = {
name: "session",
- url: "/session",
- path: "app/srv/api/session.ts",
+ url: "/_session",
+ path: "app/srv/api/auth/session.ts",
args: [],
- handler: import("./api/session")
-}
-export const npm = {
- name: "npm",
- url: "/npm/:mode/:id/*",
- path: "app/srv/api/npm.ts",
- args: ["mode","id"],
- handler: import("./api/npm")
-}
-export const local_ip = {
- name: "local_ip",
- url: "/local-ip",
- path: "app/srv/api/local-ip.ts",
- args: [],
- handler: import("./api/local-ip")
+ handler: import("./api/auth/session")
}
export const site_bundle = {
name: "site_bundle",
@@ -40,6 +19,20 @@ export const site_bundle = {
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",
@@ -47,12 +40,12 @@ export const npm_bundle = {
args: ["mode","id"],
handler: import("./api/npm-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 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",
@@ -61,12 +54,19 @@ export const site_export = {
args: ["site_id"],
handler: import("./api/site-export")
}
-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 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",
@@ -82,13 +82,6 @@ export const _prasi = {
args: [],
handler: import("./api/_prasi")
}
-export const _file = {
- name: "_file",
- url: "/_file/*",
- path: "app/srv/api/_file.ts",
- args: [],
- handler: import("./api/_file")
-}
export const _api_frm = {
name: "_api_frm",
url: "/_api_frm",
@@ -102,4 +95,11 @@ export const _dbs = {
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
diff --git a/app/web/src/render/editor/panel/side/props/CPMaster.tsx b/app/web/src/render/editor/panel/side/props/CPMaster.tsx
index d9e9fbfb..f54922f6 100644
--- a/app/web/src/render/editor/panel/side/props/CPMaster.tsx
+++ b/app/web/src/render/editor/panel/side/props/CPMaster.tsx
@@ -98,17 +98,14 @@ export const CPMaster: FC<{ mitem: MItem }> = ({ mitem }) => {
className="flex cursor-pointer items-center border border-slate-500 bg-white rounded-sm text-[10px] px-[5px] m-1 opacity-50 hover:opacity-100"
onClick={() => {
if (mprops) {
- let idx: any = "";
- let name = "prop";
- while (mprops?.get(name)) {
- idx = idx === "" ? 1 : idx + 1;
- name = `prop_${idx}`;
- }
-
+ const indexes: (number | undefined)[] = [];
+ mprops.forEach((e) => indexes.push(e.get("idx")));
+ let idx: any = (indexes.sort().pop() || 0) + 1;
+ const name = `prop_${idx};`
mprops.set(
name,
newMap({
- idx: Object.keys(mprops.toJSON()).length + 1,
+ idx: idx,
name,
type: "string",
value: '"hello"',