Skip to content

Commit

Permalink
✨add "solid-labels" and "solid-undestructure"
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Aug 8, 2022
1 parent a28952f commit 8a26ffa
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 6 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
},
"devDependencies": {
"@iconify-json/logos": "^1.1.14",
"@types/node": "^18.6.4",
"@unocss/core": "^0.45.5",
"@unocss/preset-attributify": "^0.45.5",
"@unocss/preset-icons": "^0.45.5",
"@unocss/preset-uno": "^0.45.5",
"babel-plugin-solid-labels": "^0.12.1",
"babel-plugin-solid-undestructure": "^0.0.15",
"prettier": "^2.7.1",
"typescript": "^4.7.4",
"unocss": "^0.45.5",
Expand Down
77 changes: 77 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Link, Route, Routes } from '@solidjs/router';
import type { Component } from 'solid-js';

const Child: Component<{ count: number }> = ({ count }) => {
return <div>auto split props : {count}</div>;
};
const App: Component = () => {
const [count, setCount] = createSignal(0);
let count = $signal(0);
return (
<div class="text-center">
<header class="bg-#282c34 min-h-100vh flex flex-col items-center justify-center color-white">
Expand All @@ -22,10 +25,13 @@ const App: Component = () => {
<button
class="bg-blue-400 hover:bg-blue-500 text-sm text-white font-mono font-light py-2 px-4 rounded border-2 border-blue-200 dark:bg-blue-500 dark:hover:bg-blue-600"
type="button"
onClick={() => setCount((count) => count + 1)}
onClick={() => {
count++;
}}
>
count is: {count}
</button>
<Child count={count} />

<button
// @ts-ignore
Expand All @@ -36,7 +42,9 @@ const App: Component = () => {
m="l-1em"
border="2 rounded blue-200"
type="button"
onClick={() => setCount((count) => count + 1)}
onClick={() => {
count++;
}}
>
count is: {count}
</button>
Expand Down
13 changes: 10 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ import presetIcons from '@unocss/preset-icons';
import presetUno from '@unocss/preset-uno';
import presetAttributify from '@unocss/preset-attributify';
import Icons from 'unplugin-icons/vite';
import Inspect from 'vite-plugin-inspect'
import Inspect from 'vite-plugin-inspect';
import solidLabels from 'babel-plugin-solid-labels';
import { undestructurePlugin } from 'babel-plugin-solid-undestructure';

export default defineConfig({
plugins: [
solidPlugin(),
...undestructurePlugin('ts'),
solidPlugin({
babel: {
plugins: [[solidLabels, { dev: process.env.NODE_ENV !== 'production' }]],
},
}),
Icons({
compiler: 'solid',
}),
Expand All @@ -38,7 +45,7 @@ export default defineConfig({
}),
],
}),
Inspect()
Inspect(),
],
build: {
target: 'esnext',
Expand Down

0 comments on commit 8a26ffa

Please sign in to comment.