@adea-ai/ui 0.100.0 → 0.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/about-dialog/about-dialog.d.ts.map +1 -1
- package/dist/components/composites/about-dialog/about-dialog.js +2 -1
- package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.d.ts +7 -0
- package/dist/components/composites/account-menu/account-menu.d.ts.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js +116 -89
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/help-center/help-center.d.ts.map +1 -1
- package/dist/components/composites/help-center/help-center.js +26 -21
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +43 -36
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/stat/stat.d.ts.map +1 -1
- package/dist/components/composites/stat/stat.js +46 -35
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js +73 -58
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/layout/page/page.d.ts.map +1 -1
- package/dist/components/layout/page/page.js +19 -13
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/theme/appearance-panel.d.ts.map +1 -1
- package/dist/components/theme/appearance-panel.js +37 -18
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js +5 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/card/card.d.ts.map +1 -1
- package/dist/components/ui/card/card.js +5 -1
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/chart/chart-options.d.ts +3 -2
- package/dist/components/ui/chart/chart-options.d.ts.map +1 -1
- package/dist/components/ui/chart/chart-options.js +30 -9
- package/dist/components/ui/chart/chart-options.js.map +1 -1
- package/dist/components/ui/chart/chart.d.ts +4 -9
- package/dist/components/ui/chart/chart.d.ts.map +1 -1
- package/dist/components/ui/chart/chart.js +65 -10
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +5 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/drawer/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer/drawer.js +5 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +2 -1
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/item/item.d.ts +1 -1
- package/dist/components/ui/sheet/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet/sheet.js +5 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/typography/index.d.ts +3 -0
- package/dist/components/ui/typography/index.d.ts.map +1 -0
- package/dist/components/ui/typography/index.js +2 -0
- package/dist/components/ui/typography/typography.d.ts +84 -0
- package/dist/components/ui/typography/typography.d.ts.map +1 -0
- package/dist/components/ui/typography/typography.js +179 -0
- package/dist/components/ui/typography/typography.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/r/account-menu.json +1 -0
- package/dist/r/alert-dialog.json +1 -0
- package/dist/r/card.json +1 -0
- package/dist/r/dialog.json +1 -0
- package/dist/r/drawer.json +1 -0
- package/dist/r/field.json +1 -0
- package/dist/r/help-center.json +1 -0
- package/dist/r/page.json +1 -0
- package/dist/r/registry.json +37 -0
- package/dist/r/settings.json +1 -0
- package/dist/r/sheet.json +1 -0
- package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +3 -2
- package/dist/r/src/components/composites/account-menu/account-menu.tsx +105 -66
- package/dist/r/src/components/composites/help-center/help-center.tsx +2 -1
- package/dist/r/src/components/composites/settings/settings.tsx +4 -1
- package/dist/r/src/components/composites/stat/stat.tsx +7 -2
- package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +36 -24
- package/dist/r/src/components/layout/page/page.tsx +3 -2
- package/dist/r/src/components/theme/appearance-panel.tsx +13 -4
- package/dist/r/src/components/ui/alert-dialog/alert-dialog.tsx +2 -1
- package/dist/r/src/components/ui/card/card.tsx +2 -1
- package/dist/r/src/components/ui/chart/chart-options.ts +35 -7
- package/dist/r/src/components/ui/chart/chart.tsx +65 -12
- package/dist/r/src/components/ui/dialog/dialog.tsx +2 -1
- package/dist/r/src/components/ui/drawer/drawer.tsx +2 -1
- package/dist/r/src/components/ui/field/field.tsx +2 -3
- package/dist/r/src/components/ui/sheet/sheet.tsx +5 -1
- package/dist/r/src/components/ui/typography/index.ts +9 -0
- package/dist/r/src/components/ui/typography/typography.tsx +205 -0
- package/dist/r/stat.json +1 -0
- package/dist/r/theming.json +1 -0
- package/dist/r/typography.json +24 -0
- package/dist/r/update-dialog.json +1 -0
- package/package.json +1 -1
- package/registry.json +37 -0
- package/src/components/composites/about-dialog/about-dialog.tsx +3 -2
- package/src/components/composites/account-menu/account-menu.tsx +105 -66
- package/src/components/composites/help-center/help-center.tsx +2 -1
- package/src/components/composites/settings/settings.tsx +4 -1
- package/src/components/composites/stat/stat.tsx +7 -2
- package/src/components/composites/update-dialog/update-dialog.tsx +36 -24
- package/src/components/layout/page/page.tsx +3 -2
- package/src/components/theme/appearance-panel.tsx +13 -4
- package/src/components/ui/alert-dialog/alert-dialog.tsx +2 -1
- package/src/components/ui/card/card.tsx +2 -1
- package/src/components/ui/chart/chart-options.ts +35 -7
- package/src/components/ui/chart/chart.tsx +65 -12
- package/src/components/ui/dialog/dialog.tsx +2 -1
- package/src/components/ui/drawer/drawer.tsx +2 -1
- package/src/components/ui/field/field.tsx +2 -3
- package/src/components/ui/sheet/sheet.tsx +5 -1
- package/src/components/ui/typography/index.ts +9 -0
- package/src/components/ui/typography/typography.tsx +205 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about-dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/about-dialog/about-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAA;AAOjB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,eAAe,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;CACpD,CAAA;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"about-dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/about-dialog/about-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,UAAU,CAAA;AAOjB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,eAAe,CAAC,EAAE,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,CAAA;CACpD,CAAA;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAwIlD"}
|
|
@@ -5,7 +5,7 @@ import { createComponent, effect, insert, setAttribute, template } from "solid-j
|
|
|
5
5
|
import { ExternalLink } from "lucide-solid";
|
|
6
6
|
import { Show, createEffect, createMemo, createSignal, on, onCleanup } from "solid-js";
|
|
7
7
|
//#region src/components/composites/about-dialog/about-dialog.tsx
|
|
8
|
-
var _tmpl$ = /*#__PURE__*/ template(`<div class="flex flex-col items-center gap-
|
|
8
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="flex flex-col items-center gap-2 text-center"><img alt class=size-14 aria-hidden=true><p class="text-sm text-foreground"></p><p class="text-xs text-muted-foreground"></p><div class="flex flex-wrap items-center justify-center gap-3">`);
|
|
9
9
|
/** Compact app identity and support details, with clipboard and native-browser adapters. */
|
|
10
10
|
function AboutDialog(props) {
|
|
11
11
|
const versionLabel = () => props.version ? `Version ${props.version}` : "Version unavailable";
|
|
@@ -75,6 +75,7 @@ function AboutDialog(props) {
|
|
|
75
75
|
},
|
|
76
76
|
get children() {
|
|
77
77
|
return createComponent(DialogContent, {
|
|
78
|
+
"class": "w-96",
|
|
78
79
|
onKeyDown: (event) => {
|
|
79
80
|
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
80
81
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"about-dialog.js","names":["createEffect","createMemo","createSignal","on","onCleanup","Show","Accessor","ExternalLink","ActionButton","Alert","AlertDescription","Dialog","DialogContent","DialogTitle","createDialogFocusRestoration","AboutDialogProps","appName","appIcon","version","platform","copyright","sourceUrl","open","onOpenChange","copyVersionInfo","text","Promise","openExternal","url","restoreFocusRef","HTMLElement","AboutDialog","props","versionLabel","versionInfo","join","copied","setCopied","error","setError","copying","setCopying","disposed","epoch","timer","ReturnType","setTimeout","clearTimeout","focus","copy","owner","active","navigator","clipboard","writeText","openSource","_$createComponent","children","onKeyDown","event","KeyboardEvent","key","defaultPrevented","preventDefault","aria-label","undefined","onOpenAutoFocus","currentTarget","preventScroll","onCloseAutoFocus","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$insert","type","variant","size","busy","tooltip","onClick","as","href","target","rel","when","role","_$effect","_$setAttribute","_$createComponent","_$setAttribute"],"sources":["../../../../src/components/composites/about-dialog/about-dialog.tsx"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n on,\n onCleanup,\n Show,\n type Accessor,\n} from 'solid-js'\nimport { ExternalLink } from 'lucide-solid'\nimport { ActionButton } from '../action-button'\nimport { Alert, AlertDescription } from '../../ui/alert'\nimport { Dialog, DialogContent, DialogTitle } from '../../ui/dialog'\nimport { createDialogFocusRestoration } from '../../ui/dialog/dialog'\n\nexport type AboutDialogProps = {\n appName: string\n appIcon: string\n version?: string\n platform: string\n copyright: string\n sourceUrl: string\n open: boolean\n onOpenChange: (open: boolean) => void\n copyVersionInfo?: (text: string) => Promise<void>\n openExternal?: (url: string) => Promise<void>\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** Compact app identity and support details, with clipboard and native-browser adapters. */\nexport function AboutDialog(props: AboutDialogProps) {\n const versionLabel = () => (props.version ? `Version ${props.version}` : 'Version unavailable')\n const versionInfo = createMemo(() =>\n [props.appName, versionLabel(), `Platform: ${props.platform}`].join('\\n')\n )\n const [copied, setCopied] = createSignal(false)\n const [error, setError] = createSignal('')\n const [copying, setCopying] = createSignal(false)\n let disposed = false\n let epoch = 0\n let timer: ReturnType<typeof setTimeout> | undefined\n onCleanup(() => {\n disposed = true\n epoch += 1\n clearTimeout(timer)\n })\n createEffect(\n on(\n () => props.open,\n () => {\n epoch += 1\n clearTimeout(timer)\n setCopied(false)\n setError('')\n setCopying(false)\n }\n )\n )\n const focus = createDialogFocusRestoration({\n open: () => props.open,\n restoreFocusRef: props.restoreFocusRef,\n })\n const copy = async () => {\n const owner = epoch\n const active = () => !disposed && props.open && owner === epoch\n setError('')\n setCopied(false)\n setCopying(true)\n try {\n if (props.copyVersionInfo) await props.copyVersionInfo(versionInfo())\n else await navigator.clipboard.writeText(versionInfo())\n if (!active()) return\n setCopied(true)\n clearTimeout(timer)\n timer = setTimeout(() => {\n if (active()) setCopied(false)\n }, 2000)\n } catch {\n if (active()) setError('Could not copy version info. Please try again.')\n } finally {\n if (active()) setCopying(false)\n }\n }\n const openSource = async () => {\n const owner = epoch\n setError('')\n try {\n await props.openExternal?.(props.sourceUrl)\n } catch {\n if (!disposed && props.open && owner === epoch)\n setError('Could not open the source repository. Please try again.')\n }\n }\n return (\n <Dialog open={props.open} onOpenChange={props.onOpenChange}>\n <DialogContent\n onKeyDown={(event: KeyboardEvent) => {\n // Tooltip help on the identity actions cannot trap Escape in this popup.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault()\n props.onOpenChange(false)\n }\n }}\n aria-label={`About ${props.appName}`}\n aria-labelledby=\"\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n focus.onOpenAutoFocus(event)\n // Let the identity be read before focus opens explanatory action help.\n if (!event.defaultPrevented && event.currentTarget instanceof HTMLElement) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n }}\n onCloseAutoFocus={focus.onCloseAutoFocus}\n >\n <div class=\"flex flex-col items-center gap-3 px-6 py-8 text-center\">\n <img src={props.appIcon} alt=\"\" class=\"size-16\" aria-hidden=\"true\" />\n <DialogTitle>{props.appName}</DialogTitle>\n {/* Body text on the dialog's themed surface: primary ink measures\n below AA against the lighter dialog backgrounds across schemes,\n so the version and the source link carry foreground ink and keep\n primary as the link's underline accent (the text-link treatment). */}\n <p class=\"text-sm text-foreground\">{versionLabel()}</p>\n <p class=\"text-xs text-muted-foreground\">{props.copyright}</p>\n <div class=\"flex flex-wrap items-center justify-center gap-3\">\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n busy={copying()}\n tooltip=\"Copy the app version and runtime details for a support report.\"\n onClick={() => void copy()}\n >\n {copied() ? 'Copied' : 'Copy version info'}\n </ActionButton>\n <ActionButton\n as=\"a\"\n variant=\"link\"\n size=\"sm\"\n class=\"text-foreground decoration-primary\"\n href={props.sourceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n tooltip={`Open the ${props.appName} source repository in your browser.`}\n onClick={(event) => {\n if (props.openExternal) {\n event.preventDefault()\n void openSource()\n }\n }}\n >\n <ExternalLink aria-hidden=\"true\" />\n View source\n </ActionButton>\n </div>\n <Show when={error()}>\n <Alert variant=\"destructive\" role=\"alert\">\n <AlertDescription>{error()}</AlertDescription>\n </Alert>\n </Show>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAgB+B,YAAYC,OAAyB;CACnD,MAAMC,qBAAsBD,MAAMd,UAAU,WAAWc,MAAMd,YAAY;CACzE,MAAMgB,cAAcjC,iBAClB;EAAC+B,MAAMhB;EAASiB,aAAa;EAAG,aAAaD,MAAMb;CAAU,CAAC,CAACgB,KAAK,IAAI,CAC1E;CACA,MAAM,CAACC,QAAQC,aAAanC,aAAa,KAAK;CAC9C,MAAM,CAACoC,OAAOC,YAAYrC,aAAa,EAAE;CACzC,MAAM,CAACsC,SAASC,cAAcvC,aAAa,KAAK;CAChD,IAAIwC,WAAW;CACf,IAAIC,QAAQ;CACZ,IAAIC;CACJ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MAAMhB,QAAO;MAAqC;MACvEoE,UAAUzB,UAAU;OAClB,IAAI3B,MAAML,cAAc;QACtBgC,MAAMI,eAAe;QACrB,WAAgB;OAClB;MACF;MAAC,IAAAN,WAAA;OAAA,OAAA,CAAAD,gBAEAjD,cAAY,EAAA,eAAA,OAAA,CAAA,GAAA,aAAA;MAAA;KAAA,CAAA,GAAA,IAAA;KAAAuE,OAAAR,MAAAd,gBAIhBnD,MAAI;MAAA,IAACoF,OAAI;OAAA,OAAEnD,MAAM;MAAC;MAAA,IAAAmB,WAAA;OAAA,OAAAD,gBAChB/C,OAAK;QAACuE,SAAO;QAAeU,MAAI;QAAA,IAAAjC,WAAA;SAAA,OAAAD,gBAC9B9C,kBAAgB,EAAA,IAAA+C,WAAA;UAAA,OAAEnB,MAAM;SAAC,EAAA,CAAA;QAAA;OAAA,CAAA;MAAA;KAAA,CAAA,GAAA,IAAA;KAAAqD,aAAAC,aAAApB,OAAA,OAzCpBxC,MAAMf,OAAO,CAAA;KAAA,OAAAqD;IAAA;GAAA,CAAA;EAAA;CAAA,CAAA;AAgDjC"}
|
|
1
|
+
{"version":3,"file":"about-dialog.js","names":["createEffect","createMemo","createSignal","on","onCleanup","Show","Accessor","ExternalLink","ActionButton","Alert","AlertDescription","Dialog","DialogContent","DialogTitle","createDialogFocusRestoration","AboutDialogProps","appName","appIcon","version","platform","copyright","sourceUrl","open","onOpenChange","copyVersionInfo","text","Promise","openExternal","url","restoreFocusRef","HTMLElement","AboutDialog","props","versionLabel","versionInfo","join","copied","setCopied","error","setError","copying","setCopying","disposed","epoch","timer","ReturnType","setTimeout","clearTimeout","focus","copy","owner","active","navigator","clipboard","writeText","openSource","_$createComponent","children","onKeyDown","event","KeyboardEvent","key","defaultPrevented","preventDefault","aria-label","undefined","onOpenAutoFocus","currentTarget","preventScroll","onCloseAutoFocus","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$insert","type","variant","size","busy","tooltip","onClick","as","href","target","rel","when","role","_$effect","_$setAttribute","_$createComponent","_$setAttribute"],"sources":["../../../../src/components/composites/about-dialog/about-dialog.tsx"],"sourcesContent":["import {\n createEffect,\n createMemo,\n createSignal,\n on,\n onCleanup,\n Show,\n type Accessor,\n} from 'solid-js'\nimport { ExternalLink } from 'lucide-solid'\nimport { ActionButton } from '../action-button'\nimport { Alert, AlertDescription } from '../../ui/alert'\nimport { Dialog, DialogContent, DialogTitle } from '../../ui/dialog'\nimport { createDialogFocusRestoration } from '../../ui/dialog/dialog'\n\nexport type AboutDialogProps = {\n appName: string\n appIcon: string\n version?: string\n platform: string\n copyright: string\n sourceUrl: string\n open: boolean\n onOpenChange: (open: boolean) => void\n copyVersionInfo?: (text: string) => Promise<void>\n openExternal?: (url: string) => Promise<void>\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n}\n\n/** Compact app identity and support details, with clipboard and native-browser adapters. */\nexport function AboutDialog(props: AboutDialogProps) {\n const versionLabel = () => (props.version ? `Version ${props.version}` : 'Version unavailable')\n const versionInfo = createMemo(() =>\n [props.appName, versionLabel(), `Platform: ${props.platform}`].join('\\n')\n )\n const [copied, setCopied] = createSignal(false)\n const [error, setError] = createSignal('')\n const [copying, setCopying] = createSignal(false)\n let disposed = false\n let epoch = 0\n let timer: ReturnType<typeof setTimeout> | undefined\n onCleanup(() => {\n disposed = true\n epoch += 1\n clearTimeout(timer)\n })\n createEffect(\n on(\n () => props.open,\n () => {\n epoch += 1\n clearTimeout(timer)\n setCopied(false)\n setError('')\n setCopying(false)\n }\n )\n )\n const focus = createDialogFocusRestoration({\n open: () => props.open,\n restoreFocusRef: props.restoreFocusRef,\n })\n const copy = async () => {\n const owner = epoch\n const active = () => !disposed && props.open && owner === epoch\n setError('')\n setCopied(false)\n setCopying(true)\n try {\n if (props.copyVersionInfo) await props.copyVersionInfo(versionInfo())\n else await navigator.clipboard.writeText(versionInfo())\n if (!active()) return\n setCopied(true)\n clearTimeout(timer)\n timer = setTimeout(() => {\n if (active()) setCopied(false)\n }, 2000)\n } catch {\n if (active()) setError('Could not copy version info. Please try again.')\n } finally {\n if (active()) setCopying(false)\n }\n }\n const openSource = async () => {\n const owner = epoch\n setError('')\n try {\n await props.openExternal?.(props.sourceUrl)\n } catch {\n if (!disposed && props.open && owner === epoch)\n setError('Could not open the source repository. Please try again.')\n }\n }\n return (\n <Dialog open={props.open} onOpenChange={props.onOpenChange}>\n <DialogContent\n class=\"w-96\"\n onKeyDown={(event: KeyboardEvent) => {\n // Tooltip help on the identity actions cannot trap Escape in this popup.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault()\n props.onOpenChange(false)\n }\n }}\n aria-label={`About ${props.appName}`}\n aria-labelledby=\"\"\n aria-describedby={undefined}\n onOpenAutoFocus={(event) => {\n focus.onOpenAutoFocus(event)\n // Let the identity be read before focus opens explanatory action help.\n if (!event.defaultPrevented && event.currentTarget instanceof HTMLElement) {\n event.preventDefault()\n event.currentTarget.focus({ preventScroll: true })\n }\n }}\n onCloseAutoFocus={focus.onCloseAutoFocus}\n >\n <div class=\"flex flex-col items-center gap-2 text-center\">\n <img src={props.appIcon} alt=\"\" class=\"size-14\" aria-hidden=\"true\" />\n <DialogTitle>{props.appName}</DialogTitle>\n {/* Body text on the dialog's themed surface: primary ink measures\n below AA against the lighter dialog backgrounds across schemes,\n so the version and the source link carry foreground ink and keep\n primary as the link's underline accent (the text-link treatment). */}\n <p class=\"text-sm text-foreground\">{versionLabel()}</p>\n <p class=\"text-xs text-muted-foreground\">{props.copyright}</p>\n <div class=\"flex flex-wrap items-center justify-center gap-3\">\n <ActionButton\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n busy={copying()}\n tooltip=\"Copy the app version and runtime details for a support report.\"\n onClick={() => void copy()}\n >\n {copied() ? 'Copied' : 'Copy version info'}\n </ActionButton>\n <ActionButton\n as=\"a\"\n variant=\"link\"\n size=\"sm\"\n class=\"text-foreground decoration-primary\"\n href={props.sourceUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n tooltip={`Open the ${props.appName} source repository in your browser.`}\n onClick={(event) => {\n if (props.openExternal) {\n event.preventDefault()\n void openSource()\n }\n }}\n >\n <ExternalLink aria-hidden=\"true\" />\n View source\n </ActionButton>\n </div>\n <Show when={error()}>\n <Alert variant=\"destructive\" role=\"alert\">\n <AlertDescription>{error()}</AlertDescription>\n </Alert>\n </Show>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAgB+B,YAAYC,OAAyB;CACnD,MAAMC,qBAAsBD,MAAMd,UAAU,WAAWc,MAAMd,YAAY;CACzE,MAAMgB,cAAcjC,iBAClB;EAAC+B,MAAMhB;EAASiB,aAAa;EAAG,aAAaD,MAAMb;CAAU,CAAC,CAACgB,KAAK,IAAI,CAC1E;CACA,MAAM,CAACC,QAAQC,aAAanC,aAAa,KAAK;CAC9C,MAAM,CAACoC,OAAOC,YAAYrC,aAAa,EAAE;CACzC,MAAM,CAACsC,SAASC,cAAcvC,aAAa,KAAK;CAChD,IAAIwC,WAAW;CACf,IAAIC,QAAQ;CACZ,IAAIC;CACJxC,gBAAgB;EACdsC,WAAW;EACXC,SAAS;EACTI,aAAaH,KAAK;CACpB,CAAC;CACD5C,aACEG,SACQ6B,MAAMV,YACN;EACJqB,SAAS;EACTI,aAAaH,KAAK;EAClBP,UAAU,KAAK;EACfE,SAAS,EAAE;EACXE,WAAW,KAAK;CAClB,CACF,CACF;CACA,MAAMO,QAAQlC,6BAA6B;EACzCQ,YAAYU,MAAMV;EAClBO,iBAAiBG,MAAMH;CACzB,CAAC;CACD,MAAMoB,OAAO,YAAY;EACvB,MAAMC,QAAQP;EACd,MAAMQ,eAAe,CAACT,YAAYV,MAAMV,QAAQ4B,UAAUP;EAC1DJ,SAAS,EAAE;EACXF,UAAU,KAAK;EACfI,WAAW,IAAI;EACf,IAAI;GACF,IAAIT,MAAMR,iBAAiB,MAAMQ,MAAMR,gBAAgBU,YAAY,CAAC;QAC/D,MAAMkB,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A;KAAA,CAAA,GAAA,IAAA;KAAAqD,aAAAC,aAAApB,OAAA,OAzCpBxC,MAAMf,OAAO,CAAA;KAAA,OAAAqD;IAAA;GAAA,CAAA;EAAA;CAAA,CAAA;AAgDjC"}
|
|
@@ -47,6 +47,13 @@ export type AccountMenuProps = {
|
|
|
47
47
|
hideArrow?: boolean;
|
|
48
48
|
/** The trigger size. Icon-only menus default to the standard icon size. */
|
|
49
49
|
size?: ButtonProps['size'];
|
|
50
|
+
/**
|
|
51
|
+
* Render the trigger as a `SideRailButton` row instead of a bare icon
|
|
52
|
+
* button: same geometry, hover treatment, and flush collapsed-rail tip as
|
|
53
|
+
* every other entry in the surrounding rail. The component's own tooltip
|
|
54
|
+
* is skipped — the rail row owns its help.
|
|
55
|
+
*/
|
|
56
|
+
railTrigger?: boolean;
|
|
50
57
|
/** The entries above the separator. */
|
|
51
58
|
items: readonly AccountMenuItem[];
|
|
52
59
|
/** Which platform this is rendered on, for items that declare one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/account-menu/account-menu.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"account-menu.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/account-menu/account-menu.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAGnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEjE,OAAO,EACL,YAAY,EAMb,MAAM,sCAAsC,CAAA;AAG7C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,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I,CAAA;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAWD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAoJlD;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,WAAW,CAAC,EAAE,eAAe,CAAA;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC/C,MAAM,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAC9C,UAAU,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;IACjD,UAAU,CAAC,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAA;CACnD,GAAG,eAAe,EAAE,CAoCpB"}
|
|
@@ -2,6 +2,7 @@ import { cn } from "../../../lib/utils.js";
|
|
|
2
2
|
import { Button } from "../../ui/button/button.js";
|
|
3
3
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../../ui/dropdown-menu/dropdown-menu.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../ui/tooltip/tooltip.js";
|
|
5
|
+
import { SideRailButton } from "../../layout/side-rail/side-rail.js";
|
|
5
6
|
import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
|
|
6
7
|
import { CircleHelp, Info, LogIn, LogOut, Megaphone, RefreshCw, Settings2, Smartphone, UserRound } from "lucide-solid";
|
|
7
8
|
import { For, Show, createSignal, onCleanup, splitProps } from "solid-js";
|
|
@@ -22,6 +23,7 @@ function AccountMenu(props) {
|
|
|
22
23
|
"gutter",
|
|
23
24
|
"hideArrow",
|
|
24
25
|
"size",
|
|
26
|
+
"railTrigger",
|
|
25
27
|
"items",
|
|
26
28
|
"platform",
|
|
27
29
|
"authenticated",
|
|
@@ -42,26 +44,25 @@ function AccountMenu(props) {
|
|
|
42
44
|
scheduledAfterClose = void 0;
|
|
43
45
|
});
|
|
44
46
|
const visible = () => local.items.filter((item) => !item.platform || item.platform === (local.platform ?? "desktop"));
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const menu = () => createComponent(DropdownMenu, {
|
|
48
|
+
modal: false,
|
|
49
|
+
get placement() {
|
|
50
|
+
return local.placement ?? "top-start";
|
|
51
|
+
},
|
|
52
|
+
get gutter() {
|
|
53
|
+
return local.gutter;
|
|
54
|
+
},
|
|
55
|
+
onOpenChange: (open) => {
|
|
56
|
+
setMenuOpen(open);
|
|
57
|
+
if (open) setTooltipOpen(false);
|
|
48
58
|
},
|
|
49
|
-
onOpenChange: (open) => setTooltipOpen(open && !menuOpen()),
|
|
50
59
|
get children() {
|
|
51
|
-
return [createComponent(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return local.placement ?? "top-start";
|
|
60
|
+
return [createComponent(Show, {
|
|
61
|
+
get when() {
|
|
62
|
+
return local.railTrigger;
|
|
55
63
|
},
|
|
56
|
-
get
|
|
57
|
-
return
|
|
58
|
-
},
|
|
59
|
-
onOpenChange: (open) => {
|
|
60
|
-
setMenuOpen(open);
|
|
61
|
-
if (open) setTooltipOpen(false);
|
|
62
|
-
},
|
|
63
|
-
get children() {
|
|
64
|
-
return [createComponent(TooltipTrigger, mergeProps({
|
|
64
|
+
get fallback() {
|
|
65
|
+
return createComponent(TooltipTrigger, mergeProps({
|
|
65
66
|
as: AccountMenuButton,
|
|
66
67
|
ref: (element) => trigger = element,
|
|
67
68
|
variant: "ghost",
|
|
@@ -78,88 +79,114 @@ function AccountMenu(props) {
|
|
|
78
79
|
onPointerEnter: () => local.onIntent?.()
|
|
79
80
|
}, rest, { get children() {
|
|
80
81
|
return createComponent(UserRound, { "aria-hidden": "true" });
|
|
81
|
-
} }))
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
} }));
|
|
83
|
+
},
|
|
84
|
+
get children() {
|
|
85
|
+
return createComponent(DropdownMenuTrigger, mergeProps({
|
|
86
|
+
as: SideRailButton,
|
|
87
|
+
ref: (element) => trigger = element,
|
|
88
|
+
get label() {
|
|
89
|
+
return local.label ?? "Account and settings";
|
|
84
90
|
},
|
|
85
|
-
"class"
|
|
86
|
-
|
|
87
|
-
const selection = pendingAfterClose;
|
|
88
|
-
pendingAfterClose = void 0;
|
|
89
|
-
if (!selection) return;
|
|
90
|
-
event.preventDefault();
|
|
91
|
-
scheduledAfterClose = selection;
|
|
92
|
-
queueMicrotask(() => {
|
|
93
|
-
if (scheduledAfterClose !== selection) return;
|
|
94
|
-
scheduledAfterClose = void 0;
|
|
95
|
-
selection.callback(trigger);
|
|
96
|
-
});
|
|
91
|
+
get ["class"]() {
|
|
92
|
+
return local.class;
|
|
97
93
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
get
|
|
129
|
-
return
|
|
94
|
+
onFocus: () => local.onIntent?.(),
|
|
95
|
+
onPointerEnter: () => local.onIntent?.()
|
|
96
|
+
}, rest, { get children() {
|
|
97
|
+
return createComponent(UserRound, { "aria-hidden": "true" });
|
|
98
|
+
} }));
|
|
99
|
+
}
|
|
100
|
+
}), createComponent(DropdownMenuContent, {
|
|
101
|
+
get hideArrow() {
|
|
102
|
+
return local.hideArrow;
|
|
103
|
+
},
|
|
104
|
+
"class": "min-w-56 max-h-(--kb-popper-available-height) overflow-x-hidden overflow-y-auto",
|
|
105
|
+
onCloseAutoFocus: (event) => {
|
|
106
|
+
const selection = pendingAfterClose;
|
|
107
|
+
pendingAfterClose = void 0;
|
|
108
|
+
if (!selection) return;
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
scheduledAfterClose = selection;
|
|
111
|
+
queueMicrotask(() => {
|
|
112
|
+
if (scheduledAfterClose !== selection) return;
|
|
113
|
+
scheduledAfterClose = void 0;
|
|
114
|
+
selection.callback(trigger);
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
get children() {
|
|
118
|
+
return [createComponent(DropdownMenuGroup, { get children() {
|
|
119
|
+
return createComponent(For, {
|
|
120
|
+
get each() {
|
|
121
|
+
return visible();
|
|
122
|
+
},
|
|
123
|
+
children: (item) => createComponent(DropdownMenuItem, {
|
|
124
|
+
get disabled() {
|
|
125
|
+
return item.disabled;
|
|
126
|
+
},
|
|
127
|
+
onSelect: () => {
|
|
128
|
+
pendingAfterClose = item.onSelectAfterClose ? { callback: item.onSelectAfterClose } : void 0;
|
|
129
|
+
item.onSelect?.();
|
|
130
|
+
},
|
|
131
|
+
get shortcut() {
|
|
132
|
+
return item.shortcut;
|
|
133
|
+
},
|
|
134
|
+
get keyshortcuts() {
|
|
135
|
+
return item.keyshortcuts;
|
|
130
136
|
},
|
|
131
137
|
get children() {
|
|
132
|
-
return [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
return [memo(() => item.icon ?? renderFallbackIcon(item.id)), (() => {
|
|
139
|
+
var _el$2 = _tmpl$();
|
|
140
|
+
insert(_el$2, () => item.label);
|
|
141
|
+
return _el$2;
|
|
142
|
+
})()];
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
} }), createComponent(Show, {
|
|
147
|
+
get when() {
|
|
148
|
+
return local.showSession !== false;
|
|
149
|
+
},
|
|
150
|
+
get children() {
|
|
151
|
+
return [createComponent(DropdownMenuSeparator, {}), createComponent(DropdownMenuGroup, { get children() {
|
|
152
|
+
return createComponent(DropdownMenuItem, {
|
|
153
|
+
get disabled() {
|
|
154
|
+
return local.busy;
|
|
155
|
+
},
|
|
156
|
+
onSelect: () => local.authenticated ? local.onSignOut?.() : local.onSignIn?.(),
|
|
157
|
+
get children() {
|
|
158
|
+
return [createComponent(Show, {
|
|
159
|
+
get when() {
|
|
160
|
+
return local.authenticated;
|
|
161
|
+
},
|
|
162
|
+
get fallback() {
|
|
163
|
+
return createComponent(LogIn, { "aria-hidden": "true" });
|
|
136
164
|
},
|
|
137
|
-
onSelect: () => local.authenticated ? local.onSignOut?.() : local.onSignIn?.(),
|
|
138
165
|
get children() {
|
|
139
|
-
return
|
|
140
|
-
get when() {
|
|
141
|
-
return local.authenticated;
|
|
142
|
-
},
|
|
143
|
-
get fallback() {
|
|
144
|
-
return createComponent(LogIn, { "aria-hidden": "true" });
|
|
145
|
-
},
|
|
146
|
-
get children() {
|
|
147
|
-
return createComponent(LogOut, { "aria-hidden": "true" });
|
|
148
|
-
}
|
|
149
|
-
}), (() => {
|
|
150
|
-
var _el$ = _tmpl$();
|
|
151
|
-
insert(_el$, () => local.authenticated ? "Sign out" : "Sign in");
|
|
152
|
-
return _el$;
|
|
153
|
-
})()];
|
|
166
|
+
return createComponent(LogOut, { "aria-hidden": "true" });
|
|
154
167
|
}
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
}), (() => {
|
|
169
|
+
var _el$ = _tmpl$();
|
|
170
|
+
insert(_el$, () => local.authenticated ? "Sign out" : "Sign in");
|
|
171
|
+
return _el$;
|
|
172
|
+
})()];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
} })];
|
|
159
176
|
}
|
|
160
177
|
})];
|
|
161
178
|
}
|
|
162
|
-
})
|
|
179
|
+
})];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
if (local.railTrigger) return menu();
|
|
183
|
+
return createComponent(Tooltip, {
|
|
184
|
+
get open() {
|
|
185
|
+
return tooltipOpen();
|
|
186
|
+
},
|
|
187
|
+
onOpenChange: (open) => setTooltipOpen(open && !menuOpen()),
|
|
188
|
+
get children() {
|
|
189
|
+
return [memo(() => menu()), createComponent(TooltipContent, {
|
|
163
190
|
placement: "top",
|
|
164
191
|
get children() {
|
|
165
192
|
return local.label ?? "Account and settings";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-menu.js","names":["CircleHelp","Info","LogIn","LogOut","Megaphone","RefreshCw","Settings2","Smartphone","UserRound","ComponentProps","JSX","For","Show","createSignal","onCleanup","splitProps","cn","Button","ButtonProps","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuSeparator","DropdownMenuTrigger","Tooltip","TooltipContent","TooltipTrigger","AccountMenuItem","id","label","icon","Element","shortcut","keyshortcuts","disabled","platform","onSelect","onSelectAfterClose","trigger","HTMLButtonElement","AccountMenuProps","class","placement","gutter","hideArrow","size","items","authenticated","showSession","busy","onSignIn","onSignOut","onIntent","FALLBACK_ICONS","Record","mobile","settings","about","help","feedback","updates","AccountMenu","props","local","rest","pendingAfterClose","callback","NonNullable","scheduledAfterClose","menuOpen","setMenuOpen","tooltipOpen","setTooltipOpen","undefined","visible","filter","item","_$createComponent","open","onOpenChange","children","modal","_$mergeProps","as","AccountMenuButton","ref","element","variant","aria-label","onFocus","onPointerEnter","onCloseAutoFocus","event","selection","preventDefault","queueMicrotask","each","_$memo","renderFallbackIcon","_el$2","_tmpl$","_$insert","when","fallback","_el$","createAppMenuItems","options","primaryItem","settingsShortcut","onAbout","onHelp","onFeedback","onUpdates","onSettings","Icon","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/composites/account-menu/account-menu.tsx"],"sourcesContent":["import {\n CircleHelp,\n Info,\n LogIn,\n LogOut,\n Megaphone,\n RefreshCw,\n Settings2,\n Smartphone,\n UserRound,\n} from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { For, Show, createSignal, onCleanup, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button, type ButtonProps } from '../../ui/button/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip/tooltip'\n\n/**\n * AccountMenu.\n *\n * The trailing control in a rail or a top bar: the account, the way into settings,\n * and the way out. Every desktop application has one and they are all the same menu,\n * which is why it belongs here rather than being redrawn per app.\n *\n * ## The items are the caller's\n *\n * The menu takes a list rather than hard-coding one. An application adds and removes\n * entries — a mobile hand-off that only makes sense on desktop, a feedback link that\n * only exists once there is somewhere to send it — and a component that decided the\n * list could not be used by two products.\n *\n * `disabled` on an item is deliberately visible rather than hidden: a greyed \"Help\n * Center\" says the destination is coming, while an absent one says it does not exist.\n */\nexport type AccountMenuItem = {\n id: string\n label: string\n icon?: JSX.Element\n /** A chord drawn at the trailing edge, e.g. `⌘,`. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+,`. The glyph is\n * `aria-hidden` so the item's accessible name stays exactly its label —\n * same contract as `SideRailItem`. Supply it whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n disabled?: boolean\n /** Render only on this platform. Omit to always render. */\n platform?: 'desktop' | 'web'\n onSelect?: () => void\n /** Run after the menu's close-focus cycle, with its trigger as a stable opener. */\n onSelectAfterClose?: (trigger: HTMLButtonElement | undefined) => void\n}\n\nexport type AccountMenuProps = {\n class?: string\n /** Anchor a rail menu beside its trigger, or keep the default upward placement. */\n placement?: ComponentProps<typeof DropdownMenu>['placement']\n /** Space between the trigger and menu, in pixels. */\n gutter?: ComponentProps<typeof DropdownMenu>['gutter']\n /** Hide the menu pointer when aligning it beside a compact rail. */\n hideArrow?: boolean\n /** The trigger size. Icon-only menus default to the standard icon size. */\n size?: ButtonProps['size']\n /** The entries above the separator. */\n items: readonly AccountMenuItem[]\n /** Which platform this is rendered on, for items that declare one. */\n platform?: 'desktop' | 'web'\n /** Whether a session exists. Decides the sign-in/sign-out row. */\n authenticated: boolean\n /** Local-only applications can omit the session actions altogether. */\n showSession?: boolean\n /** Disable the session row while a sign-in or sign-out is in flight. */\n busy?: boolean\n /** The name shown on the trigger's accessible label. */\n label?: string\n onSignIn?: () => void\n onSignOut?: () => void\n /** Fires on hover or focus of the trigger — a chance to prefetch. */\n onIntent?: () => void\n}\n\nconst FALLBACK_ICONS: Record<string, typeof Settings2> = {\n mobile: Smartphone,\n settings: Settings2,\n about: Info,\n help: CircleHelp,\n feedback: Megaphone,\n updates: RefreshCw,\n}\n\nexport function AccountMenu(props: AccountMenuProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'placement',\n 'gutter',\n 'hideArrow',\n 'size',\n 'items',\n 'platform',\n 'authenticated',\n 'showSession',\n 'busy',\n 'label',\n 'onSignIn',\n 'onSignOut',\n 'onIntent',\n ])\n\n let trigger: HTMLButtonElement | undefined\n let pendingAfterClose:\n | { callback: NonNullable<AccountMenuItem['onSelectAfterClose']> }\n | undefined\n let scheduledAfterClose:\n | { callback: NonNullable<AccountMenuItem['onSelectAfterClose']> }\n | undefined\n const [menuOpen, setMenuOpen] = createSignal(false)\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n\n onCleanup(() => {\n pendingAfterClose = undefined\n scheduledAfterClose = undefined\n })\n\n const visible = () =>\n local.items.filter((item) => !item.platform || item.platform === (local.platform ?? 'desktop'))\n\n return (\n <Tooltip open={tooltipOpen()} onOpenChange={(open) => setTooltipOpen(open && !menuOpen())}>\n <DropdownMenu\n modal={false}\n placement={local.placement ?? 'top-start'}\n gutter={local.gutter}\n onOpenChange={(open) => {\n setMenuOpen(open)\n if (open) setTooltipOpen(false)\n }}\n >\n <TooltipTrigger\n as={AccountMenuButton}\n ref={(element: HTMLButtonElement) => (trigger = element)}\n variant=\"ghost\"\n size={local.size ?? 'icon-md'}\n class={cn('text-muted-foreground', local.class)}\n aria-label={local.label ?? 'Account and settings'}\n onFocus={() => local.onIntent?.()}\n onPointerEnter={() => local.onIntent?.()}\n {...rest}\n >\n <UserRound aria-hidden=\"true\" />\n </TooltipTrigger>\n <DropdownMenuContent\n hideArrow={local.hideArrow}\n class=\"min-w-56 max-h-(--kb-popper-available-height) overflow-x-hidden overflow-y-auto\"\n onCloseAutoFocus={(event) => {\n const selection = pendingAfterClose\n pendingAfterClose = undefined\n if (!selection) return\n\n event.preventDefault()\n scheduledAfterClose = selection\n queueMicrotask(() => {\n if (scheduledAfterClose !== selection) return\n scheduledAfterClose = undefined\n selection.callback(trigger)\n })\n }}\n >\n <DropdownMenuGroup>\n <For each={visible()}>\n {(item) => (\n <DropdownMenuItem\n disabled={item.disabled}\n onSelect={() => {\n pendingAfterClose = item.onSelectAfterClose\n ? { callback: item.onSelectAfterClose }\n : undefined\n item.onSelect?.()\n }}\n shortcut={item.shortcut}\n keyshortcuts={item.keyshortcuts}\n >\n {item.icon ?? renderFallbackIcon(item.id)}\n <span>{item.label}</span>\n </DropdownMenuItem>\n )}\n </For>\n </DropdownMenuGroup>\n <Show when={local.showSession !== false}>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem\n disabled={local.busy}\n onSelect={() => (local.authenticated ? local.onSignOut?.() : local.onSignIn?.())}\n >\n <Show when={local.authenticated} fallback={<LogIn aria-hidden=\"true\" />}>\n <LogOut aria-hidden=\"true\" />\n </Show>\n <span>{local.authenticated ? 'Sign out' : 'Sign in'}</span>\n </DropdownMenuItem>\n </DropdownMenuGroup>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n {/* Both overlays own a Popper context; the tooltip must stay outside the menu root. */}\n <TooltipContent placement=\"top\">{local.label ?? 'Account and settings'}</TooltipContent>\n </Tooltip>\n )\n}\n\n/** The common support menu, with one app-specific entry before the shared items. */\nexport function createAppMenuItems(options: {\n primaryItem?: AccountMenuItem\n settingsShortcut?: string\n onAbout?: AccountMenuItem['onSelectAfterClose']\n onHelp?: AccountMenuItem['onSelectAfterClose']\n onFeedback?: AccountMenuItem['onSelectAfterClose']\n onUpdates?: AccountMenuItem['onSelectAfterClose']\n onSettings?: AccountMenuItem['onSelectAfterClose']\n}): AccountMenuItem[] {\n return [\n ...(options.primaryItem ? [options.primaryItem] : []),\n {\n id: 'about',\n label: 'About',\n disabled: !options.onAbout,\n onSelectAfterClose: options.onAbout,\n },\n {\n id: 'help',\n label: 'Help Center',\n disabled: !options.onHelp,\n onSelectAfterClose: options.onHelp,\n },\n {\n id: 'feedback',\n label: 'Send Feedback',\n disabled: !options.onFeedback,\n onSelectAfterClose: options.onFeedback,\n },\n {\n id: 'updates',\n label: 'Updates',\n platform: 'desktop',\n disabled: !options.onUpdates,\n onSelectAfterClose: options.onUpdates,\n },\n {\n id: 'settings',\n label: 'Settings',\n shortcut: options.settingsShortcut,\n disabled: !options.onSettings,\n onSelectAfterClose: options.onSettings,\n },\n ]\n}\n\nfunction AccountMenuButton(props: ComponentProps<typeof Button>) {\n return <DropdownMenuTrigger as={Button} {...props} />\n}\n\n/**\n * A known item id gets its conventional glyph, so a caller that only wants the\n * standard menu does not have to import six icons to get it.\n */\nfunction renderFallbackIcon(id: string): JSX.Element {\n const Icon = FALLBACK_ICONS[id]\n return Icon ? <Icon aria-hidden=\"true\" /> : null\n}\n"],"mappings":";;;;;;;;;AA0FA,IAAMsD,iBAAmD;CACvDE,QAAQjD;CACRkD,UAAUnD;CACVoD,OAAOzD;CACP0D,MAAM3D;CACN4D,UAAUxD;CACVyD,SAASxD;AACX;AAEA,SAAgByD,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQlD,WAAWgD,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CAED,IAAIxB;CACJ,IAAI2B;CAGJ,IAAIG;CAG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AI;GACJC,OAAO;GACPG,UAAU0E,QAAQE;GAClB1E,UAAU,CAACwE,QAAQO;GACnB5E,oBAAoBqE,QAAQO;EAC9B;CAAC;AAEL;AAEA,SAAS7B,kBAAkBtB,OAAsC;CAC/D,OAAAe,gBAAQtD,qBAAmB2D,WAAA,EAACC,IAAInE,OAAM,GAAM8C,KAAK,CAAA;AACnD;;;;;AAMA,SAASoC,mBAAmBtE,IAAyB;CACnD,MAAMsF,OAAO7D,eAAezB;CAC5B,OAAOsF,OAAIrC,gBAAIqC,MAAI,EAAA,eAAA,OAAA,CAAA,IAAyB;AAC9C"}
|
|
1
|
+
{"version":3,"file":"account-menu.js","names":["CircleHelp","Info","LogIn","LogOut","Megaphone","RefreshCw","Settings2","Smartphone","UserRound","ComponentProps","JSX","For","Show","createSignal","onCleanup","splitProps","cn","Button","ButtonProps","SideRailButton","DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuSeparator","DropdownMenuTrigger","Tooltip","TooltipContent","TooltipTrigger","AccountMenuItem","id","label","icon","Element","shortcut","keyshortcuts","disabled","platform","onSelect","onSelectAfterClose","trigger","HTMLButtonElement","AccountMenuProps","class","placement","gutter","hideArrow","size","railTrigger","items","authenticated","showSession","busy","onSignIn","onSignOut","onIntent","FALLBACK_ICONS","Record","mobile","settings","about","help","feedback","updates","AccountMenu","props","local","rest","pendingAfterClose","callback","NonNullable","scheduledAfterClose","menuOpen","setMenuOpen","tooltipOpen","setTooltipOpen","undefined","visible","filter","item","menu","_$createComponent","modal","onOpenChange","open","children","when","fallback","_$mergeProps","as","AccountMenuButton","ref","element","variant","aria-label","onFocus","onPointerEnter","onCloseAutoFocus","event","selection","preventDefault","queueMicrotask","each","_$memo","renderFallbackIcon","_el$2","_tmpl$","_$insert","_el$","createAppMenuItems","options","primaryItem","settingsShortcut","onAbout","onHelp","onFeedback","onUpdates","onSettings","Icon","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/composites/account-menu/account-menu.tsx"],"sourcesContent":["import {\n CircleHelp,\n Info,\n LogIn,\n LogOut,\n Megaphone,\n RefreshCw,\n Settings2,\n Smartphone,\n UserRound,\n} from 'lucide-solid'\nimport type { ComponentProps, JSX } from 'solid-js'\nimport { For, Show, createSignal, onCleanup, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button, type ButtonProps } from '../../ui/button/button'\nimport { SideRailButton } from '../../layout/side-rail/side-rail'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '../../ui/dropdown-menu/dropdown-menu'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip/tooltip'\n\n/**\n * AccountMenu.\n *\n * The trailing control in a rail or a top bar: the account, the way into settings,\n * and the way out. Every desktop application has one and they are all the same menu,\n * which is why it belongs here rather than being redrawn per app.\n *\n * ## The items are the caller's\n *\n * The menu takes a list rather than hard-coding one. An application adds and removes\n * entries — a mobile hand-off that only makes sense on desktop, a feedback link that\n * only exists once there is somewhere to send it — and a component that decided the\n * list could not be used by two products.\n *\n * `disabled` on an item is deliberately visible rather than hidden: a greyed \"Help\n * Center\" says the destination is coming, while an absent one says it does not exist.\n */\nexport type AccountMenuItem = {\n id: string\n label: string\n icon?: JSX.Element\n /** A chord drawn at the trailing edge, e.g. `⌘,`. */\n shortcut?: string\n /**\n * The parseable chord behind `shortcut`, e.g. `Meta+,`. The glyph is\n * `aria-hidden` so the item's accessible name stays exactly its label —\n * same contract as `SideRailItem`. Supply it whenever `shortcut` is drawn.\n */\n keyshortcuts?: string\n disabled?: boolean\n /** Render only on this platform. Omit to always render. */\n platform?: 'desktop' | 'web'\n onSelect?: () => void\n /** Run after the menu's close-focus cycle, with its trigger as a stable opener. */\n onSelectAfterClose?: (trigger: HTMLButtonElement | undefined) => void\n}\n\nexport type AccountMenuProps = {\n class?: string\n /** Anchor a rail menu beside its trigger, or keep the default upward placement. */\n placement?: ComponentProps<typeof DropdownMenu>['placement']\n /** Space between the trigger and menu, in pixels. */\n gutter?: ComponentProps<typeof DropdownMenu>['gutter']\n /** Hide the menu pointer when aligning it beside a compact rail. */\n hideArrow?: boolean\n /** The trigger size. Icon-only menus default to the standard icon size. */\n size?: ButtonProps['size']\n /**\n * Render the trigger as a `SideRailButton` row instead of a bare icon\n * button: same geometry, hover treatment, and flush collapsed-rail tip as\n * every other entry in the surrounding rail. The component's own tooltip\n * is skipped — the rail row owns its help.\n */\n railTrigger?: boolean\n /** The entries above the separator. */\n items: readonly AccountMenuItem[]\n /** Which platform this is rendered on, for items that declare one. */\n platform?: 'desktop' | 'web'\n /** Whether a session exists. Decides the sign-in/sign-out row. */\n authenticated: boolean\n /** Local-only applications can omit the session actions altogether. */\n showSession?: boolean\n /** Disable the session row while a sign-in or sign-out is in flight. */\n busy?: boolean\n /** The name shown on the trigger's accessible label. */\n label?: string\n onSignIn?: () => void\n onSignOut?: () => void\n /** Fires on hover or focus of the trigger — a chance to prefetch. */\n onIntent?: () => void\n}\n\nconst FALLBACK_ICONS: Record<string, typeof Settings2> = {\n mobile: Smartphone,\n settings: Settings2,\n about: Info,\n help: CircleHelp,\n feedback: Megaphone,\n updates: RefreshCw,\n}\n\nexport function AccountMenu(props: AccountMenuProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'placement',\n 'gutter',\n 'hideArrow',\n 'size',\n 'railTrigger',\n 'items',\n 'platform',\n 'authenticated',\n 'showSession',\n 'busy',\n 'label',\n 'onSignIn',\n 'onSignOut',\n 'onIntent',\n ])\n\n let trigger: HTMLButtonElement | undefined\n let pendingAfterClose:\n | { callback: NonNullable<AccountMenuItem['onSelectAfterClose']> }\n | undefined\n let scheduledAfterClose:\n | { callback: NonNullable<AccountMenuItem['onSelectAfterClose']> }\n | undefined\n const [menuOpen, setMenuOpen] = createSignal(false)\n const [tooltipOpen, setTooltipOpen] = createSignal(false)\n\n onCleanup(() => {\n pendingAfterClose = undefined\n scheduledAfterClose = undefined\n })\n\n const visible = () =>\n local.items.filter((item) => !item.platform || item.platform === (local.platform ?? 'desktop'))\n\n // Built by reference at each return, not once up front: Solid fixes a node's\n // owner chain when the JSX expression runs, and an eagerly created tree would\n // never see the Tooltip provider below — Kobalte's TooltipTrigger then throws\n // `useTooltipContext must be used within a Tooltip component`.\n const menu = () => (\n <DropdownMenu\n modal={false}\n placement={local.placement ?? 'top-start'}\n gutter={local.gutter}\n onOpenChange={(open) => {\n setMenuOpen(open)\n if (open) setTooltipOpen(false)\n }}\n >\n <Show\n when={local.railTrigger}\n fallback={\n <TooltipTrigger\n as={AccountMenuButton}\n ref={(element: HTMLButtonElement) => (trigger = element)}\n variant=\"ghost\"\n size={local.size ?? 'icon-md'}\n class={cn('text-muted-foreground', local.class)}\n aria-label={local.label ?? 'Account and settings'}\n onFocus={() => local.onIntent?.()}\n onPointerEnter={() => local.onIntent?.()}\n {...rest}\n >\n <UserRound aria-hidden=\"true\" />\n </TooltipTrigger>\n }\n >\n {/* Rail parity: the trigger is a SideRailButton row — the same\n geometry and flush collapsed-rail tip as every other rail entry —\n so the composite's own tooltip stays out of the way. */}\n <DropdownMenuTrigger\n as={SideRailButton}\n ref={(element: HTMLButtonElement) => (trigger = element)}\n label={local.label ?? 'Account and settings'}\n class={local.class}\n onFocus={() => local.onIntent?.()}\n onPointerEnter={() => local.onIntent?.()}\n {...rest}\n >\n <UserRound aria-hidden=\"true\" />\n </DropdownMenuTrigger>\n </Show>\n <DropdownMenuContent\n hideArrow={local.hideArrow}\n class=\"min-w-56 max-h-(--kb-popper-available-height) overflow-x-hidden overflow-y-auto\"\n onCloseAutoFocus={(event) => {\n const selection = pendingAfterClose\n pendingAfterClose = undefined\n if (!selection) return\n\n event.preventDefault()\n scheduledAfterClose = selection\n queueMicrotask(() => {\n if (scheduledAfterClose !== selection) return\n scheduledAfterClose = undefined\n selection.callback(trigger)\n })\n }}\n >\n <DropdownMenuGroup>\n <For each={visible()}>\n {(item) => (\n <DropdownMenuItem\n disabled={item.disabled}\n onSelect={() => {\n pendingAfterClose = item.onSelectAfterClose\n ? { callback: item.onSelectAfterClose }\n : undefined\n item.onSelect?.()\n }}\n shortcut={item.shortcut}\n keyshortcuts={item.keyshortcuts}\n >\n {item.icon ?? renderFallbackIcon(item.id)}\n <span>{item.label}</span>\n </DropdownMenuItem>\n )}\n </For>\n </DropdownMenuGroup>\n <Show when={local.showSession !== false}>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem\n disabled={local.busy}\n onSelect={() => (local.authenticated ? local.onSignOut?.() : local.onSignIn?.())}\n >\n <Show when={local.authenticated} fallback={<LogIn aria-hidden=\"true\" />}>\n <LogOut aria-hidden=\"true\" />\n </Show>\n <span>{local.authenticated ? 'Sign out' : 'Sign in'}</span>\n </DropdownMenuItem>\n </DropdownMenuGroup>\n </Show>\n </DropdownMenuContent>\n </DropdownMenu>\n )\n\n if (local.railTrigger) return menu()\n\n return (\n <Tooltip open={tooltipOpen()} onOpenChange={(open) => setTooltipOpen(open && !menuOpen())}>\n {menu()}\n {/* Both overlays own a Popper context; the tooltip must stay outside the menu root. */}\n <TooltipContent placement=\"top\">{local.label ?? 'Account and settings'}</TooltipContent>\n </Tooltip>\n )\n}\n\n/** The common support menu, with one app-specific entry before the shared items. */\nexport function createAppMenuItems(options: {\n primaryItem?: AccountMenuItem\n settingsShortcut?: string\n onAbout?: AccountMenuItem['onSelectAfterClose']\n onHelp?: AccountMenuItem['onSelectAfterClose']\n onFeedback?: AccountMenuItem['onSelectAfterClose']\n onUpdates?: AccountMenuItem['onSelectAfterClose']\n onSettings?: AccountMenuItem['onSelectAfterClose']\n}): AccountMenuItem[] {\n return [\n ...(options.primaryItem ? [options.primaryItem] : []),\n {\n id: 'about',\n label: 'About',\n disabled: !options.onAbout,\n onSelectAfterClose: options.onAbout,\n },\n {\n id: 'help',\n label: 'Help Center',\n disabled: !options.onHelp,\n onSelectAfterClose: options.onHelp,\n },\n {\n id: 'feedback',\n label: 'Send Feedback',\n disabled: !options.onFeedback,\n onSelectAfterClose: options.onFeedback,\n },\n {\n id: 'updates',\n label: 'Updates',\n platform: 'desktop',\n disabled: !options.onUpdates,\n onSelectAfterClose: options.onUpdates,\n },\n {\n id: 'settings',\n label: 'Settings',\n shortcut: options.settingsShortcut,\n disabled: !options.onSettings,\n onSelectAfterClose: options.onSettings,\n },\n ]\n}\n\nfunction AccountMenuButton(props: ComponentProps<typeof Button>) {\n return <DropdownMenuTrigger as={Button} {...props} />\n}\n\n/**\n * A known item id gets its conventional glyph, so a caller that only wants the\n * standard menu does not have to import six icons to get it.\n */\nfunction renderFallbackIcon(id: string): JSX.Element {\n const Icon = FALLBACK_ICONS[id]\n return Icon ? <Icon aria-hidden=\"true\" /> : null\n}\n"],"mappings":";;;;;;;;;;AAkGA,IAAMwD,iBAAmD;CACvDE,QAAQnD;CACRoD,UAAUrD;CACVsD,OAAO3D;CACP4D,MAAM7D;CACN8D,UAAU1D;CACV2D,SAAS1D;AACX;AAEA,SAAgB2D,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQpD,WAAWkD,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CAED,IAAIzB;CACJ,IAAI4B;CAGJ,IAAIG;CAGJ,MAAM,CAACC,UAAUC,eAAe5D,aAAa,KAAK;CAClD,MAAM,CAAC6D,aAAaC,kBAAkB9D,aAAa,KAAK;CAExDC,gBAAgB;EACdsD,oBAAoBQ,KAAAA;EACpBL,sBAAsBK,KAAAA;CACxB,CAAC;CAED,MAAMC,gBACJX,MAAMjB,MAAM6B,QAAQC,SAAS,CAACA,KAAK1C,YAAY0C,KAAK1C,cAAc6B,MAAM7B,YAAY,UAAU;CAMhG,MAAM2C,aAAOC,gBACV7D,cAAY;EACX8D,OAAO;EAAK,IACZtC,YAAS;GAAA,OAAEsB,MAAMtB,aAAa;EAAW;EAAA,IACzCC,SAA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EACA;GACEpF,IAAI;GACJC,OAAO;GACPK,UAAU,CAAC0E,QAAQK;GACnB5E,oBAAoBuE,QAAQK;EAC9B;EACA;GACErF,IAAI;GACJC,OAAO;GACPM,UAAU;GACVD,UAAU,CAAC0E,QAAQM;GACnB7E,oBAAoBuE,QAAQM;EAC9B;EACA;GACEtF,IAAI;GACJC,OAAO;GACPG,UAAU4E,QAAQE;GAClB5E,UAAU,CAAC0E,QAAQO;GACnB9E,oBAAoBuE,QAAQO;EAC9B;CAAC;AAEL;AAEA,SAAS3B,kBAAkBzB,OAAsC;CAC/D,OAAAgB,gBAAQxD,qBAAmB+D,WAAA,EAACC,IAAIxE,OAAM,GAAMgD,KAAK,CAAA;AACnD;;;;;AAMA,SAASuC,mBAAmB1E,IAAyB;CACnD,MAAMwF,OAAO9D,eAAe1B;CAC5B,OAAOwF,OAAIrC,gBAAIqC,MAAI,EAAA,eAAA,OAAA,CAAA,IAAyB;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-center.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/help-center/help-center.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-center.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/help-center/help-center.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAA;AACrE,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,YAAY,EAAE,CAAA;IAClC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;IAC1B,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,2FAA2F;AAC3F,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,kCAuFhD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
2
|
import { Alert, AlertDescription } from "../../ui/alert/alert.js";
|
|
3
|
+
import { Heading } from "../../ui/typography/typography.js";
|
|
3
4
|
import { Card, CardContent, CardHeader } from "../../ui/card/card.js";
|
|
4
5
|
import { ActionButton } from "../action-button/action-button.js";
|
|
5
6
|
import { Kbd, KbdGroup } from "../../ui/kbd/kbd.js";
|
|
@@ -7,7 +8,7 @@ import { className, createComponent, effect, insert, memo, template } from "soli
|
|
|
7
8
|
import { ExternalLink } from "lucide-solid";
|
|
8
9
|
import { For, Show, createSignal, onCleanup } from "solid-js";
|
|
9
10
|
//#region src/components/composites/help-center/help-center.tsx
|
|
10
|
-
var _tmpl$ = /*#__PURE__*/ template(`<div class="flex flex-col gap-2"><
|
|
11
|
+
var _tmpl$ = /*#__PURE__*/ template(`<div class="flex flex-col gap-2"><p class="text-sm text-muted-foreground">Keyboard shortcuts and resources for <!>.`);
|
|
11
12
|
var _tmpl$2 = /*#__PURE__*/ template(`<h2 class="text-base font-semibold text-foreground">Keyboard shortcuts`);
|
|
12
13
|
var _tmpl$3 = /*#__PURE__*/ template(`<ul class="flex flex-col gap-3">`);
|
|
13
14
|
var _tmpl$4 = /*#__PURE__*/ template(`<h2 class="text-base font-semibold text-foreground">Project links`);
|
|
@@ -38,9 +39,13 @@ function HelpCenter(props) {
|
|
|
38
39
|
return props.showHeader !== false;
|
|
39
40
|
},
|
|
40
41
|
get children() {
|
|
41
|
-
var _el$2 = _tmpl$(), _el$
|
|
42
|
-
_el$
|
|
43
|
-
insert(_el$
|
|
42
|
+
var _el$2 = _tmpl$(), _el$3 = _el$2.firstChild, _el$6 = _el$3.firstChild.nextSibling;
|
|
43
|
+
_el$6.nextSibling;
|
|
44
|
+
insert(_el$2, createComponent(Heading, {
|
|
45
|
+
size: "page",
|
|
46
|
+
children: "Help Center"
|
|
47
|
+
}), _el$3);
|
|
48
|
+
insert(_el$3, () => props.appName, _el$6);
|
|
44
49
|
return _el$2;
|
|
45
50
|
}
|
|
46
51
|
}), null);
|
|
@@ -48,15 +53,15 @@ function HelpCenter(props) {
|
|
|
48
53
|
return [createComponent(CardHeader, { get children() {
|
|
49
54
|
return _tmpl$2();
|
|
50
55
|
} }), createComponent(CardContent, { get children() {
|
|
51
|
-
var _el$
|
|
52
|
-
insert(_el$
|
|
56
|
+
var _el$8 = _tmpl$3();
|
|
57
|
+
insert(_el$8, createComponent(For, {
|
|
53
58
|
get each() {
|
|
54
59
|
return props.shortcuts;
|
|
55
60
|
},
|
|
56
61
|
children: (shortcut) => (() => {
|
|
57
|
-
var _el$
|
|
58
|
-
insert(_el$
|
|
59
|
-
insert(_el$
|
|
62
|
+
var _el$1 = _tmpl$7(), _el$10 = _el$1.firstChild;
|
|
63
|
+
insert(_el$10, () => shortcut.label);
|
|
64
|
+
insert(_el$1, createComponent(KbdGroup, { get children() {
|
|
60
65
|
return createComponent(For, {
|
|
61
66
|
get each() {
|
|
62
67
|
return shortcut.keys;
|
|
@@ -64,24 +69,24 @@ function HelpCenter(props) {
|
|
|
64
69
|
children: (key) => createComponent(Kbd, { children: key })
|
|
65
70
|
});
|
|
66
71
|
} }), null);
|
|
67
|
-
return _el$
|
|
72
|
+
return _el$1;
|
|
68
73
|
})()
|
|
69
74
|
}));
|
|
70
|
-
return _el$
|
|
75
|
+
return _el$8;
|
|
71
76
|
} })];
|
|
72
77
|
} }), null);
|
|
73
78
|
insert(_el$, createComponent(Card, { get children() {
|
|
74
79
|
return [createComponent(CardHeader, { get children() {
|
|
75
80
|
return _tmpl$4();
|
|
76
81
|
} }), createComponent(CardContent, { get children() {
|
|
77
|
-
var _el$
|
|
78
|
-
insert(_el$
|
|
82
|
+
var _el$0 = _tmpl$5();
|
|
83
|
+
insert(_el$0, createComponent(For, {
|
|
79
84
|
get each() {
|
|
80
85
|
return props.links;
|
|
81
86
|
},
|
|
82
87
|
children: (link) => (() => {
|
|
83
|
-
var _el$
|
|
84
|
-
insert(_el$
|
|
88
|
+
var _el$11 = _tmpl$9();
|
|
89
|
+
insert(_el$11, createComponent(ActionButton, {
|
|
85
90
|
as: "a",
|
|
86
91
|
variant: "link",
|
|
87
92
|
size: "sm",
|
|
@@ -104,20 +109,20 @@ function HelpCenter(props) {
|
|
|
104
109
|
return [memo(() => link.label), createComponent(ExternalLink, { "aria-hidden": "true" })];
|
|
105
110
|
}
|
|
106
111
|
}), null);
|
|
107
|
-
insert(_el$
|
|
112
|
+
insert(_el$11, createComponent(Show, {
|
|
108
113
|
get when() {
|
|
109
114
|
return link.description;
|
|
110
115
|
},
|
|
111
116
|
get children() {
|
|
112
|
-
var _el$
|
|
113
|
-
insert(_el$
|
|
114
|
-
return _el$
|
|
117
|
+
var _el$12 = _tmpl$8();
|
|
118
|
+
insert(_el$12, () => link.description);
|
|
119
|
+
return _el$12;
|
|
115
120
|
}
|
|
116
121
|
}), null);
|
|
117
|
-
return _el$
|
|
122
|
+
return _el$11;
|
|
118
123
|
})()
|
|
119
124
|
}));
|
|
120
|
-
return _el$
|
|
125
|
+
return _el$0;
|
|
121
126
|
} })];
|
|
122
127
|
} }), null);
|
|
123
128
|
insert(_el$, createComponent(Show, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-center.js","names":["createSignal","For","onCleanup","Show","ExternalLink","cn","ActionButton","Alert","AlertDescription","Card","CardContent","CardHeader","Kbd","KbdGroup","HelpShortcut","label","keys","HelpLink","description","url","HelpCenterProps","appName","shortcuts","links","openExternal","Promise","showHeader","class","HelpCenter","props","error","setError","disposed","openLink","_el$","_tmpl$6","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","
|
|
1
|
+
{"version":3,"file":"help-center.js","names":["createSignal","For","onCleanup","Show","ExternalLink","cn","ActionButton","Alert","AlertDescription","Card","CardContent","CardHeader","Kbd","KbdGroup","Heading","HelpShortcut","label","keys","HelpLink","description","url","HelpCenterProps","appName","shortcuts","links","openExternal","Promise","showHeader","class","HelpCenter","props","error","setError","disposed","openLink","_el$","_tmpl$6","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","_el$6","nextSibling","_el$5","size","_tmpl$2","_el$8","_tmpl$3","each","shortcut","_el$1","_tmpl$7","_el$10","key","_tmpl$4","_el$0","_tmpl$5","link","_el$11","_tmpl$9","as","variant","href","target","rel","tooltip","onClick","event","preventDefault","_$memo","_el$12","_tmpl$8","role","_$effect","_$className","_$createComponent","_$memo","_$className"],"sources":["../../../../src/components/composites/help-center/help-center.tsx"],"sourcesContent":["import { createSignal, For, onCleanup, Show } from 'solid-js'\nimport { ExternalLink } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { ActionButton } from '../action-button'\nimport { Alert, AlertDescription } from '../../ui/alert'\nimport { Card, CardContent, CardHeader } from '../../ui/card'\nimport { Kbd, KbdGroup } from '../../ui/kbd'\nimport { Heading } from '../../ui/typography'\n\nexport type HelpShortcut = { label: string; keys: readonly string[] }\nexport type HelpLink = { label: string; description?: string; url: string }\nexport type HelpCenterProps = {\n appName: string\n shortcuts: readonly HelpShortcut[]\n links: readonly HelpLink[]\n openExternal?: (url: string) => Promise<void>\n /** Hides the page heading and introduction when a host dialog supplies them. */\n showHeader?: boolean\n class?: string\n}\n\n/** A shared help page: real keyboard shortcuts and the application's project resources. */\nexport function HelpCenter(props: HelpCenterProps) {\n const [error, setError] = createSignal('')\n let disposed = false\n onCleanup(() => {\n disposed = true\n })\n const openLink = async (url: string) => {\n setError('')\n try {\n await props.openExternal?.(url)\n } catch {\n if (!disposed) setError('Could not open this help resource. Please try again.')\n }\n }\n return (\n <div class={cn('flex min-w-0 flex-col gap-5', props.class)}>\n <Show when={props.showHeader !== false}>\n <div class=\"flex flex-col gap-2\">\n <Heading size=\"page\">Help Center</Heading>\n <p class=\"text-sm text-muted-foreground\">\n Keyboard shortcuts and resources for {props.appName}.\n </p>\n </div>\n </Show>\n <Card>\n <CardHeader>\n <h2 class=\"text-base font-semibold text-foreground\">Keyboard shortcuts</h2>\n </CardHeader>\n <CardContent>\n <ul class=\"flex flex-col gap-3\">\n <For each={props.shortcuts}>\n {(shortcut) => (\n <li class=\"flex flex-wrap items-center justify-between gap-2\">\n <span class=\"text-sm\">{shortcut.label}</span>\n <KbdGroup>\n <For each={shortcut.keys}>{(key) => <Kbd>{key}</Kbd>}</For>\n </KbdGroup>\n </li>\n )}\n </For>\n </ul>\n </CardContent>\n </Card>\n <Card>\n <CardHeader>\n <h2 class=\"text-base font-semibold text-foreground\">Project links</h2>\n </CardHeader>\n <CardContent>\n <ul class=\"flex flex-col gap-4\">\n <For each={props.links}>\n {(link) => (\n <li class=\"flex min-w-0 flex-col items-start gap-1\">\n <ActionButton\n as=\"a\"\n variant=\"link\"\n size=\"sm\"\n class=\"text-foreground decoration-primary\"\n href={link.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n tooltip={`Open ${link.label} in your browser.`}\n onClick={(event) => {\n if (props.openExternal) {\n event.preventDefault()\n void openLink(link.url)\n }\n }}\n >\n {link.label}\n <ExternalLink aria-hidden=\"true\" />\n </ActionButton>\n <Show when={link.description}>\n <p class=\"text-sm text-muted-foreground\">{link.description}</p>\n </Show>\n </li>\n )}\n </For>\n </ul>\n </CardContent>\n </Card>\n <Show when={error()}>\n <Alert variant=\"destructive\" role=\"alert\">\n <AlertDescription>{error()}</AlertDescription>\n </Alert>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB6B,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,YAAYhC,aAAa,EAAE;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AAA,IAAA;MAAA,OAAAZ;KAAA,EAAA,CAAA;IAG/D,CAAA,CAAA;IAAA,OAAAH;GAAA,EAAA,CAAA,CAAA;EAAA,EAAA,CAAA,GAAA,IAAA;EAAAvB,OAAAF,MAAAG,gBAKRnC,MAAI;GAAA,IAACoC,OAAI;IAAA,OAAER,MAAM;GAAC;GAAA,IAAAS,WAAA;IAAA,OAAAF,gBAChB/B,OAAK;KAAC2D,SAAO;KAAeW,MAAI;KAAA,IAAArC,WAAA;MAAA,OAAAF,gBAC9B9B,kBAAgB,EAAA,IAAAgC,WAAA;OAAA,OAAET,MAAM;MAAC,EAAA,CAAA;KAAA;IAAA,CAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA+C,aAAAC,UAAA5C,MAnEpB9B,GAAG,+BAA+ByB,MAAMF,KAAK,CAAC,CAAA;EAAA,OAAAO;CAAA,EAAA,CAAA;AAwE9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAMnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,CAAC,SAAS,CAAC,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC,eA0CF;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,eAsDF;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,eAiBzF;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,eASxD"}
|