Start working on responsiveness and about page.

This commit is contained in:
Joshua Bemenderfer 2023-02-13 22:09:29 -05:00
parent 6dce7ff031
commit 8b9a136d88
22 changed files with 106 additions and 47 deletions

View File

@ -5,7 +5,7 @@ const EleventyFeatherIcons = require('eleventy-plugin-feathericons');
const HighlightJS = require('highlight.js') const HighlightJS = require('highlight.js')
const { useDocument } = require('@terrace/js/document') const { useDocument } = require('@terrace/js/document')
const { createFileReader } = require('@terrace/js/readers/node-readline') const { createFileReader } = require('@terrace/js/readers/node-readline')
const parsePage = require('./parser/page.js'); const parsePage = require('./src/parser/page.js');
module.exports = function (config) { module.exports = function (config) {
config.addPlugin(EleventyVitePlugin) config.addPlugin(EleventyVitePlugin)

View File

@ -1,4 +1,4 @@
{% set commonClasses = "px-12 py-3 text-white rounded-md w-auto" %} {% set commonClasses = "px-6 py-2 md:px-12 md:py-3 text-white rounded-md w-auto whitespace-nowrap" %}
{% macro render(node) %} {% macro render(node) %}
<a <a
href="{{ node.href }}" href="{{ node.href }}"

View File

@ -12,7 +12,7 @@ set languageMeta = {
%} %}
{% macro render(node) %} {% macro render(node) %}
<div class="text-white text-base relative flex w-full"> <div class="text-white text-sm md:text-base relative flex w-full {{ node.class }}">
{% macro Language(id, code, isFirst) %} {% macro Language(id, code, isFirst) %}
<details <details
{{ 'open' if isFirst else '' }} {{ 'open' if isFirst else '' }}
@ -22,7 +22,7 @@ set languageMeta = {
<summary <summary
class="flex gap-2 items-center px-4 py-2 cursor-pointer text-neutral-50 group-open:text-primary-500 bg-neutral-800 border-b-2 border-b-neutral-50/25 group-open:border-b-primary-600" class="flex gap-2 items-center px-4 py-2 cursor-pointer text-neutral-50 group-open:text-primary-500 bg-neutral-800 border-b-2 border-b-neutral-50/25 group-open:border-b-primary-600"
> >
<div class="w-[16px] h-[16px]">{{ languageMeta[id].icon | safe }}</div> <div class="w-[16px] h-[16px] hidden md:block">{{ languageMeta[id].icon | safe }}</div>
{{ languageMeta[id].name }} {{ languageMeta[id].name }}
</summary> </summary>
<pre <pre

View File

@ -1,6 +1,7 @@
{% set levelClasses = { {% set levelClasses = {
'2': 'text-5xl text-transparent bg-clip-text bg-gradient-to-b from-primary-400 to-primary-600 mb-12', '1': 'text-5xl text-transparent bg-clip-text bg-gradient-to-b from-primary-400 to-primary-600 mb-12',
'3': 'text-2xl font-light' '2': 'text-4xl text-transparent bg-clip-text bg-gradient-to-b from-primary-400 to-primary-600 mb-12',
'3': 'text-lg md:text-2xl font-light'
} %} } %}
{% macro render(node) %} {% macro render(node) %}

View File

@ -6,8 +6,8 @@
</div> </div>
{% else %} {% else %}
<div class="flex gap-4 items-center"> <div class="flex gap-4 items-center">
<img src="/logo.png" class="w-16 h-16" alt=""/> <img src="/logo.png" class="w-8 h-8 md:w-16 md:h-16" alt=""/>
<h1 class="text-5xl text-transparent bg-clip-text bg-gradient-to-b from-primary-400 to-primary-600">Terrace</h1> <h1 class="text-xl md:text-5xl text-transparent bg-clip-text bg-gradient-to-b from-primary-400 to-primary-600">Terrace</h1>
</div> </div>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View File

@ -1,5 +1,10 @@
{% macro render(node) %} {% macro render(node) %}
<div class="prose prose-neutral prose-lg text-base prose-p:mb-4 prose-ul:my-2 prose-ul:list-none prose-li:my-0 prose-a:text-primary-200 text-current {{node.class}}"> <div class="
prose prose-neutral text-base
prose-p:mb-2 prose-ul:my-1 prose-ul:pl-0 prose-ul:ml-6
md:prose-p:mb-4 md:prose-ul:pl-4 md:prose-ul:ml-2 md:prose-ul:my-2
prose-li:my-0 prose-a:text-primary-200 text-current {{node.class}}
">
{{ node.text | safe }} {{ node.text | safe }}
</div> </div>
{% endmacro %} {% endmacro %}

View File

@ -1,21 +1,44 @@
{% from "./Node.njk" import Node %} {% from "./Node.njk" import Node %}
{% macro render(node) %} {% macro render(node) %}
<nav class="relative bg-neutral-800 text-neutral-50 h-20 flex items-center"> <nav class="fixed left-0 right-0 top-0 lg:relative bg-neutral-800 text-neutral-50 h-20 flex items-center z-10">
<div class="container mx-auto flex items-center space-between"> <div class="container mx-auto px-8 flex items-center space-between">
<a href="/" class="w-full"> <a id="nav" class="peer" href="#nav" aria-hidden="true" tabindex="-1"></a>
<div class="absolute z-10 bg-neutral-800 w-full h-full top-0 left-0 lg:hidden"></div>
<a href="/" class="relative w-full z-20">
{{ Node('Logo', { variant: 'small' }) }} {{ Node('Logo', { variant: 'small' }) }}
</a> </a>
<div class="flex gap-8 items-stretch">
<a href="/docs" class="flex items-center hover:text-primary-400">Docs</a> <div class="
<a href="/docs" class="flex items-center hover:text-primary-400">Examples</a> group
<a href="/docs" class="flex items-center hover:text-primary-400">About</a> fixed flex flex-col gap-8 items-stretch w-full bg-neutral-800 text-neutral-50 top-20 bottom-0 left-0 px-7
<a href="/docs" class="flex items-center hover:text-primary-400">Contribute</a> transition-transform
{{ Node('SearchBox', { class: 'w-72' }) }} -translate-y-full
<a href="https://git.thederf.com/thederf/Terrace" target="_blank" class="flex items-center hover:text-primary-400"> pointer-events-none
{{ Node('Icon', { icon: 'github' }) }} peer-target:translate-y-0
peer-target:pointer-events-auto
lg:translate-y-0
lg:pointer-events-auto
lg:relative lg:top-0 lg:px-0 lg:flex-row lg:flex-1 lg:h-20 lg:bg-neutral-800 lg:text-white
">
<a href="/docs/" class="flex items-center hover:text-primary-400">Docs</a>
<a href="/docs/" class="flex items-center hover:text-primary-400">Examples</a>
<a href="/about/" class="flex items-center hover:text-primary-400">About</a>
<a href="/docs/" class="flex items-center hover:text-primary-400">Contribute</a>
<div class="-order-1 lg:order-2 flex items-center">{{ Node('SearchBox', { class: 'w-full lg:w-72' }) }}</div>
<a href="https://git.thederf.com/thederf/Terrace" target="_blank" class="flex items-center hover:text-primary-400 order-3">
{{ Node('Icon', { icon: 'github' }) }}<div class="ml-4 lg:hidden">Code</div>
</a> </a>
</div> </div>
<a href="#nav" title="Open Menu" class="absolute right-4 flex peer-target:hidden lg:hidden h-16 w-16 items-center justify-center z-20">
{{ Node('Icon', { icon: 'menu' }) }}
</a>
<a href="#" title="Close Menu" class="absolute right-4 hidden peer-target:flex lg:hidden lg:peer-target:hidden h-16 w-16 items-center justify-center text-primary-500 z-20">
{{ Node('Icon', { icon: 'x' }) }}
</a>
</div> </div>
</nav> </nav>
{% endmacro %} {% endmacro %}

View File

@ -1,7 +1,7 @@
{% from "./Node.njk" import Node %} {% from "./Node.njk" import Node %}
{% macro render(node) %} {% macro render(node) %}
<div class="{{ node.class }} flex gap-4 px-4 py-2 rounded-md border-2 border-neutral-50/75 focus-within:border-primary-400 focus-within:text-primary-400 bg-transparent text-neutral-50"> <div class="flex gap-4 px-4 py-2 rounded-md border-2 border-neutral-50/75 focus-within:border-primary-400 focus-within:text-primary-400 bg-transparent text-neutral-50 {{ node.class }}">
<input type="text" placeholder="Search" class="w-full bg-transparent outline-none"/> <input type="text" placeholder="Search" class="w-full bg-transparent outline-none"/>
{{ Node('Icon', { icon: 'search' }) }} {{ Node('Icon', { icon: 'search' }) }}
</div> </div>

View File

@ -11,7 +11,7 @@
<path d="M0 55H1920V6.99994C1811 55 1150 55 403.5 6.99994C141.541 -9.84407 0 6.99996 0 55Z" fill="currentColor"/> <path d="M0 55H1920V6.99994C1811 55 1150 55 403.5 6.99994C141.541 -9.84407 0 6.99996 0 55Z" fill="currentColor"/>
</svg> </svg>
<section class="{{ variants[node.variant] }}"> <section class="{{ variants[node.variant] }}">
<div class="container mx-auto pt-8 pb-32 {{ node.class }}"> <div class="{{ node.class }} container mx-auto px-8 pt-16 md:pt-8 pb-32">
{% for child in node.children %} {% for child in node.children %}
{{ Node(child.type, child) }} {{ Node(child.type, child) }}
{% endfor %} {% endfor %}

25
docs/src/about.tce Normal file
View File

@ -0,0 +1,25 @@
layout layout.njk
title About - Terrace - A simple structured data language
description
A simple structured data syntax for configuration, content authoring, and DSLs.
Terrace gets out of your way to let you just write
Section light
class pt-40 md:pt-32
Header 1 About Terrace
Markdown
- Needed a way to define block-based content in plain text
- Initially based on S-Expressions
- Inspired by Tree Notation & I-Expressions
Section dark
Header 2 Development Philosophy
Markdown
- No “framework”
- Tiny core, no dependencies
- As few rules as possible, let users do what they want
- Be memory friendly, dont do any work you dont have to
- Use underlying syntax, not custom patterns

View File

@ -5,11 +5,12 @@ description
Terrace gets out of your way to let you just write Terrace gets out of your way to let you just write
Section light Section light
class pt-32 pb-64 flex gap-48 class pt-40 md:pt-32 pb-48 md:pb-64 flex flex-col gap-16 md:flex-row md:gap-48
Div Block
class flex flex-col gap-8 w-full items-start class flex flex-col gap-8 w-full items-start
Logo light Logo light
Markdown Markdown
class prose-ul:list-none
A simple structured data syntax for A simple structured data syntax for
- **Configuration** - **Configuration**
- **Content authoring** - **Content authoring**
@ -22,6 +23,7 @@ Section light
Get Started Get Started
CodeExample CodeExample
class min-h-[350px]
terrace terrace
title Terrace - A simple structured data language title Terrace - A simple structured data language
description description
@ -71,12 +73,12 @@ Section light
Section dark Section dark
Header 2 Uses Header 2 Uses
Div Block
class flex gap-48 space-between class flex flex-col space-between gap-16 md:flex-row md:gap-48
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon settings Icon settings
Header 3 Configuration Header 3 Configuration
@ -88,9 +90,9 @@ Section dark
If you wish, you can build in your own input validation and type casting while parsing configuration files. If you wish, you can build in your own input validation and type casting while parsing configuration files.
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon feather Icon feather
Header 3 Content Authoring Header 3 Content Authoring
@ -100,9 +102,9 @@ Section dark
This enables effortless mixing of data, prose, and functional blocks in human-written documents. No more need for clumsy frontmatter or custom Markdown extensions! This enables effortless mixing of data, prose, and functional blocks in human-written documents. No more need for clumsy frontmatter or custom Markdown extensions!
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon code Icon code
Header 3 Domain-Specific Languages Header 3 Domain-Specific Languages
@ -119,10 +121,10 @@ Section dark
Section light Section light
Header 2 Core Header 2 Core
Div Block
class flex gap-48 space-between class flex flex-col space-between gap-16 md:flex-row md:gap-48
Div Block
Header 3 Tiny - <strong>Really Tiny</strong> Header 3 Tiny - <strong>Really Tiny</strong>
class mb-4 class mb-4
Markdown Markdown
@ -133,7 +135,7 @@ Section light
Markdown Markdown
Need to use Terrace in another runtime? The tiny core and reliance on rudimentary control structures makes that a cinch! Need to use Terrace in another runtime? The tiny core and reliance on rudimentary control structures makes that a cinch!
Div Block
Header 3 Zero Dependencies Header 3 Zero Dependencies
class mb-4 class mb-4
Markdown Markdown
@ -144,7 +146,7 @@ Section light
Markdown Markdown
Terrace allocates no dynamic memory of its own, working entirely on the stack. A great fit for resource-constrained environments. Terrace allocates no dynamic memory of its own, working entirely on the stack. A great fit for resource-constrained environments.
Div Block
Header 3 Unopinionated Header 3 Unopinionated
class mb-4 class mb-4
Markdown Markdown
@ -162,12 +164,12 @@ Section light
Section dark Section dark
Header 2 Learn More Header 2 Learn More
Div Block
class flex gap-48 space-between class flex flex-col space-between gap-16 md:flex-row md:gap-48
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon info Icon info
Header 3 About Header 3 About
@ -175,9 +177,9 @@ Section dark
Markdown Markdown
Why does Terrace exist? What is it based on? What is the development philosophy? Why does Terrace exist? What is it based on? What is the development philosophy?
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon file-text Icon file-text
Header 3 Documentation Header 3 Documentation
@ -185,9 +187,9 @@ Section dark
Markdown Markdown
Setup instructions, API documentation, and recipes for how to perform common tasks with Terrace. Setup instructions, API documentation, and recipes for how to perform common tasks with Terrace.
Div Block
class max-w-prose class max-w-prose
Div Block
class flex gap-4 items-center mb-4 class flex gap-4 items-center mb-4
Icon users Icon users
Header 3 Contribute Header 3 Contribute

View File

@ -3,14 +3,17 @@ const { contentAsText } = require('../helpers')
const languages = ['terrace', 'json', 'yaml', 'toml', 'javascript', 'typescript', 'c', 'python'] const languages = ['terrace', 'json', 'yaml', 'toml', 'javascript', 'typescript', 'c', 'python']
module.exports = async (doc, rootLevel) => { module.exports = async (doc, rootLevel) => {
const { next, level, line, head, tail } = doc const { next, level, line, head, tail, match } = doc
const node = { const node = {
type: head(), type: head(),
class: '',
languages: {} languages: {}
} }
while (await next(rootLevel)) { while (await next(rootLevel)) {
if (match('class')) node.class = tail()
const languageLevel = level() const languageLevel = level()
if (languages.includes(head())) { if (languages.includes(head())) {
node.languages[head()] = await contentAsText(doc, languageLevel) node.languages[head()] = await contentAsText(doc, languageLevel)

View File

@ -1,6 +1,6 @@
const parseNode = require('./Node.js') const parseNode = require('./Node.js')
module.exports.Div = parseNode module.exports.Block = parseNode
module.exports.Section = async (doc, rootLevel) => { module.exports.Section = async (doc, rootLevel) => {
const variant = doc.tail() const variant = doc.tail()
return { variant, ...(await parseNode(doc, rootLevel)) } return { variant, ...(await parseNode(doc, rootLevel)) }

BIN
docs/src/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB