@dita-viewer/core 0.2.1 → 0.2.3
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 +20 -7
- package/dist/editor/renderContext.d.ts +7 -0
- package/dist/editor/renderContext.js +24 -0
- package/dist/editor/topicRender.d.ts +9 -0
- package/dist/editor/topicRender.js +4 -2
- package/dist/language/ditaLanguageUtils.d.ts +15 -2
- package/dist/language/ditaLanguageUtils.js +36 -4
- package/dist/profiling.d.ts +7 -1
- package/dist/profiling.js +9 -3
- package/dist/render/baseTypeMap.js +28 -2
- package/dist/render/renderer.d.ts +24 -0
- package/dist/render/renderer.js +47 -10
- package/dist-esm/bookRender.js +145 -0
- package/dist-esm/completion.js +142 -0
- package/dist-esm/completionData.js +155 -0
- package/dist-esm/diagnostics.js +378 -0
- package/dist-esm/editor/conkeyref.js +104 -0
- package/dist-esm/editor/keySpace.js +201 -0
- package/dist-esm/editor/refResolvers.js +633 -0
- package/dist-esm/editor/renderContext.js +138 -0
- package/dist-esm/editor/sourceText.js +142 -0
- package/dist-esm/editor/topicRender.js +328 -0
- package/dist-esm/index.js +66 -0
- package/dist-esm/keyMapForDocument.js +23 -0
- package/dist-esm/language/ditaLanguageUtils.js +689 -0
- package/dist-esm/language/referenceableFiles.js +108 -0
- package/dist-esm/mapRender.js +24 -0
- package/dist-esm/package.json +1 -0
- package/dist-esm/parser/ditaParser.js +409 -0
- package/dist-esm/parser/domTypes.js +1 -0
- package/dist-esm/parser/mapTagMap.js +77 -0
- package/dist-esm/parser/namedEntities.js +321 -0
- package/dist-esm/parser/standardTagMap.js +393 -0
- package/dist-esm/profiling.js +224 -0
- package/dist-esm/render/baseTypeMap.js +1057 -0
- package/dist-esm/render/cjkSpacing.js +94 -0
- package/dist-esm/render/mapTypeMap.js +568 -0
- package/dist-esm/render/renderer.js +529 -0
- package/dist-esm/siteRender.js +261 -0
- package/package.json +4 -2
- package/styles/TOKENS.md +21 -0
- package/styles/dita-content.css +31 -17
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// Render one page of a .ditamap as a small site: the current topic plus a
|
|
2
|
+
// sidebar manifest of every topic in the map.
|
|
3
|
+
//
|
|
4
|
+
// The manifest is built from the same flattened entries bookRender uses, so
|
|
5
|
+
// the sidebar and the pages agree on which topics are members and in what
|
|
6
|
+
// order. Only the pages themselves are rendered one at a time; when the map
|
|
7
|
+
// leaves an entry unnamed, the sidebar sniffs that topic's own <title> for a
|
|
8
|
+
// readable label (explicit navtitles/linktext win and cost no read). Book view
|
|
9
|
+
// still shows every topic's title because it renders every page.
|
|
10
|
+
//
|
|
11
|
+
// The page wrapper carries data-dita-book-file, exactly like a book section,
|
|
12
|
+
// so the host can open relative links and "reveal in source" against the
|
|
13
|
+
// topic that contains them. A cross-file xref renders as
|
|
14
|
+
// data-dita-book-xref="path#id" (see baseTypeMap.ts); the host uses this
|
|
15
|
+
// manifest to switch pages before scrolling to the anchor.
|
|
16
|
+
import { statSync } from 'fs';
|
|
17
|
+
import { dirname, resolve } from 'path';
|
|
18
|
+
import { parseDitamap, preprocessEntities } from './parser/ditaParser';
|
|
19
|
+
import { decodeHrefPart, expandDitamapRefs } from './editor/refResolvers';
|
|
20
|
+
import { readSourceText } from './editor/sourceText';
|
|
21
|
+
import { renderTopicXml } from './editor/topicRender';
|
|
22
|
+
import { collectMapEntries, getMapTitleText } from './render/mapTypeMap';
|
|
23
|
+
import { topicPathOf } from './bookRender';
|
|
24
|
+
import { pruneExcluded } from './profiling';
|
|
25
|
+
function escapeHtml(s) {
|
|
26
|
+
return s
|
|
27
|
+
.replace(/&/g, '&')
|
|
28
|
+
.replace(/</g, '<')
|
|
29
|
+
.replace(/>/g, '>')
|
|
30
|
+
.replace(/"/g, '"')
|
|
31
|
+
.replace(/'/g, ''');
|
|
32
|
+
}
|
|
33
|
+
function roleHtml(entry) {
|
|
34
|
+
return entry?.role ? `<p class="dita-site-role">${escapeHtml(entry.role)}</p>` : '';
|
|
35
|
+
}
|
|
36
|
+
function decodeXmlText(s) {
|
|
37
|
+
return s.replace(/&(amp|lt|gt|quot|apos|#\d+|#x[0-9a-f]+);/gi, (all, name) => {
|
|
38
|
+
const lower = name.toLowerCase();
|
|
39
|
+
if (lower === 'amp')
|
|
40
|
+
return '&';
|
|
41
|
+
if (lower === 'lt')
|
|
42
|
+
return '<';
|
|
43
|
+
if (lower === 'gt')
|
|
44
|
+
return '>';
|
|
45
|
+
if (lower === 'quot')
|
|
46
|
+
return '"';
|
|
47
|
+
if (lower === 'apos')
|
|
48
|
+
return "'";
|
|
49
|
+
const code = lower.startsWith('#x') ? parseInt(lower.slice(2), 16) : parseInt(lower.slice(1), 10);
|
|
50
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : all;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A topic file's first <title>, cheaply -- no DOM and no render. The sidebar
|
|
55
|
+
* only needs a label, and maps routinely leave entries unnamed. Explicit map
|
|
56
|
+
* navtitles win (buildSiteNav only calls this when the map named nothing), so
|
|
57
|
+
* a well-authored map pays no file reads here. Keyrefs in a title are filled
|
|
58
|
+
* from the map's key space before tags are stripped.
|
|
59
|
+
*/
|
|
60
|
+
/** The first <title>'s markup, before keyrefs are filled; undefined if there is none. */
|
|
61
|
+
function rawTitleFromXml(xml) {
|
|
62
|
+
let text;
|
|
63
|
+
try {
|
|
64
|
+
text = preprocessEntities(xml);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const withoutComments = text.replace(/<!--[\s\S]*?-->/g, '');
|
|
70
|
+
return /<title\b[^>]*>([\s\S]*?)<\/title\s*>/i.exec(withoutComments)?.[1];
|
|
71
|
+
}
|
|
72
|
+
function finishTitle(raw, resolveKey) {
|
|
73
|
+
const withKeys = raw.replace(/<[^>]*\bkeyref=(?:"([^"]+)"|'([^']+)')[^>]*\/?>/gi, (all, doubleQuoted, singleQuoted) => resolveKey(decodeXmlText(doubleQuoted ?? singleQuoted ?? '')) ?? all);
|
|
74
|
+
const plain = decodeXmlText(withKeys
|
|
75
|
+
.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, '$1')
|
|
76
|
+
.replace(/<[^>]+>/g, ''))
|
|
77
|
+
.replace(/\s+/g, ' ')
|
|
78
|
+
.trim();
|
|
79
|
+
return plain || undefined;
|
|
80
|
+
}
|
|
81
|
+
/** modified time + size, or undefined when the file cannot be statted (then nothing is cached). */
|
|
82
|
+
function fileStamp(absPath) {
|
|
83
|
+
try {
|
|
84
|
+
const st = statSync(absPath);
|
|
85
|
+
return `${st.mtimeMs}:${st.size}`;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function pageOpen(absPath, depth) {
|
|
92
|
+
const depthAttr = depth === undefined ? '' : ` data-depth="${depth}"`;
|
|
93
|
+
return `<article class="dita-site-page" data-dita-book-file="${escapeHtml(absPath)}"${depthAttr}>`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Builds the sidebar manifest. Depth is compacted: an entry dropped here
|
|
97
|
+
* (resource-only, duplicate topic, or a childless href-less entry) leaves no
|
|
98
|
+
* hole above its surviving descendants. The caller resolves the current page
|
|
99
|
+
* from `members`.
|
|
100
|
+
*/
|
|
101
|
+
function buildSiteNav(entries, docDir, readFile, resolveKey, dependencies, titleCache) {
|
|
102
|
+
const nav = [];
|
|
103
|
+
const members = [];
|
|
104
|
+
const seen = new Set();
|
|
105
|
+
const survivingAncestors = [];
|
|
106
|
+
for (let i = 0; i < entries.length; i++) {
|
|
107
|
+
const entry = entries[i];
|
|
108
|
+
while (survivingAncestors.length > 0 &&
|
|
109
|
+
survivingAncestors[survivingAncestors.length - 1] >= entry.depth) {
|
|
110
|
+
survivingAncestors.pop();
|
|
111
|
+
}
|
|
112
|
+
const depth = survivingAncestors.length;
|
|
113
|
+
if (entry.resourceOnly)
|
|
114
|
+
continue;
|
|
115
|
+
const absPath = topicPathOf(entry, docDir);
|
|
116
|
+
if (absPath) {
|
|
117
|
+
if (seen.has(absPath))
|
|
118
|
+
continue;
|
|
119
|
+
seen.add(absPath);
|
|
120
|
+
members.push(absPath);
|
|
121
|
+
dependencies.add(absPath);
|
|
122
|
+
let title = entry.displayName;
|
|
123
|
+
if (!entry.displayNameExplicit) {
|
|
124
|
+
try {
|
|
125
|
+
const stamp = titleCache ? fileStamp(absPath) : undefined;
|
|
126
|
+
const hit = stamp !== undefined ? titleCache?.get(absPath) : undefined;
|
|
127
|
+
let raw;
|
|
128
|
+
if (hit && hit.stamp === stamp) {
|
|
129
|
+
raw = hit.title;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
raw = rawTitleFromXml(readFile(absPath)) ?? null;
|
|
133
|
+
if (stamp !== undefined)
|
|
134
|
+
titleCache?.set(absPath, { stamp, title: raw });
|
|
135
|
+
}
|
|
136
|
+
title = (raw === null ? undefined : finishTitle(raw, resolveKey)) ?? title;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Missing or unreadable: the map's own fallback label is still
|
|
140
|
+
// better than dropping the page from the sidebar.
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
nav.push({
|
|
144
|
+
absPath,
|
|
145
|
+
title,
|
|
146
|
+
depth,
|
|
147
|
+
role: entry.role,
|
|
148
|
+
href: entry.href,
|
|
149
|
+
});
|
|
150
|
+
survivingAncestors.push(entry.depth);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
// A href that resolved to nothing is an external link, a PDF, a .ditamap
|
|
154
|
+
// that wasn't expanded, or a fragment-only reference. None is a page.
|
|
155
|
+
if (entry.href)
|
|
156
|
+
continue;
|
|
157
|
+
if (!entry.displayName)
|
|
158
|
+
continue;
|
|
159
|
+
const hasChildren = i + 1 < entries.length && entries[i + 1].depth > entry.depth;
|
|
160
|
+
if (!hasChildren)
|
|
161
|
+
continue;
|
|
162
|
+
nav.push({
|
|
163
|
+
title: entry.displayName,
|
|
164
|
+
depth,
|
|
165
|
+
role: entry.role,
|
|
166
|
+
isGroup: true,
|
|
167
|
+
});
|
|
168
|
+
survivingAncestors.push(entry.depth);
|
|
169
|
+
}
|
|
170
|
+
return { entries: nav, members };
|
|
171
|
+
}
|
|
172
|
+
export function renderSiteXml(input) {
|
|
173
|
+
const doc = parseDitamap(preprocessEntities(input.xml));
|
|
174
|
+
const dependencies = input.collectDependencies ?? new Set();
|
|
175
|
+
const readFile = input.readFile ?? ((path) => readSourceText(path, 'utf-8'));
|
|
176
|
+
const read = (path, _enc) => {
|
|
177
|
+
dependencies.add(resolve(path));
|
|
178
|
+
return readFile(path);
|
|
179
|
+
};
|
|
180
|
+
expandDitamapRefs(doc.root, input.docDir, read);
|
|
181
|
+
pruneExcluded(doc.root, input.filter);
|
|
182
|
+
const keyMap = input.keyMap ?? new Map();
|
|
183
|
+
const resolveKey = (key) => keyMap.get(key);
|
|
184
|
+
const mapEntries = collectMapEntries(doc.root, resolveKey, input.roleFormat);
|
|
185
|
+
const title = getMapTitleText(doc.root, resolveKey);
|
|
186
|
+
const { entries, members } = buildSiteNav(mapEntries, input.docDir, readFile, resolveKey, dependencies, input.titleCache);
|
|
187
|
+
// The page is a dependency whether it exists or not: creating a missing
|
|
188
|
+
// topic should make the site re-render, just like editing an existing one.
|
|
189
|
+
for (const member of members)
|
|
190
|
+
dependencies.add(member);
|
|
191
|
+
const requested = input.current ? resolve(input.current) : undefined;
|
|
192
|
+
const current = requested && members.includes(requested) ? requested : members[0];
|
|
193
|
+
const currentEntry = entries.find((entry) => entry.absPath === current);
|
|
194
|
+
if (!current) {
|
|
195
|
+
const empty = input.labels?.noTopics ?? 'This map has no topics.';
|
|
196
|
+
return {
|
|
197
|
+
html: `<article class="dita-site-page dita-site-empty">` +
|
|
198
|
+
`<p class="dita-site-empty-text">${escapeHtml(empty)}</p></article>`,
|
|
199
|
+
title,
|
|
200
|
+
entries,
|
|
201
|
+
members,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
let xml;
|
|
205
|
+
try {
|
|
206
|
+
xml = readFile(current);
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
const missing = input.labels?.missingTopic ?? 'Missing topic';
|
|
210
|
+
return {
|
|
211
|
+
html: pageOpen(current, currentEntry?.depth) +
|
|
212
|
+
`${roleHtml(currentEntry)}` +
|
|
213
|
+
`<p class="dita-site-missing">${escapeHtml(missing)}: ` +
|
|
214
|
+
`<code>${escapeHtml(currentEntry?.href ?? current)}</code></p></article>`,
|
|
215
|
+
title,
|
|
216
|
+
entries,
|
|
217
|
+
members,
|
|
218
|
+
current,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const topicDir = dirname(current);
|
|
222
|
+
const asWebviewUri = (relPath) => {
|
|
223
|
+
if (!input.toResourceUrl)
|
|
224
|
+
return '';
|
|
225
|
+
return input.toResourceUrl(resolve(topicDir, decodeHrefPart(relPath)));
|
|
226
|
+
};
|
|
227
|
+
const result = renderTopicXml({
|
|
228
|
+
xml,
|
|
229
|
+
docDir: topicDir,
|
|
230
|
+
keyMap,
|
|
231
|
+
asWebviewUri,
|
|
232
|
+
// One topic per page: every topic is a top-level heading here, whatever
|
|
233
|
+
// its nesting depth in the map (that depth is the sidebar's business).
|
|
234
|
+
headingLevel: 1,
|
|
235
|
+
uiLanguage: input.uiLanguage,
|
|
236
|
+
collectDependencies: dependencies,
|
|
237
|
+
bookMembers: new Set(members),
|
|
238
|
+
docFile: current,
|
|
239
|
+
markConrefs: true,
|
|
240
|
+
});
|
|
241
|
+
if (result.error !== undefined) {
|
|
242
|
+
return {
|
|
243
|
+
html: pageOpen(current, currentEntry?.depth) +
|
|
244
|
+
`${roleHtml(currentEntry)}` +
|
|
245
|
+
`<p class="dita-site-error">${escapeHtml(result.error)}</p></article>`,
|
|
246
|
+
title,
|
|
247
|
+
entries,
|
|
248
|
+
members,
|
|
249
|
+
current,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
html: pageOpen(current, currentEntry?.depth) +
|
|
254
|
+
`${roleHtml(currentEntry)}${result.html}</article>`,
|
|
255
|
+
title,
|
|
256
|
+
topicTitle: result.title,
|
|
257
|
+
entries,
|
|
258
|
+
members,
|
|
259
|
+
current,
|
|
260
|
+
};
|
|
261
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dita-viewer/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Host-neutral DITA parsing and HTML rendering core, shared by the VS Code DITA Viewer and obsidian-dita.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dita",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
|
+
"module": "./dist-esm/index.js",
|
|
30
31
|
"default": "./dist/index.js"
|
|
31
32
|
},
|
|
32
33
|
"./styles/dita-content.css": "./styles/dita-content.css",
|
|
@@ -34,12 +35,13 @@
|
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
36
37
|
"dist",
|
|
38
|
+
"dist-esm",
|
|
37
39
|
"styles",
|
|
38
40
|
"!dist/**/*.map"
|
|
39
41
|
],
|
|
40
42
|
"scripts": {
|
|
41
43
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
42
|
-
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.esm.json && node scripts/mark-esm.cjs",
|
|
43
45
|
"pretest": "node -e \"require('fs').rmSync('dist-test',{recursive:true,force:true})\" && tsc -p tsconfig.test.json",
|
|
44
46
|
"test": "mocha --config .mocharc.json",
|
|
45
47
|
"prepublishOnly": "npm run build"
|
package/styles/TOKENS.md
CHANGED
|
@@ -22,6 +22,27 @@ carries the content (`:host` for a Shadow DOM, `:root` for a document).
|
|
|
22
22
|
Every use inside the stylesheet carries a fallback, so a host that defines only
|
|
23
23
|
some tokens still renders legibly.
|
|
24
24
|
|
|
25
|
+
## Optional tokens for floating chrome
|
|
26
|
+
|
|
27
|
+
The image button, the right-click menu and the copy toast can be coloured
|
|
28
|
+
separately from the rest. A host that has no separate colours defines none of
|
|
29
|
+
these: each one falls back to the token in the last column, which is what the
|
|
30
|
+
stylesheet used before they existed.
|
|
31
|
+
|
|
32
|
+
| Token | Meaning | Falls back to |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `--dita-btn-border` | Border of the image toolbar buttons | `--dita-border` |
|
|
35
|
+
| `--dita-btn-fg` | Text of the image toolbar buttons | `--dita-fg` |
|
|
36
|
+
| `--dita-menu-bg` | Context menu background | `--dita-bg-elevated`, then `--dita-bg` |
|
|
37
|
+
| `--dita-menu-border` | Context menu border | `--dita-border` |
|
|
38
|
+
| `--dita-menu-fg` | Context menu item text | `--dita-fg` |
|
|
39
|
+
| `--dita-menu-hover-bg` | Hovered or focused menu item background | `--dita-hover-bg` |
|
|
40
|
+
| `--dita-menu-hover-fg` | Hovered or focused menu item text | `--dita-selected-fg`, then `--dita-fg` |
|
|
41
|
+
| `--dita-menu-sep` | Divider between menu groups | `--dita-border` |
|
|
42
|
+
| `--dita-toast-bg` | Copy toast background | `--dita-bg-elevated`, then `--dita-bg` |
|
|
43
|
+
| `--dita-toast-border` | Copy toast border | `--dita-border` |
|
|
44
|
+
| `--dita-toast-fg` | Copy toast text | `--dita-fg` |
|
|
45
|
+
|
|
25
46
|
## The palette
|
|
26
47
|
|
|
27
48
|
Callouts, profiling highlights, index chips and conref tints use `--color-*`
|
package/styles/dita-content.css
CHANGED
|
@@ -8,10 +8,14 @@
|
|
|
8
8
|
* so the sheet no longer knows which application is hosting it;
|
|
9
9
|
* - :root / .vscode-dark selectors also match a Shadow DOM host
|
|
10
10
|
* (:host / :host([data-scheme="dark"]));
|
|
11
|
-
* - `body` rules
|
|
12
|
-
* `:host(.dv-conref-hot)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* - `body` rules also match `.dita-body`, `html.dv-conref-hot` also
|
|
12
|
+
* matches `:host(.dv-conref-hot)` (the extra selector matches nothing in
|
|
13
|
+
* the other kind of host, so one sheet serves both);
|
|
14
|
+
* - the image button, context menu and toast read finer tokens
|
|
15
|
+
* (--dita-btn-*, --dita-menu-*, --dita-toast-*) that fall back to the
|
|
16
|
+
* shared ones, so a host that defines only the shared tokens is unchanged;
|
|
17
|
+
* - the two #c0392b literals in .hazardstatement use --color-danger-border
|
|
18
|
+
* (identical value by default; the extension now does the same).
|
|
15
19
|
* A host supplies colours, fonts and sizes by defining the --dita-* tokens
|
|
16
20
|
* (and may override the --color-* palette); it never edits this file.
|
|
17
21
|
*/
|
|
@@ -70,7 +74,7 @@
|
|
|
70
74
|
--color-menucascade-arrow: #aaaaaa;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
.dita-body {
|
|
77
|
+
body, .dita-body {
|
|
74
78
|
font-family: var(--body-font);
|
|
75
79
|
font-size: 1em;
|
|
76
80
|
line-height: var(--line-height);
|
|
@@ -182,6 +186,7 @@ p { margin: 0.75em 0; }
|
|
|
182
186
|
/* The note text sits in .note__body for the benefit of WebHelp-style css. In
|
|
183
187
|
the own shell it stays inline, so the label and the text share a line as
|
|
184
188
|
they always did (a block here pushes the text onto its own line). */
|
|
189
|
+
body:not(.wh_topic_page) .note__body,
|
|
185
190
|
.dita-body:not(.wh_topic_page) .note__body { display: inline; }
|
|
186
191
|
.note--warning { border-left-color: var(--color-warning-border); background: var(--color-warning-bg); }
|
|
187
192
|
.note--danger { border-left-color: var(--color-danger-border); background: var(--color-danger-bg); }
|
|
@@ -315,6 +320,8 @@ ol[data-conref="block"][data-conref],
|
|
|
315
320
|
}
|
|
316
321
|
/* Set by the hover hit-test in conrefJumpScript.ts while the pointer is over
|
|
317
322
|
the icon (a background cannot take its own cursor). */
|
|
323
|
+
html.dv-conref-hot [data-conref],
|
|
324
|
+
html.dv-conref-hot [data-conref] *,
|
|
318
325
|
:host(.dv-conref-hot) [data-conref],
|
|
319
326
|
:host(.dv-conref-hot) [data-conref] * {
|
|
320
327
|
cursor: pointer;
|
|
@@ -549,6 +556,7 @@ ol[data-conref="block"][data-conref],
|
|
|
549
556
|
}
|
|
550
557
|
.indexterm-chip--ref { font-style: italic; }
|
|
551
558
|
.indexterm-chip__see { font-style: italic; opacity: 0.85; }
|
|
559
|
+
body.hide-profiling .profiled,
|
|
552
560
|
.dita-body.hide-profiling .profiled {
|
|
553
561
|
background: none;
|
|
554
562
|
box-shadow: none;
|
|
@@ -562,11 +570,15 @@ ol[data-conref="block"][data-conref],
|
|
|
562
570
|
restoring it here, turning Flags off would silently break nested-list
|
|
563
571
|
indentation for exactly the same reason it broke with the box visible,
|
|
564
572
|
just conditionally instead of always. */
|
|
573
|
+
body.hide-profiling ul.profiled,
|
|
574
|
+
body.hide-profiling ol.profiled,
|
|
565
575
|
.dita-body.hide-profiling ul.profiled,
|
|
566
576
|
.dita-body.hide-profiling ol.profiled {
|
|
567
577
|
padding-left: 1.5em;
|
|
568
578
|
}
|
|
579
|
+
body.hide-profiling .profiled--inline,
|
|
569
580
|
.dita-body.hide-profiling .profiled--inline { display: inline; }
|
|
581
|
+
body.hide-profiling .profiling-label,
|
|
570
582
|
.dita-body.hide-profiling .profiling-label { display: none; }
|
|
571
583
|
|
|
572
584
|
/* Phase 2 (the filter panel): actually hides content, unlike the toggle
|
|
@@ -630,6 +642,8 @@ tr.profiled > td,
|
|
|
630
642
|
tr.profiled > th {
|
|
631
643
|
border-color: var(--color-profiling-border);
|
|
632
644
|
}
|
|
645
|
+
body.hide-profiling tr.profiled > td,
|
|
646
|
+
body.hide-profiling tr.profiled > th,
|
|
633
647
|
.dita-body.hide-profiling tr.profiled > td,
|
|
634
648
|
.dita-body.hide-profiling tr.profiled > th {
|
|
635
649
|
border-color: var(--table-border);
|
|
@@ -688,9 +702,9 @@ img[data-load-error] { cursor: default; }
|
|
|
688
702
|
}
|
|
689
703
|
.dita-img-btn {
|
|
690
704
|
padding: 1px 5px; border-radius: 3px; line-height: 1.5; font-size: 12px; cursor: pointer;
|
|
691
|
-
border: 1px solid var(--dita-border, #555);
|
|
705
|
+
border: 1px solid var(--dita-btn-border, var(--dita-border, #555));
|
|
692
706
|
background: var(--dita-bg, rgba(30, 30, 30, 0.85));
|
|
693
|
-
color: var(--dita-fg, #eee);
|
|
707
|
+
color: var(--dita-btn-fg, var(--dita-fg, #eee));
|
|
694
708
|
}
|
|
695
709
|
.dita-img-btn:hover { opacity: 0.85; }
|
|
696
710
|
|
|
@@ -700,8 +714,8 @@ img[data-load-error] { cursor: default; }
|
|
|
700
714
|
available consistently across every host this extension runs in. */
|
|
701
715
|
.dita-img-ctxmenu {
|
|
702
716
|
position: fixed; z-index: 100000;
|
|
703
|
-
background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
|
|
704
|
-
border: 1px solid var(--dita-border, #454545);
|
|
717
|
+
background: var(--dita-menu-bg, var(--dita-bg-elevated, var(--dita-bg, #1e1e1e)));
|
|
718
|
+
border: 1px solid var(--dita-menu-border, var(--dita-border, #454545));
|
|
705
719
|
border-radius: 4px;
|
|
706
720
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
|
|
707
721
|
padding: 2px;
|
|
@@ -712,12 +726,12 @@ img[data-load-error] { cursor: default; }
|
|
|
712
726
|
padding: 4px 10px; border: none; border-radius: 3px;
|
|
713
727
|
font-size: 13px; cursor: pointer;
|
|
714
728
|
background: transparent;
|
|
715
|
-
color: var(--dita-fg, #ccc);
|
|
729
|
+
color: var(--dita-menu-fg, var(--dita-fg, #ccc));
|
|
716
730
|
}
|
|
717
731
|
.dita-img-ctxmenu-item:hover,
|
|
718
732
|
.dita-img-ctxmenu-item:focus {
|
|
719
|
-
background: var(--dita-hover-bg, #2a2d2e);
|
|
720
|
-
color: var(--dita-selected-fg, var(--dita-fg, #ccc));
|
|
733
|
+
background: var(--dita-menu-hover-bg, var(--dita-hover-bg, #2a2d2e));
|
|
734
|
+
color: var(--dita-menu-hover-fg, var(--dita-selected-fg, var(--dita-fg, #ccc)));
|
|
721
735
|
outline: none;
|
|
722
736
|
}
|
|
723
737
|
.dita-img-ctxmenu-item:disabled { cursor: default; opacity: 0.7; }
|
|
@@ -725,7 +739,7 @@ img[data-load-error] { cursor: default; }
|
|
|
725
739
|
getSiteOpenSourceScript), matching how a native menu separates groups. */
|
|
726
740
|
.dita-img-ctxmenu-sep {
|
|
727
741
|
height: 1px; margin: 2px 4px;
|
|
728
|
-
background: var(--dita-border, #454545);
|
|
742
|
+
background: var(--dita-menu-sep, var(--dita-border, #454545));
|
|
729
743
|
}
|
|
730
744
|
|
|
731
745
|
/* Transient feedback pill for the lightbox's Ctrl+C copy path, which has
|
|
@@ -733,9 +747,9 @@ img[data-load-error] { cursor: default; }
|
|
|
733
747
|
.dita-img-toast {
|
|
734
748
|
position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
|
|
735
749
|
z-index: 100001;
|
|
736
|
-
background: var(--dita-bg-elevated, var(--dita-bg, #1e1e1e));
|
|
737
|
-
border: 1px solid var(--dita-border, #454545);
|
|
738
|
-
color: var(--dita-fg, #ccc);
|
|
750
|
+
background: var(--dita-toast-bg, var(--dita-bg-elevated, var(--dita-bg, #1e1e1e)));
|
|
751
|
+
border: 1px solid var(--dita-toast-border, var(--dita-border, #454545));
|
|
752
|
+
color: var(--dita-toast-fg, var(--dita-fg, #ccc));
|
|
739
753
|
padding: 6px 14px; border-radius: 4px; font-size: 13px;
|
|
740
754
|
/* UI chrome, not document content: stays sans-serif regardless of the
|
|
741
755
|
reading-font toggle (Serif is a common choice there, and a serif toast
|
|
@@ -1089,7 +1103,7 @@ section, .example { margin: 1.5rem 0; }
|
|
|
1089
1103
|
font-weight: 600;
|
|
1090
1104
|
letter-spacing: 0.03em;
|
|
1091
1105
|
text-transform: uppercase;
|
|
1092
|
-
color: var(--color-link);
|
|
1106
|
+
color: var(--color-link, #4a76c9);
|
|
1093
1107
|
border: 1px solid currentColor;
|
|
1094
1108
|
opacity: 0.85;
|
|
1095
1109
|
vertical-align: 0.1em;
|