<div class="demo-caption">The modal</div>
<div class="demo-modal-hero">
<div class="demo-modal-hero-text">
<strong>ray-dialog is the modal of ray-elements</strong>
<span>Backdrop, inert page, trapped and restored focus, Escape, stacking. This one takes 70% of the window (<code>size="70%" height="70%"</code>) and holds a whole settings screen: vertical tabs, fields, a table, sliders, switches and a confirmation stacked on top.</span>
</div>
<ray-button data-open="dlg-settings"><ray-icon slot="left" name="settings"></ray-icon>Project settings</ray-button>
<span data-out="dlg-settings"></span>
</div>
<ray-dialog id="dlg-settings" label="Project settings" description="ray-remote · desktop app · last deployed 2 hours ago" size="70%" height="70%">
<ray-badge slot="header" variant="dot" color="green" normal-case>Live</ray-badge>
<ray-tabs class="demo-settings" variant="outline" orientation="vertical" value="general">
<ray-tab value="general"><ray-icon slot="left" name="settings"></ray-icon>General</ray-tab>
<ray-tab value="members"><ray-icon slot="left" name="user"></ray-icon>Members</ray-tab>
<ray-tab value="build"><ray-icon slot="left" name="terminal"></ray-icon>Build</ray-tab>
<ray-tab value="notifications"><ray-icon slot="left" name="info"></ray-icon>Notifications</ray-tab>
<ray-tab value="danger"><ray-icon slot="left" name="alert-triangle"></ray-icon>Danger zone</ray-tab>
<ray-tab-panel value="general">
<div class="demo-settings-section">
<div class="demo-settings-identity">
<ray-avatar name="Ray Remote" color="violet" size="xl" radius="md"></ray-avatar>
<ray-file-upload variant="compact" accept="image/*" list="none" drop-label="Drop a new icon" browse-label="browse"></ray-file-upload>
</div>
<div class="demo-dialog-form">
<ray-input name="name" label="Name" value="ray-remote" required></ray-input>
<ray-input name="id" label="Bundle id" value="dev.ray.remote" description="Reverse DNS, used by the installers."></ray-input>
</div>
<ray-textarea name="about" label="Description" rows="2" value="Control a machine from your phone: terminal, files and screen."></ray-textarea>
<div class="demo-dialog-form">
<ray-select name="region" label="Update channel" value="stable">
<option value="stable">Stable</option>
<option value="beta">Beta</option>
<option value="nightly">Nightly</option>
</ray-select>
<div class="demo-field">Visibility
<ray-segmented-control name="visibility" value="team" aria-label="Visibility"><option value="private">Private</option><option value="team">Team</option><option value="public">Public</option></ray-segmented-control>
</div>
</div>
</div>
</ray-tab-panel>
<ray-tab-panel value="members">
<div class="demo-settings-section">
<div class="demo-settings-invite">
<ray-input label="Invite by email" placeholder="name@company.com" type="email" style="flex: 1"></ray-input>
<ray-select label="Role" value="developer" style="width: 9rem"><option value="admin">Admin</option><option value="developer">Developer</option><option value="viewer">Viewer</option></ray-select>
<ray-button variant="light">Invite</ray-button>
</div>
<ray-table id="dlg-settings-members" with-border label="Members"></ray-table>
</div>
</ray-tab-panel>
<ray-tab-panel value="build">
<div class="demo-settings-section">
<div class="demo-dialog-form">
<ray-select label="Target" value="native"><option value="vm">VM</option><option value="native">Native (--release)</option></ray-select>
<ray-input label="Entry" value="src/main.ray"></ray-input>
</div>
<ray-slider label="Parallel jobs" min="1" max="16" value="6" show-value></ray-slider>
<ray-slider label="Cache size" min="0" max="8" step="0.5" value="2" show-value unit=" GB" color="teal"></ray-slider>
<div class="demo-settings-toggles">
<ray-switch label="Run tests before every build" checked></ray-switch>
<ray-switch label="Sign the macOS bundle" checked></ray-switch>
<ray-switch label="Publish to the update channel"></ray-switch>
</div>
</div>
</ray-tab-panel>
<ray-tab-panel value="notifications">
<div class="demo-settings-section">
<ray-radio-group label="Email me about" value="failures">
<ray-radio value="all">Every build</ray-radio>
<ray-radio value="failures">Failures only</ray-radio>
<ray-radio value="none">Nothing</ray-radio>
</ray-radio-group>
<div class="demo-settings-toggles">
<ray-checkbox label="New member joined" checked></ray-checkbox>
<ray-checkbox label="Release published" checked></ray-checkbox>
<ray-checkbox label="Weekly usage report"></ray-checkbox>
</div>
</div>
</ray-tab-panel>
<ray-tab-panel value="danger">
<div class="demo-settings-section">
<ray-alert color="red" label="Careful">These actions affect everyone in the project and cannot be undone.</ray-alert>
<div class="demo-settings-danger">
<div><strong>Transfer ownership</strong><span>Move ray-remote to another team.</span></div>
<ray-button variant="default">Transfer…</ray-button>
</div>
<div class="demo-settings-danger">
<div><strong>Delete project</strong><span>Removes builds, releases and the update channel.</span></div>
<ray-button variant="light" color="red" id="dlg-settings-delete">Delete…</ray-button>
</div>
</div>
</ray-tab-panel>
</ray-tabs>
<span slot="footer" class="demo-settings-saved">Last saved 2 minutes ago</span>
<ray-button slot="footer" variant="default" data-dialog-close="cancel">Cancel</ray-button>
<ray-button slot="footer" data-dialog-close="save">Save changes</ray-button>
</ray-dialog>
<div class="demo-caption">Patterns</div>
<div class="demo-launchers">
<article class="demo-launcher" style="--c: var(--ray-blue-light-color); --bg: var(--ray-blue-light)">
<span class="demo-launcher-icon"><ray-icon name="file"></ray-icon></span>
<div class="demo-launcher-text"><strong>Rename</strong><span>One field, focused on open; the button's value is the returnValue.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-rename">Open</ray-button><span data-out="dlg-rename"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-red-light-color); --bg: var(--ray-red-light)">
<span class="demo-launcher-icon"><ray-icon name="alert-triangle"></ray-icon></span>
<div class="demo-launcher-text"><strong>Confirm</strong><span><code>confirmDialog()</code> builds one and resolves to true or false.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" id="dlg-confirm-open">Delete…</ray-button><span data-out="dlg-confirm"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-violet-light-color); --bg: var(--ray-violet-light)">
<span class="demo-launcher-icon"><ray-icon name="plus"></ray-icon></span>
<div class="demo-launcher-text"><strong>Create project</strong><span>A larger form (size lg) with a header badge; read its fields on ray-close.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-create">Open</ray-button><span data-out="dlg-create"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-orange-light-color); --bg: var(--ray-orange-light)">
<span class="demo-launcher-icon"><ray-icon name="download"></ray-icon></span>
<div class="demo-launcher-text"><strong>Unsaved changes</strong><span>Persistent: no ×, Escape or backdrop; one of three answers.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-unsaved">Open</ray-button><span data-out="dlg-unsaved"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-teal-light-color); --bg: var(--ray-teal-light)">
<span class="demo-launcher-icon"><ray-icon name="paperclip"></ray-icon></span>
<div class="demo-launcher-text"><strong>Guarded draft</strong><span>ray-request-close is cancelable: closing a written note asks first.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-note">Open</ray-button><span data-out="dlg-note"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-gray-light-color); --bg: var(--ray-gray-light)">
<span class="demo-launcher-icon"><ray-icon name="settings"></ray-icon></span>
<div class="demo-launcher-text"><strong>Keyboard shortcuts</strong><span>Long content near the top (position top): the body scrolls, header and footer stay.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-keys">Open</ray-button></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-green-light-color); --bg: var(--ray-green-light)">
<span class="demo-launcher-icon"><ray-icon name="terminal"></ray-icon></span>
<div class="demo-launcher-text"><strong>Build log</strong><span>size="full" for a workspace: almost the whole window.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-log">Open</ray-button></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-pink-light-color); --bg: var(--ray-pink-light)">
<span class="demo-launcher-icon"><ray-icon name="star"></ray-icon></span>
<div class="demo-launcher-text"><strong>What's new</strong><span>Small and announcement-like (size sm), with a hero and a single action.</span></div>
<div class="demo-launcher-foot"><ray-button size="sm" variant="default" data-open="dlg-news">Open</ray-button></div>
</article>
</div>
<ray-dialog id="dlg-rename" label="Rename file" size="sm">
<ray-input label="New name" value="main.ray" description="Letters, digits, dots and dashes." autofocus></ray-input>
<div slot="footer" style="display: contents">
<ray-button variant="default" data-dialog-close="cancel">Cancel</ray-button>
<ray-button data-dialog-close="rename">Rename</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-create" label="Create project" size="lg">
<ray-badge slot="header" variant="light" color="violet" normal-case>raylang 1.27</ray-badge>
<div class="demo-dialog-form">
<ray-input name="name" label="Name" value="ray-remote" required autofocus></ray-input>
<ray-select name="template" label="Template" value="desktop">
<option value="desktop">Desktop app (std/ui)</option>
<option value="web">Web server (web)</option>
<option value="cli">Command line</option>
</ray-select>
<div class="demo-field">Frontend
<ray-segmented-control name="frontend" value="html" aria-label="Frontend"><option value="html">Plain HTML</option><option value="react">React</option><option value="vue">Vue</option></ray-segmented-control>
</div>
<ray-switch name="git" label="Initialize a git repository" checked></ray-switch>
</div>
<div slot="footer" style="display: contents">
<ray-button variant="default" data-dialog-close="cancel">Cancel</ray-button>
<ray-button data-dialog-close="create"><ray-icon slot="left" name="plus"></ray-icon>Create</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-unsaved" label="Save changes to main.ray?" size="sm" persistent hide-close>
<p class="demo-dialog-text">Your changes will be lost if you close without saving.</p>
<div slot="footer" style="display: contents">
<ray-button variant="subtle" color="red" data-dialog-close="discard" style="margin-inline-end: auto">Don't save</ray-button>
<ray-button variant="default" data-dialog-close="cancel">Cancel</ray-button>
<ray-button data-dialog-close="save" autofocus>Save</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-note" label="New note">
<ray-textarea id="dlg-note-text" label="Note" placeholder="Write something, then try Escape, the × or the backdrop." rows="4" autofocus></ray-textarea>
<div slot="footer" style="display: contents">
<ray-button variant="default" id="dlg-note-cancel">Cancel</ray-button>
<ray-button data-dialog-close="saved">Save note</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-keys" label="Keyboard shortcuts" position="top">
<ray-search slot="header" size="xs" aria-label="Filter shortcuts" placeholder="Filter" id="dlg-keys-filter" style="width: 9rem"></ray-search>
<table class="demo-keys" id="dlg-keys-table">
<tbody>
<tr><th colspan="2">General</th></tr>
<tr><td>Command palette</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>K</ray-kbd></span></td></tr>
<tr><td>Settings</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>,</ray-kbd></span></td></tr>
<tr><td>Toggle sidebar</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>B</ray-kbd></span></td></tr>
<tr><td>Toggle theme</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>⇧</ray-kbd><ray-kbd>L</ray-kbd></span></td></tr>
<tr><th colspan="2">Editor</th></tr>
<tr><td>Save</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>S</ray-kbd></span></td></tr>
<tr><td>Find</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>F</ray-kbd></span></td></tr>
<tr><td>Go to line</td><td><span><ray-kbd>⌃</ray-kbd><ray-kbd>G</ray-kbd></span></td></tr>
<tr><td>Format document</td><td><span><ray-kbd>⌥</ray-kbd><ray-kbd>⇧</ray-kbd><ray-kbd>F</ray-kbd></span></td></tr>
<tr><td>Comment line</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>/</ray-kbd></span></td></tr>
<tr><th colspan="2">Run</th></tr>
<tr><td>Run program</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>R</ray-kbd></span></td></tr>
<tr><td>Run tests</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>⇧</ray-kbd><ray-kbd>T</ray-kbd></span></td></tr>
<tr><td>Build native</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>⇧</ray-kbd><ray-kbd>B</ray-kbd></span></td></tr>
<tr><td>Stop</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>.</ray-kbd></span></td></tr>
<tr><th colspan="2">Navigation</th></tr>
<tr><td>Next tab</td><td><span><ray-kbd>⌃</ray-kbd><ray-kbd>Tab</ray-kbd></span></td></tr>
<tr><td>Previous tab</td><td><span><ray-kbd>⌃</ray-kbd><ray-kbd>⇧</ray-kbd><ray-kbd>Tab</ray-kbd></span></td></tr>
<tr><td>Go to file</td><td><span><ray-kbd>⌘</ray-kbd><ray-kbd>P</ray-kbd></span></td></tr>
<tr><td>Go back</td><td><span><ray-kbd>⌃</ray-kbd><ray-kbd>-</ray-kbd></span></td></tr>
</tbody>
</table>
<div slot="footer" style="display: contents">
<ray-button variant="default" data-dialog-close="done">Done</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-log" label="Build log · ray-remote 0.4.1" size="full">
<ray-badge slot="header" variant="dot" color="green" normal-case>Passed</ray-badge>
<pre class="demo-dialog-log"><span class="p">$</span> ray build --native --release src/main.ray
<span class="d"> compiling</span> std/ui, std/json, net 0.5.0, web 0.4.6
<span class="d"> checking </span> 42 modules · 0 warnings
<span class="d"> linking </span> target/release/ray-remote (4.2 MB)
<span class="p">$</span> ray test
<span class="ok"> ok</span> session: resumes after reconnect (12 ms)
<span class="ok"> ok</span> files: upload with progress (31 ms)
<span class="ok"> ok</span> files: rejects paths outside the root (2 ms)
<span class="ok"> ok</span> ui: palette lists the menu commands (48 ms)
<span class="ok"> ok</span> ui: theme follows the system (7 ms)
<span class="d"> result: </span>5 test(s), all passed ✓
<span class="p">$</span> ray bundle --name "Ray Remote" -o dist
<span class="d"> bundle </span> dist/Ray Remote.app (ad-hoc signed)
<span class="ok"> done</span> in 18.4 s</pre>
<div slot="footer" style="display: contents">
<ray-button variant="default" data-dialog-close="close">Close</ray-button>
<ray-button variant="light" data-dialog-close="reveal"><ray-icon slot="left" name="folder"></ray-icon>Show in folder</ray-button>
</div>
</ray-dialog>
<ray-dialog id="dlg-news" label="What's new in ray·elements 0.4" size="sm">
<div class="demo-dialog-hero"><ray-icon name="star" size="2rem"></ray-icon></div>
<ul class="demo-dialog-list">
<li><ray-badge variant="light" color="green">New</ray-badge> ray-toggle and ray-toggle-group</li>
<li><ray-badge variant="light" color="green">New</ray-badge> ray-file-upload with drag and drop</li>
<li><ray-badge variant="light" color="blue">Changed</ray-badge> every value change is a <code>change</code> event</li>
<li><ray-badge variant="light" color="gray">Docs</ray-badge> React and Vue code for every example</li>
</ul>
<div slot="footer" style="display: contents">
<ray-button full-width data-dialog-close="ok">Got it</ray-button>
</div>
</ray-dialog>
<script type="module">
import { confirmDialog } from "../src/components/dialog/dialog.js";
const out = (id, text) => { document.querySelector(`[data-out="${id}"]`).textContent = text; };
const members = document.getElementById("dlg-settings-members");
members.columns = [
{ key: "name", label: "Name", sortable: true },
{ key: "email", label: "Email" },
{ key: "role", label: "Role", sortable: true, render: (r) => {
const b = document.createElement("ray-badge");
b.variant = "light";
b.color = r.role === "Admin" ? "violet" : r.role === "Developer" ? "blue" : "gray";
b.textContent = r.role;
return b;
} },
];
members.data = [
{ id: 1, name: "Ada Lovelace", email: "ada@ray.dev", role: "Admin" },
{ id: 2, name: "Grace Hopper", email: "grace@ray.dev", role: "Developer" },
{ id: 3, name: "Alan Turing", email: "alan@ray.dev", role: "Developer" },
{ id: 4, name: "Katherine Johnson", email: "katherine@ray.dev", role: "Viewer" },
{ id: 5, name: "Edsger Dijkstra", email: "edsger@ray.dev", role: "Viewer" },
];
document.getElementById("dlg-settings-delete").addEventListener("click", async () => {
const ok = await confirmDialog({ label: "Delete ray-remote?", message: "The project, its builds and its releases are removed for everyone.", confirmLabel: "Delete project", color: "red" });
if (ok) document.getElementById("dlg-settings").close("deleted");
});
document.getElementById("dlg-settings").addEventListener("ray-close", (e) => out("dlg-settings", `returnValue: "${e.detail.returnValue}"`));
const settingsTabs = document.querySelector("#dlg-settings ray-tabs");
const narrow = matchMedia("(max-width: 40em)");
const placeTabs = () => { settingsTabs.orientation = narrow.matches ? "horizontal" : "vertical"; };
narrow.addEventListener("change", placeTabs);
placeTabs();
for (const button of document.querySelectorAll("[data-open]")) {
button.addEventListener("click", () => document.getElementById(button.dataset.open).show());
}
for (const id of ["dlg-rename", "dlg-unsaved"]) {
document.getElementById(id).addEventListener("ray-close", (e) => out(id, `returnValue: "${e.detail.returnValue}"`));
}
document.getElementById("dlg-rename").addEventListener("ray-close", (e) => {
if (e.detail.returnValue === "rename") out("dlg-rename", `Renamed to ${e.currentTarget.querySelector("ray-input").value}`);
});
const create = document.getElementById("dlg-create");
create.addEventListener("ray-close", (e) => {
if (e.detail.returnValue !== "create") return out("dlg-create", "Cancelled");
const field = (name) => create.querySelector(`[name="${name}"]`);
out("dlg-create", `${field("name").value} · ${field("template").value} · ${field("frontend").value}${field("git").checked ? " · git" : ""}`);
});
document.getElementById("dlg-confirm-open").addEventListener("click", async () => {
const ok = await confirmDialog({ label: "Delete project?", message: "This removes ray-remote and its history. It cannot be undone.", confirmLabel: "Delete", color: "red" });
out("dlg-confirm", ok ? "Deleted" : "Kept");
});
const note = document.getElementById("dlg-note");
const text = document.getElementById("dlg-note-text");
async function leave() {
if (!text.value.trim() || await confirmDialog({ label: "Discard the note?", message: "What you wrote will be lost.", confirmLabel: "Discard", color: "red" })) {
text.value = "";
note.close("discarded");
}
}
note.addEventListener("ray-request-close", (e) => { e.preventDefault(); leave(); });
document.getElementById("dlg-note-cancel").addEventListener("click", leave);
note.addEventListener("ray-close", (e) => {
out("dlg-note", e.detail.returnValue === "saved" ? `Saved: "${text.value.trim() || "(empty)"}"` : "Discarded");
if (e.detail.returnValue === "saved") text.value = "";
});
document.getElementById("dlg-keys-filter").addEventListener("input", (e) => {
const q = e.currentTarget.value.trim().toLowerCase();
for (const row of document.querySelectorAll("#dlg-keys-table tr")) {
if (row.querySelector("th")) continue;
row.hidden = q !== "" && !row.textContent.toLowerCase().includes(q);
}
});
</script>
import type { CSSProperties } from "react";
import { RayButton, RayIcon, RayDialog, RayBadge, RayTabs, RayTab, RayTabPanel, RayAvatar, RayFileUpload, RayInput, RayTextarea, RaySelect, RaySegmentedControl, RayTable, RaySlider, RaySwitch, RayRadioGroup, RayRadio, RayCheckbox, RayAlert, RaySearch, RayKbd } from "@raylang/react";
export function DialogExample() {
return (
<>
<div className="demo-caption">The modal</div>
<div className="demo-modal-hero">
<div className="demo-modal-hero-text">
<strong>ray-dialog is the modal of ray-elements</strong>
<span>Backdrop, inert page, trapped and restored focus, Escape, stacking. This one takes 70% of the window (<code>size="70%" height="70%"</code>) and holds a whole settings screen: vertical tabs, fields, a table, sliders, switches and a confirmation stacked on top.</span>
</div>
<RayButton data-open="dlg-settings"><RayIcon slot="left" name="settings" />Project settings</RayButton>
<span data-out="dlg-settings" />
</div>
<RayDialog id="dlg-settings" label="Project settings" description="ray-remote · desktop app · last deployed 2 hours ago" size="70%" height="70%">
<RayBadge slot="header" variant="dot" color="green" normalCase>Live</RayBadge>
<RayTabs className="demo-settings" variant="outline" orientation="vertical" value="general">
<RayTab value="general"><RayIcon slot="left" name="settings" />General</RayTab>
<RayTab value="members"><RayIcon slot="left" name="user" />Members</RayTab>
<RayTab value="build"><RayIcon slot="left" name="terminal" />Build</RayTab>
<RayTab value="notifications"><RayIcon slot="left" name="info" />Notifications</RayTab>
<RayTab value="danger"><RayIcon slot="left" name="alert-triangle" />Danger zone</RayTab>
<RayTabPanel value="general">
<div className="demo-settings-section">
<div className="demo-settings-identity">
<RayAvatar name="Ray Remote" color="violet" size="xl" radius="md" />
<RayFileUpload variant="compact" accept="image/*" list="none" dropLabel="Drop a new icon" browseLabel="browse" />
</div>
<div className="demo-dialog-form">
<RayInput name="name" label="Name" value="ray-remote" required />
<RayInput name="id" label="Bundle id" value="dev.ray.remote" description="Reverse DNS, used by the installers." />
</div>
<RayTextarea name="about" label="Description" rows={2} value="Control a machine from your phone: terminal, files and screen." />
<div className="demo-dialog-form">
<RaySelect name="region" label="Update channel" value="stable">
<option value="stable">Stable</option>
<option value="beta">Beta</option>
<option value="nightly">Nightly</option>
</RaySelect>
<div className="demo-field">Visibility
<RaySegmentedControl name="visibility" value="team" aria-label="Visibility"><option value="private">Private</option><option value="team">Team</option><option value="public">Public</option></RaySegmentedControl>
</div>
</div>
</div>
</RayTabPanel>
<RayTabPanel value="members">
<div className="demo-settings-section">
<div className="demo-settings-invite">
<RayInput label="Invite by email" placeholder="name@company.com" type="email" style={{ flex: "1" }} />
<RaySelect label="Role" value="developer" style={{ width: "9rem" }}><option value="admin">Admin</option><option value="developer">Developer</option><option value="viewer">Viewer</option></RaySelect>
<RayButton variant="light">Invite</RayButton>
</div>
<RayTable id="dlg-settings-members" withBorder label="Members" />
</div>
</RayTabPanel>
<RayTabPanel value="build">
<div className="demo-settings-section">
<div className="demo-dialog-form">
<RaySelect label="Target" value="native"><option value="vm">VM</option><option value="native">Native (--release)</option></RaySelect>
<RayInput label="Entry" value="src/main.ray" />
</div>
<RaySlider label="Parallel jobs" min={1} max={16} value={6} showValue />
<RaySlider label="Cache size" min={0} max={8} step={0.5} value={2} showValue unit=" GB" color="teal" />
<div className="demo-settings-toggles">
<RaySwitch label="Run tests before every build" checked />
<RaySwitch label="Sign the macOS bundle" checked />
<RaySwitch label="Publish to the update channel" />
</div>
</div>
</RayTabPanel>
<RayTabPanel value="notifications">
<div className="demo-settings-section">
<RayRadioGroup label="Email me about" value="failures">
<RayRadio value="all">Every build</RayRadio>
<RayRadio value="failures">Failures only</RayRadio>
<RayRadio value="none">Nothing</RayRadio>
</RayRadioGroup>
<div className="demo-settings-toggles">
<RayCheckbox label="New member joined" checked />
<RayCheckbox label="Release published" checked />
<RayCheckbox label="Weekly usage report" />
</div>
</div>
</RayTabPanel>
<RayTabPanel value="danger">
<div className="demo-settings-section">
<RayAlert color="red" label="Careful">These actions affect everyone in the project and cannot be undone.</RayAlert>
<div className="demo-settings-danger">
<div><strong>Transfer ownership</strong><span>Move ray-remote to another team.</span></div>
<RayButton variant="default">Transfer…</RayButton>
</div>
<div className="demo-settings-danger">
<div><strong>Delete project</strong><span>Removes builds, releases and the update channel.</span></div>
<RayButton variant="light" color="red" id="dlg-settings-delete">Delete…</RayButton>
</div>
</div>
</RayTabPanel>
</RayTabs>
<span slot="footer" className="demo-settings-saved">Last saved 2 minutes ago</span>
<RayButton slot="footer" variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton slot="footer" data-dialog-close="save">Save changes</RayButton>
</RayDialog>
<div className="demo-caption">Patterns</div>
<div className="demo-launchers">
<article className="demo-launcher" style={{ "--c": "var(--ray-blue-light-color)", "--bg": "var(--ray-blue-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="file" /></span>
<div className="demo-launcher-text"><strong>Rename</strong><span>One field, focused on open; the button's value is the returnValue.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-rename">Open</RayButton><span data-out="dlg-rename" /></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-red-light-color)", "--bg": "var(--ray-red-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="alert-triangle" /></span>
<div className="demo-launcher-text"><strong>Confirm</strong><span><code>confirmDialog()</code> builds one and resolves to true or false.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" id="dlg-confirm-open">Delete…</RayButton><span data-out="dlg-confirm" /></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-violet-light-color)", "--bg": "var(--ray-violet-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="plus" /></span>
<div className="demo-launcher-text"><strong>Create project</strong><span>A larger form (size lg) with a header badge; read its fields on ray-close.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-create">Open</RayButton><span data-out="dlg-create" /></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-orange-light-color)", "--bg": "var(--ray-orange-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="download" /></span>
<div className="demo-launcher-text"><strong>Unsaved changes</strong><span>Persistent: no ×, Escape or backdrop; one of three answers.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-unsaved">Open</RayButton><span data-out="dlg-unsaved" /></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-teal-light-color)", "--bg": "var(--ray-teal-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="paperclip" /></span>
<div className="demo-launcher-text"><strong>Guarded draft</strong><span>ray-request-close is cancelable: closing a written note asks first.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-note">Open</RayButton><span data-out="dlg-note" /></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-gray-light-color)", "--bg": "var(--ray-gray-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="settings" /></span>
<div className="demo-launcher-text"><strong>Keyboard shortcuts</strong><span>Long content near the top (position top): the body scrolls, header and footer stay.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-keys">Open</RayButton></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-green-light-color)", "--bg": "var(--ray-green-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="terminal" /></span>
<div className="demo-launcher-text"><strong>Build log</strong><span>size="full" for a workspace: almost the whole window.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-log">Open</RayButton></div>
</article>
<article className="demo-launcher" style={{ "--c": "var(--ray-pink-light-color)", "--bg": "var(--ray-pink-light)" } as CSSProperties}>
<span className="demo-launcher-icon"><RayIcon name="star" /></span>
<div className="demo-launcher-text"><strong>What's new</strong><span>Small and announcement-like (size sm), with a hero and a single action.</span></div>
<div className="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-news">Open</RayButton></div>
</article>
</div>
<RayDialog id="dlg-rename" label="Rename file" size="sm">
<RayInput label="New name" value="main.ray" description="Letters, digits, dots and dashes." autoFocus />
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="rename">Rename</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-create" label="Create project" size="lg">
<RayBadge slot="header" variant="light" color="violet" normalCase>raylang 1.27</RayBadge>
<div className="demo-dialog-form">
<RayInput name="name" label="Name" value="ray-remote" required autoFocus />
<RaySelect name="template" label="Template" value="desktop">
<option value="desktop">Desktop app (std/ui)</option>
<option value="web">Web server (web)</option>
<option value="cli">Command line</option>
</RaySelect>
<div className="demo-field">Frontend
<RaySegmentedControl name="frontend" value="html" aria-label="Frontend"><option value="html">Plain HTML</option><option value="react">React</option><option value="vue">Vue</option></RaySegmentedControl>
</div>
<RaySwitch name="git" label="Initialize a git repository" checked />
</div>
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="create"><RayIcon slot="left" name="plus" />Create</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-unsaved" label="Save changes to main.ray?" size="sm" persistent hideClose>
<p className="demo-dialog-text">Your changes will be lost if you close without saving.</p>
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="subtle" color="red" data-dialog-close="discard" style={{ marginInlineEnd: "auto" }}>Don't save</RayButton>
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="save" autoFocus>Save</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-note" label="New note">
<RayTextarea id="dlg-note-text" label="Note" placeholder="Write something, then try Escape, the × or the backdrop." rows={4} autoFocus />
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="default" id="dlg-note-cancel">Cancel</RayButton>
<RayButton data-dialog-close="saved">Save note</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-keys" label="Keyboard shortcuts" position="top">
<RaySearch slot="header" size="xs" aria-label="Filter shortcuts" placeholder="Filter" id="dlg-keys-filter" style={{ width: "9rem" }} />
<table className="demo-keys" id="dlg-keys-table">
<tbody>
<tr><th colSpan={2}>General</th></tr>
<tr><td>Command palette</td><td><span><RayKbd>⌘</RayKbd><RayKbd>K</RayKbd></span></td></tr>
<tr><td>Settings</td><td><span><RayKbd>⌘</RayKbd><RayKbd>,</RayKbd></span></td></tr>
<tr><td>Toggle sidebar</td><td><span><RayKbd>⌘</RayKbd><RayKbd>B</RayKbd></span></td></tr>
<tr><td>Toggle theme</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>L</RayKbd></span></td></tr>
<tr><th colSpan={2}>Editor</th></tr>
<tr><td>Save</td><td><span><RayKbd>⌘</RayKbd><RayKbd>S</RayKbd></span></td></tr>
<tr><td>Find</td><td><span><RayKbd>⌘</RayKbd><RayKbd>F</RayKbd></span></td></tr>
<tr><td>Go to line</td><td><span><RayKbd>⌃</RayKbd><RayKbd>G</RayKbd></span></td></tr>
<tr><td>Format document</td><td><span><RayKbd>⌥</RayKbd><RayKbd>⇧</RayKbd><RayKbd>F</RayKbd></span></td></tr>
<tr><td>Comment line</td><td><span><RayKbd>⌘</RayKbd><RayKbd>/</RayKbd></span></td></tr>
<tr><th colSpan={2}>Run</th></tr>
<tr><td>Run program</td><td><span><RayKbd>⌘</RayKbd><RayKbd>R</RayKbd></span></td></tr>
<tr><td>Run tests</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>T</RayKbd></span></td></tr>
<tr><td>Build native</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>B</RayKbd></span></td></tr>
<tr><td>Stop</td><td><span><RayKbd>⌘</RayKbd><RayKbd>.</RayKbd></span></td></tr>
<tr><th colSpan={2}>Navigation</th></tr>
<tr><td>Next tab</td><td><span><RayKbd>⌃</RayKbd><RayKbd>Tab</RayKbd></span></td></tr>
<tr><td>Previous tab</td><td><span><RayKbd>⌃</RayKbd><RayKbd>⇧</RayKbd><RayKbd>Tab</RayKbd></span></td></tr>
<tr><td>Go to file</td><td><span><RayKbd>⌘</RayKbd><RayKbd>P</RayKbd></span></td></tr>
<tr><td>Go back</td><td><span><RayKbd>⌃</RayKbd><RayKbd>-</RayKbd></span></td></tr>
</tbody>
</table>
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="default" data-dialog-close="done">Done</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-log" label="Build log · ray-remote 0.4.1" size="full">
<RayBadge slot="header" variant="dot" color="green" normalCase>Passed</RayBadge>
<pre className="demo-dialog-log"><span className="p">$</span> ray build --native --release src/main.ray
<span className="d"> compiling</span> std/ui, std/json, net 0.5.0, web 0.4.6
<span className="d"> checking </span> 42 modules · 0 warnings
<span className="d"> linking </span> target/release/ray-remote (4.2 MB)
<span className="p">$</span> ray test
<span className="ok"> ok</span> session: resumes after reconnect (12 ms)
<span className="ok"> ok</span> files: upload with progress (31 ms)
<span className="ok"> ok</span> files: rejects paths outside the root (2 ms)
<span className="ok"> ok</span> ui: palette lists the menu commands (48 ms)
<span className="ok"> ok</span> ui: theme follows the system (7 ms)
<span className="d"> result: </span>5 test(s), all passed ✓
<span className="p">$</span> ray bundle --name "Ray Remote" -o dist
<span className="d"> bundle </span> dist/Ray Remote.app (ad-hoc signed)
<span className="ok"> done</span> in 18.4 s</pre>
<div slot="footer" style={{ display: "contents" }}>
<RayButton variant="default" data-dialog-close="close">Close</RayButton>
<RayButton variant="light" data-dialog-close="reveal"><RayIcon slot="left" name="folder" />Show in folder</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-news" label="What's new in ray·elements 0.4" size="sm">
<div className="demo-dialog-hero"><RayIcon name="star" size="2rem" /></div>
<ul className="demo-dialog-list">
<li><RayBadge variant="light" color="green">New</RayBadge> ray-toggle and ray-toggle-group</li>
<li><RayBadge variant="light" color="green">New</RayBadge> ray-file-upload with drag and drop</li>
<li><RayBadge variant="light" color="blue">Changed</RayBadge> every value change is a <code>change</code> event</li>
<li><RayBadge variant="light" color="gray">Docs</RayBadge> React and Vue code for every example</li>
</ul>
<div slot="footer" style={{ display: "contents" }}>
<RayButton fullWidth data-dialog-close="ok">Got it</RayButton>
</div>
</RayDialog>
</>
);
}
<template>
<div class="demo-caption">The modal</div>
<div class="demo-modal-hero">
<div class="demo-modal-hero-text">
<strong>ray-dialog is the modal of ray-elements</strong>
<span>Backdrop, inert page, trapped and restored focus, Escape, stacking. This one takes 70% of the window (<code>size="70%" height="70%"</code>) and holds a whole settings screen: vertical tabs, fields, a table, sliders, switches and a confirmation stacked on top.</span>
</div>
<RayButton data-open="dlg-settings"><RayIcon slot="left" name="settings" />Project settings</RayButton>
<span data-out="dlg-settings"></span>
</div>
<RayDialog id="dlg-settings" label="Project settings" description="ray-remote · desktop app · last deployed 2 hours ago" size="70%" height="70%">
<RayBadge slot="header" variant="dot" color="green" normal-case>Live</RayBadge>
<RayTabs class="demo-settings" variant="outline" orientation="vertical" value="general">
<RayTab value="general"><RayIcon slot="left" name="settings" />General</RayTab>
<RayTab value="members"><RayIcon slot="left" name="user" />Members</RayTab>
<RayTab value="build"><RayIcon slot="left" name="terminal" />Build</RayTab>
<RayTab value="notifications"><RayIcon slot="left" name="info" />Notifications</RayTab>
<RayTab value="danger"><RayIcon slot="left" name="alert-triangle" />Danger zone</RayTab>
<RayTabPanel value="general">
<div class="demo-settings-section">
<div class="demo-settings-identity">
<RayAvatar name="Ray Remote" color="violet" size="xl" radius="md" />
<RayFileUpload variant="compact" accept="image/*" list="none" drop-label="Drop a new icon" browse-label="browse" />
</div>
<div class="demo-dialog-form">
<RayInput name="name" label="Name" value="ray-remote" required />
<RayInput name="id" label="Bundle id" value="dev.ray.remote" description="Reverse DNS, used by the installers." />
</div>
<RayTextarea name="about" label="Description" :rows="2" value="Control a machine from your phone: terminal, files and screen." />
<div class="demo-dialog-form">
<RaySelect name="region" label="Update channel" value="stable">
<option value="stable">Stable</option>
<option value="beta">Beta</option>
<option value="nightly">Nightly</option>
</RaySelect>
<div class="demo-field">Visibility
<RaySegmentedControl name="visibility" value="team" aria-label="Visibility"><option value="private">Private</option><option value="team">Team</option><option value="public">Public</option></RaySegmentedControl>
</div>
</div>
</div>
</RayTabPanel>
<RayTabPanel value="members">
<div class="demo-settings-section">
<div class="demo-settings-invite">
<RayInput label="Invite by email" placeholder="name@company.com" type="email" style="flex: 1" />
<RaySelect label="Role" value="developer" style="width: 9rem"><option value="admin">Admin</option><option value="developer">Developer</option><option value="viewer">Viewer</option></RaySelect>
<RayButton variant="light">Invite</RayButton>
</div>
<RayTable id="dlg-settings-members" with-border label="Members" />
</div>
</RayTabPanel>
<RayTabPanel value="build">
<div class="demo-settings-section">
<div class="demo-dialog-form">
<RaySelect label="Target" value="native"><option value="vm">VM</option><option value="native">Native (--release)</option></RaySelect>
<RayInput label="Entry" value="src/main.ray" />
</div>
<RaySlider label="Parallel jobs" :min="1" :max="16" :value="6" show-value />
<RaySlider label="Cache size" :min="0" :max="8" :step="0.5" :value="2" show-value unit=" GB" color="teal" />
<div class="demo-settings-toggles">
<RaySwitch label="Run tests before every build" checked />
<RaySwitch label="Sign the macOS bundle" checked />
<RaySwitch label="Publish to the update channel" />
</div>
</div>
</RayTabPanel>
<RayTabPanel value="notifications">
<div class="demo-settings-section">
<RayRadioGroup label="Email me about" value="failures">
<RayRadio value="all">Every build</RayRadio>
<RayRadio value="failures">Failures only</RayRadio>
<RayRadio value="none">Nothing</RayRadio>
</RayRadioGroup>
<div class="demo-settings-toggles">
<RayCheckbox label="New member joined" checked />
<RayCheckbox label="Release published" checked />
<RayCheckbox label="Weekly usage report" />
</div>
</div>
</RayTabPanel>
<RayTabPanel value="danger">
<div class="demo-settings-section">
<RayAlert color="red" label="Careful">These actions affect everyone in the project and cannot be undone.</RayAlert>
<div class="demo-settings-danger">
<div><strong>Transfer ownership</strong><span>Move ray-remote to another team.</span></div>
<RayButton variant="default">Transfer…</RayButton>
</div>
<div class="demo-settings-danger">
<div><strong>Delete project</strong><span>Removes builds, releases and the update channel.</span></div>
<RayButton variant="light" color="red" id="dlg-settings-delete">Delete…</RayButton>
</div>
</div>
</RayTabPanel>
</RayTabs>
<span slot="footer" class="demo-settings-saved">Last saved 2 minutes ago</span>
<RayButton slot="footer" variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton slot="footer" data-dialog-close="save">Save changes</RayButton>
</RayDialog>
<div class="demo-caption">Patterns</div>
<div class="demo-launchers">
<article class="demo-launcher" style="--c: var(--ray-blue-light-color); --bg: var(--ray-blue-light)">
<span class="demo-launcher-icon"><RayIcon name="file" /></span>
<div class="demo-launcher-text"><strong>Rename</strong><span>One field, focused on open; the button's value is the returnValue.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-rename">Open</RayButton><span data-out="dlg-rename"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-red-light-color); --bg: var(--ray-red-light)">
<span class="demo-launcher-icon"><RayIcon name="alert-triangle" /></span>
<div class="demo-launcher-text"><strong>Confirm</strong><span><code>confirmDialog()</code> builds one and resolves to true or false.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" id="dlg-confirm-open">Delete…</RayButton><span data-out="dlg-confirm"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-violet-light-color); --bg: var(--ray-violet-light)">
<span class="demo-launcher-icon"><RayIcon name="plus" /></span>
<div class="demo-launcher-text"><strong>Create project</strong><span>A larger form (size lg) with a header badge; read its fields on ray-close.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-create">Open</RayButton><span data-out="dlg-create"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-orange-light-color); --bg: var(--ray-orange-light)">
<span class="demo-launcher-icon"><RayIcon name="download" /></span>
<div class="demo-launcher-text"><strong>Unsaved changes</strong><span>Persistent: no ×, Escape or backdrop; one of three answers.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-unsaved">Open</RayButton><span data-out="dlg-unsaved"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-teal-light-color); --bg: var(--ray-teal-light)">
<span class="demo-launcher-icon"><RayIcon name="paperclip" /></span>
<div class="demo-launcher-text"><strong>Guarded draft</strong><span>ray-request-close is cancelable: closing a written note asks first.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-note">Open</RayButton><span data-out="dlg-note"></span></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-gray-light-color); --bg: var(--ray-gray-light)">
<span class="demo-launcher-icon"><RayIcon name="settings" /></span>
<div class="demo-launcher-text"><strong>Keyboard shortcuts</strong><span>Long content near the top (position top): the body scrolls, header and footer stay.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-keys">Open</RayButton></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-green-light-color); --bg: var(--ray-green-light)">
<span class="demo-launcher-icon"><RayIcon name="terminal" /></span>
<div class="demo-launcher-text"><strong>Build log</strong><span>size="full" for a workspace: almost the whole window.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-log">Open</RayButton></div>
</article>
<article class="demo-launcher" style="--c: var(--ray-pink-light-color); --bg: var(--ray-pink-light)">
<span class="demo-launcher-icon"><RayIcon name="star" /></span>
<div class="demo-launcher-text"><strong>What's new</strong><span>Small and announcement-like (size sm), with a hero and a single action.</span></div>
<div class="demo-launcher-foot"><RayButton size="sm" variant="default" data-open="dlg-news">Open</RayButton></div>
</article>
</div>
<RayDialog id="dlg-rename" label="Rename file" size="sm">
<RayInput label="New name" value="main.ray" description="Letters, digits, dots and dashes." autofocus />
<div slot="footer" style="display: contents">
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="rename">Rename</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-create" label="Create project" size="lg">
<RayBadge slot="header" variant="light" color="violet" normal-case>raylang 1.27</RayBadge>
<div class="demo-dialog-form">
<RayInput name="name" label="Name" value="ray-remote" required autofocus />
<RaySelect name="template" label="Template" value="desktop">
<option value="desktop">Desktop app (std/ui)</option>
<option value="web">Web server (web)</option>
<option value="cli">Command line</option>
</RaySelect>
<div class="demo-field">Frontend
<RaySegmentedControl name="frontend" value="html" aria-label="Frontend"><option value="html">Plain HTML</option><option value="react">React</option><option value="vue">Vue</option></RaySegmentedControl>
</div>
<RaySwitch name="git" label="Initialize a git repository" checked />
</div>
<div slot="footer" style="display: contents">
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="create"><RayIcon slot="left" name="plus" />Create</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-unsaved" label="Save changes to main.ray?" size="sm" persistent hide-close>
<p class="demo-dialog-text">Your changes will be lost if you close without saving.</p>
<div slot="footer" style="display: contents">
<RayButton variant="subtle" color="red" data-dialog-close="discard" style="margin-inline-end: auto">Don't save</RayButton>
<RayButton variant="default" data-dialog-close="cancel">Cancel</RayButton>
<RayButton data-dialog-close="save" autofocus>Save</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-note" label="New note">
<RayTextarea id="dlg-note-text" label="Note" placeholder="Write something, then try Escape, the × or the backdrop." :rows="4" autofocus />
<div slot="footer" style="display: contents">
<RayButton variant="default" id="dlg-note-cancel">Cancel</RayButton>
<RayButton data-dialog-close="saved">Save note</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-keys" label="Keyboard shortcuts" position="top">
<RaySearch slot="header" size="xs" aria-label="Filter shortcuts" placeholder="Filter" id="dlg-keys-filter" style="width: 9rem" />
<table class="demo-keys" id="dlg-keys-table">
<tbody>
<tr><th colspan="2">General</th></tr>
<tr><td>Command palette</td><td><span><RayKbd>⌘</RayKbd><RayKbd>K</RayKbd></span></td></tr>
<tr><td>Settings</td><td><span><RayKbd>⌘</RayKbd><RayKbd>,</RayKbd></span></td></tr>
<tr><td>Toggle sidebar</td><td><span><RayKbd>⌘</RayKbd><RayKbd>B</RayKbd></span></td></tr>
<tr><td>Toggle theme</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>L</RayKbd></span></td></tr>
<tr><th colspan="2">Editor</th></tr>
<tr><td>Save</td><td><span><RayKbd>⌘</RayKbd><RayKbd>S</RayKbd></span></td></tr>
<tr><td>Find</td><td><span><RayKbd>⌘</RayKbd><RayKbd>F</RayKbd></span></td></tr>
<tr><td>Go to line</td><td><span><RayKbd>⌃</RayKbd><RayKbd>G</RayKbd></span></td></tr>
<tr><td>Format document</td><td><span><RayKbd>⌥</RayKbd><RayKbd>⇧</RayKbd><RayKbd>F</RayKbd></span></td></tr>
<tr><td>Comment line</td><td><span><RayKbd>⌘</RayKbd><RayKbd>/</RayKbd></span></td></tr>
<tr><th colspan="2">Run</th></tr>
<tr><td>Run program</td><td><span><RayKbd>⌘</RayKbd><RayKbd>R</RayKbd></span></td></tr>
<tr><td>Run tests</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>T</RayKbd></span></td></tr>
<tr><td>Build native</td><td><span><RayKbd>⌘</RayKbd><RayKbd>⇧</RayKbd><RayKbd>B</RayKbd></span></td></tr>
<tr><td>Stop</td><td><span><RayKbd>⌘</RayKbd><RayKbd>.</RayKbd></span></td></tr>
<tr><th colspan="2">Navigation</th></tr>
<tr><td>Next tab</td><td><span><RayKbd>⌃</RayKbd><RayKbd>Tab</RayKbd></span></td></tr>
<tr><td>Previous tab</td><td><span><RayKbd>⌃</RayKbd><RayKbd>⇧</RayKbd><RayKbd>Tab</RayKbd></span></td></tr>
<tr><td>Go to file</td><td><span><RayKbd>⌘</RayKbd><RayKbd>P</RayKbd></span></td></tr>
<tr><td>Go back</td><td><span><RayKbd>⌃</RayKbd><RayKbd>-</RayKbd></span></td></tr>
</tbody>
</table>
<div slot="footer" style="display: contents">
<RayButton variant="default" data-dialog-close="done">Done</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-log" label="Build log · ray-remote 0.4.1" size="full">
<RayBadge slot="header" variant="dot" color="green" normal-case>Passed</RayBadge>
<pre class="demo-dialog-log"><span class="p">$</span> ray build --native --release src/main.ray
<span class="d"> compiling</span> std/ui, std/json, net 0.5.0, web 0.4.6
<span class="d"> checking </span> 42 modules · 0 warnings
<span class="d"> linking </span> target/release/ray-remote (4.2 MB)
<span class="p">$</span> ray test
<span class="ok"> ok</span> session: resumes after reconnect (12 ms)
<span class="ok"> ok</span> files: upload with progress (31 ms)
<span class="ok"> ok</span> files: rejects paths outside the root (2 ms)
<span class="ok"> ok</span> ui: palette lists the menu commands (48 ms)
<span class="ok"> ok</span> ui: theme follows the system (7 ms)
<span class="d"> result: </span>5 test(s), all passed ✓
<span class="p">$</span> ray bundle --name "Ray Remote" -o dist
<span class="d"> bundle </span> dist/Ray Remote.app (ad-hoc signed)
<span class="ok"> done</span> in 18.4 s</pre>
<div slot="footer" style="display: contents">
<RayButton variant="default" data-dialog-close="close">Close</RayButton>
<RayButton variant="light" data-dialog-close="reveal"><RayIcon slot="left" name="folder" />Show in folder</RayButton>
</div>
</RayDialog>
<RayDialog id="dlg-news" label="What's new in ray·elements 0.4" size="sm">
<div class="demo-dialog-hero"><RayIcon name="star" size="2rem" /></div>
<ul class="demo-dialog-list">
<li><RayBadge variant="light" color="green">New</RayBadge> ray-toggle and ray-toggle-group</li>
<li><RayBadge variant="light" color="green">New</RayBadge> ray-file-upload with drag and drop</li>
<li><RayBadge variant="light" color="blue">Changed</RayBadge> every value change is a <code>change</code> event</li>
<li><RayBadge variant="light" color="gray">Docs</RayBadge> React and Vue code for every example</li>
</ul>
<div slot="footer" style="display: contents">
<RayButton full-width data-dialog-close="ok">Got it</RayButton>
</div>
</RayDialog>
</template>