diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..61608d7 --- /dev/null +++ b/biome.json @@ -0,0 +1,93 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json", + "assist": { "actions": { "source": { "organizeImports": "on" } } }, + "formatter": { + "enabled": true, + "indentStyle": "space" + }, + "files": { + "includes": ["**", "!**/cosmos-export", "!**/dist", "!**/package.json"] + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "asNeeded", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false + } + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "suspicious": { + "noExplicitAny": "off" + }, + "complexity": { + "noForEach": "error", + "useLiteralKeys": "off" + }, + "a11y": { + "noAccessKey": "off", + "noAriaHiddenOnFocusable": "off", + "noAriaUnsupportedElements": "off", + "noAutofocus": "off", + "noDistractingElements": "off", + "noHeaderScope": "off", + "noInteractiveElementToNoninteractiveRole": "off", + "noLabelWithoutControl": "off", + "noNoninteractiveElementToInteractiveRole": "off", + "noNoninteractiveTabindex": "off", + "noPositiveTabindex": "off", + "noRedundantAlt": "off", + "noRedundantRoles": "off", + "noStaticElementInteractions": "off", + "noSvgWithoutTitle": "off", + "useAltText": "off", + "useAnchorContent": "off", + "useAriaActivedescendantWithTabindex": "off", + "useAriaPropsForRole": "off", + "useAriaPropsSupportedByRole": "off", + "useButtonType": "off", + "useFocusableInteractive": "off", + "useHeadingContent": "off", + "useHtmlLang": "off", + "useIframeTitle": "off", + "useKeyWithClickEvents": "off", + "useKeyWithMouseEvents": "off", + "useMediaCaption": "off", + "useSemanticElements": "off", + "useValidAnchor": "off", + "useValidAriaProps": "off", + "useValidAriaRole": "off", + "useValidAriaValues": "off", + "useValidAutocomplete": "off", + "useValidLang": "off" + }, + "style": { + "useSingleVarDeclarator": "error", + "noParameterAssign": "off", + "noUselessElse": "off", + "noNonNullAssertion": "off", + "useNumberNamespace": "off", + "noUnusedTemplateLiteral": "off", + "useFilenamingConvention": { + "level": "error", + "options": { + "strictCase": true, + "requireAscii": true, + "filenameCases": ["kebab-case", "export"] + } + }, + "useAsConstAssertion": "error", + "useDefaultParameterLast": "error", + "useEnumInitializers": "error", + "useSelfClosingElements": "error", + "noInferrableTypes": "error" + } + } + } +} diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..3ce444d --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,5 @@ +# [test] +# preload = ["./tests/fixtures/preload.ts"] + +[install.lockfile] +save = false diff --git a/cosmos.config.json b/cosmos.config.json new file mode 100644 index 0000000..8e9fcf2 --- /dev/null +++ b/cosmos.config.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json.schemastore.org/cosmos-config", + "plugins": ["react-cosmos-plugin-vite"], + "fixtureFileSuffix": "page", + "decoratorFile": "cosmos.decorator.tsx" +} diff --git a/cosmos.decorator.tsx b/cosmos.decorator.tsx new file mode 100644 index 0000000..9f9c38d --- /dev/null +++ b/cosmos.decorator.tsx @@ -0,0 +1,21 @@ +import React, { useEffect } from "react" + +export const TailwindDecorator = ({ + children, +}: { + children: React.ReactNode +}) => { + useEffect(() => { + const script = document.createElement("script") + script.src = "https://cdn.tailwindcss.com" + document.head.appendChild(script) + + return () => { + document.head.removeChild(script) + } + }, []) + + return <>{children} +} + +export default TailwindDecorator diff --git a/index.html b/index.html new file mode 100644 index 0000000..3b75541 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + React Cosmos Vite Renderer + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..dbf6892 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "trace-capacity-visualizer", + "private": true, + "scripts":{ + "start": "cosmos" + }, + "devDependencies": { + "@types/bun": "latest", + "react": "^19.2.0", + "react-cosmos": "^7.0.0", + "react-cosmos-plugin-vite": "^7.0.0", + "react-dom": "^19.2.0", + "vite": "^7.2.2" + }, + "peerDependencies": { + "typescript": "^5" + } +} diff --git a/pages/example01.page.tsx b/pages/example01.page.tsx new file mode 100644 index 0000000..cb57e36 --- /dev/null +++ b/pages/example01.page.tsx @@ -0,0 +1,3 @@ +export default function Example01() { + return "hi" +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..bfa0fea --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +}