-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve paths from tsconfig as webpack aliases (#200)
* Resolve tsconfig paths, add shadcn template
- Loading branch information
1 parent
21f5698
commit c746dae
Showing
26 changed files
with
1,237 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# testing | ||
coverage | ||
|
||
# production | ||
dist | ||
|
||
# misc | ||
.DS_Store | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# lock files | ||
yarn.lock | ||
package-lock.json | ||
|
||
# debug files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# extension.js | ||
extension-env.d.ts |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const isFirefoxLike = | ||
process.env.EXTENSION_PUBLIC_BROWSER === 'firefox' || | ||
process.env.EXTENSION_PUBLIC_BROWSER === 'gecko-based' | ||
|
||
|
||
if (isFirefoxLike) { | ||
browser.browserAction.onClicked.addListener(() => { | ||
browser.sidebarAction.open() | ||
}) | ||
} else { | ||
chrome.action.onClicked.addListener(() => { | ||
chrome.sidePanel.setPanelBehavior({openPanelOnActionClick: true}) | ||
}) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import * as React from 'react' | ||
import {Slot} from '@radix-ui/react-slot' | ||
import {cva, type VariantProps} from 'class-variance-authority' | ||
|
||
import {cn} from '@/lib/utils' | ||
|
||
const buttonVariants = cva( | ||
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', | ||
{ | ||
variants: { | ||
variant: { | ||
default: 'bg-primary text-primary-foreground hover:bg-primary/90', | ||
destructive: | ||
'bg-destructive text-destructive-foreground hover:bg-destructive/90', | ||
outline: | ||
'border border-input bg-background hover:bg-accent hover:text-accent-foreground', | ||
secondary: | ||
'bg-secondary text-secondary-foreground hover:bg-secondary/80', | ||
ghost: 'hover:bg-accent hover:text-accent-foreground', | ||
link: 'text-primary underline-offset-4 hover:underline' | ||
}, | ||
size: { | ||
default: 'h-10 px-4 py-2', | ||
sm: 'h-9 rounded-md px-3', | ||
lg: 'h-11 rounded-md px-8', | ||
icon: 'h-10 w-10' | ||
} | ||
}, | ||
defaultVariants: { | ||
variant: 'default', | ||
size: 'default' | ||
} | ||
} | ||
) | ||
|
||
export interface ButtonProps | ||
extends React.ButtonHTMLAttributes<HTMLButtonElement>, | ||
VariantProps<typeof buttonVariants> { | ||
asChild?: boolean | ||
} | ||
|
||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( | ||
({className, variant, size, asChild = false, ...props}, ref) => { | ||
const Comp = asChild ? Slot : 'button' | ||
return ( | ||
<Comp | ||
className={cn(buttonVariants({variant, size, className}))} | ||
ref={ref} | ||
{...props} | ||
/> | ||
) | ||
} | ||
) | ||
Button.displayName = 'Button' | ||
|
||
export {Button, buttonVariants} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import * as React from 'react' | ||
|
||
import {cn} from '@/lib/utils' | ||
|
||
const Card = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({className, ...props}, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'rounded-lg border bg-card text-card-foreground shadow-sm', | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
Card.displayName = 'Card' | ||
|
||
const CardHeader = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({className, ...props}, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn('flex flex-col space-y-1.5 p-6', className)} | ||
{...props} | ||
/> | ||
)) | ||
CardHeader.displayName = 'CardHeader' | ||
|
||
const CardTitle = React.forwardRef< | ||
HTMLParagraphElement, | ||
React.HTMLAttributes<HTMLHeadingElement> | ||
>(({className, ...props}, ref) => ( | ||
<h3 | ||
ref={ref} | ||
className={cn( | ||
'text-2xl font-semibold leading-none tracking-tight', | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
CardTitle.displayName = 'CardTitle' | ||
|
||
const CardDescription = React.forwardRef< | ||
HTMLParagraphElement, | ||
React.HTMLAttributes<HTMLParagraphElement> | ||
>(({className, ...props}, ref) => ( | ||
<p | ||
ref={ref} | ||
className={cn('text-sm text-muted-foreground', className)} | ||
{...props} | ||
/> | ||
)) | ||
CardDescription.displayName = 'CardDescription' | ||
|
||
const CardContent = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({className, ...props}, ref) => ( | ||
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} /> | ||
)) | ||
CardContent.displayName = 'CardContent' | ||
|
||
const CardFooter = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({className, ...props}, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn('flex items-center p-6 pt-0', className)} | ||
{...props} | ||
/> | ||
)) | ||
CardFooter.displayName = 'CardFooter' | ||
|
||
export {Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react' | ||
import * as LabelPrimitive from '@radix-ui/react-label' | ||
import {cva, type VariantProps} from 'class-variance-authority' | ||
|
||
import {cn} from '@/lib/utils' | ||
|
||
const labelVariants = cva( | ||
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70' | ||
) | ||
|
||
const Label = React.forwardRef< | ||
React.ElementRef<typeof LabelPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & | ||
VariantProps<typeof labelVariants> | ||
>(({className, ...props}, ref) => ( | ||
<LabelPrimitive.Root | ||
ref={ref} | ||
className={cn(labelVariants(), className)} | ||
{...props} | ||
/> | ||
)) | ||
Label.displayName = LabelPrimitive.Root.displayName | ||
|
||
export {Label} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as React from 'react' | ||
import * as SwitchPrimitives from '@radix-ui/react-switch' | ||
|
||
import {cn} from '@/lib/utils' | ||
|
||
const Switch = React.forwardRef< | ||
React.ElementRef<typeof SwitchPrimitives.Root>, | ||
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> | ||
>(({className, ...props}, ref) => ( | ||
<SwitchPrimitives.Root | ||
className={cn( | ||
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input', | ||
className | ||
)} | ||
{...props} | ||
ref={ref} | ||
> | ||
<SwitchPrimitives.Thumb | ||
className={cn( | ||
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0' | ||
)} | ||
/> | ||
</SwitchPrimitives.Root> | ||
)) | ||
Switch.displayName = SwitchPrimitives.Root.displayName | ||
|
||
export {Switch} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {clsx, type ClassValue} from 'clsx' | ||
import {twMerge} from 'tailwind-merge' | ||
|
||
export function cn(...inputs: ClassValue[]) { | ||
return twMerge(clsx(inputs)) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"chromium:manifest_version": 3, | ||
"firefox:manifest_version": 2, | ||
"version": "0.0.1", | ||
"name": "shadcn-extension", | ||
"author": "Your Name", | ||
"description": "An Extension.js example.", | ||
"icons": { | ||
"48": "images/extension_48.png" | ||
}, | ||
"chromium:action": { | ||
"default_icon": { | ||
"48": "images/extension_48.png" | ||
}, | ||
"default_title": "Open Side Panel" | ||
}, | ||
"firefox:browser_action": { | ||
"default_icon": { | ||
"48": "images/extension_48.png" | ||
}, | ||
"default_title": "Open Side Panel" | ||
}, | ||
"chromium:side_panel": { | ||
"default_path": "sidebar/index.html", | ||
"default_title": "Side Panel Content" | ||
}, | ||
"firefox:sidebar_action": { | ||
"default_panel": "sidebar/index.html", | ||
"default_title": "Side Panel Content" | ||
}, | ||
"chromium:permissions": ["sidePanel"], | ||
"background": { | ||
"chromium:service_worker": "background.ts", | ||
"firefox:scripts": ["background.ts"] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"private": true, | ||
"name": "shadcn-extension", | ||
"description": "An Extension.js example.", | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "Your Name", | ||
"email": "[email protected]", | ||
"url": "https://yourwebsite.com" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@radix-ui/react-label": "^2.1.0", | ||
"@radix-ui/react-slot": "^1.1.0", | ||
"@radix-ui/react-switch": "^1.1.1", | ||
"class-variance-authority": "^0.7.0", | ||
"clsx": "^2.1.1", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"tailwind-merge": "^2.5.3", | ||
"tailwindcss-animate": "^1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@tailwindcss/typography": "^0.5.15", | ||
"@types/react": "^18.2.64", | ||
"@types/react-dom": "^18.2.21", | ||
"autoprefixer": "^10.4.20", | ||
"daisyui": "^4.12.10", | ||
"extension": "latest", | ||
"postcss": "^8.4.47", | ||
"tailwindcss": "^3.4.13", | ||
"typescript": "5.3.3" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
plugins: [require('tailwindcss'), require('autoprefixer')] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.