From f05bcdff70c4b24e455e4f4b8134622fc831edfd Mon Sep 17 00:00:00 2001 From: Tito Bouzout Date: Sun, 20 Oct 2024 03:33:37 -0300 Subject: [PATCH] update docs --- .gitattributes | 8 + src/index.jsx | 2 +- src/pages/@playground/default-example.js | 23 +-- src/pages/@playground/index.jsx | 77 ++------ .../@props/attributes-properties/index.jsx | 12 +- src/pages/benchmark/dev/index.jsx | 7 +- src/pages/benchmark/dev/main.js | 186 ++++++++++++++---- src/pages/benchmark/dev/main.js.map | 2 +- src/pages/benchmark/html/main.js | 184 +++++++++++++---- src/pages/benchmark/html/main.js.map | 2 +- src/pages/benchmark/regular/main.js | 177 +++++++++++++---- src/pages/benchmark/regular/main.js.map | 2 +- src/pages/home.jsx | 4 +- 13 files changed, 468 insertions(+), 218 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..96103c8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +src/pages/benchmark/dev/main.js binary +src/pages/benchmark/dev/main.js.map binary + +src/pages/benchmark/html/main.js binary +src/pages/benchmark/html/main.js.map + +src/pages/benchmark/regular/main.js binary +src/pages/benchmark/regular/main.js.map binary \ No newline at end of file diff --git a/src/index.jsx b/src/index.jsx index d2e1bd5..17d844f 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -19,7 +19,7 @@ import 'tm-textarea' import './lib/components/code/tm-textarea.css' // app -import { render, setClass } from 'pota' +import { render, setClass, signal } from 'pota' import { onDocumentSize } from 'pota/plugin/useDocumentSize' import { location } from 'pota/plugin/useLocation' diff --git a/src/pages/@playground/default-example.js b/src/pages/@playground/default-example.js index 8de6a06..289482e 100644 --- a/src/pages/@playground/default-example.js +++ b/src/pages/@playground/default-example.js @@ -1,7 +1,6 @@ export default ` -import { render, signal, memo, effect } from 'pota' -import { html } from 'pota/html' +import { render, signal, memo } from 'pota' function Counter() { const [count, setCount, updateCount] = signal(1) @@ -9,27 +8,11 @@ function Counter() { const double = memo(() => count() * 2) const increment = () => updateCount(count => count + 1) - // jsx - const jsx = ( + return ( ) - - // vanilla - const vanilla = document.createElement('button') - effect(() => { - vanilla.textContent = 'vanilla ' - vanilla.textContent += count() + ' / ' + double() - }) - vanilla.onclick = increment - - // html - const htm = html\`\` - - return [jsx, vanilla, htm] } render(Counter) diff --git a/src/pages/@playground/index.jsx b/src/pages/@playground/index.jsx index cdb6528..35d9a1e 100644 --- a/src/pages/@playground/index.jsx +++ b/src/pages/@playground/index.jsx @@ -5,7 +5,7 @@ import { Code } from '../../lib/components/code/code.jsx' import { Header } from '../../lib/components/header.jsx' import { effect, memo, signal } from 'pota' -import { Collapse, For, Head, Show } from 'pota/web' +import { Collapse, For, Show } from 'pota/web' import { compress, uncompress } from '../../lib/compress.js' import example from './default-example.js' @@ -84,24 +84,16 @@ export default function () { initialValue.code ? initialValue.code : initialValue, ) - const codeDownload = memo(() => + /*const codeDownload = memo(() => URL.createObjectURL( new Blob([code()], { type: 'application/tsx', }), ), - ) + )*/ const codeURL = memo(() => compress(code())) - // transformed code - - const [transformed, setTransformed] = signal('') - - effect(() => { - transform(code()).then(setTransformed) - }) - effect(() => { window.location.hash = '#' + codeURL() }) @@ -152,34 +144,6 @@ export default function () { Cheat Sheet - - (e.target.href = codeDownload())} - > - Download - - - - { - e.preventDefault() - const node = e.target - node.href = '#' + codeURL() - - node.textContent = 'Link Copied!' - setTimeout(() => { - node.textContent = 'Link' - }, 2000) - return node.href - }} - > - Link - -