From 5107497e29d12bfacbbefb55b603195476969066 Mon Sep 17 00:00:00 2001 From: Tito Bouzout Date: Wed, 23 Oct 2024 02:33:38 -0300 Subject: [PATCH] update stuff --- frameworks/keyed/pota/index.html | 5 +++- frameworks/keyed/pota/package.json | 19 ++++++++++++-- frameworks/keyed/pota/rollup.config.js | 20 +++++++-------- frameworks/keyed/pota/src/main.jsx | 34 ++++++++++++++------------ 4 files changed, 50 insertions(+), 28 deletions(-) diff --git a/frameworks/keyed/pota/index.html b/frameworks/keyed/pota/index.html index a36a8a0e1..bd59b85f7 100644 --- a/frameworks/keyed/pota/index.html +++ b/frameworks/keyed/pota/index.html @@ -3,7 +3,10 @@ Pota - +
diff --git a/frameworks/keyed/pota/package.json b/frameworks/keyed/pota/package.json index 6bf0b88e1..f9a02ee6a 100644 --- a/frameworks/keyed/pota/package.json +++ b/frameworks/keyed/pota/package.json @@ -1,6 +1,6 @@ { "name": "js-framework-benchmark-pota", - "version": "1.0.4", + "version": "1.0.5", "type": "module", "main": "dist/main.js", "js-framework-benchmark": { @@ -20,7 +20,7 @@ "url": "https://github.com/krausest/js-framework-benchmark.git" }, "dependencies": { - "pota": "^0.14.132" + "pota": "^0.16.156" }, "devDependencies": { "@babel/core": "7.25.2", @@ -28,5 +28,20 @@ "@rollup/plugin-node-resolve": "15.2.3", "@rollup/plugin-terser": "0.4.4", "rollup": "4.21.2" + }, + "prettier": { + "printWidth": 70, + "useTabs": true, + "semi": false, + "singleQuote": true, + "quoteProps": "as-needed", + "jsxSingleQuote": false, + "trailingComma": "all", + "bracketSpacing": true, + "bracketSameLine": false, + "arrowParens": "avoid", + "proseWrap": "never", + "endOfLine": "lf", + "singleAttributePerLine": true } } diff --git a/frameworks/keyed/pota/rollup.config.js b/frameworks/keyed/pota/rollup.config.js index 2d97dd118..d48c367ca 100644 --- a/frameworks/keyed/pota/rollup.config.js +++ b/frameworks/keyed/pota/rollup.config.js @@ -1,25 +1,25 @@ -import { babel } from "@rollup/plugin-babel"; -import { nodeResolve } from "@rollup/plugin-node-resolve"; -import terser from "@rollup/plugin-terser"; +import { babel } from '@rollup/plugin-babel' +import { nodeResolve } from '@rollup/plugin-node-resolve' +import terser from '@rollup/plugin-terser' -const isProduction = process.env.BUILD === "production"; +const isProduction = process.env.BUILD === 'production' /** @type {import('rollup').RollupOptions} */ export default { - input: "./src/main.jsx", + input: './src/main.jsx', plugins: [ nodeResolve(), babel({ - babelHelpers: "bundled", - presets: [["pota/babel-preset"]], + babelHelpers: 'bundled', + presets: [['pota/babel-preset']], }), isProduction && terser(), ], output: [ { - format: "es", + format: 'es', sourcemap: false, - file: "./dist/main.js", + file: './dist/main.js', }, ], -}; +} diff --git a/frameworks/keyed/pota/src/main.jsx b/frameworks/keyed/pota/src/main.jsx index e02070205..c4dbbc580 100644 --- a/frameworks/keyed/pota/src/main.jsx +++ b/frameworks/keyed/pota/src/main.jsx @@ -1,4 +1,4 @@ -import { render, signal, batch } from 'pota' +import { render, signal } from 'pota' import { For } from 'pota/web' import { useSelector } from 'pota/plugin/useSelector' @@ -68,9 +68,7 @@ function buildData(count) { let data = new Array(count) for (let i = 0; i < count; i++) { const [label, setLabel, updateLabel] = signal( - `${adjectives[_random(adjectives.length)]} ${ - colours[_random(colours.length)] - } ${nouns[_random(nouns.length)]}`, + `${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`, ) data[i] = { id: idCounter++, @@ -97,16 +95,19 @@ const Button = ({ id, text, fn }) => ( const App = () => { const [data, setData, updateData] = signal([]), [selected, setSelected] = signal(null), - run = () => setData(buildData(1000)), + run = () => { + setData(buildData(1000)) + }, runLots = () => { setData(buildData(10000)) }, - add = () => updateData(d => [...d, ...buildData(1000)]), - update = () => - batch(() => { - for (let i = 0, d = data(), len = d.length; i < len; i += 10) - d[i].updateLabel(l => l + ' !!!') - }), + add = () => { + updateData(d => [...d, ...buildData(1000)]) + }, + update = () => { + for (let i = 0, d = data(), len = d.length; i < len; i += 10) + d[i].updateLabel(l => l + ' !!!') + }, swapRows = () => { const d = data().slice() if (d.length > 998) { @@ -116,13 +117,16 @@ const App = () => { setData(d) } }, - clear = () => setData([]), - remove = id => + clear = () => { + setData([]) + }, + remove = id => { updateData(d => { const idx = d.findIndex(datum => datum.id === id) d.splice(idx, 1) return [...d] - }), + }) + }, isSelected = useSelector(selected) return ( @@ -186,7 +190,7 @@ const App = () => { const { id, label } = row return ( - +