@stacksjs/components 0.2.867 → 0.2.869
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/dist/AppearancePicker-61r20jpp.stx +351 -0
- package/dist/{Button-sebyqeva.stx → Button-pg8mzsq3.stx} +249 -0
- package/dist/Checkbox-52mhrzkz.stx +417 -0
- package/dist/ColorSwatches-ecfxphjy.stx +287 -0
- package/dist/{NumberInput-axcfj9y8.stx → NumberInput-e2afxyh3.stx} +303 -0
- package/dist/{PasswordInput-8m3109tp.stx → PasswordInput-n2ven456.stx} +315 -0
- package/dist/RadioGroup-ps9kn22f.stx +329 -0
- package/dist/RadioGroupOption-6hyy1bvb.stx +246 -0
- package/dist/{SegmentedControl-fr69q4gb.stx → SegmentedControl-7q0t8c9s.stx} +170 -1
- package/dist/{Select-1cnqbcmg.stx → Select-ygzchedx.stx} +266 -0
- package/dist/SettingsGroup-dkae46k5.stx +200 -0
- package/dist/SettingsPane-jbd1gbdt.stx +50 -0
- package/dist/SettingsPaneHeader-f0cvkqs7.stx +188 -0
- package/dist/SettingsRow-4cxbsf1q.stx +424 -0
- package/dist/SettingsSidebarGroup-p2ygv5yy.stx +108 -0
- package/dist/SettingsSidebarItem-x8fsn3w5.stx +228 -0
- package/dist/SettingsWindow-mm490ymt.stx +537 -0
- package/dist/Slider-j59dgw1c.stx +377 -0
- package/dist/Switch-ga9ap8n8.stx +374 -0
- package/dist/{TextInput-tsvfwxmg.stx → TextInput-tyqzz3jy.stx} +325 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +35 -24
- package/dist/settings/settings.js +757 -0
- package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
- package/dist/ui/appearance-picker/index.d.ts +16 -0
- package/dist/ui/button/Button.d.ts +24 -1
- package/dist/ui/button/index.d.ts +1 -0
- package/dist/ui/checkbox/Checkbox.d.ts +9 -1
- package/dist/ui/checkbox/index.d.ts +1 -0
- package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
- package/dist/ui/color-swatches/index.d.ts +18 -0
- package/dist/ui/input/NumberInput.d.ts +11 -1
- package/dist/ui/input/PasswordInput.d.ts +9 -1
- package/dist/ui/input/TextInput.d.ts +12 -1
- package/dist/ui/input/index.d.ts +7 -3
- package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
- package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
- package/dist/ui/radio-group/index.d.ts +2 -0
- package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
- package/dist/ui/segmented-control/index.d.ts +1 -0
- package/dist/ui/select/Select.d.ts +10 -1
- package/dist/ui/select/index.d.ts +1 -0
- package/dist/ui/settings/SettingsGroup.d.ts +30 -0
- package/dist/ui/settings/SettingsPane.d.ts +19 -0
- package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
- package/dist/ui/settings/SettingsRow.d.ts +53 -0
- package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
- package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
- package/dist/ui/settings/SettingsWindow.d.ts +22 -0
- package/dist/ui/settings/core.d.ts +146 -0
- package/dist/ui/settings/index.d.ts +73 -0
- package/dist/ui/settings/settings.d.ts +8 -0
- package/dist/ui/settings/view.d.ts +36 -0
- package/dist/ui/slider/Slider.d.ts +24 -0
- package/dist/ui/slider/core.d.ts +33 -0
- package/dist/ui/slider/index.d.ts +20 -0
- package/dist/ui/switch/Switch.d.ts +10 -1
- package/dist/ui/switch/index.d.ts +2 -1
- package/dist/utils/mac-theme.d.ts +24 -0
- package/package.json +8 -3
- package/src/index.ts +6 -0
- package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
- package/src/ui/appearance-picker/README.md +61 -0
- package/src/ui/appearance-picker/index.ts +22 -0
- package/src/ui/button/Button.stx +249 -0
- package/src/ui/button/README.md +21 -0
- package/src/ui/button/index.ts +8 -0
- package/src/ui/checkbox/Checkbox.stx +275 -0
- package/src/ui/checkbox/index.ts +2 -0
- package/src/ui/color-swatches/ColorSwatches.stx +287 -0
- package/src/ui/color-swatches/README.md +66 -0
- package/src/ui/color-swatches/index.ts +25 -0
- package/src/ui/input/NumberInput.stx +303 -0
- package/src/ui/input/PasswordInput.stx +315 -0
- package/src/ui/input/TextInput.stx +325 -0
- package/src/ui/input/index.ts +9 -3
- package/src/ui/radio-group/README.md +17 -0
- package/src/ui/radio-group/RadioGroup.stx +184 -6
- package/src/ui/radio-group/RadioGroupOption.stx +178 -2
- package/src/ui/radio-group/index.ts +4 -0
- package/src/ui/segmented-control/SegmentedControl.stx +170 -1
- package/src/ui/segmented-control/index.ts +2 -0
- package/src/ui/select/README.md +12 -0
- package/src/ui/select/Select.stx +266 -0
- package/src/ui/select/index.ts +2 -0
- package/src/ui/settings/README.md +221 -0
- package/src/ui/settings/SettingsGroup.stx +200 -0
- package/src/ui/settings/SettingsPane.stx +50 -0
- package/src/ui/settings/SettingsPaneHeader.stx +188 -0
- package/src/ui/settings/SettingsRow.stx +424 -0
- package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
- package/src/ui/settings/SettingsSidebarItem.stx +228 -0
- package/src/ui/settings/SettingsWindow.stx +537 -0
- package/src/ui/settings/core.ts +359 -0
- package/src/ui/settings/index.ts +111 -0
- package/src/ui/settings/settings.ts +8 -0
- package/src/ui/settings/view.ts +740 -0
- package/src/ui/slider/README.md +91 -0
- package/src/ui/slider/Slider.stx +377 -0
- package/src/ui/slider/core.ts +120 -0
- package/src/ui/slider/index.ts +34 -0
- package/src/ui/switch/README.md +11 -0
- package/src/ui/switch/Switch.stx +217 -0
- package/src/ui/switch/index.ts +4 -1
- package/src/utils/mac-theme.ts +95 -0
- package/dist/Checkbox-80myyzzm.stx +0 -142
- package/dist/RadioGroup-smqcqgds.stx +0 -151
- package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
- package/dist/Switch-s8yf2rvm.stx +0 -157
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/** The storage name the last pane is kept under. */
|
|
2
|
+
export declare function settingsStorageName(key: string): string;
|
|
3
|
+
export declare function findSettingsPane(panes: readonly SettingsPaneInfo[], id: string | null | undefined): SettingsPaneInfo | null;
|
|
4
|
+
/** The pane a window opens on when nothing says otherwise: the first that is not a sub-pane. */
|
|
5
|
+
export declare function firstSettingsPane(panes: readonly SettingsPaneInfo[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* The first of `wanted` that is a pane, or the first pane.
|
|
8
|
+
*
|
|
9
|
+
* A stored id outlives the pane it named, and a prop can be mistyped. Neither
|
|
10
|
+
* should open a window on nothing.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveSettingsPane(panes: readonly SettingsPaneInfo[], ...wanted: Array<string | null | undefined>): string;
|
|
13
|
+
/**
|
|
14
|
+
* The sidebar item that stays selected while `id` is open: the pane itself, or
|
|
15
|
+
* for a sub-pane the pane at the top of its chain of parents.
|
|
16
|
+
*/
|
|
17
|
+
export declare function settingsSidebarPane(panes: readonly SettingsPaneInfo[], id: string): string;
|
|
18
|
+
/** The pane above a sub-pane, or empty. A parent that does not exist is no parent. */
|
|
19
|
+
export declare function settingsParentPane(panes: readonly SettingsPaneInfo[], id: string): string;
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// History
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
export declare function emptySettingsHistory(): SettingsHistory;
|
|
24
|
+
export declare function settingsHistoryCurrent(history: SettingsHistory): string;
|
|
25
|
+
/**
|
|
26
|
+
* Visit a pane. Whatever lay ahead of the cursor is a future this choice
|
|
27
|
+
* replaced, as a browser drops its forward stack on a new navigation. Visiting
|
|
28
|
+
* the pane that is already open changes nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare function settingsHistoryVisit(history: SettingsHistory, id: string): SettingsHistory;
|
|
31
|
+
export declare function settingsCanGoForward(history: SettingsHistory): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Back is possible when there is a pane behind the cursor, or when the window
|
|
34
|
+
* opened straight onto a sub-pane, whose parent is then where back leads.
|
|
35
|
+
*/
|
|
36
|
+
export declare function settingsCanGoBack(history: SettingsHistory, panes?: readonly SettingsPaneInfo[]): boolean;
|
|
37
|
+
export declare function settingsHistoryBack(history: SettingsHistory, panes?: readonly SettingsPaneInfo[]): SettingsHistory;
|
|
38
|
+
export declare function settingsHistoryForward(history: SettingsHistory): SettingsHistory;
|
|
39
|
+
/** Lower case, accents folded, runs of space made one. What both sides of a match are compared as. */
|
|
40
|
+
export declare function normalizeSettingsText(text: string | null | undefined): string;
|
|
41
|
+
/**
|
|
42
|
+
* How well `query` matches a label and its keywords.
|
|
43
|
+
*
|
|
44
|
+
* The label starting with the query is best, then a word of the label starting
|
|
45
|
+
* with it, then the query anywhere in the label, then the keywords. A query of
|
|
46
|
+
* several words matches when every word does, and is as good as its weakest
|
|
47
|
+
* word, unless the label holds the whole phrase.
|
|
48
|
+
*/
|
|
49
|
+
export declare function settingsMatchRank(query: string, label: string, keywords?: string): number;
|
|
50
|
+
/**
|
|
51
|
+
* Search the sidebar and the settings inside the panes.
|
|
52
|
+
*
|
|
53
|
+
* A sidebar item matches on its label, its own keywords and its pane's. A
|
|
54
|
+
* setting matches on its label and its keywords, and last of all on the name
|
|
55
|
+
* of the pane it is in, so typing a pane's name lists what is in it under the
|
|
56
|
+
* better matches. Settings come back best first, and in page order within a
|
|
57
|
+
* rank.
|
|
58
|
+
*/
|
|
59
|
+
export declare function searchSettings(query: string, index: SettingsSearchIndex): SettingsSearchResult;
|
|
60
|
+
/** What a screen reader is told after a search. */
|
|
61
|
+
export declare function settingsResultsAnnouncement(count: number): string;
|
|
62
|
+
/**
|
|
63
|
+
* Where a key moves from `index` in a list of `count`, or -1 when the key is
|
|
64
|
+
* not one that moves. The ends stop, as they do in a Mac source list.
|
|
65
|
+
*/
|
|
66
|
+
export declare function settingsRovingIndex(key: string, index: number, count: number): number;
|
|
67
|
+
/** Add a typed character. A pause starts a new word. */
|
|
68
|
+
export declare function settingsTypeAheadAdd(state: SettingsTypeAhead | null, character: string, now: number, timeout?: unknown): SettingsTypeAhead;
|
|
69
|
+
/**
|
|
70
|
+
* The item a typed word selects, or -1.
|
|
71
|
+
*
|
|
72
|
+
* One letter, or the same letter again and again, walks through the items that
|
|
73
|
+
* start with it, beginning after the current one. A longer word stays on the
|
|
74
|
+
* current item while it still matches, and otherwise finds the next that does.
|
|
75
|
+
*/
|
|
76
|
+
export declare function settingsTypeAheadMatch(labels: readonly string[], buffer: string, current: number): number;
|
|
77
|
+
/** How well a label matched. Higher is better; `NONE` is no match. */
|
|
78
|
+
export declare const SETTINGS_RANK: {
|
|
79
|
+
NONE: 0;
|
|
80
|
+
KEYWORD: 1;
|
|
81
|
+
SUBSTRING: 2;
|
|
82
|
+
WORD_PREFIX: 3;
|
|
83
|
+
PREFIX: 4
|
|
84
|
+
};
|
|
85
|
+
/** How long a typed run of letters stays one word, in milliseconds. */
|
|
86
|
+
export declare const SETTINGS_TYPE_AHEAD_MS: 700;
|
|
87
|
+
/** How long a found row stays highlighted, in milliseconds. */
|
|
88
|
+
export declare const SETTINGS_HIGHLIGHT_MS: 1600;
|
|
89
|
+
/**
|
|
90
|
+
* What a Settings window decides, without a DOM.
|
|
91
|
+
*
|
|
92
|
+
* Which pane is open, where back and forward lead, which sidebar item a pane
|
|
93
|
+
* belongs under, what a search finds and in what order, and where an arrow key
|
|
94
|
+
* or a typed letter moves the selection. The view reads the page into the
|
|
95
|
+
* shapes below and asks these functions what to do.
|
|
96
|
+
*/
|
|
97
|
+
/** A pane as the page declares it. `parent` is empty for a pane in the sidebar. */
|
|
98
|
+
export declare interface SettingsPaneInfo {
|
|
99
|
+
id: string
|
|
100
|
+
title: string
|
|
101
|
+
keywords?: string
|
|
102
|
+
parent?: string
|
|
103
|
+
}
|
|
104
|
+
/** A sidebar item. Its id is the id of the pane it opens. */
|
|
105
|
+
export declare interface SettingsItemInfo {
|
|
106
|
+
id: string
|
|
107
|
+
label: string
|
|
108
|
+
keywords?: string
|
|
109
|
+
}
|
|
110
|
+
/** A row inside a pane. `id` is its `data-setting`, empty when it has none. */
|
|
111
|
+
export declare interface SettingsRowInfo {
|
|
112
|
+
id: string
|
|
113
|
+
label: string
|
|
114
|
+
keywords?: string
|
|
115
|
+
pane: string
|
|
116
|
+
}
|
|
117
|
+
/** Everything a search looks through. */
|
|
118
|
+
export declare interface SettingsSearchIndex {
|
|
119
|
+
panes: readonly SettingsPaneInfo[]
|
|
120
|
+
items: readonly SettingsItemInfo[]
|
|
121
|
+
rows: readonly SettingsRowInfo[]
|
|
122
|
+
}
|
|
123
|
+
/** A setting a search found. */
|
|
124
|
+
export declare interface SettingsSearchHit {
|
|
125
|
+
id: string
|
|
126
|
+
label: string
|
|
127
|
+
pane: string
|
|
128
|
+
paneTitle: string
|
|
129
|
+
row: number
|
|
130
|
+
rank: number
|
|
131
|
+
}
|
|
132
|
+
export declare interface SettingsSearchResult {
|
|
133
|
+
query: string
|
|
134
|
+
panes: string[]
|
|
135
|
+
settings: SettingsSearchHit[]
|
|
136
|
+
}
|
|
137
|
+
/** The trail of panes visited, and where in it the window is. */
|
|
138
|
+
export declare interface SettingsHistory {
|
|
139
|
+
trail: readonly string[]
|
|
140
|
+
cursor: number
|
|
141
|
+
}
|
|
142
|
+
/** The letters typed so far, and when the last one landed. */
|
|
143
|
+
export declare interface SettingsTypeAhead {
|
|
144
|
+
buffer: string
|
|
145
|
+
at: number
|
|
146
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export declare interface SettingsWindowProps {
|
|
2
|
+
title?: string
|
|
3
|
+
pane?: string
|
|
4
|
+
searchable?: boolean
|
|
5
|
+
searchPlaceholder?: string
|
|
6
|
+
storageKey?: string
|
|
7
|
+
presentation?: 'window' | 'sheet'
|
|
8
|
+
sidebarWidth?: number
|
|
9
|
+
height?: string
|
|
10
|
+
id?: string
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
export declare interface SettingsSidebarGroupProps {
|
|
14
|
+
label?: string
|
|
15
|
+
className?: string
|
|
16
|
+
}
|
|
17
|
+
export declare interface SettingsSidebarItemProps {
|
|
18
|
+
id: string
|
|
19
|
+
label: string
|
|
20
|
+
icon?: string
|
|
21
|
+
tone?: SettingsTone
|
|
22
|
+
badge?: string | number
|
|
23
|
+
keywords?: string
|
|
24
|
+
className?: string
|
|
25
|
+
}
|
|
26
|
+
export declare interface SettingsPaneProps {
|
|
27
|
+
id: string
|
|
28
|
+
title: string
|
|
29
|
+
keywords?: string
|
|
30
|
+
parent?: string
|
|
31
|
+
active?: boolean
|
|
32
|
+
className?: string
|
|
33
|
+
}
|
|
34
|
+
export declare interface SettingsGroupProps {
|
|
35
|
+
header?: string
|
|
36
|
+
footer?: string
|
|
37
|
+
id?: string
|
|
38
|
+
className?: string
|
|
39
|
+
}
|
|
40
|
+
export declare interface SettingsRowProps {
|
|
41
|
+
label: string
|
|
42
|
+
description?: string
|
|
43
|
+
icon?: string
|
|
44
|
+
tone?: SettingsTone
|
|
45
|
+
setting?: string
|
|
46
|
+
keywords?: string
|
|
47
|
+
to?: string
|
|
48
|
+
value?: string
|
|
49
|
+
multiline?: boolean
|
|
50
|
+
destructive?: boolean
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
layout?: 'inline' | 'stacked'
|
|
53
|
+
id?: string
|
|
54
|
+
className?: string
|
|
55
|
+
}
|
|
56
|
+
export declare interface SettingsPaneHeaderProps {
|
|
57
|
+
icon?: string
|
|
58
|
+
tone?: SettingsTone
|
|
59
|
+
title: string
|
|
60
|
+
description?: string
|
|
61
|
+
className?: string
|
|
62
|
+
}
|
|
63
|
+
/** The colour of an icon tile, in the sidebar or leading a row. */
|
|
64
|
+
export type SettingsTone = 'grey' | 'blue' | 'red' | 'orange' | 'yellow' | 'green' | 'indigo' | 'purple' | 'pink' | 'ink';
|
|
65
|
+
export * from './core';
|
|
66
|
+
export { default as SettingsGroup } from './SettingsGroup';
|
|
67
|
+
export { default as SettingsPane } from './SettingsPane';
|
|
68
|
+
export { default as SettingsPaneHeader } from './SettingsPaneHeader';
|
|
69
|
+
export { default as SettingsRow } from './SettingsRow';
|
|
70
|
+
export { default as SettingsSidebarGroup } from './SettingsSidebarGroup';
|
|
71
|
+
export { default as SettingsSidebarItem } from './SettingsSidebarItem';
|
|
72
|
+
export { default as SettingsWindow } from './SettingsWindow';
|
|
73
|
+
export * from './view';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Settings window without its stx templates.
|
|
3
|
+
*
|
|
4
|
+
* `@stacksjs/components/settings`. What the window decides (`./core`, no DOM)
|
|
5
|
+
* and the view that applies it to any markup following the DOM contract.
|
|
6
|
+
*/
|
|
7
|
+
export * from './core';
|
|
8
|
+
export * from './view';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare interface SettingsWindowOptions {
|
|
2
|
+
pane?: string
|
|
3
|
+
storageKey?: string
|
|
4
|
+
globalKeys?: boolean
|
|
5
|
+
}
|
|
6
|
+
export declare interface SettingsPaneDetail {
|
|
7
|
+
id: string
|
|
8
|
+
title: string
|
|
9
|
+
parent: string
|
|
10
|
+
}
|
|
11
|
+
export declare interface SettingsSearchDetail {
|
|
12
|
+
query: string
|
|
13
|
+
panes: string[]
|
|
14
|
+
settings: Array<{ id: string, label: string, pane: string }>
|
|
15
|
+
}
|
|
16
|
+
export declare interface SettingsNavigateDetail {
|
|
17
|
+
id: string
|
|
18
|
+
from: string
|
|
19
|
+
setting: string
|
|
20
|
+
}
|
|
21
|
+
export declare interface SettingsWindowCallbacks {
|
|
22
|
+
onPane?: (detail: SettingsPaneDetail) => void
|
|
23
|
+
onSearch?: (detail: SettingsSearchDetail) => void
|
|
24
|
+
onNavigate?: (detail: SettingsNavigateDetail) => void
|
|
25
|
+
}
|
|
26
|
+
export declare class SettingsWindowView {
|
|
27
|
+
constructor(root: HTMLElement, options?: SettingsWindowOptions, callbacks?: SettingsWindowCallbacks);
|
|
28
|
+
getPane(): string;
|
|
29
|
+
showPane(id: string): boolean;
|
|
30
|
+
revealSetting(id: string): boolean;
|
|
31
|
+
back(): void;
|
|
32
|
+
forward(): void;
|
|
33
|
+
focusSearch(): void;
|
|
34
|
+
search(query: string): void;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DefineComponent } from '@stacksjs/stx';
|
|
2
|
+
declare const __dtsx_component__: __DtsxStxComponentType;
|
|
3
|
+
declare const low: unknown;
|
|
4
|
+
declare const high: unknown;
|
|
5
|
+
export declare const min: unknown;
|
|
6
|
+
export declare const max: unknown;
|
|
7
|
+
export declare const step: unknown;
|
|
8
|
+
export declare const value: unknown;
|
|
9
|
+
export declare const fraction: boolean;
|
|
10
|
+
/* A count of marks, or true for one a step. */
|
|
11
|
+
declare const rawTicks: unknown;
|
|
12
|
+
export declare const ticks: boolean;
|
|
13
|
+
export declare const disabled: ReturnType<typeof $bool>;
|
|
14
|
+
export declare const label: unknown;
|
|
15
|
+
export declare const minIcon: unknown;
|
|
16
|
+
export declare const maxIcon: unknown;
|
|
17
|
+
export declare const tint: boolean;
|
|
18
|
+
export declare const name: unknown;
|
|
19
|
+
/* A CSS length. Left out, the slider is as wide as it is allowed to be. */
|
|
20
|
+
export declare const width: unknown;
|
|
21
|
+
export declare const sliderId: unknown;
|
|
22
|
+
export declare const className: unknown;
|
|
23
|
+
declare type __DtsxStxComponentType = DefineComponent<{ min?: unknown, max?: unknown, step?: unknown, value?: unknown, ticks?: unknown, disabled?: unknown, label?: string, minIcon?: string, maxIcon?: string, tint?: unknown, name?: string, width?: string, id?: string, className?: string }> & { readonly __stxEmits?: ["input", "change"] }
|
|
24
|
+
export default __dtsx_component__;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** A usable range from whatever was passed: numbers, text, the bounds the wrong way round. */
|
|
2
|
+
export declare function sliderRange(min?: unknown, max?: unknown, step?: unknown): SliderRange;
|
|
3
|
+
/** How many decimal places a number is written with: 0.25 has two. */
|
|
4
|
+
export declare function sliderDecimals(value: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* The value the slider holds for a value it was given: inside the range and
|
|
7
|
+
* on a step counted from the minimum. A maximum that is not on a step cannot
|
|
8
|
+
* be reached, as with the browser's own range input.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sliderSnap(value: unknown, range: SliderRange): number;
|
|
11
|
+
/** Where a value sits on the track, from 0 at the minimum to 1 at the maximum. */
|
|
12
|
+
export declare function sliderFraction(value: unknown, range: SliderRange): number;
|
|
13
|
+
/** The value at a place on the track, snapped. */
|
|
14
|
+
export declare function sliderValueAt(fraction: number, range: SliderRange): number;
|
|
15
|
+
/**
|
|
16
|
+
* Where the tick marks go, as fractions of the track. A number is that many
|
|
17
|
+
* marks spread evenly, ends included; `true` is one for each step. Nothing
|
|
18
|
+
* for fewer than two marks, or for more than can be told apart.
|
|
19
|
+
*/
|
|
20
|
+
export declare function sliderTicks(ticks: unknown, range: SliderRange): number[];
|
|
21
|
+
/** The value a key moves to, or null for a key the slider does not own. */
|
|
22
|
+
export declare function sliderKeyValue(key: string, value: number, range: SliderRange, page?: number): number | null;
|
|
23
|
+
/** The most tick marks worth drawing. Past this they are a smear, not marks. */
|
|
24
|
+
export declare const SLIDER_MAX_TICKS: 101;
|
|
25
|
+
/**
|
|
26
|
+
* The arithmetic of a slider: where a value sits on the track, which values
|
|
27
|
+
* a step allows, and where the tick marks go. No DOM.
|
|
28
|
+
*/
|
|
29
|
+
export declare interface SliderRange {
|
|
30
|
+
min: number
|
|
31
|
+
max: number
|
|
32
|
+
step: number
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare interface SliderProps {
|
|
2
|
+
value?: number
|
|
3
|
+
min?: number
|
|
4
|
+
max?: number
|
|
5
|
+
step?: number
|
|
6
|
+
ticks?: number | boolean
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
label?: string
|
|
9
|
+
minIcon?: string
|
|
10
|
+
maxIcon?: string
|
|
11
|
+
tint?: 'accent' | 'neutral'
|
|
12
|
+
width?: string
|
|
13
|
+
name?: string
|
|
14
|
+
id?: string
|
|
15
|
+
className?: string
|
|
16
|
+
onInput?: (value: number) => void
|
|
17
|
+
onChange?: (value: number) => void
|
|
18
|
+
}
|
|
19
|
+
export * from './core';
|
|
20
|
+
export { default as Slider } from './Slider';
|
|
@@ -22,6 +22,15 @@ export declare const disabled: ReturnType<typeof $bool>;
|
|
|
22
22
|
export declare const size: unknown;
|
|
23
23
|
export declare const className: unknown;
|
|
24
24
|
export declare const label: unknown;
|
|
25
|
+
/*
|
|
26
|
+
* `variant="mac"` draws the switch System Settings draws: a 36x20 capsule with
|
|
27
|
+
* a pill for a knob, green when on (never the accent), and 26x15 at
|
|
28
|
+
* `size="mini"`. It is the same button, the same hidden input and the same
|
|
29
|
+
* events in other clothes: the classes below are replaced by `stx-mac-switch`,
|
|
30
|
+
* which this file's <style> block draws from the `--stx-mac-*` tokens.
|
|
31
|
+
*/
|
|
32
|
+
export declare const mac: boolean;
|
|
33
|
+
export declare const macSize: boolean;
|
|
25
34
|
/**
|
|
26
35
|
* @defaultValue
|
|
27
36
|
* ```ts
|
|
@@ -71,5 +80,5 @@ export declare const trackDisabledClasses: 'opacity-50 cursor-not-allowed pointe
|
|
|
71
80
|
export declare const thumbBaseClasses: 'pointer-events-none inline-block transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out';
|
|
72
81
|
// v-model:checked adds two-way binding; keep @change for existing callers.
|
|
73
82
|
declare const isChecked: unknown;
|
|
74
|
-
declare type __DtsxStxComponentType = DefineComponent<{ checked?: unknown, name?: string, form?: string, checkedValue?: string, uncheckedValue?: string, disabled?: unknown, size?: string, className?: string, label?: string }> & { readonly __stxEmits?: ["change"], readonly __stxExposed?: { isChecked: typeof isChecked, toggle: typeof toggle } }
|
|
83
|
+
declare type __DtsxStxComponentType = DefineComponent<{ checked?: unknown, name?: string, form?: string, checkedValue?: string, uncheckedValue?: string, disabled?: unknown, size?: string, className?: string, label?: string, variant?: unknown }> & { readonly __stxEmits?: ["change"], readonly __stxExposed?: { isChecked: typeof isChecked, toggle: typeof toggle } }
|
|
75
84
|
export default __dtsx_component__;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stylesheet every Mac-styled component carries. `:where()` keeps it at
|
|
3
|
+
* no specificity, so anything an app sets wins without `!important`.
|
|
4
|
+
*/
|
|
5
|
+
export declare function macThemeCss(): string;
|
|
6
|
+
/**
|
|
7
|
+
* What a Mac control is drawn with, as CSS custom properties.
|
|
8
|
+
*
|
|
9
|
+
* The Settings window and every control with `variant="mac"` read these and
|
|
10
|
+
* nothing else, so an app re-themes all of them by setting a variable, and
|
|
11
|
+
* light and dark are the same markup under two sets of values. The numbers
|
|
12
|
+
* are System Settings' own on macOS 26 and later, measured from the window.
|
|
13
|
+
*
|
|
14
|
+
* Dark follows the `dark` class, the way the library's role tokens do, so a
|
|
15
|
+
* control never ends up dark on a page that is light.
|
|
16
|
+
*
|
|
17
|
+
* A component's `<style>` block is extracted from its source before anything
|
|
18
|
+
* is interpolated, so each component carries this CSS as literal text rather
|
|
19
|
+
* than importing it. `test/mac-theme.test.ts` holds every copy to this file.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MAC_LIGHT: Readonly<Record<string, string>>;
|
|
22
|
+
export declare const MAC_DARK: Readonly<Record<string, string>>;
|
|
23
|
+
/** Sizes and type, the same in both modes. */
|
|
24
|
+
export declare const MAC_METRICS: Readonly<Record<string, string>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.869",
|
|
5
5
|
"description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -87,6 +87,11 @@
|
|
|
87
87
|
"bun": "./dist/preview-frame/preview-frame.js",
|
|
88
88
|
"import": "./dist/preview-frame/preview-frame.js"
|
|
89
89
|
},
|
|
90
|
+
"./settings": {
|
|
91
|
+
"types": "./dist/ui/settings/settings.d.ts",
|
|
92
|
+
"bun": "./dist/settings/settings.js",
|
|
93
|
+
"import": "./dist/settings/settings.js"
|
|
94
|
+
},
|
|
90
95
|
"./split-pane": {
|
|
91
96
|
"types": "./dist/ui/split-pane/split-pane.d.ts",
|
|
92
97
|
"bun": "./dist/split-pane/split-pane.js",
|
|
@@ -124,8 +129,8 @@
|
|
|
124
129
|
"dependencies": {
|
|
125
130
|
"@iconify-json/f7": "^1.2.2",
|
|
126
131
|
"@stacksjs/ts-css": "^0.3.11",
|
|
127
|
-
"@stacksjs/stx": "0.2.
|
|
128
|
-
"bun-plugin-stx": "0.2.
|
|
132
|
+
"@stacksjs/stx": "0.2.869",
|
|
133
|
+
"bun-plugin-stx": "0.2.869",
|
|
129
134
|
"ts-syntax-highlighter": "^0.2.20",
|
|
130
135
|
"ts-video-player": "^0.1.11"
|
|
131
136
|
},
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './theme'
|
|
|
13
13
|
// Export UI components
|
|
14
14
|
export * from './ui/accordion'
|
|
15
15
|
export * from './ui/app-frame'
|
|
16
|
+
export * from './ui/appearance-picker'
|
|
16
17
|
export * from './ui/audio'
|
|
17
18
|
export * from './ui/auth'
|
|
18
19
|
export * from './ui/avatar'
|
|
@@ -30,6 +31,7 @@ export * from './ui/card'
|
|
|
30
31
|
export * from './ui/checkbox'
|
|
31
32
|
export * from './ui/choice-chips'
|
|
32
33
|
export * from './ui/code-editor'
|
|
34
|
+
export * from './ui/color-swatches'
|
|
33
35
|
export * from './ui/combobox'
|
|
34
36
|
export * from './ui/command-palette'
|
|
35
37
|
export * from './ui/context-menu'
|
|
@@ -60,8 +62,10 @@ export * from './ui/radio'
|
|
|
60
62
|
export * from './ui/radio-group'
|
|
61
63
|
export * from './ui/segmented-control'
|
|
62
64
|
export * from './ui/select'
|
|
65
|
+
export * from './ui/settings'
|
|
63
66
|
export * from './ui/sidebar'
|
|
64
67
|
export * from './ui/skeleton'
|
|
68
|
+
export * from './ui/slider'
|
|
65
69
|
export * from './ui/spinner'
|
|
66
70
|
export * from './ui/split-pane'
|
|
67
71
|
export * from './ui/stepper'
|
|
@@ -86,6 +90,8 @@ export * from './utils/highlighter'
|
|
|
86
90
|
export * from './utils/i18n'
|
|
87
91
|
export * from './utils/keep-alive'
|
|
88
92
|
export * from './utils/lazy-loading'
|
|
93
|
+
// The Mac theme the Settings window and every `variant="mac"` control are drawn with.
|
|
94
|
+
export * from './utils/mac-theme'
|
|
89
95
|
export * from './utils/prop-validation'
|
|
90
96
|
export * from './utils/syntax-theme'
|
|
91
97
|
export * from './utils/theme'
|