@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.
Files changed (42) hide show
  1. package/README.md +20 -7
  2. package/dist/editor/renderContext.d.ts +7 -0
  3. package/dist/editor/renderContext.js +24 -0
  4. package/dist/editor/topicRender.d.ts +9 -0
  5. package/dist/editor/topicRender.js +4 -2
  6. package/dist/language/ditaLanguageUtils.d.ts +15 -2
  7. package/dist/language/ditaLanguageUtils.js +36 -4
  8. package/dist/profiling.d.ts +7 -1
  9. package/dist/profiling.js +9 -3
  10. package/dist/render/baseTypeMap.js +28 -2
  11. package/dist/render/renderer.d.ts +24 -0
  12. package/dist/render/renderer.js +47 -10
  13. package/dist-esm/bookRender.js +145 -0
  14. package/dist-esm/completion.js +142 -0
  15. package/dist-esm/completionData.js +155 -0
  16. package/dist-esm/diagnostics.js +378 -0
  17. package/dist-esm/editor/conkeyref.js +104 -0
  18. package/dist-esm/editor/keySpace.js +201 -0
  19. package/dist-esm/editor/refResolvers.js +633 -0
  20. package/dist-esm/editor/renderContext.js +138 -0
  21. package/dist-esm/editor/sourceText.js +142 -0
  22. package/dist-esm/editor/topicRender.js +328 -0
  23. package/dist-esm/index.js +66 -0
  24. package/dist-esm/keyMapForDocument.js +23 -0
  25. package/dist-esm/language/ditaLanguageUtils.js +689 -0
  26. package/dist-esm/language/referenceableFiles.js +108 -0
  27. package/dist-esm/mapRender.js +24 -0
  28. package/dist-esm/package.json +1 -0
  29. package/dist-esm/parser/ditaParser.js +409 -0
  30. package/dist-esm/parser/domTypes.js +1 -0
  31. package/dist-esm/parser/mapTagMap.js +77 -0
  32. package/dist-esm/parser/namedEntities.js +321 -0
  33. package/dist-esm/parser/standardTagMap.js +393 -0
  34. package/dist-esm/profiling.js +224 -0
  35. package/dist-esm/render/baseTypeMap.js +1057 -0
  36. package/dist-esm/render/cjkSpacing.js +94 -0
  37. package/dist-esm/render/mapTypeMap.js +568 -0
  38. package/dist-esm/render/renderer.js +529 -0
  39. package/dist-esm/siteRender.js +261 -0
  40. package/package.json +4 -2
  41. package/styles/TOKENS.md +21 -0
  42. package/styles/dita-content.css +31 -17
@@ -0,0 +1,23 @@
1
+ // Host-neutral key map lookup for one document.
2
+ //
3
+ // The VS Code host builds this in editor/keyMap.ts, which also talks to the
4
+ // workspace (context map picker, caches, warnings) and so imports `vscode`.
5
+ // This is the part a host without those features needs: find the ditamaps
6
+ // near the document and resolve their key definitions, the same way the VS
7
+ // Code preview does when no context map is set.
8
+ import { dirname } from 'path';
9
+ import { collectDitamapFilesUpward } from './editor/topicRender';
10
+ import { buildKeySpace } from './editor/keySpace';
11
+ import { readSourceText } from './editor/sourceText';
12
+ /**
13
+ * The whole key space for one document: the key values, each key's resource
14
+ * target, and the map files they were read from. Diagnostics want the values
15
+ * and the files (to watch); render paths and completion want the values map.
16
+ */
17
+ export function buildKeySpaceForDocument(docFile, options) {
18
+ const maps = collectDitamapFilesUpward(dirname(docFile), options.root, options.nearestOnly ?? true);
19
+ return buildKeySpace(undefined, maps, readSourceText, options.onError);
20
+ }
21
+ export function buildKeyMapForDocument(docFile, options) {
22
+ return buildKeySpaceForDocument(docFile, options).keys;
23
+ }