improved stream
This commit is contained in:
parent
694893baa7
commit
3e46951317
|
|
@ -6,10 +6,8 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400..900;1,400..900&display=swap"
|
||||
rel="stylesheet">
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Alegreya+Sans:ital,wght@0,300;0,400;0,500;0,700;0,800;0,900;1,300;1,400;1,500;1,700;1,800;1,900&family=Alegreya:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
|
||||
href="https://fonts.googleapis.com/css2?family=Alegreya+Sans:ital,wght@0,300;0,400;0,500;0,700;0,800;0,900;1,300;1,400;1,500;1,700;1,800;1,900&family=Alegreya:ital,wght@0,400..900;1,400..900&family=IBM+Plex+Mono:ital,wght@0,200;0,300;0,400;0,500;0,600;1,200;1,300;1,400;1,500;1,600&display=swap"
|
||||
rel="stylesheet">
|
||||
<title>Orion Reed</title>
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@
|
|||
"glob": "^10.3.3",
|
||||
"markdown-to-jsx": "^7.3.2",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.9"
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-top-level-await": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"deps/gray-matter": {
|
||||
|
|
@ -1305,6 +1306,23 @@
|
|||
"react": "^16.8 || ^17.0 || ^18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-virtual": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-3.0.1.tgz",
|
||||
"integrity": "sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^1.20.0||^2.0.0||^3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/pluginutils": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz",
|
||||
|
|
@ -1318,6 +1336,200 @@
|
|||
"node": ">= 8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.76.tgz",
|
||||
"integrity": "sha512-aYYTA2aVYkwJAZepQXtPnkUthhOfn8qd6rsh+lrJxonFrjmpI7RHt2tMDVTXP6XDX7fvnvrVtT1bwZfmBFPh0Q==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/swc"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-darwin-arm64": "1.3.76",
|
||||
"@swc/core-darwin-x64": "1.3.76",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.3.76",
|
||||
"@swc/core-linux-arm64-gnu": "1.3.76",
|
||||
"@swc/core-linux-arm64-musl": "1.3.76",
|
||||
"@swc/core-linux-x64-gnu": "1.3.76",
|
||||
"@swc/core-linux-x64-musl": "1.3.76",
|
||||
"@swc/core-win32-arm64-msvc": "1.3.76",
|
||||
"@swc/core-win32-ia32-msvc": "1.3.76",
|
||||
"@swc/core-win32-x64-msvc": "1.3.76"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/helpers": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-arm64": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.76.tgz",
|
||||
"integrity": "sha512-ovviEhZ/1E81Z9OGrO0ivLWk4VCa3I3ZzM+cd3gugglRRwVwtlIaoIYqY5S3KiCAupDd1+UCl5X7Vbio7a/V8g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-x64": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.76.tgz",
|
||||
"integrity": "sha512-tcySTDqs0SHCebtW35sCdcLWsmTEo7bEwx0gNL/spetqVT9fpFi6qU8qcnt7i2KaZHbeNl9g1aadu+Yrni+GzA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm-gnueabihf": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.76.tgz",
|
||||
"integrity": "sha512-apgzpGWy1AwoMF4urAAASsAjE7rEzZFIF+p6utuxhS7cNHzE0AyEVDYJbo+pzBdlZ8orBdzzsHtFwoEgKOjebA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-gnu": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.76.tgz",
|
||||
"integrity": "sha512-c3c0zz6S0eludqidDpuqbadE0WT3OZczyQxe9Vw8lFFXES85mvNGtwYzyGK2o7TICpsuHrndwDIoYpmpWk879g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-musl": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.76.tgz",
|
||||
"integrity": "sha512-Is3bpq7F2qtlnkzEeOD6HIZJPpOmu3q6c82lKww90Q0NnrlSluVMozTHJgwVoFZyizH7uLnk0LuNcEAWLnmJIw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-gnu": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.76.tgz",
|
||||
"integrity": "sha512-iwCeRzd9oSvUzqt7nU6p/ztceAWfnO9XVxBn502R5gs6QCBbE1HCKrWHDO77aKPK7ss+0NcIGHvXTd9L8/wRzw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-musl": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.76.tgz",
|
||||
"integrity": "sha512-a671g4tW8kyFeuICsgq4uB9ukQfiIyXJT4V6YSnmqhCTz5mazWuDxZ5wKnx/1g5nXTl+U5cWH2TZaCJatp4GKA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-arm64-msvc": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.76.tgz",
|
||||
"integrity": "sha512-+swEFtjdMezS0vKUhJC3psdSDtOJGY5pEOt4e8XOPvn7aQpKQ9LfF49XVtIwDSk5SGuWtVoLFzkSY3reWUJCyg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-ia32-msvc": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.76.tgz",
|
||||
"integrity": "sha512-5CqwAykpGBJ3PqGLOlWGLGIPpBAG1IwWVDUfro3hhjQ7XJxV5Z1aQf5V5OJ90HJVtrEAVx2xx59UV/Dh081LOg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-x64-msvc": {
|
||||
"version": "1.3.76",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.76.tgz",
|
||||
"integrity": "sha512-CiMpWLLlR3Cew9067E7XxaLBwYYJ90r9EhGSO6V1pvYSWj7ET/Ppmtj1ZhzPJMqRXAP6xflfl5R5o4ee1m4WLA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.4.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz",
|
||||
|
|
@ -7875,6 +8087,15 @@
|
|||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
|
||||
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/vinyl": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz",
|
||||
|
|
@ -7947,6 +8168,20 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vite-plugin-top-level-await": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.3.1.tgz",
|
||||
"integrity": "sha512-55M1h4NAwkrpxPNOJIBzKZFihqLUzIgnElLSmPNPMR2Fn9+JHKaNg3sVX1Fq+VgvuBksQYxiD3OnwQAUu7kaPQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rollup/plugin-virtual": "^3.0.1",
|
||||
"@swc/core": "^1.3.10",
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": ">=2.8"
|
||||
}
|
||||
},
|
||||
"node_modules/warning-symbol": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/warning-symbol/-/warning-symbol-0.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"prebuild": "node scripts/prebuild.mjs",
|
||||
"build": "node scripts/prebuild.mjs && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
|
|
@ -28,6 +29,7 @@
|
|||
"glob": "^10.3.3",
|
||||
"markdown-to-jsx": "^7.3.2",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.9"
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-top-level-await": "^1.3.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
{"id":0, "date":"2023-01-11","text":">When asked, “How could you possibly have done the first interactive graphics program, the first non-procedural programming language, the first object oriented software system, all in one year?” Ivan replied: “Well, I didnt know it was hard.”\n\n— via Alan Kay, Doing with Images Makes Symbols, 1987"}
|
||||
{"id":1, "date":"2023-05-21","text":"**Little excerpt**\n\nAn approach to interfaces in which a network of transformations, constraints, preferences, and other relations connect object(s) of interest to an interface surrogate. The system as a whole is responsible for resolving the arbitrary and complex relationship between an object and surrogate and bridging that surrogate representation to a representation which is observable to users."}
|
||||
{"date":"2019-01-01T00:00:00.000Z","text":"# This is a test\nhere is some text... I think once I can author posts and thoughts in here, I'll be able to get a lot more done.\n","id":0}
|
||||
{"date":"2020-01-01T00:00:00.000Z","text":"Lorum ipsum dolor sit amet, conse.\n- This is a task\n- This is another task\n","id":1}
|
||||
{"date":"2023-05-11T00:00:00.000Z","text":"multiple file formats\n\n\n- heterogenous decentralisation\n- cats is about objects which are processes, making them deployable as infrastructure\n- processes are blocks. cats, like blocks, do not care what the objects being processed are\n- RIDs for CARs? (is this RIDs for identity too?)\n\t- how to represent and deploy inter-systemic (Identity) relations\n- are relations the same as blocks? are they a superset? subset?\n- to Z: how would a non-process relation be represented as a block? i.e. relations\n\t- symmetric blocks? \n- content-addressed files form a network of acyclical reference\n\nportable relations & (RIDs for) content-addressed relations\n```\nRID[CID] -> {\n\trelation: RID (Identity)\n\trelata: set | (set, set)\n}\n```\n\n```\nAdd -> {\n\trelation: AddBlock\n\trelata: [\n\t\tspace_1,\n\t\tspace_2\n\t]\n}\n\nReduceDimensions -> {\n\trelation: ReduceDimensionsProcess\n\trelata: {...}\n}\n\nIsomorphic -> {\n\trelation: Isomorphism\n\trelata: {...}\n}\n```\n\n```\nIdentity -> {\n\trelation: Identity\n\trelata: {O1, O2, ..., On}\n}\n```\n\nIdentity and symmetric functions\n\n$C(S, D) \\land \\forall O_1, O_2 \\in \\text{Identity}: S(O_1, O_2) \\land (O_1 \\neq O_2 \\rightarrow D(O_1, O_2))$\n\n- $S(f, g) \\equiv \\forall x \\in \\text{Domain}(f) \\cap \\text{Domain}(g): f(x) = g(x)$\n\n$S((f_1, g_1), (f_2, g_2)) \\equiv \\forall a \\in \\text{Domain}(f_1) \\cap \\text{Domain}(f_2): g_1(f_1(a)) = a = g_2(f_2(a))$ and $\\forall b \\in \\text{Domain}(g_1) \\cap \\text{Domain}(g_2): f_1(g_1(b)) = b = f_2(g_2(b))$.\n","id":2}
|
||||
{"date":"2023-05-11T00:00:00.000Z","text":"I need to try and catch this system out with some `special characters` and unescaped bit's of stuff... What about links? [like this](https://www.google.com)","id":3}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
date: 2019-01-01 00:00:00
|
||||
---
|
||||
# This is a test
|
||||
here is some text... I think once I can author posts and thoughts in here, I'll be able to get a lot more done.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
date: 2020-01-01 00:00:00
|
||||
---
|
||||
Lorum ipsum dolor sit amet, conse.
|
||||
- This is a task
|
||||
- This is another task
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
date: 2023-05-11 00:00:00
|
||||
---
|
||||
I need to try and catch this system out with some `special characters` and unescaped bit's of stuff... What about links? [like this](https://www.google.com)
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
---
|
||||
date: 2023-05-11 00:00:00
|
||||
---
|
||||
multiple file formats
|
||||
|
||||
|
||||
- heterogenous decentralisation
|
||||
- cats is about objects which are processes, making them deployable as infrastructure
|
||||
- processes are blocks. cats, like blocks, do not care what the objects being processed are
|
||||
- RIDs for CARs? (is this RIDs for identity too?)
|
||||
- how to represent and deploy inter-systemic (Identity) relations
|
||||
- are relations the same as blocks? are they a superset? subset?
|
||||
- to Z: how would a non-process relation be represented as a block? i.e. relations
|
||||
- symmetric blocks?
|
||||
- content-addressed files form a network of acyclical reference
|
||||
|
||||
portable relations & (RIDs for) content-addressed relations
|
||||
```
|
||||
RID[CID] -> {
|
||||
relation: RID (Identity)
|
||||
relata: set | (set, set)
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
Add -> {
|
||||
relation: AddBlock
|
||||
relata: [
|
||||
space_1,
|
||||
space_2
|
||||
]
|
||||
}
|
||||
|
||||
ReduceDimensions -> {
|
||||
relation: ReduceDimensionsProcess
|
||||
relata: {...}
|
||||
}
|
||||
|
||||
Isomorphic -> {
|
||||
relation: Isomorphism
|
||||
relata: {...}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
Identity -> {
|
||||
relation: Identity
|
||||
relata: {O1, O2, ..., On}
|
||||
}
|
||||
```
|
||||
|
||||
Identity and symmetric functions
|
||||
|
||||
$C(S, D) \land \forall O_1, O_2 \in \text{Identity}: S(O_1, O_2) \land (O_1 \neq O_2 \rightarrow D(O_1, O_2))$
|
||||
|
||||
- $S(f, g) \equiv \forall x \in \text{Domain}(f) \cap \text{Domain}(g): f(x) = g(x)$
|
||||
|
||||
$S((f_1, g_1), (f_2, g_2)) \equiv \forall a \in \text{Domain}(f_1) \cap \text{Domain}(f_2): g_1(f_1(a)) = a = g_2(f_2(a))$ and $\forall b \in \text{Domain}(g_1) \cap \text{Domain}(g_2): f_1(g_1(b)) = b = f_2(g_2(b))$.
|
||||
|
|
@ -2,9 +2,9 @@ import {glob} from 'glob';
|
|||
import fs from 'fs';
|
||||
import fm from 'front-matter';
|
||||
|
||||
const posts_dir = 'public/posts/';
|
||||
|
||||
function loadStrings() {
|
||||
function loadPosts() {
|
||||
const posts_dir = 'public/posts/';
|
||||
const posts = glob.sync(`${posts_dir}*.md`).map((file) => {
|
||||
const content = fs.readFileSync(file, 'utf8');
|
||||
const slug = file.replace(`${posts_dir}`, '').replace('.md', '');
|
||||
|
|
@ -14,8 +14,25 @@ function loadStrings() {
|
|||
return posts.sort((a, b) => new Date(a.date) - new Date(b.date));
|
||||
}
|
||||
|
||||
function saveStrings(posts) {
|
||||
fs.writeFileSync('public/posts.jsonl', posts.map((post) => JSON.stringify(post)).join('\n'));
|
||||
function loadStream() {
|
||||
const streams_dir = 'public/stream/';
|
||||
const posts = glob.sync(`${streams_dir}*.md`).map((file) => {
|
||||
const content = fs.readFileSync(file, 'utf8');
|
||||
const md = fm(content)
|
||||
const { date } = md.attributes;
|
||||
const text = md.body;
|
||||
return { date, text };
|
||||
});
|
||||
posts.sort((a, b) => new Date(a.date) - new Date(b.date))
|
||||
posts.forEach((post, i) => {
|
||||
post.id = i;
|
||||
})
|
||||
return posts
|
||||
}
|
||||
|
||||
saveStrings(loadStrings());
|
||||
function saveJsonl(entries, file) {
|
||||
fs.writeFileSync(file, entries.map((e) => JSON.stringify(e)).join('\n'));
|
||||
}
|
||||
|
||||
saveJsonl(loadPosts(), 'public/posts.jsonl');
|
||||
saveJsonl(loadStream(), 'public/stream.jsonl');
|
||||
|
|
@ -9,7 +9,8 @@ import {
|
|||
createStyles,
|
||||
} from '@mantine/core'
|
||||
import { friendlyDate, getJsonl } from '@/utils'
|
||||
import { useEffect, useState } from 'preact/hooks'
|
||||
|
||||
const posts = await getJsonl('posts.jsonl')
|
||||
|
||||
type Post = {
|
||||
slug: string
|
||||
|
|
@ -54,31 +55,18 @@ function Frame({ children }) {
|
|||
}
|
||||
|
||||
export function Posts() {
|
||||
const [posts, setPost] = useState<Array<Post>>(null)
|
||||
useEffect(() => {
|
||||
getJsonl('posts.jsonl').then(setPost)
|
||||
}, [])
|
||||
|
||||
if (!posts) {
|
||||
return (
|
||||
<Frame>
|
||||
<Text>Loading posts...</Text>
|
||||
</Frame>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<Frame>
|
||||
{posts.map((post, index, array) => {
|
||||
return (
|
||||
<PostListItem
|
||||
slug={post.slug}
|
||||
title={post.title}
|
||||
date={post.date}
|
||||
index={array.length - 1 - index}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
</Frame>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Frame>
|
||||
{posts.map((post, index, array) => {
|
||||
return (
|
||||
<PostListItem
|
||||
slug={post.slug}
|
||||
title={post.title}
|
||||
date={post.date}
|
||||
index={array.length - 1 - index}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
</Frame>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {
|
|||
createStyles,
|
||||
Title,
|
||||
TextInput,
|
||||
Anchor,
|
||||
} from '@mantine/core'
|
||||
import { Header } from '@/components/Header'
|
||||
import Markdown from 'markdown-to-jsx'
|
||||
|
|
@ -16,7 +17,6 @@ import { friendlyDate, getJsonl } from '@/utils'
|
|||
|
||||
const search = signal('')
|
||||
|
||||
const margin = '0.3em'
|
||||
const streamItems = await getJsonl('stream.jsonl')
|
||||
const miniSearch = new MiniSearch({
|
||||
fields: ['text'], // fields to index for full-text search
|
||||
|
|
@ -28,31 +28,22 @@ const miniSearch = new MiniSearch({
|
|||
})
|
||||
miniSearch.addAll(streamItems)
|
||||
|
||||
const heading = { fontSize: '1.2em', marginBottom: 0 }
|
||||
const margin = '0.3em'
|
||||
const marginY = { marginTop: margin, marginBottom: margin }
|
||||
const useStyles = createStyles((theme) => ({
|
||||
group: {
|
||||
color: theme.black,
|
||||
lineHeight: '1.4em',
|
||||
fontFamily: theme.headings.fontFamily,
|
||||
},
|
||||
group: {},
|
||||
item: {
|
||||
color: theme.black,
|
||||
fontFamily: theme.headings.fontFamily,
|
||||
lineHeight: '1.2em',
|
||||
flexWrap: 'nowrap',
|
||||
fontSize: '0.85em',
|
||||
'& :first-of-type': {
|
||||
marginTop: 0,
|
||||
},
|
||||
'& p': {
|
||||
marginTop: margin,
|
||||
marginBottom: margin,
|
||||
},
|
||||
'& pre': {
|
||||
marginTop: margin,
|
||||
marginBottom: margin,
|
||||
},
|
||||
'& ul': {
|
||||
marginTop: margin,
|
||||
marginBottom: margin,
|
||||
paddingLeft: '1.4em',
|
||||
},
|
||||
|
||||
'& p': marginY,
|
||||
'& ul': { ...marginY, marginLeft: '0em', paddingLeft: '1em' },
|
||||
'& blockquote': {
|
||||
marginTop: '0.8em',
|
||||
marginBottom: '0.8em',
|
||||
|
|
@ -60,32 +51,57 @@ const useStyles = createStyles((theme) => ({
|
|||
paddingLeft: '1em',
|
||||
borderLeft: `0.25em solid ${theme.colors.gray[3]}`,
|
||||
},
|
||||
'& h1': heading,
|
||||
'& h2': heading,
|
||||
'& h3': heading,
|
||||
'& h4': heading,
|
||||
'& h5': heading,
|
||||
'& h6': heading,
|
||||
'& code': {
|
||||
fontFamily: theme.fontFamilyMonospace,
|
||||
background: theme.colors.gray[1],
|
||||
borderRadius: theme.radius.sm,
|
||||
paddingLeft: '0.2em',
|
||||
paddingRight: '0.2em',
|
||||
fontSize: '0.8em',
|
||||
},
|
||||
'& pre': {
|
||||
background: theme.colors.gray[1],
|
||||
padding: theme.spacing.sm,
|
||||
borderRadius: theme.radius.sm,
|
||||
},
|
||||
},
|
||||
date: {
|
||||
fontFamily: theme.headings.fontFamily,
|
||||
|
||||
fontFamily: theme.fontFamilyMonospace,
|
||||
fontSize: '0.8em',
|
||||
marginRight: '0.2em',
|
||||
whiteSpace: 'nowrap',
|
||||
},
|
||||
search: {
|
||||
fontFamily: theme.headings.fontFamily,
|
||||
// border: `1px solid red`,
|
||||
fontSize: '4em',
|
||||
'& :focus': {
|
||||
border: `1px solid ${theme.black}`,
|
||||
'& input': {
|
||||
':focus': {
|
||||
border: `1px solid ${theme.colors.gray[4]}`,
|
||||
},
|
||||
fontFamily: theme.headings.fontFamily,
|
||||
fontWeight: 500,
|
||||
},
|
||||
},
|
||||
}))
|
||||
const markdownOptions = {
|
||||
overrides: {
|
||||
a: Anchor,
|
||||
},
|
||||
}
|
||||
|
||||
function StreamItem({ date, markdown }) {
|
||||
const { classes } = useStyles()
|
||||
return (
|
||||
<Group className={classes.item} align="start">
|
||||
<Text color="dimmed" className={classes.date}>
|
||||
{friendlyDate(date)}
|
||||
{friendlyDate(date, 'dd/MMM/yyyy')}
|
||||
</Text>
|
||||
<Flex>
|
||||
<Markdown>{markdown}</Markdown>
|
||||
<Markdown options={markdownOptions}>{markdown}</Markdown>
|
||||
</Flex>
|
||||
</Group>
|
||||
)
|
||||
|
|
@ -104,17 +120,17 @@ function Search() {
|
|||
search.value = event.target.value
|
||||
}}
|
||||
my="sm"
|
||||
size="md"
|
||||
variant="filled"
|
||||
placeholder="Search..."
|
||||
className={classes.search}
|
||||
placeholder="Search"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Stream() {
|
||||
const { classes } = useStyles()
|
||||
console.log(search.value)
|
||||
const results = !search.value ? streamItems : miniSearch.search(search.value)
|
||||
console.log(results)
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
export const style = {
|
||||
fontFamily: 'Alegreya, serif',
|
||||
fontFamilyMonospace: 'IBM Plex Mono, monospace',
|
||||
headings: {
|
||||
fontFamily: ['Alegreya Sans'],
|
||||
fontFamily: ['Alegreya Sans, sans-serif'],
|
||||
fontWeight: 700,
|
||||
},
|
||||
lineHeight: 1.5,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { format } from 'date-fns'
|
||||
|
||||
export function friendlyDate(dateString: string): string {
|
||||
export function friendlyDate(dateString: string, format_str?: string): string {
|
||||
const inputDate = new Date(dateString)
|
||||
return format(inputDate, 'do MMM yyyy')
|
||||
return format(inputDate, format_str || 'do MMM yyyy')
|
||||
}
|
||||
|
||||
export async function getJsonl(file: string) {
|
||||
const response = await fetch('stream.jsonl')
|
||||
const response = await fetch(file)
|
||||
return await (await response.text()).split('\n').map((post) => {
|
||||
return JSON.parse(post)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,9 +2,16 @@ import { defineConfig } from 'vite'
|
|||
import preact from '@preact/preset-vite'
|
||||
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
|
||||
import path from 'path'
|
||||
import topLevelAwait from 'vite-plugin-top-level-await'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [preact()],
|
||||
plugins: [
|
||||
preact(),
|
||||
topLevelAwait({
|
||||
promiseExportName: '__tla',
|
||||
promiseImportName: (i) => `__tla_${i}`,
|
||||
}),
|
||||
],
|
||||
assetsInclude: ['**/*.md'],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue