@stacksjs/components 0.2.890 → 0.2.892
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppearancePicker-61r20jpp.stx → AppearancePicker-30fetv0a.stx} +45 -0
- package/dist/{Button-r8q6v9m3.stx → Button-ghdfqwg0.stx} +54 -1
- package/dist/{Checkbox-52mhrzkz.stx → Checkbox-355qsbwd.stx} +13 -3
- package/dist/{PasswordInput-z2g5ha65.stx → PasswordInput-hhq64qzr.stx} +15 -1
- package/dist/{SegmentedControl-7q0t8c9s.stx → SegmentedControl-b93n9n2v.stx} +9 -1
- package/dist/{Select-ygzchedx.stx → Select-p8mgxthn.stx} +13 -2
- package/dist/{SettingsGroup-dkae46k5.stx → SettingsGroup-g1hnxp1p.stx} +52 -0
- package/dist/{SettingsPane-jbd1gbdt.stx → SettingsPane-9svk1w3e.stx} +21 -2
- package/dist/{SettingsPaneHeader-f0cvkqs7.stx → SettingsPaneHeader-am42srhp.stx} +24 -0
- package/dist/{SettingsRow-4cxbsf1q.stx → SettingsRow-kgda3nv1.stx} +63 -0
- package/dist/{SettingsSidebarGroup-p2ygv5yy.stx → SettingsSidebarGroup-4ag5qjpw.stx} +17 -0
- package/dist/{SettingsSidebarItem-x8fsn3w5.stx → SettingsSidebarItem-ga2jxq53.stx} +33 -0
- package/dist/SettingsUpdateRow-ajpnqx8a.stx +143 -0
- package/dist/{SettingsWindow-mm490ymt.stx → SettingsWindow-586aps08.stx} +186 -19
- package/dist/{Switch-ga9ap8n8.stx → Switch-vd8k23sr.stx} +4 -1
- package/dist/{TextInput-m4a4kpfy.stx → TextInput-492d1c3n.stx} +15 -2
- package/dist/component-api/component-api.js +21 -3
- package/dist/index.js +24 -24
- package/dist/settings/settings.js +371 -15
- package/dist/ui/appearance-picker/AppearancePicker.d.ts +1 -0
- package/dist/ui/button/Button.d.ts +16 -0
- package/dist/ui/checkbox/Checkbox.d.ts +7 -0
- package/dist/ui/input/PasswordInput.d.ts +10 -0
- package/dist/ui/input/TextInput.d.ts +11 -0
- package/dist/ui/segmented-control/SegmentedControl.d.ts +7 -0
- package/dist/ui/settings/SettingsGroup.d.ts +5 -0
- package/dist/ui/settings/SettingsPane.d.ts +4 -0
- package/dist/ui/settings/SettingsPaneHeader.d.ts +10 -1
- package/dist/ui/settings/SettingsRow.d.ts +20 -1
- package/dist/ui/settings/SettingsSidebarGroup.d.ts +5 -0
- package/dist/ui/settings/SettingsSidebarItem.d.ts +11 -1
- package/dist/ui/settings/SettingsUpdateRow.d.ts +34 -0
- package/dist/ui/settings/SettingsWindow.d.ts +12 -0
- package/dist/ui/settings/index.d.ts +18 -0
- package/dist/ui/settings/native-theme.d.ts +130 -0
- package/dist/ui/settings/native.d.ts +51 -0
- package/dist/ui/settings/settings.d.ts +5 -2
- package/dist/ui/settings/update.d.ts +45 -0
- package/dist/utils/component-api.d.ts +2 -0
- package/package.json +3 -3
- package/src/ui/appearance-picker/AppearancePicker.stx +45 -0
- package/src/ui/appearance-picker/README.md +4 -0
- package/src/ui/button/Button.stx +54 -1
- package/src/ui/checkbox/Checkbox.stx +13 -3
- package/src/ui/input/PasswordInput.stx +15 -1
- package/src/ui/input/TextInput.stx +15 -2
- package/src/ui/segmented-control/SegmentedControl.stx +9 -1
- package/src/ui/select/Select.stx +13 -2
- package/src/ui/settings/README.md +210 -15
- package/src/ui/settings/SettingsGroup.stx +52 -0
- package/src/ui/settings/SettingsPane.stx +21 -2
- package/src/ui/settings/SettingsPaneHeader.stx +24 -0
- package/src/ui/settings/SettingsRow.stx +63 -0
- package/src/ui/settings/SettingsSidebarGroup.stx +17 -0
- package/src/ui/settings/SettingsSidebarItem.stx +33 -0
- package/src/ui/settings/SettingsUpdateRow.stx +143 -0
- package/src/ui/settings/SettingsWindow.stx +186 -19
- package/src/ui/settings/index.ts +31 -3
- package/src/ui/settings/native-theme.ts +169 -0
- package/src/ui/settings/native.ts +456 -0
- package/src/ui/settings/settings.ts +5 -2
- package/src/ui/settings/update.ts +119 -0
- package/src/ui/switch/Switch.stx +4 -1
- package/src/utils/component-api.ts +36 -3
|
@@ -175,11 +175,364 @@ function settingsTypeAheadMatch(labels, buffer, current) {
|
|
|
175
175
|
}
|
|
176
176
|
return -1;
|
|
177
177
|
}
|
|
178
|
+
// src/ui/settings/native.ts
|
|
179
|
+
var ROOT = "data-stx-settings";
|
|
180
|
+
var ITEM = "data-settings-item";
|
|
181
|
+
var PANE = "data-settings-pane";
|
|
182
|
+
var ROW = "data-settings-row";
|
|
183
|
+
|
|
184
|
+
class SettingsWindowTree {
|
|
185
|
+
tree;
|
|
186
|
+
root;
|
|
187
|
+
options;
|
|
188
|
+
callbacks;
|
|
189
|
+
history = emptySettingsHistory();
|
|
190
|
+
current = "";
|
|
191
|
+
query = "";
|
|
192
|
+
hits = [];
|
|
193
|
+
highlighted = null;
|
|
194
|
+
highlightTimer = null;
|
|
195
|
+
pressed = new Map;
|
|
196
|
+
visible = new Map;
|
|
197
|
+
disposers = [];
|
|
198
|
+
destroyed = false;
|
|
199
|
+
constructor(tree, root, options = {}, callbacks = {}) {
|
|
200
|
+
this.tree = tree;
|
|
201
|
+
this.root = root;
|
|
202
|
+
this.options = options;
|
|
203
|
+
this.callbacks = callbacks;
|
|
204
|
+
this.hear();
|
|
205
|
+
this.disposers.push(tree.observeChildren(root, () => {
|
|
206
|
+
if (this.destroyed)
|
|
207
|
+
return;
|
|
208
|
+
this.hear();
|
|
209
|
+
this.show(false);
|
|
210
|
+
this.applySearch(false);
|
|
211
|
+
}));
|
|
212
|
+
const panes = this.panes();
|
|
213
|
+
const shown = this.paneNodes().find((pane) => this.tree.getAttribute(pane, "data-active") != null);
|
|
214
|
+
this.history = settingsHistoryVisit(this.history, resolveSettingsPane(panes, this.stored(), options.pane, shown ? this.attribute(shown, PANE) : ""));
|
|
215
|
+
this.show(true);
|
|
216
|
+
this.applySearch(false);
|
|
217
|
+
}
|
|
218
|
+
getPane() {
|
|
219
|
+
return this.current;
|
|
220
|
+
}
|
|
221
|
+
showPane(id) {
|
|
222
|
+
if (!findSettingsPane(this.panes(), id))
|
|
223
|
+
return false;
|
|
224
|
+
this.open(id);
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
revealSetting(id) {
|
|
228
|
+
if (!id)
|
|
229
|
+
return false;
|
|
230
|
+
const row = this.rowNodes().find((node) => this.attribute(node, "data-setting") === id);
|
|
231
|
+
const pane = row ? this.paneOf(row) : "";
|
|
232
|
+
if (!row || !pane)
|
|
233
|
+
return false;
|
|
234
|
+
this.open(pane);
|
|
235
|
+
this.reveal(row);
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
back() {
|
|
239
|
+
this.travel(settingsHistoryBack(this.history, this.panes()));
|
|
240
|
+
}
|
|
241
|
+
forward() {
|
|
242
|
+
this.travel(settingsHistoryForward(this.history));
|
|
243
|
+
}
|
|
244
|
+
search(query) {
|
|
245
|
+
this.query = String(query ?? "");
|
|
246
|
+
this.applySearch(true);
|
|
247
|
+
}
|
|
248
|
+
chooseResult(position) {
|
|
249
|
+
const found = this.hits[position];
|
|
250
|
+
if (!found || this.tree.parent(found.row) === null)
|
|
251
|
+
return;
|
|
252
|
+
this.open(found.hit.pane);
|
|
253
|
+
this.reveal(found.row);
|
|
254
|
+
}
|
|
255
|
+
destroy() {
|
|
256
|
+
this.destroyed = true;
|
|
257
|
+
for (const dispose of this.disposers)
|
|
258
|
+
dispose();
|
|
259
|
+
this.disposers.length = 0;
|
|
260
|
+
for (const stop of this.pressed.values())
|
|
261
|
+
stop();
|
|
262
|
+
this.pressed.clear();
|
|
263
|
+
this.visible.clear();
|
|
264
|
+
this.clearHighlight();
|
|
265
|
+
}
|
|
266
|
+
attribute(node, name) {
|
|
267
|
+
return this.tree.getAttribute(node, name) ?? "";
|
|
268
|
+
}
|
|
269
|
+
toggle(node, shown) {
|
|
270
|
+
const authored = this.attribute(node, "class").split(/\s+/).filter(Boolean);
|
|
271
|
+
const was = this.visible.has(node) ? this.visible.get(node) : !authored.includes("hidden");
|
|
272
|
+
this.visible.set(node, shown);
|
|
273
|
+
if (was === shown)
|
|
274
|
+
return;
|
|
275
|
+
const classes = authored.filter((name) => name !== "hidden");
|
|
276
|
+
this.tree.setAttribute(node, "class", (shown ? classes : [...classes, "hidden"]).join(" "));
|
|
277
|
+
}
|
|
278
|
+
has(node, name) {
|
|
279
|
+
return this.tree.getAttribute(node, name) != null;
|
|
280
|
+
}
|
|
281
|
+
closest(node, name) {
|
|
282
|
+
for (let current = node;current; current = this.tree.parent(current)) {
|
|
283
|
+
if (this.has(current, name))
|
|
284
|
+
return current;
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
all(name, within = this.root) {
|
|
289
|
+
return this.tree.descendants(within).filter((node) => this.has(node, name) && this.closest(this.tree.parent(node), ROOT) === this.root);
|
|
290
|
+
}
|
|
291
|
+
paneNodes() {
|
|
292
|
+
return this.all(PANE);
|
|
293
|
+
}
|
|
294
|
+
panes() {
|
|
295
|
+
return this.paneNodes().map((pane) => {
|
|
296
|
+
const id = this.attribute(pane, PANE);
|
|
297
|
+
return { id, title: this.attribute(pane, "data-title") || id, keywords: this.attribute(pane, "data-keywords"), parent: this.attribute(pane, "data-parent") };
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
itemNodes() {
|
|
301
|
+
return this.all(ITEM);
|
|
302
|
+
}
|
|
303
|
+
items() {
|
|
304
|
+
return this.itemNodes().map((item) => ({
|
|
305
|
+
id: this.attribute(item, ITEM),
|
|
306
|
+
label: this.attribute(item, "data-label").trim(),
|
|
307
|
+
keywords: this.attribute(item, "data-keywords")
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
rowNodes() {
|
|
311
|
+
return this.all(ROW).filter((row) => this.paneOf(row) !== "");
|
|
312
|
+
}
|
|
313
|
+
paneOf(node) {
|
|
314
|
+
const pane = this.closest(node, PANE);
|
|
315
|
+
return pane ? this.attribute(pane, PANE) : "";
|
|
316
|
+
}
|
|
317
|
+
stored() {
|
|
318
|
+
if (!this.options.storageKey || !this.options.storage)
|
|
319
|
+
return "";
|
|
320
|
+
try {
|
|
321
|
+
return this.options.storage.get(settingsStorageName(this.options.storageKey)) || "";
|
|
322
|
+
} catch {
|
|
323
|
+
return "";
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
store() {
|
|
327
|
+
if (!this.options.storageKey || !this.options.storage || !this.current)
|
|
328
|
+
return;
|
|
329
|
+
try {
|
|
330
|
+
this.options.storage.set(settingsStorageName(this.options.storageKey), this.current);
|
|
331
|
+
} catch {}
|
|
332
|
+
}
|
|
333
|
+
hear() {
|
|
334
|
+
const live = new Set;
|
|
335
|
+
for (const item of this.itemNodes()) {
|
|
336
|
+
live.add(item);
|
|
337
|
+
if (!this.pressed.has(item))
|
|
338
|
+
this.pressed.set(item, this.tree.listen(item, "click", () => this.open(this.attribute(item, ITEM))));
|
|
339
|
+
}
|
|
340
|
+
for (const row of this.rowNodes()) {
|
|
341
|
+
if (!this.has(row, "data-navigate"))
|
|
342
|
+
continue;
|
|
343
|
+
live.add(row);
|
|
344
|
+
if (!this.pressed.has(row))
|
|
345
|
+
this.pressed.set(row, this.tree.listen(row, "click", () => this.navigate(row)));
|
|
346
|
+
}
|
|
347
|
+
for (const [node, stop] of this.pressed) {
|
|
348
|
+
if (live.has(node))
|
|
349
|
+
continue;
|
|
350
|
+
stop();
|
|
351
|
+
this.pressed.delete(node);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
navigate(row) {
|
|
355
|
+
if (this.attribute(row, "aria-disabled") === "true")
|
|
356
|
+
return;
|
|
357
|
+
const id = this.attribute(row, "data-navigate");
|
|
358
|
+
if (!findSettingsPane(this.panes(), id))
|
|
359
|
+
return;
|
|
360
|
+
const from = this.current;
|
|
361
|
+
this.open(id);
|
|
362
|
+
this.callbacks.onNavigate?.({ id, from, setting: this.attribute(row, "data-setting") });
|
|
363
|
+
}
|
|
364
|
+
open(id) {
|
|
365
|
+
if (!id)
|
|
366
|
+
return;
|
|
367
|
+
this.history = settingsHistoryVisit(this.history, id);
|
|
368
|
+
this.show(true);
|
|
369
|
+
}
|
|
370
|
+
travel(next) {
|
|
371
|
+
if (next === this.history)
|
|
372
|
+
return;
|
|
373
|
+
this.history = next;
|
|
374
|
+
this.show(true);
|
|
375
|
+
}
|
|
376
|
+
show(report) {
|
|
377
|
+
const panes = this.panes();
|
|
378
|
+
const id = settingsHistoryCurrent(this.history);
|
|
379
|
+
const info = findSettingsPane(panes, id);
|
|
380
|
+
if (!info)
|
|
381
|
+
return;
|
|
382
|
+
for (const pane of this.paneNodes()) {
|
|
383
|
+
this.toggle(pane, this.attribute(pane, PANE) === id);
|
|
384
|
+
}
|
|
385
|
+
const selected = settingsSidebarPane(panes, id);
|
|
386
|
+
for (const item of this.itemNodes()) {
|
|
387
|
+
const on = this.attribute(item, ITEM) === selected;
|
|
388
|
+
for (const node of [item, ...this.tree.descendants(item)])
|
|
389
|
+
this.tree.setAttribute(node, "aria-selected", on ? "true" : "false");
|
|
390
|
+
}
|
|
391
|
+
const changed = this.current !== id;
|
|
392
|
+
this.current = id;
|
|
393
|
+
this.report();
|
|
394
|
+
if (changed) {
|
|
395
|
+
this.store();
|
|
396
|
+
if (report)
|
|
397
|
+
this.callbacks.onPane?.({ id, title: info.title, parent: settingsParentPane(panes, id) });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
report() {
|
|
401
|
+
const panes = this.panes();
|
|
402
|
+
const info = findSettingsPane(panes, this.current);
|
|
403
|
+
const searching = this.query.trim() !== "";
|
|
404
|
+
this.callbacks.onState?.({
|
|
405
|
+
pane: this.current,
|
|
406
|
+
title: info?.title ?? "",
|
|
407
|
+
canGoBack: settingsCanGoBack(this.history, panes),
|
|
408
|
+
canGoForward: settingsCanGoForward(this.history),
|
|
409
|
+
query: this.query,
|
|
410
|
+
searching,
|
|
411
|
+
results: this.hits.map(({ hit }, position) => ({ position, label: hit.label, pane: hit.paneTitle })),
|
|
412
|
+
empty: searching && this.shownItems === 0 && this.hits.length === 0
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
shownItems = 0;
|
|
416
|
+
applySearch(report) {
|
|
417
|
+
const rows = this.rowNodes();
|
|
418
|
+
const index = rows.map((row) => ({
|
|
419
|
+
id: this.attribute(row, "data-setting"),
|
|
420
|
+
label: this.attribute(row, "data-label").trim(),
|
|
421
|
+
keywords: this.attribute(row, "data-keywords"),
|
|
422
|
+
pane: this.paneOf(row)
|
|
423
|
+
}));
|
|
424
|
+
const found = searchSettings(this.query, { panes: this.panes(), items: this.items(), rows: index });
|
|
425
|
+
const searching = found.query !== "";
|
|
426
|
+
const shown = new Set;
|
|
427
|
+
for (const item of this.itemNodes()) {
|
|
428
|
+
const on = !searching || found.panes.includes(this.attribute(item, ITEM));
|
|
429
|
+
if (on)
|
|
430
|
+
shown.add(item);
|
|
431
|
+
this.toggle(item, on);
|
|
432
|
+
}
|
|
433
|
+
this.shownItems = searching ? found.panes.length : shown.size;
|
|
434
|
+
let first = true;
|
|
435
|
+
for (const group of this.all("data-settings-group")) {
|
|
436
|
+
const on = this.all(ITEM, group).some((item) => shown.has(item));
|
|
437
|
+
this.toggle(group, on);
|
|
438
|
+
for (const gap of this.all("data-settings-group-gap", group))
|
|
439
|
+
this.toggle(gap, on && !first);
|
|
440
|
+
if (on)
|
|
441
|
+
first = false;
|
|
442
|
+
}
|
|
443
|
+
for (const account of this.all("data-settings-account"))
|
|
444
|
+
this.toggle(account, !searching);
|
|
445
|
+
this.hits = found.settings.map((hit) => ({ hit, row: rows[hit.row] }));
|
|
446
|
+
this.report();
|
|
447
|
+
if (report) {
|
|
448
|
+
this.callbacks.onSearch?.({
|
|
449
|
+
query: this.query.trim(),
|
|
450
|
+
panes: found.panes,
|
|
451
|
+
settings: found.settings.map((hit) => ({ id: hit.id, label: hit.label, pane: hit.pane }))
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
reveal(row) {
|
|
456
|
+
this.clearHighlight();
|
|
457
|
+
this.tree.setAttribute(row, "data-highlight", "");
|
|
458
|
+
const wash = this.options.wash?.();
|
|
459
|
+
if (wash)
|
|
460
|
+
this.tree.setStyle(row, { backgroundColor: wash });
|
|
461
|
+
this.highlighted = row;
|
|
462
|
+
this.highlightTimer = setTimeout(() => this.clearHighlight(), SETTINGS_HIGHLIGHT_MS);
|
|
463
|
+
}
|
|
464
|
+
clearHighlight() {
|
|
465
|
+
if (this.highlightTimer)
|
|
466
|
+
clearTimeout(this.highlightTimer);
|
|
467
|
+
this.highlightTimer = null;
|
|
468
|
+
if (this.highlighted) {
|
|
469
|
+
this.tree.removeAttribute(this.highlighted, "data-highlight");
|
|
470
|
+
this.tree.setStyle(this.highlighted, { backgroundColor: "transparent" });
|
|
471
|
+
}
|
|
472
|
+
this.highlighted = null;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
// src/ui/settings/update.ts
|
|
476
|
+
var SETTINGS_UPDATE_LABELS = {
|
|
477
|
+
check: "Check Now",
|
|
478
|
+
install: "Download and Install",
|
|
479
|
+
relaunch: "Restart to Update"
|
|
480
|
+
};
|
|
481
|
+
function percent(progress) {
|
|
482
|
+
const value = Number(progress);
|
|
483
|
+
if (!Number.isFinite(value))
|
|
484
|
+
return "";
|
|
485
|
+
return `${Math.round(Math.min(1, Math.max(0, value)) * 100)}%`;
|
|
486
|
+
}
|
|
487
|
+
function settingsUpdateView(status, appName = "") {
|
|
488
|
+
const name = String(appName || "").trim();
|
|
489
|
+
const version = String(status?.currentVersion || "").trim();
|
|
490
|
+
const title = [name, version].filter(Boolean).join(" ");
|
|
491
|
+
const view = (sentence, action, extra = {}) => ({
|
|
492
|
+
title,
|
|
493
|
+
sentence,
|
|
494
|
+
action,
|
|
495
|
+
actionLabel: action ? SETTINGS_UPDATE_LABELS[action] : "",
|
|
496
|
+
busy: false,
|
|
497
|
+
progress: "",
|
|
498
|
+
failed: false,
|
|
499
|
+
...extra
|
|
500
|
+
});
|
|
501
|
+
if (!status || typeof status.state !== "string")
|
|
502
|
+
return view("", null);
|
|
503
|
+
const app = name || "This app";
|
|
504
|
+
const next = String(status.version || "").trim();
|
|
505
|
+
const update = next ? `Version ${next}` : "An update";
|
|
506
|
+
const canInstall = status.selfUpdating !== false;
|
|
507
|
+
const why = String(status.reason || "").trim();
|
|
508
|
+
switch (status.state) {
|
|
509
|
+
case "unavailable":
|
|
510
|
+
return view(why || `${app} cannot update itself.`, null);
|
|
511
|
+
case "idle":
|
|
512
|
+
return view("Check for a newer version.", "check");
|
|
513
|
+
case "checking":
|
|
514
|
+
return view("Checking for updates...", "check", { busy: true });
|
|
515
|
+
case "current":
|
|
516
|
+
return view(`${app} is up to date.`, "check");
|
|
517
|
+
case "available":
|
|
518
|
+
return canInstall ? view(`${update} is available.`, "install") : view(`${update} is available. ${why || `${app} cannot update itself.`}`, "check");
|
|
519
|
+
case "downloading":
|
|
520
|
+
return view(`Downloading ${next ? `version ${next}` : "the update"}...`, "install", { busy: true, progress: percent(status.progress) });
|
|
521
|
+
case "installing":
|
|
522
|
+
return view(`Installing ${next ? `version ${next}` : "the update"}...`, "install", { busy: true });
|
|
523
|
+
case "installed":
|
|
524
|
+
return view(`${update} is installed. Restart ${app} to finish updating.`, "relaunch");
|
|
525
|
+
case "error":
|
|
526
|
+
return view(String(status.error || "").trim() || "The update could not be completed.", "check", { failed: true });
|
|
527
|
+
default:
|
|
528
|
+
return view("", null);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
178
531
|
// src/ui/settings/view.ts
|
|
179
|
-
var
|
|
180
|
-
var
|
|
181
|
-
var
|
|
182
|
-
var
|
|
532
|
+
var ROOT2 = "[data-stx-settings]";
|
|
533
|
+
var ITEM2 = "[data-settings-item]";
|
|
534
|
+
var PANE2 = "[data-settings-pane]";
|
|
535
|
+
var ROW2 = "[data-settings-row]";
|
|
183
536
|
var RESULT = "[data-settings-result]";
|
|
184
537
|
var CONTROLS = 'button, a[href], input, select, textarea, label, [role="switch"], [role="checkbox"], [role="radio"], [role="slider"], [role="button"], [contenteditable]';
|
|
185
538
|
function domId(text) {
|
|
@@ -293,14 +646,14 @@ class SettingsWindowView {
|
|
|
293
646
|
return this.all(selector)[0] ?? null;
|
|
294
647
|
}
|
|
295
648
|
all(selector, within = this.root) {
|
|
296
|
-
return Array.from(within.querySelectorAll(selector)).filter((element) => element.closest(
|
|
649
|
+
return Array.from(within.querySelectorAll(selector)).filter((element) => element.closest(ROOT2) === this.root);
|
|
297
650
|
}
|
|
298
651
|
listen(target, type, handler, options) {
|
|
299
652
|
target.addEventListener(type, handler, options);
|
|
300
653
|
this.disposers.push(() => target.removeEventListener(type, handler, options));
|
|
301
654
|
}
|
|
302
655
|
paneElements() {
|
|
303
|
-
return this.all(
|
|
656
|
+
return this.all(PANE2);
|
|
304
657
|
}
|
|
305
658
|
paneElement(id) {
|
|
306
659
|
return this.paneElements().find((pane) => pane.getAttribute("data-settings-pane") === id) ?? null;
|
|
@@ -314,7 +667,7 @@ class SettingsWindowView {
|
|
|
314
667
|
})).filter((pane) => pane.id !== "");
|
|
315
668
|
}
|
|
316
669
|
itemElements() {
|
|
317
|
-
return this.list ? this.all(
|
|
670
|
+
return this.list ? this.all(ITEM2, this.list) : [];
|
|
318
671
|
}
|
|
319
672
|
visibleItems() {
|
|
320
673
|
return this.itemElements().filter((item) => !item.hidden && !item.disabled);
|
|
@@ -330,10 +683,10 @@ class SettingsWindowView {
|
|
|
330
683
|
}));
|
|
331
684
|
}
|
|
332
685
|
rowElements() {
|
|
333
|
-
return this.all(
|
|
686
|
+
return this.all(ROW2).filter((row) => this.paneOf(row) !== "");
|
|
334
687
|
}
|
|
335
688
|
paneOf(element) {
|
|
336
|
-
return element.closest(
|
|
689
|
+
return element.closest(PANE2)?.getAttribute("data-settings-pane") || "";
|
|
337
690
|
}
|
|
338
691
|
stored() {
|
|
339
692
|
if (!this.storageKey)
|
|
@@ -480,7 +833,7 @@ class SettingsWindowView {
|
|
|
480
833
|
item.hidden = searching && !found.panes.includes(item.getAttribute("data-settings-item") || "");
|
|
481
834
|
if (this.list) {
|
|
482
835
|
for (const group of this.all("[data-settings-group]", this.list))
|
|
483
|
-
group.hidden = searching && this.all(
|
|
836
|
+
group.hidden = searching && this.all(ITEM2, group).every((item) => item.hidden);
|
|
484
837
|
this.list.hidden = searching && found.panes.length === 0;
|
|
485
838
|
}
|
|
486
839
|
if (this.account)
|
|
@@ -555,11 +908,11 @@ class SettingsWindowView {
|
|
|
555
908
|
this.highlighted = null;
|
|
556
909
|
}
|
|
557
910
|
inside(target) {
|
|
558
|
-
return target instanceof Element && target.closest(
|
|
911
|
+
return target instanceof Element && target.closest(ROOT2) === this.root;
|
|
559
912
|
}
|
|
560
913
|
navigationRow(target) {
|
|
561
914
|
const row = target.closest("[data-navigate]");
|
|
562
|
-
if (!row || row.closest(
|
|
915
|
+
if (!row || row.closest(ROOT2) !== this.root || row.getAttribute("aria-disabled") === "true")
|
|
563
916
|
return null;
|
|
564
917
|
const control = target.closest(CONTROLS);
|
|
565
918
|
if (control && control !== row && row.contains(control))
|
|
@@ -578,7 +931,7 @@ class SettingsWindowView {
|
|
|
578
931
|
const target = event.target;
|
|
579
932
|
if (!this.inside(target))
|
|
580
933
|
return;
|
|
581
|
-
const item = target.closest(
|
|
934
|
+
const item = target.closest(ITEM2);
|
|
582
935
|
if (item && this.list?.contains(item)) {
|
|
583
936
|
this.open(item.getAttribute("data-settings-item") || "");
|
|
584
937
|
return;
|
|
@@ -645,7 +998,7 @@ class SettingsWindowView {
|
|
|
645
998
|
this.onResultKey(event, result);
|
|
646
999
|
return;
|
|
647
1000
|
}
|
|
648
|
-
const item = target.closest(
|
|
1001
|
+
const item = target.closest(ITEM2);
|
|
649
1002
|
if (item && this.list?.contains(item)) {
|
|
650
1003
|
this.onItemKey(event, item);
|
|
651
1004
|
return;
|
|
@@ -733,6 +1086,8 @@ export {
|
|
|
733
1086
|
SETTINGS_HIGHLIGHT_MS,
|
|
734
1087
|
SETTINGS_RANK,
|
|
735
1088
|
SETTINGS_TYPE_AHEAD_MS,
|
|
1089
|
+
SETTINGS_UPDATE_LABELS,
|
|
1090
|
+
SettingsWindowTree,
|
|
736
1091
|
SettingsWindowView,
|
|
737
1092
|
emptySettingsHistory,
|
|
738
1093
|
findSettingsPane,
|
|
@@ -753,5 +1108,6 @@ export {
|
|
|
753
1108
|
settingsSidebarPane,
|
|
754
1109
|
settingsStorageName,
|
|
755
1110
|
settingsTypeAheadAdd,
|
|
756
|
-
settingsTypeAheadMatch
|
|
1111
|
+
settingsTypeAheadMatch,
|
|
1112
|
+
settingsUpdateView
|
|
757
1113
|
};
|
|
@@ -6,6 +6,7 @@ export declare const label: unknown;
|
|
|
6
6
|
export declare const disabled: ReturnType<typeof $bool>;
|
|
7
7
|
export declare const pickerId: unknown;
|
|
8
8
|
export declare const className: unknown;
|
|
9
|
+
export declare const T: unknown;
|
|
9
10
|
/** @defaultValue `['light', 'dark', 'auto']` */
|
|
10
11
|
declare const MODES: string[];
|
|
11
12
|
declare type __DtsxStxComponentType = DefineComponent<{ value?: unknown, options?: unknown, label?: string, disabled?: unknown, id?: string, className?: string }> & { readonly __stxEmits?: ["change"], readonly __stxExposed?: { value: unknown } }
|
|
@@ -207,5 +207,21 @@ export declare const nativeButtonClasses: unknown;
|
|
|
207
207
|
export declare const nativeTextClasses: string;
|
|
208
208
|
export declare const legacyNativeTint: boolean;
|
|
209
209
|
export declare const nativeTintClass: unknown;
|
|
210
|
+
/*
|
|
211
|
+
* On a Mac (Craft's AppKit host) a button is the system's push button, an
|
|
212
|
+
* NSButton the host draws, not the phone's filled one: 13pt words on the
|
|
213
|
+
* standard bezel. The host knows four looks by name and only a written
|
|
214
|
+
* `variant` asks for one: `primary` is the default (accent) button, `danger`
|
|
215
|
+
* the destructive one, `ghost` a borderless one, `toolbar` the toolbar's.
|
|
216
|
+
* Anything else, and no variant at all, is the plain push button, as
|
|
217
|
+
* `appearance="mac"` has it on the web, because on a Mac most buttons are.
|
|
218
|
+
* Which host this is is only known on the device, so both are in the screen
|
|
219
|
+
* and the client script keeps one.
|
|
220
|
+
* @defaultValue `['primary', 'danger', 'ghost', 'toolbar']`
|
|
221
|
+
*/
|
|
222
|
+
declare const desktopVariants: string[];
|
|
223
|
+
export declare const desktopVariant: unknown;
|
|
224
|
+
/** `title` names the button only when nothing in the slot does: beside content it is the tooltip. */
|
|
225
|
+
export declare const titleNames: unknown;
|
|
210
226
|
declare type __DtsxStxComponentType = DefineComponent<{ variant?: string, appearance?: unknown, size?: string, disabled?: unknown, loading?: unknown, type?: string, fullWidth?: unknown, symbol?: string, iconOnly?: unknown, label?: unknown, title?: string, ariaLabel?: unknown, "aria-label"?: string, leftIcon?: string, rightIcon?: string, className?: string }>;
|
|
211
227
|
export default __dtsx_component__;
|
|
@@ -22,6 +22,13 @@ export declare const switchAppearance: boolean;
|
|
|
22
22
|
* which this file's <style> block draws from the `--stx-mac-*` tokens.
|
|
23
23
|
*/
|
|
24
24
|
export declare const mac: boolean;
|
|
25
|
+
/*
|
|
26
|
+
* The Mac look is a stylesheet, and a native host has none: there the box is
|
|
27
|
+
* the platform's own control whatever `variant` says. On a Mac (Craft's
|
|
28
|
+
* AppKit host, known only on the device) `variant="mac"` also sets the words
|
|
29
|
+
* at AppKit's sizes, 13pt over 11pt; a phone keeps its own.
|
|
30
|
+
*/
|
|
31
|
+
export declare const macNative: boolean;
|
|
25
32
|
/*
|
|
26
33
|
* The two halves of the validity state, exported so the CLIENT can swap them
|
|
27
34
|
* (stacksjs/stx#2047). Toggled per class rather than as a whole string,
|
|
@@ -96,6 +96,16 @@ export declare const enterKeyHint: unknown;
|
|
|
96
96
|
*/
|
|
97
97
|
export declare const nativeAutocomplete: unknown;
|
|
98
98
|
export declare const nativeFieldClasses: unknown;
|
|
99
|
+
/*
|
|
100
|
+
* `variant="mac"` on Craft's AppKit host is AppKit's secure field (an
|
|
101
|
+
* NSSecureTextField), sized as TextInput's Mac field is. It has no reveal
|
|
102
|
+
* button there: AppKit's secure field has none, and the host does not turn
|
|
103
|
+
* one back into a plain field. Which host this is is known only on the
|
|
104
|
+
* device, so the client script decides.
|
|
105
|
+
*/
|
|
106
|
+
export declare const nativeMac: unknown;
|
|
107
|
+
export declare const nativeMacFieldClasses: 'min-h-0 h-[22px] pl-0 pr-0 text-[13px] bg-[#00000000] dark:bg-[#00000000] rounded-none';
|
|
108
|
+
export declare const nativeMacWrapClasses: 'w-[170px]';
|
|
99
109
|
export declare const nativeLabelClasses: 'mb-1.5 px-4 text-[13px] uppercase text-[#6d6d72] dark:text-[#8d8d93]';
|
|
100
110
|
export declare const nativeHelperClasses: string;
|
|
101
111
|
declare type __DtsxStxComponentType = DefineComponent<{ value?: string, placeholder?: string, disabled?: unknown, readonly?: unknown, size?: string, error?: unknown, label?: string, id?: string, helperText?: string, required?: unknown, showStrength?: unknown, className?: string, inputClassName?: string, variant?: unknown, name?: string, autocomplete?: unknown, autoComplete?: string, form?: string, inputMode?: unknown, inputmode?: string, enterKeyHint?: unknown, enterkeyhint?: string }> & { readonly __stxExposed?: { value: unknown } }
|
|
@@ -163,6 +163,17 @@ export declare const autofocus: ReturnType<typeof $bool>;
|
|
|
163
163
|
* system red outline, a disabled one dims as UIKit's do.
|
|
164
164
|
*/
|
|
165
165
|
export declare const nativeFieldClasses: unknown;
|
|
166
|
+
/*
|
|
167
|
+
* `variant="mac"` on Craft's AppKit host is AppKit's text field (the host
|
|
168
|
+
* draws an NSTextField): 22pt tall at 13pt, with the bezel and the fill the
|
|
169
|
+
* system gives it, so the phone's fill, corners and padding come off. It is a
|
|
170
|
+
* field at the end of a settings row, 170pt wide; `className="w-full"` (or
|
|
171
|
+
* any width) makes it something else. Which host this is is known only on
|
|
172
|
+
* the device, so these are classes the client script adds there.
|
|
173
|
+
*/
|
|
174
|
+
export declare const nativeMac: unknown;
|
|
175
|
+
export declare const nativeMacFieldClasses: 'min-h-0 h-[22px] px-0 text-[13px] bg-[#00000000] dark:bg-[#00000000] rounded-none';
|
|
176
|
+
export declare const nativeMacWrapClasses: 'w-[170px]';
|
|
166
177
|
export declare const nativeLabelClasses: 'mb-1.5 px-4 text-[13px] uppercase text-[#6d6d72] dark:text-[#8d8d93]';
|
|
167
178
|
export declare const nativeHelperClasses: string;
|
|
168
179
|
declare type __DtsxStxComponentType = DefineComponent<{ value?: string, placeholder?: string, disabled?: unknown, readonly?: unknown, size?: string, error?: unknown, label?: string, helperText?: string, required?: unknown, leftIcon?: string, rightIcon?: string, clearable?: unknown, maxLength?: unknown, maxlength?: unknown, showCount?: unknown, className?: string, inputClassName?: string, variant?: unknown, id?: string, name?: string, autocomplete?: unknown, autoComplete?: string, form?: string, inputMode?: unknown, inputmode?: string, enterKeyHint?: unknown, enterkeyhint?: string, type?: unknown, min?: unknown, max?: unknown, step?: unknown, pattern?: unknown, minLength?: unknown, minlength?: unknown, htmlSize?: unknown, list?: unknown, autofocus?: unknown }> & { readonly __stxEmits?: ["input", "clear", "focus", "blur", "submit", "submit-editing"], readonly __stxExposed?: { value: unknown, clear: unknown } }
|
|
@@ -81,6 +81,13 @@ declare const sizeClasses: {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
export declare const sizing: unknown;
|
|
84
|
+
/*
|
|
85
|
+
* `variant="mac"` on Craft's AppKit host (known only on the device) is
|
|
86
|
+
* AppKit's segmented control: 24pt tall whatever `size` says, as the web's
|
|
87
|
+
* Mac look has one size. The host has no segmented control of its own, so
|
|
88
|
+
* the segments are drawn there as they are where a phone has none.
|
|
89
|
+
*/
|
|
90
|
+
export declare const macNative: boolean;
|
|
84
91
|
/*
|
|
85
92
|
* On a native host ($native) the track and segments are UISegmentedControl's
|
|
86
93
|
* own: a translucent grey track with 9pt corners, the chosen segment raised
|
|
@@ -19,6 +19,10 @@ declare const __dtsx_component__: __DtsxStxComponentType;
|
|
|
19
19
|
* `footer` is text, or a named slot when the footnote carries a link:
|
|
20
20
|
*
|
|
21
21
|
* <template #footer>Read the <a href="/privacy">privacy notes</a>.</template>
|
|
22
|
+
*
|
|
23
|
+
* On a native host ($native) there is no sibling selector, so each row
|
|
24
|
+
* carries its own hairline (`data-settings-row-rule`) and the group shows it
|
|
25
|
+
* on every row but the first, again whenever its rows change.
|
|
22
26
|
*/
|
|
23
27
|
export declare const header: unknown;
|
|
24
28
|
export declare const footer: unknown;
|
|
@@ -26,5 +30,6 @@ export declare const hasFooterSlot: unknown;
|
|
|
26
30
|
export declare const groupId: unknown;
|
|
27
31
|
export declare const headerId: string;
|
|
28
32
|
export declare const className: unknown;
|
|
33
|
+
export declare const T: unknown;
|
|
29
34
|
declare type __DtsxStxComponentType = DefineComponent<{ header?: string, footer?: string, id?: string, className?: string }>;
|
|
30
35
|
export default __dtsx_component__;
|
|
@@ -7,6 +7,9 @@ declare const __dtsx_component__: __DtsxStxComponentType;
|
|
|
7
7
|
*
|
|
8
8
|
* Every pane is in the page from the start and all but one are hidden. The
|
|
9
9
|
* shell shows the open one; `active` leaves this one showing before it has.
|
|
10
|
+
*
|
|
11
|
+
* On a native host ($native) a pane is a scroll view of its own, so each pane
|
|
12
|
+
* keeps its place when the window moves between them.
|
|
10
13
|
*/
|
|
11
14
|
export declare const paneId: unknown;
|
|
12
15
|
export declare const title: unknown;
|
|
@@ -15,5 +18,6 @@ export declare const parent: unknown;
|
|
|
15
18
|
export declare const active: ReturnType<typeof $bool>;
|
|
16
19
|
export declare const role: unknown;
|
|
17
20
|
export declare const className: unknown;
|
|
21
|
+
export declare const T: unknown;
|
|
18
22
|
declare type __DtsxStxComponentType = DefineComponent<{ id?: string, title?: unknown, keywords?: string, parent?: string, active?: unknown, className?: string }>;
|
|
19
23
|
export default __dtsx_component__;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { settingsNativeGlyph } from './native-theme';
|
|
1
2
|
import type { DefineComponent } from '@stacksjs/stx';
|
|
2
3
|
declare const __dtsx_component__: __DtsxStxComponentType;
|
|
3
4
|
/*
|
|
@@ -8,6 +9,9 @@ declare const __dtsx_component__: __DtsxStxComponentType;
|
|
|
8
9
|
* description="Manage your overall setup and preferences." />
|
|
9
10
|
*
|
|
10
11
|
* Anything in the slot goes under the description: a link, a button.
|
|
12
|
+
*
|
|
13
|
+
* On a native host ($native) the glyph is the SF Symbol named by `symbol`;
|
|
14
|
+
* `icon`, an Iconify class, is the web's.
|
|
11
15
|
* @defaultValue `['grey', 'blue', 'red', 'orange', 'yellow', 'green', 'indigo', 'purple', 'pink', 'ink']`
|
|
12
16
|
*/
|
|
13
17
|
declare const TONES: string[];
|
|
@@ -16,5 +20,10 @@ export declare const tone: unknown;
|
|
|
16
20
|
export declare const title: unknown;
|
|
17
21
|
export declare const description: unknown;
|
|
18
22
|
export declare const className: unknown;
|
|
19
|
-
declare
|
|
23
|
+
export declare const symbol: unknown;
|
|
24
|
+
export declare const T: unknown;
|
|
25
|
+
export declare const tileFill: unknown;
|
|
26
|
+
export declare const glyphInk: ReturnType<typeof settingsNativeGlyph>;
|
|
27
|
+
export declare const hasExtra: unknown;
|
|
28
|
+
declare type __DtsxStxComponentType = DefineComponent<{ icon?: string, tone?: unknown, title?: string, description?: string, className?: string, symbol?: string }>;
|
|
20
29
|
export default __dtsx_component__;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { settingsNativeGlyph } from './native-theme';
|
|
1
2
|
import type { DefineComponent } from '@stacksjs/stx';
|
|
2
3
|
/** Name the slot's first control after the row, unless it has a name. */
|
|
3
4
|
declare function nameControl(): unknown;
|
|
@@ -28,6 +29,12 @@ declare const __dtsx_component__: __DtsxStxComponentType;
|
|
|
28
29
|
* `layout="stacked"` puts the control under the label at full width;
|
|
29
30
|
* `destructive` paints the label as a destructive action. `icon` is an
|
|
30
31
|
* Iconify class on a tile of `tone`.
|
|
32
|
+
*
|
|
33
|
+
* On a native host ($native) the tile's glyph is the SF Symbol named by
|
|
34
|
+
* `symbol` (`icon` is CSS, which a native host has none of), the chevron is
|
|
35
|
+
* the system's, and a navigation row is one press target: the whole row opens
|
|
36
|
+
* the pane, so a control in its slot is not pressed for itself there. The
|
|
37
|
+
* hairline above the row is the row's own view, shown by its group.
|
|
31
38
|
* @defaultValue `['grey', 'blue', 'red', 'orange', 'yellow', 'green', 'indigo', 'purple', 'pink', 'ink']`
|
|
32
39
|
*/
|
|
33
40
|
declare const TONES: string[];
|
|
@@ -49,5 +56,17 @@ export declare const rowId: unknown;
|
|
|
49
56
|
export declare const labelId: string;
|
|
50
57
|
export declare const descriptionId: string;
|
|
51
58
|
export declare const className: unknown;
|
|
52
|
-
declare
|
|
59
|
+
export declare const symbol: unknown;
|
|
60
|
+
export declare const T: unknown;
|
|
61
|
+
export declare const chevron: unknown;
|
|
62
|
+
export declare const tileFill: unknown;
|
|
63
|
+
export declare const glyphInk: ReturnType<typeof settingsNativeGlyph>;
|
|
64
|
+
export declare const hasControl: unknown;
|
|
65
|
+
declare const stacked: boolean;
|
|
66
|
+
export declare const nativeRowClasses: unknown;
|
|
67
|
+
export declare const nativeTextClasses: unknown;
|
|
68
|
+
export declare const nativeControlClasses: unknown;
|
|
69
|
+
export declare const nativeLabelClasses: unknown;
|
|
70
|
+
export declare const nativeTileClasses: unknown;
|
|
71
|
+
declare type __DtsxStxComponentType = DefineComponent<{ label?: string, description?: string, icon?: string, tone?: unknown, setting?: string, keywords?: string, to?: string, value?: string, multiline?: unknown, destructive?: unknown, disabled?: unknown, layout?: unknown, id?: unknown, className?: string, symbol?: string }> & { readonly __stxExposed?: { labelId: typeof labelId, descriptionId: typeof descriptionId, nameControl: typeof nameControl } }
|
|
53
72
|
export default __dtsx_component__;
|
|
@@ -4,8 +4,13 @@ declare const __dtsx_component__: __DtsxStxComponentType;
|
|
|
4
4
|
* <SettingsSidebarGroup>: a run of sidebar items, set a little apart from the
|
|
5
5
|
* next. System Settings gives its groups no headings; `label` is there for
|
|
6
6
|
* the window that needs one.
|
|
7
|
+
*
|
|
8
|
+
* On a native host ($native) the gap above the group is a view of its own
|
|
9
|
+
* (`data-settings-group-gap`), which the window shows above every group but
|
|
10
|
+
* the first one showing: there is no sibling selector to do it.
|
|
7
11
|
*/
|
|
8
12
|
export declare const label: unknown;
|
|
9
13
|
export declare const className: unknown;
|
|
14
|
+
export declare const T: unknown;
|
|
10
15
|
declare type __DtsxStxComponentType = DefineComponent<{ label?: string, className?: string }>;
|
|
11
16
|
export default __dtsx_component__;
|