fix ui package, use sv to create
recreated package using sv, marking correctly as a library. seems I was missing some sveltekit tooling somewhere along the way otherwise.
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
node_modules
|
||||
|
||||
# Output
|
||||
.output
|
||||
.vercel
|
||||
.netlify
|
||||
.wrangler
|
||||
/.svelte-kit
|
||||
/build
|
||||
/dist
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test
|
||||
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@@ -0,0 +1,6 @@
|
||||
# Package Managers
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
bun.lock
|
||||
bun.lockb
|
||||
15
.prettierrc
Normal file
15
.prettierrc
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.svelte",
|
||||
"options": {
|
||||
"parser": "svelte"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
58
README.md
Normal file
58
README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Svelte library
|
||||
|
||||
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
||||
|
||||
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npx sv create
|
||||
|
||||
# create a new project in my-app
|
||||
npx sv create my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
||||
|
||||
## Building
|
||||
|
||||
To build your library:
|
||||
|
||||
```bash
|
||||
npm run package
|
||||
```
|
||||
|
||||
To create a production version of your showcase app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
||||
|
||||
## Publishing
|
||||
|
||||
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
||||
|
||||
To publish your library to [npm](https://www.npmjs.com):
|
||||
|
||||
```bash
|
||||
npm publish
|
||||
```
|
||||
@@ -1,3 +1,36 @@
|
||||
import { config } from '@repo/eslint-config/index.js';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import js from '@eslint/js';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import svelte from 'eslint-plugin-svelte';
|
||||
import globals from 'globals';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import ts from 'typescript-eslint';
|
||||
import svelteConfig from './svelte.config.js';
|
||||
|
||||
export default config;
|
||||
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));
|
||||
|
||||
export default ts.config(
|
||||
includeIgnoreFile(gitignorePath),
|
||||
js.configs.recommended,
|
||||
...ts.configs.recommended,
|
||||
...svelte.configs.recommended,
|
||||
prettier,
|
||||
...svelte.configs.prettier,
|
||||
{
|
||||
languageOptions: {
|
||||
globals: { ...globals.browser, ...globals.node }
|
||||
},
|
||||
rules: { 'no-undef': 'off' }
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
extraFileExtensions: ['.svelte'],
|
||||
parser: ts.parser,
|
||||
svelteConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
17
index.ts
17
index.ts
@@ -1,17 +0,0 @@
|
||||
export { default as Button } from './components/Button.svelte';
|
||||
export { default as CenterBox } from './components/CenterBox.svelte';
|
||||
export { default as Combobox } from './components/Combobox.svelte';
|
||||
export { default as FramelessButton } from './components/FramelessButton.svelte';
|
||||
export { default as Label } from './components/Label.svelte';
|
||||
export { default as Link } from './components/Link.svelte';
|
||||
export { default as PhoneInput } from './components/PhoneInput.svelte';
|
||||
export { default as PinInput } from './components/PinInput.svelte';
|
||||
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
||||
export { default as Select } from './components/Select.svelte';
|
||||
export { default as Spinner } from './components/Spinner.svelte';
|
||||
export { default as StateMachine, type StateMachinePage } from './components/StateMachine.svelte';
|
||||
export { default as StyledRawInput } from './components/StyledRawInput.svelte';
|
||||
export { default as TextInput } from './components/TextInput.svelte';
|
||||
export { default as TimezoneInput } from './components/TimezoneInput.svelte';
|
||||
export { default as ToggleGroup } from './components/ToggleGroup.svelte';
|
||||
export { default as ToggleSelect } from './components/ToggleSelect.svelte';
|
||||
75
package.json
75
package.json
@@ -1,32 +1,75 @@
|
||||
{
|
||||
"name": "@repo/ui",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && npm run prepack",
|
||||
"preview": "vite preview",
|
||||
"prepare": "svelte-kit sync || echo ''",
|
||||
"prepack": "svelte-kit sync && svelte-package && publint",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"format": "prettier --write .",
|
||||
"lint": "prettier --check . && eslint ."
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.test.*",
|
||||
"!dist/**/*.spec.*"
|
||||
],
|
||||
"sideEffects": [
|
||||
"**/*.css"
|
||||
],
|
||||
"svelte": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"type": "module",
|
||||
"module": "index.ts",
|
||||
"main": "index.ts",
|
||||
"exports": {
|
||||
"./internal": {
|
||||
"types": "./src/lib/index.ts",
|
||||
"svelte": "./src/lib/index.ts"
|
||||
},
|
||||
".": {
|
||||
"types": "./index.ts",
|
||||
"svelte": "./index.ts"
|
||||
"types": "./dist/index.d.ts",
|
||||
"svelte": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/eslint-config": "workspace:*",
|
||||
"@repo/tailwindcss-config": "workspace:*",
|
||||
"@repo/typescript-config": "workspace:*",
|
||||
"eslint": "^9.24.0",
|
||||
"svelte": "^5.25.3",
|
||||
"@sveltejs/kit": "^2.20.2"
|
||||
"peerDependencies": {
|
||||
"svelte": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@repo/validate": "workspace:*",
|
||||
"@jsrob/svelte-portal": "^0.2.1",
|
||||
"country-state-city": "^3.2.1",
|
||||
"libphonenumber-js": "^1.12.6",
|
||||
"match-sorter": "^8.0.0",
|
||||
"melt": "^0.12.0",
|
||||
"phosphor-svelte": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.5",
|
||||
"@eslint/js": "^9.18.0",
|
||||
"@sveltejs/adapter-auto": "^4.0.0",
|
||||
"@sveltejs/kit": "^2.16.0",
|
||||
"@sveltejs/package": "^2.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||
"@tailwindcss/forms": "^0.5.9",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-svelte": "^3.0.0",
|
||||
"globals": "^16.0.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||
"publint": "^0.3.2",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"vite": "^6.2.5"
|
||||
},
|
||||
"keywords": [
|
||||
"svelte"
|
||||
]
|
||||
}
|
||||
|
||||
2
src/app.css
Normal file
2
src/app.css
Normal file
@@ -0,0 +1,2 @@
|
||||
@import 'tailwindcss';
|
||||
@plugin '@tailwindcss/forms';
|
||||
13
src/app.d.ts
vendored
Normal file
13
src/app.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
12
src/app.html
Normal file
12
src/app.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div>%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
{#if loading}
|
||||
<div class="w-[1rem]"></div>
|
||||
<div class="absolute right-4 top-1/2 translate-y-[-40%]"><Spinner size="1.3rem" /></div>
|
||||
<div class="absolute top-1/2 right-4 translate-y-[-40%]"><Spinner size="1.3rem" /></div>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
@@ -246,8 +246,8 @@
|
||||
{#if open}
|
||||
<div
|
||||
class={[
|
||||
'picker absolute left-0 top-0 z-50 overflow-y-auto px-2 py-3',
|
||||
'outline-hidden rounded-sm border shadow-lg shadow-black/25',
|
||||
'picker absolute top-0 left-0 z-50 overflow-y-auto px-2 py-3',
|
||||
'rounded-sm border shadow-lg shadow-black/25 outline-hidden',
|
||||
'border-accent dark:border-accent/50 dark:bg-text-800 bg-white dark:sm:bg-slate-800',
|
||||
'text-text dark:text-background',
|
||||
open && pickerPosition === 'top' && 'mb-[var(--outer-gap)]',
|
||||
@@ -272,8 +272,8 @@
|
||||
aria-label={getLabel(item)}
|
||||
aria-disabled={item.disabled}
|
||||
class={[
|
||||
'picker-item mb-0.5 flex min-h-10 flex-wrap items-center py-2.5 pl-5 pr-1.5',
|
||||
'outline-hidden select-none rounded-sm text-sm capitalize',
|
||||
'picker-item mb-0.5 flex min-h-10 flex-wrap items-center py-2.5 pr-1.5 pl-5',
|
||||
'rounded-sm text-sm capitalize outline-hidden select-none',
|
||||
'hover:bg-accent-500/30 dark:hover:bg-accent-700/30',
|
||||
item.value === highlighted?.value && 'bg-accent-500/80 dark:bg-accent-700/80'
|
||||
]}
|
||||
@@ -354,7 +354,7 @@
|
||||
{#if iconVisible}
|
||||
<div
|
||||
class={[
|
||||
'pointer-events-none absolute left-3.5 top-1/2 -translate-y-1/2 transform select-none'
|
||||
'pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2 transform select-none'
|
||||
]}
|
||||
transition:scale
|
||||
>
|
||||
@@ -436,7 +436,7 @@
|
||||
{#if (value && value.infotext) || (highlighted && useHighlighted && highlighted.infotext)}
|
||||
<div
|
||||
class={[
|
||||
'pointer-events-none absolute top-1/2 -translate-y-1/2 transform select-none text-sm',
|
||||
'pointer-events-none absolute top-1/2 -translate-y-1/2 transform text-sm select-none',
|
||||
'text-text/80 dark:text-background/80',
|
||||
caret ? 'end-10' : 'end-[1.125rem]'
|
||||
]}
|
||||
@@ -167,7 +167,7 @@
|
||||
<input
|
||||
type="text"
|
||||
class={[
|
||||
'px[1.125rem] w-[5ch] rounded-sm pb-3.5 pt-4 transition-colors',
|
||||
'px[1.125rem] w-[5ch] rounded-sm pt-4 pb-3.5 transition-colors',
|
||||
'text-center align-middle font-mono font-normal placeholder:font-normal',
|
||||
'border-accent dark:border-accent/50 border',
|
||||
'text-text placeholder:text-text/30 dark:text-background dark:placeholder:text-background/30',
|
||||
@@ -22,19 +22,19 @@
|
||||
{#each items as i}
|
||||
{@const item = group.getItem(i)}
|
||||
<div
|
||||
class="outline-hidden ring-accent-500 focus-visible:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 group -ml-1 flex items-center gap-3
|
||||
rounded p-1"
|
||||
class="ring-accent-500 group -ml-1 flex items-center gap-3 rounded p-1 outline-hidden focus-visible:ring-3
|
||||
data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
||||
{...item.attrs}
|
||||
>
|
||||
<div
|
||||
class="group-aria-[checked]:border-accent-500 relative size-6
|
||||
rounded-full border-2 border-neutral-400 bg-neutral-100 shadow-sm
|
||||
hover:bg-gray-100 group-aria-[checke]:bg-transparent
|
||||
group-aria-[checke]:bg-transparent hover:bg-gray-100
|
||||
data-[disabled=true]:bg-gray-400 dark:border-white dark:bg-transparent"
|
||||
>
|
||||
{#if item.checked}
|
||||
<div
|
||||
class="group-aria-[checked]:bg-accent-500 absolute left-1/2 top-1/2 size-3 -translate-x-1/2 -translate-y-1/2
|
||||
class="group-aria-[checked]:bg-accent-500 absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2
|
||||
rounded-full"
|
||||
aria-hidden="true"
|
||||
transition:scale={{ duration: 75 }}
|
||||
@@ -42,7 +42,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<span class="cursor-default select-none font-semibold capitalize leading-none">
|
||||
<span class="cursor-default leading-none font-semibold capitalize select-none">
|
||||
{i}
|
||||
</span>
|
||||
</div>
|
||||
@@ -328,7 +328,7 @@
|
||||
{/snippet}
|
||||
|
||||
<div
|
||||
class="transition-height relative mb-5 mt-5 flex h-8 items-center justify-between lg:mb-3 lg:mt-0
|
||||
class="transition-height relative mt-5 mb-5 flex h-8 items-center justify-between lg:mt-0 lg:mb-3
|
||||
{!backButtonVisible ? 'lg:h-0' : ''}"
|
||||
>
|
||||
<!-- Back button -->
|
||||
@@ -360,7 +360,7 @@
|
||||
lg:max-h-[60rem] lg:min-h-[30rem] lg:flex-row lg:items-center dark:sm:bg-gray-900"
|
||||
>
|
||||
<!-- Progress bar (desktop only, in form space) -->
|
||||
<div class="progress hidden! lg:flex! absolute left-[70%] top-8 -translate-x-1/2">
|
||||
<div class="progress absolute top-8 left-[70%] hidden! -translate-x-1/2 lg:flex!">
|
||||
{@render progress()}
|
||||
</div>
|
||||
|
||||
@@ -385,10 +385,10 @@
|
||||
<!-- Hero text -->
|
||||
<span
|
||||
class={[
|
||||
'absolute bottom-4 left-4 right-4 text-white lg:bottom-1/2 lg:pr-4 lg:text-right',
|
||||
'absolute right-4 bottom-4 left-4 text-white lg:bottom-1/2 lg:pr-4 lg:text-right',
|
||||
hero.fontSize === 'small'
|
||||
? 'max-h-[7.2rem] text-5xl font-semibold leading-[3.6rem]'
|
||||
: 'max-h-[10.6rem] text-7xl font-bold leading-[5.3rem]'
|
||||
? 'max-h-[7.2rem] text-5xl leading-[3.6rem] font-semibold'
|
||||
: 'max-h-[10.6rem] text-7xl leading-[5.3rem] font-bold'
|
||||
]}
|
||||
transition:fade
|
||||
bind:this={heroText}
|
||||
@@ -407,7 +407,7 @@
|
||||
<!-- Form page -->
|
||||
{#key index}
|
||||
<div
|
||||
class="text-text dark:text-background absolute left-0 right-0 top-0"
|
||||
class="text-text dark:text-background absolute top-0 right-0 left-0"
|
||||
in:flyIn
|
||||
out:flyOut
|
||||
bind:this={pageContainer}
|
||||
18
src/lib/index.ts
Normal file
18
src/lib/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
// Reexport your entry components here
|
||||
export { default as Button } from './Button.svelte';
|
||||
export { default as CenterBox } from './CenterBox.svelte';
|
||||
export { default as Combobox } from './Combobox.svelte';
|
||||
export { default as FramelessButton } from './FramelessButton.svelte';
|
||||
export { default as Label } from './Label.svelte';
|
||||
export { default as Link } from './Link.svelte';
|
||||
export { default as PhoneInput } from './PhoneInput.svelte';
|
||||
export { default as PinInput } from './PinInput.svelte';
|
||||
export { default as RadioGroup } from './RadioGroup.svelte';
|
||||
export { default as Select } from './Select.svelte';
|
||||
export { default as Spinner } from './Spinner.svelte';
|
||||
export { default as StateMachine, type StateMachinePage } from './StateMachine.svelte';
|
||||
export { default as StyledRawInput } from './StyledRawInput.svelte';
|
||||
export { default as TextInput } from './TextInput.svelte';
|
||||
export { default as TimezoneInput } from './TimezoneInput.svelte';
|
||||
export { default as ToggleGroup } from './ToggleGroup.svelte';
|
||||
export { default as ToggleSelect } from './ToggleSelect.svelte';
|
||||
7
src/routes/+layout.svelte
Normal file
7
src/routes/+layout.svelte
Normal file
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
import '../app.css';
|
||||
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
{@render children()}
|
||||
3
src/routes/+page.svelte
Normal file
3
src/routes/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>Welcome to your library project</h1>
|
||||
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
|
||||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
||||
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
18
svelte.config.js
Normal file
18
svelte.config.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import adapter from '@sveltejs/adapter-auto';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://svelte.dev/docs/kit/integrations
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -1,3 +1,15 @@
|
||||
{
|
||||
"extends": ["@repo/typescript-config/svelte.json"]
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext"
|
||||
}
|
||||
}
|
||||
|
||||
7
vite.config.ts
Normal file
7
vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss(), sveltekit()]
|
||||
});
|
||||
Reference in New Issue
Block a user