diff --git a/packages/temple-esbuild/package.json b/packages/temple-esbuild/package.json index fbd3264..293f147 100644 --- a/packages/temple-esbuild/package.json +++ b/packages/temple-esbuild/package.json @@ -19,9 +19,6 @@ "scripts": { "build": "tsc" }, - "peerDependencies": { - "esbuild": "^0.20" - }, "dependencies": { "@ossph/temple": "0.0.15" }, diff --git a/packages/temple-express/src/index.ts b/packages/temple-express/src/index.ts index b95ce04..8889865 100644 --- a/packages/temple-express/src/index.ts +++ b/packages/temple-express/src/index.ts @@ -3,7 +3,7 @@ import temple from '@ossph/temple/compiler'; export default function engine( options: TempleOptions, - next: (res: string) => string = (res) => res, + next: (res: string) => string = (res) => res ) { const compiler = temple(options); return async ( @@ -12,7 +12,11 @@ export default function engine( callback: (err: Error | null, results: string | undefined) => void, ) => { const { settings, _locals, cache, ...props } = options; - const build = await compiler.import(filePath); - callback(null, next(build.document.render(props))); + try { + const build = await compiler.import(filePath); + callback(null, next(build.document.inline(props))); + } catch (e) { + callback(e as Error, undefined); + } }; } \ No newline at end of file diff --git a/packages/temple-web/public/styles/theme.css b/packages/temple-web/public/styles/theme.css index c09270e..62a3d05 100644 --- a/packages/temple-web/public/styles/theme.css +++ b/packages/temple-web/public/styles/theme.css @@ -325,6 +325,97 @@ a, a:link a:hover, a:active, a:visited { } } +/* Table +---------------------------------*/ +.tbl-container { + position: relative; +} +.tbl { + border-collapse: collapse; + display: table; + width: 100%; +} + +.tbl-scroll { + overflow: auto; + flex-grow: 1; + height: 100%; + width: 100%; +} + +.tbl-nowrap { + white-space: nowrap; +} + +.tbl-z0 { + z-index: 0; +} +.tbl-z1 { + z-index: 1; +} +.tbl-z2 { + z-index: 2; +} +.tbl-z3 { + z-index: 3; +} +.tbl-z4 { + z-index: 4; +} + +.tbl-sticky { + position: sticky; +} +.tbl-sticky-b { + bottom: 0; +} +.tbl-sticky-l { + left: 0; +} +.tbl-sticky-t { + top: 0; +} +.tbl-sticky-r { + right: 0; +} + +.tbl-col { + border-color: black; + border-style: solid; + border-top-width: 1px; + padding-bottom: 16px; + padding-left: 12px; + padding-right: 12px; + padding-top: 16px; +} + +.tbl-foot { + border-color: black; + border-style: solid; + border-top-width: 1px; + padding-bottom: 16px; + padding-left: 12px; + padding-right: 12px; + padding-top: 16px; +} + +.tbl-row { + padding-bottom: 16px; + padding-left: 12px; + padding-right: 12px; + padding-top: 16px; +} + +.tbl-head { + border-color: black; + border-style: solid; + border-top-width: 1px; + padding-bottom: 16px; + padding-left: 12px; + padding-right: 12px; + padding-top: 16px; +} + /* Head ---------------------------------*/ .head { diff --git a/packages/temple-web/src/components/code-preview.tml b/packages/temple-web/src/components/code-preview.tml index 2308dd4..0d2a600 100644 --- a/packages/temple-web/src/components/code-preview.tml +++ b/packages/temple-web/src/components/code-preview.tml @@ -12,7 +12,6 @@ } -
{children}
\ No newline at end of file +
{children()}
\ No newline at end of file diff --git a/packages/temple-web/src/components/code-snippet.tml b/packages/temple-web/src/components/code-snippet.tml index 633644f..f18bade 100644 --- a/packages/temple-web/src/components/code-snippet.tml +++ b/packages/temple-web/src/components/code-snippet.tml @@ -3,7 +3,6 @@ :host { display: block; font-size: 16px; - line-height: 26px; } .snippet { background-color: #101113; @@ -67,19 +66,33 @@ .snippet .hljs-type { color: #C3937B; } + .terminal { + background-color: #000000; + padding: 10px; + } + .terminal span { + color: #00FF00; + } -
+ +
$ {children()}
+ +
+
+ diff --git a/packages/temple-web/src/components/panel-main.tml b/packages/temple-web/src/components/panel-main.tml index 2e8c638..54aea3c 100644 --- a/packages/temple-web/src/components/panel-main.tml +++ b/packages/temple-web/src/components/panel-main.tml @@ -1 +1 @@ -
{props.children}
\ No newline at end of file +
{children()}
\ No newline at end of file diff --git a/packages/temple-web/src/components/tui-button.tml b/packages/temple-web/src/components/tui-button.tml index f6186ca..1a0f330 100644 --- a/packages/temple-web/src/components/tui-button.tml +++ b/packages/temple-web/src/components/tui-button.tml @@ -36,7 +36,7 @@ - {children} + {children()} \ No newline at end of file diff --git a/packages/temple-web/src/components/tweet-box.tml b/packages/temple-web/src/components/tweet-box.tml index be362ab..9310791 100644 --- a/packages/temple-web/src/components/tweet-box.tml +++ b/packages/temple-web/src/components/tweet-box.tml @@ -38,8 +38,8 @@ }
diff --git a/packages/temple-web/src/components/window-app.tml b/packages/temple-web/src/components/window-app.tml index 497f68a..40e1bb8 100644 --- a/packages/temple-web/src/components/window-app.tml +++ b/packages/temple-web/src/components/window-app.tml @@ -69,8 +69,8 @@ }
@@ -79,5 +79,5 @@ {title}
-
{children}
+
{children()}
\ No newline at end of file diff --git a/packages/temple-web/src/index.ts b/packages/temple-web/src/index.ts index d950489..3a5aa3a 100644 --- a/packages/temple-web/src/index.ts +++ b/packages/temple-web/src/index.ts @@ -1,9 +1,13 @@ +import type { Request, Response } from 'express'; + import fs from 'fs'; import path from 'path'; import express from 'express'; import { dev, inject } from '@ossph/temple-dev'; import engine from '@ossph/temple-express'; +type Next = () => void; + //setup an HTTP server const app = express(); //let's use express' template engine feature @@ -21,10 +25,23 @@ app.use('/temple', express.static('public')); //attach the dev middleware app.use(dev({ cwd: __dirname })); +//error handling +app.use((err: Error, req: Request, res: Response, next: Next) => { + console.error(err); + res.status(500); + res.render('500', { error: err.message }); + next(); +}); + app.get('/temple/**', (req, res) => { const props = { title: 'Temple Documentation' }; // ex. app - const route = req.path.substring(8); + const route = (() => { + if (req.path.endsWith('.html')) { + return req.path.substring(8, req.path.length - 5); + } + return req.path.substring(8) + })(); //if route is empty, go to index if (route.length === 0) { res.type('text/html'); diff --git a/packages/temple-web/src/pages/500.tml b/packages/temple-web/src/pages/500.tml new file mode 100644 index 0000000..3209fce --- /dev/null +++ b/packages/temple-web/src/pages/500.tml @@ -0,0 +1,39 @@ + + + + + + + + + + +
+

Oops...

+

Something went wrong. Please try again later.

+
{error || ''}
+
+
+ + \ No newline at end of file diff --git a/packages/temple-web/src/pages/ast.tml b/packages/temple-web/src/pages/ast.tml new file mode 100644 index 0000000..635c1e0 --- /dev/null +++ b/packages/temple-web/src/pages/ast.tml @@ -0,0 +1,73 @@ + + + + + + + + + + + +
+
+ Show AST +
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/packages/temple-web/src/pages/docs/index.tml b/packages/temple-web/src/pages/docs/index.tml index ae8270c..07bed04 100644 --- a/packages/temple-web/src/pages/docs/index.tml +++ b/packages/temple-web/src/pages/docs/index.tml @@ -10,17 +10,31 @@ margin: 0; padding: 0; } + h1 { text-transform: uppercase; } a, a:link, a:hover, a:active, a:visited { color: var(--fg-primary); text-decoration: none; } p, li { - font-size: 20px; line-height: 36px; } + th { + padding: 10px; + text-align: left; + text-transform: uppercase; + } + td { + border-color: var(--muted); + border-top-style: solid; + border-top-width: 1px; + padding: 10px; + } .fab, .fas, .fa { line-height: 16px; } + .container { + padding: 10px 20px; + } + + + + + + +

Getting Started

+

+ To use Temple in your project, run one of the + following commands in your terminal: +

+
+ + + npm install @ossph/temple + + +
+
+
+ + \ No newline at end of file diff --git a/packages/temple-web/src/pages/index.tml b/packages/temple-web/src/pages/index.tml index 2977d90..dc77f7c 100644 --- a/packages/temple-web/src/pages/index.tml +++ b/packages/temple-web/src/pages/index.tml @@ -198,10 +198,10 @@ Temple Logo

Temple

The reactive web component template engine.

- + Get Started - + Read the Docs diff --git a/packages/temple-web/src/templates/panel-head.tml b/packages/temple-web/src/templates/panel-head.tml index 5293e40..f1b5c13 100644 --- a/packages/temple-web/src/templates/panel-head.tml +++ b/packages/temple-web/src/templates/panel-head.tml @@ -1,7 +1,9 @@
- Temple Logo -

Temple

+ + Temple Logo + +

Temple