@ternarytech-io/gears-ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/package.json +1 -1
- package/src/codeTokens.ts +104 -0
- package/src/components/TCodeBlock.vue +47 -0
- package/src/components/TMethodBadge.vue +21 -0
- package/src/index.ts +9 -2
- package/src/styles/gears.css +70 -0
package/README.md
CHANGED
|
@@ -89,6 +89,8 @@ The package ships its sources (`exports` points at `src/`), so it's consumed by
|
|
|
89
89
|
- **Icons** are Tabler Icons by name: `icon="plus"`. Browse them at <https://tabler.io/icons>.
|
|
90
90
|
- Tabler's own classes work alongside the components: the grid, spacing, `btn-list`, `row-cards`,
|
|
91
91
|
`list-group`, `datagrid`, `text-secondary`, …
|
|
92
|
+
- **`min-w-0`** lets a flex or grid item shrink below its content, so text in it can truncate. Bootstrap has
|
|
93
|
+
no such utility; gears.css adds it.
|
|
92
94
|
|
|
93
95
|
## The preview site
|
|
94
96
|
|
|
@@ -101,12 +103,12 @@ add a page, add an entry to `preview/registry.ts` and a folder of examples.
|
|
|
101
103
|
|
|
102
104
|
| Group | Components |
|
|
103
105
|
| --- | --- |
|
|
104
|
-
| Elements | `TButton`, `TButtonGroup` (joined buttons, across or down; a tooltip each; `click` names the button), `TBadge`, `TAvatar`, `TAlert`, `TCard`, `TIcon`, `TTooltip`, `TEmpty`, `TSpinner`, `TSkeleton`, `TProgress`, `TSeparator` (a label at the start, center or end; color, style, thickness) |
|
|
106
|
+
| Elements | `TButton`, `TButtonGroup` (joined buttons, across or down; a tooltip each; `click` names the button), `TBadge`, `TMethodBadge` (an HTTP method, each in its own color, of one width), `TAvatar`, `TAlert`, `TCard`, `TIcon`, `TTooltip`, `TEmpty`, `TSpinner`, `TSkeleton`, `TProgress`, `TSeparator` (a label at the start, center or end; color, style, thickness) |
|
|
105
107
|
| Forms | `TFormField`, `TInput`, `TInputNumber`, `TTextarea`, `TSelect`, `TSelectMenu`, `TInputTags`, `TCheckbox`, `TSwitch`, `TRadioGroup` (list, cards or tiles with a picture), `TFieldGroup`, `TFileUpload`, `TImageUpload` (one image, checked for shape and size), `TIconPicker` (any Tabler icon, by name, with a search; the list is generated by `npm run icons`), `TRating` (stars, hearts or circles; no library), `TListBox` (always shown; one or several; a search), `TCheckboxTree` (parents check their children; partly checked; folding), `TCodeEditor` |
|
|
106
108
|
| Theme | `TAccentPicker`, `TFontPicker`, `TRadiusPicker`, `TThemeBasePicker` (Tabler's theme settings as pickers), `TNavPositionPicker`, `TDensityPicker`, `TContainerPicker` (layout), `TThemeScope` (applies a `ThemeSettings`' look and density to what's inside it); `themeAccents`, `themeFonts`, `themeBases`, `themeRadii`, `themeNavs`, `themeDensities`, `themeContainers` |
|
|
107
109
|
| Overlays | `TModal`, `TSlideover`, `TDropdown`, `TSplitButton` (a main action and a menu of others), `TToaster` (with `useToast()`: neutral, success, warning, error or a custom `accent` color; a corner or the middle of the top or bottom, per toast or for all; `onClick`, `onClose`), `TLightbox` (images shown large: previous and next, arrow keys, swipes, captions) |
|
|
108
110
|
| Navigation | `TTabs`, `TPagination`, `TSteps`, `TNav`, `TPanelList`, `TCommandPalette`, `TSearchButton` |
|
|
109
|
-
| Data | `TTable` (sorting, `selectable` rows), `TAdvancedTable` (filters by column), `TEditableTable` (editing in place, bulk actions, search, pages, column kinds; client-side or `manual`), `TDataGrid` and `TDataGridItem` (Tabler's datagrid: labels and values for detail panels), `TStatCard` (with a trend and a sparkline; `loading`, `clickable`), `TSparkline` (Tabler's, no library), `TLogView` |
|
|
111
|
+
| Data | `TTable` (sorting, `selectable` rows), `TAdvancedTable` (filters by column), `TEditableTable` (editing in place, bulk actions, search, pages, column kinds; client-side or `manual`), `TDataGrid` and `TDataGridItem` (Tabler's datagrid: labels and values for detail panels), `TStatCard` (with a trend and a sparkline; `loading`, `clickable`), `TSparkline` (Tabler's, no library), `TLogView`, `TCodeBlock` (JSON or YAML to read and copy: light highlighting by `codeTokens()`, wrapping, a header with actions; no editor, so no Monaco) |
|
|
110
112
|
| Layout | `TAppLayout` (an application's frame, laid out by its theme, with a menu button on small screens), `TScaledFrame` (a whole screen scaled to fit), `TShell`, `TTopbar`, `TPage`, `TSectionLayout`, `TSplitter`, `TAuthLayout`, `TColorModeButton` |
|
|
111
113
|
| Plugins | `TAdvancedSelect`, `TChart`, `TPdfViewer`, `TCopyButton`, `TColorPicker`, `TDatePicker`, `TDropzone`, `TInputMask`, `TRangeSlider`, `TSortable`, `TSortableTree`, `TTimeInput`, `TVectorMap`, `TRichEditor` |
|
|
112
114
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Light highlighting for TCodeBlock: JSON and YAML split into tokens, each with a kind the
|
|
2
|
+
// stylesheet colors (.t-code-key, .t-code-string, …). Text in, text out: nothing is parsed or
|
|
3
|
+
// evaluated, and the tokens' text joined together is exactly the code given.
|
|
4
|
+
|
|
5
|
+
export type CodeLanguage = 'json' | 'yaml' | 'text'
|
|
6
|
+
|
|
7
|
+
export type CodeTokenKind = 'key' | 'string' | 'number' | 'literal' | 'punctuation' | 'comment' | 'plain'
|
|
8
|
+
|
|
9
|
+
export interface CodeToken { kind: CodeTokenKind; text: string }
|
|
10
|
+
|
|
11
|
+
// Above this many characters the code is shown plain: highlighting would make too many elements.
|
|
12
|
+
export const maxHighlighted = 200_000
|
|
13
|
+
|
|
14
|
+
const jsonPattern = /("(?:\\.|[^"\\])*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|\b(true|false|null)\b|([{}[\],:])|(\s+)|([^"\s{}[\],:]+)/g
|
|
15
|
+
|
|
16
|
+
function json(code: string): CodeToken[] {
|
|
17
|
+
const tokens: CodeToken[] = []
|
|
18
|
+
for (const m of code.matchAll(jsonPattern)) {
|
|
19
|
+
if (m[1] !== undefined) {
|
|
20
|
+
tokens.push({ kind: m[2] !== undefined ? 'key' : 'string', text: m[1] })
|
|
21
|
+
if (m[2] !== undefined) tokens.push({ kind: 'punctuation', text: m[2] })
|
|
22
|
+
} else if (m[3] !== undefined) tokens.push({ kind: 'number', text: m[3] })
|
|
23
|
+
else if (m[4] !== undefined) tokens.push({ kind: 'literal', text: m[4] })
|
|
24
|
+
else if (m[5] !== undefined) tokens.push({ kind: 'punctuation', text: m[5] })
|
|
25
|
+
else tokens.push({ kind: 'plain', text: m[0] })
|
|
26
|
+
}
|
|
27
|
+
return tokens
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// A YAML scalar: quoted, a number, a literal, or plain text (with a comment after it, if any).
|
|
31
|
+
function yamlValue(value: string, tokens: CodeToken[]) {
|
|
32
|
+
const comment = /(^|\s)#.*$/.exec(value)
|
|
33
|
+
const body = comment ? value.slice(0, comment.index + comment[1].length) : value
|
|
34
|
+
const text = body.trimEnd()
|
|
35
|
+
const gap = body.slice(text.length)
|
|
36
|
+
if (text.length) {
|
|
37
|
+
const kind: CodeTokenKind = /^(["']).*\1$/.test(text) ? 'string'
|
|
38
|
+
: /^-?(\d+(\.\d+)?([eE][+-]?\d+)?|\.inf|\.nan)$/i.test(text) ? 'number'
|
|
39
|
+
: /^(true|false|null|~)$/i.test(text) ? 'literal'
|
|
40
|
+
: /^[|>][+-]?$/.test(text) || /^[[\]{}]+$/.test(text) ? 'punctuation'
|
|
41
|
+
: 'string'
|
|
42
|
+
tokens.push({ kind, text })
|
|
43
|
+
}
|
|
44
|
+
if (gap) tokens.push({ kind: 'plain', text: gap })
|
|
45
|
+
if (comment) tokens.push({ kind: 'comment', text: value.slice(comment.index + comment[1].length) })
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const yamlKey = /^(\s*(?:-\s+)*)((?:"(?:\\.|[^"\\])*"|'[^']*'|(?!-\s)[^\s#'"][^#]*?))(:)(?=\s|$)(.*)$/
|
|
49
|
+
const yamlItem = /^(\s*)(-)(\s+|$)(.*)$/
|
|
50
|
+
|
|
51
|
+
function yaml(code: string): CodeToken[] {
|
|
52
|
+
const tokens: CodeToken[] = []
|
|
53
|
+
const lines = code.split('\n')
|
|
54
|
+
// Inside a block scalar (after `|` or `>`): the indent of the line that began it.
|
|
55
|
+
let block: number | null = null
|
|
56
|
+
lines.forEach((line, i) => {
|
|
57
|
+
let m: RegExpExecArray | null
|
|
58
|
+
const indent = /^\s*/.exec(line)![0].length
|
|
59
|
+
if (block !== null && (indent > block || !line.trim())) {
|
|
60
|
+
tokens.push({ kind: 'string', text: line })
|
|
61
|
+
if (i < lines.length - 1) tokens.push({ kind: 'plain', text: '\n' })
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
block = /:\s*[|>][+-]?\s*(#.*)?$/.test(line) || /^\s*-\s+[|>][+-]?\s*$/.test(line) ? indent : null
|
|
65
|
+
if (/^\s*#/.test(line)) tokens.push({ kind: 'comment', text: line })
|
|
66
|
+
else if ((m = yamlKey.exec(line))) {
|
|
67
|
+
if (m[1]) tokens.push({ kind: 'punctuation', text: m[1] })
|
|
68
|
+
tokens.push({ kind: 'key', text: m[2] }, { kind: 'punctuation', text: m[3] })
|
|
69
|
+
const rest = m[4]
|
|
70
|
+
const lead = /^\s*/.exec(rest)![0]
|
|
71
|
+
if (lead) tokens.push({ kind: 'plain', text: lead })
|
|
72
|
+
yamlValue(rest.slice(lead.length), tokens)
|
|
73
|
+
} else if ((m = yamlItem.exec(line))) {
|
|
74
|
+
if (m[1]) tokens.push({ kind: 'plain', text: m[1] })
|
|
75
|
+
tokens.push({ kind: 'punctuation', text: m[2] })
|
|
76
|
+
if (m[3]) tokens.push({ kind: 'plain', text: m[3] })
|
|
77
|
+
yamlValue(m[4], tokens)
|
|
78
|
+
} else {
|
|
79
|
+
const lead = /^\s*/.exec(line)![0]
|
|
80
|
+
if (lead) tokens.push({ kind: 'plain', text: lead })
|
|
81
|
+
yamlValue(line.slice(lead.length), tokens)
|
|
82
|
+
}
|
|
83
|
+
if (i < lines.length - 1) tokens.push({ kind: 'plain', text: '\n' })
|
|
84
|
+
})
|
|
85
|
+
return tokens
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Joins neighbours of the same kind, so there are fewer elements to draw.
|
|
89
|
+
function merge(tokens: CodeToken[]): CodeToken[] {
|
|
90
|
+
const merged: CodeToken[] = []
|
|
91
|
+
for (const token of tokens) {
|
|
92
|
+
if (!token.text) continue
|
|
93
|
+
const last = merged.at(-1)
|
|
94
|
+
if (last && last.kind === token.kind) last.text += token.text
|
|
95
|
+
else merged.push({ ...token })
|
|
96
|
+
}
|
|
97
|
+
return merged
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// The code's tokens; one plain token for text, or code too long to highlight.
|
|
101
|
+
export function codeTokens(code: string, language: CodeLanguage = 'json'): CodeToken[] {
|
|
102
|
+
if (language === 'text' || code.length > maxHighlighted) return code ? [{ kind: 'plain', text: code }] : []
|
|
103
|
+
return merge(language === 'json' ? json(code) : yaml(code))
|
|
104
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Code to read and copy, not to edit: JSON or YAML with light highlighting (`text` for none), on a
|
|
3
|
+
// sunken surface like TLogView. Give `code`, or a `value` to show as JSON. Lines wrap unless `wrap`
|
|
4
|
+
// is off (then it scrolls sideways); `maxHeight` caps it with a scroll. A `title` (or the `title`
|
|
5
|
+
// slot) gives it a header, with the copy button and any `actions`; without one the copy button sits
|
|
6
|
+
// in the corner. No editor is loaded: for editing, use TCodeEditor.
|
|
7
|
+
import { computed, useSlots } from 'vue'
|
|
8
|
+
import TCopyButton from './TCopyButton.vue'
|
|
9
|
+
import { codeTokens, type CodeLanguage } from '../codeTokens'
|
|
10
|
+
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
12
|
+
code?: string
|
|
13
|
+
// Shown as JSON, indented by two spaces; `code` wins when both are given.
|
|
14
|
+
value?: unknown
|
|
15
|
+
language?: CodeLanguage
|
|
16
|
+
title?: string
|
|
17
|
+
// The block's name for screen readers, when there's no title.
|
|
18
|
+
label?: string
|
|
19
|
+
wrap?: boolean
|
|
20
|
+
copy?: boolean
|
|
21
|
+
maxHeight?: string
|
|
22
|
+
}>(), { language: 'json', wrap: true, copy: true })
|
|
23
|
+
|
|
24
|
+
defineEmits<{ copied: [] }>()
|
|
25
|
+
|
|
26
|
+
const slots = useSlots()
|
|
27
|
+
|
|
28
|
+
const text = computed(() => props.code ?? (props.value === undefined ? '' : JSON.stringify(props.value, null, 2) ?? ''))
|
|
29
|
+
const language = computed<CodeLanguage>(() => props.code === undefined && props.value !== undefined ? 'json' : props.language)
|
|
30
|
+
const tokens = computed(() => codeTokens(text.value, language.value))
|
|
31
|
+
const header = computed(() => !!props.title || !!slots.title || !!slots.actions)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div :class="['t-code', { 't-code-nowrap': !wrap, 't-code-headed': header }]">
|
|
36
|
+
<div v-if="header" class="t-code-header">
|
|
37
|
+
<span class="t-code-title"><slot name="title">{{ title }}</slot></span>
|
|
38
|
+
<span class="t-code-actions">
|
|
39
|
+
<slot name="actions" />
|
|
40
|
+
<TCopyButton v-if="copy" :text="text" icon-only variant="ghost" size="sm" label="Copy" @copied="$emit('copied')" />
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
<TCopyButton v-else-if="copy" :text="text" icon-only variant="ghost" size="sm" label="Copy" class="t-code-copy" @copied="$emit('copied')" />
|
|
44
|
+
<pre class="t-code-body" :style="maxHeight ? { maxHeight } : undefined" tabindex="0" :aria-label="label ?? title"><code :data-language="language"><span
|
|
45
|
+
v-for="(token, i) in tokens" :key="i" :class="token.kind === 'plain' ? undefined : `t-code-${token.kind}`">{{ token.text }}</span></code></pre>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// An HTTP method as a badge, each in its own color: GET info, POST success, PUT warning, PATCH
|
|
3
|
+
// primary, DELETE error, others neutral. The method's name is always shown, so the color only
|
|
4
|
+
// helps. Monospaced and of one width, so paths beside a column of them line up.
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import TBadge from './TBadge.vue'
|
|
7
|
+
import type { Color } from '../types'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<{
|
|
10
|
+
method: string
|
|
11
|
+
variant?: 'soft' | 'solid' | 'outline'
|
|
12
|
+
}>(), { variant: 'soft' })
|
|
13
|
+
|
|
14
|
+
const colors: Record<string, Color> = { GET: 'info', POST: 'success', PUT: 'warning', PATCH: 'primary', DELETE: 'error' }
|
|
15
|
+
|
|
16
|
+
const name = computed(() => props.method.toUpperCase())
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<TBadge :color="colors[name] ?? 'neutral'" :variant="variant" :label="name" class="t-method-badge" />
|
|
21
|
+
</template>
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import TButtonGroup from './components/TButtonGroup.vue'
|
|
|
16
16
|
import TCard from './components/TCard.vue'
|
|
17
17
|
import TCheckbox from './components/TCheckbox.vue'
|
|
18
18
|
import TCheckboxTree from './components/TCheckboxTree.vue'
|
|
19
|
+
import TCodeBlock from './components/TCodeBlock.vue'
|
|
19
20
|
import TColorModeButton from './components/TColorModeButton.vue'
|
|
20
21
|
import TCommandPalette from './components/TCommandPalette.vue'
|
|
21
22
|
import TContainerPicker from './components/TContainerPicker.vue'
|
|
@@ -39,6 +40,7 @@ import TInputNumber from './components/TInputNumber.vue'
|
|
|
39
40
|
import TInputTags from './components/TInputTags.vue'
|
|
40
41
|
import TListBox from './components/TListBox.vue'
|
|
41
42
|
import TLogView from './components/TLogView.vue'
|
|
43
|
+
import TMethodBadge from './components/TMethodBadge.vue'
|
|
42
44
|
import TModal from './components/TModal.vue'
|
|
43
45
|
import TNav from './components/TNav.vue'
|
|
44
46
|
import TNavPositionPicker from './components/TNavPositionPicker.vue'
|
|
@@ -88,6 +90,7 @@ export {
|
|
|
88
90
|
TCard,
|
|
89
91
|
TCheckbox,
|
|
90
92
|
TCheckboxTree,
|
|
93
|
+
TCodeBlock,
|
|
91
94
|
TColorModeButton,
|
|
92
95
|
TCommandPalette,
|
|
93
96
|
TContainerPicker,
|
|
@@ -111,6 +114,7 @@ export {
|
|
|
111
114
|
TInputTags,
|
|
112
115
|
TListBox,
|
|
113
116
|
TLogView,
|
|
117
|
+
TMethodBadge,
|
|
114
118
|
TModal,
|
|
115
119
|
TNav,
|
|
116
120
|
TNavPositionPicker,
|
|
@@ -149,6 +153,7 @@ export {
|
|
|
149
153
|
}
|
|
150
154
|
|
|
151
155
|
export * from './types'
|
|
156
|
+
export { codeTokens, maxHighlighted, type CodeLanguage, type CodeToken, type CodeTokenKind } from './codeTokens'
|
|
152
157
|
export type { LightboxImage } from './components/TLightbox.vue'
|
|
153
158
|
export { isCustomAccent, themeAccents, themeBases, themeContainers, themeDensities, themeFonts, themeNavs, themeRadii, themeRadiusSizes } from './theme'
|
|
154
159
|
export { useColorMode, type ColorMode } from './composables/useColorMode'
|
|
@@ -158,9 +163,9 @@ export { useToast, type Toast, type ToastPosition } from './composables/useToast
|
|
|
158
163
|
|
|
159
164
|
const components = {
|
|
160
165
|
TAccentPicker, TAdvancedTable, TAlert, TAppLayout, TAuthLayout, TAvatar, TBadge, TButton, TButtonGroup, TCard,
|
|
161
|
-
TCheckbox, TCheckboxTree, TColorModeButton, TCommandPalette, TContainerPicker, TCopyButton, TDataGrid, TDataGridItem, TDensityPicker,
|
|
166
|
+
TCheckbox, TCheckboxTree, TCodeBlock, TColorModeButton, TCommandPalette, TContainerPicker, TCopyButton, TDataGrid, TDataGridItem, TDensityPicker,
|
|
162
167
|
TDropdown, TEditableTable, TEmpty, TFieldGroup, TFileUpload, TFontPicker, TFormField, TIcon, TIconPicker, TImageUpload,
|
|
163
|
-
TInput, TInputNumber, TInputTags, TLightbox, TListBox, TLogView, TModal, TNav, TNavPositionPicker, TPage, TPagination,
|
|
168
|
+
TInput, TInputNumber, TInputTags, TLightbox, TListBox, TLogView, TMethodBadge, TModal, TNav, TNavPositionPicker, TPage, TPagination,
|
|
164
169
|
TPanelList, TProgress, TRadioGroup, TRadiusPicker, TRating, TScaledFrame, TSearchButton, TSectionLayout,
|
|
165
170
|
TSelect, TSelectMenu, TSeparator, TShell, TSkeleton, TSlideover, TSparkline, TSpinner, TSplitButton, TSplitter, TStatCard,
|
|
166
171
|
TSteps, TSwitch, TTable, TTabs, TTextarea, TThemeBasePicker, TThemeScope, TToaster, TTooltip,
|
|
@@ -187,6 +192,7 @@ declare module 'vue' {
|
|
|
187
192
|
TCard: typeof TCard
|
|
188
193
|
TCheckbox: typeof TCheckbox
|
|
189
194
|
TCheckboxTree: typeof TCheckboxTree
|
|
195
|
+
TCodeBlock: typeof TCodeBlock
|
|
190
196
|
TColorModeButton: typeof TColorModeButton
|
|
191
197
|
TCommandPalette: typeof TCommandPalette
|
|
192
198
|
TContainerPicker: typeof TContainerPicker
|
|
@@ -210,6 +216,7 @@ declare module 'vue' {
|
|
|
210
216
|
TInputTags: typeof TInputTags
|
|
211
217
|
TListBox: typeof TListBox
|
|
212
218
|
TLogView: typeof TLogView
|
|
219
|
+
TMethodBadge: typeof TMethodBadge
|
|
213
220
|
TModal: typeof TModal
|
|
214
221
|
TNav: typeof TNav
|
|
215
222
|
TNavPositionPicker: typeof TNavPositionPicker
|
package/src/styles/gears.css
CHANGED
|
@@ -139,6 +139,10 @@
|
|
|
139
139
|
.t-section-panel { display: none; }
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/* Lets a flex or grid item shrink below its content, so text inside it can truncate or wrap.
|
|
143
|
+
Bootstrap has no such utility; components and apps use this one. */
|
|
144
|
+
.min-w-0 { min-width: 0; }
|
|
145
|
+
|
|
142
146
|
/* Log output: monospaced, on a slightly sunken surface. */
|
|
143
147
|
.t-log {
|
|
144
148
|
overflow: auto;
|
|
@@ -158,6 +162,72 @@
|
|
|
158
162
|
.t-log-line { display: flex; gap: 0.75rem; }
|
|
159
163
|
.t-log-time { flex-shrink: 0; color: var(--tblr-tertiary-color); user-select: none; }
|
|
160
164
|
|
|
165
|
+
/* A code block (TCodeBlock): like the log's surface, with light highlighting. The token colors
|
|
166
|
+
are their own, for both themes, each at least 4.5:1 on the block's surface. */
|
|
167
|
+
.t-code {
|
|
168
|
+
--t-code-key: light-dark(#0b5394, #79c0ff);
|
|
169
|
+
--t-code-string: light-dark(#1a6b2e, #7ee787);
|
|
170
|
+
--t-code-number: light-dark(#a3410b, #ffa657);
|
|
171
|
+
--t-code-literal: light-dark(#7a3db8, #d2a8ff);
|
|
172
|
+
--t-code-punctuation: var(--tblr-secondary-color);
|
|
173
|
+
--t-code-comment: var(--tblr-secondary-color);
|
|
174
|
+
position: relative;
|
|
175
|
+
min-width: 0;
|
|
176
|
+
color: var(--tblr-body-color);
|
|
177
|
+
background: var(--tblr-bg-surface-secondary);
|
|
178
|
+
border: var(--tblr-border-width) solid var(--tblr-border-color);
|
|
179
|
+
border-radius: var(--tblr-border-radius);
|
|
180
|
+
}
|
|
181
|
+
.t-code-header {
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: space-between;
|
|
185
|
+
gap: var(--t-space-2, 0.5rem);
|
|
186
|
+
min-height: 2.25rem;
|
|
187
|
+
padding: var(--t-space-1, 0.25rem) var(--t-space-1, 0.25rem) var(--t-space-1, 0.25rem) var(--t-space-3, 0.75rem);
|
|
188
|
+
border-bottom: var(--tblr-border-width) solid var(--tblr-border-color);
|
|
189
|
+
font-size: 0.75rem;
|
|
190
|
+
color: var(--tblr-secondary-color);
|
|
191
|
+
}
|
|
192
|
+
.t-code-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--tblr-font-weight-medium); }
|
|
193
|
+
.t-code-actions { display: flex; align-items: center; gap: var(--t-space-1, 0.25rem); flex-shrink: 0; }
|
|
194
|
+
.t-code-copy { position: absolute; top: var(--t-space-1, 0.25rem); right: var(--t-space-1, 0.25rem); z-index: 1; }
|
|
195
|
+
.t-code-body {
|
|
196
|
+
overflow: auto;
|
|
197
|
+
margin: 0;
|
|
198
|
+
padding: var(--t-space-3, 0.75rem);
|
|
199
|
+
font-family: var(--tblr-font-monospace);
|
|
200
|
+
font-size: 0.75rem;
|
|
201
|
+
line-height: 1.25rem;
|
|
202
|
+
white-space: pre-wrap;
|
|
203
|
+
overflow-wrap: anywhere;
|
|
204
|
+
/* Tabler gives a pre light text on a dark background; this one sits on the block's surface. */
|
|
205
|
+
color: inherit;
|
|
206
|
+
background: transparent;
|
|
207
|
+
border: 0;
|
|
208
|
+
border-radius: 0;
|
|
209
|
+
}
|
|
210
|
+
/* Room for the corner copy button, so the first line doesn't run under it. */
|
|
211
|
+
.t-code:not(.t-code-headed) > .t-code-body { padding-right: calc(var(--t-space-3, 0.75rem) + 2rem); }
|
|
212
|
+
.t-code-body:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: -2px; }
|
|
213
|
+
.t-code-nowrap .t-code-body { white-space: pre; overflow-wrap: normal; }
|
|
214
|
+
.t-code-body code { padding: 0; font-size: inherit; color: inherit; background: none; }
|
|
215
|
+
.t-code-key { color: var(--t-code-key); }
|
|
216
|
+
.t-code-string { color: var(--t-code-string); }
|
|
217
|
+
.t-code-number { color: var(--t-code-number); }
|
|
218
|
+
.t-code-literal { color: var(--t-code-literal); }
|
|
219
|
+
.t-code-punctuation { color: var(--t-code-punctuation); }
|
|
220
|
+
.t-code-comment { color: var(--t-code-comment); font-style: italic; }
|
|
221
|
+
|
|
222
|
+
/* An HTTP method's badge (TMethodBadge): one width, so paths beside a column of them line up. */
|
|
223
|
+
.t-method-badge {
|
|
224
|
+
min-width: 4.25rem;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
font-family: var(--tblr-font-monospace);
|
|
227
|
+
font-weight: var(--tblr-font-weight-bold);
|
|
228
|
+
letter-spacing: 0.02em;
|
|
229
|
+
}
|
|
230
|
+
|
|
161
231
|
/* A stat card's tinted icon square. */
|
|
162
232
|
.t-stat-icon {
|
|
163
233
|
display: grid;
|