This commit is contained in:
2026-08-20 08:44:42 +01:00
parent e8ef8fbeb7
commit cb43d0616e
18 changed files with 811 additions and 366 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import React, { MutableRefObject } from "react";
import { twMerge } from "tailwind-merge";
import AceEditorModes from "./ace-editor-modes";
import { AceEditorOptions } from "@moduletrace/datasquirel/dist/package-shared/types";
import { AceEditorOptions } from "../types";
export type AceEditorComponentType = {
editorRef?: MutableRefObject<AceAjax.Editor | undefined>;
+71
View File
@@ -66,3 +66,74 @@ export const AutocompleteOptions = [
"on", // Enables autofill (default)
"off", // Disables autofill
] as const;
export interface AceEditorOptions {
animatedScroll?: boolean;
autoScrollEditorIntoView?: boolean;
behavioursEnabled?: boolean;
copyWithEmptySelection?: boolean;
cursorStyle?: "ace" | "slim" | "smooth" | "wide";
customScrollbar?: boolean;
displayIndentGuides?: boolean;
dragDelay?: number;
dragEnabled?: boolean;
enableAutoIndent?: boolean;
enableBasicAutocompletion?: boolean | any[];
enableKeyboardAccessibility?: boolean;
enableLiveAutocompletion?: boolean | any[];
enableMobileMenu?: boolean;
enableMultiselect?: boolean;
enableSnippets?: boolean;
fadeFoldWidgets?: boolean;
firstLineNumber?: number;
fixedWidthGutter?: boolean;
focusTimeout?: number;
foldStyle?: "markbegin" | "markbeginend" | "manual";
fontFamily?: string;
fontSize?: number;
hScrollBarAlwaysVisible?: boolean;
hasCssTransforms?: boolean;
highlightActiveLine?: boolean;
highlightGutterLine?: boolean;
highlightIndentGuides?: boolean;
highlightSelectedWord?: boolean;
indentedSoftWrap?: boolean;
keyboardHandler?: string;
liveAutocompletionDelay?: number;
liveAutocompletionThreshold?: number;
maxLines?: number;
maxPixelHeight?: number;
mergeUndoDeltas?: boolean | "always";
minLines?: number;
mode?: string;
navigateWithinSoftTabs?: boolean;
newLineMode?: AceAjax.NewLineMode;
overwrite?: boolean;
placeholder?: string;
printMargin?: number | boolean;
printMarginColumn?: number;
readOnly?: boolean;
relativeLineNumbers?: boolean;
scrollPastEnd?: number;
scrollSpeed?: number;
selectionStyle?: string;
session?: any;
showFoldWidgets?: boolean;
showFoldedAnnotations?: boolean;
showGutter?: boolean;
showInvisibles?: boolean;
showLineNumbers?: boolean;
showPrintMargin?: boolean;
tabSize?: number;
textInputAriaLabel?: string;
theme?: string;
tooltipFollowsMouse?: boolean;
useSoftTabs?: boolean;
useSvgGutterIcons?: boolean;
useWorker?: boolean;
vScrollBarAlwaysVisible?: boolean;
value?: string;
wrap?: number | boolean | "off" | "free" | "printmargin";
wrapBehavioursEnabled?: boolean;
wrapMethod?: "code" | "text" | "auto";
}
+2 -1
View File
@@ -7,13 +7,14 @@ import {
BunextHTMLProps,
BunextRouteConfig,
BunextPageModuleMeta,
BunextPageModuleServerReturnURLObject,
} from "@moduletrace/bunext/types";
import { RootHead } from "./(partials)/root-head";
export type AppContextType = {
pageProps: PagePropsType;
query?: any;
url?: URL;
url?: BunextPageModuleServerReturnURLObject;
};
export const AppContext = React.createContext<AppContextType>({
+14 -17
View File
@@ -1,32 +1,29 @@
import { PagePropsType } from "@/src/types";
import matter from "gray-matter";
import { DSQL_TBEN_ME_BLOG_POSTS } from "@/src/types/dsql";
import { BunextPageServerFn } from "@moduletrace/bunext/types";
import sql from "@/src/utils/db";
export const server: BunextPageServerFn<PagePropsType> = async (ctx) => {
const blog_post_res = await sql`
SELECT * FROM blog_posts
WHERE slug=${ctx.query?.slug}
`;
// const blog_post_res = await sql`
// SELECT * FROM blog_posts
// WHERE slug=${ctx.query?.slug}
// `;
const blog_post: DSQL_TBEN_ME_BLOG_POSTS = [...blog_post_res]?.[0];
// const blog_post: DSQL_TBEN_ME_BLOG_POSTS = [...blog_post_res]?.[0];
if (!blog_post?.body) {
return {
props: {},
};
}
// if (!blog_post?.body) {
// return {
// props: {},
// };
// }
const pageMdString = blog_post.body;
// const pageMdString = blog_post.body;
const pageGrayMatter = matter(pageMdString);
// const pageGrayMatter = matter(pageMdString);
const content = pageGrayMatter.content;
// const content = pageGrayMatter.content;
return {
props: {
blogPost: blog_post,
blogPost: {},
},
};
};
+7 -8
View File
@@ -1,20 +1,19 @@
import { PagePropsType } from "@/src/types";
import { DSQL_TBEN_ME_BLOG_POSTS } from "@/src/types/dsql";
import { BunextPageServerFn } from "@moduletrace/bunext/types";
import sql from "@/src/utils/db";
export const server: BunextPageServerFn<PagePropsType> = async (ctx) => {
const blog_posts_res = await sql`
SELECT * FROM blog_posts
WHERE published=1
ORDER BY id DESC
`;
// const blog_posts_res = await sql`
// SELECT * FROM blog_posts
// WHERE published=1
// ORDER BY id DESC
// `;
const blog_posts: DSQL_TBEN_ME_BLOG_POSTS[] = [...blog_posts_res];
// const blog_posts: DSQL_TBEN_ME_BLOG_POSTS[] = [...blog_posts_res];
return {
props: {
blogPosts: blog_posts,
blogPosts: [],
},
};
};
-24
View File
@@ -1,24 +0,0 @@
import { SQL } from "bun";
let sql_object: any;
const sql = new SQL({
adapter: "mariadb",
hostname: process.env.DSQL_DB_HOST,
database: process.env.DSQL_DB_NAME,
username: process.env.DSQL_DB_USERNAME,
password: process.env.DSQL_DB_PASSWORD,
tls: {
rejectUnauthorized: false,
},
idleTimeout: 30000,
maxLifetime: 60 * 60 * 1000,
onclose(err) {
sql_object?.connect();
},
onconnect(err) {
sql_object = sql;
},
});
export default sql;