Skip to content

Commit

Permalink
separate ui utils into @repo/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Dec 24, 2024
1 parent 8373526 commit 3b40a1b
Show file tree
Hide file tree
Showing 34 changed files with 192 additions and 34 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/routes/dbdemo/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { eq } from 'drizzle-orm'

import { course } from '@repo/database'

import { db } from '$lib/db'

import { course } from '@repo/database'

import type { PageServerLoad } from './$types.js'

export const load: PageServerLoad = async () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/config/eslint/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default tseslint.config(
['^node:'],
// Packages. Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports within same package.
['^\\$?\\w'],
// Internal Packages. Things that start with a letter (or digit or underscore), or `@repo` followed by a letter.
['^@repo?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`. Anything not matched in another group.
Expand Down
1 change: 1 addition & 0 deletions packages/config/eslint/svelte.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import svelteParser from 'svelte-eslint-parser'
import tseslint from 'typescript-eslint'

import base from './base.js'

export default tseslint.config(
...base,
...eslintPluginSvelte.configs['flat/recommended'],
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"vitest": "^2.1.8"
},
"dependencies": {
"@repo/utils": "workspace:^",
"bits-ui": "^0.22.0",
"clsx": "^2.1.1",
"lucide-svelte": "^0.469.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { Snippet } from 'svelte'
import { slide } from 'svelte/transition'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = AccordionPrimitive.ContentProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Accordion as AccordionPrimitive } from 'bits-ui'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = AccordionPrimitive.ItemProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { ChevronDown } from 'lucide-svelte'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = AccordionPrimitive.TriggerProps
type $$Events = AccordionPrimitive.TriggerEvents
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/atom/button/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { Button as ButtonPrimitive } from 'bits-ui'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { buttonVariants, type Events, type Props } from './index.js'
type $$Props = Props
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/checkbox/checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Checkbox as CheckboxPrimitive, Label } from 'bits-ui'
import { Check } from 'lucide-svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = CheckboxPrimitive.Props & {
label?: string | undefined | null
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/atom/chip/chip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { X } from 'lucide-svelte'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { chipVariants } from './index.js'
interface Props {
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/atom/day-chip/day-chip.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { Chip } from '../chip/index.js'
import { chipVariants, type Day } from './index.js'
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/atom/gened-chip/gened-chip.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { Chip } from '../chip/index.js'
import { chipVariants, type Type } from './index.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { Button as ButtonPrimitive } from 'bits-ui'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { buttonVariants, type Events, type Props } from './index.js'
type $$Props = Props
type $$Events = Events
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/atom/input/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
const bubble = createBubbler()
import type { HTMLInputAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import type { InputEvents } from './index.js'
type $$Props = HTMLInputAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Label, RadioGroup as RadioGroupPrimitive } from 'bits-ui'
import { Circle } from 'lucide-svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = RadioGroupPrimitive.ItemProps & {
id: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui'
import type { Snippet } from 'svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = RadioGroupPrimitive.Props
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Sparkles } from 'lucide-svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
interface Props {
class?: string | undefined | null
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/switch/switch.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { Label, Switch as SwitchPrimitive } from 'bits-ui'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = SwitchPrimitive.Props & {
label?: string | undefined | null
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-body.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Snippet } from 'svelte'
import type { HTMLAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLAttributes<HTMLTableSectionElement>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-caption.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Snippet } from 'svelte'
import type { HTMLAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLAttributes<HTMLTableCaptionElement>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-cell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const bubble = createBubbler()
import type { HTMLTdAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLTdAttributes
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Snippet } from 'svelte'
import type { HTMLAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLAttributes<HTMLTableSectionElement>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-head.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Snippet } from 'svelte'
import type { HTMLThAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLThAttributes
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const bubble = createBubbler()
import type { HTMLAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLAttributes<HTMLTableSectionElement>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table-row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const bubble = createBubbler()
import type { HTMLAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLAttributes<HTMLTableRowElement> & {
'data-state'?: unknown
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/atom/table/table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Snippet } from 'svelte'
import type { HTMLTableAttributes } from 'svelte/elements'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
type $$Props = HTMLTableAttributes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import { Check, Dot, Plus } from 'lucide-svelte'
import { cn } from '../../../utils.js'
import { cn } from '@repo/utils'
import { Button } from '../../atom/button/index.js'
import { DayChip } from '../../atom/day-chip/index.js'
import { GenedChip } from '../../atom/gened-chip/index.js'
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/organism/footer/footer.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { CUGetRegWhiteFull } from '../../logo/cugetreg'
import { ThincOnDark } from '../../logo/thinc'
import { GitHubMark } from '../../logo/vendor'
import { CUGetRegWhiteFull } from '../../logo/cugetreg/index.js'
import { ThincOnDark } from '../../logo/thinc/index.js'
import { GitHubMark } from '../../logo/vendor/index.js'
</script>

<footer
Expand Down
6 changes: 0 additions & 6 deletions packages/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@ export default defineConfig({
include: [/@repo-ui/, /node_modules/],
},
},
server: {
port: 5173,
fs: {
allow: ['../../packages/ui/src'],
},
},
})
20 changes: 20 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@repo/utils",
"version": "2.0.0",
"private": true,
"type": "module",
"main": "src/index.ts",
"scripts": {
"lint": "eslint .",
"format": "eslint . --fix"
},
"devDependencies": {
"typescript": "^5.7.2"
},
"dependencies": {
"clsx": "^2.1.1",
"svelte": "^5.15.0",
"tailwind-merge": "^2.6.0",
"tailwind-variants": "^0.3.0"
}
}
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ui.js'
File renamed without changes.
Loading

0 comments on commit 3b40a1b

Please sign in to comment.