@ui-sdk/svelte 0.1.0-beta.2 → 0.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/agents.md +13 -6
- package/docs/core.md +71 -14
- package/docs/installation.md +16 -1
- package/docs/introduction.md +1 -1
- package/docs/lists-and-menus.md +1 -1
- package/docs/llms.txt +18 -3
- package/package.json +3 -3
package/docs/agents.md
CHANGED
|
@@ -413,7 +413,7 @@ For components with choices, such as a Select or Combobox, `query` with `within`
|
|
|
413
413
|
const [region] = await agent.query({ within: "Region", text: "Europe" })
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
`region.items` holds up to 50 matching choices, each with a `value` and `label`, and `region.more` says how many matched beyond that. Leave out `text` to list the first 50.
|
|
416
|
+
`region.items` holds up to 50 matching choices, each with a `value` and `label`, and `region.more` says how many matched beyond that. Leave out `text` to list the first 50. `query()` never opens anything. When a list's items only show while it's open, `items` is empty and `note` says so.
|
|
417
417
|
|
|
418
418
|
`query` also finds components without listing the page. `agent.query({ text: "Europe" })` returns the components whose label or row text has that word, and lists whose choices match, with those choices under them. `kind` keeps one kind, such as `"select"`.
|
|
419
419
|
|
|
@@ -777,6 +777,7 @@ Here's the rating's primitive. Its API has one method, `rate`:
|
|
|
777
777
|
```ts title="rating.ts"
|
|
778
778
|
const rating = definePrimitive({
|
|
779
779
|
name: "rating",
|
|
780
|
+
options: { defaultValue: "number" },
|
|
780
781
|
state: (options: { defaultValue?: number }) => ({
|
|
781
782
|
value: options.defaultValue ?? 0,
|
|
782
783
|
}),
|
|
@@ -946,7 +947,7 @@ For your own confirmation UI, return a `Promise<boolean>` that resolves with the
|
|
|
946
947
|
|
|
947
948
|
## Mark What Needs a Person
|
|
948
949
|
|
|
949
|
-
Some controls should always wait for the person
|
|
950
|
+
Some controls should always wait for the person. Add `data-agent-confirm` with a sentence that says what the control does:
|
|
950
951
|
|
|
951
952
|
```tsx
|
|
952
953
|
<Button
|
|
@@ -974,6 +975,8 @@ const agent = createAgent({
|
|
|
974
975
|
|
|
975
976
|
If the person says no, the step fails with `The person said no to "…"`.
|
|
976
977
|
|
|
978
|
+
An `allow` that returns `true` without reading `step.confirm` answers yes for the person. Check it in every `allow` you write, including the one you pass to [`registerTools`](./agents.md#webmcp).
|
|
979
|
+
|
|
977
980
|
The mark covers its element and everything inside it, for any action. Put it on a form or section to cover every control in it, or on a dialog's content to cover the buttons inside, wherever the dialog renders.
|
|
978
981
|
|
|
979
982
|
## Keep Parts of the Page from the Agent
|
|
@@ -996,7 +999,7 @@ Two more marks change what the agent sees:
|
|
|
996
999
|
</Field>
|
|
997
1000
|
```
|
|
998
1001
|
|
|
999
|
-
Changes inside `data-agent-hidden` still reach [Observe](./agents.md#observe-changes), so your own logs see them, while `agent.subscribe` stays quiet. A secret value stays out of `snapshot`, `act` results and change events, and the field's error text reads `"[redacted]"` too. Password, card and one-time-code fields are treated as secret without a mark.
|
|
1002
|
+
Changes inside `data-agent-hidden` still reach [Observe](./agents.md#observe-changes), so your own logs see them, while `agent.subscribe` stays quiet. A secret value stays out of `snapshot`, `act` results and change events, and the field's error text reads `"[redacted]"` too. Password, card and one-time-code fields are treated as secret without a mark. A hidden input is left out without one.
|
|
1000
1003
|
|
|
1001
1004
|
In development, a misspelled mark such as `data-agent-confim` logs a warning with the name it meant.
|
|
1002
1005
|
|
|
@@ -1024,7 +1027,7 @@ Put value checks in these change callbacks. Actions such as `setValue` call the
|
|
|
1024
1027
|
|
|
1025
1028
|
`allow` checks actions. Components and their actions remain visible in `snapshot()`, and the agent can still read choices with `query()`. Use `data-agent-hidden` to keep a region out of view.
|
|
1026
1029
|
|
|
1027
|
-
Finding a component or its choices can open a section or popup before the requested action is checked.
|
|
1030
|
+
Finding a component or its choices can open a section or popup before the requested action is checked. Use the component's `onOpenChange` or equivalent callback if you need to reject those changes too.
|
|
1028
1031
|
|
|
1029
1032
|
The [Reference](./agents.md#reference) lists the fields passed to `allow` and the results returned by `act`.
|
|
1030
1033
|
|
|
@@ -1265,7 +1268,9 @@ const unregister = registerTools(agent, {
|
|
|
1265
1268
|
})
|
|
1266
1269
|
```
|
|
1267
1270
|
|
|
1268
|
-
The browser's agent can now read components and call their actions. You didn't write that agent, so `registerTools` asks for an `allow` of its own. It runs for every step the browser's agent asks for, after your bridge's [permissions](./agents.md#permissions), and works the same way: return `false` to refuse a step. Here it asks you before every press.
|
|
1271
|
+
The browser's agent can now read components and call their actions. You didn't write that agent, so `registerTools` asks for an `allow` of its own. It runs for every step the browser's agent asks for, after your bridge's [permissions](./agents.md#permissions), and works the same way: return `false` to refuse a step. Here it asks you before every press. Your change callbacks still apply.
|
|
1272
|
+
|
|
1273
|
+
A step on a control you marked with [`data-agent-confirm`](./agents.md#mark-what-needs-a-person) arrives with `step.confirm`, and this `allow` answers for the person. To let every other step run and leave those to the person, pass `allow: (step) => !step.confirm`.
|
|
1269
1274
|
|
|
1270
1275
|
Registration requires a browser that provides `document.modelContext.registerTool`. In a browser without it, `registerTools` does nothing.
|
|
1271
1276
|
|
|
@@ -1283,6 +1288,8 @@ This removes the browser tools. You can still call methods on `agent` directly.
|
|
|
1283
1288
|
|
|
1284
1289
|
`snapshot` and `query` have `readOnlyHint: true`. All three tools have `untrustedContentHint: true` because their results include page content, such as labels and text people entered.
|
|
1285
1290
|
|
|
1291
|
+
`act` has `consequentialHint: true` because a step can press any button, including one whose action can't be undone. A browser can use it to ask the person before it runs `act`.
|
|
1292
|
+
|
|
1286
1293
|
These are hints for the tool consumer. `snapshot` and `query` never open a component. Use [Permissions](./agents.md#permissions) to decide which requested actions your app accepts.
|
|
1287
1294
|
|
|
1288
1295
|
|
|
@@ -1487,7 +1494,7 @@ const unregister = registerTools(agent, {
|
|
|
1487
1494
|
})
|
|
1488
1495
|
```
|
|
1489
1496
|
|
|
1490
|
-
`allow` is required. It decides each step the browser's agent asks for, after the bridge's own `allow`, and works the same way: return `false` to refuse the step, or `true` to let
|
|
1497
|
+
`allow` is required. It decides each step the browser's agent asks for, after the bridge's own `allow`, and works the same way: return `false` to refuse the step, or `true` to let it run. A step with `confirm` is one you marked for a person, and `true` answers for them. It returns a cleanup function. In a browser without WebMCP, registration does nothing. See [WebMCP](./agents.md#webmcp) for registration, cleanup, and tool annotations.
|
|
1491
1498
|
|
|
1492
1499
|
## Custom Primitives
|
|
1493
1500
|
|
package/docs/core.md
CHANGED
|
@@ -179,7 +179,7 @@ function Example() {
|
|
|
179
179
|
|
|
180
180
|
**Vue**
|
|
181
181
|
|
|
182
|
-
```ts title="components/ui/mute-button.
|
|
182
|
+
```ts title="components/ui/mute-button.ts"
|
|
183
183
|
import { createParts } from "@ui-sdk/vue/primitive"
|
|
184
184
|
import { muteButton } from "@/lib/mute-button"
|
|
185
185
|
|
|
@@ -202,7 +202,7 @@ import { MuteButton } from "@/components/ui/mute-button"
|
|
|
202
202
|
|
|
203
203
|
**Svelte**
|
|
204
204
|
|
|
205
|
-
```ts title="components/ui/mute-button.
|
|
205
|
+
```ts title="components/ui/mute-button.ts"
|
|
206
206
|
import { createParts } from "@ui-sdk/svelte/primitive"
|
|
207
207
|
import { muteButton } from "@/lib/mute-button"
|
|
208
208
|
|
|
@@ -223,7 +223,7 @@ export { MuteButton }
|
|
|
223
223
|
|
|
224
224
|
**Solid**
|
|
225
225
|
|
|
226
|
-
```ts title="components/ui/mute-button.
|
|
226
|
+
```ts title="components/ui/mute-button.ts"
|
|
227
227
|
import { createParts } from "@ui-sdk/solid/primitive"
|
|
228
228
|
import { muteButton } from "@/lib/mute-button"
|
|
229
229
|
|
|
@@ -248,7 +248,7 @@ export { Example }
|
|
|
248
248
|
|
|
249
249
|
For web components, register a custom element:
|
|
250
250
|
|
|
251
|
-
```ts title="components/ui/mute-button.
|
|
251
|
+
```ts title="components/ui/mute-button.ts"
|
|
252
252
|
import { createParts, wrappedButton } from "@ui-sdk/web"
|
|
253
253
|
import { muteButton } from "@/lib/mute-button"
|
|
254
254
|
|
|
@@ -503,6 +503,9 @@ item: slot({
|
|
|
503
503
|
role: "option",
|
|
504
504
|
focus: "roving",
|
|
505
505
|
press: ({ api, key }) => api.choose(key),
|
|
506
|
+
attrs: (state, part) => ({
|
|
507
|
+
"aria-selected": String(state.value === part.key),
|
|
508
|
+
}),
|
|
506
509
|
}),
|
|
507
510
|
```
|
|
508
511
|
|
|
@@ -764,7 +767,7 @@ createParts(copyButton, {
|
|
|
764
767
|
|
|
765
768
|
`createParts` registers a custom element for each slot you map. `wrappedButton` puts the root's behavior and attributes on a native button inside the element. Import this file from your app's browser entry point.
|
|
766
769
|
|
|
767
|
-
`Root` creates the primitive's instance and shares it with the parts inside. Every other slot becomes a part named in Pascal case, so a `star` slot becomes `Star`.
|
|
770
|
+
`Root` creates the primitive's instance and shares it with the parts inside. Every other slot you map becomes a part named in Pascal case, so a `star` slot becomes `Star`.
|
|
768
771
|
|
|
769
772
|
## Pass Options
|
|
770
773
|
|
|
@@ -3404,6 +3407,8 @@ A phone picks its keyboard from the field: `inputmode` chooses the keys, like a
|
|
|
3404
3407
|
|
|
3405
3408
|
`createPointerKind` reports whether the main pointer is a finger or a mouse and whether it can hover, from the `pointer` and `hover` media features, plus `anyPointer` and `anyHover` for every pointer attached, like a trackpad on a tablet. Read it like a preference, with `usePreference` in each framework:
|
|
3406
3409
|
|
|
3410
|
+
**React**
|
|
3411
|
+
|
|
3407
3412
|
```tsx
|
|
3408
3413
|
import { createPointerKind } from "@ui-sdk/core"
|
|
3409
3414
|
import { usePreference } from "@ui-sdk/react/preferences"
|
|
@@ -3414,6 +3419,53 @@ const { hover } = usePreference(pointerKind)
|
|
|
3414
3419
|
// "hover" with a mouse, "none" on a phone, "unknown" on the server
|
|
3415
3420
|
```
|
|
3416
3421
|
|
|
3422
|
+
**Vue**
|
|
3423
|
+
|
|
3424
|
+
```ts
|
|
3425
|
+
import { createPointerKind } from "@ui-sdk/core"
|
|
3426
|
+
import { usePreference } from "@ui-sdk/vue/preferences"
|
|
3427
|
+
|
|
3428
|
+
const pointerKind = createPointerKind()
|
|
3429
|
+
|
|
3430
|
+
const pointer = usePreference(pointerKind)
|
|
3431
|
+
// pointer.value.hover: "hover" with a mouse, "none" on a phone, "unknown" on the server
|
|
3432
|
+
```
|
|
3433
|
+
|
|
3434
|
+
**Svelte**
|
|
3435
|
+
|
|
3436
|
+
```ts
|
|
3437
|
+
import { createPointerKind } from "@ui-sdk/core"
|
|
3438
|
+
import { usePreference } from "@ui-sdk/svelte/preferences"
|
|
3439
|
+
|
|
3440
|
+
const pointerKind = createPointerKind()
|
|
3441
|
+
|
|
3442
|
+
const pointer = usePreference(pointerKind)
|
|
3443
|
+
// pointer.current.hover: "hover" with a mouse, "none" on a phone, "unknown" on the server
|
|
3444
|
+
```
|
|
3445
|
+
|
|
3446
|
+
**Solid**
|
|
3447
|
+
|
|
3448
|
+
```tsx
|
|
3449
|
+
import { createPointerKind } from "@ui-sdk/core"
|
|
3450
|
+
import { usePreference } from "@ui-sdk/solid/preferences"
|
|
3451
|
+
|
|
3452
|
+
const pointerKind = createPointerKind()
|
|
3453
|
+
|
|
3454
|
+
const pointer = usePreference(pointerKind)
|
|
3455
|
+
// pointer().hover: "hover" with a mouse, "none" on a phone, "unknown" on the server
|
|
3456
|
+
```
|
|
3457
|
+
|
|
3458
|
+
**Web Components**
|
|
3459
|
+
|
|
3460
|
+
```ts
|
|
3461
|
+
import { createPointerKind } from "@ui-sdk/core"
|
|
3462
|
+
|
|
3463
|
+
const pointerKind = createPointerKind()
|
|
3464
|
+
|
|
3465
|
+
const { hover } = pointerKind.get()
|
|
3466
|
+
// "hover" with a mouse, "none" on a phone, "unknown" on the server
|
|
3467
|
+
```
|
|
3468
|
+
|
|
3417
3469
|
It's for behavior and content, like opening on tap where nothing can hover. Style with the media queries themselves, `@media (hover: hover)` or Tailwind's `pointer-coarse:`, which are right from the first paint.
|
|
3418
3470
|
|
|
3419
3471
|
With a mouse, the details open on hover. On a phone, they open on tap, and the button says so.
|
|
@@ -3802,7 +3854,7 @@ In Notes, press Control or Command with U, then Shift+Tab. Focus returns to Unde
|
|
|
3802
3854
|
|
|
3803
3855
|
### Any Layout
|
|
3804
3856
|
|
|
3805
|
-
|
|
3857
|
+
`move` decides where each key goes. A keypad can use it to move three items at a time for Up and Down:
|
|
3806
3858
|
|
|
3807
3859
|
```ts
|
|
3808
3860
|
move: (event, { from, items, rtl }) => {
|
|
@@ -5441,7 +5493,11 @@ option: slot<{ value: string }>({
|
|
|
5441
5493
|
...part.api.listbox.attrs(state, part),
|
|
5442
5494
|
"aria-selected": String(state.value === part.key),
|
|
5443
5495
|
}),
|
|
5444
|
-
|
|
5496
|
+
press: ({ key, api }, event) => api.choose(key, event),
|
|
5497
|
+
on: {
|
|
5498
|
+
pointerdown: (event) => event.preventDefault(),
|
|
5499
|
+
pointermove: (event, { key, api }) => api.listbox.highlight(key, { event }),
|
|
5500
|
+
},
|
|
5445
5501
|
bind: (el, part) => part.api.listbox.bind(el, part),
|
|
5446
5502
|
}),
|
|
5447
5503
|
```
|
|
@@ -7948,7 +8004,7 @@ Pick your framework, then copy this prompt into your agent.
|
|
|
7948
8004
|
```text prompt
|
|
7949
8005
|
Set up ui-sdk in this React project. It needs React 19 or newer.
|
|
7950
8006
|
|
|
7951
|
-
1. Install @ui-sdk/react and @ui-sdk/core with the project's package manager.
|
|
8007
|
+
1. Install @ui-sdk/react and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
7952
8008
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/react/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/react/docs/core.md by heading, and read rendering.md next to it.
|
|
7953
8009
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
7954
8010
|
```
|
|
@@ -7958,9 +8014,10 @@ Set up ui-sdk in this React project. It needs React 19 or newer.
|
|
|
7958
8014
|
```text prompt
|
|
7959
8015
|
Set up ui-sdk in this Vue project. It needs Vue 3.5 or newer.
|
|
7960
8016
|
|
|
7961
|
-
1. Install @ui-sdk/vue and @ui-sdk/core with the project's package manager.
|
|
7962
|
-
2.
|
|
7963
|
-
3.
|
|
8017
|
+
1. Install @ui-sdk/vue and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
8018
|
+
2. If it's a Nuxt 4 or newer app, add "@ui-sdk/vue" to modules in nuxt.config.ts.
|
|
8019
|
+
3. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/vue/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/vue/docs/core.md by heading, and read rendering.md next to it.
|
|
8020
|
+
4. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
7964
8021
|
```
|
|
7965
8022
|
|
|
7966
8023
|
**Svelte**
|
|
@@ -7968,7 +8025,7 @@ Set up ui-sdk in this Vue project. It needs Vue 3.5 or newer.
|
|
|
7968
8025
|
```text prompt
|
|
7969
8026
|
Set up ui-sdk in this Svelte project. It needs Svelte 5.33 or newer.
|
|
7970
8027
|
|
|
7971
|
-
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager.
|
|
8028
|
+
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
7972
8029
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/svelte/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/svelte/docs/core.md by heading, and read rendering.md next to it.
|
|
7973
8030
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
7974
8031
|
```
|
|
@@ -7978,7 +8035,7 @@ Set up ui-sdk in this Svelte project. It needs Svelte 5.33 or newer.
|
|
|
7978
8035
|
```text prompt
|
|
7979
8036
|
Set up ui-sdk in this Solid project. It needs Solid 2: solid-js and @solidjs/web 2.0.0-rc.14 or newer.
|
|
7980
8037
|
|
|
7981
|
-
1. Install @ui-sdk/solid and @ui-sdk/core with the project's package manager.
|
|
8038
|
+
1. Install @ui-sdk/solid and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
7982
8039
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/solid/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/solid/docs/core.md by heading, and read rendering.md next to it.
|
|
7983
8040
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
7984
8041
|
```
|
|
@@ -7988,7 +8045,7 @@ Set up ui-sdk in this Solid project. It needs Solid 2: solid-js and @solidjs/web
|
|
|
7988
8045
|
```text prompt
|
|
7989
8046
|
Set up ui-sdk in this Web Components project. Each component registers its tags when you import its entry, like @ui-sdk/web/dialog.
|
|
7990
8047
|
|
|
7991
|
-
1. Install @ui-sdk/web and @ui-sdk/core with the project's package manager.
|
|
8048
|
+
1. Install @ui-sdk/web and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
7992
8049
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/web/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/web/docs/core.md by heading, and read rendering.md next to it.
|
|
7993
8050
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
7994
8051
|
```
|
package/docs/installation.md
CHANGED
|
@@ -42,7 +42,22 @@ Each [component page](./README.md) lists the parts you can use.
|
|
|
42
42
|
|
|
43
43
|
Components are unstyled, so you style them with your app's CSS or with Tailwind CSS. [Styling and Animation](./styling-and-animation.md) covers both.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
For a default look to start from, import `@ui-sdk/core/web.css` once. In SvelteKit, import it in the `<script>` of `src/routes/+layout.svelte`. In a Vite app, import it at the top of `main.ts`:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import "@ui-sdk/core/web.css"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
With Tailwind CSS, import it in your global stylesheet instead, after Tailwind. `layer(components)` puts it above Tailwind's base styles, so they don't reset it, and below its utilities, so a class still wins. Declare [the ui-sdk layer](./styling-and-animation.md#the-ui-sdk-layer) above both:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@layer ui-sdk;
|
|
55
|
+
|
|
56
|
+
@import "tailwindcss";
|
|
57
|
+
@import "@ui-sdk/core/web.css" layer(components);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
You can render your first component without setting up a provider or adding a portal root. SvelteKit can render the initial HTML on the server; [Server Rendering](./server-rendering.md) explains how to keep it consistent when the page hydrates.
|
|
46
61
|
|
|
47
62
|
## Right to Left
|
|
48
63
|
|
package/docs/introduction.md
CHANGED
|
@@ -15,7 +15,7 @@ Copy this prompt into your agent:
|
|
|
15
15
|
```text prompt
|
|
16
16
|
Set up ui-sdk in this Svelte project. It needs Svelte 5.33 or newer.
|
|
17
17
|
|
|
18
|
-
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager.
|
|
18
|
+
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
19
19
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/svelte/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/svelte/docs/core.md by heading, and read rendering.md next to it.
|
|
20
20
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
21
21
|
```
|
package/docs/lists-and-menus.md
CHANGED
|
@@ -76,7 +76,7 @@ A list that searches still filters the items you render, and hides the ones that
|
|
|
76
76
|
|
|
77
77
|
Searchable components accept a `filter` to change how typing narrows their items. [Async Options](./utilities/async-options.md) handles server results, debouncing, and stale requests.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
For a large list, pass every option through `items` and render only the visible rows. [Select](./components/select.md#virtualized) and [Combobox](./components/combobox.md#virtualized) show how.
|
|
80
80
|
|
|
81
81
|
## Describe a Menu
|
|
82
82
|
|
package/docs/llms.txt
CHANGED
|
@@ -22,7 +22,7 @@ Copy this prompt into your agent:
|
|
|
22
22
|
```text prompt
|
|
23
23
|
Set up ui-sdk in this Svelte project. It needs Svelte 5.33 or newer.
|
|
24
24
|
|
|
25
|
-
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager.
|
|
25
|
+
1. Install @ui-sdk/svelte and @ui-sdk/core with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
|
|
26
26
|
2. Add a note to AGENTS.md, creating it if needed: before using ui-sdk, follow the ui-sdk skill if it's installed, and read node_modules/@ui-sdk/svelte/docs/llms.txt. To build a new component, also search node_modules/@ui-sdk/svelte/docs/core.md by heading, and read rendering.md next to it.
|
|
27
27
|
3. If you support skills, run: npx skills add vercel-labs/ui --skill ui-sdk
|
|
28
28
|
```
|
|
@@ -80,7 +80,22 @@ Each [component page](./README.md) lists the parts you can use.
|
|
|
80
80
|
|
|
81
81
|
Components are unstyled, so you style them with your app's CSS or with Tailwind CSS. [Styling and Animation](./styling-and-animation.md) covers both.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
For a default look to start from, import `@ui-sdk/core/web.css` once. In SvelteKit, import it in the `<script>` of `src/routes/+layout.svelte`. In a Vite app, import it at the top of `main.ts`:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import "@ui-sdk/core/web.css"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
With Tailwind CSS, import it in your global stylesheet instead, after Tailwind. `layer(components)` puts it above Tailwind's base styles, so they don't reset it, and below its utilities, so a class still wins. Declare [the ui-sdk layer](./styling-and-animation.md#the-ui-sdk-layer) above both:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
@layer ui-sdk;
|
|
93
|
+
|
|
94
|
+
@import "tailwindcss";
|
|
95
|
+
@import "@ui-sdk/core/web.css" layer(components);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
You can render your first component without setting up a provider or adding a portal root. SvelteKit can render the initial HTML on the server; [Server Rendering](./server-rendering.md) explains how to keep it consistent when the page hydrates.
|
|
84
99
|
|
|
85
100
|
### Right to Left
|
|
86
101
|
|
|
@@ -808,7 +823,7 @@ A list that searches still filters the items you render, and hides the ones that
|
|
|
808
823
|
|
|
809
824
|
Searchable components accept a `filter` to change how typing narrows their items. [Async Options](./utilities/async-options.md) handles server results, debouncing, and stale requests.
|
|
810
825
|
|
|
811
|
-
|
|
826
|
+
For a large list, pass every option through `items` and render only the visible rows. [Select](./components/select.md#virtualized) and [Combobox](./components/combobox.md#virtualized) show how.
|
|
812
827
|
|
|
813
828
|
### Describe a Menu
|
|
814
829
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui-sdk/svelte",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
4
4
|
"description": "UI SDK for Svelte.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
],
|
|
382
382
|
"peerDependencies": {
|
|
383
383
|
"svelte": ">=5.33",
|
|
384
|
-
"@ui-sdk/core": "^0.1.0-beta.
|
|
384
|
+
"@ui-sdk/core": "^0.1.0-beta.4"
|
|
385
385
|
},
|
|
386
386
|
"devDependencies": {
|
|
387
387
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
"typescript": "~5.9.3",
|
|
394
394
|
"vite": "^8.3.3",
|
|
395
395
|
"vitest": "^5.0.3",
|
|
396
|
-
"@ui-sdk/core": "0.1.0-beta.
|
|
396
|
+
"@ui-sdk/core": "0.1.0-beta.4"
|
|
397
397
|
},
|
|
398
398
|
"scripts": {
|
|
399
399
|
"build": "node ../../scripts/build/build-svelte-package.mjs",
|