Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next: Svelte 5 #626

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
2d74dac
next: initial svelte 5 setup (#445)
huntabyte Apr 12, 2024
6a22de2
next: Avatar & Accordion Updates (#452)
huntabyte Apr 12, 2024
722c25f
next: Box helpers (#457)
huntabyte Apr 15, 2024
3853dbf
next: more improvements (#466)
anatolzak Apr 16, 2024
2375dfd
next: remove dependency on `bind:this` for `Presence` (#467)
huntabyte Apr 16, 2024
1bcc2d3
next: Label component (#468)
huntabyte Apr 17, 2024
f036e27
next: Progress component (#470)
huntabyte Apr 17, 2024
ae9ce2b
next: Radio Group (WIP) (#471)
huntabyte Apr 17, 2024
c645dd9
next: remove derived `attrs` (#472)
anatolzak Apr 17, 2024
50ff2eb
next: dismissable layer (#474)
anatolzak Apr 17, 2024
b78c95b
next: Radio Group (#476)
huntabyte Apr 18, 2024
4c35358
next: separator (#477)
huntabyte Apr 18, 2024
af6d78c
next: switch (#478)
huntabyte Apr 18, 2024
0b6c141
next: add inputs to components that use them (#479)
huntabyte Apr 18, 2024
694fe14
next: fix dismissable layer (#480)
anatolzak Apr 18, 2024
cdc7a6b
next: prevent text selection overflow (#482)
anatolzak Apr 18, 2024
71456ce
next: escape layer (#481)
anatolzak Apr 18, 2024
9c6f951
next: fix attrs/derived values (#483)
huntabyte Apr 18, 2024
d97b8d6
next: cleanup props (#484)
huntabyte Apr 18, 2024
09d568c
next: initial floating stuff (#485)
huntabyte Apr 19, 2024
0188fb8
next: Popper layer (#488)
huntabyte Apr 20, 2024
ab26555
next: Portal (#489)
huntabyte Apr 20, 2024
0f05c47
next: arrows (#491)
huntabyte Apr 20, 2024
b0b2359
next: testing library setup (#492)
huntabyte Apr 21, 2024
129ea8f
next: accordion tests and pagination (#493)
huntabyte Apr 21, 2024
9fa87cc
next: cleanup radio/checkbox snippets (#494)
huntabyte Apr 21, 2024
9c9672c
next: `mergeProps` helper, lots of cleanup, and Tabs component (#495)
huntabyte Apr 22, 2024
b663fa5
next: Toggle component (#496)
huntabyte Apr 22, 2024
931d1dc
next: Toggle group (#497)
huntabyte Apr 22, 2024
a22f378
next: util tests (#500)
huntabyte Apr 22, 2024
7ce4031
next: accordion test updates (#501)
huntabyte Apr 22, 2024
2435111
next: roving focus helper (#503)
huntabyte Apr 23, 2024
f31c289
next: Toolbar (#505)
huntabyte Apr 23, 2024
fc0faa0
next: Portal (#506)
huntabyte Apr 23, 2024
1436194
next: cleanup (#507)
huntabyte Apr 23, 2024
880712d
next: focus scope (#508)
huntabyte Apr 24, 2024
adbcb53
next: Dialog/Body Scroll Lock (#509)
huntabyte Apr 24, 2024
7e293ff
next: Dialog (#510)
huntabyte Apr 25, 2024
4248288
next: improve context methods (#511)
huntabyte Apr 25, 2024
f605ff7
next: use runed `box` (#513)
huntabyte Apr 25, 2024
7486b06
next: body scroll padding/margin (#514)
huntabyte Apr 26, 2024
8478fbf
next: tooltip (#515)
huntabyte Apr 28, 2024
b2e5b50
next: menu (#522)
huntabyte May 30, 2024
28c1c45
next: `context menu` (#558)
huntabyte May 30, 2024
71c3232
next: accordion tests (#559)
huntabyte May 30, 2024
47c31f9
next: checkbox tests (#560)
huntabyte May 30, 2024
d589233
next: tests (#562)
huntabyte Jun 1, 2024
ba7ebfa
next: Select (#564)
huntabyte Jun 10, 2024
c83f4a2
next: Menubar (#572)
huntabyte Jun 12, 2024
0c7ec0f
next: Navigation Menu (#573)
huntabyte Jun 16, 2024
d35f6ac
next: downgrade svelte (#575)
huntabyte Jun 16, 2024
b136913
next: chores and cleanup (#576)
huntabyte Jun 17, 2024
2a506ba
next: update svelte and cleanup (#577)
huntabyte Jun 17, 2024
6c38794
next: alert dialog (#578)
huntabyte Jun 17, 2024
18ebc51
next: cleanup menubar (#579)
huntabyte Jun 17, 2024
4ff7bac
next: Pin Input (#580)
huntabyte Jun 18, 2024
2b8bdf6
next: Date Field (#581)
huntabyte Jun 23, 2024
1b608dd
next: Date Field Improvements (#583)
huntabyte Jun 27, 2024
a6a2864
next: Date Range Field (#586)
huntabyte Jun 30, 2024
031a2df
next: Calendar (#595)
huntabyte Jul 7, 2024
e979b21
next: Range Calendar (#597)
huntabyte Jul 7, 2024
da2f00f
next: cleanup logs (#598)
huntabyte Jul 7, 2024
8f0daac
next: replace `Map` with `SvelteMap` (#599)
huntabyte Jul 7, 2024
b025b0e
next: Date Picker (#600)
huntabyte Jul 8, 2024
aed0474
next: Date Range Picker (#601)
huntabyte Jul 9, 2024
d59f4a5
next: Docs work (#605)
huntabyte Jul 10, 2024
8954690
next: drop `asChild` in favor of just the `child` snippet (#606)
huntabyte Jul 11, 2024
7667efc
next: Slider (#607)
huntabyte Jul 12, 2024
655c665
next: Component Preview overhaul (#608)
huntabyte Jul 12, 2024
f8bc2e0
next: Listbox (#603)
huntabyte Jul 12, 2024
aa0aaa5
next: updates (#610)
huntabyte Jul 17, 2024
04c4078
next: Link Preview (#612)
huntabyte Jul 18, 2024
49d03c9
chore: adds pkg-pr-new for `next` branch (#613)
AdrianGonz97 Jul 18, 2024
88d4390
chore(next): fix preview packages labels (#616)
AdrianGonz97 Jul 18, 2024
c932a76
next: Combobox (#617)
huntabyte Jul 21, 2024
89c2953
next: Scroll Area (#618)
huntabyte Jul 22, 2024
4760139
next: cleanup (#619)
huntabyte Jul 26, 2024
bb0d9d7
fix preview pr
huntabyte Jul 27, 2024
f0c10fe
next: Documentation work (#622)
huntabyte Jul 29, 2024
3d7a61b
chore: upgrade pnpm version (#624)
JitPackJoyride Jul 30, 2024
efee0cb
next: docs (#625)
huntabyte Jul 30, 2024
b06d02f
remove path filter
huntabyte Jul 31, 2024
fcb3ad2
readd path
huntabyte Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
67 changes: 8 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8

- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand All @@ -49,29 +34,11 @@ jobs:
name: Lint
steps:
- uses: actions/checkout@v4
- name: Install Node.JS
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand All @@ -82,29 +49,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.JS
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,11 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/docs-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,11 @@ jobs:
name: Publish to Cloudflare Pages
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Preview Release
on:
pull_request:
types: [ready_for_review, synchronize, opened, labeled]
paths: [packages/**]

jobs:
preview-release:
if: github.repository == 'huntabyte/bits-ui' && contains(github.event.pull_request.labels.*.name, 'publish:preview')
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: install dependencies
run: pnpm install

- name: build
run: pnpm build:packages

- name: publish preview
run: |
pnpx pkg-pr-new@0.0 publish --pnpm --compact './packages/*'
27 changes: 5 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,17 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.18.2
v20.15.1
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tabWidth": 4,
"singleQuote": false,
"trailingComma": "es5",
"semi": true,
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
"eslint.useFlatConfig": true,

// Auto fix
"editor.codeActionsOnSave": {
Expand Down
40 changes: 40 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Svelte 5 Related Notes:

- Determine how we're going to handle the `name` prop for the date field & date range field. Currently, it's passed to the root of the date field, but to the individual inputs for the date range field. It should probably be consistent across both components, opting to pass it to the input.

---

Determine how to handle validation for the various date components. My initial thought is we'll have a `validate` prop that gets called each time the user changes the date value of the component. This gives the user maximum flexibility to handle validation, but we'll need to ensure it's done so in an accessible manner.

Perhaps we can provide a `Validation` component that can be used to display validation messages. Whatever is returned from the `validate` function could be rendered in the `Validation` component as a fallback, or the user can provide their own message within its children. With this approach, we also need to determine how to then handle the cases of `minValue`, `maxValue`, and `isDateUnavailable` being set. Something to think about.

We could have some sort of `Validation` object that gets passed to an `onInvalid` callback prop that is called when the date value is invalid. It could look something like this:

```ts
type InvalidResult = {
type: "min" | "max" | "unavailable" | "custom";
message?: string;
};
```

Then the user can handle this in their own way, such as displaying a validation message in a `Validation` component, or calling a function that does whatever they need to do to handle the validation. Need to think more on this one.

---

We need to determine the ideal approach for managing the `data-<component>` attributes. We've decided to use a `data-<component>-root` attribute for the root component, and `data-<component>-<part>` for each part.

Since other components depend on these attributes for selectors, we'll need to put them in a place where they can be easily accessed and if changed, those changes will propagate to everywhere the attribute is used.

They also need to be flexible enough to allow for reusing the same component while swapping the `data-component` prefix, for example, in the menus we have `data-menubar-*`, `data-dropdown-menu-*`, `data-context-menu-*`, etc. The easy button is of course to just consolidate these into just a single `data-menu` attribute, but that's not ideal and hinders the ability to apply different styles on a global level to the different components.

---

Should we embrace the [ValidityState](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) API? Something to think about.

---

We need to expose the different `open` states via snippet props for all the `forceMount`-able components to work with Svelte and other transition/animation libs.

---

We need to handle `invalid` state for the `DateRangeField` component.
35 changes: 35 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Bits UI
=================
The following is a list of sources from which code was used/modified in this codebase.

-------------------------------------------------------------------------------
This codebase contains a modified portion of code from Adobe which can be obtained at:
* SOURCE:
* https://www.npmjs.com/package/@react-aria/utils
* LICENSE (Apache 2.0):
* https://unpkg.com/@react-aria/utils@3.24.1/LICENSE

* SOURCE:
* https://www.npmjs.com/package/react-stately
* LICENSE (Apache 2.0):
* https://unpkg.com/react-stately@3.31.1/LICENSE

-------------------------------------------------------------------------------

This codebase contains a modified portion of code from Melt UI which can be obtained at:
* SOURCE:
* https://www.npmjs.com/package/@melt-ui/svelte
* LICENSE (MIT):
* https://unpkg.com/@melt-ui/svelte@0.76.2/LICENSE

-------------------------------------------------------------------------------

This codebase contains a modified portion of code from Radix UI which can be obtained at:
* SOURCE:
* https://www.npmjs.com/package/@radix-ui/react-scroll-area
* https://www.npmjs.com/package/@radix-ui/react-select
* https://www.npmjs.com/package/@radix-ui/react-navigation-menu
* LICENSE (MIT):
* https://github.com/radix-ui/primitives/blob/main/LICENSE

-------------------------------------------------------------------------------
25 changes: 24 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,27 @@ import config, { DEFAULT_IGNORES } from "@huntabyte/eslint-config";

const ignores = ["**/extended-types"];

export default config({ svelte: true, ignores: [...DEFAULT_IGNORES, ...ignores] });
export default config({ svelte: true, ignores: [...DEFAULT_IGNORES, ...ignores] })
.override("antfu/typescript/rules", {
rules: {
"ts/consistent-type-definitions": "off",
"unused-imports/no-unused-imports": "off",
"unused-imports/no-unused-vars": "off",
"ts/no-unused-expressions": "off",
"no-unused-expressions": "off",
"ts/no-empty-object-type": "off",
},
})
.override("antfu/javascript/rules", {
rules: {
"no-unused-expressions": "off",
"unused-imports/no-unused-imports": "off",
},
})
.override("huntabyte/svelte/rules", {
rules: {
"svelte/no-at-html-tags": "off",
"unused-imports/no-unused-imports": "off",
"unused-imports/no-unused-vars": "off",
},
});
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build:packages": "pnpm -F \"./packages/**\" --parallel build",
"check": "pnpm build:packages && pnpm -r check",
"ci:publish": "pnpm build:packages && changeset publish",
"dev": "pnpm -r --parallel dev",
"dev": "pnpm -F \"./packages/**\" svelte-kit sync && pnpm -r --parallel --reporter append-only --color dev",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "eslint --fix .",
Expand All @@ -18,21 +18,23 @@
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@huntabyte/eslint-config": "^0.1.1",
"@huntabyte/eslint-config": "^0.3.2",
"@huntabyte/eslint-plugin": "^0.1.0",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"eslint": "^8.56.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint": "^9.0.0",
"eslint-plugin-svelte": "^2.37.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"prettier-plugin-tailwindcss": "0.5.13",
"svelte": "^4.2.9",
"svelte-eslint-parser": "^0.33.1",
"svelte": "5.0.0-next.199",
"svelte-eslint-parser": "^0.41.0",
"wrangler": "^3.44.0"
},
"type": "module",
"engines": {
"pnpm": ">=8.7.0",
"node": ">=18"
},
"packageManager": "pnpm@9.6.0",
"private": true
}
Loading