@gravionlabs/helix-app 0.0.1 → 22.20.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.
@@ -0,0 +1,1023 @@
1
+ import { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ErrorHandler, Injectable, PLATFORM_ID, TemplateRef, afterRenderEffect, computed, contentChild, effect, inject, input, makeEnvironmentProviders, model, provideEnvironmentInitializer, signal, untracked, viewChild } from "@angular/core";
4
+ import { HX_THEME_OPTIONS, HxButton, HxField, HxInput, HxInputNumber, HxMessage, HxSelect, HxSelectButton, HxSwitch, HxTheme, HxTree, HxTreeNodeTemplate, hxShortcut } from "@gravionlabs/helix-ui";
5
+ const PLATFORMS = [
6
+ "desktop",
7
+ "mobile",
8
+ "macos",
9
+ "windows",
10
+ "linux",
11
+ "ios",
12
+ "android",
13
+ "web"
14
+ ];
15
+ function getHxPlatformKind(platform) {
16
+ if (platform === "ios" || platform === "android" || platform === "mobile") return "mobile";
17
+ return platform === "web" ? "web" : "desktop";
18
+ }
19
+ function getHxPlatform(root = document.documentElement) {
20
+ const value = root.getAttribute("data-platform");
21
+ return value && PLATFORMS.includes(value) ? value : "web";
22
+ }
23
+ function setHxPlatform(platform, root = document.documentElement) {
24
+ root.setAttribute("data-platform", platform);
25
+ }
26
+ function searchWords(query) {
27
+ return query.toLowerCase().split(/\s+/).filter(Boolean);
28
+ }
29
+ function searchText(texts) {
30
+ return texts.join(" ").toLowerCase();
31
+ }
32
+ const HX_SETTINGS_GROUP_APPEARANCE = "appearance-behavior";
33
+ const HX_SETTINGS_GROUP_GENERAL = "general";
34
+ const DEFAULT_ORDER = 100;
35
+ const SHARED_GROUPS = [{
36
+ id: HX_SETTINGS_GROUP_APPEARANCE,
37
+ title: "Appearance & Behavior",
38
+ order: 0
39
+ }, {
40
+ id: HX_SETTINGS_GROUP_GENERAL,
41
+ title: "General",
42
+ order: 1e3
43
+ }];
44
+ var HxSettingsRegistry = class HxSettingsRegistry {
45
+ registeredGroups = signal(SHARED_GROUPS, ...ngDevMode ? [{ debugName: "registeredGroups" }] : /* istanbul ignore next */ []);
46
+ registeredPages = signal([], ...ngDevMode ? [{ debugName: "registeredPages" }] : /* istanbul ignore next */ []);
47
+ retired = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "retired" }] : /* istanbul ignore next */ []);
48
+ groups = computed(() => {
49
+ const pages = [...this.registeredPages()].sort(compareEntries);
50
+ return [...this.registeredGroups()].sort(compareEntries).map((group) => ({
51
+ ...group,
52
+ pages: pages.filter((page) => page.group === group.id)
53
+ }));
54
+ }, ...ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []);
55
+ registerGroup(group) {
56
+ return register(this.registeredGroups, group);
57
+ }
58
+ registerPage(page) {
59
+ if (!untracked(this.registeredGroups).some((group) => group.id === page.group)) throw new Error(`HxSettingsRegistry: page "${page.id}" names the unregistered group "${page.group}".`);
60
+ return register(this.registeredPages, page);
61
+ }
62
+ retire(oldId, newId) {
63
+ this.retired.update((map) => new Map(map).set(oldId, newId));
64
+ }
65
+ resolve(pageId) {
66
+ const retired = this.retired();
67
+ const seen = /* @__PURE__ */ new Set();
68
+ let id = pageId;
69
+ while (retired.has(id) && !seen.has(id)) {
70
+ seen.add(id);
71
+ id = retired.get(id);
72
+ }
73
+ const pages = this.groups().flatMap((group) => group.pages);
74
+ return pages.find((page) => page.id === id) ?? pages[0];
75
+ }
76
+ static ɵfac = i0.ɵɵngDeclareFactory({
77
+ minVersion: "12.0.0",
78
+ version: "22.3.0",
79
+ ngImport: i0,
80
+ type: HxSettingsRegistry,
81
+ deps: [],
82
+ target: i0.ɵɵFactoryTarget.Injectable
83
+ });
84
+ static ɵprov = i0.ɵɵngDeclareInjectable({
85
+ minVersion: "12.0.0",
86
+ version: "22.3.0",
87
+ ngImport: i0,
88
+ type: HxSettingsRegistry,
89
+ providedIn: "root"
90
+ });
91
+ };
92
+ i0.ɵɵngDeclareClassMetadata({
93
+ minVersion: "12.0.0",
94
+ version: "22.3.0",
95
+ ngImport: i0,
96
+ type: HxSettingsRegistry,
97
+ decorators: [{
98
+ type: Injectable,
99
+ args: [{ providedIn: "root" }]
100
+ }]
101
+ });
102
+ function hxFilterSettings(groups, query) {
103
+ const words = searchWords(query);
104
+ if (words.length === 0) return groups;
105
+ const matches = (...texts) => {
106
+ const haystack = searchText(texts);
107
+ return words.every((word) => haystack.includes(word));
108
+ };
109
+ return groups.flatMap((group) => {
110
+ const pages = group.pages.flatMap((page) => {
111
+ if (matches(page.title)) return [page];
112
+ const sections = page.sections().flatMap((section) => {
113
+ const items = section.items.filter((item) => matches(group.title, page.title, section.title, item.label, item.description, ...item.keywords ?? []));
114
+ return items.length ? [{
115
+ ...section,
116
+ items
117
+ }] : [];
118
+ });
119
+ return sections.length ? [{
120
+ ...page,
121
+ sections: () => sections
122
+ }] : [];
123
+ });
124
+ return pages.length ? [{
125
+ ...group,
126
+ pages
127
+ }] : [];
128
+ });
129
+ }
130
+ function compareEntries(a, b) {
131
+ return (a.order ?? DEFAULT_ORDER) - (b.order ?? DEFAULT_ORDER) || a.title.localeCompare(b.title);
132
+ }
133
+ function register(list, entry) {
134
+ list.update((entries) => [...entries.filter((e) => e.id !== entry.id), entry]);
135
+ return () => list.update((entries) => entries.filter((e) => e !== entry));
136
+ }
137
+ const HX_SETTINGS_PAGE_APPEARANCE = "appearance";
138
+ const FONT_SIZE_MIN = 10;
139
+ const FONT_SIZE_MAX = 24;
140
+ const DENSITY_FONT_SIZE = {
141
+ comfortable: 14,
142
+ compact: 13
143
+ };
144
+ const FONT_FAMILY_VARIABLE = "--hx-font-family";
145
+ function provideHxSettings(options = {}) {
146
+ return makeEnvironmentProviders([provideEnvironmentInitializer(() => setUp(options))]);
147
+ }
148
+ function setUp(options) {
149
+ const theme = inject(HxTheme);
150
+ const registry = inject(HxSettingsRegistry);
151
+ const appearance = options.appearance ?? {};
152
+ const custom = appearance.store;
153
+ let store;
154
+ let fonts;
155
+ if (custom) {
156
+ store = custom;
157
+ fonts = {
158
+ family: () => custom.uiFontFamily(),
159
+ size: () => custom.uiFontSize()
160
+ };
161
+ theme.stopRemembering();
162
+ applyToTheme(custom, theme);
163
+ } else {
164
+ const key = options.fontStorageKey ?? inject(HX_THEME_OPTIONS).storageKey ?? null;
165
+ ({store, fonts} = themeStore(theme, key));
166
+ }
167
+ applyFonts(fonts);
168
+ const items = appearanceSections(store, theme, appearance.density !== false);
169
+ const unregister = registry.registerPage({
170
+ id: HX_SETTINGS_PAGE_APPEARANCE,
171
+ group: HX_SETTINGS_GROUP_APPEARANCE,
172
+ title: "Appearance",
173
+ order: 0,
174
+ sections: () => [...items, ...appearance.extraSections?.() ?? []]
175
+ });
176
+ inject(DestroyRef).onDestroy(unregister);
177
+ }
178
+ function appearanceSections(store, theme, withDensity) {
179
+ const themeItems = [{
180
+ id: "theme",
181
+ kind: "segmented",
182
+ label: "Theme",
183
+ keywords: ["color mode", "dark mode"],
184
+ options: [
185
+ {
186
+ value: "light",
187
+ label: "Light"
188
+ },
189
+ {
190
+ value: "dark",
191
+ label: "Dark"
192
+ },
193
+ {
194
+ value: "system",
195
+ label: "System"
196
+ }
197
+ ],
198
+ get: () => store.mode(),
199
+ set: (value) => store.setMode(value)
200
+ }];
201
+ if (withDensity && store.density && store.setDensity) themeItems.push({
202
+ id: "density",
203
+ kind: "segmented",
204
+ label: "Density",
205
+ options: [{
206
+ value: "comfortable",
207
+ label: "Comfortable"
208
+ }, {
209
+ value: "compact",
210
+ label: "Compact"
211
+ }],
212
+ get: () => store.density() ?? theme.density(),
213
+ set: (value) => store.setDensity(value)
214
+ });
215
+ return [{
216
+ id: "theme",
217
+ title: "Theme",
218
+ items: themeItems
219
+ }, {
220
+ id: "fonts",
221
+ title: "Fonts",
222
+ items: [{
223
+ id: "ui-font-family",
224
+ kind: "text",
225
+ label: "UI font family",
226
+ placeholder: "Default",
227
+ get: () => store.uiFontFamily(),
228
+ set: (value) => store.setUiFontFamily(value)
229
+ }, {
230
+ id: "ui-font-size",
231
+ kind: "number",
232
+ label: "UI font size",
233
+ min: FONT_SIZE_MIN,
234
+ max: FONT_SIZE_MAX,
235
+ get: () => store.uiFontSize(),
236
+ set: (value) => store.setUiFontSize(value)
237
+ }]
238
+ }];
239
+ }
240
+ function themeStore(theme, key) {
241
+ const view = inject(DOCUMENT).defaultView;
242
+ const storage = isPlatformBrowser(inject(PLATFORM_ID)) && key ? {
243
+ key,
244
+ view
245
+ } : null;
246
+ const read = () => {
247
+ if (!storage) return {};
248
+ try {
249
+ const value = JSON.parse(storage.view?.localStorage.getItem(storage.key) ?? "null");
250
+ return value && typeof value === "object" ? value : {};
251
+ } catch {
252
+ return {};
253
+ }
254
+ };
255
+ const write = (name, value) => {
256
+ if (!storage) return;
257
+ try {
258
+ storage.view?.localStorage.setItem(storage.key, JSON.stringify({
259
+ ...read(),
260
+ [name]: value
261
+ }));
262
+ } catch {}
263
+ };
264
+ const saved = read();
265
+ const family = signal(typeof saved["uiFontFamily"] === "string" ? saved["uiFontFamily"] : "", ...ngDevMode ? [{ debugName: "family" }] : /* istanbul ignore next */ []);
266
+ const size = signal(typeof saved["uiFontSize"] === "number" ? clampSize(saved["uiFontSize"]) : null, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
267
+ const shownSize = computed(() => size() ?? DENSITY_FONT_SIZE[theme.density()], ...ngDevMode ? [{ debugName: "shownSize" }] : /* istanbul ignore next */ []);
268
+ return {
269
+ fonts: {
270
+ family,
271
+ size
272
+ },
273
+ store: {
274
+ mode: theme.mode,
275
+ setMode: (mode) => theme.setMode(mode),
276
+ density: theme.density,
277
+ setDensity: (density) => theme.setDensity(density),
278
+ uiFontFamily: family,
279
+ setUiFontFamily: (value) => {
280
+ family.set(value.trim());
281
+ write("uiFontFamily", value.trim());
282
+ },
283
+ uiFontSize: shownSize,
284
+ setUiFontSize: (value) => {
285
+ const next = clampSize(value);
286
+ if (next === null) return;
287
+ size.set(next);
288
+ write("uiFontSize", next);
289
+ }
290
+ }
291
+ };
292
+ }
293
+ function applyToTheme(store, theme) {
294
+ const mode = computed(() => store.mode(), ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
295
+ effect(() => {
296
+ const value = mode();
297
+ untracked(() => theme.setMode(value));
298
+ });
299
+ if (!store.density) return;
300
+ const density = computed(() => store.density(), ...ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []);
301
+ effect(() => {
302
+ const value = density();
303
+ untracked(() => theme.setDensity(value));
304
+ });
305
+ }
306
+ function applyFonts(fonts) {
307
+ if (!isPlatformBrowser(inject(PLATFORM_ID))) return;
308
+ const style = inject(DOCUMENT).documentElement.style;
309
+ let sized = false;
310
+ let named = false;
311
+ const setFamily = (family) => {
312
+ if (family) style.setProperty(FONT_FAMILY_VARIABLE, family);
313
+ else if (named) style.removeProperty(FONT_FAMILY_VARIABLE);
314
+ named = family !== "";
315
+ };
316
+ const setSize = (size) => {
317
+ if (size !== null) style.fontSize = `${size}px`;
318
+ else if (sized) style.removeProperty("font-size");
319
+ sized = size !== null;
320
+ };
321
+ const family = computed(() => fonts.family().trim(), ...ngDevMode ? [{ debugName: "family" }] : /* istanbul ignore next */ []);
322
+ const size = computed(() => {
323
+ const value = fonts.size();
324
+ return value === null ? null : clampSize(value);
325
+ }, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
326
+ effect(() => setFamily(family()));
327
+ effect(() => setSize(size()));
328
+ inject(DestroyRef).onDestroy(() => {
329
+ setFamily("");
330
+ setSize(null);
331
+ });
332
+ }
333
+ function clampSize(size) {
334
+ if (!Number.isFinite(size) || size <= 0) return null;
335
+ return Math.min(FONT_SIZE_MAX, Math.max(FONT_SIZE_MIN, size));
336
+ }
337
+ var HxSettingsSectionView = class HxSettingsSectionView {
338
+ errorHandler = inject(ErrorHandler);
339
+ section = input.required(...ngDevMode ? [{ debugName: "section" }] : /* istanbul ignore next */ []);
340
+ headingId = input.required(...ngDevMode ? [{ debugName: "headingId" }] : /* istanbul ignore next */ []);
341
+ hits = input.required(...ngDevMode ? [{ debugName: "hits" }] : /* istanbul ignore next */ []);
342
+ itemTemplate = input(...ngDevMode ? [void 0, { debugName: "itemTemplate" }] : /* istanbul ignore next */ []);
343
+ failure = signal(null, ...ngDevMode ? [{ debugName: "failure" }] : /* istanbul ignore next */ []);
344
+ saving = signal(false, ...ngDevMode ? [{ debugName: "saving" }] : /* istanbul ignore next */ []);
345
+ pending = /* @__PURE__ */ new Map();
346
+ async toggle(item, box) {
347
+ await this.set(item, box.checked);
348
+ if (!this.pending.has(item.id)) box.checked = item.get();
349
+ }
350
+ async enter(item, field) {
351
+ if (await this.set(item, field.value) && !this.pending.has(item.id)) field.value = item.get();
352
+ }
353
+ async pick(item, value, control) {
354
+ if (value === null || !this.pending.has(item.id) && Object.is(value, item.get())) return;
355
+ await this.set(item, value);
356
+ if (!this.pending.has(item.id)) control.set(item.get());
357
+ }
358
+ async run(item) {
359
+ try {
360
+ await item.run();
361
+ } catch (error) {
362
+ this.errorHandler.handleError(error);
363
+ }
364
+ }
365
+ async save(form) {
366
+ if (this.saving()) return;
367
+ this.saving.set(true);
368
+ this.failure.set(null);
369
+ try {
370
+ await form.save();
371
+ } catch (error) {
372
+ this.fail(null, error);
373
+ } finally {
374
+ this.saving.set(false);
375
+ }
376
+ }
377
+ async set(item, value) {
378
+ this.pending.set(item.id, (this.pending.get(item.id) ?? 0) + 1);
379
+ try {
380
+ await item.set(value);
381
+ if (this.failure()?.source === item.id) this.failure.set(null);
382
+ return true;
383
+ } catch (error) {
384
+ if (this.section().form) this.fail(item.id, error);
385
+ else this.errorHandler.handleError(error);
386
+ return false;
387
+ } finally {
388
+ const left = this.pending.get(item.id) - 1;
389
+ if (left) this.pending.set(item.id, left);
390
+ else this.pending.delete(item.id);
391
+ }
392
+ }
393
+ fail(source, error) {
394
+ this.failure.set({
395
+ source,
396
+ message: error instanceof Error ? error.message : String(error)
397
+ });
398
+ }
399
+ static ɵfac = i0.ɵɵngDeclareFactory({
400
+ minVersion: "12.0.0",
401
+ version: "22.3.0",
402
+ ngImport: i0,
403
+ type: HxSettingsSectionView,
404
+ deps: [],
405
+ target: i0.ɵɵFactoryTarget.Component
406
+ });
407
+ static ɵcmp = i0.ɵɵngDeclareComponent({
408
+ minVersion: "17.0.0",
409
+ version: "22.3.0",
410
+ type: HxSettingsSectionView,
411
+ isStandalone: true,
412
+ selector: "hx-settings-section",
413
+ inputs: {
414
+ section: {
415
+ classPropertyName: "section",
416
+ publicName: "section",
417
+ isSignal: true,
418
+ isRequired: true,
419
+ transformFunction: null
420
+ },
421
+ headingId: {
422
+ classPropertyName: "headingId",
423
+ publicName: "headingId",
424
+ isSignal: true,
425
+ isRequired: true,
426
+ transformFunction: null
427
+ },
428
+ hits: {
429
+ classPropertyName: "hits",
430
+ publicName: "hits",
431
+ isSignal: true,
432
+ isRequired: true,
433
+ transformFunction: null
434
+ },
435
+ itemTemplate: {
436
+ classPropertyName: "itemTemplate",
437
+ publicName: "itemTemplate",
438
+ isSignal: true,
439
+ isRequired: false,
440
+ transformFunction: null
441
+ }
442
+ },
443
+ ngImport: i0,
444
+ template: "<section [attr.aria-labelledby]=\"section().title ? headingId() : null\">\n @if (section().title) {\n <h2 [id]=\"headingId()\">{{ section().title }}</h2>\n }\n @if (section().description) {\n <p class=\"hx-settings-description\">{{ section().description }}</p>\n }\n @for (item of section().items; track item.id) {\n <div class=\"hx-settings-item\" [class.hx-settings-hit]=\"hits().has(item.id)\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n } @else {\n <hx-field [label]=\"item.label\" [hint]=\"item.description\">\n @switch (item.kind) {\n @case ('toggle') {\n <input\n #box\n hx-switch\n type=\"checkbox\"\n [checked]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (change)=\"toggle(item, box)\"\n />\n }\n @case ('select') {\n <hx-select\n #select\n size=\"small\"\n [options]=\"item.options\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, select.value)\"\n />\n }\n @case ('segmented') {\n <!-- a group of buttons takes no label[for]: it is named here -->\n <hx-select-button\n #segments\n size=\"small\"\n [options]=\"item.options\"\n [allowEmpty]=\"false\"\n [ariaLabel]=\"item.label\"\n [attr.aria-description]=\"item.description\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, segments.value)\"\n />\n }\n @case ('text') {\n <input\n #field\n hx-input\n size=\"small\"\n type=\"text\"\n [value]=\"item.get()\"\n [placeholder]=\"item.placeholder ?? ''\"\n [disabled]=\"item.disabled?.() ?? false\"\n (change)=\"enter(item, field)\"\n />\n }\n @case ('number') {\n <hx-input-number\n #number\n size=\"small\"\n [min]=\"item.min\"\n [max]=\"item.max\"\n [step]=\"item.step ?? 1\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, number.value)\"\n />\n }\n @case ('action') {\n <button\n hx-button\n size=\"small\"\n type=\"button\"\n [severity]=\"item.severity ?? 'primary'\"\n [attr.aria-description]=\"item.label\"\n [disabled]=\"item.disabled?.() ?? false\"\n (click)=\"run(item)\"\n >\n {{ item.buttonLabel }}\n </button>\n }\n @case ('readonly') {\n <span class=\"hx-settings-value\">{{ item.value() }}</span>\n @if (item.source) {\n <span class=\"hx-settings-source\">{{ item.source() }}</span>\n }\n }\n @case ('custom') {\n <ng-container\n [ngTemplateOutlet]=\"item.template\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n }\n }\n </hx-field>\n }\n </div>\n }\n @if (failure(); as failed) {\n <hx-message class=\"hx-settings-error\" severity=\"error\">{{ failed.message }}</hx-message>\n }\n @if (section().form; as form) {\n <div class=\"hx-settings-actions\">\n <button\n hx-button\n size=\"small\"\n type=\"button\"\n class=\"hx-settings-save\"\n [loading]=\"saving()\"\n [disabled]=\"!form.dirty()\"\n (click)=\"save(form)\"\n >\n Save\n </button>\n </div>\n }\n</section>\n",
445
+ styles: [":host{display:block}h2{margin:var(--h-space-5) 0 var(--h-space-2);font-size:var(--h-font-size-sm);font-weight:600}.hx-settings-description{max-inline-size:var(--h-measure-text);margin:0 0 var(--h-space-2);font-size:var(--h-font-size-xs);color:var(--h-text-muted-color)}.hx-settings-item{padding:var(--h-space-1) 0;font-size:var(--h-font-size-sm)}.hx-settings-hit>hx-field ::ng-deep>.hx-field-label{justify-self:start;border-radius:var(--h-border-radius-sm);background:color-mix(in srgb,var(--h-text-color) 22%,transparent)}.hx-settings-value{color:var(--h-text-muted-color);overflow-wrap:anywhere}.hx-settings-source{color:var(--h-text-muted-color);font-size:var(--h-font-size-xs);overflow-wrap:anywhere}.hx-settings-actions,.hx-settings-error{margin-top:var(--h-space-2)}\n"],
446
+ dependencies: [
447
+ {
448
+ kind: "directive",
449
+ type: HxButton,
450
+ selector: "button[hx-button], a[hx-button]",
451
+ inputs: [
452
+ "variant",
453
+ "severity",
454
+ "size",
455
+ "rounded",
456
+ "raised",
457
+ "fluid",
458
+ "iconOnly",
459
+ "loading"
460
+ ],
461
+ exportAs: ["hx-button"]
462
+ },
463
+ {
464
+ kind: "component",
465
+ type: HxField,
466
+ selector: "hx-field",
467
+ inputs: [
468
+ "label",
469
+ "hint",
470
+ "error",
471
+ "required",
472
+ "group"
473
+ ],
474
+ exportAs: ["hx-field"]
475
+ },
476
+ {
477
+ kind: "directive",
478
+ type: HxInput,
479
+ selector: "input[hx-input], textarea[hx-input]",
480
+ inputs: [
481
+ "variant",
482
+ "size",
483
+ "fluid",
484
+ "autoResize"
485
+ ],
486
+ exportAs: ["hx-input"]
487
+ },
488
+ {
489
+ kind: "component",
490
+ type: HxInputNumber,
491
+ selector: "hx-input-number",
492
+ inputs: [
493
+ "min",
494
+ "max",
495
+ "step",
496
+ "minFractionDigits",
497
+ "maxFractionDigits",
498
+ "locale",
499
+ "useGrouping",
500
+ "mode",
501
+ "currency",
502
+ "prefix",
503
+ "suffix",
504
+ "showButtons",
505
+ "buttonLayout",
506
+ "incrementLabel",
507
+ "decrementLabel",
508
+ "placeholder",
509
+ "size",
510
+ "variant",
511
+ "fluid",
512
+ "inputId",
513
+ "ariaLabel",
514
+ "ariaLabelledby",
515
+ "ariaDescribedby",
516
+ "value",
517
+ "disabled",
518
+ "invalid"
519
+ ],
520
+ outputs: ["valueChange", "touch"]
521
+ },
522
+ {
523
+ kind: "component",
524
+ type: HxMessage,
525
+ selector: "hx-message",
526
+ inputs: [
527
+ "severity",
528
+ "variant",
529
+ "size",
530
+ "icon",
531
+ "closable",
532
+ "closeLabel",
533
+ "life"
534
+ ],
535
+ outputs: ["close"]
536
+ },
537
+ {
538
+ kind: "component",
539
+ type: HxSelect,
540
+ selector: "hx-select",
541
+ inputs: [
542
+ "options",
543
+ "optionLabel",
544
+ "optionValue",
545
+ "optionDisabled",
546
+ "placeholder",
547
+ "emptyMessage",
548
+ "filter",
549
+ "filterPlaceholder",
550
+ "filterBy",
551
+ "emptyFilterMessage",
552
+ "size",
553
+ "variant",
554
+ "fluid",
555
+ "showClear",
556
+ "inputId",
557
+ "ariaLabel",
558
+ "ariaLabelledby",
559
+ "ariaDescribedby",
560
+ "compareWith",
561
+ "value",
562
+ "disabled",
563
+ "invalid"
564
+ ],
565
+ outputs: ["valueChange", "touch"]
566
+ },
567
+ {
568
+ kind: "component",
569
+ type: HxSelectButton,
570
+ selector: "hx-select-button",
571
+ inputs: [
572
+ "options",
573
+ "optionLabel",
574
+ "optionValue",
575
+ "optionDisabled",
576
+ "multiple",
577
+ "allowEmpty",
578
+ "size",
579
+ "fluid",
580
+ "ariaLabel",
581
+ "ariaLabelledby",
582
+ "ariaDescribedby",
583
+ "optionTooltip",
584
+ "value",
585
+ "disabled",
586
+ "invalid"
587
+ ],
588
+ outputs: ["valueChange", "touch"]
589
+ },
590
+ {
591
+ kind: "directive",
592
+ type: HxSwitch,
593
+ selector: "input[hx-switch]",
594
+ exportAs: ["hx-switch"]
595
+ },
596
+ {
597
+ kind: "directive",
598
+ type: NgTemplateOutlet,
599
+ selector: "[ngTemplateOutlet]",
600
+ inputs: [
601
+ "ngTemplateOutletContext",
602
+ "ngTemplateOutlet",
603
+ "ngTemplateOutletInjector"
604
+ ]
605
+ }
606
+ ],
607
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
608
+ });
609
+ };
610
+ i0.ɵɵngDeclareClassMetadata({
611
+ minVersion: "12.0.0",
612
+ version: "22.3.0",
613
+ ngImport: i0,
614
+ type: HxSettingsSectionView,
615
+ decorators: [{
616
+ type: Component,
617
+ args: [{
618
+ selector: "hx-settings-section",
619
+ imports: [
620
+ HxButton,
621
+ HxField,
622
+ HxInput,
623
+ HxInputNumber,
624
+ HxMessage,
625
+ HxSelect,
626
+ HxSelectButton,
627
+ HxSwitch,
628
+ NgTemplateOutlet
629
+ ],
630
+ changeDetection: ChangeDetectionStrategy.OnPush,
631
+ template: "<section [attr.aria-labelledby]=\"section().title ? headingId() : null\">\n @if (section().title) {\n <h2 [id]=\"headingId()\">{{ section().title }}</h2>\n }\n @if (section().description) {\n <p class=\"hx-settings-description\">{{ section().description }}</p>\n }\n @for (item of section().items; track item.id) {\n <div class=\"hx-settings-item\" [class.hx-settings-hit]=\"hits().has(item.id)\">\n @if (itemTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n } @else {\n <hx-field [label]=\"item.label\" [hint]=\"item.description\">\n @switch (item.kind) {\n @case ('toggle') {\n <input\n #box\n hx-switch\n type=\"checkbox\"\n [checked]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (change)=\"toggle(item, box)\"\n />\n }\n @case ('select') {\n <hx-select\n #select\n size=\"small\"\n [options]=\"item.options\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, select.value)\"\n />\n }\n @case ('segmented') {\n <!-- a group of buttons takes no label[for]: it is named here -->\n <hx-select-button\n #segments\n size=\"small\"\n [options]=\"item.options\"\n [allowEmpty]=\"false\"\n [ariaLabel]=\"item.label\"\n [attr.aria-description]=\"item.description\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, segments.value)\"\n />\n }\n @case ('text') {\n <input\n #field\n hx-input\n size=\"small\"\n type=\"text\"\n [value]=\"item.get()\"\n [placeholder]=\"item.placeholder ?? ''\"\n [disabled]=\"item.disabled?.() ?? false\"\n (change)=\"enter(item, field)\"\n />\n }\n @case ('number') {\n <hx-input-number\n #number\n size=\"small\"\n [min]=\"item.min\"\n [max]=\"item.max\"\n [step]=\"item.step ?? 1\"\n [value]=\"item.get()\"\n [disabled]=\"item.disabled?.() ?? false\"\n (valueChange)=\"pick(item, $event, number.value)\"\n />\n }\n @case ('action') {\n <button\n hx-button\n size=\"small\"\n type=\"button\"\n [severity]=\"item.severity ?? 'primary'\"\n [attr.aria-description]=\"item.label\"\n [disabled]=\"item.disabled?.() ?? false\"\n (click)=\"run(item)\"\n >\n {{ item.buttonLabel }}\n </button>\n }\n @case ('readonly') {\n <span class=\"hx-settings-value\">{{ item.value() }}</span>\n @if (item.source) {\n <span class=\"hx-settings-source\">{{ item.source() }}</span>\n }\n }\n @case ('custom') {\n <ng-container\n [ngTemplateOutlet]=\"item.template\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n }\n }\n </hx-field>\n }\n </div>\n }\n @if (failure(); as failed) {\n <hx-message class=\"hx-settings-error\" severity=\"error\">{{ failed.message }}</hx-message>\n }\n @if (section().form; as form) {\n <div class=\"hx-settings-actions\">\n <button\n hx-button\n size=\"small\"\n type=\"button\"\n class=\"hx-settings-save\"\n [loading]=\"saving()\"\n [disabled]=\"!form.dirty()\"\n (click)=\"save(form)\"\n >\n Save\n </button>\n </div>\n }\n</section>\n",
632
+ styles: [":host{display:block}h2{margin:var(--h-space-5) 0 var(--h-space-2);font-size:var(--h-font-size-sm);font-weight:600}.hx-settings-description{max-inline-size:var(--h-measure-text);margin:0 0 var(--h-space-2);font-size:var(--h-font-size-xs);color:var(--h-text-muted-color)}.hx-settings-item{padding:var(--h-space-1) 0;font-size:var(--h-font-size-sm)}.hx-settings-hit>hx-field ::ng-deep>.hx-field-label{justify-self:start;border-radius:var(--h-border-radius-sm);background:color-mix(in srgb,var(--h-text-color) 22%,transparent)}.hx-settings-value{color:var(--h-text-muted-color);overflow-wrap:anywhere}.hx-settings-source{color:var(--h-text-muted-color);font-size:var(--h-font-size-xs);overflow-wrap:anywhere}.hx-settings-actions,.hx-settings-error{margin-top:var(--h-space-2)}\n"]
633
+ }]
634
+ }],
635
+ propDecorators: {
636
+ section: [{
637
+ type: i0.Input,
638
+ args: [{
639
+ isSignal: true,
640
+ alias: "section",
641
+ required: true
642
+ }]
643
+ }],
644
+ headingId: [{
645
+ type: i0.Input,
646
+ args: [{
647
+ isSignal: true,
648
+ alias: "headingId",
649
+ required: true
650
+ }]
651
+ }],
652
+ hits: [{
653
+ type: i0.Input,
654
+ args: [{
655
+ isSignal: true,
656
+ alias: "hits",
657
+ required: true
658
+ }]
659
+ }],
660
+ itemTemplate: [{
661
+ type: i0.Input,
662
+ args: [{
663
+ isSignal: true,
664
+ alias: "itemTemplate",
665
+ required: false
666
+ }]
667
+ }]
668
+ }
669
+ });
670
+ var HxSettingItemTemplate = class HxSettingItemTemplate {
671
+ template = inject(TemplateRef);
672
+ static ngTemplateContextGuard(_directive, _context) {
673
+ return true;
674
+ }
675
+ static ɵfac = i0.ɵɵngDeclareFactory({
676
+ minVersion: "12.0.0",
677
+ version: "22.3.0",
678
+ ngImport: i0,
679
+ type: HxSettingItemTemplate,
680
+ deps: [],
681
+ target: i0.ɵɵFactoryTarget.Directive
682
+ });
683
+ static ɵdir = i0.ɵɵngDeclareDirective({
684
+ minVersion: "14.0.0",
685
+ version: "22.3.0",
686
+ type: HxSettingItemTemplate,
687
+ isStandalone: true,
688
+ selector: "ng-template[hxSettingItem]",
689
+ ngImport: i0
690
+ });
691
+ };
692
+ i0.ɵɵngDeclareClassMetadata({
693
+ minVersion: "12.0.0",
694
+ version: "22.3.0",
695
+ ngImport: i0,
696
+ type: HxSettingItemTemplate,
697
+ decorators: [{
698
+ type: Directive,
699
+ args: [{ selector: "ng-template[hxSettingItem]" }]
700
+ }]
701
+ });
702
+ const NO_HITS = /* @__PURE__ */ new Set();
703
+ let nextViewId = 0;
704
+ var HxSettingsView = class HxSettingsView {
705
+ registry = inject(HxSettingsRegistry);
706
+ searchShortcut = hxShortcut("Mod+F");
707
+ page = model("", ...ngDevMode ? [{ debugName: "page" }] : /* istanbul ignore next */ []);
708
+ collapsed = model([], ...ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []);
709
+ itemTemplate = contentChild(HxSettingItemTemplate, ...ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []);
710
+ search = viewChild.required("search", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
711
+ tree = viewChild(HxTree, ...ngDevMode ? [{ debugName: "tree" }] : /* istanbul ignore next */ []);
712
+ idPrefix = `hx-settings-view-${nextViewId++}`;
713
+ query = signal("", ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
714
+ searching = computed(() => this.query().trim() !== "", ...ngDevMode ? [{ debugName: "searching" }] : /* istanbul ignore next */ []);
715
+ visibleGroups = computed(() => hxFilterSettings(this.registry.groups(), this.query()).filter((g) => g.pages.length > 0), ...ngDevMode ? [{ debugName: "visibleGroups" }] : /* istanbul ignore next */ []);
716
+ current = computed(() => {
717
+ const page = this.registry.resolve(this.page());
718
+ const group = this.registry.groups().find((g) => g.id === page?.group);
719
+ return page && group ? {
720
+ page,
721
+ group
722
+ } : void 0;
723
+ }, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
724
+ sections = computed(() => this.current()?.page.sections() ?? [], ...ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []);
725
+ nodes = computed(() => this.visibleGroups().map((group) => ({
726
+ key: `g:${group.id}`,
727
+ label: group.title,
728
+ leaf: false,
729
+ children: group.pages.map((page) => ({
730
+ key: `p:${page.id}`,
731
+ label: page.title
732
+ }))
733
+ })), ...ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []);
734
+ selection = computed(() => {
735
+ const current = this.current();
736
+ return current ? `p:${current.page.id}` : null;
737
+ }, ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
738
+ constructor() {
739
+ afterRenderEffect(() => {
740
+ const tree = this.tree();
741
+ const nodes = this.nodes();
742
+ const collapsed = this.collapsed();
743
+ const searching = this.searching();
744
+ if (!tree) return;
745
+ untracked(() => {
746
+ for (const { key } of nodes) if (searching || !collapsed.includes(key.slice(2))) tree.expand(key);
747
+ else tree.collapse(key);
748
+ });
749
+ });
750
+ }
751
+ hits(group, page, section) {
752
+ const words = searchWords(this.query());
753
+ if (words.length === 0) return NO_HITS;
754
+ const around = searchText([
755
+ group,
756
+ page,
757
+ section.title
758
+ ]);
759
+ const matching = section.items.filter((item) => {
760
+ const own = searchText([
761
+ item.label,
762
+ item.description,
763
+ ...item.keywords ?? []
764
+ ]);
765
+ return words.some((word) => own.includes(word)) && words.every((word) => own.includes(word) || around.includes(word));
766
+ });
767
+ return new Set(matching.map((item) => item.id));
768
+ }
769
+ sectionKey(section) {
770
+ return `${this.current()?.page.id}/${section.id}`;
771
+ }
772
+ setQuery(event) {
773
+ this.query.set(event.target.value);
774
+ }
775
+ onSelect(tree, selection) {
776
+ const current = this.selection();
777
+ if (selection === current) return;
778
+ if (typeof selection === "string") {
779
+ if (selection.startsWith("p:")) {
780
+ this.page.set(selection.slice(2));
781
+ return;
782
+ }
783
+ if (!this.searching()) tree.toggle(selection);
784
+ }
785
+ tree.selection.set(current);
786
+ }
787
+ groupOpened(key) {
788
+ const id = key.slice(2);
789
+ if (this.searching() || !this.collapsed().includes(id)) return;
790
+ this.collapsed.update((ids) => ids.filter((other) => other !== id));
791
+ }
792
+ groupClosed(tree, key) {
793
+ const id = key.slice(2);
794
+ if (this.searching()) tree.expand(key);
795
+ else if (!this.collapsed().includes(id)) this.collapsed.update((ids) => [...ids, id]);
796
+ }
797
+ onKeydown(event) {
798
+ if (!this.searchShortcut.matches(event)) return;
799
+ event.preventDefault();
800
+ const search = this.search().nativeElement;
801
+ search.focus();
802
+ search.select();
803
+ }
804
+ onSearchKeydown(event) {
805
+ if (event.key !== "Escape" || this.query() === "") return;
806
+ event.preventDefault();
807
+ event.stopPropagation();
808
+ this.query.set("");
809
+ }
810
+ static ɵfac = i0.ɵɵngDeclareFactory({
811
+ minVersion: "12.0.0",
812
+ version: "22.3.0",
813
+ ngImport: i0,
814
+ type: HxSettingsView,
815
+ deps: [],
816
+ target: i0.ɵɵFactoryTarget.Component
817
+ });
818
+ static ɵcmp = i0.ɵɵngDeclareComponent({
819
+ minVersion: "17.0.0",
820
+ version: "22.3.0",
821
+ type: HxSettingsView,
822
+ isStandalone: true,
823
+ selector: "hx-settings-view",
824
+ inputs: {
825
+ page: {
826
+ classPropertyName: "page",
827
+ publicName: "page",
828
+ isSignal: true,
829
+ isRequired: false,
830
+ transformFunction: null
831
+ },
832
+ collapsed: {
833
+ classPropertyName: "collapsed",
834
+ publicName: "collapsed",
835
+ isSignal: true,
836
+ isRequired: false,
837
+ transformFunction: null
838
+ }
839
+ },
840
+ outputs: {
841
+ page: "pageChange",
842
+ collapsed: "collapsedChange"
843
+ },
844
+ host: {
845
+ listeners: { "keydown": "onKeydown($event)" },
846
+ classAttribute: "hx-settings-view"
847
+ },
848
+ queries: [{
849
+ propertyName: "itemTemplate",
850
+ first: true,
851
+ predicate: HxSettingItemTemplate,
852
+ descendants: true,
853
+ isSignal: true
854
+ }],
855
+ viewQueries: [{
856
+ propertyName: "search",
857
+ first: true,
858
+ predicate: ["search"],
859
+ descendants: true,
860
+ isSignal: true
861
+ }, {
862
+ propertyName: "tree",
863
+ first: true,
864
+ predicate: HxTree,
865
+ descendants: true,
866
+ isSignal: true
867
+ }],
868
+ ngImport: i0,
869
+ template: "<nav class=\"hx-settings-nav\" aria-label=\"Settings categories\">\n <hx-field>\n <input\n #search\n hx-input\n fluid\n size=\"small\"\n type=\"search\"\n class=\"hx-settings-search\"\n placeholder=\"Search settings\"\n aria-label=\"Search settings\"\n [value]=\"query()\"\n (input)=\"setQuery($event)\"\n (keydown)=\"onSearchKeydown($event)\"\n />\n </hx-field>\n @if (nodes().length) {\n <hx-tree\n #tree\n class=\"hx-settings-tree\"\n selectionMode=\"single\"\n ariaLabel=\"Settings\"\n [value]=\"nodes()\"\n [selection]=\"selection()\"\n (selectionChange)=\"onSelect(tree, $event)\"\n (nodeExpand)=\"groupOpened($event.node.key)\"\n (nodeCollapse)=\"groupClosed(tree, $event.node.key)\"\n >\n <ng-template hxTreeNode let-node>\n <!-- hx-tree-node-label: the type-ahead of the tree reads the label from it -->\n <span class=\"hx-tree-node-label\" [class.hx-settings-group]=\"node.children\">\n {{ node.label }}\n </span>\n </ng-template>\n </hx-tree>\n }\n <!-- always in the DOM: a live region announces only what changes inside it -->\n <div class=\"hx-settings-empty\" role=\"status\">\n @if (query().trim() && !visibleGroups().length) {\n No settings match.\n }\n </div>\n</nav>\n\n<div class=\"hx-settings-main\">\n @if (current(); as shown) {\n <header class=\"hx-settings-header\">\n <h1>\n <span class=\"hx-settings-crumb-group\">{{ shown.group.title }}</span>\n <span class=\"hx-settings-crumb-separator\"> › </span>\n <span>{{ shown.page.title }}</span>\n </h1>\n </header>\n <div class=\"hx-settings-scroll\">\n <div class=\"hx-settings-page\" [class.hx-settings-page-wide]=\"shown.page.wide\">\n <!-- the page id is part of the key: another page starts with fresh sections, without old errors -->\n @for (section of sections(); track sectionKey(section)) {\n <hx-settings-section\n [section]=\"section\"\n [headingId]=\"idPrefix + '-section-' + $index\"\n [hits]=\"hits(shown.group.title, shown.page.title, section)\"\n [itemTemplate]=\"itemTemplate()?.template\"\n />\n }\n </div>\n </div>\n }\n</div>\n",
870
+ styles: [":host{display:flex;flex:1;min-width:0;min-height:0;height:100%;overflow:hidden;background:var(--h-surface-panel);color:var(--h-text-color)}.hx-settings-nav{display:flex;flex-direction:column;flex:none;box-sizing:border-box;width:240px;min-height:0;padding:var(--h-space-3) var(--h-space-2);gap:var(--h-space-2);overflow-y:auto;font-size:var(--h-font-size-sm);border-inline-end:1px solid var(--h-border-panel)}.hx-settings-tree{--h-tree-background: transparent;--h-tree-padding: 0;--h-tree-indent: var(--h-space-2);--h-tree-node-padding: var(--h-space-1);--h-tree-node-gap: var(--h-space-1);--h-tree-node-border-radius: var(--h-border-radius-sm);--h-tree-node-toggle-button-size: var(--h-font-size-md);--h-tree-node-selected-background: var(--h-list-row-current-background);--h-tree-node-selected-color: var(--h-list-row-current-color);--h-tree-node-selected-font-weight: var(--h-list-row-current-font-weight);--h-tree-node-selected-indicator-color: var(--h-list-row-current-indicator-color);--h-tree-node-selected-indicator-width: var(--h-list-row-current-indicator-width)}.hx-settings-group{font-weight:600}.hx-settings-empty:not(:empty){padding:var(--h-space-1) var(--h-space-2);color:var(--h-text-muted-color)}.hx-settings-main{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.hx-settings-header{flex:none;padding:var(--h-space-3) var(--h-space-6);border-bottom:1px solid var(--h-border-panel)}.hx-settings-header h1{margin:0;font-size:var(--h-font-size-md);font-weight:600}.hx-settings-crumb-group,.hx-settings-crumb-separator{color:var(--h-text-muted-color);font-weight:400}.hx-settings-scroll{flex:1;min-height:0;overflow-y:auto}.hx-settings-page{box-sizing:border-box;max-width:800px;padding:var(--h-space-2) var(--h-space-6) var(--h-space-8)}.hx-settings-page-wide{max-width:1200px}\n"],
871
+ dependencies: [
872
+ {
873
+ kind: "component",
874
+ type: HxField,
875
+ selector: "hx-field",
876
+ inputs: [
877
+ "label",
878
+ "hint",
879
+ "error",
880
+ "required",
881
+ "group"
882
+ ],
883
+ exportAs: ["hx-field"]
884
+ },
885
+ {
886
+ kind: "directive",
887
+ type: HxInput,
888
+ selector: "input[hx-input], textarea[hx-input]",
889
+ inputs: [
890
+ "variant",
891
+ "size",
892
+ "fluid",
893
+ "autoResize"
894
+ ],
895
+ exportAs: ["hx-input"]
896
+ },
897
+ {
898
+ kind: "component",
899
+ type: HxSettingsSectionView,
900
+ selector: "hx-settings-section",
901
+ inputs: [
902
+ "section",
903
+ "headingId",
904
+ "hits",
905
+ "itemTemplate"
906
+ ]
907
+ },
908
+ {
909
+ kind: "component",
910
+ type: HxTree,
911
+ selector: "hx-tree",
912
+ inputs: [
913
+ "value",
914
+ "selectionMode",
915
+ "selection",
916
+ "filter",
917
+ "filterMode",
918
+ "filterPlaceholder",
919
+ "filterLabel",
920
+ "emptyMessage",
921
+ "ariaLabel"
922
+ ],
923
+ outputs: [
924
+ "selectionChange",
925
+ "nodeExpand",
926
+ "nodeCollapse"
927
+ ]
928
+ },
929
+ {
930
+ kind: "directive",
931
+ type: HxTreeNodeTemplate,
932
+ selector: "ng-template[hxTreeNode]"
933
+ }
934
+ ],
935
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
936
+ });
937
+ };
938
+ i0.ɵɵngDeclareClassMetadata({
939
+ minVersion: "12.0.0",
940
+ version: "22.3.0",
941
+ ngImport: i0,
942
+ type: HxSettingsView,
943
+ decorators: [{
944
+ type: Component,
945
+ args: [{
946
+ selector: "hx-settings-view",
947
+ imports: [
948
+ HxField,
949
+ HxInput,
950
+ HxSettingsSectionView,
951
+ HxTree,
952
+ HxTreeNodeTemplate
953
+ ],
954
+ changeDetection: ChangeDetectionStrategy.OnPush,
955
+ host: {
956
+ class: "hx-settings-view",
957
+ "(keydown)": "onKeydown($event)"
958
+ },
959
+ template: "<nav class=\"hx-settings-nav\" aria-label=\"Settings categories\">\n <hx-field>\n <input\n #search\n hx-input\n fluid\n size=\"small\"\n type=\"search\"\n class=\"hx-settings-search\"\n placeholder=\"Search settings\"\n aria-label=\"Search settings\"\n [value]=\"query()\"\n (input)=\"setQuery($event)\"\n (keydown)=\"onSearchKeydown($event)\"\n />\n </hx-field>\n @if (nodes().length) {\n <hx-tree\n #tree\n class=\"hx-settings-tree\"\n selectionMode=\"single\"\n ariaLabel=\"Settings\"\n [value]=\"nodes()\"\n [selection]=\"selection()\"\n (selectionChange)=\"onSelect(tree, $event)\"\n (nodeExpand)=\"groupOpened($event.node.key)\"\n (nodeCollapse)=\"groupClosed(tree, $event.node.key)\"\n >\n <ng-template hxTreeNode let-node>\n <!-- hx-tree-node-label: the type-ahead of the tree reads the label from it -->\n <span class=\"hx-tree-node-label\" [class.hx-settings-group]=\"node.children\">\n {{ node.label }}\n </span>\n </ng-template>\n </hx-tree>\n }\n <!-- always in the DOM: a live region announces only what changes inside it -->\n <div class=\"hx-settings-empty\" role=\"status\">\n @if (query().trim() && !visibleGroups().length) {\n No settings match.\n }\n </div>\n</nav>\n\n<div class=\"hx-settings-main\">\n @if (current(); as shown) {\n <header class=\"hx-settings-header\">\n <h1>\n <span class=\"hx-settings-crumb-group\">{{ shown.group.title }}</span>\n <span class=\"hx-settings-crumb-separator\"> › </span>\n <span>{{ shown.page.title }}</span>\n </h1>\n </header>\n <div class=\"hx-settings-scroll\">\n <div class=\"hx-settings-page\" [class.hx-settings-page-wide]=\"shown.page.wide\">\n <!-- the page id is part of the key: another page starts with fresh sections, without old errors -->\n @for (section of sections(); track sectionKey(section)) {\n <hx-settings-section\n [section]=\"section\"\n [headingId]=\"idPrefix + '-section-' + $index\"\n [hits]=\"hits(shown.group.title, shown.page.title, section)\"\n [itemTemplate]=\"itemTemplate()?.template\"\n />\n }\n </div>\n </div>\n }\n</div>\n",
960
+ styles: [":host{display:flex;flex:1;min-width:0;min-height:0;height:100%;overflow:hidden;background:var(--h-surface-panel);color:var(--h-text-color)}.hx-settings-nav{display:flex;flex-direction:column;flex:none;box-sizing:border-box;width:240px;min-height:0;padding:var(--h-space-3) var(--h-space-2);gap:var(--h-space-2);overflow-y:auto;font-size:var(--h-font-size-sm);border-inline-end:1px solid var(--h-border-panel)}.hx-settings-tree{--h-tree-background: transparent;--h-tree-padding: 0;--h-tree-indent: var(--h-space-2);--h-tree-node-padding: var(--h-space-1);--h-tree-node-gap: var(--h-space-1);--h-tree-node-border-radius: var(--h-border-radius-sm);--h-tree-node-toggle-button-size: var(--h-font-size-md);--h-tree-node-selected-background: var(--h-list-row-current-background);--h-tree-node-selected-color: var(--h-list-row-current-color);--h-tree-node-selected-font-weight: var(--h-list-row-current-font-weight);--h-tree-node-selected-indicator-color: var(--h-list-row-current-indicator-color);--h-tree-node-selected-indicator-width: var(--h-list-row-current-indicator-width)}.hx-settings-group{font-weight:600}.hx-settings-empty:not(:empty){padding:var(--h-space-1) var(--h-space-2);color:var(--h-text-muted-color)}.hx-settings-main{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.hx-settings-header{flex:none;padding:var(--h-space-3) var(--h-space-6);border-bottom:1px solid var(--h-border-panel)}.hx-settings-header h1{margin:0;font-size:var(--h-font-size-md);font-weight:600}.hx-settings-crumb-group,.hx-settings-crumb-separator{color:var(--h-text-muted-color);font-weight:400}.hx-settings-scroll{flex:1;min-height:0;overflow-y:auto}.hx-settings-page{box-sizing:border-box;max-width:800px;padding:var(--h-space-2) var(--h-space-6) var(--h-space-8)}.hx-settings-page-wide{max-width:1200px}\n"]
961
+ }]
962
+ }],
963
+ ctorParameters: () => [],
964
+ propDecorators: {
965
+ page: [{
966
+ type: i0.Input,
967
+ args: [{
968
+ isSignal: true,
969
+ alias: "page",
970
+ required: false
971
+ }]
972
+ }, {
973
+ type: i0.Output,
974
+ args: ["pageChange"]
975
+ }],
976
+ collapsed: [{
977
+ type: i0.Input,
978
+ args: [{
979
+ isSignal: true,
980
+ alias: "collapsed",
981
+ required: false
982
+ }]
983
+ }, {
984
+ type: i0.Output,
985
+ args: ["collapsedChange"]
986
+ }],
987
+ itemTemplate: [{
988
+ type: i0.ContentChild,
989
+ args: [i0.forwardRef(() => HxSettingItemTemplate), { isSignal: true }]
990
+ }],
991
+ search: [{
992
+ type: i0.ViewChild,
993
+ args: ["search", { isSignal: true }]
994
+ }],
995
+ tree: [{
996
+ type: i0.ViewChild,
997
+ args: [i0.forwardRef(() => HxTree), { isSignal: true }]
998
+ }]
999
+ }
1000
+ });
1001
+ const HX_BOTTOM_BAR_MAX_ITEMS = 5;
1002
+ function hxViewsFor(views, platform = getHxPlatform()) {
1003
+ const kind = getHxPlatformKind(platform);
1004
+ return views.filter((view) => !view.platforms || view.platforms.some((p) => p === platform || p === kind));
1005
+ }
1006
+ function hxMobileViews(views, platform = getHxPlatform()) {
1007
+ const available = hxViewsFor(views, platform);
1008
+ const order = (view) => view.barOrder ?? Number.POSITIVE_INFINITY;
1009
+ const bar = available.filter((view) => view.mobilePlacement === "bar").sort((a, b) => order(a) === order(b) ? 0 : order(a) < order(b) ? -1 : 1).slice(0, 5);
1010
+ return {
1011
+ bar,
1012
+ drawer: available.filter((view) => !bar.includes(view))
1013
+ };
1014
+ }
1015
+ function hxViewContent(view, platform = getHxPlatform()) {
1016
+ return view.platformContent?.[getHxPlatformKind(platform)] ?? view.content;
1017
+ }
1018
+ const HX_WINDOW_MIN_WIDTH = 720;
1019
+ const HX_WINDOW_MIN_HEIGHT = 480;
1020
+ const HELIX_DESKTOP_VERSION = "0.1.0";
1021
+ export { HELIX_DESKTOP_VERSION, HX_BOTTOM_BAR_MAX_ITEMS, HX_SETTINGS_GROUP_APPEARANCE, HX_SETTINGS_GROUP_GENERAL, HX_SETTINGS_PAGE_APPEARANCE, HX_WINDOW_MIN_HEIGHT, HX_WINDOW_MIN_WIDTH, HxSettingItemTemplate, HxSettingsRegistry, HxSettingsView, getHxPlatform, getHxPlatformKind, hxFilterSettings, hxMobileViews, hxViewContent, hxViewsFor, provideHxSettings, setHxPlatform };
1022
+
1023
+ //# sourceMappingURL=gravionlabs-helix-app.mjs.map