Skip to content

Commit c1ef1e1

Browse files
committed
more api, small fix
1 parent 55b9e0d commit c1ef1e1

File tree

49 files changed

+1165
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1165
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { APISchema } from '$lib/types/schema';
2+
3+
export default [
4+
{
5+
title: 'ColorGradientPicker',
6+
description: 'A gradient editor that lets users add, remove, and reposition color stops.',
7+
props: {
8+
colors: {
9+
type: { type: 'array', definition: '{ rgb: { r: number; g: number; b: number }; position: number }[]' },
10+
description: 'The array of color stops defining the gradient.',
11+
bindable: true
12+
},
13+
defaultNewColor: {
14+
type: { type: 'object', definition: '{ r: number; g: number; b: number }' },
15+
description: 'The default RGB color for newly added stops.',
16+
default: '{ r: 0, g: 0, b: 0 }'
17+
},
18+
size: {
19+
type: { type: 'enum', definition: "'default' | 'sm'" },
20+
description: 'The size of the gradient picker.',
21+
default: "'default'"
22+
},
23+
onchange: {
24+
type: { type: 'function', definition: '(colors: ColorStop[]) => void' },
25+
description: 'Callback invoked when the gradient colors change.'
26+
},
27+
class: {
28+
type: 'string',
29+
description: 'Additional CSS classes to apply.'
30+
}
31+
}
32+
}
33+
] satisfies APISchema[];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Docs from './Documentation.md';
22
import Example from './Example.svelte';
33
import Card from './Card.svelte';
4+
import api from './api';
45

56
export default {
67
slug: 'color-gradient-picker',
78
title: 'Color Gradient Picker',
89
docs: Docs,
910
example: Example,
1011
card: Card,
12+
api,
1113
};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import type { APISchema } from '$lib/types/schema';
2+
3+
export default [
4+
{
5+
title: 'ColorPicker',
6+
description: 'A full color picker with a saturation/value area, hue slider, and optional quick-select swatches. Supports RGB, OKLab, and OKHsv color spaces.',
7+
props: {
8+
rgb: {
9+
type: { type: 'object', definition: '{ r: number; g: number; b: number }' },
10+
description: 'The current color in RGB format (0-255).',
11+
bindable: true
12+
},
13+
oklab: {
14+
type: { type: 'object', definition: '{ l: number; a: number; b: number }' },
15+
description: 'The current color in OKLab format.',
16+
bindable: true
17+
},
18+
okhsv: {
19+
type: { type: 'object', definition: '{ h: number; s: number; v: number }' },
20+
description: 'The current color in OKHsv format.',
21+
bindable: true
22+
},
23+
onchange: {
24+
type: { type: 'function', definition: '(color: { hex: string; rgb: RGB; oklab: OKlab; okhsv: OKhsv; oklch: OKlch }) => void' },
25+
description: 'Callback invoked when the color changes. Provides the color in all supported formats.'
26+
},
27+
quickSelects: {
28+
type: { type: 'array', definition: '{ label: string; rgb?: RGB; oklab?: OKlab; okhsv?: OKhsv }[]' },
29+
description: 'Quick-select color swatches displayed below the picker.',
30+
default: '[]',
31+
bindable: true
32+
},
33+
class: {
34+
type: 'string',
35+
description: 'Additional CSS classes to apply.'
36+
}
37+
}
38+
},
39+
{
40+
title: 'PopoverColorPicker',
41+
description: 'A color picker wrapped in a popover, triggered by a color swatch button.',
42+
props: {
43+
rgb: {
44+
type: { type: 'object', definition: '{ r: number; g: number; b: number }' },
45+
description: 'The current color in RGB format (0-255).',
46+
bindable: true
47+
},
48+
oklab: {
49+
type: { type: 'object', definition: '{ l: number; a: number; b: number }' },
50+
description: 'The current color in OKLab format.',
51+
bindable: true
52+
},
53+
okhsv: {
54+
type: { type: 'object', definition: '{ h: number; s: number; v: number }' },
55+
description: 'The current color in OKHsv format.',
56+
bindable: true
57+
},
58+
onchange: {
59+
type: { type: 'function', definition: '(color: { hex: string; rgb: RGB; oklab: OKlab; okhsv: OKhsv; oklch: OKlch }) => void' },
60+
description: 'Callback invoked when the color changes.'
61+
},
62+
quickSelects: {
63+
type: { type: 'array', definition: '{ label: string; rgb?: RGB; oklab?: OKlab; okhsv?: OKhsv }[]' },
64+
description: 'Quick-select color swatches.',
65+
default: '[]',
66+
bindable: true
67+
},
68+
side: {
69+
type: { type: 'enum', definition: "'top' | 'right' | 'bottom' | 'left'" },
70+
description: 'The preferred side of the trigger to render the popover.',
71+
default: "'bottom'"
72+
},
73+
sideOffset: {
74+
type: 'number',
75+
description: 'The distance in pixels from the trigger.',
76+
default: '10'
77+
},
78+
class: {
79+
type: 'string',
80+
description: 'Additional CSS classes to apply.'
81+
}
82+
}
83+
}
84+
] satisfies APISchema[];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Docs from './Documentation.md';
22
import Example from './Example.svelte';
33
import Card from './Card.svelte';
4+
import api from './api';
45

56
export default {
67
slug: 'color-picker',
78
title: 'Color Picker',
89
docs: Docs,
910
example: Example,
1011
card: Card,
12+
api,
1113
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { APISchema } from '$lib/types/schema';
2+
3+
export default [
4+
{
5+
title: 'ColorSelect',
6+
description: 'A group of color swatches that allows selecting a single color.',
7+
props: {
8+
colors: {
9+
type: { type: 'array', definition: "(string | { class?: string; label: string; value?: string })[]" },
10+
description: 'The list of selectable colors. Can be simple strings or objects with custom class, label, and value.',
11+
required: true,
12+
bindable: true
13+
},
14+
selected: {
15+
type: { type: 'union', definition: "string | { class?: string; label: string; value?: string }" },
16+
description: 'The currently selected color. Defaults to the first color.',
17+
bindable: true
18+
},
19+
name: {
20+
type: 'string',
21+
description: 'The name attribute for the underlying radio inputs (auto-generated if not provided).',
22+
bindable: true
23+
},
24+
onselected: {
25+
type: { type: 'function', definition: '(color: Color, previous: Color) => void' },
26+
description: 'Callback invoked when the selected color changes.'
27+
},
28+
colorsClass: {
29+
type: 'string',
30+
description: 'Additional CSS classes for the color swatches container.'
31+
},
32+
class: {
33+
type: 'string',
34+
description: 'Additional CSS classes to apply to the root element.'
35+
},
36+
ref: {
37+
type: 'HTMLDivElement',
38+
description: 'The underlying DOM element.',
39+
bindable: true
40+
}
41+
}
42+
}
43+
] satisfies APISchema[];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Docs from './Documentation.md';
22
import Example from './Example.svelte';
33
import Card from './Card.svelte';
4+
import api from './api';
45

56
export default {
67
slug: 'color-select',
78
title: 'Color Select',
89
docs: Docs,
910
example: Example,
1011
card: Card,
12+
api,
1113
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { APISchema } from '$lib/types/schema';
2+
3+
export default [
4+
{
5+
title: 'AtprotoHandlePopup',
6+
description: 'An autocomplete input for searching and selecting AT Protocol (Bluesky) user handles. Uses bits-ui Command for the combobox behavior.',
7+
props: {
8+
value: {
9+
type: 'string',
10+
description: 'The current input value.',
11+
bindable: true
12+
},
13+
onselected: {
14+
type: { type: 'function', definition: '(actor: { handle: string; displayName: string; avatar: string; did: string }) => void' },
15+
description: 'Callback invoked when a user profile is selected from the results.'
16+
},
17+
ref: {
18+
type: 'HTMLInputElement',
19+
description: 'Reference to the input element.',
20+
bindable: true
21+
}
22+
}
23+
}
24+
] satisfies APISchema[];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import Docs from './Documentation.md';
22
import Example from './Example.svelte';
33
import Card from './Card.svelte';
4+
import api from './api';
45

56
export default {
67
slug: 'atproto-handle-popup',
78
title: 'Atproto Handle Popup',
89
docs: Docs,
910
example: Example,
1011
card: Card,
12+
api,
13+
sources: [
14+
{
15+
href: 'https://bits-ui.com/docs/components/command',
16+
label: 'bits-ui command',
17+
package: 'bits-ui',
18+
component: 'Command'
19+
}
20+
]
1121
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { APISchema } from '$lib/types/schema';
2+
3+
export default [
4+
{
5+
title: 'AtprotoLoginModal',
6+
description: 'A modal dialog for AT Protocol (Bluesky) login with handle autocomplete. Export atProtoLoginModalState to control the modal.',
7+
props: {
8+
login: {
9+
type: { type: 'function', definition: '(handle: string) => Promise<boolean | undefined>' },
10+
description: 'Callback to handle the login action. Should return true on success.'
11+
},
12+
signup: {
13+
type: { type: 'function', definition: '() => Promise<boolean | undefined>' },
14+
description: 'Callback to handle the signup action.'
15+
},
16+
formAction: {
17+
type: 'string',
18+
description: 'The form action URL for server-side form submission.'
19+
},
20+
formMethod: {
21+
type: { type: 'enum', definition: "'dialog' | 'get' | 'post'" },
22+
description: 'The form submission method.',
23+
default: "'get'"
24+
},
25+
loginOnSelect: {
26+
type: 'boolean',
27+
description: 'Whether to automatically trigger login when a handle is selected from autocomplete.',
28+
default: 'true'
29+
}
30+
}
31+
}
32+
] satisfies APISchema[];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Docs from './Documentation.md';
22
import Example from './Example.svelte';
33
import Card from './Card.svelte';
4+
import api from './api';
45

56
export default {
67
slug: 'atproto-login',
78
title: 'Atproto Login',
89
docs: Docs,
910
example: Example,
1011
card: Card,
12+
api,
1113
};

0 commit comments

Comments
 (0)