This commit is contained in:
Rizky 2024-05-10 14:29:02 +07:00
parent 2e243b9e45
commit e9907507a8
13 changed files with 84 additions and 67 deletions

File diff suppressed because one or more lines are too long

View File

@ -41,7 +41,7 @@ export const ensureLib = async (src_dir: string, id_site: string) => {
}
}
} catch (e) {
console.error(e);
// console.error(e);
}
}
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
import { IMeta } from "../../utils/types";
export const devItem = (meta: IMeta) => {
console.log(meta);
}

View File

@ -16,6 +16,7 @@ import { updatePropScope } from "./eval-prop";
import { extractNavigate } from "./extract-nav";
import { createViLocal } from "./local";
import { createViPassProp } from "./passprop";
import { devItem } from "./dev-item";
export const viEvalScript = (
vi: {
page: VG["page"];
@ -60,6 +61,7 @@ export const viEvalScript = (
PassProp: script?.PassProp,
ErrorBox: ErrorBox,
newElement: () => {},
_item: meta.mitem ? devItem(meta) : undefined,
render: (jsx: ReactNode) => {
let result = jsx;
if (isValidElement(jsx) && jsx.props.children) {
@ -134,9 +136,6 @@ export const viEvalScript = (
...viScriptArg(vi),
...exports,
...passprop,
_meta: vi.meta,
_item: meta.item,
_syncm: typeof syncronize !== "undefined" ? syncronize : undefined,
};
if (typeof passprop === "object") {

View File

@ -9,9 +9,6 @@ export const baseTypings = `
const useEffect: typeof React.useEffect;
const useState: typeof React.useState;
const _meta: Record<string, any>;
const _item: IContent;
const _syncm: (mitem:any, item:any) => void;
const pathname: string;
const isEditor: boolean;
const isLayout: boolean;
@ -30,7 +27,6 @@ export const baseTypings = `
visit: (item: IContent) => void | Promise<void>
) => void
) => void;}) => ReactNode;
const apiHeaders: Record<string, any>;
const navigate: (url: string) => void;
const params: any;
const cx: (...classNames: any[]) => string;
@ -51,11 +47,7 @@ export const baseTypings = `
};
const children: RElement;
const PassProp: FC<Record<string, any> & { children: React.ReactNode }>;
const Preload: FC<{ url: string[] }>;
const apiurl: string;
const pageid: string;
type ITEM = {
type PrasiItemSingle = {
id: string;
name: string;
type: "item" | "text";
@ -65,22 +57,24 @@ export const baseTypings = `
css?: string;
html?: string;
};
text: string;
html: string;
text?: string;
html?: string;
component?: {
id: string;
props: Record<
string,
{
value: string;
valueBuilt: string;
meta: { type: string };
}
{ type: "string" | "raw"; value: string; valueBuilt?: string }
>;
};
childs: ITEM[];
childs: PrasiItemSingle[];
};
const newElement: (gen?: (item: ITEM) => ITEM | ITEM[]) => React.ReactNode;
type PrasiItem = PrasiItemSingle & {
update: (fn: () => Promise<void> | void) => void;
};
const _item: undefined | PrasiItem;
const PassProp: FC<Record<string, any> & { children: React.ReactNode }>;
const mobile: {
notif: {
register: (user_id: string) => void;

View File

@ -0,0 +1,25 @@
type PrasiItemSingle = {
id: string;
name: string;
type: "item" | "text";
adv?: {
js?: string;
jsBuilt?: string;
css?: string;
html?: string;
};
text?: string;
html?: string;
component?: {
id: string;
props: Record<
string,
{ type: "string" | "raw"; value: string; valueBuilt?: string }
>;
};
childs: PrasiItemSingle[];
};
export type PrasiItem = PrasiItemSingle & {
update: (fn: () => Promise<void> | void) => void;
};