@bysages/solid 0.2.2 → 0.3.0
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/README.md +16 -2
- package/dist/ai-response-ClGGptX3.mjs +139 -0
- package/dist/chevron-D5RzcayK.mjs +9 -0
- package/dist/components/accordion/index.d.mts +7 -0
- package/dist/components/accordion/index.mjs +10 -0
- package/dist/components/affix/index.d.mts +20 -0
- package/dist/components/affix/index.mjs +33 -0
- package/dist/components/ai/index.d.mts +2 -0
- package/dist/components/ai/index.mjs +71 -0
- package/dist/components/ai-action/index.d.mts +13 -0
- package/dist/components/ai-action/index.mjs +27 -0
- package/dist/components/ai-attachments/index.d.mts +20 -0
- package/dist/components/ai-attachments/index.mjs +110 -0
- package/dist/components/ai-message/index.d.mts +13 -0
- package/dist/components/ai-message/index.mjs +22 -0
- package/dist/components/ai-prompt-input/index.d.mts +45 -0
- package/dist/components/ai-prompt-input/index.mjs +153 -0
- package/dist/components/ai-reasoning/index.d.mts +13 -0
- package/dist/components/ai-reasoning/index.mjs +38 -0
- package/dist/components/ai-response/index.d.mts +20 -0
- package/dist/components/ai-response/index.mjs +2 -0
- package/dist/components/ai-source/index.d.mts +13 -0
- package/dist/components/ai-source/index.mjs +36 -0
- package/dist/components/ai-suggestion/index.d.mts +13 -0
- package/dist/components/ai-suggestion/index.mjs +22 -0
- package/dist/components/ai-tool/index.d.mts +23 -0
- package/dist/components/ai-tool/index.mjs +90 -0
- package/dist/components/alert/index.d.mts +22 -0
- package/dist/components/alert/index.mjs +87 -0
- package/dist/components/angle-slider/index.d.mts +15 -0
- package/dist/components/angle-slider/index.mjs +18 -0
- package/dist/components/aspect-ratio/index.d.mts +10 -0
- package/dist/components/aspect-ratio/index.mjs +23 -0
- package/dist/components/autocomplete/index.d.mts +21 -0
- package/dist/components/autocomplete/index.mjs +76 -0
- package/dist/components/avatar/index.d.mts +23 -0
- package/dist/components/avatar/index.mjs +20 -0
- package/dist/components/avatar-group/index.d.mts +11 -0
- package/dist/components/avatar-group/index.mjs +20 -0
- package/dist/components/back-top/index.d.mts +29 -0
- package/dist/components/back-top/index.mjs +93 -0
- package/dist/components/badge/index.d.mts +10 -0
- package/dist/components/badge/index.mjs +23 -0
- package/dist/components/banner/index.d.mts +24 -0
- package/dist/components/banner/index.mjs +67 -0
- package/dist/components/bento/index.d.mts +24 -0
- package/dist/components/bento/index.mjs +51 -0
- package/dist/components/block-ui/index.d.mts +12 -0
- package/dist/components/block-ui/index.mjs +43 -0
- package/dist/components/breadcrumb/index.d.mts +11 -0
- package/dist/components/breadcrumb/index.mjs +45 -0
- package/dist/components/browser/index.d.mts +21 -0
- package/dist/components/browser/index.mjs +87 -0
- package/dist/components/button/index.d.mts +15 -0
- package/dist/components/button/index.mjs +43 -0
- package/dist/components/button-group/index.d.mts +23 -0
- package/dist/components/button-group/index.mjs +38 -0
- package/dist/components/calendar/index.d.mts +17 -0
- package/dist/components/calendar/index.mjs +209 -0
- package/dist/components/card/index.d.mts +11 -0
- package/dist/components/card/index.mjs +33 -0
- package/dist/components/carousel/index.d.mts +9 -0
- package/dist/components/carousel/index.mjs +12 -0
- package/dist/components/cascade-select/index.d.mts +31 -0
- package/dist/components/cascade-select/index.mjs +304 -0
- package/dist/components/checkbox/index.d.mts +15 -0
- package/dist/components/checkbox/index.mjs +18 -0
- package/dist/components/checkbox-group/index.d.mts +28 -0
- package/dist/components/checkbox-group/index.mjs +97 -0
- package/dist/components/chip/index.d.mts +12 -0
- package/dist/components/chip/index.mjs +36 -0
- package/dist/components/client-only/index.d.mts +2 -0
- package/dist/components/client-only/index.mjs +2 -0
- package/dist/components/clipboard/index.d.mts +16 -0
- package/dist/components/clipboard/index.mjs +19 -0
- package/dist/components/collapsible/index.d.mts +7 -0
- package/dist/components/collapsible/index.mjs +10 -0
- package/dist/components/collection/index.d.mts +2 -0
- package/dist/components/collection/index.mjs +2 -0
- package/dist/components/color-picker/index.d.mts +19 -0
- package/dist/components/color-picker/index.mjs +18 -0
- package/dist/components/combobox/index.d.mts +17 -0
- package/dist/components/combobox/index.mjs +18 -0
- package/dist/components/command/index.d.mts +43 -0
- package/dist/components/command/index.mjs +253 -0
- package/dist/components/comment/index.d.mts +17 -0
- package/dist/components/comment/index.mjs +101 -0
- package/dist/components/config-provider/index.d.mts +48 -0
- package/dist/components/config-provider/index.mjs +67 -0
- package/dist/components/container/index.d.mts +13 -0
- package/dist/components/container/index.mjs +23 -0
- package/dist/components/data-view/index.d.mts +18 -0
- package/dist/components/data-view/index.mjs +110 -0
- package/dist/components/date-input/index.d.mts +15 -0
- package/dist/components/date-input/index.mjs +18 -0
- package/dist/components/date-picker/index.d.mts +17 -0
- package/dist/components/date-picker/index.mjs +18 -0
- package/dist/components/deferred-content/index.d.mts +16 -0
- package/dist/components/deferred-content/index.mjs +52 -0
- package/dist/components/descriptions/index.d.mts +26 -0
- package/dist/components/descriptions/index.mjs +69 -0
- package/dist/components/dialog/index.d.mts +9 -0
- package/dist/components/dialog/index.mjs +11 -0
- package/dist/components/dock/index.d.mts +22 -0
- package/dist/components/dock/index.mjs +64 -0
- package/dist/components/download-trigger/index.d.mts +2 -0
- package/dist/components/download-trigger/index.mjs +2 -0
- package/dist/components/drawer/index.d.mts +9 -0
- package/dist/components/drawer/index.mjs +12 -0
- package/dist/components/dynamic-input/index.d.mts +30 -0
- package/dist/components/dynamic-input/index.mjs +119 -0
- package/dist/components/editable/index.d.mts +15 -0
- package/dist/components/editable/index.mjs +18 -0
- package/dist/components/ellipsis/index.d.mts +10 -0
- package/dist/components/ellipsis/index.mjs +27 -0
- package/dist/components/empty/index.d.mts +10 -0
- package/dist/components/empty/index.mjs +31 -0
- package/dist/components/field/index.d.mts +8 -0
- package/dist/components/field/index.mjs +11 -0
- package/dist/components/fieldset/index.d.mts +7 -0
- package/dist/components/fieldset/index.mjs +10 -0
- package/dist/components/file-upload/index.d.mts +17 -0
- package/dist/components/file-upload/index.mjs +18 -0
- package/dist/components/float-button/index.d.mts +61 -0
- package/dist/components/float-button/index.mjs +129 -0
- package/dist/components/floating-panel/index.d.mts +9 -0
- package/dist/components/floating-panel/index.mjs +12 -0
- package/dist/components/focus-trap/index.d.mts +2 -0
- package/dist/components/focus-trap/index.mjs +2 -0
- package/dist/components/form/index.d.mts +2 -0
- package/dist/components/form/index.mjs +125 -0
- package/dist/components/format/index.d.mts +9 -0
- package/dist/components/format/index.mjs +10 -0
- package/dist/components/frame/index.d.mts +10 -0
- package/dist/components/frame/index.mjs +12 -0
- package/dist/components/grid/index.d.mts +13 -0
- package/dist/components/grid/index.mjs +42 -0
- package/dist/components/highlight/index.d.mts +7 -0
- package/dist/components/highlight/index.mjs +11 -0
- package/dist/components/hover-card/index.d.mts +7 -0
- package/dist/components/hover-card/index.mjs +10 -0
- package/dist/components/icon/index.d.mts +24 -0
- package/dist/components/icon/index.mjs +54 -0
- package/dist/components/image/index.d.mts +17 -0
- package/dist/components/image/index.mjs +70 -0
- package/dist/components/image-cropper/index.d.mts +8 -0
- package/dist/components/image-cropper/index.mjs +11 -0
- package/dist/components/image-viewer/index.d.mts +19 -0
- package/dist/components/image-viewer/index.mjs +152 -0
- package/dist/components/input/index.d.mts +19 -0
- package/dist/components/input/index.mjs +2 -0
- package/dist/components/input-group/index.d.mts +18 -0
- package/dist/components/input-group/index.mjs +36 -0
- package/dist/components/json-tree-view/index.d.mts +7 -0
- package/dist/components/json-tree-view/index.mjs +10 -0
- package/dist/components/kbd/index.d.mts +6 -0
- package/dist/components/kbd/index.mjs +15 -0
- package/dist/components/layout/index.d.mts +60 -0
- package/dist/components/layout/index.mjs +192 -0
- package/dist/components/link/index.d.mts +10 -0
- package/dist/components/link/index.mjs +24 -0
- package/dist/components/list/index.d.mts +26 -0
- package/dist/components/list/index.mjs +97 -0
- package/dist/components/listbox/index.d.mts +17 -0
- package/dist/components/listbox/index.mjs +19 -0
- package/dist/components/marquee/index.d.mts +7 -0
- package/dist/components/marquee/index.mjs +10 -0
- package/dist/components/masonry/index.d.mts +11 -0
- package/dist/components/masonry/index.mjs +34 -0
- package/dist/components/mentions/index.d.mts +2 -0
- package/dist/components/mentions/index.mjs +3 -0
- package/dist/components/menu/index.d.mts +13 -0
- package/dist/components/menu/index.mjs +38 -0
- package/dist/components/menubar/index.d.mts +32 -0
- package/dist/components/menubar/index.mjs +83 -0
- package/dist/components/meter/index.d.mts +21 -0
- package/dist/components/meter/index.mjs +95 -0
- package/dist/components/navigation-menu/index.d.mts +8 -0
- package/dist/components/navigation-menu/index.mjs +11 -0
- package/dist/components/number-input/index.d.mts +15 -0
- package/dist/components/number-input/index.mjs +18 -0
- package/dist/components/order-list/index.d.mts +21 -0
- package/dist/components/order-list/index.mjs +160 -0
- package/dist/components/page-header/index.d.mts +11 -0
- package/dist/components/page-header/index.mjs +34 -0
- package/dist/components/pagination/index.d.mts +17 -0
- package/dist/components/pagination/index.mjs +18 -0
- package/dist/components/password-input/index.d.mts +15 -0
- package/dist/components/password-input/index.mjs +18 -0
- package/dist/components/pin-input/index.d.mts +14 -0
- package/dist/components/pin-input/index.mjs +18 -0
- package/dist/components/popconfirm/index.d.mts +17 -0
- package/dist/components/popconfirm/index.mjs +85 -0
- package/dist/components/popover/index.d.mts +8 -0
- package/dist/components/popover/index.mjs +11 -0
- package/dist/components/presence/index.d.mts +2 -0
- package/dist/components/presence/index.mjs +2 -0
- package/dist/components/progress/index.d.mts +15 -0
- package/dist/components/progress/index.mjs +18 -0
- package/dist/components/progress-group/index.d.mts +22 -0
- package/dist/components/progress-group/index.mjs +84 -0
- package/dist/components/qr-code/index.d.mts +8 -0
- package/dist/components/qr-code/index.mjs +11 -0
- package/dist/components/radio-group/index.d.mts +15 -0
- package/dist/components/radio-group/index.mjs +18 -0
- package/dist/components/rating-group/index.d.mts +15 -0
- package/dist/components/rating-group/index.mjs +18 -0
- package/dist/components/result/index.d.mts +22 -0
- package/dist/components/result/index.mjs +66 -0
- package/dist/components/scroll-area/index.d.mts +7 -0
- package/dist/components/scroll-area/index.mjs +10 -0
- package/dist/components/segment-group/index.d.mts +17 -0
- package/dist/components/segment-group/index.mjs +23 -0
- package/dist/components/select/index.d.mts +2 -0
- package/dist/components/select/index.mjs +2 -0
- package/dist/components/separator/index.d.mts +11 -0
- package/dist/components/separator/index.mjs +27 -0
- package/dist/components/signature-pad/index.d.mts +8 -0
- package/dist/components/signature-pad/index.mjs +11 -0
- package/dist/components/skeleton/index.d.mts +7 -0
- package/dist/components/skeleton/index.mjs +15 -0
- package/dist/components/slider/index.d.mts +15 -0
- package/dist/components/slider/index.mjs +18 -0
- package/dist/components/spinner/index.d.mts +9 -0
- package/dist/components/spinner/index.mjs +26 -0
- package/dist/components/split-button/index.d.mts +36 -0
- package/dist/components/split-button/index.mjs +124 -0
- package/dist/components/splitter/index.d.mts +7 -0
- package/dist/components/splitter/index.mjs +10 -0
- package/dist/components/spotlight/index.d.mts +11 -0
- package/dist/components/spotlight/index.mjs +38 -0
- package/dist/components/stack/index.d.mts +11 -0
- package/dist/components/stack/index.mjs +45 -0
- package/dist/components/stat/index.d.mts +17 -0
- package/dist/components/stat/index.mjs +44 -0
- package/dist/components/steps/index.d.mts +18 -0
- package/dist/components/steps/index.mjs +18 -0
- package/dist/components/swap/index.d.mts +8 -0
- package/dist/components/swap/index.mjs +11 -0
- package/dist/components/switch/index.d.mts +15 -0
- package/dist/components/switch/index.mjs +18 -0
- package/dist/components/table/index.d.mts +77 -0
- package/dist/components/table/index.mjs +837 -0
- package/dist/components/tabs/index.d.mts +19 -0
- package/dist/components/tabs/index.mjs +23 -0
- package/dist/components/tags-input/index.d.mts +16 -0
- package/dist/components/tags-input/index.mjs +18 -0
- package/dist/components/terminal/index.d.mts +17 -0
- package/dist/components/terminal/index.mjs +84 -0
- package/dist/components/textarea/index.d.mts +14 -0
- package/dist/components/textarea/index.mjs +37 -0
- package/dist/components/timeline/index.d.mts +15 -0
- package/dist/components/timeline/index.mjs +44 -0
- package/dist/components/timer/index.d.mts +8 -0
- package/dist/components/timer/index.mjs +11 -0
- package/dist/components/toast/index.d.mts +11 -0
- package/dist/components/toast/index.mjs +13 -0
- package/dist/components/toc/index.d.mts +7 -0
- package/dist/components/toc/index.mjs +10 -0
- package/dist/components/toggle/index.d.mts +7 -0
- package/dist/components/toggle/index.mjs +10 -0
- package/dist/components/toggle-group/index.d.mts +14 -0
- package/dist/components/toggle-group/index.mjs +18 -0
- package/dist/components/toolbar/index.d.mts +17 -0
- package/dist/components/toolbar/index.mjs +46 -0
- package/dist/components/tooltip/index.d.mts +7 -0
- package/dist/components/tooltip/index.mjs +10 -0
- package/dist/components/tour/index.d.mts +11 -0
- package/dist/components/tour/index.mjs +13 -0
- package/dist/components/transfer/index.d.mts +24 -0
- package/dist/components/transfer/index.mjs +175 -0
- package/dist/components/tree-select/index.d.mts +28 -0
- package/dist/components/tree-select/index.mjs +253 -0
- package/dist/components/tree-view/index.d.mts +18 -0
- package/dist/components/tree-view/index.mjs +19 -0
- package/dist/components/typography/index.d.mts +11 -0
- package/dist/components/typography/index.mjs +34 -0
- package/dist/components/user/index.d.mts +19 -0
- package/dist/components/user/index.mjs +68 -0
- package/dist/components/virtual-list/index.d.mts +17 -0
- package/dist/components/virtual-list/index.mjs +71 -0
- package/dist/components/watermark/index.d.mts +17 -0
- package/dist/components/watermark/index.mjs +77 -0
- package/dist/index-B1xiJ5ki.d.mts +1811 -0
- package/dist/index-DDX7x8aT.d.mts +95 -0
- package/dist/index-IfofF-SW.d.mts +10356 -0
- package/dist/index-YPUiqD3n.d.mts +42 -0
- package/dist/index.d.mts +141 -15209
- package/dist/index.mjs +141 -6171
- package/dist/input-DoFQ7RXh.mjs +78 -0
- package/dist/mentions-f5Js_2W7.mjs +263 -0
- package/dist/select-CHaXbzLX.mjs +115 -0
- package/package.json +101 -7
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/components/command/index.d.ts
|
|
2
|
+
export interface CommandEntry {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
/** Entries sharing a group are listed under one heading. */
|
|
6
|
+
group?: string;
|
|
7
|
+
/** A short affordance note, set as a keycap at the row's end. */
|
|
8
|
+
hint?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CommandProps {
|
|
11
|
+
/** The commands on offer, grouped as they arrive. */
|
|
12
|
+
items?: CommandEntry[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Whether the palette is up. Supply it to control the palette;
|
|
15
|
+
* changes are reported through `onOpenChange`. */
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/** Whether the shell narrows `items` as the reader types. Turn it off
|
|
18
|
+
* when the caller owns the searching — a ranked engine or a remote
|
|
19
|
+
* source — and hands down the already-narrowed list. */
|
|
20
|
+
autoFilter?: boolean;
|
|
21
|
+
/** The field's text under the caller's control; changes are reported
|
|
22
|
+
* through `onInputValueChange`. */
|
|
23
|
+
inputValue?: string;
|
|
24
|
+
/** What the list whispers when nothing matches. */
|
|
25
|
+
emptyText?: string;
|
|
26
|
+
/** Called with the chosen entry's `value`; the palette closes after. */
|
|
27
|
+
onSelect?: (value: string) => void;
|
|
28
|
+
/** The palette's openness changed. */
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/** The field's text changed. */
|
|
31
|
+
onInputValueChange?: (value: string) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The command palette: a modal sheet at the top of the page carrying a
|
|
35
|
+
* search field over the caller's commands, grouped as a ledger with a
|
|
36
|
+
* keycap hint at each row. The shell is the dialog machinery — scrim,
|
|
37
|
+
* focus trap, Escape — and the searching is the combobox machinery
|
|
38
|
+
* driving our own list: the vessel and the list live inside the sheet,
|
|
39
|
+
* so the combobox renders no separate popup and the machine's content
|
|
40
|
+
* grafts onto the sheet's list.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Command(props: CommandProps): import("solid-js").JSX.Element;
|
|
43
|
+
//#endregion
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { createComponent, insert, mergeProps, spread, template } from "@solidjs/web";
|
|
3
|
+
import { For, Show, createEffect, createSignal, splitProps } from "solid-js";
|
|
4
|
+
import { useListCollection } from "@ark-ui/solid/collection";
|
|
5
|
+
import { Combobox } from "@ark-ui/solid/combobox";
|
|
6
|
+
import { Portal } from "solid-js/web";
|
|
7
|
+
import { Dialog } from "@ark-ui/solid/dialog";
|
|
8
|
+
//#region src/components/command/index.tsx
|
|
9
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span data-scope=command data-part=item-hint>`);
|
|
10
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><!><!>`);
|
|
11
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span>`);
|
|
12
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
|
|
13
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<input>`);
|
|
14
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<div data-scope=command data-part=empty>`);
|
|
15
|
+
/** A command row: the machine's item grafted onto a vessel of our own,
|
|
16
|
+
* the label riding the machine's item text. */
|
|
17
|
+
function Row(props) {
|
|
18
|
+
return createComponent(Combobox.Item, {
|
|
19
|
+
get item() {
|
|
20
|
+
return props.entry.value;
|
|
21
|
+
},
|
|
22
|
+
asChild: (itemProps) => (() => {
|
|
23
|
+
var _el$ = _tmpl$2();
|
|
24
|
+
var _el$2 = _el$.firstChild;
|
|
25
|
+
var _el$4 = _el$2.nextSibling;
|
|
26
|
+
spread(_el$, [itemProps, {
|
|
27
|
+
"data-scope": "command",
|
|
28
|
+
"data-part": "item"
|
|
29
|
+
}], true);
|
|
30
|
+
insert(_el$, createComponent(Combobox.ItemText, { asChild: (textProps) => (() => {
|
|
31
|
+
var _el$5 = _tmpl$3();
|
|
32
|
+
spread(_el$5, [textProps, {
|
|
33
|
+
"data-scope": "command",
|
|
34
|
+
"data-part": "item-label"
|
|
35
|
+
}], true);
|
|
36
|
+
insert(_el$5, () => {
|
|
37
|
+
return props.entry.label;
|
|
38
|
+
});
|
|
39
|
+
return _el$5;
|
|
40
|
+
})() }), _el$2);
|
|
41
|
+
insert(_el$, createComponent(Show, {
|
|
42
|
+
get when() {
|
|
43
|
+
return props.entry.hint;
|
|
44
|
+
},
|
|
45
|
+
get children() {
|
|
46
|
+
var _el$3 = _tmpl$();
|
|
47
|
+
insert(_el$3, () => {
|
|
48
|
+
return props.entry.hint;
|
|
49
|
+
});
|
|
50
|
+
return _el$3;
|
|
51
|
+
}
|
|
52
|
+
}), _el$4);
|
|
53
|
+
return _el$;
|
|
54
|
+
})()
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The command palette: a modal sheet at the top of the page carrying a
|
|
59
|
+
* search field over the caller's commands, grouped as a ledger with a
|
|
60
|
+
* keycap hint at each row. The shell is the dialog machinery — scrim,
|
|
61
|
+
* focus trap, Escape — and the searching is the combobox machinery
|
|
62
|
+
* driving our own list: the vessel and the list live inside the sheet,
|
|
63
|
+
* so the combobox renders no separate popup and the machine's content
|
|
64
|
+
* grafts onto the sheet's list.
|
|
65
|
+
*/
|
|
66
|
+
function Command(props) {
|
|
67
|
+
injectComponentStyle("command");
|
|
68
|
+
injectComponentStyle("dialog");
|
|
69
|
+
const [own, rest] = splitProps(props, [
|
|
70
|
+
"items",
|
|
71
|
+
"placeholder",
|
|
72
|
+
"open",
|
|
73
|
+
"autoFilter",
|
|
74
|
+
"inputValue",
|
|
75
|
+
"emptyText",
|
|
76
|
+
"onSelect",
|
|
77
|
+
"onOpenChange",
|
|
78
|
+
"onInputValueChange"
|
|
79
|
+
]);
|
|
80
|
+
const [internalOpen, setInternalOpen] = createSignal(false);
|
|
81
|
+
const [listOpen, setListOpen] = createSignal(true);
|
|
82
|
+
let fieldText = "";
|
|
83
|
+
const { collection, set, filter } = useListCollection({
|
|
84
|
+
initialItems: (own.items ?? []).map((entry) => entry.value),
|
|
85
|
+
filter: (value, input) => {
|
|
86
|
+
const entry = (own.items ?? []).find((candidate) => candidate.value === value);
|
|
87
|
+
if (!entry) return false;
|
|
88
|
+
const query = input.toLowerCase();
|
|
89
|
+
return entry.label.toLowerCase().includes(query) || value.toLowerCase().includes(query);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
createEffect(() => {
|
|
93
|
+
set((own.items ?? []).map((entry) => entry.value));
|
|
94
|
+
if (own.autoFilter ?? true) filter(fieldText);
|
|
95
|
+
});
|
|
96
|
+
const open = () => own.open ?? internalOpen();
|
|
97
|
+
const setOpen = (value) => {
|
|
98
|
+
if (own.open === void 0) setInternalOpen(value);
|
|
99
|
+
own.onOpenChange?.(value);
|
|
100
|
+
};
|
|
101
|
+
createEffect(() => {
|
|
102
|
+
if (open()) setListOpen(true);
|
|
103
|
+
});
|
|
104
|
+
const sections = () => {
|
|
105
|
+
const available = new Set(collection().items);
|
|
106
|
+
const groups = /* @__PURE__ */ new Map();
|
|
107
|
+
for (const entry of own.items ?? []) {
|
|
108
|
+
if (!available.has(entry.value)) continue;
|
|
109
|
+
const key = entry.group ?? "";
|
|
110
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
111
|
+
groups.get(key).push(entry);
|
|
112
|
+
}
|
|
113
|
+
return Array.from(groups, ([group, entries]) => ({
|
|
114
|
+
group,
|
|
115
|
+
entries
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
118
|
+
return createComponent(Dialog.Root, mergeProps(rest, {
|
|
119
|
+
get open() {
|
|
120
|
+
return open();
|
|
121
|
+
},
|
|
122
|
+
onOpenChange: (details) => setOpen(details.open),
|
|
123
|
+
get children() {
|
|
124
|
+
return createComponent(Portal, { get children() {
|
|
125
|
+
return [createComponent(Dialog.Backdrop, {}), createComponent(Dialog.Positioner, { asChild: (positionerProps) => (() => {
|
|
126
|
+
var _el$6 = _tmpl$4();
|
|
127
|
+
spread(_el$6, [positionerProps, {
|
|
128
|
+
"data-scope": "command",
|
|
129
|
+
"data-part": "positioner"
|
|
130
|
+
}], true);
|
|
131
|
+
insert(_el$6, createComponent(Dialog.Content, { asChild: (contentProps) => (() => {
|
|
132
|
+
var _el$7 = _tmpl$4();
|
|
133
|
+
spread(_el$7, [contentProps, {
|
|
134
|
+
"data-scope": "command",
|
|
135
|
+
"data-part": "content"
|
|
136
|
+
}], true);
|
|
137
|
+
insert(_el$7, createComponent(Combobox.Root, {
|
|
138
|
+
get collection() {
|
|
139
|
+
return collection();
|
|
140
|
+
},
|
|
141
|
+
get inputValue() {
|
|
142
|
+
return own.inputValue;
|
|
143
|
+
},
|
|
144
|
+
get open() {
|
|
145
|
+
return listOpen();
|
|
146
|
+
},
|
|
147
|
+
onOpenChange: (details) => setListOpen(details.open),
|
|
148
|
+
inputBehavior: "autohighlight",
|
|
149
|
+
loopFocus: true,
|
|
150
|
+
onInputValueChange: (details) => {
|
|
151
|
+
fieldText = details.inputValue;
|
|
152
|
+
if (own.autoFilter ?? true) filter(details.inputValue);
|
|
153
|
+
own.onInputValueChange?.(details.inputValue);
|
|
154
|
+
},
|
|
155
|
+
onValueChange: (details) => {
|
|
156
|
+
const [first] = details.value;
|
|
157
|
+
if (first == null) return;
|
|
158
|
+
own.onSelect?.(first);
|
|
159
|
+
setOpen(false);
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return [createComponent(Combobox.Input, { asChild: (inputProps) => (() => {
|
|
163
|
+
var _el$8 = _tmpl$5();
|
|
164
|
+
spread(_el$8, [inputProps, {
|
|
165
|
+
type: "text",
|
|
166
|
+
get placeholder() {
|
|
167
|
+
return own.placeholder;
|
|
168
|
+
},
|
|
169
|
+
"data-scope": "command",
|
|
170
|
+
"data-part": "input"
|
|
171
|
+
}], false);
|
|
172
|
+
return _el$8;
|
|
173
|
+
})() }), createComponent(Combobox.Content, { asChild: (listProps) => (() => {
|
|
174
|
+
var _el$9 = _tmpl$2();
|
|
175
|
+
var _el$10 = _el$9.firstChild;
|
|
176
|
+
var _el$12 = _el$10.nextSibling;
|
|
177
|
+
spread(_el$9, [listProps, {
|
|
178
|
+
"data-scope": "command",
|
|
179
|
+
"data-part": "list"
|
|
180
|
+
}], true);
|
|
181
|
+
insert(_el$9, createComponent(For, {
|
|
182
|
+
get each() {
|
|
183
|
+
return sections();
|
|
184
|
+
},
|
|
185
|
+
children: (section) => createComponent(Show, {
|
|
186
|
+
get when() {
|
|
187
|
+
return section.group !== "";
|
|
188
|
+
},
|
|
189
|
+
get fallback() {
|
|
190
|
+
return createComponent(For, {
|
|
191
|
+
get each() {
|
|
192
|
+
return section.entries;
|
|
193
|
+
},
|
|
194
|
+
children: (entry) => createComponent(Row, { entry })
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
get children() {
|
|
198
|
+
return createComponent(Combobox.ItemGroup, { asChild: (groupProps) => (() => {
|
|
199
|
+
var _el$13 = _tmpl$2();
|
|
200
|
+
var _el$14 = _el$13.firstChild;
|
|
201
|
+
var _el$15 = _el$14.nextSibling;
|
|
202
|
+
spread(_el$13, [groupProps, {
|
|
203
|
+
"data-scope": "command",
|
|
204
|
+
"data-part": "group"
|
|
205
|
+
}], true);
|
|
206
|
+
insert(_el$13, createComponent(Combobox.ItemGroupLabel, { asChild: (labelProps) => (() => {
|
|
207
|
+
var _el$16 = _tmpl$4();
|
|
208
|
+
spread(_el$16, [labelProps, {
|
|
209
|
+
"data-scope": "command",
|
|
210
|
+
"data-part": "group-label"
|
|
211
|
+
}], true);
|
|
212
|
+
insert(_el$16, () => {
|
|
213
|
+
return section.group;
|
|
214
|
+
});
|
|
215
|
+
return _el$16;
|
|
216
|
+
})() }), _el$14);
|
|
217
|
+
insert(_el$13, createComponent(For, {
|
|
218
|
+
get each() {
|
|
219
|
+
return section.entries;
|
|
220
|
+
},
|
|
221
|
+
children: (entry) => createComponent(Row, { entry })
|
|
222
|
+
}), _el$15);
|
|
223
|
+
return _el$13;
|
|
224
|
+
})() });
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
}), _el$10);
|
|
228
|
+
insert(_el$9, createComponent(Show, {
|
|
229
|
+
get when() {
|
|
230
|
+
return sections().length === 0;
|
|
231
|
+
},
|
|
232
|
+
get children() {
|
|
233
|
+
var _el$11 = _tmpl$6();
|
|
234
|
+
insert(_el$11, () => {
|
|
235
|
+
return own.emptyText ?? "No matching commands";
|
|
236
|
+
});
|
|
237
|
+
return _el$11;
|
|
238
|
+
}
|
|
239
|
+
}), _el$12);
|
|
240
|
+
return _el$9;
|
|
241
|
+
})() })];
|
|
242
|
+
}
|
|
243
|
+
}));
|
|
244
|
+
return _el$7;
|
|
245
|
+
})() }));
|
|
246
|
+
return _el$6;
|
|
247
|
+
})() })];
|
|
248
|
+
} });
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { Command };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
//#region src/components/comment/index.d.ts
|
|
3
|
+
export interface CommentProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
4
|
+
author?: string;
|
|
5
|
+
datetime?: string;
|
|
6
|
+
/** The portrait hanging to the left of the body. */
|
|
7
|
+
avatar?: JSX.Element;
|
|
8
|
+
/** The row of answers beneath the ink. */
|
|
9
|
+
actions?: JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A voice on the record: the portrait hangs left (the `avatar` prop),
|
|
13
|
+
* the body carries the byline from `author` and `datetime`, the ink is
|
|
14
|
+
* the children, and `actions` is the row of answers.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Comment(props: CommentProps): JSX.Element;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { createComponent, effect, insert, setAttribute, spread, template } from "@solidjs/web";
|
|
3
|
+
import { Show, splitProps } from "solid-js";
|
|
4
|
+
//#region src/components/comment/index.tsx
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div data-scope=comment data-part=avatar>`);
|
|
6
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<span data-scope=comment data-part=author>`);
|
|
7
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<time data-scope=comment data-part=datetime>`);
|
|
8
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<header data-scope=comment data-part=header><!><!>`);
|
|
9
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<div data-scope=comment data-part=actions>`);
|
|
10
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<article><div data-scope=comment data-part=body><div data-scope=comment data-part=content></div><!>`);
|
|
11
|
+
/**
|
|
12
|
+
* A voice on the record: the portrait hangs left (the `avatar` prop),
|
|
13
|
+
* the body carries the byline from `author` and `datetime`, the ink is
|
|
14
|
+
* the children, and `actions` is the row of answers.
|
|
15
|
+
*/
|
|
16
|
+
function Comment(props) {
|
|
17
|
+
injectComponentStyle("comment");
|
|
18
|
+
const [own, rest] = splitProps(props, [
|
|
19
|
+
"author",
|
|
20
|
+
"datetime",
|
|
21
|
+
"avatar",
|
|
22
|
+
"actions",
|
|
23
|
+
"children"
|
|
24
|
+
]);
|
|
25
|
+
var _el$ = _tmpl$6();
|
|
26
|
+
var _el$3 = _el$.firstChild;
|
|
27
|
+
var _el$9 = _el$3.firstChild;
|
|
28
|
+
var _el$11 = _el$9.nextSibling;
|
|
29
|
+
spread(_el$, [rest, {
|
|
30
|
+
"data-scope": "comment",
|
|
31
|
+
"data-part": "root"
|
|
32
|
+
}], true);
|
|
33
|
+
insert(_el$, createComponent(Show, {
|
|
34
|
+
get when() {
|
|
35
|
+
return own.avatar;
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
var _el$2 = _tmpl$();
|
|
39
|
+
insert(_el$2, () => {
|
|
40
|
+
return own.avatar;
|
|
41
|
+
});
|
|
42
|
+
return _el$2;
|
|
43
|
+
}
|
|
44
|
+
}), _el$3);
|
|
45
|
+
insert(_el$3, createComponent(Show, {
|
|
46
|
+
get when() {
|
|
47
|
+
return own.author || own.datetime;
|
|
48
|
+
},
|
|
49
|
+
get children() {
|
|
50
|
+
var _el$4 = _tmpl$4();
|
|
51
|
+
var _el$6 = _el$4.firstChild;
|
|
52
|
+
var _el$8 = _el$6.nextSibling;
|
|
53
|
+
insert(_el$4, createComponent(Show, {
|
|
54
|
+
get when() {
|
|
55
|
+
return own.author;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
var _el$5 = _tmpl$2();
|
|
59
|
+
insert(_el$5, () => {
|
|
60
|
+
return own.author;
|
|
61
|
+
});
|
|
62
|
+
return _el$5;
|
|
63
|
+
}
|
|
64
|
+
}), _el$6);
|
|
65
|
+
insert(_el$4, createComponent(Show, {
|
|
66
|
+
get when() {
|
|
67
|
+
return own.datetime;
|
|
68
|
+
},
|
|
69
|
+
get children() {
|
|
70
|
+
var _el$7 = _tmpl$3();
|
|
71
|
+
insert(_el$7, () => {
|
|
72
|
+
return own.datetime;
|
|
73
|
+
});
|
|
74
|
+
effect(() => own.datetime, (_v$) => {
|
|
75
|
+
setAttribute(_el$7, "datetime", _v$);
|
|
76
|
+
});
|
|
77
|
+
return _el$7;
|
|
78
|
+
}
|
|
79
|
+
}), _el$8);
|
|
80
|
+
return _el$4;
|
|
81
|
+
}
|
|
82
|
+
}), _el$9);
|
|
83
|
+
insert(_el$9, () => {
|
|
84
|
+
return own.children;
|
|
85
|
+
});
|
|
86
|
+
insert(_el$3, createComponent(Show, {
|
|
87
|
+
get when() {
|
|
88
|
+
return own.actions;
|
|
89
|
+
},
|
|
90
|
+
get children() {
|
|
91
|
+
var _el$10 = _tmpl$5();
|
|
92
|
+
insert(_el$10, () => {
|
|
93
|
+
return own.actions;
|
|
94
|
+
});
|
|
95
|
+
return _el$10;
|
|
96
|
+
}
|
|
97
|
+
}), _el$11);
|
|
98
|
+
return _el$;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { Comment };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ThemeScene } from "@bysages/core";
|
|
2
|
+
import { JSX } from "solid-js";
|
|
3
|
+
//#region src/components/config-provider/index.d.ts
|
|
4
|
+
/** The four density tiers the token layer's `[data-density]` selectors
|
|
5
|
+
* name — whitespace and control heights compress, readability never
|
|
6
|
+
* does. */
|
|
7
|
+
export type ConfigDensity = "compact" | "default" | "comfortable" | "spacious";
|
|
8
|
+
/** The named scene registers the token layer's `[data-scene]` selectors
|
|
9
|
+
* retune — "auto" is the engine's own resolution and stays off the
|
|
10
|
+
* subtree vocabulary. */
|
|
11
|
+
export type ConfigScene = Exclude<ThemeScene, "auto">;
|
|
12
|
+
/** The configuration a provider lays over its subtree. Every field is
|
|
13
|
+
* optional: an absent field changes nothing, and the page's own
|
|
14
|
+
* attributes keep ruling. */
|
|
15
|
+
export interface ConfigContext {
|
|
16
|
+
density?: ConfigDensity;
|
|
17
|
+
scene?: ConfigScene;
|
|
18
|
+
/** A mineral pigment theme (qinghua, celadon, zhusha, …) landing as
|
|
19
|
+
* `[data-accent]` on the host element. */
|
|
20
|
+
accent?: string;
|
|
21
|
+
/** Writing direction, landing as the native `dir` attribute. */
|
|
22
|
+
dir?: "ltr" | "rtl";
|
|
23
|
+
/** BCP-47 locale, landing as the native `lang` attribute. */
|
|
24
|
+
locale?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Solid context for the provider's snapshot — a custom part reads it
|
|
27
|
+
* with `useContext(ConfigContextKey)`. */
|
|
28
|
+
export declare const ConfigContextKey: import("solid-js").Context<() => ConfigContext>;
|
|
29
|
+
/** The nearest provider's snapshot, or an empty one when no provider
|
|
30
|
+
* wraps the caller — the hook the date and format families will consume
|
|
31
|
+
* to localize their output. */
|
|
32
|
+
export declare function useConfig(): () => ConfigContext;
|
|
33
|
+
export interface ConfigProviderProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
density?: ConfigDensity;
|
|
35
|
+
scene?: ConfigScene;
|
|
36
|
+
accent?: string;
|
|
37
|
+
dir?: "ltr" | "rtl";
|
|
38
|
+
locale?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The declarative host for global configuration: one element that both
|
|
42
|
+
* carries the token layer's attributes — `[data-density]` and
|
|
43
|
+
* `[data-accent]` fire on any element — and provides the same values to
|
|
44
|
+
* descendants through `useConfig`, so interactive behavior (formatting,
|
|
45
|
+
* messages) and visual theming stay one decision.
|
|
46
|
+
*/
|
|
47
|
+
export declare function ConfigProvider(props: ConfigProviderProps): JSX.Element;
|
|
48
|
+
//#endregion
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createComponent, insert, spread, template } from "@solidjs/web";
|
|
2
|
+
import { createContext, splitProps, useContext } from "solid-js";
|
|
3
|
+
//#region src/components/config-provider/index.tsx
|
|
4
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
5
|
+
/** Solid context for the provider's snapshot — a custom part reads it
|
|
6
|
+
* with `useContext(ConfigContextKey)`. */
|
|
7
|
+
const ConfigContextKey = createContext(() => ({}));
|
|
8
|
+
/** The nearest provider's snapshot, or an empty one when no provider
|
|
9
|
+
* wraps the caller — the hook the date and format families will consume
|
|
10
|
+
* to localize their output. */
|
|
11
|
+
function useConfig() {
|
|
12
|
+
return useContext(ConfigContextKey);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The declarative host for global configuration: one element that both
|
|
16
|
+
* carries the token layer's attributes — `[data-density]` and
|
|
17
|
+
* `[data-accent]` fire on any element — and provides the same values to
|
|
18
|
+
* descendants through `useConfig`, so interactive behavior (formatting,
|
|
19
|
+
* messages) and visual theming stay one decision.
|
|
20
|
+
*/
|
|
21
|
+
function ConfigProvider(props) {
|
|
22
|
+
const [own, rest] = splitProps(props, [
|
|
23
|
+
"density",
|
|
24
|
+
"scene",
|
|
25
|
+
"accent",
|
|
26
|
+
"dir",
|
|
27
|
+
"locale",
|
|
28
|
+
"children"
|
|
29
|
+
]);
|
|
30
|
+
return createComponent(ConfigContextKey.Provider, {
|
|
31
|
+
value: () => ({
|
|
32
|
+
density: own.density,
|
|
33
|
+
scene: own.scene,
|
|
34
|
+
accent: own.accent,
|
|
35
|
+
dir: own.dir,
|
|
36
|
+
locale: own.locale
|
|
37
|
+
}),
|
|
38
|
+
get children() {
|
|
39
|
+
var _el$ = _tmpl$();
|
|
40
|
+
spread(_el$, [rest, {
|
|
41
|
+
"data-scope": "config-provider",
|
|
42
|
+
"data-part": "root",
|
|
43
|
+
get "data-density"() {
|
|
44
|
+
return own.density;
|
|
45
|
+
},
|
|
46
|
+
get "data-scene"() {
|
|
47
|
+
return own.scene;
|
|
48
|
+
},
|
|
49
|
+
get "data-accent"() {
|
|
50
|
+
return own.accent;
|
|
51
|
+
},
|
|
52
|
+
get dir() {
|
|
53
|
+
return own.dir;
|
|
54
|
+
},
|
|
55
|
+
get lang() {
|
|
56
|
+
return own.locale;
|
|
57
|
+
}
|
|
58
|
+
}], true);
|
|
59
|
+
insert(_el$, () => {
|
|
60
|
+
return own.children;
|
|
61
|
+
});
|
|
62
|
+
return _el$;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { ConfigContextKey, ConfigProvider, useConfig };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
//#region src/components/container/index.d.ts
|
|
3
|
+
/** The reading frame: content held to a measure and centered on the
|
|
4
|
+
* page. The sizes name typographic measures, not breakpoints — the page
|
|
5
|
+
* owns its edges, the container only owns how long a line of ink runs. */
|
|
6
|
+
export interface ContainerProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
size?: "narrow" | "readable" | "wide" | "full";
|
|
8
|
+
/** Keep the ink off the page edges when the viewport runs narrower
|
|
9
|
+
* than the measure. */
|
|
10
|
+
padding?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function Container(props: ContainerProps): JSX.Element;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { injectComponentStyle } from "@bysages/core";
|
|
2
|
+
import { spread, template } from "@solidjs/web";
|
|
3
|
+
import { splitProps } from "solid-js";
|
|
4
|
+
//#region src/components/container/index.tsx
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
6
|
+
function Container(props) {
|
|
7
|
+
injectComponentStyle("container");
|
|
8
|
+
const [own, rest] = splitProps(props, ["size", "padding"]);
|
|
9
|
+
var _el$ = _tmpl$();
|
|
10
|
+
spread(_el$, [rest, {
|
|
11
|
+
"data-scope": "container",
|
|
12
|
+
"data-part": "root",
|
|
13
|
+
get "data-size"() {
|
|
14
|
+
return own.size ?? "readable";
|
|
15
|
+
},
|
|
16
|
+
get "data-padding"() {
|
|
17
|
+
return own.padding === false ? void 0 : "";
|
|
18
|
+
}
|
|
19
|
+
}], false);
|
|
20
|
+
return _el$;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Container };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
//#region src/components/data-view/index.d.ts
|
|
3
|
+
export interface DataViewProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
items: unknown[];
|
|
5
|
+
/** Ledger rows or a lattice of cards. */
|
|
6
|
+
layout?: "list" | "grid";
|
|
7
|
+
/** Records per page; leave unset to show everything at once. */
|
|
8
|
+
pageSize?: number;
|
|
9
|
+
/** Renders one record; the view lays the returned nodes out. */
|
|
10
|
+
renderItem?: (item: unknown, index: number) => JSX.Element;
|
|
11
|
+
header?: JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
/** One vessel, two layouts: the caller renders each record through
|
|
14
|
+
* renderItem, the view lays the records out as a ledger or a lattice
|
|
15
|
+
* and — when a page size is given — pages them with the pagination
|
|
16
|
+
* family's own parts rather than a second implementation. */
|
|
17
|
+
export declare function DataView(props: DataViewProps): JSX.Element;
|
|
18
|
+
//#endregion
|