-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added few default examples in playground. Made a few corrections in t…
…he readme.
- Loading branch information
1 parent
71b529d
commit 507a8ba
Showing
3 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,41 @@ import { useEffect, useRef, useState } from "preact/hooks"; | |
import AceEditor from "ace-builds"; | ||
import ace from "ace-builds"; | ||
import Dracula from "ace-builds/src-noconflict/theme-dracula"; | ||
import 'ace-builds/src-noconflict/ext-language_tools'; | ||
import "ace-builds/src-noconflict/ext-language_tools"; | ||
import { transform } from "../../../core/transform.ts"; | ||
import { DataObject } from "../../../core/types.ts"; | ||
import { SerialOperations } from "../../../core/types.ts"; | ||
|
||
ace.config.set('basePath', 'https://esm.sh/[email protected]/src-noconflict'); | ||
ace.config.setModuleUrl('ace/mode/yaml', 'https://cdn.jsdelivr.net/npm/[email protected]/src-noconflict/mode-yaml.js'); | ||
ace.config.set("basePath", "https://esm.sh/[email protected]/src-noconflict"); | ||
ace.config.setModuleUrl( | ||
"ace/mode/yaml", | ||
"https://cdn.jsdelivr.net/npm/[email protected]/src-noconflict/mode-yaml.js" | ||
); | ||
|
||
const Playground = () => { | ||
const [input, setInput] = useState<string>("{}"); | ||
const [transforms, setTransforms] = useState<string>(""); | ||
const [input, setInput] = useState<string>(`{ | ||
"name": { | ||
"first": " malory", | ||
"last": "Archer" | ||
}, | ||
"exes": [ | ||
" Nikolai Jakov ", | ||
"Len Trexler", | ||
"Burt Reynolds" | ||
], | ||
"lastEx": 2 | ||
}`); | ||
const [transforms, setTransforms] = useState<string>( | ||
`lastEx : derived.lastEx + 5 | ||
modified : derived.lastEx | ||
original : input.lastEx | ||
nameObject : | ||
name : input.name.first | trim | capitalize + ' ' + input.name.last | ||
age : 25 | ||
ex1 : '=>' + input.exes[0] | rtrim | ||
isMinor : derived.nameObject.age > 18 | ||
nameLength : derived.nameObject.name | length | ||
nameUpper : derived.nameObject.name | upper`); | ||
const [output, setOutput] = useState<string>(""); | ||
const [mergeMethod, setMergeMethod] = useState<string>("overwrite"); | ||
const [errorMessage, setErrorMessage] = useState<string>(""); | ||
|
@@ -27,11 +51,11 @@ const Playground = () => { | |
maxLines: 15, | ||
enableBasicAutocompletion: true, | ||
enableLiveAutocompletion: true, | ||
enableSnippets: true | ||
enableSnippets: true, | ||
}); | ||
editor.setTheme(Dracula); | ||
editor.setValue(transforms, -1); | ||
ace.config.loadModule('ace/mode/yaml', (yamlMode: any) => { | ||
ace.config.loadModule("ace/mode/yaml", (yamlMode: any) => { | ||
editor.session.setMode(new yamlMode.Mode()); | ||
}); | ||
editor.session.on("change", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ export default function App({ Component }: PageProps) { | |
</a> | ||
</li> | ||
<li> | ||
<a href="/docs" class="nav-link"> | ||
<a href="https://docs.datadance.app" class="nav-link"> | ||
Docs | ||
</a> | ||
</li> | ||
|
@@ -56,11 +56,15 @@ export default function App({ Component }: PageProps) { | |
|
||
<Component /> | ||
<br></br> | ||
<div class="container"> | ||
<footer> | ||
<p class="text-center text-body-secondary">© 2024 Datadance, <a href="https://yakshavingdevs.org">Yak Shaving Devs</a></p> | ||
</footer> | ||
</div> | ||
|
||
<footer class="container"> | ||
<p class="text-center text-body-secondary"> | ||
© 2024 Datadance,{" "} | ||
<a href="https://yakshavingdevs.org">Yak Shaving Devs</a> | ||
</p> | ||
</footer> | ||
<br></br> | ||
|
||
<script | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" | ||
integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" | ||
|