@raylang/elements 0.8.0 → 0.10.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/index.js CHANGED
@@ -16,6 +16,7 @@ export { RayCombobox } from "./components/combobox/combobox.js";
16
16
  export { RayDatePicker, RayCalendar } from "./components/date-picker/date-picker.js";
17
17
  export { RayFileUpload, parseSize, matchesAccept, describeAccept } from "./components/file-upload/file-upload.js";
18
18
  export { RayInput } from "./components/input/input.js";
19
+ export { RayModeInput } from "./components/mode-input/mode-input.js";
19
20
  export { RayNumberInput, parseNumber, formatNumber } from "./components/number-input/number-input.js";
20
21
  export { RayPasswordInput } from "./components/password-input/password-input.js";
21
22
  export { RayPathInput, dirName, baseName } from "./components/path-input/path-input.js";
@@ -28,6 +29,7 @@ export { RaySwitch } from "./components/switch/switch.js";
28
29
  export { RayTextarea } from "./components/textarea/textarea.js";
29
30
  export { RayBottomNav, RayBottomNavItem } from "./components/bottom-nav/bottom-nav.js";
30
31
  export { RayBreadcrumbs, RayBreadcrumb } from "./components/breadcrumbs/breadcrumbs.js";
32
+ export { RayDocTabs, RayDocTab } from "./components/doc-tabs/doc-tabs.js";
31
33
  export { RayNavLink } from "./components/nav-link/nav-link.js";
32
34
  export { RayPagination, paginationRange } from "./components/pagination/pagination.js";
33
35
  export { RaySidebar, RaySidebarGroup } from "./components/sidebar/sidebar.js";
package/llms-full.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # ray-elements
2
2
 
3
- > Web components (custom elements, Shadow DOM, no dependencies) for any web app: plain HTML, React, Vue or a raylang app. npm: `@raylang/elements`, `@raylang/react`, `@raylang/vue`; raylang: the `elements` package. This file describes version 0.8.0.
3
+ > Web components (custom elements, Shadow DOM, no dependencies) for any web app: plain HTML, React, Vue or a raylang app. npm: `@raylang/elements`, `@raylang/react`, `@raylang/vue`; raylang: the `elements` package. This file describes version 0.10.0.
4
4
 
5
5
  ray-elements is a design system of standard web components (custom elements
6
6
  with Shadow DOM, no dependencies): `<ray-button>`, `<ray-input>`,
@@ -256,7 +256,9 @@ fn run() -> Result<int, string> {
256
256
 
257
257
  With the bridge: `<ray-file-upload native>` and `<ray-path-input>` use the
258
258
  system file dialogs and give real paths, `confirmDialog()` asks with the
259
- system dialog, `<ray-menu native>` opens a native context menu,
259
+ system dialog, `<ray-menu native>` opens a native context menu (fill
260
+ items that depend on the click in its `ray-request-open`, not in your own
261
+ `contextmenu` listener),
260
262
  `<ray-command-palette native-menus>` runs the app's menu bar
261
263
  (`bridge.menu`, `bridge.route`), `ray-app-shell` becomes the title bar of a
262
264
  `full_content` window, and `trackEdits(form)` shows the unsaved mark. The
@@ -895,6 +897,9 @@ Properties:
895
897
  - `size`: `xs` | `sm` | `md` | `lg` | `xl`, default `sm`, reflects. Height and font size.
896
898
  - `radius`: `xs` | `sm` | `md` | `lg` | `xl` | `full`. Corner radius.
897
899
  - `variant`: `default` | `filled` | `unstyled`, default `default`, reflects. Box style.
900
+ - `highlight` (property only): `((text: string) => HighlightRange[]) | null`. Marks ranges of the text, painted behind it: called with the text on every change (typed or set), it returns { start, end, kind?, title? } offsets. kind "error" is red with a wavy underline; any other kind is styled with ::part(highlight-<kind>); title is the tooltip over the range. Ranges must not overlap.
901
+ - `complete` (property only): `((text: string, caret: number) => CompletionResult | null | Promise<CompletionResult | null>) | null`. Inline suggestions: called as the user types (and on Ctrl+Space) with the text and the caret, it returns the part of the text a suggestion would replace and the suggestions ({ from, to, items }), or null for none. A list opens under that part (ArrowUp/Down, Enter or Tab to accept, Escape to close); the chosen item's value replaces from–to as an undoable edit, then ray-complete fires. The field becomes a combobox (aria-autocomplete, aria-expanded, aria-activedescendant).
902
+ - `suggestionsLabel` (attribute `suggestions-label`): string, default `Suggestions`. Accessible name of the suggestion list.
898
903
 
899
904
  Attributes (forwarded to the inner element):
900
905
 
@@ -912,6 +917,7 @@ Attributes (forwarded to the inner element):
912
917
 
913
918
  Events:
914
919
 
920
+ - `ray-complete` (detail `{ item: CompletionItem; from: number; to: number }`): A suggestion was accepted (the text already has it).
915
921
  - `input`: On every edit (value already updated).
916
922
  - `change`: When an edit is committed (blur, Enter).
917
923
 
@@ -927,13 +933,69 @@ Parts (`::part()`):
927
933
  - `label`: The label.
928
934
  - `description`: The description.
929
935
  - `error`: The error message.
936
+ - `suggestions`: The suggestion list (a listbox in the top layer).
937
+ - `suggestion`: Each suggestion ([aria-selected] when active).
938
+ - `suggestion-label`: A suggestion's label (in the mono font).
939
+ - `suggestion-detail`: A suggestion's detail.
940
+ - `suggestion-description`: A suggestion's description, under its label (in the interface font).
941
+ - `highlight`: Each marked range (also highlight-<kind> for a range with a kind).
942
+ - `text-layer`: The layer behind the text that holds the marks.
930
943
 
931
944
  Methods and properties:
932
945
 
933
946
  - `select(): void`: Selects the text.
947
+ - `refreshHighlight(): void`: Runs highlight again, when what it marks changed but the text did not.
934
948
 
935
949
  Vue `v-model`: `value` (updated on input).
936
950
 
951
+ Types:
952
+
953
+ - `{ start: number; end: number; kind?: string; title?: string }`: A range of a field's text to mark (ray-input and ray-textarea highlight): offsets into the text, end excluded.
954
+ - `{ value: string; label?: string; detail?: string; description?: string }`: A suggestion of a field's complete(): value is inserted; label (default: value) and detail are shown, description under them.
955
+ - `{ from: number; to: number; items: CompletionItem[] }`: What complete() returns: the part of the text (offsets, to excluded) a suggestion replaces, and the suggestions.
956
+
957
+ ### Mode input
958
+
959
+ A text field with a menu of modes on one side: choosing a mode applies its attributes to the field (type, placeholder, inputmode, pattern…), so one control says what a value is and the value — a file path or text, an amount in € or $, a search by name or ID. Everything else is ray-input.
960
+
961
+ Import: `import "@raylang/elements/mode-input";` · Category: Inputs
962
+
963
+ #### `<ray-mode-input>` (RayModeInput, extends RayInput)
964
+
965
+ Declare the modes as <option> children (label, data-icon, data-hint, data-description, disabled, and data-set-<attribute> for each attribute the mode sets on the field) or with the options property. A mode's attributes replace the field's own while it is chosen and give them back after. The menu is a ray-menu of radio items in the field's shadow root; Alt+ArrowDown opens it from the field, and the trigger keeps the caret in the field.
966
+
967
+ Properties:
968
+
969
+ - `mode`: string, reflects. The chosen mode's value (default: the first). Setting it applies that mode without ray-mode-change.
970
+ - `options` (property only): `ModeOption[]`. The modes; when not set, the <option> children.
971
+ - `display`: `label` | `icon` | `both`, reflects. What the trigger shows: the mode's hint or label, its icon, or both. Default: the icon when the mode has one, else the label.
972
+ - `position`: `start` | `end`, default `start`, reflects. The side of the field the trigger sits on.
973
+ - `menuLabel` (attribute `menu-label`): string, default `Mode`. The trigger's accessible name, read with the current mode ("Mode: File").
974
+ - `nativeMenu` (attribute `native-menu`): boolean, reflects. With a native host (a std/ui window with the bridge), the system's menu (no descriptions there).
975
+
976
+ Also the properties of RayInput (`<ray-input>`): `value`, `type`, `name`, `label`, `description`, `descriptionPosition`, `error`, `placeholder`, `required`, `disabled`, `readonly`, `size`, `radius`, `variant`, `highlight`, `complete`, `suggestionsLabel`.
977
+
978
+ Events:
979
+
980
+ - `ray-mode-change` (detail `{ mode: string; previous: string | null; option: ModeOption }`): The user chose a mode (mode is already the new one); cancelable: preventDefault keeps the previous mode.
981
+
982
+ Parts (`::part()`):
983
+
984
+ - `trigger`: The button that opens the menu.
985
+ - `trigger-icon`: The current mode's icon in the trigger.
986
+ - `trigger-label`: The current mode's hint or label in the trigger.
987
+ - `menu`: The ray-menu of modes.
988
+
989
+ Methods and properties:
990
+
991
+ - `readonly modes: ModeOption[]`: The modes in use.
992
+ - `readonly currentOption: ModeOption | null`: The chosen mode.
993
+ - `choose(value: string): void`: Chooses a mode as the user would (fires ray-mode-change).
994
+
995
+ Types:
996
+
997
+ - `{ value: string; label: string; icon?: string; hint?: string; description?: string; disabled?: boolean; attrs?: Record<string, string> }`: A mode of ray-mode-input: hint is the trigger's short text ("€"), attrs the attributes it sets on the field.
998
+
937
999
  ### Number input
938
1000
 
939
1001
  A number field (Mantine's NumberInput): + and − buttons (hold to repeat), arrow keys, min, max and step, fixed decimals, a prefix and a suffix, a thousands separator, or a duration (m:ss). An ARIA spinbutton.
@@ -1007,7 +1069,7 @@ Properties:
1007
1069
  - `showLabel` (attribute `show-label`): string, default `Show password`. Accessible name of the toggle while hidden.
1008
1070
  - `hideLabel` (attribute `hide-label`): string, default `Hide password`. Accessible name of the toggle while shown.
1009
1071
 
1010
- Also the properties of RayInput (`<ray-input>`): `value`, `type`, `name`, `label`, `description`, `descriptionPosition`, `error`, `placeholder`, `required`, `disabled`, `readonly`, `size`, `radius`, `variant`.
1072
+ Also the properties of RayInput (`<ray-input>`): `value`, `type`, `name`, `label`, `description`, `descriptionPosition`, `error`, `placeholder`, `required`, `disabled`, `readonly`, `size`, `radius`, `variant`, `highlight`, `complete`, `suggestionsLabel`.
1011
1073
 
1012
1074
  Events:
1013
1075
 
@@ -1034,7 +1096,7 @@ Properties:
1034
1096
  - `browseLabel` (attribute `browse-label`): string, default `Browse…`. Text of the button.
1035
1097
  - `dialogTitle` (attribute `dialog-title`): string. Title of the system dialog (default: the label).
1036
1098
 
1037
- Also the properties of RayInput (`<ray-input>`): `value`, `type`, `name`, `label`, `description`, `descriptionPosition`, `error`, `placeholder`, `required`, `disabled`, `readonly`, `size`, `radius`, `variant`.
1099
+ Also the properties of RayInput (`<ray-input>`): `value`, `type`, `name`, `label`, `description`, `descriptionPosition`, `error`, `placeholder`, `required`, `disabled`, `readonly`, `size`, `radius`, `variant`, `highlight`, `complete`, `suggestionsLabel`.
1038
1100
 
1039
1101
  Events:
1040
1102
 
@@ -1401,6 +1463,9 @@ Properties:
1401
1463
  - `readonly`: boolean. Not editable, still submitted.
1402
1464
  - `size`: `xs` | `sm` | `md` | `lg` | `xl`, default `sm`, reflects. Font size.
1403
1465
  - `variant`: `default` | `filled` | `unstyled`, default `default`, reflects. Box style.
1466
+ - `highlight` (property only): `((text: string) => HighlightRange[]) | null`. Marks ranges of the text, painted behind it: called with the text on every change (typed or set), it returns { start, end, kind?, title? } offsets. kind "error" is red with a wavy underline; any other kind is styled with ::part(highlight-<kind>); title is the tooltip over the range. Ranges must not overlap.
1467
+ - `complete` (property only): `((text: string, caret: number) => CompletionResult | null | Promise<CompletionResult | null>) | null`. Inline suggestions: called as the user types (and on Ctrl+Space) with the text and the caret, it returns the part of the text a suggestion would replace and the suggestions ({ from, to, items }), or null for none. A list opens under that part (ArrowUp/Down, Enter or Tab to accept, Escape to close); the chosen item's value replaces from–to as an undoable edit, then ray-complete fires. The field becomes a combobox (aria-autocomplete, aria-expanded, aria-activedescendant).
1468
+ - `suggestionsLabel` (attribute `suggestions-label`): string, default `Suggestions`. Accessible name of the suggestion list.
1404
1469
 
1405
1470
  Also the properties of FieldControl: `radius`.
1406
1471
 
@@ -1414,6 +1479,7 @@ Attributes (forwarded to the inner element):
1414
1479
 
1415
1480
  Events:
1416
1481
 
1482
+ - `ray-complete` (detail `{ item: CompletionItem; from: number; to: number }`): A suggestion was accepted (the text already has it).
1417
1483
  - `input`: On every edit.
1418
1484
  - `change`: When an edit is committed.
1419
1485
 
@@ -1421,6 +1487,17 @@ Parts (`::part()`):
1421
1487
 
1422
1488
  - `textarea`: The inner <textarea>.
1423
1489
  - `wrapper`: The box.
1490
+ - `suggestions`: The suggestion list (a listbox in the top layer).
1491
+ - `suggestion`: Each suggestion ([aria-selected] when active).
1492
+ - `suggestion-label`: A suggestion's label (in the mono font).
1493
+ - `suggestion-detail`: A suggestion's detail.
1494
+ - `suggestion-description`: A suggestion's description, under its label (in the interface font).
1495
+ - `highlight`: Each marked range (also highlight-<kind> for a range with a kind).
1496
+ - `text-layer`: The layer behind the text that holds the marks.
1497
+
1498
+ Methods and properties:
1499
+
1500
+ - `refreshHighlight(): void`: Runs highlight again, when what it marks changed but the text did not.
1424
1501
 
1425
1502
  Vue `v-model`: `value` (updated on input).
1426
1503
 
@@ -1543,6 +1620,66 @@ Parts (`::part()`):
1543
1620
  - `separator`: The separator before it.
1544
1621
  - `more`: The "…" button of a collapsed path.
1545
1622
 
1623
+ ### Document tabs
1624
+
1625
+ The tabs of open documents (an editor's, a browser's): closable, with an unsaved mark, all over one shared panel; WAI-ARIA tabs with arrows, Home/End and Delete to close. The app closes them: ray-request-close asks.
1626
+
1627
+ Import: `import "@raylang/elements/doc-tabs";` · Category: Navigation
1628
+
1629
+ #### `<ray-doc-tabs>` (RayDocTabs, extends RayElement)
1630
+
1631
+ Unlike ray-tabs, a tab has no panel of its own: they all control the element named by panel, whose content the app fills for the selected one. Closing is the app's: the ×, a middle click or Delete/Backspace fire ray-request-close, and the app removes the tab (after asking about unsaved changes, if it must). When the selected tab is removed, the one at its place is selected (change) and, if the closed tab had the focus, focused. More tabs than width: the bar scrolls sideways, fades the edge that hides tabs (data-overflow-start / data-overflow-end on the host), scrolls with a vertical wheel and keeps the selected tab in view.
1632
+
1633
+ Properties:
1634
+
1635
+ - `value`: string. Value of the selected tab (default: the first).
1636
+ - `panel`: string. The id of the shared panel: it gets role=tabpanel and aria-labelledby the selected tab; the tabs get aria-controls.
1637
+ - `label`: string. Accessible name of the tab list ("Open requests").
1638
+ - `closeLabel` (attribute `close-label`): string, default `Close`. Tooltip of the ×.
1639
+ - `dirtyLabel` (attribute `dirty-label`): string, default `Unsaved changes`. What assistive technology hears after the name of a dirty tab.
1640
+
1641
+ Events:
1642
+
1643
+ - `change`: The selected tab changed: a click, the arrow keys, or the selected tab removed.
1644
+ - `ray-request-close` (detail `{ value: string; tab: RayDocTab; source: "button" | "middle" | "key" }`): The × was clicked, the tab middle-clicked, or Delete/Backspace pressed on it: remove the tab to close it (not fired for hide-close tabs).
1645
+
1646
+ Slots:
1647
+
1648
+ - (default): ray-doc-tab elements.
1649
+ - `end`: After the tabs, outside the scrolling list: a new-tab button.
1650
+
1651
+ Parts (`::part()`):
1652
+
1653
+ - `list`: The tab list (it scrolls sideways when the tabs do not fit).
1654
+ - `end`: The end slot's box.
1655
+
1656
+ Methods and properties:
1657
+
1658
+ - `readonly tabs: RayDocTab[]`: Its tabs, in order.
1659
+ - `readonly panelElement: HTMLElement | null`: The shared panel, found by the panel id.
1660
+
1661
+ #### `<ray-doc-tab>` (RayDocTab, extends RayElement)
1662
+
1663
+ A document's tab: an icon or tag (slot left), its name (cut with an ellipsis; give the full one in title), and the × or the unsaved dot.
1664
+
1665
+ Properties:
1666
+
1667
+ - `value`: string, reflects. Identifies the document (ray-doc-tabs value).
1668
+ - `dirty`: boolean, reflects. Unsaved changes: a dot in place of the ×, which comes back under the pointer.
1669
+ - `hideClose` (attribute `hide-close`): boolean, reflects. Cannot be closed: no ×, no middle click, no Delete.
1670
+
1671
+ Slots:
1672
+
1673
+ - (default): The document's name.
1674
+ - `left`: An icon or a tag (a file type, an HTTP method).
1675
+
1676
+ Parts (`::part()`):
1677
+
1678
+ - `label`: The name.
1679
+ - `left-section`: The left slot's box.
1680
+ - `close`: The × (pointer only: it is not focusable).
1681
+ - `dot`: The unsaved mark.
1682
+
1546
1683
  ### Nav link
1547
1684
 
1548
1685
  A sidebar/navigation item: icon, label, description, badge, active state, and nested nav links that collapse under it.
@@ -1640,7 +1777,7 @@ Exports (from `@raylang/elements/pagination` and `@raylang/elements`):
1640
1777
 
1641
1778
  ### Sidebar
1642
1779
 
1643
- The side navigation of an app shell: header, content and footer; on wide screens it collapses to an icon rail, below a breakpoint it becomes an off-canvas drawer. toggle() does the right thing for the screen.
1780
+ The side navigation of an app shell: header, content and footer; on wide screens it collapses to an icon rail (or out of view), below a breakpoint it becomes an off-canvas drawer. toggle() does the right thing for the screen. It is for navigation, a list of places with icons; for content such as a tree of documents, a panel that hides and resizes, put your own element in the start pane of a ray-split (min, max, autosave, collapsed).
1644
1781
 
1645
1782
  Import: `import "@raylang/elements/sidebar";` · Category: Navigation
1646
1783
 
@@ -1650,7 +1787,8 @@ Put ray-sidebar-group + ray-nav-link (with an icon in slot=left) inside. Collaps
1650
1787
 
1651
1788
  Properties:
1652
1789
 
1653
- - `collapsed`: boolean, reflects. Wide screens: an icon rail instead of the full panel.
1790
+ - `collapsed`: boolean, reflects. Wide screens: collapsed as collapse says (an icon rail, or out of view).
1791
+ - `collapse`: `icon` | `offcanvas`, default `icon`, reflects. What collapsed does on wide screens: icon, a rail of the nav links' icons; offcanvas, hidden entirely (no width, out of the tab order).
1654
1792
  - `open`: boolean, reflects. Narrow screens: the drawer is shown (modal, focus trapped; Escape, backdrop click or a followed link close it).
1655
1793
  - `side`: `start` | `end` | `left` | `right`, default `start`, reflects. The edge it sits on (its border faces the content, its narrow-screen drawer slides from there): start/end follow the writing direction; left/right are sides of the screen.
1656
1794
  - `variant`: `sidebar` | `floating`, default `sidebar`, reflects. A panel against the edge, or a floating card with a margin.
@@ -1658,9 +1796,15 @@ Properties:
1658
1796
  - `collapsedWidth` (attribute `collapsed-width`): string. Width of the icon rail. Default 3.5rem.
1659
1797
  - `breakpoint`: string, default `48em`. At this viewport width and below, it becomes a drawer.
1660
1798
  - `label`: string, default `Sidebar`. Accessible name of its navigation.
1799
+ - `resizable`: boolean, reflects. Wide screens, expanded: its inner edge drags (or, focused, arrow-keys; Shift is faster, Home/End go to the limits) the width between min-width and max-width.
1800
+ - `minWidth` (attribute `min-width`): number, default `192`. Narrowest width when resizing, in px.
1801
+ - `maxWidth` (attribute `max-width`): number, default `480`. Widest width when resizing, in px.
1802
+ - `autosave`: string. A key: the resized width is saved in localStorage and restored. A later change of width wins.
1803
+ - `resizeLabel` (attribute `resize-label`): string, default `Resize sidebar`. Accessible name of the resize edge.
1661
1804
 
1662
1805
  Events:
1663
1806
 
1807
+ - `ray-resize` (detail `{ width: number }`): After a drag or a key resized it (resizable).
1664
1808
  - `ray-toggle` (detail `{ collapsed: boolean; open: boolean; mobile: boolean }`): After toggle().
1665
1809
  - `ray-open`: The drawer opened (narrow screens).
1666
1810
  - `ray-close`: The drawer closed (narrow screens).
@@ -1677,6 +1821,7 @@ Parts (`::part()`):
1677
1821
  - `header`: The header area.
1678
1822
  - `content`: The scrolling <nav>.
1679
1823
  - `footer`: The footer area.
1824
+ - `resizer`: The resize edge (a separator), shown when resizable.
1680
1825
  - `drawer`: The <dialog> used on narrow screens.
1681
1826
 
1682
1827
  Methods and properties:
@@ -1775,12 +1920,15 @@ Import: `import "@raylang/elements/tabs";` · Category: Navigation
1775
1920
 
1776
1921
  #### `<ray-tabs>` (RayTabs, extends RayElement)
1777
1922
 
1923
+ More tabs than width: the list scrolls sideways, fades the edge that hides tabs, scrolls with a vertical wheel and keeps the selected tab in view. The host then carries data-overflow-start and data-overflow-end (following the writing direction), to style it further.
1924
+
1778
1925
  Properties:
1779
1926
 
1780
1927
  - `value`: string. Value of the active tab (default: the first enabled one).
1781
1928
  - `variant`: `default` | `outline` | `pills`, default `default`, reflects. Tab style.
1782
1929
  - `orientation`: `horizontal` | `vertical`, default `horizontal`, reflects. Tab list direction (and arrow keys).
1783
1930
  - `color`: string, reflects. Active indicator color.
1931
+ - `size`: `xs` | `sm` | `md` | `lg` | `xl`, default `sm`, reflects. Height, font size and padding of the tabs (xs for a compact bar).
1784
1932
  - `activation`: `auto` | `manual`, default `auto`. manual: arrows move focus, Enter/Space activates.
1785
1933
  - `grow`: boolean, reflects. Tabs share the full width.
1786
1934
 
@@ -1794,7 +1942,7 @@ Slots:
1794
1942
 
1795
1943
  Parts (`::part()`):
1796
1944
 
1797
- - `list`: The tab list.
1945
+ - `list`: The tab list (it scrolls sideways when the tabs do not fit).
1798
1946
  - `panels`: The panel area.
1799
1947
 
1800
1948
  Methods and properties:
@@ -1810,11 +1958,16 @@ Properties:
1810
1958
 
1811
1959
  - `value`: string, reflects. Matches a ray-tab-panel's value.
1812
1960
  - `disabled`: boolean, reflects. Cannot be activated.
1961
+ - `count`: string, reflects. A small number after the label ("3", "99+"), lighter than a badge; part of the tab's accessible name. Empty: none.
1813
1962
 
1814
1963
  Slots:
1815
1964
 
1816
1965
  - `left`: Icon.
1817
- - `right`: Badge or count.
1966
+ - `right`: A badge or other content after the label (for a plain number, count is lighter).
1967
+
1968
+ Parts (`::part()`):
1969
+
1970
+ - `count`: The count.
1818
1971
 
1819
1972
  #### `<ray-tab-panel>` (RayTabPanel, extends RayElement)
1820
1973
 
@@ -1843,6 +1996,9 @@ Properties:
1843
1996
  - `emptyLabel` (attribute `empty-label`): string, default `Nothing found`. Text without results.
1844
1997
  - `label`: string, default `Command palette`. Accessible name.
1845
1998
  - `hideHint` (attribute `hide-hint`): boolean, reflects. No keyboard hint at the bottom.
1999
+ - `navigateLabel` (attribute `navigate-label`): string, default `navigate`. The keyboard hint's word for ↑↓.
2000
+ - `runLabel` (attribute `run-label`): string, default `run`. The keyboard hint's word for ↵.
2001
+ - `closeLabel` (attribute `close-label`): string, default `close`. The keyboard hint's word for esc.
1846
2002
  - `nativeMenus` (attribute `native-menus`): boolean, reflects. With a native host (ray-elements/core/raylang.js in a std/ui window, menus declared with elements/bridge), also lists the app's menu bar, grouped by menu with its shortcuts; running one gives the program the menu's own event.
1847
2003
  - `overlayBlur` (attribute `overlay-blur`): string. Blur of the page behind: px ("8"), a CSS length or "none". Default: --ray-overlay-blur ([overlay] blur in tokens.toml).
1848
2004
 
@@ -1873,7 +2029,7 @@ Exports (from `@raylang/elements/command-palette` and `@raylang/elements`):
1873
2029
 
1874
2030
  Types:
1875
2031
 
1876
- - `{ id?: string; label: string; description?: string; group?: string; keywords?: string | string[]; shortcut?: string; icon?: string | Node; disabled?: boolean; native?: boolean; tag?: string; onSelect?: (action: CommandAction) => void }`: An action of ray-command-palette.
2032
+ - `{ id?: string; label: string; description?: string; group?: string; keywords?: string | string[]; shortcut?: string; icon?: string | Node; prefix?: string | Node; disabled?: boolean; native?: boolean; tag?: string; onSelect?: (action: CommandAction) => void }`: An action of ray-command-palette. icon is a 1.25rem square (a registered icon name, text or a Node); prefix is content of any width before the label (text or a Node, e.g. a ray-badge with an HTTP method), not searched.
1877
2033
 
1878
2034
  #### In a raylang app
1879
2035
 
@@ -2041,6 +2197,7 @@ Also the properties of Floating: `offset`.
2041
2197
  Events:
2042
2198
 
2043
2199
  - `ray-select` (detail `{ value: string; item: RayMenuItem }`): An item was chosen; detail: { value, item }.
2200
+ - `ray-request-open` (detail `{ event: Event }`): Its trigger is about to open it (click, Arrow keys, right click), before the items are read, native menu included: fill items that depend on what was clicked here. Cancelable (preventDefault keeps it closed). Not fired by show() or open = true. detail: { event }.
2044
2201
  - `ray-open`: After it opened.
2045
2202
  - `ray-close`: After it closed.
2046
2203
 
@@ -2071,6 +2228,9 @@ Properties:
2071
2228
  - `value`: string, reflects. Reported in ray-select (default: the text).
2072
2229
  - `disabled`: boolean, reflects. Skipped by the keyboard, cannot be chosen.
2073
2230
  - `color`: string, reflects. Text and hover color (e.g. red for destructive actions).
2231
+ - `type`: `item` | `checkbox` | `radio`, default `item`, reflects. checkbox: choosing it toggles checked (menuitemcheckbox); radio: choosing it checks it and unchecks the radio items of the menu with the same name (menuitemradio). Both show a check mark when checked, in the native menu too.
2232
+ - `checked`: boolean, reflects. Checked (checkbox and radio items). Already updated when ray-select fires.
2233
+ - `name`: string, reflects. The group of a radio item: one checked per name in the menu.
2074
2234
 
2075
2235
  Slots:
2076
2236
 
@@ -2078,6 +2238,14 @@ Slots:
2078
2238
  - `left`: Icon.
2079
2239
  - `right`: Shortcut or badge.
2080
2240
 
2241
+ Parts (`::part()`):
2242
+
2243
+ - `mark`: The check mark of a checkbox or radio item.
2244
+
2245
+ Methods and properties:
2246
+
2247
+ - `readonly checkable: boolean`: Whether type is checkbox or radio.
2248
+
2081
2249
  #### `<ray-menu-label>` (RayMenuLabel, extends RayElement)
2082
2250
 
2083
2251
  A section caption inside the menu.
@@ -2100,7 +2268,16 @@ With `native` and [the native bridge](https://elements.raylang.dev/raylang.html#
2100
2268
  </ray-menu>
2101
2269
  ```
2102
2270
 
2103
- Labels, nested menus, icons and colors are the page menu's only. A dismissed native menu fires nothing.
2271
+ Checkbox and radio items show their check mark there too. Labels, nested menus, icons and colors are the page menu's only. A dismissed native menu fires nothing.
2272
+
2273
+ The native menu reads its items the moment it opens, so items that depend on what was clicked go in `ray-request-open`, which comes first (a `contextmenu` listener of your own on the trigger may run after the menu's):
2274
+
2275
+ ```js
2276
+ menu.addEventListener("ray-request-open", (e) => {
2277
+ const row = e.detail.event.target.closest(".file-row");
2278
+ menu.replaceChildren(menu.querySelector("[slot=trigger]"), ...itemsFor(row));
2279
+ });
2280
+ ```
2104
2281
 
2105
2282
  ### Popover
2106
2283
 
@@ -2433,7 +2610,7 @@ Import: `import "@raylang/elements/code";` · Category: Data display
2433
2610
 
2434
2611
  #### `<ray-code>` (RayCode, extends RayElement)
2435
2612
 
2436
- The code comes from the code property, a <script type="text/plain"> child (raw text: anything but a closing script tag), a <template> child (parsed as HTML: the easiest for markup, but a < that is not a tag, as in Promise<void>, breaks it), or the element's text; common indentation and blank edges are removed. Built-in languages: js/ts (jsx, tsx), json, html/xml/svg/vue, css, shell, ray and diff; others show as plain text. Library classes painted with the tokens: Prism's .token.*, highlight.js's .hljs-*, and Shiki's css-variables theme.
2613
+ The code comes from the code property, a <script type="text/plain"> child (raw text: anything but a closing script tag), a <template> child (parsed as HTML: the easiest for markup, but a < that is not a tag, as in Promise<void>, breaks it), or the element's text; common indentation and blank edges are removed (not with verbatim). Built-in languages: js/ts (jsx, tsx), json, html/xml/svg/vue, css, shell, ray and diff; others show as plain text. Library classes painted with the tokens: Prism's .token.*, highlight.js's .hljs-*, and Shiki's css-variables theme.
2437
2614
 
2438
2615
  Properties:
2439
2616
 
@@ -2443,6 +2620,7 @@ Properties:
2443
2620
  - `lineNumbers` (attribute `line-numbers`): boolean, reflects. Numbers each line (not copied, not selectable).
2444
2621
  - `highlight`: string. Lines to highlight: "3, 5-7".
2445
2622
  - `wrap`: boolean, reflects. Wraps long lines instead of scrolling sideways.
2623
+ - `verbatim`: boolean, reflects. Shows and copies the text exactly as given: no common indentation or blank first and last lines removed. For data (a response body, a log) rather than code written in the page.
2446
2624
  - `maxHeight` (attribute `max-height`): string. Height before it scrolls: px as a number, or a CSS length. A taller block gets a "Show all N lines" button.
2447
2625
  - `expanded`: boolean, reflects. Shown whole, past max-height.
2448
2626
  - `hideCopy` (attribute `hide-copy`): boolean, reflects. No copy button.
@@ -3252,7 +3430,7 @@ Properties:
3252
3430
  - `max`: number. Maximum size of the start pane in px.
3253
3431
  - `collapsed`: boolean, reflects. The start pane is hidden.
3254
3432
  - `disabled`: boolean, reflects. The divider cannot be moved.
3255
- - `autosave`: string. A key: the size is saved in localStorage and restored.
3433
+ - `autosave`: string. A key: the size and the collapsed state are saved in localStorage and restored (a saved state wins over the collapsed attribute).
3256
3434
 
3257
3435
  Events:
3258
3436
 
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # ray-elements
2
2
 
3
- > Web components (custom elements, Shadow DOM, no dependencies) for any web app: plain HTML, React, Vue or a raylang app. npm: `@raylang/elements`, `@raylang/react`, `@raylang/vue`; raylang: the `elements` package. This file describes version 0.8.0.
3
+ > Web components (custom elements, Shadow DOM, no dependencies) for any web app: plain HTML, React, Vue or a raylang app. npm: `@raylang/elements`, `@raylang/react`, `@raylang/vue`; raylang: the `elements` package. This file describes version 0.10.0.
4
4
 
5
5
  ray-elements is a design system of standard web components (custom elements
6
6
  with Shadow DOM, no dependencies): `<ray-button>`, `<ray-input>`,
@@ -256,7 +256,9 @@ fn run() -> Result<int, string> {
256
256
 
257
257
  With the bridge: `<ray-file-upload native>` and `<ray-path-input>` use the
258
258
  system file dialogs and give real paths, `confirmDialog()` asks with the
259
- system dialog, `<ray-menu native>` opens a native context menu,
259
+ system dialog, `<ray-menu native>` opens a native context menu (fill
260
+ items that depend on the click in its `ray-request-open`, not in your own
261
+ `contextmenu` listener),
260
262
  `<ray-command-palette native-menus>` runs the app's menu bar
261
263
  (`bridge.menu`, `bridge.route`), `ray-app-shell` becomes the title bar of a
262
264
  `full_content` window, and `trackEdits(form)` shows the unsaved mark. The
@@ -293,6 +295,7 @@ Members whose name starts with `_` are internal.
293
295
  - [Date picker](https://elements.raylang.dev/components/date-picker.md): `<ray-date-picker>`, `<ray-calendar>` (Inputs). A date field with a calendar dropdown, and the calendar on its own.
294
296
  - [File upload](https://elements.raylang.dev/components/file-upload.md): `<ray-file-upload>` (Inputs). A drop zone to pick files: drag, click, keyboard or paste.
295
297
  - [Input](https://elements.raylang.dev/components/input.md): `<ray-input>` (Inputs). A text field with label, description and error (Mantine's TextInput).
298
+ - [Mode input](https://elements.raylang.dev/components/mode-input.md): `<ray-mode-input>` (Inputs). A text field with a menu of modes on one side: choosing a mode applies its attributes to the field (type, placeholder, inputmode, pattern…), so one control says what a value is and the value — a file path or text, an amount in € or $, a search by name or ID.
296
299
  - [Number input](https://elements.raylang.dev/components/number-input.md): `<ray-number-input>` (Inputs). A number field (Mantine's NumberInput): + and − buttons (hold to repeat), arrow keys, min, max and step, fixed decimals, a prefix and a suffix, a thousands separator, or a duration (m:ss).
297
300
  - [Password input](https://elements.raylang.dev/components/password-input.md): `<ray-password-input>` (Inputs). A password field with a button that shows or hides what was typed (Mantine's PasswordInput).
298
301
  - [Path input](https://elements.raylang.dev/components/path-input.md): `<ray-path-input>` (Inputs). A field for a path on disk: a file to open, a folder, or where to save.
@@ -305,9 +308,10 @@ Members whose name starts with `_` are internal.
305
308
  - [Textarea](https://elements.raylang.dev/components/textarea.md): `<ray-textarea>` (Inputs). A multi-line text field that can grow with its content.
306
309
  - [Bottom nav](https://elements.raylang.dev/components/bottom-nav.md): `<ray-bottom-nav>`, `<ray-bottom-nav-item>` (Navigation). The bottom navigation of a phone app (Material's navigation bar, the iOS tab bar): three to five destinations with an icon, a label and a badge, the current one marked by a pill.
307
310
  - [Breadcrumbs](https://elements.raylang.dev/components/breadcrumbs.md): `<ray-breadcrumbs>`, `<ray-breadcrumb>` (Navigation). Where a page sits (Mantine's Breadcrumbs, the WAI-ARIA breadcrumb pattern): links in a labelled nav, the last one the current page.
311
+ - [Document tabs](https://elements.raylang.dev/components/doc-tabs.md): `<ray-doc-tabs>`, `<ray-doc-tab>` (Navigation). The tabs of open documents (an editor's, a browser's): closable, with an unsaved mark, all over one shared panel; WAI-ARIA tabs with arrows, Home/End and Delete to close.
308
312
  - [Nav link](https://elements.raylang.dev/components/nav-link.md): `<ray-nav-link>` (Navigation). A sidebar/navigation item: icon, label, description, badge, active state, and nested nav links that collapse under it.
309
313
  - [Pagination](https://elements.raylang.dev/components/pagination.md): `<ray-pagination>` (Navigation). Page navigation: previous/next, optional first/last, page numbers with ellipses; the number of items stays constant so it does not jump.
310
- - [Sidebar](https://elements.raylang.dev/components/sidebar.md): `<ray-sidebar>`, `<ray-sidebar-group>` (Navigation). The side navigation of an app shell: header, content and footer; on wide screens it collapses to an icon rail, below a breakpoint it becomes an off-canvas drawer.
314
+ - [Sidebar](https://elements.raylang.dev/components/sidebar.md): `<ray-sidebar>`, `<ray-sidebar-group>` (Navigation). The side navigation of an app shell: header, content and footer; on wide screens it collapses to an icon rail (or out of view), below a breakpoint it becomes an off-canvas drawer.
311
315
  - [Stepper](https://elements.raylang.dev/components/stepper.md): `<ray-stepper>`, `<ray-step>` (Navigation). A task in steps (Mantine's Stepper): a wizard, a checkout, an onboarding.
312
316
  - [Tabs](https://elements.raylang.dev/components/tabs.md): `<ray-tabs>`, `<ray-tab>`, `<ray-tab-panel>` (Navigation). Tabs and panels (WAI-ARIA tabs pattern): arrows, Home/End, automatic or manual activation.
313
317
  - [Command palette](https://elements.raylang.dev/components/command-palette.md): `<ray-command-palette>` (Overlays). Search and run actions from the keyboard (Mantine's Spotlight): fuzzy search, groups, shortcuts, ⌘K / Ctrl+K; combobox + listbox pattern in a modal dialog.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raylang/elements",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Web components for any app, with raylang extras (shadcn/ui + Mantine inspired)",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": ["web-components", "custom-elements", "design-system", "ui", "raylang"],
@@ -84,6 +84,10 @@
84
84
  "types": "./ray-elements.d.ts",
85
85
  "default": "./components/input/input.js"
86
86
  },
87
+ "./mode-input": {
88
+ "types": "./ray-elements.d.ts",
89
+ "default": "./components/mode-input/mode-input.js"
90
+ },
87
91
  "./number-input": {
88
92
  "types": "./ray-elements.d.ts",
89
93
  "default": "./components/number-input/number-input.js"
@@ -132,6 +136,10 @@
132
136
  "types": "./ray-elements.d.ts",
133
137
  "default": "./components/breadcrumbs/breadcrumbs.js"
134
138
  },
139
+ "./doc-tabs": {
140
+ "types": "./ray-elements.d.ts",
141
+ "default": "./components/doc-tabs/doc-tabs.js"
142
+ },
135
143
  "./nav-link": {
136
144
  "types": "./ray-elements.d.ts",
137
145
  "default": "./components/nav-link/nav-link.js"