Skip to content

Commit 3df620b

Browse files
committed
initial commit based on SolidOS/solid-panes#117
0 parents  commit 3df620b

21 files changed

Lines changed: 28920 additions & 0 deletions

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
root: true,
3+
parser: "@typescript-eslint/parser",
4+
plugins: ["@typescript-eslint"],
5+
extends: [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:react/recommended",
9+
],
10+
settings: {
11+
react: {
12+
version: "detect",
13+
},
14+
},
15+
};

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
node_modules

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Solid
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# markdown-pane
2+
3+
A SolidOS pane to render, create and edit markdown files.
4+
5+
## Contribute
6+
7+
### Tech stack
8+
9+
- Typescript
10+
- React
11+
- Jest
12+
- Eslint
13+
- Prettier
14+
- SolidOS
15+
16+
### Tests
17+
18+
To run all tests:
19+
```shell script
20+
npm run test
21+
```
22+
23+
#### Unit tests
24+
25+
Unit tests use `jest` and are placed next to the tested file as `*.test.ts(x)` files.
26+
27+
### Dev Server
28+
29+
Start a webpack dev server:
30+
31+
```shell script
32+
npm start
33+
```
34+
35+
Visit `http://localhost:8080/` to render the pane.
36+
37+
### Build
38+
39+
```
40+
npm run build
41+
```
42+
43+
The build is done by `tsc`, webpack is only used as dev server and not for production build.

babel.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
"@babel/preset-env",
5+
{
6+
targets: {
7+
node: "current",
8+
},
9+
},
10+
],
11+
"@babel/preset-react",
12+
"@babel/preset-typescript",
13+
],
14+
};

dev/context.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {DataBrowserContext, LiveStore, PaneRegistry} from "pane-registry";
2+
import { store } from "solid-ui";
3+
4+
export const context: DataBrowserContext = {
5+
session: {
6+
store: store as LiveStore,
7+
paneRegistry: null as PaneRegistry,
8+
},
9+
dom: document,
10+
getOutliner: () => null,
11+
};
12+
13+
export const fetcher = store.fetcher;

dev/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>makdown-pane dev server</title>
6+
<style>
7+
body {
8+
margin: 10%;
9+
}
10+
input {
11+
background-color: #eef;
12+
padding: 0.5em;
13+
border: 0.5em solid white;
14+
font-size: 120%;
15+
}
16+
</style>
17+
</head>
18+
<body>
19+
<h1>markdown-pane</h1>
20+
<div id="app">Rendering...</div>
21+
</body>
22+
</html>

dev/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { sym } from "rdflib";
2+
import { Pane } from "../src";
3+
import { context, fetcher } from "./context";
4+
5+
var noteUri = prompt("Please enter URI of markdown file");
6+
7+
fetcher.load(noteUri).then(() => {
8+
const app = Pane.render(sym(noteUri), context);
9+
console.log(app);
10+
11+
document.getElementById("app").replaceWith(app);
12+
});

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
setupFilesAfterEnv: ["./jest.setup.ts"],
3+
};

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";

0 commit comments

Comments
 (0)