This file contains hidden or 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
const attributesToObjectString = (attributes) => | |
Object.entries(attributes) | |
.filter(([key]) => key !== 'xmlns') | |
.map(([key, value]) => { | |
if ((key === 'fill' || key === 'stroke') && value !== 'none') { | |
return `${key}: 'currentColor'`; | |
} | |
return `${key}: '${value}'`; | |
}) | |
.join(', '); |
This file contains hidden or 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
import glob from 'fast-glob'; | |
import fs from 'fs'; | |
import path from 'path'; | |
import frontmatter from 'remark-frontmatter'; | |
import mdx from 'remark-mdx'; | |
import markdown from 'remark-parse'; | |
import stringify from 'remark-stringify'; | |
import { unified } from 'unified'; | |
// https://unifiedjs.com/explore/package/remark-mdx/ |
This file contains hidden or 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
function findLocalPaintStyle(name) { | |
return figma | |
.getLocalPaintStyles() | |
.find((paintStyle) => paintStyle.name === name) | |
} | |
function updateLocalAliasPaintStyles() { | |
figma.getLocalPaintStyles().forEach((paintStyle) => { | |
const alias = paintStyle.description |
This file contains hidden or 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
export default function App() { | |
return ( | |
<Stack | |
axis="x" | |
width="container.medium" | |
spaceX={{ 'breakpoints.large': 'xlarge' }} | |
spaceYStart="40px" | |
spaceYEnd="80px" | |
> | |
<Text>Hello World</Text> |
This file contains hidden or 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
type InputProps = Pick<TextFieldProps, 'value' | 'onValueChange'> | |
function Input({ value, onValueChange }: InputProps) { | |
const id = useId() | |
return ( | |
<Stack | |
paddingX="16px" | |
paddingY="8px" | |
stroke={{ |
This file contains hidden or 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
module.exports = { | |
plugins: [ | |
['@jsxui/babel-plugin', { | |
visitor: process.env.PLATFORM === 'native' ? require('./native') : require('./web') | |
}] | |
] | |
} |
This file contains hidden or 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
const components = [ | |
{ | |
name: 'Text', | |
as: 'span', | |
props: { | |
color: ['primary', 'secondary'], | |
}, | |
transforms: { | |
color: (value, theme) => theme.colors[value] | |
} |
This file contains hidden or 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
import { exec } from 'child_process'; | |
import path from 'path'; | |
export default function handler(request, response) { | |
exec( | |
`code --goto "${path.resolve(process.cwd(), 'pages/_app.page.tsx')}:30:11"`, | |
(err) => { | |
if (err) { | |
console.log(err); | |
} |
This file contains hidden or 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
const args = Object.fromEntries( | |
process.argv.slice(2).map((arg) => { | |
const [key, value] = arg.split('=') | |
return [key.slice(2), value] | |
}) | |
) | |
// input: --port=3000 --out=dist | |
// output: { port: '3000', out: 'dist' } |
This file contains hidden or 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
const fs = require('fs'); | |
const glob = require('glob'); | |
glob('src/**/index.tsx', {}, (globError, files) => { | |
if (globError) { | |
console.error(`Error Globbing: ${globError}`); | |
} | |
files.forEach((filePath) => { | |
fs.rename(filePath, filePath.replace('.tsx', '.ts'), (renameError) => { | |
if (renameError) { |