@photon-ai/pho-ui 4.16.2 → 4.17.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/chunks/{basic-page-C0C8NDjG.js → basic-page-DS1YIheB.js} +4 -4
- package/dist/chunks/{basic-page-C0C8NDjG.js.map → basic-page-DS1YIheB.js.map} +1 -1
- package/dist/chunks/{code-block-CbcE994O.js → code-block-DMiZkEWS.js} +2 -2
- package/dist/chunks/{code-block-CbcE994O.js.map → code-block-DMiZkEWS.js.map} +1 -1
- package/dist/chunks/copy-button-CHYc_cvM.js +76 -0
- package/dist/chunks/copy-button-CHYc_cvM.js.map +1 -0
- package/dist/chunks/description-list-SIlI9ZHs.js +60 -0
- package/dist/chunks/description-list-SIlI9ZHs.js.map +1 -0
- package/dist/chunks/{filter-bar-yEcG2pBm.js → filter-bar-BCiaO1gO.js} +2 -2
- package/dist/chunks/{filter-bar-yEcG2pBm.js.map → filter-bar-BCiaO1gO.js.map} +1 -1
- package/dist/chunks/menu-CoMrYnd1.js +264 -0
- package/dist/chunks/menu-CoMrYnd1.js.map +1 -0
- package/dist/components/code-block.js +1 -1
- package/dist/components/context-menu.js +38 -37
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/menu.js +5 -4
- package/dist/components/scope.js +88 -84
- package/dist/components/scope.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/sections/basic-page.js +1 -1
- package/dist/src/components/copy-button/copy-button.d.ts +15 -4
- package/dist/src/components/description-list/description-list.d.ts +3 -2
- package/dist/src/components/menu/index.d.ts +1 -1
- package/dist/src/components/menu/menu-pending.d.ts +26 -0
- package/package.json +1 -1
- package/dist/chunks/copy-button-D8XyP0oR.js +0 -56
- package/dist/chunks/copy-button-D8XyP0oR.js.map +0 -1
- package/dist/chunks/description-list-8qm83WZB.js +0 -59
- package/dist/chunks/description-list-8qm83WZB.js.map +0 -1
- package/dist/chunks/menu-BQeprfxB.js +0 -208
- package/dist/chunks/menu-BQeprfxB.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { a as de } from "./button-C9VqBBIr.js";
|
|
|
4
4
|
import { t as z } from "./createReactComponent-BqCmnqfX.js";
|
|
5
5
|
import { t as me } from "./IconChevronDown-CZilB71T.js";
|
|
6
6
|
import { t as he } from "./IconChevronUp-CrpWSgIl.js";
|
|
7
|
-
import { n as fe } from "./copy-button-
|
|
7
|
+
import { n as fe } from "./copy-button-CHYc_cvM.js";
|
|
8
8
|
import { t as d } from "./scroll-area-DSwD9th7.js";
|
|
9
9
|
import { n as ye } from "./toggle-o84tawXy.js";
|
|
10
10
|
import { t as g } from "./tooltip-BTF7GChl.js";
|
|
@@ -513,4 +513,4 @@ export {
|
|
|
513
513
|
K as u
|
|
514
514
|
};
|
|
515
515
|
|
|
516
|
-
//# sourceMappingURL=code-block-
|
|
516
|
+
//# sourceMappingURL=code-block-DMiZkEWS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block-CbcE994O.js","names":["__iconNode","__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMaximize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMinimize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconTextWrap.mjs","../../src/components/code-block/languages.ts","../../src/components/code-block/tokens.ts","../../src/components/code-block/pho-theme.ts","../../src/components/code-block/highlight.ts","../../src/components/code-block/tokenize-json.ts","../../src/components/code-block/code-block.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 4l4 0l0 4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 10l6 -6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M8 20l-4 0l0 -4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 20l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M16 20l4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M14 14l6 6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M8 4l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M4 4l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMaximize = createReactComponent(\"outline\", \"arrows-maximize\", \"ArrowsMaximize\", __iconNode);\n\nexport { __iconNode, IconArrowsMaximize as default };\n//# sourceMappingURL=IconArrowsMaximize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M5 9l4 0l0 -4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 3l6 6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 15l4 0l0 4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M3 21l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M19 9l-4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M15 9l6 -6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M19 15l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M15 15l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMinimize = createReactComponent(\"outline\", \"arrows-minimize\", \"ArrowsMinimize\", __iconNode);\n\nexport { __iconNode, IconArrowsMinimize as default };\n//# sourceMappingURL=IconArrowsMinimize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M4 6l16 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M4 18l5 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2\", \"key\": \"svg-2\" }]];\nconst IconTextWrap = createReactComponent(\"outline\", \"text-wrap\", \"TextWrap\", __iconNode);\n\nexport { __iconNode, IconTextWrap as default };\n//# sourceMappingURL=IconTextWrap.mjs.map\n","import type { LanguageRegistration } from \"shiki/core\";\n\n/**\n * The languages a code panel can color, each a grammar fetched on first\n * use — a page that shows JSON never downloads the TypeScript grammar.\n * Keyed by the name Shiki knows the grammar by; `LANGUAGE_ALIASES` lets a\n * panel say `ts` or `sh`.\n */\nexport const CODE_GRAMMARS = {\n json: () => import(\"@shikijs/langs/json\"),\n jsonc: () => import(\"@shikijs/langs/jsonc\"),\n javascript: () => import(\"@shikijs/langs/javascript\"),\n typescript: () => import(\"@shikijs/langs/typescript\"),\n jsx: () => import(\"@shikijs/langs/jsx\"),\n tsx: () => import(\"@shikijs/langs/tsx\"),\n shellscript: () => import(\"@shikijs/langs/shellscript\"),\n python: () => import(\"@shikijs/langs/python\"),\n swift: () => import(\"@shikijs/langs/swift\"),\n go: () => import(\"@shikijs/langs/go\"),\n ruby: () => import(\"@shikijs/langs/ruby\"),\n php: () => import(\"@shikijs/langs/php\"),\n java: () => import(\"@shikijs/langs/java\"),\n kotlin: () => import(\"@shikijs/langs/kotlin\"),\n csharp: () => import(\"@shikijs/langs/csharp\"),\n rust: () => import(\"@shikijs/langs/rust\"),\n html: () => import(\"@shikijs/langs/html\"),\n css: () => import(\"@shikijs/langs/css\"),\n xml: () => import(\"@shikijs/langs/xml\"),\n yaml: () => import(\"@shikijs/langs/yaml\"),\n toml: () => import(\"@shikijs/langs/toml\"),\n dotenv: () => import(\"@shikijs/langs/dotenv\"),\n sql: () => import(\"@shikijs/langs/sql\"),\n graphql: () => import(\"@shikijs/langs/graphql\"),\n http: () => import(\"@shikijs/langs/http\"),\n markdown: () => import(\"@shikijs/langs/markdown\"),\n diff: () => import(\"@shikijs/langs/diff\"),\n} satisfies Record<string, () => Promise<{ default: LanguageRegistration[] }>>;\n\nexport type CodeGrammar = keyof typeof CODE_GRAMMARS;\n\n/** Shorter names, and the ones people reach for first. */\nexport const LANGUAGE_ALIASES = {\n js: \"javascript\",\n ts: \"typescript\",\n bash: \"shellscript\",\n sh: \"shellscript\",\n shell: \"shellscript\",\n zsh: \"shellscript\",\n py: \"python\",\n rb: \"ruby\",\n kt: \"kotlin\",\n cs: \"csharp\",\n rs: \"rust\",\n yml: \"yaml\",\n md: \"markdown\",\n htm: \"html\",\n} as const satisfies Record<string, CodeGrammar>;\n\nexport type CodeLanguageAlias = keyof typeof LANGUAGE_ALIASES;\n\n/**\n * What `language` accepts: a grammar, an alias, or `text` for none. Plain\n * text is the default — a panel colors only what it is told the shape of.\n */\nexport type CodeBlockLanguage = \"text\" | CodeGrammar | CodeLanguageAlias;\n\n/**\n * The grammar behind a `language`, or `null` for plain text and names the\n * panel does not know (which read as text instead of throwing).\n */\nexport function resolveGrammar(language: string): CodeGrammar | null {\n // Own keys only: `in` would take \"toString\" for a grammar.\n if (Object.hasOwn(LANGUAGE_ALIASES, language)) {\n return LANGUAGE_ALIASES[language as CodeLanguageAlias];\n }\n return Object.hasOwn(CODE_GRAMMARS, language)\n ? (language as CodeGrammar)\n : null;\n}\n","/**\n * The token vocabulary a code panel colors with — one class per kind, on\n * the `--color-pho-code-*` tokens, which carry light and dark. The JSON\n * tokenizer speaks the first five; Shiki's grammars reach the rest.\n */\n\nexport type CodeTokenType =\n | \"key\"\n | \"string\"\n | \"number\"\n | \"keyword\"\n | \"punctuation\"\n | \"comment\"\n | \"function\"\n | \"type\"\n | \"plain\";\n\nexport interface CodeToken {\n type: CodeTokenType;\n text: string;\n}\n\n/** One line of a highlighted body. */\nexport type CodeLine = CodeToken[];\n\n/** The class a token kind wears; `plain` wears the panel's own ink. */\nexport const CODE_TOKEN_CLASS: Record<CodeTokenType, string | undefined> = {\n key: \"text-pho-code-key\",\n string: \"text-pho-code-string\",\n number: \"text-pho-code-number\",\n keyword: \"text-pho-code-keyword\",\n punctuation: \"text-pho-code-punctuation\",\n comment: \"text-pho-code-comment\",\n function: \"text-pho-code-function\",\n type: \"text-pho-code-type\",\n plain: undefined,\n};\n","import type { ThemeRegistrationRaw } from \"shiki/core\";\nimport { CODE_TOKEN_CLASS, type CodeTokenType } from \"./tokens\";\n\n/**\n * Pho's Shiki theme — not a palette but a routing table. Every TextMate\n * scope resolves to one of the panel's token kinds, and each kind's\n * \"color\" is the design token's own variable, so the theme has no light\n * and dark of its own: the `--color-pho-code-*` tokens carry both, and\n * the renderer turns each color back into the kind's class. Only the\n * kinds a body needs to read — keys, strings, numbers, keywords,\n * punctuation, comments, calls, types. Operators, variables, and\n * everything else stay in the panel's ink.\n */\n\nexport const PHO_THEME_NAME = \"pho\";\n\n/** The color a token kind \"has\" in the theme: its token's variable. */\nexport function tokenColor(type: Exclude<CodeTokenType, \"plain\">): string {\n return `var(--color-pho-code-${type})`;\n}\n\n/** The token kind behind a Shiki color, or `plain` for the panel's ink. */\nexport function tokenTypeOf(color: string | undefined): CodeTokenType {\n const match = color?.match(/^var\\(--color-pho-code-([a-z]+)\\)$/);\n const kind = match?.[1];\n return kind != null && kind in CODE_TOKEN_CLASS && kind !== \"plain\"\n ? (kind as CodeTokenType)\n : \"plain\";\n}\n\nconst rule = (\n type: Exclude<CodeTokenType, \"plain\"> | \"plain\",\n scope: string[],\n) => ({\n scope,\n settings: {\n foreground:\n type === \"plain\" ? \"var(--color-pho-code-fg)\" : tokenColor(type),\n },\n});\n\nexport const phoTheme: ThemeRegistrationRaw = {\n name: PHO_THEME_NAME,\n type: \"light\",\n fg: \"var(--color-pho-code-fg)\",\n bg: \"var(--color-pho-code-bg)\",\n settings: [\n rule(\"comment\", [\"comment\", \"punctuation.definition.comment\"]),\n rule(\"string\", [\n \"string\",\n \"markup.inserted\",\n \"meta.diff.header.to-file\",\n \"punctuation.definition.inserted\",\n ]),\n // A template's `${…}` and any embedded code read as code again.\n rule(\"plain\", [\"meta.template.expression\", \"meta.embedded\"]),\n rule(\"key\", [\n \"support.type.property-name\",\n \"meta.object-literal.key\",\n \"entity.other.attribute-name\",\n \"entity.name.tag.yaml\",\n \"keyword.key.toml\",\n \"variable.other.env\",\n ]),\n rule(\"number\", [\n \"constant.numeric\",\n \"markup.deleted\",\n \"meta.diff.header.from-file\",\n \"punctuation.definition.deleted\",\n ]),\n rule(\"keyword\", [\n \"keyword\",\n \"storage\",\n \"constant.language\",\n \"variable.language\",\n ]),\n // Symbolic operators sit in the ink: `=`, `+`, `=>`, `&&` are shape,\n // not vocabulary. The word-shaped ones above stay keywords.\n rule(\"plain\", [\"keyword.operator\"]),\n rule(\"keyword\", [\n \"keyword.operator.expression\",\n \"keyword.operator.new\",\n \"keyword.operator.logical.python\",\n \"keyword.operator.wordlike\",\n ]),\n rule(\"function\", [\n \"entity.name.function\",\n \"support.function\",\n \"entity.name.command\",\n \"meta.function-call.generic\",\n ]),\n rule(\"type\", [\n \"entity.name.type\",\n \"entity.name.class\",\n \"entity.name.tag\",\n \"entity.other.inherited-class\",\n \"support.type\",\n \"support.class\",\n \"storage.type.primitive\",\n ]),\n // A property name is a key even though it is a `support.type`.\n rule(\"key\", [\"support.type.property-name\"]),\n rule(\"punctuation\", [\n \"punctuation.separator\",\n \"punctuation.terminator\",\n \"punctuation.accessor\",\n \"punctuation.section\",\n \"punctuation.definition.array\",\n \"punctuation.definition.dictionary\",\n \"punctuation.definition.block\",\n \"punctuation.definition.parameters\",\n \"punctuation.definition.arguments\",\n \"punctuation.definition.tag\",\n \"punctuation.definition.typeparameters\",\n \"meta.brace\",\n ]),\n ],\n};\n","import { useEffect, useSyncExternalStore } from \"react\";\nimport type { HighlighterCore, ThemedToken } from \"shiki/core\";\nimport { CODE_GRAMMARS, resolveGrammar, type CodeGrammar } from \"./languages\";\nimport { phoTheme, PHO_THEME_NAME, tokenTypeOf } from \"./pho-theme\";\nimport type { CodeLine } from \"./tokens\";\n\n/**\n * Highlighting, on Shiki — one highlighter for the whole app, made on\n * the first panel that asks and kept; grammars fetched on demand and\n * kept too. Bodies are tokenized once per (grammar, text) and remembered,\n * so a wrap toggle or a fold never re-runs a grammar.\n *\n * The result is lines of `CodeToken`s in the panel's own vocabulary\n * (`tokens.ts`), never Shiki's HTML: the panel keeps rendering its own\n * lines (the fold, `data-line`) and its own classes (the design tokens).\n *\n * Nothing here runs on the server. `useHighlight` reports `null` until a\n * body is highlighted, and a panel shows its synchronous face meanwhile —\n * plain text, or the JSON tokenizer's colors — so a page prerendered and\n * a page hydrated agree, and the colors settle in a frame later.\n */\n\nlet core: HighlighterCore | null = null;\nlet corePromise: Promise<HighlighterCore> | null = null;\nconst loadedGrammars = new Set<CodeGrammar>();\nconst loadingGrammars = new Map<CodeGrammar, Promise<void>>();\n\n/**\n * Shiki itself arrives with the first body that needs it — a page of\n * cards and rows never loads the engine — and stays for the rest.\n */\nfunction getCore(): Promise<HighlighterCore> {\n corePromise ??= Promise.all([\n import(\"shiki/core\"),\n import(\"shiki/engine/javascript\"),\n ])\n .then(([{ createHighlighterCore }, { createJavaScriptRegexEngine }]) =>\n createHighlighterCore({\n themes: [phoTheme],\n langs: [],\n // Shiki's JavaScript engine: no WebAssembly to fetch or allow, and\n // `forgiving` degrades a grammar's exotic pattern instead of\n // failing the whole body.\n engine: createJavaScriptRegexEngine({ forgiving: true }),\n }),\n )\n .then((highlighter) => {\n core = highlighter;\n return highlighter;\n });\n return corePromise;\n}\n\n/** Fetch a language's grammar ahead of the first body that needs it. */\nexport function preloadLanguage(language: string): Promise<void> {\n const grammar = resolveGrammar(language);\n if (grammar == null || loadedGrammars.has(grammar)) return Promise.resolve();\n let loading = loadingGrammars.get(grammar);\n if (loading == null) {\n loading = Promise.all([getCore(), CODE_GRAMMARS[grammar]()])\n .then(([highlighter, module]) =>\n highlighter.loadLanguage(...module.default),\n )\n .then(() => {\n loadedGrammars.add(grammar);\n })\n .finally(() => {\n loadingGrammars.delete(grammar);\n });\n loadingGrammars.set(grammar, loading);\n }\n return loading;\n}\n\n/** Whether `language` can be tokenized right now, without waiting. */\nexport function isLanguageReady(language: string): boolean {\n const grammar = resolveGrammar(language);\n return grammar != null && core != null && loadedGrammars.has(grammar);\n}\n\nfunction toLines(tokens: ThemedToken[][]): CodeLine[] {\n return tokens.map((line) => {\n const out: CodeLine = [];\n for (const token of line) {\n const type = tokenTypeOf(token.color);\n const last = out[out.length - 1];\n // Neighbors of one kind collapse into one span.\n if (last != null && last.type === type) last.text += token.content;\n else out.push({ type, text: token.content });\n }\n return out;\n });\n}\n\n/**\n * Tokenize a body with a grammar that is already loaded. `null` when the\n * language is plain text or its grammar is not here yet — see\n * `preloadLanguage` / `highlight`.\n */\nexport function highlightSync(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n if (grammar == null || core == null || !loadedGrammars.has(grammar)) {\n return null;\n }\n return toLines(\n core.codeToTokensBase(code, { lang: grammar, theme: PHO_THEME_NAME }),\n );\n}\n\n/** Plain lines — what a body reads as with no grammar. */\nexport function plainLines(code: string): CodeLine[] {\n return code.split(\"\\n\").map((text) => [{ type: \"plain\", text }]);\n}\n\n/**\n * Tokenize a body, fetching the highlighter and the grammar first if\n * need be. A language the panel does not know resolves to plain lines.\n */\nexport async function highlight(\n code: string,\n language: string,\n): Promise<CodeLine[]> {\n if (resolveGrammar(language) == null) return plainLines(code);\n await preloadLanguage(language);\n return highlightSync(code, language) ?? plainLines(code);\n}\n\n/* --------------------------------- store --------------------------------- */\n\n/** How many highlighted bodies to keep. A page's worth, several times. */\nconst CACHE_LIMIT = 200;\nconst cache = new Map<string, CodeLine[]>();\nconst listeners = new Set<() => void>();\n\nfunction remember(key: string, lines: CodeLine[]): CodeLine[] {\n const known = cache.get(key);\n if (known != null) return known;\n if (cache.size >= CACHE_LIMIT) {\n const oldest = cache.keys().next().value;\n if (oldest != null) cache.delete(oldest);\n }\n cache.set(key, lines);\n return lines;\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction notify() {\n for (const listener of listeners) listener();\n}\n\nfunction cacheKey(grammar: CodeGrammar, code: string) {\n return `${grammar}\u0000${code}`;\n}\n\n/**\n * The highlighted lines of a body, or `null` while its grammar is on the\n * way (and always for plain text). A grammar already here highlights in\n * the same render, no flash.\n */\nexport function useHighlight(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n const key = grammar != null ? cacheKey(grammar, code) : null;\n const lines = useSyncExternalStore(\n subscribe,\n () => {\n if (key == null) return null;\n const known = cache.get(key);\n if (known != null) return known;\n const now = highlightSync(code, language);\n return now != null ? remember(key, now) : null;\n },\n // Prerendered markup is the synchronous face; hydration agrees with it\n // and the colors settle in the render after.\n () => null,\n );\n useEffect(() => {\n if (key == null || cache.has(key)) return;\n // Remembered even if this panel is gone by then: the next one with the\n // same body reads it in its first render.\n highlight(code, language).then(\n (result) => {\n remember(key, result);\n notify();\n },\n () => {\n // A grammar that would not load: the panel keeps its plain face.\n },\n );\n }, [key, code, language]);\n return lines;\n}\n","/**\n * A tokenizer for JSON, and nothing else: keys, strings, numbers, the\n * three keywords, and punctuation. Runs one line at a time (a JSON\n * string never spans lines) so a panel can show its first N lines and\n * stop. Text that isn't JSON comes back as it is, in plain tokens.\n */\n\nexport type JsonTokenType =\n \"key\" | \"string\" | \"number\" | \"keyword\" | \"punctuation\" | \"plain\";\n\nexport interface JsonToken {\n type: JsonTokenType;\n text: string;\n}\n\n// One pass, left to right: a string (a key when a colon follows), a\n// number, a keyword, a bracket or a comma. Anything between is plain.\nconst TOKEN =\n /(\"(?:[^\"\\\\]|\\\\.)*\")(\\s*:)?|(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)|\\b(true|false|null)\\b|([{}[\\]:,])/g;\n\nexport function tokenizeJson(line: string): JsonToken[] {\n const tokens: JsonToken[] = [];\n let last = 0;\n TOKEN.lastIndex = 0;\n for (let match = TOKEN.exec(line); match != null; match = TOKEN.exec(line)) {\n if (match.index > last) {\n tokens.push({ type: \"plain\", text: line.slice(last, match.index) });\n }\n const [, string, colon, number, keyword, punctuation] = match;\n if (string != null) {\n tokens.push({ type: colon != null ? \"key\" : \"string\", text: string });\n if (colon != null) tokens.push({ type: \"punctuation\", text: colon });\n } else if (number != null) {\n tokens.push({ type: \"number\", text: number });\n } else if (keyword != null) {\n tokens.push({ type: \"keyword\", text: keyword });\n } else if (punctuation != null) {\n tokens.push({ type: \"punctuation\", text: punctuation });\n }\n last = match.index + match[0].length;\n }\n if (last < line.length) {\n tokens.push({ type: \"plain\", text: line.slice(last) });\n }\n return tokens;\n}\n","import {\n useMemo,\n useState,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n IconArrowsMaximize,\n IconArrowsMinimize,\n IconChevronDown,\n IconChevronUp,\n IconTextWrap,\n} from \"@tabler/icons-react\";\nimport { Button } from \"../button\";\nimport { CopyButton } from \"../copy-button\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { Toggle } from \"../toggle\";\nimport { Tooltip } from \"../tooltip\";\nimport { cn } from \"../../utils/cn\";\nimport { plainLines, useHighlight } from \"./highlight\";\nimport type { CodeBlockLanguage } from \"./languages\";\nimport { tokenizeJson } from \"./tokenize-json\";\nimport { CODE_TOKEN_CLASS, type CodeLine } from \"./tokens\";\n\n/**\n * Code Block — a read-only panel for a request body, a response, an\n * event's JSON, an install command. Mono text on the code surface, a title row with expand,\n * wrap, and copy controls. Past `maxLines` the body either scrolls\n * inside that height (`overflow=\"scroll\"`, the default) or folds with a\n * footer button (`overflow=\"expand\"`).\n *\n * Design notes:\n * - Wide lines scroll sideways inside the panel; the page never does.\n * Wrapping is a toggle (`wrap` / `defaultWrap`), off by default so a\n * body reads the way it was sent.\n * - `language` colors the text with Shiki's grammar for it, fetched on\n * first use, on the `--color-pho-code-*` tokens, which carry light and\n * dark. JSON has a synchronous face too — a built-in tokenizer paints\n * it in the first render, and the grammar agrees with it — so a body\n * never flashes plain. Other languages read plain for the frame their\n * grammar takes to arrive.\n * - Without a `title` there is no title row: the controls float over the\n * panel's top-right corner, the way a snippet on a page wears a copy\n * button.\n * - A body that isn't a string (an object) is pretty-printed as JSON.\n */\n\nexport type CodeBlockOverflow = \"scroll\" | \"expand\";\n\n/** The panel's chrome — the card hairline around the code surface. */\nconst CODE_BLOCK_SURFACE =\n \"rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg\";\n\n/** One code line is `leading-5` / `min-h-5`; the pre pads `py-3`. */\nconst LINE_H = \"1.25rem\";\nconst PAD_Y = \"0.75rem\";\n\nexport interface CodeBlockProps extends Omit<\n ComponentProps<\"div\">,\n \"title\" | \"children\"\n> {\n /** The text. An object is pretty-printed as JSON (two-space indent). */\n code?: string | object | null;\n /**\n * What the text is, so the panel can color it: `json`, `typescript`,\n * `bash`, `python`, … or `text` for none. @default \"text\"\n */\n language?: CodeBlockLanguage;\n /**\n * The title row's words — \"Request body\", \"Response\". Without one the\n * row goes and the controls float over the top-right corner.\n */\n title?: ReactNode;\n /** Past this many lines the panel folds or clips. @default 30 */\n maxLines?: number;\n /**\n * How a long body is shown past `maxLines`. `scroll` clips to that\n * height and scrolls inside, with an expand toggle in the title row.\n * `expand` folds and shows a footer button.\n * @default \"scroll\"\n */\n overflow?: CodeBlockOverflow;\n /** Wrap long lines (controlled). */\n wrap?: boolean;\n /** Wrap long lines at first (uncontrolled). @default false */\n defaultWrap?: boolean;\n onWrapChange?: (wrap: boolean) => void;\n /** The expand toggle when `overflow` is `scroll`. @default true */\n expandToggle?: boolean;\n /** The wrap toggle. @default true */\n wrapToggle?: boolean;\n /**\n * A gutter of line numbers. Off by default; turn on for a long\n * payload (about twenty lines or more).\n * @default false\n */\n lineNumbers?: boolean;\n /** The copy control. @default true */\n copy?: boolean;\n /** What the panel says with no code. @default \"Nothing to show.\" */\n empty?: ReactNode;\n /** More controls beside the built-in ones, before them. */\n actions?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction toText(code: CodeBlockProps[\"code\"]): string {\n if (code == null) return \"\";\n if (typeof code === \"string\") return code;\n try {\n return JSON.stringify(code, null, 2) ?? \"\";\n } catch {\n return String(code);\n }\n}\n\n/** The face a body has before (or without) its grammar. */\nfunction syncLines(text: string, language: CodeBlockLanguage): CodeLine[] {\n if (language === \"json\" || language === \"jsonc\") {\n return text.split(\"\\n\").map((line) => tokenizeJson(line));\n }\n return plainLines(text);\n}\n\n/** Room on the first lines for the floating controls, by how many show. */\nconst FLOATING_ROOM = [undefined, \"pr-12\", \"pr-20\", \"pr-28\"] as const;\n\nfunction HeaderToggle({\n label,\n pressed,\n onPressedChange,\n children,\n}: {\n label: string;\n pressed: boolean;\n onPressedChange: (next: boolean) => void;\n children: ReactNode;\n}) {\n return (\n <Tooltip.Root>\n <Tooltip.Trigger\n render={\n <Toggle\n size=\"sm\"\n pressed={pressed}\n onPressedChange={onPressedChange}\n aria-label={label}\n className=\"rounded-sm\"\n >\n {children}\n </Toggle>\n }\n />\n <Tooltip.Portal>\n <Tooltip.Positioner>\n <Tooltip.Popup>{label}</Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n}\n\nfunction CodeLines({\n lines,\n lineNumbers,\n digits,\n wrap,\n}: {\n lines: CodeLine[];\n lineNumbers: boolean;\n digits: number;\n wrap: boolean;\n}) {\n return (\n <code>\n {lines.map((line, index) => (\n <span\n key={index}\n data-line=\"\"\n className={cn(\n \"min-h-5\",\n lineNumbers ? \"flex items-start\" : \"block\",\n lineNumbers && !wrap && \"min-w-max\",\n )}\n >\n {lineNumbers ? (\n <span\n data-line-number=\"\"\n aria-hidden\n className=\"text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none\"\n style={{ width: `${digits}ch` }}\n >\n {index + 1}\n </span>\n ) : null}\n <span className={lineNumbers ? \"min-w-0 flex-1\" : undefined}>\n {line.map((token, at) =>\n token.type === \"plain\" ? (\n token.text\n ) : (\n <span key={at} className={CODE_TOKEN_CLASS[token.type]}>\n {token.text}\n </span>\n ),\n )}\n </span>\n </span>\n ))}\n </code>\n );\n}\n\nexport function CodeBlock({\n code,\n language = \"text\",\n title,\n maxLines = 30,\n overflow = \"scroll\",\n wrap: wrapProp,\n defaultWrap = false,\n onWrapChange,\n expandToggle = true,\n wrapToggle = true,\n lineNumbers = false,\n copy = true,\n empty = \"Nothing to show.\",\n actions,\n className,\n ...props\n}: CodeBlockProps) {\n const text = useMemo(() => toText(code), [code]);\n const highlighted = useHighlight(text, language);\n const lines = useMemo(() => {\n const sync = syncLines(text, language);\n // The grammar and the split must agree on where lines are; where\n // they don't, the synchronous face stands.\n return highlighted != null && highlighted.length === sync.length\n ? highlighted\n : sync;\n }, [text, language, highlighted]);\n const [ownWrap, setOwnWrap] = useState(defaultWrap);\n const wrap = wrapProp ?? ownWrap;\n const setWrap = (next: boolean) => {\n if (wrapProp == null) setOwnWrap(next);\n onWrapChange?.(next);\n };\n const [expanded, setExpanded] = useState(false);\n const folds = lines.length > maxLines;\n const scrolling = overflow === \"scroll\" && folds && !expanded;\n const shown =\n overflow === \"expand\" && folds && !expanded\n ? lines.slice(0, maxLines)\n : lines;\n const isEmpty = text === \"\";\n const showExpandToggle =\n overflow === \"scroll\" && expandToggle && folds && !isEmpty;\n const showWrapToggle = wrapToggle && !isEmpty;\n const showCopy = copy && !isEmpty;\n const hasTitle = title != null;\n const builtIns =\n Number(showExpandToggle) + Number(showWrapToggle) + Number(showCopy);\n const hasControls = actions != null || builtIns > 0;\n const copyLabel = typeof title === \"string\" ? title.toLowerCase() : \"code\";\n const scrollLabel = typeof title === \"string\" ? title : \"Code\";\n const expandLabel = expanded\n ? `Collapse to ${maxLines} lines`\n : `Show all ${lines.length} lines`;\n const lineNoDigits = String(Math.max(lines.length, 1)).length;\n const controls = (\n <>\n {actions}\n <Tooltip.Provider>\n {showExpandToggle ? (\n <HeaderToggle\n label={expandLabel}\n pressed={expanded}\n onPressedChange={setExpanded}\n >\n {expanded ? (\n <IconArrowsMinimize aria-hidden />\n ) : (\n <IconArrowsMaximize aria-hidden />\n )}\n </HeaderToggle>\n ) : null}\n {showWrapToggle ? (\n <HeaderToggle\n label=\"Wrap long lines\"\n pressed={wrap}\n onPressedChange={setWrap}\n >\n <IconTextWrap aria-hidden />\n </HeaderToggle>\n ) : null}\n </Tooltip.Provider>\n {showCopy ? (\n <CopyButton value={text} label={copyLabel} size=\"md\" />\n ) : null}\n </>\n );\n const body = (\n <pre\n className={cn(\n \"m-0 min-w-0 py-3 font-mono text-xs leading-5\",\n lineNumbers ? \"pr-3 pl-0\" : \"px-3\",\n // Room for the floating controls on the first lines.\n !hasTitle &&\n FLOATING_ROOM[Math.min(builtIns + (actions != null ? 1 : 0), 3)],\n wrap\n ? \"[overflow-wrap:anywhere] whitespace-pre-wrap\"\n : scrolling\n ? \"w-max min-w-full whitespace-pre\"\n : \"max-w-full overflow-x-auto whitespace-pre\",\n )}\n >\n <CodeLines\n lines={shown}\n lineNumbers={lineNumbers}\n digits={lineNoDigits}\n wrap={wrap}\n />\n </pre>\n );\n return (\n <div\n data-code-block=\"\"\n data-language={language}\n data-overflow={overflow}\n data-highlighted={\n highlighted != null && lines === highlighted ? \"\" : undefined\n }\n className={cn(\n CODE_BLOCK_SURFACE,\n \"relative flex w-full min-w-0 flex-col overflow-hidden\",\n className,\n )}\n {...props}\n >\n {hasTitle ? (\n <div className=\"border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3\">\n <div className=\"text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium\">\n {title}\n </div>\n {controls}\n </div>\n ) : hasControls ? (\n // No title row: the controls float over the corner, on the code\n // surface so scrolled text passes under them.\n <div className=\"bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm\">\n {controls}\n </div>\n ) : null}\n {isEmpty ? (\n <p className=\"text-pho-description m-0 px-3 py-3 text-base\">{empty}</p>\n ) : scrolling ? (\n <section className=\"min-w-0\">\n <ScrollArea.Root\n fade={false}\n data-code-scroll=\"\"\n className=\"min-w-0 rounded-b-[inherit]\"\n style={{ height: `calc(${maxLines} * ${LINE_H} + ${PAD_Y} * 2)` }}\n >\n <ScrollArea.Viewport tabIndex={0} aria-label={scrollLabel}>\n <ScrollArea.Content>{body}</ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n {wrap ? null : (\n <ScrollArea.Scrollbar orientation=\"horizontal\">\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n )}\n </ScrollArea.Root>\n </section>\n ) : (\n body\n )}\n {overflow === \"expand\" && folds ? (\n <div className=\"border-pho-secondary flex items-center border-t px-1.5 py-1\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-expanded={expanded}\n prefix={expanded ? IconChevronUp : IconChevronDown}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {expanded ? \"Show less\" : `Show all ${lines.length} lines`}\n </Button>\n </div>\n ) : null}\n </div>\n );\n}\n\nCodeBlock.displayName = \"CodeBlock\";\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;;;;;;;AASA,IAAMA,KAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAiB,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAe,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG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A,gBAAA,EAAC,EAAW,MAAZ;AAAA,UACE,MAAM;AAAA,UACN,oBAAiB;AAAA,UACjB,WAAU;AAAA,UACV,OAAO,EAAE,QAAQ,QAAQ,CAAA,MAAc,EAAA,MAAY,EAAA,QAAa;AAAA,UAJlE,UAAA;AAAA,YAME,gBAAA,EAAC,EAAW,UAAZ;AAAA,cAAqB,UAAU;AAAA,cAAG,cAAY;AAAA,cAC5C,UAAA,gBAAA,EAAC,EAAW,SAAZ,EAAA,UAAqB,EAAyB,CAAA;AAAA,YAC3B,CAAA;AAAA,YACrB,gBAAA,EAAC,EAAW,WAAZ,EAAA,UACE,gBAAA,EAAC,EAAW,OAAZ,CAAmB,CAAA,EACC,CAAA;AAAA,YACrB,IAAO,OACN,gBAAA,EAAC,EAAW,WAAZ;AAAA,cAAsB,aAAY;AAAA,cAChC,UAAA,gBAAA,EAAC,EAAW,OAAZ,CAAmB,CAAA;AAAA,YACC,CAAA;AAAA,UAET;AAAA;MACV,CAAA,IAET;AAAA,MAED,MAAa,YAAY,IACxB,gBAAA,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,QACb,UAAA,gBAAA,EAAC,IAAD;AAAA,UACE,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,iBAAe;AAAA,UACf,QAAQ,IAAW,KAAgB;AAAA,UACnC,SAAA,MAAe,EAAA,CAAa,MAAS,CAAC,CAAI;AAAA,UAEzC,UAAA,IAAW,cAAc,YAAY,EAAM,MAAA;AAAA,QACtC,CAAA;AAAA,MACL,CAAA,IACH;AAAA,IACD;AAAA;AAET;AAEA,GAAU,cAAc"}
|
|
1
|
+
{"version":3,"file":"code-block-DMiZkEWS.js","names":["__iconNode","__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMaximize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconArrowsMinimize.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconTextWrap.mjs","../../src/components/code-block/languages.ts","../../src/components/code-block/tokens.ts","../../src/components/code-block/pho-theme.ts","../../src/components/code-block/highlight.ts","../../src/components/code-block/tokenize-json.ts","../../src/components/code-block/code-block.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 4l4 0l0 4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 10l6 -6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M8 20l-4 0l0 -4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 20l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M16 20l4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M14 14l6 6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M8 4l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M4 4l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMaximize = createReactComponent(\"outline\", \"arrows-maximize\", \"ArrowsMaximize\", __iconNode);\n\nexport { __iconNode, IconArrowsMaximize as default };\n//# sourceMappingURL=IconArrowsMaximize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M5 9l4 0l0 -4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M3 3l6 6\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M5 15l4 0l0 4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M3 21l6 -6\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M19 9l-4 0l0 -4\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M15 9l6 -6\", \"key\": \"svg-5\" }], [\"path\", { \"d\": \"M19 15l-4 0l0 4\", \"key\": \"svg-6\" }], [\"path\", { \"d\": \"M15 15l6 6\", \"key\": \"svg-7\" }]];\nconst IconArrowsMinimize = createReactComponent(\"outline\", \"arrows-minimize\", \"ArrowsMinimize\", __iconNode);\n\nexport { __iconNode, IconArrowsMinimize as default };\n//# sourceMappingURL=IconArrowsMinimize.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M4 6l16 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M4 18l5 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M4 12h13a3 3 0 0 1 0 6h-4l2 -2m0 4l-2 -2\", \"key\": \"svg-2\" }]];\nconst IconTextWrap = createReactComponent(\"outline\", \"text-wrap\", \"TextWrap\", __iconNode);\n\nexport { __iconNode, IconTextWrap as default };\n//# sourceMappingURL=IconTextWrap.mjs.map\n","import type { LanguageRegistration } from \"shiki/core\";\n\n/**\n * The languages a code panel can color, each a grammar fetched on first\n * use — a page that shows JSON never downloads the TypeScript grammar.\n * Keyed by the name Shiki knows the grammar by; `LANGUAGE_ALIASES` lets a\n * panel say `ts` or `sh`.\n */\nexport const CODE_GRAMMARS = {\n json: () => import(\"@shikijs/langs/json\"),\n jsonc: () => import(\"@shikijs/langs/jsonc\"),\n javascript: () => import(\"@shikijs/langs/javascript\"),\n typescript: () => import(\"@shikijs/langs/typescript\"),\n jsx: () => import(\"@shikijs/langs/jsx\"),\n tsx: () => import(\"@shikijs/langs/tsx\"),\n shellscript: () => import(\"@shikijs/langs/shellscript\"),\n python: () => import(\"@shikijs/langs/python\"),\n swift: () => import(\"@shikijs/langs/swift\"),\n go: () => import(\"@shikijs/langs/go\"),\n ruby: () => import(\"@shikijs/langs/ruby\"),\n php: () => import(\"@shikijs/langs/php\"),\n java: () => import(\"@shikijs/langs/java\"),\n kotlin: () => import(\"@shikijs/langs/kotlin\"),\n csharp: () => import(\"@shikijs/langs/csharp\"),\n rust: () => import(\"@shikijs/langs/rust\"),\n html: () => import(\"@shikijs/langs/html\"),\n css: () => import(\"@shikijs/langs/css\"),\n xml: () => import(\"@shikijs/langs/xml\"),\n yaml: () => import(\"@shikijs/langs/yaml\"),\n toml: () => import(\"@shikijs/langs/toml\"),\n dotenv: () => import(\"@shikijs/langs/dotenv\"),\n sql: () => import(\"@shikijs/langs/sql\"),\n graphql: () => import(\"@shikijs/langs/graphql\"),\n http: () => import(\"@shikijs/langs/http\"),\n markdown: () => import(\"@shikijs/langs/markdown\"),\n diff: () => import(\"@shikijs/langs/diff\"),\n} satisfies Record<string, () => Promise<{ default: LanguageRegistration[] }>>;\n\nexport type CodeGrammar = keyof typeof CODE_GRAMMARS;\n\n/** Shorter names, and the ones people reach for first. */\nexport const LANGUAGE_ALIASES = {\n js: \"javascript\",\n ts: \"typescript\",\n bash: \"shellscript\",\n sh: \"shellscript\",\n shell: \"shellscript\",\n zsh: \"shellscript\",\n py: \"python\",\n rb: \"ruby\",\n kt: \"kotlin\",\n cs: \"csharp\",\n rs: \"rust\",\n yml: \"yaml\",\n md: \"markdown\",\n htm: \"html\",\n} as const satisfies Record<string, CodeGrammar>;\n\nexport type CodeLanguageAlias = keyof typeof LANGUAGE_ALIASES;\n\n/**\n * What `language` accepts: a grammar, an alias, or `text` for none. Plain\n * text is the default — a panel colors only what it is told the shape of.\n */\nexport type CodeBlockLanguage = \"text\" | CodeGrammar | CodeLanguageAlias;\n\n/**\n * The grammar behind a `language`, or `null` for plain text and names the\n * panel does not know (which read as text instead of throwing).\n */\nexport function resolveGrammar(language: string): CodeGrammar | null {\n // Own keys only: `in` would take \"toString\" for a grammar.\n if (Object.hasOwn(LANGUAGE_ALIASES, language)) {\n return LANGUAGE_ALIASES[language as CodeLanguageAlias];\n }\n return Object.hasOwn(CODE_GRAMMARS, language)\n ? (language as CodeGrammar)\n : null;\n}\n","/**\n * The token vocabulary a code panel colors with — one class per kind, on\n * the `--color-pho-code-*` tokens, which carry light and dark. The JSON\n * tokenizer speaks the first five; Shiki's grammars reach the rest.\n */\n\nexport type CodeTokenType =\n | \"key\"\n | \"string\"\n | \"number\"\n | \"keyword\"\n | \"punctuation\"\n | \"comment\"\n | \"function\"\n | \"type\"\n | \"plain\";\n\nexport interface CodeToken {\n type: CodeTokenType;\n text: string;\n}\n\n/** One line of a highlighted body. */\nexport type CodeLine = CodeToken[];\n\n/** The class a token kind wears; `plain` wears the panel's own ink. */\nexport const CODE_TOKEN_CLASS: Record<CodeTokenType, string | undefined> = {\n key: \"text-pho-code-key\",\n string: \"text-pho-code-string\",\n number: \"text-pho-code-number\",\n keyword: \"text-pho-code-keyword\",\n punctuation: \"text-pho-code-punctuation\",\n comment: \"text-pho-code-comment\",\n function: \"text-pho-code-function\",\n type: \"text-pho-code-type\",\n plain: undefined,\n};\n","import type { ThemeRegistrationRaw } from \"shiki/core\";\nimport { CODE_TOKEN_CLASS, type CodeTokenType } from \"./tokens\";\n\n/**\n * Pho's Shiki theme — not a palette but a routing table. Every TextMate\n * scope resolves to one of the panel's token kinds, and each kind's\n * \"color\" is the design token's own variable, so the theme has no light\n * and dark of its own: the `--color-pho-code-*` tokens carry both, and\n * the renderer turns each color back into the kind's class. Only the\n * kinds a body needs to read — keys, strings, numbers, keywords,\n * punctuation, comments, calls, types. Operators, variables, and\n * everything else stay in the panel's ink.\n */\n\nexport const PHO_THEME_NAME = \"pho\";\n\n/** The color a token kind \"has\" in the theme: its token's variable. */\nexport function tokenColor(type: Exclude<CodeTokenType, \"plain\">): string {\n return `var(--color-pho-code-${type})`;\n}\n\n/** The token kind behind a Shiki color, or `plain` for the panel's ink. */\nexport function tokenTypeOf(color: string | undefined): CodeTokenType {\n const match = color?.match(/^var\\(--color-pho-code-([a-z]+)\\)$/);\n const kind = match?.[1];\n return kind != null && kind in CODE_TOKEN_CLASS && kind !== \"plain\"\n ? (kind as CodeTokenType)\n : \"plain\";\n}\n\nconst rule = (\n type: Exclude<CodeTokenType, \"plain\"> | \"plain\",\n scope: string[],\n) => ({\n scope,\n settings: {\n foreground:\n type === \"plain\" ? \"var(--color-pho-code-fg)\" : tokenColor(type),\n },\n});\n\nexport const phoTheme: ThemeRegistrationRaw = {\n name: PHO_THEME_NAME,\n type: \"light\",\n fg: \"var(--color-pho-code-fg)\",\n bg: \"var(--color-pho-code-bg)\",\n settings: [\n rule(\"comment\", [\"comment\", \"punctuation.definition.comment\"]),\n rule(\"string\", [\n \"string\",\n \"markup.inserted\",\n \"meta.diff.header.to-file\",\n \"punctuation.definition.inserted\",\n ]),\n // A template's `${…}` and any embedded code read as code again.\n rule(\"plain\", [\"meta.template.expression\", \"meta.embedded\"]),\n rule(\"key\", [\n \"support.type.property-name\",\n \"meta.object-literal.key\",\n \"entity.other.attribute-name\",\n \"entity.name.tag.yaml\",\n \"keyword.key.toml\",\n \"variable.other.env\",\n ]),\n rule(\"number\", [\n \"constant.numeric\",\n \"markup.deleted\",\n \"meta.diff.header.from-file\",\n \"punctuation.definition.deleted\",\n ]),\n rule(\"keyword\", [\n \"keyword\",\n \"storage\",\n \"constant.language\",\n \"variable.language\",\n ]),\n // Symbolic operators sit in the ink: `=`, `+`, `=>`, `&&` are shape,\n // not vocabulary. The word-shaped ones above stay keywords.\n rule(\"plain\", [\"keyword.operator\"]),\n rule(\"keyword\", [\n \"keyword.operator.expression\",\n \"keyword.operator.new\",\n \"keyword.operator.logical.python\",\n \"keyword.operator.wordlike\",\n ]),\n rule(\"function\", [\n \"entity.name.function\",\n \"support.function\",\n \"entity.name.command\",\n \"meta.function-call.generic\",\n ]),\n rule(\"type\", [\n \"entity.name.type\",\n \"entity.name.class\",\n \"entity.name.tag\",\n \"entity.other.inherited-class\",\n \"support.type\",\n \"support.class\",\n \"storage.type.primitive\",\n ]),\n // A property name is a key even though it is a `support.type`.\n rule(\"key\", [\"support.type.property-name\"]),\n rule(\"punctuation\", [\n \"punctuation.separator\",\n \"punctuation.terminator\",\n \"punctuation.accessor\",\n \"punctuation.section\",\n \"punctuation.definition.array\",\n \"punctuation.definition.dictionary\",\n \"punctuation.definition.block\",\n \"punctuation.definition.parameters\",\n \"punctuation.definition.arguments\",\n \"punctuation.definition.tag\",\n \"punctuation.definition.typeparameters\",\n \"meta.brace\",\n ]),\n ],\n};\n","import { useEffect, useSyncExternalStore } from \"react\";\nimport type { HighlighterCore, ThemedToken } from \"shiki/core\";\nimport { CODE_GRAMMARS, resolveGrammar, type CodeGrammar } from \"./languages\";\nimport { phoTheme, PHO_THEME_NAME, tokenTypeOf } from \"./pho-theme\";\nimport type { CodeLine } from \"./tokens\";\n\n/**\n * Highlighting, on Shiki — one highlighter for the whole app, made on\n * the first panel that asks and kept; grammars fetched on demand and\n * kept too. Bodies are tokenized once per (grammar, text) and remembered,\n * so a wrap toggle or a fold never re-runs a grammar.\n *\n * The result is lines of `CodeToken`s in the panel's own vocabulary\n * (`tokens.ts`), never Shiki's HTML: the panel keeps rendering its own\n * lines (the fold, `data-line`) and its own classes (the design tokens).\n *\n * Nothing here runs on the server. `useHighlight` reports `null` until a\n * body is highlighted, and a panel shows its synchronous face meanwhile —\n * plain text, or the JSON tokenizer's colors — so a page prerendered and\n * a page hydrated agree, and the colors settle in a frame later.\n */\n\nlet core: HighlighterCore | null = null;\nlet corePromise: Promise<HighlighterCore> | null = null;\nconst loadedGrammars = new Set<CodeGrammar>();\nconst loadingGrammars = new Map<CodeGrammar, Promise<void>>();\n\n/**\n * Shiki itself arrives with the first body that needs it — a page of\n * cards and rows never loads the engine — and stays for the rest.\n */\nfunction getCore(): Promise<HighlighterCore> {\n corePromise ??= Promise.all([\n import(\"shiki/core\"),\n import(\"shiki/engine/javascript\"),\n ])\n .then(([{ createHighlighterCore }, { createJavaScriptRegexEngine }]) =>\n createHighlighterCore({\n themes: [phoTheme],\n langs: [],\n // Shiki's JavaScript engine: no WebAssembly to fetch or allow, and\n // `forgiving` degrades a grammar's exotic pattern instead of\n // failing the whole body.\n engine: createJavaScriptRegexEngine({ forgiving: true }),\n }),\n )\n .then((highlighter) => {\n core = highlighter;\n return highlighter;\n });\n return corePromise;\n}\n\n/** Fetch a language's grammar ahead of the first body that needs it. */\nexport function preloadLanguage(language: string): Promise<void> {\n const grammar = resolveGrammar(language);\n if (grammar == null || loadedGrammars.has(grammar)) return Promise.resolve();\n let loading = loadingGrammars.get(grammar);\n if (loading == null) {\n loading = Promise.all([getCore(), CODE_GRAMMARS[grammar]()])\n .then(([highlighter, module]) =>\n highlighter.loadLanguage(...module.default),\n )\n .then(() => {\n loadedGrammars.add(grammar);\n })\n .finally(() => {\n loadingGrammars.delete(grammar);\n });\n loadingGrammars.set(grammar, loading);\n }\n return loading;\n}\n\n/** Whether `language` can be tokenized right now, without waiting. */\nexport function isLanguageReady(language: string): boolean {\n const grammar = resolveGrammar(language);\n return grammar != null && core != null && loadedGrammars.has(grammar);\n}\n\nfunction toLines(tokens: ThemedToken[][]): CodeLine[] {\n return tokens.map((line) => {\n const out: CodeLine = [];\n for (const token of line) {\n const type = tokenTypeOf(token.color);\n const last = out[out.length - 1];\n // Neighbors of one kind collapse into one span.\n if (last != null && last.type === type) last.text += token.content;\n else out.push({ type, text: token.content });\n }\n return out;\n });\n}\n\n/**\n * Tokenize a body with a grammar that is already loaded. `null` when the\n * language is plain text or its grammar is not here yet — see\n * `preloadLanguage` / `highlight`.\n */\nexport function highlightSync(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n if (grammar == null || core == null || !loadedGrammars.has(grammar)) {\n return null;\n }\n return toLines(\n core.codeToTokensBase(code, { lang: grammar, theme: PHO_THEME_NAME }),\n );\n}\n\n/** Plain lines — what a body reads as with no grammar. */\nexport function plainLines(code: string): CodeLine[] {\n return code.split(\"\\n\").map((text) => [{ type: \"plain\", text }]);\n}\n\n/**\n * Tokenize a body, fetching the highlighter and the grammar first if\n * need be. A language the panel does not know resolves to plain lines.\n */\nexport async function highlight(\n code: string,\n language: string,\n): Promise<CodeLine[]> {\n if (resolveGrammar(language) == null) return plainLines(code);\n await preloadLanguage(language);\n return highlightSync(code, language) ?? plainLines(code);\n}\n\n/* --------------------------------- store --------------------------------- */\n\n/** How many highlighted bodies to keep. A page's worth, several times. */\nconst CACHE_LIMIT = 200;\nconst cache = new Map<string, CodeLine[]>();\nconst listeners = new Set<() => void>();\n\nfunction remember(key: string, lines: CodeLine[]): CodeLine[] {\n const known = cache.get(key);\n if (known != null) return known;\n if (cache.size >= CACHE_LIMIT) {\n const oldest = cache.keys().next().value;\n if (oldest != null) cache.delete(oldest);\n }\n cache.set(key, lines);\n return lines;\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction notify() {\n for (const listener of listeners) listener();\n}\n\nfunction cacheKey(grammar: CodeGrammar, code: string) {\n return `${grammar}\u0000${code}`;\n}\n\n/**\n * The highlighted lines of a body, or `null` while its grammar is on the\n * way (and always for plain text). A grammar already here highlights in\n * the same render, no flash.\n */\nexport function useHighlight(\n code: string,\n language: string,\n): CodeLine[] | null {\n const grammar = resolveGrammar(language);\n const key = grammar != null ? cacheKey(grammar, code) : null;\n const lines = useSyncExternalStore(\n subscribe,\n () => {\n if (key == null) return null;\n const known = cache.get(key);\n if (known != null) return known;\n const now = highlightSync(code, language);\n return now != null ? remember(key, now) : null;\n },\n // Prerendered markup is the synchronous face; hydration agrees with it\n // and the colors settle in the render after.\n () => null,\n );\n useEffect(() => {\n if (key == null || cache.has(key)) return;\n // Remembered even if this panel is gone by then: the next one with the\n // same body reads it in its first render.\n highlight(code, language).then(\n (result) => {\n remember(key, result);\n notify();\n },\n () => {\n // A grammar that would not load: the panel keeps its plain face.\n },\n );\n }, [key, code, language]);\n return lines;\n}\n","/**\n * A tokenizer for JSON, and nothing else: keys, strings, numbers, the\n * three keywords, and punctuation. Runs one line at a time (a JSON\n * string never spans lines) so a panel can show its first N lines and\n * stop. Text that isn't JSON comes back as it is, in plain tokens.\n */\n\nexport type JsonTokenType =\n \"key\" | \"string\" | \"number\" | \"keyword\" | \"punctuation\" | \"plain\";\n\nexport interface JsonToken {\n type: JsonTokenType;\n text: string;\n}\n\n// One pass, left to right: a string (a key when a colon follows), a\n// number, a keyword, a bracket or a comma. Anything between is plain.\nconst TOKEN =\n /(\"(?:[^\"\\\\]|\\\\.)*\")(\\s*:)?|(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)|\\b(true|false|null)\\b|([{}[\\]:,])/g;\n\nexport function tokenizeJson(line: string): JsonToken[] {\n const tokens: JsonToken[] = [];\n let last = 0;\n TOKEN.lastIndex = 0;\n for (let match = TOKEN.exec(line); match != null; match = TOKEN.exec(line)) {\n if (match.index > last) {\n tokens.push({ type: \"plain\", text: line.slice(last, match.index) });\n }\n const [, string, colon, number, keyword, punctuation] = match;\n if (string != null) {\n tokens.push({ type: colon != null ? \"key\" : \"string\", text: string });\n if (colon != null) tokens.push({ type: \"punctuation\", text: colon });\n } else if (number != null) {\n tokens.push({ type: \"number\", text: number });\n } else if (keyword != null) {\n tokens.push({ type: \"keyword\", text: keyword });\n } else if (punctuation != null) {\n tokens.push({ type: \"punctuation\", text: punctuation });\n }\n last = match.index + match[0].length;\n }\n if (last < line.length) {\n tokens.push({ type: \"plain\", text: line.slice(last) });\n }\n return tokens;\n}\n","import {\n useMemo,\n useState,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n IconArrowsMaximize,\n IconArrowsMinimize,\n IconChevronDown,\n IconChevronUp,\n IconTextWrap,\n} from \"@tabler/icons-react\";\nimport { Button } from \"../button\";\nimport { CopyButton } from \"../copy-button\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { Toggle } from \"../toggle\";\nimport { Tooltip } from \"../tooltip\";\nimport { cn } from \"../../utils/cn\";\nimport { plainLines, useHighlight } from \"./highlight\";\nimport type { CodeBlockLanguage } from \"./languages\";\nimport { tokenizeJson } from \"./tokenize-json\";\nimport { CODE_TOKEN_CLASS, type CodeLine } from \"./tokens\";\n\n/**\n * Code Block — a read-only panel for a request body, a response, an\n * event's JSON, an install command. Mono text on the code surface, a title row with expand,\n * wrap, and copy controls. Past `maxLines` the body either scrolls\n * inside that height (`overflow=\"scroll\"`, the default) or folds with a\n * footer button (`overflow=\"expand\"`).\n *\n * Design notes:\n * - Wide lines scroll sideways inside the panel; the page never does.\n * Wrapping is a toggle (`wrap` / `defaultWrap`), off by default so a\n * body reads the way it was sent.\n * - `language` colors the text with Shiki's grammar for it, fetched on\n * first use, on the `--color-pho-code-*` tokens, which carry light and\n * dark. JSON has a synchronous face too — a built-in tokenizer paints\n * it in the first render, and the grammar agrees with it — so a body\n * never flashes plain. Other languages read plain for the frame their\n * grammar takes to arrive.\n * - Without a `title` there is no title row: the controls float over the\n * panel's top-right corner, the way a snippet on a page wears a copy\n * button.\n * - A body that isn't a string (an object) is pretty-printed as JSON.\n */\n\nexport type CodeBlockOverflow = \"scroll\" | \"expand\";\n\n/** The panel's chrome — the card hairline around the code surface. */\nconst CODE_BLOCK_SURFACE =\n \"rounded-base border border-pho-secondary bg-pho-code-bg text-pho-code-fg\";\n\n/** One code line is `leading-5` / `min-h-5`; the pre pads `py-3`. */\nconst LINE_H = \"1.25rem\";\nconst PAD_Y = \"0.75rem\";\n\nexport interface CodeBlockProps extends Omit<\n ComponentProps<\"div\">,\n \"title\" | \"children\"\n> {\n /** The text. An object is pretty-printed as JSON (two-space indent). */\n code?: string | object | null;\n /**\n * What the text is, so the panel can color it: `json`, `typescript`,\n * `bash`, `python`, … or `text` for none. @default \"text\"\n */\n language?: CodeBlockLanguage;\n /**\n * The title row's words — \"Request body\", \"Response\". Without one the\n * row goes and the controls float over the top-right corner.\n */\n title?: ReactNode;\n /** Past this many lines the panel folds or clips. @default 30 */\n maxLines?: number;\n /**\n * How a long body is shown past `maxLines`. `scroll` clips to that\n * height and scrolls inside, with an expand toggle in the title row.\n * `expand` folds and shows a footer button.\n * @default \"scroll\"\n */\n overflow?: CodeBlockOverflow;\n /** Wrap long lines (controlled). */\n wrap?: boolean;\n /** Wrap long lines at first (uncontrolled). @default false */\n defaultWrap?: boolean;\n onWrapChange?: (wrap: boolean) => void;\n /** The expand toggle when `overflow` is `scroll`. @default true */\n expandToggle?: boolean;\n /** The wrap toggle. @default true */\n wrapToggle?: boolean;\n /**\n * A gutter of line numbers. Off by default; turn on for a long\n * payload (about twenty lines or more).\n * @default false\n */\n lineNumbers?: boolean;\n /** The copy control. @default true */\n copy?: boolean;\n /** What the panel says with no code. @default \"Nothing to show.\" */\n empty?: ReactNode;\n /** More controls beside the built-in ones, before them. */\n actions?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction toText(code: CodeBlockProps[\"code\"]): string {\n if (code == null) return \"\";\n if (typeof code === \"string\") return code;\n try {\n return JSON.stringify(code, null, 2) ?? \"\";\n } catch {\n return String(code);\n }\n}\n\n/** The face a body has before (or without) its grammar. */\nfunction syncLines(text: string, language: CodeBlockLanguage): CodeLine[] {\n if (language === \"json\" || language === \"jsonc\") {\n return text.split(\"\\n\").map((line) => tokenizeJson(line));\n }\n return plainLines(text);\n}\n\n/** Room on the first lines for the floating controls, by how many show. */\nconst FLOATING_ROOM = [undefined, \"pr-12\", \"pr-20\", \"pr-28\"] as const;\n\nfunction HeaderToggle({\n label,\n pressed,\n onPressedChange,\n children,\n}: {\n label: string;\n pressed: boolean;\n onPressedChange: (next: boolean) => void;\n children: ReactNode;\n}) {\n return (\n <Tooltip.Root>\n <Tooltip.Trigger\n render={\n <Toggle\n size=\"sm\"\n pressed={pressed}\n onPressedChange={onPressedChange}\n aria-label={label}\n className=\"rounded-sm\"\n >\n {children}\n </Toggle>\n }\n />\n <Tooltip.Portal>\n <Tooltip.Positioner>\n <Tooltip.Popup>{label}</Tooltip.Popup>\n </Tooltip.Positioner>\n </Tooltip.Portal>\n </Tooltip.Root>\n );\n}\n\nfunction CodeLines({\n lines,\n lineNumbers,\n digits,\n wrap,\n}: {\n lines: CodeLine[];\n lineNumbers: boolean;\n digits: number;\n wrap: boolean;\n}) {\n return (\n <code>\n {lines.map((line, index) => (\n <span\n key={index}\n data-line=\"\"\n className={cn(\n \"min-h-5\",\n lineNumbers ? \"flex items-start\" : \"block\",\n lineNumbers && !wrap && \"min-w-max\",\n )}\n >\n {lineNumbers ? (\n <span\n data-line-number=\"\"\n aria-hidden\n className=\"text-pho-placeholder bg-pho-code-bg sticky left-0 z-[1] box-content shrink-0 pr-3 pl-3 text-right font-mono text-xs leading-5 tabular-nums select-none\"\n style={{ width: `${digits}ch` }}\n >\n {index + 1}\n </span>\n ) : null}\n <span className={lineNumbers ? \"min-w-0 flex-1\" : undefined}>\n {line.map((token, at) =>\n token.type === \"plain\" ? (\n token.text\n ) : (\n <span key={at} className={CODE_TOKEN_CLASS[token.type]}>\n {token.text}\n </span>\n ),\n )}\n </span>\n </span>\n ))}\n </code>\n );\n}\n\nexport function CodeBlock({\n code,\n language = \"text\",\n title,\n maxLines = 30,\n overflow = \"scroll\",\n wrap: wrapProp,\n defaultWrap = false,\n onWrapChange,\n expandToggle = true,\n wrapToggle = true,\n lineNumbers = false,\n copy = true,\n empty = \"Nothing to show.\",\n actions,\n className,\n ...props\n}: CodeBlockProps) {\n const text = useMemo(() => toText(code), [code]);\n const highlighted = useHighlight(text, language);\n const lines = useMemo(() => {\n const sync = syncLines(text, language);\n // The grammar and the split must agree on where lines are; where\n // they don't, the synchronous face stands.\n return highlighted != null && highlighted.length === sync.length\n ? highlighted\n : sync;\n }, [text, language, highlighted]);\n const [ownWrap, setOwnWrap] = useState(defaultWrap);\n const wrap = wrapProp ?? ownWrap;\n const setWrap = (next: boolean) => {\n if (wrapProp == null) setOwnWrap(next);\n onWrapChange?.(next);\n };\n const [expanded, setExpanded] = useState(false);\n const folds = lines.length > maxLines;\n const scrolling = overflow === \"scroll\" && folds && !expanded;\n const shown =\n overflow === \"expand\" && folds && !expanded\n ? lines.slice(0, maxLines)\n : lines;\n const isEmpty = text === \"\";\n const showExpandToggle =\n overflow === \"scroll\" && expandToggle && folds && !isEmpty;\n const showWrapToggle = wrapToggle && !isEmpty;\n const showCopy = copy && !isEmpty;\n const hasTitle = title != null;\n const builtIns =\n Number(showExpandToggle) + Number(showWrapToggle) + Number(showCopy);\n const hasControls = actions != null || builtIns > 0;\n const copyLabel = typeof title === \"string\" ? title.toLowerCase() : \"code\";\n const scrollLabel = typeof title === \"string\" ? title : \"Code\";\n const expandLabel = expanded\n ? `Collapse to ${maxLines} lines`\n : `Show all ${lines.length} lines`;\n const lineNoDigits = String(Math.max(lines.length, 1)).length;\n const controls = (\n <>\n {actions}\n <Tooltip.Provider>\n {showExpandToggle ? (\n <HeaderToggle\n label={expandLabel}\n pressed={expanded}\n onPressedChange={setExpanded}\n >\n {expanded ? (\n <IconArrowsMinimize aria-hidden />\n ) : (\n <IconArrowsMaximize aria-hidden />\n )}\n </HeaderToggle>\n ) : null}\n {showWrapToggle ? (\n <HeaderToggle\n label=\"Wrap long lines\"\n pressed={wrap}\n onPressedChange={setWrap}\n >\n <IconTextWrap aria-hidden />\n </HeaderToggle>\n ) : null}\n </Tooltip.Provider>\n {showCopy ? (\n <CopyButton value={text} label={copyLabel} size=\"md\" />\n ) : null}\n </>\n );\n const body = (\n <pre\n className={cn(\n \"m-0 min-w-0 py-3 font-mono text-xs leading-5\",\n lineNumbers ? \"pr-3 pl-0\" : \"px-3\",\n // Room for the floating controls on the first lines.\n !hasTitle &&\n FLOATING_ROOM[Math.min(builtIns + (actions != null ? 1 : 0), 3)],\n wrap\n ? \"[overflow-wrap:anywhere] whitespace-pre-wrap\"\n : scrolling\n ? \"w-max min-w-full whitespace-pre\"\n : \"max-w-full overflow-x-auto whitespace-pre\",\n )}\n >\n <CodeLines\n lines={shown}\n lineNumbers={lineNumbers}\n digits={lineNoDigits}\n wrap={wrap}\n />\n </pre>\n );\n return (\n <div\n data-code-block=\"\"\n data-language={language}\n data-overflow={overflow}\n data-highlighted={\n highlighted != null && lines === highlighted ? \"\" : undefined\n }\n className={cn(\n CODE_BLOCK_SURFACE,\n \"relative flex w-full min-w-0 flex-col overflow-hidden\",\n className,\n )}\n {...props}\n >\n {hasTitle ? (\n <div className=\"border-pho-secondary flex min-h-10 items-center gap-2 border-b py-1 pr-1.5 pl-3\">\n <div className=\"text-pho-secondary min-w-0 flex-1 truncate text-xs font-medium\">\n {title}\n </div>\n {controls}\n </div>\n ) : hasControls ? (\n // No title row: the controls float over the corner, on the code\n // surface so scrolled text passes under them.\n <div className=\"bg-pho-code-bg absolute top-1 right-1.5 z-10 flex items-center gap-2 rounded-sm\">\n {controls}\n </div>\n ) : null}\n {isEmpty ? (\n <p className=\"text-pho-description m-0 px-3 py-3 text-base\">{empty}</p>\n ) : scrolling ? (\n <section className=\"min-w-0\">\n <ScrollArea.Root\n fade={false}\n data-code-scroll=\"\"\n className=\"min-w-0 rounded-b-[inherit]\"\n style={{ height: `calc(${maxLines} * ${LINE_H} + ${PAD_Y} * 2)` }}\n >\n <ScrollArea.Viewport tabIndex={0} aria-label={scrollLabel}>\n <ScrollArea.Content>{body}</ScrollArea.Content>\n </ScrollArea.Viewport>\n <ScrollArea.Scrollbar>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n {wrap ? null : (\n <ScrollArea.Scrollbar orientation=\"horizontal\">\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n )}\n </ScrollArea.Root>\n </section>\n ) : (\n body\n )}\n {overflow === \"expand\" && folds ? (\n <div className=\"border-pho-secondary flex items-center border-t px-1.5 py-1\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n aria-expanded={expanded}\n prefix={expanded ? IconChevronUp : IconChevronDown}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {expanded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M,MAAA;AAAA,QACtC,CAAA;AAAA,MACL,CAAA,IACH;AAAA,IACD;AAAA;AAET;AAEA,GAAU,cAAc"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as n } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import { t as m } from "./resolve-variant-CcD8iG5l.js";
|
|
4
|
+
import { n as v } from "./use-copy-D6JwKUll.js";
|
|
5
|
+
import { t as y } from "./createReactComponent-BqCmnqfX.js";
|
|
6
|
+
import { t as f } from "./IconCheck-D2WuculQ.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { jsx as a, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
var x = [["path", {
|
|
10
|
+
d: "M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",
|
|
11
|
+
key: "svg-0"
|
|
12
|
+
}], ["path", {
|
|
13
|
+
d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",
|
|
14
|
+
key: "svg-1"
|
|
15
|
+
}]], b = y("outline", "copy", "Copy", x), C = {
|
|
16
|
+
xs: {
|
|
17
|
+
classes: "size-6 -m-1.25 [&>svg]:size-3.5",
|
|
18
|
+
description: "Extra small — 14px icon; 24px hover wash overflows the title line"
|
|
19
|
+
},
|
|
20
|
+
sm: {
|
|
21
|
+
classes: "size-7 [&>svg]:size-4",
|
|
22
|
+
description: "Small — the default; row cells, panel headers"
|
|
23
|
+
},
|
|
24
|
+
md: {
|
|
25
|
+
classes: "size-8 [&>svg]:size-4",
|
|
26
|
+
description: "Medium — toolbars"
|
|
27
|
+
}
|
|
28
|
+
}, w = "min-w-0 truncate font-mono text-xs text-pho-primary", k = {
|
|
29
|
+
xs: "gap-1.5",
|
|
30
|
+
sm: "gap-1",
|
|
31
|
+
md: "gap-1"
|
|
32
|
+
}, N = "a, button, input, select, textarea, label";
|
|
33
|
+
function I(e) {
|
|
34
|
+
const o = e.currentTarget, s = e.target.closest(N);
|
|
35
|
+
if (s && o.contains(s)) return;
|
|
36
|
+
const t = window.getSelection();
|
|
37
|
+
t && !t.isCollapsed && o.contains(t.anchorNode) || (e.stopPropagation(), o.querySelector(":scope > [data-copy-button]")?.click());
|
|
38
|
+
}
|
|
39
|
+
function E({ value: e, children: o, label: s = "to clipboard", size: t = "sm", onCopied: p, className: l, onClick: u, ...d }) {
|
|
40
|
+
const { copied: r, copy: h } = v(), i = o != null && o !== !1 && o !== "";
|
|
41
|
+
return /* @__PURE__ */ g("span", {
|
|
42
|
+
onClick: i ? I : void 0,
|
|
43
|
+
className: n("inline-flex overflow-visible", i ? n("group/copy min-w-0 cursor-pointer items-center", k[t]) : "shrink-0"),
|
|
44
|
+
children: [
|
|
45
|
+
i ? /* @__PURE__ */ a("span", {
|
|
46
|
+
"data-copy-view": "",
|
|
47
|
+
className: w,
|
|
48
|
+
children: o
|
|
49
|
+
}) : null,
|
|
50
|
+
/* @__PURE__ */ a("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
"data-copy-button": "",
|
|
53
|
+
"aria-label": r ? `${s} copied` : `Copy ${s}`,
|
|
54
|
+
"data-copied": r || void 0,
|
|
55
|
+
onClick: async (c) => {
|
|
56
|
+
u?.(c), !c.defaultPrevented && await h(e) && p?.(e);
|
|
57
|
+
},
|
|
58
|
+
className: n("text-pho-secondary outline-pho-brand hover:bg-pho-ghost-hover hover:text-pho-secondary-hover inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-[color,background-color] duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2", "data-[copied]:text-pho-success data-[copied]:hover:text-pho-success", i && "group-hover/copy:bg-pho-ghost-hover group-hover/copy:text-pho-secondary-hover", m(C, t), l),
|
|
59
|
+
...d,
|
|
60
|
+
children: r ? /* @__PURE__ */ a(f, { "aria-hidden": !0 }) : /* @__PURE__ */ a(b, { "aria-hidden": !0 })
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ a("output", {
|
|
63
|
+
className: "sr-only",
|
|
64
|
+
"aria-live": "polite",
|
|
65
|
+
children: r ? "Copied" : ""
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
E.displayName = "CopyButton";
|
|
71
|
+
export {
|
|
72
|
+
E as n,
|
|
73
|
+
C as t
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=copy-button-CHYc_cvM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-button-CHYc_cvM.js","names":[],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconCopy.mjs","../../src/components/copy-button/copy-button.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1\", \"key\": \"svg-1\" }]];\nconst IconCopy = createReactComponent(\"outline\", \"copy\", \"Copy\", __iconNode);\n\nexport { __iconNode, IconCopy as default };\n//# sourceMappingURL=IconCopy.mjs.map\n","import {\n type ButtonHTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { IconCheck, IconCopy } from \"@tabler/icons-react\";\nimport { cn } from \"../../utils/cn\";\nimport { resolveVariant, type VariantMap } from \"../../utils/resolve-variant\";\nimport { useCopy } from \"../../utils/use-copy\";\n\n/**\n * Size axis — a square ghost control that sits inside a row or a panel\n * header. `sm` is the default: a 28px target beside 13px mono text.\n */\nexport const COPY_BUTTON_SIZES = {\n xs: {\n classes: \"size-6 -m-1.25 [&>svg]:size-3.5\",\n description:\n \"Extra small — 14px icon; 24px hover wash overflows the title line\",\n },\n sm: {\n classes: \"size-7 [&>svg]:size-4\",\n description: \"Small — the default; row cells, panel headers\",\n },\n md: {\n classes: \"size-8 [&>svg]:size-4\",\n description: \"Medium — toolbars\",\n },\n} satisfies VariantMap;\n\nexport type CopyButtonSize = keyof typeof COPY_BUTTON_SIZES;\n\ninterface CopyButtonBaseProps {\n /** The text that goes to the clipboard. */\n value: string;\n /**\n * The view of the value, before the button: anything (the id as text,\n * a masked key, a number beside its flag). A click on it copies too,\n * the way a `<label>` presses its control; the button stays the one\n * tab stop and the accessible name. The view sets a default type (the\n * mono face, `xs`, primary ink, one truncating line); what you put in\n * sets its own and wins.\n */\n children?: ReactNode;\n /**\n * What is being copied, for the accessible name — \"request id\",\n * \"API key\". Read as `Copy {label}`, then `{label} copied`.\n * @default \"to clipboard\"\n */\n label?: string;\n /** Size variant. @default \"sm\" */\n size?: CopyButtonSize;\n /** Called after the clipboard write lands. */\n onCopied?: (value: string) => void;\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport interface CopyButtonProps\n extends\n CopyButtonBaseProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CopyButtonBaseProps> {}\n\n/**\n * The view's default type: the value on one line in the mono face, the\n * loudest ink on its line. Inherited, so content with its own classes\n * overrides it.\n */\nconst VIEW = \"min-w-0 truncate font-mono text-xs text-pho-primary\";\n\n/**\n * View to button. The wash clears the view: `xs` lets its wash overflow\n * its box by 5px, so it sits a step further out.\n */\nconst VIEW_GAP: Record<CopyButtonSize, string> = {\n xs: \"gap-1.5\",\n sm: \"gap-1\",\n md: \"gap-1\",\n};\n\n/** What keeps its own click inside the view. */\nconst INTERACTIVE = \"a, button, input, select, textarea, label\";\n\n/**\n * A click on the view presses the button, so both run the same path\n * (`onClick`, the write, `onCopied`). A link in the view keeps its\n * click, and a drag that selected text is a copy by hand in progress.\n */\nfunction pressFromValue(event: MouseEvent<HTMLSpanElement>) {\n const root = event.currentTarget;\n const interactive = (event.target as Element).closest(INTERACTIVE);\n if (interactive && root.contains(interactive)) return;\n const selection = window.getSelection();\n if (\n selection &&\n !selection.isCollapsed &&\n root.contains(selection.anchorNode)\n )\n return;\n event.stopPropagation();\n root.querySelector<HTMLButtonElement>(\":scope > [data-copy-button]\")?.click();\n}\n\n/**\n * Copy Button — the one copy affordance: a quiet icon button that writes\n * `value` to the clipboard, swaps its glyph to a check for a moment, and\n * says \"Copied\" to assistive tech through a polite live region. Ghost at\n * rest so a mono value stays the loudest thing on its line; the wash and\n * the ink lift on hover. Pass a view of the value as `children` and it\n * renders before the button, a click target too; the wash lifts over\n * either.\n */\nexport function CopyButton({\n value,\n children,\n label = \"to clipboard\",\n size = \"sm\",\n onCopied,\n className,\n onClick,\n ...props\n}: CopyButtonProps) {\n const { copied, copy } = useCopy();\n const shown = children != null && children !== false && children !== \"\";\n return (\n // A pointer shortcut, like a <label>: keys and assistive tech reach\n // the button inside, which is the control.\n // oxlint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n <span\n onClick={shown ? pressFromValue : undefined}\n className={cn(\n \"inline-flex overflow-visible\",\n shown\n ? cn(\"group/copy min-w-0 cursor-pointer items-center\", VIEW_GAP[size])\n : \"shrink-0\",\n )}\n >\n {shown ? (\n <span data-copy-view=\"\" className={VIEW}>\n {children}\n </span>\n ) : null}\n <button\n type=\"button\"\n data-copy-button=\"\"\n aria-label={copied ? `${label} copied` : `Copy ${label}`}\n data-copied={copied || undefined}\n onClick={async (event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (await copy(value)) onCopied?.(value);\n }}\n className={cn(\n \"text-pho-secondary outline-pho-brand hover:bg-pho-ghost-hover hover:text-pho-secondary-hover inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-[color,background-color] duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2\",\n \"data-[copied]:text-pho-success data-[copied]:hover:text-pho-success\",\n shown &&\n \"group-hover/copy:bg-pho-ghost-hover group-hover/copy:text-pho-secondary-hover\",\n resolveVariant(COPY_BUTTON_SIZES, size),\n className,\n )}\n {...props}\n >\n {copied ? <IconCheck aria-hidden /> : <IconCopy aria-hidden />}\n </button>\n <output className=\"sr-only\" aria-live=\"polite\">\n {copied ? \"Copied\" : \"\"}\n </output>\n </span>\n );\n}\n\nCopyButton.displayName = \"CopyButton\";\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AASA,IAAM,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAoK,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAiG,KAAO;AAAQ,CAAC,CAAC,GACvV,IAAW,EAAqB,WAAW,QAAQ,QAAQ,CAAU,GCK9D,IAAoB;AAAA,EAC/B,IAAI;AAAA,IACF,SAAS;AAAA,IACT,aACE;AAAA,EACJ;AAAA,EACA,IAAI;AAAA,IACF,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,IAAI;AAAA,IACF,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AACF,GAuCM,IAAO,uDAMP,IAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAGM,IAAc;AAOpB,SAAS,EAAe,GAAoC;AAC1D,QAAM,IAAO,EAAM,eACb,IAAe,EAAM,OAAmB,QAAQ,CAAW;AACjE,MAAI,KAAe,EAAK,SAAS,CAAW,EAAG;AAC/C,QAAM,IAAY,OAAO,aAAa;AACtC,EACE,KAC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AA,IACJ;AAAA;AAEV;AAEA,EAAW,cAAc"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as s } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import { n as y } from "./copy-button-CHYc_cvM.js";
|
|
4
|
+
import { createContext as N, useContext as v } from "react";
|
|
5
|
+
import { jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
var d = N("inline"), b = {
|
|
7
|
+
1: "",
|
|
8
|
+
2: "sm:grid-cols-2",
|
|
9
|
+
3: "sm:grid-cols-3"
|
|
10
|
+
};
|
|
11
|
+
function C({ layout: e = "inline", columns: n = 1, className: o, ...a }) {
|
|
12
|
+
return /* @__PURE__ */ t(d.Provider, {
|
|
13
|
+
value: e,
|
|
14
|
+
children: /* @__PURE__ */ t("dl", {
|
|
15
|
+
"data-description-list": e,
|
|
16
|
+
className: s("m-0 grid min-w-0", e === "inline" ? "grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-x-6" : s("gap-x-6 gap-y-3", b[n]), o),
|
|
17
|
+
...a
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function L({ label: e, value: n, children: o, mono: a, copy: r, optional: x, empty: h = "Not set", className: f, ...u }) {
|
|
22
|
+
const g = v(d), i = o ?? n, l = i == null || i === "" || i === !1, c = typeof r == "string" ? r : r && typeof n == "string" ? n : null, w = typeof e == "string" ? e.toLowerCase() : "value", m = /* @__PURE__ */ t("span", {
|
|
23
|
+
className: s("min-w-0", a ? "truncate" : "font-sans text-base [overflow-wrap:anywhere] whitespace-normal"),
|
|
24
|
+
children: i
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ p("div", {
|
|
27
|
+
"data-description-item": "",
|
|
28
|
+
"data-empty": l || void 0,
|
|
29
|
+
className: s("min-w-0", g === "inline" ? "col-span-2 grid grid-cols-subgrid items-baseline py-1" : "flex flex-col gap-0.5", f),
|
|
30
|
+
...u,
|
|
31
|
+
children: [/* @__PURE__ */ p("dt", {
|
|
32
|
+
className: "text-pho-description min-w-0 text-base [overflow-wrap:anywhere]",
|
|
33
|
+
children: [e, x ? /* @__PURE__ */ t("span", {
|
|
34
|
+
className: "text-pho-placeholder",
|
|
35
|
+
children: " (Optional)"
|
|
36
|
+
}) : null]
|
|
37
|
+
}), /* @__PURE__ */ t("dd", {
|
|
38
|
+
className: s("m-0 flex min-w-0 items-center gap-1", l ? "text-pho-placeholder text-base" : a ? "text-pho-primary font-mono text-xs" : "text-pho-primary text-base"),
|
|
39
|
+
children: l ? /* @__PURE__ */ t("span", {
|
|
40
|
+
className: "truncate",
|
|
41
|
+
children: h
|
|
42
|
+
}) : c != null && c !== "" ? /* @__PURE__ */ t(y, {
|
|
43
|
+
value: c,
|
|
44
|
+
label: w,
|
|
45
|
+
size: "xs",
|
|
46
|
+
className: "-my-1",
|
|
47
|
+
children: m
|
|
48
|
+
}) : m
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var D = {
|
|
53
|
+
Root: C,
|
|
54
|
+
Item: L
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
D as t
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=description-list-SIlI9ZHs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-list-SIlI9ZHs.js","names":[],"sources":["../../src/components/description-list/description-list.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { CopyButton } from \"../copy-button\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Description List — the facts about one record, label beside value:\n * the status, the request id, the time, the ip, the api version, the\n * idempotency key, the api key. A `<dl>` under the hood.\n *\n * Where `BasicPage.Row` is a 68px row built for a control on its right,\n * these are dense lines of text: `inline` puts the label in a column\n * beside the value, every label the same width (a subgrid), one line per\n * fact; `stacked` puts the label above the value and flows the pairs\n * into `columns`. A `mono` value wears the mono face with a copy\n * control after it; a value that is not there says so in muted ink.\n */\n\nexport type DescriptionListLayout = \"inline\" | \"stacked\";\n\nconst LayoutContext = createContext<DescriptionListLayout>(\"inline\");\n\nexport interface DescriptionListRootProps extends ComponentProps<\"dl\"> {\n /**\n * `inline` (default): label column beside the value column, one line\n * per item. `stacked`: label above value, pairs flowing into `columns`.\n */\n layout?: DescriptionListLayout;\n /** For `stacked`: pairs per row from `sm` up. @default 1 */\n columns?: 1 | 2 | 3;\n ref?: Ref<HTMLDListElement>;\n}\n\nconst COLUMNS: Record<1 | 2 | 3, string> = {\n 1: \"\",\n 2: \"sm:grid-cols-2\",\n 3: \"sm:grid-cols-3\",\n};\n\nfunction Root({\n layout = \"inline\",\n columns = 1,\n className,\n ...props\n}: DescriptionListRootProps) {\n return (\n <LayoutContext.Provider value={layout}>\n <dl\n data-description-list={layout}\n className={cn(\n \"m-0 grid min-w-0\",\n layout === \"inline\"\n ? \"grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-x-6\"\n : cn(\"gap-x-6 gap-y-3\", COLUMNS[columns]),\n className,\n )}\n {...props}\n />\n </LayoutContext.Provider>\n );\n}\n\nexport interface DescriptionListItemProps extends Omit<\n ComponentProps<\"div\">,\n \"children\" | \"title\"\n> {\n /** The fact's name — \"Request ID\", \"Idempotency key\". */\n label: ReactNode;\n /** The fact. A string wears the item's type; a node is yours to style. */\n value?: ReactNode;\n /** Composed content instead of `value` — a `Badge`, a link. */\n children?: ReactNode;\n /** The value in the mono face — ids, keys, addresses. */\n mono?: boolean;\n /**\n * A copy control after the value, and a click on the value copies\n * too. `true` copies a string `value`; pass the text to copy when the\n * value is composed.\n */\n copy?: boolean | string;\n /** Marks the label `(Optional)` — a fact that may not be there. */\n optional?: boolean;\n /** What an absent value says. @default \"Not set\" */\n empty?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\nfunction Item({\n label,\n value,\n children,\n mono,\n copy,\n optional,\n empty = \"Not set\",\n className,\n ...props\n}: DescriptionListItemProps) {\n const layout = useContext(LayoutContext);\n const content = children ?? value;\n const absent = content == null || content === \"\" || content === false;\n const copyText =\n typeof copy === \"string\"\n ? copy\n : copy && typeof value === \"string\"\n ? value\n : null;\n const copyLabel = typeof label === \"string\" ? label.toLowerCase() : \"value\";\n // An id keeps its line and truncates; prose wraps, in its own face\n // over the copy view's mono default.\n const shown = (\n <span\n className={cn(\n \"min-w-0\",\n mono\n ? \"truncate\"\n : \"font-sans text-base [overflow-wrap:anywhere] whitespace-normal\",\n )}\n >\n {content}\n </span>\n );\n return (\n <div\n data-description-item=\"\"\n data-empty={absent || undefined}\n className={cn(\n \"min-w-0\",\n layout === \"inline\"\n ? \"col-span-2 grid grid-cols-subgrid items-baseline py-1\"\n : \"flex flex-col gap-0.5\",\n className,\n )}\n {...props}\n >\n <dt className=\"text-pho-description min-w-0 text-base [overflow-wrap:anywhere]\">\n {label}\n {optional ? (\n <span className=\"text-pho-placeholder\"> (Optional)</span>\n ) : null}\n </dt>\n <dd\n className={cn(\n \"m-0 flex min-w-0 items-center gap-1\",\n absent\n ? \"text-pho-placeholder text-base\"\n : mono\n ? \"text-pho-primary font-mono text-xs\"\n : \"text-pho-primary text-base\",\n )}\n >\n {absent ? (\n <span className=\"truncate\">{empty}</span>\n ) : copyText != null && copyText !== \"\" ? (\n // The value is the copy control's too: a click on it copies.\n <CopyButton\n value={copyText}\n label={copyLabel}\n size=\"xs\"\n className=\"-my-1\"\n >\n {shown}\n </CopyButton>\n ) : (\n shown\n )}\n </dd>\n </div>\n );\n}\n\n/**\n * ```tsx\n * <DescriptionList.Root>\n * <DescriptionList.Item label=\"Status\"><Badge …/></DescriptionList.Item>\n * <DescriptionList.Item label=\"Request ID\" value=\"pho_req_…\" mono copy />\n * <DescriptionList.Item label=\"Idempotency key\" optional mono copy />\n * </DescriptionList.Root>\n * ```\n */\nexport const DescriptionList = { Root, Item };\n"],"mappings":";;;;;AAyBA,IAAM,IAAgB,EAAqC,QAAQ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A,EAAC,MAAD;AAAA,MACE,WAAW,EACT,uCACA,IACI,mCACA,IACE,uCACA,4BACR;AAAA,MAEC,UAAA,IACC,gBAAA,EAAC,QAAD;AAAA,QAAM,WAAU;AAAA,QAAY,UAAA;AAAA,MAAY,CAAA,IACtC,KAAY,QAAQ,MAAa,KAEnC,gBAAA,EAAC,GAAD;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAK;AAAA,QACL,WAAU;AAAA,QAET,UAAA;AAAA,MACS,CAAA,IAEZ;AAAA,IAEA,CAAA,CACD;AAAA;AAET;AAWA,IAAa,IAAkB;AAAA,EAAE,MAAA;AAAA,EAAM,MAAA;AAAK"}
|
|
@@ -5,7 +5,7 @@ import { t as R } from "./createReactComponent-BqCmnqfX.js";
|
|
|
5
5
|
import { t as k } from "./IconCheck-D2WuculQ.js";
|
|
6
6
|
import { t as S } from "./IconSearch-BKAHkLyX.js";
|
|
7
7
|
import { t as P } from "./IconX-pZ9vrtSr.js";
|
|
8
|
-
import { i as p } from "./menu-
|
|
8
|
+
import { i as p } from "./menu-CoMrYnd1.js";
|
|
9
9
|
import { t as T } from "./box-search-C9EVZgcb.js";
|
|
10
10
|
import { useRef as A, useState as F } from "react";
|
|
11
11
|
import { Fragment as I, jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
@@ -284,4 +284,4 @@ export {
|
|
|
284
284
|
$ as t
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
-
//# sourceMappingURL=filter-bar-
|
|
287
|
+
//# sourceMappingURL=filter-bar-BCiaO1gO.js.map
|