@scalar/api-client 3.21.1 → 3.21.2

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/components/SectionFilter.vue.d.ts +0 -2
  3. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  4. package/dist/components/SectionFilter.vue.js +1 -1
  5. package/dist/components/SectionFilter.vue.js.map +1 -1
  6. package/dist/components/SectionFilter.vue.script.js +2 -8
  7. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  8. package/dist/components/SectionFilterButton.vue.d.ts +0 -1
  9. package/dist/components/SectionFilterButton.vue.d.ts.map +1 -1
  10. package/dist/components/SectionFilterButton.vue.js.map +1 -1
  11. package/dist/components/SectionFilterButton.vue.script.js +2 -10
  12. package/dist/components/SectionFilterButton.vue.script.js.map +1 -1
  13. package/dist/style.css +146 -81
  14. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  15. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  16. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  17. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +2 -0
  18. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  19. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  21. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  22. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +17 -6
  23. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  24. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +2 -0
  25. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  26. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  28. package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
  29. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +0 -2
  30. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  31. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  33. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  34. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +23 -43
  35. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  36. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +7 -0
  37. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  38. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  39. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +6 -0
  40. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  41. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  43. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +5 -5
  44. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  45. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  46. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js.map +1 -1
  47. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js +11 -1
  48. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.script.js.map +1 -1
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  50. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +1 -1
  51. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  52. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  53. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  54. package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
  55. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +13 -1
  56. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  57. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  58. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  59. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  60. package/dist/v2/components/data-table/DataTableInput.vue.script.js +7 -2
  61. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  62. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts +20 -0
  63. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
  64. package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
  65. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +36 -16
  66. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  67. package/dist/v2/components/layout/collapsible-section-heading-level.d.ts +13 -0
  68. package/dist/v2/components/layout/collapsible-section-heading-level.d.ts.map +1 -0
  69. package/dist/v2/components/layout/collapsible-section-heading-level.js +14 -0
  70. package/dist/v2/components/layout/collapsible-section-heading-level.js.map +1 -0
  71. package/dist/v2/components/layout/index.d.ts +1 -0
  72. package/dist/v2/components/layout/index.d.ts.map +1 -1
  73. package/dist/v2/components/layout/index.js +2 -1
  74. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  75. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  76. package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
  77. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +10 -1
  78. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  79. package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts +15 -2
  80. package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
  81. package/dist/v2/components/sidebar/SidebarToggle.vue.js +3 -1
  82. package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
  83. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +5 -5
  84. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
  85. package/dist/v2/constants.js +1 -1
  86. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  87. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  88. package/dist/v2/features/modal/Modal.vue.script.js +2 -1
  89. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  90. package/dist/vue-styles.css +114 -73
  91. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInputLite.vue.script.js","names":["$attrs","$slots"],"sources":["../../../../src/v2/components/code-input/CodeInputLite.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * CodeInputLite\n *\n * Single-line `contenteditable` editor that renders `{{varname}}` as atomic\n * pill spans (`contenteditable=\"false\"`) and offers an env-variable\n * autocomplete on `{{`. The value is still exposed as a `{{name}}`-bearing\n * string via `update:modelValue`; DOM ↔ model conversion lives in\n * `renderModel` and `serializeEditor`.\n */\nexport default {\n inheritAttrs: false,\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport {\n CONTEXT_FUNCTION_NAMES,\n getContextFunctionComment,\n isContextFunctionName,\n type ContextFunctionName,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { nanoid } from 'nanoid'\nimport {\n computed,\n createApp,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n useTemplateRef,\n watch,\n type App,\n} from 'vue'\n\nimport DataTableInputSelect from '@/v2/components/data-table/DataTableInputSelect.vue'\nimport EnvironmentVariableDropdown from '@/v2/features/environments/components/EnvironmentVariablesDropdown.vue'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { CodeInputModelValue } from './CodeInput.vue'\nimport { buildPillContext } from './helpers/build-pill-context'\nimport { lookupVariableValue } from './helpers/lookup-variable-value'\nimport { pillSignature } from './helpers/pill-signature'\nimport { serializeValue } from './helpers/serialize-value'\nimport PillTooltipHost from './PillTooltipHost.vue'\n\nconst {\n modelValue,\n environment,\n disabled = false,\n readOnly = false,\n error = false,\n layout = 'desktop',\n placeholder,\n required = false,\n emitOnBlur = true,\n alwaysEmitChange = false,\n withVariables = true,\n withFakeData = false,\n linethrough = false,\n type,\n enum: enumProp,\n examples,\n default: defaultProp,\n nullable = false,\n} = defineProps<Props>()\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n 'submit': [value: string, event: KeyboardEvent | FocusEvent]\n 'blur': [value: string, event: FocusEvent]\n 'navigate': [route: { page: 'document'; path: 'environment' }]\n}>()\n\nconst { translate } = useLocalization()\n\ntype Props = {\n modelValue: CodeInputModelValue\n /** Environment for variable substitution. Pass undefined to disable env vars */\n environment: XScalarEnvironment | undefined\n /** Render as a non-interactive read-only label */\n disabled?: boolean\n /** Render the input with the native `readonly` attribute (still focusable, no edits) */\n readOnly?: boolean\n /** Show error styling */\n error?: boolean\n /** Layout context affects styling and dropdown visibility */\n layout?: ClientLayout\n /** Placeholder text for an empty input */\n placeholder?: string\n /** Show required indicator */\n required?: boolean\n /** Emit submit on blur */\n emitOnBlur?: boolean\n /** Render variable pills + show the autocomplete dropdown */\n withVariables?: boolean\n /** Include `{{$guid}}` etc. in the autocomplete dropdown */\n withFakeData?: boolean\n /** Always emit change events even if the value is unchanged */\n alwaysEmitChange?: boolean\n /** Strike-through styling for the input text (e.g. overridden values) */\n linethrough?: boolean\n /** Schema type — drives boolean select mode when `boolean` is included */\n type?: string | string[]\n /** Predefined enum values; when set the input is replaced by a select */\n enum?: string[]\n /** Example values; when set (and no enum/boolean) the input is replaced by a select */\n examples?: string[]\n /** Default value to suggest in select modes */\n default?: CodeInputModelValue\n /** Whether the boolean select includes a `null` option */\n nullable?: boolean\n}\n\nconst attrs = useAttrs()\nconst ariaLabel = computed(() =>\n typeof attrs['aria-label'] === 'string' ? attrs['aria-label'] : undefined,\n)\n\n/**\n * The id only matters once the dropdown opens (`aria-controls` /\n * `aria-activedescendant`), so we defer `nanoid()` until first focus to\n * keep idle instances cheap. A consumer-supplied `id` attr is preserved.\n */\nconst generatedComponentId = ref<string | null>(null)\nconst componentId = computed((): string | undefined =>\n typeof attrs.id === 'string'\n ? attrs.id\n : (generatedComponentId.value ?? undefined),\n)\nconst ensureComponentId = (): void => {\n if (\n (typeof attrs.id !== 'string' || !attrs.id) &&\n generatedComponentId.value === null\n ) {\n generatedComponentId.value = `id-${nanoid()}`\n }\n}\n\nconst editorRef = useTemplateRef<HTMLDivElement>('editorRef')\nconst dropdownRef = ref<InstanceType<\n typeof EnvironmentVariableDropdown\n> | null>(null)\n\n/** Id of the dropdown's `role=\"listbox\"` element, for the combobox wiring. */\nconst listboxId = computed((): string | undefined =>\n componentId.value ? `${componentId.value}-listbox` : undefined,\n)\n\n/**\n * Id of the option the dropdown currently highlights. Mirrors the dropdown's\n * own selection so the editor can expose it via `aria-activedescendant`.\n */\nconst activeOptionId = computed(\n (): string | undefined => dropdownRef.value?.activeOptionId,\n)\n\nconst isFocused = ref(false)\nconst isEmpty = ref(true)\n\n/**\n * True while an IME composition is in progress. Rebuilding the editor DOM\n * mid-composition (e.g. when `{{` forms a pill) cancels the composition, so we\n * defer those rebuilds until `compositionend`.\n */\nconst isComposing = ref(false)\n\n/**\n * Whether the serialized value should count as empty for placeholder display.\n *\n * `contenteditable` can leave behind invisible residue after some delete\n * sequences — most commonly a non-breaking space (`\\u00a0`) — which makes a\n * visually empty field report a non-zero length and silently drop its\n * placeholder. Trimming covers that case; `\\u00a0` counts as whitespace, so a\n * field that only holds editor residue is treated as empty. This affects the\n * placeholder flag only, never the value emitted via `serializeEditor`.\n */\nconst isBlankValue = (text: string): boolean => text.trim().length === 0\n\n// ───────────────────────────────────────────────────────────────────\n// Rendering-mode detection (parity with CodeInput's select dispatch)\n// ───────────────────────────────────────────────────────────────────\n\n/** True when the schema type is exactly `boolean` (or includes it in a tuple type). */\nconst isBooleanMode = computed((): boolean => {\n if (enumProp?.length) {\n return false\n }\n return type === 'boolean' || (Array.isArray(type) && type.includes('boolean'))\n})\n\nconst booleanOptions = computed((): string[] =>\n nullable ? ['true', 'false', 'null'] : ['true', 'false'],\n)\n\n/** Default type when the schema is a tuple — picks the first non-null entry. */\nconst defaultType = computed((): string | undefined => {\n if (Array.isArray(type)) {\n return type.find((t) => t !== 'null') ?? 'string'\n }\n return type\n})\n\nconst handleSelectChange = (value: string): void =>\n emit('update:modelValue', value)\n\n// ───────────────────────────────────────────────────────────────────\n// Per-pill tooltip apps\n// ───────────────────────────────────────────────────────────────────\n\nlet pillTooltipApps: App[] = []\n\n/**\n * Per-pill tooltips are the heaviest part of the render (a Vue app +\n * `useTooltip` watch + listeners each), so we defer mounting them until\n * the first interaction (focus, pointerover, or dropdown open). Once on,\n * subsequent rebuilds remount tooltips for the new pills.\n */\nlet tooltipsActive = false\n\nconst teardownPillTooltips = (): void => {\n for (const app of pillTooltipApps) {\n app.unmount()\n }\n pillTooltipApps = []\n}\n\nconst mountPillTooltips = (): void => {\n if (!editorRef.value || layout === 'modal') {\n return\n }\n const pills = editorRef.value.querySelectorAll<HTMLElement>('.scalar-pill')\n for (const pillEl of pills) {\n const variableName = pillEl.dataset.variable ?? ''\n const context = buildPillContext(variableName, environment)\n const app = createApp(PillTooltipHost, {\n context,\n target: pillEl,\n translate,\n })\n // PillTooltipHost is renderless; useTooltip attaches to `target` directly.\n app.mount(document.createElement('div'))\n pillTooltipApps.push(app)\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// DOM ↔ model conversion\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Build a pill `<span>` for the given variable. `contentEditable = 'false'`\n * makes the browser treat it as a single atom (arrow keys jump over it,\n * Backspace deletes it whole); `{{` / `}}` only live in the model string.\n */\nconst createPillElement = (\n name: string,\n start: number,\n end: number,\n): HTMLSpanElement => {\n const isCtx = isContextFunctionName(name)\n const span = document.createElement('span')\n span.className = isCtx ? 'scalar-pill scalar-pill--context-fn' : 'scalar-pill'\n span.contentEditable = 'false'\n span.dataset.variable = name\n // Model-coordinate offsets (the pill stands in for the full `{{name}}`).\n // Used by click forwarding and tests to map a pill back to the value.\n span.dataset.pillStart = String(start)\n span.dataset.pillEnd = String(end)\n\n const color = isCtx\n ? 'var(--scalar-color-3)'\n : environment?.color || 'var(--scalar-color-1)'\n span.style.setProperty('--tw-bg-base', color)\n\n // Fade env pills with no usable value. A falsy check (not just\n // `=== undefined`) matches the tooltip path's `Boolean(value)`, so a\n // variable declared with an empty string fades here too.\n const isUndefinedEnv = !isCtx && !lookupVariableValue(environment, name)\n if (isUndefinedEnv) {\n span.style.opacity = '0.5'\n }\n\n span.textContent = name\n return span\n}\n\n/** Render a model string into the editor as a mix of text nodes + pills. */\nconst renderModel = (text: string): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n\n teardownPillTooltips()\n editor.replaceChildren()\n\n if (!withVariables || !text.includes('{{')) {\n if (text) {\n editor.appendChild(document.createTextNode(text))\n }\n isEmpty.value = isBlankValue(text)\n return\n }\n\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = match.index\n const end = start + match[0].length\n if (start > lastIndex) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex, start)))\n }\n editor.appendChild(createPillElement(match[1] ?? '', start, end))\n lastIndex = end\n }\n\n if (lastIndex < text.length) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex)))\n }\n\n isEmpty.value = false\n if (tooltipsActive) {\n mountPillTooltips()\n }\n}\n\n/** Length the given child contributes to the serialized model string. */\nconst modelLengthOf = (node: Node): number => {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').length\n }\n if (node instanceof HTMLElement && node.classList.contains('scalar-pill')) {\n return `{{${node.dataset.variable ?? ''}}}`.length\n }\n // Defensive: a stray element (e.g. browser-inserted <br>) — use its text.\n return (node.textContent ?? '').length\n}\n\n/** Read the editor DOM back into a `{{name}}`-bearing model string. */\nconst serializeEditor = (): string => {\n const editor = editorRef.value\n if (!editor) {\n return ''\n }\n let out = ''\n for (const node of Array.from(editor.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE) {\n out += node.textContent ?? ''\n } else if (\n node instanceof HTMLElement &&\n node.classList.contains('scalar-pill')\n ) {\n out += `{{${node.dataset.variable ?? ''}}}`\n } else if (node instanceof HTMLElement) {\n // Flatten any stray <br> / <div> the browser may inject on paste/Enter.\n out += node.textContent ?? ''\n }\n }\n return out\n}\n\nlet lastPillSignature: string | null = null\nlet lastEnvKey = ''\n\n/**\n * Cache key for the env + `withVariables` state. Includes variable\n * name/value pairs so the watcher notices adds/removes/edits even when\n * `environment.color` is unchanged — without that, pills keep stale\n * `isDefined` opacity and tooltip values until the input itself changes.\n */\nconst computeEnvKey = (): string => {\n const color = environment?.color ?? ''\n const flag = withVariables ? '1' : '0'\n const variables = environment?.variables ?? []\n let vars = ''\n for (const v of variables) {\n const value =\n typeof v.value === 'string' ? v.value : (v.value?.default ?? '')\n // Unit separators (\\x1f / \\x1e) so values can safely contain `|` or `=`.\n vars += `\\x1f${v.name}\\x1e${value}`\n }\n return `${color}|${flag}|${vars}`\n}\n\n/** Idempotent: first call flips `tooltipsActive` and mounts pill tooltips. */\nconst ensureTooltipsActive = (): void => {\n if (tooltipsActive) {\n return\n }\n tooltipsActive = true\n mountPillTooltips()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Caret ↔ model offset\n// ───────────────────────────────────────────────────────────────────\n\n/** Selection start as a model-string offset, or `null` if not inside the editor. */\nconst getModelCaret = (): number | null => {\n const editor = editorRef.value\n if (!editor) {\n return null\n }\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0) {\n return null\n }\n const range = selection.getRangeAt(0)\n if (\n range.startContainer !== editor &&\n !editor.contains(range.startContainer)\n ) {\n return null\n }\n\n // Anchored on the editor itself: `startOffset` is a child index.\n if (range.startContainer === editor) {\n let pos = 0\n for (\n let i = 0;\n i < range.startOffset && i < editor.childNodes.length;\n i++\n ) {\n pos += modelLengthOf(editor.childNodes.item(i))\n }\n return pos\n }\n\n let pos = 0\n for (const child of Array.from(editor.childNodes)) {\n if (child === range.startContainer) {\n return pos + range.startOffset\n }\n // Pills are non-editable; if a browser quirk still lands a selection\n // inside one, snap to the nearest boundary instead of getting stuck.\n if (child.contains(range.startContainer)) {\n return range.startOffset === 0 ? pos : pos + modelLengthOf(child)\n }\n pos += modelLengthOf(child)\n }\n return pos\n}\n\n/** Place the caret at the given model offset, walking the DOM to find it. */\nconst setModelCaret = (target: number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const range = document.createRange()\n let pos = 0\n let placed = false\n\n for (const child of Array.from(editor.childNodes)) {\n const len = modelLengthOf(child)\n if (pos + len >= target) {\n if (child.nodeType === Node.TEXT_NODE) {\n const into = Math.max(\n 0,\n Math.min(target - pos, (child.textContent ?? '').length),\n )\n range.setStart(child, into)\n } else if (target - pos <= 0) {\n range.setStartBefore(child)\n } else {\n range.setStartAfter(child)\n }\n placed = true\n break\n }\n pos += len\n }\n\n if (!placed) {\n range.selectNodeContents(editor)\n range.collapse(false)\n } else {\n range.collapse(true)\n }\n\n const selection = window.getSelection()\n if (!selection) {\n return\n }\n selection.removeAllRanges()\n selection.addRange(range)\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Environment variable dropdown\n// ───────────────────────────────────────────────────────────────────\n\nconst showDropdown = ref(false)\nconst dropdownQuery = ref('')\nconst dropdownPosition = ref({ left: 0, top: 0 })\n\nconst contextFunctionDropdownItems = computed(() =>\n withFakeData\n ? CONTEXT_FUNCTION_NAMES.map((key) => ({\n key,\n description: getContextFunctionComment(key as ContextFunctionName),\n }))\n : [],\n)\n\nconst displayVariablesDropdown = computed(\n (): boolean =>\n showDropdown.value &&\n withVariables &&\n layout !== 'modal' &&\n (Boolean(environment) || withFakeData),\n)\n\nconst updateDropdownVisibility = (): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const caret = getModelCaret()\n if (caret === null) {\n showDropdown.value = false\n return\n }\n const text = serializeEditor().slice(0, caret)\n const lastOpen = text.lastIndexOf('{{')\n const lastClose = text.lastIndexOf('}}')\n\n if (lastOpen <= lastClose) {\n showDropdown.value = false\n return\n }\n\n dropdownQuery.value = text.slice(lastOpen + 2)\n // Make sure the combobox has an id before it advertises `aria-expanded`, so\n // `aria-controls` always resolves to the listbox we are about to render.\n ensureComponentId()\n showDropdown.value = true\n\n // Anchor under the caret; `getBoundingClientRect` gives the caret rect in one read.\n nextTick(() => {\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0 || !editorRef.value) {\n return\n }\n const r = selection.getRangeAt(0).cloneRange()\n r.collapse(true)\n const rect = r.getBoundingClientRect()\n const editorRect = editorRef.value.getBoundingClientRect()\n // Some browsers collapse empty ranges to a zero rect — fall back to the editor edge.\n dropdownPosition.value = {\n left: rect.left || editorRect.left,\n top: rect.bottom || editorRect.bottom,\n }\n })\n}\n\nconst handleDropdownSelect = (item: string): void => {\n if (readOnly) {\n return\n }\n const caret = getModelCaret() ?? 0\n const value = serializeEditor()\n const from = Math.max(0, caret - dropdownQuery.value.length - 2)\n const to = caret\n const next = `${value.slice(0, from)}{{${item}}}${value.slice(to)}`\n const nextCursor = from + `{{${item}}}`.length\n\n // Pill set changed — force a re-render and reposition the caret.\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n setModelCaret(nextCursor)\n\n showDropdown.value = false\n emitChange(next, { skipDropdownCheck: true })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Change / focus / blur\n// ───────────────────────────────────────────────────────────────────\n\nconst emitChange = (\n value: string,\n opts: { skipDropdownCheck?: boolean } = {},\n): void => {\n const same = value === serializeValue(modelValue)\n if (alwaysEmitChange || !same) {\n emit('update:modelValue', value)\n }\n if (!opts.skipDropdownCheck) {\n updateDropdownVisibility()\n }\n}\n\nconst handleInput = (): void => {\n const text = serializeEditor()\n isEmpty.value = isBlankValue(text)\n\n // Only rebuild when the pill set changes (e.g. `}}` closed a pattern, or\n // a value was pasted). Skipping it for plain-text edits preserves the\n // live selection — important for IME composition and double-click select.\n // Also defer while composing; `handleCompositionEnd` re-runs this path so the\n // rebuild happens once the IME has committed its text.\n const sig = pillSignature(text, withVariables)\n if (!isComposing.value && sig !== lastPillSignature) {\n const caret = getModelCaret()\n lastPillSignature = sig\n renderModel(text)\n if (caret !== null) {\n setModelCaret(caret)\n }\n }\n\n emitChange(text)\n}\n\nconst handleCompositionStart = (): void => {\n isComposing.value = true\n}\n\nconst handleCompositionEnd = (): void => {\n isComposing.value = false\n // Run the deferred input path now that the composition has committed, so any\n // pill that formed during composition is rendered.\n handleInput()\n}\n\nconst handleFocus = (): void => {\n isFocused.value = true\n ensureComponentId()\n ensureTooltipsActive()\n}\n\nconst handleBlur = (event: FocusEvent): void => {\n isFocused.value = false\n showDropdown.value = false\n const value = serializeEditor()\n // Check the serialized `value`, not `modelValue` — a `0` or `false` model is\n // a valid non-empty entry that should still submit on blur.\n if (emitOnBlur && value) {\n emit('submit', value, event)\n }\n emit('blur', value, event)\n}\n\n/**\n * Strip rich content on paste; `contenteditable=\"plaintext-only\"` is not\n * reliable cross-browser, so we intercept and use `insertText` to keep undo.\n */\nconst handlePaste = (event: ClipboardEvent): void => {\n event.preventDefault()\n const text = event.clipboardData?.getData('text/plain') ?? ''\n if (!text) {\n return\n }\n document.execCommand('insertText', false, text.replace(/\\r?\\n/g, ' '))\n // `insertText` normally fires an `input` event, but that is not guaranteed\n // across browsers. Run the same path explicitly so pill rendering, emptiness,\n // `update:modelValue`, and the dropdown never lag behind the pasted DOM.\n handleInput()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Keyboard handling\n// ───────────────────────────────────────────────────────────────────\n\nconst handleKeyDown = (event: KeyboardEvent): void => {\n if (showDropdown.value) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleArrowKey(\n event.key === 'ArrowDown' ? 'down' : 'up',\n )\n return\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleSelect()\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n showDropdown.value = false\n return\n }\n }\n\n if (event.key === 'Enter') {\n // Block the browser default so a contenteditable div does not insert\n // <br> / <div> and break single-line semantics, then emit submit\n // (used by the table editors).\n event.preventDefault()\n emit('submit', serializeEditor(), event)\n return\n }\n\n // Backspace / Delete: pill atomicity is handled by the browser via\n // `contenteditable=\"false\"` on pills — no manual `}}`-pair handling needed.\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Click forwarding & lifecycle\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Clicking a pill selects it whole, so a subsequent Backspace deletes it\n * in one keystroke and typing replaces it — the usual chip/mention model.\n */\nconst handleEditorClick = (event: MouseEvent): void => {\n const target =\n event.target instanceof Element\n ? event.target.closest<HTMLElement>('.scalar-pill')\n : null\n if (!target) {\n return\n }\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n const range = document.createRange()\n range.selectNode(target)\n const selection = window.getSelection()\n selection?.removeAllRanges()\n selection?.addRange(range)\n updateDropdownVisibility()\n}\n\nonMounted(() => {\n const initial = serializeValue(modelValue)\n lastPillSignature = pillSignature(initial, withVariables)\n lastEnvKey = computeEnvKey()\n renderModel(initial)\n isEmpty.value = isBlankValue(initial)\n\n // `autofocus` on a contenteditable div is not honoured natively, so focus\n // the editor ourselves when the consumer passes the attribute.\n if (Object.hasOwn(attrs, 'autofocus')) {\n editorRef.value?.focus()\n }\n})\n\nwatch(\n () => modelValue,\n (next) => {\n const serialized = serializeValue(next)\n // Always sync the placeholder flag, even when the DOM already matches and we\n // skip the rebuild below. Otherwise a value cell that switches from select\n // mode (no editor element) into the empty editor keeps a stale `isEmpty`,\n // and the placeholder silently disappears.\n isEmpty.value = isBlankValue(serialized)\n if (serializeEditor() === serialized) {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n)\n\n// The editable surface only exists in \"editor mode\" (see template). When a row switches into editor\n// mode after mount — most notably when this component instance is reused for a different table row —\n// `onMounted` has already run and the `modelValue` watch fired while `editorRef` was still null, so\n// the model was never painted into the freshly created element and the cell renders empty.\n//\n// Paint the model when the element appears, but only into a still-empty editor: an editor that\n// already holds text is either up to date or ahead of `modelValue` with an uncommitted edit/paste,\n// and must not be clobbered.\n//\n// `flush: 'sync'` makes the paint part of the same step that creates the element. Vue assigns a\n// non-null template ref from a post-render effect, so the element is already mounted and patched\n// when this runs — deferring any further (the `pre` default, or `post`) only pushes the paint past\n// the consumer effects that run later in the same flush. A parent that focuses the cell as it\n// switches into editor mode would then place the caret in a still-empty editor, and the paint's\n// `replaceChildren` would drop that selection.\nwatch(\n editorRef,\n (editor) => {\n if (!editor || !isBlankValue(serializeEditor())) {\n return\n }\n const serialized = serializeValue(modelValue)\n if (serialized === '') {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n { flush: 'sync' },\n)\n\nwatch(\n [() => environment, () => withVariables],\n () => {\n // Env changes affect pill colour and `isDefined` opacity — rebuild.\n const envKey = computeEnvKey()\n if (envKey === lastEnvKey) {\n return\n }\n lastEnvKey = envKey\n // Most rows are plain text; skip the DOM walk when there are no pills.\n // Pills introduced later flow through `handleInput` / the modelValue\n // watcher, which update `lastPillSignature`.\n if (lastPillSignature === '') {\n return\n }\n lastPillSignature = pillSignature(serializeEditor(), withVariables)\n // Preserve the caret across the rebuild so editing does not jump to the\n // start when the environment changes mid-edit (mirrors `handleInput`).\n const caret = getModelCaret()\n renderModel(serializeEditor())\n if (caret !== null) {\n setModelCaret(caret)\n }\n },\n // Variables are often mutated in place (e.g. editing a value in the env\n // editor) without the object reference changing — deep watch catches it.\n { deep: true },\n)\n\nonBeforeUnmount(() => {\n teardownPillTooltips()\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Public API\n// ───────────────────────────────────────────────────────────────────\n\ndefineExpose({\n /** Focus the editor. `position` controls caret placement. */\n focus: (position?: 'start' | 'end' | number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n if (!isDefined(position)) {\n return\n }\n const length = serializeEditor().length\n const pos =\n position === 'start' ? 0 : position === 'end' ? length : position\n setModelCaret(pos)\n },\n /** Replace the current value programmatically and re-render the pills. */\n setContent: (next = ''): void => {\n if (serializeEditor() === next) {\n return\n }\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n isEmpty.value = isBlankValue(next)\n },\n /** Read the current value as a `{{name}}`-bearing string. */\n getValue: (): string => serializeEditor(),\n /** Caret offset in the model string. */\n cursorPosition: (): number | undefined => {\n const c = getModelCaret()\n return c === null ? undefined : c\n },\n isFocused,\n editorRef,\n})\n</script>\n\n<template>\n <!-- Disabled mode: read-only label -->\n <div\n v-if=\"disabled\"\n class=\"text-c-2 flex cursor-default items-center justify-center\"\n :class=\"{\n 'font-code pr-2 pl-1 text-base': layout === 'modal',\n 'px-2': layout !== 'modal',\n 'line-through': linethrough,\n }\"\n data-testid=\"code-input-lite-disabled\">\n <span class=\"whitespace-nowrap\">{{ modelValue }}</span>\n </div>\n\n <!-- Enum mode: select dropdown with predefined values -->\n <DataTableInputSelect\n v-else-if=\"enumProp?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :type=\"defaultType\"\n :value=\"enumProp\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Boolean mode: select dropdown with true/false (and optionally null) -->\n <DataTableInputSelect\n v-else-if=\"isBooleanMode\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"booleanOptions\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Examples mode: select dropdown with example values -->\n <DataTableInputSelect\n v-else-if=\"examples?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"examples\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Editor mode -->\n <div\n v-else\n :id=\"componentId\"\n v-bind=\"$attrs\"\n class=\"code-input-lite group/code-input-lite peer relative w-full leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline\"\n :class=\"{\n 'code-input-lite--error': error,\n 'code-input-lite--empty': isEmpty,\n 'line-through': linethrough,\n }\">\n <!-- The single editable surface; see the file header for how pills work. -->\n <div\n ref=\"editorRef\"\n :aria-activedescendant=\"\n displayVariablesDropdown ? activeOptionId : undefined\n \"\n :aria-autocomplete=\"withVariables ? 'list' : undefined\"\n :aria-controls=\"displayVariablesDropdown ? listboxId : undefined\"\n :aria-expanded=\"displayVariablesDropdown ? 'true' : undefined\"\n :aria-invalid=\"error ? 'true' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-readonly=\"readOnly ? 'true' : undefined\"\n :aria-required=\"required ? 'true' : undefined\"\n class=\"code-input-lite__editor\"\n :contenteditable=\"readOnly ? 'false' : 'true'\"\n :data-placeholder=\"placeholder\"\n :role=\"withVariables ? 'combobox' : 'textbox'\"\n spellcheck=\"false\"\n @blur=\"handleBlur\"\n @click=\"handleEditorClick\"\n @compositionend=\"handleCompositionEnd\"\n @compositionstart=\"handleCompositionStart\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @keydown=\"handleKeyDown\"\n @paste=\"handlePaste\"\n @pointerover=\"ensureTooltipsActive\" />\n </div>\n\n <!--\n Slots and the required indicator are siblings of the mode templates so\n they render in every mode and so `absolute right-0` anchors to the\n surrounding (relative) cell rather than the shrink-wrapped mode wrapper.\n -->\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <div\n v-if=\"$slots.icon\"\n class=\"centered-y absolute right-0 flex h-full items-center p-1.5 group-has-[.code-input-lite__editor:focus]:z-1\">\n <slot name=\"icon\" />\n </div>\n <div\n v-if=\"required\"\n class=\"required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 mr-0.5 pt-px pr-2 opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 peer-has-[.code-input-lite__editor:focus]:opacity-0\">\n {{ translate('apiClient.codeInputLite.required') }}\n </div>\n\n <EnvironmentVariableDropdown\n v-if=\"displayVariablesDropdown\"\n ref=\"dropdownRef\"\n :contextFunctionItems=\"contextFunctionDropdownItems\"\n :dropdownPosition=\"dropdownPosition\"\n :environment=\"environment\"\n :listboxId=\"listboxId\"\n :query=\"dropdownQuery\"\n @close=\"showDropdown = false\"\n @redirect=\"emit('navigate', { page: 'document', path: 'environment' })\"\n @select=\"handleDropdownSelect\" />\n</template>\n\n<style scoped>\n.code-input-lite {\n /* Flex so the editor centres vertically in whatever height the cell gives us.\n Font properties inherit so we adopt the surrounding typography. */\n display: flex;\n align-items: center;\n}\n\n.code-input-lite__editor {\n /* Everything font-related inherits from the surrounding context. */\n font: inherit;\n letter-spacing: inherit;\n flex: 1;\n min-width: 0;\n background: transparent;\n outline: none;\n color: var(--scalar-color-1);\n caret-color: var(--scalar-color-1);\n /* Single-line: horizontal scroll keeps the caret visible for long values;\n the scrollbar itself is hidden (would be noisy inside a table cell). */\n white-space: pre;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n padding: 0 0.5em;\n box-sizing: border-box;\n line-height: 1.44;\n /* Positioning context for the absolutely positioned placeholder. */\n position: relative;\n}\n\n.code-input-lite__editor::-webkit-scrollbar {\n display: none;\n}\n\n/* Absolute so the placeholder does not occupy flow space inside the\n contenteditable; otherwise the caret would land after it on focus.\n `pointer-events: none` lets clicks fall through to focus the editor.\n Hidden on focus so it never renders on top of the text caret. */\n.code-input-lite--empty .code-input-lite__editor:not(:focus)::before {\n content: attr(data-placeholder);\n color: var(--scalar-color-3);\n pointer-events: none;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0.5em;\n display: flex;\n align-items: center;\n}\n\n.code-input-lite--error .code-input-lite__editor {\n outline: 1px solid var(--scalar-color-red);\n}\n</style>\n\n<style>\n/* Pill styling. Each pill is `<span contenteditable=\"false\">name</span>` —\n an atomic widget; the caret lands before or after it, never inside. */\n.scalar-pill {\n color: var(--scalar-color-2);\n border-radius: var(--scalar-radius-full);\n display: inline-block;\n font-family: var(--scalar-font-code);\n font-size: 0.9em;\n line-height: 1.4;\n vertical-align: baseline;\n background: var(--scalar-background-3);\n padding: 0.125em 0.6em;\n margin-right: 0.35em;\n cursor: text;\n /* Single click selects the whole pill — chip/mention model, deletes in one go. */\n user-select: all;\n -webkit-user-select: all;\n}\n\n.dark-mode .scalar-pill {\n background: color-mix(\n in srgb,\n var(--tw-bg-base, var(--scalar-color-1)),\n transparent 90%\n );\n}\n\n.light-mode .scalar-pill {\n background: var(--scalar-background-3);\n}\n\n.scalar-pill--context-fn {\n /* Inset box-shadow as a border so the layout box stays identical to plain pills. */\n box-shadow: 0 0 0 1px\n color-mix(in srgb, var(--scalar-color-3), transparent 35%) inset;\n}\n\n.dark-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 55%);\n}\n\n.light-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 40%);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWE,cAAc;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AA,KAAA,mBAAA,IAAA,IAAA;IAIN,yBAAA,SAAA,UAAA,GADR,YAUmC,sCAAA;;cAR7B;KAAJ,KAAI;KACH,sBAAsB,6BAAA;KACtB,kBAAkB,iBAAA;KAClB,aAAa,QAAA;KACb,WAAW,UAAA;KACX,OAAO,cAAA;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,aAAA,QAAY;KACnB,YAAQ,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,YAAA;MAAA,MAAA;MAAA,MAAA;KAAA,CAAA;KACd,UAAQ"}
1
+ {"version":3,"file":"CodeInputLite.vue.script.js","names":["$slots"],"sources":["../../../../src/v2/components/code-input/CodeInputLite.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * CodeInputLite\n *\n * Single-line `contenteditable` editor that renders `{{varname}}` as atomic\n * pill spans (`contenteditable=\"false\"`) and offers an env-variable\n * autocomplete on `{{`. The value is still exposed as a `{{name}}`-bearing\n * string via `update:modelValue`; DOM ↔ model conversion lives in\n * `renderModel` and `serializeEditor`.\n */\nexport default {\n inheritAttrs: false,\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport {\n CONTEXT_FUNCTION_NAMES,\n getContextFunctionComment,\n isContextFunctionName,\n type ContextFunctionName,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { nanoid } from 'nanoid'\nimport {\n computed,\n createApp,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n useTemplateRef,\n watch,\n type App,\n} from 'vue'\n\nimport DataTableInputSelect from '@/v2/components/data-table/DataTableInputSelect.vue'\nimport EnvironmentVariableDropdown from '@/v2/features/environments/components/EnvironmentVariablesDropdown.vue'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { CodeInputModelValue } from './CodeInput.vue'\nimport { buildPillContext } from './helpers/build-pill-context'\nimport { lookupVariableValue } from './helpers/lookup-variable-value'\nimport { pillSignature } from './helpers/pill-signature'\nimport { serializeValue } from './helpers/serialize-value'\nimport PillTooltipHost from './PillTooltipHost.vue'\n\nconst {\n modelValue,\n environment,\n disabled = false,\n readOnly = false,\n error = false,\n layout = 'desktop',\n placeholder,\n required = false,\n emitOnBlur = true,\n alwaysEmitChange = false,\n withVariables = true,\n withFakeData = false,\n linethrough = false,\n type,\n enum: enumProp,\n examples,\n default: defaultProp,\n nullable = false,\n} = defineProps<Props>()\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n 'submit': [value: string, event: KeyboardEvent | FocusEvent]\n 'blur': [value: string, event: FocusEvent]\n 'navigate': [route: { page: 'document'; path: 'environment' }]\n}>()\n\nconst { translate } = useLocalization()\n\ntype Props = {\n modelValue: CodeInputModelValue\n /** Environment for variable substitution. Pass undefined to disable env vars */\n environment: XScalarEnvironment | undefined\n /** Render as a non-interactive read-only label */\n disabled?: boolean\n /** Render the input with the native `readonly` attribute (still focusable, no edits) */\n readOnly?: boolean\n /** Show error styling */\n error?: boolean\n /** Layout context affects styling and dropdown visibility */\n layout?: ClientLayout\n /** Placeholder text for an empty input */\n placeholder?: string\n /** Show required indicator */\n required?: boolean\n /** Emit submit on blur */\n emitOnBlur?: boolean\n /** Render variable pills + show the autocomplete dropdown */\n withVariables?: boolean\n /** Include `{{$guid}}` etc. in the autocomplete dropdown */\n withFakeData?: boolean\n /** Always emit change events even if the value is unchanged */\n alwaysEmitChange?: boolean\n /** Strike-through styling for the input text (e.g. overridden values) */\n linethrough?: boolean\n /** Schema type — drives boolean select mode when `boolean` is included */\n type?: string | string[]\n /** Predefined enum values; when set the input is replaced by a select */\n enum?: string[]\n /** Example values; when set (and no enum/boolean) the input is replaced by a select */\n examples?: string[]\n /** Default value to suggest in select modes */\n default?: CodeInputModelValue\n /** Whether the boolean select includes a `null` option */\n nullable?: boolean\n}\n\nconst attrs = useAttrs()\nconst ariaLabel = computed(() =>\n typeof attrs['aria-label'] === 'string' ? attrs['aria-label'] : undefined,\n)\n/** Lifted to the editable surface like aria-label, so a visible label can name it */\nconst ariaLabelledby = computed(() =>\n typeof attrs['aria-labelledby'] === 'string'\n ? attrs['aria-labelledby']\n : undefined,\n)\n/**\n * The wrapper is a generic div, and ARIA prohibits naming a generic element,\n * so the naming attributes only go on the editor and not on the wrapper.\n */\nconst wrapperAttrs = computed(() => {\n const {\n 'aria-label': _ariaLabel,\n 'aria-labelledby': _ariaLabelledby,\n ...rest\n } = attrs\n return rest\n})\n\n/**\n * The id only matters once the dropdown opens (`aria-controls` /\n * `aria-activedescendant`), so we defer `nanoid()` until first focus to\n * keep idle instances cheap. A consumer-supplied `id` attr is preserved.\n */\nconst generatedComponentId = ref<string | null>(null)\nconst componentId = computed((): string | undefined =>\n typeof attrs.id === 'string'\n ? attrs.id\n : (generatedComponentId.value ?? undefined),\n)\nconst ensureComponentId = (): void => {\n if (\n (typeof attrs.id !== 'string' || !attrs.id) &&\n generatedComponentId.value === null\n ) {\n generatedComponentId.value = `id-${nanoid()}`\n }\n}\n\nconst editorRef = useTemplateRef<HTMLDivElement>('editorRef')\nconst dropdownRef = ref<InstanceType<\n typeof EnvironmentVariableDropdown\n> | null>(null)\n\n/** Id of the dropdown's `role=\"listbox\"` element, for the combobox wiring. */\nconst listboxId = computed((): string | undefined =>\n componentId.value ? `${componentId.value}-listbox` : undefined,\n)\n\n/**\n * Id of the option the dropdown currently highlights. Mirrors the dropdown's\n * own selection so the editor can expose it via `aria-activedescendant`.\n */\nconst activeOptionId = computed(\n (): string | undefined => dropdownRef.value?.activeOptionId,\n)\n\nconst isFocused = ref(false)\nconst isEmpty = ref(true)\n\n/**\n * True while an IME composition is in progress. Rebuilding the editor DOM\n * mid-composition (e.g. when `{{` forms a pill) cancels the composition, so we\n * defer those rebuilds until `compositionend`.\n */\nconst isComposing = ref(false)\n\n/**\n * Whether the serialized value should count as empty for placeholder display.\n *\n * `contenteditable` can leave behind invisible residue after some delete\n * sequences — most commonly a non-breaking space (`\\u00a0`) — which makes a\n * visually empty field report a non-zero length and silently drop its\n * placeholder. Trimming covers that case; `\\u00a0` counts as whitespace, so a\n * field that only holds editor residue is treated as empty. This affects the\n * placeholder flag only, never the value emitted via `serializeEditor`.\n */\nconst isBlankValue = (text: string): boolean => text.trim().length === 0\n\n// ───────────────────────────────────────────────────────────────────\n// Rendering-mode detection (parity with CodeInput's select dispatch)\n// ───────────────────────────────────────────────────────────────────\n\n/** True when the schema type is exactly `boolean` (or includes it in a tuple type). */\nconst isBooleanMode = computed((): boolean => {\n if (enumProp?.length) {\n return false\n }\n return type === 'boolean' || (Array.isArray(type) && type.includes('boolean'))\n})\n\nconst booleanOptions = computed((): string[] =>\n nullable ? ['true', 'false', 'null'] : ['true', 'false'],\n)\n\n/** Default type when the schema is a tuple — picks the first non-null entry. */\nconst defaultType = computed((): string | undefined => {\n if (Array.isArray(type)) {\n return type.find((t) => t !== 'null') ?? 'string'\n }\n return type\n})\n\nconst handleSelectChange = (value: string): void =>\n emit('update:modelValue', value)\n\n// ───────────────────────────────────────────────────────────────────\n// Per-pill tooltip apps\n// ───────────────────────────────────────────────────────────────────\n\nlet pillTooltipApps: App[] = []\n\n/**\n * Per-pill tooltips are the heaviest part of the render (a Vue app +\n * `useTooltip` watch + listeners each), so we defer mounting them until\n * the first interaction (focus, pointerover, or dropdown open). Once on,\n * subsequent rebuilds remount tooltips for the new pills.\n */\nlet tooltipsActive = false\n\nconst teardownPillTooltips = (): void => {\n for (const app of pillTooltipApps) {\n app.unmount()\n }\n pillTooltipApps = []\n}\n\nconst mountPillTooltips = (): void => {\n if (!editorRef.value || layout === 'modal') {\n return\n }\n const pills = editorRef.value.querySelectorAll<HTMLElement>('.scalar-pill')\n for (const pillEl of pills) {\n const variableName = pillEl.dataset.variable ?? ''\n const context = buildPillContext(variableName, environment)\n const app = createApp(PillTooltipHost, {\n context,\n target: pillEl,\n translate,\n })\n // PillTooltipHost is renderless; useTooltip attaches to `target` directly.\n app.mount(document.createElement('div'))\n pillTooltipApps.push(app)\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// DOM ↔ model conversion\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Build a pill `<span>` for the given variable. `contentEditable = 'false'`\n * makes the browser treat it as a single atom (arrow keys jump over it,\n * Backspace deletes it whole); `{{` / `}}` only live in the model string.\n */\nconst createPillElement = (\n name: string,\n start: number,\n end: number,\n): HTMLSpanElement => {\n const isCtx = isContextFunctionName(name)\n const span = document.createElement('span')\n span.className = isCtx ? 'scalar-pill scalar-pill--context-fn' : 'scalar-pill'\n span.contentEditable = 'false'\n span.dataset.variable = name\n // Model-coordinate offsets (the pill stands in for the full `{{name}}`).\n // Used by click forwarding and tests to map a pill back to the value.\n span.dataset.pillStart = String(start)\n span.dataset.pillEnd = String(end)\n\n const color = isCtx\n ? 'var(--scalar-color-3)'\n : environment?.color || 'var(--scalar-color-1)'\n span.style.setProperty('--tw-bg-base', color)\n\n // Fade env pills with no usable value. A falsy check (not just\n // `=== undefined`) matches the tooltip path's `Boolean(value)`, so a\n // variable declared with an empty string fades here too.\n const isUndefinedEnv = !isCtx && !lookupVariableValue(environment, name)\n if (isUndefinedEnv) {\n span.style.opacity = '0.5'\n }\n\n span.textContent = name\n return span\n}\n\n/** Render a model string into the editor as a mix of text nodes + pills. */\nconst renderModel = (text: string): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n\n teardownPillTooltips()\n editor.replaceChildren()\n\n if (!withVariables || !text.includes('{{')) {\n if (text) {\n editor.appendChild(document.createTextNode(text))\n }\n isEmpty.value = isBlankValue(text)\n return\n }\n\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = match.index\n const end = start + match[0].length\n if (start > lastIndex) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex, start)))\n }\n editor.appendChild(createPillElement(match[1] ?? '', start, end))\n lastIndex = end\n }\n\n if (lastIndex < text.length) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex)))\n }\n\n isEmpty.value = false\n if (tooltipsActive) {\n mountPillTooltips()\n }\n}\n\n/** Length the given child contributes to the serialized model string. */\nconst modelLengthOf = (node: Node): number => {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').length\n }\n if (node instanceof HTMLElement && node.classList.contains('scalar-pill')) {\n return `{{${node.dataset.variable ?? ''}}}`.length\n }\n // Defensive: a stray element (e.g. browser-inserted <br>) — use its text.\n return (node.textContent ?? '').length\n}\n\n/** Read the editor DOM back into a `{{name}}`-bearing model string. */\nconst serializeEditor = (): string => {\n const editor = editorRef.value\n if (!editor) {\n return ''\n }\n let out = ''\n for (const node of Array.from(editor.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE) {\n out += node.textContent ?? ''\n } else if (\n node instanceof HTMLElement &&\n node.classList.contains('scalar-pill')\n ) {\n out += `{{${node.dataset.variable ?? ''}}}`\n } else if (node instanceof HTMLElement) {\n // Flatten any stray <br> / <div> the browser may inject on paste/Enter.\n out += node.textContent ?? ''\n }\n }\n return out\n}\n\nlet lastPillSignature: string | null = null\nlet lastEnvKey = ''\n\n/**\n * Cache key for the env + `withVariables` state. Includes variable\n * name/value pairs so the watcher notices adds/removes/edits even when\n * `environment.color` is unchanged — without that, pills keep stale\n * `isDefined` opacity and tooltip values until the input itself changes.\n */\nconst computeEnvKey = (): string => {\n const color = environment?.color ?? ''\n const flag = withVariables ? '1' : '0'\n const variables = environment?.variables ?? []\n let vars = ''\n for (const v of variables) {\n const value =\n typeof v.value === 'string' ? v.value : (v.value?.default ?? '')\n // Unit separators (\\x1f / \\x1e) so values can safely contain `|` or `=`.\n vars += `\\x1f${v.name}\\x1e${value}`\n }\n return `${color}|${flag}|${vars}`\n}\n\n/** Idempotent: first call flips `tooltipsActive` and mounts pill tooltips. */\nconst ensureTooltipsActive = (): void => {\n if (tooltipsActive) {\n return\n }\n tooltipsActive = true\n mountPillTooltips()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Caret ↔ model offset\n// ───────────────────────────────────────────────────────────────────\n\n/** Selection start as a model-string offset, or `null` if not inside the editor. */\nconst getModelCaret = (): number | null => {\n const editor = editorRef.value\n if (!editor) {\n return null\n }\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0) {\n return null\n }\n const range = selection.getRangeAt(0)\n if (\n range.startContainer !== editor &&\n !editor.contains(range.startContainer)\n ) {\n return null\n }\n\n // Anchored on the editor itself: `startOffset` is a child index.\n if (range.startContainer === editor) {\n let pos = 0\n for (\n let i = 0;\n i < range.startOffset && i < editor.childNodes.length;\n i++\n ) {\n pos += modelLengthOf(editor.childNodes.item(i))\n }\n return pos\n }\n\n let pos = 0\n for (const child of Array.from(editor.childNodes)) {\n if (child === range.startContainer) {\n return pos + range.startOffset\n }\n // Pills are non-editable; if a browser quirk still lands a selection\n // inside one, snap to the nearest boundary instead of getting stuck.\n if (child.contains(range.startContainer)) {\n return range.startOffset === 0 ? pos : pos + modelLengthOf(child)\n }\n pos += modelLengthOf(child)\n }\n return pos\n}\n\n/** Place the caret at the given model offset, walking the DOM to find it. */\nconst setModelCaret = (target: number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const range = document.createRange()\n let pos = 0\n let placed = false\n\n for (const child of Array.from(editor.childNodes)) {\n const len = modelLengthOf(child)\n if (pos + len >= target) {\n if (child.nodeType === Node.TEXT_NODE) {\n const into = Math.max(\n 0,\n Math.min(target - pos, (child.textContent ?? '').length),\n )\n range.setStart(child, into)\n } else if (target - pos <= 0) {\n range.setStartBefore(child)\n } else {\n range.setStartAfter(child)\n }\n placed = true\n break\n }\n pos += len\n }\n\n if (!placed) {\n range.selectNodeContents(editor)\n range.collapse(false)\n } else {\n range.collapse(true)\n }\n\n const selection = window.getSelection()\n if (!selection) {\n return\n }\n selection.removeAllRanges()\n selection.addRange(range)\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Environment variable dropdown\n// ───────────────────────────────────────────────────────────────────\n\nconst showDropdown = ref(false)\nconst dropdownQuery = ref('')\nconst dropdownPosition = ref({ left: 0, top: 0 })\n\nconst contextFunctionDropdownItems = computed(() =>\n withFakeData\n ? CONTEXT_FUNCTION_NAMES.map((key) => ({\n key,\n description: getContextFunctionComment(key as ContextFunctionName),\n }))\n : [],\n)\n\nconst displayVariablesDropdown = computed(\n (): boolean =>\n showDropdown.value &&\n withVariables &&\n layout !== 'modal' &&\n (Boolean(environment) || withFakeData),\n)\n\nconst updateDropdownVisibility = (): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const caret = getModelCaret()\n if (caret === null) {\n showDropdown.value = false\n return\n }\n const text = serializeEditor().slice(0, caret)\n const lastOpen = text.lastIndexOf('{{')\n const lastClose = text.lastIndexOf('}}')\n\n if (lastOpen <= lastClose) {\n showDropdown.value = false\n return\n }\n\n dropdownQuery.value = text.slice(lastOpen + 2)\n // Make sure the combobox has an id before it advertises `aria-expanded`, so\n // `aria-controls` always resolves to the listbox we are about to render.\n ensureComponentId()\n showDropdown.value = true\n\n // Anchor under the caret; `getBoundingClientRect` gives the caret rect in one read.\n nextTick(() => {\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0 || !editorRef.value) {\n return\n }\n const r = selection.getRangeAt(0).cloneRange()\n r.collapse(true)\n const rect = r.getBoundingClientRect()\n const editorRect = editorRef.value.getBoundingClientRect()\n // Some browsers collapse empty ranges to a zero rect — fall back to the editor edge.\n dropdownPosition.value = {\n left: rect.left || editorRect.left,\n top: rect.bottom || editorRect.bottom,\n }\n })\n}\n\nconst handleDropdownSelect = (item: string): void => {\n if (readOnly) {\n return\n }\n const caret = getModelCaret() ?? 0\n const value = serializeEditor()\n const from = Math.max(0, caret - dropdownQuery.value.length - 2)\n const to = caret\n const next = `${value.slice(0, from)}{{${item}}}${value.slice(to)}`\n const nextCursor = from + `{{${item}}}`.length\n\n // Pill set changed — force a re-render and reposition the caret.\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n setModelCaret(nextCursor)\n\n showDropdown.value = false\n emitChange(next, { skipDropdownCheck: true })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Change / focus / blur\n// ───────────────────────────────────────────────────────────────────\n\nconst emitChange = (\n value: string,\n opts: { skipDropdownCheck?: boolean } = {},\n): void => {\n const same = value === serializeValue(modelValue)\n if (alwaysEmitChange || !same) {\n emit('update:modelValue', value)\n }\n if (!opts.skipDropdownCheck) {\n updateDropdownVisibility()\n }\n}\n\nconst handleInput = (): void => {\n const text = serializeEditor()\n isEmpty.value = isBlankValue(text)\n\n // Only rebuild when the pill set changes (e.g. `}}` closed a pattern, or\n // a value was pasted). Skipping it for plain-text edits preserves the\n // live selection — important for IME composition and double-click select.\n // Also defer while composing; `handleCompositionEnd` re-runs this path so the\n // rebuild happens once the IME has committed its text.\n const sig = pillSignature(text, withVariables)\n if (!isComposing.value && sig !== lastPillSignature) {\n const caret = getModelCaret()\n lastPillSignature = sig\n renderModel(text)\n if (caret !== null) {\n setModelCaret(caret)\n }\n }\n\n emitChange(text)\n}\n\nconst handleCompositionStart = (): void => {\n isComposing.value = true\n}\n\nconst handleCompositionEnd = (): void => {\n isComposing.value = false\n // Run the deferred input path now that the composition has committed, so any\n // pill that formed during composition is rendered.\n handleInput()\n}\n\nconst handleFocus = (): void => {\n isFocused.value = true\n ensureComponentId()\n ensureTooltipsActive()\n}\n\nconst handleBlur = (event: FocusEvent): void => {\n isFocused.value = false\n showDropdown.value = false\n const value = serializeEditor()\n // Check the serialized `value`, not `modelValue` — a `0` or `false` model is\n // a valid non-empty entry that should still submit on blur.\n if (emitOnBlur && value) {\n emit('submit', value, event)\n }\n emit('blur', value, event)\n}\n\n/**\n * Strip rich content on paste; `contenteditable=\"plaintext-only\"` is not\n * reliable cross-browser, so we intercept and use `insertText` to keep undo.\n */\nconst handlePaste = (event: ClipboardEvent): void => {\n event.preventDefault()\n const text = event.clipboardData?.getData('text/plain') ?? ''\n if (!text) {\n return\n }\n document.execCommand('insertText', false, text.replace(/\\r?\\n/g, ' '))\n // `insertText` normally fires an `input` event, but that is not guaranteed\n // across browsers. Run the same path explicitly so pill rendering, emptiness,\n // `update:modelValue`, and the dropdown never lag behind the pasted DOM.\n handleInput()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Keyboard handling\n// ───────────────────────────────────────────────────────────────────\n\nconst handleKeyDown = (event: KeyboardEvent): void => {\n if (showDropdown.value) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleArrowKey(\n event.key === 'ArrowDown' ? 'down' : 'up',\n )\n return\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleSelect()\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n showDropdown.value = false\n return\n }\n }\n\n if (event.key === 'Enter') {\n // Block the browser default so a contenteditable div does not insert\n // <br> / <div> and break single-line semantics, then emit submit\n // (used by the table editors).\n event.preventDefault()\n emit('submit', serializeEditor(), event)\n return\n }\n\n // Backspace / Delete: pill atomicity is handled by the browser via\n // `contenteditable=\"false\"` on pills — no manual `}}`-pair handling needed.\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Click forwarding & lifecycle\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Clicking a pill selects it whole, so a subsequent Backspace deletes it\n * in one keystroke and typing replaces it — the usual chip/mention model.\n */\nconst handleEditorClick = (event: MouseEvent): void => {\n const target =\n event.target instanceof Element\n ? event.target.closest<HTMLElement>('.scalar-pill')\n : null\n if (!target) {\n return\n }\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n const range = document.createRange()\n range.selectNode(target)\n const selection = window.getSelection()\n selection?.removeAllRanges()\n selection?.addRange(range)\n updateDropdownVisibility()\n}\n\nonMounted(() => {\n const initial = serializeValue(modelValue)\n lastPillSignature = pillSignature(initial, withVariables)\n lastEnvKey = computeEnvKey()\n renderModel(initial)\n isEmpty.value = isBlankValue(initial)\n\n // `autofocus` on a contenteditable div is not honoured natively, so focus\n // the editor ourselves when the consumer passes the attribute.\n if (Object.hasOwn(attrs, 'autofocus')) {\n editorRef.value?.focus()\n }\n})\n\nwatch(\n () => modelValue,\n (next) => {\n const serialized = serializeValue(next)\n // Always sync the placeholder flag, even when the DOM already matches and we\n // skip the rebuild below. Otherwise a value cell that switches from select\n // mode (no editor element) into the empty editor keeps a stale `isEmpty`,\n // and the placeholder silently disappears.\n isEmpty.value = isBlankValue(serialized)\n if (serializeEditor() === serialized) {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n)\n\n// The editable surface only exists in \"editor mode\" (see template). When a row switches into editor\n// mode after mount — most notably when this component instance is reused for a different table row —\n// `onMounted` has already run and the `modelValue` watch fired while `editorRef` was still null, so\n// the model was never painted into the freshly created element and the cell renders empty.\n//\n// Paint the model when the element appears, but only into a still-empty editor: an editor that\n// already holds text is either up to date or ahead of `modelValue` with an uncommitted edit/paste,\n// and must not be clobbered.\n//\n// `flush: 'sync'` makes the paint part of the same step that creates the element. Vue assigns a\n// non-null template ref from a post-render effect, so the element is already mounted and patched\n// when this runs — deferring any further (the `pre` default, or `post`) only pushes the paint past\n// the consumer effects that run later in the same flush. A parent that focuses the cell as it\n// switches into editor mode would then place the caret in a still-empty editor, and the paint's\n// `replaceChildren` would drop that selection.\nwatch(\n editorRef,\n (editor) => {\n if (!editor || !isBlankValue(serializeEditor())) {\n return\n }\n const serialized = serializeValue(modelValue)\n if (serialized === '') {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n { flush: 'sync' },\n)\n\nwatch(\n [() => environment, () => withVariables],\n () => {\n // Env changes affect pill colour and `isDefined` opacity — rebuild.\n const envKey = computeEnvKey()\n if (envKey === lastEnvKey) {\n return\n }\n lastEnvKey = envKey\n // Most rows are plain text; skip the DOM walk when there are no pills.\n // Pills introduced later flow through `handleInput` / the modelValue\n // watcher, which update `lastPillSignature`.\n if (lastPillSignature === '') {\n return\n }\n lastPillSignature = pillSignature(serializeEditor(), withVariables)\n // Preserve the caret across the rebuild so editing does not jump to the\n // start when the environment changes mid-edit (mirrors `handleInput`).\n const caret = getModelCaret()\n renderModel(serializeEditor())\n if (caret !== null) {\n setModelCaret(caret)\n }\n },\n // Variables are often mutated in place (e.g. editing a value in the env\n // editor) without the object reference changing — deep watch catches it.\n { deep: true },\n)\n\nonBeforeUnmount(() => {\n teardownPillTooltips()\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Public API\n// ───────────────────────────────────────────────────────────────────\n\ndefineExpose({\n /** Focus the editor. `position` controls caret placement. */\n focus: (position?: 'start' | 'end' | number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n if (!isDefined(position)) {\n return\n }\n const length = serializeEditor().length\n const pos =\n position === 'start' ? 0 : position === 'end' ? length : position\n setModelCaret(pos)\n },\n /** Replace the current value programmatically and re-render the pills. */\n setContent: (next = ''): void => {\n if (serializeEditor() === next) {\n return\n }\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n isEmpty.value = isBlankValue(next)\n },\n /** Read the current value as a `{{name}}`-bearing string. */\n getValue: (): string => serializeEditor(),\n /** Caret offset in the model string. */\n cursorPosition: (): number | undefined => {\n const c = getModelCaret()\n return c === null ? undefined : c\n },\n isFocused,\n editorRef,\n})\n</script>\n\n<template>\n <!-- Disabled mode: read-only label -->\n <div\n v-if=\"disabled\"\n class=\"text-c-2 flex cursor-default items-center justify-center\"\n :class=\"{\n 'font-code pr-2 pl-1 text-base': layout === 'modal',\n 'px-2': layout !== 'modal',\n 'line-through': linethrough,\n }\"\n data-testid=\"code-input-lite-disabled\">\n <span class=\"whitespace-nowrap\">{{ modelValue }}</span>\n </div>\n\n <!-- Enum mode: select dropdown with predefined values -->\n <DataTableInputSelect\n v-else-if=\"enumProp?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :type=\"defaultType\"\n :value=\"enumProp\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Boolean mode: select dropdown with true/false (and optionally null) -->\n <DataTableInputSelect\n v-else-if=\"isBooleanMode\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"booleanOptions\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Examples mode: select dropdown with example values -->\n <DataTableInputSelect\n v-else-if=\"examples?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"examples\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Editor mode -->\n <div\n v-else\n :id=\"componentId\"\n v-bind=\"wrapperAttrs\"\n class=\"code-input-lite group/code-input-lite peer relative w-full leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline\"\n :class=\"{\n 'code-input-lite--error': error,\n 'code-input-lite--empty': isEmpty,\n 'line-through': linethrough,\n }\">\n <!-- The single editable surface; see the file header for how pills work. -->\n <div\n ref=\"editorRef\"\n :aria-activedescendant=\"\n displayVariablesDropdown ? activeOptionId : undefined\n \"\n :aria-autocomplete=\"withVariables ? 'list' : undefined\"\n :aria-controls=\"displayVariablesDropdown ? listboxId : undefined\"\n :aria-expanded=\"displayVariablesDropdown ? 'true' : undefined\"\n :aria-invalid=\"error ? 'true' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-labelledby=\"ariaLabelledby\"\n :aria-readonly=\"readOnly ? 'true' : undefined\"\n :aria-required=\"required ? 'true' : undefined\"\n class=\"code-input-lite__editor\"\n :contenteditable=\"readOnly ? 'false' : 'true'\"\n :data-placeholder=\"placeholder\"\n :role=\"withVariables ? 'combobox' : 'textbox'\"\n spellcheck=\"false\"\n @blur=\"handleBlur\"\n @click=\"handleEditorClick\"\n @compositionend=\"handleCompositionEnd\"\n @compositionstart=\"handleCompositionStart\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @keydown=\"handleKeyDown\"\n @paste=\"handlePaste\"\n @pointerover=\"ensureTooltipsActive\" />\n </div>\n\n <!--\n Slots and the required indicator are siblings of the mode templates so\n they render in every mode and so `absolute right-0` anchors to the\n surrounding (relative) cell rather than the shrink-wrapped mode wrapper.\n -->\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <div\n v-if=\"$slots.icon\"\n class=\"centered-y absolute right-0 flex h-full items-center p-1.5 group-has-[.code-input-lite__editor:focus]:z-1\">\n <slot name=\"icon\" />\n </div>\n <div\n v-if=\"required\"\n class=\"required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 mr-0.5 pt-px pr-2 opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 peer-has-[.code-input-lite__editor:focus]:opacity-0\">\n {{ translate('apiClient.codeInputLite.required') }}\n </div>\n\n <EnvironmentVariableDropdown\n v-if=\"displayVariablesDropdown\"\n ref=\"dropdownRef\"\n :contextFunctionItems=\"contextFunctionDropdownItems\"\n :dropdownPosition=\"dropdownPosition\"\n :environment=\"environment\"\n :listboxId=\"listboxId\"\n :query=\"dropdownQuery\"\n @close=\"showDropdown = false\"\n @redirect=\"emit('navigate', { page: 'document', path: 'environment' })\"\n @select=\"handleDropdownSelect\" />\n</template>\n\n<style scoped>\n.code-input-lite {\n /* Flex so the editor centres vertically in whatever height the cell gives us.\n Font properties inherit so we adopt the surrounding typography. */\n display: flex;\n align-items: center;\n}\n\n.code-input-lite__editor {\n /* Everything font-related inherits from the surrounding context. */\n font: inherit;\n letter-spacing: inherit;\n flex: 1;\n min-width: 0;\n background: transparent;\n outline: none;\n color: var(--scalar-color-1);\n caret-color: var(--scalar-color-1);\n /* Single-line: horizontal scroll keeps the caret visible for long values;\n the scrollbar itself is hidden (would be noisy inside a table cell). */\n white-space: pre;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n padding: 0 0.5em;\n box-sizing: border-box;\n line-height: 1.44;\n /* Positioning context for the absolutely positioned placeholder. */\n position: relative;\n}\n\n.code-input-lite__editor::-webkit-scrollbar {\n display: none;\n}\n\n/* Absolute so the placeholder does not occupy flow space inside the\n contenteditable; otherwise the caret would land after it on focus.\n `pointer-events: none` lets clicks fall through to focus the editor.\n Hidden on focus so it never renders on top of the text caret. */\n.code-input-lite--empty .code-input-lite__editor:not(:focus)::before {\n content: attr(data-placeholder);\n color: var(--scalar-color-3);\n pointer-events: none;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0.5em;\n display: flex;\n align-items: center;\n}\n\n.code-input-lite--error .code-input-lite__editor {\n outline: 1px solid var(--scalar-color-red);\n}\n</style>\n\n<style>\n/* Pill styling. Each pill is `<span contenteditable=\"false\">name</span>` —\n an atomic widget; the caret lands before or after it, never inside. */\n.scalar-pill {\n color: var(--scalar-color-2);\n border-radius: var(--scalar-radius-full);\n display: inline-block;\n font-family: var(--scalar-font-code);\n font-size: 0.9em;\n line-height: 1.4;\n vertical-align: baseline;\n background: var(--scalar-background-3);\n padding: 0.125em 0.6em;\n margin-right: 0.35em;\n cursor: text;\n /* Single click selects the whole pill — chip/mention model, deletes in one go. */\n user-select: all;\n -webkit-user-select: all;\n}\n\n.dark-mode .scalar-pill {\n background: color-mix(\n in srgb,\n var(--tw-bg-base, var(--scalar-color-1)),\n transparent 90%\n );\n}\n\n.light-mode .scalar-pill {\n background: var(--scalar-background-3);\n}\n\n.scalar-pill--context-fn {\n /* Inset box-shadow as a border so the layout box stays identical to plain pills. */\n box-shadow: 0 0 0 1px\n color-mix(in srgb, var(--scalar-color-3), transparent 35%) inset;\n}\n\n.dark-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 55%);\n}\n\n.light-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 40%);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;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AAU,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,WAAW,EAAE,kBAAkB,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,4FAA4F;IAC5F,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAC;AA2VJ,QAAA,IAAI,OAAO,IAAU,EAAuB,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AACvF,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC7C;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAO7C,QAAA,MAAM,UAAU;;;;;;;;;;;cAhXD,OAAO;kBASH,OAAO;cALX,OAAO;2BADM,OAAO;6EAiXjC,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import DataTableInput_vue_vue_type_script_setup_true_lang_default from "./DataTableInput.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/components/data-table/DataTableInput.vue
5
- var DataTableInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DataTableInput_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-135d11b9"]]);
5
+ var DataTableInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DataTableInput_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8e7de9be"]]);
6
6
  //#endregion
7
7
  export { DataTableInput_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableInput.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, ref, useTemplateRef } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n// If not an enum nor read only, focus the code input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n codeInput.value?.focus()\n }\n}\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n :for=\"id ?? ''\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div class=\"relative flex min-w-0 flex-1\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"emit('update:modelValue', '')\" />\n <!-- Toggle Visibility -->\n <ScalarIconButton\n v-if=\"type === 'password'\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"\n mask\n ? translate('apiClient.dataTableInput.showPassword')\n : translate('apiClient.dataTableInput.hidePassword')\n \"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"DataTableInput.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, ref, useTemplateRef } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n// If not an enum nor read only, focus the code input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n codeInput.value?.focus()\n }\n}\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n :for=\"id ?? ''\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div class=\"relative flex min-w-0 flex-1\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"emit('update:modelValue', '')\" />\n <!-- Toggle Visibility -->\n <!-- A toggle button keeps one name and reports its state, so the label\n stays \"Show Password\" while `aria-pressed` says whether the value is\n revealed. Flipping the name instead leaves screen readers silent,\n because activating a button does not re-announce its name. -->\n <ScalarIconButton\n v-if=\"type === 'password'\"\n :aria-pressed=\"!mask\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"translate('apiClient.dataTableInput.showPassword')\"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":""}
@@ -133,12 +133,17 @@ var DataTableInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
133
133
  }, null, 8, ["icon", "label"])) : createCommentVNode("", true),
134
134
  __props.type === "password" ? (openBlock(), createBlock(unref(ScalarIconButton), {
135
135
  key: 3,
136
+ "aria-pressed": !mask.value,
136
137
  class: "-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25",
137
138
  "data-testid": "data-table-password-toggle",
138
139
  icon: mask.value ? unref(ScalarIconEye) : unref(ScalarIconEyeSlash),
139
- label: mask.value ? unref(translate)("apiClient.dataTableInput.showPassword") : unref(translate)("apiClient.dataTableInput.hidePassword"),
140
+ label: unref(translate)("apiClient.dataTableInput.showPassword"),
140
141
  onClick: _cache[5] || (_cache[5] = ($event) => mask.value = !mask.value)
141
- }, null, 8, ["icon", "label"])) : createCommentVNode("", true)
142
+ }, null, 8, [
143
+ "aria-pressed",
144
+ "icon",
145
+ "label"
146
+ ])) : createCommentVNode("", true)
142
147
  ]),
143
148
  _: 3
144
149
  }, 8, ["class"]);
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableInput.vue.script.js","names":["$slots","$attrs"],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, ref, useTemplateRef } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n// If not an enum nor read only, focus the code input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n codeInput.value?.focus()\n }\n}\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n :for=\"id ?? ''\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div class=\"relative flex min-w-0 flex-1\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"emit('update:modelValue', '')\" />\n <!-- Toggle Visibility -->\n <ScalarIconButton\n v-if=\"type === 'password'\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"\n mask\n ? translate('apiClient.dataTableInput.showPassword')\n : translate('apiClient.dataTableInput.hidePassword')\n \"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAyBd,MAAM,OAAO;EAOb,MAAM,EAAE,cAAc,gBAAgB;EAItC,MAAM,OAAO,IAAI,IAAI;EACrB,MAAM,0BAA0B,IAAI,KAAK;EACzC,MAAM,YAAY,eAAe,WAAW;EAE5C,MAAM,mBAAmB,CAAC,wBAAwB,SAAS,KAAK,WAAW;EAE3E,MAAM,YAAY,eAChB,MAAM,SAAS,aAAa,SAAU,MAAM,QAAQ,MACtD;EAGA,MAAM,yBAAyB;GAC7B,IAAI,CAAC,MAAM,MAAM,UAAU,CAAC,MAAM,UAChC,UAAU,OAAO,MAAM;EAE3B;;uBAGE,YAmFgB,uBAAA,EAlFd,OAAK,eAAA,CAAC,iBACE,QAAA,cAAc,CAAA,EAAA,GAAA;2BAOhB;KALEA,KAAAA,OAAO,WAAA,UAAA,GADf,mBAMM,OAAA;;MAJJ,OAAM;MACL,KAAK,QAAA,MAAE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AA,OAAA,MAAA,WAAE,KAAI,YAAA;MACX,uBAAiB,OAAA,OAAA,OAAA,MAAG,UAAU,KAAI,qBAAsB,KAAK;;;;;;;;;;;KAI5DD,KAAAA,OAAO,WAAA,UAAA,GADf,mBAIM,OAJN,YAIM,CADJ,WAAuB,KAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAEzB,WAAoB,KAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,IAAA;KAGZ,QAAA,cAAA,UAAA,GADR,YAK2C,MAAA,gBAAA,GAAA;;MAHzC,OAAM;MACL,MAAM,MAAA,WAAA;MACN,OAAO,MAAA,SAAA,CAAS,CAAA,qCAAA;MAChB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,qBAAA,EAAA;;KAGN,QAAA,SAAI,cAAA,UAAA,GADZ,YAU0B,MAAA,gBAAA,GAAA;;MARxB,OAAM;MACN,eAAY;MACX,MAAM,KAAA,QAAO,MAAA,aAAA,IAAgB,MAAA,kBAAA;MAC7B,OAAgB,KAAA,QAAiB,MAAA,SAAA,CAAS,CAAA,uCAAA,IAAsD,MAAA,SAAA,CAAS,CAAA,uCAAA;MAKzG,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAA,QAAI,CAAI,KAAA"}
1
+ {"version":3,"file":"DataTableInput.vue.script.js","names":["$slots","$attrs"],"sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconEye, ScalarIconEyeSlash, ScalarIconX } from '@scalar/icons'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { computed, ref, useTemplateRef } from 'vue'\n\nimport type { VueClassProp } from '@/types/vue'\nimport { CodeInputLite } from '@/v2/components/code-input'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\nimport DataTableInputSelect from './DataTableInputSelect.vue'\n\nconst props = withDefaults(\n defineProps<{\n id?: string\n type?: string | undefined\n /** Class for the wrapping cell because attrs is bound to the input */\n containerClass?: VueClassProp | undefined\n required?: boolean\n modelValue: string\n /** Allows adding a custom value to the enum dropdown, defaults to true */\n canAddCustomEnumValue?: boolean\n readOnly?: boolean\n enum?: string[]\n environment: XScalarEnvironment\n description?: string | undefined\n /** Whether to show context function suggestions like $guid, $timestamp. Defaults to true */\n withFakeData?: boolean\n }>(),\n {\n canAddCustomEnumValue: true,\n required: false,\n readOnly: false,\n withFakeData: true,\n },\n)\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', v: string | number): void\n (e: 'inputFocus'): void\n (e: 'inputBlur'): void\n (e: 'selectVariable', value: string): void\n}>()\n\nconst { translate } = useLocalization()\n\ndefineOptions({ inheritAttrs: false })\n\nconst mask = ref(true)\nconst interactingWithDropdown = ref(false)\nconst codeInput = useTemplateRef('codeInput')\n\nconst handleBlur = () => !interactingWithDropdown.value && emit('inputBlur')\n\nconst inputType = computed(() =>\n props.type === 'password' ? 'text' : (props.type ?? 'text'),\n)\n\n// If not an enum nor read only, focus the code input\nconst handleLabelClick = () => {\n if (!props.enum?.length && !props.readOnly) {\n codeInput.value?.focus()\n }\n}\n</script>\n<template>\n <DataTableCell\n class=\"relative flex\"\n :class=\"containerClass\">\n <div\n v-if=\"$slots.default\"\n class=\"text-c-1 flex items-center pr-0 pl-3\"\n :for=\"id ?? ''\"\n @click=\"handleLabelClick\">\n <slot />:\n </div>\n <div class=\"relative flex min-w-0 flex-1\">\n <template v-if=\"props.enum && props.enum.length\">\n <DataTableInputSelect\n :canAddCustomValue=\"props.canAddCustomEnumValue\"\n :modelValue=\"props.modelValue\"\n :value=\"props.enum\"\n @update:modelValue=\"emit('update:modelValue', $event)\" />\n </template>\n <template v-else>\n <input\n v-if=\"mask && type === 'password'\"\n v-bind=\"id ? { ...$attrs, id: id } : $attrs\"\n autocomplete=\"off\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none px-2 py-1.25 -outline-offset-1\"\n :class=\"{ 'scalar-password-input': type === 'password' }\"\n data-1p-ignore\n :readOnly=\"readOnly\"\n spellcheck=\"false\"\n :type=\"inputType\"\n :value=\"modelValue\"\n @input=\"\n emit(\n 'update:modelValue',\n ($event.target as HTMLInputElement).value ?? '',\n )\n \" />\n <CodeInputLite\n v-else\n v-bind=\"$attrs\"\n :id=\"id\"\n ref=\"codeInput\"\n class=\"text-c-1 disabled:text-c-2 peer w-full min-w-0 border-none -outline-offset-1\"\n :class=\"[\n type === 'password' && description && 'pr-12',\n description && 'pr-8',\n type === 'password' && 'scalar-password-input',\n ]\"\n :environment=\"environment\"\n :modelValue=\"modelValue ?? ''\"\n :readOnly=\"readOnly\"\n :required=\"Boolean(required)\"\n :type=\"inputType\"\n :withFakeData=\"withFakeData\"\n @blur=\"handleBlur\"\n @focus=\"emit('inputFocus')\"\n @update:modelValue=\"(value) => emit('update:modelValue', value)\" />\n </template>\n </div>\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <slot name=\"icon\" />\n <!-- Clear -->\n <ScalarIconButton\n v-if=\"modelValue\"\n class=\"-ml-.25 h-6 w-6 self-center p-1.25\"\n :icon=\"ScalarIconX\"\n :label=\"translate('apiClient.dataTableInput.clearValue')\"\n @click=\"emit('update:modelValue', '')\" />\n <!-- Toggle Visibility -->\n <!-- A toggle button keeps one name and reports its state, so the label\n stays \"Show Password\" while `aria-pressed` says whether the value is\n revealed. Flipping the name instead leaves screen readers silent,\n because activating a button does not re-announce its name. -->\n <ScalarIconButton\n v-if=\"type === 'password'\"\n :aria-pressed=\"!mask\"\n class=\"-ml-.5 mr-1.25 h-6 w-6 self-center p-1.25\"\n data-testid=\"data-table-password-toggle\"\n :icon=\"mask ? ScalarIconEye : ScalarIconEyeSlash\"\n :label=\"translate('apiClient.dataTableInput.showPassword')\"\n @click=\"mask = !mask\" />\n </DataTableCell>\n</template>\n\n<style scoped>\n:deep(.code-input-lite__editor) {\n background-color: transparent;\n font-family: var(--scalar-font);\n font-size: var(--scalar-small);\n padding: 5px 8px;\n}\n:deep(.scalar-pill:not(:last-of-type)) {\n margin-right: 0.15em;\n}\n:deep(.scalar-pill:not(:first-of-type)) {\n margin-left: 0.5px;\n}\n/* Tailwind placeholder is busted */\ninput::placeholder {\n color: var(--scalar-color-3);\n}\n/* we want our inputs to look like a password input but not be one */\n.scalar-password-input {\n text-security: disc;\n -webkit-text-security: disc;\n -moz-text-security: disc;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAyBd,MAAM,OAAO;EAOb,MAAM,EAAE,cAAc,gBAAgB;EAItC,MAAM,OAAO,IAAI,IAAI;EACrB,MAAM,0BAA0B,IAAI,KAAK;EACzC,MAAM,YAAY,eAAe,WAAW;EAE5C,MAAM,mBAAmB,CAAC,wBAAwB,SAAS,KAAK,WAAW;EAE3E,MAAM,YAAY,eAChB,MAAM,SAAS,aAAa,SAAU,MAAM,QAAQ,MACtD;EAGA,MAAM,yBAAyB;GAC7B,IAAI,CAAC,MAAM,MAAM,UAAU,CAAC,MAAM,UAChC,UAAU,OAAO,MAAM;EAE3B;;uBAGE,YAoFgB,uBAAA,EAnFd,OAAK,eAAA,CAAC,iBACE,QAAA,cAAc,CAAA,EAAA,GAAA;2BAOhB;KALEA,KAAAA,OAAO,WAAA,UAAA,GADf,mBAMM,OAAA;;MAJJ,OAAM;MACL,KAAK,QAAA,MAAE;MACP,SAAO;SACR,WAAQ,KAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,IAAA,GAAA,OAAA,OAAA,OAAA,KAAA,gBAAA,MACV,EAAA,EAAA,GAAA,GAAA,UAAA,KAAA,mBAAA,IAAA,IAAA;KACA,mBA+CM,OA/CN,YA+CM,CA9C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A,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;KAEzB,WAAoB,KAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,IAAA;KAGZ,QAAA,cAAA,UAAA,GADR,YAK2C,MAAA,gBAAA,GAAA;;MAHzC,OAAM;MACL,MAAM,MAAA,WAAA;MACN,OAAO,MAAA,SAAA,CAAS,CAAA,qCAAA;MAChB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,qBAAA,EAAA;;KAON,QAAA,SAAI,cAAA,UAAA,GADZ,YAO0B,MAAA,gBAAA,GAAA;;MALvB,gBAAY,CAAG,KAAA;MAChB,OAAM;MACN,eAAY;MACX,MAAM,KAAA,QAAO,MAAA,aAAA,IAAgB,MAAA,kBAAA;MAC7B,OAAO,MAAA,SAAA,CAAS,CAAA,uCAAA;MAChB,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAA,QAAI,CAAI,KAAA"}
@@ -8,6 +8,16 @@ export default _default;
8
8
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
9
9
  /** Whether the disclosure is open by default. */
10
10
  defaultOpen?: boolean;
11
+ /**
12
+ * Whether the title belongs in the document outline.
13
+ *
14
+ * A section of a request or response is a passage of the page, so its title
15
+ * is a heading by default. A caller whose title only names a cluster of
16
+ * controls opts out: the title renders as plain text and the section becomes
17
+ * a `group` named by it, which keeps the card findable without adding an
18
+ * entry to the heading outline that has no passage behind it.
19
+ */
20
+ heading?: boolean;
11
21
  /** Number of items to show in badge when collapsed. */
12
22
  itemCount?: number;
13
23
  /** Whether the disclosure is static and cannot be toggled. */
@@ -17,6 +27,16 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
27
  }, string, import("vue").PublicProps, Readonly<{
18
28
  /** Whether the disclosure is open by default. */
19
29
  defaultOpen?: boolean;
30
+ /**
31
+ * Whether the title belongs in the document outline.
32
+ *
33
+ * A section of a request or response is a passage of the page, so its title
34
+ * is a heading by default. A caller whose title only names a cluster of
35
+ * controls opts out: the title renders as plain text and the section becomes
36
+ * a `group` named by it, which keeps the card findable without adding an
37
+ * entry to the heading outline that has no passage behind it.
38
+ */
39
+ heading?: boolean;
20
40
  /** Number of items to show in badge when collapsed. */
21
41
  itemCount?: number;
22
42
  /** Whether the disclosure is static and cannot be toggled. */
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"names":[],"mappings":"AAwIA;;;;GAIG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY;IAEhB,iDAAiD;kBACnC,OAAO;IACrB,uDAAuD;gBAC3C,MAAM;IAClB,8DAA8D;eACnD,OAAO;;;;IALlB,iDAAiD;kBACnC,OAAO;IACrB,uDAAuD;gBAC3C,MAAM;IAClB,8DAA8D;eACnD,OAAO;;;;YAkQR,CAAC,KAAK;;KAAiB,KAAK,GAAG;;cAC7B,CAAC,KAAK;;KAAiB,KAAK,GAAG;;cAC/B,CAAC,KAAK;;KAAiB,KAAK,GAAG;EAUzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"CollapsibleSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"names":[],"mappings":"AA4KA;;;;GAIG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAKzC,QAAA,MAAM,YAAY;IAEhB,iDAAiD;kBACnC,OAAO;IACrB;;;;;;;;OAQG;cACO,OAAO;IACjB,uDAAuD;gBAC3C,MAAM;IAClB,8DAA8D;eACnD,OAAO;;;;IAflB,iDAAiD;kBACnC,OAAO;IACrB;;;;;;;;OAQG;cACO,OAAO;IACjB,uDAAuD;gBAC3C,MAAM;IAClB,8DAA8D;eACnD,OAAO;;;;YA+RR,CAAC,KAAK;;KAAiB,KAAK,GAAG;;cAC7B,CAAC,KAAK;;KAAiB,KAAK,GAAG;;cAC/B,CAAC,KAAK;;KAAiB,KAAK,GAAG;EAUzC,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleSection.vue.js","names":[],"sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Simple collapsible section component that can be used to wrap content that should be collapsed and expanded\n *\n * Would like to replace with details/summary elements, but they are not supported in all browsers yet?\n */\nexport default {\n name: 'CollapsibleSection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useId } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport ValueEmitter from './ValueEmitter.vue'\n\nconst {\n defaultOpen = true,\n itemCount = 0,\n isStatic,\n} = defineProps<{\n /** Whether the disclosure is open by default. */\n defaultOpen?: boolean\n /** Number of items to show in badge when collapsed. */\n itemCount?: number\n /** Whether the disclosure is static and cannot be toggled. */\n isStatic?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst headingId = useId()\n</script>\n\n<template>\n <Disclosure\n v-slot=\"{ open }\"\n as=\"div\"\n class=\"group/collapse text-c-2 focus-within:text-c-1 last:ui-open:border-b-0\"\n :class=\"{\n 'last-of-type:first-of-type:border-b-0': isStatic,\n 'border-b': !isStatic,\n }\"\n :defaultOpen=\"defaultOpen\"\n :static=\"isStatic\">\n <!-- We use this hack to emit the slot value back to the parent -->\n <ValueEmitter\n :value=\"open\"\n @change=\"(value) => emit('update:modelValue', value)\" />\n\n <section\n :aria-labelledby=\"headingId\"\n class=\"contents\">\n <div\n class=\"bg-b-2 flex items-center\"\n :class=\"isStatic && 'rounded-t-xl border-x border-t'\">\n <!-- Main disclosure button that toggles the panel -->\n <DisclosureButton\n class=\"hover:text-c-1 group box-content flex max-h-8 flex-1 items-center gap-2.5 overflow-hidden px-1 py-1.5 text-base font-medium outline-none md:px-1.5 xl:pr-0.5 xl:pl-2\"\n :class=\"isStatic && '!pl-3'\"\n :disabled=\"isStatic\">\n <ScalarIcon\n v-if=\"!isStatic\"\n class=\"text-c-3 group-hover:text-c-1 rounded-px ui-open:rotate-90 ui-not-open:rotate-0 outline-offset-2 group-focus-visible:outline\"\n icon=\"ChevronRight\"\n size=\"md\" />\n\n <!-- Heading with title -->\n <h2\n class=\"text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]\">\n <span\n :id=\"headingId\"\n class=\"contents\">\n <slot\n name=\"title\"\n :open=\"open\" />\n <span\n v-if=\"!open\"\n class=\"sr-only\"\n >{{ translate('apiClient.collapsibleSection.collapsed') }}</span\n >\n </span>\n\n <!-- Badge showing item count when collapsed. -->\n <span\n v-if=\"!open && itemCount\"\n class=\"bg-b-2 text-c-2 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold\">\n {{ itemCount }}\n <span class=\"sr-only\">{{\n itemCount === 1\n ? translate('apiClient.collapsibleSection.item')\n : translate('apiClient.collapsibleSection.items')\n }}</span>\n </span>\n </h2>\n </DisclosureButton>\n\n <!-- Optional actions slot that hides when the panel is closed. -->\n <div\n v-if=\"$slots.actions\"\n class=\"ui-not-open:hidden flex items-center gap-2 pr-0.75\">\n <slot\n name=\"actions\"\n :open=\"open\" />\n </div>\n </div>\n\n <!-- The collapsible content panel. -->\n <DisclosurePanel\n v-bind=\"$attrs\"\n class=\"diclosure-panel h-full max-h-fit rounded-b\">\n <slot :open=\"open\" />\n </DisclosurePanel>\n </section>\n </Disclosure>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"CollapsibleSection.vue.js","names":[],"sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Simple collapsible section component that can be used to wrap content that should be collapsed and expanded\n *\n * Would like to replace with details/summary elements, but they are not supported in all browsers yet?\n */\nexport default {\n name: 'CollapsibleSection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed, inject, toValue, useId } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport { COLLAPSIBLE_SECTION_HEADING_LEVEL } from './collapsible-section-heading-level'\nimport ValueEmitter from './ValueEmitter.vue'\n\nconst {\n defaultOpen = true,\n heading = true,\n itemCount = 0,\n isStatic,\n} = defineProps<{\n /** Whether the disclosure is open by default. */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline.\n *\n * A section of a request or response is a passage of the page, so its title\n * is a heading by default. A caller whose title only names a cluster of\n * controls opts out: the title renders as plain text and the section becomes\n * a `group` named by it, which keeps the card findable without adding an\n * entry to the heading outline that has no passage behind it.\n */\n heading?: boolean\n /** Number of items to show in badge when collapsed. */\n itemCount?: number\n /** Whether the disclosure is static and cannot be toggled. */\n isStatic?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\n/**\n * Defaults to `h2`, for a section that sits directly below the page title. A\n * parent that renders a title above its sections provides a deeper level.\n */\nconst headingLevel = inject(COLLAPSIBLE_SECTION_HEADING_LEVEL, 2)\n\n/**\n * The element that holds the title. A caller that opted out of the heading gets\n * a `span`, which reads as plain text and is also the only valid choice inside\n * the disclosure button, since a heading is not phrasing content.\n */\nconst titleTag = computed((): string =>\n heading ? `h${toValue(headingLevel)}` : 'span',\n)\n\n/** Names the `group` a section without a heading becomes. */\nconst titleId = useId()\n</script>\n\n<template>\n <Disclosure\n v-slot=\"{ open }\"\n as=\"div\"\n class=\"group/collapse text-c-2 focus-within:text-c-1 last:ui-open:border-b-0\"\n :class=\"{\n 'last-of-type:first-of-type:border-b-0': isStatic,\n 'border-b': !isStatic,\n }\"\n :defaultOpen=\"defaultOpen\"\n :static=\"isStatic\">\n <!-- We use this hack to emit the slot value back to the parent -->\n <ValueEmitter\n :value=\"open\"\n @change=\"(value) => emit('update:modelValue', value)\" />\n\n <!-- A section that carries a heading stays deliberately unnamed: naming it\n would turn it into a region landmark wrapping its own heading, so\n screen readers announce the title twice before reading the contents.\n Without a heading there is nothing to duplicate, and `group` is not a\n landmark, so the name bounds the card without joining the landmark\n list. -->\n <section\n :aria-labelledby=\"heading ? undefined : titleId\"\n class=\"contents\"\n :role=\"heading ? undefined : 'group'\">\n <div\n class=\"bg-b-2 flex items-center\"\n :class=\"isStatic && 'rounded-t-xl border-x border-t'\">\n <!-- Main disclosure button that toggles the panel -->\n <DisclosureButton\n class=\"hover:text-c-1 group box-content flex max-h-8 flex-1 items-center gap-2.5 overflow-hidden px-1 py-1.5 text-base font-medium outline-none md:px-1.5 xl:pr-0.5 xl:pl-2\"\n :class=\"isStatic && '!pl-3'\"\n :disabled=\"isStatic\">\n <ScalarIcon\n v-if=\"!isStatic\"\n class=\"text-c-3 group-hover:text-c-1 rounded-px ui-open:rotate-90 ui-not-open:rotate-0 outline-offset-2 group-focus-visible:outline\"\n icon=\"ChevronRight\"\n size=\"md\" />\n\n <!-- Heading with title -->\n <component\n :is=\"titleTag\"\n :id=\"heading ? undefined : titleId\"\n class=\"text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]\">\n <span class=\"contents\">\n <slot\n name=\"title\"\n :open=\"open\" />\n <span\n v-if=\"!open\"\n class=\"sr-only\"\n >{{ translate('apiClient.collapsibleSection.collapsed') }}</span\n >\n </span>\n\n <!-- Badge showing item count when collapsed. -->\n <span\n v-if=\"!open && itemCount\"\n class=\"bg-b-2 text-c-2 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold\">\n {{ itemCount }}\n <span class=\"sr-only\">{{\n itemCount === 1\n ? translate('apiClient.collapsibleSection.item')\n : translate('apiClient.collapsibleSection.items')\n }}</span>\n </span>\n </component>\n </DisclosureButton>\n\n <!-- Optional actions slot that hides when the panel is closed. -->\n <div\n v-if=\"$slots.actions\"\n class=\"ui-not-open:hidden flex items-center gap-2 pr-0.75\">\n <slot\n name=\"actions\"\n :open=\"open\" />\n </div>\n </div>\n\n <!-- The collapsible content panel. -->\n <DisclosurePanel\n v-bind=\"$attrs\"\n class=\"diclosure-panel h-full max-h-fit rounded-b\">\n <slot :open=\"open\" />\n </DisclosurePanel>\n </section>\n </Disclosure>\n</template>\n"],"mappings":""}
@@ -1,22 +1,22 @@
1
1
  import { useLocalization } from "../../features/localization/index.js";
2
+ import { COLLAPSIBLE_SECTION_HEADING_LEVEL } from "./collapsible-section-heading-level.js";
2
3
  import ValueEmitter_default from "./ValueEmitter.vue.js";
3
- import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useId, withCtx } from "vue";
4
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, toValue, unref, useId, withCtx } from "vue";
4
5
  import { ScalarIcon } from "@scalar/components/icon";
5
6
  import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue";
6
7
  //#region src/v2/components/layout/CollapsibleSection.vue?vue&type=script&setup=true&lang.ts
7
- var _hoisted_1 = ["aria-labelledby"];
8
- var _hoisted_2 = { class: "text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]" };
9
- var _hoisted_3 = ["id"];
10
- var _hoisted_4 = {
8
+ var _hoisted_1 = ["aria-labelledby", "role"];
9
+ var _hoisted_2 = { class: "contents" };
10
+ var _hoisted_3 = {
11
11
  key: 0,
12
12
  class: "sr-only"
13
13
  };
14
- var _hoisted_5 = {
14
+ var _hoisted_4 = {
15
15
  key: 0,
16
16
  class: "bg-b-2 text-c-2 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold"
17
17
  };
18
- var _hoisted_6 = { class: "sr-only" };
19
- var _hoisted_7 = {
18
+ var _hoisted_5 = { class: "sr-only" };
19
+ var _hoisted_6 = {
20
20
  key: 0,
21
21
  class: "ui-not-open:hidden flex items-center gap-2 pr-0.75"
22
22
  };
@@ -27,6 +27,10 @@ var CollapsibleSection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
27
27
  type: Boolean,
28
28
  default: true
29
29
  },
30
+ heading: {
31
+ type: Boolean,
32
+ default: true
33
+ },
30
34
  itemCount: { default: 0 },
31
35
  isStatic: { type: Boolean }
32
36
  },
@@ -34,7 +38,19 @@ var CollapsibleSection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
34
38
  setup(__props, { emit: __emit }) {
35
39
  const emit = __emit;
36
40
  const { translate } = useLocalization();
37
- const headingId = useId();
41
+ /**
42
+ * Defaults to `h2`, for a section that sits directly below the page title. A
43
+ * parent that renders a title above its sections provides a deeper level.
44
+ */
45
+ const headingLevel = inject(COLLAPSIBLE_SECTION_HEADING_LEVEL, 2);
46
+ /**
47
+ * The element that holds the title. A caller that opted out of the heading gets
48
+ * a `span`, which reads as plain text and is also the only valid choice inside
49
+ * the disclosure button, since a heading is not phrasing content.
50
+ */
51
+ const titleTag = computed(() => __props.heading ? `h${toValue(headingLevel)}` : "span");
52
+ /** Names the `group` a section without a heading becomes. */
53
+ const titleId = useId();
38
54
  return (_ctx, _cache) => {
39
55
  return openBlock(), createBlock(unref(Disclosure), {
40
56
  as: "div",
@@ -49,8 +65,9 @@ var CollapsibleSection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
49
65
  value: open,
50
66
  onChange: _cache[0] || (_cache[0] = (value) => emit("update:modelValue", value))
51
67
  }, null, 8, ["value"]), createElementVNode("section", {
52
- "aria-labelledby": unref(headingId),
53
- class: "contents"
68
+ "aria-labelledby": __props.heading ? void 0 : unref(titleId),
69
+ class: "contents",
70
+ role: __props.heading ? void 0 : "group"
54
71
  }, [createElementVNode("div", { class: normalizeClass(["bg-b-2 flex items-center", __props.isStatic && "rounded-t-xl border-x border-t"]) }, [createVNode(unref(DisclosureButton), {
55
72
  class: normalizeClass(["hover:text-c-1 group box-content flex max-h-8 flex-1 items-center gap-2.5 overflow-hidden px-1 py-1.5 text-base font-medium outline-none md:px-1.5 xl:pr-0.5 xl:pl-2", __props.isStatic && "!pl-3"]),
56
73
  disabled: __props.isStatic
@@ -60,12 +77,15 @@ var CollapsibleSection_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
60
77
  class: "text-c-3 group-hover:text-c-1 rounded-px ui-open:rotate-90 ui-not-open:rotate-0 outline-offset-2 group-focus-visible:outline",
61
78
  icon: "ChevronRight",
62
79
  size: "md"
63
- })) : createCommentVNode("", true), createElementVNode("h2", _hoisted_2, [createElementVNode("span", {
64
- id: unref(headingId),
65
- class: "contents"
66
- }, [renderSlot(_ctx.$slots, "title", { open }), !open ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(unref(translate)("apiClient.collapsibleSection.collapsed")), 1)) : createCommentVNode("", true)], 8, _hoisted_3), !open && __props.itemCount ? (openBlock(), createElementBlock("span", _hoisted_5, [createTextVNode(toDisplayString(__props.itemCount) + " ", 1), createElementVNode("span", _hoisted_6, toDisplayString(__props.itemCount === 1 ? unref(translate)("apiClient.collapsibleSection.item") : unref(translate)("apiClient.collapsibleSection.items")), 1)])) : createCommentVNode("", true)])]),
80
+ })) : createCommentVNode("", true), (openBlock(), createBlock(resolveDynamicComponent(titleTag.value), {
81
+ id: __props.heading ? void 0 : unref(titleId),
82
+ class: "text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]"
83
+ }, {
84
+ default: withCtx(() => [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "title", { open }), !open ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(unref(translate)("apiClient.collapsibleSection.collapsed")), 1)) : createCommentVNode("", true)]), !open && __props.itemCount ? (openBlock(), createElementBlock("span", _hoisted_4, [createTextVNode(toDisplayString(__props.itemCount) + " ", 1), createElementVNode("span", _hoisted_5, toDisplayString(__props.itemCount === 1 ? unref(translate)("apiClient.collapsibleSection.item") : unref(translate)("apiClient.collapsibleSection.items")), 1)])) : createCommentVNode("", true)]),
85
+ _: 2
86
+ }, 1032, ["id"]))]),
67
87
  _: 2
68
- }, 1032, ["class", "disabled"]), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_7, [renderSlot(_ctx.$slots, "actions", { open })])) : createCommentVNode("", true)], 2), createVNode(unref(DisclosurePanel), mergeProps(_ctx.$attrs, { class: "diclosure-panel h-full max-h-fit rounded-b" }), {
88
+ }, 1032, ["class", "disabled"]), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "actions", { open })])) : createCommentVNode("", true)], 2), createVNode(unref(DisclosurePanel), mergeProps(_ctx.$attrs, { class: "diclosure-panel h-full max-h-fit rounded-b" }), {
69
89
  default: withCtx(() => [renderSlot(_ctx.$slots, "default", { open })]),
70
90
  _: 2
71
91
  }, 1040)], 8, _hoisted_1)]),
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleSection.vue.script.js","names":["$slots","$attrs"],"sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Simple collapsible section component that can be used to wrap content that should be collapsed and expanded\n *\n * Would like to replace with details/summary elements, but they are not supported in all browsers yet?\n */\nexport default {\n name: 'CollapsibleSection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { useId } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport ValueEmitter from './ValueEmitter.vue'\n\nconst {\n defaultOpen = true,\n itemCount = 0,\n isStatic,\n} = defineProps<{\n /** Whether the disclosure is open by default. */\n defaultOpen?: boolean\n /** Number of items to show in badge when collapsed. */\n itemCount?: number\n /** Whether the disclosure is static and cannot be toggled. */\n isStatic?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst headingId = useId()\n</script>\n\n<template>\n <Disclosure\n v-slot=\"{ open }\"\n as=\"div\"\n class=\"group/collapse text-c-2 focus-within:text-c-1 last:ui-open:border-b-0\"\n :class=\"{\n 'last-of-type:first-of-type:border-b-0': isStatic,\n 'border-b': !isStatic,\n }\"\n :defaultOpen=\"defaultOpen\"\n :static=\"isStatic\">\n <!-- We use this hack to emit the slot value back to the parent -->\n <ValueEmitter\n :value=\"open\"\n @change=\"(value) => emit('update:modelValue', value)\" />\n\n <section\n :aria-labelledby=\"headingId\"\n class=\"contents\">\n <div\n class=\"bg-b-2 flex items-center\"\n :class=\"isStatic && 'rounded-t-xl border-x border-t'\">\n <!-- Main disclosure button that toggles the panel -->\n <DisclosureButton\n class=\"hover:text-c-1 group box-content flex max-h-8 flex-1 items-center gap-2.5 overflow-hidden px-1 py-1.5 text-base font-medium outline-none md:px-1.5 xl:pr-0.5 xl:pl-2\"\n :class=\"isStatic && '!pl-3'\"\n :disabled=\"isStatic\">\n <ScalarIcon\n v-if=\"!isStatic\"\n class=\"text-c-3 group-hover:text-c-1 rounded-px ui-open:rotate-90 ui-not-open:rotate-0 outline-offset-2 group-focus-visible:outline\"\n icon=\"ChevronRight\"\n size=\"md\" />\n\n <!-- Heading with title -->\n <h2\n class=\"text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]\">\n <span\n :id=\"headingId\"\n class=\"contents\">\n <slot\n name=\"title\"\n :open=\"open\" />\n <span\n v-if=\"!open\"\n class=\"sr-only\"\n >{{ translate('apiClient.collapsibleSection.collapsed') }}</span\n >\n </span>\n\n <!-- Badge showing item count when collapsed. -->\n <span\n v-if=\"!open && itemCount\"\n class=\"bg-b-2 text-c-2 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold\">\n {{ itemCount }}\n <span class=\"sr-only\">{{\n itemCount === 1\n ? translate('apiClient.collapsibleSection.item')\n : translate('apiClient.collapsibleSection.items')\n }}</span>\n </span>\n </h2>\n </DisclosureButton>\n\n <!-- Optional actions slot that hides when the panel is closed. -->\n <div\n v-if=\"$slots.actions\"\n class=\"ui-not-open:hidden flex items-center gap-2 pr-0.75\">\n <slot\n name=\"actions\"\n :open=\"open\" />\n </div>\n </div>\n\n <!-- The collapsible content panel. -->\n <DisclosurePanel\n v-bind=\"$attrs\"\n class=\"diclosure-panel h-full max-h-fit rounded-b\">\n <slot :open=\"open\" />\n </DisclosurePanel>\n </section>\n </Disclosure>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAOE,MAAM;;;;;;;;;;;EA0BR,MAAM,OAAO;EAIb,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,YAAY,MAAM;;uBAItB,YA+Ea,MAAA,UAAA,GAAA;IA7EX,IAAG;IACH,OAAK,eAAA,CAAC,yEAAuE;8CACpB,QAAA;kBAA6B,QAAA;;IAIrF,aAAa,QAAA;IACb,QAAQ,QAAA;;sBAIiD,EAZhD,WAAI,CAUd,YAE0D,sBAAA;KADvD,OAAO;KACP,UAAM,OAAA,OAAA,OAAA,MAAG,UAAU,KAAI,qBAAsB,KAAK;4BAErD,mBA+DU,WAAA;KA9DP,mBAAiB,MAAA,SAAA;KAClB,OAAM;QACN,mBAoDM,OAAA,EAnDJ,OAAK,eAAA,CAAC,4BACE,QAAA,YAAQ,gCAAA,CAAA,EAAA,GAAA,CAEhB,YAsCmB,MAAA,gBAAA,GAAA;KArCjB,OAAK,eAAA,CAAC,wKACE,QAAA,YAAQ,OAAA,CAAA;KACf,UAAU,QAAA;;4BAKG,CAAA,CAHL,QAAA,YAAA,UAAA,GADT,YAIc,MAAA,UAAA,GAAA;;MAFZ,OAAM;MACN,MAAK;MACL,MAAK;yCAGP,mBA0BK,MA1BL,YA0BK,CAxBH,mBAWO,QAAA;MAVJ,IAAI,MAAA,SAAA;MACL,OAAM;SACN,WAEiB,KAAA,QAAA,SAAA,EAAR,KAAI,CAAA,GAAA,CAEJ,QAAA,UAAA,GADT,mBAIC,QAJD,YAIC,gBADK,MAAA,SAAA,CAAS,CAAA,wCAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,GAAA,UAAA,GAAA,CAMR,QAAQ,QAAA,aAAA,UAAA,GADjB,mBASO,QATP,YASO,CAAA,gBAAA,gBANF,QAAA,SAAS,IAAG,KACf,CAAA,GAAA,mBAIS,QAJT,YAIS,gBAHP,QAAA,cAAS,IAA2B,MAAA,SAAA,CAAS,CAAA,mCAAA,IAA0D,MAAA,SAAA,CAAS,CAAA,oCAAA,CAAA,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,CAAA,CAAA,CAAA;;qCAUhHA,KAAAA,OAAO,WAAA,UAAA,GADf,mBAMM,OANN,YAMM,CAHJ,WAEiB,KAAA,QAAA,WAAA,EAAR,KAAI,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,CAAA,GAAA,CAAA,GAKjB,YAIkB,MAAA,eAAA,GAJlB,WACUC,KAGQ,QAHF,EACd,OAAM,6CAA4C,CAAA,GAAA;4BAC7B,CAArB,WAAqB,KAAA,QAAA,WAAA,EAAR,KAAI,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"CollapsibleSection.vue.script.js","names":["$slots","$attrs"],"sources":["../../../../src/v2/components/layout/CollapsibleSection.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Simple collapsible section component that can be used to wrap content that should be collapsed and expanded\n *\n * Would like to replace with details/summary elements, but they are not supported in all browsers yet?\n */\nexport default {\n name: 'CollapsibleSection',\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed, inject, toValue, useId } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport { COLLAPSIBLE_SECTION_HEADING_LEVEL } from './collapsible-section-heading-level'\nimport ValueEmitter from './ValueEmitter.vue'\n\nconst {\n defaultOpen = true,\n heading = true,\n itemCount = 0,\n isStatic,\n} = defineProps<{\n /** Whether the disclosure is open by default. */\n defaultOpen?: boolean\n /**\n * Whether the title belongs in the document outline.\n *\n * A section of a request or response is a passage of the page, so its title\n * is a heading by default. A caller whose title only names a cluster of\n * controls opts out: the title renders as plain text and the section becomes\n * a `group` named by it, which keeps the card findable without adding an\n * entry to the heading outline that has no passage behind it.\n */\n heading?: boolean\n /** Number of items to show in badge when collapsed. */\n itemCount?: number\n /** Whether the disclosure is static and cannot be toggled. */\n isStatic?: boolean\n}>()\n\nconst emit = defineEmits<{\n (e: 'update:modelValue', value: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\n/**\n * Defaults to `h2`, for a section that sits directly below the page title. A\n * parent that renders a title above its sections provides a deeper level.\n */\nconst headingLevel = inject(COLLAPSIBLE_SECTION_HEADING_LEVEL, 2)\n\n/**\n * The element that holds the title. A caller that opted out of the heading gets\n * a `span`, which reads as plain text and is also the only valid choice inside\n * the disclosure button, since a heading is not phrasing content.\n */\nconst titleTag = computed((): string =>\n heading ? `h${toValue(headingLevel)}` : 'span',\n)\n\n/** Names the `group` a section without a heading becomes. */\nconst titleId = useId()\n</script>\n\n<template>\n <Disclosure\n v-slot=\"{ open }\"\n as=\"div\"\n class=\"group/collapse text-c-2 focus-within:text-c-1 last:ui-open:border-b-0\"\n :class=\"{\n 'last-of-type:first-of-type:border-b-0': isStatic,\n 'border-b': !isStatic,\n }\"\n :defaultOpen=\"defaultOpen\"\n :static=\"isStatic\">\n <!-- We use this hack to emit the slot value back to the parent -->\n <ValueEmitter\n :value=\"open\"\n @change=\"(value) => emit('update:modelValue', value)\" />\n\n <!-- A section that carries a heading stays deliberately unnamed: naming it\n would turn it into a region landmark wrapping its own heading, so\n screen readers announce the title twice before reading the contents.\n Without a heading there is nothing to duplicate, and `group` is not a\n landmark, so the name bounds the card without joining the landmark\n list. -->\n <section\n :aria-labelledby=\"heading ? undefined : titleId\"\n class=\"contents\"\n :role=\"heading ? undefined : 'group'\">\n <div\n class=\"bg-b-2 flex items-center\"\n :class=\"isStatic && 'rounded-t-xl border-x border-t'\">\n <!-- Main disclosure button that toggles the panel -->\n <DisclosureButton\n class=\"hover:text-c-1 group box-content flex max-h-8 flex-1 items-center gap-2.5 overflow-hidden px-1 py-1.5 text-base font-medium outline-none md:px-1.5 xl:pr-0.5 xl:pl-2\"\n :class=\"isStatic && '!pl-3'\"\n :disabled=\"isStatic\">\n <ScalarIcon\n v-if=\"!isStatic\"\n class=\"text-c-3 group-hover:text-c-1 rounded-px ui-open:rotate-90 ui-not-open:rotate-0 outline-offset-2 group-focus-visible:outline\"\n icon=\"ChevronRight\"\n size=\"md\" />\n\n <!-- Heading with title -->\n <component\n :is=\"titleTag\"\n :id=\"heading ? undefined : titleId\"\n class=\"text-c-1 m-0 flex flex-1 items-center gap-1.5 leading-[20px]\">\n <span class=\"contents\">\n <slot\n name=\"title\"\n :open=\"open\" />\n <span\n v-if=\"!open\"\n class=\"sr-only\"\n >{{ translate('apiClient.collapsibleSection.collapsed') }}</span\n >\n </span>\n\n <!-- Badge showing item count when collapsed. -->\n <span\n v-if=\"!open && itemCount\"\n class=\"bg-b-2 text-c-2 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold\">\n {{ itemCount }}\n <span class=\"sr-only\">{{\n itemCount === 1\n ? translate('apiClient.collapsibleSection.item')\n : translate('apiClient.collapsibleSection.items')\n }}</span>\n </span>\n </component>\n </DisclosureButton>\n\n <!-- Optional actions slot that hides when the panel is closed. -->\n <div\n v-if=\"$slots.actions\"\n class=\"ui-not-open:hidden flex items-center gap-2 pr-0.75\">\n <slot\n name=\"actions\"\n :open=\"open\" />\n </div>\n </div>\n\n <!-- The collapsible content panel. -->\n <DisclosurePanel\n v-bind=\"$attrs\"\n class=\"diclosure-panel h-full max-h-fit rounded-b\">\n <slot :open=\"open\" />\n </DisclosurePanel>\n </section>\n </Disclosure>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAOE,MAAM;;;;;;;;;;;;;;;EAsCR,MAAM,OAAO;EAIb,MAAM,EAAE,cAAc,gBAAgB;;;;;EAMtC,MAAM,eAAe,OAAO,mCAAmC,CAAC;;;;;;EAOhE,MAAM,WAAW,eACf,QAAA,UAAU,IAAI,QAAQ,YAAY,MAAM,MAC1C;;EAGA,MAAM,UAAU,MAAM;;uBAIpB,YAsFa,MAAA,UAAA,GAAA;IApFX,IAAG;IACH,OAAK,eAAA,CAAC,yEAAuE;8CACpB,QAAA;kBAA6B,QAAA;;IAIrF,aAAa,QAAA;IACb,QAAQ,QAAA;;sBAIiD,EAZhD,WAAI,CAUd,YAE0D,sBAAA;KADvD,OAAO;KACP,UAAM,OAAA,OAAA,OAAA,MAAG,UAAU,KAAI,qBAAsB,KAAK;4BAQrD,mBAgEU,WAAA;KA/DP,mBAAiB,QAAA,UAAU,KAAA,IAAY,MAAA,OAAA;KACxC,OAAM;KACL,MAAM,QAAA,UAAU,KAAA,IAAS;QAC1B,mBAoDM,OAAA,EAnDJ,OAAK,eAAA,CAAC,4BACE,QAAA,YAAQ,gCAAA,CAAA,EAAA,GAAA,CAEhB,YAsCmB,MAAA,gBAAA,GAAA;KArCjB,OAAK,eAAA,CAAC,wKACE,QAAA,YAAQ,OAAA,CAAA;KACf,UAAU,QAAA;;4BAKG,CAAA,CAHL,QAAA,YAAA,UAAA,GADT,YAIc,MAAA,UAAA,GAAA;;MAFZ,OAAM;MACN,MAAK;MACL,MAAK;uDAGP,YA0BY,wBAzBL,SAAA,KAAQ,GAAA;MACZ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